@infinite-table/infinite-react 0.3.0-canary.0 → 0.3.2
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 +416 -275
- package/index.esm.css +47 -41
- package/index.esm.js +763 -423
- package/index.js +769 -431
- 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,7 +2785,29 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2719
2785
|
}
|
|
2720
2786
|
});
|
|
2721
2787
|
};
|
|
2722
|
-
this.
|
|
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
|
+
};
|
|
2810
|
+
this.updateElementPosition = (elementIndex, options) => {
|
|
2723
2811
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2724
2812
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
2725
2813
|
if (cell == null) {
|
|
@@ -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;
|
|
@@ -2754,7 +2832,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2754
2832
|
itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
|
2755
2833
|
itemElement.style.willChange = "transform";
|
|
2756
2834
|
itemElement.style.backfaceVisibility = "hidden";
|
|
2757
|
-
|
|
2835
|
+
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
2836
|
+
itemElement.style.zIndex = hidden ? "-1" : "auto";
|
|
2758
2837
|
} else {
|
|
2759
2838
|
itemElement.style.display = "";
|
|
2760
2839
|
itemElement.style.left = `${x}px`;
|
|
@@ -2894,6 +2973,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2894
2973
|
this.destroyed = true;
|
|
2895
2974
|
this.reset();
|
|
2896
2975
|
this.onDestroy();
|
|
2976
|
+
this.hoverRowUpdatesInProgress.clear();
|
|
2977
|
+
this.hoverRowUpdatesInProgress = null;
|
|
2897
2978
|
this.brain = null;
|
|
2898
2979
|
this.mappedCells = null;
|
|
2899
2980
|
};
|
|
@@ -2902,7 +2983,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2902
2983
|
const removeOnScroll = brain.onScroll(this.adjustFixedElementsOnScroll);
|
|
2903
2984
|
const removeOnSizeChange = brain.onAvailableSizeChange(() => {
|
|
2904
2985
|
this.adjustFixedElementsOnScroll();
|
|
2905
|
-
|
|
2986
|
+
raf(() => {
|
|
2906
2987
|
this.adjustFixedElementsOnScroll();
|
|
2907
2988
|
});
|
|
2908
2989
|
});
|
|
@@ -2947,6 +3028,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2947
3028
|
const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
|
|
2948
3029
|
const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
|
|
2949
3030
|
const { row: rowFixed, col: colFixed } = this.isCellFixed(rowIndex, colIndex);
|
|
3031
|
+
const hidden = !!covered;
|
|
2950
3032
|
const renderedNode = renderCell({
|
|
2951
3033
|
rowIndex,
|
|
2952
3034
|
colIndex,
|
|
@@ -2956,7 +3038,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2956
3038
|
colspan,
|
|
2957
3039
|
rowFixed,
|
|
2958
3040
|
colFixed,
|
|
2959
|
-
hidden
|
|
3041
|
+
hidden,
|
|
2960
3042
|
heightWithRowspan,
|
|
2961
3043
|
widthWithColspan,
|
|
2962
3044
|
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
@@ -2973,7 +3055,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2973
3055
|
this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
|
|
2974
3056
|
}
|
|
2975
3057
|
itemUpdater(renderedNode);
|
|
2976
|
-
this.updateElementPosition(elementIndex);
|
|
3058
|
+
this.updateElementPosition(elementIndex, { hidden, rowspan, colspan });
|
|
2977
3059
|
return;
|
|
2978
3060
|
}
|
|
2979
3061
|
reset() {
|
|
@@ -3438,19 +3520,19 @@ var useInternalProps = () => {
|
|
|
3438
3520
|
};
|
|
3439
3521
|
|
|
3440
3522
|
// 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: "
|
|
3523
|
+
var alignItems = { center: "_16lm1iw13", stretch: "_16lm1iw14" };
|
|
3524
|
+
var cssEllipsisClassName = "_16lm1iw1c _16lm1iw1d _16lm1iw18";
|
|
3525
|
+
var cursor = { pointer: "_16lm1iwd" };
|
|
3526
|
+
var display = { flex: "_16lm1iwl", block: "_16lm1iwm", inlineBlock: "_16lm1iwn" };
|
|
3527
|
+
var flex = { "1": "_16lm1iwe", none: "_16lm1iwf" };
|
|
3528
|
+
var justifyContent = { center: "_16lm1iw15", start: "_16lm1iw16", end: "_16lm1iw17" };
|
|
3529
|
+
var left = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3530
|
+
var overflow = { hidden: "_16lm1iw18", auto: "_16lm1iw19", visible: "_16lm1iw1a" };
|
|
3449
3531
|
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": "
|
|
3532
|
+
var top = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
3533
|
+
var transformTranslateZero = "_16lm1iwa";
|
|
3534
|
+
var userSelect = { none: "_16lm1iwo" };
|
|
3535
|
+
var zIndex = { "1": "_16lm1iwg", "10": "_16lm1iwh", "1000": "_16lm1iwi", "10000": "_16lm1iwj", "100000": "_16lm1iwk" };
|
|
3454
3536
|
|
|
3455
3537
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3456
3538
|
var InfiniteTableBody = React12.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
@@ -3493,7 +3575,7 @@ var useInfiniteTableState = () => {
|
|
|
3493
3575
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3494
3576
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3495
3577
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3496
|
-
var ColumnCellCls = "_1eexc2a5
|
|
3578
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3497
3579
|
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
3580
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3499
3581
|
|
|
@@ -3835,18 +3917,19 @@ function SortIcon(props) {
|
|
|
3835
3917
|
|
|
3836
3918
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3837
3919
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3838
|
-
var CellCls = "_1eexc2a5
|
|
3920
|
+
var CellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3839
3921
|
var HeaderCellProxy = "_12zfob10";
|
|
3840
3922
|
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
|
|
3923
|
+
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"]] });
|
|
3924
|
+
var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3843
3925
|
var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
|
|
3844
3926
|
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3845
|
-
var HeaderWrapperCls = "_12zfob1z
|
|
3927
|
+
var HeaderWrapperCls = "_12zfob1z _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
|
|
3846
3928
|
|
|
3847
3929
|
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
3848
3930
|
function RenderHookComponent(props) {
|
|
3849
|
-
|
|
3931
|
+
var _a;
|
|
3932
|
+
return (_a = props.render(props.renderParam)) != null ? _a : null;
|
|
3850
3933
|
}
|
|
3851
3934
|
|
|
3852
3935
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
@@ -3952,11 +4035,6 @@ function useInfiniteHeaderCell() {
|
|
|
3952
4035
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3953
4036
|
var React18 = __toModule(require("react"));
|
|
3954
4037
|
|
|
3955
|
-
// src/utils/getGlobal.ts
|
|
3956
|
-
function getGlobal() {
|
|
3957
|
-
return globalThis;
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
4038
|
// src/components/utils/getScrollbarWidth.ts
|
|
3961
4039
|
var scrollbarWidth;
|
|
3962
4040
|
function getScrollbarWidth() {
|
|
@@ -4298,9 +4376,9 @@ var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(-
|
|
|
4298
4376
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4299
4377
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4300
4378
|
var FooterCls = "_16lm1iw1";
|
|
4301
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4379
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwl _16lm1iw11 _16lm1iw0";
|
|
4302
4380
|
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 = "
|
|
4381
|
+
var InfiniteClsShiftingColumns = "_16lm1iwo";
|
|
4304
4382
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4305
4383
|
|
|
4306
4384
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
@@ -4384,6 +4462,8 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4384
4462
|
var _a;
|
|
4385
4463
|
const {
|
|
4386
4464
|
rowInfo,
|
|
4465
|
+
rowStyle,
|
|
4466
|
+
rowClassName,
|
|
4387
4467
|
width,
|
|
4388
4468
|
column,
|
|
4389
4469
|
onMouseLeave,
|
|
@@ -4402,40 +4482,51 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4402
4482
|
ref: domRef
|
|
4403
4483
|
}, "no column");
|
|
4404
4484
|
}
|
|
4405
|
-
const { data, isGroupRow,
|
|
4485
|
+
const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
|
|
4486
|
+
const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
|
|
4406
4487
|
const groupRowInfo = null;
|
|
4407
4488
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4408
4489
|
if (column.valueGetter) {
|
|
4409
4490
|
value = column.valueGetter(isGroupRow ? {
|
|
4410
4491
|
data: rowInfo.data,
|
|
4492
|
+
isGroupRow,
|
|
4411
4493
|
rowInfo
|
|
4412
4494
|
} : {
|
|
4413
4495
|
data: rowInfo.data,
|
|
4496
|
+
isGroupRow,
|
|
4414
4497
|
rowInfo
|
|
4415
4498
|
});
|
|
4416
4499
|
}
|
|
4417
4500
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4418
4501
|
const rest = rowInfo.isGroupRow ? {
|
|
4419
4502
|
rowInfo,
|
|
4503
|
+
isGroupRow: rowInfo.isGroupRow,
|
|
4420
4504
|
data: rowInfo.data
|
|
4421
4505
|
} : {
|
|
4422
4506
|
rowInfo,
|
|
4507
|
+
isGroupRow: rowInfo.isGroupRow,
|
|
4423
4508
|
data: rowInfo.data
|
|
4424
4509
|
};
|
|
4425
4510
|
const stylingRenderParam = __spreadValues({
|
|
4426
4511
|
value,
|
|
4427
4512
|
column
|
|
4428
4513
|
}, rest);
|
|
4429
|
-
|
|
4514
|
+
const renderValue = value;
|
|
4430
4515
|
const renderParam = __spreadProps(__spreadValues({
|
|
4431
4516
|
value,
|
|
4432
4517
|
column,
|
|
4433
4518
|
domRef,
|
|
4434
4519
|
groupRowInfo
|
|
4435
4520
|
}, rest), {
|
|
4521
|
+
isGroupRow,
|
|
4436
4522
|
rowIndex,
|
|
4437
4523
|
toggleGroupRow,
|
|
4438
|
-
toggleCurrentGroupRow: () =>
|
|
4524
|
+
toggleCurrentGroupRow: () => {
|
|
4525
|
+
if (!rowInfo.isGroupRow) {
|
|
4526
|
+
return;
|
|
4527
|
+
}
|
|
4528
|
+
toggleGroupRow(rowInfo.groupKeys);
|
|
4529
|
+
},
|
|
4439
4530
|
groupBy: computedDataSource.groupBy,
|
|
4440
4531
|
pivotBy: computedDataSource.pivotBy
|
|
4441
4532
|
});
|
|
@@ -4452,8 +4543,16 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4452
4543
|
}
|
|
4453
4544
|
return renderValue;
|
|
4454
4545
|
};
|
|
4546
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
4547
|
+
rowIndex
|
|
4548
|
+
});
|
|
4549
|
+
const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
|
|
4455
4550
|
const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
|
|
4456
|
-
|
|
4551
|
+
let style;
|
|
4552
|
+
if (rowStyle) {
|
|
4553
|
+
style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
|
|
4554
|
+
}
|
|
4555
|
+
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
4457
4556
|
style.width = width;
|
|
4458
4557
|
style.height = rowHeight;
|
|
4459
4558
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
@@ -4469,7 +4568,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4469
4568
|
onMouseLeave,
|
|
4470
4569
|
onMouseEnter,
|
|
4471
4570
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4472
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName),
|
|
4571
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
|
|
4473
4572
|
renderChildren
|
|
4474
4573
|
};
|
|
4475
4574
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
@@ -4493,8 +4592,8 @@ var RowHoverCls = "_7pupv01";
|
|
|
4493
4592
|
var React21 = __toModule(require("react"));
|
|
4494
4593
|
|
|
4495
4594
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4496
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4497
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
4595
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx" };
|
|
4596
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx";
|
|
4498
4597
|
var LoadMaskTextCls = "qy58ya4";
|
|
4499
4598
|
|
|
4500
4599
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -4523,7 +4622,6 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4523
4622
|
const measuredMaxWidths = {};
|
|
4524
4623
|
const computedPaddingsForColumns = {};
|
|
4525
4624
|
if (match && match.length) {
|
|
4526
|
-
console.log(match);
|
|
4527
4625
|
match.forEach((content) => {
|
|
4528
4626
|
const cell = content.parentElement;
|
|
4529
4627
|
const isHeader = cell.matches(`.${InfiniteTableHeaderCellClassName}`);
|
|
@@ -4700,6 +4798,8 @@ function useCellRendering(param) {
|
|
|
4700
4798
|
groupRenderStrategy,
|
|
4701
4799
|
brain,
|
|
4702
4800
|
showZebraRows,
|
|
4801
|
+
rowStyle,
|
|
4802
|
+
rowClassName,
|
|
4703
4803
|
onScrollToTop,
|
|
4704
4804
|
onScrollToBottom,
|
|
4705
4805
|
scrollToBottomOffset
|
|
@@ -4794,7 +4894,9 @@ function useCellRendering(param) {
|
|
|
4794
4894
|
onMouseLeave,
|
|
4795
4895
|
domRef,
|
|
4796
4896
|
width,
|
|
4797
|
-
column
|
|
4897
|
+
column,
|
|
4898
|
+
rowStyle,
|
|
4899
|
+
rowClassName
|
|
4798
4900
|
};
|
|
4799
4901
|
return /* @__PURE__ */ import_react24.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
4800
4902
|
}, [
|
|
@@ -4804,7 +4906,9 @@ function useCellRendering(param) {
|
|
|
4804
4906
|
groupRenderStrategy,
|
|
4805
4907
|
toggleGroupRow,
|
|
4806
4908
|
showZebraRows,
|
|
4807
|
-
repaintId
|
|
4909
|
+
repaintId,
|
|
4910
|
+
rowStyle,
|
|
4911
|
+
rowClassName
|
|
4808
4912
|
]);
|
|
4809
4913
|
return {
|
|
4810
4914
|
renderCell
|
|
@@ -4960,6 +5064,9 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
4960
5064
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
4961
5065
|
const dataArray = getDataSourceState().dataArray;
|
|
4962
5066
|
const rowInfo = dataArray[rowIndex];
|
|
5067
|
+
if (!rowInfo) {
|
|
5068
|
+
return 1;
|
|
5069
|
+
}
|
|
4963
5070
|
const data = rowInfo.data;
|
|
4964
5071
|
const column = computedVisibleColumns[colIndex];
|
|
4965
5072
|
if (!column || !column.rowspan) {
|
|
@@ -4995,7 +5102,20 @@ function useColumnSizeFn(columns) {
|
|
|
4995
5102
|
var import_react34 = __toModule(require("react"));
|
|
4996
5103
|
|
|
4997
5104
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
4998
|
-
var
|
|
5105
|
+
var React25 = __toModule(require("react"));
|
|
5106
|
+
|
|
5107
|
+
// src/utils/stripVar.ts
|
|
5108
|
+
function stripVar(cssVariableWithVarString) {
|
|
5109
|
+
return cssVariableWithVarString.slice(4, -1);
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
// src/components/DataSource/state/rowInfoStatus.ts
|
|
5113
|
+
var showLoadingIcon = (rowInfo) => {
|
|
5114
|
+
if (rowInfo.dataSourceHasGrouping) {
|
|
5115
|
+
return rowInfo.isGroupRow ? rowInfo.childrenLoading || !rowInfo.selfLoaded : !rowInfo.selfLoaded;
|
|
5116
|
+
}
|
|
5117
|
+
return !rowInfo.selfLoaded;
|
|
5118
|
+
};
|
|
4999
5119
|
|
|
5000
5120
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5001
5121
|
var React23 = __toModule(require("react"));
|
|
@@ -5003,8 +5123,8 @@ var import_react29 = __toModule(require("react"));
|
|
|
5003
5123
|
|
|
5004
5124
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5005
5125
|
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: "
|
|
5126
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwf _16lm1iwd";
|
|
5127
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5008
5128
|
|
|
5009
5129
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5010
5130
|
function ExpanderIcon(props) {
|
|
@@ -5039,6 +5159,43 @@ function ExpanderIcon(props) {
|
|
|
5039
5159
|
}));
|
|
5040
5160
|
}
|
|
5041
5161
|
|
|
5162
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5163
|
+
var React24 = __toModule(require("react"));
|
|
5164
|
+
|
|
5165
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5166
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwf _16lm1iwd";
|
|
5167
|
+
|
|
5168
|
+
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5169
|
+
var LoadingIcon = (props) => {
|
|
5170
|
+
return /* @__PURE__ */ React24.createElement("svg", {
|
|
5171
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5172
|
+
style: {
|
|
5173
|
+
margin: "auto",
|
|
5174
|
+
display: "block",
|
|
5175
|
+
shapeRendering: "auto"
|
|
5176
|
+
},
|
|
5177
|
+
width: "24px",
|
|
5178
|
+
height: "24px",
|
|
5179
|
+
viewBox: "0 0 100 100",
|
|
5180
|
+
preserveAspectRatio: "xMidYMid",
|
|
5181
|
+
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5182
|
+
}, /* @__PURE__ */ React24.createElement("circle", {
|
|
5183
|
+
cx: "50",
|
|
5184
|
+
cy: "50",
|
|
5185
|
+
fill: "none",
|
|
5186
|
+
strokeWidth: "10",
|
|
5187
|
+
r: "35",
|
|
5188
|
+
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5189
|
+
}, /* @__PURE__ */ React24.createElement("animateTransform", {
|
|
5190
|
+
attributeName: "transform",
|
|
5191
|
+
type: "rotate",
|
|
5192
|
+
repeatCount: "indefinite",
|
|
5193
|
+
dur: "1s",
|
|
5194
|
+
values: "0 50 50;360 50 50",
|
|
5195
|
+
keyTimes: "0;1"
|
|
5196
|
+
})));
|
|
5197
|
+
};
|
|
5198
|
+
|
|
5042
5199
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5043
5200
|
function getGroupColumnRender({
|
|
5044
5201
|
groupIndexForColumn,
|
|
@@ -5049,12 +5206,12 @@ function getGroupColumnRender({
|
|
|
5049
5206
|
var _a, _b, _c;
|
|
5050
5207
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5051
5208
|
if (column.renderValue) {
|
|
5052
|
-
value = /* @__PURE__ */
|
|
5209
|
+
value = /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
5053
5210
|
render: column.renderValue,
|
|
5054
5211
|
renderParam: renderOptions
|
|
5055
5212
|
});
|
|
5056
5213
|
}
|
|
5057
|
-
|
|
5214
|
+
const groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : rowInfo.isGroupRow && ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndexForColumn]) || rowInfo;
|
|
5058
5215
|
if (!groupRowInfo) {
|
|
5059
5216
|
return null;
|
|
5060
5217
|
}
|
|
@@ -5077,31 +5234,30 @@ function getGroupColumnRender({
|
|
|
5077
5234
|
}
|
|
5078
5235
|
let icon = null;
|
|
5079
5236
|
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
|
-
|
|
5237
|
+
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5238
|
+
if (isLoading) {
|
|
5239
|
+
icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
|
|
5240
|
+
} else if (showExpanderIcon) {
|
|
5241
|
+
const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
|
|
5082
5242
|
expanded: !collapsed,
|
|
5083
5243
|
onChange: () => {
|
|
5084
5244
|
toggleGroupRow(groupKeys);
|
|
5085
5245
|
}
|
|
5086
5246
|
});
|
|
5087
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5247
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
5088
5248
|
render: column.renderGroupIcon,
|
|
5089
5249
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5090
5250
|
}) : defaultIcon;
|
|
5091
5251
|
}
|
|
5092
|
-
return /* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
5093
5253
|
className: join(display.flex, alignItems.center)
|
|
5094
|
-
}, icon, /* @__PURE__ */
|
|
5254
|
+
}, icon, /* @__PURE__ */ React25.createElement("div", {
|
|
5095
5255
|
className: cssEllipsisClassName
|
|
5096
5256
|
}, value != null ? value : null));
|
|
5097
5257
|
};
|
|
5098
5258
|
}
|
|
5099
5259
|
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
5100
|
-
const {
|
|
5101
|
-
groupByForColumn,
|
|
5102
|
-
groupIndexForColumn,
|
|
5103
|
-
groupRenderStrategy
|
|
5104
|
-
} = options;
|
|
5260
|
+
const { groupByForColumn, groupIndexForColumn, groupRenderStrategy } = options;
|
|
5105
5261
|
let generatedGroupColumn = __spreadValues({
|
|
5106
5262
|
header: `Group by ${groupByForColumn.field}`,
|
|
5107
5263
|
groupByField: groupByForColumn.field,
|
|
@@ -5126,30 +5282,40 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5126
5282
|
header: `Group`,
|
|
5127
5283
|
groupByField: options.groupBy.map((g) => g.field),
|
|
5128
5284
|
sortable: false,
|
|
5285
|
+
style: ({ rowInfo }) => ({
|
|
5286
|
+
[stripVar(ThemeVars.components.Row.groupNesting)]: rowInfo.isGroupRow ? rowInfo.groupNesting - 1 : 0
|
|
5287
|
+
}),
|
|
5129
5288
|
render: (renderOptions) => {
|
|
5130
5289
|
var _a, _b;
|
|
5131
5290
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5132
|
-
if (!rowInfo.isGroupRow) {
|
|
5133
|
-
return null;
|
|
5134
|
-
}
|
|
5135
5291
|
if (column.renderValue) {
|
|
5136
5292
|
value = column.renderValue(renderOptions);
|
|
5137
5293
|
}
|
|
5138
|
-
const collapsed = rowInfo.collapsed;
|
|
5294
|
+
const collapsed = rowInfo.isGroupRow ? rowInfo.collapsed : false;
|
|
5139
5295
|
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
|
-
|
|
5296
|
+
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;
|
|
5297
|
+
const isLoading = showLoadingIcon(rowInfo);
|
|
5298
|
+
if (isLoading) {
|
|
5299
|
+
icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
|
|
5300
|
+
} else if (showExpanderIcon) {
|
|
5301
|
+
const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
|
|
5143
5302
|
expanded: !collapsed,
|
|
5144
5303
|
onChange: () => {
|
|
5304
|
+
if (!rowInfo.isGroupRow) {
|
|
5305
|
+
return;
|
|
5306
|
+
}
|
|
5145
5307
|
toggleGroupRow(rowInfo.groupKeys);
|
|
5146
5308
|
}
|
|
5147
5309
|
});
|
|
5148
|
-
icon =
|
|
5310
|
+
icon = defaultIcon;
|
|
5311
|
+
if (column.renderGroupIcon) {
|
|
5312
|
+
const renderParam = Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions);
|
|
5313
|
+
icon = column.renderGroupIcon(renderParam);
|
|
5314
|
+
}
|
|
5149
5315
|
}
|
|
5150
|
-
return /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
5151
5317
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5152
|
-
}, icon, /* @__PURE__ */
|
|
5318
|
+
}, icon, /* @__PURE__ */ React25.createElement("div", {
|
|
5153
5319
|
className: cssEllipsisClassName
|
|
5154
5320
|
}, value != null ? value : null));
|
|
5155
5321
|
}
|
|
@@ -5188,86 +5354,6 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5188
5354
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5189
5355
|
var import_react33 = __toModule(require("react"));
|
|
5190
5356
|
|
|
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
5357
|
// src/utils/groupAndPivot/index.ts
|
|
5272
5358
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
5273
5359
|
var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
|
|
@@ -5279,7 +5365,7 @@ function initReducers(reducers) {
|
|
|
5279
5365
|
return {};
|
|
5280
5366
|
}
|
|
5281
5367
|
const result = {};
|
|
5282
|
-
for (
|
|
5368
|
+
for (const key in reducers)
|
|
5283
5369
|
if (reducers.hasOwnProperty(key)) {
|
|
5284
5370
|
result[key] = reducers[key].initialValue;
|
|
5285
5371
|
}
|
|
@@ -5290,7 +5376,7 @@ function computeReducersFor(data, reducers, reducerResults) {
|
|
|
5290
5376
|
if (!reducers || !Object.keys(reducers).length) {
|
|
5291
5377
|
return;
|
|
5292
5378
|
}
|
|
5293
|
-
for (
|
|
5379
|
+
for (const key in reducers)
|
|
5294
5380
|
if (reducers.hasOwnProperty(key)) {
|
|
5295
5381
|
const reducer = reducers[key];
|
|
5296
5382
|
if (typeof reducer.reducer !== "function") {
|
|
@@ -5312,7 +5398,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5312
5398
|
function traverseValues(pivotDeepMap, container, pivot2, pivotIndex = 0, currentPivotKeys2 = []) {
|
|
5313
5399
|
const last = !pivot2.length || pivotIndex === pivot2.length - 1;
|
|
5314
5400
|
const values = container[(mappings == null ? void 0 : mappings.values) || "values"] || {};
|
|
5315
|
-
for (
|
|
5401
|
+
for (const k in values)
|
|
5316
5402
|
if (values.hasOwnProperty(k)) {
|
|
5317
5403
|
const pivotKey = k;
|
|
5318
5404
|
currentPivotKeys2.push(pivotKey);
|
|
@@ -5328,12 +5414,12 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5328
5414
|
}
|
|
5329
5415
|
}
|
|
5330
5416
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
5331
|
-
|
|
5417
|
+
const currentPivotKeys = [];
|
|
5332
5418
|
const initialReducerValue = initReducers(reducers);
|
|
5333
5419
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
5334
5420
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5335
5421
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5336
|
-
const dataArray = lazyGroupRowInfo.
|
|
5422
|
+
const dataArray = lazyGroupRowInfo.children;
|
|
5337
5423
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5338
5424
|
const deepMapGroupValue = deepMap.get(currentGroupKeys);
|
|
5339
5425
|
if (deepMapGroupValue) {
|
|
@@ -5341,11 +5427,23 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5341
5427
|
}
|
|
5342
5428
|
return next == null ? void 0 : next();
|
|
5343
5429
|
}
|
|
5430
|
+
if (lazyGroupRowInfo) {
|
|
5431
|
+
const current = deepMap.get(currentGroupKeys);
|
|
5432
|
+
if (current) {
|
|
5433
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
5434
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5435
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5436
|
+
current.error = lazyGroupRowInfo.error;
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5344
5439
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5345
5440
|
if (!dataArray[i]) {
|
|
5346
5441
|
const deepMapGroupValue2 = {
|
|
5347
5442
|
items: [],
|
|
5348
|
-
reducerResults: {}
|
|
5443
|
+
reducerResults: {},
|
|
5444
|
+
cache: false,
|
|
5445
|
+
childrenLoading: false,
|
|
5446
|
+
childrenAvailable: false
|
|
5349
5447
|
};
|
|
5350
5448
|
deepMap.set([
|
|
5351
5449
|
...currentGroupKeys,
|
|
@@ -5355,14 +5453,15 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5355
5453
|
}
|
|
5356
5454
|
const dataObject = dataArray[i].data;
|
|
5357
5455
|
const dataKeys = dataArray[i].keys;
|
|
5358
|
-
let item = dataObject;
|
|
5359
5456
|
if (dataKeys.length) {
|
|
5360
|
-
const
|
|
5361
|
-
const key = item[groupByProperty];
|
|
5457
|
+
const key = dataKeys[dataKeys.length - 1];
|
|
5362
5458
|
currentGroupKeys.push(key);
|
|
5363
5459
|
}
|
|
5364
5460
|
const deepMapGroupValue = {
|
|
5365
5461
|
items: [],
|
|
5462
|
+
cache: false,
|
|
5463
|
+
childrenLoading: false,
|
|
5464
|
+
childrenAvailable: false,
|
|
5366
5465
|
commonData: dataObject,
|
|
5367
5466
|
reducerResults: dataArray[i].aggregations || {}
|
|
5368
5467
|
};
|
|
@@ -5431,13 +5530,16 @@ function group(groupParams, data) {
|
|
|
5431
5530
|
const groupByLength = groupBy.length;
|
|
5432
5531
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
5433
5532
|
const deepMap = new DeepMap();
|
|
5434
|
-
|
|
5435
|
-
|
|
5533
|
+
const currentGroupKeys = [];
|
|
5534
|
+
const currentPivotKeys = [];
|
|
5436
5535
|
const initialReducerValue = initReducers(reducers);
|
|
5437
5536
|
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
5438
5537
|
if (!groupByLength) {
|
|
5439
5538
|
const deepMapGroupValue = {
|
|
5440
5539
|
items: [],
|
|
5540
|
+
cache: false,
|
|
5541
|
+
childrenLoading: false,
|
|
5542
|
+
childrenAvailable: false,
|
|
5441
5543
|
reducerResults: __spreadValues({}, initialReducerValue)
|
|
5442
5544
|
};
|
|
5443
5545
|
if (pivot) {
|
|
@@ -5446,7 +5548,7 @@ function group(groupParams, data) {
|
|
|
5446
5548
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
5447
5549
|
}
|
|
5448
5550
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
5449
|
-
|
|
5551
|
+
const item = data[i];
|
|
5450
5552
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
5451
5553
|
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
5452
5554
|
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
@@ -5454,6 +5556,9 @@ function group(groupParams, data) {
|
|
|
5454
5556
|
if (!deepMap.has(currentGroupKeys)) {
|
|
5455
5557
|
const deepMapGroupValue = {
|
|
5456
5558
|
items: [],
|
|
5559
|
+
cache: false,
|
|
5560
|
+
childrenLoading: false,
|
|
5561
|
+
childrenAvailable: false,
|
|
5457
5562
|
reducerResults: __spreadValues({}, initialReducerValue)
|
|
5458
5563
|
};
|
|
5459
5564
|
if (pivot) {
|
|
@@ -5512,7 +5617,8 @@ function flatten(groupResult) {
|
|
|
5512
5617
|
return result;
|
|
5513
5618
|
}
|
|
5514
5619
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
5515
|
-
|
|
5620
|
+
var _a;
|
|
5621
|
+
const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
|
|
5516
5622
|
const groupNesting = groupKeys.length;
|
|
5517
5623
|
const {
|
|
5518
5624
|
items: groupItems,
|
|
@@ -5520,10 +5626,10 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5520
5626
|
pivotDeepMap,
|
|
5521
5627
|
commonData
|
|
5522
5628
|
} = deepMapValue;
|
|
5523
|
-
let data = null;
|
|
5629
|
+
let data = commonData != null ? commonData : null;
|
|
5524
5630
|
if (Object.keys(reducerResults).length > 0) {
|
|
5525
|
-
data =
|
|
5526
|
-
for (
|
|
5631
|
+
data = __spreadValues({}, commonData);
|
|
5632
|
+
for (const key in reducers)
|
|
5527
5633
|
if (reducers.hasOwnProperty(key)) {
|
|
5528
5634
|
const reducer = reducers[key];
|
|
5529
5635
|
const field = reducer.field;
|
|
@@ -5532,8 +5638,10 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5532
5638
|
}
|
|
5533
5639
|
}
|
|
5534
5640
|
}
|
|
5535
|
-
let
|
|
5641
|
+
let selfLoaded = true;
|
|
5642
|
+
let theValue = (_a = data != null ? data[groupBy[groupKeys.length - 1]] : null) != null ? _a : groupKeys[groupKeys.length - 1];
|
|
5536
5643
|
if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
|
|
5644
|
+
selfLoaded = false;
|
|
5537
5645
|
theValue = null;
|
|
5538
5646
|
}
|
|
5539
5647
|
const enhancedGroupData = {
|
|
@@ -5543,13 +5651,20 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5543
5651
|
groupKeys,
|
|
5544
5652
|
id: `${groupKeys}`,
|
|
5545
5653
|
collapsed,
|
|
5654
|
+
dataSourceHasGrouping: true,
|
|
5655
|
+
selfLoaded,
|
|
5656
|
+
error: options.error,
|
|
5546
5657
|
parents,
|
|
5547
|
-
|
|
5658
|
+
deepRowInfoArray: [],
|
|
5548
5659
|
collapsedChildrenCount: 0,
|
|
5549
5660
|
collapsedGroupsCount: 0,
|
|
5661
|
+
childrenAvailable: lazyLoad ? options.childrenAvailable : true,
|
|
5662
|
+
childrenLoading: options.childrenLoading,
|
|
5550
5663
|
indexInParentGroups: options.indexInParentGroups,
|
|
5551
5664
|
indexInGroup: options.indexInGroup,
|
|
5552
5665
|
indexInAll: options.indexInAll,
|
|
5666
|
+
directChildrenCount: options.directChildrenCount,
|
|
5667
|
+
directChildrenLoadedCount: lazyLoad ? options.directChildrenLoadedCount : options.directChildrenCount,
|
|
5553
5668
|
value: theValue,
|
|
5554
5669
|
rootGroupBy: groupBy,
|
|
5555
5670
|
groupBy: groupNesting === groupBy.length ? groupBy : groupBy.slice(0, groupNesting),
|
|
@@ -5562,7 +5677,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5562
5677
|
}
|
|
5563
5678
|
function completeReducers(reducers, reducerResults, items) {
|
|
5564
5679
|
if (reducers) {
|
|
5565
|
-
for (
|
|
5680
|
+
for (const key in reducers)
|
|
5566
5681
|
if (reducers.hasOwnProperty(key)) {
|
|
5567
5682
|
const reducer = reducers[key];
|
|
5568
5683
|
if (reducer.done) {
|
|
@@ -5574,6 +5689,7 @@ function completeReducers(reducers, reducerResults, items) {
|
|
|
5574
5689
|
}
|
|
5575
5690
|
function enhancedFlatten(param) {
|
|
5576
5691
|
const {
|
|
5692
|
+
lazyLoad,
|
|
5577
5693
|
groupResult,
|
|
5578
5694
|
toPrimaryKey,
|
|
5579
5695
|
groupRowsState,
|
|
@@ -5587,11 +5703,13 @@ function enhancedFlatten(param) {
|
|
|
5587
5703
|
const parents = [];
|
|
5588
5704
|
const indexInParentGroups = [];
|
|
5589
5705
|
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
5590
|
-
var _a;
|
|
5706
|
+
var _a, _b;
|
|
5591
5707
|
const items = deepMapValue.items;
|
|
5592
5708
|
const groupNesting = groupKeys.length;
|
|
5593
5709
|
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
5710
|
+
indexInParentGroups.push(indexInGroup);
|
|
5594
5711
|
const enhancedGroupData = getEnhancedGroupData({
|
|
5712
|
+
lazyLoad,
|
|
5595
5713
|
groupBy: groupByStrings,
|
|
5596
5714
|
parents: Array.from(parents),
|
|
5597
5715
|
reducers,
|
|
@@ -5599,35 +5717,60 @@ function enhancedFlatten(param) {
|
|
|
5599
5717
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
5600
5718
|
indexInAll: result.length,
|
|
5601
5719
|
groupKeys,
|
|
5720
|
+
error: deepMapValue.error,
|
|
5721
|
+
childrenLoading: deepMapValue.childrenLoading,
|
|
5722
|
+
childrenAvailable: deepMapValue.childrenAvailable,
|
|
5723
|
+
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
5724
|
+
directChildrenLoadedCount: 0,
|
|
5602
5725
|
collapsed
|
|
5603
5726
|
}, deepMapValue);
|
|
5604
|
-
const
|
|
5727
|
+
const parent = parents[parents.length - 1];
|
|
5728
|
+
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
5729
|
+
let include = generateGroupRows || collapsed;
|
|
5730
|
+
if (parentCollapsed) {
|
|
5731
|
+
include = false;
|
|
5732
|
+
}
|
|
5605
5733
|
if (include) {
|
|
5606
5734
|
result.push(enhancedGroupData);
|
|
5607
5735
|
}
|
|
5608
5736
|
if (collapsed) {
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5737
|
+
enhancedGroupData.collapsedChildrenCount = enhancedGroupData.groupCount;
|
|
5738
|
+
parents.forEach((parent2) => {
|
|
5739
|
+
if (!parentCollapsed) {
|
|
5740
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
5741
|
+
}
|
|
5742
|
+
parent2.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
5743
|
+
parent2.collapsedGroupsCount += 1;
|
|
5613
5744
|
});
|
|
5614
5745
|
} else {
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5746
|
+
if (!parentCollapsed) {
|
|
5747
|
+
parents.forEach((parent2) => {
|
|
5748
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
5749
|
+
});
|
|
5750
|
+
}
|
|
5751
|
+
}
|
|
5752
|
+
if (parent && enhancedGroupData.selfLoaded && lazyLoad) {
|
|
5753
|
+
parent.directChildrenLoadedCount += 1;
|
|
5618
5754
|
}
|
|
5619
|
-
indexInParentGroups.push(indexInGroup);
|
|
5620
5755
|
parents.push(enhancedGroupData);
|
|
5621
|
-
|
|
5756
|
+
const continueWithChildren = !collapsed || lazyLoad;
|
|
5757
|
+
if (continueWithChildren) {
|
|
5622
5758
|
if (!next) {
|
|
5623
5759
|
if (!pivot) {
|
|
5624
5760
|
const startIndex = result.length;
|
|
5625
|
-
|
|
5761
|
+
if (!collapsed) {
|
|
5762
|
+
result.length += items.length;
|
|
5763
|
+
}
|
|
5764
|
+
for (let index = 0, len = items.length; index < len; index++) {
|
|
5765
|
+
const item = items[index];
|
|
5626
5766
|
const rowInfo = {
|
|
5627
5767
|
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
5628
5768
|
data: item,
|
|
5769
|
+
dataSourceHasGrouping: true,
|
|
5629
5770
|
isGroupRow: false,
|
|
5630
|
-
|
|
5771
|
+
selfLoaded: !!item,
|
|
5772
|
+
rootGroupBy: groupByStrings,
|
|
5773
|
+
collapsed,
|
|
5631
5774
|
groupKeys,
|
|
5632
5775
|
parents: Array.from(parents),
|
|
5633
5776
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
@@ -5637,11 +5780,19 @@ function enhancedFlatten(param) {
|
|
|
5637
5780
|
groupNesting,
|
|
5638
5781
|
groupCount: enhancedGroupData.groupCount
|
|
5639
5782
|
};
|
|
5640
|
-
parents.forEach((
|
|
5641
|
-
|
|
5783
|
+
parents.forEach((parent2, i) => {
|
|
5784
|
+
const last = i === parents.length - 1;
|
|
5785
|
+
if (last && item) {
|
|
5786
|
+
parent2.directChildrenLoadedCount += 1;
|
|
5787
|
+
}
|
|
5788
|
+
if (!parentCollapsed) {
|
|
5789
|
+
parent2.deepRowInfoArray.push(rowInfo);
|
|
5790
|
+
}
|
|
5642
5791
|
});
|
|
5643
|
-
|
|
5644
|
-
|
|
5792
|
+
if (!collapsed) {
|
|
5793
|
+
result[startIndex + index] = rowInfo;
|
|
5794
|
+
}
|
|
5795
|
+
}
|
|
5645
5796
|
}
|
|
5646
5797
|
} else {
|
|
5647
5798
|
next();
|
|
@@ -5655,49 +5806,151 @@ function enhancedFlatten(param) {
|
|
|
5655
5806
|
};
|
|
5656
5807
|
}
|
|
5657
5808
|
|
|
5658
|
-
// src/components/
|
|
5659
|
-
var
|
|
5660
|
-
function useEffectWithChanges(fn, deps) {
|
|
5661
|
-
const prevRef = (0, import_react31.useRef)({});
|
|
5662
|
-
const oldValuesRef = (0, import_react31.useRef)({});
|
|
5663
|
-
const oldValues = oldValuesRef.current;
|
|
5664
|
-
const changesRef = (0, import_react31.useRef)({});
|
|
5665
|
-
const changes = changesRef.current;
|
|
5666
|
-
const useEffectDeps = [];
|
|
5667
|
-
for (const k in deps) {
|
|
5668
|
-
if (deps.hasOwnProperty(k)) {
|
|
5669
|
-
if (deps[k] !== prevRef.current[k]) {
|
|
5670
|
-
changes[k] = deps[k];
|
|
5671
|
-
oldValues[k] = prevRef.current[k];
|
|
5672
|
-
}
|
|
5673
|
-
useEffectDeps.push(deps[k]);
|
|
5674
|
-
}
|
|
5675
|
-
}
|
|
5676
|
-
prevRef.current = deps;
|
|
5677
|
-
(0, import_react31.useEffect)(() => {
|
|
5678
|
-
const changes2 = changesRef.current;
|
|
5679
|
-
const result = fn(changes2, oldValues);
|
|
5680
|
-
changesRef.current = {};
|
|
5681
|
-
oldValuesRef.current = {};
|
|
5682
|
-
return result;
|
|
5683
|
-
}, useEffectDeps);
|
|
5684
|
-
}
|
|
5809
|
+
// src/components/DataSource/index.tsx
|
|
5810
|
+
var React26 = __toModule(require("react"));
|
|
5685
5811
|
|
|
5686
|
-
// src/
|
|
5687
|
-
var
|
|
5688
|
-
|
|
5689
|
-
});
|
|
5690
|
-
var SKIP_DATA_CHANGES_KEYS = {
|
|
5691
|
-
originalDataArray: true,
|
|
5692
|
-
changes: true
|
|
5812
|
+
// src/utils/multisort/sortTypes.ts
|
|
5813
|
+
var numberComparator = function(first, second) {
|
|
5814
|
+
return first - second;
|
|
5693
5815
|
};
|
|
5694
|
-
function
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
return
|
|
5698
|
-
}
|
|
5699
|
-
|
|
5700
|
-
|
|
5816
|
+
var stringComparator = function(first, second) {
|
|
5817
|
+
first = `${first}`;
|
|
5818
|
+
second = `${second}`;
|
|
5819
|
+
return first.localeCompare(second);
|
|
5820
|
+
};
|
|
5821
|
+
var sortTypes = {
|
|
5822
|
+
number: numberComparator,
|
|
5823
|
+
string: stringComparator
|
|
5824
|
+
};
|
|
5825
|
+
var sortTypes_default = sortTypes;
|
|
5826
|
+
|
|
5827
|
+
// src/utils/multisort/index.ts
|
|
5828
|
+
var multisort = (sortInfo, array, get) => {
|
|
5829
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
5830
|
+
return array;
|
|
5831
|
+
};
|
|
5832
|
+
multisort.knownTypes = sortTypes_default;
|
|
5833
|
+
var getSingleSortFunction = (info) => {
|
|
5834
|
+
if (!info) {
|
|
5835
|
+
return;
|
|
5836
|
+
}
|
|
5837
|
+
const field = info.field;
|
|
5838
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5839
|
+
if (!dir) {
|
|
5840
|
+
return;
|
|
5841
|
+
}
|
|
5842
|
+
let fn = info.fn;
|
|
5843
|
+
if (!fn && info.type) {
|
|
5844
|
+
fn = multisort.knownTypes[info.type];
|
|
5845
|
+
if (!fn) {
|
|
5846
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
if (!fn) {
|
|
5850
|
+
fn = sortTypes_default.string;
|
|
5851
|
+
}
|
|
5852
|
+
return (first, second) => {
|
|
5853
|
+
const a = field ? first[field] : first;
|
|
5854
|
+
const b = field ? second[field] : second;
|
|
5855
|
+
return dir * fn(a, b);
|
|
5856
|
+
};
|
|
5857
|
+
};
|
|
5858
|
+
var getSortFunctions = (sortInfo) => {
|
|
5859
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
5860
|
+
};
|
|
5861
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
5862
|
+
const fns = getSortFunctions(sortInfo);
|
|
5863
|
+
return (first, second) => {
|
|
5864
|
+
if (get) {
|
|
5865
|
+
first = get(first);
|
|
5866
|
+
second = get(second);
|
|
5867
|
+
}
|
|
5868
|
+
let result = 0;
|
|
5869
|
+
let i = 0;
|
|
5870
|
+
let fn;
|
|
5871
|
+
const len = fns.length;
|
|
5872
|
+
for (; i < len; i++) {
|
|
5873
|
+
fn = fns[i];
|
|
5874
|
+
if (!fn) {
|
|
5875
|
+
continue;
|
|
5876
|
+
}
|
|
5877
|
+
result = fn(first, second);
|
|
5878
|
+
if (result !== 0) {
|
|
5879
|
+
return result;
|
|
5880
|
+
}
|
|
5881
|
+
}
|
|
5882
|
+
return result;
|
|
5883
|
+
};
|
|
5884
|
+
};
|
|
5885
|
+
|
|
5886
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5887
|
+
var import_react32 = __toModule(require("react"));
|
|
5888
|
+
|
|
5889
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
5890
|
+
var import_react31 = __toModule(require("react"));
|
|
5891
|
+
function useEffectWithChanges(fn, deps) {
|
|
5892
|
+
const prevRef = (0, import_react31.useRef)({});
|
|
5893
|
+
const oldValuesRef = (0, import_react31.useRef)({});
|
|
5894
|
+
const oldValues = oldValuesRef.current;
|
|
5895
|
+
const changesRef = (0, import_react31.useRef)({});
|
|
5896
|
+
const changes = changesRef.current;
|
|
5897
|
+
const useEffectDeps = [];
|
|
5898
|
+
for (const k in deps) {
|
|
5899
|
+
if (deps.hasOwnProperty(k)) {
|
|
5900
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
5901
|
+
changes[k] = deps[k];
|
|
5902
|
+
oldValues[k] = prevRef.current[k];
|
|
5903
|
+
}
|
|
5904
|
+
useEffectDeps.push(deps[k]);
|
|
5905
|
+
}
|
|
5906
|
+
}
|
|
5907
|
+
prevRef.current = deps;
|
|
5908
|
+
(0, import_react31.useEffect)(() => {
|
|
5909
|
+
const changes2 = changesRef.current;
|
|
5910
|
+
const result = fn(changes2, oldValues);
|
|
5911
|
+
changesRef.current = {};
|
|
5912
|
+
oldValuesRef.current = {};
|
|
5913
|
+
return result;
|
|
5914
|
+
}, useEffectDeps);
|
|
5915
|
+
}
|
|
5916
|
+
|
|
5917
|
+
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
5918
|
+
function assignFiltered(filterFn, target, ...rest) {
|
|
5919
|
+
const result = target;
|
|
5920
|
+
rest.forEach((obj) => {
|
|
5921
|
+
for (const key in obj) {
|
|
5922
|
+
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
5923
|
+
result[key] = obj[key];
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
});
|
|
5927
|
+
return result;
|
|
5928
|
+
}
|
|
5929
|
+
function assignNonNull(target, ...rest) {
|
|
5930
|
+
return assignFiltered((value) => value != null, target, ...rest);
|
|
5931
|
+
}
|
|
5932
|
+
function assignExcept(exceptKeys, target, ...rest) {
|
|
5933
|
+
return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
|
|
5934
|
+
}
|
|
5935
|
+
|
|
5936
|
+
// src/components/DataSource/privateHooks/getChangeDetect.ts
|
|
5937
|
+
function getChangeDetect() {
|
|
5938
|
+
var _a;
|
|
5939
|
+
const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
|
|
5940
|
+
return `${Date.now()}:${perfNow}`;
|
|
5941
|
+
}
|
|
5942
|
+
|
|
5943
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5944
|
+
var CACHE_DEFAULT = true;
|
|
5945
|
+
var getRafPromise = () => new Promise((resolve) => {
|
|
5946
|
+
requestAnimationFrame(resolve);
|
|
5947
|
+
});
|
|
5948
|
+
var SKIP_DATA_CHANGES_KEYS = {
|
|
5949
|
+
originalDataArray: true,
|
|
5950
|
+
changes: true
|
|
5951
|
+
};
|
|
5952
|
+
function buildDataSourceDataParams(componentState, overrides) {
|
|
5953
|
+
var _a, _b;
|
|
5701
5954
|
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
5702
5955
|
const dataSourceParams = {
|
|
5703
5956
|
append: false,
|
|
@@ -5707,6 +5960,9 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
5707
5960
|
pivotBy: componentState.pivotBy,
|
|
5708
5961
|
aggregationReducers: componentState.aggregationReducers
|
|
5709
5962
|
};
|
|
5963
|
+
if (dataSourceParams.groupBy) {
|
|
5964
|
+
dataSourceParams.groupRowsState = componentState.groupRowsState.getState();
|
|
5965
|
+
}
|
|
5710
5966
|
if (componentState.livePagination !== void 0) {
|
|
5711
5967
|
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
5712
5968
|
dataSourceParams.__cursorId = componentState.cursorId;
|
|
@@ -5742,7 +5998,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5742
5998
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
5743
5999
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
5744
6000
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
5745
|
-
const items = existingGroupRowInfo.
|
|
6001
|
+
const items = existingGroupRowInfo.children;
|
|
5746
6002
|
const len = items.length;
|
|
5747
6003
|
let allLoaded = true;
|
|
5748
6004
|
for (let i = 0; i < len; i++) {
|
|
@@ -5755,6 +6011,21 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5755
6011
|
return Promise.resolve(true);
|
|
5756
6012
|
}
|
|
5757
6013
|
}
|
|
6014
|
+
if (existingGroupRowInfo) {
|
|
6015
|
+
if (!existingGroupRowInfo.childrenLoading) {
|
|
6016
|
+
existingGroupRowInfo.childrenLoading = true;
|
|
6017
|
+
}
|
|
6018
|
+
} else {
|
|
6019
|
+
lazyGroupData.set(key, {
|
|
6020
|
+
error: void 0,
|
|
6021
|
+
children: [],
|
|
6022
|
+
childrenLoading: true,
|
|
6023
|
+
childrenAvailable: false,
|
|
6024
|
+
cache: CACHE_DEFAULT,
|
|
6025
|
+
totalCount: 0
|
|
6026
|
+
});
|
|
6027
|
+
}
|
|
6028
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
5758
6029
|
}
|
|
5759
6030
|
if (typeof data === "function") {
|
|
5760
6031
|
data = data(dataParams);
|
|
@@ -5764,7 +6035,6 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5764
6035
|
actions.loading = true;
|
|
5765
6036
|
}
|
|
5766
6037
|
return Promise.resolve(data).then((dataParam) => {
|
|
5767
|
-
var _a, _b, _c, _d;
|
|
5768
6038
|
let dataArray = [];
|
|
5769
6039
|
let skipAssign = false;
|
|
5770
6040
|
if (Array.isArray(dataParam.data)) {
|
|
@@ -5777,57 +6047,87 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5777
6047
|
actions.pivotMappings = remoteData.mappings;
|
|
5778
6048
|
}
|
|
5779
6049
|
if (componentState.lazyLoad) {
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
totalCount: newGroupRowInfo.totalCount,
|
|
5792
|
-
cache: (_b = newGroupRowInfo.cache) != null ? _b : true
|
|
6050
|
+
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6051
|
+
var _a, _b, _c;
|
|
6052
|
+
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6053
|
+
const dataArray2 = remoteData2.data;
|
|
6054
|
+
const newGroupRowInfo = {
|
|
6055
|
+
cache: !!remoteData2.cache,
|
|
6056
|
+
childrenLoading: false,
|
|
6057
|
+
childrenAvailable: true,
|
|
6058
|
+
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6059
|
+
children: dataArray2,
|
|
6060
|
+
error: remoteData2.error
|
|
5793
6061
|
};
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
6062
|
+
const childDatasets = [];
|
|
6063
|
+
if (dataParams.lazyLoadBatchSize && !parentKeys) {
|
|
6064
|
+
const existingGroupRowInfo = lazyGroupData.get(theKey);
|
|
6065
|
+
const isGroupNew = !existingGroupRowInfo;
|
|
6066
|
+
const currentGroupRowInfo = assignExcept({
|
|
6067
|
+
children: true
|
|
6068
|
+
}, existingGroupRowInfo || {}, newGroupRowInfo);
|
|
6069
|
+
if (isGroupNew) {
|
|
6070
|
+
currentGroupRowInfo.chidren = [];
|
|
6071
|
+
}
|
|
6072
|
+
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6073
|
+
const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
|
|
6074
|
+
const end = Math.min((_c = remoteData2.totalCount) != null ? _c : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6075
|
+
for (let i = start; i < end; i++) {
|
|
6076
|
+
const it = newGroupRowInfo.children[i - start];
|
|
6077
|
+
if (!it) {
|
|
6078
|
+
throw `lazily loaded item not found at index ${i - start}`;
|
|
6079
|
+
}
|
|
6080
|
+
currentGroupRowInfo.children[i] = it;
|
|
6081
|
+
if (it.dataset) {
|
|
6082
|
+
childDatasets.push({
|
|
6083
|
+
keys: it.keys,
|
|
6084
|
+
dataset: it.dataset
|
|
6085
|
+
});
|
|
6086
|
+
}
|
|
6087
|
+
}
|
|
6088
|
+
if (isGroupNew) {
|
|
6089
|
+
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
5804
6090
|
}
|
|
5805
|
-
|
|
6091
|
+
} else {
|
|
6092
|
+
if (parentKeys) {
|
|
6093
|
+
newGroupRowInfo.children.forEach((child) => {
|
|
6094
|
+
if (child && child.dataset) {
|
|
6095
|
+
childDatasets.push({
|
|
6096
|
+
keys: child.keys,
|
|
6097
|
+
dataset: child.dataset
|
|
6098
|
+
});
|
|
6099
|
+
}
|
|
6100
|
+
});
|
|
6101
|
+
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
6102
|
+
}
|
|
6103
|
+
lazyGroupData.set(theKey, newGroupRowInfo);
|
|
5806
6104
|
}
|
|
5807
|
-
|
|
5808
|
-
|
|
6105
|
+
let skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = false;
|
|
6106
|
+
if (!keys || !keys.length) {
|
|
6107
|
+
const topLevelLazyGroupData = lazyGroupData.get([
|
|
6108
|
+
LAZY_ROOT_KEY_FOR_GROUPS
|
|
6109
|
+
]);
|
|
6110
|
+
actions.originalDataArray = [...topLevelLazyGroupData.children];
|
|
6111
|
+
skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = true;
|
|
5809
6112
|
}
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
6113
|
+
if (!skipTriggerChangeAsAlreadyOriginalArrayWasUpdated) {
|
|
6114
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
6115
|
+
}
|
|
6116
|
+
if (childDatasets.length) {
|
|
6117
|
+
const parentKeys2 = keys;
|
|
6118
|
+
childDatasets.forEach(({ keys: keys2, dataset }) => {
|
|
6119
|
+
resolveRemoteData(keys2, dataset, parentKeys2);
|
|
6120
|
+
});
|
|
6121
|
+
}
|
|
6122
|
+
};
|
|
6123
|
+
const lazyGroupData = componentState.originalLazyGroupData;
|
|
5813
6124
|
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
|
-
}
|
|
6125
|
+
resolveRemoteData(dataParams.groupKeys || [], remoteData);
|
|
5823
6126
|
}
|
|
5824
6127
|
} else {
|
|
5825
6128
|
dataArray = dataParam;
|
|
5826
6129
|
}
|
|
5827
6130
|
if (!skipAssign) {
|
|
5828
|
-
if (append) {
|
|
5829
|
-
console.log("appending", dataArray);
|
|
5830
|
-
}
|
|
5831
6131
|
actions.originalDataArray = append ? componentState.originalDataArray.concat(dataArray) : dataArray;
|
|
5832
6132
|
}
|
|
5833
6133
|
if (dataIsPromise && !componentState.lazyLoad) {
|
|
@@ -5944,8 +6244,8 @@ function useLazyLoadRange() {
|
|
|
5944
6244
|
componentActions: actions,
|
|
5945
6245
|
componentState
|
|
5946
6246
|
} = useComponentState();
|
|
5947
|
-
|
|
5948
|
-
|
|
6247
|
+
(0, import_react32.useEffect)(() => {
|
|
6248
|
+
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
5949
6249
|
}, [componentState.data, componentState.dataParams]);
|
|
5950
6250
|
const {
|
|
5951
6251
|
lazyLoadBatchSize,
|
|
@@ -5954,7 +6254,7 @@ function useLazyLoadRange() {
|
|
|
5954
6254
|
scrollStopDelayUpdatedByTable
|
|
5955
6255
|
} = componentState;
|
|
5956
6256
|
const latestRenderRangeRef = (0, import_react32.useRef)(null);
|
|
5957
|
-
const loadRange = (renderRange, cache =
|
|
6257
|
+
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
5958
6258
|
const componentState2 = getComponentState();
|
|
5959
6259
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
5960
6260
|
if (!renderRange) {
|
|
@@ -5977,11 +6277,11 @@ function useLazyLoadRange() {
|
|
|
5977
6277
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
5978
6278
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
5979
6279
|
latestRenderRangeRef.current = renderRange;
|
|
5980
|
-
loadRange(renderRange
|
|
6280
|
+
loadRange(renderRange);
|
|
5981
6281
|
});
|
|
5982
6282
|
}
|
|
5983
6283
|
return;
|
|
5984
|
-
}, [lazyLoadBatchSize
|
|
6284
|
+
}, [lazyLoadBatchSize]);
|
|
5985
6285
|
(0, import_react32.useEffect)(() => {
|
|
5986
6286
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
5987
6287
|
debouncedLoadRange();
|
|
@@ -5998,7 +6298,10 @@ function lazyLoadRange(options, cache) {
|
|
|
5998
6298
|
componentActions
|
|
5999
6299
|
} = options;
|
|
6000
6300
|
const { dataArray } = componentState;
|
|
6001
|
-
const isRowLoaded = (index) =>
|
|
6301
|
+
const isRowLoaded = (index) => {
|
|
6302
|
+
const rowInfo = dataArray[index];
|
|
6303
|
+
return rowInfo.data != null;
|
|
6304
|
+
};
|
|
6002
6305
|
const perGroupFnCalls = new DeepMap();
|
|
6003
6306
|
const rootGroupKeys = ["_______xxx______"];
|
|
6004
6307
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
@@ -6006,17 +6309,36 @@ function lazyLoadRange(options, cache) {
|
|
|
6006
6309
|
if (!rowInfo) {
|
|
6007
6310
|
continue;
|
|
6008
6311
|
}
|
|
6009
|
-
const rowLoaded =
|
|
6010
|
-
const theGroupKeys = rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
6011
|
-
if (rowInfo.
|
|
6312
|
+
const rowLoaded = isRowLoaded(i);
|
|
6313
|
+
const theGroupKeys = rowInfo.dataSourceHasGrouping && rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
6314
|
+
if (rowInfo.isGroupRow && rowInfo.dataSourceHasGrouping && rowInfo.groupKeys) {
|
|
6012
6315
|
theGroupKeys.pop();
|
|
6013
6316
|
}
|
|
6014
6317
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6015
|
-
const indexInGroup = rowInfo.indexInGroup;
|
|
6318
|
+
const indexInGroup = rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll;
|
|
6319
|
+
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6320
|
+
const currentFnCall = {
|
|
6321
|
+
lazyLoadStartIndex: 0,
|
|
6322
|
+
lazyLoadBatchSize,
|
|
6323
|
+
groupKeys: rowInfo.groupKeys
|
|
6324
|
+
};
|
|
6325
|
+
const cacheKeys2 = rowInfo.groupKeys;
|
|
6326
|
+
let cachedFnCalls = perGroupFnCalls.get(cacheKeys2);
|
|
6327
|
+
if (!(cachedFnCalls == null ? void 0 : cachedFnCalls[rowInfo.id])) {
|
|
6328
|
+
const shouldSetFnCalls = !cachedFnCalls;
|
|
6329
|
+
cachedFnCalls = cachedFnCalls || {};
|
|
6330
|
+
if (!cachedFnCalls[rowInfo.id]) {
|
|
6331
|
+
cachedFnCalls[rowInfo.id] = currentFnCall;
|
|
6332
|
+
}
|
|
6333
|
+
if (shouldSetFnCalls) {
|
|
6334
|
+
perGroupFnCalls.set(cacheKeys2, cachedFnCalls);
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6337
|
+
}
|
|
6016
6338
|
if (!rowLoaded) {
|
|
6017
6339
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6018
6340
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
6019
|
-
const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
|
|
6341
|
+
const offset = (rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll) - batchStartIndexInGroup;
|
|
6020
6342
|
const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
|
|
6021
6343
|
const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
|
|
6022
6344
|
const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
|
|
@@ -6044,7 +6366,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6044
6366
|
allFnCalls.push(...Object.values(record));
|
|
6045
6367
|
});
|
|
6046
6368
|
allFnCalls.reduce((promise, fnCall) => {
|
|
6047
|
-
const cacheKey =
|
|
6369
|
+
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
6048
6370
|
if (cache && cache.has(cacheKey)) {
|
|
6049
6371
|
return promise;
|
|
6050
6372
|
}
|
|
@@ -6054,22 +6376,65 @@ function lazyLoadRange(options, cache) {
|
|
|
6054
6376
|
}, initialPromise);
|
|
6055
6377
|
}
|
|
6056
6378
|
|
|
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
|
-
}
|
|
6379
|
+
// src/utils/shallowEqualObjects.ts
|
|
6380
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
6381
|
+
if (objA === objB) {
|
|
6382
|
+
return true;
|
|
6067
6383
|
}
|
|
6068
|
-
if (
|
|
6069
|
-
|
|
6384
|
+
if (!objA || !objB) {
|
|
6385
|
+
return false;
|
|
6070
6386
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6387
|
+
var aKeys = Object.keys(objA);
|
|
6388
|
+
var bKeys = Object.keys(objB);
|
|
6389
|
+
if (ignoreKeys) {
|
|
6390
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6391
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6392
|
+
}
|
|
6393
|
+
var len = aKeys.length;
|
|
6394
|
+
if (bKeys.length !== len) {
|
|
6395
|
+
return false;
|
|
6396
|
+
}
|
|
6397
|
+
for (var i = 0; i < len; i++) {
|
|
6398
|
+
var key = aKeys[i];
|
|
6399
|
+
if (ignoreKeys) {
|
|
6400
|
+
if (ignoreKeys.has(key)) {
|
|
6401
|
+
continue;
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6405
|
+
return false;
|
|
6406
|
+
}
|
|
6407
|
+
}
|
|
6408
|
+
return true;
|
|
6409
|
+
}
|
|
6410
|
+
|
|
6411
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
6412
|
+
var map = new WeakMap();
|
|
6413
|
+
var getCompareDefault = (a) => a;
|
|
6414
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6415
|
+
map.set(fn, {
|
|
6416
|
+
lastCallTime: 0,
|
|
6417
|
+
lastCallArg: null
|
|
6418
|
+
});
|
|
6419
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6420
|
+
return (arg) => {
|
|
6421
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6422
|
+
lastCallTime: 0,
|
|
6423
|
+
lastCallArg: null
|
|
6424
|
+
};
|
|
6425
|
+
const now = Date.now();
|
|
6426
|
+
const diff = now - lastCallTime;
|
|
6427
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6428
|
+
if (diff < timeframe && objectsEqual) {
|
|
6429
|
+
return;
|
|
6430
|
+
}
|
|
6431
|
+
map.set(fn, {
|
|
6432
|
+
lastCallTime: now,
|
|
6433
|
+
lastCallArg: arg
|
|
6434
|
+
});
|
|
6435
|
+
fn(arg);
|
|
6436
|
+
};
|
|
6437
|
+
}
|
|
6073
6438
|
|
|
6074
6439
|
// src/components/DataSource/GroupRowsState.ts
|
|
6075
6440
|
var GroupRowsState = class {
|
|
@@ -6181,65 +6546,22 @@ var GroupRowsState = class {
|
|
|
6181
6546
|
}
|
|
6182
6547
|
};
|
|
6183
6548
|
|
|
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;
|
|
6549
|
+
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6550
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
6551
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
6552
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
6553
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
6554
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
6555
|
+
const prevResult = weakMap.get(sortInfo);
|
|
6556
|
+
if (prevResult && prevResult.length === result.length) {
|
|
6557
|
+
return prevResult;
|
|
6211
6558
|
}
|
|
6212
6559
|
}
|
|
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
|
-
}
|
|
6560
|
+
if (weakMap && sortInfo) {
|
|
6561
|
+
weakMap.set(sortInfo, result);
|
|
6562
|
+
}
|
|
6563
|
+
return result;
|
|
6564
|
+
};
|
|
6243
6565
|
|
|
6244
6566
|
// src/components/DataSource/state/getInitialState.ts
|
|
6245
6567
|
var defaultCursorId = Symbol("cursorId");
|
|
@@ -6249,6 +6571,7 @@ function initSetupState() {
|
|
|
6249
6571
|
const dataArray = [];
|
|
6250
6572
|
const originalLazyGroupData = new DeepMap();
|
|
6251
6573
|
return {
|
|
6574
|
+
lazyLoadCacheOfLoadedBatches: new DeepMap(),
|
|
6252
6575
|
dataParams: void 0,
|
|
6253
6576
|
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
6254
6577
|
notifyScrollStop: buildSubscriptionCallback(),
|
|
@@ -6299,6 +6622,9 @@ var forwardProps2 = (setupState) => {
|
|
|
6299
6622
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
6300
6623
|
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
6301
6624
|
groupRowsState: (groupRowsState) => {
|
|
6625
|
+
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
6626
|
+
groupRowsState = new GroupRowsState(groupRowsState);
|
|
6627
|
+
}
|
|
6302
6628
|
return groupRowsState || new GroupRowsState({
|
|
6303
6629
|
expandedRows: true,
|
|
6304
6630
|
collapsedRows: []
|
|
@@ -6466,7 +6792,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6466
6792
|
pivotIndex: -1,
|
|
6467
6793
|
valueGetter: ({ rowInfo }) => {
|
|
6468
6794
|
var _a;
|
|
6469
|
-
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
6795
|
+
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6470
6796
|
}
|
|
6471
6797
|
}));
|
|
6472
6798
|
});
|
|
@@ -6515,6 +6841,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6515
6841
|
header,
|
|
6516
6842
|
valueGetter: ({ rowInfo }) => {
|
|
6517
6843
|
var _a, _b;
|
|
6844
|
+
if (!rowInfo.isGroupRow) {
|
|
6845
|
+
return null;
|
|
6846
|
+
}
|
|
6518
6847
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
6519
6848
|
}
|
|
6520
6849
|
});
|
|
@@ -6537,7 +6866,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6537
6866
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
6538
6867
|
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
6539
6868
|
if (!isSingleAggregationColumn) {
|
|
6540
|
-
|
|
6869
|
+
const parentGroupForTotalsGroup = columnGroupId;
|
|
6541
6870
|
columnGroupId = `total:${keys.join("/")}`;
|
|
6542
6871
|
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
6543
6872
|
header: `${keys[keys.length - 1]} total`,
|
|
@@ -6567,6 +6896,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6567
6896
|
sortable: false,
|
|
6568
6897
|
valueGetter: ({ rowInfo }) => {
|
|
6569
6898
|
var _a, _b;
|
|
6899
|
+
if (!rowInfo.isGroupRow) {
|
|
6900
|
+
return null;
|
|
6901
|
+
}
|
|
6570
6902
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
6571
6903
|
}
|
|
6572
6904
|
});
|
|
@@ -6602,12 +6934,12 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
6602
6934
|
};
|
|
6603
6935
|
function toRowInfo(data, id, index) {
|
|
6604
6936
|
return {
|
|
6937
|
+
dataSourceHasGrouping: false,
|
|
6605
6938
|
data,
|
|
6606
|
-
collapsed: true,
|
|
6607
6939
|
id,
|
|
6608
6940
|
indexInAll: index,
|
|
6609
|
-
|
|
6610
|
-
|
|
6941
|
+
isGroupRow: false,
|
|
6942
|
+
selfLoaded: true
|
|
6611
6943
|
};
|
|
6612
6944
|
}
|
|
6613
6945
|
function concludeReducer(params) {
|
|
@@ -6635,7 +6967,7 @@ function concludeReducer(params) {
|
|
|
6635
6967
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
6636
6968
|
const groupBy = state.groupBy;
|
|
6637
6969
|
const pivotBy = state.pivotBy;
|
|
6638
|
-
const shouldGroup = groupBy.length || pivotBy;
|
|
6970
|
+
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
6639
6971
|
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
6640
6972
|
"generateGroupRows",
|
|
6641
6973
|
"originalDataArray",
|
|
@@ -6660,12 +6992,8 @@ function concludeReducer(params) {
|
|
|
6660
6992
|
state.sortedAt = now;
|
|
6661
6993
|
}
|
|
6662
6994
|
state.postSortDataArray = dataArray;
|
|
6663
|
-
state.groupDeepMap = void 0;
|
|
6664
6995
|
const toPrimaryKey = (data) => {
|
|
6665
6996
|
const pk = data[state.primaryKey];
|
|
6666
|
-
if (Array.isArray(pk)) {
|
|
6667
|
-
debugger;
|
|
6668
|
-
}
|
|
6669
6997
|
return pk;
|
|
6670
6998
|
};
|
|
6671
6999
|
if (shouldGroup) {
|
|
@@ -6682,6 +7010,7 @@ function concludeReducer(params) {
|
|
|
6682
7010
|
}, dataArray);
|
|
6683
7011
|
const flattenResult = enhancedFlatten({
|
|
6684
7012
|
groupResult,
|
|
7013
|
+
lazyLoad: !!state.lazyLoad,
|
|
6685
7014
|
reducers: state.aggregationReducers,
|
|
6686
7015
|
toPrimaryKey,
|
|
6687
7016
|
groupRowsState: state.groupRowsState,
|
|
@@ -6737,7 +7066,7 @@ function DataSourceWithContext(props) {
|
|
|
6737
7066
|
if (typeof children === "function") {
|
|
6738
7067
|
children = children(computedValues);
|
|
6739
7068
|
}
|
|
6740
|
-
return /* @__PURE__ */
|
|
7069
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, children);
|
|
6741
7070
|
}
|
|
6742
7071
|
var DataSourceRoot = getComponentStateRoot({
|
|
6743
7072
|
initSetupState,
|
|
@@ -6760,14 +7089,14 @@ function DataSourceCmp({ children }) {
|
|
|
6760
7089
|
globalThis.getDataSourceState = getState;
|
|
6761
7090
|
}
|
|
6762
7091
|
useLoadData();
|
|
6763
|
-
return /* @__PURE__ */
|
|
7092
|
+
return /* @__PURE__ */ React26.createElement(DataSourceContext.Provider, {
|
|
6764
7093
|
value: contextValue
|
|
6765
|
-
}, /* @__PURE__ */
|
|
7094
|
+
}, /* @__PURE__ */ React26.createElement(DataSourceWithContext, {
|
|
6766
7095
|
children
|
|
6767
7096
|
}));
|
|
6768
7097
|
}
|
|
6769
7098
|
function DataSource(props) {
|
|
6770
|
-
return /* @__PURE__ */
|
|
7099
|
+
return /* @__PURE__ */ React26.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React26.createElement(DataSourceCmp, {
|
|
6771
7100
|
children: props.children
|
|
6772
7101
|
}));
|
|
6773
7102
|
}
|
|
@@ -6780,10 +7109,26 @@ function useToggleGroupRow() {
|
|
|
6780
7109
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
6781
7110
|
newState.toggleGroupRow(groupKeys);
|
|
6782
7111
|
dataSourceActions.groupRowsState = newState;
|
|
6783
|
-
if (state.lazyLoad
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
7112
|
+
if (state.lazyLoad) {
|
|
7113
|
+
const dataKeys = [LAZY_ROOT_KEY_FOR_GROUPS, ...groupKeys];
|
|
7114
|
+
const currentData = state.originalLazyGroupData.get(dataKeys);
|
|
7115
|
+
if (newState.isGroupRowExpanded(groupKeys)) {
|
|
7116
|
+
if (!(currentData == null ? void 0 : currentData.cache)) {
|
|
7117
|
+
loadData(state.data, state, dataSourceActions, {
|
|
7118
|
+
groupKeys
|
|
7119
|
+
});
|
|
7120
|
+
}
|
|
7121
|
+
} else {
|
|
7122
|
+
if (!(currentData == null ? void 0 : currentData.cache)) {
|
|
7123
|
+
const keysToDelete = state.lazyLoadCacheOfLoadedBatches.getKeysStartingWith(groupKeys);
|
|
7124
|
+
keysToDelete.forEach((keys) => {
|
|
7125
|
+
state.lazyLoadCacheOfLoadedBatches.delete(keys);
|
|
7126
|
+
});
|
|
7127
|
+
dataSourceActions.lazyLoadCacheOfLoadedBatches = DeepMap.clone(state.lazyLoadCacheOfLoadedBatches);
|
|
7128
|
+
state.originalLazyGroupData.delete(dataKeys);
|
|
7129
|
+
dataSourceActions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
7130
|
+
}
|
|
7131
|
+
}
|
|
6787
7132
|
}
|
|
6788
7133
|
}, []);
|
|
6789
7134
|
return toggleGroupRow;
|
|
@@ -6853,12 +7198,18 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
6853
7198
|
field,
|
|
6854
7199
|
valueGetter: ({ rowInfo }) => {
|
|
6855
7200
|
var _a;
|
|
6856
|
-
return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
|
|
7201
|
+
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
6857
7202
|
},
|
|
6858
7203
|
rowspan: ({ rowInfo, dataArray }) => {
|
|
7204
|
+
if (!rowInfo.isGroupRow) {
|
|
7205
|
+
return 1;
|
|
7206
|
+
}
|
|
6859
7207
|
const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
|
|
6860
7208
|
indexInParentGroups: []
|
|
6861
7209
|
};
|
|
7210
|
+
if (!prevRowInfo || !prevRowInfo.dataSourceHasGrouping) {
|
|
7211
|
+
return 1;
|
|
7212
|
+
}
|
|
6862
7213
|
const prevIndexes = prevRowInfo.indexInParentGroups || [];
|
|
6863
7214
|
const currentIndexes = rowInfo.indexInParentGroups || [];
|
|
6864
7215
|
let computeSpan = false;
|
|
@@ -7011,8 +7362,11 @@ function useHideColumns(groupByMap) {
|
|
|
7011
7362
|
let expandedGroupsLevel = 0;
|
|
7012
7363
|
const len = dataArray.length;
|
|
7013
7364
|
for (let i = 0; i < len; i++) {
|
|
7014
|
-
const
|
|
7015
|
-
|
|
7365
|
+
const rowInfo = dataArray[i];
|
|
7366
|
+
if (!rowInfo.isGroupRow) {
|
|
7367
|
+
continue;
|
|
7368
|
+
}
|
|
7369
|
+
expandedGroupsLevel = Math.max(expandedGroupsLevel, rowInfo.groupNesting - 1);
|
|
7016
7370
|
if (expandedGroupsLevel === groupsLength - 1) {
|
|
7017
7371
|
break;
|
|
7018
7372
|
}
|
|
@@ -7339,22 +7693,6 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
7339
7693
|
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
|
|
7340
7694
|
}
|
|
7341
7695
|
|
|
7342
|
-
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
7343
|
-
function assignFiltered(filterFn, target, ...rest) {
|
|
7344
|
-
let result = target;
|
|
7345
|
-
rest.forEach((obj) => {
|
|
7346
|
-
for (const key in obj) {
|
|
7347
|
-
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
7348
|
-
result[key] = obj[key];
|
|
7349
|
-
}
|
|
7350
|
-
}
|
|
7351
|
-
});
|
|
7352
|
-
return result;
|
|
7353
|
-
}
|
|
7354
|
-
function assignNonNull(target, ...rest) {
|
|
7355
|
-
return assignFiltered((value) => value != null, target, ...rest);
|
|
7356
|
-
}
|
|
7357
|
-
|
|
7358
7696
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
7359
7697
|
var logError = err("getComputedVisibleColumns");
|
|
7360
7698
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
@@ -8121,7 +8459,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
8121
8459
|
const valid = (0, import_react39.useMemo)(() => {
|
|
8122
8460
|
let valid2 = isValidLicense(licenseKey, {
|
|
8123
8461
|
publishedAt: 1624970570587,
|
|
8124
|
-
version: "0.3.
|
|
8462
|
+
version: "0.3.2"
|
|
8125
8463
|
});
|
|
8126
8464
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8127
8465
|
return true;
|
|
@@ -8346,7 +8684,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
8346
8684
|
getParentState: () => useDataSource(),
|
|
8347
8685
|
debugName: "InfiniteTable"
|
|
8348
8686
|
});
|
|
8349
|
-
var InfiniteTableComponent =
|
|
8687
|
+
var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
|
|
8350
8688
|
var _a;
|
|
8351
8689
|
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
8352
8690
|
const {
|
|
@@ -8379,7 +8717,7 @@ var InfiniteTableComponent = React26.memo(function InfiniteTableComponent2() {
|
|
|
8379
8717
|
bodySize,
|
|
8380
8718
|
computed
|
|
8381
8719
|
});
|
|
8382
|
-
|
|
8720
|
+
React27.useEffect(() => {
|
|
8383
8721
|
const dataSourceState = getDataSourceState();
|
|
8384
8722
|
const onChange = debounce((renderRange) => {
|
|
8385
8723
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -8392,32 +8730,32 @@ var InfiniteTableComponent = React26.memo(function InfiniteTableComponent2() {
|
|
|
8392
8730
|
const licenseValid = useLicense(licenseKey);
|
|
8393
8731
|
const domProps = useDOMProps(componentState.domProps);
|
|
8394
8732
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
8395
|
-
|
|
8733
|
+
React27.useEffect(() => {
|
|
8396
8734
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
8397
8735
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8398
8736
|
}, [scrollStopDelay]);
|
|
8399
8737
|
useAutoSizeColumns();
|
|
8400
|
-
return /* @__PURE__ */
|
|
8738
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadValues({
|
|
8401
8739
|
ref: domRef
|
|
8402
|
-
}, domProps), header ? /* @__PURE__ */
|
|
8740
|
+
}, domProps), header ? /* @__PURE__ */ React27.createElement(TableHeaderWrapper, {
|
|
8403
8741
|
brain: headerBrain,
|
|
8404
8742
|
scrollbars
|
|
8405
|
-
}) : null, /* @__PURE__ */
|
|
8743
|
+
}) : null, /* @__PURE__ */ React27.createElement(InfiniteTableBody, null, /* @__PURE__ */ React27.createElement(HeadlessTable, {
|
|
8406
8744
|
tabIndex: 0,
|
|
8407
8745
|
scrollStopDelay,
|
|
8408
8746
|
brain,
|
|
8409
8747
|
renderCell,
|
|
8410
8748
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8411
8749
|
scrollerDOMRef
|
|
8412
|
-
}), /* @__PURE__ */
|
|
8750
|
+
}), /* @__PURE__ */ React27.createElement(LoadMaskCmp, {
|
|
8413
8751
|
visible: loading
|
|
8414
|
-
}, loadingText)), licenseValid ? null : /* @__PURE__ */
|
|
8752
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ React27.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React27.createElement("div", {
|
|
8415
8753
|
ref: portalDOMRef,
|
|
8416
8754
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8417
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
8755
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
|
|
8418
8756
|
varName: rowHeightCSSVar,
|
|
8419
8757
|
onChange: onRowHeightCSSVarChange
|
|
8420
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
8758
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
|
|
8421
8759
|
varName: headerHeightCSSVar,
|
|
8422
8760
|
onChange: onHeaderHeightCSSVarChange
|
|
8423
8761
|
}) : null);
|
|
@@ -8448,25 +8786,25 @@ function InfiniteTableContextProvider() {
|
|
|
8448
8786
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
8449
8787
|
componentActions.bodySize = bodySize;
|
|
8450
8788
|
}, { earlyAttach: true });
|
|
8451
|
-
|
|
8789
|
+
React27.useEffect(() => {
|
|
8452
8790
|
return () => {
|
|
8453
8791
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
8454
8792
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
8455
8793
|
};
|
|
8456
8794
|
}, []);
|
|
8457
|
-
|
|
8795
|
+
React27.useEffect(() => {
|
|
8458
8796
|
if (scrollerDOMRef.current) {
|
|
8459
8797
|
scrollerDOMRef.current.scrollTop = 0;
|
|
8460
8798
|
}
|
|
8461
8799
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8462
8800
|
const TableContext2 = getInfiniteTableContext();
|
|
8463
|
-
return /* @__PURE__ */
|
|
8801
|
+
return /* @__PURE__ */ React27.createElement(TableContext2.Provider, {
|
|
8464
8802
|
value: contextValue
|
|
8465
|
-
}, /* @__PURE__ */
|
|
8803
|
+
}, /* @__PURE__ */ React27.createElement(InfiniteTableComponent, null));
|
|
8466
8804
|
}
|
|
8467
8805
|
function InfiniteTable(props) {
|
|
8468
|
-
const table = /* @__PURE__ */
|
|
8469
|
-
return /* @__PURE__ */
|
|
8806
|
+
const table = /* @__PURE__ */ React27.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React27.createElement(InfiniteTableContextProvider, null));
|
|
8807
|
+
return /* @__PURE__ */ React27.createElement(React27.StrictMode, null, table);
|
|
8470
8808
|
}
|
|
8471
8809
|
InfiniteTable.defaultProps = {
|
|
8472
8810
|
rowHeight: 40,
|