@infinite-table/infinite-react 0.4.10 → 0.4.11
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.d.ts +1 -1
- package/index.esm.js +66 -42
- package/index.js +66 -42
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1170,7 +1170,6 @@ interface DataSourceMappedState<T> {
|
|
|
1170
1170
|
primaryKey: DataSourceProps<T>['primaryKey'];
|
|
1171
1171
|
filterDelay: NonUndefined<DataSourceProps<T>['filterDelay']>;
|
|
1172
1172
|
groupBy: NonUndefined<DataSourceProps<T>['groupBy']>;
|
|
1173
|
-
groupRowsState: GroupRowsState<T>;
|
|
1174
1173
|
pivotBy: DataSourceProps<T>['pivotBy'];
|
|
1175
1174
|
loading: NonUndefined<DataSourceProps<T>['loading']>;
|
|
1176
1175
|
sortTypes: NonUndefined<DataSourceProps<T>['sortTypes']>;
|
|
@@ -1384,6 +1383,7 @@ declare type DataSourceDerivedState<T> = {
|
|
|
1384
1383
|
toPrimaryKey: (data: T) => any;
|
|
1385
1384
|
operatorsByFilterType: Record<string, Record<string, DataSourceFilterOperator<T>>>;
|
|
1386
1385
|
filterMode: NonUndefined<DataSourceProps<T>['filterMode']>;
|
|
1386
|
+
groupRowsState: GroupRowsState<T>;
|
|
1387
1387
|
multiSort: boolean;
|
|
1388
1388
|
controlledSort: boolean;
|
|
1389
1389
|
controlledFilter: boolean;
|
package/index.esm.js
CHANGED
|
@@ -4360,6 +4360,10 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4360
4360
|
if (extraFlags.rowSelected) {
|
|
4361
4361
|
result.push(...baseClasses.map((c) => `${c}--row-selected`));
|
|
4362
4362
|
}
|
|
4363
|
+
if (extraFlags.groupRow) {
|
|
4364
|
+
result.push(...baseClasses.map((c) => `${c}--group-row`));
|
|
4365
|
+
result.push(...baseClasses.map((c) => `${c}--${extraFlags.rowExpanded ? "group-row-expanded" : "group-row-collapsed"}`));
|
|
4366
|
+
}
|
|
4363
4367
|
if (column.computedPinned) {
|
|
4364
4368
|
result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
|
|
4365
4369
|
} else {
|
|
@@ -5906,7 +5910,14 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5906
5910
|
onClick,
|
|
5907
5911
|
onMouseDown,
|
|
5908
5912
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
5909
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, {
|
|
5913
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, {
|
|
5914
|
+
dragging: false,
|
|
5915
|
+
zebra,
|
|
5916
|
+
rowActive,
|
|
5917
|
+
rowSelected,
|
|
5918
|
+
groupRow: rowInfo.isGroupRow,
|
|
5919
|
+
rowExpanded: rowInfo.isGroupRow ? !rowInfo.collapsed : false
|
|
5920
|
+
}), colClassName, rowComputedClassName),
|
|
5910
5921
|
renderChildren
|
|
5911
5922
|
};
|
|
5912
5923
|
return /* @__PURE__ */ createElement18(InfiniteTableCell, __spreadValues({}, cellProps));
|
|
@@ -6954,7 +6965,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6954
6965
|
dragging,
|
|
6955
6966
|
rowSelected: false,
|
|
6956
6967
|
zebra: false,
|
|
6957
|
-
rowActive: false
|
|
6968
|
+
rowActive: false,
|
|
6969
|
+
groupRow: false,
|
|
6970
|
+
rowExpanded: false
|
|
6958
6971
|
}), CellCls),
|
|
6959
6972
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
6960
6973
|
afterChildren: /* @__PURE__ */ createElement25(Fragment3, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement25(InfiniteTableColumnHeaderFilter, {
|
|
@@ -7696,6 +7709,14 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7696
7709
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
7697
7710
|
if (current) {
|
|
7698
7711
|
current.items = dataArray;
|
|
7712
|
+
for (let i = 0, len = currentGroupKeys.length; i < len; i++) {
|
|
7713
|
+
const currentKeys = currentGroupKeys.slice(0, i);
|
|
7714
|
+
const deepMapGroupValue = deepMap.get(currentKeys);
|
|
7715
|
+
if (deepMapGroupValue) {
|
|
7716
|
+
deepMapGroupValue.items = deepMapGroupValue.items || [];
|
|
7717
|
+
deepMapGroupValue.items = deepMapGroupValue.items.concat(dataArray);
|
|
7718
|
+
}
|
|
7719
|
+
}
|
|
7699
7720
|
indexer.indexArray(dataArray, toPrimaryKey);
|
|
7700
7721
|
}
|
|
7701
7722
|
return next == null ? void 0 : next();
|
|
@@ -7716,7 +7737,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7716
7737
|
continue;
|
|
7717
7738
|
}
|
|
7718
7739
|
const dataObject = dataArray[i].data;
|
|
7719
|
-
const dataKeys = dataArray[i].keys;
|
|
7740
|
+
const dataKeys = dataArray[i].keys || [];
|
|
7720
7741
|
if (dataKeys.length) {
|
|
7721
7742
|
const key = dataKeys[dataKeys.length - 1];
|
|
7722
7743
|
currentGroupKeys.push(key);
|
|
@@ -7894,7 +7915,7 @@ function flatten(groupResult) {
|
|
|
7894
7915
|
}
|
|
7895
7916
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
7896
7917
|
var _a;
|
|
7897
|
-
const { groupBy, groupKeys,
|
|
7918
|
+
const { groupBy, groupKeys, parents, reducers, lazyLoad } = options;
|
|
7898
7919
|
const groupNesting = groupKeys.length;
|
|
7899
7920
|
const {
|
|
7900
7921
|
items: groupItems,
|
|
@@ -7929,7 +7950,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
7929
7950
|
selectedChildredCount: 0,
|
|
7930
7951
|
deselectedChildredCount: 0,
|
|
7931
7952
|
id: `${groupKeys}`,
|
|
7932
|
-
collapsed,
|
|
7953
|
+
collapsed: false,
|
|
7933
7954
|
dataSourceHasGrouping: true,
|
|
7934
7955
|
selfLoaded,
|
|
7935
7956
|
error: options.error,
|
|
@@ -7988,7 +8009,7 @@ function enhancedFlatten(param) {
|
|
|
7988
8009
|
var _a, _b;
|
|
7989
8010
|
const items = deepMapValue.items;
|
|
7990
8011
|
const groupNesting = groupKeys.length;
|
|
7991
|
-
|
|
8012
|
+
let collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
7992
8013
|
indexInParentGroups.push(indexInGroup);
|
|
7993
8014
|
const enhancedGroupData = getEnhancedGroupData({
|
|
7994
8015
|
lazyLoad,
|
|
@@ -8001,11 +8022,10 @@ function enhancedFlatten(param) {
|
|
|
8001
8022
|
groupKeys,
|
|
8002
8023
|
error: deepMapValue.error,
|
|
8003
8024
|
totalChildrenCount: deepMapValue.totalChildrenCount,
|
|
8004
|
-
childrenLoading: deepMapValue.childrenLoading,
|
|
8025
|
+
childrenLoading: (deepMapValue.childrenLoading || !collapsed && !deepMapValue.childrenAvailable) && lazyLoad,
|
|
8005
8026
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
8006
8027
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
8007
|
-
directChildrenLoadedCount: 0
|
|
8008
|
-
collapsed
|
|
8028
|
+
directChildrenLoadedCount: 0
|
|
8009
8029
|
}, deepMapValue);
|
|
8010
8030
|
if (isRowSelected) {
|
|
8011
8031
|
enhancedGroupData.rowSelected = isRowSelected(enhancedGroupData);
|
|
@@ -8017,6 +8037,10 @@ function enhancedFlatten(param) {
|
|
|
8017
8037
|
}
|
|
8018
8038
|
const parent = parents[parents.length - 1];
|
|
8019
8039
|
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
8040
|
+
if (parentCollapsed) {
|
|
8041
|
+
collapsed = true;
|
|
8042
|
+
}
|
|
8043
|
+
enhancedGroupData.collapsed = collapsed;
|
|
8020
8044
|
let include = generateGroupRows || collapsed;
|
|
8021
8045
|
if (parentCollapsed) {
|
|
8022
8046
|
include = false;
|
|
@@ -8024,27 +8048,16 @@ function enhancedFlatten(param) {
|
|
|
8024
8048
|
if (include) {
|
|
8025
8049
|
result.push(enhancedGroupData);
|
|
8026
8050
|
}
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
}
|
|
8033
|
-
parent2.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
8034
|
-
parent2.collapsedGroupsCount += 1;
|
|
8035
|
-
});
|
|
8036
|
-
} else {
|
|
8037
|
-
if (!parentCollapsed) {
|
|
8038
|
-
parents.forEach((parent2) => {
|
|
8039
|
-
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
8040
|
-
});
|
|
8041
|
-
}
|
|
8042
|
-
}
|
|
8051
|
+
enhancedGroupData.collapsedChildrenCount = 0;
|
|
8052
|
+
parents.forEach((parent2) => {
|
|
8053
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
8054
|
+
parent2.collapsedGroupsCount += collapsed ? 1 : 0;
|
|
8055
|
+
});
|
|
8043
8056
|
if (parent && enhancedGroupData.selfLoaded && lazyLoad) {
|
|
8044
8057
|
parent.directChildrenLoadedCount += 1;
|
|
8045
8058
|
}
|
|
8046
8059
|
parents.push(enhancedGroupData);
|
|
8047
|
-
const continueWithChildren =
|
|
8060
|
+
const continueWithChildren = true;
|
|
8048
8061
|
if (continueWithChildren) {
|
|
8049
8062
|
if (!next) {
|
|
8050
8063
|
if (!pivot) {
|
|
@@ -8082,9 +8095,10 @@ function enhancedFlatten(param) {
|
|
|
8082
8095
|
if (last && item) {
|
|
8083
8096
|
parent2.directChildrenLoadedCount += 1;
|
|
8084
8097
|
}
|
|
8085
|
-
if (
|
|
8086
|
-
parent2.
|
|
8098
|
+
if (collapsed) {
|
|
8099
|
+
parent2.collapsedChildrenCount += 1;
|
|
8087
8100
|
}
|
|
8101
|
+
parent2.deepRowInfoArray.push(rowInfo);
|
|
8088
8102
|
});
|
|
8089
8103
|
if (!collapsed) {
|
|
8090
8104
|
result[startIndex + index] = rowInfo;
|
|
@@ -8753,8 +8767,10 @@ function useLazyLoadRange() {
|
|
|
8753
8767
|
const {
|
|
8754
8768
|
lazyLoadBatchSize,
|
|
8755
8769
|
lazyLoad,
|
|
8770
|
+
originalLazyGroupDataChangeDetect,
|
|
8756
8771
|
notifyRenderRangeChange,
|
|
8757
8772
|
dataArray,
|
|
8773
|
+
groupRowsState,
|
|
8758
8774
|
scrollStopDelayUpdatedByTable
|
|
8759
8775
|
} = componentState;
|
|
8760
8776
|
const latestRenderRangeRef = useRef18(null);
|
|
@@ -8783,20 +8799,27 @@ function useLazyLoadRange() {
|
|
|
8783
8799
|
}, cache);
|
|
8784
8800
|
};
|
|
8785
8801
|
const debouncedLoadRange = useMemo7(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
8786
|
-
|
|
8802
|
+
useEffectWithChanges((changes) => {
|
|
8787
8803
|
if (lazyLoad) {
|
|
8804
|
+
if (changes.originalLazyGroupDataChangeDetect || changes.groupRowsState) {
|
|
8805
|
+
loadRange(notifyRenderRangeChange.get());
|
|
8806
|
+
}
|
|
8788
8807
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
8789
8808
|
latestRenderRangeRef.current = renderRange;
|
|
8790
8809
|
loadRange(renderRange);
|
|
8791
8810
|
});
|
|
8792
8811
|
}
|
|
8793
8812
|
return;
|
|
8794
|
-
},
|
|
8813
|
+
}, {
|
|
8814
|
+
lazyLoadBatchSize,
|
|
8815
|
+
lazyLoad,
|
|
8816
|
+
originalLazyGroupDataChangeDetect,
|
|
8817
|
+
groupRowsState
|
|
8818
|
+
});
|
|
8795
8819
|
useEffect17(() => {
|
|
8796
8820
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
8797
8821
|
debouncedLoadRange();
|
|
8798
8822
|
}
|
|
8799
|
-
return;
|
|
8800
8823
|
}, [dataArray]);
|
|
8801
8824
|
}
|
|
8802
8825
|
function lazyLoadRange(options, cache) {
|
|
@@ -9673,16 +9696,7 @@ var forwardProps3 = (setupState) => {
|
|
|
9673
9696
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
9674
9697
|
loading: (loading) => loading != null ? loading : false,
|
|
9675
9698
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
9676
|
-
groupBy: (groupBy) => groupBy != null ? groupBy : []
|
|
9677
|
-
groupRowsState: (groupRowsState) => {
|
|
9678
|
-
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
9679
|
-
groupRowsState = new GroupRowsState(groupRowsState);
|
|
9680
|
-
}
|
|
9681
|
-
return groupRowsState || new GroupRowsState({
|
|
9682
|
-
expandedRows: true,
|
|
9683
|
-
collapsedRows: []
|
|
9684
|
-
});
|
|
9685
|
-
}
|
|
9699
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : []
|
|
9686
9700
|
};
|
|
9687
9701
|
};
|
|
9688
9702
|
function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
@@ -9741,8 +9755,17 @@ function mapPropsToState(params) {
|
|
|
9741
9755
|
}
|
|
9742
9756
|
const primaryKeyDescriptor = state.primaryKey;
|
|
9743
9757
|
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
|
|
9758
|
+
let groupRowsState = props.groupRowsState || state.groupRowsState || props.defaultGroupRowsState;
|
|
9759
|
+
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
9760
|
+
groupRowsState = new GroupRowsState(groupRowsState);
|
|
9761
|
+
}
|
|
9762
|
+
groupRowsState = groupRowsState || new GroupRowsState(state.lazyLoad ? { expandedRows: [], collapsedRows: true } : {
|
|
9763
|
+
expandedRows: true,
|
|
9764
|
+
collapsedRows: []
|
|
9765
|
+
});
|
|
9744
9766
|
const result = {
|
|
9745
9767
|
selectionMode,
|
|
9768
|
+
groupRowsState,
|
|
9746
9769
|
rowSelection: rowSelectionState,
|
|
9747
9770
|
toPrimaryKey,
|
|
9748
9771
|
operatorsByFilterType,
|
|
@@ -12491,7 +12514,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12491
12514
|
const valid = useMemo11(() => {
|
|
12492
12515
|
let valid2 = isValidLicense(licenseKey, {
|
|
12493
12516
|
publishedAt: 1624970570587,
|
|
12494
|
-
version: "0.4.
|
|
12517
|
+
version: "0.4.11"
|
|
12495
12518
|
});
|
|
12496
12519
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12497
12520
|
return true;
|
|
@@ -13410,3 +13433,4 @@ export {
|
|
|
13410
13433
|
useInfiniteColumnCell,
|
|
13411
13434
|
useInfiniteHeaderCell
|
|
13412
13435
|
};
|
|
13436
|
+
//!collapsed || lazyLoad;
|
package/index.js
CHANGED
|
@@ -4323,6 +4323,10 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4323
4323
|
if (extraFlags.rowSelected) {
|
|
4324
4324
|
result.push(...baseClasses.map((c) => `${c}--row-selected`));
|
|
4325
4325
|
}
|
|
4326
|
+
if (extraFlags.groupRow) {
|
|
4327
|
+
result.push(...baseClasses.map((c) => `${c}--group-row`));
|
|
4328
|
+
result.push(...baseClasses.map((c) => `${c}--${extraFlags.rowExpanded ? "group-row-expanded" : "group-row-collapsed"}`));
|
|
4329
|
+
}
|
|
4326
4330
|
if (column.computedPinned) {
|
|
4327
4331
|
result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
|
|
4328
4332
|
} else {
|
|
@@ -5849,7 +5853,14 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5849
5853
|
onClick,
|
|
5850
5854
|
onMouseDown,
|
|
5851
5855
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
5852
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, {
|
|
5856
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, {
|
|
5857
|
+
dragging: false,
|
|
5858
|
+
zebra,
|
|
5859
|
+
rowActive,
|
|
5860
|
+
rowSelected,
|
|
5861
|
+
groupRow: rowInfo.isGroupRow,
|
|
5862
|
+
rowExpanded: rowInfo.isGroupRow ? !rowInfo.collapsed : false
|
|
5863
|
+
}), colClassName, rowComputedClassName),
|
|
5853
5864
|
renderChildren
|
|
5854
5865
|
};
|
|
5855
5866
|
return /* @__PURE__ */ React21.createElement(InfiniteTableCell, __spreadValues({}, cellProps));
|
|
@@ -6886,7 +6897,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6886
6897
|
dragging,
|
|
6887
6898
|
rowSelected: false,
|
|
6888
6899
|
zebra: false,
|
|
6889
|
-
rowActive: false
|
|
6900
|
+
rowActive: false,
|
|
6901
|
+
groupRow: false,
|
|
6902
|
+
rowExpanded: false
|
|
6890
6903
|
}), CellCls),
|
|
6891
6904
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
6892
6905
|
afterChildren: /* @__PURE__ */ React28.createElement(React28.Fragment, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React28.createElement(InfiniteTableColumnHeaderFilter, {
|
|
@@ -7606,6 +7619,14 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7606
7619
|
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
7607
7620
|
if (current) {
|
|
7608
7621
|
current.items = dataArray;
|
|
7622
|
+
for (let i = 0, len = currentGroupKeys.length; i < len; i++) {
|
|
7623
|
+
const currentKeys = currentGroupKeys.slice(0, i);
|
|
7624
|
+
const deepMapGroupValue = deepMap.get(currentKeys);
|
|
7625
|
+
if (deepMapGroupValue) {
|
|
7626
|
+
deepMapGroupValue.items = deepMapGroupValue.items || [];
|
|
7627
|
+
deepMapGroupValue.items = deepMapGroupValue.items.concat(dataArray);
|
|
7628
|
+
}
|
|
7629
|
+
}
|
|
7609
7630
|
indexer.indexArray(dataArray, toPrimaryKey);
|
|
7610
7631
|
}
|
|
7611
7632
|
return next == null ? void 0 : next();
|
|
@@ -7626,7 +7647,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
7626
7647
|
continue;
|
|
7627
7648
|
}
|
|
7628
7649
|
const dataObject = dataArray[i].data;
|
|
7629
|
-
const dataKeys = dataArray[i].keys;
|
|
7650
|
+
const dataKeys = dataArray[i].keys || [];
|
|
7630
7651
|
if (dataKeys.length) {
|
|
7631
7652
|
const key = dataKeys[dataKeys.length - 1];
|
|
7632
7653
|
currentGroupKeys.push(key);
|
|
@@ -7804,7 +7825,7 @@ function flatten(groupResult) {
|
|
|
7804
7825
|
}
|
|
7805
7826
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
7806
7827
|
var _a;
|
|
7807
|
-
const { groupBy, groupKeys,
|
|
7828
|
+
const { groupBy, groupKeys, parents, reducers, lazyLoad } = options;
|
|
7808
7829
|
const groupNesting = groupKeys.length;
|
|
7809
7830
|
const {
|
|
7810
7831
|
items: groupItems,
|
|
@@ -7839,7 +7860,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
7839
7860
|
selectedChildredCount: 0,
|
|
7840
7861
|
deselectedChildredCount: 0,
|
|
7841
7862
|
id: `${groupKeys}`,
|
|
7842
|
-
collapsed,
|
|
7863
|
+
collapsed: false,
|
|
7843
7864
|
dataSourceHasGrouping: true,
|
|
7844
7865
|
selfLoaded,
|
|
7845
7866
|
error: options.error,
|
|
@@ -7898,7 +7919,7 @@ function enhancedFlatten(param) {
|
|
|
7898
7919
|
var _a, _b;
|
|
7899
7920
|
const items = deepMapValue.items;
|
|
7900
7921
|
const groupNesting = groupKeys.length;
|
|
7901
|
-
|
|
7922
|
+
let collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
|
|
7902
7923
|
indexInParentGroups.push(indexInGroup);
|
|
7903
7924
|
const enhancedGroupData = getEnhancedGroupData({
|
|
7904
7925
|
lazyLoad,
|
|
@@ -7911,11 +7932,10 @@ function enhancedFlatten(param) {
|
|
|
7911
7932
|
groupKeys,
|
|
7912
7933
|
error: deepMapValue.error,
|
|
7913
7934
|
totalChildrenCount: deepMapValue.totalChildrenCount,
|
|
7914
|
-
childrenLoading: deepMapValue.childrenLoading,
|
|
7935
|
+
childrenLoading: (deepMapValue.childrenLoading || !collapsed && !deepMapValue.childrenAvailable) && lazyLoad,
|
|
7915
7936
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
7916
7937
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
7917
|
-
directChildrenLoadedCount: 0
|
|
7918
|
-
collapsed
|
|
7938
|
+
directChildrenLoadedCount: 0
|
|
7919
7939
|
}, deepMapValue);
|
|
7920
7940
|
if (isRowSelected) {
|
|
7921
7941
|
enhancedGroupData.rowSelected = isRowSelected(enhancedGroupData);
|
|
@@ -7927,6 +7947,10 @@ function enhancedFlatten(param) {
|
|
|
7927
7947
|
}
|
|
7928
7948
|
const parent = parents[parents.length - 1];
|
|
7929
7949
|
const parentCollapsed = (_b = parent == null ? void 0 : parent.collapsed) != null ? _b : false;
|
|
7950
|
+
if (parentCollapsed) {
|
|
7951
|
+
collapsed = true;
|
|
7952
|
+
}
|
|
7953
|
+
enhancedGroupData.collapsed = collapsed;
|
|
7930
7954
|
let include = generateGroupRows || collapsed;
|
|
7931
7955
|
if (parentCollapsed) {
|
|
7932
7956
|
include = false;
|
|
@@ -7934,27 +7958,16 @@ function enhancedFlatten(param) {
|
|
|
7934
7958
|
if (include) {
|
|
7935
7959
|
result.push(enhancedGroupData);
|
|
7936
7960
|
}
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
}
|
|
7943
|
-
parent2.collapsedChildrenCount += enhancedGroupData.groupCount;
|
|
7944
|
-
parent2.collapsedGroupsCount += 1;
|
|
7945
|
-
});
|
|
7946
|
-
} else {
|
|
7947
|
-
if (!parentCollapsed) {
|
|
7948
|
-
parents.forEach((parent2) => {
|
|
7949
|
-
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
7950
|
-
});
|
|
7951
|
-
}
|
|
7952
|
-
}
|
|
7961
|
+
enhancedGroupData.collapsedChildrenCount = 0;
|
|
7962
|
+
parents.forEach((parent2) => {
|
|
7963
|
+
parent2.deepRowInfoArray.push(enhancedGroupData);
|
|
7964
|
+
parent2.collapsedGroupsCount += collapsed ? 1 : 0;
|
|
7965
|
+
});
|
|
7953
7966
|
if (parent && enhancedGroupData.selfLoaded && lazyLoad) {
|
|
7954
7967
|
parent.directChildrenLoadedCount += 1;
|
|
7955
7968
|
}
|
|
7956
7969
|
parents.push(enhancedGroupData);
|
|
7957
|
-
const continueWithChildren =
|
|
7970
|
+
const continueWithChildren = true;
|
|
7958
7971
|
if (continueWithChildren) {
|
|
7959
7972
|
if (!next) {
|
|
7960
7973
|
if (!pivot) {
|
|
@@ -7992,9 +8005,10 @@ function enhancedFlatten(param) {
|
|
|
7992
8005
|
if (last && item) {
|
|
7993
8006
|
parent2.directChildrenLoadedCount += 1;
|
|
7994
8007
|
}
|
|
7995
|
-
if (
|
|
7996
|
-
parent2.
|
|
8008
|
+
if (collapsed) {
|
|
8009
|
+
parent2.collapsedChildrenCount += 1;
|
|
7997
8010
|
}
|
|
8011
|
+
parent2.deepRowInfoArray.push(rowInfo);
|
|
7998
8012
|
});
|
|
7999
8013
|
if (!collapsed) {
|
|
8000
8014
|
result[startIndex + index] = rowInfo;
|
|
@@ -8660,8 +8674,10 @@ function useLazyLoadRange() {
|
|
|
8660
8674
|
const {
|
|
8661
8675
|
lazyLoadBatchSize,
|
|
8662
8676
|
lazyLoad,
|
|
8677
|
+
originalLazyGroupDataChangeDetect,
|
|
8663
8678
|
notifyRenderRangeChange,
|
|
8664
8679
|
dataArray,
|
|
8680
|
+
groupRowsState,
|
|
8665
8681
|
scrollStopDelayUpdatedByTable
|
|
8666
8682
|
} = componentState;
|
|
8667
8683
|
const latestRenderRangeRef = (0, import_react30.useRef)(null);
|
|
@@ -8690,20 +8706,27 @@ function useLazyLoadRange() {
|
|
|
8690
8706
|
}, cache);
|
|
8691
8707
|
};
|
|
8692
8708
|
const debouncedLoadRange = (0, import_react30.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
8693
|
-
(
|
|
8709
|
+
useEffectWithChanges((changes) => {
|
|
8694
8710
|
if (lazyLoad) {
|
|
8711
|
+
if (changes.originalLazyGroupDataChangeDetect || changes.groupRowsState) {
|
|
8712
|
+
loadRange(notifyRenderRangeChange.get());
|
|
8713
|
+
}
|
|
8695
8714
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
8696
8715
|
latestRenderRangeRef.current = renderRange;
|
|
8697
8716
|
loadRange(renderRange);
|
|
8698
8717
|
});
|
|
8699
8718
|
}
|
|
8700
8719
|
return;
|
|
8701
|
-
},
|
|
8720
|
+
}, {
|
|
8721
|
+
lazyLoadBatchSize,
|
|
8722
|
+
lazyLoad,
|
|
8723
|
+
originalLazyGroupDataChangeDetect,
|
|
8724
|
+
groupRowsState
|
|
8725
|
+
});
|
|
8702
8726
|
(0, import_react30.useEffect)(() => {
|
|
8703
8727
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
8704
8728
|
debouncedLoadRange();
|
|
8705
8729
|
}
|
|
8706
|
-
return;
|
|
8707
8730
|
}, [dataArray]);
|
|
8708
8731
|
}
|
|
8709
8732
|
function lazyLoadRange(options, cache) {
|
|
@@ -9580,16 +9603,7 @@ var forwardProps3 = (setupState) => {
|
|
|
9580
9603
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
9581
9604
|
loading: (loading) => loading != null ? loading : false,
|
|
9582
9605
|
sortInfo: (sortInfo) => normalizeSortInfo(sortInfo, setupState.propsCache.get("sortInfo")),
|
|
9583
|
-
groupBy: (groupBy) => groupBy != null ? groupBy : []
|
|
9584
|
-
groupRowsState: (groupRowsState) => {
|
|
9585
|
-
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
9586
|
-
groupRowsState = new GroupRowsState(groupRowsState);
|
|
9587
|
-
}
|
|
9588
|
-
return groupRowsState || new GroupRowsState({
|
|
9589
|
-
expandedRows: true,
|
|
9590
|
-
collapsedRows: []
|
|
9591
|
-
});
|
|
9592
|
-
}
|
|
9606
|
+
groupBy: (groupBy) => groupBy != null ? groupBy : []
|
|
9593
9607
|
};
|
|
9594
9608
|
};
|
|
9595
9609
|
function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
@@ -9648,8 +9662,17 @@ function mapPropsToState(params) {
|
|
|
9648
9662
|
}
|
|
9649
9663
|
const primaryKeyDescriptor = state.primaryKey;
|
|
9650
9664
|
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
|
|
9665
|
+
let groupRowsState = props.groupRowsState || state.groupRowsState || props.defaultGroupRowsState;
|
|
9666
|
+
if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
|
|
9667
|
+
groupRowsState = new GroupRowsState(groupRowsState);
|
|
9668
|
+
}
|
|
9669
|
+
groupRowsState = groupRowsState || new GroupRowsState(state.lazyLoad ? { expandedRows: [], collapsedRows: true } : {
|
|
9670
|
+
expandedRows: true,
|
|
9671
|
+
collapsedRows: []
|
|
9672
|
+
});
|
|
9651
9673
|
const result = {
|
|
9652
9674
|
selectionMode,
|
|
9675
|
+
groupRowsState,
|
|
9653
9676
|
rowSelection: rowSelectionState,
|
|
9654
9677
|
toPrimaryKey,
|
|
9655
9678
|
operatorsByFilterType,
|
|
@@ -12392,7 +12415,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12392
12415
|
const valid = (0, import_react44.useMemo)(() => {
|
|
12393
12416
|
let valid2 = isValidLicense(licenseKey, {
|
|
12394
12417
|
publishedAt: 1624970570587,
|
|
12395
|
-
version: "0.4.
|
|
12418
|
+
version: "0.4.11"
|
|
12396
12419
|
});
|
|
12397
12420
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12398
12421
|
return true;
|
|
@@ -13285,3 +13308,4 @@ var components = {
|
|
|
13285
13308
|
CheckBox: InfiniteCheckBox,
|
|
13286
13309
|
LoadMask
|
|
13287
13310
|
};
|
|
13311
|
+
//!collapsed || lazyLoad;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinite-table/infinite-react",
|
|
3
3
|
"description": "Infinite Table for React",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.11",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
7
7
|
"typings": "index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "Commercial & Open Source",
|
|
16
16
|
"//": "will be updated at build time",
|
|
17
|
-
"publishedAt":
|
|
17
|
+
"publishedAt": 1661872202933
|
|
18
18
|
}
|