UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

35 lines (34 loc) 1.28 kB
export type UseHandleSortStateOptions = { /** * Defines if the current column should be active or not. * Defaults to `false`. */ active?: boolean; /** * Define the sorting direction. Can be `asc`, `desc` or `off`. * Defaults to `off`. */ direction?: UseHandleSortStateDirection; /** * Define the possible modes. * Defaults to `["asc", "desc", "off"]`. */ modes?: Array<UseHandleSortStateMode>; }; export type UseHandleSortStateDirection = 'asc' | 'desc' | 'off'; export type UseHandleSortStateMode = 'asc' | 'desc' | 'off'; export type UseHandleSortStateName = string; export type UseHandleSortStateConfig = Record<UseHandleSortStateName, UseHandleSortStateOptions>; export type TableSortState = Record<UseHandleSortStateName, { active: boolean; reversed: boolean; direction: UseHandleSortStateDirection | 'off'; }>; export type TableSortEventHandler = () => void; export type TableSortHandler = Record<UseHandleSortStateName, TableSortEventHandler>; export declare function useHandleSortState(config: UseHandleSortStateConfig, defaults?: UseHandleSortStateOptions): { sortState: TableSortState; sortHandler: TableSortHandler; activeSortName: any; }; export default useHandleSortState;