Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat(grid): show details for read-only cells

二丫讲梵00f58ebe16e5
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index 72920aaa5f..7a676223b2 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -2855,6 +2855,17 @@ function startDomCellEdit(rowId: number, columnIndex: number, displayText: strin
startCellEdit(rowId, columnIndex, cellEditContentNeedsExpandedEditor({ displayText, editText, target: event.currentTarget }));
}
+function showReadonlyCellDetailsOnDblClick(item: RowItem, rowIndex: number, visibleColIdx: number, actualColIdx: number): boolean {
+ if (canEditCellItem(item, actualColIdx)) return false;
+ showCellDetailsForVisibleCell(rowIndex, visibleColIdx, actualColIdx);
+ return true;
+}
+
+function onDomCellDblClick(item: RowItem, rowIndex: number, visibleColIdx: number, actualColIdx: number, event: MouseEvent) {
+ if (showReadonlyCellDetailsOnDblClick(item, rowIndex, visibleColIdx, actualColIdx)) return;
+ startDomCellEdit(item.id, actualColIdx, formatCellCached(item.data[actualColIdx], actualColIdx), event);
+}
+
function cellEditContentNeedsExpandedEditor(options: { displayText: string; editText: string; target: EventTarget | null }): boolean {
const text = options.editText || options.displayText;
if (text.includes("\n") || text.includes("\r")) return true;
@@ -4687,7 +4698,8 @@ function onCanvasDblClick(event: MouseEvent) {
}
const item = displayItemAt(hit.rowIndex);
const actualColIdx = visibleColumnIndexes.value[hit.visibleColIdx];
- if (!item || actualColIdx === undefined || !canEditCellItem(item, actualColIdx)) return;
+ if (!item || actualColIdx === undefined) return;
+ if (showReadonlyCellDetailsOnDblClick(item, item.displayIndex, hit.visibleColIdx, actualColIdx)) return;
startCellEdit(item.id, actualColIdx, canvasCellContentOverflows(item, actualColIdx, hit.visibleColIdx));
}
@@ -5258,6 +5270,16 @@ function showTransposeCellDetails(rowIndex: number, actualColIdx: number) {
gridRef.value?.focus({ preventScroll: true });
}
+function onTransposeCellDblClick(rowIndex: number, actualColIdx: number, displayText: string, event: MouseEvent) {
+ const item = displayItemAt(rowIndex);
+ if (!item) return;
+ if (!canEditCellItem(item, actualColIdx)) {
+ showTransposeCellDetails(rowIndex, actualColIdx);
+ return;
+ }
+ startDomCellEdit(item.id, actualColIdx, displayText, event);
+}
+
function onTransposeCellContext(rowIndex: number, actualColIdx: number, event: MouseEvent) {
selectTransposeCell(rowIndex, actualColIdx, event);
const item = displayItemAt(rowIndex);
@@ -7716,7 +7738,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
@mouseenter="onTransposeCellMouseenter(cell.recordIndex, cell.valueIndex)"
@mouseleave="onCellMouseleave(cell.recordIndex, cell.valueIndex)"
@contextmenu="onTransposeCellContext(cell.recordIndex, cell.valueIndex, $event)"
- @dblclick.stop="canEditCellItem(displayItems[cell.recordIndex], cell.valueIndex) && startDomCellEdit(displayItems[cell.recordIndex].id, cell.valueIndex, cell.display, $event)"
+ @dblclick.stop="onTransposeCellDblClick(cell.recordIndex, cell.valueIndex, cell.display, $event)"
>
<template v-if="editingCell?.rowId === displayItems[cell.recordIndex]?.id && editingCell?.col === cell.valueIndex">
<TemporalCellEditor
@@ -8369,7 +8391,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
"
@mouseenter="onCellMouseenter(item.displayIndex, col.visibleColIdx, col.actualColIdx)"
@mouseleave="onCellMouseleave(item.displayIndex, col.actualColIdx)"
- @dblclick="canEditCellItem(item, col.actualColIdx) && startDomCellEdit(item.id, col.actualColIdx, formatCellCached(item.data[col.actualColIdx], col.actualColIdx), $event)"
+ @dblclick="onDomCellDblClick(item, item.displayIndex, col.visibleColIdx, col.actualColIdx, $event)"
:data-visible-col-index="col.visibleColIdx"
@contextmenu="onCellContext(item.id, item.displayIndex, col.actualColIdx, col.visibleColIdx, $event)"
>