ali-react-table
Version:
10 lines (9 loc) • 770 B
TypeScript
import { CellProps } from '../interfaces';
/** 合并两个 cellProps(单元格属性)对象,返回一个合并后的全新对象。
*
* mergeCellProps 会按照以下规则来合并两个对象:
* * 对于 数字、字符串、布尔值类型的字段,extra 中的字段值将直接覆盖 base 中的字段值(className 是个特例,会进行字符串拼接)
* * 对于函数/方法类型的字段(对应单元格的事件回调函数),mergeCellProps 将生成一个新的函数,新函数将按序调用 base 和 extra 中的方法
* * 对于普通对象类型的字段(对应单元格的样式),mergeCellProps 将合并两个对象
* */
export default function mergeCellProps(base: CellProps, extra: CellProps): CellProps;