@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.esm.js
CHANGED
|
@@ -48,26 +48,6 @@ var __reExport = (target, module, desc) => {
|
|
|
48
48
|
var __toModule = (module) => {
|
|
49
49
|
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
50
50
|
};
|
|
51
|
-
var __async = (__this, __arguments, generator) => {
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
var fulfilled = (value) => {
|
|
54
|
-
try {
|
|
55
|
-
step(generator.next(value));
|
|
56
|
-
} catch (e) {
|
|
57
|
-
reject(e);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var rejected = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.throw(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
68
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
51
|
|
|
72
52
|
// node_modules/ms/index.js
|
|
73
53
|
var require_ms = __commonJS({
|
|
@@ -673,7 +653,8 @@ import {
|
|
|
673
653
|
StrictMode,
|
|
674
654
|
createElement as createElement33,
|
|
675
655
|
memo as memo13,
|
|
676
|
-
useEffect as
|
|
656
|
+
useEffect as useEffect24,
|
|
657
|
+
useLayoutEffect as useLayoutEffect6
|
|
677
658
|
} from "react";
|
|
678
659
|
|
|
679
660
|
// src/components/InfiniteTable/internalProps.ts
|
|
@@ -756,7 +737,7 @@ var ScrollListener = class {
|
|
|
756
737
|
|
|
757
738
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
758
739
|
function computeColumnGroupsDepths(columnGroups) {
|
|
759
|
-
const
|
|
740
|
+
const map2 = new Map();
|
|
760
741
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
761
742
|
let parentGroupId = colGroup.columnGroup;
|
|
762
743
|
let depth = 0;
|
|
@@ -771,9 +752,9 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
771
752
|
depth++;
|
|
772
753
|
parentGroupId = parent.columnGroup;
|
|
773
754
|
}
|
|
774
|
-
|
|
755
|
+
map2.set(colGroupId, depth);
|
|
775
756
|
});
|
|
776
|
-
return
|
|
757
|
+
return map2;
|
|
777
758
|
}
|
|
778
759
|
|
|
779
760
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
@@ -786,6 +767,9 @@ function toMap(mapOrObject) {
|
|
|
786
767
|
}
|
|
787
768
|
return new Map(Object.entries(mapOrObject));
|
|
788
769
|
}
|
|
770
|
+
function toColumnTypesMap(mapOrObject) {
|
|
771
|
+
return toMap(mapOrObject);
|
|
772
|
+
}
|
|
789
773
|
function initSetupState() {
|
|
790
774
|
const columnsGeneratedForGrouping = new Map();
|
|
791
775
|
return {
|
|
@@ -819,6 +803,7 @@ var forwardProps = () => {
|
|
|
819
803
|
var _a;
|
|
820
804
|
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
821
805
|
},
|
|
806
|
+
scrollTopId: 1,
|
|
822
807
|
components: 1,
|
|
823
808
|
loadingText: 1,
|
|
824
809
|
pivotColumns: 1,
|
|
@@ -844,6 +829,7 @@ var forwardProps = () => {
|
|
|
844
829
|
pivotColumn: 1,
|
|
845
830
|
pivotRowLabelsColumn: 1,
|
|
846
831
|
pivotColumnGroups: 1,
|
|
832
|
+
onScrollbarsChange: 1,
|
|
847
833
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
848
834
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
849
835
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
@@ -869,7 +855,7 @@ var forwardProps = () => {
|
|
|
869
855
|
},
|
|
870
856
|
columnTypes: (columnTypes) => {
|
|
871
857
|
var _a;
|
|
872
|
-
return (_a =
|
|
858
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
873
859
|
},
|
|
874
860
|
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
875
861
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
@@ -1512,28 +1498,28 @@ var useRerender = () => {
|
|
|
1512
1498
|
|
|
1513
1499
|
// src/components/hooks/useInterceptedMap.ts
|
|
1514
1500
|
import { useEffect as useEffect2 } from "react";
|
|
1515
|
-
function interceptMap(
|
|
1516
|
-
const { set, delete: deleteKey, clear } =
|
|
1501
|
+
function interceptMap(map2, fns) {
|
|
1502
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1517
1503
|
if (fns.set) {
|
|
1518
|
-
|
|
1519
|
-
set.call(
|
|
1504
|
+
map2.set = (key, value) => {
|
|
1505
|
+
set.call(map2, key, value);
|
|
1520
1506
|
fns.set(key, value);
|
|
1521
|
-
return
|
|
1507
|
+
return map2;
|
|
1522
1508
|
};
|
|
1523
1509
|
}
|
|
1524
1510
|
if (fns.delete) {
|
|
1525
|
-
|
|
1526
|
-
const removed = deleteKey.call(
|
|
1511
|
+
map2.delete = (key) => {
|
|
1512
|
+
const removed = deleteKey.call(map2, key);
|
|
1527
1513
|
fns.delete(key);
|
|
1528
1514
|
return removed;
|
|
1529
1515
|
};
|
|
1530
1516
|
}
|
|
1531
1517
|
if (fns.clear || fns.beforeClear) {
|
|
1532
|
-
|
|
1518
|
+
map2.clear = () => {
|
|
1533
1519
|
if (fns.beforeClear) {
|
|
1534
|
-
fns.beforeClear(
|
|
1520
|
+
fns.beforeClear(map2);
|
|
1535
1521
|
}
|
|
1536
|
-
const result = clear.call(
|
|
1522
|
+
const result = clear.call(map2);
|
|
1537
1523
|
if (fns.clear) {
|
|
1538
1524
|
fns.clear();
|
|
1539
1525
|
}
|
|
@@ -1542,13 +1528,13 @@ function interceptMap(map, fns) {
|
|
|
1542
1528
|
}
|
|
1543
1529
|
return () => {
|
|
1544
1530
|
if (set) {
|
|
1545
|
-
|
|
1531
|
+
map2.set = set;
|
|
1546
1532
|
}
|
|
1547
1533
|
if (deleteKey) {
|
|
1548
|
-
|
|
1534
|
+
map2.delete = deleteKey;
|
|
1549
1535
|
}
|
|
1550
1536
|
if (clear) {
|
|
1551
|
-
|
|
1537
|
+
map2.clear = clear;
|
|
1552
1538
|
}
|
|
1553
1539
|
};
|
|
1554
1540
|
}
|
|
@@ -1568,16 +1554,16 @@ var rafFn = (fn) => {
|
|
|
1568
1554
|
};
|
|
1569
1555
|
|
|
1570
1556
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1571
|
-
var useRerenderOnKeyChange = (
|
|
1557
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1572
1558
|
const [renderId, rerender] = useRerender();
|
|
1573
1559
|
useEffect3(() => {
|
|
1574
1560
|
const update = rafFn(rerender);
|
|
1575
|
-
return interceptMap(
|
|
1561
|
+
return interceptMap(map2, {
|
|
1576
1562
|
set: update,
|
|
1577
1563
|
clear: update,
|
|
1578
1564
|
delete: update
|
|
1579
1565
|
});
|
|
1580
|
-
}, [
|
|
1566
|
+
}, [map2]);
|
|
1581
1567
|
return renderId;
|
|
1582
1568
|
};
|
|
1583
1569
|
|
|
@@ -1691,7 +1677,7 @@ var useComputedVisibleColumns = ({
|
|
|
1691
1677
|
var sortAscending = (a, b) => a - b;
|
|
1692
1678
|
|
|
1693
1679
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1694
|
-
import { useCallback as useCallback5, useState as
|
|
1680
|
+
import { useCallback as useCallback5, useState as useState5 } from "react";
|
|
1695
1681
|
|
|
1696
1682
|
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1697
1683
|
import { useEffect as useEffect5 } from "react";
|
|
@@ -1814,7 +1800,7 @@ function getComponentStateContext() {
|
|
|
1814
1800
|
}
|
|
1815
1801
|
return ComponentContext = createContext3(null);
|
|
1816
1802
|
}
|
|
1817
|
-
function
|
|
1803
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1818
1804
|
const state = getState();
|
|
1819
1805
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1820
1806
|
const key = stateKey;
|
|
@@ -1826,6 +1812,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1826
1812
|
return;
|
|
1827
1813
|
}
|
|
1828
1814
|
notifyChange(props, stateKey, value);
|
|
1815
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1816
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1817
|
+
}
|
|
1829
1818
|
const forwardFn = propsToForward[key];
|
|
1830
1819
|
if (typeof forwardFn === "function") {
|
|
1831
1820
|
value = forwardFn(value);
|
|
@@ -1938,7 +1927,7 @@ function getComponentStateRoot(config) {
|
|
|
1938
1927
|
const getComponentState = useLatest(state);
|
|
1939
1928
|
const { allowedControlledPropOverrides } = config;
|
|
1940
1929
|
const actions = useMemo3(() => {
|
|
1941
|
-
const generatedActions =
|
|
1930
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1942
1931
|
return generatedActions;
|
|
1943
1932
|
}, [
|
|
1944
1933
|
dispatch,
|
|
@@ -2107,7 +2096,7 @@ function useColumnGroups() {
|
|
|
2107
2096
|
}
|
|
2108
2097
|
|
|
2109
2098
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2110
|
-
import { useEffect as
|
|
2099
|
+
import { useEffect as useEffect10, useMemo as useMemo5 } from "react";
|
|
2111
2100
|
|
|
2112
2101
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2113
2102
|
import {
|
|
@@ -2371,62 +2360,231 @@ import {
|
|
|
2371
2360
|
createElement as createElement6
|
|
2372
2361
|
} from "react";
|
|
2373
2362
|
|
|
2374
|
-
// src/
|
|
2375
|
-
|
|
2363
|
+
// src/utils/multisort/sortTypes.ts
|
|
2364
|
+
var numberComparator = function(first, second) {
|
|
2365
|
+
return first - second;
|
|
2366
|
+
};
|
|
2367
|
+
var stringComparator = function(first, second) {
|
|
2368
|
+
first = `${first}`;
|
|
2369
|
+
second = `${second}`;
|
|
2370
|
+
return first.localeCompare(second);
|
|
2371
|
+
};
|
|
2372
|
+
var sortTypes = {
|
|
2373
|
+
number: numberComparator,
|
|
2374
|
+
string: stringComparator
|
|
2375
|
+
};
|
|
2376
|
+
var sortTypes_default = sortTypes;
|
|
2376
2377
|
|
|
2377
|
-
// src/
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2378
|
+
// src/utils/multisort/index.ts
|
|
2379
|
+
var multisort = (sortInfo, array, get) => {
|
|
2380
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2381
|
+
return array;
|
|
2382
|
+
};
|
|
2383
|
+
multisort.knownTypes = sortTypes_default;
|
|
2384
|
+
var getSingleSortFunction = (info) => {
|
|
2385
|
+
if (!info) {
|
|
2386
|
+
return;
|
|
2384
2387
|
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2388
|
+
const field = info.field;
|
|
2389
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2390
|
+
if (!dir) {
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
let fn = info.fn;
|
|
2394
|
+
if (!fn && info.type) {
|
|
2395
|
+
fn = multisort.knownTypes[info.type];
|
|
2396
|
+
if (!fn) {
|
|
2397
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
if (!fn) {
|
|
2401
|
+
fn = sortTypes_default.string;
|
|
2402
|
+
}
|
|
2403
|
+
return (first, second) => {
|
|
2404
|
+
const a = field ? first[field] : first;
|
|
2405
|
+
const b = field ? second[field] : second;
|
|
2406
|
+
return dir * fn(a, b);
|
|
2387
2407
|
};
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2408
|
+
};
|
|
2409
|
+
var getSortFunctions = (sortInfo) => {
|
|
2410
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2411
|
+
};
|
|
2412
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2413
|
+
const fns = getSortFunctions(sortInfo);
|
|
2414
|
+
return (first, second) => {
|
|
2415
|
+
if (get) {
|
|
2416
|
+
first = get(first);
|
|
2417
|
+
second = get(second);
|
|
2395
2418
|
}
|
|
2396
|
-
|
|
2397
|
-
|
|
2419
|
+
let result = 0;
|
|
2420
|
+
let i = 0;
|
|
2421
|
+
let fn;
|
|
2422
|
+
const len = fns.length;
|
|
2423
|
+
for (; i < len; i++) {
|
|
2424
|
+
fn = fns[i];
|
|
2425
|
+
if (!fn) {
|
|
2426
|
+
continue;
|
|
2427
|
+
}
|
|
2428
|
+
result = fn(first, second);
|
|
2429
|
+
if (result !== 0) {
|
|
2430
|
+
return result;
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
return result;
|
|
2434
|
+
};
|
|
2435
|
+
};
|
|
2436
|
+
|
|
2437
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2438
|
+
import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
2439
|
+
|
|
2440
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2441
|
+
import { useEffect as useEffect8, useRef as useRef5 } from "react";
|
|
2442
|
+
function useEffectWithChanges(fn, deps) {
|
|
2443
|
+
const prevRef = useRef5({});
|
|
2444
|
+
const oldValuesRef = useRef5({});
|
|
2445
|
+
const oldValues = oldValuesRef.current;
|
|
2446
|
+
const changesRef = useRef5({});
|
|
2447
|
+
const changes = changesRef.current;
|
|
2448
|
+
const useEffectDeps = [];
|
|
2449
|
+
for (let k in deps) {
|
|
2450
|
+
if (deps.hasOwnProperty(k)) {
|
|
2451
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2452
|
+
changes[k] = deps[k];
|
|
2453
|
+
oldValues[k] = prevRef.current[k];
|
|
2454
|
+
}
|
|
2455
|
+
useEffectDeps.push(deps[k]);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
prevRef.current = deps;
|
|
2459
|
+
useEffect8(() => {
|
|
2460
|
+
const changes2 = changesRef.current;
|
|
2461
|
+
const result = fn(changes2, oldValues);
|
|
2462
|
+
changesRef.current = {};
|
|
2463
|
+
oldValuesRef.current = {};
|
|
2464
|
+
return result;
|
|
2465
|
+
}, useEffectDeps);
|
|
2398
2466
|
}
|
|
2399
2467
|
|
|
2400
2468
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2401
|
-
function
|
|
2402
|
-
|
|
2469
|
+
function buildDataSourceDataParams(componentState) {
|
|
2470
|
+
var _a, _b;
|
|
2471
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2472
|
+
const dataSourceParams = {
|
|
2473
|
+
originalDataArray: componentState.originalDataArray,
|
|
2474
|
+
sortInfo,
|
|
2475
|
+
groupRowsBy: componentState.groupRowsBy,
|
|
2476
|
+
pivotBy: componentState.pivotBy
|
|
2477
|
+
};
|
|
2478
|
+
if (componentState.livePagination !== void 0) {
|
|
2479
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2480
|
+
}
|
|
2481
|
+
return dataSourceParams;
|
|
2482
|
+
}
|
|
2483
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2484
|
+
var _a;
|
|
2485
|
+
if (typeof componentState.data === "function") {
|
|
2486
|
+
loadData(componentState.data, componentState, actions);
|
|
2487
|
+
}
|
|
2488
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2489
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2490
|
+
}
|
|
2491
|
+
function loadData(data, componentState, actions) {
|
|
2492
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2493
|
+
if (typeof data === "function") {
|
|
2494
|
+
data = data(dataParams);
|
|
2495
|
+
}
|
|
2496
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2497
|
+
if (dataIsPromise) {
|
|
2498
|
+
actions.loading = true;
|
|
2499
|
+
}
|
|
2500
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2501
|
+
let dataArray = [];
|
|
2502
|
+
if (Array.isArray(dataParam.data)) {
|
|
2503
|
+
const remoteData = dataParam;
|
|
2504
|
+
dataArray = remoteData.data;
|
|
2505
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2506
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2507
|
+
}
|
|
2508
|
+
} else {
|
|
2509
|
+
dataArray = dataParam;
|
|
2510
|
+
}
|
|
2511
|
+
actions.originalDataArray = dataArray;
|
|
2512
|
+
if (dataIsPromise) {
|
|
2513
|
+
actions.loading = false;
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2403
2516
|
}
|
|
2404
2517
|
function useLoadData() {
|
|
2405
2518
|
const {
|
|
2519
|
+
getComponentState,
|
|
2406
2520
|
componentActions: actions,
|
|
2407
2521
|
componentState: { data }
|
|
2408
2522
|
} = useComponentState();
|
|
2409
|
-
const loadData = (data2) => {
|
|
2410
|
-
let dataSourceInfo = {
|
|
2411
|
-
originalDataArray: []
|
|
2412
|
-
};
|
|
2413
|
-
if (typeof data2 === "function") {
|
|
2414
|
-
data2 = data2();
|
|
2415
|
-
}
|
|
2416
|
-
if (Array.isArray(data2)) {
|
|
2417
|
-
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2418
|
-
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2419
|
-
} else {
|
|
2420
|
-
actions.loading = true;
|
|
2421
|
-
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2422
|
-
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2423
|
-
actions.loading = false;
|
|
2424
|
-
});
|
|
2425
|
-
}
|
|
2426
|
-
};
|
|
2427
2523
|
useLayoutEffect3(() => {
|
|
2428
|
-
loadData(data);
|
|
2524
|
+
loadData(data, getComponentState(), actions);
|
|
2429
2525
|
}, [data]);
|
|
2526
|
+
useLivePagination();
|
|
2527
|
+
}
|
|
2528
|
+
function useLivePagination() {
|
|
2529
|
+
const {
|
|
2530
|
+
getComponentState,
|
|
2531
|
+
componentActions: actions,
|
|
2532
|
+
componentState
|
|
2533
|
+
} = useComponentState();
|
|
2534
|
+
const {
|
|
2535
|
+
notifyScrollbarsChange,
|
|
2536
|
+
sortInfo,
|
|
2537
|
+
groupRowsBy,
|
|
2538
|
+
pivotBy,
|
|
2539
|
+
livePaginationCursor,
|
|
2540
|
+
scrollBottomId
|
|
2541
|
+
} = componentState;
|
|
2542
|
+
const [scrollbars, setScrollbars] = useState4({
|
|
2543
|
+
vertical: false,
|
|
2544
|
+
horizontal: false
|
|
2545
|
+
});
|
|
2546
|
+
const scrollbarsRef = useRef6(scrollbars);
|
|
2547
|
+
useEffect9(() => {
|
|
2548
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2549
|
+
if (!scrollbars2) {
|
|
2550
|
+
return;
|
|
2551
|
+
}
|
|
2552
|
+
scrollbarsRef.current = scrollbars2;
|
|
2553
|
+
setScrollbars(scrollbars2);
|
|
2554
|
+
});
|
|
2555
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2556
|
+
}, [notifyScrollbarsChange]);
|
|
2557
|
+
const [cursorId, updateCursorId] = useState4(void 0);
|
|
2558
|
+
useEffect9(() => {
|
|
2559
|
+
const frameId = requestAnimationFrame(() => {
|
|
2560
|
+
var _a;
|
|
2561
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2562
|
+
updateCursorId(livePaginationCursor);
|
|
2563
|
+
}
|
|
2564
|
+
});
|
|
2565
|
+
return () => cancelAnimationFrame(frameId);
|
|
2566
|
+
}, [livePaginationCursor]);
|
|
2567
|
+
useEffect9(() => {
|
|
2568
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2569
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2570
|
+
updateCursorId(livePaginationCursor2);
|
|
2571
|
+
}
|
|
2572
|
+
}, [scrollbars.vertical]);
|
|
2573
|
+
useEffect9(() => {
|
|
2574
|
+
updateCursorId(scrollBottomId);
|
|
2575
|
+
}, [scrollBottomId]);
|
|
2576
|
+
const depsObject = {
|
|
2577
|
+
sortInfo,
|
|
2578
|
+
groupRowsBy,
|
|
2579
|
+
pivotBy,
|
|
2580
|
+
cursorId
|
|
2581
|
+
};
|
|
2582
|
+
useEffectWithChanges(() => {
|
|
2583
|
+
if (cursorId === void 0) {
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2587
|
+
}, depsObject);
|
|
2430
2588
|
}
|
|
2431
2589
|
|
|
2432
2590
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2480,9 +2638,9 @@ var DeepMap = class {
|
|
|
2480
2638
|
if (!pair) {
|
|
2481
2639
|
return;
|
|
2482
2640
|
}
|
|
2483
|
-
const { map } = pair;
|
|
2641
|
+
const { map: map2 } = pair;
|
|
2484
2642
|
const keys = [...parentKeys, key];
|
|
2485
|
-
const next =
|
|
2643
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2486
2644
|
if (pair.hasOwnProperty("value")) {
|
|
2487
2645
|
fn(pair.value, keys, i, next);
|
|
2488
2646
|
i++;
|
|
@@ -2548,14 +2706,14 @@ var DeepMap = class {
|
|
|
2548
2706
|
return this.length;
|
|
2549
2707
|
}
|
|
2550
2708
|
clear() {
|
|
2551
|
-
const clearMap = (
|
|
2552
|
-
|
|
2553
|
-
const { map:
|
|
2554
|
-
if (
|
|
2555
|
-
clearMap(
|
|
2709
|
+
const clearMap = (map2) => {
|
|
2710
|
+
map2.forEach((value, _key) => {
|
|
2711
|
+
const { map: map3 } = value;
|
|
2712
|
+
if (map3) {
|
|
2713
|
+
clearMap(map3);
|
|
2556
2714
|
}
|
|
2557
2715
|
});
|
|
2558
|
-
|
|
2716
|
+
map2.clear();
|
|
2559
2717
|
};
|
|
2560
2718
|
clearMap(this.map);
|
|
2561
2719
|
this.length = 0;
|
|
@@ -2600,9 +2758,9 @@ var DeepMap = class {
|
|
|
2600
2758
|
}
|
|
2601
2759
|
}
|
|
2602
2760
|
while (maps.length) {
|
|
2603
|
-
let
|
|
2761
|
+
let map2 = maps.pop();
|
|
2604
2762
|
let key = keys.pop();
|
|
2605
|
-
if (key && (
|
|
2763
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2606
2764
|
let parentMap = maps[maps.length - 1];
|
|
2607
2765
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2608
2766
|
if (pair) {
|
|
@@ -2641,12 +2799,12 @@ var DeepMap = class {
|
|
|
2641
2799
|
if (!pair) {
|
|
2642
2800
|
return;
|
|
2643
2801
|
}
|
|
2644
|
-
const { map } = pair;
|
|
2802
|
+
const { map: map2 } = pair;
|
|
2645
2803
|
const keys = [...parentKeys, key];
|
|
2646
2804
|
const next = once(() => {
|
|
2647
|
-
if (
|
|
2648
|
-
|
|
2649
|
-
this.visitKey(k,
|
|
2805
|
+
if (map2) {
|
|
2806
|
+
map2.forEach((_, k) => {
|
|
2807
|
+
this.visitKey(k, map2, keys, fn);
|
|
2650
2808
|
});
|
|
2651
2809
|
}
|
|
2652
2810
|
});
|
|
@@ -2812,14 +2970,68 @@ var GroupRowsState = class {
|
|
|
2812
2970
|
}
|
|
2813
2971
|
};
|
|
2814
2972
|
|
|
2973
|
+
// src/utils/shallowEqualObjects.ts
|
|
2974
|
+
function shallowEqualObjects(objA, objB) {
|
|
2975
|
+
if (objA === objB) {
|
|
2976
|
+
return true;
|
|
2977
|
+
}
|
|
2978
|
+
if (!objA || !objB) {
|
|
2979
|
+
return false;
|
|
2980
|
+
}
|
|
2981
|
+
var aKeys = Object.keys(objA);
|
|
2982
|
+
var bKeys = Object.keys(objB);
|
|
2983
|
+
var len = aKeys.length;
|
|
2984
|
+
if (bKeys.length !== len) {
|
|
2985
|
+
return false;
|
|
2986
|
+
}
|
|
2987
|
+
for (var i = 0; i < len; i++) {
|
|
2988
|
+
var key = aKeys[i];
|
|
2989
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2990
|
+
return false;
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
return true;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2997
|
+
var map = new WeakMap();
|
|
2998
|
+
var getCompareDefault = (a) => a;
|
|
2999
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
3000
|
+
map.set(fn, {
|
|
3001
|
+
lastCallTime: 0,
|
|
3002
|
+
lastCallArg: null
|
|
3003
|
+
});
|
|
3004
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
3005
|
+
return (arg) => {
|
|
3006
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
3007
|
+
lastCallTime: 0,
|
|
3008
|
+
lastCallArg: null
|
|
3009
|
+
};
|
|
3010
|
+
const now = Date.now();
|
|
3011
|
+
const diff = now - lastCallTime;
|
|
3012
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
3013
|
+
if (diff < timeframe && objectsEqual) {
|
|
3014
|
+
return;
|
|
3015
|
+
}
|
|
3016
|
+
map.set(fn, {
|
|
3017
|
+
lastCallTime: now,
|
|
3018
|
+
lastCallArg: arg
|
|
3019
|
+
});
|
|
3020
|
+
fn(arg);
|
|
3021
|
+
};
|
|
3022
|
+
}
|
|
3023
|
+
|
|
2815
3024
|
// src/components/DataSource/state/getInitialState.ts
|
|
2816
3025
|
function initSetupState2() {
|
|
2817
3026
|
const now = Date.now();
|
|
2818
3027
|
const originalDataArray = [];
|
|
2819
3028
|
const dataArray = [];
|
|
2820
3029
|
return {
|
|
3030
|
+
dataParams: void 0,
|
|
3031
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2821
3032
|
pivotTotalColumnPosition: "end",
|
|
2822
3033
|
originalDataArray,
|
|
3034
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2823
3035
|
pivotColumns: void 0,
|
|
2824
3036
|
pivotColumnGroups: void 0,
|
|
2825
3037
|
dataArray,
|
|
@@ -2836,12 +3048,20 @@ function initSetupState2() {
|
|
|
2836
3048
|
lastGroupDataArray: void 0
|
|
2837
3049
|
};
|
|
2838
3050
|
}
|
|
3051
|
+
function getCompareObject(dataParams) {
|
|
3052
|
+
const obj = __spreadValues({}, dataParams);
|
|
3053
|
+
delete obj.originalDataArray;
|
|
3054
|
+
return obj;
|
|
3055
|
+
}
|
|
2839
3056
|
var forwardProps3 = () => {
|
|
2840
3057
|
return {
|
|
3058
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2841
3059
|
remoteCount: 1,
|
|
2842
3060
|
data: 1,
|
|
2843
3061
|
pivotBy: 1,
|
|
2844
3062
|
primaryKey: 1,
|
|
3063
|
+
livePagination: 1,
|
|
3064
|
+
livePaginationCursor: 1,
|
|
2845
3065
|
loading: (loading) => loading != null ? loading : false,
|
|
2846
3066
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2847
3067
|
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
@@ -2854,10 +3074,20 @@ var forwardProps3 = () => {
|
|
|
2854
3074
|
};
|
|
2855
3075
|
};
|
|
2856
3076
|
function mapPropsToState2(params) {
|
|
2857
|
-
var _a;
|
|
2858
3077
|
const { props } = params;
|
|
3078
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2859
3079
|
return {
|
|
2860
|
-
|
|
3080
|
+
controlledSort,
|
|
3081
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3082
|
+
};
|
|
3083
|
+
}
|
|
3084
|
+
function getInterceptActions() {
|
|
3085
|
+
return {
|
|
3086
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3087
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3088
|
+
dataParams.sortInfo = sortInfo;
|
|
3089
|
+
actions.dataParams = dataParams;
|
|
3090
|
+
}
|
|
2861
3091
|
};
|
|
2862
3092
|
}
|
|
2863
3093
|
|
|
@@ -3091,80 +3321,6 @@ function enhancedFlatten(param) {
|
|
|
3091
3321
|
};
|
|
3092
3322
|
}
|
|
3093
3323
|
|
|
3094
|
-
// src/utils/multisort/sortTypes.ts
|
|
3095
|
-
var numberComparator = function(first, second) {
|
|
3096
|
-
return first - second;
|
|
3097
|
-
};
|
|
3098
|
-
var stringComparator = function(first, second) {
|
|
3099
|
-
first = `${first}`;
|
|
3100
|
-
second = `${second}`;
|
|
3101
|
-
return first.localeCompare(second);
|
|
3102
|
-
};
|
|
3103
|
-
var sortTypes = {
|
|
3104
|
-
number: numberComparator,
|
|
3105
|
-
string: stringComparator
|
|
3106
|
-
};
|
|
3107
|
-
var sortTypes_default = sortTypes;
|
|
3108
|
-
|
|
3109
|
-
// src/utils/multisort/index.ts
|
|
3110
|
-
var multisort = (sortInfo, array, get) => {
|
|
3111
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
3112
|
-
return array;
|
|
3113
|
-
};
|
|
3114
|
-
multisort.knownTypes = sortTypes_default;
|
|
3115
|
-
var getSingleSortFunction = (info) => {
|
|
3116
|
-
if (!info) {
|
|
3117
|
-
return;
|
|
3118
|
-
}
|
|
3119
|
-
const field = info.field;
|
|
3120
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
3121
|
-
if (!dir) {
|
|
3122
|
-
return;
|
|
3123
|
-
}
|
|
3124
|
-
let fn = info.fn;
|
|
3125
|
-
if (!fn && info.type) {
|
|
3126
|
-
fn = multisort.knownTypes[info.type];
|
|
3127
|
-
if (!fn) {
|
|
3128
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
if (!fn) {
|
|
3132
|
-
fn = sortTypes_default.string;
|
|
3133
|
-
}
|
|
3134
|
-
return (first, second) => {
|
|
3135
|
-
const a = field ? first[field] : first;
|
|
3136
|
-
const b = field ? second[field] : second;
|
|
3137
|
-
return dir * fn(a, b);
|
|
3138
|
-
};
|
|
3139
|
-
};
|
|
3140
|
-
var getSortFunctions = (sortInfo) => {
|
|
3141
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
3142
|
-
};
|
|
3143
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
3144
|
-
const fns = getSortFunctions(sortInfo);
|
|
3145
|
-
return (first, second) => {
|
|
3146
|
-
if (get) {
|
|
3147
|
-
first = get(first);
|
|
3148
|
-
second = get(second);
|
|
3149
|
-
}
|
|
3150
|
-
let result = 0;
|
|
3151
|
-
let i = 0;
|
|
3152
|
-
let fn;
|
|
3153
|
-
const len = fns.length;
|
|
3154
|
-
for (; i < len; i++) {
|
|
3155
|
-
fn = fns[i];
|
|
3156
|
-
if (!fn) {
|
|
3157
|
-
continue;
|
|
3158
|
-
}
|
|
3159
|
-
result = fn(first, second);
|
|
3160
|
-
if (result !== 0) {
|
|
3161
|
-
return result;
|
|
3162
|
-
}
|
|
3163
|
-
}
|
|
3164
|
-
return result;
|
|
3165
|
-
};
|
|
3166
|
-
};
|
|
3167
|
-
|
|
3168
3324
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3169
3325
|
function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPosition) {
|
|
3170
3326
|
const pivotLength = pivotBy.length;
|
|
@@ -3289,7 +3445,7 @@ function concludeReducer(params) {
|
|
|
3289
3445
|
var _a;
|
|
3290
3446
|
const { state, previousState } = params;
|
|
3291
3447
|
const sortInfo = state.sortInfo;
|
|
3292
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3448
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3293
3449
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3294
3450
|
"originalDataArray",
|
|
3295
3451
|
"sortInfo"
|
|
@@ -3359,7 +3515,9 @@ function concludeReducer(params) {
|
|
|
3359
3515
|
}
|
|
3360
3516
|
state.dataArray = rowInfoDataArray;
|
|
3361
3517
|
state.reducedAt = now;
|
|
3362
|
-
|
|
3518
|
+
if (true) {
|
|
3519
|
+
globalThis.state = state;
|
|
3520
|
+
}
|
|
3363
3521
|
return state;
|
|
3364
3522
|
}
|
|
3365
3523
|
|
|
@@ -3382,7 +3540,8 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3382
3540
|
initSetupState: initSetupState2,
|
|
3383
3541
|
forwardProps: forwardProps3,
|
|
3384
3542
|
concludeReducer,
|
|
3385
|
-
mapPropsToState: mapPropsToState2
|
|
3543
|
+
mapPropsToState: mapPropsToState2,
|
|
3544
|
+
interceptActions: getInterceptActions()
|
|
3386
3545
|
});
|
|
3387
3546
|
function DataSourceCmp({ children }) {
|
|
3388
3547
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3442,10 +3601,10 @@ function useColumnsWhen() {
|
|
|
3442
3601
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3443
3602
|
} = useComponentState();
|
|
3444
3603
|
const groupRowsMap = useGroupRowsMap(groupRowsBy);
|
|
3445
|
-
|
|
3604
|
+
useEffect10(() => {
|
|
3446
3605
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3447
3606
|
}, [groupRenderStrategy]);
|
|
3448
|
-
|
|
3607
|
+
useEffect10(() => {
|
|
3449
3608
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3450
3609
|
}, [pivotTotalColumnPosition]);
|
|
3451
3610
|
useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
|
|
@@ -3508,7 +3667,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3508
3667
|
});
|
|
3509
3668
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3510
3669
|
}
|
|
3511
|
-
|
|
3670
|
+
useEffect10(() => {
|
|
3512
3671
|
const update = () => {
|
|
3513
3672
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
|
|
3514
3673
|
};
|
|
@@ -3534,7 +3693,7 @@ function useColumnsWhenPivoting() {
|
|
|
3534
3693
|
}
|
|
3535
3694
|
} = useComponentState();
|
|
3536
3695
|
const toggleGroupRow = useToggleGroupRow();
|
|
3537
|
-
|
|
3696
|
+
useEffect10(() => {
|
|
3538
3697
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3539
3698
|
pivotColumn,
|
|
3540
3699
|
pivotRowLabelsColumn,
|
|
@@ -3555,7 +3714,7 @@ function useColumnsWhenGrouping() {
|
|
|
3555
3714
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3556
3715
|
} = useComponentState();
|
|
3557
3716
|
const toggleGroupRow = useToggleGroupRow();
|
|
3558
|
-
|
|
3717
|
+
useEffect10(() => {
|
|
3559
3718
|
if (pivotColumns) {
|
|
3560
3719
|
return;
|
|
3561
3720
|
}
|
|
@@ -3592,7 +3751,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3592
3751
|
groupRenderStrategy
|
|
3593
3752
|
}
|
|
3594
3753
|
} = useComponentState();
|
|
3595
|
-
|
|
3754
|
+
useEffect10(() => {
|
|
3596
3755
|
if (groupRenderStrategy === "single-column") {
|
|
3597
3756
|
return;
|
|
3598
3757
|
}
|
|
@@ -3696,7 +3855,7 @@ function useComputed() {
|
|
|
3696
3855
|
columnTypes,
|
|
3697
3856
|
bodySize
|
|
3698
3857
|
} = componentState;
|
|
3699
|
-
|
|
3858
|
+
useState5(() => {
|
|
3700
3859
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3701
3860
|
if (rowHeight) {
|
|
3702
3861
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3714,7 +3873,8 @@ function useComputed() {
|
|
|
3714
3873
|
useColumnsWhen();
|
|
3715
3874
|
const setSortInfo = useCallback5((sortInfo) => {
|
|
3716
3875
|
var _a2;
|
|
3717
|
-
|
|
3876
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3877
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3718
3878
|
}, []);
|
|
3719
3879
|
const columns = componentState.computedColumns;
|
|
3720
3880
|
const {
|
|
@@ -3882,14 +4042,14 @@ import {
|
|
|
3882
4042
|
createElement as createElement15,
|
|
3883
4043
|
memo as memo6
|
|
3884
4044
|
} from "react";
|
|
3885
|
-
import { useCallback as useCallback8, useEffect as
|
|
4045
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
|
|
3886
4046
|
|
|
3887
4047
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3888
4048
|
import {
|
|
3889
4049
|
Fragment as Fragment2,
|
|
3890
4050
|
createElement as createElement11
|
|
3891
4051
|
} from "react";
|
|
3892
|
-
import { useCallback as useCallback7, useEffect as
|
|
4052
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef8 } from "react";
|
|
3893
4053
|
|
|
3894
4054
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3895
4055
|
import {
|
|
@@ -3970,8 +4130,8 @@ var import_binary_search = __toModule(require_binary_search());
|
|
|
3970
4130
|
import {
|
|
3971
4131
|
useCallback as useCallback6,
|
|
3972
4132
|
useMemo as useMemo6,
|
|
3973
|
-
useRef as
|
|
3974
|
-
useState as
|
|
4133
|
+
useRef as useRef7,
|
|
4134
|
+
useState as useState6
|
|
3975
4135
|
} from "react";
|
|
3976
4136
|
|
|
3977
4137
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
@@ -4006,13 +4166,13 @@ var useColumnPointerEvents = ({
|
|
|
4006
4166
|
columns,
|
|
4007
4167
|
computedRemainingSpace
|
|
4008
4168
|
}) => {
|
|
4009
|
-
const [draggingDiff, setDraggingDiff] =
|
|
4010
|
-
const [proxyOffset, setProxyOffset] =
|
|
4011
|
-
const breakpointsRef =
|
|
4012
|
-
const pointerMoveRef =
|
|
4013
|
-
const didDragRef =
|
|
4014
|
-
const initialClientPos =
|
|
4015
|
-
const currentDropIndexRef =
|
|
4169
|
+
const [draggingDiff, setDraggingDiff] = useState6(null);
|
|
4170
|
+
const [proxyOffset, setProxyOffset] = useState6(null);
|
|
4171
|
+
const breakpointsRef = useRef7([]);
|
|
4172
|
+
const pointerMoveRef = useRef7(null);
|
|
4173
|
+
const didDragRef = useRef7(false);
|
|
4174
|
+
const initialClientPos = useRef7(null);
|
|
4175
|
+
const currentDropIndexRef = useRef7(null);
|
|
4016
4176
|
const dragging = draggingDiff != null;
|
|
4017
4177
|
const { componentActions, computed } = useInfiniteTable();
|
|
4018
4178
|
const { computedColumnOrder } = computed;
|
|
@@ -4025,7 +4185,7 @@ var useColumnPointerEvents = ({
|
|
|
4025
4185
|
columnWidth: column.computedWidth
|
|
4026
4186
|
};
|
|
4027
4187
|
}, [columns, columnId, column]);
|
|
4028
|
-
let cursorRef =
|
|
4188
|
+
let cursorRef = useRef7("auto");
|
|
4029
4189
|
const onPointerDown = useCallback6((e) => {
|
|
4030
4190
|
const target = domRef.current;
|
|
4031
4191
|
cursorRef.current = target.style.cursor;
|
|
@@ -4166,7 +4326,7 @@ import { createPortal } from "react-dom";
|
|
|
4166
4326
|
import {
|
|
4167
4327
|
createElement as createElement10
|
|
4168
4328
|
} from "react";
|
|
4169
|
-
import { useEffect as
|
|
4329
|
+
import { useEffect as useEffect11, useState as useState7 } from "react";
|
|
4170
4330
|
var defaultLineStyle = {
|
|
4171
4331
|
marginTop: 2,
|
|
4172
4332
|
marginBottom: 2,
|
|
@@ -4174,8 +4334,8 @@ var defaultLineStyle = {
|
|
|
4174
4334
|
};
|
|
4175
4335
|
function SortIcon(props) {
|
|
4176
4336
|
var _a;
|
|
4177
|
-
const [rendered, setRendered] =
|
|
4178
|
-
const [opacity, setOpacity] =
|
|
4337
|
+
const [rendered, setRendered] = useState7(true);
|
|
4338
|
+
const [opacity, setOpacity] = useState7(0);
|
|
4179
4339
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4180
4340
|
const showIndex = index != null && index > 0;
|
|
4181
4341
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4189,7 +4349,7 @@ function SortIcon(props) {
|
|
|
4189
4349
|
}), props.lineStyle), {
|
|
4190
4350
|
opacity
|
|
4191
4351
|
});
|
|
4192
|
-
|
|
4352
|
+
useEffect11(() => {
|
|
4193
4353
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4194
4354
|
if (!rendered && newOpacity) {
|
|
4195
4355
|
setRendered(true);
|
|
@@ -4266,7 +4426,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4266
4426
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4267
4427
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4268
4428
|
});
|
|
4269
|
-
const domRef =
|
|
4429
|
+
const domRef = useRef8(null);
|
|
4270
4430
|
const ref = useCallback7((node) => {
|
|
4271
4431
|
var _a2;
|
|
4272
4432
|
domRef.current = node;
|
|
@@ -4276,7 +4436,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4276
4436
|
computed: { computedRemainingSpace },
|
|
4277
4437
|
componentState: { portalDOMRef }
|
|
4278
4438
|
} = useInfiniteTable();
|
|
4279
|
-
|
|
4439
|
+
useEffect12(() => {
|
|
4280
4440
|
let clearOnResize = null;
|
|
4281
4441
|
const node = domRef.current;
|
|
4282
4442
|
if (onResize && node) {
|
|
@@ -4332,7 +4492,7 @@ import {
|
|
|
4332
4492
|
createElement as createElement14,
|
|
4333
4493
|
memo as memo5
|
|
4334
4494
|
} from "react";
|
|
4335
|
-
import { useEffect as
|
|
4495
|
+
import { useEffect as useEffect13 } from "react";
|
|
4336
4496
|
|
|
4337
4497
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4338
4498
|
import {
|
|
@@ -4340,9 +4500,9 @@ import {
|
|
|
4340
4500
|
createElement as createElement12,
|
|
4341
4501
|
memo as memo4
|
|
4342
4502
|
} from "react";
|
|
4343
|
-
import { useLayoutEffect as useLayoutEffect4, useState as
|
|
4503
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
|
|
4344
4504
|
function AvoidReactDiffFn(props) {
|
|
4345
|
-
const [children, setChildren] =
|
|
4505
|
+
const [children, setChildren] = useState8(props.updater.get());
|
|
4346
4506
|
useLayoutEffect4(() => {
|
|
4347
4507
|
const remove = props.updater.onChange((children2) => {
|
|
4348
4508
|
setChildren(children2);
|
|
@@ -4375,10 +4535,10 @@ var MappedItems = class extends Logger {
|
|
|
4375
4535
|
return result;
|
|
4376
4536
|
};
|
|
4377
4537
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4378
|
-
const
|
|
4538
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4379
4539
|
const result = [];
|
|
4380
|
-
for (const elementIndex in
|
|
4381
|
-
const itemIndex =
|
|
4540
|
+
for (const elementIndex in map2) {
|
|
4541
|
+
const itemIndex = map2[elementIndex];
|
|
4382
4542
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4383
4543
|
result.push(elementIndex >> 0);
|
|
4384
4544
|
}
|
|
@@ -4683,7 +4843,7 @@ function RawListFn(props) {
|
|
|
4683
4843
|
debugChannel
|
|
4684
4844
|
});
|
|
4685
4845
|
const getRenderItem = useLatest(renderItem);
|
|
4686
|
-
|
|
4846
|
+
useEffect13(() => {
|
|
4687
4847
|
const renderRange = brain.getRenderRange();
|
|
4688
4848
|
renderer.renderRange(renderRange, {
|
|
4689
4849
|
renderItem,
|
|
@@ -4691,7 +4851,7 @@ function RawListFn(props) {
|
|
|
4691
4851
|
onRender: onRenderUpdater
|
|
4692
4852
|
});
|
|
4693
4853
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4694
|
-
|
|
4854
|
+
useEffect13(() => {
|
|
4695
4855
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4696
4856
|
renderer.renderRange(renderRange, {
|
|
4697
4857
|
force: false,
|
|
@@ -4733,14 +4893,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4733
4893
|
columns: computedVisibleColumnsMap
|
|
4734
4894
|
});
|
|
4735
4895
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4736
|
-
|
|
4896
|
+
useEffect14(() => {
|
|
4737
4897
|
const onScroll = (scrollPosition) => {
|
|
4738
4898
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4739
4899
|
};
|
|
4740
4900
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4741
4901
|
return removeOnScroll;
|
|
4742
4902
|
}, [brain]);
|
|
4743
|
-
const domRef =
|
|
4903
|
+
const domRef = useRef9(null);
|
|
4744
4904
|
const headerCls = HeaderClsRecipe({
|
|
4745
4905
|
pinned: pinning,
|
|
4746
4906
|
overflow: false,
|
|
@@ -4763,7 +4923,7 @@ import {
|
|
|
4763
4923
|
createElement as createElement18,
|
|
4764
4924
|
memo as memo7,
|
|
4765
4925
|
useMemo as useMemo8,
|
|
4766
|
-
useRef as
|
|
4926
|
+
useRef as useRef10
|
|
4767
4927
|
} from "react";
|
|
4768
4928
|
|
|
4769
4929
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
@@ -4773,7 +4933,7 @@ import {
|
|
|
4773
4933
|
|
|
4774
4934
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4775
4935
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4776
|
-
const
|
|
4936
|
+
const map2 = new Map();
|
|
4777
4937
|
const temporaryMap = new Map();
|
|
4778
4938
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4779
4939
|
columns.forEach((col, index) => {
|
|
@@ -4791,7 +4951,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4791
4951
|
computedWidth: col.computedWidth,
|
|
4792
4952
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4793
4953
|
};
|
|
4794
|
-
|
|
4954
|
+
map2.set([colId], colItem);
|
|
4795
4955
|
let groupId = col.columnGroup;
|
|
4796
4956
|
let colGroupItem;
|
|
4797
4957
|
let prevGroupItem = colItem;
|
|
@@ -4813,7 +4973,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4813
4973
|
computedWidth: 0,
|
|
4814
4974
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4815
4975
|
};
|
|
4816
|
-
|
|
4976
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4817
4977
|
temporaryMap.set(groupId, colGroupItem);
|
|
4818
4978
|
}
|
|
4819
4979
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4830,7 +4990,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4830
4990
|
});
|
|
4831
4991
|
const result = [];
|
|
4832
4992
|
let groupOffset = 0;
|
|
4833
|
-
|
|
4993
|
+
map2.forEach((item) => {
|
|
4834
4994
|
if (!item.ref.columnGroup) {
|
|
4835
4995
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4836
4996
|
item.groupOffset = groupOffset;
|
|
@@ -4842,7 +5002,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4842
5002
|
groupOffset += itemWidth;
|
|
4843
5003
|
}
|
|
4844
5004
|
});
|
|
4845
|
-
|
|
5005
|
+
map2.clear();
|
|
4846
5006
|
temporaryMap.clear();
|
|
4847
5007
|
return result;
|
|
4848
5008
|
}
|
|
@@ -4941,7 +5101,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4941
5101
|
}
|
|
4942
5102
|
|
|
4943
5103
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4944
|
-
import { useEffect as
|
|
5104
|
+
import { useEffect as useEffect15 } from "react";
|
|
4945
5105
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4946
5106
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4947
5107
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4974,7 +5134,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4974
5134
|
},
|
|
4975
5135
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
4976
5136
|
} = useInfiniteTable();
|
|
4977
|
-
const domRef =
|
|
5137
|
+
const domRef = useRef10(null);
|
|
4978
5138
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
4979
5139
|
const columnHeaderGroups = useMemo8(() => {
|
|
4980
5140
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
@@ -5007,7 +5167,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5007
5167
|
if (totalWidth != null) {
|
|
5008
5168
|
style.width = availableWidth;
|
|
5009
5169
|
}
|
|
5010
|
-
|
|
5170
|
+
useEffect15(() => {
|
|
5011
5171
|
const scroller = brain || scrollListener;
|
|
5012
5172
|
if (!scroller || !scrollable) {
|
|
5013
5173
|
return;
|
|
@@ -5124,12 +5284,12 @@ import {
|
|
|
5124
5284
|
createElement as createElement20,
|
|
5125
5285
|
forwardRef as forwardRef2
|
|
5126
5286
|
} from "react";
|
|
5127
|
-
import { useRef as
|
|
5287
|
+
import { useRef as useRef11 } from "react";
|
|
5128
5288
|
|
|
5129
5289
|
// src/components/hooks/useOnScroll.ts
|
|
5130
|
-
import { useEffect as
|
|
5290
|
+
import { useEffect as useEffect16 } from "react";
|
|
5131
5291
|
var useOnScroll = (domRef, onScroll) => {
|
|
5132
|
-
|
|
5292
|
+
useEffect16(() => {
|
|
5133
5293
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5134
5294
|
const scrollFn = (event) => {
|
|
5135
5295
|
const node = event.target;
|
|
@@ -5175,7 +5335,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
|
|
|
5175
5335
|
className,
|
|
5176
5336
|
style
|
|
5177
5337
|
} = props;
|
|
5178
|
-
const domRef = ref != null ? ref :
|
|
5338
|
+
const domRef = ref != null ? ref : useRef11(null);
|
|
5179
5339
|
useOnScroll(domRef, onContainerScroll);
|
|
5180
5340
|
return /* @__PURE__ */ createElement20("div", {
|
|
5181
5341
|
ref: domRef,
|
|
@@ -5209,7 +5369,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5209
5369
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
5210
5370
|
|
|
5211
5371
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5212
|
-
import { useCallback as useCallback17, useEffect as
|
|
5372
|
+
import { useCallback as useCallback17, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
5213
5373
|
|
|
5214
5374
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5215
5375
|
import {
|
|
@@ -5228,7 +5388,7 @@ import {
|
|
|
5228
5388
|
Fragment as Fragment4,
|
|
5229
5389
|
createElement as createElement22
|
|
5230
5390
|
} from "react";
|
|
5231
|
-
import { useRef as
|
|
5391
|
+
import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
|
|
5232
5392
|
|
|
5233
5393
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5234
5394
|
var VirtualListCls = "mlx2t0 _16lm1iw0";
|
|
@@ -5271,11 +5431,11 @@ var VirtualList = (props) => {
|
|
|
5271
5431
|
"onContainerScroll",
|
|
5272
5432
|
"children"
|
|
5273
5433
|
]);
|
|
5274
|
-
const domRef =
|
|
5434
|
+
const domRef = useRef12(null);
|
|
5275
5435
|
const [, rerender] = useRerender();
|
|
5276
|
-
const [totalSize, setTotalSize] =
|
|
5277
|
-
const renderCountRef =
|
|
5278
|
-
|
|
5436
|
+
const [totalSize, setTotalSize] = useState9(0);
|
|
5437
|
+
const renderCountRef = useRef12(0);
|
|
5438
|
+
useEffect17(() => {
|
|
5279
5439
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5280
5440
|
renderCountRef.current = renderCount;
|
|
5281
5441
|
if (true) {
|
|
@@ -5294,7 +5454,7 @@ var VirtualList = (props) => {
|
|
|
5294
5454
|
removeOnTotalSizeChange();
|
|
5295
5455
|
};
|
|
5296
5456
|
}, [virtualBrain]);
|
|
5297
|
-
|
|
5457
|
+
useEffect17(() => {
|
|
5298
5458
|
const onScroll = (scrollPosition) => {
|
|
5299
5459
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5300
5460
|
};
|
|
@@ -5352,7 +5512,7 @@ import {
|
|
|
5352
5512
|
memo as memo10,
|
|
5353
5513
|
useCallback as useCallback11
|
|
5354
5514
|
} from "react";
|
|
5355
|
-
import { useRef as
|
|
5515
|
+
import { useRef as useRef14 } from "react";
|
|
5356
5516
|
|
|
5357
5517
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5358
5518
|
import {
|
|
@@ -5461,7 +5621,7 @@ var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
|
5461
5621
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5462
5622
|
import {
|
|
5463
5623
|
useCallback as useCallback10,
|
|
5464
|
-
useRef as
|
|
5624
|
+
useRef as useRef13
|
|
5465
5625
|
} from "react";
|
|
5466
5626
|
|
|
5467
5627
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
@@ -5487,7 +5647,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5487
5647
|
domRef: domRefFromProps,
|
|
5488
5648
|
rowInfo
|
|
5489
5649
|
} = props;
|
|
5490
|
-
const domRef =
|
|
5650
|
+
const domRef = useRef13(null);
|
|
5491
5651
|
const rowDOMRef = useCallback10((node) => {
|
|
5492
5652
|
domRefFromProps(node);
|
|
5493
5653
|
domRef.current = node;
|
|
@@ -5590,7 +5750,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5590
5750
|
width: rowWidth,
|
|
5591
5751
|
height: rowHeight
|
|
5592
5752
|
}, domProps.style);
|
|
5593
|
-
const renderCellRef =
|
|
5753
|
+
const renderCellRef = useRef14(null);
|
|
5594
5754
|
const renderCell = useCallback11(({ domRef, itemIndex }) => {
|
|
5595
5755
|
const column = columns[itemIndex];
|
|
5596
5756
|
if (!column) {
|
|
@@ -5763,7 +5923,7 @@ function useUnpinnedRendering(params) {
|
|
|
5763
5923
|
}
|
|
5764
5924
|
|
|
5765
5925
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5766
|
-
import { useCallback as useCallback13, useEffect as
|
|
5926
|
+
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
|
|
5767
5927
|
|
|
5768
5928
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5769
5929
|
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
@@ -5779,7 +5939,7 @@ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn
|
|
|
5779
5939
|
var DELAY = 200;
|
|
5780
5940
|
var TableClassName = internalProps.rootClassName;
|
|
5781
5941
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5782
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
5942
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5783
5943
|
var useOnContainerScroll = ({
|
|
5784
5944
|
verticalVirtualBrain,
|
|
5785
5945
|
horizontalVirtualBrain,
|
|
@@ -5795,10 +5955,11 @@ var useOnContainerScroll = ({
|
|
|
5795
5955
|
bodySize
|
|
5796
5956
|
}
|
|
5797
5957
|
} = useInfiniteTable();
|
|
5798
|
-
const
|
|
5799
|
-
const
|
|
5800
|
-
const
|
|
5801
|
-
|
|
5958
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5959
|
+
const timeoutIdRef = useRef15(0);
|
|
5960
|
+
const scrollingRef = useRef15(false);
|
|
5961
|
+
const scrollTopMaxRef = useRef15(0);
|
|
5962
|
+
useEffect18(() => {
|
|
5802
5963
|
const { current: node } = scrollerDOMRef;
|
|
5803
5964
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5804
5965
|
}, [reservedContentHeight, bodySize.height]);
|
|
@@ -5837,7 +5998,7 @@ var useOnContainerScroll = ({
|
|
|
5837
5998
|
domRef.current,
|
|
5838
5999
|
setScrolling
|
|
5839
6000
|
]);
|
|
5840
|
-
const scrollPositionRef =
|
|
6001
|
+
const scrollPositionRef = useRef15({
|
|
5841
6002
|
scrollLeft: 0,
|
|
5842
6003
|
scrollTop: 0
|
|
5843
6004
|
});
|
|
@@ -5855,6 +6016,9 @@ var useOnContainerScroll = ({
|
|
|
5855
6016
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5856
6017
|
if (isScrollBottom) {
|
|
5857
6018
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
6019
|
+
if (getDataSourceState().livePagination) {
|
|
6020
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
6021
|
+
}
|
|
5858
6022
|
}
|
|
5859
6023
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5860
6024
|
return {
|
|
@@ -5874,12 +6038,12 @@ import { useCallback as useCallback15 } from "react";
|
|
|
5874
6038
|
import {
|
|
5875
6039
|
createElement as createElement28
|
|
5876
6040
|
} from "react";
|
|
5877
|
-
import { useEffect as
|
|
6041
|
+
import { useEffect as useEffect20, useCallback as useCallback14, useRef as useRef16 } from "react";
|
|
5878
6042
|
|
|
5879
6043
|
// src/components/hooks/useOnMount.ts
|
|
5880
|
-
import { useEffect as
|
|
6044
|
+
import { useEffect as useEffect19 } from "react";
|
|
5881
6045
|
function useOnMount(domRef, props) {
|
|
5882
|
-
|
|
6046
|
+
useEffect19(() => {
|
|
5883
6047
|
const { onMount, onUnmount } = props;
|
|
5884
6048
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5885
6049
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5910,7 +6074,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5910
6074
|
onMount,
|
|
5911
6075
|
onUnmount
|
|
5912
6076
|
} = props;
|
|
5913
|
-
const domRef =
|
|
6077
|
+
const domRef = useRef16(null);
|
|
5914
6078
|
const renderItem = useCallback14((renderProps) => renderRow({
|
|
5915
6079
|
domRef: renderProps.domRef,
|
|
5916
6080
|
rowHeight: renderProps.itemSize,
|
|
@@ -5920,7 +6084,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5920
6084
|
onMount,
|
|
5921
6085
|
onUnmount
|
|
5922
6086
|
});
|
|
5923
|
-
|
|
6087
|
+
useEffect20(() => {
|
|
5924
6088
|
const onScroll = (scrollPosition) => {
|
|
5925
6089
|
const node = domRef.current;
|
|
5926
6090
|
if (node) {
|
|
@@ -6143,7 +6307,7 @@ function usePinnedStartRendering(params) {
|
|
|
6143
6307
|
}
|
|
6144
6308
|
|
|
6145
6309
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6146
|
-
import { useEffect as
|
|
6310
|
+
import { useEffect as useEffect21 } from "react";
|
|
6147
6311
|
|
|
6148
6312
|
// src/components/VirtualBrain/index.ts
|
|
6149
6313
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -6622,7 +6786,7 @@ function useYourBrain(param) {
|
|
|
6622
6786
|
});
|
|
6623
6787
|
return brain;
|
|
6624
6788
|
});
|
|
6625
|
-
|
|
6789
|
+
useEffect21(() => {
|
|
6626
6790
|
return () => {
|
|
6627
6791
|
horizontalVirtualBrain.destroy();
|
|
6628
6792
|
verticalVirtualBrain.destroy();
|
|
@@ -6630,13 +6794,13 @@ function useYourBrain(param) {
|
|
|
6630
6794
|
}, []);
|
|
6631
6795
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6632
6796
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6633
|
-
|
|
6797
|
+
useEffect21(() => {
|
|
6634
6798
|
verticalVirtualBrain.setAvailableSize({
|
|
6635
6799
|
height: bodySize.height,
|
|
6636
6800
|
width: 0
|
|
6637
6801
|
});
|
|
6638
6802
|
}, [bodySize, verticalVirtualBrain]);
|
|
6639
|
-
|
|
6803
|
+
useEffect21(() => {
|
|
6640
6804
|
horizontalVirtualBrain.setAvailableSize({
|
|
6641
6805
|
height: 0,
|
|
6642
6806
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6645,29 +6809,6 @@ function useYourBrain(param) {
|
|
|
6645
6809
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6646
6810
|
}
|
|
6647
6811
|
|
|
6648
|
-
// src/utils/shallowEqualObjects.ts
|
|
6649
|
-
function shallowEqualObjects(objA, objB) {
|
|
6650
|
-
if (objA === objB) {
|
|
6651
|
-
return true;
|
|
6652
|
-
}
|
|
6653
|
-
if (!objA || !objB) {
|
|
6654
|
-
return false;
|
|
6655
|
-
}
|
|
6656
|
-
var aKeys = Object.keys(objA);
|
|
6657
|
-
var bKeys = Object.keys(objB);
|
|
6658
|
-
var len = aKeys.length;
|
|
6659
|
-
if (bKeys.length !== len) {
|
|
6660
|
-
return false;
|
|
6661
|
-
}
|
|
6662
|
-
for (var i = 0; i < len; i++) {
|
|
6663
|
-
var key = aKeys[i];
|
|
6664
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6665
|
-
return false;
|
|
6666
|
-
}
|
|
6667
|
-
}
|
|
6668
|
-
return true;
|
|
6669
|
-
}
|
|
6670
|
-
|
|
6671
6812
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6672
6813
|
function useListRendering(param) {
|
|
6673
6814
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6697,7 +6838,7 @@ function useListRendering(param) {
|
|
|
6697
6838
|
pinnedEndScrollListener
|
|
6698
6839
|
} = componentState;
|
|
6699
6840
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6700
|
-
const repaintIdRef =
|
|
6841
|
+
const repaintIdRef = useRef17(0);
|
|
6701
6842
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6702
6843
|
repaintIdRef.current++;
|
|
6703
6844
|
}
|
|
@@ -6739,12 +6880,12 @@ function useListRendering(param) {
|
|
|
6739
6880
|
});
|
|
6740
6881
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6741
6882
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6742
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6883
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6743
6884
|
const scrollbars = useMemo10(() => ({
|
|
6744
6885
|
vertical: hasVerticalScrollbar,
|
|
6745
6886
|
horizontal: hasHorizontalScrollbar
|
|
6746
6887
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6747
|
-
|
|
6888
|
+
useEffect22(() => {
|
|
6748
6889
|
if (!bodySize.height) {
|
|
6749
6890
|
return;
|
|
6750
6891
|
}
|
|
@@ -6805,7 +6946,7 @@ function useListRendering(param) {
|
|
|
6805
6946
|
computedUnpinnedColumns
|
|
6806
6947
|
});
|
|
6807
6948
|
const [, rerender] = useRerender();
|
|
6808
|
-
|
|
6949
|
+
useEffect22(() => {
|
|
6809
6950
|
rerender();
|
|
6810
6951
|
}, [dataSourceState]);
|
|
6811
6952
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6832,9 +6973,9 @@ import {
|
|
|
6832
6973
|
createElement as createElement30,
|
|
6833
6974
|
forwardRef as forwardRef3,
|
|
6834
6975
|
useCallback as useCallback18,
|
|
6835
|
-
useRef as
|
|
6976
|
+
useRef as useRef18
|
|
6836
6977
|
} from "react";
|
|
6837
|
-
import { useEffect as
|
|
6978
|
+
import { useEffect as useEffect23 } from "react";
|
|
6838
6979
|
|
|
6839
6980
|
// src/components/utils/decamelize.ts
|
|
6840
6981
|
var import_decamelize = __toModule(require_decamelize());
|
|
@@ -6872,7 +7013,7 @@ var enforceStyle = (node, style) => {
|
|
|
6872
7013
|
};
|
|
6873
7014
|
var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6874
7015
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6875
|
-
const domRef =
|
|
7016
|
+
const domRef = useRef18(null);
|
|
6876
7017
|
const domCallback = useCallback18((node) => {
|
|
6877
7018
|
domRef.current = node;
|
|
6878
7019
|
if (!ref) {
|
|
@@ -6884,7 +7025,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6884
7025
|
ref.current = node;
|
|
6885
7026
|
}
|
|
6886
7027
|
}, []);
|
|
6887
|
-
|
|
7028
|
+
useEffect23(() => {
|
|
6888
7029
|
const forceStyle = () => {
|
|
6889
7030
|
requestAnimationFrame(() => {
|
|
6890
7031
|
var _a;
|
|
@@ -7065,7 +7206,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7065
7206
|
const valid = useMemo11(() => {
|
|
7066
7207
|
let valid2 = isValidLicense(licenseKey, {
|
|
7067
7208
|
publishedAt: 1624970570587,
|
|
7068
|
-
version: "0.0.
|
|
7209
|
+
version: "0.0.9"
|
|
7069
7210
|
});
|
|
7070
7211
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7071
7212
|
return true;
|
|
@@ -7081,7 +7222,7 @@ import {
|
|
|
7081
7222
|
useCallback as useCallback19,
|
|
7082
7223
|
useLayoutEffect as useLayoutEffect5
|
|
7083
7224
|
} from "react";
|
|
7084
|
-
import { useRef as
|
|
7225
|
+
import { useRef as useRef19 } from "react";
|
|
7085
7226
|
var error = err("CSSVariableWatch");
|
|
7086
7227
|
var debug5 = dbg("CSSVariableWatch");
|
|
7087
7228
|
var WRAPPER_STYLE = {
|
|
@@ -7094,7 +7235,7 @@ var WRAPPER_STYLE = {
|
|
|
7094
7235
|
overflow: "hidden"
|
|
7095
7236
|
};
|
|
7096
7237
|
var useCSSVariableWatch = (params) => {
|
|
7097
|
-
const lastValueRef =
|
|
7238
|
+
const lastValueRef = useRef19(0);
|
|
7098
7239
|
const onResize = useCallback19(({ height }) => {
|
|
7099
7240
|
if (height && height !== lastValueRef.current) {
|
|
7100
7241
|
lastValueRef.current = height;
|
|
@@ -7114,7 +7255,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7114
7255
|
}, []);
|
|
7115
7256
|
};
|
|
7116
7257
|
var CSSVariableWatch = (props) => {
|
|
7117
|
-
const domRef =
|
|
7258
|
+
const domRef = useRef19(null);
|
|
7118
7259
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7119
7260
|
ref: domRef
|
|
7120
7261
|
}));
|
|
@@ -7259,9 +7400,15 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7259
7400
|
});
|
|
7260
7401
|
var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
7261
7402
|
var _a;
|
|
7262
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
7263
7403
|
const {
|
|
7264
|
-
componentState
|
|
7404
|
+
componentState,
|
|
7405
|
+
getComputed,
|
|
7406
|
+
computed,
|
|
7407
|
+
getState: getInfiniteTableState
|
|
7408
|
+
} = useInfiniteTable();
|
|
7409
|
+
const {
|
|
7410
|
+
componentState: { dataArray, loading },
|
|
7411
|
+
getState: getDataSourceState
|
|
7265
7412
|
} = useDataSourceContextValue();
|
|
7266
7413
|
const {
|
|
7267
7414
|
domRef,
|
|
@@ -7298,6 +7445,15 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7298
7445
|
const licenseValid = useLicense(licenseKey);
|
|
7299
7446
|
const domProps = useDOMProps(componentState.domProps);
|
|
7300
7447
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7448
|
+
useLayoutEffect6(() => {
|
|
7449
|
+
const dataSourceState = getDataSourceState();
|
|
7450
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7451
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7452
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7453
|
+
onScrollbarsChange(scrollbars);
|
|
7454
|
+
}
|
|
7455
|
+
notifyScrollbarsChange(scrollbars);
|
|
7456
|
+
}, [scrollbars]);
|
|
7301
7457
|
return /* @__PURE__ */ createElement33("div", __spreadValues({
|
|
7302
7458
|
ref: domRef
|
|
7303
7459
|
}, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
|
|
@@ -7329,7 +7485,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7329
7485
|
});
|
|
7330
7486
|
function InfiniteTableContextProvider() {
|
|
7331
7487
|
const { componentActions, componentState } = useComponentState();
|
|
7332
|
-
const { scrollerDOMRef } = componentState;
|
|
7488
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7333
7489
|
const computed = useComputed();
|
|
7334
7490
|
const getComputed = useLatest(computed);
|
|
7335
7491
|
const getState = useLatest(componentState);
|
|
@@ -7358,12 +7514,17 @@ function InfiniteTableContextProvider() {
|
|
|
7358
7514
|
}
|
|
7359
7515
|
componentActions.bodySize = bodySize;
|
|
7360
7516
|
}, { earlyAttach: true });
|
|
7361
|
-
|
|
7517
|
+
useEffect24(() => {
|
|
7362
7518
|
return () => {
|
|
7363
7519
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7364
7520
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7365
7521
|
};
|
|
7366
7522
|
}, []);
|
|
7523
|
+
useEffect24(() => {
|
|
7524
|
+
if (scrollerDOMRef.current) {
|
|
7525
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7526
|
+
}
|
|
7527
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7367
7528
|
const TableContext2 = getInfiniteTableContext();
|
|
7368
7529
|
return /* @__PURE__ */ createElement33(TableContext2.Provider, {
|
|
7369
7530
|
value: contextValue
|
|
@@ -7388,6 +7549,7 @@ export {
|
|
|
7388
7549
|
getComponentStateRoot,
|
|
7389
7550
|
group,
|
|
7390
7551
|
interceptMap,
|
|
7552
|
+
multisort,
|
|
7391
7553
|
useComponentState,
|
|
7392
7554
|
useDataSource
|
|
7393
7555
|
};
|