feat(ui): support customizable maximum tab width

This commit is contained in:
lxk955 authored and GitHub committed 2026-10-04 16:33:28 +08:00
1 parent 8a2241c36e
commit 9419e18b79
23 files changed
+242 -6

No files matched your search

@@ -563,3 +563,38 @@ describe("editorSettingsDraftPatchFromSettings", () => {
expect(patch.pageSize).toBe(normalizeTableOpenPageSizeDraft(999999));
});
});
describe("editorSettingsDraft - tabMaxWidth", () => {
it("includes tabMaxWidth in EDITOR_SETTINGS_DRAFT_KEYS", () => {
expect(EDITOR_SETTINGS_DRAFT_KEYS).toContain("tabMaxWidth");
});
it("maps tabMaxWidth from settings", () => {
expect(editorSettingsDraftFromSettings(makeSettings({ tabMaxWidth: 240 })).tabMaxWidth).toBe(240);
expect(editorSettingsDraftFromSettings(makeSettings({ tabMaxWidth: 0 })).tabMaxWidth).toBe(0);
});
it("detects change in tabMaxWidth", () => {
const settings = makeSettings({ tabMaxWidth: 0 });
const draft = editorSettingsDraftFromSettings(settings);
const base = editorSettingsDraftFromSettings(settings);
draft.tabMaxWidth = 240;
expect(editorSettingsDraftChanged(draft, base)).toBe(true);
});
it("detects no change when tabMaxWidth matches", () => {
const settings = makeSettings({ tabMaxWidth: 240 });
const draft = editorSettingsDraftFromSettings(settings);
const base = editorSettingsDraftFromSettings(settings);
expect(editorSettingsDraftChanged(draft, base)).toBe(false);
});
it("includes tabMaxWidth in patch when changed", () => {
const settings = makeSettings({ tabMaxWidth: 0 });
const draft = editorSettingsDraftFromSettings(settings);
const base = editorSettingsDraftFromSettings(settings);
draft.tabMaxWidth = 240;
const patch = editorSettingsPatchFromDraft(draft, base);
expect(patch.tabMaxWidth).toBe(240);
});
});
@@ -52,6 +52,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
"colorizeConnectionTabs",
"tabGroupMode",
"tabSortMode",
"tabMaxWidth",
"showColumnCommentsInHeader",
"showColumnTypesInHeader",
"showColumnHeaderTooltips",
@@ -190,6 +190,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
{ id: "appearance-welcome-page", category: "appearance", titleKey: "settings.welcomePage", descriptionKey: "settings.welcomePageDescription", targetId: "welcome-page-settings" },
{ id: "appearance-layout", category: "appearance", titleKey: "settings.appLayout", targetId: "appearance" },
{ id: "appearance-tab-layout", category: "appearance", titleKey: "settings.tabLayout", targetId: "appearance" },
{ id: "appearance-tab-max-width", category: "appearance", titleKey: "settings.tabMaxWidth", descriptionKey: "settings.tabMaxWidthDescription", targetId: "appearance" },
{ id: "appearance-connection-tab-colors", category: "appearance", titleKey: "settings.colorizeConnectionTabs", descriptionKey: "settings.colorizeConnectionTabsDescription", targetId: "appearance" },
{ id: "appearance-icons", category: "appearance", titleKey: "settings.iconTheme", targetId: "appearance", visible: desktopOnly },
{ id: "appearance-tray", category: "appearance", titleKey: "settings.showTrayIcon", descriptionKey: "settings.showTrayIconDescription", targetId: "appearance", visible: desktopOnly },
@@ -119,6 +119,7 @@ const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readon
"tabGroupMode",
"colorizeConnectionTabs",
"tabSortMode",
"tabMaxWidth",
"sidebarActivation",
"sidebarObjectDisplay",
"routineSourceOpenMode",