import React, { Key, MutableRefObject, ReactNode } from "react"; import { CheckboxPropsType } from "../Checkbox/interface"; import { PaginationPropsType } from "../Pagination/interface"; import { SearchBaseType } from "../Search/interface"; import { DesignTypes } from "../typings"; export declare type CallbackProps = Partial, 'onClick' | 'onMouseEnter' | 'onMouseLeave'>>; export declare type ColumnType = { index?: boolean; checked?: ((column: ColumnType, record: T, index: Record<'columnIndex' | 'dataIndex', number>) => { checkedProps: CheckboxPropsType; } | ReactNode) | boolean; /** * √ * 列标题 */ title?: ReactNode; /** * √ * React的 key值,如果不指定,默认取 dataKey 的值 */ key?: Key; /** * √ * 列数据在数据项中对应的 key,用于取值显示 */ dataKey: TKey; /** * √ * 列宽度 */ width?: string | number; /** * 排序函数,如果想要服务端排序或者添加更多自定义操作, */ sorter?: ((a: any, b: any) => any) | boolean; /** * √ * 自定义头部标题单元格显示的内容 */ headerCellRender?: (column: ColumnType, index: number) => ReactNode; /** * √ * 设置头部单元格的各项事件回调 */ onTheadTdCell?: (column: ColumnType, index: number) => CallbackProps; footerCellRender?: (column: ColumnType, colData: TValue[], index: number) => ReactNode; onTfootTdCell?: (column: ColumnType, colData: TValue[], index: number) => CallbackProps; /** * √ * 自定义单元格显示的内容 */ bodyCellRender?: (column: ColumnType, record: T, index: Record<'columnIndex' | 'dataIndex', number>) => ReactNode; /** * √ * 设置单元格的各项事件回调 */ onTbodyTdCell?: (column: ColumnType, record: T, index: number) => CallbackProps; /** * √ * 当单元格内容为空时,显示占位符,优先级低于 render。 */ placeholder?: ReactNode; /** * √ * 设置列的对齐方式 left */ align?: DesignTypes['Align']; }; export interface TableBaseType { /** * 表格尾部 */ footer?: (currentPageDate: any) => ReactNode; /** * √ */ columns: ColumnType[]; /** * √ * 表格数据 */ data: T[] | ((pagination: { current: number; pageSize: number; }, search: any) => Promise<{ list: T[]; total: number; } | undefined>); /** * √ * 表格行 key 的取值字段 */ rowKey?: TKey | ((record: T) => TKey); /** * √ * 设置表格行的各项事件回调 */ onRow?: (record: T, index: number) => CallbackProps; /** * 表格是否在加载中 */ loading?: boolean; /** * √ * 当单元格内容为空时,显示占位符,优先级低于 column.placeholder。 */ placeholder?: ReactNode; /** * 是否开启斑马纹 */ stripe?: boolean; /** * √ * 边框 */ borders?: Partial> | null; /** * √ * 边框宽度 */ borderWidth?: number; /** * 分页 */ pagination?: boolean | PaginationPropsType; search?: SearchBaseType; oprationContent?: ReactNode; selectListChange?: (list: any[]) => void; actionRef?: MutableRefObject; } export declare type TablePropsType = TableBaseType & JSX.IntrinsicElements['table']; export declare type ActionType = { refresh: () => void; };