@infinite-table/infinite-react 0.2.0 → 0.2.4

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 (4) hide show
  1. package/index.d.ts +150 -135
  2. package/index.esm.js +497 -363
  3. package/index.js +502 -366
  4. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -199,6 +199,103 @@ declare module "components/types/SubscriptionCallback" {
199
199
  onChange: (fn: SubscriptionCallbackOnChangeFn<T>) => VoidFn;
200
200
  }
201
201
  }
202
+ declare module "components/types/Size" {
203
+ export interface Size {
204
+ width: number;
205
+ height: number;
206
+ }
207
+ export type OnResizeFn = (size: {
208
+ width: number;
209
+ height: number;
210
+ }) => void;
211
+ }
212
+ declare module "components/VirtualBrain/index" {
213
+ import { Logger } from "utils/debug";
214
+ import { Size } from "components/types/Size";
215
+ import type { OnScrollFn, ScrollPosition } from "components/types/ScrollPosition";
216
+ type MainAxisOptions = 'vertical' | 'horizontal';
217
+ export type VirtualBrainOptions = {
218
+ mainAxis: MainAxisOptions;
219
+ itemSize: MainAxisSize;
220
+ itemSpan?: ({ itemIndex }: {
221
+ itemIndex: number;
222
+ }) => number;
223
+ count: number;
224
+ name?: string;
225
+ };
226
+ export type MainAxisSize = number | ((itemIndex: number) => number);
227
+ type OnRenderCountChangeFn = (renderCount: number) => void;
228
+ type OnSizeChangeFn = (size: number) => void;
229
+ type OnDestroyFn = () => void;
230
+ export type GetItemPositionFn = (itemIndex: number) => number;
231
+ export type RenderRange = {
232
+ renderStartIndex: number;
233
+ renderEndIndex: number;
234
+ };
235
+ export type OnRenderRangeChangeFn = (renderRange: RenderRange) => void;
236
+ export class VirtualBrain extends Logger {
237
+ private scrollPosition;
238
+ private scrollPositionOnMainAxis;
239
+ private itemSpanParent;
240
+ private itemSpanValue;
241
+ private itemSizeCache;
242
+ private itemOffsetCache;
243
+ private options;
244
+ private destroyed;
245
+ private totalSize;
246
+ private onScrollFns;
247
+ private onTotalSizeChangeFns;
248
+ private onRenderCountChangeFns;
249
+ private onRenderRangeChangeFns;
250
+ private onDestroyFns;
251
+ name: string | undefined;
252
+ private renderCount;
253
+ private renderRange;
254
+ private availableSize;
255
+ constructor(options: VirtualBrainOptions);
256
+ setAvailableSize: (size: Size) => void;
257
+ getOptions(): VirtualBrainOptions;
258
+ private updateRenderCount;
259
+ private computeRenderCount;
260
+ private setRenderCount;
261
+ private updateRenderRange;
262
+ getRenderStartIndex(): number;
263
+ getRenderCount: () => number;
264
+ setScrollPosition: (scrollPosition: ScrollPosition) => void;
265
+ private notifyScrollChange;
266
+ private notifyDestroy;
267
+ private notifyTotalSizeChange;
268
+ private notifyRenderCountChange;
269
+ private notifyRenderRangeChange;
270
+ getRenderRange: () => RenderRange;
271
+ private setRenderRange;
272
+ private computeRenderRange;
273
+ getScrollPosition: () => ScrollPosition;
274
+ onScroll: (fn: OnScrollFn) => () => void;
275
+ onTotalSizeChange: (fn: OnSizeChangeFn) => () => void;
276
+ onRenderCountChange: (fn: OnRenderCountChangeFn) => () => void;
277
+ onRenderRangeChange: (fn: OnRenderRangeChangeFn) => () => void;
278
+ onDestroy: (fn: OnDestroyFn) => () => void;
279
+ update: (newCount: VirtualBrainOptions['count'], newItemSize: VirtualBrainOptions['itemSize'], newItemSpan?: VirtualBrainOptions['itemSpan']) => void;
280
+ private reset;
281
+ private computeItemSpanUpTo;
282
+ private computeCacheFor;
283
+ private getItemSizeCacheFor;
284
+ getItemSpan: (itemIndex: number) => number;
285
+ getItemSpanParent: (itemIndex: number) => number;
286
+ getItemSizeWithSpan: (itemIndex: number, itemSpan: number) => number;
287
+ /**
288
+ * For now, this doesn't take into account the itemspan, and it's okay not to
289
+ * @param itemIndex
290
+ * @returns the size of the specified item
291
+ */
292
+ getItemSize: (itemIndex: number) => number;
293
+ getTotalSize: () => number;
294
+ getItemAt: (scrollPos: number) => number;
295
+ getItemOffsetFor: (itemIndex: number) => number;
296
+ destroy: () => void;
297
+ }
298
+ }
202
299
  declare module "components/DataSource/types" {
203
300
  import * as React from 'react';
204
301
  import { MultisortInfo } from "utils/multisort/index";
@@ -211,6 +308,7 @@ declare module "components/DataSource/types" {
211
308
  import { NonUndefined } from "components/types/NonUndefined";
212
309
  import { SubscriptionCallback } from "components/types/SubscriptionCallback";
213
310
  import { ScrollStopInfo } from "components/InfiniteTable/types/InfiniteTableProps";
311
+ import { RenderRange } from "components/VirtualBrain/index";
214
312
  export interface DataSourceDataParams<T> {
215
313
  originalDataArray: T[];
216
314
  sortInfo?: DataSourceSortInfo<T>;
@@ -235,6 +333,7 @@ declare module "components/DataSource/types" {
235
333
  export type DataSourceRemoteData<T> = {
236
334
  data: T[];
237
335
  mappings?: DataSourceMappings;
336
+ cache?: boolean;
238
337
  totalCount?: number;
239
338
  livePaginationCursor?: DataSourceLivePaginationCursorValue;
240
339
  };
@@ -249,8 +348,7 @@ declare module "components/DataSource/types" {
249
348
  export interface DataSourceMappedState<T> {
250
349
  aggregationReducers?: DataSourceProps<T>['aggregationReducers'];
251
350
  livePagination: DataSourceProps<T>['livePagination'];
252
- fullLazyLoad: DataSourceProps<T>['fullLazyLoad'];
253
- lazyLoadBatchSize: DataSourceProps<T>['lazyLoadBatchSize'];
351
+ lazyLoad: DataSourceProps<T>['lazyLoad'];
254
352
  onDataParamsChange: DataSourceProps<T>['onDataParamsChange'];
255
353
  data: DataSourceProps<T>['data'];
256
354
  primaryKey: DataSourceProps<T>['primaryKey'];
@@ -282,6 +380,7 @@ declare module "components/DataSource/types" {
282
380
  export type LazyGroupRowInfo<DataType> = {
283
381
  items: LazyGroupDataItem<DataType>[];
284
382
  totalCount: number;
383
+ cache?: boolean;
285
384
  };
286
385
  export type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyGroupRowInfo<DataType>>;
287
386
  export interface DataSourceSetupState<T> {
@@ -290,8 +389,11 @@ declare module "components/DataSource/types" {
290
389
  showSeparatePivotColumnForSingleAggregation: boolean;
291
390
  dataParams?: DataSourceDataParams<T>;
292
391
  originalLazyGroupData: LazyGroupDataDeepMap<T>;
392
+ originalLazyGroupDataChangeDetect: number | string;
393
+ scrollStopDelayUpdatedByTable: number;
293
394
  notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
294
395
  notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
396
+ notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
295
397
  originalDataArray: T[];
296
398
  lastSortDataArray?: T[];
297
399
  lastGroupDataArray?: InfiniteTableRowInfo<T>[];
@@ -315,8 +417,9 @@ declare module "components/DataSource/types" {
315
417
  primaryKey: keyof T;
316
418
  fields?: (keyof T)[];
317
419
  data: DataSourceData<T>;
318
- fullLazyLoad?: boolean;
319
- lazyLoadBatchSize?: number;
420
+ lazyLoad?: boolean | {
421
+ batchSize?: number;
422
+ };
320
423
  loading?: boolean;
321
424
  defaultLoading?: boolean;
322
425
  onLoadingChange?: (loading: boolean) => void;
@@ -354,6 +457,7 @@ declare module "components/DataSource/types" {
354
457
  multiSort: boolean;
355
458
  controlledSort: boolean;
356
459
  livePaginationCursor?: DataSourceLivePaginationCursorValue;
460
+ lazyLoadBatchSize?: number;
357
461
  }
358
462
  export type DataSourceComponentActions<T> = ComponentStateActions<DataSourceState<T>>;
359
463
  export interface DataSourceContextValue<T> {
@@ -383,16 +487,24 @@ declare module "components/DataSource/publicHooks/useDataSource" {
383
487
  export function useDataSource<T>(): DataSourceState<T>;
384
488
  export function useDataSourceContextValue<T>(): DataSourceContextValue<T>;
385
489
  }
490
+ declare module "utils/getGlobal" {
491
+ export function getGlobal<T extends Window>(): T;
492
+ }
386
493
  declare module "components/hooks/useEffectWithChanges" {
387
494
  import { EffectCallback } from 'react';
388
495
  export function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
389
496
  export function useEffectWithObject(fn: EffectCallback, deps: Record<string, any>): void;
390
497
  }
498
+ declare module "components/utils/debounce" {
499
+ export function debounce(fn: Function, { wait }: {
500
+ wait: number;
501
+ }): (...args: any[]) => void;
502
+ }
391
503
  declare module "components/DataSource/privateHooks/useLoadData" {
392
504
  import { ComponentStateGeneratedActions } from "components/hooks/useComponentState";
393
505
  import { DataSourceDataParams, DataSourceData, DataSourceState } from "components/DataSource/types";
394
506
  export function buildDataSourceDataParams<T>(componentState: DataSourceState<T>, overrides?: Partial<DataSourceDataParams<T>>): DataSourceDataParams<T>;
395
- export function loadData<T>(data: DataSourceData<T>, componentState: DataSourceState<T>, actions: ComponentStateGeneratedActions<DataSourceState<T>>, overrides?: Partial<DataSourceDataParams<T>>): void;
507
+ export function loadData<T>(data: DataSourceData<T>, componentState: DataSourceState<T>, actions: ComponentStateGeneratedActions<DataSourceState<T>>, overrides?: Partial<DataSourceDataParams<T>>): Promise<any>;
396
508
  export function useLoadData<T>(): void;
397
509
  }
398
510
  declare module "components/DataSource/state/normalizeSortInfo" {
@@ -422,10 +534,13 @@ declare module "components/DataSource/state/getInitialState" {
422
534
  sortInfo: 1 | ((value: import("components/DataSource").DataSourceSortInfo<T> | undefined) => import("components/DataSource").DataSourceSingleSortInfo<T>[] | null);
423
535
  groupBy: 1 | ((value: import("components/DataSource").DataSourcePropGroupBy<T> | undefined) => import("components/DataSource").DataSourcePropGroupBy<T>);
424
536
  pivotBy: 1 | ((value: import("components/DataSource").DataSourcePropPivotBy<T> | undefined) => import("components/DataSource").DataSourcePropPivotBy<T> | undefined);
425
- lazyLoadBatchSize: 1 | ((value: number | undefined) => number | undefined);
426
537
  aggregationReducers: 1 | ((value: import("components/DataSource").DataSourcePropAggregationReducers<T> | undefined) => import("components/DataSource").DataSourcePropAggregationReducers<T> | undefined);
427
538
  livePagination: 1 | ((value: boolean | undefined) => boolean | undefined);
428
- fullLazyLoad: 1 | ((value: boolean | undefined) => boolean | undefined);
539
+ lazyLoad: 1 | ((value: boolean | {
540
+ batchSize?: number | undefined;
541
+ } | undefined) => boolean | {
542
+ batchSize?: number | undefined;
543
+ } | undefined);
429
544
  onDataParamsChange: 1 | ((value: ((dataParamsChange: DataSourceDataParams<T>) => void) | undefined) => ((dataParamsChange: DataSourceDataParams<T>) => void) | undefined);
430
545
  primaryKey: 1 | ((value: keyof T) => keyof T);
431
546
  groupRowsState: 1 | ((value: GroupRowsState<any> | undefined) => GroupRowsState<any>);
@@ -439,6 +554,7 @@ declare module "components/DataSource/state/getInitialState" {
439
554
  export function onPropChange<T>(params: {
440
555
  name: keyof T;
441
556
  newValue: any;
557
+ oldValue: any;
442
558
  }, props: DataSourceProps<T>, actions: DataSourceComponentActions<T>): void;
443
559
  export function getInterceptActions<T>(): ComponentInterceptedActions<DataSourceState<T>>;
444
560
  }
@@ -482,6 +598,7 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
482
598
  toggleCurrentGroupRow: () => void;
483
599
  toggleGroupRow: InfiniteTableToggleGroupRowFn;
484
600
  groupBy: DataSourceState<DATA_TYPE>['groupBy'];
601
+ pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
485
602
  } & ({
486
603
  rowInfo: InfiniteTableRowInfoNormal<DATA_TYPE>;
487
604
  data: DATA_TYPE;
@@ -489,6 +606,10 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
489
606
  rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
490
607
  data: Partial<DATA_TYPE> | null;
491
608
  });
609
+ export type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
610
+ collapsed: boolean;
611
+ groupIcon: Renderable;
612
+ };
492
613
  export type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
493
614
  export type InfiniteTableColumnRowspanFnParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
494
615
  rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
@@ -502,7 +623,8 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
502
623
  column: InfiniteTableComputedColumn<T>;
503
624
  columnSortInfo: DataSourceSingleSortInfo<T> | null | undefined;
504
625
  }
505
- export type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, }: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
626
+ export type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = ({ value, rowIndex, column, data, toggleGroupRow, toggleCurrentGroupRow, rowInfo, groupBy, pivotBy, }: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
627
+ export type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
506
628
  export type InfiniteTableColumnRenderValueFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE>;
507
629
  export type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderRenderParams<T>) => Renderable;
508
630
  export type InfiniteTableColumnWithField<T> = {
@@ -687,6 +809,7 @@ declare module "utils/groupAndPivot/index" {
687
809
  import { InfiniteTableColumnGroup, InfiniteTableGroupColumnBase } from "components/InfiniteTable/types/InfiniteTableProps";
688
810
  import { DeepMap } from "utils/DeepMap/index";
689
811
  export const LAZY_ROOT_KEY_FOR_GROUPS: string;
812
+ export const NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
690
813
  export type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
691
814
  id: string;
692
815
  };
@@ -747,6 +870,7 @@ declare module "utils/groupAndPivot/index" {
747
870
  export type PivotValuesDeepMap<DataType, KeyType> = DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
748
871
  export type DeepMapGroupValueType<DataType, KeyType> = {
749
872
  items: DataType[];
873
+ commonData?: Partial<DataType>;
750
874
  reducerResults: Record<string, AggregationReducerResult>;
751
875
  pivotDeepMap?: DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
752
876
  };
@@ -976,10 +1100,10 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
976
1100
  import * as React from 'react';
977
1101
  import { InfiniteTableState } from "components/InfiniteTable/types/index";
978
1102
  import { AggregationReducer, InfiniteTableRowInfoGroup, InfiniteTableRowInfoNormal } from "utils/groupAndPivot/index";
979
- import { DataSourceGroupBy, DataSourcePropGroupBy, DataSourcePropPivotBy, DataSourceState } from "components/DataSource/index";
1103
+ import { DataSourceGroupBy, DataSourcePivotBy, DataSourcePropGroupBy, DataSourcePropPivotBy, DataSourceState } from "components/DataSource/index";
980
1104
  import { Renderable } from "components/types/Renderable";
981
1105
  import { LoadMaskProps } from "components/InfiniteTable/components/LoadMask";
982
- import type { InfiniteTableColumn, InfiniteTableColumnRenderFunction, InfiniteTableComputedColumn, InfiniteTableComputedPivotFinalColumn, InfiniteTablePivotColumn, InfiniteTablePivotFinalColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
1106
+ import type { InfiniteTableColumn, InfiniteTableColumnRenderFunction, InfiniteTableComputedColumn, InfiniteTableComputedPivotFinalColumn, InfiniteTableGroupColumnRenderIconFunction, InfiniteTablePivotColumn, InfiniteTablePivotFinalColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
983
1107
  import { InfiniteTablePropPivotTotalColumnPosition } from "components/InfiniteTable/types/InfiniteTableState";
984
1108
  export type InfiniteTablePropColumnOrderNormalized = string[];
985
1109
  export type InfiniteTablePropColumnOrder = InfiniteTablePropColumnOrderNormalized | true;
@@ -1080,6 +1204,7 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
1080
1204
  groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
1081
1205
  groupCount: number;
1082
1206
  groupBy: DataSourceGroupBy<T>[];
1207
+ pivotBy?: DataSourcePivotBy<T>[];
1083
1208
  };
1084
1209
  export type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
1085
1210
  column: COL_TYPE;
@@ -1087,8 +1212,9 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
1087
1212
  pivotBy: DataSourcePropPivotBy<T>;
1088
1213
  };
1089
1214
  export type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
1090
- export type InfiniteTableGroupColumnBase<T> = InfiniteTableColumn<T> & {
1215
+ export type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
1091
1216
  renderValue?: InfiniteTableColumnRenderFunction<T>;
1217
+ renderGroupIcon?: InfiniteTableGroupColumnRenderIconFunction<T>;
1092
1218
  id?: string;
1093
1219
  };
1094
1220
  export type InfiniteTablePivotColumnBase<T> = InfiniteTableColumn<T> & {
@@ -1097,7 +1223,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
1097
1223
  export type InfiniteTablePropGroupColumn<T> = InfiniteTableGroupColumnBase<T> | InfiniteTableGroupColumnFunction<T>;
1098
1224
  export type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => Partial<InfiniteTableGroupColumnBase<T>>;
1099
1225
  export type InfiniteTablePropPivotColumn<T, COL_TYPE = InfiniteTableColumn<T>> = Partial<InfiniteTablePivotColumnBase<T>> | ((options: InfiniteTablePivotColumnGetterOptions<T, COL_TYPE>) => InfiniteTablePivotColumnBase<T>);
1100
- export type InfiniteTablePropPivotRowLabelsColumn<T> = InfiniteTablePropPivotColumn<T>;
1101
1226
  export type InfiniteTablePropComponents = {
1102
1227
  LoadMask?: React.FC<LoadMaskProps>;
1103
1228
  };
@@ -1113,7 +1238,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
1113
1238
  components?: InfiniteTablePropComponents;
1114
1239
  viewportReservedWidth?: number;
1115
1240
  pivotColumn?: InfiniteTablePropPivotColumn<T, InfiniteTableColumn<T> & InfiniteTablePivotFinalColumn<T>>;
1116
- pivotRowLabelsColumn?: InfiniteTablePropPivotRowLabelsColumn<T>;
1117
1241
  pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
1118
1242
  groupColumn?: Partial<InfiniteTablePropGroupColumn<T>>;
1119
1243
  groupRenderStrategy?: InfiniteTablePropGroupRenderStrategy;
@@ -1179,16 +1303,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
1179
1303
  horizontal: boolean;
1180
1304
  };
1181
1305
  }
1182
- declare module "components/types/Size" {
1183
- export interface Size {
1184
- width: number;
1185
- height: number;
1186
- }
1187
- export type OnResizeFn = (size: {
1188
- width: number;
1189
- height: number;
1190
- }) => void;
1191
- }
1192
1306
  declare module "components/VirtualBrain/ScrollListener" {
1193
1307
  import { OnScrollFn, ScrollPosition } from "components/types/ScrollPosition";
1194
1308
  export class ScrollListener {
@@ -1209,7 +1323,7 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
1209
1323
  import { SubscriptionCallback } from "components/types/SubscriptionCallback";
1210
1324
  import { ScrollListener } from "components/VirtualBrain/ScrollListener";
1211
1325
  import { NonUndefined } from "components/types/NonUndefined";
1212
- import { InfiniteTableColumn, InfiniteTablePivotColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
1326
+ import { InfiniteTableColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
1213
1327
  import { ComponentStateActions } from "components/hooks/useComponentState";
1214
1328
  import { DataSourceGroupBy, DataSourceProps } from "components/DataSource/types";
1215
1329
  export type GroupByMap<T> = Map<keyof T, {
@@ -1232,7 +1346,6 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
1232
1346
  draggingColumnId: null | string;
1233
1347
  pinnedStartScrollListener: ScrollListener;
1234
1348
  pinnedEndScrollListener: ScrollListener;
1235
- computedPivotColumns?: Map<string, InfiniteTablePivotColumn<T>>;
1236
1349
  columnShifts: number[] | null;
1237
1350
  }
1238
1351
  export type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
@@ -1271,7 +1384,6 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
1271
1384
  pinnedStartMaxWidth: InfiniteTableProps<T>['pinnedStartMaxWidth'];
1272
1385
  pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
1273
1386
  pivotColumn: InfiniteTableProps<T>['pivotColumn'];
1274
- pivotRowLabelsColumn: InfiniteTableProps<T>['pivotRowLabelsColumn'];
1275
1387
  pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
1276
1388
  activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
1277
1389
  columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
@@ -1354,6 +1466,7 @@ declare module "components/InfiniteTable/types/InfiniteTableComputedValues" {
1354
1466
  computedRemainingSpace: number;
1355
1467
  unpinnedColumnRenderCount: number;
1356
1468
  columnRenderStartIndex: number;
1469
+ toggleGroupRow: (groupKeys: any[]) => void;
1357
1470
  }
1358
1471
  }
1359
1472
  declare module "components/InfiniteTable/types/InfiniteTableContextValue" {
@@ -1371,12 +1484,12 @@ declare module "components/InfiniteTable/types/index" {
1371
1484
  import type { InfiniteTableState } from "components/InfiniteTable/types/InfiniteTableState";
1372
1485
  import type { InfiniteTableAction } from "components/InfiniteTable/types/InfiniteTableAction";
1373
1486
  import type { InfiniteTableActionType } from "components/InfiniteTable/types/InfiniteTableActionType";
1374
- import type { InfiniteTableProps, InfiniteTableImperativeApi, InfiniteTablePropColumnOrder, InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnAggregator, InfiniteTableColumnGroup, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropRowStyle, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTablePropRowClassName, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePropColumnSizingMap, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableColumnSizingOptions, Scrollbars, InfiniteTableGroupColumnBase } from "components/InfiniteTable/types/InfiniteTableProps";
1487
+ import type { InfiniteTableProps, InfiniteTableImperativeApi, InfiniteTablePropColumnOrder, InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnAggregator, InfiniteTableColumnGroup, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropRowStyle, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTablePropRowClassName, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTablePropComponents, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePropColumnSizingMap, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableColumnSizingOptions, Scrollbars, InfiniteTableGroupColumnBase, InfiniteTablePropGroupColumn } from "components/InfiniteTable/types/InfiniteTableProps";
1375
1488
  import type { InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam } from "components/InfiniteTable/types/InfiniteTableColumn";
1376
1489
  import type { InfiniteTableComputedValues } from "components/InfiniteTable/types/InfiniteTableComputedValues";
1377
1490
  import type { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
1378
1491
  import type { InfiniteTableRowInfo } from "utils/groupAndPivot/index";
1379
- export type { Scrollbars, InfiniteTableColumnAggregator, InfiniteTableComputedValues, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTableRowInfo, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnBase, InfiniteTablePropColumnOrder, InfiniteTablePropComponents, InfiniteTablePropColumnVisibility as InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnGroup, InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableContextValue, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropColumnSizing, InfiniteTablePropColumnSizingMap, InfiniteTableColumnSizingOptions, InfiniteTableState, InfiniteTableAction, InfiniteTableProps, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableImperativeApi, InfiniteTableActionType, InfiniteTablePropRowStyle, InfiniteTablePropRowClassName, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTableGroupColumnGetterOptions, };
1492
+ export type { Scrollbars, InfiniteTableColumnAggregator, InfiniteTableComputedValues, InfiniteTablePropColumns, InfiniteTablePropGroupColumn, InfiniteTablePropColumnsMap, InfiniteTableRowInfo, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnBase, InfiniteTablePropColumnOrder, InfiniteTablePropComponents, InfiniteTablePropColumnVisibility as InfiniteTablePropColumnVisibility, InfiniteTablePropColumnPinning, InfiniteTableColumnGroup, InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableContextValue, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropColumnGroups, InfiniteTablePropColumnSizing, InfiniteTablePropColumnSizingMap, InfiniteTableColumnSizingOptions, InfiniteTableState, InfiniteTableAction, InfiniteTableProps, InfiniteTablePropColumnTypes, InfiniteTablePropColumnTypesMap, InfiniteTableImperativeApi, InfiniteTableActionType, InfiniteTablePropRowStyle, InfiniteTablePropRowClassName, InfiniteTableRowStyleFn, InfiniteTableRowClassNameFn, InfiniteTableGroupColumnGetterOptions, };
1380
1493
  }
1381
1494
  declare module "components/InfiniteTable/InfiniteTableContext" {
1382
1495
  import { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
@@ -1413,7 +1526,6 @@ declare module "components/InfiniteTable/state/getInitialState" {
1413
1526
  components: 1 | ((value: import("components/InfiniteTable/types").InfiniteTablePropComponents | undefined) => import("components/InfiniteTable/types").InfiniteTablePropComponents | undefined);
1414
1527
  loadingText: 1 | ((value: import("react").ReactNode) => import("react").ReactNode);
1415
1528
  viewportReservedWidth: 1 | ((value: number | undefined) => number | undefined);
1416
- pivotRowLabelsColumn: 1 | ((value: import("components/InfiniteTable/types/InfiniteTableProps").InfiniteTablePropPivotRowLabelsColumn<T> | undefined) => import("components/InfiniteTable/types/InfiniteTableProps").InfiniteTablePropPivotRowLabelsColumn<T> | undefined);
1417
1529
  groupColumn: 1 | ((value: Partial<InfiniteTablePropGroupColumn<T>> | undefined) => Partial<InfiniteTablePropGroupColumn<T>> | undefined);
1418
1530
  hideEmptyGroupColumns: 1 | ((value: boolean | undefined) => boolean);
1419
1531
  columnVisibility: 1 | ((value: import("components/InfiniteTable/types").InfiniteTablePropColumnVisibility | undefined) => import("components/InfiniteTable/types").InfiniteTablePropColumnVisibility);
@@ -1535,9 +1647,6 @@ declare module "components/InfiniteTable/utils/adjustColumnOrderForPinning" {
1535
1647
  import { InfiniteTablePropColumnOrderNormalized, InfiniteTablePropColumnPinningMap } from "components/InfiniteTable/types/InfiniteTableProps";
1536
1648
  export const adjustColumnOrderForPinning: (columnOrder: InfiniteTablePropColumnOrderNormalized, columnPinning: InfiniteTablePropColumnPinningMap) => InfiniteTablePropColumnOrderNormalized;
1537
1649
  }
1538
- declare module "utils/getGlobal" {
1539
- export function getGlobal<T extends Window>(): T;
1540
- }
1541
1650
  declare module "components/utils/getScrollbarWidth" {
1542
1651
  export function getScrollbarWidth(): number;
1543
1652
  }
@@ -1730,19 +1839,6 @@ declare module "components/InfiniteTable/components/InfiniteTableRow/row.css" {
1730
1839
  }>;
1731
1840
  export const GroupRowExpanderCls: string;
1732
1841
  }
1733
- declare module "components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns" {
1734
- import { DataSourcePropGroupBy, DataSourcePropPivotBy } from "components/DataSource/index";
1735
- import { InfiniteTableProps } from "components/InfiniteTable/types/index";
1736
- import { InfiniteTableState } from "components/InfiniteTable/types/InfiniteTableState";
1737
- export function getComputedPivotColumnsFromDataSourcePivotColumns<T>(pivotColumns: InfiniteTableProps<T>['pivotColumns'], params: {
1738
- toggleGroupRow: (groupKeys: any[]) => void;
1739
- pivotColumn: InfiniteTableProps<T>['pivotColumn'];
1740
- pivotRowLabelsColumn: InfiniteTableProps<T>['pivotRowLabelsColumn'];
1741
- pivotTotalColumnPosition: InfiniteTableState<T>['pivotTotalColumnPosition'];
1742
- pivotBy: DataSourcePropPivotBy<T>;
1743
- groupBy: DataSourcePropGroupBy<T>;
1744
- }): InfiniteTableProps<T>['pivotColumns'];
1745
- }
1746
1842
  declare module "components/InfiniteTable/utils/getColumnForGroupBy" {
1747
1843
  import * as React from 'react';
1748
1844
  import { InfiniteTableColumnRenderParam } from "components/InfiniteTable/index";
@@ -1765,17 +1861,23 @@ declare module "components/InfiniteTable/hooks/useToggleGroupRow" {
1765
1861
  export function useToggleGroupRow<T>(): ToggleGrouRowFn;
1766
1862
  }
1767
1863
  declare module "components/InfiniteTable/hooks/useColumnsWhen" {
1768
- import type { InfiniteTableColumn } from "components/InfiniteTable/index";
1769
- import type { DataSourceGroupBy } from "components/DataSource/index";
1864
+ import type { InfiniteTableColumn, InfiniteTableState } from "components/InfiniteTable/index";
1865
+ import type { DataSourceGroupBy, DataSourcePivotBy } from "components/DataSource/index";
1770
1866
  import type { InfiniteTablePropGroupRenderStrategy, InfiniteTableProps } from "components/InfiniteTable/types/InfiniteTableProps";
1771
- export function useColumnsWhen<T>(): void;
1867
+ import { ToggleGrouRowFn } from "components/InfiniteTable/hooks/useToggleGroupRow";
1868
+ export function useColumnsWhen<T>(): {
1869
+ toggleGroupRow: ToggleGrouRowFn;
1870
+ };
1772
1871
  export function getColumnsWhenGrouping<T>(params: {
1773
1872
  columns: Map<string, InfiniteTableColumn<T>>;
1774
1873
  groupBy: DataSourceGroupBy<T>[];
1874
+ pivotBy?: DataSourcePivotBy<T>[];
1775
1875
  toggleGroupRow: (groupKeys: any[]) => void;
1876
+ pivotTotalColumnPosition: InfiniteTableState<T>['pivotTotalColumnPosition'];
1776
1877
  groupColumn: InfiniteTableProps<T>['groupColumn'];
1777
1878
  groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
1778
1879
  pivotColumns: InfiniteTableProps<T>['pivotColumns'];
1880
+ pivotColumn: InfiniteTableProps<T>['pivotColumn'];
1779
1881
  }): Map<string, InfiniteTableColumn<T>> | undefined;
1780
1882
  }
1781
1883
  declare module "components/InfiniteTable/hooks/useComputed" {
@@ -1797,93 +1899,6 @@ declare module "components/InfiniteTable/components/InfiniteTableBody/InfiniteTa
1797
1899
  declare module "components/InfiniteTable/components/InfiniteTableBody/index" {
1798
1900
  export * from "components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody";
1799
1901
  }
1800
- declare module "components/VirtualBrain/index" {
1801
- import { Logger } from "utils/debug";
1802
- import { Size } from "components/types/Size";
1803
- import type { OnScrollFn, ScrollPosition } from "components/types/ScrollPosition";
1804
- type MainAxisOptions = 'vertical' | 'horizontal';
1805
- export type VirtualBrainOptions = {
1806
- mainAxis: MainAxisOptions;
1807
- itemSize: MainAxisSize;
1808
- itemSpan?: ({ itemIndex }: {
1809
- itemIndex: number;
1810
- }) => number;
1811
- count: number;
1812
- name?: string;
1813
- };
1814
- export type MainAxisSize = number | ((itemIndex: number) => number);
1815
- type OnRenderCountChangeFn = (renderCount: number) => void;
1816
- type OnSizeChangeFn = (size: number) => void;
1817
- type OnDestroyFn = () => void;
1818
- export type GetItemPositionFn = (itemIndex: number) => number;
1819
- export type RenderRange = {
1820
- renderStartIndex: number;
1821
- renderEndIndex: number;
1822
- };
1823
- export type OnRenderRangeChangeFn = (renderRange: RenderRange) => void;
1824
- export class VirtualBrain extends Logger {
1825
- private scrollPosition;
1826
- private scrollPositionOnMainAxis;
1827
- private itemSpanParent;
1828
- private itemSpanValue;
1829
- private itemSizeCache;
1830
- private itemOffsetCache;
1831
- private options;
1832
- private destroyed;
1833
- private totalSize;
1834
- private onScrollFns;
1835
- private onTotalSizeChangeFns;
1836
- private onRenderCountChangeFns;
1837
- private onRenderRangeChangeFns;
1838
- private onDestroyFns;
1839
- name: string | undefined;
1840
- private renderCount;
1841
- private renderRange;
1842
- private availableSize;
1843
- constructor(options: VirtualBrainOptions);
1844
- setAvailableSize: (size: Size) => void;
1845
- getOptions(): VirtualBrainOptions;
1846
- private updateRenderCount;
1847
- private computeRenderCount;
1848
- private setRenderCount;
1849
- private updateRenderRange;
1850
- getRenderStartIndex(): number;
1851
- getRenderCount: () => number;
1852
- setScrollPosition: (scrollPosition: ScrollPosition) => void;
1853
- private notifyScrollChange;
1854
- private notifyDestroy;
1855
- private notifyTotalSizeChange;
1856
- private notifyRenderCountChange;
1857
- private notifyRenderRangeChange;
1858
- getRenderRange: () => RenderRange;
1859
- private setRenderRange;
1860
- private computeRenderRange;
1861
- getScrollPosition: () => ScrollPosition;
1862
- onScroll: (fn: OnScrollFn) => () => void;
1863
- onTotalSizeChange: (fn: OnSizeChangeFn) => () => void;
1864
- onRenderCountChange: (fn: OnRenderCountChangeFn) => () => void;
1865
- onRenderRangeChange: (fn: OnRenderRangeChangeFn) => () => void;
1866
- onDestroy: (fn: OnDestroyFn) => () => void;
1867
- update: (newCount: VirtualBrainOptions['count'], newItemSize: VirtualBrainOptions['itemSize'], newItemSpan?: VirtualBrainOptions['itemSpan']) => void;
1868
- private reset;
1869
- private computeItemSpanUpTo;
1870
- private computeCacheFor;
1871
- private getItemSizeCacheFor;
1872
- getItemSpan: (itemIndex: number) => number;
1873
- getItemSpanParent: (itemIndex: number) => number;
1874
- getItemSizeWithSpan: (itemIndex: number, itemSpan: number) => number;
1875
- /**
1876
- * For now, this doesn't take into account the itemspan, and it's okay not to
1877
- * @param itemIndex
1878
- * @returns the size of the specified item
1879
- */
1880
- getItemSize: (itemIndex: number) => number;
1881
- getTotalSize: () => number;
1882
- getItemAt: (scrollPos: number) => number;
1883
- getItemOffsetFor: (itemIndex: number) => number;
1884
- destroy: () => void;
1885
- }
1886
- }
1887
1902
  declare module "components/InfiniteTable/components/ScrollbarPlaceholder" {
1888
1903
  import * as React from 'react';
1889
1904
  function HorizontalScrollbarPlaceholderFn(props: {