feat(data-grid): make the row number column show original row numbers
This commit is contained in:
1 parent
9ab1462ca8
commit
6517284d95
17 files changed
+196
-10
No files matched your search
@@ -371,6 +371,12 @@ describe("normalizeEditorSettings", () => {
|
||||
expect(normalizeEditorSettings({ dataGridSearchMode: "invalid" as any }).dataGridSearchMode).toBe("filter");
|
||||
});
|
||||
|
||||
it("defaults the data grid row number column to the view position and preserves original row numbers", () => {
|
||||
expect(normalizeEditorSettings({}).dataGridRowNumberMode).toBe("view");
|
||||
expect(normalizeEditorSettings({ dataGridRowNumberMode: "source" }).dataGridRowNumberMode).toBe("source");
|
||||
expect(normalizeEditorSettings({ dataGridRowNumberMode: "invalid" as any }).dataGridRowNumberMode).toBe("view");
|
||||
});
|
||||
|
||||
it("defaults the global data grid copy preference and preserves valid choices", () => {
|
||||
expect(normalizeEditorSettings({}).dataGridCopyExtractor).toBe("smart");
|
||||
expect(normalizeEditorSettings({ dataGridCopyExtractor: "smart" }).dataGridCopyExtractor).toBe("smart");
|
||||
|
||||
@@ -663,6 +663,8 @@ const DATA_GRID_RENDER_MODES = ["dom", "canvas"] as const;
|
||||
export type DataGridRenderMode = (typeof DATA_GRID_RENDER_MODES)[number];
|
||||
const DATA_GRID_SEARCH_MODES = ["filter", "highlight"] as const;
|
||||
export type DataGridSearchMode = (typeof DATA_GRID_SEARCH_MODES)[number];
|
||||
const DATA_GRID_ROW_NUMBER_MODES = ["view", "source"] as const;
|
||||
export type DataGridRowNumberMode = (typeof DATA_GRID_ROW_NUMBER_MODES)[number];
|
||||
export type DataGridFilterEditorView = "quick" | "conditions" | "text";
|
||||
export type DataGridToolbarLayout = "single" | "split";
|
||||
const RESULT_RUN_DISPLAY_MODES = ["tabs", "list"] as const;
|
||||
@@ -852,6 +854,7 @@ export interface EditorSettings {
|
||||
localFilterPopoverWidth: number;
|
||||
dataGridRenderMode: DataGridRenderMode;
|
||||
dataGridSearchMode: DataGridSearchMode;
|
||||
dataGridRowNumberMode: DataGridRowNumberMode;
|
||||
dataGridCopyExtractor: DataGridCopyPreference;
|
||||
dataGridExtractorOptions: DataGridExtractorOptions;
|
||||
dataGridExtractorOptionsMigrationVersion: number;
|
||||
@@ -1127,6 +1130,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
||||
localFilterPopoverWidth: 360,
|
||||
dataGridRenderMode: "canvas",
|
||||
dataGridSearchMode: "filter",
|
||||
dataGridRowNumberMode: "view",
|
||||
dataGridCopyExtractor: "smart",
|
||||
dataGridExtractorOptions: normalizeDataGridExtractorOptions(DEFAULT_DATA_GRID_EXTRACTOR_OPTIONS),
|
||||
dataGridExtractorOptionsMigrationVersion: DATA_GRID_EXTRACTOR_OPTIONS_MIGRATION_VERSION,
|
||||
@@ -1300,6 +1304,10 @@ function normalizeDataGridSearchMode(value: unknown): DataGridSearchMode {
|
||||
return DATA_GRID_SEARCH_MODES.includes(value as DataGridSearchMode) ? (value as DataGridSearchMode) : DEFAULT_EDITOR_SETTINGS.dataGridSearchMode;
|
||||
}
|
||||
|
||||
function normalizeDataGridRowNumberMode(value: unknown): DataGridRowNumberMode {
|
||||
return DATA_GRID_ROW_NUMBER_MODES.includes(value as DataGridRowNumberMode) ? (value as DataGridRowNumberMode) : DEFAULT_EDITOR_SETTINGS.dataGridRowNumberMode;
|
||||
}
|
||||
|
||||
function normalizeDataGridFilterEditorView(value: unknown): DataGridFilterEditorView {
|
||||
return value === "conditions" || value === "text" ? value : DEFAULT_EDITOR_SETTINGS.dataGridFilterEditorView;
|
||||
}
|
||||
@@ -1675,6 +1683,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
localFilterPopoverWidth: normalizeDrawerWidth(settings.localFilterPopoverWidth, 240, DEFAULT_EDITOR_SETTINGS.localFilterPopoverWidth),
|
||||
dataGridRenderMode: normalizeDataGridRenderMode(settings.dataGridRenderMode),
|
||||
dataGridSearchMode: normalizeDataGridSearchMode(settings.dataGridSearchMode),
|
||||
dataGridRowNumberMode: normalizeDataGridRowNumberMode(settings.dataGridRowNumberMode),
|
||||
dataGridCopyExtractor: normalizeDataGridCopyPreference(settings.dataGridCopyExtractor),
|
||||
dataGridExtractorOptions,
|
||||
dataGridExtractorOptionsMigrationVersion: DATA_GRID_EXTRACTOR_OPTIONS_MIGRATION_VERSION,
|
||||
@@ -2499,6 +2508,7 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
if (partial.localFilterPopoverWidth !== undefined) editorSettings.value.localFilterPopoverWidth = normalizeDrawerWidth(partial.localFilterPopoverWidth, 240, DEFAULT_EDITOR_SETTINGS.localFilterPopoverWidth);
|
||||
if (partial.dataGridRenderMode !== undefined) editorSettings.value.dataGridRenderMode = normalizeDataGridRenderMode(partial.dataGridRenderMode);
|
||||
if (partial.dataGridSearchMode !== undefined) editorSettings.value.dataGridSearchMode = normalizeDataGridSearchMode(partial.dataGridSearchMode);
|
||||
if (partial.dataGridRowNumberMode !== undefined) editorSettings.value.dataGridRowNumberMode = normalizeDataGridRowNumberMode(partial.dataGridRowNumberMode);
|
||||
if (partial.dataGridCopyExtractor !== undefined) editorSettings.value.dataGridCopyExtractor = normalizeDataGridCopyPreference(partial.dataGridCopyExtractor);
|
||||
if (partial.dataGridExtractorOptions !== undefined) editorSettings.value.dataGridExtractorOptions = normalizeDataGridExtractorOptions(partial.dataGridExtractorOptions);
|
||||
if (partial.dataGridExtractorOptionsMigrationVersion !== undefined) editorSettings.value.dataGridExtractorOptionsMigrationVersion = DATA_GRID_EXTRACTOR_OPTIONS_MIGRATION_VERSION;
|
||||
|
||||
Reference in new issue
Block a user