feat(sidebar): locate column in data grid on sidebar column click

This commit is contained in:
lxk955 authored and GitHub committed 2026-10-04 16:34:29 +08:00
1 parent 9419e18b79
commit f951983914
14 files changed
+549 -5

No files matched your search

@@ -218,4 +218,11 @@ describe("treeNodeClick", () => {
signature: undefined,
});
});
it("locates column in data grid on single click in single-activation mode and double click in double-activation mode", () => {
expect(treeNodeRowAction("column", false, "single")).toBe("locate-column");
expect(treeNodeRowAction("column", false, "double")).toBe("none");
expect(treeNodeRowDoubleClickAction("column", false, "single")).toBe("none");
expect(treeNodeRowDoubleClickAction("column", false, "double")).toBe("locate-column");
});
});
@@ -2,8 +2,8 @@ import type { DatabaseType, ObjectSourceKind, TreeNode, TreeNodeType } from "@/t
import { customTypeCapabilities, supportsTypeObjectSource } from "@/lib/database/databaseObjectCapabilities";
import { matchesShortcut, type ShortcutLikeEvent } from "@/lib/editor/keyboardShortcuts";
export type TreeNodeRowAction = "open-data" | "open-source" | "open-extension-details" | "open-event-trigger-details" | "open-saved-sql" | "open-object-browser" | "open-object-browser-and-expand" | "toggle" | "none";
export type TreeNodeRowDoubleClickAction = "open-data" | "activate-data" | "open-database-browser" | "open-object-browser" | "open-object-browser-and-expand" | "open-source" | "open-extension-details" | "open-event-trigger-details" | "open-saved-sql" | "toggle" | "none";
export type TreeNodeRowAction = "open-data" | "open-source" | "open-extension-details" | "open-event-trigger-details" | "open-saved-sql" | "open-object-browser" | "open-object-browser-and-expand" | "locate-column" | "toggle" | "none";
export type TreeNodeRowDoubleClickAction = "open-data" | "activate-data" | "open-database-browser" | "open-object-browser" | "open-object-browser-and-expand" | "open-source" | "open-extension-details" | "open-event-trigger-details" | "open-saved-sql" | "locate-column" | "toggle" | "none";
export type SidebarSelectionCopyAction = "copy-name" | "none";
export type SidebarActivation = "single" | "double";
@@ -140,6 +140,7 @@ export function treeNodeRowAction(type: TreeNodeType, canExpand: boolean, activa
if (type === "event-trigger") return "open-event-trigger-details";
if (savedSqlNodeTypes.has(type)) return "open-saved-sql";
if (dataNodeTypes.has(type)) return "open-data";
if (type === "column") return "locate-column";
// PostgreSQL-family custom types: open read-only details (toggle when expandable).
if (type === "type" && customTypeCapabilities(dbType).details) return canExpand ? "toggle" : "none";
// Xugu and other databases: expandable package/type nodes toggle their members.
@@ -172,6 +173,7 @@ export function treeNodeRowDoubleClickAction(type: TreeNodeType, canOpenObjectBr
if (type === "extension") return "open-extension-details";
if (type === "event-trigger") return "open-event-trigger-details";
if (dataNodeTypes.has(type)) return "open-data";
if (type === "column") return "locate-column";
if (type === "type" && customTypeCapabilities(dbType).details) return canExpand ? "toggle" : "none";
if (sourceNodeTypes.has(type) && canOpenTreeNodeSource(type, dbType)) return "open-source";
if (savedSqlNodeTypes.has(type)) return "open-saved-sql";