25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(sidebar): multi-select drag, blank-click deselect, empty-group-name (#681) (#823)
vrustx14fa15531f57
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vueindex d73e401505..0a11b92661 100644--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue@@ -188,6 +188,15 @@ async function scrollToSidebarNode(nodeId: string) {}}+function clearSidebarSelection() {+ // Clicking the blank area of the tree clears the current selection. Row+ // clicks call event.stopPropagation(), so this only fires for blank clicks+ // (issue #681 — selection wasn't cleared in double-click activation mode).+ store.selectedTreeNodeId = null;+ store.selectedTreeNodeIds = [];+ store.treeSelectionAnchorId = null;+}+async function createNewGroup() {const groupId = store.createConnectionGroup(t("connectionGroup.newGroupDefault"));pendingRenameGroupId.value = groupId;@@ -506,6 +515,7 @@ defineExpose({ focusSearch, createNewGroup });ref="treeScrollerRef"class="sidebar-tree connection-tree-scroller min-h-0 flex-1 overflow-y-auto":class="sidebarTreeOverflowClass"+ @click="clearSidebarSelection":items="flatNodes":item-size="SIDEBAR_TREE_ROW_HEIGHT":buffer="SIDEBAR_TREE_SCROLL_BUFFER"@@ -533,6 +543,7 @@ defineExpose({ focusSearch, createNewGroup });ref="plainTreeScrollerRef"class="sidebar-tree min-h-0 flex-1 overflow-y-auto":class="sidebarTreeOverflowClass"+ @click="clearSidebarSelection"><TreeItemv-for="item in flatNodes"diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vueindex 79e638ee2d..8c49ad48fb 100644--- a/apps/desktop/src/components/sidebar/TreeItem.vue+++ b/apps/desktop/src/components/sidebar/TreeItem.vue@@ -530,6 +530,9 @@ function onClick(event: MouseEvent) {event.stopPropagation();return;}+ // Row clicks must not bubble to the tree container, whose click handler+ // clears the selection when the blank area is clicked (issue #681).+ event.stopPropagation();if (event.shiftKey) {selectTreeNodeRange(props.node);rowRef.value?.focus({ preventScroll: true });@@ -2591,15 +2594,18 @@ watch();function finishRenameGroup() {+ // Guard against double invocation: pressing Enter sets isRenamingGroup=false+ // and unmounts the input, which then fires @blur -> finishRenameGroup again.+ // The first call can rebuild the tree and recycle props.node onto a different+ // group, so a second run would act on the wrong group and cascade across+ // groups (issue #681).+ if (!isRenamingGroup.value) return;isRenamingGroup.value = false;const trimmed = renameInput.value.trim();- if (!trimmed) {- connectionStore.deleteConnectionGroup(props.node.id);- return;- }- if (trimmed !== props.node.label) {- connectionStore.renameConnectionGroup(props.node.id, trimmed);- }+ // An empty name cancels the rename and keeps the group as-is — never delete+ // here. Deleting a group is done explicitly via the context menu (issue #681).+ if (!trimmed || trimmed === props.node.label) return;+ connectionStore.renameConnectionGroup(props.node.id, trimmed);}function deleteConnectionGroup() {@@ -2725,7 +2731,13 @@ const {startDrag,updateTarget,clearTarget,-} = useDragSort((draggedId, targetId, position) => connectionStore.reorderSidebarEntry(draggedId, targetId, position));+} = useDragSort((draggedId, targetId, position) => {+ // If the grabbed row is part of a multi-selection, move all selected rows+ // together; otherwise just the grabbed one (issue #681).+ const selected = connectionStore.selectedTreeNodeIds;+ const draggedIds = selected.length > 1 && selected.includes(draggedId) ? [...selected] : [draggedId];+ connectionStore.reorderSidebarEntries(draggedIds, targetId, position);+});const isDraggable = computed(() => {if (props.dragDisabled) return false;diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.tsindex 8d3759c885..0d2ab622e8 100644--- a/apps/desktop/src/stores/connectionStore.ts+++ b/apps/desktop/src/stores/connectionStore.ts@@ -2344,5 +2344,17 @@ export const useConnectionStore = defineStore("connection", () => {reorderSidebarEntry(draggedId: string, targetId: string, position: DropPosition) {updateLayoutAndRebuild(reorderEntryOp(sidebarLayout.value, draggedId, targetId, position));},+ reorderSidebarEntries(draggedIds: string[], targetId: string, position: DropPosition) {+ // Apply each dragged entry in turn so a multi-selection moves together,+ // not just the single grabbed row (issue #681).+ let layout = sidebarLayout.value;+ let changed = false;+ for (const id of draggedIds) {+ if (id === targetId) continue;+ layout = reorderEntryOp(layout, id, targetId, position);+ changed = true;+ }+ if (changed) updateLayoutAndRebuild(layout);+ },};});