@infinite-table/infinite-react 0.2.11 → 0.2.14
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 +239 -217
- package/index.esm.js +146 -86
- package/index.js +146 -86
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -616,6 +616,20 @@ var require_vanilla_extract_recipes_createRuntimeFn_cjs = __commonJS({
|
|
|
616
616
|
}
|
|
617
617
|
});
|
|
618
618
|
|
|
619
|
+
// src/components/utils/debounce.ts
|
|
620
|
+
function debounce(fn, { wait }) {
|
|
621
|
+
let timeout = null;
|
|
622
|
+
return function(...args) {
|
|
623
|
+
const context = this;
|
|
624
|
+
if (timeout !== null) {
|
|
625
|
+
clearTimeout(timeout);
|
|
626
|
+
}
|
|
627
|
+
timeout = setTimeout(() => {
|
|
628
|
+
fn.apply(context, args);
|
|
629
|
+
}, wait);
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
|
|
619
633
|
// src/components/InfiniteTable/index.tsx
|
|
620
634
|
import {
|
|
621
635
|
StrictMode,
|
|
@@ -1460,7 +1474,7 @@ var useInfiniteTable = () => {
|
|
|
1460
1474
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
1461
1475
|
import { useMemo as useMemo2 } from "react";
|
|
1462
1476
|
|
|
1463
|
-
// src/components/flexbox/index.
|
|
1477
|
+
// src/components/flexbox/index.ts
|
|
1464
1478
|
var computeFlex = (params) => {
|
|
1465
1479
|
const {
|
|
1466
1480
|
availableSize,
|
|
@@ -1731,7 +1745,6 @@ var getComputedVisibleColumns = ({
|
|
|
1731
1745
|
}
|
|
1732
1746
|
return acc;
|
|
1733
1747
|
}, {});
|
|
1734
|
-
console.log(columnSizing, "columnSizing");
|
|
1735
1748
|
const flexResult = computeFlex({
|
|
1736
1749
|
availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
|
|
1737
1750
|
maxSize: columnMaxWidth,
|
|
@@ -2100,6 +2113,7 @@ var useComputedVisibleColumns = ({
|
|
|
2100
2113
|
pinnedEndMaxWidth,
|
|
2101
2114
|
pinnedStartMaxWidth,
|
|
2102
2115
|
columnSizing,
|
|
2116
|
+
columnTypes,
|
|
2103
2117
|
columnPinning,
|
|
2104
2118
|
columnsRenderId,
|
|
2105
2119
|
pinningRenderId
|
|
@@ -2130,7 +2144,7 @@ var sortAscending = (a, b) => a - b;
|
|
|
2130
2144
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
2131
2145
|
import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo6, useState as useState5 } from "react";
|
|
2132
2146
|
|
|
2133
|
-
// src/components/hooks/useComponentState.tsx
|
|
2147
|
+
// src/components/hooks/useComponentState/index.tsx
|
|
2134
2148
|
import {
|
|
2135
2149
|
createElement as createElement2,
|
|
2136
2150
|
memo,
|
|
@@ -2203,7 +2217,7 @@ var usePrevious = (value, initialValue) => {
|
|
|
2203
2217
|
return ref.current;
|
|
2204
2218
|
};
|
|
2205
2219
|
|
|
2206
|
-
// src/components/hooks/useComponentState.tsx
|
|
2220
|
+
// src/components/hooks/useComponentState/index.tsx
|
|
2207
2221
|
var notifyChange = (props, propName, newValue) => {
|
|
2208
2222
|
const upperPropName = toUpperFirst(propName);
|
|
2209
2223
|
const callbackPropName = `on${upperPropName}Change`;
|
|
@@ -2833,6 +2847,7 @@ var DeepMap = class {
|
|
|
2833
2847
|
this.map = new Map();
|
|
2834
2848
|
this.length = 0;
|
|
2835
2849
|
this.revision = 0;
|
|
2850
|
+
this.emptyKey = Symbol("emptyKey");
|
|
2836
2851
|
this.visit = (fn) => {
|
|
2837
2852
|
this.map.forEach((_, k) => this.visitKey(k, this.map, [], fn));
|
|
2838
2853
|
};
|
|
@@ -2844,13 +2859,19 @@ var DeepMap = class {
|
|
|
2844
2859
|
return;
|
|
2845
2860
|
}
|
|
2846
2861
|
let i = 0;
|
|
2847
|
-
currentMap.
|
|
2862
|
+
const hasEmptyKey = currentMap.has(this.emptyKey);
|
|
2863
|
+
let allowEmptyKey = true;
|
|
2864
|
+
const iterator = (_, key) => {
|
|
2848
2865
|
const pair = currentMap.get(key);
|
|
2849
2866
|
if (!pair) {
|
|
2850
2867
|
return;
|
|
2851
2868
|
}
|
|
2852
2869
|
const { map: map2 } = pair;
|
|
2853
|
-
const
|
|
2870
|
+
const isEmptyKey = key === this.emptyKey;
|
|
2871
|
+
if (isEmptyKey && !allowEmptyKey) {
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
2874
|
+
const keys = isEmptyKey ? [] : [...parentKeys, key];
|
|
2854
2875
|
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2855
2876
|
if (pair.hasOwnProperty("value")) {
|
|
2856
2877
|
fn(pair.value, keys, i, next);
|
|
@@ -2858,7 +2879,13 @@ var DeepMap = class {
|
|
|
2858
2879
|
} else {
|
|
2859
2880
|
next == null ? void 0 : next();
|
|
2860
2881
|
}
|
|
2861
|
-
}
|
|
2882
|
+
};
|
|
2883
|
+
if (hasEmptyKey) {
|
|
2884
|
+
iterator(void 0, this.emptyKey);
|
|
2885
|
+
allowEmptyKey = false;
|
|
2886
|
+
i = 0;
|
|
2887
|
+
}
|
|
2888
|
+
currentMap.forEach(iterator);
|
|
2862
2889
|
};
|
|
2863
2890
|
if (initial) {
|
|
2864
2891
|
initial.forEach((entry) => {
|
|
@@ -2877,7 +2904,7 @@ var DeepMap = class {
|
|
|
2877
2904
|
set(keys, value) {
|
|
2878
2905
|
let currentMap = this.map;
|
|
2879
2906
|
if (!keys.length) {
|
|
2880
|
-
|
|
2907
|
+
keys = [this.emptyKey];
|
|
2881
2908
|
}
|
|
2882
2909
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2883
2910
|
const key = keys[i];
|
|
@@ -2903,7 +2930,7 @@ var DeepMap = class {
|
|
|
2903
2930
|
var _a;
|
|
2904
2931
|
let currentMap = this.map;
|
|
2905
2932
|
if (!keys.length) {
|
|
2906
|
-
|
|
2933
|
+
keys = [this.emptyKey];
|
|
2907
2934
|
}
|
|
2908
2935
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2909
2936
|
const key = keys[i];
|
|
@@ -2938,10 +2965,11 @@ var DeepMap = class {
|
|
|
2938
2965
|
this.revision = 0;
|
|
2939
2966
|
}
|
|
2940
2967
|
delete(keys) {
|
|
2941
|
-
keys = [...keys];
|
|
2942
2968
|
let currentMap = this.map;
|
|
2943
2969
|
if (!keys.length) {
|
|
2944
|
-
|
|
2970
|
+
keys = [this.emptyKey];
|
|
2971
|
+
} else {
|
|
2972
|
+
keys = [...keys];
|
|
2945
2973
|
}
|
|
2946
2974
|
let maps = [currentMap];
|
|
2947
2975
|
let result = false;
|
|
@@ -2994,7 +3022,7 @@ var DeepMap = class {
|
|
|
2994
3022
|
has(keys) {
|
|
2995
3023
|
let currentMap = this.map;
|
|
2996
3024
|
if (!keys.length) {
|
|
2997
|
-
|
|
3025
|
+
keys = [this.emptyKey];
|
|
2998
3026
|
}
|
|
2999
3027
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
3000
3028
|
const key = keys[i];
|
|
@@ -3018,7 +3046,7 @@ var DeepMap = class {
|
|
|
3018
3046
|
return;
|
|
3019
3047
|
}
|
|
3020
3048
|
const { map: map2 } = pair;
|
|
3021
|
-
const keys = [...parentKeys, key];
|
|
3049
|
+
const keys = key === this.emptyKey ? [] : [...parentKeys, key];
|
|
3022
3050
|
const next = once(() => {
|
|
3023
3051
|
if (map2) {
|
|
3024
3052
|
map2.forEach((_, k) => {
|
|
@@ -3034,7 +3062,12 @@ var DeepMap = class {
|
|
|
3034
3062
|
getArray(fn) {
|
|
3035
3063
|
const result = [];
|
|
3036
3064
|
this.visit((pair, keys) => {
|
|
3037
|
-
|
|
3065
|
+
const res = fn(__spreadProps(__spreadValues({}, pair), { keys }));
|
|
3066
|
+
if (keys.length === 0) {
|
|
3067
|
+
result.splice(0, 0, res);
|
|
3068
|
+
} else {
|
|
3069
|
+
result.push(res);
|
|
3070
|
+
}
|
|
3038
3071
|
});
|
|
3039
3072
|
return result;
|
|
3040
3073
|
}
|
|
@@ -3120,7 +3153,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
3120
3153
|
} = groupParams;
|
|
3121
3154
|
const deepMap = new DeepMap();
|
|
3122
3155
|
function traverseValues(pivotDeepMap, container, pivot2, pivotIndex = 0, currentPivotKeys2 = []) {
|
|
3123
|
-
const last = pivotIndex === pivot2.length - 1;
|
|
3156
|
+
const last = !pivot2.length || pivotIndex === pivot2.length - 1;
|
|
3124
3157
|
const values = container[(mappings == null ? void 0 : mappings.values) || "values"] || {};
|
|
3125
3158
|
for (var k in values)
|
|
3126
3159
|
if (values.hasOwnProperty(k)) {
|
|
@@ -3144,7 +3177,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
3144
3177
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
3145
3178
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
3146
3179
|
const dataArray = lazyGroupRowInfo.items;
|
|
3147
|
-
if (currentGroupKeys.length == groupBy.length) {
|
|
3180
|
+
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
3148
3181
|
const deepMapGroupValue = deepMap.get(currentGroupKeys);
|
|
3149
3182
|
if (deepMapGroupValue) {
|
|
3150
3183
|
deepMapGroupValue.items = dataArray;
|
|
@@ -3166,9 +3199,11 @@ function lazyGroup(groupParams, rootData) {
|
|
|
3166
3199
|
const dataObject = dataArray[i].data;
|
|
3167
3200
|
const dataKeys = dataArray[i].keys;
|
|
3168
3201
|
let item = dataObject;
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3202
|
+
if (dataKeys.length) {
|
|
3203
|
+
const { field: groupByProperty } = groupBy[dataKeys.length - 1];
|
|
3204
|
+
const key = item[groupByProperty];
|
|
3205
|
+
currentGroupKeys.push(key);
|
|
3206
|
+
}
|
|
3172
3207
|
const deepMapGroupValue = {
|
|
3173
3208
|
items: [],
|
|
3174
3209
|
commonData: dataObject,
|
|
@@ -3180,7 +3215,9 @@ function lazyGroup(groupParams, rootData) {
|
|
|
3180
3215
|
const pivotContainer = dataArray[i].pivot;
|
|
3181
3216
|
traverseValues(pivotDeepMap, pivotContainer, pivot, 0, currentPivotKeys);
|
|
3182
3217
|
}
|
|
3183
|
-
|
|
3218
|
+
if (dataKeys.length) {
|
|
3219
|
+
currentGroupKeys.pop();
|
|
3220
|
+
}
|
|
3184
3221
|
}
|
|
3185
3222
|
next == null ? void 0 : next();
|
|
3186
3223
|
});
|
|
@@ -3196,6 +3233,37 @@ function lazyGroup(groupParams, rootData) {
|
|
|
3196
3233
|
}
|
|
3197
3234
|
return result;
|
|
3198
3235
|
}
|
|
3236
|
+
function processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, pivot, reducers, topLevelPivotColumns, initialReducerValue, defaultToKey = DEFAULT_TO_KEY) {
|
|
3237
|
+
const {
|
|
3238
|
+
items: currentGroupItems,
|
|
3239
|
+
reducerResults,
|
|
3240
|
+
pivotDeepMap
|
|
3241
|
+
} = deepMap.get(currentGroupKeys);
|
|
3242
|
+
currentGroupItems.push(item);
|
|
3243
|
+
if (reducers) {
|
|
3244
|
+
computeReducersFor(item, reducers, reducerResults);
|
|
3245
|
+
}
|
|
3246
|
+
if (pivot) {
|
|
3247
|
+
for (let pivotIndex = 0, pivotLength = pivot.length; pivotIndex < pivotLength; pivotIndex++) {
|
|
3248
|
+
const { field: pivotField, toKey: pivotToKey } = pivot[pivotIndex];
|
|
3249
|
+
const pivotKey = (pivotToKey || defaultToKey)(item[pivotField], item);
|
|
3250
|
+
currentPivotKeys.push(pivotKey);
|
|
3251
|
+
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3252
|
+
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3253
|
+
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3254
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3255
|
+
items: []
|
|
3256
|
+
});
|
|
3257
|
+
}
|
|
3258
|
+
const { reducerResults: pivotReducerResults, items: pivotGroupItems } = pivotDeepMap.get(currentPivotKeys);
|
|
3259
|
+
pivotGroupItems.push(item);
|
|
3260
|
+
if (reducers) {
|
|
3261
|
+
computeReducersFor(item, reducers, pivotReducerResults);
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
currentPivotKeys.length = 0;
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3199
3267
|
function group(groupParams, data) {
|
|
3200
3268
|
const {
|
|
3201
3269
|
groupBy,
|
|
@@ -3210,6 +3278,16 @@ function group(groupParams, data) {
|
|
|
3210
3278
|
let currentPivotKeys = [];
|
|
3211
3279
|
const initialReducerValue = initReducers(reducers);
|
|
3212
3280
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
3281
|
+
if (!groupByLength) {
|
|
3282
|
+
const deepMapGroupValue = {
|
|
3283
|
+
items: [],
|
|
3284
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
3285
|
+
};
|
|
3286
|
+
if (pivot) {
|
|
3287
|
+
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
3288
|
+
}
|
|
3289
|
+
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
3290
|
+
}
|
|
3213
3291
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
3214
3292
|
let item = data[i];
|
|
3215
3293
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -3226,38 +3304,10 @@ function group(groupParams, data) {
|
|
|
3226
3304
|
}
|
|
3227
3305
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
3228
3306
|
}
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
} = deepMap.get(currentGroupKeys);
|
|
3234
|
-
currentGroupItems.push(item);
|
|
3235
|
-
if (reducers) {
|
|
3236
|
-
computeReducersFor(item, reducers, reducerResults);
|
|
3237
|
-
}
|
|
3238
|
-
if (pivot) {
|
|
3239
|
-
for (let pivotIndex = 0, pivotLength = pivot.length; pivotIndex < pivotLength; pivotIndex++) {
|
|
3240
|
-
const { field: pivotField, toKey: pivotToKey } = pivot[pivotIndex];
|
|
3241
|
-
const pivotKey = (pivotToKey || defaultToKey)(item[pivotField], item);
|
|
3242
|
-
currentPivotKeys.push(pivotKey);
|
|
3243
|
-
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3244
|
-
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3245
|
-
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3246
|
-
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3247
|
-
items: []
|
|
3248
|
-
});
|
|
3249
|
-
}
|
|
3250
|
-
const {
|
|
3251
|
-
reducerResults: pivotReducerResults,
|
|
3252
|
-
items: pivotGroupItems
|
|
3253
|
-
} = pivotDeepMap.get(currentPivotKeys);
|
|
3254
|
-
pivotGroupItems.push(item);
|
|
3255
|
-
if (reducers) {
|
|
3256
|
-
computeReducersFor(item, reducers, pivotReducerResults);
|
|
3257
|
-
}
|
|
3258
|
-
}
|
|
3259
|
-
currentPivotKeys.length = 0;
|
|
3260
|
-
}
|
|
3307
|
+
processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, pivot, reducers, topLevelPivotColumns, initialReducerValue, defaultToKey);
|
|
3308
|
+
}
|
|
3309
|
+
if (!groupByLength) {
|
|
3310
|
+
processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, pivot, reducers, topLevelPivotColumns, initialReducerValue, defaultToKey);
|
|
3261
3311
|
}
|
|
3262
3312
|
if (reducers) {
|
|
3263
3313
|
computeReducersFor(item, reducers, globalReducerResults);
|
|
@@ -3476,20 +3526,6 @@ function useEffectWithChanges(fn, deps) {
|
|
|
3476
3526
|
}, useEffectDeps);
|
|
3477
3527
|
}
|
|
3478
3528
|
|
|
3479
|
-
// src/components/utils/debounce.ts
|
|
3480
|
-
function debounce(fn, { wait }) {
|
|
3481
|
-
let timeout = null;
|
|
3482
|
-
return function(...args) {
|
|
3483
|
-
const context = this;
|
|
3484
|
-
if (timeout !== null) {
|
|
3485
|
-
clearTimeout(timeout);
|
|
3486
|
-
}
|
|
3487
|
-
timeout = setTimeout(() => {
|
|
3488
|
-
fn.apply(context, args);
|
|
3489
|
-
}, wait);
|
|
3490
|
-
};
|
|
3491
|
-
}
|
|
3492
|
-
|
|
3493
3529
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
3494
3530
|
var getRafPromise = () => new Promise((resolve) => {
|
|
3495
3531
|
requestAnimationFrame(resolve);
|
|
@@ -3515,7 +3551,7 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
3515
3551
|
};
|
|
3516
3552
|
if (componentState.livePagination !== void 0) {
|
|
3517
3553
|
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
3518
|
-
dataSourceParams.
|
|
3554
|
+
dataSourceParams.__cursorId = componentState.cursorId;
|
|
3519
3555
|
}
|
|
3520
3556
|
if (componentState.lazyLoad) {
|
|
3521
3557
|
if (componentState.lazyLoadBatchSize != null && componentState.lazyLoadBatchSize > 0) {
|
|
@@ -3546,7 +3582,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
3546
3582
|
const lazyGroupData = componentState.originalLazyGroupData;
|
|
3547
3583
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
3548
3584
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
3549
|
-
if (existingGroupRowInfo && existingGroupRowInfo.cache) {
|
|
3585
|
+
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
3550
3586
|
const items = existingGroupRowInfo.items;
|
|
3551
3587
|
const len = items.length;
|
|
3552
3588
|
let allLoaded = true;
|
|
@@ -3612,10 +3648,14 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
3612
3648
|
lazyGroupData.set(key, newGroupRowInfo);
|
|
3613
3649
|
}
|
|
3614
3650
|
skipAssign = true;
|
|
3615
|
-
|
|
3651
|
+
let skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = false;
|
|
3616
3652
|
if (!dataParams.groupKeys || !dataParams.groupKeys.length) {
|
|
3617
3653
|
const topLevelItems = lazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]);
|
|
3618
3654
|
actions.originalDataArray = [...topLevelItems.items];
|
|
3655
|
+
skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = true;
|
|
3656
|
+
}
|
|
3657
|
+
if (!skipTriggerChangeAsAlreadyOriginalArrayWasUpdated) {
|
|
3658
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
3619
3659
|
}
|
|
3620
3660
|
}
|
|
3621
3661
|
} else {
|
|
@@ -3701,7 +3741,8 @@ function useLoadData() {
|
|
|
3701
3741
|
const componentState2 = getComponentState();
|
|
3702
3742
|
if (initialRef.current) {
|
|
3703
3743
|
initialRef.current = false;
|
|
3704
|
-
|
|
3744
|
+
const dataParams = buildDataSourceDataParams(componentState2);
|
|
3745
|
+
actions.dataParams = dataParams;
|
|
3705
3746
|
}
|
|
3706
3747
|
}, depsObject);
|
|
3707
3748
|
}
|
|
@@ -3714,7 +3755,6 @@ function useLazyLoadRange() {
|
|
|
3714
3755
|
const loadingCache = useMemo4(() => {
|
|
3715
3756
|
return new Map();
|
|
3716
3757
|
}, [componentState.data]);
|
|
3717
|
-
globalThis.loadingCache = loadingCache;
|
|
3718
3758
|
const {
|
|
3719
3759
|
lazyLoadBatchSize,
|
|
3720
3760
|
notifyRenderRangeChange,
|
|
@@ -3722,13 +3762,13 @@ function useLazyLoadRange() {
|
|
|
3722
3762
|
scrollStopDelayUpdatedByTable
|
|
3723
3763
|
} = componentState;
|
|
3724
3764
|
const latestRenderRangeRef = useRef6(null);
|
|
3725
|
-
const loadRange = (
|
|
3765
|
+
const loadRange = (renderRange, cache = loadingCache) => {
|
|
3726
3766
|
const componentState2 = getComponentState();
|
|
3727
|
-
|
|
3728
|
-
if (!
|
|
3767
|
+
renderRange = renderRange || latestRenderRangeRef.current;
|
|
3768
|
+
if (!renderRange) {
|
|
3729
3769
|
return;
|
|
3730
3770
|
}
|
|
3731
|
-
const { renderStartIndex: startIndex, renderEndIndex: endIndex } =
|
|
3771
|
+
const { renderStartIndex: startIndex, renderEndIndex: endIndex } = renderRange;
|
|
3732
3772
|
if (!lazyLoadBatchSize || lazyLoadBatchSize <= 0) {
|
|
3733
3773
|
return;
|
|
3734
3774
|
}
|
|
@@ -3743,9 +3783,9 @@ function useLazyLoadRange() {
|
|
|
3743
3783
|
const debouncedLoadRange = useMemo4(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
3744
3784
|
useEffect8(() => {
|
|
3745
3785
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
3746
|
-
return notifyRenderRangeChange.onChange((
|
|
3747
|
-
latestRenderRangeRef.current =
|
|
3748
|
-
loadRange(
|
|
3786
|
+
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
3787
|
+
latestRenderRangeRef.current = renderRange;
|
|
3788
|
+
loadRange(renderRange, loadingCache);
|
|
3749
3789
|
});
|
|
3750
3790
|
}
|
|
3751
3791
|
return;
|
|
@@ -4156,7 +4196,7 @@ function getInterceptActions() {
|
|
|
4156
4196
|
},
|
|
4157
4197
|
cursorId: (cursorId, { actions, state }) => {
|
|
4158
4198
|
const dataParams = buildDataSourceDataParams(state, {
|
|
4159
|
-
cursorId
|
|
4199
|
+
__cursorId: cursorId
|
|
4160
4200
|
});
|
|
4161
4201
|
actions.dataParams = dataParams;
|
|
4162
4202
|
},
|
|
@@ -4181,7 +4221,7 @@ function getInterceptActions() {
|
|
|
4181
4221
|
|
|
4182
4222
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
4183
4223
|
function prepareColumn(column) {
|
|
4184
|
-
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
4224
|
+
const { pivotByAtIndex: pivotByForColumn, pivotAggregator } = column;
|
|
4185
4225
|
if (pivotByForColumn == null ? void 0 : pivotByForColumn.column) {
|
|
4186
4226
|
if (typeof pivotByForColumn.column === "function") {
|
|
4187
4227
|
Object.assign(column, pivotByForColumn.column({ column }));
|
|
@@ -4189,6 +4229,13 @@ function prepareColumn(column) {
|
|
|
4189
4229
|
Object.assign(column, pivotByForColumn.column);
|
|
4190
4230
|
}
|
|
4191
4231
|
}
|
|
4232
|
+
if (pivotAggregator == null ? void 0 : pivotAggregator.pivotColumn) {
|
|
4233
|
+
if (typeof pivotAggregator.pivotColumn === "function") {
|
|
4234
|
+
Object.assign(column, pivotAggregator.pivotColumn({ column }));
|
|
4235
|
+
} else {
|
|
4236
|
+
Object.assign(column, pivotAggregator.pivotColumn);
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4192
4239
|
return column;
|
|
4193
4240
|
}
|
|
4194
4241
|
function prepareColumnGroup(columnGroup) {
|
|
@@ -4319,7 +4366,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
4319
4366
|
next == null ? void 0 : next();
|
|
4320
4367
|
}
|
|
4321
4368
|
});
|
|
4322
|
-
if (
|
|
4369
|
+
if (!pivotLength) {
|
|
4323
4370
|
aggregationReducers.forEach((reducer, index) => {
|
|
4324
4371
|
columns.set(`total:${reducer.id}`, prepareColumn({
|
|
4325
4372
|
header: `${reducer.name || reducer.id} total`,
|
|
@@ -4851,7 +4898,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
4851
4898
|
}, toggleGroupRow, groupColumn);
|
|
4852
4899
|
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
4853
4900
|
});
|
|
4854
|
-
} else if (groupRenderStrategy === "single-column") {
|
|
4901
|
+
} else if (groupRenderStrategy === "single-column" && groupBy.length) {
|
|
4855
4902
|
const singleGroupColumn = getSingleGroupColumn({
|
|
4856
4903
|
groupCount: groupBy.length,
|
|
4857
4904
|
groupBy,
|
|
@@ -4861,7 +4908,14 @@ function getColumnsWhenGrouping(params) {
|
|
|
4861
4908
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
4862
4909
|
}
|
|
4863
4910
|
if (pivotColumns) {
|
|
4911
|
+
const columnsByField = {};
|
|
4912
|
+
columns.forEach((col) => {
|
|
4913
|
+
if (col.field) {
|
|
4914
|
+
columnsByField[col.field] = col;
|
|
4915
|
+
}
|
|
4916
|
+
});
|
|
4864
4917
|
pivotColumns.forEach((col, key) => {
|
|
4918
|
+
var _a, _b;
|
|
4865
4919
|
if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
|
|
4866
4920
|
return;
|
|
4867
4921
|
}
|
|
@@ -4877,6 +4931,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
4877
4931
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
4878
4932
|
}
|
|
4879
4933
|
}
|
|
4934
|
+
if (column.inheritFromColumn !== false) {
|
|
4935
|
+
const colToInheritFrom = typeof column.inheritFromColumn === "string" ? columns.get(column.inheritFromColumn) : ((_a = column.pivotAggregator) == null ? void 0 : _a.field) ? columnsByField[(_b = column.pivotAggregator) == null ? void 0 : _b.field] : void 0;
|
|
4936
|
+
column = __spreadValues(__spreadValues({}, colToInheritFrom), column);
|
|
4937
|
+
}
|
|
4880
4938
|
if (!column.render && column.renderValue) {
|
|
4881
4939
|
column.render = (renderOptions) => {
|
|
4882
4940
|
return column.renderValue(renderOptions);
|
|
@@ -7315,8 +7373,8 @@ function PinnedRowsContainer(props) {
|
|
|
7315
7373
|
}
|
|
7316
7374
|
function useRenderPinnedRow(params) {
|
|
7317
7375
|
const { getData, getState, columnsWidth, columns, rowSpan, verticalBrain } = params;
|
|
7376
|
+
const dataArray = getData();
|
|
7318
7377
|
const renderPinnedRow = useCallback15((rowParams) => {
|
|
7319
|
-
const dataArray = getData();
|
|
7320
7378
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
7321
7379
|
const { showZebraRows, showHoverRows } = getState();
|
|
7322
7380
|
const rowProps = __spreadValues({
|
|
@@ -7333,7 +7391,7 @@ function useRenderPinnedRow(params) {
|
|
|
7333
7391
|
columns
|
|
7334
7392
|
}, rowParams);
|
|
7335
7393
|
return /* @__PURE__ */ createElement28(TableRowUnvirtualized, __spreadValues({}, rowProps));
|
|
7336
|
-
}, [columnsWidth, columns, verticalBrain]);
|
|
7394
|
+
}, [columnsWidth, columns, verticalBrain, dataArray]);
|
|
7337
7395
|
return renderPinnedRow;
|
|
7338
7396
|
}
|
|
7339
7397
|
function usePinnedRenderingForSide(side, params) {
|
|
@@ -7371,6 +7429,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
7371
7429
|
const renderRowPinned = useRenderPinnedRow({
|
|
7372
7430
|
getData,
|
|
7373
7431
|
getState,
|
|
7432
|
+
repaintId,
|
|
7374
7433
|
toggleGroupRow,
|
|
7375
7434
|
rowSpan,
|
|
7376
7435
|
verticalBrain: verticalVirtualBrain,
|
|
@@ -7516,7 +7575,7 @@ function useListRendering(param) {
|
|
|
7516
7575
|
} = componentState;
|
|
7517
7576
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
7518
7577
|
const repaintIdRef = useRef17(0);
|
|
7519
|
-
if (!shallowEqualObjects(prevComputed, computed)
|
|
7578
|
+
if (prevDataSourceTimestamp !== dataSourceState.updatedAt || !shallowEqualObjects(prevComputed, computed)) {
|
|
7520
7579
|
repaintIdRef.current++;
|
|
7521
7580
|
}
|
|
7522
7581
|
const repaintId = repaintIdRef.current;
|
|
@@ -7861,7 +7920,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7861
7920
|
const valid = useMemo12(() => {
|
|
7862
7921
|
let valid2 = isValidLicense(licenseKey, {
|
|
7863
7922
|
publishedAt: 1624970570587,
|
|
7864
|
-
version: "0.2.
|
|
7923
|
+
version: "0.2.14"
|
|
7865
7924
|
});
|
|
7866
7925
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
7867
7926
|
return true;
|
|
@@ -8350,6 +8409,7 @@ export {
|
|
|
8350
8409
|
InfiniteTable,
|
|
8351
8410
|
InfiniteTableClassName,
|
|
8352
8411
|
InfiniteTableComponent,
|
|
8412
|
+
debounce,
|
|
8353
8413
|
flatten,
|
|
8354
8414
|
getComponentStateRoot,
|
|
8355
8415
|
group,
|