@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.esm.js
CHANGED
|
@@ -638,9 +638,9 @@ import {
|
|
|
638
638
|
StrictMode,
|
|
639
639
|
createElement as createElement35,
|
|
640
640
|
memo as memo13,
|
|
641
|
-
useEffect as useEffect30
|
|
641
|
+
useEffect as useEffect30,
|
|
642
|
+
useState as useState15
|
|
642
643
|
} from "react";
|
|
643
|
-
import { useCallback as useCallback18, useState as useState16 } from "react";
|
|
644
644
|
|
|
645
645
|
// src/utils/join.ts
|
|
646
646
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -1018,32 +1018,33 @@ var AvoidReactDiff = memo2(AvoidReactDiffFn);
|
|
|
1018
1018
|
|
|
1019
1019
|
// src/components/utils/buildSubscriptionCallback.tsx
|
|
1020
1020
|
function buildSubscriptionCallback(withRaf = false) {
|
|
1021
|
-
let
|
|
1021
|
+
let lastCallValue = null;
|
|
1022
1022
|
let fns = [];
|
|
1023
1023
|
let rafId = null;
|
|
1024
1024
|
const updater = (items, callback) => {
|
|
1025
|
+
const results = [];
|
|
1025
1026
|
if (withRaf) {
|
|
1026
1027
|
if (rafId != null) {
|
|
1027
1028
|
cancelAnimationFrame(rafId);
|
|
1028
1029
|
rafId = null;
|
|
1029
1030
|
}
|
|
1030
1031
|
requestAnimationFrame(() => {
|
|
1031
|
-
|
|
1032
|
+
lastCallValue = items;
|
|
1032
1033
|
rafId = null;
|
|
1033
1034
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1034
|
-
fns[i](items);
|
|
1035
|
+
results.push(fns[i](items));
|
|
1035
1036
|
}
|
|
1036
|
-
callback == null ? void 0 : callback();
|
|
1037
|
+
callback == null ? void 0 : callback(results);
|
|
1037
1038
|
});
|
|
1038
1039
|
} else {
|
|
1039
|
-
|
|
1040
|
+
lastCallValue = items;
|
|
1040
1041
|
for (let i = 0, len = fns.length; i < len; i++) {
|
|
1041
|
-
fns[i](items);
|
|
1042
|
+
results.push(fns[i](items));
|
|
1042
1043
|
}
|
|
1043
|
-
callback == null ? void 0 : callback();
|
|
1044
|
+
callback == null ? void 0 : callback(results);
|
|
1044
1045
|
}
|
|
1045
1046
|
};
|
|
1046
|
-
updater.get = () =>
|
|
1047
|
+
updater.get = () => lastCallValue;
|
|
1047
1048
|
updater.onChange = (fn) => {
|
|
1048
1049
|
fns.push(fn);
|
|
1049
1050
|
return () => {
|
|
@@ -1054,6 +1055,7 @@ function buildSubscriptionCallback(withRaf = false) {
|
|
|
1054
1055
|
updater(null);
|
|
1055
1056
|
fns.length = 0;
|
|
1056
1057
|
};
|
|
1058
|
+
updater.getListenersCount = () => fns.length;
|
|
1057
1059
|
return updater;
|
|
1058
1060
|
}
|
|
1059
1061
|
|
|
@@ -2247,13 +2249,19 @@ var DeepMap = class {
|
|
|
2247
2249
|
this.visitDepthFirst = (fn) => {
|
|
2248
2250
|
this.visitWithNext([], fn);
|
|
2249
2251
|
};
|
|
2250
|
-
this.visitWithNext = (parentKeys, fn, currentMap = this.map) => {
|
|
2252
|
+
this.visitWithNext = (parentKeys, fn, currentMap = this.map, depthLimit, skipSelfValue) => {
|
|
2251
2253
|
if (!currentMap) {
|
|
2252
2254
|
return;
|
|
2253
2255
|
}
|
|
2254
2256
|
let i = 0;
|
|
2255
2257
|
const hasEmptyKey = currentMap.has(this.emptyKey);
|
|
2256
|
-
let allowEmptyKey = true;
|
|
2258
|
+
let allowEmptyKey = skipSelfValue ? false : true;
|
|
2259
|
+
if (depthLimit !== void 0) {
|
|
2260
|
+
if (depthLimit < 0) {
|
|
2261
|
+
return;
|
|
2262
|
+
}
|
|
2263
|
+
depthLimit--;
|
|
2264
|
+
}
|
|
2257
2265
|
const iterator = (_, key) => {
|
|
2258
2266
|
const pair = currentMap.get(key);
|
|
2259
2267
|
if (!pair) {
|
|
@@ -2265,7 +2273,7 @@ var DeepMap = class {
|
|
|
2265
2273
|
return;
|
|
2266
2274
|
}
|
|
2267
2275
|
const keys = isEmptyKey ? [] : [...parentKeys, key];
|
|
2268
|
-
|
|
2276
|
+
let next = map2 ? () => this.visitWithNext(keys, fn, map2, depthLimit !== void 0 ? depthLimit - 1 : void 0) : void 0;
|
|
2269
2277
|
if (pair.hasOwnProperty("value")) {
|
|
2270
2278
|
fn(pair.value, keys, i, next);
|
|
2271
2279
|
i++;
|
|
@@ -2297,41 +2305,84 @@ var DeepMap = class {
|
|
|
2297
2305
|
});
|
|
2298
2306
|
}
|
|
2299
2307
|
}
|
|
2300
|
-
getValuesStartingWith(keys) {
|
|
2308
|
+
getValuesStartingWith(keys, excludeSelf, depthLimit) {
|
|
2301
2309
|
const result = [];
|
|
2302
2310
|
this.getStartingWith(keys, (_keys, value) => {
|
|
2303
2311
|
result.push(value);
|
|
2304
|
-
});
|
|
2312
|
+
}, excludeSelf, depthLimit);
|
|
2305
2313
|
return result;
|
|
2306
2314
|
}
|
|
2307
|
-
getKeysStartingWith(keys) {
|
|
2315
|
+
getKeysStartingWith(keys, excludeSelf, depthLimit) {
|
|
2308
2316
|
const result = [];
|
|
2309
2317
|
this.getStartingWith(keys, (keys2) => {
|
|
2310
2318
|
result.push(keys2);
|
|
2311
|
-
});
|
|
2319
|
+
}, excludeSelf, depthLimit);
|
|
2312
2320
|
return result;
|
|
2313
2321
|
}
|
|
2314
|
-
getStartingWith(keys, fn) {
|
|
2322
|
+
getStartingWith(keys, fn, excludeSelf, depthLimit) {
|
|
2323
|
+
let currentMap = this.map;
|
|
2324
|
+
let pair;
|
|
2325
|
+
let stop = false;
|
|
2326
|
+
if (keys.length) {
|
|
2327
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2328
|
+
const key = keys[i];
|
|
2329
|
+
pair = currentMap.get(key);
|
|
2330
|
+
if (!pair || !pair.map) {
|
|
2331
|
+
stop = true;
|
|
2332
|
+
if (i === len - 1) {
|
|
2333
|
+
stop = true;
|
|
2334
|
+
break;
|
|
2335
|
+
} else {
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
currentMap = pair.map;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
if (pair && pair.value !== void 0) {
|
|
2343
|
+
if (!excludeSelf) {
|
|
2344
|
+
fn(keys, pair.value);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
if (stop) {
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
this.visitWithNext(keys, (value, keys2, _i, next) => {
|
|
2351
|
+
fn(keys2, value);
|
|
2352
|
+
next == null ? void 0 : next();
|
|
2353
|
+
}, currentMap, depthLimit, excludeSelf);
|
|
2354
|
+
}
|
|
2355
|
+
getMapAt(keys) {
|
|
2315
2356
|
let currentMap = this.map;
|
|
2316
2357
|
let pair;
|
|
2317
2358
|
if (!keys.length) {
|
|
2318
|
-
|
|
2359
|
+
return this.map;
|
|
2319
2360
|
}
|
|
2320
2361
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2321
2362
|
const key = keys[i];
|
|
2322
2363
|
pair = currentMap.get(key);
|
|
2323
2364
|
if (!pair || !pair.map) {
|
|
2324
|
-
return;
|
|
2365
|
+
return void 0;
|
|
2325
2366
|
}
|
|
2326
2367
|
currentMap = pair.map;
|
|
2327
2368
|
}
|
|
2328
|
-
|
|
2329
|
-
|
|
2369
|
+
return currentMap;
|
|
2370
|
+
}
|
|
2371
|
+
getAllChildrenSizeFor(keys) {
|
|
2372
|
+
let currentMap = this.map;
|
|
2373
|
+
let pair;
|
|
2374
|
+
if (!keys.length) {
|
|
2375
|
+
return this.length;
|
|
2330
2376
|
}
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2377
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2378
|
+
const key = keys[i];
|
|
2379
|
+
pair = currentMap.get(key);
|
|
2380
|
+
if (!pair || !pair.map) {
|
|
2381
|
+
return 0;
|
|
2382
|
+
}
|
|
2383
|
+
currentMap = pair.map;
|
|
2384
|
+
}
|
|
2385
|
+
return pair.length;
|
|
2335
2386
|
}
|
|
2336
2387
|
getDirectChildrenSizeFor(keys) {
|
|
2337
2388
|
var _a;
|
|
@@ -2361,7 +2412,9 @@ var DeepMap = class {
|
|
|
2361
2412
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2362
2413
|
const key = keys[i];
|
|
2363
2414
|
const last = i === len - 1;
|
|
2364
|
-
const pair = currentMap.get(key) || {
|
|
2415
|
+
const pair = currentMap.get(key) || {
|
|
2416
|
+
length: 0
|
|
2417
|
+
};
|
|
2365
2418
|
if (last) {
|
|
2366
2419
|
pair.revision = this.revision++;
|
|
2367
2420
|
pair.value = value;
|
|
@@ -2372,6 +2425,7 @@ var DeepMap = class {
|
|
|
2372
2425
|
pair.map = new Map();
|
|
2373
2426
|
currentMap.set(key, pair);
|
|
2374
2427
|
}
|
|
2428
|
+
pair.length++;
|
|
2375
2429
|
currentMap = pair.map;
|
|
2376
2430
|
}
|
|
2377
2431
|
}
|
|
@@ -2422,6 +2476,7 @@ var DeepMap = class {
|
|
|
2422
2476
|
keys = [...keys];
|
|
2423
2477
|
}
|
|
2424
2478
|
const maps = [currentMap];
|
|
2479
|
+
const pairs = [];
|
|
2425
2480
|
let result = false;
|
|
2426
2481
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
2427
2482
|
const key = keys[i];
|
|
@@ -2433,6 +2488,9 @@ var DeepMap = class {
|
|
|
2433
2488
|
delete pair.value;
|
|
2434
2489
|
delete pair.revision;
|
|
2435
2490
|
result = true;
|
|
2491
|
+
pairs.forEach((pair2) => {
|
|
2492
|
+
pair2.length--;
|
|
2493
|
+
});
|
|
2436
2494
|
this.length--;
|
|
2437
2495
|
}
|
|
2438
2496
|
if (pair.map && pair.map.size === 0) {
|
|
@@ -2448,6 +2506,7 @@ var DeepMap = class {
|
|
|
2448
2506
|
result = false;
|
|
2449
2507
|
break;
|
|
2450
2508
|
}
|
|
2509
|
+
pairs.push(pair);
|
|
2451
2510
|
currentMap = pair.map;
|
|
2452
2511
|
maps.push(currentMap);
|
|
2453
2512
|
}
|
|
@@ -2521,6 +2580,19 @@ var DeepMap = class {
|
|
|
2521
2580
|
});
|
|
2522
2581
|
return result;
|
|
2523
2582
|
}
|
|
2583
|
+
valuesAt(keys) {
|
|
2584
|
+
const map2 = this.getMapAt(keys);
|
|
2585
|
+
if (!map2) {
|
|
2586
|
+
return [];
|
|
2587
|
+
}
|
|
2588
|
+
const result = [];
|
|
2589
|
+
map2.forEach((bag) => {
|
|
2590
|
+
if (bag.value !== void 0) {
|
|
2591
|
+
result.push(bag.value);
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2594
|
+
return result;
|
|
2595
|
+
}
|
|
2524
2596
|
values() {
|
|
2525
2597
|
return this.sortedIterator((pair) => pair.value);
|
|
2526
2598
|
}
|
|
@@ -3592,11 +3664,11 @@ var useRerender = () => {
|
|
|
3592
3664
|
};
|
|
3593
3665
|
|
|
3594
3666
|
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3595
|
-
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1
|
|
3596
|
-
var ActiveIndicatorWrapperCls = "
|
|
3667
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwg _16lm1iw3 _16lm1iw15 _16lm1iw13", hidden: "nxbq1c3 nxbq1c1 _16lm1iwg _16lm1iw3 _16lm1iw15 _16lm1iw13" };
|
|
3668
|
+
var ActiveIndicatorWrapperCls = "_16lm1iwg _16lm1iw3 _16lm1iw15 _16lm1iw13 _16lm1iwz _16lm1iwp";
|
|
3597
3669
|
|
|
3598
3670
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3599
|
-
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0
|
|
3671
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwg _16lm1iw3 _16lm1iw12 _16lm1iw13 _16lm1iw15", hidden: "j26lrx2 j26lrx0 _16lm1iwg _16lm1iw3 _16lm1iw12 _16lm1iw13 _16lm1iw15" };
|
|
3600
3672
|
|
|
3601
3673
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3602
3674
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
@@ -3887,10 +3959,10 @@ var usePrevious = (value, initialValue) => {
|
|
|
3887
3959
|
};
|
|
3888
3960
|
|
|
3889
3961
|
// src/components/hooks/useComponentState/index.tsx
|
|
3890
|
-
var notifyChange = (props, callbackPropName,
|
|
3962
|
+
var notifyChange = (props, callbackPropName, values) => {
|
|
3891
3963
|
const callbackProp = props[callbackPropName];
|
|
3892
3964
|
if (typeof callbackProp === "function") {
|
|
3893
|
-
callbackProp(
|
|
3965
|
+
callbackProp(...values);
|
|
3894
3966
|
}
|
|
3895
3967
|
};
|
|
3896
3968
|
var debug3 = dbg("rerender");
|
|
@@ -3919,14 +3991,14 @@ function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward
|
|
|
3919
3991
|
}
|
|
3920
3992
|
}
|
|
3921
3993
|
if (notifyTheChange) {
|
|
3922
|
-
let
|
|
3994
|
+
let callbackParams = [value];
|
|
3923
3995
|
let callbackName = `on${toUpperFirst(stateKey)}Change`;
|
|
3924
3996
|
if (mappedCallbacks && mappedCallbacks[key]) {
|
|
3925
3997
|
const res = mappedCallbacks[key](value, state2);
|
|
3926
3998
|
callbackName = res.callbackName || callbackName;
|
|
3927
|
-
|
|
3999
|
+
callbackParams = res.callbackParams;
|
|
3928
4000
|
}
|
|
3929
|
-
notifyChange(props, callbackName,
|
|
4001
|
+
notifyChange(props, callbackName, callbackParams);
|
|
3930
4002
|
}
|
|
3931
4003
|
const forwardFn = propsToForward[key];
|
|
3932
4004
|
if (typeof forwardFn === "function") {
|
|
@@ -4143,20 +4215,20 @@ var useInternalProps = () => {
|
|
|
4143
4215
|
};
|
|
4144
4216
|
|
|
4145
4217
|
// src/components/InfiniteTable/utilities.css.ts
|
|
4146
|
-
var alignItems = { center: "
|
|
4147
|
-
var cssEllipsisClassName = "
|
|
4148
|
-
var cursor = { pointer: "
|
|
4149
|
-
var display = { flex: "
|
|
4150
|
-
var flex = { "1": "
|
|
4151
|
-
var flexFlow = { column: "
|
|
4152
|
-
var justifyContent = { center: "
|
|
4153
|
-
var left = { "0": "
|
|
4154
|
-
var overflow = { hidden: "
|
|
4218
|
+
var alignItems = { center: "_16lm1iw1h", stretch: "_16lm1iw1i" };
|
|
4219
|
+
var cssEllipsisClassName = "_16lm1iw1s _16lm1iw1t _16lm1iw1m";
|
|
4220
|
+
var cursor = { pointer: "_16lm1iwe", colResize: "_16lm1iwf" };
|
|
4221
|
+
var display = { flex: "_16lm1iwu", none: "_16lm1iwv", block: "_16lm1iww", inlineBlock: "_16lm1iwx" };
|
|
4222
|
+
var flex = { "1": "_16lm1iwh", none: "_16lm1iwi" };
|
|
4223
|
+
var flexFlow = { column: "_16lm1iw1d", columnReverse: "_16lm1iw1e", row: "_16lm1iw1f", rowReverse: "_16lm1iw1g" };
|
|
4224
|
+
var justifyContent = { center: "_16lm1iw1j", start: "_16lm1iw1k", end: "_16lm1iw1l" };
|
|
4225
|
+
var left = { "0": "_16lm1iw15", "100%": "_16lm1iw16", auto: "_16lm1iw17" };
|
|
4226
|
+
var overflow = { hidden: "_16lm1iw1m", auto: "_16lm1iw1n", visible: "_16lm1iw1o" };
|
|
4155
4227
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
4156
|
-
var top = { "0": "
|
|
4228
|
+
var top = { "0": "_16lm1iw13", "100%": "_16lm1iw14" };
|
|
4157
4229
|
var transformTranslateZero = "_16lm1iwa";
|
|
4158
|
-
var userSelect = { none: "
|
|
4159
|
-
var zIndex = { "1": "
|
|
4230
|
+
var userSelect = { none: "_16lm1iwy" };
|
|
4231
|
+
var zIndex = { "1": "_16lm1iwj", "10": "_16lm1iwk", "100": "_16lm1iwl", "1000": "_16lm1iwm", "10000": "_16lm1iwn", "100000": "_16lm1iwo", "1000000": "_16lm1iwp", "10000000": "_16lm1iwq", "1k": "_16lm1iwr", "10k": "_16lm1iws", "100k": "_16lm1iwt" };
|
|
4160
4232
|
|
|
4161
4233
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
4162
4234
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
@@ -4253,6 +4325,7 @@ var defaultFilterTypes = getFilterTypes();
|
|
|
4253
4325
|
|
|
4254
4326
|
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
4255
4327
|
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
4328
|
+
var _a;
|
|
4256
4329
|
const result = [...baseClasses];
|
|
4257
4330
|
const variantObject = {
|
|
4258
4331
|
filtered: column.computedFiltered,
|
|
@@ -4262,7 +4335,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4262
4335
|
firstInCategory: column.computedFirstInCategory,
|
|
4263
4336
|
lastInCategory: column.computedLastInCategory,
|
|
4264
4337
|
pinned: column.computedPinned || false,
|
|
4265
|
-
rowSelected: extraFlags.rowSelected,
|
|
4338
|
+
rowSelected: (_a = extraFlags.rowSelected) != null ? _a : "null",
|
|
4266
4339
|
rowActive: extraFlags.rowActive,
|
|
4267
4340
|
dragging: extraFlags.dragging,
|
|
4268
4341
|
zebra: extraFlags.zebra
|
|
@@ -4317,14 +4390,14 @@ var useInfiniteTable = () => {
|
|
|
4317
4390
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4318
4391
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4319
4392
|
var FooterCls = "_16lm1iw1";
|
|
4320
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4393
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwu _16lm1iw1d _16lm1iw0";
|
|
4321
4394
|
var InfiniteClsHasPinnedEnd = "_1yeub2vo";
|
|
4322
4395
|
var InfiniteClsHasPinnedStart = "_1yeub2vn";
|
|
4323
4396
|
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"]] });
|
|
4324
4397
|
var InfiniteClsShiftingColumns = "_1yeub2vl";
|
|
4325
|
-
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2
|
|
4398
|
+
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw13 _16lm1iwf _16lm1iwy _16lm1iw11 _16lm1iw1q _16lm1iwg _16lm1iwq";
|
|
4326
4399
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4327
|
-
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2
|
|
4400
|
+
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw13 _16lm1iwf _16lm1iwy _16lm1iw11 _16lm1iw1q _16lm1iwg _16lm1iwq";
|
|
4328
4401
|
|
|
4329
4402
|
// src/components/utils/getScrollbarWidth.ts
|
|
4330
4403
|
var scrollbarWidth;
|
|
@@ -4902,6 +4975,9 @@ var useColumnPointerEvents = ({
|
|
|
4902
4975
|
} = useInfiniteTable();
|
|
4903
4976
|
const onPointerDown = useCallback6((e) => {
|
|
4904
4977
|
var _a2;
|
|
4978
|
+
if (e.target.tagName === "INPUT") {
|
|
4979
|
+
return;
|
|
4980
|
+
}
|
|
4905
4981
|
const {
|
|
4906
4982
|
computedVisibleColumns,
|
|
4907
4983
|
computedVisibleColumnsMap,
|
|
@@ -4910,6 +4986,9 @@ var useColumnPointerEvents = ({
|
|
|
4910
4986
|
computedPinnedEndColumns
|
|
4911
4987
|
} = getComputed();
|
|
4912
4988
|
const dragColumn = computedVisibleColumnsMap.get(columnId);
|
|
4989
|
+
if (!dragColumn.computedDraggable) {
|
|
4990
|
+
return;
|
|
4991
|
+
}
|
|
4913
4992
|
const target = domRef.current;
|
|
4914
4993
|
const targetRect = target.getBoundingClientRect();
|
|
4915
4994
|
const tableRect = rootRef.current.getBoundingClientRect();
|
|
@@ -5034,8 +5113,8 @@ function objectValuesExcept(obj, exceptList) {
|
|
|
5034
5113
|
|
|
5035
5114
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
5036
5115
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5037
|
-
var ColumnCellCls = "_1eexc2a6 _1eexc2a5
|
|
5038
|
-
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: "
|
|
5116
|
+
var ColumnCellCls = "_1eexc2a6 _1eexc2a5 _16lm1iwu _16lm1iw1f _16lm1iw1h _16lm1iw2 _16lm1iw1r _16lm1iw1s _16lm1iwy";
|
|
5117
|
+
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"]] });
|
|
5039
5118
|
var SelectionCheckboxCls = "_1eexc2a7";
|
|
5040
5119
|
|
|
5041
5120
|
// src/components/InfiniteTable/components/CheckBox.tsx
|
|
@@ -5045,7 +5124,7 @@ import {
|
|
|
5045
5124
|
import { useEffect as useEffect9, useRef as useRef11 } from "react";
|
|
5046
5125
|
|
|
5047
5126
|
// src/components/InfiniteTable/components/CheckBox.css.ts
|
|
5048
|
-
var CheckBoxCls = "
|
|
5127
|
+
var CheckBoxCls = "_16lm1iwe";
|
|
5049
5128
|
|
|
5050
5129
|
// src/components/InfiniteTable/components/CheckBox.tsx
|
|
5051
5130
|
function forwardProps2() {
|
|
@@ -5060,7 +5139,7 @@ var InfiniteCheckBoxRoot = getComponentStateRoot({
|
|
|
5060
5139
|
checked: (checked) => {
|
|
5061
5140
|
return {
|
|
5062
5141
|
callbackName: "onChange",
|
|
5063
|
-
|
|
5142
|
+
callbackParams: [checked]
|
|
5064
5143
|
};
|
|
5065
5144
|
}
|
|
5066
5145
|
},
|
|
@@ -5185,7 +5264,7 @@ var defaultRenderSelectionCheckBox = (params) => {
|
|
|
5185
5264
|
deselectCurrentRow();
|
|
5186
5265
|
}
|
|
5187
5266
|
},
|
|
5188
|
-
checked: rowInfo.
|
|
5267
|
+
checked: rowInfo.rowSelected
|
|
5189
5268
|
});
|
|
5190
5269
|
};
|
|
5191
5270
|
function isColumnWithField(c) {
|
|
@@ -5204,6 +5283,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5204
5283
|
toggleGroupRow,
|
|
5205
5284
|
rowIndex,
|
|
5206
5285
|
rowHeight,
|
|
5286
|
+
columnsMap,
|
|
5207
5287
|
domRef,
|
|
5208
5288
|
hidden,
|
|
5209
5289
|
showZebraRows
|
|
@@ -5279,23 +5359,24 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5279
5359
|
}, rest);
|
|
5280
5360
|
const renderParam = __spreadProps(__spreadValues({
|
|
5281
5361
|
column,
|
|
5362
|
+
columnsMap,
|
|
5282
5363
|
domRef,
|
|
5283
5364
|
groupRowInfo
|
|
5284
5365
|
}, rest), {
|
|
5285
5366
|
selectionMode,
|
|
5286
|
-
selectRow: imperativeApi.selectRow,
|
|
5287
|
-
deselectRow: imperativeApi.deselectRow,
|
|
5288
|
-
toggleRowSelection: imperativeApi.toggleRowSelection,
|
|
5367
|
+
selectRow: imperativeApi.selectionApi.selectRow,
|
|
5368
|
+
deselectRow: imperativeApi.selectionApi.deselectRow,
|
|
5369
|
+
toggleRowSelection: imperativeApi.selectionApi.toggleRowSelection,
|
|
5289
5370
|
renderBag: {
|
|
5290
5371
|
value,
|
|
5291
5372
|
selectionCheckBox: null,
|
|
5292
5373
|
groupIcon: null
|
|
5293
5374
|
},
|
|
5294
5375
|
selectCurrentRow: useCallback7(() => {
|
|
5295
|
-
return imperativeApi.selectRow(rowInfo.id);
|
|
5376
|
+
return imperativeApi.selectionApi.selectRow(rowInfo.id, rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0);
|
|
5296
5377
|
}, [rowInfo]),
|
|
5297
5378
|
deselectCurrentRow: useCallback7(() => {
|
|
5298
|
-
return imperativeApi.deselectRow(rowInfo.id);
|
|
5379
|
+
return imperativeApi.selectionApi.deselectRow(rowInfo.id, rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0);
|
|
5299
5380
|
}, [rowInfo]),
|
|
5300
5381
|
rowIndex,
|
|
5301
5382
|
toggleGroupRow,
|
|
@@ -5306,7 +5387,10 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5306
5387
|
toggleGroupRow(rowInfo.groupKeys);
|
|
5307
5388
|
}, [rowInfo]),
|
|
5308
5389
|
toggleCurrentGroupRowSelection: useCallback7(() => {
|
|
5309
|
-
|
|
5390
|
+
if (!rowInfo.isGroupRow) {
|
|
5391
|
+
return;
|
|
5392
|
+
}
|
|
5393
|
+
return imperativeApi.selectionApi.toggleGroupRowSelection(rowInfo.isGroupRow ? rowInfo.groupKeys : []);
|
|
5310
5394
|
}, [rowInfo]),
|
|
5311
5395
|
groupBy: computedDataSource.groupBy,
|
|
5312
5396
|
pivotBy: computedDataSource.pivotBy
|
|
@@ -5323,7 +5407,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5323
5407
|
})
|
|
5324
5408
|
});
|
|
5325
5409
|
}
|
|
5326
|
-
if (column.renderSelectionCheckBox) {
|
|
5410
|
+
if (column.renderSelectionCheckBox && selectionMode == "multi-row") {
|
|
5327
5411
|
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ createElement15(RenderCellHookComponent, {
|
|
5328
5412
|
render: defaultRenderSelectionCheckBox,
|
|
5329
5413
|
renderParam
|
|
@@ -5367,7 +5451,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5367
5451
|
renderParam
|
|
5368
5452
|
});
|
|
5369
5453
|
}
|
|
5370
|
-
return /* @__PURE__ */ createElement15(Fragment2, null, renderParam.renderBag.groupIcon, renderParam.renderBag.selectionCheckBox, renderParam.renderBag.value);
|
|
5454
|
+
return /* @__PURE__ */ createElement15(Fragment2, 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);
|
|
5371
5455
|
}, [
|
|
5372
5456
|
column,
|
|
5373
5457
|
hidden,
|
|
@@ -5425,6 +5509,15 @@ function RenderCellHookComponent(props) {
|
|
|
5425
5509
|
renderParam: props.renderParam
|
|
5426
5510
|
}));
|
|
5427
5511
|
}
|
|
5512
|
+
function RenderHeaderCellHookComponent(props) {
|
|
5513
|
+
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
5514
|
+
return /* @__PURE__ */ createElement16(ContextProvider, {
|
|
5515
|
+
value: props.renderParam
|
|
5516
|
+
}, /* @__PURE__ */ createElement16(RenderHookComponent, {
|
|
5517
|
+
render: props.render,
|
|
5518
|
+
renderParam: props.renderParam
|
|
5519
|
+
}));
|
|
5520
|
+
}
|
|
5428
5521
|
|
|
5429
5522
|
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
5430
5523
|
import {
|
|
@@ -5472,19 +5565,19 @@ import { useEffect as useEffect10, useState as useState6 } from "react";
|
|
|
5472
5565
|
|
|
5473
5566
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
5474
5567
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5475
|
-
var CellCls = "_1eexc2a5
|
|
5476
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "
|
|
5477
|
-
var HeaderCellProxy = "_12zfob1k
|
|
5478
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob1l
|
|
5479
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob16
|
|
5480
|
-
var HeaderFilterCls = "
|
|
5481
|
-
var HeaderFilterEditorCls = "
|
|
5482
|
-
var HeaderGroupCls = "
|
|
5568
|
+
var CellCls = "_1eexc2a5 _16lm1iwu _16lm1iw1f _16lm1iw1h _16lm1iw2 _16lm1iw1r _16lm1iw1s _16lm1iwy";
|
|
5569
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob11e _16lm1iw10 _16lm1iw12 _16lm1iwu _16lm1iw1f _16lm1iw1h", variantClassNames: { filtered: { false: "_12zfob11f", true: "_12zfob11g" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5570
|
+
var HeaderCellProxy = "_12zfob1k _16lm1iw1s _16lm1iw1t _16lm1iw1m";
|
|
5571
|
+
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"]] });
|
|
5572
|
+
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"]] });
|
|
5573
|
+
var HeaderFilterCls = "_12zfob11j _16lm1iwu _16lm1iw1f _16lm1iw1h _16lm1iw1";
|
|
5574
|
+
var HeaderFilterEditorCls = "_16lm1iw12 _16lm1iw10";
|
|
5575
|
+
var HeaderGroupCls = "_12zfob11i _16lm1iwu _16lm1iw1f _16lm1iw1h";
|
|
5483
5576
|
var HeaderScrollbarPlaceholderCls = "_12zfob15 _16lm1iw2";
|
|
5484
5577
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
5485
5578
|
var HeaderSortIconIndexCls = "_12zfob14";
|
|
5486
5579
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob11", center: "_12zfob12", end: "_12zfob13" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5487
|
-
var HeaderWrapperCls = "
|
|
5580
|
+
var HeaderWrapperCls = "_12zfob11h _16lm1iw1m _16lm1iw1 _16lm1iwu _16lm1iw1f";
|
|
5488
5581
|
|
|
5489
5582
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
5490
5583
|
var defaultLineStyle = {
|
|
@@ -6054,9 +6147,9 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
6054
6147
|
|
|
6055
6148
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
6056
6149
|
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6057
|
-
var ResizeHandleCls = "zneyzh0 _16lm1iw2
|
|
6058
|
-
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "zneyzhb _16lm1iw2
|
|
6059
|
-
var ResizeHandleRecipeCls = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { computedPinned: { start: "zneyzh1", end: "zneyzh2
|
|
6150
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iw13 _16lm1iw1a _16lm1iw18 _16lm1iwf _16lm1iw1m";
|
|
6151
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "zneyzhb _16lm1iw2 _16lm1iw13 _16lm1iw18", variantClassNames: { constrained: { false: "zneyzhc", true: "zneyzhd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
6152
|
+
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"]] });
|
|
6060
6153
|
|
|
6061
6154
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
6062
6155
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
@@ -6199,6 +6292,23 @@ function useColumnResizeHandle(column) {
|
|
|
6199
6292
|
}
|
|
6200
6293
|
|
|
6201
6294
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
6295
|
+
var defaultRenderSelectionCheckBox2 = (params) => {
|
|
6296
|
+
const { allRowsSelected, someRowsSelected, api } = params;
|
|
6297
|
+
const selected = allRowsSelected ? true : someRowsSelected ? null : false;
|
|
6298
|
+
return /* @__PURE__ */ createElement22(InfiniteCheckBox, {
|
|
6299
|
+
domProps: {
|
|
6300
|
+
className: SelectionCheckboxCls
|
|
6301
|
+
},
|
|
6302
|
+
onChange: (selected2) => {
|
|
6303
|
+
if (selected2) {
|
|
6304
|
+
api.selectionApi.selectAll();
|
|
6305
|
+
} else {
|
|
6306
|
+
api.selectionApi.deselectAll();
|
|
6307
|
+
}
|
|
6308
|
+
},
|
|
6309
|
+
checked: selected
|
|
6310
|
+
});
|
|
6311
|
+
};
|
|
6202
6312
|
var InfiniteTableHeaderCellContext = createContext5(null);
|
|
6203
6313
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
6204
6314
|
var InfiniteTableHeaderCellClassName = `${rootClassName9}HeaderCell`;
|
|
@@ -6208,6 +6318,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6208
6318
|
const column = props.column;
|
|
6209
6319
|
const {
|
|
6210
6320
|
computed: { showColumnFilters },
|
|
6321
|
+
imperativeApi: api,
|
|
6211
6322
|
componentState: {
|
|
6212
6323
|
portalDOMRef,
|
|
6213
6324
|
columnHeaderHeight,
|
|
@@ -6215,8 +6326,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6215
6326
|
columnReorderDragColumnId
|
|
6216
6327
|
}
|
|
6217
6328
|
} = useInfiniteTable();
|
|
6329
|
+
const { allRowsSelected, someRowsSelected, selectionMode } = useDataSource();
|
|
6218
6330
|
const dragging = columnReorderDragColumnId === column.id;
|
|
6219
|
-
const { onResize, height, width, headerOptions } = props;
|
|
6331
|
+
const { onResize, height, width, headerOptions, columnsMap } = props;
|
|
6220
6332
|
const sortInfo = column.computedSortInfo;
|
|
6221
6333
|
let header = column.header;
|
|
6222
6334
|
const ref = useCallback9((node) => {
|
|
@@ -6225,7 +6337,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6225
6337
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
6226
6338
|
}, [props.domRef]);
|
|
6227
6339
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
6228
|
-
const
|
|
6340
|
+
const sortIcon = column.computedSortable && (column.computedSorted || alwaysShow) ? /* @__PURE__ */ createElement22(SortIcon, {
|
|
6229
6341
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
6230
6342
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
6231
6343
|
align: column.align || "start"
|
|
@@ -6236,20 +6348,58 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6236
6348
|
dragging,
|
|
6237
6349
|
domRef: ref,
|
|
6238
6350
|
column,
|
|
6351
|
+
columnsMap,
|
|
6239
6352
|
columnSortInfo: sortInfo,
|
|
6240
6353
|
columnFilterValue: column.computedFilterValue,
|
|
6241
|
-
|
|
6354
|
+
someRowsSelected,
|
|
6355
|
+
allRowsSelected,
|
|
6356
|
+
selectionMode,
|
|
6357
|
+
api,
|
|
6358
|
+
renderBag: {
|
|
6359
|
+
sortIcon,
|
|
6360
|
+
selectionCheckBox: null,
|
|
6361
|
+
header: column.header && typeof column.header !== "function" ? column.header : column.name
|
|
6362
|
+
}
|
|
6242
6363
|
};
|
|
6243
6364
|
const align = column.align || "start";
|
|
6244
6365
|
const renderChildren = () => {
|
|
6366
|
+
if (column.renderSortIcon) {
|
|
6367
|
+
renderParam.renderBag.sortIcon = /* @__PURE__ */ createElement22(RenderHeaderCellHookComponent, {
|
|
6368
|
+
render: column.renderSortIcon,
|
|
6369
|
+
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6370
|
+
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6371
|
+
})
|
|
6372
|
+
});
|
|
6373
|
+
}
|
|
6374
|
+
if (column.renderSelectionCheckBox && selectionMode === "multi-row") {
|
|
6375
|
+
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ createElement22(RenderHeaderCellHookComponent, {
|
|
6376
|
+
render: defaultRenderSelectionCheckBox2,
|
|
6377
|
+
renderParam
|
|
6378
|
+
});
|
|
6379
|
+
if (column.renderHeaderSelectionCheckBox && column.renderHeaderSelectionCheckBox !== true) {
|
|
6380
|
+
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ createElement22(RenderHeaderCellHookComponent, {
|
|
6381
|
+
render: column.renderHeaderSelectionCheckBox,
|
|
6382
|
+
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6383
|
+
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6384
|
+
})
|
|
6385
|
+
});
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6245
6388
|
if (header instanceof Function) {
|
|
6246
|
-
header = /* @__PURE__ */ createElement22(RenderHookComponent, {
|
|
6389
|
+
renderParam.renderBag.header = /* @__PURE__ */ createElement22(RenderHookComponent, {
|
|
6247
6390
|
render: header,
|
|
6391
|
+
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6392
|
+
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6393
|
+
})
|
|
6394
|
+
});
|
|
6395
|
+
}
|
|
6396
|
+
if (column.renderHeader) {
|
|
6397
|
+
return /* @__PURE__ */ createElement22(RenderHeaderCellHookComponent, {
|
|
6398
|
+
render: column.renderHeader,
|
|
6248
6399
|
renderParam
|
|
6249
6400
|
});
|
|
6250
6401
|
}
|
|
6251
|
-
|
|
6252
|
-
return /* @__PURE__ */ createElement22(Fragment3, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
6402
|
+
return /* @__PURE__ */ createElement22(Fragment3, 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);
|
|
6253
6403
|
};
|
|
6254
6404
|
const domRef = useRef13(null);
|
|
6255
6405
|
const {
|
|
@@ -6785,7 +6935,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
6785
6935
|
headerOptions,
|
|
6786
6936
|
width: widthWithColspan,
|
|
6787
6937
|
height: heightWithRowspan,
|
|
6788
|
-
|
|
6938
|
+
columnsMap: computedVisibleColumnsMap
|
|
6789
6939
|
});
|
|
6790
6940
|
}, [
|
|
6791
6941
|
headerOptions,
|
|
@@ -6989,7 +7139,7 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
6989
7139
|
|
|
6990
7140
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
6991
7141
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
6992
|
-
var GroupRowExpanderCls = "_7pupv0b";
|
|
7142
|
+
var GroupRowExpanderCls = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_7pupv0b", center: "_7pupv0c", end: "_7pupv0d" } }, defaultVariants: {}, compoundVariants: [] });
|
|
6993
7143
|
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: [] });
|
|
6994
7144
|
var RowHoverCls = "_7pupv01";
|
|
6995
7145
|
|
|
@@ -7000,8 +7150,8 @@ import {
|
|
|
7000
7150
|
} from "react";
|
|
7001
7151
|
|
|
7002
7152
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
7003
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
7004
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
7153
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iw13 _16lm1iw15 _16lm1iw1a _16lm1iw18", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iw13 _16lm1iw15 _16lm1iw1a _16lm1iw18" };
|
|
7154
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iw13 _16lm1iw15 _16lm1iw1a _16lm1iw18";
|
|
7005
7155
|
var LoadMaskTextCls = "qy58ya4";
|
|
7006
7156
|
|
|
7007
7157
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -7019,9 +7169,38 @@ function LoadMaskFn(props) {
|
|
|
7019
7169
|
}
|
|
7020
7170
|
var LoadMask = memo12(LoadMaskFn);
|
|
7021
7171
|
|
|
7172
|
+
// src/utils/deepClone.ts
|
|
7173
|
+
function cloneArray(arr) {
|
|
7174
|
+
return arr.map(deepClone);
|
|
7175
|
+
}
|
|
7176
|
+
function deepClone(source) {
|
|
7177
|
+
if (getGlobal().structuredClone) {
|
|
7178
|
+
return getGlobal().structuredClone(source);
|
|
7179
|
+
}
|
|
7180
|
+
if (source === null || typeof source !== "object") {
|
|
7181
|
+
return source;
|
|
7182
|
+
}
|
|
7183
|
+
if (Array.isArray(source)) {
|
|
7184
|
+
return cloneArray(source);
|
|
7185
|
+
}
|
|
7186
|
+
if (source instanceof Date) {
|
|
7187
|
+
return new Date(source);
|
|
7188
|
+
}
|
|
7189
|
+
if (source instanceof Set) {
|
|
7190
|
+
return new Set(cloneArray(Array.from(source)));
|
|
7191
|
+
}
|
|
7192
|
+
if (source instanceof Map) {
|
|
7193
|
+
return new Map(cloneArray(Array.from(source)));
|
|
7194
|
+
}
|
|
7195
|
+
let target = {};
|
|
7196
|
+
for (let key in source)
|
|
7197
|
+
if (source.hasOwnProperty(key)) {
|
|
7198
|
+
target[key] = deepClone(source[key]);
|
|
7199
|
+
}
|
|
7200
|
+
return target;
|
|
7201
|
+
}
|
|
7202
|
+
|
|
7022
7203
|
// src/utils/groupAndPivot/index.ts
|
|
7023
|
-
var GROUP_SELECTED_REDUCER_KEY = "__groupFullySelected";
|
|
7024
|
-
var GROUP_CHILDREN_SELECTED_COUNT_KEY = "__groupChildrenSelectedCount";
|
|
7025
7204
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
7026
7205
|
var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
|
|
7027
7206
|
function DEFAULT_TO_KEY(value) {
|
|
@@ -7038,7 +7217,7 @@ function initReducers(reducers) {
|
|
|
7038
7217
|
}
|
|
7039
7218
|
return result;
|
|
7040
7219
|
}
|
|
7041
|
-
function computeReducersFor(data, index, reducers, reducerResults) {
|
|
7220
|
+
function computeReducersFor(data, index, reducers, reducerResults, groupKeys) {
|
|
7042
7221
|
var _a, _b;
|
|
7043
7222
|
if (!reducers || !Object.keys(reducers).length) {
|
|
7044
7223
|
return;
|
|
@@ -7051,7 +7230,7 @@ function computeReducersFor(data, index, reducers, reducerResults) {
|
|
|
7051
7230
|
}
|
|
7052
7231
|
const currentValue = reducerResults[key];
|
|
7053
7232
|
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
7054
|
-
reducerResults[key] = reducer.reducer(currentValue, value, data, index);
|
|
7233
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data, index, groupKeys);
|
|
7055
7234
|
}
|
|
7056
7235
|
}
|
|
7057
7236
|
function lazyGroup(groupParams, rootData) {
|
|
@@ -7059,6 +7238,8 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7059
7238
|
reducers = {},
|
|
7060
7239
|
pivot,
|
|
7061
7240
|
groupBy,
|
|
7241
|
+
indexer,
|
|
7242
|
+
toPrimaryKey,
|
|
7062
7243
|
mappings
|
|
7063
7244
|
} = groupParams;
|
|
7064
7245
|
const deepMap = new DeepMap();
|
|
@@ -7083,7 +7264,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7083
7264
|
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
7084
7265
|
const currentPivotKeys = [];
|
|
7085
7266
|
const initialReducerValue = initReducers(reducers);
|
|
7086
|
-
const globalReducerResults =
|
|
7267
|
+
const globalReducerResults = deepClone(initialReducerValue);
|
|
7087
7268
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
7088
7269
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
7089
7270
|
const dataArray = lazyGroupRowInfo.children;
|
|
@@ -7097,6 +7278,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7097
7278
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
7098
7279
|
if (current) {
|
|
7099
7280
|
current.items = dataArray;
|
|
7281
|
+
indexer.indexArray(dataArray, toPrimaryKey);
|
|
7100
7282
|
}
|
|
7101
7283
|
return next == null ? void 0 : next();
|
|
7102
7284
|
}
|
|
@@ -7127,6 +7309,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7127
7309
|
childrenLoading: false,
|
|
7128
7310
|
childrenAvailable: false,
|
|
7129
7311
|
commonData: dataObject,
|
|
7312
|
+
totalChildrenCount: dataArray[i].totalChildrenCount,
|
|
7130
7313
|
reducerResults: dataArray[i].aggregations || {}
|
|
7131
7314
|
};
|
|
7132
7315
|
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
@@ -7161,7 +7344,7 @@ function processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, itemInd
|
|
|
7161
7344
|
} = deepMap.get(currentGroupKeys);
|
|
7162
7345
|
currentGroupItems.push(item);
|
|
7163
7346
|
if (reducers) {
|
|
7164
|
-
computeReducersFor(item, itemIndex, reducers, reducerResults);
|
|
7347
|
+
computeReducersFor(item, itemIndex, reducers, reducerResults, currentGroupKeys);
|
|
7165
7348
|
}
|
|
7166
7349
|
if (pivot) {
|
|
7167
7350
|
for (let pivotIndex = 0, pivotLength = pivot.length; pivotIndex < pivotLength; pivotIndex++) {
|
|
@@ -7171,19 +7354,27 @@ function processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, itemInd
|
|
|
7171
7354
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
7172
7355
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
7173
7356
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
7174
|
-
reducerResults:
|
|
7357
|
+
reducerResults: deepClone(initialReducerValue),
|
|
7175
7358
|
items: []
|
|
7176
7359
|
});
|
|
7177
7360
|
}
|
|
7178
7361
|
const { reducerResults: pivotReducerResults, items: pivotGroupItems } = pivotDeepMap.get(currentPivotKeys);
|
|
7179
7362
|
pivotGroupItems.push(item);
|
|
7180
7363
|
if (reducers) {
|
|
7181
|
-
computeReducersFor(item, itemIndex, reducers, pivotReducerResults);
|
|
7364
|
+
computeReducersFor(item, itemIndex, reducers, pivotReducerResults, currentGroupKeys);
|
|
7182
7365
|
}
|
|
7183
7366
|
}
|
|
7184
7367
|
currentPivotKeys.length = 0;
|
|
7185
7368
|
}
|
|
7186
7369
|
}
|
|
7370
|
+
function getGroupKeysForDataItem(data, groupBy) {
|
|
7371
|
+
return groupBy.reduce((groupKeys, groupBy2) => {
|
|
7372
|
+
const { field: groupByProperty, toKey: groupToKey } = groupBy2;
|
|
7373
|
+
const key = (groupToKey || DEFAULT_TO_KEY)(data[groupByProperty], data);
|
|
7374
|
+
groupKeys.push(key);
|
|
7375
|
+
return groupKeys;
|
|
7376
|
+
}, []);
|
|
7377
|
+
}
|
|
7187
7378
|
function group(groupParams, data) {
|
|
7188
7379
|
const {
|
|
7189
7380
|
groupBy,
|
|
@@ -7197,14 +7388,14 @@ function group(groupParams, data) {
|
|
|
7197
7388
|
const currentGroupKeys = [];
|
|
7198
7389
|
const currentPivotKeys = [];
|
|
7199
7390
|
const initialReducerValue = initReducers(reducers);
|
|
7200
|
-
const globalReducerResults =
|
|
7391
|
+
const globalReducerResults = deepClone(initialReducerValue);
|
|
7201
7392
|
if (!groupByLength) {
|
|
7202
7393
|
const deepMapGroupValue = {
|
|
7203
7394
|
items: [],
|
|
7204
7395
|
cache: false,
|
|
7205
7396
|
childrenLoading: false,
|
|
7206
7397
|
childrenAvailable: false,
|
|
7207
|
-
reducerResults:
|
|
7398
|
+
reducerResults: deepClone(initialReducerValue)
|
|
7208
7399
|
};
|
|
7209
7400
|
if (pivot) {
|
|
7210
7401
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -7223,7 +7414,7 @@ function group(groupParams, data) {
|
|
|
7223
7414
|
cache: false,
|
|
7224
7415
|
childrenLoading: false,
|
|
7225
7416
|
childrenAvailable: false,
|
|
7226
|
-
reducerResults:
|
|
7417
|
+
reducerResults: deepClone(initialReducerValue)
|
|
7227
7418
|
};
|
|
7228
7419
|
if (pivot) {
|
|
7229
7420
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -7236,7 +7427,7 @@ function group(groupParams, data) {
|
|
|
7236
7427
|
processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, i, pivot, reducers, topLevelPivotColumns, initialReducerValue, defaultToKey);
|
|
7237
7428
|
}
|
|
7238
7429
|
if (reducers) {
|
|
7239
|
-
computeReducersFor(item, i, reducers, globalReducerResults);
|
|
7430
|
+
computeReducersFor(item, i, reducers, globalReducerResults, currentGroupKeys);
|
|
7240
7431
|
}
|
|
7241
7432
|
currentGroupKeys.length = 0;
|
|
7242
7433
|
}
|
|
@@ -7313,8 +7504,9 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
7313
7504
|
groupCount: groupItems.length,
|
|
7314
7505
|
groupData: groupItems,
|
|
7315
7506
|
groupKeys,
|
|
7316
|
-
rowSelected:
|
|
7317
|
-
|
|
7507
|
+
rowSelected: false,
|
|
7508
|
+
selectedChildredCount: 0,
|
|
7509
|
+
deselectedChildredCount: 0,
|
|
7318
7510
|
id: `${groupKeys}`,
|
|
7319
7511
|
collapsed,
|
|
7320
7512
|
dataSourceHasGrouping: true,
|
|
@@ -7324,6 +7516,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
7324
7516
|
deepRowInfoArray: [],
|
|
7325
7517
|
collapsedChildrenCount: 0,
|
|
7326
7518
|
collapsedGroupsCount: 0,
|
|
7519
|
+
totalChildrenCount: options.totalChildrenCount,
|
|
7327
7520
|
childrenAvailable: lazyLoad ? options.childrenAvailable : true,
|
|
7328
7521
|
childrenLoading: options.childrenLoading,
|
|
7329
7522
|
indexInParentGroups: options.indexInParentGroups,
|
|
@@ -7360,7 +7553,7 @@ function enhancedFlatten(param) {
|
|
|
7360
7553
|
toPrimaryKey,
|
|
7361
7554
|
groupRowsState,
|
|
7362
7555
|
isRowSelected,
|
|
7363
|
-
|
|
7556
|
+
rowSelectionState,
|
|
7364
7557
|
generateGroupRows,
|
|
7365
7558
|
reducers = {}
|
|
7366
7559
|
} = param;
|
|
@@ -7386,13 +7579,21 @@ function enhancedFlatten(param) {
|
|
|
7386
7579
|
indexInAll: result.length,
|
|
7387
7580
|
groupKeys,
|
|
7388
7581
|
error: deepMapValue.error,
|
|
7582
|
+
totalChildrenCount: deepMapValue.totalChildrenCount,
|
|
7389
7583
|
childrenLoading: deepMapValue.childrenLoading,
|
|
7390
7584
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
7391
7585
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
7392
7586
|
directChildrenLoadedCount: 0,
|
|
7393
7587
|
collapsed
|
|
7394
7588
|
}, deepMapValue);
|
|
7395
|
-
|
|
7589
|
+
if (isRowSelected) {
|
|
7590
|
+
enhancedGroupData.rowSelected = isRowSelected(enhancedGroupData);
|
|
7591
|
+
if (rowSelectionState) {
|
|
7592
|
+
const selectionCount = rowSelectionState.getSelectionCountFor(enhancedGroupData.groupKeys);
|
|
7593
|
+
enhancedGroupData.selectedChildredCount = selectionCount.selectedCount;
|
|
7594
|
+
enhancedGroupData.deselectedChildredCount = selectionCount.deselectedCount;
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7396
7597
|
const parent = parents[parents.length - 1];
|
|
7397
7598
|
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
7398
7599
|
let include = generateGroupRows || collapsed;
|
|
@@ -7455,7 +7656,6 @@ function enhancedFlatten(param) {
|
|
|
7455
7656
|
if (isRowSelected) {
|
|
7456
7657
|
rowInfo.rowSelected = isRowSelected(rowInfo);
|
|
7457
7658
|
}
|
|
7458
|
-
indexer.add(rowInfo.indexInAll, rowInfo.id);
|
|
7459
7659
|
parents.forEach((parent2, i) => {
|
|
7460
7660
|
const last = i === parents.length - 1;
|
|
7461
7661
|
if (last && item) {
|
|
@@ -8257,212 +8457,540 @@ function lazyLoadRange(options, cache) {
|
|
|
8257
8457
|
}, initialPromise);
|
|
8258
8458
|
}
|
|
8259
8459
|
|
|
8260
|
-
// src/components/DataSource/
|
|
8261
|
-
var
|
|
8262
|
-
constructor(state) {
|
|
8460
|
+
// src/components/DataSource/RowSelectionState.ts
|
|
8461
|
+
var RowSelectionState = class {
|
|
8462
|
+
constructor(state, getConfig, _forTestingOnly) {
|
|
8463
|
+
this.selectedRows = null;
|
|
8464
|
+
this.deselectedRows = null;
|
|
8465
|
+
this.defaultSelection = false;
|
|
8466
|
+
this.selectedMap = new DeepMap();
|
|
8467
|
+
this.deselectedMap = new DeepMap();
|
|
8468
|
+
this.selectionCache = new DeepMap();
|
|
8469
|
+
this.selectionCountCache = new DeepMap();
|
|
8470
|
+
this.mapSet = (name, key) => {
|
|
8471
|
+
if (!Array.isArray(key)) {
|
|
8472
|
+
key = [...this.getGroupKeysForPrimaryKey(key), key];
|
|
8473
|
+
}
|
|
8474
|
+
this.xcache();
|
|
8475
|
+
if (name === "selected") {
|
|
8476
|
+
this.selectedMap.set(key, true);
|
|
8477
|
+
} else {
|
|
8478
|
+
this.deselectedMap.set(key, true);
|
|
8479
|
+
}
|
|
8480
|
+
};
|
|
8481
|
+
this._selectedMapSet = (key) => {
|
|
8482
|
+
this.mapSet("selected", key);
|
|
8483
|
+
};
|
|
8484
|
+
this._deselectedMapSet = (key) => {
|
|
8485
|
+
this.mapSet("deselected", key);
|
|
8486
|
+
};
|
|
8263
8487
|
const stateObject = state instanceof Object.getPrototypeOf(this).constructor ? state.getState() : state;
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
});
|
|
8488
|
+
this.getConfig = getConfig;
|
|
8489
|
+
if (_forTestingOnly) {
|
|
8490
|
+
Object.assign(this, _forTestingOnly);
|
|
8491
|
+
}
|
|
8492
|
+
this.update(stateObject);
|
|
8270
8493
|
}
|
|
8271
|
-
|
|
8272
|
-
|
|
8494
|
+
getGroupKeysForPrimaryKey(pk) {
|
|
8495
|
+
const { indexer, groupBy } = this.getConfig();
|
|
8496
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8497
|
+
return data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8273
8498
|
}
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
(_a = this.positiveMap) == null ? void 0 : _a.clear();
|
|
8277
|
-
(_b = this.negativeMap) == null ? void 0 : _b.clear();
|
|
8278
|
-
delete this.positiveMap;
|
|
8279
|
-
delete this.negativeMap;
|
|
8499
|
+
getGroupDeepMap() {
|
|
8500
|
+
return this.getConfig().groupDeepMap;
|
|
8280
8501
|
}
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
if (this.allNegative && this.allPositive) {
|
|
8286
|
-
throw `Cannot have both negativeItems and positiveItems be true!`;
|
|
8287
|
-
}
|
|
8288
|
-
if (negativeItems && negativeItems !== true) {
|
|
8289
|
-
if (!this.negativeMap) {
|
|
8290
|
-
this.negativeMap = new Map();
|
|
8291
|
-
}
|
|
8292
|
-
this.negativeMap.clear();
|
|
8293
|
-
for (let k in negativeItems) {
|
|
8294
|
-
if (negativeItems.hasOwnProperty(k)) {
|
|
8295
|
-
this.negativeMap.set(k, true);
|
|
8296
|
-
}
|
|
8297
|
-
}
|
|
8298
|
-
if (this.positiveMap) {
|
|
8299
|
-
this.positiveMap.clear();
|
|
8300
|
-
}
|
|
8502
|
+
getGroupCount(groupKeys) {
|
|
8503
|
+
var _a;
|
|
8504
|
+
if (groupKeys.length == 0) {
|
|
8505
|
+
return this.getConfig().totalCount;
|
|
8301
8506
|
}
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
this.positiveMap.clear();
|
|
8307
|
-
for (let k in positiveItems) {
|
|
8308
|
-
if (positiveItems.hasOwnProperty(k)) {
|
|
8309
|
-
this.positiveMap.set(k, true);
|
|
8310
|
-
}
|
|
8311
|
-
}
|
|
8312
|
-
if (this.negativeMap) {
|
|
8313
|
-
this.negativeMap.clear();
|
|
8314
|
-
}
|
|
8507
|
+
const groupDeepMap = this.getGroupDeepMap();
|
|
8508
|
+
const deepMapValue = groupDeepMap == null ? void 0 : groupDeepMap.get(groupKeys);
|
|
8509
|
+
if (!deepMapValue) {
|
|
8510
|
+
return 0;
|
|
8315
8511
|
}
|
|
8512
|
+
return (_a = deepMapValue.totalChildrenCount) != null ? _a : deepMapValue.items.length || 0;
|
|
8316
8513
|
}
|
|
8317
|
-
|
|
8318
|
-
|
|
8514
|
+
getGroupKeysDirectlyInsideGroup(groupKeys) {
|
|
8515
|
+
const { groupDeepMap } = this.getConfig();
|
|
8516
|
+
return (groupDeepMap == null ? void 0 : groupDeepMap.getKeysStartingWith(groupKeys, true, 1)) || [];
|
|
8319
8517
|
}
|
|
8320
|
-
|
|
8321
|
-
return this.
|
|
8518
|
+
getGroupByLength() {
|
|
8519
|
+
return this.getConfig().groupBy.length;
|
|
8322
8520
|
}
|
|
8323
|
-
|
|
8324
|
-
return
|
|
8521
|
+
static from(rowSeleStateObject, getConfig, _forTestingOnly) {
|
|
8522
|
+
return new RowSelectionState(rowSeleStateObject, getConfig, _forTestingOnly);
|
|
8325
8523
|
}
|
|
8326
|
-
|
|
8327
|
-
|
|
8524
|
+
update(stateObject) {
|
|
8525
|
+
var _a, _b;
|
|
8526
|
+
this.selectedRows = stateObject.selectedRows || null;
|
|
8527
|
+
this.deselectedRows = stateObject.deselectedRows || null;
|
|
8528
|
+
this.selectedMap.clear();
|
|
8529
|
+
this.deselectedMap.clear();
|
|
8530
|
+
(_a = this.selectedRows) == null ? void 0 : _a.forEach(this._selectedMapSet);
|
|
8531
|
+
(_b = this.deselectedRows) == null ? void 0 : _b.forEach(this._deselectedMapSet);
|
|
8532
|
+
this.defaultSelection = stateObject.defaultSelection;
|
|
8533
|
+
this.xcache();
|
|
8534
|
+
}
|
|
8535
|
+
xcache() {
|
|
8536
|
+
this.selectionCache.clear();
|
|
8537
|
+
this.selectionCountCache.clear();
|
|
8328
8538
|
}
|
|
8329
|
-
|
|
8539
|
+
getState() {
|
|
8540
|
+
const normalize = (allKeys) => {
|
|
8541
|
+
const groupByLength = this.getGroupByLength();
|
|
8542
|
+
return allKeys.map((keys) => keys.length > groupByLength ? keys.pop() : keys);
|
|
8543
|
+
};
|
|
8544
|
+
const selectedRows = normalize(this.selectedMap.topDownKeys());
|
|
8545
|
+
const deselectedRows = normalize(this.deselectedMap.topDownKeys());
|
|
8546
|
+
return {
|
|
8547
|
+
defaultSelection: this.defaultSelection,
|
|
8548
|
+
selectedRows,
|
|
8549
|
+
deselectedRows
|
|
8550
|
+
};
|
|
8551
|
+
}
|
|
8552
|
+
deselectAll() {
|
|
8330
8553
|
this.update({
|
|
8331
|
-
|
|
8332
|
-
|
|
8554
|
+
defaultSelection: false,
|
|
8555
|
+
selectedRows: [],
|
|
8556
|
+
deselectedRows: []
|
|
8333
8557
|
});
|
|
8334
8558
|
}
|
|
8335
|
-
|
|
8559
|
+
selectAll() {
|
|
8336
8560
|
this.update({
|
|
8337
|
-
|
|
8338
|
-
|
|
8561
|
+
defaultSelection: true,
|
|
8562
|
+
deselectedRows: [],
|
|
8563
|
+
selectedRows: []
|
|
8339
8564
|
});
|
|
8340
8565
|
}
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
key = `${key}`;
|
|
8344
|
-
if (this.allPositive === true) {
|
|
8345
|
-
if (this.allNegative === true) {
|
|
8346
|
-
throw 'Cannot have both positiveItems and negativeItems be "true"';
|
|
8347
|
-
}
|
|
8348
|
-
return !((_a = this.negativeMap) == null ? void 0 : _a.has(key));
|
|
8349
|
-
}
|
|
8350
|
-
return !!((_b = this.positiveMap) == null ? void 0 : _b.has(key));
|
|
8351
|
-
}
|
|
8352
|
-
isItemNegative(key) {
|
|
8353
|
-
return !this.isItemPositive(key);
|
|
8566
|
+
isRowDefaultSelected() {
|
|
8567
|
+
return this.defaultSelection === true;
|
|
8354
8568
|
}
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8569
|
+
isRowDefaultDeselected() {
|
|
8570
|
+
return this.defaultSelection === false;
|
|
8571
|
+
}
|
|
8572
|
+
isRowSelected(key, groupKeys) {
|
|
8573
|
+
groupKeys = groupKeys || this.getGroupKeysForPrimaryKey(key);
|
|
8574
|
+
const finalKey = [...groupKeys, key];
|
|
8575
|
+
const cachedResult = this.selectionCache.get(finalKey);
|
|
8576
|
+
if (cachedResult !== void 0) {
|
|
8577
|
+
return cachedResult;
|
|
8578
|
+
}
|
|
8579
|
+
const inSelected = this.selectedMap.has(finalKey);
|
|
8580
|
+
const inDeselected = this.deselectedMap.has(finalKey);
|
|
8581
|
+
if (inSelected) {
|
|
8582
|
+
this.selectionCache.set(finalKey, true);
|
|
8583
|
+
return true;
|
|
8360
8584
|
}
|
|
8361
|
-
if (
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8585
|
+
if (inDeselected) {
|
|
8586
|
+
this.selectionCache.set(finalKey, false);
|
|
8587
|
+
return false;
|
|
8588
|
+
}
|
|
8589
|
+
if (this.selectedMap.has(groupKeys)) {
|
|
8590
|
+
this.selectionCache.set(finalKey, true);
|
|
8591
|
+
return true;
|
|
8592
|
+
}
|
|
8593
|
+
if (this.deselectedMap.has(groupKeys)) {
|
|
8594
|
+
this.selectionCache.set(finalKey, false);
|
|
8595
|
+
return false;
|
|
8596
|
+
}
|
|
8597
|
+
groupKeys = [...groupKeys];
|
|
8598
|
+
while (groupKeys.length) {
|
|
8599
|
+
groupKeys.pop();
|
|
8600
|
+
const inSelected2 = this.selectedMap.has(groupKeys);
|
|
8601
|
+
const inDeselected2 = this.deselectedMap.has(groupKeys);
|
|
8602
|
+
if (inSelected2) {
|
|
8603
|
+
this.selectionCache.set(finalKey, true);
|
|
8604
|
+
return true;
|
|
8372
8605
|
}
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
throw `No negativeMap found when trying to set item ${key} be negative`;
|
|
8377
|
-
}
|
|
8378
|
-
this.negativeMap.set(key, true);
|
|
8379
|
-
} else if (this.allNegative === true) {
|
|
8380
|
-
if (!this.positiveMap) {
|
|
8381
|
-
throw `No positiveMap found when trying to set item ${key} be negative`;
|
|
8382
|
-
}
|
|
8383
|
-
(_a = this.positiveMap) == null ? void 0 : _a.delete(key);
|
|
8606
|
+
if (inDeselected2) {
|
|
8607
|
+
this.selectionCache.set(finalKey, false);
|
|
8608
|
+
return false;
|
|
8384
8609
|
}
|
|
8385
8610
|
}
|
|
8611
|
+
this.selectionCache.set(finalKey, this.defaultSelection);
|
|
8612
|
+
return this.defaultSelection;
|
|
8386
8613
|
}
|
|
8387
|
-
|
|
8388
|
-
this.
|
|
8389
|
-
}
|
|
8390
|
-
makeItemPositive(key) {
|
|
8391
|
-
this.setItemValue(key, true);
|
|
8392
|
-
}
|
|
8393
|
-
toggleItem(key) {
|
|
8394
|
-
this.setItemValue(key, !this.isItemPositive(key));
|
|
8614
|
+
isRowDeselected(key, groupKeys) {
|
|
8615
|
+
return !this.isRowSelected(key, groupKeys);
|
|
8395
8616
|
}
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
}
|
|
8403
|
-
var RowSelectionState = class extends BooleanCollectionState {
|
|
8404
|
-
constructor(state) {
|
|
8405
|
-
super(state);
|
|
8617
|
+
setRowSelected(key, selected, groupKeys) {
|
|
8618
|
+
if (selected) {
|
|
8619
|
+
this.setRowAsSelected(key, groupKeys);
|
|
8620
|
+
} else {
|
|
8621
|
+
this.setRowAsDeselected(key, groupKeys);
|
|
8622
|
+
}
|
|
8406
8623
|
}
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
};
|
|
8624
|
+
getGroupRowSelectionState(initialGroupKeys) {
|
|
8625
|
+
const cachedResult = this.selectionCache.get(initialGroupKeys);
|
|
8626
|
+
if (cachedResult !== void 0) {
|
|
8627
|
+
return cachedResult;
|
|
8628
|
+
}
|
|
8629
|
+
const { selectedCount, deselectedCount } = this.getSelectionCountFor(initialGroupKeys, this.getGroupRowBooleanSelectionStateFromParent(initialGroupKeys));
|
|
8630
|
+
const result = selectedCount && deselectedCount ? null : selectedCount ? true : false;
|
|
8631
|
+
this.selectionCache.set(initialGroupKeys, result);
|
|
8632
|
+
return result;
|
|
8413
8633
|
}
|
|
8414
|
-
|
|
8415
|
-
|
|
8634
|
+
getGroupRowBooleanSelectionStateFromParent(initialGroupKeys) {
|
|
8635
|
+
if (!initialGroupKeys.length) {
|
|
8636
|
+
return this.defaultSelection;
|
|
8637
|
+
}
|
|
8638
|
+
const groupKeys = [...initialGroupKeys];
|
|
8639
|
+
const selfDeselected = this.deselectedMap.has(groupKeys);
|
|
8640
|
+
const selfSelected = this.selectedMap.has(groupKeys);
|
|
8641
|
+
let selectionState = selfSelected && !selfDeselected ? true : selfDeselected && !selfSelected ? false : void 0;
|
|
8642
|
+
if (selectionState === void 0) {
|
|
8643
|
+
while (groupKeys.length) {
|
|
8644
|
+
groupKeys.pop();
|
|
8645
|
+
if (this.deselectedMap.has(groupKeys)) {
|
|
8646
|
+
selectionState = false;
|
|
8647
|
+
break;
|
|
8648
|
+
}
|
|
8649
|
+
if (this.selectedMap.has(groupKeys)) {
|
|
8650
|
+
selectionState = true;
|
|
8651
|
+
break;
|
|
8652
|
+
}
|
|
8653
|
+
}
|
|
8654
|
+
}
|
|
8655
|
+
if (selectionState === void 0) {
|
|
8656
|
+
selectionState = this.defaultSelection;
|
|
8657
|
+
}
|
|
8658
|
+
return selectionState;
|
|
8416
8659
|
}
|
|
8417
|
-
|
|
8418
|
-
return
|
|
8660
|
+
isGroupRowPartlySelected(groupKeys) {
|
|
8661
|
+
return this.getGroupRowSelectionState(groupKeys) === null;
|
|
8419
8662
|
}
|
|
8420
|
-
|
|
8421
|
-
return this.
|
|
8663
|
+
isGroupRowSelected(groupKeys) {
|
|
8664
|
+
return this.getGroupRowSelectionState(groupKeys) === true;
|
|
8422
8665
|
}
|
|
8423
|
-
|
|
8424
|
-
return this.
|
|
8666
|
+
isGroupRowDeselected(groupKeys) {
|
|
8667
|
+
return this.getGroupRowSelectionState(groupKeys) === false;
|
|
8425
8668
|
}
|
|
8426
|
-
|
|
8427
|
-
this.
|
|
8669
|
+
selectGroupRow(groupKeys) {
|
|
8670
|
+
const selectedKeys = this.selectedMap.getKeysStartingWith(groupKeys, true);
|
|
8671
|
+
selectedKeys.forEach((groupKeys2) => {
|
|
8672
|
+
this.selectedMap.delete(groupKeys2);
|
|
8673
|
+
});
|
|
8674
|
+
this._selectedMapSet(groupKeys);
|
|
8675
|
+
const deselectedKeys = this.deselectedMap.getKeysStartingWith(groupKeys);
|
|
8676
|
+
deselectedKeys.forEach((groupKeys2) => {
|
|
8677
|
+
this.deselectedMap.delete(groupKeys2);
|
|
8678
|
+
});
|
|
8428
8679
|
}
|
|
8429
|
-
|
|
8430
|
-
this.
|
|
8680
|
+
deselectGroupRow(groupKeys) {
|
|
8681
|
+
const deselectedKeys = this.deselectedMap.getKeysStartingWith(groupKeys, true);
|
|
8682
|
+
deselectedKeys.forEach((groupKeys2) => {
|
|
8683
|
+
this.deselectedMap.delete(groupKeys2);
|
|
8684
|
+
});
|
|
8685
|
+
this._deselectedMapSet(groupKeys);
|
|
8686
|
+
const selectedKeys = this.selectedMap.getKeysStartingWith(groupKeys);
|
|
8687
|
+
selectedKeys.forEach((groupKeys2) => {
|
|
8688
|
+
this.selectedMap.delete(groupKeys2);
|
|
8689
|
+
});
|
|
8431
8690
|
}
|
|
8432
|
-
|
|
8433
|
-
|
|
8691
|
+
setRowAsSelected(key, groupKeys) {
|
|
8692
|
+
groupKeys = groupKeys || this.getGroupKeysForPrimaryKey(key);
|
|
8693
|
+
const finalKey = [...groupKeys, key];
|
|
8694
|
+
this.deselectedMap.delete(finalKey);
|
|
8695
|
+
this.xcache();
|
|
8696
|
+
if (this.getGroupRowSelectionState(groupKeys) !== true) {
|
|
8697
|
+
this._selectedMapSet(finalKey);
|
|
8698
|
+
if (this.getGroupRowSelectionState(groupKeys) === true) {
|
|
8699
|
+
this.selectGroupRow(groupKeys);
|
|
8700
|
+
}
|
|
8701
|
+
}
|
|
8434
8702
|
}
|
|
8435
|
-
|
|
8436
|
-
|
|
8703
|
+
setRowAsDeselected(key, groupKeys) {
|
|
8704
|
+
groupKeys = groupKeys || this.getGroupKeysForPrimaryKey(key);
|
|
8705
|
+
const finalKey = [...groupKeys, key];
|
|
8706
|
+
this.selectedMap.delete(finalKey);
|
|
8707
|
+
if (this.getGroupRowSelectionState(groupKeys) !== false) {
|
|
8708
|
+
this._deselectedMapSet(finalKey);
|
|
8709
|
+
if (this.getGroupRowSelectionState(groupKeys) === false) {
|
|
8710
|
+
this.deselectGroupRow(groupKeys);
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8437
8713
|
}
|
|
8438
|
-
|
|
8439
|
-
|
|
8714
|
+
deselectRow(key, groupKeys) {
|
|
8715
|
+
this.setRowSelected(key, false, groupKeys);
|
|
8440
8716
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8717
|
+
selectRow(key, groupKeys) {
|
|
8718
|
+
this.setRowSelected(key, true, groupKeys);
|
|
8443
8719
|
}
|
|
8444
|
-
|
|
8445
|
-
|
|
8720
|
+
toggleGroupRowSelection(groupKeys) {
|
|
8721
|
+
const groupRowSelectionState = this.getGroupRowSelectionState(groupKeys);
|
|
8722
|
+
if (groupRowSelectionState === true) {
|
|
8723
|
+
this.deselectGroupRow(groupKeys);
|
|
8724
|
+
} else {
|
|
8725
|
+
this.selectGroupRow(groupKeys);
|
|
8726
|
+
}
|
|
8446
8727
|
}
|
|
8447
|
-
|
|
8448
|
-
this.
|
|
8728
|
+
toggleRowSelection(key, groupKeys) {
|
|
8729
|
+
if (this.isRowSelected(key, groupKeys)) {
|
|
8730
|
+
this.deselectRow(key, groupKeys);
|
|
8731
|
+
} else {
|
|
8732
|
+
this.selectRow(key, groupKeys);
|
|
8733
|
+
}
|
|
8449
8734
|
}
|
|
8450
|
-
|
|
8451
|
-
this.
|
|
8735
|
+
getSelectedCount() {
|
|
8736
|
+
return this.getSelectionCountFor([]).selectedCount;
|
|
8452
8737
|
}
|
|
8453
|
-
|
|
8454
|
-
this.
|
|
8738
|
+
getDeselectedCount() {
|
|
8739
|
+
return this.getSelectionCountFor([]).deselectedCount;
|
|
8455
8740
|
}
|
|
8456
|
-
|
|
8741
|
+
getSelectionCountFor(groupKeys = [], parentSelected) {
|
|
8457
8742
|
var _a, _b;
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
return
|
|
8461
|
-
}
|
|
8462
|
-
|
|
8743
|
+
const cachedResult = this.selectionCountCache.get(groupKeys);
|
|
8744
|
+
if (cachedResult != null) {
|
|
8745
|
+
return cachedResult;
|
|
8746
|
+
}
|
|
8747
|
+
if (groupKeys.length > this.getGroupByLength()) {
|
|
8748
|
+
const result2 = this.isRowSelected(groupKeys) ? { selectedCount: 1, deselectedCount: 0 } : {
|
|
8749
|
+
selectedCount: 0,
|
|
8750
|
+
deselectedCount: 1
|
|
8751
|
+
};
|
|
8752
|
+
this.selectionCountCache.set(groupKeys, result2);
|
|
8753
|
+
return result2;
|
|
8754
|
+
}
|
|
8755
|
+
parentSelected = parentSelected != null ? parentSelected : this.getGroupRowBooleanSelectionStateFromParent(groupKeys);
|
|
8756
|
+
let allKeys = this.getGroupKeysDirectlyInsideGroup(groupKeys);
|
|
8757
|
+
if (groupKeys.length === this.getGroupByLength()) {
|
|
8758
|
+
const selectionState = this.selectedMap.has(groupKeys) ? true : this.deselectedMap.has(groupKeys) ? false : parentSelected;
|
|
8759
|
+
const totalCount = this.getGroupCount(groupKeys);
|
|
8760
|
+
let selectedCount2 = this.selectedMap.getKeysStartingWith(groupKeys, true, 1).length;
|
|
8761
|
+
let deselectedCount2 = this.deselectedMap.getKeysStartingWith(groupKeys, true, 1).length;
|
|
8762
|
+
const notSpecifiedCount = totalCount - (selectedCount2 + deselectedCount2);
|
|
8763
|
+
const result2 = {
|
|
8764
|
+
selectedCount: selectedCount2 + (selectionState ? notSpecifiedCount : 0),
|
|
8765
|
+
deselectedCount: deselectedCount2 + (selectionState ? 0 : notSpecifiedCount)
|
|
8766
|
+
};
|
|
8767
|
+
this.selectionCountCache.set(groupKeys, result2);
|
|
8768
|
+
return result2;
|
|
8769
|
+
}
|
|
8770
|
+
let selectedCount = 0;
|
|
8771
|
+
let deselectedCount = 0;
|
|
8772
|
+
if (this.getConfig().lazyLoad && !allKeys.length) {
|
|
8773
|
+
const totalChildrenCount = ((_b = (_a = this.getConfig().groupDeepMap) == null ? void 0 : _a.get(groupKeys)) == null ? void 0 : _b.totalChildrenCount) || 0;
|
|
8774
|
+
if (parentSelected) {
|
|
8775
|
+
selectedCount = totalChildrenCount;
|
|
8776
|
+
deselectedCount = this.deselectedMap.getAllChildrenSizeFor(groupKeys);
|
|
8777
|
+
if (deselectedCount === totalChildrenCount) {
|
|
8778
|
+
selectedCount = 0;
|
|
8779
|
+
}
|
|
8780
|
+
} else {
|
|
8781
|
+
deselectedCount = totalChildrenCount;
|
|
8782
|
+
selectedCount = this.selectedMap.getAllChildrenSizeFor(groupKeys);
|
|
8783
|
+
if (selectedCount === totalChildrenCount) {
|
|
8784
|
+
deselectedCount = 0;
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
}
|
|
8788
|
+
allKeys.forEach((keys) => {
|
|
8789
|
+
let isSelected = this.selectedMap.get(keys);
|
|
8790
|
+
let isDeselected = this.deselectedMap.get(keys);
|
|
8791
|
+
const selected = isSelected ? true : isDeselected ? false : parentSelected;
|
|
8792
|
+
const { selectedCount: selCount, deselectedCount: deselCount } = this.getSelectionCountFor(keys, selected);
|
|
8793
|
+
selectedCount += selCount;
|
|
8794
|
+
deselectedCount += deselCount;
|
|
8795
|
+
});
|
|
8796
|
+
const result = {
|
|
8797
|
+
selectedCount,
|
|
8798
|
+
deselectedCount
|
|
8799
|
+
};
|
|
8800
|
+
this.selectionCountCache.set(groupKeys, result);
|
|
8801
|
+
return result;
|
|
8463
8802
|
}
|
|
8464
8803
|
};
|
|
8465
8804
|
|
|
8805
|
+
// src/components/InfiniteTable/api/getSelectionApi.ts
|
|
8806
|
+
function rowSelectionStateConfigGetter(stateOrStateGetter) {
|
|
8807
|
+
return () => {
|
|
8808
|
+
const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
|
|
8809
|
+
return {
|
|
8810
|
+
lazyLoad: !!state.lazyLoad,
|
|
8811
|
+
groupBy: state.groupBy,
|
|
8812
|
+
groupDeepMap: state.groupDeepMap,
|
|
8813
|
+
indexer: state.indexer,
|
|
8814
|
+
totalCount: state.unfilteredCount
|
|
8815
|
+
};
|
|
8816
|
+
};
|
|
8817
|
+
}
|
|
8818
|
+
function getSelectionApi(param) {
|
|
8819
|
+
const {
|
|
8820
|
+
getDataSourceState,
|
|
8821
|
+
dataSourceActions
|
|
8822
|
+
} = param;
|
|
8823
|
+
const selectionApi = {
|
|
8824
|
+
get allRowsSelected() {
|
|
8825
|
+
return getDataSourceState().allRowsSelected;
|
|
8826
|
+
},
|
|
8827
|
+
selectAll() {
|
|
8828
|
+
const { rowSelection, selectionMode } = getDataSourceState();
|
|
8829
|
+
if (selectionMode !== "multi-row") {
|
|
8830
|
+
throw "Selection mode is not multi-row";
|
|
8831
|
+
}
|
|
8832
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8833
|
+
throw "Invalid row selection";
|
|
8834
|
+
}
|
|
8835
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8836
|
+
rowSelectionState.selectAll();
|
|
8837
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8838
|
+
},
|
|
8839
|
+
deselectAll() {
|
|
8840
|
+
const { rowSelection, selectionMode } = getDataSourceState();
|
|
8841
|
+
if (selectionMode !== "multi-row") {
|
|
8842
|
+
throw "Selection mode is not multi-row";
|
|
8843
|
+
}
|
|
8844
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8845
|
+
throw "Invalid row selection";
|
|
8846
|
+
}
|
|
8847
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8848
|
+
rowSelectionState.deselectAll();
|
|
8849
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8850
|
+
},
|
|
8851
|
+
isRowSelected(pk, groupKeys) {
|
|
8852
|
+
const { rowSelection, selectionMode, indexer, groupBy } = getDataSourceState();
|
|
8853
|
+
if (selectionMode === "single-row") {
|
|
8854
|
+
return rowSelection === pk;
|
|
8855
|
+
}
|
|
8856
|
+
if (selectionMode !== "multi-row") {
|
|
8857
|
+
throw "Selection mode is not multi-row or single-row";
|
|
8858
|
+
}
|
|
8859
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8860
|
+
throw "Invalid row selection";
|
|
8861
|
+
}
|
|
8862
|
+
if (!groupKeys) {
|
|
8863
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8864
|
+
groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8865
|
+
}
|
|
8866
|
+
return rowSelection.isRowSelected(pk, groupKeys);
|
|
8867
|
+
},
|
|
8868
|
+
isRowDeselected(pk, groupKeys) {
|
|
8869
|
+
return !this.isRowSelected(pk, groupKeys);
|
|
8870
|
+
},
|
|
8871
|
+
selectRow(pk, groupKeys) {
|
|
8872
|
+
const { rowSelection, selectionMode, indexer, groupBy } = getDataSourceState();
|
|
8873
|
+
if (selectionMode === "single-row") {
|
|
8874
|
+
dataSourceActions.rowSelection = pk;
|
|
8875
|
+
return;
|
|
8876
|
+
}
|
|
8877
|
+
if (selectionMode !== "multi-row") {
|
|
8878
|
+
throw "Selection mode is not multi-row or single-row";
|
|
8879
|
+
}
|
|
8880
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8881
|
+
throw "Invalid row selection";
|
|
8882
|
+
}
|
|
8883
|
+
if (!groupKeys) {
|
|
8884
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8885
|
+
groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8886
|
+
}
|
|
8887
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8888
|
+
rowSelectionState.selectRow(pk, groupKeys);
|
|
8889
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8890
|
+
},
|
|
8891
|
+
deselectRow(pk, groupKeys) {
|
|
8892
|
+
const { selectionMode, rowSelection, indexer, groupBy } = getDataSourceState();
|
|
8893
|
+
if (selectionMode === "single-row") {
|
|
8894
|
+
dataSourceActions.rowSelection = null;
|
|
8895
|
+
return;
|
|
8896
|
+
}
|
|
8897
|
+
if (selectionMode !== "multi-row") {
|
|
8898
|
+
throw "Selection mode is not multi-row or single-row";
|
|
8899
|
+
}
|
|
8900
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8901
|
+
throw "Invalid row selection";
|
|
8902
|
+
}
|
|
8903
|
+
if (selectionMode === "multi-row") {
|
|
8904
|
+
if (!groupKeys) {
|
|
8905
|
+
const data = indexer.getDataForPrimaryKey(pk);
|
|
8906
|
+
groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
|
|
8907
|
+
}
|
|
8908
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8909
|
+
rowSelectionState.deselectRow(pk, groupKeys);
|
|
8910
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8911
|
+
}
|
|
8912
|
+
},
|
|
8913
|
+
toggleRowSelection(pk, groupKeys) {
|
|
8914
|
+
if (this.isRowSelected(pk, groupKeys)) {
|
|
8915
|
+
this.deselectRow(pk, groupKeys);
|
|
8916
|
+
} else {
|
|
8917
|
+
this.selectRow(pk, groupKeys);
|
|
8918
|
+
}
|
|
8919
|
+
},
|
|
8920
|
+
selectGroupRow(groupKeys) {
|
|
8921
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8922
|
+
if (selectionMode !== "multi-row") {
|
|
8923
|
+
throw 'Selection mode should be "multi-row"';
|
|
8924
|
+
}
|
|
8925
|
+
if (!groupBy) {
|
|
8926
|
+
throw "No grouping specified";
|
|
8927
|
+
}
|
|
8928
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8929
|
+
throw "Invalid row selection";
|
|
8930
|
+
}
|
|
8931
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8932
|
+
rowSelectionState.selectGroupRow(groupKeys);
|
|
8933
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8934
|
+
},
|
|
8935
|
+
deselectGroupRow(groupKeys) {
|
|
8936
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8937
|
+
if (selectionMode !== "multi-row") {
|
|
8938
|
+
throw 'Selection mode should be "multi-row"';
|
|
8939
|
+
}
|
|
8940
|
+
if (!groupBy) {
|
|
8941
|
+
throw "No grouping specified";
|
|
8942
|
+
}
|
|
8943
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8944
|
+
throw "Invalid row selection";
|
|
8945
|
+
}
|
|
8946
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8947
|
+
rowSelectionState.deselectGroupRow(groupKeys);
|
|
8948
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8949
|
+
},
|
|
8950
|
+
toggleGroupRowSelection(groupKeys) {
|
|
8951
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8952
|
+
if (selectionMode !== "multi-row") {
|
|
8953
|
+
throw 'Selection mode should be "multi-row"';
|
|
8954
|
+
}
|
|
8955
|
+
if (!groupBy) {
|
|
8956
|
+
throw "No grouping specified";
|
|
8957
|
+
}
|
|
8958
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8959
|
+
throw "Invalid row selection";
|
|
8960
|
+
}
|
|
8961
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
8962
|
+
rowSelectionState.toggleGroupRowSelection(groupKeys);
|
|
8963
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
8964
|
+
},
|
|
8965
|
+
getGroupRowSelectionState(groupKeys) {
|
|
8966
|
+
const { selectionMode, rowSelection, groupBy } = getDataSourceState();
|
|
8967
|
+
if (selectionMode !== "multi-row") {
|
|
8968
|
+
throw 'Selection mode should be "multi-row"';
|
|
8969
|
+
}
|
|
8970
|
+
if (!groupBy) {
|
|
8971
|
+
throw "No grouping specified";
|
|
8972
|
+
}
|
|
8973
|
+
if (!(rowSelection instanceof RowSelectionState)) {
|
|
8974
|
+
throw "Invalid row selection";
|
|
8975
|
+
}
|
|
8976
|
+
return rowSelection.getGroupRowSelectionState(groupKeys);
|
|
8977
|
+
},
|
|
8978
|
+
getSelectedPrimaryKeys: () => {
|
|
8979
|
+
const selected = [];
|
|
8980
|
+
getDataSourceState().dataArray.forEach((rowInfo) => {
|
|
8981
|
+
if (!rowInfo.isGroupRow && rowInfo.rowSelected) {
|
|
8982
|
+
selected.push(rowInfo.id);
|
|
8983
|
+
}
|
|
8984
|
+
});
|
|
8985
|
+
return selected;
|
|
8986
|
+
}
|
|
8987
|
+
};
|
|
8988
|
+
if (false) {
|
|
8989
|
+
globalThis.selectionApi = selectionApi;
|
|
8990
|
+
}
|
|
8991
|
+
return selectionApi;
|
|
8992
|
+
}
|
|
8993
|
+
|
|
8466
8994
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
8467
8995
|
var map = new WeakMap();
|
|
8468
8996
|
var getCompareDefault = (a) => a;
|
|
@@ -8494,22 +9022,23 @@ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
|
8494
9022
|
// src/components/DataSource/Indexer.ts
|
|
8495
9023
|
var Indexer = class {
|
|
8496
9024
|
constructor() {
|
|
8497
|
-
this.
|
|
8498
|
-
this.
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
this.
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
9025
|
+
this.primaryKeyToData = new Map();
|
|
9026
|
+
this.add = (primaryKey, data) => {
|
|
9027
|
+
this.primaryKeyToData.set(`${primaryKey}`, data);
|
|
9028
|
+
};
|
|
9029
|
+
this.clear = () => {
|
|
9030
|
+
this.primaryKeyToData.clear();
|
|
9031
|
+
};
|
|
9032
|
+
this.getDataForPrimaryKey = (primaryKey) => {
|
|
9033
|
+
return this.primaryKeyToData.get(`${primaryKey}`);
|
|
9034
|
+
};
|
|
9035
|
+
this.indexArray = (arr, toPrimaryKey) => {
|
|
9036
|
+
arr.forEach((item) => {
|
|
9037
|
+
if (item != null) {
|
|
9038
|
+
this.add(toPrimaryKey(item), item);
|
|
9039
|
+
}
|
|
9040
|
+
});
|
|
9041
|
+
};
|
|
8513
9042
|
}
|
|
8514
9043
|
};
|
|
8515
9044
|
|
|
@@ -8570,7 +9099,7 @@ function initSetupState() {
|
|
|
8570
9099
|
groupDeepMap: void 0,
|
|
8571
9100
|
reducerResults: void 0,
|
|
8572
9101
|
allRowsSelected: false,
|
|
8573
|
-
|
|
9102
|
+
someRowsSelected: false,
|
|
8574
9103
|
postSortDataArray: void 0,
|
|
8575
9104
|
postGroupDataArray: void 0,
|
|
8576
9105
|
lastSortDataArray: void 0,
|
|
@@ -8626,7 +9155,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
8626
9155
|
return livePaginationCursor;
|
|
8627
9156
|
}
|
|
8628
9157
|
function mapPropsToState(params) {
|
|
8629
|
-
var _a, _b
|
|
9158
|
+
var _a, _b;
|
|
8630
9159
|
const { props, state, oldState } = params;
|
|
8631
9160
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
8632
9161
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -8653,36 +9182,34 @@ function mapPropsToState(params) {
|
|
|
8653
9182
|
selectionMode = "single-row";
|
|
8654
9183
|
}
|
|
8655
9184
|
}
|
|
8656
|
-
selectionMode = selectionMode != null ? selectionMode :
|
|
9185
|
+
selectionMode = selectionMode != null ? selectionMode : false;
|
|
8657
9186
|
}
|
|
8658
9187
|
}
|
|
8659
9188
|
let rowSelectionState = null;
|
|
8660
|
-
let currentRowSelection = props.rowSelection !== void 0 ? props.rowSelection :
|
|
9189
|
+
let currentRowSelection = props.rowSelection !== void 0 ? props.rowSelection : state.rowSelection === void 0 ? props.defaultRowSelection !== void 0 ? props.defaultRowSelection : null : state.rowSelection;
|
|
8661
9190
|
if (selectionMode !== false) {
|
|
8662
9191
|
if (selectionMode === "single-row" || selectionMode === "multi-row") {
|
|
8663
9192
|
if (currentRowSelection === null) {
|
|
8664
9193
|
rowSelectionState = selectionMode === "single-row" ? null : new RowSelectionState({
|
|
8665
|
-
selectedRows:
|
|
8666
|
-
deselectedRows:
|
|
8667
|
-
|
|
9194
|
+
selectedRows: [],
|
|
9195
|
+
deselectedRows: [],
|
|
9196
|
+
defaultSelection: false
|
|
9197
|
+
}, rowSelectionStateConfigGetter(state));
|
|
8668
9198
|
} else {
|
|
8669
|
-
rowSelectionState = selectionMode === "single-row" ? currentRowSelection : currentRowSelection instanceof RowSelectionState ? currentRowSelection : new RowSelectionState(currentRowSelection);
|
|
9199
|
+
rowSelectionState = selectionMode === "single-row" ? currentRowSelection : currentRowSelection instanceof RowSelectionState ? currentRowSelection : new RowSelectionState(currentRowSelection, rowSelectionStateConfigGetter(state));
|
|
8670
9200
|
}
|
|
8671
9201
|
}
|
|
8672
9202
|
}
|
|
8673
9203
|
const primaryKeyDescriptor = state.primaryKey;
|
|
8674
|
-
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data
|
|
8675
|
-
const pk = data[primaryKeyDescriptor];
|
|
8676
|
-
return pk;
|
|
8677
|
-
};
|
|
9204
|
+
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
|
|
8678
9205
|
const result = {
|
|
8679
9206
|
selectionMode,
|
|
9207
|
+
rowSelection: rowSelectionState,
|
|
8680
9208
|
toPrimaryKey,
|
|
8681
|
-
rowSelection: rowSelectionState != null ? rowSelectionState : null,
|
|
8682
9209
|
operatorsByFilterType,
|
|
8683
9210
|
controlledSort,
|
|
8684
9211
|
controlledFilter,
|
|
8685
|
-
filterMode: ((
|
|
9212
|
+
filterMode: ((_b = props.filterMode) != null ? _b : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
8686
9213
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
8687
9214
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
8688
9215
|
};
|
|
@@ -8714,20 +9241,17 @@ function getMappedCallbacks() {
|
|
|
8714
9241
|
rowSelection: (rowSelection, state) => {
|
|
8715
9242
|
if (state.selectionMode === "single-row") {
|
|
8716
9243
|
return {
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
9244
|
+
callbackParams: [
|
|
9245
|
+
rowSelection,
|
|
9246
|
+
"single-row"
|
|
9247
|
+
]
|
|
8721
9248
|
};
|
|
8722
9249
|
}
|
|
8723
9250
|
return {
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
},
|
|
8729
|
-
rowSelectionState: rowSelection
|
|
8730
|
-
}
|
|
9251
|
+
callbackParams: [
|
|
9252
|
+
rowSelection.getState(),
|
|
9253
|
+
"multi-row"
|
|
9254
|
+
]
|
|
8731
9255
|
};
|
|
8732
9256
|
}
|
|
8733
9257
|
};
|
|
@@ -9079,16 +9603,16 @@ function filterDataSource(params) {
|
|
|
9079
9603
|
return dataArray;
|
|
9080
9604
|
}
|
|
9081
9605
|
function concludeReducer(params) {
|
|
9082
|
-
var _a, _b
|
|
9606
|
+
var _a, _b;
|
|
9083
9607
|
const { state, previousState } = params;
|
|
9084
|
-
const primaryKeyDescriptor = state.primaryKey;
|
|
9085
9608
|
const sortInfo = state.sortInfo;
|
|
9086
9609
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
9087
9610
|
if (state.lazyLoad || state.livePagination) {
|
|
9088
9611
|
shouldSort = false;
|
|
9089
9612
|
}
|
|
9090
9613
|
let originalDataArrayChanged = haveDepsChanged(previousState, state, [
|
|
9091
|
-
"originalDataArray"
|
|
9614
|
+
"originalDataArray",
|
|
9615
|
+
"originalLazyGroupDataChangeDetect"
|
|
9092
9616
|
]);
|
|
9093
9617
|
const dataSourceChange = previousState && state.data !== previousState.data;
|
|
9094
9618
|
let lazyLoadGroupDataChange = state.lazyLoad && previousState && (previousState.groupBy !== state.groupBy || previousState.sortInfo !== state.sortInfo);
|
|
@@ -9099,6 +9623,13 @@ function concludeReducer(params) {
|
|
|
9099
9623
|
state.originalLazyGroupData = new DeepMap();
|
|
9100
9624
|
originalDataArrayChanged = true;
|
|
9101
9625
|
}
|
|
9626
|
+
const shouldIndex = originalDataArrayChanged;
|
|
9627
|
+
if (shouldIndex) {
|
|
9628
|
+
state.indexer.clear();
|
|
9629
|
+
if (!state.lazyLoad) {
|
|
9630
|
+
state.indexer.indexArray(state.originalDataArray, state.toPrimaryKey);
|
|
9631
|
+
}
|
|
9632
|
+
}
|
|
9102
9633
|
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
9103
9634
|
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
9104
9635
|
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
@@ -9117,7 +9648,8 @@ function concludeReducer(params) {
|
|
|
9117
9648
|
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
9118
9649
|
const selectionDepsChanged = haveDepsChanged(previousState, state, [
|
|
9119
9650
|
"rowSelection",
|
|
9120
|
-
"isRowSelected"
|
|
9651
|
+
"isRowSelected",
|
|
9652
|
+
"originalLazyGroupDataChangeDetect"
|
|
9121
9653
|
]);
|
|
9122
9654
|
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
9123
9655
|
"generateGroupRows",
|
|
@@ -9131,13 +9663,10 @@ function concludeReducer(params) {
|
|
|
9131
9663
|
"pivotGrandTotalColumnPosition",
|
|
9132
9664
|
"showSeparatePivotColumnForSingleAggregation"
|
|
9133
9665
|
]);
|
|
9134
|
-
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray) || selectionDepsChanged
|
|
9666
|
+
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray) || selectionDepsChanged;
|
|
9135
9667
|
const now = Date.now();
|
|
9136
9668
|
let dataArray = state.originalDataArray;
|
|
9137
|
-
const toPrimaryKey =
|
|
9138
|
-
const pk = data[primaryKeyDescriptor];
|
|
9139
|
-
return pk;
|
|
9140
|
-
};
|
|
9669
|
+
const toPrimaryKey = state.toPrimaryKey;
|
|
9141
9670
|
if (!shouldFilter) {
|
|
9142
9671
|
state.unfilteredCount = dataArray.length;
|
|
9143
9672
|
}
|
|
@@ -9167,60 +9696,47 @@ function concludeReducer(params) {
|
|
|
9167
9696
|
}
|
|
9168
9697
|
state.postSortDataArray = dataArray;
|
|
9169
9698
|
let rowInfoDataArray = state.dataArray;
|
|
9699
|
+
const rowSelectionState = state.rowSelection instanceof RowSelectionState ? state.rowSelection : void 0;
|
|
9700
|
+
rowSelectionState == null ? void 0 : rowSelectionState.xcache();
|
|
9170
9701
|
let isRowSelected = state.selectionMode === "single-row" ? (rowInfo) => {
|
|
9171
9702
|
return rowInfo.id === state.rowSelection;
|
|
9172
9703
|
} : state.selectionMode === "multi-row" ? (rowInfo) => {
|
|
9173
|
-
|
|
9704
|
+
const rowSelection = rowSelectionState;
|
|
9705
|
+
return rowInfo.isGroupRow ? rowSelection.getGroupRowSelectionState(rowInfo.groupKeys) : rowSelection.isRowSelected(rowInfo.id, rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0);
|
|
9174
9706
|
} : void 0;
|
|
9175
|
-
if (state.isRowSelected) {
|
|
9176
|
-
isRowSelected = (rowInfo) => state.isRowSelected(rowInfo,
|
|
9707
|
+
if (state.isRowSelected && state.selectionMode === "multi-row") {
|
|
9708
|
+
isRowSelected = (rowInfo) => state.isRowSelected(rowInfo, rowSelectionState, state.selectionMode);
|
|
9177
9709
|
}
|
|
9178
9710
|
if (shouldGroup) {
|
|
9179
9711
|
if (shouldGroupAgain) {
|
|
9180
9712
|
let aggregationReducers = state.aggregationReducers;
|
|
9181
|
-
if (state.selectionMode === "multi-row") {
|
|
9182
|
-
const groupSelectedReducer = {
|
|
9183
|
-
initialValue: true,
|
|
9184
|
-
reducer: (groupSelected, _value, data, index) => {
|
|
9185
|
-
const rowId = toPrimaryKey(data, index);
|
|
9186
|
-
return groupSelected && state.rowSelection.isRowSelected(rowId);
|
|
9187
|
-
}
|
|
9188
|
-
};
|
|
9189
|
-
const groupChildrenSelectedCountReducer = {
|
|
9190
|
-
initialValue: 0,
|
|
9191
|
-
reducer: (selectedCount, _value, data, index) => {
|
|
9192
|
-
const rowId = toPrimaryKey(data, index);
|
|
9193
|
-
return selectedCount + state.rowSelection.isRowSelected(rowId);
|
|
9194
|
-
}
|
|
9195
|
-
};
|
|
9196
|
-
aggregationReducers = __spreadProps(__spreadValues({}, aggregationReducers), {
|
|
9197
|
-
[GROUP_SELECTED_REDUCER_KEY]: groupSelectedReducer,
|
|
9198
|
-
[GROUP_CHILDREN_SELECTED_COUNT_KEY]: groupChildrenSelectedCountReducer
|
|
9199
|
-
});
|
|
9200
|
-
}
|
|
9201
9713
|
const groupResult = state.lazyLoad ? lazyGroup({
|
|
9202
9714
|
groupBy,
|
|
9203
9715
|
pivot: pivotBy,
|
|
9204
9716
|
mappings: state.pivotMappings,
|
|
9205
|
-
reducers: aggregationReducers
|
|
9717
|
+
reducers: aggregationReducers,
|
|
9718
|
+
indexer: state.indexer,
|
|
9719
|
+
toPrimaryKey
|
|
9206
9720
|
}, state.originalLazyGroupData) : group({
|
|
9207
9721
|
groupBy,
|
|
9208
9722
|
pivot: pivotBy,
|
|
9209
9723
|
reducers: aggregationReducers
|
|
9210
9724
|
}, dataArray);
|
|
9211
|
-
state.
|
|
9725
|
+
state.groupDeepMap = groupResult.deepMap;
|
|
9726
|
+
if (rowSelectionState) {
|
|
9727
|
+
rowSelectionState.getConfig = rowSelectionStateConfigGetter(state);
|
|
9728
|
+
}
|
|
9212
9729
|
const flattenResult = enhancedFlatten({
|
|
9213
9730
|
groupResult,
|
|
9214
9731
|
lazyLoad: !!state.lazyLoad,
|
|
9215
9732
|
reducers: aggregationReducers,
|
|
9216
9733
|
toPrimaryKey,
|
|
9217
9734
|
isRowSelected,
|
|
9218
|
-
|
|
9735
|
+
rowSelectionState,
|
|
9219
9736
|
groupRowsState: state.groupRowsState,
|
|
9220
9737
|
generateGroupRows: state.generateGroupRows
|
|
9221
9738
|
});
|
|
9222
9739
|
rowInfoDataArray = flattenResult.data;
|
|
9223
|
-
state.groupDeepMap = groupResult.deepMap;
|
|
9224
9740
|
state.reducerResults = groupResult.reducerResults;
|
|
9225
9741
|
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
9226
9742
|
deepMap: groupResult.topLevelPivotColumns,
|
|
@@ -9242,10 +9758,8 @@ function concludeReducer(params) {
|
|
|
9242
9758
|
state.pivotColumns = void 0;
|
|
9243
9759
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
9244
9760
|
if (arrayDifferentAfterSortStep || groupsDepsChanged || selectionDepsChanged) {
|
|
9245
|
-
state.indexer.clear();
|
|
9246
9761
|
rowInfoDataArray = dataArray.map((data, index) => {
|
|
9247
|
-
const rowInfo = toRowInfo(data, data ? toPrimaryKey(data
|
|
9248
|
-
state.indexer.add(index, rowInfo.id);
|
|
9762
|
+
const rowInfo = toRowInfo(data, data ? toPrimaryKey(data) : index, index, isRowSelected);
|
|
9249
9763
|
return rowInfo;
|
|
9250
9764
|
});
|
|
9251
9765
|
}
|
|
@@ -9257,13 +9771,27 @@ function concludeReducer(params) {
|
|
|
9257
9771
|
state.dataArray = rowInfoDataArray;
|
|
9258
9772
|
state.reducedAt = now;
|
|
9259
9773
|
if (state.selectionMode === "multi-row") {
|
|
9260
|
-
if (shouldGroup) {
|
|
9261
|
-
|
|
9262
|
-
|
|
9774
|
+
if (shouldGroup && state.lazyLoad) {
|
|
9775
|
+
let allRowsSelected = true;
|
|
9776
|
+
let someRowsSelected = false;
|
|
9777
|
+
state.dataArray.forEach((rowInfo) => {
|
|
9778
|
+
if (rowInfo.isGroupRow && rowInfo.groupKeys.length === 1) {
|
|
9779
|
+
const { rowSelected } = rowInfo;
|
|
9780
|
+
if (rowSelected !== true) {
|
|
9781
|
+
allRowsSelected = false;
|
|
9782
|
+
}
|
|
9783
|
+
if (rowSelected === true || rowSelected === null) {
|
|
9784
|
+
someRowsSelected = true;
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
});
|
|
9788
|
+
state.allRowsSelected = allRowsSelected;
|
|
9789
|
+
state.someRowsSelected = someRowsSelected;
|
|
9263
9790
|
} else {
|
|
9264
|
-
const dataArrayCount = state.
|
|
9265
|
-
|
|
9266
|
-
state.allRowsSelected = dataArrayCount ===
|
|
9791
|
+
const dataArrayCount = state.filteredCount;
|
|
9792
|
+
const selectedRowCount = state.rowSelection.getSelectedCount();
|
|
9793
|
+
state.allRowsSelected = dataArrayCount === selectedRowCount;
|
|
9794
|
+
state.someRowsSelected = selectedRowCount > 0;
|
|
9267
9795
|
}
|
|
9268
9796
|
}
|
|
9269
9797
|
if (false) {
|
|
@@ -9307,6 +9835,7 @@ function DataSourceCmp({ children }) {
|
|
|
9307
9835
|
};
|
|
9308
9836
|
if (false) {
|
|
9309
9837
|
globalThis.getDataSourceState = getState;
|
|
9838
|
+
globalThis.dataSourceActions = componentActions;
|
|
9310
9839
|
}
|
|
9311
9840
|
useLoadData();
|
|
9312
9841
|
return /* @__PURE__ */ createElement30(DataSourceContext.Provider, {
|
|
@@ -9321,128 +9850,42 @@ function DataSource(props) {
|
|
|
9321
9850
|
}));
|
|
9322
9851
|
}
|
|
9323
9852
|
|
|
9324
|
-
// src/components/InfiniteTable/getImperativeApi.ts
|
|
9325
|
-
function getImperativeApi(
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
groupResult.items.forEach((data) => {
|
|
9338
|
-
const id = toPrimaryKey(data);
|
|
9339
|
-
if (selected) {
|
|
9340
|
-
rowSelectionState.selectRow(id);
|
|
9341
|
-
} else {
|
|
9342
|
-
rowSelectionState.deselectRow(id);
|
|
9343
|
-
}
|
|
9344
|
-
});
|
|
9345
|
-
}
|
|
9346
|
-
const primaryKey = `${groupKeys}`;
|
|
9347
|
-
const index = getDataSourceState().indexer.getIndexOf(primaryKey);
|
|
9348
|
-
if (index != null) {
|
|
9349
|
-
const rowInfo = getDataSourceState().dataArray[index];
|
|
9350
|
-
rowInfo.deepRowInfoArray.forEach((rowInfo2) => {
|
|
9351
|
-
if (!rowInfo2.isGroupRow) {
|
|
9352
|
-
if (selected) {
|
|
9353
|
-
rowSelectionState.selectRow(rowInfo2.id);
|
|
9354
|
-
} else {
|
|
9355
|
-
rowSelectionState.deselectRow(rowInfo2.id);
|
|
9356
|
-
}
|
|
9357
|
-
}
|
|
9358
|
-
});
|
|
9359
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9360
|
-
return true;
|
|
9361
|
-
}
|
|
9362
|
-
}
|
|
9363
|
-
return false;
|
|
9364
|
-
}
|
|
9853
|
+
// src/components/InfiniteTable/api/getImperativeApi.ts
|
|
9854
|
+
function getImperativeApi(param) {
|
|
9855
|
+
const {
|
|
9856
|
+
getComputed,
|
|
9857
|
+
getState,
|
|
9858
|
+
getDataSourceState,
|
|
9859
|
+
componentActions,
|
|
9860
|
+
dataSourceActions
|
|
9861
|
+
} = param;
|
|
9862
|
+
const selectionApi = getSelectionApi({
|
|
9863
|
+
dataSourceActions,
|
|
9864
|
+
getDataSourceState
|
|
9865
|
+
});
|
|
9365
9866
|
const imperativeApi = {
|
|
9366
|
-
get
|
|
9367
|
-
return
|
|
9368
|
-
},
|
|
9369
|
-
getSelectedRowCount() {
|
|
9370
|
-
const { selectionMode, selectedRowCount } = getDataSourceState();
|
|
9371
|
-
if (selectionMode != "multi-row") {
|
|
9372
|
-
throw `Cannot get the selected row count unless "selectionMode" is "multi-row"!`;
|
|
9373
|
-
}
|
|
9374
|
-
return selectedRowCount;
|
|
9375
|
-
},
|
|
9376
|
-
getSelectedRows() {
|
|
9377
|
-
const { rowSelection, indexer, dataArray } = getDataSourceState();
|
|
9378
|
-
if (!rowSelection || !(rowSelection instanceof RowSelectionState)) {
|
|
9379
|
-
return [];
|
|
9380
|
-
}
|
|
9381
|
-
if (rowSelection.isRowDefaultDeselected()) {
|
|
9382
|
-
const { selectedRows } = rowSelection.getState();
|
|
9383
|
-
return Object.keys(selectedRows).reduce((res, id) => {
|
|
9384
|
-
const index = indexer.getIndexOf(id);
|
|
9385
|
-
if (index == null) {
|
|
9386
|
-
return res;
|
|
9387
|
-
}
|
|
9388
|
-
const rowInfo = dataArray[index];
|
|
9389
|
-
if (!rowInfo || !rowInfo.data) {
|
|
9390
|
-
return res;
|
|
9391
|
-
}
|
|
9392
|
-
res.push(rowInfo.data);
|
|
9393
|
-
return res;
|
|
9394
|
-
}, []);
|
|
9395
|
-
} else {
|
|
9396
|
-
return dataArray.filter((rowInfo) => {
|
|
9397
|
-
return !rowInfo.isGroupRow && rowSelection.isRowSelected(rowInfo.id);
|
|
9398
|
-
}).map((rowInfo) => rowInfo.data);
|
|
9399
|
-
}
|
|
9400
|
-
return [];
|
|
9867
|
+
get selectionApi() {
|
|
9868
|
+
return selectionApi;
|
|
9401
9869
|
},
|
|
9402
9870
|
setColumnOrder: (columnOrder) => {
|
|
9403
9871
|
componentActions.columnOrder = columnOrder;
|
|
9404
9872
|
},
|
|
9405
|
-
|
|
9406
|
-
const
|
|
9407
|
-
if (
|
|
9408
|
-
|
|
9409
|
-
rowSelectionState.selectRow(pk);
|
|
9410
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9873
|
+
collapseGroupRow(groupKeys) {
|
|
9874
|
+
const state = getDataSourceState();
|
|
9875
|
+
if (state.groupRowsState.isGroupRowExpanded(groupKeys)) {
|
|
9876
|
+
this.toggleGroupRow(groupKeys);
|
|
9411
9877
|
return true;
|
|
9412
|
-
} else if (selectionMode === "single-row") {
|
|
9413
|
-
dataSourceActions.rowSelection = pk;
|
|
9414
|
-
return false;
|
|
9415
9878
|
}
|
|
9416
9879
|
return false;
|
|
9417
9880
|
},
|
|
9418
|
-
|
|
9419
|
-
const
|
|
9420
|
-
if (
|
|
9421
|
-
|
|
9422
|
-
rowSelectionState.deselectRow(pk);
|
|
9423
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9424
|
-
return true;
|
|
9425
|
-
} else if (selectionMode === "single-row") {
|
|
9426
|
-
dataSourceActions.rowSelection = null;
|
|
9881
|
+
expandGroupRow(groupKeys) {
|
|
9882
|
+
const state = getDataSourceState();
|
|
9883
|
+
if (state.groupRowsState.isGroupRowCollapsed(groupKeys)) {
|
|
9884
|
+
this.toggleGroupRow(groupKeys);
|
|
9427
9885
|
return true;
|
|
9428
9886
|
}
|
|
9429
9887
|
return false;
|
|
9430
9888
|
},
|
|
9431
|
-
isRowSelected: (pk) => {
|
|
9432
|
-
const { selectionMode, rowSelection } = getDataSourceState();
|
|
9433
|
-
if (selectionMode === "multi-row") {
|
|
9434
|
-
return rowSelection.isRowSelected(pk);
|
|
9435
|
-
} else if (selectionMode === "single-row") {
|
|
9436
|
-
return rowSelection === pk;
|
|
9437
|
-
}
|
|
9438
|
-
return false;
|
|
9439
|
-
},
|
|
9440
|
-
selectGroupRow: (groupKeys) => {
|
|
9441
|
-
return setGroupRowSelection(groupKeys, true);
|
|
9442
|
-
},
|
|
9443
|
-
deselectGroupRow: (groupKeys) => {
|
|
9444
|
-
return setGroupRowSelection(groupKeys, false);
|
|
9445
|
-
},
|
|
9446
9889
|
toggleGroupRow(groupKeys) {
|
|
9447
9890
|
const state = getDataSourceState();
|
|
9448
9891
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
@@ -9470,64 +9913,6 @@ function getImperativeApi(getComputed, getState, getDataSourceState, componentAc
|
|
|
9470
9913
|
}
|
|
9471
9914
|
}
|
|
9472
9915
|
},
|
|
9473
|
-
isGroupRowSelected: (groupKeys) => {
|
|
9474
|
-
const { selectionMode } = getDataSourceState();
|
|
9475
|
-
if (selectionMode === "multi-row") {
|
|
9476
|
-
const primaryKey = `${groupKeys}`;
|
|
9477
|
-
const index = getDataSourceState().indexer.getIndexOf(primaryKey);
|
|
9478
|
-
if (index != null) {
|
|
9479
|
-
const rowInfo = getDataSourceState().dataArray[index];
|
|
9480
|
-
return rowInfo.rowSelected;
|
|
9481
|
-
}
|
|
9482
|
-
}
|
|
9483
|
-
return false;
|
|
9484
|
-
},
|
|
9485
|
-
toggleGroupRowSelection(groupKeys) {
|
|
9486
|
-
const { selectionMode } = getDataSourceState();
|
|
9487
|
-
if (selectionMode === "multi-row") {
|
|
9488
|
-
if (this.isGroupRowSelected(groupKeys)) {
|
|
9489
|
-
this.deselectGroupRow(groupKeys);
|
|
9490
|
-
} else {
|
|
9491
|
-
this.selectGroupRow(groupKeys);
|
|
9492
|
-
}
|
|
9493
|
-
return true;
|
|
9494
|
-
}
|
|
9495
|
-
return false;
|
|
9496
|
-
},
|
|
9497
|
-
toggleRowSelection: (pk) => {
|
|
9498
|
-
const { selectionMode, rowSelection: currentRowSelection } = getDataSourceState();
|
|
9499
|
-
if (selectionMode === "multi-row") {
|
|
9500
|
-
const rowSelectionState = new RowSelectionState(currentRowSelection);
|
|
9501
|
-
rowSelectionState.toggleRowSelection(pk);
|
|
9502
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9503
|
-
return true;
|
|
9504
|
-
} else if (selectionMode === "single-row") {
|
|
9505
|
-
const rowSelection = currentRowSelection === pk ? null : pk;
|
|
9506
|
-
dataSourceActions.rowSelection = rowSelection;
|
|
9507
|
-
return true;
|
|
9508
|
-
}
|
|
9509
|
-
return false;
|
|
9510
|
-
},
|
|
9511
|
-
selectAllRows: () => {
|
|
9512
|
-
const { selectionMode, rowSelection: currentRowSelection } = getDataSourceState();
|
|
9513
|
-
if (selectionMode === "multi-row") {
|
|
9514
|
-
const rowSelectionState = new RowSelectionState(currentRowSelection);
|
|
9515
|
-
rowSelectionState.selectAll();
|
|
9516
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9517
|
-
return true;
|
|
9518
|
-
}
|
|
9519
|
-
return false;
|
|
9520
|
-
},
|
|
9521
|
-
deselectAllRows: () => {
|
|
9522
|
-
const { selectionMode, rowSelection: currentRowSelection } = getDataSourceState();
|
|
9523
|
-
if (selectionMode === "multi-row") {
|
|
9524
|
-
const rowSelectionState = new RowSelectionState(currentRowSelection);
|
|
9525
|
-
rowSelectionState.deselectAll();
|
|
9526
|
-
dataSourceActions.rowSelection = rowSelectionState;
|
|
9527
|
-
return true;
|
|
9528
|
-
}
|
|
9529
|
-
return false;
|
|
9530
|
-
},
|
|
9531
9916
|
setColumnVisibility: (columnVisibility) => {
|
|
9532
9917
|
componentActions.columnVisibility = columnVisibility;
|
|
9533
9918
|
},
|
|
@@ -9802,6 +10187,7 @@ function useCellRendering(param) {
|
|
|
9802
10187
|
computedPinnedStartColumns,
|
|
9803
10188
|
computedPinnedEndColumns,
|
|
9804
10189
|
computedVisibleColumns,
|
|
10190
|
+
computedVisibleColumnsMap,
|
|
9805
10191
|
rowspan,
|
|
9806
10192
|
toggleGroupRow,
|
|
9807
10193
|
columnSize
|
|
@@ -9905,6 +10291,7 @@ function useCellRendering(param) {
|
|
|
9905
10291
|
domRef,
|
|
9906
10292
|
width,
|
|
9907
10293
|
column,
|
|
10294
|
+
columnsMap: computedVisibleColumnsMap,
|
|
9908
10295
|
rowStyle,
|
|
9909
10296
|
rowClassName
|
|
9910
10297
|
};
|
|
@@ -9913,6 +10300,7 @@ function useCellRendering(param) {
|
|
|
9913
10300
|
rowHeight,
|
|
9914
10301
|
getData,
|
|
9915
10302
|
computedVisibleColumns,
|
|
10303
|
+
computedVisibleColumnsMap,
|
|
9916
10304
|
groupRenderStrategy,
|
|
9917
10305
|
toggleGroupRow,
|
|
9918
10306
|
showZebraRows,
|
|
@@ -9928,42 +10316,112 @@ function useCellRendering(param) {
|
|
|
9928
10316
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
9929
10317
|
import { useCallback as useCallback17, useEffect as useEffect26, useState as useState14 } from "react";
|
|
9930
10318
|
|
|
9931
|
-
// src/components/InfiniteTable/
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
map2.set = (key, value) => {
|
|
9940
|
-
set.call(map2, key, value);
|
|
9941
|
-
fns.set(key, value);
|
|
9942
|
-
return map2;
|
|
9943
|
-
};
|
|
10319
|
+
// src/components/InfiniteTable/utils/MultiRowSelector.ts
|
|
10320
|
+
function ensureMinMax(start, end) {
|
|
10321
|
+
return start < end ? [start, end] : [end, start];
|
|
10322
|
+
}
|
|
10323
|
+
var MultiRowSelector = class {
|
|
10324
|
+
constructor(options) {
|
|
10325
|
+
this.multiSelectStartIndex = 0;
|
|
10326
|
+
this.getIdForIndex = options.getIdForIndex;
|
|
9944
10327
|
}
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
const removed = deleteKey.call(map2, key);
|
|
9948
|
-
fns.delete(key);
|
|
9949
|
-
return removed;
|
|
9950
|
-
};
|
|
10328
|
+
set rowSelectionState(rowSelectionState) {
|
|
10329
|
+
this._rowSelectionState = rowSelectionState;
|
|
9951
10330
|
}
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
if (fns.beforeClear) {
|
|
9955
|
-
fns.beforeClear(map2);
|
|
9956
|
-
}
|
|
9957
|
-
const result = clear.call(map2);
|
|
9958
|
-
if (fns.clear) {
|
|
9959
|
-
fns.clear();
|
|
9960
|
-
}
|
|
9961
|
-
return result;
|
|
9962
|
-
};
|
|
10331
|
+
get rowSelectionState() {
|
|
10332
|
+
return this._rowSelectionState;
|
|
9963
10333
|
}
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
10334
|
+
selectRange(startIndex, endIndex) {
|
|
10335
|
+
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
10336
|
+
const rowSelectionState = this.rowSelectionState;
|
|
10337
|
+
for (let i = start; i <= end; i++) {
|
|
10338
|
+
const id = this.getIdForIndex(i);
|
|
10339
|
+
rowSelectionState.selectRow(id);
|
|
10340
|
+
}
|
|
10341
|
+
}
|
|
10342
|
+
deselectRange(startIndex, endIndex) {
|
|
10343
|
+
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
10344
|
+
const rowSelectionState = this.rowSelectionState;
|
|
10345
|
+
for (let i = start; i <= end; i++) {
|
|
10346
|
+
const id = this.getIdForIndex(i);
|
|
10347
|
+
rowSelectionState.deselectRow(id);
|
|
10348
|
+
}
|
|
10349
|
+
}
|
|
10350
|
+
resetClick(index) {
|
|
10351
|
+
this.rowSelectionState.deselectAll();
|
|
10352
|
+
const id = this.getIdForIndex(index);
|
|
10353
|
+
this.rowSelectionState.selectRow(id);
|
|
10354
|
+
this.multiSelectStartIndex = index;
|
|
10355
|
+
this.multiSelectEndIndex = void 0;
|
|
10356
|
+
}
|
|
10357
|
+
singleAddClick(index) {
|
|
10358
|
+
const id = this.getIdForIndex(index);
|
|
10359
|
+
if (this.rowSelectionState.isRowSelected(id)) {
|
|
10360
|
+
this.rowSelectionState.deselectRow(id);
|
|
10361
|
+
if (this.rowSelectionState.isRowSelected(this.getIdForIndex(index + 1))) {
|
|
10362
|
+
this.multiSelectStartIndex = index + 1;
|
|
10363
|
+
} else {
|
|
10364
|
+
}
|
|
10365
|
+
} else {
|
|
10366
|
+
this.rowSelectionState.selectRow(id);
|
|
10367
|
+
this.multiSelectStartIndex = index;
|
|
10368
|
+
let multiSelectEndIndex = void 0;
|
|
10369
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
10370
|
+
const id2 = this.getIdForIndex(i);
|
|
10371
|
+
if (this.rowSelectionState.isRowSelected(id2)) {
|
|
10372
|
+
multiSelectEndIndex = i;
|
|
10373
|
+
} else {
|
|
10374
|
+
break;
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
this.multiSelectEndIndex = multiSelectEndIndex;
|
|
10378
|
+
}
|
|
10379
|
+
}
|
|
10380
|
+
multiSelectClick(index) {
|
|
10381
|
+
if (this.multiSelectEndIndex != null) {
|
|
10382
|
+
this.deselectRange(this.multiSelectStartIndex, this.multiSelectEndIndex);
|
|
10383
|
+
}
|
|
10384
|
+
this.selectRange(this.multiSelectStartIndex, index);
|
|
10385
|
+
this.multiSelectEndIndex = index;
|
|
10386
|
+
}
|
|
10387
|
+
};
|
|
10388
|
+
|
|
10389
|
+
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
10390
|
+
import { useEffect as useEffect20 } from "react";
|
|
10391
|
+
|
|
10392
|
+
// src/components/hooks/useInterceptedMap.ts
|
|
10393
|
+
import { useEffect as useEffect19 } from "react";
|
|
10394
|
+
function interceptMap(map2, fns) {
|
|
10395
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
10396
|
+
if (fns.set) {
|
|
10397
|
+
map2.set = (key, value) => {
|
|
10398
|
+
set.call(map2, key, value);
|
|
10399
|
+
fns.set(key, value);
|
|
10400
|
+
return map2;
|
|
10401
|
+
};
|
|
10402
|
+
}
|
|
10403
|
+
if (fns.delete) {
|
|
10404
|
+
map2.delete = (key) => {
|
|
10405
|
+
const removed = deleteKey.call(map2, key);
|
|
10406
|
+
fns.delete(key);
|
|
10407
|
+
return removed;
|
|
10408
|
+
};
|
|
10409
|
+
}
|
|
10410
|
+
if (fns.clear || fns.beforeClear) {
|
|
10411
|
+
map2.clear = () => {
|
|
10412
|
+
if (fns.beforeClear) {
|
|
10413
|
+
fns.beforeClear(map2);
|
|
10414
|
+
}
|
|
10415
|
+
const result = clear.call(map2);
|
|
10416
|
+
if (fns.clear) {
|
|
10417
|
+
fns.clear();
|
|
10418
|
+
}
|
|
10419
|
+
return result;
|
|
10420
|
+
};
|
|
10421
|
+
}
|
|
10422
|
+
return () => {
|
|
10423
|
+
if (set) {
|
|
10424
|
+
map2.set = set;
|
|
9967
10425
|
}
|
|
9968
10426
|
if (deleteKey) {
|
|
9969
10427
|
map2.delete = deleteKey;
|
|
@@ -10119,13 +10577,13 @@ import { useState as useState12 } from "react";
|
|
|
10119
10577
|
|
|
10120
10578
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
10121
10579
|
var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
10122
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
10123
|
-
var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
10580
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwi _16lm1iwe";
|
|
10581
|
+
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"]] });
|
|
10124
10582
|
|
|
10125
10583
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
10126
10584
|
function ExpanderIcon(props) {
|
|
10127
10585
|
var _a;
|
|
10128
|
-
const { size = 24 } = props;
|
|
10586
|
+
const { size = 24, direction = "start" } = props;
|
|
10129
10587
|
const [expanded, setExpanded] = useState12((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
10130
10588
|
const onClick = () => {
|
|
10131
10589
|
var _a2;
|
|
@@ -10148,8 +10606,9 @@ function ExpanderIcon(props) {
|
|
|
10148
10606
|
style: props.style,
|
|
10149
10607
|
onClick,
|
|
10150
10608
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
10609
|
+
direction: direction || "start",
|
|
10151
10610
|
expanded
|
|
10152
|
-
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
10611
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`, `InfiniteIcon-expander--${direction === "end" ? "end" : "start"}`)
|
|
10153
10612
|
}, /* @__PURE__ */ createElement32("path", {
|
|
10154
10613
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
10155
10614
|
}));
|
|
@@ -10161,7 +10620,7 @@ import {
|
|
|
10161
10620
|
} from "react";
|
|
10162
10621
|
|
|
10163
10622
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
10164
|
-
var LoadingIconCls = "_16lm1iw8
|
|
10623
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwi _16lm1iwe";
|
|
10165
10624
|
|
|
10166
10625
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
10167
10626
|
var LoadingIcon = (props) => {
|
|
@@ -10207,7 +10666,7 @@ function getGroupColumnRender({
|
|
|
10207
10666
|
groupRenderStrategy
|
|
10208
10667
|
}) {
|
|
10209
10668
|
return (renderOptions) => {
|
|
10210
|
-
const { rowInfo, renderBag } = renderOptions;
|
|
10669
|
+
const { rowInfo, renderBag, column } = renderOptions;
|
|
10211
10670
|
let { value: valueToRender, groupIcon, selectionCheckBox } = renderBag;
|
|
10212
10671
|
const groupRowInfo = rowInfo;
|
|
10213
10672
|
if (groupRenderStrategy === "multi-column") {
|
|
@@ -10217,7 +10676,7 @@ function getGroupColumnRender({
|
|
|
10217
10676
|
} else if (groupRenderStrategy === "single-column" && !groupRowInfo.isGroupRow) {
|
|
10218
10677
|
}
|
|
10219
10678
|
return /* @__PURE__ */ createElement34("div", {
|
|
10220
|
-
className: join(display.flex, alignItems.center, groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && !rowInfo.isGroupRow && selectionCheckBox ? GroupRowExpanderCls : null)
|
|
10679
|
+
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)
|
|
10221
10680
|
}, groupIcon, selectionCheckBox, /* @__PURE__ */ createElement34("div", {
|
|
10222
10681
|
className: cssEllipsisClassName
|
|
10223
10682
|
}, valueToRender != null ? valueToRender : null));
|
|
@@ -10231,7 +10690,7 @@ function getGroupColumnRenderGroupIcon({
|
|
|
10231
10690
|
}) {
|
|
10232
10691
|
return (renderOptions) => {
|
|
10233
10692
|
var _a, _b, _c;
|
|
10234
|
-
const { rowInfo, value, groupBy, pivotBy } = renderOptions;
|
|
10693
|
+
const { rowInfo, value, groupBy, pivotBy, column } = renderOptions;
|
|
10235
10694
|
const groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : rowInfo.isGroupRow && ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndexForColumn]) || rowInfo;
|
|
10236
10695
|
if (!groupRowInfo) {
|
|
10237
10696
|
return null;
|
|
@@ -10263,6 +10722,7 @@ function getGroupColumnRenderGroupIcon({
|
|
|
10263
10722
|
} else if (showExpanderIcon) {
|
|
10264
10723
|
const defaultIcon = /* @__PURE__ */ createElement34(ExpanderIcon, {
|
|
10265
10724
|
expanded: !collapsed,
|
|
10725
|
+
direction: column.align === "end" ? "end" : "start",
|
|
10266
10726
|
onChange: () => {
|
|
10267
10727
|
toggleGroupRow(groupKeys);
|
|
10268
10728
|
}
|
|
@@ -10280,8 +10740,11 @@ function getGroupColumnRenderGroupIcon({
|
|
|
10280
10740
|
};
|
|
10281
10741
|
}
|
|
10282
10742
|
function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
10283
|
-
var _a;
|
|
10284
10743
|
const { groupByForColumn, groupIndexForColumn, groupRenderStrategy } = options;
|
|
10744
|
+
let userDefinedGroupColumn = typeof groupColumnFromProps === "function" ? groupColumnFromProps(options, toggleGroupRow) : __spreadValues({}, groupColumnFromProps);
|
|
10745
|
+
if (groupByForColumn.column) {
|
|
10746
|
+
userDefinedGroupColumn = __spreadValues(__spreadValues({}, userDefinedGroupColumn), groupByForColumn.column);
|
|
10747
|
+
}
|
|
10285
10748
|
let generatedGroupColumn = __spreadProps(__spreadValues({
|
|
10286
10749
|
header: `Group by ${groupByForColumn.field}`,
|
|
10287
10750
|
groupByField: groupByForColumn.field,
|
|
@@ -10291,9 +10754,9 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
10291
10754
|
groupIndexForColumn,
|
|
10292
10755
|
groupRenderStrategy
|
|
10293
10756
|
})
|
|
10294
|
-
},
|
|
10757
|
+
}, userDefinedGroupColumn), {
|
|
10295
10758
|
renderGroupIcon: getGroupColumnRenderGroupIcon({
|
|
10296
|
-
initialRenderGroupIcon:
|
|
10759
|
+
initialRenderGroupIcon: userDefinedGroupColumn == null ? void 0 : userDefinedGroupColumn.renderGroupIcon,
|
|
10297
10760
|
groupIndexForColumn,
|
|
10298
10761
|
toggleGroupRow,
|
|
10299
10762
|
groupRenderStrategy
|
|
@@ -10314,7 +10777,7 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
10314
10777
|
header: `Group`,
|
|
10315
10778
|
groupByField: options.groupBy.map((g) => g.field),
|
|
10316
10779
|
sortable: false,
|
|
10317
|
-
renderSelectionCheckBox:
|
|
10780
|
+
renderSelectionCheckBox: options.selectionMode === "multi-row",
|
|
10318
10781
|
style: styleForGroupColumn,
|
|
10319
10782
|
render: getGroupColumnRender({
|
|
10320
10783
|
groupIndexForColumn: 0,
|
|
@@ -10511,7 +10974,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
10511
10974
|
}
|
|
10512
10975
|
function useColumnsWhenGrouping() {
|
|
10513
10976
|
const {
|
|
10514
|
-
componentState: { groupBy, pivotBy }
|
|
10977
|
+
componentState: { groupBy, pivotBy, selectionMode }
|
|
10515
10978
|
} = useDataSourceContextValue();
|
|
10516
10979
|
const {
|
|
10517
10980
|
componentActions,
|
|
@@ -10538,7 +11001,8 @@ function useColumnsWhenGrouping() {
|
|
|
10538
11001
|
groupBy,
|
|
10539
11002
|
pivotBy,
|
|
10540
11003
|
pivotColumns,
|
|
10541
|
-
toggleGroupRow
|
|
11004
|
+
toggleGroupRow,
|
|
11005
|
+
selectionMode
|
|
10542
11006
|
});
|
|
10543
11007
|
componentActions.columnsWhenGrouping = columnsWhenGrouping;
|
|
10544
11008
|
};
|
|
@@ -10552,6 +11016,7 @@ function useColumnsWhenGrouping() {
|
|
|
10552
11016
|
columns,
|
|
10553
11017
|
groupBy,
|
|
10554
11018
|
pivotBy,
|
|
11019
|
+
selectionMode,
|
|
10555
11020
|
groupColumn,
|
|
10556
11021
|
groupRenderStrategy,
|
|
10557
11022
|
pivotColumns,
|
|
@@ -10695,6 +11160,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
10695
11160
|
pivotColumns,
|
|
10696
11161
|
groupBy,
|
|
10697
11162
|
pivotBy,
|
|
11163
|
+
selectionMode,
|
|
10698
11164
|
groupColumn,
|
|
10699
11165
|
pivotTotalColumnPosition,
|
|
10700
11166
|
pivotGrandTotalColumnPosition,
|
|
@@ -10715,7 +11181,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
10715
11181
|
pivotBy,
|
|
10716
11182
|
groupIndexForColumn,
|
|
10717
11183
|
groupCount: arr.length,
|
|
10718
|
-
groupRenderStrategy
|
|
11184
|
+
groupRenderStrategy,
|
|
11185
|
+
selectionMode
|
|
10719
11186
|
}, toggleGroupRow, groupColumn);
|
|
10720
11187
|
computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
|
|
10721
11188
|
});
|
|
@@ -10724,7 +11191,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
10724
11191
|
groupCount: groupBy.length,
|
|
10725
11192
|
groupBy,
|
|
10726
11193
|
pivotBy,
|
|
10727
|
-
groupRenderStrategy
|
|
11194
|
+
groupRenderStrategy,
|
|
11195
|
+
selectionMode
|
|
10728
11196
|
}, toggleGroupRow, groupColumn);
|
|
10729
11197
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
10730
11198
|
}
|
|
@@ -11134,7 +11602,10 @@ var getComputedVisibleColumns = ({
|
|
|
11134
11602
|
computedVisibleColumns,
|
|
11135
11603
|
computedVisibleColumnsMap,
|
|
11136
11604
|
computedPinnedEndWidth,
|
|
11137
|
-
computedPinnedStartWidth
|
|
11605
|
+
computedPinnedStartWidth,
|
|
11606
|
+
renderSelectionCheckBox: computedVisibleColumns.reduce((bool, c) => {
|
|
11607
|
+
return bool || !!c.renderSelectionCheckBox;
|
|
11608
|
+
}, false)
|
|
11138
11609
|
};
|
|
11139
11610
|
return result;
|
|
11140
11611
|
};
|
|
@@ -11195,7 +11666,8 @@ var useComputedVisibleColumns = ({
|
|
|
11195
11666
|
computedUnpinnedOffset,
|
|
11196
11667
|
computedPinnedEndOffset,
|
|
11197
11668
|
computedPinnedEndWidth,
|
|
11198
|
-
computedPinnedStartWidth
|
|
11669
|
+
computedPinnedStartWidth,
|
|
11670
|
+
renderSelectionCheckBox
|
|
11199
11671
|
} = useMemo10(() => {
|
|
11200
11672
|
return getComputedVisibleColumns({
|
|
11201
11673
|
columns,
|
|
@@ -11246,6 +11718,7 @@ var useComputedVisibleColumns = ({
|
|
|
11246
11718
|
columnsRenderId
|
|
11247
11719
|
]);
|
|
11248
11720
|
const result = {
|
|
11721
|
+
renderSelectionCheckBox,
|
|
11249
11722
|
columns,
|
|
11250
11723
|
computedPinnedEndWidth,
|
|
11251
11724
|
computedPinnedStartWidth,
|
|
@@ -11353,7 +11826,8 @@ function useComputed() {
|
|
|
11353
11826
|
computedPinnedEndOffset,
|
|
11354
11827
|
computedRemainingSpace,
|
|
11355
11828
|
computedPinnedStartWidth,
|
|
11356
|
-
computedPinnedEndWidth
|
|
11829
|
+
computedPinnedEndWidth,
|
|
11830
|
+
renderSelectionCheckBox
|
|
11357
11831
|
} = useComputedVisibleColumns({
|
|
11358
11832
|
columns,
|
|
11359
11833
|
columnCssEllipsis: componentState.columnCssEllipsis,
|
|
@@ -11384,12 +11858,20 @@ function useComputed() {
|
|
|
11384
11858
|
const scrollbars = useScrollbars(brain);
|
|
11385
11859
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
11386
11860
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
11861
|
+
const [multiRowSelector] = useState14(() => {
|
|
11862
|
+
const multiRowSelector2 = new MultiRowSelector({
|
|
11863
|
+
getIdForIndex: (index) => getDataSourceState().dataArray[index].id
|
|
11864
|
+
});
|
|
11865
|
+
return multiRowSelector2;
|
|
11866
|
+
});
|
|
11387
11867
|
return {
|
|
11868
|
+
multiRowSelector,
|
|
11388
11869
|
showColumnFilters: !!dataSourceState.filterValue,
|
|
11389
11870
|
scrollbars,
|
|
11390
11871
|
columnSize,
|
|
11391
11872
|
rowspan,
|
|
11392
11873
|
toggleGroupRow,
|
|
11874
|
+
renderSelectionCheckBox,
|
|
11393
11875
|
computedPinnedStartOverflow,
|
|
11394
11876
|
computedPinnedEndOverflow,
|
|
11395
11877
|
computedPinnedStartWidth,
|
|
@@ -11572,7 +12054,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
11572
12054
|
const valid = useMemo11(() => {
|
|
11573
12055
|
let valid2 = isValidLicense(licenseKey, {
|
|
11574
12056
|
publishedAt: 1624970570587,
|
|
11575
|
-
version: "0.4.
|
|
12057
|
+
version: "0.4.3"
|
|
11576
12058
|
});
|
|
11577
12059
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
11578
12060
|
return true;
|
|
@@ -11582,149 +12064,19 @@ var useLicense = (licenseKey = "") => {
|
|
|
11582
12064
|
return valid;
|
|
11583
12065
|
};
|
|
11584
12066
|
|
|
11585
|
-
// src/components/InfiniteTable/hooks/useRowSelection.ts
|
|
11586
|
-
import { useEffect as useEffect27, useState as useState15 } from "react";
|
|
11587
|
-
|
|
11588
|
-
// src/components/InfiniteTable/utils/MultiRowSelector.ts
|
|
11589
|
-
function ensureMinMax(start, end) {
|
|
11590
|
-
return start < end ? [start, end] : [end, start];
|
|
11591
|
-
}
|
|
11592
|
-
var MultiRowSelector = class {
|
|
11593
|
-
constructor(options) {
|
|
11594
|
-
this.multiSelectStartIndex = 0;
|
|
11595
|
-
this.getIdForIndex = options.getIdForIndex;
|
|
11596
|
-
}
|
|
11597
|
-
set rowSelectionState(rowSelectionState) {
|
|
11598
|
-
this._rowSelectionState = rowSelectionState;
|
|
11599
|
-
}
|
|
11600
|
-
get rowSelectionState() {
|
|
11601
|
-
return this._rowSelectionState;
|
|
11602
|
-
}
|
|
11603
|
-
selectRange(startIndex, endIndex) {
|
|
11604
|
-
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
11605
|
-
const rowSelectionState = this.rowSelectionState;
|
|
11606
|
-
for (let i = start; i <= end; i++) {
|
|
11607
|
-
const id = this.getIdForIndex(i);
|
|
11608
|
-
rowSelectionState.selectRow(id);
|
|
11609
|
-
}
|
|
11610
|
-
}
|
|
11611
|
-
deselectRange(startIndex, endIndex) {
|
|
11612
|
-
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
11613
|
-
const rowSelectionState = this.rowSelectionState;
|
|
11614
|
-
for (let i = start; i <= end; i++) {
|
|
11615
|
-
const id = this.getIdForIndex(i);
|
|
11616
|
-
rowSelectionState.deselectRow(id);
|
|
11617
|
-
}
|
|
11618
|
-
}
|
|
11619
|
-
resetClick(index) {
|
|
11620
|
-
this.rowSelectionState.deselectAll();
|
|
11621
|
-
const id = this.getIdForIndex(index);
|
|
11622
|
-
this.rowSelectionState.selectRow(id);
|
|
11623
|
-
this.multiSelectStartIndex = index;
|
|
11624
|
-
this.multiSelectEndIndex = void 0;
|
|
11625
|
-
}
|
|
11626
|
-
singleAddClick(index) {
|
|
11627
|
-
const id = this.getIdForIndex(index);
|
|
11628
|
-
if (this.rowSelectionState.isRowSelected(id)) {
|
|
11629
|
-
this.rowSelectionState.deselectRow(id);
|
|
11630
|
-
if (this.rowSelectionState.isRowSelected(this.getIdForIndex(index + 1))) {
|
|
11631
|
-
this.multiSelectStartIndex = index + 1;
|
|
11632
|
-
} else {
|
|
11633
|
-
}
|
|
11634
|
-
} else {
|
|
11635
|
-
this.rowSelectionState.selectRow(id);
|
|
11636
|
-
this.multiSelectStartIndex = index;
|
|
11637
|
-
let multiSelectEndIndex = void 0;
|
|
11638
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
11639
|
-
const id2 = this.getIdForIndex(i);
|
|
11640
|
-
if (this.rowSelectionState.isRowSelected(id2)) {
|
|
11641
|
-
multiSelectEndIndex = i;
|
|
11642
|
-
} else {
|
|
11643
|
-
break;
|
|
11644
|
-
}
|
|
11645
|
-
}
|
|
11646
|
-
this.multiSelectEndIndex = multiSelectEndIndex;
|
|
11647
|
-
}
|
|
11648
|
-
}
|
|
11649
|
-
multiSelectClick(index) {
|
|
11650
|
-
if (this.multiSelectEndIndex != null) {
|
|
11651
|
-
this.deselectRange(this.multiSelectStartIndex, this.multiSelectEndIndex);
|
|
11652
|
-
}
|
|
11653
|
-
this.selectRange(this.multiSelectStartIndex, index);
|
|
11654
|
-
this.multiSelectEndIndex = index;
|
|
11655
|
-
}
|
|
11656
|
-
};
|
|
11657
|
-
|
|
11658
|
-
// src/components/InfiniteTable/hooks/useRowSelection.ts
|
|
11659
|
-
function useRowSelection() {
|
|
11660
|
-
const { getState } = useInfiniteTable();
|
|
11661
|
-
const [multiRowSelector] = useState15(() => {
|
|
11662
|
-
const multiRowSelector2 = new MultiRowSelector({
|
|
11663
|
-
getIdForIndex: (index) => getDataSourceState().dataArray[index].id
|
|
11664
|
-
});
|
|
11665
|
-
return multiRowSelector2;
|
|
11666
|
-
});
|
|
11667
|
-
const { getState: getDataSourceState, componentActions } = useDataSourceContextValue();
|
|
11668
|
-
useEffect27(() => {
|
|
11669
|
-
const removeOnClick = getState().cellClick.onChange((args) => {
|
|
11670
|
-
if (args == null) {
|
|
11671
|
-
return;
|
|
11672
|
-
}
|
|
11673
|
-
const { rowIndex, event } = args;
|
|
11674
|
-
let {
|
|
11675
|
-
rowSelection: rowSelectionState,
|
|
11676
|
-
selectionMode,
|
|
11677
|
-
groupBy
|
|
11678
|
-
} = getDataSourceState();
|
|
11679
|
-
if (groupBy.length) {
|
|
11680
|
-
return;
|
|
11681
|
-
}
|
|
11682
|
-
if (selectionMode === "multi-row") {
|
|
11683
|
-
rowSelectionState = new RowSelectionState(rowSelectionState);
|
|
11684
|
-
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
11685
|
-
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
11686
|
-
if (event.shiftKey) {
|
|
11687
|
-
multiRowSelector.multiSelectClick(rowIndex);
|
|
11688
|
-
} else if (event.metaKey || event.ctrlKey) {
|
|
11689
|
-
multiRowSelector.singleAddClick(rowIndex);
|
|
11690
|
-
} else {
|
|
11691
|
-
multiRowSelector.resetClick(rowIndex);
|
|
11692
|
-
}
|
|
11693
|
-
componentActions.rowSelection = rowSelectionState;
|
|
11694
|
-
}
|
|
11695
|
-
} else if (selectionMode === "single-row") {
|
|
11696
|
-
}
|
|
11697
|
-
});
|
|
11698
|
-
const removeOnKeyDown = getState().keyDown.onChange((event) => {
|
|
11699
|
-
let { rowSelection: rowSelectionState, selectionMode } = getDataSourceState();
|
|
11700
|
-
if (selectionMode === "multi-row") {
|
|
11701
|
-
if ((event == null ? void 0 : event.key) === "a" && (event.ctrlKey || event.metaKey)) {
|
|
11702
|
-
rowSelectionState = new RowSelectionState(rowSelectionState);
|
|
11703
|
-
rowSelectionState.selectAll();
|
|
11704
|
-
componentActions.rowSelection = rowSelectionState;
|
|
11705
|
-
}
|
|
11706
|
-
}
|
|
11707
|
-
});
|
|
11708
|
-
return () => {
|
|
11709
|
-
removeOnClick();
|
|
11710
|
-
removeOnKeyDown();
|
|
11711
|
-
};
|
|
11712
|
-
}, [multiRowSelector]);
|
|
11713
|
-
}
|
|
11714
|
-
|
|
11715
12067
|
// src/components/InfiniteTable/hooks/useScrollToActiveCell.ts
|
|
11716
|
-
import { useRef as useRef22, useEffect as
|
|
12068
|
+
import { useRef as useRef22, useEffect as useEffect27 } from "react";
|
|
11717
12069
|
var RETRIES = 10;
|
|
11718
12070
|
function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
11719
12071
|
const didScrollRef = useRef22(false);
|
|
11720
12072
|
const rafId = useRef22(null);
|
|
11721
|
-
|
|
12073
|
+
useEffect27(() => {
|
|
11722
12074
|
if (activeCellIndex != null) {
|
|
11723
12075
|
didScrollRef.current = false;
|
|
11724
12076
|
cancelRaf(rafId.current);
|
|
11725
12077
|
}
|
|
11726
12078
|
}, [activeCellIndex]);
|
|
11727
|
-
|
|
12079
|
+
useEffect27(() => {
|
|
11728
12080
|
if (activeCellIndex != null && !didScrollRef.current) {
|
|
11729
12081
|
let tryScroll = function(times = 0) {
|
|
11730
12082
|
times++;
|
|
@@ -11747,18 +12099,18 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
11747
12099
|
}
|
|
11748
12100
|
|
|
11749
12101
|
// src/components/InfiniteTable/hooks/useScrollToActiveRow.ts
|
|
11750
|
-
import { useRef as useRef23, useEffect as
|
|
12102
|
+
import { useRef as useRef23, useEffect as useEffect28 } from "react";
|
|
11751
12103
|
var RETRIES2 = 10;
|
|
11752
12104
|
function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
11753
12105
|
const didScrollRef = useRef23(false);
|
|
11754
12106
|
const rafId = useRef23(null);
|
|
11755
|
-
|
|
12107
|
+
useEffect28(() => {
|
|
11756
12108
|
if (activeRowIndex != null) {
|
|
11757
12109
|
didScrollRef.current = false;
|
|
11758
12110
|
cancelAnimationFrame(rafId.current);
|
|
11759
12111
|
}
|
|
11760
12112
|
}, [activeRowIndex]);
|
|
11761
|
-
|
|
12113
|
+
useEffect28(() => {
|
|
11762
12114
|
if (activeRowIndex != null && !didScrollRef.current) {
|
|
11763
12115
|
let tryScroll = function(times = 0) {
|
|
11764
12116
|
times++;
|
|
@@ -11779,225 +12131,34 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
11779
12131
|
}, [activeRowIndex, dataCount]);
|
|
11780
12132
|
}
|
|
11781
12133
|
|
|
11782
|
-
// src/components/
|
|
11783
|
-
|
|
11784
|
-
return Math.min(Math.max(value, min), max);
|
|
11785
|
-
}
|
|
12134
|
+
// src/components/InfiniteTable/state/getInitialState.ts
|
|
12135
|
+
import { createRef } from "react";
|
|
11786
12136
|
|
|
11787
|
-
// src/components/
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
11813
|
-
},
|
|
11814
|
-
PageUp: () => {
|
|
11815
|
-
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
11816
|
-
},
|
|
11817
|
-
End: () => {
|
|
11818
|
-
activeRowIndex = max;
|
|
11819
|
-
},
|
|
11820
|
-
Home: () => {
|
|
11821
|
-
activeRowIndex = min;
|
|
11822
|
-
}
|
|
11823
|
-
};
|
|
11824
|
-
const Fn = KeyToFunction[key];
|
|
11825
|
-
if (!Fn) {
|
|
11826
|
-
return false;
|
|
11827
|
-
}
|
|
11828
|
-
Fn();
|
|
11829
|
-
actions.activeRowIndex = activeRowIndex;
|
|
11830
|
-
return true;
|
|
11831
|
-
}
|
|
11832
|
-
function handleCellNavigation(options) {
|
|
11833
|
-
const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
|
|
11834
|
-
const state = getState();
|
|
11835
|
-
const { activeCellIndex, brain } = state;
|
|
11836
|
-
if (!activeCellIndex) {
|
|
11837
|
-
return false;
|
|
11838
|
-
}
|
|
11839
|
-
let [rowIndex, colIndex] = activeCellIndex;
|
|
11840
|
-
const {
|
|
11841
|
-
start: [startRow, startCol],
|
|
11842
|
-
end: [endRow, endCol]
|
|
11843
|
-
} = brain.getRenderRange();
|
|
11844
|
-
const renderRowCount = endRow - startRow - 1;
|
|
11845
|
-
const renderColCount = endCol - startCol - 1;
|
|
11846
|
-
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
11847
|
-
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
11848
|
-
const minRow = 0;
|
|
11849
|
-
const minCol = 0;
|
|
11850
|
-
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
11851
|
-
colIndex = clamp(colIndex, 0, maxCol);
|
|
11852
|
-
actions.activeCellIndex = [rowIndex, colIndex];
|
|
11853
|
-
const KeyToFunction = {
|
|
11854
|
-
ArrowDown: () => {
|
|
11855
|
-
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
11856
|
-
},
|
|
11857
|
-
ArrowUp: () => {
|
|
11858
|
-
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
11859
|
-
},
|
|
11860
|
-
ArrowLeft: () => {
|
|
11861
|
-
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
11862
|
-
},
|
|
11863
|
-
ArrowRight: () => {
|
|
11864
|
-
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
11865
|
-
},
|
|
11866
|
-
PageDown: () => {
|
|
11867
|
-
if (!shiftKey) {
|
|
11868
|
-
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
11869
|
-
} else {
|
|
11870
|
-
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
11871
|
-
}
|
|
11872
|
-
},
|
|
11873
|
-
PageUp: () => {
|
|
11874
|
-
if (!shiftKey) {
|
|
11875
|
-
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
11876
|
-
} else {
|
|
11877
|
-
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
11878
|
-
}
|
|
11879
|
-
},
|
|
11880
|
-
End: () => {
|
|
11881
|
-
if (!shiftKey) {
|
|
11882
|
-
rowIndex = maxRow;
|
|
11883
|
-
} else {
|
|
11884
|
-
colIndex = maxCol;
|
|
11885
|
-
}
|
|
11886
|
-
},
|
|
11887
|
-
Home: () => {
|
|
11888
|
-
if (!shiftKey) {
|
|
11889
|
-
rowIndex = minRow;
|
|
11890
|
-
} else {
|
|
11891
|
-
colIndex = minCol;
|
|
11892
|
-
}
|
|
11893
|
-
}
|
|
11894
|
-
};
|
|
11895
|
-
const Fn = KeyToFunction[key];
|
|
11896
|
-
if (!Fn) {
|
|
11897
|
-
return false;
|
|
11898
|
-
}
|
|
11899
|
-
Fn();
|
|
11900
|
-
actions.activeCellIndex = [rowIndex, colIndex];
|
|
11901
|
-
return true;
|
|
11902
|
-
}
|
|
11903
|
-
var validKeys = {
|
|
11904
|
-
ArrowUp: true,
|
|
11905
|
-
ArrowDown: true,
|
|
11906
|
-
ArrowLeft: true,
|
|
11907
|
-
ArrowRight: true,
|
|
11908
|
-
PageUp: true,
|
|
11909
|
-
PageDown: true,
|
|
11910
|
-
Home: true,
|
|
11911
|
-
End: true,
|
|
11912
|
-
Enter: true,
|
|
11913
|
-
" ": true
|
|
11914
|
-
};
|
|
11915
|
-
function handleKeyboardNavigation(options) {
|
|
11916
|
-
const { getState, getDataSourceState, imperativeApi } = options;
|
|
11917
|
-
const state = getState();
|
|
11918
|
-
const dataSourceState = getDataSourceState();
|
|
11919
|
-
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
11920
|
-
if (!validKeys[options.key]) {
|
|
11921
|
-
return false;
|
|
11922
|
-
}
|
|
11923
|
-
if (options.key === "Enter") {
|
|
11924
|
-
if (keyboardNavigation === "row" && activeRowIndex != null) {
|
|
11925
|
-
const rowInfo = dataSourceState.dataArray[activeRowIndex];
|
|
11926
|
-
if (rowInfo && rowInfo.isGroupRow) {
|
|
11927
|
-
imperativeApi.toggleGroupRow(rowInfo.groupKeys);
|
|
11928
|
-
return true;
|
|
11929
|
-
}
|
|
11930
|
-
}
|
|
11931
|
-
if (keyboardNavigation === "cell" && activeCellIndex != null) {
|
|
11932
|
-
const rowInfo = dataSourceState.dataArray[activeCellIndex[0]];
|
|
11933
|
-
if (rowInfo && rowInfo.isGroupRow) {
|
|
11934
|
-
imperativeApi.toggleGroupRow(rowInfo.groupKeys);
|
|
11935
|
-
return true;
|
|
11936
|
-
}
|
|
11937
|
-
}
|
|
11938
|
-
return false;
|
|
11939
|
-
}
|
|
11940
|
-
if (options.key === " ") {
|
|
11941
|
-
if (keyboardNavigation === "row" && activeRowIndex != null) {
|
|
11942
|
-
const rowInfo = dataSourceState.dataArray[activeRowIndex];
|
|
11943
|
-
if (rowInfo) {
|
|
11944
|
-
if (rowInfo.isGroupRow) {
|
|
11945
|
-
imperativeApi.toggleGroupRowSelection(rowInfo.groupKeys);
|
|
11946
|
-
} else {
|
|
11947
|
-
imperativeApi.toggleRowSelection(rowInfo.id);
|
|
11948
|
-
}
|
|
11949
|
-
return true;
|
|
11950
|
-
}
|
|
11951
|
-
}
|
|
11952
|
-
if (keyboardNavigation === "cell" && activeCellIndex != null) {
|
|
11953
|
-
const rowInfo = dataSourceState.dataArray[activeCellIndex[0]];
|
|
11954
|
-
if (rowInfo) {
|
|
11955
|
-
if (rowInfo.isGroupRow) {
|
|
11956
|
-
imperativeApi.toggleGroupRowSelection(rowInfo.groupKeys);
|
|
11957
|
-
} else {
|
|
11958
|
-
imperativeApi.toggleRowSelection(rowInfo.id);
|
|
11959
|
-
}
|
|
11960
|
-
return true;
|
|
11961
|
-
}
|
|
11962
|
-
}
|
|
11963
|
-
}
|
|
11964
|
-
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
11965
|
-
return handleRowNavigation(options);
|
|
11966
|
-
}
|
|
11967
|
-
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
11968
|
-
return handleCellNavigation(options);
|
|
11969
|
-
}
|
|
11970
|
-
return false;
|
|
11971
|
-
}
|
|
11972
|
-
|
|
11973
|
-
// src/components/InfiniteTable/state/getInitialState.ts
|
|
11974
|
-
import { createRef } from "react";
|
|
11975
|
-
|
|
11976
|
-
// src/components/VirtualBrain/ScrollListener.ts
|
|
11977
|
-
var initialScrollPosition = {
|
|
11978
|
-
scrollLeft: 0,
|
|
11979
|
-
scrollTop: 0
|
|
11980
|
-
};
|
|
11981
|
-
var ScrollListener = class {
|
|
11982
|
-
constructor() {
|
|
11983
|
-
this.scrollPosition = initialScrollPosition;
|
|
11984
|
-
this.onScrollFns = [];
|
|
11985
|
-
this.getScrollPosition = () => {
|
|
11986
|
-
return this.scrollPosition;
|
|
11987
|
-
};
|
|
11988
|
-
this.onScroll = (fn) => {
|
|
11989
|
-
this.onScrollFns.push(fn);
|
|
11990
|
-
return () => {
|
|
11991
|
-
this.onScrollFns = this.onScrollFns.filter((f) => f !== fn);
|
|
11992
|
-
};
|
|
11993
|
-
};
|
|
11994
|
-
this.setScrollPosition = (scrollPosition) => {
|
|
11995
|
-
this.scrollPosition = scrollPosition;
|
|
11996
|
-
this.notifyScrollChange();
|
|
11997
|
-
};
|
|
11998
|
-
this.destroy = () => {
|
|
11999
|
-
this.onScrollFns = [];
|
|
12000
|
-
};
|
|
12137
|
+
// src/components/VirtualBrain/ScrollListener.ts
|
|
12138
|
+
var initialScrollPosition = {
|
|
12139
|
+
scrollLeft: 0,
|
|
12140
|
+
scrollTop: 0
|
|
12141
|
+
};
|
|
12142
|
+
var ScrollListener = class {
|
|
12143
|
+
constructor() {
|
|
12144
|
+
this.scrollPosition = initialScrollPosition;
|
|
12145
|
+
this.onScrollFns = [];
|
|
12146
|
+
this.getScrollPosition = () => {
|
|
12147
|
+
return this.scrollPosition;
|
|
12148
|
+
};
|
|
12149
|
+
this.onScroll = (fn) => {
|
|
12150
|
+
this.onScrollFns.push(fn);
|
|
12151
|
+
return () => {
|
|
12152
|
+
this.onScrollFns = this.onScrollFns.filter((f) => f !== fn);
|
|
12153
|
+
};
|
|
12154
|
+
};
|
|
12155
|
+
this.setScrollPosition = (scrollPosition) => {
|
|
12156
|
+
this.scrollPosition = scrollPosition;
|
|
12157
|
+
this.notifyScrollChange();
|
|
12158
|
+
};
|
|
12159
|
+
this.destroy = () => {
|
|
12160
|
+
this.onScrollFns = [];
|
|
12161
|
+
};
|
|
12001
12162
|
}
|
|
12002
12163
|
notifyScrollChange() {
|
|
12003
12164
|
const { scrollPosition } = this;
|
|
@@ -12141,6 +12302,7 @@ var forwardProps4 = (setupState) => {
|
|
|
12141
12302
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
12142
12303
|
pivotGrandTotalColumnPosition: 1,
|
|
12143
12304
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
12305
|
+
keyboardSelection: (keyboardSelection) => keyboardSelection != null ? keyboardSelection : true,
|
|
12144
12306
|
activeRowIndex: 1,
|
|
12145
12307
|
activeCellIndex: 1,
|
|
12146
12308
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
@@ -12215,6 +12377,388 @@ var mapPropsToState2 = (params) => {
|
|
|
12215
12377
|
// src/components/InfiniteTable/utils/toCSSVarName.ts
|
|
12216
12378
|
var toCSSVarName = (value) => `--infinite-${value}`;
|
|
12217
12379
|
|
|
12380
|
+
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
12381
|
+
import { useCallback as useCallback18, useMemo as useMemo12, useEffect as useEffect29 } from "react";
|
|
12382
|
+
|
|
12383
|
+
// src/components/InfiniteTable/eventHandlers/onCellClick.ts
|
|
12384
|
+
function onCellClick(context, event) {
|
|
12385
|
+
updateRowSelectionOnCellClick(context, event);
|
|
12386
|
+
}
|
|
12387
|
+
function updateRowSelectionOnCellClick(context, event) {
|
|
12388
|
+
const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
|
|
12389
|
+
const { multiRowSelector, renderSelectionCheckBox } = getComputed();
|
|
12390
|
+
const dataSourceState = getDataSourceState();
|
|
12391
|
+
const { selectionMode, groupBy } = dataSourceState;
|
|
12392
|
+
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12393
|
+
if (groupBy.length) {
|
|
12394
|
+
return false;
|
|
12395
|
+
}
|
|
12396
|
+
if (selectionMode === "multi-row") {
|
|
12397
|
+
if (renderSelectionCheckBox && !event.key) {
|
|
12398
|
+
return false;
|
|
12399
|
+
}
|
|
12400
|
+
rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12401
|
+
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
12402
|
+
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
12403
|
+
if (event.shiftKey) {
|
|
12404
|
+
multiRowSelector.multiSelectClick(rowIndex);
|
|
12405
|
+
} else if (event.metaKey || event.ctrlKey) {
|
|
12406
|
+
multiRowSelector.singleAddClick(rowIndex);
|
|
12407
|
+
} else {
|
|
12408
|
+
multiRowSelector.resetClick(rowIndex);
|
|
12409
|
+
}
|
|
12410
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
12411
|
+
return true;
|
|
12412
|
+
}
|
|
12413
|
+
} else if (selectionMode === "single-row") {
|
|
12414
|
+
}
|
|
12415
|
+
return false;
|
|
12416
|
+
}
|
|
12417
|
+
|
|
12418
|
+
// src/components/utils/clamp.ts
|
|
12419
|
+
function clamp(value, min, max) {
|
|
12420
|
+
return Math.min(Math.max(value, min), max);
|
|
12421
|
+
}
|
|
12422
|
+
|
|
12423
|
+
// src/components/InfiniteTable/eventHandlers/keyboardNavigation.ts
|
|
12424
|
+
function handleRowNavigation(options) {
|
|
12425
|
+
const { key, getState, getDataSourceState, actions, api } = options;
|
|
12426
|
+
const dataArray = getDataSourceState().dataArray;
|
|
12427
|
+
const arrLength = dataArray.length;
|
|
12428
|
+
const state = getState();
|
|
12429
|
+
const { brain } = state;
|
|
12430
|
+
let { activeRowIndex } = state;
|
|
12431
|
+
if (activeRowIndex == null) {
|
|
12432
|
+
return false;
|
|
12433
|
+
}
|
|
12434
|
+
const {
|
|
12435
|
+
start: [startRow],
|
|
12436
|
+
end: [endRow]
|
|
12437
|
+
} = brain.getRenderRange();
|
|
12438
|
+
const renderRowCount = endRow - startRow - 1;
|
|
12439
|
+
const min = 0;
|
|
12440
|
+
const max = arrLength - 1;
|
|
12441
|
+
const KeyToFunction = {
|
|
12442
|
+
ArrowDown: () => {
|
|
12443
|
+
activeRowIndex = clamp(activeRowIndex + 1, min, max);
|
|
12444
|
+
},
|
|
12445
|
+
ArrowUp: () => {
|
|
12446
|
+
activeRowIndex = clamp(activeRowIndex - 1, min, max);
|
|
12447
|
+
},
|
|
12448
|
+
ArrowLeft: () => {
|
|
12449
|
+
const rowInfo = dataArray[activeRowIndex];
|
|
12450
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12451
|
+
return api.collapseGroupRow(rowInfo.groupKeys);
|
|
12452
|
+
}
|
|
12453
|
+
return false;
|
|
12454
|
+
},
|
|
12455
|
+
ArrowRight: () => {
|
|
12456
|
+
const rowInfo = dataArray[activeRowIndex];
|
|
12457
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12458
|
+
return api.expandGroupRow(rowInfo.groupKeys);
|
|
12459
|
+
}
|
|
12460
|
+
return false;
|
|
12461
|
+
},
|
|
12462
|
+
Enter: () => {
|
|
12463
|
+
const rowInfo = dataArray[activeRowIndex];
|
|
12464
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12465
|
+
return api.toggleGroupRow(rowInfo.groupKeys);
|
|
12466
|
+
}
|
|
12467
|
+
return false;
|
|
12468
|
+
},
|
|
12469
|
+
PageDown: () => {
|
|
12470
|
+
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
12471
|
+
},
|
|
12472
|
+
PageUp: () => {
|
|
12473
|
+
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
12474
|
+
},
|
|
12475
|
+
End: () => {
|
|
12476
|
+
activeRowIndex = max;
|
|
12477
|
+
},
|
|
12478
|
+
Home: () => {
|
|
12479
|
+
activeRowIndex = min;
|
|
12480
|
+
}
|
|
12481
|
+
};
|
|
12482
|
+
const Fn = KeyToFunction[key];
|
|
12483
|
+
if (!Fn) {
|
|
12484
|
+
return false;
|
|
12485
|
+
}
|
|
12486
|
+
Fn();
|
|
12487
|
+
actions.activeRowIndex = activeRowIndex;
|
|
12488
|
+
return true;
|
|
12489
|
+
}
|
|
12490
|
+
function handleCellNavigation(options) {
|
|
12491
|
+
const {
|
|
12492
|
+
api,
|
|
12493
|
+
key,
|
|
12494
|
+
shiftKey,
|
|
12495
|
+
getState,
|
|
12496
|
+
getComputed,
|
|
12497
|
+
getDataSourceState,
|
|
12498
|
+
actions
|
|
12499
|
+
} = options;
|
|
12500
|
+
const dataArray = getDataSourceState().dataArray;
|
|
12501
|
+
const state = getState();
|
|
12502
|
+
const { activeCellIndex, brain } = state;
|
|
12503
|
+
if (!activeCellIndex) {
|
|
12504
|
+
return false;
|
|
12505
|
+
}
|
|
12506
|
+
let [rowIndex, colIndex] = activeCellIndex;
|
|
12507
|
+
const {
|
|
12508
|
+
start: [startRow, startCol],
|
|
12509
|
+
end: [endRow, endCol]
|
|
12510
|
+
} = brain.getRenderRange();
|
|
12511
|
+
const renderRowCount = endRow - startRow - 1;
|
|
12512
|
+
const renderColCount = endCol - startCol - 1;
|
|
12513
|
+
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
12514
|
+
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
12515
|
+
const minRow = 0;
|
|
12516
|
+
const minCol = 0;
|
|
12517
|
+
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
12518
|
+
colIndex = clamp(colIndex, 0, maxCol);
|
|
12519
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
12520
|
+
const KeyToFunction = {
|
|
12521
|
+
ArrowDown: () => {
|
|
12522
|
+
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
12523
|
+
},
|
|
12524
|
+
ArrowUp: () => {
|
|
12525
|
+
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
12526
|
+
},
|
|
12527
|
+
ArrowLeft: () => {
|
|
12528
|
+
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
12529
|
+
},
|
|
12530
|
+
ArrowRight: () => {
|
|
12531
|
+
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
12532
|
+
},
|
|
12533
|
+
Enter: () => {
|
|
12534
|
+
const rowInfo = dataArray[rowIndex];
|
|
12535
|
+
if (rowInfo && rowInfo.isGroupRow) {
|
|
12536
|
+
return api.toggleGroupRow(rowInfo.groupKeys);
|
|
12537
|
+
}
|
|
12538
|
+
return false;
|
|
12539
|
+
},
|
|
12540
|
+
PageDown: () => {
|
|
12541
|
+
if (!shiftKey) {
|
|
12542
|
+
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
12543
|
+
} else {
|
|
12544
|
+
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
12545
|
+
}
|
|
12546
|
+
},
|
|
12547
|
+
PageUp: () => {
|
|
12548
|
+
if (!shiftKey) {
|
|
12549
|
+
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
12550
|
+
} else {
|
|
12551
|
+
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
12552
|
+
}
|
|
12553
|
+
},
|
|
12554
|
+
End: () => {
|
|
12555
|
+
if (!shiftKey) {
|
|
12556
|
+
rowIndex = maxRow;
|
|
12557
|
+
} else {
|
|
12558
|
+
colIndex = maxCol;
|
|
12559
|
+
}
|
|
12560
|
+
},
|
|
12561
|
+
Home: () => {
|
|
12562
|
+
if (!shiftKey) {
|
|
12563
|
+
rowIndex = minRow;
|
|
12564
|
+
} else {
|
|
12565
|
+
colIndex = minCol;
|
|
12566
|
+
}
|
|
12567
|
+
}
|
|
12568
|
+
};
|
|
12569
|
+
const Fn = KeyToFunction[key];
|
|
12570
|
+
if (!Fn) {
|
|
12571
|
+
return false;
|
|
12572
|
+
}
|
|
12573
|
+
Fn();
|
|
12574
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
12575
|
+
return true;
|
|
12576
|
+
}
|
|
12577
|
+
var validKeys = {
|
|
12578
|
+
ArrowUp: true,
|
|
12579
|
+
ArrowDown: true,
|
|
12580
|
+
ArrowLeft: true,
|
|
12581
|
+
ArrowRight: true,
|
|
12582
|
+
PageUp: true,
|
|
12583
|
+
PageDown: true,
|
|
12584
|
+
Home: true,
|
|
12585
|
+
End: true,
|
|
12586
|
+
Enter: true,
|
|
12587
|
+
" ": true
|
|
12588
|
+
};
|
|
12589
|
+
function handleKeyboardNavigation(options) {
|
|
12590
|
+
const { getState } = options;
|
|
12591
|
+
const state = getState();
|
|
12592
|
+
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
12593
|
+
if (!validKeys[options.key]) {
|
|
12594
|
+
return false;
|
|
12595
|
+
}
|
|
12596
|
+
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
12597
|
+
return handleRowNavigation(options);
|
|
12598
|
+
}
|
|
12599
|
+
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
12600
|
+
return handleCellNavigation(options);
|
|
12601
|
+
}
|
|
12602
|
+
return false;
|
|
12603
|
+
}
|
|
12604
|
+
|
|
12605
|
+
// src/components/InfiniteTable/eventHandlers/keyboardSelection.ts
|
|
12606
|
+
var validKeys2 = {
|
|
12607
|
+
Enter: true,
|
|
12608
|
+
" ": true,
|
|
12609
|
+
a: true
|
|
12610
|
+
};
|
|
12611
|
+
function handleKeyboardSelection(context) {
|
|
12612
|
+
const {
|
|
12613
|
+
getState,
|
|
12614
|
+
getDataSourceState,
|
|
12615
|
+
dataSourceActions,
|
|
12616
|
+
api: imperativeApi,
|
|
12617
|
+
key,
|
|
12618
|
+
ctrlKey,
|
|
12619
|
+
metaKey
|
|
12620
|
+
} = context;
|
|
12621
|
+
if (!validKeys2[key]) {
|
|
12622
|
+
return false;
|
|
12623
|
+
}
|
|
12624
|
+
const state = getState();
|
|
12625
|
+
const dataSourceState = getDataSourceState();
|
|
12626
|
+
const {
|
|
12627
|
+
activeRowIndex,
|
|
12628
|
+
activeCellIndex,
|
|
12629
|
+
keyboardNavigation,
|
|
12630
|
+
keyboardSelection
|
|
12631
|
+
} = state;
|
|
12632
|
+
const { selectionMode, groupBy, rowSelection } = dataSourceState;
|
|
12633
|
+
if (keyboardSelection === false) {
|
|
12634
|
+
return false;
|
|
12635
|
+
}
|
|
12636
|
+
const rowIndex = keyboardNavigation === "row" && activeRowIndex != null ? activeRowIndex : keyboardNavigation === "cell" && activeCellIndex != null ? activeCellIndex[0] : null;
|
|
12637
|
+
const rowInfo = rowIndex != null ? dataSourceState.dataArray[rowIndex] : null;
|
|
12638
|
+
if (!rowInfo || rowIndex == null) {
|
|
12639
|
+
return false;
|
|
12640
|
+
}
|
|
12641
|
+
if (selectionMode === "single-row" && key === " ") {
|
|
12642
|
+
imperativeApi.selectionApi.toggleRowSelection(rowInfo.id);
|
|
12643
|
+
return true;
|
|
12644
|
+
}
|
|
12645
|
+
if (selectionMode !== "multi-row") {
|
|
12646
|
+
return false;
|
|
12647
|
+
}
|
|
12648
|
+
if (key === "a" && (ctrlKey || metaKey)) {
|
|
12649
|
+
const rowSelectionState = new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12650
|
+
rowSelectionState.selectAll();
|
|
12651
|
+
dataSourceActions.rowSelection = rowSelectionState;
|
|
12652
|
+
return true;
|
|
12653
|
+
}
|
|
12654
|
+
if (key === " ") {
|
|
12655
|
+
if (groupBy.length) {
|
|
12656
|
+
if (rowInfo.isGroupRow) {
|
|
12657
|
+
imperativeApi.selectionApi.toggleGroupRowSelection(rowInfo.groupKeys);
|
|
12658
|
+
} else {
|
|
12659
|
+
imperativeApi.selectionApi.toggleRowSelection(rowInfo.id);
|
|
12660
|
+
}
|
|
12661
|
+
return true;
|
|
12662
|
+
} else {
|
|
12663
|
+
const event = __spreadValues({}, context);
|
|
12664
|
+
const { renderSelectionCheckBox } = context.getComputed();
|
|
12665
|
+
if (renderSelectionCheckBox) {
|
|
12666
|
+
event.shiftKey = false;
|
|
12667
|
+
event.metaKey = false;
|
|
12668
|
+
event.ctrlKey = true;
|
|
12669
|
+
}
|
|
12670
|
+
return updateRowSelectionOnCellClick(__spreadProps(__spreadValues({}, context), { rowIndex }), event);
|
|
12671
|
+
}
|
|
12672
|
+
}
|
|
12673
|
+
return false;
|
|
12674
|
+
}
|
|
12675
|
+
|
|
12676
|
+
// src/components/InfiniteTable/eventHandlers/onKeyDown.ts
|
|
12677
|
+
function onKeyDown(context, event) {
|
|
12678
|
+
const keyboardHandlerContext = __spreadProps(__spreadValues({}, context), {
|
|
12679
|
+
key: event.key,
|
|
12680
|
+
metaKey: event.metaKey,
|
|
12681
|
+
ctrlKey: event.ctrlKey,
|
|
12682
|
+
shiftKey: event.shiftKey
|
|
12683
|
+
});
|
|
12684
|
+
if (handleKeyboardSelection(keyboardHandlerContext)) {
|
|
12685
|
+
event.preventDefault();
|
|
12686
|
+
}
|
|
12687
|
+
if (handleKeyboardNavigation(keyboardHandlerContext)) {
|
|
12688
|
+
event.preventDefault();
|
|
12689
|
+
}
|
|
12690
|
+
}
|
|
12691
|
+
|
|
12692
|
+
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
12693
|
+
function useEventHandlersContext() {
|
|
12694
|
+
const {
|
|
12695
|
+
getState,
|
|
12696
|
+
componentActions: actions,
|
|
12697
|
+
imperativeApi,
|
|
12698
|
+
getComputed
|
|
12699
|
+
} = useInfiniteTable();
|
|
12700
|
+
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
12701
|
+
const context = useMemo12(() => {
|
|
12702
|
+
const context2 = {
|
|
12703
|
+
getComputed,
|
|
12704
|
+
api: imperativeApi,
|
|
12705
|
+
getState,
|
|
12706
|
+
actions,
|
|
12707
|
+
getDataSourceState,
|
|
12708
|
+
dataSourceActions
|
|
12709
|
+
};
|
|
12710
|
+
return context2;
|
|
12711
|
+
}, [getState, actions, getDataSourceState, dataSourceActions]);
|
|
12712
|
+
return context;
|
|
12713
|
+
}
|
|
12714
|
+
function handleDOMEvents() {
|
|
12715
|
+
const context = useEventHandlersContext();
|
|
12716
|
+
useEffect29(() => {
|
|
12717
|
+
const removeOnKeyDown = context.getState().keyDown.onChange((event) => {
|
|
12718
|
+
onKeyDown(__spreadProps(__spreadValues({}, context), {
|
|
12719
|
+
key: event.key,
|
|
12720
|
+
metaKey: event.metaKey,
|
|
12721
|
+
ctrlKey: event.ctrlKey,
|
|
12722
|
+
shiftKey: event.shiftKey,
|
|
12723
|
+
preventDefault: () => event.preventDefault()
|
|
12724
|
+
}), event);
|
|
12725
|
+
});
|
|
12726
|
+
function cellClickHandler(cellClickParam) {
|
|
12727
|
+
if (!cellClickParam) {
|
|
12728
|
+
return;
|
|
12729
|
+
}
|
|
12730
|
+
const event = cellClickParam.event;
|
|
12731
|
+
const virtualEvent = {
|
|
12732
|
+
metaKey: event.metaKey,
|
|
12733
|
+
ctrlKey: event.ctrlKey,
|
|
12734
|
+
shiftKey: event.shiftKey,
|
|
12735
|
+
key: "",
|
|
12736
|
+
preventDefault: () => event.preventDefault()
|
|
12737
|
+
};
|
|
12738
|
+
onCellClick(__spreadValues(__spreadProps(__spreadValues({}, context), {
|
|
12739
|
+
rowIndex: cellClickParam.rowIndex,
|
|
12740
|
+
colIndex: cellClickParam.colIndex
|
|
12741
|
+
}), virtualEvent), virtualEvent);
|
|
12742
|
+
}
|
|
12743
|
+
const removeOnCellClick = context.getState().cellClick.onChange(cellClickHandler);
|
|
12744
|
+
return () => {
|
|
12745
|
+
removeOnKeyDown();
|
|
12746
|
+
removeOnCellClick();
|
|
12747
|
+
};
|
|
12748
|
+
}, []);
|
|
12749
|
+
}
|
|
12750
|
+
function subscribeToDOMEvents() {
|
|
12751
|
+
const { getState } = useInfiniteTable();
|
|
12752
|
+
const onKeyDown2 = useCallback18((event) => {
|
|
12753
|
+
getState().keyDown(event);
|
|
12754
|
+
}, []);
|
|
12755
|
+
return { onKeyDown: onKeyDown2 };
|
|
12756
|
+
}
|
|
12757
|
+
function useDOMEventHandlers() {
|
|
12758
|
+
handleDOMEvents();
|
|
12759
|
+
return subscribeToDOMEvents();
|
|
12760
|
+
}
|
|
12761
|
+
|
|
12218
12762
|
// src/components/InfiniteTable/index.tsx
|
|
12219
12763
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
12220
12764
|
var HOVERED_CLASS_NAMES = [RowHoverCls, "InfiniteColumnCell--hovered"];
|
|
@@ -12232,14 +12776,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
12232
12776
|
});
|
|
12233
12777
|
var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
12234
12778
|
var _a;
|
|
12235
|
-
const {
|
|
12236
|
-
componentState,
|
|
12237
|
-
getComputed,
|
|
12238
|
-
computed,
|
|
12239
|
-
componentActions: actions,
|
|
12240
|
-
getState,
|
|
12241
|
-
imperativeApi
|
|
12242
|
-
} = useInfiniteTable();
|
|
12779
|
+
const { componentState, getComputed, computed, imperativeApi } = useInfiniteTable();
|
|
12243
12780
|
const {
|
|
12244
12781
|
componentState: { loading, dataArray },
|
|
12245
12782
|
getState: getDataSourceState,
|
|
@@ -12268,7 +12805,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
12268
12805
|
} = componentState;
|
|
12269
12806
|
useScrollToActiveRow(activeRowIndex, dataArray.length, imperativeApi);
|
|
12270
12807
|
useScrollToActiveCell(activeCellIndex, dataArray.length, imperativeApi);
|
|
12271
|
-
|
|
12808
|
+
const { onKeyDown: onKeyDown2 } = useDOMEventHandlers();
|
|
12272
12809
|
const { bodySize } = componentState;
|
|
12273
12810
|
const { scrollbars } = computed;
|
|
12274
12811
|
const { renderCell } = useCellRendering({
|
|
@@ -12296,22 +12833,8 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
12296
12833
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
12297
12834
|
}, [scrollStopDelay]);
|
|
12298
12835
|
useAutoSizeColumns();
|
|
12299
|
-
const onKeyDown = useCallback18((event) => {
|
|
12300
|
-
getState().keyDown(event);
|
|
12301
|
-
if (handleKeyboardNavigation({
|
|
12302
|
-
getState,
|
|
12303
|
-
actions,
|
|
12304
|
-
getDataSourceState,
|
|
12305
|
-
getComputed,
|
|
12306
|
-
imperativeApi,
|
|
12307
|
-
key: event.key,
|
|
12308
|
-
shiftKey: !!event.shiftKey
|
|
12309
|
-
})) {
|
|
12310
|
-
event.preventDefault();
|
|
12311
|
-
}
|
|
12312
|
-
}, []);
|
|
12313
12836
|
return /* @__PURE__ */ createElement35("div", __spreadValues({
|
|
12314
|
-
onKeyDown,
|
|
12837
|
+
onKeyDown: onKeyDown2,
|
|
12315
12838
|
ref: domRef
|
|
12316
12839
|
}, domProps), header ? /* @__PURE__ */ createElement35(TableHeaderWrapper, {
|
|
12317
12840
|
bodyBrain: brain,
|
|
@@ -12358,8 +12881,14 @@ function InfiniteTableContextProvider() {
|
|
|
12358
12881
|
globalThis.getComputed = getComputed;
|
|
12359
12882
|
}
|
|
12360
12883
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
12361
|
-
const [imperativeApi] =
|
|
12362
|
-
return getImperativeApi(
|
|
12884
|
+
const [imperativeApi] = useState15(() => {
|
|
12885
|
+
return getImperativeApi({
|
|
12886
|
+
getComputed,
|
|
12887
|
+
getState,
|
|
12888
|
+
getDataSourceState,
|
|
12889
|
+
componentActions,
|
|
12890
|
+
dataSourceActions
|
|
12891
|
+
});
|
|
12363
12892
|
});
|
|
12364
12893
|
const contextValue = {
|
|
12365
12894
|
componentActions,
|