feat(data-grid): make the row number column show original row numbers

This commit is contained in:
xianghu908 authored and GitHub committed 2026-09-24 12:11:58 +08:00
1 parent 9ab1462ca8
commit 6517284d95
17 files changed
+196 -10

No files matched your search

+10 -2
View File
@@ -231,6 +231,7 @@ import {
} from "@/lib/dataGrid/dataGridInfiniteScroll";
import { resolveDataGridWheelScroll } from "@/lib/dataGrid/dataGridWheel";
import { CANVAS_DATA_GRID_ROW_HEIGHT, MAX_CANVAS_DATA_GRID_PIXEL_RATIO, canvasDataGridActionOverlayWidth, canvasDataGridActionReservedWidth, dataGridSearchMatchKey, drawCanvasDataGrid, resolveCanvasCellTextLayout, type CanvasDevicePixelSize } from "@/lib/dataGrid/canvasDataGridRenderer";
import { resolveDataGridRowNumberLabel } from "@/lib/dataGrid/dataGridRowNumber";
import { resolveCrosshairTarget, type CrosshairTarget } from "@/lib/dataGrid/crosshairHighlight";
import { DATA_GRID_DARK_STRIPED_ROW_BG, DATA_GRID_LIGHT_STRIPED_ROW_BG, dataGridActiveRowBackground } from "@/lib/dataGrid/dataGridPaintTheme";
import { createRowLowerTextCache } from "@/lib/dataGrid/dataGridRowLowerText";
@@ -757,6 +758,7 @@ const columnIndexMap = computed(() => buildColumnIndexMap(indexes.value, primary
const compactColumnHeaderActions = computed(() => settingsStore.editorSettings.compactColumnHeaderActions);
const dataGridRenderMode = computed(() => settingsStore.editorSettings.dataGridRenderMode);
const dataGridSearchMode = computed(() => settingsStore.editorSettings.dataGridSearchMode);
const dataGridRowNumberMode = computed(() => settingsStore.editorSettings.dataGridRowNumberMode);
const compactDataGridToolbar = computed(() => dataGridTopbarOverflowCompact.value || isDataGridToolbarCompact(dataGridTopbarWidth.value, dataGridViewportWidth.value, DATA_GRID_CONDITION_TOOLBAR_MIN_WIDTH));
const splitDataGridToolbar = computed(() => settingsStore.editorSettings.dataGridToolbarLayout === "split");
const responsiveDataGridToolbarActionCount = computed(() => dataGridToolbarActionCollapseCount(dataGridTopbarWidth.value, dataGridViewportWidth.value, DATA_GRID_CONDITION_TOOLBAR_MIN_WIDTH));
@@ -6387,8 +6389,13 @@ function rowNumberPageOffset(): number {
function rowNumberText(item: RowItem | undefined): string {
if (!item) return "";
if (item.isDraft) return "*";
return String(item.displayIndex + 1 + rowNumberPageOffset());
return resolveDataGridRowNumberLabel({
displayIndex: item.displayIndex,
sourceIndex: item.sourceIndex,
isDraft: item.isDraft,
sourceRowNumbers: dataGridRowNumberMode.value === "source",
pageOffset: rowNumberPageOffset(),
});
}
const quickEntryDraftPlaceholder = computed(() => t("grid.quickEntryDraftPlaceholder"));
@@ -7286,6 +7293,7 @@ function drawCanvasGrid() {
booleanDisplayMode: booleanDisplayMode.value,
flatteningMultiLineEnabled: flatteningMultiLineEnabled.value,
showWhitespace: showWhitespaceEnabled.value,
rowNumberMode: dataGridRowNumberMode.value,
});
if (!drawn) return;
flipCanvasSurface();