import React from "react"; import { TableAddon, RowRenderContext } from "../TableProps"; /** * `expandable` 插件用于支持表格行展开。 */ export interface ExpandableAddonOptions { /** * 展开的行如何渲染 */ render?(record: Record): React.ReactNode; /** * 将当前记录展开成更多的记录 */ expand?(record: Record): Record[]; /** * 展开行的键值 */ expandedKeys?: string[]; /** * 用户进行展开/收起操作的时候,知会最新的键值 */ onExpandedKeysChange?: (value: string[], context: { event: React.SyntheticEvent; operateType: "expand" | "collapse"; operateKey: string; operateRecord: Record; }) => void; /** * 判断记录是否允许展开,如果不提供该判断,则认为所有记录均可展开 */ shouldRecordExpandable?: (record: Record) => boolean; /** * 展开行内容渲染之前,插入多少个间隙单元格 */ gapCell?: number; /** * 是否整行点击可展开 * @default false * @since 2.2.0 */ rowExpand?: boolean; /** * 可以在插入的间隙单元格中,渲染指定的内容(需要配置 gapCell > 0) */ gapCellRender?: (record: Record) => React.ReactNode; /** * 提供一个列的 `key`,将展开组件插入到一个目标列 * * 默认在最前新建一列插入 */ targetColumnKey?: string; /** * 列宽度,可以指定 CSS 属性或数字 (单位:px) * @default 26 */ width?: string | number; /** * **高级用法** * 更改该插件的在每行的渲染内容,`element` 为默认渲染内容,`context` 中包含该行数据相关信息 * @default x => x */ iconRender?: (element: JSX.Element, context: RowRenderContext) => React.ReactNode; } export declare function expandable(options: ExpandableAddonOptions): TableAddon;