@infinite-table/infinite-react 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +91 -57
- package/index.esm.js +456 -294
- package/index.js +486 -325
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -53,26 +53,6 @@ var __reExport = (target, module2, desc) => {
|
|
|
53
53
|
var __toModule = (module2) => {
|
|
54
54
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
55
55
|
};
|
|
56
|
-
var __async = (__this, __arguments, generator) => {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
var fulfilled = (value) => {
|
|
59
|
-
try {
|
|
60
|
-
step(generator.next(value));
|
|
61
|
-
} catch (e) {
|
|
62
|
-
reject(e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var rejected = (value) => {
|
|
66
|
-
try {
|
|
67
|
-
step(generator.throw(value));
|
|
68
|
-
} catch (e) {
|
|
69
|
-
reject(e);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
73
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
56
|
|
|
77
57
|
// node_modules/ms/index.js
|
|
78
58
|
var require_ms = __commonJS({
|
|
@@ -685,6 +665,7 @@ __export(exports, {
|
|
|
685
665
|
getComponentStateRoot: () => getComponentStateRoot,
|
|
686
666
|
group: () => group,
|
|
687
667
|
interceptMap: () => interceptMap,
|
|
668
|
+
multisort: () => multisort,
|
|
688
669
|
useComponentState: () => useComponentState,
|
|
689
670
|
useDataSource: () => useDataSource
|
|
690
671
|
});
|
|
@@ -772,7 +753,7 @@ var ScrollListener = class {
|
|
|
772
753
|
|
|
773
754
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
774
755
|
function computeColumnGroupsDepths(columnGroups) {
|
|
775
|
-
const
|
|
756
|
+
const map2 = new Map();
|
|
776
757
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
777
758
|
let parentGroupId = colGroup.columnGroup;
|
|
778
759
|
let depth = 0;
|
|
@@ -787,9 +768,9 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
787
768
|
depth++;
|
|
788
769
|
parentGroupId = parent.columnGroup;
|
|
789
770
|
}
|
|
790
|
-
|
|
771
|
+
map2.set(colGroupId, depth);
|
|
791
772
|
});
|
|
792
|
-
return
|
|
773
|
+
return map2;
|
|
793
774
|
}
|
|
794
775
|
|
|
795
776
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
@@ -802,6 +783,9 @@ function toMap(mapOrObject) {
|
|
|
802
783
|
}
|
|
803
784
|
return new Map(Object.entries(mapOrObject));
|
|
804
785
|
}
|
|
786
|
+
function toColumnTypesMap(mapOrObject) {
|
|
787
|
+
return toMap(mapOrObject);
|
|
788
|
+
}
|
|
805
789
|
function initSetupState() {
|
|
806
790
|
const columnsGeneratedForGrouping = new Map();
|
|
807
791
|
return {
|
|
@@ -835,6 +819,7 @@ var forwardProps = () => {
|
|
|
835
819
|
var _a;
|
|
836
820
|
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
837
821
|
},
|
|
822
|
+
scrollTopId: 1,
|
|
838
823
|
components: 1,
|
|
839
824
|
loadingText: 1,
|
|
840
825
|
pivotColumns: 1,
|
|
@@ -860,6 +845,7 @@ var forwardProps = () => {
|
|
|
860
845
|
pivotColumn: 1,
|
|
861
846
|
pivotRowLabelsColumn: 1,
|
|
862
847
|
pivotColumnGroups: 1,
|
|
848
|
+
onScrollbarsChange: 1,
|
|
863
849
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
864
850
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
865
851
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
@@ -885,7 +871,7 @@ var forwardProps = () => {
|
|
|
885
871
|
},
|
|
886
872
|
columnTypes: (columnTypes) => {
|
|
887
873
|
var _a;
|
|
888
|
-
return (_a =
|
|
874
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
889
875
|
},
|
|
890
876
|
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
891
877
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
@@ -1520,28 +1506,28 @@ var useRerender = () => {
|
|
|
1520
1506
|
|
|
1521
1507
|
// src/components/hooks/useInterceptedMap.ts
|
|
1522
1508
|
var import_react6 = __toModule(require("react"));
|
|
1523
|
-
function interceptMap(
|
|
1524
|
-
const { set, delete: deleteKey, clear } =
|
|
1509
|
+
function interceptMap(map2, fns) {
|
|
1510
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1525
1511
|
if (fns.set) {
|
|
1526
|
-
|
|
1527
|
-
set.call(
|
|
1512
|
+
map2.set = (key, value) => {
|
|
1513
|
+
set.call(map2, key, value);
|
|
1528
1514
|
fns.set(key, value);
|
|
1529
|
-
return
|
|
1515
|
+
return map2;
|
|
1530
1516
|
};
|
|
1531
1517
|
}
|
|
1532
1518
|
if (fns.delete) {
|
|
1533
|
-
|
|
1534
|
-
const removed = deleteKey.call(
|
|
1519
|
+
map2.delete = (key) => {
|
|
1520
|
+
const removed = deleteKey.call(map2, key);
|
|
1535
1521
|
fns.delete(key);
|
|
1536
1522
|
return removed;
|
|
1537
1523
|
};
|
|
1538
1524
|
}
|
|
1539
1525
|
if (fns.clear || fns.beforeClear) {
|
|
1540
|
-
|
|
1526
|
+
map2.clear = () => {
|
|
1541
1527
|
if (fns.beforeClear) {
|
|
1542
|
-
fns.beforeClear(
|
|
1528
|
+
fns.beforeClear(map2);
|
|
1543
1529
|
}
|
|
1544
|
-
const result = clear.call(
|
|
1530
|
+
const result = clear.call(map2);
|
|
1545
1531
|
if (fns.clear) {
|
|
1546
1532
|
fns.clear();
|
|
1547
1533
|
}
|
|
@@ -1550,13 +1536,13 @@ function interceptMap(map, fns) {
|
|
|
1550
1536
|
}
|
|
1551
1537
|
return () => {
|
|
1552
1538
|
if (set) {
|
|
1553
|
-
|
|
1539
|
+
map2.set = set;
|
|
1554
1540
|
}
|
|
1555
1541
|
if (deleteKey) {
|
|
1556
|
-
|
|
1542
|
+
map2.delete = deleteKey;
|
|
1557
1543
|
}
|
|
1558
1544
|
if (clear) {
|
|
1559
|
-
|
|
1545
|
+
map2.clear = clear;
|
|
1560
1546
|
}
|
|
1561
1547
|
};
|
|
1562
1548
|
}
|
|
@@ -1576,16 +1562,16 @@ var rafFn = (fn) => {
|
|
|
1576
1562
|
};
|
|
1577
1563
|
|
|
1578
1564
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1579
|
-
var useRerenderOnKeyChange = (
|
|
1565
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1580
1566
|
const [renderId, rerender] = useRerender();
|
|
1581
1567
|
(0, import_react7.useEffect)(() => {
|
|
1582
1568
|
const update = rafFn(rerender);
|
|
1583
|
-
return interceptMap(
|
|
1569
|
+
return interceptMap(map2, {
|
|
1584
1570
|
set: update,
|
|
1585
1571
|
clear: update,
|
|
1586
1572
|
delete: update
|
|
1587
1573
|
});
|
|
1588
|
-
}, [
|
|
1574
|
+
}, [map2]);
|
|
1589
1575
|
return renderId;
|
|
1590
1576
|
};
|
|
1591
1577
|
|
|
@@ -1699,7 +1685,7 @@ var useComputedVisibleColumns = ({
|
|
|
1699
1685
|
var sortAscending = (a, b) => a - b;
|
|
1700
1686
|
|
|
1701
1687
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1702
|
-
var
|
|
1688
|
+
var import_react20 = __toModule(require("react"));
|
|
1703
1689
|
|
|
1704
1690
|
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1705
1691
|
var import_react12 = __toModule(require("react"));
|
|
@@ -1807,7 +1793,7 @@ function getComponentStateContext() {
|
|
|
1807
1793
|
}
|
|
1808
1794
|
return ComponentContext = (0, import_react11.createContext)(null);
|
|
1809
1795
|
}
|
|
1810
|
-
function
|
|
1796
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1811
1797
|
const state = getState();
|
|
1812
1798
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1813
1799
|
const key = stateKey;
|
|
@@ -1819,6 +1805,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1819
1805
|
return;
|
|
1820
1806
|
}
|
|
1821
1807
|
notifyChange(props, stateKey, value);
|
|
1808
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1809
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1810
|
+
}
|
|
1822
1811
|
const forwardFn = propsToForward[key];
|
|
1823
1812
|
if (typeof forwardFn === "function") {
|
|
1824
1813
|
value = forwardFn(value);
|
|
@@ -1931,7 +1920,7 @@ function getComponentStateRoot(config) {
|
|
|
1931
1920
|
const getComponentState = useLatest(state);
|
|
1932
1921
|
const { allowedControlledPropOverrides } = config;
|
|
1933
1922
|
const actions = (0, import_react11.useMemo)(() => {
|
|
1934
|
-
const generatedActions =
|
|
1923
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1935
1924
|
return generatedActions;
|
|
1936
1925
|
}, [
|
|
1937
1926
|
dispatch,
|
|
@@ -2098,7 +2087,7 @@ function useColumnGroups() {
|
|
|
2098
2087
|
}
|
|
2099
2088
|
|
|
2100
2089
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2101
|
-
var
|
|
2090
|
+
var import_react19 = __toModule(require("react"));
|
|
2102
2091
|
|
|
2103
2092
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2104
2093
|
var React7 = __toModule(require("react"));
|
|
@@ -2347,67 +2336,236 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2347
2336
|
}
|
|
2348
2337
|
|
|
2349
2338
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2350
|
-
var
|
|
2339
|
+
var import_react18 = __toModule(require("react"));
|
|
2351
2340
|
|
|
2352
2341
|
// src/components/DataSource/index.tsx
|
|
2353
2342
|
var React9 = __toModule(require("react"));
|
|
2354
2343
|
|
|
2355
|
-
// src/
|
|
2356
|
-
var
|
|
2344
|
+
// src/utils/multisort/sortTypes.ts
|
|
2345
|
+
var numberComparator = function(first, second) {
|
|
2346
|
+
return first - second;
|
|
2347
|
+
};
|
|
2348
|
+
var stringComparator = function(first, second) {
|
|
2349
|
+
first = `${first}`;
|
|
2350
|
+
second = `${second}`;
|
|
2351
|
+
return first.localeCompare(second);
|
|
2352
|
+
};
|
|
2353
|
+
var sortTypes = {
|
|
2354
|
+
number: numberComparator,
|
|
2355
|
+
string: stringComparator
|
|
2356
|
+
};
|
|
2357
|
+
var sortTypes_default = sortTypes;
|
|
2357
2358
|
|
|
2358
|
-
// src/
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2359
|
+
// src/utils/multisort/index.ts
|
|
2360
|
+
var multisort = (sortInfo, array, get) => {
|
|
2361
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2362
|
+
return array;
|
|
2363
|
+
};
|
|
2364
|
+
multisort.knownTypes = sortTypes_default;
|
|
2365
|
+
var getSingleSortFunction = (info) => {
|
|
2366
|
+
if (!info) {
|
|
2367
|
+
return;
|
|
2365
2368
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2369
|
+
const field = info.field;
|
|
2370
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2371
|
+
if (!dir) {
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
let fn = info.fn;
|
|
2375
|
+
if (!fn && info.type) {
|
|
2376
|
+
fn = multisort.knownTypes[info.type];
|
|
2377
|
+
if (!fn) {
|
|
2378
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
if (!fn) {
|
|
2382
|
+
fn = sortTypes_default.string;
|
|
2383
|
+
}
|
|
2384
|
+
return (first, second) => {
|
|
2385
|
+
const a = field ? first[field] : first;
|
|
2386
|
+
const b = field ? second[field] : second;
|
|
2387
|
+
return dir * fn(a, b);
|
|
2368
2388
|
};
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2389
|
+
};
|
|
2390
|
+
var getSortFunctions = (sortInfo) => {
|
|
2391
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2392
|
+
};
|
|
2393
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2394
|
+
const fns = getSortFunctions(sortInfo);
|
|
2395
|
+
return (first, second) => {
|
|
2396
|
+
if (get) {
|
|
2397
|
+
first = get(first);
|
|
2398
|
+
second = get(second);
|
|
2376
2399
|
}
|
|
2377
|
-
|
|
2378
|
-
|
|
2400
|
+
let result = 0;
|
|
2401
|
+
let i = 0;
|
|
2402
|
+
let fn;
|
|
2403
|
+
const len = fns.length;
|
|
2404
|
+
for (; i < len; i++) {
|
|
2405
|
+
fn = fns[i];
|
|
2406
|
+
if (!fn) {
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
result = fn(first, second);
|
|
2410
|
+
if (result !== 0) {
|
|
2411
|
+
return result;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
return result;
|
|
2415
|
+
};
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2418
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2419
|
+
var import_react16 = __toModule(require("react"));
|
|
2420
|
+
|
|
2421
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2422
|
+
var import_react15 = __toModule(require("react"));
|
|
2423
|
+
function useEffectWithChanges(fn, deps) {
|
|
2424
|
+
const prevRef = (0, import_react15.useRef)({});
|
|
2425
|
+
const oldValuesRef = (0, import_react15.useRef)({});
|
|
2426
|
+
const oldValues = oldValuesRef.current;
|
|
2427
|
+
const changesRef = (0, import_react15.useRef)({});
|
|
2428
|
+
const changes = changesRef.current;
|
|
2429
|
+
const useEffectDeps = [];
|
|
2430
|
+
for (let k in deps) {
|
|
2431
|
+
if (deps.hasOwnProperty(k)) {
|
|
2432
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2433
|
+
changes[k] = deps[k];
|
|
2434
|
+
oldValues[k] = prevRef.current[k];
|
|
2435
|
+
}
|
|
2436
|
+
useEffectDeps.push(deps[k]);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
prevRef.current = deps;
|
|
2440
|
+
(0, import_react15.useEffect)(() => {
|
|
2441
|
+
const changes2 = changesRef.current;
|
|
2442
|
+
const result = fn(changes2, oldValues);
|
|
2443
|
+
changesRef.current = {};
|
|
2444
|
+
oldValuesRef.current = {};
|
|
2445
|
+
return result;
|
|
2446
|
+
}, useEffectDeps);
|
|
2379
2447
|
}
|
|
2380
2448
|
|
|
2381
2449
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2382
|
-
function
|
|
2383
|
-
|
|
2450
|
+
function buildDataSourceDataParams(componentState) {
|
|
2451
|
+
var _a, _b;
|
|
2452
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2453
|
+
const dataSourceParams = {
|
|
2454
|
+
originalDataArray: componentState.originalDataArray,
|
|
2455
|
+
sortInfo,
|
|
2456
|
+
groupRowsBy: componentState.groupRowsBy,
|
|
2457
|
+
pivotBy: componentState.pivotBy
|
|
2458
|
+
};
|
|
2459
|
+
if (componentState.livePagination !== void 0) {
|
|
2460
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2461
|
+
}
|
|
2462
|
+
return dataSourceParams;
|
|
2463
|
+
}
|
|
2464
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2465
|
+
var _a;
|
|
2466
|
+
if (typeof componentState.data === "function") {
|
|
2467
|
+
loadData(componentState.data, componentState, actions);
|
|
2468
|
+
}
|
|
2469
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2470
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2471
|
+
}
|
|
2472
|
+
function loadData(data, componentState, actions) {
|
|
2473
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2474
|
+
if (typeof data === "function") {
|
|
2475
|
+
data = data(dataParams);
|
|
2476
|
+
}
|
|
2477
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2478
|
+
if (dataIsPromise) {
|
|
2479
|
+
actions.loading = true;
|
|
2480
|
+
}
|
|
2481
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2482
|
+
let dataArray = [];
|
|
2483
|
+
if (Array.isArray(dataParam.data)) {
|
|
2484
|
+
const remoteData = dataParam;
|
|
2485
|
+
dataArray = remoteData.data;
|
|
2486
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2487
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2488
|
+
}
|
|
2489
|
+
} else {
|
|
2490
|
+
dataArray = dataParam;
|
|
2491
|
+
}
|
|
2492
|
+
actions.originalDataArray = dataArray;
|
|
2493
|
+
if (dataIsPromise) {
|
|
2494
|
+
actions.loading = false;
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2384
2497
|
}
|
|
2385
2498
|
function useLoadData() {
|
|
2386
2499
|
const {
|
|
2500
|
+
getComponentState,
|
|
2387
2501
|
componentActions: actions,
|
|
2388
2502
|
componentState: { data }
|
|
2389
2503
|
} = useComponentState();
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
originalDataArray: []
|
|
2393
|
-
};
|
|
2394
|
-
if (typeof data2 === "function") {
|
|
2395
|
-
data2 = data2();
|
|
2396
|
-
}
|
|
2397
|
-
if (Array.isArray(data2)) {
|
|
2398
|
-
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2399
|
-
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2400
|
-
} else {
|
|
2401
|
-
actions.loading = true;
|
|
2402
|
-
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2403
|
-
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2404
|
-
actions.loading = false;
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
};
|
|
2408
|
-
(0, import_react15.useLayoutEffect)(() => {
|
|
2409
|
-
loadData(data);
|
|
2504
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
2505
|
+
loadData(data, getComponentState(), actions);
|
|
2410
2506
|
}, [data]);
|
|
2507
|
+
useLivePagination();
|
|
2508
|
+
}
|
|
2509
|
+
function useLivePagination() {
|
|
2510
|
+
const {
|
|
2511
|
+
getComponentState,
|
|
2512
|
+
componentActions: actions,
|
|
2513
|
+
componentState
|
|
2514
|
+
} = useComponentState();
|
|
2515
|
+
const {
|
|
2516
|
+
notifyScrollbarsChange,
|
|
2517
|
+
sortInfo,
|
|
2518
|
+
groupRowsBy,
|
|
2519
|
+
pivotBy,
|
|
2520
|
+
livePaginationCursor,
|
|
2521
|
+
scrollBottomId
|
|
2522
|
+
} = componentState;
|
|
2523
|
+
const [scrollbars, setScrollbars] = (0, import_react16.useState)({
|
|
2524
|
+
vertical: false,
|
|
2525
|
+
horizontal: false
|
|
2526
|
+
});
|
|
2527
|
+
const scrollbarsRef = (0, import_react16.useRef)(scrollbars);
|
|
2528
|
+
(0, import_react16.useEffect)(() => {
|
|
2529
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2530
|
+
if (!scrollbars2) {
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2533
|
+
scrollbarsRef.current = scrollbars2;
|
|
2534
|
+
setScrollbars(scrollbars2);
|
|
2535
|
+
});
|
|
2536
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2537
|
+
}, [notifyScrollbarsChange]);
|
|
2538
|
+
const [cursorId, updateCursorId] = (0, import_react16.useState)(void 0);
|
|
2539
|
+
(0, import_react16.useEffect)(() => {
|
|
2540
|
+
const frameId = requestAnimationFrame(() => {
|
|
2541
|
+
var _a;
|
|
2542
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2543
|
+
updateCursorId(livePaginationCursor);
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
return () => cancelAnimationFrame(frameId);
|
|
2547
|
+
}, [livePaginationCursor]);
|
|
2548
|
+
(0, import_react16.useEffect)(() => {
|
|
2549
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2550
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2551
|
+
updateCursorId(livePaginationCursor2);
|
|
2552
|
+
}
|
|
2553
|
+
}, [scrollbars.vertical]);
|
|
2554
|
+
(0, import_react16.useEffect)(() => {
|
|
2555
|
+
updateCursorId(scrollBottomId);
|
|
2556
|
+
}, [scrollBottomId]);
|
|
2557
|
+
const depsObject = {
|
|
2558
|
+
sortInfo,
|
|
2559
|
+
groupRowsBy,
|
|
2560
|
+
pivotBy,
|
|
2561
|
+
cursorId
|
|
2562
|
+
};
|
|
2563
|
+
useEffectWithChanges(() => {
|
|
2564
|
+
if (cursorId === void 0) {
|
|
2565
|
+
return;
|
|
2566
|
+
}
|
|
2567
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2568
|
+
}, depsObject);
|
|
2411
2569
|
}
|
|
2412
2570
|
|
|
2413
2571
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2417,7 +2575,7 @@ var normalizeSortInfo = (sortInfo) => {
|
|
|
2417
2575
|
};
|
|
2418
2576
|
|
|
2419
2577
|
// src/components/hooks/useOnce.ts
|
|
2420
|
-
var
|
|
2578
|
+
var import_react17 = __toModule(require("react"));
|
|
2421
2579
|
function once(fn) {
|
|
2422
2580
|
let called = false;
|
|
2423
2581
|
let result = null;
|
|
@@ -2432,7 +2590,7 @@ function once(fn) {
|
|
|
2432
2590
|
return onceFn;
|
|
2433
2591
|
}
|
|
2434
2592
|
function useOnce(fn) {
|
|
2435
|
-
const onceFn = (0,
|
|
2593
|
+
const onceFn = (0, import_react17.useMemo)(() => {
|
|
2436
2594
|
return once(fn);
|
|
2437
2595
|
}, []);
|
|
2438
2596
|
return onceFn();
|
|
@@ -2461,9 +2619,9 @@ var DeepMap = class {
|
|
|
2461
2619
|
if (!pair) {
|
|
2462
2620
|
return;
|
|
2463
2621
|
}
|
|
2464
|
-
const { map } = pair;
|
|
2622
|
+
const { map: map2 } = pair;
|
|
2465
2623
|
const keys = [...parentKeys, key];
|
|
2466
|
-
const next =
|
|
2624
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2467
2625
|
if (pair.hasOwnProperty("value")) {
|
|
2468
2626
|
fn(pair.value, keys, i, next);
|
|
2469
2627
|
i++;
|
|
@@ -2529,14 +2687,14 @@ var DeepMap = class {
|
|
|
2529
2687
|
return this.length;
|
|
2530
2688
|
}
|
|
2531
2689
|
clear() {
|
|
2532
|
-
const clearMap = (
|
|
2533
|
-
|
|
2534
|
-
const { map:
|
|
2535
|
-
if (
|
|
2536
|
-
clearMap(
|
|
2690
|
+
const clearMap = (map2) => {
|
|
2691
|
+
map2.forEach((value, _key) => {
|
|
2692
|
+
const { map: map3 } = value;
|
|
2693
|
+
if (map3) {
|
|
2694
|
+
clearMap(map3);
|
|
2537
2695
|
}
|
|
2538
2696
|
});
|
|
2539
|
-
|
|
2697
|
+
map2.clear();
|
|
2540
2698
|
};
|
|
2541
2699
|
clearMap(this.map);
|
|
2542
2700
|
this.length = 0;
|
|
@@ -2581,9 +2739,9 @@ var DeepMap = class {
|
|
|
2581
2739
|
}
|
|
2582
2740
|
}
|
|
2583
2741
|
while (maps.length) {
|
|
2584
|
-
let
|
|
2742
|
+
let map2 = maps.pop();
|
|
2585
2743
|
let key = keys.pop();
|
|
2586
|
-
if (key && (
|
|
2744
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2587
2745
|
let parentMap = maps[maps.length - 1];
|
|
2588
2746
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2589
2747
|
if (pair) {
|
|
@@ -2622,12 +2780,12 @@ var DeepMap = class {
|
|
|
2622
2780
|
if (!pair) {
|
|
2623
2781
|
return;
|
|
2624
2782
|
}
|
|
2625
|
-
const { map } = pair;
|
|
2783
|
+
const { map: map2 } = pair;
|
|
2626
2784
|
const keys = [...parentKeys, key];
|
|
2627
2785
|
const next = once(() => {
|
|
2628
|
-
if (
|
|
2629
|
-
|
|
2630
|
-
this.visitKey(k,
|
|
2786
|
+
if (map2) {
|
|
2787
|
+
map2.forEach((_, k) => {
|
|
2788
|
+
this.visitKey(k, map2, keys, fn);
|
|
2631
2789
|
});
|
|
2632
2790
|
}
|
|
2633
2791
|
});
|
|
@@ -2793,14 +2951,68 @@ var GroupRowsState = class {
|
|
|
2793
2951
|
}
|
|
2794
2952
|
};
|
|
2795
2953
|
|
|
2954
|
+
// src/utils/shallowEqualObjects.ts
|
|
2955
|
+
function shallowEqualObjects(objA, objB) {
|
|
2956
|
+
if (objA === objB) {
|
|
2957
|
+
return true;
|
|
2958
|
+
}
|
|
2959
|
+
if (!objA || !objB) {
|
|
2960
|
+
return false;
|
|
2961
|
+
}
|
|
2962
|
+
var aKeys = Object.keys(objA);
|
|
2963
|
+
var bKeys = Object.keys(objB);
|
|
2964
|
+
var len = aKeys.length;
|
|
2965
|
+
if (bKeys.length !== len) {
|
|
2966
|
+
return false;
|
|
2967
|
+
}
|
|
2968
|
+
for (var i = 0; i < len; i++) {
|
|
2969
|
+
var key = aKeys[i];
|
|
2970
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2971
|
+
return false;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
return true;
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2978
|
+
var map = new WeakMap();
|
|
2979
|
+
var getCompareDefault = (a) => a;
|
|
2980
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2981
|
+
map.set(fn, {
|
|
2982
|
+
lastCallTime: 0,
|
|
2983
|
+
lastCallArg: null
|
|
2984
|
+
});
|
|
2985
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2986
|
+
return (arg) => {
|
|
2987
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2988
|
+
lastCallTime: 0,
|
|
2989
|
+
lastCallArg: null
|
|
2990
|
+
};
|
|
2991
|
+
const now = Date.now();
|
|
2992
|
+
const diff = now - lastCallTime;
|
|
2993
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2994
|
+
if (diff < timeframe && objectsEqual) {
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
2997
|
+
map.set(fn, {
|
|
2998
|
+
lastCallTime: now,
|
|
2999
|
+
lastCallArg: arg
|
|
3000
|
+
});
|
|
3001
|
+
fn(arg);
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
|
|
2796
3005
|
// src/components/DataSource/state/getInitialState.ts
|
|
2797
3006
|
function initSetupState2() {
|
|
2798
3007
|
const now = Date.now();
|
|
2799
3008
|
const originalDataArray = [];
|
|
2800
3009
|
const dataArray = [];
|
|
2801
3010
|
return {
|
|
3011
|
+
dataParams: void 0,
|
|
3012
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2802
3013
|
pivotTotalColumnPosition: "end",
|
|
2803
3014
|
originalDataArray,
|
|
3015
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2804
3016
|
pivotColumns: void 0,
|
|
2805
3017
|
pivotColumnGroups: void 0,
|
|
2806
3018
|
dataArray,
|
|
@@ -2817,12 +3029,20 @@ function initSetupState2() {
|
|
|
2817
3029
|
lastGroupDataArray: void 0
|
|
2818
3030
|
};
|
|
2819
3031
|
}
|
|
3032
|
+
function getCompareObject(dataParams) {
|
|
3033
|
+
const obj = __spreadValues({}, dataParams);
|
|
3034
|
+
delete obj.originalDataArray;
|
|
3035
|
+
return obj;
|
|
3036
|
+
}
|
|
2820
3037
|
var forwardProps3 = () => {
|
|
2821
3038
|
return {
|
|
3039
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2822
3040
|
remoteCount: 1,
|
|
2823
3041
|
data: 1,
|
|
2824
3042
|
pivotBy: 1,
|
|
2825
3043
|
primaryKey: 1,
|
|
3044
|
+
livePagination: 1,
|
|
3045
|
+
livePaginationCursor: 1,
|
|
2826
3046
|
loading: (loading) => loading != null ? loading : false,
|
|
2827
3047
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2828
3048
|
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
@@ -2835,10 +3055,20 @@ var forwardProps3 = () => {
|
|
|
2835
3055
|
};
|
|
2836
3056
|
};
|
|
2837
3057
|
function mapPropsToState2(params) {
|
|
2838
|
-
var _a;
|
|
2839
3058
|
const { props } = params;
|
|
3059
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2840
3060
|
return {
|
|
2841
|
-
|
|
3061
|
+
controlledSort,
|
|
3062
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
function getInterceptActions() {
|
|
3066
|
+
return {
|
|
3067
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3068
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3069
|
+
dataParams.sortInfo = sortInfo;
|
|
3070
|
+
actions.dataParams = dataParams;
|
|
3071
|
+
}
|
|
2842
3072
|
};
|
|
2843
3073
|
}
|
|
2844
3074
|
|
|
@@ -3072,80 +3302,6 @@ function enhancedFlatten(param) {
|
|
|
3072
3302
|
};
|
|
3073
3303
|
}
|
|
3074
3304
|
|
|
3075
|
-
// src/utils/multisort/sortTypes.ts
|
|
3076
|
-
var numberComparator = function(first, second) {
|
|
3077
|
-
return first - second;
|
|
3078
|
-
};
|
|
3079
|
-
var stringComparator = function(first, second) {
|
|
3080
|
-
first = `${first}`;
|
|
3081
|
-
second = `${second}`;
|
|
3082
|
-
return first.localeCompare(second);
|
|
3083
|
-
};
|
|
3084
|
-
var sortTypes = {
|
|
3085
|
-
number: numberComparator,
|
|
3086
|
-
string: stringComparator
|
|
3087
|
-
};
|
|
3088
|
-
var sortTypes_default = sortTypes;
|
|
3089
|
-
|
|
3090
|
-
// src/utils/multisort/index.ts
|
|
3091
|
-
var multisort = (sortInfo, array, get) => {
|
|
3092
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
3093
|
-
return array;
|
|
3094
|
-
};
|
|
3095
|
-
multisort.knownTypes = sortTypes_default;
|
|
3096
|
-
var getSingleSortFunction = (info) => {
|
|
3097
|
-
if (!info) {
|
|
3098
|
-
return;
|
|
3099
|
-
}
|
|
3100
|
-
const field = info.field;
|
|
3101
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
3102
|
-
if (!dir) {
|
|
3103
|
-
return;
|
|
3104
|
-
}
|
|
3105
|
-
let fn = info.fn;
|
|
3106
|
-
if (!fn && info.type) {
|
|
3107
|
-
fn = multisort.knownTypes[info.type];
|
|
3108
|
-
if (!fn) {
|
|
3109
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
3110
|
-
}
|
|
3111
|
-
}
|
|
3112
|
-
if (!fn) {
|
|
3113
|
-
fn = sortTypes_default.string;
|
|
3114
|
-
}
|
|
3115
|
-
return (first, second) => {
|
|
3116
|
-
const a = field ? first[field] : first;
|
|
3117
|
-
const b = field ? second[field] : second;
|
|
3118
|
-
return dir * fn(a, b);
|
|
3119
|
-
};
|
|
3120
|
-
};
|
|
3121
|
-
var getSortFunctions = (sortInfo) => {
|
|
3122
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
3123
|
-
};
|
|
3124
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
3125
|
-
const fns = getSortFunctions(sortInfo);
|
|
3126
|
-
return (first, second) => {
|
|
3127
|
-
if (get) {
|
|
3128
|
-
first = get(first);
|
|
3129
|
-
second = get(second);
|
|
3130
|
-
}
|
|
3131
|
-
let result = 0;
|
|
3132
|
-
let i = 0;
|
|
3133
|
-
let fn;
|
|
3134
|
-
const len = fns.length;
|
|
3135
|
-
for (; i < len; i++) {
|
|
3136
|
-
fn = fns[i];
|
|
3137
|
-
if (!fn) {
|
|
3138
|
-
continue;
|
|
3139
|
-
}
|
|
3140
|
-
result = fn(first, second);
|
|
3141
|
-
if (result !== 0) {
|
|
3142
|
-
return result;
|
|
3143
|
-
}
|
|
3144
|
-
}
|
|
3145
|
-
return result;
|
|
3146
|
-
};
|
|
3147
|
-
};
|
|
3148
|
-
|
|
3149
3305
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3150
3306
|
function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPosition) {
|
|
3151
3307
|
const pivotLength = pivotBy.length;
|
|
@@ -3270,7 +3426,7 @@ function concludeReducer(params) {
|
|
|
3270
3426
|
var _a;
|
|
3271
3427
|
const { state, previousState } = params;
|
|
3272
3428
|
const sortInfo = state.sortInfo;
|
|
3273
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3429
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3274
3430
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3275
3431
|
"originalDataArray",
|
|
3276
3432
|
"sortInfo"
|
|
@@ -3340,7 +3496,9 @@ function concludeReducer(params) {
|
|
|
3340
3496
|
}
|
|
3341
3497
|
state.dataArray = rowInfoDataArray;
|
|
3342
3498
|
state.reducedAt = now;
|
|
3343
|
-
|
|
3499
|
+
if (true) {
|
|
3500
|
+
globalThis.state = state;
|
|
3501
|
+
}
|
|
3344
3502
|
return state;
|
|
3345
3503
|
}
|
|
3346
3504
|
|
|
@@ -3363,7 +3521,8 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3363
3521
|
initSetupState: initSetupState2,
|
|
3364
3522
|
forwardProps: forwardProps3,
|
|
3365
3523
|
concludeReducer,
|
|
3366
|
-
mapPropsToState: mapPropsToState2
|
|
3524
|
+
mapPropsToState: mapPropsToState2,
|
|
3525
|
+
interceptActions: getInterceptActions()
|
|
3367
3526
|
});
|
|
3368
3527
|
function DataSourceCmp({ children }) {
|
|
3369
3528
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3393,7 +3552,7 @@ function DataSource(props) {
|
|
|
3393
3552
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3394
3553
|
function useToggleGroupRow() {
|
|
3395
3554
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3396
|
-
const toggleGroupRow = (0,
|
|
3555
|
+
const toggleGroupRow = (0, import_react18.useCallback)((groupKeys) => {
|
|
3397
3556
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
3398
3557
|
newState.toggleGroupRow(groupKeys);
|
|
3399
3558
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -3403,7 +3562,7 @@ function useToggleGroupRow() {
|
|
|
3403
3562
|
|
|
3404
3563
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3405
3564
|
function useGroupRowsMap(groupRowsBy) {
|
|
3406
|
-
const groupRowsMap = (0,
|
|
3565
|
+
const groupRowsMap = (0, import_react19.useMemo)(() => {
|
|
3407
3566
|
return groupRowsBy.reduce((acc, groupBy, index) => {
|
|
3408
3567
|
acc.set(groupBy.field, {
|
|
3409
3568
|
groupBy,
|
|
@@ -3423,10 +3582,10 @@ function useColumnsWhen() {
|
|
|
3423
3582
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3424
3583
|
} = useComponentState();
|
|
3425
3584
|
const groupRowsMap = useGroupRowsMap(groupRowsBy);
|
|
3426
|
-
(0,
|
|
3585
|
+
(0, import_react19.useEffect)(() => {
|
|
3427
3586
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3428
3587
|
}, [groupRenderStrategy]);
|
|
3429
|
-
(0,
|
|
3588
|
+
(0, import_react19.useEffect)(() => {
|
|
3430
3589
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3431
3590
|
}, [pivotTotalColumnPosition]);
|
|
3432
3591
|
useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
|
|
@@ -3489,7 +3648,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3489
3648
|
});
|
|
3490
3649
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3491
3650
|
}
|
|
3492
|
-
(0,
|
|
3651
|
+
(0, import_react19.useEffect)(() => {
|
|
3493
3652
|
const update = () => {
|
|
3494
3653
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
|
|
3495
3654
|
};
|
|
@@ -3515,7 +3674,7 @@ function useColumnsWhenPivoting() {
|
|
|
3515
3674
|
}
|
|
3516
3675
|
} = useComponentState();
|
|
3517
3676
|
const toggleGroupRow = useToggleGroupRow();
|
|
3518
|
-
(0,
|
|
3677
|
+
(0, import_react19.useEffect)(() => {
|
|
3519
3678
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3520
3679
|
pivotColumn,
|
|
3521
3680
|
pivotRowLabelsColumn,
|
|
@@ -3536,7 +3695,7 @@ function useColumnsWhenGrouping() {
|
|
|
3536
3695
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3537
3696
|
} = useComponentState();
|
|
3538
3697
|
const toggleGroupRow = useToggleGroupRow();
|
|
3539
|
-
(0,
|
|
3698
|
+
(0, import_react19.useEffect)(() => {
|
|
3540
3699
|
if (pivotColumns) {
|
|
3541
3700
|
return;
|
|
3542
3701
|
}
|
|
@@ -3573,7 +3732,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3573
3732
|
groupRenderStrategy
|
|
3574
3733
|
}
|
|
3575
3734
|
} = useComponentState();
|
|
3576
|
-
(0,
|
|
3735
|
+
(0, import_react19.useEffect)(() => {
|
|
3577
3736
|
if (groupRenderStrategy === "single-column") {
|
|
3578
3737
|
return;
|
|
3579
3738
|
}
|
|
@@ -3677,7 +3836,7 @@ function useComputed() {
|
|
|
3677
3836
|
columnTypes,
|
|
3678
3837
|
bodySize
|
|
3679
3838
|
} = componentState;
|
|
3680
|
-
(0,
|
|
3839
|
+
(0, import_react20.useState)(() => {
|
|
3681
3840
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3682
3841
|
if (rowHeight) {
|
|
3683
3842
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3693,9 +3852,10 @@ function useComputed() {
|
|
|
3693
3852
|
const { multiSort } = dataSourceState;
|
|
3694
3853
|
useColumnGroups();
|
|
3695
3854
|
useColumnsWhen();
|
|
3696
|
-
const setSortInfo = (0,
|
|
3855
|
+
const setSortInfo = (0, import_react20.useCallback)((sortInfo) => {
|
|
3697
3856
|
var _a2;
|
|
3698
|
-
|
|
3857
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3858
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3699
3859
|
}, []);
|
|
3700
3860
|
const columns = componentState.computedColumns;
|
|
3701
3861
|
const {
|
|
@@ -3852,20 +4012,20 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
|
3852
4012
|
|
|
3853
4013
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
3854
4014
|
var React18 = __toModule(require("react"));
|
|
3855
|
-
var
|
|
4015
|
+
var import_react28 = __toModule(require("react"));
|
|
3856
4016
|
|
|
3857
4017
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3858
4018
|
var React14 = __toModule(require("react"));
|
|
3859
|
-
var
|
|
4019
|
+
var import_react24 = __toModule(require("react"));
|
|
3860
4020
|
|
|
3861
4021
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3862
4022
|
var React12 = __toModule(require("react"));
|
|
3863
4023
|
|
|
3864
4024
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3865
|
-
var
|
|
4025
|
+
var import_react21 = __toModule(require("react"));
|
|
3866
4026
|
var useInfiniteTableState = () => {
|
|
3867
4027
|
const TableContext2 = getInfiniteTableContext();
|
|
3868
|
-
const { componentState } = (0,
|
|
4028
|
+
const { componentState } = (0, import_react21.useContext)(TableContext2);
|
|
3869
4029
|
return componentState;
|
|
3870
4030
|
};
|
|
3871
4031
|
|
|
@@ -3931,7 +4091,7 @@ var InfiniteTableCell = React12.memo(InfiniteTableCellFn);
|
|
|
3931
4091
|
|
|
3932
4092
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3933
4093
|
var import_binary_search = __toModule(require_binary_search());
|
|
3934
|
-
var
|
|
4094
|
+
var import_react22 = __toModule(require("react"));
|
|
3935
4095
|
|
|
3936
4096
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
3937
4097
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -3965,18 +4125,18 @@ var useColumnPointerEvents = ({
|
|
|
3965
4125
|
columns,
|
|
3966
4126
|
computedRemainingSpace
|
|
3967
4127
|
}) => {
|
|
3968
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
3969
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
3970
|
-
const breakpointsRef = (0,
|
|
3971
|
-
const pointerMoveRef = (0,
|
|
3972
|
-
const didDragRef = (0,
|
|
3973
|
-
const initialClientPos = (0,
|
|
3974
|
-
const currentDropIndexRef = (0,
|
|
4128
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react22.useState)(null);
|
|
4129
|
+
const [proxyOffset, setProxyOffset] = (0, import_react22.useState)(null);
|
|
4130
|
+
const breakpointsRef = (0, import_react22.useRef)([]);
|
|
4131
|
+
const pointerMoveRef = (0, import_react22.useRef)(null);
|
|
4132
|
+
const didDragRef = (0, import_react22.useRef)(false);
|
|
4133
|
+
const initialClientPos = (0, import_react22.useRef)(null);
|
|
4134
|
+
const currentDropIndexRef = (0, import_react22.useRef)(null);
|
|
3975
4135
|
const dragging = draggingDiff != null;
|
|
3976
4136
|
const { componentActions, computed } = useInfiniteTable();
|
|
3977
4137
|
const { computedColumnOrder } = computed;
|
|
3978
|
-
const column = (0,
|
|
3979
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
4138
|
+
const column = (0, import_react22.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
4139
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react22.useMemo)(() => {
|
|
3980
4140
|
const columnsArray2 = Array.from(columns.values());
|
|
3981
4141
|
return {
|
|
3982
4142
|
columnsArray: columnsArray2,
|
|
@@ -3984,8 +4144,8 @@ var useColumnPointerEvents = ({
|
|
|
3984
4144
|
columnWidth: column.computedWidth
|
|
3985
4145
|
};
|
|
3986
4146
|
}, [columns, columnId, column]);
|
|
3987
|
-
let cursorRef = (0,
|
|
3988
|
-
const onPointerDown = (0,
|
|
4147
|
+
let cursorRef = (0, import_react22.useRef)("auto");
|
|
4148
|
+
const onPointerDown = (0, import_react22.useCallback)((e) => {
|
|
3989
4149
|
const target = domRef.current;
|
|
3990
4150
|
cursorRef.current = target.style.cursor;
|
|
3991
4151
|
didDragRef.current = false;
|
|
@@ -4048,7 +4208,7 @@ var useColumnPointerEvents = ({
|
|
|
4048
4208
|
target.addEventListener("pointermove", onPointerMove);
|
|
4049
4209
|
target.setPointerCapture(e.pointerId);
|
|
4050
4210
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
4051
|
-
const onPointerUp = (0,
|
|
4211
|
+
const onPointerUp = (0, import_react22.useCallback)((e) => {
|
|
4052
4212
|
const target = domRef.current;
|
|
4053
4213
|
target.style.cursor = cursorRef.current;
|
|
4054
4214
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -4123,7 +4283,7 @@ var import_react_dom = __toModule(require("react-dom"));
|
|
|
4123
4283
|
|
|
4124
4284
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4125
4285
|
var React13 = __toModule(require("react"));
|
|
4126
|
-
var
|
|
4286
|
+
var import_react23 = __toModule(require("react"));
|
|
4127
4287
|
var defaultLineStyle = {
|
|
4128
4288
|
marginTop: 2,
|
|
4129
4289
|
marginBottom: 2,
|
|
@@ -4131,8 +4291,8 @@ var defaultLineStyle = {
|
|
|
4131
4291
|
};
|
|
4132
4292
|
function SortIcon(props) {
|
|
4133
4293
|
var _a;
|
|
4134
|
-
const [rendered, setRendered] = (0,
|
|
4135
|
-
const [opacity, setOpacity] = (0,
|
|
4294
|
+
const [rendered, setRendered] = (0, import_react23.useState)(true);
|
|
4295
|
+
const [opacity, setOpacity] = (0, import_react23.useState)(0);
|
|
4136
4296
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4137
4297
|
const showIndex = index != null && index > 0;
|
|
4138
4298
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4146,7 +4306,7 @@ function SortIcon(props) {
|
|
|
4146
4306
|
}), props.lineStyle), {
|
|
4147
4307
|
opacity
|
|
4148
4308
|
});
|
|
4149
|
-
(0,
|
|
4309
|
+
(0, import_react23.useEffect)(() => {
|
|
4150
4310
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4151
4311
|
if (!rendered && newOpacity) {
|
|
4152
4312
|
setRendered(true);
|
|
@@ -4223,8 +4383,8 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4223
4383
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4224
4384
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4225
4385
|
});
|
|
4226
|
-
const domRef = (0,
|
|
4227
|
-
const ref = (0,
|
|
4386
|
+
const domRef = (0, import_react24.useRef)(null);
|
|
4387
|
+
const ref = (0, import_react24.useCallback)((node) => {
|
|
4228
4388
|
var _a2;
|
|
4229
4389
|
domRef.current = node;
|
|
4230
4390
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
@@ -4233,7 +4393,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4233
4393
|
computed: { computedRemainingSpace },
|
|
4234
4394
|
componentState: { portalDOMRef }
|
|
4235
4395
|
} = useInfiniteTable();
|
|
4236
|
-
(0,
|
|
4396
|
+
(0, import_react24.useEffect)(() => {
|
|
4237
4397
|
let clearOnResize = null;
|
|
4238
4398
|
const node = domRef.current;
|
|
4239
4399
|
if (onResize && node) {
|
|
@@ -4286,14 +4446,14 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4286
4446
|
|
|
4287
4447
|
// src/components/RawList/index.tsx
|
|
4288
4448
|
var React17 = __toModule(require("react"));
|
|
4289
|
-
var
|
|
4449
|
+
var import_react27 = __toModule(require("react"));
|
|
4290
4450
|
|
|
4291
4451
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4292
4452
|
var React15 = __toModule(require("react"));
|
|
4293
|
-
var
|
|
4453
|
+
var import_react25 = __toModule(require("react"));
|
|
4294
4454
|
function AvoidReactDiffFn(props) {
|
|
4295
|
-
const [children, setChildren] = (0,
|
|
4296
|
-
(0,
|
|
4455
|
+
const [children, setChildren] = (0, import_react25.useState)(props.updater.get());
|
|
4456
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
4297
4457
|
const remove = props.updater.onChange((children2) => {
|
|
4298
4458
|
setChildren(children2);
|
|
4299
4459
|
});
|
|
@@ -4304,7 +4464,7 @@ function AvoidReactDiffFn(props) {
|
|
|
4304
4464
|
var AvoidReactDiff = React15.memo(AvoidReactDiffFn);
|
|
4305
4465
|
|
|
4306
4466
|
// src/components/RawList/useVirtualRenderer.ts
|
|
4307
|
-
var
|
|
4467
|
+
var import_react26 = __toModule(require("react"));
|
|
4308
4468
|
|
|
4309
4469
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4310
4470
|
var React16 = __toModule(require("react"));
|
|
@@ -4323,10 +4483,10 @@ var MappedItems = class extends Logger {
|
|
|
4323
4483
|
return result;
|
|
4324
4484
|
};
|
|
4325
4485
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4326
|
-
const
|
|
4486
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4327
4487
|
const result = [];
|
|
4328
|
-
for (const elementIndex in
|
|
4329
|
-
const itemIndex =
|
|
4488
|
+
for (const elementIndex in map2) {
|
|
4489
|
+
const itemIndex = map2[elementIndex];
|
|
4330
4490
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4331
4491
|
result.push(elementIndex >> 0);
|
|
4332
4492
|
}
|
|
@@ -4618,7 +4778,7 @@ function createRenderer(brain) {
|
|
|
4618
4778
|
function useVirtualRenderer({
|
|
4619
4779
|
brain
|
|
4620
4780
|
}) {
|
|
4621
|
-
return (0,
|
|
4781
|
+
return (0, import_react26.useMemo)(() => {
|
|
4622
4782
|
return createRenderer(brain);
|
|
4623
4783
|
}, [brain]);
|
|
4624
4784
|
}
|
|
@@ -4631,7 +4791,7 @@ function RawListFn(props) {
|
|
|
4631
4791
|
debugChannel
|
|
4632
4792
|
});
|
|
4633
4793
|
const getRenderItem = useLatest(renderItem);
|
|
4634
|
-
(0,
|
|
4794
|
+
(0, import_react27.useEffect)(() => {
|
|
4635
4795
|
const renderRange = brain.getRenderRange();
|
|
4636
4796
|
renderer.renderRange(renderRange, {
|
|
4637
4797
|
renderItem,
|
|
@@ -4639,7 +4799,7 @@ function RawListFn(props) {
|
|
|
4639
4799
|
onRender: onRenderUpdater
|
|
4640
4800
|
});
|
|
4641
4801
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4642
|
-
(0,
|
|
4802
|
+
(0, import_react27.useEffect)(() => {
|
|
4643
4803
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4644
4804
|
renderer.renderRange(renderRange, {
|
|
4645
4805
|
force: false,
|
|
@@ -4666,7 +4826,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4666
4826
|
componentState: { headerHeight }
|
|
4667
4827
|
} = useInfiniteTable();
|
|
4668
4828
|
const { computedVisibleColumnsMap } = computed;
|
|
4669
|
-
const renderColumn = (0,
|
|
4829
|
+
const renderColumn = (0, import_react28.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
4670
4830
|
const column = columns[columnIndex];
|
|
4671
4831
|
if (!column) {
|
|
4672
4832
|
if (true) {
|
|
@@ -4681,14 +4841,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4681
4841
|
columns: computedVisibleColumnsMap
|
|
4682
4842
|
});
|
|
4683
4843
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4684
|
-
(0,
|
|
4844
|
+
(0, import_react28.useEffect)(() => {
|
|
4685
4845
|
const onScroll = (scrollPosition) => {
|
|
4686
4846
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4687
4847
|
};
|
|
4688
4848
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4689
4849
|
return removeOnScroll;
|
|
4690
4850
|
}, [brain]);
|
|
4691
|
-
const domRef = (0,
|
|
4851
|
+
const domRef = (0, import_react28.useRef)(null);
|
|
4692
4852
|
const headerCls = HeaderClsRecipe({
|
|
4693
4853
|
pinned: pinning,
|
|
4694
4854
|
overflow: false,
|
|
@@ -4714,7 +4874,7 @@ var React20 = __toModule(require("react"));
|
|
|
4714
4874
|
|
|
4715
4875
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4716
4876
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4717
|
-
const
|
|
4877
|
+
const map2 = new Map();
|
|
4718
4878
|
const temporaryMap = new Map();
|
|
4719
4879
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4720
4880
|
columns.forEach((col, index) => {
|
|
@@ -4732,7 +4892,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4732
4892
|
computedWidth: col.computedWidth,
|
|
4733
4893
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4734
4894
|
};
|
|
4735
|
-
|
|
4895
|
+
map2.set([colId], colItem);
|
|
4736
4896
|
let groupId = col.columnGroup;
|
|
4737
4897
|
let colGroupItem;
|
|
4738
4898
|
let prevGroupItem = colItem;
|
|
@@ -4754,7 +4914,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4754
4914
|
computedWidth: 0,
|
|
4755
4915
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4756
4916
|
};
|
|
4757
|
-
|
|
4917
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4758
4918
|
temporaryMap.set(groupId, colGroupItem);
|
|
4759
4919
|
}
|
|
4760
4920
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4771,7 +4931,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4771
4931
|
});
|
|
4772
4932
|
const result = [];
|
|
4773
4933
|
let groupOffset = 0;
|
|
4774
|
-
|
|
4934
|
+
map2.forEach((item) => {
|
|
4775
4935
|
if (!item.ref.columnGroup) {
|
|
4776
4936
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4777
4937
|
item.groupOffset = groupOffset;
|
|
@@ -4783,7 +4943,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4783
4943
|
groupOffset += itemWidth;
|
|
4784
4944
|
}
|
|
4785
4945
|
});
|
|
4786
|
-
|
|
4946
|
+
map2.clear();
|
|
4787
4947
|
temporaryMap.clear();
|
|
4788
4948
|
return result;
|
|
4789
4949
|
}
|
|
@@ -4880,7 +5040,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4880
5040
|
}
|
|
4881
5041
|
|
|
4882
5042
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4883
|
-
var
|
|
5043
|
+
var import_react29 = __toModule(require("react"));
|
|
4884
5044
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4885
5045
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4886
5046
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4946,7 +5106,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4946
5106
|
if (totalWidth != null) {
|
|
4947
5107
|
style.width = availableWidth;
|
|
4948
5108
|
}
|
|
4949
|
-
(0,
|
|
5109
|
+
(0, import_react29.useEffect)(() => {
|
|
4950
5110
|
const scroller = brain || scrollListener;
|
|
4951
5111
|
if (!scroller || !scrollable) {
|
|
4952
5112
|
return;
|
|
@@ -5060,12 +5220,12 @@ function TableHeaderWrapper(props) {
|
|
|
5060
5220
|
|
|
5061
5221
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5062
5222
|
var React23 = __toModule(require("react"));
|
|
5063
|
-
var
|
|
5223
|
+
var import_react31 = __toModule(require("react"));
|
|
5064
5224
|
|
|
5065
5225
|
// src/components/hooks/useOnScroll.ts
|
|
5066
|
-
var
|
|
5226
|
+
var import_react30 = __toModule(require("react"));
|
|
5067
5227
|
var useOnScroll = (domRef, onScroll) => {
|
|
5068
|
-
(0,
|
|
5228
|
+
(0, import_react30.useEffect)(() => {
|
|
5069
5229
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5070
5230
|
const scrollFn = (event) => {
|
|
5071
5231
|
const node = event.target;
|
|
@@ -5111,7 +5271,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5111
5271
|
className,
|
|
5112
5272
|
style
|
|
5113
5273
|
} = props;
|
|
5114
|
-
const domRef = ref != null ? ref : (0,
|
|
5274
|
+
const domRef = ref != null ? ref : (0, import_react31.useRef)(null);
|
|
5115
5275
|
useOnScroll(domRef, onContainerScroll);
|
|
5116
5276
|
return /* @__PURE__ */ React23.createElement("div", {
|
|
5117
5277
|
ref: domRef,
|
|
@@ -5142,18 +5302,18 @@ function SpacePlaceholderFn(props) {
|
|
|
5142
5302
|
var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
|
|
5143
5303
|
|
|
5144
5304
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5145
|
-
var
|
|
5305
|
+
var import_react42 = __toModule(require("react"));
|
|
5146
5306
|
|
|
5147
5307
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5148
5308
|
var React30 = __toModule(require("react"));
|
|
5149
|
-
var
|
|
5309
|
+
var import_react35 = __toModule(require("react"));
|
|
5150
5310
|
|
|
5151
5311
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5152
5312
|
var React26 = __toModule(require("react"));
|
|
5153
5313
|
|
|
5154
5314
|
// src/components/VirtualList/VirtualList.tsx
|
|
5155
5315
|
var React25 = __toModule(require("react"));
|
|
5156
|
-
var
|
|
5316
|
+
var import_react32 = __toModule(require("react"));
|
|
5157
5317
|
|
|
5158
5318
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5159
5319
|
var VirtualListCls = "mlx2t0 _16lm1iw0";
|
|
@@ -5196,11 +5356,11 @@ var VirtualList = (props) => {
|
|
|
5196
5356
|
"onContainerScroll",
|
|
5197
5357
|
"children"
|
|
5198
5358
|
]);
|
|
5199
|
-
const domRef = (0,
|
|
5359
|
+
const domRef = (0, import_react32.useRef)(null);
|
|
5200
5360
|
const [, rerender] = useRerender();
|
|
5201
|
-
const [totalSize, setTotalSize] = (0,
|
|
5202
|
-
const renderCountRef = (0,
|
|
5203
|
-
(0,
|
|
5361
|
+
const [totalSize, setTotalSize] = (0, import_react32.useState)(0);
|
|
5362
|
+
const renderCountRef = (0, import_react32.useRef)(0);
|
|
5363
|
+
(0, import_react32.useEffect)(() => {
|
|
5204
5364
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5205
5365
|
renderCountRef.current = renderCount;
|
|
5206
5366
|
if (true) {
|
|
@@ -5219,7 +5379,7 @@ var VirtualList = (props) => {
|
|
|
5219
5379
|
removeOnTotalSizeChange();
|
|
5220
5380
|
};
|
|
5221
5381
|
}, [virtualBrain]);
|
|
5222
|
-
(0,
|
|
5382
|
+
(0, import_react32.useEffect)(() => {
|
|
5223
5383
|
const onScroll = (scrollPosition) => {
|
|
5224
5384
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5225
5385
|
};
|
|
@@ -5273,7 +5433,7 @@ var VirtualRowList = (props) => {
|
|
|
5273
5433
|
|
|
5274
5434
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
5275
5435
|
var React28 = __toModule(require("react"));
|
|
5276
|
-
var
|
|
5436
|
+
var import_react34 = __toModule(require("react"));
|
|
5277
5437
|
|
|
5278
5438
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5279
5439
|
var React27 = __toModule(require("react"));
|
|
@@ -5377,7 +5537,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5377
5537
|
var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
|
|
5378
5538
|
|
|
5379
5539
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5380
|
-
var
|
|
5540
|
+
var import_react33 = __toModule(require("react"));
|
|
5381
5541
|
|
|
5382
5542
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
5383
5543
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
@@ -5402,8 +5562,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5402
5562
|
domRef: domRefFromProps,
|
|
5403
5563
|
rowInfo
|
|
5404
5564
|
} = props;
|
|
5405
|
-
const domRef = (0,
|
|
5406
|
-
const rowDOMRef = (0,
|
|
5565
|
+
const domRef = (0, import_react33.useRef)(null);
|
|
5566
|
+
const rowDOMRef = (0, import_react33.useCallback)((node) => {
|
|
5407
5567
|
domRefFromProps(node);
|
|
5408
5568
|
domRef.current = node;
|
|
5409
5569
|
}, []);
|
|
@@ -5435,7 +5595,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5435
5595
|
}), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
|
|
5436
5596
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
5437
5597
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
5438
|
-
const onMouseEnter = (0,
|
|
5598
|
+
const onMouseEnter = (0, import_react33.useCallback)((event) => {
|
|
5439
5599
|
var _a;
|
|
5440
5600
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
5441
5601
|
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
@@ -5449,7 +5609,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5449
5609
|
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5450
5610
|
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5451
5611
|
}, [initialMouseEnter, showHoverRows]);
|
|
5452
|
-
const onMouseLeave = (0,
|
|
5612
|
+
const onMouseLeave = (0, import_react33.useCallback)((event) => {
|
|
5453
5613
|
var _a;
|
|
5454
5614
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
5455
5615
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
@@ -5505,7 +5665,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5505
5665
|
width: rowWidth,
|
|
5506
5666
|
height: rowHeight
|
|
5507
5667
|
}, domProps.style);
|
|
5508
|
-
const renderCellRef = (0,
|
|
5668
|
+
const renderCellRef = (0, import_react34.useRef)(null);
|
|
5509
5669
|
const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
|
|
5510
5670
|
const column = columns[itemIndex];
|
|
5511
5671
|
if (!column) {
|
|
@@ -5609,7 +5769,7 @@ function useUnpinnedRendering(params) {
|
|
|
5609
5769
|
} = params;
|
|
5610
5770
|
const { virtualizeColumns } = getState();
|
|
5611
5771
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
5612
|
-
const renderRowUnpinned = (0,
|
|
5772
|
+
const renderRowUnpinned = (0, import_react35.useCallback)((rowParams) => {
|
|
5613
5773
|
const dataArray = getData();
|
|
5614
5774
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5615
5775
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -5675,7 +5835,7 @@ function useUnpinnedRendering(params) {
|
|
|
5675
5835
|
}
|
|
5676
5836
|
|
|
5677
5837
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5678
|
-
var
|
|
5838
|
+
var import_react36 = __toModule(require("react"));
|
|
5679
5839
|
|
|
5680
5840
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5681
5841
|
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
@@ -5691,7 +5851,7 @@ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn
|
|
|
5691
5851
|
var DELAY = 200;
|
|
5692
5852
|
var TableClassName = internalProps.rootClassName;
|
|
5693
5853
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5694
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
5854
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5695
5855
|
var useOnContainerScroll = ({
|
|
5696
5856
|
verticalVirtualBrain,
|
|
5697
5857
|
horizontalVirtualBrain,
|
|
@@ -5707,14 +5867,15 @@ var useOnContainerScroll = ({
|
|
|
5707
5867
|
bodySize
|
|
5708
5868
|
}
|
|
5709
5869
|
} = useInfiniteTable();
|
|
5710
|
-
const
|
|
5711
|
-
const
|
|
5712
|
-
const
|
|
5713
|
-
(0,
|
|
5870
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5871
|
+
const timeoutIdRef = (0, import_react36.useRef)(0);
|
|
5872
|
+
const scrollingRef = (0, import_react36.useRef)(false);
|
|
5873
|
+
const scrollTopMaxRef = (0, import_react36.useRef)(0);
|
|
5874
|
+
(0, import_react36.useEffect)(() => {
|
|
5714
5875
|
const { current: node } = scrollerDOMRef;
|
|
5715
5876
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5716
5877
|
}, [reservedContentHeight, bodySize.height]);
|
|
5717
|
-
const setScrolling = (0,
|
|
5878
|
+
const setScrolling = (0, import_react36.useCallback)((scrolling) => {
|
|
5718
5879
|
var _a;
|
|
5719
5880
|
const prevScrolling = scrollingRef.current;
|
|
5720
5881
|
scrollingRef.current = scrolling;
|
|
@@ -5739,7 +5900,7 @@ var useOnContainerScroll = ({
|
|
|
5739
5900
|
}
|
|
5740
5901
|
}
|
|
5741
5902
|
}, []);
|
|
5742
|
-
const onContainerScroll = (0,
|
|
5903
|
+
const onContainerScroll = (0, import_react36.useCallback)((scrollInfo) => {
|
|
5743
5904
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5744
5905
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5745
5906
|
setScrolling(true);
|
|
@@ -5749,15 +5910,15 @@ var useOnContainerScroll = ({
|
|
|
5749
5910
|
domRef.current,
|
|
5750
5911
|
setScrolling
|
|
5751
5912
|
]);
|
|
5752
|
-
const scrollPositionRef = (0,
|
|
5913
|
+
const scrollPositionRef = (0, import_react36.useRef)({
|
|
5753
5914
|
scrollLeft: 0,
|
|
5754
5915
|
scrollTop: 0
|
|
5755
5916
|
});
|
|
5756
|
-
const applyScrollHorizontal = (0,
|
|
5917
|
+
const applyScrollHorizontal = (0, import_react36.useCallback)(({ scrollLeft }) => {
|
|
5757
5918
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
5758
5919
|
onContainerScroll(scrollPositionRef.current);
|
|
5759
5920
|
}, [onContainerScroll]);
|
|
5760
|
-
const applyScrollVertical = (0,
|
|
5921
|
+
const applyScrollVertical = (0, import_react36.useCallback)(({ scrollTop }) => {
|
|
5761
5922
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
5762
5923
|
onContainerScroll(scrollPositionRef.current);
|
|
5763
5924
|
if (scrollTop === 0) {
|
|
@@ -5767,6 +5928,9 @@ var useOnContainerScroll = ({
|
|
|
5767
5928
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5768
5929
|
if (isScrollBottom) {
|
|
5769
5930
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5931
|
+
if (getDataSourceState().livePagination) {
|
|
5932
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
5933
|
+
}
|
|
5770
5934
|
}
|
|
5771
5935
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5772
5936
|
return {
|
|
@@ -5777,16 +5941,16 @@ var useOnContainerScroll = ({
|
|
|
5777
5941
|
|
|
5778
5942
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5779
5943
|
var React32 = __toModule(require("react"));
|
|
5780
|
-
var
|
|
5944
|
+
var import_react39 = __toModule(require("react"));
|
|
5781
5945
|
|
|
5782
5946
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5783
5947
|
var React31 = __toModule(require("react"));
|
|
5784
|
-
var
|
|
5948
|
+
var import_react38 = __toModule(require("react"));
|
|
5785
5949
|
|
|
5786
5950
|
// src/components/hooks/useOnMount.ts
|
|
5787
|
-
var
|
|
5951
|
+
var import_react37 = __toModule(require("react"));
|
|
5788
5952
|
function useOnMount(domRef, props) {
|
|
5789
|
-
(0,
|
|
5953
|
+
(0, import_react37.useEffect)(() => {
|
|
5790
5954
|
const { onMount, onUnmount } = props;
|
|
5791
5955
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5792
5956
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5817,8 +5981,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5817
5981
|
onMount,
|
|
5818
5982
|
onUnmount
|
|
5819
5983
|
} = props;
|
|
5820
|
-
const domRef = (0,
|
|
5821
|
-
const renderItem = (0,
|
|
5984
|
+
const domRef = (0, import_react38.useRef)(null);
|
|
5985
|
+
const renderItem = (0, import_react38.useCallback)((renderProps) => renderRow({
|
|
5822
5986
|
domRef: renderProps.domRef,
|
|
5823
5987
|
rowHeight: renderProps.itemSize,
|
|
5824
5988
|
rowIndex: renderProps.itemIndex
|
|
@@ -5827,7 +5991,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5827
5991
|
onMount,
|
|
5828
5992
|
onUnmount
|
|
5829
5993
|
});
|
|
5830
|
-
(0,
|
|
5994
|
+
(0, import_react38.useEffect)(() => {
|
|
5831
5995
|
const onScroll = (scrollPosition) => {
|
|
5832
5996
|
const node = domRef.current;
|
|
5833
5997
|
if (node) {
|
|
@@ -5894,7 +6058,7 @@ function PinnedRowsContainer(props) {
|
|
|
5894
6058
|
}
|
|
5895
6059
|
return result;
|
|
5896
6060
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
5897
|
-
const updateScroll = (0,
|
|
6061
|
+
const updateScroll = (0, import_react39.useCallback)((node, scrollPosition) => {
|
|
5898
6062
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
5899
6063
|
}, [hasOverflow, pinnedScrollListener]);
|
|
5900
6064
|
const rowListProps = {
|
|
@@ -5936,7 +6100,7 @@ function PinnedRowsContainer(props) {
|
|
|
5936
6100
|
}
|
|
5937
6101
|
function useRenderPinnedRow(params) {
|
|
5938
6102
|
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
5939
|
-
const renderPinnedRow = (0,
|
|
6103
|
+
const renderPinnedRow = (0, import_react39.useCallback)((rowParams) => {
|
|
5940
6104
|
const dataArray = getData();
|
|
5941
6105
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5942
6106
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -6050,7 +6214,7 @@ function usePinnedStartRendering(params) {
|
|
|
6050
6214
|
}
|
|
6051
6215
|
|
|
6052
6216
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6053
|
-
var
|
|
6217
|
+
var import_react41 = __toModule(require("react"));
|
|
6054
6218
|
|
|
6055
6219
|
// src/components/VirtualBrain/index.ts
|
|
6056
6220
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -6488,9 +6652,9 @@ var VirtualBrain = class extends Logger {
|
|
|
6488
6652
|
};
|
|
6489
6653
|
|
|
6490
6654
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
6491
|
-
var
|
|
6655
|
+
var import_react40 = __toModule(require("react"));
|
|
6492
6656
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
6493
|
-
const columnSize = (0,
|
|
6657
|
+
const columnSize = (0, import_react40.useCallback)((index) => {
|
|
6494
6658
|
const column = computedUnpinnedColumns[index];
|
|
6495
6659
|
if (!column) {
|
|
6496
6660
|
console.log("cannot find column at index", index, computedUnpinnedColumns);
|
|
@@ -6529,7 +6693,7 @@ function useYourBrain(param) {
|
|
|
6529
6693
|
});
|
|
6530
6694
|
return brain;
|
|
6531
6695
|
});
|
|
6532
|
-
(0,
|
|
6696
|
+
(0, import_react41.useEffect)(() => {
|
|
6533
6697
|
return () => {
|
|
6534
6698
|
horizontalVirtualBrain.destroy();
|
|
6535
6699
|
verticalVirtualBrain.destroy();
|
|
@@ -6537,13 +6701,13 @@ function useYourBrain(param) {
|
|
|
6537
6701
|
}, []);
|
|
6538
6702
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6539
6703
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6540
|
-
(0,
|
|
6704
|
+
(0, import_react41.useEffect)(() => {
|
|
6541
6705
|
verticalVirtualBrain.setAvailableSize({
|
|
6542
6706
|
height: bodySize.height,
|
|
6543
6707
|
width: 0
|
|
6544
6708
|
});
|
|
6545
6709
|
}, [bodySize, verticalVirtualBrain]);
|
|
6546
|
-
(0,
|
|
6710
|
+
(0, import_react41.useEffect)(() => {
|
|
6547
6711
|
horizontalVirtualBrain.setAvailableSize({
|
|
6548
6712
|
height: 0,
|
|
6549
6713
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6552,29 +6716,6 @@ function useYourBrain(param) {
|
|
|
6552
6716
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6553
6717
|
}
|
|
6554
6718
|
|
|
6555
|
-
// src/utils/shallowEqualObjects.ts
|
|
6556
|
-
function shallowEqualObjects(objA, objB) {
|
|
6557
|
-
if (objA === objB) {
|
|
6558
|
-
return true;
|
|
6559
|
-
}
|
|
6560
|
-
if (!objA || !objB) {
|
|
6561
|
-
return false;
|
|
6562
|
-
}
|
|
6563
|
-
var aKeys = Object.keys(objA);
|
|
6564
|
-
var bKeys = Object.keys(objB);
|
|
6565
|
-
var len = aKeys.length;
|
|
6566
|
-
if (bKeys.length !== len) {
|
|
6567
|
-
return false;
|
|
6568
|
-
}
|
|
6569
|
-
for (var i = 0; i < len; i++) {
|
|
6570
|
-
var key = aKeys[i];
|
|
6571
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6572
|
-
return false;
|
|
6573
|
-
}
|
|
6574
|
-
}
|
|
6575
|
-
return true;
|
|
6576
|
-
}
|
|
6577
|
-
|
|
6578
6719
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6579
6720
|
function useListRendering(param) {
|
|
6580
6721
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6604,12 +6745,12 @@ function useListRendering(param) {
|
|
|
6604
6745
|
pinnedEndScrollListener
|
|
6605
6746
|
} = componentState;
|
|
6606
6747
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6607
|
-
const repaintIdRef = (0,
|
|
6748
|
+
const repaintIdRef = (0, import_react42.useRef)(0);
|
|
6608
6749
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6609
6750
|
repaintIdRef.current++;
|
|
6610
6751
|
}
|
|
6611
6752
|
const repaintId = repaintIdRef.current;
|
|
6612
|
-
const rowSpan = (0,
|
|
6753
|
+
const rowSpan = (0, import_react42.useMemo)(() => {
|
|
6613
6754
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6614
6755
|
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
6615
6756
|
let maxSpan = 1;
|
|
@@ -6646,12 +6787,12 @@ function useListRendering(param) {
|
|
|
6646
6787
|
});
|
|
6647
6788
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6648
6789
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6649
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6650
|
-
const scrollbars = (0,
|
|
6790
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6791
|
+
const scrollbars = (0, import_react42.useMemo)(() => ({
|
|
6651
6792
|
vertical: hasVerticalScrollbar,
|
|
6652
6793
|
horizontal: hasHorizontalScrollbar
|
|
6653
6794
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6654
|
-
(0,
|
|
6795
|
+
(0, import_react42.useEffect)(() => {
|
|
6655
6796
|
if (!bodySize.height) {
|
|
6656
6797
|
return;
|
|
6657
6798
|
}
|
|
@@ -6677,7 +6818,7 @@ function useListRendering(param) {
|
|
|
6677
6818
|
reservedContentHeight
|
|
6678
6819
|
});
|
|
6679
6820
|
const { componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
6680
|
-
const toggleGroupRow = (0,
|
|
6821
|
+
const toggleGroupRow = (0, import_react42.useCallback)((groupKeys) => {
|
|
6681
6822
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
6682
6823
|
newState.toggleGroupRow(groupKeys);
|
|
6683
6824
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -6712,7 +6853,7 @@ function useListRendering(param) {
|
|
|
6712
6853
|
computedUnpinnedColumns
|
|
6713
6854
|
});
|
|
6714
6855
|
const [, rerender] = useRerender();
|
|
6715
|
-
(0,
|
|
6856
|
+
(0, import_react42.useEffect)(() => {
|
|
6716
6857
|
rerender();
|
|
6717
6858
|
}, [dataSourceState]);
|
|
6718
6859
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6736,7 +6877,7 @@ function useListRendering(param) {
|
|
|
6736
6877
|
|
|
6737
6878
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6738
6879
|
var React33 = __toModule(require("react"));
|
|
6739
|
-
var
|
|
6880
|
+
var import_react43 = __toModule(require("react"));
|
|
6740
6881
|
|
|
6741
6882
|
// src/components/utils/decamelize.ts
|
|
6742
6883
|
var import_decamelize = __toModule(require_decamelize());
|
|
@@ -6786,7 +6927,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6786
6927
|
ref.current = node;
|
|
6787
6928
|
}
|
|
6788
6929
|
}, []);
|
|
6789
|
-
(0,
|
|
6930
|
+
(0, import_react43.useEffect)(() => {
|
|
6790
6931
|
const forceStyle = () => {
|
|
6791
6932
|
requestAnimationFrame(() => {
|
|
6792
6933
|
var _a;
|
|
@@ -6814,7 +6955,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6814
6955
|
});
|
|
6815
6956
|
|
|
6816
6957
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6817
|
-
var
|
|
6958
|
+
var import_react44 = __toModule(require("react"));
|
|
6818
6959
|
|
|
6819
6960
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
6820
6961
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -6964,10 +7105,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
|
6964
7105
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
6965
7106
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
6966
7107
|
var useLicense = (licenseKey = "") => {
|
|
6967
|
-
const valid = (0,
|
|
7108
|
+
const valid = (0, import_react44.useMemo)(() => {
|
|
6968
7109
|
let valid2 = isValidLicense(licenseKey, {
|
|
6969
7110
|
publishedAt: 1624970570587,
|
|
6970
|
-
version: "0.0.
|
|
7111
|
+
version: "0.0.9"
|
|
6971
7112
|
});
|
|
6972
7113
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
6973
7114
|
return true;
|
|
@@ -6979,7 +7120,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
6979
7120
|
|
|
6980
7121
|
// src/components/CSSVariableWatch.tsx
|
|
6981
7122
|
var React34 = __toModule(require("react"));
|
|
6982
|
-
var
|
|
7123
|
+
var import_react45 = __toModule(require("react"));
|
|
6983
7124
|
var error = err("CSSVariableWatch");
|
|
6984
7125
|
var debug5 = dbg("CSSVariableWatch");
|
|
6985
7126
|
var WRAPPER_STYLE = {
|
|
@@ -6992,7 +7133,7 @@ var WRAPPER_STYLE = {
|
|
|
6992
7133
|
overflow: "hidden"
|
|
6993
7134
|
};
|
|
6994
7135
|
var useCSSVariableWatch = (params) => {
|
|
6995
|
-
const lastValueRef = (0,
|
|
7136
|
+
const lastValueRef = (0, import_react45.useRef)(0);
|
|
6996
7137
|
const onResize = React34.useCallback(({ height }) => {
|
|
6997
7138
|
if (height && height !== lastValueRef.current) {
|
|
6998
7139
|
lastValueRef.current = height;
|
|
@@ -7012,7 +7153,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7012
7153
|
}, []);
|
|
7013
7154
|
};
|
|
7014
7155
|
var CSSVariableWatch = (props) => {
|
|
7015
|
-
const domRef = (0,
|
|
7156
|
+
const domRef = (0, import_react45.useRef)(null);
|
|
7016
7157
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7017
7158
|
ref: domRef
|
|
7018
7159
|
}));
|
|
@@ -7154,9 +7295,15 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7154
7295
|
});
|
|
7155
7296
|
var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
7156
7297
|
var _a;
|
|
7157
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
7158
7298
|
const {
|
|
7159
|
-
componentState
|
|
7299
|
+
componentState,
|
|
7300
|
+
getComputed,
|
|
7301
|
+
computed,
|
|
7302
|
+
getState: getInfiniteTableState
|
|
7303
|
+
} = useInfiniteTable();
|
|
7304
|
+
const {
|
|
7305
|
+
componentState: { dataArray, loading },
|
|
7306
|
+
getState: getDataSourceState
|
|
7160
7307
|
} = useDataSourceContextValue();
|
|
7161
7308
|
const {
|
|
7162
7309
|
domRef,
|
|
@@ -7193,6 +7340,15 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7193
7340
|
const licenseValid = useLicense(licenseKey);
|
|
7194
7341
|
const domProps = useDOMProps(componentState.domProps);
|
|
7195
7342
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7343
|
+
React36.useLayoutEffect(() => {
|
|
7344
|
+
const dataSourceState = getDataSourceState();
|
|
7345
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7346
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7347
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7348
|
+
onScrollbarsChange(scrollbars);
|
|
7349
|
+
}
|
|
7350
|
+
notifyScrollbarsChange(scrollbars);
|
|
7351
|
+
}, [scrollbars]);
|
|
7196
7352
|
return /* @__PURE__ */ React36.createElement("div", __spreadValues({
|
|
7197
7353
|
ref: domRef
|
|
7198
7354
|
}, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
|
|
@@ -7224,7 +7380,7 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7224
7380
|
});
|
|
7225
7381
|
function InfiniteTableContextProvider() {
|
|
7226
7382
|
const { componentActions, componentState } = useComponentState();
|
|
7227
|
-
const { scrollerDOMRef } = componentState;
|
|
7383
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7228
7384
|
const computed = useComputed();
|
|
7229
7385
|
const getComputed = useLatest(computed);
|
|
7230
7386
|
const getState = useLatest(componentState);
|
|
@@ -7259,6 +7415,11 @@ function InfiniteTableContextProvider() {
|
|
|
7259
7415
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7260
7416
|
};
|
|
7261
7417
|
}, []);
|
|
7418
|
+
React36.useEffect(() => {
|
|
7419
|
+
if (scrollerDOMRef.current) {
|
|
7420
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7421
|
+
}
|
|
7422
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7262
7423
|
const TableContext2 = getInfiniteTableContext();
|
|
7263
7424
|
return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
|
|
7264
7425
|
value: contextValue
|