Browse Source

feat: auto-expand bases in TreeView

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3573/head
mertmit 2 years ago
parent
commit
e8f19809b7
  1. 19
      packages/nc-gui/components/dashboard/TreeView.vue

19
packages/nc-gui/components/dashboard/TreeView.vue

@ -273,10 +273,23 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
}
})
onMounted(() => {
watch(
activeTable,
(value, oldValue) => {
if (value) {
if (value !== oldValue) {
const fndTable = tables.value.find((el) => el.id === value)
if (fndTable) {
activeKey.value = [`collapse-${fndTable.base_id}`]
}
}
} else {
if (bases.value.filter((el) => el.enabled)[0]?.id)
activeKey.value.push(`collapse-${bases.value.filter((el) => el.enabled)[0].id}`)
})
activeKey.value = [`collapse-${bases.value.filter((el) => el.enabled)[0].id}`]
}
},
{ immediate: true },
)
</script>
<template>

Loading…
Cancel
Save