From cdbe0079e772894d88c20d0574be3bea1c3cf27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Mon, 20 Jul 2026 14:05:40 +0800 Subject: [PATCH] feat(settings): configure table open page size --- .../editor/EditorSettingsDialog.vue | 27 +++++++++++- apps/desktop/src/components/grid/DataGrid.vue | 4 +- .../__tests__/useDataGridActions.spec.ts | 14 ++++-- .../src/composables/useDataGridActions.ts | 6 ++- .../src/composables/useNavigationTargets.ts | 2 +- .../composables/useSidebarDataOpenRuntime.ts | 2 +- apps/desktop/src/i18n/locales/en.ts | 2 + apps/desktop/src/i18n/locales/es.ts | 2 + apps/desktop/src/i18n/locales/it.ts | 2 + apps/desktop/src/i18n/locales/ja.ts | 2 + apps/desktop/src/i18n/locales/pt-BR.ts | 2 + apps/desktop/src/i18n/locales/zh-CN.ts | 2 + apps/desktop/src/i18n/locales/zh-TW.ts | 2 + .../__tests__/editorSettingsDraft.spec.ts | 44 ++++++++++++++++++- .../src/lib/settings/editorSettingsDraft.ts | 24 +++++++--- .../src/lib/table/tableOpenPageLimit.ts | 5 +-- apps/desktop/src/stores/queryStore.ts | 6 +-- apps/desktop/src/stores/settingsStore.ts | 4 ++ packages/app-tests/queryResultToolbar.test.ts | 3 +- packages/app-tests/queryStore.test.ts | 12 ++--- packages/app-tests/settingsStore.test.ts | 20 ++++++++- 21 files changed, 156 insertions(+), 31 deletions(-) diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue index 262c399eb..380f98b69 100644 --- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue +++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue @@ -108,7 +108,7 @@ import ChangelogPanel from "@/components/settings/ChangelogPanel.vue"; import ScheduledDatabaseBackupSettings from "@/components/backup/ScheduledDatabaseBackupSettings.vue"; import SqlFormatterSettingsPanel from "./SqlFormatterSettingsPanel.vue"; import { APP_THEME_PALETTES, type AppThemeAppearance, type AppThemeMode, type AppThemePalette } from "@/lib/app/appTheme"; -import { editorSettingsDraftChanged, editorSettingsDraftFromSettings, editorSettingsPatchFromDraft, type EditorSettingsDraft } from "@/lib/settings/editorSettingsDraft"; +import { editorSettingsDraftChanged, editorSettingsDraftFromSettings, editorSettingsPatchFromDraft, normalizeTableOpenPageSizeDraft, type EditorSettingsDraft } from "@/lib/settings/editorSettingsDraft"; import { useConnectionStore } from "@/stores/connectionStore"; import { useSavedSqlStore } from "@/stores/savedSqlStore"; import { useTunnelProfileStore } from "@/stores/tunnelProfileStore"; @@ -119,6 +119,7 @@ import { apiUrl } from "@/lib/common/webPath"; import { DEFAULT_UI_FONT_FAMILY, SYSTEM_UI_FONT_FAMILY } from "@/lib/app/appFonts"; import { buildAppSupportInfoRows, formatAppSupportInfoForClipboard, type AppSupportInfoLabels } from "@/lib/app/supportInfo"; import { DateTimePatterns, normalizeSupportedDateTimePattern } from "@/lib/dataGrid/columnFormatter"; +import { MAX_RESULT_PAGE_SIZE, MIN_RESULT_PAGE_SIZE } from "@/lib/dataGrid/paginationPageSize"; const { t } = useI18n(); const { toast } = useToast(); @@ -295,6 +296,7 @@ const editShowColumnCommentsInHeader = ref(settingsStore.editorSettings.showColu const editShowColumnTypesInHeader = ref(settingsStore.editorSettings.showColumnTypesInHeader); const editCompactColumnHeaderActions = ref(settingsStore.editorSettings.compactColumnHeaderActions); const editDataGridQuickEntry = ref(settingsStore.editorSettings.dataGridQuickEntry); +const editTableOpenPageSize = ref(settingsStore.editorSettings.tableOpenPageSize); const editInfiniteScroll = ref(settingsStore.editorSettings.infiniteScroll); const editInfiniteScrollMaxRows = ref(settingsStore.editorSettings.infiniteScrollMaxRows); const editAutoCalculateTotalRows = ref(settingsStore.editorSettings.autoCalculateTotalRows); @@ -303,6 +305,10 @@ const editTableColumnTemplateDatabaseType = ref(TABLE_COLUMN_TEMPL const editSqlVariableSyntaxOverrides = ref(normalizeSqlVariableSyntaxOverrides(settingsStore.editorSettings.sqlVariableSyntaxOverrides)); const editSqlVariableSyntaxDatabaseType = ref(SQL_VARIABLE_SYNTAX_DATABASE_TYPES[0] ?? "mysql"); +function updateTableOpenPageSizeDraft(value: string | number) { + editTableOpenPageSize.value = normalizeTableOpenPageSizeDraft(value); +} + function sqlVariableSyntaxToggle(key: keyof SqlVariableSyntaxToggles): boolean { return editSqlVariableSyntaxOverrides.value[editSqlVariableSyntaxDatabaseType.value]?.[key] ?? true; } @@ -428,6 +434,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft { showColumnTypesInHeader: editShowColumnTypesInHeader.value, compactColumnHeaderActions: editCompactColumnHeaderActions.value, dataGridQuickEntry: editDataGridQuickEntry.value, + tableOpenPageSize: editTableOpenPageSize.value, infiniteScroll: editInfiniteScroll.value, infiniteScrollMaxRows: editInfiniteScrollMaxRows.value, autoCalculateTotalRows: editAutoCalculateTotalRows.value, @@ -708,6 +715,7 @@ function syncEditorSettingsDraftFromStore() { editShowColumnTypesInHeader.value = settingsStore.editorSettings.showColumnTypesInHeader; editCompactColumnHeaderActions.value = settingsStore.editorSettings.compactColumnHeaderActions; editDataGridQuickEntry.value = settingsStore.editorSettings.dataGridQuickEntry; + editTableOpenPageSize.value = settingsStore.editorSettings.tableOpenPageSize; editInfiniteScroll.value = settingsStore.editorSettings.infiniteScroll; editInfiniteScrollMaxRows.value = settingsStore.editorSettings.infiniteScrollMaxRows; editAutoCalculateTotalRows.value = settingsStore.editorSettings.autoCalculateTotalRows; @@ -931,6 +939,7 @@ function resetDefaultsForTab(tab: SettingsCategory) { editShowColumnTypesInHeader.value = DEFAULT_EDITOR_SETTINGS.showColumnTypesInHeader; editCompactColumnHeaderActions.value = DEFAULT_EDITOR_SETTINGS.compactColumnHeaderActions; editDataGridQuickEntry.value = DEFAULT_EDITOR_SETTINGS.dataGridQuickEntry; + editTableOpenPageSize.value = DEFAULT_EDITOR_SETTINGS.tableOpenPageSize; editInfiniteScroll.value = DEFAULT_EDITOR_SETTINGS.infiniteScroll; editInfiniteScrollMaxRows.value = DEFAULT_EDITOR_SETTINGS.infiniteScrollMaxRows; editAutoCalculateTotalRows.value = DEFAULT_EDITOR_SETTINGS.autoCalculateTotalRows; @@ -988,6 +997,7 @@ function resetAllDefaults() { editShowColumnTypesInHeader.value = DEFAULT_EDITOR_SETTINGS.showColumnTypesInHeader; editCompactColumnHeaderActions.value = DEFAULT_EDITOR_SETTINGS.compactColumnHeaderActions; editDataGridQuickEntry.value = DEFAULT_EDITOR_SETTINGS.dataGridQuickEntry; + editTableOpenPageSize.value = DEFAULT_EDITOR_SETTINGS.tableOpenPageSize; editInfiniteScroll.value = DEFAULT_EDITOR_SETTINGS.infiniteScroll; editInfiniteScrollMaxRows.value = DEFAULT_EDITOR_SETTINGS.infiniteScrollMaxRows; editAutoCalculateTotalRows.value = DEFAULT_EDITOR_SETTINGS.autoCalculateTotalRows; @@ -3818,6 +3828,21 @@ onUnmounted(cleanupPreviewEditor);
+
+
{{ t("settings.dataGridDisplay") }}
+
+
+ +

+ {{ t("settings.tableOpenPageSizeDescription") }} +

+
+ +
+
+