diff --git a/packages/ui/src/components/content/ContentListPanel.vue b/packages/ui/src/components/content/ContentListPanel.vue
index 52eb7306f..0c58480cb 100644
--- a/packages/ui/src/components/content/ContentListPanel.vue
+++ b/packages/ui/src/components/content/ContentListPanel.vue
@@ -17,20 +17,25 @@ const props = withDefaults(defineProps<{
locked: false,
})
-const manualSelections: Ref> = ref({})
-const selected: Ref = computed(() => Object.keys(manualSelections.value).filter((item) => manualSelections.value[item]))
+const selectionStates: Ref> = ref({})
+const selected: Ref = computed(() => Object.keys(selectionStates.value).filter((item) => selectionStates.value[item] && props.items.some((x) => x.filename === item)))
const allSelected = ref(false)
+const model = defineModel()
+
+function updateSelection() {
+ model.value = selected.value
+}
+
function setSelected(value: boolean) {
- for (const item of props.items) {
- manualSelections.value[item.filename] = value
+ if (value) {
+ selectionStates.value = Object.fromEntries(props.items.map((item) => [item.filename, true]))
+ } else {
+ selectionStates.value = {}
}
+ updateSelection()
}
-
-defineExpose({
- selected,
-})
@@ -57,12 +62,14 @@ defineExpose({
disable-transform
key-field="filename"
style="height: 100%"
- v-slot="{ item }"
+ v-slot="{ item, index }"
>