@infinite-table/infinite-react 0.1.3 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +141 -130
- package/index.esm.js +440 -340
- package/index.js +445 -343
- 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
|
};
|
|
@@ -282,6 +381,7 @@ declare module "components/DataSource/types" {
|
|
|
282
381
|
export type LazyGroupRowInfo<DataType> = {
|
|
283
382
|
items: LazyGroupDataItem<DataType>[];
|
|
284
383
|
totalCount: number;
|
|
384
|
+
cache?: boolean;
|
|
285
385
|
};
|
|
286
386
|
export type LazyGroupDataDeepMap<DataType, KeyType = string> = DeepMap<KeyType, LazyGroupRowInfo<DataType>>;
|
|
287
387
|
export interface DataSourceSetupState<T> {
|
|
@@ -290,8 +390,11 @@ declare module "components/DataSource/types" {
|
|
|
290
390
|
showSeparatePivotColumnForSingleAggregation: boolean;
|
|
291
391
|
dataParams?: DataSourceDataParams<T>;
|
|
292
392
|
originalLazyGroupData: LazyGroupDataDeepMap<T>;
|
|
393
|
+
originalLazyGroupDataChangeDetect: number | string;
|
|
394
|
+
scrollStopDelayUpdatedByTable: number;
|
|
293
395
|
notifyScrollbarsChange: SubscriptionCallback<Scrollbars>;
|
|
294
396
|
notifyScrollStop: SubscriptionCallback<ScrollStopInfo>;
|
|
397
|
+
notifyRenderRangeChange: SubscriptionCallback<RenderRange>;
|
|
295
398
|
originalDataArray: T[];
|
|
296
399
|
lastSortDataArray?: T[];
|
|
297
400
|
lastGroupDataArray?: InfiniteTableRowInfo<T>[];
|
|
@@ -383,16 +486,24 @@ declare module "components/DataSource/publicHooks/useDataSource" {
|
|
|
383
486
|
export function useDataSource<T>(): DataSourceState<T>;
|
|
384
487
|
export function useDataSourceContextValue<T>(): DataSourceContextValue<T>;
|
|
385
488
|
}
|
|
489
|
+
declare module "utils/getGlobal" {
|
|
490
|
+
export function getGlobal<T extends Window>(): T;
|
|
491
|
+
}
|
|
386
492
|
declare module "components/hooks/useEffectWithChanges" {
|
|
387
493
|
import { EffectCallback } from 'react';
|
|
388
494
|
export function useEffectWithChanges(fn: (changes: Record<string, any>, prevValues: Record<string, any>) => void | (() => void), deps: Record<string, any>): void;
|
|
389
495
|
export function useEffectWithObject(fn: EffectCallback, deps: Record<string, any>): void;
|
|
390
496
|
}
|
|
497
|
+
declare module "components/utils/debounce" {
|
|
498
|
+
export function debounce(fn: Function, { wait }: {
|
|
499
|
+
wait: number;
|
|
500
|
+
}): (...args: any[]) => void;
|
|
501
|
+
}
|
|
391
502
|
declare module "components/DataSource/privateHooks/useLoadData" {
|
|
392
503
|
import { ComponentStateGeneratedActions } from "components/hooks/useComponentState";
|
|
393
504
|
import { DataSourceDataParams, DataSourceData, DataSourceState } from "components/DataSource/types";
|
|
394
505
|
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>>):
|
|
506
|
+
export function loadData<T>(data: DataSourceData<T>, componentState: DataSourceState<T>, actions: ComponentStateGeneratedActions<DataSourceState<T>>, overrides?: Partial<DataSourceDataParams<T>>): Promise<any>;
|
|
396
507
|
export function useLoadData<T>(): void;
|
|
397
508
|
}
|
|
398
509
|
declare module "components/DataSource/state/normalizeSortInfo" {
|
|
@@ -482,6 +593,7 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
|
|
|
482
593
|
toggleCurrentGroupRow: () => void;
|
|
483
594
|
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
484
595
|
groupBy: DataSourceState<DATA_TYPE>['groupBy'];
|
|
596
|
+
pivotBy?: DataSourceState<DATA_TYPE>['pivotBy'];
|
|
485
597
|
} & ({
|
|
486
598
|
rowInfo: InfiniteTableRowInfoNormal<DATA_TYPE>;
|
|
487
599
|
data: DATA_TYPE;
|
|
@@ -489,6 +601,10 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
|
|
|
489
601
|
rowInfo: InfiniteTableRowInfoGroup<DATA_TYPE>;
|
|
490
602
|
data: Partial<DATA_TYPE> | null;
|
|
491
603
|
});
|
|
604
|
+
export type InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
|
|
605
|
+
collapsed: boolean;
|
|
606
|
+
groupIcon: Renderable;
|
|
607
|
+
};
|
|
492
608
|
export type InfiniteTableColumnRenderValueParam<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>;
|
|
493
609
|
export type InfiniteTableColumnRowspanFnParams<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = {
|
|
494
610
|
rowInfo: InfiniteTableRowInfo<DATA_TYPE>;
|
|
@@ -502,7 +618,8 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
|
|
|
502
618
|
column: InfiniteTableComputedColumn<T>;
|
|
503
619
|
columnSortInfo: DataSourceSingleSortInfo<T> | null | undefined;
|
|
504
620
|
}
|
|
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;
|
|
621
|
+
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;
|
|
622
|
+
export type InfiniteTableGroupColumnRenderIconFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (param: InfiniteTableGroupColumnRenderIconParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
|
|
506
623
|
export type InfiniteTableColumnRenderValueFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE>;
|
|
507
624
|
export type InfiniteTableColumnHeaderRenderFunction<T> = ({ columnSortInfo, column, }: InfiniteTableColumnHeaderRenderParams<T>) => Renderable;
|
|
508
625
|
export type InfiniteTableColumnWithField<T> = {
|
|
@@ -687,6 +804,7 @@ declare module "utils/groupAndPivot/index" {
|
|
|
687
804
|
import { InfiniteTableColumnGroup, InfiniteTableGroupColumnBase } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
688
805
|
import { DeepMap } from "utils/DeepMap/index";
|
|
689
806
|
export const LAZY_ROOT_KEY_FOR_GROUPS: string;
|
|
807
|
+
export const NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
|
|
690
808
|
export type AggregationReducer<T, AggregationResultType = any> = DataSourceAggregationReducer<T, AggregationResultType> & {
|
|
691
809
|
id: string;
|
|
692
810
|
};
|
|
@@ -720,6 +838,7 @@ declare module "utils/groupAndPivot/index" {
|
|
|
720
838
|
indexInAll: number;
|
|
721
839
|
groupCount?: number;
|
|
722
840
|
groupBy?: (keyof T)[];
|
|
841
|
+
rootGroupBy?: (keyof T)[];
|
|
723
842
|
pivotValuesMap?: PivotValuesDeepMap<T, any>;
|
|
724
843
|
reducerResults?: Record<string, AggregationReducerResult>;
|
|
725
844
|
};
|
|
@@ -734,6 +853,7 @@ declare module "utils/groupAndPivot/index" {
|
|
|
734
853
|
groupKeys?: any[];
|
|
735
854
|
groupCount: number;
|
|
736
855
|
groupBy: (keyof T)[];
|
|
856
|
+
rootGroupBy: (keyof T)[];
|
|
737
857
|
pivotValuesMap?: PivotValuesDeepMap<T, any>;
|
|
738
858
|
};
|
|
739
859
|
export type GroupKeyType<T extends any = any> = T;
|
|
@@ -974,10 +1094,10 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
974
1094
|
import * as React from 'react';
|
|
975
1095
|
import { InfiniteTableState } from "components/InfiniteTable/types/index";
|
|
976
1096
|
import { AggregationReducer, InfiniteTableRowInfoGroup, InfiniteTableRowInfoNormal } from "utils/groupAndPivot/index";
|
|
977
|
-
import { DataSourceGroupBy, DataSourcePropGroupBy, DataSourcePropPivotBy, DataSourceState } from "components/DataSource/index";
|
|
1097
|
+
import { DataSourceGroupBy, DataSourcePivotBy, DataSourcePropGroupBy, DataSourcePropPivotBy, DataSourceState } from "components/DataSource/index";
|
|
978
1098
|
import { Renderable } from "components/types/Renderable";
|
|
979
1099
|
import { LoadMaskProps } from "components/InfiniteTable/components/LoadMask";
|
|
980
|
-
import type { InfiniteTableColumn, InfiniteTableColumnRenderFunction, InfiniteTableComputedColumn, InfiniteTableComputedPivotFinalColumn, InfiniteTablePivotColumn, InfiniteTablePivotFinalColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1100
|
+
import type { InfiniteTableColumn, InfiniteTableColumnRenderFunction, InfiniteTableComputedColumn, InfiniteTableComputedPivotFinalColumn, InfiniteTableGroupColumnRenderIconFunction, InfiniteTablePivotColumn, InfiniteTablePivotFinalColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
981
1101
|
import { InfiniteTablePropPivotTotalColumnPosition } from "components/InfiniteTable/types/InfiniteTableState";
|
|
982
1102
|
export type InfiniteTablePropColumnOrderNormalized = string[];
|
|
983
1103
|
export type InfiniteTablePropColumnOrder = InfiniteTablePropColumnOrderNormalized | true;
|
|
@@ -1078,6 +1198,7 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1078
1198
|
groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
|
|
1079
1199
|
groupCount: number;
|
|
1080
1200
|
groupBy: DataSourceGroupBy<T>[];
|
|
1201
|
+
pivotBy?: DataSourcePivotBy<T>[];
|
|
1081
1202
|
};
|
|
1082
1203
|
export type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
|
|
1083
1204
|
column: COL_TYPE;
|
|
@@ -1085,17 +1206,17 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1085
1206
|
pivotBy: DataSourcePropPivotBy<T>;
|
|
1086
1207
|
};
|
|
1087
1208
|
export type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
|
|
1088
|
-
export type InfiniteTableGroupColumnBase<T> = InfiniteTableColumn<T
|
|
1209
|
+
export type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
|
|
1089
1210
|
renderValue?: InfiniteTableColumnRenderFunction<T>;
|
|
1211
|
+
renderGroupIcon?: InfiniteTableGroupColumnRenderIconFunction<T>;
|
|
1090
1212
|
id?: string;
|
|
1091
1213
|
};
|
|
1092
1214
|
export type InfiniteTablePivotColumnBase<T> = InfiniteTableColumn<T> & {
|
|
1093
1215
|
renderValue?: InfiniteTableColumnRenderFunction<T, InfiniteTableComputedPivotFinalColumn<T>>;
|
|
1094
1216
|
};
|
|
1095
1217
|
export type InfiniteTablePropGroupColumn<T> = InfiniteTableGroupColumnBase<T> | InfiniteTableGroupColumnFunction<T>;
|
|
1096
|
-
export type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => InfiniteTableGroupColumnBase<T
|
|
1218
|
+
export type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => Partial<InfiniteTableGroupColumnBase<T>>;
|
|
1097
1219
|
export type InfiniteTablePropPivotColumn<T, COL_TYPE = InfiniteTableColumn<T>> = Partial<InfiniteTablePivotColumnBase<T>> | ((options: InfiniteTablePivotColumnGetterOptions<T, COL_TYPE>) => InfiniteTablePivotColumnBase<T>);
|
|
1098
|
-
export type InfiniteTablePropPivotRowLabelsColumn<T> = InfiniteTablePropPivotColumn<T>;
|
|
1099
1220
|
export type InfiniteTablePropComponents = {
|
|
1100
1221
|
LoadMask?: React.FC<LoadMaskProps>;
|
|
1101
1222
|
};
|
|
@@ -1111,7 +1232,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1111
1232
|
components?: InfiniteTablePropComponents;
|
|
1112
1233
|
viewportReservedWidth?: number;
|
|
1113
1234
|
pivotColumn?: InfiniteTablePropPivotColumn<T, InfiniteTableColumn<T> & InfiniteTablePivotFinalColumn<T>>;
|
|
1114
|
-
pivotRowLabelsColumn?: InfiniteTablePropPivotRowLabelsColumn<T>;
|
|
1115
1235
|
pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
|
|
1116
1236
|
groupColumn?: Partial<InfiniteTablePropGroupColumn<T>>;
|
|
1117
1237
|
groupRenderStrategy?: InfiniteTablePropGroupRenderStrategy;
|
|
@@ -1177,16 +1297,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1177
1297
|
horizontal: boolean;
|
|
1178
1298
|
};
|
|
1179
1299
|
}
|
|
1180
|
-
declare module "components/types/Size" {
|
|
1181
|
-
export interface Size {
|
|
1182
|
-
width: number;
|
|
1183
|
-
height: number;
|
|
1184
|
-
}
|
|
1185
|
-
export type OnResizeFn = (size: {
|
|
1186
|
-
width: number;
|
|
1187
|
-
height: number;
|
|
1188
|
-
}) => void;
|
|
1189
|
-
}
|
|
1190
1300
|
declare module "components/VirtualBrain/ScrollListener" {
|
|
1191
1301
|
import { OnScrollFn, ScrollPosition } from "components/types/ScrollPosition";
|
|
1192
1302
|
export class ScrollListener {
|
|
@@ -1207,7 +1317,7 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
|
|
|
1207
1317
|
import { SubscriptionCallback } from "components/types/SubscriptionCallback";
|
|
1208
1318
|
import { ScrollListener } from "components/VirtualBrain/ScrollListener";
|
|
1209
1319
|
import { NonUndefined } from "components/types/NonUndefined";
|
|
1210
|
-
import { InfiniteTableColumn
|
|
1320
|
+
import { InfiniteTableColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1211
1321
|
import { ComponentStateActions } from "components/hooks/useComponentState";
|
|
1212
1322
|
import { DataSourceGroupBy, DataSourceProps } from "components/DataSource/types";
|
|
1213
1323
|
export type GroupByMap<T> = Map<keyof T, {
|
|
@@ -1230,7 +1340,6 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
|
|
|
1230
1340
|
draggingColumnId: null | string;
|
|
1231
1341
|
pinnedStartScrollListener: ScrollListener;
|
|
1232
1342
|
pinnedEndScrollListener: ScrollListener;
|
|
1233
|
-
computedPivotColumns?: Map<string, InfiniteTablePivotColumn<T>>;
|
|
1234
1343
|
columnShifts: number[] | null;
|
|
1235
1344
|
}
|
|
1236
1345
|
export type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
|
|
@@ -1269,7 +1378,6 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
|
|
|
1269
1378
|
pinnedStartMaxWidth: InfiniteTableProps<T>['pinnedStartMaxWidth'];
|
|
1270
1379
|
pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
|
|
1271
1380
|
pivotColumn: InfiniteTableProps<T>['pivotColumn'];
|
|
1272
|
-
pivotRowLabelsColumn: InfiniteTableProps<T>['pivotRowLabelsColumn'];
|
|
1273
1381
|
pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
|
|
1274
1382
|
activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
|
|
1275
1383
|
columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
|
|
@@ -1352,6 +1460,7 @@ declare module "components/InfiniteTable/types/InfiniteTableComputedValues" {
|
|
|
1352
1460
|
computedRemainingSpace: number;
|
|
1353
1461
|
unpinnedColumnRenderCount: number;
|
|
1354
1462
|
columnRenderStartIndex: number;
|
|
1463
|
+
toggleGroupRow: (groupKeys: any[]) => void;
|
|
1355
1464
|
}
|
|
1356
1465
|
}
|
|
1357
1466
|
declare module "components/InfiniteTable/types/InfiniteTableContextValue" {
|
|
@@ -1369,12 +1478,12 @@ declare module "components/InfiniteTable/types/index" {
|
|
|
1369
1478
|
import type { InfiniteTableState } from "components/InfiniteTable/types/InfiniteTableState";
|
|
1370
1479
|
import type { InfiniteTableAction } from "components/InfiniteTable/types/InfiniteTableAction";
|
|
1371
1480
|
import type { InfiniteTableActionType } from "components/InfiniteTable/types/InfiniteTableActionType";
|
|
1372
|
-
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 } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1481
|
+
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";
|
|
1373
1482
|
import type { InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1374
1483
|
import type { InfiniteTableComputedValues } from "components/InfiniteTable/types/InfiniteTableComputedValues";
|
|
1375
1484
|
import type { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
|
|
1376
1485
|
import type { InfiniteTableRowInfo } from "utils/groupAndPivot/index";
|
|
1377
|
-
export type { Scrollbars, InfiniteTableColumnAggregator, InfiniteTableComputedValues, InfiniteTablePropColumns, InfiniteTablePropColumnsMap, InfiniteTableRowInfo, InfiniteTableGroupColumnFunction, 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, };
|
|
1486
|
+
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, };
|
|
1378
1487
|
}
|
|
1379
1488
|
declare module "components/InfiniteTable/InfiniteTableContext" {
|
|
1380
1489
|
import { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
|
|
@@ -1411,7 +1520,6 @@ declare module "components/InfiniteTable/state/getInitialState" {
|
|
|
1411
1520
|
components: 1 | ((value: import("components/InfiniteTable/types").InfiniteTablePropComponents | undefined) => import("components/InfiniteTable/types").InfiniteTablePropComponents | undefined);
|
|
1412
1521
|
loadingText: 1 | ((value: import("react").ReactNode) => import("react").ReactNode);
|
|
1413
1522
|
viewportReservedWidth: 1 | ((value: number | undefined) => number | undefined);
|
|
1414
|
-
pivotRowLabelsColumn: 1 | ((value: import("components/InfiniteTable/types/InfiniteTableProps").InfiniteTablePropPivotRowLabelsColumn<T> | undefined) => import("components/InfiniteTable/types/InfiniteTableProps").InfiniteTablePropPivotRowLabelsColumn<T> | undefined);
|
|
1415
1523
|
groupColumn: 1 | ((value: Partial<InfiniteTablePropGroupColumn<T>> | undefined) => Partial<InfiniteTablePropGroupColumn<T>> | undefined);
|
|
1416
1524
|
hideEmptyGroupColumns: 1 | ((value: boolean | undefined) => boolean);
|
|
1417
1525
|
columnVisibility: 1 | ((value: import("components/InfiniteTable/types").InfiniteTablePropColumnVisibility | undefined) => import("components/InfiniteTable/types").InfiniteTablePropColumnVisibility);
|
|
@@ -1533,9 +1641,6 @@ declare module "components/InfiniteTable/utils/adjustColumnOrderForPinning" {
|
|
|
1533
1641
|
import { InfiniteTablePropColumnOrderNormalized, InfiniteTablePropColumnPinningMap } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1534
1642
|
export const adjustColumnOrderForPinning: (columnOrder: InfiniteTablePropColumnOrderNormalized, columnPinning: InfiniteTablePropColumnPinningMap) => InfiniteTablePropColumnOrderNormalized;
|
|
1535
1643
|
}
|
|
1536
|
-
declare module "utils/getGlobal" {
|
|
1537
|
-
export function getGlobal<T extends Window>(): T;
|
|
1538
|
-
}
|
|
1539
1644
|
declare module "components/utils/getScrollbarWidth" {
|
|
1540
1645
|
export function getScrollbarWidth(): number;
|
|
1541
1646
|
}
|
|
@@ -1728,19 +1833,6 @@ declare module "components/InfiniteTable/components/InfiniteTableRow/row.css" {
|
|
|
1728
1833
|
}>;
|
|
1729
1834
|
export const GroupRowExpanderCls: string;
|
|
1730
1835
|
}
|
|
1731
|
-
declare module "components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns" {
|
|
1732
|
-
import { DataSourcePropGroupBy, DataSourcePropPivotBy } from "components/DataSource/index";
|
|
1733
|
-
import { InfiniteTableProps } from "components/InfiniteTable/types/index";
|
|
1734
|
-
import { InfiniteTableState } from "components/InfiniteTable/types/InfiniteTableState";
|
|
1735
|
-
export function getComputedPivotColumnsFromDataSourcePivotColumns<T>(pivotColumns: InfiniteTableProps<T>['pivotColumns'], params: {
|
|
1736
|
-
toggleGroupRow: (groupKeys: any[]) => void;
|
|
1737
|
-
pivotColumn: InfiniteTableProps<T>['pivotColumn'];
|
|
1738
|
-
pivotRowLabelsColumn: InfiniteTableProps<T>['pivotRowLabelsColumn'];
|
|
1739
|
-
pivotTotalColumnPosition: InfiniteTableState<T>['pivotTotalColumnPosition'];
|
|
1740
|
-
pivotBy: DataSourcePropPivotBy<T>;
|
|
1741
|
-
groupBy: DataSourcePropGroupBy<T>;
|
|
1742
|
-
}): InfiniteTableProps<T>['pivotColumns'];
|
|
1743
|
-
}
|
|
1744
1836
|
declare module "components/InfiniteTable/utils/getColumnForGroupBy" {
|
|
1745
1837
|
import * as React from 'react';
|
|
1746
1838
|
import { InfiniteTableColumnRenderParam } from "components/InfiniteTable/index";
|
|
@@ -1763,17 +1855,23 @@ declare module "components/InfiniteTable/hooks/useToggleGroupRow" {
|
|
|
1763
1855
|
export function useToggleGroupRow<T>(): ToggleGrouRowFn;
|
|
1764
1856
|
}
|
|
1765
1857
|
declare module "components/InfiniteTable/hooks/useColumnsWhen" {
|
|
1766
|
-
import type { InfiniteTableColumn } from "components/InfiniteTable/index";
|
|
1767
|
-
import type { DataSourceGroupBy } from "components/DataSource/index";
|
|
1858
|
+
import type { InfiniteTableColumn, InfiniteTableState } from "components/InfiniteTable/index";
|
|
1859
|
+
import type { DataSourceGroupBy, DataSourcePivotBy } from "components/DataSource/index";
|
|
1768
1860
|
import type { InfiniteTablePropGroupRenderStrategy, InfiniteTableProps } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1769
|
-
|
|
1861
|
+
import { ToggleGrouRowFn } from "components/InfiniteTable/hooks/useToggleGroupRow";
|
|
1862
|
+
export function useColumnsWhen<T>(): {
|
|
1863
|
+
toggleGroupRow: ToggleGrouRowFn;
|
|
1864
|
+
};
|
|
1770
1865
|
export function getColumnsWhenGrouping<T>(params: {
|
|
1771
1866
|
columns: Map<string, InfiniteTableColumn<T>>;
|
|
1772
1867
|
groupBy: DataSourceGroupBy<T>[];
|
|
1868
|
+
pivotBy?: DataSourcePivotBy<T>[];
|
|
1773
1869
|
toggleGroupRow: (groupKeys: any[]) => void;
|
|
1870
|
+
pivotTotalColumnPosition: InfiniteTableState<T>['pivotTotalColumnPosition'];
|
|
1774
1871
|
groupColumn: InfiniteTableProps<T>['groupColumn'];
|
|
1775
1872
|
groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
|
|
1776
1873
|
pivotColumns: InfiniteTableProps<T>['pivotColumns'];
|
|
1874
|
+
pivotColumn: InfiniteTableProps<T>['pivotColumn'];
|
|
1777
1875
|
}): Map<string, InfiniteTableColumn<T>> | undefined;
|
|
1778
1876
|
}
|
|
1779
1877
|
declare module "components/InfiniteTable/hooks/useComputed" {
|
|
@@ -1795,93 +1893,6 @@ declare module "components/InfiniteTable/components/InfiniteTableBody/InfiniteTa
|
|
|
1795
1893
|
declare module "components/InfiniteTable/components/InfiniteTableBody/index" {
|
|
1796
1894
|
export * from "components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody";
|
|
1797
1895
|
}
|
|
1798
|
-
declare module "components/VirtualBrain/index" {
|
|
1799
|
-
import { Logger } from "utils/debug";
|
|
1800
|
-
import { Size } from "components/types/Size";
|
|
1801
|
-
import type { OnScrollFn, ScrollPosition } from "components/types/ScrollPosition";
|
|
1802
|
-
type MainAxisOptions = 'vertical' | 'horizontal';
|
|
1803
|
-
export type VirtualBrainOptions = {
|
|
1804
|
-
mainAxis: MainAxisOptions;
|
|
1805
|
-
itemSize: MainAxisSize;
|
|
1806
|
-
itemSpan?: ({ itemIndex }: {
|
|
1807
|
-
itemIndex: number;
|
|
1808
|
-
}) => number;
|
|
1809
|
-
count: number;
|
|
1810
|
-
name?: string;
|
|
1811
|
-
};
|
|
1812
|
-
export type MainAxisSize = number | ((itemIndex: number) => number);
|
|
1813
|
-
type OnRenderCountChangeFn = (renderCount: number) => void;
|
|
1814
|
-
type OnSizeChangeFn = (size: number) => void;
|
|
1815
|
-
type OnDestroyFn = () => void;
|
|
1816
|
-
export type GetItemPositionFn = (itemIndex: number) => number;
|
|
1817
|
-
export type RenderRange = {
|
|
1818
|
-
renderStartIndex: number;
|
|
1819
|
-
renderEndIndex: number;
|
|
1820
|
-
};
|
|
1821
|
-
export type OnRenderRangeChangeFn = (renderRange: RenderRange) => void;
|
|
1822
|
-
export class VirtualBrain extends Logger {
|
|
1823
|
-
private scrollPosition;
|
|
1824
|
-
private scrollPositionOnMainAxis;
|
|
1825
|
-
private itemSpanParent;
|
|
1826
|
-
private itemSpanValue;
|
|
1827
|
-
private itemSizeCache;
|
|
1828
|
-
private itemOffsetCache;
|
|
1829
|
-
private options;
|
|
1830
|
-
private destroyed;
|
|
1831
|
-
private totalSize;
|
|
1832
|
-
private onScrollFns;
|
|
1833
|
-
private onTotalSizeChangeFns;
|
|
1834
|
-
private onRenderCountChangeFns;
|
|
1835
|
-
private onRenderRangeChangeFns;
|
|
1836
|
-
private onDestroyFns;
|
|
1837
|
-
name: string | undefined;
|
|
1838
|
-
private renderCount;
|
|
1839
|
-
private renderRange;
|
|
1840
|
-
private availableSize;
|
|
1841
|
-
constructor(options: VirtualBrainOptions);
|
|
1842
|
-
setAvailableSize: (size: Size) => void;
|
|
1843
|
-
getOptions(): VirtualBrainOptions;
|
|
1844
|
-
private updateRenderCount;
|
|
1845
|
-
private computeRenderCount;
|
|
1846
|
-
private setRenderCount;
|
|
1847
|
-
private updateRenderRange;
|
|
1848
|
-
getRenderStartIndex(): number;
|
|
1849
|
-
getRenderCount: () => number;
|
|
1850
|
-
setScrollPosition: (scrollPosition: ScrollPosition) => void;
|
|
1851
|
-
private notifyScrollChange;
|
|
1852
|
-
private notifyDestroy;
|
|
1853
|
-
private notifyTotalSizeChange;
|
|
1854
|
-
private notifyRenderCountChange;
|
|
1855
|
-
private notifyRenderRangeChange;
|
|
1856
|
-
getRenderRange: () => RenderRange;
|
|
1857
|
-
private setRenderRange;
|
|
1858
|
-
private computeRenderRange;
|
|
1859
|
-
getScrollPosition: () => ScrollPosition;
|
|
1860
|
-
onScroll: (fn: OnScrollFn) => () => void;
|
|
1861
|
-
onTotalSizeChange: (fn: OnSizeChangeFn) => () => void;
|
|
1862
|
-
onRenderCountChange: (fn: OnRenderCountChangeFn) => () => void;
|
|
1863
|
-
onRenderRangeChange: (fn: OnRenderRangeChangeFn) => () => void;
|
|
1864
|
-
onDestroy: (fn: OnDestroyFn) => () => void;
|
|
1865
|
-
update: (newCount: VirtualBrainOptions['count'], newItemSize: VirtualBrainOptions['itemSize'], newItemSpan?: VirtualBrainOptions['itemSpan']) => void;
|
|
1866
|
-
private reset;
|
|
1867
|
-
private computeItemSpanUpTo;
|
|
1868
|
-
private computeCacheFor;
|
|
1869
|
-
private getItemSizeCacheFor;
|
|
1870
|
-
getItemSpan: (itemIndex: number) => number;
|
|
1871
|
-
getItemSpanParent: (itemIndex: number) => number;
|
|
1872
|
-
getItemSizeWithSpan: (itemIndex: number, itemSpan: number) => number;
|
|
1873
|
-
/**
|
|
1874
|
-
* For now, this doesn't take into account the itemspan, and it's okay not to
|
|
1875
|
-
* @param itemIndex
|
|
1876
|
-
* @returns the size of the specified item
|
|
1877
|
-
*/
|
|
1878
|
-
getItemSize: (itemIndex: number) => number;
|
|
1879
|
-
getTotalSize: () => number;
|
|
1880
|
-
getItemAt: (scrollPos: number) => number;
|
|
1881
|
-
getItemOffsetFor: (itemIndex: number) => number;
|
|
1882
|
-
destroy: () => void;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
1896
|
declare module "components/InfiniteTable/components/ScrollbarPlaceholder" {
|
|
1886
1897
|
import * as React from 'react';
|
|
1887
1898
|
function HorizontalScrollbarPlaceholderFn(props: {
|