@infinite-table/infinite-react 0.4.0 → 0.4.3
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/README.md +1 -1
- package/index.css +81 -64
- package/index.d.ts +290 -185
- package/index.esm.css +81 -64
- package/index.esm.js +1480 -951
- package/index.js +1486 -958
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -668,7 +668,6 @@ function debounce(fn, { wait }) {
|
|
|
668
668
|
|
|
669
669
|
// src/components/InfiniteTable/index.tsx
|
|
670
670
|
var React38 = __toModule(require("react"));
|
|
671
|
-
var import_react49 = __toModule(require("react"));
|
|
672
671
|
|
|
673
672
|
// src/utils/join.ts
|
|
674
673
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -1012,32 +1011,33 @@ var AvoidReactDiff = React7.memo(AvoidReactDiffFn);
|
|
|
1012
1011
|
|
|
1013
1012
|
// src/components/utils/buildSubscriptionCallback.tsx
|
|
1014
1013
|
function buildSubscriptionCallback(withRaf = false) {
|
|
1015
|
-
let
|
|
1014
|
+
let lastCallValue = null;
|
|
1016
1015
|
let fns = [];
|
|
1017
1016
|
let rafId = null;
|
|
1018
1017
|
const updater = (items, callback) => {
|
|
1018
|
+
const results = [];
|
|
1019
1019
|
if (withRaf) {
|
|
1020
1020
|
if (rafId != null) {
|
|
1021
1021
|
cancelAnimationFrame(rafId);
|
|
1022
1022
|
rafId = null;
|
|
1023
1023
|
}
|
|
1024
1024
|
requestAnimationFrame(() => {
|
|
1025
|
-
|
|
1025
|
+
lastCallValue = items;
|
|
1026
1026
|
rafId = null;
|
|
1027
1027
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1028
|
-
fns[i](items);
|
|
1028
|
+
results.push(fns[i](items));
|
|
1029
1029
|
}
|
|
1030
|
-
callback == null ? void 0 : callback();
|
|
1030
|
+
callback == null ? void 0 : callback(results);
|
|
1031
1031
|
});
|
|
1032
1032
|
} else {
|
|
1033
|
-
|
|
1033
|
+
lastCallValue = items;
|
|
1034
1034
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1035
|
-
fns[i](items);
|
|
1035
|
+
results.push(fns[i](items));
|
|
1036
1036
|
}
|
|
1037
|
-
callback == null ? void 0 : callback();
|
|
1037
|
+
callback == null ? void 0 : callback(results);
|
|
1038
1038
|
}
|
|
1039
1039
|
};
|
|
1040
|
-
updater.get = () =>
|
|
1040
|
+
updater.get = () => lastCallValue;
|
|
1041
1041
|
updater.onChange = (fn) => {
|
|
1042
1042
|
fns.push(fn);
|
|
1043
1043
|
return () => {
|
|
@@ -1048,6 +1048,7 @@ function buildSubscriptionCallback(withRaf = false) {
|
|
|
1048
1048
|
updater(null);
|
|
1049
1049
|
fns.length = 0;
|
|
1050
1050
|
};
|
|
1051
|
+
updater.getListenersCount = () => fns.length;
|
|
1051
1052
|
return updater;
|
|
1052
1053
|
}
|
|
1053
1054
|
|
|
@@ -2239,13 +2240,19 @@ var DeepMap = class {
|
|
|
2239
2240
|
this.visitDepthFirst = (fn) => {
|
|
2240
2241
|
this.visitWithNext([], fn);
|
|
2241
2242
|
};
|
|
2242
|
-
this.visitWithNext = (parentKeys, fn, currentMap = this.map) => {
|
|
2243
|
+
this.visitWithNext = (parentKeys, fn, currentMap = this.map, depthLimit, skipSelfValue) => {
|
|
2243
2244
|
if (!currentMap) {
|
|
2244
2245
|
return;
|
|
2245
2246
|
}
|
|
2246
2247
|
let i = 0;
|
|
2247
2248
|
const hasEmptyKey = currentMap.has(this.emptyKey);
|
|
2248
|
-
let allowEmptyKey = true;
|
|
2249
|
+
let allowEmptyKey = skipSelfValue ? false : true;
|
|
2250
|
+
if (depthLimit !== void 0) {
|
|
2251
|
+
if (depthLimit < 0) {
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
depthLimit--;
|
|
2255
|
+
}
|
|
2249
2256
|
const iterator = (_, key) => {
|
|
2250
2257
|
const pair = currentMap.get(key);
|
|
2251
2258
|
if (!pair) {
|
|
@@ -2257,7 +2264,7 @@ var DeepMap = class {
|
|
|
2257
2264
|
return;
|
|
2258
2265
|
}
|
|
2259
2266
|
const keys = isEmptyKey ? [] : [...parentKeys, key];
|
|
2260
|
-
|
|
2267
|
+
let next = map2 ? () => this.visitWithNext(keys, fn, map2, depthLimit !== void 0 ? depthLimit - 1 : void 0) : void 0;
|
|
2261
2268
|
if (pair.hasOwnProperty("value")) {
|
|
2262
2269
|
fn(pair.value, keys, i, next);
|
|
2263
2270
|
i++;
|
|
@@ -2289,41 +2296,84 @@ var DeepMap = class {
|
|
|
2289
2296
|
});
|
|
2290
2297
|
}
|
|
2291
2298
|
}
|
|
2292
|
-
getValuesStartingWith(keys) {
|
|
2299
|
+
getValuesStartingWith(keys, excludeSelf, depthLimit) {
|
|
2293
2300
|
const result = [];
|
|
2294
2301
|
this.getStartingWith(keys, (_keys, value) => {
|
|
2295
2302
|
result.push(value);
|
|
2296
|
-
});
|
|
2303
|
+
}, excludeSelf, depthLimit);
|
|
2297
2304
|
return result;
|
|
2298
2305
|
}
|
|
2299
|
-
getKeysStartingWith(keys) {
|
|
2306
|
+
getKeysStartingWith(keys, excludeSelf, depthLimit) {
|
|
2300
2307
|
const result = [];
|
|
2301
2308
|
this.getStartingWith(keys, (keys2) => {
|
|
2302
2309
|
result.push(keys2);
|
|
2303
|
-
});
|
|
2310
|
+
}, excludeSelf, depthLimit);
|
|
2304
2311
|
return result;
|
|
2305
2312
|
}
|
|
2306
|
-
getStartingWith(keys, fn) {
|
|
2313
|
+
getStartingWith(keys, fn, excludeSelf, depthLimit) {
|
|
2314
|
+
let currentMap = this.map;
|
|
2315
|
+
let pair;
|
|
2316
|
+
let stop = false;
|
|
2317
|
+
if (keys.length) {
|
|
2318
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2319
|
+
const key = keys[i];
|
|
2320
|
+
pair = currentMap.get(key);
|
|
2321
|
+
if (!pair || !pair.map) {
|
|
2322
|
+
stop = true;
|
|
2323
|
+
if (i === len - 1) {
|
|
2324
|
+
stop = true;
|
|
2325
|
+
break;
|
|
2326
|
+
} else {
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
currentMap = pair.map;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
if (pair && pair.value !== void 0) {
|
|
2334
|
+
if (!excludeSelf) {
|
|
2335
|
+
fn(keys, pair.value);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
if (stop) {
|
|
2339
|
+
return;
|
|
2340
|
+
}
|
|
2341
|
+
this.visitWithNext(keys, (value, keys2, _i, next) => {
|
|
2342
|
+
fn(keys2, value);
|
|
2343
|
+
next == null ? void 0 : next();
|
|
2344
|
+
}, currentMap, depthLimit, excludeSelf);
|
|
2345
|
+
}
|
|
2346
|
+
getMapAt(keys) {
|
|
2307
2347
|
let currentMap = this.map;
|
|
2308
2348
|
let pair;
|
|
2309
2349
|
if (!keys.length) {
|
|
2310
|
-
|
|
2350
|
+
return this.map;
|
|
2311
2351
|
}
|
|
2312
2352
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2313
2353
|
const key = keys[i];
|
|
2314
2354
|
pair = currentMap.get(key);
|
|
2315
2355
|
if (!pair || !pair.map) {
|
|
2316
|
-
return;
|
|
2356
|
+
return void 0;
|
|
2317
2357
|
}
|
|
2318
2358
|
currentMap = pair.map;
|
|
2319
2359
|
}
|
|
2320
|
-
|
|
2321
|
-
|
|
2360
|
+
return currentMap;
|
|
2361
|
+
}
|
|
2362
|
+
getAllChildrenSizeFor(keys) {
|
|
2363
|
+
let currentMap = this.map;
|
|
2364
|
+
let pair;
|
|
2365
|
+
if (!keys.length) {
|
|
2366
|
+
return this.length;
|
|
2322
2367
|
}
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2368
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2369
|
+
const key = keys[i];
|
|
2370
|
+
pair = currentMap.get(key);
|
|
2371
|
+
if (!pair || !pair.map) {
|
|
2372
|
+
return 0;
|
|
2373
|
+
}
|
|
2374
|
+
currentMap = pair.map;
|
|
2375
|
+
}
|
|
2376
|
+
return pair.length;
|
|
2327
2377
|
}
|
|
2328
2378
|
getDirectChildrenSizeFor(keys) {
|
|
2329
2379
|
var _a;
|
|
@@ -2353,7 +2403,9 @@ var DeepMap = class {
|
|
|
2353
2403
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2354
2404
|
const key = keys[i];
|
|
2355
2405
|
const last = i === len - 1;
|
|
2356
|
-
const pair = currentMap.get(key) || {
|
|
2406
|
+
const pair = currentMap.get(key) || {
|
|
2407
|
+
length: 0
|
|
2408
|
+
};
|
|
2357
2409
|
if (last) {
|
|
2358
2410
|
pair.revision = this.revision++;
|
|
2359
2411
|
pair.value = value;
|
|
@@ -2364,6 +2416,7 @@ var DeepMap = class {
|
|
|
2364
2416
|
pair.map = new Map();
|
|
2365
2417
|
currentMap.set(key, pair);
|
|
2366
2418
|
}
|
|
2419
|
+
pair.length++;
|
|
2367
2420
|
currentMap = pair.map;
|
|
2368
2421
|
}
|
|
2369
2422
|
}
|
|
@@ -2414,6 +2467,7 @@ var DeepMap = class {
|
|
|
2414
2467
|
keys = [...keys];
|
|
2415
2468
|
}
|
|
2416
2469
|
const maps = [currentMap];
|
|
2470
|
+
const pairs = [];
|
|
2417
2471
|
let result = false;
|
|
2418
2472
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2419
2473
|
const key = keys[i];
|
|
@@ -2425,6 +2479,9 @@ var DeepMap = class {
|
|
|
2425
2479
|
delete pair.value;
|
|
2426
2480
|
delete pair.revision;
|
|
2427
2481
|
result = true;
|
|
2482
|
+
pairs.forEach((pair2) => {
|
|
2483
|
+
pair2.length--;
|
|
2484
|
+
});
|
|
2428
2485
|
this.length--;
|
|
2429
2486
|
}
|
|
2430
2487
|
if (pair.map && pair.map.size === 0) {
|
|
@@ -2440,6 +2497,7 @@ var DeepMap = class {
|
|
|
2440
2497
|
result = false;
|
|
2441
2498
|
break;
|
|
2442
2499
|
}
|
|
2500
|
+
pairs.push(pair);
|
|
2443
2501
|
currentMap = pair.map;
|
|
2444
2502
|
maps.push(currentMap);
|
|
2445
2503
|
}
|
|
@@ -2513,6 +2571,19 @@ var DeepMap = class {
|
|
|
2513
2571
|
});
|
|
2514
2572
|
return result;
|
|
2515
2573
|
}
|
|
2574
|
+
valuesAt(keys) {
|
|
2575
|
+
const map2 = this.getMapAt(keys);
|
|
2576
|
+
if (!map2) {
|
|
2577
|
+
return [];
|
|
2578
|
+
}
|
|
2579
|
+
const result = [];
|
|
2580
|
+
map2.forEach((bag) => {
|
|
2581
|
+
if (bag.value !== void 0) {
|
|
2582
|
+
result.push(bag.value);
|
|
2583
|
+
}
|
|
2584
|
+
});
|
|
2585
|
+
return result;
|
|
2586
|
+
}
|
|
2516
2587
|
values() {
|
|
2517
2588
|
return this.sortedIterator((pair) => pair.value);
|
|
2518
2589
|
}
|
|
@@ -3581,11 +3652,11 @@ var useRerender = () => {
|
|
|
3581
3652
|
};
|
|
3582
3653
|
|
|
3583
3654
|
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3584
|
-
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1
|
|
3585
|
-
var ActiveIndicatorWrapperCls = "
|
|
3655
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwg _16lm1iw3 _16lm1iw15 _16lm1iw13", hidden: "nxbq1c3 nxbq1c1 _16lm1iwg _16lm1iw3 _16lm1iw15 _16lm1iw13" };
|
|
3656
|
+
var ActiveIndicatorWrapperCls = "_16lm1iwg _16lm1iw3 _16lm1iw15 _16lm1iw13 _16lm1iwz _16lm1iwp";
|
|
3586
3657
|
|
|
3587
3658
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3588
|
-
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0
|
|
3659
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwg _16lm1iw3 _16lm1iw12 _16lm1iw13 _16lm1iw15", hidden: "j26lrx2 j26lrx0 _16lm1iwg _16lm1iw3 _16lm1iw12 _16lm1iw13 _16lm1iw15" };
|
|
3589
3660
|
|
|
3590
3661
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3591
3662
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
@@ -3862,10 +3933,10 @@ var usePrevious = (value, initialValue) => {
|
|
|
3862
3933
|
};
|
|
3863
3934
|
|
|
3864
3935
|
// src/components/hooks/useComponentState/index.tsx
|
|
3865
|
-
var notifyChange = (props, callbackPropName,
|
|
3936
|
+
var notifyChange = (props, callbackPropName, values) => {
|
|
3866
3937
|
const callbackProp = props[callbackPropName];
|
|
3867
3938
|
if (typeof callbackProp === "function") {
|
|
3868
|
-
callbackProp(
|
|
3939
|
+
callbackProp(...values);
|
|
3869
3940
|
}
|
|
3870
3941
|
};
|
|
3871
3942
|
var debug3 = dbg("rerender");
|
|
@@ -3894,14 +3965,14 @@ function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward
|
|
|
3894
3965
|
}
|
|
3895
3966
|
}
|
|
3896
3967
|
if (notifyTheChange) {
|
|
3897
|
-
let
|
|
3968
|
+
let callbackParams = [value];
|
|
3898
3969
|
let callbackName = `on${toUpperFirst(stateKey)}Change`;
|
|
3899
3970
|
if (mappedCallbacks && mappedCallbacks[key]) {
|
|
3900
3971
|
const res = mappedCallbacks[key](value, state2);
|
|
3901
3972
|
callbackName = res.callbackName || callbackName;
|
|
3902
|
-
|
|
3973
|
+
callbackParams = res.callbackParams;
|
|
3903
3974
|
}
|
|
3904
|
-
notifyChange(props, callbackName,
|
|
3975
|
+
notifyChange(props, callbackName, callbackParams);
|
|
3905
3976
|
}
|
|
3906
3977
|
const forwardFn = propsToForward[key];
|
|
3907
3978
|
if (typeof forwardFn === "function") {
|
|
@@ -4115,20 +4186,20 @@ var useInternalProps = () => {
|
|
|
4115
4186
|
};
|
|
4116
4187
|
|
|
4117
4188
|
// src/components/InfiniteTable/utilities.css.ts
|
|
4118
|
-
var alignItems = { center: "
|
|
4119
|
-
var cssEllipsisClassName = "
|
|
4120
|
-
var cursor = { pointer: "
|
|
4121
|
-
var display = { flex: "
|
|
4122
|
-
var flex = { "1": "
|
|
4123
|
-
var flexFlow = { column: "
|
|
4124
|
-
var justifyContent = { center: "
|
|
4125
|
-
var left = { "0": "
|
|
4126
|
-
var overflow = { hidden: "
|
|
4189
|
+
var alignItems = { center: "_16lm1iw1h", stretch: "_16lm1iw1i" };
|
|
4190
|
+
var cssEllipsisClassName = "_16lm1iw1s _16lm1iw1t _16lm1iw1m";
|
|
4191
|
+
var cursor = { pointer: "_16lm1iwe", colResize: "_16lm1iwf" };
|
|
4192
|
+
var display = { flex: "_16lm1iwu", none: "_16lm1iwv", block: "_16lm1iww", inlineBlock: "_16lm1iwx" };
|
|
4193
|
+
var flex = { "1": "_16lm1iwh", none: "_16lm1iwi" };
|
|
4194
|
+
var flexFlow = { column: "_16lm1iw1d", columnReverse: "_16lm1iw1e", row: "_16lm1iw1f", rowReverse: "_16lm1iw1g" };
|
|
4195
|
+
var justifyContent = { center: "_16lm1iw1j", start: "_16lm1iw1k", end: "_16lm1iw1l" };
|
|
4196
|
+
var left = { "0": "_16lm1iw15", "100%": "_16lm1iw16", auto: "_16lm1iw17" };
|
|
4197
|
+
var overflow = { hidden: "_16lm1iw1m", auto: "_16lm1iw1n", visible: "_16lm1iw1o" };
|
|
4127
4198
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
4128
|
-
var top = { "0": "
|
|
4199
|
+
var top = { "0": "_16lm1iw13", "100%": "_16lm1iw14" };
|
|
4129
4200
|
var transformTranslateZero = "_16lm1iwa";
|
|
4130
|
-
var userSelect = { none: "
|
|
4131
|
-
var zIndex = { "1": "
|
|
4201
|
+
var userSelect = { none: "_16lm1iwy" };
|
|
4202
|
+
var zIndex = { "1": "_16lm1iwj", "10": "_16lm1iwk", "100": "_16lm1iwl", "1000": "_16lm1iwm", "10000": "_16lm1iwn", "100000": "_16lm1iwo", "1000000": "_16lm1iwp", "10000000": "_16lm1iwq", "1k": "_16lm1iwr", "10k": "_16lm1iws", "100k": "_16lm1iwt" };
|
|
4132
4203
|
|
|
4133
4204
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
4134
4205
|
var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
@@ -4217,6 +4288,7 @@ var defaultFilterTypes = getFilterTypes();
|
|
|
4217
4288
|
|
|
4218
4289
|
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
4219
4290
|
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
4291
|
+
var _a;
|
|
4220
4292
|
const result = [...baseClasses];
|
|
4221
4293
|
const variantObject = {
|
|
4222
4294
|
filtered: column.computedFiltered,
|
|
@@ -4226,7 +4298,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4226
4298
|
firstInCategory: column.computedFirstInCategory,
|
|
4227
4299
|
lastInCategory: column.computedLastInCategory,
|
|
4228
4300
|
pinned: column.computedPinned || false,
|
|
4229
|
-
rowSelected: extraFlags.rowSelected,
|
|
4301
|
+
rowSelected: (_a = extraFlags.rowSelected) != null ? _a : "null",
|
|
4230
4302
|
rowActive: extraFlags.rowActive,
|
|
4231
4303
|
dragging: extraFlags.dragging,
|
|
4232
4304
|
zebra: extraFlags.zebra
|
|
@@ -4281,14 +4353,14 @@ var useInfiniteTable = () => {
|
|
|
4281
4353
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4282
4354
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4283
4355
|
var FooterCls = "_16lm1iw1";
|
|
4284
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4356
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwu _16lm1iw1d _16lm1iw0";
|
|
4285
4357
|
var InfiniteClsHasPinnedEnd = "_1yeub2vo";
|
|
4286
4358
|
var InfiniteClsHasPinnedStart = "_1yeub2vn";
|
|
4287
4359
|
var InfiniteClsRecipe = (0, import_createRuntimeFn.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: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
|
|
4288
4360
|
var InfiniteClsShiftingColumns = "_1yeub2vl";
|
|
4289
|
-
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2
|
|
4361
|
+
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw13 _16lm1iwf _16lm1iwy _16lm1iw11 _16lm1iw1q _16lm1iwg _16lm1iwq";
|
|
4290
4362
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4291
|
-
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2
|
|
4363
|
+
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw13 _16lm1iwf _16lm1iwy _16lm1iw11 _16lm1iw1q _16lm1iwg _16lm1iwq";
|
|
4292
4364
|
|
|
4293
4365
|
// src/components/utils/getScrollbarWidth.ts
|
|
4294
4366
|
var scrollbarWidth;
|
|
@@ -4866,6 +4938,9 @@ var useColumnPointerEvents = ({
|
|
|
4866
4938
|
} = useInfiniteTable();
|
|
4867
4939
|
const onPointerDown = (0, import_react16.useCallback)((e) => {
|
|
4868
4940
|
var _a2;
|
|
4941
|
+
if (e.target.tagName === "INPUT") {
|
|
4942
|
+
return;
|
|
4943
|
+
}
|
|
4869
4944
|
const {
|
|
4870
4945
|
computedVisibleColumns,
|
|
4871
4946
|
computedVisibleColumnsMap,
|
|
@@ -4874,6 +4949,9 @@ var useColumnPointerEvents = ({
|
|
|
4874
4949
|
computedPinnedEndColumns
|
|
4875
4950
|
} = getComputed();
|
|
4876
4951
|
const dragColumn = computedVisibleColumnsMap.get(columnId);
|
|
4952
|
+
if (!dragColumn.computedDraggable) {
|
|
4953
|
+
return;
|
|
4954
|
+
}
|
|
4877
4955
|
const target = domRef.current;
|
|
4878
4956
|
const targetRect = target.getBoundingClientRect();
|
|
4879
4957
|
const tableRect = rootRef.current.getBoundingClientRect();
|
|
@@ -4991,8 +5069,8 @@ function objectValuesExcept(obj, exceptList) {
|
|
|
4991
5069
|
|
|
4992
5070
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4993
5071
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4994
|
-
var ColumnCellCls = "_1eexc2a6 _1eexc2a5
|
|
4995
|
-
var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a8", variantClassNames: { dragging: { false: "_1eexc2a9", true: "_1eexc2aa" }, rowActive: { false: "_1eexc2ab", true: "_1eexc2ac" }, zebra: { false: "_1eexc2ad", even: "_1eexc2ae", odd: "_1eexc2af" }, rowSelected: { true: "_1eexc2ag", false: "_1eexc2ah" }, first: { true: "
|
|
5072
|
+
var ColumnCellCls = "_1eexc2a6 _1eexc2a5 _16lm1iwu _16lm1iw1f _16lm1iw1h _16lm1iw2 _16lm1iw1r _16lm1iw1s _16lm1iwy";
|
|
5073
|
+
var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a8", variantClassNames: { dragging: { false: "_1eexc2a9", true: "_1eexc2aa" }, rowActive: { false: "_1eexc2ab", true: "_1eexc2ac" }, zebra: { false: "_1eexc2ad", even: "_1eexc2ae", odd: "_1eexc2af" }, rowSelected: { true: "_1eexc2ag", false: "_1eexc2ah", null: "_1eexc2ai" }, first: { true: "_1eexc2aj", false: "_1eexc2ak" }, last: { true: "_1eexc2al", false: "_1eexc2am" }, groupByField: { true: "_1eexc2an", false: "_1eexc2ao" }, firstInCategory: { true: "_1eexc2ap", false: "_1eexc2aq" }, lastInCategory: { true: "_1eexc2ar", false: "_1eexc2as" }, pinned: { start: "_1eexc2at", end: "_1eexc2au", false: "_1eexc2av" }, filtered: { true: "_1eexc2aw", false: "_1eexc2ax" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2ay"], [{ pinned: "start", firstInCategory: true }, "_1eexc2az"], [{ pinned: "end", firstInCategory: true }, "_1eexc2a10"], [{ pinned: "end", lastInCategory: true }, "_1eexc2a11"]] });
|
|
4996
5074
|
var SelectionCheckboxCls = "_1eexc2a7";
|
|
4997
5075
|
|
|
4998
5076
|
// src/components/InfiniteTable/components/CheckBox.tsx
|
|
@@ -5000,7 +5078,7 @@ var React16 = __toModule(require("react"));
|
|
|
5000
5078
|
var import_react17 = __toModule(require("react"));
|
|
5001
5079
|
|
|
5002
5080
|
// src/components/InfiniteTable/components/CheckBox.css.ts
|
|
5003
|
-
var CheckBoxCls = "
|
|
5081
|
+
var CheckBoxCls = "_16lm1iwe";
|
|
5004
5082
|
|
|
5005
5083
|
// src/components/InfiniteTable/components/CheckBox.tsx
|
|
5006
5084
|
function forwardProps2() {
|
|
@@ -5015,7 +5093,7 @@ var InfiniteCheckBoxRoot = getComponentStateRoot({
|
|
|
5015
5093
|
checked: (checked) => {
|
|
5016
5094
|
return {
|
|
5017
5095
|
callbackName: "onChange",
|
|
5018
|
-
|
|
5096
|
+
callbackParams: [checked]
|
|
5019
5097
|
};
|
|
5020
5098
|
}
|
|
5021
5099
|
},
|
|
@@ -5136,7 +5214,7 @@ var defaultRenderSelectionCheckBox = (params) => {
|
|
|
5136
5214
|
deselectCurrentRow();
|
|
5137
5215
|
}
|
|
5138
5216
|
},
|
|
5139
|
-
checked: rowInfo.
|
|
5217
|
+
checked: rowInfo.rowSelected
|
|
5140
5218
|
});
|
|
5141
5219
|
};
|
|
5142
5220
|
function isColumnWithField(c) {
|
|
@@ -5155,6 +5233,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5155
5233
|
toggleGroupRow,
|
|
5156
5234
|
rowIndex,
|
|
5157
5235
|
rowHeight,
|
|
5236
|
+
columnsMap,
|
|
5158
5237
|
domRef,
|
|
5159
5238
|
hidden,
|
|
5160
5239
|
showZebraRows
|
|
@@ -5230,23 +5309,24 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5230
5309
|
}, rest);
|
|
5231
5310
|
const renderParam = __spreadProps(__spreadValues({
|
|
5232
5311
|
column,
|
|
5312
|
+
columnsMap,
|
|
5233
5313
|
domRef,
|
|
5234
5314
|
groupRowInfo
|
|
5235
5315
|
}, rest), {
|
|
5236
5316
|
selectionMode,
|
|
5237
|
-
selectRow: imperativeApi.selectRow,
|
|
5238
|
-
deselectRow: imperativeApi.deselectRow,
|
|
5239
|
-
toggleRowSelection: imperativeApi.toggleRowSelection,
|
|
5317
|
+
selectRow: imperativeApi.selectionApi.selectRow,
|
|
5318
|
+
deselectRow: imperativeApi.selectionApi.deselectRow,
|
|
5319
|
+
toggleRowSelection: imperativeApi.selectionApi.toggleRowSelection,
|
|
5240
5320
|
renderBag: {
|
|
5241
5321
|
value,
|
|
5242
5322
|
selectionCheckBox: null,
|
|
5243
5323
|
groupIcon: null
|
|
5244
5324
|
},
|
|
5245
5325
|
selectCurrentRow: (0, import_react18.useCallback)(() => {
|
|
5246
|
-
return imperativeApi.selectRow(rowInfo.id);
|
|
5326
|
+
return imperativeApi.selectionApi.selectRow(rowInfo.id, rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0);
|
|
5247
5327
|
}, [rowInfo]),
|
|
5248
5328
|
deselectCurrentRow: (0, import_react18.useCallback)(() => {
|
|
5249
|
-
return imperativeApi.deselectRow(rowInfo.id);
|
|
5329
|
+
return imperativeApi.selectionApi.deselectRow(rowInfo.id, rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0);
|
|
5250
5330
|
}, [rowInfo]),
|
|
5251
5331
|
rowIndex,
|
|
5252
5332
|
toggleGroupRow,
|
|
@@ -5257,7 +5337,10 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5257
5337
|
toggleGroupRow(rowInfo.groupKeys);
|
|
5258
5338
|
}, [rowInfo]),
|
|
5259
5339
|
toggleCurrentGroupRowSelection: (0, import_react18.useCallback)(() => {
|
|
5260
|
-
|
|
5340
|
+
if (!rowInfo.isGroupRow) {
|
|
5341
|
+
return;
|
|
5342
|
+
}
|
|
5343
|
+
return imperativeApi.selectionApi.toggleGroupRowSelection(rowInfo.isGroupRow ? rowInfo.groupKeys : []);
|
|
5261
5344
|
}, [rowInfo]),
|
|
5262
5345
|
groupBy: computedDataSource.groupBy,
|
|
5263
5346
|
pivotBy: computedDataSource.pivotBy
|
|
@@ -5274,7 +5357,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5274
5357
|
})
|
|
5275
5358
|
});
|
|
5276
5359
|
}
|
|
5277
|
-
if (column.renderSelectionCheckBox) {
|
|
5360
|
+
if (column.renderSelectionCheckBox && selectionMode == "multi-row") {
|
|
5278
5361
|
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ React18.createElement(RenderCellHookComponent, {
|
|
5279
5362
|
render: defaultRenderSelectionCheckBox,
|
|
5280
5363
|
renderParam
|
|
@@ -5318,7 +5401,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5318
5401
|
renderParam
|
|
5319
5402
|
});
|
|
5320
5403
|
}
|
|
5321
|
-
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, renderParam.renderBag.groupIcon, renderParam.renderBag.selectionCheckBox, renderParam.renderBag.value);
|
|
5404
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, column.align !== "end" ? renderParam.renderBag.groupIcon : null, column.align !== "end" ? renderParam.renderBag.selectionCheckBox : null, renderParam.renderBag.value, column.align === "end" ? renderParam.renderBag.selectionCheckBox : null, column.align === "end" ? renderParam.renderBag.groupIcon : null);
|
|
5322
5405
|
}, [
|
|
5323
5406
|
column,
|
|
5324
5407
|
hidden,
|
|
@@ -5376,6 +5459,15 @@ function RenderCellHookComponent(props) {
|
|
|
5376
5459
|
renderParam: props.renderParam
|
|
5377
5460
|
}));
|
|
5378
5461
|
}
|
|
5462
|
+
function RenderHeaderCellHookComponent(props) {
|
|
5463
|
+
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
5464
|
+
return /* @__PURE__ */ React19.createElement(ContextProvider, {
|
|
5465
|
+
value: props.renderParam
|
|
5466
|
+
}, /* @__PURE__ */ React19.createElement(RenderHookComponent, {
|
|
5467
|
+
render: props.render,
|
|
5468
|
+
renderParam: props.renderParam
|
|
5469
|
+
}));
|
|
5470
|
+
}
|
|
5379
5471
|
|
|
5380
5472
|
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
5381
5473
|
var React20 = __toModule(require("react"));
|
|
@@ -5419,19 +5511,19 @@ var import_react19 = __toModule(require("react"));
|
|
|
5419
5511
|
|
|
5420
5512
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
5421
5513
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5422
|
-
var CellCls = "_1eexc2a5
|
|
5423
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "
|
|
5424
|
-
var HeaderCellProxy = "_12zfob1k
|
|
5425
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob1l
|
|
5426
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob16
|
|
5427
|
-
var HeaderFilterCls = "
|
|
5428
|
-
var HeaderFilterEditorCls = "
|
|
5429
|
-
var HeaderGroupCls = "
|
|
5514
|
+
var CellCls = "_1eexc2a5 _16lm1iwu _16lm1iw1f _16lm1iw1h _16lm1iw2 _16lm1iw1r _16lm1iw1s _16lm1iwy";
|
|
5515
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob11e _16lm1iw10 _16lm1iw12 _16lm1iwu _16lm1iw1f _16lm1iw1h", variantClassNames: { filtered: { false: "_12zfob11f", true: "_12zfob11g" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5516
|
+
var HeaderCellProxy = "_12zfob1k _16lm1iw1s _16lm1iw1t _16lm1iw1m";
|
|
5517
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob1l _16lm1iww", variantClassNames: { rowActive: { false: "_12zfob1m", true: "_12zfob1n" }, rowSelected: { false: "_12zfob1o", true: "_12zfob1p", null: "_12zfob1q" }, zebra: { false: "_12zfob1r", even: "_12zfob1s", odd: "_12zfob1t" }, dragging: { true: "_12zfob1u", false: "_12zfob1v" }, first: { true: "_12zfob1w", false: "_12zfob1x" }, last: { true: "_12zfob1y", false: "_12zfob1z" }, groupByField: { true: "_12zfob110", false: "_12zfob111" }, firstInCategory: { true: "_12zfob112", false: "_12zfob113" }, lastInCategory: { true: "_12zfob114", false: "_12zfob115" }, pinned: { start: "_12zfob116", end: "_12zfob117", false: "_12zfob118" }, filtered: { true: "_12zfob119", false: "_12zfob11a" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob11b"], [{ pinned: "end", firstInCategory: true }, "_12zfob11c"], [{ pinned: false, lastInCategory: true }, "_12zfob11d"]] });
|
|
5518
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob16 _16lm1iww _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob17", end: "_12zfob18", false: "_12zfob19" }, firstInCategory: { true: "_12zfob1a", false: "_12zfob1b" }, lastInCategory: { true: "_12zfob1c", false: "_12zfob1d" }, overflow: { true: "_12zfob1e", false: "_12zfob1f" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1g"], [{ pinned: "start", firstInCategory: true }, "_12zfob1h"], [{ overflow: true, pinned: "end" }, "_12zfob1i"], [{ pinned: "end", lastInCategory: true }, "_12zfob1j"]] });
|
|
5519
|
+
var HeaderFilterCls = "_12zfob11j _16lm1iwu _16lm1iw1f _16lm1iw1h _16lm1iw1";
|
|
5520
|
+
var HeaderFilterEditorCls = "_16lm1iw12 _16lm1iw10";
|
|
5521
|
+
var HeaderGroupCls = "_12zfob11i _16lm1iwu _16lm1iw1f _16lm1iw1h";
|
|
5430
5522
|
var HeaderScrollbarPlaceholderCls = "_12zfob15 _16lm1iw2";
|
|
5431
5523
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
5432
5524
|
var HeaderSortIconIndexCls = "_12zfob14";
|
|
5433
5525
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob11", center: "_12zfob12", end: "_12zfob13" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5434
|
-
var HeaderWrapperCls = "
|
|
5526
|
+
var HeaderWrapperCls = "_12zfob11h _16lm1iw1m _16lm1iw1 _16lm1iwu _16lm1iw1f";
|
|
5435
5527
|
|
|
5436
5528
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
5437
5529
|
var defaultLineStyle = {
|
|
@@ -5994,9 +6086,9 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5994
6086
|
|
|
5995
6087
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
5996
6088
|
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5997
|
-
var ResizeHandleCls = "zneyzh0 _16lm1iw2
|
|
5998
|
-
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "zneyzhb _16lm1iw2
|
|
5999
|
-
var ResizeHandleRecipeCls = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { computedPinned: { start: "zneyzh1", end: "zneyzh2
|
|
6089
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iw13 _16lm1iw1a _16lm1iw18 _16lm1iwf _16lm1iw1m";
|
|
6090
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "zneyzhb _16lm1iw2 _16lm1iw13 _16lm1iw18", variantClassNames: { constrained: { false: "zneyzhc", true: "zneyzhd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
6091
|
+
var ResizeHandleRecipeCls = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { computedPinned: { start: "zneyzh1", end: "zneyzh2 _16lm1iw15 _16lm1iw1c", false: "zneyzh3" }, computedFirstInCategory: { true: "zneyzh4", false: "zneyzh5" }, computedLastInCategory: { true: "zneyzh6", false: "zneyzh7" } }, defaultVariants: {}, compoundVariants: [[{ computedPinned: "end", computedLastInCategory: false, computedFirstInCategory: true }, "zneyzh8"], [{ computedPinned: false, computedFirstInCategory: false, computedLastInCategory: true }, "zneyzh9"], [{ computedPinned: "start", computedFirstInCategory: false, computedLastInCategory: true }, "zneyzha"]] });
|
|
6000
6092
|
|
|
6001
6093
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
6002
6094
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
@@ -6139,6 +6231,23 @@ function useColumnResizeHandle(column) {
|
|
|
6139
6231
|
}
|
|
6140
6232
|
|
|
6141
6233
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
6234
|
+
var defaultRenderSelectionCheckBox2 = (params) => {
|
|
6235
|
+
const { allRowsSelected, someRowsSelected, api } = params;
|
|
6236
|
+
const selected = allRowsSelected ? true : someRowsSelected ? null : false;
|
|
6237
|
+
return /* @__PURE__ */ React25.createElement(InfiniteCheckBox, {
|
|
6238
|
+
domProps: {
|
|
6239
|
+
className: SelectionCheckboxCls
|
|
6240
|
+
},
|
|
6241
|
+
onChange: (selected2) => {
|
|
6242
|
+
if (selected2) {
|
|
6243
|
+
api.selectionApi.selectAll();
|
|
6244
|
+
} else {
|
|
6245
|
+
api.selectionApi.deselectAll();
|
|
6246
|
+
}
|
|
6247
|
+
},
|
|
6248
|
+
checked: selected
|
|
6249
|
+
});
|
|
6250
|
+
};
|
|
6142
6251
|
var InfiniteTableHeaderCellContext = React25.createContext(null);
|
|
6143
6252
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
6144
6253
|
var InfiniteTableHeaderCellClassName = `${rootClassName9}HeaderCell`;
|
|
@@ -6148,6 +6257,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6148
6257
|
const column = props.column;
|
|
6149
6258
|
const {
|
|
6150
6259
|
computed: { showColumnFilters },
|
|
6260
|
+
imperativeApi: api,
|
|
6151
6261
|
componentState: {
|
|
6152
6262
|
portalDOMRef,
|
|
6153
6263
|
columnHeaderHeight,
|
|
@@ -6155,8 +6265,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6155
6265
|
columnReorderDragColumnId
|
|
6156
6266
|
}
|
|
6157
6267
|
} = useInfiniteTable();
|
|
6268
|
+
const { allRowsSelected, someRowsSelected, selectionMode } = useDataSource();
|
|
6158
6269
|
const dragging = columnReorderDragColumnId === column.id;
|
|
6159
|
-
const { onResize, height, width, headerOptions } = props;
|
|
6270
|
+
const { onResize, height, width, headerOptions, columnsMap } = props;
|
|
6160
6271
|
const sortInfo = column.computedSortInfo;
|
|
6161
6272
|
let header = column.header;
|
|
6162
6273
|
const ref = (0, import_react23.useCallback)((node) => {
|
|
@@ -6165,7 +6276,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6165
6276
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
6166
6277
|
}, [props.domRef]);
|
|
6167
6278
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
6168
|
-
const
|
|
6279
|
+
const sortIcon = column.computedSortable && (column.computedSorted || alwaysShow) ? /* @__PURE__ */ React25.createElement(SortIcon, {
|
|
6169
6280
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
6170
6281
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
6171
6282
|
align: column.align || "start"
|
|
@@ -6176,20 +6287,58 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6176
6287
|
dragging,
|
|
6177
6288
|
domRef: ref,
|
|
6178
6289
|
column,
|
|
6290
|
+
columnsMap,
|
|
6179
6291
|
columnSortInfo: sortInfo,
|
|
6180
6292
|
columnFilterValue: column.computedFilterValue,
|
|
6181
|
-
|
|
6293
|
+
someRowsSelected,
|
|
6294
|
+
allRowsSelected,
|
|
6295
|
+
selectionMode,
|
|
6296
|
+
api,
|
|
6297
|
+
renderBag: {
|
|
6298
|
+
sortIcon,
|
|
6299
|
+
selectionCheckBox: null,
|
|
6300
|
+
header: column.header && typeof column.header !== "function" ? column.header : column.name
|
|
6301
|
+
}
|
|
6182
6302
|
};
|
|
6183
6303
|
const align = column.align || "start";
|
|
6184
6304
|
const renderChildren = () => {
|
|
6305
|
+
if (column.renderSortIcon) {
|
|
6306
|
+
renderParam.renderBag.sortIcon = /* @__PURE__ */ React25.createElement(RenderHeaderCellHookComponent, {
|
|
6307
|
+
render: column.renderSortIcon,
|
|
6308
|
+
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6309
|
+
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6310
|
+
})
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6313
|
+
if (column.renderSelectionCheckBox && selectionMode === "multi-row") {
|
|
6314
|
+
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ React25.createElement(RenderHeaderCellHookComponent, {
|
|
6315
|
+
render: defaultRenderSelectionCheckBox2,
|
|
6316
|
+
renderParam
|
|
6317
|
+
});
|
|
6318
|
+
if (column.renderHeaderSelectionCheckBox && column.renderHeaderSelectionCheckBox !== true) {
|
|
6319
|
+
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ React25.createElement(RenderHeaderCellHookComponent, {
|
|
6320
|
+
render: column.renderHeaderSelectionCheckBox,
|
|
6321
|
+
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6322
|
+
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6323
|
+
})
|
|
6324
|
+
});
|
|
6325
|
+
}
|
|
6326
|
+
}
|
|
6185
6327
|
if (header instanceof Function) {
|
|
6186
|
-
header = /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
6328
|
+
renderParam.renderBag.header = /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
6187
6329
|
render: header,
|
|
6330
|
+
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6331
|
+
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6332
|
+
})
|
|
6333
|
+
});
|
|
6334
|
+
}
|
|
6335
|
+
if (column.renderHeader) {
|
|
6336
|
+
return /* @__PURE__ */ React25.createElement(RenderHeaderCellHookComponent, {
|
|
6337
|
+
render: column.renderHeader,
|
|
6188
6338
|
renderParam
|
|
6189
6339
|
});
|
|
6190
6340
|
}
|
|
6191
|
-
|
|
6192
|
-
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
6341
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, align !== "end" ? renderParam.renderBag.selectionCheckBox : null, align === "end" ? renderParam.renderBag.sortIcon : null, renderParam.renderBag.header, align !== "end" ? renderParam.renderBag.sortIcon : null, align === "end" ? renderParam.renderBag.selectionCheckBox : null);
|
|
6193
6342
|
};
|
|
6194
6343
|
const domRef = (0, import_react23.useRef)(null);
|
|
6195
6344
|
const {
|
|
@@ -6711,7 +6860,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
6711
6860
|
headerOptions,
|
|
6712
6861
|
width: widthWithColspan,
|
|
6713
6862
|
height: heightWithRowspan,
|
|
6714
|
-
|
|
6863
|
+
columnsMap: computedVisibleColumnsMap
|
|
6715
6864
|
});
|
|
6716
6865
|
}, [
|
|
6717
6866
|
headerOptions,
|
|
@@ -6910,7 +7059,7 @@ var InfiniteTableLicenseFooter = React31.forwardRef(function InfiniteTableLicens
|
|
|
6910
7059
|
|
|
6911
7060
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
6912
7061
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6913
|
-
var GroupRowExpanderCls = "_7pupv0b";
|
|
7062
|
+
var GroupRowExpanderCls = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_7pupv0b", center: "_7pupv0c", end: "_7pupv0d" } }, defaultVariants: {}, compoundVariants: [] });
|
|
6914
7063
|
var RowClsRecipe = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
|
|
6915
7064
|
var RowHoverCls = "_7pupv01";
|
|
6916
7065
|
|
|
@@ -6918,8 +7067,8 @@ var RowHoverCls = "_7pupv01";
|
|
|
6918
7067
|
var React32 = __toModule(require("react"));
|
|
6919
7068
|
|
|
6920
7069
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
6921
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
6922
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
7070
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iw13 _16lm1iw15 _16lm1iw1a _16lm1iw18", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iw13 _16lm1iw15 _16lm1iw1a _16lm1iw18" };
|
|
7071
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iw13 _16lm1iw15 _16lm1iw1a _16lm1iw18";
|
|
6923
7072
|
var LoadMaskTextCls = "qy58ya4";
|
|
6924
7073
|
|
|
6925
7074
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -6937,9 +7086,38 @@ function LoadMaskFn(props) {
|
|
|
6937
7086
|
}
|
|
6938
7087
|
var LoadMask = React32.memo(LoadMaskFn);
|
|
6939
7088
|
|
|
7089
|
+
// src/utils/deepClone.ts
|
|
7090
|
+
function cloneArray(arr) {
|
|
7091
|
+
return arr.map(deepClone);
|
|
7092
|
+
}
|
|
7093
|
+
function deepClone(source) {
|
|
7094
|
+
if (getGlobal().structuredClone) {
|
|
7095
|
+
return getGlobal().structuredClone(source);
|
|
7096
|
+
}
|
|
7097
|
+
if (source === null || typeof source !== "object") {
|
|
7098
|
+
return source;
|
|
7099
|
+
}
|
|
7100
|
+
if (Array.isArray(source)) {
|
|
7101
|
+
return cloneArray(source);
|
|
7102
|
+
}
|
|
7103
|
+
if (source instanceof Date) {
|
|
7104
|
+
return new Date(source);
|
|
7105
|
+
}
|
|
7106
|
+
if (source instanceof Set) {
|
|
7107
|
+
return new Set(cloneArray(Array.from(source)));
|
|
7108
|
+
}
|
|
7109
|
+
if (source instanceof Map) {
|
|
7110
|
+
return new Map(cloneArray(Array.from(source)));
|
|
7111
|
+
}
|
|
7112
|
+
let target = {};
|
|
7113
|
+
for (let key in source)
|
|
7114
|
+
if (source.hasOwnProperty(key)) {
|
|
7115
|
+
target[key] = deepClone(source[key]);
|
|
7116
|
+
}
|
|
7117
|
+
return target;
|
|
7118
|
+
}
|
|
7119
|
+
|
|
6940
7120
|
// src/utils/groupAndPivot/index.ts
|
|
6941
|
-
var GROUP_SELECTED_REDUCER_KEY = "__groupFullySelected";
|
|
6942
|
-
var GROUP_CHILDREN_SELECTED_COUNT_KEY = "__groupChildrenSelectedCount";
|
|
6943
7121
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
6944
7122
|
var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
|
|
6945
7123
|
function DEFAULT_TO_KEY(value) {
|
|
@@ -6956,7 +7134,7 @@ function initReducers(reducers) {
|
|
|
6956
7134
|
}
|
|
6957
7135
|
return result;
|
|
6958
7136
|
}
|
|
6959
|
-
function computeReducersFor(data, index, reducers, reducerResults) {
|
|
7137
|
+
function computeReducersFor(data, index, reducers, reducerResults, groupKeys) {
|
|
6960
7138
|
var _a, _b;
|
|
6961
7139
|
if (!reducers || !Object.keys(reducers).length) {
|
|
6962
7140
|
return;
|
|
@@ -6969,7 +7147,7 @@ function computeReducersFor(data, index, reducers, reducerResults) {
|
|
|
6969
7147
|
}
|
|
6970
7148
|
const currentValue = reducerResults[key];
|
|
6971
7149
|
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
6972
|
-
reducerResults[key] = reducer.reducer(currentValue, value, data, index);
|
|
7150
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data, index, groupKeys);
|
|
6973
7151
|
}
|
|
6974
7152
|
}
|
|
6975
7153
|
function lazyGroup(groupParams, rootData) {
|
|
@@ -6977,6 +7155,8 @@ function lazyGroup(groupParams, rootData) {
|
|
|
6977
7155
|
reducers = {},
|
|
6978
7156
|
pivot,
|
|
6979
7157
|
groupBy,
|
|
7158
|
+
indexer,
|
|
7159
|
+
toPrimaryKey,
|
|
6980
7160
|
mappings
|
|
6981
7161
|
} = groupParams;
|
|
6982
7162
|
const deepMap = new DeepMap();
|
|
@@ -7001,7 +7181,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7001
7181
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
7002
7182
|
const currentPivotKeys = [];
|
|
7003
7183
|
const initialReducerValue = initReducers(reducers);
|
|
7004
|
-
const globalReducerResults =
|
|
7184
|
+
const globalReducerResults = deepClone(initialReducerValue);
|
|
7005
7185
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
7006
7186
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
7007
7187
|
const dataArray = lazyGroupRowInfo.children;
|
|
@@ -7015,6 +7195,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7015
7195
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
7016
7196
|
if (current) {
|
|
7017
7197
|
current.items = dataArray;
|
|
7198
|
+
indexer.indexArray(dataArray, toPrimaryKey);
|
|
7018
7199
|
}
|
|
7019
7200
|
return next == null ? void 0 : next();
|
|
7020
7201
|
}
|
|
@@ -7045,6 +7226,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7045
7226
|
childrenLoading: false,
|
|
7046
7227
|
childrenAvailable: false,
|
|
7047
7228
|
commonData: dataObject,
|
|
7229
|
+
totalChildrenCount: dataArray[i].totalChildrenCount,
|
|
7048
7230
|
reducerResults: dataArray[i].aggregations || {}
|
|
7049
7231
|
};
|
|
7050
7232
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
@@ -7079,7 +7261,7 @@ function processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, itemInd
|
|
|
7079
7261
|
} = deepMap.get(currentGroupKeys);
|
|
7080
7262
|
currentGroupItems.push(item);
|
|
7081
7263
|
if (reducers) {
|
|
7082
|
-
computeReducersFor(item, itemIndex, reducers, reducerResults);
|
|
7264
|
+
computeReducersFor(item, itemIndex, reducers, reducerResults, currentGroupKeys);
|
|
7083
7265
|
}
|
|
7084
7266
|
if (pivot) {
|
|
7085
7267
|
for (let pivotIndex = 0, pivotLength = pivot.length; pivotIndex < pivotLength; pivotIndex++) {
|
|
@@ -7089,19 +7271,27 @@ function processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, itemInd
|
|
|
7089
7271
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
7090
7272
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
7091
7273
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
7092
|
-
reducerResults:
|
|
7274
|
+
reducerResults: deepClone(initialReducerValue),
|
|
7093
7275
|
items: []
|
|
7094
7276
|
});
|
|
7095
7277
|
}
|
|
7096
7278
|
const { reducerResults: pivotReducerResults, items: pivotGroupItems } = pivotDeepMap.get(currentPivotKeys);
|
|
7097
7279
|
pivotGroupItems.push(item);
|
|
7098
7280
|
if (reducers) {
|
|
7099
|
-
computeReducersFor(item, itemIndex, reducers, pivotReducerResults);
|
|
7281
|
+
computeReducersFor(item, itemIndex, reducers, pivotReducerResults, currentGroupKeys);
|
|
7100
7282
|
}
|
|
7101
7283
|
}
|
|
7102
7284
|
currentPivotKeys.length = 0;
|
|
7103
7285
|
}
|
|
7104
7286
|
}
|
|
7287
|
+
function getGroupKeysForDataItem(data, groupBy) {
|
|
7288
|
+
return groupBy.reduce((groupKeys, groupBy2) => {
|
|
7289
|
+
const { field: groupByProperty, toKey: groupToKey } = groupBy2;
|
|
7290
|
+
const key = (groupToKey || DEFAULT_TO_KEY)(data[groupByProperty], data);
|
|
7291
|
+
groupKeys.push(key);
|
|
7292
|
+
return groupKeys;
|
|
7293
|
+
}, []);
|
|
7294
|
+
}
|
|
7105
7295
|
function group(groupParams, data) {
|
|
7106
7296
|
const {
|
|
7107
7297
|
groupBy,
|
|
@@ -7115,14 +7305,14 @@ function group(groupParams, data) {
|
|
|
7115
7305
|
const currentGroupKeys = [];
|
|
7116
7306
|
const currentPivotKeys = [];
|
|
7117
7307
|
const initialReducerValue = initReducers(reducers);
|
|
7118
|
-
const globalReducerResults =
|
|
7308
|
+
const globalReducerResults = deepClone(initialReducerValue);
|
|
7119
7309
|
if (!groupByLength) {
|
|
7120
7310
|
const deepMapGroupValue = {
|
|
7121
7311
|
items: [],
|
|
7122
7312
|
cache: false,
|
|
7123
7313
|
childrenLoading: false,
|
|
7124
7314
|
childrenAvailable: false,
|
|
7125
|
-
reducerResults:
|
|
7315
|
+
reducerResults: deepClone(initialReducerValue)
|
|
7126
7316
|
};
|
|
7127
7317
|
if (pivot) {
|
|
7128
7318
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -7141,7 +7331,7 @@ function group(groupParams, data) {
|
|
|
7141
7331
|
cache: false,
|
|
7142
7332
|
childrenLoading: false,
|
|
7143
7333
|
childrenAvailable: false,
|
|
7144
|
-
reducerResults:
|
|
7334
|
+
reducerResults: deepClone(initialReducerValue)
|
|
7145
7335
|
};
|
|
7146
7336
|
if (pivot) {
|
|
7147
7337
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -7154,7 +7344,7 @@ function group(groupParams, data) {
|
|
|
7154
7344
|
processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, i, pivot, reducers, topLevelPivotColumns, initialReducerValue, defaultToKey);
|
|
7155
7345
|
}
|
|
7156
7346
|
if (reducers) {
|
|
7157
|
-
computeReducersFor(item, i, reducers, globalReducerResults);
|
|
7347
|
+
computeReducersFor(item, i, reducers, globalReducerResults, currentGroupKeys);
|
|
7158
7348
|
}
|
|
7159
7349
|
currentGroupKeys.length = 0;
|
|
7160
7350
|
}
|
|
@@ -7231,8 +7421,9 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
7231
7421
|
groupCount: groupItems.length,
|
|
7232
7422
|
groupData: groupItems,
|
|
7233
7423
|
groupKeys,
|
|
7234
|
-
rowSelected:
|
|
7235
|
-
|
|
7424
|
+
rowSelected: false,
|
|
7425
|
+
selectedChildredCount: 0,
|
|
7426
|
+
deselectedChildredCount: 0,
|
|
7236
7427
|
id: `${groupKeys}`,
|
|
7237
7428
|
collapsed,
|
|
7238
7429
|
dataSourceHasGrouping: true,
|
|
@@ -7242,6 +7433,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
7242
7433
|
deepRowInfoArray: [],
|
|
7243
7434
|
collapsedChildrenCount: 0,
|
|
7244
7435
|
collapsedGroupsCount: 0,
|
|
7436
|
+
totalChildrenCount: options.totalChildrenCount,
|
|
7245
7437
|
childrenAvailable: lazyLoad ? options.childrenAvailable : true,
|
|
7246
7438
|
childrenLoading: options.childrenLoading,
|
|
7247
7439
|
indexInParentGroups: options.indexInParentGroups,
|
|
@@ -7278,7 +7470,7 @@ function enhancedFlatten(param) {
|
|
|
7278
7470
|
toPrimaryKey,
|
|
7279
7471
|
groupRowsState,
|
|
7280
7472
|
isRowSelected,
|
|
7281
|
-
|
|
7473
|
+
rowSelectionState,
|
|
7282
7474
|
generateGroupRows,
|
|
7283
7475
|
reducers = {}
|
|
7284
7476
|
} = param;
|
|
@@ -7304,13 +7496,21 @@ function enhancedFlatten(param) {
|
|
|
7304
7496
|
indexInAll: result.length,
|
|
7305
7497
|
groupKeys,
|
|
7306
7498
|
error: deepMapValue.error,
|
|
7499
|
+
totalChildrenCount: deepMapValue.totalChildrenCount,
|
|
7307
7500
|
childrenLoading: deepMapValue.childrenLoading,
|
|
7308
7501
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
7309
7502
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
7310
7503
|
directChildrenLoadedCount: 0,
|
|
7311
7504
|
collapsed
|
|
7312
7505
|
}, deepMapValue);
|
|
7313
|
-
|
|
7506
|
+
if (isRowSelected) {
|
|
7507
|
+
enhancedGroupData.rowSelected = isRowSelected(enhancedGroupData);
|
|
7508
|
+
if (rowSelectionState) {
|
|
7509
|
+
const selectionCount = rowSelectionState.getSelectionCountFor(enhancedGroupData.groupKeys);
|
|
7510
|
+
enhancedGroupData.selectedChildredCount = selectionCount.selectedCount;
|
|
7511
|
+
enhancedGroupData.deselectedChildredCount = selectionCount.deselectedCount;
|
|
7512
|
+
}
|
|
7513
|
+
}
|
|
7314
7514
|
const parent = parents[parents.length - 1];
|
|
7315
7515
|
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
7316
7516
|
let include = generateGroupRows || collapsed;
|
|
@@ -7373,7 +7573,6 @@ function enhancedFlatten(param) {
|
|
|
7373
7573
|
if (isRowSelected) {
|
|
7374
7574
|
rowInfo.rowSelected = isRowSelected(rowInfo);
|
|
7375
7575
|
}
|
|
7376
|
-
indexer.add(rowInfo.indexInAll, rowInfo.id);
|
|
7377
7576
|
parents.forEach((parent2, i) => {
|
|
7378
7577
|
const last = i === parents.length - 1;
|
|
7379
7578
|
if (last && item) {
|
|
@@ -8172,212 +8371,540 @@ function lazyLoadRange(options, cache) {
|
|
|
8172
8371
|
}, initialPromise);
|
|
8173
8372
|
}
|
|
8174
8373
|
|
|
8175
|
-
// src/components/DataSource/
|
|
8176
|
-
var
|
|
8177
|
-
constructor(state) {
|
|
8374
|
+
// src/components/DataSource/RowSelectionState.ts
|
|
8375
|
+
var RowSelectionState = class {
|
|
8376
|
+
constructor(state, getConfig, _forTestingOnly) {
|
|
8377
|
+
this.selectedRows = null;
|
|
8378
|
+
this.deselectedRows = null;
|
|
8379
|
+
this.defaultSelection = false;
|
|
8380
|
+
this.selectedMap = new DeepMap();
|
|
8381
|
+
this.deselectedMap = new DeepMap();
|
|
8382
|
+
this.selectionCache = new DeepMap();
|
|
8383
|
+
this.selectionCountCache = new DeepMap();
|
|
8384
|
+
this.mapSet = (name, key) => {
|
|
8385
|
+
if (!Array.isArray(key)) {
|
|
8386
|
+
key = [...this.getGroupKeysForPrimaryKey(key), key];
|
|
8387
|
+
}
|
|
8388
|
+
this.xcache();
|
|
8389
|
+
if (name === "selected") {
|
|
8390
|
+
this.selectedMap.set(key, true);
|
|
8391
|
+
} else {
|
|
8392
|
+
this.deselectedMap.set(key, true);
|
|
8393
|
+
}
|
|
8394
|
+
};
|
|
8395
|
+
this._selectedMapSet = (key) => {
|
|
8396
|
+
this.mapSet("selected", key);
|
|
8397
|
+
};
|
|
8398
|
+
this._deselectedMapSet = (key) => {
|
|
8399
|
+
this.mapSet("deselected", key);
|
|
8400
|
+
};
|
|
8178
8401
|
const stateObject = state instanceof Object.getPrototypeOf(this).constructor ? state.getState() : state;
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
});
|
|
8402
|
+
this.getConfig = getConfig;
|
|
8403
|
+
if (_forTestingOnly) {
|
|
8404
|
+
Object.assign(this, _forTestingOnly);
|
|
8405
|
+
}
|
|
8406
|
+
this.update(stateObject);
|
|
8185
8407
|
}
|
|
8186
|
-
|
|
8187
|
-
|
|
8408
|
+
getGroupKeysForPrimaryKey(pk) {
|
|
8409
|
+
const { indexer, groupBy } = this.getConfig();
|
|
8410
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8411
|
+
return data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8188
8412
|
}
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
(_a = this.positiveMap) == null ? void 0 : _a.clear();
|
|
8192
|
-
(_b = this.negativeMap) == null ? void 0 : _b.clear();
|
|
8193
|
-
delete this.positiveMap;
|
|
8194
|
-
delete this.negativeMap;
|
|
8413
|
+
getGroupDeepMap() {
|
|
8414
|
+
return this.getConfig().groupDeepMap;
|
|
8195
8415
|
}
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
if (this.allNegative && this.allPositive) {
|
|
8201
|
-
throw `Cannot have both negativeItems and positiveItems be true!`;
|
|
8202
|
-
}
|
|
8203
|
-
if (negativeItems && negativeItems !== true) {
|
|
8204
|
-
if (!this.negativeMap) {
|
|
8205
|
-
this.negativeMap = new Map();
|
|
8206
|
-
}
|
|
8207
|
-
this.negativeMap.clear();
|
|
8208
|
-
for (let k in negativeItems) {
|
|
8209
|
-
if (negativeItems.hasOwnProperty(k)) {
|
|
8210
|
-
this.negativeMap.set(k, true);
|
|
8211
|
-
}
|
|
8212
|
-
}
|
|
8213
|
-
if (this.positiveMap) {
|
|
8214
|
-
this.positiveMap.clear();
|
|
8215
|
-
}
|
|
8416
|
+
getGroupCount(groupKeys) {
|
|
8417
|
+
var _a;
|
|
8418
|
+
if (groupKeys.length == 0) {
|
|
8419
|
+
return this.getConfig().totalCount;
|
|
8216
8420
|
}
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
this.positiveMap.clear();
|
|
8222
|
-
for (let k in positiveItems) {
|
|
8223
|
-
if (positiveItems.hasOwnProperty(k)) {
|
|
8224
|
-
this.positiveMap.set(k, true);
|
|
8225
|
-
}
|
|
8226
|
-
}
|
|
8227
|
-
if (this.negativeMap) {
|
|
8228
|
-
this.negativeMap.clear();
|
|
8229
|
-
}
|
|
8421
|
+
const groupDeepMap = this.getGroupDeepMap();
|
|
8422
|
+
const deepMapValue = groupDeepMap == null ? void 0 : groupDeepMap.get(groupKeys);
|
|
8423
|
+
if (!deepMapValue) {
|
|
8424
|
+
return 0;
|
|
8230
8425
|
}
|
|
8426
|
+
return (_a = deepMapValue.totalChildrenCount) != null ? _a : deepMapValue.items.length || 0;
|
|
8231
8427
|
}
|
|
8232
|
-
|
|
8233
|
-
|
|
8428
|
+
getGroupKeysDirectlyInsideGroup(groupKeys) {
|
|
8429
|
+
const { groupDeepMap } = this.getConfig();
|
|
8430
|
+
return (groupDeepMap == null ? void 0 : groupDeepMap.getKeysStartingWith(groupKeys, true, 1)) || [];
|
|
8234
8431
|
}
|
|
8235
|
-
|
|
8236
|
-
return this.
|
|
8432
|
+
getGroupByLength() {
|
|
8433
|
+
return this.getConfig().groupBy.length;
|
|
8237
8434
|
}
|
|
8238
|
-
|
|
8239
|
-
return
|
|
8435
|
+
static from(rowSeleStateObject, getConfig, _forTestingOnly) {
|
|
8436
|
+
return new RowSelectionState(rowSeleStateObject, getConfig, _forTestingOnly);
|
|
8240
8437
|
}
|
|
8241
|
-
|
|
8242
|
-
|
|
8438
|
+
update(stateObject) {
|
|
8439
|
+
var _a, _b;
|
|
8440
|
+
this.selectedRows = stateObject.selectedRows || null;
|
|
8441
|
+
this.deselectedRows = stateObject.deselectedRows || null;
|
|
8442
|
+
this.selectedMap.clear();
|
|
8443
|
+
this.deselectedMap.clear();
|
|
8444
|
+
(_a = this.selectedRows) == null ? void 0 : _a.forEach(this._selectedMapSet);
|
|
8445
|
+
(_b = this.deselectedRows) == null ? void 0 : _b.forEach(this._deselectedMapSet);
|
|
8446
|
+
this.defaultSelection = stateObject.defaultSelection;
|
|
8447
|
+
this.xcache();
|
|
8448
|
+
}
|
|
8449
|
+
xcache() {
|
|
8450
|
+
this.selectionCache.clear();
|
|
8451
|
+
this.selectionCountCache.clear();
|
|
8243
8452
|
}
|
|
8244
|
-
|
|
8453
|
+
getState() {
|
|
8454
|
+
const normalize = (allKeys) => {
|
|
8455
|
+
const groupByLength = this.getGroupByLength();
|
|
8456
|
+
return allKeys.map((keys) => keys.length > groupByLength ? keys.pop() : keys);
|
|
8457
|
+
};
|
|
8458
|
+
const selectedRows = normalize(this.selectedMap.topDownKeys());
|
|
8459
|
+
const deselectedRows = normalize(this.deselectedMap.topDownKeys());
|
|
8460
|
+
return {
|
|
8461
|
+
defaultSelection: this.defaultSelection,
|
|
8462
|
+
selectedRows,
|
|
8463
|
+
deselectedRows
|
|
8464
|
+
};
|
|
8465
|
+
}
|
|
8466
|
+
deselectAll() {
|
|
8245
8467
|
this.update({
|
|
8246
|
-
|
|
8247
|
-
|
|
8468
|
+
defaultSelection: false,
|
|
8469
|
+
selectedRows: [],
|
|
8470
|
+
deselectedRows: []
|
|
8248
8471
|
});
|
|
8249
8472
|
}
|
|
8250
|
-
|
|
8473
|
+
selectAll() {
|
|
8251
8474
|
this.update({
|
|
8252
|
-
|
|
8253
|
-
|
|
8475
|
+
defaultSelection: true,
|
|
8476
|
+
deselectedRows: [],
|
|
8477
|
+
selectedRows: []
|
|
8254
8478
|
});
|
|
8255
8479
|
}
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
key = `${key}`;
|
|
8259
|
-
if (this.allPositive === true) {
|
|
8260
|
-
if (this.allNegative === true) {
|
|
8261
|
-
throw 'Cannot have both positiveItems and negativeItems be "true"';
|
|
8262
|
-
}
|
|
8263
|
-
return !((_a = this.negativeMap) == null ? void 0 : _a.has(key));
|
|
8264
|
-
}
|
|
8265
|
-
return !!((_b = this.positiveMap) == null ? void 0 : _b.has(key));
|
|
8266
|
-
}
|
|
8267
|
-
isItemNegative(key) {
|
|
8268
|
-
return !this.isItemPositive(key);
|
|
8480
|
+
isRowDefaultSelected() {
|
|
8481
|
+
return this.defaultSelection === true;
|
|
8269
8482
|
}
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8483
|
+
isRowDefaultDeselected() {
|
|
8484
|
+
return this.defaultSelection === false;
|
|
8485
|
+
}
|
|
8486
|
+
isRowSelected(key, groupKeys) {
|
|
8487
|
+
groupKeys = groupKeys || this.getGroupKeysForPrimaryKey(key);
|
|
8488
|
+
const finalKey = [...groupKeys, key];
|
|
8489
|
+
const cachedResult = this.selectionCache.get(finalKey);
|
|
8490
|
+
if (cachedResult !== void 0) {
|
|
8491
|
+
return cachedResult;
|
|
8492
|
+
}
|
|
8493
|
+
const inSelected = this.selectedMap.has(finalKey);
|
|
8494
|
+
const inDeselected = this.deselectedMap.has(finalKey);
|
|
8495
|
+
if (inSelected) {
|
|
8496
|
+
this.selectionCache.set(finalKey, true);
|
|
8497
|
+
return true;
|
|
8275
8498
|
}
|
|
8276
|
-
if (
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8499
|
+
if (inDeselected) {
|
|
8500
|
+
this.selectionCache.set(finalKey, false);
|
|
8501
|
+
return false;
|
|
8502
|
+
}
|
|
8503
|
+
if (this.selectedMap.has(groupKeys)) {
|
|
8504
|
+
this.selectionCache.set(finalKey, true);
|
|
8505
|
+
return true;
|
|
8506
|
+
}
|
|
8507
|
+
if (this.deselectedMap.has(groupKeys)) {
|
|
8508
|
+
this.selectionCache.set(finalKey, false);
|
|
8509
|
+
return false;
|
|
8510
|
+
}
|
|
8511
|
+
groupKeys = [...groupKeys];
|
|
8512
|
+
while (groupKeys.length) {
|
|
8513
|
+
groupKeys.pop();
|
|
8514
|
+
const inSelected2 = this.selectedMap.has(groupKeys);
|
|
8515
|
+
const inDeselected2 = this.deselectedMap.has(groupKeys);
|
|
8516
|
+
if (inSelected2) {
|
|
8517
|
+
this.selectionCache.set(finalKey, true);
|
|
8518
|
+
return true;
|
|
8287
8519
|
}
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
throw `No negativeMap found when trying to set item ${key} be negative`;
|
|
8292
|
-
}
|
|
8293
|
-
this.negativeMap.set(key, true);
|
|
8294
|
-
} else if (this.allNegative === true) {
|
|
8295
|
-
if (!this.positiveMap) {
|
|
8296
|
-
throw `No positiveMap found when trying to set item ${key} be negative`;
|
|
8297
|
-
}
|
|
8298
|
-
(_a = this.positiveMap) == null ? void 0 : _a.delete(key);
|
|
8520
|
+
if (inDeselected2) {
|
|
8521
|
+
this.selectionCache.set(finalKey, false);
|
|
8522
|
+
return false;
|
|
8299
8523
|
}
|
|
8300
8524
|
}
|
|
8525
|
+
this.selectionCache.set(finalKey, this.defaultSelection);
|
|
8526
|
+
return this.defaultSelection;
|
|
8301
8527
|
}
|
|
8302
|
-
|
|
8303
|
-
this.
|
|
8304
|
-
}
|
|
8305
|
-
makeItemPositive(key) {
|
|
8306
|
-
this.setItemValue(key, true);
|
|
8307
|
-
}
|
|
8308
|
-
toggleItem(key) {
|
|
8309
|
-
this.setItemValue(key, !this.isItemPositive(key));
|
|
8528
|
+
isRowDeselected(key, groupKeys) {
|
|
8529
|
+
return !this.isRowSelected(key, groupKeys);
|
|
8310
8530
|
}
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
}
|
|
8318
|
-
var RowSelectionState = class extends BooleanCollectionState {
|
|
8319
|
-
constructor(state) {
|
|
8320
|
-
super(state);
|
|
8531
|
+
setRowSelected(key, selected, groupKeys) {
|
|
8532
|
+
if (selected) {
|
|
8533
|
+
this.setRowAsSelected(key, groupKeys);
|
|
8534
|
+
} else {
|
|
8535
|
+
this.setRowAsDeselected(key, groupKeys);
|
|
8536
|
+
}
|
|
8321
8537
|
}
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
};
|
|
8538
|
+
getGroupRowSelectionState(initialGroupKeys) {
|
|
8539
|
+
const cachedResult = this.selectionCache.get(initialGroupKeys);
|
|
8540
|
+
if (cachedResult !== void 0) {
|
|
8541
|
+
return cachedResult;
|
|
8542
|
+
}
|
|
8543
|
+
const { selectedCount, deselectedCount } = this.getSelectionCountFor(initialGroupKeys, this.getGroupRowBooleanSelectionStateFromParent(initialGroupKeys));
|
|
8544
|
+
const result = selectedCount && deselectedCount ? null : selectedCount ? true : false;
|
|
8545
|
+
this.selectionCache.set(initialGroupKeys, result);
|
|
8546
|
+
return result;
|
|
8328
8547
|
}
|
|
8329
|
-
|
|
8330
|
-
|
|
8548
|
+
getGroupRowBooleanSelectionStateFromParent(initialGroupKeys) {
|
|
8549
|
+
if (!initialGroupKeys.length) {
|
|
8550
|
+
return this.defaultSelection;
|
|
8551
|
+
}
|
|
8552
|
+
const groupKeys = [...initialGroupKeys];
|
|
8553
|
+
const selfDeselected = this.deselectedMap.has(groupKeys);
|
|
8554
|
+
const selfSelected = this.selectedMap.has(groupKeys);
|
|
8555
|
+
let selectionState = selfSelected && !selfDeselected ? true : selfDeselected && !selfSelected ? false : void 0;
|
|
8556
|
+
if (selectionState === void 0) {
|
|
8557
|
+
while (groupKeys.length) {
|
|
8558
|
+
groupKeys.pop();
|
|
8559
|
+
if (this.deselectedMap.has(groupKeys)) {
|
|
8560
|
+
selectionState = false;
|
|
8561
|
+
break;
|
|
8562
|
+
}
|
|
8563
|
+
if (this.selectedMap.has(groupKeys)) {
|
|
8564
|
+
selectionState = true;
|
|
8565
|
+
break;
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
}
|
|
8569
|
+
if (selectionState === void 0) {
|
|
8570
|
+
selectionState = this.defaultSelection;
|
|
8571
|
+
}
|
|
8572
|
+
return selectionState;
|
|
8331
8573
|
}
|
|
8332
|
-
|
|
8333
|
-
return
|
|
8574
|
+
isGroupRowPartlySelected(groupKeys) {
|
|
8575
|
+
return this.getGroupRowSelectionState(groupKeys) === null;
|
|
8334
8576
|
}
|
|
8335
|
-
|
|
8336
|
-
return this.
|
|
8577
|
+
isGroupRowSelected(groupKeys) {
|
|
8578
|
+
return this.getGroupRowSelectionState(groupKeys) === true;
|
|
8337
8579
|
}
|
|
8338
|
-
|
|
8339
|
-
return this.
|
|
8580
|
+
isGroupRowDeselected(groupKeys) {
|
|
8581
|
+
return this.getGroupRowSelectionState(groupKeys) === false;
|
|
8340
8582
|
}
|
|
8341
|
-
|
|
8342
|
-
this.
|
|
8583
|
+
selectGroupRow(groupKeys) {
|
|
8584
|
+
const selectedKeys = this.selectedMap.getKeysStartingWith(groupKeys, true);
|
|
8585
|
+
selectedKeys.forEach((groupKeys2) => {
|
|
8586
|
+
this.selectedMap.delete(groupKeys2);
|
|
8587
|
+
});
|
|
8588
|
+
this._selectedMapSet(groupKeys);
|
|
8589
|
+
const deselectedKeys = this.deselectedMap.getKeysStartingWith(groupKeys);
|
|
8590
|
+
deselectedKeys.forEach((groupKeys2) => {
|
|
8591
|
+
this.deselectedMap.delete(groupKeys2);
|
|
8592
|
+
});
|
|
8343
8593
|
}
|
|
8344
|
-
|
|
8345
|
-
this.
|
|
8594
|
+
deselectGroupRow(groupKeys) {
|
|
8595
|
+
const deselectedKeys = this.deselectedMap.getKeysStartingWith(groupKeys, true);
|
|
8596
|
+
deselectedKeys.forEach((groupKeys2) => {
|
|
8597
|
+
this.deselectedMap.delete(groupKeys2);
|
|
8598
|
+
});
|
|
8599
|
+
this._deselectedMapSet(groupKeys);
|
|
8600
|
+
const selectedKeys = this.selectedMap.getKeysStartingWith(groupKeys);
|
|
8601
|
+
selectedKeys.forEach((groupKeys2) => {
|
|
8602
|
+
this.selectedMap.delete(groupKeys2);
|
|
8603
|
+
});
|
|
8346
8604
|
}
|
|
8347
|
-
|
|
8348
|
-
|
|
8605
|
+
setRowAsSelected(key, groupKeys) {
|
|
8606
|
+
groupKeys = groupKeys || this.getGroupKeysForPrimaryKey(key);
|
|
8607
|
+
const finalKey = [...groupKeys, key];
|
|
8608
|
+
this.deselectedMap.delete(finalKey);
|
|
8609
|
+
this.xcache();
|
|
8610
|
+
if (this.getGroupRowSelectionState(groupKeys) !== true) {
|
|
8611
|
+
this._selectedMapSet(finalKey);
|
|
8612
|
+
if (this.getGroupRowSelectionState(groupKeys) === true) {
|
|
8613
|
+
this.selectGroupRow(groupKeys);
|
|
8614
|
+
}
|
|
8615
|
+
}
|
|
8349
8616
|
}
|
|
8350
|
-
|
|
8351
|
-
|
|
8617
|
+
setRowAsDeselected(key, groupKeys) {
|
|
8618
|
+
groupKeys = groupKeys || this.getGroupKeysForPrimaryKey(key);
|
|
8619
|
+
const finalKey = [...groupKeys, key];
|
|
8620
|
+
this.selectedMap.delete(finalKey);
|
|
8621
|
+
if (this.getGroupRowSelectionState(groupKeys) !== false) {
|
|
8622
|
+
this._deselectedMapSet(finalKey);
|
|
8623
|
+
if (this.getGroupRowSelectionState(groupKeys) === false) {
|
|
8624
|
+
this.deselectGroupRow(groupKeys);
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8352
8627
|
}
|
|
8353
|
-
|
|
8354
|
-
|
|
8628
|
+
deselectRow(key, groupKeys) {
|
|
8629
|
+
this.setRowSelected(key, false, groupKeys);
|
|
8355
8630
|
}
|
|
8356
|
-
|
|
8357
|
-
|
|
8631
|
+
selectRow(key, groupKeys) {
|
|
8632
|
+
this.setRowSelected(key, true, groupKeys);
|
|
8358
8633
|
}
|
|
8359
|
-
|
|
8360
|
-
|
|
8634
|
+
toggleGroupRowSelection(groupKeys) {
|
|
8635
|
+
const groupRowSelectionState = this.getGroupRowSelectionState(groupKeys);
|
|
8636
|
+
if (groupRowSelectionState === true) {
|
|
8637
|
+
this.deselectGroupRow(groupKeys);
|
|
8638
|
+
} else {
|
|
8639
|
+
this.selectGroupRow(groupKeys);
|
|
8640
|
+
}
|
|
8361
8641
|
}
|
|
8362
|
-
|
|
8363
|
-
this.
|
|
8642
|
+
toggleRowSelection(key, groupKeys) {
|
|
8643
|
+
if (this.isRowSelected(key, groupKeys)) {
|
|
8644
|
+
this.deselectRow(key, groupKeys);
|
|
8645
|
+
} else {
|
|
8646
|
+
this.selectRow(key, groupKeys);
|
|
8647
|
+
}
|
|
8364
8648
|
}
|
|
8365
|
-
|
|
8366
|
-
this.
|
|
8649
|
+
getSelectedCount() {
|
|
8650
|
+
return this.getSelectionCountFor([]).selectedCount;
|
|
8367
8651
|
}
|
|
8368
|
-
|
|
8369
|
-
this.
|
|
8652
|
+
getDeselectedCount() {
|
|
8653
|
+
return this.getSelectionCountFor([]).deselectedCount;
|
|
8370
8654
|
}
|
|
8371
|
-
|
|
8655
|
+
getSelectionCountFor(groupKeys = [], parentSelected) {
|
|
8372
8656
|
var _a, _b;
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
return
|
|
8376
|
-
}
|
|
8377
|
-
|
|
8657
|
+
const cachedResult = this.selectionCountCache.get(groupKeys);
|
|
8658
|
+
if (cachedResult != null) {
|
|
8659
|
+
return cachedResult;
|
|
8660
|
+
}
|
|
8661
|
+
if (groupKeys.length > this.getGroupByLength()) {
|
|
8662
|
+
const result2 = this.isRowSelected(groupKeys) ? { selectedCount: 1, deselectedCount: 0 } : {
|
|
8663
|
+
selectedCount: 0,
|
|
8664
|
+
deselectedCount: 1
|
|
8665
|
+
};
|
|
8666
|
+
this.selectionCountCache.set(groupKeys, result2);
|
|
8667
|
+
return result2;
|
|
8668
|
+
}
|
|
8669
|
+
parentSelected = parentSelected != null ? parentSelected : this.getGroupRowBooleanSelectionStateFromParent(groupKeys);
|
|
8670
|
+
let allKeys = this.getGroupKeysDirectlyInsideGroup(groupKeys);
|
|
8671
|
+
if (groupKeys.length === this.getGroupByLength()) {
|
|
8672
|
+
const selectionState = this.selectedMap.has(groupKeys) ? true : this.deselectedMap.has(groupKeys) ? false : parentSelected;
|
|
8673
|
+
const totalCount = this.getGroupCount(groupKeys);
|
|
8674
|
+
let selectedCount2 = this.selectedMap.getKeysStartingWith(groupKeys, true, 1).length;
|
|
8675
|
+
let deselectedCount2 = this.deselectedMap.getKeysStartingWith(groupKeys, true, 1).length;
|
|
8676
|
+
const notSpecifiedCount = totalCount - (selectedCount2 + deselectedCount2);
|
|
8677
|
+
const result2 = {
|
|
8678
|
+
selectedCount: selectedCount2 + (selectionState ? notSpecifiedCount : 0),
|
|
8679
|
+
deselectedCount: deselectedCount2 + (selectionState ? 0 : notSpecifiedCount)
|
|
8680
|
+
};
|
|
8681
|
+
this.selectionCountCache.set(groupKeys, result2);
|
|
8682
|
+
return result2;
|
|
8683
|
+
}
|
|
8684
|
+
let selectedCount = 0;
|
|
8685
|
+
let deselectedCount = 0;
|
|
8686
|
+
if (this.getConfig().lazyLoad && !allKeys.length) {
|
|
8687
|
+
const totalChildrenCount = ((_b = (_a = this.getConfig().groupDeepMap) == null ? void 0 : _a.get(groupKeys)) == null ? void 0 : _b.totalChildrenCount) || 0;
|
|
8688
|
+
if (parentSelected) {
|
|
8689
|
+
selectedCount = totalChildrenCount;
|
|
8690
|
+
deselectedCount = this.deselectedMap.getAllChildrenSizeFor(groupKeys);
|
|
8691
|
+
if (deselectedCount === totalChildrenCount) {
|
|
8692
|
+
selectedCount = 0;
|
|
8693
|
+
}
|
|
8694
|
+
} else {
|
|
8695
|
+
deselectedCount = totalChildrenCount;
|
|
8696
|
+
selectedCount = this.selectedMap.getAllChildrenSizeFor(groupKeys);
|
|
8697
|
+
if (selectedCount === totalChildrenCount) {
|
|
8698
|
+
deselectedCount = 0;
|
|
8699
|
+
}
|
|
8700
|
+
}
|
|
8701
|
+
}
|
|
8702
|
+
allKeys.forEach((keys) => {
|
|
8703
|
+
let isSelected = this.selectedMap.get(keys);
|
|
8704
|
+
let isDeselected = this.deselectedMap.get(keys);
|
|
8705
|
+
const selected = isSelected ? true : isDeselected ? false : parentSelected;
|
|
8706
|
+
const { selectedCount: selCount, deselectedCount: deselCount } = this.getSelectionCountFor(keys, selected);
|
|
8707
|
+
selectedCount += selCount;
|
|
8708
|
+
deselectedCount += deselCount;
|
|
8709
|
+
});
|
|
8710
|
+
const result = {
|
|
8711
|
+
selectedCount,
|
|
8712
|
+
deselectedCount
|
|
8713
|
+
};
|
|
8714
|
+
this.selectionCountCache.set(groupKeys, result);
|
|
8715
|
+
return result;
|
|
8378
8716
|
}
|
|
8379
8717
|
};
|
|
8380
8718
|
|
|
8719
|
+
// src/components/InfiniteTable/api/getSelectionApi.ts
|
|
8720
|
+
function rowSelectionStateConfigGetter(stateOrStateGetter) {
|
|
8721
|
+
return () => {
|
|
8722
|
+
const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
|
|
8723
|
+
return {
|
|
8724
|
+
lazyLoad: !!state.lazyLoad,
|
|
8725
|
+
groupBy: state.groupBy,
|
|
8726
|
+
groupDeepMap: state.groupDeepMap,
|
|
8727
|
+
indexer: state.indexer,
|
|
8728
|
+
totalCount: state.unfilteredCount
|
|
8729
|
+
};
|
|
8730
|
+
};
|
|
8731
|
+
}
|
|
8732
|
+
function getSelectionApi(param) {
|
|
8733
|
+
const {
|
|
8734
|
+
getDataSourceState,
|
|
8735
|
+
dataSourceActions
|
|
8736
|
+
} = param;
|
|
8737
|
+
const selectionApi = {
|
|
8738
|
+
get allRowsSelected() {
|
|
8739
|
+
return getDataSourceState().allRowsSelected;
|
|
8740
|
+
},
|
|
8741
|
+
selectAll() {
|
|
8742
|
+
const { rowSelection, selectionMode } = getDataSourceState();
|
|
8743
|
+
if (selectionMode !== "multi-row") {
|
|
8744
|
+
throw "Selection mode is not multi-row";
|
|
8745
|
+
}
|
|
8746
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8747
|
+
throw "Invalid row selection";
|
|
8748
|
+
}
|
|
8749
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8750
|
+
rowSelectionState.selectAll();
|
|
8751
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8752
|
+
},
|
|
8753
|
+
deselectAll() {
|
|
8754
|
+
const { rowSelection, selectionMode } = getDataSourceState();
|
|
8755
|
+
if (selectionMode !== "multi-row") {
|
|
8756
|
+
throw "Selection mode is not multi-row";
|
|
8757
|
+
}
|
|
8758
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8759
|
+
throw "Invalid row selection";
|
|
8760
|
+
}
|
|
8761
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8762
|
+
rowSelectionState.deselectAll();
|
|
8763
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8764
|
+
},
|
|
8765
|
+
isRowSelected(pk, groupKeys) {
|
|
8766
|
+
const { rowSelection, selectionMode, indexer, groupBy } = getDataSourceState();
|
|
8767
|
+
if (selectionMode === "single-row") {
|
|
8768
|
+
return rowSelection === pk;
|
|
8769
|
+
}
|
|
8770
|
+
if (selectionMode !== "multi-row") {
|
|
8771
|
+
throw "Selection mode is not multi-row or single-row";
|
|
8772
|
+
}
|
|
8773
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8774
|
+
throw "Invalid row selection";
|
|
8775
|
+
}
|
|
8776
|
+
if (!groupKeys) {
|
|
8777
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8778
|
+
groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8779
|
+
}
|
|
8780
|
+
return rowSelection.isRowSelected(pk, groupKeys);
|
|
8781
|
+
},
|
|
8782
|
+
isRowDeselected(pk, groupKeys) {
|
|
8783
|
+
return !this.isRowSelected(pk, groupKeys);
|
|
8784
|
+
},
|
|
8785
|
+
selectRow(pk, groupKeys) {
|
|
8786
|
+
const { rowSelection, selectionMode, indexer, groupBy } = getDataSourceState();
|
|
8787
|
+
if (selectionMode === "single-row") {
|
|
8788
|
+
dataSourceActions.rowSelection = pk;
|
|
8789
|
+
return;
|
|
8790
|
+
}
|
|
8791
|
+
if (selectionMode !== "multi-row") {
|
|
8792
|
+
throw "Selection mode is not multi-row or single-row";
|
|
8793
|
+
}
|
|
8794
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8795
|
+
throw "Invalid row selection";
|
|
8796
|
+
}
|
|
8797
|
+
if (!groupKeys) {
|
|
8798
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8799
|
+
groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8800
|
+
}
|
|
8801
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8802
|
+
rowSelectionState.selectRow(pk, groupKeys);
|
|
8803
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8804
|
+
},
|
|
8805
|
+
deselectRow(pk, groupKeys) {
|
|
8806
|
+
const { selectionMode, rowSelection, indexer, groupBy } = getDataSourceState();
|
|
8807
|
+
if (selectionMode === "single-row") {
|
|
8808
|
+
dataSourceActions.rowSelection = null;
|
|
8809
|
+
return;
|
|
8810
|
+
}
|
|
8811
|
+
if (selectionMode !== "multi-row") {
|
|
8812
|
+
throw "Selection mode is not multi-row or single-row";
|
|
8813
|
+
}
|
|
8814
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8815
|
+
throw "Invalid row selection";
|
|
8816
|
+
}
|
|
8817
|
+
if (selectionMode === "multi-row") {
|
|
8818
|
+
if (!groupKeys) {
|
|
8819
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8820
|
+
groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8821
|
+
}
|
|
8822
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8823
|
+
rowSelectionState.deselectRow(pk, groupKeys);
|
|
8824
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8825
|
+
}
|
|
8826
|
+
},
|
|
8827
|
+
toggleRowSelection(pk, groupKeys) {
|
|
8828
|
+
if (this.isRowSelected(pk, groupKeys)) {
|
|
8829
|
+
this.deselectRow(pk, groupKeys);
|
|
8830
|
+
} else {
|
|
8831
|
+
this.selectRow(pk, groupKeys);
|
|
8832
|
+
}
|
|
8833
|
+
},
|
|
8834
|
+
selectGroupRow(groupKeys) {
|
|
8835
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8836
|
+
if (selectionMode !== "multi-row") {
|
|
8837
|
+
throw 'Selection mode should be "multi-row"';
|
|
8838
|
+
}
|
|
8839
|
+
if (!groupBy) {
|
|
8840
|
+
throw "No grouping specified";
|
|
8841
|
+
}
|
|
8842
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8843
|
+
throw "Invalid row selection";
|
|
8844
|
+
}
|
|
8845
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8846
|
+
rowSelectionState.selectGroupRow(groupKeys);
|
|
8847
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8848
|
+
},
|
|
8849
|
+
deselectGroupRow(groupKeys) {
|
|
8850
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8851
|
+
if (selectionMode !== "multi-row") {
|
|
8852
|
+
throw 'Selection mode should be "multi-row"';
|
|
8853
|
+
}
|
|
8854
|
+
if (!groupBy) {
|
|
8855
|
+
throw "No grouping specified";
|
|
8856
|
+
}
|
|
8857
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8858
|
+
throw "Invalid row selection";
|
|
8859
|
+
}
|
|
8860
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8861
|
+
rowSelectionState.deselectGroupRow(groupKeys);
|
|
8862
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8863
|
+
},
|
|
8864
|
+
toggleGroupRowSelection(groupKeys) {
|
|
8865
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8866
|
+
if (selectionMode !== "multi-row") {
|
|
8867
|
+
throw 'Selection mode should be "multi-row"';
|
|
8868
|
+
}
|
|
8869
|
+
if (!groupBy) {
|
|
8870
|
+
throw "No grouping specified";
|
|
8871
|
+
}
|
|
8872
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8873
|
+
throw "Invalid row selection";
|
|
8874
|
+
}
|
|
8875
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8876
|
+
rowSelectionState.toggleGroupRowSelection(groupKeys);
|
|
8877
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8878
|
+
},
|
|
8879
|
+
getGroupRowSelectionState(groupKeys) {
|
|
8880
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8881
|
+
if (selectionMode !== "multi-row") {
|
|
8882
|
+
throw 'Selection mode should be "multi-row"';
|
|
8883
|
+
}
|
|
8884
|
+
if (!groupBy) {
|
|
8885
|
+
throw "No grouping specified";
|
|
8886
|
+
}
|
|
8887
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8888
|
+
throw "Invalid row selection";
|
|
8889
|
+
}
|
|
8890
|
+
return rowSelection.getGroupRowSelectionState(groupKeys);
|
|
8891
|
+
},
|
|
8892
|
+
getSelectedPrimaryKeys: () => {
|
|
8893
|
+
const selected = [];
|
|
8894
|
+
getDataSourceState().dataArray.forEach((rowInfo) => {
|
|
8895
|
+
if (!rowInfo.isGroupRow && rowInfo.rowSelected) {
|
|
8896
|
+
selected.push(rowInfo.id);
|
|
8897
|
+
}
|
|
8898
|
+
});
|
|
8899
|
+
return selected;
|
|
8900
|
+
}
|
|
8901
|
+
};
|
|
8902
|
+
if (false) {
|
|
8903
|
+
globalThis.selectionApi = selectionApi;
|
|
8904
|
+
}
|
|
8905
|
+
return selectionApi;
|
|
8906
|
+
}
|
|
8907
|
+
|
|
8381
8908
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
8382
8909
|
var map = new WeakMap();
|
|
8383
8910
|
var getCompareDefault = (a) => a;
|
|
@@ -8409,22 +8936,23 @@ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
|
8409
8936
|
// src/components/DataSource/Indexer.ts
|
|
8410
8937
|
var Indexer = class {
|
|
8411
8938
|
constructor() {
|
|
8412
|
-
this.
|
|
8413
|
-
this.
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
this.
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8939
|
+
this.primaryKeyToData = new Map();
|
|
8940
|
+
this.add = (primaryKey, data) => {
|
|
8941
|
+
this.primaryKeyToData.set(`${primaryKey}`, data);
|
|
8942
|
+
};
|
|
8943
|
+
this.clear = () => {
|
|
8944
|
+
this.primaryKeyToData.clear();
|
|
8945
|
+
};
|
|
8946
|
+
this.getDataForPrimaryKey = (primaryKey) => {
|
|
8947
|
+
return this.primaryKeyToData.get(`${primaryKey}`);
|
|
8948
|
+
};
|
|
8949
|
+
this.indexArray = (arr, toPrimaryKey) => {
|
|
8950
|
+
arr.forEach((item) => {
|
|
8951
|
+
if (item != null) {
|
|
8952
|
+
this.add(toPrimaryKey(item), item);
|
|
8953
|
+
}
|
|
8954
|
+
});
|
|
8955
|
+
};
|
|
8428
8956
|
}
|
|
8429
8957
|
};
|
|
8430
8958
|
|
|
@@ -8485,7 +9013,7 @@ function initSetupState() {
|
|
|
8485
9013
|
groupDeepMap: void 0,
|
|
8486
9014
|
reducerResults: void 0,
|
|
8487
9015
|
allRowsSelected: false,
|
|
8488
|
-
|
|
9016
|
+
someRowsSelected: false,
|
|
8489
9017
|
postSortDataArray: void 0,
|
|
8490
9018
|
postGroupDataArray: void 0,
|
|
8491
9019
|
lastSortDataArray: void 0,
|
|
@@ -8541,7 +9069,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
8541
9069
|
return livePaginationCursor;
|
|
8542
9070
|
}
|
|
8543
9071
|
function mapPropsToState(params) {
|
|
8544
|
-
var _a, _b
|
|
9072
|
+
var _a, _b;
|
|
8545
9073
|
const { props, state, oldState } = params;
|
|
8546
9074
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
8547
9075
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -8568,36 +9096,34 @@ function mapPropsToState(params) {
|
|
|
8568
9096
|
selectionMode = "single-row";
|
|
8569
9097
|
}
|
|
8570
9098
|
}
|
|
8571
|
-
selectionMode = selectionMode != null ? selectionMode :
|
|
9099
|
+
selectionMode = selectionMode != null ? selectionMode : false;
|
|
8572
9100
|
}
|
|
8573
9101
|
}
|
|
8574
9102
|
let rowSelectionState = null;
|
|
8575
|
-
let currentRowSelection = props.rowSelection !== void 0 ? props.rowSelection :
|
|
9103
|
+
let currentRowSelection = props.rowSelection !== void 0 ? props.rowSelection : state.rowSelection === void 0 ? props.defaultRowSelection !== void 0 ? props.defaultRowSelection : null : state.rowSelection;
|
|
8576
9104
|
if (selectionMode !== false) {
|
|
8577
9105
|
if (selectionMode === "single-row" || selectionMode === "multi-row") {
|
|
8578
9106
|
if (currentRowSelection === null) {
|
|
8579
9107
|
rowSelectionState = selectionMode === "single-row" ? null : new RowSelectionState({
|
|
8580
|
-
selectedRows:
|
|
8581
|
-
deselectedRows:
|
|
8582
|
-
|
|
9108
|
+
selectedRows: [],
|
|
9109
|
+
deselectedRows: [],
|
|
9110
|
+
defaultSelection: false
|
|
9111
|
+
}, rowSelectionStateConfigGetter(state));
|
|
8583
9112
|
} else {
|
|
8584
|
-
rowSelectionState = selectionMode === "single-row" ? currentRowSelection : currentRowSelection instanceof RowSelectionState ? currentRowSelection : new RowSelectionState(currentRowSelection);
|
|
9113
|
+
rowSelectionState = selectionMode === "single-row" ? currentRowSelection : currentRowSelection instanceof RowSelectionState ? currentRowSelection : new RowSelectionState(currentRowSelection, rowSelectionStateConfigGetter(state));
|
|
8585
9114
|
}
|
|
8586
9115
|
}
|
|
8587
9116
|
}
|
|
8588
9117
|
const primaryKeyDescriptor = state.primaryKey;
|
|
8589
|
-
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data
|
|
8590
|
-
const pk = data[primaryKeyDescriptor];
|
|
8591
|
-
return pk;
|
|
8592
|
-
};
|
|
9118
|
+
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
|
|
8593
9119
|
const result = {
|
|
8594
9120
|
selectionMode,
|
|
9121
|
+
rowSelection: rowSelectionState,
|
|
8595
9122
|
toPrimaryKey,
|
|
8596
|
-
rowSelection: rowSelectionState != null ? rowSelectionState : null,
|
|
8597
9123
|
operatorsByFilterType,
|
|
8598
9124
|
controlledSort,
|
|
8599
9125
|
controlledFilter,
|
|
8600
|
-
filterMode: ((
|
|
9126
|
+
filterMode: ((_b = props.filterMode) != null ? _b : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
8601
9127
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
8602
9128
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
8603
9129
|
};
|
|
@@ -8629,20 +9155,17 @@ function getMappedCallbacks() {
|
|
|
8629
9155
|
rowSelection: (rowSelection, state) => {
|
|
8630
9156
|
if (state.selectionMode === "single-row") {
|
|
8631
9157
|
return {
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
9158
|
+
callbackParams: [
|
|
9159
|
+
rowSelection,
|
|
9160
|
+
"single-row"
|
|
9161
|
+
]
|
|
8636
9162
|
};
|
|
8637
9163
|
}
|
|
8638
9164
|
return {
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
},
|
|
8644
|
-
rowSelectionState: rowSelection
|
|
8645
|
-
}
|
|
9165
|
+
callbackParams: [
|
|
9166
|
+
rowSelection.getState(),
|
|
9167
|
+
"multi-row"
|
|
9168
|
+
]
|
|
8646
9169
|
};
|
|
8647
9170
|
}
|
|
8648
9171
|
};
|
|
@@ -8994,16 +9517,16 @@ function filterDataSource(params) {
|
|
|
8994
9517
|
return dataArray;
|
|
8995
9518
|
}
|
|
8996
9519
|
function concludeReducer(params) {
|
|
8997
|
-
var _a, _b
|
|
9520
|
+
var _a, _b;
|
|
8998
9521
|
const { state, previousState } = params;
|
|
8999
|
-
const primaryKeyDescriptor = state.primaryKey;
|
|
9000
9522
|
const sortInfo = state.sortInfo;
|
|
9001
9523
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
9002
9524
|
if (state.lazyLoad || state.livePagination) {
|
|
9003
9525
|
shouldSort = false;
|
|
9004
9526
|
}
|
|
9005
9527
|
let originalDataArrayChanged = haveDepsChanged(previousState, state, [
|
|
9006
|
-
"originalDataArray"
|
|
9528
|
+
"originalDataArray",
|
|
9529
|
+
"originalLazyGroupDataChangeDetect"
|
|
9007
9530
|
]);
|
|
9008
9531
|
const dataSourceChange = previousState && state.data !== previousState.data;
|
|
9009
9532
|
let lazyLoadGroupDataChange = state.lazyLoad && previousState && (previousState.groupBy !== state.groupBy || previousState.sortInfo !== state.sortInfo);
|
|
@@ -9014,6 +9537,13 @@ function concludeReducer(params) {
|
|
|
9014
9537
|
state.originalLazyGroupData = new DeepMap();
|
|
9015
9538
|
originalDataArrayChanged = true;
|
|
9016
9539
|
}
|
|
9540
|
+
const shouldIndex = originalDataArrayChanged;
|
|
9541
|
+
if (shouldIndex) {
|
|
9542
|
+
state.indexer.clear();
|
|
9543
|
+
if (!state.lazyLoad) {
|
|
9544
|
+
state.indexer.indexArray(state.originalDataArray, state.toPrimaryKey);
|
|
9545
|
+
}
|
|
9546
|
+
}
|
|
9017
9547
|
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
9018
9548
|
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
9019
9549
|
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
@@ -9032,7 +9562,8 @@ function concludeReducer(params) {
|
|
|
9032
9562
|
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
9033
9563
|
const selectionDepsChanged = haveDepsChanged(previousState, state, [
|
|
9034
9564
|
"rowSelection",
|
|
9035
|
-
"isRowSelected"
|
|
9565
|
+
"isRowSelected",
|
|
9566
|
+
"originalLazyGroupDataChangeDetect"
|
|
9036
9567
|
]);
|
|
9037
9568
|
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
9038
9569
|
"generateGroupRows",
|
|
@@ -9046,13 +9577,10 @@ function concludeReducer(params) {
|
|
|
9046
9577
|
"pivotGrandTotalColumnPosition",
|
|
9047
9578
|
"showSeparatePivotColumnForSingleAggregation"
|
|
9048
9579
|
]);
|
|
9049
|
-
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray) || selectionDepsChanged
|
|
9580
|
+
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray) || selectionDepsChanged;
|
|
9050
9581
|
const now = Date.now();
|
|
9051
9582
|
let dataArray = state.originalDataArray;
|
|
9052
|
-
const toPrimaryKey =
|
|
9053
|
-
const pk = data[primaryKeyDescriptor];
|
|
9054
|
-
return pk;
|
|
9055
|
-
};
|
|
9583
|
+
const toPrimaryKey = state.toPrimaryKey;
|
|
9056
9584
|
if (!shouldFilter) {
|
|
9057
9585
|
state.unfilteredCount = dataArray.length;
|
|
9058
9586
|
}
|
|
@@ -9082,60 +9610,47 @@ function concludeReducer(params) {
|
|
|
9082
9610
|
}
|
|
9083
9611
|
state.postSortDataArray = dataArray;
|
|
9084
9612
|
let rowInfoDataArray = state.dataArray;
|
|
9613
|
+
const rowSelectionState = state.rowSelection instanceof RowSelectionState ? state.rowSelection : void 0;
|
|
9614
|
+
rowSelectionState == null ? void 0 : rowSelectionState.xcache();
|
|
9085
9615
|
let isRowSelected = state.selectionMode === "single-row" ? (rowInfo) => {
|
|
9086
9616
|
return rowInfo.id === state.rowSelection;
|
|
9087
9617
|
} : state.selectionMode === "multi-row" ? (rowInfo) => {
|
|
9088
|
-
|
|
9618
|
+
const rowSelection = rowSelectionState;
|
|
9619
|
+
return rowInfo.isGroupRow ? rowSelection.getGroupRowSelectionState(rowInfo.groupKeys) : rowSelection.isRowSelected(rowInfo.id, rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0);
|
|
9089
9620
|
} : void 0;
|
|
9090
|
-
if (state.isRowSelected) {
|
|
9091
|
-
isRowSelected = (rowInfo) => state.isRowSelected(rowInfo,
|
|
9621
|
+
if (state.isRowSelected && state.selectionMode === "multi-row") {
|
|
9622
|
+
isRowSelected = (rowInfo) => state.isRowSelected(rowInfo, rowSelectionState, state.selectionMode);
|
|
9092
9623
|
}
|
|
9093
9624
|
if (shouldGroup) {
|
|
9094
9625
|
if (shouldGroupAgain) {
|
|
9095
9626
|
let aggregationReducers = state.aggregationReducers;
|
|
9096
|
-
if (state.selectionMode === "multi-row") {
|
|
9097
|
-
const groupSelectedReducer = {
|
|
9098
|
-
initialValue: true,
|
|
9099
|
-
reducer: (groupSelected, _value, data, index) => {
|
|
9100
|
-
const rowId = toPrimaryKey(data, index);
|
|
9101
|
-
return groupSelected && state.rowSelection.isRowSelected(rowId);
|
|
9102
|
-
}
|
|
9103
|
-
};
|
|
9104
|
-
const groupChildrenSelectedCountReducer = {
|
|
9105
|
-
initialValue: 0,
|
|
9106
|
-
reducer: (selectedCount, _value, data, index) => {
|
|
9107
|
-
const rowId = toPrimaryKey(data, index);
|
|
9108
|
-
return selectedCount + state.rowSelection.isRowSelected(rowId);
|
|
9109
|
-
}
|
|
9110
|
-
};
|
|
9111
|
-
aggregationReducers = __spreadProps(__spreadValues({}, aggregationReducers), {
|
|
9112
|
-
[GROUP_SELECTED_REDUCER_KEY]: groupSelectedReducer,
|
|
9113
|
-
[GROUP_CHILDREN_SELECTED_COUNT_KEY]: groupChildrenSelectedCountReducer
|
|
9114
|
-
});
|
|
9115
|
-
}
|
|
9116
9627
|
const groupResult = state.lazyLoad ? lazyGroup({
|
|
9117
9628
|
groupBy,
|
|
9118
9629
|
pivot: pivotBy,
|
|
9119
9630
|
mappings: state.pivotMappings,
|
|
9120
|
-
reducers: aggregationReducers
|
|
9631
|
+
reducers: aggregationReducers,
|
|
9632
|
+
indexer: state.indexer,
|
|
9633
|
+
toPrimaryKey
|
|
9121
9634
|
}, state.originalLazyGroupData) : group({
|
|
9122
9635
|
groupBy,
|
|
9123
9636
|
pivot: pivotBy,
|
|
9124
9637
|
reducers: aggregationReducers
|
|
9125
9638
|
}, dataArray);
|
|
9126
|
-
state.
|
|
9639
|
+
state.groupDeepMap = groupResult.deepMap;
|
|
9640
|
+
if (rowSelectionState) {
|
|
9641
|
+
rowSelectionState.getConfig = rowSelectionStateConfigGetter(state);
|
|
9642
|
+
}
|
|
9127
9643
|
const flattenResult = enhancedFlatten({
|
|
9128
9644
|
groupResult,
|
|
9129
9645
|
lazyLoad: !!state.lazyLoad,
|
|
9130
9646
|
reducers: aggregationReducers,
|
|
9131
9647
|
toPrimaryKey,
|
|
9132
9648
|
isRowSelected,
|
|
9133
|
-
|
|
9649
|
+
rowSelectionState,
|
|
9134
9650
|
groupRowsState: state.groupRowsState,
|
|
9135
9651
|
generateGroupRows: state.generateGroupRows
|
|
9136
9652
|
});
|
|
9137
9653
|
rowInfoDataArray = flattenResult.data;
|
|
9138
|
-
state.groupDeepMap = groupResult.deepMap;
|
|
9139
9654
|
state.reducerResults = groupResult.reducerResults;
|
|
9140
9655
|
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
9141
9656
|
deepMap: groupResult.topLevelPivotColumns,
|
|
@@ -9157,10 +9672,8 @@ function concludeReducer(params) {
|
|
|
9157
9672
|
state.pivotColumns = void 0;
|
|
9158
9673
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
9159
9674
|
if (arrayDifferentAfterSortStep || groupsDepsChanged || selectionDepsChanged) {
|
|
9160
|
-
state.indexer.clear();
|
|
9161
9675
|
rowInfoDataArray = dataArray.map((data, index) => {
|
|
9162
|
-
const rowInfo = toRowInfo(data, data ? toPrimaryKey(data
|
|
9163
|
-
state.indexer.add(index, rowInfo.id);
|
|
9676
|
+
const rowInfo = toRowInfo(data, data ? toPrimaryKey(data) : index, index, isRowSelected);
|
|
9164
9677
|
return rowInfo;
|
|
9165
9678
|
});
|
|
9166
9679
|
}
|
|
@@ -9172,13 +9685,27 @@ function concludeReducer(params) {
|
|
|
9172
9685
|
state.dataArray = rowInfoDataArray;
|
|
9173
9686
|
state.reducedAt = now;
|
|
9174
9687
|
if (state.selectionMode === "multi-row") {
|
|
9175
|
-
if (shouldGroup) {
|
|
9176
|
-
|
|
9177
|
-
|
|
9688
|
+
if (shouldGroup && state.lazyLoad) {
|
|
9689
|
+
let allRowsSelected = true;
|
|
9690
|
+
let someRowsSelected = false;
|
|
9691
|
+
state.dataArray.forEach((rowInfo) => {
|
|
9692
|
+
if (rowInfo.isGroupRow && rowInfo.groupKeys.length === 1) {
|
|
9693
|
+
const { rowSelected } = rowInfo;
|
|
9694
|
+
if (rowSelected !== true) {
|
|
9695
|
+
allRowsSelected = false;
|
|
9696
|
+
}
|
|
9697
|
+
if (rowSelected === true || rowSelected === null) {
|
|
9698
|
+
someRowsSelected = true;
|
|
9699
|
+
}
|
|
9700
|
+
}
|
|
9701
|
+
});
|
|
9702
|
+
state.allRowsSelected = allRowsSelected;
|
|
9703
|
+
state.someRowsSelected = someRowsSelected;
|
|
9178
9704
|
} else {
|
|
9179
|
-
const dataArrayCount = state.
|
|
9180
|
-
|
|
9181
|
-
state.allRowsSelected = dataArrayCount ===
|
|
9705
|
+
const dataArrayCount = state.filteredCount;
|
|
9706
|
+
const selectedRowCount = state.rowSelection.getSelectedCount();
|
|
9707
|
+
state.allRowsSelected = dataArrayCount === selectedRowCount;
|
|
9708
|
+
state.someRowsSelected = selectedRowCount > 0;
|
|
9182
9709
|
}
|
|
9183
9710
|
}
|
|
9184
9711
|
if (false) {
|
|
@@ -9222,6 +9749,7 @@ function DataSourceCmp({ children }) {
|
|
|
9222
9749
|
};
|
|
9223
9750
|
if (false) {
|
|
9224
9751
|
globalThis.getDataSourceState = getState;
|
|
9752
|
+
globalThis.dataSourceActions = componentActions;
|
|
9225
9753
|
}
|
|
9226
9754
|
useLoadData();
|
|
9227
9755
|
return /* @__PURE__ */ React33.createElement(DataSourceContext.Provider, {
|
|
@@ -9236,128 +9764,42 @@ function DataSource(props) {
|
|
|
9236
9764
|
}));
|
|
9237
9765
|
}
|
|
9238
9766
|
|
|
9239
|
-
// src/components/InfiniteTable/getImperativeApi.ts
|
|
9240
|
-
function getImperativeApi(
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
groupResult.items.forEach((data) => {
|
|
9253
|
-
const id = toPrimaryKey(data);
|
|
9254
|
-
if (selected) {
|
|
9255
|
-
rowSelectionState.selectRow(id);
|
|
9256
|
-
} else {
|
|
9257
|
-
rowSelectionState.deselectRow(id);
|
|
9258
|
-
}
|
|
9259
|
-
});
|
|
9260
|
-
}
|
|
9261
|
-
const primaryKey = `${groupKeys}`;
|
|
9262
|
-
const index = getDataSourceState().indexer.getIndexOf(primaryKey);
|
|
9263
|
-
if (index != null) {
|
|
9264
|
-
const rowInfo = getDataSourceState().dataArray[index];
|
|
9265
|
-
rowInfo.deepRowInfoArray.forEach((rowInfo2) => {
|
|
9266
|
-
if (!rowInfo2.isGroupRow) {
|
|
9267
|
-
if (selected) {
|
|
9268
|
-
rowSelectionState.selectRow(rowInfo2.id);
|
|
9269
|
-
} else {
|
|
9270
|
-
rowSelectionState.deselectRow(rowInfo2.id);
|
|
9271
|
-
}
|
|
9272
|
-
}
|
|
9273
|
-
});
|
|
9274
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9275
|
-
return true;
|
|
9276
|
-
}
|
|
9277
|
-
}
|
|
9278
|
-
return false;
|
|
9279
|
-
}
|
|
9767
|
+
// src/components/InfiniteTable/api/getImperativeApi.ts
|
|
9768
|
+
function getImperativeApi(param) {
|
|
9769
|
+
const {
|
|
9770
|
+
getComputed,
|
|
9771
|
+
getState,
|
|
9772
|
+
getDataSourceState,
|
|
9773
|
+
componentActions,
|
|
9774
|
+
dataSourceActions
|
|
9775
|
+
} = param;
|
|
9776
|
+
const selectionApi = getSelectionApi({
|
|
9777
|
+
dataSourceActions,
|
|
9778
|
+
getDataSourceState
|
|
9779
|
+
});
|
|
9280
9780
|
const imperativeApi = {
|
|
9281
|
-
get
|
|
9282
|
-
return
|
|
9283
|
-
},
|
|
9284
|
-
getSelectedRowCount() {
|
|
9285
|
-
const { selectionMode, selectedRowCount } = getDataSourceState();
|
|
9286
|
-
if (selectionMode != "multi-row") {
|
|
9287
|
-
throw `Cannot get the selected row count unless "selectionMode" is "multi-row"!`;
|
|
9288
|
-
}
|
|
9289
|
-
return selectedRowCount;
|
|
9290
|
-
},
|
|
9291
|
-
getSelectedRows() {
|
|
9292
|
-
const { rowSelection, indexer, dataArray } = getDataSourceState();
|
|
9293
|
-
if (!rowSelection || !(rowSelection instanceof RowSelectionState)) {
|
|
9294
|
-
return [];
|
|
9295
|
-
}
|
|
9296
|
-
if (rowSelection.isRowDefaultDeselected()) {
|
|
9297
|
-
const { selectedRows } = rowSelection.getState();
|
|
9298
|
-
return Object.keys(selectedRows).reduce((res, id) => {
|
|
9299
|
-
const index = indexer.getIndexOf(id);
|
|
9300
|
-
if (index == null) {
|
|
9301
|
-
return res;
|
|
9302
|
-
}
|
|
9303
|
-
const rowInfo = dataArray[index];
|
|
9304
|
-
if (!rowInfo || !rowInfo.data) {
|
|
9305
|
-
return res;
|
|
9306
|
-
}
|
|
9307
|
-
res.push(rowInfo.data);
|
|
9308
|
-
return res;
|
|
9309
|
-
}, []);
|
|
9310
|
-
} else {
|
|
9311
|
-
return dataArray.filter((rowInfo) => {
|
|
9312
|
-
return !rowInfo.isGroupRow && rowSelection.isRowSelected(rowInfo.id);
|
|
9313
|
-
}).map((rowInfo) => rowInfo.data);
|
|
9314
|
-
}
|
|
9315
|
-
return [];
|
|
9781
|
+
get selectionApi() {
|
|
9782
|
+
return selectionApi;
|
|
9316
9783
|
},
|
|
9317
9784
|
setColumnOrder: (columnOrder) => {
|
|
9318
9785
|
componentActions.columnOrder = columnOrder;
|
|
9319
9786
|
},
|
|
9320
|
-
|
|
9321
|
-
const
|
|
9322
|
-
if (
|
|
9323
|
-
|
|
9324
|
-
rowSelectionState.selectRow(pk);
|
|
9325
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9787
|
+
collapseGroupRow(groupKeys) {
|
|
9788
|
+
const state = getDataSourceState();
|
|
9789
|
+
if (state.groupRowsState.isGroupRowExpanded(groupKeys)) {
|
|
9790
|
+
this.toggleGroupRow(groupKeys);
|
|
9326
9791
|
return true;
|
|
9327
|
-
} else if (selectionMode === "single-row") {
|
|
9328
|
-
dataSourceActions.rowSelection = pk;
|
|
9329
|
-
return false;
|
|
9330
9792
|
}
|
|
9331
9793
|
return false;
|
|
9332
9794
|
},
|
|
9333
|
-
|
|
9334
|
-
const
|
|
9335
|
-
if (
|
|
9336
|
-
|
|
9337
|
-
rowSelectionState.deselectRow(pk);
|
|
9338
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9339
|
-
return true;
|
|
9340
|
-
} else if (selectionMode === "single-row") {
|
|
9341
|
-
dataSourceActions.rowSelection = null;
|
|
9795
|
+
expandGroupRow(groupKeys) {
|
|
9796
|
+
const state = getDataSourceState();
|
|
9797
|
+
if (state.groupRowsState.isGroupRowCollapsed(groupKeys)) {
|
|
9798
|
+
this.toggleGroupRow(groupKeys);
|
|
9342
9799
|
return true;
|
|
9343
9800
|
}
|
|
9344
9801
|
return false;
|
|
9345
9802
|
},
|
|
9346
|
-
isRowSelected: (pk) => {
|
|
9347
|
-
const { selectionMode, rowSelection } = getDataSourceState();
|
|
9348
|
-
if (selectionMode === "multi-row") {
|
|
9349
|
-
return rowSelection.isRowSelected(pk);
|
|
9350
|
-
} else if (selectionMode === "single-row") {
|
|
9351
|
-
return rowSelection === pk;
|
|
9352
|
-
}
|
|
9353
|
-
return false;
|
|
9354
|
-
},
|
|
9355
|
-
selectGroupRow: (groupKeys) => {
|
|
9356
|
-
return setGroupRowSelection(groupKeys, true);
|
|
9357
|
-
},
|
|
9358
|
-
deselectGroupRow: (groupKeys) => {
|
|
9359
|
-
return setGroupRowSelection(groupKeys, false);
|
|
9360
|
-
},
|
|
9361
9803
|
toggleGroupRow(groupKeys) {
|
|
9362
9804
|
const state = getDataSourceState();
|
|
9363
9805
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
@@ -9385,64 +9827,6 @@ function getImperativeApi(getComputed, getState, getDataSourceState, componentAc
|
|
|
9385
9827
|
}
|
|
9386
9828
|
}
|
|
9387
9829
|
},
|
|
9388
|
-
isGroupRowSelected: (groupKeys) => {
|
|
9389
|
-
const { selectionMode } = getDataSourceState();
|
|
9390
|
-
if (selectionMode === "multi-row") {
|
|
9391
|
-
const primaryKey = `${groupKeys}`;
|
|
9392
|
-
const index = getDataSourceState().indexer.getIndexOf(primaryKey);
|
|
9393
|
-
if (index != null) {
|
|
9394
|
-
const rowInfo = getDataSourceState().dataArray[index];
|
|
9395
|
-
return rowInfo.rowSelected;
|
|
9396
|
-
}
|
|
9397
|
-
}
|
|
9398
|
-
return false;
|
|
9399
|
-
},
|
|
9400
|
-
toggleGroupRowSelection(groupKeys) {
|
|
9401
|
-
const { selectionMode } = getDataSourceState();
|
|
9402
|
-
if (selectionMode === "multi-row") {
|
|
9403
|
-
if (this.isGroupRowSelected(groupKeys)) {
|
|
9404
|
-
this.deselectGroupRow(groupKeys);
|
|
9405
|
-
} else {
|
|
9406
|
-
this.selectGroupRow(groupKeys);
|
|
9407
|
-
}
|
|
9408
|
-
return true;
|
|
9409
|
-
}
|
|
9410
|
-
return false;
|
|
9411
|
-
},
|
|
9412
|
-
toggleRowSelection: (pk) => {
|
|
9413
|
-
const { selectionMode, rowSelection: currentRowSelection } = getDataSourceState();
|
|
9414
|
-
if (selectionMode === "multi-row") {
|
|
9415
|
-
const rowSelectionState = new RowSelectionState(currentRowSelection);
|
|
9416
|
-
rowSelectionState.toggleRowSelection(pk);
|
|
9417
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9418
|
-
return true;
|
|
9419
|
-
} else if (selectionMode === "single-row") {
|
|
9420
|
-
const rowSelection = currentRowSelection === pk ? null : pk;
|
|
9421
|
-
dataSourceActions.rowSelection = rowSelection;
|
|
9422
|
-
return true;
|
|
9423
|
-
}
|
|
9424
|
-
return false;
|
|
9425
|
-
},
|
|
9426
|
-
selectAllRows: () => {
|
|
9427
|
-
const { selectionMode, rowSelection: currentRowSelection } = getDataSourceState();
|
|
9428
|
-
if (selectionMode === "multi-row") {
|
|
9429
|
-
const rowSelectionState = new RowSelectionState(currentRowSelection);
|
|
9430
|
-
rowSelectionState.selectAll();
|
|
9431
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9432
|
-
return true;
|
|
9433
|
-
}
|
|
9434
|
-
return false;
|
|
9435
|
-
},
|
|
9436
|
-
deselectAllRows: () => {
|
|
9437
|
-
const { selectionMode, rowSelection: currentRowSelection } = getDataSourceState();
|
|
9438
|
-
if (selectionMode === "multi-row") {
|
|
9439
|
-
const rowSelectionState = new RowSelectionState(currentRowSelection);
|
|
9440
|
-
rowSelectionState.deselectAll();
|
|
9441
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9442
|
-
return true;
|
|
9443
|
-
}
|
|
9444
|
-
return false;
|
|
9445
|
-
},
|
|
9446
9830
|
setColumnVisibility: (columnVisibility) => {
|
|
9447
9831
|
componentActions.columnVisibility = columnVisibility;
|
|
9448
9832
|
},
|
|
@@ -9711,6 +10095,7 @@ function useCellRendering(param) {
|
|
|
9711
10095
|
computedPinnedStartColumns,
|
|
9712
10096
|
computedPinnedEndColumns,
|
|
9713
10097
|
computedVisibleColumns,
|
|
10098
|
+
computedVisibleColumnsMap,
|
|
9714
10099
|
rowspan,
|
|
9715
10100
|
toggleGroupRow,
|
|
9716
10101
|
columnSize
|
|
@@ -9814,6 +10199,7 @@ function useCellRendering(param) {
|
|
|
9814
10199
|
domRef,
|
|
9815
10200
|
width,
|
|
9816
10201
|
column,
|
|
10202
|
+
columnsMap: computedVisibleColumnsMap,
|
|
9817
10203
|
rowStyle,
|
|
9818
10204
|
rowClassName
|
|
9819
10205
|
};
|
|
@@ -9822,6 +10208,7 @@ function useCellRendering(param) {
|
|
|
9822
10208
|
rowHeight,
|
|
9823
10209
|
getData,
|
|
9824
10210
|
computedVisibleColumns,
|
|
10211
|
+
computedVisibleColumnsMap,
|
|
9825
10212
|
groupRenderStrategy,
|
|
9826
10213
|
toggleGroupRow,
|
|
9827
10214
|
showZebraRows,
|
|
@@ -9837,42 +10224,112 @@ function useCellRendering(param) {
|
|
|
9837
10224
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
9838
10225
|
var import_react43 = __toModule(require("react"));
|
|
9839
10226
|
|
|
9840
|
-
// src/components/InfiniteTable/
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
var
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
map2.set = (key, value) => {
|
|
9849
|
-
set.call(map2, key, value);
|
|
9850
|
-
fns.set(key, value);
|
|
9851
|
-
return map2;
|
|
9852
|
-
};
|
|
10227
|
+
// src/components/InfiniteTable/utils/MultiRowSelector.ts
|
|
10228
|
+
function ensureMinMax(start, end) {
|
|
10229
|
+
return start < end ? [start, end] : [end, start];
|
|
10230
|
+
}
|
|
10231
|
+
var MultiRowSelector = class {
|
|
10232
|
+
constructor(options) {
|
|
10233
|
+
this.multiSelectStartIndex = 0;
|
|
10234
|
+
this.getIdForIndex = options.getIdForIndex;
|
|
9853
10235
|
}
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
const removed = deleteKey.call(map2, key);
|
|
9857
|
-
fns.delete(key);
|
|
9858
|
-
return removed;
|
|
9859
|
-
};
|
|
10236
|
+
set rowSelectionState(rowSelectionState) {
|
|
10237
|
+
this._rowSelectionState = rowSelectionState;
|
|
9860
10238
|
}
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
if (fns.beforeClear) {
|
|
9864
|
-
fns.beforeClear(map2);
|
|
9865
|
-
}
|
|
9866
|
-
const result = clear.call(map2);
|
|
9867
|
-
if (fns.clear) {
|
|
9868
|
-
fns.clear();
|
|
9869
|
-
}
|
|
9870
|
-
return result;
|
|
9871
|
-
};
|
|
10239
|
+
get rowSelectionState() {
|
|
10240
|
+
return this._rowSelectionState;
|
|
9872
10241
|
}
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
10242
|
+
selectRange(startIndex, endIndex) {
|
|
10243
|
+
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
10244
|
+
const rowSelectionState = this.rowSelectionState;
|
|
10245
|
+
for (let i = start; i <= end; i++) {
|
|
10246
|
+
const id = this.getIdForIndex(i);
|
|
10247
|
+
rowSelectionState.selectRow(id);
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
deselectRange(startIndex, endIndex) {
|
|
10251
|
+
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
10252
|
+
const rowSelectionState = this.rowSelectionState;
|
|
10253
|
+
for (let i = start; i <= end; i++) {
|
|
10254
|
+
const id = this.getIdForIndex(i);
|
|
10255
|
+
rowSelectionState.deselectRow(id);
|
|
10256
|
+
}
|
|
10257
|
+
}
|
|
10258
|
+
resetClick(index) {
|
|
10259
|
+
this.rowSelectionState.deselectAll();
|
|
10260
|
+
const id = this.getIdForIndex(index);
|
|
10261
|
+
this.rowSelectionState.selectRow(id);
|
|
10262
|
+
this.multiSelectStartIndex = index;
|
|
10263
|
+
this.multiSelectEndIndex = void 0;
|
|
10264
|
+
}
|
|
10265
|
+
singleAddClick(index) {
|
|
10266
|
+
const id = this.getIdForIndex(index);
|
|
10267
|
+
if (this.rowSelectionState.isRowSelected(id)) {
|
|
10268
|
+
this.rowSelectionState.deselectRow(id);
|
|
10269
|
+
if (this.rowSelectionState.isRowSelected(this.getIdForIndex(index + 1))) {
|
|
10270
|
+
this.multiSelectStartIndex = index + 1;
|
|
10271
|
+
} else {
|
|
10272
|
+
}
|
|
10273
|
+
} else {
|
|
10274
|
+
this.rowSelectionState.selectRow(id);
|
|
10275
|
+
this.multiSelectStartIndex = index;
|
|
10276
|
+
let multiSelectEndIndex = void 0;
|
|
10277
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
10278
|
+
const id2 = this.getIdForIndex(i);
|
|
10279
|
+
if (this.rowSelectionState.isRowSelected(id2)) {
|
|
10280
|
+
multiSelectEndIndex = i;
|
|
10281
|
+
} else {
|
|
10282
|
+
break;
|
|
10283
|
+
}
|
|
10284
|
+
}
|
|
10285
|
+
this.multiSelectEndIndex = multiSelectEndIndex;
|
|
10286
|
+
}
|
|
10287
|
+
}
|
|
10288
|
+
multiSelectClick(index) {
|
|
10289
|
+
if (this.multiSelectEndIndex != null) {
|
|
10290
|
+
this.deselectRange(this.multiSelectStartIndex, this.multiSelectEndIndex);
|
|
10291
|
+
}
|
|
10292
|
+
this.selectRange(this.multiSelectStartIndex, index);
|
|
10293
|
+
this.multiSelectEndIndex = index;
|
|
10294
|
+
}
|
|
10295
|
+
};
|
|
10296
|
+
|
|
10297
|
+
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
10298
|
+
var import_react33 = __toModule(require("react"));
|
|
10299
|
+
|
|
10300
|
+
// src/components/hooks/useInterceptedMap.ts
|
|
10301
|
+
var import_react32 = __toModule(require("react"));
|
|
10302
|
+
function interceptMap(map2, fns) {
|
|
10303
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
10304
|
+
if (fns.set) {
|
|
10305
|
+
map2.set = (key, value) => {
|
|
10306
|
+
set.call(map2, key, value);
|
|
10307
|
+
fns.set(key, value);
|
|
10308
|
+
return map2;
|
|
10309
|
+
};
|
|
10310
|
+
}
|
|
10311
|
+
if (fns.delete) {
|
|
10312
|
+
map2.delete = (key) => {
|
|
10313
|
+
const removed = deleteKey.call(map2, key);
|
|
10314
|
+
fns.delete(key);
|
|
10315
|
+
return removed;
|
|
10316
|
+
};
|
|
10317
|
+
}
|
|
10318
|
+
if (fns.clear || fns.beforeClear) {
|
|
10319
|
+
map2.clear = () => {
|
|
10320
|
+
if (fns.beforeClear) {
|
|
10321
|
+
fns.beforeClear(map2);
|
|
10322
|
+
}
|
|
10323
|
+
const result = clear.call(map2);
|
|
10324
|
+
if (fns.clear) {
|
|
10325
|
+
fns.clear();
|
|
10326
|
+
}
|
|
10327
|
+
return result;
|
|
10328
|
+
};
|
|
10329
|
+
}
|
|
10330
|
+
return () => {
|
|
10331
|
+
if (set) {
|
|
10332
|
+
map2.set = set;
|
|
9876
10333
|
}
|
|
9877
10334
|
if (deleteKey) {
|
|
9878
10335
|
map2.delete = deleteKey;
|
|
@@ -10023,13 +10480,13 @@ var import_react36 = __toModule(require("react"));
|
|
|
10023
10480
|
|
|
10024
10481
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
10025
10482
|
var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
10026
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
10027
|
-
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
10483
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwi _16lm1iwe";
|
|
10484
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" }, direction: { end: "_198z9783", start: "_198z9784" } }, defaultVariants: {}, compoundVariants: [[{ expanded: false, direction: "end" }, "_16lm1iwd"]] });
|
|
10028
10485
|
|
|
10029
10486
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
10030
10487
|
function ExpanderIcon(props) {
|
|
10031
10488
|
var _a;
|
|
10032
|
-
const { size = 24 } = props;
|
|
10489
|
+
const { size = 24, direction = "start" } = props;
|
|
10033
10490
|
const [expanded, setExpanded] = (0, import_react36.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
10034
10491
|
const onClick = () => {
|
|
10035
10492
|
var _a2;
|
|
@@ -10052,8 +10509,9 @@ function ExpanderIcon(props) {
|
|
|
10052
10509
|
style: props.style,
|
|
10053
10510
|
onClick,
|
|
10054
10511
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
10512
|
+
direction: direction || "start",
|
|
10055
10513
|
expanded
|
|
10056
|
-
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
10514
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`, `InfiniteIcon-expander--${direction === "end" ? "end" : "start"}`)
|
|
10057
10515
|
}, /* @__PURE__ */ React35.createElement("path", {
|
|
10058
10516
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
10059
10517
|
}));
|
|
@@ -10063,7 +10521,7 @@ function ExpanderIcon(props) {
|
|
|
10063
10521
|
var React36 = __toModule(require("react"));
|
|
10064
10522
|
|
|
10065
10523
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
10066
|
-
var LoadingIconCls = "_16lm1iw8
|
|
10524
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwi _16lm1iwe";
|
|
10067
10525
|
|
|
10068
10526
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
10069
10527
|
var LoadingIcon = (props) => {
|
|
@@ -10109,7 +10567,7 @@ function getGroupColumnRender({
|
|
|
10109
10567
|
groupRenderStrategy
|
|
10110
10568
|
}) {
|
|
10111
10569
|
return (renderOptions) => {
|
|
10112
|
-
const { rowInfo, renderBag } = renderOptions;
|
|
10570
|
+
const { rowInfo, renderBag, column } = renderOptions;
|
|
10113
10571
|
let { value: valueToRender, groupIcon, selectionCheckBox } = renderBag;
|
|
10114
10572
|
const groupRowInfo = rowInfo;
|
|
10115
10573
|
if (groupRenderStrategy === "multi-column") {
|
|
@@ -10119,7 +10577,7 @@ function getGroupColumnRender({
|
|
|
10119
10577
|
} else if (groupRenderStrategy === "single-column" && !groupRowInfo.isGroupRow) {
|
|
10120
10578
|
}
|
|
10121
10579
|
return /* @__PURE__ */ React37.createElement("div", {
|
|
10122
|
-
className: join(display.flex, alignItems.center, groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && !rowInfo.isGroupRow && selectionCheckBox ? GroupRowExpanderCls : null)
|
|
10580
|
+
className: join(display.flex, column.align === "end" ? flexFlow.rowReverse : flexFlow.row, alignItems.center, groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && !rowInfo.isGroupRow && selectionCheckBox ? GroupRowExpanderCls({ align: column.align || "start" }) : null)
|
|
10123
10581
|
}, groupIcon, selectionCheckBox, /* @__PURE__ */ React37.createElement("div", {
|
|
10124
10582
|
className: cssEllipsisClassName
|
|
10125
10583
|
}, valueToRender != null ? valueToRender : null));
|
|
@@ -10133,7 +10591,7 @@ function getGroupColumnRenderGroupIcon({
|
|
|
10133
10591
|
}) {
|
|
10134
10592
|
return (renderOptions) => {
|
|
10135
10593
|
var _a, _b, _c;
|
|
10136
|
-
const { rowInfo, value, groupBy, pivotBy } = renderOptions;
|
|
10594
|
+
const { rowInfo, value, groupBy, pivotBy, column } = renderOptions;
|
|
10137
10595
|
const groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : rowInfo.isGroupRow && ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndexForColumn]) || rowInfo;
|
|
10138
10596
|
if (!groupRowInfo) {
|
|
10139
10597
|
return null;
|
|
@@ -10165,6 +10623,7 @@ function getGroupColumnRenderGroupIcon({
|
|
|
10165
10623
|
} else if (showExpanderIcon) {
|
|
10166
10624
|
const defaultIcon = /* @__PURE__ */ React37.createElement(ExpanderIcon, {
|
|
10167
10625
|
expanded: !collapsed,
|
|
10626
|
+
direction: column.align === "end" ? "end" : "start",
|
|
10168
10627
|
onChange: () => {
|
|
10169
10628
|
toggleGroupRow(groupKeys);
|
|
10170
10629
|
}
|
|
@@ -10182,8 +10641,11 @@ function getGroupColumnRenderGroupIcon({
|
|
|
10182
10641
|
};
|
|
10183
10642
|
}
|
|
10184
10643
|
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
10185
|
-
var _a;
|
|
10186
10644
|
const { groupByForColumn, groupIndexForColumn, groupRenderStrategy } = options;
|
|
10645
|
+
let userDefinedGroupColumn = typeof groupColumnFromProps === "function" ? groupColumnFromProps(options, toggleGroupRow) : __spreadValues({}, groupColumnFromProps);
|
|
10646
|
+
if (groupByForColumn.column) {
|
|
10647
|
+
userDefinedGroupColumn = __spreadValues(__spreadValues({}, userDefinedGroupColumn), groupByForColumn.column);
|
|
10648
|
+
}
|
|
10187
10649
|
let generatedGroupColumn = __spreadProps(__spreadValues({
|
|
10188
10650
|
header: `Group by ${groupByForColumn.field}`,
|
|
10189
10651
|
groupByField: groupByForColumn.field,
|
|
@@ -10193,9 +10655,9 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
10193
10655
|
groupIndexForColumn,
|
|
10194
10656
|
groupRenderStrategy
|
|
10195
10657
|
})
|
|
10196
|
-
},
|
|
10658
|
+
}, userDefinedGroupColumn), {
|
|
10197
10659
|
renderGroupIcon: getGroupColumnRenderGroupIcon({
|
|
10198
|
-
initialRenderGroupIcon:
|
|
10660
|
+
initialRenderGroupIcon: userDefinedGroupColumn == null ? void 0 : userDefinedGroupColumn.renderGroupIcon,
|
|
10199
10661
|
groupIndexForColumn,
|
|
10200
10662
|
toggleGroupRow,
|
|
10201
10663
|
groupRenderStrategy
|
|
@@ -10216,7 +10678,7 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
10216
10678
|
header: `Group`,
|
|
10217
10679
|
groupByField: options.groupBy.map((g) => g.field),
|
|
10218
10680
|
sortable: false,
|
|
10219
|
-
renderSelectionCheckBox:
|
|
10681
|
+
renderSelectionCheckBox: options.selectionMode === "multi-row",
|
|
10220
10682
|
style: styleForGroupColumn,
|
|
10221
10683
|
render: getGroupColumnRender({
|
|
10222
10684
|
groupIndexForColumn: 0,
|
|
@@ -10413,7 +10875,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
10413
10875
|
}
|
|
10414
10876
|
function useColumnsWhenGrouping() {
|
|
10415
10877
|
const {
|
|
10416
|
-
componentState: { groupBy, pivotBy }
|
|
10878
|
+
componentState: { groupBy, pivotBy, selectionMode }
|
|
10417
10879
|
} = useDataSourceContextValue();
|
|
10418
10880
|
const {
|
|
10419
10881
|
componentActions,
|
|
@@ -10440,7 +10902,8 @@ function useColumnsWhenGrouping() {
|
|
|
10440
10902
|
groupBy,
|
|
10441
10903
|
pivotBy,
|
|
10442
10904
|
pivotColumns,
|
|
10443
|
-
toggleGroupRow
|
|
10905
|
+
toggleGroupRow,
|
|
10906
|
+
selectionMode
|
|
10444
10907
|
});
|
|
10445
10908
|
componentActions.columnsWhenGrouping = columnsWhenGrouping;
|
|
10446
10909
|
};
|
|
@@ -10454,6 +10917,7 @@ function useColumnsWhenGrouping() {
|
|
|
10454
10917
|
columns,
|
|
10455
10918
|
groupBy,
|
|
10456
10919
|
pivotBy,
|
|
10920
|
+
selectionMode,
|
|
10457
10921
|
groupColumn,
|
|
10458
10922
|
groupRenderStrategy,
|
|
10459
10923
|
pivotColumns,
|
|
@@ -10597,6 +11061,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
10597
11061
|
pivotColumns,
|
|
10598
11062
|
groupBy,
|
|
10599
11063
|
pivotBy,
|
|
11064
|
+
selectionMode,
|
|
10600
11065
|
groupColumn,
|
|
10601
11066
|
pivotTotalColumnPosition,
|
|
10602
11067
|
pivotGrandTotalColumnPosition,
|
|
@@ -10617,7 +11082,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
10617
11082
|
pivotBy,
|
|
10618
11083
|
groupIndexForColumn,
|
|
10619
11084
|
groupCount: arr.length,
|
|
10620
|
-
groupRenderStrategy
|
|
11085
|
+
groupRenderStrategy,
|
|
11086
|
+
selectionMode
|
|
10621
11087
|
}, toggleGroupRow, groupColumn);
|
|
10622
11088
|
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
10623
11089
|
});
|
|
@@ -10626,7 +11092,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
10626
11092
|
groupCount: groupBy.length,
|
|
10627
11093
|
groupBy,
|
|
10628
11094
|
pivotBy,
|
|
10629
|
-
groupRenderStrategy
|
|
11095
|
+
groupRenderStrategy,
|
|
11096
|
+
selectionMode
|
|
10630
11097
|
}, toggleGroupRow, groupColumn);
|
|
10631
11098
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
10632
11099
|
}
|
|
@@ -11036,7 +11503,10 @@ var getComputedVisibleColumns = ({
|
|
|
11036
11503
|
computedVisibleColumns,
|
|
11037
11504
|
computedVisibleColumnsMap,
|
|
11038
11505
|
computedPinnedEndWidth,
|
|
11039
|
-
computedPinnedStartWidth
|
|
11506
|
+
computedPinnedStartWidth,
|
|
11507
|
+
renderSelectionCheckBox: computedVisibleColumns.reduce((bool, c) => {
|
|
11508
|
+
return bool || !!c.renderSelectionCheckBox;
|
|
11509
|
+
}, false)
|
|
11040
11510
|
};
|
|
11041
11511
|
return result;
|
|
11042
11512
|
};
|
|
@@ -11097,7 +11567,8 @@ var useComputedVisibleColumns = ({
|
|
|
11097
11567
|
computedUnpinnedOffset,
|
|
11098
11568
|
computedPinnedEndOffset,
|
|
11099
11569
|
computedPinnedEndWidth,
|
|
11100
|
-
computedPinnedStartWidth
|
|
11570
|
+
computedPinnedStartWidth,
|
|
11571
|
+
renderSelectionCheckBox
|
|
11101
11572
|
} = (0, import_react41.useMemo)(() => {
|
|
11102
11573
|
return getComputedVisibleColumns({
|
|
11103
11574
|
columns,
|
|
@@ -11148,6 +11619,7 @@ var useComputedVisibleColumns = ({
|
|
|
11148
11619
|
columnsRenderId
|
|
11149
11620
|
]);
|
|
11150
11621
|
const result = {
|
|
11622
|
+
renderSelectionCheckBox,
|
|
11151
11623
|
columns,
|
|
11152
11624
|
computedPinnedEndWidth,
|
|
11153
11625
|
computedPinnedStartWidth,
|
|
@@ -11255,7 +11727,8 @@ function useComputed() {
|
|
|
11255
11727
|
computedPinnedEndOffset,
|
|
11256
11728
|
computedRemainingSpace,
|
|
11257
11729
|
computedPinnedStartWidth,
|
|
11258
|
-
computedPinnedEndWidth
|
|
11730
|
+
computedPinnedEndWidth,
|
|
11731
|
+
renderSelectionCheckBox
|
|
11259
11732
|
} = useComputedVisibleColumns({
|
|
11260
11733
|
columns,
|
|
11261
11734
|
columnCssEllipsis: componentState.columnCssEllipsis,
|
|
@@ -11286,12 +11759,20 @@ function useComputed() {
|
|
|
11286
11759
|
const scrollbars = useScrollbars(brain);
|
|
11287
11760
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
11288
11761
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
11762
|
+
const [multiRowSelector] = (0, import_react43.useState)(() => {
|
|
11763
|
+
const multiRowSelector2 = new MultiRowSelector({
|
|
11764
|
+
getIdForIndex: (index) => getDataSourceState().dataArray[index].id
|
|
11765
|
+
});
|
|
11766
|
+
return multiRowSelector2;
|
|
11767
|
+
});
|
|
11289
11768
|
return {
|
|
11769
|
+
multiRowSelector,
|
|
11290
11770
|
showColumnFilters: !!dataSourceState.filterValue,
|
|
11291
11771
|
scrollbars,
|
|
11292
11772
|
columnSize,
|
|
11293
11773
|
rowspan,
|
|
11294
11774
|
toggleGroupRow,
|
|
11775
|
+
renderSelectionCheckBox,
|
|
11295
11776
|
computedPinnedStartOverflow,
|
|
11296
11777
|
computedPinnedEndOverflow,
|
|
11297
11778
|
computedPinnedStartWidth,
|
|
@@ -11474,7 +11955,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
11474
11955
|
const valid = (0, import_react44.useMemo)(() => {
|
|
11475
11956
|
let valid2 = isValidLicense(licenseKey, {
|
|
11476
11957
|
publishedAt: 1624970570587,
|
|
11477
|
-
version: "0.4.
|
|
11958
|
+
version: "0.4.3"
|
|
11478
11959
|
});
|
|
11479
11960
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
11480
11961
|
return true;
|
|
@@ -11484,149 +11965,19 @@ var useLicense = (licenseKey = "") => {
|
|
|
11484
11965
|
return valid;
|
|
11485
11966
|
};
|
|
11486
11967
|
|
|
11487
|
-
// src/components/InfiniteTable/hooks/useRowSelection.ts
|
|
11488
|
-
var import_react45 = __toModule(require("react"));
|
|
11489
|
-
|
|
11490
|
-
// src/components/InfiniteTable/utils/MultiRowSelector.ts
|
|
11491
|
-
function ensureMinMax(start, end) {
|
|
11492
|
-
return start < end ? [start, end] : [end, start];
|
|
11493
|
-
}
|
|
11494
|
-
var MultiRowSelector = class {
|
|
11495
|
-
constructor(options) {
|
|
11496
|
-
this.multiSelectStartIndex = 0;
|
|
11497
|
-
this.getIdForIndex = options.getIdForIndex;
|
|
11498
|
-
}
|
|
11499
|
-
set rowSelectionState(rowSelectionState) {
|
|
11500
|
-
this._rowSelectionState = rowSelectionState;
|
|
11501
|
-
}
|
|
11502
|
-
get rowSelectionState() {
|
|
11503
|
-
return this._rowSelectionState;
|
|
11504
|
-
}
|
|
11505
|
-
selectRange(startIndex, endIndex) {
|
|
11506
|
-
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
11507
|
-
const rowSelectionState = this.rowSelectionState;
|
|
11508
|
-
for (let i = start; i <= end; i++) {
|
|
11509
|
-
const id = this.getIdForIndex(i);
|
|
11510
|
-
rowSelectionState.selectRow(id);
|
|
11511
|
-
}
|
|
11512
|
-
}
|
|
11513
|
-
deselectRange(startIndex, endIndex) {
|
|
11514
|
-
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
11515
|
-
const rowSelectionState = this.rowSelectionState;
|
|
11516
|
-
for (let i = start; i <= end; i++) {
|
|
11517
|
-
const id = this.getIdForIndex(i);
|
|
11518
|
-
rowSelectionState.deselectRow(id);
|
|
11519
|
-
}
|
|
11520
|
-
}
|
|
11521
|
-
resetClick(index) {
|
|
11522
|
-
this.rowSelectionState.deselectAll();
|
|
11523
|
-
const id = this.getIdForIndex(index);
|
|
11524
|
-
this.rowSelectionState.selectRow(id);
|
|
11525
|
-
this.multiSelectStartIndex = index;
|
|
11526
|
-
this.multiSelectEndIndex = void 0;
|
|
11527
|
-
}
|
|
11528
|
-
singleAddClick(index) {
|
|
11529
|
-
const id = this.getIdForIndex(index);
|
|
11530
|
-
if (this.rowSelectionState.isRowSelected(id)) {
|
|
11531
|
-
this.rowSelectionState.deselectRow(id);
|
|
11532
|
-
if (this.rowSelectionState.isRowSelected(this.getIdForIndex(index + 1))) {
|
|
11533
|
-
this.multiSelectStartIndex = index + 1;
|
|
11534
|
-
} else {
|
|
11535
|
-
}
|
|
11536
|
-
} else {
|
|
11537
|
-
this.rowSelectionState.selectRow(id);
|
|
11538
|
-
this.multiSelectStartIndex = index;
|
|
11539
|
-
let multiSelectEndIndex = void 0;
|
|
11540
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
11541
|
-
const id2 = this.getIdForIndex(i);
|
|
11542
|
-
if (this.rowSelectionState.isRowSelected(id2)) {
|
|
11543
|
-
multiSelectEndIndex = i;
|
|
11544
|
-
} else {
|
|
11545
|
-
break;
|
|
11546
|
-
}
|
|
11547
|
-
}
|
|
11548
|
-
this.multiSelectEndIndex = multiSelectEndIndex;
|
|
11549
|
-
}
|
|
11550
|
-
}
|
|
11551
|
-
multiSelectClick(index) {
|
|
11552
|
-
if (this.multiSelectEndIndex != null) {
|
|
11553
|
-
this.deselectRange(this.multiSelectStartIndex, this.multiSelectEndIndex);
|
|
11554
|
-
}
|
|
11555
|
-
this.selectRange(this.multiSelectStartIndex, index);
|
|
11556
|
-
this.multiSelectEndIndex = index;
|
|
11557
|
-
}
|
|
11558
|
-
};
|
|
11559
|
-
|
|
11560
|
-
// src/components/InfiniteTable/hooks/useRowSelection.ts
|
|
11561
|
-
function useRowSelection() {
|
|
11562
|
-
const { getState } = useInfiniteTable();
|
|
11563
|
-
const [multiRowSelector] = (0, import_react45.useState)(() => {
|
|
11564
|
-
const multiRowSelector2 = new MultiRowSelector({
|
|
11565
|
-
getIdForIndex: (index) => getDataSourceState().dataArray[index].id
|
|
11566
|
-
});
|
|
11567
|
-
return multiRowSelector2;
|
|
11568
|
-
});
|
|
11569
|
-
const { getState: getDataSourceState, componentActions } = useDataSourceContextValue();
|
|
11570
|
-
(0, import_react45.useEffect)(() => {
|
|
11571
|
-
const removeOnClick = getState().cellClick.onChange((args) => {
|
|
11572
|
-
if (args == null) {
|
|
11573
|
-
return;
|
|
11574
|
-
}
|
|
11575
|
-
const { rowIndex, event } = args;
|
|
11576
|
-
let {
|
|
11577
|
-
rowSelection: rowSelectionState,
|
|
11578
|
-
selectionMode,
|
|
11579
|
-
groupBy
|
|
11580
|
-
} = getDataSourceState();
|
|
11581
|
-
if (groupBy.length) {
|
|
11582
|
-
return;
|
|
11583
|
-
}
|
|
11584
|
-
if (selectionMode === "multi-row") {
|
|
11585
|
-
rowSelectionState = new RowSelectionState(rowSelectionState);
|
|
11586
|
-
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
11587
|
-
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
11588
|
-
if (event.shiftKey) {
|
|
11589
|
-
multiRowSelector.multiSelectClick(rowIndex);
|
|
11590
|
-
} else if (event.metaKey || event.ctrlKey) {
|
|
11591
|
-
multiRowSelector.singleAddClick(rowIndex);
|
|
11592
|
-
} else {
|
|
11593
|
-
multiRowSelector.resetClick(rowIndex);
|
|
11594
|
-
}
|
|
11595
|
-
componentActions.rowSelection = rowSelectionState;
|
|
11596
|
-
}
|
|
11597
|
-
} else if (selectionMode === "single-row") {
|
|
11598
|
-
}
|
|
11599
|
-
});
|
|
11600
|
-
const removeOnKeyDown = getState().keyDown.onChange((event) => {
|
|
11601
|
-
let { rowSelection: rowSelectionState, selectionMode } = getDataSourceState();
|
|
11602
|
-
if (selectionMode === "multi-row") {
|
|
11603
|
-
if ((event == null ? void 0 : event.key) === "a" && (event.ctrlKey || event.metaKey)) {
|
|
11604
|
-
rowSelectionState = new RowSelectionState(rowSelectionState);
|
|
11605
|
-
rowSelectionState.selectAll();
|
|
11606
|
-
componentActions.rowSelection = rowSelectionState;
|
|
11607
|
-
}
|
|
11608
|
-
}
|
|
11609
|
-
});
|
|
11610
|
-
return () => {
|
|
11611
|
-
removeOnClick();
|
|
11612
|
-
removeOnKeyDown();
|
|
11613
|
-
};
|
|
11614
|
-
}, [multiRowSelector]);
|
|
11615
|
-
}
|
|
11616
|
-
|
|
11617
11968
|
// src/components/InfiniteTable/hooks/useScrollToActiveCell.ts
|
|
11618
|
-
var
|
|
11969
|
+
var import_react45 = __toModule(require("react"));
|
|
11619
11970
|
var RETRIES = 10;
|
|
11620
11971
|
function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
11621
|
-
const didScrollRef = (0,
|
|
11622
|
-
const rafId = (0,
|
|
11623
|
-
(0,
|
|
11972
|
+
const didScrollRef = (0, import_react45.useRef)(false);
|
|
11973
|
+
const rafId = (0, import_react45.useRef)(null);
|
|
11974
|
+
(0, import_react45.useEffect)(() => {
|
|
11624
11975
|
if (activeCellIndex != null) {
|
|
11625
11976
|
didScrollRef.current = false;
|
|
11626
11977
|
cancelRaf(rafId.current);
|
|
11627
11978
|
}
|
|
11628
11979
|
}, [activeCellIndex]);
|
|
11629
|
-
(0,
|
|
11980
|
+
(0, import_react45.useEffect)(() => {
|
|
11630
11981
|
if (activeCellIndex != null && !didScrollRef.current) {
|
|
11631
11982
|
let tryScroll = function(times = 0) {
|
|
11632
11983
|
times++;
|
|
@@ -11649,18 +12000,18 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
11649
12000
|
}
|
|
11650
12001
|
|
|
11651
12002
|
// src/components/InfiniteTable/hooks/useScrollToActiveRow.ts
|
|
11652
|
-
var
|
|
12003
|
+
var import_react46 = __toModule(require("react"));
|
|
11653
12004
|
var RETRIES2 = 10;
|
|
11654
12005
|
function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
11655
|
-
const didScrollRef = (0,
|
|
11656
|
-
const rafId = (0,
|
|
11657
|
-
(0,
|
|
12006
|
+
const didScrollRef = (0, import_react46.useRef)(false);
|
|
12007
|
+
const rafId = (0, import_react46.useRef)(null);
|
|
12008
|
+
(0, import_react46.useEffect)(() => {
|
|
11658
12009
|
if (activeRowIndex != null) {
|
|
11659
12010
|
didScrollRef.current = false;
|
|
11660
12011
|
cancelAnimationFrame(rafId.current);
|
|
11661
12012
|
}
|
|
11662
12013
|
}, [activeRowIndex]);
|
|
11663
|
-
(0,
|
|
12014
|
+
(0, import_react46.useEffect)(() => {
|
|
11664
12015
|
if (activeRowIndex != null && !didScrollRef.current) {
|
|
11665
12016
|
let tryScroll = function(times = 0) {
|
|
11666
12017
|
times++;
|
|
@@ -11681,225 +12032,34 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
11681
12032
|
}, [activeRowIndex, dataCount]);
|
|
11682
12033
|
}
|
|
11683
12034
|
|
|
11684
|
-
// src/components/
|
|
11685
|
-
|
|
11686
|
-
return Math.min(Math.max(value, min), max);
|
|
11687
|
-
}
|
|
12035
|
+
// src/components/InfiniteTable/state/getInitialState.ts
|
|
12036
|
+
var import_react47 = __toModule(require("react"));
|
|
11688
12037
|
|
|
11689
|
-
// src/components/
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
11715
|
-
},
|
|
11716
|
-
PageUp: () => {
|
|
11717
|
-
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
11718
|
-
},
|
|
11719
|
-
End: () => {
|
|
11720
|
-
activeRowIndex = max;
|
|
11721
|
-
},
|
|
11722
|
-
Home: () => {
|
|
11723
|
-
activeRowIndex = min;
|
|
11724
|
-
}
|
|
11725
|
-
};
|
|
11726
|
-
const Fn = KeyToFunction[key];
|
|
11727
|
-
if (!Fn) {
|
|
11728
|
-
return false;
|
|
11729
|
-
}
|
|
11730
|
-
Fn();
|
|
11731
|
-
actions.activeRowIndex = activeRowIndex;
|
|
11732
|
-
return true;
|
|
11733
|
-
}
|
|
11734
|
-
function handleCellNavigation(options) {
|
|
11735
|
-
const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
|
|
11736
|
-
const state = getState();
|
|
11737
|
-
const { activeCellIndex, brain } = state;
|
|
11738
|
-
if (!activeCellIndex) {
|
|
11739
|
-
return false;
|
|
11740
|
-
}
|
|
11741
|
-
let [rowIndex, colIndex] = activeCellIndex;
|
|
11742
|
-
const {
|
|
11743
|
-
start: [startRow, startCol],
|
|
11744
|
-
end: [endRow, endCol]
|
|
11745
|
-
} = brain.getRenderRange();
|
|
11746
|
-
const renderRowCount = endRow - startRow - 1;
|
|
11747
|
-
const renderColCount = endCol - startCol - 1;
|
|
11748
|
-
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
11749
|
-
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
11750
|
-
const minRow = 0;
|
|
11751
|
-
const minCol = 0;
|
|
11752
|
-
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
11753
|
-
colIndex = clamp(colIndex, 0, maxCol);
|
|
11754
|
-
actions.activeCellIndex = [rowIndex, colIndex];
|
|
11755
|
-
const KeyToFunction = {
|
|
11756
|
-
ArrowDown: () => {
|
|
11757
|
-
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
11758
|
-
},
|
|
11759
|
-
ArrowUp: () => {
|
|
11760
|
-
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
11761
|
-
},
|
|
11762
|
-
ArrowLeft: () => {
|
|
11763
|
-
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
11764
|
-
},
|
|
11765
|
-
ArrowRight: () => {
|
|
11766
|
-
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
11767
|
-
},
|
|
11768
|
-
PageDown: () => {
|
|
11769
|
-
if (!shiftKey) {
|
|
11770
|
-
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
11771
|
-
} else {
|
|
11772
|
-
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
11773
|
-
}
|
|
11774
|
-
},
|
|
11775
|
-
PageUp: () => {
|
|
11776
|
-
if (!shiftKey) {
|
|
11777
|
-
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
11778
|
-
} else {
|
|
11779
|
-
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
11780
|
-
}
|
|
11781
|
-
},
|
|
11782
|
-
End: () => {
|
|
11783
|
-
if (!shiftKey) {
|
|
11784
|
-
rowIndex = maxRow;
|
|
11785
|
-
} else {
|
|
11786
|
-
colIndex = maxCol;
|
|
11787
|
-
}
|
|
11788
|
-
},
|
|
11789
|
-
Home: () => {
|
|
11790
|
-
if (!shiftKey) {
|
|
11791
|
-
rowIndex = minRow;
|
|
11792
|
-
} else {
|
|
11793
|
-
colIndex = minCol;
|
|
11794
|
-
}
|
|
11795
|
-
}
|
|
11796
|
-
};
|
|
11797
|
-
const Fn = KeyToFunction[key];
|
|
11798
|
-
if (!Fn) {
|
|
11799
|
-
return false;
|
|
11800
|
-
}
|
|
11801
|
-
Fn();
|
|
11802
|
-
actions.activeCellIndex = [rowIndex, colIndex];
|
|
11803
|
-
return true;
|
|
11804
|
-
}
|
|
11805
|
-
var validKeys = {
|
|
11806
|
-
ArrowUp: true,
|
|
11807
|
-
ArrowDown: true,
|
|
11808
|
-
ArrowLeft: true,
|
|
11809
|
-
ArrowRight: true,
|
|
11810
|
-
PageUp: true,
|
|
11811
|
-
PageDown: true,
|
|
11812
|
-
Home: true,
|
|
11813
|
-
End: true,
|
|
11814
|
-
Enter: true,
|
|
11815
|
-
" ": true
|
|
11816
|
-
};
|
|
11817
|
-
function handleKeyboardNavigation(options) {
|
|
11818
|
-
const { getState, getDataSourceState, imperativeApi } = options;
|
|
11819
|
-
const state = getState();
|
|
11820
|
-
const dataSourceState = getDataSourceState();
|
|
11821
|
-
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
11822
|
-
if (!validKeys[options.key]) {
|
|
11823
|
-
return false;
|
|
11824
|
-
}
|
|
11825
|
-
if (options.key === "Enter") {
|
|
11826
|
-
if (keyboardNavigation === "row" && activeRowIndex != null) {
|
|
11827
|
-
const rowInfo = dataSourceState.dataArray[activeRowIndex];
|
|
11828
|
-
if (rowInfo && rowInfo.isGroupRow) {
|
|
11829
|
-
imperativeApi.toggleGroupRow(rowInfo.groupKeys);
|
|
11830
|
-
return true;
|
|
11831
|
-
}
|
|
11832
|
-
}
|
|
11833
|
-
if (keyboardNavigation === "cell" && activeCellIndex != null) {
|
|
11834
|
-
const rowInfo = dataSourceState.dataArray[activeCellIndex[0]];
|
|
11835
|
-
if (rowInfo && rowInfo.isGroupRow) {
|
|
11836
|
-
imperativeApi.toggleGroupRow(rowInfo.groupKeys);
|
|
11837
|
-
return true;
|
|
11838
|
-
}
|
|
11839
|
-
}
|
|
11840
|
-
return false;
|
|
11841
|
-
}
|
|
11842
|
-
if (options.key === " ") {
|
|
11843
|
-
if (keyboardNavigation === "row" && activeRowIndex != null) {
|
|
11844
|
-
const rowInfo = dataSourceState.dataArray[activeRowIndex];
|
|
11845
|
-
if (rowInfo) {
|
|
11846
|
-
if (rowInfo.isGroupRow) {
|
|
11847
|
-
imperativeApi.toggleGroupRowSelection(rowInfo.groupKeys);
|
|
11848
|
-
} else {
|
|
11849
|
-
imperativeApi.toggleRowSelection(rowInfo.id);
|
|
11850
|
-
}
|
|
11851
|
-
return true;
|
|
11852
|
-
}
|
|
11853
|
-
}
|
|
11854
|
-
if (keyboardNavigation === "cell" && activeCellIndex != null) {
|
|
11855
|
-
const rowInfo = dataSourceState.dataArray[activeCellIndex[0]];
|
|
11856
|
-
if (rowInfo) {
|
|
11857
|
-
if (rowInfo.isGroupRow) {
|
|
11858
|
-
imperativeApi.toggleGroupRowSelection(rowInfo.groupKeys);
|
|
11859
|
-
} else {
|
|
11860
|
-
imperativeApi.toggleRowSelection(rowInfo.id);
|
|
11861
|
-
}
|
|
11862
|
-
return true;
|
|
11863
|
-
}
|
|
11864
|
-
}
|
|
11865
|
-
}
|
|
11866
|
-
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
11867
|
-
return handleRowNavigation(options);
|
|
11868
|
-
}
|
|
11869
|
-
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
11870
|
-
return handleCellNavigation(options);
|
|
11871
|
-
}
|
|
11872
|
-
return false;
|
|
11873
|
-
}
|
|
11874
|
-
|
|
11875
|
-
// src/components/InfiniteTable/state/getInitialState.ts
|
|
11876
|
-
var import_react48 = __toModule(require("react"));
|
|
11877
|
-
|
|
11878
|
-
// src/components/VirtualBrain/ScrollListener.ts
|
|
11879
|
-
var initialScrollPosition = {
|
|
11880
|
-
scrollLeft: 0,
|
|
11881
|
-
scrollTop: 0
|
|
11882
|
-
};
|
|
11883
|
-
var ScrollListener = class {
|
|
11884
|
-
constructor() {
|
|
11885
|
-
this.scrollPosition = initialScrollPosition;
|
|
11886
|
-
this.onScrollFns = [];
|
|
11887
|
-
this.getScrollPosition = () => {
|
|
11888
|
-
return this.scrollPosition;
|
|
11889
|
-
};
|
|
11890
|
-
this.onScroll = (fn) => {
|
|
11891
|
-
this.onScrollFns.push(fn);
|
|
11892
|
-
return () => {
|
|
11893
|
-
this.onScrollFns = this.onScrollFns.filter((f) => f !== fn);
|
|
11894
|
-
};
|
|
11895
|
-
};
|
|
11896
|
-
this.setScrollPosition = (scrollPosition) => {
|
|
11897
|
-
this.scrollPosition = scrollPosition;
|
|
11898
|
-
this.notifyScrollChange();
|
|
11899
|
-
};
|
|
11900
|
-
this.destroy = () => {
|
|
11901
|
-
this.onScrollFns = [];
|
|
11902
|
-
};
|
|
12038
|
+
// src/components/VirtualBrain/ScrollListener.ts
|
|
12039
|
+
var initialScrollPosition = {
|
|
12040
|
+
scrollLeft: 0,
|
|
12041
|
+
scrollTop: 0
|
|
12042
|
+
};
|
|
12043
|
+
var ScrollListener = class {
|
|
12044
|
+
constructor() {
|
|
12045
|
+
this.scrollPosition = initialScrollPosition;
|
|
12046
|
+
this.onScrollFns = [];
|
|
12047
|
+
this.getScrollPosition = () => {
|
|
12048
|
+
return this.scrollPosition;
|
|
12049
|
+
};
|
|
12050
|
+
this.onScroll = (fn) => {
|
|
12051
|
+
this.onScrollFns.push(fn);
|
|
12052
|
+
return () => {
|
|
12053
|
+
this.onScrollFns = this.onScrollFns.filter((f) => f !== fn);
|
|
12054
|
+
};
|
|
12055
|
+
};
|
|
12056
|
+
this.setScrollPosition = (scrollPosition) => {
|
|
12057
|
+
this.scrollPosition = scrollPosition;
|
|
12058
|
+
this.notifyScrollChange();
|
|
12059
|
+
};
|
|
12060
|
+
this.destroy = () => {
|
|
12061
|
+
this.onScrollFns = [];
|
|
12062
|
+
};
|
|
11903
12063
|
}
|
|
11904
12064
|
notifyScrollChange() {
|
|
11905
12065
|
const { scrollPosition } = this;
|
|
@@ -11968,10 +12128,10 @@ function initSetupState2() {
|
|
|
11968
12128
|
propsCache: new Map([]),
|
|
11969
12129
|
brain,
|
|
11970
12130
|
headerBrain,
|
|
11971
|
-
domRef: (0,
|
|
11972
|
-
scrollerDOMRef: (0,
|
|
11973
|
-
portalDOMRef: (0,
|
|
11974
|
-
activeCellIndicatorDOMRef: (0,
|
|
12131
|
+
domRef: (0, import_react47.createRef)(),
|
|
12132
|
+
scrollerDOMRef: (0, import_react47.createRef)(),
|
|
12133
|
+
portalDOMRef: (0, import_react47.createRef)(),
|
|
12134
|
+
activeCellIndicatorDOMRef: (0, import_react47.createRef)(),
|
|
11975
12135
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
11976
12136
|
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
11977
12137
|
cellClick: buildSubscriptionCallback(),
|
|
@@ -12043,6 +12203,7 @@ var forwardProps4 = (setupState) => {
|
|
|
12043
12203
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
12044
12204
|
pivotGrandTotalColumnPosition: 1,
|
|
12045
12205
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
12206
|
+
keyboardSelection: (keyboardSelection) => keyboardSelection != null ? keyboardSelection : true,
|
|
12046
12207
|
activeRowIndex: 1,
|
|
12047
12208
|
activeCellIndex: 1,
|
|
12048
12209
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
@@ -12117,6 +12278,388 @@ var mapPropsToState2 = (params) => {
|
|
|
12117
12278
|
// src/components/InfiniteTable/utils/toCSSVarName.ts
|
|
12118
12279
|
var toCSSVarName = (value) => `--infinite-${value}`;
|
|
12119
12280
|
|
|
12281
|
+
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
12282
|
+
var import_react48 = __toModule(require("react"));
|
|
12283
|
+
|
|
12284
|
+
// src/components/InfiniteTable/eventHandlers/onCellClick.ts
|
|
12285
|
+
function onCellClick(context, event) {
|
|
12286
|
+
updateRowSelectionOnCellClick(context, event);
|
|
12287
|
+
}
|
|
12288
|
+
function updateRowSelectionOnCellClick(context, event) {
|
|
12289
|
+
const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
|
|
12290
|
+
const { multiRowSelector, renderSelectionCheckBox } = getComputed();
|
|
12291
|
+
const dataSourceState = getDataSourceState();
|
|
12292
|
+
const { selectionMode, groupBy } = dataSourceState;
|
|
12293
|
+
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12294
|
+
if (groupBy.length) {
|
|
12295
|
+
return false;
|
|
12296
|
+
}
|
|
12297
|
+
if (selectionMode === "multi-row") {
|
|
12298
|
+
if (renderSelectionCheckBox && !event.key) {
|
|
12299
|
+
return false;
|
|
12300
|
+
}
|
|
12301
|
+
rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12302
|
+
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
12303
|
+
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
12304
|
+
if (event.shiftKey) {
|
|
12305
|
+
multiRowSelector.multiSelectClick(rowIndex);
|
|
12306
|
+
} else if (event.metaKey || event.ctrlKey) {
|
|
12307
|
+
multiRowSelector.singleAddClick(rowIndex);
|
|
12308
|
+
} else {
|
|
12309
|
+
multiRowSelector.resetClick(rowIndex);
|
|
12310
|
+
}
|
|
12311
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
12312
|
+
return true;
|
|
12313
|
+
}
|
|
12314
|
+
} else if (selectionMode === "single-row") {
|
|
12315
|
+
}
|
|
12316
|
+
return false;
|
|
12317
|
+
}
|
|
12318
|
+
|
|
12319
|
+
// src/components/utils/clamp.ts
|
|
12320
|
+
function clamp(value, min, max) {
|
|
12321
|
+
return Math.min(Math.max(value, min), max);
|
|
12322
|
+
}
|
|
12323
|
+
|
|
12324
|
+
// src/components/InfiniteTable/eventHandlers/keyboardNavigation.ts
|
|
12325
|
+
function handleRowNavigation(options) {
|
|
12326
|
+
const { key, getState, getDataSourceState, actions, api } = options;
|
|
12327
|
+
const dataArray = getDataSourceState().dataArray;
|
|
12328
|
+
const arrLength = dataArray.length;
|
|
12329
|
+
const state = getState();
|
|
12330
|
+
const { brain } = state;
|
|
12331
|
+
let { activeRowIndex } = state;
|
|
12332
|
+
if (activeRowIndex == null) {
|
|
12333
|
+
return false;
|
|
12334
|
+
}
|
|
12335
|
+
const {
|
|
12336
|
+
start: [startRow],
|
|
12337
|
+
end: [endRow]
|
|
12338
|
+
} = brain.getRenderRange();
|
|
12339
|
+
const renderRowCount = endRow - startRow - 1;
|
|
12340
|
+
const min = 0;
|
|
12341
|
+
const max = arrLength - 1;
|
|
12342
|
+
const KeyToFunction = {
|
|
12343
|
+
ArrowDown: () => {
|
|
12344
|
+
activeRowIndex = clamp(activeRowIndex + 1, min, max);
|
|
12345
|
+
},
|
|
12346
|
+
ArrowUp: () => {
|
|
12347
|
+
activeRowIndex = clamp(activeRowIndex - 1, min, max);
|
|
12348
|
+
},
|
|
12349
|
+
ArrowLeft: () => {
|
|
12350
|
+
const rowInfo = dataArray[activeRowIndex];
|
|
12351
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12352
|
+
return api.collapseGroupRow(rowInfo.groupKeys);
|
|
12353
|
+
}
|
|
12354
|
+
return false;
|
|
12355
|
+
},
|
|
12356
|
+
ArrowRight: () => {
|
|
12357
|
+
const rowInfo = dataArray[activeRowIndex];
|
|
12358
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12359
|
+
return api.expandGroupRow(rowInfo.groupKeys);
|
|
12360
|
+
}
|
|
12361
|
+
return false;
|
|
12362
|
+
},
|
|
12363
|
+
Enter: () => {
|
|
12364
|
+
const rowInfo = dataArray[activeRowIndex];
|
|
12365
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12366
|
+
return api.toggleGroupRow(rowInfo.groupKeys);
|
|
12367
|
+
}
|
|
12368
|
+
return false;
|
|
12369
|
+
},
|
|
12370
|
+
PageDown: () => {
|
|
12371
|
+
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
12372
|
+
},
|
|
12373
|
+
PageUp: () => {
|
|
12374
|
+
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
12375
|
+
},
|
|
12376
|
+
End: () => {
|
|
12377
|
+
activeRowIndex = max;
|
|
12378
|
+
},
|
|
12379
|
+
Home: () => {
|
|
12380
|
+
activeRowIndex = min;
|
|
12381
|
+
}
|
|
12382
|
+
};
|
|
12383
|
+
const Fn = KeyToFunction[key];
|
|
12384
|
+
if (!Fn) {
|
|
12385
|
+
return false;
|
|
12386
|
+
}
|
|
12387
|
+
Fn();
|
|
12388
|
+
actions.activeRowIndex = activeRowIndex;
|
|
12389
|
+
return true;
|
|
12390
|
+
}
|
|
12391
|
+
function handleCellNavigation(options) {
|
|
12392
|
+
const {
|
|
12393
|
+
api,
|
|
12394
|
+
key,
|
|
12395
|
+
shiftKey,
|
|
12396
|
+
getState,
|
|
12397
|
+
getComputed,
|
|
12398
|
+
getDataSourceState,
|
|
12399
|
+
actions
|
|
12400
|
+
} = options;
|
|
12401
|
+
const dataArray = getDataSourceState().dataArray;
|
|
12402
|
+
const state = getState();
|
|
12403
|
+
const { activeCellIndex, brain } = state;
|
|
12404
|
+
if (!activeCellIndex) {
|
|
12405
|
+
return false;
|
|
12406
|
+
}
|
|
12407
|
+
let [rowIndex, colIndex] = activeCellIndex;
|
|
12408
|
+
const {
|
|
12409
|
+
start: [startRow, startCol],
|
|
12410
|
+
end: [endRow, endCol]
|
|
12411
|
+
} = brain.getRenderRange();
|
|
12412
|
+
const renderRowCount = endRow - startRow - 1;
|
|
12413
|
+
const renderColCount = endCol - startCol - 1;
|
|
12414
|
+
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
12415
|
+
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
12416
|
+
const minRow = 0;
|
|
12417
|
+
const minCol = 0;
|
|
12418
|
+
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
12419
|
+
colIndex = clamp(colIndex, 0, maxCol);
|
|
12420
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
12421
|
+
const KeyToFunction = {
|
|
12422
|
+
ArrowDown: () => {
|
|
12423
|
+
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
12424
|
+
},
|
|
12425
|
+
ArrowUp: () => {
|
|
12426
|
+
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
12427
|
+
},
|
|
12428
|
+
ArrowLeft: () => {
|
|
12429
|
+
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
12430
|
+
},
|
|
12431
|
+
ArrowRight: () => {
|
|
12432
|
+
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
12433
|
+
},
|
|
12434
|
+
Enter: () => {
|
|
12435
|
+
const rowInfo = dataArray[rowIndex];
|
|
12436
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12437
|
+
return api.toggleGroupRow(rowInfo.groupKeys);
|
|
12438
|
+
}
|
|
12439
|
+
return false;
|
|
12440
|
+
},
|
|
12441
|
+
PageDown: () => {
|
|
12442
|
+
if (!shiftKey) {
|
|
12443
|
+
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
12444
|
+
} else {
|
|
12445
|
+
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
12446
|
+
}
|
|
12447
|
+
},
|
|
12448
|
+
PageUp: () => {
|
|
12449
|
+
if (!shiftKey) {
|
|
12450
|
+
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
12451
|
+
} else {
|
|
12452
|
+
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
12453
|
+
}
|
|
12454
|
+
},
|
|
12455
|
+
End: () => {
|
|
12456
|
+
if (!shiftKey) {
|
|
12457
|
+
rowIndex = maxRow;
|
|
12458
|
+
} else {
|
|
12459
|
+
colIndex = maxCol;
|
|
12460
|
+
}
|
|
12461
|
+
},
|
|
12462
|
+
Home: () => {
|
|
12463
|
+
if (!shiftKey) {
|
|
12464
|
+
rowIndex = minRow;
|
|
12465
|
+
} else {
|
|
12466
|
+
colIndex = minCol;
|
|
12467
|
+
}
|
|
12468
|
+
}
|
|
12469
|
+
};
|
|
12470
|
+
const Fn = KeyToFunction[key];
|
|
12471
|
+
if (!Fn) {
|
|
12472
|
+
return false;
|
|
12473
|
+
}
|
|
12474
|
+
Fn();
|
|
12475
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
12476
|
+
return true;
|
|
12477
|
+
}
|
|
12478
|
+
var validKeys = {
|
|
12479
|
+
ArrowUp: true,
|
|
12480
|
+
ArrowDown: true,
|
|
12481
|
+
ArrowLeft: true,
|
|
12482
|
+
ArrowRight: true,
|
|
12483
|
+
PageUp: true,
|
|
12484
|
+
PageDown: true,
|
|
12485
|
+
Home: true,
|
|
12486
|
+
End: true,
|
|
12487
|
+
Enter: true,
|
|
12488
|
+
" ": true
|
|
12489
|
+
};
|
|
12490
|
+
function handleKeyboardNavigation(options) {
|
|
12491
|
+
const { getState } = options;
|
|
12492
|
+
const state = getState();
|
|
12493
|
+
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
12494
|
+
if (!validKeys[options.key]) {
|
|
12495
|
+
return false;
|
|
12496
|
+
}
|
|
12497
|
+
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
12498
|
+
return handleRowNavigation(options);
|
|
12499
|
+
}
|
|
12500
|
+
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
12501
|
+
return handleCellNavigation(options);
|
|
12502
|
+
}
|
|
12503
|
+
return false;
|
|
12504
|
+
}
|
|
12505
|
+
|
|
12506
|
+
// src/components/InfiniteTable/eventHandlers/keyboardSelection.ts
|
|
12507
|
+
var validKeys2 = {
|
|
12508
|
+
Enter: true,
|
|
12509
|
+
" ": true,
|
|
12510
|
+
a: true
|
|
12511
|
+
};
|
|
12512
|
+
function handleKeyboardSelection(context) {
|
|
12513
|
+
const {
|
|
12514
|
+
getState,
|
|
12515
|
+
getDataSourceState,
|
|
12516
|
+
dataSourceActions,
|
|
12517
|
+
api: imperativeApi,
|
|
12518
|
+
key,
|
|
12519
|
+
ctrlKey,
|
|
12520
|
+
metaKey
|
|
12521
|
+
} = context;
|
|
12522
|
+
if (!validKeys2[key]) {
|
|
12523
|
+
return false;
|
|
12524
|
+
}
|
|
12525
|
+
const state = getState();
|
|
12526
|
+
const dataSourceState = getDataSourceState();
|
|
12527
|
+
const {
|
|
12528
|
+
activeRowIndex,
|
|
12529
|
+
activeCellIndex,
|
|
12530
|
+
keyboardNavigation,
|
|
12531
|
+
keyboardSelection
|
|
12532
|
+
} = state;
|
|
12533
|
+
const { selectionMode, groupBy, rowSelection } = dataSourceState;
|
|
12534
|
+
if (keyboardSelection === false) {
|
|
12535
|
+
return false;
|
|
12536
|
+
}
|
|
12537
|
+
const rowIndex = keyboardNavigation === "row" && activeRowIndex != null ? activeRowIndex : keyboardNavigation === "cell" && activeCellIndex != null ? activeCellIndex[0] : null;
|
|
12538
|
+
const rowInfo = rowIndex != null ? dataSourceState.dataArray[rowIndex] : null;
|
|
12539
|
+
if (!rowInfo || rowIndex == null) {
|
|
12540
|
+
return false;
|
|
12541
|
+
}
|
|
12542
|
+
if (selectionMode === "single-row" && key === " ") {
|
|
12543
|
+
imperativeApi.selectionApi.toggleRowSelection(rowInfo.id);
|
|
12544
|
+
return true;
|
|
12545
|
+
}
|
|
12546
|
+
if (selectionMode !== "multi-row") {
|
|
12547
|
+
return false;
|
|
12548
|
+
}
|
|
12549
|
+
if (key === "a" && (ctrlKey || metaKey)) {
|
|
12550
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12551
|
+
rowSelectionState.selectAll();
|
|
12552
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
12553
|
+
return true;
|
|
12554
|
+
}
|
|
12555
|
+
if (key === " ") {
|
|
12556
|
+
if (groupBy.length) {
|
|
12557
|
+
if (rowInfo.isGroupRow) {
|
|
12558
|
+
imperativeApi.selectionApi.toggleGroupRowSelection(rowInfo.groupKeys);
|
|
12559
|
+
} else {
|
|
12560
|
+
imperativeApi.selectionApi.toggleRowSelection(rowInfo.id);
|
|
12561
|
+
}
|
|
12562
|
+
return true;
|
|
12563
|
+
} else {
|
|
12564
|
+
const event = __spreadValues({}, context);
|
|
12565
|
+
const { renderSelectionCheckBox } = context.getComputed();
|
|
12566
|
+
if (renderSelectionCheckBox) {
|
|
12567
|
+
event.shiftKey = false;
|
|
12568
|
+
event.metaKey = false;
|
|
12569
|
+
event.ctrlKey = true;
|
|
12570
|
+
}
|
|
12571
|
+
return updateRowSelectionOnCellClick(__spreadProps(__spreadValues({}, context), { rowIndex }), event);
|
|
12572
|
+
}
|
|
12573
|
+
}
|
|
12574
|
+
return false;
|
|
12575
|
+
}
|
|
12576
|
+
|
|
12577
|
+
// src/components/InfiniteTable/eventHandlers/onKeyDown.ts
|
|
12578
|
+
function onKeyDown(context, event) {
|
|
12579
|
+
const keyboardHandlerContext = __spreadProps(__spreadValues({}, context), {
|
|
12580
|
+
key: event.key,
|
|
12581
|
+
metaKey: event.metaKey,
|
|
12582
|
+
ctrlKey: event.ctrlKey,
|
|
12583
|
+
shiftKey: event.shiftKey
|
|
12584
|
+
});
|
|
12585
|
+
if (handleKeyboardSelection(keyboardHandlerContext)) {
|
|
12586
|
+
event.preventDefault();
|
|
12587
|
+
}
|
|
12588
|
+
if (handleKeyboardNavigation(keyboardHandlerContext)) {
|
|
12589
|
+
event.preventDefault();
|
|
12590
|
+
}
|
|
12591
|
+
}
|
|
12592
|
+
|
|
12593
|
+
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
12594
|
+
function useEventHandlersContext() {
|
|
12595
|
+
const {
|
|
12596
|
+
getState,
|
|
12597
|
+
componentActions: actions,
|
|
12598
|
+
imperativeApi,
|
|
12599
|
+
getComputed
|
|
12600
|
+
} = useInfiniteTable();
|
|
12601
|
+
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
12602
|
+
const context = (0, import_react48.useMemo)(() => {
|
|
12603
|
+
const context2 = {
|
|
12604
|
+
getComputed,
|
|
12605
|
+
api: imperativeApi,
|
|
12606
|
+
getState,
|
|
12607
|
+
actions,
|
|
12608
|
+
getDataSourceState,
|
|
12609
|
+
dataSourceActions
|
|
12610
|
+
};
|
|
12611
|
+
return context2;
|
|
12612
|
+
}, [getState, actions, getDataSourceState, dataSourceActions]);
|
|
12613
|
+
return context;
|
|
12614
|
+
}
|
|
12615
|
+
function handleDOMEvents() {
|
|
12616
|
+
const context = useEventHandlersContext();
|
|
12617
|
+
(0, import_react48.useEffect)(() => {
|
|
12618
|
+
const removeOnKeyDown = context.getState().keyDown.onChange((event) => {
|
|
12619
|
+
onKeyDown(__spreadProps(__spreadValues({}, context), {
|
|
12620
|
+
key: event.key,
|
|
12621
|
+
metaKey: event.metaKey,
|
|
12622
|
+
ctrlKey: event.ctrlKey,
|
|
12623
|
+
shiftKey: event.shiftKey,
|
|
12624
|
+
preventDefault: () => event.preventDefault()
|
|
12625
|
+
}), event);
|
|
12626
|
+
});
|
|
12627
|
+
function cellClickHandler(cellClickParam) {
|
|
12628
|
+
if (!cellClickParam) {
|
|
12629
|
+
return;
|
|
12630
|
+
}
|
|
12631
|
+
const event = cellClickParam.event;
|
|
12632
|
+
const virtualEvent = {
|
|
12633
|
+
metaKey: event.metaKey,
|
|
12634
|
+
ctrlKey: event.ctrlKey,
|
|
12635
|
+
shiftKey: event.shiftKey,
|
|
12636
|
+
key: "",
|
|
12637
|
+
preventDefault: () => event.preventDefault()
|
|
12638
|
+
};
|
|
12639
|
+
onCellClick(__spreadValues(__spreadProps(__spreadValues({}, context), {
|
|
12640
|
+
rowIndex: cellClickParam.rowIndex,
|
|
12641
|
+
colIndex: cellClickParam.colIndex
|
|
12642
|
+
}), virtualEvent), virtualEvent);
|
|
12643
|
+
}
|
|
12644
|
+
const removeOnCellClick = context.getState().cellClick.onChange(cellClickHandler);
|
|
12645
|
+
return () => {
|
|
12646
|
+
removeOnKeyDown();
|
|
12647
|
+
removeOnCellClick();
|
|
12648
|
+
};
|
|
12649
|
+
}, []);
|
|
12650
|
+
}
|
|
12651
|
+
function subscribeToDOMEvents() {
|
|
12652
|
+
const { getState } = useInfiniteTable();
|
|
12653
|
+
const onKeyDown2 = (0, import_react48.useCallback)((event) => {
|
|
12654
|
+
getState().keyDown(event);
|
|
12655
|
+
}, []);
|
|
12656
|
+
return { onKeyDown: onKeyDown2 };
|
|
12657
|
+
}
|
|
12658
|
+
function useDOMEventHandlers() {
|
|
12659
|
+
handleDOMEvents();
|
|
12660
|
+
return subscribeToDOMEvents();
|
|
12661
|
+
}
|
|
12662
|
+
|
|
12120
12663
|
// src/components/InfiniteTable/index.tsx
|
|
12121
12664
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
12122
12665
|
var HOVERED_CLASS_NAMES = [RowHoverCls, "InfiniteColumnCell--hovered"];
|
|
@@ -12134,14 +12677,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
12134
12677
|
});
|
|
12135
12678
|
var InfiniteTableComponent = React38.memo(function InfiniteTableComponent2() {
|
|
12136
12679
|
var _a;
|
|
12137
|
-
const {
|
|
12138
|
-
componentState,
|
|
12139
|
-
getComputed,
|
|
12140
|
-
computed,
|
|
12141
|
-
componentActions: actions,
|
|
12142
|
-
getState,
|
|
12143
|
-
imperativeApi
|
|
12144
|
-
} = useInfiniteTable();
|
|
12680
|
+
const { componentState, getComputed, computed, imperativeApi } = useInfiniteTable();
|
|
12145
12681
|
const {
|
|
12146
12682
|
componentState: { loading, dataArray },
|
|
12147
12683
|
getState: getDataSourceState,
|
|
@@ -12170,7 +12706,7 @@ var InfiniteTableComponent = React38.memo(function InfiniteTableComponent2() {
|
|
|
12170
12706
|
} = componentState;
|
|
12171
12707
|
useScrollToActiveRow(activeRowIndex, dataArray.length, imperativeApi);
|
|
12172
12708
|
useScrollToActiveCell(activeCellIndex, dataArray.length, imperativeApi);
|
|
12173
|
-
|
|
12709
|
+
const { onKeyDown: onKeyDown2 } = useDOMEventHandlers();
|
|
12174
12710
|
const { bodySize } = componentState;
|
|
12175
12711
|
const { scrollbars } = computed;
|
|
12176
12712
|
const { renderCell } = useCellRendering({
|
|
@@ -12198,22 +12734,8 @@ var InfiniteTableComponent = React38.memo(function InfiniteTableComponent2() {
|
|
|
12198
12734
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
12199
12735
|
}, [scrollStopDelay]);
|
|
12200
12736
|
useAutoSizeColumns();
|
|
12201
|
-
const onKeyDown = (0, import_react49.useCallback)((event) => {
|
|
12202
|
-
getState().keyDown(event);
|
|
12203
|
-
if (handleKeyboardNavigation({
|
|
12204
|
-
getState,
|
|
12205
|
-
actions,
|
|
12206
|
-
getDataSourceState,
|
|
12207
|
-
getComputed,
|
|
12208
|
-
imperativeApi,
|
|
12209
|
-
key: event.key,
|
|
12210
|
-
shiftKey: !!event.shiftKey
|
|
12211
|
-
})) {
|
|
12212
|
-
event.preventDefault();
|
|
12213
|
-
}
|
|
12214
|
-
}, []);
|
|
12215
12737
|
return /* @__PURE__ */ React38.createElement("div", __spreadValues({
|
|
12216
|
-
onKeyDown,
|
|
12738
|
+
onKeyDown: onKeyDown2,
|
|
12217
12739
|
ref: domRef
|
|
12218
12740
|
}, domProps), header ? /* @__PURE__ */ React38.createElement(TableHeaderWrapper, {
|
|
12219
12741
|
bodyBrain: brain,
|
|
@@ -12260,8 +12782,14 @@ function InfiniteTableContextProvider() {
|
|
|
12260
12782
|
globalThis.getComputed = getComputed;
|
|
12261
12783
|
}
|
|
12262
12784
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
12263
|
-
const [imperativeApi] =
|
|
12264
|
-
return getImperativeApi(
|
|
12785
|
+
const [imperativeApi] = React38.useState(() => {
|
|
12786
|
+
return getImperativeApi({
|
|
12787
|
+
getComputed,
|
|
12788
|
+
getState,
|
|
12789
|
+
getDataSourceState,
|
|
12790
|
+
componentActions,
|
|
12791
|
+
dataSourceActions
|
|
12792
|
+
});
|
|
12265
12793
|
});
|
|
12266
12794
|
const contextValue = {
|
|
12267
12795
|
componentActions,
|