import type * as React from 'react'; import type { Reference } from 'rc-table'; import type { FixedType, GetComponentProps, ColumnType as RcColumnType, RenderedCell as RcRenderedCell } from 'rc-table/lib/interface'; import { ExpandableConfig, GetRowKey } from 'rc-table/lib/interface'; import type { Breakpoint } from '../_util/responsiveObserver'; import type { AnyObject } from '../_util/type'; import type { CheckboxProps } from '../checkbox'; import type { PaginationProps } from '../pagination'; import type { TooltipProps } from '../tooltip'; import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection'; import type { InternalTableProps, TableProps } from './InternalTable'; export type RefTable = (props: React.PropsWithChildren> & React.RefAttributes) => React.ReactElement; export type RefInternalTable = (props: React.PropsWithChildren> & React.RefAttributes) => React.ReactElement; export { ExpandableConfig, GetRowKey }; export type Key = React.Key; export type SafeKey = Exclude; 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; filterEmptyText?: React.ReactNode; filterCheckall?: React.ReactNode; filterSearchPlaceholder?: string; emptyText?: React.ReactNode | (() => React.ReactNode); selectAll?: React.ReactNode; selectNone?: React.ReactNode; selectInvert?: React.ReactNode; selectionAll?: React.ReactNode; sortTitle?: string; expand?: string; collapse?: string; triggerDesc?: string; triggerAsc?: string; cancelSort?: string; } export type SortOrder = 'descend' | 'ascend' | null; export type SorterTooltipTarget = 'full-header' | 'sorter-icon'; export type SorterTooltipProps = TooltipProps & { target?: SorterTooltipTarget; }; declare const TableActions: readonly ["paginate", "sort", "filter"]; export type TableAction = (typeof TableActions)[number]; export type CompareFn = (a: T, b: T, sortOrder?: SortOrder) => number; export interface ColumnFilterItem { text: React.ReactNode; value: React.Key | boolean; 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 type FilterValue = (Key | boolean)[]; export type FilterKey = (string | number)[] | null; export type FilterSearchType = boolean | ((input: string, record: RecordType) => boolean); export interface FilterConfirmProps { closeDropdown: boolean; } export interface FilterDropdownProps { prefixCls: string; setSelectedKeys: (selectedKeys: React.Key[]) => void; selectedKeys: React.Key[]; /** * Confirm filter value, if you want to close dropdown before commit, you can call with * {closeDropdown: true} */ confirm: (param?: FilterConfirmProps) => void; clearFilters?: () => void; filters?: ColumnFilterItem[]; /** Only close filterDropdown */ close: () => void; visible: boolean; } export interface ColumnType extends Omit, 'title'> { title?: ColumnTitle; sorter?: boolean | CompareFn | { compare?: CompareFn; /** Config multiple sorter order priority */ multiple?: number; }; sortOrder?: SortOrder; defaultSortOrder?: SortOrder; sortDirections?: SortOrder[]; sortIcon?: (props: { sortOrder: SortOrder; }) => React.ReactNode; showSorterTooltip?: boolean | SorterTooltipProps; filtered?: boolean; filters?: ColumnFilterItem[]; filterDropdown?: React.ReactNode | ((props: FilterDropdownProps) => React.ReactNode); filterOnClose?: boolean; filterMultiple?: boolean; filteredValue?: FilterValue | null; defaultFilteredValue?: FilterValue | null; filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode); filterMode?: 'menu' | 'tree'; filterSearch?: FilterSearchType; onFilter?: (value: React.Key | boolean, record: RecordType) => boolean; filterDropdownOpen?: boolean; onFilterDropdownOpenChange?: (visible: boolean) => void; filterResetToDefaultFilteredValue?: boolean; responsive?: Breakpoint[]; /** @deprecated Please use `filterDropdownOpen` instead */ filterDropdownVisible?: boolean; /** @deprecated Please use `onFilterDropdownOpenChange` instead */ onFilterDropdownVisibleChange?: (visible: boolean) => void; } export interface ColumnGroupType extends Omit, 'dataIndex'> { 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: T[], nativeEvent: Event) => void; export type RowSelectMethod = 'all' | 'none' | 'invert' | 'single' | 'multiple'; export interface TableRowSelection { /** Keep the selection keys in list even the key not exist in `dataSource` anymore */ preserveSelectedRowKeys?: boolean; type?: RowSelectionType; selectedRowKeys?: Key[]; defaultSelectedRowKeys?: Key[]; onChange?: (selectedRowKeys: Key[], selectedRows: T[], info: { type: RowSelectMethod; }) => void; getCheckboxProps?: (record: T) => Partial>; onSelect?: SelectionSelectFn; /** @deprecated This function is deprecated and should use `onChange` instead */ onSelectMultiple?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void; /** @deprecated This function is deprecated and should use `onChange` instead */ onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void; /** @deprecated This function is deprecated and should use `onChange` instead */ onSelectInvert?: (selectedRowKeys: Key[]) => void; /** @deprecated This function is deprecated and should use `onChange` instead */ onSelectNone?: () => void; selections?: INTERNAL_SELECTION_ITEM[] | boolean; hideSelectAll?: boolean; fixed?: FixedType; columnWidth?: string | number; columnTitle?: React.ReactNode | ((checkboxNode: React.ReactNode) => React.ReactNode); checkStrictly?: boolean; renderCell?: (value: boolean, record: T, index: number, originNode: React.ReactNode) => React.ReactNode | RcRenderedCell; onCell?: GetComponentProps; } export type TransformColumns = (columns: ColumnsType) => ColumnsType; export interface TableCurrentDataSource { currentDataSource: RecordType[]; action: TableAction; } export interface SorterResult { column?: ColumnType; order?: SortOrder; field?: Key | readonly Key[]; columnKey?: Key; } export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement; type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'none'; export interface TablePaginationConfig extends PaginationProps { position?: TablePaginationPosition[]; }