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(grid): restore first double-click cell editing
zipgdc10323b7c9d
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vueindex c45a6bf054..3fe5f9472d 100644--- a/apps/desktop/src/components/grid/DataGrid.vue+++ b/apps/desktop/src/components/grid/DataGrid.vue@@ -7088,8 +7088,13 @@ function canvasColumnAt(contentX: number): number {return low;}+function canvasEventSurface(event: MouseEvent): HTMLCanvasElement | null {+ const currentTarget = event.currentTarget;+ return currentTarget instanceof HTMLCanvasElement ? currentTarget : activeCanvasSurface();+}+function canvasHitTest(event: MouseEvent): { rowIndex: number; visibleColIdx: number; rowNumber: boolean } | null {- const canvas = activeCanvasSurface();+ const canvas = canvasEventSurface(event);const scroller = canvasScrollerElement();if (!canvas || !scroller) return null;const rect = canvas.getBoundingClientRect();@@ -7203,8 +7208,8 @@ function onDomGridWheel(event: WheelEvent) {function onCanvasMouseMove(event: MouseEvent) {stopReleasedSelectionGesture(event);+ const cursorSurface = canvasEventSurface(event);if (columnHeaderPointerInteractionActive()) {- const cursorSurface = activeCanvasSurface();if (cursorSurface) cursorSurface.style.cursor = "default";onCanvasMouseLeave();return;@@ -7219,7 +7224,6 @@ function onCanvasMouseMove(event: MouseEvent) {}: null;const actualColIdx = next ? visibleColumnIndexes.value[next.visibleColIdx] : undefined;- const cursorSurface = activeCanvasSurface();if (cursorSurface) {const overBooleanInteractive =booleanCellsUseCheckbox.value && hit != null && !hit.rowNumber && hitItem != null && actualColIdx !== undefined && isBooleanGridCell(hitItem, actualColIdx) && canEditCellItem(hitItem, actualColIdx) && booleanInteractiveHitFromCanvasEvent(hitItem, hit, actualColIdx, event);@@ -7271,7 +7275,7 @@ function clearCanvasDetailHover(event?: MouseEvent) {function booleanCheckboxHitFromCanvasEvent(item: RowItem, hit: { rowIndex: number; visibleColIdx: number }, actualColIdx: number, event: MouseEvent): boolean {if (item.data[actualColIdx] === null) return false;- const canvas = activeCanvasSurface();+ const canvas = canvasEventSurface(event);const canvasRect = canvas?.getBoundingClientRect();const cellRect = canvasCellViewportRect(hit.rowIndex, hit.visibleColIdx);if (!canvasRect || !cellRect) return false;@@ -7288,7 +7292,7 @@ function booleanCheckboxHitFromCanvasEvent(item: RowItem, hit: { rowIndex: numbefunction booleanNullTextHitFromCanvasEvent(item: RowItem, hit: { rowIndex: number; visibleColIdx: number }, actualColIdx: number, event: MouseEvent): boolean {if (item.data[actualColIdx] !== null) return false;- const canvas = activeCanvasSurface();+ const canvas = canvasEventSurface(event);const canvasRect = canvas?.getBoundingClientRect();const cellRect = canvasCellViewportRect(hit.rowIndex, hit.visibleColIdx);if (!canvasRect || !cellRect) return false;@@ -12949,6 +12953,7 @@ function currentGridContextMenuItems(): ContextMenuItem[] {width: `${totalWidth}px`,height: `${canvasContentHeight}px`,}"+ @dblclick="onCanvasDblClick"><canvasref="canvasRef"@@ -12962,7 +12967,6 @@ function currentGridContextMenuItems(): ContextMenuItem[] {@mouseleave="onCanvasMouseLeave"@mousedown="onCanvasMouseDown"@contextmenu="onCanvasContext"- @dblclick="onCanvasDblClick"/><canvasref="canvasBackRef"@@ -12976,9 +12980,8 @@ function currentGridContextMenuItems(): ContextMenuItem[] {@mouseleave="onCanvasMouseLeave"@mousedown="onCanvasMouseDown"@contextmenu="onCanvasContext"- @dblclick="onCanvasDblClick"/>- <div ref="canvasOverlayRef" class="canvas-grid-overlay dbx-data-grid-font-family sticky left-0 top-0 z-10 overflow-visible" :style="canvasOverlayStyle">+ <div ref="canvasOverlayRef" class="canvas-grid-overlay dbx-data-grid-font-family sticky left-0 top-0 z-10 overflow-visible" :style="canvasOverlayStyle" @dblclick.stop><div v-if="canvasReadonlyTextCell" class="absolute pointer-events-auto z-20 tabular-nums" :style="canvasReadonlyTextCellStyle" @mousedown.stop @click.stop><DataGridReadonlyTextSelection :value="canvasReadonlyTextCell.value" :expanded="canvasReadonlyTextCell.expanded" @close="closeReadonlyCellTextSelection" @escape="escapeReadonlyCellTextSelection" /></div>diff --git a/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.tsindex c3e1e1b846..e1cf49ce40 100644--- a/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts+++ b/apps/desktop/src/components/grid/__tests__/DataGridSurfaces.spec.ts@@ -142,6 +142,22 @@ describe("DataGrid canvas surfaces", () => {expect(dataGridSource).toContain("const canvas = inactiveCanvasSurface();");expect(dataGridSource).toContain("canvasUsingBackSurface.value = !canvasUsingBackSurface.value;");});++ it("uses the canvas that actually received the event during a surface flip", () => {+ expect(dataGridSource).toContain("function canvasEventSurface(event: MouseEvent): HTMLCanvasElement | null");+ expect(dataGridSource).toContain("const currentTarget = event.currentTarget;");+ expect(dataGridSource).toContain("return currentTarget instanceof HTMLCanvasElement ? currentTarget : activeCanvasSurface();");+ expect(dataGridSource).toContain("const canvas = canvasEventSurface(event);");++ const canvasMouseMove = dataGridSource.slice(dataGridSource.indexOf("function onCanvasMouseMove"), dataGridSource.indexOf("function onCanvasMouseLeave"));+ expect(canvasMouseMove).toContain("const cursorSurface = canvasEventSurface(event);");+ });++ it("handles double clicks on the stable canvas container", () => {+ expect(dataGridSource).toContain('@dblclick="onCanvasDblClick"');+ expect(dataGridSource.match(/@dblclick="onCanvasDblClick"/g)).toHaveLength(1);+ expect(dataGridSource).toContain("@dblclick.stop");+ });});describe("DataGridSearchBar", () => {