fix(sidebar): restore tree node collapsing
This commit is contained in:
3 files changed
+53
-5
No files matched your search
@@ -40,6 +40,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
|
||||
import { codeMirrorSqlDialect } from "@/lib/database/jdbcDialect";
|
||||
import { sqlFormatDialectForDbType } from "@/lib/sql/sqlFormatter";
|
||||
import { createSidebarActionTarget, findSidebarActionTarget, matchesSidebarActionTarget, type SidebarActionTarget } from "@/lib/sidebar/sidebarActionTarget";
|
||||
import { syncSidebarTreeNodeExpansion } from "@/lib/sidebar/sidebarTreeExpansion";
|
||||
import type { SidebarDangerDialogRequest } from "@/lib/sidebar/sidebarDangerDialog";
|
||||
import { resetSidebarTreeDialogState } from "./sidebarTreeDialogState";
|
||||
import { SidebarDangerConfirmDialog, SidebarDdlViewDialog, SidebarObjectSourceDialog, SidebarProcedureExecutionDialog, SidebarVisibleDatabasesDialog, SidebarVisibleSchemasDialog } from "./sidebarAsyncDialogs";
|
||||
@@ -387,7 +388,7 @@ function filterLocallySearchedTables(nodes: TreeNode[]): TreeNode[] {
|
||||
children,
|
||||
)
|
||||
: children.filter((child) => localTableSearchChildTypes.has(child.type) && !!matchSidebarLabel(child.label.toLowerCase(), query.toLowerCase()));
|
||||
return { ...node, children: matchingChildren, isExpanded: true };
|
||||
return { ...node, children: matchingChildren };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -670,10 +671,7 @@ watch(flatNodes, (nodes) => {
|
||||
}
|
||||
}
|
||||
stickyScrollTop.value = 0;
|
||||
void nextTick(() => {
|
||||
treeScrollerRef.value?.forceUpdate(true);
|
||||
scheduleSidebarScrollMetricsUpdate();
|
||||
});
|
||||
void nextTick(scheduleSidebarScrollMetricsUpdate);
|
||||
});
|
||||
|
||||
const sidebarTreeOverflowClass = computed(() => (settingsStore.editorSettings.sidebarAllowHorizontalScroll ? "overflow-x-auto sidebar-tree-horizontal-scroll" : "overflow-x-hidden"));
|
||||
@@ -1186,6 +1184,11 @@ function onSearchToggle(node: TreeNode) {
|
||||
searchCollapsedIds.value = next;
|
||||
}
|
||||
|
||||
function onNodeToggled(node: TreeNode) {
|
||||
if (isTreeSearchFiltering.value) return;
|
||||
syncSidebarTreeNodeExpansion(store.treeNodes, node);
|
||||
}
|
||||
|
||||
function openSidebarContextMenu(event: MouseEvent, node: TreeNode, openContextMenu: (event: MouseEvent, itemsOverride?: ContextMenuItem[]) => void) {
|
||||
const items = sidebarTreeRuntime.buildContextMenu(node);
|
||||
sidebarContextMenuTarget.value = createSidebarActionTarget(node);
|
||||
@@ -1666,6 +1669,7 @@ defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes });
|
||||
:node="sidebarTreeRuntimeInitialNode"
|
||||
:depth="0"
|
||||
@search-toggle="onSearchToggle"
|
||||
@node-toggled="onNodeToggled"
|
||||
@open-ddl="openSidebarDdl"
|
||||
@open-object-source="openSidebarObjectSource"
|
||||
@open-procedure="openSidebarProcedure"
|
||||
|
||||
Reference in new issue
Block a user