@infinite-table/infinite-react 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +5 -4
- package/index.d.ts +280 -198
- package/index.esm.css +5 -4
- package/index.esm.js +1112 -673
- package/index.js +1151 -712
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -198,11 +198,11 @@ var require_common = __commonJS({
|
|
|
198
198
|
let enableOverride = null;
|
|
199
199
|
let namespacesCache;
|
|
200
200
|
let enabledCache;
|
|
201
|
-
function
|
|
202
|
-
if (!
|
|
201
|
+
function debug6(...args) {
|
|
202
|
+
if (!debug6.enabled) {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
|
-
const self =
|
|
205
|
+
const self = debug6;
|
|
206
206
|
const curr = Number(new Date());
|
|
207
207
|
const ms = curr - (prevTime || curr);
|
|
208
208
|
self.diff = ms;
|
|
@@ -232,12 +232,12 @@ var require_common = __commonJS({
|
|
|
232
232
|
const logFn = self.log || createDebug.log;
|
|
233
233
|
logFn.apply(self, args);
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
Object.defineProperty(
|
|
235
|
+
debug6.namespace = namespace;
|
|
236
|
+
debug6.useColors = createDebug.useColors();
|
|
237
|
+
debug6.color = createDebug.selectColor(namespace);
|
|
238
|
+
debug6.extend = extend;
|
|
239
|
+
debug6.destroy = createDebug.destroy;
|
|
240
|
+
Object.defineProperty(debug6, "enabled", {
|
|
241
241
|
enumerable: true,
|
|
242
242
|
configurable: false,
|
|
243
243
|
get: () => {
|
|
@@ -255,9 +255,9 @@ var require_common = __commonJS({
|
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
if (typeof createDebug.init === "function") {
|
|
258
|
-
createDebug.init(
|
|
258
|
+
createDebug.init(debug6);
|
|
259
259
|
}
|
|
260
|
-
return
|
|
260
|
+
return debug6;
|
|
261
261
|
}
|
|
262
262
|
function extend(namespace, delimiter) {
|
|
263
263
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
@@ -721,14 +721,21 @@ var ScrollListener = class {
|
|
|
721
721
|
};
|
|
722
722
|
|
|
723
723
|
// src/components/InfiniteTable/utils/toMap.ts
|
|
724
|
-
function toMap(mapOrObject) {
|
|
724
|
+
function toMap(mapOrObject, weakMapCache) {
|
|
725
725
|
if (!mapOrObject) {
|
|
726
726
|
return new Map();
|
|
727
727
|
}
|
|
728
728
|
if (mapOrObject instanceof Map) {
|
|
729
729
|
return mapOrObject;
|
|
730
730
|
}
|
|
731
|
-
|
|
731
|
+
if (weakMapCache && weakMapCache.has(mapOrObject)) {
|
|
732
|
+
return weakMapCache.get(mapOrObject);
|
|
733
|
+
}
|
|
734
|
+
const result = new Map(Object.entries(mapOrObject));
|
|
735
|
+
if (weakMapCache) {
|
|
736
|
+
weakMapCache.set(mapOrObject, result);
|
|
737
|
+
}
|
|
738
|
+
return result;
|
|
732
739
|
}
|
|
733
740
|
|
|
734
741
|
// src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
|
|
@@ -754,12 +761,10 @@ function computeColumnGroupsDepths(columnGroups) {
|
|
|
754
761
|
}
|
|
755
762
|
|
|
756
763
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
757
|
-
function toColumnTypesMap(mapOrObject) {
|
|
758
|
-
return toMap(mapOrObject);
|
|
759
|
-
}
|
|
760
764
|
function initSetupState() {
|
|
761
765
|
const columnsGeneratedForGrouping = new Map();
|
|
762
766
|
return {
|
|
767
|
+
propsCache: new Map([]),
|
|
763
768
|
columnShifts: null,
|
|
764
769
|
domRef: (0, import_react2.createRef)(),
|
|
765
770
|
scrollerDOMRef: (0, import_react2.createRef)(),
|
|
@@ -784,12 +789,8 @@ function initSetupState() {
|
|
|
784
789
|
columnsWhenInlineGroupRenderStrategy: void 0
|
|
785
790
|
};
|
|
786
791
|
}
|
|
787
|
-
var forwardProps = () => {
|
|
792
|
+
var forwardProps = (setupState) => {
|
|
788
793
|
return {
|
|
789
|
-
columns: (columns) => {
|
|
790
|
-
var _a;
|
|
791
|
-
return (_a = toMap(columns)) != null ? _a : new Map();
|
|
792
|
-
},
|
|
793
794
|
scrollTopId: 1,
|
|
794
795
|
components: 1,
|
|
795
796
|
loadingText: 1,
|
|
@@ -807,6 +808,7 @@ var forwardProps = () => {
|
|
|
807
808
|
onBlurWithin: 1,
|
|
808
809
|
onScrollToTop: 1,
|
|
809
810
|
onScrollToBottom: 1,
|
|
811
|
+
onScrollStop: 1,
|
|
810
812
|
scrollToBottomOffset: 1,
|
|
811
813
|
rowStyle: 1,
|
|
812
814
|
rowProps: 1,
|
|
@@ -817,6 +819,7 @@ var forwardProps = () => {
|
|
|
817
819
|
pivotRowLabelsColumn: 1,
|
|
818
820
|
pivotColumnGroups: 1,
|
|
819
821
|
onScrollbarsChange: 1,
|
|
822
|
+
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 100,
|
|
820
823
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
821
824
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
822
825
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
@@ -835,21 +838,13 @@ var forwardProps = () => {
|
|
|
835
838
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
836
839
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
837
840
|
headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
columnSizing: (columnSizing) => {
|
|
844
|
-
var _a;
|
|
845
|
-
return (_a = toMap(columnSizing)) != null ? _a : new Map();
|
|
846
|
-
},
|
|
847
|
-
columnTypes: (columnTypes) => {
|
|
848
|
-
var _a;
|
|
849
|
-
return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
|
|
850
|
-
},
|
|
841
|
+
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
842
|
+
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
843
|
+
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
844
|
+
columnSizing: (columnSizing) => toMap(columnSizing, setupState.propsCache.get("columnSizing")),
|
|
845
|
+
columnTypes: (columnTypes) => toMap(columnTypes, setupState.propsCache.get("columnTypes")),
|
|
851
846
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
852
|
-
columnGroups: (columnGroups) => columnGroups
|
|
847
|
+
columnGroups: (columnGroups) => toMap(columnGroups, setupState.propsCache.get("columnGroups"))
|
|
853
848
|
};
|
|
854
849
|
};
|
|
855
850
|
function getGroupRenderStrategy(options) {
|
|
@@ -1224,11 +1219,11 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
1224
1219
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
1225
1220
|
var logError = err("getComputedVisibleColumns");
|
|
1226
1221
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
1227
|
-
return
|
|
1222
|
+
return columnVisibility[colId] !== false;
|
|
1228
1223
|
};
|
|
1229
1224
|
var getComputedPinned = (colId, columnPinning) => {
|
|
1230
1225
|
const pinned = columnPinning.get(colId);
|
|
1231
|
-
const computedPinned = pinned === "start"
|
|
1226
|
+
const computedPinned = pinned === "start" ? "start" : pinned === "end" ? "end" : false;
|
|
1232
1227
|
return computedPinned;
|
|
1233
1228
|
};
|
|
1234
1229
|
var getComputedVisibleColumns = ({
|
|
@@ -1260,7 +1255,8 @@ var getComputedVisibleColumns = ({
|
|
|
1260
1255
|
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
1261
1256
|
return false;
|
|
1262
1257
|
}
|
|
1263
|
-
|
|
1258
|
+
const result2 = isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
|
|
1259
|
+
return result2;
|
|
1264
1260
|
});
|
|
1265
1261
|
const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
|
|
1266
1262
|
const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
|
|
@@ -1289,7 +1285,10 @@ var getComputedVisibleColumns = ({
|
|
|
1289
1285
|
width: colType == null ? void 0 : colType.defaultWidth,
|
|
1290
1286
|
flex: colType == null ? void 0 : colType.defaultFlex
|
|
1291
1287
|
};
|
|
1292
|
-
let colSizing = columnSizing.get(colId) || {
|
|
1288
|
+
let colSizing = columnSizing.get(colId) || {
|
|
1289
|
+
width: column == null ? void 0 : column.defaultWidth,
|
|
1290
|
+
flex: column == null ? void 0 : column.defaultFlex
|
|
1291
|
+
};
|
|
1293
1292
|
if (colSizing.width != null) {
|
|
1294
1293
|
delete colTypeSizing.flex;
|
|
1295
1294
|
}
|
|
@@ -1576,7 +1575,6 @@ var useComputedVisibleColumns = ({
|
|
|
1576
1575
|
const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
|
|
1577
1576
|
const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
|
|
1578
1577
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
1579
|
-
const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
|
|
1580
1578
|
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
1581
1579
|
const {
|
|
1582
1580
|
computedRemainingSpace,
|
|
@@ -1632,7 +1630,6 @@ var useComputedVisibleColumns = ({
|
|
|
1632
1630
|
pinnedStartMaxWidth,
|
|
1633
1631
|
columnPinning,
|
|
1634
1632
|
columnsRenderId,
|
|
1635
|
-
visibilityRenderId,
|
|
1636
1633
|
columnsSizingRenderId,
|
|
1637
1634
|
pinningRenderId,
|
|
1638
1635
|
columnTypesRenderId
|
|
@@ -1657,11 +1654,11 @@ var useComputedVisibleColumns = ({
|
|
|
1657
1654
|
return result;
|
|
1658
1655
|
};
|
|
1659
1656
|
|
|
1660
|
-
// src/utils/sortAscending.ts
|
|
1657
|
+
// src/utils/DeepMap/sortAscending.ts
|
|
1661
1658
|
var sortAscending = (a, b) => a - b;
|
|
1662
1659
|
|
|
1663
1660
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
1664
|
-
var
|
|
1661
|
+
var import_react18 = __toModule(require("react"));
|
|
1665
1662
|
|
|
1666
1663
|
// src/components/hooks/useComponentState.tsx
|
|
1667
1664
|
var React2 = __toModule(require("react"));
|
|
@@ -1753,9 +1750,14 @@ function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward
|
|
|
1753
1750
|
if (currentValue === value) {
|
|
1754
1751
|
return;
|
|
1755
1752
|
}
|
|
1756
|
-
|
|
1753
|
+
let notifyTheChange = true;
|
|
1757
1754
|
if (interceptedActions && typeof interceptedActions[key] === "function") {
|
|
1758
|
-
interceptedActions[key](value, { actions, state: state2 })
|
|
1755
|
+
if (interceptedActions[key](value, { actions, state: state2 }) === false) {
|
|
1756
|
+
notifyTheChange = false;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
if (notifyTheChange) {
|
|
1760
|
+
notifyChange(props, stateKey, value);
|
|
1759
1761
|
}
|
|
1760
1762
|
const forwardFn = propsToForward[key];
|
|
1761
1763
|
if (typeof forwardFn === "function") {
|
|
@@ -1833,9 +1835,12 @@ function getComponentStateRoot(config) {
|
|
|
1833
1835
|
const getProps = useLatest(props);
|
|
1834
1836
|
const theReducer = (previousState, action) => {
|
|
1835
1837
|
var _a2;
|
|
1838
|
+
if (action.type === "REPLACE_STATE") {
|
|
1839
|
+
return action.payload;
|
|
1840
|
+
}
|
|
1836
1841
|
const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
|
|
1837
1842
|
const mappedState = action.payload.mappedState;
|
|
1838
|
-
const updatedProps = action.payload.
|
|
1843
|
+
const updatedProps = action.payload.updatedPropsToState;
|
|
1839
1844
|
const newState = Object.assign({}, previousState);
|
|
1840
1845
|
if (mappedState) {
|
|
1841
1846
|
Object.assign(newState, mappedState);
|
|
@@ -1889,8 +1894,9 @@ function getComponentStateRoot(config) {
|
|
|
1889
1894
|
const currentProps = props;
|
|
1890
1895
|
const newMappedState = {};
|
|
1891
1896
|
let newMappedStateCount = 0;
|
|
1892
|
-
const
|
|
1893
|
-
let
|
|
1897
|
+
const updatedPropsToState = {};
|
|
1898
|
+
let updatedPropsToStateCount = 0;
|
|
1899
|
+
const rawUpdatedProps = {};
|
|
1894
1900
|
for (var k in props) {
|
|
1895
1901
|
const key = k;
|
|
1896
1902
|
const oldValue = prevProps[key];
|
|
@@ -1901,6 +1907,7 @@ function getComponentStateRoot(config) {
|
|
|
1901
1907
|
if (oldValue === newValue) {
|
|
1902
1908
|
continue;
|
|
1903
1909
|
}
|
|
1910
|
+
rawUpdatedProps[key] = { newValue, oldValue };
|
|
1904
1911
|
if (isControlled(key, props) || isControlled(key, prevProps)) {
|
|
1905
1912
|
if (propsToForward.hasOwnProperty(k)) {
|
|
1906
1913
|
let valueToSet = newValue;
|
|
@@ -1913,22 +1920,30 @@ function getComponentStateRoot(config) {
|
|
|
1913
1920
|
newMappedStateCount++;
|
|
1914
1921
|
}
|
|
1915
1922
|
} else if (propsToStateSetRef.current.has(k)) {
|
|
1916
|
-
|
|
1917
|
-
|
|
1923
|
+
updatedPropsToState[key] = currentProps[key];
|
|
1924
|
+
updatedPropsToStateCount++;
|
|
1918
1925
|
}
|
|
1919
1926
|
}
|
|
1920
1927
|
}
|
|
1921
|
-
if (
|
|
1928
|
+
if (updatedPropsToStateCount > 0 || newMappedStateCount > 0) {
|
|
1922
1929
|
debug2("Triggered by new values for the following props", ...[
|
|
1923
1930
|
...Object.keys(newMappedState != null ? newMappedState : {}),
|
|
1924
|
-
...Object.keys(
|
|
1931
|
+
...Object.keys(updatedPropsToState != null ? updatedPropsToState : {})
|
|
1925
1932
|
]);
|
|
1926
|
-
|
|
1933
|
+
const action = {
|
|
1927
1934
|
payload: {
|
|
1928
1935
|
mappedState: newMappedStateCount ? newMappedState : null,
|
|
1929
|
-
|
|
1936
|
+
updatedPropsToState: updatedPropsToStateCount ? updatedPropsToState : null
|
|
1930
1937
|
}
|
|
1931
|
-
}
|
|
1938
|
+
};
|
|
1939
|
+
dispatch(action);
|
|
1940
|
+
if (config.onPropChange) {
|
|
1941
|
+
for (var prop in rawUpdatedProps)
|
|
1942
|
+
if (rawUpdatedProps.hasOwnProperty(prop)) {
|
|
1943
|
+
const { newValue, oldValue } = rawUpdatedProps[prop];
|
|
1944
|
+
config.onPropChange({ name: prop, newValue, oldValue }, props, actions);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1932
1947
|
}
|
|
1933
1948
|
});
|
|
1934
1949
|
return /* @__PURE__ */ React2.createElement(Context.Provider, {
|
|
@@ -1996,35 +2011,38 @@ function useColumnGroups() {
|
|
|
1996
2011
|
return interceptMap(collapsedColumnGroups, {
|
|
1997
2012
|
set: (key, visibleCol) => {
|
|
1998
2013
|
const colIds = key.slice(1);
|
|
1999
|
-
const
|
|
2014
|
+
const columnVisibility = __spreadValues({}, getComponentState().columnVisibility);
|
|
2000
2015
|
colIds.forEach((colId) => {
|
|
2001
|
-
columnVisibility
|
|
2016
|
+
columnVisibility[colId] = false;
|
|
2002
2017
|
});
|
|
2003
|
-
columnVisibility
|
|
2018
|
+
delete columnVisibility[visibleCol];
|
|
2019
|
+
componentActions.columnVisibility = columnVisibility;
|
|
2004
2020
|
},
|
|
2005
2021
|
beforeClear: (currentCollapsedGroups) => {
|
|
2006
|
-
const
|
|
2022
|
+
const columnVisibility = __spreadValues({}, getComponentState().columnVisibility);
|
|
2007
2023
|
const keys = [...currentCollapsedGroups.keys()];
|
|
2008
2024
|
keys.forEach((key) => {
|
|
2009
2025
|
const colIds = key.slice(1);
|
|
2010
2026
|
colIds.forEach((colId) => {
|
|
2011
|
-
columnVisibility
|
|
2027
|
+
delete columnVisibility[colId];
|
|
2012
2028
|
});
|
|
2013
2029
|
});
|
|
2030
|
+
componentActions.columnVisibility = columnVisibility;
|
|
2014
2031
|
},
|
|
2015
2032
|
delete: (key) => {
|
|
2016
|
-
const
|
|
2033
|
+
const columnVisibility = __spreadValues({}, getComponentState().columnVisibility);
|
|
2017
2034
|
const colIds = key.slice(1);
|
|
2018
2035
|
colIds.forEach((colId) => {
|
|
2019
|
-
columnVisibility
|
|
2036
|
+
delete columnVisibility[colId];
|
|
2020
2037
|
});
|
|
2038
|
+
componentActions.columnVisibility = columnVisibility;
|
|
2021
2039
|
}
|
|
2022
2040
|
});
|
|
2023
2041
|
}, [collapsedColumnGroups]);
|
|
2024
2042
|
}
|
|
2025
2043
|
|
|
2026
2044
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
2027
|
-
var
|
|
2045
|
+
var import_react17 = __toModule(require("react"));
|
|
2028
2046
|
|
|
2029
2047
|
// src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
|
|
2030
2048
|
var React6 = __toModule(require("react"));
|
|
@@ -2279,7 +2297,7 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
2279
2297
|
}
|
|
2280
2298
|
|
|
2281
2299
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
2282
|
-
var
|
|
2300
|
+
var import_react16 = __toModule(require("react"));
|
|
2283
2301
|
|
|
2284
2302
|
// src/components/DataSource/index.tsx
|
|
2285
2303
|
var React8 = __toModule(require("react"));
|
|
@@ -2361,188 +2379,7 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
2361
2379
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2362
2380
|
var import_react15 = __toModule(require("react"));
|
|
2363
2381
|
|
|
2364
|
-
// src/
|
|
2365
|
-
var import_react14 = __toModule(require("react"));
|
|
2366
|
-
function useEffectWithChanges(fn, deps) {
|
|
2367
|
-
const prevRef = (0, import_react14.useRef)({});
|
|
2368
|
-
const oldValuesRef = (0, import_react14.useRef)({});
|
|
2369
|
-
const oldValues = oldValuesRef.current;
|
|
2370
|
-
const changesRef = (0, import_react14.useRef)({});
|
|
2371
|
-
const changes = changesRef.current;
|
|
2372
|
-
const useEffectDeps = [];
|
|
2373
|
-
for (let k in deps) {
|
|
2374
|
-
if (deps.hasOwnProperty(k)) {
|
|
2375
|
-
if (deps[k] !== prevRef.current[k]) {
|
|
2376
|
-
changes[k] = deps[k];
|
|
2377
|
-
oldValues[k] = prevRef.current[k];
|
|
2378
|
-
}
|
|
2379
|
-
useEffectDeps.push(deps[k]);
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
prevRef.current = deps;
|
|
2383
|
-
(0, import_react14.useEffect)(() => {
|
|
2384
|
-
const changes2 = changesRef.current;
|
|
2385
|
-
const result = fn(changes2, oldValues);
|
|
2386
|
-
changesRef.current = {};
|
|
2387
|
-
oldValuesRef.current = {};
|
|
2388
|
-
return result;
|
|
2389
|
-
}, useEffectDeps);
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
2393
|
-
var debug3 = dbg("DataSource:useLoadData");
|
|
2394
|
-
function anonimizeValues(arg) {
|
|
2395
|
-
const result = {};
|
|
2396
|
-
for (var k in arg)
|
|
2397
|
-
if (arg.hasOwnProperty(k)) {
|
|
2398
|
-
result[k] = true;
|
|
2399
|
-
}
|
|
2400
|
-
return result;
|
|
2401
|
-
}
|
|
2402
|
-
function buildDataSourceDataParams(componentState, changes) {
|
|
2403
|
-
var _a, _b;
|
|
2404
|
-
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
2405
|
-
const dataSourceParams = {
|
|
2406
|
-
originalDataArray: componentState.originalDataArray,
|
|
2407
|
-
sortInfo,
|
|
2408
|
-
groupBy: componentState.groupBy,
|
|
2409
|
-
pivotBy: componentState.pivotBy
|
|
2410
|
-
};
|
|
2411
|
-
if (componentState.livePagination !== void 0) {
|
|
2412
|
-
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
2413
|
-
}
|
|
2414
|
-
if (changes !== void 0) {
|
|
2415
|
-
dataSourceParams.changes = changes;
|
|
2416
|
-
}
|
|
2417
|
-
return dataSourceParams;
|
|
2418
|
-
}
|
|
2419
|
-
function notifyDataParamsChanged(componentState, actions, changes) {
|
|
2420
|
-
var _a;
|
|
2421
|
-
if (typeof componentState.data === "function") {
|
|
2422
|
-
loadData(componentState.data, componentState, actions);
|
|
2423
|
-
}
|
|
2424
|
-
const dataParams = buildDataSourceDataParams(componentState, changes);
|
|
2425
|
-
(_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
|
|
2426
|
-
}
|
|
2427
|
-
function loadData(data, componentState, actions) {
|
|
2428
|
-
const dataParams = buildDataSourceDataParams(componentState);
|
|
2429
|
-
if (typeof data === "function") {
|
|
2430
|
-
data = data(dataParams);
|
|
2431
|
-
}
|
|
2432
|
-
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
2433
|
-
if (dataIsPromise) {
|
|
2434
|
-
actions.loading = true;
|
|
2435
|
-
}
|
|
2436
|
-
Promise.resolve(data).then((dataParam) => {
|
|
2437
|
-
let dataArray = [];
|
|
2438
|
-
if (Array.isArray(dataParam.data)) {
|
|
2439
|
-
const remoteData = dataParam;
|
|
2440
|
-
dataArray = remoteData.data;
|
|
2441
|
-
if (remoteData.livePaginationCursor !== void 0) {
|
|
2442
|
-
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
2443
|
-
}
|
|
2444
|
-
} else {
|
|
2445
|
-
dataArray = dataParam;
|
|
2446
|
-
}
|
|
2447
|
-
actions.originalDataArray = dataArray;
|
|
2448
|
-
if (dataIsPromise) {
|
|
2449
|
-
actions.loading = false;
|
|
2450
|
-
}
|
|
2451
|
-
});
|
|
2452
|
-
}
|
|
2453
|
-
function useLoadData() {
|
|
2454
|
-
const {
|
|
2455
|
-
getComponentState,
|
|
2456
|
-
componentActions: actions,
|
|
2457
|
-
componentState: { data }
|
|
2458
|
-
} = useComponentState();
|
|
2459
|
-
(0, import_react15.useLayoutEffect)(() => {
|
|
2460
|
-
loadData(data, getComponentState(), actions);
|
|
2461
|
-
}, [data]);
|
|
2462
|
-
useLivePagination();
|
|
2463
|
-
}
|
|
2464
|
-
function useLivePagination() {
|
|
2465
|
-
const {
|
|
2466
|
-
getComponentState,
|
|
2467
|
-
componentActions: actions,
|
|
2468
|
-
componentState
|
|
2469
|
-
} = useComponentState();
|
|
2470
|
-
const {
|
|
2471
|
-
notifyScrollbarsChange,
|
|
2472
|
-
sortInfo,
|
|
2473
|
-
groupBy,
|
|
2474
|
-
pivotBy,
|
|
2475
|
-
livePaginationCursor,
|
|
2476
|
-
scrollBottomId
|
|
2477
|
-
} = componentState;
|
|
2478
|
-
const [scrollbars, setScrollbars] = (0, import_react15.useState)({
|
|
2479
|
-
vertical: false,
|
|
2480
|
-
horizontal: false
|
|
2481
|
-
});
|
|
2482
|
-
const scrollbarsRef = (0, import_react15.useRef)(scrollbars);
|
|
2483
|
-
(0, import_react15.useEffect)(() => {
|
|
2484
|
-
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
2485
|
-
if (!scrollbars2) {
|
|
2486
|
-
return;
|
|
2487
|
-
}
|
|
2488
|
-
scrollbarsRef.current = scrollbars2;
|
|
2489
|
-
setScrollbars(scrollbars2);
|
|
2490
|
-
});
|
|
2491
|
-
return () => notifyScrollbarsChange.destroy();
|
|
2492
|
-
}, [notifyScrollbarsChange]);
|
|
2493
|
-
const [cursorId, updateCursorId] = (0, import_react15.useState)(void 0);
|
|
2494
|
-
(0, import_react15.useEffect)(() => {
|
|
2495
|
-
const frameId = requestAnimationFrame(() => {
|
|
2496
|
-
var _a;
|
|
2497
|
-
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
|
|
2498
|
-
updateCursorId(livePaginationCursor);
|
|
2499
|
-
}
|
|
2500
|
-
});
|
|
2501
|
-
return () => cancelAnimationFrame(frameId);
|
|
2502
|
-
}, [livePaginationCursor]);
|
|
2503
|
-
(0, import_react15.useEffect)(() => {
|
|
2504
|
-
const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
|
|
2505
|
-
if (!scrollbars.vertical && livePagination) {
|
|
2506
|
-
updateCursorId(livePaginationCursor2);
|
|
2507
|
-
}
|
|
2508
|
-
}, [scrollbars.vertical]);
|
|
2509
|
-
(0, import_react15.useEffect)(() => {
|
|
2510
|
-
updateCursorId(scrollBottomId);
|
|
2511
|
-
}, [scrollBottomId]);
|
|
2512
|
-
const depsObject = {
|
|
2513
|
-
sortInfo,
|
|
2514
|
-
groupBy,
|
|
2515
|
-
pivotBy,
|
|
2516
|
-
livePaginationCursor: cursorId
|
|
2517
|
-
};
|
|
2518
|
-
useEffectWithChanges((changes, prevValues) => {
|
|
2519
|
-
if (cursorId === void 0) {
|
|
2520
|
-
return;
|
|
2521
|
-
}
|
|
2522
|
-
debug3("onDataParamsChange triggered because the following values have changed", changes, "old values", prevValues);
|
|
2523
|
-
notifyDataParamsChanged(getComponentState(), actions, anonimizeValues(changes));
|
|
2524
|
-
}, depsObject);
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
2528
|
-
var EMPTY_ARRAY = Object.freeze([]);
|
|
2529
|
-
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
2530
|
-
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
2531
|
-
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
2532
|
-
if (weakMap && weakMap.has(sortInfo)) {
|
|
2533
|
-
const prevResult = weakMap.get(sortInfo);
|
|
2534
|
-
if (prevResult && prevResult.length === result.length) {
|
|
2535
|
-
return prevResult;
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
if (weakMap && sortInfo) {
|
|
2539
|
-
weakMap.set(sortInfo, result);
|
|
2540
|
-
}
|
|
2541
|
-
return result;
|
|
2542
|
-
};
|
|
2543
|
-
|
|
2544
|
-
// src/components/hooks/useOnce.ts
|
|
2545
|
-
var import_react16 = __toModule(require("react"));
|
|
2382
|
+
// src/utils/DeepMap/once.ts
|
|
2546
2383
|
function once(fn) {
|
|
2547
2384
|
let called = false;
|
|
2548
2385
|
let result = null;
|
|
@@ -2556,14 +2393,8 @@ function once(fn) {
|
|
|
2556
2393
|
};
|
|
2557
2394
|
return onceFn;
|
|
2558
2395
|
}
|
|
2559
|
-
function useOnce(fn) {
|
|
2560
|
-
const onceFn = (0, import_react16.useMemo)(() => {
|
|
2561
|
-
return once(fn);
|
|
2562
|
-
}, []);
|
|
2563
|
-
return onceFn();
|
|
2564
|
-
}
|
|
2565
2396
|
|
|
2566
|
-
// src/utils/DeepMap.ts
|
|
2397
|
+
// src/utils/DeepMap/index.ts
|
|
2567
2398
|
var SORT_ASC_REVISION = (p1, p2) => sortAscending(p1.revision, p2.revision);
|
|
2568
2399
|
var DeepMap = class {
|
|
2569
2400
|
constructor(initial) {
|
|
@@ -2815,70 +2646,776 @@ var DeepMap = class {
|
|
|
2815
2646
|
}
|
|
2816
2647
|
};
|
|
2817
2648
|
|
|
2818
|
-
// src/
|
|
2819
|
-
var
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
return {
|
|
2826
|
-
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
2827
|
-
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
2828
|
-
};
|
|
2829
|
-
}
|
|
2830
|
-
destroy() {
|
|
2831
|
-
var _a, _b;
|
|
2832
|
-
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
2833
|
-
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
2834
|
-
delete this.expandedMap;
|
|
2835
|
-
delete this.collapsedMap;
|
|
2649
|
+
// src/utils/groupAndPivot/index.ts
|
|
2650
|
+
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
2651
|
+
function DEFAULT_TO_KEY(value) {
|
|
2652
|
+
return value;
|
|
2653
|
+
}
|
|
2654
|
+
function initReducers(reducers) {
|
|
2655
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
2656
|
+
return {};
|
|
2836
2657
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
this.collapsedAll = collapsedRows === true;
|
|
2842
|
-
this.expandedAll = expandedRows === true;
|
|
2843
|
-
if (this.collapsedAll && this.expandedAll) {
|
|
2844
|
-
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
2845
|
-
}
|
|
2846
|
-
if (collapsedRows !== true) {
|
|
2847
|
-
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
2848
|
-
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
2849
|
-
}
|
|
2850
|
-
if (expandedRows !== true) {
|
|
2851
|
-
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
2852
|
-
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
2658
|
+
const result = {};
|
|
2659
|
+
for (let key in reducers)
|
|
2660
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2661
|
+
result[key] = reducers[key].initialValue;
|
|
2853
2662
|
}
|
|
2663
|
+
return result;
|
|
2664
|
+
}
|
|
2665
|
+
function computeReducersFor(data, reducers, reducerResults) {
|
|
2666
|
+
var _a, _b;
|
|
2667
|
+
if (!reducers || !Object.keys(reducers).length) {
|
|
2668
|
+
return;
|
|
2854
2669
|
}
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
}
|
|
2861
|
-
collapseAll() {
|
|
2862
|
-
this.update({
|
|
2863
|
-
collapsedRows: true,
|
|
2864
|
-
expandedRows: []
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
expandAll() {
|
|
2868
|
-
this.update({
|
|
2869
|
-
expandedRows: true,
|
|
2870
|
-
collapsedRows: []
|
|
2871
|
-
});
|
|
2872
|
-
}
|
|
2873
|
-
isGroupRowExpanded(keys) {
|
|
2874
|
-
var _a, _b;
|
|
2875
|
-
if (this.expandedAll === true) {
|
|
2876
|
-
if (this.collapsedAll === true) {
|
|
2877
|
-
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
2670
|
+
for (let key in reducers)
|
|
2671
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2672
|
+
const reducer = reducers[key];
|
|
2673
|
+
if (typeof reducer.reducer !== "function") {
|
|
2674
|
+
continue;
|
|
2878
2675
|
}
|
|
2879
|
-
|
|
2676
|
+
const currentValue = reducerResults[key];
|
|
2677
|
+
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
2678
|
+
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
2880
2679
|
}
|
|
2881
|
-
|
|
2680
|
+
}
|
|
2681
|
+
function lazyGroup(groupParams, rootData) {
|
|
2682
|
+
const {
|
|
2683
|
+
reducers = {},
|
|
2684
|
+
pivot,
|
|
2685
|
+
groupBy,
|
|
2686
|
+
mappings
|
|
2687
|
+
} = groupParams;
|
|
2688
|
+
const deepMap = new DeepMap();
|
|
2689
|
+
function traverseValues(pivotDeepMap, container, pivot2, pivotIndex = 0, currentPivotKeys2 = []) {
|
|
2690
|
+
const last = pivotIndex === pivot2.length - 1;
|
|
2691
|
+
const values = container[(mappings == null ? void 0 : mappings.values) || "values"] || {};
|
|
2692
|
+
for (var k in values)
|
|
2693
|
+
if (values.hasOwnProperty(k)) {
|
|
2694
|
+
const pivotKey = k;
|
|
2695
|
+
currentPivotKeys2.push(pivotKey);
|
|
2696
|
+
topLevelPivotColumns.set(currentPivotKeys2, true);
|
|
2697
|
+
pivotDeepMap.set(currentPivotKeys2, {
|
|
2698
|
+
reducerResults: values[k][(mappings == null ? void 0 : mappings.totals) || "totals"] || {},
|
|
2699
|
+
items: []
|
|
2700
|
+
});
|
|
2701
|
+
if (!last) {
|
|
2702
|
+
traverseValues(pivotDeepMap, values[k], pivot2, pivotIndex + 1, currentPivotKeys2);
|
|
2703
|
+
}
|
|
2704
|
+
currentPivotKeys2.pop();
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
2708
|
+
let currentPivotKeys = [];
|
|
2709
|
+
const initialReducerValue = initReducers(reducers);
|
|
2710
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2711
|
+
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
2712
|
+
const [_rootKey, ...currentGroupKeys] = keys;
|
|
2713
|
+
const dataArray = lazyGroupRowInfo.items;
|
|
2714
|
+
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
2715
|
+
if (!dataArray[i]) {
|
|
2716
|
+
const deepMapGroupValue2 = {
|
|
2717
|
+
items: [],
|
|
2718
|
+
reducerResults: {}
|
|
2719
|
+
};
|
|
2720
|
+
deepMap.set([...currentGroupKeys, `not-loaded-yet-${i}`], deepMapGroupValue2);
|
|
2721
|
+
continue;
|
|
2722
|
+
}
|
|
2723
|
+
const dataObject = dataArray[i].data;
|
|
2724
|
+
const dataKeys = dataArray[i].keys;
|
|
2725
|
+
let item = dataObject;
|
|
2726
|
+
const { field: groupByProperty } = groupBy[dataKeys.length - 1];
|
|
2727
|
+
const key = item[groupByProperty];
|
|
2728
|
+
currentGroupKeys.push(key);
|
|
2729
|
+
const deepMapGroupValue = {
|
|
2730
|
+
items: [],
|
|
2731
|
+
reducerResults: dataArray[i].aggregations || {}
|
|
2732
|
+
};
|
|
2733
|
+
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
2734
|
+
if (pivot) {
|
|
2735
|
+
const pivotDeepMap = deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
2736
|
+
const pivotContainer = dataArray[i].pivot;
|
|
2737
|
+
traverseValues(pivotDeepMap, pivotContainer, pivot, 0, currentPivotKeys);
|
|
2738
|
+
}
|
|
2739
|
+
currentGroupKeys.pop();
|
|
2740
|
+
}
|
|
2741
|
+
next == null ? void 0 : next();
|
|
2742
|
+
});
|
|
2743
|
+
const result = {
|
|
2744
|
+
deepMap,
|
|
2745
|
+
groupParams,
|
|
2746
|
+
initialData: rootData,
|
|
2747
|
+
reducerResults: globalReducerResults
|
|
2748
|
+
};
|
|
2749
|
+
if (pivot) {
|
|
2750
|
+
result.topLevelPivotColumns = topLevelPivotColumns;
|
|
2751
|
+
result.pivot = pivot;
|
|
2752
|
+
}
|
|
2753
|
+
return result;
|
|
2754
|
+
}
|
|
2755
|
+
function group(groupParams, data) {
|
|
2756
|
+
const {
|
|
2757
|
+
groupBy,
|
|
2758
|
+
defaultToKey = DEFAULT_TO_KEY,
|
|
2759
|
+
pivot,
|
|
2760
|
+
reducers
|
|
2761
|
+
} = groupParams;
|
|
2762
|
+
const groupByLength = groupBy.length;
|
|
2763
|
+
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
2764
|
+
const deepMap = new DeepMap();
|
|
2765
|
+
let currentGroupKeys = [];
|
|
2766
|
+
let currentPivotKeys = [];
|
|
2767
|
+
const initialReducerValue = initReducers(reducers);
|
|
2768
|
+
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
2769
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
|
2770
|
+
let item = data[i];
|
|
2771
|
+
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
2772
|
+
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
2773
|
+
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
2774
|
+
currentGroupKeys.push(key);
|
|
2775
|
+
if (!deepMap.has(currentGroupKeys)) {
|
|
2776
|
+
const deepMapGroupValue = {
|
|
2777
|
+
items: [],
|
|
2778
|
+
reducerResults: __spreadValues({}, initialReducerValue)
|
|
2779
|
+
};
|
|
2780
|
+
if (pivot) {
|
|
2781
|
+
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
2782
|
+
}
|
|
2783
|
+
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
2784
|
+
}
|
|
2785
|
+
const {
|
|
2786
|
+
items: currentGroupItems,
|
|
2787
|
+
reducerResults,
|
|
2788
|
+
pivotDeepMap
|
|
2789
|
+
} = deepMap.get(currentGroupKeys);
|
|
2790
|
+
currentGroupItems.push(item);
|
|
2791
|
+
if (reducers) {
|
|
2792
|
+
computeReducersFor(item, reducers, reducerResults);
|
|
2793
|
+
}
|
|
2794
|
+
if (pivot) {
|
|
2795
|
+
for (let pivotIndex = 0, pivotLength = pivot.length; pivotIndex < pivotLength; pivotIndex++) {
|
|
2796
|
+
const { field: pivotField, toKey: pivotToKey } = pivot[pivotIndex];
|
|
2797
|
+
const pivotKey = (pivotToKey || defaultToKey)(item[pivotField], item);
|
|
2798
|
+
currentPivotKeys.push(pivotKey);
|
|
2799
|
+
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
2800
|
+
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
2801
|
+
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
2802
|
+
reducerResults: __spreadValues({}, initialReducerValue),
|
|
2803
|
+
items: []
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
const {
|
|
2807
|
+
reducerResults: pivotReducerResults,
|
|
2808
|
+
items: pivotGroupItems
|
|
2809
|
+
} = pivotDeepMap.get(currentPivotKeys);
|
|
2810
|
+
pivotGroupItems.push(item);
|
|
2811
|
+
if (reducers) {
|
|
2812
|
+
computeReducersFor(item, reducers, pivotReducerResults);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
currentPivotKeys.length = 0;
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
if (reducers) {
|
|
2819
|
+
computeReducersFor(item, reducers, globalReducerResults);
|
|
2820
|
+
}
|
|
2821
|
+
currentGroupKeys.length = 0;
|
|
2822
|
+
}
|
|
2823
|
+
if (reducers) {
|
|
2824
|
+
deepMap.visitDepthFirst((deepMapValue, _keys, _indexInGroup, next) => {
|
|
2825
|
+
completeReducers(reducers, deepMapValue.reducerResults, deepMapValue.items);
|
|
2826
|
+
if (pivot) {
|
|
2827
|
+
deepMapValue.pivotDeepMap.visitDepthFirst(({ items, reducerResults: pivotReducerResults }, _keys2, _indexInGroup2, next2) => {
|
|
2828
|
+
completeReducers(reducers, pivotReducerResults, items);
|
|
2829
|
+
next2 == null ? void 0 : next2();
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
next == null ? void 0 : next();
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
if (reducers) {
|
|
2836
|
+
completeReducers(reducers, globalReducerResults, data);
|
|
2837
|
+
}
|
|
2838
|
+
const result = {
|
|
2839
|
+
deepMap,
|
|
2840
|
+
groupParams,
|
|
2841
|
+
initialData: data,
|
|
2842
|
+
reducerResults: globalReducerResults
|
|
2843
|
+
};
|
|
2844
|
+
if (pivot) {
|
|
2845
|
+
result.topLevelPivotColumns = topLevelPivotColumns;
|
|
2846
|
+
result.pivot = pivot;
|
|
2847
|
+
}
|
|
2848
|
+
return result;
|
|
2849
|
+
}
|
|
2850
|
+
function flatten(groupResult) {
|
|
2851
|
+
const { groupParams, deepMap } = groupResult;
|
|
2852
|
+
const groupByLength = groupParams.groupBy.length;
|
|
2853
|
+
const result = [];
|
|
2854
|
+
deepMap.topDownKeys().reduce((acc, key) => {
|
|
2855
|
+
if (key.length === groupByLength) {
|
|
2856
|
+
const items = deepMap.get(key).items;
|
|
2857
|
+
acc.push(...items);
|
|
2858
|
+
}
|
|
2859
|
+
return acc;
|
|
2860
|
+
}, result);
|
|
2861
|
+
return result;
|
|
2862
|
+
}
|
|
2863
|
+
function getEnhancedGroupData(options, deepMapValue) {
|
|
2864
|
+
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
2865
|
+
const groupNesting = groupKeys.length;
|
|
2866
|
+
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
2867
|
+
let data = null;
|
|
2868
|
+
if (Object.keys(reducerResults).length > 0) {
|
|
2869
|
+
data = {};
|
|
2870
|
+
for (let key in reducers)
|
|
2871
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2872
|
+
const reducer = reducers[key];
|
|
2873
|
+
const field = reducer.field;
|
|
2874
|
+
if (field) {
|
|
2875
|
+
data[field] = reducerResults[key];
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
const enhancedGroupData = {
|
|
2880
|
+
data,
|
|
2881
|
+
groupCount: groupItems.length,
|
|
2882
|
+
groupData: groupItems,
|
|
2883
|
+
groupKeys,
|
|
2884
|
+
id: groupKeys,
|
|
2885
|
+
collapsed,
|
|
2886
|
+
parents,
|
|
2887
|
+
collapsedChildrenCount: 0,
|
|
2888
|
+
collapsedGroupsCount: 0,
|
|
2889
|
+
indexInParentGroups: options.indexInParentGroups,
|
|
2890
|
+
indexInGroup: options.indexInGroup,
|
|
2891
|
+
indexInAll: options.indexInAll,
|
|
2892
|
+
value: groupKeys[groupKeys.length - 1],
|
|
2893
|
+
rootGroupBy: groupBy,
|
|
2894
|
+
groupBy: groupNesting === groupBy.length ? groupBy : groupBy.slice(0, groupNesting),
|
|
2895
|
+
isGroupRow: true,
|
|
2896
|
+
pivotValuesMap: pivotDeepMap,
|
|
2897
|
+
groupNesting,
|
|
2898
|
+
reducerResults
|
|
2899
|
+
};
|
|
2900
|
+
return enhancedGroupData;
|
|
2901
|
+
}
|
|
2902
|
+
function completeReducers(reducers, reducerResults, items) {
|
|
2903
|
+
if (reducers) {
|
|
2904
|
+
for (let key in reducers)
|
|
2905
|
+
if (reducers.hasOwnProperty(key)) {
|
|
2906
|
+
const reducer = reducers[key];
|
|
2907
|
+
if (reducer.done) {
|
|
2908
|
+
reducerResults[key] = reducer.done(reducerResults[key], items);
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
return reducerResults;
|
|
2913
|
+
}
|
|
2914
|
+
function enhancedFlatten(param) {
|
|
2915
|
+
const {
|
|
2916
|
+
groupResult,
|
|
2917
|
+
toPrimaryKey,
|
|
2918
|
+
groupRowsState,
|
|
2919
|
+
generateGroupRows,
|
|
2920
|
+
reducers = {}
|
|
2921
|
+
} = param;
|
|
2922
|
+
const { groupParams, deepMap, pivot } = groupResult;
|
|
2923
|
+
const { groupBy } = groupParams;
|
|
2924
|
+
const groupByStrings = groupBy.map((g) => g.field);
|
|
2925
|
+
const result = [];
|
|
2926
|
+
const parents = [];
|
|
2927
|
+
const indexInParentGroups = [];
|
|
2928
|
+
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
2929
|
+
var _a;
|
|
2930
|
+
const items = deepMapValue.items;
|
|
2931
|
+
const groupNesting = groupKeys.length;
|
|
2932
|
+
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
2933
|
+
const enhancedGroupData = getEnhancedGroupData({
|
|
2934
|
+
groupBy: groupByStrings,
|
|
2935
|
+
parents: Array.from(parents),
|
|
2936
|
+
reducers,
|
|
2937
|
+
indexInGroup,
|
|
2938
|
+
indexInParentGroups: Array.from(indexInParentGroups),
|
|
2939
|
+
indexInAll: result.length,
|
|
2940
|
+
groupKeys,
|
|
2941
|
+
collapsed
|
|
2942
|
+
}, deepMapValue);
|
|
2943
|
+
const include = generateGroupRows || collapsed;
|
|
2944
|
+
if (include) {
|
|
2945
|
+
result.push(enhancedGroupData);
|
|
2946
|
+
}
|
|
2947
|
+
if (collapsed) {
|
|
2948
|
+
parents.forEach((parent) => {
|
|
2949
|
+
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
2950
|
+
parent.collapsedGroupsCount += 1;
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
indexInParentGroups.push(indexInGroup);
|
|
2954
|
+
parents.push(enhancedGroupData);
|
|
2955
|
+
if (!collapsed) {
|
|
2956
|
+
if (!next) {
|
|
2957
|
+
if (!pivot) {
|
|
2958
|
+
const startIndex = result.length;
|
|
2959
|
+
result.push(...items.map((item, index) => {
|
|
2960
|
+
return {
|
|
2961
|
+
id: toPrimaryKey(item),
|
|
2962
|
+
data: item,
|
|
2963
|
+
isGroupRow: false,
|
|
2964
|
+
collapsed: false,
|
|
2965
|
+
groupKeys,
|
|
2966
|
+
parents: Array.from(parents),
|
|
2967
|
+
indexInParentGroups: [...indexInParentGroups, index],
|
|
2968
|
+
indexInGroup: index,
|
|
2969
|
+
indexInAll: startIndex + index,
|
|
2970
|
+
groupBy: groupByStrings,
|
|
2971
|
+
groupNesting,
|
|
2972
|
+
groupCount: enhancedGroupData.groupCount
|
|
2973
|
+
};
|
|
2974
|
+
}));
|
|
2975
|
+
}
|
|
2976
|
+
} else {
|
|
2977
|
+
next();
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
parents.pop();
|
|
2981
|
+
indexInParentGroups.pop();
|
|
2982
|
+
});
|
|
2983
|
+
return {
|
|
2984
|
+
data: result
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
// src/components/hooks/useEffectWithChanges.ts
|
|
2989
|
+
var import_react14 = __toModule(require("react"));
|
|
2990
|
+
function useEffectWithChanges(fn, deps) {
|
|
2991
|
+
const prevRef = (0, import_react14.useRef)({});
|
|
2992
|
+
const oldValuesRef = (0, import_react14.useRef)({});
|
|
2993
|
+
const oldValues = oldValuesRef.current;
|
|
2994
|
+
const changesRef = (0, import_react14.useRef)({});
|
|
2995
|
+
const changes = changesRef.current;
|
|
2996
|
+
const useEffectDeps = [];
|
|
2997
|
+
for (let k in deps) {
|
|
2998
|
+
if (deps.hasOwnProperty(k)) {
|
|
2999
|
+
if (deps[k] !== prevRef.current[k]) {
|
|
3000
|
+
changes[k] = deps[k];
|
|
3001
|
+
oldValues[k] = prevRef.current[k];
|
|
3002
|
+
}
|
|
3003
|
+
useEffectDeps.push(deps[k]);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
prevRef.current = deps;
|
|
3007
|
+
(0, import_react14.useEffect)(() => {
|
|
3008
|
+
const changes2 = changesRef.current;
|
|
3009
|
+
const result = fn(changes2, oldValues);
|
|
3010
|
+
changesRef.current = {};
|
|
3011
|
+
oldValuesRef.current = {};
|
|
3012
|
+
return result;
|
|
3013
|
+
}, useEffectDeps);
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
// src/components/utils/debounce.ts
|
|
3017
|
+
function debounce(fn, { wait }) {
|
|
3018
|
+
let timeout = null;
|
|
3019
|
+
return function(...args) {
|
|
3020
|
+
const context = this;
|
|
3021
|
+
if (timeout !== null) {
|
|
3022
|
+
clearTimeout(timeout);
|
|
3023
|
+
}
|
|
3024
|
+
timeout = setTimeout(() => {
|
|
3025
|
+
fn.apply(context, args);
|
|
3026
|
+
}, wait);
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
3031
|
+
var getRafPromise = () => new Promise((resolve) => {
|
|
3032
|
+
requestAnimationFrame(resolve);
|
|
3033
|
+
});
|
|
3034
|
+
var SKIP_DATA_CHANGES_KEYS = {
|
|
3035
|
+
originalDataArray: true,
|
|
3036
|
+
changes: true
|
|
3037
|
+
};
|
|
3038
|
+
function getChangeDetect() {
|
|
3039
|
+
var _a;
|
|
3040
|
+
const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
|
|
3041
|
+
return `${Date.now()}:${perfNow}`;
|
|
3042
|
+
}
|
|
3043
|
+
function buildDataSourceDataParams(componentState, overrides) {
|
|
3044
|
+
var _a, _b;
|
|
3045
|
+
const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
3046
|
+
const dataSourceParams = {
|
|
3047
|
+
originalDataArray: componentState.originalDataArray,
|
|
3048
|
+
sortInfo,
|
|
3049
|
+
groupBy: componentState.groupBy,
|
|
3050
|
+
pivotBy: componentState.pivotBy,
|
|
3051
|
+
aggregationReducers: componentState.aggregationReducers
|
|
3052
|
+
};
|
|
3053
|
+
if (componentState.livePagination !== void 0) {
|
|
3054
|
+
dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
|
|
3055
|
+
dataSourceParams.cursorId = componentState.cursorId;
|
|
3056
|
+
}
|
|
3057
|
+
if (componentState.fullLazyLoad) {
|
|
3058
|
+
if (componentState.lazyLoadBatchSize != null && componentState.lazyLoadBatchSize > 0) {
|
|
3059
|
+
dataSourceParams.lazyLoadBatchSize = componentState.lazyLoadBatchSize;
|
|
3060
|
+
dataSourceParams.lazyLoadStartIndex = 0;
|
|
3061
|
+
}
|
|
3062
|
+
dataSourceParams.groupKeys = [];
|
|
3063
|
+
}
|
|
3064
|
+
if (overrides) {
|
|
3065
|
+
Object.assign(dataSourceParams, overrides);
|
|
3066
|
+
}
|
|
3067
|
+
const changes = {};
|
|
3068
|
+
const oldDataSourceParams = componentState.dataParams || {};
|
|
3069
|
+
for (let k in dataSourceParams) {
|
|
3070
|
+
if (dataSourceParams.hasOwnProperty(k) && !SKIP_DATA_CHANGES_KEYS[k]) {
|
|
3071
|
+
const key = k;
|
|
3072
|
+
if (dataSourceParams[key] !== oldDataSourceParams[key]) {
|
|
3073
|
+
changes[key] = true;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
dataSourceParams.changes = changes;
|
|
3078
|
+
return dataSourceParams;
|
|
3079
|
+
}
|
|
3080
|
+
function loadData(data, componentState, actions, overrides) {
|
|
3081
|
+
const dataParams = buildDataSourceDataParams(componentState, overrides);
|
|
3082
|
+
if (typeof data === "function") {
|
|
3083
|
+
data = data(dataParams);
|
|
3084
|
+
}
|
|
3085
|
+
const dataIsPromise = typeof data === "object" && typeof data.then === "function";
|
|
3086
|
+
if (dataIsPromise && !componentState.fullLazyLoad) {
|
|
3087
|
+
actions.loading = true;
|
|
3088
|
+
}
|
|
3089
|
+
return Promise.resolve(data).then((dataParam) => {
|
|
3090
|
+
var _a, _b, _c;
|
|
3091
|
+
let dataArray = [];
|
|
3092
|
+
let skipAssign = false;
|
|
3093
|
+
if (Array.isArray(dataParam.data)) {
|
|
3094
|
+
const remoteData = dataParam;
|
|
3095
|
+
dataArray = remoteData.data;
|
|
3096
|
+
if (remoteData.livePaginationCursor !== void 0) {
|
|
3097
|
+
actions.livePaginationCursor = remoteData.livePaginationCursor;
|
|
3098
|
+
}
|
|
3099
|
+
if (remoteData.mappings) {
|
|
3100
|
+
actions.pivotMappings = remoteData.mappings;
|
|
3101
|
+
}
|
|
3102
|
+
if (componentState.fullLazyLoad && dataParams.groupKeys) {
|
|
3103
|
+
const lazyGroupData = componentState.originalLazyGroupData;
|
|
3104
|
+
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys];
|
|
3105
|
+
const newGroupRowInfo = {
|
|
3106
|
+
totalCount: (_a = remoteData.totalCount) != null ? _a : dataArray.length,
|
|
3107
|
+
items: dataArray
|
|
3108
|
+
};
|
|
3109
|
+
if (dataParams.lazyLoadBatchSize) {
|
|
3110
|
+
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
3111
|
+
const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
|
|
3112
|
+
items: [],
|
|
3113
|
+
totalCount: newGroupRowInfo.totalCount
|
|
3114
|
+
};
|
|
3115
|
+
currentGroupRowInfo.items.length = currentGroupRowInfo.totalCount;
|
|
3116
|
+
const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
|
|
3117
|
+
const end = Math.min((_c = remoteData.totalCount) != null ? _c : start + dataParams.lazyLoadBatchSize);
|
|
3118
|
+
for (let i = start; i < end; i++) {
|
|
3119
|
+
currentGroupRowInfo.items[i] = newGroupRowInfo.items[i - start];
|
|
3120
|
+
}
|
|
3121
|
+
if (!existingGroupRowInfo) {
|
|
3122
|
+
lazyGroupData.set(key, currentGroupRowInfo);
|
|
3123
|
+
}
|
|
3124
|
+
} else {
|
|
3125
|
+
lazyGroupData.set(key, newGroupRowInfo);
|
|
3126
|
+
}
|
|
3127
|
+
skipAssign = true;
|
|
3128
|
+
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
3129
|
+
}
|
|
3130
|
+
} else {
|
|
3131
|
+
dataArray = dataParam;
|
|
3132
|
+
}
|
|
3133
|
+
if (!skipAssign) {
|
|
3134
|
+
actions.originalDataArray = dataArray;
|
|
3135
|
+
}
|
|
3136
|
+
if (dataIsPromise && !componentState.fullLazyLoad) {
|
|
3137
|
+
actions.loading = false;
|
|
3138
|
+
}
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
function useLoadData() {
|
|
3142
|
+
const {
|
|
3143
|
+
getComponentState,
|
|
3144
|
+
componentActions: actions,
|
|
3145
|
+
componentState
|
|
3146
|
+
} = useComponentState();
|
|
3147
|
+
const {
|
|
3148
|
+
data,
|
|
3149
|
+
notifyScrollbarsChange,
|
|
3150
|
+
sortInfo,
|
|
3151
|
+
groupBy,
|
|
3152
|
+
pivotBy,
|
|
3153
|
+
livePagination,
|
|
3154
|
+
livePaginationCursor,
|
|
3155
|
+
cursorId: stateCursorId
|
|
3156
|
+
} = componentState;
|
|
3157
|
+
const [scrollbars, setScrollbars] = (0, import_react15.useState)({
|
|
3158
|
+
vertical: false,
|
|
3159
|
+
horizontal: false
|
|
3160
|
+
});
|
|
3161
|
+
const scrollbarsRef = (0, import_react15.useRef)(scrollbars);
|
|
3162
|
+
(0, import_react15.useEffect)(() => {
|
|
3163
|
+
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
3164
|
+
if (!scrollbars2) {
|
|
3165
|
+
return;
|
|
3166
|
+
}
|
|
3167
|
+
scrollbarsRef.current = scrollbars2;
|
|
3168
|
+
setScrollbars(scrollbars2);
|
|
3169
|
+
});
|
|
3170
|
+
return () => notifyScrollbarsChange.destroy();
|
|
3171
|
+
}, [notifyScrollbarsChange]);
|
|
3172
|
+
(0, import_react15.useEffect)(() => {
|
|
3173
|
+
const frameId = requestAnimationFrame(() => {
|
|
3174
|
+
var _a;
|
|
3175
|
+
if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical) && livePaginationCursor) {
|
|
3176
|
+
actions.cursorId = livePaginationCursor;
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
3179
|
+
return () => cancelAnimationFrame(frameId);
|
|
3180
|
+
}, [livePaginationCursor]);
|
|
3181
|
+
(0, import_react15.useEffect)(() => {
|
|
3182
|
+
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2 } = getComponentState();
|
|
3183
|
+
if (!scrollbars.vertical && livePagination2) {
|
|
3184
|
+
if (livePaginationCursor2) {
|
|
3185
|
+
actions.cursorId = livePaginationCursor2;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
}, [scrollbars.vertical]);
|
|
3189
|
+
const depsObject = {
|
|
3190
|
+
sortInfo,
|
|
3191
|
+
groupBy,
|
|
3192
|
+
pivotBy,
|
|
3193
|
+
cursorId: livePagination ? stateCursorId : null
|
|
3194
|
+
};
|
|
3195
|
+
const initialRef = (0, import_react15.useRef)(true);
|
|
3196
|
+
useLazyLoadRange();
|
|
3197
|
+
useEffectWithChanges(() => {
|
|
3198
|
+
const componentState2 = getComponentState();
|
|
3199
|
+
if (typeof componentState2.data !== "function") {
|
|
3200
|
+
loadData(componentState2.data, componentState2, actions);
|
|
3201
|
+
}
|
|
3202
|
+
}, { data });
|
|
3203
|
+
useEffectWithChanges(() => {
|
|
3204
|
+
const componentState2 = getComponentState();
|
|
3205
|
+
if (typeof componentState2.data === "function") {
|
|
3206
|
+
loadData(componentState2.data, componentState2, actions);
|
|
3207
|
+
}
|
|
3208
|
+
}, __spreadProps(__spreadValues({}, depsObject), { data }));
|
|
3209
|
+
useEffectWithChanges((_changes, _prevValues) => {
|
|
3210
|
+
const componentState2 = getComponentState();
|
|
3211
|
+
if (initialRef.current) {
|
|
3212
|
+
initialRef.current = false;
|
|
3213
|
+
actions.dataParams = buildDataSourceDataParams(componentState2);
|
|
3214
|
+
}
|
|
3215
|
+
}, depsObject);
|
|
3216
|
+
}
|
|
3217
|
+
function useLazyLoadRange() {
|
|
3218
|
+
const {
|
|
3219
|
+
getComponentState,
|
|
3220
|
+
componentActions: actions,
|
|
3221
|
+
componentState
|
|
3222
|
+
} = useComponentState();
|
|
3223
|
+
const loadingCache = (0, import_react15.useMemo)(() => {
|
|
3224
|
+
return new Map();
|
|
3225
|
+
}, [componentState.data]);
|
|
3226
|
+
globalThis.loadingCache = loadingCache;
|
|
3227
|
+
const {
|
|
3228
|
+
lazyLoadBatchSize,
|
|
3229
|
+
notifyRenderRangeChange,
|
|
3230
|
+
dataArray,
|
|
3231
|
+
scrollStopDelayUpdatedByTable
|
|
3232
|
+
} = componentState;
|
|
3233
|
+
const latestRenderRangeRef = (0, import_react15.useRef)(null);
|
|
3234
|
+
const loadRange = (param, cache = loadingCache) => {
|
|
3235
|
+
const componentState2 = getComponentState();
|
|
3236
|
+
param = param || latestRenderRangeRef.current;
|
|
3237
|
+
if (!param) {
|
|
3238
|
+
return;
|
|
3239
|
+
}
|
|
3240
|
+
const { renderStartIndex: startIndex, renderEndIndex: endIndex } = param;
|
|
3241
|
+
if (!lazyLoadBatchSize || lazyLoadBatchSize <= 0) {
|
|
3242
|
+
return;
|
|
3243
|
+
}
|
|
3244
|
+
lazyLoadRange({
|
|
3245
|
+
startIndex,
|
|
3246
|
+
endIndex,
|
|
3247
|
+
lazyLoadBatchSize,
|
|
3248
|
+
componentState: componentState2,
|
|
3249
|
+
componentActions: actions
|
|
3250
|
+
}, cache);
|
|
3251
|
+
};
|
|
3252
|
+
const debouncedLoadRange = (0, import_react15.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
3253
|
+
(0, import_react15.useEffect)(() => {
|
|
3254
|
+
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
3255
|
+
return notifyRenderRangeChange.onChange((param) => {
|
|
3256
|
+
latestRenderRangeRef.current = param;
|
|
3257
|
+
loadRange(param, loadingCache);
|
|
3258
|
+
});
|
|
3259
|
+
}
|
|
3260
|
+
return;
|
|
3261
|
+
}, [lazyLoadBatchSize, loadingCache]);
|
|
3262
|
+
(0, import_react15.useEffect)(() => {
|
|
3263
|
+
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
3264
|
+
debouncedLoadRange();
|
|
3265
|
+
}
|
|
3266
|
+
return;
|
|
3267
|
+
}, [dataArray]);
|
|
3268
|
+
}
|
|
3269
|
+
function lazyLoadRange(options, cache) {
|
|
3270
|
+
const {
|
|
3271
|
+
startIndex,
|
|
3272
|
+
endIndex,
|
|
3273
|
+
lazyLoadBatchSize,
|
|
3274
|
+
componentState,
|
|
3275
|
+
componentActions
|
|
3276
|
+
} = options;
|
|
3277
|
+
const { dataArray } = componentState;
|
|
3278
|
+
const isRowLoaded = (index) => dataArray[index].data != null;
|
|
3279
|
+
const perGroupFnCalls = new DeepMap();
|
|
3280
|
+
const rootGroupKeys = ["_______xxx______"];
|
|
3281
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
3282
|
+
const rowInfo = dataArray[i];
|
|
3283
|
+
if (!rowInfo) {
|
|
3284
|
+
continue;
|
|
3285
|
+
}
|
|
3286
|
+
const rowLoaded = rowInfo.data != null;
|
|
3287
|
+
const parentGroupKeys = rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
|
|
3288
|
+
if (rowInfo.groupKeys) {
|
|
3289
|
+
parentGroupKeys.pop();
|
|
3290
|
+
}
|
|
3291
|
+
const cacheKeys = parentGroupKeys.length ? parentGroupKeys : rootGroupKeys;
|
|
3292
|
+
const indexInGroup = rowInfo.indexInGroup;
|
|
3293
|
+
if (!rowLoaded) {
|
|
3294
|
+
let fnCalls = perGroupFnCalls.get(cacheKeys);
|
|
3295
|
+
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
3296
|
+
const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
|
|
3297
|
+
const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
|
|
3298
|
+
const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
|
|
3299
|
+
const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
|
|
3300
|
+
if (batchStartRowLoaded || (fnCalls == null ? void 0 : fnCalls[batchStartRowId])) {
|
|
3301
|
+
continue;
|
|
3302
|
+
}
|
|
3303
|
+
const shouldSetFnCalls = !fnCalls;
|
|
3304
|
+
fnCalls = fnCalls || {};
|
|
3305
|
+
const currentFnCall = {
|
|
3306
|
+
lazyLoadStartIndex: batchStartIndexInGroup,
|
|
3307
|
+
lazyLoadBatchSize,
|
|
3308
|
+
groupKeys: parentGroupKeys
|
|
3309
|
+
};
|
|
3310
|
+
if (!fnCalls[batchStartRowId]) {
|
|
3311
|
+
fnCalls[batchStartRowId] = currentFnCall;
|
|
3312
|
+
}
|
|
3313
|
+
if (shouldSetFnCalls) {
|
|
3314
|
+
perGroupFnCalls.set(cacheKeys, fnCalls);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
let initialPromise = Promise.resolve(true);
|
|
3319
|
+
const allFnCalls = [];
|
|
3320
|
+
perGroupFnCalls.topDownValues().forEach((record) => {
|
|
3321
|
+
allFnCalls.push(...Object.values(record));
|
|
3322
|
+
});
|
|
3323
|
+
allFnCalls.reduce((promise, fnCall) => {
|
|
3324
|
+
const cacheKey = `${fnCall.groupKeys.join("-")}:${fnCall.lazyLoadStartIndex}`;
|
|
3325
|
+
if (cache && cache.has(cacheKey)) {
|
|
3326
|
+
return promise;
|
|
3327
|
+
}
|
|
3328
|
+
cache == null ? void 0 : cache.set(cacheKey, true);
|
|
3329
|
+
const args = [componentState.data, componentState, componentActions, fnCall];
|
|
3330
|
+
return promise.then(() => getRafPromise()).then(() => loadData(...args)).then(() => {
|
|
3331
|
+
requestAnimationFrame(() => {
|
|
3332
|
+
cache == null ? void 0 : cache.delete(cacheKey);
|
|
3333
|
+
});
|
|
3334
|
+
});
|
|
3335
|
+
}, initialPromise);
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
3339
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
3340
|
+
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
3341
|
+
const sortInfo = initialSortInfo != null ? initialSortInfo : EMPTY_ARRAY;
|
|
3342
|
+
const result = Array.isArray(sortInfo) ? sortInfo : [sortInfo];
|
|
3343
|
+
if (weakMap && weakMap.has(sortInfo)) {
|
|
3344
|
+
const prevResult = weakMap.get(sortInfo);
|
|
3345
|
+
if (prevResult && prevResult.length === result.length) {
|
|
3346
|
+
return prevResult;
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
if (weakMap && sortInfo) {
|
|
3350
|
+
weakMap.set(sortInfo, result);
|
|
3351
|
+
}
|
|
3352
|
+
return result;
|
|
3353
|
+
};
|
|
3354
|
+
|
|
3355
|
+
// src/components/DataSource/GroupRowsState.ts
|
|
3356
|
+
var GroupRowsState = class {
|
|
3357
|
+
constructor(state) {
|
|
3358
|
+
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
3359
|
+
}
|
|
3360
|
+
getState() {
|
|
3361
|
+
var _a, _b, _c, _d;
|
|
3362
|
+
return {
|
|
3363
|
+
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
3364
|
+
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
destroy() {
|
|
3368
|
+
var _a, _b;
|
|
3369
|
+
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
3370
|
+
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
3371
|
+
delete this.expandedMap;
|
|
3372
|
+
delete this.collapsedMap;
|
|
3373
|
+
}
|
|
3374
|
+
update(state) {
|
|
3375
|
+
var _a, _b, _c, _d;
|
|
3376
|
+
this.initialState = state;
|
|
3377
|
+
const { collapsedRows, expandedRows } = this.initialState;
|
|
3378
|
+
this.collapsedAll = collapsedRows === true;
|
|
3379
|
+
this.expandedAll = expandedRows === true;
|
|
3380
|
+
if (this.collapsedAll && this.expandedAll) {
|
|
3381
|
+
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
3382
|
+
}
|
|
3383
|
+
if (collapsedRows !== true) {
|
|
3384
|
+
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
3385
|
+
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
3386
|
+
}
|
|
3387
|
+
if (expandedRows !== true) {
|
|
3388
|
+
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
3389
|
+
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
areAllCollapsed() {
|
|
3393
|
+
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
3394
|
+
}
|
|
3395
|
+
areAllExpanded() {
|
|
3396
|
+
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
3397
|
+
}
|
|
3398
|
+
collapseAll() {
|
|
3399
|
+
this.update({
|
|
3400
|
+
collapsedRows: true,
|
|
3401
|
+
expandedRows: []
|
|
3402
|
+
});
|
|
3403
|
+
}
|
|
3404
|
+
expandAll() {
|
|
3405
|
+
this.update({
|
|
3406
|
+
expandedRows: true,
|
|
3407
|
+
collapsedRows: []
|
|
3408
|
+
});
|
|
3409
|
+
}
|
|
3410
|
+
isGroupRowExpanded(keys) {
|
|
3411
|
+
var _a, _b;
|
|
3412
|
+
if (this.expandedAll === true) {
|
|
3413
|
+
if (this.collapsedAll === true) {
|
|
3414
|
+
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
3415
|
+
}
|
|
3416
|
+
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
3417
|
+
}
|
|
3418
|
+
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
2882
3419
|
}
|
|
2883
3420
|
isGroupRowCollapsed(keys) {
|
|
2884
3421
|
return !this.isGroupRowExpanded(keys);
|
|
@@ -2926,7 +3463,7 @@ var GroupRowsState = class {
|
|
|
2926
3463
|
};
|
|
2927
3464
|
|
|
2928
3465
|
// src/utils/shallowEqualObjects.ts
|
|
2929
|
-
function shallowEqualObjects(objA, objB) {
|
|
3466
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
2930
3467
|
if (objA === objB) {
|
|
2931
3468
|
return true;
|
|
2932
3469
|
}
|
|
@@ -2935,12 +3472,21 @@ function shallowEqualObjects(objA, objB) {
|
|
|
2935
3472
|
}
|
|
2936
3473
|
var aKeys = Object.keys(objA);
|
|
2937
3474
|
var bKeys = Object.keys(objB);
|
|
3475
|
+
if (ignoreKeys) {
|
|
3476
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
3477
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
3478
|
+
}
|
|
2938
3479
|
var len = aKeys.length;
|
|
2939
3480
|
if (bKeys.length !== len) {
|
|
2940
3481
|
return false;
|
|
2941
3482
|
}
|
|
2942
3483
|
for (var i = 0; i < len; i++) {
|
|
2943
3484
|
var key = aKeys[i];
|
|
3485
|
+
if (ignoreKeys) {
|
|
3486
|
+
if (ignoreKeys.has(key)) {
|
|
3487
|
+
continue;
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
2944
3490
|
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
2945
3491
|
return false;
|
|
2946
3492
|
}
|
|
@@ -2951,12 +3497,12 @@ function shallowEqualObjects(objA, objB) {
|
|
|
2951
3497
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
2952
3498
|
var map = new WeakMap();
|
|
2953
3499
|
var getCompareDefault = (a) => a;
|
|
2954
|
-
function discardCallsWithEqualArg(fn, timeframe = 50,
|
|
3500
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
2955
3501
|
map.set(fn, {
|
|
2956
3502
|
lastCallTime: 0,
|
|
2957
3503
|
lastCallArg: null
|
|
2958
3504
|
});
|
|
2959
|
-
const getCompare =
|
|
3505
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
2960
3506
|
return (arg) => {
|
|
2961
3507
|
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
2962
3508
|
lastCallTime: 0,
|
|
@@ -2977,20 +3523,28 @@ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
|
|
|
2977
3523
|
}
|
|
2978
3524
|
|
|
2979
3525
|
// src/components/DataSource/state/getInitialState.ts
|
|
3526
|
+
var defaultCursorId = Symbol("cursorId");
|
|
2980
3527
|
function initSetupState2() {
|
|
2981
3528
|
const now = Date.now();
|
|
2982
3529
|
const originalDataArray = [];
|
|
2983
3530
|
const dataArray = [];
|
|
3531
|
+
const originalLazyGroupData = new DeepMap();
|
|
2984
3532
|
return {
|
|
2985
3533
|
dataParams: void 0,
|
|
2986
3534
|
notifyScrollbarsChange: buildSubscriptionCallback(),
|
|
3535
|
+
notifyScrollStop: buildSubscriptionCallback(),
|
|
3536
|
+
notifyRenderRangeChange: buildSubscriptionCallback(),
|
|
2987
3537
|
pivotTotalColumnPosition: "end",
|
|
3538
|
+
scrollStopDelayUpdatedByTable: 100,
|
|
3539
|
+
originalLazyGroupData,
|
|
3540
|
+
originalLazyGroupDataChangeDetect: 0,
|
|
2988
3541
|
originalDataArray,
|
|
2989
|
-
|
|
3542
|
+
cursorId: defaultCursorId,
|
|
2990
3543
|
showSeparatePivotColumnForSingleAggregation: false,
|
|
2991
3544
|
propsCache: new Map([
|
|
2992
3545
|
["sortInfo", new WeakMap()]
|
|
2993
3546
|
]),
|
|
3547
|
+
pivotMappings: void 0,
|
|
2994
3548
|
pivotColumns: void 0,
|
|
2995
3549
|
pivotColumnGroups: void 0,
|
|
2996
3550
|
dataArray,
|
|
@@ -3006,19 +3560,22 @@ function initSetupState2() {
|
|
|
3006
3560
|
lastGroupDataArray: void 0
|
|
3007
3561
|
};
|
|
3008
3562
|
}
|
|
3009
|
-
function
|
|
3563
|
+
function getCompareObjectForDataParams(dataParams) {
|
|
3010
3564
|
const obj = __spreadValues({}, dataParams);
|
|
3011
3565
|
delete obj.originalDataArray;
|
|
3012
3566
|
return obj;
|
|
3013
3567
|
}
|
|
3014
3568
|
var forwardProps3 = (setupState) => {
|
|
3015
3569
|
return {
|
|
3016
|
-
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100,
|
|
3570
|
+
onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObjectForDataParams) : void 0,
|
|
3571
|
+
fullLazyLoad: 1,
|
|
3017
3572
|
data: 1,
|
|
3018
3573
|
pivotBy: 1,
|
|
3019
3574
|
primaryKey: 1,
|
|
3020
3575
|
livePagination: 1,
|
|
3576
|
+
lazyLoadBatchSize: (lazyLoadBatchSize) => lazyLoadBatchSize != null ? lazyLoadBatchSize : -1,
|
|
3021
3577
|
aggregationReducers: 1,
|
|
3578
|
+
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
3022
3579
|
loading: (loading) => loading != null ? loading : false,
|
|
3023
3580
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
3024
3581
|
groupBy: (groupBy) => groupBy != null ? groupBy : [],
|
|
@@ -3030,297 +3587,111 @@ var forwardProps3 = (setupState) => {
|
|
|
3030
3587
|
}
|
|
3031
3588
|
};
|
|
3032
3589
|
};
|
|
3590
|
+
function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
3591
|
+
const livePaginationCursor = typeof livePaginationCursorProp === "function" ? livePaginationCursorProp({
|
|
3592
|
+
array: state.originalDataArray,
|
|
3593
|
+
length: state.originalDataArray.length,
|
|
3594
|
+
lastItem: state.originalDataArray[state.originalDataArray.length - 1]
|
|
3595
|
+
}) : livePaginationCursorProp;
|
|
3596
|
+
return livePaginationCursor;
|
|
3597
|
+
}
|
|
3033
3598
|
function mapPropsToState2(params) {
|
|
3034
|
-
const { props, state } = params;
|
|
3599
|
+
const { props, state, oldState } = params;
|
|
3035
3600
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
3036
3601
|
const result = {
|
|
3037
3602
|
controlledSort,
|
|
3038
3603
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
|
|
3039
3604
|
};
|
|
3040
|
-
if (props.livePagination) {
|
|
3041
|
-
const
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
lastItem: state.originalDataArray[state.originalDataArray.length - 1]
|
|
3045
|
-
}) : props.livePaginationCursor;
|
|
3046
|
-
result.livePaginationCursor = livePaginationCursor;
|
|
3047
|
-
}
|
|
3048
|
-
return result;
|
|
3049
|
-
}
|
|
3050
|
-
function getInterceptActions() {
|
|
3051
|
-
return {
|
|
3052
|
-
sortInfo: (sortInfo, { actions, state }) => {
|
|
3053
|
-
const dataParams = buildDataSourceDataParams(state);
|
|
3054
|
-
dataParams.sortInfo = sortInfo;
|
|
3055
|
-
actions.dataParams = dataParams;
|
|
3056
|
-
}
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
|
-
|
|
3060
|
-
// src/utils/groupAndPivot/index.ts
|
|
3061
|
-
function DEFAULT_TO_KEY(value) {
|
|
3062
|
-
return value;
|
|
3063
|
-
}
|
|
3064
|
-
function initReducers(reducers) {
|
|
3065
|
-
if (!reducers || !Object.keys(reducers).length) {
|
|
3066
|
-
return {};
|
|
3067
|
-
}
|
|
3068
|
-
const result = {};
|
|
3069
|
-
for (let key in reducers)
|
|
3070
|
-
if (reducers.hasOwnProperty(key)) {
|
|
3071
|
-
result[key] = reducers[key].initialValue;
|
|
3072
|
-
}
|
|
3073
|
-
return result;
|
|
3074
|
-
}
|
|
3075
|
-
function computeReducersFor(data, reducers, reducerResults) {
|
|
3076
|
-
var _a, _b;
|
|
3077
|
-
if (!reducers || !Object.keys(reducers).length) {
|
|
3078
|
-
return;
|
|
3079
|
-
}
|
|
3080
|
-
for (let key in reducers)
|
|
3081
|
-
if (reducers.hasOwnProperty(key)) {
|
|
3082
|
-
const reducer = reducers[key];
|
|
3083
|
-
const currentValue = reducerResults[key];
|
|
3084
|
-
const value = reducer.field ? data[reducer.field] : (_b = (_a = reducer.getter) == null ? void 0 : _a.call(reducer, data)) != null ? _b : null;
|
|
3085
|
-
reducerResults[key] = reducer.reducer(currentValue, value, data);
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
function group(groupParams, data) {
|
|
3089
|
-
const {
|
|
3090
|
-
groupBy,
|
|
3091
|
-
defaultToKey = DEFAULT_TO_KEY,
|
|
3092
|
-
pivot,
|
|
3093
|
-
reducers
|
|
3094
|
-
} = groupParams;
|
|
3095
|
-
const groupByLength = groupBy.length;
|
|
3096
|
-
const topLevelPivotColumns = pivot ? new DeepMap() : void 0;
|
|
3097
|
-
const deepMap = new DeepMap();
|
|
3098
|
-
let currentGroupKeys = [];
|
|
3099
|
-
let currentPivotKeys = [];
|
|
3100
|
-
const initialReducerValue = initReducers(reducers);
|
|
3101
|
-
const globalReducerResults = __spreadValues({}, initialReducerValue);
|
|
3102
|
-
for (let i = 0, len = data.length; i < len; i++) {
|
|
3103
|
-
let item = data[i];
|
|
3104
|
-
for (let groupByIndex = 0; groupByIndex < groupByLength; groupByIndex++) {
|
|
3105
|
-
const { field: groupByProperty, toKey: groupToKey } = groupBy[groupByIndex];
|
|
3106
|
-
const key = (groupToKey || defaultToKey)(item[groupByProperty], item);
|
|
3107
|
-
currentGroupKeys.push(key);
|
|
3108
|
-
if (!deepMap.has(currentGroupKeys)) {
|
|
3109
|
-
const deepMapGroupValue = {
|
|
3110
|
-
items: [],
|
|
3111
|
-
reducerResults: __spreadValues({}, initialReducerValue)
|
|
3112
|
-
};
|
|
3113
|
-
if (pivot) {
|
|
3114
|
-
deepMapGroupValue.pivotDeepMap = new DeepMap();
|
|
3115
|
-
}
|
|
3116
|
-
deepMap.set(currentGroupKeys, deepMapGroupValue);
|
|
3117
|
-
}
|
|
3118
|
-
const {
|
|
3119
|
-
items: currentGroupItems,
|
|
3120
|
-
reducerResults,
|
|
3121
|
-
pivotDeepMap
|
|
3122
|
-
} = deepMap.get(currentGroupKeys);
|
|
3123
|
-
currentGroupItems.push(item);
|
|
3124
|
-
if (reducers) {
|
|
3125
|
-
computeReducersFor(item, reducers, reducerResults);
|
|
3126
|
-
}
|
|
3127
|
-
if (pivot) {
|
|
3128
|
-
for (let pivotIndex = 0, pivotLength = pivot.length; pivotIndex < pivotLength; pivotIndex++) {
|
|
3129
|
-
const { field: pivotField, toKey: pivotToKey } = pivot[pivotIndex];
|
|
3130
|
-
const pivotKey = (pivotToKey || defaultToKey)(item[pivotField], item);
|
|
3131
|
-
currentPivotKeys.push(pivotKey);
|
|
3132
|
-
if (!pivotDeepMap.has(currentPivotKeys)) {
|
|
3133
|
-
topLevelPivotColumns.set(currentPivotKeys, true);
|
|
3134
|
-
pivotDeepMap == null ? void 0 : pivotDeepMap.set(currentPivotKeys, {
|
|
3135
|
-
reducerResults: __spreadValues({}, initialReducerValue),
|
|
3136
|
-
items: []
|
|
3137
|
-
});
|
|
3138
|
-
}
|
|
3139
|
-
const {
|
|
3140
|
-
reducerResults: pivotReducerResults,
|
|
3141
|
-
items: pivotGroupItems
|
|
3142
|
-
} = pivotDeepMap.get(currentPivotKeys);
|
|
3143
|
-
pivotGroupItems.push(item);
|
|
3144
|
-
if (reducers) {
|
|
3145
|
-
computeReducersFor(item, reducers, pivotReducerResults);
|
|
3146
|
-
}
|
|
3147
|
-
}
|
|
3148
|
-
currentPivotKeys.length = 0;
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
if (reducers) {
|
|
3152
|
-
computeReducersFor(item, reducers, globalReducerResults);
|
|
3153
|
-
}
|
|
3154
|
-
currentGroupKeys.length = 0;
|
|
3155
|
-
}
|
|
3156
|
-
if (reducers) {
|
|
3157
|
-
deepMap.visitDepthFirst((deepMapValue, _keys, _indexInGroup, next) => {
|
|
3158
|
-
completeReducers(reducers, deepMapValue.reducerResults, deepMapValue.items);
|
|
3159
|
-
if (pivot) {
|
|
3160
|
-
deepMapValue.pivotDeepMap.visitDepthFirst(({ items, reducerResults: pivotReducerResults }, _keys2, _indexInGroup2, next2) => {
|
|
3161
|
-
completeReducers(reducers, pivotReducerResults, items);
|
|
3162
|
-
next2 == null ? void 0 : next2();
|
|
3163
|
-
});
|
|
3164
|
-
}
|
|
3165
|
-
next == null ? void 0 : next();
|
|
3166
|
-
});
|
|
3167
|
-
}
|
|
3168
|
-
if (reducers) {
|
|
3169
|
-
completeReducers(reducers, globalReducerResults, data);
|
|
3170
|
-
}
|
|
3171
|
-
const result = {
|
|
3172
|
-
deepMap,
|
|
3173
|
-
groupParams,
|
|
3174
|
-
initialData: data,
|
|
3175
|
-
reducerResults: globalReducerResults
|
|
3176
|
-
};
|
|
3177
|
-
if (pivot) {
|
|
3178
|
-
result.topLevelPivotColumns = topLevelPivotColumns;
|
|
3179
|
-
result.pivot = pivot;
|
|
3605
|
+
if (props.livePagination) {
|
|
3606
|
+
const dataArrayChanged = !oldState || oldState.originalDataArray !== state.originalDataArray;
|
|
3607
|
+
const livePaginationCursor = typeof props.livePaginationCursor === "function" ? dataArrayChanged ? getLivePaginationCursorValue(props.livePaginationCursor, state) : state.livePaginationCursor : props.livePaginationCursor;
|
|
3608
|
+
result.livePaginationCursor = livePaginationCursor;
|
|
3180
3609
|
}
|
|
3181
3610
|
return result;
|
|
3182
3611
|
}
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
const
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3612
|
+
var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
|
|
3613
|
+
function onPropChange(params, props, actions) {
|
|
3614
|
+
const { name, newValue } = params;
|
|
3615
|
+
if (name === "data" && typeof newValue === "function" && !props.groupRowsState) {
|
|
3616
|
+
if (props.fullLazyLoad) {
|
|
3617
|
+
debugFullLazyLoad(`"data" function prop has changed`);
|
|
3618
|
+
}
|
|
3619
|
+
if (props.collapseGroupRowsOnDataFunctionChange !== false) {
|
|
3620
|
+
actions.groupRowsState = new GroupRowsState({
|
|
3621
|
+
collapsedRows: true,
|
|
3622
|
+
expandedRows: []
|
|
3623
|
+
});
|
|
3191
3624
|
}
|
|
3192
|
-
return acc;
|
|
3193
|
-
}, result);
|
|
3194
|
-
return result;
|
|
3195
|
-
}
|
|
3196
|
-
function getEnhancedGroupData(options, deepMapValue) {
|
|
3197
|
-
const { groupBy, groupKeys, collapsed, parents, reducers } = options;
|
|
3198
|
-
const groupNesting = groupKeys.length;
|
|
3199
|
-
const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
|
|
3200
|
-
let data = null;
|
|
3201
|
-
if (Object.keys(reducerResults).length > 0) {
|
|
3202
|
-
data = {};
|
|
3203
|
-
for (let key in reducers)
|
|
3204
|
-
if (reducers.hasOwnProperty(key)) {
|
|
3205
|
-
const reducer = reducers[key];
|
|
3206
|
-
const field = reducer.field;
|
|
3207
|
-
if (field) {
|
|
3208
|
-
data[field] = reducerResults[key];
|
|
3209
|
-
}
|
|
3210
|
-
}
|
|
3211
3625
|
}
|
|
3212
|
-
const enhancedGroupData = {
|
|
3213
|
-
data,
|
|
3214
|
-
groupCount: groupItems.length,
|
|
3215
|
-
groupData: groupItems,
|
|
3216
|
-
groupKeys,
|
|
3217
|
-
id: groupKeys,
|
|
3218
|
-
collapsed,
|
|
3219
|
-
parents,
|
|
3220
|
-
collapsedChildrenCount: 0,
|
|
3221
|
-
collapsedGroupsCount: 0,
|
|
3222
|
-
indexInParentGroups: options.indexInParentGroups,
|
|
3223
|
-
indexInGroup: options.indexInGroup,
|
|
3224
|
-
indexInAll: options.indexInAll,
|
|
3225
|
-
value: groupKeys[groupKeys.length - 1],
|
|
3226
|
-
groupBy: groupBy.slice(0, groupNesting),
|
|
3227
|
-
isGroupRow: true,
|
|
3228
|
-
pivotValuesMap: pivotDeepMap,
|
|
3229
|
-
groupNesting,
|
|
3230
|
-
reducerResults
|
|
3231
|
-
};
|
|
3232
|
-
return enhancedGroupData;
|
|
3233
3626
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3627
|
+
var debugDataParams = dbg("DataSource:dataParams");
|
|
3628
|
+
function getInterceptActions() {
|
|
3629
|
+
return {
|
|
3630
|
+
sortInfo: (sortInfo, { actions, state }) => {
|
|
3631
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3632
|
+
sortInfo,
|
|
3633
|
+
livePaginationCursor: null
|
|
3634
|
+
});
|
|
3635
|
+
actions.dataParams = dataParams;
|
|
3636
|
+
if (state.livePagination) {
|
|
3637
|
+
requestAnimationFrame(() => {
|
|
3638
|
+
actions.livePaginationCursor = null;
|
|
3639
|
+
});
|
|
3242
3640
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
groupResult,
|
|
3249
|
-
toPrimaryKey,
|
|
3250
|
-
groupRowsState,
|
|
3251
|
-
generateGroupRows,
|
|
3252
|
-
reducers = {}
|
|
3253
|
-
} = param;
|
|
3254
|
-
const { groupParams, deepMap, pivot } = groupResult;
|
|
3255
|
-
const { groupBy } = groupParams;
|
|
3256
|
-
const groupByStrings = groupBy.map((g) => g.field);
|
|
3257
|
-
const result = [];
|
|
3258
|
-
const parents = [];
|
|
3259
|
-
const indexInParentGroups = [];
|
|
3260
|
-
deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
|
|
3261
|
-
var _a;
|
|
3262
|
-
const items = deepMapValue.items;
|
|
3263
|
-
const groupNesting = groupKeys.length;
|
|
3264
|
-
const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
3265
|
-
const enhancedGroupData = getEnhancedGroupData({
|
|
3266
|
-
groupBy: groupByStrings,
|
|
3267
|
-
parents: Array.from(parents),
|
|
3268
|
-
reducers,
|
|
3269
|
-
indexInGroup,
|
|
3270
|
-
indexInParentGroups: Array.from(indexInParentGroups),
|
|
3271
|
-
indexInAll: result.length,
|
|
3272
|
-
groupKeys,
|
|
3273
|
-
collapsed
|
|
3274
|
-
}, deepMapValue);
|
|
3275
|
-
const include = generateGroupRows || collapsed;
|
|
3276
|
-
if (include) {
|
|
3277
|
-
result.push(enhancedGroupData);
|
|
3278
|
-
}
|
|
3279
|
-
if (collapsed) {
|
|
3280
|
-
parents.forEach((parent) => {
|
|
3281
|
-
parent.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
3282
|
-
parent.collapsedGroupsCount += 1;
|
|
3641
|
+
},
|
|
3642
|
+
groupBy: (groupBy, { actions, state }) => {
|
|
3643
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3644
|
+
groupBy,
|
|
3645
|
+
livePaginationCursor: null
|
|
3283
3646
|
});
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3647
|
+
actions.dataParams = dataParams;
|
|
3648
|
+
if (state.livePagination) {
|
|
3649
|
+
requestAnimationFrame(() => {
|
|
3650
|
+
actions.livePaginationCursor = null;
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
},
|
|
3654
|
+
pivotBy: (pivotBy, { actions, state }) => {
|
|
3655
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3656
|
+
pivotBy,
|
|
3657
|
+
livePaginationCursor: null
|
|
3658
|
+
});
|
|
3659
|
+
actions.dataParams = dataParams;
|
|
3660
|
+
if (state.livePagination) {
|
|
3661
|
+
requestAnimationFrame(() => {
|
|
3662
|
+
actions.livePaginationCursor = null;
|
|
3663
|
+
});
|
|
3664
|
+
}
|
|
3665
|
+
},
|
|
3666
|
+
cursorId: (cursorId, { actions, state }) => {
|
|
3667
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3668
|
+
cursorId
|
|
3669
|
+
});
|
|
3670
|
+
actions.dataParams = dataParams;
|
|
3671
|
+
},
|
|
3672
|
+
livePaginationCursor: (livePaginationCursor, { actions, state }) => {
|
|
3673
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
3674
|
+
livePaginationCursor
|
|
3675
|
+
});
|
|
3676
|
+
actions.dataParams = dataParams;
|
|
3677
|
+
},
|
|
3678
|
+
dataParams: (dataParams, { state }) => {
|
|
3679
|
+
if (shallowEqualObjects(dataParams, state.dataParams, new Set([
|
|
3680
|
+
"changes",
|
|
3681
|
+
"originalDataArray"
|
|
3682
|
+
]))) {
|
|
3683
|
+
return false;
|
|
3310
3684
|
}
|
|
3685
|
+
debugDataParams("onDataParamsChange triggered because the following values have changed", dataParams == null ? void 0 : dataParams.changes);
|
|
3686
|
+
return true;
|
|
3311
3687
|
}
|
|
3312
|
-
parents.pop();
|
|
3313
|
-
indexInParentGroups.pop();
|
|
3314
|
-
});
|
|
3315
|
-
return {
|
|
3316
|
-
data: result
|
|
3317
3688
|
};
|
|
3318
3689
|
}
|
|
3319
3690
|
|
|
3320
3691
|
// src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
|
|
3321
3692
|
function prepareColumn(column) {
|
|
3322
3693
|
const { pivotByAtIndex: pivotByForColumn } = column;
|
|
3323
|
-
if (pivotByForColumn.column) {
|
|
3694
|
+
if (pivotByForColumn == null ? void 0 : pivotByForColumn.column) {
|
|
3324
3695
|
if (typeof pivotByForColumn.column === "function") {
|
|
3325
3696
|
Object.assign(column, pivotByForColumn.column({ column }));
|
|
3326
3697
|
} else {
|
|
@@ -3331,7 +3702,7 @@ function prepareColumn(column) {
|
|
|
3331
3702
|
}
|
|
3332
3703
|
function prepareColumnGroup(columnGroup) {
|
|
3333
3704
|
const { pivotByAtIndex: pivotByForColumnGroup } = columnGroup;
|
|
3334
|
-
if (pivotByForColumnGroup.columnGroup) {
|
|
3705
|
+
if (pivotByForColumnGroup == null ? void 0 : pivotByForColumnGroup.columnGroup) {
|
|
3335
3706
|
if (typeof pivotByForColumnGroup.columnGroup === "function") {
|
|
3336
3707
|
Object.assign(columnGroup, pivotByForColumnGroup.columnGroup({ columnGroup }));
|
|
3337
3708
|
} else {
|
|
@@ -3360,6 +3731,9 @@ function getPivotColumnsAndColumnGroups({
|
|
|
3360
3731
|
valueGetter: (params) => {
|
|
3361
3732
|
var _a;
|
|
3362
3733
|
const { rowInfo } = params;
|
|
3734
|
+
if (!rowInfo.data) {
|
|
3735
|
+
return "Loading ...";
|
|
3736
|
+
}
|
|
3363
3737
|
return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
|
|
3364
3738
|
}
|
|
3365
3739
|
}
|
|
@@ -3391,7 +3765,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
3391
3765
|
}));
|
|
3392
3766
|
}
|
|
3393
3767
|
aggregationReducers.forEach((reducer, index) => {
|
|
3394
|
-
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.id;
|
|
3768
|
+
const header = isSingleAggregationColumn ? keys[keys.length - 1] : reducer.name || reducer.id;
|
|
3395
3769
|
const computedPivotColumn = prepareColumn({
|
|
3396
3770
|
pivotBy,
|
|
3397
3771
|
pivotColumn: true,
|
|
@@ -3410,7 +3784,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
3410
3784
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3411
3785
|
}
|
|
3412
3786
|
});
|
|
3413
|
-
const columnId = `${keys.join("/")}
|
|
3787
|
+
const columnId = `${reducer.id}:${keys.join("/")}`;
|
|
3414
3788
|
columns.set(columnId, computedPivotColumn);
|
|
3415
3789
|
});
|
|
3416
3790
|
} else {
|
|
@@ -3443,7 +3817,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
3443
3817
|
}));
|
|
3444
3818
|
}
|
|
3445
3819
|
aggregationReducers.forEach((reducer, index) => {
|
|
3446
|
-
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.id} total`;
|
|
3820
|
+
const header = isSingleAggregationColumn ? `${keys[keys.length - 1]} total ` : `${reducer.name || reducer.id} total`;
|
|
3447
3821
|
const computedPivotColumn = prepareColumn({
|
|
3448
3822
|
columnGroup: columnGroupId,
|
|
3449
3823
|
header,
|
|
@@ -3462,7 +3836,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
3462
3836
|
return (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[reducer.id];
|
|
3463
3837
|
}
|
|
3464
3838
|
});
|
|
3465
|
-
columns.set(`total:${keys.join("/")}
|
|
3839
|
+
columns.set(`total:${reducer.id}:${keys.join("/")}`, computedPivotColumn);
|
|
3466
3840
|
});
|
|
3467
3841
|
}
|
|
3468
3842
|
}
|
|
@@ -3471,15 +3845,22 @@ function getPivotColumnsAndColumnGroups({
|
|
|
3471
3845
|
}
|
|
3472
3846
|
});
|
|
3473
3847
|
if (columns.size === 1) {
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3848
|
+
aggregationReducers.forEach((reducer, index) => {
|
|
3849
|
+
columns.set(`total:${reducer.id}`, prepareColumn({
|
|
3850
|
+
header: `${reducer.name || reducer.id} total`,
|
|
3851
|
+
pivotBy,
|
|
3852
|
+
pivotColumn: true,
|
|
3853
|
+
pivotTotalColumn: true,
|
|
3854
|
+
pivotAggregator: reducer,
|
|
3855
|
+
pivotAggregatorIndex: index,
|
|
3856
|
+
pivotGroupKeys: [],
|
|
3857
|
+
pivotGroupKey: "",
|
|
3858
|
+
pivotIndex: -1,
|
|
3859
|
+
valueGetter: ({ rowInfo }) => {
|
|
3860
|
+
var _a;
|
|
3861
|
+
return (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id];
|
|
3862
|
+
}
|
|
3863
|
+
}));
|
|
3483
3864
|
});
|
|
3484
3865
|
}
|
|
3485
3866
|
const result = {
|
|
@@ -3516,10 +3897,11 @@ function concludeReducer(params) {
|
|
|
3516
3897
|
const { state, previousState } = params;
|
|
3517
3898
|
const sortInfo = state.sortInfo;
|
|
3518
3899
|
const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
3519
|
-
const
|
|
3520
|
-
"originalDataArray"
|
|
3521
|
-
"sortInfo"
|
|
3900
|
+
const originalDataArrayChanged = haveDepsChanged(previousState, state, [
|
|
3901
|
+
"originalDataArray"
|
|
3522
3902
|
]);
|
|
3903
|
+
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
3904
|
+
const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
|
|
3523
3905
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
3524
3906
|
const groupBy = state.groupBy;
|
|
3525
3907
|
const pivotBy = state.pivotBy;
|
|
@@ -3527,6 +3909,8 @@ function concludeReducer(params) {
|
|
|
3527
3909
|
const groupsDepsChanged = haveDepsChanged(previousState, state, [
|
|
3528
3910
|
"generateGroupRows",
|
|
3529
3911
|
"originalDataArray",
|
|
3912
|
+
"originalLazyGroupData",
|
|
3913
|
+
"originalLazyGroupDataChangeDetect",
|
|
3530
3914
|
"groupBy",
|
|
3531
3915
|
"groupRowsState",
|
|
3532
3916
|
"pivotBy",
|
|
@@ -3551,7 +3935,12 @@ function concludeReducer(params) {
|
|
|
3551
3935
|
};
|
|
3552
3936
|
if (shouldGroup) {
|
|
3553
3937
|
if (shouldGroupAgain) {
|
|
3554
|
-
const groupResult =
|
|
3938
|
+
const groupResult = state.fullLazyLoad ? lazyGroup({
|
|
3939
|
+
groupBy,
|
|
3940
|
+
pivot: pivotBy,
|
|
3941
|
+
mappings: state.pivotMappings,
|
|
3942
|
+
reducers: state.aggregationReducers
|
|
3943
|
+
}, state.originalLazyGroupData) : group({
|
|
3555
3944
|
groupBy,
|
|
3556
3945
|
pivot: pivotBy,
|
|
3557
3946
|
reducers: state.aggregationReducers
|
|
@@ -3619,6 +4008,7 @@ var DataSourceRoot = getComponentStateRoot({
|
|
|
3619
4008
|
forwardProps: forwardProps3,
|
|
3620
4009
|
concludeReducer,
|
|
3621
4010
|
mapPropsToState: mapPropsToState2,
|
|
4011
|
+
onPropChange,
|
|
3622
4012
|
interceptActions: getInterceptActions()
|
|
3623
4013
|
});
|
|
3624
4014
|
function DataSourceCmp({ children }) {
|
|
@@ -3649,17 +4039,23 @@ function DataSource(props) {
|
|
|
3649
4039
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
3650
4040
|
function useToggleGroupRow() {
|
|
3651
4041
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
3652
|
-
const toggleGroupRow = (0,
|
|
3653
|
-
const
|
|
4042
|
+
const toggleGroupRow = (0, import_react16.useCallback)((groupKeys) => {
|
|
4043
|
+
const state = getDataSourceState();
|
|
4044
|
+
const newState = new GroupRowsState(state.groupRowsState);
|
|
3654
4045
|
newState.toggleGroupRow(groupKeys);
|
|
3655
4046
|
dataSourceActions.groupRowsState = newState;
|
|
4047
|
+
if (state.fullLazyLoad && newState.isGroupRowExpanded(groupKeys)) {
|
|
4048
|
+
loadData(state.data, state, dataSourceActions, {
|
|
4049
|
+
groupKeys
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
3656
4052
|
}, []);
|
|
3657
4053
|
return toggleGroupRow;
|
|
3658
4054
|
}
|
|
3659
4055
|
|
|
3660
4056
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
3661
4057
|
function useGroupByMap(groupBy) {
|
|
3662
|
-
const groupByMap = (0,
|
|
4058
|
+
const groupByMap = (0, import_react17.useMemo)(() => {
|
|
3663
4059
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
3664
4060
|
acc.set(groupBy2.field, {
|
|
3665
4061
|
groupBy: groupBy2,
|
|
@@ -3679,10 +4075,10 @@ function useColumnsWhen() {
|
|
|
3679
4075
|
componentState: { groupRenderStrategy, pivotTotalColumnPosition }
|
|
3680
4076
|
} = useComponentState();
|
|
3681
4077
|
const groupByMap = useGroupByMap(groupBy);
|
|
3682
|
-
(0,
|
|
4078
|
+
(0, import_react17.useEffect)(() => {
|
|
3683
4079
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
3684
4080
|
}, [groupRenderStrategy]);
|
|
3685
|
-
(0,
|
|
4081
|
+
(0, import_react17.useEffect)(() => {
|
|
3686
4082
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
3687
4083
|
}, [pivotTotalColumnPosition]);
|
|
3688
4084
|
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
@@ -3745,7 +4141,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
3745
4141
|
});
|
|
3746
4142
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
3747
4143
|
}
|
|
3748
|
-
(0,
|
|
4144
|
+
(0, import_react17.useEffect)(() => {
|
|
3749
4145
|
const update = () => {
|
|
3750
4146
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
3751
4147
|
};
|
|
@@ -3771,7 +4167,7 @@ function useColumnsWhenPivoting() {
|
|
|
3771
4167
|
}
|
|
3772
4168
|
} = useComponentState();
|
|
3773
4169
|
const toggleGroupRow = useToggleGroupRow();
|
|
3774
|
-
(0,
|
|
4170
|
+
(0, import_react17.useEffect)(() => {
|
|
3775
4171
|
const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
|
|
3776
4172
|
pivotColumn,
|
|
3777
4173
|
pivotRowLabelsColumn,
|
|
@@ -3792,7 +4188,7 @@ function useColumnsWhenGrouping() {
|
|
|
3792
4188
|
componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
|
|
3793
4189
|
} = useComponentState();
|
|
3794
4190
|
const toggleGroupRow = useToggleGroupRow();
|
|
3795
|
-
(0,
|
|
4191
|
+
(0, import_react17.useEffect)(() => {
|
|
3796
4192
|
if (pivotColumns) {
|
|
3797
4193
|
return;
|
|
3798
4194
|
}
|
|
@@ -3829,7 +4225,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3829
4225
|
groupRenderStrategy
|
|
3830
4226
|
}
|
|
3831
4227
|
} = useComponentState();
|
|
3832
|
-
(0,
|
|
4228
|
+
(0, import_react17.useEffect)(() => {
|
|
3833
4229
|
if (groupRenderStrategy !== "multi-column") {
|
|
3834
4230
|
return;
|
|
3835
4231
|
}
|
|
@@ -3847,7 +4243,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3847
4243
|
const currentState = getComponentState();
|
|
3848
4244
|
const { computedColumns } = currentState;
|
|
3849
4245
|
let updated = false;
|
|
3850
|
-
const columnVisibility =
|
|
4246
|
+
const columnVisibility = __spreadValues({}, currentState.columnVisibility);
|
|
3851
4247
|
const cols = computedColumns;
|
|
3852
4248
|
groupBy.forEach(({ field, column: groupColumn }, index) => {
|
|
3853
4249
|
const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
|
|
@@ -3858,9 +4254,9 @@ function useHideEmptyGroupColumns(groupRowsMap) {
|
|
|
3858
4254
|
const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
|
|
3859
4255
|
updated = true;
|
|
3860
4256
|
if (shouldBeHidden) {
|
|
3861
|
-
columnVisibility
|
|
4257
|
+
columnVisibility[colId] = false;
|
|
3862
4258
|
} else {
|
|
3863
|
-
columnVisibility
|
|
4259
|
+
delete columnVisibility[colId];
|
|
3864
4260
|
}
|
|
3865
4261
|
});
|
|
3866
4262
|
if (updated) {
|
|
@@ -3935,7 +4331,7 @@ function useComputed() {
|
|
|
3935
4331
|
bodySize,
|
|
3936
4332
|
showSeparatePivotColumnForSingleAggregation
|
|
3937
4333
|
} = componentState;
|
|
3938
|
-
(0,
|
|
4334
|
+
(0, import_react18.useState)(() => {
|
|
3939
4335
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
3940
4336
|
if (rowHeight) {
|
|
3941
4337
|
componentActions.rowHeight = rowHeight;
|
|
@@ -3947,19 +4343,16 @@ function useComputed() {
|
|
|
3947
4343
|
}
|
|
3948
4344
|
});
|
|
3949
4345
|
});
|
|
3950
|
-
(0,
|
|
4346
|
+
(0, import_react18.useEffect)(() => {
|
|
3951
4347
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
3952
4348
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
3953
4349
|
const { multiSort } = dataSourceState;
|
|
3954
4350
|
useColumnGroups();
|
|
3955
4351
|
useColumnsWhen();
|
|
3956
|
-
const setSortInfo = (0,
|
|
4352
|
+
const setSortInfo = (0, import_react18.useCallback)((sortInfo) => {
|
|
3957
4353
|
var _a2;
|
|
3958
4354
|
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
3959
4355
|
dataSourceActions.sortInfo = newSortInfo;
|
|
3960
|
-
if (getDataSourceState().livePagination) {
|
|
3961
|
-
dataSourceActions.livePaginationCursor = null;
|
|
3962
|
-
}
|
|
3963
4356
|
}, [getDataSourceState]);
|
|
3964
4357
|
const columns = componentState.computedColumns;
|
|
3965
4358
|
const {
|
|
@@ -4116,20 +4509,20 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
|
|
|
4116
4509
|
|
|
4117
4510
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4118
4511
|
var React17 = __toModule(require("react"));
|
|
4119
|
-
var
|
|
4512
|
+
var import_react26 = __toModule(require("react"));
|
|
4120
4513
|
|
|
4121
4514
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
4122
4515
|
var React13 = __toModule(require("react"));
|
|
4123
|
-
var
|
|
4516
|
+
var import_react22 = __toModule(require("react"));
|
|
4124
4517
|
|
|
4125
4518
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4126
4519
|
var React11 = __toModule(require("react"));
|
|
4127
4520
|
|
|
4128
4521
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4129
|
-
var
|
|
4522
|
+
var import_react19 = __toModule(require("react"));
|
|
4130
4523
|
var useInfiniteTableState = () => {
|
|
4131
4524
|
const TableContext2 = getInfiniteTableContext();
|
|
4132
|
-
const { componentState } = (0,
|
|
4525
|
+
const { componentState } = (0, import_react19.useContext)(TableContext2);
|
|
4133
4526
|
return componentState;
|
|
4134
4527
|
};
|
|
4135
4528
|
|
|
@@ -4195,7 +4588,7 @@ var InfiniteTableCell = React11.memo(InfiniteTableCellFn);
|
|
|
4195
4588
|
|
|
4196
4589
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4197
4590
|
var import_binary_search = __toModule(require_binary_search());
|
|
4198
|
-
var
|
|
4591
|
+
var import_react20 = __toModule(require("react"));
|
|
4199
4592
|
|
|
4200
4593
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4201
4594
|
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
@@ -4229,18 +4622,18 @@ var useColumnPointerEvents = ({
|
|
|
4229
4622
|
columns,
|
|
4230
4623
|
computedRemainingSpace
|
|
4231
4624
|
}) => {
|
|
4232
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
4233
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
4234
|
-
const breakpointsRef = (0,
|
|
4235
|
-
const pointerMoveRef = (0,
|
|
4236
|
-
const didDragRef = (0,
|
|
4237
|
-
const initialClientPos = (0,
|
|
4238
|
-
const currentDropIndexRef = (0,
|
|
4625
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react20.useState)(null);
|
|
4626
|
+
const [proxyOffset, setProxyOffset] = (0, import_react20.useState)(null);
|
|
4627
|
+
const breakpointsRef = (0, import_react20.useRef)([]);
|
|
4628
|
+
const pointerMoveRef = (0, import_react20.useRef)(null);
|
|
4629
|
+
const didDragRef = (0, import_react20.useRef)(false);
|
|
4630
|
+
const initialClientPos = (0, import_react20.useRef)(null);
|
|
4631
|
+
const currentDropIndexRef = (0, import_react20.useRef)(null);
|
|
4239
4632
|
const dragging = draggingDiff != null;
|
|
4240
4633
|
const { componentActions, computed } = useInfiniteTable();
|
|
4241
4634
|
const { computedColumnOrder } = computed;
|
|
4242
|
-
const column = (0,
|
|
4243
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
4635
|
+
const column = (0, import_react20.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
4636
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react20.useMemo)(() => {
|
|
4244
4637
|
const columnsArray2 = Array.from(columns.values());
|
|
4245
4638
|
return {
|
|
4246
4639
|
columnsArray: columnsArray2,
|
|
@@ -4248,8 +4641,8 @@ var useColumnPointerEvents = ({
|
|
|
4248
4641
|
columnWidth: column.computedWidth
|
|
4249
4642
|
};
|
|
4250
4643
|
}, [columns, columnId, column]);
|
|
4251
|
-
let cursorRef = (0,
|
|
4252
|
-
const onPointerDown = (0,
|
|
4644
|
+
let cursorRef = (0, import_react20.useRef)("auto");
|
|
4645
|
+
const onPointerDown = (0, import_react20.useCallback)((e) => {
|
|
4253
4646
|
const target = domRef.current;
|
|
4254
4647
|
cursorRef.current = target.style.cursor;
|
|
4255
4648
|
didDragRef.current = false;
|
|
@@ -4312,7 +4705,7 @@ var useColumnPointerEvents = ({
|
|
|
4312
4705
|
target.addEventListener("pointermove", onPointerMove);
|
|
4313
4706
|
target.setPointerCapture(e.pointerId);
|
|
4314
4707
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
4315
|
-
const onPointerUp = (0,
|
|
4708
|
+
const onPointerUp = (0, import_react20.useCallback)((e) => {
|
|
4316
4709
|
const target = domRef.current;
|
|
4317
4710
|
target.style.cursor = cursorRef.current;
|
|
4318
4711
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -4387,7 +4780,7 @@ var import_react_dom = __toModule(require("react-dom"));
|
|
|
4387
4780
|
|
|
4388
4781
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4389
4782
|
var React12 = __toModule(require("react"));
|
|
4390
|
-
var
|
|
4783
|
+
var import_react21 = __toModule(require("react"));
|
|
4391
4784
|
var defaultLineStyle = {
|
|
4392
4785
|
marginTop: 2,
|
|
4393
4786
|
marginBottom: 2,
|
|
@@ -4395,8 +4788,8 @@ var defaultLineStyle = {
|
|
|
4395
4788
|
};
|
|
4396
4789
|
function SortIcon(props) {
|
|
4397
4790
|
var _a;
|
|
4398
|
-
const [rendered, setRendered] = (0,
|
|
4399
|
-
const [opacity, setOpacity] = (0,
|
|
4791
|
+
const [rendered, setRendered] = (0, import_react21.useState)(true);
|
|
4792
|
+
const [opacity, setOpacity] = (0, import_react21.useState)(0);
|
|
4400
4793
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
4401
4794
|
const showIndex = index != null && index > 0;
|
|
4402
4795
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -4410,7 +4803,7 @@ function SortIcon(props) {
|
|
|
4410
4803
|
}), props.lineStyle), {
|
|
4411
4804
|
opacity
|
|
4412
4805
|
});
|
|
4413
|
-
(0,
|
|
4806
|
+
(0, import_react21.useEffect)(() => {
|
|
4414
4807
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
4415
4808
|
if (!rendered && newOpacity) {
|
|
4416
4809
|
setRendered(true);
|
|
@@ -4487,8 +4880,8 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4487
4880
|
className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
|
|
4488
4881
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
4489
4882
|
});
|
|
4490
|
-
const domRef = (0,
|
|
4491
|
-
const ref = (0,
|
|
4883
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
4884
|
+
const ref = (0, import_react22.useCallback)((node) => {
|
|
4492
4885
|
var _a2;
|
|
4493
4886
|
domRef.current = node;
|
|
4494
4887
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
@@ -4497,7 +4890,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4497
4890
|
computed: { computedRemainingSpace },
|
|
4498
4891
|
componentState: { portalDOMRef }
|
|
4499
4892
|
} = useInfiniteTable();
|
|
4500
|
-
(0,
|
|
4893
|
+
(0, import_react22.useEffect)(() => {
|
|
4501
4894
|
let clearOnResize = null;
|
|
4502
4895
|
const node = domRef.current;
|
|
4503
4896
|
if (onResize && node) {
|
|
@@ -4550,14 +4943,14 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4550
4943
|
|
|
4551
4944
|
// src/components/RawList/index.tsx
|
|
4552
4945
|
var React16 = __toModule(require("react"));
|
|
4553
|
-
var
|
|
4946
|
+
var import_react25 = __toModule(require("react"));
|
|
4554
4947
|
|
|
4555
4948
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
4556
4949
|
var React14 = __toModule(require("react"));
|
|
4557
|
-
var
|
|
4950
|
+
var import_react23 = __toModule(require("react"));
|
|
4558
4951
|
function AvoidReactDiffFn(props) {
|
|
4559
|
-
const [children, setChildren] = (0,
|
|
4560
|
-
(0,
|
|
4952
|
+
const [children, setChildren] = (0, import_react23.useState)(props.updater.get());
|
|
4953
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
4561
4954
|
const remove = props.updater.onChange((children2) => {
|
|
4562
4955
|
setChildren(children2);
|
|
4563
4956
|
});
|
|
@@ -4568,7 +4961,7 @@ function AvoidReactDiffFn(props) {
|
|
|
4568
4961
|
var AvoidReactDiff = React14.memo(AvoidReactDiffFn);
|
|
4569
4962
|
|
|
4570
4963
|
// src/components/RawList/useVirtualRenderer.ts
|
|
4571
|
-
var
|
|
4964
|
+
var import_react24 = __toModule(require("react"));
|
|
4572
4965
|
|
|
4573
4966
|
// src/components/RawList/ReactVirtualRenderer.tsx
|
|
4574
4967
|
var React15 = __toModule(require("react"));
|
|
@@ -4882,7 +5275,7 @@ function createRenderer(brain) {
|
|
|
4882
5275
|
function useVirtualRenderer({
|
|
4883
5276
|
brain
|
|
4884
5277
|
}) {
|
|
4885
|
-
return (0,
|
|
5278
|
+
return (0, import_react24.useMemo)(() => {
|
|
4886
5279
|
return createRenderer(brain);
|
|
4887
5280
|
}, [brain]);
|
|
4888
5281
|
}
|
|
@@ -4895,7 +5288,7 @@ function RawListFn(props) {
|
|
|
4895
5288
|
debugChannel
|
|
4896
5289
|
});
|
|
4897
5290
|
const getRenderItem = useLatest(renderItem);
|
|
4898
|
-
(0,
|
|
5291
|
+
(0, import_react25.useEffect)(() => {
|
|
4899
5292
|
const renderRange = brain.getRenderRange();
|
|
4900
5293
|
renderer.renderRange(renderRange, {
|
|
4901
5294
|
renderItem,
|
|
@@ -4903,7 +5296,7 @@ function RawListFn(props) {
|
|
|
4903
5296
|
onRender: onRenderUpdater
|
|
4904
5297
|
});
|
|
4905
5298
|
}, [brain, renderItem, onRenderUpdater]);
|
|
4906
|
-
(0,
|
|
5299
|
+
(0, import_react25.useEffect)(() => {
|
|
4907
5300
|
const remove = brain.onRenderRangeChange((renderRange) => {
|
|
4908
5301
|
renderer.renderRange(renderRange, {
|
|
4909
5302
|
force: false,
|
|
@@ -4920,7 +5313,7 @@ function RawListFn(props) {
|
|
|
4920
5313
|
var RawList = React16.memo(RawListFn);
|
|
4921
5314
|
|
|
4922
5315
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4923
|
-
var
|
|
5316
|
+
var debug3 = dbg("Header");
|
|
4924
5317
|
var { rootClassName: rootClassName4 } = internalProps;
|
|
4925
5318
|
var TableHeaderClassName = `${rootClassName4}Header`;
|
|
4926
5319
|
function InfiniteTableHeaderFn(props) {
|
|
@@ -4930,11 +5323,11 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4930
5323
|
componentState: { headerHeight }
|
|
4931
5324
|
} = useInfiniteTable();
|
|
4932
5325
|
const { computedVisibleColumnsMap } = computed;
|
|
4933
|
-
const renderColumn = (0,
|
|
5326
|
+
const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
|
|
4934
5327
|
const column = columns[columnIndex];
|
|
4935
5328
|
if (!column) {
|
|
4936
5329
|
if (true) {
|
|
4937
|
-
|
|
5330
|
+
debug3("Cannot find column to render at ", columnIndex);
|
|
4938
5331
|
}
|
|
4939
5332
|
return null;
|
|
4940
5333
|
}
|
|
@@ -4945,14 +5338,14 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4945
5338
|
columns: computedVisibleColumnsMap
|
|
4946
5339
|
});
|
|
4947
5340
|
}, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
|
|
4948
|
-
(0,
|
|
5341
|
+
(0, import_react26.useEffect)(() => {
|
|
4949
5342
|
const onScroll = (scrollPosition) => {
|
|
4950
5343
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
4951
5344
|
};
|
|
4952
5345
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4953
5346
|
return removeOnScroll;
|
|
4954
5347
|
}, [brain]);
|
|
4955
|
-
const domRef = (0,
|
|
5348
|
+
const domRef = (0, import_react26.useRef)(null);
|
|
4956
5349
|
const headerCls = HeaderClsRecipe({
|
|
4957
5350
|
pinned: pinning,
|
|
4958
5351
|
overflow: false,
|
|
@@ -5144,7 +5537,7 @@ function renderColumnHeaderGroups(config) {
|
|
|
5144
5537
|
}
|
|
5145
5538
|
|
|
5146
5539
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
|
|
5147
|
-
var
|
|
5540
|
+
var import_react27 = __toModule(require("react"));
|
|
5148
5541
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
5149
5542
|
var TableHeaderClassName2 = `${rootClassName5}Header`;
|
|
5150
5543
|
var UPDATE_SCROLL = (node, scrollPosition) => {
|
|
@@ -5210,7 +5603,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
|
|
|
5210
5603
|
if (totalWidth != null) {
|
|
5211
5604
|
style.width = availableWidth;
|
|
5212
5605
|
}
|
|
5213
|
-
(0,
|
|
5606
|
+
(0, import_react27.useEffect)(() => {
|
|
5214
5607
|
const scroller = brain || scrollListener;
|
|
5215
5608
|
if (!scroller || !scrollable) {
|
|
5216
5609
|
return;
|
|
@@ -5264,6 +5657,9 @@ function TableHeaderWrapper(props) {
|
|
|
5264
5657
|
const hasPinnedStart = computedPinnedStartColumns.length > 0;
|
|
5265
5658
|
const hasPinnedEnd = computedPinnedEndColumns.length > 0;
|
|
5266
5659
|
const height = columnGroupsMaxDepth ? columnGroupsMaxDepth * headerHeight : headerHeight;
|
|
5660
|
+
const unvirtualizedStyle = !virtualizeHeader && computedPinnedStartColumnsWidth ? {
|
|
5661
|
+
left: computedPinnedStartWidth
|
|
5662
|
+
} : void 0;
|
|
5267
5663
|
const header = virtualizeHeader ? /* @__PURE__ */ React21.createElement(InfiniteTableHeader, {
|
|
5268
5664
|
columns: computedUnpinnedColumns,
|
|
5269
5665
|
repaintId: virtualizeHeader ? repaintId : void 0,
|
|
@@ -5278,6 +5674,7 @@ function TableHeaderWrapper(props) {
|
|
|
5278
5674
|
availableWidth: computedUnpinnedColumnsWidth,
|
|
5279
5675
|
totalWidth: computedUnpinnedColumnsWidth
|
|
5280
5676
|
}) : /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
|
|
5677
|
+
style: unvirtualizedStyle,
|
|
5281
5678
|
brain,
|
|
5282
5679
|
scrollable: true,
|
|
5283
5680
|
pinning: false,
|
|
@@ -5324,12 +5721,12 @@ function TableHeaderWrapper(props) {
|
|
|
5324
5721
|
|
|
5325
5722
|
// src/components/VirtualScrollContainer/index.tsx
|
|
5326
5723
|
var React22 = __toModule(require("react"));
|
|
5327
|
-
var
|
|
5724
|
+
var import_react29 = __toModule(require("react"));
|
|
5328
5725
|
|
|
5329
5726
|
// src/components/hooks/useOnScroll.ts
|
|
5330
|
-
var
|
|
5727
|
+
var import_react28 = __toModule(require("react"));
|
|
5331
5728
|
var useOnScroll = (domRef, onScroll) => {
|
|
5332
|
-
(0,
|
|
5729
|
+
(0, import_react28.useEffect)(() => {
|
|
5333
5730
|
const domNode = domRef == null ? void 0 : domRef.current;
|
|
5334
5731
|
const scrollFn = (event) => {
|
|
5335
5732
|
const node = event.target;
|
|
@@ -5375,7 +5772,7 @@ var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2
|
|
|
5375
5772
|
className,
|
|
5376
5773
|
style
|
|
5377
5774
|
} = props;
|
|
5378
|
-
const domRef = ref != null ? ref : (0,
|
|
5775
|
+
const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
|
|
5379
5776
|
useOnScroll(domRef, onContainerScroll);
|
|
5380
5777
|
return /* @__PURE__ */ React22.createElement("div", {
|
|
5381
5778
|
ref: domRef,
|
|
@@ -5410,14 +5807,14 @@ var import_react41 = __toModule(require("react"));
|
|
|
5410
5807
|
|
|
5411
5808
|
// src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
|
|
5412
5809
|
var React29 = __toModule(require("react"));
|
|
5413
|
-
var
|
|
5810
|
+
var import_react33 = __toModule(require("react"));
|
|
5414
5811
|
|
|
5415
5812
|
// src/components/VirtualList/VirtualRowList.tsx
|
|
5416
5813
|
var React25 = __toModule(require("react"));
|
|
5417
5814
|
|
|
5418
5815
|
// src/components/VirtualList/VirtualList.tsx
|
|
5419
5816
|
var React24 = __toModule(require("react"));
|
|
5420
|
-
var
|
|
5817
|
+
var import_react30 = __toModule(require("react"));
|
|
5421
5818
|
|
|
5422
5819
|
// src/components/VirtualList/VirtualList.css.ts
|
|
5423
5820
|
var VirtualListCls = "_16lm1iw1 _16lm1iw8 _16lm1iw0";
|
|
@@ -5428,7 +5825,7 @@ var scrollTransformTargetCls = "mlx2t3";
|
|
|
5428
5825
|
var UPDATE_SCROLL2 = (node, scrollPosition) => {
|
|
5429
5826
|
node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
|
|
5430
5827
|
};
|
|
5431
|
-
var
|
|
5828
|
+
var debug4 = dbg("VirtuaList");
|
|
5432
5829
|
var rootClassName7 = "InfiniteList";
|
|
5433
5830
|
var VirtualList = (props) => {
|
|
5434
5831
|
const _a = props, {
|
|
@@ -5460,15 +5857,15 @@ var VirtualList = (props) => {
|
|
|
5460
5857
|
"onContainerScroll",
|
|
5461
5858
|
"children"
|
|
5462
5859
|
]);
|
|
5463
|
-
const domRef = (0,
|
|
5860
|
+
const domRef = (0, import_react30.useRef)(null);
|
|
5464
5861
|
const [, rerender] = useRerender();
|
|
5465
|
-
const [totalSize, setTotalSize] = (0,
|
|
5466
|
-
const renderCountRef = (0,
|
|
5467
|
-
(0,
|
|
5862
|
+
const [totalSize, setTotalSize] = (0, import_react30.useState)(0);
|
|
5863
|
+
const renderCountRef = (0, import_react30.useRef)(0);
|
|
5864
|
+
(0, import_react30.useEffect)(() => {
|
|
5468
5865
|
const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
|
|
5469
5866
|
renderCountRef.current = renderCount;
|
|
5470
5867
|
if (true) {
|
|
5471
|
-
|
|
5868
|
+
debug4.extend(mainAxis)(`Render count change ${renderCount}`);
|
|
5472
5869
|
}
|
|
5473
5870
|
rerender();
|
|
5474
5871
|
});
|
|
@@ -5483,7 +5880,7 @@ var VirtualList = (props) => {
|
|
|
5483
5880
|
removeOnTotalSizeChange();
|
|
5484
5881
|
};
|
|
5485
5882
|
}, [virtualBrain]);
|
|
5486
|
-
(0,
|
|
5883
|
+
(0, import_react30.useEffect)(() => {
|
|
5487
5884
|
const onScroll = (scrollPosition) => {
|
|
5488
5885
|
UPDATE_SCROLL2(domRef.current, scrollPosition);
|
|
5489
5886
|
};
|
|
@@ -5537,7 +5934,7 @@ var VirtualRowList = (props) => {
|
|
|
5537
5934
|
|
|
5538
5935
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
|
|
5539
5936
|
var React27 = __toModule(require("react"));
|
|
5540
|
-
var
|
|
5937
|
+
var import_react32 = __toModule(require("react"));
|
|
5541
5938
|
|
|
5542
5939
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
5543
5940
|
var React26 = __toModule(require("react"));
|
|
@@ -5565,6 +5962,9 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5565
5962
|
}
|
|
5566
5963
|
const { data, isGroupRow, groupBy } = rowInfo;
|
|
5567
5964
|
const groupRowInfo = null;
|
|
5965
|
+
if (rowInfo.indexInAll === 0 && column.groupByField && column.groupByField === "stack") {
|
|
5966
|
+
debugger;
|
|
5967
|
+
}
|
|
5568
5968
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
5569
5969
|
if (column.valueGetter) {
|
|
5570
5970
|
value = column.valueGetter(isGroupRow ? {
|
|
@@ -5647,7 +6047,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5647
6047
|
var InfiniteTableColumnCell = React26.memo(InfiniteTableColumnCellFn);
|
|
5648
6048
|
|
|
5649
6049
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
|
|
5650
|
-
var
|
|
6050
|
+
var import_react31 = __toModule(require("react"));
|
|
5651
6051
|
|
|
5652
6052
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
|
|
5653
6053
|
var { rootClassName: rootClassName9 } = internalProps;
|
|
@@ -5672,8 +6072,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5672
6072
|
domRef: domRefFromProps,
|
|
5673
6073
|
rowInfo
|
|
5674
6074
|
} = props;
|
|
5675
|
-
const domRef = (0,
|
|
5676
|
-
const rowDOMRef = (0,
|
|
6075
|
+
const domRef = (0, import_react31.useRef)(null);
|
|
6076
|
+
const rowDOMRef = (0, import_react31.useCallback)((node) => {
|
|
5677
6077
|
domRefFromProps(node);
|
|
5678
6078
|
domRef.current = node;
|
|
5679
6079
|
}, []);
|
|
@@ -5704,7 +6104,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5704
6104
|
}), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
|
|
5705
6105
|
const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
|
|
5706
6106
|
const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
|
|
5707
|
-
const onMouseEnter = (0,
|
|
6107
|
+
const onMouseEnter = (0, import_react31.useCallback)((event) => {
|
|
5708
6108
|
var _a;
|
|
5709
6109
|
initialMouseEnter == null ? void 0 : initialMouseEnter(event);
|
|
5710
6110
|
const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
|
|
@@ -5718,7 +6118,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
|
|
|
5718
6118
|
const rows = parentNode.querySelectorAll(hoverSelector.join(","));
|
|
5719
6119
|
rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
|
|
5720
6120
|
}, [initialMouseEnter, showHoverRows]);
|
|
5721
|
-
const onMouseLeave = (0,
|
|
6121
|
+
const onMouseLeave = (0, import_react31.useCallback)((event) => {
|
|
5722
6122
|
var _a;
|
|
5723
6123
|
initialMouseLeave == null ? void 0 : initialMouseLeave(event);
|
|
5724
6124
|
const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
|
|
@@ -5774,7 +6174,7 @@ function InfiniteTableRowFn(props) {
|
|
|
5774
6174
|
width: rowWidth,
|
|
5775
6175
|
height: rowHeight
|
|
5776
6176
|
}, domProps.style);
|
|
5777
|
-
const renderCellRef = (0,
|
|
6177
|
+
const renderCellRef = (0, import_react32.useRef)(null);
|
|
5778
6178
|
const renderCell = React27.useCallback(({ domRef, itemIndex }) => {
|
|
5779
6179
|
const column = columns[itemIndex];
|
|
5780
6180
|
if (!column) {
|
|
@@ -5878,7 +6278,7 @@ function useUnpinnedRendering(params) {
|
|
|
5878
6278
|
} = params;
|
|
5879
6279
|
const { virtualizeColumns } = getState();
|
|
5880
6280
|
const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
|
|
5881
|
-
const renderRowUnpinned = (0,
|
|
6281
|
+
const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
|
|
5882
6282
|
const dataArray = getData();
|
|
5883
6283
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
5884
6284
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -5944,7 +6344,7 @@ function useUnpinnedRendering(params) {
|
|
|
5944
6344
|
}
|
|
5945
6345
|
|
|
5946
6346
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5947
|
-
var
|
|
6347
|
+
var import_react34 = __toModule(require("react"));
|
|
5948
6348
|
|
|
5949
6349
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
5950
6350
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
@@ -5957,7 +6357,6 @@ var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf",
|
|
|
5957
6357
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5958
6358
|
|
|
5959
6359
|
// src/components/InfiniteTable/hooks/useOnContainerScroll.ts
|
|
5960
|
-
var DELAY = 200;
|
|
5961
6360
|
var TableClassName = internalProps.rootClassName;
|
|
5962
6361
|
var TableClassName__Scrolling = `${TableClassName}--scrolling`;
|
|
5963
6362
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
@@ -5968,23 +6367,33 @@ var useOnContainerScroll = ({
|
|
|
5968
6367
|
}) => {
|
|
5969
6368
|
const {
|
|
5970
6369
|
componentState: {
|
|
6370
|
+
scrollStopDelay,
|
|
5971
6371
|
scrollerDOMRef,
|
|
5972
6372
|
domRef,
|
|
5973
6373
|
scrollToBottomOffset,
|
|
5974
6374
|
onScrollToBottom,
|
|
5975
6375
|
onScrollToTop,
|
|
6376
|
+
onScrollStop: onScrollStopFromProps,
|
|
5976
6377
|
bodySize
|
|
5977
6378
|
}
|
|
5978
6379
|
} = useInfiniteTable();
|
|
5979
|
-
const {
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
6380
|
+
const {
|
|
6381
|
+
componentActions: dataSourceActions,
|
|
6382
|
+
getState: getDataSourceState,
|
|
6383
|
+
componentState: { notifyScrollStop }
|
|
6384
|
+
} = useDataSourceContextValue();
|
|
6385
|
+
const onScrollStop = (0, import_react34.useCallback)((param) => {
|
|
6386
|
+
onScrollStopFromProps == null ? void 0 : onScrollStopFromProps(param);
|
|
6387
|
+
notifyScrollStop(param);
|
|
6388
|
+
}, [onScrollStopFromProps, notifyScrollStop]);
|
|
6389
|
+
const timeoutIdRef = (0, import_react34.useRef)(0);
|
|
6390
|
+
const scrollingRef = (0, import_react34.useRef)(false);
|
|
6391
|
+
const scrollTopMaxRef = (0, import_react34.useRef)(0);
|
|
6392
|
+
(0, import_react34.useEffect)(() => {
|
|
5984
6393
|
const { current: node } = scrollerDOMRef;
|
|
5985
6394
|
scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
|
|
5986
6395
|
}, [reservedContentHeight, bodySize.height]);
|
|
5987
|
-
const setScrolling = (0,
|
|
6396
|
+
const setScrolling = (0, import_react34.useCallback)((scrolling) => {
|
|
5988
6397
|
var _a;
|
|
5989
6398
|
const prevScrolling = scrollingRef.current;
|
|
5990
6399
|
scrollingRef.current = scrolling;
|
|
@@ -5995,9 +6404,17 @@ var useOnContainerScroll = ({
|
|
|
5995
6404
|
timeoutIdRef.current = setTimeout(() => {
|
|
5996
6405
|
setScrolling(false);
|
|
5997
6406
|
timeoutIdRef.current = 0;
|
|
5998
|
-
},
|
|
6407
|
+
}, scrollStopDelay);
|
|
5999
6408
|
}
|
|
6000
6409
|
if (prevScrolling !== scrolling) {
|
|
6410
|
+
if (!scrolling) {
|
|
6411
|
+
const range = verticalVirtualBrain.getRenderRange();
|
|
6412
|
+
onScrollStop({
|
|
6413
|
+
scrollTop: scrollPositionRef.current.scrollTop,
|
|
6414
|
+
firstVisibleRowIndex: range.renderStartIndex,
|
|
6415
|
+
lastVisibleRowIndex: range.renderEndIndex
|
|
6416
|
+
});
|
|
6417
|
+
}
|
|
6001
6418
|
const classList = (_a = domRef.current) == null ? void 0 : _a.classList;
|
|
6002
6419
|
if (!classList) {
|
|
6003
6420
|
return;
|
|
@@ -6008,8 +6425,8 @@ var useOnContainerScroll = ({
|
|
|
6008
6425
|
classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
|
|
6009
6426
|
}
|
|
6010
6427
|
}
|
|
6011
|
-
}, []);
|
|
6012
|
-
const onContainerScroll = (0,
|
|
6428
|
+
}, [scrollStopDelay, onScrollStop]);
|
|
6429
|
+
const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
|
|
6013
6430
|
verticalVirtualBrain.setScrollPosition(scrollInfo);
|
|
6014
6431
|
horizontalVirtualBrain.setScrollPosition(scrollInfo);
|
|
6015
6432
|
setScrolling(true);
|
|
@@ -6019,15 +6436,15 @@ var useOnContainerScroll = ({
|
|
|
6019
6436
|
domRef.current,
|
|
6020
6437
|
setScrolling
|
|
6021
6438
|
]);
|
|
6022
|
-
const scrollPositionRef = (0,
|
|
6439
|
+
const scrollPositionRef = (0, import_react34.useRef)({
|
|
6023
6440
|
scrollLeft: 0,
|
|
6024
6441
|
scrollTop: 0
|
|
6025
6442
|
});
|
|
6026
|
-
const applyScrollHorizontal = (0,
|
|
6443
|
+
const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
|
|
6027
6444
|
scrollPositionRef.current.scrollLeft = scrollLeft;
|
|
6028
6445
|
onContainerScroll(scrollPositionRef.current);
|
|
6029
6446
|
}, [onContainerScroll]);
|
|
6030
|
-
const applyScrollVertical = (0,
|
|
6447
|
+
const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
|
|
6031
6448
|
scrollPositionRef.current.scrollTop = scrollTop;
|
|
6032
6449
|
onContainerScroll(scrollPositionRef.current);
|
|
6033
6450
|
if (scrollTop === 0) {
|
|
@@ -6038,7 +6455,7 @@ var useOnContainerScroll = ({
|
|
|
6038
6455
|
if (isScrollBottom) {
|
|
6039
6456
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
6040
6457
|
if (getDataSourceState().livePagination) {
|
|
6041
|
-
dataSourceActions.
|
|
6458
|
+
dataSourceActions.cursorId = Date.now();
|
|
6042
6459
|
}
|
|
6043
6460
|
}
|
|
6044
6461
|
}, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
|
|
@@ -6050,16 +6467,16 @@ var useOnContainerScroll = ({
|
|
|
6050
6467
|
|
|
6051
6468
|
// src/components/InfiniteTable/hooks/usePinnedRendering.tsx
|
|
6052
6469
|
var React31 = __toModule(require("react"));
|
|
6053
|
-
var
|
|
6470
|
+
var import_react37 = __toModule(require("react"));
|
|
6054
6471
|
|
|
6055
6472
|
// src/components/VirtualList/RowListWithExternalScrolling.tsx
|
|
6056
6473
|
var React30 = __toModule(require("react"));
|
|
6057
|
-
var
|
|
6474
|
+
var import_react36 = __toModule(require("react"));
|
|
6058
6475
|
|
|
6059
6476
|
// src/components/hooks/useOnMount.ts
|
|
6060
|
-
var
|
|
6477
|
+
var import_react35 = __toModule(require("react"));
|
|
6061
6478
|
function useOnMount(domRef, props) {
|
|
6062
|
-
(0,
|
|
6479
|
+
(0, import_react35.useEffect)(() => {
|
|
6063
6480
|
const { onMount, onUnmount } = props;
|
|
6064
6481
|
const node = domRef == null ? void 0 : domRef.current;
|
|
6065
6482
|
onMount == null ? void 0 : onMount(node);
|
|
@@ -6090,8 +6507,8 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
6090
6507
|
onMount,
|
|
6091
6508
|
onUnmount
|
|
6092
6509
|
} = props;
|
|
6093
|
-
const domRef = (0,
|
|
6094
|
-
const renderItem = (0,
|
|
6510
|
+
const domRef = (0, import_react36.useRef)(null);
|
|
6511
|
+
const renderItem = (0, import_react36.useCallback)((renderProps) => renderRow({
|
|
6095
6512
|
domRef: renderProps.domRef,
|
|
6096
6513
|
rowHeight: renderProps.itemSize,
|
|
6097
6514
|
rowIndex: renderProps.itemIndex
|
|
@@ -6100,7 +6517,7 @@ var RowListWithExternalScrolling = (props) => {
|
|
|
6100
6517
|
onMount,
|
|
6101
6518
|
onUnmount
|
|
6102
6519
|
});
|
|
6103
|
-
(0,
|
|
6520
|
+
(0, import_react36.useEffect)(() => {
|
|
6104
6521
|
const onScroll = (scrollPosition) => {
|
|
6105
6522
|
const node = domRef.current;
|
|
6106
6523
|
if (node) {
|
|
@@ -6167,7 +6584,7 @@ function PinnedRowsContainer(props) {
|
|
|
6167
6584
|
}
|
|
6168
6585
|
return result;
|
|
6169
6586
|
}, [height, rowWidth, pinning, hasOverflow]);
|
|
6170
|
-
const updateScroll = (0,
|
|
6587
|
+
const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
|
|
6171
6588
|
UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
|
|
6172
6589
|
}, [hasOverflow, pinnedScrollListener]);
|
|
6173
6590
|
const rowListProps = {
|
|
@@ -6209,7 +6626,7 @@ function PinnedRowsContainer(props) {
|
|
|
6209
6626
|
}
|
|
6210
6627
|
function useRenderPinnedRow(params) {
|
|
6211
6628
|
const { getData, getState, columnsWidth, columns, verticalBrain } = params;
|
|
6212
|
-
const renderPinnedRow = (0,
|
|
6629
|
+
const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
|
|
6213
6630
|
const dataArray = getData();
|
|
6214
6631
|
const rowInfo = dataArray[rowParams.rowIndex];
|
|
6215
6632
|
const { showZebraRows, showHoverRows } = getState();
|
|
@@ -6325,6 +6742,15 @@ function usePinnedStartRendering(params) {
|
|
|
6325
6742
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
6326
6743
|
var import_react40 = __toModule(require("react"));
|
|
6327
6744
|
|
|
6745
|
+
// src/components/hooks/useOnce.ts
|
|
6746
|
+
var import_react38 = __toModule(require("react"));
|
|
6747
|
+
function useOnce(fn) {
|
|
6748
|
+
const onceFn = (0, import_react38.useMemo)(() => {
|
|
6749
|
+
return once(fn);
|
|
6750
|
+
}, []);
|
|
6751
|
+
return onceFn();
|
|
6752
|
+
}
|
|
6753
|
+
|
|
6328
6754
|
// src/components/VirtualBrain/index.ts
|
|
6329
6755
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
6330
6756
|
var initialScrollPosition2 = {
|
|
@@ -7215,7 +7641,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7215
7641
|
const valid = (0, import_react43.useMemo)(() => {
|
|
7216
7642
|
let valid2 = isValidLicense(licenseKey, {
|
|
7217
7643
|
publishedAt: 1624970570587,
|
|
7218
|
-
version: "0.1
|
|
7644
|
+
version: "0.2.1"
|
|
7219
7645
|
});
|
|
7220
7646
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7221
7647
|
return true;
|
|
@@ -7229,7 +7655,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7229
7655
|
var React33 = __toModule(require("react"));
|
|
7230
7656
|
var import_react44 = __toModule(require("react"));
|
|
7231
7657
|
var error = err("CSSVariableWatch");
|
|
7232
|
-
var
|
|
7658
|
+
var debug5 = dbg("CSSVariableWatch");
|
|
7233
7659
|
var WRAPPER_STYLE = {
|
|
7234
7660
|
position: "absolute",
|
|
7235
7661
|
pointerEvents: "none",
|
|
@@ -7252,7 +7678,7 @@ var useCSSVariableWatch = (params) => {
|
|
|
7252
7678
|
const value = params.ref.current.getBoundingClientRect().height;
|
|
7253
7679
|
if (value) {
|
|
7254
7680
|
lastValueRef.current = value;
|
|
7255
|
-
|
|
7681
|
+
debug5(`Variable ${params.varName} found and equals ${value}.`);
|
|
7256
7682
|
params.onChange(value);
|
|
7257
7683
|
} else {
|
|
7258
7684
|
error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
|
|
@@ -7410,7 +7836,8 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
|
7410
7836
|
} = useInfiniteTable();
|
|
7411
7837
|
const {
|
|
7412
7838
|
componentState: { dataArray, loading },
|
|
7413
|
-
getState: getDataSourceState
|
|
7839
|
+
getState: getDataSourceState,
|
|
7840
|
+
componentActions: dataSourceActions
|
|
7414
7841
|
} = useDataSourceContextValue();
|
|
7415
7842
|
const {
|
|
7416
7843
|
domRef,
|
|
@@ -7423,7 +7850,8 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
|
7423
7850
|
onHeaderHeightCSSVarChange,
|
|
7424
7851
|
rowHeightCSSVar,
|
|
7425
7852
|
headerHeightCSSVar,
|
|
7426
|
-
components
|
|
7853
|
+
components,
|
|
7854
|
+
scrollStopDelay
|
|
7427
7855
|
} = componentState;
|
|
7428
7856
|
const { columnShifts, bodySize } = componentState;
|
|
7429
7857
|
const {
|
|
@@ -7436,6 +7864,7 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
|
7436
7864
|
scrollbars,
|
|
7437
7865
|
applyScrollVertical,
|
|
7438
7866
|
horizontalVirtualBrain,
|
|
7867
|
+
verticalVirtualBrain,
|
|
7439
7868
|
reservedContentHeight
|
|
7440
7869
|
} = useListRendering({
|
|
7441
7870
|
getComputed,
|
|
@@ -7444,6 +7873,13 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
|
7444
7873
|
bodySize,
|
|
7445
7874
|
computed
|
|
7446
7875
|
});
|
|
7876
|
+
React35.useEffect(() => {
|
|
7877
|
+
const dataSourceState = getDataSourceState();
|
|
7878
|
+
const onChange = debounce((renderRange) => {
|
|
7879
|
+
dataSourceState.notifyRenderRangeChange(renderRange);
|
|
7880
|
+
}, { wait: scrollStopDelay });
|
|
7881
|
+
return verticalVirtualBrain.onRenderRangeChange(onChange);
|
|
7882
|
+
}, [verticalVirtualBrain, scrollStopDelay]);
|
|
7447
7883
|
const licenseValid = useLicense(licenseKey);
|
|
7448
7884
|
const domProps = useDOMProps(componentState.domProps);
|
|
7449
7885
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
@@ -7456,6 +7892,9 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
|
|
|
7456
7892
|
}
|
|
7457
7893
|
notifyScrollbarsChange(scrollbars);
|
|
7458
7894
|
}, [scrollbars]);
|
|
7895
|
+
React35.useEffect(() => {
|
|
7896
|
+
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
7897
|
+
}, [scrollStopDelay]);
|
|
7459
7898
|
return /* @__PURE__ */ React35.createElement("div", __spreadValues({
|
|
7460
7899
|
ref: domRef
|
|
7461
7900
|
}, domProps), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
|