@infinite-table/infinite-react
Version:
Infinite Table for React
1,218 lines (1,185 loc) • 350 kB
TypeScript
import * as React$1 from 'react';
import React__default, { CSSProperties, HTMLProps, RefCallback, MutableRefObject, MouseEvent, KeyboardEvent, HTMLAttributes, ReactNode, EffectCallback, DependencyList } from 'react';
type ManagedComponentStateContextValue<T_STATE, T_ACTIONS> = {
getComponentState: () => T_STATE;
componentState: T_STATE;
componentActions: T_ACTIONS;
assignState: (state: Partial<T_STATE>) => void;
replaceState: (state: T_STATE) => void;
};
type ComponentStateGeneratedActions<T_STATE> = {
[k in keyof T_STATE]: T_STATE[k] | React.SetStateAction<T_STATE[k]>;
};
type ComponentInterceptedActions<T_STATE> = {
[k in keyof T_STATE]?: (value: T_STATE[k], { actions, state, }: {
actions: ComponentStateGeneratedActions<T_STATE>;
state: T_STATE;
}) => void | boolean;
};
type ComponentMappedCallbacks<T_STATE> = {
[k in keyof T_STATE]: (value: T_STATE[k], state: T_STATE) => {
callbackName: string;
callbackParams: any[];
};
};
type ComponentStateActions<T_STATE> = ComponentStateGeneratedActions<T_STATE>;
type NonUndefined<T> = T extends undefined ? never : T;
type ToPath<T> = (data: T) => string[];
type ToTreeDataArrayOptions<T, RESULT_T> = {
nodesKey: keyof RESULT_T;
pathKey: keyof T | string | ToPath<T>;
emptyGroup?: object | ((path: string[], children: T[]) => object);
};
declare function toTreeDataArray<T = any, RESULT_T = any>(data: T[], options: ToTreeDataArrayOptions<T, RESULT_T>): RESULT_T[];
type VoidFn$1 = () => void;
type Pair<KeyType, ValueType> = {
value?: ValueType;
map?: Map<KeyType, Pair<KeyType, ValueType>>;
length: number;
revision?: number;
};
type PairWithKeys<KeyType, ValueType> = Pair<KeyType, ValueType> & {
keys: KeyType[];
};
type StartingWithMethodOptions = {
excludeSelf?: boolean;
depthLimit?: number;
};
type StartingWithMethodOptionsWithOrder = {
excludeSelf?: boolean;
depthLimit?: number;
respectOrder?: boolean;
};
type DeepMapVisitFn<KeyType, ValueType, ReturnType = void> = (pair: Pair<KeyType, ValueType>, keys: KeyType[], next: VoidFn$1) => ReturnType;
declare class DeepMap<KeyType, ValueType> {
private map;
private length;
private revision;
private emptyKey;
static clone<KeyType, ValueType>(map: DeepMap<KeyType, ValueType>): DeepMap<KeyType, ValueType>;
constructor(initial?: [KeyType[], ValueType][]);
fill(initial?: [KeyType[], ValueType][]): void;
getValuesStartingWith(keys: KeyType[], options?: StartingWithMethodOptions): ValueType[];
getEntriesStartingWith(keys: KeyType[], options?: StartingWithMethodOptions): [KeyType[], ValueType][];
getLeafNodesStartingWith<T>(keys: KeyType[], withPair: (pair: PairWithKeys<KeyType, ValueType>) => T, options?: StartingWithMethodOptionsWithOrder): T[];
getKeysForLeafNodesStartingWith(keys: KeyType[], options?: StartingWithMethodOptionsWithOrder): KeyType[][];
getKeysAndValuesForLeafNodesStartingWith(keys: KeyType[], options?: StartingWithMethodOptionsWithOrder): [KeyType[], ValueType][];
/**
* @param keys - the keys of the node to start from
* @param excludeSelf - whether to exclude the start node
* @param depthLimit - the depth limit
* @returns the keys of the first child on each branch (starting from the node with the given keys)
*/
getKeysOfFirstChildOnEachBranchStartingWith(keys: KeyType[], options?: StartingWithMethodOptionsWithOrder): KeyType[][];
getKeysStartingWith(keys: KeyType[], options?: StartingWithMethodOptions): KeyType[][];
private getStartingWith;
private getMapAt;
getAllChildrenSizeFor(keys: KeyType[]): number;
getDirectChildrenSizeFor(keys: KeyType[]): number;
set(keys: KeyType[] & {
length: Omit<number, 0>;
}, value: ValueType): this;
get(keys: KeyType[]): ValueType | undefined;
get size(): number;
clear(): void;
delete(keys: KeyType[]): boolean;
has(keys: KeyType[]): boolean;
private visitKey;
visit: (fn: DeepMapVisitFn<KeyType, ValueType>) => void;
visitSome: (fn: (value: ValueType, keys: KeyType[], indexInGroup: number, next?: VoidFn$1) => boolean) => void;
visitDepthFirst: (fn: (value: ValueType, keys: KeyType[], indexInGroup: number, next?: VoidFn$1) => void) => void;
private visitWithNext;
private getArray;
rawKeysAt(keys: KeyType[]): KeyType[];
valuesAt(keys: KeyType[]): ValueType[];
values(): Generator<ValueType, void, unknown>;
keys(): Generator<KeyType[], void, unknown>;
entries(): Generator<[KeyType[], ValueType], void, unknown>;
topDownEntries(): [KeyType[], ValueType][];
topDownKeys(): KeyType[][];
topDownValues(): ValueType[];
private sortedIterator;
}
type NodePath$1<PRIMARY_KEY_TYPE = any> = PRIMARY_KEY_TYPE[];
type TreeExpandStateObject_ByPath<PRIMARY_KEY_TYPE = any> = {
expandedPaths: NodePath$1<PRIMARY_KEY_TYPE>[];
collapsedPaths: NodePath$1<PRIMARY_KEY_TYPE>[];
defaultExpanded: boolean;
collapsedIds?: never;
expandedIds?: never;
} | {
defaultExpanded: true;
collapsedPaths: NodePath$1<PRIMARY_KEY_TYPE>[];
expandedPaths?: NodePath$1<PRIMARY_KEY_TYPE>[];
collapsedIds?: never;
expandedIds?: never;
} | {
defaultExpanded: false;
collapsedPaths?: NodePath$1<PRIMARY_KEY_TYPE>[];
expandedPaths: NodePath$1<PRIMARY_KEY_TYPE>[];
collapsedIds?: never;
expandedIds?: never;
};
type TreeExpandStateObject_ById<PRIMARY_KEY_TYPE = any> = {
defaultExpanded: boolean;
expandedIds: PRIMARY_KEY_TYPE[];
collapsedIds: PRIMARY_KEY_TYPE[];
expandedPaths?: never;
collapsedPaths?: never;
} | {
defaultExpanded: true;
collapsedIds: PRIMARY_KEY_TYPE[];
expandedIds?: PRIMARY_KEY_TYPE[];
expandedPaths?: never;
collapsedPaths?: never;
} | {
defaultExpanded: false;
collapsedIds?: PRIMARY_KEY_TYPE[];
expandedIds: PRIMARY_KEY_TYPE[];
expandedPaths?: never;
collapsedPaths?: never;
};
type TreeExpandStateObject<PRIMARY_KEY_TYPE = any> = TreeExpandStateObject_ByPath<PRIMARY_KEY_TYPE> | TreeExpandStateObject_ById<PRIMARY_KEY_TYPE>;
type TreeExpandStateMode = 'id' | 'path';
declare class TreeExpandState<PRIMARY_KEY_TYPE = any> {
collapsedPathsMap: DeepMap<PRIMARY_KEY_TYPE, true>;
expandedPathsMap: DeepMap<PRIMARY_KEY_TYPE, true>;
collapsedIdsMap: Map<PRIMARY_KEY_TYPE, true>;
expandedIdsMap: Map<PRIMARY_KEY_TYPE, true>;
private _mode;
get mode(): TreeExpandStateMode;
defaultExpanded: boolean;
constructor(clone?: TreeExpandStateObject | TreeExpandState);
reset(): void;
destroy(): void;
expandAll: () => void;
collapseAll: () => void;
expandNode(nodePathOrId: PRIMARY_KEY_TYPE | NodePath$1<PRIMARY_KEY_TYPE>): void;
collapseNode(nodePathOrId: PRIMARY_KEY_TYPE | NodePath$1<PRIMARY_KEY_TYPE>): void;
setNodeExpanded(nodePathOrId: PRIMARY_KEY_TYPE | NodePath$1<PRIMARY_KEY_TYPE>, expanded: boolean): void;
isNodeExpandedByPath(nodePath: NodePath$1<PRIMARY_KEY_TYPE>): boolean;
isNodeExpandedById(id: PRIMARY_KEY_TYPE): boolean;
isNodeExpanded(nodePathOrId: PRIMARY_KEY_TYPE | NodePath$1<PRIMARY_KEY_TYPE>): boolean;
update(stateObject: TreeExpandStateObject): void;
getState(): TreeExpandStateObject;
}
type OnNodeStateChangeParam = DataSourceCallback_BaseParam<any> & {};
type TreeDataSourceOnlyProps<T> = {
nodesKey?: string;
treeSelection?: DataSourcePropTreeSelection;
treeFilterFunction?: DataSourcePropTreeFilterFunction<T>;
defaultTreeSelection?: DataSourcePropTreeSelection;
treeExpandState?: TreeExpandStateValue;
defaultTreeExpandState?: TreeExpandStateValue;
onTreeExpandStateChange?: (treeExpandState: TreeExpandStateObject<any>, params: {
dataSourceApi: DataSourceApi<T>;
nodePath: NodePath$1 | null;
nodeState: 'collapsed' | 'expanded';
}) => void;
onTreeDataMutations?: ({ dataArray, timestamp, treeMutations, nodesKey, }: {
nodesKey: keyof T | any;
dataArray: DataSourceState<T>['originalDataArray'];
timestamp: number;
treeMutations: NonUndefined<DataSourceState<T>['originalDataArrayChangedInfo']['treeMutations']>;
}) => void;
isNodeSelected?: DataSourcePropIsNodeSelected<T>;
isNodeSelectable?: DataSourcePropIsNodeSelectable<T>;
isNodeReadOnly?: DataSourcePropIsNodeReadOnly<T>;
/**
* Called when a node is expanded. Not called when treeApi.expandAll is called.
*/
onNodeExpand?: (node: NodePath$1, param: OnNodeStateChangeParam) => void;
/**
* Called when a node is collapsed. Not called when treeApi.collapseAll is called.
*/
onNodeCollapse?: (node: NodePath$1, param: OnNodeStateChangeParam) => void;
} & ({
selectionMode?: 'multi-row';
treeSelection?: DataSourcePropTreeSelection_MultiNode;
defaultTreeSelection?: DataSourcePropTreeSelection_MultiNode;
onTreeSelectionChange?: DataSourcePropOnTreeSelectionChange_MultiNode;
} | {
selectionMode?: 'single-row';
treeSelection?: DataSourcePropTreeSelection_SingleNode;
defaultTreeSelection?: DataSourcePropTreeSelection_SingleNode;
onTreeSelectionChange?: DataSourcePropOnTreeSelectionChange_SingleNode;
} | {
selectionMode?: 'single-cell';
cellSelection?: DataSourcePropCellSelection_SingleCell;
defaultCellSelection?: DataSourcePropCellSelection_SingleCell;
onCellSelectionChange?: DataSourcePropOnCellSelectionChange_SingleCell;
} | {
selectionMode?: 'multi-cell';
cellSelection?: DataSourcePropCellSelection_MultiCell;
defaultCellSelection?: DataSourcePropCellSelection_MultiCell;
onCellSelectionChange?: DataSourcePropOnCellSelectionChange_MultiCell;
} | {
selectionMode?: false;
}) & ({
isNodeCollapsed?: DataSourcePropIsNodeExpanded<T>;
isNodeExpanded?: never;
} | {
isNodeExpanded?: DataSourcePropIsNodeExpanded<T>;
isNodeCollapsed?: never;
});
type DataSourcePropsNotAvailableInTreeDataSource = keyof Pick<DataSourceProps<any>, 'groupBy' | 'defaultGroupBy' | 'nodesKey' | 'defaultGroupRowsState' | 'groupRowsState' | 'onGroupRowsStateChange' | 'onGroupByChange' | 'collapseGroupRowsOnDataFunctionChange' | 'livePagination' | 'onLivePaginationCursorChange' | 'groupMode' | 'filterFunction' | 'onPivotByChange' | 'pivotBy' | 'defaultPivotBy' | 'selectionMode' | 'rowSelection' | 'defaultRowSelection'>;
type TreeDataSourceProps<T> = Omit<DataSourceProps<T>, DataSourcePropsNotAvailableInTreeDataSource> & TreeDataSourceOnlyProps<T>;
declare function TreeDataSource<T>(props: TreeDataSourceProps<T>): React$1.JSX.Element;
type NodePath = any[];
type TreeSelectionStateObject = {
selectedPaths: NodePath;
deselectedPaths: NodePath;
defaultSelection: boolean;
} | {
defaultSelection: true;
deselectedPaths: NodePath;
selectedPaths?: NodePath;
} | {
defaultSelection: false;
selectedPaths: NodePath;
deselectedPaths?: NodePath;
};
type TreeSelectionStateConfigObject = {
treePaths: DeepMap<any, true>;
strictCheckPaths: boolean;
};
type TreeSelectionStateConfigParam<_T = any> = {
treePaths: TreeSelectionStateConfigObject['treePaths'] | any[][];
/**
* Defaults to true. If false, when checking if a given path is selected,
* it will not check if the path is in the treePaths, but will only check
* in the selectionMap.
*
* If true, will check for the path both in the treePaths and the selectionMap.
*/
strictCheckPaths?: boolean;
};
type GetTreeSelectionStateConfig<T> = TreeSelectionStateConfigParam<T> | (() => TreeSelectionStateConfigParam<T>);
type NodeSelectionState = {
selected: boolean | null;
selectedCount: number;
deselectedCount: number;
leafCount: number;
};
declare class TreeSelectionState<T = any> {
selectedPaths: NodePath[] | null;
deselectedPaths: NodePath[] | null;
defaultSelection: boolean;
selectionMap: DeepMap<NodePath, boolean>;
cache: DeepMap<NodePath, NodeSelectionState>;
getConfig: GetTreeSelectionStateConfig<T>;
config: TreeSelectionStateConfigObject;
getTreePaths(treePaths?: TreeSelectionStateConfigParam['treePaths']): DeepMap<any, true>;
withTreePaths<T>(fn: (treePaths: TreeSelectionStateConfigObject['treePaths']) => T, treePaths?: TreeSelectionStateConfigParam['treePaths']): T;
getLeafNodePaths(rootNodePath?: NodePath, treePaths?: TreeSelectionStateConfigParam['treePaths']): any[][];
forEachLeafNodePath(fn: (nodePath: NodePath, { selected }: {
selected: boolean;
}) => void, rootNodePath?: NodePath, treePaths?: TreeSelectionStateConfigParam['treePaths']): void;
getSelectedLeafNodePaths(rootNodePath?: NodePath, treePaths?: TreeSelectionStateConfigParam['treePaths']): NodePath[];
getDeselectedLeafNodePaths(rootNodePath?: NodePath, treePaths?: TreeSelectionStateConfigParam['treePaths']): NodePath[];
isLeafNode(nodePath: NodePath): boolean | null;
getLeafNodesCount(nodePath: NodePath): number;
static from<T>(treeSelectionState: TreeSelectionStateObject, getConfig: GetTreeSelectionStateConfig<T>): TreeSelectionState<T>;
constructor(state: TreeSelectionStateObject | TreeSelectionState, getConfig?: GetTreeSelectionStateConfig<T>);
setConfig(getConfig: GetTreeSelectionStateConfig<T>): void;
private xcache;
private update;
private setSelectionForPath;
getState(): TreeSelectionStateObject;
deselectAll(): void;
selectAll(): void;
private strictMode;
enableStrictMode(): void;
disableStrictMode(): void;
isPathAvailable(nodePath: NodePath): boolean;
isNodeSelected(nodePath: NodePath): boolean | null;
private isSelfSelected;
private cacheIt;
private getSelectionStateForNode;
private isPathSelected;
private getNodeBooleanSelectionStateFromParent;
setNodeSelection(nodePath: NodePath, selected: boolean): void;
selectNode(nodePath: NodePath): void;
deselectNode(nodePath: any[]): void;
toggleNodeSelection(nodePath: NodePath): void;
getSelectedCount(): number;
getDeselectedCount(): number;
getSelectionCountFor(nodePath?: NodePath): {
selectedCount: number;
deselectedCount: number;
};
destroy(): void;
}
type TreeGridOnlyProps<_T> = {};
type InfiniteTablePropsNotAvailableInTreeGrid = keyof Pick<InfiniteTableProps<any>, 'pivotColumns' | 'pivotColumnGroups' | 'pivotTotalColumnPosition' | 'pivotGrandTotalColumnPosition' | 'groupColumn' | 'groupRenderStrategy' | 'hideEmptyGroupColumns' | 'showSeparatePivotColumnForSingleAggregation' | 'isRowDetailExpanded' | 'isRowDetailEnabled' | 'rowDetailCache' | 'rowDetailState' | 'defaultRowDetailState' | 'onRowDetailStateChange' | 'rowDetailHeight' | 'rowDetailRenderer' | 'groupRenderStrategy'>;
type TreeGridProps<T> = Omit<InfiniteTableProps<T>, InfiniteTablePropsNotAvailableInTreeGrid> & TreeGridOnlyProps<T>;
declare function TreeGrid<T>(props: TreeGridProps<T>): React$1.JSX.Element;
declare const withSelectedLeafNodesOnly: (callback: (treeSelectionObject: TreeSelectionStateObject) => void) => DataSourcePropOnTreeSelectionChange_MultiNode;
type DebugLogger = {
(...args: any[]): void;
extend: (channelName: string) => DebugLogger;
color: (colorName: string, ...message: string[]) => [string, string];
enabled: boolean;
channel: string;
destroy: () => void;
logFn: undefined | ((...args: any[]) => void);
};
/**
* Returns whether logging is enabled for a specific channel
*
* @param channel the name of a specific channel like "a:b:c" - cannot contain wildcards
* @param permissions we accept values like "a:b:c,d:e:f,d:x:*" - multiple values separated by a comma. can also contain wildcards
* @returns boolean
*/
declare function isChannelEnabled(channel: string, permissions: string): boolean;
declare const debug: {
(channelName: string): DebugLogger;
colors: string[];
enable: string;
diffenable: string | boolean;
logFn: DebugLogger["logFn"];
destroyAll: () => void;
isChannelEnabled: typeof isChannelEnabled;
onLogIntent: (channel: string, fn: (options: {
timestamp: number;
channel: string;
color: string;
args: any[];
}) => void) => VoidFunction;
};
interface LogFn {
(...args: any[]): void;
extend: (channelName: string) => LogFn;
}
declare class Logger {
debug: LogFn;
error: LogFn;
constructor(channelName: string);
}
interface Size {
width: number;
height: number;
}
interface ScrollPosition {
scrollTop: number;
scrollLeft: number;
}
type OnScrollFn = (scrollPosition: ScrollPosition) => void;
type RenderRange = {
renderStartIndex: number;
renderEndIndex: number;
};
type VoidFn = () => void;
type SubscriptionCallbackOnChangeFn<T> = (node: T | null) => void;
interface SubscriptionCallback<T> {
(node: T, callback?: () => void): void;
get: () => T | null;
destroy: VoidFn;
onChange: (fn: SubscriptionCallbackOnChangeFn<T>) => VoidFn;
getListenersCount: () => number;
}
type DataSourceMutation<T> = {
type: 'delete';
primaryKey: any;
nodePath?: never;
originalData: T;
metadata: any;
} | {
type: 'delete';
primaryKey?: never;
nodePath: NodePath$1;
originalData: T;
metadata: any;
} | {
type: 'update';
primaryKey: any;
nodePath?: never;
data: Partial<T>;
originalData: T;
metadata: any;
} | {
type: 'update';
primaryKey?: never;
nodePath: NodePath$1;
data: Partial<T>;
originalData: T;
metadata: any;
} | {
type: 'update-children';
primaryKey?: never;
nodePath: NodePath$1;
children: UpdateChildrenFn<T>;
originalData: T;
metadata: any;
} | {
type: 'insert';
primaryKey: any;
nodePath?: never;
position: 'before' | 'after';
originalData: null;
data: T;
metadata: any;
} | {
type: 'insert';
primaryKey?: never;
nodePath: NodePath$1;
position: 'before' | 'after';
originalData: null;
data: T;
metadata: any;
} | {
type: 'clear-all';
primaryKey: undefined;
metadata: any;
};
declare class DataSourceCache<DataType, PrimaryKeyType = string> {
private affectedFields;
private allFieldsAffected;
private nodesKey;
private primaryKeyToData;
private nodePathToData;
constructor(options: {
nodesKey: string | undefined;
});
static clone<DataType, PrimaryKeyType = string>(cache: DataSourceCache<DataType, PrimaryKeyType>, { light }?: {
light?: boolean;
}): DataSourceCache<DataType, PrimaryKeyType>;
getAffectedFields: () => true | Set<keyof DataType>;
delete: (primaryKey: PrimaryKeyType, originalData: DataType, metadata: any) => void;
deleteNodePath: (nodePath: NodePath$1, originalData: DataType, metadata: any) => void;
insert: (primaryKey: PrimaryKeyType, data: DataType, position: "before" | "after", metadata: any) => void;
insertNodePath: (nodePath: NodePath$1, data: DataType, position: "before" | "after", metadata: any) => void;
update: (primaryKey: PrimaryKeyType, data: Partial<DataType>, originalData: DataType, metadata: any) => void;
updateNodePath: (nodePath: NodePath$1, data: Partial<DataType>, originalData: DataType, metadata: any) => void;
updateChildren: (nodePath: NodePath$1, children: UpdateChildrenFn<DataType>, originalData: DataType, metadata: any) => void;
resetDataSource: (metadata: any) => void;
shouldResetDataSource: () => boolean;
clear: () => void;
isEmpty: () => boolean;
removeInfo: (primaryKey: PrimaryKeyType) => void;
removeNodePathInfo: (nodePath: NodePath$1) => void;
getMutationsForPrimaryKey: (primaryKey: PrimaryKeyType) => DataSourceMutation<DataType>[] | undefined;
getMutationsForNodePath: (nodePath: NodePath$1) => DataSourceMutation<DataType>[] | undefined;
getMutationsCount: () => number;
getMutations: () => Map<PrimaryKeyType, DataSourceMutation<DataType>[]>;
getTreeMutations: () => DeepMap<NodePath$1, DataSourceMutation<DataType>[]>;
getMutationsArray: () => DataSourceMutation<DataType>[];
getTreeMutationsArray: () => DataSourceMutation<DataType>[];
}
type ForwardPropsToStateFnResult<TYPE_PROPS, TYPE_RESULT, COMPONENT_SETUP_STATE> = {
[propName in keyof TYPE_PROPS & keyof TYPE_RESULT]: 1 | ((value: TYPE_PROPS[propName], setupState: COMPONENT_SETUP_STATE) => TYPE_RESULT[propName]);
};
type ComponentStateRootConfig<T_PROPS, COMPONENT_MAPPED_STATE, COMPONENT_SETUP_STATE = {}, COMPONENT_DERIVED_STATE = {}, T_ACTIONS = {}, T_PARENT_STATE = {}> = {
debugName?: string | ((props: T_PROPS) => string);
initSetupState?: (props: T_PROPS) => COMPONENT_SETUP_STATE;
Context?: React$1.Context<ManagedComponentStateContextValue<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE, ComponentStateGeneratedActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>>>;
layoutEffect?: boolean;
forwardProps?: (setupState: COMPONENT_SETUP_STATE, props: T_PROPS) => ForwardPropsToStateFnResult<T_PROPS, COMPONENT_MAPPED_STATE, COMPONENT_SETUP_STATE>;
allowedControlledPropOverrides?: Record<keyof T_PROPS, true>;
interceptActions?: ComponentInterceptedActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>;
mappedCallbacks?: ComponentMappedCallbacks<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>;
onPropChange?: (params: {
name: keyof T_PROPS;
oldValue: any;
newValue: any;
}, props: T_PROPS, actions: ComponentStateActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>, state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & Partial<COMPONENT_DERIVED_STATE>) => void;
onPropsChange?: (newPropValues: {
[k in keyof T_PROPS]?: {
newValue: T_PROPS[k];
oldValue: T_PROPS[k];
};
}, props: T_PROPS, actions: ComponentStateActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>, state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & Partial<COMPONENT_DERIVED_STATE>) => void;
mapPropsToState?: (params: {
props: T_PROPS;
state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & Partial<COMPONENT_DERIVED_STATE>;
oldState: null | (COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & Partial<COMPONENT_DERIVED_STATE>);
parentState: T_PARENT_STATE | null;
}) => COMPONENT_DERIVED_STATE;
concludeReducer?: (params: {
previousState: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
updatedProps: Partial<T_PROPS> | null;
parentState: T_PARENT_STATE | null;
}) => COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
getReducerActions?: (dispatch: React$1.Dispatch<any>) => T_ACTIONS;
getParentState?: () => T_PARENT_STATE;
cleanup?: (state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE) => void;
onControlledPropertyChange?: (name: string, newValue: any, oldValue: any) => void | ((value: any, oldValue: any) => any);
};
declare function buildManagedComponent<T_PROPS extends object, COMPONENT_MAPPED_STATE extends object, COMPONENT_SETUP_STATE extends object = {}, COMPONENT_DERIVED_STATE extends object = {}, T_ACTIONS = {}, T_PARENT_STATE = {}>(config: ComponentStateRootConfig<T_PROPS, COMPONENT_MAPPED_STATE, COMPONENT_SETUP_STATE, COMPONENT_DERIVED_STATE, T_ACTIONS, T_PARENT_STATE>): {
ManagedComponentContextProvider: React$1.NamedExoticComponent<T_PROPS & {
children?: React$1.ReactNode;
}>;
useManagedComponent: (props: T_PROPS) => {
contextValue: {
componentState: COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE;
componentActions: ComponentStateGeneratedActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>;
getComponentState: () => COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE;
replaceState: (newState: COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE) => void;
assignState: (newState: Partial<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>) => void;
};
ContextComponent: React$1.Context<ManagedComponentStateContextValue<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE, ComponentStateGeneratedActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>>>;
};
};
declare function useManagedComponentState<COMPONENT_STATE>(Context?: React$1.Context<ManagedComponentStateContextValue<COMPONENT_STATE, ComponentStateActions<COMPONENT_STATE>>>): ManagedComponentStateContextValue<COMPONENT_STATE, ComponentStateGeneratedActions<COMPONENT_STATE>>;
type Renderable = React$1.ReactNode | React$1.JSX.Element;
type TableRenderRange = {
start: [number, number];
end: [number, number];
rowFixed?: FixedPosition;
colFixed?: FixedPosition;
};
type FixedPosition = false | 'start' | 'end';
type WhichDirection = {
horizontal?: boolean;
vertical?: boolean;
};
type ItemSizeFunction = (index: number) => number;
interface IBrain {
getColCount: () => number;
getRowCount: () => number;
getFixedCellInfo: () => {
fixedRowsStart: number;
fixedColsStart: number;
fixedRowsEnd: number;
fixedColsEnd: number;
};
getRowspanParent: (rowIndex: number, colIndex: number) => number;
getColspanParent: (rowIndex: number, colIndex: number) => number;
getRowHeight: (rowIndex: number) => number;
getColWidth: (colIndex: number) => number;
getRowHeightWithSpan: (rowIndex: number, colIndex: number, rowspan: number) => number;
getColWidthWithSpan: (rowIndex: number, colIndex: number, colspan: number) => number;
isRowFixedStart: (rowIndex: number) => boolean;
isRowFixedEnd: (rowIndex: number) => boolean;
getScrollPosition: () => ScrollPosition;
getItemOffsetFor: (itemIndex: number, direction: 'horizontal' | 'vertical') => number;
getItemSize: (itemIndex: number, direction: 'horizontal' | 'vertical') => number;
getItemAt: (scrollPos: number, direction: 'horizontal' | 'vertical') => number;
getAvailableSize: () => Size;
getFixedStartRowsHeight: () => number;
getFixedEndRowsHeight: (options?: {
skipScroll: boolean;
}) => number;
getFixedStartColsWidth: () => number;
getFixedEndColsWidth: (options?: {
skipScroll: boolean;
}) => number;
getFixedEndColsOffsets: (options?: {
skipScroll: boolean;
}) => number[];
getFixedEndRowsOffsets: (options?: {
skipScroll: boolean;
}) => number[];
isRowFixed: (rowIndex: number) => boolean;
isColFixed: (colIndex: number) => boolean;
getRenderRange: () => TableRenderRange;
getExtraSpanCellsForRange: (options: {
horizontal: {
startIndex: number;
endIndex: number;
};
vertical: {
startIndex: number;
endIndex: number;
};
}) => [number, number][];
getRowspan: (rowIndex: number, colIndex: number) => number;
getColspan: (rowIndex: number, colIndex: number) => number;
getCellOffset: (rowIndex: number, colIndex: number) => {
x: number;
y: number;
};
name: string;
onRenderRangeChange: (fn: (renderRange: TableRenderRange) => void) => VoidFunction;
onScroll: (fn: OnScrollFn) => VoidFunction;
onAvailableSizeChange: (fn: (size: Size) => void) => VoidFunction;
onDestroy: (fn: VoidFunction) => void;
onScrollStart: (fn: VoidFunction) => VoidFunction;
onScrollStop: (fn: (scrollPos: ScrollPosition) => void) => VoidFunction;
}
type SpanFunction = ({ rowIndex, colIndex, }: {
rowIndex: number;
colIndex: number;
}) => number;
type RenderRangeType = {
startIndex: number;
endIndex: number;
};
type MatrixBrainOptions = {
width: number;
height: number;
cols: number;
rows: number;
rowHeight: number | ItemSizeFunction;
colWidth: number | ItemSizeFunction;
rowspan?: SpanFunction;
colspan?: SpanFunction;
};
type FnOnRenderRangeChange = (range: TableRenderRange) => void;
type FnOnDirectionalRenderRangeChange = (range: [number, number]) => void;
type FnOnRenderCountChange = ({ horizontal, vertical, }: {
horizontal: number;
vertical: number;
}) => void;
type OnAvailableSizeChange = (size: Size) => void;
type ShouldUpdateRenderCountOptions = {
horizontalChange: boolean;
colsChanged: boolean;
colWidthChanged: boolean;
widthChanged: boolean;
colspanChanged: boolean;
verticalChange: boolean;
rowsChanged: boolean;
rowHeightChanged: boolean;
heightChanged: boolean;
rowspanChanged: boolean;
};
declare class MatrixBrain extends Logger implements IBrain {
private scrolling;
protected RENDER_COUNT_SAFETY_MARGIN_START: number;
protected RENDER_COUNT_SAFETY_MARGIN_END: number;
protected availableWidth: MatrixBrainOptions['width'];
protected availableRenderWidth: number;
isHorizontalLayoutBrain: boolean;
name: string;
protected availableHeight: MatrixBrainOptions['height'];
protected availableRenderHeight: number;
protected cols: MatrixBrainOptions['cols'];
protected rows: MatrixBrainOptions['rows'];
protected alwaysRenderedColumns: Set<number>;
/**
* This is only here for easier accessing in the renderer, when the horizontal layout is enabled.
* In this way, the API is the same for both brains, so we don't have to cast the brain type in the renderer.
*/
set rowsPerPage(rowsPerPage: number);
get rowsPerPage(): number;
protected _rowsPerPage: number;
protected rowHeight: MatrixBrainOptions['rowHeight'];
protected colWidth: MatrixBrainOptions['colWidth'];
private rowspan;
private colspan;
private rowspanParent;
private rowspanValue;
protected rowHeightCache: number[];
protected rowOffsetCache: number[];
private verticalTotalSize;
private colspanParent;
private colspanValue;
protected colWidthCache: number[];
protected colOffsetCache: number[];
private horizontalTotalSize;
private horizontalRenderCount?;
private verticalRenderCount?;
protected maxHorizontalRenderCount: number;
protected maxVerticalRenderCount: number;
private horizontalExtendRangeBy;
private verticalExtendRangeBy;
protected horizontalRenderRange: RenderRangeType;
protected verticalRenderRange: RenderRangeType;
protected extraSpanCells: [number, number][];
private scrollPosition;
private onScrollFns;
private onRenderRangeChangeFns;
private onVerticalRenderRangeChangeFns;
private onHorizontalRenderRangeChangeFns;
private onDestroyFns;
protected destroyed: boolean;
private onRenderCountChangeFns;
private onAvailableSizeChangeFns;
private onScrollStartFns;
private onScrollStopFns;
private scrollTimeoutId;
private scrollStopDelay;
/**
* Number of columns that are fixed at the start
*/
private fixedColsStart;
/**
* Number of columns that are fixed at the end
*/
private fixedColsEnd;
/**
* Number of rows that are fixed at the start
*/
private fixedRowsStart;
/**
* Number of rows that are fixed at the end
*/
private fixedRowsEnd;
constructor(name: string);
private reset;
private resetVertical;
private resetHorizontal;
setScrollStopDelay: (scrollStopDelay: number) => void;
getVirtualColIndex(colIndex: number, _opts?: {
pageIndex: number;
}): number;
getRowCount: () => number;
getColCount: () => number;
update(options: Partial<MatrixBrainOptions>, shouldUpdateRenderCount?: (options: ShouldUpdateRenderCountOptions) => boolean): void;
/**
*
* @param options.left - if true, extends the left side with the amount of current visible columns, otherwise with the specified number
* @param options.right - if true, extends the right side with the amount of current visible columns, otherwise with the specified number
*/
extendRenderRange(options: {
start?: number | boolean;
end?: number | boolean;
direction: 'horizontal' | 'vertical';
}): () => void;
updateRenderCount(which?: WhichDirection): void;
protected doUpdateRenderCount(which?: WhichDirection): void;
get scrollTopMax(): number;
get scrollLeftMax(): number;
private setScrolling;
private notifyScrollStart;
private notifyScrollStop;
setScrollPosition(scrollPosition: ScrollPosition, callback?: (scrollPos: ScrollPosition) => void): void;
protected notifyAvailableSizeChange: () => void;
protected notifyRenderRangeChange(immediate?: boolean): void;
protected notifyVerticalRenderRangeChange: (immediate?: boolean) => void;
protected notifyHorizontalRenderRangeChange: (immediate?: boolean) => void;
private notifyScrollChange;
protected computeDirectionalRenderCount(direction: 'horizontal' | 'vertical', itemSize: number | ItemSizeFunction, count: number, theRenderSize: Size): number;
getFixedSize(direction: 'horizontal' | 'vertical'): number;
getFixedStartSize(direction: 'horizontal' | 'vertical'): number;
getFixedEndSize(direction: 'horizontal' | 'vertical'): number;
isColFixedEnd: (colIndex: number) => boolean;
isColFixedStart: (colIndex: number) => boolean;
isRowFixedEnd: (rowIndex: number) => boolean;
isRowFixedStart: (rowIndex: number) => boolean;
isColFixed: (colIndex: number) => boolean;
isRowFixed: (rowIndex: number) => boolean;
getFixedEndColsWidth: () => number;
/**
* Returns an array of offsets for all cols fixed at the end
*
* The order in the array is from leftmost col to the rightmost col
* The reference for offset is the left side of the table.
* The offsets take into account the scroll position and return the correct position.
*
* The indexes in the returned array are the absolute indexes of the cols, so the returned array is an array with holes
*
*/
getFixedEndColsOffsets: ({ skipScroll }?: {
skipScroll: boolean;
}) => number[];
/**
* Returns an array of offsets for all rows fixed at the end
*
* The order in the array is from topmost row to the bottom-most row
* The reference for offset is the top side of the table.
* The offsets take into account the scroll position and return the correct position.
*
* The indexes in the returned array are the absolute indexes of the rows, so the returned array is an array with holes
*
*/
getFixedEndRowsOffsets: ({ skipScroll }?: {
skipScroll: boolean;
}) => number[];
getFixedStartColsWidth: () => number;
getFixedEndRowsHeight: () => number;
getFixedStartRowsHeight: () => number;
computeRenderCount: (which?: WhichDirection) => {
horizontal: number;
vertical: number;
};
setRenderCount: ({ horizontal, vertical, }: {
horizontal: number | undefined;
vertical: number | undefined;
}) => void;
private notifyRenderCountChange;
updateFixedCells: (config: {
fixedColsStart?: number;
fixedColsEnd?: number;
fixedRowsStart?: number;
fixedRowsEnd?: number;
}) => void;
getFixedCellInfo: () => {
fixedRowsStart: number;
fixedColsStart: number;
fixedRowsEnd: number;
fixedColsEnd: number;
};
updateRenderRange: (which?: WhichDirection) => void;
getExtraSpanCellsForRange: ({ horizontal, vertical, }: {
horizontal: RenderRangeType;
vertical: RenderRangeType;
}) => [number, number][];
computeRenderRange: (which?: WhichDirection) => {
horizontal: RenderRangeType;
vertical: RenderRangeType;
extraCells: [number, number][];
};
computeDirectionalRenderRange: (direction: "horizontal" | "vertical") => {
startIndex: number;
endIndex: number;
};
getItemAt: (scrollPos: number, direction: "horizontal" | "vertical") => number;
getCellOffset(rowIndex: number, colIndex: number): {
x: number;
y: number;
};
getInitialRowHeight(): number | ItemSizeFunction;
getInitialCols(): number;
getInitialRows(): number;
getItemOffsetFor(itemIndex: number, direction: 'horizontal' | 'vertical'): number;
protected computeCacheFor: (itemIndex: number, direction: "horizontal" | "vertical") => void;
private getItemSizeCacheFor;
private computeItemSpanUpTo;
private getCellSpan;
getRowspan: (rowIndex: number, colIndex: number) => number;
getColspan: (rowIndex: number, colIndex: number) => number;
getRowspanParent: (rowIndex: number, colIndex: number) => number;
getColspanParent: (rowIndex: number, colIndex: number) => number;
getItemSpanParent: (rowIndex: number, colIndex: number, direction: "horizontal" | "vertical") => number;
getRowHeightWithSpan: (rowIndex: number, colIndex: number, rowspan: number) => number;
getColWidthWithSpan: (rowIndex: number, colIndex: number, colspan: number) => number;
private getItemSizeWithSpan;
getRowHeight: (rowIndex: number) => number;
getColWidth: (colIndex: number) => number;
/**
* For now, this doesn't take into account the row/colspan, and it's okay not to
* @param itemIndex
* @returns the size of the specified item
*/
getItemSize: (itemIndex: number, direction: "horizontal" | "vertical") => number;
getRowIndexInPage(rowIndex: number): number;
getPageIndexForRow(_rowIndex: number): number;
getVirtualizedContentSize(): {
height: number;
width: number;
};
getVirtualizedContentSizeFor(direction: 'horizontal' | 'vertical'): number;
keepColumnRendered: (colIndex: number) => () => void;
getAlwaysRenderedColumns: () => number[];
setRenderRange: ({ horizontal, vertical, extraCells, }: {
horizontal: RenderRangeType;
vertical: RenderRangeType;
extraCells?: [number, number][];
}) => void;
getRenderRangeCellCount: (range: TableRenderRange) => number;
getMaxCellCount: () => number;
getExtraCells: () => [number, number][];
getScrollPosition: () => ScrollPosition;
getRenderRange: () => TableRenderRange;
onScroll: (fn: OnScrollFn) => () => void;
onScrollStart: (fn: VoidFunction) => () => void;
onScrollStop: (fn: (scrollPos: ScrollPosition) => void) => () => void;
onRenderRangeChange: (fn: FnOnRenderRangeChange) => () => void;
onVerticalRenderRangeChange: (fn: FnOnDirectionalRenderRangeChange) => () => void;
onHorizontalRenderRangeChange: (fn: FnOnDirectionalRenderRangeChange) => () => void;
onRenderCountChange: (fn: FnOnRenderCountChange) => () => void;
onAvailableSizeChange: (fn: OnAvailableSizeChange) => () => void;
onDestroy: (fn: VoidFn) => () => void;
getAvailableSize: () => {
width: number;
height: number;
};
protected getAvailableRenderSize: () => {
width: number;
height: number;
};
private notifyDestroy;
destroy(): void;
}
type CellSelectionPosition<ROW_PRIMARY_KEY_TYPE = any, COL_ID = string> = [ROW_PRIMARY_KEY_TYPE, COL_ID];
type CellSelectionStateObject = {
selectedCells: CellSelectionPosition[];
deselectedCells: CellSelectionPosition[];
defaultSelection: boolean;
} | {
defaultSelection: true;
deselectedCells: CellSelectionPosition[];
selectedCells?: CellSelectionPosition[];
} | {
defaultSelection: false;
selectedCells: CellSelectionPosition[];
deselectedCells?: CellSelectionPosition[];
};
declare class CellSelectionState {
wildcard: string;
cache: DeepMap<any, boolean>;
selectedRowsToColumns: Map<any, Set<string>>;
selectedColumnsToRows: Map<string, Set<any>>;
deselectedRowsToColumns: Map<any, Set<string>>;
deselectedColumnsToRows: Map<string, Set<any>>;
defaultSelection: boolean;
debugId: string;
constructor(clone?: CellSelectionStateObject | CellSelectionState);
deselectAll: () => void;
selectAll: () => void;
selectCell(rowId: any, colId: string): void;
deselectCell(rowId: any, colId: string): void;
selectColumn(colId: string): void;
deselectColumn(colId: string): void;
setCellSelected(rowId: any, colId: string, selected: boolean): void;
private setCellInDeselection;
private setCellInSelection;
update(stateObject: CellSelectionStateObject): void;
/**
* Returns whether there is at least one selected cell in the row
*
* @param rowId the row id
* @param columnIds the columns currently available in the grid
* @returns boolean
*/
isCellSelectionInRow(rowId: any, columnIds: string[]): boolean;
private error;
isCellSelected(rowId: any, colId: string): boolean;
private isCellSelected_Internal;
getState(): CellSelectionStateObject;
}
type PointCoords = {
top: number;
left: number;
};
interface RowDetailCacheStorage<_K, T> {
add(key: any, value: T): void;
get(key: any): T | undefined;
delete(key: any): void;
has(key: any): boolean;
}
interface RowDetailCacheStorageForCurrentRow<T = RowDetailCacheEntry> {
add(value: T): void;
get(): T | undefined;
delete(): void;
has(): boolean;
}
declare class RowDetailCache<K = RowDetailCacheKey, T = RowDetailCacheEntry> implements RowDetailCacheStorage<K, T> {
private cacheStorage;
constructor(cache?: boolean | number);
add(key: K, value: T): void;
get(key: K): T | undefined;
delete(key: K): void;
has(key: K): boolean;
}
type BooleanCollectionStateKeys<KeyType> = true | KeyType[];
type BooleanCollectionStateObject<KeyType> = {
positiveItems: BooleanCollectionStateKeys<KeyType>;
negativeItems: BooleanCollectionStateKeys<KeyType>;
};
declare abstract class BooleanCollectionState<StateObject, KeyType> {
protected positiveMap?: Map<KeyType, true>;
protected negativeMap?: Map<KeyType, true>;
protected allNegative: boolean;
protected allPositive: boolean;
private initialState;
constructor(state: BooleanCollectionStateObject<KeyType> | BooleanCollectionState<StateObject, KeyType>);
abstract getPositiveFromState(state: StateObject): BooleanCollectionStateKeys<KeyType>;
abstract getNegativeFromState(state: StateObject): BooleanCollectionStateKeys<KeyType>;
abstract getState(): StateObject;
protected getInitialState(): BooleanCollectionStateObject<KeyType>;
destroy(): void;
private update;
protected isDefaultNegativeSelection(): boolean;
protected isDefaultPositiveSelection(): boolean;
protected areAllNegative(): boolean;
protected areAllPositive(): boolean;
protected makeAllNegative(): void;
protected makeAllPositive(): void;
protected isItemPositive(key: KeyType): boolean;
protected isItemNegative(key: KeyType): boolean;
protected setItemValue(key: KeyType, shouldMakePositive: boolean): void;
protected makeItemNegative(key: KeyType): void;
protected makeItemPositive(key: KeyType): void;
protected toggleItem(key: KeyType): void;
}
type DiscriminatedUnion<A, B> = (A & {
[K in keyof B]?: undefined;
}) | (B & {
[K in keyof A]?: undefined;
});
type KeyOfNoSymbol<T> = Exclude<keyof T, Symbol>;
/**
* Restrict using either exclusively the keys of T or exclusively the keys of U.
*
* No unique keys of T can be used simultaneously with any unique keys of U.
*
* @example
*```
* const myVar: XOR<T, U>
*```
*
* @see https://github.com/maninak/ts-xor/tree/master#description
*/
type XOR<T, U> = T | U extends object ? Prettify<Without<T, U> & U> | Prettify<Without<U, T> & T> : T | U;
/**
* Useful if applying XOR on more than 2 types.
* It comes with the penalty of having the types wrapped in an array
*
* @example
* ```
* AllXOR<[
* { a: AModule },
* { b: BModule },
* { c: CModule },
* { d: DModule }
* ]>
* ```
* @see https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-723571692
*/
type AllXOR<T extends any[]> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? AllXOR<[XOR<A, B>, ...Rest]> : never;
/**
* Get the keys of T without any keys of U.
*/
type Without<T, U> = {
[P in Exclude<keyof T, keyof U>]?: never;
};
/**
* Resolve mapped types and show the derived keys and their types when hovering in
* IDEs, instead of just showing the names those mapped types are defined with.
*/
type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
type ValueGetterParams<T> = {
data: T;
field?: keyof T;
};
type GroupKeyType$1<T extends any = any> = T;
type GroupByValueGetter<T> = (params: ValueGetterParams<T>) => any;
type GroupBy<DataType, KeyType = any> = {
toKey?: (value: any, data: DataType) => GroupKeyType$1<KeyType>;
column?: Partial<InfiniteTableGroupColumnBase<DataType>>;
} & AllXOR<[
{
field: KeyOfNoSymbol<DataType>;
},
{
valueGetter: GroupByValueGetter<DataType>;
field: KeyOfNoSymbol<DataType>;
},
{
valueGetter: GroupByValueGetter<DataType>;
field?: KeyOfNoSymbol<DataType>;
groupField: string;
}
]>;
type PerfMarkerDetails = {
name: string;
value: string | number | boolean;
}[];
interface PerfMarker {
start(options?: {
details?: PerfMarkerDetails;
}): PerfMarker;
end(options?: {
details?: PerfMarkerDetails;
}): PerfMarker;
}
type SortDir = 1 | -1;
type MultisortInfo<T> = {
/**
* The sorting direction
*/
dir: SortDir;
/**
* for now 'string' and 'number' are known types, meaning they have
* sort functions already implemented
*/
type?: string | string[];
fn?: (a: any, b: any) => number;
/**
* a property whose value to use for sorting on the array items
*/
field?: keyof T;
/**
* or a function to retrieve the item value to use for sorting
*/
valueGetter?: (item: T) => any;
};
type MultisortInfoAllowMultipleFields<T> = Omit<MultisortInfo<T>, 'field'> & {
field?: keyof T | (keyof T | ((item: T) => any))[];
};
declare const multisort: {
<T>(sortInfo: MultisortInfoAllowMultipleFields<T>[], array: T[], options?: {
marker?: PerfMarker;
get?: (item: any) => T;
} | ((item: any) => T)): T[];
knownTypes: {
[key: string]: (first: any, second: any) => number;
};
};
type NestedMultiSortOptions<T> = {
get?: (item: any) => T;
nodesKey: string;
isLeafNode?: (item: T) => boolean;
getNodeChildren?: (item: T) => null | T[];
toKey: (item: T) => any;
depthFirst?: boolean;
inplace?: boolean;
marker?: PerfMarker;
};
declare const multisortNested: <T>(sortInfo: MultisortInfoAllowMultipleFields<T>[], array: T[], options: NestedMultiSortOptions<T>) => T[];
type MenuIconProps = {
lineWidth?: number;
lineStyle?: React$1.CSSProperties;
style?: React$1.CSSProperties;
className?: string;
domProps?: React$1.HTMLAttributes<HTMLDivElement>;
reserveSpaceWhenHidden?: boolean;
menuVisible?: boolean;
children?: React$1.ReactNode;
};
declare function MenuIcon(props: MenuIconProps): React$1.JSX.Element;
type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
type InfiniteTableToggleTreeNodeFn = (nodePath: any[]) => void;
type InfiniteTableToggleRowDetailsFn = (id: any) => void;
type InfiniteTableSelectRowFn = (id: any) => void;
type InfiniteTableColumnHeaderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
dragging: boolean;
column: COL_TYPE;
columnsMap: Map<string, COL_TYPE>;
columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
columnFilterValue: DataSourceFilterValueItem<DATA_TYPE> | null;
selectionMode: DataSourcePropSelectionMode;
horizontalLayoutPageIndex: null | number;
allRowsSelected: boolean;
someRowsSelected: boolean;
filtered: boolean;
api: InfiniteTableApi<DATA_TYPE>;
dataSourceApi: DataSourceApi<DATA_TYPE>;
columnApi: InfiniteTableColumnApi<DATA_TYPE>;
renderBag: {
all?: Renderable;
header: string | number | Renderable;
sortIcon?: Renderable;
menuIcon?: Renderable;
menuIconProps?: MenuIconProps;
filterIcon?: Renderable;
filterEditor?: Renderable;
selectionCheckBox?: Renderable;
};
} & ({
domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
htmlElementRef: React$1.MutableRefObject<HTMLElement | null>;
renderLocation: 'column-header';
} | {
renderLocation: 'grouping-toolbar' | 'column-menu' | 'column-filter';
});
type InfiniteTableColumnRenderBag = {
value: string | number | Renderable;
groupIcon?: Renderable;
treeIcon?: Renderable;
rowDetailsIcon?: Renderable;
all?: Renderable;
selectionCheckBox?: Renderable;
};
type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
htmlElementRef: React$1.MutableRefObject<HTMLElement | null>;
rowIndexInHorizontalLayoutPage: null | number;
horizontalLayoutPageIndex: null | number;
value: string | number | Renderable;
align: InfiniteTableColumnAlignValues;
verticalAlign: InfiniteTableColumnVerticalAlignValues;
renderBag: InfiniteTableColumnRenderBag;
rowIndex: number;
rowActive: boolean;
api: InfiniteTableApi<DATA_TYPE>;
dataSourceApi: DataSourceApi<DATA_TYPE>;
editError?: Error;
column: COL_TYPE;
columns