fix(ui): 完善控制台列表并优化企业中心与个人操作

This commit is contained in:
zhanjunhao
2026-11-25 10:05:30 +08:00
parent dd4da99f1d
commit a532b860c8
51 changed files with 1736 additions and 1306 deletions
+28 -4
View File
@@ -91,10 +91,28 @@ const markFixedRight = (
.join(' '),
});
export function prepareCenterColumns(columns, width = 0, measuredWidths = {}) {
export function prepareCenterColumns(
columns,
width = 0,
measuredWidths = {},
minScrollableWidth = 0,
) {
const leaves = leafColumns(columns);
const last = leaves.at(-1);
const hasAction = last && isActionColumn(last);
const fixedWidthLimit =
width > 0 ? Math.max(56, width - minScrollableWidth) : 0;
const otherFixedWidth = leaves.reduce(
(total, column) =>
column !== last && column.fixed ? total + columnWidth(column) : total,
0,
);
const remainingActionWidth = fixedWidthLimit - otherFixedWidth;
// Keep both sides fixed when wrapped action buttons still have enough space.
const actionWidthLimit =
minScrollableWidth > 0 && remainingActionWidth >= 120
? remainingActionWidth
: fixedWidthLimit;
const pinnedWidth = hasAction
? leaves.reduce(
(total, column, index) =>
@@ -102,7 +120,7 @@ export function prepareCenterColumns(columns, width = 0, measuredWidths = {}) {
(column === last
? Math.min(
actionWidth(column, measuredWidths[index]),
width || Infinity,
actionWidthLimit || Infinity,
)
: column.fixed
? columnWidth(column)
@@ -110,7 +128,7 @@ export function prepareCenterColumns(columns, width = 0, measuredWidths = {}) {
0,
)
: 0;
const releaseOtherFixed = width > 0 && pinnedWidth > width;
const releaseOtherFixed = width > 0 && pinnedWidth > fixedWidthLimit;
const estimatedTotal = leaves.reduce(
(total, column) => total + columnWidth(column),
0,
@@ -126,7 +144,13 @@ export function prepareCenterColumns(columns, width = 0, measuredWidths = {}) {
return { ...column, children: column.children.map(mapColumn) };
const columnIndex = index++;
if (hasAction && column === last)
return markFixedRight(column, columnIndex, true, measuredWidths, width);
return markFixedRight(
column,
columnIndex,
true,
measuredWidths,
actionWidthLimit,
);
if (fallback.has(column)) return markFixedRight(column, columnIndex);
if (releaseOtherFixed && column.fixed) {
const { fixed: _fixed, ...scrollable } = column;