- 新增业务部台账、收款记录、业务条线说明及 ledger-shared / vm-shared 公共壳层 - 租赁业务台账:字段计算、宽表交互、标注 PRD 与表头说明修复 - 租赁合同:列表/表单增强、客户资质与审批规则 - 侧栏调整:工作台移至 OneOS 根目录,台账与数据分析分组更新 - 补充 S3 批量发布脚本与弹窗明细表规范 Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
1001 B
TypeScript
26 lines
1001 B
TypeScript
import type { ColumnsType } from 'antd/es/table';
|
||
|
||
/** 弹窗明细表统一 className,配合 src/common/modal-detail-table.css */
|
||
export const LN_MODAL_DETAIL_TABLE_CLASS = 'ln-modal-detail-table';
|
||
|
||
/** 计算 Ant Table scroll.x;expand 默认预留滚动条/展开列余量 */
|
||
export function sumColumnScrollX<T>(columns: ColumnsType<T>, expand = 0): number {
|
||
const base = columns.reduce((sum, col) => sum + (Number(col.width) || 0), 0);
|
||
return base + expand;
|
||
}
|
||
|
||
/** 开发环境检查:弹窗表每列必须设置 width,避免表头表体错行 */
|
||
export function warnMissingModalColumnWidths<T>(
|
||
columns: ColumnsType<T>,
|
||
context: string,
|
||
): void {
|
||
if (typeof import.meta !== 'undefined' && !import.meta.env?.DEV) return;
|
||
const missing = columns.filter((col) => col.width == null);
|
||
if (missing.length > 0) {
|
||
console.warn(
|
||
`[${context}] 弹窗表格列缺少 width,可能导致表头与内容错行:`,
|
||
missing.map((col) => col.key ?? col.title),
|
||
);
|
||
}
|
||
}
|