import { GetRowKey, ColumnType as RcColumnType, ExpandableConfig } from 'rc-table/lib/interface'; import { CheckboxProps } from '../checkbox'; import { PaginationConfig } from '../pagination'; export { GetRowKey, ExpandableConfig }; export type Key = React.Key; export type RowSelectionType = 'checkbox' | 'radio'; export type SelectionItemSelectFn = (currentRowKeys: Key[]) => void; export type ExpandType = null | 'row' | 'nest'; export interface TableLocale { filterTitle?: string; filterConfirm?: React.ReactNode; filterReset?: React.ReactNode; emptyText?: React.ReactNode | (() => React.ReactNode); selectAll?: React.ReactNode; selectInvert?: React.ReactNode; selectionAll?: React.ReactNode; sortTitle?: string; expand?: string; collapse?: string; } export type SortOrder = 'descend' | 'ascend' | null; export type CompareFn = (a: T, b: T, sortOrder?: SortOrder) => number; export interface ColumnFilterItem { text: React.ReactNode; value: string; children?: ColumnFilterItem[]; } export interface ColumnTitleProps { /** @deprecated Please use `sorterColumns` instead. */ sortOrder?: SortOrder; /** @deprecated Please use `sorterColumns` instead. */ sortColumn?: ColumnType; sortColumns?: { column: ColumnType; order: SortOrder }[]; filters?: Record; } export type ColumnTitle = | React.ReactNode | ((props: ColumnTitleProps) => React.ReactNode); export interface FilterDropdownProps { prefixCls: string; setSelectedKeys: (selectedKeys: string[]) => void; selectedKeys: React.Key[]; confirm: () => void; clearFilters?: () => void; filters?: ColumnFilterItem[]; visible: boolean; } export interface ColumnType extends RcColumnType { title?: ColumnTitle; // Sorter // TODO: Doc this update sorter?: | boolean | CompareFn | { compare: CompareFn; /** Config multiple sorter order priority */ multiple: number; }; sortOrder?: SortOrder; defaultSortOrder?: SortOrder; sortDirections?: SortOrder[]; // Filter filters?: ColumnFilterItem[]; filterDropdown?: React.ReactNode | ((props: FilterDropdownProps) => React.ReactNode); filterMultiple?: boolean; filteredValue?: Key[] | null; defaultFilteredValue?: Key[] | null; filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode); onFilter?: (value: any, record: RecordType) => boolean; filterDropdownVisible?: boolean; onFilterDropdownVisibleChange?: (visible: boolean) => void; } export interface ColumnGroupType extends ColumnType { children: ColumnsType; } export type ColumnsType = ( | ColumnGroupType | ColumnType )[]; export interface SelectionItem { key: string; text: React.ReactNode; onSelect?: SelectionItemSelectFn; } export type SelectionSelectFn = ( record: T, selected: boolean, selectedRows: Object[], nativeEvent: Event, ) => void; export interface TableRowSelection { type?: RowSelectionType; selectedRowKeys?: Key[]; onChange?: (selectedRowKeys: Key[], selectedRows: T[]) => void; getCheckboxProps?: (record: T) => Partial; onSelect?: SelectionSelectFn; onSelectMultiple?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void; /** @deprecated This function is meaningless and should use `onChange` instead */ onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void; /** @deprecated This function is meaningless and should use `onChange` instead */ onSelectInvert?: (selectedRowKeys: Key[]) => void; selections?: SelectionItem[] | boolean; hideDefaultSelections?: boolean; fixed?: boolean; columnWidth?: string | number; columnTitle?: string | React.ReactNode; } export type TransformColumns = ( columns: ColumnsType, ) => ColumnsType; export interface TableCurrentDataSource { currentDataSource: RecordType[]; } export interface SorterResult { column?: ColumnType; order?: SortOrder; field?: Key | Key[]; columnKey?: Key; } export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement; export interface TablePaginationConfig extends PaginationConfig { position?: 'top' | 'bottom' | 'both'; }