@infinite-table/infinite-react 0.2.19 → 0.3.0

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 -710
  3. package/index.esm.css +187 -169
  4. package/index.esm.js +7335 -6974
  5. package/index.js +7413 -7025
  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,652 @@ 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
+ groupBy?: (keyof T)[];
511
+ } & InfiniteTableRowInfoDataDiscriminator<T>;
512
+ declare type InfiniteTableRowStyleFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => undefined | React$1.CSSProperties;
513
+ declare type InfiniteTableRowClassNameFn<T> = (params: InfiniteTableRowStyleFnParams<T>) => string | undefined;
514
+ declare type InfiniteTablePropRowStyle<T> = React$1.CSSProperties | InfiniteTableRowStyleFn<T>;
515
+ declare type InfiniteTablePropRowClassName<T> = string | InfiniteTableRowClassNameFn<T>;
516
+ declare type InfiniteTableColumnAggregator<T, AggregationResultType> = Omit<AggregationReducer<T, AggregationResultType>, 'getter' | 'id'> & {
517
+ getter?: AggregationReducer<T, AggregationResultType>['getter'];
518
+ field?: keyof T;
519
+ };
520
+ declare type InfiniteTableColumnType<T> = {
521
+ minWidth?: number;
522
+ maxWidth?: number;
340
523
  defaultWidth?: number;
341
524
  defaultFlex?: number;
525
+ defaultPinned?: InfiniteTableColumnPinnedValues;
526
+ defaultHiddenWhenGroupedBy?: InfiniteTableColumn<T>['defaultHiddenWhenGroupedBy'];
527
+ header?: InfiniteTableColumn<T>['header'];
528
+ comparer?: InfiniteTableColumn<T>['comparer'];
529
+ draggable?: InfiniteTableColumn<T>['draggable'];
530
+ sortable?: InfiniteTableColumn<T>['sortable'];
531
+ resizable?: InfiniteTableColumn<T>['resizable'];
532
+ align?: InfiniteTableColumn<T>['align'];
533
+ verticalAlign?: InfiniteTableColumn<T>['verticalAlign'];
534
+ cssEllipsis?: boolean;
535
+ headerCssEllipsis?: boolean;
536
+ components?: InfiniteTableColumn<T>['components'];
537
+ renderValue?: InfiniteTableColumn<T>['renderValue'];
538
+ render?: InfiniteTableColumn<T>['render'];
539
+ valueGetter?: InfiniteTableColumn<T>['valueGetter'];
540
+ style?: InfiniteTableColumn<T>['style'];
541
+ };
542
+ declare type InfiniteTablePropColumnTypes<T> = Record<'default' | string, InfiniteTableColumnType<T>>;
543
+ declare type InfiniteTableColumnSizingOptions = {
544
+ flex?: number;
545
+ width?: number;
342
546
  minWidth?: number;
343
547
  maxWidth?: number;
344
- components?: {
345
- ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
346
- HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
347
- };
348
548
  };
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;
549
+ declare type InfiniteTablePropColumnSizing = Record<string, InfiniteTableColumnSizingOptions>;
550
+ declare type InfiniteTableImperativeApi<T> = {
551
+ setColumnOrder: (columnOrder: InfiniteTablePropColumnOrder) => void;
552
+ setColumnVisibility: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
553
+ x?: T;
554
+ getState: () => InfiniteTableState<T>;
555
+ getDataSourceState: () => DataSourceState<T>;
360
556
  };
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;
557
+ declare type InfiniteTablePropVirtualizeColumns<T> = boolean | ((columns: InfiniteTableComputedColumn<T>[]) => boolean);
558
+ declare type InfiniteTablePropColumnsMap<T, ColumnType = InfiniteTableColumn<T>> = Map<string, ColumnType>;
559
+ declare type InfiniteTablePropColumns<T, ColumnType = InfiniteTableColumn<T>> = InfiniteTablePropColumnsMap<T, ColumnType> | Record<string, ColumnType>;
560
+ declare type InfiniteTablePropColumnGroupsMap = Map<string, InfiniteTableColumnGroup>;
561
+ declare type InfiniteTablePropColumnGroupsRecord = Record<string, InfiniteTableColumnGroup>;
562
+ declare type InfiniteTablePropColumnGroups = InfiniteTablePropColumnGroupsRecord | InfiniteTablePropColumnGroupsMap;
563
+ declare type InfiniteTablePropCollapsedColumnGroups = Map<string[], string>;
564
+ declare type InfiniteTableColumnGroupHeaderRenderParams = {
565
+ columnGroup: InfiniteTableComputedColumnGroup;
369
566
  };
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;
567
+ declare type InfiniteTableColumnGroupHeaderRenderFunction = (params: InfiniteTableColumnGroupHeaderRenderParams) => Renderable;
568
+ declare type InfiniteTableColumnGroup = {
569
+ columnGroup?: string;
570
+ header?: Renderable | InfiniteTableColumnGroupHeaderRenderFunction;
380
571
  };
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;
572
+ declare type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
402
573
  id: string;
574
+ groupOffset: number;
575
+ computedWidth: number;
576
+ uniqueGroupId: string[];
577
+ columns: string[];
578
+ depth: number;
403
579
  };
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;
580
+ declare type InfiniteTableGroupColumnGetterOptions<T> = {
581
+ groupIndexForColumn?: number;
582
+ groupByForColumn?: DataSourceGroupBy<T>;
583
+ groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
584
+ groupCount: number;
585
+ groupBy: DataSourceGroupBy<T>[];
586
+ pivotBy?: DataSourcePivotBy<T>[];
587
+ };
588
+ declare type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
589
+ column: COL_TYPE;
590
+ groupBy: DataSourcePropGroupBy<T>;
591
+ pivotBy: DataSourcePropPivotBy<T>;
592
+ };
593
+ declare type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
594
+ declare type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
595
+ renderValue?: InfiniteTableColumnRenderFunction<T>;
596
+ renderGroupIcon?: InfiniteTableGroupColumnRenderIconFunction<T>;
597
+ id?: string;
598
+ };
599
+ declare type InfiniteTablePivotColumnBase<T> = InfiniteTableColumn<T> & {
600
+ renderValue?: InfiniteTableColumnRenderFunction<T, InfiniteTableComputedPivotFinalColumn<T>>;
601
+ };
602
+ declare type InfiniteTablePropGroupColumn<T> = InfiniteTableGroupColumnBase<T> | InfiniteTableGroupColumnFunction<T>;
603
+ declare type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => Partial<InfiniteTableGroupColumnBase<T>>;
604
+ declare type InfiniteTablePropPivotColumn<T, COL_TYPE = InfiniteTableColumn<T>> = Partial<InfiniteTablePivotColumnBase<T>> | ((options: InfiniteTablePivotColumnGetterOptions<T, COL_TYPE>) => InfiniteTablePivotColumnBase<T>);
605
+ declare type InfiniteTablePropComponents = {
606
+ LoadMask?: React$1.FC<LoadMaskProps>;
607
+ };
608
+ declare type ScrollStopInfo = {
609
+ scrollTop: number;
610
+ firstVisibleRowIndex: number;
611
+ lastVisibleRowIndex: number;
612
+ };
613
+ interface InfiniteTableProps<T> {
614
+ columns: InfiniteTablePropColumns<T>;
615
+ pivotColumns?: InfiniteTablePropColumnsMap<T, InfiniteTablePivotColumn<T>>;
616
+ loadingText?: Renderable;
617
+ components?: InfiniteTablePropComponents;
618
+ viewportReservedWidth?: number;
619
+ pivotColumn?: InfiniteTablePropPivotColumn<T, InfiniteTableColumn<T> & InfiniteTablePivotFinalColumn<T>>;
620
+ pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
621
+ pivotGrandTotalColumnPosition?: InfiniteTablePropPivotGrandTotalColumnPosition;
622
+ groupColumn?: Partial<InfiniteTablePropGroupColumn<T>>;
623
+ groupRenderStrategy?: InfiniteTablePropGroupRenderStrategy;
624
+ hideEmptyGroupColumns?: boolean;
625
+ columnVisibility?: InfiniteTablePropColumnVisibility;
626
+ defaultColumnVisibility?: InfiniteTablePropColumnVisibility;
627
+ pinnedStartMaxWidth?: number;
628
+ pinnedEndMaxWidth?: number;
629
+ columnPinning?: InfiniteTablePropColumnPinning;
630
+ defaultColumnPinning?: InfiniteTablePropColumnPinning;
631
+ columnSizing?: InfiniteTablePropColumnSizing;
632
+ defaultColumnSizing?: InfiniteTablePropColumnSizing;
633
+ onColumnSizingChange?: (columnSizing: InfiniteTablePropColumnSizing) => void;
634
+ pivotColumnGroups?: InfiniteTablePropColumnGroups;
635
+ columnGroups?: InfiniteTablePropColumnGroups;
636
+ defaultColumnGroups?: InfiniteTablePropColumnGroups;
637
+ defaultCollapsedColumnGroups?: InfiniteTablePropCollapsedColumnGroups;
638
+ collapsedColumnGroups?: InfiniteTablePropCollapsedColumnGroups;
639
+ onScrollbarsChange?: (scrollbars: Scrollbars) => void;
640
+ onColumnVisibilityChange?: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
641
+ columnTypes?: InfiniteTablePropColumnTypes<T>;
642
+ showSeparatePivotColumnForSingleAggregation?: boolean;
643
+ rowHeight: number | string;
644
+ rowStyle?: InfiniteTablePropRowStyle<T>;
645
+ rowClassName?: InfiniteTablePropRowClassName<T>;
646
+ headerHeight: number | string;
647
+ domProps?: React$1.HTMLProps<HTMLDivElement>;
648
+ showZebraRows?: boolean;
649
+ showHoverRows?: boolean;
650
+ sortable?: boolean;
651
+ draggableColumns?: boolean;
652
+ header?: boolean;
653
+ focusedClassName?: string;
654
+ focusedWithinClassName?: string;
655
+ focusedStyle?: React$1.CSSProperties;
656
+ focusedWithinStyle?: React$1.CSSProperties;
657
+ columnCssEllipsis?: boolean;
658
+ columnHeaderCssEllipsis?: boolean;
659
+ columnDefaultWidth?: number;
660
+ columnMinWidth?: number;
661
+ columnMaxWidth?: number;
662
+ resizableColumns?: boolean;
663
+ virtualizeColumns?: InfiniteTablePropVirtualizeColumns<T>;
664
+ virtualizeRows?: boolean;
665
+ defaultActiveIndex?: number;
666
+ activeIndex?: number;
667
+ onSelfFocus?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
668
+ onSelfBlur?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
669
+ onFocusWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
670
+ onBlurWithin?: (event: React$1.FocusEvent<HTMLDivElement>) => void;
671
+ onScrollToTop?: () => void;
672
+ onScrollToBottom?: () => void;
673
+ scrollStopDelay?: number;
674
+ onScrollStop?: (param: ScrollStopInfo) => void;
675
+ scrollToBottomOffset?: number;
676
+ defaultColumnOrder?: InfiniteTablePropColumnOrder;
677
+ columnOrder?: InfiniteTablePropColumnOrder;
678
+ onColumnOrderChange?: (columnOrder: InfiniteTablePropColumnOrder) => void;
679
+ onRowHeightChange?: (rowHeight: number) => void;
680
+ onReady?: (api: InfiniteTableImperativeApi<T>) => void;
681
+ rowProps?: React$1.HTMLProps<HTMLDivElement> | ((rowArgs: InfiniteTableRowStyleFnParams<T>) => React$1.HTMLProps<HTMLDivElement>);
682
+ licenseKey?: string;
683
+ scrollTopKey?: string | number;
684
+ autoSizeColumnsKey?: InfiniteTablePropAutoSizeColumnsKey;
685
+ }
686
+ declare type InfiniteTablePropAutoSizeColumnsKey = string | number | {
687
+ key: string | number;
688
+ columnsToSkip?: string[];
689
+ columnsToResize?: string[];
690
+ includeHeader?: boolean;
691
+ };
692
+ declare type Scrollbars = {
693
+ vertical: boolean;
694
+ horizontal: boolean;
695
+ };
696
+
697
+ interface InfiniteTableComputedValues<T> {
698
+ scrollbars: {
699
+ vertical: boolean;
700
+ horizontal: boolean;
701
+ };
702
+ rowspan?: MatrixBrainOptions['rowspan'];
703
+ computedPinnedStartOverflow: boolean;
704
+ computedPinnedEndOverflow: boolean;
705
+ computedPinnedStartColumns: InfiniteTableComputedColumn<T>[];
706
+ computedPinnedEndColumns: InfiniteTableComputedColumn<T>[];
707
+ computedUnpinnedColumns: InfiniteTableComputedColumn<T>[];
708
+ computedVisibleColumns: InfiniteTableComputedColumn<T>[];
709
+ computedVisibleColumnsMap: Map<string, InfiniteTableComputedColumn<T>>;
710
+ computedColumnVisibility: InfiniteTablePropColumnVisibility;
711
+ computedColumnOrder: InfiniteTablePropColumnOrderNormalized;
712
+ computedPinnedStartColumnsWidth: number;
713
+ computedPinnedStartWidth: number;
714
+ computedPinnedEndColumnsWidth: number;
715
+ computedPinnedEndWidth: number;
716
+ computedUnpinnedColumnsWidth: number;
717
+ computedUnpinnedOffset: number;
718
+ computedPinnedEndOffset: number;
719
+ computedRemainingSpace: number;
720
+ toggleGroupRow: (groupKeys: any[]) => void;
721
+ columnSize: (colIndex: number) => number;
722
+ }
723
+
724
+ interface InfiniteTableContextValue<T> {
725
+ componentState: InfiniteTableState<T>;
726
+ componentActions: InfiniteTableActions<T>;
727
+ computed: InfiniteTableComputedValues<T>;
728
+ getComputed: () => InfiniteTableComputedValues<T>;
729
+ getState: () => InfiniteTableState<T>;
730
+ }
731
+
732
+ declare type RenderRange = {
733
+ renderStartIndex: number;
734
+ renderEndIndex: number;
735
+ };
736
+
737
+ interface DataSourceDataParams<T> {
738
+ originalDataArray: T[];
739
+ sortInfo?: DataSourceSortInfo<T>;
740
+ groupBy?: DataSourcePropGroupBy<T>;
741
+ pivotBy?: DataSourcePropPivotBy<T>;
742
+ groupRowsState?: DataSourcePropGroupRowsStateObject<any>;
743
+ lazyLoadBatchSize?: number;
744
+ lazyLoadStartIndex?: number;
745
+ groupKeys?: any[];
746
+ append?: boolean;
747
+ aggregationReducers?: DataSourcePropAggregationReducers<T>;
748
+ livePaginationCursor?: DataSourceLivePaginationCursorValue;
749
+ __cursorId?: DataSourceSetupState<T>['cursorId'];
750
+ changes?: DataSourceDataParamsChanges<T>;
751
+ }
752
+ declare type DataSourceDataParamsChanges<T> = Partial<Record<keyof Omit<DataSourceDataParams<T>, 'originalDataArray' | 'changes'>, true>>;
753
+ declare type DataSourceSingleSortInfo<T> = MultisortInfo<T> & {
754
+ field?: keyof T;
755
+ id?: string;
424
756
  };
425
757
  declare type DataSourceGroupBy<T> = GroupBy<T, any>;
426
758
  declare type DataSourcePivotBy<T> = PivotBy<T, any>;
427
759
  declare type DataSourceSortInfo<T> = null | DataSourceSingleSortInfo<T> | DataSourceSingleSortInfo<T>[];
428
760
  declare type DataSourceRemoteData<T> = {
429
- data: T[];
761
+ data: T[] | LazyGroupDataItem<T>[];
430
762
  mappings?: DataSourceMappings;
431
763
  cache?: boolean;
432
764
  totalCount?: number;
@@ -434,7 +766,7 @@ declare type DataSourceRemoteData<T> = {
434
766
  };
435
767
  declare type DataSourceData<T> = T[] | DataSourceRemoteData<T> | Promise<T[] | DataSourceRemoteData<T>> | ((dataInfo: DataSourceDataParams<T>) => T[] | Promise<T[] | DataSourceRemoteData<T>>);
436
768
  declare type DataSourceGroupRowsList<KeyType> = true | KeyType[][];
437
- declare type DataSourceExpandedAndCollapsedGroupRows<KeyType> = {
769
+ declare type DataSourcePropGroupRowsStateObject<KeyType> = {
438
770
  expandedRows: DataSourceGroupRowsList<KeyType>;
439
771
  collapsedRows: DataSourceGroupRowsList<KeyType>;
440
772
  };
@@ -448,7 +780,7 @@ interface DataSourceMappedState<T> {
448
780
  data: DataSourceProps<T>['data'];
449
781
  primaryKey: DataSourceProps<T>['primaryKey'];
450
782
  groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
451
- groupRowsState: NonUndefined<DataSourceProps<T>['groupRowsState']>;
783
+ groupRowsState: GroupRowsState<T>;
452
784
  pivotBy: DataSourceProps<T>['pivotBy'];
453
785
  loading: NonUndefined<DataSourceProps<T>['loading']>;
454
786
  collapseGroupRowsOnDataFunctionChange: NonUndefined<DataSourceProps<T>['collapseGroupRowsOnDataFunctionChange']>;
@@ -473,18 +805,26 @@ declare type LazyGroupDataItem<DataType> = {
473
805
  data: Partial<DataType>;
474
806
  keys: any[];
475
807
  aggregations?: Record<string, any>;
808
+ dataset?: DataSourceRemoteData<DataType>;
476
809
  pivot?: {
477
810
  values: Record<string, any>;
478
811
  totals?: Record<string, any>;
479
812
  };
480
813
  };
481
- declare type LazyGroupRowInfo<DataType> = {
482
- items: LazyGroupDataItem<DataType>[];
814
+ declare type LazyRowInfoGroup<DataType> = {
815
+ /**
816
+ * Those are direct children of the current lazy group row
817
+ */
818
+ children: LazyGroupDataItem<DataType>[];
819
+ childrenLoading: boolean;
820
+ childrenAvailable: boolean;
821
+ cache: boolean;
483
822
  totalCount: number;
484
- cache?: boolean;
823
+ error?: string;
485
824
  };
486
- declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyGroupRowInfo<DataType>>;
825
+ declare type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyRowInfoGroup<DataType>>;
487
826
  interface DataSourceSetupState<T> {
827
+ lazyLoadCacheOfLoadedBatches: DeepMap<string, true>;
488
828
  pivotMappings?: DataSourceMappings;
489
829
  propsCache: Map<keyof DataSourceProps<T>, WeakMap<any, any>>;
490
830
  showSeparatePivotColumnForSingleAggregation: boolean;
@@ -502,7 +842,7 @@ interface DataSourceSetupState<T> {
502
842
  groupDeepMap?: DeepMap<GroupKeyType, DeepMapGroupValueType<T, any>>;
503
843
  pivotTotalColumnPosition: InfiniteTablePropPivotTotalColumnPosition;
504
844
  pivotGrandTotalColumnPosition: InfiniteTablePropPivotGrandTotalColumnPosition;
505
- cursorId: number | Symbol | DataSourceLivePaginationCursorValue;
845
+ cursorId: number | symbol | DataSourceLivePaginationCursorValue;
506
846
  updatedAt: number;
507
847
  reducedAt: number;
508
848
  groupedAt: number;
@@ -533,8 +873,8 @@ declare type DataSourceProps<T> = {
533
873
  groupBy?: DataSourcePropGroupBy<T>;
534
874
  defaultGroupBy?: DataSourcePropGroupBy<T>;
535
875
  onGroupByChange?: (groupBy: DataSourcePropGroupBy<T>) => void;
536
- groupRowsState?: GroupRowsState;
537
- defaultGroupRowsState?: GroupRowsState;
876
+ groupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<any>;
877
+ defaultGroupRowsState?: GroupRowsState | DataSourcePropGroupRowsStateObject<keyof T>;
538
878
  onGroupRowsStateChange?: (groupRowsState: GroupRowsState) => void;
539
879
  collapseGroupRowsOnDataFunctionChange?: boolean;
540
880
  sortInfo?: DataSourceSortInfo<T>;
@@ -578,6 +918,28 @@ interface DataSourceReducer<T> {
578
918
  (state: DataSourceState<T>, action: DataSourceAction<any>): DataSourceState<T>;
579
919
  }
580
920
 
921
+ declare class GroupRowsState<KeyType extends any = any> {
922
+ private expandedMap?;
923
+ private collapsedMap?;
924
+ private collapsedAll;
925
+ private expandedAll;
926
+ private initialState;
927
+ constructor(state: DataSourcePropGroupRowsStateObject<KeyType> | GroupRowsState<KeyType>);
928
+ getState(): DataSourcePropGroupRowsStateObject<KeyType>;
929
+ destroy(): void;
930
+ private update;
931
+ areAllCollapsed(): boolean;
932
+ areAllExpanded(): boolean;
933
+ collapseAll(): void;
934
+ expandAll(): void;
935
+ isGroupRowExpanded(keys: KeyType[]): boolean | undefined;
936
+ isGroupRowCollapsed(keys: KeyType[]): boolean;
937
+ setGroupRowExpanded(keys: KeyType[], shouldExpand: boolean): void;
938
+ collapseGroupRow(keys: KeyType[]): void;
939
+ expandGroupRow(keys: KeyType[]): void;
940
+ toggleGroupRow(keys: KeyType[]): void;
941
+ }
942
+
581
943
  declare type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
582
944
  id: string;
583
945
  };
@@ -585,51 +947,191 @@ declare type AggregationReducerResult<AggregationResultType extends any = any> =
585
947
  value: AggregationResultType;
586
948
  id: string;
587
949
  };
588
- declare type InfiniteTableRowInfoNormalType<DataType> = {
589
- data: DataType;
950
+ /**
951
+ * InfiniteTableRowInfo can have different object shape depending on the presence or absence of grouping.
952
+ *
953
+ * You can use `dataSourceHasGrouping: boolean` as a discriminator to determine the shape of the object, to know
954
+ * if the dataSource had grouping or not. Furthermore, for when the dataSource has grouping,
955
+ * you can use `isGroupRow: boolean` to discriminate between group rows vs normal rows.
956
+ *
957
+ */
958
+ declare type InfiniteTableRowInfo<T> = InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T> | InfiniteTable_NoGrouping_RowInfoNormal<T>;
959
+ declare type InfiniteTableRowInfoDataDiscriminator<T> = {
960
+ data: T;
590
961
  isGroupRow: false;
591
- };
592
- declare type InfiniteTableRowInfoGroupType<DataType> = {
593
- data: Partial<DataType> | null;
962
+ rowInfo: InfiniteTable_NoGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoNormal<T>;
963
+ } | {
964
+ data: Partial<T> | null;
965
+ rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<T>;
594
966
  isGroupRow: true;
595
967
  };
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> = {
968
+ /**
969
+ * This is the base row info for all scenarios - things every
970
+ * rowInfo is guaranteed to have (be it group or normal row, or dataSource with or without grouping)
971
+ *
972
+ */
973
+ declare type InfiniteTable_RowInfoBase<_T> = {
600
974
  id: any;
601
975
  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
976
  indexInAll: number;
613
- groupCount?: number;
614
- groupBy?: (keyof T)[];
615
- rootGroupBy?: (keyof T)[];
616
- pivotValuesMap?: PivotValuesDeepMap<T, any>;
617
- reducerResults?: Record<string, AggregationReducerResult>;
977
+ indexInGroup: number;
618
978
  };
619
- declare type InfiniteTableEnhancedGroupInfo<T> = InfiniteTableRowInfo<T> & {
979
+ declare type InfiniteTable_HasGrouping_RowInfoNormal<T> = {
980
+ dataSourceHasGrouping: true;
981
+ data: T;
982
+ isGroupRow: false;
983
+ } & InfiniteTable_HasGrouping_RowInfoBase<T> & InfiniteTable_RowInfoBase<T>;
984
+ declare type InfiniteTable_HasGrouping_RowInfoGroup<T> = {
985
+ dataSourceHasGrouping: true;
620
986
  data: Partial<T> | null;
621
- groupData: T[];
622
- flatRowInfoList: (InfiniteTableRowInfo<T> | InfiniteTableEnhancedGroupInfo<T>)[];
623
- value: any;
624
987
  isGroupRow: true;
988
+ /**
989
+ * This array contains all the (uncollapsed, so visible) row infos under this group, at any level of nesting,
990
+ * in the order in which they are visible in the table
991
+ */
992
+ deepRowInfoArray: (InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T>)[];
993
+ reducerResults?: Record<string, AggregationReducerResult>;
994
+ /**
995
+ * The count of all leaf nodes (normal rows) that are inside this group.
996
+ * This count is the same as the length of the groupData array property.
997
+ */
998
+ groupCount: number;
999
+ /**
1000
+ * The array of all leaf nodes (normal rows) that are inside this group.
1001
+ */
1002
+ groupData: T[];
1003
+ /**
1004
+ * The count of all leaf nodes (normal rows) inside the group that are not being visible
1005
+ * due to collapsing (either the current row is collapsed or any of its children)
1006
+ */
625
1007
  collapsedChildrenCount: number;
626
1008
  collapsedGroupsCount: number;
627
- groupNesting: number;
628
- groupKeys?: any[];
629
- groupCount: number;
1009
+ /**
1010
+ * The count of the direct children of the current group. Direct children can be either normal rows or groups.
1011
+ */
1012
+ directChildrenCount: number;
1013
+ directChildrenLoadedCount: number;
1014
+ /**
1015
+ *
1016
+ * A DeepMap of pivot values.
1017
+ *
1018
+ * For each pivot reducer result, it contains all the items that make up the pivot value.
1019
+ *
1020
+ */
1021
+ pivotValuesMap?: PivotValuesDeepMap<T, any>;
1022
+ /**
1023
+ * For non-lazy grouping, this is always true.
1024
+ * 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),
1025
+ * 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.
1026
+ *
1027
+ * NOTE: if this is true, it doesn't mean that (all or some of) the children have been loaded, it only means that at least some children have been requested.
1028
+ *
1029
+ * Use directChildrenCount and directChildrenLoadedCount to know if all the children have been loaded or not.
1030
+ */
1031
+ childrenAvailable: boolean;
1032
+ /**
1033
+ * Boolean flag that will be true while lazy loading direct children of the current row group.
1034
+ *
1035
+ * NOTE: with batched loading, if the user is no longer scrolling, after everything
1036
+ * in the viewport has loaded (and thus for example a certain row group had childrenLoading: true)
1037
+ * if no new batches are being loaded, childrenLoading will be false again, even though
1038
+ * the current row group still has children that are not loaded yet.
1039
+ * Use directChildrenLoadedCount and directChildrenCount to know if all the children have been loaded or not.
1040
+ */
1041
+ childrenLoading: boolean;
1042
+ } & InfiniteTable_HasGrouping_RowInfoBase<T> & InfiniteTable_RowInfoBase<T>;
1043
+ declare type InfiniteTable_NoGrouping_RowInfoNormal<T> = {
1044
+ dataSourceHasGrouping: false;
1045
+ data: T;
1046
+ isGroupRow: false;
1047
+ selfLoaded: boolean;
1048
+ } & InfiniteTable_RowInfoBase<T>;
1049
+ declare type InfiniteTable_HasGrouping_RowInfoBase<T> = {
1050
+ /**
1051
+ * Available on all rowInfo objects when the datasource is grouped, otherwise, it will be undefined.
1052
+ *
1053
+ * For group rows, the group keys will have all the keys starting from the topmost parent
1054
+ * down to the current group row (including the group row).
1055
+ * For normal rows, the group keys will have all the keys starting from the topmost parent
1056
+ * down to the last group row in the hierarchy (the direct parent of the current row).
1057
+ *
1058
+ * Example: People grouped by country and city
1059
+ *
1060
+ * Italy - country - groupKeys: ['Italy']
1061
+ * Rome - city - groupKeys: ['Italy', 'Rome']
1062
+ * Marco - person - groupKeys: ['Italy', 'Rome']
1063
+ * Luca - person - groupKeys: ['Italy', 'Rome']
1064
+ * Giuseppe - person - groupKeys: ['Italy', 'Rome']
1065
+ *
1066
+ */
1067
+ groupKeys: any[];
1068
+ /**
1069
+ * Available on all rowInfo objects when the datasource is grouped, otherwise, it will be undefined.
1070
+ *
1071
+ * Has the same structure as groupKeys, but it will contain the fields used to group the rows.
1072
+ *
1073
+ * Example: People grouped by country and city
1074
+ *
1075
+ * Italy - country - groupKeys: ['country']
1076
+ * Rome - city - groupKeys: ['country', 'city']
1077
+ * Marco - person - groupKeys: ['country', 'city']
1078
+ * Luca - person - groupKeys: ['country', 'city']
1079
+ * Giuseppe - person - groupKeys: ['country', 'city']
1080
+ */
630
1081
  groupBy: (keyof T)[];
1082
+ /**
1083
+ * The groupBy value of the DataSource component, mapped to the groupBy.field
1084
+ */
631
1085
  rootGroupBy: (keyof T)[];
632
- pivotValuesMap?: PivotValuesDeepMap<T, any>;
1086
+ /**
1087
+ * Available on all rowInfo objects when the datasource is grouped.
1088
+ *
1089
+ * Italy - country - parent mapped to their ids will be: [] // rowInfo.parents.map((p: any) => p.id)
1090
+ * Rome - city - parent mapped to their ids will be: ['Italy']
1091
+ * Marco - person - parent mapped to their ids will be: ['Italy','Italy,Rome']
1092
+ * Luca - person - parent mapped to their ids will be: ['Italy','Italy,Rome']
1093
+ * Giuseppe - person - parent mapped to their ids will be: ['Italy','Italy,Rome']
1094
+ * USA - country - parent mapped to their ids will be: []
1095
+ * LA - city - parent mapped to their ids will be: ['USA']
1096
+ * Bob - person - parent mapped to their ids will be: ['USA','USA,LA']
1097
+ */
1098
+ parents: InfiniteTable_HasGrouping_RowInfoGroup<T>[];
1099
+ /**
1100
+ * Available when the datasource is grouped, this will be set for both group and normal rows.
1101
+ * Italy - country - indexInParentGroups: [0]
1102
+ * Rome - city - indexInParentGroups: [0,0]
1103
+ * Marco - person - indexInParentGroups: [0,0,0]
1104
+ * Luca - person - indexInParentGroups: [0,0,1]
1105
+ * Giuseppe - person - indexInParentGroups: [0,0,2]
1106
+ * USA - country - indexInParentGroups: [1]
1107
+ * LA - city - indexInParentGroups: [1,0]
1108
+ * Bob - person - indexInParentGroups: [1,0,2]
1109
+ */
1110
+ indexInParentGroups: number[];
1111
+ /**
1112
+ * Available on all rowInfo objects when the datasource is grouped.
1113
+ *
1114
+ * For every rowInfo object, it counts the number of leaf/normal rows that the group contains.
1115
+ * For normal rows, the groupCount represents the groupCount of the direct parent.
1116
+ *
1117
+ * Italy - country - groupCount: 3
1118
+ * Rome - city - groupCount: 2
1119
+ * Marco - person - groupCount: 2
1120
+ * Luca - person - groupCount: 2
1121
+ * Napoli - city - groupCount: 1
1122
+ * Giuseppe - person - groupCount: 1
1123
+ * USA - country - groupCount: 1
1124
+ * LA - city - groupCount: 1
1125
+ * Bob - person - groupCount: 1
1126
+ */
1127
+ groupCount: number;
1128
+ groupNesting: number;
1129
+ collapsed: boolean;
1130
+ /**
1131
+ * This is false only when the DataSource is configured with lazy batching and the current
1132
+ * row has not been loaded yet. It has nothing to do with children, only with self.
1133
+ */
1134
+ selfLoaded: boolean;
633
1135
  };
634
1136
  declare type GroupKeyType<T extends any = any> = T;
635
1137
  declare type PivotReducerResults<T = any> = Record<string, AggregationReducerResult<T>>;
@@ -639,8 +1141,15 @@ declare type PivotGroupValueType<DataType, KeyType> = {
639
1141
  };
640
1142
  declare type PivotValuesDeepMap<DataType, KeyType> = DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
641
1143
  declare type DeepMapGroupValueType<DataType, KeyType> = {
1144
+ /**
1145
+ * These are leaf items. This array may be empty when there is batched lazy loading
1146
+ */
642
1147
  items: DataType[];
643
1148
  commonData?: Partial<DataType>;
1149
+ childrenLoading: boolean;
1150
+ childrenAvailable: boolean;
1151
+ cache: boolean;
1152
+ error?: string;
644
1153
  reducerResults: Record<string, AggregationReducerResult>;
645
1154
  pivotDeepMap?: DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
646
1155
  };
@@ -674,375 +1183,182 @@ declare type DataGroupResult<DataType, KeyType extends any> = {
674
1183
  declare function group<DataType, KeyType = any>(groupParams: GroupParams<DataType, KeyType>, data: DataType[]): DataGroupResult<DataType, KeyType>;
675
1184
  declare function flatten<DataType, KeyType extends any>(groupResult: DataGroupResult<DataType, KeyType>): DataType[];
676
1185
 
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'];
1186
+ declare type InfiniteTableCellProps<T> = {
1187
+ column: InfiniteTableComputedColumn<T>;
1188
+ renderChildren: () => Renderable;
1189
+ width: number;
721
1190
  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>;
1191
+ virtualized?: boolean;
1192
+ skipColumnShifting?: boolean;
1193
+ beforeChildren?: Renderable;
1194
+ afterChildren?: Renderable;
1195
+ offset?: number;
1196
+ offsetProperty?: 'left' | 'right';
1197
+ cssPosition?: CSSProperties['position'];
1198
+ domRef?: React.RefCallback<HTMLElement>;
1199
+ cellType: 'body' | 'header';
743
1200
  };
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;
1201
+
1202
+ declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
1203
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
1204
+ }[Keys];
1205
+
1206
+ declare type InfiniteTableToggleGroupRowFn = (groupKeys: any[]) => void;
1207
+ declare type InfiniteTableColumnHeaderParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1208
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1209
+ sortTool: JSX.Element;
1210
+ column: COL_TYPE;
1211
+ columnSortInfo: DataSourceSingleSortInfo<DATA_TYPE> | null;
753
1212
  };
754
- declare type InfiniteTableColumnGroupHeaderRenderFunction = (params: InfiniteTableColumnGroupHeaderRenderParams) => Renderable;
755
- declare type InfiniteTableColumnGroup = {
756
- columnGroup?: string;
757
- header?: Renderable | InfiniteTableColumnGroupHeaderRenderFunction;
1213
+ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1214
+ domRef: InfiniteTableCellProps<DATA_TYPE>['domRef'];
1215
+ value: string | number | Renderable;
1216
+ groupRowInfo: InfiniteTableRowInfo<DATA_TYPE> | null;
1217
+ rowIndex: number;
1218
+ column: COL_TYPE;
1219
+ toggleCurrentGroupRow: () => void;
1220
+ toggleGroupRow: InfiniteTableToggleGroupRowFn;
1221
+ groupBy: DataSourceState<DATA_TYPE>['groupBy'];
1222
+ pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
758
1223
  };
759
- declare type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
760
- id: string;
761
- groupOffset: number;
762
- computedWidth: number;
763
- uniqueGroupId: string[];
764
- columns: string[];
765
- depth: number;
1224
+ declare type InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & InfiniteTableRowInfoDataDiscriminator<DATA_TYPE>;
1225
+ declare type InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> = InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE> & {
1226
+ rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<DATA_TYPE>;
1227
+ isGroupRow: true;
1228
+ data: Partial<DATA_TYPE> | null;
766
1229
  };
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>[];
1230
+ declare type InfiniteTableColumnCellContextType<DATA_TYPE> = InfiniteTableColumnRenderParam<DATA_TYPE> & {};
1231
+ declare type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableGroupColumnRenderParams<DATA_TYPE, COL_TYPE> & {
1232
+ collapsed: boolean;
1233
+ groupIcon: Renderable;
774
1234
  };
775
- declare type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
1235
+ declare type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
1236
+ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
1237
+ rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
1238
+ data: DATA_TYPE | Partial<DATA_TYPE> | null;
1239
+ dataArray: InfiniteTableRowInfo<DATA_TYPE>[];
1240
+ rowIndex: number;
776
1241
  column: COL_TYPE;
777
- groupBy: DataSourcePropGroupBy<T>;
778
- pivotBy: DataSourcePropPivotBy<T>;
779
1242
  };
780
- declare type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
781
- declare type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
1243
+ declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1244
+ declare type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
1245
+ declare type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderParams<T>) => Renderable;
1246
+ declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
1247
+ declare type InfiniteTableColumnVerticalAlign = 'start' | 'center' | 'end';
1248
+ declare type InfiniteTableColumnHeader<T> = Renderable | InfiniteTableColumnHeaderRenderFunction<T>;
1249
+ declare type InfiniteTableColumnTypeNames = 'string' | 'number' | 'date' | string;
1250
+ declare type InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<T> = RequireAtLeastOne<{
1251
+ /**
1252
+ * Determines the field property of the column.
1253
+ */
1254
+ field?: keyof T;
1255
+ render?: InfiniteTableColumnRenderFunction<T>;
782
1256
  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>;
1257
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
1258
+ }, 'render' | 'renderValue' | 'field' | 'valueGetter'>;
1259
+ declare type InfiniteTableColumnStyleFnParams<T> = {
1260
+ value: Renderable;
1261
+ column: InfiniteTableColumn<T>;
1262
+ } & InfiniteTableRowInfoDataDiscriminator<T>;
1263
+ declare type InfiniteTableColumnStyleFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | React.CSSProperties;
1264
+ declare type InfiniteTableColumnClassNameFn<T> = (params: InfiniteTableColumnStyleFnParams<T>) => undefined | string;
1265
+ declare type InfiniteTableColumnStyle<T> = CSSProperties | InfiniteTableColumnStyleFn<T>;
1266
+ declare type InfiniteTableColumnClassName<T> = string | InfiniteTableColumnClassNameFn<T>;
1267
+ declare type InfiniteTableColumnValueGetterParams<T> = InfiniteTableRowInfoDataDiscriminator<T>;
1268
+ declare type InfiniteTableColumnValueGetter<T, VALUE_GETTER_TYPE = string | number | boolean | null | undefined> = (params: InfiniteTableColumnValueGetterParams<T>) => VALUE_GETTER_TYPE;
1269
+ declare type InfiniteTableColumnRowspanFn<T> = (params: InfiniteTableColumnRowspanParam<T>) => number;
1270
+ declare type InfiniteTableColumnComparer<T> = (a: T, b: T) => number;
1271
+ declare type InfiniteTableBaseColumn<T> = {
1272
+ sortable?: boolean;
1273
+ draggable?: boolean;
1274
+ resizable?: boolean;
1275
+ comparer?: InfiniteTableColumnComparer<T>;
1276
+ defaultHiddenWhenGroupedBy?: '*' | keyof T | {
1277
+ [k in keyof Partial<T>]: true;
1278
+ };
1279
+ align?: InfiniteTableColumnAlign;
1280
+ verticalAlign?: InfiniteTableColumnVerticalAlign;
1281
+ columnGroup?: string;
1282
+ header?: InfiniteTableColumnHeader<T>;
1283
+ name?: Renderable;
1284
+ cssEllipsis?: boolean;
1285
+ headerCssEllipsis?: boolean;
1286
+ type?: InfiniteTableColumnTypeNames | InfiniteTableColumnTypeNames[] | null;
1287
+ style?: InfiniteTableColumnStyle<T>;
1288
+ className?: InfiniteTableColumnClassName<T>;
1289
+ rowspan?: InfiniteTableColumnRowspanFn<T>;
1290
+ valueGetter?: InfiniteTableColumnValueGetter<T>;
1291
+ defaultWidth?: number;
1292
+ defaultFlex?: number;
1293
+ minWidth?: number;
1294
+ maxWidth?: number;
1295
+ components?: {
1296
+ ColumnCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1297
+ HeaderCell?: React.FunctionComponent<HTMLProps<HTMLDivElement>>;
1298
+ };
794
1299
  };
795
- declare type ScrollStopInfo = {
796
- scrollTop: number;
797
- firstVisibleRowIndex: number;
798
- lastVisibleRowIndex: number;
1300
+ /**
1301
+ * Defines a column in the table.
1302
+ *
1303
+ * @typeParam DATA_TYPE The type of the data in the table.
1304
+ *
1305
+ * Can be bound to a field which is a `keyof DATA_TYPE`.
1306
+ */
1307
+ declare type InfiniteTableColumn<DATA_TYPE> = {} & InfiniteTableBaseColumn<DATA_TYPE> & InfiniteTableColumnWithRenderOrRenderValueOrFieldOrValueGetter<DATA_TYPE>;
1308
+ declare type InfiniteTableGeneratedGroupColumn<T> = InfiniteTableColumn<T> & {
1309
+ groupByField: string | string[];
1310
+ id?: string;
799
1311
  };
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;
1312
+ declare type InfiniteTablePivotColumn<T> = InfiniteTableColumn<T> & ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnVariant<T, any>>>;
1313
+ declare type InfiniteTablePivotFinalColumnGroup<DataType, KeyType extends any = any> = InfiniteTableColumnGroup & {
1314
+ pivotBy: DataSourcePivotBy<DataType>[];
1315
+ pivotTotalColumnGroup?: true;
1316
+ pivotGroupKeys: KeyType[];
1317
+ pivotByAtIndex: PivotBy<DataType, KeyType>;
1318
+ pivotGroupKey: KeyType;
1319
+ pivotIndex: number;
878
1320
  };
879
- declare type Scrollbars = {
880
- vertical: boolean;
881
- horizontal: boolean;
1321
+ declare type InfiniteTablePivotFinalColumn<DataType, KeyType extends any = any> = InfiniteTableColumn<DataType> & {
1322
+ pivotBy: DataSourcePivotBy<DataType>[];
1323
+ pivotColumn: true;
1324
+ pivotTotalColumn: boolean;
1325
+ pivotAggregator: AggregationReducer<DataType, any>;
1326
+ pivotAggregatorIndex: number;
1327
+ pivotGroupKeys: KeyType[];
1328
+ pivotByAtIndex?: PivotBy<DataType, KeyType>;
1329
+ pivotIndex: number;
1330
+ pivotGroupKey: KeyType;
882
1331
  };
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;
1332
+ declare type InfiniteTablePivotFinalColumnVariant<DataType, KeyType extends any = any> = InfiniteTablePivotFinalColumn<DataType, KeyType>;
1333
+ declare type InfiniteTableComputedColumnBase<T> = {
1334
+ computedWidth: number;
1335
+ computedOffset: number;
1336
+ computedPinningOffset: number;
1337
+ computedAbsoluteOffset: number;
1338
+ computedSortable: boolean;
1339
+ computedSortInfo: DataSourceSingleSortInfo<T> | null;
1340
+ computedSorted: boolean;
1341
+ computedSortedAsc: boolean;
1342
+ computedSortedDesc: boolean;
1343
+ computedSortIndex: number;
1344
+ computedVisibleIndex: number;
1345
+ computedMultiSort: boolean;
1346
+ computedPinned: InfiniteTableColumnPinnedValues;
1347
+ computedDraggable: boolean;
1348
+ computedFirstInCategory: boolean;
1349
+ computedLastInCategory: boolean;
1350
+ computedFirst: boolean;
1351
+ computedLast: boolean;
1352
+ toggleSort: () => void;
1353
+ id: string;
1008
1354
  };
1355
+ declare type InfiniteTableComputedColumn<T> = InfiniteTableColumn<T> & InfiniteTableComputedColumnBase<T> & Partial<InfiniteTablePivotFinalColumn<T>> & Partial<InfiniteTableGeneratedGroupColumn<T>>;
1356
+ declare type InfiniteTableComputedPivotFinalColumn<T> = InfiniteTableComputedColumn<T> & InfiniteTablePivotFinalColumn<T>;
1009
1357
 
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
- }
1358
+ declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1041
1359
 
1042
1360
  declare function useInfiniteColumnCell<T>(): InfiniteTableColumnCellContextType<T>;
1043
1361
 
1044
- declare function useInfiniteHeaderCell<T>(): InfiniteTableColumnHeaderParams<T, InfiniteTableComputedColumn<T>>;
1045
-
1046
1362
  declare const InfiniteTableClassName: string;
1047
1363
  declare const InfiniteTableComponent: React$1.MemoExoticComponent<(<T>() => JSX.Element)>;
1048
1364
  declare function InfiniteTable<T>(props: InfiniteTableProps<T>): JSX.Element;
@@ -1106,6 +1422,6 @@ declare type InterceptedMapFns<K, V> = {
1106
1422
  */
1107
1423
  declare function interceptMap<K, V>(map: Map<K, V>, fns: InterceptedMapFns<K, V>): () => void;
1108
1424
 
1109
- declare function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
1425
+ declare function useEffectWithChanges<T>(fn: (changes: Record<keyof T, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<keyof T, any>): void;
1110
1426
 
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 };
1427
+ 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 };