@infinite-table/infinite-react 0.0.10 → 0.1.0
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 +166 -112
- package/index.esm.css +3 -5
- package/index.esm.js +380 -285
- package/index.js +635 -538
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -703,6 +703,17 @@ var ScrollListener = class {
|
|
|
703
703
|
}
|
|
704
704
|
};
|
|
705
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
|
+
|
|
706
717
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
707
718
|
function computeColumnGroupsDepths(columnGroups) {
|
|
708
719
|
const map2 = new Map();
|
|
@@ -726,15 +737,6 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
726
737
|
}
|
|
727
738
|
|
|
728
739
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
729
|
-
function toMap(mapOrObject) {
|
|
730
|
-
if (!mapOrObject) {
|
|
731
|
-
return new Map();
|
|
732
|
-
}
|
|
733
|
-
if (mapOrObject instanceof Map) {
|
|
734
|
-
return mapOrObject;
|
|
735
|
-
}
|
|
736
|
-
return new Map(Object.entries(mapOrObject));
|
|
737
|
-
}
|
|
738
740
|
function toColumnTypesMap(mapOrObject) {
|
|
739
741
|
return toMap(mapOrObject);
|
|
740
742
|
}
|
|
@@ -804,6 +806,7 @@ var forwardProps = () => {
|
|
|
804
806
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
805
807
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
806
808
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
809
|
+
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
807
810
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
808
811
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
809
812
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
@@ -815,7 +818,10 @@ var forwardProps = () => {
|
|
|
815
818
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
816
819
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
817
820
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
818
|
-
columnVisibility: (columnVisibility) =>
|
|
821
|
+
columnVisibility: (columnVisibility) => {
|
|
822
|
+
var _a;
|
|
823
|
+
return (_a = toMap(columnVisibility)) != null ? _a : new Map();
|
|
824
|
+
},
|
|
819
825
|
columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
|
|
820
826
|
columnSizing: (columnSizing) => {
|
|
821
827
|
var _a;
|
|
@@ -825,21 +831,20 @@ var forwardProps = () => {
|
|
|
825
831
|
var _a;
|
|
826
832
|
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
827
833
|
},
|
|
828
|
-
columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
|
|
829
834
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
830
835
|
columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
|
|
831
836
|
};
|
|
832
837
|
};
|
|
833
838
|
function getGroupRenderStrategy(options) {
|
|
834
|
-
const {
|
|
839
|
+
const { groupBy, groupColumn, groupRenderStrategy } = options;
|
|
835
840
|
if (groupRenderStrategy) {
|
|
836
841
|
return groupRenderStrategy;
|
|
837
842
|
}
|
|
838
843
|
if (groupColumn != null && typeof groupColumn === "object") {
|
|
839
844
|
return "single-column";
|
|
840
845
|
}
|
|
841
|
-
const
|
|
842
|
-
if (
|
|
846
|
+
const columnsInGroupBy = groupBy.filter((g) => g.column);
|
|
847
|
+
if (columnsInGroupBy.length) {
|
|
843
848
|
return "multi-column";
|
|
844
849
|
}
|
|
845
850
|
return "multi-column";
|
|
@@ -850,16 +855,17 @@ var mapPropsToState = (params) => {
|
|
|
850
855
|
const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
|
|
851
856
|
const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
|
|
852
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;
|
|
853
|
-
const
|
|
858
|
+
const groupBy = parentState == null ? void 0 : parentState.groupBy;
|
|
854
859
|
const groupRenderStrategy = getGroupRenderStrategy({
|
|
855
860
|
groupRenderStrategy: props.groupRenderStrategy,
|
|
856
|
-
|
|
861
|
+
groupBy,
|
|
857
862
|
groupColumn: props.groupColumn
|
|
858
863
|
});
|
|
864
|
+
const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
859
865
|
return {
|
|
860
866
|
groupRenderStrategy,
|
|
861
|
-
|
|
862
|
-
computedColumns
|
|
867
|
+
groupBy,
|
|
868
|
+
computedColumns,
|
|
863
869
|
virtualizeHeader,
|
|
864
870
|
columnGroupsDepthsMap,
|
|
865
871
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -1645,48 +1651,17 @@ var useComputedVisibleColumns = ({
|
|
|
1645
1651
|
var sortAscending = (a, b) => a - b;
|
|
1646
1652
|
|
|
1647
1653
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1648
|
-
import { useCallback as useCallback5, useState as useState5 } from "react";
|
|
1649
|
-
|
|
1650
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1651
|
-
import { useEffect as useEffect5 } from "react";
|
|
1652
|
-
|
|
1653
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1654
|
-
import {
|
|
1655
|
-
useContext as useContext2
|
|
1656
|
-
} from "react";
|
|
1657
|
-
|
|
1658
|
-
// src/components/DataSource/DataSourceContext.ts
|
|
1659
|
-
import {
|
|
1660
|
-
createContext as createContext2
|
|
1661
|
-
} from "react";
|
|
1662
|
-
var DSContext;
|
|
1663
|
-
function getDataSourceContext() {
|
|
1664
|
-
if (DSContext) {
|
|
1665
|
-
return DSContext;
|
|
1666
|
-
}
|
|
1667
|
-
return DSContext = createContext2({
|
|
1668
|
-
getState: () => null,
|
|
1669
|
-
componentState: null,
|
|
1670
|
-
componentActions: null
|
|
1671
|
-
});
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
// src/components/DataSource/publicHooks/useDataSourceActions.ts
|
|
1675
|
-
function useDataSourceActions() {
|
|
1676
|
-
const DataSourceContext = getDataSourceContext();
|
|
1677
|
-
const contextValue = useContext2(DataSourceContext);
|
|
1678
|
-
return contextValue.componentActions;
|
|
1679
|
-
}
|
|
1654
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useState as useState5 } from "react";
|
|
1680
1655
|
|
|
1681
1656
|
// src/components/hooks/useComponentState.tsx
|
|
1682
1657
|
import {
|
|
1683
1658
|
createElement as createElement2,
|
|
1684
1659
|
memo,
|
|
1685
|
-
useContext as
|
|
1660
|
+
useContext as useContext2
|
|
1686
1661
|
} from "react";
|
|
1687
1662
|
import {
|
|
1688
1663
|
useReducer,
|
|
1689
|
-
createContext as
|
|
1664
|
+
createContext as createContext2,
|
|
1690
1665
|
useMemo as useMemo3,
|
|
1691
1666
|
useEffect as useEffect4,
|
|
1692
1667
|
useState as useState2,
|
|
@@ -1766,7 +1741,7 @@ function getComponentStateContext() {
|
|
|
1766
1741
|
if (ComponentContext) {
|
|
1767
1742
|
return ComponentContext;
|
|
1768
1743
|
}
|
|
1769
|
-
return ComponentContext =
|
|
1744
|
+
return ComponentContext = createContext2(null);
|
|
1770
1745
|
}
|
|
1771
1746
|
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
1772
1747
|
const state = getState();
|
|
@@ -1925,7 +1900,7 @@ function getComponentStateRoot(config) {
|
|
|
1925
1900
|
if (oldValue === newValue) {
|
|
1926
1901
|
continue;
|
|
1927
1902
|
}
|
|
1928
|
-
if (isControlled(key, props)) {
|
|
1903
|
+
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1929
1904
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1930
1905
|
let valueToSet = newValue;
|
|
1931
1906
|
const forwardFn = propsToForward[k];
|
|
@@ -1962,56 +1937,44 @@ function getComponentStateRoot(config) {
|
|
|
1962
1937
|
}
|
|
1963
1938
|
function useComponentState() {
|
|
1964
1939
|
const Context = getComponentStateContext();
|
|
1965
|
-
return
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
// src/components/InfiniteTable/hooks/useColumnAggregations.ts
|
|
1969
|
-
function useColumnAggregations() {
|
|
1970
|
-
const {
|
|
1971
|
-
componentState: { columnAggregations },
|
|
1972
|
-
getComponentState
|
|
1973
|
-
} = useComponentState();
|
|
1974
|
-
const dataSourceActions = useDataSourceActions();
|
|
1975
|
-
useEffect5(() => {
|
|
1976
|
-
function updateDataSourceAggregations() {
|
|
1977
|
-
const reducers = [];
|
|
1978
|
-
const componentState = getComponentState();
|
|
1979
|
-
columnAggregations.forEach((aggregator, key) => {
|
|
1980
|
-
var _a;
|
|
1981
|
-
const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
|
|
1982
|
-
const newAggregator = __spreadValues({
|
|
1983
|
-
getter: (data) => colField ? data[colField] : data
|
|
1984
|
-
}, aggregator);
|
|
1985
|
-
reducers.push(newAggregator);
|
|
1986
|
-
});
|
|
1987
|
-
dataSourceActions.aggregationReducers = reducers;
|
|
1988
|
-
}
|
|
1989
|
-
updateDataSourceAggregations();
|
|
1990
|
-
return interceptMap(columnAggregations, {
|
|
1991
|
-
clear: updateDataSourceAggregations,
|
|
1992
|
-
delete: updateDataSourceAggregations,
|
|
1993
|
-
set: updateDataSourceAggregations
|
|
1994
|
-
});
|
|
1995
|
-
}, [columnAggregations]);
|
|
1940
|
+
return useContext2(Context);
|
|
1996
1941
|
}
|
|
1997
1942
|
|
|
1998
1943
|
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
1999
1944
|
import {
|
|
2000
|
-
useContext as
|
|
1945
|
+
useContext as useContext3
|
|
1946
|
+
} from "react";
|
|
1947
|
+
|
|
1948
|
+
// src/components/DataSource/DataSourceContext.ts
|
|
1949
|
+
import {
|
|
1950
|
+
createContext as createContext3
|
|
2001
1951
|
} from "react";
|
|
1952
|
+
var DSContext;
|
|
1953
|
+
function getDataSourceContext() {
|
|
1954
|
+
if (DSContext) {
|
|
1955
|
+
return DSContext;
|
|
1956
|
+
}
|
|
1957
|
+
return DSContext = createContext3({
|
|
1958
|
+
getState: () => null,
|
|
1959
|
+
componentState: null,
|
|
1960
|
+
componentActions: null
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
// src/components/DataSource/publicHooks/useDataSource.ts
|
|
2002
1965
|
function useDataSource() {
|
|
2003
1966
|
const DataSourceContext = getDataSourceContext();
|
|
2004
|
-
const contextValue =
|
|
1967
|
+
const contextValue = useContext3(DataSourceContext);
|
|
2005
1968
|
return contextValue.componentState;
|
|
2006
1969
|
}
|
|
2007
1970
|
function useDataSourceContextValue() {
|
|
2008
1971
|
const DataSourceContext = getDataSourceContext();
|
|
2009
|
-
const contextValue =
|
|
1972
|
+
const contextValue = useContext3(DataSourceContext);
|
|
2010
1973
|
return contextValue;
|
|
2011
1974
|
}
|
|
2012
1975
|
|
|
2013
1976
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
2014
|
-
import { useEffect as
|
|
1977
|
+
import { useEffect as useEffect5 } from "react";
|
|
2015
1978
|
function useColumnGroups() {
|
|
2016
1979
|
const {
|
|
2017
1980
|
componentState: {
|
|
@@ -2021,7 +1984,7 @@ function useColumnGroups() {
|
|
|
2021
1984
|
componentActions,
|
|
2022
1985
|
getComponentState
|
|
2023
1986
|
} = useComponentState();
|
|
2024
|
-
|
|
1987
|
+
useEffect5(() => {
|
|
2025
1988
|
const recompute = () => {
|
|
2026
1989
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
2027
1990
|
};
|
|
@@ -2032,7 +1995,7 @@ function useColumnGroups() {
|
|
|
2032
1995
|
set: update
|
|
2033
1996
|
});
|
|
2034
1997
|
}, [computedColumnGroups]);
|
|
2035
|
-
|
|
1998
|
+
useEffect5(() => {
|
|
2036
1999
|
return interceptMap(collapsedColumnGroups, {
|
|
2037
2000
|
set: (key, visibleCol) => {
|
|
2038
2001
|
const colIds = key.slice(1);
|
|
@@ -2064,7 +2027,7 @@ function useColumnGroups() {
|
|
|
2064
2027
|
}
|
|
2065
2028
|
|
|
2066
2029
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2067
|
-
import { useEffect as
|
|
2030
|
+
import { useEffect as useEffect9, useMemo as useMemo5 } from "react";
|
|
2068
2031
|
|
|
2069
2032
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2070
2033
|
import {
|
|
@@ -2077,27 +2040,14 @@ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
|
2077
2040
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2078
2041
|
import {
|
|
2079
2042
|
createElement as createElement3,
|
|
2080
|
-
useEffect as
|
|
2043
|
+
useEffect as useEffect6
|
|
2081
2044
|
} from "react";
|
|
2082
2045
|
import { useState as useState3 } from "react";
|
|
2083
2046
|
|
|
2084
|
-
// src/components/InfiniteTable/
|
|
2085
|
-
var
|
|
2086
|
-
var
|
|
2087
|
-
var
|
|
2088
|
-
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2089
|
-
var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
|
|
2090
|
-
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2091
|
-
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2092
|
-
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2093
|
-
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2094
|
-
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2095
|
-
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2096
|
-
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2097
|
-
var transformTranslateZero = "_16lm1iw8";
|
|
2098
|
-
var userSelect = { none: "_16lm1iwm" };
|
|
2099
|
-
var willChange = { transform: "_16lm1iw19" };
|
|
2100
|
-
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2047
|
+
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
2048
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2049
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwd _16lm1iwb";
|
|
2050
|
+
var ExpanderIconClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwa", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2101
2051
|
|
|
2102
2052
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
2103
2053
|
function ExpanderIcon(props) {
|
|
@@ -2111,7 +2061,7 @@ function ExpanderIcon(props) {
|
|
|
2111
2061
|
setExpanded(!expanded);
|
|
2112
2062
|
}
|
|
2113
2063
|
};
|
|
2114
|
-
|
|
2064
|
+
useEffect6(() => {
|
|
2115
2065
|
if (isControlled("expanded", props)) {
|
|
2116
2066
|
setExpanded(props.expanded);
|
|
2117
2067
|
}
|
|
@@ -2124,18 +2074,37 @@ function ExpanderIcon(props) {
|
|
|
2124
2074
|
width: `${size}px`,
|
|
2125
2075
|
style: props.style,
|
|
2126
2076
|
onClick,
|
|
2127
|
-
className: join(props.className,
|
|
2077
|
+
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
2078
|
+
expanded
|
|
2079
|
+
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
2128
2080
|
}, /* @__PURE__ */ createElement3("path", {
|
|
2129
2081
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
2130
2082
|
}));
|
|
2131
2083
|
}
|
|
2132
2084
|
|
|
2133
2085
|
// src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
|
|
2134
|
-
var
|
|
2086
|
+
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
2135
2087
|
var GroupRowExpanderCls = "_7pupv0b";
|
|
2136
|
-
var RowClsRecipe = (0,
|
|
2088
|
+
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: [] });
|
|
2137
2089
|
var RowHoverCls = "_7pupv01";
|
|
2138
2090
|
|
|
2091
|
+
// src/components/InfiniteTable/utilities.css.ts
|
|
2092
|
+
var alignItems = { center: "_16lm1iw11", stretch: "_16lm1iw12" };
|
|
2093
|
+
var cssEllipsisClassName = "_16lm1iw1a _16lm1iw1b _16lm1iw16";
|
|
2094
|
+
var cursor = { pointer: "_16lm1iwb" };
|
|
2095
|
+
var display = { flex: "_16lm1iwj", block: "_16lm1iwk", inlineBlock: "_16lm1iwl" };
|
|
2096
|
+
var flex = { "1": "_16lm1iwc", none: "_16lm1iwd" };
|
|
2097
|
+
var flexFlow = { column: "_16lm1iwz", row: "_16lm1iw10" };
|
|
2098
|
+
var justifyContent = { center: "_16lm1iw13", start: "_16lm1iw14", end: "_16lm1iw15" };
|
|
2099
|
+
var left = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
|
|
2100
|
+
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
2101
|
+
var top = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
|
|
2102
|
+
var transform = { translateZero: "_16lm1iw9", rotate90: "_16lm1iwa" };
|
|
2103
|
+
var transformTranslateZero = "_16lm1iw8";
|
|
2104
|
+
var userSelect = { none: "_16lm1iwm" };
|
|
2105
|
+
var willChange = { transform: "_16lm1iw19" };
|
|
2106
|
+
var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
|
|
2107
|
+
|
|
2139
2108
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2140
2109
|
function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
|
|
2141
2110
|
if (!pivotColumns) {
|
|
@@ -2145,7 +2114,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2145
2114
|
pivotColumn,
|
|
2146
2115
|
pivotRowLabelsColumn,
|
|
2147
2116
|
pivotBy,
|
|
2148
|
-
|
|
2117
|
+
groupBy,
|
|
2149
2118
|
pivotTotalColumnPosition,
|
|
2150
2119
|
toggleGroupRow
|
|
2151
2120
|
} = params;
|
|
@@ -2162,7 +2131,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2162
2131
|
column = __spreadValues(__spreadValues({}, column), pivotColumn({
|
|
2163
2132
|
column,
|
|
2164
2133
|
pivotBy,
|
|
2165
|
-
|
|
2134
|
+
groupBy
|
|
2166
2135
|
}));
|
|
2167
2136
|
} else {
|
|
2168
2137
|
column = __spreadValues(__spreadValues({}, column), pivotColumn);
|
|
@@ -2174,7 +2143,7 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2174
2143
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
|
|
2175
2144
|
column,
|
|
2176
2145
|
pivotBy,
|
|
2177
|
-
|
|
2146
|
+
groupBy
|
|
2178
2147
|
}));
|
|
2179
2148
|
} else {
|
|
2180
2149
|
column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
|
|
@@ -2183,11 +2152,11 @@ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params)
|
|
|
2183
2152
|
if (!column.render) {
|
|
2184
2153
|
column.render = (renderOptions) => {
|
|
2185
2154
|
var _a;
|
|
2186
|
-
let { value, rowInfo, column: column2,
|
|
2155
|
+
let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
|
|
2187
2156
|
if (column2.renderValue) {
|
|
2188
2157
|
value = column2.renderValue(renderOptions);
|
|
2189
2158
|
}
|
|
2190
|
-
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) <
|
|
2159
|
+
const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
|
|
2191
2160
|
return /* @__PURE__ */ createElement4("div", {
|
|
2192
2161
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
2193
2162
|
}, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
|
|
@@ -2287,7 +2256,7 @@ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2287
2256
|
function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
2288
2257
|
let generatedGroupColumn = {
|
|
2289
2258
|
header: `Group`,
|
|
2290
|
-
groupByField: options.
|
|
2259
|
+
groupByField: options.groupBy.map((g) => g.field),
|
|
2291
2260
|
sortable: false,
|
|
2292
2261
|
render: (renderOptions) => {
|
|
2293
2262
|
let { value, rowInfo, column } = renderOptions;
|
|
@@ -2403,10 +2372,10 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
2403
2372
|
};
|
|
2404
2373
|
|
|
2405
2374
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2406
|
-
import { useEffect as
|
|
2375
|
+
import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
2407
2376
|
|
|
2408
2377
|
// src/components/hooks/useEffectWithChanges.ts
|
|
2409
|
-
import { useEffect as
|
|
2378
|
+
import { useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
2410
2379
|
function useEffectWithChanges(fn, deps) {
|
|
2411
2380
|
const prevRef = useRef5({});
|
|
2412
2381
|
const oldValuesRef = useRef5({});
|
|
@@ -2424,7 +2393,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
2424
2393
|
}
|
|
2425
2394
|
}
|
|
2426
2395
|
prevRef.current = deps;
|
|
2427
|
-
|
|
2396
|
+
useEffect7(() => {
|
|
2428
2397
|
const changes2 = changesRef.current;
|
|
2429
2398
|
const result = fn(changes2, oldValues);
|
|
2430
2399
|
changesRef.current = {};
|
|
@@ -2440,7 +2409,7 @@ function buildDataSourceDataParams(componentState) {
|
|
|
2440
2409
|
const dataSourceParams = {
|
|
2441
2410
|
originalDataArray: componentState.originalDataArray,
|
|
2442
2411
|
sortInfo,
|
|
2443
|
-
|
|
2412
|
+
groupBy: componentState.groupBy,
|
|
2444
2413
|
pivotBy: componentState.pivotBy
|
|
2445
2414
|
};
|
|
2446
2415
|
if (componentState.livePagination !== void 0) {
|
|
@@ -2502,7 +2471,7 @@ function useLivePagination() {
|
|
|
2502
2471
|
const {
|
|
2503
2472
|
notifyScrollbarsChange,
|
|
2504
2473
|
sortInfo,
|
|
2505
|
-
|
|
2474
|
+
groupBy,
|
|
2506
2475
|
pivotBy,
|
|
2507
2476
|
livePaginationCursor,
|
|
2508
2477
|
scrollBottomId
|
|
@@ -2512,7 +2481,7 @@ function useLivePagination() {
|
|
|
2512
2481
|
horizontal: false
|
|
2513
2482
|
});
|
|
2514
2483
|
const scrollbarsRef = useRef6(scrollbars);
|
|
2515
|
-
|
|
2484
|
+
useEffect8(() => {
|
|
2516
2485
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2517
2486
|
if (!scrollbars2) {
|
|
2518
2487
|
return;
|
|
@@ -2523,7 +2492,7 @@ function useLivePagination() {
|
|
|
2523
2492
|
return () => notifyScrollbarsChange.destroy();
|
|
2524
2493
|
}, [notifyScrollbarsChange]);
|
|
2525
2494
|
const [cursorId, updateCursorId] = useState4(void 0);
|
|
2526
|
-
|
|
2495
|
+
useEffect8(() => {
|
|
2527
2496
|
const frameId = requestAnimationFrame(() => {
|
|
2528
2497
|
var _a;
|
|
2529
2498
|
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
@@ -2532,18 +2501,18 @@ function useLivePagination() {
|
|
|
2532
2501
|
});
|
|
2533
2502
|
return () => cancelAnimationFrame(frameId);
|
|
2534
2503
|
}, [livePaginationCursor]);
|
|
2535
|
-
|
|
2504
|
+
useEffect8(() => {
|
|
2536
2505
|
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2537
2506
|
if (!scrollbars.vertical && livePagination) {
|
|
2538
2507
|
updateCursorId(livePaginationCursor2);
|
|
2539
2508
|
}
|
|
2540
2509
|
}, [scrollbars.vertical]);
|
|
2541
|
-
|
|
2510
|
+
useEffect8(() => {
|
|
2542
2511
|
updateCursorId(scrollBottomId);
|
|
2543
2512
|
}, [scrollBottomId]);
|
|
2544
2513
|
const depsObject = {
|
|
2545
2514
|
sortInfo,
|
|
2546
|
-
|
|
2515
|
+
groupBy,
|
|
2547
2516
|
pivotBy,
|
|
2548
2517
|
cursorId
|
|
2549
2518
|
};
|
|
@@ -2624,6 +2593,13 @@ var DeepMap = class {
|
|
|
2624
2593
|
});
|
|
2625
2594
|
}
|
|
2626
2595
|
}
|
|
2596
|
+
static clone(map2) {
|
|
2597
|
+
const clone = new DeepMap();
|
|
2598
|
+
map2.visit((pair, keys) => {
|
|
2599
|
+
clone.set(keys, pair.value);
|
|
2600
|
+
});
|
|
2601
|
+
return clone;
|
|
2602
|
+
}
|
|
2627
2603
|
set(keys, value) {
|
|
2628
2604
|
let currentMap = this.map;
|
|
2629
2605
|
if (!keys.length) {
|
|
@@ -3000,6 +2976,7 @@ function initSetupState2() {
|
|
|
3000
2976
|
pivotTotalColumnPosition: "end",
|
|
3001
2977
|
originalDataArray,
|
|
3002
2978
|
scrollBottomId: Symbol("scrollBottomId"),
|
|
2979
|
+
showSeparatePivotColumnForSingleAggregation: false,
|
|
3003
2980
|
pivotColumns: void 0,
|
|
3004
2981
|
pivotColumnGroups: void 0,
|
|
3005
2982
|
dataArray,
|
|
@@ -3008,7 +2985,6 @@ function initSetupState2() {
|
|
|
3008
2985
|
sortedAt: 0,
|
|
3009
2986
|
reducedAt: now,
|
|
3010
2987
|
generateGroupRows: true,
|
|
3011
|
-
aggregationReducers: void 0,
|
|
3012
2988
|
groupDeepMap: void 0,
|
|
3013
2989
|
postSortDataArray: void 0,
|
|
3014
2990
|
postGroupDataArray: void 0,
|
|
@@ -3024,15 +3000,15 @@ function getCompareObject(dataParams) {
|
|
|
3024
3000
|
var forwardProps3 = () => {
|
|
3025
3001
|
return {
|
|
3026
3002
|
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
|
|
3027
|
-
remoteCount: 1,
|
|
3028
3003
|
data: 1,
|
|
3029
3004
|
pivotBy: 1,
|
|
3030
3005
|
primaryKey: 1,
|
|
3031
3006
|
livePagination: 1,
|
|
3032
3007
|
livePaginationCursor: 1,
|
|
3008
|
+
aggregationReducers: 1,
|
|
3033
3009
|
loading: (loading) => loading != null ? loading : false,
|
|
3034
3010
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
|
|
3035
|
-
|
|
3011
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
3036
3012
|
groupRowsState: (groupRowsState) => {
|
|
3037
3013
|
return groupRowsState || new GroupRowsState({
|
|
3038
3014
|
expandedRows: true,
|
|
@@ -3064,19 +3040,28 @@ function DEFAULT_TO_KEY(value) {
|
|
|
3064
3040
|
return value;
|
|
3065
3041
|
}
|
|
3066
3042
|
function initReducers(reducers) {
|
|
3067
|
-
if (!reducers || !reducers.length) {
|
|
3068
|
-
return
|
|
3043
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3044
|
+
return {};
|
|
3069
3045
|
}
|
|
3070
|
-
|
|
3046
|
+
const result = {};
|
|
3047
|
+
for (let key in reducers)
|
|
3048
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3049
|
+
result[key] = reducers[key].initialValue;
|
|
3050
|
+
}
|
|
3051
|
+
return result;
|
|
3071
3052
|
}
|
|
3072
3053
|
function computeReducersFor(data, reducers, reducerResults) {
|
|
3073
|
-
|
|
3054
|
+
var _a, _b;
|
|
3055
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
3074
3056
|
return;
|
|
3075
3057
|
}
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3058
|
+
for (let key in reducers)
|
|
3059
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3060
|
+
const reducer = reducers[key];
|
|
3061
|
+
const currentValue = reducerResults[key];
|
|
3062
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3063
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3064
|
+
}
|
|
3080
3065
|
}
|
|
3081
3066
|
function group(groupParams, data) {
|
|
3082
3067
|
const {
|
|
@@ -3091,7 +3076,7 @@ function group(groupParams, data) {
|
|
|
3091
3076
|
let currentGroupKeys = [];
|
|
3092
3077
|
let currentPivotKeys = [];
|
|
3093
3078
|
const initialReducerValue = initReducers(reducers);
|
|
3094
|
-
const globalReducerResults =
|
|
3079
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
3095
3080
|
for (let i = 0, len = data.length; i < len; i++) {
|
|
3096
3081
|
let item = data[i];
|
|
3097
3082
|
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
@@ -3101,7 +3086,7 @@ function group(groupParams, data) {
|
|
|
3101
3086
|
if (!deepMap.has(currentGroupKeys)) {
|
|
3102
3087
|
const deepMapGroupValue = {
|
|
3103
3088
|
items: [],
|
|
3104
|
-
reducerResults:
|
|
3089
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
3105
3090
|
};
|
|
3106
3091
|
if (pivot) {
|
|
3107
3092
|
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
@@ -3125,7 +3110,7 @@ function group(groupParams, data) {
|
|
|
3125
3110
|
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3126
3111
|
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3127
3112
|
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3128
|
-
reducerResults:
|
|
3113
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3129
3114
|
items: []
|
|
3130
3115
|
});
|
|
3131
3116
|
}
|
|
@@ -3187,11 +3172,23 @@ function flatten(groupResult) {
|
|
|
3187
3172
|
return result;
|
|
3188
3173
|
}
|
|
3189
3174
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
3190
|
-
const { groupBy, groupKeys, collapsed, parents } = options;
|
|
3175
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
3191
3176
|
const groupNesting = groupKeys.length;
|
|
3192
3177
|
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3178
|
+
let data = null;
|
|
3179
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
3180
|
+
data = {};
|
|
3181
|
+
for (let key in reducers)
|
|
3182
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3183
|
+
const reducer = reducers[key];
|
|
3184
|
+
const field = reducer.field;
|
|
3185
|
+
if (field) {
|
|
3186
|
+
data[field] = reducerResults[key];
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3193
3190
|
const enhancedGroupData = {
|
|
3194
|
-
data
|
|
3191
|
+
data,
|
|
3195
3192
|
groupCount: groupItems.length,
|
|
3196
3193
|
groupData: groupItems,
|
|
3197
3194
|
groupKeys,
|
|
@@ -3213,17 +3210,25 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
3213
3210
|
return enhancedGroupData;
|
|
3214
3211
|
}
|
|
3215
3212
|
function completeReducers(reducers, reducerResults, items) {
|
|
3216
|
-
if (reducers
|
|
3217
|
-
|
|
3218
|
-
if (
|
|
3219
|
-
|
|
3213
|
+
if (reducers) {
|
|
3214
|
+
for (let key in reducers)
|
|
3215
|
+
if (reducers.hasOwnProperty(key)) {
|
|
3216
|
+
const reducer = reducers[key];
|
|
3217
|
+
if (reducer.done) {
|
|
3218
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
3219
|
+
}
|
|
3220
3220
|
}
|
|
3221
|
-
});
|
|
3222
3221
|
}
|
|
3223
3222
|
return reducerResults;
|
|
3224
3223
|
}
|
|
3225
3224
|
function enhancedFlatten(param) {
|
|
3226
|
-
const {
|
|
3225
|
+
const {
|
|
3226
|
+
groupResult,
|
|
3227
|
+
toPrimaryKey,
|
|
3228
|
+
groupRowsState,
|
|
3229
|
+
generateGroupRows,
|
|
3230
|
+
reducers = {}
|
|
3231
|
+
} = param;
|
|
3227
3232
|
const { groupParams, deepMap, pivot } = groupResult;
|
|
3228
3233
|
const { groupBy } = groupParams;
|
|
3229
3234
|
const groupByStrings = groupBy.map((g) => g.field);
|
|
@@ -3238,6 +3243,7 @@ function enhancedFlatten(param) {
|
|
|
3238
3243
|
const enhancedGroupData = getEnhancedGroupData({
|
|
3239
3244
|
groupBy: groupByStrings,
|
|
3240
3245
|
parents: Array.from(parents),
|
|
3246
|
+
reducers,
|
|
3241
3247
|
indexInGroup,
|
|
3242
3248
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3243
3249
|
indexInAll: result.length,
|
|
@@ -3290,13 +3296,45 @@ function enhancedFlatten(param) {
|
|
|
3290
3296
|
}
|
|
3291
3297
|
|
|
3292
3298
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3293
|
-
function
|
|
3299
|
+
function prepareColumn(column) {
|
|
3300
|
+
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3301
|
+
if (pivotByForColumn.column) {
|
|
3302
|
+
if (typeof pivotByForColumn.column === "function") {
|
|
3303
|
+
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3304
|
+
} else {
|
|
3305
|
+
Object.assign(column, pivotByForColumn.column);
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
return column;
|
|
3309
|
+
}
|
|
3310
|
+
function prepareColumnGroup(columnGroup) {
|
|
3311
|
+
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3312
|
+
if (pivotByForColumnGroup.columnGroup) {
|
|
3313
|
+
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3314
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3315
|
+
} else {
|
|
3316
|
+
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
return columnGroup;
|
|
3320
|
+
}
|
|
3321
|
+
function getPivotColumnsAndColumnGroups({
|
|
3322
|
+
deepMap,
|
|
3323
|
+
pivotBy,
|
|
3324
|
+
pivotTotalColumnPosition,
|
|
3325
|
+
reducers = {},
|
|
3326
|
+
showSeparatePivotColumnForSingleAggregation = false
|
|
3327
|
+
}) {
|
|
3294
3328
|
const pivotLength = pivotBy.length;
|
|
3329
|
+
const aggregationReducers = Object.keys(reducers).map((key) => {
|
|
3330
|
+
return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
|
|
3331
|
+
});
|
|
3295
3332
|
const columns = new Map([
|
|
3296
3333
|
[
|
|
3297
3334
|
"labels",
|
|
3298
3335
|
{
|
|
3299
3336
|
header: "Row labels",
|
|
3337
|
+
pivotBy,
|
|
3300
3338
|
valueGetter: (params) => {
|
|
3301
3339
|
var _a;
|
|
3302
3340
|
const { rowInfo } = params;
|
|
@@ -3306,72 +3344,104 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3306
3344
|
]
|
|
3307
3345
|
]);
|
|
3308
3346
|
const columnGroups = new Map();
|
|
3347
|
+
const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
|
|
3309
3348
|
deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
|
|
3310
3349
|
keys = [...keys];
|
|
3311
3350
|
if (pivotTotalColumnPosition === "end") {
|
|
3312
3351
|
next == null ? void 0 : next();
|
|
3313
3352
|
}
|
|
3314
3353
|
if (keys.length === pivotLength) {
|
|
3315
|
-
const parentKeys = keys.slice(0, -1);
|
|
3316
|
-
let columnGroupId = parentKeys.join("/");
|
|
3317
3354
|
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3318
|
-
let computedPivotColumn = __spreadValues({
|
|
3319
|
-
pivotBy,
|
|
3320
|
-
pivotColumn: true,
|
|
3321
|
-
pivotGroupKeys: keys,
|
|
3322
|
-
pivotGroupKeyForColumn: keys[keys.length - 1],
|
|
3323
|
-
pivotIndexForColumn: keys.length - 1,
|
|
3324
|
-
pivotByForColumn,
|
|
3325
|
-
sortable: false,
|
|
3326
|
-
columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
|
|
3327
|
-
header: keys[keys.length - 1],
|
|
3328
|
-
valueGetter: ({ rowInfo }) => {
|
|
3329
|
-
var _a, _b, _c;
|
|
3330
|
-
const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
|
|
3331
|
-
return value;
|
|
3332
|
-
}
|
|
3333
|
-
}, pivotByForColumn.column);
|
|
3334
|
-
if (pivotByForColumn.column) {
|
|
3335
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3336
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3337
|
-
} else {
|
|
3338
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3339
|
-
}
|
|
3340
|
-
}
|
|
3341
|
-
columns.set(`${keys.join("/")}`, computedPivotColumn);
|
|
3342
|
-
} else {
|
|
3343
|
-
const colGroupId = keys.join("/");
|
|
3344
3355
|
const parentKeys = keys.slice(0, -1);
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
columnGroup:
|
|
3353
|
-
|
|
3354
|
-
pivotTotalColumn: true,
|
|
3356
|
+
let parentColumnGroupId = parentKeys.join("/");
|
|
3357
|
+
if (!isSingleAggregationColumn) {
|
|
3358
|
+
const columnGroupId = parentColumnGroupId;
|
|
3359
|
+
parentColumnGroupId = keys.join("/");
|
|
3360
|
+
const pivotGroupKey = keys[keys.length - 1];
|
|
3361
|
+
columnGroups.set(parentColumnGroupId, prepareColumnGroup({
|
|
3362
|
+
header: pivotGroupKey,
|
|
3363
|
+
columnGroup: columnGroupId,
|
|
3364
|
+
pivotBy,
|
|
3355
3365
|
pivotGroupKeys: keys,
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3366
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3367
|
+
pivotIndex: keys.length - 1,
|
|
3368
|
+
pivotGroupKey
|
|
3369
|
+
}));
|
|
3370
|
+
}
|
|
3371
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3372
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3373
|
+
const computedPivotColumn = prepareColumn({
|
|
3359
3374
|
pivotBy,
|
|
3375
|
+
pivotColumn: true,
|
|
3376
|
+
pivotTotalColumn: false,
|
|
3377
|
+
pivotAggregator: reducer,
|
|
3378
|
+
pivotAggregatorIndex: index,
|
|
3379
|
+
pivotGroupKeys: keys,
|
|
3380
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3381
|
+
pivotIndex: keys.length - 1,
|
|
3382
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3360
3383
|
sortable: false,
|
|
3384
|
+
columnGroup: parentColumnGroupId,
|
|
3385
|
+
header,
|
|
3361
3386
|
valueGetter: ({ rowInfo }) => {
|
|
3362
|
-
var _a, _b
|
|
3363
|
-
|
|
3364
|
-
return value;
|
|
3365
|
-
}
|
|
3366
|
-
}, pivotByForColumn.column);
|
|
3367
|
-
if (pivotByForColumn.column) {
|
|
3368
|
-
if (typeof pivotByForColumn.column === "function") {
|
|
3369
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column({ column: computedPivotColumn }));
|
|
3370
|
-
} else {
|
|
3371
|
-
Object.assign(computedPivotColumn, pivotByForColumn.column);
|
|
3387
|
+
var _a, _b;
|
|
3388
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3372
3389
|
}
|
|
3390
|
+
});
|
|
3391
|
+
const columnId = `${keys.join("/")}-${reducer.id}`;
|
|
3392
|
+
columns.set(columnId, computedPivotColumn);
|
|
3393
|
+
});
|
|
3394
|
+
} else {
|
|
3395
|
+
const colGroupId = keys.join("/");
|
|
3396
|
+
const parentKeys = keys.slice(0, -1);
|
|
3397
|
+
columnGroups.set(colGroupId, prepareColumnGroup({
|
|
3398
|
+
columnGroup: parentKeys.length ? parentKeys.join("/") : void 0,
|
|
3399
|
+
header: keys[keys.length - 1],
|
|
3400
|
+
pivotBy,
|
|
3401
|
+
pivotGroupKeys: keys,
|
|
3402
|
+
pivotIndex: keys.length - 1,
|
|
3403
|
+
pivotByAtIndex: pivotBy[keys.length - 1],
|
|
3404
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3405
|
+
}));
|
|
3406
|
+
if (pivotTotalColumnPosition !== false) {
|
|
3407
|
+
const pivotByForColumn = pivotBy[keys.length - 1];
|
|
3408
|
+
let columnGroupId = parentKeys.length ? parentKeys.join("/") : void 0;
|
|
3409
|
+
if (!isSingleAggregationColumn) {
|
|
3410
|
+
let parentGroupForTotalsGroup = columnGroupId;
|
|
3411
|
+
columnGroupId = `total:${keys.join("/")}`;
|
|
3412
|
+
columnGroups.set(columnGroupId, prepareColumnGroup({
|
|
3413
|
+
header: `${keys[keys.length - 1]} total`,
|
|
3414
|
+
columnGroup: parentGroupForTotalsGroup,
|
|
3415
|
+
pivotBy,
|
|
3416
|
+
pivotTotalColumnGroup: true,
|
|
3417
|
+
pivotGroupKeys: keys,
|
|
3418
|
+
pivotIndex: keys.length - 1,
|
|
3419
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3420
|
+
pivotGroupKey: keys[keys.length - 1]
|
|
3421
|
+
}));
|
|
3373
3422
|
}
|
|
3374
|
-
|
|
3423
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3424
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3425
|
+
const computedPivotColumn = prepareColumn({
|
|
3426
|
+
columnGroup: columnGroupId,
|
|
3427
|
+
header,
|
|
3428
|
+
pivotAggregator: reducer,
|
|
3429
|
+
pivotAggregatorIndex: index,
|
|
3430
|
+
pivotColumn: true,
|
|
3431
|
+
pivotTotalColumn: true,
|
|
3432
|
+
pivotGroupKeys: keys,
|
|
3433
|
+
pivotGroupKey: keys[keys.length - 1],
|
|
3434
|
+
pivotByAtIndex: pivotByForColumn,
|
|
3435
|
+
pivotIndex: keys.length - 1,
|
|
3436
|
+
pivotBy,
|
|
3437
|
+
sortable: false,
|
|
3438
|
+
valueGetter: ({ rowInfo }) => {
|
|
3439
|
+
var _a, _b;
|
|
3440
|
+
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3441
|
+
}
|
|
3442
|
+
});
|
|
3443
|
+
columns.set(`total:${keys.join("/")}-${reducer.id}`, computedPivotColumn);
|
|
3444
|
+
});
|
|
3375
3445
|
}
|
|
3376
3446
|
}
|
|
3377
3447
|
if (pivotTotalColumnPosition === "start" || pivotTotalColumnPosition === false) {
|
|
@@ -3381,9 +3451,12 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
|
|
|
3381
3451
|
if (columns.size === 1) {
|
|
3382
3452
|
columns.set("single", {
|
|
3383
3453
|
header: "Reduced",
|
|
3454
|
+
pivotBy,
|
|
3455
|
+
pivotColumn: true,
|
|
3384
3456
|
valueGetter: ({ rowInfo }) => {
|
|
3385
3457
|
var _a;
|
|
3386
|
-
|
|
3458
|
+
const key = Object.keys(rowInfo.reducerResults || {})[0];
|
|
3459
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[key];
|
|
3387
3460
|
}
|
|
3388
3461
|
});
|
|
3389
3462
|
}
|
|
@@ -3407,7 +3480,14 @@ var haveDepsChanged = (state1, state2, deps) => {
|
|
|
3407
3480
|
return false;
|
|
3408
3481
|
};
|
|
3409
3482
|
function toRowInfo(data, id, index) {
|
|
3410
|
-
return {
|
|
3483
|
+
return {
|
|
3484
|
+
data,
|
|
3485
|
+
collapsed: true,
|
|
3486
|
+
id,
|
|
3487
|
+
indexInAll: index,
|
|
3488
|
+
indexInGroup: index,
|
|
3489
|
+
isGroupRow: false
|
|
3490
|
+
};
|
|
3411
3491
|
}
|
|
3412
3492
|
function concludeReducer(params) {
|
|
3413
3493
|
var _a;
|
|
@@ -3419,17 +3499,18 @@ function concludeReducer(params) {
|
|
|
3419
3499
|
"sortInfo"
|
|
3420
3500
|
]);
|
|
3421
3501
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3422
|
-
const groupBy = state.
|
|
3502
|
+
const groupBy = state.groupBy;
|
|
3423
3503
|
const pivotBy = state.pivotBy;
|
|
3424
3504
|
const shouldGroup = groupBy.length || pivotBy;
|
|
3425
3505
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3426
3506
|
"generateGroupRows",
|
|
3427
3507
|
"originalDataArray",
|
|
3428
|
-
"
|
|
3508
|
+
"groupBy",
|
|
3429
3509
|
"groupRowsState",
|
|
3430
3510
|
"pivotBy",
|
|
3431
3511
|
"aggregationReducers",
|
|
3432
3512
|
"pivotTotalColumnPosition",
|
|
3513
|
+
"showSeparatePivotColumnForSingleAggregation",
|
|
3433
3514
|
"sortInfo"
|
|
3434
3515
|
]);
|
|
3435
3516
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
@@ -3455,13 +3536,20 @@ function concludeReducer(params) {
|
|
|
3455
3536
|
}, dataArray);
|
|
3456
3537
|
const flattenResult = enhancedFlatten({
|
|
3457
3538
|
groupResult,
|
|
3539
|
+
reducers: state.aggregationReducers,
|
|
3458
3540
|
toPrimaryKey,
|
|
3459
3541
|
groupRowsState: state.groupRowsState,
|
|
3460
3542
|
generateGroupRows: state.generateGroupRows
|
|
3461
3543
|
});
|
|
3462
3544
|
rowInfoDataArray = flattenResult.data;
|
|
3463
3545
|
state.groupDeepMap = groupResult.deepMap;
|
|
3464
|
-
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(
|
|
3546
|
+
const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
|
|
3547
|
+
deepMap: groupResult.topLevelPivotColumns,
|
|
3548
|
+
pivotBy,
|
|
3549
|
+
pivotTotalColumnPosition: (_a = state.pivotTotalColumnPosition) != null ? _a : "end",
|
|
3550
|
+
reducers: state.aggregationReducers,
|
|
3551
|
+
showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
|
|
3552
|
+
}) : void 0;
|
|
3465
3553
|
state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
|
|
3466
3554
|
state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
|
|
3467
3555
|
} else {
|
|
@@ -3548,49 +3636,49 @@ function useToggleGroupRow() {
|
|
|
3548
3636
|
}
|
|
3549
3637
|
|
|
3550
3638
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3551
|
-
function
|
|
3552
|
-
const
|
|
3553
|
-
return
|
|
3554
|
-
acc.set(
|
|
3555
|
-
groupBy,
|
|
3639
|
+
function useGroupByMap(groupBy) {
|
|
3640
|
+
const groupByMap = useMemo5(() => {
|
|
3641
|
+
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3642
|
+
acc.set(groupBy2.field, {
|
|
3643
|
+
groupBy: groupBy2,
|
|
3556
3644
|
groupIndex: index
|
|
3557
3645
|
});
|
|
3558
3646
|
return acc;
|
|
3559
3647
|
}, new Map());
|
|
3560
|
-
}, [
|
|
3561
|
-
return
|
|
3648
|
+
}, [groupBy]);
|
|
3649
|
+
return groupByMap;
|
|
3562
3650
|
}
|
|
3563
3651
|
function useColumnsWhen() {
|
|
3564
3652
|
const {
|
|
3565
|
-
componentState: {
|
|
3653
|
+
componentState: { groupBy },
|
|
3566
3654
|
componentActions: dataSourceActions
|
|
3567
3655
|
} = useDataSourceContextValue();
|
|
3568
3656
|
const {
|
|
3569
3657
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3570
3658
|
} = useComponentState();
|
|
3571
|
-
const
|
|
3572
|
-
|
|
3659
|
+
const groupByMap = useGroupByMap(groupBy);
|
|
3660
|
+
useEffect9(() => {
|
|
3573
3661
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3574
3662
|
}, [groupRenderStrategy]);
|
|
3575
|
-
|
|
3663
|
+
useEffect9(() => {
|
|
3576
3664
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3577
3665
|
}, [pivotTotalColumnPosition]);
|
|
3578
|
-
useColumnsWhenInlineGroupRenderStrategy(
|
|
3666
|
+
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
3579
3667
|
useColumnsWhenPivoting();
|
|
3580
3668
|
useColumnsWhenGrouping();
|
|
3581
|
-
useHideEmptyGroupColumns(
|
|
3669
|
+
useHideEmptyGroupColumns(groupByMap);
|
|
3582
3670
|
}
|
|
3583
|
-
function useColumnsWhenInlineGroupRenderStrategy(
|
|
3671
|
+
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
3584
3672
|
const toggleGroupRow = useToggleGroupRow();
|
|
3585
3673
|
const {
|
|
3586
3674
|
componentActions,
|
|
3587
3675
|
componentState: { columns, groupRenderStrategy }
|
|
3588
3676
|
} = useComponentState();
|
|
3589
|
-
function computeColumnsWhenInlineGroupRenderStrategy(columns2,
|
|
3677
|
+
function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
|
|
3590
3678
|
const computedColumns = new Map();
|
|
3591
3679
|
columns2.forEach((column, id) => {
|
|
3592
3680
|
let base = {};
|
|
3593
|
-
const groupByForColumn =
|
|
3681
|
+
const groupByForColumn = groupByMap2.get(column.field);
|
|
3594
3682
|
if (groupByForColumn && groupRenderStrategy2 === "inline") {
|
|
3595
3683
|
const { groupIndex } = groupByForColumn;
|
|
3596
3684
|
const field = groupByForColumn.groupBy.field;
|
|
@@ -3635,9 +3723,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3635
3723
|
});
|
|
3636
3724
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3637
3725
|
}
|
|
3638
|
-
|
|
3726
|
+
useEffect9(() => {
|
|
3639
3727
|
const update = () => {
|
|
3640
|
-
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns,
|
|
3728
|
+
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3641
3729
|
};
|
|
3642
3730
|
update();
|
|
3643
3731
|
return interceptMap(columns, {
|
|
@@ -3645,11 +3733,11 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
|
|
|
3645
3733
|
delete: update,
|
|
3646
3734
|
clear: update
|
|
3647
3735
|
});
|
|
3648
|
-
}, [columns,
|
|
3736
|
+
}, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
|
|
3649
3737
|
}
|
|
3650
3738
|
function useColumnsWhenPivoting() {
|
|
3651
3739
|
const {
|
|
3652
|
-
componentState: {
|
|
3740
|
+
componentState: { groupBy, pivotBy }
|
|
3653
3741
|
} = useDataSourceContextValue();
|
|
3654
3742
|
const {
|
|
3655
3743
|
componentActions,
|
|
@@ -3661,13 +3749,13 @@ function useColumnsWhenPivoting() {
|
|
|
3661
3749
|
}
|
|
3662
3750
|
} = useComponentState();
|
|
3663
3751
|
const toggleGroupRow = useToggleGroupRow();
|
|
3664
|
-
|
|
3752
|
+
useEffect9(() => {
|
|
3665
3753
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3666
3754
|
pivotColumn,
|
|
3667
3755
|
pivotRowLabelsColumn,
|
|
3668
3756
|
pivotTotalColumnPosition,
|
|
3669
3757
|
pivotBy,
|
|
3670
|
-
|
|
3758
|
+
groupBy,
|
|
3671
3759
|
toggleGroupRow
|
|
3672
3760
|
});
|
|
3673
3761
|
componentActions.computedPivotColumns = computedPivotColumns;
|
|
@@ -3675,14 +3763,14 @@ function useColumnsWhenPivoting() {
|
|
|
3675
3763
|
}
|
|
3676
3764
|
function useColumnsWhenGrouping() {
|
|
3677
3765
|
const {
|
|
3678
|
-
componentState: {
|
|
3766
|
+
componentState: { groupBy }
|
|
3679
3767
|
} = useDataSourceContextValue();
|
|
3680
3768
|
const {
|
|
3681
3769
|
componentActions,
|
|
3682
3770
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3683
3771
|
} = useComponentState();
|
|
3684
3772
|
const toggleGroupRow = useToggleGroupRow();
|
|
3685
|
-
|
|
3773
|
+
useEffect9(() => {
|
|
3686
3774
|
if (pivotColumns) {
|
|
3687
3775
|
return;
|
|
3688
3776
|
}
|
|
@@ -3691,7 +3779,7 @@ function useColumnsWhenGrouping() {
|
|
|
3691
3779
|
columns,
|
|
3692
3780
|
groupColumn,
|
|
3693
3781
|
groupRenderStrategy,
|
|
3694
|
-
|
|
3782
|
+
groupBy,
|
|
3695
3783
|
pivotColumns,
|
|
3696
3784
|
toggleGroupRow
|
|
3697
3785
|
});
|
|
@@ -3703,11 +3791,11 @@ function useColumnsWhenGrouping() {
|
|
|
3703
3791
|
delete: update,
|
|
3704
3792
|
clear: update
|
|
3705
3793
|
});
|
|
3706
|
-
}, [
|
|
3794
|
+
}, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
|
|
3707
3795
|
}
|
|
3708
3796
|
function useHideEmptyGroupColumns(groupRowsMap) {
|
|
3709
3797
|
const {
|
|
3710
|
-
componentState: {
|
|
3798
|
+
componentState: { groupBy, groupRowsState },
|
|
3711
3799
|
getState: getDataSourceState
|
|
3712
3800
|
} = useDataSourceContextValue();
|
|
3713
3801
|
const {
|
|
@@ -3719,11 +3807,11 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3719
3807
|
groupRenderStrategy
|
|
3720
3808
|
}
|
|
3721
3809
|
} = useComponentState();
|
|
3722
|
-
|
|
3723
|
-
if (groupRenderStrategy
|
|
3810
|
+
useEffect9(() => {
|
|
3811
|
+
if (groupRenderStrategy !== "multi-column") {
|
|
3724
3812
|
return;
|
|
3725
3813
|
}
|
|
3726
|
-
const groupsLength =
|
|
3814
|
+
const groupsLength = groupBy.length;
|
|
3727
3815
|
let expandedGroupsLevel = 0;
|
|
3728
3816
|
const { dataArray } = getDataSourceState();
|
|
3729
3817
|
const len = dataArray.length;
|
|
@@ -3739,15 +3827,15 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3739
3827
|
let updated = false;
|
|
3740
3828
|
const columnVisibility = new Map(currentState.columnVisibility);
|
|
3741
3829
|
const cols = computedColumns;
|
|
3742
|
-
|
|
3743
|
-
const colId =
|
|
3744
|
-
|
|
3830
|
+
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3831
|
+
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
3832
|
+
let col = cols.get(colId);
|
|
3745
3833
|
if (!col) {
|
|
3746
3834
|
return;
|
|
3747
3835
|
}
|
|
3748
|
-
const shouldBeHidden = index > expandedGroupsLevel;
|
|
3836
|
+
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3749
3837
|
updated = true;
|
|
3750
|
-
if (shouldBeHidden
|
|
3838
|
+
if (shouldBeHidden) {
|
|
3751
3839
|
columnVisibility.set(colId, false);
|
|
3752
3840
|
} else {
|
|
3753
3841
|
columnVisibility.delete(colId);
|
|
@@ -3760,7 +3848,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3760
3848
|
getDataSourceState,
|
|
3761
3849
|
groupRenderStrategy,
|
|
3762
3850
|
generatedColumns,
|
|
3763
|
-
|
|
3851
|
+
groupBy,
|
|
3764
3852
|
groupRowsMap,
|
|
3765
3853
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
3766
3854
|
hideEmptyGroupColumns
|
|
@@ -3769,7 +3857,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3769
3857
|
function getColumnsWhenGrouping(params) {
|
|
3770
3858
|
const {
|
|
3771
3859
|
pivotColumns,
|
|
3772
|
-
|
|
3860
|
+
groupBy,
|
|
3773
3861
|
groupColumn,
|
|
3774
3862
|
groupRenderStrategy,
|
|
3775
3863
|
toggleGroupRow,
|
|
@@ -3783,10 +3871,10 @@ function getColumnsWhenGrouping(params) {
|
|
|
3783
3871
|
}
|
|
3784
3872
|
const computedColumns = new Map();
|
|
3785
3873
|
if (groupRenderStrategy === "multi-column") {
|
|
3786
|
-
|
|
3874
|
+
groupBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
|
|
3787
3875
|
const generatedGroupColumn = getColumnForGroupBy({
|
|
3788
3876
|
groupByForColumn,
|
|
3789
|
-
|
|
3877
|
+
groupBy,
|
|
3790
3878
|
groupIndexForColumn,
|
|
3791
3879
|
groupCount: arr.length,
|
|
3792
3880
|
groupRenderStrategy
|
|
@@ -3795,8 +3883,8 @@ function getColumnsWhenGrouping(params) {
|
|
|
3795
3883
|
});
|
|
3796
3884
|
} else if (groupRenderStrategy === "single-column") {
|
|
3797
3885
|
const singleGroupColumn = getSingleGroupColumn({
|
|
3798
|
-
groupCount:
|
|
3799
|
-
|
|
3886
|
+
groupCount: groupBy.length,
|
|
3887
|
+
groupBy,
|
|
3800
3888
|
groupRenderStrategy
|
|
3801
3889
|
}, toggleGroupRow, groupColumn);
|
|
3802
3890
|
computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
|
|
@@ -3821,7 +3909,8 @@ function useComputed() {
|
|
|
3821
3909
|
columnPinning,
|
|
3822
3910
|
columnSizing,
|
|
3823
3911
|
columnTypes,
|
|
3824
|
-
bodySize
|
|
3912
|
+
bodySize,
|
|
3913
|
+
showSeparatePivotColumnForSingleAggregation
|
|
3825
3914
|
} = componentState;
|
|
3826
3915
|
useState5(() => {
|
|
3827
3916
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
@@ -3835,7 +3924,9 @@ function useComputed() {
|
|
|
3835
3924
|
}
|
|
3836
3925
|
});
|
|
3837
3926
|
});
|
|
3838
|
-
|
|
3927
|
+
useEffect10(() => {
|
|
3928
|
+
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3929
|
+
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3839
3930
|
const { multiSort } = dataSourceState;
|
|
3840
3931
|
useColumnGroups();
|
|
3841
3932
|
useColumnsWhen();
|
|
@@ -3994,11 +4085,11 @@ function VerticalScrollbarPlaceholderFn(props) {
|
|
|
3994
4085
|
var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
|
|
3995
4086
|
|
|
3996
4087
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3997
|
-
var
|
|
4088
|
+
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3998
4089
|
var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
3999
4090
|
var HeaderCellProxy = "_12zfob10";
|
|
4000
|
-
var HeaderCellRecipe = (0,
|
|
4001
|
-
var HeaderClsRecipe = (0,
|
|
4091
|
+
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"]] });
|
|
4092
|
+
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"]] });
|
|
4002
4093
|
var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
|
|
4003
4094
|
var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
|
|
4004
4095
|
var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
|
|
@@ -4026,18 +4117,18 @@ import {
|
|
|
4026
4117
|
} from "react";
|
|
4027
4118
|
|
|
4028
4119
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4029
|
-
import { useContext as
|
|
4120
|
+
import { useContext as useContext4 } from "react";
|
|
4030
4121
|
var useInfiniteTableState = () => {
|
|
4031
4122
|
const TableContext2 = getInfiniteTableContext();
|
|
4032
|
-
const { componentState } =
|
|
4123
|
+
const { componentState } = useContext4(TableContext2);
|
|
4033
4124
|
return componentState;
|
|
4034
4125
|
};
|
|
4035
4126
|
|
|
4036
4127
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4037
|
-
var
|
|
4128
|
+
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4038
4129
|
var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
|
|
4039
4130
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4040
|
-
var ColumnCellRecipe = (0,
|
|
4131
|
+
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"]] });
|
|
4041
4132
|
var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
|
|
4042
4133
|
|
|
4043
4134
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
@@ -5359,7 +5450,7 @@ import {
|
|
|
5359
5450
|
import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
|
|
5360
5451
|
|
|
5361
5452
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5362
|
-
var VirtualListCls = "
|
|
5453
|
+
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
5363
5454
|
var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
|
|
5364
5455
|
var scrollTransformTargetCls = "mlx2t3";
|
|
5365
5456
|
|
|
@@ -5513,32 +5604,38 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5513
5604
|
const groupRowInfo = null;
|
|
5514
5605
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5515
5606
|
if (column.valueGetter) {
|
|
5516
|
-
value = column.valueGetter({
|
|
5517
|
-
data,
|
|
5518
|
-
rowInfo
|
|
5519
|
-
|
|
5607
|
+
value = column.valueGetter(isGroupRow ? {
|
|
5608
|
+
data: rowInfo.data,
|
|
5609
|
+
rowInfo
|
|
5610
|
+
} : {
|
|
5611
|
+
data: rowInfo.data,
|
|
5612
|
+
rowInfo
|
|
5520
5613
|
});
|
|
5521
5614
|
}
|
|
5522
5615
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
5523
|
-
const
|
|
5524
|
-
|
|
5525
|
-
|
|
5616
|
+
const rest = rowInfo.isGroupRow ? {
|
|
5617
|
+
rowInfo,
|
|
5618
|
+
data: rowInfo.data
|
|
5619
|
+
} : {
|
|
5526
5620
|
rowInfo,
|
|
5527
|
-
data
|
|
5621
|
+
data: rowInfo.data
|
|
5528
5622
|
};
|
|
5623
|
+
const stylingRenderParam = __spreadValues({
|
|
5624
|
+
value,
|
|
5625
|
+
column
|
|
5626
|
+
}, rest);
|
|
5529
5627
|
let renderValue = value;
|
|
5530
5628
|
if (column.render || column.renderValue) {
|
|
5531
|
-
const renderParam = {
|
|
5629
|
+
const renderParam = __spreadProps(__spreadValues({
|
|
5532
5630
|
value,
|
|
5533
5631
|
column,
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
data,
|
|
5632
|
+
groupRowInfo
|
|
5633
|
+
}, rest), {
|
|
5537
5634
|
rowIndex,
|
|
5538
5635
|
toggleGroupRow,
|
|
5539
5636
|
toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
|
|
5540
|
-
|
|
5541
|
-
};
|
|
5637
|
+
groupBy: computedDataSource.groupBy
|
|
5638
|
+
});
|
|
5542
5639
|
if (column.render) {
|
|
5543
5640
|
renderValue = column.render(renderParam);
|
|
5544
5641
|
} else if (column.renderValue) {
|
|
@@ -5620,12 +5717,11 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5620
5717
|
domRefFromProps(node);
|
|
5621
5718
|
domRef.current = node;
|
|
5622
5719
|
}, []);
|
|
5623
|
-
const
|
|
5624
|
-
|
|
5625
|
-
rowInfo,
|
|
5720
|
+
const rest = rowInfo.isGroupRow ? { data: rowInfo.data, rowInfo } : { data: rowInfo.data, rowInfo };
|
|
5721
|
+
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
5626
5722
|
rowIndex,
|
|
5627
|
-
|
|
5628
|
-
};
|
|
5723
|
+
groupBy: rowInfo.groupBy
|
|
5724
|
+
});
|
|
5629
5725
|
if (typeof rowProps === "function") {
|
|
5630
5726
|
rowProps = rowProps(rowPropsAndStyleArgs);
|
|
5631
5727
|
}
|
|
@@ -5894,14 +5990,14 @@ function useUnpinnedRendering(params) {
|
|
|
5894
5990
|
import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
|
|
5895
5991
|
|
|
5896
5992
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5897
|
-
var
|
|
5993
|
+
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5898
5994
|
var FooterCls = "_16lm1iw1";
|
|
5899
5995
|
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
|
|
5900
|
-
var InfiniteClsRecipe = (0,
|
|
5996
|
+
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: [] });
|
|
5901
5997
|
var InfiniteClsScrolling = "_1yeub2v1";
|
|
5902
5998
|
var InfiniteClsShiftingColumns = "_16lm1iwm";
|
|
5903
5999
|
var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
|
|
5904
|
-
var PinnedRowsContainerClsVariants = (0,
|
|
6000
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5905
6001
|
|
|
5906
6002
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5907
6003
|
var DELAY = 200;
|
|
@@ -6866,7 +6962,6 @@ function useListRendering(param) {
|
|
|
6866
6962
|
setColumnVisibility: (columnVisibility) => {
|
|
6867
6963
|
componentActions.columnVisibility = columnVisibility;
|
|
6868
6964
|
},
|
|
6869
|
-
setColumnAggregations: (columnAggregations) => componentActions.columnAggregations = columnAggregations,
|
|
6870
6965
|
getState,
|
|
6871
6966
|
getDataSourceState
|
|
6872
6967
|
};
|
|
@@ -7173,7 +7268,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7173
7268
|
const valid = useMemo11(() => {
|
|
7174
7269
|
let valid2 = isValidLicense(licenseKey, {
|
|
7175
7270
|
publishedAt: 1624970570587,
|
|
7176
|
-
version: "0.0
|
|
7271
|
+
version: "0.1.0"
|
|
7177
7272
|
});
|
|
7178
7273
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7179
7274
|
return true;
|