From 90276464b27331c945d119b9c10f01019dab3392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Thu, 9 Jul 2026 20:20:14 +0800 Subject: [PATCH] feat(dataGrid): fix temporal cell editor precision --- apps/desktop/src/components/grid/DataGrid.vue | 60 +++++++++++++--- .../components/grid/TemporalCellEditor.vue | 58 +++++++++++++-- .../dataGrid/dataGridTemporalEditor.spec.ts | 48 +++++++++++++ .../lib/dataGrid/dataGridTemporalEditor.ts | 71 +++++++++++++++---- crates/dbx-core/src/data_grid_sql.rs | 16 +++++ 5 files changed, 224 insertions(+), 29 deletions(-) create mode 100644 apps/desktop/src/lib/__tests__/dataGrid/dataGridTemporalEditor.spec.ts diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index 83f2de1301..f6a0ec7ebf 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -115,7 +115,7 @@ import { canFormatCellDetailJson, cellDetailEditorText, compactJsonText, default import { renderWktOnCanvas, isHexGeometry } from "@/lib/dataGrid/geometryPreview"; import { buildDataGridCellDetail, buildDataGridColumnDetail, buildDataGridRowDetail, dataGridColumnDetailJson, dataGridColumnDetailTsv, dataGridRowDetailJson, dataGridRowDetailTsv, filterDataGridDetailFields, type DataGridCellDetail } from "@/lib/dataGrid/dataGridDetail"; import { applyColumnFormatter, buildColumnFormatterKey, normalizeColumnFormatter, resolveColumnFormatter, type ColumnFormatterConfig, type DateTimeFormatterUnit, DateTimePatterns } from "@/lib/dataGrid/columnFormatter"; -import { temporalCellEditorKind, type TemporalCellEditorKind } from "@/lib/dataGrid/dataGridTemporalEditor"; +import { temporalCellEditorConfig, type TemporalCellEditorConfig } from "@/lib/dataGrid/dataGridTemporalEditor"; import { isCancelSearchShortcut, isCopyCurrentRowShortcut, isDeleteCurrentRowShortcut, isFocusSearchShortcut, isModRShortcut, isSaveShortcut, isToggleTransposeShortcut } from "@/lib/editor/keyboardShortcuts"; import { dataGridHeaderContentWidth, scrollbarGutterWidth } from "@/lib/dataGrid/dataGridScrollGutter"; import { canGoNextDataGridPage } from "@/lib/dataGrid/dataGridPagination"; @@ -4066,8 +4066,8 @@ function resultColumnInfoForGridColumn(columnIndex: number): Pick { const detailEditValue = ref(""); const isEditingDetail = ref(false); -const detailTemporalEditorKind = computed(() => { +const detailTemporalEditorConfig = computed(() => { const detail = activeCellDetail.value; - return detail ? temporalEditorKindForColumn(detail.colIndex) : undefined; + return detail ? temporalEditorConfigForColumn(detail.colIndex) : undefined; }); const sideDetailPrioritizesValue = computed(() => !cellDetailPanelIsBottom.value && !isEditingDetail.value && !!activeCellDetail.value?.formattedJson); const sideDetailValueFillsHeight = computed(() => cellDetailPanelIsBottom.value || isEditingDetail.value || (!cellDetailPanelIsBottom.value && !activeCellDetail.value?.imagePreviewUrl)); @@ -9197,7 +9197,15 @@ const gridContextMenuItems = computed(() => { @dblclick.stop="canEditCellItem(displayItems[cell.recordIndex], cell.valueIndex) && startDomCellEdit(displayItems[cell.recordIndex].id, cell.valueIndex, cell.display, $event)" >