@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.js
CHANGED
|
@@ -53,26 +53,6 @@ var __reExport = (target, module2, desc) => {
|
|
|
53
53
|
var __toModule = (module2) => {
|
|
54
54
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
55
55
|
};
|
|
56
|
-
var __async = (__this, __arguments, generator) => {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
var fulfilled = (value) => {
|
|
59
|
-
try {
|
|
60
|
-
step(generator.next(value));
|
|
61
|
-
} catch (e) {
|
|
62
|
-
reject(e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var rejected = (value) => {
|
|
66
|
-
try {
|
|
67
|
-
step(generator.throw(value));
|
|
68
|
-
} catch (e) {
|
|
69
|
-
reject(e);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
73
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
56
|
|
|
77
57
|
// node_modules/ms/index.js
|
|
78
58
|
var require_ms = __commonJS({
|
|
@@ -641,38 +621,6 @@ var require_binary_search = __commonJS({
|
|
|
641
621
|
}
|
|
642
622
|
});
|
|
643
623
|
|
|
644
|
-
// node_modules/decamelize/index.js
|
|
645
|
-
var require_decamelize = __commonJS({
|
|
646
|
-
"node_modules/decamelize/index.js"(exports, module2) {
|
|
647
|
-
"use strict";
|
|
648
|
-
var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
|
|
649
|
-
decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
|
|
650
|
-
return $0.toLowerCase();
|
|
651
|
-
});
|
|
652
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
|
|
653
|
-
return $1 + separator + $2.toLowerCase();
|
|
654
|
-
});
|
|
655
|
-
};
|
|
656
|
-
module2.exports = (text, {
|
|
657
|
-
separator = "_",
|
|
658
|
-
preserveConsecutiveUppercase = false
|
|
659
|
-
} = {}) => {
|
|
660
|
-
if (!(typeof text === "string" && typeof separator === "string")) {
|
|
661
|
-
throw new TypeError("The `text` and `separator` arguments should be of type `string`");
|
|
662
|
-
}
|
|
663
|
-
if (text.length < 2) {
|
|
664
|
-
return preserveConsecutiveUppercase ? text : text.toLowerCase();
|
|
665
|
-
}
|
|
666
|
-
const replacement = `$1${separator}$2`;
|
|
667
|
-
const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
|
|
668
|
-
if (preserveConsecutiveUppercase) {
|
|
669
|
-
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
670
|
-
}
|
|
671
|
-
return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
|
|
676
624
|
// src/index.tsx
|
|
677
625
|
__export(exports, {
|
|
678
626
|
DataSource: () => DataSource,
|
|
@@ -685,12 +633,13 @@ __export(exports, {
|
|
|
685
633
|
getComponentStateRoot: () => getComponentStateRoot,
|
|
686
634
|
group: () => group,
|
|
687
635
|
interceptMap: () => interceptMap,
|
|
636
|
+
multisort: () => multisort,
|
|
688
637
|
useComponentState: () => useComponentState,
|
|
689
638
|
useDataSource: () => useDataSource
|
|
690
639
|
});
|
|
691
640
|
|
|
692
641
|
// src/components/InfiniteTable/index.tsx
|
|
693
|
-
var
|
|
642
|
+
var React35 = __toModule(require("react"));
|
|
694
643
|
|
|
695
644
|
// src/components/InfiniteTable/internalProps.ts
|
|
696
645
|
var rootClassName = "Infinite";
|
|
@@ -770,9 +719,20 @@ var ScrollListener = class {
|
|
|
770
719
|
}
|
|
771
720
|
};
|
|
772
721
|
|
|
722
|
+
// src/components/InfiniteTable/utils/toMap.ts
|
|
723
|
+
function toMap(mapOrObject) {
|
|
724
|
+
if (!mapOrObject) {
|
|
725
|
+
return new Map();
|
|
726
|
+
}
|
|
727
|
+
if (mapOrObject instanceof Map) {
|
|
728
|
+
return mapOrObject;
|
|
729
|
+
}
|
|
730
|
+
return new Map(Object.entries(mapOrObject));
|
|
731
|
+
}
|
|
732
|
+
|
|
773
733
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
774
734
|
function computeColumnGroupsDepths(columnGroups) {
|
|
775
|
-
const
|
|
735
|
+
const map2 = new Map();
|
|
776
736
|
columnGroups.forEach((colGroup, colGroupId) => {
|
|
777
737
|
let parentGroupId = colGroup.columnGroup;
|
|
778
738
|
let depth = 0;
|
|
@@ -787,20 +747,14 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
787
747
|
depth++;
|
|
788
748
|
parentGroupId = parent.columnGroup;
|
|
789
749
|
}
|
|
790
|
-
|
|
750
|
+
map2.set(colGroupId, depth);
|
|
791
751
|
});
|
|
792
|
-
return
|
|
752
|
+
return map2;
|
|
793
753
|
}
|
|
794
754
|
|
|
795
755
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
796
|
-
function
|
|
797
|
-
|
|
798
|
-
return new Map();
|
|
799
|
-
}
|
|
800
|
-
if (mapOrObject instanceof Map) {
|
|
801
|
-
return mapOrObject;
|
|
802
|
-
}
|
|
803
|
-
return new Map(Object.entries(mapOrObject));
|
|
756
|
+
function toColumnTypesMap(mapOrObject) {
|
|
757
|
+
return toMap(mapOrObject);
|
|
804
758
|
}
|
|
805
759
|
function initSetupState() {
|
|
806
760
|
const columnsGeneratedForGrouping = new Map();
|
|
@@ -835,6 +789,7 @@ var forwardProps = () => {
|
|
|
835
789
|
var _a;
|
|
836
790
|
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
837
791
|
},
|
|
792
|
+
scrollTopId: 1,
|
|
838
793
|
components: 1,
|
|
839
794
|
loadingText: 1,
|
|
840
795
|
pivotColumns: 1,
|
|
@@ -860,12 +815,14 @@ var forwardProps = () => {
|
|
|
860
815
|
pivotColumn: 1,
|
|
861
816
|
pivotRowLabelsColumn: 1,
|
|
862
817
|
pivotColumnGroups: 1,
|
|
818
|
+
onScrollbarsChange: 1,
|
|
863
819
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
864
820
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
865
821
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
866
822
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
867
823
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
868
824
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
825
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
869
826
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
870
827
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
871
828
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
@@ -877,7 +834,10 @@ var forwardProps = () => {
|
|
|
877
834
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
878
835
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
879
836
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
880
|
-
columnVisibility: (columnVisibility) =>
|
|
837
|
+
columnVisibility: (columnVisibility) => {
|
|
838
|
+
var _a;
|
|
839
|
+
return (_a = toMap(columnVisibility)) != null ? _a : new Map();
|
|
840
|
+
},
|
|
881
841
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
882
842
|
columnSizing: (columnSizing) => {
|
|
883
843
|
var _a;
|
|
@@ -885,23 +845,22 @@ var forwardProps = () => {
|
|
|
885
845
|
},
|
|
886
846
|
columnTypes: (columnTypes) => {
|
|
887
847
|
var _a;
|
|
888
|
-
return (_a =
|
|
848
|
+
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
889
849
|
},
|
|
890
|
-
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
891
850
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
892
851
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
893
852
|
};
|
|
894
853
|
};
|
|
895
854
|
function getGroupRenderStrategy(options) {
|
|
896
|
-
const {
|
|
855
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
897
856
|
if (groupRenderStrategy) {
|
|
898
857
|
return groupRenderStrategy;
|
|
899
858
|
}
|
|
900
859
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
901
860
|
return "single-column";
|
|
902
861
|
}
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
862
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
863
|
+
if (columnsInGroupBy.length) {
|
|
905
864
|
return "multi-column";
|
|
906
865
|
}
|
|
907
866
|
return "multi-column";
|
|
@@ -912,16 +871,17 @@ var mapPropsToState = (params) => {
|
|
|
912
871
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
913
872
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
914
873
|
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;
|
|
915
|
-
const
|
|
874
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
916
875
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
917
876
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
918
|
-
|
|
877
|
+
groupBy,
|
|
919
878
|
groupColumn: props.groupColumn
|
|
920
879
|
});
|
|
880
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
921
881
|
return {
|
|
922
882
|
groupRenderStrategy,
|
|
923
|
-
|
|
924
|
-
computedColumns
|
|
883
|
+
groupBy,
|
|
884
|
+
computedColumns,
|
|
925
885
|
virtualizeHeader,
|
|
926
886
|
columnGroupsDepthsMap,
|
|
927
887
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1325,8 +1285,8 @@ var getComputedVisibleColumns = ({
|
|
|
1325
1285
|
const colTypeSizing = {
|
|
1326
1286
|
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1327
1287
|
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1328
|
-
width: colType == null ? void 0 : colType.
|
|
1329
|
-
flex: colType == null ? void 0 : colType.
|
|
1288
|
+
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1289
|
+
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1330
1290
|
};
|
|
1331
1291
|
let colSizing = columnSizing.get(colId) || {};
|
|
1332
1292
|
if (colSizing.width != null) {
|
|
@@ -1379,7 +1339,7 @@ var getComputedVisibleColumns = ({
|
|
|
1379
1339
|
});
|
|
1380
1340
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
1381
1341
|
columnsArray.forEach((c, i) => {
|
|
1382
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1342
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1383
1343
|
const id = visibleColumnOrder[i];
|
|
1384
1344
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1385
1345
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -1440,6 +1400,7 @@ var getComputedVisibleColumns = ({
|
|
|
1440
1400
|
const result2 = __spreadProps(__spreadValues({
|
|
1441
1401
|
align: colType.align,
|
|
1442
1402
|
verticalAlign: colType.verticalAlign,
|
|
1403
|
+
valueGetter: colType.valueGetter,
|
|
1443
1404
|
renderValue: colType.renderValue,
|
|
1444
1405
|
render: colType.render
|
|
1445
1406
|
}, c), {
|
|
@@ -1447,7 +1408,7 @@ var getComputedVisibleColumns = ({
|
|
|
1447
1408
|
computedAbsoluteOffset,
|
|
1448
1409
|
computedPinningOffset,
|
|
1449
1410
|
computedOffset,
|
|
1450
|
-
computedSortable: (_e = (_d = c.sortable) != null ? _d : sortable) != null ? _e : true,
|
|
1411
|
+
computedSortable: (_f = (_e = (_d = c.sortable) != null ? _d : colType.sortable) != null ? _e : sortable) != null ? _f : true,
|
|
1451
1412
|
computedSortInfo,
|
|
1452
1413
|
computedSortIndex,
|
|
1453
1414
|
computedMultiSort: multiSort,
|
|
@@ -1456,14 +1417,14 @@ var getComputedVisibleColumns = ({
|
|
|
1456
1417
|
computedSortedDesc,
|
|
1457
1418
|
computedVisibleIndex: i,
|
|
1458
1419
|
computedPinned,
|
|
1459
|
-
computedDraggable: (
|
|
1420
|
+
computedDraggable: (_h = (_g = c.draggable) != null ? _g : draggableColumns) != null ? _h : true,
|
|
1460
1421
|
computedFirstInCategory,
|
|
1461
1422
|
computedLastInCategory,
|
|
1462
1423
|
computedFirst: i === 0,
|
|
1463
1424
|
computedLast,
|
|
1464
1425
|
toggleSort,
|
|
1465
1426
|
id,
|
|
1466
|
-
header: (
|
|
1427
|
+
header: (_k = (_j = (_i = c.header) != null ? _i : colType.header) != null ? _j : c.name) != null ? _k : c.field
|
|
1467
1428
|
});
|
|
1468
1429
|
computedOffset += computedWidth;
|
|
1469
1430
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -1520,28 +1481,28 @@ var useRerender = () => {
|
|
|
1520
1481
|
|
|
1521
1482
|
// src/components/hooks/useInterceptedMap.ts
|
|
1522
1483
|
var import_react6 = __toModule(require("react"));
|
|
1523
|
-
function interceptMap(
|
|
1524
|
-
const { set, delete: deleteKey, clear } =
|
|
1484
|
+
function interceptMap(map2, fns) {
|
|
1485
|
+
const { set, delete: deleteKey, clear } = map2;
|
|
1525
1486
|
if (fns.set) {
|
|
1526
|
-
|
|
1527
|
-
set.call(
|
|
1487
|
+
map2.set = (key, value) => {
|
|
1488
|
+
set.call(map2, key, value);
|
|
1528
1489
|
fns.set(key, value);
|
|
1529
|
-
return
|
|
1490
|
+
return map2;
|
|
1530
1491
|
};
|
|
1531
1492
|
}
|
|
1532
1493
|
if (fns.delete) {
|
|
1533
|
-
|
|
1534
|
-
const removed = deleteKey.call(
|
|
1494
|
+
map2.delete = (key) => {
|
|
1495
|
+
const removed = deleteKey.call(map2, key);
|
|
1535
1496
|
fns.delete(key);
|
|
1536
1497
|
return removed;
|
|
1537
1498
|
};
|
|
1538
1499
|
}
|
|
1539
1500
|
if (fns.clear || fns.beforeClear) {
|
|
1540
|
-
|
|
1501
|
+
map2.clear = () => {
|
|
1541
1502
|
if (fns.beforeClear) {
|
|
1542
|
-
fns.beforeClear(
|
|
1503
|
+
fns.beforeClear(map2);
|
|
1543
1504
|
}
|
|
1544
|
-
const result = clear.call(
|
|
1505
|
+
const result = clear.call(map2);
|
|
1545
1506
|
if (fns.clear) {
|
|
1546
1507
|
fns.clear();
|
|
1547
1508
|
}
|
|
@@ -1550,13 +1511,13 @@ function interceptMap(map, fns) {
|
|
|
1550
1511
|
}
|
|
1551
1512
|
return () => {
|
|
1552
1513
|
if (set) {
|
|
1553
|
-
|
|
1514
|
+
map2.set = set;
|
|
1554
1515
|
}
|
|
1555
1516
|
if (deleteKey) {
|
|
1556
|
-
|
|
1517
|
+
map2.delete = deleteKey;
|
|
1557
1518
|
}
|
|
1558
1519
|
if (clear) {
|
|
1559
|
-
|
|
1520
|
+
map2.clear = clear;
|
|
1560
1521
|
}
|
|
1561
1522
|
};
|
|
1562
1523
|
}
|
|
@@ -1576,16 +1537,16 @@ var rafFn = (fn) => {
|
|
|
1576
1537
|
};
|
|
1577
1538
|
|
|
1578
1539
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
1579
|
-
var useRerenderOnKeyChange = (
|
|
1540
|
+
var useRerenderOnKeyChange = (map2) => {
|
|
1580
1541
|
const [renderId, rerender] = useRerender();
|
|
1581
1542
|
(0, import_react7.useEffect)(() => {
|
|
1582
1543
|
const update = rafFn(rerender);
|
|
1583
|
-
return interceptMap(
|
|
1544
|
+
return interceptMap(map2, {
|
|
1584
1545
|
set: update,
|
|
1585
1546
|
clear: update,
|
|
1586
1547
|
delete: update
|
|
1587
1548
|
});
|
|
1588
|
-
}, [
|
|
1549
|
+
}, [map2]);
|
|
1589
1550
|
return renderId;
|
|
1590
1551
|
};
|
|
1591
1552
|
|
|
@@ -1701,35 +1662,8 @@ var sortAscending = (a, b) => a - b;
|
|
|
1701
1662
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1702
1663
|
var import_react19 = __toModule(require("react"));
|
|
1703
1664
|
|
|
1704
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1705
|
-
var import_react12 = __toModule(require("react"));
|
|
1706
|
-
|
|
1707
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1708
|
-
var React3 = __toModule(require("react"));
|
|
1709
|
-
|
|
1710
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1711
|
-
var React2 = __toModule(require("react"));
|
|
1712
|
-
var DSContext;
|
|
1713
|
-
function getDataSourceContext() {
|
|
1714
|
-
if (DSContext) {
|
|
1715
|
-
return DSContext;
|
|
1716
|
-
}
|
|
1717
|
-
return DSContext = React2.createContext({
|
|
1718
|
-
getState: () => null,
|
|
1719
|
-
componentState: null,
|
|
1720
|
-
componentActions: null
|
|
1721
|
-
});
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1725
|
-
function useDataSourceActions() {
|
|
1726
|
-
const DataSourceContext = getDataSourceContext();
|
|
1727
|
-
const contextValue = React3.useContext(DataSourceContext);
|
|
1728
|
-
return contextValue.componentActions;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
1665
|
// src/components/hooks/useComponentState.tsx
|
|
1732
|
-
var
|
|
1666
|
+
var React2 = __toModule(require("react"));
|
|
1733
1667
|
var import_react11 = __toModule(require("react"));
|
|
1734
1668
|
|
|
1735
1669
|
// src/utils/proxyFnCall.ts
|
|
@@ -1807,7 +1741,7 @@ function getComponentStateContext() {
|
|
|
1807
1741
|
}
|
|
1808
1742
|
return ComponentContext = (0, import_react11.createContext)(null);
|
|
1809
1743
|
}
|
|
1810
|
-
function
|
|
1744
|
+
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1811
1745
|
const state = getState();
|
|
1812
1746
|
return Object.keys(state).reduce((actions, stateKey) => {
|
|
1813
1747
|
const key = stateKey;
|
|
@@ -1819,6 +1753,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
|
|
|
1819
1753
|
return;
|
|
1820
1754
|
}
|
|
1821
1755
|
notifyChange(props, stateKey, value);
|
|
1756
|
+
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1757
|
+
interceptedActions[key](value, { actions, state: state2 });
|
|
1758
|
+
}
|
|
1822
1759
|
const forwardFn = propsToForward[key];
|
|
1823
1760
|
if (typeof forwardFn === "function") {
|
|
1824
1761
|
value = forwardFn(value);
|
|
@@ -1856,7 +1793,7 @@ function forwardProps2(propsToForward, props) {
|
|
|
1856
1793
|
return mappedState;
|
|
1857
1794
|
}
|
|
1858
1795
|
function getComponentStateRoot(config) {
|
|
1859
|
-
return
|
|
1796
|
+
return React2.memo(function ComponentStateRoot(props) {
|
|
1860
1797
|
var _a, _b;
|
|
1861
1798
|
const propsToStateSetRef = (0, import_react11.useRef)(new Set());
|
|
1862
1799
|
const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps() : {}, []);
|
|
@@ -1931,7 +1868,7 @@ function getComponentStateRoot(config) {
|
|
|
1931
1868
|
const getComponentState = useLatest(state);
|
|
1932
1869
|
const { allowedControlledPropOverrides } = config;
|
|
1933
1870
|
const actions = (0, import_react11.useMemo)(() => {
|
|
1934
|
-
const generatedActions =
|
|
1871
|
+
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
1935
1872
|
return generatedActions;
|
|
1936
1873
|
}, [
|
|
1937
1874
|
dispatch,
|
|
@@ -1961,7 +1898,7 @@ function getComponentStateRoot(config) {
|
|
|
1961
1898
|
if (oldValue === newValue) {
|
|
1962
1899
|
continue;
|
|
1963
1900
|
}
|
|
1964
|
-
if (isControlled(key, props)) {
|
|
1901
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1965
1902
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1966
1903
|
let valueToSet = newValue;
|
|
1967
1904
|
const forwardFn = propsToForward[k];
|
|
@@ -1991,61 +1928,47 @@ function getComponentStateRoot(config) {
|
|
|
1991
1928
|
});
|
|
1992
1929
|
}
|
|
1993
1930
|
});
|
|
1994
|
-
return /* @__PURE__ */
|
|
1931
|
+
return /* @__PURE__ */ React2.createElement(Context.Provider, {
|
|
1995
1932
|
value: contextValue
|
|
1996
1933
|
}, props.children);
|
|
1997
1934
|
});
|
|
1998
1935
|
}
|
|
1999
1936
|
function useComponentState() {
|
|
2000
1937
|
const Context = getComponentStateContext();
|
|
2001
|
-
return
|
|
1938
|
+
return React2.useContext(Context);
|
|
2002
1939
|
}
|
|
2003
1940
|
|
|
2004
|
-
// src/components/
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
getter: (data) => colField ? data[colField] : data
|
|
2020
|
-
}, aggregator);
|
|
2021
|
-
reducers.push(newAggregator);
|
|
2022
|
-
});
|
|
2023
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
2024
|
-
}
|
|
2025
|
-
updateDataSourceAggregations();
|
|
2026
|
-
return interceptMap(columnAggregations, {
|
|
2027
|
-
clear: updateDataSourceAggregations,
|
|
2028
|
-
delete: updateDataSourceAggregations,
|
|
2029
|
-
set: updateDataSourceAggregations
|
|
2030
|
-
});
|
|
2031
|
-
}, [columnAggregations]);
|
|
1941
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1942
|
+
var React4 = __toModule(require("react"));
|
|
1943
|
+
|
|
1944
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1945
|
+
var React3 = __toModule(require("react"));
|
|
1946
|
+
var DSContext;
|
|
1947
|
+
function getDataSourceContext() {
|
|
1948
|
+
if (DSContext) {
|
|
1949
|
+
return DSContext;
|
|
1950
|
+
}
|
|
1951
|
+
return DSContext = React3.createContext({
|
|
1952
|
+
getState: () => null,
|
|
1953
|
+
componentState: null,
|
|
1954
|
+
componentActions: null
|
|
1955
|
+
});
|
|
2032
1956
|
}
|
|
2033
1957
|
|
|
2034
1958
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2035
|
-
var React5 = __toModule(require("react"));
|
|
2036
1959
|
function useDataSource() {
|
|
2037
1960
|
const DataSourceContext = getDataSourceContext();
|
|
2038
|
-
const contextValue =
|
|
1961
|
+
const contextValue = React4.useContext(DataSourceContext);
|
|
2039
1962
|
return contextValue.componentState;
|
|
2040
1963
|
}
|
|
2041
1964
|
function useDataSourceContextValue() {
|
|
2042
1965
|
const DataSourceContext = getDataSourceContext();
|
|
2043
|
-
const contextValue =
|
|
1966
|
+
const contextValue = React4.useContext(DataSourceContext);
|
|
2044
1967
|
return contextValue;
|
|
2045
1968
|
}
|
|
2046
1969
|
|
|
2047
1970
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
2048
|
-
var
|
|
1971
|
+
var import_react12 = __toModule(require("react"));
|
|
2049
1972
|
function useColumnGroups() {
|
|
2050
1973
|
const {
|
|
2051
1974
|
componentState: {
|
|
@@ -2055,7 +1978,7 @@ function useColumnGroups() {
|
|
|
2055
1978
|
componentActions,
|
|
2056
1979
|
getComponentState
|
|
2057
1980
|
} = useComponentState();
|
|
2058
|
-
(0,
|
|
1981
|
+
(0, import_react12.useEffect)(() => {
|
|
2059
1982
|
const recompute = () => {
|
|
2060
1983
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
2061
1984
|
};
|
|
@@ -2066,7 +1989,7 @@ function useColumnGroups() {
|
|
|
2066
1989
|
set: update
|
|
2067
1990
|
});
|
|
2068
1991
|
}, [computedColumnGroups]);
|
|
2069
|
-
(0,
|
|
1992
|
+
(0, import_react12.useEffect)(() => {
|
|
2070
1993
|
return interceptMap(collapsedColumnGroups, {
|
|
2071
1994
|
set: (key, visibleCol) => {
|
|
2072
1995
|
const colIds = key.slice(1);
|
|
@@ -2101,38 +2024,25 @@ function useColumnGroups() {
|
|
|
2101
2024
|
var import_react18 = __toModule(require("react"));
|
|
2102
2025
|
|
|
2103
2026
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2104
|
-
var
|
|
2027
|
+
var React6 = __toModule(require("react"));
|
|
2105
2028
|
|
|
2106
2029
|
// src/utils/join.ts
|
|
2107
2030
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
2108
2031
|
|
|
2109
2032
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2110
|
-
var
|
|
2111
|
-
var
|
|
2033
|
+
var React5 = __toModule(require("react"));
|
|
2034
|
+
var import_react13 = __toModule(require("react"));
|
|
2112
2035
|
|
|
2113
|
-
// src/components/InfiniteTable/
|
|
2114
|
-
var
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2117
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2118
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2119
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2120
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2121
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2122
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2123
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2124
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2125
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2126
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2127
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2128
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2129
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2036
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2037
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2038
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2039
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2130
2040
|
|
|
2131
2041
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2132
2042
|
function ExpanderIcon(props) {
|
|
2133
2043
|
var _a;
|
|
2134
2044
|
const { size = 24 } = props;
|
|
2135
|
-
const [expanded, setExpanded] = (0,
|
|
2045
|
+
const [expanded, setExpanded] = (0, import_react13.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
2136
2046
|
const onClick = () => {
|
|
2137
2047
|
var _a2;
|
|
2138
2048
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -2140,12 +2050,12 @@ function ExpanderIcon(props) {
|
|
|
2140
2050
|
setExpanded(!expanded);
|
|
2141
2051
|
}
|
|
2142
2052
|
};
|
|
2143
|
-
|
|
2053
|
+
React5.useEffect(() => {
|
|
2144
2054
|
if (isControlled("expanded", props)) {
|
|
2145
2055
|
setExpanded(props.expanded);
|
|
2146
2056
|
}
|
|
2147
2057
|
}, [props.expanded]);
|
|
2148
|
-
return /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ React5.createElement("svg", {
|
|
2149
2059
|
"data-name": "expander-icon",
|
|
2150
2060
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2151
2061
|
height: `${size}px`,
|
|
@@ -2153,18 +2063,37 @@ function ExpanderIcon(props) {
|
|
|
2153
2063
|
width: `${size}px`,
|
|
2154
2064
|
style: props.style,
|
|
2155
2065
|
onClick,
|
|
2156
|
-
className: join(props.className,
|
|
2157
|
-
|
|
2066
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2067
|
+
expanded
|
|
2068
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2069
|
+
}, /* @__PURE__ */ React5.createElement("path", {
|
|
2158
2070
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2159
2071
|
}));
|
|
2160
2072
|
}
|
|
2161
2073
|
|
|
2162
2074
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2163
|
-
var
|
|
2075
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2164
2076
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2165
|
-
var RowClsRecipe = (0,
|
|
2077
|
+
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: [] });
|
|
2166
2078
|
var RowHoverCls = "_7pupv01";
|
|
2167
2079
|
|
|
2080
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2081
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2082
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2083
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2084
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2085
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2086
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2087
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2088
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2089
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2090
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2091
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2092
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2093
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2094
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2095
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2096
|
+
|
|
2168
2097
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2169
2098
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2170
2099
|
if (!pivotColumns) {
|
|
@@ -2174,7 +2103,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2174
2103
|
pivotColumn,
|
|
2175
2104
|
pivotRowLabelsColumn,
|
|
2176
2105
|
pivotBy,
|
|
2177
|
-
|
|
2106
|
+
groupBy,
|
|
2178
2107
|
pivotTotalColumnPosition,
|
|
2179
2108
|
toggleGroupRow
|
|
2180
2109
|
} = params;
|
|
@@ -2191,7 +2120,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2191
2120
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2192
2121
|
column,
|
|
2193
2122
|
pivotBy,
|
|
2194
|
-
|
|
2123
|
+
groupBy
|
|
2195
2124
|
}));
|
|
2196
2125
|
} else {
|
|
2197
2126
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2203,7 +2132,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2203
2132
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2204
2133
|
column,
|
|
2205
2134
|
pivotBy,
|
|
2206
|
-
|
|
2135
|
+
groupBy
|
|
2207
2136
|
}));
|
|
2208
2137
|
} else {
|
|
2209
2138
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2212,19 +2141,19 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2212
2141
|
if (!column.render) {
|
|
2213
2142
|
column.render = (renderOptions) => {
|
|
2214
2143
|
var _a;
|
|
2215
|
-
let { value, rowInfo, column: column2,
|
|
2144
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2216
2145
|
if (column2.renderValue) {
|
|
2217
2146
|
value = column2.renderValue(renderOptions);
|
|
2218
2147
|
}
|
|
2219
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2220
|
-
return /* @__PURE__ */
|
|
2148
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2149
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
2221
2150
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2222
|
-
}, showExpanderIcon ? /* @__PURE__ */
|
|
2151
|
+
}, showExpanderIcon ? /* @__PURE__ */ React6.createElement(ExpanderIcon, {
|
|
2223
2152
|
expanded: !rowInfo.collapsed,
|
|
2224
2153
|
onChange: () => {
|
|
2225
2154
|
toggleGroupRow(rowInfo.groupKeys);
|
|
2226
2155
|
}
|
|
2227
|
-
}) : null, /* @__PURE__ */
|
|
2156
|
+
}) : null, /* @__PURE__ */ React6.createElement("div", {
|
|
2228
2157
|
className: cssEllipsisClassName
|
|
2229
2158
|
}, value != null ? value : null));
|
|
2230
2159
|
};
|
|
@@ -2241,7 +2170,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2241
2170
|
}
|
|
2242
2171
|
|
|
2243
2172
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2244
|
-
var
|
|
2173
|
+
var React7 = __toModule(require("react"));
|
|
2245
2174
|
function getGroupColumnRender({
|
|
2246
2175
|
groupIndexForColumn,
|
|
2247
2176
|
groupRenderStrategy,
|
|
@@ -2274,14 +2203,14 @@ function getGroupColumnRender({
|
|
|
2274
2203
|
return null;
|
|
2275
2204
|
}
|
|
2276
2205
|
}
|
|
2277
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2278
2207
|
className: join(display.flex, alignItems.center)
|
|
2279
|
-
}, /* @__PURE__ */
|
|
2208
|
+
}, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2280
2209
|
expanded: !collapsed,
|
|
2281
2210
|
onChange: () => {
|
|
2282
2211
|
toggleGroupRow(groupKeys);
|
|
2283
2212
|
}
|
|
2284
|
-
}), /* @__PURE__ */
|
|
2213
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
2285
2214
|
className: cssEllipsisClassName
|
|
2286
2215
|
}, value != null ? value : null));
|
|
2287
2216
|
};
|
|
@@ -2314,7 +2243,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2314
2243
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2315
2244
|
let generatedGroupColumn = {
|
|
2316
2245
|
header: `Group`,
|
|
2317
|
-
groupByField: options.
|
|
2246
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2318
2247
|
sortable: false,
|
|
2319
2248
|
render: (renderOptions) => {
|
|
2320
2249
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2324,14 +2253,14 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2324
2253
|
if (column.renderValue) {
|
|
2325
2254
|
value = column.renderValue(renderOptions);
|
|
2326
2255
|
}
|
|
2327
|
-
return /* @__PURE__ */
|
|
2256
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2328
2257
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2329
|
-
}, /* @__PURE__ */
|
|
2258
|
+
}, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2330
2259
|
expanded: !rowInfo.collapsed,
|
|
2331
2260
|
onChange: () => {
|
|
2332
2261
|
toggleGroupRow(rowInfo.groupKeys);
|
|
2333
2262
|
}
|
|
2334
|
-
}), /* @__PURE__ */
|
|
2263
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
2335
2264
|
className: cssEllipsisClassName
|
|
2336
2265
|
}, value != null ? value : null));
|
|
2337
2266
|
}
|
|
@@ -2350,64 +2279,233 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2350
2279
|
var import_react17 = __toModule(require("react"));
|
|
2351
2280
|
|
|
2352
2281
|
// src/components/DataSource/index.tsx
|
|
2353
|
-
var
|
|
2282
|
+
var React8 = __toModule(require("react"));
|
|
2354
2283
|
|
|
2355
|
-
// src/
|
|
2356
|
-
var
|
|
2284
|
+
// src/utils/multisort/sortTypes.ts
|
|
2285
|
+
var numberComparator = function(first, second) {
|
|
2286
|
+
return first - second;
|
|
2287
|
+
};
|
|
2288
|
+
var stringComparator = function(first, second) {
|
|
2289
|
+
first = `${first}`;
|
|
2290
|
+
second = `${second}`;
|
|
2291
|
+
return first.localeCompare(second);
|
|
2292
|
+
};
|
|
2293
|
+
var sortTypes = {
|
|
2294
|
+
number: numberComparator,
|
|
2295
|
+
string: stringComparator
|
|
2296
|
+
};
|
|
2297
|
+
var sortTypes_default = sortTypes;
|
|
2357
2298
|
|
|
2358
|
-
// src/
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2299
|
+
// src/utils/multisort/index.ts
|
|
2300
|
+
var multisort = (sortInfo, array, get) => {
|
|
2301
|
+
array.sort(getMultisortFunction(sortInfo, get));
|
|
2302
|
+
return array;
|
|
2303
|
+
};
|
|
2304
|
+
multisort.knownTypes = sortTypes_default;
|
|
2305
|
+
var getSingleSortFunction = (info) => {
|
|
2306
|
+
if (!info) {
|
|
2307
|
+
return;
|
|
2365
2308
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2309
|
+
const field = info.field;
|
|
2310
|
+
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
2311
|
+
if (!dir) {
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
let fn = info.fn;
|
|
2315
|
+
if (!fn && info.type) {
|
|
2316
|
+
fn = multisort.knownTypes[info.type];
|
|
2317
|
+
if (!fn) {
|
|
2318
|
+
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
if (!fn) {
|
|
2322
|
+
fn = sortTypes_default.string;
|
|
2323
|
+
}
|
|
2324
|
+
return (first, second) => {
|
|
2325
|
+
const a = field ? first[field] : first;
|
|
2326
|
+
const b = field ? second[field] : second;
|
|
2327
|
+
return dir * fn(a, b);
|
|
2368
2328
|
};
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2329
|
+
};
|
|
2330
|
+
var getSortFunctions = (sortInfo) => {
|
|
2331
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
2332
|
+
};
|
|
2333
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
2334
|
+
const fns = getSortFunctions(sortInfo);
|
|
2335
|
+
return (first, second) => {
|
|
2336
|
+
if (get) {
|
|
2337
|
+
first = get(first);
|
|
2338
|
+
second = get(second);
|
|
2376
2339
|
}
|
|
2377
|
-
|
|
2378
|
-
|
|
2340
|
+
let result = 0;
|
|
2341
|
+
let i = 0;
|
|
2342
|
+
let fn;
|
|
2343
|
+
const len = fns.length;
|
|
2344
|
+
for (; i < len; i++) {
|
|
2345
|
+
fn = fns[i];
|
|
2346
|
+
if (!fn) {
|
|
2347
|
+
continue;
|
|
2348
|
+
}
|
|
2349
|
+
result = fn(first, second);
|
|
2350
|
+
if (result !== 0) {
|
|
2351
|
+
return result;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
return result;
|
|
2355
|
+
};
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2359
|
+
var import_react15 = __toModule(require("react"));
|
|
2360
|
+
|
|
2361
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2362
|
+
var import_react14 = __toModule(require("react"));
|
|
2363
|
+
function useEffectWithChanges(fn, deps) {
|
|
2364
|
+
const prevRef = (0, import_react14.useRef)({});
|
|
2365
|
+
const oldValuesRef = (0, import_react14.useRef)({});
|
|
2366
|
+
const oldValues = oldValuesRef.current;
|
|
2367
|
+
const changesRef = (0, import_react14.useRef)({});
|
|
2368
|
+
const changes = changesRef.current;
|
|
2369
|
+
const useEffectDeps = [];
|
|
2370
|
+
for (let k in deps) {
|
|
2371
|
+
if (deps.hasOwnProperty(k)) {
|
|
2372
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
2373
|
+
changes[k] = deps[k];
|
|
2374
|
+
oldValues[k] = prevRef.current[k];
|
|
2375
|
+
}
|
|
2376
|
+
useEffectDeps.push(deps[k]);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
prevRef.current = deps;
|
|
2380
|
+
(0, import_react14.useEffect)(() => {
|
|
2381
|
+
const changes2 = changesRef.current;
|
|
2382
|
+
const result = fn(changes2, oldValues);
|
|
2383
|
+
changesRef.current = {};
|
|
2384
|
+
oldValuesRef.current = {};
|
|
2385
|
+
return result;
|
|
2386
|
+
}, useEffectDeps);
|
|
2379
2387
|
}
|
|
2380
2388
|
|
|
2381
2389
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2382
|
-
function
|
|
2383
|
-
|
|
2390
|
+
function buildDataSourceDataParams(componentState) {
|
|
2391
|
+
var _a, _b;
|
|
2392
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2393
|
+
const dataSourceParams = {
|
|
2394
|
+
originalDataArray: componentState.originalDataArray,
|
|
2395
|
+
sortInfo,
|
|
2396
|
+
groupBy: componentState.groupBy,
|
|
2397
|
+
pivotBy: componentState.pivotBy
|
|
2398
|
+
};
|
|
2399
|
+
if (componentState.livePagination !== void 0) {
|
|
2400
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2401
|
+
}
|
|
2402
|
+
return dataSourceParams;
|
|
2403
|
+
}
|
|
2404
|
+
function notifyDataParamsChanged(componentState, actions) {
|
|
2405
|
+
var _a;
|
|
2406
|
+
if (typeof componentState.data === "function") {
|
|
2407
|
+
loadData(componentState.data, componentState, actions);
|
|
2408
|
+
}
|
|
2409
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2410
|
+
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2411
|
+
}
|
|
2412
|
+
function loadData(data, componentState, actions) {
|
|
2413
|
+
const dataParams = buildDataSourceDataParams(componentState);
|
|
2414
|
+
if (typeof data === "function") {
|
|
2415
|
+
data = data(dataParams);
|
|
2416
|
+
}
|
|
2417
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2418
|
+
if (dataIsPromise) {
|
|
2419
|
+
actions.loading = true;
|
|
2420
|
+
}
|
|
2421
|
+
Promise.resolve(data).then((dataParam) => {
|
|
2422
|
+
let dataArray = [];
|
|
2423
|
+
if (Array.isArray(dataParam.data)) {
|
|
2424
|
+
const remoteData = dataParam;
|
|
2425
|
+
dataArray = remoteData.data;
|
|
2426
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
2427
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2428
|
+
}
|
|
2429
|
+
} else {
|
|
2430
|
+
dataArray = dataParam;
|
|
2431
|
+
}
|
|
2432
|
+
actions.originalDataArray = dataArray;
|
|
2433
|
+
if (dataIsPromise) {
|
|
2434
|
+
actions.loading = false;
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2384
2437
|
}
|
|
2385
2438
|
function useLoadData() {
|
|
2386
2439
|
const {
|
|
2440
|
+
getComponentState,
|
|
2387
2441
|
componentActions: actions,
|
|
2388
2442
|
componentState: { data }
|
|
2389
2443
|
} = useComponentState();
|
|
2390
|
-
const loadData = (data2) => {
|
|
2391
|
-
let dataSourceInfo = {
|
|
2392
|
-
originalDataArray: []
|
|
2393
|
-
};
|
|
2394
|
-
if (typeof data2 === "function") {
|
|
2395
|
-
data2 = data2();
|
|
2396
|
-
}
|
|
2397
|
-
if (Array.isArray(data2)) {
|
|
2398
|
-
dataSourceInfo = buildDataSourceInfo(data2);
|
|
2399
|
-
actions.originalDataArray = dataSourceInfo.originalDataArray;
|
|
2400
|
-
} else {
|
|
2401
|
-
actions.loading = true;
|
|
2402
|
-
loadDataAsync(data2).then((dataSourceInfo2) => {
|
|
2403
|
-
actions.originalDataArray = dataSourceInfo2.originalDataArray;
|
|
2404
|
-
actions.loading = false;
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
};
|
|
2408
2444
|
(0, import_react15.useLayoutEffect)(() => {
|
|
2409
|
-
loadData(data);
|
|
2445
|
+
loadData(data, getComponentState(), actions);
|
|
2410
2446
|
}, [data]);
|
|
2447
|
+
useLivePagination();
|
|
2448
|
+
}
|
|
2449
|
+
function useLivePagination() {
|
|
2450
|
+
const {
|
|
2451
|
+
getComponentState,
|
|
2452
|
+
componentActions: actions,
|
|
2453
|
+
componentState
|
|
2454
|
+
} = useComponentState();
|
|
2455
|
+
const {
|
|
2456
|
+
notifyScrollbarsChange,
|
|
2457
|
+
sortInfo,
|
|
2458
|
+
groupBy,
|
|
2459
|
+
pivotBy,
|
|
2460
|
+
livePaginationCursor,
|
|
2461
|
+
scrollBottomId
|
|
2462
|
+
} = componentState;
|
|
2463
|
+
const [scrollbars, setScrollbars] = (0, import_react15.useState)({
|
|
2464
|
+
vertical: false,
|
|
2465
|
+
horizontal: false
|
|
2466
|
+
});
|
|
2467
|
+
const scrollbarsRef = (0, import_react15.useRef)(scrollbars);
|
|
2468
|
+
(0, import_react15.useEffect)(() => {
|
|
2469
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2470
|
+
if (!scrollbars2) {
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2473
|
+
scrollbarsRef.current = scrollbars2;
|
|
2474
|
+
setScrollbars(scrollbars2);
|
|
2475
|
+
});
|
|
2476
|
+
return () => notifyScrollbarsChange.destroy();
|
|
2477
|
+
}, [notifyScrollbarsChange]);
|
|
2478
|
+
const [cursorId, updateCursorId] = (0, import_react15.useState)(void 0);
|
|
2479
|
+
(0, import_react15.useEffect)(() => {
|
|
2480
|
+
const frameId = requestAnimationFrame(() => {
|
|
2481
|
+
var _a;
|
|
2482
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2483
|
+
updateCursorId(livePaginationCursor);
|
|
2484
|
+
}
|
|
2485
|
+
});
|
|
2486
|
+
return () => cancelAnimationFrame(frameId);
|
|
2487
|
+
}, [livePaginationCursor]);
|
|
2488
|
+
(0, import_react15.useEffect)(() => {
|
|
2489
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2490
|
+
if (!scrollbars.vertical && livePagination) {
|
|
2491
|
+
updateCursorId(livePaginationCursor2);
|
|
2492
|
+
}
|
|
2493
|
+
}, [scrollbars.vertical]);
|
|
2494
|
+
(0, import_react15.useEffect)(() => {
|
|
2495
|
+
updateCursorId(scrollBottomId);
|
|
2496
|
+
}, [scrollBottomId]);
|
|
2497
|
+
const depsObject = {
|
|
2498
|
+
sortInfo,
|
|
2499
|
+
groupBy,
|
|
2500
|
+
pivotBy,
|
|
2501
|
+
cursorId
|
|
2502
|
+
};
|
|
2503
|
+
useEffectWithChanges(() => {
|
|
2504
|
+
if (cursorId === void 0) {
|
|
2505
|
+
return;
|
|
2506
|
+
}
|
|
2507
|
+
notifyDataParamsChanged(getComponentState(), actions);
|
|
2508
|
+
}, depsObject);
|
|
2411
2509
|
}
|
|
2412
2510
|
|
|
2413
2511
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
@@ -2461,9 +2559,9 @@ var DeepMap = class {
|
|
|
2461
2559
|
if (!pair) {
|
|
2462
2560
|
return;
|
|
2463
2561
|
}
|
|
2464
|
-
const { map } = pair;
|
|
2562
|
+
const { map: map2 } = pair;
|
|
2465
2563
|
const keys = [...parentKeys, key];
|
|
2466
|
-
const next =
|
|
2564
|
+
const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
|
|
2467
2565
|
if (pair.hasOwnProperty("value")) {
|
|
2468
2566
|
fn(pair.value, keys, i, next);
|
|
2469
2567
|
i++;
|
|
@@ -2479,6 +2577,13 @@ var DeepMap = class {
|
|
|
2479
2577
|
});
|
|
2480
2578
|
}
|
|
2481
2579
|
}
|
|
2580
|
+
static clone(map2) {
|
|
2581
|
+
const clone = new DeepMap();
|
|
2582
|
+
map2.visit((pair, keys) => {
|
|
2583
|
+
clone.set(keys, pair.value);
|
|
2584
|
+
});
|
|
2585
|
+
return clone;
|
|
2586
|
+
}
|
|
2482
2587
|
set(keys, value) {
|
|
2483
2588
|
let currentMap = this.map;
|
|
2484
2589
|
if (!keys.length) {
|
|
@@ -2529,14 +2634,14 @@ var DeepMap = class {
|
|
|
2529
2634
|
return this.length;
|
|
2530
2635
|
}
|
|
2531
2636
|
clear() {
|
|
2532
|
-
const clearMap = (
|
|
2533
|
-
|
|
2534
|
-
const { map:
|
|
2535
|
-
if (
|
|
2536
|
-
clearMap(
|
|
2637
|
+
const clearMap = (map2) => {
|
|
2638
|
+
map2.forEach((value, _key) => {
|
|
2639
|
+
const { map: map3 } = value;
|
|
2640
|
+
if (map3) {
|
|
2641
|
+
clearMap(map3);
|
|
2537
2642
|
}
|
|
2538
2643
|
});
|
|
2539
|
-
|
|
2644
|
+
map2.clear();
|
|
2540
2645
|
};
|
|
2541
2646
|
clearMap(this.map);
|
|
2542
2647
|
this.length = 0;
|
|
@@ -2581,9 +2686,9 @@ var DeepMap = class {
|
|
|
2581
2686
|
}
|
|
2582
2687
|
}
|
|
2583
2688
|
while (maps.length) {
|
|
2584
|
-
let
|
|
2689
|
+
let map2 = maps.pop();
|
|
2585
2690
|
let key = keys.pop();
|
|
2586
|
-
if (key && (
|
|
2691
|
+
if (key && (map2 == null ? void 0 : map2.size) === 0) {
|
|
2587
2692
|
let parentMap = maps[maps.length - 1];
|
|
2588
2693
|
let pair = parentMap == null ? void 0 : parentMap.get(key);
|
|
2589
2694
|
if (pair) {
|
|
@@ -2622,12 +2727,12 @@ var DeepMap = class {
|
|
|
2622
2727
|
if (!pair) {
|
|
2623
2728
|
return;
|
|
2624
2729
|
}
|
|
2625
|
-
const { map } = pair;
|
|
2730
|
+
const { map: map2 } = pair;
|
|
2626
2731
|
const keys = [...parentKeys, key];
|
|
2627
2732
|
const next = once(() => {
|
|
2628
|
-
if (
|
|
2629
|
-
|
|
2630
|
-
this.visitKey(k,
|
|
2733
|
+
if (map2) {
|
|
2734
|
+
map2.forEach((_, k) => {
|
|
2735
|
+
this.visitKey(k, map2, keys, fn);
|
|
2631
2736
|
});
|
|
2632
2737
|
}
|
|
2633
2738
|
});
|
|
@@ -2793,14 +2898,69 @@ var GroupRowsState = class {
|
|
|
2793
2898
|
}
|
|
2794
2899
|
};
|
|
2795
2900
|
|
|
2901
|
+
// src/utils/shallowEqualObjects.ts
|
|
2902
|
+
function shallowEqualObjects(objA, objB) {
|
|
2903
|
+
if (objA === objB) {
|
|
2904
|
+
return true;
|
|
2905
|
+
}
|
|
2906
|
+
if (!objA || !objB) {
|
|
2907
|
+
return false;
|
|
2908
|
+
}
|
|
2909
|
+
var aKeys = Object.keys(objA);
|
|
2910
|
+
var bKeys = Object.keys(objB);
|
|
2911
|
+
var len = aKeys.length;
|
|
2912
|
+
if (bKeys.length !== len) {
|
|
2913
|
+
return false;
|
|
2914
|
+
}
|
|
2915
|
+
for (var i = 0; i < len; i++) {
|
|
2916
|
+
var key = aKeys[i];
|
|
2917
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2918
|
+
return false;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
return true;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2925
|
+
var map = new WeakMap();
|
|
2926
|
+
var getCompareDefault = (a) => a;
|
|
2927
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2928
|
+
map.set(fn, {
|
|
2929
|
+
lastCallTime: 0,
|
|
2930
|
+
lastCallArg: null
|
|
2931
|
+
});
|
|
2932
|
+
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2933
|
+
return (arg) => {
|
|
2934
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2935
|
+
lastCallTime: 0,
|
|
2936
|
+
lastCallArg: null
|
|
2937
|
+
};
|
|
2938
|
+
const now = Date.now();
|
|
2939
|
+
const diff = now - lastCallTime;
|
|
2940
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2941
|
+
if (diff < timeframe && objectsEqual) {
|
|
2942
|
+
return;
|
|
2943
|
+
}
|
|
2944
|
+
map.set(fn, {
|
|
2945
|
+
lastCallTime: now,
|
|
2946
|
+
lastCallArg: arg
|
|
2947
|
+
});
|
|
2948
|
+
fn(arg);
|
|
2949
|
+
};
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2796
2952
|
// src/components/DataSource/state/getInitialState.ts
|
|
2797
2953
|
function initSetupState2() {
|
|
2798
2954
|
const now = Date.now();
|
|
2799
2955
|
const originalDataArray = [];
|
|
2800
2956
|
const dataArray = [];
|
|
2801
2957
|
return {
|
|
2958
|
+
dataParams: void 0,
|
|
2959
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2802
2960
|
pivotTotalColumnPosition: "end",
|
|
2803
2961
|
originalDataArray,
|
|
2962
|
+
scrollBottomId: Symbol("scrollBottomId"),
|
|
2963
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
2804
2964
|
pivotColumns: void 0,
|
|
2805
2965
|
pivotColumnGroups: void 0,
|
|
2806
2966
|
dataArray,
|
|
@@ -2809,7 +2969,6 @@ function initSetupState2() {
|
|
|
2809
2969
|
sortedAt: 0,
|
|
2810
2970
|
reducedAt: now,
|
|
2811
2971
|
generateGroupRows: true,
|
|
2812
|
-
aggregationReducers: void 0,
|
|
2813
2972
|
groupDeepMap: void 0,
|
|
2814
2973
|
postSortDataArray: void 0,
|
|
2815
2974
|
postGroupDataArray: void 0,
|
|
@@ -2817,15 +2976,23 @@ function initSetupState2() {
|
|
|
2817
2976
|
lastGroupDataArray: void 0
|
|
2818
2977
|
};
|
|
2819
2978
|
}
|
|
2979
|
+
function getCompareObject(dataParams) {
|
|
2980
|
+
const obj = __spreadValues({}, dataParams);
|
|
2981
|
+
delete obj.originalDataArray;
|
|
2982
|
+
return obj;
|
|
2983
|
+
}
|
|
2820
2984
|
var forwardProps3 = () => {
|
|
2821
2985
|
return {
|
|
2822
|
-
|
|
2986
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
2823
2987
|
data: 1,
|
|
2824
2988
|
pivotBy: 1,
|
|
2825
2989
|
primaryKey: 1,
|
|
2990
|
+
livePagination: 1,
|
|
2991
|
+
livePaginationCursor: 1,
|
|
2992
|
+
aggregationReducers: 1,
|
|
2826
2993
|
loading: (loading) => loading != null ? loading : false,
|
|
2827
2994
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
2828
|
-
|
|
2995
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
2829
2996
|
groupRowsState: (groupRowsState) => {
|
|
2830
2997
|
return groupRowsState || new GroupRowsState({
|
|
2831
2998
|
expandedRows: true,
|
|
@@ -2835,10 +3002,20 @@ var forwardProps3 = () => {
|
|
|
2835
3002
|
};
|
|
2836
3003
|
};
|
|
2837
3004
|
function mapPropsToState2(params) {
|
|
2838
|
-
var _a;
|
|
2839
3005
|
const { props } = params;
|
|
3006
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
2840
3007
|
return {
|
|
2841
|
-
|
|
3008
|
+
controlledSort,
|
|
3009
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3010
|
+
};
|
|
3011
|
+
}
|
|
3012
|
+
function getInterceptActions() {
|
|
3013
|
+
return {
|
|
3014
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3015
|
+
const dataParams = buildDataSourceDataParams(state);
|
|
3016
|
+
dataParams.sortInfo = sortInfo;
|
|
3017
|
+
actions.dataParams = dataParams;
|
|
3018
|
+
}
|
|
2842
3019
|
};
|
|
2843
3020
|
}
|
|
2844
3021
|
|
|
@@ -2847,19 +3024,28 @@ function DEFAULT_TO_KEY(value) {
|
|
|
2847
3024
|
return value;
|
|
2848
3025
|
}
|
|
2849
3026
|
function initReducers(reducers) {
|
|
2850
|
-
if (!reducers || !reducers.length) {
|
|
2851
|
-
return
|
|
3027
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3028
|
+
return {};
|
|
2852
3029
|
}
|
|
2853
|
-
|
|
3030
|
+
const result = {};
|
|
3031
|
+
for (let key in reducers)
|
|
3032
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3033
|
+
result[key] = reducers[key].initialValue;
|
|
3034
|
+
}
|
|
3035
|
+
return result;
|
|
2854
3036
|
}
|
|
2855
3037
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
2856
|
-
|
|
3038
|
+
var _a, _b;
|
|
3039
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
2857
3040
|
return;
|
|
2858
3041
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
3042
|
+
for (let key in reducers)
|
|
3043
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3044
|
+
const reducer = reducers[key];
|
|
3045
|
+
const currentValue = reducerResults[key];
|
|
3046
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3047
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3048
|
+
}
|
|
2863
3049
|
}
|
|
2864
3050
|
function group(groupParams, data) {
|
|
2865
3051
|
const {
|
|
@@ -2874,7 +3060,7 @@ function group(groupParams, data) {
|
|
|
2874
3060
|
let currentGroupKeys = [];
|
|
2875
3061
|
let currentPivotKeys = [];
|
|
2876
3062
|
const initialReducerValue = initReducers(reducers);
|
|
2877
|
-
const globalReducerResults =
|
|
3063
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2878
3064
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
2879
3065
|
let item = data[i];
|
|
2880
3066
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -2884,7 +3070,7 @@ function group(groupParams, data) {
|
|
|
2884
3070
|
if (!deepMap.has(currentGroupKeys)) {
|
|
2885
3071
|
const deepMapGroupValue = {
|
|
2886
3072
|
items: [],
|
|
2887
|
-
reducerResults:
|
|
3073
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
2888
3074
|
};
|
|
2889
3075
|
if (pivot) {
|
|
2890
3076
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -2908,7 +3094,7 @@ function group(groupParams, data) {
|
|
|
2908
3094
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
2909
3095
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
2910
3096
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
2911
|
-
reducerResults:
|
|
3097
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
2912
3098
|
items: []
|
|
2913
3099
|
});
|
|
2914
3100
|
}
|
|
@@ -2970,11 +3156,23 @@ function flatten(groupResult) {
|
|
|
2970
3156
|
return result;
|
|
2971
3157
|
}
|
|
2972
3158
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
2973
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
3159
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
2974
3160
|
const groupNesting = groupKeys.length;
|
|
2975
3161
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3162
|
+
let data = null;
|
|
3163
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
3164
|
+
data = {};
|
|
3165
|
+
for (let key in reducers)
|
|
3166
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3167
|
+
const reducer = reducers[key];
|
|
3168
|
+
const field = reducer.field;
|
|
3169
|
+
if (field) {
|
|
3170
|
+
data[field] = reducerResults[key];
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
2976
3174
|
const enhancedGroupData = {
|
|
2977
|
-
data
|
|
3175
|
+
data,
|
|
2978
3176
|
groupCount: groupItems.length,
|
|
2979
3177
|
groupData: groupItems,
|
|
2980
3178
|
groupKeys,
|
|
@@ -2996,17 +3194,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
2996
3194
|
return enhancedGroupData;
|
|
2997
3195
|
}
|
|
2998
3196
|
function completeReducers(reducers, reducerResults, items) {
|
|
2999
|
-
if (reducers
|
|
3000
|
-
|
|
3001
|
-
if (
|
|
3002
|
-
|
|
3197
|
+
if (reducers) {
|
|
3198
|
+
for (let key in reducers)
|
|
3199
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3200
|
+
const reducer = reducers[key];
|
|
3201
|
+
if (reducer.done) {
|
|
3202
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
3203
|
+
}
|
|
3003
3204
|
}
|
|
3004
|
-
});
|
|
3005
3205
|
}
|
|
3006
3206
|
return reducerResults;
|
|
3007
3207
|
}
|
|
3008
3208
|
function enhancedFlatten(param) {
|
|
3009
|
-
const {
|
|
3209
|
+
const {
|
|
3210
|
+
groupResult,
|
|
3211
|
+
toPrimaryKey,
|
|
3212
|
+
groupRowsState,
|
|
3213
|
+
generateGroupRows,
|
|
3214
|
+
reducers = {}
|
|
3215
|
+
} = param;
|
|
3010
3216
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
3011
3217
|
const { groupBy } = groupParams;
|
|
3012
3218
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -3021,6 +3227,7 @@ function enhancedFlatten(param) {
|
|
|
3021
3227
|
const enhancedGroupData = getEnhancedGroupData({
|
|
3022
3228
|
groupBy: groupByStrings,
|
|
3023
3229
|
parents: Array.from(parents),
|
|
3230
|
+
reducers,
|
|
3024
3231
|
indexInGroup,
|
|
3025
3232
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3026
3233
|
indexInAll: result.length,
|
|
@@ -3072,88 +3279,46 @@ function enhancedFlatten(param) {
|
|
|
3072
3279
|
};
|
|
3073
3280
|
}
|
|
3074
3281
|
|
|
3075
|
-
// src/utils/
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
};
|
|
3084
|
-
var sortTypes = {
|
|
3085
|
-
number: numberComparator,
|
|
3086
|
-
string: stringComparator
|
|
3087
|
-
};
|
|
3088
|
-
var sortTypes_default = sortTypes;
|
|
3089
|
-
|
|
3090
|
-
// src/utils/multisort/index.ts
|
|
3091
|
-
var multisort = (sortInfo, array, get) => {
|
|
3092
|
-
array.sort(getMultisortFunction(sortInfo, get));
|
|
3093
|
-
return array;
|
|
3094
|
-
};
|
|
3095
|
-
multisort.knownTypes = sortTypes_default;
|
|
3096
|
-
var getSingleSortFunction = (info) => {
|
|
3097
|
-
if (!info) {
|
|
3098
|
-
return;
|
|
3099
|
-
}
|
|
3100
|
-
const field = info.field;
|
|
3101
|
-
var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
3102
|
-
if (!dir) {
|
|
3103
|
-
return;
|
|
3104
|
-
}
|
|
3105
|
-
let fn = info.fn;
|
|
3106
|
-
if (!fn && info.type) {
|
|
3107
|
-
fn = multisort.knownTypes[info.type];
|
|
3108
|
-
if (!fn) {
|
|
3109
|
-
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
3282
|
+
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3283
|
+
function prepareColumn(column) {
|
|
3284
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3285
|
+
if (pivotByForColumn.column) {
|
|
3286
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3287
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3288
|
+
} else {
|
|
3289
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3110
3290
|
}
|
|
3111
3291
|
}
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
var getSortFunctions = (sortInfo) => {
|
|
3122
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
3123
|
-
};
|
|
3124
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
3125
|
-
const fns = getSortFunctions(sortInfo);
|
|
3126
|
-
return (first, second) => {
|
|
3127
|
-
if (get) {
|
|
3128
|
-
first = get(first);
|
|
3129
|
-
second = get(second);
|
|
3130
|
-
}
|
|
3131
|
-
let result = 0;
|
|
3132
|
-
let i = 0;
|
|
3133
|
-
let fn;
|
|
3134
|
-
const len = fns.length;
|
|
3135
|
-
for (; i < len; i++) {
|
|
3136
|
-
fn = fns[i];
|
|
3137
|
-
if (!fn) {
|
|
3138
|
-
continue;
|
|
3139
|
-
}
|
|
3140
|
-
result = fn(first, second);
|
|
3141
|
-
if (result !== 0) {
|
|
3142
|
-
return result;
|
|
3143
|
-
}
|
|
3292
|
+
return column;
|
|
3293
|
+
}
|
|
3294
|
+
function prepareColumnGroup(columnGroup) {
|
|
3295
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3296
|
+
if (pivotByForColumnGroup.columnGroup) {
|
|
3297
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3298
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3299
|
+
} else {
|
|
3300
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3144
3301
|
}
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
}
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3302
|
+
}
|
|
3303
|
+
return columnGroup;
|
|
3304
|
+
}
|
|
3305
|
+
function getPivotColumnsAndColumnGroups({
|
|
3306
|
+
deepMap,
|
|
3307
|
+
pivotBy,
|
|
3308
|
+
pivotTotalColumnPosition,
|
|
3309
|
+
reducers = {},
|
|
3310
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3311
|
+
}) {
|
|
3151
3312
|
const pivotLength = pivotBy.length;
|
|
3313
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3314
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3315
|
+
});
|
|
3152
3316
|
const columns = new Map([
|
|
3153
3317
|
[
|
|
3154
3318
|
"labels",
|
|
3155
3319
|
{
|
|
3156
3320
|
header: "Row labels",
|
|
3321
|
+
pivotBy,
|
|
3157
3322
|
valueGetter: (params) => {
|
|
3158
3323
|
var _a;
|
|
3159
3324
|
const { rowInfo } = params;
|
|
@@ -3163,72 +3328,104 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3163
3328
|
]
|
|
3164
3329
|
]);
|
|
3165
3330
|
const columnGroups = new Map();
|
|
3331
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3166
3332
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3167
3333
|
keys = [...keys];
|
|
3168
3334
|
if (pivotTotalColumnPosition === "end") {
|
|
3169
3335
|
next == null ? void 0 : next();
|
|
3170
3336
|
}
|
|
3171
3337
|
if (keys.length === pivotLength) {
|
|
3172
|
-
const parentKeys = keys.slice(0, -1);
|
|
3173
|
-
let columnGroupId = parentKeys.join("/");
|
|
3174
3338
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3175
|
-
let computedPivotColumn = __spreadValues({
|
|
3176
|
-
pivotBy,
|
|
3177
|
-
pivotColumn: true,
|
|
3178
|
-
pivotGroupKeys: keys,
|
|
3179
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3180
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3181
|
-
pivotByForColumn,
|
|
3182
|
-
sortable: false,
|
|
3183
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3184
|
-
header: keys[keys.length - 1],
|
|
3185
|
-
valueGetter: ({ rowInfo }) => {
|
|
3186
|
-
var _a, _b, _c;
|
|
3187
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3188
|
-
return value;
|
|
3189
|
-
}
|
|
3190
|
-
}, pivotByForColumn.column);
|
|
3191
|
-
if (pivotByForColumn.column) {
|
|
3192
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3193
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3194
|
-
} else {
|
|
3195
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3196
|
-
}
|
|
3197
|
-
}
|
|
3198
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3199
|
-
} else {
|
|
3200
|
-
const colGroupId = keys.join("/");
|
|
3201
3339
|
const parentKeys = keys.slice(0, -1);
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
columnGroup:
|
|
3210
|
-
|
|
3211
|
-
pivotTotalColumn: true,
|
|
3340
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3341
|
+
if (!isSingleAggregationColumn) {
|
|
3342
|
+
const columnGroupId = parentColumnGroupId;
|
|
3343
|
+
parentColumnGroupId = keys.join("/");
|
|
3344
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3345
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3346
|
+
header: pivotGroupKey,
|
|
3347
|
+
columnGroup: columnGroupId,
|
|
3348
|
+
pivotBy,
|
|
3212
3349
|
pivotGroupKeys: keys,
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3350
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3351
|
+
pivotIndex: keys.length - 1,
|
|
3352
|
+
pivotGroupKey
|
|
3353
|
+
}));
|
|
3354
|
+
}
|
|
3355
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3356
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3357
|
+
const computedPivotColumn = prepareColumn({
|
|
3216
3358
|
pivotBy,
|
|
3359
|
+
pivotColumn: true,
|
|
3360
|
+
pivotTotalColumn: false,
|
|
3361
|
+
pivotAggregator: reducer,
|
|
3362
|
+
pivotAggregatorIndex: index,
|
|
3363
|
+
pivotGroupKeys: keys,
|
|
3364
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3365
|
+
pivotIndex: keys.length - 1,
|
|
3366
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3217
3367
|
sortable: false,
|
|
3368
|
+
columnGroup: parentColumnGroupId,
|
|
3369
|
+
header,
|
|
3218
3370
|
valueGetter: ({ rowInfo }) => {
|
|
3219
|
-
var _a, _b
|
|
3220
|
-
|
|
3221
|
-
return value;
|
|
3222
|
-
}
|
|
3223
|
-
}, pivotByForColumn.column);
|
|
3224
|
-
if (pivotByForColumn.column) {
|
|
3225
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3226
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3227
|
-
} else {
|
|
3228
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3371
|
+
var _a, _b;
|
|
3372
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3229
3373
|
}
|
|
3374
|
+
});
|
|
3375
|
+
const columnId = `${keys.join("/")}-${reducer.id}`;
|
|
3376
|
+
columns.set(columnId, computedPivotColumn);
|
|
3377
|
+
});
|
|
3378
|
+
} else {
|
|
3379
|
+
const colGroupId = keys.join("/");
|
|
3380
|
+
const parentKeys = keys.slice(0, -1);
|
|
3381
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3382
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3383
|
+
header: keys[keys.length - 1],
|
|
3384
|
+
pivotBy,
|
|
3385
|
+
pivotGroupKeys: keys,
|
|
3386
|
+
pivotIndex: keys.length - 1,
|
|
3387
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3388
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3389
|
+
}));
|
|
3390
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3391
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3392
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3393
|
+
if (!isSingleAggregationColumn) {
|
|
3394
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3395
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3396
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3397
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3398
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3399
|
+
pivotBy,
|
|
3400
|
+
pivotTotalColumnGroup: true,
|
|
3401
|
+
pivotGroupKeys: keys,
|
|
3402
|
+
pivotIndex: keys.length - 1,
|
|
3403
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3404
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3405
|
+
}));
|
|
3230
3406
|
}
|
|
3231
|
-
|
|
3407
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3408
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3409
|
+
const computedPivotColumn = prepareColumn({
|
|
3410
|
+
columnGroup: columnGroupId,
|
|
3411
|
+
header,
|
|
3412
|
+
pivotAggregator: reducer,
|
|
3413
|
+
pivotAggregatorIndex: index,
|
|
3414
|
+
pivotColumn: true,
|
|
3415
|
+
pivotTotalColumn: true,
|
|
3416
|
+
pivotGroupKeys: keys,
|
|
3417
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3418
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3419
|
+
pivotIndex: keys.length - 1,
|
|
3420
|
+
pivotBy,
|
|
3421
|
+
sortable: false,
|
|
3422
|
+
valueGetter: ({ rowInfo }) => {
|
|
3423
|
+
var _a, _b;
|
|
3424
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3425
|
+
}
|
|
3426
|
+
});
|
|
3427
|
+
columns.set(`total:${keys.join("/")}-${reducer.id}`, computedPivotColumn);
|
|
3428
|
+
});
|
|
3232
3429
|
}
|
|
3233
3430
|
}
|
|
3234
3431
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3238,9 +3435,12 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3238
3435
|
if (columns.size === 1) {
|
|
3239
3436
|
columns.set("single", {
|
|
3240
3437
|
header: "Reduced",
|
|
3438
|
+
pivotBy,
|
|
3439
|
+
pivotColumn: true,
|
|
3241
3440
|
valueGetter: ({ rowInfo }) => {
|
|
3242
3441
|
var _a;
|
|
3243
|
-
|
|
3442
|
+
const key = Object.keys(rowInfo.reducerResults || {})[0];
|
|
3443
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[key];
|
|
3244
3444
|
}
|
|
3245
3445
|
});
|
|
3246
3446
|
}
|
|
@@ -3264,29 +3464,37 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3264
3464
|
return false;
|
|
3265
3465
|
};
|
|
3266
3466
|
function toRowInfo(data, id, index) {
|
|
3267
|
-
return {
|
|
3467
|
+
return {
|
|
3468
|
+
data,
|
|
3469
|
+
collapsed: true,
|
|
3470
|
+
id,
|
|
3471
|
+
indexInAll: index,
|
|
3472
|
+
indexInGroup: index,
|
|
3473
|
+
isGroupRow: false
|
|
3474
|
+
};
|
|
3268
3475
|
}
|
|
3269
3476
|
function concludeReducer(params) {
|
|
3270
3477
|
var _a;
|
|
3271
3478
|
const { state, previousState } = params;
|
|
3272
3479
|
const sortInfo = state.sortInfo;
|
|
3273
|
-
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
|
|
3480
|
+
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3274
3481
|
const sortDepsChanged = haveDepsChanged(previousState, state, [
|
|
3275
3482
|
"originalDataArray",
|
|
3276
3483
|
"sortInfo"
|
|
3277
3484
|
]);
|
|
3278
3485
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3279
|
-
const groupBy = state.
|
|
3486
|
+
const groupBy = state.groupBy;
|
|
3280
3487
|
const pivotBy = state.pivotBy;
|
|
3281
3488
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3282
3489
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3283
3490
|
"generateGroupRows",
|
|
3284
3491
|
"originalDataArray",
|
|
3285
|
-
"
|
|
3492
|
+
"groupBy",
|
|
3286
3493
|
"groupRowsState",
|
|
3287
3494
|
"pivotBy",
|
|
3288
3495
|
"aggregationReducers",
|
|
3289
3496
|
"pivotTotalColumnPosition",
|
|
3497
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3290
3498
|
"sortInfo"
|
|
3291
3499
|
]);
|
|
3292
3500
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3312,13 +3520,20 @@ function concludeReducer(params) {
|
|
|
3312
3520
|
}, dataArray);
|
|
3313
3521
|
const flattenResult = enhancedFlatten({
|
|
3314
3522
|
groupResult,
|
|
3523
|
+
reducers: state.aggregationReducers,
|
|
3315
3524
|
toPrimaryKey,
|
|
3316
3525
|
groupRowsState: state.groupRowsState,
|
|
3317
3526
|
generateGroupRows: state.generateGroupRows
|
|
3318
3527
|
});
|
|
3319
3528
|
rowInfoDataArray = flattenResult.data;
|
|
3320
3529
|
state.groupDeepMap = groupResult.deepMap;
|
|
3321
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3530
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3531
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3532
|
+
pivotBy,
|
|
3533
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3534
|
+
reducers: state.aggregationReducers,
|
|
3535
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3536
|
+
}) : void 0;
|
|
3322
3537
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3323
3538
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3324
3539
|
} else {
|
|
@@ -3340,7 +3555,9 @@ function concludeReducer(params) {
|
|
|
3340
3555
|
}
|
|
3341
3556
|
state.dataArray = rowInfoDataArray;
|
|
3342
3557
|
state.reducedAt = now;
|
|
3343
|
-
|
|
3558
|
+
if (true) {
|
|
3559
|
+
globalThis.state = state;
|
|
3560
|
+
}
|
|
3344
3561
|
return state;
|
|
3345
3562
|
}
|
|
3346
3563
|
|
|
@@ -3357,13 +3574,14 @@ function DataSourceWithContext(props) {
|
|
|
3357
3574
|
if (typeof children === "function") {
|
|
3358
3575
|
children = children(computedValues);
|
|
3359
3576
|
}
|
|
3360
|
-
return /* @__PURE__ */
|
|
3577
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children);
|
|
3361
3578
|
}
|
|
3362
3579
|
var DataSourceRoot = getComponentStateRoot({
|
|
3363
3580
|
initSetupState: initSetupState2,
|
|
3364
3581
|
forwardProps: forwardProps3,
|
|
3365
3582
|
concludeReducer,
|
|
3366
|
-
mapPropsToState: mapPropsToState2
|
|
3583
|
+
mapPropsToState: mapPropsToState2,
|
|
3584
|
+
interceptActions: getInterceptActions()
|
|
3367
3585
|
});
|
|
3368
3586
|
function DataSourceCmp({ children }) {
|
|
3369
3587
|
const DataSourceContext = getDataSourceContext();
|
|
@@ -3378,14 +3596,14 @@ function DataSourceCmp({ children }) {
|
|
|
3378
3596
|
globalThis.getDataSourceState = getState;
|
|
3379
3597
|
}
|
|
3380
3598
|
useLoadData();
|
|
3381
|
-
return /* @__PURE__ */
|
|
3599
|
+
return /* @__PURE__ */ React8.createElement(DataSourceContext.Provider, {
|
|
3382
3600
|
value: contextValue
|
|
3383
|
-
}, /* @__PURE__ */
|
|
3601
|
+
}, /* @__PURE__ */ React8.createElement(DataSourceWithContext, {
|
|
3384
3602
|
children
|
|
3385
3603
|
}));
|
|
3386
3604
|
}
|
|
3387
3605
|
function DataSource(props) {
|
|
3388
|
-
return /* @__PURE__ */
|
|
3606
|
+
return /* @__PURE__ */ React8.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React8.createElement(DataSourceCmp, {
|
|
3389
3607
|
children: props.children
|
|
3390
3608
|
}));
|
|
3391
3609
|
}
|
|
@@ -3402,49 +3620,49 @@ function useToggleGroupRow() {
|
|
|
3402
3620
|
}
|
|
3403
3621
|
|
|
3404
3622
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3405
|
-
function
|
|
3406
|
-
const
|
|
3407
|
-
return
|
|
3408
|
-
acc.set(
|
|
3409
|
-
groupBy,
|
|
3623
|
+
function useGroupByMap(groupBy) {
|
|
3624
|
+
const groupByMap = (0, import_react18.useMemo)(() => {
|
|
3625
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3626
|
+
acc.set(groupBy2.field, {
|
|
3627
|
+
groupBy: groupBy2,
|
|
3410
3628
|
groupIndex: index
|
|
3411
3629
|
});
|
|
3412
3630
|
return acc;
|
|
3413
3631
|
}, new Map());
|
|
3414
|
-
}, [
|
|
3415
|
-
return
|
|
3632
|
+
}, [groupBy]);
|
|
3633
|
+
return groupByMap;
|
|
3416
3634
|
}
|
|
3417
3635
|
function useColumnsWhen() {
|
|
3418
3636
|
const {
|
|
3419
|
-
componentState: {
|
|
3637
|
+
componentState: { groupBy },
|
|
3420
3638
|
componentActions: dataSourceActions
|
|
3421
3639
|
} = useDataSourceContextValue();
|
|
3422
3640
|
const {
|
|
3423
3641
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3424
3642
|
} = useComponentState();
|
|
3425
|
-
const
|
|
3643
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3426
3644
|
(0, import_react18.useEffect)(() => {
|
|
3427
3645
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3428
3646
|
}, [groupRenderStrategy]);
|
|
3429
3647
|
(0, import_react18.useEffect)(() => {
|
|
3430
3648
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3431
3649
|
}, [pivotTotalColumnPosition]);
|
|
3432
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3650
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3433
3651
|
useColumnsWhenPivoting();
|
|
3434
3652
|
useColumnsWhenGrouping();
|
|
3435
|
-
useHideEmptyGroupColumns(
|
|
3653
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3436
3654
|
}
|
|
3437
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3655
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3438
3656
|
const toggleGroupRow = useToggleGroupRow();
|
|
3439
3657
|
const {
|
|
3440
3658
|
componentActions,
|
|
3441
3659
|
componentState: { columns, groupRenderStrategy }
|
|
3442
3660
|
} = useComponentState();
|
|
3443
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3661
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3444
3662
|
const computedColumns = new Map();
|
|
3445
3663
|
columns2.forEach((column, id) => {
|
|
3446
3664
|
let base = {};
|
|
3447
|
-
const groupByForColumn =
|
|
3665
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3448
3666
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3449
3667
|
const { groupIndex } = groupByForColumn;
|
|
3450
3668
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3491,7 +3709,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3491
3709
|
}
|
|
3492
3710
|
(0, import_react18.useEffect)(() => {
|
|
3493
3711
|
const update = () => {
|
|
3494
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
3712
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3495
3713
|
};
|
|
3496
3714
|
update();
|
|
3497
3715
|
return interceptMap(columns, {
|
|
@@ -3499,11 +3717,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3499
3717
|
delete: update,
|
|
3500
3718
|
clear: update
|
|
3501
3719
|
});
|
|
3502
|
-
}, [columns,
|
|
3720
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3503
3721
|
}
|
|
3504
3722
|
function useColumnsWhenPivoting() {
|
|
3505
3723
|
const {
|
|
3506
|
-
componentState: {
|
|
3724
|
+
componentState: { groupBy, pivotBy }
|
|
3507
3725
|
} = useDataSourceContextValue();
|
|
3508
3726
|
const {
|
|
3509
3727
|
componentActions,
|
|
@@ -3521,7 +3739,7 @@ function useColumnsWhenPivoting() {
|
|
|
3521
3739
|
pivotRowLabelsColumn,
|
|
3522
3740
|
pivotTotalColumnPosition,
|
|
3523
3741
|
pivotBy,
|
|
3524
|
-
|
|
3742
|
+
groupBy,
|
|
3525
3743
|
toggleGroupRow
|
|
3526
3744
|
});
|
|
3527
3745
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3529,7 +3747,7 @@ function useColumnsWhenPivoting() {
|
|
|
3529
3747
|
}
|
|
3530
3748
|
function useColumnsWhenGrouping() {
|
|
3531
3749
|
const {
|
|
3532
|
-
componentState: {
|
|
3750
|
+
componentState: { groupBy }
|
|
3533
3751
|
} = useDataSourceContextValue();
|
|
3534
3752
|
const {
|
|
3535
3753
|
componentActions,
|
|
@@ -3545,7 +3763,7 @@ function useColumnsWhenGrouping() {
|
|
|
3545
3763
|
columns,
|
|
3546
3764
|
groupColumn,
|
|
3547
3765
|
groupRenderStrategy,
|
|
3548
|
-
|
|
3766
|
+
groupBy,
|
|
3549
3767
|
pivotColumns,
|
|
3550
3768
|
toggleGroupRow
|
|
3551
3769
|
});
|
|
@@ -3557,11 +3775,11 @@ function useColumnsWhenGrouping() {
|
|
|
3557
3775
|
delete: update,
|
|
3558
3776
|
clear: update
|
|
3559
3777
|
});
|
|
3560
|
-
}, [
|
|
3778
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3561
3779
|
}
|
|
3562
3780
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3563
3781
|
const {
|
|
3564
|
-
componentState: {
|
|
3782
|
+
componentState: { groupBy, groupRowsState },
|
|
3565
3783
|
getState: getDataSourceState
|
|
3566
3784
|
} = useDataSourceContextValue();
|
|
3567
3785
|
const {
|
|
@@ -3574,10 +3792,10 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3574
3792
|
}
|
|
3575
3793
|
} = useComponentState();
|
|
3576
3794
|
(0, import_react18.useEffect)(() => {
|
|
3577
|
-
if (groupRenderStrategy
|
|
3795
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3578
3796
|
return;
|
|
3579
3797
|
}
|
|
3580
|
-
const groupsLength =
|
|
3798
|
+
const groupsLength = groupBy.length;
|
|
3581
3799
|
let expandedGroupsLevel = 0;
|
|
3582
3800
|
const { dataArray } = getDataSourceState();
|
|
3583
3801
|
const len = dataArray.length;
|
|
@@ -3593,15 +3811,15 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3593
3811
|
let updated = false;
|
|
3594
3812
|
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3595
3813
|
const cols = computedColumns;
|
|
3596
|
-
|
|
3597
|
-
const colId =
|
|
3598
|
-
|
|
3814
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3815
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
3816
|
+
let col = cols.get(colId);
|
|
3599
3817
|
if (!col) {
|
|
3600
3818
|
return;
|
|
3601
3819
|
}
|
|
3602
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3820
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3603
3821
|
updated = true;
|
|
3604
|
-
if (shouldBeHidden
|
|
3822
|
+
if (shouldBeHidden) {
|
|
3605
3823
|
columnVisibility.set(colId, false);
|
|
3606
3824
|
} else {
|
|
3607
3825
|
columnVisibility.delete(colId);
|
|
@@ -3614,7 +3832,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3614
3832
|
getDataSourceState,
|
|
3615
3833
|
groupRenderStrategy,
|
|
3616
3834
|
generatedColumns,
|
|
3617
|
-
|
|
3835
|
+
groupBy,
|
|
3618
3836
|
groupRowsMap,
|
|
3619
3837
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3620
3838
|
hideEmptyGroupColumns
|
|
@@ -3623,7 +3841,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3623
3841
|
function getColumnsWhenGrouping(params) {
|
|
3624
3842
|
const {
|
|
3625
3843
|
pivotColumns,
|
|
3626
|
-
|
|
3844
|
+
groupBy,
|
|
3627
3845
|
groupColumn,
|
|
3628
3846
|
groupRenderStrategy,
|
|
3629
3847
|
toggleGroupRow,
|
|
@@ -3637,10 +3855,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
3637
3855
|
}
|
|
3638
3856
|
const computedColumns = new Map();
|
|
3639
3857
|
if (groupRenderStrategy === "multi-column") {
|
|
3640
|
-
|
|
3858
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3641
3859
|
const generatedGroupColumn = getColumnForGroupBy({
|
|
3642
3860
|
groupByForColumn,
|
|
3643
|
-
|
|
3861
|
+
groupBy,
|
|
3644
3862
|
groupIndexForColumn,
|
|
3645
3863
|
groupCount: arr.length,
|
|
3646
3864
|
groupRenderStrategy
|
|
@@ -3649,8 +3867,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
3649
3867
|
});
|
|
3650
3868
|
} else if (groupRenderStrategy === "single-column") {
|
|
3651
3869
|
const singleGroupColumn = getSingleGroupColumn({
|
|
3652
|
-
groupCount:
|
|
3653
|
-
|
|
3870
|
+
groupCount: groupBy.length,
|
|
3871
|
+
groupBy,
|
|
3654
3872
|
groupRenderStrategy
|
|
3655
3873
|
}, toggleGroupRow, groupColumn);
|
|
3656
3874
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
@@ -3675,7 +3893,8 @@ function useComputed() {
|
|
|
3675
3893
|
columnPinning,
|
|
3676
3894
|
columnSizing,
|
|
3677
3895
|
columnTypes,
|
|
3678
|
-
bodySize
|
|
3896
|
+
bodySize,
|
|
3897
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3679
3898
|
} = componentState;
|
|
3680
3899
|
(0, import_react19.useState)(() => {
|
|
3681
3900
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
@@ -3689,13 +3908,16 @@ function useComputed() {
|
|
|
3689
3908
|
}
|
|
3690
3909
|
});
|
|
3691
3910
|
});
|
|
3692
|
-
|
|
3911
|
+
(0, import_react19.useEffect)(() => {
|
|
3912
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3913
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3693
3914
|
const { multiSort } = dataSourceState;
|
|
3694
3915
|
useColumnGroups();
|
|
3695
3916
|
useColumnsWhen();
|
|
3696
3917
|
const setSortInfo = (0, import_react19.useCallback)((sortInfo) => {
|
|
3697
3918
|
var _a2;
|
|
3698
|
-
|
|
3919
|
+
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3920
|
+
dataSourceActions.sortInfo = newSortInfo;
|
|
3699
3921
|
}, []);
|
|
3700
3922
|
const columns = componentState.computedColumns;
|
|
3701
3923
|
const {
|
|
@@ -3783,7 +4005,7 @@ function useComputed() {
|
|
|
3783
4005
|
}
|
|
3784
4006
|
|
|
3785
4007
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3786
|
-
var
|
|
4008
|
+
var React9 = __toModule(require("react"));
|
|
3787
4009
|
|
|
3788
4010
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3789
4011
|
var useInternalProps = () => {
|
|
@@ -3791,9 +4013,9 @@ var useInternalProps = () => {
|
|
|
3791
4013
|
};
|
|
3792
4014
|
|
|
3793
4015
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3794
|
-
var InfiniteTableBody =
|
|
4016
|
+
var InfiniteTableBody = React9.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3795
4017
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
3796
|
-
return /* @__PURE__ */
|
|
4018
|
+
return /* @__PURE__ */ React9.createElement("div", __spreadProps(__spreadValues({
|
|
3797
4019
|
ref
|
|
3798
4020
|
}, props), {
|
|
3799
4021
|
className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
@@ -3801,16 +4023,16 @@ var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, re
|
|
|
3801
4023
|
});
|
|
3802
4024
|
|
|
3803
4025
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3804
|
-
var
|
|
4026
|
+
var React21 = __toModule(require("react"));
|
|
3805
4027
|
|
|
3806
4028
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3807
|
-
var
|
|
4029
|
+
var React10 = __toModule(require("react"));
|
|
3808
4030
|
function HorizontalScrollbarPlaceholderFn(props) {
|
|
3809
4031
|
const scrollbarWidth2 = getScrollbarWidth();
|
|
3810
4032
|
if (!scrollbarWidth2) {
|
|
3811
4033
|
return null;
|
|
3812
4034
|
}
|
|
3813
|
-
return /* @__PURE__ */
|
|
4035
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3814
4036
|
"data-name": "horizontal-scrollbar-placeholder",
|
|
3815
4037
|
style: __spreadValues({
|
|
3816
4038
|
position: "absolute",
|
|
@@ -3820,13 +4042,13 @@ function HorizontalScrollbarPlaceholderFn(props) {
|
|
|
3820
4042
|
}, props.style)
|
|
3821
4043
|
});
|
|
3822
4044
|
}
|
|
3823
|
-
var HorizontalScrollbarPlaceholder =
|
|
4045
|
+
var HorizontalScrollbarPlaceholder = React10.memo(HorizontalScrollbarPlaceholderFn);
|
|
3824
4046
|
function VerticalScrollbarPlaceholderFn(props) {
|
|
3825
4047
|
const scrollbarWidth2 = getScrollbarWidth();
|
|
3826
4048
|
if (!scrollbarWidth2) {
|
|
3827
4049
|
return null;
|
|
3828
4050
|
}
|
|
3829
|
-
return /* @__PURE__ */
|
|
4051
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3830
4052
|
"data-name": "vertical-scrollbar-placeholder",
|
|
3831
4053
|
style: __spreadValues({
|
|
3832
4054
|
position: "absolute",
|
|
@@ -3836,14 +4058,14 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3836
4058
|
}, props.style)
|
|
3837
4059
|
});
|
|
3838
4060
|
}
|
|
3839
|
-
var VerticalScrollbarPlaceholder =
|
|
4061
|
+
var VerticalScrollbarPlaceholder = React10.memo(VerticalScrollbarPlaceholderFn);
|
|
3840
4062
|
|
|
3841
4063
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3842
|
-
var
|
|
4064
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3843
4065
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3844
4066
|
var HeaderCellProxy = "_12zfob10";
|
|
3845
|
-
var HeaderCellRecipe = (0,
|
|
3846
|
-
var HeaderClsRecipe = (0,
|
|
4067
|
+
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"]] });
|
|
4068
|
+
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"]] });
|
|
3847
4069
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
3848
4070
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
3849
4071
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -3851,15 +4073,15 @@ var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
|
3851
4073
|
var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
3852
4074
|
|
|
3853
4075
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
3854
|
-
var
|
|
4076
|
+
var React17 = __toModule(require("react"));
|
|
3855
4077
|
var import_react27 = __toModule(require("react"));
|
|
3856
4078
|
|
|
3857
4079
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3858
|
-
var
|
|
4080
|
+
var React13 = __toModule(require("react"));
|
|
3859
4081
|
var import_react23 = __toModule(require("react"));
|
|
3860
4082
|
|
|
3861
4083
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3862
|
-
var
|
|
4084
|
+
var React11 = __toModule(require("react"));
|
|
3863
4085
|
|
|
3864
4086
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3865
4087
|
var import_react20 = __toModule(require("react"));
|
|
@@ -3870,10 +4092,10 @@ var useInfiniteTableState = () => {
|
|
|
3870
4092
|
};
|
|
3871
4093
|
|
|
3872
4094
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3873
|
-
var
|
|
4095
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3874
4096
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3875
4097
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3876
|
-
var ColumnCellRecipe = (0,
|
|
4098
|
+
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"]] });
|
|
3877
4099
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
3878
4100
|
|
|
3879
4101
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -3918,16 +4140,16 @@ function InfiniteTableCellFn(props) {
|
|
|
3918
4140
|
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
3919
4141
|
}
|
|
3920
4142
|
}
|
|
3921
|
-
return /* @__PURE__ */
|
|
4143
|
+
return /* @__PURE__ */ React11.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
3922
4144
|
ref: domRef,
|
|
3923
4145
|
style,
|
|
3924
4146
|
"data-name": `Cell`,
|
|
3925
4147
|
className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, CellCls2, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : "")
|
|
3926
|
-
}), beforeChildren, cssEllipsis ? /* @__PURE__ */
|
|
4148
|
+
}), beforeChildren, cssEllipsis ? /* @__PURE__ */ React11.createElement("div", {
|
|
3927
4149
|
className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
|
|
3928
4150
|
}, children) : children, afterChildren);
|
|
3929
4151
|
}
|
|
3930
|
-
var InfiniteTableCell =
|
|
4152
|
+
var InfiniteTableCell = React11.memo(InfiniteTableCellFn);
|
|
3931
4153
|
|
|
3932
4154
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3933
4155
|
var import_binary_search = __toModule(require_binary_search());
|
|
@@ -4122,7 +4344,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4122
4344
|
var import_react_dom = __toModule(require("react-dom"));
|
|
4123
4345
|
|
|
4124
4346
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4125
|
-
var
|
|
4347
|
+
var React12 = __toModule(require("react"));
|
|
4126
4348
|
var import_react22 = __toModule(require("react"));
|
|
4127
4349
|
var defaultLineStyle = {
|
|
4128
4350
|
marginTop: 2,
|
|
@@ -4176,18 +4398,18 @@ function SortIcon(props) {
|
|
|
4176
4398
|
if (direction === -1) {
|
|
4177
4399
|
indexStyle.top = "100%";
|
|
4178
4400
|
}
|
|
4179
|
-
return /* @__PURE__ */
|
|
4401
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
4180
4402
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
4181
4403
|
className: join(className, "ITableIcon", "ITableIcon-sort")
|
|
4182
|
-
}, showIndex ? /* @__PURE__ */
|
|
4404
|
+
}, showIndex ? /* @__PURE__ */ React12.createElement("div", {
|
|
4183
4405
|
"data-name": "index",
|
|
4184
4406
|
style: indexStyle
|
|
4185
|
-
}, index) : null, /* @__PURE__ */
|
|
4407
|
+
}, index) : null, /* @__PURE__ */ React12.createElement("div", {
|
|
4186
4408
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
4187
4409
|
onTransitionEnd
|
|
4188
|
-
}), /* @__PURE__ */
|
|
4410
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
4189
4411
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
4190
|
-
}), /* @__PURE__ */
|
|
4412
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
4191
4413
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
4192
4414
|
}));
|
|
4193
4415
|
}
|
|
@@ -4218,7 +4440,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4218
4440
|
});
|
|
4219
4441
|
}
|
|
4220
4442
|
header = header != null ? header : column.name;
|
|
4221
|
-
const sortTool = /* @__PURE__ */
|
|
4443
|
+
const sortTool = /* @__PURE__ */ React13.createElement(SortIcon, {
|
|
4222
4444
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4223
4445
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4224
4446
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
@@ -4256,7 +4478,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4256
4478
|
let offset = offsetFromProps != null ? offsetFromProps : virtualized ? 0 : column.computedPinningOffset;
|
|
4257
4479
|
let draggingProxy = null;
|
|
4258
4480
|
if (dragging) {
|
|
4259
|
-
draggingProxy = /* @__PURE__ */
|
|
4481
|
+
draggingProxy = /* @__PURE__ */ React13.createElement("div", {
|
|
4260
4482
|
className: `${baseCls}Proxy ${HeaderCellProxy}`,
|
|
4261
4483
|
style: {
|
|
4262
4484
|
position: "absolute",
|
|
@@ -4269,7 +4491,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4269
4491
|
}, header);
|
|
4270
4492
|
draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
|
|
4271
4493
|
}
|
|
4272
|
-
return /* @__PURE__ */
|
|
4494
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(InfiniteTableCell, {
|
|
4273
4495
|
domRef: ref,
|
|
4274
4496
|
column,
|
|
4275
4497
|
"data-name": `HeaderCell`,
|
|
@@ -4285,11 +4507,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4285
4507
|
}
|
|
4286
4508
|
|
|
4287
4509
|
// src/components/RawList/index.tsx
|
|
4288
|
-
var
|
|
4510
|
+
var React16 = __toModule(require("react"));
|
|
4289
4511
|
var import_react26 = __toModule(require("react"));
|
|
4290
4512
|
|
|
4291
4513
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4292
|
-
var
|
|
4514
|
+
var React14 = __toModule(require("react"));
|
|
4293
4515
|
var import_react24 = __toModule(require("react"));
|
|
4294
4516
|
function AvoidReactDiffFn(props) {
|
|
4295
4517
|
const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
|
|
@@ -4299,15 +4521,15 @@ function AvoidReactDiffFn(props) {
|
|
|
4299
4521
|
});
|
|
4300
4522
|
return remove;
|
|
4301
4523
|
}, [props.updater]);
|
|
4302
|
-
return /* @__PURE__ */
|
|
4524
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, children);
|
|
4303
4525
|
}
|
|
4304
|
-
var AvoidReactDiff =
|
|
4526
|
+
var AvoidReactDiff = React14.memo(AvoidReactDiffFn);
|
|
4305
4527
|
|
|
4306
4528
|
// src/components/RawList/useVirtualRenderer.ts
|
|
4307
4529
|
var import_react25 = __toModule(require("react"));
|
|
4308
4530
|
|
|
4309
4531
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4310
|
-
var
|
|
4532
|
+
var React15 = __toModule(require("react"));
|
|
4311
4533
|
|
|
4312
4534
|
// src/components/RawList/MappedItems.ts
|
|
4313
4535
|
var MappedItems = class extends Logger {
|
|
@@ -4323,10 +4545,10 @@ var MappedItems = class extends Logger {
|
|
|
4323
4545
|
return result;
|
|
4324
4546
|
};
|
|
4325
4547
|
this.getElementsOutsideItemRange = (startIndex, endIndex) => {
|
|
4326
|
-
const
|
|
4548
|
+
const map2 = this.elementIndexToItemIndex;
|
|
4327
4549
|
const result = [];
|
|
4328
|
-
for (const elementIndex in
|
|
4329
|
-
const itemIndex =
|
|
4550
|
+
for (const elementIndex in map2) {
|
|
4551
|
+
const itemIndex = map2[elementIndex];
|
|
4330
4552
|
if (itemIndex < startIndex || itemIndex > endIndex) {
|
|
4331
4553
|
result.push(elementIndex >> 0);
|
|
4332
4554
|
}
|
|
@@ -4552,7 +4774,7 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4552
4774
|
};
|
|
4553
4775
|
this.itemDOMRefs[elementIndex] = domRef;
|
|
4554
4776
|
this.updaters[elementIndex] = buildSubscriptionCallback();
|
|
4555
|
-
const item = /* @__PURE__ */
|
|
4777
|
+
const item = /* @__PURE__ */ React15.createElement(AvoidReactDiff, {
|
|
4556
4778
|
key: elementIndex,
|
|
4557
4779
|
name: `${elementIndex}`,
|
|
4558
4780
|
updater: this.updaters[elementIndex]
|
|
@@ -4649,11 +4871,11 @@ function RawListFn(props) {
|
|
|
4649
4871
|
});
|
|
4650
4872
|
return remove;
|
|
4651
4873
|
}, [brain, onRenderUpdater]);
|
|
4652
|
-
return /* @__PURE__ */
|
|
4874
|
+
return /* @__PURE__ */ React16.createElement(AvoidReactDiff, {
|
|
4653
4875
|
updater: onRenderUpdater
|
|
4654
4876
|
});
|
|
4655
4877
|
}
|
|
4656
|
-
var RawList =
|
|
4878
|
+
var RawList = React16.memo(RawListFn);
|
|
4657
4879
|
|
|
4658
4880
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4659
4881
|
var debug3 = dbg("Header");
|
|
@@ -4674,7 +4896,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4674
4896
|
}
|
|
4675
4897
|
return null;
|
|
4676
4898
|
}
|
|
4677
|
-
return /* @__PURE__ */
|
|
4899
|
+
return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderCell, {
|
|
4678
4900
|
domRef: domRef2,
|
|
4679
4901
|
column,
|
|
4680
4902
|
headerHeight,
|
|
@@ -4699,22 +4921,22 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4699
4921
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4700
4922
|
style
|
|
4701
4923
|
};
|
|
4702
|
-
return /* @__PURE__ */
|
|
4924
|
+
return /* @__PURE__ */ React17.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React17.createElement(RawList, {
|
|
4703
4925
|
brain,
|
|
4704
4926
|
renderItem: renderColumn
|
|
4705
4927
|
}));
|
|
4706
4928
|
}
|
|
4707
|
-
var InfiniteTableHeader =
|
|
4929
|
+
var InfiniteTableHeader = React17.memo(InfiniteTableHeaderFn);
|
|
4708
4930
|
|
|
4709
4931
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4710
|
-
var
|
|
4932
|
+
var React20 = __toModule(require("react"));
|
|
4711
4933
|
|
|
4712
4934
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
4713
|
-
var
|
|
4935
|
+
var React19 = __toModule(require("react"));
|
|
4714
4936
|
|
|
4715
4937
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4716
4938
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
4717
|
-
const
|
|
4939
|
+
const map2 = new Map();
|
|
4718
4940
|
const temporaryMap = new Map();
|
|
4719
4941
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
4720
4942
|
columns.forEach((col, index) => {
|
|
@@ -4732,7 +4954,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4732
4954
|
computedWidth: col.computedWidth,
|
|
4733
4955
|
depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
|
|
4734
4956
|
};
|
|
4735
|
-
|
|
4957
|
+
map2.set([colId], colItem);
|
|
4736
4958
|
let groupId = col.columnGroup;
|
|
4737
4959
|
let colGroupItem;
|
|
4738
4960
|
let prevGroupItem = colItem;
|
|
@@ -4754,7 +4976,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4754
4976
|
computedWidth: 0,
|
|
4755
4977
|
depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
|
|
4756
4978
|
};
|
|
4757
|
-
|
|
4979
|
+
map2.set(groupAbsoluteId, colGroupItem);
|
|
4758
4980
|
temporaryMap.set(groupId, colGroupItem);
|
|
4759
4981
|
}
|
|
4760
4982
|
colGroupItem.columnItems.push(colItem);
|
|
@@ -4771,7 +4993,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4771
4993
|
});
|
|
4772
4994
|
const result = [];
|
|
4773
4995
|
let groupOffset = 0;
|
|
4774
|
-
|
|
4996
|
+
map2.forEach((item) => {
|
|
4775
4997
|
if (!item.ref.columnGroup) {
|
|
4776
4998
|
const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
|
|
4777
4999
|
item.groupOffset = groupOffset;
|
|
@@ -4783,7 +5005,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
|
4783
5005
|
groupOffset += itemWidth;
|
|
4784
5006
|
}
|
|
4785
5007
|
});
|
|
4786
|
-
|
|
5008
|
+
map2.clear();
|
|
4787
5009
|
temporaryMap.clear();
|
|
4788
5010
|
return result;
|
|
4789
5011
|
}
|
|
@@ -4800,7 +5022,7 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4800
5022
|
}
|
|
4801
5023
|
|
|
4802
5024
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4803
|
-
var
|
|
5025
|
+
var React18 = __toModule(require("react"));
|
|
4804
5026
|
var TableHeaderGroupClassName = `${rootClassName}HeaderGroup`;
|
|
4805
5027
|
function InfiniteTableHeaderGroup(props) {
|
|
4806
5028
|
const { columnGroup, height, headerHeight } = props;
|
|
@@ -4814,16 +5036,16 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4814
5036
|
width: columnGroup.computedWidth,
|
|
4815
5037
|
height
|
|
4816
5038
|
};
|
|
4817
|
-
return /* @__PURE__ */
|
|
5039
|
+
return /* @__PURE__ */ React18.createElement("div", {
|
|
4818
5040
|
"data-group-id": columnGroup.id,
|
|
4819
5041
|
className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
|
|
4820
5042
|
style
|
|
4821
|
-
}, /* @__PURE__ */
|
|
5043
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
4822
5044
|
className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
|
|
4823
5045
|
style: { height: headerHeight }
|
|
4824
|
-
}, /* @__PURE__ */
|
|
5046
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
4825
5047
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4826
|
-
}, header)), /* @__PURE__ */
|
|
5048
|
+
}, header)), /* @__PURE__ */ React18.createElement("div", {
|
|
4827
5049
|
className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
|
|
4828
5050
|
}, props.children));
|
|
4829
5051
|
}
|
|
@@ -4846,7 +5068,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4846
5068
|
return items2.map((colGroupItem) => {
|
|
4847
5069
|
if (colGroupItem.type === "column") {
|
|
4848
5070
|
const col = colGroupItem.ref;
|
|
4849
|
-
return /* @__PURE__ */
|
|
5071
|
+
return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderCell, {
|
|
4850
5072
|
key: col.id,
|
|
4851
5073
|
headerHeight: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
|
|
4852
5074
|
column: col,
|
|
@@ -4860,7 +5082,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4860
5082
|
colIds.push(col.id);
|
|
4861
5083
|
return col;
|
|
4862
5084
|
});
|
|
4863
|
-
return /* @__PURE__ */
|
|
5085
|
+
return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderGroup, {
|
|
4864
5086
|
key: `${colGroupItem.uniqueGroupId.join("/")}`,
|
|
4865
5087
|
columns: columns2,
|
|
4866
5088
|
height: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
|
|
@@ -4913,9 +5135,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4913
5135
|
},
|
|
4914
5136
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
4915
5137
|
} = useInfiniteTable();
|
|
4916
|
-
const domRef =
|
|
5138
|
+
const domRef = React20.useRef(null);
|
|
4917
5139
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
4918
|
-
const columnHeaderGroups =
|
|
5140
|
+
const columnHeaderGroups = React20.useMemo(() => {
|
|
4919
5141
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
4920
5142
|
columnGroups: computedColumnGroups,
|
|
4921
5143
|
columnGroupsDepthsMap,
|
|
@@ -4934,7 +5156,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4934
5156
|
columnGroupsMaxDepth
|
|
4935
5157
|
]);
|
|
4936
5158
|
const children = hasColumnGroups ? columnHeaderGroups : columns.map((c) => {
|
|
4937
|
-
return /* @__PURE__ */
|
|
5159
|
+
return /* @__PURE__ */ React20.createElement(InfiniteTableHeaderCell, {
|
|
4938
5160
|
key: c.id,
|
|
4939
5161
|
headerHeight,
|
|
4940
5162
|
column: c,
|
|
@@ -4957,20 +5179,20 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
4957
5179
|
const removeOnScroll = scroller.onScroll(onScroll);
|
|
4958
5180
|
return removeOnScroll;
|
|
4959
5181
|
}, [brain, scrollListener]);
|
|
4960
|
-
return /* @__PURE__ */
|
|
5182
|
+
return /* @__PURE__ */ React20.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
4961
5183
|
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
|
|
4962
5184
|
pinned: pinning,
|
|
4963
5185
|
virtualized: false,
|
|
4964
5186
|
overflow: scrollable
|
|
4965
5187
|
})),
|
|
4966
5188
|
style
|
|
4967
|
-
}), /* @__PURE__ */
|
|
5189
|
+
}), /* @__PURE__ */ React20.createElement("div", {
|
|
4968
5190
|
style: { width: totalWidth },
|
|
4969
5191
|
className: join(flexFlow.row, display.flex),
|
|
4970
5192
|
ref: domRef
|
|
4971
5193
|
}, children));
|
|
4972
5194
|
}
|
|
4973
|
-
var InfiniteTableHeaderUnvirtualized =
|
|
5195
|
+
var InfiniteTableHeaderUnvirtualized = React20.memo(InfiniteTableHeaderUnvirtualizedFn);
|
|
4974
5196
|
|
|
4975
5197
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4976
5198
|
function TableHeaderWrapper(props) {
|
|
@@ -5000,7 +5222,7 @@ function TableHeaderWrapper(props) {
|
|
|
5000
5222
|
const hasPinnedStart = computedPinnedStartColumns.length > 0;
|
|
5001
5223
|
const hasPinnedEnd = computedPinnedEndColumns.length > 0;
|
|
5002
5224
|
const height = columnGroupsMaxDepth ? columnGroupsMaxDepth * headerHeight : headerHeight;
|
|
5003
|
-
const header = virtualizeHeader ? /* @__PURE__ */
|
|
5225
|
+
const header = virtualizeHeader ? /* @__PURE__ */ React21.createElement(InfiniteTableHeader, {
|
|
5004
5226
|
columns: computedUnpinnedColumns,
|
|
5005
5227
|
repaintId: virtualizeHeader ? repaintId : void 0,
|
|
5006
5228
|
brain,
|
|
@@ -5013,7 +5235,7 @@ function TableHeaderWrapper(props) {
|
|
|
5013
5235
|
},
|
|
5014
5236
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5015
5237
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5016
|
-
}) : /* @__PURE__ */
|
|
5238
|
+
}) : /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5017
5239
|
brain,
|
|
5018
5240
|
scrollable: true,
|
|
5019
5241
|
pinning: false,
|
|
@@ -5021,12 +5243,12 @@ function TableHeaderWrapper(props) {
|
|
|
5021
5243
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5022
5244
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5023
5245
|
});
|
|
5024
|
-
return /* @__PURE__ */
|
|
5246
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
5025
5247
|
className: HeaderWrapperCls,
|
|
5026
5248
|
style: {
|
|
5027
5249
|
height: virtualizeHeader ? height : void 0
|
|
5028
5250
|
}
|
|
5029
|
-
}, hasPinnedStart ? /* @__PURE__ */
|
|
5251
|
+
}, hasPinnedStart ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5030
5252
|
style: {
|
|
5031
5253
|
left: 0,
|
|
5032
5254
|
position: "absolute",
|
|
@@ -5038,7 +5260,7 @@ function TableHeaderWrapper(props) {
|
|
|
5038
5260
|
scrollable: computedPinnedStartOverflow,
|
|
5039
5261
|
pinning: "start",
|
|
5040
5262
|
scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
|
|
5041
|
-
}) : null, header, hasPinnedEnd ? /* @__PURE__ */
|
|
5263
|
+
}) : null, header, hasPinnedEnd ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5042
5264
|
style: {
|
|
5043
5265
|
right: scrollbars.vertical ? getScrollbarWidth() : 0,
|
|
5044
5266
|
position: "absolute",
|
|
@@ -5050,7 +5272,7 @@ function TableHeaderWrapper(props) {
|
|
|
5050
5272
|
scrollable: computedPinnedEndOverflow,
|
|
5051
5273
|
pinning: "end",
|
|
5052
5274
|
scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
|
|
5053
|
-
}) : null, scrollbars.vertical ? /* @__PURE__ */
|
|
5275
|
+
}) : null, scrollbars.vertical ? /* @__PURE__ */ React21.createElement(VerticalScrollbarPlaceholder, {
|
|
5054
5276
|
style: {
|
|
5055
5277
|
height: "100%",
|
|
5056
5278
|
right: 0
|
|
@@ -5059,7 +5281,7 @@ function TableHeaderWrapper(props) {
|
|
|
5059
5281
|
}
|
|
5060
5282
|
|
|
5061
5283
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5062
|
-
var
|
|
5284
|
+
var React22 = __toModule(require("react"));
|
|
5063
5285
|
var import_react30 = __toModule(require("react"));
|
|
5064
5286
|
|
|
5065
5287
|
// src/components/hooks/useOnScroll.ts
|
|
@@ -5103,7 +5325,7 @@ var getScrollableClassName = (scrollable) => {
|
|
|
5103
5325
|
|
|
5104
5326
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5105
5327
|
var rootClassName6 = "InfiniteVirtualScrollContainer";
|
|
5106
|
-
var VirtualScrollContainer =
|
|
5328
|
+
var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2(props, ref) {
|
|
5107
5329
|
const {
|
|
5108
5330
|
children,
|
|
5109
5331
|
scrollable = true,
|
|
@@ -5113,7 +5335,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5113
5335
|
} = props;
|
|
5114
5336
|
const domRef = ref != null ? ref : (0, import_react30.useRef)(null);
|
|
5115
5337
|
useOnScroll(domRef, onContainerScroll);
|
|
5116
|
-
return /* @__PURE__ */
|
|
5338
|
+
return /* @__PURE__ */ React22.createElement("div", {
|
|
5117
5339
|
ref: domRef,
|
|
5118
5340
|
style,
|
|
5119
5341
|
className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
|
|
@@ -5121,7 +5343,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5121
5343
|
});
|
|
5122
5344
|
|
|
5123
5345
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
5124
|
-
var
|
|
5346
|
+
var React23 = __toModule(require("react"));
|
|
5125
5347
|
function SpacePlaceholderFn(props) {
|
|
5126
5348
|
const { height, width, count } = props;
|
|
5127
5349
|
const style = {
|
|
@@ -5131,7 +5353,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5131
5353
|
opacity: 0,
|
|
5132
5354
|
pointerEvents: "none"
|
|
5133
5355
|
};
|
|
5134
|
-
return /* @__PURE__ */
|
|
5356
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
5135
5357
|
"data-count": count,
|
|
5136
5358
|
"data-placeholder-width": true ? width : void 0,
|
|
5137
5359
|
"data-placeholder-height": true ? height : void 0,
|
|
@@ -5139,24 +5361,24 @@ function SpacePlaceholderFn(props) {
|
|
|
5139
5361
|
style
|
|
5140
5362
|
});
|
|
5141
5363
|
}
|
|
5142
|
-
var SpacePlaceholder =
|
|
5364
|
+
var SpacePlaceholder = React23.memo(SpacePlaceholderFn);
|
|
5143
5365
|
|
|
5144
5366
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5145
5367
|
var import_react41 = __toModule(require("react"));
|
|
5146
5368
|
|
|
5147
5369
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5148
|
-
var
|
|
5370
|
+
var React29 = __toModule(require("react"));
|
|
5149
5371
|
var import_react34 = __toModule(require("react"));
|
|
5150
5372
|
|
|
5151
5373
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5152
|
-
var
|
|
5374
|
+
var React25 = __toModule(require("react"));
|
|
5153
5375
|
|
|
5154
5376
|
// src/components/VirtualList/VirtualList.tsx
|
|
5155
|
-
var
|
|
5377
|
+
var React24 = __toModule(require("react"));
|
|
5156
5378
|
var import_react31 = __toModule(require("react"));
|
|
5157
5379
|
|
|
5158
5380
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5159
|
-
var VirtualListCls = "
|
|
5381
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5160
5382
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5161
5383
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5162
5384
|
|
|
@@ -5234,19 +5456,19 @@ var VirtualList = (props) => {
|
|
|
5234
5456
|
if (true) {
|
|
5235
5457
|
domProps["data-cmp-name"] = `VirtualList`;
|
|
5236
5458
|
}
|
|
5237
|
-
return /* @__PURE__ */
|
|
5459
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React24.createElement(VirtualScrollContainer, {
|
|
5238
5460
|
scrollable,
|
|
5239
5461
|
onContainerScroll
|
|
5240
|
-
}, /* @__PURE__ */
|
|
5462
|
+
}, /* @__PURE__ */ React24.createElement("div", {
|
|
5241
5463
|
ref: domRef,
|
|
5242
5464
|
className: scrollTransformTargetCls,
|
|
5243
5465
|
"data-name": "scroll-transform-target"
|
|
5244
|
-
}, /* @__PURE__ */
|
|
5466
|
+
}, /* @__PURE__ */ React24.createElement(RawList, {
|
|
5245
5467
|
brain: virtualBrain,
|
|
5246
5468
|
renderItem,
|
|
5247
5469
|
repaintId,
|
|
5248
5470
|
debugChannel: "VirtualList-" + mainAxis
|
|
5249
|
-
})), children, /* @__PURE__ */
|
|
5471
|
+
})), children, /* @__PURE__ */ React24.createElement(SpacePlaceholder, {
|
|
5250
5472
|
count,
|
|
5251
5473
|
width,
|
|
5252
5474
|
height
|
|
@@ -5256,14 +5478,14 @@ var VirtualList = (props) => {
|
|
|
5256
5478
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5257
5479
|
var VirtualRowList = (props) => {
|
|
5258
5480
|
const _a = props, { rowWidth, rowHeight, renderRow } = _a, listProps = __objRest(_a, ["rowWidth", "rowHeight", "renderRow"]);
|
|
5259
|
-
const renderItem =
|
|
5481
|
+
const renderItem = React25.useCallback((renderProps) => {
|
|
5260
5482
|
return renderRow({
|
|
5261
5483
|
domRef: renderProps.domRef,
|
|
5262
5484
|
rowHeight: renderProps.itemSize,
|
|
5263
5485
|
rowIndex: renderProps.itemIndex
|
|
5264
5486
|
});
|
|
5265
5487
|
}, [renderRow]);
|
|
5266
|
-
return /* @__PURE__ */
|
|
5488
|
+
return /* @__PURE__ */ React25.createElement(VirtualList, __spreadProps(__spreadValues({}, listProps), {
|
|
5267
5489
|
renderItem,
|
|
5268
5490
|
mainAxis: "vertical",
|
|
5269
5491
|
itemMainAxisSize: rowHeight,
|
|
@@ -5272,11 +5494,11 @@ var VirtualRowList = (props) => {
|
|
|
5272
5494
|
};
|
|
5273
5495
|
|
|
5274
5496
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
5275
|
-
var
|
|
5497
|
+
var React27 = __toModule(require("react"));
|
|
5276
5498
|
var import_react33 = __toModule(require("react"));
|
|
5277
5499
|
|
|
5278
5500
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5279
|
-
var
|
|
5501
|
+
var React26 = __toModule(require("react"));
|
|
5280
5502
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
5281
5503
|
var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
|
|
5282
5504
|
function isColumnWithField(c) {
|
|
@@ -5303,32 +5525,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5303
5525
|
const groupRowInfo = null;
|
|
5304
5526
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5305
5527
|
if (column.valueGetter) {
|
|
5306
|
-
value = column.valueGetter({
|
|
5307
|
-
data,
|
|
5308
|
-
rowInfo
|
|
5309
|
-
|
|
5528
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5529
|
+
data: rowInfo.data,
|
|
5530
|
+
rowInfo
|
|
5531
|
+
} : {
|
|
5532
|
+
data: rowInfo.data,
|
|
5533
|
+
rowInfo
|
|
5310
5534
|
});
|
|
5311
5535
|
}
|
|
5312
5536
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5313
|
-
const
|
|
5314
|
-
|
|
5315
|
-
|
|
5537
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5538
|
+
rowInfo,
|
|
5539
|
+
data: rowInfo.data
|
|
5540
|
+
} : {
|
|
5316
5541
|
rowInfo,
|
|
5317
|
-
data
|
|
5542
|
+
data: rowInfo.data
|
|
5318
5543
|
};
|
|
5544
|
+
const stylingRenderParam = __spreadValues({
|
|
5545
|
+
value,
|
|
5546
|
+
column
|
|
5547
|
+
}, rest);
|
|
5319
5548
|
let renderValue = value;
|
|
5320
5549
|
if (column.render || column.renderValue) {
|
|
5321
|
-
const renderParam = {
|
|
5550
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5322
5551
|
value,
|
|
5323
5552
|
column,
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
data,
|
|
5553
|
+
groupRowInfo
|
|
5554
|
+
}, rest), {
|
|
5327
5555
|
rowIndex,
|
|
5328
5556
|
toggleGroupRow,
|
|
5329
5557
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5330
|
-
|
|
5331
|
-
};
|
|
5558
|
+
groupBy: computedDataSource.groupBy
|
|
5559
|
+
});
|
|
5332
5560
|
if (column.render) {
|
|
5333
5561
|
renderValue = column.render(renderParam);
|
|
5334
5562
|
} else if (column.renderValue) {
|
|
@@ -5363,7 +5591,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5363
5591
|
}
|
|
5364
5592
|
}
|
|
5365
5593
|
}
|
|
5366
|
-
return /* @__PURE__ */
|
|
5594
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
|
|
5367
5595
|
domRef,
|
|
5368
5596
|
offsetProperty
|
|
5369
5597
|
}, dataset), {
|
|
@@ -5374,7 +5602,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5374
5602
|
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
|
|
5375
5603
|
}), hidden ? null : renderValue);
|
|
5376
5604
|
}
|
|
5377
|
-
var InfiniteTableColumnCell =
|
|
5605
|
+
var InfiniteTableColumnCell = React26.memo(InfiniteTableColumnCellFn);
|
|
5378
5606
|
|
|
5379
5607
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5380
5608
|
var import_react32 = __toModule(require("react"));
|
|
@@ -5407,12 +5635,11 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5407
5635
|
domRefFromProps(node);
|
|
5408
5636
|
domRef.current = node;
|
|
5409
5637
|
}, []);
|
|
5410
|
-
const
|
|
5411
|
-
|
|
5412
|
-
rowInfo,
|
|
5638
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5639
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5413
5640
|
rowIndex,
|
|
5414
|
-
|
|
5415
|
-
};
|
|
5641
|
+
groupBy: rowInfo.groupBy
|
|
5642
|
+
});
|
|
5416
5643
|
if (typeof rowProps === "function") {
|
|
5417
5644
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5418
5645
|
}
|
|
@@ -5506,12 +5733,12 @@ function InfiniteTableRowFn(props) {
|
|
|
5506
5733
|
height: rowHeight
|
|
5507
5734
|
}, domProps.style);
|
|
5508
5735
|
const renderCellRef = (0, import_react33.useRef)(null);
|
|
5509
|
-
const renderCell =
|
|
5736
|
+
const renderCell = React27.useCallback(({ domRef, itemIndex }) => {
|
|
5510
5737
|
const column = columns[itemIndex];
|
|
5511
5738
|
if (!column) {
|
|
5512
5739
|
}
|
|
5513
5740
|
const hidden = false;
|
|
5514
|
-
return /* @__PURE__ */
|
|
5741
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, {
|
|
5515
5742
|
getData,
|
|
5516
5743
|
rowInfo,
|
|
5517
5744
|
groupRenderStrategy,
|
|
@@ -5538,18 +5765,18 @@ function InfiniteTableRowFn(props) {
|
|
|
5538
5765
|
if (true) {
|
|
5539
5766
|
domProps["data-cmp-name"] = "ITableRow";
|
|
5540
5767
|
}
|
|
5541
|
-
return /* @__PURE__ */
|
|
5768
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5542
5769
|
style
|
|
5543
|
-
}), /* @__PURE__ */
|
|
5770
|
+
}), /* @__PURE__ */ React27.createElement(RawList, {
|
|
5544
5771
|
brain,
|
|
5545
5772
|
renderItem: renderCell,
|
|
5546
5773
|
debugChannel: `${rowIndex}`
|
|
5547
5774
|
}));
|
|
5548
5775
|
}
|
|
5549
|
-
var InfiniteTableRow =
|
|
5776
|
+
var InfiniteTableRow = React27.memo(InfiniteTableRowFn);
|
|
5550
5777
|
|
|
5551
5778
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx
|
|
5552
|
-
var
|
|
5779
|
+
var React28 = __toModule(require("react"));
|
|
5553
5780
|
function TableRowUnvirtualizedFn(props) {
|
|
5554
5781
|
const {
|
|
5555
5782
|
rowHeight,
|
|
@@ -5570,7 +5797,7 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5570
5797
|
}, domProps.style);
|
|
5571
5798
|
const children = columns.map((col) => {
|
|
5572
5799
|
const hidden = false;
|
|
5573
|
-
return /* @__PURE__ */
|
|
5800
|
+
return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
|
|
5574
5801
|
key: col.id,
|
|
5575
5802
|
virtualized: false,
|
|
5576
5803
|
rowHeight,
|
|
@@ -5583,11 +5810,11 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5583
5810
|
column: col
|
|
5584
5811
|
});
|
|
5585
5812
|
});
|
|
5586
|
-
return /* @__PURE__ */
|
|
5813
|
+
return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5587
5814
|
style
|
|
5588
5815
|
}), children);
|
|
5589
5816
|
}
|
|
5590
|
-
var TableRowUnvirtualized =
|
|
5817
|
+
var TableRowUnvirtualized = React28.memo(TableRowUnvirtualizedFn);
|
|
5591
5818
|
|
|
5592
5819
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5593
5820
|
function useUnpinnedRendering(params) {
|
|
@@ -5630,7 +5857,7 @@ function useUnpinnedRendering(params) {
|
|
|
5630
5857
|
rowProps.repaintId = repaintId;
|
|
5631
5858
|
}
|
|
5632
5859
|
const TableRowComponent = shouldVirtualizeColumns ? InfiniteTableRow : TableRowUnvirtualized;
|
|
5633
|
-
return /* @__PURE__ */
|
|
5860
|
+
return /* @__PURE__ */ React29.createElement(TableRowComponent, __spreadValues({}, rowProps));
|
|
5634
5861
|
}, [
|
|
5635
5862
|
repaintId,
|
|
5636
5863
|
rowHeight,
|
|
@@ -5640,7 +5867,7 @@ function useUnpinnedRendering(params) {
|
|
|
5640
5867
|
horizontalVirtualBrain,
|
|
5641
5868
|
verticalVirtualBrain
|
|
5642
5869
|
]);
|
|
5643
|
-
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */
|
|
5870
|
+
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React29.createElement("div", {
|
|
5644
5871
|
"data-name": "horizontal-scrollbar-placeholder--fake",
|
|
5645
5872
|
style: {
|
|
5646
5873
|
position: "absolute",
|
|
@@ -5651,10 +5878,10 @@ function useUnpinnedRendering(params) {
|
|
|
5651
5878
|
overflow: "auto",
|
|
5652
5879
|
visibility: columnShifts ? "visible" : "hidden"
|
|
5653
5880
|
}
|
|
5654
|
-
}, /* @__PURE__ */
|
|
5881
|
+
}, /* @__PURE__ */ React29.createElement("div", {
|
|
5655
5882
|
style: { height: "100%", width: computedUnpinnedColumnsWidth }
|
|
5656
5883
|
})) : null;
|
|
5657
|
-
return rowHeight != 0 ? /* @__PURE__ */
|
|
5884
|
+
return rowHeight != 0 ? /* @__PURE__ */ React29.createElement(VirtualRowList, {
|
|
5658
5885
|
repaintId: `${repaintId}-unpinned-`,
|
|
5659
5886
|
brain: verticalVirtualBrain,
|
|
5660
5887
|
onContainerScroll: applyScrollHorizontal,
|
|
@@ -5678,20 +5905,20 @@ function useUnpinnedRendering(params) {
|
|
|
5678
5905
|
var import_react35 = __toModule(require("react"));
|
|
5679
5906
|
|
|
5680
5907
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5681
|
-
var
|
|
5908
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5682
5909
|
var FooterCls = "_16lm1iw1";
|
|
5683
5910
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5684
|
-
var InfiniteClsRecipe = (0,
|
|
5911
|
+
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: [] });
|
|
5685
5912
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5686
5913
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5687
5914
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5688
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
5915
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5689
5916
|
|
|
5690
5917
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5691
5918
|
var DELAY = 200;
|
|
5692
5919
|
var TableClassName = internalProps.rootClassName;
|
|
5693
5920
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5694
|
-
var SCROLL_BOTTOM_OFFSET =
|
|
5921
|
+
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5695
5922
|
var useOnContainerScroll = ({
|
|
5696
5923
|
verticalVirtualBrain,
|
|
5697
5924
|
horizontalVirtualBrain,
|
|
@@ -5707,6 +5934,7 @@ var useOnContainerScroll = ({
|
|
|
5707
5934
|
bodySize
|
|
5708
5935
|
}
|
|
5709
5936
|
} = useInfiniteTable();
|
|
5937
|
+
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5710
5938
|
const timeoutIdRef = (0, import_react35.useRef)(0);
|
|
5711
5939
|
const scrollingRef = (0, import_react35.useRef)(false);
|
|
5712
5940
|
const scrollTopMaxRef = (0, import_react35.useRef)(0);
|
|
@@ -5767,6 +5995,9 @@ var useOnContainerScroll = ({
|
|
|
5767
5995
|
const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
|
|
5768
5996
|
if (isScrollBottom) {
|
|
5769
5997
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5998
|
+
if (getDataSourceState().livePagination) {
|
|
5999
|
+
dataSourceActions.scrollBottomId = Date.now();
|
|
6000
|
+
}
|
|
5770
6001
|
}
|
|
5771
6002
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
5772
6003
|
return {
|
|
@@ -5776,11 +6007,11 @@ var useOnContainerScroll = ({
|
|
|
5776
6007
|
};
|
|
5777
6008
|
|
|
5778
6009
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5779
|
-
var
|
|
6010
|
+
var React31 = __toModule(require("react"));
|
|
5780
6011
|
var import_react38 = __toModule(require("react"));
|
|
5781
6012
|
|
|
5782
6013
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5783
|
-
var
|
|
6014
|
+
var React30 = __toModule(require("react"));
|
|
5784
6015
|
var import_react37 = __toModule(require("react"));
|
|
5785
6016
|
|
|
5786
6017
|
// src/components/hooks/useOnMount.ts
|
|
@@ -5856,7 +6087,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5856
6087
|
if (true) {
|
|
5857
6088
|
domProps["data-cmp-name"] = "RowListWithExternalScrolling";
|
|
5858
6089
|
}
|
|
5859
|
-
return /* @__PURE__ */
|
|
6090
|
+
return /* @__PURE__ */ React30.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React30.createElement(RawList, {
|
|
5860
6091
|
brain,
|
|
5861
6092
|
renderItem,
|
|
5862
6093
|
repaintId
|
|
@@ -5879,7 +6110,7 @@ function PinnedRowsContainer(props) {
|
|
|
5879
6110
|
brain,
|
|
5880
6111
|
renderRow
|
|
5881
6112
|
} = props;
|
|
5882
|
-
const style =
|
|
6113
|
+
const style = React31.useMemo(() => {
|
|
5883
6114
|
const result = pinning === "end" ? {
|
|
5884
6115
|
width: rowWidth,
|
|
5885
6116
|
height,
|
|
@@ -5905,7 +6136,7 @@ function PinnedRowsContainer(props) {
|
|
|
5905
6136
|
className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
|
|
5906
6137
|
};
|
|
5907
6138
|
if (hasOverflow) {
|
|
5908
|
-
return /* @__PURE__ */
|
|
6139
|
+
return /* @__PURE__ */ React31.createElement(VirtualScrollContainer, {
|
|
5909
6140
|
scrollable: {
|
|
5910
6141
|
horizontal: true,
|
|
5911
6142
|
vertical: false
|
|
@@ -5921,18 +6152,18 @@ function PinnedRowsContainer(props) {
|
|
|
5921
6152
|
className: join(PinnedRowsContainerClsVariants({
|
|
5922
6153
|
pinned: pinning
|
|
5923
6154
|
}), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
|
|
5924
|
-
}, /* @__PURE__ */
|
|
6155
|
+
}, /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
|
|
5925
6156
|
onMount: (node) => {
|
|
5926
6157
|
pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
|
|
5927
6158
|
updateScroll(node, brain.getScrollPosition(), scrollPosition);
|
|
5928
6159
|
});
|
|
5929
6160
|
}
|
|
5930
|
-
})), /* @__PURE__ */
|
|
6161
|
+
})), /* @__PURE__ */ React31.createElement(SpacePlaceholder, {
|
|
5931
6162
|
width: rowWidth,
|
|
5932
6163
|
height: 1
|
|
5933
6164
|
}));
|
|
5934
6165
|
}
|
|
5935
|
-
return /* @__PURE__ */
|
|
6166
|
+
return /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
5936
6167
|
}
|
|
5937
6168
|
function useRenderPinnedRow(params) {
|
|
5938
6169
|
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
@@ -5952,7 +6183,7 @@ function useRenderPinnedRow(params) {
|
|
|
5952
6183
|
rowWidth: columnsWidth,
|
|
5953
6184
|
columns
|
|
5954
6185
|
}, rowParams);
|
|
5955
|
-
return /* @__PURE__ */
|
|
6186
|
+
return /* @__PURE__ */ React31.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
|
|
5956
6187
|
}, [columnsWidth, columns, verticalBrain]);
|
|
5957
6188
|
return renderPinnedRow;
|
|
5958
6189
|
}
|
|
@@ -5995,7 +6226,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
5995
6226
|
columns,
|
|
5996
6227
|
columnsWidth
|
|
5997
6228
|
});
|
|
5998
|
-
const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */
|
|
6229
|
+
const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ React31.createElement(PinnedRowsContainer, {
|
|
5999
6230
|
pinning: side,
|
|
6000
6231
|
pinnedScrollListener,
|
|
6001
6232
|
hasOverflow,
|
|
@@ -6008,7 +6239,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6008
6239
|
brain: verticalVirtualBrain,
|
|
6009
6240
|
renderRow: renderRowPinned
|
|
6010
6241
|
}) : null;
|
|
6011
|
-
const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */
|
|
6242
|
+
const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ React31.createElement(HorizontalScrollbarPlaceholder, {
|
|
6012
6243
|
style: side === "end" ? {
|
|
6013
6244
|
width: columnsWidth,
|
|
6014
6245
|
right: hasVerticalScrollbar ? getScrollbarWidth() : 0
|
|
@@ -6552,29 +6783,6 @@ function useYourBrain(param) {
|
|
|
6552
6783
|
return { horizontalVirtualBrain, verticalVirtualBrain };
|
|
6553
6784
|
}
|
|
6554
6785
|
|
|
6555
|
-
// src/utils/shallowEqualObjects.ts
|
|
6556
|
-
function shallowEqualObjects(objA, objB) {
|
|
6557
|
-
if (objA === objB) {
|
|
6558
|
-
return true;
|
|
6559
|
-
}
|
|
6560
|
-
if (!objA || !objB) {
|
|
6561
|
-
return false;
|
|
6562
|
-
}
|
|
6563
|
-
var aKeys = Object.keys(objA);
|
|
6564
|
-
var bKeys = Object.keys(objB);
|
|
6565
|
-
var len = aKeys.length;
|
|
6566
|
-
if (bKeys.length !== len) {
|
|
6567
|
-
return false;
|
|
6568
|
-
}
|
|
6569
|
-
for (var i = 0; i < len; i++) {
|
|
6570
|
-
var key = aKeys[i];
|
|
6571
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6572
|
-
return false;
|
|
6573
|
-
}
|
|
6574
|
-
}
|
|
6575
|
-
return true;
|
|
6576
|
-
}
|
|
6577
|
-
|
|
6578
6786
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
6579
6787
|
function useListRendering(param) {
|
|
6580
6788
|
const { computed, bodySize, columnShifts } = param;
|
|
@@ -6646,7 +6854,7 @@ function useListRendering(param) {
|
|
|
6646
6854
|
});
|
|
6647
6855
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6648
6856
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6649
|
-
const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
|
|
6857
|
+
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6650
6858
|
const scrollbars = (0, import_react41.useMemo)(() => ({
|
|
6651
6859
|
vertical: hasVerticalScrollbar,
|
|
6652
6860
|
horizontal: hasHorizontalScrollbar
|
|
@@ -6664,7 +6872,6 @@ function useListRendering(param) {
|
|
|
6664
6872
|
setColumnVisibility: (columnVisibility) => {
|
|
6665
6873
|
componentActions.columnVisibility = columnVisibility;
|
|
6666
6874
|
},
|
|
6667
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6668
6875
|
getState,
|
|
6669
6876
|
getDataSourceState
|
|
6670
6877
|
};
|
|
@@ -6735,15 +6942,14 @@ function useListRendering(param) {
|
|
|
6735
6942
|
}
|
|
6736
6943
|
|
|
6737
6944
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6738
|
-
var
|
|
6945
|
+
var React32 = __toModule(require("react"));
|
|
6739
6946
|
var import_react42 = __toModule(require("react"));
|
|
6740
6947
|
|
|
6741
6948
|
// src/components/utils/decamelize.ts
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
};
|
|
6949
|
+
function decamelize(str, options) {
|
|
6950
|
+
const { separator } = options != null ? options : { separator: "-" };
|
|
6951
|
+
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();
|
|
6952
|
+
}
|
|
6747
6953
|
|
|
6748
6954
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6749
6955
|
var defaultStyle2 = {
|
|
@@ -6772,10 +6978,10 @@ var enforceStyle = (node, style) => {
|
|
|
6772
6978
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
6773
6979
|
}
|
|
6774
6980
|
};
|
|
6775
|
-
var InfiniteTableLicenseFooter =
|
|
6981
|
+
var InfiniteTableLicenseFooter = React32.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6776
6982
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6777
|
-
const domRef =
|
|
6778
|
-
const domCallback =
|
|
6983
|
+
const domRef = React32.useRef(null);
|
|
6984
|
+
const domCallback = React32.useCallback((node) => {
|
|
6779
6985
|
domRef.current = node;
|
|
6780
6986
|
if (!ref) {
|
|
6781
6987
|
return;
|
|
@@ -6800,12 +7006,12 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6800
7006
|
clearInterval(intervalId);
|
|
6801
7007
|
};
|
|
6802
7008
|
}, []);
|
|
6803
|
-
return /* @__PURE__ */
|
|
7009
|
+
return /* @__PURE__ */ React32.createElement("div", __spreadProps(__spreadValues({
|
|
6804
7010
|
ref: domCallback
|
|
6805
7011
|
}, props), {
|
|
6806
7012
|
className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
|
|
6807
7013
|
style: defaultStyle2
|
|
6808
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
7014
|
+
}), "Powered by", " ", /* @__PURE__ */ React32.createElement("a", {
|
|
6809
7015
|
href: "https://infinite-table.com",
|
|
6810
7016
|
rel: "noopener noreferrer",
|
|
6811
7017
|
role: "link",
|
|
@@ -6967,7 +7173,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
6967
7173
|
const valid = (0, import_react43.useMemo)(() => {
|
|
6968
7174
|
let valid2 = isValidLicense(licenseKey, {
|
|
6969
7175
|
publishedAt: 1624970570587,
|
|
6970
|
-
version: "0.
|
|
7176
|
+
version: "0.1.1"
|
|
6971
7177
|
});
|
|
6972
7178
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
6973
7179
|
return true;
|
|
@@ -6978,7 +7184,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
6978
7184
|
};
|
|
6979
7185
|
|
|
6980
7186
|
// src/components/CSSVariableWatch.tsx
|
|
6981
|
-
var
|
|
7187
|
+
var React33 = __toModule(require("react"));
|
|
6982
7188
|
var import_react44 = __toModule(require("react"));
|
|
6983
7189
|
var error = err("CSSVariableWatch");
|
|
6984
7190
|
var debug5 = dbg("CSSVariableWatch");
|
|
@@ -6993,14 +7199,14 @@ var WRAPPER_STYLE = {
|
|
|
6993
7199
|
};
|
|
6994
7200
|
var useCSSVariableWatch = (params) => {
|
|
6995
7201
|
const lastValueRef = (0, import_react44.useRef)(0);
|
|
6996
|
-
const onResize =
|
|
7202
|
+
const onResize = React33.useCallback(({ height }) => {
|
|
6997
7203
|
if (height && height !== lastValueRef.current) {
|
|
6998
7204
|
lastValueRef.current = height;
|
|
6999
7205
|
params.onChange(height);
|
|
7000
7206
|
}
|
|
7001
7207
|
}, [params.onChange]);
|
|
7002
7208
|
useResizeObserver(params.ref, onResize, { earlyAttach: true });
|
|
7003
|
-
|
|
7209
|
+
React33.useLayoutEffect(() => {
|
|
7004
7210
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7005
7211
|
if (value) {
|
|
7006
7212
|
lastValueRef.current = value;
|
|
@@ -7016,11 +7222,11 @@ var CSSVariableWatch = (props) => {
|
|
|
7016
7222
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7017
7223
|
ref: domRef
|
|
7018
7224
|
}));
|
|
7019
|
-
return /* @__PURE__ */
|
|
7225
|
+
return /* @__PURE__ */ React33.createElement("div", {
|
|
7020
7226
|
"data-name": "css-variable-watcher",
|
|
7021
7227
|
"data-var": props.varName,
|
|
7022
7228
|
style: WRAPPER_STYLE
|
|
7023
|
-
}, /* @__PURE__ */
|
|
7229
|
+
}, /* @__PURE__ */ React33.createElement("div", {
|
|
7024
7230
|
ref: domRef,
|
|
7025
7231
|
style: {
|
|
7026
7232
|
height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
|
|
@@ -7113,7 +7319,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
7113
7319
|
}
|
|
7114
7320
|
|
|
7115
7321
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
7116
|
-
var
|
|
7322
|
+
var React34 = __toModule(require("react"));
|
|
7117
7323
|
|
|
7118
7324
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
7119
7325
|
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv" };
|
|
@@ -7125,15 +7331,15 @@ var { rootClassName: rootClassName11 } = internalProps;
|
|
|
7125
7331
|
var baseCls2 = `${rootClassName11}-LoadMask`;
|
|
7126
7332
|
function LoadMaskFn(props) {
|
|
7127
7333
|
const { visible, children = "Loading" } = props;
|
|
7128
|
-
return /* @__PURE__ */
|
|
7334
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
7129
7335
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
|
|
7130
|
-
}, /* @__PURE__ */
|
|
7336
|
+
}, /* @__PURE__ */ React34.createElement("div", {
|
|
7131
7337
|
className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
|
|
7132
|
-
}), /* @__PURE__ */
|
|
7338
|
+
}), /* @__PURE__ */ React34.createElement("div", {
|
|
7133
7339
|
className: `${LoadMaskTextCls} ${baseCls2}-Text`
|
|
7134
7340
|
}, children));
|
|
7135
7341
|
}
|
|
7136
|
-
var LoadMask =
|
|
7342
|
+
var LoadMask = React34.memo(LoadMaskFn);
|
|
7137
7343
|
|
|
7138
7344
|
// src/components/InfiniteTable/index.tsx
|
|
7139
7345
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
@@ -7152,11 +7358,17 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7152
7358
|
getParentState: () => useDataSource(),
|
|
7153
7359
|
debugName: "InfiniteTable"
|
|
7154
7360
|
});
|
|
7155
|
-
var InfiniteTableComponent =
|
|
7361
|
+
var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
7156
7362
|
var _a;
|
|
7157
|
-
const { componentState, getComputed, computed } = useInfiniteTable();
|
|
7158
7363
|
const {
|
|
7159
|
-
componentState
|
|
7364
|
+
componentState,
|
|
7365
|
+
getComputed,
|
|
7366
|
+
computed,
|
|
7367
|
+
getState: getInfiniteTableState
|
|
7368
|
+
} = useInfiniteTable();
|
|
7369
|
+
const {
|
|
7370
|
+
componentState: { dataArray, loading },
|
|
7371
|
+
getState: getDataSourceState
|
|
7160
7372
|
} = useDataSourceContextValue();
|
|
7161
7373
|
const {
|
|
7162
7374
|
domRef,
|
|
@@ -7193,38 +7405,47 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7193
7405
|
const licenseValid = useLicense(licenseKey);
|
|
7194
7406
|
const domProps = useDOMProps(componentState.domProps);
|
|
7195
7407
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7196
|
-
|
|
7408
|
+
React35.useLayoutEffect(() => {
|
|
7409
|
+
const dataSourceState = getDataSourceState();
|
|
7410
|
+
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7411
|
+
const { notifyScrollbarsChange } = dataSourceState;
|
|
7412
|
+
if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
|
|
7413
|
+
onScrollbarsChange(scrollbars);
|
|
7414
|
+
}
|
|
7415
|
+
notifyScrollbarsChange(scrollbars);
|
|
7416
|
+
}, [scrollbars]);
|
|
7417
|
+
return /* @__PURE__ */ React35.createElement("div", __spreadValues({
|
|
7197
7418
|
ref: domRef
|
|
7198
|
-
}, domProps), header ? /* @__PURE__ */
|
|
7419
|
+
}, domProps), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
|
|
7199
7420
|
brain: horizontalVirtualBrain,
|
|
7200
7421
|
repaintId,
|
|
7201
7422
|
scrollbars
|
|
7202
|
-
}) : null, /* @__PURE__ */
|
|
7423
|
+
}) : null, /* @__PURE__ */ React35.createElement(InfiniteTableBody, null, /* @__PURE__ */ React35.createElement(VirtualScrollContainer, {
|
|
7203
7424
|
ref: scrollerDOMRef,
|
|
7204
7425
|
onContainerScroll: applyScrollVertical,
|
|
7205
7426
|
scrollable: ONLY_VERTICAL_SCROLLBAR
|
|
7206
|
-
}, /* @__PURE__ */
|
|
7427
|
+
}, /* @__PURE__ */ React35.createElement("div", {
|
|
7207
7428
|
className: display.flex
|
|
7208
|
-
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */
|
|
7429
|
+
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React35.createElement(SpacePlaceholder, {
|
|
7209
7430
|
count: dataArray.length,
|
|
7210
7431
|
width: 0,
|
|
7211
7432
|
height: reservedContentHeight
|
|
7212
|
-
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */
|
|
7433
|
+
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React35.createElement(LoadMaskCmp, {
|
|
7213
7434
|
visible: loading
|
|
7214
|
-
}, loadingText)), licenseValid ? null : /* @__PURE__ */
|
|
7435
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ React35.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React35.createElement("div", {
|
|
7215
7436
|
ref: portalDOMRef,
|
|
7216
7437
|
className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
7217
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
7438
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
|
|
7218
7439
|
varName: rowHeightCSSVar,
|
|
7219
7440
|
onChange: onRowHeightCSSVarChange
|
|
7220
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
7441
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
|
|
7221
7442
|
varName: headerHeightCSSVar,
|
|
7222
7443
|
onChange: onHeaderHeightCSSVarChange
|
|
7223
7444
|
}) : null);
|
|
7224
7445
|
});
|
|
7225
7446
|
function InfiniteTableContextProvider() {
|
|
7226
7447
|
const { componentActions, componentState } = useComponentState();
|
|
7227
|
-
const { scrollerDOMRef } = componentState;
|
|
7448
|
+
const { scrollerDOMRef, scrollTopId } = componentState;
|
|
7228
7449
|
const computed = useComputed();
|
|
7229
7450
|
const getComputed = useLatest(computed);
|
|
7230
7451
|
const getState = useLatest(componentState);
|
|
@@ -7253,20 +7474,25 @@ function InfiniteTableContextProvider() {
|
|
|
7253
7474
|
}
|
|
7254
7475
|
componentActions.bodySize = bodySize;
|
|
7255
7476
|
}, { earlyAttach: true });
|
|
7256
|
-
|
|
7477
|
+
React35.useEffect(() => {
|
|
7257
7478
|
return () => {
|
|
7258
7479
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7259
7480
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7260
7481
|
};
|
|
7261
7482
|
}, []);
|
|
7483
|
+
React35.useEffect(() => {
|
|
7484
|
+
if (scrollerDOMRef.current) {
|
|
7485
|
+
scrollerDOMRef.current.scrollTop = 0;
|
|
7486
|
+
}
|
|
7487
|
+
}, [scrollTopId, scrollerDOMRef]);
|
|
7262
7488
|
const TableContext2 = getInfiniteTableContext();
|
|
7263
|
-
return /* @__PURE__ */
|
|
7489
|
+
return /* @__PURE__ */ React35.createElement(TableContext2.Provider, {
|
|
7264
7490
|
value: contextValue
|
|
7265
|
-
}, /* @__PURE__ */
|
|
7491
|
+
}, /* @__PURE__ */ React35.createElement(InfiniteTableComponent, null));
|
|
7266
7492
|
}
|
|
7267
7493
|
function InfiniteTable(props) {
|
|
7268
|
-
const table = /* @__PURE__ */
|
|
7269
|
-
return /* @__PURE__ */
|
|
7494
|
+
const table = /* @__PURE__ */ React35.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(InfiniteTableContextProvider, null));
|
|
7495
|
+
return /* @__PURE__ */ React35.createElement(React35.StrictMode, null, table);
|
|
7270
7496
|
}
|
|
7271
7497
|
InfiniteTable.defaultProps = {
|
|
7272
7498
|
rowHeight: 40,
|