import { LoadingProps } from '../loading'; import type { TNode, ClassName, HTMLElementAttributes } from '../common'; export interface TdBaseTableProps { bordered?: boolean; cellEmptyContent?: string | TNode>; columns?: Array>; data?: Array; empty?: string | TNode; fixedRows?: Array; footerSummary?: string | TNode; height?: string | number; loading?: boolean | TNode; loadingProps?: Partial; maxHeight?: string | number; rowAttributes?: TableRowAttributes; rowClassName?: ClassName | ((params: RowClassNameParams) => ClassName); rowKey: string; rowspanAndColspan?: TableRowspanAndColspanFunc; showHeader?: boolean; stripe?: boolean; tableContentWidth?: string; tableLayout?: 'auto' | 'fixed'; verticalAlign?: 'top' | 'middle' | 'bottom'; onCellClick?: (context: BaseTableCellEventContext) => void; onRowClick?: (context: RowEventContext) => void; onScroll?: (params: { e: Event; }) => void; onScrollToBottom?: () => void; } export interface BaseTableInstanceFunctions { refreshTable: () => void; } export interface BaseTableCol { align?: 'left' | 'right' | 'center'; cell?: string | TNode>; className?: TableColumnClassName | TableColumnClassName[]; colKey?: string; ellipsis?: boolean | TNode>; ellipsisTitle?: boolean | TNode>; fixed?: 'left' | 'right'; minWidth?: string | number; render?: TNode>; title?: string | TNode<{ col: BaseTableCol; colIndex: number; }>; width?: string | number; } export type TableRowAttributes = HTMLElementAttributes | ((params: { row: T; rowIndex: number; type: 'body' | 'foot'; }) => HTMLElementAttributes) | Array>; export interface RowClassNameParams { row: T; rowIndex: number; rowKey?: string; type?: 'body' | 'foot'; } export type TableRowspanAndColspanFunc = (params: BaseTableCellParams) => RowspanColspan; export interface RowspanColspan { colspan?: number; rowspan?: number; } export interface BaseTableCellEventContext { row: T; col: BaseTableCol; rowIndex: number; colIndex: number; e: MouseEvent; } export interface RowEventContext { row: T; index: number; e: MouseEvent; } export interface TableRowData { [key: string]: any; children?: TableRowData[]; } export interface BaseTableCellParams { row: T; rowIndex: number; col: BaseTableCol; colIndex: number; } export type TableColumnClassName = ClassName | ((context: CellData) => ClassName); export interface CellData extends BaseTableCellParams { type: 'th' | 'td'; } export interface BaseTableColParams { col: BaseTableCol; colIndex: number; } export interface BaseTableRenderParams extends BaseTableCellParams { type: RenderType; } export type RenderType = 'cell' | 'title'; export type DataType = TableRowData;