fix(ui): 修复固定列表头并优化官网指标配置

This commit is contained in:
zhanjunhao
2026-11-17 17:47:57 +08:00
parent d878f0db21
commit 737c353d84
28 changed files with 351 additions and 108 deletions
+30
View File
@@ -112,3 +112,33 @@ test('recognizes translated operation headers without requiring a key', async ()
});
assert.equal(isActionColumn({ title: 'Actions', render: () => null }), true);
});
test('releases competing fixed columns when the operation area would overlap them', () => {
const columns = [
{ key: 'name', width: 180, fixed: 'left' },
{ key: 'description', width: 300 },
{ title: '操作', key: 'actions', render: () => null },
];
const narrow = prepareCenterColumns(columns, 321, { 2: 240 });
assert.equal(narrow[0].fixed, undefined);
assert.equal(narrow[0].width, 180);
assert.equal(narrow[2].fixed, 'right');
assert.equal(narrow[2].width, 240);
const wide = prepareCenterColumns(columns, 900, { 2: 240 });
assert.equal(wide[0].fixed, 'left');
assert.equal(wide[2].width, 240);
assert.equal(columns[0].fixed, 'left');
});
test('bounds measured operation widths to the viewport and restores them after resize', () => {
const render = () => null;
const columns = [
{ key: 'name', width: 200 },
{ title: '操作', render },
];
const narrow = prepareCenterColumns(columns, 280, { 1: 350 });
assert.equal(narrow[1].width, 280);
assert.equal(narrow[1].render, render);
assert.equal(prepareCenterColumns(columns, 900, { 1: 350 })[1].width, 350);
assert.equal(prepareCenterColumns(columns, 0, { 1: 350 })[1].width, 350);
});