@infinite-table/infinite-react 0.3.0-canary.0 → 0.3.0
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.css +47 -41
- package/index.d.ts +414 -274
- package/index.esm.css +47 -41
- package/index.esm.js +684 -363
- package/index.js +684 -365
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -636,7 +636,7 @@ function debounce(fn, { wait }) {
|
|
|
636
636
|
// src/components/InfiniteTable/index.tsx
|
|
637
637
|
import {
|
|
638
638
|
StrictMode,
|
|
639
|
-
createElement as
|
|
639
|
+
createElement as createElement22,
|
|
640
640
|
memo as memo9,
|
|
641
641
|
useEffect as useEffect23
|
|
642
642
|
} from "react";
|
|
@@ -1010,13 +1010,30 @@ function AvoidReactDiffFn(props) {
|
|
|
1010
1010
|
var AvoidReactDiff = memo2(AvoidReactDiffFn);
|
|
1011
1011
|
|
|
1012
1012
|
// src/components/utils/buildSubscriptionCallback.tsx
|
|
1013
|
-
function buildSubscriptionCallback() {
|
|
1013
|
+
function buildSubscriptionCallback(withRaf = false) {
|
|
1014
1014
|
let result = null;
|
|
1015
1015
|
let fns = [];
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1016
|
+
let rafId = null;
|
|
1017
|
+
const updater = (items, callback) => {
|
|
1018
|
+
if (withRaf) {
|
|
1019
|
+
if (rafId != null) {
|
|
1020
|
+
cancelAnimationFrame(rafId);
|
|
1021
|
+
rafId = null;
|
|
1022
|
+
}
|
|
1023
|
+
requestAnimationFrame(() => {
|
|
1024
|
+
result = items;
|
|
1025
|
+
rafId = null;
|
|
1026
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1027
|
+
fns[i](items);
|
|
1028
|
+
}
|
|
1029
|
+
callback == null ? void 0 : callback();
|
|
1030
|
+
});
|
|
1031
|
+
} else {
|
|
1032
|
+
result = items;
|
|
1033
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1034
|
+
fns[i](items);
|
|
1035
|
+
}
|
|
1036
|
+
callback == null ? void 0 : callback();
|
|
1020
1037
|
}
|
|
1021
1038
|
};
|
|
1022
1039
|
updater.get = () => result;
|
|
@@ -1057,6 +1074,19 @@ function arrayIntersection(...arrays) {
|
|
|
1057
1074
|
});
|
|
1058
1075
|
}
|
|
1059
1076
|
|
|
1077
|
+
// src/utils/getGlobal.ts
|
|
1078
|
+
function getGlobal() {
|
|
1079
|
+
return globalThis;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// src/utils/raf.ts
|
|
1083
|
+
var raf = getGlobal().requestAnimationFrame || ((fn) => {
|
|
1084
|
+
return setTimeout(fn, 16);
|
|
1085
|
+
});
|
|
1086
|
+
var cancelRaf = getGlobal().cancelAnimationFrame || ((timeoutId) => {
|
|
1087
|
+
return clearTimeout(timeoutId);
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1060
1090
|
// src/components/VirtualBrain/MatrixBrain.ts
|
|
1061
1091
|
var import_binary_search = __toModule(require_binary_search());
|
|
1062
1092
|
var getRenderRangeCellCount = (range) => {
|
|
@@ -1069,7 +1099,7 @@ var getRenderRangeCellCount = (range) => {
|
|
|
1069
1099
|
};
|
|
1070
1100
|
var ALL_DIRECTIONS = { horizontal: true, vertical: true };
|
|
1071
1101
|
var SORT_ASC = (a, b) => a - b;
|
|
1072
|
-
var
|
|
1102
|
+
var raf2 = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
1073
1103
|
var MatrixBrain = class extends Logger {
|
|
1074
1104
|
constructor() {
|
|
1075
1105
|
super(`MatrixBrain`);
|
|
@@ -1254,7 +1284,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1254
1284
|
const fns = this.onAvailableSizeChangeFns;
|
|
1255
1285
|
const range = this.getAvailableSize();
|
|
1256
1286
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1257
|
-
|
|
1287
|
+
raf2(() => {
|
|
1258
1288
|
fns[i](range);
|
|
1259
1289
|
});
|
|
1260
1290
|
}
|
|
@@ -1263,7 +1293,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1263
1293
|
const fns = this.onRenderRangeChangeFns;
|
|
1264
1294
|
const range = this.getRenderRange();
|
|
1265
1295
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1266
|
-
|
|
1296
|
+
raf2(() => {
|
|
1267
1297
|
fns[i](range);
|
|
1268
1298
|
});
|
|
1269
1299
|
}
|
|
@@ -1272,7 +1302,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1272
1302
|
const fns = this.onVerticalRenderRangeChangeFns;
|
|
1273
1303
|
const range = this.verticalRenderRange;
|
|
1274
1304
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1275
|
-
|
|
1305
|
+
raf2(() => {
|
|
1276
1306
|
fns[i]([range.startIndex, range.endIndex]);
|
|
1277
1307
|
});
|
|
1278
1308
|
}
|
|
@@ -1281,7 +1311,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1281
1311
|
const fns = this.onHorizontalRenderRangeChangeFns;
|
|
1282
1312
|
const range = this.horizontalRenderRange;
|
|
1283
1313
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1284
|
-
|
|
1314
|
+
raf2(() => {
|
|
1285
1315
|
fns[i]([range.startIndex, range.endIndex]);
|
|
1286
1316
|
});
|
|
1287
1317
|
}
|
|
@@ -1981,7 +2011,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1981
2011
|
};
|
|
1982
2012
|
const fns = this.onRenderCountChangeFns;
|
|
1983
2013
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1984
|
-
|
|
2014
|
+
raf2(() => {
|
|
1985
2015
|
fns[i](renderCount);
|
|
1986
2016
|
});
|
|
1987
2017
|
}
|
|
@@ -2077,6 +2107,20 @@ var DeepMap = class {
|
|
|
2077
2107
|
return clone;
|
|
2078
2108
|
}
|
|
2079
2109
|
getValuesStartingWith(keys) {
|
|
2110
|
+
const result = [];
|
|
2111
|
+
this.getStartingWith(keys, (_keys, value) => {
|
|
2112
|
+
result.push(value);
|
|
2113
|
+
});
|
|
2114
|
+
return result;
|
|
2115
|
+
}
|
|
2116
|
+
getKeysStartingWith(keys) {
|
|
2117
|
+
const result = [];
|
|
2118
|
+
this.getStartingWith(keys, (keys2) => {
|
|
2119
|
+
result.push(keys2);
|
|
2120
|
+
});
|
|
2121
|
+
return result;
|
|
2122
|
+
}
|
|
2123
|
+
getStartingWith(keys, fn) {
|
|
2080
2124
|
let currentMap = this.map;
|
|
2081
2125
|
let pair;
|
|
2082
2126
|
if (!keys.length) {
|
|
@@ -2086,16 +2130,37 @@ var DeepMap = class {
|
|
|
2086
2130
|
const key = keys[i];
|
|
2087
2131
|
pair = currentMap.get(key);
|
|
2088
2132
|
if (!pair || !pair.map) {
|
|
2089
|
-
return
|
|
2133
|
+
return;
|
|
2090
2134
|
}
|
|
2091
2135
|
currentMap = pair.map;
|
|
2092
2136
|
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2137
|
+
if (pair && pair.value !== void 0) {
|
|
2138
|
+
fn(keys, pair.value);
|
|
2139
|
+
}
|
|
2140
|
+
this.visitWithNext(keys, (value, keys2, _i, next) => {
|
|
2141
|
+
fn(keys2, value);
|
|
2096
2142
|
next == null ? void 0 : next();
|
|
2097
2143
|
}, currentMap);
|
|
2098
|
-
|
|
2144
|
+
}
|
|
2145
|
+
getDirectChildrenSizeFor(keys) {
|
|
2146
|
+
var _a;
|
|
2147
|
+
let currentMap = this.map;
|
|
2148
|
+
if (!keys.length) {
|
|
2149
|
+
keys = [this.emptyKey];
|
|
2150
|
+
}
|
|
2151
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2152
|
+
const key = keys[i];
|
|
2153
|
+
const last = i === len - 1;
|
|
2154
|
+
const pair = currentMap.get(key);
|
|
2155
|
+
if (!pair || !pair.map) {
|
|
2156
|
+
return 0;
|
|
2157
|
+
}
|
|
2158
|
+
currentMap = pair.map;
|
|
2159
|
+
if (last) {
|
|
2160
|
+
return (_a = currentMap == null ? void 0 : currentMap.size) != null ? _a : 0;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
return 0;
|
|
2099
2164
|
}
|
|
2100
2165
|
set(keys, value) {
|
|
2101
2166
|
let currentMap = this.map;
|
|
@@ -2165,7 +2230,7 @@ var DeepMap = class {
|
|
|
2165
2230
|
} else {
|
|
2166
2231
|
keys = [...keys];
|
|
2167
2232
|
}
|
|
2168
|
-
|
|
2233
|
+
const maps = [currentMap];
|
|
2169
2234
|
let result = false;
|
|
2170
2235
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2171
2236
|
const key = keys[i];
|
|
@@ -2454,6 +2519,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2454
2519
|
this.updaters = [];
|
|
2455
2520
|
this.items = [];
|
|
2456
2521
|
this.currentHoveredRow = -1;
|
|
2522
|
+
this.hoverRowUpdatesInProgress = new Map();
|
|
2457
2523
|
this.getExtraSpanCellsForRange = (range) => {
|
|
2458
2524
|
const { start, end } = range;
|
|
2459
2525
|
const [startRow, startCol] = start;
|
|
@@ -2732,6 +2798,28 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2732
2798
|
}
|
|
2733
2799
|
});
|
|
2734
2800
|
};
|
|
2801
|
+
this.updateHoverClassNamesForRow = (rowIndex) => {
|
|
2802
|
+
if (this.scrolling) {
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
if (this.hoverRowUpdatesInProgress.has(rowIndex)) {
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
this.hoverRowUpdatesInProgress.set(rowIndex, true);
|
|
2809
|
+
const checkHoverClass = () => {
|
|
2810
|
+
if (this.currentHoveredRow != -1 && !this.scrolling) {
|
|
2811
|
+
if (this.currentHoveredRow === rowIndex) {
|
|
2812
|
+
this.addHoverClass(rowIndex);
|
|
2813
|
+
} else {
|
|
2814
|
+
this.removeHoverClass(rowIndex);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
raf(() => {
|
|
2819
|
+
checkHoverClass();
|
|
2820
|
+
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
2821
|
+
});
|
|
2822
|
+
};
|
|
2735
2823
|
this.updateElementPosition = (elementIndex) => {
|
|
2736
2824
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2737
2825
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
@@ -2748,17 +2836,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2748
2836
|
}
|
|
2749
2837
|
const { x, y } = itemPosition;
|
|
2750
2838
|
if (itemElement) {
|
|
2751
|
-
|
|
2752
|
-
if (this.currentHoveredRow === rowIndex) {
|
|
2753
|
-
this.cellHoverClassNames.forEach((cls) => {
|
|
2754
|
-
itemElement.classList.add(cls);
|
|
2755
|
-
});
|
|
2756
|
-
} else {
|
|
2757
|
-
this.cellHoverClassNames.forEach((cls) => {
|
|
2758
|
-
itemElement.classList.remove(cls);
|
|
2759
|
-
});
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2839
|
+
this.updateHoverClassNamesForRow(rowIndex);
|
|
2762
2840
|
if (true) {
|
|
2763
2841
|
itemElement.dataset.rowIndex = rowIndex;
|
|
2764
2842
|
itemElement.dataset.colIndex = colIndex;
|
|
@@ -2907,6 +2985,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2907
2985
|
this.destroyed = true;
|
|
2908
2986
|
this.reset();
|
|
2909
2987
|
this.onDestroy();
|
|
2988
|
+
this.hoverRowUpdatesInProgress.clear();
|
|
2989
|
+
this.hoverRowUpdatesInProgress = null;
|
|
2910
2990
|
this.brain = null;
|
|
2911
2991
|
this.mappedCells = null;
|
|
2912
2992
|
};
|
|
@@ -2915,7 +2995,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2915
2995
|
const removeOnScroll = brain.onScroll(this.adjustFixedElementsOnScroll);
|
|
2916
2996
|
const removeOnSizeChange = brain.onAvailableSizeChange(() => {
|
|
2917
2997
|
this.adjustFixedElementsOnScroll();
|
|
2918
|
-
|
|
2998
|
+
raf(() => {
|
|
2919
2999
|
this.adjustFixedElementsOnScroll();
|
|
2920
3000
|
});
|
|
2921
3001
|
});
|
|
@@ -3465,19 +3545,19 @@ var useInternalProps = () => {
|
|
|
3465
3545
|
};
|
|
3466
3546
|
|
|
3467
3547
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3468
|
-
var alignItems = { center: "
|
|
3469
|
-
var cssEllipsisClassName = "
|
|
3470
|
-
var cursor = { pointer: "
|
|
3471
|
-
var display = { flex: "
|
|
3472
|
-
var flex = { "1": "
|
|
3473
|
-
var justifyContent = { center: "
|
|
3474
|
-
var left = { "0": "
|
|
3475
|
-
var overflow = { hidden: "
|
|
3548
|
+
var alignItems = { center: "_16lm1iw13", stretch: "_16lm1iw14" };
|
|
3549
|
+
var cssEllipsisClassName = "_16lm1iw1c _16lm1iw1d _16lm1iw18";
|
|
3550
|
+
var cursor = { pointer: "_16lm1iwd" };
|
|
3551
|
+
var display = { flex: "_16lm1iwl", block: "_16lm1iwm", inlineBlock: "_16lm1iwn" };
|
|
3552
|
+
var flex = { "1": "_16lm1iwe", none: "_16lm1iwf" };
|
|
3553
|
+
var justifyContent = { center: "_16lm1iw15", start: "_16lm1iw16", end: "_16lm1iw17" };
|
|
3554
|
+
var left = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3555
|
+
var overflow = { hidden: "_16lm1iw18", auto: "_16lm1iw19", visible: "_16lm1iw1a" };
|
|
3476
3556
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3477
|
-
var top = { "0": "
|
|
3478
|
-
var transformTranslateZero = "
|
|
3479
|
-
var userSelect = { none: "
|
|
3480
|
-
var zIndex = { "1": "
|
|
3557
|
+
var top = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
3558
|
+
var transformTranslateZero = "_16lm1iwa";
|
|
3559
|
+
var userSelect = { none: "_16lm1iwo" };
|
|
3560
|
+
var zIndex = { "1": "_16lm1iwg", "10": "_16lm1iwh", "1000": "_16lm1iwi", "10000": "_16lm1iwj", "100000": "_16lm1iwk" };
|
|
3481
3561
|
|
|
3482
3562
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3483
3563
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
@@ -3527,7 +3607,7 @@ var useInfiniteTableState = () => {
|
|
|
3527
3607
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3528
3608
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3529
3609
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3530
|
-
var ColumnCellCls = "_1eexc2a5
|
|
3610
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3531
3611
|
var ColumnCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, zebra: { false: "_1eexc2aa", even: "_1eexc2ab", odd: "_1eexc2ac" }, first: { true: "_1eexc2ad", false: "_1eexc2ae" }, last: { true: "_1eexc2af", false: "_1eexc2ag" }, groupByField: { true: "_1eexc2ah", false: "_1eexc2ai" }, firstInCategory: { true: "_1eexc2aj", false: "_1eexc2ak" }, lastInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, pinned: { start: "_1eexc2an", end: "_1eexc2ao", false: "_1eexc2ap" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2aq"], [{ pinned: "end", firstInCategory: true }, "_1eexc2ar"]] });
|
|
3532
3612
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3533
3613
|
|
|
@@ -3876,18 +3956,19 @@ function SortIcon(props) {
|
|
|
3876
3956
|
|
|
3877
3957
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3878
3958
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3879
|
-
var CellCls = "_1eexc2a5
|
|
3959
|
+
var CellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3880
3960
|
var HeaderCellProxy = "_12zfob10";
|
|
3881
3961
|
var HeaderCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob1d", variantClassNames: { zebra: { false: "_12zfob1e", even: "_12zfob1f", odd: "_12zfob1g" }, dragging: { true: "_12zfob1h", false: "_12zfob1i" }, first: { true: "_12zfob1j", false: "_12zfob1k" }, last: { true: "_12zfob1l", false: "_12zfob1m" }, groupByField: { true: "_12zfob1n", false: "_12zfob1o" }, firstInCategory: { true: "_12zfob1p", false: "_12zfob1q" }, lastInCategory: { true: "_12zfob1r", false: "_12zfob1s" }, pinned: { start: "_12zfob1t", end: "_12zfob1u", false: "_12zfob1v" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1w"], [{ pinned: "end", firstInCategory: true }, "_12zfob1x"], [{ pinned: false, lastInCategory: true }, "_12zfob1y"]] });
|
|
3882
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob13
|
|
3883
|
-
var HeaderGroupCls = "_12zfob110
|
|
3962
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob13 _16lm1iw12 _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob14", end: "_12zfob15", false: "_12zfob16" }, virtualized: { true: "_12zfob17", false: "_12zfob18" }, overflow: { true: "_12zfob19", false: "_12zfob1a" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1b"], [{ overflow: true, pinned: "end" }, "_12zfob1c"]] });
|
|
3963
|
+
var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3884
3964
|
var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
|
|
3885
3965
|
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3886
|
-
var HeaderWrapperCls = "_12zfob1z
|
|
3966
|
+
var HeaderWrapperCls = "_12zfob1z _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
|
|
3887
3967
|
|
|
3888
3968
|
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
3889
3969
|
function RenderHookComponent(props) {
|
|
3890
|
-
|
|
3970
|
+
var _a;
|
|
3971
|
+
return (_a = props.render(props.renderParam)) != null ? _a : null;
|
|
3891
3972
|
}
|
|
3892
3973
|
|
|
3893
3974
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
@@ -3997,11 +4078,6 @@ import {
|
|
|
3997
4078
|
useMemo as useMemo5
|
|
3998
4079
|
} from "react";
|
|
3999
4080
|
|
|
4000
|
-
// src/utils/getGlobal.ts
|
|
4001
|
-
function getGlobal() {
|
|
4002
|
-
return globalThis;
|
|
4003
|
-
}
|
|
4004
|
-
|
|
4005
4081
|
// src/components/utils/getScrollbarWidth.ts
|
|
4006
4082
|
var scrollbarWidth;
|
|
4007
4083
|
function getScrollbarWidth() {
|
|
@@ -4353,9 +4429,9 @@ var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(-
|
|
|
4353
4429
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4354
4430
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4355
4431
|
var FooterCls = "_16lm1iw1";
|
|
4356
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4432
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwl _16lm1iw11 _16lm1iw0";
|
|
4357
4433
|
var InfiniteClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4358
|
-
var InfiniteClsShiftingColumns = "
|
|
4434
|
+
var InfiniteClsShiftingColumns = "_16lm1iwo";
|
|
4359
4435
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4360
4436
|
|
|
4361
4437
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
@@ -4461,15 +4537,18 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4461
4537
|
ref: domRef
|
|
4462
4538
|
}, "no column");
|
|
4463
4539
|
}
|
|
4464
|
-
const { data, isGroupRow,
|
|
4540
|
+
const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
|
|
4541
|
+
const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
|
|
4465
4542
|
const groupRowInfo = null;
|
|
4466
4543
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4467
4544
|
if (column.valueGetter) {
|
|
4468
4545
|
value = column.valueGetter(isGroupRow ? {
|
|
4469
4546
|
data: rowInfo.data,
|
|
4547
|
+
isGroupRow,
|
|
4470
4548
|
rowInfo
|
|
4471
4549
|
} : {
|
|
4472
4550
|
data: rowInfo.data,
|
|
4551
|
+
isGroupRow,
|
|
4473
4552
|
rowInfo
|
|
4474
4553
|
});
|
|
4475
4554
|
}
|
|
@@ -4483,18 +4562,25 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4483
4562
|
};
|
|
4484
4563
|
const stylingRenderParam = __spreadValues({
|
|
4485
4564
|
value,
|
|
4486
|
-
column
|
|
4565
|
+
column,
|
|
4566
|
+
isGroupRow
|
|
4487
4567
|
}, rest);
|
|
4488
|
-
|
|
4568
|
+
const renderValue = value;
|
|
4489
4569
|
const renderParam = __spreadProps(__spreadValues({
|
|
4490
4570
|
value,
|
|
4491
4571
|
column,
|
|
4492
4572
|
domRef,
|
|
4493
|
-
groupRowInfo
|
|
4573
|
+
groupRowInfo,
|
|
4574
|
+
isGroupRow
|
|
4494
4575
|
}, rest), {
|
|
4495
4576
|
rowIndex,
|
|
4496
4577
|
toggleGroupRow,
|
|
4497
|
-
toggleCurrentGroupRow: () =>
|
|
4578
|
+
toggleCurrentGroupRow: () => {
|
|
4579
|
+
if (!rowInfo.isGroupRow) {
|
|
4580
|
+
return;
|
|
4581
|
+
}
|
|
4582
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
4583
|
+
},
|
|
4498
4584
|
groupBy: computedDataSource.groupBy,
|
|
4499
4585
|
pivotBy: computedDataSource.pivotBy
|
|
4500
4586
|
});
|
|
@@ -4555,8 +4641,8 @@ import {
|
|
|
4555
4641
|
} from "react";
|
|
4556
4642
|
|
|
4557
4643
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4558
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4559
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
4644
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx" };
|
|
4645
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx";
|
|
4560
4646
|
var LoadMaskTextCls = "qy58ya4";
|
|
4561
4647
|
|
|
4562
4648
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -4589,7 +4675,6 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4589
4675
|
const measuredMaxWidths = {};
|
|
4590
4676
|
const computedPaddingsForColumns = {};
|
|
4591
4677
|
if (match && match.length) {
|
|
4592
|
-
console.log(match);
|
|
4593
4678
|
match.forEach((content) => {
|
|
4594
4679
|
const cell = content.parentElement;
|
|
4595
4680
|
const isHeader = cell.matches(`.${InfiniteTableHeaderCellClassName}`);
|
|
@@ -5062,9 +5147,22 @@ import { useEffect as useEffect19, useMemo as useMemo8 } from "react";
|
|
|
5062
5147
|
|
|
5063
5148
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5064
5149
|
import {
|
|
5065
|
-
createElement as
|
|
5150
|
+
createElement as createElement20
|
|
5066
5151
|
} from "react";
|
|
5067
5152
|
|
|
5153
|
+
// src/utils/stripVar.ts
|
|
5154
|
+
function stripVar(cssVariableWithVarString) {
|
|
5155
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
5156
|
+
}
|
|
5157
|
+
|
|
5158
|
+
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5159
|
+
var showLoadingIcon = (rowInfo) => {
|
|
5160
|
+
if (rowInfo.dataSourceHasGrouping) {
|
|
5161
|
+
return rowInfo.isGroupRow ? rowInfo.childrenLoading || !rowInfo.selfLoaded : !rowInfo.selfLoaded;
|
|
5162
|
+
}
|
|
5163
|
+
return !rowInfo.selfLoaded;
|
|
5164
|
+
};
|
|
5165
|
+
|
|
5068
5166
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5069
5167
|
import {
|
|
5070
5168
|
createElement as createElement18,
|
|
@@ -5074,8 +5172,8 @@ import { useState as useState8 } from "react";
|
|
|
5074
5172
|
|
|
5075
5173
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5076
5174
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5077
|
-
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd
|
|
5078
|
-
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "
|
|
5175
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwf _16lm1iwd";
|
|
5176
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5079
5177
|
|
|
5080
5178
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5081
5179
|
function ExpanderIcon(props) {
|
|
@@ -5110,6 +5208,45 @@ function ExpanderIcon(props) {
|
|
|
5110
5208
|
}));
|
|
5111
5209
|
}
|
|
5112
5210
|
|
|
5211
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5212
|
+
import {
|
|
5213
|
+
createElement as createElement19
|
|
5214
|
+
} from "react";
|
|
5215
|
+
|
|
5216
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5217
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwf _16lm1iwd";
|
|
5218
|
+
|
|
5219
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5220
|
+
var LoadingIcon = (props) => {
|
|
5221
|
+
return /* @__PURE__ */ createElement19("svg", {
|
|
5222
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5223
|
+
style: {
|
|
5224
|
+
margin: "auto",
|
|
5225
|
+
display: "block",
|
|
5226
|
+
shapeRendering: "auto"
|
|
5227
|
+
},
|
|
5228
|
+
width: "24px",
|
|
5229
|
+
height: "24px",
|
|
5230
|
+
viewBox: "0 0 100 100",
|
|
5231
|
+
preserveAspectRatio: "xMidYMid",
|
|
5232
|
+
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5233
|
+
}, /* @__PURE__ */ createElement19("circle", {
|
|
5234
|
+
cx: "50",
|
|
5235
|
+
cy: "50",
|
|
5236
|
+
fill: "none",
|
|
5237
|
+
strokeWidth: "10",
|
|
5238
|
+
r: "35",
|
|
5239
|
+
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5240
|
+
}, /* @__PURE__ */ createElement19("animateTransform", {
|
|
5241
|
+
attributeName: "transform",
|
|
5242
|
+
type: "rotate",
|
|
5243
|
+
repeatCount: "indefinite",
|
|
5244
|
+
dur: "1s",
|
|
5245
|
+
values: "0 50 50;360 50 50",
|
|
5246
|
+
keyTimes: "0;1"
|
|
5247
|
+
})));
|
|
5248
|
+
};
|
|
5249
|
+
|
|
5113
5250
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5114
5251
|
function getGroupColumnRender({
|
|
5115
5252
|
groupIndexForColumn,
|
|
@@ -5120,12 +5257,12 @@ function getGroupColumnRender({
|
|
|
5120
5257
|
var _a, _b, _c;
|
|
5121
5258
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5122
5259
|
if (column.renderValue) {
|
|
5123
|
-
value = /* @__PURE__ */
|
|
5260
|
+
value = /* @__PURE__ */ createElement20(RenderHookComponent, {
|
|
5124
5261
|
render: column.renderValue,
|
|
5125
5262
|
renderParam: renderOptions
|
|
5126
5263
|
});
|
|
5127
5264
|
}
|
|
5128
|
-
|
|
5265
|
+
const groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : rowInfo.isGroupRow && ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndexForColumn]) || rowInfo;
|
|
5129
5266
|
if (!groupRowInfo) {
|
|
5130
5267
|
return null;
|
|
5131
5268
|
}
|
|
@@ -5148,31 +5285,30 @@ function getGroupColumnRender({
|
|
|
5148
5285
|
}
|
|
5149
5286
|
let icon = null;
|
|
5150
5287
|
const showExpanderIcon = pivotBy ? (((_b = groupRowInfo.groupKeys) == null ? void 0 : _b.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_c = groupRowInfo.groupKeys) == null ? void 0 : _c.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
|
|
5151
|
-
|
|
5152
|
-
|
|
5288
|
+
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5289
|
+
if (isLoading) {
|
|
5290
|
+
icon = /* @__PURE__ */ createElement20(LoadingIcon, null);
|
|
5291
|
+
} else if (showExpanderIcon) {
|
|
5292
|
+
const defaultIcon = /* @__PURE__ */ createElement20(ExpanderIcon, {
|
|
5153
5293
|
expanded: !collapsed,
|
|
5154
5294
|
onChange: () => {
|
|
5155
5295
|
toggleGroupRow(groupKeys);
|
|
5156
5296
|
}
|
|
5157
5297
|
});
|
|
5158
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5298
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ createElement20(RenderHookComponent, {
|
|
5159
5299
|
render: column.renderGroupIcon,
|
|
5160
5300
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5161
5301
|
}) : defaultIcon;
|
|
5162
5302
|
}
|
|
5163
|
-
return /* @__PURE__ */
|
|
5303
|
+
return /* @__PURE__ */ createElement20("div", {
|
|
5164
5304
|
className: join(display.flex, alignItems.center)
|
|
5165
|
-
}, icon, /* @__PURE__ */
|
|
5305
|
+
}, icon, /* @__PURE__ */ createElement20("div", {
|
|
5166
5306
|
className: cssEllipsisClassName
|
|
5167
5307
|
}, value != null ? value : null));
|
|
5168
5308
|
};
|
|
5169
5309
|
}
|
|
5170
5310
|
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
5171
|
-
const {
|
|
5172
|
-
groupByForColumn,
|
|
5173
|
-
groupIndexForColumn,
|
|
5174
|
-
groupRenderStrategy
|
|
5175
|
-
} = options;
|
|
5311
|
+
const { groupByForColumn, groupIndexForColumn, groupRenderStrategy } = options;
|
|
5176
5312
|
let generatedGroupColumn = __spreadValues({
|
|
5177
5313
|
header: `Group by ${groupByForColumn.field}`,
|
|
5178
5314
|
groupByField: groupByForColumn.field,
|
|
@@ -5197,30 +5333,40 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5197
5333
|
header: `Group`,
|
|
5198
5334
|
groupByField: options.groupBy.map((g) => g.field),
|
|
5199
5335
|
sortable: false,
|
|
5336
|
+
style: ({ rowInfo }) => ({
|
|
5337
|
+
[stripVar(ThemeVars.components.Row.groupNesting)]: rowInfo.isGroupRow ? rowInfo.groupNesting - 1 : 0
|
|
5338
|
+
}),
|
|
5200
5339
|
render: (renderOptions) => {
|
|
5201
5340
|
var _a, _b;
|
|
5202
5341
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5203
|
-
if (!rowInfo.isGroupRow) {
|
|
5204
|
-
return null;
|
|
5205
|
-
}
|
|
5206
5342
|
if (column.renderValue) {
|
|
5207
5343
|
value = column.renderValue(renderOptions);
|
|
5208
5344
|
}
|
|
5209
|
-
const collapsed = rowInfo.collapsed;
|
|
5345
|
+
const collapsed = rowInfo.isGroupRow ? rowInfo.collapsed : false;
|
|
5210
5346
|
let icon = null;
|
|
5211
|
-
const showExpanderIcon = pivotBy ? (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_b = rowInfo.groupKeys) == null ? void 0 : _b.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
|
|
5212
|
-
|
|
5213
|
-
|
|
5347
|
+
const showExpanderIcon = rowInfo.isGroupRow ? pivotBy ? (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_b = rowInfo.groupKeys) == null ? void 0 : _b.length) || 0) <= (groupBy == null ? void 0 : groupBy.length) : false;
|
|
5348
|
+
const isLoading = showLoadingIcon(rowInfo);
|
|
5349
|
+
if (isLoading) {
|
|
5350
|
+
icon = /* @__PURE__ */ createElement20(LoadingIcon, null);
|
|
5351
|
+
} else if (showExpanderIcon) {
|
|
5352
|
+
const defaultIcon = /* @__PURE__ */ createElement20(ExpanderIcon, {
|
|
5214
5353
|
expanded: !collapsed,
|
|
5215
5354
|
onChange: () => {
|
|
5355
|
+
if (!rowInfo.isGroupRow) {
|
|
5356
|
+
return;
|
|
5357
|
+
}
|
|
5216
5358
|
toggleGroupRow(rowInfo.groupKeys);
|
|
5217
5359
|
}
|
|
5218
5360
|
});
|
|
5219
|
-
icon =
|
|
5361
|
+
icon = defaultIcon;
|
|
5362
|
+
if (column.renderGroupIcon) {
|
|
5363
|
+
const renderParam = Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions);
|
|
5364
|
+
icon = column.renderGroupIcon(renderParam);
|
|
5365
|
+
}
|
|
5220
5366
|
}
|
|
5221
|
-
return /* @__PURE__ */
|
|
5367
|
+
return /* @__PURE__ */ createElement20("div", {
|
|
5222
5368
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5223
|
-
}, icon, /* @__PURE__ */
|
|
5369
|
+
}, icon, /* @__PURE__ */ createElement20("div", {
|
|
5224
5370
|
className: cssEllipsisClassName
|
|
5225
5371
|
}, value != null ? value : null));
|
|
5226
5372
|
}
|
|
@@ -5259,89 +5405,6 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5259
5405
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5260
5406
|
import { useCallback as useCallback13 } from "react";
|
|
5261
5407
|
|
|
5262
|
-
// src/components/DataSource/index.tsx
|
|
5263
|
-
import {
|
|
5264
|
-
Fragment as Fragment2,
|
|
5265
|
-
createElement as createElement20
|
|
5266
|
-
} from "react";
|
|
5267
|
-
|
|
5268
|
-
// src/utils/multisort/sortTypes.ts
|
|
5269
|
-
var numberComparator = function(first, second) {
|
|
5270
|
-
return first - second;
|
|
5271
|
-
};
|
|
5272
|
-
var stringComparator = function(first, second) {
|
|
5273
|
-
first = `${first}`;
|
|
5274
|
-
second = `${second}`;
|
|
5275
|
-
return first.localeCompare(second);
|
|
5276
|
-
};
|
|
5277
|
-
var sortTypes = {
|
|
5278
|
-
number: numberComparator,
|
|
5279
|
-
string: stringComparator
|
|
5280
|
-
};
|
|
5281
|
-
var sortTypes_default = sortTypes;
|
|
5282
|
-
|
|
5283
|
-
// src/utils/multisort/index.ts
|
|
5284
|
-
var multisort = (sortInfo, array, get) => {
|
|
5285
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
5286
|
-
return array;
|
|
5287
|
-
};
|
|
5288
|
-
multisort.knownTypes = sortTypes_default;
|
|
5289
|
-
var getSingleSortFunction = (info) => {
|
|
5290
|
-
if (!info) {
|
|
5291
|
-
return;
|
|
5292
|
-
}
|
|
5293
|
-
const field = info.field;
|
|
5294
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5295
|
-
if (!dir) {
|
|
5296
|
-
return;
|
|
5297
|
-
}
|
|
5298
|
-
let fn = info.fn;
|
|
5299
|
-
if (!fn && info.type) {
|
|
5300
|
-
fn = multisort.knownTypes[info.type];
|
|
5301
|
-
if (!fn) {
|
|
5302
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
5303
|
-
}
|
|
5304
|
-
}
|
|
5305
|
-
if (!fn) {
|
|
5306
|
-
fn = sortTypes_default.string;
|
|
5307
|
-
}
|
|
5308
|
-
return (first, second) => {
|
|
5309
|
-
const a = field ? first[field] : first;
|
|
5310
|
-
const b = field ? second[field] : second;
|
|
5311
|
-
return dir * fn(a, b);
|
|
5312
|
-
};
|
|
5313
|
-
};
|
|
5314
|
-
var getSortFunctions = (sortInfo) => {
|
|
5315
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
5316
|
-
};
|
|
5317
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
5318
|
-
const fns = getSortFunctions(sortInfo);
|
|
5319
|
-
return (first, second) => {
|
|
5320
|
-
if (get) {
|
|
5321
|
-
first = get(first);
|
|
5322
|
-
second = get(second);
|
|
5323
|
-
}
|
|
5324
|
-
let result = 0;
|
|
5325
|
-
let i = 0;
|
|
5326
|
-
let fn;
|
|
5327
|
-
const len = fns.length;
|
|
5328
|
-
for (; i < len; i++) {
|
|
5329
|
-
fn = fns[i];
|
|
5330
|
-
if (!fn) {
|
|
5331
|
-
continue;
|
|
5332
|
-
}
|
|
5333
|
-
result = fn(first, second);
|
|
5334
|
-
if (result !== 0) {
|
|
5335
|
-
return result;
|
|
5336
|
-
}
|
|
5337
|
-
}
|
|
5338
|
-
return result;
|
|
5339
|
-
};
|
|
5340
|
-
};
|
|
5341
|
-
|
|
5342
|
-
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5343
|
-
import { useEffect as useEffect18, useMemo as useMemo7, useRef as useRef17, useState as useState9 } from "react";
|
|
5344
|
-
|
|
5345
5408
|
// src/utils/groupAndPivot/index.ts
|
|
5346
5409
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
5347
5410
|
var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
|
|
@@ -5353,7 +5416,7 @@ function initReducers(reducers) {
|
|
|
5353
5416
|
return {};
|
|
5354
5417
|
}
|
|
5355
5418
|
const result = {};
|
|
5356
|
-
for (
|
|
5419
|
+
for (const key in reducers)
|
|
5357
5420
|
if (reducers.hasOwnProperty(key)) {
|
|
5358
5421
|
result[key] = reducers[key].initialValue;
|
|
5359
5422
|
}
|
|
@@ -5364,7 +5427,7 @@ function computeReducersFor(data, reducers, reducerResults) {
|
|
|
5364
5427
|
if (!reducers || !Object.keys(reducers).length) {
|
|
5365
5428
|
return;
|
|
5366
5429
|
}
|
|
5367
|
-
for (
|
|
5430
|
+
for (const key in reducers)
|
|
5368
5431
|
if (reducers.hasOwnProperty(key)) {
|
|
5369
5432
|
const reducer = reducers[key];
|
|
5370
5433
|
if (typeof reducer.reducer !== "function") {
|
|
@@ -5386,7 +5449,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5386
5449
|
function traverseValues(pivotDeepMap, container, pivot2, pivotIndex = 0, currentPivotKeys2 = []) {
|
|
5387
5450
|
const last = !pivot2.length || pivotIndex === pivot2.length - 1;
|
|
5388
5451
|
const values = container[(mappings == null ? void 0 : mappings.values) || "values"] || {};
|
|
5389
|
-
for (
|
|
5452
|
+
for (const k in values)
|
|
5390
5453
|
if (values.hasOwnProperty(k)) {
|
|
5391
5454
|
const pivotKey = k;
|
|
5392
5455
|
currentPivotKeys2.push(pivotKey);
|
|
@@ -5402,12 +5465,12 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5402
5465
|
}
|
|
5403
5466
|
}
|
|
5404
5467
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
5405
|
-
|
|
5468
|
+
const currentPivotKeys = [];
|
|
5406
5469
|
const initialReducerValue = initReducers(reducers);
|
|
5407
5470
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
5408
5471
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5409
5472
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5410
|
-
const dataArray = lazyGroupRowInfo.
|
|
5473
|
+
const dataArray = lazyGroupRowInfo.children;
|
|
5411
5474
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5412
5475
|
const deepMapGroupValue = deepMap.get(currentGroupKeys);
|
|
5413
5476
|
if (deepMapGroupValue) {
|
|
@@ -5415,11 +5478,23 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5415
5478
|
}
|
|
5416
5479
|
return next == null ? void 0 : next();
|
|
5417
5480
|
}
|
|
5481
|
+
if (lazyGroupRowInfo) {
|
|
5482
|
+
const current = deepMap.get(currentGroupKeys);
|
|
5483
|
+
if (current) {
|
|
5484
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
5485
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5486
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5487
|
+
current.error = lazyGroupRowInfo.error;
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5418
5490
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5419
5491
|
if (!dataArray[i]) {
|
|
5420
5492
|
const deepMapGroupValue2 = {
|
|
5421
5493
|
items: [],
|
|
5422
|
-
reducerResults: {}
|
|
5494
|
+
reducerResults: {},
|
|
5495
|
+
cache: false,
|
|
5496
|
+
childrenLoading: false,
|
|
5497
|
+
childrenAvailable: false
|
|
5423
5498
|
};
|
|
5424
5499
|
deepMap.set([
|
|
5425
5500
|
...currentGroupKeys,
|
|
@@ -5429,7 +5504,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5429
5504
|
}
|
|
5430
5505
|
const dataObject = dataArray[i].data;
|
|
5431
5506
|
const dataKeys = dataArray[i].keys;
|
|
5432
|
-
|
|
5507
|
+
const item = dataObject;
|
|
5433
5508
|
if (dataKeys.length) {
|
|
5434
5509
|
const { field: groupByProperty } = groupBy[dataKeys.length - 1];
|
|
5435
5510
|
const key = item[groupByProperty];
|
|
@@ -5437,6 +5512,9 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5437
5512
|
}
|
|
5438
5513
|
const deepMapGroupValue = {
|
|
5439
5514
|
items: [],
|
|
5515
|
+
cache: false,
|
|
5516
|
+
childrenLoading: false,
|
|
5517
|
+
childrenAvailable: false,
|
|
5440
5518
|
commonData: dataObject,
|
|
5441
5519
|
reducerResults: dataArray[i].aggregations || {}
|
|
5442
5520
|
};
|
|
@@ -5505,13 +5583,16 @@ function group(groupParams, data) {
|
|
|
5505
5583
|
const groupByLength = groupBy.length;
|
|
5506
5584
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
5507
5585
|
const deepMap = new DeepMap();
|
|
5508
|
-
|
|
5509
|
-
|
|
5586
|
+
const currentGroupKeys = [];
|
|
5587
|
+
const currentPivotKeys = [];
|
|
5510
5588
|
const initialReducerValue = initReducers(reducers);
|
|
5511
5589
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
5512
5590
|
if (!groupByLength) {
|
|
5513
5591
|
const deepMapGroupValue = {
|
|
5514
5592
|
items: [],
|
|
5593
|
+
cache: false,
|
|
5594
|
+
childrenLoading: false,
|
|
5595
|
+
childrenAvailable: false,
|
|
5515
5596
|
reducerResults: __spreadValues({}, initialReducerValue)
|
|
5516
5597
|
};
|
|
5517
5598
|
if (pivot) {
|
|
@@ -5520,7 +5601,7 @@ function group(groupParams, data) {
|
|
|
5520
5601
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
5521
5602
|
}
|
|
5522
5603
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
5523
|
-
|
|
5604
|
+
const item = data[i];
|
|
5524
5605
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
5525
5606
|
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
5526
5607
|
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
@@ -5528,6 +5609,9 @@ function group(groupParams, data) {
|
|
|
5528
5609
|
if (!deepMap.has(currentGroupKeys)) {
|
|
5529
5610
|
const deepMapGroupValue = {
|
|
5530
5611
|
items: [],
|
|
5612
|
+
cache: false,
|
|
5613
|
+
childrenLoading: false,
|
|
5614
|
+
childrenAvailable: false,
|
|
5531
5615
|
reducerResults: __spreadValues({}, initialReducerValue)
|
|
5532
5616
|
};
|
|
5533
5617
|
if (pivot) {
|
|
@@ -5586,7 +5670,7 @@ function flatten(groupResult) {
|
|
|
5586
5670
|
return result;
|
|
5587
5671
|
}
|
|
5588
5672
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
5589
|
-
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
5673
|
+
const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
|
|
5590
5674
|
const groupNesting = groupKeys.length;
|
|
5591
5675
|
const {
|
|
5592
5676
|
items: groupItems,
|
|
@@ -5597,7 +5681,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5597
5681
|
let data = null;
|
|
5598
5682
|
if (Object.keys(reducerResults).length > 0) {
|
|
5599
5683
|
data = commonData || {};
|
|
5600
|
-
for (
|
|
5684
|
+
for (const key in reducers)
|
|
5601
5685
|
if (reducers.hasOwnProperty(key)) {
|
|
5602
5686
|
const reducer = reducers[key];
|
|
5603
5687
|
const field = reducer.field;
|
|
@@ -5606,8 +5690,10 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5606
5690
|
}
|
|
5607
5691
|
}
|
|
5608
5692
|
}
|
|
5693
|
+
let selfLoaded = true;
|
|
5609
5694
|
let theValue = groupKeys[groupKeys.length - 1];
|
|
5610
5695
|
if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
|
|
5696
|
+
selfLoaded = false;
|
|
5611
5697
|
theValue = null;
|
|
5612
5698
|
}
|
|
5613
5699
|
const enhancedGroupData = {
|
|
@@ -5617,13 +5703,19 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5617
5703
|
groupKeys,
|
|
5618
5704
|
id: `${groupKeys}`,
|
|
5619
5705
|
collapsed,
|
|
5706
|
+
dataSourceHasGrouping: true,
|
|
5707
|
+
selfLoaded,
|
|
5620
5708
|
parents,
|
|
5621
|
-
|
|
5709
|
+
deepRowInfoArray: [],
|
|
5622
5710
|
collapsedChildrenCount: 0,
|
|
5623
5711
|
collapsedGroupsCount: 0,
|
|
5712
|
+
childrenAvailable: lazyLoad ? options.childrenAvailable : true,
|
|
5713
|
+
childrenLoading: options.childrenLoading,
|
|
5624
5714
|
indexInParentGroups: options.indexInParentGroups,
|
|
5625
5715
|
indexInGroup: options.indexInGroup,
|
|
5626
5716
|
indexInAll: options.indexInAll,
|
|
5717
|
+
directChildrenCount: options.directChildrenCount,
|
|
5718
|
+
directChildrenLoadedCount: lazyLoad ? options.directChildrenLoadedCount : options.directChildrenCount,
|
|
5627
5719
|
value: theValue,
|
|
5628
5720
|
rootGroupBy: groupBy,
|
|
5629
5721
|
groupBy: groupNesting === groupBy.length ? groupBy : groupBy.slice(0, groupNesting),
|
|
@@ -5636,7 +5728,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5636
5728
|
}
|
|
5637
5729
|
function completeReducers(reducers, reducerResults, items) {
|
|
5638
5730
|
if (reducers) {
|
|
5639
|
-
for (
|
|
5731
|
+
for (const key in reducers)
|
|
5640
5732
|
if (reducers.hasOwnProperty(key)) {
|
|
5641
5733
|
const reducer = reducers[key];
|
|
5642
5734
|
if (reducer.done) {
|
|
@@ -5648,6 +5740,7 @@ function completeReducers(reducers, reducerResults, items) {
|
|
|
5648
5740
|
}
|
|
5649
5741
|
function enhancedFlatten(param) {
|
|
5650
5742
|
const {
|
|
5743
|
+
lazyLoad,
|
|
5651
5744
|
groupResult,
|
|
5652
5745
|
toPrimaryKey,
|
|
5653
5746
|
groupRowsState,
|
|
@@ -5661,11 +5754,13 @@ function enhancedFlatten(param) {
|
|
|
5661
5754
|
const parents = [];
|
|
5662
5755
|
const indexInParentGroups = [];
|
|
5663
5756
|
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
5664
|
-
var _a;
|
|
5757
|
+
var _a, _b;
|
|
5665
5758
|
const items = deepMapValue.items;
|
|
5666
5759
|
const groupNesting = groupKeys.length;
|
|
5667
5760
|
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
5761
|
+
indexInParentGroups.push(indexInGroup);
|
|
5668
5762
|
const enhancedGroupData = getEnhancedGroupData({
|
|
5763
|
+
lazyLoad,
|
|
5669
5764
|
groupBy: groupByStrings,
|
|
5670
5765
|
parents: Array.from(parents),
|
|
5671
5766
|
reducers,
|
|
@@ -5673,35 +5768,59 @@ function enhancedFlatten(param) {
|
|
|
5673
5768
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
5674
5769
|
indexInAll: result.length,
|
|
5675
5770
|
groupKeys,
|
|
5771
|
+
childrenLoading: deepMapValue.childrenLoading,
|
|
5772
|
+
childrenAvailable: deepMapValue.childrenAvailable,
|
|
5773
|
+
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
5774
|
+
directChildrenLoadedCount: 0,
|
|
5676
5775
|
collapsed
|
|
5677
5776
|
}, deepMapValue);
|
|
5678
|
-
const
|
|
5777
|
+
const parent = parents[parents.length - 1];
|
|
5778
|
+
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
5779
|
+
let include = generateGroupRows || collapsed;
|
|
5780
|
+
if (parentCollapsed) {
|
|
5781
|
+
include = false;
|
|
5782
|
+
}
|
|
5679
5783
|
if (include) {
|
|
5680
5784
|
result.push(enhancedGroupData);
|
|
5681
5785
|
}
|
|
5682
5786
|
if (collapsed) {
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5787
|
+
enhancedGroupData.collapsedChildrenCount = enhancedGroupData.groupCount;
|
|
5788
|
+
parents.forEach((parent2) => {
|
|
5789
|
+
if (!parentCollapsed) {
|
|
5790
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
5791
|
+
}
|
|
5792
|
+
parent2.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
5793
|
+
parent2.collapsedGroupsCount += 1;
|
|
5687
5794
|
});
|
|
5688
5795
|
} else {
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5796
|
+
if (!parentCollapsed) {
|
|
5797
|
+
parents.forEach((parent2) => {
|
|
5798
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
5799
|
+
});
|
|
5800
|
+
}
|
|
5801
|
+
}
|
|
5802
|
+
if (parent && enhancedGroupData.selfLoaded && lazyLoad) {
|
|
5803
|
+
parent.directChildrenLoadedCount += 1;
|
|
5692
5804
|
}
|
|
5693
|
-
indexInParentGroups.push(indexInGroup);
|
|
5694
5805
|
parents.push(enhancedGroupData);
|
|
5695
|
-
|
|
5806
|
+
const continueWithChildren = !collapsed || lazyLoad;
|
|
5807
|
+
if (continueWithChildren) {
|
|
5696
5808
|
if (!next) {
|
|
5697
5809
|
if (!pivot) {
|
|
5698
5810
|
const startIndex = result.length;
|
|
5699
|
-
|
|
5811
|
+
if (!collapsed) {
|
|
5812
|
+
result.length += items.length;
|
|
5813
|
+
}
|
|
5814
|
+
for (let index = 0, len = items.length; index < len; index++) {
|
|
5815
|
+
const item = items[index];
|
|
5700
5816
|
const rowInfo = {
|
|
5701
5817
|
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
5702
5818
|
data: item,
|
|
5819
|
+
dataSourceHasGrouping: true,
|
|
5703
5820
|
isGroupRow: false,
|
|
5704
|
-
|
|
5821
|
+
selfLoaded: !!item,
|
|
5822
|
+
rootGroupBy: groupByStrings,
|
|
5823
|
+
collapsed,
|
|
5705
5824
|
groupKeys,
|
|
5706
5825
|
parents: Array.from(parents),
|
|
5707
5826
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
@@ -5711,11 +5830,19 @@ function enhancedFlatten(param) {
|
|
|
5711
5830
|
groupNesting,
|
|
5712
5831
|
groupCount: enhancedGroupData.groupCount
|
|
5713
5832
|
};
|
|
5714
|
-
parents.forEach((
|
|
5715
|
-
|
|
5833
|
+
parents.forEach((parent2, i) => {
|
|
5834
|
+
const last = i === parents.length - 1;
|
|
5835
|
+
if (last && item) {
|
|
5836
|
+
parent2.directChildrenLoadedCount += 1;
|
|
5837
|
+
}
|
|
5838
|
+
if (!parentCollapsed) {
|
|
5839
|
+
parent2.deepRowInfoArray.push(rowInfo);
|
|
5840
|
+
}
|
|
5716
5841
|
});
|
|
5717
|
-
|
|
5718
|
-
|
|
5842
|
+
if (!collapsed) {
|
|
5843
|
+
result[startIndex + index] = rowInfo;
|
|
5844
|
+
}
|
|
5845
|
+
}
|
|
5719
5846
|
}
|
|
5720
5847
|
} else {
|
|
5721
5848
|
next();
|
|
@@ -5729,6 +5856,89 @@ function enhancedFlatten(param) {
|
|
|
5729
5856
|
};
|
|
5730
5857
|
}
|
|
5731
5858
|
|
|
5859
|
+
// src/components/DataSource/index.tsx
|
|
5860
|
+
import {
|
|
5861
|
+
Fragment as Fragment2,
|
|
5862
|
+
createElement as createElement21
|
|
5863
|
+
} from "react";
|
|
5864
|
+
|
|
5865
|
+
// src/utils/multisort/sortTypes.ts
|
|
5866
|
+
var numberComparator = function(first, second) {
|
|
5867
|
+
return first - second;
|
|
5868
|
+
};
|
|
5869
|
+
var stringComparator = function(first, second) {
|
|
5870
|
+
first = `${first}`;
|
|
5871
|
+
second = `${second}`;
|
|
5872
|
+
return first.localeCompare(second);
|
|
5873
|
+
};
|
|
5874
|
+
var sortTypes = {
|
|
5875
|
+
number: numberComparator,
|
|
5876
|
+
string: stringComparator
|
|
5877
|
+
};
|
|
5878
|
+
var sortTypes_default = sortTypes;
|
|
5879
|
+
|
|
5880
|
+
// src/utils/multisort/index.ts
|
|
5881
|
+
var multisort = (sortInfo, array, get) => {
|
|
5882
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
5883
|
+
return array;
|
|
5884
|
+
};
|
|
5885
|
+
multisort.knownTypes = sortTypes_default;
|
|
5886
|
+
var getSingleSortFunction = (info) => {
|
|
5887
|
+
if (!info) {
|
|
5888
|
+
return;
|
|
5889
|
+
}
|
|
5890
|
+
const field = info.field;
|
|
5891
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5892
|
+
if (!dir) {
|
|
5893
|
+
return;
|
|
5894
|
+
}
|
|
5895
|
+
let fn = info.fn;
|
|
5896
|
+
if (!fn && info.type) {
|
|
5897
|
+
fn = multisort.knownTypes[info.type];
|
|
5898
|
+
if (!fn) {
|
|
5899
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
if (!fn) {
|
|
5903
|
+
fn = sortTypes_default.string;
|
|
5904
|
+
}
|
|
5905
|
+
return (first, second) => {
|
|
5906
|
+
const a = field ? first[field] : first;
|
|
5907
|
+
const b = field ? second[field] : second;
|
|
5908
|
+
return dir * fn(a, b);
|
|
5909
|
+
};
|
|
5910
|
+
};
|
|
5911
|
+
var getSortFunctions = (sortInfo) => {
|
|
5912
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
5913
|
+
};
|
|
5914
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
5915
|
+
const fns = getSortFunctions(sortInfo);
|
|
5916
|
+
return (first, second) => {
|
|
5917
|
+
if (get) {
|
|
5918
|
+
first = get(first);
|
|
5919
|
+
second = get(second);
|
|
5920
|
+
}
|
|
5921
|
+
let result = 0;
|
|
5922
|
+
let i = 0;
|
|
5923
|
+
let fn;
|
|
5924
|
+
const len = fns.length;
|
|
5925
|
+
for (; i < len; i++) {
|
|
5926
|
+
fn = fns[i];
|
|
5927
|
+
if (!fn) {
|
|
5928
|
+
continue;
|
|
5929
|
+
}
|
|
5930
|
+
result = fn(first, second);
|
|
5931
|
+
if (result !== 0) {
|
|
5932
|
+
return result;
|
|
5933
|
+
}
|
|
5934
|
+
}
|
|
5935
|
+
return result;
|
|
5936
|
+
};
|
|
5937
|
+
};
|
|
5938
|
+
|
|
5939
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5940
|
+
import { useEffect as useEffect18, useMemo as useMemo7, useRef as useRef17, useState as useState9 } from "react";
|
|
5941
|
+
|
|
5732
5942
|
// src/components/hooks/useEffectWithChanges.ts
|
|
5733
5943
|
import { useEffect as useEffect17, useRef as useRef16 } from "react";
|
|
5734
5944
|
function useEffectWithChanges(fn, deps) {
|
|
@@ -5757,7 +5967,15 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5757
5967
|
}, useEffectDeps);
|
|
5758
5968
|
}
|
|
5759
5969
|
|
|
5970
|
+
// src/components/DataSource/privateHooks/getChangeDetect.ts
|
|
5971
|
+
function getChangeDetect() {
|
|
5972
|
+
var _a;
|
|
5973
|
+
const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
|
|
5974
|
+
return `${Date.now()}:${perfNow}`;
|
|
5975
|
+
}
|
|
5976
|
+
|
|
5760
5977
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5978
|
+
var CACHE_DEFAULT = true;
|
|
5761
5979
|
var getRafPromise = () => new Promise((resolve) => {
|
|
5762
5980
|
requestAnimationFrame(resolve);
|
|
5763
5981
|
});
|
|
@@ -5765,11 +5983,6 @@ var SKIP_DATA_CHANGES_KEYS = {
|
|
|
5765
5983
|
originalDataArray: true,
|
|
5766
5984
|
changes: true
|
|
5767
5985
|
};
|
|
5768
|
-
function getChangeDetect() {
|
|
5769
|
-
var _a;
|
|
5770
|
-
const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
|
|
5771
|
-
return `${Date.now()}:${perfNow}`;
|
|
5772
|
-
}
|
|
5773
5986
|
function buildDataSourceDataParams(componentState, overrides) {
|
|
5774
5987
|
var _a, _b;
|
|
5775
5988
|
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
@@ -5781,6 +5994,9 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
5781
5994
|
pivotBy: componentState.pivotBy,
|
|
5782
5995
|
aggregationReducers: componentState.aggregationReducers
|
|
5783
5996
|
};
|
|
5997
|
+
if (dataSourceParams.groupBy) {
|
|
5998
|
+
dataSourceParams.groupRowsState = componentState.groupRowsState.getState();
|
|
5999
|
+
}
|
|
5784
6000
|
if (componentState.livePagination !== void 0) {
|
|
5785
6001
|
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
5786
6002
|
dataSourceParams.__cursorId = componentState.cursorId;
|
|
@@ -5816,7 +6032,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5816
6032
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
5817
6033
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
5818
6034
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
5819
|
-
const items = existingGroupRowInfo.
|
|
6035
|
+
const items = existingGroupRowInfo.children;
|
|
5820
6036
|
const len = items.length;
|
|
5821
6037
|
let allLoaded = true;
|
|
5822
6038
|
for (let i = 0; i < len; i++) {
|
|
@@ -5829,6 +6045,21 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5829
6045
|
return Promise.resolve(true);
|
|
5830
6046
|
}
|
|
5831
6047
|
}
|
|
6048
|
+
if (existingGroupRowInfo) {
|
|
6049
|
+
if (!existingGroupRowInfo.childrenLoading) {
|
|
6050
|
+
existingGroupRowInfo.childrenLoading = true;
|
|
6051
|
+
}
|
|
6052
|
+
} else {
|
|
6053
|
+
lazyGroupData.set(key, {
|
|
6054
|
+
error: void 0,
|
|
6055
|
+
children: [],
|
|
6056
|
+
childrenLoading: true,
|
|
6057
|
+
childrenAvailable: false,
|
|
6058
|
+
cache: CACHE_DEFAULT,
|
|
6059
|
+
totalCount: 0
|
|
6060
|
+
});
|
|
6061
|
+
}
|
|
6062
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
5832
6063
|
}
|
|
5833
6064
|
if (typeof data === "function") {
|
|
5834
6065
|
data = data(dataParams);
|
|
@@ -5838,7 +6069,6 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5838
6069
|
actions.loading = true;
|
|
5839
6070
|
}
|
|
5840
6071
|
return Promise.resolve(data).then((dataParam) => {
|
|
5841
|
-
var _a, _b, _c, _d;
|
|
5842
6072
|
let dataArray = [];
|
|
5843
6073
|
let skipAssign = false;
|
|
5844
6074
|
if (Array.isArray(dataParam.data)) {
|
|
@@ -5851,57 +6081,93 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5851
6081
|
actions.pivotMappings = remoteData.mappings;
|
|
5852
6082
|
}
|
|
5853
6083
|
if (componentState.lazyLoad) {
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
items: [],
|
|
5865
|
-
totalCount: newGroupRowInfo.totalCount,
|
|
5866
|
-
cache: (_b = newGroupRowInfo.cache) != null ? _b : true
|
|
6084
|
+
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6085
|
+
var _a, _b, _c, _d;
|
|
6086
|
+
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6087
|
+
const dataArray2 = remoteData2.data;
|
|
6088
|
+
const newGroupRowInfo = {
|
|
6089
|
+
cache: !!remoteData2.cache,
|
|
6090
|
+
childrenLoading: false,
|
|
6091
|
+
childrenAvailable: true,
|
|
6092
|
+
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6093
|
+
children: dataArray2
|
|
5867
6094
|
};
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
6095
|
+
const childDatasets = [];
|
|
6096
|
+
if (dataParams.lazyLoadBatchSize && !parentKeys) {
|
|
6097
|
+
const existingGroupRowInfo = lazyGroupData.get(theKey);
|
|
6098
|
+
const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
|
|
6099
|
+
children: [],
|
|
6100
|
+
childrenAvailable: true,
|
|
6101
|
+
childrenLoading: false,
|
|
6102
|
+
totalCount: newGroupRowInfo.totalCount,
|
|
6103
|
+
cache: (_b = newGroupRowInfo.cache) != null ? _b : CACHE_DEFAULT
|
|
6104
|
+
};
|
|
6105
|
+
if (existingGroupRowInfo) {
|
|
6106
|
+
existingGroupRowInfo.cache = newGroupRowInfo.cache;
|
|
6107
|
+
existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
|
|
6108
|
+
existingGroupRowInfo.childrenLoading = false;
|
|
6109
|
+
existingGroupRowInfo.childrenAvailable = true;
|
|
6110
|
+
existingGroupRowInfo.error = newGroupRowInfo.error;
|
|
5878
6111
|
}
|
|
5879
|
-
currentGroupRowInfo.
|
|
6112
|
+
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6113
|
+
const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
|
|
6114
|
+
const end = Math.min((_d = remoteData2.totalCount) != null ? _d : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6115
|
+
for (let i = start; i < end; i++) {
|
|
6116
|
+
const it = newGroupRowInfo.children[i - start];
|
|
6117
|
+
if (!it) {
|
|
6118
|
+
throw `lazily loaded item not found at index ${i - start}`;
|
|
6119
|
+
}
|
|
6120
|
+
currentGroupRowInfo.children[i] = it;
|
|
6121
|
+
if (it.dataset) {
|
|
6122
|
+
childDatasets.push({
|
|
6123
|
+
keys: it.keys,
|
|
6124
|
+
dataset: it.dataset
|
|
6125
|
+
});
|
|
6126
|
+
}
|
|
6127
|
+
}
|
|
6128
|
+
if (!existingGroupRowInfo) {
|
|
6129
|
+
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
6130
|
+
}
|
|
6131
|
+
} else {
|
|
6132
|
+
if (parentKeys) {
|
|
6133
|
+
newGroupRowInfo.children.forEach((child) => {
|
|
6134
|
+
if (child.dataset) {
|
|
6135
|
+
childDatasets.push({
|
|
6136
|
+
keys: child.keys,
|
|
6137
|
+
dataset: child.dataset
|
|
6138
|
+
});
|
|
6139
|
+
}
|
|
6140
|
+
});
|
|
6141
|
+
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
6142
|
+
}
|
|
6143
|
+
lazyGroupData.set(theKey, newGroupRowInfo);
|
|
5880
6144
|
}
|
|
5881
|
-
|
|
5882
|
-
|
|
6145
|
+
let skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = false;
|
|
6146
|
+
if (!keys || !keys.length) {
|
|
6147
|
+
const topLevelLazyGroupData = lazyGroupData.get([
|
|
6148
|
+
LAZY_ROOT_KEY_FOR_GROUPS
|
|
6149
|
+
]);
|
|
6150
|
+
actions.originalDataArray = [...topLevelLazyGroupData.children];
|
|
6151
|
+
skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = true;
|
|
5883
6152
|
}
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
6153
|
+
if (!skipTriggerChangeAsAlreadyOriginalArrayWasUpdated) {
|
|
6154
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
6155
|
+
}
|
|
6156
|
+
if (childDatasets.length) {
|
|
6157
|
+
const parentKeys2 = keys;
|
|
6158
|
+
childDatasets.forEach(({ keys: keys2, dataset }) => {
|
|
6159
|
+
resolveRemoteData(keys2, dataset, parentKeys2);
|
|
6160
|
+
});
|
|
6161
|
+
}
|
|
6162
|
+
};
|
|
6163
|
+
const lazyGroupData = componentState.originalLazyGroupData;
|
|
5887
6164
|
skipAssign = true;
|
|
5888
|
-
|
|
5889
|
-
if (!dataParams.groupKeys || !dataParams.groupKeys.length) {
|
|
5890
|
-
const topLevelItems = lazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]);
|
|
5891
|
-
actions.originalDataArray = [...topLevelItems.items];
|
|
5892
|
-
skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = true;
|
|
5893
|
-
}
|
|
5894
|
-
if (!skipTriggerChangeAsAlreadyOriginalArrayWasUpdated) {
|
|
5895
|
-
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
5896
|
-
}
|
|
6165
|
+
resolveRemoteData(dataParams.groupKeys || [], remoteData);
|
|
5897
6166
|
}
|
|
5898
6167
|
} else {
|
|
5899
6168
|
dataArray = dataParam;
|
|
5900
6169
|
}
|
|
5901
6170
|
if (!skipAssign) {
|
|
5902
|
-
if (append) {
|
|
5903
|
-
console.log("appending", dataArray);
|
|
5904
|
-
}
|
|
5905
6171
|
actions.originalDataArray = append ? componentState.originalDataArray.concat(dataArray) : dataArray;
|
|
5906
6172
|
}
|
|
5907
6173
|
if (dataIsPromise && !componentState.lazyLoad) {
|
|
@@ -6018,8 +6284,8 @@ function useLazyLoadRange() {
|
|
|
6018
6284
|
componentActions: actions,
|
|
6019
6285
|
componentState
|
|
6020
6286
|
} = useComponentState();
|
|
6021
|
-
|
|
6022
|
-
|
|
6287
|
+
useEffect18(() => {
|
|
6288
|
+
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6023
6289
|
}, [componentState.data, componentState.dataParams]);
|
|
6024
6290
|
const {
|
|
6025
6291
|
lazyLoadBatchSize,
|
|
@@ -6028,7 +6294,7 @@ function useLazyLoadRange() {
|
|
|
6028
6294
|
scrollStopDelayUpdatedByTable
|
|
6029
6295
|
} = componentState;
|
|
6030
6296
|
const latestRenderRangeRef = useRef17(null);
|
|
6031
|
-
const loadRange = (renderRange, cache =
|
|
6297
|
+
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
6032
6298
|
const componentState2 = getComponentState();
|
|
6033
6299
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
6034
6300
|
if (!renderRange) {
|
|
@@ -6051,11 +6317,11 @@ function useLazyLoadRange() {
|
|
|
6051
6317
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6052
6318
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6053
6319
|
latestRenderRangeRef.current = renderRange;
|
|
6054
|
-
loadRange(renderRange
|
|
6320
|
+
loadRange(renderRange);
|
|
6055
6321
|
});
|
|
6056
6322
|
}
|
|
6057
6323
|
return;
|
|
6058
|
-
}, [lazyLoadBatchSize
|
|
6324
|
+
}, [lazyLoadBatchSize]);
|
|
6059
6325
|
useEffect18(() => {
|
|
6060
6326
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6061
6327
|
debouncedLoadRange();
|
|
@@ -6072,7 +6338,10 @@ function lazyLoadRange(options, cache) {
|
|
|
6072
6338
|
componentActions
|
|
6073
6339
|
} = options;
|
|
6074
6340
|
const { dataArray } = componentState;
|
|
6075
|
-
const isRowLoaded = (index) =>
|
|
6341
|
+
const isRowLoaded = (index) => {
|
|
6342
|
+
const rowInfo = dataArray[index];
|
|
6343
|
+
return rowInfo.data != null;
|
|
6344
|
+
};
|
|
6076
6345
|
const perGroupFnCalls = new DeepMap();
|
|
6077
6346
|
const rootGroupKeys = ["_______xxx______"];
|
|
6078
6347
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
@@ -6080,13 +6349,32 @@ function lazyLoadRange(options, cache) {
|
|
|
6080
6349
|
if (!rowInfo) {
|
|
6081
6350
|
continue;
|
|
6082
6351
|
}
|
|
6083
|
-
const rowLoaded =
|
|
6084
|
-
const theGroupKeys = rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
6085
|
-
if (rowInfo.
|
|
6352
|
+
const rowLoaded = isRowLoaded(i);
|
|
6353
|
+
const theGroupKeys = rowInfo.dataSourceHasGrouping && rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
6354
|
+
if (rowInfo.isGroupRow && rowInfo.dataSourceHasGrouping && rowInfo.groupKeys) {
|
|
6086
6355
|
theGroupKeys.pop();
|
|
6087
6356
|
}
|
|
6088
6357
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6089
6358
|
const indexInGroup = rowInfo.indexInGroup;
|
|
6359
|
+
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6360
|
+
const currentFnCall = {
|
|
6361
|
+
lazyLoadStartIndex: 0,
|
|
6362
|
+
lazyLoadBatchSize,
|
|
6363
|
+
groupKeys: rowInfo.groupKeys
|
|
6364
|
+
};
|
|
6365
|
+
const cacheKeys2 = rowInfo.groupKeys;
|
|
6366
|
+
let cachedFnCalls = perGroupFnCalls.get(cacheKeys2);
|
|
6367
|
+
if (!(cachedFnCalls == null ? void 0 : cachedFnCalls[rowInfo.id])) {
|
|
6368
|
+
const shouldSetFnCalls = !cachedFnCalls;
|
|
6369
|
+
cachedFnCalls = cachedFnCalls || {};
|
|
6370
|
+
if (!cachedFnCalls[rowInfo.id]) {
|
|
6371
|
+
cachedFnCalls[rowInfo.id] = currentFnCall;
|
|
6372
|
+
}
|
|
6373
|
+
if (shouldSetFnCalls) {
|
|
6374
|
+
perGroupFnCalls.set(cacheKeys2, cachedFnCalls);
|
|
6375
|
+
}
|
|
6376
|
+
}
|
|
6377
|
+
}
|
|
6090
6378
|
if (!rowLoaded) {
|
|
6091
6379
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6092
6380
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
@@ -6118,7 +6406,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6118
6406
|
allFnCalls.push(...Object.values(record));
|
|
6119
6407
|
});
|
|
6120
6408
|
allFnCalls.reduce((promise, fnCall) => {
|
|
6121
|
-
const cacheKey =
|
|
6409
|
+
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
6122
6410
|
if (cache && cache.has(cacheKey)) {
|
|
6123
6411
|
return promise;
|
|
6124
6412
|
}
|
|
@@ -6128,22 +6416,65 @@ function lazyLoadRange(options, cache) {
|
|
|
6128
6416
|
}, initialPromise);
|
|
6129
6417
|
}
|
|
6130
6418
|
|
|
6131
|
-
// src/
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
6136
|
-
if (weakMap && weakMap.has(sortInfo)) {
|
|
6137
|
-
const prevResult = weakMap.get(sortInfo);
|
|
6138
|
-
if (prevResult && prevResult.length === result.length) {
|
|
6139
|
-
return prevResult;
|
|
6140
|
-
}
|
|
6419
|
+
// src/utils/shallowEqualObjects.ts
|
|
6420
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
6421
|
+
if (objA === objB) {
|
|
6422
|
+
return true;
|
|
6141
6423
|
}
|
|
6142
|
-
if (
|
|
6143
|
-
|
|
6424
|
+
if (!objA || !objB) {
|
|
6425
|
+
return false;
|
|
6144
6426
|
}
|
|
6145
|
-
|
|
6146
|
-
|
|
6427
|
+
var aKeys = Object.keys(objA);
|
|
6428
|
+
var bKeys = Object.keys(objB);
|
|
6429
|
+
if (ignoreKeys) {
|
|
6430
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6431
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6432
|
+
}
|
|
6433
|
+
var len = aKeys.length;
|
|
6434
|
+
if (bKeys.length !== len) {
|
|
6435
|
+
return false;
|
|
6436
|
+
}
|
|
6437
|
+
for (var i = 0; i < len; i++) {
|
|
6438
|
+
var key = aKeys[i];
|
|
6439
|
+
if (ignoreKeys) {
|
|
6440
|
+
if (ignoreKeys.has(key)) {
|
|
6441
|
+
continue;
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6445
|
+
return false;
|
|
6446
|
+
}
|
|
6447
|
+
}
|
|
6448
|
+
return true;
|
|
6449
|
+
}
|
|
6450
|
+
|
|
6451
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
6452
|
+
var map = new WeakMap();
|
|
6453
|
+
var getCompareDefault = (a) => a;
|
|
6454
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6455
|
+
map.set(fn, {
|
|
6456
|
+
lastCallTime: 0,
|
|
6457
|
+
lastCallArg: null
|
|
6458
|
+
});
|
|
6459
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6460
|
+
return (arg) => {
|
|
6461
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6462
|
+
lastCallTime: 0,
|
|
6463
|
+
lastCallArg: null
|
|
6464
|
+
};
|
|
6465
|
+
const now = Date.now();
|
|
6466
|
+
const diff = now - lastCallTime;
|
|
6467
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6468
|
+
if (diff < timeframe && objectsEqual) {
|
|
6469
|
+
return;
|
|
6470
|
+
}
|
|
6471
|
+
map.set(fn, {
|
|
6472
|
+
lastCallTime: now,
|
|
6473
|
+
lastCallArg: arg
|
|
6474
|
+
});
|
|
6475
|
+
fn(arg);
|
|
6476
|
+
};
|
|
6477
|
+
}
|
|
6147
6478
|
|
|
6148
6479
|
// src/components/DataSource/GroupRowsState.ts
|
|
6149
6480
|
var GroupRowsState = class {
|
|
@@ -6255,65 +6586,22 @@ var GroupRowsState = class {
|
|
|
6255
6586
|
}
|
|
6256
6587
|
};
|
|
6257
6588
|
|
|
6258
|
-
// src/
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
if (
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
var bKeys = Object.keys(objB);
|
|
6268
|
-
if (ignoreKeys) {
|
|
6269
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6270
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6271
|
-
}
|
|
6272
|
-
var len = aKeys.length;
|
|
6273
|
-
if (bKeys.length !== len) {
|
|
6274
|
-
return false;
|
|
6275
|
-
}
|
|
6276
|
-
for (var i = 0; i < len; i++) {
|
|
6277
|
-
var key = aKeys[i];
|
|
6278
|
-
if (ignoreKeys) {
|
|
6279
|
-
if (ignoreKeys.has(key)) {
|
|
6280
|
-
continue;
|
|
6281
|
-
}
|
|
6282
|
-
}
|
|
6283
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6284
|
-
return false;
|
|
6589
|
+
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6590
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
6591
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
6592
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
6593
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
6594
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
6595
|
+
const prevResult = weakMap.get(sortInfo);
|
|
6596
|
+
if (prevResult && prevResult.length === result.length) {
|
|
6597
|
+
return prevResult;
|
|
6285
6598
|
}
|
|
6286
6599
|
}
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
var getCompareDefault = (a) => a;
|
|
6293
|
-
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6294
|
-
map.set(fn, {
|
|
6295
|
-
lastCallTime: 0,
|
|
6296
|
-
lastCallArg: null
|
|
6297
|
-
});
|
|
6298
|
-
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6299
|
-
return (arg) => {
|
|
6300
|
-
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6301
|
-
lastCallTime: 0,
|
|
6302
|
-
lastCallArg: null
|
|
6303
|
-
};
|
|
6304
|
-
const now = Date.now();
|
|
6305
|
-
const diff = now - lastCallTime;
|
|
6306
|
-
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6307
|
-
if (diff < timeframe && objectsEqual) {
|
|
6308
|
-
return;
|
|
6309
|
-
}
|
|
6310
|
-
map.set(fn, {
|
|
6311
|
-
lastCallTime: now,
|
|
6312
|
-
lastCallArg: arg
|
|
6313
|
-
});
|
|
6314
|
-
fn(arg);
|
|
6315
|
-
};
|
|
6316
|
-
}
|
|
6600
|
+
if (weakMap && sortInfo) {
|
|
6601
|
+
weakMap.set(sortInfo, result);
|
|
6602
|
+
}
|
|
6603
|
+
return result;
|
|
6604
|
+
};
|
|
6317
6605
|
|
|
6318
6606
|
// src/components/DataSource/state/getInitialState.ts
|
|
6319
6607
|
var defaultCursorId = Symbol("cursorId");
|
|
@@ -6323,6 +6611,7 @@ function initSetupState() {
|
|
|
6323
6611
|
const dataArray = [];
|
|
6324
6612
|
const originalLazyGroupData = new DeepMap();
|
|
6325
6613
|
return {
|
|
6614
|
+
lazyLoadCacheOfLoadedBatches: new DeepMap(),
|
|
6326
6615
|
dataParams: void 0,
|
|
6327
6616
|
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
6328
6617
|
notifyScrollStop: buildSubscriptionCallback(),
|
|
@@ -6373,6 +6662,9 @@ var forwardProps2 = (setupState) => {
|
|
|
6373
6662
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
6374
6663
|
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
6375
6664
|
groupRowsState: (groupRowsState) => {
|
|
6665
|
+
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
6666
|
+
groupRowsState = new GroupRowsState(groupRowsState);
|
|
6667
|
+
}
|
|
6376
6668
|
return groupRowsState || new GroupRowsState({
|
|
6377
6669
|
expandedRows: true,
|
|
6378
6670
|
collapsedRows: []
|
|
@@ -6540,7 +6832,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6540
6832
|
pivotIndex: -1,
|
|
6541
6833
|
valueGetter: ({ rowInfo }) => {
|
|
6542
6834
|
var _a;
|
|
6543
|
-
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
6835
|
+
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6544
6836
|
}
|
|
6545
6837
|
}));
|
|
6546
6838
|
});
|
|
@@ -6589,6 +6881,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6589
6881
|
header,
|
|
6590
6882
|
valueGetter: ({ rowInfo }) => {
|
|
6591
6883
|
var _a, _b;
|
|
6884
|
+
if (!rowInfo.isGroupRow) {
|
|
6885
|
+
return null;
|
|
6886
|
+
}
|
|
6592
6887
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
6593
6888
|
}
|
|
6594
6889
|
});
|
|
@@ -6611,7 +6906,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6611
6906
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
6612
6907
|
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
6613
6908
|
if (!isSingleAggregationColumn) {
|
|
6614
|
-
|
|
6909
|
+
const parentGroupForTotalsGroup = columnGroupId;
|
|
6615
6910
|
columnGroupId = `total:${keys.join("/")}`;
|
|
6616
6911
|
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
6617
6912
|
header: `${keys[keys.length - 1]} total`,
|
|
@@ -6641,6 +6936,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6641
6936
|
sortable: false,
|
|
6642
6937
|
valueGetter: ({ rowInfo }) => {
|
|
6643
6938
|
var _a, _b;
|
|
6939
|
+
if (!rowInfo.isGroupRow) {
|
|
6940
|
+
return null;
|
|
6941
|
+
}
|
|
6644
6942
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
6645
6943
|
}
|
|
6646
6944
|
});
|
|
@@ -6676,12 +6974,13 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
6676
6974
|
};
|
|
6677
6975
|
function toRowInfo(data, id, index) {
|
|
6678
6976
|
return {
|
|
6977
|
+
dataSourceHasGrouping: false,
|
|
6679
6978
|
data,
|
|
6680
|
-
collapsed: true,
|
|
6681
6979
|
id,
|
|
6682
6980
|
indexInAll: index,
|
|
6683
6981
|
indexInGroup: index,
|
|
6684
|
-
isGroupRow: false
|
|
6982
|
+
isGroupRow: false,
|
|
6983
|
+
selfLoaded: true
|
|
6685
6984
|
};
|
|
6686
6985
|
}
|
|
6687
6986
|
function concludeReducer(params) {
|
|
@@ -6709,7 +7008,7 @@ function concludeReducer(params) {
|
|
|
6709
7008
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
6710
7009
|
const groupBy = state.groupBy;
|
|
6711
7010
|
const pivotBy = state.pivotBy;
|
|
6712
|
-
const shouldGroup = groupBy.length || pivotBy;
|
|
7011
|
+
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
6713
7012
|
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
6714
7013
|
"generateGroupRows",
|
|
6715
7014
|
"originalDataArray",
|
|
@@ -6734,12 +7033,8 @@ function concludeReducer(params) {
|
|
|
6734
7033
|
state.sortedAt = now;
|
|
6735
7034
|
}
|
|
6736
7035
|
state.postSortDataArray = dataArray;
|
|
6737
|
-
state.groupDeepMap = void 0;
|
|
6738
7036
|
const toPrimaryKey = (data) => {
|
|
6739
7037
|
const pk = data[state.primaryKey];
|
|
6740
|
-
if (Array.isArray(pk)) {
|
|
6741
|
-
debugger;
|
|
6742
|
-
}
|
|
6743
7038
|
return pk;
|
|
6744
7039
|
};
|
|
6745
7040
|
if (shouldGroup) {
|
|
@@ -6756,6 +7051,7 @@ function concludeReducer(params) {
|
|
|
6756
7051
|
}, dataArray);
|
|
6757
7052
|
const flattenResult = enhancedFlatten({
|
|
6758
7053
|
groupResult,
|
|
7054
|
+
lazyLoad: !!state.lazyLoad,
|
|
6759
7055
|
reducers: state.aggregationReducers,
|
|
6760
7056
|
toPrimaryKey,
|
|
6761
7057
|
groupRowsState: state.groupRowsState,
|
|
@@ -6811,7 +7107,7 @@ function DataSourceWithContext(props) {
|
|
|
6811
7107
|
if (typeof children === "function") {
|
|
6812
7108
|
children = children(computedValues);
|
|
6813
7109
|
}
|
|
6814
|
-
return /* @__PURE__ */
|
|
7110
|
+
return /* @__PURE__ */ createElement21(Fragment2, null, children);
|
|
6815
7111
|
}
|
|
6816
7112
|
var DataSourceRoot = getComponentStateRoot({
|
|
6817
7113
|
initSetupState,
|
|
@@ -6834,14 +7130,14 @@ function DataSourceCmp({ children }) {
|
|
|
6834
7130
|
globalThis.getDataSourceState = getState;
|
|
6835
7131
|
}
|
|
6836
7132
|
useLoadData();
|
|
6837
|
-
return /* @__PURE__ */
|
|
7133
|
+
return /* @__PURE__ */ createElement21(DataSourceContext.Provider, {
|
|
6838
7134
|
value: contextValue
|
|
6839
|
-
}, /* @__PURE__ */
|
|
7135
|
+
}, /* @__PURE__ */ createElement21(DataSourceWithContext, {
|
|
6840
7136
|
children
|
|
6841
7137
|
}));
|
|
6842
7138
|
}
|
|
6843
7139
|
function DataSource(props) {
|
|
6844
|
-
return /* @__PURE__ */
|
|
7140
|
+
return /* @__PURE__ */ createElement21(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement21(DataSourceCmp, {
|
|
6845
7141
|
children: props.children
|
|
6846
7142
|
}));
|
|
6847
7143
|
}
|
|
@@ -6854,10 +7150,26 @@ function useToggleGroupRow() {
|
|
|
6854
7150
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
6855
7151
|
newState.toggleGroupRow(groupKeys);
|
|
6856
7152
|
dataSourceActions.groupRowsState = newState;
|
|
6857
|
-
if (state.lazyLoad
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
7153
|
+
if (state.lazyLoad) {
|
|
7154
|
+
const dataKeys = [LAZY_ROOT_KEY_FOR_GROUPS, ...groupKeys];
|
|
7155
|
+
const currentData = state.originalLazyGroupData.get(dataKeys);
|
|
7156
|
+
if (newState.isGroupRowExpanded(groupKeys)) {
|
|
7157
|
+
if (!(currentData == null ? void 0 : currentData.cache)) {
|
|
7158
|
+
loadData(state.data, state, dataSourceActions, {
|
|
7159
|
+
groupKeys
|
|
7160
|
+
});
|
|
7161
|
+
}
|
|
7162
|
+
} else {
|
|
7163
|
+
if (!(currentData == null ? void 0 : currentData.cache)) {
|
|
7164
|
+
const keysToDelete = state.lazyLoadCacheOfLoadedBatches.getKeysStartingWith(groupKeys);
|
|
7165
|
+
keysToDelete.forEach((keys) => {
|
|
7166
|
+
state.lazyLoadCacheOfLoadedBatches.delete(keys);
|
|
7167
|
+
});
|
|
7168
|
+
dataSourceActions.lazyLoadCacheOfLoadedBatches = DeepMap.clone(state.lazyLoadCacheOfLoadedBatches);
|
|
7169
|
+
state.originalLazyGroupData.delete(dataKeys);
|
|
7170
|
+
dataSourceActions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
6861
7173
|
}
|
|
6862
7174
|
}, []);
|
|
6863
7175
|
return toggleGroupRow;
|
|
@@ -6927,12 +7239,18 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
6927
7239
|
field,
|
|
6928
7240
|
valueGetter: ({ rowInfo }) => {
|
|
6929
7241
|
var _a;
|
|
6930
|
-
return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
|
|
7242
|
+
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
6931
7243
|
},
|
|
6932
7244
|
rowspan: ({ rowInfo, dataArray }) => {
|
|
7245
|
+
if (!rowInfo.isGroupRow) {
|
|
7246
|
+
return 1;
|
|
7247
|
+
}
|
|
6933
7248
|
const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
|
|
6934
7249
|
indexInParentGroups: []
|
|
6935
7250
|
};
|
|
7251
|
+
if (!prevRowInfo || !prevRowInfo.dataSourceHasGrouping) {
|
|
7252
|
+
return 1;
|
|
7253
|
+
}
|
|
6936
7254
|
const prevIndexes = prevRowInfo.indexInParentGroups || [];
|
|
6937
7255
|
const currentIndexes = rowInfo.indexInParentGroups || [];
|
|
6938
7256
|
let computeSpan = false;
|
|
@@ -7085,8 +7403,11 @@ function useHideColumns(groupByMap) {
|
|
|
7085
7403
|
let expandedGroupsLevel = 0;
|
|
7086
7404
|
const len = dataArray.length;
|
|
7087
7405
|
for (let i = 0; i < len; i++) {
|
|
7088
|
-
const
|
|
7089
|
-
|
|
7406
|
+
const rowInfo = dataArray[i];
|
|
7407
|
+
if (!rowInfo.isGroupRow) {
|
|
7408
|
+
continue;
|
|
7409
|
+
}
|
|
7410
|
+
expandedGroupsLevel = Math.max(expandedGroupsLevel, rowInfo.groupNesting - 1);
|
|
7090
7411
|
if (expandedGroupsLevel === groupsLength - 1) {
|
|
7091
7412
|
break;
|
|
7092
7413
|
}
|
|
@@ -8195,7 +8516,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
8195
8516
|
const valid = useMemo10(() => {
|
|
8196
8517
|
let valid2 = isValidLicense(licenseKey, {
|
|
8197
8518
|
publishedAt: 1624970570587,
|
|
8198
|
-
version: "0.3.0
|
|
8519
|
+
version: "0.3.0"
|
|
8199
8520
|
});
|
|
8200
8521
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8201
8522
|
return true;
|
|
@@ -8471,27 +8792,27 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8471
8792
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8472
8793
|
}, [scrollStopDelay]);
|
|
8473
8794
|
useAutoSizeColumns();
|
|
8474
|
-
return /* @__PURE__ */
|
|
8795
|
+
return /* @__PURE__ */ createElement22("div", __spreadValues({
|
|
8475
8796
|
ref: domRef
|
|
8476
|
-
}, domProps), header ? /* @__PURE__ */
|
|
8797
|
+
}, domProps), header ? /* @__PURE__ */ createElement22(TableHeaderWrapper, {
|
|
8477
8798
|
brain: headerBrain,
|
|
8478
8799
|
scrollbars
|
|
8479
|
-
}) : null, /* @__PURE__ */
|
|
8800
|
+
}) : null, /* @__PURE__ */ createElement22(InfiniteTableBody, null, /* @__PURE__ */ createElement22(HeadlessTable, {
|
|
8480
8801
|
tabIndex: 0,
|
|
8481
8802
|
scrollStopDelay,
|
|
8482
8803
|
brain,
|
|
8483
8804
|
renderCell,
|
|
8484
8805
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8485
8806
|
scrollerDOMRef
|
|
8486
|
-
}), /* @__PURE__ */
|
|
8807
|
+
}), /* @__PURE__ */ createElement22(LoadMaskCmp, {
|
|
8487
8808
|
visible: loading
|
|
8488
|
-
}, loadingText)), licenseValid ? null : /* @__PURE__ */
|
|
8809
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ createElement22(InfiniteTableLicenseFooter, null), /* @__PURE__ */ createElement22("div", {
|
|
8489
8810
|
ref: portalDOMRef,
|
|
8490
8811
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8491
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
8812
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement22(CSSVariableWatch, {
|
|
8492
8813
|
varName: rowHeightCSSVar,
|
|
8493
8814
|
onChange: onRowHeightCSSVarChange
|
|
8494
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
8815
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ createElement22(CSSVariableWatch, {
|
|
8495
8816
|
varName: headerHeightCSSVar,
|
|
8496
8817
|
onChange: onHeaderHeightCSSVarChange
|
|
8497
8818
|
}) : null);
|
|
@@ -8534,13 +8855,13 @@ function InfiniteTableContextProvider() {
|
|
|
8534
8855
|
}
|
|
8535
8856
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8536
8857
|
const TableContext2 = getInfiniteTableContext();
|
|
8537
|
-
return /* @__PURE__ */
|
|
8858
|
+
return /* @__PURE__ */ createElement22(TableContext2.Provider, {
|
|
8538
8859
|
value: contextValue
|
|
8539
|
-
}, /* @__PURE__ */
|
|
8860
|
+
}, /* @__PURE__ */ createElement22(InfiniteTableComponent, null));
|
|
8540
8861
|
}
|
|
8541
8862
|
function InfiniteTable(props) {
|
|
8542
|
-
const table = /* @__PURE__ */
|
|
8543
|
-
return /* @__PURE__ */
|
|
8863
|
+
const table = /* @__PURE__ */ createElement22(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement22(InfiniteTableContextProvider, null));
|
|
8864
|
+
return /* @__PURE__ */ createElement22(StrictMode, null, table);
|
|
8544
8865
|
}
|
|
8545
8866
|
InfiniteTable.defaultProps = {
|
|
8546
8867
|
rowHeight: 40,
|