@table-library/react-table-library
Version:
react-table-library
58 lines (57 loc) • 1.85 kB
TypeScript
import * as React from 'react';
import { Nullish, State, Modifier } from '@table-library/react-table-library/types/common';
import { TableNode } from '@table-library/react-table-library/types/table';
export declare enum SortIconPositions {
Prefix = 0,
Suffix = 1
}
export declare enum SortToggleType {
Alternate = 0,
AlternateWithReset = 1
}
export declare type SortOptionsIcon = {
position?: SortIconPositions;
margin?: string;
size?: string;
iconDefault?: React.ReactElement | Nullish;
iconUp?: React.ReactElement | Nullish;
iconDown?: React.ReactElement | Nullish;
};
export declare type SortFn = (node: TableNode[]) => TableNode[];
export declare type SortOptions = {
sortFns: Record<string, SortFn>;
isServer?: boolean;
sortToggleType?: SortToggleType;
sortIcon?: SortOptionsIcon;
isRecursive?: boolean;
};
export declare type SortOptionsIconSound = Required<SortOptionsIcon>;
declare type SortOptionsSound = {
[K in keyof Required<SortOptions>]: K extends 'sortIcon' ? SortOptionsIconSound : Required<SortOptions>[K];
};
export declare type SortFunctionInput = {
sortKey: string;
};
export declare type SortFunctions = {
onToggleSort: (sortFunctionInput: SortFunctionInput) => void;
};
export declare type ColumnSortProps = {
sortKey: string;
sortIcon?: SortOptionsIcon;
};
export declare type HeaderCellSortProps = {
index?: number;
sortKey: string;
sortIcon?: SortOptionsIcon;
children?: React.ReactNode;
} & Record<string, any>;
export declare type Sort<T extends TableNode> = {
state: State;
fns: SortFunctions;
options: SortOptionsSound;
modifier: Modifier<T>;
components: {
HeaderCellSort: React.FunctionComponent<HeaderCellSortProps>;
};
};
export {};