@infinite-table/infinite-react 9.1.5 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +108 -2
- package/index.dev.js +297 -32
- package/index.dev.mjs +297 -32
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -15119,6 +15119,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
15119
15119
|
childrenAvailable: false,
|
|
15120
15120
|
commonData: dataObject,
|
|
15121
15121
|
totalChildrenCount: dataArray[i].totalChildrenCount,
|
|
15122
|
+
totalChildrenCountUnfiltered: dataArray[i].totalChildrenCountUnfiltered,
|
|
15122
15123
|
reducerResults: dataArray[i].aggregations || {},
|
|
15123
15124
|
isTree: false,
|
|
15124
15125
|
isGroupBy: true
|
|
@@ -16670,6 +16671,52 @@ function getGroupKeysForDataItem(data, groupBy) {
|
|
|
16670
16671
|
}
|
|
16671
16672
|
|
|
16672
16673
|
// src/components/DataSource/RowSelectionState.ts
|
|
16674
|
+
var EMPTY_UNFILTERED_GROUPS = new DeepMap();
|
|
16675
|
+
var unfilteredGroupsCache = /* @__PURE__ */ new WeakMap();
|
|
16676
|
+
function getUnfilteredGroups(config) {
|
|
16677
|
+
const { originalDataArray, groupBy, toPrimaryKey } = config;
|
|
16678
|
+
if (!originalDataArray || !groupBy.length) {
|
|
16679
|
+
return EMPTY_UNFILTERED_GROUPS;
|
|
16680
|
+
}
|
|
16681
|
+
const cached = unfilteredGroupsCache.get(originalDataArray);
|
|
16682
|
+
if (cached && cached.groupBy === groupBy) {
|
|
16683
|
+
return cached.groups;
|
|
16684
|
+
}
|
|
16685
|
+
const groups = new DeepMap();
|
|
16686
|
+
const lastLevel = groupBy.length;
|
|
16687
|
+
const keys = [];
|
|
16688
|
+
originalDataArray.forEach((data) => {
|
|
16689
|
+
const groupKeys = getGroupKeysForDataItem(data, groupBy);
|
|
16690
|
+
keys.length = 0;
|
|
16691
|
+
for (let i = 0; i < groupKeys.length; i++) {
|
|
16692
|
+
keys.push(groupKeys[i]);
|
|
16693
|
+
let group2 = groups.get(keys);
|
|
16694
|
+
if (!group2) {
|
|
16695
|
+
group2 = { count: 0 };
|
|
16696
|
+
if (keys.length === lastLevel) {
|
|
16697
|
+
group2.primaryKeys = [];
|
|
16698
|
+
}
|
|
16699
|
+
groups.set(keys, group2);
|
|
16700
|
+
}
|
|
16701
|
+
group2.count++;
|
|
16702
|
+
group2.primaryKeys?.push(toPrimaryKey(data));
|
|
16703
|
+
}
|
|
16704
|
+
});
|
|
16705
|
+
unfilteredGroupsCache.set(originalDataArray, { groupBy, groups });
|
|
16706
|
+
return groups;
|
|
16707
|
+
}
|
|
16708
|
+
function getUnfilteredPrimaryKeysInsideGroup(groups, groupKeys) {
|
|
16709
|
+
const result = [];
|
|
16710
|
+
groups.getLeafNodesStartingWith(groupKeys, (pair) => {
|
|
16711
|
+
const primaryKeys = pair.value?.primaryKeys;
|
|
16712
|
+
if (primaryKeys) {
|
|
16713
|
+
for (let i = 0; i < primaryKeys.length; i++) {
|
|
16714
|
+
result.push(primaryKeys[i]);
|
|
16715
|
+
}
|
|
16716
|
+
}
|
|
16717
|
+
});
|
|
16718
|
+
return result;
|
|
16719
|
+
}
|
|
16673
16720
|
var RowSelectionState = class _RowSelectionState {
|
|
16674
16721
|
constructor(state, getConfig, _forTestingOnly) {
|
|
16675
16722
|
this.selectedRows = null;
|
|
@@ -16721,26 +16768,123 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16721
16768
|
getGroupDeepMap() {
|
|
16722
16769
|
return this.getConfig().groupDeepMap;
|
|
16723
16770
|
}
|
|
16771
|
+
/**
|
|
16772
|
+
* The selection acts only on the rows that pass the filter, and some rows are filtered out
|
|
16773
|
+
*/
|
|
16774
|
+
targetsVisibleRowsOnly() {
|
|
16775
|
+
const { multiRowSelectionTarget, someRowsFilteredOut } = this.getConfig();
|
|
16776
|
+
return multiRowSelectionTarget === "visible" && !!someRowsFilteredOut;
|
|
16777
|
+
}
|
|
16778
|
+
/**
|
|
16779
|
+
* The selection also acts on rows that are filtered out, and some rows are filtered out
|
|
16780
|
+
*/
|
|
16781
|
+
targetsFilteredOutRows() {
|
|
16782
|
+
const { multiRowSelectionTarget, someRowsFilteredOut } = this.getConfig();
|
|
16783
|
+
return multiRowSelectionTarget !== "visible" && !!someRowsFilteredOut;
|
|
16784
|
+
}
|
|
16785
|
+
getVisibleDataInsideGroup(groupKeys) {
|
|
16786
|
+
const { postFilterDataArray, groupDeepMap } = this.getConfig();
|
|
16787
|
+
if (!groupKeys.length) {
|
|
16788
|
+
return postFilterDataArray ?? [];
|
|
16789
|
+
}
|
|
16790
|
+
return groupDeepMap?.get(groupKeys)?.items ?? [];
|
|
16791
|
+
}
|
|
16792
|
+
hasFilteredOutRowsInsideGroup(groupKeys) {
|
|
16793
|
+
const config = this.getConfig();
|
|
16794
|
+
if (!config.someRowsFilteredOut) {
|
|
16795
|
+
return false;
|
|
16796
|
+
}
|
|
16797
|
+
const allCount = groupKeys.length ? getUnfilteredGroups(config).get(groupKeys)?.count ?? 0 : config.originalDataArray?.length ?? 0;
|
|
16798
|
+
return allCount > this.getVisibleDataInsideGroup(groupKeys).length;
|
|
16799
|
+
}
|
|
16800
|
+
/**
|
|
16801
|
+
* Sets the selection of each visible row inside the group, by its full path,
|
|
16802
|
+
* so the rows of the group that are filtered out keep their selection
|
|
16803
|
+
*/
|
|
16804
|
+
setVisibleRowsSelection(groupKeys, selected) {
|
|
16805
|
+
const { groupBy, toPrimaryKey } = this.getConfig();
|
|
16806
|
+
const mapToSet = selected ? this.selectedMap : this.deselectedMap;
|
|
16807
|
+
const mapToClear = selected ? this.deselectedMap : this.selectedMap;
|
|
16808
|
+
this.xcache();
|
|
16809
|
+
this.getVisibleDataInsideGroup(groupKeys).forEach((data) => {
|
|
16810
|
+
const rowGroupKeys = getGroupKeysForDataItem(data, groupBy);
|
|
16811
|
+
const pk = toPrimaryKey(data);
|
|
16812
|
+
const finalKey = [...rowGroupKeys, pk];
|
|
16813
|
+
mapToClear.delete(finalKey);
|
|
16814
|
+
if (this.isRowSelected(pk, rowGroupKeys) !== selected) {
|
|
16815
|
+
mapToSet.set(finalKey, true);
|
|
16816
|
+
}
|
|
16817
|
+
});
|
|
16818
|
+
this.xcache();
|
|
16819
|
+
}
|
|
16820
|
+
/**
|
|
16821
|
+
* Lazy load, when the selection also acts on rows that are filtered out:
|
|
16822
|
+
* the count of all the rows inside the group without the filter, if the server sent it
|
|
16823
|
+
*/
|
|
16824
|
+
getLazyUnfilteredCount(groupKeys) {
|
|
16825
|
+
const config = this.getConfig();
|
|
16826
|
+
if (!config.lazyLoad || config.multiRowSelectionTarget === "visible") {
|
|
16827
|
+
return void 0;
|
|
16828
|
+
}
|
|
16829
|
+
if (!groupKeys.length) {
|
|
16830
|
+
return config.lazyUnfilteredCount;
|
|
16831
|
+
}
|
|
16832
|
+
return config.groupDeepMap?.get(groupKeys)?.totalChildrenCountUnfiltered;
|
|
16833
|
+
}
|
|
16834
|
+
/**
|
|
16835
|
+
* Lazy load, when the selection also acts on rows that are filtered out:
|
|
16836
|
+
* the count of the rows inside the group (not at the last level) that are not inside
|
|
16837
|
+
* its loaded groups - so the rows of the groups hidden by the filter or not loaded yet
|
|
16838
|
+
*/
|
|
16839
|
+
getLazyHiddenRowsCount(groupKeys) {
|
|
16840
|
+
const unfilteredCount = groupKeys.length < this.getGroupByLength() ? this.getLazyUnfilteredCount(groupKeys) : void 0;
|
|
16841
|
+
if (unfilteredCount === void 0) {
|
|
16842
|
+
return 0;
|
|
16843
|
+
}
|
|
16844
|
+
const { groupDeepMap } = this.getConfig();
|
|
16845
|
+
let childrenCount = 0;
|
|
16846
|
+
this.getGroupKeysDirectlyInsideGroup(groupKeys).forEach((keys) => {
|
|
16847
|
+
childrenCount += this.getLazyUnfilteredCount(keys) ?? (groupDeepMap?.get(keys)?.totalChildrenCount || 0);
|
|
16848
|
+
});
|
|
16849
|
+
return Math.max(unfilteredCount - childrenCount, 0);
|
|
16850
|
+
}
|
|
16724
16851
|
getGroupCount(groupKeys) {
|
|
16725
16852
|
if (groupKeys.length == 0) {
|
|
16726
|
-
return this.getConfig().totalCount;
|
|
16853
|
+
return this.getLazyUnfilteredCount([]) ?? this.getConfig().totalCount;
|
|
16854
|
+
}
|
|
16855
|
+
if (this.targetsFilteredOutRows()) {
|
|
16856
|
+
return getUnfilteredGroups(this.getConfig()).get(groupKeys)?.count ?? 0;
|
|
16727
16857
|
}
|
|
16728
16858
|
const groupDeepMap = this.getGroupDeepMap();
|
|
16729
16859
|
const deepMapValue = groupDeepMap?.get(groupKeys);
|
|
16730
16860
|
if (!deepMapValue) {
|
|
16731
16861
|
return 0;
|
|
16732
16862
|
}
|
|
16733
|
-
return deepMapValue.totalChildrenCount ?? (deepMapValue.items.length || 0);
|
|
16863
|
+
return this.getLazyUnfilteredCount(groupKeys) ?? deepMapValue.totalChildrenCount ?? (deepMapValue.items.length || 0);
|
|
16734
16864
|
}
|
|
16735
16865
|
getGroupKeysDirectlyInsideGroup(groupKeys) {
|
|
16736
|
-
const
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
|
|
16866
|
+
const config = this.getConfig();
|
|
16867
|
+
const options = { excludeSelf: true, depthLimit: 1 };
|
|
16868
|
+
if (this.targetsFilteredOutRows()) {
|
|
16869
|
+
return getUnfilteredGroups(config).getKeysStartingWith(
|
|
16870
|
+
groupKeys,
|
|
16871
|
+
options
|
|
16872
|
+
);
|
|
16873
|
+
}
|
|
16874
|
+
return config.groupDeepMap?.getKeysStartingWith(groupKeys, options) || [];
|
|
16741
16875
|
}
|
|
16742
16876
|
getAllPrimaryKeysInsideGroup(groupKeys) {
|
|
16743
|
-
const
|
|
16877
|
+
const config = this.getConfig();
|
|
16878
|
+
const { groupDeepMap, toPrimaryKey } = config;
|
|
16879
|
+
if (this.targetsFilteredOutRows()) {
|
|
16880
|
+
return groupKeys.length ? getUnfilteredPrimaryKeysInsideGroup(
|
|
16881
|
+
getUnfilteredGroups(config),
|
|
16882
|
+
groupKeys
|
|
16883
|
+
) : (config.originalDataArray ?? []).map(toPrimaryKey);
|
|
16884
|
+
}
|
|
16885
|
+
if (!config.groupBy.length) {
|
|
16886
|
+
return this.getVisibleDataInsideGroup([]).map(toPrimaryKey);
|
|
16887
|
+
}
|
|
16744
16888
|
if (!groupKeys.length) {
|
|
16745
16889
|
const topLevelKeys = groupDeepMap?.getKeysStartingWith([], {
|
|
16746
16890
|
excludeSelf: true,
|
|
@@ -16778,7 +16922,7 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16778
16922
|
if (this.onlyUsePrimaryKeys) {
|
|
16779
16923
|
return keys[0];
|
|
16780
16924
|
}
|
|
16781
|
-
return keys.length
|
|
16925
|
+
return groupByLength === 0 && keys.length === 1 ? keys[0] : keys;
|
|
16782
16926
|
});
|
|
16783
16927
|
};
|
|
16784
16928
|
const selectedRows = normalize(this.selectedMap.topDownKeys());
|
|
@@ -16790,6 +16934,14 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16790
16934
|
};
|
|
16791
16935
|
}
|
|
16792
16936
|
deselectAll() {
|
|
16937
|
+
if (this.targetsVisibleRowsOnly()) {
|
|
16938
|
+
if (this.onlyUsePrimaryKeys) {
|
|
16939
|
+
this.deselectGroupRow([]);
|
|
16940
|
+
} else {
|
|
16941
|
+
this.setVisibleRowsSelection([], false);
|
|
16942
|
+
}
|
|
16943
|
+
return;
|
|
16944
|
+
}
|
|
16793
16945
|
this.update({
|
|
16794
16946
|
defaultSelection: false,
|
|
16795
16947
|
selectedRows: [],
|
|
@@ -16797,6 +16949,14 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16797
16949
|
});
|
|
16798
16950
|
}
|
|
16799
16951
|
selectAll() {
|
|
16952
|
+
if (this.targetsVisibleRowsOnly()) {
|
|
16953
|
+
if (this.onlyUsePrimaryKeys) {
|
|
16954
|
+
this.selectGroupRow([]);
|
|
16955
|
+
} else {
|
|
16956
|
+
this.setVisibleRowsSelection([], true);
|
|
16957
|
+
}
|
|
16958
|
+
return;
|
|
16959
|
+
}
|
|
16800
16960
|
this.update({
|
|
16801
16961
|
defaultSelection: true,
|
|
16802
16962
|
deselectedRows: [],
|
|
@@ -16951,6 +17111,10 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16951
17111
|
this.xcache();
|
|
16952
17112
|
return;
|
|
16953
17113
|
}
|
|
17114
|
+
if (this.targetsVisibleRowsOnly() && this.hasFilteredOutRowsInsideGroup(groupKeys)) {
|
|
17115
|
+
this.setVisibleRowsSelection(groupKeys, true);
|
|
17116
|
+
return;
|
|
17117
|
+
}
|
|
16954
17118
|
const selectedKeys = this.selectedMap.getKeysStartingWith(groupKeys, {
|
|
16955
17119
|
excludeSelf: true
|
|
16956
17120
|
});
|
|
@@ -16979,6 +17143,10 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16979
17143
|
this.xcache();
|
|
16980
17144
|
return;
|
|
16981
17145
|
}
|
|
17146
|
+
if (this.targetsVisibleRowsOnly() && this.hasFilteredOutRowsInsideGroup(groupKeys)) {
|
|
17147
|
+
this.setVisibleRowsSelection(groupKeys, false);
|
|
17148
|
+
return;
|
|
17149
|
+
}
|
|
16982
17150
|
const deselectedKeys = this.deselectedMap.getKeysStartingWith(groupKeys, {
|
|
16983
17151
|
excludeSelf: true
|
|
16984
17152
|
});
|
|
@@ -17077,7 +17245,7 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17077
17245
|
this.selectionCountCache.set(groupKeys, result2);
|
|
17078
17246
|
return result2;
|
|
17079
17247
|
}
|
|
17080
|
-
if (
|
|
17248
|
+
if (this.onlyUsePrimaryKeys && (groupByLength || this.targetsVisibleRowsOnly())) {
|
|
17081
17249
|
const allKeys2 = this.getAllPrimaryKeysInsideGroup(groupKeys);
|
|
17082
17250
|
let selectedCount2 = 0;
|
|
17083
17251
|
let deselectedCount2 = 0;
|
|
@@ -17103,6 +17271,21 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17103
17271
|
this.selectionCountCache.set(groupKeys, result2);
|
|
17104
17272
|
return result2;
|
|
17105
17273
|
}
|
|
17274
|
+
if (groupKeys.length === groupByLength && this.targetsVisibleRowsOnly()) {
|
|
17275
|
+
const { toPrimaryKey } = this.getConfig();
|
|
17276
|
+
let selectedCount2 = 0;
|
|
17277
|
+
let deselectedCount2 = 0;
|
|
17278
|
+
this.getVisibleDataInsideGroup(groupKeys).forEach((data) => {
|
|
17279
|
+
if (this.isRowSelected(toPrimaryKey(data), groupKeys)) {
|
|
17280
|
+
selectedCount2++;
|
|
17281
|
+
} else {
|
|
17282
|
+
deselectedCount2++;
|
|
17283
|
+
}
|
|
17284
|
+
});
|
|
17285
|
+
const result2 = { selectedCount: selectedCount2, deselectedCount: deselectedCount2 };
|
|
17286
|
+
this.selectionCountCache.set(groupKeys, result2);
|
|
17287
|
+
return result2;
|
|
17288
|
+
}
|
|
17106
17289
|
parentSelected = parentSelected ?? this.getGroupRowBooleanSelectionStateFromParent(groupKeys);
|
|
17107
17290
|
let allKeys = this.getGroupKeysDirectlyInsideGroup(groupKeys);
|
|
17108
17291
|
if (groupKeys.length === this.getGroupByLength()) {
|
|
@@ -17126,8 +17309,9 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17126
17309
|
}
|
|
17127
17310
|
let selectedCount = 0;
|
|
17128
17311
|
let deselectedCount = 0;
|
|
17129
|
-
|
|
17130
|
-
|
|
17312
|
+
const { lazyLoad, groupDeepMap } = this.getConfig();
|
|
17313
|
+
if (lazyLoad && !allKeys.length) {
|
|
17314
|
+
const totalChildrenCount = this.getLazyUnfilteredCount(groupKeys) ?? (groupDeepMap?.get(groupKeys)?.totalChildrenCount || 0);
|
|
17131
17315
|
if (parentSelected) {
|
|
17132
17316
|
selectedCount = totalChildrenCount;
|
|
17133
17317
|
deselectedCount = this.deselectedMap.getAllChildrenSizeFor(groupKeys);
|
|
@@ -17150,6 +17334,12 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17150
17334
|
selectedCount += selCount;
|
|
17151
17335
|
deselectedCount += deselCount;
|
|
17152
17336
|
});
|
|
17337
|
+
const hiddenCount = allKeys.length ? this.getLazyHiddenRowsCount(groupKeys) : 0;
|
|
17338
|
+
if (parentSelected) {
|
|
17339
|
+
selectedCount += hiddenCount;
|
|
17340
|
+
} else {
|
|
17341
|
+
deselectedCount += hiddenCount;
|
|
17342
|
+
}
|
|
17153
17343
|
const result = {
|
|
17154
17344
|
selectedCount,
|
|
17155
17345
|
deselectedCount
|
|
@@ -17169,14 +17359,22 @@ function cloneRowSelection(rowSelection, stateOrGetDataSourceState) {
|
|
|
17169
17359
|
function rowSelectionStateConfigGetter(stateOrStateGetter) {
|
|
17170
17360
|
return () => {
|
|
17171
17361
|
const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
|
|
17362
|
+
const { originalDataArray, postFilterDataArray } = state;
|
|
17363
|
+
const lazyLoad = !!state.lazyLoad;
|
|
17364
|
+
const lazyRoot = lazyLoad ? state.originalLazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]) : void 0;
|
|
17172
17365
|
return {
|
|
17173
|
-
lazyLoad
|
|
17366
|
+
lazyLoad,
|
|
17174
17367
|
toPrimaryKey: state.toPrimaryKey,
|
|
17175
17368
|
onlyUsePrimaryKeys: !state.useGroupKeysForMultiRowSelection,
|
|
17176
17369
|
groupBy: state.groupBy,
|
|
17177
17370
|
groupDeepMap: state.groupDeepMap,
|
|
17178
17371
|
indexer: state.indexer,
|
|
17179
|
-
totalCount: state.unfilteredCount
|
|
17372
|
+
totalCount: lazyLoad ? originalDataArray?.length ?? 0 : state.unfilteredCount,
|
|
17373
|
+
lazyUnfilteredCount: state.groupBy.length ? lazyRoot?.totalChildrenCountUnfiltered : lazyRoot?.totalCountUnfiltered,
|
|
17374
|
+
multiRowSelectionTarget: state.multiRowSelectionTarget,
|
|
17375
|
+
someRowsFilteredOut: !state.lazyLoad && !!originalDataArray && !!postFilterDataArray && postFilterDataArray.length < originalDataArray.length,
|
|
17376
|
+
originalDataArray,
|
|
17377
|
+
postFilterDataArray
|
|
17180
17378
|
};
|
|
17181
17379
|
};
|
|
17182
17380
|
}
|
|
@@ -18111,6 +18309,9 @@ var TreeExpandState = class {
|
|
|
18111
18309
|
};
|
|
18112
18310
|
|
|
18113
18311
|
// src/components/DataSource/TreeSelectionState.ts
|
|
18312
|
+
var toTreePathsMap = (treePaths) => {
|
|
18313
|
+
return Array.isArray(treePaths) ? new DeepMap(treePaths.map((path) => [path, true])) : treePaths;
|
|
18314
|
+
};
|
|
18114
18315
|
var shortestToLongest = (a, b) => a.length - b.length;
|
|
18115
18316
|
var TreeSelectionState = class _TreeSelectionState {
|
|
18116
18317
|
constructor(state, getConfig) {
|
|
@@ -18137,13 +18338,7 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18137
18338
|
}
|
|
18138
18339
|
}
|
|
18139
18340
|
getTreePaths(treePaths) {
|
|
18140
|
-
|
|
18141
|
-
if (Array.isArray(treePaths)) {
|
|
18142
|
-
return new DeepMap(treePaths.map((path) => [path, true]));
|
|
18143
|
-
}
|
|
18144
|
-
return treePaths;
|
|
18145
|
-
}
|
|
18146
|
-
return this.config.treePaths;
|
|
18341
|
+
return treePaths ? toTreePathsMap(treePaths) : this.config.treePaths;
|
|
18147
18342
|
}
|
|
18148
18343
|
withTreePaths(fn, treePaths) {
|
|
18149
18344
|
const initialTreePaths = this.config.treePaths;
|
|
@@ -18216,11 +18411,38 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18216
18411
|
setConfig(getConfig) {
|
|
18217
18412
|
const config = typeof getConfig === "function" ? getConfig() : getConfig;
|
|
18218
18413
|
this.config = {
|
|
18219
|
-
treePaths:
|
|
18220
|
-
strictCheckPaths: config.strictCheckPaths ?? true
|
|
18414
|
+
treePaths: toTreePathsMap(config.treePaths),
|
|
18415
|
+
strictCheckPaths: config.strictCheckPaths ?? true,
|
|
18416
|
+
multiRowSelectionTarget: config.multiRowSelectionTarget,
|
|
18417
|
+
unfilteredTreePaths: config.unfilteredTreePaths ? toTreePathsMap(config.unfilteredTreePaths) : void 0
|
|
18221
18418
|
};
|
|
18222
18419
|
this.xcache();
|
|
18223
18420
|
}
|
|
18421
|
+
hasFilteredOutLeavesInside(nodePath) {
|
|
18422
|
+
const { multiRowSelectionTarget, unfilteredTreePaths, treePaths } = this.config;
|
|
18423
|
+
if (multiRowSelectionTarget !== "visible" || !unfilteredTreePaths || unfilteredTreePaths === treePaths) {
|
|
18424
|
+
return false;
|
|
18425
|
+
}
|
|
18426
|
+
return unfilteredTreePaths.getAllChildrenSizeFor(nodePath) > treePaths.getAllChildrenSizeFor(nodePath);
|
|
18427
|
+
}
|
|
18428
|
+
/**
|
|
18429
|
+
* Sets the selection of each visible leaf node inside the node, by its path,
|
|
18430
|
+
* so the leaf nodes that are filtered out keep their selection
|
|
18431
|
+
*/
|
|
18432
|
+
setVisibleLeafNodesSelection(nodePath, selected) {
|
|
18433
|
+
const { unfilteredTreePaths, treePaths } = this.config;
|
|
18434
|
+
this.xcache();
|
|
18435
|
+
treePaths.getKeysForLeafNodesStartingWith(nodePath).forEach((leafPath) => {
|
|
18436
|
+
if (unfilteredTreePaths.getAllChildrenSizeFor(leafPath) > 0) {
|
|
18437
|
+
return;
|
|
18438
|
+
}
|
|
18439
|
+
this.selectionMap.delete(leafPath);
|
|
18440
|
+
if (this.isNodeSelected(leafPath) !== selected) {
|
|
18441
|
+
this.setSelectionForPath(leafPath, selected);
|
|
18442
|
+
}
|
|
18443
|
+
});
|
|
18444
|
+
this.xcache();
|
|
18445
|
+
}
|
|
18224
18446
|
xcache() {
|
|
18225
18447
|
this.cache.clear();
|
|
18226
18448
|
}
|
|
@@ -18261,6 +18483,10 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18261
18483
|
};
|
|
18262
18484
|
}
|
|
18263
18485
|
deselectAll() {
|
|
18486
|
+
if (this.hasFilteredOutLeavesInside([])) {
|
|
18487
|
+
this.setVisibleLeafNodesSelection([], false);
|
|
18488
|
+
return;
|
|
18489
|
+
}
|
|
18264
18490
|
this.update({
|
|
18265
18491
|
defaultSelection: false,
|
|
18266
18492
|
selectedPaths: [],
|
|
@@ -18268,6 +18494,10 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18268
18494
|
});
|
|
18269
18495
|
}
|
|
18270
18496
|
selectAll() {
|
|
18497
|
+
if (this.hasFilteredOutLeavesInside([])) {
|
|
18498
|
+
this.setVisibleLeafNodesSelection([], true);
|
|
18499
|
+
return;
|
|
18500
|
+
}
|
|
18271
18501
|
this.update({
|
|
18272
18502
|
defaultSelection: true,
|
|
18273
18503
|
deselectedPaths: [],
|
|
@@ -18419,6 +18649,10 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18419
18649
|
if (!nodePath.length) {
|
|
18420
18650
|
return;
|
|
18421
18651
|
}
|
|
18652
|
+
if (this.hasFilteredOutLeavesInside(nodePath)) {
|
|
18653
|
+
this.setVisibleLeafNodesSelection(nodePath, selected);
|
|
18654
|
+
return;
|
|
18655
|
+
}
|
|
18422
18656
|
this.xcache();
|
|
18423
18657
|
const keys = this.selectionMap.getKeysStartingWith(nodePath);
|
|
18424
18658
|
keys.forEach((nodePath2) => {
|
|
@@ -18475,8 +18709,17 @@ function cloneTreeSelection(treeSelection2, stateOrGetState) {
|
|
|
18475
18709
|
function treeSelectionStateConfigGetter(stateOrStateGetter) {
|
|
18476
18710
|
return () => {
|
|
18477
18711
|
const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
|
|
18712
|
+
const { treePaths, unfilteredTreePaths, multiRowSelectionTarget } = state;
|
|
18713
|
+
if (multiRowSelectionTarget === "visible") {
|
|
18714
|
+
return {
|
|
18715
|
+
treePaths,
|
|
18716
|
+
unfilteredTreePaths,
|
|
18717
|
+
multiRowSelectionTarget
|
|
18718
|
+
};
|
|
18719
|
+
}
|
|
18478
18720
|
return {
|
|
18479
|
-
treePaths:
|
|
18721
|
+
treePaths: unfilteredTreePaths ?? treePaths,
|
|
18722
|
+
multiRowSelectionTarget
|
|
18480
18723
|
};
|
|
18481
18724
|
};
|
|
18482
18725
|
}
|
|
@@ -20541,6 +20784,7 @@ var forwardProps3 = (setupState, props) => {
|
|
|
20541
20784
|
treeFilterFunction: 1,
|
|
20542
20785
|
filterValue: 1,
|
|
20543
20786
|
useGroupKeysForMultiRowSelection: (useGroupKeysForMultiRowSelection) => useGroupKeysForMultiRowSelection ?? false,
|
|
20787
|
+
multiRowSelectionTarget: (multiRowSelectionTarget) => multiRowSelectionTarget ?? "all",
|
|
20544
20788
|
filterDelay: (filterDelay) => filterDelay ?? 200,
|
|
20545
20789
|
filterTypes: (filterTypes) => {
|
|
20546
20790
|
return { ...defaultFilterTypes2, ...filterTypes };
|
|
@@ -21604,12 +21848,14 @@ function concludeReducer(params) {
|
|
|
21604
21848
|
"rowSelection",
|
|
21605
21849
|
"cellSelection",
|
|
21606
21850
|
"isRowSelected",
|
|
21851
|
+
"multiRowSelectionTarget",
|
|
21607
21852
|
"originalLazyGroupDataChangeDetect"
|
|
21608
21853
|
]);
|
|
21609
21854
|
const treeSelectionDepsChanged = haveDepsChanged(previousState, state, [
|
|
21610
21855
|
"treeSelection",
|
|
21611
21856
|
"cellSelection",
|
|
21612
21857
|
"isNodeSelected",
|
|
21858
|
+
"multiRowSelectionTarget",
|
|
21613
21859
|
"originalLazyGroupDataChangeDetect"
|
|
21614
21860
|
]);
|
|
21615
21861
|
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
@@ -21743,6 +21989,9 @@ function concludeReducer(params) {
|
|
|
21743
21989
|
const rowSelectionState = state.rowSelection instanceof RowSelectionState ? state.rowSelection : void 0;
|
|
21744
21990
|
const treeExpandState = state.treeExpandState instanceof TreeExpandState ? state.treeExpandState : void 0;
|
|
21745
21991
|
const cellSelectionState = state.cellSelection instanceof CellSelectionState ? state.cellSelection : void 0;
|
|
21992
|
+
if (rowSelectionState) {
|
|
21993
|
+
rowSelectionState.getConfig = rowSelectionStateConfigGetter(state);
|
|
21994
|
+
}
|
|
21746
21995
|
rowSelectionState?.xcache();
|
|
21747
21996
|
let isRowSelected = state.selectionMode === "single-row" ? (rowInfo) => {
|
|
21748
21997
|
return rowInfo.id === state.rowSelection;
|
|
@@ -22037,6 +22286,14 @@ function concludeReducer(params) {
|
|
|
22037
22286
|
}
|
|
22038
22287
|
}
|
|
22039
22288
|
});
|
|
22289
|
+
const { rowSelection } = state;
|
|
22290
|
+
if (rowSelection instanceof RowSelectionState && rowSelection.getLazyHiddenRowsCount([])) {
|
|
22291
|
+
if (rowSelection.defaultSelection) {
|
|
22292
|
+
someRowsSelected = true;
|
|
22293
|
+
} else {
|
|
22294
|
+
allRowsSelected = false;
|
|
22295
|
+
}
|
|
22296
|
+
}
|
|
22040
22297
|
state.allRowsSelected = allRowsSelected;
|
|
22041
22298
|
state.someRowsSelected = someRowsSelected;
|
|
22042
22299
|
if (debugId) {
|
|
@@ -22049,10 +22306,14 @@ function concludeReducer(params) {
|
|
|
22049
22306
|
debugId
|
|
22050
22307
|
).track.DataSource.label.ComputeSelectionCount.start();
|
|
22051
22308
|
}
|
|
22052
|
-
const
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22309
|
+
const selectionCount = state.isTree ? state.treeSelectionState?.getSelectionCountFor([]) : state.rowSelection.getSelectionCountFor([]);
|
|
22310
|
+
if (selectionCount) {
|
|
22311
|
+
state.allRowsSelected = selectionCount.deselectedCount === 0;
|
|
22312
|
+
state.someRowsSelected = selectionCount.selectedCount > 0;
|
|
22313
|
+
} else {
|
|
22314
|
+
state.allRowsSelected = state.totalLeafNodesCount === 0;
|
|
22315
|
+
state.someRowsSelected = false;
|
|
22316
|
+
}
|
|
22056
22317
|
if (debugId) {
|
|
22057
22318
|
marker?.end();
|
|
22058
22319
|
marker = void 0;
|
|
@@ -22151,6 +22412,9 @@ function buildDataSourceDataParams(componentState, overrides, masterContext) {
|
|
|
22151
22412
|
dataSourceParams.lazyLoadStartIndex = 0;
|
|
22152
22413
|
}
|
|
22153
22414
|
dataSourceParams.groupKeys = [];
|
|
22415
|
+
if (componentState.selectionMode === "multi-row") {
|
|
22416
|
+
dataSourceParams.multiRowSelectionTarget = componentState.multiRowSelectionTarget;
|
|
22417
|
+
}
|
|
22154
22418
|
}
|
|
22155
22419
|
if (overrides) {
|
|
22156
22420
|
Object.assign(dataSourceParams, overrides);
|
|
@@ -22227,8 +22491,7 @@ function loadData(data, componentState, actions, overrides, masterContext) {
|
|
|
22227
22491
|
childrenLoading: true,
|
|
22228
22492
|
childrenAvailable: false,
|
|
22229
22493
|
cache: CACHE_DEFAULT,
|
|
22230
|
-
totalCount: 0
|
|
22231
|
-
totalCountUnfiltered: 0
|
|
22494
|
+
totalCount: 0
|
|
22232
22495
|
});
|
|
22233
22496
|
}
|
|
22234
22497
|
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
@@ -22267,7 +22530,9 @@ function loadData(data, componentState, actions, overrides, masterContext) {
|
|
|
22267
22530
|
childrenLoading: false,
|
|
22268
22531
|
childrenAvailable: true,
|
|
22269
22532
|
totalCount: remoteData2.totalCount ?? dataArray2.length,
|
|
22270
|
-
|
|
22533
|
+
// set even when missing, so a previous response's values are not kept
|
|
22534
|
+
totalCountUnfiltered: remoteData2.totalCountUnfiltered,
|
|
22535
|
+
totalChildrenCountUnfiltered: remoteData2.totalChildrenCountUnfiltered,
|
|
22271
22536
|
children: dataArray2,
|
|
22272
22537
|
error: remoteData2.error
|
|
22273
22538
|
};
|
|
@@ -27832,7 +28097,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
27832
28097
|
}
|
|
27833
28098
|
let valid2 = isValidLicense(licenseKey, {
|
|
27834
28099
|
publishedAt: 1624970570587,
|
|
27835
|
-
version: "9.
|
|
28100
|
+
version: "9.3.0"
|
|
27836
28101
|
});
|
|
27837
28102
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
27838
28103
|
return true;
|