import { IRow, ICell, IColumn, EditorUsage, IBodyCellNamePolicy, ISelection, ICellNN, } from '../index.data'; import { FormulaManagerConfig } from '../formula-manager/index.data'; /** * 与外界交换数据的关键结构 * 包含cellIds(id1, null, null , id2) 这样的结构 * cells必须与cellIds对齐, 也是[cell1, null, null, cell2] 这样的结构 * 而cells如果从数据库回传, 则可能是 [cell1, cell2] 这样的结构, 则需要预处理进行对齐( 插入null ) */ export type IRowWithCell = IRow & { cells: ICell[]; }; export type Props = { // 是否enzyme测试环境 env?: 'test'; // 使用方式: 选行, 选单元格, 作为编辑器 usage: EditorUsage; columns: IColumn[]; rows: IRowWithCell[]; // {i:-1, j:0}: 冻结第1列 // {i:0, j: -1}: 冻结第1行 // {i:-1, j:-1}: 不冻结 freezeAt?: { i: number; j: number }; // label公式:A3, K!A3 // 第一次初始化时使用label公式比较方便, 默认是id公式 formulaType?: 'label' | 'id'; onSelectionChanged?: (selection: ISelection) => void; onError?: (e: Error) => void; formulaConfig?: | ({ userFormula: 'byPosition'; } & FormulaManagerConfig) | ({ userFormula: 'byName'; bodyCellNamePolicy?: IBodyCellNamePolicy; } & FormulaManagerConfig); // 例如: construction的第2-5个单元格的对号切换, 就可以用这个解决 // 解释参见 todo.md (2020-06-06, 搜costType) checkableConfig?: { isChecked(cell: ICellNN, row: IRow): boolean; checkable(cell: ICellNN, row: IRow): boolean; onCellChecked(checked: boolean, setCellData: (cellPatch: Partial) => void): void; }; // 仅当使用了type=tree时, 并且使用了cell.type===rowNo才需要配置 // 若不配置, 则默认值参见RowNoRenderer/index.tsx rowNoTemplates?: string[]; // 禁用自动计算, 默认为false disableAutoCalculate?: boolean; // 预加载高度 // bottom一般直取接500 // 而right: // 对于象 估算表这样的表格, 最好让right=0, 全部显示出来, 不需要预加载 // 对于象 国安建工 成本详表 这样的表, 太宽了, 可以预加载, 如500px padding?: { right: number; bottom: number }; };