Browse Source

Merge pull request #7820 from nocodb/nc-fix/auto-collapse-sidebar-base-table

Nc fix/auto collapse sidebar base table
pull/7835/head
Raju Udava 8 months ago committed by GitHub
parent
commit
3ed1a98338
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue

23
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -45,7 +45,7 @@ provide(SidebarTableInj, table)
const { setMenuContext, openRenameTableDialog, duplicateTable } = inject(TreeViewInj)!
const { loadViews: _loadViews } = useViewsStore()
const { activeView, activeViewTitleOrId } = storeToRefs(useViewsStore())
const { activeView, activeViewTitleOrId, viewsByTable } = storeToRefs(useViewsStore())
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
// todo: temp
@ -138,6 +138,27 @@ watch(
const isTableOpened = computed(() => {
return openedTableId.value === table.value?.id && (activeView.value?.is_default || !activeViewTitleOrId.value)
})
let tableTimeout: number
watch(openedTableId, () => {
if (tableTimeout) {
clearTimeout(tableTimeout)
}
if (table.value.id !== openedTableId.value && isExpanded.value) {
const views = viewsByTable.value.get(table.value.id!)?.filter((v) => !v.is_default) ?? []
if (views.length) return
tableTimeout = setTimeout(() => {
if (isExpanded.value) {
isExpanded.value = false
}
clearTimeout(tableTimeout)
}, 10000)
}
})
</script>
<template>

Loading…
Cancel
Save