🐛 fix(sidebar): 修复长表名横向滚动截断

- 取消 V2 对象树等宽标签自截断,支持横向滚动展示完整名称

- 提高对象树横向滚动宽度上限并补充回归测试
This commit is contained in:
Syngnat
2026-06-24 22:42:04 +08:00
parent 672d05d124
commit 6d1c034052
3 changed files with 22 additions and 2 deletions

View File

@@ -1064,6 +1064,8 @@ describe('Sidebar locate toolbar', () => {
expect(css).toMatch(/\.gn-v2-tree-status::before \{[^}]*width: 7px;[^}]*height: 7px;[^}]*border-radius: 50%;/s);
expect(css).toMatch(/\.gn-v2-tree-status\.is-success::before \{[^}]*background: #22c55e;[^}]*box-shadow: 0 0 0 4px rgba\(34, 197, 94, 0\.18\);/s);
expect(css).toMatch(/\.gn-v2-tree-label \{[^}]*overflow: hidden;[^}]*text-overflow: ellipsis;/s);
expect(css).toMatch(/\.gn-v2-tree-title\.is-mono \{[^}]*width: max-content;[^}]*min-width: 100%;[^}]*flex: 0 0 auto;/s);
expect(css).toMatch(/\.gn-v2-tree-title\.is-mono \.gn-v2-tree-label \{[^}]*flex: 0 0 auto;[^}]*overflow: visible;[^}]*text-overflow: clip;/s);
expect(css).toMatch(/\.gn-v2-tree-folder-icon \{[^}]*width: 22px;[^}]*height: 22px;[^}]*flex: 0 0 22px;/s);
expect(css).not.toContain('.gn-v2-tree-connection-meta');
});
@@ -1088,9 +1090,18 @@ describe('Sidebar locate toolbar', () => {
type: 'table',
},
] as any, 900);
const veryLongWidth = estimateV2TreeHorizontalScrollWidth([
{
title: `example.main.${'order_detail_with_long_business_suffix_'.repeat(6)}`,
key: 'table-very-long',
type: 'table',
},
] as any, 320);
expect(narrowWidth).toBeGreaterThan(260);
expect(narrowWidth).toBeLessThanOrEqual(960);
expect(narrowWidth).toBeLessThanOrEqual(2600);
expect(veryLongWidth).toBeGreaterThan(960);
expect(veryLongWidth).toBeLessThanOrEqual(2600);
expect(wideWidth).toBeUndefined();
});

View File

@@ -323,7 +323,7 @@ const V2_EXPLORER_FILTER_GROUP_KEYS: Record<Exclude<V2ExplorerFilter, 'all'>, st
events: ['events'],
};
const V2_TREE_HORIZONTAL_SCROLL_MAX_WIDTH = 960;
const V2_TREE_HORIZONTAL_SCROLL_MAX_WIDTH = 2600;
const V2_TREE_HORIZONTAL_SCROLL_BASE_WIDTH = 88;
const V2_TREE_HORIZONTAL_SCROLL_INDENT_WIDTH = 24;
const V2_TREE_HORIZONTAL_SCROLL_AVG_CHAR_WIDTH = 8;

View File

@@ -2726,7 +2726,16 @@ body[data-ui-version="v2"] .gn-v2-tree-title {
line-height: 1.25;
}
body[data-ui-version="v2"] .gn-v2-tree-title.is-mono {
width: max-content;
min-width: 100%;
flex: 0 0 auto;
}
body[data-ui-version="v2"] .gn-v2-tree-title.is-mono .gn-v2-tree-label {
flex: 0 0 auto;
overflow: visible;
text-overflow: clip;
font-family: inherit;
font-size: inherit;
font-weight: 400 !important;