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。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(table): add table font size control (#2095)
zipga458ebd08f6e
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vueindex e0d4f901c3..a2a831afae 100644--- a/apps/desktop/src/components/grid/DataGrid.vue+++ b/apps/desktop/src/components/grid/DataGrid.vue@@ -164,6 +164,7 @@ const slots = useSlots();const connectionStore = useConnectionStore();const queryStore = useQueryStore();const settingsStore = useSettingsStore();+const tableFontSize = computed(() => settingsStore.editorSettings.tableFontSize);const { isDark } = useTheme();const { toast } = useToast();const { highlight } = useSqlHighlighter();@@ -2062,6 +2063,7 @@ const gridStyle = computed(() => ({"--header-total-w": dataGridHeaderContentWidth("var(--total-w)", gridScrollbarGutter.value),"--grid-scrollbar-gutter": `${gridScrollbarGutter.value}px`,[EDITOR_FONT_FAMILY_CSS_VAR]: settingsStore.editorSettings.fontFamily,+ "--dbx-table-font-size": `${tableFontSize.value}px`,}));const gridHorizontalScrollLeft = ref(0);const gridViewportWidth = ref(0);@@ -4436,7 +4438,7 @@ const canvasSurfaceWidth = computed(() => {if (vw <= 0) return total;return Math.min(vw, total);});-const canvasRenderStyleKey = computed(() => `${settingsStore.editorSettings.theme}:${settingsStore.editorSettings.uiScale}:${canvasBackingPixelRatio.value}:${isDark.value}:${settingsStore.editorSettings.fontFamily}`);+const canvasRenderStyleKey = computed(() => `${settingsStore.editorSettings.theme}:${settingsStore.editorSettings.uiScale}:${canvasBackingPixelRatio.value}:${isDark.value}:${settingsStore.editorSettings.fontFamily}:${tableFontSize.value}`);const CANVAS_MOUSE_WHEEL_SCROLL_MULTIPLIER = 1.5;const CANVAS_TRACKPAD_DELTA_THRESHOLD = 40;let canvasResizeObserver: ResizeObserver | null = null;@@ -7698,7 +7700,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {@scroll="onTransposeScroll"><template #before>- <div class="sticky top-0 z-20 flex h-7 border-b border-border bg-[rgb(239_239_239)] text-xs font-semibold text-muted-foreground dark:bg-muted" :style="{ width: `${transposeTotalWidth}px` }">+ <div class="data-grid-transpose-header sticky top-0 z-20 flex h-7 border-b border-border bg-[rgb(239_239_239)] font-semibold text-muted-foreground dark:bg-muted" :style="{ width: `${transposeTotalWidth}px` }"><div class="sticky left-0 z-30 shrink-0 border-r border-border px-3 py-1.5 bg-[rgb(239_239_239)] truncate dark:bg-muted relative" :style="{ width: `${transposePinnedWidth}px` }">{{ t("grid.columnName") }}<div class="absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize hover:bg-primary/30" @mousedown.stop="onTransposePinnedResizeStart" />@@ -7724,7 +7726,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {</div></template><template #default="{ item }">- <div class="flex border-b border-border/60 text-xs" :style="{ height: '30px', width: `${transposeTotalWidth}px` }">+ <div class="data-grid-transpose-row flex border-b border-border/60" :style="{ height: '30px', width: `${transposeTotalWidth}px` }"><div class="sticky left-0 z-10 flex shrink-0 items-center border-r border-border bg-background px-3 py-0 font-medium truncate" :style="{ width: `${transposePinnedWidth}px` }" :title="item.column">{{ item.column }}</div>@@ -7765,7 +7767,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {autocapitalize="off"autocorrect="off"spellcheck="false"- class="cell-edit-input cell-edit-input--expanded absolute left-0 top-0 min-h-full bg-background px-1.5 py-1 text-[13px] leading-[18px] outline-none z-10"+ class="cell-edit-input cell-edit-input--expanded absolute left-0 top-0 min-h-full bg-background px-1.5 py-1 leading-[18px] outline-none z-10"@blur="commitEditFromBlur"@click.stop@focus="onCellEditTextareaInput"@@ -7780,7 +7782,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {autocapitalize="off"autocorrect="off"spellcheck="false"- class="cell-edit-input absolute inset-0 bg-background border-2 border-primary px-1.5 py-0 text-[13px] leading-[26px] outline-none z-10"+ class="cell-edit-input absolute inset-0 bg-background border-2 border-primary px-1.5 py-0 leading-[26px] outline-none z-10"@blur="commitEditFromBlur"@click.stop@input="onCellEditTextareaInput"@@ -7826,7 +7828,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<template v-else><!-- Sticky header --><div ref="headerRef" class="shrink-0 bg-[rgb(239_239_239)] dark:bg-muted/60 z-10 w-full border-y border-border overflow-hidden">- <div class="flex w-(--header-total-w) text-xs font-semibold text-foreground">+ <div class="data-grid-header-row flex w-(--header-total-w) font-semibold text-foreground"><divclass="shrink-0 px-2 py-1.5 border-r w-(--row-num-w) border-border text-center text-muted-foreground select-none cursor-default hover:bg-gray-200 dark:hover:bg-gray-800 sticky left-0 z-20 bg-[rgb(239_239_239)] dark:bg-muted":class="{ '!bg-gray-300 dark:!bg-gray-900 outline outline-primary -outline-offset-1': isSelectingAll }"@@ -8195,7 +8197,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<div class="relative" :style="{ width: `${totalWidth}px`, height: `${canvasContentHeight}px` }"><canvasref="canvasRef"- class="canvas-grid-surface dbx-data-grid-font-family sticky left-0 top-0 z-0 block text-[13px]/[1rem] font-normal"+ class="canvas-grid-surface dbx-data-grid-font-family sticky left-0 top-0 z-0 block font-normal":style="{ width: `${canvasSurfaceWidth}px`, height: `${canvasViewportHeight}px` }"@mousemove="onCanvasMouseMove"@mouseleave="onCanvasMouseLeave"@@ -8223,7 +8225,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {autocapitalize="off"autocorrect="off"spellcheck="false"- class="cell-edit-input cell-edit-input--expanded absolute left-0 top-0 min-h-full bg-background px-2.5 py-1 text-[13px] leading-[18px] outline-none z-10"+ class="cell-edit-input cell-edit-input--expanded absolute left-0 top-0 min-h-full bg-background px-2.5 py-1 leading-[18px] outline-none z-10"@blur="commitEditFromBlur"@click.stop@focus="onCellEditTextareaInput"@@ -8238,7 +8240,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {autocapitalize="off"autocorrect="off"spellcheck="false"- class="cell-edit-input absolute inset-0 bg-background border-2 border-primary px-2.5 py-0 text-[13px] leading-[22px] outline-none z-10"+ class="cell-edit-input absolute inset-0 bg-background border-2 border-primary px-2.5 py-0 leading-[22px] outline-none z-10"@blur="commitEditFromBlur"@click.stop@input="onCellEditTextareaInput"@@ -8285,7 +8287,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<RecycleScrollerv-else-if="hasVisibleRows"ref="scrollerRef"- class="data-grid-scroller dbx-data-grid-font-family flex-1 overflow-x-auto overscroll-none text-[13px]"+ class="data-grid-scroller dbx-data-grid-font-family flex-1 overflow-x-auto overscroll-none":class="{ 'is-scrolling': isScrolling }":items="displayItems":item-size="26"@@ -8296,7 +8298,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {><template #default="{ item }"><div- class="flex text-[13px] border-b border-border h-6.5 w-(--total-w)"+ class="data-grid-row flex border-b border-border h-6.5 w-(--total-w)":class="{'bg-destructive/5 opacity-70': item.isDeleted,'bg-primary/5': item.isNew && !isRowActive(item.displayIndex),@@ -8319,7 +8321,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {<divv-for="col in renderedGridColumns":key="col.actualColIdx"- class="group/cell shrink-0 px-3 py-1 border-r border-border whitespace-nowrap overflow-hidden text-ellipsis relative select-none inline-block items-center tabular-nums text-[13px]"+ class="data-grid-cell group/cell shrink-0 px-3 py-1 border-r border-border whitespace-nowrap overflow-hidden text-ellipsis relative select-none inline-block items-center tabular-nums":style="renderedColumnStyle(col.visibleColIdx)":class="{'text-muted-foreground italic': isNull(item.data[col.actualColIdx]),@@ -8355,7 +8357,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {autocapitalize="off"autocorrect="off"spellcheck="false"- class="cell-edit-input cell-edit-input--expanded absolute left-0 top-0 min-h-full bg-background px-2.5 py-1 text-[13px] leading-[18px] outline-none z-10"+ class="cell-edit-input cell-edit-input--expanded absolute left-0 top-0 min-h-full bg-background px-2.5 py-1 leading-[18px] outline-none z-10"@blur="commitEditFromBlur"@click.stop@focus="onCellEditTextareaInput"@@ -8370,7 +8372,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {autocapitalize="off"autocorrect="off"spellcheck="false"- class="cell-edit-input absolute inset-0 bg-background border-2 border-primary px-2.5 py-0 text-[13px] leading-[22px] outline-none z-10"+ class="cell-edit-input absolute inset-0 bg-background border-2 border-primary px-2.5 py-0 leading-[22px] outline-none z-10"@blur="commitEditFromBlur"@click.stop@input="onCellEditTextareaInput"@@ -9449,6 +9451,13 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {margin-inline-end: 0.25rem;}+.data-grid-scroller,+.data-grid-header-row,+.data-grid-transpose-header,+.data-grid-transpose-row {+ font-size: var(--dbx-table-font-size, 13px);+}+.data-grid-topbar-action-button--compact .data-grid-topbar-action-icon {margin-inline-end: 0;transform: scale(0.96);@@ -9589,7 +9598,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {.canvas-grid-surface {cursor: cell;font-family: var(--dbx-data-grid-font-family);- font-size: 13px;+ font-size: var(--dbx-table-font-size, 13px);font-weight: 400;line-height: 1rem;outline: none;@@ -9597,6 +9606,7 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {.cell-edit-input {font-family: inherit;+ font-size: var(--dbx-table-font-size, 13px);}.cell-edit-input--expanded {diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vueindex 663e1c7a1d..5a036b83d7 100644--- a/apps/desktop/src/components/layout/ContentArea.vue+++ b/apps/desktop/src/components/layout/ContentArea.vue@@ -3,7 +3,7 @@ import { computed, ref, defineAsyncComponent, watch, nextTick, onMounted, onUnmoimport { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage";import type { CSSProperties } from "vue";import { useI18n } from "vue-i18n";-import { Check, Columns3, EyeOff, Loader2, Search, Bot, GitBranch, BarChart3, TableProperties, ChevronDown, ChevronUp, Inbox, RefreshCcw, Wrench, Toolbox, ListChecks, Database, FileUp, Download, X, Pin, Rows3, SquareDashed } from "@lucide/vue";+import { Check, Columns3, EyeOff, Loader2, Search, Bot, GitBranch, BarChart3, TableProperties, ChevronDown, ChevronUp, Inbox, RefreshCcw, Wrench, Toolbox, ListChecks, Database, FileUp, Download, X, Pin, Rows3, SquareDashed, Minus, Plus } from "@lucide/vue";import { Splitpanes, Pane } from "splitpanes";import "splitpanes/dist/splitpanes.css";import { Button } from "@/components/ui/button";@@ -49,7 +49,7 @@ const ExplainPlanViewer = defineAsyncComponent(() => import("@/components/explaiconst QueryChart = defineAsyncComponent(() => import("@/components/chart/QueryChart.vue"));import { useQueryStore } from "@/stores/queryStore";import { useConnectionStore } from "@/stores/connectionStore";-import { useSettingsStore } from "@/stores/settingsStore";+import { TABLE_FONT_SIZE_DEFAULT, TABLE_FONT_SIZE_MAX, TABLE_FONT_SIZE_MIN, useSettingsStore } from "@/stores/settingsStore";import { useToast } from "@/composables/useToast";import { canCancelQueryExecution, queryExecutionLabelKey } from "@/lib/queryExecutionState";import { databaseDisplayNameForTab, executionSummaryItems, nextExecutionSummaryView, resultGridCacheKey, resultRunItems, tabularResultItems } from "@/lib/tabPresentation";@@ -175,6 +175,8 @@ const resultTabsScrollerRef = ref<HTMLElement | null>(null);const columnVisibilitySearch = ref("");const columnVisibilityOptions = computed(() => dataGridRef.value?.filteredColumnVisibilityOptions(columnVisibilitySearch.value) ?? []);const dataGridRenderMode = computed(() => settingsStore.editorSettings.dataGridRenderMode);+const tableFontSize = computed(() => settingsStore.editorSettings.tableFontSize);+const dataGridViewOptionsActive = computed(() => dataGridRef.value?.nullColumnsHidden || dataGridRef.value?.multiRowTranspose || dataGridRenderMode.value === "dom" || tableFontSize.value !== TABLE_FONT_SIZE_DEFAULT);const redisKeyBrowserRef = ref<SearchableBrowserHandle>();const etcdKeyBrowserRef = ref<SearchableBrowserHandle>();const zookeeperKeyBrowserRef = ref<SearchableBrowserHandle>();@@ -198,6 +200,18 @@ function setDataGridRenderMode(value: "canvas" | "dom") {settingsStore.updateEditorSettings({ dataGridRenderMode: value });}+function setTableFontSize(value: number) {+ settingsStore.updateEditorSettings({ tableFontSize: value });+}++function decreaseTableFontSize() {+ setTableFontSize(tableFontSize.value - 1);+}++function increaseTableFontSize() {+ setTableFontSize(tableFontSize.value + 1);+}+const activeTabDimension = computed(() => {const tab = props.activeTab;if (!tab.connectionId || tab.mode !== "vector") return undefined;@@ -770,7 +784,7 @@ defineExpose({ focusSearch, refreshData, handleModRTarget, requestQueryEditorExesize="icon"class="h-6 w-7 shrink-0 text-foreground hover:bg-accent":class="{- 'bg-accent text-foreground': dataGridRef?.nullColumnsHidden || dataGridRef?.multiRowTranspose || dataGridRenderMode === 'dom',+ 'bg-accent text-foreground': dataGridViewOptionsActive,}":title="t('grid.viewOptions')":aria-label="t('grid.viewOptions')"@@ -808,6 +822,33 @@ defineExpose({ focusSearch, refreshData, handleModRTarget, requestQueryEditorExe</div></LightTooltip></div>+ <div class="flex items-center justify-between gap-3 px-3 py-2 text-xs">+ <div class="min-w-0 flex items-center gap-2 font-medium">+ <span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center text-[11px] font-semibold text-muted-foreground">A</span>+ <span>{{ t("grid.tableFontSize") }}</span>+ </div>+ <div class="flex h-7 w-32 items-center rounded-md border bg-muted/40 p-0.5">+ <button+ type="button"+ class="flex h-6 w-8 items-center justify-center rounded-[5px] bg-background text-foreground shadow-sm transition-colors hover:text-foreground disabled:pointer-events-none disabled:bg-muted/40 disabled:text-muted-foreground disabled:opacity-50 disabled:shadow-none"+ :disabled="tableFontSize <= TABLE_FONT_SIZE_MIN"+ :aria-label="t('common.decrease')"+ @click="decreaseTableFontSize"+ >+ <Minus class="h-3.5 w-3.5" />+ </button>+ <span class="flex-1 text-center text-xs font-semibold tabular-nums">{{ tableFontSize }}</span>+ <button+ type="button"+ class="flex h-6 w-8 items-center justify-center rounded-[5px] bg-background text-foreground shadow-sm transition-colors hover:text-foreground disabled:pointer-events-none disabled:bg-muted/40 disabled:text-muted-foreground disabled:opacity-50 disabled:shadow-none"+ :disabled="tableFontSize >= TABLE_FONT_SIZE_MAX"+ :aria-label="t('common.increase')"+ @click="increaseTableFontSize"+ >+ <Plus class="h-3.5 w-3.5" />+ </button>+ </div>+ </div><div class="flex items-center justify-between gap-3 px-3 py-2 text-xs"><div class="min-w-0 flex items-center gap-2 font-medium"><Rows3 class="h-3.5 w-3.5 shrink-0 text-muted-foreground" />@@ -1062,7 +1103,7 @@ defineExpose({ focusSearch, refreshData, handleModRTarget, requestQueryEditorExesize="icon"class="h-6 w-7 shrink-0 text-foreground hover:bg-accent":class="{- 'bg-accent text-foreground': dataGridRef?.nullColumnsHidden || dataGridRef?.multiRowTranspose || dataGridRenderMode === 'dom',+ 'bg-accent text-foreground': dataGridViewOptionsActive,}":title="t('grid.viewOptions')":aria-label="t('grid.viewOptions')"@@ -1100,6 +1141,33 @@ defineExpose({ focusSearch, refreshData, handleModRTarget, requestQueryEditorExe</div></LightTooltip></div>+ <div class="flex items-center justify-between gap-3 px-3 py-2 text-xs">+ <div class="min-w-0 flex items-center gap-2 font-medium">+ <span class="flex h-3.5 w-3.5 shrink-0 items-center justify-center text-[11px] font-semibold text-muted-foreground">A</span>+ <span>{{ t("grid.tableFontSize") }}</span>+ </div>+ <div class="flex h-7 w-32 items-center rounded-md border bg-muted/40 p-0.5">+ <button+ type="button"+ class="flex h-6 w-8 items-center justify-center rounded-[5px] bg-background text-foreground shadow-sm transition-colors hover:text-foreground disabled:pointer-events-none disabled:bg-muted/40 disabled:text-muted-foreground disabled:opacity-50 disabled:shadow-none"+ :disabled="tableFontSize <= TABLE_FONT_SIZE_MIN"+ :aria-label="t('common.decrease')"+ @click="decreaseTableFontSize"+ >+ <Minus class="h-3.5 w-3.5" />+ </button>+ <span class="flex-1 text-center text-xs font-semibold tabular-nums">{{ tableFontSize }}</span>+ <button+ type="button"+ class="flex h-6 w-8 items-center justify-center rounded-[5px] bg-background text-foreground shadow-sm transition-colors hover:text-foreground disabled:pointer-events-none disabled:bg-muted/40 disabled:text-muted-foreground disabled:opacity-50 disabled:shadow-none"+ :disabled="tableFontSize >= TABLE_FONT_SIZE_MAX"+ :aria-label="t('common.increase')"+ @click="increaseTableFontSize"+ >+ <Plus class="h-3.5 w-3.5" />+ </button>+ </div>+ </div><div class="flex items-center justify-between gap-3 px-3 py-2 text-xs"><div class="min-w-0 flex items-center gap-2 font-medium"><Rows3 class="h-3.5 w-3.5 shrink-0 text-muted-foreground" />diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex c67750ba67..fc29426739 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -604,6 +604,7 @@ export default {domRenderMode: "DOM",canvasRenderMode: "Canvas",renderModeHint: "Switch between Canvas rendering and the DOM fallback grid.",+ tableFontSize: "Table font size",filter: "Filter",filterBuilder: "Filters",filterBuilderTitle: "Filters",@@ -908,6 +909,8 @@ export default {remove: "Remove",retry: "Retry",more: "More",+ decrease: "Decrease",+ increase: "Increase",done: "Done",connection: "Connection",database: "Database",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 1d20669625..f8cb888de7 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -607,6 +607,7 @@ export default withEnglishFallback({domRenderMode: "DOM",canvasRenderMode: "Canvas",renderModeHint: "在 Canvas 渲染和 DOM 兜底表格之间切换。",+ tableFontSize: "表格字号",filter: "筛选",filterBuilder: "筛选器",filterBuilderTitle: "筛选器",@@ -911,6 +912,8 @@ export default withEnglishFallback({remove: "移除",retry: "重试",more: "更多",+ decrease: "减小",+ increase: "增大",done: "完成",connection: "连接",database: "数据库",diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.tsindex e2ec278eed..14f853a75a 100644--- a/apps/desktop/src/stores/settingsStore.ts+++ b/apps/desktop/src/stores/settingsStore.ts@@ -253,6 +253,9 @@ const CELL_DETAIL_PANEL_LAYOUTS = ["bottom", "right"] as const;export type CellDetailPanelLayout = (typeof CELL_DETAIL_PANEL_LAYOUTS)[number];const DATA_GRID_RENDER_MODES = ["dom", "canvas"] as const;export type DataGridRenderMode = (typeof DATA_GRID_RENDER_MODES)[number];+export const TABLE_FONT_SIZE_MIN = 12;+export const TABLE_FONT_SIZE_MAX = 16;+export const TABLE_FONT_SIZE_DEFAULT = 13;const DISCONNECT_TAB_HANDLING_MODES = ["close-tabs", "keep-tabs-clear-results", "keep-tabs-keep-results"] as const;export type DisconnectTabHandlingMode = (typeof DISCONNECT_TAB_HANDLING_MODES)[number];@@ -338,6 +341,7 @@ export interface EditorSettings {showColumnTypesInHeader: boolean;compactColumnHeaderActions: boolean;dataGridRenderMode: DataGridRenderMode;+ tableFontSize: number;structureEditorDensity: StructureEditorDensity;tableInfoDrawerWidth: number;cellDetailDrawerWidth: number;@@ -442,6 +446,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {showColumnTypesInHeader: true,compactColumnHeaderActions: true,dataGridRenderMode: "canvas",+ tableFontSize: TABLE_FONT_SIZE_DEFAULT,structureEditorDensity: "compact",tableInfoDrawerWidth: 320,cellDetailDrawerWidth: 380,@@ -498,6 +503,11 @@ function normalizeDataGridRenderMode(value: unknown): DataGridRenderMode {return DATA_GRID_RENDER_MODES.includes(value as DataGridRenderMode) ? (value as DataGridRenderMode) : DEFAULT_EDITOR_SETTINGS.dataGridRenderMode;}+function normalizeTableFontSize(value: unknown): number {+ if (typeof value !== "number" || !Number.isFinite(value)) return TABLE_FONT_SIZE_DEFAULT;+ return Math.min(TABLE_FONT_SIZE_MAX, Math.max(TABLE_FONT_SIZE_MIN, Math.round(value)));+}+function normalizeUpdateDownloadSource(value: unknown): UpdateDownloadSource {return value === "cnb" ? "cnb" : DEFAULT_EDITOR_SETTINGS.updateDownloadSource;}@@ -617,6 +627,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, existshowColumnTypesInHeader: settings.showColumnTypesInHeader ?? DEFAULT_EDITOR_SETTINGS.showColumnTypesInHeader,compactColumnHeaderActions: settings.compactColumnHeaderActions ?? DEFAULT_EDITOR_SETTINGS.compactColumnHeaderActions,dataGridRenderMode: normalizeDataGridRenderMode(settings.dataGridRenderMode),+ tableFontSize: normalizeTableFontSize(settings.tableFontSize),structureEditorDensity: normalizeStructureEditorDensity(settings.structureEditorDensity),tableInfoDrawerWidth: normalizeDrawerWidth(settings.tableInfoDrawerWidth, 240, DEFAULT_EDITOR_SETTINGS.tableInfoDrawerWidth),cellDetailDrawerWidth: normalizeDrawerWidth(settings.cellDetailDrawerWidth, 260, DEFAULT_EDITOR_SETTINGS.cellDetailDrawerWidth),@@ -789,6 +800,7 @@ export const useSettingsStore = defineStore("settings", () => {if (partial.showColumnTypesInHeader !== undefined) editorSettings.value.showColumnTypesInHeader = partial.showColumnTypesInHeader;if (partial.compactColumnHeaderActions !== undefined) editorSettings.value.compactColumnHeaderActions = partial.compactColumnHeaderActions;if (partial.dataGridRenderMode !== undefined) editorSettings.value.dataGridRenderMode = normalizeDataGridRenderMode(partial.dataGridRenderMode);+ if (partial.tableFontSize !== undefined) editorSettings.value.tableFontSize = normalizeTableFontSize(partial.tableFontSize);if (partial.structureEditorDensity !== undefined) editorSettings.value.structureEditorDensity = normalizeStructureEditorDensity(partial.structureEditorDensity);if (partial.tableInfoDrawerWidth !== undefined) editorSettings.value.tableInfoDrawerWidth = normalizeDrawerWidth(partial.tableInfoDrawerWidth, 240, DEFAULT_EDITOR_SETTINGS.tableInfoDrawerWidth);if (partial.cellDetailDrawerWidth !== undefined) editorSettings.value.cellDetailDrawerWidth = normalizeDrawerWidth(partial.cellDetailDrawerWidth, 260, DEFAULT_EDITOR_SETTINGS.cellDetailDrawerWidth);diff --git a/packages/app-tests/settingsStore.test.ts b/packages/app-tests/settingsStore.test.tsindex f3932c7168..b3a5ebfff1 100644--- a/packages/app-tests/settingsStore.test.ts+++ b/packages/app-tests/settingsStore.test.ts@@ -190,6 +190,16 @@ test("normalizes data grid render mode", () => {assert.equal(normalizeEditorSettings({ dataGridRenderMode: "unknown" as any }).dataGridRenderMode, "canvas");});+test("normalizes table font size", () => {+ assert.equal(DEFAULT_EDITOR_SETTINGS.tableFontSize, 13);+ assert.equal(normalizeEditorSettings({}).tableFontSize, 13);+ assert.equal(normalizeEditorSettings({ tableFontSize: 12 }).tableFontSize, 12);+ assert.equal(normalizeEditorSettings({ tableFontSize: 14.6 }).tableFontSize, 15);+ assert.equal(normalizeEditorSettings({ tableFontSize: 8 }).tableFontSize, 12);+ assert.equal(normalizeEditorSettings({ tableFontSize: 20 }).tableFontSize, 16);+ assert.equal(normalizeEditorSettings({ tableFontSize: "large" as any }).tableFontSize, 13);+});+test("normalizes table structure editor density", () => {assert.equal(DEFAULT_EDITOR_SETTINGS.structureEditorDensity, "compact");assert.equal(normalizeEditorSettings({}).structureEditorDensity, "compact");