import { CSSProperties, ReactNode } from 'react'; export declare type IDataTableCellRender = (cell: ICell, info: { rowIndex: number; colIndex: number; }) => { editing?: ReactNode; normal?: ReactNode; }; export interface IDataTableProps { /** * @description 自定义样式 * @default - */ style?: CSSProperties; /** * @description 自定义类名 * @default - */ className?: string; /** * @description 单元格 * @default [] */ cells: ICell[][]; /** * @description 单元格数值 * @default [] */ mask?: number[][]; /** * @description 默认页码 * @default { current: 1; pageSize: 300 } */ defaultPagination?: { current: number; pageSize: number; }; /** * @description 是否显示斑马纹 * @default false */ striped?: boolean; /** * @description 是否为伸展模式 * @default false */ stretch?: boolean; /** * @description 表格布局 * @default auto */ layout?: 'auto' | 'fixed'; /** * @description 自定义单元格 render * @default - */ cellRender?: IDataTableCellRender; /** * @description 单元格点击事件 * @default */ onCellClick?: (event: ICellClickEvent) => void; /** * @description 单元格编辑框 onBlur 事件 * @default */ onCellBlur?: (event: ICellBlurEvent) => void; } export interface ICell { /** * @description uuid * @default - */ uuid: string; /** * @description 文本 * @default - */ text: string; /** * @description 是否错误 * @default - */ error?: boolean; /** * @description 是否处于激活状态(注意:active 并不等同于 highlight) * @default - */ active?: boolean; /** * @description 是否高亮 * @default - */ highlight?: boolean; /** * @description 是否正在编辑 * @default - */ editing?: boolean; /** * @description className * @default - */ className?: string; /** * @description style * @default - */ style?: CSSProperties; /** * @description 额外信息 * @default - */ info?: Record; } export interface ICellIndex { /** * @description 行索引 * @default - */ rowIndex: number; /** * @description 列索引 * @default - */ colIndex: number; } export interface ICellClickEvent { /** * @description 当前单元格 * @default - */ cell: ICell; /** * @description 当前单元格索引 * @default - */ cellIndex: ICellIndex; } export interface ICellPressEnterEvent { /** * @description 当前单元格 * @default - */ cell: ICell; /** * @description 单元格索引 * @default - */ cellIndex: ICellIndex; /** * @description 当前值 * @default - */ value: string; } export interface ICellBlurEvent { /** * @description 所点击单元格 * @default - */ cell: ICell; /** * @description 所点击单元格索引 * @default - */ cellIndex: ICellIndex; /** * @description 当前值 * @default - */ value: string; } export interface IDataTableCellSpan { /** * @description 行占位 * * `0` 表示该单元格不显示 * * `1` 表示该单元格正常占位一行 * * `>1` 表示该单元格占多行 * @default 1 */ rowspan: number; /** * @description 列占位 * * `0` 表示该单元格不显示 * * `1` 表示该单元格正常占位一列 * * `>1` 表示该单元格占多列 * @default 1 */ colspan: number; } export declare type IDataTableCellSpans = IDataTableCellSpan[][];