@infinite-table/infinite-react 0.0.10 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +8 -9
- package/index.d.ts +347 -207
- package/index.esm.css +8 -9
- package/index.esm.js +1307 -864
- package/index.js +1455 -1010
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -635,11 +635,12 @@ __export(exports, {
|
|
|
635
635
|
interceptMap: () => interceptMap,
|
|
636
636
|
multisort: () => multisort,
|
|
637
637
|
useComponentState: () => useComponentState,
|
|
638
|
-
useDataSource: () => useDataSource
|
|
638
|
+
useDataSource: () => useDataSource,
|
|
639
|
+
useEffectWithChanges: () => useEffectWithChanges
|
|
639
640
|
});
|
|
640
641
|
|
|
641
642
|
// src/components/InfiniteTable/index.tsx
|
|
642
|
-
var
|
|
643
|
+
var React35 = __toModule(require("react"));
|
|
643
644
|
|
|
644
645
|
// src/components/InfiniteTable/internalProps.ts
|
|
645
646
|
var rootClassName = "Infinite";
|
|
@@ -719,6 +720,24 @@ var ScrollListener = class {
|
|
|
719
720
|
}
|
|
720
721
|
};
|
|
721
722
|
|
|
723
|
+
// src/components/InfiniteTable/utils/toMap.ts
|
|
724
|
+
function toMap(mapOrObject, weakMapCache) {
|
|
725
|
+
if (!mapOrObject) {
|
|
726
|
+
return new Map();
|
|
727
|
+
}
|
|
728
|
+
if (mapOrObject instanceof Map) {
|
|
729
|
+
return mapOrObject;
|
|
730
|
+
}
|
|
731
|
+
if (weakMapCache && weakMapCache.has(mapOrObject)) {
|
|
732
|
+
return weakMapCache.get(mapOrObject);
|
|
733
|
+
}
|
|
734
|
+
const result = new Map(Object.entries(mapOrObject));
|
|
735
|
+
if (weakMapCache) {
|
|
736
|
+
weakMapCache.set(mapOrObject, result);
|
|
737
|
+
}
|
|
738
|
+
return result;
|
|
739
|
+
}
|
|
740
|
+
|
|
722
741
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
723
742
|
function computeColumnGroupsDepths(columnGroups) {
|
|
724
743
|
const map2 = new Map();
|
|
@@ -742,21 +761,10 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
742
761
|
}
|
|
743
762
|
|
|
744
763
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
745
|
-
function toMap(mapOrObject) {
|
|
746
|
-
if (!mapOrObject) {
|
|
747
|
-
return new Map();
|
|
748
|
-
}
|
|
749
|
-
if (mapOrObject instanceof Map) {
|
|
750
|
-
return mapOrObject;
|
|
751
|
-
}
|
|
752
|
-
return new Map(Object.entries(mapOrObject));
|
|
753
|
-
}
|
|
754
|
-
function toColumnTypesMap(mapOrObject) {
|
|
755
|
-
return toMap(mapOrObject);
|
|
756
|
-
}
|
|
757
764
|
function initSetupState() {
|
|
758
765
|
const columnsGeneratedForGrouping = new Map();
|
|
759
766
|
return {
|
|
767
|
+
propsCache: new Map([]),
|
|
760
768
|
columnShifts: null,
|
|
761
769
|
domRef: (0, import_react2.createRef)(),
|
|
762
770
|
scrollerDOMRef: (0, import_react2.createRef)(),
|
|
@@ -781,12 +789,8 @@ function initSetupState() {
|
|
|
781
789
|
columnsWhenInlineGroupRenderStrategy: void 0
|
|
782
790
|
};
|
|
783
791
|
}
|
|
784
|
-
var forwardProps = () => {
|
|
792
|
+
var forwardProps = (setupState) => {
|
|
785
793
|
return {
|
|
786
|
-
columns: (columns) => {
|
|
787
|
-
var _a;
|
|
788
|
-
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
789
|
-
},
|
|
790
794
|
scrollTopId: 1,
|
|
791
795
|
components: 1,
|
|
792
796
|
loadingText: 1,
|
|
@@ -804,6 +808,7 @@ var forwardProps = () => {
|
|
|
804
808
|
onBlurWithin: 1,
|
|
805
809
|
onScrollToTop: 1,
|
|
806
810
|
onScrollToBottom: 1,
|
|
811
|
+
onScrollStop: 1,
|
|
807
812
|
scrollToBottomOffset: 1,
|
|
808
813
|
rowStyle: 1,
|
|
809
814
|
rowProps: 1,
|
|
@@ -814,12 +819,14 @@ var forwardProps = () => {
|
|
|
814
819
|
pivotRowLabelsColumn: 1,
|
|
815
820
|
pivotColumnGroups: 1,
|
|
816
821
|
onScrollbarsChange: 1,
|
|
822
|
+
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 100,
|
|
817
823
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
818
824
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
819
825
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
820
826
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
821
827
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
822
828
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
829
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
823
830
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
824
831
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
825
832
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
@@ -831,31 +838,25 @@ var forwardProps = () => {
|
|
|
831
838
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
832
839
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
833
840
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
},
|
|
840
|
-
columnTypes: (columnTypes) => {
|
|
841
|
-
var _a;
|
|
842
|
-
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
843
|
-
},
|
|
844
|
-
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
841
|
+
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
842
|
+
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
843
|
+
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
844
|
+
columnSizing: (columnSizing) => toMap(columnSizing, setupState.propsCache.get("columnSizing")),
|
|
845
|
+
columnTypes: (columnTypes) => toMap(columnTypes, setupState.propsCache.get("columnTypes")),
|
|
845
846
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
846
|
-
columnGroups: (columnGroups) => columnGroups
|
|
847
|
+
columnGroups: (columnGroups) => toMap(columnGroups, setupState.propsCache.get("columnGroups"))
|
|
847
848
|
};
|
|
848
849
|
};
|
|
849
850
|
function getGroupRenderStrategy(options) {
|
|
850
|
-
const {
|
|
851
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
851
852
|
if (groupRenderStrategy) {
|
|
852
853
|
return groupRenderStrategy;
|
|
853
854
|
}
|
|
854
855
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
855
856
|
return "single-column";
|
|
856
857
|
}
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
858
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
859
|
+
if (columnsInGroupBy.length) {
|
|
859
860
|
return "multi-column";
|
|
860
861
|
}
|
|
861
862
|
return "multi-column";
|
|
@@ -866,16 +867,17 @@ var mapPropsToState = (params) => {
|
|
|
866
867
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
867
868
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
868
869
|
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;
|
|
869
|
-
const
|
|
870
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
870
871
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
871
872
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
872
|
-
|
|
873
|
+
groupBy,
|
|
873
874
|
groupColumn: props.groupColumn
|
|
874
875
|
});
|
|
876
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
875
877
|
return {
|
|
876
878
|
groupRenderStrategy,
|
|
877
|
-
|
|
878
|
-
computedColumns
|
|
879
|
+
groupBy,
|
|
880
|
+
computedColumns,
|
|
879
881
|
virtualizeHeader,
|
|
880
882
|
columnGroupsDepthsMap,
|
|
881
883
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1217,11 +1219,11 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
1217
1219
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1218
1220
|
var logError = err("getComputedVisibleColumns");
|
|
1219
1221
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1220
|
-
return
|
|
1222
|
+
return columnVisibility[colId] !== false;
|
|
1221
1223
|
};
|
|
1222
1224
|
var getComputedPinned = (colId, columnPinning) => {
|
|
1223
1225
|
const pinned = columnPinning.get(colId);
|
|
1224
|
-
const computedPinned = pinned === "start"
|
|
1226
|
+
const computedPinned = pinned === "start" ? "start" : pinned === "end" ? "end" : false;
|
|
1225
1227
|
return computedPinned;
|
|
1226
1228
|
};
|
|
1227
1229
|
var getComputedVisibleColumns = ({
|
|
@@ -1253,7 +1255,9 @@ var getComputedVisibleColumns = ({
|
|
|
1253
1255
|
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1254
1256
|
return false;
|
|
1255
1257
|
}
|
|
1256
|
-
|
|
1258
|
+
const result2 = isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
|
|
1259
|
+
console.log(columnVisibility, colId, result2);
|
|
1260
|
+
return result2;
|
|
1257
1261
|
});
|
|
1258
1262
|
const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
|
|
1259
1263
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
@@ -1279,10 +1283,13 @@ var getComputedVisibleColumns = ({
|
|
|
1279
1283
|
const colTypeSizing = {
|
|
1280
1284
|
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1281
1285
|
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1282
|
-
width: colType == null ? void 0 : colType.
|
|
1283
|
-
flex: colType == null ? void 0 : colType.
|
|
1286
|
+
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1287
|
+
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1288
|
+
};
|
|
1289
|
+
let colSizing = columnSizing.get(colId) || {
|
|
1290
|
+
width: column == null ? void 0 : column.defaultWidth,
|
|
1291
|
+
flex: column == null ? void 0 : column.defaultFlex
|
|
1284
1292
|
};
|
|
1285
|
-
let colSizing = columnSizing.get(colId) || {};
|
|
1286
1293
|
if (colSizing.width != null) {
|
|
1287
1294
|
delete colTypeSizing.flex;
|
|
1288
1295
|
}
|
|
@@ -1333,7 +1340,7 @@ var getComputedVisibleColumns = ({
|
|
|
1333
1340
|
});
|
|
1334
1341
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
1335
1342
|
columnsArray.forEach((c, i) => {
|
|
1336
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1343
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1337
1344
|
const id = visibleColumnOrder[i];
|
|
1338
1345
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1339
1346
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -1394,6 +1401,7 @@ var getComputedVisibleColumns = ({
|
|
|
1394
1401
|
const result2 = __spreadProps(__spreadValues({
|
|
1395
1402
|
align: colType.align,
|
|
1396
1403
|
verticalAlign: colType.verticalAlign,
|
|
1404
|
+
valueGetter: colType.valueGetter,
|
|
1397
1405
|
renderValue: colType.renderValue,
|
|
1398
1406
|
render: colType.render
|
|
1399
1407
|
}, c), {
|
|
@@ -1401,7 +1409,7 @@ var getComputedVisibleColumns = ({
|
|
|
1401
1409
|
computedAbsoluteOffset,
|
|
1402
1410
|
computedPinningOffset,
|
|
1403
1411
|
computedOffset,
|
|
1404
|
-
computedSortable: (_e = (_d = c.sortable) != null ? _d : sortable) != null ? _e : true,
|
|
1412
|
+
computedSortable: (_f = (_e = (_d = c.sortable) != null ? _d : colType.sortable) != null ? _e : sortable) != null ? _f : true,
|
|
1405
1413
|
computedSortInfo,
|
|
1406
1414
|
computedSortIndex,
|
|
1407
1415
|
computedMultiSort: multiSort,
|
|
@@ -1410,14 +1418,14 @@ var getComputedVisibleColumns = ({
|
|
|
1410
1418
|
computedSortedDesc,
|
|
1411
1419
|
computedVisibleIndex: i,
|
|
1412
1420
|
computedPinned,
|
|
1413
|
-
computedDraggable: (
|
|
1421
|
+
computedDraggable: (_h = (_g = c.draggable) != null ? _g : draggableColumns) != null ? _h : true,
|
|
1414
1422
|
computedFirstInCategory,
|
|
1415
1423
|
computedLastInCategory,
|
|
1416
1424
|
computedFirst: i === 0,
|
|
1417
1425
|
computedLast,
|
|
1418
1426
|
toggleSort,
|
|
1419
1427
|
id,
|
|
1420
|
-
header: (
|
|
1428
|
+
header: (_k = (_j = (_i = c.header) != null ? _i : colType.header) != null ? _j : c.name) != null ? _k : c.field
|
|
1421
1429
|
});
|
|
1422
1430
|
computedOffset += computedWidth;
|
|
1423
1431
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -1568,7 +1576,6 @@ var useComputedVisibleColumns = ({
|
|
|
1568
1576
|
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1569
1577
|
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1570
1578
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1571
|
-
const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
|
|
1572
1579
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
1573
1580
|
const {
|
|
1574
1581
|
computedRemainingSpace,
|
|
@@ -1624,7 +1631,6 @@ var useComputedVisibleColumns = ({
|
|
|
1624
1631
|
pinnedStartMaxWidth,
|
|
1625
1632
|
columnPinning,
|
|
1626
1633
|
columnsRenderId,
|
|
1627
|
-
visibilityRenderId,
|
|
1628
1634
|
columnsSizingRenderId,
|
|
1629
1635
|
pinningRenderId,
|
|
1630
1636
|
columnTypesRenderId
|
|
@@ -1649,41 +1655,14 @@ var useComputedVisibleColumns = ({
|
|
|
1649
1655
|
return result;
|
|
1650
1656
|
};
|
|
1651
1657
|
|
|
1652
|
-
// src/utils/sortAscending.ts
|
|
1658
|
+
// src/utils/DeepMap/sortAscending.ts
|
|
1653
1659
|
var sortAscending = (a, b) => a - b;
|
|
1654
1660
|
|
|
1655
1661
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1656
|
-
var
|
|
1657
|
-
|
|
1658
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1659
|
-
var import_react12 = __toModule(require("react"));
|
|
1660
|
-
|
|
1661
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1662
|
-
var React3 = __toModule(require("react"));
|
|
1663
|
-
|
|
1664
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1665
|
-
var React2 = __toModule(require("react"));
|
|
1666
|
-
var DSContext;
|
|
1667
|
-
function getDataSourceContext() {
|
|
1668
|
-
if (DSContext) {
|
|
1669
|
-
return DSContext;
|
|
1670
|
-
}
|
|
1671
|
-
return DSContext = React2.createContext({
|
|
1672
|
-
getState: () => null,
|
|
1673
|
-
componentState: null,
|
|
1674
|
-
componentActions: null
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1679
|
-
function useDataSourceActions() {
|
|
1680
|
-
const DataSourceContext = getDataSourceContext();
|
|
1681
|
-
const contextValue = React3.useContext(DataSourceContext);
|
|
1682
|
-
return contextValue.componentActions;
|
|
1683
|
-
}
|
|
1662
|
+
var import_react18 = __toModule(require("react"));
|
|
1684
1663
|
|
|
1685
1664
|
// src/components/hooks/useComponentState.tsx
|
|
1686
|
-
var
|
|
1665
|
+
var React2 = __toModule(require("react"));
|
|
1687
1666
|
var import_react11 = __toModule(require("react"));
|
|
1688
1667
|
|
|
1689
1668
|
// src/utils/proxyFnCall.ts
|
|
@@ -1772,9 +1751,14 @@ function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward
|
|
|
1772
1751
|
if (currentValue === value) {
|
|
1773
1752
|
return;
|
|
1774
1753
|
}
|
|
1775
|
-
|
|
1754
|
+
let notifyTheChange = true;
|
|
1776
1755
|
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1777
|
-
interceptedActions[key](value, { actions, state: state2 })
|
|
1756
|
+
if (interceptedActions[key](value, { actions, state: state2 }) === false) {
|
|
1757
|
+
notifyTheChange = false;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
if (notifyTheChange) {
|
|
1761
|
+
notifyChange(props, stateKey, value);
|
|
1778
1762
|
}
|
|
1779
1763
|
const forwardFn = propsToForward[key];
|
|
1780
1764
|
if (typeof forwardFn === "function") {
|
|
@@ -1813,14 +1797,16 @@ function forwardProps2(propsToForward, props) {
|
|
|
1813
1797
|
return mappedState;
|
|
1814
1798
|
}
|
|
1815
1799
|
function getComponentStateRoot(config) {
|
|
1816
|
-
return
|
|
1800
|
+
return React2.memo(function ComponentStateRoot(props) {
|
|
1817
1801
|
var _a, _b;
|
|
1802
|
+
const [initialSetupState] = (0, import_react11.useState)(() => {
|
|
1803
|
+
return config.initSetupState ? config.initSetupState() : {};
|
|
1804
|
+
});
|
|
1818
1805
|
const propsToStateSetRef = (0, import_react11.useRef)(new Set());
|
|
1819
|
-
const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps() : {}, []);
|
|
1806
|
+
const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
1820
1807
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
1821
1808
|
const getParentState = useLatest(parentState);
|
|
1822
1809
|
const [wholeState] = (0, import_react11.useState)(() => {
|
|
1823
|
-
const initialSetupState = config.initSetupState ? config.initSetupState() : {};
|
|
1824
1810
|
let mappedState = {};
|
|
1825
1811
|
if (propsToForward) {
|
|
1826
1812
|
mappedState = forwardProps2(propsToForward, props);
|
|
@@ -1850,9 +1836,12 @@ function getComponentStateRoot(config) {
|
|
|
1850
1836
|
const getProps = useLatest(props);
|
|
1851
1837
|
const theReducer = (previousState, action) => {
|
|
1852
1838
|
var _a2;
|
|
1839
|
+
if (action.type === "REPLACE_STATE") {
|
|
1840
|
+
return action.payload;
|
|
1841
|
+
}
|
|
1853
1842
|
const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
|
|
1854
1843
|
const mappedState = action.payload.mappedState;
|
|
1855
|
-
const updatedProps = action.payload.
|
|
1844
|
+
const updatedProps = action.payload.updatedPropsToState;
|
|
1856
1845
|
const newState = Object.assign({}, previousState);
|
|
1857
1846
|
if (mappedState) {
|
|
1858
1847
|
Object.assign(newState, mappedState);
|
|
@@ -1906,8 +1895,9 @@ function getComponentStateRoot(config) {
|
|
|
1906
1895
|
const currentProps = props;
|
|
1907
1896
|
const newMappedState = {};
|
|
1908
1897
|
let newMappedStateCount = 0;
|
|
1909
|
-
const
|
|
1910
|
-
let
|
|
1898
|
+
const updatedPropsToState = {};
|
|
1899
|
+
let updatedPropsToStateCount = 0;
|
|
1900
|
+
const rawUpdatedProps = {};
|
|
1911
1901
|
for (var k in props) {
|
|
1912
1902
|
const key = k;
|
|
1913
1903
|
const oldValue = prevProps[key];
|
|
@@ -1918,7 +1908,8 @@ function getComponentStateRoot(config) {
|
|
|
1918
1908
|
if (oldValue === newValue) {
|
|
1919
1909
|
continue;
|
|
1920
1910
|
}
|
|
1921
|
-
|
|
1911
|
+
rawUpdatedProps[key] = { newValue, oldValue };
|
|
1912
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1922
1913
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1923
1914
|
let valueToSet = newValue;
|
|
1924
1915
|
const forwardFn = propsToForward[k];
|
|
@@ -1930,79 +1921,73 @@ function getComponentStateRoot(config) {
|
|
|
1930
1921
|
newMappedStateCount++;
|
|
1931
1922
|
}
|
|
1932
1923
|
} else if (propsToStateSetRef.current.has(k)) {
|
|
1933
|
-
|
|
1934
|
-
|
|
1924
|
+
updatedPropsToState[key] = currentProps[key];
|
|
1925
|
+
updatedPropsToStateCount++;
|
|
1935
1926
|
}
|
|
1936
1927
|
}
|
|
1937
1928
|
}
|
|
1938
|
-
if (
|
|
1929
|
+
if (updatedPropsToStateCount > 0 || newMappedStateCount > 0) {
|
|
1939
1930
|
debug2("Triggered by new values for the following props", ...[
|
|
1940
1931
|
...Object.keys(newMappedState != null ? newMappedState : {}),
|
|
1941
|
-
...Object.keys(
|
|
1932
|
+
...Object.keys(updatedPropsToState != null ? updatedPropsToState : {})
|
|
1942
1933
|
]);
|
|
1943
|
-
|
|
1934
|
+
const action = {
|
|
1944
1935
|
payload: {
|
|
1945
1936
|
mappedState: newMappedStateCount ? newMappedState : null,
|
|
1946
|
-
|
|
1937
|
+
updatedPropsToState: updatedPropsToStateCount ? updatedPropsToState : null
|
|
1947
1938
|
}
|
|
1948
|
-
}
|
|
1939
|
+
};
|
|
1940
|
+
dispatch(action);
|
|
1941
|
+
if (config.onPropChange) {
|
|
1942
|
+
for (var prop in rawUpdatedProps)
|
|
1943
|
+
if (rawUpdatedProps.hasOwnProperty(prop)) {
|
|
1944
|
+
const { newValue, oldValue } = rawUpdatedProps[prop];
|
|
1945
|
+
config.onPropChange({ name: prop, newValue, oldValue }, props, actions);
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1949
1948
|
}
|
|
1950
1949
|
});
|
|
1951
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ React2.createElement(Context.Provider, {
|
|
1952
1951
|
value: contextValue
|
|
1953
1952
|
}, props.children);
|
|
1954
1953
|
});
|
|
1955
1954
|
}
|
|
1956
1955
|
function useComponentState() {
|
|
1957
1956
|
const Context = getComponentStateContext();
|
|
1958
|
-
return
|
|
1957
|
+
return React2.useContext(Context);
|
|
1959
1958
|
}
|
|
1960
1959
|
|
|
1961
|
-
// src/components/
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
getter: (data) => colField ? data[colField] : data
|
|
1977
|
-
}, aggregator);
|
|
1978
|
-
reducers.push(newAggregator);
|
|
1979
|
-
});
|
|
1980
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
1981
|
-
}
|
|
1982
|
-
updateDataSourceAggregations();
|
|
1983
|
-
return interceptMap(columnAggregations, {
|
|
1984
|
-
clear: updateDataSourceAggregations,
|
|
1985
|
-
delete: updateDataSourceAggregations,
|
|
1986
|
-
set: updateDataSourceAggregations
|
|
1987
|
-
});
|
|
1988
|
-
}, [columnAggregations]);
|
|
1960
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1961
|
+
var React4 = __toModule(require("react"));
|
|
1962
|
+
|
|
1963
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1964
|
+
var React3 = __toModule(require("react"));
|
|
1965
|
+
var DSContext;
|
|
1966
|
+
function getDataSourceContext() {
|
|
1967
|
+
if (DSContext) {
|
|
1968
|
+
return DSContext;
|
|
1969
|
+
}
|
|
1970
|
+
return DSContext = React3.createContext({
|
|
1971
|
+
getState: () => null,
|
|
1972
|
+
componentState: null,
|
|
1973
|
+
componentActions: null
|
|
1974
|
+
});
|
|
1989
1975
|
}
|
|
1990
1976
|
|
|
1991
1977
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1992
|
-
var React5 = __toModule(require("react"));
|
|
1993
1978
|
function useDataSource() {
|
|
1994
1979
|
const DataSourceContext = getDataSourceContext();
|
|
1995
|
-
const contextValue =
|
|
1980
|
+
const contextValue = React4.useContext(DataSourceContext);
|
|
1996
1981
|
return contextValue.componentState;
|
|
1997
1982
|
}
|
|
1998
1983
|
function useDataSourceContextValue() {
|
|
1999
1984
|
const DataSourceContext = getDataSourceContext();
|
|
2000
|
-
const contextValue =
|
|
1985
|
+
const contextValue = React4.useContext(DataSourceContext);
|
|
2001
1986
|
return contextValue;
|
|
2002
1987
|
}
|
|
2003
1988
|
|
|
2004
1989
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
2005
|
-
var
|
|
1990
|
+
var import_react12 = __toModule(require("react"));
|
|
2006
1991
|
function useColumnGroups() {
|
|
2007
1992
|
const {
|
|
2008
1993
|
componentState: {
|
|
@@ -2012,7 +1997,7 @@ function useColumnGroups() {
|
|
|
2012
1997
|
componentActions,
|
|
2013
1998
|
getComponentState
|
|
2014
1999
|
} = useComponentState();
|
|
2015
|
-
(0,
|
|
2000
|
+
(0, import_react12.useEffect)(() => {
|
|
2016
2001
|
const recompute = () => {
|
|
2017
2002
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
2018
2003
|
};
|
|
@@ -2023,73 +2008,63 @@ function useColumnGroups() {
|
|
|
2023
2008
|
set: update
|
|
2024
2009
|
});
|
|
2025
2010
|
}, [computedColumnGroups]);
|
|
2026
|
-
(0,
|
|
2011
|
+
(0, import_react12.useEffect)(() => {
|
|
2027
2012
|
return interceptMap(collapsedColumnGroups, {
|
|
2028
2013
|
set: (key, visibleCol) => {
|
|
2029
2014
|
const colIds = key.slice(1);
|
|
2030
|
-
const
|
|
2015
|
+
const columnVisibility = __spreadValues({}, getComponentState().columnVisibility);
|
|
2031
2016
|
colIds.forEach((colId) => {
|
|
2032
|
-
columnVisibility
|
|
2017
|
+
columnVisibility[colId] = false;
|
|
2033
2018
|
});
|
|
2034
|
-
columnVisibility
|
|
2019
|
+
delete columnVisibility[visibleCol];
|
|
2020
|
+
componentActions.columnVisibility = columnVisibility;
|
|
2035
2021
|
},
|
|
2036
2022
|
beforeClear: (currentCollapsedGroups) => {
|
|
2037
|
-
const
|
|
2023
|
+
const columnVisibility = __spreadValues({}, getComponentState().columnVisibility);
|
|
2038
2024
|
const keys = [...currentCollapsedGroups.keys()];
|
|
2039
2025
|
keys.forEach((key) => {
|
|
2040
2026
|
const colIds = key.slice(1);
|
|
2041
2027
|
colIds.forEach((colId) => {
|
|
2042
|
-
columnVisibility
|
|
2028
|
+
delete columnVisibility[colId];
|
|
2043
2029
|
});
|
|
2044
2030
|
});
|
|
2031
|
+
componentActions.columnVisibility = columnVisibility;
|
|
2045
2032
|
},
|
|
2046
2033
|
delete: (key) => {
|
|
2047
|
-
const
|
|
2034
|
+
const columnVisibility = __spreadValues({}, getComponentState().columnVisibility);
|
|
2048
2035
|
const colIds = key.slice(1);
|
|
2049
2036
|
colIds.forEach((colId) => {
|
|
2050
|
-
columnVisibility
|
|
2037
|
+
delete columnVisibility[colId];
|
|
2051
2038
|
});
|
|
2039
|
+
componentActions.columnVisibility = columnVisibility;
|
|
2052
2040
|
}
|
|
2053
2041
|
});
|
|
2054
2042
|
}, [collapsedColumnGroups]);
|
|
2055
2043
|
}
|
|
2056
2044
|
|
|
2057
2045
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2058
|
-
var
|
|
2046
|
+
var import_react17 = __toModule(require("react"));
|
|
2059
2047
|
|
|
2060
2048
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2061
|
-
var
|
|
2049
|
+
var React6 = __toModule(require("react"));
|
|
2062
2050
|
|
|
2063
2051
|
// src/utils/join.ts
|
|
2064
2052
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
2065
2053
|
|
|
2066
2054
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2067
|
-
var
|
|
2068
|
-
var
|
|
2055
|
+
var React5 = __toModule(require("react"));
|
|
2056
|
+
var import_react13 = __toModule(require("react"));
|
|
2069
2057
|
|
|
2070
|
-
// src/components/InfiniteTable/
|
|
2071
|
-
var
|
|
2072
|
-
var
|
|
2073
|
-
var
|
|
2074
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2075
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2076
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2077
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2078
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2079
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2080
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2081
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2082
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2083
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2084
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2085
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2086
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2058
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2059
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2060
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2061
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2087
2062
|
|
|
2088
2063
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2089
2064
|
function ExpanderIcon(props) {
|
|
2090
2065
|
var _a;
|
|
2091
2066
|
const { size = 24 } = props;
|
|
2092
|
-
const [expanded, setExpanded] = (0,
|
|
2067
|
+
const [expanded, setExpanded] = (0, import_react13.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
2093
2068
|
const onClick = () => {
|
|
2094
2069
|
var _a2;
|
|
2095
2070
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -2097,12 +2072,12 @@ function ExpanderIcon(props) {
|
|
|
2097
2072
|
setExpanded(!expanded);
|
|
2098
2073
|
}
|
|
2099
2074
|
};
|
|
2100
|
-
|
|
2075
|
+
React5.useEffect(() => {
|
|
2101
2076
|
if (isControlled("expanded", props)) {
|
|
2102
2077
|
setExpanded(props.expanded);
|
|
2103
2078
|
}
|
|
2104
2079
|
}, [props.expanded]);
|
|
2105
|
-
return /* @__PURE__ */
|
|
2080
|
+
return /* @__PURE__ */ React5.createElement("svg", {
|
|
2106
2081
|
"data-name": "expander-icon",
|
|
2107
2082
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2108
2083
|
height: `${size}px`,
|
|
@@ -2110,18 +2085,37 @@ function ExpanderIcon(props) {
|
|
|
2110
2085
|
width: `${size}px`,
|
|
2111
2086
|
style: props.style,
|
|
2112
2087
|
onClick,
|
|
2113
|
-
className: join(props.className,
|
|
2114
|
-
|
|
2088
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2089
|
+
expanded
|
|
2090
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2091
|
+
}, /* @__PURE__ */ React5.createElement("path", {
|
|
2115
2092
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2116
2093
|
}));
|
|
2117
2094
|
}
|
|
2118
2095
|
|
|
2119
2096
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2120
|
-
var
|
|
2097
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2121
2098
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2122
|
-
var RowClsRecipe = (0,
|
|
2099
|
+
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: [] });
|
|
2123
2100
|
var RowHoverCls = "_7pupv01";
|
|
2124
2101
|
|
|
2102
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2103
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2104
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2105
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2106
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2107
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2108
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2109
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2110
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2111
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2112
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2113
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2114
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2115
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2116
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2117
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2118
|
+
|
|
2125
2119
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2126
2120
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2127
2121
|
if (!pivotColumns) {
|
|
@@ -2131,7 +2125,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2131
2125
|
pivotColumn,
|
|
2132
2126
|
pivotRowLabelsColumn,
|
|
2133
2127
|
pivotBy,
|
|
2134
|
-
|
|
2128
|
+
groupBy,
|
|
2135
2129
|
pivotTotalColumnPosition,
|
|
2136
2130
|
toggleGroupRow
|
|
2137
2131
|
} = params;
|
|
@@ -2148,7 +2142,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2148
2142
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2149
2143
|
column,
|
|
2150
2144
|
pivotBy,
|
|
2151
|
-
|
|
2145
|
+
groupBy
|
|
2152
2146
|
}));
|
|
2153
2147
|
} else {
|
|
2154
2148
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2160,7 +2154,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2160
2154
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2161
2155
|
column,
|
|
2162
2156
|
pivotBy,
|
|
2163
|
-
|
|
2157
|
+
groupBy
|
|
2164
2158
|
}));
|
|
2165
2159
|
} else {
|
|
2166
2160
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2169,19 +2163,19 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2169
2163
|
if (!column.render) {
|
|
2170
2164
|
column.render = (renderOptions) => {
|
|
2171
2165
|
var _a;
|
|
2172
|
-
let { value, rowInfo, column: column2,
|
|
2166
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2173
2167
|
if (column2.renderValue) {
|
|
2174
2168
|
value = column2.renderValue(renderOptions);
|
|
2175
2169
|
}
|
|
2176
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2177
|
-
return /* @__PURE__ */
|
|
2170
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2171
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
2178
2172
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2179
|
-
}, showExpanderIcon ? /* @__PURE__ */
|
|
2173
|
+
}, showExpanderIcon ? /* @__PURE__ */ React6.createElement(ExpanderIcon, {
|
|
2180
2174
|
expanded: !rowInfo.collapsed,
|
|
2181
2175
|
onChange: () => {
|
|
2182
2176
|
toggleGroupRow(rowInfo.groupKeys);
|
|
2183
2177
|
}
|
|
2184
|
-
}) : null, /* @__PURE__ */
|
|
2178
|
+
}) : null, /* @__PURE__ */ React6.createElement("div", {
|
|
2185
2179
|
className: cssEllipsisClassName
|
|
2186
2180
|
}, value != null ? value : null));
|
|
2187
2181
|
};
|
|
@@ -2198,7 +2192,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2198
2192
|
}
|
|
2199
2193
|
|
|
2200
2194
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2201
|
-
var
|
|
2195
|
+
var React7 = __toModule(require("react"));
|
|
2202
2196
|
function getGroupColumnRender({
|
|
2203
2197
|
groupIndexForColumn,
|
|
2204
2198
|
groupRenderStrategy,
|
|
@@ -2231,14 +2225,14 @@ function getGroupColumnRender({
|
|
|
2231
2225
|
return null;
|
|
2232
2226
|
}
|
|
2233
2227
|
}
|
|
2234
|
-
return /* @__PURE__ */
|
|
2228
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2235
2229
|
className: join(display.flex, alignItems.center)
|
|
2236
|
-
}, /* @__PURE__ */
|
|
2230
|
+
}, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2237
2231
|
expanded: !collapsed,
|
|
2238
2232
|
onChange: () => {
|
|
2239
2233
|
toggleGroupRow(groupKeys);
|
|
2240
2234
|
}
|
|
2241
|
-
}), /* @__PURE__ */
|
|
2235
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
2242
2236
|
className: cssEllipsisClassName
|
|
2243
2237
|
}, value != null ? value : null));
|
|
2244
2238
|
};
|
|
@@ -2271,7 +2265,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2271
2265
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2272
2266
|
let generatedGroupColumn = {
|
|
2273
2267
|
header: `Group`,
|
|
2274
|
-
groupByField: options.
|
|
2268
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2275
2269
|
sortable: false,
|
|
2276
2270
|
render: (renderOptions) => {
|
|
2277
2271
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2281,14 +2275,14 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2281
2275
|
if (column.renderValue) {
|
|
2282
2276
|
value = column.renderValue(renderOptions);
|
|
2283
2277
|
}
|
|
2284
|
-
return /* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2285
2279
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2286
|
-
}, /* @__PURE__ */
|
|
2280
|
+
}, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2287
2281
|
expanded: !rowInfo.collapsed,
|
|
2288
2282
|
onChange: () => {
|
|
2289
2283
|
toggleGroupRow(rowInfo.groupKeys);
|
|
2290
2284
|
}
|
|
2291
|
-
}), /* @__PURE__ */
|
|
2285
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
2292
2286
|
className: cssEllipsisClassName
|
|
2293
2287
|
}, value != null ? value : null));
|
|
2294
2288
|
}
|
|
@@ -2304,10 +2298,10 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2304
2298
|
}
|
|
2305
2299
|
|
|
2306
2300
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2307
|
-
var
|
|
2301
|
+
var import_react16 = __toModule(require("react"));
|
|
2308
2302
|
|
|
2309
2303
|
// src/components/DataSource/index.tsx
|
|
2310
|
-
var
|
|
2304
|
+
var React8 = __toModule(require("react"));
|
|
2311
2305
|
|
|
2312
2306
|
// src/utils/multisort/sortTypes.ts
|
|
2313
2307
|
var numberComparator = function(first, second) {
|
|
@@ -2384,166 +2378,9 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
2384
2378
|
};
|
|
2385
2379
|
|
|
2386
2380
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2387
|
-
var import_react16 = __toModule(require("react"));
|
|
2388
|
-
|
|
2389
|
-
// src/components/hooks/useEffectWithChanges.ts
|
|
2390
2381
|
var import_react15 = __toModule(require("react"));
|
|
2391
|
-
function useEffectWithChanges(fn, deps) {
|
|
2392
|
-
const prevRef = (0, import_react15.useRef)({});
|
|
2393
|
-
const oldValuesRef = (0, import_react15.useRef)({});
|
|
2394
|
-
const oldValues = oldValuesRef.current;
|
|
2395
|
-
const changesRef = (0, import_react15.useRef)({});
|
|
2396
|
-
const changes = changesRef.current;
|
|
2397
|
-
const useEffectDeps = [];
|
|
2398
|
-
for (let k in deps) {
|
|
2399
|
-
if (deps.hasOwnProperty(k)) {
|
|
2400
|
-
if (deps[k] !== prevRef.current[k]) {
|
|
2401
|
-
changes[k] = deps[k];
|
|
2402
|
-
oldValues[k] = prevRef.current[k];
|
|
2403
|
-
}
|
|
2404
|
-
useEffectDeps.push(deps[k]);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
prevRef.current = deps;
|
|
2408
|
-
(0, import_react15.useEffect)(() => {
|
|
2409
|
-
const changes2 = changesRef.current;
|
|
2410
|
-
const result = fn(changes2, oldValues);
|
|
2411
|
-
changesRef.current = {};
|
|
2412
|
-
oldValuesRef.current = {};
|
|
2413
|
-
return result;
|
|
2414
|
-
}, useEffectDeps);
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2418
|
-
function buildDataSourceDataParams(componentState) {
|
|
2419
|
-
var _a, _b;
|
|
2420
|
-
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2421
|
-
const dataSourceParams = {
|
|
2422
|
-
originalDataArray: componentState.originalDataArray,
|
|
2423
|
-
sortInfo,
|
|
2424
|
-
groupRowsBy: componentState.groupRowsBy,
|
|
2425
|
-
pivotBy: componentState.pivotBy
|
|
2426
|
-
};
|
|
2427
|
-
if (componentState.livePagination !== void 0) {
|
|
2428
|
-
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2429
|
-
}
|
|
2430
|
-
return dataSourceParams;
|
|
2431
|
-
}
|
|
2432
|
-
function notifyDataParamsChanged(componentState, actions) {
|
|
2433
|
-
var _a;
|
|
2434
|
-
if (typeof componentState.data === "function") {
|
|
2435
|
-
loadData(componentState.data, componentState, actions);
|
|
2436
|
-
}
|
|
2437
|
-
const dataParams = buildDataSourceDataParams(componentState);
|
|
2438
|
-
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2439
|
-
}
|
|
2440
|
-
function loadData(data, componentState, actions) {
|
|
2441
|
-
const dataParams = buildDataSourceDataParams(componentState);
|
|
2442
|
-
if (typeof data === "function") {
|
|
2443
|
-
data = data(dataParams);
|
|
2444
|
-
}
|
|
2445
|
-
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2446
|
-
if (dataIsPromise) {
|
|
2447
|
-
actions.loading = true;
|
|
2448
|
-
}
|
|
2449
|
-
Promise.resolve(data).then((dataParam) => {
|
|
2450
|
-
let dataArray = [];
|
|
2451
|
-
if (Array.isArray(dataParam.data)) {
|
|
2452
|
-
const remoteData = dataParam;
|
|
2453
|
-
dataArray = remoteData.data;
|
|
2454
|
-
if (remoteData.livePaginationCursor !== void 0) {
|
|
2455
|
-
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2456
|
-
}
|
|
2457
|
-
} else {
|
|
2458
|
-
dataArray = dataParam;
|
|
2459
|
-
}
|
|
2460
|
-
actions.originalDataArray = dataArray;
|
|
2461
|
-
if (dataIsPromise) {
|
|
2462
|
-
actions.loading = false;
|
|
2463
|
-
}
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
function useLoadData() {
|
|
2467
|
-
const {
|
|
2468
|
-
getComponentState,
|
|
2469
|
-
componentActions: actions,
|
|
2470
|
-
componentState: { data }
|
|
2471
|
-
} = useComponentState();
|
|
2472
|
-
(0, import_react16.useLayoutEffect)(() => {
|
|
2473
|
-
loadData(data, getComponentState(), actions);
|
|
2474
|
-
}, [data]);
|
|
2475
|
-
useLivePagination();
|
|
2476
|
-
}
|
|
2477
|
-
function useLivePagination() {
|
|
2478
|
-
const {
|
|
2479
|
-
getComponentState,
|
|
2480
|
-
componentActions: actions,
|
|
2481
|
-
componentState
|
|
2482
|
-
} = useComponentState();
|
|
2483
|
-
const {
|
|
2484
|
-
notifyScrollbarsChange,
|
|
2485
|
-
sortInfo,
|
|
2486
|
-
groupRowsBy,
|
|
2487
|
-
pivotBy,
|
|
2488
|
-
livePaginationCursor,
|
|
2489
|
-
scrollBottomId
|
|
2490
|
-
} = componentState;
|
|
2491
|
-
const [scrollbars, setScrollbars] = (0, import_react16.useState)({
|
|
2492
|
-
vertical: false,
|
|
2493
|
-
horizontal: false
|
|
2494
|
-
});
|
|
2495
|
-
const scrollbarsRef = (0, import_react16.useRef)(scrollbars);
|
|
2496
|
-
(0, import_react16.useEffect)(() => {
|
|
2497
|
-
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2498
|
-
if (!scrollbars2) {
|
|
2499
|
-
return;
|
|
2500
|
-
}
|
|
2501
|
-
scrollbarsRef.current = scrollbars2;
|
|
2502
|
-
setScrollbars(scrollbars2);
|
|
2503
|
-
});
|
|
2504
|
-
return () => notifyScrollbarsChange.destroy();
|
|
2505
|
-
}, [notifyScrollbarsChange]);
|
|
2506
|
-
const [cursorId, updateCursorId] = (0, import_react16.useState)(void 0);
|
|
2507
|
-
(0, import_react16.useEffect)(() => {
|
|
2508
|
-
const frameId = requestAnimationFrame(() => {
|
|
2509
|
-
var _a;
|
|
2510
|
-
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2511
|
-
updateCursorId(livePaginationCursor);
|
|
2512
|
-
}
|
|
2513
|
-
});
|
|
2514
|
-
return () => cancelAnimationFrame(frameId);
|
|
2515
|
-
}, [livePaginationCursor]);
|
|
2516
|
-
(0, import_react16.useEffect)(() => {
|
|
2517
|
-
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2518
|
-
if (!scrollbars.vertical && livePagination) {
|
|
2519
|
-
updateCursorId(livePaginationCursor2);
|
|
2520
|
-
}
|
|
2521
|
-
}, [scrollbars.vertical]);
|
|
2522
|
-
(0, import_react16.useEffect)(() => {
|
|
2523
|
-
updateCursorId(scrollBottomId);
|
|
2524
|
-
}, [scrollBottomId]);
|
|
2525
|
-
const depsObject = {
|
|
2526
|
-
sortInfo,
|
|
2527
|
-
groupRowsBy,
|
|
2528
|
-
pivotBy,
|
|
2529
|
-
cursorId
|
|
2530
|
-
};
|
|
2531
|
-
useEffectWithChanges(() => {
|
|
2532
|
-
if (cursorId === void 0) {
|
|
2533
|
-
return;
|
|
2534
|
-
}
|
|
2535
|
-
notifyDataParamsChanged(getComponentState(), actions);
|
|
2536
|
-
}, depsObject);
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
2540
|
-
var normalizeSortInfo = (sortInfo) => {
|
|
2541
|
-
sortInfo = sortInfo != null ? sortInfo : [];
|
|
2542
|
-
return Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
2543
|
-
};
|
|
2544
2382
|
|
|
2545
|
-
// src/
|
|
2546
|
-
var import_react17 = __toModule(require("react"));
|
|
2383
|
+
// src/utils/DeepMap/once.ts
|
|
2547
2384
|
function once(fn) {
|
|
2548
2385
|
let called = false;
|
|
2549
2386
|
let result = null;
|
|
@@ -2557,14 +2394,8 @@ function once(fn) {
|
|
|
2557
2394
|
};
|
|
2558
2395
|
return onceFn;
|
|
2559
2396
|
}
|
|
2560
|
-
function useOnce(fn) {
|
|
2561
|
-
const onceFn = (0, import_react17.useMemo)(() => {
|
|
2562
|
-
return once(fn);
|
|
2563
|
-
}, []);
|
|
2564
|
-
return onceFn();
|
|
2565
|
-
}
|
|
2566
2397
|
|
|
2567
|
-
// src/utils/DeepMap.ts
|
|
2398
|
+
// src/utils/DeepMap/index.ts
|
|
2568
2399
|
var SORT_ASC_REVISION = (p1, p2) => sortAscending(p1.revision, p2.revision);
|
|
2569
2400
|
var DeepMap = class {
|
|
2570
2401
|
constructor(initial) {
|
|
@@ -2605,6 +2436,13 @@ var DeepMap = class {
|
|
|
2605
2436
|
});
|
|
2606
2437
|
}
|
|
2607
2438
|
}
|
|
2439
|
+
static clone(map2) {
|
|
2440
|
+
const clone = new DeepMap();
|
|
2441
|
+
map2.visit((pair, keys) => {
|
|
2442
|
+
clone.set(keys, pair.value);
|
|
2443
|
+
});
|
|
2444
|
+
return clone;
|
|
2445
|
+
}
|
|
2608
2446
|
set(keys, value) {
|
|
2609
2447
|
let currentMap = this.map;
|
|
2610
2448
|
if (!keys.length) {
|
|
@@ -2809,287 +2647,143 @@ var DeepMap = class {
|
|
|
2809
2647
|
}
|
|
2810
2648
|
};
|
|
2811
2649
|
|
|
2812
|
-
// src/components/DataSource/GroupRowsState.ts
|
|
2813
|
-
var GroupRowsState = class {
|
|
2814
|
-
constructor(state) {
|
|
2815
|
-
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
2816
|
-
}
|
|
2817
|
-
getState() {
|
|
2818
|
-
var _a, _b, _c, _d;
|
|
2819
|
-
return {
|
|
2820
|
-
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
2821
|
-
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
2822
|
-
};
|
|
2823
|
-
}
|
|
2824
|
-
destroy() {
|
|
2825
|
-
var _a, _b;
|
|
2826
|
-
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
2827
|
-
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
2828
|
-
delete this.expandedMap;
|
|
2829
|
-
delete this.collapsedMap;
|
|
2830
|
-
}
|
|
2831
|
-
update(state) {
|
|
2832
|
-
var _a, _b, _c, _d;
|
|
2833
|
-
this.initialState = state;
|
|
2834
|
-
const { collapsedRows, expandedRows } = this.initialState;
|
|
2835
|
-
this.collapsedAll = collapsedRows === true;
|
|
2836
|
-
this.expandedAll = expandedRows === true;
|
|
2837
|
-
if (this.collapsedAll && this.expandedAll) {
|
|
2838
|
-
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
2839
|
-
}
|
|
2840
|
-
if (collapsedRows !== true) {
|
|
2841
|
-
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
2842
|
-
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
2843
|
-
}
|
|
2844
|
-
if (expandedRows !== true) {
|
|
2845
|
-
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
2846
|
-
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
areAllCollapsed() {
|
|
2850
|
-
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
2851
|
-
}
|
|
2852
|
-
areAllExpanded() {
|
|
2853
|
-
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
2854
|
-
}
|
|
2855
|
-
collapseAll() {
|
|
2856
|
-
this.update({
|
|
2857
|
-
collapsedRows: true,
|
|
2858
|
-
expandedRows: []
|
|
2859
|
-
});
|
|
2860
|
-
}
|
|
2861
|
-
expandAll() {
|
|
2862
|
-
this.update({
|
|
2863
|
-
expandedRows: true,
|
|
2864
|
-
collapsedRows: []
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
isGroupRowExpanded(keys) {
|
|
2868
|
-
var _a, _b;
|
|
2869
|
-
if (this.expandedAll === true) {
|
|
2870
|
-
if (this.collapsedAll === true) {
|
|
2871
|
-
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
2872
|
-
}
|
|
2873
|
-
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
2874
|
-
}
|
|
2875
|
-
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
2876
|
-
}
|
|
2877
|
-
isGroupRowCollapsed(keys) {
|
|
2878
|
-
return !this.isGroupRowExpanded(keys);
|
|
2879
|
-
}
|
|
2880
|
-
setGroupRowExpanded(keys, shouldExpand) {
|
|
2881
|
-
var _a;
|
|
2882
|
-
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
2883
|
-
return;
|
|
2884
|
-
}
|
|
2885
|
-
if (shouldExpand) {
|
|
2886
|
-
if (this.collapsedAll === true) {
|
|
2887
|
-
if (!this.expandedMap) {
|
|
2888
|
-
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
2889
|
-
}
|
|
2890
|
-
this.expandedMap.set(keys, true);
|
|
2891
|
-
} else if (this.expandedAll === true) {
|
|
2892
|
-
if (!this.collapsedMap) {
|
|
2893
|
-
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
2894
|
-
}
|
|
2895
|
-
this.collapsedMap.delete(keys);
|
|
2896
|
-
}
|
|
2897
|
-
} else {
|
|
2898
|
-
if (this.expandedAll === true) {
|
|
2899
|
-
if (!this.collapsedMap) {
|
|
2900
|
-
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
2901
|
-
}
|
|
2902
|
-
this.collapsedMap.set(keys, true);
|
|
2903
|
-
} else if (this.collapsedAll === true) {
|
|
2904
|
-
if (!this.expandedMap) {
|
|
2905
|
-
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
2906
|
-
}
|
|
2907
|
-
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
2908
|
-
}
|
|
2909
|
-
}
|
|
2910
|
-
}
|
|
2911
|
-
collapseGroupRow(keys) {
|
|
2912
|
-
this.setGroupRowExpanded(keys, false);
|
|
2913
|
-
}
|
|
2914
|
-
expandGroupRow(keys) {
|
|
2915
|
-
this.setGroupRowExpanded(keys, true);
|
|
2916
|
-
}
|
|
2917
|
-
toggleGroupRow(keys) {
|
|
2918
|
-
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
2919
|
-
}
|
|
2920
|
-
};
|
|
2921
|
-
|
|
2922
|
-
// src/utils/shallowEqualObjects.ts
|
|
2923
|
-
function shallowEqualObjects(objA, objB) {
|
|
2924
|
-
if (objA === objB) {
|
|
2925
|
-
return true;
|
|
2926
|
-
}
|
|
2927
|
-
if (!objA || !objB) {
|
|
2928
|
-
return false;
|
|
2929
|
-
}
|
|
2930
|
-
var aKeys = Object.keys(objA);
|
|
2931
|
-
var bKeys = Object.keys(objB);
|
|
2932
|
-
var len = aKeys.length;
|
|
2933
|
-
if (bKeys.length !== len) {
|
|
2934
|
-
return false;
|
|
2935
|
-
}
|
|
2936
|
-
for (var i = 0; i < len; i++) {
|
|
2937
|
-
var key = aKeys[i];
|
|
2938
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2939
|
-
return false;
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
return true;
|
|
2943
|
-
}
|
|
2944
|
-
|
|
2945
|
-
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2946
|
-
var map = new WeakMap();
|
|
2947
|
-
var getCompareDefault = (a) => a;
|
|
2948
|
-
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
2949
|
-
map.set(fn, {
|
|
2950
|
-
lastCallTime: 0,
|
|
2951
|
-
lastCallArg: null
|
|
2952
|
-
});
|
|
2953
|
-
const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
|
|
2954
|
-
return (arg) => {
|
|
2955
|
-
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2956
|
-
lastCallTime: 0,
|
|
2957
|
-
lastCallArg: null
|
|
2958
|
-
};
|
|
2959
|
-
const now = Date.now();
|
|
2960
|
-
const diff = now - lastCallTime;
|
|
2961
|
-
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
2962
|
-
if (diff < timeframe && objectsEqual) {
|
|
2963
|
-
return;
|
|
2964
|
-
}
|
|
2965
|
-
map.set(fn, {
|
|
2966
|
-
lastCallTime: now,
|
|
2967
|
-
lastCallArg: arg
|
|
2968
|
-
});
|
|
2969
|
-
fn(arg);
|
|
2970
|
-
};
|
|
2971
|
-
}
|
|
2972
|
-
|
|
2973
|
-
// src/components/DataSource/state/getInitialState.ts
|
|
2974
|
-
function initSetupState2() {
|
|
2975
|
-
const now = Date.now();
|
|
2976
|
-
const originalDataArray = [];
|
|
2977
|
-
const dataArray = [];
|
|
2978
|
-
return {
|
|
2979
|
-
dataParams: void 0,
|
|
2980
|
-
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
2981
|
-
pivotTotalColumnPosition: "end",
|
|
2982
|
-
originalDataArray,
|
|
2983
|
-
scrollBottomId: Symbol("scrollBottomId"),
|
|
2984
|
-
pivotColumns: void 0,
|
|
2985
|
-
pivotColumnGroups: void 0,
|
|
2986
|
-
dataArray,
|
|
2987
|
-
updatedAt: now,
|
|
2988
|
-
groupedAt: 0,
|
|
2989
|
-
sortedAt: 0,
|
|
2990
|
-
reducedAt: now,
|
|
2991
|
-
generateGroupRows: true,
|
|
2992
|
-
aggregationReducers: void 0,
|
|
2993
|
-
groupDeepMap: void 0,
|
|
2994
|
-
postSortDataArray: void 0,
|
|
2995
|
-
postGroupDataArray: void 0,
|
|
2996
|
-
lastSortDataArray: void 0,
|
|
2997
|
-
lastGroupDataArray: void 0
|
|
2998
|
-
};
|
|
2999
|
-
}
|
|
3000
|
-
function getCompareObject(dataParams) {
|
|
3001
|
-
const obj = __spreadValues({}, dataParams);
|
|
3002
|
-
delete obj.originalDataArray;
|
|
3003
|
-
return obj;
|
|
3004
|
-
}
|
|
3005
|
-
var forwardProps3 = () => {
|
|
3006
|
-
return {
|
|
3007
|
-
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
3008
|
-
remoteCount: 1,
|
|
3009
|
-
data: 1,
|
|
3010
|
-
pivotBy: 1,
|
|
3011
|
-
primaryKey: 1,
|
|
3012
|
-
livePagination: 1,
|
|
3013
|
-
livePaginationCursor: 1,
|
|
3014
|
-
loading: (loading) => loading != null ? loading : false,
|
|
3015
|
-
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
3016
|
-
groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
|
|
3017
|
-
groupRowsState: (groupRowsState) => {
|
|
3018
|
-
return groupRowsState || new GroupRowsState({
|
|
3019
|
-
expandedRows: true,
|
|
3020
|
-
collapsedRows: []
|
|
3021
|
-
});
|
|
3022
|
-
}
|
|
3023
|
-
};
|
|
3024
|
-
};
|
|
3025
|
-
function mapPropsToState2(params) {
|
|
3026
|
-
const { props } = params;
|
|
3027
|
-
const controlledSort = isControlledValue(props.sortInfo);
|
|
3028
|
-
return {
|
|
3029
|
-
controlledSort,
|
|
3030
|
-
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3031
|
-
};
|
|
3032
|
-
}
|
|
3033
|
-
function getInterceptActions() {
|
|
3034
|
-
return {
|
|
3035
|
-
sortInfo: (sortInfo, { actions, state }) => {
|
|
3036
|
-
const dataParams = buildDataSourceDataParams(state);
|
|
3037
|
-
dataParams.sortInfo = sortInfo;
|
|
3038
|
-
actions.dataParams = dataParams;
|
|
3039
|
-
}
|
|
3040
|
-
};
|
|
3041
|
-
}
|
|
3042
|
-
|
|
3043
2650
|
// src/utils/groupAndPivot/index.ts
|
|
2651
|
+
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
3044
2652
|
function DEFAULT_TO_KEY(value) {
|
|
3045
2653
|
return value;
|
|
3046
2654
|
}
|
|
3047
2655
|
function initReducers(reducers) {
|
|
3048
|
-
if (!reducers || !reducers.length) {
|
|
3049
|
-
return
|
|
2656
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
2657
|
+
return {};
|
|
3050
2658
|
}
|
|
3051
|
-
|
|
2659
|
+
const result = {};
|
|
2660
|
+
for (let key in reducers)
|
|
2661
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2662
|
+
result[key] = reducers[key].initialValue;
|
|
2663
|
+
}
|
|
2664
|
+
return result;
|
|
3052
2665
|
}
|
|
3053
2666
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
3054
|
-
|
|
2667
|
+
var _a, _b;
|
|
2668
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3055
2669
|
return;
|
|
3056
2670
|
}
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
2671
|
+
for (let key in reducers)
|
|
2672
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2673
|
+
const reducer = reducers[key];
|
|
2674
|
+
if (typeof reducer.reducer !== "function") {
|
|
2675
|
+
continue;
|
|
2676
|
+
}
|
|
2677
|
+
const currentValue = reducerResults[key];
|
|
2678
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
2679
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
2680
|
+
}
|
|
3061
2681
|
}
|
|
3062
|
-
function
|
|
2682
|
+
function lazyGroup(groupParams, rootData) {
|
|
3063
2683
|
const {
|
|
3064
|
-
|
|
3065
|
-
defaultToKey = DEFAULT_TO_KEY,
|
|
2684
|
+
reducers = {},
|
|
3066
2685
|
pivot,
|
|
3067
|
-
|
|
2686
|
+
groupBy,
|
|
2687
|
+
mappings
|
|
3068
2688
|
} = groupParams;
|
|
3069
|
-
const groupByLength = groupBy.length;
|
|
3070
|
-
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
3071
2689
|
const deepMap = new DeepMap();
|
|
3072
|
-
|
|
2690
|
+
function traverseValues(pivotDeepMap, container, pivot2, pivotIndex = 0, currentPivotKeys2 = []) {
|
|
2691
|
+
const last = pivotIndex === pivot2.length - 1;
|
|
2692
|
+
const values = container[(mappings == null ? void 0 : mappings.values) || "values"] || {};
|
|
2693
|
+
for (var k in values)
|
|
2694
|
+
if (values.hasOwnProperty(k)) {
|
|
2695
|
+
const pivotKey = k;
|
|
2696
|
+
currentPivotKeys2.push(pivotKey);
|
|
2697
|
+
topLevelPivotColumns.set(currentPivotKeys2, true);
|
|
2698
|
+
pivotDeepMap.set(currentPivotKeys2, {
|
|
2699
|
+
reducerResults: values[k][(mappings == null ? void 0 : mappings.totals) || "totals"] || {},
|
|
2700
|
+
items: []
|
|
2701
|
+
});
|
|
2702
|
+
if (!last) {
|
|
2703
|
+
traverseValues(pivotDeepMap, values[k], pivot2, pivotIndex + 1, currentPivotKeys2);
|
|
2704
|
+
}
|
|
2705
|
+
currentPivotKeys2.pop();
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
3073
2709
|
let currentPivotKeys = [];
|
|
3074
2710
|
const initialReducerValue = initReducers(reducers);
|
|
3075
|
-
const globalReducerResults =
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
if (!deepMap.has(currentGroupKeys)) {
|
|
3083
|
-
const deepMapGroupValue = {
|
|
2711
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2712
|
+
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
2713
|
+
const [_rootKey, ...currentGroupKeys] = keys;
|
|
2714
|
+
const dataArray = lazyGroupRowInfo.items;
|
|
2715
|
+
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
2716
|
+
if (!dataArray[i]) {
|
|
2717
|
+
const deepMapGroupValue2 = {
|
|
3084
2718
|
items: [],
|
|
3085
|
-
reducerResults:
|
|
2719
|
+
reducerResults: {}
|
|
3086
2720
|
};
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
}
|
|
3090
|
-
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
2721
|
+
deepMap.set([...currentGroupKeys, `not-loaded-yet-${i}`], deepMapGroupValue2);
|
|
2722
|
+
continue;
|
|
3091
2723
|
}
|
|
3092
|
-
const
|
|
2724
|
+
const dataObject = dataArray[i].data;
|
|
2725
|
+
const dataKeys = dataArray[i].keys;
|
|
2726
|
+
let item = dataObject;
|
|
2727
|
+
const { field: groupByProperty } = groupBy[dataKeys.length - 1];
|
|
2728
|
+
const key = item[groupByProperty];
|
|
2729
|
+
currentGroupKeys.push(key);
|
|
2730
|
+
const deepMapGroupValue = {
|
|
2731
|
+
items: [],
|
|
2732
|
+
reducerResults: dataArray[i].aggregations || {}
|
|
2733
|
+
};
|
|
2734
|
+
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
2735
|
+
if (pivot) {
|
|
2736
|
+
const pivotDeepMap = deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
2737
|
+
const pivotContainer = dataArray[i].pivot;
|
|
2738
|
+
traverseValues(pivotDeepMap, pivotContainer, pivot, 0, currentPivotKeys);
|
|
2739
|
+
}
|
|
2740
|
+
currentGroupKeys.pop();
|
|
2741
|
+
}
|
|
2742
|
+
next == null ? void 0 : next();
|
|
2743
|
+
});
|
|
2744
|
+
const result = {
|
|
2745
|
+
deepMap,
|
|
2746
|
+
groupParams,
|
|
2747
|
+
initialData: rootData,
|
|
2748
|
+
reducerResults: globalReducerResults
|
|
2749
|
+
};
|
|
2750
|
+
if (pivot) {
|
|
2751
|
+
result.topLevelPivotColumns = topLevelPivotColumns;
|
|
2752
|
+
result.pivot = pivot;
|
|
2753
|
+
}
|
|
2754
|
+
return result;
|
|
2755
|
+
}
|
|
2756
|
+
function group(groupParams, data) {
|
|
2757
|
+
const {
|
|
2758
|
+
groupBy,
|
|
2759
|
+
defaultToKey = DEFAULT_TO_KEY,
|
|
2760
|
+
pivot,
|
|
2761
|
+
reducers
|
|
2762
|
+
} = groupParams;
|
|
2763
|
+
const groupByLength = groupBy.length;
|
|
2764
|
+
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
2765
|
+
const deepMap = new DeepMap();
|
|
2766
|
+
let currentGroupKeys = [];
|
|
2767
|
+
let currentPivotKeys = [];
|
|
2768
|
+
const initialReducerValue = initReducers(reducers);
|
|
2769
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2770
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
|
2771
|
+
let item = data[i];
|
|
2772
|
+
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
2773
|
+
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
2774
|
+
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
2775
|
+
currentGroupKeys.push(key);
|
|
2776
|
+
if (!deepMap.has(currentGroupKeys)) {
|
|
2777
|
+
const deepMapGroupValue = {
|
|
2778
|
+
items: [],
|
|
2779
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
2780
|
+
};
|
|
2781
|
+
if (pivot) {
|
|
2782
|
+
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
2783
|
+
}
|
|
2784
|
+
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
2785
|
+
}
|
|
2786
|
+
const {
|
|
3093
2787
|
items: currentGroupItems,
|
|
3094
2788
|
reducerResults,
|
|
3095
2789
|
pivotDeepMap
|
|
@@ -3106,7 +2800,7 @@ function group(groupParams, data) {
|
|
|
3106
2800
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3107
2801
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3108
2802
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3109
|
-
reducerResults:
|
|
2803
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3110
2804
|
items: []
|
|
3111
2805
|
});
|
|
3112
2806
|
}
|
|
@@ -3168,11 +2862,23 @@ function flatten(groupResult) {
|
|
|
3168
2862
|
return result;
|
|
3169
2863
|
}
|
|
3170
2864
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
3171
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
2865
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
3172
2866
|
const groupNesting = groupKeys.length;
|
|
3173
2867
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
2868
|
+
let data = null;
|
|
2869
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
2870
|
+
data = {};
|
|
2871
|
+
for (let key in reducers)
|
|
2872
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2873
|
+
const reducer = reducers[key];
|
|
2874
|
+
const field = reducer.field;
|
|
2875
|
+
if (field) {
|
|
2876
|
+
data[field] = reducerResults[key];
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
3174
2880
|
const enhancedGroupData = {
|
|
3175
|
-
data
|
|
2881
|
+
data,
|
|
3176
2882
|
groupCount: groupItems.length,
|
|
3177
2883
|
groupData: groupItems,
|
|
3178
2884
|
groupKeys,
|
|
@@ -3194,17 +2900,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
3194
2900
|
return enhancedGroupData;
|
|
3195
2901
|
}
|
|
3196
2902
|
function completeReducers(reducers, reducerResults, items) {
|
|
3197
|
-
if (reducers
|
|
3198
|
-
|
|
3199
|
-
if (
|
|
3200
|
-
|
|
2903
|
+
if (reducers) {
|
|
2904
|
+
for (let key in reducers)
|
|
2905
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2906
|
+
const reducer = reducers[key];
|
|
2907
|
+
if (reducer.done) {
|
|
2908
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
2909
|
+
}
|
|
3201
2910
|
}
|
|
3202
|
-
});
|
|
3203
2911
|
}
|
|
3204
2912
|
return reducerResults;
|
|
3205
2913
|
}
|
|
3206
2914
|
function enhancedFlatten(param) {
|
|
3207
|
-
const {
|
|
2915
|
+
const {
|
|
2916
|
+
groupResult,
|
|
2917
|
+
toPrimaryKey,
|
|
2918
|
+
groupRowsState,
|
|
2919
|
+
generateGroupRows,
|
|
2920
|
+
reducers = {}
|
|
2921
|
+
} = param;
|
|
3208
2922
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
3209
2923
|
const { groupBy } = groupParams;
|
|
3210
2924
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -3219,6 +2933,7 @@ function enhancedFlatten(param) {
|
|
|
3219
2933
|
const enhancedGroupData = getEnhancedGroupData({
|
|
3220
2934
|
groupBy: groupByStrings,
|
|
3221
2935
|
parents: Array.from(parents),
|
|
2936
|
+
reducers,
|
|
3222
2937
|
indexInGroup,
|
|
3223
2938
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3224
2939
|
indexInAll: result.length,
|
|
@@ -3262,97 +2977,750 @@ function enhancedFlatten(param) {
|
|
|
3262
2977
|
next();
|
|
3263
2978
|
}
|
|
3264
2979
|
}
|
|
3265
|
-
parents.pop();
|
|
3266
|
-
indexInParentGroups.pop();
|
|
3267
|
-
});
|
|
3268
|
-
return {
|
|
3269
|
-
data: result
|
|
2980
|
+
parents.pop();
|
|
2981
|
+
indexInParentGroups.pop();
|
|
2982
|
+
});
|
|
2983
|
+
return {
|
|
2984
|
+
data: result
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2989
|
+
var import_react14 = __toModule(require("react"));
|
|
2990
|
+
function useEffectWithChanges(fn, deps) {
|
|
2991
|
+
const prevRef = (0, import_react14.useRef)({});
|
|
2992
|
+
const oldValuesRef = (0, import_react14.useRef)({});
|
|
2993
|
+
const oldValues = oldValuesRef.current;
|
|
2994
|
+
const changesRef = (0, import_react14.useRef)({});
|
|
2995
|
+
const changes = changesRef.current;
|
|
2996
|
+
const useEffectDeps = [];
|
|
2997
|
+
for (let k in deps) {
|
|
2998
|
+
if (deps.hasOwnProperty(k)) {
|
|
2999
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
3000
|
+
changes[k] = deps[k];
|
|
3001
|
+
oldValues[k] = prevRef.current[k];
|
|
3002
|
+
}
|
|
3003
|
+
useEffectDeps.push(deps[k]);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
prevRef.current = deps;
|
|
3007
|
+
(0, import_react14.useEffect)(() => {
|
|
3008
|
+
const changes2 = changesRef.current;
|
|
3009
|
+
const result = fn(changes2, oldValues);
|
|
3010
|
+
changesRef.current = {};
|
|
3011
|
+
oldValuesRef.current = {};
|
|
3012
|
+
return result;
|
|
3013
|
+
}, useEffectDeps);
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
3017
|
+
var SKIP_DATA_CHANGES_KEYS = {
|
|
3018
|
+
originalDataArray: true,
|
|
3019
|
+
changes: true
|
|
3020
|
+
};
|
|
3021
|
+
function buildDataSourceDataParams(componentState, overrides) {
|
|
3022
|
+
var _a, _b;
|
|
3023
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
3024
|
+
const dataSourceParams = {
|
|
3025
|
+
originalDataArray: componentState.originalDataArray,
|
|
3026
|
+
sortInfo,
|
|
3027
|
+
groupBy: componentState.groupBy,
|
|
3028
|
+
pivotBy: componentState.pivotBy,
|
|
3029
|
+
aggregationReducers: componentState.aggregationReducers
|
|
3030
|
+
};
|
|
3031
|
+
if (componentState.livePagination !== void 0) {
|
|
3032
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
3033
|
+
dataSourceParams.cursorId = componentState.cursorId;
|
|
3034
|
+
}
|
|
3035
|
+
if (componentState.fullLazyLoad) {
|
|
3036
|
+
if (componentState.lazyLoadBatchSize != null && componentState.lazyLoadBatchSize > 0) {
|
|
3037
|
+
dataSourceParams.lazyLoadBatchSize = componentState.lazyLoadBatchSize;
|
|
3038
|
+
dataSourceParams.lazyLoadStartIndex = 0;
|
|
3039
|
+
}
|
|
3040
|
+
dataSourceParams.groupKeys = [];
|
|
3041
|
+
}
|
|
3042
|
+
if (overrides) {
|
|
3043
|
+
Object.assign(dataSourceParams, overrides);
|
|
3044
|
+
}
|
|
3045
|
+
const changes = {};
|
|
3046
|
+
const oldDataSourceParams = componentState.dataParams || {};
|
|
3047
|
+
for (let k in dataSourceParams) {
|
|
3048
|
+
if (dataSourceParams.hasOwnProperty(k) && !SKIP_DATA_CHANGES_KEYS[k]) {
|
|
3049
|
+
const key = k;
|
|
3050
|
+
if (dataSourceParams[key] !== oldDataSourceParams[key]) {
|
|
3051
|
+
changes[key] = true;
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
dataSourceParams.changes = changes;
|
|
3056
|
+
return dataSourceParams;
|
|
3057
|
+
}
|
|
3058
|
+
function loadData(data, componentState, actions, overrides) {
|
|
3059
|
+
const dataParams = buildDataSourceDataParams(componentState, overrides);
|
|
3060
|
+
if (typeof data === "function") {
|
|
3061
|
+
data = data(dataParams);
|
|
3062
|
+
}
|
|
3063
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
3064
|
+
if (dataIsPromise) {
|
|
3065
|
+
actions.loading = true;
|
|
3066
|
+
}
|
|
3067
|
+
Promise.resolve(data).then((dataParam) => {
|
|
3068
|
+
var _a, _b, _c;
|
|
3069
|
+
let dataArray = [];
|
|
3070
|
+
let skipAssign = false;
|
|
3071
|
+
if (Array.isArray(dataParam.data)) {
|
|
3072
|
+
const remoteData = dataParam;
|
|
3073
|
+
dataArray = remoteData.data;
|
|
3074
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
3075
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
3076
|
+
}
|
|
3077
|
+
if (remoteData.mappings) {
|
|
3078
|
+
actions.pivotMappings = remoteData.mappings;
|
|
3079
|
+
}
|
|
3080
|
+
if (componentState.fullLazyLoad && dataParams.groupKeys) {
|
|
3081
|
+
const lazyGroupData = DeepMap.clone(componentState.originalLazyGroupData);
|
|
3082
|
+
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys];
|
|
3083
|
+
const newGroupRowInfo = {
|
|
3084
|
+
totalCount: (_a = remoteData.totalCount) != null ? _a : dataArray.length,
|
|
3085
|
+
items: dataArray
|
|
3086
|
+
};
|
|
3087
|
+
if (dataParams.lazyLoadBatchSize) {
|
|
3088
|
+
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
3089
|
+
const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
|
|
3090
|
+
items: [],
|
|
3091
|
+
totalCount: newGroupRowInfo.totalCount
|
|
3092
|
+
};
|
|
3093
|
+
currentGroupRowInfo.items.length = currentGroupRowInfo.totalCount;
|
|
3094
|
+
const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
|
|
3095
|
+
const end = start + ((_c = dataParams.lazyLoadBatchSize) != null ? _c : dataArray.length);
|
|
3096
|
+
for (let i = start; i < end; i++) {
|
|
3097
|
+
currentGroupRowInfo.items[i] = newGroupRowInfo.items[i - start];
|
|
3098
|
+
}
|
|
3099
|
+
if (!existingGroupRowInfo) {
|
|
3100
|
+
lazyGroupData.set(key, currentGroupRowInfo);
|
|
3101
|
+
}
|
|
3102
|
+
} else {
|
|
3103
|
+
lazyGroupData.set(key, newGroupRowInfo);
|
|
3104
|
+
}
|
|
3105
|
+
skipAssign = true;
|
|
3106
|
+
actions.originalLazyGroupData = lazyGroupData;
|
|
3107
|
+
}
|
|
3108
|
+
} else {
|
|
3109
|
+
dataArray = dataParam;
|
|
3110
|
+
}
|
|
3111
|
+
if (!skipAssign) {
|
|
3112
|
+
actions.originalDataArray = dataArray;
|
|
3113
|
+
}
|
|
3114
|
+
if (dataIsPromise) {
|
|
3115
|
+
actions.loading = false;
|
|
3116
|
+
}
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
function useLoadData() {
|
|
3120
|
+
const {
|
|
3121
|
+
getComponentState,
|
|
3122
|
+
componentActions: actions,
|
|
3123
|
+
componentState
|
|
3124
|
+
} = useComponentState();
|
|
3125
|
+
const {
|
|
3126
|
+
data,
|
|
3127
|
+
notifyScrollbarsChange,
|
|
3128
|
+
sortInfo,
|
|
3129
|
+
groupBy,
|
|
3130
|
+
pivotBy,
|
|
3131
|
+
livePagination,
|
|
3132
|
+
livePaginationCursor,
|
|
3133
|
+
cursorId: stateCursorId,
|
|
3134
|
+
lazyLoadBatchSize,
|
|
3135
|
+
notifyScrollStop
|
|
3136
|
+
} = componentState;
|
|
3137
|
+
const [scrollbars, setScrollbars] = (0, import_react15.useState)({
|
|
3138
|
+
vertical: false,
|
|
3139
|
+
horizontal: false
|
|
3140
|
+
});
|
|
3141
|
+
const scrollbarsRef = (0, import_react15.useRef)(scrollbars);
|
|
3142
|
+
(0, import_react15.useEffect)(() => {
|
|
3143
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
3144
|
+
if (!scrollbars2) {
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
scrollbarsRef.current = scrollbars2;
|
|
3148
|
+
setScrollbars(scrollbars2);
|
|
3149
|
+
});
|
|
3150
|
+
return () => notifyScrollbarsChange.destroy();
|
|
3151
|
+
}, [notifyScrollbarsChange]);
|
|
3152
|
+
(0, import_react15.useEffect)(() => {
|
|
3153
|
+
const frameId = requestAnimationFrame(() => {
|
|
3154
|
+
var _a;
|
|
3155
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical) && livePaginationCursor) {
|
|
3156
|
+
actions.cursorId = livePaginationCursor;
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
return () => cancelAnimationFrame(frameId);
|
|
3160
|
+
}, [livePaginationCursor]);
|
|
3161
|
+
(0, import_react15.useEffect)(() => {
|
|
3162
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2 } = getComponentState();
|
|
3163
|
+
if (!scrollbars.vertical && livePagination2) {
|
|
3164
|
+
if (livePaginationCursor2) {
|
|
3165
|
+
actions.cursorId = livePaginationCursor2;
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
}, [scrollbars.vertical]);
|
|
3169
|
+
const depsObject = {
|
|
3170
|
+
sortInfo,
|
|
3171
|
+
groupBy,
|
|
3172
|
+
pivotBy,
|
|
3173
|
+
cursorId: livePagination ? stateCursorId : null
|
|
3174
|
+
};
|
|
3175
|
+
const initialRef = (0, import_react15.useRef)(true);
|
|
3176
|
+
(0, import_react15.useEffect)(() => {
|
|
3177
|
+
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
3178
|
+
return notifyScrollStop.onChange((param) => {
|
|
3179
|
+
console.log("scroll stop", param);
|
|
3180
|
+
if (!param) {
|
|
3181
|
+
return;
|
|
3182
|
+
}
|
|
3183
|
+
const componentState2 = getComponentState();
|
|
3184
|
+
const {
|
|
3185
|
+
firstVisibleRowIndex: startIndex,
|
|
3186
|
+
lastVisibleRowIndex: endIndex
|
|
3187
|
+
} = param;
|
|
3188
|
+
const firstBatchStart = Math.floor(startIndex / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
3189
|
+
const lastBatchStart = Math.floor(endIndex / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
3190
|
+
const isRowLoaded = (index) => componentState2.dataArray[index].data != null;
|
|
3191
|
+
for (let batchStartIndex = firstBatchStart; batchStartIndex <= lastBatchStart; batchStartIndex = batchStartIndex + lazyLoadBatchSize) {
|
|
3192
|
+
if (!isRowLoaded(batchStartIndex)) {
|
|
3193
|
+
loadData(componentState2.data, componentState2, actions, {
|
|
3194
|
+
lazyLoadBatchSize,
|
|
3195
|
+
lazyLoadStartIndex: batchStartIndex
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3201
|
+
return;
|
|
3202
|
+
}, [lazyLoadBatchSize]);
|
|
3203
|
+
useEffectWithChanges(() => {
|
|
3204
|
+
const componentState2 = getComponentState();
|
|
3205
|
+
if (typeof componentState2.data !== "function") {
|
|
3206
|
+
loadData(componentState2.data, componentState2, actions);
|
|
3207
|
+
}
|
|
3208
|
+
}, { data });
|
|
3209
|
+
useEffectWithChanges(() => {
|
|
3210
|
+
const componentState2 = getComponentState();
|
|
3211
|
+
if (typeof componentState2.data === "function") {
|
|
3212
|
+
loadData(componentState2.data, componentState2, actions);
|
|
3213
|
+
}
|
|
3214
|
+
}, __spreadProps(__spreadValues({}, depsObject), { data }));
|
|
3215
|
+
useEffectWithChanges((_changes, _prevValues) => {
|
|
3216
|
+
const componentState2 = getComponentState();
|
|
3217
|
+
if (initialRef.current) {
|
|
3218
|
+
initialRef.current = false;
|
|
3219
|
+
actions.dataParams = buildDataSourceDataParams(componentState2);
|
|
3220
|
+
}
|
|
3221
|
+
}, depsObject);
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
3225
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
3226
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
3227
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
3228
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
3229
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
3230
|
+
const prevResult = weakMap.get(sortInfo);
|
|
3231
|
+
if (prevResult && prevResult.length === result.length) {
|
|
3232
|
+
return prevResult;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
if (weakMap && sortInfo) {
|
|
3236
|
+
weakMap.set(sortInfo, result);
|
|
3237
|
+
}
|
|
3238
|
+
return result;
|
|
3239
|
+
};
|
|
3240
|
+
|
|
3241
|
+
// src/components/DataSource/GroupRowsState.ts
|
|
3242
|
+
var GroupRowsState = class {
|
|
3243
|
+
constructor(state) {
|
|
3244
|
+
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
3245
|
+
}
|
|
3246
|
+
getState() {
|
|
3247
|
+
var _a, _b, _c, _d;
|
|
3248
|
+
return {
|
|
3249
|
+
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
3250
|
+
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
3251
|
+
};
|
|
3252
|
+
}
|
|
3253
|
+
destroy() {
|
|
3254
|
+
var _a, _b;
|
|
3255
|
+
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
3256
|
+
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
3257
|
+
delete this.expandedMap;
|
|
3258
|
+
delete this.collapsedMap;
|
|
3259
|
+
}
|
|
3260
|
+
update(state) {
|
|
3261
|
+
var _a, _b, _c, _d;
|
|
3262
|
+
this.initialState = state;
|
|
3263
|
+
const { collapsedRows, expandedRows } = this.initialState;
|
|
3264
|
+
this.collapsedAll = collapsedRows === true;
|
|
3265
|
+
this.expandedAll = expandedRows === true;
|
|
3266
|
+
if (this.collapsedAll && this.expandedAll) {
|
|
3267
|
+
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
3268
|
+
}
|
|
3269
|
+
if (collapsedRows !== true) {
|
|
3270
|
+
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
3271
|
+
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
3272
|
+
}
|
|
3273
|
+
if (expandedRows !== true) {
|
|
3274
|
+
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
3275
|
+
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
areAllCollapsed() {
|
|
3279
|
+
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
3280
|
+
}
|
|
3281
|
+
areAllExpanded() {
|
|
3282
|
+
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
3283
|
+
}
|
|
3284
|
+
collapseAll() {
|
|
3285
|
+
this.update({
|
|
3286
|
+
collapsedRows: true,
|
|
3287
|
+
expandedRows: []
|
|
3288
|
+
});
|
|
3289
|
+
}
|
|
3290
|
+
expandAll() {
|
|
3291
|
+
this.update({
|
|
3292
|
+
expandedRows: true,
|
|
3293
|
+
collapsedRows: []
|
|
3294
|
+
});
|
|
3295
|
+
}
|
|
3296
|
+
isGroupRowExpanded(keys) {
|
|
3297
|
+
var _a, _b;
|
|
3298
|
+
if (this.expandedAll === true) {
|
|
3299
|
+
if (this.collapsedAll === true) {
|
|
3300
|
+
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
3301
|
+
}
|
|
3302
|
+
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
3303
|
+
}
|
|
3304
|
+
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
3305
|
+
}
|
|
3306
|
+
isGroupRowCollapsed(keys) {
|
|
3307
|
+
return !this.isGroupRowExpanded(keys);
|
|
3308
|
+
}
|
|
3309
|
+
setGroupRowExpanded(keys, shouldExpand) {
|
|
3310
|
+
var _a;
|
|
3311
|
+
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
3312
|
+
return;
|
|
3313
|
+
}
|
|
3314
|
+
if (shouldExpand) {
|
|
3315
|
+
if (this.collapsedAll === true) {
|
|
3316
|
+
if (!this.expandedMap) {
|
|
3317
|
+
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
3318
|
+
}
|
|
3319
|
+
this.expandedMap.set(keys, true);
|
|
3320
|
+
} else if (this.expandedAll === true) {
|
|
3321
|
+
if (!this.collapsedMap) {
|
|
3322
|
+
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
3323
|
+
}
|
|
3324
|
+
this.collapsedMap.delete(keys);
|
|
3325
|
+
}
|
|
3326
|
+
} else {
|
|
3327
|
+
if (this.expandedAll === true) {
|
|
3328
|
+
if (!this.collapsedMap) {
|
|
3329
|
+
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
3330
|
+
}
|
|
3331
|
+
this.collapsedMap.set(keys, true);
|
|
3332
|
+
} else if (this.collapsedAll === true) {
|
|
3333
|
+
if (!this.expandedMap) {
|
|
3334
|
+
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
3335
|
+
}
|
|
3336
|
+
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
collapseGroupRow(keys) {
|
|
3341
|
+
this.setGroupRowExpanded(keys, false);
|
|
3342
|
+
}
|
|
3343
|
+
expandGroupRow(keys) {
|
|
3344
|
+
this.setGroupRowExpanded(keys, true);
|
|
3345
|
+
}
|
|
3346
|
+
toggleGroupRow(keys) {
|
|
3347
|
+
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
3348
|
+
}
|
|
3349
|
+
};
|
|
3350
|
+
|
|
3351
|
+
// src/utils/shallowEqualObjects.ts
|
|
3352
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
3353
|
+
if (objA === objB) {
|
|
3354
|
+
return true;
|
|
3355
|
+
}
|
|
3356
|
+
if (!objA || !objB) {
|
|
3357
|
+
return false;
|
|
3358
|
+
}
|
|
3359
|
+
var aKeys = Object.keys(objA);
|
|
3360
|
+
var bKeys = Object.keys(objB);
|
|
3361
|
+
if (ignoreKeys) {
|
|
3362
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
3363
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
3364
|
+
}
|
|
3365
|
+
var len = aKeys.length;
|
|
3366
|
+
if (bKeys.length !== len) {
|
|
3367
|
+
return false;
|
|
3368
|
+
}
|
|
3369
|
+
for (var i = 0; i < len; i++) {
|
|
3370
|
+
var key = aKeys[i];
|
|
3371
|
+
if (ignoreKeys) {
|
|
3372
|
+
if (ignoreKeys.has(key)) {
|
|
3373
|
+
continue;
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
3377
|
+
return false;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
return true;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
3384
|
+
var map = new WeakMap();
|
|
3385
|
+
var getCompareDefault = (a) => a;
|
|
3386
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
3387
|
+
map.set(fn, {
|
|
3388
|
+
lastCallTime: 0,
|
|
3389
|
+
lastCallArg: null
|
|
3390
|
+
});
|
|
3391
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
3392
|
+
return (arg) => {
|
|
3393
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
3394
|
+
lastCallTime: 0,
|
|
3395
|
+
lastCallArg: null
|
|
3396
|
+
};
|
|
3397
|
+
const now = Date.now();
|
|
3398
|
+
const diff = now - lastCallTime;
|
|
3399
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
3400
|
+
if (diff < timeframe && objectsEqual) {
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
map.set(fn, {
|
|
3404
|
+
lastCallTime: now,
|
|
3405
|
+
lastCallArg: arg
|
|
3406
|
+
});
|
|
3407
|
+
fn(arg);
|
|
3408
|
+
};
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
// src/components/DataSource/state/getInitialState.ts
|
|
3412
|
+
var defaultCursorId = Symbol("cursorId");
|
|
3413
|
+
function initSetupState2() {
|
|
3414
|
+
const now = Date.now();
|
|
3415
|
+
const originalDataArray = [];
|
|
3416
|
+
const dataArray = [];
|
|
3417
|
+
const originalLazyGroupData = new DeepMap();
|
|
3418
|
+
return {
|
|
3419
|
+
dataParams: void 0,
|
|
3420
|
+
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
3421
|
+
notifyScrollStop: buildSubscriptionCallback(),
|
|
3422
|
+
pivotTotalColumnPosition: "end",
|
|
3423
|
+
originalLazyGroupData,
|
|
3424
|
+
originalDataArray,
|
|
3425
|
+
cursorId: defaultCursorId,
|
|
3426
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
3427
|
+
propsCache: new Map([
|
|
3428
|
+
["sortInfo", new WeakMap()]
|
|
3429
|
+
]),
|
|
3430
|
+
pivotMappings: void 0,
|
|
3431
|
+
pivotColumns: void 0,
|
|
3432
|
+
pivotColumnGroups: void 0,
|
|
3433
|
+
dataArray,
|
|
3434
|
+
updatedAt: now,
|
|
3435
|
+
groupedAt: 0,
|
|
3436
|
+
sortedAt: 0,
|
|
3437
|
+
reducedAt: now,
|
|
3438
|
+
generateGroupRows: true,
|
|
3439
|
+
groupDeepMap: void 0,
|
|
3440
|
+
postSortDataArray: void 0,
|
|
3441
|
+
postGroupDataArray: void 0,
|
|
3442
|
+
lastSortDataArray: void 0,
|
|
3443
|
+
lastGroupDataArray: void 0
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function getCompareObjectForDataParams(dataParams) {
|
|
3447
|
+
const obj = __spreadValues({}, dataParams);
|
|
3448
|
+
delete obj.originalDataArray;
|
|
3449
|
+
return obj;
|
|
3450
|
+
}
|
|
3451
|
+
var forwardProps3 = (setupState) => {
|
|
3452
|
+
return {
|
|
3453
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObjectForDataParams) : void 0,
|
|
3454
|
+
fullLazyLoad: 1,
|
|
3455
|
+
data: 1,
|
|
3456
|
+
pivotBy: 1,
|
|
3457
|
+
primaryKey: 1,
|
|
3458
|
+
livePagination: 1,
|
|
3459
|
+
lazyLoadBatchSize: (lazyLoadBatchSize) => lazyLoadBatchSize != null ? lazyLoadBatchSize : -1,
|
|
3460
|
+
aggregationReducers: 1,
|
|
3461
|
+
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
3462
|
+
loading: (loading) => loading != null ? loading : false,
|
|
3463
|
+
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
3464
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
3465
|
+
groupRowsState: (groupRowsState) => {
|
|
3466
|
+
return groupRowsState || new GroupRowsState({
|
|
3467
|
+
expandedRows: true,
|
|
3468
|
+
collapsedRows: []
|
|
3469
|
+
});
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3472
|
+
};
|
|
3473
|
+
function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
3474
|
+
const livePaginationCursor = typeof livePaginationCursorProp === "function" ? livePaginationCursorProp({
|
|
3475
|
+
array: state.originalDataArray,
|
|
3476
|
+
length: state.originalDataArray.length,
|
|
3477
|
+
lastItem: state.originalDataArray[state.originalDataArray.length - 1]
|
|
3478
|
+
}) : livePaginationCursorProp;
|
|
3479
|
+
return livePaginationCursor;
|
|
3480
|
+
}
|
|
3481
|
+
function mapPropsToState2(params) {
|
|
3482
|
+
const { props, state, oldState } = params;
|
|
3483
|
+
const controlledSort = isControlledValue(props.sortInfo);
|
|
3484
|
+
const result = {
|
|
3485
|
+
controlledSort,
|
|
3486
|
+
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3487
|
+
};
|
|
3488
|
+
if (props.livePagination) {
|
|
3489
|
+
const dataArrayChanged = !oldState || oldState.originalDataArray !== state.originalDataArray;
|
|
3490
|
+
const livePaginationCursor = typeof props.livePaginationCursor === "function" ? dataArrayChanged ? getLivePaginationCursorValue(props.livePaginationCursor, state) : state.livePaginationCursor : props.livePaginationCursor;
|
|
3491
|
+
result.livePaginationCursor = livePaginationCursor;
|
|
3492
|
+
}
|
|
3493
|
+
return result;
|
|
3494
|
+
}
|
|
3495
|
+
var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
|
|
3496
|
+
function onPropChange(params, props, actions) {
|
|
3497
|
+
const { name, newValue } = params;
|
|
3498
|
+
if (name === "data" && typeof newValue === "function" && !props.groupRowsState) {
|
|
3499
|
+
if (props.fullLazyLoad) {
|
|
3500
|
+
debugFullLazyLoad(`"data" function prop has changed`);
|
|
3501
|
+
}
|
|
3502
|
+
if (props.collapseGroupRowsOnDataFunctionChange !== false) {
|
|
3503
|
+
actions.groupRowsState = new GroupRowsState({
|
|
3504
|
+
collapsedRows: true,
|
|
3505
|
+
expandedRows: []
|
|
3506
|
+
});
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
var debugDataParams = dbg("DataSource:dataParams");
|
|
3511
|
+
function getInterceptActions() {
|
|
3512
|
+
return {
|
|
3513
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3514
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3515
|
+
sortInfo,
|
|
3516
|
+
livePaginationCursor: null
|
|
3517
|
+
});
|
|
3518
|
+
actions.dataParams = dataParams;
|
|
3519
|
+
if (state.livePagination) {
|
|
3520
|
+
requestAnimationFrame(() => {
|
|
3521
|
+
actions.livePaginationCursor = null;
|
|
3522
|
+
});
|
|
3523
|
+
}
|
|
3524
|
+
},
|
|
3525
|
+
groupBy: (groupBy, { actions, state }) => {
|
|
3526
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3527
|
+
groupBy,
|
|
3528
|
+
livePaginationCursor: null
|
|
3529
|
+
});
|
|
3530
|
+
actions.dataParams = dataParams;
|
|
3531
|
+
if (state.livePagination) {
|
|
3532
|
+
requestAnimationFrame(() => {
|
|
3533
|
+
actions.livePaginationCursor = null;
|
|
3534
|
+
});
|
|
3535
|
+
}
|
|
3536
|
+
},
|
|
3537
|
+
pivotBy: (pivotBy, { actions, state }) => {
|
|
3538
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3539
|
+
pivotBy,
|
|
3540
|
+
livePaginationCursor: null
|
|
3541
|
+
});
|
|
3542
|
+
actions.dataParams = dataParams;
|
|
3543
|
+
if (state.livePagination) {
|
|
3544
|
+
requestAnimationFrame(() => {
|
|
3545
|
+
actions.livePaginationCursor = null;
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
},
|
|
3549
|
+
cursorId: (cursorId, { actions, state }) => {
|
|
3550
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3551
|
+
cursorId
|
|
3552
|
+
});
|
|
3553
|
+
actions.dataParams = dataParams;
|
|
3554
|
+
},
|
|
3555
|
+
livePaginationCursor: (livePaginationCursor, { actions, state }) => {
|
|
3556
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3557
|
+
livePaginationCursor
|
|
3558
|
+
});
|
|
3559
|
+
actions.dataParams = dataParams;
|
|
3560
|
+
},
|
|
3561
|
+
dataParams: (dataParams, { state }) => {
|
|
3562
|
+
if (shallowEqualObjects(dataParams, state.dataParams, new Set([
|
|
3563
|
+
"changes",
|
|
3564
|
+
"originalDataArray"
|
|
3565
|
+
]))) {
|
|
3566
|
+
return false;
|
|
3567
|
+
}
|
|
3568
|
+
debugDataParams("onDataParamsChange triggered because the following values have changed", dataParams == null ? void 0 : dataParams.changes);
|
|
3569
|
+
return true;
|
|
3570
|
+
}
|
|
3270
3571
|
};
|
|
3271
3572
|
}
|
|
3272
3573
|
|
|
3273
3574
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3274
|
-
function
|
|
3575
|
+
function prepareColumn(column) {
|
|
3576
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3577
|
+
if (pivotByForColumn == null ? void 0 : pivotByForColumn.column) {
|
|
3578
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3579
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3580
|
+
} else {
|
|
3581
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
return column;
|
|
3585
|
+
}
|
|
3586
|
+
function prepareColumnGroup(columnGroup) {
|
|
3587
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3588
|
+
if (pivotByForColumnGroup == null ? void 0 : pivotByForColumnGroup.columnGroup) {
|
|
3589
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3590
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3591
|
+
} else {
|
|
3592
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
return columnGroup;
|
|
3596
|
+
}
|
|
3597
|
+
function getPivotColumnsAndColumnGroups({
|
|
3598
|
+
deepMap,
|
|
3599
|
+
pivotBy,
|
|
3600
|
+
pivotTotalColumnPosition,
|
|
3601
|
+
reducers = {},
|
|
3602
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3603
|
+
}) {
|
|
3275
3604
|
const pivotLength = pivotBy.length;
|
|
3605
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3606
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3607
|
+
});
|
|
3276
3608
|
const columns = new Map([
|
|
3277
3609
|
[
|
|
3278
3610
|
"labels",
|
|
3279
3611
|
{
|
|
3280
3612
|
header: "Row labels",
|
|
3613
|
+
pivotBy,
|
|
3281
3614
|
valueGetter: (params) => {
|
|
3282
3615
|
var _a;
|
|
3283
3616
|
const { rowInfo } = params;
|
|
3617
|
+
if (!rowInfo.data) {
|
|
3618
|
+
return "Loading ... TODO replace this with a loading indicator";
|
|
3619
|
+
}
|
|
3284
3620
|
return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
|
|
3285
3621
|
}
|
|
3286
3622
|
}
|
|
3287
3623
|
]
|
|
3288
3624
|
]);
|
|
3289
3625
|
const columnGroups = new Map();
|
|
3626
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3290
3627
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3291
3628
|
keys = [...keys];
|
|
3292
3629
|
if (pivotTotalColumnPosition === "end") {
|
|
3293
3630
|
next == null ? void 0 : next();
|
|
3294
3631
|
}
|
|
3295
3632
|
if (keys.length === pivotLength) {
|
|
3296
|
-
const parentKeys = keys.slice(0, -1);
|
|
3297
|
-
let columnGroupId = parentKeys.join("/");
|
|
3298
3633
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3299
|
-
let computedPivotColumn = __spreadValues({
|
|
3300
|
-
pivotBy,
|
|
3301
|
-
pivotColumn: true,
|
|
3302
|
-
pivotGroupKeys: keys,
|
|
3303
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3304
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3305
|
-
pivotByForColumn,
|
|
3306
|
-
sortable: false,
|
|
3307
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3308
|
-
header: keys[keys.length - 1],
|
|
3309
|
-
valueGetter: ({ rowInfo }) => {
|
|
3310
|
-
var _a, _b, _c;
|
|
3311
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3312
|
-
return value;
|
|
3313
|
-
}
|
|
3314
|
-
}, pivotByForColumn.column);
|
|
3315
|
-
if (pivotByForColumn.column) {
|
|
3316
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3317
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3318
|
-
} else {
|
|
3319
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3320
|
-
}
|
|
3321
|
-
}
|
|
3322
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3323
|
-
} else {
|
|
3324
|
-
const colGroupId = keys.join("/");
|
|
3325
3634
|
const parentKeys = keys.slice(0, -1);
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
columnGroup:
|
|
3334
|
-
|
|
3335
|
-
pivotTotalColumn: true,
|
|
3635
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3636
|
+
if (!isSingleAggregationColumn) {
|
|
3637
|
+
const columnGroupId = parentColumnGroupId;
|
|
3638
|
+
parentColumnGroupId = keys.join("/");
|
|
3639
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3640
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3641
|
+
header: pivotGroupKey,
|
|
3642
|
+
columnGroup: columnGroupId,
|
|
3643
|
+
pivotBy,
|
|
3336
3644
|
pivotGroupKeys: keys,
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3645
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3646
|
+
pivotIndex: keys.length - 1,
|
|
3647
|
+
pivotGroupKey
|
|
3648
|
+
}));
|
|
3649
|
+
}
|
|
3650
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3651
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.name || reducer.id;
|
|
3652
|
+
const computedPivotColumn = prepareColumn({
|
|
3340
3653
|
pivotBy,
|
|
3654
|
+
pivotColumn: true,
|
|
3655
|
+
pivotTotalColumn: false,
|
|
3656
|
+
pivotAggregator: reducer,
|
|
3657
|
+
pivotAggregatorIndex: index,
|
|
3658
|
+
pivotGroupKeys: keys,
|
|
3659
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3660
|
+
pivotIndex: keys.length - 1,
|
|
3661
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3341
3662
|
sortable: false,
|
|
3663
|
+
columnGroup: parentColumnGroupId,
|
|
3664
|
+
header,
|
|
3342
3665
|
valueGetter: ({ rowInfo }) => {
|
|
3343
|
-
var _a, _b
|
|
3344
|
-
|
|
3345
|
-
return value;
|
|
3346
|
-
}
|
|
3347
|
-
}, pivotByForColumn.column);
|
|
3348
|
-
if (pivotByForColumn.column) {
|
|
3349
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3350
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3351
|
-
} else {
|
|
3352
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3666
|
+
var _a, _b;
|
|
3667
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3353
3668
|
}
|
|
3669
|
+
});
|
|
3670
|
+
const columnId = `${reducer.id}:${keys.join("/")}`;
|
|
3671
|
+
columns.set(columnId, computedPivotColumn);
|
|
3672
|
+
});
|
|
3673
|
+
} else {
|
|
3674
|
+
const colGroupId = keys.join("/");
|
|
3675
|
+
const parentKeys = keys.slice(0, -1);
|
|
3676
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3677
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3678
|
+
header: keys[keys.length - 1],
|
|
3679
|
+
pivotBy,
|
|
3680
|
+
pivotGroupKeys: keys,
|
|
3681
|
+
pivotIndex: keys.length - 1,
|
|
3682
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3683
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3684
|
+
}));
|
|
3685
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3686
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3687
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3688
|
+
if (!isSingleAggregationColumn) {
|
|
3689
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3690
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3691
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3692
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3693
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3694
|
+
pivotBy,
|
|
3695
|
+
pivotTotalColumnGroup: true,
|
|
3696
|
+
pivotGroupKeys: keys,
|
|
3697
|
+
pivotIndex: keys.length - 1,
|
|
3698
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3699
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3700
|
+
}));
|
|
3354
3701
|
}
|
|
3355
|
-
|
|
3702
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3703
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.name || reducer.id} total`;
|
|
3704
|
+
const computedPivotColumn = prepareColumn({
|
|
3705
|
+
columnGroup: columnGroupId,
|
|
3706
|
+
header,
|
|
3707
|
+
pivotAggregator: reducer,
|
|
3708
|
+
pivotAggregatorIndex: index,
|
|
3709
|
+
pivotColumn: true,
|
|
3710
|
+
pivotTotalColumn: true,
|
|
3711
|
+
pivotGroupKeys: keys,
|
|
3712
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3713
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3714
|
+
pivotIndex: keys.length - 1,
|
|
3715
|
+
pivotBy,
|
|
3716
|
+
sortable: false,
|
|
3717
|
+
valueGetter: ({ rowInfo }) => {
|
|
3718
|
+
var _a, _b;
|
|
3719
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3720
|
+
}
|
|
3721
|
+
});
|
|
3722
|
+
columns.set(`total:${reducer.id}:${keys.join("/")}`, computedPivotColumn);
|
|
3723
|
+
});
|
|
3356
3724
|
}
|
|
3357
3725
|
}
|
|
3358
3726
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3360,12 +3728,22 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3360
3728
|
}
|
|
3361
3729
|
});
|
|
3362
3730
|
if (columns.size === 1) {
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3731
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3732
|
+
columns.set(`total:${reducer.id}`, prepareColumn({
|
|
3733
|
+
header: `${reducer.name || reducer.id} total`,
|
|
3734
|
+
pivotBy,
|
|
3735
|
+
pivotColumn: true,
|
|
3736
|
+
pivotTotalColumn: true,
|
|
3737
|
+
pivotAggregator: reducer,
|
|
3738
|
+
pivotAggregatorIndex: index,
|
|
3739
|
+
pivotGroupKeys: [],
|
|
3740
|
+
pivotGroupKey: "",
|
|
3741
|
+
pivotIndex: -1,
|
|
3742
|
+
valueGetter: ({ rowInfo }) => {
|
|
3743
|
+
var _a;
|
|
3744
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
3745
|
+
}
|
|
3746
|
+
}));
|
|
3369
3747
|
});
|
|
3370
3748
|
}
|
|
3371
3749
|
const result = {
|
|
@@ -3388,29 +3766,39 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3388
3766
|
return false;
|
|
3389
3767
|
};
|
|
3390
3768
|
function toRowInfo(data, id, index) {
|
|
3391
|
-
return {
|
|
3769
|
+
return {
|
|
3770
|
+
data,
|
|
3771
|
+
collapsed: true,
|
|
3772
|
+
id,
|
|
3773
|
+
indexInAll: index,
|
|
3774
|
+
indexInGroup: index,
|
|
3775
|
+
isGroupRow: false
|
|
3776
|
+
};
|
|
3392
3777
|
}
|
|
3393
3778
|
function concludeReducer(params) {
|
|
3394
3779
|
var _a;
|
|
3395
3780
|
const { state, previousState } = params;
|
|
3396
3781
|
const sortInfo = state.sortInfo;
|
|
3397
3782
|
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3398
|
-
const
|
|
3399
|
-
"originalDataArray"
|
|
3400
|
-
"sortInfo"
|
|
3783
|
+
const originalDataArrayChanged = haveDepsChanged(previousState, state, [
|
|
3784
|
+
"originalDataArray"
|
|
3401
3785
|
]);
|
|
3786
|
+
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
3787
|
+
const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
|
|
3402
3788
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3403
|
-
const groupBy = state.
|
|
3789
|
+
const groupBy = state.groupBy;
|
|
3404
3790
|
const pivotBy = state.pivotBy;
|
|
3405
3791
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3406
3792
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3407
3793
|
"generateGroupRows",
|
|
3408
3794
|
"originalDataArray",
|
|
3409
|
-
"
|
|
3795
|
+
"originalLazyGroupData",
|
|
3796
|
+
"groupBy",
|
|
3410
3797
|
"groupRowsState",
|
|
3411
3798
|
"pivotBy",
|
|
3412
3799
|
"aggregationReducers",
|
|
3413
3800
|
"pivotTotalColumnPosition",
|
|
3801
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3414
3802
|
"sortInfo"
|
|
3415
3803
|
]);
|
|
3416
3804
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3429,20 +3817,32 @@ function concludeReducer(params) {
|
|
|
3429
3817
|
};
|
|
3430
3818
|
if (shouldGroup) {
|
|
3431
3819
|
if (shouldGroupAgain) {
|
|
3432
|
-
const groupResult =
|
|
3820
|
+
const groupResult = state.fullLazyLoad ? lazyGroup({
|
|
3821
|
+
groupBy,
|
|
3822
|
+
pivot: pivotBy,
|
|
3823
|
+
mappings: state.pivotMappings,
|
|
3824
|
+
reducers: state.aggregationReducers
|
|
3825
|
+
}, state.originalLazyGroupData) : group({
|
|
3433
3826
|
groupBy,
|
|
3434
3827
|
pivot: pivotBy,
|
|
3435
3828
|
reducers: state.aggregationReducers
|
|
3436
3829
|
}, dataArray);
|
|
3437
3830
|
const flattenResult = enhancedFlatten({
|
|
3438
3831
|
groupResult,
|
|
3832
|
+
reducers: state.aggregationReducers,
|
|
3439
3833
|
toPrimaryKey,
|
|
3440
3834
|
groupRowsState: state.groupRowsState,
|
|
3441
3835
|
generateGroupRows: state.generateGroupRows
|
|
3442
3836
|
});
|
|
3443
3837
|
rowInfoDataArray = flattenResult.data;
|
|
3444
3838
|
state.groupDeepMap = groupResult.deepMap;
|
|
3445
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3839
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3840
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3841
|
+
pivotBy,
|
|
3842
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3843
|
+
reducers: state.aggregationReducers,
|
|
3844
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3845
|
+
}) : void 0;
|
|
3446
3846
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3447
3847
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3448
3848
|
} else {
|
|
@@ -3483,13 +3883,14 @@ function DataSourceWithContext(props) {
|
|
|
3483
3883
|
if (typeof children === "function") {
|
|
3484
3884
|
children = children(computedValues);
|
|
3485
3885
|
}
|
|
3486
|
-
return /* @__PURE__ */
|
|
3886
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children);
|
|
3487
3887
|
}
|
|
3488
3888
|
var DataSourceRoot = getComponentStateRoot({
|
|
3489
3889
|
initSetupState: initSetupState2,
|
|
3490
3890
|
forwardProps: forwardProps3,
|
|
3491
3891
|
concludeReducer,
|
|
3492
3892
|
mapPropsToState: mapPropsToState2,
|
|
3893
|
+
onPropChange,
|
|
3493
3894
|
interceptActions: getInterceptActions()
|
|
3494
3895
|
});
|
|
3495
3896
|
function DataSourceCmp({ children }) {
|
|
@@ -3505,14 +3906,14 @@ function DataSourceCmp({ children }) {
|
|
|
3505
3906
|
globalThis.getDataSourceState = getState;
|
|
3506
3907
|
}
|
|
3507
3908
|
useLoadData();
|
|
3508
|
-
return /* @__PURE__ */
|
|
3909
|
+
return /* @__PURE__ */ React8.createElement(DataSourceContext.Provider, {
|
|
3509
3910
|
value: contextValue
|
|
3510
|
-
}, /* @__PURE__ */
|
|
3911
|
+
}, /* @__PURE__ */ React8.createElement(DataSourceWithContext, {
|
|
3511
3912
|
children
|
|
3512
3913
|
}));
|
|
3513
3914
|
}
|
|
3514
3915
|
function DataSource(props) {
|
|
3515
|
-
return /* @__PURE__ */
|
|
3916
|
+
return /* @__PURE__ */ React8.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React8.createElement(DataSourceCmp, {
|
|
3516
3917
|
children: props.children
|
|
3517
3918
|
}));
|
|
3518
3919
|
}
|
|
@@ -3520,58 +3921,64 @@ function DataSource(props) {
|
|
|
3520
3921
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3521
3922
|
function useToggleGroupRow() {
|
|
3522
3923
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3523
|
-
const toggleGroupRow = (0,
|
|
3524
|
-
const
|
|
3924
|
+
const toggleGroupRow = (0, import_react16.useCallback)((groupKeys) => {
|
|
3925
|
+
const state = getDataSourceState();
|
|
3926
|
+
const newState = new GroupRowsState(state.groupRowsState);
|
|
3525
3927
|
newState.toggleGroupRow(groupKeys);
|
|
3526
3928
|
dataSourceActions.groupRowsState = newState;
|
|
3929
|
+
if (state.fullLazyLoad && newState.isGroupRowExpanded(groupKeys)) {
|
|
3930
|
+
loadData(state.data, state, dataSourceActions, {
|
|
3931
|
+
groupKeys
|
|
3932
|
+
});
|
|
3933
|
+
}
|
|
3527
3934
|
}, []);
|
|
3528
3935
|
return toggleGroupRow;
|
|
3529
3936
|
}
|
|
3530
3937
|
|
|
3531
3938
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3532
|
-
function
|
|
3533
|
-
const
|
|
3534
|
-
return
|
|
3535
|
-
acc.set(
|
|
3536
|
-
groupBy,
|
|
3939
|
+
function useGroupByMap(groupBy) {
|
|
3940
|
+
const groupByMap = (0, import_react17.useMemo)(() => {
|
|
3941
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3942
|
+
acc.set(groupBy2.field, {
|
|
3943
|
+
groupBy: groupBy2,
|
|
3537
3944
|
groupIndex: index
|
|
3538
3945
|
});
|
|
3539
3946
|
return acc;
|
|
3540
3947
|
}, new Map());
|
|
3541
|
-
}, [
|
|
3542
|
-
return
|
|
3948
|
+
}, [groupBy]);
|
|
3949
|
+
return groupByMap;
|
|
3543
3950
|
}
|
|
3544
3951
|
function useColumnsWhen() {
|
|
3545
3952
|
const {
|
|
3546
|
-
componentState: {
|
|
3953
|
+
componentState: { groupBy },
|
|
3547
3954
|
componentActions: dataSourceActions
|
|
3548
3955
|
} = useDataSourceContextValue();
|
|
3549
3956
|
const {
|
|
3550
3957
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3551
3958
|
} = useComponentState();
|
|
3552
|
-
const
|
|
3553
|
-
(0,
|
|
3959
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3960
|
+
(0, import_react17.useEffect)(() => {
|
|
3554
3961
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3555
3962
|
}, [groupRenderStrategy]);
|
|
3556
|
-
(0,
|
|
3963
|
+
(0, import_react17.useEffect)(() => {
|
|
3557
3964
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3558
3965
|
}, [pivotTotalColumnPosition]);
|
|
3559
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3966
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3560
3967
|
useColumnsWhenPivoting();
|
|
3561
3968
|
useColumnsWhenGrouping();
|
|
3562
|
-
useHideEmptyGroupColumns(
|
|
3969
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3563
3970
|
}
|
|
3564
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3971
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3565
3972
|
const toggleGroupRow = useToggleGroupRow();
|
|
3566
3973
|
const {
|
|
3567
3974
|
componentActions,
|
|
3568
3975
|
componentState: { columns, groupRenderStrategy }
|
|
3569
3976
|
} = useComponentState();
|
|
3570
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3977
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3571
3978
|
const computedColumns = new Map();
|
|
3572
3979
|
columns2.forEach((column, id) => {
|
|
3573
3980
|
let base = {};
|
|
3574
|
-
const groupByForColumn =
|
|
3981
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3575
3982
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3576
3983
|
const { groupIndex } = groupByForColumn;
|
|
3577
3984
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3616,9 +4023,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3616
4023
|
});
|
|
3617
4024
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3618
4025
|
}
|
|
3619
|
-
(0,
|
|
4026
|
+
(0, import_react17.useEffect)(() => {
|
|
3620
4027
|
const update = () => {
|
|
3621
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
4028
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3622
4029
|
};
|
|
3623
4030
|
update();
|
|
3624
4031
|
return interceptMap(columns, {
|
|
@@ -3626,11 +4033,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3626
4033
|
delete: update,
|
|
3627
4034
|
clear: update
|
|
3628
4035
|
});
|
|
3629
|
-
}, [columns,
|
|
4036
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3630
4037
|
}
|
|
3631
4038
|
function useColumnsWhenPivoting() {
|
|
3632
4039
|
const {
|
|
3633
|
-
componentState: {
|
|
4040
|
+
componentState: { groupBy, pivotBy }
|
|
3634
4041
|
} = useDataSourceContextValue();
|
|
3635
4042
|
const {
|
|
3636
4043
|
componentActions,
|
|
@@ -3642,13 +4049,13 @@ function useColumnsWhenPivoting() {
|
|
|
3642
4049
|
}
|
|
3643
4050
|
} = useComponentState();
|
|
3644
4051
|
const toggleGroupRow = useToggleGroupRow();
|
|
3645
|
-
(0,
|
|
4052
|
+
(0, import_react17.useEffect)(() => {
|
|
3646
4053
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3647
4054
|
pivotColumn,
|
|
3648
4055
|
pivotRowLabelsColumn,
|
|
3649
4056
|
pivotTotalColumnPosition,
|
|
3650
4057
|
pivotBy,
|
|
3651
|
-
|
|
4058
|
+
groupBy,
|
|
3652
4059
|
toggleGroupRow
|
|
3653
4060
|
});
|
|
3654
4061
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3656,14 +4063,14 @@ function useColumnsWhenPivoting() {
|
|
|
3656
4063
|
}
|
|
3657
4064
|
function useColumnsWhenGrouping() {
|
|
3658
4065
|
const {
|
|
3659
|
-
componentState: {
|
|
4066
|
+
componentState: { groupBy }
|
|
3660
4067
|
} = useDataSourceContextValue();
|
|
3661
4068
|
const {
|
|
3662
4069
|
componentActions,
|
|
3663
4070
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3664
4071
|
} = useComponentState();
|
|
3665
4072
|
const toggleGroupRow = useToggleGroupRow();
|
|
3666
|
-
(0,
|
|
4073
|
+
(0, import_react17.useEffect)(() => {
|
|
3667
4074
|
if (pivotColumns) {
|
|
3668
4075
|
return;
|
|
3669
4076
|
}
|
|
@@ -3672,7 +4079,7 @@ function useColumnsWhenGrouping() {
|
|
|
3672
4079
|
columns,
|
|
3673
4080
|
groupColumn,
|
|
3674
4081
|
groupRenderStrategy,
|
|
3675
|
-
|
|
4082
|
+
groupBy,
|
|
3676
4083
|
pivotColumns,
|
|
3677
4084
|
toggleGroupRow
|
|
3678
4085
|
});
|
|
@@ -3684,11 +4091,11 @@ function useColumnsWhenGrouping() {
|
|
|
3684
4091
|
delete: update,
|
|
3685
4092
|
clear: update
|
|
3686
4093
|
});
|
|
3687
|
-
}, [
|
|
4094
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3688
4095
|
}
|
|
3689
4096
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3690
4097
|
const {
|
|
3691
|
-
componentState: {
|
|
4098
|
+
componentState: { groupBy, groupRowsState },
|
|
3692
4099
|
getState: getDataSourceState
|
|
3693
4100
|
} = useDataSourceContextValue();
|
|
3694
4101
|
const {
|
|
@@ -3700,11 +4107,11 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3700
4107
|
groupRenderStrategy
|
|
3701
4108
|
}
|
|
3702
4109
|
} = useComponentState();
|
|
3703
|
-
(0,
|
|
3704
|
-
if (groupRenderStrategy
|
|
4110
|
+
(0, import_react17.useEffect)(() => {
|
|
4111
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3705
4112
|
return;
|
|
3706
4113
|
}
|
|
3707
|
-
const groupsLength =
|
|
4114
|
+
const groupsLength = groupBy.length;
|
|
3708
4115
|
let expandedGroupsLevel = 0;
|
|
3709
4116
|
const { dataArray } = getDataSourceState();
|
|
3710
4117
|
const len = dataArray.length;
|
|
@@ -3718,20 +4125,20 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3718
4125
|
const currentState = getComponentState();
|
|
3719
4126
|
const { computedColumns } = currentState;
|
|
3720
4127
|
let updated = false;
|
|
3721
|
-
const columnVisibility =
|
|
4128
|
+
const columnVisibility = __spreadValues({}, currentState.columnVisibility);
|
|
3722
4129
|
const cols = computedColumns;
|
|
3723
|
-
|
|
3724
|
-
const colId =
|
|
3725
|
-
|
|
4130
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
4131
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
4132
|
+
let col = cols.get(colId);
|
|
3726
4133
|
if (!col) {
|
|
3727
4134
|
return;
|
|
3728
4135
|
}
|
|
3729
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
4136
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3730
4137
|
updated = true;
|
|
3731
|
-
if (shouldBeHidden
|
|
3732
|
-
columnVisibility
|
|
4138
|
+
if (shouldBeHidden) {
|
|
4139
|
+
columnVisibility[colId] = false;
|
|
3733
4140
|
} else {
|
|
3734
|
-
columnVisibility
|
|
4141
|
+
delete columnVisibility[colId];
|
|
3735
4142
|
}
|
|
3736
4143
|
});
|
|
3737
4144
|
if (updated) {
|
|
@@ -3741,7 +4148,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3741
4148
|
getDataSourceState,
|
|
3742
4149
|
groupRenderStrategy,
|
|
3743
4150
|
generatedColumns,
|
|
3744
|
-
|
|
4151
|
+
groupBy,
|
|
3745
4152
|
groupRowsMap,
|
|
3746
4153
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3747
4154
|
hideEmptyGroupColumns
|
|
@@ -3750,7 +4157,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3750
4157
|
function getColumnsWhenGrouping(params) {
|
|
3751
4158
|
const {
|
|
3752
4159
|
pivotColumns,
|
|
3753
|
-
|
|
4160
|
+
groupBy,
|
|
3754
4161
|
groupColumn,
|
|
3755
4162
|
groupRenderStrategy,
|
|
3756
4163
|
toggleGroupRow,
|
|
@@ -3764,10 +4171,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
3764
4171
|
}
|
|
3765
4172
|
const computedColumns = new Map();
|
|
3766
4173
|
if (groupRenderStrategy === "multi-column") {
|
|
3767
|
-
|
|
4174
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3768
4175
|
const generatedGroupColumn = getColumnForGroupBy({
|
|
3769
4176
|
groupByForColumn,
|
|
3770
|
-
|
|
4177
|
+
groupBy,
|
|
3771
4178
|
groupIndexForColumn,
|
|
3772
4179
|
groupCount: arr.length,
|
|
3773
4180
|
groupRenderStrategy
|
|
@@ -3776,8 +4183,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
3776
4183
|
});
|
|
3777
4184
|
} else if (groupRenderStrategy === "single-column") {
|
|
3778
4185
|
const singleGroupColumn = getSingleGroupColumn({
|
|
3779
|
-
groupCount:
|
|
3780
|
-
|
|
4186
|
+
groupCount: groupBy.length,
|
|
4187
|
+
groupBy,
|
|
3781
4188
|
groupRenderStrategy
|
|
3782
4189
|
}, toggleGroupRow, groupColumn);
|
|
3783
4190
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
@@ -3794,7 +4201,8 @@ function useComputed() {
|
|
|
3794
4201
|
const { componentActions, componentState } = useComponentState();
|
|
3795
4202
|
const {
|
|
3796
4203
|
componentActions: dataSourceActions,
|
|
3797
|
-
componentState: dataSourceState
|
|
4204
|
+
componentState: dataSourceState,
|
|
4205
|
+
getState: getDataSourceState
|
|
3798
4206
|
} = useDataSourceContextValue();
|
|
3799
4207
|
const {
|
|
3800
4208
|
columnOrder,
|
|
@@ -3802,9 +4210,10 @@ function useComputed() {
|
|
|
3802
4210
|
columnPinning,
|
|
3803
4211
|
columnSizing,
|
|
3804
4212
|
columnTypes,
|
|
3805
|
-
bodySize
|
|
4213
|
+
bodySize,
|
|
4214
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3806
4215
|
} = componentState;
|
|
3807
|
-
(0,
|
|
4216
|
+
(0, import_react18.useState)(() => {
|
|
3808
4217
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3809
4218
|
if (rowHeight) {
|
|
3810
4219
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3816,15 +4225,17 @@ function useComputed() {
|
|
|
3816
4225
|
}
|
|
3817
4226
|
});
|
|
3818
4227
|
});
|
|
3819
|
-
|
|
4228
|
+
(0, import_react18.useEffect)(() => {
|
|
4229
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
4230
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3820
4231
|
const { multiSort } = dataSourceState;
|
|
3821
4232
|
useColumnGroups();
|
|
3822
4233
|
useColumnsWhen();
|
|
3823
|
-
const setSortInfo = (0,
|
|
4234
|
+
const setSortInfo = (0, import_react18.useCallback)((sortInfo) => {
|
|
3824
4235
|
var _a2;
|
|
3825
4236
|
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3826
4237
|
dataSourceActions.sortInfo = newSortInfo;
|
|
3827
|
-
}, []);
|
|
4238
|
+
}, [getDataSourceState]);
|
|
3828
4239
|
const columns = componentState.computedColumns;
|
|
3829
4240
|
const {
|
|
3830
4241
|
computedColumnOrder,
|
|
@@ -3911,7 +4322,7 @@ function useComputed() {
|
|
|
3911
4322
|
}
|
|
3912
4323
|
|
|
3913
4324
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3914
|
-
var
|
|
4325
|
+
var React9 = __toModule(require("react"));
|
|
3915
4326
|
|
|
3916
4327
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3917
4328
|
var useInternalProps = () => {
|
|
@@ -3919,9 +4330,9 @@ var useInternalProps = () => {
|
|
|
3919
4330
|
};
|
|
3920
4331
|
|
|
3921
4332
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3922
|
-
var InfiniteTableBody =
|
|
4333
|
+
var InfiniteTableBody = React9.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3923
4334
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
3924
|
-
return /* @__PURE__ */
|
|
4335
|
+
return /* @__PURE__ */ React9.createElement("div", __spreadProps(__spreadValues({
|
|
3925
4336
|
ref
|
|
3926
4337
|
}, props), {
|
|
3927
4338
|
className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
@@ -3929,16 +4340,16 @@ var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, re
|
|
|
3929
4340
|
});
|
|
3930
4341
|
|
|
3931
4342
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3932
|
-
var
|
|
4343
|
+
var React21 = __toModule(require("react"));
|
|
3933
4344
|
|
|
3934
4345
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3935
|
-
var
|
|
4346
|
+
var React10 = __toModule(require("react"));
|
|
3936
4347
|
function HorizontalScrollbarPlaceholderFn(props) {
|
|
3937
4348
|
const scrollbarWidth2 = getScrollbarWidth();
|
|
3938
4349
|
if (!scrollbarWidth2) {
|
|
3939
4350
|
return null;
|
|
3940
4351
|
}
|
|
3941
|
-
return /* @__PURE__ */
|
|
4352
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3942
4353
|
"data-name": "horizontal-scrollbar-placeholder",
|
|
3943
4354
|
style: __spreadValues({
|
|
3944
4355
|
position: "absolute",
|
|
@@ -3948,13 +4359,13 @@ function HorizontalScrollbarPlaceholderFn(props) {
|
|
|
3948
4359
|
}, props.style)
|
|
3949
4360
|
});
|
|
3950
4361
|
}
|
|
3951
|
-
var HorizontalScrollbarPlaceholder =
|
|
4362
|
+
var HorizontalScrollbarPlaceholder = React10.memo(HorizontalScrollbarPlaceholderFn);
|
|
3952
4363
|
function VerticalScrollbarPlaceholderFn(props) {
|
|
3953
4364
|
const scrollbarWidth2 = getScrollbarWidth();
|
|
3954
4365
|
if (!scrollbarWidth2) {
|
|
3955
4366
|
return null;
|
|
3956
4367
|
}
|
|
3957
|
-
return /* @__PURE__ */
|
|
4368
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3958
4369
|
"data-name": "vertical-scrollbar-placeholder",
|
|
3959
4370
|
style: __spreadValues({
|
|
3960
4371
|
position: "absolute",
|
|
@@ -3964,14 +4375,14 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3964
4375
|
}, props.style)
|
|
3965
4376
|
});
|
|
3966
4377
|
}
|
|
3967
|
-
var VerticalScrollbarPlaceholder =
|
|
4378
|
+
var VerticalScrollbarPlaceholder = React10.memo(VerticalScrollbarPlaceholderFn);
|
|
3968
4379
|
|
|
3969
4380
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3970
|
-
var
|
|
4381
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3971
4382
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3972
4383
|
var HeaderCellProxy = "_12zfob10";
|
|
3973
|
-
var HeaderCellRecipe = (0,
|
|
3974
|
-
var HeaderClsRecipe = (0,
|
|
4384
|
+
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"]] });
|
|
4385
|
+
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"]] });
|
|
3975
4386
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
3976
4387
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
3977
4388
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -3979,29 +4390,29 @@ var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
|
3979
4390
|
var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
3980
4391
|
|
|
3981
4392
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
3982
|
-
var
|
|
3983
|
-
var
|
|
4393
|
+
var React17 = __toModule(require("react"));
|
|
4394
|
+
var import_react26 = __toModule(require("react"));
|
|
3984
4395
|
|
|
3985
4396
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3986
|
-
var
|
|
3987
|
-
var
|
|
4397
|
+
var React13 = __toModule(require("react"));
|
|
4398
|
+
var import_react22 = __toModule(require("react"));
|
|
3988
4399
|
|
|
3989
4400
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3990
|
-
var
|
|
4401
|
+
var React11 = __toModule(require("react"));
|
|
3991
4402
|
|
|
3992
4403
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3993
|
-
var
|
|
4404
|
+
var import_react19 = __toModule(require("react"));
|
|
3994
4405
|
var useInfiniteTableState = () => {
|
|
3995
4406
|
const TableContext2 = getInfiniteTableContext();
|
|
3996
|
-
const { componentState } = (0,
|
|
4407
|
+
const { componentState } = (0, import_react19.useContext)(TableContext2);
|
|
3997
4408
|
return componentState;
|
|
3998
4409
|
};
|
|
3999
4410
|
|
|
4000
4411
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4001
|
-
var
|
|
4412
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4002
4413
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
4003
4414
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4004
|
-
var ColumnCellRecipe = (0,
|
|
4415
|
+
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"]] });
|
|
4005
4416
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
4006
4417
|
|
|
4007
4418
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -4046,20 +4457,20 @@ function InfiniteTableCellFn(props) {
|
|
|
4046
4457
|
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
4047
4458
|
}
|
|
4048
4459
|
}
|
|
4049
|
-
return /* @__PURE__ */
|
|
4460
|
+
return /* @__PURE__ */ React11.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
4050
4461
|
ref: domRef,
|
|
4051
4462
|
style,
|
|
4052
4463
|
"data-name": `Cell`,
|
|
4053
4464
|
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}` : "")
|
|
4054
|
-
}), beforeChildren, cssEllipsis ? /* @__PURE__ */
|
|
4465
|
+
}), beforeChildren, cssEllipsis ? /* @__PURE__ */ React11.createElement("div", {
|
|
4055
4466
|
className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
|
|
4056
4467
|
}, children) : children, afterChildren);
|
|
4057
4468
|
}
|
|
4058
|
-
var InfiniteTableCell =
|
|
4469
|
+
var InfiniteTableCell = React11.memo(InfiniteTableCellFn);
|
|
4059
4470
|
|
|
4060
4471
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4061
4472
|
var import_binary_search = __toModule(require_binary_search());
|
|
4062
|
-
var
|
|
4473
|
+
var import_react20 = __toModule(require("react"));
|
|
4063
4474
|
|
|
4064
4475
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4065
4476
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -4093,18 +4504,18 @@ var useColumnPointerEvents = ({
|
|
|
4093
4504
|
columns,
|
|
4094
4505
|
computedRemainingSpace
|
|
4095
4506
|
}) => {
|
|
4096
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
4097
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
4098
|
-
const breakpointsRef = (0,
|
|
4099
|
-
const pointerMoveRef = (0,
|
|
4100
|
-
const didDragRef = (0,
|
|
4101
|
-
const initialClientPos = (0,
|
|
4102
|
-
const currentDropIndexRef = (0,
|
|
4507
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react20.useState)(null);
|
|
4508
|
+
const [proxyOffset, setProxyOffset] = (0, import_react20.useState)(null);
|
|
4509
|
+
const breakpointsRef = (0, import_react20.useRef)([]);
|
|
4510
|
+
const pointerMoveRef = (0, import_react20.useRef)(null);
|
|
4511
|
+
const didDragRef = (0, import_react20.useRef)(false);
|
|
4512
|
+
const initialClientPos = (0, import_react20.useRef)(null);
|
|
4513
|
+
const currentDropIndexRef = (0, import_react20.useRef)(null);
|
|
4103
4514
|
const dragging = draggingDiff != null;
|
|
4104
4515
|
const { componentActions, computed } = useInfiniteTable();
|
|
4105
4516
|
const { computedColumnOrder } = computed;
|
|
4106
|
-
const column = (0,
|
|
4107
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
4517
|
+
const column = (0, import_react20.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
4518
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react20.useMemo)(() => {
|
|
4108
4519
|
const columnsArray2 = Array.from(columns.values());
|
|
4109
4520
|
return {
|
|
4110
4521
|
columnsArray: columnsArray2,
|
|
@@ -4112,8 +4523,8 @@ var useColumnPointerEvents = ({
|
|
|
4112
4523
|
columnWidth: column.computedWidth
|
|
4113
4524
|
};
|
|
4114
4525
|
}, [columns, columnId, column]);
|
|
4115
|
-
let cursorRef = (0,
|
|
4116
|
-
const onPointerDown = (0,
|
|
4526
|
+
let cursorRef = (0, import_react20.useRef)("auto");
|
|
4527
|
+
const onPointerDown = (0, import_react20.useCallback)((e) => {
|
|
4117
4528
|
const target = domRef.current;
|
|
4118
4529
|
cursorRef.current = target.style.cursor;
|
|
4119
4530
|
didDragRef.current = false;
|
|
@@ -4176,7 +4587,7 @@ var useColumnPointerEvents = ({
|
|
|
4176
4587
|
target.addEventListener("pointermove", onPointerMove);
|
|
4177
4588
|
target.setPointerCapture(e.pointerId);
|
|
4178
4589
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
4179
|
-
const onPointerUp = (0,
|
|
4590
|
+
const onPointerUp = (0, import_react20.useCallback)((e) => {
|
|
4180
4591
|
const target = domRef.current;
|
|
4181
4592
|
target.style.cursor = cursorRef.current;
|
|
4182
4593
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -4250,8 +4661,8 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4250
4661
|
var import_react_dom = __toModule(require("react-dom"));
|
|
4251
4662
|
|
|
4252
4663
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4253
|
-
var
|
|
4254
|
-
var
|
|
4664
|
+
var React12 = __toModule(require("react"));
|
|
4665
|
+
var import_react21 = __toModule(require("react"));
|
|
4255
4666
|
var defaultLineStyle = {
|
|
4256
4667
|
marginTop: 2,
|
|
4257
4668
|
marginBottom: 2,
|
|
@@ -4259,8 +4670,8 @@ var defaultLineStyle = {
|
|
|
4259
4670
|
};
|
|
4260
4671
|
function SortIcon(props) {
|
|
4261
4672
|
var _a;
|
|
4262
|
-
const [rendered, setRendered] = (0,
|
|
4263
|
-
const [opacity, setOpacity] = (0,
|
|
4673
|
+
const [rendered, setRendered] = (0, import_react21.useState)(true);
|
|
4674
|
+
const [opacity, setOpacity] = (0, import_react21.useState)(0);
|
|
4264
4675
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4265
4676
|
const showIndex = index != null && index > 0;
|
|
4266
4677
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4274,7 +4685,7 @@ function SortIcon(props) {
|
|
|
4274
4685
|
}), props.lineStyle), {
|
|
4275
4686
|
opacity
|
|
4276
4687
|
});
|
|
4277
|
-
(0,
|
|
4688
|
+
(0, import_react21.useEffect)(() => {
|
|
4278
4689
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4279
4690
|
if (!rendered && newOpacity) {
|
|
4280
4691
|
setRendered(true);
|
|
@@ -4304,18 +4715,18 @@ function SortIcon(props) {
|
|
|
4304
4715
|
if (direction === -1) {
|
|
4305
4716
|
indexStyle.top = "100%";
|
|
4306
4717
|
}
|
|
4307
|
-
return /* @__PURE__ */
|
|
4718
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
4308
4719
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
4309
4720
|
className: join(className, "ITableIcon", "ITableIcon-sort")
|
|
4310
|
-
}, showIndex ? /* @__PURE__ */
|
|
4721
|
+
}, showIndex ? /* @__PURE__ */ React12.createElement("div", {
|
|
4311
4722
|
"data-name": "index",
|
|
4312
4723
|
style: indexStyle
|
|
4313
|
-
}, index) : null, /* @__PURE__ */
|
|
4724
|
+
}, index) : null, /* @__PURE__ */ React12.createElement("div", {
|
|
4314
4725
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
4315
4726
|
onTransitionEnd
|
|
4316
|
-
}), /* @__PURE__ */
|
|
4727
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
4317
4728
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
4318
|
-
}), /* @__PURE__ */
|
|
4729
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
4319
4730
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
4320
4731
|
}));
|
|
4321
4732
|
}
|
|
@@ -4346,13 +4757,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4346
4757
|
});
|
|
4347
4758
|
}
|
|
4348
4759
|
header = header != null ? header : column.name;
|
|
4349
|
-
const sortTool = /* @__PURE__ */
|
|
4760
|
+
const sortTool = /* @__PURE__ */ React13.createElement(SortIcon, {
|
|
4350
4761
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4351
4762
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4352
4763
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4353
4764
|
});
|
|
4354
|
-
const domRef = (0,
|
|
4355
|
-
const ref = (0,
|
|
4765
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
4766
|
+
const ref = (0, import_react22.useCallback)((node) => {
|
|
4356
4767
|
var _a2;
|
|
4357
4768
|
domRef.current = node;
|
|
4358
4769
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
@@ -4361,7 +4772,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4361
4772
|
computed: { computedRemainingSpace },
|
|
4362
4773
|
componentState: { portalDOMRef }
|
|
4363
4774
|
} = useInfiniteTable();
|
|
4364
|
-
(0,
|
|
4775
|
+
(0, import_react22.useEffect)(() => {
|
|
4365
4776
|
let clearOnResize = null;
|
|
4366
4777
|
const node = domRef.current;
|
|
4367
4778
|
if (onResize && node) {
|
|
@@ -4384,7 +4795,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4384
4795
|
let offset = offsetFromProps != null ? offsetFromProps : virtualized ? 0 : column.computedPinningOffset;
|
|
4385
4796
|
let draggingProxy = null;
|
|
4386
4797
|
if (dragging) {
|
|
4387
|
-
draggingProxy = /* @__PURE__ */
|
|
4798
|
+
draggingProxy = /* @__PURE__ */ React13.createElement("div", {
|
|
4388
4799
|
className: `${baseCls}Proxy ${HeaderCellProxy}`,
|
|
4389
4800
|
style: {
|
|
4390
4801
|
position: "absolute",
|
|
@@ -4397,7 +4808,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4397
4808
|
}, header);
|
|
4398
4809
|
draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
|
|
4399
4810
|
}
|
|
4400
|
-
return /* @__PURE__ */
|
|
4811
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(InfiniteTableCell, {
|
|
4401
4812
|
domRef: ref,
|
|
4402
4813
|
column,
|
|
4403
4814
|
"data-name": `HeaderCell`,
|
|
@@ -4413,29 +4824,29 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4413
4824
|
}
|
|
4414
4825
|
|
|
4415
4826
|
// src/components/RawList/index.tsx
|
|
4416
|
-
var
|
|
4417
|
-
var
|
|
4827
|
+
var React16 = __toModule(require("react"));
|
|
4828
|
+
var import_react25 = __toModule(require("react"));
|
|
4418
4829
|
|
|
4419
4830
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4420
|
-
var
|
|
4421
|
-
var
|
|
4831
|
+
var React14 = __toModule(require("react"));
|
|
4832
|
+
var import_react23 = __toModule(require("react"));
|
|
4422
4833
|
function AvoidReactDiffFn(props) {
|
|
4423
|
-
const [children, setChildren] = (0,
|
|
4424
|
-
(0,
|
|
4834
|
+
const [children, setChildren] = (0, import_react23.useState)(props.updater.get());
|
|
4835
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
4425
4836
|
const remove = props.updater.onChange((children2) => {
|
|
4426
4837
|
setChildren(children2);
|
|
4427
4838
|
});
|
|
4428
4839
|
return remove;
|
|
4429
4840
|
}, [props.updater]);
|
|
4430
|
-
return /* @__PURE__ */
|
|
4841
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, children);
|
|
4431
4842
|
}
|
|
4432
|
-
var AvoidReactDiff =
|
|
4843
|
+
var AvoidReactDiff = React14.memo(AvoidReactDiffFn);
|
|
4433
4844
|
|
|
4434
4845
|
// src/components/RawList/useVirtualRenderer.ts
|
|
4435
|
-
var
|
|
4846
|
+
var import_react24 = __toModule(require("react"));
|
|
4436
4847
|
|
|
4437
4848
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4438
|
-
var
|
|
4849
|
+
var React15 = __toModule(require("react"));
|
|
4439
4850
|
|
|
4440
4851
|
// src/components/RawList/MappedItems.ts
|
|
4441
4852
|
var MappedItems = class extends Logger {
|
|
@@ -4680,7 +5091,7 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4680
5091
|
};
|
|
4681
5092
|
this.itemDOMRefs[elementIndex] = domRef;
|
|
4682
5093
|
this.updaters[elementIndex] = buildSubscriptionCallback();
|
|
4683
|
-
const item = /* @__PURE__ */
|
|
5094
|
+
const item = /* @__PURE__ */ React15.createElement(AvoidReactDiff, {
|
|
4684
5095
|
key: elementIndex,
|
|
4685
5096
|
name: `${elementIndex}`,
|
|
4686
5097
|
updater: this.updaters[elementIndex]
|
|
@@ -4746,7 +5157,7 @@ function createRenderer(brain) {
|
|
|
4746
5157
|
function useVirtualRenderer({
|
|
4747
5158
|
brain
|
|
4748
5159
|
}) {
|
|
4749
|
-
return (0,
|
|
5160
|
+
return (0, import_react24.useMemo)(() => {
|
|
4750
5161
|
return createRenderer(brain);
|
|
4751
5162
|
}, [brain]);
|
|
4752
5163
|
}
|
|
@@ -4759,7 +5170,7 @@ function RawListFn(props) {
|
|
|
4759
5170
|
debugChannel
|
|
4760
5171
|
});
|
|
4761
5172
|
const getRenderItem = useLatest(renderItem);
|
|
4762
|
-
(0,
|
|
5173
|
+
(0, import_react25.useEffect)(() => {
|
|
4763
5174
|
const renderRange = brain.getRenderRange();
|
|
4764
5175
|
renderer.renderRange(renderRange, {
|
|
4765
5176
|
renderItem,
|
|
@@ -4767,7 +5178,7 @@ function RawListFn(props) {
|
|
|
4767
5178
|
onRender: onRenderUpdater
|
|
4768
5179
|
});
|
|
4769
5180
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4770
|
-
(0,
|
|
5181
|
+
(0, import_react25.useEffect)(() => {
|
|
4771
5182
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4772
5183
|
renderer.renderRange(renderRange, {
|
|
4773
5184
|
force: false,
|
|
@@ -4777,11 +5188,11 @@ function RawListFn(props) {
|
|
|
4777
5188
|
});
|
|
4778
5189
|
return remove;
|
|
4779
5190
|
}, [brain, onRenderUpdater]);
|
|
4780
|
-
return /* @__PURE__ */
|
|
5191
|
+
return /* @__PURE__ */ React16.createElement(AvoidReactDiff, {
|
|
4781
5192
|
updater: onRenderUpdater
|
|
4782
5193
|
});
|
|
4783
5194
|
}
|
|
4784
|
-
var RawList =
|
|
5195
|
+
var RawList = React16.memo(RawListFn);
|
|
4785
5196
|
|
|
4786
5197
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4787
5198
|
var debug3 = dbg("Header");
|
|
@@ -4794,7 +5205,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4794
5205
|
componentState: { headerHeight }
|
|
4795
5206
|
} = useInfiniteTable();
|
|
4796
5207
|
const { computedVisibleColumnsMap } = computed;
|
|
4797
|
-
const renderColumn = (0,
|
|
5208
|
+
const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
4798
5209
|
const column = columns[columnIndex];
|
|
4799
5210
|
if (!column) {
|
|
4800
5211
|
if (true) {
|
|
@@ -4802,21 +5213,21 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4802
5213
|
}
|
|
4803
5214
|
return null;
|
|
4804
5215
|
}
|
|
4805
|
-
return /* @__PURE__ */
|
|
5216
|
+
return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderCell, {
|
|
4806
5217
|
domRef: domRef2,
|
|
4807
5218
|
column,
|
|
4808
5219
|
headerHeight,
|
|
4809
5220
|
columns: computedVisibleColumnsMap
|
|
4810
5221
|
});
|
|
4811
5222
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4812
|
-
(0,
|
|
5223
|
+
(0, import_react26.useEffect)(() => {
|
|
4813
5224
|
const onScroll = (scrollPosition) => {
|
|
4814
5225
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4815
5226
|
};
|
|
4816
5227
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4817
5228
|
return removeOnScroll;
|
|
4818
5229
|
}, [brain]);
|
|
4819
|
-
const domRef = (0,
|
|
5230
|
+
const domRef = (0, import_react26.useRef)(null);
|
|
4820
5231
|
const headerCls = HeaderClsRecipe({
|
|
4821
5232
|
pinned: pinning,
|
|
4822
5233
|
overflow: false,
|
|
@@ -4827,18 +5238,18 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4827
5238
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4828
5239
|
style
|
|
4829
5240
|
};
|
|
4830
|
-
return /* @__PURE__ */
|
|
5241
|
+
return /* @__PURE__ */ React17.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React17.createElement(RawList, {
|
|
4831
5242
|
brain,
|
|
4832
5243
|
renderItem: renderColumn
|
|
4833
5244
|
}));
|
|
4834
5245
|
}
|
|
4835
|
-
var InfiniteTableHeader =
|
|
5246
|
+
var InfiniteTableHeader = React17.memo(InfiniteTableHeaderFn);
|
|
4836
5247
|
|
|
4837
5248
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4838
|
-
var
|
|
5249
|
+
var React20 = __toModule(require("react"));
|
|
4839
5250
|
|
|
4840
5251
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
4841
|
-
var
|
|
5252
|
+
var React19 = __toModule(require("react"));
|
|
4842
5253
|
|
|
4843
5254
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4844
5255
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
@@ -4928,7 +5339,7 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4928
5339
|
}
|
|
4929
5340
|
|
|
4930
5341
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4931
|
-
var
|
|
5342
|
+
var React18 = __toModule(require("react"));
|
|
4932
5343
|
var TableHeaderGroupClassName = `${rootClassName}HeaderGroup`;
|
|
4933
5344
|
function InfiniteTableHeaderGroup(props) {
|
|
4934
5345
|
const { columnGroup, height, headerHeight } = props;
|
|
@@ -4942,16 +5353,16 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4942
5353
|
width: columnGroup.computedWidth,
|
|
4943
5354
|
height
|
|
4944
5355
|
};
|
|
4945
|
-
return /* @__PURE__ */
|
|
5356
|
+
return /* @__PURE__ */ React18.createElement("div", {
|
|
4946
5357
|
"data-group-id": columnGroup.id,
|
|
4947
5358
|
className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
|
|
4948
5359
|
style
|
|
4949
|
-
}, /* @__PURE__ */
|
|
5360
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
4950
5361
|
className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
|
|
4951
5362
|
style: { height: headerHeight }
|
|
4952
|
-
}, /* @__PURE__ */
|
|
5363
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
4953
5364
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4954
|
-
}, header)), /* @__PURE__ */
|
|
5365
|
+
}, header)), /* @__PURE__ */ React18.createElement("div", {
|
|
4955
5366
|
className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
|
|
4956
5367
|
}, props.children));
|
|
4957
5368
|
}
|
|
@@ -4974,7 +5385,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4974
5385
|
return items2.map((colGroupItem) => {
|
|
4975
5386
|
if (colGroupItem.type === "column") {
|
|
4976
5387
|
const col = colGroupItem.ref;
|
|
4977
|
-
return /* @__PURE__ */
|
|
5388
|
+
return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderCell, {
|
|
4978
5389
|
key: col.id,
|
|
4979
5390
|
headerHeight: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
|
|
4980
5391
|
column: col,
|
|
@@ -4988,7 +5399,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
4988
5399
|
colIds.push(col.id);
|
|
4989
5400
|
return col;
|
|
4990
5401
|
});
|
|
4991
|
-
return /* @__PURE__ */
|
|
5402
|
+
return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderGroup, {
|
|
4992
5403
|
key: `${colGroupItem.uniqueGroupId.join("/")}`,
|
|
4993
5404
|
columns: columns2,
|
|
4994
5405
|
height: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
|
|
@@ -5008,7 +5419,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
5008
5419
|
}
|
|
5009
5420
|
|
|
5010
5421
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
5011
|
-
var
|
|
5422
|
+
var import_react27 = __toModule(require("react"));
|
|
5012
5423
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
5013
5424
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
5014
5425
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -5041,9 +5452,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5041
5452
|
},
|
|
5042
5453
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
5043
5454
|
} = useInfiniteTable();
|
|
5044
|
-
const domRef =
|
|
5455
|
+
const domRef = React20.useRef(null);
|
|
5045
5456
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
5046
|
-
const columnHeaderGroups =
|
|
5457
|
+
const columnHeaderGroups = React20.useMemo(() => {
|
|
5047
5458
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
5048
5459
|
columnGroups: computedColumnGroups,
|
|
5049
5460
|
columnGroupsDepthsMap,
|
|
@@ -5062,7 +5473,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5062
5473
|
columnGroupsMaxDepth
|
|
5063
5474
|
]);
|
|
5064
5475
|
const children = hasColumnGroups ? columnHeaderGroups : columns.map((c) => {
|
|
5065
|
-
return /* @__PURE__ */
|
|
5476
|
+
return /* @__PURE__ */ React20.createElement(InfiniteTableHeaderCell, {
|
|
5066
5477
|
key: c.id,
|
|
5067
5478
|
headerHeight,
|
|
5068
5479
|
column: c,
|
|
@@ -5074,7 +5485,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5074
5485
|
if (totalWidth != null) {
|
|
5075
5486
|
style.width = availableWidth;
|
|
5076
5487
|
}
|
|
5077
|
-
(0,
|
|
5488
|
+
(0, import_react27.useEffect)(() => {
|
|
5078
5489
|
const scroller = brain || scrollListener;
|
|
5079
5490
|
if (!scroller || !scrollable) {
|
|
5080
5491
|
return;
|
|
@@ -5085,20 +5496,20 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5085
5496
|
const removeOnScroll = scroller.onScroll(onScroll);
|
|
5086
5497
|
return removeOnScroll;
|
|
5087
5498
|
}, [brain, scrollListener]);
|
|
5088
|
-
return /* @__PURE__ */
|
|
5499
|
+
return /* @__PURE__ */ React20.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5089
5500
|
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
|
|
5090
5501
|
pinned: pinning,
|
|
5091
5502
|
virtualized: false,
|
|
5092
5503
|
overflow: scrollable
|
|
5093
5504
|
})),
|
|
5094
5505
|
style
|
|
5095
|
-
}), /* @__PURE__ */
|
|
5506
|
+
}), /* @__PURE__ */ React20.createElement("div", {
|
|
5096
5507
|
style: { width: totalWidth },
|
|
5097
5508
|
className: join(flexFlow.row, display.flex),
|
|
5098
5509
|
ref: domRef
|
|
5099
5510
|
}, children));
|
|
5100
5511
|
}
|
|
5101
|
-
var InfiniteTableHeaderUnvirtualized =
|
|
5512
|
+
var InfiniteTableHeaderUnvirtualized = React20.memo(InfiniteTableHeaderUnvirtualizedFn);
|
|
5102
5513
|
|
|
5103
5514
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
5104
5515
|
function TableHeaderWrapper(props) {
|
|
@@ -5128,7 +5539,10 @@ function TableHeaderWrapper(props) {
|
|
|
5128
5539
|
const hasPinnedStart = computedPinnedStartColumns.length > 0;
|
|
5129
5540
|
const hasPinnedEnd = computedPinnedEndColumns.length > 0;
|
|
5130
5541
|
const height = columnGroupsMaxDepth ? columnGroupsMaxDepth * headerHeight : headerHeight;
|
|
5131
|
-
const
|
|
5542
|
+
const unvirtualizedStyle = !virtualizeHeader && computedPinnedStartColumnsWidth ? {
|
|
5543
|
+
left: computedPinnedStartWidth
|
|
5544
|
+
} : void 0;
|
|
5545
|
+
const header = virtualizeHeader ? /* @__PURE__ */ React21.createElement(InfiniteTableHeader, {
|
|
5132
5546
|
columns: computedUnpinnedColumns,
|
|
5133
5547
|
repaintId: virtualizeHeader ? repaintId : void 0,
|
|
5134
5548
|
brain,
|
|
@@ -5141,7 +5555,8 @@ function TableHeaderWrapper(props) {
|
|
|
5141
5555
|
},
|
|
5142
5556
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5143
5557
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5144
|
-
}) : /* @__PURE__ */
|
|
5558
|
+
}) : /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5559
|
+
style: unvirtualizedStyle,
|
|
5145
5560
|
brain,
|
|
5146
5561
|
scrollable: true,
|
|
5147
5562
|
pinning: false,
|
|
@@ -5149,12 +5564,12 @@ function TableHeaderWrapper(props) {
|
|
|
5149
5564
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5150
5565
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5151
5566
|
});
|
|
5152
|
-
return /* @__PURE__ */
|
|
5567
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
5153
5568
|
className: HeaderWrapperCls,
|
|
5154
5569
|
style: {
|
|
5155
5570
|
height: virtualizeHeader ? height : void 0
|
|
5156
5571
|
}
|
|
5157
|
-
}, hasPinnedStart ? /* @__PURE__ */
|
|
5572
|
+
}, hasPinnedStart ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5158
5573
|
style: {
|
|
5159
5574
|
left: 0,
|
|
5160
5575
|
position: "absolute",
|
|
@@ -5166,7 +5581,7 @@ function TableHeaderWrapper(props) {
|
|
|
5166
5581
|
scrollable: computedPinnedStartOverflow,
|
|
5167
5582
|
pinning: "start",
|
|
5168
5583
|
scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
|
|
5169
|
-
}) : null, header, hasPinnedEnd ? /* @__PURE__ */
|
|
5584
|
+
}) : null, header, hasPinnedEnd ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5170
5585
|
style: {
|
|
5171
5586
|
right: scrollbars.vertical ? getScrollbarWidth() : 0,
|
|
5172
5587
|
position: "absolute",
|
|
@@ -5178,7 +5593,7 @@ function TableHeaderWrapper(props) {
|
|
|
5178
5593
|
scrollable: computedPinnedEndOverflow,
|
|
5179
5594
|
pinning: "end",
|
|
5180
5595
|
scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
|
|
5181
|
-
}) : null, scrollbars.vertical ? /* @__PURE__ */
|
|
5596
|
+
}) : null, scrollbars.vertical ? /* @__PURE__ */ React21.createElement(VerticalScrollbarPlaceholder, {
|
|
5182
5597
|
style: {
|
|
5183
5598
|
height: "100%",
|
|
5184
5599
|
right: 0
|
|
@@ -5187,13 +5602,13 @@ function TableHeaderWrapper(props) {
|
|
|
5187
5602
|
}
|
|
5188
5603
|
|
|
5189
5604
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5190
|
-
var
|
|
5191
|
-
var
|
|
5605
|
+
var React22 = __toModule(require("react"));
|
|
5606
|
+
var import_react29 = __toModule(require("react"));
|
|
5192
5607
|
|
|
5193
5608
|
// src/components/hooks/useOnScroll.ts
|
|
5194
|
-
var
|
|
5609
|
+
var import_react28 = __toModule(require("react"));
|
|
5195
5610
|
var useOnScroll = (domRef, onScroll) => {
|
|
5196
|
-
(0,
|
|
5611
|
+
(0, import_react28.useEffect)(() => {
|
|
5197
5612
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5198
5613
|
const scrollFn = (event) => {
|
|
5199
5614
|
const node = event.target;
|
|
@@ -5231,7 +5646,7 @@ var getScrollableClassName = (scrollable) => {
|
|
|
5231
5646
|
|
|
5232
5647
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5233
5648
|
var rootClassName6 = "InfiniteVirtualScrollContainer";
|
|
5234
|
-
var VirtualScrollContainer =
|
|
5649
|
+
var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2(props, ref) {
|
|
5235
5650
|
const {
|
|
5236
5651
|
children,
|
|
5237
5652
|
scrollable = true,
|
|
@@ -5239,9 +5654,9 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5239
5654
|
className,
|
|
5240
5655
|
style
|
|
5241
5656
|
} = props;
|
|
5242
|
-
const domRef = ref != null ? ref : (0,
|
|
5657
|
+
const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
|
|
5243
5658
|
useOnScroll(domRef, onContainerScroll);
|
|
5244
|
-
return /* @__PURE__ */
|
|
5659
|
+
return /* @__PURE__ */ React22.createElement("div", {
|
|
5245
5660
|
ref: domRef,
|
|
5246
5661
|
style,
|
|
5247
5662
|
className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
|
|
@@ -5249,7 +5664,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5249
5664
|
});
|
|
5250
5665
|
|
|
5251
5666
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
5252
|
-
var
|
|
5667
|
+
var React23 = __toModule(require("react"));
|
|
5253
5668
|
function SpacePlaceholderFn(props) {
|
|
5254
5669
|
const { height, width, count } = props;
|
|
5255
5670
|
const style = {
|
|
@@ -5259,7 +5674,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5259
5674
|
opacity: 0,
|
|
5260
5675
|
pointerEvents: "none"
|
|
5261
5676
|
};
|
|
5262
|
-
return /* @__PURE__ */
|
|
5677
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
5263
5678
|
"data-count": count,
|
|
5264
5679
|
"data-placeholder-width": true ? width : void 0,
|
|
5265
5680
|
"data-placeholder-height": true ? height : void 0,
|
|
@@ -5267,24 +5682,24 @@ function SpacePlaceholderFn(props) {
|
|
|
5267
5682
|
style
|
|
5268
5683
|
});
|
|
5269
5684
|
}
|
|
5270
|
-
var SpacePlaceholder =
|
|
5685
|
+
var SpacePlaceholder = React23.memo(SpacePlaceholderFn);
|
|
5271
5686
|
|
|
5272
5687
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5273
|
-
var
|
|
5688
|
+
var import_react41 = __toModule(require("react"));
|
|
5274
5689
|
|
|
5275
5690
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5276
|
-
var
|
|
5277
|
-
var
|
|
5691
|
+
var React29 = __toModule(require("react"));
|
|
5692
|
+
var import_react33 = __toModule(require("react"));
|
|
5278
5693
|
|
|
5279
5694
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5280
|
-
var
|
|
5695
|
+
var React25 = __toModule(require("react"));
|
|
5281
5696
|
|
|
5282
5697
|
// src/components/VirtualList/VirtualList.tsx
|
|
5283
|
-
var
|
|
5284
|
-
var
|
|
5698
|
+
var React24 = __toModule(require("react"));
|
|
5699
|
+
var import_react30 = __toModule(require("react"));
|
|
5285
5700
|
|
|
5286
5701
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5287
|
-
var VirtualListCls = "
|
|
5702
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5288
5703
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5289
5704
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5290
5705
|
|
|
@@ -5324,11 +5739,11 @@ var VirtualList = (props) => {
|
|
|
5324
5739
|
"onContainerScroll",
|
|
5325
5740
|
"children"
|
|
5326
5741
|
]);
|
|
5327
|
-
const domRef = (0,
|
|
5742
|
+
const domRef = (0, import_react30.useRef)(null);
|
|
5328
5743
|
const [, rerender] = useRerender();
|
|
5329
|
-
const [totalSize, setTotalSize] = (0,
|
|
5330
|
-
const renderCountRef = (0,
|
|
5331
|
-
(0,
|
|
5744
|
+
const [totalSize, setTotalSize] = (0, import_react30.useState)(0);
|
|
5745
|
+
const renderCountRef = (0, import_react30.useRef)(0);
|
|
5746
|
+
(0, import_react30.useEffect)(() => {
|
|
5332
5747
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5333
5748
|
renderCountRef.current = renderCount;
|
|
5334
5749
|
if (true) {
|
|
@@ -5347,7 +5762,7 @@ var VirtualList = (props) => {
|
|
|
5347
5762
|
removeOnTotalSizeChange();
|
|
5348
5763
|
};
|
|
5349
5764
|
}, [virtualBrain]);
|
|
5350
|
-
(0,
|
|
5765
|
+
(0, import_react30.useEffect)(() => {
|
|
5351
5766
|
const onScroll = (scrollPosition) => {
|
|
5352
5767
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5353
5768
|
};
|
|
@@ -5362,19 +5777,19 @@ var VirtualList = (props) => {
|
|
|
5362
5777
|
if (true) {
|
|
5363
5778
|
domProps["data-cmp-name"] = `VirtualList`;
|
|
5364
5779
|
}
|
|
5365
|
-
return /* @__PURE__ */
|
|
5780
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React24.createElement(VirtualScrollContainer, {
|
|
5366
5781
|
scrollable,
|
|
5367
5782
|
onContainerScroll
|
|
5368
|
-
}, /* @__PURE__ */
|
|
5783
|
+
}, /* @__PURE__ */ React24.createElement("div", {
|
|
5369
5784
|
ref: domRef,
|
|
5370
5785
|
className: scrollTransformTargetCls,
|
|
5371
5786
|
"data-name": "scroll-transform-target"
|
|
5372
|
-
}, /* @__PURE__ */
|
|
5787
|
+
}, /* @__PURE__ */ React24.createElement(RawList, {
|
|
5373
5788
|
brain: virtualBrain,
|
|
5374
5789
|
renderItem,
|
|
5375
5790
|
repaintId,
|
|
5376
5791
|
debugChannel: "VirtualList-" + mainAxis
|
|
5377
|
-
})), children, /* @__PURE__ */
|
|
5792
|
+
})), children, /* @__PURE__ */ React24.createElement(SpacePlaceholder, {
|
|
5378
5793
|
count,
|
|
5379
5794
|
width,
|
|
5380
5795
|
height
|
|
@@ -5384,14 +5799,14 @@ var VirtualList = (props) => {
|
|
|
5384
5799
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5385
5800
|
var VirtualRowList = (props) => {
|
|
5386
5801
|
const _a = props, { rowWidth, rowHeight, renderRow } = _a, listProps = __objRest(_a, ["rowWidth", "rowHeight", "renderRow"]);
|
|
5387
|
-
const renderItem =
|
|
5802
|
+
const renderItem = React25.useCallback((renderProps) => {
|
|
5388
5803
|
return renderRow({
|
|
5389
5804
|
domRef: renderProps.domRef,
|
|
5390
5805
|
rowHeight: renderProps.itemSize,
|
|
5391
5806
|
rowIndex: renderProps.itemIndex
|
|
5392
5807
|
});
|
|
5393
5808
|
}, [renderRow]);
|
|
5394
|
-
return /* @__PURE__ */
|
|
5809
|
+
return /* @__PURE__ */ React25.createElement(VirtualList, __spreadProps(__spreadValues({}, listProps), {
|
|
5395
5810
|
renderItem,
|
|
5396
5811
|
mainAxis: "vertical",
|
|
5397
5812
|
itemMainAxisSize: rowHeight,
|
|
@@ -5400,11 +5815,11 @@ var VirtualRowList = (props) => {
|
|
|
5400
5815
|
};
|
|
5401
5816
|
|
|
5402
5817
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
5403
|
-
var
|
|
5404
|
-
var
|
|
5818
|
+
var React27 = __toModule(require("react"));
|
|
5819
|
+
var import_react32 = __toModule(require("react"));
|
|
5405
5820
|
|
|
5406
5821
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5407
|
-
var
|
|
5822
|
+
var React26 = __toModule(require("react"));
|
|
5408
5823
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
5409
5824
|
var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
|
|
5410
5825
|
function isColumnWithField(c) {
|
|
@@ -5431,32 +5846,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5431
5846
|
const groupRowInfo = null;
|
|
5432
5847
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5433
5848
|
if (column.valueGetter) {
|
|
5434
|
-
value = column.valueGetter({
|
|
5435
|
-
data,
|
|
5436
|
-
rowInfo
|
|
5437
|
-
|
|
5849
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5850
|
+
data: rowInfo.data,
|
|
5851
|
+
rowInfo
|
|
5852
|
+
} : {
|
|
5853
|
+
data: rowInfo.data,
|
|
5854
|
+
rowInfo
|
|
5438
5855
|
});
|
|
5439
5856
|
}
|
|
5440
5857
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5441
|
-
const
|
|
5442
|
-
value,
|
|
5443
|
-
column,
|
|
5858
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5444
5859
|
rowInfo,
|
|
5445
|
-
data
|
|
5860
|
+
data: rowInfo.data
|
|
5861
|
+
} : {
|
|
5862
|
+
rowInfo,
|
|
5863
|
+
data: rowInfo.data
|
|
5446
5864
|
};
|
|
5865
|
+
const stylingRenderParam = __spreadValues({
|
|
5866
|
+
value,
|
|
5867
|
+
column
|
|
5868
|
+
}, rest);
|
|
5447
5869
|
let renderValue = value;
|
|
5448
5870
|
if (column.render || column.renderValue) {
|
|
5449
|
-
const renderParam = {
|
|
5871
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5450
5872
|
value,
|
|
5451
5873
|
column,
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
data,
|
|
5874
|
+
groupRowInfo
|
|
5875
|
+
}, rest), {
|
|
5455
5876
|
rowIndex,
|
|
5456
5877
|
toggleGroupRow,
|
|
5457
5878
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5458
|
-
|
|
5459
|
-
};
|
|
5879
|
+
groupBy: computedDataSource.groupBy
|
|
5880
|
+
});
|
|
5460
5881
|
if (column.render) {
|
|
5461
5882
|
renderValue = column.render(renderParam);
|
|
5462
5883
|
} else if (column.renderValue) {
|
|
@@ -5491,7 +5912,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5491
5912
|
}
|
|
5492
5913
|
}
|
|
5493
5914
|
}
|
|
5494
|
-
return /* @__PURE__ */
|
|
5915
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
|
|
5495
5916
|
domRef,
|
|
5496
5917
|
offsetProperty
|
|
5497
5918
|
}, dataset), {
|
|
@@ -5502,10 +5923,10 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5502
5923
|
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
|
|
5503
5924
|
}), hidden ? null : renderValue);
|
|
5504
5925
|
}
|
|
5505
|
-
var InfiniteTableColumnCell =
|
|
5926
|
+
var InfiniteTableColumnCell = React26.memo(InfiniteTableColumnCellFn);
|
|
5506
5927
|
|
|
5507
5928
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5508
|
-
var
|
|
5929
|
+
var import_react31 = __toModule(require("react"));
|
|
5509
5930
|
|
|
5510
5931
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
5511
5932
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
@@ -5530,17 +5951,16 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5530
5951
|
domRef: domRefFromProps,
|
|
5531
5952
|
rowInfo
|
|
5532
5953
|
} = props;
|
|
5533
|
-
const domRef = (0,
|
|
5534
|
-
const rowDOMRef = (0,
|
|
5954
|
+
const domRef = (0, import_react31.useRef)(null);
|
|
5955
|
+
const rowDOMRef = (0, import_react31.useCallback)((node) => {
|
|
5535
5956
|
domRefFromProps(node);
|
|
5536
5957
|
domRef.current = node;
|
|
5537
5958
|
}, []);
|
|
5538
|
-
const
|
|
5539
|
-
|
|
5540
|
-
rowInfo,
|
|
5959
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5960
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5541
5961
|
rowIndex,
|
|
5542
|
-
|
|
5543
|
-
};
|
|
5962
|
+
groupBy: rowInfo.groupBy
|
|
5963
|
+
});
|
|
5544
5964
|
if (typeof rowProps === "function") {
|
|
5545
5965
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5546
5966
|
}
|
|
@@ -5563,7 +5983,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5563
5983
|
}), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
|
|
5564
5984
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
5565
5985
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
5566
|
-
const onMouseEnter = (0,
|
|
5986
|
+
const onMouseEnter = (0, import_react31.useCallback)((event) => {
|
|
5567
5987
|
var _a;
|
|
5568
5988
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
5569
5989
|
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
@@ -5577,7 +5997,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5577
5997
|
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5578
5998
|
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5579
5999
|
}, [initialMouseEnter, showHoverRows]);
|
|
5580
|
-
const onMouseLeave = (0,
|
|
6000
|
+
const onMouseLeave = (0, import_react31.useCallback)((event) => {
|
|
5581
6001
|
var _a;
|
|
5582
6002
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
5583
6003
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
@@ -5633,13 +6053,13 @@ function InfiniteTableRowFn(props) {
|
|
|
5633
6053
|
width: rowWidth,
|
|
5634
6054
|
height: rowHeight
|
|
5635
6055
|
}, domProps.style);
|
|
5636
|
-
const renderCellRef = (0,
|
|
5637
|
-
const renderCell =
|
|
6056
|
+
const renderCellRef = (0, import_react32.useRef)(null);
|
|
6057
|
+
const renderCell = React27.useCallback(({ domRef, itemIndex }) => {
|
|
5638
6058
|
const column = columns[itemIndex];
|
|
5639
6059
|
if (!column) {
|
|
5640
6060
|
}
|
|
5641
6061
|
const hidden = false;
|
|
5642
|
-
return /* @__PURE__ */
|
|
6062
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, {
|
|
5643
6063
|
getData,
|
|
5644
6064
|
rowInfo,
|
|
5645
6065
|
groupRenderStrategy,
|
|
@@ -5666,18 +6086,18 @@ function InfiniteTableRowFn(props) {
|
|
|
5666
6086
|
if (true) {
|
|
5667
6087
|
domProps["data-cmp-name"] = "ITableRow";
|
|
5668
6088
|
}
|
|
5669
|
-
return /* @__PURE__ */
|
|
6089
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5670
6090
|
style
|
|
5671
|
-
}), /* @__PURE__ */
|
|
6091
|
+
}), /* @__PURE__ */ React27.createElement(RawList, {
|
|
5672
6092
|
brain,
|
|
5673
6093
|
renderItem: renderCell,
|
|
5674
6094
|
debugChannel: `${rowIndex}`
|
|
5675
6095
|
}));
|
|
5676
6096
|
}
|
|
5677
|
-
var InfiniteTableRow =
|
|
6097
|
+
var InfiniteTableRow = React27.memo(InfiniteTableRowFn);
|
|
5678
6098
|
|
|
5679
6099
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx
|
|
5680
|
-
var
|
|
6100
|
+
var React28 = __toModule(require("react"));
|
|
5681
6101
|
function TableRowUnvirtualizedFn(props) {
|
|
5682
6102
|
const {
|
|
5683
6103
|
rowHeight,
|
|
@@ -5698,7 +6118,7 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5698
6118
|
}, domProps.style);
|
|
5699
6119
|
const children = columns.map((col) => {
|
|
5700
6120
|
const hidden = false;
|
|
5701
|
-
return /* @__PURE__ */
|
|
6121
|
+
return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
|
|
5702
6122
|
key: col.id,
|
|
5703
6123
|
virtualized: false,
|
|
5704
6124
|
rowHeight,
|
|
@@ -5711,11 +6131,11 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5711
6131
|
column: col
|
|
5712
6132
|
});
|
|
5713
6133
|
});
|
|
5714
|
-
return /* @__PURE__ */
|
|
6134
|
+
return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5715
6135
|
style
|
|
5716
6136
|
}), children);
|
|
5717
6137
|
}
|
|
5718
|
-
var TableRowUnvirtualized =
|
|
6138
|
+
var TableRowUnvirtualized = React28.memo(TableRowUnvirtualizedFn);
|
|
5719
6139
|
|
|
5720
6140
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5721
6141
|
function useUnpinnedRendering(params) {
|
|
@@ -5737,7 +6157,7 @@ function useUnpinnedRendering(params) {
|
|
|
5737
6157
|
} = params;
|
|
5738
6158
|
const { virtualizeColumns } = getState();
|
|
5739
6159
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
5740
|
-
const renderRowUnpinned = (0,
|
|
6160
|
+
const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
|
|
5741
6161
|
const dataArray = getData();
|
|
5742
6162
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5743
6163
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -5758,7 +6178,7 @@ function useUnpinnedRendering(params) {
|
|
|
5758
6178
|
rowProps.repaintId = repaintId;
|
|
5759
6179
|
}
|
|
5760
6180
|
const TableRowComponent = shouldVirtualizeColumns ? InfiniteTableRow : TableRowUnvirtualized;
|
|
5761
|
-
return /* @__PURE__ */
|
|
6181
|
+
return /* @__PURE__ */ React29.createElement(TableRowComponent, __spreadValues({}, rowProps));
|
|
5762
6182
|
}, [
|
|
5763
6183
|
repaintId,
|
|
5764
6184
|
rowHeight,
|
|
@@ -5768,7 +6188,7 @@ function useUnpinnedRendering(params) {
|
|
|
5768
6188
|
horizontalVirtualBrain,
|
|
5769
6189
|
verticalVirtualBrain
|
|
5770
6190
|
]);
|
|
5771
|
-
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */
|
|
6191
|
+
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React29.createElement("div", {
|
|
5772
6192
|
"data-name": "horizontal-scrollbar-placeholder--fake",
|
|
5773
6193
|
style: {
|
|
5774
6194
|
position: "absolute",
|
|
@@ -5779,10 +6199,10 @@ function useUnpinnedRendering(params) {
|
|
|
5779
6199
|
overflow: "auto",
|
|
5780
6200
|
visibility: columnShifts ? "visible" : "hidden"
|
|
5781
6201
|
}
|
|
5782
|
-
}, /* @__PURE__ */
|
|
6202
|
+
}, /* @__PURE__ */ React29.createElement("div", {
|
|
5783
6203
|
style: { height: "100%", width: computedUnpinnedColumnsWidth }
|
|
5784
6204
|
})) : null;
|
|
5785
|
-
return rowHeight != 0 ? /* @__PURE__ */
|
|
6205
|
+
return rowHeight != 0 ? /* @__PURE__ */ React29.createElement(VirtualRowList, {
|
|
5786
6206
|
repaintId: `${repaintId}-unpinned-`,
|
|
5787
6207
|
brain: verticalVirtualBrain,
|
|
5788
6208
|
onContainerScroll: applyScrollHorizontal,
|
|
@@ -5803,20 +6223,19 @@ function useUnpinnedRendering(params) {
|
|
|
5803
6223
|
}
|
|
5804
6224
|
|
|
5805
6225
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5806
|
-
var
|
|
6226
|
+
var import_react34 = __toModule(require("react"));
|
|
5807
6227
|
|
|
5808
6228
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5809
|
-
var
|
|
6229
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5810
6230
|
var FooterCls = "_16lm1iw1";
|
|
5811
6231
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5812
|
-
var InfiniteClsRecipe = (0,
|
|
6232
|
+
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: [] });
|
|
5813
6233
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5814
6234
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5815
6235
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5816
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
6236
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5817
6237
|
|
|
5818
6238
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5819
|
-
var DELAY = 200;
|
|
5820
6239
|
var TableClassName = internalProps.rootClassName;
|
|
5821
6240
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5822
6241
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
@@ -5827,23 +6246,33 @@ var useOnContainerScroll = ({
|
|
|
5827
6246
|
}) => {
|
|
5828
6247
|
const {
|
|
5829
6248
|
componentState: {
|
|
6249
|
+
scrollStopDelay,
|
|
5830
6250
|
scrollerDOMRef,
|
|
5831
6251
|
domRef,
|
|
5832
6252
|
scrollToBottomOffset,
|
|
5833
6253
|
onScrollToBottom,
|
|
5834
6254
|
onScrollToTop,
|
|
6255
|
+
onScrollStop: onScrollStopFromProps,
|
|
5835
6256
|
bodySize
|
|
5836
6257
|
}
|
|
5837
6258
|
} = useInfiniteTable();
|
|
5838
|
-
const {
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
6259
|
+
const {
|
|
6260
|
+
componentActions: dataSourceActions,
|
|
6261
|
+
getState: getDataSourceState,
|
|
6262
|
+
componentState: { notifyScrollStop }
|
|
6263
|
+
} = useDataSourceContextValue();
|
|
6264
|
+
const onScrollStop = (0, import_react34.useCallback)((param) => {
|
|
6265
|
+
onScrollStopFromProps == null ? void 0 : onScrollStopFromProps(param);
|
|
6266
|
+
notifyScrollStop(param);
|
|
6267
|
+
}, [onScrollStopFromProps, notifyScrollStop]);
|
|
6268
|
+
const timeoutIdRef = (0, import_react34.useRef)(0);
|
|
6269
|
+
const scrollingRef = (0, import_react34.useRef)(false);
|
|
6270
|
+
const scrollTopMaxRef = (0, import_react34.useRef)(0);
|
|
6271
|
+
(0, import_react34.useEffect)(() => {
|
|
5843
6272
|
const { current: node } = scrollerDOMRef;
|
|
5844
6273
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5845
6274
|
}, [reservedContentHeight, bodySize.height]);
|
|
5846
|
-
const setScrolling = (0,
|
|
6275
|
+
const setScrolling = (0, import_react34.useCallback)((scrolling) => {
|
|
5847
6276
|
var _a;
|
|
5848
6277
|
const prevScrolling = scrollingRef.current;
|
|
5849
6278
|
scrollingRef.current = scrolling;
|
|
@@ -5854,9 +6283,17 @@ var useOnContainerScroll = ({
|
|
|
5854
6283
|
timeoutIdRef.current = setTimeout(() => {
|
|
5855
6284
|
setScrolling(false);
|
|
5856
6285
|
timeoutIdRef.current = 0;
|
|
5857
|
-
},
|
|
6286
|
+
}, scrollStopDelay);
|
|
5858
6287
|
}
|
|
5859
6288
|
if (prevScrolling !== scrolling) {
|
|
6289
|
+
if (!scrolling) {
|
|
6290
|
+
const range = verticalVirtualBrain.getRenderRange();
|
|
6291
|
+
onScrollStop({
|
|
6292
|
+
scrollTop: scrollPositionRef.current.scrollTop,
|
|
6293
|
+
firstVisibleRowIndex: range.renderStartIndex,
|
|
6294
|
+
lastVisibleRowIndex: range.renderEndIndex
|
|
6295
|
+
});
|
|
6296
|
+
}
|
|
5860
6297
|
const classList = (_a = domRef.current) == null ? void 0 : _a.classList;
|
|
5861
6298
|
if (!classList) {
|
|
5862
6299
|
return;
|
|
@@ -5867,8 +6304,8 @@ var useOnContainerScroll = ({
|
|
|
5867
6304
|
classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
|
|
5868
6305
|
}
|
|
5869
6306
|
}
|
|
5870
|
-
}, []);
|
|
5871
|
-
const onContainerScroll = (0,
|
|
6307
|
+
}, [scrollStopDelay, onScrollStop]);
|
|
6308
|
+
const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
|
|
5872
6309
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5873
6310
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5874
6311
|
setScrolling(true);
|
|
@@ -5878,15 +6315,15 @@ var useOnContainerScroll = ({
|
|
|
5878
6315
|
domRef.current,
|
|
5879
6316
|
setScrolling
|
|
5880
6317
|
]);
|
|
5881
|
-
const scrollPositionRef = (0,
|
|
6318
|
+
const scrollPositionRef = (0, import_react34.useRef)({
|
|
5882
6319
|
scrollLeft: 0,
|
|
5883
6320
|
scrollTop: 0
|
|
5884
6321
|
});
|
|
5885
|
-
const applyScrollHorizontal = (0,
|
|
6322
|
+
const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
|
|
5886
6323
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
5887
6324
|
onContainerScroll(scrollPositionRef.current);
|
|
5888
6325
|
}, [onContainerScroll]);
|
|
5889
|
-
const applyScrollVertical = (0,
|
|
6326
|
+
const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
|
|
5890
6327
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
5891
6328
|
onContainerScroll(scrollPositionRef.current);
|
|
5892
6329
|
if (scrollTop === 0) {
|
|
@@ -5897,7 +6334,7 @@ var useOnContainerScroll = ({
|
|
|
5897
6334
|
if (isScrollBottom) {
|
|
5898
6335
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
5899
6336
|
if (getDataSourceState().livePagination) {
|
|
5900
|
-
dataSourceActions.
|
|
6337
|
+
dataSourceActions.cursorId = Date.now();
|
|
5901
6338
|
}
|
|
5902
6339
|
}
|
|
5903
6340
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
@@ -5908,17 +6345,17 @@ var useOnContainerScroll = ({
|
|
|
5908
6345
|
};
|
|
5909
6346
|
|
|
5910
6347
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5911
|
-
var
|
|
5912
|
-
var
|
|
6348
|
+
var React31 = __toModule(require("react"));
|
|
6349
|
+
var import_react37 = __toModule(require("react"));
|
|
5913
6350
|
|
|
5914
6351
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5915
|
-
var
|
|
5916
|
-
var
|
|
6352
|
+
var React30 = __toModule(require("react"));
|
|
6353
|
+
var import_react36 = __toModule(require("react"));
|
|
5917
6354
|
|
|
5918
6355
|
// src/components/hooks/useOnMount.ts
|
|
5919
|
-
var
|
|
6356
|
+
var import_react35 = __toModule(require("react"));
|
|
5920
6357
|
function useOnMount(domRef, props) {
|
|
5921
|
-
(0,
|
|
6358
|
+
(0, import_react35.useEffect)(() => {
|
|
5922
6359
|
const { onMount, onUnmount } = props;
|
|
5923
6360
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5924
6361
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5949,8 +6386,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5949
6386
|
onMount,
|
|
5950
6387
|
onUnmount
|
|
5951
6388
|
} = props;
|
|
5952
|
-
const domRef = (0,
|
|
5953
|
-
const renderItem = (0,
|
|
6389
|
+
const domRef = (0, import_react36.useRef)(null);
|
|
6390
|
+
const renderItem = (0, import_react36.useCallback)((renderProps) => renderRow({
|
|
5954
6391
|
domRef: renderProps.domRef,
|
|
5955
6392
|
rowHeight: renderProps.itemSize,
|
|
5956
6393
|
rowIndex: renderProps.itemIndex
|
|
@@ -5959,7 +6396,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5959
6396
|
onMount,
|
|
5960
6397
|
onUnmount
|
|
5961
6398
|
});
|
|
5962
|
-
(0,
|
|
6399
|
+
(0, import_react36.useEffect)(() => {
|
|
5963
6400
|
const onScroll = (scrollPosition) => {
|
|
5964
6401
|
const node = domRef.current;
|
|
5965
6402
|
if (node) {
|
|
@@ -5988,7 +6425,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5988
6425
|
if (true) {
|
|
5989
6426
|
domProps["data-cmp-name"] = "RowListWithExternalScrolling";
|
|
5990
6427
|
}
|
|
5991
|
-
return /* @__PURE__ */
|
|
6428
|
+
return /* @__PURE__ */ React30.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React30.createElement(RawList, {
|
|
5992
6429
|
brain,
|
|
5993
6430
|
renderItem,
|
|
5994
6431
|
repaintId
|
|
@@ -6011,7 +6448,7 @@ function PinnedRowsContainer(props) {
|
|
|
6011
6448
|
brain,
|
|
6012
6449
|
renderRow
|
|
6013
6450
|
} = props;
|
|
6014
|
-
const style =
|
|
6451
|
+
const style = React31.useMemo(() => {
|
|
6015
6452
|
const result = pinning === "end" ? {
|
|
6016
6453
|
width: rowWidth,
|
|
6017
6454
|
height,
|
|
@@ -6026,7 +6463,7 @@ function PinnedRowsContainer(props) {
|
|
|
6026
6463
|
}
|
|
6027
6464
|
return result;
|
|
6028
6465
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
6029
|
-
const updateScroll = (0,
|
|
6466
|
+
const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
|
|
6030
6467
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
6031
6468
|
}, [hasOverflow, pinnedScrollListener]);
|
|
6032
6469
|
const rowListProps = {
|
|
@@ -6037,7 +6474,7 @@ function PinnedRowsContainer(props) {
|
|
|
6037
6474
|
className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
|
|
6038
6475
|
};
|
|
6039
6476
|
if (hasOverflow) {
|
|
6040
|
-
return /* @__PURE__ */
|
|
6477
|
+
return /* @__PURE__ */ React31.createElement(VirtualScrollContainer, {
|
|
6041
6478
|
scrollable: {
|
|
6042
6479
|
horizontal: true,
|
|
6043
6480
|
vertical: false
|
|
@@ -6053,22 +6490,22 @@ function PinnedRowsContainer(props) {
|
|
|
6053
6490
|
className: join(PinnedRowsContainerClsVariants({
|
|
6054
6491
|
pinned: pinning
|
|
6055
6492
|
}), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
|
|
6056
|
-
}, /* @__PURE__ */
|
|
6493
|
+
}, /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
|
|
6057
6494
|
onMount: (node) => {
|
|
6058
6495
|
pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
|
|
6059
6496
|
updateScroll(node, brain.getScrollPosition(), scrollPosition);
|
|
6060
6497
|
});
|
|
6061
6498
|
}
|
|
6062
|
-
})), /* @__PURE__ */
|
|
6499
|
+
})), /* @__PURE__ */ React31.createElement(SpacePlaceholder, {
|
|
6063
6500
|
width: rowWidth,
|
|
6064
6501
|
height: 1
|
|
6065
6502
|
}));
|
|
6066
6503
|
}
|
|
6067
|
-
return /* @__PURE__ */
|
|
6504
|
+
return /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
6068
6505
|
}
|
|
6069
6506
|
function useRenderPinnedRow(params) {
|
|
6070
6507
|
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
6071
|
-
const renderPinnedRow = (0,
|
|
6508
|
+
const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
|
|
6072
6509
|
const dataArray = getData();
|
|
6073
6510
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
6074
6511
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -6084,7 +6521,7 @@ function useRenderPinnedRow(params) {
|
|
|
6084
6521
|
rowWidth: columnsWidth,
|
|
6085
6522
|
columns
|
|
6086
6523
|
}, rowParams);
|
|
6087
|
-
return /* @__PURE__ */
|
|
6524
|
+
return /* @__PURE__ */ React31.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
|
|
6088
6525
|
}, [columnsWidth, columns, verticalBrain]);
|
|
6089
6526
|
return renderPinnedRow;
|
|
6090
6527
|
}
|
|
@@ -6127,7 +6564,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6127
6564
|
columns,
|
|
6128
6565
|
columnsWidth
|
|
6129
6566
|
});
|
|
6130
|
-
const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */
|
|
6567
|
+
const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ React31.createElement(PinnedRowsContainer, {
|
|
6131
6568
|
pinning: side,
|
|
6132
6569
|
pinnedScrollListener,
|
|
6133
6570
|
hasOverflow,
|
|
@@ -6140,7 +6577,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6140
6577
|
brain: verticalVirtualBrain,
|
|
6141
6578
|
renderRow: renderRowPinned
|
|
6142
6579
|
}) : null;
|
|
6143
|
-
const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */
|
|
6580
|
+
const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ React31.createElement(HorizontalScrollbarPlaceholder, {
|
|
6144
6581
|
style: side === "end" ? {
|
|
6145
6582
|
width: columnsWidth,
|
|
6146
6583
|
right: hasVerticalScrollbar ? getScrollbarWidth() : 0
|
|
@@ -6182,7 +6619,16 @@ function usePinnedStartRendering(params) {
|
|
|
6182
6619
|
}
|
|
6183
6620
|
|
|
6184
6621
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6185
|
-
var
|
|
6622
|
+
var import_react40 = __toModule(require("react"));
|
|
6623
|
+
|
|
6624
|
+
// src/components/hooks/useOnce.ts
|
|
6625
|
+
var import_react38 = __toModule(require("react"));
|
|
6626
|
+
function useOnce(fn) {
|
|
6627
|
+
const onceFn = (0, import_react38.useMemo)(() => {
|
|
6628
|
+
return once(fn);
|
|
6629
|
+
}, []);
|
|
6630
|
+
return onceFn();
|
|
6631
|
+
}
|
|
6186
6632
|
|
|
6187
6633
|
// src/components/VirtualBrain/index.ts
|
|
6188
6634
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -6620,9 +7066,9 @@ var VirtualBrain = class extends Logger {
|
|
|
6620
7066
|
};
|
|
6621
7067
|
|
|
6622
7068
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
6623
|
-
var
|
|
7069
|
+
var import_react39 = __toModule(require("react"));
|
|
6624
7070
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
6625
|
-
const columnSize = (0,
|
|
7071
|
+
const columnSize = (0, import_react39.useCallback)((index) => {
|
|
6626
7072
|
const column = computedUnpinnedColumns[index];
|
|
6627
7073
|
if (!column) {
|
|
6628
7074
|
console.log("cannot find column at index", index, computedUnpinnedColumns);
|
|
@@ -6661,7 +7107,7 @@ function useYourBrain(param) {
|
|
|
6661
7107
|
});
|
|
6662
7108
|
return brain;
|
|
6663
7109
|
});
|
|
6664
|
-
(0,
|
|
7110
|
+
(0, import_react40.useEffect)(() => {
|
|
6665
7111
|
return () => {
|
|
6666
7112
|
horizontalVirtualBrain.destroy();
|
|
6667
7113
|
verticalVirtualBrain.destroy();
|
|
@@ -6669,13 +7115,13 @@ function useYourBrain(param) {
|
|
|
6669
7115
|
}, []);
|
|
6670
7116
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6671
7117
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6672
|
-
(0,
|
|
7118
|
+
(0, import_react40.useEffect)(() => {
|
|
6673
7119
|
verticalVirtualBrain.setAvailableSize({
|
|
6674
7120
|
height: bodySize.height,
|
|
6675
7121
|
width: 0
|
|
6676
7122
|
});
|
|
6677
7123
|
}, [bodySize, verticalVirtualBrain]);
|
|
6678
|
-
(0,
|
|
7124
|
+
(0, import_react40.useEffect)(() => {
|
|
6679
7125
|
horizontalVirtualBrain.setAvailableSize({
|
|
6680
7126
|
height: 0,
|
|
6681
7127
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6713,12 +7159,12 @@ function useListRendering(param) {
|
|
|
6713
7159
|
pinnedEndScrollListener
|
|
6714
7160
|
} = componentState;
|
|
6715
7161
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6716
|
-
const repaintIdRef = (0,
|
|
7162
|
+
const repaintIdRef = (0, import_react41.useRef)(0);
|
|
6717
7163
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6718
7164
|
repaintIdRef.current++;
|
|
6719
7165
|
}
|
|
6720
7166
|
const repaintId = repaintIdRef.current;
|
|
6721
|
-
const rowSpan = (0,
|
|
7167
|
+
const rowSpan = (0, import_react41.useMemo)(() => {
|
|
6722
7168
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6723
7169
|
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
6724
7170
|
let maxSpan = 1;
|
|
@@ -6756,11 +7202,11 @@ function useListRendering(param) {
|
|
|
6756
7202
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6757
7203
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6758
7204
|
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6759
|
-
const scrollbars = (0,
|
|
7205
|
+
const scrollbars = (0, import_react41.useMemo)(() => ({
|
|
6760
7206
|
vertical: hasVerticalScrollbar,
|
|
6761
7207
|
horizontal: hasHorizontalScrollbar
|
|
6762
7208
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6763
|
-
(0,
|
|
7209
|
+
(0, import_react41.useEffect)(() => {
|
|
6764
7210
|
if (!bodySize.height) {
|
|
6765
7211
|
return;
|
|
6766
7212
|
}
|
|
@@ -6773,7 +7219,6 @@ function useListRendering(param) {
|
|
|
6773
7219
|
setColumnVisibility: (columnVisibility) => {
|
|
6774
7220
|
componentActions.columnVisibility = columnVisibility;
|
|
6775
7221
|
},
|
|
6776
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6777
7222
|
getState,
|
|
6778
7223
|
getDataSourceState
|
|
6779
7224
|
};
|
|
@@ -6786,7 +7231,7 @@ function useListRendering(param) {
|
|
|
6786
7231
|
reservedContentHeight
|
|
6787
7232
|
});
|
|
6788
7233
|
const { componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
6789
|
-
const toggleGroupRow = (0,
|
|
7234
|
+
const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
|
|
6790
7235
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
6791
7236
|
newState.toggleGroupRow(groupKeys);
|
|
6792
7237
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -6821,7 +7266,7 @@ function useListRendering(param) {
|
|
|
6821
7266
|
computedUnpinnedColumns
|
|
6822
7267
|
});
|
|
6823
7268
|
const [, rerender] = useRerender();
|
|
6824
|
-
(0,
|
|
7269
|
+
(0, import_react41.useEffect)(() => {
|
|
6825
7270
|
rerender();
|
|
6826
7271
|
}, [dataSourceState]);
|
|
6827
7272
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6844,8 +7289,8 @@ function useListRendering(param) {
|
|
|
6844
7289
|
}
|
|
6845
7290
|
|
|
6846
7291
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6847
|
-
var
|
|
6848
|
-
var
|
|
7292
|
+
var React32 = __toModule(require("react"));
|
|
7293
|
+
var import_react42 = __toModule(require("react"));
|
|
6849
7294
|
|
|
6850
7295
|
// src/components/utils/decamelize.ts
|
|
6851
7296
|
function decamelize(str, options) {
|
|
@@ -6880,10 +7325,10 @@ var enforceStyle = (node, style) => {
|
|
|
6880
7325
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
6881
7326
|
}
|
|
6882
7327
|
};
|
|
6883
|
-
var InfiniteTableLicenseFooter =
|
|
7328
|
+
var InfiniteTableLicenseFooter = React32.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6884
7329
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6885
|
-
const domRef =
|
|
6886
|
-
const domCallback =
|
|
7330
|
+
const domRef = React32.useRef(null);
|
|
7331
|
+
const domCallback = React32.useCallback((node) => {
|
|
6887
7332
|
domRef.current = node;
|
|
6888
7333
|
if (!ref) {
|
|
6889
7334
|
return;
|
|
@@ -6894,7 +7339,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6894
7339
|
ref.current = node;
|
|
6895
7340
|
}
|
|
6896
7341
|
}, []);
|
|
6897
|
-
(0,
|
|
7342
|
+
(0, import_react42.useEffect)(() => {
|
|
6898
7343
|
const forceStyle = () => {
|
|
6899
7344
|
requestAnimationFrame(() => {
|
|
6900
7345
|
var _a;
|
|
@@ -6908,12 +7353,12 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6908
7353
|
clearInterval(intervalId);
|
|
6909
7354
|
};
|
|
6910
7355
|
}, []);
|
|
6911
|
-
return /* @__PURE__ */
|
|
7356
|
+
return /* @__PURE__ */ React32.createElement("div", __spreadProps(__spreadValues({
|
|
6912
7357
|
ref: domCallback
|
|
6913
7358
|
}, props), {
|
|
6914
7359
|
className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
|
|
6915
7360
|
style: defaultStyle2
|
|
6916
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
7361
|
+
}), "Powered by", " ", /* @__PURE__ */ React32.createElement("a", {
|
|
6917
7362
|
href: "https://infinite-table.com",
|
|
6918
7363
|
rel: "noopener noreferrer",
|
|
6919
7364
|
role: "link",
|
|
@@ -6922,7 +7367,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6922
7367
|
});
|
|
6923
7368
|
|
|
6924
7369
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6925
|
-
var
|
|
7370
|
+
var import_react43 = __toModule(require("react"));
|
|
6926
7371
|
|
|
6927
7372
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
6928
7373
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -7072,10 +7517,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
|
7072
7517
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
7073
7518
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
7074
7519
|
var useLicense = (licenseKey = "") => {
|
|
7075
|
-
const valid = (0,
|
|
7520
|
+
const valid = (0, import_react43.useMemo)(() => {
|
|
7076
7521
|
let valid2 = isValidLicense(licenseKey, {
|
|
7077
7522
|
publishedAt: 1624970570587,
|
|
7078
|
-
version: "0.
|
|
7523
|
+
version: "0.1.3"
|
|
7079
7524
|
});
|
|
7080
7525
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7081
7526
|
return true;
|
|
@@ -7086,8 +7531,8 @@ var useLicense = (licenseKey = "") => {
|
|
|
7086
7531
|
};
|
|
7087
7532
|
|
|
7088
7533
|
// src/components/CSSVariableWatch.tsx
|
|
7089
|
-
var
|
|
7090
|
-
var
|
|
7534
|
+
var React33 = __toModule(require("react"));
|
|
7535
|
+
var import_react44 = __toModule(require("react"));
|
|
7091
7536
|
var error = err("CSSVariableWatch");
|
|
7092
7537
|
var debug5 = dbg("CSSVariableWatch");
|
|
7093
7538
|
var WRAPPER_STYLE = {
|
|
@@ -7100,15 +7545,15 @@ var WRAPPER_STYLE = {
|
|
|
7100
7545
|
overflow: "hidden"
|
|
7101
7546
|
};
|
|
7102
7547
|
var useCSSVariableWatch = (params) => {
|
|
7103
|
-
const lastValueRef = (0,
|
|
7104
|
-
const onResize =
|
|
7548
|
+
const lastValueRef = (0, import_react44.useRef)(0);
|
|
7549
|
+
const onResize = React33.useCallback(({ height }) => {
|
|
7105
7550
|
if (height && height !== lastValueRef.current) {
|
|
7106
7551
|
lastValueRef.current = height;
|
|
7107
7552
|
params.onChange(height);
|
|
7108
7553
|
}
|
|
7109
7554
|
}, [params.onChange]);
|
|
7110
7555
|
useResizeObserver(params.ref, onResize, { earlyAttach: true });
|
|
7111
|
-
|
|
7556
|
+
React33.useLayoutEffect(() => {
|
|
7112
7557
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7113
7558
|
if (value) {
|
|
7114
7559
|
lastValueRef.current = value;
|
|
@@ -7120,15 +7565,15 @@ var useCSSVariableWatch = (params) => {
|
|
|
7120
7565
|
}, []);
|
|
7121
7566
|
};
|
|
7122
7567
|
var CSSVariableWatch = (props) => {
|
|
7123
|
-
const domRef = (0,
|
|
7568
|
+
const domRef = (0, import_react44.useRef)(null);
|
|
7124
7569
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7125
7570
|
ref: domRef
|
|
7126
7571
|
}));
|
|
7127
|
-
return /* @__PURE__ */
|
|
7572
|
+
return /* @__PURE__ */ React33.createElement("div", {
|
|
7128
7573
|
"data-name": "css-variable-watcher",
|
|
7129
7574
|
"data-var": props.varName,
|
|
7130
7575
|
style: WRAPPER_STYLE
|
|
7131
|
-
}, /* @__PURE__ */
|
|
7576
|
+
}, /* @__PURE__ */ React33.createElement("div", {
|
|
7132
7577
|
ref: domRef,
|
|
7133
7578
|
style: {
|
|
7134
7579
|
height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
|
|
@@ -7221,7 +7666,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
7221
7666
|
}
|
|
7222
7667
|
|
|
7223
7668
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
7224
|
-
var
|
|
7669
|
+
var React34 = __toModule(require("react"));
|
|
7225
7670
|
|
|
7226
7671
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
7227
7672
|
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv" };
|
|
@@ -7233,15 +7678,15 @@ var { rootClassName: rootClassName11 } = internalProps;
|
|
|
7233
7678
|
var baseCls2 = `${rootClassName11}-LoadMask`;
|
|
7234
7679
|
function LoadMaskFn(props) {
|
|
7235
7680
|
const { visible, children = "Loading" } = props;
|
|
7236
|
-
return /* @__PURE__ */
|
|
7681
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
7237
7682
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
|
|
7238
|
-
}, /* @__PURE__ */
|
|
7683
|
+
}, /* @__PURE__ */ React34.createElement("div", {
|
|
7239
7684
|
className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
|
|
7240
|
-
}), /* @__PURE__ */
|
|
7685
|
+
}), /* @__PURE__ */ React34.createElement("div", {
|
|
7241
7686
|
className: `${LoadMaskTextCls} ${baseCls2}-Text`
|
|
7242
7687
|
}, children));
|
|
7243
7688
|
}
|
|
7244
|
-
var LoadMask =
|
|
7689
|
+
var LoadMask = React34.memo(LoadMaskFn);
|
|
7245
7690
|
|
|
7246
7691
|
// src/components/InfiniteTable/index.tsx
|
|
7247
7692
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
@@ -7260,7 +7705,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7260
7705
|
getParentState: () => useDataSource(),
|
|
7261
7706
|
debugName: "InfiniteTable"
|
|
7262
7707
|
});
|
|
7263
|
-
var InfiniteTableComponent =
|
|
7708
|
+
var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
7264
7709
|
var _a;
|
|
7265
7710
|
const {
|
|
7266
7711
|
componentState,
|
|
@@ -7307,7 +7752,7 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7307
7752
|
const licenseValid = useLicense(licenseKey);
|
|
7308
7753
|
const domProps = useDOMProps(componentState.domProps);
|
|
7309
7754
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7310
|
-
|
|
7755
|
+
React35.useLayoutEffect(() => {
|
|
7311
7756
|
const dataSourceState = getDataSourceState();
|
|
7312
7757
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7313
7758
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -7316,31 +7761,31 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7316
7761
|
}
|
|
7317
7762
|
notifyScrollbarsChange(scrollbars);
|
|
7318
7763
|
}, [scrollbars]);
|
|
7319
|
-
return /* @__PURE__ */
|
|
7764
|
+
return /* @__PURE__ */ React35.createElement("div", __spreadValues({
|
|
7320
7765
|
ref: domRef
|
|
7321
|
-
}, domProps), header ? /* @__PURE__ */
|
|
7766
|
+
}, domProps), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
|
|
7322
7767
|
brain: horizontalVirtualBrain,
|
|
7323
7768
|
repaintId,
|
|
7324
7769
|
scrollbars
|
|
7325
|
-
}) : null, /* @__PURE__ */
|
|
7770
|
+
}) : null, /* @__PURE__ */ React35.createElement(InfiniteTableBody, null, /* @__PURE__ */ React35.createElement(VirtualScrollContainer, {
|
|
7326
7771
|
ref: scrollerDOMRef,
|
|
7327
7772
|
onContainerScroll: applyScrollVertical,
|
|
7328
7773
|
scrollable: ONLY_VERTICAL_SCROLLBAR
|
|
7329
|
-
}, /* @__PURE__ */
|
|
7774
|
+
}, /* @__PURE__ */ React35.createElement("div", {
|
|
7330
7775
|
className: display.flex
|
|
7331
|
-
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */
|
|
7776
|
+
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React35.createElement(SpacePlaceholder, {
|
|
7332
7777
|
count: dataArray.length,
|
|
7333
7778
|
width: 0,
|
|
7334
7779
|
height: reservedContentHeight
|
|
7335
|
-
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */
|
|
7780
|
+
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React35.createElement(LoadMaskCmp, {
|
|
7336
7781
|
visible: loading
|
|
7337
|
-
}, loadingText)), licenseValid ? null : /* @__PURE__ */
|
|
7782
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ React35.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React35.createElement("div", {
|
|
7338
7783
|
ref: portalDOMRef,
|
|
7339
7784
|
className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
7340
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
7785
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
|
|
7341
7786
|
varName: rowHeightCSSVar,
|
|
7342
7787
|
onChange: onRowHeightCSSVarChange
|
|
7343
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
7788
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
|
|
7344
7789
|
varName: headerHeightCSSVar,
|
|
7345
7790
|
onChange: onHeaderHeightCSSVarChange
|
|
7346
7791
|
}) : null);
|
|
@@ -7376,25 +7821,25 @@ function InfiniteTableContextProvider() {
|
|
|
7376
7821
|
}
|
|
7377
7822
|
componentActions.bodySize = bodySize;
|
|
7378
7823
|
}, { earlyAttach: true });
|
|
7379
|
-
|
|
7824
|
+
React35.useEffect(() => {
|
|
7380
7825
|
return () => {
|
|
7381
7826
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7382
7827
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7383
7828
|
};
|
|
7384
7829
|
}, []);
|
|
7385
|
-
|
|
7830
|
+
React35.useEffect(() => {
|
|
7386
7831
|
if (scrollerDOMRef.current) {
|
|
7387
7832
|
scrollerDOMRef.current.scrollTop = 0;
|
|
7388
7833
|
}
|
|
7389
7834
|
}, [scrollTopId, scrollerDOMRef]);
|
|
7390
7835
|
const TableContext2 = getInfiniteTableContext();
|
|
7391
|
-
return /* @__PURE__ */
|
|
7836
|
+
return /* @__PURE__ */ React35.createElement(TableContext2.Provider, {
|
|
7392
7837
|
value: contextValue
|
|
7393
|
-
}, /* @__PURE__ */
|
|
7838
|
+
}, /* @__PURE__ */ React35.createElement(InfiniteTableComponent, null));
|
|
7394
7839
|
}
|
|
7395
7840
|
function InfiniteTable(props) {
|
|
7396
|
-
const table = /* @__PURE__ */
|
|
7397
|
-
return /* @__PURE__ */
|
|
7841
|
+
const table = /* @__PURE__ */ React35.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(InfiniteTableContextProvider, null));
|
|
7842
|
+
return /* @__PURE__ */ React35.createElement(React35.StrictMode, null, table);
|
|
7398
7843
|
}
|
|
7399
7844
|
InfiniteTable.defaultProps = {
|
|
7400
7845
|
rowHeight: 40,
|