@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.esm.js
CHANGED
|
@@ -193,11 +193,11 @@ var require_common = __commonJS({
|
|
|
193
193
|
let enableOverride = null;
|
|
194
194
|
let namespacesCache;
|
|
195
195
|
let enabledCache;
|
|
196
|
-
function
|
|
197
|
-
if (!
|
|
196
|
+
function debug7(...args) {
|
|
197
|
+
if (!debug7.enabled) {
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
const self =
|
|
200
|
+
const self = debug7;
|
|
201
201
|
const curr = Number(new Date());
|
|
202
202
|
const ms = curr - (prevTime || curr);
|
|
203
203
|
self.diff = ms;
|
|
@@ -227,12 +227,12 @@ var require_common = __commonJS({
|
|
|
227
227
|
const logFn = self.log || createDebug.log;
|
|
228
228
|
logFn.apply(self, args);
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
Object.defineProperty(
|
|
230
|
+
debug7.namespace = namespace;
|
|
231
|
+
debug7.useColors = createDebug.useColors();
|
|
232
|
+
debug7.color = createDebug.selectColor(namespace);
|
|
233
|
+
debug7.extend = extend;
|
|
234
|
+
debug7.destroy = createDebug.destroy;
|
|
235
|
+
Object.defineProperty(debug7, "enabled", {
|
|
236
236
|
enumerable: true,
|
|
237
237
|
configurable: false,
|
|
238
238
|
get: () => {
|
|
@@ -250,9 +250,9 @@ var require_common = __commonJS({
|
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
if (typeof createDebug.init === "function") {
|
|
253
|
-
createDebug.init(
|
|
253
|
+
createDebug.init(debug7);
|
|
254
254
|
}
|
|
255
|
-
return
|
|
255
|
+
return debug7;
|
|
256
256
|
}
|
|
257
257
|
function extend(namespace, delimiter) {
|
|
258
258
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
@@ -616,38 +616,6 @@ var require_binary_search = __commonJS({
|
|
|
616
616
|
}
|
|
617
617
|
});
|
|
618
618
|
|
|
619
|
-
// node_modules/decamelize/index.js
|
|
620
|
-
var require_decamelize = __commonJS({
|
|
621
|
-
"node_modules/decamelize/index.js"(exports, module) {
|
|
622
|
-
"use strict";
|
|
623
|
-
var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
|
|
624
|
-
decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
|
|
625
|
-
return $0.toLowerCase();
|
|
626
|
-
});
|
|
627
|
-
return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
|
|
628
|
-
return $1 + separator + $2.toLowerCase();
|
|
629
|
-
});
|
|
630
|
-
};
|
|
631
|
-
module.exports = (text, {
|
|
632
|
-
separator = "_",
|
|
633
|
-
preserveConsecutiveUppercase = false
|
|
634
|
-
} = {}) => {
|
|
635
|
-
if (!(typeof text === "string" && typeof separator === "string")) {
|
|
636
|
-
throw new TypeError("The `text` and `separator` arguments should be of type `string`");
|
|
637
|
-
}
|
|
638
|
-
if (text.length < 2) {
|
|
639
|
-
return preserveConsecutiveUppercase ? text : text.toLowerCase();
|
|
640
|
-
}
|
|
641
|
-
const replacement = `$1${separator}$2`;
|
|
642
|
-
const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
|
|
643
|
-
if (preserveConsecutiveUppercase) {
|
|
644
|
-
return handlePreserveConsecutiveUppercase(decamelized, separator);
|
|
645
|
-
}
|
|
646
|
-
return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
|
|
651
619
|
// src/components/InfiniteTable/index.tsx
|
|
652
620
|
import {
|
|
653
621
|
StrictMode,
|
|
@@ -735,6 +703,17 @@ var ScrollListener = class {
|
|
|
735
703
|
}
|
|
736
704
|
};
|
|
737
705
|
|
|
706
|
+
// src/components/InfiniteTable/utils/toMap.ts
|
|
707
|
+
function toMap(mapOrObject) {
|
|
708
|
+
if (!mapOrObject) {
|
|
709
|
+
return new Map();
|
|
710
|
+
}
|
|
711
|
+
if (mapOrObject instanceof Map) {
|
|
712
|
+
return mapOrObject;
|
|
713
|
+
}
|
|
714
|
+
return new Map(Object.entries(mapOrObject));
|
|
715
|
+
}
|
|
716
|
+
|
|
738
717
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
739
718
|
function computeColumnGroupsDepths(columnGroups) {
|
|
740
719
|
const map2 = new Map();
|
|
@@ -758,15 +737,6 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
758
737
|
}
|
|
759
738
|
|
|
760
739
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
761
|
-
function toMap(mapOrObject) {
|
|
762
|
-
if (!mapOrObject) {
|
|
763
|
-
return new Map();
|
|
764
|
-
}
|
|
765
|
-
if (mapOrObject instanceof Map) {
|
|
766
|
-
return mapOrObject;
|
|
767
|
-
}
|
|
768
|
-
return new Map(Object.entries(mapOrObject));
|
|
769
|
-
}
|
|
770
740
|
function toColumnTypesMap(mapOrObject) {
|
|
771
741
|
return toMap(mapOrObject);
|
|
772
742
|
}
|
|
@@ -836,6 +806,7 @@ var forwardProps = () => {
|
|
|
836
806
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
837
807
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
838
808
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
809
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
839
810
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
840
811
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
841
812
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
@@ -847,7 +818,10 @@ var forwardProps = () => {
|
|
|
847
818
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
848
819
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
849
820
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
850
|
-
columnVisibility: (columnVisibility) =>
|
|
821
|
+
columnVisibility: (columnVisibility) => {
|
|
822
|
+
var _a;
|
|
823
|
+
return (_a = toMap(columnVisibility)) != null ? _a : new Map();
|
|
824
|
+
},
|
|
851
825
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
852
826
|
columnSizing: (columnSizing) => {
|
|
853
827
|
var _a;
|
|
@@ -857,21 +831,20 @@ var forwardProps = () => {
|
|
|
857
831
|
var _a;
|
|
858
832
|
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
859
833
|
},
|
|
860
|
-
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
861
834
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
862
835
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
863
836
|
};
|
|
864
837
|
};
|
|
865
838
|
function getGroupRenderStrategy(options) {
|
|
866
|
-
const {
|
|
839
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
867
840
|
if (groupRenderStrategy) {
|
|
868
841
|
return groupRenderStrategy;
|
|
869
842
|
}
|
|
870
843
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
871
844
|
return "single-column";
|
|
872
845
|
}
|
|
873
|
-
const
|
|
874
|
-
if (
|
|
846
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
847
|
+
if (columnsInGroupBy.length) {
|
|
875
848
|
return "multi-column";
|
|
876
849
|
}
|
|
877
850
|
return "multi-column";
|
|
@@ -882,16 +855,17 @@ var mapPropsToState = (params) => {
|
|
|
882
855
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
883
856
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
884
857
|
const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != (oldState == null ? void 0 : oldState.columnGroups) || state.pivotColumnGroups && state.pivotColumnGroups != (oldState == null ? void 0 : oldState.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
|
|
885
|
-
const
|
|
858
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
886
859
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
887
860
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
888
|
-
|
|
861
|
+
groupBy,
|
|
889
862
|
groupColumn: props.groupColumn
|
|
890
863
|
});
|
|
864
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
891
865
|
return {
|
|
892
866
|
groupRenderStrategy,
|
|
893
|
-
|
|
894
|
-
computedColumns
|
|
867
|
+
groupBy,
|
|
868
|
+
computedColumns,
|
|
895
869
|
virtualizeHeader,
|
|
896
870
|
columnGroupsDepthsMap,
|
|
897
871
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1303,8 +1277,8 @@ var getComputedVisibleColumns = ({
|
|
|
1303
1277
|
const colTypeSizing = {
|
|
1304
1278
|
minWidth: colType == null ? void 0 : colType.minWidth,
|
|
1305
1279
|
maxWidth: colType == null ? void 0 : colType.maxWidth,
|
|
1306
|
-
width: colType == null ? void 0 : colType.
|
|
1307
|
-
flex: colType == null ? void 0 : colType.
|
|
1280
|
+
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1281
|
+
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1308
1282
|
};
|
|
1309
1283
|
let colSizing = columnSizing.get(colId) || {};
|
|
1310
1284
|
if (colSizing.width != null) {
|
|
@@ -1357,7 +1331,7 @@ var getComputedVisibleColumns = ({
|
|
|
1357
1331
|
});
|
|
1358
1332
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
1359
1333
|
columnsArray.forEach((c, i) => {
|
|
1360
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1334
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1361
1335
|
const id = visibleColumnOrder[i];
|
|
1362
1336
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
1363
1337
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -1418,6 +1392,7 @@ var getComputedVisibleColumns = ({
|
|
|
1418
1392
|
const result2 = __spreadProps(__spreadValues({
|
|
1419
1393
|
align: colType.align,
|
|
1420
1394
|
verticalAlign: colType.verticalAlign,
|
|
1395
|
+
valueGetter: colType.valueGetter,
|
|
1421
1396
|
renderValue: colType.renderValue,
|
|
1422
1397
|
render: colType.render
|
|
1423
1398
|
}, c), {
|
|
@@ -1425,7 +1400,7 @@ var getComputedVisibleColumns = ({
|
|
|
1425
1400
|
computedAbsoluteOffset,
|
|
1426
1401
|
computedPinningOffset,
|
|
1427
1402
|
computedOffset,
|
|
1428
|
-
computedSortable: (_e = (_d = c.sortable) != null ? _d : sortable) != null ? _e : true,
|
|
1403
|
+
computedSortable: (_f = (_e = (_d = c.sortable) != null ? _d : colType.sortable) != null ? _e : sortable) != null ? _f : true,
|
|
1429
1404
|
computedSortInfo,
|
|
1430
1405
|
computedSortIndex,
|
|
1431
1406
|
computedMultiSort: multiSort,
|
|
@@ -1434,14 +1409,14 @@ var getComputedVisibleColumns = ({
|
|
|
1434
1409
|
computedSortedDesc,
|
|
1435
1410
|
computedVisibleIndex: i,
|
|
1436
1411
|
computedPinned,
|
|
1437
|
-
computedDraggable: (
|
|
1412
|
+
computedDraggable: (_h = (_g = c.draggable) != null ? _g : draggableColumns) != null ? _h : true,
|
|
1438
1413
|
computedFirstInCategory,
|
|
1439
1414
|
computedLastInCategory,
|
|
1440
1415
|
computedFirst: i === 0,
|
|
1441
1416
|
computedLast,
|
|
1442
1417
|
toggleSort,
|
|
1443
1418
|
id,
|
|
1444
|
-
header: (
|
|
1419
|
+
header: (_k = (_j = (_i = c.header) != null ? _i : colType.header) != null ? _j : c.name) != null ? _k : c.field
|
|
1445
1420
|
});
|
|
1446
1421
|
computedOffset += computedWidth;
|
|
1447
1422
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -1677,48 +1652,17 @@ var useComputedVisibleColumns = ({
|
|
|
1677
1652
|
var sortAscending = (a, b) => a - b;
|
|
1678
1653
|
|
|
1679
1654
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1680
|
-
import { useCallback as useCallback5, useState as useState5 } from "react";
|
|
1681
|
-
|
|
1682
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1683
|
-
import { useEffect as useEffect5 } from "react";
|
|
1684
|
-
|
|
1685
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1686
|
-
import {
|
|
1687
|
-
useContext as useContext2
|
|
1688
|
-
} from "react";
|
|
1689
|
-
|
|
1690
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1691
|
-
import {
|
|
1692
|
-
createContext as createContext2
|
|
1693
|
-
} from "react";
|
|
1694
|
-
var DSContext;
|
|
1695
|
-
function getDataSourceContext() {
|
|
1696
|
-
if (DSContext) {
|
|
1697
|
-
return DSContext;
|
|
1698
|
-
}
|
|
1699
|
-
return DSContext = createContext2({
|
|
1700
|
-
getState: () => null,
|
|
1701
|
-
componentState: null,
|
|
1702
|
-
componentActions: null
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1707
|
-
function useDataSourceActions() {
|
|
1708
|
-
const DataSourceContext = getDataSourceContext();
|
|
1709
|
-
const contextValue = useContext2(DataSourceContext);
|
|
1710
|
-
return contextValue.componentActions;
|
|
1711
|
-
}
|
|
1655
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useState as useState5 } from "react";
|
|
1712
1656
|
|
|
1713
1657
|
// src/components/hooks/useComponentState.tsx
|
|
1714
1658
|
import {
|
|
1715
1659
|
createElement as createElement2,
|
|
1716
1660
|
memo,
|
|
1717
|
-
useContext as
|
|
1661
|
+
useContext as useContext2
|
|
1718
1662
|
} from "react";
|
|
1719
1663
|
import {
|
|
1720
1664
|
useReducer,
|
|
1721
|
-
createContext as
|
|
1665
|
+
createContext as createContext2,
|
|
1722
1666
|
useMemo as useMemo3,
|
|
1723
1667
|
useEffect as useEffect4,
|
|
1724
1668
|
useState as useState2,
|
|
@@ -1798,7 +1742,7 @@ function getComponentStateContext() {
|
|
|
1798
1742
|
if (ComponentContext) {
|
|
1799
1743
|
return ComponentContext;
|
|
1800
1744
|
}
|
|
1801
|
-
return ComponentContext =
|
|
1745
|
+
return ComponentContext = createContext2(null);
|
|
1802
1746
|
}
|
|
1803
1747
|
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1804
1748
|
const state = getState();
|
|
@@ -1854,12 +1798,14 @@ function forwardProps2(propsToForward, props) {
|
|
|
1854
1798
|
function getComponentStateRoot(config) {
|
|
1855
1799
|
return memo(function ComponentStateRoot(props) {
|
|
1856
1800
|
var _a, _b;
|
|
1801
|
+
const [initialSetupState] = useState2(() => {
|
|
1802
|
+
return config.initSetupState ? config.initSetupState() : {};
|
|
1803
|
+
});
|
|
1857
1804
|
const propsToStateSetRef = useRef4(new Set());
|
|
1858
|
-
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps() : {}, []);
|
|
1805
|
+
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
1859
1806
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
1860
1807
|
const getParentState = useLatest(parentState);
|
|
1861
1808
|
const [wholeState] = useState2(() => {
|
|
1862
|
-
const initialSetupState = config.initSetupState ? config.initSetupState() : {};
|
|
1863
1809
|
let mappedState = {};
|
|
1864
1810
|
if (propsToForward) {
|
|
1865
1811
|
mappedState = forwardProps2(propsToForward, props);
|
|
@@ -1957,7 +1903,7 @@ function getComponentStateRoot(config) {
|
|
|
1957
1903
|
if (oldValue === newValue) {
|
|
1958
1904
|
continue;
|
|
1959
1905
|
}
|
|
1960
|
-
if (isControlled(key, props)) {
|
|
1906
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1961
1907
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1962
1908
|
let valueToSet = newValue;
|
|
1963
1909
|
const forwardFn = propsToForward[k];
|
|
@@ -1994,56 +1940,44 @@ function getComponentStateRoot(config) {
|
|
|
1994
1940
|
}
|
|
1995
1941
|
function useComponentState() {
|
|
1996
1942
|
const Context = getComponentStateContext();
|
|
1997
|
-
return
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
2001
|
-
function useColumnAggregations() {
|
|
2002
|
-
const {
|
|
2003
|
-
componentState: { columnAggregations },
|
|
2004
|
-
getComponentState
|
|
2005
|
-
} = useComponentState();
|
|
2006
|
-
const dataSourceActions = useDataSourceActions();
|
|
2007
|
-
useEffect5(() => {
|
|
2008
|
-
function updateDataSourceAggregations() {
|
|
2009
|
-
const reducers = [];
|
|
2010
|
-
const componentState = getComponentState();
|
|
2011
|
-
columnAggregations.forEach((aggregator, key) => {
|
|
2012
|
-
var _a;
|
|
2013
|
-
const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
|
|
2014
|
-
const newAggregator = __spreadValues({
|
|
2015
|
-
getter: (data) => colField ? data[colField] : data
|
|
2016
|
-
}, aggregator);
|
|
2017
|
-
reducers.push(newAggregator);
|
|
2018
|
-
});
|
|
2019
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
2020
|
-
}
|
|
2021
|
-
updateDataSourceAggregations();
|
|
2022
|
-
return interceptMap(columnAggregations, {
|
|
2023
|
-
clear: updateDataSourceAggregations,
|
|
2024
|
-
delete: updateDataSourceAggregations,
|
|
2025
|
-
set: updateDataSourceAggregations
|
|
2026
|
-
});
|
|
2027
|
-
}, [columnAggregations]);
|
|
1943
|
+
return useContext2(Context);
|
|
2028
1944
|
}
|
|
2029
1945
|
|
|
2030
1946
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2031
1947
|
import {
|
|
2032
|
-
useContext as
|
|
1948
|
+
useContext as useContext3
|
|
2033
1949
|
} from "react";
|
|
1950
|
+
|
|
1951
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1952
|
+
import {
|
|
1953
|
+
createContext as createContext3
|
|
1954
|
+
} from "react";
|
|
1955
|
+
var DSContext;
|
|
1956
|
+
function getDataSourceContext() {
|
|
1957
|
+
if (DSContext) {
|
|
1958
|
+
return DSContext;
|
|
1959
|
+
}
|
|
1960
|
+
return DSContext = createContext3({
|
|
1961
|
+
getState: () => null,
|
|
1962
|
+
componentState: null,
|
|
1963
|
+
componentActions: null
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2034
1968
|
function useDataSource() {
|
|
2035
1969
|
const DataSourceContext = getDataSourceContext();
|
|
2036
|
-
const contextValue =
|
|
1970
|
+
const contextValue = useContext3(DataSourceContext);
|
|
2037
1971
|
return contextValue.componentState;
|
|
2038
1972
|
}
|
|
2039
1973
|
function useDataSourceContextValue() {
|
|
2040
1974
|
const DataSourceContext = getDataSourceContext();
|
|
2041
|
-
const contextValue =
|
|
1975
|
+
const contextValue = useContext3(DataSourceContext);
|
|
2042
1976
|
return contextValue;
|
|
2043
1977
|
}
|
|
2044
1978
|
|
|
2045
1979
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
2046
|
-
import { useEffect as
|
|
1980
|
+
import { useEffect as useEffect5 } from "react";
|
|
2047
1981
|
function useColumnGroups() {
|
|
2048
1982
|
const {
|
|
2049
1983
|
componentState: {
|
|
@@ -2053,7 +1987,7 @@ function useColumnGroups() {
|
|
|
2053
1987
|
componentActions,
|
|
2054
1988
|
getComponentState
|
|
2055
1989
|
} = useComponentState();
|
|
2056
|
-
|
|
1990
|
+
useEffect5(() => {
|
|
2057
1991
|
const recompute = () => {
|
|
2058
1992
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
2059
1993
|
};
|
|
@@ -2064,7 +1998,7 @@ function useColumnGroups() {
|
|
|
2064
1998
|
set: update
|
|
2065
1999
|
});
|
|
2066
2000
|
}, [computedColumnGroups]);
|
|
2067
|
-
|
|
2001
|
+
useEffect5(() => {
|
|
2068
2002
|
return interceptMap(collapsedColumnGroups, {
|
|
2069
2003
|
set: (key, visibleCol) => {
|
|
2070
2004
|
const colIds = key.slice(1);
|
|
@@ -2096,7 +2030,7 @@ function useColumnGroups() {
|
|
|
2096
2030
|
}
|
|
2097
2031
|
|
|
2098
2032
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2099
|
-
import { useEffect as
|
|
2033
|
+
import { useEffect as useEffect9, useMemo as useMemo5 } from "react";
|
|
2100
2034
|
|
|
2101
2035
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2102
2036
|
import {
|
|
@@ -2109,27 +2043,14 @@ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
|
2109
2043
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2110
2044
|
import {
|
|
2111
2045
|
createElement as createElement3,
|
|
2112
|
-
useEffect as
|
|
2046
|
+
useEffect as useEffect6
|
|
2113
2047
|
} from "react";
|
|
2114
2048
|
import { useState as useState3 } from "react";
|
|
2115
2049
|
|
|
2116
|
-
// src/components/InfiniteTable/
|
|
2117
|
-
var
|
|
2118
|
-
var
|
|
2119
|
-
var
|
|
2120
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2121
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2122
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2123
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2124
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2125
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2126
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2127
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2128
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2129
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2130
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2131
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2132
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2050
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2051
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2052
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2053
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2133
2054
|
|
|
2134
2055
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2135
2056
|
function ExpanderIcon(props) {
|
|
@@ -2143,7 +2064,7 @@ function ExpanderIcon(props) {
|
|
|
2143
2064
|
setExpanded(!expanded);
|
|
2144
2065
|
}
|
|
2145
2066
|
};
|
|
2146
|
-
|
|
2067
|
+
useEffect6(() => {
|
|
2147
2068
|
if (isControlled("expanded", props)) {
|
|
2148
2069
|
setExpanded(props.expanded);
|
|
2149
2070
|
}
|
|
@@ -2156,18 +2077,37 @@ function ExpanderIcon(props) {
|
|
|
2156
2077
|
width: `${size}px`,
|
|
2157
2078
|
style: props.style,
|
|
2158
2079
|
onClick,
|
|
2159
|
-
className: join(props.className,
|
|
2080
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2081
|
+
expanded
|
|
2082
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2160
2083
|
}, /* @__PURE__ */ createElement3("path", {
|
|
2161
2084
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2162
2085
|
}));
|
|
2163
2086
|
}
|
|
2164
2087
|
|
|
2165
2088
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2166
|
-
var
|
|
2089
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2167
2090
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2168
|
-
var RowClsRecipe = (0,
|
|
2091
|
+
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: [] });
|
|
2169
2092
|
var RowHoverCls = "_7pupv01";
|
|
2170
2093
|
|
|
2094
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2095
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2096
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2097
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2098
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2099
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2100
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2101
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2102
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2103
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2104
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2105
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2106
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2107
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2108
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2109
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2110
|
+
|
|
2171
2111
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2172
2112
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2173
2113
|
if (!pivotColumns) {
|
|
@@ -2177,7 +2117,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2177
2117
|
pivotColumn,
|
|
2178
2118
|
pivotRowLabelsColumn,
|
|
2179
2119
|
pivotBy,
|
|
2180
|
-
|
|
2120
|
+
groupBy,
|
|
2181
2121
|
pivotTotalColumnPosition,
|
|
2182
2122
|
toggleGroupRow
|
|
2183
2123
|
} = params;
|
|
@@ -2194,7 +2134,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2194
2134
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2195
2135
|
column,
|
|
2196
2136
|
pivotBy,
|
|
2197
|
-
|
|
2137
|
+
groupBy
|
|
2198
2138
|
}));
|
|
2199
2139
|
} else {
|
|
2200
2140
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2206,7 +2146,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2206
2146
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2207
2147
|
column,
|
|
2208
2148
|
pivotBy,
|
|
2209
|
-
|
|
2149
|
+
groupBy
|
|
2210
2150
|
}));
|
|
2211
2151
|
} else {
|
|
2212
2152
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2215,11 +2155,11 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2215
2155
|
if (!column.render) {
|
|
2216
2156
|
column.render = (renderOptions) => {
|
|
2217
2157
|
var _a;
|
|
2218
|
-
let { value, rowInfo, column: column2,
|
|
2158
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2219
2159
|
if (column2.renderValue) {
|
|
2220
2160
|
value = column2.renderValue(renderOptions);
|
|
2221
2161
|
}
|
|
2222
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2162
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2223
2163
|
return /* @__PURE__ */ createElement4("div", {
|
|
2224
2164
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2225
2165
|
}, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
|
|
@@ -2319,7 +2259,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2319
2259
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2320
2260
|
let generatedGroupColumn = {
|
|
2321
2261
|
header: `Group`,
|
|
2322
|
-
groupByField: options.
|
|
2262
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2323
2263
|
sortable: false,
|
|
2324
2264
|
render: (renderOptions) => {
|
|
2325
2265
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2435,10 +2375,10 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
2435
2375
|
};
|
|
2436
2376
|
|
|
2437
2377
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2438
|
-
import { useEffect as
|
|
2378
|
+
import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
2439
2379
|
|
|
2440
2380
|
// src/components/hooks/useEffectWithChanges.ts
|
|
2441
|
-
import { useEffect as
|
|
2381
|
+
import { useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
2442
2382
|
function useEffectWithChanges(fn, deps) {
|
|
2443
2383
|
const prevRef = useRef5({});
|
|
2444
2384
|
const oldValuesRef = useRef5({});
|
|
@@ -2456,7 +2396,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
2456
2396
|
}
|
|
2457
2397
|
}
|
|
2458
2398
|
prevRef.current = deps;
|
|
2459
|
-
|
|
2399
|
+
useEffect7(() => {
|
|
2460
2400
|
const changes2 = changesRef.current;
|
|
2461
2401
|
const result = fn(changes2, oldValues);
|
|
2462
2402
|
changesRef.current = {};
|
|
@@ -2466,26 +2406,38 @@ function useEffectWithChanges(fn, deps) {
|
|
|
2466
2406
|
}
|
|
2467
2407
|
|
|
2468
2408
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2469
|
-
|
|
2409
|
+
var debug3 = dbg("DataSource:useLoadData");
|
|
2410
|
+
function anonimizeValues(arg) {
|
|
2411
|
+
const result = {};
|
|
2412
|
+
for (var k in arg)
|
|
2413
|
+
if (arg.hasOwnProperty(k)) {
|
|
2414
|
+
result[k] = true;
|
|
2415
|
+
}
|
|
2416
|
+
return result;
|
|
2417
|
+
}
|
|
2418
|
+
function buildDataSourceDataParams(componentState, changes) {
|
|
2470
2419
|
var _a, _b;
|
|
2471
2420
|
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2472
2421
|
const dataSourceParams = {
|
|
2473
2422
|
originalDataArray: componentState.originalDataArray,
|
|
2474
2423
|
sortInfo,
|
|
2475
|
-
|
|
2424
|
+
groupBy: componentState.groupBy,
|
|
2476
2425
|
pivotBy: componentState.pivotBy
|
|
2477
2426
|
};
|
|
2478
2427
|
if (componentState.livePagination !== void 0) {
|
|
2479
2428
|
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2480
2429
|
}
|
|
2430
|
+
if (changes !== void 0) {
|
|
2431
|
+
dataSourceParams.changes = changes;
|
|
2432
|
+
}
|
|
2481
2433
|
return dataSourceParams;
|
|
2482
2434
|
}
|
|
2483
|
-
function notifyDataParamsChanged(componentState, actions) {
|
|
2435
|
+
function notifyDataParamsChanged(componentState, actions, changes) {
|
|
2484
2436
|
var _a;
|
|
2485
2437
|
if (typeof componentState.data === "function") {
|
|
2486
2438
|
loadData(componentState.data, componentState, actions);
|
|
2487
2439
|
}
|
|
2488
|
-
const dataParams = buildDataSourceDataParams(componentState);
|
|
2440
|
+
const dataParams = buildDataSourceDataParams(componentState, changes);
|
|
2489
2441
|
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2490
2442
|
}
|
|
2491
2443
|
function loadData(data, componentState, actions) {
|
|
@@ -2534,7 +2486,7 @@ function useLivePagination() {
|
|
|
2534
2486
|
const {
|
|
2535
2487
|
notifyScrollbarsChange,
|
|
2536
2488
|
sortInfo,
|
|
2537
|
-
|
|
2489
|
+
groupBy,
|
|
2538
2490
|
pivotBy,
|
|
2539
2491
|
livePaginationCursor,
|
|
2540
2492
|
scrollBottomId
|
|
@@ -2544,7 +2496,7 @@ function useLivePagination() {
|
|
|
2544
2496
|
horizontal: false
|
|
2545
2497
|
});
|
|
2546
2498
|
const scrollbarsRef = useRef6(scrollbars);
|
|
2547
|
-
|
|
2499
|
+
useEffect8(() => {
|
|
2548
2500
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2549
2501
|
if (!scrollbars2) {
|
|
2550
2502
|
return;
|
|
@@ -2555,7 +2507,7 @@ function useLivePagination() {
|
|
|
2555
2507
|
return () => notifyScrollbarsChange.destroy();
|
|
2556
2508
|
}, [notifyScrollbarsChange]);
|
|
2557
2509
|
const [cursorId, updateCursorId] = useState4(void 0);
|
|
2558
|
-
|
|
2510
|
+
useEffect8(() => {
|
|
2559
2511
|
const frameId = requestAnimationFrame(() => {
|
|
2560
2512
|
var _a;
|
|
2561
2513
|
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
@@ -2564,33 +2516,45 @@ function useLivePagination() {
|
|
|
2564
2516
|
});
|
|
2565
2517
|
return () => cancelAnimationFrame(frameId);
|
|
2566
2518
|
}, [livePaginationCursor]);
|
|
2567
|
-
|
|
2519
|
+
useEffect8(() => {
|
|
2568
2520
|
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2569
2521
|
if (!scrollbars.vertical && livePagination) {
|
|
2570
2522
|
updateCursorId(livePaginationCursor2);
|
|
2571
2523
|
}
|
|
2572
2524
|
}, [scrollbars.vertical]);
|
|
2573
|
-
|
|
2525
|
+
useEffect8(() => {
|
|
2574
2526
|
updateCursorId(scrollBottomId);
|
|
2575
2527
|
}, [scrollBottomId]);
|
|
2576
2528
|
const depsObject = {
|
|
2577
2529
|
sortInfo,
|
|
2578
|
-
|
|
2530
|
+
groupBy,
|
|
2579
2531
|
pivotBy,
|
|
2580
|
-
cursorId
|
|
2532
|
+
livePaginationCursor: cursorId
|
|
2581
2533
|
};
|
|
2582
|
-
useEffectWithChanges(() => {
|
|
2534
|
+
useEffectWithChanges((changes, prevValues) => {
|
|
2583
2535
|
if (cursorId === void 0) {
|
|
2584
2536
|
return;
|
|
2585
2537
|
}
|
|
2586
|
-
|
|
2538
|
+
debug3("onDataParamsChange triggered because the following values have changed", changes, "old values", prevValues);
|
|
2539
|
+
notifyDataParamsChanged(getComponentState(), actions, anonimizeValues(changes));
|
|
2587
2540
|
}, depsObject);
|
|
2588
2541
|
}
|
|
2589
2542
|
|
|
2590
2543
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
2591
|
-
var
|
|
2592
|
-
|
|
2593
|
-
|
|
2544
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
2545
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
2546
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
2547
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
2548
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
2549
|
+
const prevResult = weakMap.get(sortInfo);
|
|
2550
|
+
if (prevResult && prevResult.length === result.length) {
|
|
2551
|
+
return prevResult;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
if (weakMap && sortInfo) {
|
|
2555
|
+
weakMap.set(sortInfo, result);
|
|
2556
|
+
}
|
|
2557
|
+
return result;
|
|
2594
2558
|
};
|
|
2595
2559
|
|
|
2596
2560
|
// src/components/hooks/useOnce.ts
|
|
@@ -2656,6 +2620,13 @@ var DeepMap = class {
|
|
|
2656
2620
|
});
|
|
2657
2621
|
}
|
|
2658
2622
|
}
|
|
2623
|
+
static clone(map2) {
|
|
2624
|
+
const clone = new DeepMap();
|
|
2625
|
+
map2.visit((pair, keys) => {
|
|
2626
|
+
clone.set(keys, pair.value);
|
|
2627
|
+
});
|
|
2628
|
+
return clone;
|
|
2629
|
+
}
|
|
2659
2630
|
set(keys, value) {
|
|
2660
2631
|
let currentMap = this.map;
|
|
2661
2632
|
if (!keys.length) {
|
|
@@ -3032,6 +3003,10 @@ function initSetupState2() {
|
|
|
3032
3003
|
pivotTotalColumnPosition: "end",
|
|
3033
3004
|
originalDataArray,
|
|
3034
3005
|
scrollBottomId: Symbol("scrollBottomId"),
|
|
3006
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
3007
|
+
propsCache: new Map([
|
|
3008
|
+
["sortInfo", new WeakMap()]
|
|
3009
|
+
]),
|
|
3035
3010
|
pivotColumns: void 0,
|
|
3036
3011
|
pivotColumnGroups: void 0,
|
|
3037
3012
|
dataArray,
|
|
@@ -3040,7 +3015,6 @@ function initSetupState2() {
|
|
|
3040
3015
|
sortedAt: 0,
|
|
3041
3016
|
reducedAt: now,
|
|
3042
3017
|
generateGroupRows: true,
|
|
3043
|
-
aggregationReducers: void 0,
|
|
3044
3018
|
groupDeepMap: void 0,
|
|
3045
3019
|
postSortDataArray: void 0,
|
|
3046
3020
|
postGroupDataArray: void 0,
|
|
@@ -3053,18 +3027,17 @@ function getCompareObject(dataParams) {
|
|
|
3053
3027
|
delete obj.originalDataArray;
|
|
3054
3028
|
return obj;
|
|
3055
3029
|
}
|
|
3056
|
-
var forwardProps3 = () => {
|
|
3030
|
+
var forwardProps3 = (setupState) => {
|
|
3057
3031
|
return {
|
|
3058
3032
|
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
3059
|
-
remoteCount: 1,
|
|
3060
3033
|
data: 1,
|
|
3061
3034
|
pivotBy: 1,
|
|
3062
3035
|
primaryKey: 1,
|
|
3063
3036
|
livePagination: 1,
|
|
3064
|
-
|
|
3037
|
+
aggregationReducers: 1,
|
|
3065
3038
|
loading: (loading) => loading != null ? loading : false,
|
|
3066
|
-
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
3067
|
-
|
|
3039
|
+
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
3040
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
3068
3041
|
groupRowsState: (groupRowsState) => {
|
|
3069
3042
|
return groupRowsState || new GroupRowsState({
|
|
3070
3043
|
expandedRows: true,
|
|
@@ -3074,12 +3047,21 @@ var forwardProps3 = () => {
|
|
|
3074
3047
|
};
|
|
3075
3048
|
};
|
|
3076
3049
|
function mapPropsToState2(params) {
|
|
3077
|
-
const { props } = params;
|
|
3050
|
+
const { props, state } = params;
|
|
3078
3051
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
3079
|
-
|
|
3052
|
+
const result = {
|
|
3080
3053
|
controlledSort,
|
|
3081
3054
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3082
3055
|
};
|
|
3056
|
+
if (props.livePagination) {
|
|
3057
|
+
const livePaginationCursor = typeof props.livePaginationCursor === "function" ? props.livePaginationCursor({
|
|
3058
|
+
array: state.originalDataArray,
|
|
3059
|
+
length: state.originalDataArray.length,
|
|
3060
|
+
lastItem: state.originalDataArray[state.originalDataArray.length - 1]
|
|
3061
|
+
}) : props.livePaginationCursor;
|
|
3062
|
+
result.livePaginationCursor = livePaginationCursor;
|
|
3063
|
+
}
|
|
3064
|
+
return result;
|
|
3083
3065
|
}
|
|
3084
3066
|
function getInterceptActions() {
|
|
3085
3067
|
return {
|
|
@@ -3096,19 +3078,28 @@ function DEFAULT_TO_KEY(value) {
|
|
|
3096
3078
|
return value;
|
|
3097
3079
|
}
|
|
3098
3080
|
function initReducers(reducers) {
|
|
3099
|
-
if (!reducers || !reducers.length) {
|
|
3100
|
-
return
|
|
3081
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3082
|
+
return {};
|
|
3101
3083
|
}
|
|
3102
|
-
|
|
3084
|
+
const result = {};
|
|
3085
|
+
for (let key in reducers)
|
|
3086
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3087
|
+
result[key] = reducers[key].initialValue;
|
|
3088
|
+
}
|
|
3089
|
+
return result;
|
|
3103
3090
|
}
|
|
3104
3091
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
3105
|
-
|
|
3092
|
+
var _a, _b;
|
|
3093
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3106
3094
|
return;
|
|
3107
3095
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3096
|
+
for (let key in reducers)
|
|
3097
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3098
|
+
const reducer = reducers[key];
|
|
3099
|
+
const currentValue = reducerResults[key];
|
|
3100
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3101
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3102
|
+
}
|
|
3112
3103
|
}
|
|
3113
3104
|
function group(groupParams, data) {
|
|
3114
3105
|
const {
|
|
@@ -3123,7 +3114,7 @@ function group(groupParams, data) {
|
|
|
3123
3114
|
let currentGroupKeys = [];
|
|
3124
3115
|
let currentPivotKeys = [];
|
|
3125
3116
|
const initialReducerValue = initReducers(reducers);
|
|
3126
|
-
const globalReducerResults =
|
|
3117
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
3127
3118
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
3128
3119
|
let item = data[i];
|
|
3129
3120
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -3133,7 +3124,7 @@ function group(groupParams, data) {
|
|
|
3133
3124
|
if (!deepMap.has(currentGroupKeys)) {
|
|
3134
3125
|
const deepMapGroupValue = {
|
|
3135
3126
|
items: [],
|
|
3136
|
-
reducerResults:
|
|
3127
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
3137
3128
|
};
|
|
3138
3129
|
if (pivot) {
|
|
3139
3130
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -3157,7 +3148,7 @@ function group(groupParams, data) {
|
|
|
3157
3148
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3158
3149
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3159
3150
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3160
|
-
reducerResults:
|
|
3151
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3161
3152
|
items: []
|
|
3162
3153
|
});
|
|
3163
3154
|
}
|
|
@@ -3219,11 +3210,23 @@ function flatten(groupResult) {
|
|
|
3219
3210
|
return result;
|
|
3220
3211
|
}
|
|
3221
3212
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
3222
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
3213
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
3223
3214
|
const groupNesting = groupKeys.length;
|
|
3224
3215
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3216
|
+
let data = null;
|
|
3217
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
3218
|
+
data = {};
|
|
3219
|
+
for (let key in reducers)
|
|
3220
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3221
|
+
const reducer = reducers[key];
|
|
3222
|
+
const field = reducer.field;
|
|
3223
|
+
if (field) {
|
|
3224
|
+
data[field] = reducerResults[key];
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3225
3228
|
const enhancedGroupData = {
|
|
3226
|
-
data
|
|
3229
|
+
data,
|
|
3227
3230
|
groupCount: groupItems.length,
|
|
3228
3231
|
groupData: groupItems,
|
|
3229
3232
|
groupKeys,
|
|
@@ -3245,17 +3248,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
3245
3248
|
return enhancedGroupData;
|
|
3246
3249
|
}
|
|
3247
3250
|
function completeReducers(reducers, reducerResults, items) {
|
|
3248
|
-
if (reducers
|
|
3249
|
-
|
|
3250
|
-
if (
|
|
3251
|
-
|
|
3251
|
+
if (reducers) {
|
|
3252
|
+
for (let key in reducers)
|
|
3253
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3254
|
+
const reducer = reducers[key];
|
|
3255
|
+
if (reducer.done) {
|
|
3256
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
3257
|
+
}
|
|
3252
3258
|
}
|
|
3253
|
-
});
|
|
3254
3259
|
}
|
|
3255
3260
|
return reducerResults;
|
|
3256
3261
|
}
|
|
3257
3262
|
function enhancedFlatten(param) {
|
|
3258
|
-
const {
|
|
3263
|
+
const {
|
|
3264
|
+
groupResult,
|
|
3265
|
+
toPrimaryKey,
|
|
3266
|
+
groupRowsState,
|
|
3267
|
+
generateGroupRows,
|
|
3268
|
+
reducers = {}
|
|
3269
|
+
} = param;
|
|
3259
3270
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
3260
3271
|
const { groupBy } = groupParams;
|
|
3261
3272
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -3270,6 +3281,7 @@ function enhancedFlatten(param) {
|
|
|
3270
3281
|
const enhancedGroupData = getEnhancedGroupData({
|
|
3271
3282
|
groupBy: groupByStrings,
|
|
3272
3283
|
parents: Array.from(parents),
|
|
3284
|
+
reducers,
|
|
3273
3285
|
indexInGroup,
|
|
3274
3286
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3275
3287
|
indexInAll: result.length,
|
|
@@ -3322,13 +3334,45 @@ function enhancedFlatten(param) {
|
|
|
3322
3334
|
}
|
|
3323
3335
|
|
|
3324
3336
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3325
|
-
function
|
|
3337
|
+
function prepareColumn(column) {
|
|
3338
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3339
|
+
if (pivotByForColumn.column) {
|
|
3340
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3341
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3342
|
+
} else {
|
|
3343
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
return column;
|
|
3347
|
+
}
|
|
3348
|
+
function prepareColumnGroup(columnGroup) {
|
|
3349
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3350
|
+
if (pivotByForColumnGroup.columnGroup) {
|
|
3351
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3352
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3353
|
+
} else {
|
|
3354
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
return columnGroup;
|
|
3358
|
+
}
|
|
3359
|
+
function getPivotColumnsAndColumnGroups({
|
|
3360
|
+
deepMap,
|
|
3361
|
+
pivotBy,
|
|
3362
|
+
pivotTotalColumnPosition,
|
|
3363
|
+
reducers = {},
|
|
3364
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3365
|
+
}) {
|
|
3326
3366
|
const pivotLength = pivotBy.length;
|
|
3367
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3368
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3369
|
+
});
|
|
3327
3370
|
const columns = new Map([
|
|
3328
3371
|
[
|
|
3329
3372
|
"labels",
|
|
3330
3373
|
{
|
|
3331
3374
|
header: "Row labels",
|
|
3375
|
+
pivotBy,
|
|
3332
3376
|
valueGetter: (params) => {
|
|
3333
3377
|
var _a;
|
|
3334
3378
|
const { rowInfo } = params;
|
|
@@ -3338,72 +3382,104 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3338
3382
|
]
|
|
3339
3383
|
]);
|
|
3340
3384
|
const columnGroups = new Map();
|
|
3385
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3341
3386
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3342
3387
|
keys = [...keys];
|
|
3343
3388
|
if (pivotTotalColumnPosition === "end") {
|
|
3344
3389
|
next == null ? void 0 : next();
|
|
3345
3390
|
}
|
|
3346
3391
|
if (keys.length === pivotLength) {
|
|
3347
|
-
const parentKeys = keys.slice(0, -1);
|
|
3348
|
-
let columnGroupId = parentKeys.join("/");
|
|
3349
3392
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3350
|
-
let computedPivotColumn = __spreadValues({
|
|
3351
|
-
pivotBy,
|
|
3352
|
-
pivotColumn: true,
|
|
3353
|
-
pivotGroupKeys: keys,
|
|
3354
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3355
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3356
|
-
pivotByForColumn,
|
|
3357
|
-
sortable: false,
|
|
3358
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3359
|
-
header: keys[keys.length - 1],
|
|
3360
|
-
valueGetter: ({ rowInfo }) => {
|
|
3361
|
-
var _a, _b, _c;
|
|
3362
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3363
|
-
return value;
|
|
3364
|
-
}
|
|
3365
|
-
}, pivotByForColumn.column);
|
|
3366
|
-
if (pivotByForColumn.column) {
|
|
3367
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3368
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3369
|
-
} else {
|
|
3370
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3371
|
-
}
|
|
3372
|
-
}
|
|
3373
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3374
|
-
} else {
|
|
3375
|
-
const colGroupId = keys.join("/");
|
|
3376
3393
|
const parentKeys = keys.slice(0, -1);
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
columnGroup:
|
|
3385
|
-
|
|
3386
|
-
pivotTotalColumn: true,
|
|
3394
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3395
|
+
if (!isSingleAggregationColumn) {
|
|
3396
|
+
const columnGroupId = parentColumnGroupId;
|
|
3397
|
+
parentColumnGroupId = keys.join("/");
|
|
3398
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3399
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3400
|
+
header: pivotGroupKey,
|
|
3401
|
+
columnGroup: columnGroupId,
|
|
3402
|
+
pivotBy,
|
|
3387
3403
|
pivotGroupKeys: keys,
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3404
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3405
|
+
pivotIndex: keys.length - 1,
|
|
3406
|
+
pivotGroupKey
|
|
3407
|
+
}));
|
|
3408
|
+
}
|
|
3409
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3410
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3411
|
+
const computedPivotColumn = prepareColumn({
|
|
3391
3412
|
pivotBy,
|
|
3413
|
+
pivotColumn: true,
|
|
3414
|
+
pivotTotalColumn: false,
|
|
3415
|
+
pivotAggregator: reducer,
|
|
3416
|
+
pivotAggregatorIndex: index,
|
|
3417
|
+
pivotGroupKeys: keys,
|
|
3418
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3419
|
+
pivotIndex: keys.length - 1,
|
|
3420
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3392
3421
|
sortable: false,
|
|
3422
|
+
columnGroup: parentColumnGroupId,
|
|
3423
|
+
header,
|
|
3393
3424
|
valueGetter: ({ rowInfo }) => {
|
|
3394
|
-
var _a, _b
|
|
3395
|
-
|
|
3396
|
-
return value;
|
|
3397
|
-
}
|
|
3398
|
-
}, pivotByForColumn.column);
|
|
3399
|
-
if (pivotByForColumn.column) {
|
|
3400
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3401
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3402
|
-
} else {
|
|
3403
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3425
|
+
var _a, _b;
|
|
3426
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3404
3427
|
}
|
|
3428
|
+
});
|
|
3429
|
+
const columnId = `${keys.join("/")}-${reducer.id}`;
|
|
3430
|
+
columns.set(columnId, computedPivotColumn);
|
|
3431
|
+
});
|
|
3432
|
+
} else {
|
|
3433
|
+
const colGroupId = keys.join("/");
|
|
3434
|
+
const parentKeys = keys.slice(0, -1);
|
|
3435
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3436
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3437
|
+
header: keys[keys.length - 1],
|
|
3438
|
+
pivotBy,
|
|
3439
|
+
pivotGroupKeys: keys,
|
|
3440
|
+
pivotIndex: keys.length - 1,
|
|
3441
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3442
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3443
|
+
}));
|
|
3444
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3445
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3446
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3447
|
+
if (!isSingleAggregationColumn) {
|
|
3448
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3449
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3450
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3451
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3452
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3453
|
+
pivotBy,
|
|
3454
|
+
pivotTotalColumnGroup: true,
|
|
3455
|
+
pivotGroupKeys: keys,
|
|
3456
|
+
pivotIndex: keys.length - 1,
|
|
3457
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3458
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3459
|
+
}));
|
|
3405
3460
|
}
|
|
3406
|
-
|
|
3461
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3462
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3463
|
+
const computedPivotColumn = prepareColumn({
|
|
3464
|
+
columnGroup: columnGroupId,
|
|
3465
|
+
header,
|
|
3466
|
+
pivotAggregator: reducer,
|
|
3467
|
+
pivotAggregatorIndex: index,
|
|
3468
|
+
pivotColumn: true,
|
|
3469
|
+
pivotTotalColumn: true,
|
|
3470
|
+
pivotGroupKeys: keys,
|
|
3471
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3472
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3473
|
+
pivotIndex: keys.length - 1,
|
|
3474
|
+
pivotBy,
|
|
3475
|
+
sortable: false,
|
|
3476
|
+
valueGetter: ({ rowInfo }) => {
|
|
3477
|
+
var _a, _b;
|
|
3478
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3479
|
+
}
|
|
3480
|
+
});
|
|
3481
|
+
columns.set(`total:${keys.join("/")}-${reducer.id}`, computedPivotColumn);
|
|
3482
|
+
});
|
|
3407
3483
|
}
|
|
3408
3484
|
}
|
|
3409
3485
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3413,9 +3489,12 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3413
3489
|
if (columns.size === 1) {
|
|
3414
3490
|
columns.set("single", {
|
|
3415
3491
|
header: "Reduced",
|
|
3492
|
+
pivotBy,
|
|
3493
|
+
pivotColumn: true,
|
|
3416
3494
|
valueGetter: ({ rowInfo }) => {
|
|
3417
3495
|
var _a;
|
|
3418
|
-
|
|
3496
|
+
const key = Object.keys(rowInfo.reducerResults || {})[0];
|
|
3497
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[key];
|
|
3419
3498
|
}
|
|
3420
3499
|
});
|
|
3421
3500
|
}
|
|
@@ -3439,7 +3518,14 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3439
3518
|
return false;
|
|
3440
3519
|
};
|
|
3441
3520
|
function toRowInfo(data, id, index) {
|
|
3442
|
-
return {
|
|
3521
|
+
return {
|
|
3522
|
+
data,
|
|
3523
|
+
collapsed: true,
|
|
3524
|
+
id,
|
|
3525
|
+
indexInAll: index,
|
|
3526
|
+
indexInGroup: index,
|
|
3527
|
+
isGroupRow: false
|
|
3528
|
+
};
|
|
3443
3529
|
}
|
|
3444
3530
|
function concludeReducer(params) {
|
|
3445
3531
|
var _a;
|
|
@@ -3451,17 +3537,18 @@ function concludeReducer(params) {
|
|
|
3451
3537
|
"sortInfo"
|
|
3452
3538
|
]);
|
|
3453
3539
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3454
|
-
const groupBy = state.
|
|
3540
|
+
const groupBy = state.groupBy;
|
|
3455
3541
|
const pivotBy = state.pivotBy;
|
|
3456
3542
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3457
3543
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3458
3544
|
"generateGroupRows",
|
|
3459
3545
|
"originalDataArray",
|
|
3460
|
-
"
|
|
3546
|
+
"groupBy",
|
|
3461
3547
|
"groupRowsState",
|
|
3462
3548
|
"pivotBy",
|
|
3463
3549
|
"aggregationReducers",
|
|
3464
3550
|
"pivotTotalColumnPosition",
|
|
3551
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3465
3552
|
"sortInfo"
|
|
3466
3553
|
]);
|
|
3467
3554
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3487,13 +3574,20 @@ function concludeReducer(params) {
|
|
|
3487
3574
|
}, dataArray);
|
|
3488
3575
|
const flattenResult = enhancedFlatten({
|
|
3489
3576
|
groupResult,
|
|
3577
|
+
reducers: state.aggregationReducers,
|
|
3490
3578
|
toPrimaryKey,
|
|
3491
3579
|
groupRowsState: state.groupRowsState,
|
|
3492
3580
|
generateGroupRows: state.generateGroupRows
|
|
3493
3581
|
});
|
|
3494
3582
|
rowInfoDataArray = flattenResult.data;
|
|
3495
3583
|
state.groupDeepMap = groupResult.deepMap;
|
|
3496
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3584
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3585
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3586
|
+
pivotBy,
|
|
3587
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3588
|
+
reducers: state.aggregationReducers,
|
|
3589
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3590
|
+
}) : void 0;
|
|
3497
3591
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3498
3592
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3499
3593
|
} else {
|
|
@@ -3580,49 +3674,49 @@ function useToggleGroupRow() {
|
|
|
3580
3674
|
}
|
|
3581
3675
|
|
|
3582
3676
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3583
|
-
function
|
|
3584
|
-
const
|
|
3585
|
-
return
|
|
3586
|
-
acc.set(
|
|
3587
|
-
groupBy,
|
|
3677
|
+
function useGroupByMap(groupBy) {
|
|
3678
|
+
const groupByMap = useMemo5(() => {
|
|
3679
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3680
|
+
acc.set(groupBy2.field, {
|
|
3681
|
+
groupBy: groupBy2,
|
|
3588
3682
|
groupIndex: index
|
|
3589
3683
|
});
|
|
3590
3684
|
return acc;
|
|
3591
3685
|
}, new Map());
|
|
3592
|
-
}, [
|
|
3593
|
-
return
|
|
3686
|
+
}, [groupBy]);
|
|
3687
|
+
return groupByMap;
|
|
3594
3688
|
}
|
|
3595
3689
|
function useColumnsWhen() {
|
|
3596
3690
|
const {
|
|
3597
|
-
componentState: {
|
|
3691
|
+
componentState: { groupBy },
|
|
3598
3692
|
componentActions: dataSourceActions
|
|
3599
3693
|
} = useDataSourceContextValue();
|
|
3600
3694
|
const {
|
|
3601
3695
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3602
3696
|
} = useComponentState();
|
|
3603
|
-
const
|
|
3604
|
-
|
|
3697
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3698
|
+
useEffect9(() => {
|
|
3605
3699
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3606
3700
|
}, [groupRenderStrategy]);
|
|
3607
|
-
|
|
3701
|
+
useEffect9(() => {
|
|
3608
3702
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3609
3703
|
}, [pivotTotalColumnPosition]);
|
|
3610
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3704
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3611
3705
|
useColumnsWhenPivoting();
|
|
3612
3706
|
useColumnsWhenGrouping();
|
|
3613
|
-
useHideEmptyGroupColumns(
|
|
3707
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3614
3708
|
}
|
|
3615
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3709
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3616
3710
|
const toggleGroupRow = useToggleGroupRow();
|
|
3617
3711
|
const {
|
|
3618
3712
|
componentActions,
|
|
3619
3713
|
componentState: { columns, groupRenderStrategy }
|
|
3620
3714
|
} = useComponentState();
|
|
3621
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3715
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3622
3716
|
const computedColumns = new Map();
|
|
3623
3717
|
columns2.forEach((column, id) => {
|
|
3624
3718
|
let base = {};
|
|
3625
|
-
const groupByForColumn =
|
|
3719
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3626
3720
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3627
3721
|
const { groupIndex } = groupByForColumn;
|
|
3628
3722
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3667,9 +3761,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3667
3761
|
});
|
|
3668
3762
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3669
3763
|
}
|
|
3670
|
-
|
|
3764
|
+
useEffect9(() => {
|
|
3671
3765
|
const update = () => {
|
|
3672
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
3766
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3673
3767
|
};
|
|
3674
3768
|
update();
|
|
3675
3769
|
return interceptMap(columns, {
|
|
@@ -3677,11 +3771,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3677
3771
|
delete: update,
|
|
3678
3772
|
clear: update
|
|
3679
3773
|
});
|
|
3680
|
-
}, [columns,
|
|
3774
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3681
3775
|
}
|
|
3682
3776
|
function useColumnsWhenPivoting() {
|
|
3683
3777
|
const {
|
|
3684
|
-
componentState: {
|
|
3778
|
+
componentState: { groupBy, pivotBy }
|
|
3685
3779
|
} = useDataSourceContextValue();
|
|
3686
3780
|
const {
|
|
3687
3781
|
componentActions,
|
|
@@ -3693,13 +3787,13 @@ function useColumnsWhenPivoting() {
|
|
|
3693
3787
|
}
|
|
3694
3788
|
} = useComponentState();
|
|
3695
3789
|
const toggleGroupRow = useToggleGroupRow();
|
|
3696
|
-
|
|
3790
|
+
useEffect9(() => {
|
|
3697
3791
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3698
3792
|
pivotColumn,
|
|
3699
3793
|
pivotRowLabelsColumn,
|
|
3700
3794
|
pivotTotalColumnPosition,
|
|
3701
3795
|
pivotBy,
|
|
3702
|
-
|
|
3796
|
+
groupBy,
|
|
3703
3797
|
toggleGroupRow
|
|
3704
3798
|
});
|
|
3705
3799
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3707,14 +3801,14 @@ function useColumnsWhenPivoting() {
|
|
|
3707
3801
|
}
|
|
3708
3802
|
function useColumnsWhenGrouping() {
|
|
3709
3803
|
const {
|
|
3710
|
-
componentState: {
|
|
3804
|
+
componentState: { groupBy }
|
|
3711
3805
|
} = useDataSourceContextValue();
|
|
3712
3806
|
const {
|
|
3713
3807
|
componentActions,
|
|
3714
3808
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3715
3809
|
} = useComponentState();
|
|
3716
3810
|
const toggleGroupRow = useToggleGroupRow();
|
|
3717
|
-
|
|
3811
|
+
useEffect9(() => {
|
|
3718
3812
|
if (pivotColumns) {
|
|
3719
3813
|
return;
|
|
3720
3814
|
}
|
|
@@ -3723,7 +3817,7 @@ function useColumnsWhenGrouping() {
|
|
|
3723
3817
|
columns,
|
|
3724
3818
|
groupColumn,
|
|
3725
3819
|
groupRenderStrategy,
|
|
3726
|
-
|
|
3820
|
+
groupBy,
|
|
3727
3821
|
pivotColumns,
|
|
3728
3822
|
toggleGroupRow
|
|
3729
3823
|
});
|
|
@@ -3735,11 +3829,11 @@ function useColumnsWhenGrouping() {
|
|
|
3735
3829
|
delete: update,
|
|
3736
3830
|
clear: update
|
|
3737
3831
|
});
|
|
3738
|
-
}, [
|
|
3832
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3739
3833
|
}
|
|
3740
3834
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3741
3835
|
const {
|
|
3742
|
-
componentState: {
|
|
3836
|
+
componentState: { groupBy, groupRowsState },
|
|
3743
3837
|
getState: getDataSourceState
|
|
3744
3838
|
} = useDataSourceContextValue();
|
|
3745
3839
|
const {
|
|
@@ -3751,11 +3845,11 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3751
3845
|
groupRenderStrategy
|
|
3752
3846
|
}
|
|
3753
3847
|
} = useComponentState();
|
|
3754
|
-
|
|
3755
|
-
if (groupRenderStrategy
|
|
3848
|
+
useEffect9(() => {
|
|
3849
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3756
3850
|
return;
|
|
3757
3851
|
}
|
|
3758
|
-
const groupsLength =
|
|
3852
|
+
const groupsLength = groupBy.length;
|
|
3759
3853
|
let expandedGroupsLevel = 0;
|
|
3760
3854
|
const { dataArray } = getDataSourceState();
|
|
3761
3855
|
const len = dataArray.length;
|
|
@@ -3771,15 +3865,15 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3771
3865
|
let updated = false;
|
|
3772
3866
|
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3773
3867
|
const cols = computedColumns;
|
|
3774
|
-
|
|
3775
|
-
const colId =
|
|
3776
|
-
|
|
3868
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3869
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
3870
|
+
let col = cols.get(colId);
|
|
3777
3871
|
if (!col) {
|
|
3778
3872
|
return;
|
|
3779
3873
|
}
|
|
3780
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3874
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3781
3875
|
updated = true;
|
|
3782
|
-
if (shouldBeHidden
|
|
3876
|
+
if (shouldBeHidden) {
|
|
3783
3877
|
columnVisibility.set(colId, false);
|
|
3784
3878
|
} else {
|
|
3785
3879
|
columnVisibility.delete(colId);
|
|
@@ -3792,7 +3886,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3792
3886
|
getDataSourceState,
|
|
3793
3887
|
groupRenderStrategy,
|
|
3794
3888
|
generatedColumns,
|
|
3795
|
-
|
|
3889
|
+
groupBy,
|
|
3796
3890
|
groupRowsMap,
|
|
3797
3891
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3798
3892
|
hideEmptyGroupColumns
|
|
@@ -3801,7 +3895,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3801
3895
|
function getColumnsWhenGrouping(params) {
|
|
3802
3896
|
const {
|
|
3803
3897
|
pivotColumns,
|
|
3804
|
-
|
|
3898
|
+
groupBy,
|
|
3805
3899
|
groupColumn,
|
|
3806
3900
|
groupRenderStrategy,
|
|
3807
3901
|
toggleGroupRow,
|
|
@@ -3815,10 +3909,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
3815
3909
|
}
|
|
3816
3910
|
const computedColumns = new Map();
|
|
3817
3911
|
if (groupRenderStrategy === "multi-column") {
|
|
3818
|
-
|
|
3912
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3819
3913
|
const generatedGroupColumn = getColumnForGroupBy({
|
|
3820
3914
|
groupByForColumn,
|
|
3821
|
-
|
|
3915
|
+
groupBy,
|
|
3822
3916
|
groupIndexForColumn,
|
|
3823
3917
|
groupCount: arr.length,
|
|
3824
3918
|
groupRenderStrategy
|
|
@@ -3827,8 +3921,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
3827
3921
|
});
|
|
3828
3922
|
} else if (groupRenderStrategy === "single-column") {
|
|
3829
3923
|
const singleGroupColumn = getSingleGroupColumn({
|
|
3830
|
-
groupCount:
|
|
3831
|
-
|
|
3924
|
+
groupCount: groupBy.length,
|
|
3925
|
+
groupBy,
|
|
3832
3926
|
groupRenderStrategy
|
|
3833
3927
|
}, toggleGroupRow, groupColumn);
|
|
3834
3928
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
@@ -3845,7 +3939,8 @@ function useComputed() {
|
|
|
3845
3939
|
const { componentActions, componentState } = useComponentState();
|
|
3846
3940
|
const {
|
|
3847
3941
|
componentActions: dataSourceActions,
|
|
3848
|
-
componentState: dataSourceState
|
|
3942
|
+
componentState: dataSourceState,
|
|
3943
|
+
getState: getDataSourceState
|
|
3849
3944
|
} = useDataSourceContextValue();
|
|
3850
3945
|
const {
|
|
3851
3946
|
columnOrder,
|
|
@@ -3853,7 +3948,8 @@ function useComputed() {
|
|
|
3853
3948
|
columnPinning,
|
|
3854
3949
|
columnSizing,
|
|
3855
3950
|
columnTypes,
|
|
3856
|
-
bodySize
|
|
3951
|
+
bodySize,
|
|
3952
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3857
3953
|
} = componentState;
|
|
3858
3954
|
useState5(() => {
|
|
3859
3955
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
@@ -3867,7 +3963,9 @@ function useComputed() {
|
|
|
3867
3963
|
}
|
|
3868
3964
|
});
|
|
3869
3965
|
});
|
|
3870
|
-
|
|
3966
|
+
useEffect10(() => {
|
|
3967
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3968
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3871
3969
|
const { multiSort } = dataSourceState;
|
|
3872
3970
|
useColumnGroups();
|
|
3873
3971
|
useColumnsWhen();
|
|
@@ -3875,7 +3973,10 @@ function useComputed() {
|
|
|
3875
3973
|
var _a2;
|
|
3876
3974
|
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3877
3975
|
dataSourceActions.sortInfo = newSortInfo;
|
|
3878
|
-
|
|
3976
|
+
if (getDataSourceState().livePagination) {
|
|
3977
|
+
dataSourceActions.livePaginationCursor = null;
|
|
3978
|
+
}
|
|
3979
|
+
}, [getDataSourceState]);
|
|
3879
3980
|
const columns = componentState.computedColumns;
|
|
3880
3981
|
const {
|
|
3881
3982
|
computedColumnOrder,
|
|
@@ -4026,11 +4127,11 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
4026
4127
|
var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
|
|
4027
4128
|
|
|
4028
4129
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4029
|
-
var
|
|
4130
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4030
4131
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
4031
4132
|
var HeaderCellProxy = "_12zfob10";
|
|
4032
|
-
var HeaderCellRecipe = (0,
|
|
4033
|
-
var HeaderClsRecipe = (0,
|
|
4133
|
+
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"]] });
|
|
4134
|
+
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"]] });
|
|
4034
4135
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
4035
4136
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
4036
4137
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -4058,18 +4159,18 @@ import {
|
|
|
4058
4159
|
} from "react";
|
|
4059
4160
|
|
|
4060
4161
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4061
|
-
import { useContext as
|
|
4162
|
+
import { useContext as useContext4 } from "react";
|
|
4062
4163
|
var useInfiniteTableState = () => {
|
|
4063
4164
|
const TableContext2 = getInfiniteTableContext();
|
|
4064
|
-
const { componentState } =
|
|
4165
|
+
const { componentState } = useContext4(TableContext2);
|
|
4065
4166
|
return componentState;
|
|
4066
4167
|
};
|
|
4067
4168
|
|
|
4068
4169
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4069
|
-
var
|
|
4170
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4070
4171
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
4071
4172
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4072
|
-
var ColumnCellRecipe = (0,
|
|
4173
|
+
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"]] });
|
|
4073
4174
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
4074
4175
|
|
|
4075
4176
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -4868,7 +4969,7 @@ function RawListFn(props) {
|
|
|
4868
4969
|
var RawList = memo5(RawListFn);
|
|
4869
4970
|
|
|
4870
4971
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4871
|
-
var
|
|
4972
|
+
var debug4 = dbg("Header");
|
|
4872
4973
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
4873
4974
|
var TableHeaderClassName = `${rootClassName4}Header`;
|
|
4874
4975
|
function InfiniteTableHeaderFn(props) {
|
|
@@ -4882,7 +4983,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4882
4983
|
const column = columns[columnIndex];
|
|
4883
4984
|
if (!column) {
|
|
4884
4985
|
if (true) {
|
|
4885
|
-
|
|
4986
|
+
debug4("Cannot find column to render at ", columnIndex);
|
|
4886
4987
|
}
|
|
4887
4988
|
return null;
|
|
4888
4989
|
}
|
|
@@ -5391,7 +5492,7 @@ import {
|
|
|
5391
5492
|
import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
|
|
5392
5493
|
|
|
5393
5494
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5394
|
-
var VirtualListCls = "
|
|
5495
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5395
5496
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5396
5497
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5397
5498
|
|
|
@@ -5399,7 +5500,7 @@ var scrollTransformTargetCls = "mlx2t3";
|
|
|
5399
5500
|
var UPDATE_SCROLL2 = (node, scrollPosition) => {
|
|
5400
5501
|
node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
|
|
5401
5502
|
};
|
|
5402
|
-
var
|
|
5503
|
+
var debug5 = dbg("VirtuaList");
|
|
5403
5504
|
var rootClassName7 = "InfiniteList";
|
|
5404
5505
|
var VirtualList = (props) => {
|
|
5405
5506
|
const _a = props, {
|
|
@@ -5439,7 +5540,7 @@ var VirtualList = (props) => {
|
|
|
5439
5540
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5440
5541
|
renderCountRef.current = renderCount;
|
|
5441
5542
|
if (true) {
|
|
5442
|
-
|
|
5543
|
+
debug5.extend(mainAxis)(`Render count change ${renderCount}`);
|
|
5443
5544
|
}
|
|
5444
5545
|
rerender();
|
|
5445
5546
|
});
|
|
@@ -5545,32 +5646,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5545
5646
|
const groupRowInfo = null;
|
|
5546
5647
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5547
5648
|
if (column.valueGetter) {
|
|
5548
|
-
value = column.valueGetter({
|
|
5549
|
-
data,
|
|
5550
|
-
rowInfo
|
|
5551
|
-
|
|
5649
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5650
|
+
data: rowInfo.data,
|
|
5651
|
+
rowInfo
|
|
5652
|
+
} : {
|
|
5653
|
+
data: rowInfo.data,
|
|
5654
|
+
rowInfo
|
|
5552
5655
|
});
|
|
5553
5656
|
}
|
|
5554
5657
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5555
|
-
const
|
|
5556
|
-
value,
|
|
5557
|
-
column,
|
|
5658
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5558
5659
|
rowInfo,
|
|
5559
|
-
data
|
|
5660
|
+
data: rowInfo.data
|
|
5661
|
+
} : {
|
|
5662
|
+
rowInfo,
|
|
5663
|
+
data: rowInfo.data
|
|
5560
5664
|
};
|
|
5665
|
+
const stylingRenderParam = __spreadValues({
|
|
5666
|
+
value,
|
|
5667
|
+
column
|
|
5668
|
+
}, rest);
|
|
5561
5669
|
let renderValue = value;
|
|
5562
5670
|
if (column.render || column.renderValue) {
|
|
5563
|
-
const renderParam = {
|
|
5671
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5564
5672
|
value,
|
|
5565
5673
|
column,
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
data,
|
|
5674
|
+
groupRowInfo
|
|
5675
|
+
}, rest), {
|
|
5569
5676
|
rowIndex,
|
|
5570
5677
|
toggleGroupRow,
|
|
5571
5678
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5572
|
-
|
|
5573
|
-
};
|
|
5679
|
+
groupBy: computedDataSource.groupBy
|
|
5680
|
+
});
|
|
5574
5681
|
if (column.render) {
|
|
5575
5682
|
renderValue = column.render(renderParam);
|
|
5576
5683
|
} else if (column.renderValue) {
|
|
@@ -5652,12 +5759,11 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5652
5759
|
domRefFromProps(node);
|
|
5653
5760
|
domRef.current = node;
|
|
5654
5761
|
}, []);
|
|
5655
|
-
const
|
|
5656
|
-
|
|
5657
|
-
rowInfo,
|
|
5762
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5763
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5658
5764
|
rowIndex,
|
|
5659
|
-
|
|
5660
|
-
};
|
|
5765
|
+
groupBy: rowInfo.groupBy
|
|
5766
|
+
});
|
|
5661
5767
|
if (typeof rowProps === "function") {
|
|
5662
5768
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5663
5769
|
}
|
|
@@ -5926,14 +6032,14 @@ function useUnpinnedRendering(params) {
|
|
|
5926
6032
|
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
|
|
5927
6033
|
|
|
5928
6034
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5929
|
-
var
|
|
6035
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5930
6036
|
var FooterCls = "_16lm1iw1";
|
|
5931
6037
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5932
|
-
var InfiniteClsRecipe = (0,
|
|
6038
|
+
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: [] });
|
|
5933
6039
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5934
6040
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5935
6041
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5936
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
6042
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5937
6043
|
|
|
5938
6044
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5939
6045
|
var DELAY = 200;
|
|
@@ -6898,7 +7004,6 @@ function useListRendering(param) {
|
|
|
6898
7004
|
setColumnVisibility: (columnVisibility) => {
|
|
6899
7005
|
componentActions.columnVisibility = columnVisibility;
|
|
6900
7006
|
},
|
|
6901
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6902
7007
|
getState,
|
|
6903
7008
|
getDataSourceState
|
|
6904
7009
|
};
|
|
@@ -6978,11 +7083,10 @@ import {
|
|
|
6978
7083
|
import { useEffect as useEffect23 } from "react";
|
|
6979
7084
|
|
|
6980
7085
|
// src/components/utils/decamelize.ts
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
};
|
|
7086
|
+
function decamelize(str, options) {
|
|
7087
|
+
const { separator } = options != null ? options : { separator: "-" };
|
|
7088
|
+
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();
|
|
7089
|
+
}
|
|
6986
7090
|
|
|
6987
7091
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
6988
7092
|
var defaultStyle2 = {
|
|
@@ -7206,7 +7310,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7206
7310
|
const valid = useMemo11(() => {
|
|
7207
7311
|
let valid2 = isValidLicense(licenseKey, {
|
|
7208
7312
|
publishedAt: 1624970570587,
|
|
7209
|
-
version: "0.
|
|
7313
|
+
version: "0.1.2"
|
|
7210
7314
|
});
|
|
7211
7315
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7212
7316
|
return true;
|
|
@@ -7224,7 +7328,7 @@ import {
|
|
|
7224
7328
|
} from "react";
|
|
7225
7329
|
import { useRef as useRef19 } from "react";
|
|
7226
7330
|
var error = err("CSSVariableWatch");
|
|
7227
|
-
var
|
|
7331
|
+
var debug6 = dbg("CSSVariableWatch");
|
|
7228
7332
|
var WRAPPER_STYLE = {
|
|
7229
7333
|
position: "absolute",
|
|
7230
7334
|
pointerEvents: "none",
|
|
@@ -7247,7 +7351,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7247
7351
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7248
7352
|
if (value) {
|
|
7249
7353
|
lastValueRef.current = value;
|
|
7250
|
-
|
|
7354
|
+
debug6(`Variable ${params.varName} found and equals ${value}.`);
|
|
7251
7355
|
params.onChange(value);
|
|
7252
7356
|
} else {
|
|
7253
7357
|
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
@@ -7551,5 +7655,6 @@ export {
|
|
|
7551
7655
|
interceptMap,
|
|
7552
7656
|
multisort,
|
|
7553
7657
|
useComponentState,
|
|
7554
|
-
useDataSource
|
|
7658
|
+
useDataSource,
|
|
7659
|
+
useEffectWithChanges
|
|
7555
7660
|
};
|