/// import { TableProps, PrimaryKey } from '../base'; import { ArtColumn, TableTransform, Transform } from '../interfaces'; declare type RowPropsGetter = TableProps['getRowProps']; export interface TablePipelineIndentsConfig { iconIndent: number; iconWidth: 16; iconGap: number; indentSize: number; } export interface TablePipelineCtx { primaryKey?: PrimaryKey; components: { [name: string]: any; }; indents: TablePipelineIndentsConfig; [key: string]: any; } /** * 表格数据处理流水线。TablePipeline 提供了表格数据处理过程中的一些上下方与工具方法,包括…… * * 1. ctx:上下文环境对象,step(流水线上的一步)可以对 ctx 中的字段进行读写。 * ctx 中部分字段名称有特定的含义(例如 primaryKey 表示行的主键),使用自定义的上下文信息时注意避开这些名称。 * * 2. rowPropsGetters:getRowProps 回调队列,step 可以通过 pipeline.appendRowPropsGetter 向队列中追加回调函数, * 在调用 pipeline.props() 队列中的所有函数会组合形成最终的 getRowProps * * 3. 当前流水线的状态,包括 dataSource, columns, rowPropsGetters 三个部分 * * 4. snapshots,调用 pipeline.snapshot(name) 可以记录当前的状态,后续可以通过 name 来读取保存的状态 * */ export declare class TablePipeline { ref?: React.MutableRefObject; private readonly _snapshots; private readonly _rowPropsGetters; private _tableProps; private _dataSource; private _isSameInputDataSource; private _columns; private _footerDataSource?; static defaultIndents: TablePipelineIndentsConfig; readonly ctx: TablePipelineCtx; private readonly state; private readonly setState; constructor({ state, setState, ctx, ref }: { state: any; setState: TablePipeline['setState']; ctx: Partial; ref?: React.MutableRefObject; }); guid(): string; appendRowPropsGetter(getter: RowPropsGetter): this; addTableProps(props: React.HTMLAttributes): void; getDataSource(name?: string): any[]; isSameInputDataSource(): boolean; getColumns(name?: string): any[]; getFooterDataSource(): any[]; getStateAtKey(stateKey: string, defaultValue?: T): T; /** 将 stateKey 对应的状态设置为 partialState */ setStateAtKey(stateKey: string, partialState: any, extraInfo?: any): void; /** 确保 primaryKey 已被设置,并返回 primaryKey */ ensurePrimaryKey(hint?: string): PrimaryKey; /** 设置流水线的输入数据 */ input(input: { dataSource: any[]; columns: ArtColumn[]; }): this; /** 设置 dataSource */ dataSource(rows: any[]): this; /** 设置 columns */ columns(cols: ArtColumn[]): this; /** 设置主键 */ primaryKey(key: PrimaryKey): this; /** 设置页脚数据 */ footerDataSource(rows: any[]): this; /** 保存快照 */ snapshot(name: string): this; /** @deprecated * 应用一个 kd-table Table transform */ useTransform(transform: TableTransform): this; /** 使用 pipeline 功能拓展 */ use(step: (pipeline: this) => this): this; /** 转换 dataSource */ mapDataSource(mapper: Transform): this; /** 转换 columns */ mapColumns(mapper: Transform): this; /** 获取featureOptions 内容 */ getFeatureOptions(optionKey: string): any; /** 设置pipelineOptions 内容 */ setFeatureOptions(optionKey: string, value: any): void; /** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */ getProps(this: TablePipeline): TableProps; getFeatureApi(featureName: string): any; addFeatureApi(featureName: string): any; getLastPipeline(): any; } export declare function useTablePipeline(ctx?: Partial): TablePipeline; export {};