@infinite-table/infinite-react 0.2.11 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +239 -217
- package/index.esm.js +146 -86
- package/index.js +146 -86
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import * as _vanilla_extract_private from '@vanilla-extract/private';
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import { CSSProperties, MutableRefObject } from 'react';
|
|
4
4
|
|
|
5
|
+
declare function debounce(fn: Function, { wait }: {
|
|
6
|
+
wait: number;
|
|
7
|
+
}): (...args: any[]) => void;
|
|
8
|
+
|
|
5
9
|
interface ScrollPosition {
|
|
6
10
|
scrollTop: number;
|
|
7
11
|
scrollLeft: number;
|
|
@@ -43,6 +47,7 @@ declare class DeepMap<KeyType, ValueType> {
|
|
|
43
47
|
private map;
|
|
44
48
|
private length;
|
|
45
49
|
private revision;
|
|
50
|
+
private emptyKey;
|
|
46
51
|
static clone<KeyType, ValueType>(map: DeepMap<KeyType, ValueType>): DeepMap<KeyType, ValueType>;
|
|
47
52
|
constructor(initial?: [KeyType[], ValueType][]);
|
|
48
53
|
set(keys: KeyType[] & {
|
|
@@ -73,7 +78,7 @@ declare type ComponentStateContext<T_STATE, T_ACTIONS> = {
|
|
|
73
78
|
componentActions: T_ACTIONS;
|
|
74
79
|
};
|
|
75
80
|
declare type ComponentStateGeneratedActions<T_STATE> = {
|
|
76
|
-
[k in keyof T_STATE]: T_STATE[k] | React
|
|
81
|
+
[k in keyof T_STATE]: T_STATE[k] | React.SetStateAction<T_STATE[k]>;
|
|
77
82
|
};
|
|
78
83
|
declare type ComponentInterceptedActions<T_STATE> = {
|
|
79
84
|
[k in keyof T_STATE]?: (value: T_STATE[k], { actions, state, }: {
|
|
@@ -82,40 +87,28 @@ declare type ComponentInterceptedActions<T_STATE> = {
|
|
|
82
87
|
}) => void | boolean;
|
|
83
88
|
};
|
|
84
89
|
declare type ComponentStateActions<T_STATE> = ComponentStateGeneratedActions<T_STATE>;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
|
|
108
|
-
updatedProps: Partial<T_PROPS> | null;
|
|
109
|
-
parentState: T_PARENT_STATE | null;
|
|
110
|
-
}) => COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
|
|
111
|
-
getReducerActions?: (dispatch: React$1.Dispatch<any>) => T_ACTIONS;
|
|
112
|
-
getParentState?: () => T_PARENT_STATE;
|
|
113
|
-
onControlledPropertyChange?: (name: string, newValue: any, oldValue: any) => void | ((value: any, oldValue: any) => any);
|
|
114
|
-
};
|
|
115
|
-
declare function getComponentStateRoot<T_PROPS, 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>): React$1.NamedExoticComponent<T_PROPS & {
|
|
116
|
-
children: React$1.ReactNode;
|
|
117
|
-
}>;
|
|
118
|
-
declare function useComponentState<COMPONENT_STATE>(): ComponentStateContext<COMPONENT_STATE, ComponentStateGeneratedActions<COMPONENT_STATE>>;
|
|
90
|
+
|
|
91
|
+
declare class GroupRowsState<KeyType extends any = any> {
|
|
92
|
+
private expandedMap?;
|
|
93
|
+
private collapsedMap?;
|
|
94
|
+
private collapsedAll;
|
|
95
|
+
private expandedAll;
|
|
96
|
+
private initialState;
|
|
97
|
+
constructor(state: DataSourceExpandedAndCollapsedGroupRows<KeyType> | GroupRowsState<KeyType>);
|
|
98
|
+
getState(): DataSourceExpandedAndCollapsedGroupRows<KeyType>;
|
|
99
|
+
destroy(): void;
|
|
100
|
+
private update;
|
|
101
|
+
areAllCollapsed(): boolean;
|
|
102
|
+
areAllExpanded(): boolean;
|
|
103
|
+
collapseAll(): void;
|
|
104
|
+
expandAll(): void;
|
|
105
|
+
isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
|
|
106
|
+
isGroupRowCollapsed(keys: KeyType[]): boolean;
|
|
107
|
+
setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
|
|
108
|
+
collapseGroupRow(keys: KeyType[]): void;
|
|
109
|
+
expandGroupRow(keys: KeyType[]): void;
|
|
110
|
+
toggleGroupRow(keys: KeyType[]): void;
|
|
111
|
+
}
|
|
119
112
|
|
|
120
113
|
declare type NonUndefined<T> = T extends undefined ? never : T;
|
|
121
114
|
|
|
@@ -226,6 +219,168 @@ declare class VirtualBrain extends Logger {
|
|
|
226
219
|
destroy: () => void;
|
|
227
220
|
}
|
|
228
221
|
|
|
222
|
+
declare type Renderable = React$1.ReactNode;
|
|
223
|
+
|
|
224
|
+
declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
225
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
226
|
+
}[Keys];
|
|
227
|
+
|
|
228
|
+
declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
|
|
229
|
+
declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
|
|
230
|
+
value: string | number | Renderable;
|
|
231
|
+
groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
|
|
232
|
+
rowIndex: number;
|
|
233
|
+
column: COL_TYPE;
|
|
234
|
+
toggleCurrentGroupRow: () => void;
|
|
235
|
+
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
236
|
+
groupBy: DataSourceState<DATA_TYPE>['groupBy'];
|
|
237
|
+
pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
|
|
238
|
+
} & ({
|
|
239
|
+
rowInfo: InfiniteTableRowInfoNormal<DATA_TYPE>;
|
|
240
|
+
data: DATA_TYPE;
|
|
241
|
+
} | {
|
|
242
|
+
rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
|
|
243
|
+
data: Partial<DATA_TYPE> | null;
|
|
244
|
+
});
|
|
245
|
+
declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
|
|
246
|
+
collapsed: boolean;
|
|
247
|
+
groupIcon: Renderable;
|
|
248
|
+
};
|
|
249
|
+
declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
|
|
250
|
+
declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
|
|
251
|
+
rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
|
|
252
|
+
data: DATA_TYPE | Partial<DATA_TYPE> | null;
|
|
253
|
+
dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
|
|
254
|
+
rowIndex: number;
|
|
255
|
+
column: COL_TYPE;
|
|
256
|
+
};
|
|
257
|
+
interface InfiniteTableColumnHeaderRenderParams<T> {
|
|
258
|
+
column: InfiniteTableComputedColumn<T>;
|
|
259
|
+
columnSortInfo: DataSourceSingleSortInfo<T> | null | undefined;
|
|
260
|
+
}
|
|
261
|
+
declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, pivotBy, }: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
|
|
262
|
+
declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
|
|
263
|
+
declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderRenderParams<T>) => Renderable;
|
|
264
|
+
declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
|
|
265
|
+
declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
|
|
266
|
+
declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
|
|
267
|
+
declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
|
|
268
|
+
declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
|
|
269
|
+
/**
|
|
270
|
+
* Determines the field property of the column.
|
|
271
|
+
*/
|
|
272
|
+
field?: keyof T;
|
|
273
|
+
render?: InfiniteTableColumnRenderFunction<T>;
|
|
274
|
+
renderValue?: InfiniteTableColumnRenderFunction<T>;
|
|
275
|
+
valueGetter?: InfiniteTableColumnValueGetter<T>;
|
|
276
|
+
}, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
|
|
277
|
+
declare type InfiniteTableColumnStyleFnParams<T> = {
|
|
278
|
+
value: Renderable;
|
|
279
|
+
column: InfiniteTableColumn<T>;
|
|
280
|
+
} & ({
|
|
281
|
+
data: T;
|
|
282
|
+
rowInfo: InfiniteTableRowInfoNormal<T>;
|
|
283
|
+
} | {
|
|
284
|
+
data: Partial<T> | null;
|
|
285
|
+
rowInfo: InfiniteTableRowInfoGroup<T>;
|
|
286
|
+
});
|
|
287
|
+
declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
|
|
288
|
+
declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
|
|
289
|
+
declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
|
|
290
|
+
declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
|
|
291
|
+
declare type InfiniteTableColumnValueGetterParams<T> = {
|
|
292
|
+
data: T;
|
|
293
|
+
rowInfo: InfiniteTableRowInfoNormal<T>;
|
|
294
|
+
} | {
|
|
295
|
+
data: Partial<T> | null;
|
|
296
|
+
rowInfo: InfiniteTableRowInfoGroup<T>;
|
|
297
|
+
};
|
|
298
|
+
declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = Renderable> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
|
|
299
|
+
declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
|
|
300
|
+
declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
|
|
301
|
+
declare type InfiniteTableBaseColumn<T> = {
|
|
302
|
+
sortable?: boolean;
|
|
303
|
+
draggable?: boolean;
|
|
304
|
+
resizable?: boolean;
|
|
305
|
+
comparer?: InfiniteTableColumnComparer<T>;
|
|
306
|
+
defaultHiddenWhenGroupedBy?: '*' | keyof T | {
|
|
307
|
+
[k in keyof Partial<T>]: true;
|
|
308
|
+
};
|
|
309
|
+
align?: InfiniteTableColumnAlign;
|
|
310
|
+
verticalAlign?: InfiniteTableColumnVerticalAlign;
|
|
311
|
+
columnGroup?: string;
|
|
312
|
+
header?: InfiniteTableColumnHeader<T>;
|
|
313
|
+
name?: Renderable;
|
|
314
|
+
cssEllipsis?: boolean;
|
|
315
|
+
headerCssEllipsis?: boolean;
|
|
316
|
+
type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
|
|
317
|
+
style?: InfiniteTableColumnStyle<T>;
|
|
318
|
+
className?: InfiniteTableColumnClassName<T>;
|
|
319
|
+
rowspan?: InfiniteTableColumnRowspanFn<T>;
|
|
320
|
+
valueGetter?: InfiniteTableColumnValueGetter<T>;
|
|
321
|
+
defaultWidth?: number;
|
|
322
|
+
defaultFlex?: number;
|
|
323
|
+
minWidth?: number;
|
|
324
|
+
maxWidth?: number;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Defines a column in the table.
|
|
328
|
+
*
|
|
329
|
+
* @typeParam DATA_TYPE The type of the data in the table.
|
|
330
|
+
*
|
|
331
|
+
* Can be bound to a field which is a `keyof DATA_TYPE`.
|
|
332
|
+
*/
|
|
333
|
+
declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
|
|
334
|
+
declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
|
|
335
|
+
groupByField: string | string[];
|
|
336
|
+
id?: string;
|
|
337
|
+
};
|
|
338
|
+
declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
|
|
339
|
+
declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
|
|
340
|
+
pivotBy: DataSourcePivotBy<DataType>[];
|
|
341
|
+
pivotTotalColumnGroup?: true;
|
|
342
|
+
pivotGroupKeys: KeyType[];
|
|
343
|
+
pivotByAtIndex: PivotBy<DataType, KeyType>;
|
|
344
|
+
pivotGroupKey: KeyType;
|
|
345
|
+
pivotIndex: number;
|
|
346
|
+
};
|
|
347
|
+
declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
|
|
348
|
+
pivotBy: DataSourcePivotBy<DataType>[];
|
|
349
|
+
pivotColumn: true;
|
|
350
|
+
pivotTotalColumn: boolean;
|
|
351
|
+
pivotAggregator: AggregationReducer<DataType, any>;
|
|
352
|
+
pivotAggregatorIndex: number;
|
|
353
|
+
pivotGroupKeys: KeyType[];
|
|
354
|
+
pivotByAtIndex?: PivotBy<DataType, KeyType>;
|
|
355
|
+
pivotIndex: number;
|
|
356
|
+
pivotGroupKey: KeyType;
|
|
357
|
+
};
|
|
358
|
+
declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
|
|
359
|
+
declare type InfiniteTableComputedColumnBase<T> = {
|
|
360
|
+
computedWidth: number;
|
|
361
|
+
computedOffset: number;
|
|
362
|
+
computedPinningOffset: number;
|
|
363
|
+
computedAbsoluteOffset: number;
|
|
364
|
+
computedSortable: boolean;
|
|
365
|
+
computedSortInfo: DataSourceSingleSortInfo<T> | null;
|
|
366
|
+
computedSorted: boolean;
|
|
367
|
+
computedSortedAsc: boolean;
|
|
368
|
+
computedSortedDesc: boolean;
|
|
369
|
+
computedSortIndex: number;
|
|
370
|
+
computedVisibleIndex: number;
|
|
371
|
+
computedMultiSort: boolean;
|
|
372
|
+
computedPinned: InfiniteTableColumnPinnedValues;
|
|
373
|
+
computedDraggable: boolean;
|
|
374
|
+
computedFirstInCategory: boolean;
|
|
375
|
+
computedLastInCategory: boolean;
|
|
376
|
+
computedFirst: boolean;
|
|
377
|
+
computedLast: boolean;
|
|
378
|
+
toggleSort: () => void;
|
|
379
|
+
id: string;
|
|
380
|
+
};
|
|
381
|
+
declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
|
|
382
|
+
declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
|
|
383
|
+
|
|
229
384
|
interface DataSourceDataParams<T> {
|
|
230
385
|
originalDataArray: T[];
|
|
231
386
|
sortInfo?: DataSourceSortInfo<T>;
|
|
@@ -236,7 +391,7 @@ interface DataSourceDataParams<T> {
|
|
|
236
391
|
groupKeys?: any[];
|
|
237
392
|
aggregationReducers?: DataSourcePropAggregationReducers<T>;
|
|
238
393
|
livePaginationCursor?: DataSourceLivePaginationCursorValue;
|
|
239
|
-
|
|
394
|
+
__cursorId?: DataSourceSetupState<T>['cursorId'];
|
|
240
395
|
changes?: DataSourceDataParamsChanges<T>;
|
|
241
396
|
}
|
|
242
397
|
declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
|
|
@@ -283,6 +438,12 @@ declare type DataSourceAggregationReducer<T, AggregationResultType> = {
|
|
|
283
438
|
getter?: (data: T) => any;
|
|
284
439
|
reducer: string | ((accumulator: any, value: any, data: T) => AggregationResultType | any);
|
|
285
440
|
done?: (accumulatedValue: AggregationResultType | any, array: T[]) => AggregationResultType;
|
|
441
|
+
pivotColumn?: ColumnTypeWithInherit<Partial<InfiniteTableColumn<T>>> | (({ column, }: {
|
|
442
|
+
column: InfiniteTablePivotFinalColumnVariant<T>;
|
|
443
|
+
}) => ColumnTypeWithInherit<Partial<InfiniteTablePivotColumn<T>>>);
|
|
444
|
+
};
|
|
445
|
+
declare type ColumnTypeWithInherit<COL_TYPE> = COL_TYPE & {
|
|
446
|
+
inheritFromColumn?: string | boolean;
|
|
286
447
|
};
|
|
287
448
|
declare type DataSourceMappings = Record<'totals' | 'values', string>;
|
|
288
449
|
declare type LazyGroupDataItem<DataType> = {
|
|
@@ -393,184 +554,6 @@ interface DataSourceReducer<T> {
|
|
|
393
554
|
(state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
|
|
394
555
|
}
|
|
395
556
|
|
|
396
|
-
declare function useDataSource<T>(): DataSourceState<T>;
|
|
397
|
-
|
|
398
|
-
declare function DataSource<T>(props: DataSourceProps<T>): JSX.Element;
|
|
399
|
-
|
|
400
|
-
declare class GroupRowsState<KeyType extends any = any> {
|
|
401
|
-
private expandedMap?;
|
|
402
|
-
private collapsedMap?;
|
|
403
|
-
private collapsedAll;
|
|
404
|
-
private expandedAll;
|
|
405
|
-
private initialState;
|
|
406
|
-
constructor(state: DataSourceExpandedAndCollapsedGroupRows<KeyType> | GroupRowsState<KeyType>);
|
|
407
|
-
getState(): DataSourceExpandedAndCollapsedGroupRows<KeyType>;
|
|
408
|
-
destroy(): void;
|
|
409
|
-
private update;
|
|
410
|
-
areAllCollapsed(): boolean;
|
|
411
|
-
areAllExpanded(): boolean;
|
|
412
|
-
collapseAll(): void;
|
|
413
|
-
expandAll(): void;
|
|
414
|
-
isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
|
|
415
|
-
isGroupRowCollapsed(keys: KeyType[]): boolean;
|
|
416
|
-
setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
|
|
417
|
-
collapseGroupRow(keys: KeyType[]): void;
|
|
418
|
-
expandGroupRow(keys: KeyType[]): void;
|
|
419
|
-
toggleGroupRow(keys: KeyType[]): void;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
declare type Renderable = React$1.ReactNode;
|
|
423
|
-
|
|
424
|
-
declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
425
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
426
|
-
}[Keys];
|
|
427
|
-
|
|
428
|
-
declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
|
|
429
|
-
declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
|
|
430
|
-
value: string | number | Renderable;
|
|
431
|
-
groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
|
|
432
|
-
rowIndex: number;
|
|
433
|
-
column: COL_TYPE;
|
|
434
|
-
toggleCurrentGroupRow: () => void;
|
|
435
|
-
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
436
|
-
groupBy: DataSourceState<DATA_TYPE>['groupBy'];
|
|
437
|
-
pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
|
|
438
|
-
} & ({
|
|
439
|
-
rowInfo: InfiniteTableRowInfoNormal<DATA_TYPE>;
|
|
440
|
-
data: DATA_TYPE;
|
|
441
|
-
} | {
|
|
442
|
-
rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
|
|
443
|
-
data: Partial<DATA_TYPE> | null;
|
|
444
|
-
});
|
|
445
|
-
declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
|
|
446
|
-
collapsed: boolean;
|
|
447
|
-
groupIcon: Renderable;
|
|
448
|
-
};
|
|
449
|
-
declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
|
|
450
|
-
declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
|
|
451
|
-
rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
|
|
452
|
-
data: DATA_TYPE | Partial<DATA_TYPE> | null;
|
|
453
|
-
dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
|
|
454
|
-
rowIndex: number;
|
|
455
|
-
column: COL_TYPE;
|
|
456
|
-
};
|
|
457
|
-
interface InfiniteTableColumnHeaderRenderParams<T> {
|
|
458
|
-
column: InfiniteTableComputedColumn<T>;
|
|
459
|
-
columnSortInfo: DataSourceSingleSortInfo<T> | null | undefined;
|
|
460
|
-
}
|
|
461
|
-
declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, pivotBy, }: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
|
|
462
|
-
declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
|
|
463
|
-
declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderRenderParams<T>) => Renderable;
|
|
464
|
-
declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
|
|
465
|
-
declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
|
|
466
|
-
declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
|
|
467
|
-
declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
|
|
468
|
-
declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
|
|
469
|
-
field?: keyof T;
|
|
470
|
-
render?: InfiniteTableColumnRenderFunction<T>;
|
|
471
|
-
renderValue?: InfiniteTableColumnRenderFunction<T>;
|
|
472
|
-
valueGetter?: InfiniteTableColumnValueGetter<T>;
|
|
473
|
-
}, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
|
|
474
|
-
declare type InfiniteTableColumnStyleFnParams<T> = {
|
|
475
|
-
value: Renderable;
|
|
476
|
-
column: InfiniteTableColumn<T>;
|
|
477
|
-
} & ({
|
|
478
|
-
data: T;
|
|
479
|
-
rowInfo: InfiniteTableRowInfoNormal<T>;
|
|
480
|
-
} | {
|
|
481
|
-
data: Partial<T> | null;
|
|
482
|
-
rowInfo: InfiniteTableRowInfoGroup<T>;
|
|
483
|
-
});
|
|
484
|
-
declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
|
|
485
|
-
declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
|
|
486
|
-
declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
|
|
487
|
-
declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
|
|
488
|
-
declare type InfiniteTableColumnValueGetterParams<T> = {
|
|
489
|
-
data: T;
|
|
490
|
-
rowInfo: InfiniteTableRowInfoNormal<T>;
|
|
491
|
-
} | {
|
|
492
|
-
data: Partial<T> | null;
|
|
493
|
-
rowInfo: InfiniteTableRowInfoGroup<T>;
|
|
494
|
-
};
|
|
495
|
-
declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = Renderable> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
|
|
496
|
-
declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
|
|
497
|
-
declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
|
|
498
|
-
declare type InfiniteTableBaseColumn<T> = {
|
|
499
|
-
sortable?: boolean;
|
|
500
|
-
draggable?: boolean;
|
|
501
|
-
resizable?: boolean;
|
|
502
|
-
comparer?: InfiniteTableColumnComparer<T>;
|
|
503
|
-
defaultHiddenWhenGroupedBy?: '*' | keyof T | {
|
|
504
|
-
[k in keyof Partial<T>]: true;
|
|
505
|
-
};
|
|
506
|
-
align?: InfiniteTableColumnAlign;
|
|
507
|
-
verticalAlign?: InfiniteTableColumnVerticalAlign;
|
|
508
|
-
columnGroup?: string;
|
|
509
|
-
header?: InfiniteTableColumnHeader<T>;
|
|
510
|
-
name?: Renderable;
|
|
511
|
-
cssEllipsis?: boolean;
|
|
512
|
-
headerCssEllipsis?: boolean;
|
|
513
|
-
type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
|
|
514
|
-
style?: InfiniteTableColumnStyle<T>;
|
|
515
|
-
className?: InfiniteTableColumnClassName<T>;
|
|
516
|
-
rowspan?: InfiniteTableColumnRowspanFn<T>;
|
|
517
|
-
valueGetter?: InfiniteTableColumnValueGetter<T>;
|
|
518
|
-
defaultWidth?: number;
|
|
519
|
-
defaultFlex?: number;
|
|
520
|
-
minWidth?: number;
|
|
521
|
-
maxWidth?: number;
|
|
522
|
-
};
|
|
523
|
-
declare type InfiniteTableColumn<T> = {} & InfiniteTableBaseColumn<T> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T>;
|
|
524
|
-
declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
|
|
525
|
-
groupByField: string | string[];
|
|
526
|
-
id?: string;
|
|
527
|
-
};
|
|
528
|
-
declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & Partial<InfiniteTablePivotFinalColumnVariant<T, any>>;
|
|
529
|
-
declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
|
|
530
|
-
pivotBy: DataSourcePivotBy<DataType>[];
|
|
531
|
-
pivotTotalColumnGroup?: true;
|
|
532
|
-
pivotGroupKeys: KeyType[];
|
|
533
|
-
pivotByAtIndex: PivotBy<DataType, KeyType>;
|
|
534
|
-
pivotGroupKey: KeyType;
|
|
535
|
-
pivotIndex: number;
|
|
536
|
-
};
|
|
537
|
-
declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
|
|
538
|
-
pivotBy: DataSourcePivotBy<DataType>[];
|
|
539
|
-
pivotColumn: true;
|
|
540
|
-
pivotTotalColumn: boolean;
|
|
541
|
-
pivotAggregator: AggregationReducer<DataType, any>;
|
|
542
|
-
pivotAggregatorIndex: number;
|
|
543
|
-
pivotGroupKeys: KeyType[];
|
|
544
|
-
pivotByAtIndex?: PivotBy<DataType, KeyType>;
|
|
545
|
-
pivotIndex: number;
|
|
546
|
-
pivotGroupKey: KeyType;
|
|
547
|
-
};
|
|
548
|
-
declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
|
|
549
|
-
declare type InfiniteTableComputedColumnBase<T> = {
|
|
550
|
-
computedWidth: number;
|
|
551
|
-
computedOffset: number;
|
|
552
|
-
computedPinningOffset: number;
|
|
553
|
-
computedAbsoluteOffset: number;
|
|
554
|
-
computedSortable: boolean;
|
|
555
|
-
computedSortInfo: DataSourceSingleSortInfo<T> | null;
|
|
556
|
-
computedSorted: boolean;
|
|
557
|
-
computedSortedAsc: boolean;
|
|
558
|
-
computedSortedDesc: boolean;
|
|
559
|
-
computedSortIndex: number;
|
|
560
|
-
computedVisibleIndex: number;
|
|
561
|
-
computedMultiSort: boolean;
|
|
562
|
-
computedPinned: InfiniteTableColumnPinnedValues;
|
|
563
|
-
computedDraggable: boolean;
|
|
564
|
-
computedFirstInCategory: boolean;
|
|
565
|
-
computedLastInCategory: boolean;
|
|
566
|
-
computedFirst: boolean;
|
|
567
|
-
computedLast: boolean;
|
|
568
|
-
toggleSort: () => void;
|
|
569
|
-
id: string;
|
|
570
|
-
};
|
|
571
|
-
declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
|
|
572
|
-
declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
|
|
573
|
-
|
|
574
557
|
declare type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
|
|
575
558
|
id: string;
|
|
576
559
|
};
|
|
@@ -643,12 +626,12 @@ declare type GroupBy<DataType, KeyType> = {
|
|
|
643
626
|
column?: Partial<InfiniteTableGroupColumnBase<DataType>>;
|
|
644
627
|
};
|
|
645
628
|
declare type PivotBy<DataType, KeyType> = Omit<GroupBy<DataType, KeyType>, 'column'> & {
|
|
646
|
-
column?: InfiniteTableColumn<DataType
|
|
629
|
+
column?: ColumnTypeWithInherit<Partial<InfiniteTableColumn<DataType>>> | (({ column, }: {
|
|
647
630
|
column: InfiniteTablePivotFinalColumnVariant<DataType, KeyType>;
|
|
648
631
|
}) => Partial<InfiniteTablePivotColumn<DataType>>);
|
|
649
632
|
columnGroup?: InfiniteTableColumnGroup | (({ columnGroup, }: {
|
|
650
633
|
columnGroup: InfiniteTablePivotFinalColumnGroup<DataType, KeyType>;
|
|
651
|
-
}) => Partial<InfiniteTablePivotFinalColumnGroup<DataType
|
|
634
|
+
}) => ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnGroup<DataType>>>);
|
|
652
635
|
};
|
|
653
636
|
declare type GroupParams<DataType, KeyType> = {
|
|
654
637
|
groupBy: GroupBy<DataType, KeyType>[];
|
|
@@ -1038,6 +1021,45 @@ declare namespace InfiniteTable {
|
|
|
1038
1021
|
};
|
|
1039
1022
|
}
|
|
1040
1023
|
|
|
1024
|
+
declare function useDataSource<T>(): DataSourceState<T>;
|
|
1025
|
+
|
|
1026
|
+
declare function DataSource<T>(props: DataSourceProps<T>): JSX.Element;
|
|
1027
|
+
|
|
1028
|
+
declare type ForwardPropsToStateFnResult<TYPE_PROPS, TYPE_RESULT> = Partial<{
|
|
1029
|
+
[propName in keyof TYPE_PROPS & keyof TYPE_RESULT]: 1 | ((value: TYPE_PROPS[propName]) => TYPE_RESULT[propName]);
|
|
1030
|
+
}>;
|
|
1031
|
+
declare type ComponentStateRootConfig<T_PROPS, COMPONENT_MAPPED_STATE, COMPONENT_SETUP_STATE = {}, COMPONENT_DERIVED_STATE = {}, T_ACTIONS = {}, T_PARENT_STATE = {}> = {
|
|
1032
|
+
debugName?: string;
|
|
1033
|
+
initSetupState?: () => COMPONENT_SETUP_STATE;
|
|
1034
|
+
forwardProps?: (setupState: COMPONENT_SETUP_STATE) => ForwardPropsToStateFnResult<T_PROPS, COMPONENT_MAPPED_STATE>;
|
|
1035
|
+
allowedControlledPropOverrides?: Record<keyof T_PROPS, true>;
|
|
1036
|
+
interceptActions?: ComponentInterceptedActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>;
|
|
1037
|
+
onPropChange?: (params: {
|
|
1038
|
+
name: keyof T_PROPS;
|
|
1039
|
+
oldValue: any;
|
|
1040
|
+
newValue: any;
|
|
1041
|
+
}, props: T_PROPS, actions: ComponentStateActions<COMPONENT_MAPPED_STATE & COMPONENT_DERIVED_STATE & COMPONENT_SETUP_STATE>) => void;
|
|
1042
|
+
mapPropsToState?: (params: {
|
|
1043
|
+
props: T_PROPS;
|
|
1044
|
+
state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & Partial<COMPONENT_DERIVED_STATE>;
|
|
1045
|
+
oldState: null | (COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & Partial<COMPONENT_DERIVED_STATE>);
|
|
1046
|
+
parentState: T_PARENT_STATE | null;
|
|
1047
|
+
}) => COMPONENT_DERIVED_STATE;
|
|
1048
|
+
concludeReducer?: (params: {
|
|
1049
|
+
previousState: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
|
|
1050
|
+
state: COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
|
|
1051
|
+
updatedProps: Partial<T_PROPS> | null;
|
|
1052
|
+
parentState: T_PARENT_STATE | null;
|
|
1053
|
+
}) => COMPONENT_MAPPED_STATE & COMPONENT_SETUP_STATE & COMPONENT_DERIVED_STATE;
|
|
1054
|
+
getReducerActions?: (dispatch: React$1.Dispatch<any>) => T_ACTIONS;
|
|
1055
|
+
getParentState?: () => T_PARENT_STATE;
|
|
1056
|
+
onControlledPropertyChange?: (name: string, newValue: any, oldValue: any) => void | ((value: any, oldValue: any) => any);
|
|
1057
|
+
};
|
|
1058
|
+
declare function getComponentStateRoot<T_PROPS, 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>): React$1.NamedExoticComponent<T_PROPS & {
|
|
1059
|
+
children: React$1.ReactNode;
|
|
1060
|
+
}>;
|
|
1061
|
+
declare function useComponentState<COMPONENT_STATE>(): ComponentStateContext<COMPONENT_STATE, ComponentStateGeneratedActions<COMPONENT_STATE>>;
|
|
1062
|
+
|
|
1041
1063
|
declare type InterceptedMapFns<K, V> = {
|
|
1042
1064
|
set?: (k: K, v: V) => void;
|
|
1043
1065
|
beforeClear?: (map: Map<K, V>) => void;
|
|
@@ -1054,4 +1076,4 @@ declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>
|
|
|
1054
1076
|
|
|
1055
1077
|
declare function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
|
|
1056
1078
|
|
|
1057
|
-
export { DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceExpandedAndCollapsedGroupRows, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropGroupBy, DataSourcePropLivePaginationCursor, DataSourcePropPivotBy, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTableImperativeApi, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyGroupRowInfo, Scrollbars, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges };
|
|
1079
|
+
export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceExpandedAndCollapsedGroupRows, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropGroupBy, DataSourcePropLivePaginationCursor, DataSourcePropPivotBy, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTableImperativeApi, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyGroupRowInfo, Scrollbars, debounce, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges };
|