@infinite-table/infinite-react 0.2.20 → 0.3.1

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.
Files changed (6) hide show
  1. package/index.css +187 -169
  2. package/index.d.ts +1026 -711
  3. package/index.esm.css +187 -169
  4. package/index.esm.js +7365 -6992
  5. package/index.js +7485 -7085
  6. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,41 +1,11 @@
1
1
  import * as _vanilla_extract_private from '@vanilla-extract/private';
2
2
  import * as React$1 from 'react';
3
- import { CSSProperties, HTMLProps, MutableRefObject } from 'react';
3
+ import { MutableRefObject, CSSProperties, HTMLProps } from 'react';
4
4
 
5
5
  declare function debounce(fn: Function, { wait }: {
6
6
  wait: number;
7
7
  }): (...args: any[]) => void;
8
8
 
9
- interface ScrollPosition {
10
- scrollTop: number;
11
- scrollLeft: number;
12
- }
13
- declare type OnScrollFn = (scrollPosition: ScrollPosition) => void;
14
-
15
- declare type SortDir = 1 | -1;
16
- declare type MultisortInfo<T> = {
17
- /**
18
- * The sorting direction
19
- */
20
- dir: SortDir;
21
- /**
22
- * a property whose value to use for sorting on the array items
23
- */
24
- field?: keyof T;
25
- /**
26
- * for now 'string' and 'number' are known types, meaning they have
27
- * sort functions already implemented
28
- */
29
- type?: string;
30
- fn?: (a: any, b: any) => number;
31
- };
32
- declare const multisort: {
33
- <T>(sortInfo: MultisortInfo<T>[], array: T[], get?: ((item: any) => T) | undefined): T[];
34
- knownTypes: {
35
- [key: string]: (first: any, second: any) => number;
36
- };
37
- };
38
-
39
9
  declare type VoidFn$1 = () => void;
40
10
  declare type Pair<KeyType, ValueType> = {
41
11
  value?: ValueType;
@@ -50,6 +20,10 @@ declare class DeepMap<KeyType, ValueType> {
50
20
  private emptyKey;
51
21
  static clone<KeyType, ValueType>(map: DeepMap<KeyType, ValueType>): DeepMap<KeyType, ValueType>;
52
22
  constructor(initial?: [KeyType[], ValueType][]);
23
+ getValuesStartingWith(keys: KeyType[]): ValueType[];
24
+ getKeysStartingWith(keys: KeyType[]): KeyType[][];
25
+ private getStartingWith;
26
+ getDirectChildrenSizeFor(keys: KeyType[]): number;
53
27
  set(keys: KeyType[] & {
54
28
  length: Omit<number, 0>;
55
29
  }, value: ValueType): this;
@@ -72,6 +46,30 @@ declare class DeepMap<KeyType, ValueType> {
72
46
  private sortedIterator;
73
47
  }
74
48
 
49
+ declare type SortDir = 1 | -1;
50
+ declare type MultisortInfo<T> = {
51
+ /**
52
+ * The sorting direction
53
+ */
54
+ dir: SortDir;
55
+ /**
56
+ * a property whose value to use for sorting on the array items
57
+ */
58
+ field?: keyof T;
59
+ /**
60
+ * for now 'string' and 'number' are known types, meaning they have
61
+ * sort functions already implemented
62
+ */
63
+ type?: string;
64
+ fn?: (a: any, b: any) => number;
65
+ };
66
+ declare const multisort: {
67
+ <T>(sortInfo: MultisortInfo<T>[], array: T[], get?: ((item: any) => T) | undefined): T[];
68
+ knownTypes: {
69
+ [key: string]: (first: any, second: any) => number;
70
+ };
71
+ };
72
+
75
73
  declare type ComponentStateContext<T_STATE, T_ACTIONS> = {
76
74
  getComponentState: () => T_STATE;
77
75
  componentState: T_STATE;
@@ -88,39 +86,22 @@ declare type ComponentInterceptedActions<T_STATE> = {
88
86
  };
89
87
  declare type ComponentStateActions<T_STATE> = ComponentStateGeneratedActions<T_STATE>;
90
88
 
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;
89
+ declare enum InfiniteTableActionType {
90
+ SET_COLUMN_SIZE = 0,
91
+ SET_SCROLL_POSITION = 1,
92
+ SET_BODY_SIZE = 2,
93
+ SET_COLUMN_ORDER = 3,
94
+ SET_COLUMN_VISIBILITY = 4,
95
+ SET_COLUMN_SHIFTS = 5,
96
+ SET_COLUMN_PINNING = 6,
97
+ SET_COLUMN_AGGREGATIONS = 7,
98
+ SET_DRAGGING_COLUMN_ID = 8
111
99
  }
112
100
 
113
- declare type NonUndefined<T> = T extends undefined ? never : T;
114
-
115
- declare type VoidFn = () => void;
116
-
117
- declare type SubscriptionCallbackOnChangeFn<T> = (node: T | null) => void;
118
- interface SubscriptionCallback<T> {
119
- (node: T): void;
120
- get: () => T | null;
121
- destroy: VoidFn;
122
- onChange: (fn: SubscriptionCallbackOnChangeFn<T>) => VoidFn;
123
- }
101
+ declare type InfiniteTableAction = {
102
+ type: InfiniteTableActionType;
103
+ payload?: any;
104
+ };
124
105
 
125
106
  interface LogFn {
126
107
  (...args: any[]): LogFn;
@@ -132,301 +113,651 @@ declare class Logger {
132
113
  constructor(channelName: string);
133
114
  }
134
115
 
116
+ interface ScrollPosition {
117
+ scrollTop: number;
118
+ scrollLeft: number;
119
+ }
120
+ declare type OnScrollFn = (scrollPosition: ScrollPosition) => void;
121
+
135
122
  interface Size {
136
123
  width: number;
137
124
  height: number;
138
125
  }
139
126
 
140
- declare type MainAxisOptions = 'vertical' | 'horizontal';
141
- declare type VirtualBrainOptions = {
142
- mainAxis: MainAxisOptions;
143
- itemSize: MainAxisSize;
144
- itemSpan?: ({ itemIndex }: {
145
- itemIndex: number;
146
- }) => number;
147
- count: number;
148
- name?: string;
127
+ declare type VoidFn = () => void;
128
+
129
+ declare type FixedPosition = false | 'start' | 'end';
130
+ declare type SpanFunction = ({ rowIndex, colIndex, }: {
131
+ rowIndex: number;
132
+ colIndex: number;
133
+ }) => number;
134
+ declare type RenderRangeType = {
135
+ startIndex: number;
136
+ endIndex: number;
149
137
  };
150
- declare type MainAxisSize = number | ((itemIndex: number) => number);
151
- declare type OnRenderCountChangeFn = (renderCount: number) => void;
152
- declare type OnSizeChangeFn = (size: number) => void;
153
- declare type OnDestroyFn = () => void;
154
- declare type RenderRange = {
155
- renderStartIndex: number;
156
- renderEndIndex: number;
138
+ declare type ItemSizeFunction = (index: number) => number;
139
+ declare type MatrixBrainOptions = {
140
+ width: number;
141
+ height: number;
142
+ cols: number;
143
+ rows: number;
144
+ rowHeight: number | ItemSizeFunction;
145
+ colWidth: number | ItemSizeFunction;
146
+ rowspan?: SpanFunction;
147
+ colspan?: SpanFunction;
148
+ };
149
+ declare type TableRenderRange = {
150
+ start: [number, number];
151
+ end: [number, number];
152
+ rowFixed?: FixedPosition;
153
+ colFixed?: FixedPosition;
157
154
  };
158
- declare type OnRenderRangeChangeFn = (renderRange: RenderRange) => void;
159
- declare class VirtualBrain extends Logger {
155
+ declare type WhichDirection = {
156
+ horizontal?: boolean;
157
+ vertical?: boolean;
158
+ };
159
+ declare type FnOnRenderRangeChange = (range: TableRenderRange) => void;
160
+ declare type FnOnDirectionalRenderRangeChange = (range: [number, number]) => void;
161
+ declare type FnOnRenderCountChange = ({ horizontal, vertical, }: {
162
+ horizontal: number;
163
+ vertical: number;
164
+ }) => void;
165
+ declare type OnAvailableSizeChange = (size: Size) => void;
166
+ declare class MatrixBrain extends Logger {
167
+ private scrolling;
168
+ private width;
169
+ private height;
170
+ private cols;
171
+ private rows;
172
+ private rowHeight;
173
+ private colWidth;
174
+ private rowspan;
175
+ private colspan;
176
+ private rowspanParent;
177
+ private rowspanValue;
178
+ private rowHeightCache;
179
+ private rowOffsetCache;
180
+ private verticalTotalSize;
181
+ private colspanParent;
182
+ private colspanValue;
183
+ private colWidthCache;
184
+ private colOffsetCache;
185
+ private horizontalTotalSize;
186
+ private horizontalRenderCount?;
187
+ private verticalRenderCount?;
188
+ private horizontalRenderRange;
189
+ private verticalRenderRange;
190
+ private extraSpanCells;
160
191
  private scrollPosition;
161
- private scrollPositionOnMainAxis;
162
- private itemSpanParent;
163
- private itemSpanValue;
164
- private itemSizeCache;
165
- private itemOffsetCache;
166
- private options;
167
- private destroyed;
168
- private totalSize;
169
192
  private onScrollFns;
170
- private onTotalSizeChangeFns;
171
- private onRenderCountChangeFns;
172
193
  private onRenderRangeChangeFns;
194
+ private onVerticalRenderRangeChangeFns;
195
+ private onHorizontalRenderRangeChangeFns;
173
196
  private onDestroyFns;
174
- name: string | undefined;
175
- private renderCount;
176
- private renderRange;
177
- private availableSize;
178
- constructor(options: VirtualBrainOptions);
179
- setAvailableSize: (size: Size) => void;
180
- getOptions(): VirtualBrainOptions;
181
- private updateRenderCount;
182
- private computeRenderCount;
183
- private setRenderCount;
184
- private updateRenderRange;
185
- getRenderStartIndex(): number;
186
- getRenderCount: () => number;
187
- setScrollPosition: (scrollPosition: ScrollPosition) => void;
197
+ private destroyed;
198
+ private onRenderCountChangeFns;
199
+ private onAvailableSizeChangeFns;
200
+ private onScrollStartFns;
201
+ private onScrollStopFns;
202
+ private scrollTimeoutId;
203
+ private scrollStopDelay;
204
+ /**
205
+ * Number of columns that are fixed at the start
206
+ */
207
+ private fixedColsStart;
208
+ /**
209
+ * Number of columns that are fixed at the end
210
+ */
211
+ private fixedColsEnd;
212
+ /**
213
+ * Number of rows that are fixed at the start
214
+ */
215
+ private fixedRowsStart;
216
+ /**
217
+ * Number of rows that are fixed at the end
218
+ */
219
+ private fixedRowsEnd;
220
+ constructor();
221
+ private reset;
222
+ private resetVertical;
223
+ private resetHorizontal;
224
+ setScrollStopDelay: (scrollStopDelay: number) => void;
225
+ getRowCount: () => number;
226
+ getColCount: () => number;
227
+ update: (options: Partial<MatrixBrainOptions>) => void;
228
+ setRowAndColumnSizes({ rowHeight, colWidth, }: {
229
+ rowHeight: number | ItemSizeFunction;
230
+ colWidth: number | ItemSizeFunction;
231
+ }): void;
232
+ setRowsAndCols: ({ rows, cols }: {
233
+ rows: number;
234
+ cols: number;
235
+ }) => void;
236
+ setAvailableSize(size: Partial<Size>, config?: {
237
+ skipUpdateRenderCount?: boolean;
238
+ }): void;
239
+ updateRenderCount: (which?: WhichDirection) => void;
240
+ private doUpdateRenderCount;
241
+ get scrollTopMax(): number;
242
+ get scrollLeftMax(): number;
243
+ private setScrolling;
244
+ private notifyScrollStart;
245
+ private notifyScrollStop;
246
+ setScrollPosition: (scrollPosition: ScrollPosition, callback?: ((scrollPos: ScrollPosition) => void) | undefined) => void;
247
+ private notifyAvailableSizeChange;
248
+ private notifyRenderRangeChange;
249
+ private notifyVerticalRenderRangeChange;
250
+ private notifyHorizontalRenderRangeChange;
188
251
  private notifyScrollChange;
189
- private notifyDestroy;
190
- private notifyTotalSizeChange;
252
+ private computeDirectionalRenderCount;
253
+ getFixedSize(direction: 'horizontal' | 'vertical'): number;
254
+ getFixedStartSize(direction: 'horizontal' | 'vertical'): number;
255
+ getFixedEndSize(direction: 'horizontal' | 'vertical'): number;
256
+ getFixedEndColsWidth: () => number;
257
+ /**
258
+ * Returns an array of offsets for all cols fixed at the end
259
+ *
260
+ * The order in the array is from leftmost col to the rightmost col
261
+ * The reference for offset is the left side of the table.
262
+ * The offsets take into account the scroll position and return the correct position.
263
+ *
264
+ * The indexes in the returned array are the absolute indexes of the cols, so the returned array is an array with holes
265
+ *
266
+ */
267
+ getFixedEndColsOffsets: () => number[];
268
+ /**
269
+ * Returns an array of offsets for all rows fixed at the end
270
+ *
271
+ * The order in the array is from topmost row to the bottom-most row
272
+ * The reference for offset is the top side of the table.
273
+ * The offsets take into account the scroll position and return the correct position.
274
+ *
275
+ * The indexes in the returned array are the absolute indexes of the rows, so the returned array is an array with holes
276
+ *
277
+ */
278
+ getFixedEndRowsOffsets: () => number[];
279
+ getFixedStartColsWidth: () => number;
280
+ getFixedEndRowsHeight: () => number;
281
+ getFixedStartRowsHeight: () => number;
282
+ computeRenderCount: (which?: WhichDirection) => {
283
+ horizontal: number;
284
+ vertical: number;
285
+ };
286
+ setRenderCount: ({ horizontal, vertical, }: {
287
+ horizontal: number;
288
+ vertical: number;
289
+ }) => void;
191
290
  private notifyRenderCountChange;
192
- private notifyRenderRangeChange;
193
- getRenderRange: () => RenderRange;
194
- private setRenderRange;
195
- private computeRenderRange;
196
- getScrollPosition: () => ScrollPosition;
197
- onScroll: (fn: OnScrollFn) => () => void;
198
- onTotalSizeChange: (fn: OnSizeChangeFn) => () => void;
199
- onRenderCountChange: (fn: OnRenderCountChangeFn) => () => void;
200
- onRenderRangeChange: (fn: OnRenderRangeChangeFn) => () => void;
201
- onDestroy: (fn: OnDestroyFn) => () => void;
202
- update: (newCount: VirtualBrainOptions['count'], newItemSize: VirtualBrainOptions['itemSize'], newItemSpan?: VirtualBrainOptions['itemSpan']) => void;
203
- private reset;
204
- private computeItemSpanUpTo;
291
+ updateFixedCells: (config: {
292
+ fixedColsStart?: number;
293
+ fixedColsEnd?: number;
294
+ fixedRowsStart?: number;
295
+ fixedRowsEnd?: number;
296
+ }) => void;
297
+ getFixedCellInfo: () => {
298
+ fixedRowsStart: number;
299
+ fixedColsStart: number;
300
+ fixedRowsEnd: number;
301
+ fixedColsEnd: number;
302
+ };
303
+ updateRenderRange: (which?: WhichDirection) => void;
304
+ getExtraSpanCellsForRange: ({ horizontal, vertical, }: {
305
+ horizontal: RenderRangeType;
306
+ vertical: RenderRangeType;
307
+ }) => [number, number][];
308
+ computeRenderRange: (which?: WhichDirection) => {
309
+ horizontal: RenderRangeType;
310
+ vertical: RenderRangeType;
311
+ extraCells: [number, number][];
312
+ };
313
+ computeDirectionalRenderRange: (direction: 'horizontal' | 'vertical') => {
314
+ startIndex: number;
315
+ endIndex: number;
316
+ };
317
+ getItemAt: (scrollPos: number, direction: 'horizontal' | 'vertical') => number;
318
+ getCellOffset: (rowIndex: number, colIndex: number) => {
319
+ x: number;
320
+ y: number;
321
+ };
322
+ private getItemOffsetFor;
205
323
  private computeCacheFor;
206
324
  private getItemSizeCacheFor;
207
- getItemSpan: (itemIndex: number) => number;
208
- getItemSpanParent: (itemIndex: number) => number;
209
- getItemSizeWithSpan: (itemIndex: number, itemSpan: number) => number;
325
+ private computeItemSpanUpTo;
326
+ private getCellSpan;
327
+ getRowspan: (rowIndex: number, colIndex: number) => number;
328
+ getColspan: (rowIndex: number, colIndex: number) => number;
329
+ getRowspanParent: (rowIndex: number, colIndex: number) => number;
330
+ getColspanParent: (rowIndex: number, colIndex: number) => number;
331
+ getItemSpanParent: (rowIndex: number, colIndex: number, direction: 'horizontal' | 'vertical') => number;
332
+ getRowHeightWithSpan: (rowIndex: number, colIndex: number, rowspan: number) => number;
333
+ getColWidthWithSpan: (rowIndex: number, colIndex: number, colspan: number) => number;
334
+ private getItemSizeWithSpan;
335
+ getRowHeight: (rowIndex: number) => number;
336
+ getColWidth: (colIndex: number) => number;
210
337
  /**
211
- * For now, this doesn't take into account the itemspan, and it's okay not to
338
+ * For now, this doesn't take into account the row/colspan, and it's okay not to
212
339
  * @param itemIndex
213
340
  * @returns the size of the specified item
214
341
  */
215
- getItemSize: (itemIndex: number) => number;
216
- getTotalSize: () => number;
217
- getItemAt: (scrollPos: number) => number;
218
- getItemOffsetFor: (itemIndex: number) => number;
342
+ getItemSize: (itemIndex: number, direction: 'horizontal' | 'vertical') => number;
343
+ getTotalSize: () => {
344
+ height: number;
345
+ width: number;
346
+ };
347
+ getTotalSizeFor: (direction: 'horizontal' | 'vertical') => number;
348
+ setRenderRange: ({ horizontal, vertical, extraCells, }: {
349
+ horizontal: RenderRangeType;
350
+ vertical: RenderRangeType;
351
+ extraCells?: [number, number][] | undefined;
352
+ }) => void;
353
+ getRenderRangeCellCount: (range: TableRenderRange) => number;
354
+ getExtraCells: () => [
355
+ number,
356
+ number
357
+ ][];
358
+ getScrollPosition: () => ScrollPosition;
359
+ getRenderRange: () => TableRenderRange;
360
+ onScroll: (fn: OnScrollFn) => () => void;
361
+ onScrollStart: (fn: VoidFunction) => () => void;
362
+ onScrollStop: (fn: (scrollPos: ScrollPosition) => void) => () => void;
363
+ onRenderRangeChange: (fn: FnOnRenderRangeChange) => () => void;
364
+ onVerticalRenderRangeChange: (fn: FnOnDirectionalRenderRangeChange) => () => void;
365
+ onHorizontalRenderRangeChange: (fn: FnOnDirectionalRenderRangeChange) => () => void;
366
+ onRenderCountChange: (fn: FnOnRenderCountChange) => () => void;
367
+ onAvailableSizeChange: (fn: OnAvailableSizeChange) => () => void;
368
+ onDestroy: (fn: VoidFn) => () => void;
369
+ getAvailableSize: () => {
370
+ width: number;
371
+ height: number;
372
+ };
373
+ private notifyDestroy;
219
374
  destroy: () => void;
220
375
  }
221
376
 
222
377
  declare type Renderable = React$1.ReactNode | JSX.Element;
223
378
 
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];
379
+ declare type SubscriptionCallbackOnChangeFn<T> = (node: T | null) => void;
380
+ interface SubscriptionCallback<T> {
381
+ (node: T, callback?: () => void): void;
382
+ get: () => T | null;
383
+ destroy: VoidFn;
384
+ onChange: (fn: SubscriptionCallbackOnChangeFn<T>) => VoidFn;
385
+ }
227
386
 
228
- declare type InfiniteTableCellProps<T> = {
229
- column: InfiniteTableComputedColumn<T>;
230
- renderChildren: () => Renderable;
231
- cssEllipsis?: boolean;
232
- virtualized?: boolean;
233
- skipColumnShifting?: boolean;
234
- beforeChildren?: Renderable;
235
- afterChildren?: Renderable;
236
- offset?: number;
237
- offsetProperty?: 'left' | 'right';
238
- cssPosition?: CSSProperties['position'];
239
- domRef?: React.RefCallback<HTMLElement>;
240
- cellType: 'body' | 'header';
241
- };
387
+ declare class ScrollListener {
388
+ private scrollPosition;
389
+ private onScrollFns;
390
+ getScrollPosition: () => ScrollPosition;
391
+ onScroll: (fn: OnScrollFn) => () => void;
392
+ setScrollPosition: (scrollPosition: ScrollPosition) => void;
393
+ private notifyScrollChange;
394
+ destroy: () => void;
395
+ }
242
396
 
243
- declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
244
- declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
245
- domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
246
- sortTool: JSX.Element;
247
- column: COL_TYPE;
248
- columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
249
- };
250
- declare type InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
251
- domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
252
- value: string | number | Renderable;
253
- groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
254
- rowIndex: number;
255
- column: COL_TYPE;
256
- toggleCurrentGroupRow: () => void;
257
- toggleGroupRow: InfiniteTableToggleGroupRowFn;
258
- groupBy: DataSourceState<DATA_TYPE>['groupBy'];
259
- pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
260
- } & ({
261
- rowInfo: InfiniteTableRowInfoNormal<DATA_TYPE>;
262
- data: DATA_TYPE;
263
- } | {
264
- rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
265
- data: Partial<DATA_TYPE> | null;
266
- });
267
- declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParams<DATA_TYPE> & {};
268
- declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE> & {
269
- collapsed: boolean;
270
- groupIcon: Renderable;
271
- };
272
- declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE>;
273
- declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
274
- rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
275
- data: DATA_TYPE | Partial<DATA_TYPE> | null;
276
- dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
277
- rowIndex: number;
278
- column: COL_TYPE;
279
- };
280
- declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, pivotBy, }: InfiniteTableColumnRenderParams<DATA_TYPE, COL_TYPE>) => Renderable | null;
281
- declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
282
- declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
283
- declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
284
- declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
285
- declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
286
- declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
287
- declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
288
- /**
289
- * Determines the field property of the column.
290
- */
291
- field?: keyof T;
292
- render?: InfiniteTableColumnRenderFunction<T>;
293
- renderValue?: InfiniteTableColumnRenderFunction<T>;
294
- valueGetter?: InfiniteTableColumnValueGetter<T>;
295
- }, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
296
- declare type InfiniteTableColumnStyleFnParams<T> = {
297
- value: Renderable;
298
- column: InfiniteTableColumn<T>;
299
- } & ({
300
- data: T;
301
- rowInfo: InfiniteTableRowInfoNormal<T>;
302
- } | {
303
- data: Partial<T> | null;
304
- rowInfo: InfiniteTableRowInfoGroup<T>;
305
- });
306
- declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
307
- declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
308
- declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
309
- declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
310
- declare type InfiniteTableColumnValueGetterParams<T> = {
311
- data: T;
312
- rowInfo: InfiniteTableRowInfoNormal<T>;
313
- } | {
314
- data: Partial<T> | null;
315
- rowInfo: InfiniteTableRowInfoGroup<T>;
316
- };
317
- declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
318
- declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
319
- declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
320
- declare type InfiniteTableBaseColumn<T> = {
321
- sortable?: boolean;
322
- draggable?: boolean;
323
- resizable?: boolean;
324
- comparer?: InfiniteTableColumnComparer<T>;
325
- defaultHiddenWhenGroupedBy?: '*' | keyof T | {
326
- [k in keyof Partial<T>]: true;
327
- };
328
- align?: InfiniteTableColumnAlign;
329
- verticalAlign?: InfiniteTableColumnVerticalAlign;
330
- columnGroup?: string;
331
- header?: InfiniteTableColumnHeader<T>;
332
- name?: Renderable;
333
- cssEllipsis?: boolean;
334
- headerCssEllipsis?: boolean;
335
- type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
336
- style?: InfiniteTableColumnStyle<T>;
337
- className?: InfiniteTableColumnClassName<T>;
338
- rowspan?: InfiniteTableColumnRowspanFn<T>;
339
- valueGetter?: InfiniteTableColumnValueGetter<T>;
397
+ declare type NonUndefined<T> = T extends undefined ? never : T;
398
+
399
+ interface InfiniteTableSetupState<T> {
400
+ propsCache: Map<keyof InfiniteTableProps<T>, WeakMap<any, any>>;
401
+ columnsWhenInlineGroupRenderStrategy?: Map<string, InfiniteTableColumn<T>>;
402
+ domRef: MutableRefObject<HTMLDivElement | null>;
403
+ scrollerDOMRef: MutableRefObject<HTMLDivElement | null>;
404
+ portalDOMRef: MutableRefObject<HTMLDivElement | null>;
405
+ onRowHeightCSSVarChange: SubscriptionCallback<number>;
406
+ onHeaderHeightCSSVarChange: SubscriptionCallback<number>;
407
+ columnsWhenGrouping?: InfiniteTablePropColumnsMap<T>;
408
+ bodySize: Size;
409
+ brain: MatrixBrain;
410
+ headerBrain: MatrixBrain;
411
+ focused: boolean;
412
+ ready: boolean;
413
+ focusedWithin: boolean;
414
+ scrollPosition: ScrollPosition;
415
+ draggingColumnId: null | string;
416
+ pinnedStartScrollListener: ScrollListener;
417
+ pinnedEndScrollListener: ScrollListener;
418
+ columnShifts: number[] | null;
419
+ }
420
+ declare type InfiniteTableColumnGroupsDepthsMap = Map<string, number>;
421
+ declare type InfiniteTablePropPivotTotalColumnPosition = false | 'start' | 'end';
422
+ declare type InfiniteTablePropPivotGrandTotalColumnPosition = InfiniteTablePropPivotTotalColumnPosition;
423
+ interface InfiniteTableMappedState<T> {
424
+ scrollTopKey: InfiniteTableProps<T>['scrollTopKey'];
425
+ viewportReservedWidth: InfiniteTableProps<T>['viewportReservedWidth'];
426
+ groupColumn: InfiniteTableProps<T>['groupColumn'];
427
+ onScrollbarsChange: InfiniteTableProps<T>['onScrollbarsChange'];
428
+ loadingText: InfiniteTableProps<T>['loadingText'];
429
+ components: InfiniteTableProps<T>['components'];
430
+ columns: InfiniteTablePropColumnsMap<T>;
431
+ pivotColumns: InfiniteTableProps<T>['pivotColumns'];
432
+ onReady: InfiniteTableProps<T>['onReady'];
433
+ onSelfFocus: InfiniteTableProps<T>['onSelfFocus'];
434
+ onSelfBlur: InfiniteTableProps<T>['onSelfBlur'];
435
+ onFocusWithin: InfiniteTableProps<T>['onFocusWithin'];
436
+ onBlurWithin: InfiniteTableProps<T>['onBlurWithin'];
437
+ autoSizeColumnsKey: InfiniteTableProps<T>['autoSizeColumnsKey'];
438
+ scrollStopDelay: NonUndefined<InfiniteTableProps<T>['scrollStopDelay']>;
439
+ onScrollToTop: InfiniteTableProps<T>['onScrollToTop'];
440
+ onScrollToBottom: InfiniteTableProps<T>['onScrollToBottom'];
441
+ onScrollStop: InfiniteTableProps<T>['onScrollStop'];
442
+ scrollToBottomOffset: InfiniteTableProps<T>['scrollToBottomOffset'];
443
+ focusedClassName: InfiniteTableProps<T>['focusedClassName'];
444
+ focusedWithinClassName: InfiniteTableProps<T>['focusedWithinClassName'];
445
+ focusedStyle: InfiniteTableProps<T>['focusedStyle'];
446
+ focusedWithinStyle: InfiniteTableProps<T>['focusedWithinStyle'];
447
+ showSeparatePivotColumnForSingleAggregation: NonUndefined<InfiniteTableProps<T>['showSeparatePivotColumnForSingleAggregation']>;
448
+ domProps: InfiniteTableProps<T>['domProps'];
449
+ rowStyle: InfiniteTableProps<T>['rowStyle'];
450
+ rowProps: InfiniteTableProps<T>['rowProps'];
451
+ rowClassName: InfiniteTableProps<T>['rowClassName'];
452
+ pinnedStartMaxWidth: InfiniteTableProps<T>['pinnedStartMaxWidth'];
453
+ pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
454
+ pivotColumn: InfiniteTableProps<T>['pivotColumn'];
455
+ pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
456
+ activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
457
+ columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
458
+ columnMaxWidth: NonUndefined<InfiniteTableProps<T>['columnMaxWidth']>;
459
+ columnDefaultWidth: NonUndefined<InfiniteTableProps<T>['columnDefaultWidth']>;
460
+ columnCssEllipsis: NonUndefined<InfiniteTableProps<T>['columnCssEllipsis']>;
461
+ draggableColumns: NonUndefined<InfiniteTableProps<T>['draggableColumns']>;
462
+ sortable: NonUndefined<InfiniteTableProps<T>['sortable']>;
463
+ hideEmptyGroupColumns: NonUndefined<InfiniteTableProps<T>['hideEmptyGroupColumns']>;
464
+ columnOrder: NonUndefined<InfiniteTableProps<T>['columnOrder']>;
465
+ showZebraRows: NonUndefined<InfiniteTableProps<T>['showZebraRows']>;
466
+ showHoverRows: NonUndefined<InfiniteTableProps<T>['showHoverRows']>;
467
+ header: NonUndefined<InfiniteTableProps<T>['header']>;
468
+ virtualizeColumns: NonUndefined<InfiniteTableProps<T>['virtualizeColumns']>;
469
+ rowHeight: number;
470
+ headerHeight: number;
471
+ licenseKey: NonUndefined<InfiniteTableProps<T>['licenseKey']>;
472
+ columnVisibility: InfiniteTablePropColumnVisibility;
473
+ columnPinning: InfiniteTablePropColumnPinningMap;
474
+ columnSizing: InfiniteTablePropColumnSizing;
475
+ columnTypes: InfiniteTablePropColumnTypes<T>;
476
+ columnGroups: InfiniteTablePropColumnGroupsMap;
477
+ collapsedColumnGroups: NonUndefined<InfiniteTableProps<T>['collapsedColumnGroups']>;
478
+ pivotTotalColumnPosition: NonUndefined<InfiniteTableProps<T>['pivotTotalColumnPosition']>;
479
+ pivotGrandTotalColumnPosition: InfiniteTableProps<T>['pivotGrandTotalColumnPosition'];
480
+ }
481
+ interface InfiniteTableDerivedState<T> {
482
+ groupBy: DataSourceProps<T>['groupBy'];
483
+ computedColumns: Map<string, InfiniteTableColumn<T>>;
484
+ groupRenderStrategy: NonUndefined<InfiniteTableProps<T>['groupRenderStrategy']>;
485
+ columnHeaderCssEllipsis: NonUndefined<InfiniteTableProps<T>['columnHeaderCssEllipsis']>;
486
+ columnGroupsDepthsMap: InfiniteTableColumnGroupsDepthsMap;
487
+ columnGroupsMaxDepth: number;
488
+ computedColumnGroups: InfiniteTablePropColumnGroupsMap;
489
+ rowHeightCSSVar: string;
490
+ headerHeightCSSVar: string;
491
+ controlledColumnVisibility: boolean;
492
+ }
493
+ declare type InfiniteTableActions<T> = ComponentStateActions<InfiniteTableState<T>>;
494
+ interface InfiniteTableState<T> extends InfiniteTableMappedState<T>, InfiniteTableDerivedState<T>, InfiniteTableSetupState<T> {
495
+ }
496
+
497
+ declare type LoadMaskProps = {
498
+ visible: boolean;
499
+ children: Renderable;
500
+ };
501
+ declare type InfiniteTablePropColumnOrderNormalized = string[];
502
+ declare type InfiniteTablePropColumnOrder = InfiniteTablePropColumnOrderNormalized | true;
503
+ declare type InfiniteTablePropColumnVisibility = Record<string, false>;
504
+ declare type InfiniteTablePropColumnPinningMap = Map<string, true | 'start' | 'end'>;
505
+ declare type InfiniteTableColumnPinnedValues = false | 'start' | 'end';
506
+ declare type InfiniteTablePropColumnPinningRecord = Record<string, true | 'start' | 'end'>;
507
+ declare type InfiniteTablePropColumnPinning = InfiniteTablePropColumnPinningRecord | InfiniteTablePropColumnPinningMap;
508
+ declare type InfiniteTableRowStyleFnParams<T> = {
509
+ rowIndex: number;
510
+ } & InfiniteTableRowInfoDataDiscriminator<T>;
511
+ declare type InfiniteTableRowStyleFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => undefined | React$1.CSSProperties;
512
+ declare type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => string | undefined;
513
+ declare type InfiniteTablePropRowStyle<T> = React$1.CSSProperties | InfiniteTableRowStyleFn<T>;
514
+ declare type InfiniteTablePropRowClassName<T> = string | InfiniteTableRowClassNameFn<T>;
515
+ declare type InfiniteTableColumnAggregator<T, AggregationResultType> = Omit<AggregationReducer<T, AggregationResultType>, 'getter' | 'id'> & {
516
+ getter?: AggregationReducer<T, AggregationResultType>['getter'];
517
+ field?: keyof T;
518
+ };
519
+ declare type InfiniteTableColumnType<T> = {
520
+ minWidth?: number;
521
+ maxWidth?: number;
340
522
  defaultWidth?: number;
341
523
  defaultFlex?: number;
524
+ defaultPinned?: InfiniteTableColumnPinnedValues;
525
+ defaultHiddenWhenGroupedBy?: InfiniteTableColumn<T>['defaultHiddenWhenGroupedBy'];
526
+ header?: InfiniteTableColumn<T>['header'];
527
+ comparer?: InfiniteTableColumn<T>['comparer'];
528
+ draggable?: InfiniteTableColumn<T>['draggable'];
529
+ sortable?: InfiniteTableColumn<T>['sortable'];
530
+ resizable?: InfiniteTableColumn<T>['resizable'];
531
+ align?: InfiniteTableColumn<T>['align'];
532
+ verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
533
+ cssEllipsis?: boolean;
534
+ headerCssEllipsis?: boolean;
535
+ components?: InfiniteTableColumn<T>['components'];
536
+ renderValue?: InfiniteTableColumn<T>['renderValue'];
537
+ render?: InfiniteTableColumn<T>['render'];
538
+ valueGetter?: InfiniteTableColumn<T>['valueGetter'];
539
+ style?: InfiniteTableColumn<T>['style'];
540
+ };
541
+ declare type InfiniteTablePropColumnTypes<T> = Record<'default' | string, InfiniteTableColumnType<T>>;
542
+ declare type InfiniteTableColumnSizingOptions = {
543
+ flex?: number;
544
+ width?: number;
342
545
  minWidth?: number;
343
546
  maxWidth?: number;
344
- components?: {
345
- ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
346
- HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
347
- };
348
547
  };
349
- /**
350
- * Defines a column in the table.
351
- *
352
- * @typeParam DATA_TYPE The type of the data in the table.
353
- *
354
- * Can be bound to a field which is a `keyof DATA_TYPE`.
355
- */
356
- declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
357
- declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
358
- groupByField: string | string[];
359
- id?: string;
548
+ declare type InfiniteTablePropColumnSizing = Record<string, InfiniteTableColumnSizingOptions>;
549
+ declare type InfiniteTableImperativeApi<T> = {
550
+ setColumnOrder: (columnOrder: InfiniteTablePropColumnOrder) => void;
551
+ setColumnVisibility: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
552
+ x?: T;
553
+ getState: () => InfiniteTableState<T>;
554
+ getDataSourceState: () => DataSourceState<T>;
360
555
  };
361
- declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
362
- declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
363
- pivotBy: DataSourcePivotBy<DataType>[];
364
- pivotTotalColumnGroup?: true;
365
- pivotGroupKeys: KeyType[];
366
- pivotByAtIndex: PivotBy<DataType, KeyType>;
367
- pivotGroupKey: KeyType;
368
- pivotIndex: number;
556
+ declare type InfiniteTablePropVirtualizeColumns<T> = boolean | ((columns: InfiniteTableComputedColumn<T>[]) => boolean);
557
+ declare type InfiniteTablePropColumnsMap<T, ColumnType = InfiniteTableColumn<T>> = Map<string, ColumnType>;
558
+ declare type InfiniteTablePropColumns<T, ColumnType = InfiniteTableColumn<T>> = InfiniteTablePropColumnsMap<T, ColumnType> | Record<string, ColumnType>;
559
+ declare type InfiniteTablePropColumnGroupsMap = Map<string, InfiniteTableColumnGroup>;
560
+ declare type InfiniteTablePropColumnGroupsRecord = Record<string, InfiniteTableColumnGroup>;
561
+ declare type InfiniteTablePropColumnGroups = InfiniteTablePropColumnGroupsRecord | InfiniteTablePropColumnGroupsMap;
562
+ declare type InfiniteTablePropCollapsedColumnGroups = Map<string[], string>;
563
+ declare type InfiniteTableColumnGroupHeaderRenderParams = {
564
+ columnGroup: InfiniteTableComputedColumnGroup;
369
565
  };
370
- declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
371
- pivotBy: DataSourcePivotBy<DataType>[];
372
- pivotColumn: true;
373
- pivotTotalColumn: boolean;
374
- pivotAggregator: AggregationReducer<DataType, any>;
375
- pivotAggregatorIndex: number;
376
- pivotGroupKeys: KeyType[];
377
- pivotByAtIndex?: PivotBy<DataType, KeyType>;
378
- pivotIndex: number;
379
- pivotGroupKey: KeyType;
566
+ declare type InfiniteTableColumnGroupHeaderRenderFunction = (params: InfiniteTableColumnGroupHeaderRenderParams) => Renderable;
567
+ declare type InfiniteTableColumnGroup = {
568
+ columnGroup?: string;
569
+ header?: Renderable | InfiniteTableColumnGroupHeaderRenderFunction;
380
570
  };
381
- declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
382
- declare type InfiniteTableComputedColumnBase<T> = {
383
- computedWidth: number;
384
- computedOffset: number;
385
- computedPinningOffset: number;
386
- computedAbsoluteOffset: number;
387
- computedSortable: boolean;
388
- computedSortInfo: DataSourceSingleSortInfo<T> | null;
389
- computedSorted: boolean;
390
- computedSortedAsc: boolean;
391
- computedSortedDesc: boolean;
392
- computedSortIndex: number;
393
- computedVisibleIndex: number;
394
- computedMultiSort: boolean;
395
- computedPinned: InfiniteTableColumnPinnedValues;
396
- computedDraggable: boolean;
397
- computedFirstInCategory: boolean;
398
- computedLastInCategory: boolean;
399
- computedFirst: boolean;
400
- computedLast: boolean;
401
- toggleSort: () => void;
571
+ declare type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
402
572
  id: string;
573
+ groupOffset: number;
574
+ computedWidth: number;
575
+ uniqueGroupId: string[];
576
+ columns: string[];
577
+ depth: number;
403
578
  };
404
- declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
405
- declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
406
-
407
- interface DataSourceDataParams<T> {
408
- originalDataArray: T[];
409
- sortInfo?: DataSourceSortInfo<T>;
410
- groupBy?: DataSourcePropGroupBy<T>;
411
- pivotBy?: DataSourcePropPivotBy<T>;
412
- lazyLoadBatchSize?: number;
413
- lazyLoadStartIndex?: number;
414
- groupKeys?: any[];
415
- aggregationReducers?: DataSourcePropAggregationReducers<T>;
416
- livePaginationCursor?: DataSourceLivePaginationCursorValue;
417
- __cursorId?: DataSourceSetupState<T>['cursorId'];
418
- changes?: DataSourceDataParamsChanges<T>;
419
- }
420
- declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
421
- declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
422
- field?: keyof T;
423
- id?: string;
579
+ declare type InfiniteTableGroupColumnGetterOptions<T> = {
580
+ groupIndexForColumn?: number;
581
+ groupByForColumn?: DataSourceGroupBy<T>;
582
+ groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
583
+ groupCount: number;
584
+ groupBy: DataSourceGroupBy<T>[];
585
+ pivotBy?: DataSourcePivotBy<T>[];
424
586
  };
425
- declare type DataSourceGroupBy<T> = GroupBy<T, any>;
587
+ declare type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
588
+ column: COL_TYPE;
589
+ groupBy: DataSourcePropGroupBy<T>;
590
+ pivotBy: DataSourcePropPivotBy<T>;
591
+ };
592
+ declare type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
593
+ declare type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
594
+ renderValue?: InfiniteTableColumnRenderFunction<T>;
595
+ renderGroupIcon?: InfiniteTableGroupColumnRenderIconFunction<T>;
596
+ id?: string;
597
+ };
598
+ declare type InfiniteTablePivotColumnBase<T> = InfiniteTableColumn<T> & {
599
+ renderValue?: InfiniteTableColumnRenderFunction<T, InfiniteTableComputedPivotFinalColumn<T>>;
600
+ };
601
+ declare type InfiniteTablePropGroupColumn<T> = InfiniteTableGroupColumnBase<T> | InfiniteTableGroupColumnFunction<T>;
602
+ declare type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => Partial<InfiniteTableGroupColumnBase<T>>;
603
+ declare type InfiniteTablePropPivotColumn<T, COL_TYPE = InfiniteTableColumn<T>> = Partial<InfiniteTablePivotColumnBase<T>> | ((options: InfiniteTablePivotColumnGetterOptions<T, COL_TYPE>) => InfiniteTablePivotColumnBase<T>);
604
+ declare type InfiniteTablePropComponents = {
605
+ LoadMask?: React$1.FC<LoadMaskProps>;
606
+ };
607
+ declare type ScrollStopInfo = {
608
+ scrollTop: number;
609
+ firstVisibleRowIndex: number;
610
+ lastVisibleRowIndex: number;
611
+ };
612
+ interface InfiniteTableProps<T> {
613
+ columns: InfiniteTablePropColumns<T>;
614
+ pivotColumns?: InfiniteTablePropColumnsMap<T, InfiniteTablePivotColumn<T>>;
615
+ loadingText?: Renderable;
616
+ components?: InfiniteTablePropComponents;
617
+ viewportReservedWidth?: number;
618
+ pivotColumn?: InfiniteTablePropPivotColumn<T, InfiniteTableColumn<T> & InfiniteTablePivotFinalColumn<T>>;
619
+ pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
620
+ pivotGrandTotalColumnPosition?: InfiniteTablePropPivotGrandTotalColumnPosition;
621
+ groupColumn?: Partial<InfiniteTablePropGroupColumn<T>>;
622
+ groupRenderStrategy?: InfiniteTablePropGroupRenderStrategy;
623
+ hideEmptyGroupColumns?: boolean;
624
+ columnVisibility?: InfiniteTablePropColumnVisibility;
625
+ defaultColumnVisibility?: InfiniteTablePropColumnVisibility;
626
+ pinnedStartMaxWidth?: number;
627
+ pinnedEndMaxWidth?: number;
628
+ columnPinning?: InfiniteTablePropColumnPinning;
629
+ defaultColumnPinning?: InfiniteTablePropColumnPinning;
630
+ columnSizing?: InfiniteTablePropColumnSizing;
631
+ defaultColumnSizing?: InfiniteTablePropColumnSizing;
632
+ onColumnSizingChange?: (columnSizing: InfiniteTablePropColumnSizing) => void;
633
+ pivotColumnGroups?: InfiniteTablePropColumnGroups;
634
+ columnGroups?: InfiniteTablePropColumnGroups;
635
+ defaultColumnGroups?: InfiniteTablePropColumnGroups;
636
+ defaultCollapsedColumnGroups?: InfiniteTablePropCollapsedColumnGroups;
637
+ collapsedColumnGroups?: InfiniteTablePropCollapsedColumnGroups;
638
+ onScrollbarsChange?: (scrollbars: Scrollbars) => void;
639
+ onColumnVisibilityChange?: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
640
+ columnTypes?: InfiniteTablePropColumnTypes<T>;
641
+ showSeparatePivotColumnForSingleAggregation?: boolean;
642
+ rowHeight: number | string;
643
+ rowStyle?: InfiniteTablePropRowStyle<T>;
644
+ rowClassName?: InfiniteTablePropRowClassName<T>;
645
+ headerHeight: number | string;
646
+ domProps?: React$1.HTMLProps<HTMLDivElement>;
647
+ showZebraRows?: boolean;
648
+ showHoverRows?: boolean;
649
+ sortable?: boolean;
650
+ draggableColumns?: boolean;
651
+ header?: boolean;
652
+ focusedClassName?: string;
653
+ focusedWithinClassName?: string;
654
+ focusedStyle?: React$1.CSSProperties;
655
+ focusedWithinStyle?: React$1.CSSProperties;
656
+ columnCssEllipsis?: boolean;
657
+ columnHeaderCssEllipsis?: boolean;
658
+ columnDefaultWidth?: number;
659
+ columnMinWidth?: number;
660
+ columnMaxWidth?: number;
661
+ resizableColumns?: boolean;
662
+ virtualizeColumns?: InfiniteTablePropVirtualizeColumns<T>;
663
+ virtualizeRows?: boolean;
664
+ defaultActiveIndex?: number;
665
+ activeIndex?: number;
666
+ onSelfFocus?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
667
+ onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
668
+ onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
669
+ onBlurWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
670
+ onScrollToTop?: () => void;
671
+ onScrollToBottom?: () => void;
672
+ scrollStopDelay?: number;
673
+ onScrollStop?: (param: ScrollStopInfo) => void;
674
+ scrollToBottomOffset?: number;
675
+ defaultColumnOrder?: InfiniteTablePropColumnOrder;
676
+ columnOrder?: InfiniteTablePropColumnOrder;
677
+ onColumnOrderChange?: (columnOrder: InfiniteTablePropColumnOrder) => void;
678
+ onRowHeightChange?: (rowHeight: number) => void;
679
+ onReady?: (api: InfiniteTableImperativeApi<T>) => void;
680
+ rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
681
+ licenseKey?: string;
682
+ scrollTopKey?: string | number;
683
+ autoSizeColumnsKey?: InfiniteTablePropAutoSizeColumnsKey;
684
+ }
685
+ declare type InfiniteTablePropAutoSizeColumnsKey = string | number | {
686
+ key: string | number;
687
+ columnsToSkip?: string[];
688
+ columnsToResize?: string[];
689
+ includeHeader?: boolean;
690
+ };
691
+ declare type Scrollbars = {
692
+ vertical: boolean;
693
+ horizontal: boolean;
694
+ };
695
+
696
+ interface InfiniteTableComputedValues<T> {
697
+ scrollbars: {
698
+ vertical: boolean;
699
+ horizontal: boolean;
700
+ };
701
+ rowspan?: MatrixBrainOptions['rowspan'];
702
+ computedPinnedStartOverflow: boolean;
703
+ computedPinnedEndOverflow: boolean;
704
+ computedPinnedStartColumns: InfiniteTableComputedColumn<T>[];
705
+ computedPinnedEndColumns: InfiniteTableComputedColumn<T>[];
706
+ computedUnpinnedColumns: InfiniteTableComputedColumn<T>[];
707
+ computedVisibleColumns: InfiniteTableComputedColumn<T>[];
708
+ computedVisibleColumnsMap: Map<string, InfiniteTableComputedColumn<T>>;
709
+ computedColumnVisibility: InfiniteTablePropColumnVisibility;
710
+ computedColumnOrder: InfiniteTablePropColumnOrderNormalized;
711
+ computedPinnedStartColumnsWidth: number;
712
+ computedPinnedStartWidth: number;
713
+ computedPinnedEndColumnsWidth: number;
714
+ computedPinnedEndWidth: number;
715
+ computedUnpinnedColumnsWidth: number;
716
+ computedUnpinnedOffset: number;
717
+ computedPinnedEndOffset: number;
718
+ computedRemainingSpace: number;
719
+ toggleGroupRow: (groupKeys: any[]) => void;
720
+ columnSize: (colIndex: number) => number;
721
+ }
722
+
723
+ interface InfiniteTableContextValue<T> {
724
+ componentState: InfiniteTableState<T>;
725
+ componentActions: InfiniteTableActions<T>;
726
+ computed: InfiniteTableComputedValues<T>;
727
+ getComputed: () => InfiniteTableComputedValues<T>;
728
+ getState: () => InfiniteTableState<T>;
729
+ }
730
+
731
+ declare type RenderRange = {
732
+ renderStartIndex: number;
733
+ renderEndIndex: number;
734
+ };
735
+
736
+ interface DataSourceDataParams<T> {
737
+ originalDataArray: T[];
738
+ sortInfo?: DataSourceSortInfo<T>;
739
+ groupBy?: DataSourcePropGroupBy<T>;
740
+ pivotBy?: DataSourcePropPivotBy<T>;
741
+ groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
742
+ lazyLoadBatchSize?: number;
743
+ lazyLoadStartIndex?: number;
744
+ groupKeys?: any[];
745
+ append?: boolean;
746
+ aggregationReducers?: DataSourcePropAggregationReducers<T>;
747
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
748
+ __cursorId?: DataSourceSetupState<T>['cursorId'];
749
+ changes?: DataSourceDataParamsChanges<T>;
750
+ }
751
+ declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
752
+ declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
753
+ field?: keyof T;
754
+ id?: string;
755
+ };
756
+ declare type DataSourceGroupBy<T> = GroupBy<T, any>;
426
757
  declare type DataSourcePivotBy<T> = PivotBy<T, any>;
427
758
  declare type DataSourceSortInfo<T> = null | DataSourceSingleSortInfo<T> | DataSourceSingleSortInfo<T>[];
428
759
  declare type DataSourceRemoteData<T> = {
429
- data: T[];
760
+ data: T[] | LazyGroupDataItem<T>[];
430
761
  mappings?: DataSourceMappings;
431
762
  cache?: boolean;
432
763
  totalCount?: number;
@@ -434,7 +765,7 @@ declare type DataSourceRemoteData<T> = {
434
765
  };
435
766
  declare type DataSourceData<T> = T[] | DataSourceRemoteData<T> | Promise<T[] | DataSourceRemoteData<T>> | ((dataInfo: DataSourceDataParams<T>) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
436
767
  declare type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
437
- declare type DataSourceExpandedAndCollapsedGroupRows<KeyType> = {
768
+ declare type DataSourcePropGroupRowsStateObject<KeyType> = {
438
769
  expandedRows: DataSourceGroupRowsList<KeyType>;
439
770
  collapsedRows: DataSourceGroupRowsList<KeyType>;
440
771
  };
@@ -448,7 +779,7 @@ interface DataSourceMappedState<T> {
448
779
  data: DataSourceProps<T>['data'];
449
780
  primaryKey: DataSourceProps<T>['primaryKey'];
450
781
  groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
451
- groupRowsState: NonUndefined<DataSourceProps<T>['groupRowsState']>;
782
+ groupRowsState: GroupRowsState<T>;
452
783
  pivotBy: DataSourceProps<T>['pivotBy'];
453
784
  loading: NonUndefined<DataSourceProps<T>['loading']>;
454
785
  collapseGroupRowsOnDataFunctionChange: NonUndefined<DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']>;
@@ -473,18 +804,26 @@ declare type LazyGroupDataItem<DataType> = {
473
804
  data: Partial<DataType>;
474
805
  keys: any[];
475
806
  aggregations?: Record<string, any>;
807
+ dataset?: DataSourceRemoteData<DataType>;
476
808
  pivot?: {
477
809
  values: Record<string, any>;
478
810
  totals?: Record<string, any>;
479
811
  };
480
812
  };
481
- declare type LazyGroupRowInfo<DataType> = {
482
- items: LazyGroupDataItem<DataType>[];
813
+ declare type LazyRowInfoGroup<DataType> = {
814
+ /**
815
+ * Those are direct children of the current lazy group row
816
+ */
817
+ children: LazyGroupDataItem<DataType>[];
818
+ childrenLoading: boolean;
819
+ childrenAvailable: boolean;
820
+ cache: boolean;
483
821
  totalCount: number;
484
- cache?: boolean;
822
+ error?: string;
485
823
  };
486
- declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyGroupRowInfo<DataType>>;
824
+ declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
487
825
  interface DataSourceSetupState<T> {
826
+ lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
488
827
  pivotMappings?: DataSourceMappings;
489
828
  propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
490
829
  showSeparatePivotColumnForSingleAggregation: boolean;
@@ -502,7 +841,7 @@ interface DataSourceSetupState<T> {
502
841
  groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
503
842
  pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
504
843
  pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
505
- cursorId: number | Symbol | DataSourceLivePaginationCursorValue;
844
+ cursorId: number | symbol | DataSourceLivePaginationCursorValue;
506
845
  updatedAt: number;
507
846
  reducedAt: number;
508
847
  groupedAt: number;
@@ -533,8 +872,8 @@ declare type DataSourceProps<T> = {
533
872
  groupBy?: DataSourcePropGroupBy<T>;
534
873
  defaultGroupBy?: DataSourcePropGroupBy<T>;
535
874
  onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
536
- groupRowsState?: GroupRowsState;
537
- defaultGroupRowsState?: GroupRowsState;
875
+ groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
876
+ defaultGroupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<keyof T>;
538
877
  onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
539
878
  collapseGroupRowsOnDataFunctionChange?: boolean;
540
879
  sortInfo?: DataSourceSortInfo<T>;
@@ -578,6 +917,28 @@ interface DataSourceReducer<T> {
578
917
  (state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
579
918
  }
580
919
 
920
+ declare class GroupRowsState<KeyType extends any = any> {
921
+ private expandedMap?;
922
+ private collapsedMap?;
923
+ private collapsedAll;
924
+ private expandedAll;
925
+ private initialState;
926
+ constructor(state: DataSourcePropGroupRowsStateObject<KeyType> | GroupRowsState<KeyType>);
927
+ getState(): DataSourcePropGroupRowsStateObject<KeyType>;
928
+ destroy(): void;
929
+ private update;
930
+ areAllCollapsed(): boolean;
931
+ areAllExpanded(): boolean;
932
+ collapseAll(): void;
933
+ expandAll(): void;
934
+ isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
935
+ isGroupRowCollapsed(keys: KeyType[]): boolean;
936
+ setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
937
+ collapseGroupRow(keys: KeyType[]): void;
938
+ expandGroupRow(keys: KeyType[]): void;
939
+ toggleGroupRow(keys: KeyType[]): void;
940
+ }
941
+
581
942
  declare type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
582
943
  id: string;
583
944
  };
@@ -585,51 +946,191 @@ declare type AggregationReducerResult<AggregationResultType extends any = any> =
585
946
  value: AggregationResultType;
586
947
  id: string;
587
948
  };
588
- declare type InfiniteTableRowInfoNormalType<DataType> = {
589
- data: DataType;
949
+ /**
950
+ * InfiniteTableRowInfo can have different object shape depending on the presence or absence of grouping.
951
+ *
952
+ * You can use `dataSourceHasGrouping: boolean` as a discriminator to determine the shape of the object, to know
953
+ * if the dataSource had grouping or not. Furthermore, for when the dataSource has grouping,
954
+ * you can use `isGroupRow: boolean` to discriminate between group rows vs normal rows.
955
+ *
956
+ */
957
+ declare type InfiniteTableRowInfo<T> = InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T> | InfiniteTable_NoGrouping_RowInfoNormal<T>;
958
+ declare type InfiniteTableRowInfoDataDiscriminator<T> = {
959
+ data: T;
590
960
  isGroupRow: false;
591
- };
592
- declare type InfiniteTableRowInfoGroupType<DataType> = {
593
- data: Partial<DataType> | null;
961
+ rowInfo: InfiniteTable_NoGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoNormal<T>;
962
+ } | {
963
+ data: Partial<T> | null;
964
+ rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<T>;
594
965
  isGroupRow: true;
595
966
  };
596
- declare type InfiniteTableRowInfoNormal<T> = InfiniteTableRowInfoBase<T> & InfiniteTableRowInfoNormalType<T>;
597
- declare type InfiniteTableRowInfoGroup<T> = InfiniteTableRowInfoBase<T> & InfiniteTableRowInfoGroupType<T>;
598
- declare type InfiniteTableRowInfo<T> = InfiniteTableRowInfoNormal<T> | InfiniteTableRowInfoGroup<T>;
599
- declare type InfiniteTableRowInfoBase<T> = {
967
+ /**
968
+ * This is the base row info for all scenarios - things every
969
+ * rowInfo is guaranteed to have (be it group or normal row, or dataSource with or without grouping)
970
+ *
971
+ */
972
+ declare type InfiniteTable_RowInfoBase<_T> = {
600
973
  id: any;
601
974
  value?: any;
602
- groupData?: T[];
603
- collapsed: boolean;
604
- collapsedChildrenCount?: number;
605
- collapsedGroupsCount?: number;
606
- groupNesting?: number;
607
- groupKeys?: any[];
608
- flatRowInfoList?: (InfiniteTableRowInfo<T> | InfiniteTableEnhancedGroupInfo<T>)[];
609
- parents?: InfiniteTableEnhancedGroupInfo<T>[];
610
- indexInParentGroups?: number[];
611
- indexInGroup: number;
612
975
  indexInAll: number;
613
- groupCount?: number;
614
- groupBy?: (keyof T)[];
615
- rootGroupBy?: (keyof T)[];
616
- pivotValuesMap?: PivotValuesDeepMap<T, any>;
617
- reducerResults?: Record<string, AggregationReducerResult>;
618
976
  };
619
- declare type InfiniteTableEnhancedGroupInfo<T> = InfiniteTableRowInfo<T> & {
977
+ declare type InfiniteTable_HasGrouping_RowInfoNormal<T> = {
978
+ dataSourceHasGrouping: true;
979
+ data: T;
980
+ isGroupRow: false;
981
+ } & InfiniteTable_HasGrouping_RowInfoBase<T> & InfiniteTable_RowInfoBase<T>;
982
+ declare type InfiniteTable_HasGrouping_RowInfoGroup<T> = {
983
+ dataSourceHasGrouping: true;
620
984
  data: Partial<T> | null;
621
- groupData: T[];
622
- flatRowInfoList: (InfiniteTableRowInfo<T> | InfiniteTableEnhancedGroupInfo<T>)[];
623
- value: any;
624
985
  isGroupRow: true;
986
+ /**
987
+ * This array contains all the (uncollapsed, so visible) row infos under this group, at any level of nesting,
988
+ * in the order in which they are visible in the table
989
+ */
990
+ deepRowInfoArray: (InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T>)[];
991
+ reducerResults?: Record<string, AggregationReducerResult>;
992
+ /**
993
+ * The count of all leaf nodes (normal rows) that are inside this group.
994
+ * This count is the same as the length of the groupData array property.
995
+ */
996
+ groupCount: number;
997
+ /**
998
+ * The array of all leaf nodes (normal rows) that are inside this group.
999
+ */
1000
+ groupData: T[];
1001
+ /**
1002
+ * The count of all leaf nodes (normal rows) inside the group that are not being visible
1003
+ * due to collapsing (either the current row is collapsed or any of its children)
1004
+ */
625
1005
  collapsedChildrenCount: number;
626
1006
  collapsedGroupsCount: number;
627
- groupNesting: number;
628
- groupKeys?: any[];
629
- groupCount: number;
1007
+ /**
1008
+ * The count of the direct children of the current group. Direct children can be either normal rows or groups.
1009
+ */
1010
+ directChildrenCount: number;
1011
+ directChildrenLoadedCount: number;
1012
+ /**
1013
+ *
1014
+ * A DeepMap of pivot values.
1015
+ *
1016
+ * For each pivot reducer result, it contains all the items that make up the pivot value.
1017
+ *
1018
+ */
1019
+ pivotValuesMap?: PivotValuesDeepMap<T, any>;
1020
+ /**
1021
+ * For non-lazy grouping, this is always true.
1022
+ * For lazy/batched grouping, this is true if the group has been expanded at least once (and if the remote call has been configured with cache: true),
1023
+ * since if the remote call is not cached, collapsing the row group should lose all the data that was loaded for it, and it's as if it was never loaded, so in that case, childrenAvailable is false.
1024
+ *
1025
+ * NOTE: if this is true, it doesn't mean that all the children have been loaded, it only means that some children have been loaded and are available
1026
+ *
1027
+ * Use directChildrenCount and directChildrenLoadedCount to know if all the children have been loaded or not.
1028
+ */
1029
+ childrenAvailable: boolean;
1030
+ /**
1031
+ * Boolean flag that will be true while lazy loading direct children of the current row group.
1032
+ *
1033
+ * NOTE: with batched loading, if the user is no longer scrolling, after everything
1034
+ * in the viewport has loaded (and thus for example a certain row group had childrenLoading: true)
1035
+ * if no new batches are being loaded, childrenLoading will be false again, even though
1036
+ * the current row group still has children that are not loaded yet.
1037
+ * Use directChildrenLoadedCount and directChildrenCount to know if all the children have been loaded or not.
1038
+ */
1039
+ childrenLoading: boolean;
1040
+ } & InfiniteTable_HasGrouping_RowInfoBase<T> & InfiniteTable_RowInfoBase<T>;
1041
+ declare type InfiniteTable_NoGrouping_RowInfoNormal<T> = {
1042
+ dataSourceHasGrouping: false;
1043
+ data: T;
1044
+ isGroupRow: false;
1045
+ selfLoaded: boolean;
1046
+ } & InfiniteTable_RowInfoBase<T>;
1047
+ declare type InfiniteTable_HasGrouping_RowInfoBase<T> = {
1048
+ indexInGroup: number;
1049
+ /**
1050
+ * Available on all rowInfo objects when the datasource is grouped, otherwise, it will be undefined.
1051
+ *
1052
+ * For group rows, the group keys will have all the keys starting from the topmost parent
1053
+ * down to the current group row (including the group row).
1054
+ * For normal rows, the group keys will have all the keys starting from the topmost parent
1055
+ * down to the last group row in the hierarchy (the direct parent of the current row).
1056
+ *
1057
+ * Example: People grouped by country and city
1058
+ *
1059
+ * Italy - country - groupKeys: ['Italy']
1060
+ * Rome - city - groupKeys: ['Italy', 'Rome']
1061
+ * Marco - person - groupKeys: ['Italy', 'Rome']
1062
+ * Luca - person - groupKeys: ['Italy', 'Rome']
1063
+ * Giuseppe - person - groupKeys: ['Italy', 'Rome']
1064
+ *
1065
+ */
1066
+ groupKeys: any[];
1067
+ /**
1068
+ * Available on all rowInfo objects when the datasource is grouped, otherwise, it will be undefined.
1069
+ *
1070
+ * Has the same structure as groupKeys, but it will contain the fields used to group the rows.
1071
+ *
1072
+ * Example: People grouped by country and city
1073
+ *
1074
+ * Italy - country - groupKeys: ['country']
1075
+ * Rome - city - groupKeys: ['country', 'city']
1076
+ * Marco - person - groupKeys: ['country', 'city']
1077
+ * Luca - person - groupKeys: ['country', 'city']
1078
+ * Giuseppe - person - groupKeys: ['country', 'city']
1079
+ */
630
1080
  groupBy: (keyof T)[];
1081
+ /**
1082
+ * The groupBy value of the DataSource component, mapped to the groupBy.field
1083
+ */
631
1084
  rootGroupBy: (keyof T)[];
632
- pivotValuesMap?: PivotValuesDeepMap<T, any>;
1085
+ /**
1086
+ * Available on all rowInfo objects when the datasource is grouped.
1087
+ *
1088
+ * Italy - country - parent mapped to their ids will be: [] // rowInfo.parents.map((p: any) => p.id)
1089
+ * Rome - city - parent mapped to their ids will be: ['Italy']
1090
+ * Marco - person - parent mapped to their ids will be: ['Italy','Italy,Rome']
1091
+ * Luca - person - parent mapped to their ids will be: ['Italy','Italy,Rome']
1092
+ * Giuseppe - person - parent mapped to their ids will be: ['Italy','Italy,Rome']
1093
+ * USA - country - parent mapped to their ids will be: []
1094
+ * LA - city - parent mapped to their ids will be: ['USA']
1095
+ * Bob - person - parent mapped to their ids will be: ['USA','USA,LA']
1096
+ */
1097
+ parents: InfiniteTable_HasGrouping_RowInfoGroup<T>[];
1098
+ /**
1099
+ * Available when the datasource is grouped, this will be set for both group and normal rows.
1100
+ * Italy - country - indexInParentGroups: [0]
1101
+ * Rome - city - indexInParentGroups: [0,0]
1102
+ * Marco - person - indexInParentGroups: [0,0,0]
1103
+ * Luca - person - indexInParentGroups: [0,0,1]
1104
+ * Giuseppe - person - indexInParentGroups: [0,0,2]
1105
+ * USA - country - indexInParentGroups: [1]
1106
+ * LA - city - indexInParentGroups: [1,0]
1107
+ * Bob - person - indexInParentGroups: [1,0,2]
1108
+ */
1109
+ indexInParentGroups: number[];
1110
+ /**
1111
+ * Available on all rowInfo objects when the datasource is grouped.
1112
+ *
1113
+ * For every rowInfo object, it counts the number of leaf/normal rows that the group contains.
1114
+ * For normal rows, the groupCount represents the groupCount of the direct parent.
1115
+ *
1116
+ * Italy - country - groupCount: 3
1117
+ * Rome - city - groupCount: 2
1118
+ * Marco - person - groupCount: 2
1119
+ * Luca - person - groupCount: 2
1120
+ * Napoli - city - groupCount: 1
1121
+ * Giuseppe - person - groupCount: 1
1122
+ * USA - country - groupCount: 1
1123
+ * LA - city - groupCount: 1
1124
+ * Bob - person - groupCount: 1
1125
+ */
1126
+ groupCount: number;
1127
+ groupNesting: number;
1128
+ collapsed: boolean;
1129
+ /**
1130
+ * This is false only when the DataSource is configured with lazy batching and the current
1131
+ * row has not been loaded yet. It has nothing to do with children, only with self.
1132
+ */
1133
+ selfLoaded: boolean;
633
1134
  };
634
1135
  declare type GroupKeyType<T extends any = any> = T;
635
1136
  declare type PivotReducerResults<T = any> = Record<string, AggregationReducerResult<T>>;
@@ -639,8 +1140,15 @@ declare type PivotGroupValueType<DataType, KeyType> = {
639
1140
  };
640
1141
  declare type PivotValuesDeepMap<DataType, KeyType> = DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
641
1142
  declare type DeepMapGroupValueType<DataType, KeyType> = {
1143
+ /**
1144
+ * These are leaf items. This array may be empty when there is batched lazy loading
1145
+ */
642
1146
  items: DataType[];
643
1147
  commonData?: Partial<DataType>;
1148
+ childrenLoading: boolean;
1149
+ childrenAvailable: boolean;
1150
+ cache: boolean;
1151
+ error?: string;
644
1152
  reducerResults: Record<string, AggregationReducerResult>;
645
1153
  pivotDeepMap?: DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
646
1154
  };
@@ -674,375 +1182,182 @@ declare type DataGroupResult<DataType, KeyType extends any> = {
674
1182
  declare function group<DataType, KeyType = any>(groupParams: GroupParams<DataType, KeyType>, data: DataType[]): DataGroupResult<DataType, KeyType>;
675
1183
  declare function flatten<DataType, KeyType extends any>(groupResult: DataGroupResult<DataType, KeyType>): DataType[];
676
1184
 
677
- declare type LoadMaskProps = {
678
- visible: boolean;
679
- children: Renderable;
680
- };
681
-
682
- declare type InfiniteTablePropColumnOrderNormalized = string[];
683
- declare type InfiniteTablePropColumnOrder = InfiniteTablePropColumnOrderNormalized | true;
684
- declare type InfiniteTablePropColumnVisibility = Record<string, false>;
685
- declare type InfiniteTablePropColumnPinningMap = Map<string, true | 'start' | 'end'>;
686
- declare type InfiniteTableColumnPinnedValues = false | 'start' | 'end';
687
- declare type InfiniteTablePropColumnPinningRecord = Record<string, true | 'start' | 'end'>;
688
- declare type InfiniteTablePropColumnPinning = InfiniteTablePropColumnPinningRecord | InfiniteTablePropColumnPinningMap;
689
- declare type InfiniteTableRowStyleFnParams<T> = {
690
- rowIndex: number;
691
- groupBy?: (keyof T)[];
692
- } & ({
693
- data: T;
694
- rowInfo: InfiniteTableRowInfoNormal<T>;
695
- } | {
696
- data: Partial<T> | null;
697
- rowInfo: InfiniteTableRowInfoGroup<T>;
698
- });
699
- declare type InfiniteTableRowStyleFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => undefined | React$1.CSSProperties;
700
- declare type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => string | undefined;
701
- declare type InfiniteTablePropRowStyle<T> = React$1.CSSProperties | InfiniteTableRowStyleFn<T>;
702
- declare type InfiniteTablePropRowClassName<T> = string | InfiniteTableRowClassNameFn<T>;
703
- declare type InfiniteTableColumnAggregator<T, AggregationResultType> = Omit<AggregationReducer<T, AggregationResultType>, 'getter' | 'id'> & {
704
- getter?: AggregationReducer<T, AggregationResultType>['getter'];
705
- field?: keyof T;
706
- };
707
- declare type InfiniteTableColumnType<T> = {
708
- minWidth?: number;
709
- maxWidth?: number;
710
- defaultWidth?: number;
711
- defaultFlex?: number;
712
- defaultPinned?: InfiniteTableColumnPinnedValues;
713
- defaultHiddenWhenGroupedBy?: InfiniteTableColumn<T>['defaultHiddenWhenGroupedBy'];
714
- header?: InfiniteTableColumn<T>['header'];
715
- comparer?: InfiniteTableColumn<T>['comparer'];
716
- draggable?: InfiniteTableColumn<T>['draggable'];
717
- sortable?: InfiniteTableColumn<T>['sortable'];
718
- resizable?: InfiniteTableColumn<T>['resizable'];
719
- align?: InfiniteTableColumn<T>['align'];
720
- verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
1185
+ declare type InfiniteTableCellProps<T> = {
1186
+ column: InfiniteTableComputedColumn<T>;
1187
+ renderChildren: () => Renderable;
1188
+ width: number;
721
1189
  cssEllipsis?: boolean;
722
- headerCssEllipsis?: boolean;
723
- components?: InfiniteTableColumn<T>['components'];
724
- renderValue?: InfiniteTableColumn<T>['renderValue'];
725
- render?: InfiniteTableColumn<T>['render'];
726
- valueGetter?: InfiniteTableColumn<T>['valueGetter'];
727
- style?: InfiniteTableColumn<T>['style'];
728
- };
729
- declare type InfiniteTablePropColumnTypes<T> = Record<'default' | string, InfiniteTableColumnType<T>>;
730
- declare type InfiniteTableColumnSizingOptions = {
731
- flex?: number;
732
- width?: number;
733
- minWidth?: number;
734
- maxWidth?: number;
735
- };
736
- declare type InfiniteTablePropColumnSizing = Record<string, InfiniteTableColumnSizingOptions>;
737
- declare type InfiniteTableImperativeApi<T> = {
738
- setColumnOrder: (columnOrder: InfiniteTablePropColumnOrder) => void;
739
- setColumnVisibility: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
740
- x?: T;
741
- getState: () => InfiniteTableState<T>;
742
- getDataSourceState: () => DataSourceState<T>;
1190
+ virtualized?: boolean;
1191
+ skipColumnShifting?: boolean;
1192
+ beforeChildren?: Renderable;
1193
+ afterChildren?: Renderable;
1194
+ offset?: number;
1195
+ offsetProperty?: 'left' | 'right';
1196
+ cssPosition?: CSSProperties['position'];
1197
+ domRef?: React.RefCallback<HTMLElement>;
1198
+ cellType: 'body' | 'header';
743
1199
  };
744
- declare type InfiniteTablePropVirtualizeColumns<T> = boolean | ((columns: InfiniteTableComputedColumn<T>[]) => boolean);
745
- declare type InfiniteTablePropColumnsMap<T, ColumnType = InfiniteTableColumn<T>> = Map<string, ColumnType>;
746
- declare type InfiniteTablePropColumns<T, ColumnType = InfiniteTableColumn<T>> = InfiniteTablePropColumnsMap<T, ColumnType> | Record<string, ColumnType>;
747
- declare type InfiniteTablePropColumnGroupsMap = Map<string, InfiniteTableColumnGroup>;
748
- declare type InfiniteTablePropColumnGroupsRecord = Record<string, InfiniteTableColumnGroup>;
749
- declare type InfiniteTablePropColumnGroups = InfiniteTablePropColumnGroupsRecord | InfiniteTablePropColumnGroupsMap;
750
- declare type InfiniteTablePropCollapsedColumnGroups = Map<string[], string>;
751
- declare type InfiniteTableColumnGroupHeaderRenderParams = {
752
- columnGroup: InfiniteTableComputedColumnGroup;
1200
+
1201
+ declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
1202
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
1203
+ }[Keys];
1204
+
1205
+ declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
1206
+ declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1207
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1208
+ sortTool: JSX.Element;
1209
+ column: COL_TYPE;
1210
+ columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
753
1211
  };
754
- declare type InfiniteTableColumnGroupHeaderRenderFunction = (params: InfiniteTableColumnGroupHeaderRenderParams) => Renderable;
755
- declare type InfiniteTableColumnGroup = {
756
- columnGroup?: string;
757
- header?: Renderable | InfiniteTableColumnGroupHeaderRenderFunction;
1212
+ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1213
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1214
+ value: string | number | Renderable;
1215
+ groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
1216
+ rowIndex: number;
1217
+ column: COL_TYPE;
1218
+ toggleCurrentGroupRow: () => void;
1219
+ toggleGroupRow: InfiniteTableToggleGroupRowFn;
1220
+ groupBy: DataSourceState<DATA_TYPE>['groupBy'];
1221
+ pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
758
1222
  };
759
- declare type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
760
- id: string;
761
- groupOffset: number;
762
- computedWidth: number;
763
- uniqueGroupId: string[];
764
- columns: string[];
765
- depth: number;
1223
+ declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & InfiniteTableRowInfoDataDiscriminator<DATA_TYPE>;
1224
+ declare type InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & {
1225
+ rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<DATA_TYPE>;
1226
+ isGroupRow: true;
1227
+ data: Partial<DATA_TYPE> | null;
766
1228
  };
767
- declare type InfiniteTableGroupColumnGetterOptions<T> = {
768
- groupIndexForColumn?: number;
769
- groupByForColumn?: DataSourceGroupBy<T>;
770
- groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
771
- groupCount: number;
772
- groupBy: DataSourceGroupBy<T>[];
773
- pivotBy?: DataSourcePivotBy<T>[];
1229
+ declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParam<DATA_TYPE> & {};
1230
+ declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> & {
1231
+ collapsed: boolean;
1232
+ groupIcon: Renderable;
774
1233
  };
775
- declare type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
1234
+ declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
1235
+ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1236
+ rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
1237
+ data: DATA_TYPE | Partial<DATA_TYPE> | null;
1238
+ dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
1239
+ rowIndex: number;
776
1240
  column: COL_TYPE;
777
- groupBy: DataSourcePropGroupBy<T>;
778
- pivotBy: DataSourcePropPivotBy<T>;
779
1241
  };
780
- declare type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
781
- declare type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
1242
+ declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1243
+ declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1244
+ declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
1245
+ declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
1246
+ declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
1247
+ declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
1248
+ declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
1249
+ declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
1250
+ /**
1251
+ * Determines the field property of the column.
1252
+ */
1253
+ field?: keyof T;
1254
+ render?: InfiniteTableColumnRenderFunction<T>;
782
1255
  renderValue?: InfiniteTableColumnRenderFunction<T>;
783
- renderGroupIcon?: InfiniteTableGroupColumnRenderIconFunction<T>;
784
- id?: string;
785
- };
786
- declare type InfiniteTablePivotColumnBase<T> = InfiniteTableColumn<T> & {
787
- renderValue?: InfiniteTableColumnRenderFunction<T, InfiniteTableComputedPivotFinalColumn<T>>;
788
- };
789
- declare type InfiniteTablePropGroupColumn<T> = InfiniteTableGroupColumnBase<T> | InfiniteTableGroupColumnFunction<T>;
790
- declare type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => Partial<InfiniteTableGroupColumnBase<T>>;
791
- declare type InfiniteTablePropPivotColumn<T, COL_TYPE = InfiniteTableColumn<T>> = Partial<InfiniteTablePivotColumnBase<T>> | ((options: InfiniteTablePivotColumnGetterOptions<T, COL_TYPE>) => InfiniteTablePivotColumnBase<T>);
792
- declare type InfiniteTablePropComponents = {
793
- LoadMask?: React$1.FC<LoadMaskProps>;
1256
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
1257
+ }, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
1258
+ declare type InfiniteTableColumnStyleFnParams<T> = {
1259
+ value: Renderable;
1260
+ column: InfiniteTableColumn<T>;
1261
+ } & InfiniteTableRowInfoDataDiscriminator<T>;
1262
+ declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
1263
+ declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
1264
+ declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
1265
+ declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
1266
+ declare type InfiniteTableColumnValueGetterParams<T> = InfiniteTableRowInfoDataDiscriminator<T>;
1267
+ declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
1268
+ declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
1269
+ declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
1270
+ declare type InfiniteTableBaseColumn<T> = {
1271
+ sortable?: boolean;
1272
+ draggable?: boolean;
1273
+ resizable?: boolean;
1274
+ comparer?: InfiniteTableColumnComparer<T>;
1275
+ defaultHiddenWhenGroupedBy?: '*' | keyof T | {
1276
+ [k in keyof Partial<T>]: true;
1277
+ };
1278
+ align?: InfiniteTableColumnAlign;
1279
+ verticalAlign?: InfiniteTableColumnVerticalAlign;
1280
+ columnGroup?: string;
1281
+ header?: InfiniteTableColumnHeader<T>;
1282
+ name?: Renderable;
1283
+ cssEllipsis?: boolean;
1284
+ headerCssEllipsis?: boolean;
1285
+ type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
1286
+ style?: InfiniteTableColumnStyle<T>;
1287
+ className?: InfiniteTableColumnClassName<T>;
1288
+ rowspan?: InfiniteTableColumnRowspanFn<T>;
1289
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
1290
+ defaultWidth?: number;
1291
+ defaultFlex?: number;
1292
+ minWidth?: number;
1293
+ maxWidth?: number;
1294
+ components?: {
1295
+ ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1296
+ HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1297
+ };
794
1298
  };
795
- declare type ScrollStopInfo = {
796
- scrollTop: number;
797
- firstVisibleRowIndex: number;
798
- lastVisibleRowIndex: number;
1299
+ /**
1300
+ * Defines a column in the table.
1301
+ *
1302
+ * @typeParam DATA_TYPE The type of the data in the table.
1303
+ *
1304
+ * Can be bound to a field which is a `keyof DATA_TYPE`.
1305
+ */
1306
+ declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
1307
+ declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
1308
+ groupByField: string | string[];
1309
+ id?: string;
799
1310
  };
800
- interface InfiniteTableProps<T> {
801
- columns: InfiniteTablePropColumns<T>;
802
- pivotColumns?: InfiniteTablePropColumnsMap<T, InfiniteTablePivotColumn<T>>;
803
- loadingText?: Renderable;
804
- components?: InfiniteTablePropComponents;
805
- viewportReservedWidth?: number;
806
- pivotColumn?: InfiniteTablePropPivotColumn<T, InfiniteTableColumn<T> & InfiniteTablePivotFinalColumn<T>>;
807
- pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
808
- pivotGrandTotalColumnPosition?: InfiniteTablePropPivotGrandTotalColumnPosition;
809
- groupColumn?: Partial<InfiniteTablePropGroupColumn<T>>;
810
- groupRenderStrategy?: InfiniteTablePropGroupRenderStrategy;
811
- hideEmptyGroupColumns?: boolean;
812
- columnVisibility?: InfiniteTablePropColumnVisibility;
813
- defaultColumnVisibility?: InfiniteTablePropColumnVisibility;
814
- pinnedStartMaxWidth?: number;
815
- pinnedEndMaxWidth?: number;
816
- columnPinning?: InfiniteTablePropColumnPinning;
817
- defaultColumnPinning?: InfiniteTablePropColumnPinning;
818
- columnSizing?: InfiniteTablePropColumnSizing;
819
- defaultColumnSizing?: InfiniteTablePropColumnSizing;
820
- onColumnSizingChange?: (columnSizing: InfiniteTablePropColumnSizing) => void;
821
- pivotColumnGroups?: InfiniteTablePropColumnGroups;
822
- columnGroups?: InfiniteTablePropColumnGroups;
823
- defaultColumnGroups?: InfiniteTablePropColumnGroups;
824
- defaultCollapsedColumnGroups?: InfiniteTablePropCollapsedColumnGroups;
825
- collapsedColumnGroups?: InfiniteTablePropCollapsedColumnGroups;
826
- onScrollbarsChange?: (scrollbars: Scrollbars) => void;
827
- onColumnVisibilityChange?: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
828
- columnTypes?: InfiniteTablePropColumnTypes<T>;
829
- showSeparatePivotColumnForSingleAggregation?: boolean;
830
- rowHeight: number | string;
831
- rowStyle?: InfiniteTablePropRowStyle<T>;
832
- rowClassName?: InfiniteTablePropRowClassName<T>;
833
- headerHeight: number | string;
834
- domProps?: React$1.HTMLProps<HTMLDivElement>;
835
- showZebraRows?: boolean;
836
- showHoverRows?: boolean;
837
- sortable?: boolean;
838
- draggableColumns?: boolean;
839
- header?: boolean;
840
- focusedClassName?: string;
841
- focusedWithinClassName?: string;
842
- focusedStyle?: React$1.CSSProperties;
843
- focusedWithinStyle?: React$1.CSSProperties;
844
- columnCssEllipsis?: boolean;
845
- columnHeaderCssEllipsis?: boolean;
846
- columnDefaultWidth?: number;
847
- columnMinWidth?: number;
848
- columnMaxWidth?: number;
849
- resizableColumns?: boolean;
850
- virtualizeColumns?: InfiniteTablePropVirtualizeColumns<T>;
851
- virtualizeRows?: boolean;
852
- defaultActiveIndex?: number;
853
- activeIndex?: number;
854
- onSelfFocus?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
855
- onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
856
- onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
857
- onBlurWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
858
- onScrollToTop?: () => void;
859
- onScrollToBottom?: () => void;
860
- scrollStopDelay?: number;
861
- onScrollStop?: (param: ScrollStopInfo) => void;
862
- scrollToBottomOffset?: number;
863
- defaultColumnOrder?: InfiniteTablePropColumnOrder;
864
- columnOrder?: InfiniteTablePropColumnOrder;
865
- onColumnOrderChange?: (columnOrder: InfiniteTablePropColumnOrder) => void;
866
- onRowHeightChange?: (rowHeight: number) => void;
867
- onReady?: (api: InfiniteTableImperativeApi<T>) => void;
868
- rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
869
- licenseKey?: string;
870
- scrollTopKey?: string | number;
871
- autoSizeColumnsKey?: InfiniteTablePropAutoSizeColumnsKey;
872
- }
873
- declare type InfiniteTablePropAutoSizeColumnsKey = string | number | {
874
- key: string | number;
875
- columnsToSkip?: string[];
876
- columnsToResize?: string[];
877
- includeHeader?: boolean;
1311
+ declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
1312
+ declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
1313
+ pivotBy: DataSourcePivotBy<DataType>[];
1314
+ pivotTotalColumnGroup?: true;
1315
+ pivotGroupKeys: KeyType[];
1316
+ pivotByAtIndex: PivotBy<DataType, KeyType>;
1317
+ pivotGroupKey: KeyType;
1318
+ pivotIndex: number;
878
1319
  };
879
- declare type Scrollbars = {
880
- vertical: boolean;
881
- horizontal: boolean;
1320
+ declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
1321
+ pivotBy: DataSourcePivotBy<DataType>[];
1322
+ pivotColumn: true;
1323
+ pivotTotalColumn: boolean;
1324
+ pivotAggregator: AggregationReducer<DataType, any>;
1325
+ pivotAggregatorIndex: number;
1326
+ pivotGroupKeys: KeyType[];
1327
+ pivotByAtIndex?: PivotBy<DataType, KeyType>;
1328
+ pivotIndex: number;
1329
+ pivotGroupKey: KeyType;
882
1330
  };
883
-
884
- declare class ScrollListener {
885
- private scrollPosition;
886
- private onScrollFns;
887
- getScrollPosition: () => ScrollPosition;
888
- onScroll: (fn: OnScrollFn) => () => void;
889
- setScrollPosition: (scrollPosition: ScrollPosition) => void;
890
- private notifyScrollChange;
891
- destroy: () => void;
892
- }
893
-
894
- interface InfiniteTableSetupState<T> {
895
- propsCache: Map<keyof InfiniteTableProps<T>, WeakMap<any, any>>;
896
- columnsWhenInlineGroupRenderStrategy?: Map<string, InfiniteTableColumn<T>>;
897
- domRef: MutableRefObject<HTMLDivElement | null>;
898
- scrollerDOMRef: MutableRefObject<HTMLDivElement | null>;
899
- portalDOMRef: MutableRefObject<HTMLDivElement | null>;
900
- onRowHeightCSSVarChange: SubscriptionCallback<number>;
901
- onHeaderHeightCSSVarChange: SubscriptionCallback<number>;
902
- columnsWhenGrouping?: InfiniteTablePropColumnsMap<T>;
903
- bodySize: Size;
904
- verticalVirtualBrain: VirtualBrain;
905
- horizontalVirtualBrain: VirtualBrain;
906
- focused: boolean;
907
- ready: boolean;
908
- focusedWithin: boolean;
909
- scrollPosition: ScrollPosition;
910
- draggingColumnId: null | string;
911
- pinnedStartScrollListener: ScrollListener;
912
- pinnedEndScrollListener: ScrollListener;
913
- columnShifts: number[] | null;
914
- }
915
- declare type InfiniteTableColumnGroupsDepthsMap = Map<string, number>;
916
- declare type InfiniteTablePropPivotTotalColumnPosition = false | 'start' | 'end';
917
- declare type InfiniteTablePropPivotGrandTotalColumnPosition = InfiniteTablePropPivotTotalColumnPosition;
918
- interface InfiniteTableMappedState<T> {
919
- scrollTopKey: InfiniteTableProps<T>['scrollTopKey'];
920
- viewportReservedWidth: InfiniteTableProps<T>['viewportReservedWidth'];
921
- groupColumn: InfiniteTableProps<T>['groupColumn'];
922
- onScrollbarsChange: InfiniteTableProps<T>['onScrollbarsChange'];
923
- loadingText: InfiniteTableProps<T>['loadingText'];
924
- components: InfiniteTableProps<T>['components'];
925
- columns: InfiniteTablePropColumnsMap<T>;
926
- pivotColumns: InfiniteTableProps<T>['pivotColumns'];
927
- onReady: InfiniteTableProps<T>['onReady'];
928
- onSelfFocus: InfiniteTableProps<T>['onSelfFocus'];
929
- onSelfBlur: InfiniteTableProps<T>['onSelfBlur'];
930
- onFocusWithin: InfiniteTableProps<T>['onFocusWithin'];
931
- onBlurWithin: InfiniteTableProps<T>['onBlurWithin'];
932
- autoSizeColumnsKey: InfiniteTableProps<T>['autoSizeColumnsKey'];
933
- scrollStopDelay: NonUndefined<InfiniteTableProps<T>['scrollStopDelay']>;
934
- onScrollToTop: InfiniteTableProps<T>['onScrollToTop'];
935
- onScrollToBottom: InfiniteTableProps<T>['onScrollToBottom'];
936
- onScrollStop: InfiniteTableProps<T>['onScrollStop'];
937
- scrollToBottomOffset: InfiniteTableProps<T>['scrollToBottomOffset'];
938
- focusedClassName: InfiniteTableProps<T>['focusedClassName'];
939
- focusedWithinClassName: InfiniteTableProps<T>['focusedWithinClassName'];
940
- focusedStyle: InfiniteTableProps<T>['focusedStyle'];
941
- focusedWithinStyle: InfiniteTableProps<T>['focusedWithinStyle'];
942
- showSeparatePivotColumnForSingleAggregation: NonUndefined<InfiniteTableProps<T>['showSeparatePivotColumnForSingleAggregation']>;
943
- domProps: InfiniteTableProps<T>['domProps'];
944
- rowStyle: InfiniteTableProps<T>['rowStyle'];
945
- rowProps: InfiniteTableProps<T>['rowProps'];
946
- rowClassName: InfiniteTableProps<T>['rowClassName'];
947
- pinnedStartMaxWidth: InfiniteTableProps<T>['pinnedStartMaxWidth'];
948
- pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
949
- pivotColumn: InfiniteTableProps<T>['pivotColumn'];
950
- pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
951
- activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
952
- columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
953
- columnMaxWidth: NonUndefined<InfiniteTableProps<T>['columnMaxWidth']>;
954
- columnDefaultWidth: NonUndefined<InfiniteTableProps<T>['columnDefaultWidth']>;
955
- columnCssEllipsis: NonUndefined<InfiniteTableProps<T>['columnCssEllipsis']>;
956
- draggableColumns: NonUndefined<InfiniteTableProps<T>['draggableColumns']>;
957
- sortable: NonUndefined<InfiniteTableProps<T>['sortable']>;
958
- hideEmptyGroupColumns: NonUndefined<InfiniteTableProps<T>['hideEmptyGroupColumns']>;
959
- columnOrder: NonUndefined<InfiniteTableProps<T>['columnOrder']>;
960
- showZebraRows: NonUndefined<InfiniteTableProps<T>['showZebraRows']>;
961
- showHoverRows: NonUndefined<InfiniteTableProps<T>['showHoverRows']>;
962
- header: NonUndefined<InfiniteTableProps<T>['header']>;
963
- virtualizeColumns: NonUndefined<InfiniteTableProps<T>['virtualizeColumns']>;
964
- rowHeight: number;
965
- headerHeight: number;
966
- licenseKey: NonUndefined<InfiniteTableProps<T>['licenseKey']>;
967
- columnVisibility: InfiniteTablePropColumnVisibility;
968
- columnPinning: InfiniteTablePropColumnPinningMap;
969
- columnSizing: InfiniteTablePropColumnSizing;
970
- columnTypes: InfiniteTablePropColumnTypes<T>;
971
- columnGroups: InfiniteTablePropColumnGroupsMap;
972
- collapsedColumnGroups: NonUndefined<InfiniteTableProps<T>['collapsedColumnGroups']>;
973
- pivotTotalColumnPosition: NonUndefined<InfiniteTableProps<T>['pivotTotalColumnPosition']>;
974
- pivotGrandTotalColumnPosition: InfiniteTableProps<T>['pivotGrandTotalColumnPosition'];
975
- }
976
- interface InfiniteTableDerivedState<T> {
977
- groupBy: DataSourceProps<T>['groupBy'];
978
- computedColumns: Map<string, InfiniteTableColumn<T>>;
979
- virtualizeHeader: boolean;
980
- groupRenderStrategy: NonUndefined<InfiniteTableProps<T>['groupRenderStrategy']>;
981
- columnHeaderCssEllipsis: NonUndefined<InfiniteTableProps<T>['columnHeaderCssEllipsis']>;
982
- columnGroupsDepthsMap: InfiniteTableColumnGroupsDepthsMap;
983
- columnGroupsMaxDepth: number;
984
- computedColumnGroups: InfiniteTablePropColumnGroupsMap;
985
- rowHeightCSSVar: string;
986
- headerHeightCSSVar: string;
987
- controlledColumnVisibility: boolean;
988
- }
989
- declare type InfiniteTableActions<T> = ComponentStateActions<InfiniteTableState<T>>;
990
- interface InfiniteTableState<T> extends InfiniteTableMappedState<T>, InfiniteTableDerivedState<T>, InfiniteTableSetupState<T> {
991
- }
992
-
993
- declare enum InfiniteTableActionType {
994
- SET_COLUMN_SIZE = 0,
995
- SET_SCROLL_POSITION = 1,
996
- SET_BODY_SIZE = 2,
997
- SET_COLUMN_ORDER = 3,
998
- SET_COLUMN_VISIBILITY = 4,
999
- SET_COLUMN_SHIFTS = 5,
1000
- SET_COLUMN_PINNING = 6,
1001
- SET_COLUMN_AGGREGATIONS = 7,
1002
- SET_DRAGGING_COLUMN_ID = 8
1003
- }
1004
-
1005
- declare type InfiniteTableAction = {
1006
- type: InfiniteTableActionType;
1007
- payload?: any;
1331
+ declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
1332
+ declare type InfiniteTableComputedColumnBase<T> = {
1333
+ computedWidth: number;
1334
+ computedOffset: number;
1335
+ computedPinningOffset: number;
1336
+ computedAbsoluteOffset: number;
1337
+ computedSortable: boolean;
1338
+ computedSortInfo: DataSourceSingleSortInfo<T> | null;
1339
+ computedSorted: boolean;
1340
+ computedSortedAsc: boolean;
1341
+ computedSortedDesc: boolean;
1342
+ computedSortIndex: number;
1343
+ computedVisibleIndex: number;
1344
+ computedMultiSort: boolean;
1345
+ computedPinned: InfiniteTableColumnPinnedValues;
1346
+ computedDraggable: boolean;
1347
+ computedFirstInCategory: boolean;
1348
+ computedLastInCategory: boolean;
1349
+ computedFirst: boolean;
1350
+ computedLast: boolean;
1351
+ toggleSort: () => void;
1352
+ id: string;
1008
1353
  };
1354
+ declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
1355
+ declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
1009
1356
 
1010
- interface InfiniteTableComputedValues<T> {
1011
- rowSpan?: VirtualBrainOptions['itemSpan'];
1012
- computedPinnedStartOverflow: boolean;
1013
- computedPinnedEndOverflow: boolean;
1014
- computedPinnedStartColumns: InfiniteTableComputedColumn<T>[];
1015
- computedPinnedEndColumns: InfiniteTableComputedColumn<T>[];
1016
- computedUnpinnedColumns: InfiniteTableComputedColumn<T>[];
1017
- computedVisibleColumns: InfiniteTableComputedColumn<T>[];
1018
- computedVisibleColumnsMap: Map<string, InfiniteTableComputedColumn<T>>;
1019
- computedColumnVisibility: InfiniteTablePropColumnVisibility;
1020
- computedColumnOrder: InfiniteTablePropColumnOrderNormalized;
1021
- computedPinnedStartColumnsWidth: number;
1022
- computedPinnedStartWidth: number;
1023
- computedPinnedEndColumnsWidth: number;
1024
- computedPinnedEndWidth: number;
1025
- computedUnpinnedColumnsWidth: number;
1026
- computedUnpinnedOffset: number;
1027
- computedPinnedEndOffset: number;
1028
- computedRemainingSpace: number;
1029
- unpinnedColumnRenderCount: number;
1030
- columnRenderStartIndex: number;
1031
- toggleGroupRow: (groupKeys: any[]) => void;
1032
- }
1033
-
1034
- interface InfiniteTableContextValue<T> {
1035
- componentState: InfiniteTableState<T>;
1036
- componentActions: InfiniteTableActions<T>;
1037
- computed: InfiniteTableComputedValues<T>;
1038
- getComputed: () => InfiniteTableComputedValues<T>;
1039
- getState: () => InfiniteTableState<T>;
1040
- }
1357
+ declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1041
1358
 
1042
1359
  declare function useInfiniteColumnCell<T>(): InfiniteTableColumnCellContextType<T>;
1043
1360
 
1044
- declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1045
-
1046
1361
  declare const InfiniteTableClassName: string;
1047
1362
  declare const InfiniteTableComponent: React$1.MemoExoticComponent<(<T>() => JSX.Element)>;
1048
1363
  declare function InfiniteTable<T>(props: InfiniteTableProps<T>): JSX.Element;
@@ -1106,6 +1421,6 @@ declare type InterceptedMapFns<K, V> = {
1106
1421
  */
1107
1422
  declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>): () => void;
1108
1423
 
1109
- declare function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
1424
+ declare function useEffectWithChanges<T>(fn: (changes: Record<keyof T, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<keyof T, any>): void;
1110
1425
 
1111
- 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, InfiniteTableColumnRenderParams as InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTableGroupColumnRenderIconFunction, 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, useInfiniteColumnCell, useInfiniteHeaderCell };
1426
+ export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, 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, InfiniteTableGroupColumnRenderIconFunction, InfiniteTableImperativeApi, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Scrollbars, debounce, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };