@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.js
CHANGED
|
@@ -660,7 +660,7 @@ function debounce(fn, { wait }) {
|
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
// src/components/InfiniteTable/index.tsx
|
|
663
|
-
var
|
|
663
|
+
var React27 = __toModule(require("react"));
|
|
664
664
|
|
|
665
665
|
// src/utils/join.ts
|
|
666
666
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -997,13 +997,30 @@ function AvoidReactDiffFn(props) {
|
|
|
997
997
|
var AvoidReactDiff = React7.memo(AvoidReactDiffFn);
|
|
998
998
|
|
|
999
999
|
// src/components/utils/buildSubscriptionCallback.tsx
|
|
1000
|
-
function buildSubscriptionCallback() {
|
|
1000
|
+
function buildSubscriptionCallback(withRaf = false) {
|
|
1001
1001
|
let result = null;
|
|
1002
1002
|
let fns = [];
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1003
|
+
let rafId = null;
|
|
1004
|
+
const updater = (items, callback) => {
|
|
1005
|
+
if (withRaf) {
|
|
1006
|
+
if (rafId != null) {
|
|
1007
|
+
cancelAnimationFrame(rafId);
|
|
1008
|
+
rafId = null;
|
|
1009
|
+
}
|
|
1010
|
+
requestAnimationFrame(() => {
|
|
1011
|
+
result = items;
|
|
1012
|
+
rafId = null;
|
|
1013
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1014
|
+
fns[i](items);
|
|
1015
|
+
}
|
|
1016
|
+
callback == null ? void 0 : callback();
|
|
1017
|
+
});
|
|
1018
|
+
} else {
|
|
1019
|
+
result = items;
|
|
1020
|
+
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1021
|
+
fns[i](items);
|
|
1022
|
+
}
|
|
1023
|
+
callback == null ? void 0 : callback();
|
|
1007
1024
|
}
|
|
1008
1025
|
};
|
|
1009
1026
|
updater.get = () => result;
|
|
@@ -1044,6 +1061,19 @@ function arrayIntersection(...arrays) {
|
|
|
1044
1061
|
});
|
|
1045
1062
|
}
|
|
1046
1063
|
|
|
1064
|
+
// src/utils/getGlobal.ts
|
|
1065
|
+
function getGlobal() {
|
|
1066
|
+
return globalThis;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// src/utils/raf.ts
|
|
1070
|
+
var raf = getGlobal().requestAnimationFrame || ((fn) => {
|
|
1071
|
+
return setTimeout(fn, 16);
|
|
1072
|
+
});
|
|
1073
|
+
var cancelRaf = getGlobal().cancelAnimationFrame || ((timeoutId) => {
|
|
1074
|
+
return clearTimeout(timeoutId);
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1047
1077
|
// src/components/VirtualBrain/MatrixBrain.ts
|
|
1048
1078
|
var import_binary_search = __toModule(require_binary_search());
|
|
1049
1079
|
var getRenderRangeCellCount = (range) => {
|
|
@@ -1056,7 +1086,7 @@ var getRenderRangeCellCount = (range) => {
|
|
|
1056
1086
|
};
|
|
1057
1087
|
var ALL_DIRECTIONS = { horizontal: true, vertical: true };
|
|
1058
1088
|
var SORT_ASC = (a, b) => a - b;
|
|
1059
|
-
var
|
|
1089
|
+
var raf2 = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
|
|
1060
1090
|
var MatrixBrain = class extends Logger {
|
|
1061
1091
|
constructor() {
|
|
1062
1092
|
super(`MatrixBrain`);
|
|
@@ -1241,7 +1271,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1241
1271
|
const fns = this.onAvailableSizeChangeFns;
|
|
1242
1272
|
const range = this.getAvailableSize();
|
|
1243
1273
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1244
|
-
|
|
1274
|
+
raf2(() => {
|
|
1245
1275
|
fns[i](range);
|
|
1246
1276
|
});
|
|
1247
1277
|
}
|
|
@@ -1250,7 +1280,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1250
1280
|
const fns = this.onRenderRangeChangeFns;
|
|
1251
1281
|
const range = this.getRenderRange();
|
|
1252
1282
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1253
|
-
|
|
1283
|
+
raf2(() => {
|
|
1254
1284
|
fns[i](range);
|
|
1255
1285
|
});
|
|
1256
1286
|
}
|
|
@@ -1259,7 +1289,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1259
1289
|
const fns = this.onVerticalRenderRangeChangeFns;
|
|
1260
1290
|
const range = this.verticalRenderRange;
|
|
1261
1291
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1262
|
-
|
|
1292
|
+
raf2(() => {
|
|
1263
1293
|
fns[i]([range.startIndex, range.endIndex]);
|
|
1264
1294
|
});
|
|
1265
1295
|
}
|
|
@@ -1268,7 +1298,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1268
1298
|
const fns = this.onHorizontalRenderRangeChangeFns;
|
|
1269
1299
|
const range = this.horizontalRenderRange;
|
|
1270
1300
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1271
|
-
|
|
1301
|
+
raf2(() => {
|
|
1272
1302
|
fns[i]([range.startIndex, range.endIndex]);
|
|
1273
1303
|
});
|
|
1274
1304
|
}
|
|
@@ -1968,7 +1998,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1968
1998
|
};
|
|
1969
1999
|
const fns = this.onRenderCountChangeFns;
|
|
1970
2000
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1971
|
-
|
|
2001
|
+
raf2(() => {
|
|
1972
2002
|
fns[i](renderCount);
|
|
1973
2003
|
});
|
|
1974
2004
|
}
|
|
@@ -2064,6 +2094,20 @@ var DeepMap = class {
|
|
|
2064
2094
|
return clone;
|
|
2065
2095
|
}
|
|
2066
2096
|
getValuesStartingWith(keys) {
|
|
2097
|
+
const result = [];
|
|
2098
|
+
this.getStartingWith(keys, (_keys, value) => {
|
|
2099
|
+
result.push(value);
|
|
2100
|
+
});
|
|
2101
|
+
return result;
|
|
2102
|
+
}
|
|
2103
|
+
getKeysStartingWith(keys) {
|
|
2104
|
+
const result = [];
|
|
2105
|
+
this.getStartingWith(keys, (keys2) => {
|
|
2106
|
+
result.push(keys2);
|
|
2107
|
+
});
|
|
2108
|
+
return result;
|
|
2109
|
+
}
|
|
2110
|
+
getStartingWith(keys, fn) {
|
|
2067
2111
|
let currentMap = this.map;
|
|
2068
2112
|
let pair;
|
|
2069
2113
|
if (!keys.length) {
|
|
@@ -2073,16 +2117,37 @@ var DeepMap = class {
|
|
|
2073
2117
|
const key = keys[i];
|
|
2074
2118
|
pair = currentMap.get(key);
|
|
2075
2119
|
if (!pair || !pair.map) {
|
|
2076
|
-
return
|
|
2120
|
+
return;
|
|
2077
2121
|
}
|
|
2078
2122
|
currentMap = pair.map;
|
|
2079
2123
|
}
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2124
|
+
if (pair && pair.value !== void 0) {
|
|
2125
|
+
fn(keys, pair.value);
|
|
2126
|
+
}
|
|
2127
|
+
this.visitWithNext(keys, (value, keys2, _i, next) => {
|
|
2128
|
+
fn(keys2, value);
|
|
2083
2129
|
next == null ? void 0 : next();
|
|
2084
2130
|
}, currentMap);
|
|
2085
|
-
|
|
2131
|
+
}
|
|
2132
|
+
getDirectChildrenSizeFor(keys) {
|
|
2133
|
+
var _a;
|
|
2134
|
+
let currentMap = this.map;
|
|
2135
|
+
if (!keys.length) {
|
|
2136
|
+
keys = [this.emptyKey];
|
|
2137
|
+
}
|
|
2138
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2139
|
+
const key = keys[i];
|
|
2140
|
+
const last = i === len - 1;
|
|
2141
|
+
const pair = currentMap.get(key);
|
|
2142
|
+
if (!pair || !pair.map) {
|
|
2143
|
+
return 0;
|
|
2144
|
+
}
|
|
2145
|
+
currentMap = pair.map;
|
|
2146
|
+
if (last) {
|
|
2147
|
+
return (_a = currentMap == null ? void 0 : currentMap.size) != null ? _a : 0;
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
return 0;
|
|
2086
2151
|
}
|
|
2087
2152
|
set(keys, value) {
|
|
2088
2153
|
let currentMap = this.map;
|
|
@@ -2152,7 +2217,7 @@ var DeepMap = class {
|
|
|
2152
2217
|
} else {
|
|
2153
2218
|
keys = [...keys];
|
|
2154
2219
|
}
|
|
2155
|
-
|
|
2220
|
+
const maps = [currentMap];
|
|
2156
2221
|
let result = false;
|
|
2157
2222
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2158
2223
|
const key = keys[i];
|
|
@@ -2441,6 +2506,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2441
2506
|
this.updaters = [];
|
|
2442
2507
|
this.items = [];
|
|
2443
2508
|
this.currentHoveredRow = -1;
|
|
2509
|
+
this.hoverRowUpdatesInProgress = new Map();
|
|
2444
2510
|
this.getExtraSpanCellsForRange = (range) => {
|
|
2445
2511
|
const { start, end } = range;
|
|
2446
2512
|
const [startRow, startCol] = start;
|
|
@@ -2719,6 +2785,28 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2719
2785
|
}
|
|
2720
2786
|
});
|
|
2721
2787
|
};
|
|
2788
|
+
this.updateHoverClassNamesForRow = (rowIndex) => {
|
|
2789
|
+
if (this.scrolling) {
|
|
2790
|
+
return;
|
|
2791
|
+
}
|
|
2792
|
+
if (this.hoverRowUpdatesInProgress.has(rowIndex)) {
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
this.hoverRowUpdatesInProgress.set(rowIndex, true);
|
|
2796
|
+
const checkHoverClass = () => {
|
|
2797
|
+
if (this.currentHoveredRow != -1 && !this.scrolling) {
|
|
2798
|
+
if (this.currentHoveredRow === rowIndex) {
|
|
2799
|
+
this.addHoverClass(rowIndex);
|
|
2800
|
+
} else {
|
|
2801
|
+
this.removeHoverClass(rowIndex);
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
};
|
|
2805
|
+
raf(() => {
|
|
2806
|
+
checkHoverClass();
|
|
2807
|
+
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
2808
|
+
});
|
|
2809
|
+
};
|
|
2722
2810
|
this.updateElementPosition = (elementIndex) => {
|
|
2723
2811
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2724
2812
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
@@ -2735,17 +2823,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2735
2823
|
}
|
|
2736
2824
|
const { x, y } = itemPosition;
|
|
2737
2825
|
if (itemElement) {
|
|
2738
|
-
|
|
2739
|
-
if (this.currentHoveredRow === rowIndex) {
|
|
2740
|
-
this.cellHoverClassNames.forEach((cls) => {
|
|
2741
|
-
itemElement.classList.add(cls);
|
|
2742
|
-
});
|
|
2743
|
-
} else {
|
|
2744
|
-
this.cellHoverClassNames.forEach((cls) => {
|
|
2745
|
-
itemElement.classList.remove(cls);
|
|
2746
|
-
});
|
|
2747
|
-
}
|
|
2748
|
-
}
|
|
2826
|
+
this.updateHoverClassNamesForRow(rowIndex);
|
|
2749
2827
|
if (true) {
|
|
2750
2828
|
itemElement.dataset.rowIndex = rowIndex;
|
|
2751
2829
|
itemElement.dataset.colIndex = colIndex;
|
|
@@ -2894,6 +2972,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2894
2972
|
this.destroyed = true;
|
|
2895
2973
|
this.reset();
|
|
2896
2974
|
this.onDestroy();
|
|
2975
|
+
this.hoverRowUpdatesInProgress.clear();
|
|
2976
|
+
this.hoverRowUpdatesInProgress = null;
|
|
2897
2977
|
this.brain = null;
|
|
2898
2978
|
this.mappedCells = null;
|
|
2899
2979
|
};
|
|
@@ -2902,7 +2982,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2902
2982
|
const removeOnScroll = brain.onScroll(this.adjustFixedElementsOnScroll);
|
|
2903
2983
|
const removeOnSizeChange = brain.onAvailableSizeChange(() => {
|
|
2904
2984
|
this.adjustFixedElementsOnScroll();
|
|
2905
|
-
|
|
2985
|
+
raf(() => {
|
|
2906
2986
|
this.adjustFixedElementsOnScroll();
|
|
2907
2987
|
});
|
|
2908
2988
|
});
|
|
@@ -3438,19 +3518,19 @@ var useInternalProps = () => {
|
|
|
3438
3518
|
};
|
|
3439
3519
|
|
|
3440
3520
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3441
|
-
var alignItems = { center: "
|
|
3442
|
-
var cssEllipsisClassName = "
|
|
3443
|
-
var cursor = { pointer: "
|
|
3444
|
-
var display = { flex: "
|
|
3445
|
-
var flex = { "1": "
|
|
3446
|
-
var justifyContent = { center: "
|
|
3447
|
-
var left = { "0": "
|
|
3448
|
-
var overflow = { hidden: "
|
|
3521
|
+
var alignItems = { center: "_16lm1iw13", stretch: "_16lm1iw14" };
|
|
3522
|
+
var cssEllipsisClassName = "_16lm1iw1c _16lm1iw1d _16lm1iw18";
|
|
3523
|
+
var cursor = { pointer: "_16lm1iwd" };
|
|
3524
|
+
var display = { flex: "_16lm1iwl", block: "_16lm1iwm", inlineBlock: "_16lm1iwn" };
|
|
3525
|
+
var flex = { "1": "_16lm1iwe", none: "_16lm1iwf" };
|
|
3526
|
+
var justifyContent = { center: "_16lm1iw15", start: "_16lm1iw16", end: "_16lm1iw17" };
|
|
3527
|
+
var left = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3528
|
+
var overflow = { hidden: "_16lm1iw18", auto: "_16lm1iw19", visible: "_16lm1iw1a" };
|
|
3449
3529
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3450
|
-
var top = { "0": "
|
|
3451
|
-
var transformTranslateZero = "
|
|
3452
|
-
var userSelect = { none: "
|
|
3453
|
-
var zIndex = { "1": "
|
|
3530
|
+
var top = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
3531
|
+
var transformTranslateZero = "_16lm1iwa";
|
|
3532
|
+
var userSelect = { none: "_16lm1iwo" };
|
|
3533
|
+
var zIndex = { "1": "_16lm1iwg", "10": "_16lm1iwh", "1000": "_16lm1iwi", "10000": "_16lm1iwj", "100000": "_16lm1iwk" };
|
|
3454
3534
|
|
|
3455
3535
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3456
3536
|
var InfiniteTableBody = React12.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
@@ -3493,7 +3573,7 @@ var useInfiniteTableState = () => {
|
|
|
3493
3573
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3494
3574
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3495
3575
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3496
|
-
var ColumnCellCls = "_1eexc2a5
|
|
3576
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3497
3577
|
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"]] });
|
|
3498
3578
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3499
3579
|
|
|
@@ -3835,18 +3915,19 @@ function SortIcon(props) {
|
|
|
3835
3915
|
|
|
3836
3916
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3837
3917
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3838
|
-
var CellCls = "_1eexc2a5
|
|
3918
|
+
var CellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3839
3919
|
var HeaderCellProxy = "_12zfob10";
|
|
3840
3920
|
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"]] });
|
|
3841
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob13
|
|
3842
|
-
var HeaderGroupCls = "_12zfob110
|
|
3921
|
+
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"]] });
|
|
3922
|
+
var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3843
3923
|
var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
|
|
3844
3924
|
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3845
|
-
var HeaderWrapperCls = "_12zfob1z
|
|
3925
|
+
var HeaderWrapperCls = "_12zfob1z _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
|
|
3846
3926
|
|
|
3847
3927
|
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
3848
3928
|
function RenderHookComponent(props) {
|
|
3849
|
-
|
|
3929
|
+
var _a;
|
|
3930
|
+
return (_a = props.render(props.renderParam)) != null ? _a : null;
|
|
3850
3931
|
}
|
|
3851
3932
|
|
|
3852
3933
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
@@ -3952,11 +4033,6 @@ function useInfiniteHeaderCell() {
|
|
|
3952
4033
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3953
4034
|
var React18 = __toModule(require("react"));
|
|
3954
4035
|
|
|
3955
|
-
// src/utils/getGlobal.ts
|
|
3956
|
-
function getGlobal() {
|
|
3957
|
-
return globalThis;
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
4036
|
// src/components/utils/getScrollbarWidth.ts
|
|
3961
4037
|
var scrollbarWidth;
|
|
3962
4038
|
function getScrollbarWidth() {
|
|
@@ -4298,9 +4374,9 @@ var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(-
|
|
|
4298
4374
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4299
4375
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4300
4376
|
var FooterCls = "_16lm1iw1";
|
|
4301
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4377
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwl _16lm1iw11 _16lm1iw0";
|
|
4302
4378
|
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: [] });
|
|
4303
|
-
var InfiniteClsShiftingColumns = "
|
|
4379
|
+
var InfiniteClsShiftingColumns = "_16lm1iwo";
|
|
4304
4380
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4305
4381
|
|
|
4306
4382
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
@@ -4402,15 +4478,18 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4402
4478
|
ref: domRef
|
|
4403
4479
|
}, "no column");
|
|
4404
4480
|
}
|
|
4405
|
-
const { data, isGroupRow,
|
|
4481
|
+
const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
|
|
4482
|
+
const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
|
|
4406
4483
|
const groupRowInfo = null;
|
|
4407
4484
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4408
4485
|
if (column.valueGetter) {
|
|
4409
4486
|
value = column.valueGetter(isGroupRow ? {
|
|
4410
4487
|
data: rowInfo.data,
|
|
4488
|
+
isGroupRow,
|
|
4411
4489
|
rowInfo
|
|
4412
4490
|
} : {
|
|
4413
4491
|
data: rowInfo.data,
|
|
4492
|
+
isGroupRow,
|
|
4414
4493
|
rowInfo
|
|
4415
4494
|
});
|
|
4416
4495
|
}
|
|
@@ -4424,18 +4503,25 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4424
4503
|
};
|
|
4425
4504
|
const stylingRenderParam = __spreadValues({
|
|
4426
4505
|
value,
|
|
4427
|
-
column
|
|
4506
|
+
column,
|
|
4507
|
+
isGroupRow
|
|
4428
4508
|
}, rest);
|
|
4429
|
-
|
|
4509
|
+
const renderValue = value;
|
|
4430
4510
|
const renderParam = __spreadProps(__spreadValues({
|
|
4431
4511
|
value,
|
|
4432
4512
|
column,
|
|
4433
4513
|
domRef,
|
|
4434
|
-
groupRowInfo
|
|
4514
|
+
groupRowInfo,
|
|
4515
|
+
isGroupRow
|
|
4435
4516
|
}, rest), {
|
|
4436
4517
|
rowIndex,
|
|
4437
4518
|
toggleGroupRow,
|
|
4438
|
-
toggleCurrentGroupRow: () =>
|
|
4519
|
+
toggleCurrentGroupRow: () => {
|
|
4520
|
+
if (!rowInfo.isGroupRow) {
|
|
4521
|
+
return;
|
|
4522
|
+
}
|
|
4523
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
4524
|
+
},
|
|
4439
4525
|
groupBy: computedDataSource.groupBy,
|
|
4440
4526
|
pivotBy: computedDataSource.pivotBy
|
|
4441
4527
|
});
|
|
@@ -4493,8 +4579,8 @@ var RowHoverCls = "_7pupv01";
|
|
|
4493
4579
|
var React21 = __toModule(require("react"));
|
|
4494
4580
|
|
|
4495
4581
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4496
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4497
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
4582
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx" };
|
|
4583
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx";
|
|
4498
4584
|
var LoadMaskTextCls = "qy58ya4";
|
|
4499
4585
|
|
|
4500
4586
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -4523,7 +4609,6 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4523
4609
|
const measuredMaxWidths = {};
|
|
4524
4610
|
const computedPaddingsForColumns = {};
|
|
4525
4611
|
if (match && match.length) {
|
|
4526
|
-
console.log(match);
|
|
4527
4612
|
match.forEach((content) => {
|
|
4528
4613
|
const cell = content.parentElement;
|
|
4529
4614
|
const isHeader = cell.matches(`.${InfiniteTableHeaderCellClassName}`);
|
|
@@ -4995,7 +5080,20 @@ function useColumnSizeFn(columns) {
|
|
|
4995
5080
|
var import_react34 = __toModule(require("react"));
|
|
4996
5081
|
|
|
4997
5082
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
4998
|
-
var
|
|
5083
|
+
var React25 = __toModule(require("react"));
|
|
5084
|
+
|
|
5085
|
+
// src/utils/stripVar.ts
|
|
5086
|
+
function stripVar(cssVariableWithVarString) {
|
|
5087
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
5088
|
+
}
|
|
5089
|
+
|
|
5090
|
+
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5091
|
+
var showLoadingIcon = (rowInfo) => {
|
|
5092
|
+
if (rowInfo.dataSourceHasGrouping) {
|
|
5093
|
+
return rowInfo.isGroupRow ? rowInfo.childrenLoading || !rowInfo.selfLoaded : !rowInfo.selfLoaded;
|
|
5094
|
+
}
|
|
5095
|
+
return !rowInfo.selfLoaded;
|
|
5096
|
+
};
|
|
4999
5097
|
|
|
5000
5098
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5001
5099
|
var React23 = __toModule(require("react"));
|
|
@@ -5003,8 +5101,8 @@ var import_react29 = __toModule(require("react"));
|
|
|
5003
5101
|
|
|
5004
5102
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5005
5103
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5006
|
-
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd
|
|
5007
|
-
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "
|
|
5104
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwf _16lm1iwd";
|
|
5105
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5008
5106
|
|
|
5009
5107
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5010
5108
|
function ExpanderIcon(props) {
|
|
@@ -5039,6 +5137,43 @@ function ExpanderIcon(props) {
|
|
|
5039
5137
|
}));
|
|
5040
5138
|
}
|
|
5041
5139
|
|
|
5140
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5141
|
+
var React24 = __toModule(require("react"));
|
|
5142
|
+
|
|
5143
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5144
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwf _16lm1iwd";
|
|
5145
|
+
|
|
5146
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5147
|
+
var LoadingIcon = (props) => {
|
|
5148
|
+
return /* @__PURE__ */ React24.createElement("svg", {
|
|
5149
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5150
|
+
style: {
|
|
5151
|
+
margin: "auto",
|
|
5152
|
+
display: "block",
|
|
5153
|
+
shapeRendering: "auto"
|
|
5154
|
+
},
|
|
5155
|
+
width: "24px",
|
|
5156
|
+
height: "24px",
|
|
5157
|
+
viewBox: "0 0 100 100",
|
|
5158
|
+
preserveAspectRatio: "xMidYMid",
|
|
5159
|
+
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5160
|
+
}, /* @__PURE__ */ React24.createElement("circle", {
|
|
5161
|
+
cx: "50",
|
|
5162
|
+
cy: "50",
|
|
5163
|
+
fill: "none",
|
|
5164
|
+
strokeWidth: "10",
|
|
5165
|
+
r: "35",
|
|
5166
|
+
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5167
|
+
}, /* @__PURE__ */ React24.createElement("animateTransform", {
|
|
5168
|
+
attributeName: "transform",
|
|
5169
|
+
type: "rotate",
|
|
5170
|
+
repeatCount: "indefinite",
|
|
5171
|
+
dur: "1s",
|
|
5172
|
+
values: "0 50 50;360 50 50",
|
|
5173
|
+
keyTimes: "0;1"
|
|
5174
|
+
})));
|
|
5175
|
+
};
|
|
5176
|
+
|
|
5042
5177
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5043
5178
|
function getGroupColumnRender({
|
|
5044
5179
|
groupIndexForColumn,
|
|
@@ -5049,12 +5184,12 @@ function getGroupColumnRender({
|
|
|
5049
5184
|
var _a, _b, _c;
|
|
5050
5185
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5051
5186
|
if (column.renderValue) {
|
|
5052
|
-
value = /* @__PURE__ */
|
|
5187
|
+
value = /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
5053
5188
|
render: column.renderValue,
|
|
5054
5189
|
renderParam: renderOptions
|
|
5055
5190
|
});
|
|
5056
5191
|
}
|
|
5057
|
-
|
|
5192
|
+
const groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : rowInfo.isGroupRow && ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndexForColumn]) || rowInfo;
|
|
5058
5193
|
if (!groupRowInfo) {
|
|
5059
5194
|
return null;
|
|
5060
5195
|
}
|
|
@@ -5077,31 +5212,30 @@ function getGroupColumnRender({
|
|
|
5077
5212
|
}
|
|
5078
5213
|
let icon = null;
|
|
5079
5214
|
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);
|
|
5080
|
-
|
|
5081
|
-
|
|
5215
|
+
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5216
|
+
if (isLoading) {
|
|
5217
|
+
icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
|
|
5218
|
+
} else if (showExpanderIcon) {
|
|
5219
|
+
const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
|
|
5082
5220
|
expanded: !collapsed,
|
|
5083
5221
|
onChange: () => {
|
|
5084
5222
|
toggleGroupRow(groupKeys);
|
|
5085
5223
|
}
|
|
5086
5224
|
});
|
|
5087
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5225
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
5088
5226
|
render: column.renderGroupIcon,
|
|
5089
5227
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5090
5228
|
}) : defaultIcon;
|
|
5091
5229
|
}
|
|
5092
|
-
return /* @__PURE__ */
|
|
5230
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
5093
5231
|
className: join(display.flex, alignItems.center)
|
|
5094
|
-
}, icon, /* @__PURE__ */
|
|
5232
|
+
}, icon, /* @__PURE__ */ React25.createElement("div", {
|
|
5095
5233
|
className: cssEllipsisClassName
|
|
5096
5234
|
}, value != null ? value : null));
|
|
5097
5235
|
};
|
|
5098
5236
|
}
|
|
5099
5237
|
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
5100
|
-
const {
|
|
5101
|
-
groupByForColumn,
|
|
5102
|
-
groupIndexForColumn,
|
|
5103
|
-
groupRenderStrategy
|
|
5104
|
-
} = options;
|
|
5238
|
+
const { groupByForColumn, groupIndexForColumn, groupRenderStrategy } = options;
|
|
5105
5239
|
let generatedGroupColumn = __spreadValues({
|
|
5106
5240
|
header: `Group by ${groupByForColumn.field}`,
|
|
5107
5241
|
groupByField: groupByForColumn.field,
|
|
@@ -5126,30 +5260,40 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5126
5260
|
header: `Group`,
|
|
5127
5261
|
groupByField: options.groupBy.map((g) => g.field),
|
|
5128
5262
|
sortable: false,
|
|
5263
|
+
style: ({ rowInfo }) => ({
|
|
5264
|
+
[stripVar(ThemeVars.components.Row.groupNesting)]: rowInfo.isGroupRow ? rowInfo.groupNesting - 1 : 0
|
|
5265
|
+
}),
|
|
5129
5266
|
render: (renderOptions) => {
|
|
5130
5267
|
var _a, _b;
|
|
5131
5268
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5132
|
-
if (!rowInfo.isGroupRow) {
|
|
5133
|
-
return null;
|
|
5134
|
-
}
|
|
5135
5269
|
if (column.renderValue) {
|
|
5136
5270
|
value = column.renderValue(renderOptions);
|
|
5137
5271
|
}
|
|
5138
|
-
const collapsed = rowInfo.collapsed;
|
|
5272
|
+
const collapsed = rowInfo.isGroupRow ? rowInfo.collapsed : false;
|
|
5139
5273
|
let icon = null;
|
|
5140
|
-
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);
|
|
5141
|
-
|
|
5142
|
-
|
|
5274
|
+
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;
|
|
5275
|
+
const isLoading = showLoadingIcon(rowInfo);
|
|
5276
|
+
if (isLoading) {
|
|
5277
|
+
icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
|
|
5278
|
+
} else if (showExpanderIcon) {
|
|
5279
|
+
const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
|
|
5143
5280
|
expanded: !collapsed,
|
|
5144
5281
|
onChange: () => {
|
|
5282
|
+
if (!rowInfo.isGroupRow) {
|
|
5283
|
+
return;
|
|
5284
|
+
}
|
|
5145
5285
|
toggleGroupRow(rowInfo.groupKeys);
|
|
5146
5286
|
}
|
|
5147
5287
|
});
|
|
5148
|
-
icon =
|
|
5288
|
+
icon = defaultIcon;
|
|
5289
|
+
if (column.renderGroupIcon) {
|
|
5290
|
+
const renderParam = Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions);
|
|
5291
|
+
icon = column.renderGroupIcon(renderParam);
|
|
5292
|
+
}
|
|
5149
5293
|
}
|
|
5150
|
-
return /* @__PURE__ */
|
|
5294
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
5151
5295
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5152
|
-
}, icon, /* @__PURE__ */
|
|
5296
|
+
}, icon, /* @__PURE__ */ React25.createElement("div", {
|
|
5153
5297
|
className: cssEllipsisClassName
|
|
5154
5298
|
}, value != null ? value : null));
|
|
5155
5299
|
}
|
|
@@ -5188,86 +5332,6 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5188
5332
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5189
5333
|
var import_react33 = __toModule(require("react"));
|
|
5190
5334
|
|
|
5191
|
-
// src/components/DataSource/index.tsx
|
|
5192
|
-
var React25 = __toModule(require("react"));
|
|
5193
|
-
|
|
5194
|
-
// src/utils/multisort/sortTypes.ts
|
|
5195
|
-
var numberComparator = function(first, second) {
|
|
5196
|
-
return first - second;
|
|
5197
|
-
};
|
|
5198
|
-
var stringComparator = function(first, second) {
|
|
5199
|
-
first = `${first}`;
|
|
5200
|
-
second = `${second}`;
|
|
5201
|
-
return first.localeCompare(second);
|
|
5202
|
-
};
|
|
5203
|
-
var sortTypes = {
|
|
5204
|
-
number: numberComparator,
|
|
5205
|
-
string: stringComparator
|
|
5206
|
-
};
|
|
5207
|
-
var sortTypes_default = sortTypes;
|
|
5208
|
-
|
|
5209
|
-
// src/utils/multisort/index.ts
|
|
5210
|
-
var multisort = (sortInfo, array, get) => {
|
|
5211
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
5212
|
-
return array;
|
|
5213
|
-
};
|
|
5214
|
-
multisort.knownTypes = sortTypes_default;
|
|
5215
|
-
var getSingleSortFunction = (info) => {
|
|
5216
|
-
if (!info) {
|
|
5217
|
-
return;
|
|
5218
|
-
}
|
|
5219
|
-
const field = info.field;
|
|
5220
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5221
|
-
if (!dir) {
|
|
5222
|
-
return;
|
|
5223
|
-
}
|
|
5224
|
-
let fn = info.fn;
|
|
5225
|
-
if (!fn && info.type) {
|
|
5226
|
-
fn = multisort.knownTypes[info.type];
|
|
5227
|
-
if (!fn) {
|
|
5228
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
5229
|
-
}
|
|
5230
|
-
}
|
|
5231
|
-
if (!fn) {
|
|
5232
|
-
fn = sortTypes_default.string;
|
|
5233
|
-
}
|
|
5234
|
-
return (first, second) => {
|
|
5235
|
-
const a = field ? first[field] : first;
|
|
5236
|
-
const b = field ? second[field] : second;
|
|
5237
|
-
return dir * fn(a, b);
|
|
5238
|
-
};
|
|
5239
|
-
};
|
|
5240
|
-
var getSortFunctions = (sortInfo) => {
|
|
5241
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
5242
|
-
};
|
|
5243
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
5244
|
-
const fns = getSortFunctions(sortInfo);
|
|
5245
|
-
return (first, second) => {
|
|
5246
|
-
if (get) {
|
|
5247
|
-
first = get(first);
|
|
5248
|
-
second = get(second);
|
|
5249
|
-
}
|
|
5250
|
-
let result = 0;
|
|
5251
|
-
let i = 0;
|
|
5252
|
-
let fn;
|
|
5253
|
-
const len = fns.length;
|
|
5254
|
-
for (; i < len; i++) {
|
|
5255
|
-
fn = fns[i];
|
|
5256
|
-
if (!fn) {
|
|
5257
|
-
continue;
|
|
5258
|
-
}
|
|
5259
|
-
result = fn(first, second);
|
|
5260
|
-
if (result !== 0) {
|
|
5261
|
-
return result;
|
|
5262
|
-
}
|
|
5263
|
-
}
|
|
5264
|
-
return result;
|
|
5265
|
-
};
|
|
5266
|
-
};
|
|
5267
|
-
|
|
5268
|
-
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5269
|
-
var import_react32 = __toModule(require("react"));
|
|
5270
|
-
|
|
5271
5335
|
// src/utils/groupAndPivot/index.ts
|
|
5272
5336
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
5273
5337
|
var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
|
|
@@ -5279,7 +5343,7 @@ function initReducers(reducers) {
|
|
|
5279
5343
|
return {};
|
|
5280
5344
|
}
|
|
5281
5345
|
const result = {};
|
|
5282
|
-
for (
|
|
5346
|
+
for (const key in reducers)
|
|
5283
5347
|
if (reducers.hasOwnProperty(key)) {
|
|
5284
5348
|
result[key] = reducers[key].initialValue;
|
|
5285
5349
|
}
|
|
@@ -5290,7 +5354,7 @@ function computeReducersFor(data, reducers, reducerResults) {
|
|
|
5290
5354
|
if (!reducers || !Object.keys(reducers).length) {
|
|
5291
5355
|
return;
|
|
5292
5356
|
}
|
|
5293
|
-
for (
|
|
5357
|
+
for (const key in reducers)
|
|
5294
5358
|
if (reducers.hasOwnProperty(key)) {
|
|
5295
5359
|
const reducer = reducers[key];
|
|
5296
5360
|
if (typeof reducer.reducer !== "function") {
|
|
@@ -5312,7 +5376,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5312
5376
|
function traverseValues(pivotDeepMap, container, pivot2, pivotIndex = 0, currentPivotKeys2 = []) {
|
|
5313
5377
|
const last = !pivot2.length || pivotIndex === pivot2.length - 1;
|
|
5314
5378
|
const values = container[(mappings == null ? void 0 : mappings.values) || "values"] || {};
|
|
5315
|
-
for (
|
|
5379
|
+
for (const k in values)
|
|
5316
5380
|
if (values.hasOwnProperty(k)) {
|
|
5317
5381
|
const pivotKey = k;
|
|
5318
5382
|
currentPivotKeys2.push(pivotKey);
|
|
@@ -5328,12 +5392,12 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5328
5392
|
}
|
|
5329
5393
|
}
|
|
5330
5394
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
5331
|
-
|
|
5395
|
+
const currentPivotKeys = [];
|
|
5332
5396
|
const initialReducerValue = initReducers(reducers);
|
|
5333
5397
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
5334
5398
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5335
5399
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5336
|
-
const dataArray = lazyGroupRowInfo.
|
|
5400
|
+
const dataArray = lazyGroupRowInfo.children;
|
|
5337
5401
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5338
5402
|
const deepMapGroupValue = deepMap.get(currentGroupKeys);
|
|
5339
5403
|
if (deepMapGroupValue) {
|
|
@@ -5341,11 +5405,23 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5341
5405
|
}
|
|
5342
5406
|
return next == null ? void 0 : next();
|
|
5343
5407
|
}
|
|
5408
|
+
if (lazyGroupRowInfo) {
|
|
5409
|
+
const current = deepMap.get(currentGroupKeys);
|
|
5410
|
+
if (current) {
|
|
5411
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
5412
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5413
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5414
|
+
current.error = lazyGroupRowInfo.error;
|
|
5415
|
+
}
|
|
5416
|
+
}
|
|
5344
5417
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5345
5418
|
if (!dataArray[i]) {
|
|
5346
5419
|
const deepMapGroupValue2 = {
|
|
5347
5420
|
items: [],
|
|
5348
|
-
reducerResults: {}
|
|
5421
|
+
reducerResults: {},
|
|
5422
|
+
cache: false,
|
|
5423
|
+
childrenLoading: false,
|
|
5424
|
+
childrenAvailable: false
|
|
5349
5425
|
};
|
|
5350
5426
|
deepMap.set([
|
|
5351
5427
|
...currentGroupKeys,
|
|
@@ -5355,7 +5431,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5355
5431
|
}
|
|
5356
5432
|
const dataObject = dataArray[i].data;
|
|
5357
5433
|
const dataKeys = dataArray[i].keys;
|
|
5358
|
-
|
|
5434
|
+
const item = dataObject;
|
|
5359
5435
|
if (dataKeys.length) {
|
|
5360
5436
|
const { field: groupByProperty } = groupBy[dataKeys.length - 1];
|
|
5361
5437
|
const key = item[groupByProperty];
|
|
@@ -5363,6 +5439,9 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5363
5439
|
}
|
|
5364
5440
|
const deepMapGroupValue = {
|
|
5365
5441
|
items: [],
|
|
5442
|
+
cache: false,
|
|
5443
|
+
childrenLoading: false,
|
|
5444
|
+
childrenAvailable: false,
|
|
5366
5445
|
commonData: dataObject,
|
|
5367
5446
|
reducerResults: dataArray[i].aggregations || {}
|
|
5368
5447
|
};
|
|
@@ -5431,13 +5510,16 @@ function group(groupParams, data) {
|
|
|
5431
5510
|
const groupByLength = groupBy.length;
|
|
5432
5511
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
5433
5512
|
const deepMap = new DeepMap();
|
|
5434
|
-
|
|
5435
|
-
|
|
5513
|
+
const currentGroupKeys = [];
|
|
5514
|
+
const currentPivotKeys = [];
|
|
5436
5515
|
const initialReducerValue = initReducers(reducers);
|
|
5437
5516
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
5438
5517
|
if (!groupByLength) {
|
|
5439
5518
|
const deepMapGroupValue = {
|
|
5440
5519
|
items: [],
|
|
5520
|
+
cache: false,
|
|
5521
|
+
childrenLoading: false,
|
|
5522
|
+
childrenAvailable: false,
|
|
5441
5523
|
reducerResults: __spreadValues({}, initialReducerValue)
|
|
5442
5524
|
};
|
|
5443
5525
|
if (pivot) {
|
|
@@ -5446,7 +5528,7 @@ function group(groupParams, data) {
|
|
|
5446
5528
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
5447
5529
|
}
|
|
5448
5530
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
5449
|
-
|
|
5531
|
+
const item = data[i];
|
|
5450
5532
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
5451
5533
|
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
5452
5534
|
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
@@ -5454,6 +5536,9 @@ function group(groupParams, data) {
|
|
|
5454
5536
|
if (!deepMap.has(currentGroupKeys)) {
|
|
5455
5537
|
const deepMapGroupValue = {
|
|
5456
5538
|
items: [],
|
|
5539
|
+
cache: false,
|
|
5540
|
+
childrenLoading: false,
|
|
5541
|
+
childrenAvailable: false,
|
|
5457
5542
|
reducerResults: __spreadValues({}, initialReducerValue)
|
|
5458
5543
|
};
|
|
5459
5544
|
if (pivot) {
|
|
@@ -5512,7 +5597,7 @@ function flatten(groupResult) {
|
|
|
5512
5597
|
return result;
|
|
5513
5598
|
}
|
|
5514
5599
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
5515
|
-
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
5600
|
+
const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
|
|
5516
5601
|
const groupNesting = groupKeys.length;
|
|
5517
5602
|
const {
|
|
5518
5603
|
items: groupItems,
|
|
@@ -5523,7 +5608,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5523
5608
|
let data = null;
|
|
5524
5609
|
if (Object.keys(reducerResults).length > 0) {
|
|
5525
5610
|
data = commonData || {};
|
|
5526
|
-
for (
|
|
5611
|
+
for (const key in reducers)
|
|
5527
5612
|
if (reducers.hasOwnProperty(key)) {
|
|
5528
5613
|
const reducer = reducers[key];
|
|
5529
5614
|
const field = reducer.field;
|
|
@@ -5532,8 +5617,10 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5532
5617
|
}
|
|
5533
5618
|
}
|
|
5534
5619
|
}
|
|
5620
|
+
let selfLoaded = true;
|
|
5535
5621
|
let theValue = groupKeys[groupKeys.length - 1];
|
|
5536
5622
|
if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
|
|
5623
|
+
selfLoaded = false;
|
|
5537
5624
|
theValue = null;
|
|
5538
5625
|
}
|
|
5539
5626
|
const enhancedGroupData = {
|
|
@@ -5543,13 +5630,19 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5543
5630
|
groupKeys,
|
|
5544
5631
|
id: `${groupKeys}`,
|
|
5545
5632
|
collapsed,
|
|
5633
|
+
dataSourceHasGrouping: true,
|
|
5634
|
+
selfLoaded,
|
|
5546
5635
|
parents,
|
|
5547
|
-
|
|
5636
|
+
deepRowInfoArray: [],
|
|
5548
5637
|
collapsedChildrenCount: 0,
|
|
5549
5638
|
collapsedGroupsCount: 0,
|
|
5639
|
+
childrenAvailable: lazyLoad ? options.childrenAvailable : true,
|
|
5640
|
+
childrenLoading: options.childrenLoading,
|
|
5550
5641
|
indexInParentGroups: options.indexInParentGroups,
|
|
5551
5642
|
indexInGroup: options.indexInGroup,
|
|
5552
5643
|
indexInAll: options.indexInAll,
|
|
5644
|
+
directChildrenCount: options.directChildrenCount,
|
|
5645
|
+
directChildrenLoadedCount: lazyLoad ? options.directChildrenLoadedCount : options.directChildrenCount,
|
|
5553
5646
|
value: theValue,
|
|
5554
5647
|
rootGroupBy: groupBy,
|
|
5555
5648
|
groupBy: groupNesting === groupBy.length ? groupBy : groupBy.slice(0, groupNesting),
|
|
@@ -5562,7 +5655,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5562
5655
|
}
|
|
5563
5656
|
function completeReducers(reducers, reducerResults, items) {
|
|
5564
5657
|
if (reducers) {
|
|
5565
|
-
for (
|
|
5658
|
+
for (const key in reducers)
|
|
5566
5659
|
if (reducers.hasOwnProperty(key)) {
|
|
5567
5660
|
const reducer = reducers[key];
|
|
5568
5661
|
if (reducer.done) {
|
|
@@ -5574,6 +5667,7 @@ function completeReducers(reducers, reducerResults, items) {
|
|
|
5574
5667
|
}
|
|
5575
5668
|
function enhancedFlatten(param) {
|
|
5576
5669
|
const {
|
|
5670
|
+
lazyLoad,
|
|
5577
5671
|
groupResult,
|
|
5578
5672
|
toPrimaryKey,
|
|
5579
5673
|
groupRowsState,
|
|
@@ -5587,11 +5681,13 @@ function enhancedFlatten(param) {
|
|
|
5587
5681
|
const parents = [];
|
|
5588
5682
|
const indexInParentGroups = [];
|
|
5589
5683
|
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
5590
|
-
var _a;
|
|
5684
|
+
var _a, _b;
|
|
5591
5685
|
const items = deepMapValue.items;
|
|
5592
5686
|
const groupNesting = groupKeys.length;
|
|
5593
5687
|
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
5688
|
+
indexInParentGroups.push(indexInGroup);
|
|
5594
5689
|
const enhancedGroupData = getEnhancedGroupData({
|
|
5690
|
+
lazyLoad,
|
|
5595
5691
|
groupBy: groupByStrings,
|
|
5596
5692
|
parents: Array.from(parents),
|
|
5597
5693
|
reducers,
|
|
@@ -5599,35 +5695,59 @@ function enhancedFlatten(param) {
|
|
|
5599
5695
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
5600
5696
|
indexInAll: result.length,
|
|
5601
5697
|
groupKeys,
|
|
5698
|
+
childrenLoading: deepMapValue.childrenLoading,
|
|
5699
|
+
childrenAvailable: deepMapValue.childrenAvailable,
|
|
5700
|
+
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
5701
|
+
directChildrenLoadedCount: 0,
|
|
5602
5702
|
collapsed
|
|
5603
5703
|
}, deepMapValue);
|
|
5604
|
-
const
|
|
5704
|
+
const parent = parents[parents.length - 1];
|
|
5705
|
+
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
5706
|
+
let include = generateGroupRows || collapsed;
|
|
5707
|
+
if (parentCollapsed) {
|
|
5708
|
+
include = false;
|
|
5709
|
+
}
|
|
5605
5710
|
if (include) {
|
|
5606
5711
|
result.push(enhancedGroupData);
|
|
5607
5712
|
}
|
|
5608
5713
|
if (collapsed) {
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5714
|
+
enhancedGroupData.collapsedChildrenCount = enhancedGroupData.groupCount;
|
|
5715
|
+
parents.forEach((parent2) => {
|
|
5716
|
+
if (!parentCollapsed) {
|
|
5717
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
5718
|
+
}
|
|
5719
|
+
parent2.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
5720
|
+
parent2.collapsedGroupsCount += 1;
|
|
5613
5721
|
});
|
|
5614
5722
|
} else {
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5723
|
+
if (!parentCollapsed) {
|
|
5724
|
+
parents.forEach((parent2) => {
|
|
5725
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
5726
|
+
});
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
if (parent && enhancedGroupData.selfLoaded && lazyLoad) {
|
|
5730
|
+
parent.directChildrenLoadedCount += 1;
|
|
5618
5731
|
}
|
|
5619
|
-
indexInParentGroups.push(indexInGroup);
|
|
5620
5732
|
parents.push(enhancedGroupData);
|
|
5621
|
-
|
|
5733
|
+
const continueWithChildren = !collapsed || lazyLoad;
|
|
5734
|
+
if (continueWithChildren) {
|
|
5622
5735
|
if (!next) {
|
|
5623
5736
|
if (!pivot) {
|
|
5624
5737
|
const startIndex = result.length;
|
|
5625
|
-
|
|
5738
|
+
if (!collapsed) {
|
|
5739
|
+
result.length += items.length;
|
|
5740
|
+
}
|
|
5741
|
+
for (let index = 0, len = items.length; index < len; index++) {
|
|
5742
|
+
const item = items[index];
|
|
5626
5743
|
const rowInfo = {
|
|
5627
5744
|
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
5628
5745
|
data: item,
|
|
5746
|
+
dataSourceHasGrouping: true,
|
|
5629
5747
|
isGroupRow: false,
|
|
5630
|
-
|
|
5748
|
+
selfLoaded: !!item,
|
|
5749
|
+
rootGroupBy: groupByStrings,
|
|
5750
|
+
collapsed,
|
|
5631
5751
|
groupKeys,
|
|
5632
5752
|
parents: Array.from(parents),
|
|
5633
5753
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
@@ -5637,11 +5757,19 @@ function enhancedFlatten(param) {
|
|
|
5637
5757
|
groupNesting,
|
|
5638
5758
|
groupCount: enhancedGroupData.groupCount
|
|
5639
5759
|
};
|
|
5640
|
-
parents.forEach((
|
|
5641
|
-
|
|
5760
|
+
parents.forEach((parent2, i) => {
|
|
5761
|
+
const last = i === parents.length - 1;
|
|
5762
|
+
if (last && item) {
|
|
5763
|
+
parent2.directChildrenLoadedCount += 1;
|
|
5764
|
+
}
|
|
5765
|
+
if (!parentCollapsed) {
|
|
5766
|
+
parent2.deepRowInfoArray.push(rowInfo);
|
|
5767
|
+
}
|
|
5642
5768
|
});
|
|
5643
|
-
|
|
5644
|
-
|
|
5769
|
+
if (!collapsed) {
|
|
5770
|
+
result[startIndex + index] = rowInfo;
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5645
5773
|
}
|
|
5646
5774
|
} else {
|
|
5647
5775
|
next();
|
|
@@ -5655,6 +5783,86 @@ function enhancedFlatten(param) {
|
|
|
5655
5783
|
};
|
|
5656
5784
|
}
|
|
5657
5785
|
|
|
5786
|
+
// src/components/DataSource/index.tsx
|
|
5787
|
+
var React26 = __toModule(require("react"));
|
|
5788
|
+
|
|
5789
|
+
// src/utils/multisort/sortTypes.ts
|
|
5790
|
+
var numberComparator = function(first, second) {
|
|
5791
|
+
return first - second;
|
|
5792
|
+
};
|
|
5793
|
+
var stringComparator = function(first, second) {
|
|
5794
|
+
first = `${first}`;
|
|
5795
|
+
second = `${second}`;
|
|
5796
|
+
return first.localeCompare(second);
|
|
5797
|
+
};
|
|
5798
|
+
var sortTypes = {
|
|
5799
|
+
number: numberComparator,
|
|
5800
|
+
string: stringComparator
|
|
5801
|
+
};
|
|
5802
|
+
var sortTypes_default = sortTypes;
|
|
5803
|
+
|
|
5804
|
+
// src/utils/multisort/index.ts
|
|
5805
|
+
var multisort = (sortInfo, array, get) => {
|
|
5806
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
5807
|
+
return array;
|
|
5808
|
+
};
|
|
5809
|
+
multisort.knownTypes = sortTypes_default;
|
|
5810
|
+
var getSingleSortFunction = (info) => {
|
|
5811
|
+
if (!info) {
|
|
5812
|
+
return;
|
|
5813
|
+
}
|
|
5814
|
+
const field = info.field;
|
|
5815
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5816
|
+
if (!dir) {
|
|
5817
|
+
return;
|
|
5818
|
+
}
|
|
5819
|
+
let fn = info.fn;
|
|
5820
|
+
if (!fn && info.type) {
|
|
5821
|
+
fn = multisort.knownTypes[info.type];
|
|
5822
|
+
if (!fn) {
|
|
5823
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
if (!fn) {
|
|
5827
|
+
fn = sortTypes_default.string;
|
|
5828
|
+
}
|
|
5829
|
+
return (first, second) => {
|
|
5830
|
+
const a = field ? first[field] : first;
|
|
5831
|
+
const b = field ? second[field] : second;
|
|
5832
|
+
return dir * fn(a, b);
|
|
5833
|
+
};
|
|
5834
|
+
};
|
|
5835
|
+
var getSortFunctions = (sortInfo) => {
|
|
5836
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
5837
|
+
};
|
|
5838
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
5839
|
+
const fns = getSortFunctions(sortInfo);
|
|
5840
|
+
return (first, second) => {
|
|
5841
|
+
if (get) {
|
|
5842
|
+
first = get(first);
|
|
5843
|
+
second = get(second);
|
|
5844
|
+
}
|
|
5845
|
+
let result = 0;
|
|
5846
|
+
let i = 0;
|
|
5847
|
+
let fn;
|
|
5848
|
+
const len = fns.length;
|
|
5849
|
+
for (; i < len; i++) {
|
|
5850
|
+
fn = fns[i];
|
|
5851
|
+
if (!fn) {
|
|
5852
|
+
continue;
|
|
5853
|
+
}
|
|
5854
|
+
result = fn(first, second);
|
|
5855
|
+
if (result !== 0) {
|
|
5856
|
+
return result;
|
|
5857
|
+
}
|
|
5858
|
+
}
|
|
5859
|
+
return result;
|
|
5860
|
+
};
|
|
5861
|
+
};
|
|
5862
|
+
|
|
5863
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5864
|
+
var import_react32 = __toModule(require("react"));
|
|
5865
|
+
|
|
5658
5866
|
// src/components/hooks/useEffectWithChanges.ts
|
|
5659
5867
|
var import_react31 = __toModule(require("react"));
|
|
5660
5868
|
function useEffectWithChanges(fn, deps) {
|
|
@@ -5683,7 +5891,15 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5683
5891
|
}, useEffectDeps);
|
|
5684
5892
|
}
|
|
5685
5893
|
|
|
5894
|
+
// src/components/DataSource/privateHooks/getChangeDetect.ts
|
|
5895
|
+
function getChangeDetect() {
|
|
5896
|
+
var _a;
|
|
5897
|
+
const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
|
|
5898
|
+
return `${Date.now()}:${perfNow}`;
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5686
5901
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5902
|
+
var CACHE_DEFAULT = true;
|
|
5687
5903
|
var getRafPromise = () => new Promise((resolve) => {
|
|
5688
5904
|
requestAnimationFrame(resolve);
|
|
5689
5905
|
});
|
|
@@ -5691,11 +5907,6 @@ var SKIP_DATA_CHANGES_KEYS = {
|
|
|
5691
5907
|
originalDataArray: true,
|
|
5692
5908
|
changes: true
|
|
5693
5909
|
};
|
|
5694
|
-
function getChangeDetect() {
|
|
5695
|
-
var _a;
|
|
5696
|
-
const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
|
|
5697
|
-
return `${Date.now()}:${perfNow}`;
|
|
5698
|
-
}
|
|
5699
5910
|
function buildDataSourceDataParams(componentState, overrides) {
|
|
5700
5911
|
var _a, _b;
|
|
5701
5912
|
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
@@ -5707,6 +5918,9 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
5707
5918
|
pivotBy: componentState.pivotBy,
|
|
5708
5919
|
aggregationReducers: componentState.aggregationReducers
|
|
5709
5920
|
};
|
|
5921
|
+
if (dataSourceParams.groupBy) {
|
|
5922
|
+
dataSourceParams.groupRowsState = componentState.groupRowsState.getState();
|
|
5923
|
+
}
|
|
5710
5924
|
if (componentState.livePagination !== void 0) {
|
|
5711
5925
|
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
5712
5926
|
dataSourceParams.__cursorId = componentState.cursorId;
|
|
@@ -5742,7 +5956,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5742
5956
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
5743
5957
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
5744
5958
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
5745
|
-
const items = existingGroupRowInfo.
|
|
5959
|
+
const items = existingGroupRowInfo.children;
|
|
5746
5960
|
const len = items.length;
|
|
5747
5961
|
let allLoaded = true;
|
|
5748
5962
|
for (let i = 0; i < len; i++) {
|
|
@@ -5755,6 +5969,21 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5755
5969
|
return Promise.resolve(true);
|
|
5756
5970
|
}
|
|
5757
5971
|
}
|
|
5972
|
+
if (existingGroupRowInfo) {
|
|
5973
|
+
if (!existingGroupRowInfo.childrenLoading) {
|
|
5974
|
+
existingGroupRowInfo.childrenLoading = true;
|
|
5975
|
+
}
|
|
5976
|
+
} else {
|
|
5977
|
+
lazyGroupData.set(key, {
|
|
5978
|
+
error: void 0,
|
|
5979
|
+
children: [],
|
|
5980
|
+
childrenLoading: true,
|
|
5981
|
+
childrenAvailable: false,
|
|
5982
|
+
cache: CACHE_DEFAULT,
|
|
5983
|
+
totalCount: 0
|
|
5984
|
+
});
|
|
5985
|
+
}
|
|
5986
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
5758
5987
|
}
|
|
5759
5988
|
if (typeof data === "function") {
|
|
5760
5989
|
data = data(dataParams);
|
|
@@ -5764,7 +5993,6 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5764
5993
|
actions.loading = true;
|
|
5765
5994
|
}
|
|
5766
5995
|
return Promise.resolve(data).then((dataParam) => {
|
|
5767
|
-
var _a, _b, _c, _d;
|
|
5768
5996
|
let dataArray = [];
|
|
5769
5997
|
let skipAssign = false;
|
|
5770
5998
|
if (Array.isArray(dataParam.data)) {
|
|
@@ -5777,57 +6005,93 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5777
6005
|
actions.pivotMappings = remoteData.mappings;
|
|
5778
6006
|
}
|
|
5779
6007
|
if (componentState.lazyLoad) {
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
items: [],
|
|
5791
|
-
totalCount: newGroupRowInfo.totalCount,
|
|
5792
|
-
cache: (_b = newGroupRowInfo.cache) != null ? _b : true
|
|
6008
|
+
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6009
|
+
var _a, _b, _c, _d;
|
|
6010
|
+
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6011
|
+
const dataArray2 = remoteData2.data;
|
|
6012
|
+
const newGroupRowInfo = {
|
|
6013
|
+
cache: !!remoteData2.cache,
|
|
6014
|
+
childrenLoading: false,
|
|
6015
|
+
childrenAvailable: true,
|
|
6016
|
+
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6017
|
+
children: dataArray2
|
|
5793
6018
|
};
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
6019
|
+
const childDatasets = [];
|
|
6020
|
+
if (dataParams.lazyLoadBatchSize && !parentKeys) {
|
|
6021
|
+
const existingGroupRowInfo = lazyGroupData.get(theKey);
|
|
6022
|
+
const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
|
|
6023
|
+
children: [],
|
|
6024
|
+
childrenAvailable: true,
|
|
6025
|
+
childrenLoading: false,
|
|
6026
|
+
totalCount: newGroupRowInfo.totalCount,
|
|
6027
|
+
cache: (_b = newGroupRowInfo.cache) != null ? _b : CACHE_DEFAULT
|
|
6028
|
+
};
|
|
6029
|
+
if (existingGroupRowInfo) {
|
|
6030
|
+
existingGroupRowInfo.cache = newGroupRowInfo.cache;
|
|
6031
|
+
existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
|
|
6032
|
+
existingGroupRowInfo.childrenLoading = false;
|
|
6033
|
+
existingGroupRowInfo.childrenAvailable = true;
|
|
6034
|
+
existingGroupRowInfo.error = newGroupRowInfo.error;
|
|
6035
|
+
}
|
|
6036
|
+
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6037
|
+
const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
|
|
6038
|
+
const end = Math.min((_d = remoteData2.totalCount) != null ? _d : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6039
|
+
for (let i = start; i < end; i++) {
|
|
6040
|
+
const it = newGroupRowInfo.children[i - start];
|
|
6041
|
+
if (!it) {
|
|
6042
|
+
throw `lazily loaded item not found at index ${i - start}`;
|
|
6043
|
+
}
|
|
6044
|
+
currentGroupRowInfo.children[i] = it;
|
|
6045
|
+
if (it.dataset) {
|
|
6046
|
+
childDatasets.push({
|
|
6047
|
+
keys: it.keys,
|
|
6048
|
+
dataset: it.dataset
|
|
6049
|
+
});
|
|
6050
|
+
}
|
|
5804
6051
|
}
|
|
5805
|
-
|
|
6052
|
+
if (!existingGroupRowInfo) {
|
|
6053
|
+
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
6054
|
+
}
|
|
6055
|
+
} else {
|
|
6056
|
+
if (parentKeys) {
|
|
6057
|
+
newGroupRowInfo.children.forEach((child) => {
|
|
6058
|
+
if (child.dataset) {
|
|
6059
|
+
childDatasets.push({
|
|
6060
|
+
keys: child.keys,
|
|
6061
|
+
dataset: child.dataset
|
|
6062
|
+
});
|
|
6063
|
+
}
|
|
6064
|
+
});
|
|
6065
|
+
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
6066
|
+
}
|
|
6067
|
+
lazyGroupData.set(theKey, newGroupRowInfo);
|
|
5806
6068
|
}
|
|
5807
|
-
|
|
5808
|
-
|
|
6069
|
+
let skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = false;
|
|
6070
|
+
if (!keys || !keys.length) {
|
|
6071
|
+
const topLevelLazyGroupData = lazyGroupData.get([
|
|
6072
|
+
LAZY_ROOT_KEY_FOR_GROUPS
|
|
6073
|
+
]);
|
|
6074
|
+
actions.originalDataArray = [...topLevelLazyGroupData.children];
|
|
6075
|
+
skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = true;
|
|
5809
6076
|
}
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
6077
|
+
if (!skipTriggerChangeAsAlreadyOriginalArrayWasUpdated) {
|
|
6078
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
6079
|
+
}
|
|
6080
|
+
if (childDatasets.length) {
|
|
6081
|
+
const parentKeys2 = keys;
|
|
6082
|
+
childDatasets.forEach(({ keys: keys2, dataset }) => {
|
|
6083
|
+
resolveRemoteData(keys2, dataset, parentKeys2);
|
|
6084
|
+
});
|
|
6085
|
+
}
|
|
6086
|
+
};
|
|
6087
|
+
const lazyGroupData = componentState.originalLazyGroupData;
|
|
5813
6088
|
skipAssign = true;
|
|
5814
|
-
|
|
5815
|
-
if (!dataParams.groupKeys || !dataParams.groupKeys.length) {
|
|
5816
|
-
const topLevelItems = lazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]);
|
|
5817
|
-
actions.originalDataArray = [...topLevelItems.items];
|
|
5818
|
-
skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = true;
|
|
5819
|
-
}
|
|
5820
|
-
if (!skipTriggerChangeAsAlreadyOriginalArrayWasUpdated) {
|
|
5821
|
-
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
5822
|
-
}
|
|
6089
|
+
resolveRemoteData(dataParams.groupKeys || [], remoteData);
|
|
5823
6090
|
}
|
|
5824
6091
|
} else {
|
|
5825
6092
|
dataArray = dataParam;
|
|
5826
6093
|
}
|
|
5827
6094
|
if (!skipAssign) {
|
|
5828
|
-
if (append) {
|
|
5829
|
-
console.log("appending", dataArray);
|
|
5830
|
-
}
|
|
5831
6095
|
actions.originalDataArray = append ? componentState.originalDataArray.concat(dataArray) : dataArray;
|
|
5832
6096
|
}
|
|
5833
6097
|
if (dataIsPromise && !componentState.lazyLoad) {
|
|
@@ -5944,8 +6208,8 @@ function useLazyLoadRange() {
|
|
|
5944
6208
|
componentActions: actions,
|
|
5945
6209
|
componentState
|
|
5946
6210
|
} = useComponentState();
|
|
5947
|
-
|
|
5948
|
-
|
|
6211
|
+
(0, import_react32.useEffect)(() => {
|
|
6212
|
+
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
5949
6213
|
}, [componentState.data, componentState.dataParams]);
|
|
5950
6214
|
const {
|
|
5951
6215
|
lazyLoadBatchSize,
|
|
@@ -5954,7 +6218,7 @@ function useLazyLoadRange() {
|
|
|
5954
6218
|
scrollStopDelayUpdatedByTable
|
|
5955
6219
|
} = componentState;
|
|
5956
6220
|
const latestRenderRangeRef = (0, import_react32.useRef)(null);
|
|
5957
|
-
const loadRange = (renderRange, cache =
|
|
6221
|
+
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
5958
6222
|
const componentState2 = getComponentState();
|
|
5959
6223
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
5960
6224
|
if (!renderRange) {
|
|
@@ -5977,11 +6241,11 @@ function useLazyLoadRange() {
|
|
|
5977
6241
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
5978
6242
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
5979
6243
|
latestRenderRangeRef.current = renderRange;
|
|
5980
|
-
loadRange(renderRange
|
|
6244
|
+
loadRange(renderRange);
|
|
5981
6245
|
});
|
|
5982
6246
|
}
|
|
5983
6247
|
return;
|
|
5984
|
-
}, [lazyLoadBatchSize
|
|
6248
|
+
}, [lazyLoadBatchSize]);
|
|
5985
6249
|
(0, import_react32.useEffect)(() => {
|
|
5986
6250
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
5987
6251
|
debouncedLoadRange();
|
|
@@ -5998,7 +6262,10 @@ function lazyLoadRange(options, cache) {
|
|
|
5998
6262
|
componentActions
|
|
5999
6263
|
} = options;
|
|
6000
6264
|
const { dataArray } = componentState;
|
|
6001
|
-
const isRowLoaded = (index) =>
|
|
6265
|
+
const isRowLoaded = (index) => {
|
|
6266
|
+
const rowInfo = dataArray[index];
|
|
6267
|
+
return rowInfo.data != null;
|
|
6268
|
+
};
|
|
6002
6269
|
const perGroupFnCalls = new DeepMap();
|
|
6003
6270
|
const rootGroupKeys = ["_______xxx______"];
|
|
6004
6271
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
@@ -6006,13 +6273,32 @@ function lazyLoadRange(options, cache) {
|
|
|
6006
6273
|
if (!rowInfo) {
|
|
6007
6274
|
continue;
|
|
6008
6275
|
}
|
|
6009
|
-
const rowLoaded =
|
|
6010
|
-
const theGroupKeys = rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
6011
|
-
if (rowInfo.
|
|
6276
|
+
const rowLoaded = isRowLoaded(i);
|
|
6277
|
+
const theGroupKeys = rowInfo.dataSourceHasGrouping && rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
6278
|
+
if (rowInfo.isGroupRow && rowInfo.dataSourceHasGrouping && rowInfo.groupKeys) {
|
|
6012
6279
|
theGroupKeys.pop();
|
|
6013
6280
|
}
|
|
6014
6281
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6015
6282
|
const indexInGroup = rowInfo.indexInGroup;
|
|
6283
|
+
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6284
|
+
const currentFnCall = {
|
|
6285
|
+
lazyLoadStartIndex: 0,
|
|
6286
|
+
lazyLoadBatchSize,
|
|
6287
|
+
groupKeys: rowInfo.groupKeys
|
|
6288
|
+
};
|
|
6289
|
+
const cacheKeys2 = rowInfo.groupKeys;
|
|
6290
|
+
let cachedFnCalls = perGroupFnCalls.get(cacheKeys2);
|
|
6291
|
+
if (!(cachedFnCalls == null ? void 0 : cachedFnCalls[rowInfo.id])) {
|
|
6292
|
+
const shouldSetFnCalls = !cachedFnCalls;
|
|
6293
|
+
cachedFnCalls = cachedFnCalls || {};
|
|
6294
|
+
if (!cachedFnCalls[rowInfo.id]) {
|
|
6295
|
+
cachedFnCalls[rowInfo.id] = currentFnCall;
|
|
6296
|
+
}
|
|
6297
|
+
if (shouldSetFnCalls) {
|
|
6298
|
+
perGroupFnCalls.set(cacheKeys2, cachedFnCalls);
|
|
6299
|
+
}
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6016
6302
|
if (!rowLoaded) {
|
|
6017
6303
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6018
6304
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
@@ -6044,7 +6330,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6044
6330
|
allFnCalls.push(...Object.values(record));
|
|
6045
6331
|
});
|
|
6046
6332
|
allFnCalls.reduce((promise, fnCall) => {
|
|
6047
|
-
const cacheKey =
|
|
6333
|
+
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
6048
6334
|
if (cache && cache.has(cacheKey)) {
|
|
6049
6335
|
return promise;
|
|
6050
6336
|
}
|
|
@@ -6054,22 +6340,65 @@ function lazyLoadRange(options, cache) {
|
|
|
6054
6340
|
}, initialPromise);
|
|
6055
6341
|
}
|
|
6056
6342
|
|
|
6057
|
-
// src/
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
6062
|
-
if (weakMap && weakMap.has(sortInfo)) {
|
|
6063
|
-
const prevResult = weakMap.get(sortInfo);
|
|
6064
|
-
if (prevResult && prevResult.length === result.length) {
|
|
6065
|
-
return prevResult;
|
|
6066
|
-
}
|
|
6343
|
+
// src/utils/shallowEqualObjects.ts
|
|
6344
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
6345
|
+
if (objA === objB) {
|
|
6346
|
+
return true;
|
|
6067
6347
|
}
|
|
6068
|
-
if (
|
|
6069
|
-
|
|
6348
|
+
if (!objA || !objB) {
|
|
6349
|
+
return false;
|
|
6070
6350
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6351
|
+
var aKeys = Object.keys(objA);
|
|
6352
|
+
var bKeys = Object.keys(objB);
|
|
6353
|
+
if (ignoreKeys) {
|
|
6354
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6355
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6356
|
+
}
|
|
6357
|
+
var len = aKeys.length;
|
|
6358
|
+
if (bKeys.length !== len) {
|
|
6359
|
+
return false;
|
|
6360
|
+
}
|
|
6361
|
+
for (var i = 0; i < len; i++) {
|
|
6362
|
+
var key = aKeys[i];
|
|
6363
|
+
if (ignoreKeys) {
|
|
6364
|
+
if (ignoreKeys.has(key)) {
|
|
6365
|
+
continue;
|
|
6366
|
+
}
|
|
6367
|
+
}
|
|
6368
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6369
|
+
return false;
|
|
6370
|
+
}
|
|
6371
|
+
}
|
|
6372
|
+
return true;
|
|
6373
|
+
}
|
|
6374
|
+
|
|
6375
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
6376
|
+
var map = new WeakMap();
|
|
6377
|
+
var getCompareDefault = (a) => a;
|
|
6378
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6379
|
+
map.set(fn, {
|
|
6380
|
+
lastCallTime: 0,
|
|
6381
|
+
lastCallArg: null
|
|
6382
|
+
});
|
|
6383
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6384
|
+
return (arg) => {
|
|
6385
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6386
|
+
lastCallTime: 0,
|
|
6387
|
+
lastCallArg: null
|
|
6388
|
+
};
|
|
6389
|
+
const now = Date.now();
|
|
6390
|
+
const diff = now - lastCallTime;
|
|
6391
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6392
|
+
if (diff < timeframe && objectsEqual) {
|
|
6393
|
+
return;
|
|
6394
|
+
}
|
|
6395
|
+
map.set(fn, {
|
|
6396
|
+
lastCallTime: now,
|
|
6397
|
+
lastCallArg: arg
|
|
6398
|
+
});
|
|
6399
|
+
fn(arg);
|
|
6400
|
+
};
|
|
6401
|
+
}
|
|
6073
6402
|
|
|
6074
6403
|
// src/components/DataSource/GroupRowsState.ts
|
|
6075
6404
|
var GroupRowsState = class {
|
|
@@ -6181,65 +6510,22 @@ var GroupRowsState = class {
|
|
|
6181
6510
|
}
|
|
6182
6511
|
};
|
|
6183
6512
|
|
|
6184
|
-
// src/
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
if (
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
var bKeys = Object.keys(objB);
|
|
6194
|
-
if (ignoreKeys) {
|
|
6195
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6196
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6197
|
-
}
|
|
6198
|
-
var len = aKeys.length;
|
|
6199
|
-
if (bKeys.length !== len) {
|
|
6200
|
-
return false;
|
|
6201
|
-
}
|
|
6202
|
-
for (var i = 0; i < len; i++) {
|
|
6203
|
-
var key = aKeys[i];
|
|
6204
|
-
if (ignoreKeys) {
|
|
6205
|
-
if (ignoreKeys.has(key)) {
|
|
6206
|
-
continue;
|
|
6207
|
-
}
|
|
6208
|
-
}
|
|
6209
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6210
|
-
return false;
|
|
6513
|
+
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6514
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
6515
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
6516
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
6517
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
6518
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
6519
|
+
const prevResult = weakMap.get(sortInfo);
|
|
6520
|
+
if (prevResult && prevResult.length === result.length) {
|
|
6521
|
+
return prevResult;
|
|
6211
6522
|
}
|
|
6212
6523
|
}
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
var getCompareDefault = (a) => a;
|
|
6219
|
-
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6220
|
-
map.set(fn, {
|
|
6221
|
-
lastCallTime: 0,
|
|
6222
|
-
lastCallArg: null
|
|
6223
|
-
});
|
|
6224
|
-
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6225
|
-
return (arg) => {
|
|
6226
|
-
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6227
|
-
lastCallTime: 0,
|
|
6228
|
-
lastCallArg: null
|
|
6229
|
-
};
|
|
6230
|
-
const now = Date.now();
|
|
6231
|
-
const diff = now - lastCallTime;
|
|
6232
|
-
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6233
|
-
if (diff < timeframe && objectsEqual) {
|
|
6234
|
-
return;
|
|
6235
|
-
}
|
|
6236
|
-
map.set(fn, {
|
|
6237
|
-
lastCallTime: now,
|
|
6238
|
-
lastCallArg: arg
|
|
6239
|
-
});
|
|
6240
|
-
fn(arg);
|
|
6241
|
-
};
|
|
6242
|
-
}
|
|
6524
|
+
if (weakMap && sortInfo) {
|
|
6525
|
+
weakMap.set(sortInfo, result);
|
|
6526
|
+
}
|
|
6527
|
+
return result;
|
|
6528
|
+
};
|
|
6243
6529
|
|
|
6244
6530
|
// src/components/DataSource/state/getInitialState.ts
|
|
6245
6531
|
var defaultCursorId = Symbol("cursorId");
|
|
@@ -6249,6 +6535,7 @@ function initSetupState() {
|
|
|
6249
6535
|
const dataArray = [];
|
|
6250
6536
|
const originalLazyGroupData = new DeepMap();
|
|
6251
6537
|
return {
|
|
6538
|
+
lazyLoadCacheOfLoadedBatches: new DeepMap(),
|
|
6252
6539
|
dataParams: void 0,
|
|
6253
6540
|
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
6254
6541
|
notifyScrollStop: buildSubscriptionCallback(),
|
|
@@ -6299,6 +6586,9 @@ var forwardProps2 = (setupState) => {
|
|
|
6299
6586
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
6300
6587
|
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
6301
6588
|
groupRowsState: (groupRowsState) => {
|
|
6589
|
+
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
6590
|
+
groupRowsState = new GroupRowsState(groupRowsState);
|
|
6591
|
+
}
|
|
6302
6592
|
return groupRowsState || new GroupRowsState({
|
|
6303
6593
|
expandedRows: true,
|
|
6304
6594
|
collapsedRows: []
|
|
@@ -6466,7 +6756,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6466
6756
|
pivotIndex: -1,
|
|
6467
6757
|
valueGetter: ({ rowInfo }) => {
|
|
6468
6758
|
var _a;
|
|
6469
|
-
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
6759
|
+
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6470
6760
|
}
|
|
6471
6761
|
}));
|
|
6472
6762
|
});
|
|
@@ -6515,6 +6805,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6515
6805
|
header,
|
|
6516
6806
|
valueGetter: ({ rowInfo }) => {
|
|
6517
6807
|
var _a, _b;
|
|
6808
|
+
if (!rowInfo.isGroupRow) {
|
|
6809
|
+
return null;
|
|
6810
|
+
}
|
|
6518
6811
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
6519
6812
|
}
|
|
6520
6813
|
});
|
|
@@ -6537,7 +6830,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6537
6830
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
6538
6831
|
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
6539
6832
|
if (!isSingleAggregationColumn) {
|
|
6540
|
-
|
|
6833
|
+
const parentGroupForTotalsGroup = columnGroupId;
|
|
6541
6834
|
columnGroupId = `total:${keys.join("/")}`;
|
|
6542
6835
|
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
6543
6836
|
header: `${keys[keys.length - 1]} total`,
|
|
@@ -6567,6 +6860,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6567
6860
|
sortable: false,
|
|
6568
6861
|
valueGetter: ({ rowInfo }) => {
|
|
6569
6862
|
var _a, _b;
|
|
6863
|
+
if (!rowInfo.isGroupRow) {
|
|
6864
|
+
return null;
|
|
6865
|
+
}
|
|
6570
6866
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
6571
6867
|
}
|
|
6572
6868
|
});
|
|
@@ -6602,12 +6898,13 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
6602
6898
|
};
|
|
6603
6899
|
function toRowInfo(data, id, index) {
|
|
6604
6900
|
return {
|
|
6901
|
+
dataSourceHasGrouping: false,
|
|
6605
6902
|
data,
|
|
6606
|
-
collapsed: true,
|
|
6607
6903
|
id,
|
|
6608
6904
|
indexInAll: index,
|
|
6609
6905
|
indexInGroup: index,
|
|
6610
|
-
isGroupRow: false
|
|
6906
|
+
isGroupRow: false,
|
|
6907
|
+
selfLoaded: true
|
|
6611
6908
|
};
|
|
6612
6909
|
}
|
|
6613
6910
|
function concludeReducer(params) {
|
|
@@ -6635,7 +6932,7 @@ function concludeReducer(params) {
|
|
|
6635
6932
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
6636
6933
|
const groupBy = state.groupBy;
|
|
6637
6934
|
const pivotBy = state.pivotBy;
|
|
6638
|
-
const shouldGroup = groupBy.length || pivotBy;
|
|
6935
|
+
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
6639
6936
|
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
6640
6937
|
"generateGroupRows",
|
|
6641
6938
|
"originalDataArray",
|
|
@@ -6660,12 +6957,8 @@ function concludeReducer(params) {
|
|
|
6660
6957
|
state.sortedAt = now;
|
|
6661
6958
|
}
|
|
6662
6959
|
state.postSortDataArray = dataArray;
|
|
6663
|
-
state.groupDeepMap = void 0;
|
|
6664
6960
|
const toPrimaryKey = (data) => {
|
|
6665
6961
|
const pk = data[state.primaryKey];
|
|
6666
|
-
if (Array.isArray(pk)) {
|
|
6667
|
-
debugger;
|
|
6668
|
-
}
|
|
6669
6962
|
return pk;
|
|
6670
6963
|
};
|
|
6671
6964
|
if (shouldGroup) {
|
|
@@ -6682,6 +6975,7 @@ function concludeReducer(params) {
|
|
|
6682
6975
|
}, dataArray);
|
|
6683
6976
|
const flattenResult = enhancedFlatten({
|
|
6684
6977
|
groupResult,
|
|
6978
|
+
lazyLoad: !!state.lazyLoad,
|
|
6685
6979
|
reducers: state.aggregationReducers,
|
|
6686
6980
|
toPrimaryKey,
|
|
6687
6981
|
groupRowsState: state.groupRowsState,
|
|
@@ -6737,7 +7031,7 @@ function DataSourceWithContext(props) {
|
|
|
6737
7031
|
if (typeof children === "function") {
|
|
6738
7032
|
children = children(computedValues);
|
|
6739
7033
|
}
|
|
6740
|
-
return /* @__PURE__ */
|
|
7034
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, children);
|
|
6741
7035
|
}
|
|
6742
7036
|
var DataSourceRoot = getComponentStateRoot({
|
|
6743
7037
|
initSetupState,
|
|
@@ -6760,14 +7054,14 @@ function DataSourceCmp({ children }) {
|
|
|
6760
7054
|
globalThis.getDataSourceState = getState;
|
|
6761
7055
|
}
|
|
6762
7056
|
useLoadData();
|
|
6763
|
-
return /* @__PURE__ */
|
|
7057
|
+
return /* @__PURE__ */ React26.createElement(DataSourceContext.Provider, {
|
|
6764
7058
|
value: contextValue
|
|
6765
|
-
}, /* @__PURE__ */
|
|
7059
|
+
}, /* @__PURE__ */ React26.createElement(DataSourceWithContext, {
|
|
6766
7060
|
children
|
|
6767
7061
|
}));
|
|
6768
7062
|
}
|
|
6769
7063
|
function DataSource(props) {
|
|
6770
|
-
return /* @__PURE__ */
|
|
7064
|
+
return /* @__PURE__ */ React26.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React26.createElement(DataSourceCmp, {
|
|
6771
7065
|
children: props.children
|
|
6772
7066
|
}));
|
|
6773
7067
|
}
|
|
@@ -6780,10 +7074,26 @@ function useToggleGroupRow() {
|
|
|
6780
7074
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
6781
7075
|
newState.toggleGroupRow(groupKeys);
|
|
6782
7076
|
dataSourceActions.groupRowsState = newState;
|
|
6783
|
-
if (state.lazyLoad
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
7077
|
+
if (state.lazyLoad) {
|
|
7078
|
+
const dataKeys = [LAZY_ROOT_KEY_FOR_GROUPS, ...groupKeys];
|
|
7079
|
+
const currentData = state.originalLazyGroupData.get(dataKeys);
|
|
7080
|
+
if (newState.isGroupRowExpanded(groupKeys)) {
|
|
7081
|
+
if (!(currentData == null ? void 0 : currentData.cache)) {
|
|
7082
|
+
loadData(state.data, state, dataSourceActions, {
|
|
7083
|
+
groupKeys
|
|
7084
|
+
});
|
|
7085
|
+
}
|
|
7086
|
+
} else {
|
|
7087
|
+
if (!(currentData == null ? void 0 : currentData.cache)) {
|
|
7088
|
+
const keysToDelete = state.lazyLoadCacheOfLoadedBatches.getKeysStartingWith(groupKeys);
|
|
7089
|
+
keysToDelete.forEach((keys) => {
|
|
7090
|
+
state.lazyLoadCacheOfLoadedBatches.delete(keys);
|
|
7091
|
+
});
|
|
7092
|
+
dataSourceActions.lazyLoadCacheOfLoadedBatches = DeepMap.clone(state.lazyLoadCacheOfLoadedBatches);
|
|
7093
|
+
state.originalLazyGroupData.delete(dataKeys);
|
|
7094
|
+
dataSourceActions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
6787
7097
|
}
|
|
6788
7098
|
}, []);
|
|
6789
7099
|
return toggleGroupRow;
|
|
@@ -6853,12 +7163,18 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
6853
7163
|
field,
|
|
6854
7164
|
valueGetter: ({ rowInfo }) => {
|
|
6855
7165
|
var _a;
|
|
6856
|
-
return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
|
|
7166
|
+
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
6857
7167
|
},
|
|
6858
7168
|
rowspan: ({ rowInfo, dataArray }) => {
|
|
7169
|
+
if (!rowInfo.isGroupRow) {
|
|
7170
|
+
return 1;
|
|
7171
|
+
}
|
|
6859
7172
|
const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
|
|
6860
7173
|
indexInParentGroups: []
|
|
6861
7174
|
};
|
|
7175
|
+
if (!prevRowInfo || !prevRowInfo.dataSourceHasGrouping) {
|
|
7176
|
+
return 1;
|
|
7177
|
+
}
|
|
6862
7178
|
const prevIndexes = prevRowInfo.indexInParentGroups || [];
|
|
6863
7179
|
const currentIndexes = rowInfo.indexInParentGroups || [];
|
|
6864
7180
|
let computeSpan = false;
|
|
@@ -7011,8 +7327,11 @@ function useHideColumns(groupByMap) {
|
|
|
7011
7327
|
let expandedGroupsLevel = 0;
|
|
7012
7328
|
const len = dataArray.length;
|
|
7013
7329
|
for (let i = 0; i < len; i++) {
|
|
7014
|
-
const
|
|
7015
|
-
|
|
7330
|
+
const rowInfo = dataArray[i];
|
|
7331
|
+
if (!rowInfo.isGroupRow) {
|
|
7332
|
+
continue;
|
|
7333
|
+
}
|
|
7334
|
+
expandedGroupsLevel = Math.max(expandedGroupsLevel, rowInfo.groupNesting - 1);
|
|
7016
7335
|
if (expandedGroupsLevel === groupsLength - 1) {
|
|
7017
7336
|
break;
|
|
7018
7337
|
}
|
|
@@ -8121,7 +8440,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
8121
8440
|
const valid = (0, import_react39.useMemo)(() => {
|
|
8122
8441
|
let valid2 = isValidLicense(licenseKey, {
|
|
8123
8442
|
publishedAt: 1624970570587,
|
|
8124
|
-
version: "0.3.0
|
|
8443
|
+
version: "0.3.0"
|
|
8125
8444
|
});
|
|
8126
8445
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8127
8446
|
return true;
|
|
@@ -8346,7 +8665,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
8346
8665
|
getParentState: () => useDataSource(),
|
|
8347
8666
|
debugName: "InfiniteTable"
|
|
8348
8667
|
});
|
|
8349
|
-
var InfiniteTableComponent =
|
|
8668
|
+
var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
|
|
8350
8669
|
var _a;
|
|
8351
8670
|
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
8352
8671
|
const {
|
|
@@ -8379,7 +8698,7 @@ var InfiniteTableComponent = React26.memo(function InfiniteTableComponent2() {
|
|
|
8379
8698
|
bodySize,
|
|
8380
8699
|
computed
|
|
8381
8700
|
});
|
|
8382
|
-
|
|
8701
|
+
React27.useEffect(() => {
|
|
8383
8702
|
const dataSourceState = getDataSourceState();
|
|
8384
8703
|
const onChange = debounce((renderRange) => {
|
|
8385
8704
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -8392,32 +8711,32 @@ var InfiniteTableComponent = React26.memo(function InfiniteTableComponent2() {
|
|
|
8392
8711
|
const licenseValid = useLicense(licenseKey);
|
|
8393
8712
|
const domProps = useDOMProps(componentState.domProps);
|
|
8394
8713
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
8395
|
-
|
|
8714
|
+
React27.useEffect(() => {
|
|
8396
8715
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
8397
8716
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8398
8717
|
}, [scrollStopDelay]);
|
|
8399
8718
|
useAutoSizeColumns();
|
|
8400
|
-
return /* @__PURE__ */
|
|
8719
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadValues({
|
|
8401
8720
|
ref: domRef
|
|
8402
|
-
}, domProps), header ? /* @__PURE__ */
|
|
8721
|
+
}, domProps), header ? /* @__PURE__ */ React27.createElement(TableHeaderWrapper, {
|
|
8403
8722
|
brain: headerBrain,
|
|
8404
8723
|
scrollbars
|
|
8405
|
-
}) : null, /* @__PURE__ */
|
|
8724
|
+
}) : null, /* @__PURE__ */ React27.createElement(InfiniteTableBody, null, /* @__PURE__ */ React27.createElement(HeadlessTable, {
|
|
8406
8725
|
tabIndex: 0,
|
|
8407
8726
|
scrollStopDelay,
|
|
8408
8727
|
brain,
|
|
8409
8728
|
renderCell,
|
|
8410
8729
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8411
8730
|
scrollerDOMRef
|
|
8412
|
-
}), /* @__PURE__ */
|
|
8731
|
+
}), /* @__PURE__ */ React27.createElement(LoadMaskCmp, {
|
|
8413
8732
|
visible: loading
|
|
8414
|
-
}, loadingText)), licenseValid ? null : /* @__PURE__ */
|
|
8733
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ React27.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React27.createElement("div", {
|
|
8415
8734
|
ref: portalDOMRef,
|
|
8416
8735
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8417
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
8736
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
|
|
8418
8737
|
varName: rowHeightCSSVar,
|
|
8419
8738
|
onChange: onRowHeightCSSVarChange
|
|
8420
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
8739
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
|
|
8421
8740
|
varName: headerHeightCSSVar,
|
|
8422
8741
|
onChange: onHeaderHeightCSSVarChange
|
|
8423
8742
|
}) : null);
|
|
@@ -8448,25 +8767,25 @@ function InfiniteTableContextProvider() {
|
|
|
8448
8767
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
8449
8768
|
componentActions.bodySize = bodySize;
|
|
8450
8769
|
}, { earlyAttach: true });
|
|
8451
|
-
|
|
8770
|
+
React27.useEffect(() => {
|
|
8452
8771
|
return () => {
|
|
8453
8772
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
8454
8773
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
8455
8774
|
};
|
|
8456
8775
|
}, []);
|
|
8457
|
-
|
|
8776
|
+
React27.useEffect(() => {
|
|
8458
8777
|
if (scrollerDOMRef.current) {
|
|
8459
8778
|
scrollerDOMRef.current.scrollTop = 0;
|
|
8460
8779
|
}
|
|
8461
8780
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8462
8781
|
const TableContext2 = getInfiniteTableContext();
|
|
8463
|
-
return /* @__PURE__ */
|
|
8782
|
+
return /* @__PURE__ */ React27.createElement(TableContext2.Provider, {
|
|
8464
8783
|
value: contextValue
|
|
8465
|
-
}, /* @__PURE__ */
|
|
8784
|
+
}, /* @__PURE__ */ React27.createElement(InfiniteTableComponent, null));
|
|
8466
8785
|
}
|
|
8467
8786
|
function InfiniteTable(props) {
|
|
8468
|
-
const table = /* @__PURE__ */
|
|
8469
|
-
return /* @__PURE__ */
|
|
8787
|
+
const table = /* @__PURE__ */ React27.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React27.createElement(InfiniteTableContextProvider, null));
|
|
8788
|
+
return /* @__PURE__ */ React27.createElement(React27.StrictMode, null, table);
|
|
8470
8789
|
}
|
|
8471
8790
|
InfiniteTable.defaultProps = {
|
|
8472
8791
|
rowHeight: 40,
|