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

@@ -64,6 +64,7 @@ const editorSettingCategoryOverrides: Partial<Record<string, BackupSettingsCateg
tabGroupMode: "appearance",
tabGroupCustomizations: "appearance",
tabSortMode: "appearance",
tabMaxWidth: "appearance",
compactTabTitle: "appearance",
executeModeDefaultVersion: "editor",
globalConnectTimeoutSecs: "editor",
@@ -118,6 +118,7 @@ import {
type SqlCompletionTriggerMode,
type SqlTableCompletionSchemaQualification,
type TableHoverLookupMode,
normalizeTabMaxWidth,
SIDEBAR_INDENT_MIN,
SIDEBAR_INDENT_MAX,
SIDEBAR_FONT_SIZE_MIN,
@@ -720,6 +721,7 @@ const editTabPlacement = ref<TabPlacement>(settingsStore.editorSettings.tabPlace
const editColorizeConnectionTabs = ref(settingsStore.editorSettings.colorizeConnectionTabs);
const editTabGroupMode = ref<TabGroupMode>(settingsStore.editorSettings.tabGroupMode);
const editTabSortMode = ref<TabSortMode>(settingsStore.editorSettings.tabSortMode);
const editTabMaxWidth = ref<number>(settingsStore.editorSettings.tabMaxWidth);
const editShowTrayIcon = ref(settingsStore.desktopSettings.show_tray_icon);
const editQuitOnClose = ref(settingsStore.desktopSettings.quit_on_close);
const desktopCloseBehaviorResetPending = ref(false);
@@ -1094,6 +1096,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
colorizeConnectionTabs: editColorizeConnectionTabs.value,
tabGroupMode: editTabGroupMode.value,
tabSortMode: editTabSortMode.value,
tabMaxWidth: editTabMaxWidth.value,
showColumnCommentsInHeader: editShowColumnCommentsInHeader.value,
showColumnTypesInHeader: editShowColumnTypesInHeader.value,
showColumnHeaderTooltips: editShowColumnHeaderTooltips.value,
@@ -1769,6 +1772,7 @@ function syncEditorSettingsDraftFromStore() {
editColorizeConnectionTabs.value = settingsStore.editorSettings.colorizeConnectionTabs;
editTabGroupMode.value = settingsStore.editorSettings.tabGroupMode;
editTabSortMode.value = settingsStore.editorSettings.tabSortMode;
editTabMaxWidth.value = settingsStore.editorSettings.tabMaxWidth;
editShowColumnCommentsInHeader.value = settingsStore.editorSettings.showColumnCommentsInHeader;
editShowColumnTypesInHeader.value = settingsStore.editorSettings.showColumnTypesInHeader;
editShowColumnHeaderTooltips.value = settingsStore.editorSettings.showColumnHeaderTooltips;
@@ -1919,6 +1923,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
colorizeConnectionTabs: editColorizeConnectionTabs,
tabGroupMode: editTabGroupMode,
tabSortMode: editTabSortMode,
tabMaxWidth: editTabMaxWidth,
showColumnCommentsInHeader: editShowColumnCommentsInHeader,
showColumnTypesInHeader: editShowColumnTypesInHeader,
showColumnHeaderTooltips: editShowColumnHeaderTooltips,
@@ -2465,6 +2470,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editColorizeConnectionTabs.value = DEFAULT_EDITOR_SETTINGS.colorizeConnectionTabs;
editTabGroupMode.value = DEFAULT_EDITOR_SETTINGS.tabGroupMode;
editTabSortMode.value = DEFAULT_EDITOR_SETTINGS.tabSortMode;
editTabMaxWidth.value = DEFAULT_EDITOR_SETTINGS.tabMaxWidth;
editShowTrayIcon.value = DEFAULT_DESKTOP_SETTINGS.show_tray_icon;
editQuitOnClose.value = DEFAULT_DESKTOP_SETTINGS.quit_on_close;
desktopCloseBehaviorResetPending.value = true;
@@ -3160,6 +3166,10 @@ function setTabSortMode(value: TabSortMode) {
editTabSortMode.value = value;
}
function setTabMaxWidth(value: number) {
editTabMaxWidth.value = normalizeTabMaxWidth(value);
}
function setSidebarActivation(value: "single" | "double") {
editSidebarActivation.value = value;
}
@@ -7579,7 +7589,7 @@ onUnmounted(() => {
</div>
<div class="settings-appearance-group">
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
<div class="space-y-2">
<Label>{{ t("settings.tabPlacement") }}</Label>
<Select :model-value="editTabPlacement" @update:model-value="setTabPlacement($event as TabPlacement)">
@@ -7616,10 +7626,24 @@ onUnmounted(() => {
</SelectContent>
</Select>
</div>
<div class="space-y-2">
<Label>{{ t("settings.tabMaxWidth") }}</Label>
<Select :model-value="String(editTabMaxWidth)" @update:model-value="setTabMaxWidth(Number($event))">
<SelectTrigger class="w-full"><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value="0">{{ t("settings.tabMaxWidthUnlimited") }}</SelectItem>
<SelectItem value="160">{{ t("settings.tabMaxWidthCompact") }}</SelectItem>
<SelectItem value="200">{{ t("settings.tabMaxWidthMedium") }}</SelectItem>
<SelectItem value="240">{{ t("settings.tabMaxWidthStandard") }}</SelectItem>
<SelectItem value="320">{{ t("settings.tabMaxWidthWide") }}</SelectItem>
</SelectContent>
</Select>
</div>
</div>
<div class="space-y-1 text-xs text-muted-foreground">
<p>{{ t("settings.tabPlacementDescription") }}</p>
<p>{{ t("settings.tabOrganizationDescription") }}</p>
<p>{{ t("settings.tabMaxWidthDescription") }}</p>
</div>
</div>
@@ -42,6 +42,7 @@ import {
Clock3,
Copy,
Database,
FoldHorizontal,
ListFilter,
ListOrdered,
Maximize2,
@@ -189,8 +190,15 @@ const showTabTreeGuides = computed(() => isVerticalLayout.value && !isTabBarColl
// the shared vertical rail width; fill that rail so nested pane bars stay in
// sync while the resize handle updates the outer panel (issue #9977).
const tabBarStyle = computed<CSSProperties | undefined>(() => {
if (!isVerticalLayout.value) return undefined;
return { width: "100%", flex: "0 0 100%" };
const styles: CSSProperties = {};
if (isVerticalLayout.value) {
styles.width = "100%";
styles.flex = "0 0 100%";
}
if (!isVerticalLayout.value && settingsStore.editorSettings.tabMaxWidth > 0) {
styles["--tab-max-width"] = `${settingsStore.editorSettings.tabMaxWidth}px`;
}
return Object.keys(styles).length > 0 ? styles : undefined;
});
const tabBarCollapseIcon = computed(() => {
const isLeft = settingsStore.editorSettings.tabPlacement === "left";
@@ -375,8 +383,15 @@ const tabPlacementItems = computed(() => [
{ value: "left", label: t("settings.tabPlacementLeft") },
{ value: "right", label: t("settings.tabPlacementRight") },
]);
const tabMaxWidthItems = computed(() => [
{ value: 0, label: t("settings.tabMaxWidthUnlimited") },
{ value: 160, label: t("settings.tabMaxWidthCompact") },
{ value: 200, label: t("settings.tabMaxWidthMedium") },
{ value: 240, label: t("settings.tabMaxWidthStandard") },
{ value: 320, label: t("settings.tabMaxWidthWide") },
]);
type TabPreferencePatch = Partial<Pick<EditorSettings, "tabPlacement" | "tabGroupMode" | "tabSortMode" | "tabGroupCustomizations">>;
type TabPreferencePatch = Partial<Pick<EditorSettings, "tabPlacement" | "tabGroupMode" | "tabSortMode" | "tabGroupCustomizations" | "tabMaxWidth">>;
async function persistTabPreferences(partial: TabPreferencePatch) {
try {
@@ -398,6 +413,10 @@ function updateTabPlacement(value: string) {
if (value === "top" || value === "bottom" || value === "left" || value === "right") void persistTabPreferences({ tabPlacement: value });
}
function updateTabMaxWidth(value: number) {
if (Number.isFinite(value) && value >= 0) void persistTabPreferences({ tabMaxWidth: value });
}
function databaseTabGroupKey(tab: QueryTab) {
const database = tab.database || "";
if (connectionStore.getConfig(tab.connectionId)?.db_type === "redis") {
@@ -879,8 +898,9 @@ const tabOrganizationItems = computed(() => [
groupLabel: index === 0 ? t("settings.tabGroup") : undefined,
})),
...tabSortItems.value.map((item, index) => ({ ...item, value: `sort:${item.value}`, icon: { manual: ListOrdered, "created-asc": Clock3, "title-asc": ArrowDownAZ }[item.value], separatorBefore: index === 0, groupLabel: index === 0 ? t("settings.tabSort") : undefined })),
...tabMaxWidthItems.value.map((item, index) => ({ ...item, value: `maxwidth:${item.value}`, icon: item.value === 0 ? Maximize2 : FoldHorizontal, separatorBefore: index === 0, groupLabel: index === 0 ? t("settings.tabMaxWidth") : undefined })),
]);
const selectedTabOrganizationItems = computed(() => [`placement:${settingsStore.editorSettings.tabPlacement}`, `group:${settingsStore.editorSettings.tabGroupMode}`, `sort:${settingsStore.editorSettings.tabSortMode}`]);
const selectedTabOrganizationItems = computed(() => [`placement:${settingsStore.editorSettings.tabPlacement}`, `group:${settingsStore.editorSettings.tabGroupMode}`, `sort:${settingsStore.editorSettings.tabSortMode}`, `maxwidth:${settingsStore.editorSettings.tabMaxWidth}`]);
function selectTabOrganizationItem(value: string) {
const [section, option] = value.split(":");
@@ -888,6 +908,7 @@ function selectTabOrganizationItem(value: string) {
if (section === "placement") updateTabPlacement(option);
else if (section === "group") updateTabGroupMode(option);
else if (section === "sort") updateTabSortMode(option);
else if (section === "maxwidth") updateTabMaxWidth(Number(option));
}
function getTabGroupMenuItems(tab: QueryTab): ContextMenuItem[] {
@@ -1566,6 +1587,7 @@ watch(
props.specialPageTabs?.driverStoreOpen,
settingsStore.editorSettings.tabLayout,
settingsStore.editorSettings.tabGroupMode,
settingsStore.editorSettings.tabMaxWidth,
compactTabTitle.value,
Array.from(collapsedTabGroups.value).sort().join("|"),
],
@@ -1618,6 +1640,7 @@ watch([() => props.specialPageTabs?.settingsActive, () => props.specialPageTabs?
:data-group-id="groupId"
:data-group-mode="settingsStore.editorSettings.tabGroupMode"
:data-placement="settingsStore.editorSettings.tabPlacement"
:data-has-max-tab-width="!isVerticalLayout && settingsStore.editorSettings.tabMaxWidth > 0"
>
<!-- Compact vertical toolbar: search, tab organization, collapse. -->
<div v-if="isVerticalLayout" class="flex h-9 shrink-0 items-center gap-0.5 border-b p-1" :class="isTabBarCollapsed ? 'justify-center' : ''">
@@ -45,6 +45,7 @@ import EditorGroupTabBar from "../EditorGroupTabBar.vue";
import { createNoopEditorToolbarActions, EDITOR_TOOLBAR_ACTIONS, type EditorToolbarActions } from "../editorToolbarActions";
import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useSettingsStore } from "@/stores/settingsStore";
import type { ConnectionConfig } from "@/types/database";
function createHost(): HTMLDivElement {
@@ -729,4 +730,27 @@ describe("EditorGroupTabBar behavior", () => {
app.unmount();
host.remove();
});
it("applies --tab-max-width and data-has-max-tab-width when tabMaxWidth is configured", async () => {
const store = useQueryStore();
const settings = useSettingsStore();
settings.editorSettings.tabMaxWidth = 240;
const firstId = store.createTab("pg-1", "app", "Query 1", "query");
const mainGroup = store.groups[0];
const { app, host } = mountBar(mainGroup.id, [firstId], firstId, pinia);
await settle();
const bar = host.querySelector<HTMLElement>(".app-tab-bar")!;
expect(bar.dataset.hasMaxTabWidth).toBe("true");
expect(bar.style.getPropertyValue("--tab-max-width")).toBe("240px");
// Setting tabMaxWidth to 0 removes the limit
settings.editorSettings.tabMaxWidth = 0;
await settle();
expect(bar.dataset.hasMaxTabWidth).toBe("false");
expect(bar.style.getPropertyValue("--tab-max-width")).toBe("");
app.unmount();
host.remove();
});
});
@@ -334,6 +334,7 @@
.app-tab-bar:not(.vertical-tab-layout) .app-tab-pill {
border: 0.5px solid color-mix(in oklch, var(--foreground) 14%, var(--border));
max-width: var(--tab-max-width, none);
}
.app-tab-bar:not(.vertical-tab-layout) .app-tab-pill[data-active-tab="true"] {
@@ -843,7 +844,7 @@
* expand smoothly instead of appearing and disappearing in one frame. */
.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode)) .tab-group-entry {
min-width: 0;
max-width: var(--tab-group-entry-expanded-width, 100%);
max-width: var(--tab-group-entry-expanded-width, var(--tab-max-width, 100%));
max-height: 2rem;
overflow: hidden;
transition:
@@ -859,6 +860,11 @@
flex: none;
}
.app-tab-bar:not(.vertical-tab-layout):not(:has(.wrap-mode))[data-has-max-tab-width="true"] .tab-group-entry[data-tab-group-id] > .tab-group-tab {
min-width: var(--tab-group-entry-expanded-width, 0) !important;
max-width: var(--tab-max-width, 100%);
}
/* The classic single-row strip is 2.25rem tall. Keep ordinary tab wrappers
* at the full row height so direct tabs such as Settings do not look taller. */
.app-tab-bar.classic-tab-layout:not(.vertical-tab-layout):not(:has(.wrap-mode)) .tab-group-entry {
@@ -906,6 +912,10 @@
/* Do not animate dimensions in wrapped mode. The browser must reflow the
* complete set of rows immediately when a group is expanded or collapsed. */
.app-tab-scroll.wrap-mode .tab-group-entry {
max-width: var(--tab-max-width, none);
}
.app-tab-scroll.wrap-mode .tab-group-entry,
.app-tab-scroll.wrap-mode .tab-group-entry--collapsed,
.app-tab-scroll.wrap-mode .tab-group-tab,
+7
View File
@@ -7132,6 +7132,13 @@ export default withEnglishFallback({
tabSortCreated: "Yaradılma vaxtı",
tabSortTitle: "Vərəq adı",
tabOrganizationDescription: "Qruplaşdırma və sıralama yalnız göstərilən ardıcıllığa təsir edir. Əl ilə sıralamada sürükləmə mümkündür.",
tabMaxWidth: "Vərəqin maksimum eni",
tabMaxWidthDescription: "Üfüqi vərəqlərin maksimum enini məhdudlaşdırır, uzun başlıqları qısaldır. Tam başlığı görmək üçün üzərinə gəlin.",
tabMaxWidthUnlimited: "Məhdudiyyətsiz (adaptiv)",
tabMaxWidthCompact: "Yığcam (160px)",
tabMaxWidthMedium: "Orta (200px)",
tabMaxWidthStandard: "Standart (240px)",
tabMaxWidthWide: "Geniş (320px)",
iconTheme: "İkon və loqo üslubu",
iconThemeDefault: "Standart",
iconThemeDefaultDescription: "DBX tətbiqinin rəngli ikonundan istifadə et.",
+7
View File
@@ -8002,6 +8002,13 @@ export default {
tabSortCreated: "Creation time",
tabSortTitle: "Tab name",
tabOrganizationDescription: "Grouping and sorting affect only the displayed order. Dragging is available in manual order.",
tabMaxWidth: "Maximum tab width",
tabMaxWidthDescription: "Limit the maximum width of horizontal tabs, truncating long titles with ellipsis. Hover to view the full title.",
tabMaxWidthUnlimited: "Unlimited (adaptive)",
tabMaxWidthCompact: "Compact (160px)",
tabMaxWidthMedium: "Medium (200px)",
tabMaxWidthStandard: "Standard (240px)",
tabMaxWidthWide: "Wide (320px)",
iconTheme: "Icon and logo style",
iconThemeDefault: "Default",
iconThemeDefaultDescription: "Use the color DBX app icon.",
+7
View File
@@ -7339,6 +7339,13 @@ export default withEnglishFallback({
tabSortCreated: "Hora de creación",
tabSortTitle: "Nombre de pestaña",
tabOrganizationDescription: "La agrupación y la ordenación solo afectan al orden visible. Arrastre disponible en orden manual.",
tabMaxWidth: "Ancho máximo de pestaña",
tabMaxWidthDescription: "Limita el ancho máximo de las pestañas horizontales, truncando títulos largos. Pase el cursor para ver el título completo.",
tabMaxWidthUnlimited: "Sin límite (adaptativo)",
tabMaxWidthCompact: "Compacto (160px)",
tabMaxWidthMedium: "Medio (200px)",
tabMaxWidthStandard: "Estándar (240px)",
tabMaxWidthWide: "Ancho (320px)",
iconTheme: "Estilo de icono y logo",
iconThemeDefault: "Predeterminado",
iconThemeDefaultDescription: "Usar el icono de color de DBX.",
+7
View File
@@ -7796,6 +7796,13 @@ export default withEnglishFallback({
tabSortCreated: "Waktu pembuatan",
tabSortTitle: "Nama tab",
tabOrganizationDescription: "Pengelompokan dan pengurutan hanya memengaruhi urutan tampilan. Menyeret tab tersedia dalam urutan manual.",
tabMaxWidth: "Lebar tab maksimum",
tabMaxWidthDescription: "Batasi lebar maksimum tab horizontal, memotong judul yang panjang. Arahkan kursor untuk melihat judul lengkap.",
tabMaxWidthUnlimited: "Tanpa batas (adaptif)",
tabMaxWidthCompact: "Kompak (160px)",
tabMaxWidthMedium: "Sedang (200px)",
tabMaxWidthStandard: "Standar (240px)",
tabMaxWidthWide: "Lebar (320px)",
iconTheme: "Gaya ikon dan logo",
iconThemeDefault: "Default",
iconThemeDefaultDescription: "Gunakan ikon aplikasi DBX berwarna.",
+7
View File
@@ -7117,6 +7117,13 @@ export default withEnglishFallback({
tabSortCreated: "Data di creazione",
tabSortTitle: "Nome scheda",
tabOrganizationDescription: "Raggruppamento e ordinamento influenzano solo l'ordine visibile. Il trascinamento è disponibile nell'ordine manuale.",
tabMaxWidth: "Larghezza massima scheda",
tabMaxWidthDescription: "Limita la larghezza massima delle schede orizzontali, troncando i titoli lunghi. Passa il cursore per vedere il titolo completo.",
tabMaxWidthUnlimited: "Nessun limite (adattivo)",
tabMaxWidthCompact: "Compatto (160px)",
tabMaxWidthMedium: "Medio (200px)",
tabMaxWidthStandard: "Standard (240px)",
tabMaxWidthWide: "Ampio (320px)",
iconTheme: "Stile icona e logo",
iconThemeDefault: "Predefinito",
iconThemeDefaultDescription: "Utilizza l'icona colorata dell'app DBX.",
+7
View File
@@ -7148,6 +7148,13 @@ export default withEnglishFallback({
tabSortCreated: "作成日時",
tabSortTitle: "タブ名",
tabOrganizationDescription: "グループ化と並べ替えは表示順にのみ影響します。ドラッグは手動順で利用できます。",
tabMaxWidth: "タブの最大幅",
tabMaxWidthDescription: "水平タブの最大表示幅を制限し、長すぎるタイトルは省略してホバー時に完全なタイトルを表示します。",
tabMaxWidthUnlimited: "制限なし(自動適合)",
tabMaxWidthCompact: "コンパクト (160px)",
tabMaxWidthMedium: "標準的 (200px)",
tabMaxWidthStandard: "標準 (240px)",
tabMaxWidthWide: "ワイド (320px)",
iconTheme: "アイコンとロゴのスタイル",
iconThemeDefault: "デフォルト",
iconThemeDefaultDescription: "カラーDBXアプリアイコンを使用。",
+7
View File
@@ -6923,6 +6923,13 @@ export default withEnglishFallback({
tabSortCreated: "생성 시간",
tabSortTitle: "탭 이름",
tabOrganizationDescription: "그룹화와 정렬은 표시 순서에만 영향을 줍니다. 끌기는 수동 순서에서 사용할 수 있습니다.",
tabMaxWidth: "탭 최대 너비",
tabMaxWidthDescription: "가로 탭의 최대 표시 너비를 제한하며, 긴 제목은 말줄임표로 표시하고 마우스 호버 시 전체 제목을 표시합니다.",
tabMaxWidthUnlimited: "제한 없음 (자동 맞춤)",
tabMaxWidthCompact: "간결하게 (160px)",
tabMaxWidthMedium: "중간 (200px)",
tabMaxWidthStandard: "표준 (240px)",
tabMaxWidthWide: "넓게 (320px)",
iconTheme: "아이콘 및 로고 스타일",
iconThemeDefault: "기본",
iconThemeDefaultDescription: "컬러 DBX 앱 아이콘을 사용합니다.",
+7
View File
@@ -7119,6 +7119,13 @@ export default withEnglishFallback({
tabSortCreated: "Hora de criação",
tabSortTitle: "Nome da aba",
tabOrganizationDescription: "Agrupamento e ordenação afetam apenas a ordem exibida. Arrastar fica disponível na ordem manual.",
tabMaxWidth: "Largura máxima da aba",
tabMaxWidthDescription: "Limita a largura máxima das abas horizontais, truncando títulos longos. Passe o mouse para ver o título completo.",
tabMaxWidthUnlimited: "Sem limite (adaptativo)",
tabMaxWidthCompact: "Compacto (160px)",
tabMaxWidthMedium: "Médio (200px)",
tabMaxWidthStandard: "Padrão (240px)",
tabMaxWidthWide: "Largo (320px)",
iconTheme: "Estilo do ícone e do logo",
iconThemeDefault: "Padrão",
iconThemeDefaultDescription: "Usar o ícone colorido do app DBX.",
+7
View File
@@ -8332,6 +8332,13 @@ export default withEnglishFallback({
tabSortCreated: "Время создания",
tabSortTitle: "Имя вкладки",
tabOrganizationDescription: "Группировка и сортировка влияют только на отображаемый порядок. Перетаскивание доступно при ручном порядке.",
tabMaxWidth: "Максимальная ширина вкладки",
tabMaxWidthDescription: "Ограничивает максимальную ширину горизонтальных вкладок, усекая длинные названия. Наведите курсор для полного названия.",
tabMaxWidthUnlimited: "Без ограничений (адаптивная)",
tabMaxWidthCompact: "Компактная (160px)",
tabMaxWidthMedium: "Средняя (200px)",
tabMaxWidthStandard: "Стандартная (240px)",
tabMaxWidthWide: "Широкая (320px)",
iconTheme: "Стиль значка и логотипа",
iconThemeDefault: "По умолчанию",
iconThemeDefaultDescription: "Использовать цветной значок приложения DBX.",
+7
View File
@@ -7014,6 +7014,13 @@ export default withEnglishFallback({
tabSortCreated: "Oluşturulma zamanı",
tabSortTitle: "Sekme adı",
tabOrganizationDescription: "Gruplama ve sıralama yalnızca görüntülenen sırayı etkiler. Sürükleme, elle sıralamada kullanılabilir.",
tabMaxWidth: "Maksimum sekme genişliği",
tabMaxWidthDescription: "Yatay sekmelerin maksimum genişliğini sınırlar, uzun başlıkları kısaltır. Tam başlığı görmek için üzerine gelin.",
tabMaxWidthUnlimited: "Sınırsız (uyarlanabilir)",
tabMaxWidthCompact: "Kompakt (160px)",
tabMaxWidthMedium: "Orta (200px)",
tabMaxWidthStandard: "Standart (240px)",
tabMaxWidthWide: "Geniş (320px)",
iconTheme: "Simge ve logo biçemi",
iconThemeDefault: "Varsayılan",
iconThemeDefaultDescription: "Renkli DBX uygulama simgesini kullan.",
+7
View File
@@ -7988,6 +7988,13 @@ export default withEnglishFallback({
tabSortCreated: "按创建时间",
tabSortTitle: "按标签页名称",
tabOrganizationDescription: "分组和排序只影响显示顺序;仅手动排序时支持拖拽。",
tabMaxWidth: "标签最大宽度",
tabMaxWidthDescription: "限制水平标签页的最大显示宽度,超出时省略显示,悬停显示完整标题。",
tabMaxWidthUnlimited: "不限制(完整自适应)",
tabMaxWidthCompact: "紧凑 (160px)",
tabMaxWidthMedium: "中等 (200px)",
tabMaxWidthStandard: "标准 (240px)",
tabMaxWidthWide: "宽松 (320px)",
iconTheme: "图标与 Logo 样式",
iconThemeDefault: "默认",
iconThemeDefaultDescription: "使用彩色 DBX 应用图标。",
+7
View File
@@ -6471,6 +6471,13 @@ export default withEnglishFallback({
tabSortCreated: "依建立時間",
tabSortTitle: "依標籤頁名稱",
tabOrganizationDescription: "分組和排序只影響顯示順序;只有手動排序時可拖曳。",
tabMaxWidth: "標籤最大寬度",
tabMaxWidthDescription: "限制水平標籤頁的最大顯示寬度,超出時省略顯示,懸停顯示完整標題。",
tabMaxWidthUnlimited: "不限制(完整自適應)",
tabMaxWidthCompact: "緊湊 (160px)",
tabMaxWidthMedium: "中等 (200px)",
tabMaxWidthStandard: "標準 (240px)",
tabMaxWidthWide: "寬鬆 (320px)",
iconTheme: "圖示與 Logo 樣式",
iconThemeDefault: "預設",
iconThemeDefaultDescription: "使用彩色 DBX 應用程式圖示。",
@@ -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",
+20
View File
@@ -1012,6 +1012,26 @@ describe("normalizeEditorSettings - tabLayout", () => {
});
});
describe("normalizeEditorSettings - tabMaxWidth", () => {
it("defaults tabMaxWidth to 0", () => {
expect(normalizeEditorSettings({}).tabMaxWidth).toBe(0);
});
it("preserves valid width values", () => {
expect(normalizeEditorSettings({ tabMaxWidth: 160 }).tabMaxWidth).toBe(160);
expect(normalizeEditorSettings({ tabMaxWidth: 240 }).tabMaxWidth).toBe(240);
expect(normalizeEditorSettings({ tabMaxWidth: 320 }).tabMaxWidth).toBe(320);
});
it("falls back to 0 for invalid values", () => {
expect(normalizeEditorSettings({ tabMaxWidth: -10 } as any).tabMaxWidth).toBe(0);
expect(normalizeEditorSettings({ tabMaxWidth: 9999 } as any).tabMaxWidth).toBe(0);
expect(normalizeEditorSettings({ tabMaxWidth: "240" } as any).tabMaxWidth).toBe(0);
expect(normalizeEditorSettings({ tabMaxWidth: null } as any).tabMaxWidth).toBe(0);
expect(normalizeEditorSettings({ tabMaxWidth: undefined } as any).tabMaxWidth).toBe(0);
});
});
describe("normalizeEditorSettings - sidebarPinDefaultDatabase", () => {
it("defaults sidebarPinDefaultDatabase to true", () => {
expect(normalizeEditorSettings({}).sidebarPinDefaultDatabase).toBe(true);
+12
View File
@@ -914,6 +914,8 @@ export interface EditorSettings {
tabGroupMode: TabGroupMode;
tabGroupCustomizations: Record<string, TabGroupCustomization>;
tabSortMode: TabSortMode;
/** 水平标签页最大显示宽度(像素,0 表示不限制)。 */
tabMaxWidth: number;
appLayout: "separated" | "classic";
pageSize: number;
tableOpenPageSize: number;
@@ -1242,6 +1244,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
tabGroupMode: "none",
tabGroupCustomizations: {},
tabSortMode: "manual",
tabMaxWidth: 0,
appLayout: "classic",
pageSize: 100,
tableOpenPageSize: 100,
@@ -1460,6 +1463,13 @@ function normalizeTabSortMode(value: unknown): TabSortMode {
return TAB_SORT_MODES.includes(value as TabSortMode) ? (value as TabSortMode) : DEFAULT_EDITOR_SETTINGS.tabSortMode;
}
export function normalizeTabMaxWidth(value: unknown): number {
if (typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1200) {
return Math.round(value);
}
return DEFAULT_EDITOR_SETTINGS.tabMaxWidth;
}
function normalizeCellDetailPanelLayout(value: unknown): CellDetailPanelLayout {
return CELL_DETAIL_PANEL_LAYOUTS.includes(value as CellDetailPanelLayout) ? (value as CellDetailPanelLayout) : DEFAULT_EDITOR_SETTINGS.cellDetailPanelLayout;
}
@@ -1842,6 +1852,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
tabGroupMode: normalizeTabGroupMode(settings.tabGroupMode),
tabGroupCustomizations: normalizeTabGroupCustomizations(settings.tabGroupCustomizations),
tabSortMode: normalizeTabSortMode(settings.tabSortMode),
tabMaxWidth: normalizeTabMaxWidth(settings.tabMaxWidth),
appLayout: settings.appLayout ?? DEFAULT_EDITOR_SETTINGS.appLayout,
pageSize: normalizeResultPageSize(settings.pageSize),
tableOpenPageSize: normalizeResultPageSize(settings.tableOpenPageSize, DEFAULT_EDITOR_SETTINGS.tableOpenPageSize),
@@ -2696,6 +2707,7 @@ export const useSettingsStore = defineStore("settings", () => {
if (partial.tabGroupMode !== undefined) editorSettings.value.tabGroupMode = normalizeTabGroupMode(partial.tabGroupMode);
if (partial.tabGroupCustomizations !== undefined) editorSettings.value.tabGroupCustomizations = normalizeTabGroupCustomizations(partial.tabGroupCustomizations);
if (partial.tabSortMode !== undefined) editorSettings.value.tabSortMode = normalizeTabSortMode(partial.tabSortMode);
if (partial.tabMaxWidth !== undefined) editorSettings.value.tabMaxWidth = normalizeTabMaxWidth(partial.tabMaxWidth);
if (partial.appLayout !== undefined) editorSettings.value.appLayout = partial.appLayout;
if (partial.pageSize !== undefined) editorSettings.value.pageSize = normalizeResultPageSize(partial.pageSize);
if (partial.tableOpenPageSize !== undefined) editorSettings.value.tableOpenPageSize = normalizeResultPageSize(partial.tableOpenPageSize, DEFAULT_EDITOR_SETTINGS.tableOpenPageSize);