UNPKG

@table-library/react-table-library

Version:
42 lines (41 loc) 1.77 kB
import { ExtendedNode, Identifier, TableNode } from './table'; export declare type Nullish = null | undefined; export declare type Action = { type: string; payload?: any; }; export declare type State = Record<string, any>; export declare type IdState = { id?: Identifier | Nullish; ids: Identifier[]; all?: boolean; none?: boolean; } & State; export declare type MiddlewareFunction = (action: Action, state: State, context: any) => void; export declare type StateAndChange = { state?: State; onChange?: MiddlewareFunction; }; export declare type Modifier<T extends TableNode> = (nodes: T[]) => ExtendedNode<T>[]; declare type IdReducerFunctionsOptions = { isCarryForward?: boolean; isPartialToAll?: boolean; } & Record<string, any>; export declare type IdReducerFunctions<T extends TableNode> = { onAddById: (id: Identifier) => void; onRemoveById: (id: Identifier) => void; onToggleById: (id: Identifier) => void; onAddByIds: (ids: Identifier[], options: IdReducerFunctionsOptions) => void; onRemoveByIds: (ids: Identifier[]) => void; onToggleByIdRecursively: (id: Identifier, options: IdReducerFunctionsOptions) => void; onAddByIdRecursively: (id: Identifier, options: IdReducerFunctionsOptions) => void; onRemoveByIdRecursively: (id: Identifier) => void; onAddByIdExclusively: (id: Identifier) => void; onRemoveByIdExclusively: () => void; onToggleByIdExclusively: (id: Identifier) => void; onToggleByIdShift: (id: Identifier, options: IdReducerFunctionsOptions, modifier: Modifier<T>) => void; onAddAll: (ids: Identifier[]) => void; onRemoveAll: () => void; onToggleAll: (options: IdReducerFunctionsOptions) => void; }; export {};