@infinite-table/infinite-react 0.2.14 → 0.2.17
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 +45 -13
- package/index.esm.js +295 -183
- package/index.js +328 -218
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -637,7 +637,9 @@ __export(exports, {
|
|
|
637
637
|
multisort: () => multisort,
|
|
638
638
|
useComponentState: () => useComponentState,
|
|
639
639
|
useDataSource: () => useDataSource,
|
|
640
|
-
useEffectWithChanges: () => useEffectWithChanges
|
|
640
|
+
useEffectWithChanges: () => useEffectWithChanges,
|
|
641
|
+
useInfiniteColumnCell: () => useInfiniteColumnCell,
|
|
642
|
+
useInfiniteHeaderCell: () => useInfiniteHeaderCell
|
|
641
643
|
});
|
|
642
644
|
|
|
643
645
|
// src/components/utils/debounce.ts
|
|
@@ -1319,6 +1321,7 @@ var forwardProps = (setupState) => {
|
|
|
1319
1321
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
1320
1322
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
1321
1323
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
1324
|
+
pivotGrandTotalColumnPosition: 1,
|
|
1322
1325
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
1323
1326
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
1324
1327
|
header: (header) => header != null ? header : true,
|
|
@@ -1892,7 +1895,8 @@ var getComputedVisibleColumns = ({
|
|
|
1892
1895
|
valueGetter: colType.valueGetter,
|
|
1893
1896
|
renderValue: colType.renderValue,
|
|
1894
1897
|
render: colType.render,
|
|
1895
|
-
style: colType.style
|
|
1898
|
+
style: colType.style,
|
|
1899
|
+
components: colType.components
|
|
1896
1900
|
}, c), {
|
|
1897
1901
|
cssEllipsis,
|
|
1898
1902
|
headerCssEllipsis,
|
|
@@ -2152,7 +2156,7 @@ var useComputedVisibleColumns = ({
|
|
|
2152
2156
|
var sortAscending = (a, b) => a - b;
|
|
2153
2157
|
|
|
2154
2158
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
2155
|
-
var
|
|
2159
|
+
var import_react19 = __toModule(require("react"));
|
|
2156
2160
|
|
|
2157
2161
|
// src/components/hooks/useComponentState/index.tsx
|
|
2158
2162
|
var React2 = __toModule(require("react"));
|
|
@@ -2536,7 +2540,7 @@ function useColumnGroups() {
|
|
|
2536
2540
|
}
|
|
2537
2541
|
|
|
2538
2542
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2539
|
-
var
|
|
2543
|
+
var import_react18 = __toModule(require("react"));
|
|
2540
2544
|
|
|
2541
2545
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2542
2546
|
var React6 = __toModule(require("react"));
|
|
@@ -2610,6 +2614,11 @@ var userSelect = { none: "_16lm1iwm" };
|
|
|
2610
2614
|
var willChange = { transform: "_16lm1iw19" };
|
|
2611
2615
|
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2612
2616
|
|
|
2617
|
+
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
2618
|
+
function RenderHookComponent(props) {
|
|
2619
|
+
return props.render(props.renderParam);
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2613
2622
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2614
2623
|
function getGroupColumnRender({
|
|
2615
2624
|
groupIndexForColumn,
|
|
@@ -2620,7 +2629,10 @@ function getGroupColumnRender({
|
|
|
2620
2629
|
var _a, _b, _c;
|
|
2621
2630
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
2622
2631
|
if (column.renderValue) {
|
|
2623
|
-
value =
|
|
2632
|
+
value = /* @__PURE__ */ React6.createElement(RenderHookComponent, {
|
|
2633
|
+
render: column.renderValue,
|
|
2634
|
+
renderParam: renderOptions
|
|
2635
|
+
});
|
|
2624
2636
|
}
|
|
2625
2637
|
let groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndexForColumn]) || rowInfo;
|
|
2626
2638
|
if (!groupRowInfo) {
|
|
@@ -2652,7 +2664,10 @@ function getGroupColumnRender({
|
|
|
2652
2664
|
toggleGroupRow(groupKeys);
|
|
2653
2665
|
}
|
|
2654
2666
|
});
|
|
2655
|
-
icon = column.renderGroupIcon ?
|
|
2667
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React6.createElement(RenderHookComponent, {
|
|
2668
|
+
render: column.renderGroupIcon,
|
|
2669
|
+
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
2670
|
+
}) : defaultIcon;
|
|
2656
2671
|
}
|
|
2657
2672
|
return /* @__PURE__ */ React6.createElement("div", {
|
|
2658
2673
|
className: join(display.flex, alignItems.center)
|
|
@@ -2729,8 +2744,29 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2729
2744
|
return generatedGroupColumn;
|
|
2730
2745
|
}
|
|
2731
2746
|
|
|
2747
|
+
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
2748
|
+
var import_react14 = __toModule(require("react"));
|
|
2749
|
+
function useEffectWithRaf(fn, deps) {
|
|
2750
|
+
const rafId = (0, import_react14.useRef)(0);
|
|
2751
|
+
const removeFnRaf = (0, import_react14.useRef)();
|
|
2752
|
+
(0, import_react14.useEffect)(() => {
|
|
2753
|
+
rafId.current = requestAnimationFrame(() => {
|
|
2754
|
+
removeFnRaf.current = fn();
|
|
2755
|
+
});
|
|
2756
|
+
return () => {
|
|
2757
|
+
if (rafId.current) {
|
|
2758
|
+
cancelAnimationFrame(rafId.current);
|
|
2759
|
+
}
|
|
2760
|
+
if (typeof removeFnRaf.current === "function") {
|
|
2761
|
+
removeFnRaf.current();
|
|
2762
|
+
removeFnRaf.current = void 0;
|
|
2763
|
+
}
|
|
2764
|
+
};
|
|
2765
|
+
}, deps);
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2732
2768
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2733
|
-
var
|
|
2769
|
+
var import_react17 = __toModule(require("react"));
|
|
2734
2770
|
|
|
2735
2771
|
// src/components/DataSource/index.tsx
|
|
2736
2772
|
var React7 = __toModule(require("react"));
|
|
@@ -2810,7 +2846,7 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
2810
2846
|
};
|
|
2811
2847
|
|
|
2812
2848
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2813
|
-
var
|
|
2849
|
+
var import_react16 = __toModule(require("react"));
|
|
2814
2850
|
|
|
2815
2851
|
// src/utils/DeepMap/once.ts
|
|
2816
2852
|
function once(fn) {
|
|
@@ -2896,14 +2932,13 @@ var DeepMap = class {
|
|
|
2896
2932
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2897
2933
|
const key = keys[i];
|
|
2898
2934
|
const last = i === len - 1;
|
|
2935
|
+
const pair = currentMap.get(key) || {};
|
|
2899
2936
|
if (last) {
|
|
2900
|
-
const pair = currentMap.has(key) ? currentMap.get(key) : {};
|
|
2901
2937
|
pair.revision = this.revision++;
|
|
2902
2938
|
pair.value = value;
|
|
2903
2939
|
currentMap.set(key, pair);
|
|
2904
2940
|
this.length++;
|
|
2905
2941
|
} else {
|
|
2906
|
-
const pair = currentMap.has(key) ? currentMap.get(key) : {};
|
|
2907
2942
|
if (!pair.map) {
|
|
2908
2943
|
pair.map = new Map();
|
|
2909
2944
|
currentMap.set(key, pair);
|
|
@@ -2914,7 +2949,6 @@ var DeepMap = class {
|
|
|
2914
2949
|
return this;
|
|
2915
2950
|
}
|
|
2916
2951
|
get(keys) {
|
|
2917
|
-
var _a;
|
|
2918
2952
|
let currentMap = this.map;
|
|
2919
2953
|
if (!keys.length) {
|
|
2920
2954
|
keys = [this.emptyKey];
|
|
@@ -2922,10 +2956,10 @@ var DeepMap = class {
|
|
|
2922
2956
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2923
2957
|
const key = keys[i];
|
|
2924
2958
|
const last = i === len - 1;
|
|
2959
|
+
const pair = currentMap.get(key);
|
|
2925
2960
|
if (last) {
|
|
2926
|
-
return
|
|
2961
|
+
return pair ? pair.value : void 0;
|
|
2927
2962
|
} else {
|
|
2928
|
-
const pair = currentMap.get(key);
|
|
2929
2963
|
if (!pair || !pair.map) {
|
|
2930
2964
|
return;
|
|
2931
2965
|
}
|
|
@@ -2963,8 +2997,8 @@ var DeepMap = class {
|
|
|
2963
2997
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2964
2998
|
const key = keys[i];
|
|
2965
2999
|
const last = i === len - 1;
|
|
3000
|
+
const pair = currentMap.get(key);
|
|
2966
3001
|
if (last) {
|
|
2967
|
-
const pair = currentMap.get(key);
|
|
2968
3002
|
if (pair) {
|
|
2969
3003
|
if (pair.hasOwnProperty("value")) {
|
|
2970
3004
|
delete pair.value;
|
|
@@ -2981,7 +3015,6 @@ var DeepMap = class {
|
|
|
2981
3015
|
}
|
|
2982
3016
|
break;
|
|
2983
3017
|
} else {
|
|
2984
|
-
const pair = currentMap.get(key);
|
|
2985
3018
|
if (!pair || !pair.map) {
|
|
2986
3019
|
result = false;
|
|
2987
3020
|
break;
|
|
@@ -2991,11 +3024,11 @@ var DeepMap = class {
|
|
|
2991
3024
|
}
|
|
2992
3025
|
}
|
|
2993
3026
|
while (maps.length) {
|
|
2994
|
-
|
|
2995
|
-
|
|
3027
|
+
const map2 = maps.pop();
|
|
3028
|
+
const key = keys.pop();
|
|
2996
3029
|
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2997
|
-
|
|
2998
|
-
|
|
3030
|
+
const parentMap = maps[maps.length - 1];
|
|
3031
|
+
const pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2999
3032
|
if (pair) {
|
|
3000
3033
|
delete pair.map;
|
|
3001
3034
|
if (!pair.hasOwnProperty("value")) {
|
|
@@ -3014,11 +3047,10 @@ var DeepMap = class {
|
|
|
3014
3047
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
3015
3048
|
const key = keys[i];
|
|
3016
3049
|
const last = i === len - 1;
|
|
3050
|
+
const pair = currentMap.get(key);
|
|
3017
3051
|
if (last) {
|
|
3018
|
-
|
|
3019
|
-
return !!pair && pair.hasOwnProperty("value");
|
|
3052
|
+
return pair ? pair.hasOwnProperty("value") : false;
|
|
3020
3053
|
} else {
|
|
3021
|
-
const pair = currentMap.get(key);
|
|
3022
3054
|
if (!pair || !pair.map) {
|
|
3023
3055
|
return false;
|
|
3024
3056
|
}
|
|
@@ -3486,12 +3518,12 @@ function enhancedFlatten(param) {
|
|
|
3486
3518
|
}
|
|
3487
3519
|
|
|
3488
3520
|
// src/components/hooks/useEffectWithChanges.ts
|
|
3489
|
-
var
|
|
3521
|
+
var import_react15 = __toModule(require("react"));
|
|
3490
3522
|
function useEffectWithChanges(fn, deps) {
|
|
3491
|
-
const prevRef = (0,
|
|
3492
|
-
const oldValuesRef = (0,
|
|
3523
|
+
const prevRef = (0, import_react15.useRef)({});
|
|
3524
|
+
const oldValuesRef = (0, import_react15.useRef)({});
|
|
3493
3525
|
const oldValues = oldValuesRef.current;
|
|
3494
|
-
const changesRef = (0,
|
|
3526
|
+
const changesRef = (0, import_react15.useRef)({});
|
|
3495
3527
|
const changes = changesRef.current;
|
|
3496
3528
|
const useEffectDeps = [];
|
|
3497
3529
|
for (let k in deps) {
|
|
@@ -3504,7 +3536,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
3504
3536
|
}
|
|
3505
3537
|
}
|
|
3506
3538
|
prevRef.current = deps;
|
|
3507
|
-
(0,
|
|
3539
|
+
(0, import_react15.useEffect)(() => {
|
|
3508
3540
|
const changes2 = changesRef.current;
|
|
3509
3541
|
const result = fn(changes2, oldValues);
|
|
3510
3542
|
changesRef.current = {};
|
|
@@ -3672,12 +3704,12 @@ function useLoadData() {
|
|
|
3672
3704
|
livePaginationCursor,
|
|
3673
3705
|
cursorId: stateCursorId
|
|
3674
3706
|
} = componentState;
|
|
3675
|
-
const [scrollbars, setScrollbars] = (0,
|
|
3707
|
+
const [scrollbars, setScrollbars] = (0, import_react16.useState)({
|
|
3676
3708
|
vertical: false,
|
|
3677
3709
|
horizontal: false
|
|
3678
3710
|
});
|
|
3679
|
-
const scrollbarsRef = (0,
|
|
3680
|
-
(0,
|
|
3711
|
+
const scrollbarsRef = (0, import_react16.useRef)(scrollbars);
|
|
3712
|
+
(0, import_react16.useEffect)(() => {
|
|
3681
3713
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
3682
3714
|
if (!scrollbars2) {
|
|
3683
3715
|
return;
|
|
@@ -3687,7 +3719,7 @@ function useLoadData() {
|
|
|
3687
3719
|
});
|
|
3688
3720
|
return () => notifyScrollbarsChange.destroy();
|
|
3689
3721
|
}, [notifyScrollbarsChange]);
|
|
3690
|
-
(0,
|
|
3722
|
+
(0, import_react16.useEffect)(() => {
|
|
3691
3723
|
const frameId = requestAnimationFrame(() => {
|
|
3692
3724
|
var _a;
|
|
3693
3725
|
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical) && livePaginationCursor) {
|
|
@@ -3696,7 +3728,7 @@ function useLoadData() {
|
|
|
3696
3728
|
});
|
|
3697
3729
|
return () => cancelAnimationFrame(frameId);
|
|
3698
3730
|
}, [livePaginationCursor]);
|
|
3699
|
-
(0,
|
|
3731
|
+
(0, import_react16.useEffect)(() => {
|
|
3700
3732
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2 } = getComponentState();
|
|
3701
3733
|
if (!scrollbars.vertical && livePagination2) {
|
|
3702
3734
|
if (livePaginationCursor2) {
|
|
@@ -3710,7 +3742,7 @@ function useLoadData() {
|
|
|
3710
3742
|
pivotBy,
|
|
3711
3743
|
cursorId: livePagination ? stateCursorId : null
|
|
3712
3744
|
};
|
|
3713
|
-
const initialRef = (0,
|
|
3745
|
+
const initialRef = (0, import_react16.useRef)(true);
|
|
3714
3746
|
useLazyLoadRange();
|
|
3715
3747
|
useEffectWithChanges(() => {
|
|
3716
3748
|
const componentState2 = getComponentState();
|
|
@@ -3739,7 +3771,7 @@ function useLazyLoadRange() {
|
|
|
3739
3771
|
componentActions: actions,
|
|
3740
3772
|
componentState
|
|
3741
3773
|
} = useComponentState();
|
|
3742
|
-
const loadingCache = (0,
|
|
3774
|
+
const loadingCache = (0, import_react16.useMemo)(() => {
|
|
3743
3775
|
return new Map();
|
|
3744
3776
|
}, [componentState.data]);
|
|
3745
3777
|
const {
|
|
@@ -3748,7 +3780,7 @@ function useLazyLoadRange() {
|
|
|
3748
3780
|
dataArray,
|
|
3749
3781
|
scrollStopDelayUpdatedByTable
|
|
3750
3782
|
} = componentState;
|
|
3751
|
-
const latestRenderRangeRef = (0,
|
|
3783
|
+
const latestRenderRangeRef = (0, import_react16.useRef)(null);
|
|
3752
3784
|
const loadRange = (renderRange, cache = loadingCache) => {
|
|
3753
3785
|
const componentState2 = getComponentState();
|
|
3754
3786
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -3767,8 +3799,8 @@ function useLazyLoadRange() {
|
|
|
3767
3799
|
componentActions: actions
|
|
3768
3800
|
}, cache);
|
|
3769
3801
|
};
|
|
3770
|
-
const debouncedLoadRange = (0,
|
|
3771
|
-
(0,
|
|
3802
|
+
const debouncedLoadRange = (0, import_react16.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
3803
|
+
(0, import_react16.useEffect)(() => {
|
|
3772
3804
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
3773
3805
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
3774
3806
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -3777,7 +3809,7 @@ function useLazyLoadRange() {
|
|
|
3777
3809
|
}
|
|
3778
3810
|
return;
|
|
3779
3811
|
}, [lazyLoadBatchSize, loadingCache]);
|
|
3780
|
-
(0,
|
|
3812
|
+
(0, import_react16.useEffect)(() => {
|
|
3781
3813
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
3782
3814
|
debouncedLoadRange();
|
|
3783
3815
|
}
|
|
@@ -4053,6 +4085,7 @@ function initSetupState2() {
|
|
|
4053
4085
|
notifyScrollStop: buildSubscriptionCallback(),
|
|
4054
4086
|
notifyRenderRangeChange: buildSubscriptionCallback(),
|
|
4055
4087
|
pivotTotalColumnPosition: "end",
|
|
4088
|
+
pivotGrandTotalColumnPosition: false,
|
|
4056
4089
|
scrollStopDelayUpdatedByTable: 100,
|
|
4057
4090
|
originalLazyGroupData,
|
|
4058
4091
|
originalLazyGroupDataChangeDetect: 0,
|
|
@@ -4240,6 +4273,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
4240
4273
|
deepMap,
|
|
4241
4274
|
pivotBy,
|
|
4242
4275
|
pivotTotalColumnPosition,
|
|
4276
|
+
pivotGrandTotalColumnPosition,
|
|
4243
4277
|
reducers = {},
|
|
4244
4278
|
showSeparatePivotColumnForSingleAggregation = false
|
|
4245
4279
|
}) {
|
|
@@ -4249,6 +4283,28 @@ function getPivotColumnsAndColumnGroups({
|
|
|
4249
4283
|
});
|
|
4250
4284
|
const columns = new Map([]);
|
|
4251
4285
|
const columnGroups = new Map();
|
|
4286
|
+
const addGrandTotalColumns = once(function() {
|
|
4287
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
4288
|
+
columns.set(`total:${reducer.id}`, prepareColumn({
|
|
4289
|
+
header: `${reducer.name || reducer.id} total`,
|
|
4290
|
+
pivotBy,
|
|
4291
|
+
pivotColumn: true,
|
|
4292
|
+
pivotTotalColumn: true,
|
|
4293
|
+
pivotAggregator: reducer,
|
|
4294
|
+
pivotAggregatorIndex: index,
|
|
4295
|
+
pivotGroupKeys: [],
|
|
4296
|
+
pivotGroupKey: "",
|
|
4297
|
+
pivotIndex: -1,
|
|
4298
|
+
valueGetter: ({ rowInfo }) => {
|
|
4299
|
+
var _a;
|
|
4300
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
4301
|
+
}
|
|
4302
|
+
}));
|
|
4303
|
+
});
|
|
4304
|
+
});
|
|
4305
|
+
if (!pivotLength && pivotTotalColumnPosition === "start" || pivotGrandTotalColumnPosition === "start") {
|
|
4306
|
+
addGrandTotalColumns();
|
|
4307
|
+
}
|
|
4252
4308
|
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
4253
4309
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
4254
4310
|
keys = [...keys];
|
|
@@ -4353,25 +4409,10 @@ function getPivotColumnsAndColumnGroups({
|
|
|
4353
4409
|
next == null ? void 0 : next();
|
|
4354
4410
|
}
|
|
4355
4411
|
});
|
|
4356
|
-
if (!pivotLength) {
|
|
4357
|
-
|
|
4358
|
-
columns.set(`total:${reducer.id}`, prepareColumn({
|
|
4359
|
-
header: `${reducer.name || reducer.id} total`,
|
|
4360
|
-
pivotBy,
|
|
4361
|
-
pivotColumn: true,
|
|
4362
|
-
pivotTotalColumn: true,
|
|
4363
|
-
pivotAggregator: reducer,
|
|
4364
|
-
pivotAggregatorIndex: index,
|
|
4365
|
-
pivotGroupKeys: [],
|
|
4366
|
-
pivotGroupKey: "",
|
|
4367
|
-
pivotIndex: -1,
|
|
4368
|
-
valueGetter: ({ rowInfo }) => {
|
|
4369
|
-
var _a;
|
|
4370
|
-
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
4371
|
-
}
|
|
4372
|
-
}));
|
|
4373
|
-
});
|
|
4412
|
+
if (!pivotLength && pivotTotalColumnPosition === "end" || pivotGrandTotalColumnPosition === "end") {
|
|
4413
|
+
addGrandTotalColumns();
|
|
4374
4414
|
}
|
|
4415
|
+
console.log(columns.keys());
|
|
4375
4416
|
const result = {
|
|
4376
4417
|
columns,
|
|
4377
4418
|
columnGroups
|
|
@@ -4402,7 +4443,7 @@ function toRowInfo(data, id, index) {
|
|
|
4402
4443
|
};
|
|
4403
4444
|
}
|
|
4404
4445
|
function concludeReducer(params) {
|
|
4405
|
-
var _a;
|
|
4446
|
+
var _a, _b;
|
|
4406
4447
|
const { state, previousState } = params;
|
|
4407
4448
|
const sortInfo = state.sortInfo;
|
|
4408
4449
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
@@ -4437,6 +4478,7 @@ function concludeReducer(params) {
|
|
|
4437
4478
|
"pivotBy",
|
|
4438
4479
|
"aggregationReducers",
|
|
4439
4480
|
"pivotTotalColumnPosition",
|
|
4481
|
+
"pivotGrandTotalColumnPosition",
|
|
4440
4482
|
"showSeparatePivotColumnForSingleAggregation",
|
|
4441
4483
|
"sortInfo"
|
|
4442
4484
|
]);
|
|
@@ -4483,6 +4525,7 @@ function concludeReducer(params) {
|
|
|
4483
4525
|
deepMap: groupResult.topLevelPivotColumns,
|
|
4484
4526
|
pivotBy,
|
|
4485
4527
|
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
4528
|
+
pivotGrandTotalColumnPosition: (_b = state.pivotGrandTotalColumnPosition) != null ? _b : false,
|
|
4486
4529
|
reducers: state.aggregationReducers,
|
|
4487
4530
|
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
4488
4531
|
}) : void 0;
|
|
@@ -4564,7 +4607,7 @@ function DataSource(props) {
|
|
|
4564
4607
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
4565
4608
|
function useToggleGroupRow() {
|
|
4566
4609
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
4567
|
-
const toggleGroupRow = (0,
|
|
4610
|
+
const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
|
|
4568
4611
|
const state = getDataSourceState();
|
|
4569
4612
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
4570
4613
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -4580,7 +4623,7 @@ function useToggleGroupRow() {
|
|
|
4580
4623
|
|
|
4581
4624
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
4582
4625
|
function useGroupByMap(groupBy) {
|
|
4583
|
-
const groupByMap = (0,
|
|
4626
|
+
const groupByMap = (0, import_react18.useMemo)(() => {
|
|
4584
4627
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
4585
4628
|
acc.set(groupBy2.field, {
|
|
4586
4629
|
groupBy: groupBy2,
|
|
@@ -4597,15 +4640,24 @@ function useColumnsWhen() {
|
|
|
4597
4640
|
componentActions: dataSourceActions
|
|
4598
4641
|
} = useDataSourceContextValue();
|
|
4599
4642
|
const {
|
|
4600
|
-
componentState: {
|
|
4643
|
+
componentState: {
|
|
4644
|
+
groupRenderStrategy,
|
|
4645
|
+
pivotTotalColumnPosition,
|
|
4646
|
+
pivotGrandTotalColumnPosition
|
|
4647
|
+
}
|
|
4601
4648
|
} = useComponentState();
|
|
4602
4649
|
const groupByMap = useGroupByMap(groupBy);
|
|
4603
|
-
(0,
|
|
4650
|
+
(0, import_react18.useEffect)(() => {
|
|
4604
4651
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
4605
4652
|
}, [groupRenderStrategy]);
|
|
4606
|
-
(0,
|
|
4653
|
+
(0, import_react18.useEffect)(() => {
|
|
4607
4654
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
4608
4655
|
}, [pivotTotalColumnPosition]);
|
|
4656
|
+
(0, import_react18.useEffect)(() => {
|
|
4657
|
+
if (pivotGrandTotalColumnPosition != void 0) {
|
|
4658
|
+
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
4659
|
+
}
|
|
4660
|
+
}, [pivotGrandTotalColumnPosition]);
|
|
4609
4661
|
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
4610
4662
|
const { toggleGroupRow } = useColumnsWhenGrouping();
|
|
4611
4663
|
useHideColumns(groupByMap);
|
|
@@ -4669,7 +4721,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
4669
4721
|
});
|
|
4670
4722
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
4671
4723
|
}
|
|
4672
|
-
(0,
|
|
4724
|
+
(0, import_react18.useEffect)(() => {
|
|
4673
4725
|
const update = () => {
|
|
4674
4726
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
4675
4727
|
};
|
|
@@ -4693,17 +4745,19 @@ function useColumnsWhenGrouping() {
|
|
|
4693
4745
|
groupRenderStrategy,
|
|
4694
4746
|
pivotColumns,
|
|
4695
4747
|
pivotColumn,
|
|
4696
|
-
pivotTotalColumnPosition
|
|
4748
|
+
pivotTotalColumnPosition,
|
|
4749
|
+
pivotGrandTotalColumnPosition
|
|
4697
4750
|
}
|
|
4698
4751
|
} = useComponentState();
|
|
4699
4752
|
const toggleGroupRow = useToggleGroupRow();
|
|
4700
|
-
(0,
|
|
4753
|
+
(0, import_react18.useEffect)(() => {
|
|
4701
4754
|
const update = () => {
|
|
4702
4755
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
4703
4756
|
columns,
|
|
4704
4757
|
groupColumn,
|
|
4705
4758
|
pivotColumn,
|
|
4706
4759
|
pivotTotalColumnPosition,
|
|
4760
|
+
pivotGrandTotalColumnPosition,
|
|
4707
4761
|
groupRenderStrategy: groupRenderStrategy === "inline" ? "single-column" : groupRenderStrategy,
|
|
4708
4762
|
groupBy,
|
|
4709
4763
|
pivotBy,
|
|
@@ -4751,7 +4805,7 @@ function useHideColumns(groupByMap) {
|
|
|
4751
4805
|
}
|
|
4752
4806
|
} = useComponentState();
|
|
4753
4807
|
const prevHideEmptyGroupColumns = usePrevious(hideEmptyGroupColumns);
|
|
4754
|
-
(
|
|
4808
|
+
useEffectWithRaf(() => {
|
|
4755
4809
|
if (groupRenderStrategy !== "multi-column") {
|
|
4756
4810
|
return;
|
|
4757
4811
|
}
|
|
@@ -4829,7 +4883,7 @@ function useHideColumns(groupByMap) {
|
|
|
4829
4883
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
4830
4884
|
hideEmptyGroupColumns
|
|
4831
4885
|
]);
|
|
4832
|
-
(0,
|
|
4886
|
+
(0, import_react18.useEffect)(() => {
|
|
4833
4887
|
const isGrouped = groupBy.length > 0;
|
|
4834
4888
|
const currentState = getComponentState();
|
|
4835
4889
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -4864,6 +4918,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
4864
4918
|
pivotBy,
|
|
4865
4919
|
groupColumn,
|
|
4866
4920
|
pivotTotalColumnPosition,
|
|
4921
|
+
pivotGrandTotalColumnPosition,
|
|
4867
4922
|
pivotColumn,
|
|
4868
4923
|
groupRenderStrategy,
|
|
4869
4924
|
toggleGroupRow,
|
|
@@ -4903,7 +4958,12 @@ function getColumnsWhenGrouping(params) {
|
|
|
4903
4958
|
});
|
|
4904
4959
|
pivotColumns.forEach((col, key) => {
|
|
4905
4960
|
var _a, _b;
|
|
4906
|
-
|
|
4961
|
+
const isSimpleTotalColumn = col.pivotTotalColumn && col.columnGroup;
|
|
4962
|
+
const isGrandTotalColumn = col.pivotTotalColumn && !col.columnGroup;
|
|
4963
|
+
if (isSimpleTotalColumn && pivotTotalColumnPosition === false) {
|
|
4964
|
+
return;
|
|
4965
|
+
}
|
|
4966
|
+
if (isGrandTotalColumn && pivotGrandTotalColumnPosition === false) {
|
|
4907
4967
|
return;
|
|
4908
4968
|
}
|
|
4909
4969
|
let column = __spreadValues({}, col);
|
|
@@ -4955,7 +5015,7 @@ function useComputed() {
|
|
|
4955
5015
|
bodySize,
|
|
4956
5016
|
showSeparatePivotColumnForSingleAggregation
|
|
4957
5017
|
} = componentState;
|
|
4958
|
-
(0,
|
|
5018
|
+
(0, import_react19.useState)(() => {
|
|
4959
5019
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
4960
5020
|
if (rowHeight) {
|
|
4961
5021
|
componentActions.rowHeight = rowHeight;
|
|
@@ -4967,13 +5027,13 @@ function useComputed() {
|
|
|
4967
5027
|
}
|
|
4968
5028
|
});
|
|
4969
5029
|
});
|
|
4970
|
-
(0,
|
|
5030
|
+
(0, import_react19.useEffect)(() => {
|
|
4971
5031
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
4972
5032
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
4973
5033
|
const { multiSort } = dataSourceState;
|
|
4974
5034
|
useColumnGroups();
|
|
4975
5035
|
const { toggleGroupRow } = useColumnsWhen();
|
|
4976
|
-
const setSortInfo = (0,
|
|
5036
|
+
const setSortInfo = (0, import_react19.useCallback)((sortInfo) => {
|
|
4977
5037
|
var _a2;
|
|
4978
5038
|
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
4979
5039
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -5017,7 +5077,7 @@ function useComputed() {
|
|
|
5017
5077
|
columnSizing,
|
|
5018
5078
|
columnTypes
|
|
5019
5079
|
});
|
|
5020
|
-
const rowSpan = (0,
|
|
5080
|
+
const rowSpan = (0, import_react19.useMemo)(() => {
|
|
5021
5081
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5022
5082
|
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
5023
5083
|
let maxSpan = 1;
|
|
@@ -5162,20 +5222,20 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
|
5162
5222
|
|
|
5163
5223
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
5164
5224
|
var React16 = __toModule(require("react"));
|
|
5165
|
-
var
|
|
5225
|
+
var import_react27 = __toModule(require("react"));
|
|
5166
5226
|
|
|
5167
5227
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
5168
5228
|
var React12 = __toModule(require("react"));
|
|
5169
|
-
var
|
|
5229
|
+
var import_react23 = __toModule(require("react"));
|
|
5170
5230
|
|
|
5171
5231
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
5172
5232
|
var React10 = __toModule(require("react"));
|
|
5173
5233
|
|
|
5174
5234
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
5175
|
-
var
|
|
5235
|
+
var import_react20 = __toModule(require("react"));
|
|
5176
5236
|
var useInfiniteTableState = () => {
|
|
5177
5237
|
const TableContext2 = getInfiniteTableContext();
|
|
5178
|
-
const { componentState } = (0,
|
|
5238
|
+
const { componentState } = (0, import_react20.useContext)(TableContext2);
|
|
5179
5239
|
return componentState;
|
|
5180
5240
|
};
|
|
5181
5241
|
|
|
@@ -5191,7 +5251,7 @@ var { rootClassName: rootClassName2 } = internalProps;
|
|
|
5191
5251
|
var InfiniteTableCellClassName = `${rootClassName2}Cell`;
|
|
5192
5252
|
var InfiniteTableCellContentClassName = `${rootClassName2}Cell_content`;
|
|
5193
5253
|
function InfiniteTableCellFn(props) {
|
|
5194
|
-
var _b, _c;
|
|
5254
|
+
var _b, _c, _d, _e;
|
|
5195
5255
|
const _a = props, {
|
|
5196
5256
|
cssEllipsis = true,
|
|
5197
5257
|
virtualized = true,
|
|
@@ -5199,10 +5259,12 @@ function InfiniteTableCellFn(props) {
|
|
|
5199
5259
|
offsetProperty = "left",
|
|
5200
5260
|
column,
|
|
5201
5261
|
domRef,
|
|
5202
|
-
children,
|
|
5203
5262
|
afterChildren,
|
|
5204
5263
|
beforeChildren,
|
|
5205
|
-
offset
|
|
5264
|
+
offset,
|
|
5265
|
+
cellType,
|
|
5266
|
+
cssPosition: _cssPosition,
|
|
5267
|
+
renderChildren
|
|
5206
5268
|
} = _a, domProps = __objRest(_a, [
|
|
5207
5269
|
"cssEllipsis",
|
|
5208
5270
|
"virtualized",
|
|
@@ -5210,11 +5272,14 @@ function InfiniteTableCellFn(props) {
|
|
|
5210
5272
|
"offsetProperty",
|
|
5211
5273
|
"column",
|
|
5212
5274
|
"domRef",
|
|
5213
|
-
"children",
|
|
5214
5275
|
"afterChildren",
|
|
5215
5276
|
"beforeChildren",
|
|
5216
|
-
"offset"
|
|
5277
|
+
"offset",
|
|
5278
|
+
"cellType",
|
|
5279
|
+
"cssPosition",
|
|
5280
|
+
"renderChildren"
|
|
5217
5281
|
]);
|
|
5282
|
+
const children = renderChildren();
|
|
5218
5283
|
const { columnShifts } = useInfiniteTableState();
|
|
5219
5284
|
const shifting = !!columnShifts;
|
|
5220
5285
|
const style = __spreadValues({
|
|
@@ -5229,20 +5294,27 @@ function InfiniteTableCellFn(props) {
|
|
|
5229
5294
|
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
5230
5295
|
}
|
|
5231
5296
|
}
|
|
5232
|
-
|
|
5233
|
-
ref: domRef,
|
|
5297
|
+
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
5234
5298
|
style,
|
|
5235
|
-
"data-name":
|
|
5236
|
-
className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : "")
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5299
|
+
"data-name": "Cell",
|
|
5300
|
+
className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
5301
|
+
children: /* @__PURE__ */ React10.createElement(React10.Fragment, null, beforeChildren, /* @__PURE__ */ React10.createElement("div", {
|
|
5302
|
+
className: `${InfiniteTableCellContentClassName} ${cssEllipsis ? cssEllipsisClassName : overflow.hidden}`
|
|
5303
|
+
}, children), afterChildren)
|
|
5304
|
+
});
|
|
5305
|
+
const RenderComponent = cellType === "body" ? (_d = column.components) == null ? void 0 : _d.ColumnCell : (_e = column.components) == null ? void 0 : _e.HeaderCell;
|
|
5306
|
+
if (RenderComponent) {
|
|
5307
|
+
return /* @__PURE__ */ React10.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
5308
|
+
}
|
|
5309
|
+
return /* @__PURE__ */ React10.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
5310
|
+
ref: domRef
|
|
5311
|
+
}));
|
|
5240
5312
|
}
|
|
5241
5313
|
var InfiniteTableCell = React10.memo(InfiniteTableCellFn);
|
|
5242
5314
|
|
|
5243
5315
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
5244
5316
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
5245
|
-
var
|
|
5317
|
+
var import_react21 = __toModule(require("react"));
|
|
5246
5318
|
|
|
5247
5319
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
5248
5320
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -5276,18 +5348,18 @@ var useColumnPointerEvents = ({
|
|
|
5276
5348
|
columns,
|
|
5277
5349
|
computedRemainingSpace
|
|
5278
5350
|
}) => {
|
|
5279
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
5280
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
5281
|
-
const breakpointsRef = (0,
|
|
5282
|
-
const pointerMoveRef = (0,
|
|
5283
|
-
const didDragRef = (0,
|
|
5284
|
-
const initialClientPos = (0,
|
|
5285
|
-
const currentDropIndexRef = (0,
|
|
5351
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react21.useState)(null);
|
|
5352
|
+
const [proxyOffset, setProxyOffset] = (0, import_react21.useState)(null);
|
|
5353
|
+
const breakpointsRef = (0, import_react21.useRef)([]);
|
|
5354
|
+
const pointerMoveRef = (0, import_react21.useRef)(null);
|
|
5355
|
+
const didDragRef = (0, import_react21.useRef)(false);
|
|
5356
|
+
const initialClientPos = (0, import_react21.useRef)(null);
|
|
5357
|
+
const currentDropIndexRef = (0, import_react21.useRef)(null);
|
|
5286
5358
|
const dragging = draggingDiff != null;
|
|
5287
5359
|
const { componentActions, computed } = useInfiniteTable();
|
|
5288
5360
|
const { computedColumnOrder } = computed;
|
|
5289
|
-
const column = (0,
|
|
5290
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
5361
|
+
const column = (0, import_react21.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
5362
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react21.useMemo)(() => {
|
|
5291
5363
|
const columnsArray2 = Array.from(columns.values());
|
|
5292
5364
|
return {
|
|
5293
5365
|
columnsArray: columnsArray2,
|
|
@@ -5295,8 +5367,8 @@ var useColumnPointerEvents = ({
|
|
|
5295
5367
|
columnWidth: column.computedWidth
|
|
5296
5368
|
};
|
|
5297
5369
|
}, [columns, columnId, column]);
|
|
5298
|
-
let cursorRef = (0,
|
|
5299
|
-
const onPointerDown = (0,
|
|
5370
|
+
let cursorRef = (0, import_react21.useRef)("auto");
|
|
5371
|
+
const onPointerDown = (0, import_react21.useCallback)((e) => {
|
|
5300
5372
|
const target = domRef.current;
|
|
5301
5373
|
cursorRef.current = target.style.cursor;
|
|
5302
5374
|
didDragRef.current = false;
|
|
@@ -5359,7 +5431,7 @@ var useColumnPointerEvents = ({
|
|
|
5359
5431
|
target.addEventListener("pointermove", onPointerMove);
|
|
5360
5432
|
target.setPointerCapture(e.pointerId);
|
|
5361
5433
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
5362
|
-
const onPointerUp = (0,
|
|
5434
|
+
const onPointerUp = (0, import_react21.useCallback)((e) => {
|
|
5363
5435
|
const target = domRef.current;
|
|
5364
5436
|
target.style.cursor = cursorRef.current;
|
|
5365
5437
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -5434,7 +5506,7 @@ var import_react_dom = __toModule(require("react-dom"));
|
|
|
5434
5506
|
|
|
5435
5507
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
5436
5508
|
var React11 = __toModule(require("react"));
|
|
5437
|
-
var
|
|
5509
|
+
var import_react22 = __toModule(require("react"));
|
|
5438
5510
|
var defaultLineStyle = {
|
|
5439
5511
|
marginTop: 2,
|
|
5440
5512
|
marginBottom: 2,
|
|
@@ -5443,8 +5515,8 @@ var defaultLineStyle = {
|
|
|
5443
5515
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
5444
5516
|
function SortIcon(props) {
|
|
5445
5517
|
var _a;
|
|
5446
|
-
const [rendered, setRendered] = (0,
|
|
5447
|
-
const [opacity, setOpacity] = (0,
|
|
5518
|
+
const [rendered, setRendered] = (0, import_react22.useState)(true);
|
|
5519
|
+
const [opacity, setOpacity] = (0, import_react22.useState)(0);
|
|
5448
5520
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
5449
5521
|
const showIndex = index != null && index > 0;
|
|
5450
5522
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -5458,7 +5530,7 @@ function SortIcon(props) {
|
|
|
5458
5530
|
}), props.lineStyle), {
|
|
5459
5531
|
opacity
|
|
5460
5532
|
});
|
|
5461
|
-
(0,
|
|
5533
|
+
(0, import_react22.useEffect)(() => {
|
|
5462
5534
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
5463
5535
|
if (!rendered && newOpacity) {
|
|
5464
5536
|
setRendered(true);
|
|
@@ -5505,6 +5577,7 @@ function SortIcon(props) {
|
|
|
5505
5577
|
}
|
|
5506
5578
|
|
|
5507
5579
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
5580
|
+
var InfiniteTableHeaderCellContext = React12.createContext(null);
|
|
5508
5581
|
var defaultStyle = {
|
|
5509
5582
|
position: "absolute",
|
|
5510
5583
|
top: 0
|
|
@@ -5523,29 +5596,38 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5523
5596
|
}
|
|
5524
5597
|
const sortInfo = column.computedSortInfo;
|
|
5525
5598
|
let header = column.header;
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
}
|
|
5532
|
-
header = header != null ? header : column.name;
|
|
5599
|
+
const ref = (0, import_react23.useCallback)((node) => {
|
|
5600
|
+
var _a2;
|
|
5601
|
+
domRef.current = node;
|
|
5602
|
+
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
5603
|
+
}, [props.domRef]);
|
|
5533
5604
|
const sortTool = /* @__PURE__ */ React12.createElement(SortIcon, {
|
|
5534
5605
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
5535
5606
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}`,
|
|
5536
5607
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
5537
5608
|
});
|
|
5538
|
-
const
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
}
|
|
5609
|
+
const renderParam = {
|
|
5610
|
+
domRef: ref,
|
|
5611
|
+
column,
|
|
5612
|
+
columnSortInfo: sortInfo,
|
|
5613
|
+
sortTool
|
|
5614
|
+
};
|
|
5615
|
+
const renderChildren = () => {
|
|
5616
|
+
if (header instanceof Function) {
|
|
5617
|
+
header = /* @__PURE__ */ React12.createElement(RenderHookComponent, {
|
|
5618
|
+
render: header,
|
|
5619
|
+
renderParam
|
|
5620
|
+
});
|
|
5621
|
+
}
|
|
5622
|
+
header = header != null ? header : column.name;
|
|
5623
|
+
return header;
|
|
5624
|
+
};
|
|
5625
|
+
const domRef = (0, import_react23.useRef)(null);
|
|
5544
5626
|
const {
|
|
5545
5627
|
computed: { computedRemainingSpace },
|
|
5546
5628
|
componentState: { portalDOMRef }
|
|
5547
5629
|
} = useInfiniteTable();
|
|
5548
|
-
(0,
|
|
5630
|
+
(0, import_react23.useEffect)(() => {
|
|
5549
5631
|
let clearOnResize = null;
|
|
5550
5632
|
const node = domRef.current;
|
|
5551
5633
|
if (onResize && node) {
|
|
@@ -5581,8 +5663,12 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5581
5663
|
}, header);
|
|
5582
5664
|
draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
|
|
5583
5665
|
}
|
|
5584
|
-
|
|
5666
|
+
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
5667
|
+
return /* @__PURE__ */ React12.createElement(ContextProvider, {
|
|
5668
|
+
value: renderParam
|
|
5669
|
+
}, /* @__PURE__ */ React12.createElement(InfiniteTableCell, {
|
|
5585
5670
|
domRef: ref,
|
|
5671
|
+
cellType: "header",
|
|
5586
5672
|
column,
|
|
5587
5673
|
"data-name": `HeaderCell`,
|
|
5588
5674
|
"data-column-id": column.id,
|
|
@@ -5592,20 +5678,25 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5592
5678
|
onPointerUp,
|
|
5593
5679
|
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging }), CellCls),
|
|
5594
5680
|
cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
|
|
5595
|
-
afterChildren: sortTool
|
|
5596
|
-
|
|
5681
|
+
afterChildren: sortTool,
|
|
5682
|
+
renderChildren
|
|
5683
|
+
}), draggingProxy);
|
|
5684
|
+
}
|
|
5685
|
+
function useInfiniteHeaderCell() {
|
|
5686
|
+
const result = (0, import_react23.useContext)(InfiniteTableHeaderCellContext);
|
|
5687
|
+
return result;
|
|
5597
5688
|
}
|
|
5598
5689
|
|
|
5599
5690
|
// src/components/RawList/index.tsx
|
|
5600
5691
|
var React15 = __toModule(require("react"));
|
|
5601
|
-
var
|
|
5692
|
+
var import_react26 = __toModule(require("react"));
|
|
5602
5693
|
|
|
5603
5694
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
5604
5695
|
var React13 = __toModule(require("react"));
|
|
5605
|
-
var
|
|
5696
|
+
var import_react24 = __toModule(require("react"));
|
|
5606
5697
|
function AvoidReactDiffFn(props) {
|
|
5607
|
-
const [children, setChildren] = (0,
|
|
5608
|
-
(0,
|
|
5698
|
+
const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
|
|
5699
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
5609
5700
|
const remove = props.updater.onChange((children2) => {
|
|
5610
5701
|
setChildren(children2);
|
|
5611
5702
|
});
|
|
@@ -5616,7 +5707,7 @@ function AvoidReactDiffFn(props) {
|
|
|
5616
5707
|
var AvoidReactDiff = React13.memo(AvoidReactDiffFn);
|
|
5617
5708
|
|
|
5618
5709
|
// src/components/RawList/useVirtualRenderer.ts
|
|
5619
|
-
var
|
|
5710
|
+
var import_react25 = __toModule(require("react"));
|
|
5620
5711
|
|
|
5621
5712
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
5622
5713
|
var React14 = __toModule(require("react"));
|
|
@@ -5900,7 +5991,7 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
5900
5991
|
}
|
|
5901
5992
|
this.mappedItems.renderItemAtElement(itemIndex, elementIndex, renderedNode);
|
|
5902
5993
|
if (true) {
|
|
5903
|
-
this.
|
|
5994
|
+
dbg(`ReactVirtualRenderer:${this.brain.getOptions().mainAxis}`)(`Render item ${itemIndex} at element ${elementIndex}`);
|
|
5904
5995
|
}
|
|
5905
5996
|
itemUpdater(renderedNode);
|
|
5906
5997
|
this.updateElementPosition(elementIndex);
|
|
@@ -5930,7 +6021,7 @@ function createRenderer(brain) {
|
|
|
5930
6021
|
function useVirtualRenderer({
|
|
5931
6022
|
brain
|
|
5932
6023
|
}) {
|
|
5933
|
-
return (0,
|
|
6024
|
+
return (0, import_react25.useMemo)(() => {
|
|
5934
6025
|
return createRenderer(brain);
|
|
5935
6026
|
}, [brain]);
|
|
5936
6027
|
}
|
|
@@ -5943,7 +6034,7 @@ function RawListFn(props) {
|
|
|
5943
6034
|
debugChannel
|
|
5944
6035
|
});
|
|
5945
6036
|
const getRenderItem = useLatest(renderItem);
|
|
5946
|
-
(0,
|
|
6037
|
+
(0, import_react26.useEffect)(() => {
|
|
5947
6038
|
const renderRange = brain.getRenderRange();
|
|
5948
6039
|
renderer.renderRange(renderRange, {
|
|
5949
6040
|
renderItem,
|
|
@@ -5951,7 +6042,7 @@ function RawListFn(props) {
|
|
|
5951
6042
|
onRender: onRenderUpdater
|
|
5952
6043
|
});
|
|
5953
6044
|
}, [brain, renderItem, onRenderUpdater]);
|
|
5954
|
-
(0,
|
|
6045
|
+
(0, import_react26.useEffect)(() => {
|
|
5955
6046
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
5956
6047
|
renderer.renderRange(renderRange, {
|
|
5957
6048
|
force: false,
|
|
@@ -5978,7 +6069,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
5978
6069
|
componentState: { headerHeight }
|
|
5979
6070
|
} = useInfiniteTable();
|
|
5980
6071
|
const { computedVisibleColumnsMap } = computed;
|
|
5981
|
-
const renderColumn = (0,
|
|
6072
|
+
const renderColumn = (0, import_react27.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
5982
6073
|
const column = columns[columnIndex];
|
|
5983
6074
|
if (!column) {
|
|
5984
6075
|
if (true) {
|
|
@@ -5993,7 +6084,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
5993
6084
|
columns: computedVisibleColumnsMap
|
|
5994
6085
|
});
|
|
5995
6086
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
5996
|
-
(0,
|
|
6087
|
+
(0, import_react27.useEffect)(() => {
|
|
5997
6088
|
const onScroll = (scrollPosition) => {
|
|
5998
6089
|
if (domRef.current) {
|
|
5999
6090
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -6002,7 +6093,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
6002
6093
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
6003
6094
|
return removeOnScroll;
|
|
6004
6095
|
}, [brain]);
|
|
6005
|
-
const domRef = (0,
|
|
6096
|
+
const domRef = (0, import_react27.useRef)(null);
|
|
6006
6097
|
const headerCls = HeaderClsRecipe({
|
|
6007
6098
|
pinned: pinning,
|
|
6008
6099
|
overflow: false,
|
|
@@ -6194,7 +6285,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
6194
6285
|
}
|
|
6195
6286
|
|
|
6196
6287
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
6197
|
-
var
|
|
6288
|
+
var import_react28 = __toModule(require("react"));
|
|
6198
6289
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
6199
6290
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
6200
6291
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -6260,7 +6351,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
6260
6351
|
if (totalWidth != null) {
|
|
6261
6352
|
style.width = availableWidth;
|
|
6262
6353
|
}
|
|
6263
|
-
(0,
|
|
6354
|
+
(0, import_react28.useEffect)(() => {
|
|
6264
6355
|
const scroller = brain || scrollListener;
|
|
6265
6356
|
if (!scroller || !scrollable) {
|
|
6266
6357
|
return;
|
|
@@ -6380,12 +6471,12 @@ function TableHeaderWrapper(props) {
|
|
|
6380
6471
|
|
|
6381
6472
|
// src/components/VirtualScrollContainer/index.tsx
|
|
6382
6473
|
var React21 = __toModule(require("react"));
|
|
6383
|
-
var
|
|
6474
|
+
var import_react30 = __toModule(require("react"));
|
|
6384
6475
|
|
|
6385
6476
|
// src/components/hooks/useOnScroll.ts
|
|
6386
|
-
var
|
|
6477
|
+
var import_react29 = __toModule(require("react"));
|
|
6387
6478
|
var useOnScroll = (domRef, onScroll) => {
|
|
6388
|
-
(0,
|
|
6479
|
+
(0, import_react29.useEffect)(() => {
|
|
6389
6480
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
6390
6481
|
const scrollFn = (event) => {
|
|
6391
6482
|
const node = event.target;
|
|
@@ -6431,7 +6522,7 @@ var VirtualScrollContainer = React21.forwardRef(function VirtualScrollContainer2
|
|
|
6431
6522
|
className,
|
|
6432
6523
|
style
|
|
6433
6524
|
} = props;
|
|
6434
|
-
const domRef = ref != null ? ref : (0,
|
|
6525
|
+
const domRef = ref != null ? ref : (0, import_react30.useRef)(null);
|
|
6435
6526
|
useOnScroll(domRef, onContainerScroll);
|
|
6436
6527
|
return /* @__PURE__ */ React21.createElement("div", {
|
|
6437
6528
|
ref: domRef,
|
|
@@ -6462,18 +6553,18 @@ function SpacePlaceholderFn(props) {
|
|
|
6462
6553
|
var SpacePlaceholder = React22.memo(SpacePlaceholderFn);
|
|
6463
6554
|
|
|
6464
6555
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6465
|
-
var
|
|
6556
|
+
var import_react42 = __toModule(require("react"));
|
|
6466
6557
|
|
|
6467
6558
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
6468
6559
|
var React28 = __toModule(require("react"));
|
|
6469
|
-
var
|
|
6560
|
+
var import_react35 = __toModule(require("react"));
|
|
6470
6561
|
|
|
6471
6562
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
6472
6563
|
var React24 = __toModule(require("react"));
|
|
6473
6564
|
|
|
6474
6565
|
// src/components/VirtualList/VirtualList.tsx
|
|
6475
6566
|
var React23 = __toModule(require("react"));
|
|
6476
|
-
var
|
|
6567
|
+
var import_react31 = __toModule(require("react"));
|
|
6477
6568
|
|
|
6478
6569
|
// src/components/VirtualList/VirtualList.css.ts
|
|
6479
6570
|
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
@@ -6516,11 +6607,11 @@ var VirtualList = (props) => {
|
|
|
6516
6607
|
"onContainerScroll",
|
|
6517
6608
|
"children"
|
|
6518
6609
|
]);
|
|
6519
|
-
const domRef = (0,
|
|
6610
|
+
const domRef = (0, import_react31.useRef)(null);
|
|
6520
6611
|
const [, rerender] = useRerender();
|
|
6521
|
-
const [totalSize, setTotalSize] = (0,
|
|
6522
|
-
const renderCountRef = (0,
|
|
6523
|
-
(0,
|
|
6612
|
+
const [totalSize, setTotalSize] = (0, import_react31.useState)(0);
|
|
6613
|
+
const renderCountRef = (0, import_react31.useRef)(0);
|
|
6614
|
+
(0, import_react31.useEffect)(() => {
|
|
6524
6615
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
6525
6616
|
renderCountRef.current = renderCount;
|
|
6526
6617
|
if (true) {
|
|
@@ -6539,7 +6630,7 @@ var VirtualList = (props) => {
|
|
|
6539
6630
|
removeOnTotalSizeChange();
|
|
6540
6631
|
};
|
|
6541
6632
|
}, [virtualBrain]);
|
|
6542
|
-
(0,
|
|
6633
|
+
(0, import_react31.useEffect)(() => {
|
|
6543
6634
|
const onScroll = (scrollPosition) => {
|
|
6544
6635
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
6545
6636
|
};
|
|
@@ -6593,11 +6684,13 @@ var VirtualRowList = (props) => {
|
|
|
6593
6684
|
|
|
6594
6685
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
6595
6686
|
var React26 = __toModule(require("react"));
|
|
6596
|
-
var
|
|
6687
|
+
var import_react34 = __toModule(require("react"));
|
|
6597
6688
|
|
|
6598
6689
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
6599
6690
|
var React25 = __toModule(require("react"));
|
|
6691
|
+
var import_react32 = __toModule(require("react"));
|
|
6600
6692
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
6693
|
+
var InfiniteTableColumnCellContext = React25.createContext(null);
|
|
6601
6694
|
var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
|
|
6602
6695
|
function isColumnWithField(c) {
|
|
6603
6696
|
return typeof c.field === "string";
|
|
@@ -6644,24 +6737,31 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6644
6737
|
column
|
|
6645
6738
|
}, rest);
|
|
6646
6739
|
let renderValue = value;
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
renderValue = column.renderValue(renderParam);
|
|
6740
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
6741
|
+
value,
|
|
6742
|
+
column,
|
|
6743
|
+
domRef,
|
|
6744
|
+
groupRowInfo
|
|
6745
|
+
}, rest), {
|
|
6746
|
+
rowIndex,
|
|
6747
|
+
toggleGroupRow,
|
|
6748
|
+
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
6749
|
+
groupBy: computedDataSource.groupBy,
|
|
6750
|
+
pivotBy: computedDataSource.pivotBy
|
|
6751
|
+
});
|
|
6752
|
+
const renderChildren = () => {
|
|
6753
|
+
if (hidden) {
|
|
6754
|
+
return null;
|
|
6663
6755
|
}
|
|
6664
|
-
|
|
6756
|
+
const renderFn = column.render || column.renderValue;
|
|
6757
|
+
if (renderFn) {
|
|
6758
|
+
return /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
6759
|
+
render: renderFn,
|
|
6760
|
+
renderParam
|
|
6761
|
+
});
|
|
6762
|
+
}
|
|
6763
|
+
return renderValue;
|
|
6764
|
+
};
|
|
6665
6765
|
const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
|
|
6666
6766
|
const colStyle = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) : column.style : void 0;
|
|
6667
6767
|
const style = colStyle ? __spreadProps(__spreadValues({}, colStyle), {
|
|
@@ -6689,21 +6789,31 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6689
6789
|
}
|
|
6690
6790
|
}
|
|
6691
6791
|
}
|
|
6692
|
-
|
|
6792
|
+
const cellProps = __spreadProps(__spreadValues({
|
|
6693
6793
|
domRef,
|
|
6694
6794
|
offsetProperty
|
|
6695
6795
|
}, dataset), {
|
|
6796
|
+
cellType: "body",
|
|
6696
6797
|
column,
|
|
6697
6798
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
6698
6799
|
style,
|
|
6699
6800
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
6700
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
|
|
6701
|
-
|
|
6801
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName),
|
|
6802
|
+
renderChildren
|
|
6803
|
+
});
|
|
6804
|
+
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
6805
|
+
return /* @__PURE__ */ React25.createElement(ContextProvider, {
|
|
6806
|
+
value: renderParam
|
|
6807
|
+
}, /* @__PURE__ */ React25.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
6702
6808
|
}
|
|
6703
6809
|
var InfiniteTableColumnCell = React25.memo(InfiniteTableColumnCellFn);
|
|
6810
|
+
function useInfiniteColumnCell() {
|
|
6811
|
+
const result = (0, import_react32.useContext)(InfiniteTableColumnCellContext);
|
|
6812
|
+
return result;
|
|
6813
|
+
}
|
|
6704
6814
|
|
|
6705
6815
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
6706
|
-
var
|
|
6816
|
+
var import_react33 = __toModule(require("react"));
|
|
6707
6817
|
|
|
6708
6818
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
6709
6819
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
@@ -6729,8 +6839,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6729
6839
|
rowInfo,
|
|
6730
6840
|
rowSpan
|
|
6731
6841
|
} = props;
|
|
6732
|
-
const domRef = (0,
|
|
6733
|
-
const rowDOMRef = (0,
|
|
6842
|
+
const domRef = (0, import_react33.useRef)(null);
|
|
6843
|
+
const rowDOMRef = (0, import_react33.useCallback)((node) => {
|
|
6734
6844
|
domRefFromProps(node);
|
|
6735
6845
|
domRef.current = node;
|
|
6736
6846
|
}, []);
|
|
@@ -6761,7 +6871,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6761
6871
|
}), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
|
|
6762
6872
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
6763
6873
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
6764
|
-
const onMouseEnter = (0,
|
|
6874
|
+
const onMouseEnter = (0, import_react33.useCallback)((event) => {
|
|
6765
6875
|
var _a;
|
|
6766
6876
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
6767
6877
|
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
@@ -6775,7 +6885,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
6775
6885
|
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
6776
6886
|
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
6777
6887
|
}, [initialMouseEnter, showHoverRows]);
|
|
6778
|
-
const onMouseLeave = (0,
|
|
6888
|
+
const onMouseLeave = (0, import_react33.useCallback)((event) => {
|
|
6779
6889
|
var _a;
|
|
6780
6890
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
6781
6891
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
@@ -6831,7 +6941,7 @@ function InfiniteTableRowFn(props) {
|
|
|
6831
6941
|
width: rowWidth,
|
|
6832
6942
|
height: rowHeight
|
|
6833
6943
|
}, domProps.style);
|
|
6834
|
-
const renderCellRef = (0,
|
|
6944
|
+
const renderCellRef = (0, import_react34.useRef)(null);
|
|
6835
6945
|
const renderCell = React26.useCallback(({ domRef, itemIndex }) => {
|
|
6836
6946
|
const column = columns[itemIndex];
|
|
6837
6947
|
if (!column) {
|
|
@@ -6936,7 +7046,7 @@ function useUnpinnedRendering(params) {
|
|
|
6936
7046
|
} = params;
|
|
6937
7047
|
const { virtualizeColumns } = getState();
|
|
6938
7048
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
6939
|
-
const renderRowUnpinned = (0,
|
|
7049
|
+
const renderRowUnpinned = (0, import_react35.useCallback)((rowParams) => {
|
|
6940
7050
|
const dataArray = getData();
|
|
6941
7051
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
6942
7052
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -7004,7 +7114,7 @@ function useUnpinnedRendering(params) {
|
|
|
7004
7114
|
}
|
|
7005
7115
|
|
|
7006
7116
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
7007
|
-
var
|
|
7117
|
+
var import_react36 = __toModule(require("react"));
|
|
7008
7118
|
|
|
7009
7119
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
7010
7120
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
@@ -7042,18 +7152,18 @@ var useOnContainerScroll = ({
|
|
|
7042
7152
|
getState: getDataSourceState,
|
|
7043
7153
|
componentState: { notifyScrollStop }
|
|
7044
7154
|
} = useDataSourceContextValue();
|
|
7045
|
-
const onScrollStop = (0,
|
|
7155
|
+
const onScrollStop = (0, import_react36.useCallback)((param) => {
|
|
7046
7156
|
onScrollStopFromProps == null ? void 0 : onScrollStopFromProps(param);
|
|
7047
7157
|
notifyScrollStop(param);
|
|
7048
7158
|
}, [onScrollStopFromProps, notifyScrollStop]);
|
|
7049
|
-
const timeoutIdRef = (0,
|
|
7050
|
-
const scrollingRef = (0,
|
|
7051
|
-
const scrollTopMaxRef = (0,
|
|
7052
|
-
(0,
|
|
7159
|
+
const timeoutIdRef = (0, import_react36.useRef)(0);
|
|
7160
|
+
const scrollingRef = (0, import_react36.useRef)(false);
|
|
7161
|
+
const scrollTopMaxRef = (0, import_react36.useRef)(0);
|
|
7162
|
+
(0, import_react36.useEffect)(() => {
|
|
7053
7163
|
const { current: node } = scrollerDOMRef;
|
|
7054
7164
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
7055
7165
|
}, [reservedContentHeight, bodySize.height]);
|
|
7056
|
-
const setScrolling = (0,
|
|
7166
|
+
const setScrolling = (0, import_react36.useCallback)((scrolling) => {
|
|
7057
7167
|
var _a;
|
|
7058
7168
|
const prevScrolling = scrollingRef.current;
|
|
7059
7169
|
scrollingRef.current = scrolling;
|
|
@@ -7086,7 +7196,7 @@ var useOnContainerScroll = ({
|
|
|
7086
7196
|
}
|
|
7087
7197
|
}
|
|
7088
7198
|
}, [scrollStopDelay, onScrollStop]);
|
|
7089
|
-
const onContainerScroll = (0,
|
|
7199
|
+
const onContainerScroll = (0, import_react36.useCallback)((scrollInfo) => {
|
|
7090
7200
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
7091
7201
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
7092
7202
|
setScrolling(true);
|
|
@@ -7096,15 +7206,15 @@ var useOnContainerScroll = ({
|
|
|
7096
7206
|
domRef.current,
|
|
7097
7207
|
setScrolling
|
|
7098
7208
|
]);
|
|
7099
|
-
const scrollPositionRef = (0,
|
|
7209
|
+
const scrollPositionRef = (0, import_react36.useRef)({
|
|
7100
7210
|
scrollLeft: 0,
|
|
7101
7211
|
scrollTop: 0
|
|
7102
7212
|
});
|
|
7103
|
-
const applyScrollHorizontal = (0,
|
|
7213
|
+
const applyScrollHorizontal = (0, import_react36.useCallback)(({ scrollLeft }) => {
|
|
7104
7214
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
7105
7215
|
onContainerScroll(scrollPositionRef.current);
|
|
7106
7216
|
}, [onContainerScroll]);
|
|
7107
|
-
const applyScrollVertical = (0,
|
|
7217
|
+
const applyScrollVertical = (0, import_react36.useCallback)(({ scrollTop }) => {
|
|
7108
7218
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
7109
7219
|
onContainerScroll(scrollPositionRef.current);
|
|
7110
7220
|
if (scrollTop === 0) {
|
|
@@ -7127,16 +7237,16 @@ var useOnContainerScroll = ({
|
|
|
7127
7237
|
|
|
7128
7238
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
7129
7239
|
var React30 = __toModule(require("react"));
|
|
7130
|
-
var
|
|
7240
|
+
var import_react39 = __toModule(require("react"));
|
|
7131
7241
|
|
|
7132
7242
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
7133
7243
|
var React29 = __toModule(require("react"));
|
|
7134
|
-
var
|
|
7244
|
+
var import_react38 = __toModule(require("react"));
|
|
7135
7245
|
|
|
7136
7246
|
// src/components/hooks/useOnMount.ts
|
|
7137
|
-
var
|
|
7247
|
+
var import_react37 = __toModule(require("react"));
|
|
7138
7248
|
function useOnMount(domRef, props) {
|
|
7139
|
-
(0,
|
|
7249
|
+
(0, import_react37.useEffect)(() => {
|
|
7140
7250
|
const { onMount, onUnmount } = props;
|
|
7141
7251
|
const node = domRef == null ? void 0 : domRef.current;
|
|
7142
7252
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -7167,8 +7277,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
7167
7277
|
onMount,
|
|
7168
7278
|
onUnmount
|
|
7169
7279
|
} = props;
|
|
7170
|
-
const domRef = (0,
|
|
7171
|
-
const renderItem = (0,
|
|
7280
|
+
const domRef = (0, import_react38.useRef)(null);
|
|
7281
|
+
const renderItem = (0, import_react38.useCallback)((renderProps) => renderRow({
|
|
7172
7282
|
domRef: renderProps.domRef,
|
|
7173
7283
|
rowHeight: renderProps.itemSize,
|
|
7174
7284
|
rowIndex: renderProps.itemIndex
|
|
@@ -7177,7 +7287,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
7177
7287
|
onMount,
|
|
7178
7288
|
onUnmount
|
|
7179
7289
|
});
|
|
7180
|
-
(0,
|
|
7290
|
+
(0, import_react38.useEffect)(() => {
|
|
7181
7291
|
const onScroll = (scrollPosition) => {
|
|
7182
7292
|
const node = domRef.current;
|
|
7183
7293
|
if (node) {
|
|
@@ -7244,7 +7354,7 @@ function PinnedRowsContainer(props) {
|
|
|
7244
7354
|
}
|
|
7245
7355
|
return result;
|
|
7246
7356
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
7247
|
-
const updateScroll = (0,
|
|
7357
|
+
const updateScroll = (0, import_react39.useCallback)((node, scrollPosition) => {
|
|
7248
7358
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
7249
7359
|
}, [hasOverflow, pinnedScrollListener]);
|
|
7250
7360
|
const rowListProps = {
|
|
@@ -7287,7 +7397,7 @@ function PinnedRowsContainer(props) {
|
|
|
7287
7397
|
function useRenderPinnedRow(params) {
|
|
7288
7398
|
const { getData, getState, columnsWidth, columns, rowSpan, verticalBrain } = params;
|
|
7289
7399
|
const dataArray = getData();
|
|
7290
|
-
const renderPinnedRow = (0,
|
|
7400
|
+
const renderPinnedRow = (0, import_react39.useCallback)((rowParams) => {
|
|
7291
7401
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
7292
7402
|
const { showZebraRows, showHoverRows } = getState();
|
|
7293
7403
|
const rowProps = __spreadValues({
|
|
@@ -7404,13 +7514,13 @@ function usePinnedStartRendering(params) {
|
|
|
7404
7514
|
}
|
|
7405
7515
|
|
|
7406
7516
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
7407
|
-
var
|
|
7517
|
+
var import_react41 = __toModule(require("react"));
|
|
7408
7518
|
|
|
7409
7519
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
7410
|
-
var
|
|
7520
|
+
var import_react40 = __toModule(require("react"));
|
|
7411
7521
|
var debug5 = dbg("useColumnSizeFn");
|
|
7412
7522
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
7413
|
-
const columnSize = (0,
|
|
7523
|
+
const columnSize = (0, import_react40.useCallback)((index) => {
|
|
7414
7524
|
const column = computedUnpinnedColumns[index];
|
|
7415
7525
|
if (!column) {
|
|
7416
7526
|
debug5("cannot find column at index", index, computedUnpinnedColumns);
|
|
@@ -7440,13 +7550,13 @@ function useYourBrain(param) {
|
|
|
7440
7550
|
globalThis.verticalVirtualBrain = verticalVirtualBrain;
|
|
7441
7551
|
globalThis.horizontalVirtualBrain = horizontalVirtualBrain;
|
|
7442
7552
|
}
|
|
7443
|
-
(0,
|
|
7553
|
+
(0, import_react41.useEffect)(() => {
|
|
7444
7554
|
verticalVirtualBrain.setAvailableSize({
|
|
7445
7555
|
height: bodySize.height,
|
|
7446
7556
|
width: 0
|
|
7447
7557
|
});
|
|
7448
7558
|
}, [bodySize, verticalVirtualBrain]);
|
|
7449
|
-
(0,
|
|
7559
|
+
(0, import_react41.useEffect)(() => {
|
|
7450
7560
|
horizontalVirtualBrain.setAvailableSize({
|
|
7451
7561
|
height: 0,
|
|
7452
7562
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -7487,7 +7597,7 @@ function useListRendering(param) {
|
|
|
7487
7597
|
horizontalVirtualBrain
|
|
7488
7598
|
} = componentState;
|
|
7489
7599
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
7490
|
-
const repaintIdRef = (0,
|
|
7600
|
+
const repaintIdRef = (0, import_react42.useRef)(0);
|
|
7491
7601
|
if (prevDataSourceTimestamp !== dataSourceState.updatedAt || !shallowEqualObjects(prevComputed, computed)) {
|
|
7492
7602
|
repaintIdRef.current++;
|
|
7493
7603
|
}
|
|
@@ -7506,11 +7616,11 @@ function useListRendering(param) {
|
|
|
7506
7616
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
7507
7617
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
7508
7618
|
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
7509
|
-
const scrollbars = (0,
|
|
7619
|
+
const scrollbars = (0, import_react42.useMemo)(() => ({
|
|
7510
7620
|
vertical: hasVerticalScrollbar,
|
|
7511
7621
|
horizontal: hasHorizontalScrollbar
|
|
7512
7622
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
7513
|
-
(0,
|
|
7623
|
+
(0, import_react42.useEffect)(() => {
|
|
7514
7624
|
if (!bodySize.height) {
|
|
7515
7625
|
return;
|
|
7516
7626
|
}
|
|
@@ -7566,7 +7676,7 @@ function useListRendering(param) {
|
|
|
7566
7676
|
computedUnpinnedColumns
|
|
7567
7677
|
});
|
|
7568
7678
|
const [, rerender] = useRerender();
|
|
7569
|
-
(0,
|
|
7679
|
+
(0, import_react42.useEffect)(() => {
|
|
7570
7680
|
rerender();
|
|
7571
7681
|
}, [dataSourceState]);
|
|
7572
7682
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -7590,7 +7700,7 @@ function useListRendering(param) {
|
|
|
7590
7700
|
|
|
7591
7701
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
7592
7702
|
var React31 = __toModule(require("react"));
|
|
7593
|
-
var
|
|
7703
|
+
var import_react43 = __toModule(require("react"));
|
|
7594
7704
|
|
|
7595
7705
|
// src/components/utils/decamelize.ts
|
|
7596
7706
|
function decamelize(str, options) {
|
|
@@ -7639,7 +7749,7 @@ var InfiniteTableLicenseFooter = React31.forwardRef(function InfiniteTableLicens
|
|
|
7639
7749
|
ref.current = node;
|
|
7640
7750
|
}
|
|
7641
7751
|
}, []);
|
|
7642
|
-
(0,
|
|
7752
|
+
(0, import_react43.useEffect)(() => {
|
|
7643
7753
|
const forceStyle = () => {
|
|
7644
7754
|
requestAnimationFrame(() => {
|
|
7645
7755
|
var _a;
|
|
@@ -7667,7 +7777,7 @@ var InfiniteTableLicenseFooter = React31.forwardRef(function InfiniteTableLicens
|
|
|
7667
7777
|
});
|
|
7668
7778
|
|
|
7669
7779
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
7670
|
-
var
|
|
7780
|
+
var import_react44 = __toModule(require("react"));
|
|
7671
7781
|
|
|
7672
7782
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
7673
7783
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -7825,10 +7935,10 @@ var isInsideSandbox = () => {
|
|
|
7825
7935
|
};
|
|
7826
7936
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
7827
7937
|
var useLicense = (licenseKey = "") => {
|
|
7828
|
-
const valid = (0,
|
|
7938
|
+
const valid = (0, import_react44.useMemo)(() => {
|
|
7829
7939
|
let valid2 = isValidLicense(licenseKey, {
|
|
7830
7940
|
publishedAt: 1624970570587,
|
|
7831
|
-
version: "0.2.
|
|
7941
|
+
version: "0.2.17"
|
|
7832
7942
|
});
|
|
7833
7943
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
7834
7944
|
return true;
|
|
@@ -7840,7 +7950,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7840
7950
|
|
|
7841
7951
|
// src/components/CSSVariableWatch.tsx
|
|
7842
7952
|
var React32 = __toModule(require("react"));
|
|
7843
|
-
var
|
|
7953
|
+
var import_react45 = __toModule(require("react"));
|
|
7844
7954
|
var error = err("CSSVariableWatch");
|
|
7845
7955
|
var debug6 = dbg("CSSVariableWatch");
|
|
7846
7956
|
var WRAPPER_STYLE = {
|
|
@@ -7853,7 +7963,7 @@ var WRAPPER_STYLE = {
|
|
|
7853
7963
|
overflow: "hidden"
|
|
7854
7964
|
};
|
|
7855
7965
|
var useCSSVariableWatch = (params) => {
|
|
7856
|
-
const lastValueRef = (0,
|
|
7966
|
+
const lastValueRef = (0, import_react45.useRef)(0);
|
|
7857
7967
|
const onResize = React32.useCallback(({ height }) => {
|
|
7858
7968
|
if (height && height !== lastValueRef.current) {
|
|
7859
7969
|
lastValueRef.current = height;
|
|
@@ -7873,7 +7983,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7873
7983
|
}, []);
|
|
7874
7984
|
};
|
|
7875
7985
|
var CSSVariableWatch = (props) => {
|
|
7876
|
-
const domRef = (0,
|
|
7986
|
+
const domRef = (0, import_react45.useRef)(null);
|
|
7877
7987
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7878
7988
|
ref: domRef
|
|
7879
7989
|
}));
|
|
@@ -7997,7 +8107,7 @@ function LoadMaskFn(props) {
|
|
|
7997
8107
|
var LoadMask = React33.memo(LoadMaskFn);
|
|
7998
8108
|
|
|
7999
8109
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
8000
|
-
var
|
|
8110
|
+
var import_react46 = __toModule(require("react"));
|
|
8001
8111
|
var OFFSET = 10;
|
|
8002
8112
|
function getColumnContentMaxWidths(domRef, options) {
|
|
8003
8113
|
var _a;
|
|
@@ -8062,11 +8172,11 @@ function useAutoSizeColumns() {
|
|
|
8062
8172
|
horizontalVirtualBrain
|
|
8063
8173
|
}
|
|
8064
8174
|
} = useComponentState();
|
|
8065
|
-
const [refreshId, setRefreshId] = (0,
|
|
8175
|
+
const [refreshId, setRefreshId] = (0, import_react46.useState)(0);
|
|
8066
8176
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
8067
8177
|
const getTheKey = useLatest(theKey);
|
|
8068
|
-
const lastExecutedIdentifierRef = (0,
|
|
8069
|
-
(0,
|
|
8178
|
+
const lastExecutedIdentifierRef = (0, import_react46.useRef)(null);
|
|
8179
|
+
(0, import_react46.useEffect)(() => {
|
|
8070
8180
|
const key = getTheKey();
|
|
8071
8181
|
if (key == null) {
|
|
8072
8182
|
return;
|
|
@@ -8084,7 +8194,7 @@ function useAutoSizeColumns() {
|
|
|
8084
8194
|
removeHorizontal();
|
|
8085
8195
|
};
|
|
8086
8196
|
}, [verticalVirtualBrain, horizontalVirtualBrain]);
|
|
8087
|
-
(0,
|
|
8197
|
+
(0, import_react46.useEffect)(() => {
|
|
8088
8198
|
var _a;
|
|
8089
8199
|
if (theKey == null) {
|
|
8090
8200
|
return;
|