fix(sidebar): expand connection node on double-click activation

This commit is contained in:
Freedom authored and GitHub committed 2026-08-20 10:23:07 +08:00
1 parent 1faf5715f1
commit bd36b5f1d0
2 files changed
+9 -1

No files matched your search

@@ -78,6 +78,12 @@ describe("treeNodeClick", () => {
expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "postgres", false)).toBe("toggle"); expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "postgres", false)).toBe("toggle");
}); });
it("expands the connection node on double-click activation even when the database browser is available", () => {
expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "postgres", true)).toBe("toggle");
expect(treeNodeRowDoubleClickAction("connection", false, "double", true, "mysql", true)).toBe("toggle");
expect(treeNodeRowDoubleClickAction("connection", false, "double", false, "postgres", true)).toBe("none");
});
it("opens the object browser on single click when the database single-click switch is on", () => { it("opens the object browser on single click when the database single-click switch is on", () => {
expect(treeNodeRowAction("database", true, "single", "postgres", true, true)).toBe("open-object-browser-and-expand"); expect(treeNodeRowAction("database", true, "single", "postgres", true, true)).toBe("open-object-browser-and-expand");
expect(treeNodeRowAction("database", false, "single", "postgres", true, true)).toBe("open-object-browser"); expect(treeNodeRowAction("database", false, "single", "postgres", true, true)).toBe("open-object-browser");
@@ -147,7 +147,9 @@ export function treeNodeRowDoubleClickAction(type: TreeNodeType, canOpenObjectBr
// sequence. Only double-click activation needs a second-stage table action. // sequence. Only double-click activation needs a second-stage table action.
if (type === "table") return activation === "double" ? "activate-data" : "none"; if (type === "table") return activation === "double" ? "activate-data" : "none";
if (openDatabaseOnSingleClick && canOpenObjectBrowser && shouldOpenObjectBrowserOnSingleClick(type, true)) return "none"; if (openDatabaseOnSingleClick && canOpenObjectBrowser && shouldOpenObjectBrowserOnSingleClick(type, true)) return "none";
if (type === "connection" && canOpenDatabaseBrowser) return "open-database-browser"; // 双击激活模式下,双击连接节点应当展开树(与单击模式下单击展开一致),
// “打开数据库浏览”只保留给单击激活模式下的双击手势。
if (type === "connection" && canOpenDatabaseBrowser && activation !== "double") return "open-database-browser";
if (activation === "double") { if (activation === "double") {
if (type === "extension") return "open-extension-details"; if (type === "extension") return "open-extension-details";
if (dataNodeTypes.has(type)) return "open-data"; if (dataNodeTypes.has(type)) return "open-data";