@infinite-table/infinite-react 0.1.4 → 0.2.3
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 +142 -130
- package/index.esm.js +471 -349
- package/index.js +476 -352
- 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;
|
|
@@ -745,6 +865,7 @@ declare module "utils/groupAndPivot/index" {
|
|
|
745
865
|
export type PivotValuesDeepMap<DataType, KeyType> = DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
|
|
746
866
|
export type DeepMapGroupValueType<DataType, KeyType> = {
|
|
747
867
|
items: DataType[];
|
|
868
|
+
commonData?: Partial<DataType>;
|
|
748
869
|
reducerResults: Record<string, AggregationReducerResult>;
|
|
749
870
|
pivotDeepMap?: DeepMap<GroupKeyType<KeyType>, PivotGroupValueType<DataType, KeyType>>;
|
|
750
871
|
};
|
|
@@ -974,10 +1095,10 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
974
1095
|
import * as React from 'react';
|
|
975
1096
|
import { InfiniteTableState } from "components/InfiniteTable/types/index";
|
|
976
1097
|
import { AggregationReducer, InfiniteTableRowInfoGroup, InfiniteTableRowInfoNormal } from "utils/groupAndPivot/index";
|
|
977
|
-
import { DataSourceGroupBy, DataSourcePropGroupBy, DataSourcePropPivotBy, DataSourceState } from "components/DataSource/index";
|
|
1098
|
+
import { DataSourceGroupBy, DataSourcePivotBy, DataSourcePropGroupBy, DataSourcePropPivotBy, DataSourceState } from "components/DataSource/index";
|
|
978
1099
|
import { Renderable } from "components/types/Renderable";
|
|
979
1100
|
import { LoadMaskProps } from "components/InfiniteTable/components/LoadMask";
|
|
980
|
-
import type { InfiniteTableColumn, InfiniteTableColumnRenderFunction, InfiniteTableComputedColumn, InfiniteTableComputedPivotFinalColumn, InfiniteTablePivotColumn, InfiniteTablePivotFinalColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1101
|
+
import type { InfiniteTableColumn, InfiniteTableColumnRenderFunction, InfiniteTableComputedColumn, InfiniteTableComputedPivotFinalColumn, InfiniteTableGroupColumnRenderIconFunction, InfiniteTablePivotColumn, InfiniteTablePivotFinalColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
981
1102
|
import { InfiniteTablePropPivotTotalColumnPosition } from "components/InfiniteTable/types/InfiniteTableState";
|
|
982
1103
|
export type InfiniteTablePropColumnOrderNormalized = string[];
|
|
983
1104
|
export type InfiniteTablePropColumnOrder = InfiniteTablePropColumnOrderNormalized | true;
|
|
@@ -1078,6 +1199,7 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1078
1199
|
groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
|
|
1079
1200
|
groupCount: number;
|
|
1080
1201
|
groupBy: DataSourceGroupBy<T>[];
|
|
1202
|
+
pivotBy?: DataSourcePivotBy<T>[];
|
|
1081
1203
|
};
|
|
1082
1204
|
export type InfiniteTablePivotColumnGetterOptions<T, COL_TYPE = InfiniteTableColumn<T>> = {
|
|
1083
1205
|
column: COL_TYPE;
|
|
@@ -1085,17 +1207,17 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1085
1207
|
pivotBy: DataSourcePropPivotBy<T>;
|
|
1086
1208
|
};
|
|
1087
1209
|
export type InfiniteTablePropGroupRenderStrategy = 'single-column' | 'multi-column' | 'inline';
|
|
1088
|
-
export type InfiniteTableGroupColumnBase<T> = InfiniteTableColumn<T
|
|
1210
|
+
export type InfiniteTableGroupColumnBase<T> = Partial<InfiniteTableColumn<T>> & {
|
|
1089
1211
|
renderValue?: InfiniteTableColumnRenderFunction<T>;
|
|
1212
|
+
renderGroupIcon?: InfiniteTableGroupColumnRenderIconFunction<T>;
|
|
1090
1213
|
id?: string;
|
|
1091
1214
|
};
|
|
1092
1215
|
export type InfiniteTablePivotColumnBase<T> = InfiniteTableColumn<T> & {
|
|
1093
1216
|
renderValue?: InfiniteTableColumnRenderFunction<T, InfiniteTableComputedPivotFinalColumn<T>>;
|
|
1094
1217
|
};
|
|
1095
1218
|
export type InfiniteTablePropGroupColumn<T> = InfiniteTableGroupColumnBase<T> | InfiniteTableGroupColumnFunction<T>;
|
|
1096
|
-
export type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => InfiniteTableGroupColumnBase<T
|
|
1219
|
+
export type InfiniteTableGroupColumnFunction<T> = (options: InfiniteTableGroupColumnGetterOptions<T>, toggleGroupRow: (groupKeys: any[]) => void) => Partial<InfiniteTableGroupColumnBase<T>>;
|
|
1097
1220
|
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
1221
|
export type InfiniteTablePropComponents = {
|
|
1100
1222
|
LoadMask?: React.FC<LoadMaskProps>;
|
|
1101
1223
|
};
|
|
@@ -1111,7 +1233,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1111
1233
|
components?: InfiniteTablePropComponents;
|
|
1112
1234
|
viewportReservedWidth?: number;
|
|
1113
1235
|
pivotColumn?: InfiniteTablePropPivotColumn<T, InfiniteTableColumn<T> & InfiniteTablePivotFinalColumn<T>>;
|
|
1114
|
-
pivotRowLabelsColumn?: InfiniteTablePropPivotRowLabelsColumn<T>;
|
|
1115
1236
|
pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
|
|
1116
1237
|
groupColumn?: Partial<InfiniteTablePropGroupColumn<T>>;
|
|
1117
1238
|
groupRenderStrategy?: InfiniteTablePropGroupRenderStrategy;
|
|
@@ -1177,16 +1298,6 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1177
1298
|
horizontal: boolean;
|
|
1178
1299
|
};
|
|
1179
1300
|
}
|
|
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
1301
|
declare module "components/VirtualBrain/ScrollListener" {
|
|
1191
1302
|
import { OnScrollFn, ScrollPosition } from "components/types/ScrollPosition";
|
|
1192
1303
|
export class ScrollListener {
|
|
@@ -1207,7 +1318,7 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
|
|
|
1207
1318
|
import { SubscriptionCallback } from "components/types/SubscriptionCallback";
|
|
1208
1319
|
import { ScrollListener } from "components/VirtualBrain/ScrollListener";
|
|
1209
1320
|
import { NonUndefined } from "components/types/NonUndefined";
|
|
1210
|
-
import { InfiniteTableColumn
|
|
1321
|
+
import { InfiniteTableColumn } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1211
1322
|
import { ComponentStateActions } from "components/hooks/useComponentState";
|
|
1212
1323
|
import { DataSourceGroupBy, DataSourceProps } from "components/DataSource/types";
|
|
1213
1324
|
export type GroupByMap<T> = Map<keyof T, {
|
|
@@ -1230,7 +1341,6 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
|
|
|
1230
1341
|
draggingColumnId: null | string;
|
|
1231
1342
|
pinnedStartScrollListener: ScrollListener;
|
|
1232
1343
|
pinnedEndScrollListener: ScrollListener;
|
|
1233
|
-
computedPivotColumns?: Map<string, InfiniteTablePivotColumn<T>>;
|
|
1234
1344
|
columnShifts: number[] | null;
|
|
1235
1345
|
}
|
|
1236
1346
|
export type InfiniteTableComputedColumnGroup = InfiniteTableColumnGroup & {
|
|
@@ -1269,7 +1379,6 @@ declare module "components/InfiniteTable/types/InfiniteTableState" {
|
|
|
1269
1379
|
pinnedStartMaxWidth: InfiniteTableProps<T>['pinnedStartMaxWidth'];
|
|
1270
1380
|
pinnedEndMaxWidth: InfiniteTableProps<T>['pinnedEndMaxWidth'];
|
|
1271
1381
|
pivotColumn: InfiniteTableProps<T>['pivotColumn'];
|
|
1272
|
-
pivotRowLabelsColumn: InfiniteTableProps<T>['pivotRowLabelsColumn'];
|
|
1273
1382
|
pivotColumnGroups: InfiniteTablePropColumnGroupsMap;
|
|
1274
1383
|
activeIndex: NonUndefined<InfiniteTableProps<T>['activeIndex']>;
|
|
1275
1384
|
columnMinWidth: NonUndefined<InfiniteTableProps<T>['columnMinWidth']>;
|
|
@@ -1352,6 +1461,7 @@ declare module "components/InfiniteTable/types/InfiniteTableComputedValues" {
|
|
|
1352
1461
|
computedRemainingSpace: number;
|
|
1353
1462
|
unpinnedColumnRenderCount: number;
|
|
1354
1463
|
columnRenderStartIndex: number;
|
|
1464
|
+
toggleGroupRow: (groupKeys: any[]) => void;
|
|
1355
1465
|
}
|
|
1356
1466
|
}
|
|
1357
1467
|
declare module "components/InfiniteTable/types/InfiniteTableContextValue" {
|
|
@@ -1369,12 +1479,12 @@ declare module "components/InfiniteTable/types/index" {
|
|
|
1369
1479
|
import type { InfiniteTableState } from "components/InfiniteTable/types/InfiniteTableState";
|
|
1370
1480
|
import type { InfiniteTableAction } from "components/InfiniteTable/types/InfiniteTableAction";
|
|
1371
1481
|
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";
|
|
1482
|
+
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
1483
|
import type { InfiniteTableColumn, InfiniteTableColumnComparer, InfiniteTableComputedColumn, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam } from "components/InfiniteTable/types/InfiniteTableColumn";
|
|
1374
1484
|
import type { InfiniteTableComputedValues } from "components/InfiniteTable/types/InfiniteTableComputedValues";
|
|
1375
1485
|
import type { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
|
|
1376
1486
|
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, };
|
|
1487
|
+
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
1488
|
}
|
|
1379
1489
|
declare module "components/InfiniteTable/InfiniteTableContext" {
|
|
1380
1490
|
import { InfiniteTableContextValue } from "components/InfiniteTable/types/InfiniteTableContextValue";
|
|
@@ -1411,7 +1521,6 @@ declare module "components/InfiniteTable/state/getInitialState" {
|
|
|
1411
1521
|
components: 1 | ((value: import("components/InfiniteTable/types").InfiniteTablePropComponents | undefined) => import("components/InfiniteTable/types").InfiniteTablePropComponents | undefined);
|
|
1412
1522
|
loadingText: 1 | ((value: import("react").ReactNode) => import("react").ReactNode);
|
|
1413
1523
|
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
1524
|
groupColumn: 1 | ((value: Partial<InfiniteTablePropGroupColumn<T>> | undefined) => Partial<InfiniteTablePropGroupColumn<T>> | undefined);
|
|
1416
1525
|
hideEmptyGroupColumns: 1 | ((value: boolean | undefined) => boolean);
|
|
1417
1526
|
columnVisibility: 1 | ((value: import("components/InfiniteTable/types").InfiniteTablePropColumnVisibility | undefined) => import("components/InfiniteTable/types").InfiniteTablePropColumnVisibility);
|
|
@@ -1533,9 +1642,6 @@ declare module "components/InfiniteTable/utils/adjustColumnOrderForPinning" {
|
|
|
1533
1642
|
import { InfiniteTablePropColumnOrderNormalized, InfiniteTablePropColumnPinningMap } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1534
1643
|
export const adjustColumnOrderForPinning: (columnOrder: InfiniteTablePropColumnOrderNormalized, columnPinning: InfiniteTablePropColumnPinningMap) => InfiniteTablePropColumnOrderNormalized;
|
|
1535
1644
|
}
|
|
1536
|
-
declare module "utils/getGlobal" {
|
|
1537
|
-
export function getGlobal<T extends Window>(): T;
|
|
1538
|
-
}
|
|
1539
1645
|
declare module "components/utils/getScrollbarWidth" {
|
|
1540
1646
|
export function getScrollbarWidth(): number;
|
|
1541
1647
|
}
|
|
@@ -1728,19 +1834,6 @@ declare module "components/InfiniteTable/components/InfiniteTableRow/row.css" {
|
|
|
1728
1834
|
}>;
|
|
1729
1835
|
export const GroupRowExpanderCls: string;
|
|
1730
1836
|
}
|
|
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
1837
|
declare module "components/InfiniteTable/utils/getColumnForGroupBy" {
|
|
1745
1838
|
import * as React from 'react';
|
|
1746
1839
|
import { InfiniteTableColumnRenderParam } from "components/InfiniteTable/index";
|
|
@@ -1763,17 +1856,23 @@ declare module "components/InfiniteTable/hooks/useToggleGroupRow" {
|
|
|
1763
1856
|
export function useToggleGroupRow<T>(): ToggleGrouRowFn;
|
|
1764
1857
|
}
|
|
1765
1858
|
declare module "components/InfiniteTable/hooks/useColumnsWhen" {
|
|
1766
|
-
import type { InfiniteTableColumn } from "components/InfiniteTable/index";
|
|
1767
|
-
import type { DataSourceGroupBy } from "components/DataSource/index";
|
|
1859
|
+
import type { InfiniteTableColumn, InfiniteTableState } from "components/InfiniteTable/index";
|
|
1860
|
+
import type { DataSourceGroupBy, DataSourcePivotBy } from "components/DataSource/index";
|
|
1768
1861
|
import type { InfiniteTablePropGroupRenderStrategy, InfiniteTableProps } from "components/InfiniteTable/types/InfiniteTableProps";
|
|
1769
|
-
|
|
1862
|
+
import { ToggleGrouRowFn } from "components/InfiniteTable/hooks/useToggleGroupRow";
|
|
1863
|
+
export function useColumnsWhen<T>(): {
|
|
1864
|
+
toggleGroupRow: ToggleGrouRowFn;
|
|
1865
|
+
};
|
|
1770
1866
|
export function getColumnsWhenGrouping<T>(params: {
|
|
1771
1867
|
columns: Map<string, InfiniteTableColumn<T>>;
|
|
1772
1868
|
groupBy: DataSourceGroupBy<T>[];
|
|
1869
|
+
pivotBy?: DataSourcePivotBy<T>[];
|
|
1773
1870
|
toggleGroupRow: (groupKeys: any[]) => void;
|
|
1871
|
+
pivotTotalColumnPosition: InfiniteTableState<T>['pivotTotalColumnPosition'];
|
|
1774
1872
|
groupColumn: InfiniteTableProps<T>['groupColumn'];
|
|
1775
1873
|
groupRenderStrategy: InfiniteTablePropGroupRenderStrategy;
|
|
1776
1874
|
pivotColumns: InfiniteTableProps<T>['pivotColumns'];
|
|
1875
|
+
pivotColumn: InfiniteTableProps<T>['pivotColumn'];
|
|
1777
1876
|
}): Map<string, InfiniteTableColumn<T>> | undefined;
|
|
1778
1877
|
}
|
|
1779
1878
|
declare module "components/InfiniteTable/hooks/useComputed" {
|
|
@@ -1795,93 +1894,6 @@ declare module "components/InfiniteTable/components/InfiniteTableBody/InfiniteTa
|
|
|
1795
1894
|
declare module "components/InfiniteTable/components/InfiniteTableBody/index" {
|
|
1796
1895
|
export * from "components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody";
|
|
1797
1896
|
}
|
|
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
1897
|
declare module "components/InfiniteTable/components/ScrollbarPlaceholder" {
|
|
1886
1898
|
import * as React from 'react';
|
|
1887
1899
|
function HorizontalScrollbarPlaceholderFn(props: {
|