antd
Version:
An enterprise-class UI design language and React components implementation
24 lines (23 loc) • 1.19 kB
TypeScript
import type { ColumnsType, ColumnTitleProps, ColumnType, Key, SorterResult, SorterTooltipProps, SortOrder, TableLocale, TransformColumns } from '../interface';
export interface SortState<RecordType> {
column: ColumnType<RecordType>;
key: Key;
sortOrder: SortOrder | null;
multiplePriority: number | false;
}
export declare function getSortData<RecordType>(data: readonly RecordType[], sortStates: SortState<RecordType>[], childrenColumnName: string): RecordType[];
interface SorterConfig<RecordType> {
prefixCls: string;
mergedColumns: ColumnsType<RecordType>;
onSorterChange: (sorterResult: SorterResult<RecordType> | SorterResult<RecordType>[], sortStates: SortState<RecordType>[]) => void;
sortDirections: SortOrder[];
tableLocale?: TableLocale;
showSorterTooltip?: boolean | SorterTooltipProps;
}
export default function useFilterSorter<RecordType>({ prefixCls, mergedColumns, onSorterChange, sortDirections, tableLocale, showSorterTooltip, }: SorterConfig<RecordType>): [
TransformColumns<RecordType>,
SortState<RecordType>[],
ColumnTitleProps<RecordType>,
() => SorterResult<RecordType> | SorterResult<RecordType>[]
];
export {};