@infinite-table/infinite-react 0.0.8 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +3 -5
- package/index.d.ts +259 -167
- package/index.esm.css +3 -5
- package/index.esm.js +825 -600
- package/index.js +889 -663
- package/package.json +3 -4
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({
|
|
@@ -636,44 +616,13 @@ var require_binary_search = __commonJS({
|
|
|
636
616
|
}
|
|
637
617
|
});
|
|
638
618
|
|
|
639
|
-
// node_modules/decamelize/index.js
|
|
640
|
-
var require_decamelize = __commonJS({
|
|
641
|
-
"node_modules/decamelize/index.js"(exports, module) {
|
|
642
|
-
"use strict";
|
|
643
|
-
var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
|
|
644
|
-
decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
|
|
645
|
-
return $0.toLowerCase();
|
|
646
|
-
});
|
|
647
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
|
|
648
|
-
return $1 + separator + $2.toLowerCase();
|
|
649
|
-
});
|
|
650
|
-
};
|
|
651
|
-
module.exports = (text, {
|
|
652
|
-
separator = "_",
|
|
653
|
-
preserveConsecutiveUppercase = false
|
|
654
|
-
} = {}) => {
|
|
655
|
-
if (!(typeof text === "string" && typeof separator === "string")) {
|
|
656
|
-
throw new TypeError("The `text` and `separator` arguments should be of type `string`");
|
|
657
|
-
}
|
|
658
|
-
if (text.length < 2) {
|
|
659
|
-
return preserveConsecutiveUppercase ? text : text.toLowerCase();
|
|
660
|
-
}
|
|
661
|
-
const replacement = `$1${separator}$2`;
|
|
662
|
-
const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
|
|
663
|
-
if (preserveConsecutiveUppercase) {
|
|
664
|
-
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
665
|
-
}
|
|
666
|
-
return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
|
|
671
619
|
// src/components/InfiniteTable/index.tsx
|
|
672
620
|
import {
|
|
673
621
|
StrictMode,
|
|
674
622
|
createElement as createElement33,
|
|
675
623
|
memo as memo13,
|
|
676
|
-
useEffect as
|
|
624
|
+
useEffect as useEffect24,
|
|
625
|
+
useLayoutEffect as useLayoutEffect6
|
|
677
626
|
} from "react";
|
|
678
627
|
|
|
679
628
|
// src/components/InfiniteTable/internalProps.ts
|
|
@@ -754,9 +703,20 @@ var ScrollListener = class {
|
|
|
754
703
|
}
|
|
755
704
|
};
|
|
756
705
|
|
|
706
|
+
// src/components/InfiniteTable/utils/toMap.ts
|
|
707
|
+
function toMap(mapOrObject) {
|
|
708
|
+
if (!mapOrObject) {
|
|
709
|
+
return new Map();
|
|
710
|
+
}
|
|
711
|
+
if (mapOrObject instanceof Map) {
|
|
712
|
+
return mapOrObject;
|
|
713
|
+
}
|
|
714
|
+
return new Map(Object.entries(mapOrObject));
|
|
715
|
+
}
|
|
716
|
+
|
|
757
717
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
758
718
|
function computeColumnGroupsDepths(columnGroups) {
|
|
759
|
-
const
|
|
719
|
+
const map2 = new Map();
|
|
760
720
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
761
721
|
let parentGroupId = colGroup.columnGroup;
|
|
762
722
|
let depth = 0;
|
|
@@ -771,20 +731,14 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
771
731
|
depth++;
|
|
772
732
|
parentGroupId = parent.columnGroup;
|
|
773
733
|
}
|
|
774
|
-
|
|
734
|
+
map2.set(colGroupId, depth);
|
|
775
735
|
});
|
|
776
|
-
return
|
|
736
|
+
return map2;
|
|
777
737
|
}
|
|
778
738
|
|
|
779
739
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
780
|
-
function
|
|
781
|
-
|
|
782
|
-
return new Map();
|
|
783
|
-
}
|
|
784
|
-
if (mapOrObject instanceof Map) {
|
|
785
|
-
return mapOrObject;
|
|
786
|
-
}
|
|
787
|
-
return new Map(Object.entries(mapOrObject));
|
|
740
|
+
function toColumnTypesMap(mapOrObject) {
|
|
741
|
+
return toMap(mapOrObject);
|
|
788
742
|
}
|
|
789
743
|
function initSetupState() {
|
|
790
744
|
const columnsGeneratedForGrouping = new Map();
|
|
@@ -819,6 +773,7 @@ var forwardProps = () => {
|
|
|
819
773
|
var _a;
|
|
820
774
|
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
821
775
|
},
|
|
776
|
+
scrollTopId: 1,
|
|
822
777
|
components: 1,
|
|
823
778
|
loadingText: 1,
|
|
824
779
|
pivotColumns: 1,
|
|
@@ -844,12 +799,14 @@ var forwardProps = () => {
|
|
|
844
799
|
pivotColumn: 1,
|
|
845
800
|
pivotRowLabelsColumn: 1,
|
|
846
801
|
pivotColumnGroups: 1,
|
|
802
|
+
onScrollbarsChange: 1,
|
|
847
803
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
848
804
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
849
805
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
850
806
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
851
807
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
852
808
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
809
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
853
810
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
854
811
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
855
812
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
@@ -861,7 +818,10 @@ var forwardProps = () => {
|
|
|
861
818
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
862
819
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
863
820
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
864
|
-
columnVisibility: (columnVisibility) =>
|
|
821
|
+
columnVisibility: (columnVisibility) => {
|
|
822
|
+
var _a;
|
|
823
|
+
return (_a = toMap(columnVisibility)) != null ? _a : new Map();
|
|
824
|
+
},
|
|
865
825
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
866
826
|
columnSizing: (columnSizing) => {
|
|
867
827
|
var _a;
|
|
@@ -869,23 +829,22 @@ var forwardProps = () => {
|
|
|
869
829
|
},
|
|
870
830
|
columnTypes: (columnTypes) => {
|
|
871
831
|
var _a;
|
|
872
|
-
return (_a =
|
|
832
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
873
833
|
},
|
|
874
|
-
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
875
834
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
876
835
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
877
836
|
};
|
|
878
837
|
};
|
|
879
838
|
function getGroupRenderStrategy(options) {
|
|
880
|
-
const {
|
|
839
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
881
840
|
if (groupRenderStrategy) {
|
|
882
841
|
return groupRenderStrategy;
|
|
883
842
|
}
|
|
884
843
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
885
844
|
return "single-column";
|
|
886
845
|
}
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
846
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
847
|
+
if (columnsInGroupBy.length) {
|
|
889
848
|
return "multi-column";
|
|
890
849
|
}
|
|
891
850
|
return "multi-column";
|
|
@@ -896,16 +855,17 @@ var mapPropsToState = (params) => {
|
|
|
896
855
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
897
856
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
898
857
|
const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != (oldState == null ? void 0 : oldState.columnGroups) || state.pivotColumnGroups && state.pivotColumnGroups != (oldState == null ? void 0 : oldState.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
|
|
899
|
-
const
|
|
858
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
900
859
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
901
860
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
902
|
-
|
|
861
|
+
groupBy,
|
|
903
862
|
groupColumn: props.groupColumn
|
|
904
863
|
});
|
|
864
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
905
865
|
return {
|
|
906
866
|
groupRenderStrategy,
|
|
907
|
-
|
|
908
|
-
computedColumns
|
|
867
|
+
groupBy,
|
|
868
|
+
computedColumns,
|
|
909
869
|
virtualizeHeader,
|
|
910
870
|
columnGroupsDepthsMap,
|
|
911
871
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1317,8 +1277,8 @@ var getComputedVisibleColumns = ({
|
|
|
1317
1277
|
const colTypeSizing = {
|
|
1318
1278
|
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1319
1279
|
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1320
|
-
width: colType == null ? void 0 : colType.
|
|
1321
|
-
flex: colType == null ? void 0 : colType.
|
|
1280
|
+
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1281
|
+
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1322
1282
|
};
|
|
1323
1283
|
let colSizing = columnSizing.get(colId) || {};
|
|
1324
1284
|
if (colSizing.width != null) {
|
|
@@ -1371,7 +1331,7 @@ var getComputedVisibleColumns = ({
|
|
|
1371
1331
|
});
|
|
1372
1332
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
1373
1333
|
columnsArray.forEach((c, i) => {
|
|
1374
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1334
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1375
1335
|
const id = visibleColumnOrder[i];
|
|
1376
1336
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1377
1337
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -1432,6 +1392,7 @@ var getComputedVisibleColumns = ({
|
|
|
1432
1392
|
const result2 = __spreadProps(__spreadValues({
|
|
1433
1393
|
align: colType.align,
|
|
1434
1394
|
verticalAlign: colType.verticalAlign,
|
|
1395
|
+
valueGetter: colType.valueGetter,
|
|
1435
1396
|
renderValue: colType.renderValue,
|
|
1436
1397
|
render: colType.render
|
|
1437
1398
|
}, c), {
|
|
@@ -1439,7 +1400,7 @@ var getComputedVisibleColumns = ({
|
|
|
1439
1400
|
computedAbsoluteOffset,
|
|
1440
1401
|
computedPinningOffset,
|
|
1441
1402
|
computedOffset,
|
|
1442
|
-
computedSortable: (_e = (_d = c.sortable) != null ? _d : sortable) != null ? _e : true,
|
|
1403
|
+
computedSortable: (_f = (_e = (_d = c.sortable) != null ? _d : colType.sortable) != null ? _e : sortable) != null ? _f : true,
|
|
1443
1404
|
computedSortInfo,
|
|
1444
1405
|
computedSortIndex,
|
|
1445
1406
|
computedMultiSort: multiSort,
|
|
@@ -1448,14 +1409,14 @@ var getComputedVisibleColumns = ({
|
|
|
1448
1409
|
computedSortedDesc,
|
|
1449
1410
|
computedVisibleIndex: i,
|
|
1450
1411
|
computedPinned,
|
|
1451
|
-
computedDraggable: (
|
|
1412
|
+
computedDraggable: (_h = (_g = c.draggable) != null ? _g : draggableColumns) != null ? _h : true,
|
|
1452
1413
|
computedFirstInCategory,
|
|
1453
1414
|
computedLastInCategory,
|
|
1454
1415
|
computedFirst: i === 0,
|
|
1455
1416
|
computedLast,
|
|
1456
1417
|
toggleSort,
|
|
1457
1418
|
id,
|
|
1458
|
-
header: (
|
|
1419
|
+
header: (_k = (_j = (_i = c.header) != null ? _i : colType.header) != null ? _j : c.name) != null ? _k : c.field
|
|
1459
1420
|
});
|
|
1460
1421
|
computedOffset += computedWidth;
|
|
1461
1422
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -1512,28 +1473,28 @@ var useRerender = () => {
|
|
|
1512
1473
|
|
|
1513
1474
|
// src/components/hooks/useInterceptedMap.ts
|
|
1514
1475
|
import { useEffect as useEffect2 } from "react";
|
|
1515
|
-
function interceptMap(
|
|
1516
|
-
const { set, delete: deleteKey, clear } =
|
|
1476
|
+
function interceptMap(map2, fns) {
|
|
1477
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1517
1478
|
if (fns.set) {
|
|
1518
|
-
|
|
1519
|
-
set.call(
|
|
1479
|
+
map2.set = (key, value) => {
|
|
1480
|
+
set.call(map2, key, value);
|
|
1520
1481
|
fns.set(key, value);
|
|
1521
|
-
return
|
|
1482
|
+
return map2;
|
|
1522
1483
|
};
|
|
1523
1484
|
}
|
|
1524
1485
|
if (fns.delete) {
|
|
1525
|
-
|
|
1526
|
-
const removed = deleteKey.call(
|
|
1486
|
+
map2.delete = (key) => {
|
|
1487
|
+
const removed = deleteKey.call(map2, key);
|
|
1527
1488
|
fns.delete(key);
|
|
1528
1489
|
return removed;
|
|
1529
1490
|
};
|
|
1530
1491
|
}
|
|
1531
1492
|
if (fns.clear || fns.beforeClear) {
|
|
1532
|
-
|
|
1493
|
+
map2.clear = () => {
|
|
1533
1494
|
if (fns.beforeClear) {
|
|
1534
|
-
fns.beforeClear(
|
|
1495
|
+
fns.beforeClear(map2);
|
|
1535
1496
|
}
|
|
1536
|
-
const result = clear.call(
|
|
1497
|
+
const result = clear.call(map2);
|
|
1537
1498
|
if (fns.clear) {
|
|
1538
1499
|
fns.clear();
|
|
1539
1500
|
}
|
|
@@ -1542,13 +1503,13 @@ function interceptMap(map, fns) {
|
|
|
1542
1503
|
}
|
|
1543
1504
|
return () => {
|
|
1544
1505
|
if (set) {
|
|
1545
|
-
|
|
1506
|
+
map2.set = set;
|
|
1546
1507
|
}
|
|
1547
1508
|
if (deleteKey) {
|
|
1548
|
-
|
|
1509
|
+
map2.delete = deleteKey;
|
|
1549
1510
|
}
|
|
1550
1511
|
if (clear) {
|
|
1551
|
-
|
|
1512
|
+
map2.clear = clear;
|
|
1552
1513
|
}
|
|
1553
1514
|
};
|
|
1554
1515
|
}
|
|
@@ -1568,16 +1529,16 @@ var rafFn = (fn) => {
|
|
|
1568
1529
|
};
|
|
1569
1530
|
|
|
1570
1531
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1571
|
-
var useRerenderOnKeyChange = (
|
|
1532
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1572
1533
|
const [renderId, rerender] = useRerender();
|
|
1573
1534
|
useEffect3(() => {
|
|
1574
1535
|
const update = rafFn(rerender);
|
|
1575
|
-
return interceptMap(
|
|
1536
|
+
return interceptMap(map2, {
|
|
1576
1537
|
set: update,
|
|
1577
1538
|
clear: update,
|
|
1578
1539
|
delete: update
|
|
1579
1540
|
});
|
|
1580
|
-
}, [
|
|
1541
|
+
}, [map2]);
|
|
1581
1542
|
return renderId;
|
|
1582
1543
|
};
|
|
1583
1544
|
|
|
@@ -1691,48 +1652,17 @@ var useComputedVisibleColumns = ({
|
|
|
1691
1652
|
var sortAscending = (a, b) => a - b;
|
|
1692
1653
|
|
|
1693
1654
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1694
|
-
import { useCallback as useCallback5, useState as
|
|
1695
|
-
|
|
1696
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1697
|
-
import { useEffect as useEffect5 } from "react";
|
|
1698
|
-
|
|
1699
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1700
|
-
import {
|
|
1701
|
-
useContext as useContext2
|
|
1702
|
-
} from "react";
|
|
1703
|
-
|
|
1704
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1705
|
-
import {
|
|
1706
|
-
createContext as createContext2
|
|
1707
|
-
} from "react";
|
|
1708
|
-
var DSContext;
|
|
1709
|
-
function getDataSourceContext() {
|
|
1710
|
-
if (DSContext) {
|
|
1711
|
-
return DSContext;
|
|
1712
|
-
}
|
|
1713
|
-
return DSContext = createContext2({
|
|
1714
|
-
getState: () => null,
|
|
1715
|
-
componentState: null,
|
|
1716
|
-
componentActions: null
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1721
|
-
function useDataSourceActions() {
|
|
1722
|
-
const DataSourceContext = getDataSourceContext();
|
|
1723
|
-
const contextValue = useContext2(DataSourceContext);
|
|
1724
|
-
return contextValue.componentActions;
|
|
1725
|
-
}
|
|
1655
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useState as useState5 } from "react";
|
|
1726
1656
|
|
|
1727
1657
|
// src/components/hooks/useComponentState.tsx
|
|
1728
1658
|
import {
|
|
1729
1659
|
createElement as createElement2,
|
|
1730
1660
|
memo,
|
|
1731
|
-
useContext as
|
|
1661
|
+
useContext as useContext2
|
|
1732
1662
|
} from "react";
|
|
1733
1663
|
import {
|
|
1734
1664
|
useReducer,
|
|
1735
|
-
createContext as
|
|
1665
|
+
createContext as createContext2,
|
|
1736
1666
|
useMemo as useMemo3,
|
|
1737
1667
|
useEffect as useEffect4,
|
|
1738
1668
|
useState as useState2,
|
|
@@ -1812,9 +1742,9 @@ function getComponentStateContext() {
|
|
|
1812
1742
|
if (ComponentContext) {
|
|
1813
1743
|
return ComponentContext;
|
|
1814
1744
|
}
|
|
1815
|
-
return ComponentContext =
|
|
1745
|
+
return ComponentContext = createContext2(null);
|
|
1816
1746
|
}
|
|
1817
|
-
function
|
|
1747
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1818
1748
|
const state = getState();
|
|
1819
1749
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1820
1750
|
const key = stateKey;
|
|
@@ -1826,6 +1756,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1826
1756
|
return;
|
|
1827
1757
|
}
|
|
1828
1758
|
notifyChange(props, stateKey, value);
|
|
1759
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1760
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1761
|
+
}
|
|
1829
1762
|
const forwardFn = propsToForward[key];
|
|
1830
1763
|
if (typeof forwardFn === "function") {
|
|
1831
1764
|
value = forwardFn(value);
|
|
@@ -1938,7 +1871,7 @@ function getComponentStateRoot(config) {
|
|
|
1938
1871
|
const getComponentState = useLatest(state);
|
|
1939
1872
|
const { allowedControlledPropOverrides } = config;
|
|
1940
1873
|
const actions = useMemo3(() => {
|
|
1941
|
-
const generatedActions =
|
|
1874
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1942
1875
|
return generatedActions;
|
|
1943
1876
|
}, [
|
|
1944
1877
|
dispatch,
|
|
@@ -1968,7 +1901,7 @@ function getComponentStateRoot(config) {
|
|
|
1968
1901
|
if (oldValue === newValue) {
|
|
1969
1902
|
continue;
|
|
1970
1903
|
}
|
|
1971
|
-
if (isControlled(key, props)) {
|
|
1904
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1972
1905
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1973
1906
|
let valueToSet = newValue;
|
|
1974
1907
|
const forwardFn = propsToForward[k];
|
|
@@ -2005,56 +1938,44 @@ function getComponentStateRoot(config) {
|
|
|
2005
1938
|
}
|
|
2006
1939
|
function useComponentState() {
|
|
2007
1940
|
const Context = getComponentStateContext();
|
|
2008
|
-
return
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
2012
|
-
function useColumnAggregations() {
|
|
2013
|
-
const {
|
|
2014
|
-
componentState: { columnAggregations },
|
|
2015
|
-
getComponentState
|
|
2016
|
-
} = useComponentState();
|
|
2017
|
-
const dataSourceActions = useDataSourceActions();
|
|
2018
|
-
useEffect5(() => {
|
|
2019
|
-
function updateDataSourceAggregations() {
|
|
2020
|
-
const reducers = [];
|
|
2021
|
-
const componentState = getComponentState();
|
|
2022
|
-
columnAggregations.forEach((aggregator, key) => {
|
|
2023
|
-
var _a;
|
|
2024
|
-
const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
|
|
2025
|
-
const newAggregator = __spreadValues({
|
|
2026
|
-
getter: (data) => colField ? data[colField] : data
|
|
2027
|
-
}, aggregator);
|
|
2028
|
-
reducers.push(newAggregator);
|
|
2029
|
-
});
|
|
2030
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
2031
|
-
}
|
|
2032
|
-
updateDataSourceAggregations();
|
|
2033
|
-
return interceptMap(columnAggregations, {
|
|
2034
|
-
clear: updateDataSourceAggregations,
|
|
2035
|
-
delete: updateDataSourceAggregations,
|
|
2036
|
-
set: updateDataSourceAggregations
|
|
2037
|
-
});
|
|
2038
|
-
}, [columnAggregations]);
|
|
1941
|
+
return useContext2(Context);
|
|
2039
1942
|
}
|
|
2040
1943
|
|
|
2041
1944
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2042
1945
|
import {
|
|
2043
|
-
useContext as
|
|
1946
|
+
useContext as useContext3
|
|
2044
1947
|
} from "react";
|
|
1948
|
+
|
|
1949
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1950
|
+
import {
|
|
1951
|
+
createContext as createContext3
|
|
1952
|
+
} from "react";
|
|
1953
|
+
var DSContext;
|
|
1954
|
+
function getDataSourceContext() {
|
|
1955
|
+
if (DSContext) {
|
|
1956
|
+
return DSContext;
|
|
1957
|
+
}
|
|
1958
|
+
return DSContext = createContext3({
|
|
1959
|
+
getState: () => null,
|
|
1960
|
+
componentState: null,
|
|
1961
|
+
componentActions: null
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2045
1966
|
function useDataSource() {
|
|
2046
1967
|
const DataSourceContext = getDataSourceContext();
|
|
2047
|
-
const contextValue =
|
|
1968
|
+
const contextValue = useContext3(DataSourceContext);
|
|
2048
1969
|
return contextValue.componentState;
|
|
2049
1970
|
}
|
|
2050
1971
|
function useDataSourceContextValue() {
|
|
2051
1972
|
const DataSourceContext = getDataSourceContext();
|
|
2052
|
-
const contextValue =
|
|
1973
|
+
const contextValue = useContext3(DataSourceContext);
|
|
2053
1974
|
return contextValue;
|
|
2054
1975
|
}
|
|
2055
1976
|
|
|
2056
1977
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
2057
|
-
import { useEffect as
|
|
1978
|
+
import { useEffect as useEffect5 } from "react";
|
|
2058
1979
|
function useColumnGroups() {
|
|
2059
1980
|
const {
|
|
2060
1981
|
componentState: {
|
|
@@ -2064,7 +1985,7 @@ function useColumnGroups() {
|
|
|
2064
1985
|
componentActions,
|
|
2065
1986
|
getComponentState
|
|
2066
1987
|
} = useComponentState();
|
|
2067
|
-
|
|
1988
|
+
useEffect5(() => {
|
|
2068
1989
|
const recompute = () => {
|
|
2069
1990
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
2070
1991
|
};
|
|
@@ -2075,7 +1996,7 @@ function useColumnGroups() {
|
|
|
2075
1996
|
set: update
|
|
2076
1997
|
});
|
|
2077
1998
|
}, [computedColumnGroups]);
|
|
2078
|
-
|
|
1999
|
+
useEffect5(() => {
|
|
2079
2000
|
return interceptMap(collapsedColumnGroups, {
|
|
2080
2001
|
set: (key, visibleCol) => {
|
|
2081
2002
|
const colIds = key.slice(1);
|
|
@@ -2107,7 +2028,7 @@ function useColumnGroups() {
|
|
|
2107
2028
|
}
|
|
2108
2029
|
|
|
2109
2030
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2110
|
-
import { useEffect as
|
|
2031
|
+
import { useEffect as useEffect9, useMemo as useMemo5 } from "react";
|
|
2111
2032
|
|
|
2112
2033
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2113
2034
|
import {
|
|
@@ -2120,27 +2041,14 @@ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
|
2120
2041
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2121
2042
|
import {
|
|
2122
2043
|
createElement as createElement3,
|
|
2123
|
-
useEffect as
|
|
2044
|
+
useEffect as useEffect6
|
|
2124
2045
|
} from "react";
|
|
2125
2046
|
import { useState as useState3 } from "react";
|
|
2126
2047
|
|
|
2127
|
-
// src/components/InfiniteTable/
|
|
2128
|
-
var
|
|
2129
|
-
var
|
|
2130
|
-
var
|
|
2131
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2132
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2133
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2134
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2135
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2136
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2137
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2138
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2139
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2140
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2141
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2142
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2143
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2048
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2049
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2050
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2051
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2144
2052
|
|
|
2145
2053
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2146
2054
|
function ExpanderIcon(props) {
|
|
@@ -2154,7 +2062,7 @@ function ExpanderIcon(props) {
|
|
|
2154
2062
|
setExpanded(!expanded);
|
|
2155
2063
|
}
|
|
2156
2064
|
};
|
|
2157
|
-
|
|
2065
|
+
useEffect6(() => {
|
|
2158
2066
|
if (isControlled("expanded", props)) {
|
|
2159
2067
|
setExpanded(props.expanded);
|
|
2160
2068
|
}
|
|
@@ -2167,18 +2075,37 @@ function ExpanderIcon(props) {
|
|
|
2167
2075
|
width: `${size}px`,
|
|
2168
2076
|
style: props.style,
|
|
2169
2077
|
onClick,
|
|
2170
|
-
className: join(props.className,
|
|
2078
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2079
|
+
expanded
|
|
2080
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2171
2081
|
}, /* @__PURE__ */ createElement3("path", {
|
|
2172
2082
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2173
2083
|
}));
|
|
2174
2084
|
}
|
|
2175
2085
|
|
|
2176
2086
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2177
|
-
var
|
|
2087
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2178
2088
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2179
|
-
var RowClsRecipe = (0,
|
|
2089
|
+
var RowClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2180
2090
|
var RowHoverCls = "_7pupv01";
|
|
2181
2091
|
|
|
2092
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2093
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2094
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2095
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2096
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2097
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2098
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2099
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2100
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2101
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2102
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2103
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2104
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2105
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2106
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2107
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2108
|
+
|
|
2182
2109
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2183
2110
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2184
2111
|
if (!pivotColumns) {
|
|
@@ -2188,7 +2115,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2188
2115
|
pivotColumn,
|
|
2189
2116
|
pivotRowLabelsColumn,
|
|
2190
2117
|
pivotBy,
|
|
2191
|
-
|
|
2118
|
+
groupBy,
|
|
2192
2119
|
pivotTotalColumnPosition,
|
|
2193
2120
|
toggleGroupRow
|
|
2194
2121
|
} = params;
|
|
@@ -2205,7 +2132,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2205
2132
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2206
2133
|
column,
|
|
2207
2134
|
pivotBy,
|
|
2208
|
-
|
|
2135
|
+
groupBy
|
|
2209
2136
|
}));
|
|
2210
2137
|
} else {
|
|
2211
2138
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2217,7 +2144,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2217
2144
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2218
2145
|
column,
|
|
2219
2146
|
pivotBy,
|
|
2220
|
-
|
|
2147
|
+
groupBy
|
|
2221
2148
|
}));
|
|
2222
2149
|
} else {
|
|
2223
2150
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2226,11 +2153,11 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2226
2153
|
if (!column.render) {
|
|
2227
2154
|
column.render = (renderOptions) => {
|
|
2228
2155
|
var _a;
|
|
2229
|
-
let { value, rowInfo, column: column2,
|
|
2156
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2230
2157
|
if (column2.renderValue) {
|
|
2231
2158
|
value = column2.renderValue(renderOptions);
|
|
2232
2159
|
}
|
|
2233
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2160
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2234
2161
|
return /* @__PURE__ */ createElement4("div", {
|
|
2235
2162
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2236
2163
|
}, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
|
|
@@ -2330,7 +2257,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2330
2257
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2331
2258
|
let generatedGroupColumn = {
|
|
2332
2259
|
header: `Group`,
|
|
2333
|
-
groupByField: options.
|
|
2260
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2334
2261
|
sortable: false,
|
|
2335
2262
|
render: (renderOptions) => {
|
|
2336
2263
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2371,62 +2298,231 @@ import {
|
|
|
2371
2298
|
createElement as createElement6
|
|
2372
2299
|
} from "react";
|
|
2373
2300
|
|
|
2374
|
-
// src/
|
|
2375
|
-
|
|
2301
|
+
// src/utils/multisort/sortTypes.ts
|
|
2302
|
+
var numberComparator = function(first, second) {
|
|
2303
|
+
return first - second;
|
|
2304
|
+
};
|
|
2305
|
+
var stringComparator = function(first, second) {
|
|
2306
|
+
first = `${first}`;
|
|
2307
|
+
second = `${second}`;
|
|
2308
|
+
return first.localeCompare(second);
|
|
2309
|
+
};
|
|
2310
|
+
var sortTypes = {
|
|
2311
|
+
number: numberComparator,
|
|
2312
|
+
string: stringComparator
|
|
2313
|
+
};
|
|
2314
|
+
var sortTypes_default = sortTypes;
|
|
2376
2315
|
|
|
2377
|
-
// src/
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2316
|
+
// src/utils/multisort/index.ts
|
|
2317
|
+
var multisort = (sortInfo, array, get) => {
|
|
2318
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2319
|
+
return array;
|
|
2320
|
+
};
|
|
2321
|
+
multisort.knownTypes = sortTypes_default;
|
|
2322
|
+
var getSingleSortFunction = (info) => {
|
|
2323
|
+
if (!info) {
|
|
2324
|
+
return;
|
|
2384
2325
|
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2326
|
+
const field = info.field;
|
|
2327
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2328
|
+
if (!dir) {
|
|
2329
|
+
return;
|
|
2330
|
+
}
|
|
2331
|
+
let fn = info.fn;
|
|
2332
|
+
if (!fn && info.type) {
|
|
2333
|
+
fn = multisort.knownTypes[info.type];
|
|
2334
|
+
if (!fn) {
|
|
2335
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
if (!fn) {
|
|
2339
|
+
fn = sortTypes_default.string;
|
|
2340
|
+
}
|
|
2341
|
+
return (first, second) => {
|
|
2342
|
+
const a = field ? first[field] : first;
|
|
2343
|
+
const b = field ? second[field] : second;
|
|
2344
|
+
return dir * fn(a, b);
|
|
2387
2345
|
};
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2346
|
+
};
|
|
2347
|
+
var getSortFunctions = (sortInfo) => {
|
|
2348
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2349
|
+
};
|
|
2350
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2351
|
+
const fns = getSortFunctions(sortInfo);
|
|
2352
|
+
return (first, second) => {
|
|
2353
|
+
if (get) {
|
|
2354
|
+
first = get(first);
|
|
2355
|
+
second = get(second);
|
|
2395
2356
|
}
|
|
2396
|
-
|
|
2397
|
-
|
|
2357
|
+
let result = 0;
|
|
2358
|
+
let i = 0;
|
|
2359
|
+
let fn;
|
|
2360
|
+
const len = fns.length;
|
|
2361
|
+
for (; i < len; i++) {
|
|
2362
|
+
fn = fns[i];
|
|
2363
|
+
if (!fn) {
|
|
2364
|
+
continue;
|
|
2365
|
+
}
|
|
2366
|
+
result = fn(first, second);
|
|
2367
|
+
if (result !== 0) {
|
|
2368
|
+
return result;
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
return result;
|
|
2372
|
+
};
|
|
2373
|
+
};
|
|
2374
|
+
|
|
2375
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2376
|
+
import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
2377
|
+
|
|
2378
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2379
|
+
import { useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
2380
|
+
function useEffectWithChanges(fn, deps) {
|
|
2381
|
+
const prevRef = useRef5({});
|
|
2382
|
+
const oldValuesRef = useRef5({});
|
|
2383
|
+
const oldValues = oldValuesRef.current;
|
|
2384
|
+
const changesRef = useRef5({});
|
|
2385
|
+
const changes = changesRef.current;
|
|
2386
|
+
const useEffectDeps = [];
|
|
2387
|
+
for (let k in deps) {
|
|
2388
|
+
if (deps.hasOwnProperty(k)) {
|
|
2389
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2390
|
+
changes[k] = deps[k];
|
|
2391
|
+
oldValues[k] = prevRef.current[k];
|
|
2392
|
+
}
|
|
2393
|
+
useEffectDeps.push(deps[k]);
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
prevRef.current = deps;
|
|
2397
|
+
useEffect7(() => {
|
|
2398
|
+
const changes2 = changesRef.current;
|
|
2399
|
+
const result = fn(changes2, oldValues);
|
|
2400
|
+
changesRef.current = {};
|
|
2401
|
+
oldValuesRef.current = {};
|
|
2402
|
+
return result;
|
|
2403
|
+
}, useEffectDeps);
|
|
2398
2404
|
}
|
|
2399
2405
|
|
|
2400
2406
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2401
|
-
function
|
|
2402
|
-
|
|
2407
|
+
function buildDataSourceDataParams(componentState) {
|
|
2408
|
+
var _a, _b;
|
|
2409
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2410
|
+
const dataSourceParams = {
|
|
2411
|
+
originalDataArray: componentState.originalDataArray,
|
|
2412
|
+
sortInfo,
|
|
2413
|
+
groupBy: componentState.groupBy,
|
|
2414
|
+
pivotBy: componentState.pivotBy
|
|
2415
|
+
};
|
|
2416
|
+
if (componentState.livePagination !== void 0) {
|
|
2417
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2418
|
+
}
|
|
2419
|
+
return dataSourceParams;
|
|
2420
|
+
}
|
|
2421
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2422
|
+
var _a;
|
|
2423
|
+
if (typeof componentState.data === "function") {
|
|
2424
|
+
loadData(componentState.data, componentState, actions);
|
|
2425
|
+
}
|
|
2426
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2427
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2428
|
+
}
|
|
2429
|
+
function loadData(data, componentState, actions) {
|
|
2430
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2431
|
+
if (typeof data === "function") {
|
|
2432
|
+
data = data(dataParams);
|
|
2433
|
+
}
|
|
2434
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2435
|
+
if (dataIsPromise) {
|
|
2436
|
+
actions.loading = true;
|
|
2437
|
+
}
|
|
2438
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2439
|
+
let dataArray = [];
|
|
2440
|
+
if (Array.isArray(dataParam.data)) {
|
|
2441
|
+
const remoteData = dataParam;
|
|
2442
|
+
dataArray = remoteData.data;
|
|
2443
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2444
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2445
|
+
}
|
|
2446
|
+
} else {
|
|
2447
|
+
dataArray = dataParam;
|
|
2448
|
+
}
|
|
2449
|
+
actions.originalDataArray = dataArray;
|
|
2450
|
+
if (dataIsPromise) {
|
|
2451
|
+
actions.loading = false;
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2403
2454
|
}
|
|
2404
2455
|
function useLoadData() {
|
|
2405
2456
|
const {
|
|
2457
|
+
getComponentState,
|
|
2406
2458
|
componentActions: actions,
|
|
2407
2459
|
componentState: { data }
|
|
2408
2460
|
} = 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
2461
|
useLayoutEffect3(() => {
|
|
2428
|
-
loadData(data);
|
|
2462
|
+
loadData(data, getComponentState(), actions);
|
|
2429
2463
|
}, [data]);
|
|
2464
|
+
useLivePagination();
|
|
2465
|
+
}
|
|
2466
|
+
function useLivePagination() {
|
|
2467
|
+
const {
|
|
2468
|
+
getComponentState,
|
|
2469
|
+
componentActions: actions,
|
|
2470
|
+
componentState
|
|
2471
|
+
} = useComponentState();
|
|
2472
|
+
const {
|
|
2473
|
+
notifyScrollbarsChange,
|
|
2474
|
+
sortInfo,
|
|
2475
|
+
groupBy,
|
|
2476
|
+
pivotBy,
|
|
2477
|
+
livePaginationCursor,
|
|
2478
|
+
scrollBottomId
|
|
2479
|
+
} = componentState;
|
|
2480
|
+
const [scrollbars, setScrollbars] = useState4({
|
|
2481
|
+
vertical: false,
|
|
2482
|
+
horizontal: false
|
|
2483
|
+
});
|
|
2484
|
+
const scrollbarsRef = useRef6(scrollbars);
|
|
2485
|
+
useEffect8(() => {
|
|
2486
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2487
|
+
if (!scrollbars2) {
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
scrollbarsRef.current = scrollbars2;
|
|
2491
|
+
setScrollbars(scrollbars2);
|
|
2492
|
+
});
|
|
2493
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2494
|
+
}, [notifyScrollbarsChange]);
|
|
2495
|
+
const [cursorId, updateCursorId] = useState4(void 0);
|
|
2496
|
+
useEffect8(() => {
|
|
2497
|
+
const frameId = requestAnimationFrame(() => {
|
|
2498
|
+
var _a;
|
|
2499
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2500
|
+
updateCursorId(livePaginationCursor);
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
return () => cancelAnimationFrame(frameId);
|
|
2504
|
+
}, [livePaginationCursor]);
|
|
2505
|
+
useEffect8(() => {
|
|
2506
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2507
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2508
|
+
updateCursorId(livePaginationCursor2);
|
|
2509
|
+
}
|
|
2510
|
+
}, [scrollbars.vertical]);
|
|
2511
|
+
useEffect8(() => {
|
|
2512
|
+
updateCursorId(scrollBottomId);
|
|
2513
|
+
}, [scrollBottomId]);
|
|
2514
|
+
const depsObject = {
|
|
2515
|
+
sortInfo,
|
|
2516
|
+
groupBy,
|
|
2517
|
+
pivotBy,
|
|
2518
|
+
cursorId
|
|
2519
|
+
};
|
|
2520
|
+
useEffectWithChanges(() => {
|
|
2521
|
+
if (cursorId === void 0) {
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2524
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2525
|
+
}, depsObject);
|
|
2430
2526
|
}
|
|
2431
2527
|
|
|
2432
2528
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2480,9 +2576,9 @@ var DeepMap = class {
|
|
|
2480
2576
|
if (!pair) {
|
|
2481
2577
|
return;
|
|
2482
2578
|
}
|
|
2483
|
-
const { map } = pair;
|
|
2579
|
+
const { map: map2 } = pair;
|
|
2484
2580
|
const keys = [...parentKeys, key];
|
|
2485
|
-
const next =
|
|
2581
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2486
2582
|
if (pair.hasOwnProperty("value")) {
|
|
2487
2583
|
fn(pair.value, keys, i, next);
|
|
2488
2584
|
i++;
|
|
@@ -2498,6 +2594,13 @@ var DeepMap = class {
|
|
|
2498
2594
|
});
|
|
2499
2595
|
}
|
|
2500
2596
|
}
|
|
2597
|
+
static clone(map2) {
|
|
2598
|
+
const clone = new DeepMap();
|
|
2599
|
+
map2.visit((pair, keys) => {
|
|
2600
|
+
clone.set(keys, pair.value);
|
|
2601
|
+
});
|
|
2602
|
+
return clone;
|
|
2603
|
+
}
|
|
2501
2604
|
set(keys, value) {
|
|
2502
2605
|
let currentMap = this.map;
|
|
2503
2606
|
if (!keys.length) {
|
|
@@ -2548,14 +2651,14 @@ var DeepMap = class {
|
|
|
2548
2651
|
return this.length;
|
|
2549
2652
|
}
|
|
2550
2653
|
clear() {
|
|
2551
|
-
const clearMap = (
|
|
2552
|
-
|
|
2553
|
-
const { map:
|
|
2554
|
-
if (
|
|
2555
|
-
clearMap(
|
|
2654
|
+
const clearMap = (map2) => {
|
|
2655
|
+
map2.forEach((value, _key) => {
|
|
2656
|
+
const { map: map3 } = value;
|
|
2657
|
+
if (map3) {
|
|
2658
|
+
clearMap(map3);
|
|
2556
2659
|
}
|
|
2557
2660
|
});
|
|
2558
|
-
|
|
2661
|
+
map2.clear();
|
|
2559
2662
|
};
|
|
2560
2663
|
clearMap(this.map);
|
|
2561
2664
|
this.length = 0;
|
|
@@ -2600,9 +2703,9 @@ var DeepMap = class {
|
|
|
2600
2703
|
}
|
|
2601
2704
|
}
|
|
2602
2705
|
while (maps.length) {
|
|
2603
|
-
let
|
|
2706
|
+
let map2 = maps.pop();
|
|
2604
2707
|
let key = keys.pop();
|
|
2605
|
-
if (key && (
|
|
2708
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2606
2709
|
let parentMap = maps[maps.length - 1];
|
|
2607
2710
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2608
2711
|
if (pair) {
|
|
@@ -2641,12 +2744,12 @@ var DeepMap = class {
|
|
|
2641
2744
|
if (!pair) {
|
|
2642
2745
|
return;
|
|
2643
2746
|
}
|
|
2644
|
-
const { map } = pair;
|
|
2747
|
+
const { map: map2 } = pair;
|
|
2645
2748
|
const keys = [...parentKeys, key];
|
|
2646
2749
|
const next = once(() => {
|
|
2647
|
-
if (
|
|
2648
|
-
|
|
2649
|
-
this.visitKey(k,
|
|
2750
|
+
if (map2) {
|
|
2751
|
+
map2.forEach((_, k) => {
|
|
2752
|
+
this.visitKey(k, map2, keys, fn);
|
|
2650
2753
|
});
|
|
2651
2754
|
}
|
|
2652
2755
|
});
|
|
@@ -2812,14 +2915,69 @@ var GroupRowsState = class {
|
|
|
2812
2915
|
}
|
|
2813
2916
|
};
|
|
2814
2917
|
|
|
2918
|
+
// src/utils/shallowEqualObjects.ts
|
|
2919
|
+
function shallowEqualObjects(objA, objB) {
|
|
2920
|
+
if (objA === objB) {
|
|
2921
|
+
return true;
|
|
2922
|
+
}
|
|
2923
|
+
if (!objA || !objB) {
|
|
2924
|
+
return false;
|
|
2925
|
+
}
|
|
2926
|
+
var aKeys = Object.keys(objA);
|
|
2927
|
+
var bKeys = Object.keys(objB);
|
|
2928
|
+
var len = aKeys.length;
|
|
2929
|
+
if (bKeys.length !== len) {
|
|
2930
|
+
return false;
|
|
2931
|
+
}
|
|
2932
|
+
for (var i = 0; i < len; i++) {
|
|
2933
|
+
var key = aKeys[i];
|
|
2934
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2935
|
+
return false;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
return true;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2942
|
+
var map = new WeakMap();
|
|
2943
|
+
var getCompareDefault = (a) => a;
|
|
2944
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2945
|
+
map.set(fn, {
|
|
2946
|
+
lastCallTime: 0,
|
|
2947
|
+
lastCallArg: null
|
|
2948
|
+
});
|
|
2949
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2950
|
+
return (arg) => {
|
|
2951
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2952
|
+
lastCallTime: 0,
|
|
2953
|
+
lastCallArg: null
|
|
2954
|
+
};
|
|
2955
|
+
const now = Date.now();
|
|
2956
|
+
const diff = now - lastCallTime;
|
|
2957
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2958
|
+
if (diff < timeframe && objectsEqual) {
|
|
2959
|
+
return;
|
|
2960
|
+
}
|
|
2961
|
+
map.set(fn, {
|
|
2962
|
+
lastCallTime: now,
|
|
2963
|
+
lastCallArg: arg
|
|
2964
|
+
});
|
|
2965
|
+
fn(arg);
|
|
2966
|
+
};
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2815
2969
|
// src/components/DataSource/state/getInitialState.ts
|
|
2816
2970
|
function initSetupState2() {
|
|
2817
2971
|
const now = Date.now();
|
|
2818
2972
|
const originalDataArray = [];
|
|
2819
2973
|
const dataArray = [];
|
|
2820
2974
|
return {
|
|
2975
|
+
dataParams: void 0,
|
|
2976
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2821
2977
|
pivotTotalColumnPosition: "end",
|
|
2822
2978
|
originalDataArray,
|
|
2979
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2980
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
2823
2981
|
pivotColumns: void 0,
|
|
2824
2982
|
pivotColumnGroups: void 0,
|
|
2825
2983
|
dataArray,
|
|
@@ -2828,7 +2986,6 @@ function initSetupState2() {
|
|
|
2828
2986
|
sortedAt: 0,
|
|
2829
2987
|
reducedAt: now,
|
|
2830
2988
|
generateGroupRows: true,
|
|
2831
|
-
aggregationReducers: void 0,
|
|
2832
2989
|
groupDeepMap: void 0,
|
|
2833
2990
|
postSortDataArray: void 0,
|
|
2834
2991
|
postGroupDataArray: void 0,
|
|
@@ -2836,15 +2993,23 @@ function initSetupState2() {
|
|
|
2836
2993
|
lastGroupDataArray: void 0
|
|
2837
2994
|
};
|
|
2838
2995
|
}
|
|
2996
|
+
function getCompareObject(dataParams) {
|
|
2997
|
+
const obj = __spreadValues({}, dataParams);
|
|
2998
|
+
delete obj.originalDataArray;
|
|
2999
|
+
return obj;
|
|
3000
|
+
}
|
|
2839
3001
|
var forwardProps3 = () => {
|
|
2840
3002
|
return {
|
|
2841
|
-
|
|
3003
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2842
3004
|
data: 1,
|
|
2843
3005
|
pivotBy: 1,
|
|
2844
3006
|
primaryKey: 1,
|
|
3007
|
+
livePagination: 1,
|
|
3008
|
+
livePaginationCursor: 1,
|
|
3009
|
+
aggregationReducers: 1,
|
|
2845
3010
|
loading: (loading) => loading != null ? loading : false,
|
|
2846
3011
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2847
|
-
|
|
3012
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
2848
3013
|
groupRowsState: (groupRowsState) => {
|
|
2849
3014
|
return groupRowsState || new GroupRowsState({
|
|
2850
3015
|
expandedRows: true,
|
|
@@ -2854,10 +3019,20 @@ var forwardProps3 = () => {
|
|
|
2854
3019
|
};
|
|
2855
3020
|
};
|
|
2856
3021
|
function mapPropsToState2(params) {
|
|
2857
|
-
var _a;
|
|
2858
3022
|
const { props } = params;
|
|
3023
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2859
3024
|
return {
|
|
2860
|
-
|
|
3025
|
+
controlledSort,
|
|
3026
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
function getInterceptActions() {
|
|
3030
|
+
return {
|
|
3031
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3032
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3033
|
+
dataParams.sortInfo = sortInfo;
|
|
3034
|
+
actions.dataParams = dataParams;
|
|
3035
|
+
}
|
|
2861
3036
|
};
|
|
2862
3037
|
}
|
|
2863
3038
|
|
|
@@ -2866,19 +3041,28 @@ function DEFAULT_TO_KEY(value) {
|
|
|
2866
3041
|
return value;
|
|
2867
3042
|
}
|
|
2868
3043
|
function initReducers(reducers) {
|
|
2869
|
-
if (!reducers || !reducers.length) {
|
|
2870
|
-
return
|
|
3044
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3045
|
+
return {};
|
|
2871
3046
|
}
|
|
2872
|
-
|
|
3047
|
+
const result = {};
|
|
3048
|
+
for (let key in reducers)
|
|
3049
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3050
|
+
result[key] = reducers[key].initialValue;
|
|
3051
|
+
}
|
|
3052
|
+
return result;
|
|
2873
3053
|
}
|
|
2874
3054
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
2875
|
-
|
|
3055
|
+
var _a, _b;
|
|
3056
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
2876
3057
|
return;
|
|
2877
3058
|
}
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
3059
|
+
for (let key in reducers)
|
|
3060
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3061
|
+
const reducer = reducers[key];
|
|
3062
|
+
const currentValue = reducerResults[key];
|
|
3063
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3064
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3065
|
+
}
|
|
2882
3066
|
}
|
|
2883
3067
|
function group(groupParams, data) {
|
|
2884
3068
|
const {
|
|
@@ -2893,7 +3077,7 @@ function group(groupParams, data) {
|
|
|
2893
3077
|
let currentGroupKeys = [];
|
|
2894
3078
|
let currentPivotKeys = [];
|
|
2895
3079
|
const initialReducerValue = initReducers(reducers);
|
|
2896
|
-
const globalReducerResults =
|
|
3080
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2897
3081
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
2898
3082
|
let item = data[i];
|
|
2899
3083
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -2903,7 +3087,7 @@ function group(groupParams, data) {
|
|
|
2903
3087
|
if (!deepMap.has(currentGroupKeys)) {
|
|
2904
3088
|
const deepMapGroupValue = {
|
|
2905
3089
|
items: [],
|
|
2906
|
-
reducerResults:
|
|
3090
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
2907
3091
|
};
|
|
2908
3092
|
if (pivot) {
|
|
2909
3093
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -2927,7 +3111,7 @@ function group(groupParams, data) {
|
|
|
2927
3111
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
2928
3112
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
2929
3113
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
2930
|
-
reducerResults:
|
|
3114
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
2931
3115
|
items: []
|
|
2932
3116
|
});
|
|
2933
3117
|
}
|
|
@@ -2989,11 +3173,23 @@ function flatten(groupResult) {
|
|
|
2989
3173
|
return result;
|
|
2990
3174
|
}
|
|
2991
3175
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
2992
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
3176
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
2993
3177
|
const groupNesting = groupKeys.length;
|
|
2994
3178
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3179
|
+
let data = null;
|
|
3180
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
3181
|
+
data = {};
|
|
3182
|
+
for (let key in reducers)
|
|
3183
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3184
|
+
const reducer = reducers[key];
|
|
3185
|
+
const field = reducer.field;
|
|
3186
|
+
if (field) {
|
|
3187
|
+
data[field] = reducerResults[key];
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
2995
3191
|
const enhancedGroupData = {
|
|
2996
|
-
data
|
|
3192
|
+
data,
|
|
2997
3193
|
groupCount: groupItems.length,
|
|
2998
3194
|
groupData: groupItems,
|
|
2999
3195
|
groupKeys,
|
|
@@ -3015,17 +3211,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
3015
3211
|
return enhancedGroupData;
|
|
3016
3212
|
}
|
|
3017
3213
|
function completeReducers(reducers, reducerResults, items) {
|
|
3018
|
-
if (reducers
|
|
3019
|
-
|
|
3020
|
-
if (
|
|
3021
|
-
|
|
3214
|
+
if (reducers) {
|
|
3215
|
+
for (let key in reducers)
|
|
3216
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3217
|
+
const reducer = reducers[key];
|
|
3218
|
+
if (reducer.done) {
|
|
3219
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
3220
|
+
}
|
|
3022
3221
|
}
|
|
3023
|
-
});
|
|
3024
3222
|
}
|
|
3025
3223
|
return reducerResults;
|
|
3026
3224
|
}
|
|
3027
3225
|
function enhancedFlatten(param) {
|
|
3028
|
-
const {
|
|
3226
|
+
const {
|
|
3227
|
+
groupResult,
|
|
3228
|
+
toPrimaryKey,
|
|
3229
|
+
groupRowsState,
|
|
3230
|
+
generateGroupRows,
|
|
3231
|
+
reducers = {}
|
|
3232
|
+
} = param;
|
|
3029
3233
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
3030
3234
|
const { groupBy } = groupParams;
|
|
3031
3235
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -3040,6 +3244,7 @@ function enhancedFlatten(param) {
|
|
|
3040
3244
|
const enhancedGroupData = getEnhancedGroupData({
|
|
3041
3245
|
groupBy: groupByStrings,
|
|
3042
3246
|
parents: Array.from(parents),
|
|
3247
|
+
reducers,
|
|
3043
3248
|
indexInGroup,
|
|
3044
3249
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3045
3250
|
indexInAll: result.length,
|
|
@@ -3091,88 +3296,46 @@ function enhancedFlatten(param) {
|
|
|
3091
3296
|
};
|
|
3092
3297
|
}
|
|
3093
3298
|
|
|
3094
|
-
// src/utils/
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
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(", ")}`);
|
|
3299
|
+
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3300
|
+
function prepareColumn(column) {
|
|
3301
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3302
|
+
if (pivotByForColumn.column) {
|
|
3303
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3304
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3305
|
+
} else {
|
|
3306
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3129
3307
|
}
|
|
3130
3308
|
}
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
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
|
-
}
|
|
3309
|
+
return column;
|
|
3310
|
+
}
|
|
3311
|
+
function prepareColumnGroup(columnGroup) {
|
|
3312
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3313
|
+
if (pivotByForColumnGroup.columnGroup) {
|
|
3314
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3315
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3316
|
+
} else {
|
|
3317
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3163
3318
|
}
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
}
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3319
|
+
}
|
|
3320
|
+
return columnGroup;
|
|
3321
|
+
}
|
|
3322
|
+
function getPivotColumnsAndColumnGroups({
|
|
3323
|
+
deepMap,
|
|
3324
|
+
pivotBy,
|
|
3325
|
+
pivotTotalColumnPosition,
|
|
3326
|
+
reducers = {},
|
|
3327
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3328
|
+
}) {
|
|
3170
3329
|
const pivotLength = pivotBy.length;
|
|
3330
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3331
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3332
|
+
});
|
|
3171
3333
|
const columns = new Map([
|
|
3172
3334
|
[
|
|
3173
3335
|
"labels",
|
|
3174
3336
|
{
|
|
3175
3337
|
header: "Row labels",
|
|
3338
|
+
pivotBy,
|
|
3176
3339
|
valueGetter: (params) => {
|
|
3177
3340
|
var _a;
|
|
3178
3341
|
const { rowInfo } = params;
|
|
@@ -3182,72 +3345,104 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3182
3345
|
]
|
|
3183
3346
|
]);
|
|
3184
3347
|
const columnGroups = new Map();
|
|
3348
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3185
3349
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3186
3350
|
keys = [...keys];
|
|
3187
3351
|
if (pivotTotalColumnPosition === "end") {
|
|
3188
3352
|
next == null ? void 0 : next();
|
|
3189
3353
|
}
|
|
3190
3354
|
if (keys.length === pivotLength) {
|
|
3191
|
-
const parentKeys = keys.slice(0, -1);
|
|
3192
|
-
let columnGroupId = parentKeys.join("/");
|
|
3193
3355
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3194
|
-
let computedPivotColumn = __spreadValues({
|
|
3195
|
-
pivotBy,
|
|
3196
|
-
pivotColumn: true,
|
|
3197
|
-
pivotGroupKeys: keys,
|
|
3198
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3199
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3200
|
-
pivotByForColumn,
|
|
3201
|
-
sortable: false,
|
|
3202
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3203
|
-
header: keys[keys.length - 1],
|
|
3204
|
-
valueGetter: ({ rowInfo }) => {
|
|
3205
|
-
var _a, _b, _c;
|
|
3206
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3207
|
-
return value;
|
|
3208
|
-
}
|
|
3209
|
-
}, pivotByForColumn.column);
|
|
3210
|
-
if (pivotByForColumn.column) {
|
|
3211
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3212
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3213
|
-
} else {
|
|
3214
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3215
|
-
}
|
|
3216
|
-
}
|
|
3217
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3218
|
-
} else {
|
|
3219
|
-
const colGroupId = keys.join("/");
|
|
3220
3356
|
const parentKeys = keys.slice(0, -1);
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
columnGroup:
|
|
3229
|
-
|
|
3230
|
-
pivotTotalColumn: true,
|
|
3357
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3358
|
+
if (!isSingleAggregationColumn) {
|
|
3359
|
+
const columnGroupId = parentColumnGroupId;
|
|
3360
|
+
parentColumnGroupId = keys.join("/");
|
|
3361
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3362
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3363
|
+
header: pivotGroupKey,
|
|
3364
|
+
columnGroup: columnGroupId,
|
|
3365
|
+
pivotBy,
|
|
3231
3366
|
pivotGroupKeys: keys,
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3367
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3368
|
+
pivotIndex: keys.length - 1,
|
|
3369
|
+
pivotGroupKey
|
|
3370
|
+
}));
|
|
3371
|
+
}
|
|
3372
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3373
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3374
|
+
const computedPivotColumn = prepareColumn({
|
|
3235
3375
|
pivotBy,
|
|
3376
|
+
pivotColumn: true,
|
|
3377
|
+
pivotTotalColumn: false,
|
|
3378
|
+
pivotAggregator: reducer,
|
|
3379
|
+
pivotAggregatorIndex: index,
|
|
3380
|
+
pivotGroupKeys: keys,
|
|
3381
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3382
|
+
pivotIndex: keys.length - 1,
|
|
3383
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3236
3384
|
sortable: false,
|
|
3385
|
+
columnGroup: parentColumnGroupId,
|
|
3386
|
+
header,
|
|
3237
3387
|
valueGetter: ({ rowInfo }) => {
|
|
3238
|
-
var _a, _b
|
|
3239
|
-
|
|
3240
|
-
return value;
|
|
3241
|
-
}
|
|
3242
|
-
}, pivotByForColumn.column);
|
|
3243
|
-
if (pivotByForColumn.column) {
|
|
3244
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3245
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3246
|
-
} else {
|
|
3247
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3388
|
+
var _a, _b;
|
|
3389
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3248
3390
|
}
|
|
3391
|
+
});
|
|
3392
|
+
const columnId = `${keys.join("/")}-${reducer.id}`;
|
|
3393
|
+
columns.set(columnId, computedPivotColumn);
|
|
3394
|
+
});
|
|
3395
|
+
} else {
|
|
3396
|
+
const colGroupId = keys.join("/");
|
|
3397
|
+
const parentKeys = keys.slice(0, -1);
|
|
3398
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3399
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3400
|
+
header: keys[keys.length - 1],
|
|
3401
|
+
pivotBy,
|
|
3402
|
+
pivotGroupKeys: keys,
|
|
3403
|
+
pivotIndex: keys.length - 1,
|
|
3404
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3405
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3406
|
+
}));
|
|
3407
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3408
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3409
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3410
|
+
if (!isSingleAggregationColumn) {
|
|
3411
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3412
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3413
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3414
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3415
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3416
|
+
pivotBy,
|
|
3417
|
+
pivotTotalColumnGroup: true,
|
|
3418
|
+
pivotGroupKeys: keys,
|
|
3419
|
+
pivotIndex: keys.length - 1,
|
|
3420
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3421
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3422
|
+
}));
|
|
3249
3423
|
}
|
|
3250
|
-
|
|
3424
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3425
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3426
|
+
const computedPivotColumn = prepareColumn({
|
|
3427
|
+
columnGroup: columnGroupId,
|
|
3428
|
+
header,
|
|
3429
|
+
pivotAggregator: reducer,
|
|
3430
|
+
pivotAggregatorIndex: index,
|
|
3431
|
+
pivotColumn: true,
|
|
3432
|
+
pivotTotalColumn: true,
|
|
3433
|
+
pivotGroupKeys: keys,
|
|
3434
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3435
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3436
|
+
pivotIndex: keys.length - 1,
|
|
3437
|
+
pivotBy,
|
|
3438
|
+
sortable: false,
|
|
3439
|
+
valueGetter: ({ rowInfo }) => {
|
|
3440
|
+
var _a, _b;
|
|
3441
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3442
|
+
}
|
|
3443
|
+
});
|
|
3444
|
+
columns.set(`total:${keys.join("/")}-${reducer.id}`, computedPivotColumn);
|
|
3445
|
+
});
|
|
3251
3446
|
}
|
|
3252
3447
|
}
|
|
3253
3448
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3257,9 +3452,12 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3257
3452
|
if (columns.size === 1) {
|
|
3258
3453
|
columns.set("single", {
|
|
3259
3454
|
header: "Reduced",
|
|
3455
|
+
pivotBy,
|
|
3456
|
+
pivotColumn: true,
|
|
3260
3457
|
valueGetter: ({ rowInfo }) => {
|
|
3261
3458
|
var _a;
|
|
3262
|
-
|
|
3459
|
+
const key = Object.keys(rowInfo.reducerResults || {})[0];
|
|
3460
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[key];
|
|
3263
3461
|
}
|
|
3264
3462
|
});
|
|
3265
3463
|
}
|
|
@@ -3283,29 +3481,37 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3283
3481
|
return false;
|
|
3284
3482
|
};
|
|
3285
3483
|
function toRowInfo(data, id, index) {
|
|
3286
|
-
return {
|
|
3484
|
+
return {
|
|
3485
|
+
data,
|
|
3486
|
+
collapsed: true,
|
|
3487
|
+
id,
|
|
3488
|
+
indexInAll: index,
|
|
3489
|
+
indexInGroup: index,
|
|
3490
|
+
isGroupRow: false
|
|
3491
|
+
};
|
|
3287
3492
|
}
|
|
3288
3493
|
function concludeReducer(params) {
|
|
3289
3494
|
var _a;
|
|
3290
3495
|
const { state, previousState } = params;
|
|
3291
3496
|
const sortInfo = state.sortInfo;
|
|
3292
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3497
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3293
3498
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3294
3499
|
"originalDataArray",
|
|
3295
3500
|
"sortInfo"
|
|
3296
3501
|
]);
|
|
3297
3502
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3298
|
-
const groupBy = state.
|
|
3503
|
+
const groupBy = state.groupBy;
|
|
3299
3504
|
const pivotBy = state.pivotBy;
|
|
3300
3505
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3301
3506
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3302
3507
|
"generateGroupRows",
|
|
3303
3508
|
"originalDataArray",
|
|
3304
|
-
"
|
|
3509
|
+
"groupBy",
|
|
3305
3510
|
"groupRowsState",
|
|
3306
3511
|
"pivotBy",
|
|
3307
3512
|
"aggregationReducers",
|
|
3308
3513
|
"pivotTotalColumnPosition",
|
|
3514
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3309
3515
|
"sortInfo"
|
|
3310
3516
|
]);
|
|
3311
3517
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3331,13 +3537,20 @@ function concludeReducer(params) {
|
|
|
3331
3537
|
}, dataArray);
|
|
3332
3538
|
const flattenResult = enhancedFlatten({
|
|
3333
3539
|
groupResult,
|
|
3540
|
+
reducers: state.aggregationReducers,
|
|
3334
3541
|
toPrimaryKey,
|
|
3335
3542
|
groupRowsState: state.groupRowsState,
|
|
3336
3543
|
generateGroupRows: state.generateGroupRows
|
|
3337
3544
|
});
|
|
3338
3545
|
rowInfoDataArray = flattenResult.data;
|
|
3339
3546
|
state.groupDeepMap = groupResult.deepMap;
|
|
3340
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3547
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3548
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3549
|
+
pivotBy,
|
|
3550
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3551
|
+
reducers: state.aggregationReducers,
|
|
3552
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3553
|
+
}) : void 0;
|
|
3341
3554
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3342
3555
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3343
3556
|
} else {
|
|
@@ -3359,7 +3572,9 @@ function concludeReducer(params) {
|
|
|
3359
3572
|
}
|
|
3360
3573
|
state.dataArray = rowInfoDataArray;
|
|
3361
3574
|
state.reducedAt = now;
|
|
3362
|
-
|
|
3575
|
+
if (true) {
|
|
3576
|
+
globalThis.state = state;
|
|
3577
|
+
}
|
|
3363
3578
|
return state;
|
|
3364
3579
|
}
|
|
3365
3580
|
|
|
@@ -3382,7 +3597,8 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3382
3597
|
initSetupState: initSetupState2,
|
|
3383
3598
|
forwardProps: forwardProps3,
|
|
3384
3599
|
concludeReducer,
|
|
3385
|
-
mapPropsToState: mapPropsToState2
|
|
3600
|
+
mapPropsToState: mapPropsToState2,
|
|
3601
|
+
interceptActions: getInterceptActions()
|
|
3386
3602
|
});
|
|
3387
3603
|
function DataSourceCmp({ children }) {
|
|
3388
3604
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3421,49 +3637,49 @@ function useToggleGroupRow() {
|
|
|
3421
3637
|
}
|
|
3422
3638
|
|
|
3423
3639
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3424
|
-
function
|
|
3425
|
-
const
|
|
3426
|
-
return
|
|
3427
|
-
acc.set(
|
|
3428
|
-
groupBy,
|
|
3640
|
+
function useGroupByMap(groupBy) {
|
|
3641
|
+
const groupByMap = useMemo5(() => {
|
|
3642
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3643
|
+
acc.set(groupBy2.field, {
|
|
3644
|
+
groupBy: groupBy2,
|
|
3429
3645
|
groupIndex: index
|
|
3430
3646
|
});
|
|
3431
3647
|
return acc;
|
|
3432
3648
|
}, new Map());
|
|
3433
|
-
}, [
|
|
3434
|
-
return
|
|
3649
|
+
}, [groupBy]);
|
|
3650
|
+
return groupByMap;
|
|
3435
3651
|
}
|
|
3436
3652
|
function useColumnsWhen() {
|
|
3437
3653
|
const {
|
|
3438
|
-
componentState: {
|
|
3654
|
+
componentState: { groupBy },
|
|
3439
3655
|
componentActions: dataSourceActions
|
|
3440
3656
|
} = useDataSourceContextValue();
|
|
3441
3657
|
const {
|
|
3442
3658
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3443
3659
|
} = useComponentState();
|
|
3444
|
-
const
|
|
3445
|
-
|
|
3660
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3661
|
+
useEffect9(() => {
|
|
3446
3662
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3447
3663
|
}, [groupRenderStrategy]);
|
|
3448
|
-
|
|
3664
|
+
useEffect9(() => {
|
|
3449
3665
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3450
3666
|
}, [pivotTotalColumnPosition]);
|
|
3451
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3667
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3452
3668
|
useColumnsWhenPivoting();
|
|
3453
3669
|
useColumnsWhenGrouping();
|
|
3454
|
-
useHideEmptyGroupColumns(
|
|
3670
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3455
3671
|
}
|
|
3456
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3672
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3457
3673
|
const toggleGroupRow = useToggleGroupRow();
|
|
3458
3674
|
const {
|
|
3459
3675
|
componentActions,
|
|
3460
3676
|
componentState: { columns, groupRenderStrategy }
|
|
3461
3677
|
} = useComponentState();
|
|
3462
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3678
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3463
3679
|
const computedColumns = new Map();
|
|
3464
3680
|
columns2.forEach((column, id) => {
|
|
3465
3681
|
let base = {};
|
|
3466
|
-
const groupByForColumn =
|
|
3682
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3467
3683
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3468
3684
|
const { groupIndex } = groupByForColumn;
|
|
3469
3685
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3508,9 +3724,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3508
3724
|
});
|
|
3509
3725
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3510
3726
|
}
|
|
3511
|
-
|
|
3727
|
+
useEffect9(() => {
|
|
3512
3728
|
const update = () => {
|
|
3513
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
3729
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3514
3730
|
};
|
|
3515
3731
|
update();
|
|
3516
3732
|
return interceptMap(columns, {
|
|
@@ -3518,11 +3734,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3518
3734
|
delete: update,
|
|
3519
3735
|
clear: update
|
|
3520
3736
|
});
|
|
3521
|
-
}, [columns,
|
|
3737
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3522
3738
|
}
|
|
3523
3739
|
function useColumnsWhenPivoting() {
|
|
3524
3740
|
const {
|
|
3525
|
-
componentState: {
|
|
3741
|
+
componentState: { groupBy, pivotBy }
|
|
3526
3742
|
} = useDataSourceContextValue();
|
|
3527
3743
|
const {
|
|
3528
3744
|
componentActions,
|
|
@@ -3534,13 +3750,13 @@ function useColumnsWhenPivoting() {
|
|
|
3534
3750
|
}
|
|
3535
3751
|
} = useComponentState();
|
|
3536
3752
|
const toggleGroupRow = useToggleGroupRow();
|
|
3537
|
-
|
|
3753
|
+
useEffect9(() => {
|
|
3538
3754
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3539
3755
|
pivotColumn,
|
|
3540
3756
|
pivotRowLabelsColumn,
|
|
3541
3757
|
pivotTotalColumnPosition,
|
|
3542
3758
|
pivotBy,
|
|
3543
|
-
|
|
3759
|
+
groupBy,
|
|
3544
3760
|
toggleGroupRow
|
|
3545
3761
|
});
|
|
3546
3762
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3548,14 +3764,14 @@ function useColumnsWhenPivoting() {
|
|
|
3548
3764
|
}
|
|
3549
3765
|
function useColumnsWhenGrouping() {
|
|
3550
3766
|
const {
|
|
3551
|
-
componentState: {
|
|
3767
|
+
componentState: { groupBy }
|
|
3552
3768
|
} = useDataSourceContextValue();
|
|
3553
3769
|
const {
|
|
3554
3770
|
componentActions,
|
|
3555
3771
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3556
3772
|
} = useComponentState();
|
|
3557
3773
|
const toggleGroupRow = useToggleGroupRow();
|
|
3558
|
-
|
|
3774
|
+
useEffect9(() => {
|
|
3559
3775
|
if (pivotColumns) {
|
|
3560
3776
|
return;
|
|
3561
3777
|
}
|
|
@@ -3564,7 +3780,7 @@ function useColumnsWhenGrouping() {
|
|
|
3564
3780
|
columns,
|
|
3565
3781
|
groupColumn,
|
|
3566
3782
|
groupRenderStrategy,
|
|
3567
|
-
|
|
3783
|
+
groupBy,
|
|
3568
3784
|
pivotColumns,
|
|
3569
3785
|
toggleGroupRow
|
|
3570
3786
|
});
|
|
@@ -3576,11 +3792,11 @@ function useColumnsWhenGrouping() {
|
|
|
3576
3792
|
delete: update,
|
|
3577
3793
|
clear: update
|
|
3578
3794
|
});
|
|
3579
|
-
}, [
|
|
3795
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3580
3796
|
}
|
|
3581
3797
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3582
3798
|
const {
|
|
3583
|
-
componentState: {
|
|
3799
|
+
componentState: { groupBy, groupRowsState },
|
|
3584
3800
|
getState: getDataSourceState
|
|
3585
3801
|
} = useDataSourceContextValue();
|
|
3586
3802
|
const {
|
|
@@ -3592,11 +3808,11 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3592
3808
|
groupRenderStrategy
|
|
3593
3809
|
}
|
|
3594
3810
|
} = useComponentState();
|
|
3595
|
-
|
|
3596
|
-
if (groupRenderStrategy
|
|
3811
|
+
useEffect9(() => {
|
|
3812
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3597
3813
|
return;
|
|
3598
3814
|
}
|
|
3599
|
-
const groupsLength =
|
|
3815
|
+
const groupsLength = groupBy.length;
|
|
3600
3816
|
let expandedGroupsLevel = 0;
|
|
3601
3817
|
const { dataArray } = getDataSourceState();
|
|
3602
3818
|
const len = dataArray.length;
|
|
@@ -3612,15 +3828,15 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3612
3828
|
let updated = false;
|
|
3613
3829
|
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3614
3830
|
const cols = computedColumns;
|
|
3615
|
-
|
|
3616
|
-
const colId =
|
|
3617
|
-
|
|
3831
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3832
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
3833
|
+
let col = cols.get(colId);
|
|
3618
3834
|
if (!col) {
|
|
3619
3835
|
return;
|
|
3620
3836
|
}
|
|
3621
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3837
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3622
3838
|
updated = true;
|
|
3623
|
-
if (shouldBeHidden
|
|
3839
|
+
if (shouldBeHidden) {
|
|
3624
3840
|
columnVisibility.set(colId, false);
|
|
3625
3841
|
} else {
|
|
3626
3842
|
columnVisibility.delete(colId);
|
|
@@ -3633,7 +3849,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3633
3849
|
getDataSourceState,
|
|
3634
3850
|
groupRenderStrategy,
|
|
3635
3851
|
generatedColumns,
|
|
3636
|
-
|
|
3852
|
+
groupBy,
|
|
3637
3853
|
groupRowsMap,
|
|
3638
3854
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3639
3855
|
hideEmptyGroupColumns
|
|
@@ -3642,7 +3858,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3642
3858
|
function getColumnsWhenGrouping(params) {
|
|
3643
3859
|
const {
|
|
3644
3860
|
pivotColumns,
|
|
3645
|
-
|
|
3861
|
+
groupBy,
|
|
3646
3862
|
groupColumn,
|
|
3647
3863
|
groupRenderStrategy,
|
|
3648
3864
|
toggleGroupRow,
|
|
@@ -3656,10 +3872,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
3656
3872
|
}
|
|
3657
3873
|
const computedColumns = new Map();
|
|
3658
3874
|
if (groupRenderStrategy === "multi-column") {
|
|
3659
|
-
|
|
3875
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3660
3876
|
const generatedGroupColumn = getColumnForGroupBy({
|
|
3661
3877
|
groupByForColumn,
|
|
3662
|
-
|
|
3878
|
+
groupBy,
|
|
3663
3879
|
groupIndexForColumn,
|
|
3664
3880
|
groupCount: arr.length,
|
|
3665
3881
|
groupRenderStrategy
|
|
@@ -3668,8 +3884,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
3668
3884
|
});
|
|
3669
3885
|
} else if (groupRenderStrategy === "single-column") {
|
|
3670
3886
|
const singleGroupColumn = getSingleGroupColumn({
|
|
3671
|
-
groupCount:
|
|
3672
|
-
|
|
3887
|
+
groupCount: groupBy.length,
|
|
3888
|
+
groupBy,
|
|
3673
3889
|
groupRenderStrategy
|
|
3674
3890
|
}, toggleGroupRow, groupColumn);
|
|
3675
3891
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
@@ -3694,9 +3910,10 @@ function useComputed() {
|
|
|
3694
3910
|
columnPinning,
|
|
3695
3911
|
columnSizing,
|
|
3696
3912
|
columnTypes,
|
|
3697
|
-
bodySize
|
|
3913
|
+
bodySize,
|
|
3914
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3698
3915
|
} = componentState;
|
|
3699
|
-
|
|
3916
|
+
useState5(() => {
|
|
3700
3917
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3701
3918
|
if (rowHeight) {
|
|
3702
3919
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3708,13 +3925,16 @@ function useComputed() {
|
|
|
3708
3925
|
}
|
|
3709
3926
|
});
|
|
3710
3927
|
});
|
|
3711
|
-
|
|
3928
|
+
useEffect10(() => {
|
|
3929
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3930
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3712
3931
|
const { multiSort } = dataSourceState;
|
|
3713
3932
|
useColumnGroups();
|
|
3714
3933
|
useColumnsWhen();
|
|
3715
3934
|
const setSortInfo = useCallback5((sortInfo) => {
|
|
3716
3935
|
var _a2;
|
|
3717
|
-
|
|
3936
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3937
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3718
3938
|
}, []);
|
|
3719
3939
|
const columns = componentState.computedColumns;
|
|
3720
3940
|
const {
|
|
@@ -3866,11 +4086,11 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3866
4086
|
var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
|
|
3867
4087
|
|
|
3868
4088
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3869
|
-
var
|
|
4089
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3870
4090
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3871
4091
|
var HeaderCellProxy = "_12zfob10";
|
|
3872
|
-
var HeaderCellRecipe = (0,
|
|
3873
|
-
var HeaderClsRecipe = (0,
|
|
4092
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob1c", variantClassNames: { dragging: { true: "_12zfob1d", false: "_12zfob1e" }, first: { true: "_12zfob1f", false: "_12zfob1g" }, last: { true: "_12zfob1h", false: "_12zfob1i" }, groupByField: { true: "_12zfob1j", false: "_12zfob1k" }, firstInCategory: { true: "_12zfob1l", false: "_12zfob1m" }, lastInCategory: { true: "_12zfob1n", false: "_12zfob1o" }, pinned: { start: "_12zfob1p", end: "_12zfob1q", false: "_12zfob1r" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1s"], [{ pinned: "end", firstInCategory: true }, "_12zfob1t"], [{ pinned: false, lastInCategory: true }, "_12zfob1u"]] });
|
|
4093
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_12zfob12 _16lm1iw10", variantClassNames: { pinned: { start: "_12zfob13", end: "_12zfob14", false: "_12zfob15" }, virtualized: { true: "_12zfob16", false: "_12zfob17" }, overflow: { true: "_12zfob18", false: "_12zfob19" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1a"], [{ overflow: true, pinned: "end" }, "_12zfob1b"]] });
|
|
3874
4094
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
3875
4095
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
3876
4096
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -3882,14 +4102,14 @@ import {
|
|
|
3882
4102
|
createElement as createElement15,
|
|
3883
4103
|
memo as memo6
|
|
3884
4104
|
} from "react";
|
|
3885
|
-
import { useCallback as useCallback8, useEffect as
|
|
4105
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
|
|
3886
4106
|
|
|
3887
4107
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3888
4108
|
import {
|
|
3889
4109
|
Fragment as Fragment2,
|
|
3890
4110
|
createElement as createElement11
|
|
3891
4111
|
} from "react";
|
|
3892
|
-
import { useCallback as useCallback7, useEffect as
|
|
4112
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef8 } from "react";
|
|
3893
4113
|
|
|
3894
4114
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3895
4115
|
import {
|
|
@@ -3898,18 +4118,18 @@ import {
|
|
|
3898
4118
|
} from "react";
|
|
3899
4119
|
|
|
3900
4120
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3901
|
-
import { useContext as
|
|
4121
|
+
import { useContext as useContext4 } from "react";
|
|
3902
4122
|
var useInfiniteTableState = () => {
|
|
3903
4123
|
const TableContext2 = getInfiniteTableContext();
|
|
3904
|
-
const { componentState } =
|
|
4124
|
+
const { componentState } = useContext4(TableContext2);
|
|
3905
4125
|
return componentState;
|
|
3906
4126
|
};
|
|
3907
4127
|
|
|
3908
4128
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3909
|
-
var
|
|
4129
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3910
4130
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3911
4131
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3912
|
-
var ColumnCellRecipe = (0,
|
|
4132
|
+
var ColumnCellRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "_16lm1iw2 _16lm1iwo _16lm1iw7 _16lm1iwr", variantClassNames: { dragging: { false: "_1eexc2a7" }, first: { true: "_1eexc2a8", false: "_1eexc2a9" }, last: { true: "_1eexc2aa", false: "_1eexc2ab" }, groupByField: { true: "_1eexc2ac", false: "_1eexc2ad" }, firstInCategory: { true: "_1eexc2ae", false: "_1eexc2af" }, lastInCategory: { true: "_1eexc2ag", false: "_1eexc2ah" }, pinned: { start: "_1eexc2ai", end: "_1eexc2aj", false: "_1eexc2ak" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2al"], [{ pinned: "end", firstInCategory: true }, "_1eexc2am"]] });
|
|
3913
4133
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3914
4134
|
|
|
3915
4135
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -3970,8 +4190,8 @@ var import_binary_search = __toModule(require_binary_search());
|
|
|
3970
4190
|
import {
|
|
3971
4191
|
useCallback as useCallback6,
|
|
3972
4192
|
useMemo as useMemo6,
|
|
3973
|
-
useRef as
|
|
3974
|
-
useState as
|
|
4193
|
+
useRef as useRef7,
|
|
4194
|
+
useState as useState6
|
|
3975
4195
|
} from "react";
|
|
3976
4196
|
|
|
3977
4197
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
@@ -4006,13 +4226,13 @@ var useColumnPointerEvents = ({
|
|
|
4006
4226
|
columns,
|
|
4007
4227
|
computedRemainingSpace
|
|
4008
4228
|
}) => {
|
|
4009
|
-
const [draggingDiff, setDraggingDiff] =
|
|
4010
|
-
const [proxyOffset, setProxyOffset] =
|
|
4011
|
-
const breakpointsRef =
|
|
4012
|
-
const pointerMoveRef =
|
|
4013
|
-
const didDragRef =
|
|
4014
|
-
const initialClientPos =
|
|
4015
|
-
const currentDropIndexRef =
|
|
4229
|
+
const [draggingDiff, setDraggingDiff] = useState6(null);
|
|
4230
|
+
const [proxyOffset, setProxyOffset] = useState6(null);
|
|
4231
|
+
const breakpointsRef = useRef7([]);
|
|
4232
|
+
const pointerMoveRef = useRef7(null);
|
|
4233
|
+
const didDragRef = useRef7(false);
|
|
4234
|
+
const initialClientPos = useRef7(null);
|
|
4235
|
+
const currentDropIndexRef = useRef7(null);
|
|
4016
4236
|
const dragging = draggingDiff != null;
|
|
4017
4237
|
const { componentActions, computed } = useInfiniteTable();
|
|
4018
4238
|
const { computedColumnOrder } = computed;
|
|
@@ -4025,7 +4245,7 @@ var useColumnPointerEvents = ({
|
|
|
4025
4245
|
columnWidth: column.computedWidth
|
|
4026
4246
|
};
|
|
4027
4247
|
}, [columns, columnId, column]);
|
|
4028
|
-
let cursorRef =
|
|
4248
|
+
let cursorRef = useRef7("auto");
|
|
4029
4249
|
const onPointerDown = useCallback6((e) => {
|
|
4030
4250
|
const target = domRef.current;
|
|
4031
4251
|
cursorRef.current = target.style.cursor;
|
|
@@ -4166,7 +4386,7 @@ import { createPortal } from "react-dom";
|
|
|
4166
4386
|
import {
|
|
4167
4387
|
createElement as createElement10
|
|
4168
4388
|
} from "react";
|
|
4169
|
-
import { useEffect as
|
|
4389
|
+
import { useEffect as useEffect11, useState as useState7 } from "react";
|
|
4170
4390
|
var defaultLineStyle = {
|
|
4171
4391
|
marginTop: 2,
|
|
4172
4392
|
marginBottom: 2,
|
|
@@ -4174,8 +4394,8 @@ var defaultLineStyle = {
|
|
|
4174
4394
|
};
|
|
4175
4395
|
function SortIcon(props) {
|
|
4176
4396
|
var _a;
|
|
4177
|
-
const [rendered, setRendered] =
|
|
4178
|
-
const [opacity, setOpacity] =
|
|
4397
|
+
const [rendered, setRendered] = useState7(true);
|
|
4398
|
+
const [opacity, setOpacity] = useState7(0);
|
|
4179
4399
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4180
4400
|
const showIndex = index != null && index > 0;
|
|
4181
4401
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4189,7 +4409,7 @@ function SortIcon(props) {
|
|
|
4189
4409
|
}), props.lineStyle), {
|
|
4190
4410
|
opacity
|
|
4191
4411
|
});
|
|
4192
|
-
|
|
4412
|
+
useEffect11(() => {
|
|
4193
4413
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4194
4414
|
if (!rendered && newOpacity) {
|
|
4195
4415
|
setRendered(true);
|
|
@@ -4266,7 +4486,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4266
4486
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4267
4487
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4268
4488
|
});
|
|
4269
|
-
const domRef =
|
|
4489
|
+
const domRef = useRef8(null);
|
|
4270
4490
|
const ref = useCallback7((node) => {
|
|
4271
4491
|
var _a2;
|
|
4272
4492
|
domRef.current = node;
|
|
@@ -4276,7 +4496,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4276
4496
|
computed: { computedRemainingSpace },
|
|
4277
4497
|
componentState: { portalDOMRef }
|
|
4278
4498
|
} = useInfiniteTable();
|
|
4279
|
-
|
|
4499
|
+
useEffect12(() => {
|
|
4280
4500
|
let clearOnResize = null;
|
|
4281
4501
|
const node = domRef.current;
|
|
4282
4502
|
if (onResize && node) {
|
|
@@ -4332,7 +4552,7 @@ import {
|
|
|
4332
4552
|
createElement as createElement14,
|
|
4333
4553
|
memo as memo5
|
|
4334
4554
|
} from "react";
|
|
4335
|
-
import { useEffect as
|
|
4555
|
+
import { useEffect as useEffect13 } from "react";
|
|
4336
4556
|
|
|
4337
4557
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4338
4558
|
import {
|
|
@@ -4340,9 +4560,9 @@ import {
|
|
|
4340
4560
|
createElement as createElement12,
|
|
4341
4561
|
memo as memo4
|
|
4342
4562
|
} from "react";
|
|
4343
|
-
import { useLayoutEffect as useLayoutEffect4, useState as
|
|
4563
|
+
import { useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
|
|
4344
4564
|
function AvoidReactDiffFn(props) {
|
|
4345
|
-
const [children, setChildren] =
|
|
4565
|
+
const [children, setChildren] = useState8(props.updater.get());
|
|
4346
4566
|
useLayoutEffect4(() => {
|
|
4347
4567
|
const remove = props.updater.onChange((children2) => {
|
|
4348
4568
|
setChildren(children2);
|
|
@@ -4375,10 +4595,10 @@ var MappedItems = class extends Logger {
|
|
|
4375
4595
|
return result;
|
|
4376
4596
|
};
|
|
4377
4597
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4378
|
-
const
|
|
4598
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4379
4599
|
const result = [];
|
|
4380
|
-
for (const elementIndex in
|
|
4381
|
-
const itemIndex =
|
|
4600
|
+
for (const elementIndex in map2) {
|
|
4601
|
+
const itemIndex = map2[elementIndex];
|
|
4382
4602
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4383
4603
|
result.push(elementIndex >> 0);
|
|
4384
4604
|
}
|
|
@@ -4683,7 +4903,7 @@ function RawListFn(props) {
|
|
|
4683
4903
|
debugChannel
|
|
4684
4904
|
});
|
|
4685
4905
|
const getRenderItem = useLatest(renderItem);
|
|
4686
|
-
|
|
4906
|
+
useEffect13(() => {
|
|
4687
4907
|
const renderRange = brain.getRenderRange();
|
|
4688
4908
|
renderer.renderRange(renderRange, {
|
|
4689
4909
|
renderItem,
|
|
@@ -4691,7 +4911,7 @@ function RawListFn(props) {
|
|
|
4691
4911
|
onRender: onRenderUpdater
|
|
4692
4912
|
});
|
|
4693
4913
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4694
|
-
|
|
4914
|
+
useEffect13(() => {
|
|
4695
4915
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4696
4916
|
renderer.renderRange(renderRange, {
|
|
4697
4917
|
force: false,
|
|
@@ -4733,14 +4953,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4733
4953
|
columns: computedVisibleColumnsMap
|
|
4734
4954
|
});
|
|
4735
4955
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4736
|
-
|
|
4956
|
+
useEffect14(() => {
|
|
4737
4957
|
const onScroll = (scrollPosition) => {
|
|
4738
4958
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4739
4959
|
};
|
|
4740
4960
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4741
4961
|
return removeOnScroll;
|
|
4742
4962
|
}, [brain]);
|
|
4743
|
-
const domRef =
|
|
4963
|
+
const domRef = useRef9(null);
|
|
4744
4964
|
const headerCls = HeaderClsRecipe({
|
|
4745
4965
|
pinned: pinning,
|
|
4746
4966
|
overflow: false,
|
|
@@ -4763,7 +4983,7 @@ import {
|
|
|
4763
4983
|
createElement as createElement18,
|
|
4764
4984
|
memo as memo7,
|
|
4765
4985
|
useMemo as useMemo8,
|
|
4766
|
-
useRef as
|
|
4986
|
+
useRef as useRef10
|
|
4767
4987
|
} from "react";
|
|
4768
4988
|
|
|
4769
4989
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
@@ -4773,7 +4993,7 @@ import {
|
|
|
4773
4993
|
|
|
4774
4994
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4775
4995
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4776
|
-
const
|
|
4996
|
+
const map2 = new Map();
|
|
4777
4997
|
const temporaryMap = new Map();
|
|
4778
4998
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4779
4999
|
columns.forEach((col, index) => {
|
|
@@ -4791,7 +5011,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4791
5011
|
computedWidth: col.computedWidth,
|
|
4792
5012
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4793
5013
|
};
|
|
4794
|
-
|
|
5014
|
+
map2.set([colId], colItem);
|
|
4795
5015
|
let groupId = col.columnGroup;
|
|
4796
5016
|
let colGroupItem;
|
|
4797
5017
|
let prevGroupItem = colItem;
|
|
@@ -4813,7 +5033,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4813
5033
|
computedWidth: 0,
|
|
4814
5034
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4815
5035
|
};
|
|
4816
|
-
|
|
5036
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4817
5037
|
temporaryMap.set(groupId, colGroupItem);
|
|
4818
5038
|
}
|
|
4819
5039
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4830,7 +5050,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4830
5050
|
});
|
|
4831
5051
|
const result = [];
|
|
4832
5052
|
let groupOffset = 0;
|
|
4833
|
-
|
|
5053
|
+
map2.forEach((item) => {
|
|
4834
5054
|
if (!item.ref.columnGroup) {
|
|
4835
5055
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4836
5056
|
item.groupOffset = groupOffset;
|
|
@@ -4842,7 +5062,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4842
5062
|
groupOffset += itemWidth;
|
|
4843
5063
|
}
|
|
4844
5064
|
});
|
|
4845
|
-
|
|
5065
|
+
map2.clear();
|
|
4846
5066
|
temporaryMap.clear();
|
|
4847
5067
|
return result;
|
|
4848
5068
|
}
|
|
@@ -4941,7 +5161,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4941
5161
|
}
|
|
4942
5162
|
|
|
4943
5163
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4944
|
-
import { useEffect as
|
|
5164
|
+
import { useEffect as useEffect15 } from "react";
|
|
4945
5165
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4946
5166
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
4947
5167
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -4974,7 +5194,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4974
5194
|
},
|
|
4975
5195
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
4976
5196
|
} = useInfiniteTable();
|
|
4977
|
-
const domRef =
|
|
5197
|
+
const domRef = useRef10(null);
|
|
4978
5198
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
4979
5199
|
const columnHeaderGroups = useMemo8(() => {
|
|
4980
5200
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
@@ -5007,7 +5227,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5007
5227
|
if (totalWidth != null) {
|
|
5008
5228
|
style.width = availableWidth;
|
|
5009
5229
|
}
|
|
5010
|
-
|
|
5230
|
+
useEffect15(() => {
|
|
5011
5231
|
const scroller = brain || scrollListener;
|
|
5012
5232
|
if (!scroller || !scrollable) {
|
|
5013
5233
|
return;
|
|
@@ -5124,12 +5344,12 @@ import {
|
|
|
5124
5344
|
createElement as createElement20,
|
|
5125
5345
|
forwardRef as forwardRef2
|
|
5126
5346
|
} from "react";
|
|
5127
|
-
import { useRef as
|
|
5347
|
+
import { useRef as useRef11 } from "react";
|
|
5128
5348
|
|
|
5129
5349
|
// src/components/hooks/useOnScroll.ts
|
|
5130
|
-
import { useEffect as
|
|
5350
|
+
import { useEffect as useEffect16 } from "react";
|
|
5131
5351
|
var useOnScroll = (domRef, onScroll) => {
|
|
5132
|
-
|
|
5352
|
+
useEffect16(() => {
|
|
5133
5353
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5134
5354
|
const scrollFn = (event) => {
|
|
5135
5355
|
const node = event.target;
|
|
@@ -5175,7 +5395,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
|
|
|
5175
5395
|
className,
|
|
5176
5396
|
style
|
|
5177
5397
|
} = props;
|
|
5178
|
-
const domRef = ref != null ? ref :
|
|
5398
|
+
const domRef = ref != null ? ref : useRef11(null);
|
|
5179
5399
|
useOnScroll(domRef, onContainerScroll);
|
|
5180
5400
|
return /* @__PURE__ */ createElement20("div", {
|
|
5181
5401
|
ref: domRef,
|
|
@@ -5209,7 +5429,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5209
5429
|
var SpacePlaceholder = memo8(SpacePlaceholderFn);
|
|
5210
5430
|
|
|
5211
5431
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5212
|
-
import { useCallback as useCallback17, useEffect as
|
|
5432
|
+
import { useCallback as useCallback17, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
5213
5433
|
|
|
5214
5434
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5215
5435
|
import {
|
|
@@ -5228,10 +5448,10 @@ import {
|
|
|
5228
5448
|
Fragment as Fragment4,
|
|
5229
5449
|
createElement as createElement22
|
|
5230
5450
|
} from "react";
|
|
5231
|
-
import { useRef as
|
|
5451
|
+
import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
|
|
5232
5452
|
|
|
5233
5453
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5234
|
-
var VirtualListCls = "
|
|
5454
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5235
5455
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5236
5456
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5237
5457
|
|
|
@@ -5271,11 +5491,11 @@ var VirtualList = (props) => {
|
|
|
5271
5491
|
"onContainerScroll",
|
|
5272
5492
|
"children"
|
|
5273
5493
|
]);
|
|
5274
|
-
const domRef =
|
|
5494
|
+
const domRef = useRef12(null);
|
|
5275
5495
|
const [, rerender] = useRerender();
|
|
5276
|
-
const [totalSize, setTotalSize] =
|
|
5277
|
-
const renderCountRef =
|
|
5278
|
-
|
|
5496
|
+
const [totalSize, setTotalSize] = useState9(0);
|
|
5497
|
+
const renderCountRef = useRef12(0);
|
|
5498
|
+
useEffect17(() => {
|
|
5279
5499
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5280
5500
|
renderCountRef.current = renderCount;
|
|
5281
5501
|
if (true) {
|
|
@@ -5294,7 +5514,7 @@ var VirtualList = (props) => {
|
|
|
5294
5514
|
removeOnTotalSizeChange();
|
|
5295
5515
|
};
|
|
5296
5516
|
}, [virtualBrain]);
|
|
5297
|
-
|
|
5517
|
+
useEffect17(() => {
|
|
5298
5518
|
const onScroll = (scrollPosition) => {
|
|
5299
5519
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5300
5520
|
};
|
|
@@ -5352,7 +5572,7 @@ import {
|
|
|
5352
5572
|
memo as memo10,
|
|
5353
5573
|
useCallback as useCallback11
|
|
5354
5574
|
} from "react";
|
|
5355
|
-
import { useRef as
|
|
5575
|
+
import { useRef as useRef14 } from "react";
|
|
5356
5576
|
|
|
5357
5577
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5358
5578
|
import {
|
|
@@ -5385,32 +5605,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5385
5605
|
const groupRowInfo = null;
|
|
5386
5606
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5387
5607
|
if (column.valueGetter) {
|
|
5388
|
-
value = column.valueGetter({
|
|
5389
|
-
data,
|
|
5390
|
-
rowInfo
|
|
5391
|
-
|
|
5608
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5609
|
+
data: rowInfo.data,
|
|
5610
|
+
rowInfo
|
|
5611
|
+
} : {
|
|
5612
|
+
data: rowInfo.data,
|
|
5613
|
+
rowInfo
|
|
5392
5614
|
});
|
|
5393
5615
|
}
|
|
5394
5616
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5395
|
-
const
|
|
5396
|
-
|
|
5397
|
-
|
|
5617
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5618
|
+
rowInfo,
|
|
5619
|
+
data: rowInfo.data
|
|
5620
|
+
} : {
|
|
5398
5621
|
rowInfo,
|
|
5399
|
-
data
|
|
5622
|
+
data: rowInfo.data
|
|
5400
5623
|
};
|
|
5624
|
+
const stylingRenderParam = __spreadValues({
|
|
5625
|
+
value,
|
|
5626
|
+
column
|
|
5627
|
+
}, rest);
|
|
5401
5628
|
let renderValue = value;
|
|
5402
5629
|
if (column.render || column.renderValue) {
|
|
5403
|
-
const renderParam = {
|
|
5630
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5404
5631
|
value,
|
|
5405
5632
|
column,
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
data,
|
|
5633
|
+
groupRowInfo
|
|
5634
|
+
}, rest), {
|
|
5409
5635
|
rowIndex,
|
|
5410
5636
|
toggleGroupRow,
|
|
5411
5637
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5412
|
-
|
|
5413
|
-
};
|
|
5638
|
+
groupBy: computedDataSource.groupBy
|
|
5639
|
+
});
|
|
5414
5640
|
if (column.render) {
|
|
5415
5641
|
renderValue = column.render(renderParam);
|
|
5416
5642
|
} else if (column.renderValue) {
|
|
@@ -5461,7 +5687,7 @@ var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
|
5461
5687
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5462
5688
|
import {
|
|
5463
5689
|
useCallback as useCallback10,
|
|
5464
|
-
useRef as
|
|
5690
|
+
useRef as useRef13
|
|
5465
5691
|
} from "react";
|
|
5466
5692
|
|
|
5467
5693
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
@@ -5487,17 +5713,16 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5487
5713
|
domRef: domRefFromProps,
|
|
5488
5714
|
rowInfo
|
|
5489
5715
|
} = props;
|
|
5490
|
-
const domRef =
|
|
5716
|
+
const domRef = useRef13(null);
|
|
5491
5717
|
const rowDOMRef = useCallback10((node) => {
|
|
5492
5718
|
domRefFromProps(node);
|
|
5493
5719
|
domRef.current = node;
|
|
5494
5720
|
}, []);
|
|
5495
|
-
const
|
|
5496
|
-
|
|
5497
|
-
rowInfo,
|
|
5721
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5722
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5498
5723
|
rowIndex,
|
|
5499
|
-
|
|
5500
|
-
};
|
|
5724
|
+
groupBy: rowInfo.groupBy
|
|
5725
|
+
});
|
|
5501
5726
|
if (typeof rowProps === "function") {
|
|
5502
5727
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5503
5728
|
}
|
|
@@ -5590,7 +5815,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5590
5815
|
width: rowWidth,
|
|
5591
5816
|
height: rowHeight
|
|
5592
5817
|
}, domProps.style);
|
|
5593
|
-
const renderCellRef =
|
|
5818
|
+
const renderCellRef = useRef14(null);
|
|
5594
5819
|
const renderCell = useCallback11(({ domRef, itemIndex }) => {
|
|
5595
5820
|
const column = columns[itemIndex];
|
|
5596
5821
|
if (!column) {
|
|
@@ -5763,23 +5988,23 @@ function useUnpinnedRendering(params) {
|
|
|
5763
5988
|
}
|
|
5764
5989
|
|
|
5765
5990
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5766
|
-
import { useCallback as useCallback13, useEffect as
|
|
5991
|
+
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
|
|
5767
5992
|
|
|
5768
5993
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5769
|
-
var
|
|
5994
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5770
5995
|
var FooterCls = "_16lm1iw1";
|
|
5771
5996
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5772
|
-
var InfiniteClsRecipe = (0,
|
|
5997
|
+
var InfiniteClsRecipe = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5773
5998
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5774
5999
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5775
6000
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5776
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
6001
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5777
6002
|
|
|
5778
6003
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5779
6004
|
var DELAY = 200;
|
|
5780
6005
|
var TableClassName = internalProps.rootClassName;
|
|
5781
6006
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5782
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
6007
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5783
6008
|
var useOnContainerScroll = ({
|
|
5784
6009
|
verticalVirtualBrain,
|
|
5785
6010
|
horizontalVirtualBrain,
|
|
@@ -5795,10 +6020,11 @@ var useOnContainerScroll = ({
|
|
|
5795
6020
|
bodySize
|
|
5796
6021
|
}
|
|
5797
6022
|
} = useInfiniteTable();
|
|
5798
|
-
const
|
|
5799
|
-
const
|
|
5800
|
-
const
|
|
5801
|
-
|
|
6023
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
6024
|
+
const timeoutIdRef = useRef15(0);
|
|
6025
|
+
const scrollingRef = useRef15(false);
|
|
6026
|
+
const scrollTopMaxRef = useRef15(0);
|
|
6027
|
+
useEffect18(() => {
|
|
5802
6028
|
const { current: node } = scrollerDOMRef;
|
|
5803
6029
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5804
6030
|
}, [reservedContentHeight, bodySize.height]);
|
|
@@ -5837,7 +6063,7 @@ var useOnContainerScroll = ({
|
|
|
5837
6063
|
domRef.current,
|
|
5838
6064
|
setScrolling
|
|
5839
6065
|
]);
|
|
5840
|
-
const scrollPositionRef =
|
|
6066
|
+
const scrollPositionRef = useRef15({
|
|
5841
6067
|
scrollLeft: 0,
|
|
5842
6068
|
scrollTop: 0
|
|
5843
6069
|
});
|
|
@@ -5855,6 +6081,9 @@ var useOnContainerScroll = ({
|
|
|
5855
6081
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5856
6082
|
if (isScrollBottom) {
|
|
5857
6083
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
6084
|
+
if (getDataSourceState().livePagination) {
|
|
6085
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
6086
|
+
}
|
|
5858
6087
|
}
|
|
5859
6088
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5860
6089
|
return {
|
|
@@ -5874,12 +6103,12 @@ import { useCallback as useCallback15 } from "react";
|
|
|
5874
6103
|
import {
|
|
5875
6104
|
createElement as createElement28
|
|
5876
6105
|
} from "react";
|
|
5877
|
-
import { useEffect as
|
|
6106
|
+
import { useEffect as useEffect20, useCallback as useCallback14, useRef as useRef16 } from "react";
|
|
5878
6107
|
|
|
5879
6108
|
// src/components/hooks/useOnMount.ts
|
|
5880
|
-
import { useEffect as
|
|
6109
|
+
import { useEffect as useEffect19 } from "react";
|
|
5881
6110
|
function useOnMount(domRef, props) {
|
|
5882
|
-
|
|
6111
|
+
useEffect19(() => {
|
|
5883
6112
|
const { onMount, onUnmount } = props;
|
|
5884
6113
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5885
6114
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5910,7 +6139,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5910
6139
|
onMount,
|
|
5911
6140
|
onUnmount
|
|
5912
6141
|
} = props;
|
|
5913
|
-
const domRef =
|
|
6142
|
+
const domRef = useRef16(null);
|
|
5914
6143
|
const renderItem = useCallback14((renderProps) => renderRow({
|
|
5915
6144
|
domRef: renderProps.domRef,
|
|
5916
6145
|
rowHeight: renderProps.itemSize,
|
|
@@ -5920,7 +6149,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5920
6149
|
onMount,
|
|
5921
6150
|
onUnmount
|
|
5922
6151
|
});
|
|
5923
|
-
|
|
6152
|
+
useEffect20(() => {
|
|
5924
6153
|
const onScroll = (scrollPosition) => {
|
|
5925
6154
|
const node = domRef.current;
|
|
5926
6155
|
if (node) {
|
|
@@ -6143,7 +6372,7 @@ function usePinnedStartRendering(params) {
|
|
|
6143
6372
|
}
|
|
6144
6373
|
|
|
6145
6374
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6146
|
-
import { useEffect as
|
|
6375
|
+
import { useEffect as useEffect21 } from "react";
|
|
6147
6376
|
|
|
6148
6377
|
// src/components/VirtualBrain/index.ts
|
|
6149
6378
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -6622,7 +6851,7 @@ function useYourBrain(param) {
|
|
|
6622
6851
|
});
|
|
6623
6852
|
return brain;
|
|
6624
6853
|
});
|
|
6625
|
-
|
|
6854
|
+
useEffect21(() => {
|
|
6626
6855
|
return () => {
|
|
6627
6856
|
horizontalVirtualBrain.destroy();
|
|
6628
6857
|
verticalVirtualBrain.destroy();
|
|
@@ -6630,13 +6859,13 @@ function useYourBrain(param) {
|
|
|
6630
6859
|
}, []);
|
|
6631
6860
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6632
6861
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6633
|
-
|
|
6862
|
+
useEffect21(() => {
|
|
6634
6863
|
verticalVirtualBrain.setAvailableSize({
|
|
6635
6864
|
height: bodySize.height,
|
|
6636
6865
|
width: 0
|
|
6637
6866
|
});
|
|
6638
6867
|
}, [bodySize, verticalVirtualBrain]);
|
|
6639
|
-
|
|
6868
|
+
useEffect21(() => {
|
|
6640
6869
|
horizontalVirtualBrain.setAvailableSize({
|
|
6641
6870
|
height: 0,
|
|
6642
6871
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6645,29 +6874,6 @@ function useYourBrain(param) {
|
|
|
6645
6874
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6646
6875
|
}
|
|
6647
6876
|
|
|
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
6877
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6672
6878
|
function useListRendering(param) {
|
|
6673
6879
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6697,7 +6903,7 @@ function useListRendering(param) {
|
|
|
6697
6903
|
pinnedEndScrollListener
|
|
6698
6904
|
} = componentState;
|
|
6699
6905
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6700
|
-
const repaintIdRef =
|
|
6906
|
+
const repaintIdRef = useRef17(0);
|
|
6701
6907
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6702
6908
|
repaintIdRef.current++;
|
|
6703
6909
|
}
|
|
@@ -6739,12 +6945,12 @@ function useListRendering(param) {
|
|
|
6739
6945
|
});
|
|
6740
6946
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6741
6947
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6742
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6948
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6743
6949
|
const scrollbars = useMemo10(() => ({
|
|
6744
6950
|
vertical: hasVerticalScrollbar,
|
|
6745
6951
|
horizontal: hasHorizontalScrollbar
|
|
6746
6952
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6747
|
-
|
|
6953
|
+
useEffect22(() => {
|
|
6748
6954
|
if (!bodySize.height) {
|
|
6749
6955
|
return;
|
|
6750
6956
|
}
|
|
@@ -6757,7 +6963,6 @@ function useListRendering(param) {
|
|
|
6757
6963
|
setColumnVisibility: (columnVisibility) => {
|
|
6758
6964
|
componentActions.columnVisibility = columnVisibility;
|
|
6759
6965
|
},
|
|
6760
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6761
6966
|
getState,
|
|
6762
6967
|
getDataSourceState
|
|
6763
6968
|
};
|
|
@@ -6805,7 +7010,7 @@ function useListRendering(param) {
|
|
|
6805
7010
|
computedUnpinnedColumns
|
|
6806
7011
|
});
|
|
6807
7012
|
const [, rerender] = useRerender();
|
|
6808
|
-
|
|
7013
|
+
useEffect22(() => {
|
|
6809
7014
|
rerender();
|
|
6810
7015
|
}, [dataSourceState]);
|
|
6811
7016
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6832,16 +7037,15 @@ import {
|
|
|
6832
7037
|
createElement as createElement30,
|
|
6833
7038
|
forwardRef as forwardRef3,
|
|
6834
7039
|
useCallback as useCallback18,
|
|
6835
|
-
useRef as
|
|
7040
|
+
useRef as useRef18
|
|
6836
7041
|
} from "react";
|
|
6837
|
-
import { useEffect as
|
|
7042
|
+
import { useEffect as useEffect23 } from "react";
|
|
6838
7043
|
|
|
6839
7044
|
// src/components/utils/decamelize.ts
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
};
|
|
7045
|
+
function decamelize(str, options) {
|
|
7046
|
+
const { separator } = options != null ? options : { separator: "-" };
|
|
7047
|
+
return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
|
|
7048
|
+
}
|
|
6845
7049
|
|
|
6846
7050
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6847
7051
|
var defaultStyle2 = {
|
|
@@ -6872,7 +7076,7 @@ var enforceStyle = (node, style) => {
|
|
|
6872
7076
|
};
|
|
6873
7077
|
var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6874
7078
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6875
|
-
const domRef =
|
|
7079
|
+
const domRef = useRef18(null);
|
|
6876
7080
|
const domCallback = useCallback18((node) => {
|
|
6877
7081
|
domRef.current = node;
|
|
6878
7082
|
if (!ref) {
|
|
@@ -6884,7 +7088,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
6884
7088
|
ref.current = node;
|
|
6885
7089
|
}
|
|
6886
7090
|
}, []);
|
|
6887
|
-
|
|
7091
|
+
useEffect23(() => {
|
|
6888
7092
|
const forceStyle = () => {
|
|
6889
7093
|
requestAnimationFrame(() => {
|
|
6890
7094
|
var _a;
|
|
@@ -7065,7 +7269,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7065
7269
|
const valid = useMemo11(() => {
|
|
7066
7270
|
let valid2 = isValidLicense(licenseKey, {
|
|
7067
7271
|
publishedAt: 1624970570587,
|
|
7068
|
-
version: "0.
|
|
7272
|
+
version: "0.1.1"
|
|
7069
7273
|
});
|
|
7070
7274
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7071
7275
|
return true;
|
|
@@ -7081,7 +7285,7 @@ import {
|
|
|
7081
7285
|
useCallback as useCallback19,
|
|
7082
7286
|
useLayoutEffect as useLayoutEffect5
|
|
7083
7287
|
} from "react";
|
|
7084
|
-
import { useRef as
|
|
7288
|
+
import { useRef as useRef19 } from "react";
|
|
7085
7289
|
var error = err("CSSVariableWatch");
|
|
7086
7290
|
var debug5 = dbg("CSSVariableWatch");
|
|
7087
7291
|
var WRAPPER_STYLE = {
|
|
@@ -7094,7 +7298,7 @@ var WRAPPER_STYLE = {
|
|
|
7094
7298
|
overflow: "hidden"
|
|
7095
7299
|
};
|
|
7096
7300
|
var useCSSVariableWatch = (params) => {
|
|
7097
|
-
const lastValueRef =
|
|
7301
|
+
const lastValueRef = useRef19(0);
|
|
7098
7302
|
const onResize = useCallback19(({ height }) => {
|
|
7099
7303
|
if (height && height !== lastValueRef.current) {
|
|
7100
7304
|
lastValueRef.current = height;
|
|
@@ -7114,7 +7318,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7114
7318
|
}, []);
|
|
7115
7319
|
};
|
|
7116
7320
|
var CSSVariableWatch = (props) => {
|
|
7117
|
-
const domRef =
|
|
7321
|
+
const domRef = useRef19(null);
|
|
7118
7322
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7119
7323
|
ref: domRef
|
|
7120
7324
|
}));
|
|
@@ -7259,9 +7463,15 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7259
7463
|
});
|
|
7260
7464
|
var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
7261
7465
|
var _a;
|
|
7262
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
7263
7466
|
const {
|
|
7264
|
-
componentState
|
|
7467
|
+
componentState,
|
|
7468
|
+
getComputed,
|
|
7469
|
+
computed,
|
|
7470
|
+
getState: getInfiniteTableState
|
|
7471
|
+
} = useInfiniteTable();
|
|
7472
|
+
const {
|
|
7473
|
+
componentState: { dataArray, loading },
|
|
7474
|
+
getState: getDataSourceState
|
|
7265
7475
|
} = useDataSourceContextValue();
|
|
7266
7476
|
const {
|
|
7267
7477
|
domRef,
|
|
@@ -7298,6 +7508,15 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7298
7508
|
const licenseValid = useLicense(licenseKey);
|
|
7299
7509
|
const domProps = useDOMProps(componentState.domProps);
|
|
7300
7510
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7511
|
+
useLayoutEffect6(() => {
|
|
7512
|
+
const dataSourceState = getDataSourceState();
|
|
7513
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7514
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7515
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7516
|
+
onScrollbarsChange(scrollbars);
|
|
7517
|
+
}
|
|
7518
|
+
notifyScrollbarsChange(scrollbars);
|
|
7519
|
+
}, [scrollbars]);
|
|
7301
7520
|
return /* @__PURE__ */ createElement33("div", __spreadValues({
|
|
7302
7521
|
ref: domRef
|
|
7303
7522
|
}, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
|
|
@@ -7329,7 +7548,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
|
|
|
7329
7548
|
});
|
|
7330
7549
|
function InfiniteTableContextProvider() {
|
|
7331
7550
|
const { componentActions, componentState } = useComponentState();
|
|
7332
|
-
const { scrollerDOMRef } = componentState;
|
|
7551
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7333
7552
|
const computed = useComputed();
|
|
7334
7553
|
const getComputed = useLatest(computed);
|
|
7335
7554
|
const getState = useLatest(componentState);
|
|
@@ -7358,12 +7577,17 @@ function InfiniteTableContextProvider() {
|
|
|
7358
7577
|
}
|
|
7359
7578
|
componentActions.bodySize = bodySize;
|
|
7360
7579
|
}, { earlyAttach: true });
|
|
7361
|
-
|
|
7580
|
+
useEffect24(() => {
|
|
7362
7581
|
return () => {
|
|
7363
7582
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7364
7583
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7365
7584
|
};
|
|
7366
7585
|
}, []);
|
|
7586
|
+
useEffect24(() => {
|
|
7587
|
+
if (scrollerDOMRef.current) {
|
|
7588
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7589
|
+
}
|
|
7590
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7367
7591
|
const TableContext2 = getInfiniteTableContext();
|
|
7368
7592
|
return /* @__PURE__ */ createElement33(TableContext2.Provider, {
|
|
7369
7593
|
value: contextValue
|
|
@@ -7388,6 +7612,7 @@ export {
|
|
|
7388
7612
|
getComponentStateRoot,
|
|
7389
7613
|
group,
|
|
7390
7614
|
interceptMap,
|
|
7615
|
+
multisort,
|
|
7391
7616
|
useComponentState,
|
|
7392
7617
|
useDataSource
|
|
7393
7618
|
};
|