@infinite-table/infinite-react 0.0.9 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +3 -5
- package/index.d.ts +196 -127
- package/index.esm.css +3 -5
- package/index.esm.js +469 -364
- package/index.js +724 -617
- package/package.json +3 -4
package/index.js
CHANGED
|
@@ -198,11 +198,11 @@ var require_common = __commonJS({
|
|
|
198
198
|
let enableOverride = null;
|
|
199
199
|
let namespacesCache;
|
|
200
200
|
let enabledCache;
|
|
201
|
-
function
|
|
202
|
-
if (!
|
|
201
|
+
function debug7(...args) {
|
|
202
|
+
if (!debug7.enabled) {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
|
-
const self =
|
|
205
|
+
const self = debug7;
|
|
206
206
|
const curr = Number(new Date());
|
|
207
207
|
const ms = curr - (prevTime || curr);
|
|
208
208
|
self.diff = ms;
|
|
@@ -232,12 +232,12 @@ var require_common = __commonJS({
|
|
|
232
232
|
const logFn = self.log || createDebug.log;
|
|
233
233
|
logFn.apply(self, args);
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
Object.defineProperty(
|
|
235
|
+
debug7.namespace = namespace;
|
|
236
|
+
debug7.useColors = createDebug.useColors();
|
|
237
|
+
debug7.color = createDebug.selectColor(namespace);
|
|
238
|
+
debug7.extend = extend;
|
|
239
|
+
debug7.destroy = createDebug.destroy;
|
|
240
|
+
Object.defineProperty(debug7, "enabled", {
|
|
241
241
|
enumerable: true,
|
|
242
242
|
configurable: false,
|
|
243
243
|
get: () => {
|
|
@@ -255,9 +255,9 @@ var require_common = __commonJS({
|
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
if (typeof createDebug.init === "function") {
|
|
258
|
-
createDebug.init(
|
|
258
|
+
createDebug.init(debug7);
|
|
259
259
|
}
|
|
260
|
-
return
|
|
260
|
+
return debug7;
|
|
261
261
|
}
|
|
262
262
|
function extend(namespace, delimiter) {
|
|
263
263
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
@@ -621,38 +621,6 @@ var require_binary_search = __commonJS({
|
|
|
621
621
|
}
|
|
622
622
|
});
|
|
623
623
|
|
|
624
|
-
// node_modules/decamelize/index.js
|
|
625
|
-
var require_decamelize = __commonJS({
|
|
626
|
-
"node_modules/decamelize/index.js"(exports, module2) {
|
|
627
|
-
"use strict";
|
|
628
|
-
var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
|
|
629
|
-
decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
|
|
630
|
-
return $0.toLowerCase();
|
|
631
|
-
});
|
|
632
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
|
|
633
|
-
return $1 + separator + $2.toLowerCase();
|
|
634
|
-
});
|
|
635
|
-
};
|
|
636
|
-
module2.exports = (text, {
|
|
637
|
-
separator = "_",
|
|
638
|
-
preserveConsecutiveUppercase = false
|
|
639
|
-
} = {}) => {
|
|
640
|
-
if (!(typeof text === "string" && typeof separator === "string")) {
|
|
641
|
-
throw new TypeError("The `text` and `separator` arguments should be of type `string`");
|
|
642
|
-
}
|
|
643
|
-
if (text.length < 2) {
|
|
644
|
-
return preserveConsecutiveUppercase ? text : text.toLowerCase();
|
|
645
|
-
}
|
|
646
|
-
const replacement = `$1${separator}$2`;
|
|
647
|
-
const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
|
|
648
|
-
if (preserveConsecutiveUppercase) {
|
|
649
|
-
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
650
|
-
}
|
|
651
|
-
return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
|
|
656
624
|
// src/index.tsx
|
|
657
625
|
__export(exports, {
|
|
658
626
|
DataSource: () => DataSource,
|
|
@@ -667,11 +635,12 @@ __export(exports, {
|
|
|
667
635
|
interceptMap: () => interceptMap,
|
|
668
636
|
multisort: () => multisort,
|
|
669
637
|
useComponentState: () => useComponentState,
|
|
670
|
-
useDataSource: () => useDataSource
|
|
638
|
+
useDataSource: () => useDataSource,
|
|
639
|
+
useEffectWithChanges: () => useEffectWithChanges
|
|
671
640
|
});
|
|
672
641
|
|
|
673
642
|
// src/components/InfiniteTable/index.tsx
|
|
674
|
-
var
|
|
643
|
+
var React35 = __toModule(require("react"));
|
|
675
644
|
|
|
676
645
|
// src/components/InfiniteTable/internalProps.ts
|
|
677
646
|
var rootClassName = "Infinite";
|
|
@@ -751,6 +720,17 @@ var ScrollListener = class {
|
|
|
751
720
|
}
|
|
752
721
|
};
|
|
753
722
|
|
|
723
|
+
// src/components/InfiniteTable/utils/toMap.ts
|
|
724
|
+
function toMap(mapOrObject) {
|
|
725
|
+
if (!mapOrObject) {
|
|
726
|
+
return new Map();
|
|
727
|
+
}
|
|
728
|
+
if (mapOrObject instanceof Map) {
|
|
729
|
+
return mapOrObject;
|
|
730
|
+
}
|
|
731
|
+
return new Map(Object.entries(mapOrObject));
|
|
732
|
+
}
|
|
733
|
+
|
|
754
734
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
755
735
|
function computeColumnGroupsDepths(columnGroups) {
|
|
756
736
|
const map2 = new Map();
|
|
@@ -774,15 +754,6 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
774
754
|
}
|
|
775
755
|
|
|
776
756
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
777
|
-
function toMap(mapOrObject) {
|
|
778
|
-
if (!mapOrObject) {
|
|
779
|
-
return new Map();
|
|
780
|
-
}
|
|
781
|
-
if (mapOrObject instanceof Map) {
|
|
782
|
-
return mapOrObject;
|
|
783
|
-
}
|
|
784
|
-
return new Map(Object.entries(mapOrObject));
|
|
785
|
-
}
|
|
786
757
|
function toColumnTypesMap(mapOrObject) {
|
|
787
758
|
return toMap(mapOrObject);
|
|
788
759
|
}
|
|
@@ -852,6 +823,7 @@ var forwardProps = () => {
|
|
|
852
823
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
853
824
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
854
825
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
826
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
855
827
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
856
828
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
857
829
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
@@ -863,7 +835,10 @@ var forwardProps = () => {
|
|
|
863
835
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
864
836
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
865
837
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
866
|
-
columnVisibility: (columnVisibility) =>
|
|
838
|
+
columnVisibility: (columnVisibility) => {
|
|
839
|
+
var _a;
|
|
840
|
+
return (_a = toMap(columnVisibility)) != null ? _a : new Map();
|
|
841
|
+
},
|
|
867
842
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
868
843
|
columnSizing: (columnSizing) => {
|
|
869
844
|
var _a;
|
|
@@ -873,21 +848,20 @@ var forwardProps = () => {
|
|
|
873
848
|
var _a;
|
|
874
849
|
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
875
850
|
},
|
|
876
|
-
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
877
851
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
878
852
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
879
853
|
};
|
|
880
854
|
};
|
|
881
855
|
function getGroupRenderStrategy(options) {
|
|
882
|
-
const {
|
|
856
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
883
857
|
if (groupRenderStrategy) {
|
|
884
858
|
return groupRenderStrategy;
|
|
885
859
|
}
|
|
886
860
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
887
861
|
return "single-column";
|
|
888
862
|
}
|
|
889
|
-
const
|
|
890
|
-
if (
|
|
863
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
864
|
+
if (columnsInGroupBy.length) {
|
|
891
865
|
return "multi-column";
|
|
892
866
|
}
|
|
893
867
|
return "multi-column";
|
|
@@ -898,16 +872,17 @@ var mapPropsToState = (params) => {
|
|
|
898
872
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
899
873
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
900
874
|
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;
|
|
901
|
-
const
|
|
875
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
902
876
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
903
877
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
904
|
-
|
|
878
|
+
groupBy,
|
|
905
879
|
groupColumn: props.groupColumn
|
|
906
880
|
});
|
|
881
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
907
882
|
return {
|
|
908
883
|
groupRenderStrategy,
|
|
909
|
-
|
|
910
|
-
computedColumns
|
|
884
|
+
groupBy,
|
|
885
|
+
computedColumns,
|
|
911
886
|
virtualizeHeader,
|
|
912
887
|
columnGroupsDepthsMap,
|
|
913
888
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1311,8 +1286,8 @@ var getComputedVisibleColumns = ({
|
|
|
1311
1286
|
const colTypeSizing = {
|
|
1312
1287
|
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1313
1288
|
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1314
|
-
width: colType == null ? void 0 : colType.
|
|
1315
|
-
flex: colType == null ? void 0 : colType.
|
|
1289
|
+
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1290
|
+
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1316
1291
|
};
|
|
1317
1292
|
let colSizing = columnSizing.get(colId) || {};
|
|
1318
1293
|
if (colSizing.width != null) {
|
|
@@ -1365,7 +1340,7 @@ var getComputedVisibleColumns = ({
|
|
|
1365
1340
|
});
|
|
1366
1341
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
1367
1342
|
columnsArray.forEach((c, i) => {
|
|
1368
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1343
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1369
1344
|
const id = visibleColumnOrder[i];
|
|
1370
1345
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1371
1346
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -1426,6 +1401,7 @@ var getComputedVisibleColumns = ({
|
|
|
1426
1401
|
const result2 = __spreadProps(__spreadValues({
|
|
1427
1402
|
align: colType.align,
|
|
1428
1403
|
verticalAlign: colType.verticalAlign,
|
|
1404
|
+
valueGetter: colType.valueGetter,
|
|
1429
1405
|
renderValue: colType.renderValue,
|
|
1430
1406
|
render: colType.render
|
|
1431
1407
|
}, c), {
|
|
@@ -1433,7 +1409,7 @@ var getComputedVisibleColumns = ({
|
|
|
1433
1409
|
computedAbsoluteOffset,
|
|
1434
1410
|
computedPinningOffset,
|
|
1435
1411
|
computedOffset,
|
|
1436
|
-
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,
|
|
1437
1413
|
computedSortInfo,
|
|
1438
1414
|
computedSortIndex,
|
|
1439
1415
|
computedMultiSort: multiSort,
|
|
@@ -1442,14 +1418,14 @@ var getComputedVisibleColumns = ({
|
|
|
1442
1418
|
computedSortedDesc,
|
|
1443
1419
|
computedVisibleIndex: i,
|
|
1444
1420
|
computedPinned,
|
|
1445
|
-
computedDraggable: (
|
|
1421
|
+
computedDraggable: (_h = (_g = c.draggable) != null ? _g : draggableColumns) != null ? _h : true,
|
|
1446
1422
|
computedFirstInCategory,
|
|
1447
1423
|
computedLastInCategory,
|
|
1448
1424
|
computedFirst: i === 0,
|
|
1449
1425
|
computedLast,
|
|
1450
1426
|
toggleSort,
|
|
1451
1427
|
id,
|
|
1452
|
-
header: (
|
|
1428
|
+
header: (_k = (_j = (_i = c.header) != null ? _i : colType.header) != null ? _j : c.name) != null ? _k : c.field
|
|
1453
1429
|
});
|
|
1454
1430
|
computedOffset += computedWidth;
|
|
1455
1431
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -1685,37 +1661,10 @@ var useComputedVisibleColumns = ({
|
|
|
1685
1661
|
var sortAscending = (a, b) => a - b;
|
|
1686
1662
|
|
|
1687
1663
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1688
|
-
var
|
|
1689
|
-
|
|
1690
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1691
|
-
var import_react12 = __toModule(require("react"));
|
|
1692
|
-
|
|
1693
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1694
|
-
var React3 = __toModule(require("react"));
|
|
1695
|
-
|
|
1696
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1697
|
-
var React2 = __toModule(require("react"));
|
|
1698
|
-
var DSContext;
|
|
1699
|
-
function getDataSourceContext() {
|
|
1700
|
-
if (DSContext) {
|
|
1701
|
-
return DSContext;
|
|
1702
|
-
}
|
|
1703
|
-
return DSContext = React2.createContext({
|
|
1704
|
-
getState: () => null,
|
|
1705
|
-
componentState: null,
|
|
1706
|
-
componentActions: null
|
|
1707
|
-
});
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1711
|
-
function useDataSourceActions() {
|
|
1712
|
-
const DataSourceContext = getDataSourceContext();
|
|
1713
|
-
const contextValue = React3.useContext(DataSourceContext);
|
|
1714
|
-
return contextValue.componentActions;
|
|
1715
|
-
}
|
|
1664
|
+
var import_react19 = __toModule(require("react"));
|
|
1716
1665
|
|
|
1717
1666
|
// src/components/hooks/useComponentState.tsx
|
|
1718
|
-
var
|
|
1667
|
+
var React2 = __toModule(require("react"));
|
|
1719
1668
|
var import_react11 = __toModule(require("react"));
|
|
1720
1669
|
|
|
1721
1670
|
// src/utils/proxyFnCall.ts
|
|
@@ -1845,14 +1794,16 @@ function forwardProps2(propsToForward, props) {
|
|
|
1845
1794
|
return mappedState;
|
|
1846
1795
|
}
|
|
1847
1796
|
function getComponentStateRoot(config) {
|
|
1848
|
-
return
|
|
1797
|
+
return React2.memo(function ComponentStateRoot(props) {
|
|
1849
1798
|
var _a, _b;
|
|
1799
|
+
const [initialSetupState] = (0, import_react11.useState)(() => {
|
|
1800
|
+
return config.initSetupState ? config.initSetupState() : {};
|
|
1801
|
+
});
|
|
1850
1802
|
const propsToStateSetRef = (0, import_react11.useRef)(new Set());
|
|
1851
|
-
const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps() : {}, []);
|
|
1803
|
+
const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
1852
1804
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
1853
1805
|
const getParentState = useLatest(parentState);
|
|
1854
1806
|
const [wholeState] = (0, import_react11.useState)(() => {
|
|
1855
|
-
const initialSetupState = config.initSetupState ? config.initSetupState() : {};
|
|
1856
1807
|
let mappedState = {};
|
|
1857
1808
|
if (propsToForward) {
|
|
1858
1809
|
mappedState = forwardProps2(propsToForward, props);
|
|
@@ -1950,7 +1901,7 @@ function getComponentStateRoot(config) {
|
|
|
1950
1901
|
if (oldValue === newValue) {
|
|
1951
1902
|
continue;
|
|
1952
1903
|
}
|
|
1953
|
-
if (isControlled(key, props)) {
|
|
1904
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1954
1905
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1955
1906
|
let valueToSet = newValue;
|
|
1956
1907
|
const forwardFn = propsToForward[k];
|
|
@@ -1980,61 +1931,47 @@ function getComponentStateRoot(config) {
|
|
|
1980
1931
|
});
|
|
1981
1932
|
}
|
|
1982
1933
|
});
|
|
1983
|
-
return /* @__PURE__ */
|
|
1934
|
+
return /* @__PURE__ */ React2.createElement(Context.Provider, {
|
|
1984
1935
|
value: contextValue
|
|
1985
1936
|
}, props.children);
|
|
1986
1937
|
});
|
|
1987
1938
|
}
|
|
1988
1939
|
function useComponentState() {
|
|
1989
1940
|
const Context = getComponentStateContext();
|
|
1990
|
-
return
|
|
1941
|
+
return React2.useContext(Context);
|
|
1991
1942
|
}
|
|
1992
1943
|
|
|
1993
|
-
// src/components/
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
getter: (data) => colField ? data[colField] : data
|
|
2009
|
-
}, aggregator);
|
|
2010
|
-
reducers.push(newAggregator);
|
|
2011
|
-
});
|
|
2012
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
2013
|
-
}
|
|
2014
|
-
updateDataSourceAggregations();
|
|
2015
|
-
return interceptMap(columnAggregations, {
|
|
2016
|
-
clear: updateDataSourceAggregations,
|
|
2017
|
-
delete: updateDataSourceAggregations,
|
|
2018
|
-
set: updateDataSourceAggregations
|
|
2019
|
-
});
|
|
2020
|
-
}, [columnAggregations]);
|
|
1944
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1945
|
+
var React4 = __toModule(require("react"));
|
|
1946
|
+
|
|
1947
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1948
|
+
var React3 = __toModule(require("react"));
|
|
1949
|
+
var DSContext;
|
|
1950
|
+
function getDataSourceContext() {
|
|
1951
|
+
if (DSContext) {
|
|
1952
|
+
return DSContext;
|
|
1953
|
+
}
|
|
1954
|
+
return DSContext = React3.createContext({
|
|
1955
|
+
getState: () => null,
|
|
1956
|
+
componentState: null,
|
|
1957
|
+
componentActions: null
|
|
1958
|
+
});
|
|
2021
1959
|
}
|
|
2022
1960
|
|
|
2023
1961
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2024
|
-
var React5 = __toModule(require("react"));
|
|
2025
1962
|
function useDataSource() {
|
|
2026
1963
|
const DataSourceContext = getDataSourceContext();
|
|
2027
|
-
const contextValue =
|
|
1964
|
+
const contextValue = React4.useContext(DataSourceContext);
|
|
2028
1965
|
return contextValue.componentState;
|
|
2029
1966
|
}
|
|
2030
1967
|
function useDataSourceContextValue() {
|
|
2031
1968
|
const DataSourceContext = getDataSourceContext();
|
|
2032
|
-
const contextValue =
|
|
1969
|
+
const contextValue = React4.useContext(DataSourceContext);
|
|
2033
1970
|
return contextValue;
|
|
2034
1971
|
}
|
|
2035
1972
|
|
|
2036
1973
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
2037
|
-
var
|
|
1974
|
+
var import_react12 = __toModule(require("react"));
|
|
2038
1975
|
function useColumnGroups() {
|
|
2039
1976
|
const {
|
|
2040
1977
|
componentState: {
|
|
@@ -2044,7 +1981,7 @@ function useColumnGroups() {
|
|
|
2044
1981
|
componentActions,
|
|
2045
1982
|
getComponentState
|
|
2046
1983
|
} = useComponentState();
|
|
2047
|
-
(0,
|
|
1984
|
+
(0, import_react12.useEffect)(() => {
|
|
2048
1985
|
const recompute = () => {
|
|
2049
1986
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
2050
1987
|
};
|
|
@@ -2055,7 +1992,7 @@ function useColumnGroups() {
|
|
|
2055
1992
|
set: update
|
|
2056
1993
|
});
|
|
2057
1994
|
}, [computedColumnGroups]);
|
|
2058
|
-
(0,
|
|
1995
|
+
(0, import_react12.useEffect)(() => {
|
|
2059
1996
|
return interceptMap(collapsedColumnGroups, {
|
|
2060
1997
|
set: (key, visibleCol) => {
|
|
2061
1998
|
const colIds = key.slice(1);
|
|
@@ -2087,41 +2024,28 @@ function useColumnGroups() {
|
|
|
2087
2024
|
}
|
|
2088
2025
|
|
|
2089
2026
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2090
|
-
var
|
|
2027
|
+
var import_react18 = __toModule(require("react"));
|
|
2091
2028
|
|
|
2092
2029
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2093
|
-
var
|
|
2030
|
+
var React6 = __toModule(require("react"));
|
|
2094
2031
|
|
|
2095
2032
|
// src/utils/join.ts
|
|
2096
2033
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
2097
2034
|
|
|
2098
2035
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2099
|
-
var
|
|
2100
|
-
var
|
|
2036
|
+
var React5 = __toModule(require("react"));
|
|
2037
|
+
var import_react13 = __toModule(require("react"));
|
|
2101
2038
|
|
|
2102
|
-
// src/components/InfiniteTable/
|
|
2103
|
-
var
|
|
2104
|
-
var
|
|
2105
|
-
var
|
|
2106
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2107
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2108
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2109
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2110
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2111
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2112
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2113
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2114
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2115
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2116
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2117
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2118
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2039
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2040
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2041
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2042
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2119
2043
|
|
|
2120
2044
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2121
2045
|
function ExpanderIcon(props) {
|
|
2122
2046
|
var _a;
|
|
2123
2047
|
const { size = 24 } = props;
|
|
2124
|
-
const [expanded, setExpanded] = (0,
|
|
2048
|
+
const [expanded, setExpanded] = (0, import_react13.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
2125
2049
|
const onClick = () => {
|
|
2126
2050
|
var _a2;
|
|
2127
2051
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -2129,12 +2053,12 @@ function ExpanderIcon(props) {
|
|
|
2129
2053
|
setExpanded(!expanded);
|
|
2130
2054
|
}
|
|
2131
2055
|
};
|
|
2132
|
-
|
|
2056
|
+
React5.useEffect(() => {
|
|
2133
2057
|
if (isControlled("expanded", props)) {
|
|
2134
2058
|
setExpanded(props.expanded);
|
|
2135
2059
|
}
|
|
2136
2060
|
}, [props.expanded]);
|
|
2137
|
-
return /* @__PURE__ */
|
|
2061
|
+
return /* @__PURE__ */ React5.createElement("svg", {
|
|
2138
2062
|
"data-name": "expander-icon",
|
|
2139
2063
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2140
2064
|
height: `${size}px`,
|
|
@@ -2142,18 +2066,37 @@ function ExpanderIcon(props) {
|
|
|
2142
2066
|
width: `${size}px`,
|
|
2143
2067
|
style: props.style,
|
|
2144
2068
|
onClick,
|
|
2145
|
-
className: join(props.className,
|
|
2146
|
-
|
|
2069
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2070
|
+
expanded
|
|
2071
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2072
|
+
}, /* @__PURE__ */ React5.createElement("path", {
|
|
2147
2073
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2148
2074
|
}));
|
|
2149
2075
|
}
|
|
2150
2076
|
|
|
2151
2077
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2152
|
-
var
|
|
2078
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2153
2079
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2154
|
-
var RowClsRecipe = (0,
|
|
2080
|
+
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: [] });
|
|
2155
2081
|
var RowHoverCls = "_7pupv01";
|
|
2156
2082
|
|
|
2083
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2084
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2085
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2086
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2087
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2088
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2089
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2090
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2091
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2092
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2093
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2094
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2095
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2096
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2097
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2098
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2099
|
+
|
|
2157
2100
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2158
2101
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2159
2102
|
if (!pivotColumns) {
|
|
@@ -2163,7 +2106,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2163
2106
|
pivotColumn,
|
|
2164
2107
|
pivotRowLabelsColumn,
|
|
2165
2108
|
pivotBy,
|
|
2166
|
-
|
|
2109
|
+
groupBy,
|
|
2167
2110
|
pivotTotalColumnPosition,
|
|
2168
2111
|
toggleGroupRow
|
|
2169
2112
|
} = params;
|
|
@@ -2180,7 +2123,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2180
2123
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2181
2124
|
column,
|
|
2182
2125
|
pivotBy,
|
|
2183
|
-
|
|
2126
|
+
groupBy
|
|
2184
2127
|
}));
|
|
2185
2128
|
} else {
|
|
2186
2129
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2192,7 +2135,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2192
2135
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2193
2136
|
column,
|
|
2194
2137
|
pivotBy,
|
|
2195
|
-
|
|
2138
|
+
groupBy
|
|
2196
2139
|
}));
|
|
2197
2140
|
} else {
|
|
2198
2141
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2201,19 +2144,19 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2201
2144
|
if (!column.render) {
|
|
2202
2145
|
column.render = (renderOptions) => {
|
|
2203
2146
|
var _a;
|
|
2204
|
-
let { value, rowInfo, column: column2,
|
|
2147
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2205
2148
|
if (column2.renderValue) {
|
|
2206
2149
|
value = column2.renderValue(renderOptions);
|
|
2207
2150
|
}
|
|
2208
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2209
|
-
return /* @__PURE__ */
|
|
2151
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2152
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
2210
2153
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2211
|
-
}, showExpanderIcon ? /* @__PURE__ */
|
|
2154
|
+
}, showExpanderIcon ? /* @__PURE__ */ React6.createElement(ExpanderIcon, {
|
|
2212
2155
|
expanded: !rowInfo.collapsed,
|
|
2213
2156
|
onChange: () => {
|
|
2214
2157
|
toggleGroupRow(rowInfo.groupKeys);
|
|
2215
2158
|
}
|
|
2216
|
-
}) : null, /* @__PURE__ */
|
|
2159
|
+
}) : null, /* @__PURE__ */ React6.createElement("div", {
|
|
2217
2160
|
className: cssEllipsisClassName
|
|
2218
2161
|
}, value != null ? value : null));
|
|
2219
2162
|
};
|
|
@@ -2230,7 +2173,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2230
2173
|
}
|
|
2231
2174
|
|
|
2232
2175
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
2233
|
-
var
|
|
2176
|
+
var React7 = __toModule(require("react"));
|
|
2234
2177
|
function getGroupColumnRender({
|
|
2235
2178
|
groupIndexForColumn,
|
|
2236
2179
|
groupRenderStrategy,
|
|
@@ -2263,14 +2206,14 @@ function getGroupColumnRender({
|
|
|
2263
2206
|
return null;
|
|
2264
2207
|
}
|
|
2265
2208
|
}
|
|
2266
|
-
return /* @__PURE__ */
|
|
2209
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2267
2210
|
className: join(display.flex, alignItems.center)
|
|
2268
|
-
}, /* @__PURE__ */
|
|
2211
|
+
}, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2269
2212
|
expanded: !collapsed,
|
|
2270
2213
|
onChange: () => {
|
|
2271
2214
|
toggleGroupRow(groupKeys);
|
|
2272
2215
|
}
|
|
2273
|
-
}), /* @__PURE__ */
|
|
2216
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
2274
2217
|
className: cssEllipsisClassName
|
|
2275
2218
|
}, value != null ? value : null));
|
|
2276
2219
|
};
|
|
@@ -2303,7 +2246,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2303
2246
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2304
2247
|
let generatedGroupColumn = {
|
|
2305
2248
|
header: `Group`,
|
|
2306
|
-
groupByField: options.
|
|
2249
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2307
2250
|
sortable: false,
|
|
2308
2251
|
render: (renderOptions) => {
|
|
2309
2252
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2313,14 +2256,14 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2313
2256
|
if (column.renderValue) {
|
|
2314
2257
|
value = column.renderValue(renderOptions);
|
|
2315
2258
|
}
|
|
2316
|
-
return /* @__PURE__ */
|
|
2259
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
2317
2260
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2318
|
-
}, /* @__PURE__ */
|
|
2261
|
+
}, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
|
|
2319
2262
|
expanded: !rowInfo.collapsed,
|
|
2320
2263
|
onChange: () => {
|
|
2321
2264
|
toggleGroupRow(rowInfo.groupKeys);
|
|
2322
2265
|
}
|
|
2323
|
-
}), /* @__PURE__ */
|
|
2266
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
2324
2267
|
className: cssEllipsisClassName
|
|
2325
2268
|
}, value != null ? value : null));
|
|
2326
2269
|
}
|
|
@@ -2336,10 +2279,10 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2336
2279
|
}
|
|
2337
2280
|
|
|
2338
2281
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2339
|
-
var
|
|
2282
|
+
var import_react17 = __toModule(require("react"));
|
|
2340
2283
|
|
|
2341
2284
|
// src/components/DataSource/index.tsx
|
|
2342
|
-
var
|
|
2285
|
+
var React8 = __toModule(require("react"));
|
|
2343
2286
|
|
|
2344
2287
|
// src/utils/multisort/sortTypes.ts
|
|
2345
2288
|
var numberComparator = function(first, second) {
|
|
@@ -2416,15 +2359,15 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
2416
2359
|
};
|
|
2417
2360
|
|
|
2418
2361
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2419
|
-
var
|
|
2362
|
+
var import_react15 = __toModule(require("react"));
|
|
2420
2363
|
|
|
2421
2364
|
// src/components/hooks/useEffectWithChanges.ts
|
|
2422
|
-
var
|
|
2365
|
+
var import_react14 = __toModule(require("react"));
|
|
2423
2366
|
function useEffectWithChanges(fn, deps) {
|
|
2424
|
-
const prevRef = (0,
|
|
2425
|
-
const oldValuesRef = (0,
|
|
2367
|
+
const prevRef = (0, import_react14.useRef)({});
|
|
2368
|
+
const oldValuesRef = (0, import_react14.useRef)({});
|
|
2426
2369
|
const oldValues = oldValuesRef.current;
|
|
2427
|
-
const changesRef = (0,
|
|
2370
|
+
const changesRef = (0, import_react14.useRef)({});
|
|
2428
2371
|
const changes = changesRef.current;
|
|
2429
2372
|
const useEffectDeps = [];
|
|
2430
2373
|
for (let k in deps) {
|
|
@@ -2437,7 +2380,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
2437
2380
|
}
|
|
2438
2381
|
}
|
|
2439
2382
|
prevRef.current = deps;
|
|
2440
|
-
(0,
|
|
2383
|
+
(0, import_react14.useEffect)(() => {
|
|
2441
2384
|
const changes2 = changesRef.current;
|
|
2442
2385
|
const result = fn(changes2, oldValues);
|
|
2443
2386
|
changesRef.current = {};
|
|
@@ -2447,26 +2390,38 @@ function useEffectWithChanges(fn, deps) {
|
|
|
2447
2390
|
}
|
|
2448
2391
|
|
|
2449
2392
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2450
|
-
|
|
2393
|
+
var debug3 = dbg("DataSource:useLoadData");
|
|
2394
|
+
function anonimizeValues(arg) {
|
|
2395
|
+
const result = {};
|
|
2396
|
+
for (var k in arg)
|
|
2397
|
+
if (arg.hasOwnProperty(k)) {
|
|
2398
|
+
result[k] = true;
|
|
2399
|
+
}
|
|
2400
|
+
return result;
|
|
2401
|
+
}
|
|
2402
|
+
function buildDataSourceDataParams(componentState, changes) {
|
|
2451
2403
|
var _a, _b;
|
|
2452
2404
|
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2453
2405
|
const dataSourceParams = {
|
|
2454
2406
|
originalDataArray: componentState.originalDataArray,
|
|
2455
2407
|
sortInfo,
|
|
2456
|
-
|
|
2408
|
+
groupBy: componentState.groupBy,
|
|
2457
2409
|
pivotBy: componentState.pivotBy
|
|
2458
2410
|
};
|
|
2459
2411
|
if (componentState.livePagination !== void 0) {
|
|
2460
2412
|
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2461
2413
|
}
|
|
2414
|
+
if (changes !== void 0) {
|
|
2415
|
+
dataSourceParams.changes = changes;
|
|
2416
|
+
}
|
|
2462
2417
|
return dataSourceParams;
|
|
2463
2418
|
}
|
|
2464
|
-
function notifyDataParamsChanged(componentState, actions) {
|
|
2419
|
+
function notifyDataParamsChanged(componentState, actions, changes) {
|
|
2465
2420
|
var _a;
|
|
2466
2421
|
if (typeof componentState.data === "function") {
|
|
2467
2422
|
loadData(componentState.data, componentState, actions);
|
|
2468
2423
|
}
|
|
2469
|
-
const dataParams = buildDataSourceDataParams(componentState);
|
|
2424
|
+
const dataParams = buildDataSourceDataParams(componentState, changes);
|
|
2470
2425
|
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2471
2426
|
}
|
|
2472
2427
|
function loadData(data, componentState, actions) {
|
|
@@ -2501,7 +2456,7 @@ function useLoadData() {
|
|
|
2501
2456
|
componentActions: actions,
|
|
2502
2457
|
componentState: { data }
|
|
2503
2458
|
} = useComponentState();
|
|
2504
|
-
(0,
|
|
2459
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
2505
2460
|
loadData(data, getComponentState(), actions);
|
|
2506
2461
|
}, [data]);
|
|
2507
2462
|
useLivePagination();
|
|
@@ -2515,17 +2470,17 @@ function useLivePagination() {
|
|
|
2515
2470
|
const {
|
|
2516
2471
|
notifyScrollbarsChange,
|
|
2517
2472
|
sortInfo,
|
|
2518
|
-
|
|
2473
|
+
groupBy,
|
|
2519
2474
|
pivotBy,
|
|
2520
2475
|
livePaginationCursor,
|
|
2521
2476
|
scrollBottomId
|
|
2522
2477
|
} = componentState;
|
|
2523
|
-
const [scrollbars, setScrollbars] = (0,
|
|
2478
|
+
const [scrollbars, setScrollbars] = (0, import_react15.useState)({
|
|
2524
2479
|
vertical: false,
|
|
2525
2480
|
horizontal: false
|
|
2526
2481
|
});
|
|
2527
|
-
const scrollbarsRef = (0,
|
|
2528
|
-
(0,
|
|
2482
|
+
const scrollbarsRef = (0, import_react15.useRef)(scrollbars);
|
|
2483
|
+
(0, import_react15.useEffect)(() => {
|
|
2529
2484
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2530
2485
|
if (!scrollbars2) {
|
|
2531
2486
|
return;
|
|
@@ -2535,8 +2490,8 @@ function useLivePagination() {
|
|
|
2535
2490
|
});
|
|
2536
2491
|
return () => notifyScrollbarsChange.destroy();
|
|
2537
2492
|
}, [notifyScrollbarsChange]);
|
|
2538
|
-
const [cursorId, updateCursorId] = (0,
|
|
2539
|
-
(0,
|
|
2493
|
+
const [cursorId, updateCursorId] = (0, import_react15.useState)(void 0);
|
|
2494
|
+
(0, import_react15.useEffect)(() => {
|
|
2540
2495
|
const frameId = requestAnimationFrame(() => {
|
|
2541
2496
|
var _a;
|
|
2542
2497
|
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
@@ -2545,37 +2500,49 @@ function useLivePagination() {
|
|
|
2545
2500
|
});
|
|
2546
2501
|
return () => cancelAnimationFrame(frameId);
|
|
2547
2502
|
}, [livePaginationCursor]);
|
|
2548
|
-
(0,
|
|
2503
|
+
(0, import_react15.useEffect)(() => {
|
|
2549
2504
|
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2550
2505
|
if (!scrollbars.vertical && livePagination) {
|
|
2551
2506
|
updateCursorId(livePaginationCursor2);
|
|
2552
2507
|
}
|
|
2553
2508
|
}, [scrollbars.vertical]);
|
|
2554
|
-
(0,
|
|
2509
|
+
(0, import_react15.useEffect)(() => {
|
|
2555
2510
|
updateCursorId(scrollBottomId);
|
|
2556
2511
|
}, [scrollBottomId]);
|
|
2557
2512
|
const depsObject = {
|
|
2558
2513
|
sortInfo,
|
|
2559
|
-
|
|
2514
|
+
groupBy,
|
|
2560
2515
|
pivotBy,
|
|
2561
|
-
cursorId
|
|
2516
|
+
livePaginationCursor: cursorId
|
|
2562
2517
|
};
|
|
2563
|
-
useEffectWithChanges(() => {
|
|
2518
|
+
useEffectWithChanges((changes, prevValues) => {
|
|
2564
2519
|
if (cursorId === void 0) {
|
|
2565
2520
|
return;
|
|
2566
2521
|
}
|
|
2567
|
-
|
|
2522
|
+
debug3("onDataParamsChange triggered because the following values have changed", changes, "old values", prevValues);
|
|
2523
|
+
notifyDataParamsChanged(getComponentState(), actions, anonimizeValues(changes));
|
|
2568
2524
|
}, depsObject);
|
|
2569
2525
|
}
|
|
2570
2526
|
|
|
2571
2527
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
2572
|
-
var
|
|
2573
|
-
|
|
2574
|
-
|
|
2528
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
2529
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
2530
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
2531
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
2532
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
2533
|
+
const prevResult = weakMap.get(sortInfo);
|
|
2534
|
+
if (prevResult && prevResult.length === result.length) {
|
|
2535
|
+
return prevResult;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
if (weakMap && sortInfo) {
|
|
2539
|
+
weakMap.set(sortInfo, result);
|
|
2540
|
+
}
|
|
2541
|
+
return result;
|
|
2575
2542
|
};
|
|
2576
2543
|
|
|
2577
2544
|
// src/components/hooks/useOnce.ts
|
|
2578
|
-
var
|
|
2545
|
+
var import_react16 = __toModule(require("react"));
|
|
2579
2546
|
function once(fn) {
|
|
2580
2547
|
let called = false;
|
|
2581
2548
|
let result = null;
|
|
@@ -2590,7 +2557,7 @@ function once(fn) {
|
|
|
2590
2557
|
return onceFn;
|
|
2591
2558
|
}
|
|
2592
2559
|
function useOnce(fn) {
|
|
2593
|
-
const onceFn = (0,
|
|
2560
|
+
const onceFn = (0, import_react16.useMemo)(() => {
|
|
2594
2561
|
return once(fn);
|
|
2595
2562
|
}, []);
|
|
2596
2563
|
return onceFn();
|
|
@@ -2637,6 +2604,13 @@ var DeepMap = class {
|
|
|
2637
2604
|
});
|
|
2638
2605
|
}
|
|
2639
2606
|
}
|
|
2607
|
+
static clone(map2) {
|
|
2608
|
+
const clone = new DeepMap();
|
|
2609
|
+
map2.visit((pair, keys) => {
|
|
2610
|
+
clone.set(keys, pair.value);
|
|
2611
|
+
});
|
|
2612
|
+
return clone;
|
|
2613
|
+
}
|
|
2640
2614
|
set(keys, value) {
|
|
2641
2615
|
let currentMap = this.map;
|
|
2642
2616
|
if (!keys.length) {
|
|
@@ -3013,6 +2987,10 @@ function initSetupState2() {
|
|
|
3013
2987
|
pivotTotalColumnPosition: "end",
|
|
3014
2988
|
originalDataArray,
|
|
3015
2989
|
scrollBottomId: Symbol("scrollBottomId"),
|
|
2990
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
2991
|
+
propsCache: new Map([
|
|
2992
|
+
["sortInfo", new WeakMap()]
|
|
2993
|
+
]),
|
|
3016
2994
|
pivotColumns: void 0,
|
|
3017
2995
|
pivotColumnGroups: void 0,
|
|
3018
2996
|
dataArray,
|
|
@@ -3021,7 +2999,6 @@ function initSetupState2() {
|
|
|
3021
2999
|
sortedAt: 0,
|
|
3022
3000
|
reducedAt: now,
|
|
3023
3001
|
generateGroupRows: true,
|
|
3024
|
-
aggregationReducers: void 0,
|
|
3025
3002
|
groupDeepMap: void 0,
|
|
3026
3003
|
postSortDataArray: void 0,
|
|
3027
3004
|
postGroupDataArray: void 0,
|
|
@@ -3034,18 +3011,17 @@ function getCompareObject(dataParams) {
|
|
|
3034
3011
|
delete obj.originalDataArray;
|
|
3035
3012
|
return obj;
|
|
3036
3013
|
}
|
|
3037
|
-
var forwardProps3 = () => {
|
|
3014
|
+
var forwardProps3 = (setupState) => {
|
|
3038
3015
|
return {
|
|
3039
3016
|
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
3040
|
-
remoteCount: 1,
|
|
3041
3017
|
data: 1,
|
|
3042
3018
|
pivotBy: 1,
|
|
3043
3019
|
primaryKey: 1,
|
|
3044
3020
|
livePagination: 1,
|
|
3045
|
-
|
|
3021
|
+
aggregationReducers: 1,
|
|
3046
3022
|
loading: (loading) => loading != null ? loading : false,
|
|
3047
|
-
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
3048
|
-
|
|
3023
|
+
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
3024
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
3049
3025
|
groupRowsState: (groupRowsState) => {
|
|
3050
3026
|
return groupRowsState || new GroupRowsState({
|
|
3051
3027
|
expandedRows: true,
|
|
@@ -3055,12 +3031,21 @@ var forwardProps3 = () => {
|
|
|
3055
3031
|
};
|
|
3056
3032
|
};
|
|
3057
3033
|
function mapPropsToState2(params) {
|
|
3058
|
-
const { props } = params;
|
|
3034
|
+
const { props, state } = params;
|
|
3059
3035
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
3060
|
-
|
|
3036
|
+
const result = {
|
|
3061
3037
|
controlledSort,
|
|
3062
3038
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3063
3039
|
};
|
|
3040
|
+
if (props.livePagination) {
|
|
3041
|
+
const livePaginationCursor = typeof props.livePaginationCursor === "function" ? props.livePaginationCursor({
|
|
3042
|
+
array: state.originalDataArray,
|
|
3043
|
+
length: state.originalDataArray.length,
|
|
3044
|
+
lastItem: state.originalDataArray[state.originalDataArray.length - 1]
|
|
3045
|
+
}) : props.livePaginationCursor;
|
|
3046
|
+
result.livePaginationCursor = livePaginationCursor;
|
|
3047
|
+
}
|
|
3048
|
+
return result;
|
|
3064
3049
|
}
|
|
3065
3050
|
function getInterceptActions() {
|
|
3066
3051
|
return {
|
|
@@ -3077,19 +3062,28 @@ function DEFAULT_TO_KEY(value) {
|
|
|
3077
3062
|
return value;
|
|
3078
3063
|
}
|
|
3079
3064
|
function initReducers(reducers) {
|
|
3080
|
-
if (!reducers || !reducers.length) {
|
|
3081
|
-
return
|
|
3065
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3066
|
+
return {};
|
|
3082
3067
|
}
|
|
3083
|
-
|
|
3068
|
+
const result = {};
|
|
3069
|
+
for (let key in reducers)
|
|
3070
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3071
|
+
result[key] = reducers[key].initialValue;
|
|
3072
|
+
}
|
|
3073
|
+
return result;
|
|
3084
3074
|
}
|
|
3085
3075
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
3086
|
-
|
|
3076
|
+
var _a, _b;
|
|
3077
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3087
3078
|
return;
|
|
3088
3079
|
}
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3080
|
+
for (let key in reducers)
|
|
3081
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3082
|
+
const reducer = reducers[key];
|
|
3083
|
+
const currentValue = reducerResults[key];
|
|
3084
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3085
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3086
|
+
}
|
|
3093
3087
|
}
|
|
3094
3088
|
function group(groupParams, data) {
|
|
3095
3089
|
const {
|
|
@@ -3104,7 +3098,7 @@ function group(groupParams, data) {
|
|
|
3104
3098
|
let currentGroupKeys = [];
|
|
3105
3099
|
let currentPivotKeys = [];
|
|
3106
3100
|
const initialReducerValue = initReducers(reducers);
|
|
3107
|
-
const globalReducerResults =
|
|
3101
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
3108
3102
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
3109
3103
|
let item = data[i];
|
|
3110
3104
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -3114,7 +3108,7 @@ function group(groupParams, data) {
|
|
|
3114
3108
|
if (!deepMap.has(currentGroupKeys)) {
|
|
3115
3109
|
const deepMapGroupValue = {
|
|
3116
3110
|
items: [],
|
|
3117
|
-
reducerResults:
|
|
3111
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
3118
3112
|
};
|
|
3119
3113
|
if (pivot) {
|
|
3120
3114
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -3138,7 +3132,7 @@ function group(groupParams, data) {
|
|
|
3138
3132
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3139
3133
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3140
3134
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3141
|
-
reducerResults:
|
|
3135
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3142
3136
|
items: []
|
|
3143
3137
|
});
|
|
3144
3138
|
}
|
|
@@ -3200,11 +3194,23 @@ function flatten(groupResult) {
|
|
|
3200
3194
|
return result;
|
|
3201
3195
|
}
|
|
3202
3196
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
3203
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
3197
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
3204
3198
|
const groupNesting = groupKeys.length;
|
|
3205
3199
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3200
|
+
let data = null;
|
|
3201
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
3202
|
+
data = {};
|
|
3203
|
+
for (let key in reducers)
|
|
3204
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3205
|
+
const reducer = reducers[key];
|
|
3206
|
+
const field = reducer.field;
|
|
3207
|
+
if (field) {
|
|
3208
|
+
data[field] = reducerResults[key];
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3206
3212
|
const enhancedGroupData = {
|
|
3207
|
-
data
|
|
3213
|
+
data,
|
|
3208
3214
|
groupCount: groupItems.length,
|
|
3209
3215
|
groupData: groupItems,
|
|
3210
3216
|
groupKeys,
|
|
@@ -3226,17 +3232,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
3226
3232
|
return enhancedGroupData;
|
|
3227
3233
|
}
|
|
3228
3234
|
function completeReducers(reducers, reducerResults, items) {
|
|
3229
|
-
if (reducers
|
|
3230
|
-
|
|
3231
|
-
if (
|
|
3232
|
-
|
|
3235
|
+
if (reducers) {
|
|
3236
|
+
for (let key in reducers)
|
|
3237
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3238
|
+
const reducer = reducers[key];
|
|
3239
|
+
if (reducer.done) {
|
|
3240
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
3241
|
+
}
|
|
3233
3242
|
}
|
|
3234
|
-
});
|
|
3235
3243
|
}
|
|
3236
3244
|
return reducerResults;
|
|
3237
3245
|
}
|
|
3238
3246
|
function enhancedFlatten(param) {
|
|
3239
|
-
const {
|
|
3247
|
+
const {
|
|
3248
|
+
groupResult,
|
|
3249
|
+
toPrimaryKey,
|
|
3250
|
+
groupRowsState,
|
|
3251
|
+
generateGroupRows,
|
|
3252
|
+
reducers = {}
|
|
3253
|
+
} = param;
|
|
3240
3254
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
3241
3255
|
const { groupBy } = groupParams;
|
|
3242
3256
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -3251,6 +3265,7 @@ function enhancedFlatten(param) {
|
|
|
3251
3265
|
const enhancedGroupData = getEnhancedGroupData({
|
|
3252
3266
|
groupBy: groupByStrings,
|
|
3253
3267
|
parents: Array.from(parents),
|
|
3268
|
+
reducers,
|
|
3254
3269
|
indexInGroup,
|
|
3255
3270
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3256
3271
|
indexInAll: result.length,
|
|
@@ -3303,13 +3318,45 @@ function enhancedFlatten(param) {
|
|
|
3303
3318
|
}
|
|
3304
3319
|
|
|
3305
3320
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3306
|
-
function
|
|
3321
|
+
function prepareColumn(column) {
|
|
3322
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3323
|
+
if (pivotByForColumn.column) {
|
|
3324
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3325
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3326
|
+
} else {
|
|
3327
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
return column;
|
|
3331
|
+
}
|
|
3332
|
+
function prepareColumnGroup(columnGroup) {
|
|
3333
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3334
|
+
if (pivotByForColumnGroup.columnGroup) {
|
|
3335
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3336
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3337
|
+
} else {
|
|
3338
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
return columnGroup;
|
|
3342
|
+
}
|
|
3343
|
+
function getPivotColumnsAndColumnGroups({
|
|
3344
|
+
deepMap,
|
|
3345
|
+
pivotBy,
|
|
3346
|
+
pivotTotalColumnPosition,
|
|
3347
|
+
reducers = {},
|
|
3348
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3349
|
+
}) {
|
|
3307
3350
|
const pivotLength = pivotBy.length;
|
|
3351
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3352
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3353
|
+
});
|
|
3308
3354
|
const columns = new Map([
|
|
3309
3355
|
[
|
|
3310
3356
|
"labels",
|
|
3311
3357
|
{
|
|
3312
3358
|
header: "Row labels",
|
|
3359
|
+
pivotBy,
|
|
3313
3360
|
valueGetter: (params) => {
|
|
3314
3361
|
var _a;
|
|
3315
3362
|
const { rowInfo } = params;
|
|
@@ -3319,72 +3366,104 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3319
3366
|
]
|
|
3320
3367
|
]);
|
|
3321
3368
|
const columnGroups = new Map();
|
|
3369
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3322
3370
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3323
3371
|
keys = [...keys];
|
|
3324
3372
|
if (pivotTotalColumnPosition === "end") {
|
|
3325
3373
|
next == null ? void 0 : next();
|
|
3326
3374
|
}
|
|
3327
3375
|
if (keys.length === pivotLength) {
|
|
3328
|
-
const parentKeys = keys.slice(0, -1);
|
|
3329
|
-
let columnGroupId = parentKeys.join("/");
|
|
3330
3376
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3331
|
-
let computedPivotColumn = __spreadValues({
|
|
3332
|
-
pivotBy,
|
|
3333
|
-
pivotColumn: true,
|
|
3334
|
-
pivotGroupKeys: keys,
|
|
3335
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3336
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3337
|
-
pivotByForColumn,
|
|
3338
|
-
sortable: false,
|
|
3339
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3340
|
-
header: keys[keys.length - 1],
|
|
3341
|
-
valueGetter: ({ rowInfo }) => {
|
|
3342
|
-
var _a, _b, _c;
|
|
3343
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3344
|
-
return value;
|
|
3345
|
-
}
|
|
3346
|
-
}, pivotByForColumn.column);
|
|
3347
|
-
if (pivotByForColumn.column) {
|
|
3348
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3349
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3350
|
-
} else {
|
|
3351
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3352
|
-
}
|
|
3353
|
-
}
|
|
3354
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3355
|
-
} else {
|
|
3356
|
-
const colGroupId = keys.join("/");
|
|
3357
3377
|
const parentKeys = keys.slice(0, -1);
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
columnGroup:
|
|
3366
|
-
|
|
3367
|
-
pivotTotalColumn: true,
|
|
3378
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3379
|
+
if (!isSingleAggregationColumn) {
|
|
3380
|
+
const columnGroupId = parentColumnGroupId;
|
|
3381
|
+
parentColumnGroupId = keys.join("/");
|
|
3382
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3383
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3384
|
+
header: pivotGroupKey,
|
|
3385
|
+
columnGroup: columnGroupId,
|
|
3386
|
+
pivotBy,
|
|
3368
3387
|
pivotGroupKeys: keys,
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3388
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3389
|
+
pivotIndex: keys.length - 1,
|
|
3390
|
+
pivotGroupKey
|
|
3391
|
+
}));
|
|
3392
|
+
}
|
|
3393
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3394
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3395
|
+
const computedPivotColumn = prepareColumn({
|
|
3372
3396
|
pivotBy,
|
|
3397
|
+
pivotColumn: true,
|
|
3398
|
+
pivotTotalColumn: false,
|
|
3399
|
+
pivotAggregator: reducer,
|
|
3400
|
+
pivotAggregatorIndex: index,
|
|
3401
|
+
pivotGroupKeys: keys,
|
|
3402
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3403
|
+
pivotIndex: keys.length - 1,
|
|
3404
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3373
3405
|
sortable: false,
|
|
3406
|
+
columnGroup: parentColumnGroupId,
|
|
3407
|
+
header,
|
|
3374
3408
|
valueGetter: ({ rowInfo }) => {
|
|
3375
|
-
var _a, _b
|
|
3376
|
-
|
|
3377
|
-
return value;
|
|
3378
|
-
}
|
|
3379
|
-
}, pivotByForColumn.column);
|
|
3380
|
-
if (pivotByForColumn.column) {
|
|
3381
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3382
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3383
|
-
} else {
|
|
3384
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3409
|
+
var _a, _b;
|
|
3410
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3385
3411
|
}
|
|
3412
|
+
});
|
|
3413
|
+
const columnId = `${keys.join("/")}-${reducer.id}`;
|
|
3414
|
+
columns.set(columnId, computedPivotColumn);
|
|
3415
|
+
});
|
|
3416
|
+
} else {
|
|
3417
|
+
const colGroupId = keys.join("/");
|
|
3418
|
+
const parentKeys = keys.slice(0, -1);
|
|
3419
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3420
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3421
|
+
header: keys[keys.length - 1],
|
|
3422
|
+
pivotBy,
|
|
3423
|
+
pivotGroupKeys: keys,
|
|
3424
|
+
pivotIndex: keys.length - 1,
|
|
3425
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3426
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3427
|
+
}));
|
|
3428
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3429
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3430
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3431
|
+
if (!isSingleAggregationColumn) {
|
|
3432
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3433
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3434
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3435
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3436
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3437
|
+
pivotBy,
|
|
3438
|
+
pivotTotalColumnGroup: true,
|
|
3439
|
+
pivotGroupKeys: keys,
|
|
3440
|
+
pivotIndex: keys.length - 1,
|
|
3441
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3442
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3443
|
+
}));
|
|
3386
3444
|
}
|
|
3387
|
-
|
|
3445
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3446
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3447
|
+
const computedPivotColumn = prepareColumn({
|
|
3448
|
+
columnGroup: columnGroupId,
|
|
3449
|
+
header,
|
|
3450
|
+
pivotAggregator: reducer,
|
|
3451
|
+
pivotAggregatorIndex: index,
|
|
3452
|
+
pivotColumn: true,
|
|
3453
|
+
pivotTotalColumn: true,
|
|
3454
|
+
pivotGroupKeys: keys,
|
|
3455
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3456
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3457
|
+
pivotIndex: keys.length - 1,
|
|
3458
|
+
pivotBy,
|
|
3459
|
+
sortable: false,
|
|
3460
|
+
valueGetter: ({ rowInfo }) => {
|
|
3461
|
+
var _a, _b;
|
|
3462
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3463
|
+
}
|
|
3464
|
+
});
|
|
3465
|
+
columns.set(`total:${keys.join("/")}-${reducer.id}`, computedPivotColumn);
|
|
3466
|
+
});
|
|
3388
3467
|
}
|
|
3389
3468
|
}
|
|
3390
3469
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3394,9 +3473,12 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3394
3473
|
if (columns.size === 1) {
|
|
3395
3474
|
columns.set("single", {
|
|
3396
3475
|
header: "Reduced",
|
|
3476
|
+
pivotBy,
|
|
3477
|
+
pivotColumn: true,
|
|
3397
3478
|
valueGetter: ({ rowInfo }) => {
|
|
3398
3479
|
var _a;
|
|
3399
|
-
|
|
3480
|
+
const key = Object.keys(rowInfo.reducerResults || {})[0];
|
|
3481
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[key];
|
|
3400
3482
|
}
|
|
3401
3483
|
});
|
|
3402
3484
|
}
|
|
@@ -3420,7 +3502,14 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3420
3502
|
return false;
|
|
3421
3503
|
};
|
|
3422
3504
|
function toRowInfo(data, id, index) {
|
|
3423
|
-
return {
|
|
3505
|
+
return {
|
|
3506
|
+
data,
|
|
3507
|
+
collapsed: true,
|
|
3508
|
+
id,
|
|
3509
|
+
indexInAll: index,
|
|
3510
|
+
indexInGroup: index,
|
|
3511
|
+
isGroupRow: false
|
|
3512
|
+
};
|
|
3424
3513
|
}
|
|
3425
3514
|
function concludeReducer(params) {
|
|
3426
3515
|
var _a;
|
|
@@ -3432,17 +3521,18 @@ function concludeReducer(params) {
|
|
|
3432
3521
|
"sortInfo"
|
|
3433
3522
|
]);
|
|
3434
3523
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3435
|
-
const groupBy = state.
|
|
3524
|
+
const groupBy = state.groupBy;
|
|
3436
3525
|
const pivotBy = state.pivotBy;
|
|
3437
3526
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3438
3527
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3439
3528
|
"generateGroupRows",
|
|
3440
3529
|
"originalDataArray",
|
|
3441
|
-
"
|
|
3530
|
+
"groupBy",
|
|
3442
3531
|
"groupRowsState",
|
|
3443
3532
|
"pivotBy",
|
|
3444
3533
|
"aggregationReducers",
|
|
3445
3534
|
"pivotTotalColumnPosition",
|
|
3535
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3446
3536
|
"sortInfo"
|
|
3447
3537
|
]);
|
|
3448
3538
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3468,13 +3558,20 @@ function concludeReducer(params) {
|
|
|
3468
3558
|
}, dataArray);
|
|
3469
3559
|
const flattenResult = enhancedFlatten({
|
|
3470
3560
|
groupResult,
|
|
3561
|
+
reducers: state.aggregationReducers,
|
|
3471
3562
|
toPrimaryKey,
|
|
3472
3563
|
groupRowsState: state.groupRowsState,
|
|
3473
3564
|
generateGroupRows: state.generateGroupRows
|
|
3474
3565
|
});
|
|
3475
3566
|
rowInfoDataArray = flattenResult.data;
|
|
3476
3567
|
state.groupDeepMap = groupResult.deepMap;
|
|
3477
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3568
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3569
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3570
|
+
pivotBy,
|
|
3571
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3572
|
+
reducers: state.aggregationReducers,
|
|
3573
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3574
|
+
}) : void 0;
|
|
3478
3575
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3479
3576
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3480
3577
|
} else {
|
|
@@ -3515,7 +3612,7 @@ function DataSourceWithContext(props) {
|
|
|
3515
3612
|
if (typeof children === "function") {
|
|
3516
3613
|
children = children(computedValues);
|
|
3517
3614
|
}
|
|
3518
|
-
return /* @__PURE__ */
|
|
3615
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children);
|
|
3519
3616
|
}
|
|
3520
3617
|
var DataSourceRoot = getComponentStateRoot({
|
|
3521
3618
|
initSetupState: initSetupState2,
|
|
@@ -3537,14 +3634,14 @@ function DataSourceCmp({ children }) {
|
|
|
3537
3634
|
globalThis.getDataSourceState = getState;
|
|
3538
3635
|
}
|
|
3539
3636
|
useLoadData();
|
|
3540
|
-
return /* @__PURE__ */
|
|
3637
|
+
return /* @__PURE__ */ React8.createElement(DataSourceContext.Provider, {
|
|
3541
3638
|
value: contextValue
|
|
3542
|
-
}, /* @__PURE__ */
|
|
3639
|
+
}, /* @__PURE__ */ React8.createElement(DataSourceWithContext, {
|
|
3543
3640
|
children
|
|
3544
3641
|
}));
|
|
3545
3642
|
}
|
|
3546
3643
|
function DataSource(props) {
|
|
3547
|
-
return /* @__PURE__ */
|
|
3644
|
+
return /* @__PURE__ */ React8.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React8.createElement(DataSourceCmp, {
|
|
3548
3645
|
children: props.children
|
|
3549
3646
|
}));
|
|
3550
3647
|
}
|
|
@@ -3552,7 +3649,7 @@ function DataSource(props) {
|
|
|
3552
3649
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3553
3650
|
function useToggleGroupRow() {
|
|
3554
3651
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3555
|
-
const toggleGroupRow = (0,
|
|
3652
|
+
const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
|
|
3556
3653
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
3557
3654
|
newState.toggleGroupRow(groupKeys);
|
|
3558
3655
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -3561,49 +3658,49 @@ function useToggleGroupRow() {
|
|
|
3561
3658
|
}
|
|
3562
3659
|
|
|
3563
3660
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3564
|
-
function
|
|
3565
|
-
const
|
|
3566
|
-
return
|
|
3567
|
-
acc.set(
|
|
3568
|
-
groupBy,
|
|
3661
|
+
function useGroupByMap(groupBy) {
|
|
3662
|
+
const groupByMap = (0, import_react18.useMemo)(() => {
|
|
3663
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3664
|
+
acc.set(groupBy2.field, {
|
|
3665
|
+
groupBy: groupBy2,
|
|
3569
3666
|
groupIndex: index
|
|
3570
3667
|
});
|
|
3571
3668
|
return acc;
|
|
3572
3669
|
}, new Map());
|
|
3573
|
-
}, [
|
|
3574
|
-
return
|
|
3670
|
+
}, [groupBy]);
|
|
3671
|
+
return groupByMap;
|
|
3575
3672
|
}
|
|
3576
3673
|
function useColumnsWhen() {
|
|
3577
3674
|
const {
|
|
3578
|
-
componentState: {
|
|
3675
|
+
componentState: { groupBy },
|
|
3579
3676
|
componentActions: dataSourceActions
|
|
3580
3677
|
} = useDataSourceContextValue();
|
|
3581
3678
|
const {
|
|
3582
3679
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3583
3680
|
} = useComponentState();
|
|
3584
|
-
const
|
|
3585
|
-
(0,
|
|
3681
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3682
|
+
(0, import_react18.useEffect)(() => {
|
|
3586
3683
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3587
3684
|
}, [groupRenderStrategy]);
|
|
3588
|
-
(0,
|
|
3685
|
+
(0, import_react18.useEffect)(() => {
|
|
3589
3686
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3590
3687
|
}, [pivotTotalColumnPosition]);
|
|
3591
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3688
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3592
3689
|
useColumnsWhenPivoting();
|
|
3593
3690
|
useColumnsWhenGrouping();
|
|
3594
|
-
useHideEmptyGroupColumns(
|
|
3691
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3595
3692
|
}
|
|
3596
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3693
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3597
3694
|
const toggleGroupRow = useToggleGroupRow();
|
|
3598
3695
|
const {
|
|
3599
3696
|
componentActions,
|
|
3600
3697
|
componentState: { columns, groupRenderStrategy }
|
|
3601
3698
|
} = useComponentState();
|
|
3602
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3699
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3603
3700
|
const computedColumns = new Map();
|
|
3604
3701
|
columns2.forEach((column, id) => {
|
|
3605
3702
|
let base = {};
|
|
3606
|
-
const groupByForColumn =
|
|
3703
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3607
3704
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3608
3705
|
const { groupIndex } = groupByForColumn;
|
|
3609
3706
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3648,9 +3745,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3648
3745
|
});
|
|
3649
3746
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3650
3747
|
}
|
|
3651
|
-
(0,
|
|
3748
|
+
(0, import_react18.useEffect)(() => {
|
|
3652
3749
|
const update = () => {
|
|
3653
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
3750
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3654
3751
|
};
|
|
3655
3752
|
update();
|
|
3656
3753
|
return interceptMap(columns, {
|
|
@@ -3658,11 +3755,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3658
3755
|
delete: update,
|
|
3659
3756
|
clear: update
|
|
3660
3757
|
});
|
|
3661
|
-
}, [columns,
|
|
3758
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3662
3759
|
}
|
|
3663
3760
|
function useColumnsWhenPivoting() {
|
|
3664
3761
|
const {
|
|
3665
|
-
componentState: {
|
|
3762
|
+
componentState: { groupBy, pivotBy }
|
|
3666
3763
|
} = useDataSourceContextValue();
|
|
3667
3764
|
const {
|
|
3668
3765
|
componentActions,
|
|
@@ -3674,13 +3771,13 @@ function useColumnsWhenPivoting() {
|
|
|
3674
3771
|
}
|
|
3675
3772
|
} = useComponentState();
|
|
3676
3773
|
const toggleGroupRow = useToggleGroupRow();
|
|
3677
|
-
(0,
|
|
3774
|
+
(0, import_react18.useEffect)(() => {
|
|
3678
3775
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3679
3776
|
pivotColumn,
|
|
3680
3777
|
pivotRowLabelsColumn,
|
|
3681
3778
|
pivotTotalColumnPosition,
|
|
3682
3779
|
pivotBy,
|
|
3683
|
-
|
|
3780
|
+
groupBy,
|
|
3684
3781
|
toggleGroupRow
|
|
3685
3782
|
});
|
|
3686
3783
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3688,14 +3785,14 @@ function useColumnsWhenPivoting() {
|
|
|
3688
3785
|
}
|
|
3689
3786
|
function useColumnsWhenGrouping() {
|
|
3690
3787
|
const {
|
|
3691
|
-
componentState: {
|
|
3788
|
+
componentState: { groupBy }
|
|
3692
3789
|
} = useDataSourceContextValue();
|
|
3693
3790
|
const {
|
|
3694
3791
|
componentActions,
|
|
3695
3792
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3696
3793
|
} = useComponentState();
|
|
3697
3794
|
const toggleGroupRow = useToggleGroupRow();
|
|
3698
|
-
(0,
|
|
3795
|
+
(0, import_react18.useEffect)(() => {
|
|
3699
3796
|
if (pivotColumns) {
|
|
3700
3797
|
return;
|
|
3701
3798
|
}
|
|
@@ -3704,7 +3801,7 @@ function useColumnsWhenGrouping() {
|
|
|
3704
3801
|
columns,
|
|
3705
3802
|
groupColumn,
|
|
3706
3803
|
groupRenderStrategy,
|
|
3707
|
-
|
|
3804
|
+
groupBy,
|
|
3708
3805
|
pivotColumns,
|
|
3709
3806
|
toggleGroupRow
|
|
3710
3807
|
});
|
|
@@ -3716,11 +3813,11 @@ function useColumnsWhenGrouping() {
|
|
|
3716
3813
|
delete: update,
|
|
3717
3814
|
clear: update
|
|
3718
3815
|
});
|
|
3719
|
-
}, [
|
|
3816
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3720
3817
|
}
|
|
3721
3818
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3722
3819
|
const {
|
|
3723
|
-
componentState: {
|
|
3820
|
+
componentState: { groupBy, groupRowsState },
|
|
3724
3821
|
getState: getDataSourceState
|
|
3725
3822
|
} = useDataSourceContextValue();
|
|
3726
3823
|
const {
|
|
@@ -3732,11 +3829,11 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3732
3829
|
groupRenderStrategy
|
|
3733
3830
|
}
|
|
3734
3831
|
} = useComponentState();
|
|
3735
|
-
(0,
|
|
3736
|
-
if (groupRenderStrategy
|
|
3832
|
+
(0, import_react18.useEffect)(() => {
|
|
3833
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3737
3834
|
return;
|
|
3738
3835
|
}
|
|
3739
|
-
const groupsLength =
|
|
3836
|
+
const groupsLength = groupBy.length;
|
|
3740
3837
|
let expandedGroupsLevel = 0;
|
|
3741
3838
|
const { dataArray } = getDataSourceState();
|
|
3742
3839
|
const len = dataArray.length;
|
|
@@ -3752,15 +3849,15 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3752
3849
|
let updated = false;
|
|
3753
3850
|
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3754
3851
|
const cols = computedColumns;
|
|
3755
|
-
|
|
3756
|
-
const colId =
|
|
3757
|
-
|
|
3852
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3853
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
3854
|
+
let col = cols.get(colId);
|
|
3758
3855
|
if (!col) {
|
|
3759
3856
|
return;
|
|
3760
3857
|
}
|
|
3761
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3858
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3762
3859
|
updated = true;
|
|
3763
|
-
if (shouldBeHidden
|
|
3860
|
+
if (shouldBeHidden) {
|
|
3764
3861
|
columnVisibility.set(colId, false);
|
|
3765
3862
|
} else {
|
|
3766
3863
|
columnVisibility.delete(colId);
|
|
@@ -3773,7 +3870,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3773
3870
|
getDataSourceState,
|
|
3774
3871
|
groupRenderStrategy,
|
|
3775
3872
|
generatedColumns,
|
|
3776
|
-
|
|
3873
|
+
groupBy,
|
|
3777
3874
|
groupRowsMap,
|
|
3778
3875
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3779
3876
|
hideEmptyGroupColumns
|
|
@@ -3782,7 +3879,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3782
3879
|
function getColumnsWhenGrouping(params) {
|
|
3783
3880
|
const {
|
|
3784
3881
|
pivotColumns,
|
|
3785
|
-
|
|
3882
|
+
groupBy,
|
|
3786
3883
|
groupColumn,
|
|
3787
3884
|
groupRenderStrategy,
|
|
3788
3885
|
toggleGroupRow,
|
|
@@ -3796,10 +3893,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
3796
3893
|
}
|
|
3797
3894
|
const computedColumns = new Map();
|
|
3798
3895
|
if (groupRenderStrategy === "multi-column") {
|
|
3799
|
-
|
|
3896
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3800
3897
|
const generatedGroupColumn = getColumnForGroupBy({
|
|
3801
3898
|
groupByForColumn,
|
|
3802
|
-
|
|
3899
|
+
groupBy,
|
|
3803
3900
|
groupIndexForColumn,
|
|
3804
3901
|
groupCount: arr.length,
|
|
3805
3902
|
groupRenderStrategy
|
|
@@ -3808,8 +3905,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
3808
3905
|
});
|
|
3809
3906
|
} else if (groupRenderStrategy === "single-column") {
|
|
3810
3907
|
const singleGroupColumn = getSingleGroupColumn({
|
|
3811
|
-
groupCount:
|
|
3812
|
-
|
|
3908
|
+
groupCount: groupBy.length,
|
|
3909
|
+
groupBy,
|
|
3813
3910
|
groupRenderStrategy
|
|
3814
3911
|
}, toggleGroupRow, groupColumn);
|
|
3815
3912
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
@@ -3826,7 +3923,8 @@ function useComputed() {
|
|
|
3826
3923
|
const { componentActions, componentState } = useComponentState();
|
|
3827
3924
|
const {
|
|
3828
3925
|
componentActions: dataSourceActions,
|
|
3829
|
-
componentState: dataSourceState
|
|
3926
|
+
componentState: dataSourceState,
|
|
3927
|
+
getState: getDataSourceState
|
|
3830
3928
|
} = useDataSourceContextValue();
|
|
3831
3929
|
const {
|
|
3832
3930
|
columnOrder,
|
|
@@ -3834,9 +3932,10 @@ function useComputed() {
|
|
|
3834
3932
|
columnPinning,
|
|
3835
3933
|
columnSizing,
|
|
3836
3934
|
columnTypes,
|
|
3837
|
-
bodySize
|
|
3935
|
+
bodySize,
|
|
3936
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3838
3937
|
} = componentState;
|
|
3839
|
-
(0,
|
|
3938
|
+
(0, import_react19.useState)(() => {
|
|
3840
3939
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3841
3940
|
if (rowHeight) {
|
|
3842
3941
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3848,15 +3947,20 @@ function useComputed() {
|
|
|
3848
3947
|
}
|
|
3849
3948
|
});
|
|
3850
3949
|
});
|
|
3851
|
-
|
|
3950
|
+
(0, import_react19.useEffect)(() => {
|
|
3951
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3952
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3852
3953
|
const { multiSort } = dataSourceState;
|
|
3853
3954
|
useColumnGroups();
|
|
3854
3955
|
useColumnsWhen();
|
|
3855
|
-
const setSortInfo = (0,
|
|
3956
|
+
const setSortInfo = (0, import_react19.useCallback)((sortInfo) => {
|
|
3856
3957
|
var _a2;
|
|
3857
3958
|
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3858
3959
|
dataSourceActions.sortInfo = newSortInfo;
|
|
3859
|
-
|
|
3960
|
+
if (getDataSourceState().livePagination) {
|
|
3961
|
+
dataSourceActions.livePaginationCursor = null;
|
|
3962
|
+
}
|
|
3963
|
+
}, [getDataSourceState]);
|
|
3860
3964
|
const columns = componentState.computedColumns;
|
|
3861
3965
|
const {
|
|
3862
3966
|
computedColumnOrder,
|
|
@@ -3943,7 +4047,7 @@ function useComputed() {
|
|
|
3943
4047
|
}
|
|
3944
4048
|
|
|
3945
4049
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3946
|
-
var
|
|
4050
|
+
var React9 = __toModule(require("react"));
|
|
3947
4051
|
|
|
3948
4052
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3949
4053
|
var useInternalProps = () => {
|
|
@@ -3951,9 +4055,9 @@ var useInternalProps = () => {
|
|
|
3951
4055
|
};
|
|
3952
4056
|
|
|
3953
4057
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3954
|
-
var InfiniteTableBody =
|
|
4058
|
+
var InfiniteTableBody = React9.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3955
4059
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
3956
|
-
return /* @__PURE__ */
|
|
4060
|
+
return /* @__PURE__ */ React9.createElement("div", __spreadProps(__spreadValues({
|
|
3957
4061
|
ref
|
|
3958
4062
|
}, props), {
|
|
3959
4063
|
className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
@@ -3961,16 +4065,16 @@ var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, re
|
|
|
3961
4065
|
});
|
|
3962
4066
|
|
|
3963
4067
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
3964
|
-
var
|
|
4068
|
+
var React21 = __toModule(require("react"));
|
|
3965
4069
|
|
|
3966
4070
|
// src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
|
|
3967
|
-
var
|
|
4071
|
+
var React10 = __toModule(require("react"));
|
|
3968
4072
|
function HorizontalScrollbarPlaceholderFn(props) {
|
|
3969
4073
|
const scrollbarWidth2 = getScrollbarWidth();
|
|
3970
4074
|
if (!scrollbarWidth2) {
|
|
3971
4075
|
return null;
|
|
3972
4076
|
}
|
|
3973
|
-
return /* @__PURE__ */
|
|
4077
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3974
4078
|
"data-name": "horizontal-scrollbar-placeholder",
|
|
3975
4079
|
style: __spreadValues({
|
|
3976
4080
|
position: "absolute",
|
|
@@ -3980,13 +4084,13 @@ function HorizontalScrollbarPlaceholderFn(props) {
|
|
|
3980
4084
|
}, props.style)
|
|
3981
4085
|
});
|
|
3982
4086
|
}
|
|
3983
|
-
var HorizontalScrollbarPlaceholder =
|
|
4087
|
+
var HorizontalScrollbarPlaceholder = React10.memo(HorizontalScrollbarPlaceholderFn);
|
|
3984
4088
|
function VerticalScrollbarPlaceholderFn(props) {
|
|
3985
4089
|
const scrollbarWidth2 = getScrollbarWidth();
|
|
3986
4090
|
if (!scrollbarWidth2) {
|
|
3987
4091
|
return null;
|
|
3988
4092
|
}
|
|
3989
|
-
return /* @__PURE__ */
|
|
4093
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3990
4094
|
"data-name": "vertical-scrollbar-placeholder",
|
|
3991
4095
|
style: __spreadValues({
|
|
3992
4096
|
position: "absolute",
|
|
@@ -3996,14 +4100,14 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3996
4100
|
}, props.style)
|
|
3997
4101
|
});
|
|
3998
4102
|
}
|
|
3999
|
-
var VerticalScrollbarPlaceholder =
|
|
4103
|
+
var VerticalScrollbarPlaceholder = React10.memo(VerticalScrollbarPlaceholderFn);
|
|
4000
4104
|
|
|
4001
4105
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4002
|
-
var
|
|
4106
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4003
4107
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
4004
4108
|
var HeaderCellProxy = "_12zfob10";
|
|
4005
|
-
var HeaderCellRecipe = (0,
|
|
4006
|
-
var HeaderClsRecipe = (0,
|
|
4109
|
+
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"]] });
|
|
4110
|
+
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"]] });
|
|
4007
4111
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
4008
4112
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
4009
4113
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -4011,29 +4115,29 @@ var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
|
4011
4115
|
var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
4012
4116
|
|
|
4013
4117
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4014
|
-
var
|
|
4015
|
-
var
|
|
4118
|
+
var React17 = __toModule(require("react"));
|
|
4119
|
+
var import_react27 = __toModule(require("react"));
|
|
4016
4120
|
|
|
4017
4121
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
4018
|
-
var
|
|
4019
|
-
var
|
|
4122
|
+
var React13 = __toModule(require("react"));
|
|
4123
|
+
var import_react23 = __toModule(require("react"));
|
|
4020
4124
|
|
|
4021
4125
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4022
|
-
var
|
|
4126
|
+
var React11 = __toModule(require("react"));
|
|
4023
4127
|
|
|
4024
4128
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4025
|
-
var
|
|
4129
|
+
var import_react20 = __toModule(require("react"));
|
|
4026
4130
|
var useInfiniteTableState = () => {
|
|
4027
4131
|
const TableContext2 = getInfiniteTableContext();
|
|
4028
|
-
const { componentState } = (0,
|
|
4132
|
+
const { componentState } = (0, import_react20.useContext)(TableContext2);
|
|
4029
4133
|
return componentState;
|
|
4030
4134
|
};
|
|
4031
4135
|
|
|
4032
4136
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4033
|
-
var
|
|
4137
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4034
4138
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
4035
4139
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4036
|
-
var ColumnCellRecipe = (0,
|
|
4140
|
+
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"]] });
|
|
4037
4141
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
4038
4142
|
|
|
4039
4143
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -4078,20 +4182,20 @@ function InfiniteTableCellFn(props) {
|
|
|
4078
4182
|
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
4079
4183
|
}
|
|
4080
4184
|
}
|
|
4081
|
-
return /* @__PURE__ */
|
|
4185
|
+
return /* @__PURE__ */ React11.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
4082
4186
|
ref: domRef,
|
|
4083
4187
|
style,
|
|
4084
4188
|
"data-name": `Cell`,
|
|
4085
4189
|
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}` : "")
|
|
4086
|
-
}), beforeChildren, cssEllipsis ? /* @__PURE__ */
|
|
4190
|
+
}), beforeChildren, cssEllipsis ? /* @__PURE__ */ React11.createElement("div", {
|
|
4087
4191
|
className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
|
|
4088
4192
|
}, children) : children, afterChildren);
|
|
4089
4193
|
}
|
|
4090
|
-
var InfiniteTableCell =
|
|
4194
|
+
var InfiniteTableCell = React11.memo(InfiniteTableCellFn);
|
|
4091
4195
|
|
|
4092
4196
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4093
4197
|
var import_binary_search = __toModule(require_binary_search());
|
|
4094
|
-
var
|
|
4198
|
+
var import_react21 = __toModule(require("react"));
|
|
4095
4199
|
|
|
4096
4200
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4097
4201
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -4125,18 +4229,18 @@ var useColumnPointerEvents = ({
|
|
|
4125
4229
|
columns,
|
|
4126
4230
|
computedRemainingSpace
|
|
4127
4231
|
}) => {
|
|
4128
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
4129
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
4130
|
-
const breakpointsRef = (0,
|
|
4131
|
-
const pointerMoveRef = (0,
|
|
4132
|
-
const didDragRef = (0,
|
|
4133
|
-
const initialClientPos = (0,
|
|
4134
|
-
const currentDropIndexRef = (0,
|
|
4232
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react21.useState)(null);
|
|
4233
|
+
const [proxyOffset, setProxyOffset] = (0, import_react21.useState)(null);
|
|
4234
|
+
const breakpointsRef = (0, import_react21.useRef)([]);
|
|
4235
|
+
const pointerMoveRef = (0, import_react21.useRef)(null);
|
|
4236
|
+
const didDragRef = (0, import_react21.useRef)(false);
|
|
4237
|
+
const initialClientPos = (0, import_react21.useRef)(null);
|
|
4238
|
+
const currentDropIndexRef = (0, import_react21.useRef)(null);
|
|
4135
4239
|
const dragging = draggingDiff != null;
|
|
4136
4240
|
const { componentActions, computed } = useInfiniteTable();
|
|
4137
4241
|
const { computedColumnOrder } = computed;
|
|
4138
|
-
const column = (0,
|
|
4139
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
4242
|
+
const column = (0, import_react21.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
4243
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react21.useMemo)(() => {
|
|
4140
4244
|
const columnsArray2 = Array.from(columns.values());
|
|
4141
4245
|
return {
|
|
4142
4246
|
columnsArray: columnsArray2,
|
|
@@ -4144,8 +4248,8 @@ var useColumnPointerEvents = ({
|
|
|
4144
4248
|
columnWidth: column.computedWidth
|
|
4145
4249
|
};
|
|
4146
4250
|
}, [columns, columnId, column]);
|
|
4147
|
-
let cursorRef = (0,
|
|
4148
|
-
const onPointerDown = (0,
|
|
4251
|
+
let cursorRef = (0, import_react21.useRef)("auto");
|
|
4252
|
+
const onPointerDown = (0, import_react21.useCallback)((e) => {
|
|
4149
4253
|
const target = domRef.current;
|
|
4150
4254
|
cursorRef.current = target.style.cursor;
|
|
4151
4255
|
didDragRef.current = false;
|
|
@@ -4208,7 +4312,7 @@ var useColumnPointerEvents = ({
|
|
|
4208
4312
|
target.addEventListener("pointermove", onPointerMove);
|
|
4209
4313
|
target.setPointerCapture(e.pointerId);
|
|
4210
4314
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
4211
|
-
const onPointerUp = (0,
|
|
4315
|
+
const onPointerUp = (0, import_react21.useCallback)((e) => {
|
|
4212
4316
|
const target = domRef.current;
|
|
4213
4317
|
target.style.cursor = cursorRef.current;
|
|
4214
4318
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -4282,8 +4386,8 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4282
4386
|
var import_react_dom = __toModule(require("react-dom"));
|
|
4283
4387
|
|
|
4284
4388
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4285
|
-
var
|
|
4286
|
-
var
|
|
4389
|
+
var React12 = __toModule(require("react"));
|
|
4390
|
+
var import_react22 = __toModule(require("react"));
|
|
4287
4391
|
var defaultLineStyle = {
|
|
4288
4392
|
marginTop: 2,
|
|
4289
4393
|
marginBottom: 2,
|
|
@@ -4291,8 +4395,8 @@ var defaultLineStyle = {
|
|
|
4291
4395
|
};
|
|
4292
4396
|
function SortIcon(props) {
|
|
4293
4397
|
var _a;
|
|
4294
|
-
const [rendered, setRendered] = (0,
|
|
4295
|
-
const [opacity, setOpacity] = (0,
|
|
4398
|
+
const [rendered, setRendered] = (0, import_react22.useState)(true);
|
|
4399
|
+
const [opacity, setOpacity] = (0, import_react22.useState)(0);
|
|
4296
4400
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4297
4401
|
const showIndex = index != null && index > 0;
|
|
4298
4402
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4306,7 +4410,7 @@ function SortIcon(props) {
|
|
|
4306
4410
|
}), props.lineStyle), {
|
|
4307
4411
|
opacity
|
|
4308
4412
|
});
|
|
4309
|
-
(0,
|
|
4413
|
+
(0, import_react22.useEffect)(() => {
|
|
4310
4414
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4311
4415
|
if (!rendered && newOpacity) {
|
|
4312
4416
|
setRendered(true);
|
|
@@ -4336,18 +4440,18 @@ function SortIcon(props) {
|
|
|
4336
4440
|
if (direction === -1) {
|
|
4337
4441
|
indexStyle.top = "100%";
|
|
4338
4442
|
}
|
|
4339
|
-
return /* @__PURE__ */
|
|
4443
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
4340
4444
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
4341
4445
|
className: join(className, "ITableIcon", "ITableIcon-sort")
|
|
4342
|
-
}, showIndex ? /* @__PURE__ */
|
|
4446
|
+
}, showIndex ? /* @__PURE__ */ React12.createElement("div", {
|
|
4343
4447
|
"data-name": "index",
|
|
4344
4448
|
style: indexStyle
|
|
4345
|
-
}, index) : null, /* @__PURE__ */
|
|
4449
|
+
}, index) : null, /* @__PURE__ */ React12.createElement("div", {
|
|
4346
4450
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
4347
4451
|
onTransitionEnd
|
|
4348
|
-
}), /* @__PURE__ */
|
|
4452
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
4349
4453
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
4350
|
-
}), /* @__PURE__ */
|
|
4454
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
4351
4455
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
4352
4456
|
}));
|
|
4353
4457
|
}
|
|
@@ -4378,13 +4482,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4378
4482
|
});
|
|
4379
4483
|
}
|
|
4380
4484
|
header = header != null ? header : column.name;
|
|
4381
|
-
const sortTool = /* @__PURE__ */
|
|
4485
|
+
const sortTool = /* @__PURE__ */ React13.createElement(SortIcon, {
|
|
4382
4486
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4383
4487
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4384
4488
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4385
4489
|
});
|
|
4386
|
-
const domRef = (0,
|
|
4387
|
-
const ref = (0,
|
|
4490
|
+
const domRef = (0, import_react23.useRef)(null);
|
|
4491
|
+
const ref = (0, import_react23.useCallback)((node) => {
|
|
4388
4492
|
var _a2;
|
|
4389
4493
|
domRef.current = node;
|
|
4390
4494
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
@@ -4393,7 +4497,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4393
4497
|
computed: { computedRemainingSpace },
|
|
4394
4498
|
componentState: { portalDOMRef }
|
|
4395
4499
|
} = useInfiniteTable();
|
|
4396
|
-
(0,
|
|
4500
|
+
(0, import_react23.useEffect)(() => {
|
|
4397
4501
|
let clearOnResize = null;
|
|
4398
4502
|
const node = domRef.current;
|
|
4399
4503
|
if (onResize && node) {
|
|
@@ -4416,7 +4520,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4416
4520
|
let offset = offsetFromProps != null ? offsetFromProps : virtualized ? 0 : column.computedPinningOffset;
|
|
4417
4521
|
let draggingProxy = null;
|
|
4418
4522
|
if (dragging) {
|
|
4419
|
-
draggingProxy = /* @__PURE__ */
|
|
4523
|
+
draggingProxy = /* @__PURE__ */ React13.createElement("div", {
|
|
4420
4524
|
className: `${baseCls}Proxy ${HeaderCellProxy}`,
|
|
4421
4525
|
style: {
|
|
4422
4526
|
position: "absolute",
|
|
@@ -4429,7 +4533,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4429
4533
|
}, header);
|
|
4430
4534
|
draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
|
|
4431
4535
|
}
|
|
4432
|
-
return /* @__PURE__ */
|
|
4536
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(InfiniteTableCell, {
|
|
4433
4537
|
domRef: ref,
|
|
4434
4538
|
column,
|
|
4435
4539
|
"data-name": `HeaderCell`,
|
|
@@ -4445,29 +4549,29 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4445
4549
|
}
|
|
4446
4550
|
|
|
4447
4551
|
// src/components/RawList/index.tsx
|
|
4448
|
-
var
|
|
4449
|
-
var
|
|
4552
|
+
var React16 = __toModule(require("react"));
|
|
4553
|
+
var import_react26 = __toModule(require("react"));
|
|
4450
4554
|
|
|
4451
4555
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4452
|
-
var
|
|
4453
|
-
var
|
|
4556
|
+
var React14 = __toModule(require("react"));
|
|
4557
|
+
var import_react24 = __toModule(require("react"));
|
|
4454
4558
|
function AvoidReactDiffFn(props) {
|
|
4455
|
-
const [children, setChildren] = (0,
|
|
4456
|
-
(0,
|
|
4559
|
+
const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
|
|
4560
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
4457
4561
|
const remove = props.updater.onChange((children2) => {
|
|
4458
4562
|
setChildren(children2);
|
|
4459
4563
|
});
|
|
4460
4564
|
return remove;
|
|
4461
4565
|
}, [props.updater]);
|
|
4462
|
-
return /* @__PURE__ */
|
|
4566
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, children);
|
|
4463
4567
|
}
|
|
4464
|
-
var AvoidReactDiff =
|
|
4568
|
+
var AvoidReactDiff = React14.memo(AvoidReactDiffFn);
|
|
4465
4569
|
|
|
4466
4570
|
// src/components/RawList/useVirtualRenderer.ts
|
|
4467
|
-
var
|
|
4571
|
+
var import_react25 = __toModule(require("react"));
|
|
4468
4572
|
|
|
4469
4573
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4470
|
-
var
|
|
4574
|
+
var React15 = __toModule(require("react"));
|
|
4471
4575
|
|
|
4472
4576
|
// src/components/RawList/MappedItems.ts
|
|
4473
4577
|
var MappedItems = class extends Logger {
|
|
@@ -4712,7 +4816,7 @@ var ReactVirtualRenderer = class extends Logger {
|
|
|
4712
4816
|
};
|
|
4713
4817
|
this.itemDOMRefs[elementIndex] = domRef;
|
|
4714
4818
|
this.updaters[elementIndex] = buildSubscriptionCallback();
|
|
4715
|
-
const item = /* @__PURE__ */
|
|
4819
|
+
const item = /* @__PURE__ */ React15.createElement(AvoidReactDiff, {
|
|
4716
4820
|
key: elementIndex,
|
|
4717
4821
|
name: `${elementIndex}`,
|
|
4718
4822
|
updater: this.updaters[elementIndex]
|
|
@@ -4778,7 +4882,7 @@ function createRenderer(brain) {
|
|
|
4778
4882
|
function useVirtualRenderer({
|
|
4779
4883
|
brain
|
|
4780
4884
|
}) {
|
|
4781
|
-
return (0,
|
|
4885
|
+
return (0, import_react25.useMemo)(() => {
|
|
4782
4886
|
return createRenderer(brain);
|
|
4783
4887
|
}, [brain]);
|
|
4784
4888
|
}
|
|
@@ -4791,7 +4895,7 @@ function RawListFn(props) {
|
|
|
4791
4895
|
debugChannel
|
|
4792
4896
|
});
|
|
4793
4897
|
const getRenderItem = useLatest(renderItem);
|
|
4794
|
-
(0,
|
|
4898
|
+
(0, import_react26.useEffect)(() => {
|
|
4795
4899
|
const renderRange = brain.getRenderRange();
|
|
4796
4900
|
renderer.renderRange(renderRange, {
|
|
4797
4901
|
renderItem,
|
|
@@ -4799,7 +4903,7 @@ function RawListFn(props) {
|
|
|
4799
4903
|
onRender: onRenderUpdater
|
|
4800
4904
|
});
|
|
4801
4905
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4802
|
-
(0,
|
|
4906
|
+
(0, import_react26.useEffect)(() => {
|
|
4803
4907
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4804
4908
|
renderer.renderRange(renderRange, {
|
|
4805
4909
|
force: false,
|
|
@@ -4809,14 +4913,14 @@ function RawListFn(props) {
|
|
|
4809
4913
|
});
|
|
4810
4914
|
return remove;
|
|
4811
4915
|
}, [brain, onRenderUpdater]);
|
|
4812
|
-
return /* @__PURE__ */
|
|
4916
|
+
return /* @__PURE__ */ React16.createElement(AvoidReactDiff, {
|
|
4813
4917
|
updater: onRenderUpdater
|
|
4814
4918
|
});
|
|
4815
4919
|
}
|
|
4816
|
-
var RawList =
|
|
4920
|
+
var RawList = React16.memo(RawListFn);
|
|
4817
4921
|
|
|
4818
4922
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4819
|
-
var
|
|
4923
|
+
var debug4 = dbg("Header");
|
|
4820
4924
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
4821
4925
|
var TableHeaderClassName = `${rootClassName4}Header`;
|
|
4822
4926
|
function InfiniteTableHeaderFn(props) {
|
|
@@ -4826,29 +4930,29 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4826
4930
|
componentState: { headerHeight }
|
|
4827
4931
|
} = useInfiniteTable();
|
|
4828
4932
|
const { computedVisibleColumnsMap } = computed;
|
|
4829
|
-
const renderColumn = (0,
|
|
4933
|
+
const renderColumn = (0, import_react27.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
4830
4934
|
const column = columns[columnIndex];
|
|
4831
4935
|
if (!column) {
|
|
4832
4936
|
if (true) {
|
|
4833
|
-
|
|
4937
|
+
debug4("Cannot find column to render at ", columnIndex);
|
|
4834
4938
|
}
|
|
4835
4939
|
return null;
|
|
4836
4940
|
}
|
|
4837
|
-
return /* @__PURE__ */
|
|
4941
|
+
return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderCell, {
|
|
4838
4942
|
domRef: domRef2,
|
|
4839
4943
|
column,
|
|
4840
4944
|
headerHeight,
|
|
4841
4945
|
columns: computedVisibleColumnsMap
|
|
4842
4946
|
});
|
|
4843
4947
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4844
|
-
(0,
|
|
4948
|
+
(0, import_react27.useEffect)(() => {
|
|
4845
4949
|
const onScroll = (scrollPosition) => {
|
|
4846
4950
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4847
4951
|
};
|
|
4848
4952
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4849
4953
|
return removeOnScroll;
|
|
4850
4954
|
}, [brain]);
|
|
4851
|
-
const domRef = (0,
|
|
4955
|
+
const domRef = (0, import_react27.useRef)(null);
|
|
4852
4956
|
const headerCls = HeaderClsRecipe({
|
|
4853
4957
|
pinned: pinning,
|
|
4854
4958
|
overflow: false,
|
|
@@ -4859,18 +4963,18 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4859
4963
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4860
4964
|
style
|
|
4861
4965
|
};
|
|
4862
|
-
return /* @__PURE__ */
|
|
4966
|
+
return /* @__PURE__ */ React17.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React17.createElement(RawList, {
|
|
4863
4967
|
brain,
|
|
4864
4968
|
renderItem: renderColumn
|
|
4865
4969
|
}));
|
|
4866
4970
|
}
|
|
4867
|
-
var InfiniteTableHeader =
|
|
4971
|
+
var InfiniteTableHeader = React17.memo(InfiniteTableHeaderFn);
|
|
4868
4972
|
|
|
4869
4973
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
4870
|
-
var
|
|
4974
|
+
var React20 = __toModule(require("react"));
|
|
4871
4975
|
|
|
4872
4976
|
// src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
|
|
4873
|
-
var
|
|
4977
|
+
var React19 = __toModule(require("react"));
|
|
4874
4978
|
|
|
4875
4979
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
4876
4980
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
|
|
@@ -4960,7 +5064,7 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4960
5064
|
}
|
|
4961
5065
|
|
|
4962
5066
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4963
|
-
var
|
|
5067
|
+
var React18 = __toModule(require("react"));
|
|
4964
5068
|
var TableHeaderGroupClassName = `${rootClassName}HeaderGroup`;
|
|
4965
5069
|
function InfiniteTableHeaderGroup(props) {
|
|
4966
5070
|
const { columnGroup, height, headerHeight } = props;
|
|
@@ -4974,16 +5078,16 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4974
5078
|
width: columnGroup.computedWidth,
|
|
4975
5079
|
height
|
|
4976
5080
|
};
|
|
4977
|
-
return /* @__PURE__ */
|
|
5081
|
+
return /* @__PURE__ */ React18.createElement("div", {
|
|
4978
5082
|
"data-group-id": columnGroup.id,
|
|
4979
5083
|
className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
|
|
4980
5084
|
style
|
|
4981
|
-
}, /* @__PURE__ */
|
|
5085
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
4982
5086
|
className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
|
|
4983
5087
|
style: { height: headerHeight }
|
|
4984
|
-
}, /* @__PURE__ */
|
|
5088
|
+
}, /* @__PURE__ */ React18.createElement("div", {
|
|
4985
5089
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4986
|
-
}, header)), /* @__PURE__ */
|
|
5090
|
+
}, header)), /* @__PURE__ */ React18.createElement("div", {
|
|
4987
5091
|
className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
|
|
4988
5092
|
}, props.children));
|
|
4989
5093
|
}
|
|
@@ -5006,7 +5110,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
5006
5110
|
return items2.map((colGroupItem) => {
|
|
5007
5111
|
if (colGroupItem.type === "column") {
|
|
5008
5112
|
const col = colGroupItem.ref;
|
|
5009
|
-
return /* @__PURE__ */
|
|
5113
|
+
return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderCell, {
|
|
5010
5114
|
key: col.id,
|
|
5011
5115
|
headerHeight: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
|
|
5012
5116
|
column: col,
|
|
@@ -5020,7 +5124,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
5020
5124
|
colIds.push(col.id);
|
|
5021
5125
|
return col;
|
|
5022
5126
|
});
|
|
5023
|
-
return /* @__PURE__ */
|
|
5127
|
+
return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderGroup, {
|
|
5024
5128
|
key: `${colGroupItem.uniqueGroupId.join("/")}`,
|
|
5025
5129
|
columns: columns2,
|
|
5026
5130
|
height: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
|
|
@@ -5040,7 +5144,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
5040
5144
|
}
|
|
5041
5145
|
|
|
5042
5146
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
5043
|
-
var
|
|
5147
|
+
var import_react28 = __toModule(require("react"));
|
|
5044
5148
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
5045
5149
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
5046
5150
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -5073,9 +5177,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5073
5177
|
},
|
|
5074
5178
|
computed: { computedVisibleColumnsMap: columnsMap }
|
|
5075
5179
|
} = useInfiniteTable();
|
|
5076
|
-
const domRef =
|
|
5180
|
+
const domRef = React20.useRef(null);
|
|
5077
5181
|
const hasColumnGroups = computedColumnGroups.size > 0;
|
|
5078
|
-
const columnHeaderGroups =
|
|
5182
|
+
const columnHeaderGroups = React20.useMemo(() => {
|
|
5079
5183
|
return hasColumnGroups ? renderColumnHeaderGroups({
|
|
5080
5184
|
columnGroups: computedColumnGroups,
|
|
5081
5185
|
columnGroupsDepthsMap,
|
|
@@ -5094,7 +5198,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5094
5198
|
columnGroupsMaxDepth
|
|
5095
5199
|
]);
|
|
5096
5200
|
const children = hasColumnGroups ? columnHeaderGroups : columns.map((c) => {
|
|
5097
|
-
return /* @__PURE__ */
|
|
5201
|
+
return /* @__PURE__ */ React20.createElement(InfiniteTableHeaderCell, {
|
|
5098
5202
|
key: c.id,
|
|
5099
5203
|
headerHeight,
|
|
5100
5204
|
column: c,
|
|
@@ -5106,7 +5210,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5106
5210
|
if (totalWidth != null) {
|
|
5107
5211
|
style.width = availableWidth;
|
|
5108
5212
|
}
|
|
5109
|
-
(0,
|
|
5213
|
+
(0, import_react28.useEffect)(() => {
|
|
5110
5214
|
const scroller = brain || scrollListener;
|
|
5111
5215
|
if (!scroller || !scrollable) {
|
|
5112
5216
|
return;
|
|
@@ -5117,20 +5221,20 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5117
5221
|
const removeOnScroll = scroller.onScroll(onScroll);
|
|
5118
5222
|
return removeOnScroll;
|
|
5119
5223
|
}, [brain, scrollListener]);
|
|
5120
|
-
return /* @__PURE__ */
|
|
5224
|
+
return /* @__PURE__ */ React20.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5121
5225
|
className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
|
|
5122
5226
|
pinned: pinning,
|
|
5123
5227
|
virtualized: false,
|
|
5124
5228
|
overflow: scrollable
|
|
5125
5229
|
})),
|
|
5126
5230
|
style
|
|
5127
|
-
}), /* @__PURE__ */
|
|
5231
|
+
}), /* @__PURE__ */ React20.createElement("div", {
|
|
5128
5232
|
style: { width: totalWidth },
|
|
5129
5233
|
className: join(flexFlow.row, display.flex),
|
|
5130
5234
|
ref: domRef
|
|
5131
5235
|
}, children));
|
|
5132
5236
|
}
|
|
5133
|
-
var InfiniteTableHeaderUnvirtualized =
|
|
5237
|
+
var InfiniteTableHeaderUnvirtualized = React20.memo(InfiniteTableHeaderUnvirtualizedFn);
|
|
5134
5238
|
|
|
5135
5239
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
5136
5240
|
function TableHeaderWrapper(props) {
|
|
@@ -5160,7 +5264,7 @@ function TableHeaderWrapper(props) {
|
|
|
5160
5264
|
const hasPinnedStart = computedPinnedStartColumns.length > 0;
|
|
5161
5265
|
const hasPinnedEnd = computedPinnedEndColumns.length > 0;
|
|
5162
5266
|
const height = columnGroupsMaxDepth ? columnGroupsMaxDepth * headerHeight : headerHeight;
|
|
5163
|
-
const header = virtualizeHeader ? /* @__PURE__ */
|
|
5267
|
+
const header = virtualizeHeader ? /* @__PURE__ */ React21.createElement(InfiniteTableHeader, {
|
|
5164
5268
|
columns: computedUnpinnedColumns,
|
|
5165
5269
|
repaintId: virtualizeHeader ? repaintId : void 0,
|
|
5166
5270
|
brain,
|
|
@@ -5173,7 +5277,7 @@ function TableHeaderWrapper(props) {
|
|
|
5173
5277
|
},
|
|
5174
5278
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5175
5279
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5176
|
-
}) : /* @__PURE__ */
|
|
5280
|
+
}) : /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5177
5281
|
brain,
|
|
5178
5282
|
scrollable: true,
|
|
5179
5283
|
pinning: false,
|
|
@@ -5181,12 +5285,12 @@ function TableHeaderWrapper(props) {
|
|
|
5181
5285
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5182
5286
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5183
5287
|
});
|
|
5184
|
-
return /* @__PURE__ */
|
|
5288
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
5185
5289
|
className: HeaderWrapperCls,
|
|
5186
5290
|
style: {
|
|
5187
5291
|
height: virtualizeHeader ? height : void 0
|
|
5188
5292
|
}
|
|
5189
|
-
}, hasPinnedStart ? /* @__PURE__ */
|
|
5293
|
+
}, hasPinnedStart ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5190
5294
|
style: {
|
|
5191
5295
|
left: 0,
|
|
5192
5296
|
position: "absolute",
|
|
@@ -5198,7 +5302,7 @@ function TableHeaderWrapper(props) {
|
|
|
5198
5302
|
scrollable: computedPinnedStartOverflow,
|
|
5199
5303
|
pinning: "start",
|
|
5200
5304
|
scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
|
|
5201
|
-
}) : null, header, hasPinnedEnd ? /* @__PURE__ */
|
|
5305
|
+
}) : null, header, hasPinnedEnd ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5202
5306
|
style: {
|
|
5203
5307
|
right: scrollbars.vertical ? getScrollbarWidth() : 0,
|
|
5204
5308
|
position: "absolute",
|
|
@@ -5210,7 +5314,7 @@ function TableHeaderWrapper(props) {
|
|
|
5210
5314
|
scrollable: computedPinnedEndOverflow,
|
|
5211
5315
|
pinning: "end",
|
|
5212
5316
|
scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
|
|
5213
|
-
}) : null, scrollbars.vertical ? /* @__PURE__ */
|
|
5317
|
+
}) : null, scrollbars.vertical ? /* @__PURE__ */ React21.createElement(VerticalScrollbarPlaceholder, {
|
|
5214
5318
|
style: {
|
|
5215
5319
|
height: "100%",
|
|
5216
5320
|
right: 0
|
|
@@ -5219,13 +5323,13 @@ function TableHeaderWrapper(props) {
|
|
|
5219
5323
|
}
|
|
5220
5324
|
|
|
5221
5325
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5222
|
-
var
|
|
5223
|
-
var
|
|
5326
|
+
var React22 = __toModule(require("react"));
|
|
5327
|
+
var import_react30 = __toModule(require("react"));
|
|
5224
5328
|
|
|
5225
5329
|
// src/components/hooks/useOnScroll.ts
|
|
5226
|
-
var
|
|
5330
|
+
var import_react29 = __toModule(require("react"));
|
|
5227
5331
|
var useOnScroll = (domRef, onScroll) => {
|
|
5228
|
-
(0,
|
|
5332
|
+
(0, import_react29.useEffect)(() => {
|
|
5229
5333
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5230
5334
|
const scrollFn = (event) => {
|
|
5231
5335
|
const node = event.target;
|
|
@@ -5263,7 +5367,7 @@ var getScrollableClassName = (scrollable) => {
|
|
|
5263
5367
|
|
|
5264
5368
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5265
5369
|
var rootClassName6 = "InfiniteVirtualScrollContainer";
|
|
5266
|
-
var VirtualScrollContainer =
|
|
5370
|
+
var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2(props, ref) {
|
|
5267
5371
|
const {
|
|
5268
5372
|
children,
|
|
5269
5373
|
scrollable = true,
|
|
@@ -5271,9 +5375,9 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5271
5375
|
className,
|
|
5272
5376
|
style
|
|
5273
5377
|
} = props;
|
|
5274
|
-
const domRef = ref != null ? ref : (0,
|
|
5378
|
+
const domRef = ref != null ? ref : (0, import_react30.useRef)(null);
|
|
5275
5379
|
useOnScroll(domRef, onContainerScroll);
|
|
5276
|
-
return /* @__PURE__ */
|
|
5380
|
+
return /* @__PURE__ */ React22.createElement("div", {
|
|
5277
5381
|
ref: domRef,
|
|
5278
5382
|
style,
|
|
5279
5383
|
className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
|
|
@@ -5281,7 +5385,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
|
|
|
5281
5385
|
});
|
|
5282
5386
|
|
|
5283
5387
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
5284
|
-
var
|
|
5388
|
+
var React23 = __toModule(require("react"));
|
|
5285
5389
|
function SpacePlaceholderFn(props) {
|
|
5286
5390
|
const { height, width, count } = props;
|
|
5287
5391
|
const style = {
|
|
@@ -5291,7 +5395,7 @@ function SpacePlaceholderFn(props) {
|
|
|
5291
5395
|
opacity: 0,
|
|
5292
5396
|
pointerEvents: "none"
|
|
5293
5397
|
};
|
|
5294
|
-
return /* @__PURE__ */
|
|
5398
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
5295
5399
|
"data-count": count,
|
|
5296
5400
|
"data-placeholder-width": true ? width : void 0,
|
|
5297
5401
|
"data-placeholder-height": true ? height : void 0,
|
|
@@ -5299,24 +5403,24 @@ function SpacePlaceholderFn(props) {
|
|
|
5299
5403
|
style
|
|
5300
5404
|
});
|
|
5301
5405
|
}
|
|
5302
|
-
var SpacePlaceholder =
|
|
5406
|
+
var SpacePlaceholder = React23.memo(SpacePlaceholderFn);
|
|
5303
5407
|
|
|
5304
5408
|
// src/components/InfiniteTable/hooks/useListRendering.tsx
|
|
5305
|
-
var
|
|
5409
|
+
var import_react41 = __toModule(require("react"));
|
|
5306
5410
|
|
|
5307
5411
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5308
|
-
var
|
|
5309
|
-
var
|
|
5412
|
+
var React29 = __toModule(require("react"));
|
|
5413
|
+
var import_react34 = __toModule(require("react"));
|
|
5310
5414
|
|
|
5311
5415
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5312
|
-
var
|
|
5416
|
+
var React25 = __toModule(require("react"));
|
|
5313
5417
|
|
|
5314
5418
|
// src/components/VirtualList/VirtualList.tsx
|
|
5315
|
-
var
|
|
5316
|
-
var
|
|
5419
|
+
var React24 = __toModule(require("react"));
|
|
5420
|
+
var import_react31 = __toModule(require("react"));
|
|
5317
5421
|
|
|
5318
5422
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5319
|
-
var VirtualListCls = "
|
|
5423
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5320
5424
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5321
5425
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5322
5426
|
|
|
@@ -5324,7 +5428,7 @@ var scrollTransformTargetCls = "mlx2t3";
|
|
|
5324
5428
|
var UPDATE_SCROLL2 = (node, scrollPosition) => {
|
|
5325
5429
|
node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
|
|
5326
5430
|
};
|
|
5327
|
-
var
|
|
5431
|
+
var debug5 = dbg("VirtuaList");
|
|
5328
5432
|
var rootClassName7 = "InfiniteList";
|
|
5329
5433
|
var VirtualList = (props) => {
|
|
5330
5434
|
const _a = props, {
|
|
@@ -5356,15 +5460,15 @@ var VirtualList = (props) => {
|
|
|
5356
5460
|
"onContainerScroll",
|
|
5357
5461
|
"children"
|
|
5358
5462
|
]);
|
|
5359
|
-
const domRef = (0,
|
|
5463
|
+
const domRef = (0, import_react31.useRef)(null);
|
|
5360
5464
|
const [, rerender] = useRerender();
|
|
5361
|
-
const [totalSize, setTotalSize] = (0,
|
|
5362
|
-
const renderCountRef = (0,
|
|
5363
|
-
(0,
|
|
5465
|
+
const [totalSize, setTotalSize] = (0, import_react31.useState)(0);
|
|
5466
|
+
const renderCountRef = (0, import_react31.useRef)(0);
|
|
5467
|
+
(0, import_react31.useEffect)(() => {
|
|
5364
5468
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5365
5469
|
renderCountRef.current = renderCount;
|
|
5366
5470
|
if (true) {
|
|
5367
|
-
|
|
5471
|
+
debug5.extend(mainAxis)(`Render count change ${renderCount}`);
|
|
5368
5472
|
}
|
|
5369
5473
|
rerender();
|
|
5370
5474
|
});
|
|
@@ -5379,7 +5483,7 @@ var VirtualList = (props) => {
|
|
|
5379
5483
|
removeOnTotalSizeChange();
|
|
5380
5484
|
};
|
|
5381
5485
|
}, [virtualBrain]);
|
|
5382
|
-
(0,
|
|
5486
|
+
(0, import_react31.useEffect)(() => {
|
|
5383
5487
|
const onScroll = (scrollPosition) => {
|
|
5384
5488
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5385
5489
|
};
|
|
@@ -5394,19 +5498,19 @@ var VirtualList = (props) => {
|
|
|
5394
5498
|
if (true) {
|
|
5395
5499
|
domProps["data-cmp-name"] = `VirtualList`;
|
|
5396
5500
|
}
|
|
5397
|
-
return /* @__PURE__ */
|
|
5501
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React24.createElement(VirtualScrollContainer, {
|
|
5398
5502
|
scrollable,
|
|
5399
5503
|
onContainerScroll
|
|
5400
|
-
}, /* @__PURE__ */
|
|
5504
|
+
}, /* @__PURE__ */ React24.createElement("div", {
|
|
5401
5505
|
ref: domRef,
|
|
5402
5506
|
className: scrollTransformTargetCls,
|
|
5403
5507
|
"data-name": "scroll-transform-target"
|
|
5404
|
-
}, /* @__PURE__ */
|
|
5508
|
+
}, /* @__PURE__ */ React24.createElement(RawList, {
|
|
5405
5509
|
brain: virtualBrain,
|
|
5406
5510
|
renderItem,
|
|
5407
5511
|
repaintId,
|
|
5408
5512
|
debugChannel: "VirtualList-" + mainAxis
|
|
5409
|
-
})), children, /* @__PURE__ */
|
|
5513
|
+
})), children, /* @__PURE__ */ React24.createElement(SpacePlaceholder, {
|
|
5410
5514
|
count,
|
|
5411
5515
|
width,
|
|
5412
5516
|
height
|
|
@@ -5416,14 +5520,14 @@ var VirtualList = (props) => {
|
|
|
5416
5520
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5417
5521
|
var VirtualRowList = (props) => {
|
|
5418
5522
|
const _a = props, { rowWidth, rowHeight, renderRow } = _a, listProps = __objRest(_a, ["rowWidth", "rowHeight", "renderRow"]);
|
|
5419
|
-
const renderItem =
|
|
5523
|
+
const renderItem = React25.useCallback((renderProps) => {
|
|
5420
5524
|
return renderRow({
|
|
5421
5525
|
domRef: renderProps.domRef,
|
|
5422
5526
|
rowHeight: renderProps.itemSize,
|
|
5423
5527
|
rowIndex: renderProps.itemIndex
|
|
5424
5528
|
});
|
|
5425
5529
|
}, [renderRow]);
|
|
5426
|
-
return /* @__PURE__ */
|
|
5530
|
+
return /* @__PURE__ */ React25.createElement(VirtualList, __spreadProps(__spreadValues({}, listProps), {
|
|
5427
5531
|
renderItem,
|
|
5428
5532
|
mainAxis: "vertical",
|
|
5429
5533
|
itemMainAxisSize: rowHeight,
|
|
@@ -5432,11 +5536,11 @@ var VirtualRowList = (props) => {
|
|
|
5432
5536
|
};
|
|
5433
5537
|
|
|
5434
5538
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
5435
|
-
var
|
|
5436
|
-
var
|
|
5539
|
+
var React27 = __toModule(require("react"));
|
|
5540
|
+
var import_react33 = __toModule(require("react"));
|
|
5437
5541
|
|
|
5438
5542
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5439
|
-
var
|
|
5543
|
+
var React26 = __toModule(require("react"));
|
|
5440
5544
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
5441
5545
|
var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
|
|
5442
5546
|
function isColumnWithField(c) {
|
|
@@ -5463,32 +5567,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5463
5567
|
const groupRowInfo = null;
|
|
5464
5568
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5465
5569
|
if (column.valueGetter) {
|
|
5466
|
-
value = column.valueGetter({
|
|
5467
|
-
data,
|
|
5468
|
-
rowInfo
|
|
5469
|
-
|
|
5570
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5571
|
+
data: rowInfo.data,
|
|
5572
|
+
rowInfo
|
|
5573
|
+
} : {
|
|
5574
|
+
data: rowInfo.data,
|
|
5575
|
+
rowInfo
|
|
5470
5576
|
});
|
|
5471
5577
|
}
|
|
5472
5578
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5473
|
-
const
|
|
5474
|
-
value,
|
|
5475
|
-
column,
|
|
5579
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5476
5580
|
rowInfo,
|
|
5477
|
-
data
|
|
5581
|
+
data: rowInfo.data
|
|
5582
|
+
} : {
|
|
5583
|
+
rowInfo,
|
|
5584
|
+
data: rowInfo.data
|
|
5478
5585
|
};
|
|
5586
|
+
const stylingRenderParam = __spreadValues({
|
|
5587
|
+
value,
|
|
5588
|
+
column
|
|
5589
|
+
}, rest);
|
|
5479
5590
|
let renderValue = value;
|
|
5480
5591
|
if (column.render || column.renderValue) {
|
|
5481
|
-
const renderParam = {
|
|
5592
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5482
5593
|
value,
|
|
5483
5594
|
column,
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
data,
|
|
5595
|
+
groupRowInfo
|
|
5596
|
+
}, rest), {
|
|
5487
5597
|
rowIndex,
|
|
5488
5598
|
toggleGroupRow,
|
|
5489
5599
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5490
|
-
|
|
5491
|
-
};
|
|
5600
|
+
groupBy: computedDataSource.groupBy
|
|
5601
|
+
});
|
|
5492
5602
|
if (column.render) {
|
|
5493
5603
|
renderValue = column.render(renderParam);
|
|
5494
5604
|
} else if (column.renderValue) {
|
|
@@ -5523,7 +5633,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5523
5633
|
}
|
|
5524
5634
|
}
|
|
5525
5635
|
}
|
|
5526
|
-
return /* @__PURE__ */
|
|
5636
|
+
return /* @__PURE__ */ React26.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
|
|
5527
5637
|
domRef,
|
|
5528
5638
|
offsetProperty
|
|
5529
5639
|
}, dataset), {
|
|
@@ -5534,10 +5644,10 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5534
5644
|
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
|
|
5535
5645
|
}), hidden ? null : renderValue);
|
|
5536
5646
|
}
|
|
5537
|
-
var InfiniteTableColumnCell =
|
|
5647
|
+
var InfiniteTableColumnCell = React26.memo(InfiniteTableColumnCellFn);
|
|
5538
5648
|
|
|
5539
5649
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5540
|
-
var
|
|
5650
|
+
var import_react32 = __toModule(require("react"));
|
|
5541
5651
|
|
|
5542
5652
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
5543
5653
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
@@ -5562,17 +5672,16 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5562
5672
|
domRef: domRefFromProps,
|
|
5563
5673
|
rowInfo
|
|
5564
5674
|
} = props;
|
|
5565
|
-
const domRef = (0,
|
|
5566
|
-
const rowDOMRef = (0,
|
|
5675
|
+
const domRef = (0, import_react32.useRef)(null);
|
|
5676
|
+
const rowDOMRef = (0, import_react32.useCallback)((node) => {
|
|
5567
5677
|
domRefFromProps(node);
|
|
5568
5678
|
domRef.current = node;
|
|
5569
5679
|
}, []);
|
|
5570
|
-
const
|
|
5571
|
-
|
|
5572
|
-
rowInfo,
|
|
5680
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5681
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5573
5682
|
rowIndex,
|
|
5574
|
-
|
|
5575
|
-
};
|
|
5683
|
+
groupBy: rowInfo.groupBy
|
|
5684
|
+
});
|
|
5576
5685
|
if (typeof rowProps === "function") {
|
|
5577
5686
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5578
5687
|
}
|
|
@@ -5595,7 +5704,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5595
5704
|
}), `${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);
|
|
5596
5705
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
5597
5706
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
5598
|
-
const onMouseEnter = (0,
|
|
5707
|
+
const onMouseEnter = (0, import_react32.useCallback)((event) => {
|
|
5599
5708
|
var _a;
|
|
5600
5709
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
5601
5710
|
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
@@ -5609,7 +5718,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5609
5718
|
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5610
5719
|
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5611
5720
|
}, [initialMouseEnter, showHoverRows]);
|
|
5612
|
-
const onMouseLeave = (0,
|
|
5721
|
+
const onMouseLeave = (0, import_react32.useCallback)((event) => {
|
|
5613
5722
|
var _a;
|
|
5614
5723
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
5615
5724
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
@@ -5665,13 +5774,13 @@ function InfiniteTableRowFn(props) {
|
|
|
5665
5774
|
width: rowWidth,
|
|
5666
5775
|
height: rowHeight
|
|
5667
5776
|
}, domProps.style);
|
|
5668
|
-
const renderCellRef = (0,
|
|
5669
|
-
const renderCell =
|
|
5777
|
+
const renderCellRef = (0, import_react33.useRef)(null);
|
|
5778
|
+
const renderCell = React27.useCallback(({ domRef, itemIndex }) => {
|
|
5670
5779
|
const column = columns[itemIndex];
|
|
5671
5780
|
if (!column) {
|
|
5672
5781
|
}
|
|
5673
5782
|
const hidden = false;
|
|
5674
|
-
return /* @__PURE__ */
|
|
5783
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, {
|
|
5675
5784
|
getData,
|
|
5676
5785
|
rowInfo,
|
|
5677
5786
|
groupRenderStrategy,
|
|
@@ -5698,18 +5807,18 @@ function InfiniteTableRowFn(props) {
|
|
|
5698
5807
|
if (true) {
|
|
5699
5808
|
domProps["data-cmp-name"] = "ITableRow";
|
|
5700
5809
|
}
|
|
5701
|
-
return /* @__PURE__ */
|
|
5810
|
+
return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5702
5811
|
style
|
|
5703
|
-
}), /* @__PURE__ */
|
|
5812
|
+
}), /* @__PURE__ */ React27.createElement(RawList, {
|
|
5704
5813
|
brain,
|
|
5705
5814
|
renderItem: renderCell,
|
|
5706
5815
|
debugChannel: `${rowIndex}`
|
|
5707
5816
|
}));
|
|
5708
5817
|
}
|
|
5709
|
-
var InfiniteTableRow =
|
|
5818
|
+
var InfiniteTableRow = React27.memo(InfiniteTableRowFn);
|
|
5710
5819
|
|
|
5711
5820
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx
|
|
5712
|
-
var
|
|
5821
|
+
var React28 = __toModule(require("react"));
|
|
5713
5822
|
function TableRowUnvirtualizedFn(props) {
|
|
5714
5823
|
const {
|
|
5715
5824
|
rowHeight,
|
|
@@ -5730,7 +5839,7 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5730
5839
|
}, domProps.style);
|
|
5731
5840
|
const children = columns.map((col) => {
|
|
5732
5841
|
const hidden = false;
|
|
5733
|
-
return /* @__PURE__ */
|
|
5842
|
+
return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
|
|
5734
5843
|
key: col.id,
|
|
5735
5844
|
virtualized: false,
|
|
5736
5845
|
rowHeight,
|
|
@@ -5743,11 +5852,11 @@ function TableRowUnvirtualizedFn(props) {
|
|
|
5743
5852
|
column: col
|
|
5744
5853
|
});
|
|
5745
5854
|
});
|
|
5746
|
-
return /* @__PURE__ */
|
|
5855
|
+
return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({}, domProps), {
|
|
5747
5856
|
style
|
|
5748
5857
|
}), children);
|
|
5749
5858
|
}
|
|
5750
|
-
var TableRowUnvirtualized =
|
|
5859
|
+
var TableRowUnvirtualized = React28.memo(TableRowUnvirtualizedFn);
|
|
5751
5860
|
|
|
5752
5861
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5753
5862
|
function useUnpinnedRendering(params) {
|
|
@@ -5769,7 +5878,7 @@ function useUnpinnedRendering(params) {
|
|
|
5769
5878
|
} = params;
|
|
5770
5879
|
const { virtualizeColumns } = getState();
|
|
5771
5880
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
5772
|
-
const renderRowUnpinned = (0,
|
|
5881
|
+
const renderRowUnpinned = (0, import_react34.useCallback)((rowParams) => {
|
|
5773
5882
|
const dataArray = getData();
|
|
5774
5883
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5775
5884
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -5790,7 +5899,7 @@ function useUnpinnedRendering(params) {
|
|
|
5790
5899
|
rowProps.repaintId = repaintId;
|
|
5791
5900
|
}
|
|
5792
5901
|
const TableRowComponent = shouldVirtualizeColumns ? InfiniteTableRow : TableRowUnvirtualized;
|
|
5793
|
-
return /* @__PURE__ */
|
|
5902
|
+
return /* @__PURE__ */ React29.createElement(TableRowComponent, __spreadValues({}, rowProps));
|
|
5794
5903
|
}, [
|
|
5795
5904
|
repaintId,
|
|
5796
5905
|
rowHeight,
|
|
@@ -5800,7 +5909,7 @@ function useUnpinnedRendering(params) {
|
|
|
5800
5909
|
horizontalVirtualBrain,
|
|
5801
5910
|
verticalVirtualBrain
|
|
5802
5911
|
]);
|
|
5803
|
-
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */
|
|
5912
|
+
const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React29.createElement("div", {
|
|
5804
5913
|
"data-name": "horizontal-scrollbar-placeholder--fake",
|
|
5805
5914
|
style: {
|
|
5806
5915
|
position: "absolute",
|
|
@@ -5811,10 +5920,10 @@ function useUnpinnedRendering(params) {
|
|
|
5811
5920
|
overflow: "auto",
|
|
5812
5921
|
visibility: columnShifts ? "visible" : "hidden"
|
|
5813
5922
|
}
|
|
5814
|
-
}, /* @__PURE__ */
|
|
5923
|
+
}, /* @__PURE__ */ React29.createElement("div", {
|
|
5815
5924
|
style: { height: "100%", width: computedUnpinnedColumnsWidth }
|
|
5816
5925
|
})) : null;
|
|
5817
|
-
return rowHeight != 0 ? /* @__PURE__ */
|
|
5926
|
+
return rowHeight != 0 ? /* @__PURE__ */ React29.createElement(VirtualRowList, {
|
|
5818
5927
|
repaintId: `${repaintId}-unpinned-`,
|
|
5819
5928
|
brain: verticalVirtualBrain,
|
|
5820
5929
|
onContainerScroll: applyScrollHorizontal,
|
|
@@ -5835,17 +5944,17 @@ function useUnpinnedRendering(params) {
|
|
|
5835
5944
|
}
|
|
5836
5945
|
|
|
5837
5946
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5838
|
-
var
|
|
5947
|
+
var import_react35 = __toModule(require("react"));
|
|
5839
5948
|
|
|
5840
5949
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5841
|
-
var
|
|
5950
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5842
5951
|
var FooterCls = "_16lm1iw1";
|
|
5843
5952
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5844
|
-
var InfiniteClsRecipe = (0,
|
|
5953
|
+
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: [] });
|
|
5845
5954
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5846
5955
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5847
5956
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5848
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
5957
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5849
5958
|
|
|
5850
5959
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5851
5960
|
var DELAY = 200;
|
|
@@ -5868,14 +5977,14 @@ var useOnContainerScroll = ({
|
|
|
5868
5977
|
}
|
|
5869
5978
|
} = useInfiniteTable();
|
|
5870
5979
|
const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
|
|
5871
|
-
const timeoutIdRef = (0,
|
|
5872
|
-
const scrollingRef = (0,
|
|
5873
|
-
const scrollTopMaxRef = (0,
|
|
5874
|
-
(0,
|
|
5980
|
+
const timeoutIdRef = (0, import_react35.useRef)(0);
|
|
5981
|
+
const scrollingRef = (0, import_react35.useRef)(false);
|
|
5982
|
+
const scrollTopMaxRef = (0, import_react35.useRef)(0);
|
|
5983
|
+
(0, import_react35.useEffect)(() => {
|
|
5875
5984
|
const { current: node } = scrollerDOMRef;
|
|
5876
5985
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5877
5986
|
}, [reservedContentHeight, bodySize.height]);
|
|
5878
|
-
const setScrolling = (0,
|
|
5987
|
+
const setScrolling = (0, import_react35.useCallback)((scrolling) => {
|
|
5879
5988
|
var _a;
|
|
5880
5989
|
const prevScrolling = scrollingRef.current;
|
|
5881
5990
|
scrollingRef.current = scrolling;
|
|
@@ -5900,7 +6009,7 @@ var useOnContainerScroll = ({
|
|
|
5900
6009
|
}
|
|
5901
6010
|
}
|
|
5902
6011
|
}, []);
|
|
5903
|
-
const onContainerScroll = (0,
|
|
6012
|
+
const onContainerScroll = (0, import_react35.useCallback)((scrollInfo) => {
|
|
5904
6013
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5905
6014
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
5906
6015
|
setScrolling(true);
|
|
@@ -5910,15 +6019,15 @@ var useOnContainerScroll = ({
|
|
|
5910
6019
|
domRef.current,
|
|
5911
6020
|
setScrolling
|
|
5912
6021
|
]);
|
|
5913
|
-
const scrollPositionRef = (0,
|
|
6022
|
+
const scrollPositionRef = (0, import_react35.useRef)({
|
|
5914
6023
|
scrollLeft: 0,
|
|
5915
6024
|
scrollTop: 0
|
|
5916
6025
|
});
|
|
5917
|
-
const applyScrollHorizontal = (0,
|
|
6026
|
+
const applyScrollHorizontal = (0, import_react35.useCallback)(({ scrollLeft }) => {
|
|
5918
6027
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
5919
6028
|
onContainerScroll(scrollPositionRef.current);
|
|
5920
6029
|
}, [onContainerScroll]);
|
|
5921
|
-
const applyScrollVertical = (0,
|
|
6030
|
+
const applyScrollVertical = (0, import_react35.useCallback)(({ scrollTop }) => {
|
|
5922
6031
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
5923
6032
|
onContainerScroll(scrollPositionRef.current);
|
|
5924
6033
|
if (scrollTop === 0) {
|
|
@@ -5940,17 +6049,17 @@ var useOnContainerScroll = ({
|
|
|
5940
6049
|
};
|
|
5941
6050
|
|
|
5942
6051
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
5943
|
-
var React32 = __toModule(require("react"));
|
|
5944
|
-
var import_react39 = __toModule(require("react"));
|
|
5945
|
-
|
|
5946
|
-
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
5947
6052
|
var React31 = __toModule(require("react"));
|
|
5948
6053
|
var import_react38 = __toModule(require("react"));
|
|
5949
6054
|
|
|
5950
|
-
// src/components/
|
|
6055
|
+
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
6056
|
+
var React30 = __toModule(require("react"));
|
|
5951
6057
|
var import_react37 = __toModule(require("react"));
|
|
6058
|
+
|
|
6059
|
+
// src/components/hooks/useOnMount.ts
|
|
6060
|
+
var import_react36 = __toModule(require("react"));
|
|
5952
6061
|
function useOnMount(domRef, props) {
|
|
5953
|
-
(0,
|
|
6062
|
+
(0, import_react36.useEffect)(() => {
|
|
5954
6063
|
const { onMount, onUnmount } = props;
|
|
5955
6064
|
const node = domRef == null ? void 0 : domRef.current;
|
|
5956
6065
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -5981,8 +6090,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5981
6090
|
onMount,
|
|
5982
6091
|
onUnmount
|
|
5983
6092
|
} = props;
|
|
5984
|
-
const domRef = (0,
|
|
5985
|
-
const renderItem = (0,
|
|
6093
|
+
const domRef = (0, import_react37.useRef)(null);
|
|
6094
|
+
const renderItem = (0, import_react37.useCallback)((renderProps) => renderRow({
|
|
5986
6095
|
domRef: renderProps.domRef,
|
|
5987
6096
|
rowHeight: renderProps.itemSize,
|
|
5988
6097
|
rowIndex: renderProps.itemIndex
|
|
@@ -5991,7 +6100,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
5991
6100
|
onMount,
|
|
5992
6101
|
onUnmount
|
|
5993
6102
|
});
|
|
5994
|
-
(0,
|
|
6103
|
+
(0, import_react37.useEffect)(() => {
|
|
5995
6104
|
const onScroll = (scrollPosition) => {
|
|
5996
6105
|
const node = domRef.current;
|
|
5997
6106
|
if (node) {
|
|
@@ -6020,7 +6129,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
6020
6129
|
if (true) {
|
|
6021
6130
|
domProps["data-cmp-name"] = "RowListWithExternalScrolling";
|
|
6022
6131
|
}
|
|
6023
|
-
return /* @__PURE__ */
|
|
6132
|
+
return /* @__PURE__ */ React30.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React30.createElement(RawList, {
|
|
6024
6133
|
brain,
|
|
6025
6134
|
renderItem,
|
|
6026
6135
|
repaintId
|
|
@@ -6043,7 +6152,7 @@ function PinnedRowsContainer(props) {
|
|
|
6043
6152
|
brain,
|
|
6044
6153
|
renderRow
|
|
6045
6154
|
} = props;
|
|
6046
|
-
const style =
|
|
6155
|
+
const style = React31.useMemo(() => {
|
|
6047
6156
|
const result = pinning === "end" ? {
|
|
6048
6157
|
width: rowWidth,
|
|
6049
6158
|
height,
|
|
@@ -6058,7 +6167,7 @@ function PinnedRowsContainer(props) {
|
|
|
6058
6167
|
}
|
|
6059
6168
|
return result;
|
|
6060
6169
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
6061
|
-
const updateScroll = (0,
|
|
6170
|
+
const updateScroll = (0, import_react38.useCallback)((node, scrollPosition) => {
|
|
6062
6171
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
6063
6172
|
}, [hasOverflow, pinnedScrollListener]);
|
|
6064
6173
|
const rowListProps = {
|
|
@@ -6069,7 +6178,7 @@ function PinnedRowsContainer(props) {
|
|
|
6069
6178
|
className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
|
|
6070
6179
|
};
|
|
6071
6180
|
if (hasOverflow) {
|
|
6072
|
-
return /* @__PURE__ */
|
|
6181
|
+
return /* @__PURE__ */ React31.createElement(VirtualScrollContainer, {
|
|
6073
6182
|
scrollable: {
|
|
6074
6183
|
horizontal: true,
|
|
6075
6184
|
vertical: false
|
|
@@ -6085,22 +6194,22 @@ function PinnedRowsContainer(props) {
|
|
|
6085
6194
|
className: join(PinnedRowsContainerClsVariants({
|
|
6086
6195
|
pinned: pinning
|
|
6087
6196
|
}), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
|
|
6088
|
-
}, /* @__PURE__ */
|
|
6197
|
+
}, /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
|
|
6089
6198
|
onMount: (node) => {
|
|
6090
6199
|
pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
|
|
6091
6200
|
updateScroll(node, brain.getScrollPosition(), scrollPosition);
|
|
6092
6201
|
});
|
|
6093
6202
|
}
|
|
6094
|
-
})), /* @__PURE__ */
|
|
6203
|
+
})), /* @__PURE__ */ React31.createElement(SpacePlaceholder, {
|
|
6095
6204
|
width: rowWidth,
|
|
6096
6205
|
height: 1
|
|
6097
6206
|
}));
|
|
6098
6207
|
}
|
|
6099
|
-
return /* @__PURE__ */
|
|
6208
|
+
return /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
|
|
6100
6209
|
}
|
|
6101
6210
|
function useRenderPinnedRow(params) {
|
|
6102
6211
|
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
6103
|
-
const renderPinnedRow = (0,
|
|
6212
|
+
const renderPinnedRow = (0, import_react38.useCallback)((rowParams) => {
|
|
6104
6213
|
const dataArray = getData();
|
|
6105
6214
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
6106
6215
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -6116,7 +6225,7 @@ function useRenderPinnedRow(params) {
|
|
|
6116
6225
|
rowWidth: columnsWidth,
|
|
6117
6226
|
columns
|
|
6118
6227
|
}, rowParams);
|
|
6119
|
-
return /* @__PURE__ */
|
|
6228
|
+
return /* @__PURE__ */ React31.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
|
|
6120
6229
|
}, [columnsWidth, columns, verticalBrain]);
|
|
6121
6230
|
return renderPinnedRow;
|
|
6122
6231
|
}
|
|
@@ -6159,7 +6268,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6159
6268
|
columns,
|
|
6160
6269
|
columnsWidth
|
|
6161
6270
|
});
|
|
6162
|
-
const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */
|
|
6271
|
+
const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ React31.createElement(PinnedRowsContainer, {
|
|
6163
6272
|
pinning: side,
|
|
6164
6273
|
pinnedScrollListener,
|
|
6165
6274
|
hasOverflow,
|
|
@@ -6172,7 +6281,7 @@ function usePinnedRenderingForSide(side, params) {
|
|
|
6172
6281
|
brain: verticalVirtualBrain,
|
|
6173
6282
|
renderRow: renderRowPinned
|
|
6174
6283
|
}) : null;
|
|
6175
|
-
const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */
|
|
6284
|
+
const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ React31.createElement(HorizontalScrollbarPlaceholder, {
|
|
6176
6285
|
style: side === "end" ? {
|
|
6177
6286
|
width: columnsWidth,
|
|
6178
6287
|
right: hasVerticalScrollbar ? getScrollbarWidth() : 0
|
|
@@ -6214,7 +6323,7 @@ function usePinnedStartRendering(params) {
|
|
|
6214
6323
|
}
|
|
6215
6324
|
|
|
6216
6325
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6217
|
-
var
|
|
6326
|
+
var import_react40 = __toModule(require("react"));
|
|
6218
6327
|
|
|
6219
6328
|
// src/components/VirtualBrain/index.ts
|
|
6220
6329
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -6652,9 +6761,9 @@ var VirtualBrain = class extends Logger {
|
|
|
6652
6761
|
};
|
|
6653
6762
|
|
|
6654
6763
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
6655
|
-
var
|
|
6764
|
+
var import_react39 = __toModule(require("react"));
|
|
6656
6765
|
function useColumnSizeFn(computedUnpinnedColumns) {
|
|
6657
|
-
const columnSize = (0,
|
|
6766
|
+
const columnSize = (0, import_react39.useCallback)((index) => {
|
|
6658
6767
|
const column = computedUnpinnedColumns[index];
|
|
6659
6768
|
if (!column) {
|
|
6660
6769
|
console.log("cannot find column at index", index, computedUnpinnedColumns);
|
|
@@ -6693,7 +6802,7 @@ function useYourBrain(param) {
|
|
|
6693
6802
|
});
|
|
6694
6803
|
return brain;
|
|
6695
6804
|
});
|
|
6696
|
-
(0,
|
|
6805
|
+
(0, import_react40.useEffect)(() => {
|
|
6697
6806
|
return () => {
|
|
6698
6807
|
horizontalVirtualBrain.destroy();
|
|
6699
6808
|
verticalVirtualBrain.destroy();
|
|
@@ -6701,13 +6810,13 @@ function useYourBrain(param) {
|
|
|
6701
6810
|
}, []);
|
|
6702
6811
|
horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
|
|
6703
6812
|
verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
|
|
6704
|
-
(0,
|
|
6813
|
+
(0, import_react40.useEffect)(() => {
|
|
6705
6814
|
verticalVirtualBrain.setAvailableSize({
|
|
6706
6815
|
height: bodySize.height,
|
|
6707
6816
|
width: 0
|
|
6708
6817
|
});
|
|
6709
6818
|
}, [bodySize, verticalVirtualBrain]);
|
|
6710
|
-
(0,
|
|
6819
|
+
(0, import_react40.useEffect)(() => {
|
|
6711
6820
|
horizontalVirtualBrain.setAvailableSize({
|
|
6712
6821
|
height: 0,
|
|
6713
6822
|
width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
|
|
@@ -6745,12 +6854,12 @@ function useListRendering(param) {
|
|
|
6745
6854
|
pinnedEndScrollListener
|
|
6746
6855
|
} = componentState;
|
|
6747
6856
|
const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
|
|
6748
|
-
const repaintIdRef = (0,
|
|
6857
|
+
const repaintIdRef = (0, import_react41.useRef)(0);
|
|
6749
6858
|
if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
|
|
6750
6859
|
repaintIdRef.current++;
|
|
6751
6860
|
}
|
|
6752
6861
|
const repaintId = repaintIdRef.current;
|
|
6753
|
-
const rowSpan = (0,
|
|
6862
|
+
const rowSpan = (0, import_react41.useMemo)(() => {
|
|
6754
6863
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6755
6864
|
return colsWithRowspan.length ? ({ itemIndex }) => {
|
|
6756
6865
|
let maxSpan = 1;
|
|
@@ -6788,11 +6897,11 @@ function useListRendering(param) {
|
|
|
6788
6897
|
const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
|
|
6789
6898
|
const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
|
|
6790
6899
|
const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
|
|
6791
|
-
const scrollbars = (0,
|
|
6900
|
+
const scrollbars = (0, import_react41.useMemo)(() => ({
|
|
6792
6901
|
vertical: hasVerticalScrollbar,
|
|
6793
6902
|
horizontal: hasHorizontalScrollbar
|
|
6794
6903
|
}), [hasVerticalScrollbar, hasHorizontalScrollbar]);
|
|
6795
|
-
(0,
|
|
6904
|
+
(0, import_react41.useEffect)(() => {
|
|
6796
6905
|
if (!bodySize.height) {
|
|
6797
6906
|
return;
|
|
6798
6907
|
}
|
|
@@ -6805,7 +6914,6 @@ function useListRendering(param) {
|
|
|
6805
6914
|
setColumnVisibility: (columnVisibility) => {
|
|
6806
6915
|
componentActions.columnVisibility = columnVisibility;
|
|
6807
6916
|
},
|
|
6808
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6809
6917
|
getState,
|
|
6810
6918
|
getDataSourceState
|
|
6811
6919
|
};
|
|
@@ -6818,7 +6926,7 @@ function useListRendering(param) {
|
|
|
6818
6926
|
reservedContentHeight
|
|
6819
6927
|
});
|
|
6820
6928
|
const { componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
6821
|
-
const toggleGroupRow = (0,
|
|
6929
|
+
const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
|
|
6822
6930
|
const newState = new GroupRowsState(getDataSourceState().groupRowsState);
|
|
6823
6931
|
newState.toggleGroupRow(groupKeys);
|
|
6824
6932
|
dataSourceActions.groupRowsState = newState;
|
|
@@ -6853,7 +6961,7 @@ function useListRendering(param) {
|
|
|
6853
6961
|
computedUnpinnedColumns
|
|
6854
6962
|
});
|
|
6855
6963
|
const [, rerender] = useRerender();
|
|
6856
|
-
(0,
|
|
6964
|
+
(0, import_react41.useEffect)(() => {
|
|
6857
6965
|
rerender();
|
|
6858
6966
|
}, [dataSourceState]);
|
|
6859
6967
|
const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
|
|
@@ -6876,15 +6984,14 @@ function useListRendering(param) {
|
|
|
6876
6984
|
}
|
|
6877
6985
|
|
|
6878
6986
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6879
|
-
var
|
|
6880
|
-
var
|
|
6987
|
+
var React32 = __toModule(require("react"));
|
|
6988
|
+
var import_react42 = __toModule(require("react"));
|
|
6881
6989
|
|
|
6882
6990
|
// src/components/utils/decamelize.ts
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
};
|
|
6991
|
+
function decamelize(str, options) {
|
|
6992
|
+
const { separator } = options != null ? options : { separator: "-" };
|
|
6993
|
+
return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
|
|
6994
|
+
}
|
|
6888
6995
|
|
|
6889
6996
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6890
6997
|
var defaultStyle2 = {
|
|
@@ -6913,10 +7020,10 @@ var enforceStyle = (node, style) => {
|
|
|
6913
7020
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
6914
7021
|
}
|
|
6915
7022
|
};
|
|
6916
|
-
var InfiniteTableLicenseFooter =
|
|
7023
|
+
var InfiniteTableLicenseFooter = React32.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
6917
7024
|
const { rootClassName: rootClassName12 } = useInternalProps();
|
|
6918
|
-
const domRef =
|
|
6919
|
-
const domCallback =
|
|
7025
|
+
const domRef = React32.useRef(null);
|
|
7026
|
+
const domCallback = React32.useCallback((node) => {
|
|
6920
7027
|
domRef.current = node;
|
|
6921
7028
|
if (!ref) {
|
|
6922
7029
|
return;
|
|
@@ -6927,7 +7034,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6927
7034
|
ref.current = node;
|
|
6928
7035
|
}
|
|
6929
7036
|
}, []);
|
|
6930
|
-
(0,
|
|
7037
|
+
(0, import_react42.useEffect)(() => {
|
|
6931
7038
|
const forceStyle = () => {
|
|
6932
7039
|
requestAnimationFrame(() => {
|
|
6933
7040
|
var _a;
|
|
@@ -6941,12 +7048,12 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6941
7048
|
clearInterval(intervalId);
|
|
6942
7049
|
};
|
|
6943
7050
|
}, []);
|
|
6944
|
-
return /* @__PURE__ */
|
|
7051
|
+
return /* @__PURE__ */ React32.createElement("div", __spreadProps(__spreadValues({
|
|
6945
7052
|
ref: domCallback
|
|
6946
7053
|
}, props), {
|
|
6947
7054
|
className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
|
|
6948
7055
|
style: defaultStyle2
|
|
6949
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
7056
|
+
}), "Powered by", " ", /* @__PURE__ */ React32.createElement("a", {
|
|
6950
7057
|
href: "https://infinite-table.com",
|
|
6951
7058
|
rel: "noopener noreferrer",
|
|
6952
7059
|
role: "link",
|
|
@@ -6955,7 +7062,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
|
|
|
6955
7062
|
});
|
|
6956
7063
|
|
|
6957
7064
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
6958
|
-
var
|
|
7065
|
+
var import_react43 = __toModule(require("react"));
|
|
6959
7066
|
|
|
6960
7067
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
6961
7068
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -7105,10 +7212,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
|
7105
7212
|
var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
|
|
7106
7213
|
var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
|
|
7107
7214
|
var useLicense = (licenseKey = "") => {
|
|
7108
|
-
const valid = (0,
|
|
7215
|
+
const valid = (0, import_react43.useMemo)(() => {
|
|
7109
7216
|
let valid2 = isValidLicense(licenseKey, {
|
|
7110
7217
|
publishedAt: 1624970570587,
|
|
7111
|
-
version: "0.
|
|
7218
|
+
version: "0.1.2"
|
|
7112
7219
|
});
|
|
7113
7220
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7114
7221
|
return true;
|
|
@@ -7119,10 +7226,10 @@ var useLicense = (licenseKey = "") => {
|
|
|
7119
7226
|
};
|
|
7120
7227
|
|
|
7121
7228
|
// src/components/CSSVariableWatch.tsx
|
|
7122
|
-
var
|
|
7123
|
-
var
|
|
7229
|
+
var React33 = __toModule(require("react"));
|
|
7230
|
+
var import_react44 = __toModule(require("react"));
|
|
7124
7231
|
var error = err("CSSVariableWatch");
|
|
7125
|
-
var
|
|
7232
|
+
var debug6 = dbg("CSSVariableWatch");
|
|
7126
7233
|
var WRAPPER_STYLE = {
|
|
7127
7234
|
position: "absolute",
|
|
7128
7235
|
pointerEvents: "none",
|
|
@@ -7133,19 +7240,19 @@ var WRAPPER_STYLE = {
|
|
|
7133
7240
|
overflow: "hidden"
|
|
7134
7241
|
};
|
|
7135
7242
|
var useCSSVariableWatch = (params) => {
|
|
7136
|
-
const lastValueRef = (0,
|
|
7137
|
-
const onResize =
|
|
7243
|
+
const lastValueRef = (0, import_react44.useRef)(0);
|
|
7244
|
+
const onResize = React33.useCallback(({ height }) => {
|
|
7138
7245
|
if (height && height !== lastValueRef.current) {
|
|
7139
7246
|
lastValueRef.current = height;
|
|
7140
7247
|
params.onChange(height);
|
|
7141
7248
|
}
|
|
7142
7249
|
}, [params.onChange]);
|
|
7143
7250
|
useResizeObserver(params.ref, onResize, { earlyAttach: true });
|
|
7144
|
-
|
|
7251
|
+
React33.useLayoutEffect(() => {
|
|
7145
7252
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7146
7253
|
if (value) {
|
|
7147
7254
|
lastValueRef.current = value;
|
|
7148
|
-
|
|
7255
|
+
debug6(`Variable ${params.varName} found and equals ${value}.`);
|
|
7149
7256
|
params.onChange(value);
|
|
7150
7257
|
} else {
|
|
7151
7258
|
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
@@ -7153,15 +7260,15 @@ var useCSSVariableWatch = (params) => {
|
|
|
7153
7260
|
}, []);
|
|
7154
7261
|
};
|
|
7155
7262
|
var CSSVariableWatch = (props) => {
|
|
7156
|
-
const domRef = (0,
|
|
7263
|
+
const domRef = (0, import_react44.useRef)(null);
|
|
7157
7264
|
useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
|
|
7158
7265
|
ref: domRef
|
|
7159
7266
|
}));
|
|
7160
|
-
return /* @__PURE__ */
|
|
7267
|
+
return /* @__PURE__ */ React33.createElement("div", {
|
|
7161
7268
|
"data-name": "css-variable-watcher",
|
|
7162
7269
|
"data-var": props.varName,
|
|
7163
7270
|
style: WRAPPER_STYLE
|
|
7164
|
-
}, /* @__PURE__ */
|
|
7271
|
+
}, /* @__PURE__ */ React33.createElement("div", {
|
|
7165
7272
|
ref: domRef,
|
|
7166
7273
|
style: {
|
|
7167
7274
|
height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
|
|
@@ -7254,7 +7361,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
7254
7361
|
}
|
|
7255
7362
|
|
|
7256
7363
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
7257
|
-
var
|
|
7364
|
+
var React34 = __toModule(require("react"));
|
|
7258
7365
|
|
|
7259
7366
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
7260
7367
|
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv" };
|
|
@@ -7266,15 +7373,15 @@ var { rootClassName: rootClassName11 } = internalProps;
|
|
|
7266
7373
|
var baseCls2 = `${rootClassName11}-LoadMask`;
|
|
7267
7374
|
function LoadMaskFn(props) {
|
|
7268
7375
|
const { visible, children = "Loading" } = props;
|
|
7269
|
-
return /* @__PURE__ */
|
|
7376
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
7270
7377
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
|
|
7271
|
-
}, /* @__PURE__ */
|
|
7378
|
+
}, /* @__PURE__ */ React34.createElement("div", {
|
|
7272
7379
|
className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
|
|
7273
|
-
}), /* @__PURE__ */
|
|
7380
|
+
}), /* @__PURE__ */ React34.createElement("div", {
|
|
7274
7381
|
className: `${LoadMaskTextCls} ${baseCls2}-Text`
|
|
7275
7382
|
}, children));
|
|
7276
7383
|
}
|
|
7277
|
-
var LoadMask =
|
|
7384
|
+
var LoadMask = React34.memo(LoadMaskFn);
|
|
7278
7385
|
|
|
7279
7386
|
// src/components/InfiniteTable/index.tsx
|
|
7280
7387
|
var InfiniteTableClassName = internalProps.rootClassName;
|
|
@@ -7293,7 +7400,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
7293
7400
|
getParentState: () => useDataSource(),
|
|
7294
7401
|
debugName: "InfiniteTable"
|
|
7295
7402
|
});
|
|
7296
|
-
var InfiniteTableComponent =
|
|
7403
|
+
var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
7297
7404
|
var _a;
|
|
7298
7405
|
const {
|
|
7299
7406
|
componentState,
|
|
@@ -7340,7 +7447,7 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7340
7447
|
const licenseValid = useLicense(licenseKey);
|
|
7341
7448
|
const domProps = useDOMProps(componentState.domProps);
|
|
7342
7449
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
7343
|
-
|
|
7450
|
+
React35.useLayoutEffect(() => {
|
|
7344
7451
|
const dataSourceState = getDataSourceState();
|
|
7345
7452
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
7346
7453
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -7349,31 +7456,31 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
|
|
|
7349
7456
|
}
|
|
7350
7457
|
notifyScrollbarsChange(scrollbars);
|
|
7351
7458
|
}, [scrollbars]);
|
|
7352
|
-
return /* @__PURE__ */
|
|
7459
|
+
return /* @__PURE__ */ React35.createElement("div", __spreadValues({
|
|
7353
7460
|
ref: domRef
|
|
7354
|
-
}, domProps), header ? /* @__PURE__ */
|
|
7461
|
+
}, domProps), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
|
|
7355
7462
|
brain: horizontalVirtualBrain,
|
|
7356
7463
|
repaintId,
|
|
7357
7464
|
scrollbars
|
|
7358
|
-
}) : null, /* @__PURE__ */
|
|
7465
|
+
}) : null, /* @__PURE__ */ React35.createElement(InfiniteTableBody, null, /* @__PURE__ */ React35.createElement(VirtualScrollContainer, {
|
|
7359
7466
|
ref: scrollerDOMRef,
|
|
7360
7467
|
onContainerScroll: applyScrollVertical,
|
|
7361
7468
|
scrollable: ONLY_VERTICAL_SCROLLBAR
|
|
7362
|
-
}, /* @__PURE__ */
|
|
7469
|
+
}, /* @__PURE__ */ React35.createElement("div", {
|
|
7363
7470
|
className: display.flex
|
|
7364
|
-
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */
|
|
7471
|
+
}, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React35.createElement(SpacePlaceholder, {
|
|
7365
7472
|
count: dataArray.length,
|
|
7366
7473
|
width: 0,
|
|
7367
7474
|
height: reservedContentHeight
|
|
7368
|
-
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */
|
|
7475
|
+
})), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React35.createElement(LoadMaskCmp, {
|
|
7369
7476
|
visible: loading
|
|
7370
|
-
}, loadingText)), licenseValid ? null : /* @__PURE__ */
|
|
7477
|
+
}, loadingText)), licenseValid ? null : /* @__PURE__ */ React35.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React35.createElement("div", {
|
|
7371
7478
|
ref: portalDOMRef,
|
|
7372
7479
|
className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
7373
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
7480
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
|
|
7374
7481
|
varName: rowHeightCSSVar,
|
|
7375
7482
|
onChange: onRowHeightCSSVarChange
|
|
7376
|
-
}) : null, headerHeightCSSVar ? /* @__PURE__ */
|
|
7483
|
+
}) : null, headerHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
|
|
7377
7484
|
varName: headerHeightCSSVar,
|
|
7378
7485
|
onChange: onHeaderHeightCSSVarChange
|
|
7379
7486
|
}) : null);
|
|
@@ -7409,25 +7516,25 @@ function InfiniteTableContextProvider() {
|
|
|
7409
7516
|
}
|
|
7410
7517
|
componentActions.bodySize = bodySize;
|
|
7411
7518
|
}, { earlyAttach: true });
|
|
7412
|
-
|
|
7519
|
+
React35.useEffect(() => {
|
|
7413
7520
|
return () => {
|
|
7414
7521
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
7415
7522
|
componentState.onHeaderHeightCSSVarChange.destroy();
|
|
7416
7523
|
};
|
|
7417
7524
|
}, []);
|
|
7418
|
-
|
|
7525
|
+
React35.useEffect(() => {
|
|
7419
7526
|
if (scrollerDOMRef.current) {
|
|
7420
7527
|
scrollerDOMRef.current.scrollTop = 0;
|
|
7421
7528
|
}
|
|
7422
7529
|
}, [scrollTopId, scrollerDOMRef]);
|
|
7423
7530
|
const TableContext2 = getInfiniteTableContext();
|
|
7424
|
-
return /* @__PURE__ */
|
|
7531
|
+
return /* @__PURE__ */ React35.createElement(TableContext2.Provider, {
|
|
7425
7532
|
value: contextValue
|
|
7426
|
-
}, /* @__PURE__ */
|
|
7533
|
+
}, /* @__PURE__ */ React35.createElement(InfiniteTableComponent, null));
|
|
7427
7534
|
}
|
|
7428
7535
|
function InfiniteTable(props) {
|
|
7429
|
-
const table = /* @__PURE__ */
|
|
7430
|
-
return /* @__PURE__ */
|
|
7536
|
+
const table = /* @__PURE__ */ React35.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(InfiniteTableContextProvider, null));
|
|
7537
|
+
return /* @__PURE__ */ React35.createElement(React35.StrictMode, null, table);
|
|
7431
7538
|
}
|
|
7432
7539
|
InfiniteTable.defaultProps = {
|
|
7433
7540
|
rowHeight: 40,
|