@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.js
CHANGED
|
@@ -15185,6 +15185,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
15185
15185
|
childrenAvailable: false,
|
|
15186
15186
|
commonData: dataObject,
|
|
15187
15187
|
totalChildrenCount: dataArray[i].totalChildrenCount,
|
|
15188
|
+
totalChildrenCountUnfiltered: dataArray[i].totalChildrenCountUnfiltered,
|
|
15188
15189
|
reducerResults: dataArray[i].aggregations || {},
|
|
15189
15190
|
isTree: false,
|
|
15190
15191
|
isGroupBy: true
|
|
@@ -16736,6 +16737,52 @@ function getGroupKeysForDataItem(data, groupBy) {
|
|
|
16736
16737
|
}
|
|
16737
16738
|
|
|
16738
16739
|
// src/components/DataSource/RowSelectionState.ts
|
|
16740
|
+
var EMPTY_UNFILTERED_GROUPS = new DeepMap();
|
|
16741
|
+
var unfilteredGroupsCache = /* @__PURE__ */ new WeakMap();
|
|
16742
|
+
function getUnfilteredGroups(config) {
|
|
16743
|
+
const { originalDataArray, groupBy, toPrimaryKey } = config;
|
|
16744
|
+
if (!originalDataArray || !groupBy.length) {
|
|
16745
|
+
return EMPTY_UNFILTERED_GROUPS;
|
|
16746
|
+
}
|
|
16747
|
+
const cached = unfilteredGroupsCache.get(originalDataArray);
|
|
16748
|
+
if (cached && cached.groupBy === groupBy) {
|
|
16749
|
+
return cached.groups;
|
|
16750
|
+
}
|
|
16751
|
+
const groups = new DeepMap();
|
|
16752
|
+
const lastLevel = groupBy.length;
|
|
16753
|
+
const keys = [];
|
|
16754
|
+
originalDataArray.forEach((data) => {
|
|
16755
|
+
const groupKeys = getGroupKeysForDataItem(data, groupBy);
|
|
16756
|
+
keys.length = 0;
|
|
16757
|
+
for (let i = 0; i < groupKeys.length; i++) {
|
|
16758
|
+
keys.push(groupKeys[i]);
|
|
16759
|
+
let group2 = groups.get(keys);
|
|
16760
|
+
if (!group2) {
|
|
16761
|
+
group2 = { count: 0 };
|
|
16762
|
+
if (keys.length === lastLevel) {
|
|
16763
|
+
group2.primaryKeys = [];
|
|
16764
|
+
}
|
|
16765
|
+
groups.set(keys, group2);
|
|
16766
|
+
}
|
|
16767
|
+
group2.count++;
|
|
16768
|
+
group2.primaryKeys?.push(toPrimaryKey(data));
|
|
16769
|
+
}
|
|
16770
|
+
});
|
|
16771
|
+
unfilteredGroupsCache.set(originalDataArray, { groupBy, groups });
|
|
16772
|
+
return groups;
|
|
16773
|
+
}
|
|
16774
|
+
function getUnfilteredPrimaryKeysInsideGroup(groups, groupKeys) {
|
|
16775
|
+
const result = [];
|
|
16776
|
+
groups.getLeafNodesStartingWith(groupKeys, (pair) => {
|
|
16777
|
+
const primaryKeys = pair.value?.primaryKeys;
|
|
16778
|
+
if (primaryKeys) {
|
|
16779
|
+
for (let i = 0; i < primaryKeys.length; i++) {
|
|
16780
|
+
result.push(primaryKeys[i]);
|
|
16781
|
+
}
|
|
16782
|
+
}
|
|
16783
|
+
});
|
|
16784
|
+
return result;
|
|
16785
|
+
}
|
|
16739
16786
|
var RowSelectionState = class _RowSelectionState {
|
|
16740
16787
|
constructor(state, getConfig, _forTestingOnly) {
|
|
16741
16788
|
this.selectedRows = null;
|
|
@@ -16787,26 +16834,123 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16787
16834
|
getGroupDeepMap() {
|
|
16788
16835
|
return this.getConfig().groupDeepMap;
|
|
16789
16836
|
}
|
|
16837
|
+
/**
|
|
16838
|
+
* The selection acts only on the rows that pass the filter, and some rows are filtered out
|
|
16839
|
+
*/
|
|
16840
|
+
targetsVisibleRowsOnly() {
|
|
16841
|
+
const { multiRowSelectionTarget, someRowsFilteredOut } = this.getConfig();
|
|
16842
|
+
return multiRowSelectionTarget === "visible" && !!someRowsFilteredOut;
|
|
16843
|
+
}
|
|
16844
|
+
/**
|
|
16845
|
+
* The selection also acts on rows that are filtered out, and some rows are filtered out
|
|
16846
|
+
*/
|
|
16847
|
+
targetsFilteredOutRows() {
|
|
16848
|
+
const { multiRowSelectionTarget, someRowsFilteredOut } = this.getConfig();
|
|
16849
|
+
return multiRowSelectionTarget !== "visible" && !!someRowsFilteredOut;
|
|
16850
|
+
}
|
|
16851
|
+
getVisibleDataInsideGroup(groupKeys) {
|
|
16852
|
+
const { postFilterDataArray, groupDeepMap } = this.getConfig();
|
|
16853
|
+
if (!groupKeys.length) {
|
|
16854
|
+
return postFilterDataArray ?? [];
|
|
16855
|
+
}
|
|
16856
|
+
return groupDeepMap?.get(groupKeys)?.items ?? [];
|
|
16857
|
+
}
|
|
16858
|
+
hasFilteredOutRowsInsideGroup(groupKeys) {
|
|
16859
|
+
const config = this.getConfig();
|
|
16860
|
+
if (!config.someRowsFilteredOut) {
|
|
16861
|
+
return false;
|
|
16862
|
+
}
|
|
16863
|
+
const allCount = groupKeys.length ? getUnfilteredGroups(config).get(groupKeys)?.count ?? 0 : config.originalDataArray?.length ?? 0;
|
|
16864
|
+
return allCount > this.getVisibleDataInsideGroup(groupKeys).length;
|
|
16865
|
+
}
|
|
16866
|
+
/**
|
|
16867
|
+
* Sets the selection of each visible row inside the group, by its full path,
|
|
16868
|
+
* so the rows of the group that are filtered out keep their selection
|
|
16869
|
+
*/
|
|
16870
|
+
setVisibleRowsSelection(groupKeys, selected) {
|
|
16871
|
+
const { groupBy, toPrimaryKey } = this.getConfig();
|
|
16872
|
+
const mapToSet = selected ? this.selectedMap : this.deselectedMap;
|
|
16873
|
+
const mapToClear = selected ? this.deselectedMap : this.selectedMap;
|
|
16874
|
+
this.xcache();
|
|
16875
|
+
this.getVisibleDataInsideGroup(groupKeys).forEach((data) => {
|
|
16876
|
+
const rowGroupKeys = getGroupKeysForDataItem(data, groupBy);
|
|
16877
|
+
const pk = toPrimaryKey(data);
|
|
16878
|
+
const finalKey = [...rowGroupKeys, pk];
|
|
16879
|
+
mapToClear.delete(finalKey);
|
|
16880
|
+
if (this.isRowSelected(pk, rowGroupKeys) !== selected) {
|
|
16881
|
+
mapToSet.set(finalKey, true);
|
|
16882
|
+
}
|
|
16883
|
+
});
|
|
16884
|
+
this.xcache();
|
|
16885
|
+
}
|
|
16886
|
+
/**
|
|
16887
|
+
* Lazy load, when the selection also acts on rows that are filtered out:
|
|
16888
|
+
* the count of all the rows inside the group without the filter, if the server sent it
|
|
16889
|
+
*/
|
|
16890
|
+
getLazyUnfilteredCount(groupKeys) {
|
|
16891
|
+
const config = this.getConfig();
|
|
16892
|
+
if (!config.lazyLoad || config.multiRowSelectionTarget === "visible") {
|
|
16893
|
+
return void 0;
|
|
16894
|
+
}
|
|
16895
|
+
if (!groupKeys.length) {
|
|
16896
|
+
return config.lazyUnfilteredCount;
|
|
16897
|
+
}
|
|
16898
|
+
return config.groupDeepMap?.get(groupKeys)?.totalChildrenCountUnfiltered;
|
|
16899
|
+
}
|
|
16900
|
+
/**
|
|
16901
|
+
* Lazy load, when the selection also acts on rows that are filtered out:
|
|
16902
|
+
* the count of the rows inside the group (not at the last level) that are not inside
|
|
16903
|
+
* its loaded groups - so the rows of the groups hidden by the filter or not loaded yet
|
|
16904
|
+
*/
|
|
16905
|
+
getLazyHiddenRowsCount(groupKeys) {
|
|
16906
|
+
const unfilteredCount = groupKeys.length < this.getGroupByLength() ? this.getLazyUnfilteredCount(groupKeys) : void 0;
|
|
16907
|
+
if (unfilteredCount === void 0) {
|
|
16908
|
+
return 0;
|
|
16909
|
+
}
|
|
16910
|
+
const { groupDeepMap } = this.getConfig();
|
|
16911
|
+
let childrenCount = 0;
|
|
16912
|
+
this.getGroupKeysDirectlyInsideGroup(groupKeys).forEach((keys) => {
|
|
16913
|
+
childrenCount += this.getLazyUnfilteredCount(keys) ?? (groupDeepMap?.get(keys)?.totalChildrenCount || 0);
|
|
16914
|
+
});
|
|
16915
|
+
return Math.max(unfilteredCount - childrenCount, 0);
|
|
16916
|
+
}
|
|
16790
16917
|
getGroupCount(groupKeys) {
|
|
16791
16918
|
if (groupKeys.length == 0) {
|
|
16792
|
-
return this.getConfig().totalCount;
|
|
16919
|
+
return this.getLazyUnfilteredCount([]) ?? this.getConfig().totalCount;
|
|
16920
|
+
}
|
|
16921
|
+
if (this.targetsFilteredOutRows()) {
|
|
16922
|
+
return getUnfilteredGroups(this.getConfig()).get(groupKeys)?.count ?? 0;
|
|
16793
16923
|
}
|
|
16794
16924
|
const groupDeepMap = this.getGroupDeepMap();
|
|
16795
16925
|
const deepMapValue = groupDeepMap?.get(groupKeys);
|
|
16796
16926
|
if (!deepMapValue) {
|
|
16797
16927
|
return 0;
|
|
16798
16928
|
}
|
|
16799
|
-
return deepMapValue.totalChildrenCount ?? (deepMapValue.items.length || 0);
|
|
16929
|
+
return this.getLazyUnfilteredCount(groupKeys) ?? deepMapValue.totalChildrenCount ?? (deepMapValue.items.length || 0);
|
|
16800
16930
|
}
|
|
16801
16931
|
getGroupKeysDirectlyInsideGroup(groupKeys) {
|
|
16802
|
-
const
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
|
|
16932
|
+
const config = this.getConfig();
|
|
16933
|
+
const options = { excludeSelf: true, depthLimit: 1 };
|
|
16934
|
+
if (this.targetsFilteredOutRows()) {
|
|
16935
|
+
return getUnfilteredGroups(config).getKeysStartingWith(
|
|
16936
|
+
groupKeys,
|
|
16937
|
+
options
|
|
16938
|
+
);
|
|
16939
|
+
}
|
|
16940
|
+
return config.groupDeepMap?.getKeysStartingWith(groupKeys, options) || [];
|
|
16807
16941
|
}
|
|
16808
16942
|
getAllPrimaryKeysInsideGroup(groupKeys) {
|
|
16809
|
-
const
|
|
16943
|
+
const config = this.getConfig();
|
|
16944
|
+
const { groupDeepMap, toPrimaryKey } = config;
|
|
16945
|
+
if (this.targetsFilteredOutRows()) {
|
|
16946
|
+
return groupKeys.length ? getUnfilteredPrimaryKeysInsideGroup(
|
|
16947
|
+
getUnfilteredGroups(config),
|
|
16948
|
+
groupKeys
|
|
16949
|
+
) : (config.originalDataArray ?? []).map(toPrimaryKey);
|
|
16950
|
+
}
|
|
16951
|
+
if (!config.groupBy.length) {
|
|
16952
|
+
return this.getVisibleDataInsideGroup([]).map(toPrimaryKey);
|
|
16953
|
+
}
|
|
16810
16954
|
if (!groupKeys.length) {
|
|
16811
16955
|
const topLevelKeys = groupDeepMap?.getKeysStartingWith([], {
|
|
16812
16956
|
excludeSelf: true,
|
|
@@ -16844,7 +16988,7 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16844
16988
|
if (this.onlyUsePrimaryKeys) {
|
|
16845
16989
|
return keys[0];
|
|
16846
16990
|
}
|
|
16847
|
-
return keys.length
|
|
16991
|
+
return groupByLength === 0 && keys.length === 1 ? keys[0] : keys;
|
|
16848
16992
|
});
|
|
16849
16993
|
};
|
|
16850
16994
|
const selectedRows = normalize(this.selectedMap.topDownKeys());
|
|
@@ -16856,6 +17000,14 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16856
17000
|
};
|
|
16857
17001
|
}
|
|
16858
17002
|
deselectAll() {
|
|
17003
|
+
if (this.targetsVisibleRowsOnly()) {
|
|
17004
|
+
if (this.onlyUsePrimaryKeys) {
|
|
17005
|
+
this.deselectGroupRow([]);
|
|
17006
|
+
} else {
|
|
17007
|
+
this.setVisibleRowsSelection([], false);
|
|
17008
|
+
}
|
|
17009
|
+
return;
|
|
17010
|
+
}
|
|
16859
17011
|
this.update({
|
|
16860
17012
|
defaultSelection: false,
|
|
16861
17013
|
selectedRows: [],
|
|
@@ -16863,6 +17015,14 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
16863
17015
|
});
|
|
16864
17016
|
}
|
|
16865
17017
|
selectAll() {
|
|
17018
|
+
if (this.targetsVisibleRowsOnly()) {
|
|
17019
|
+
if (this.onlyUsePrimaryKeys) {
|
|
17020
|
+
this.selectGroupRow([]);
|
|
17021
|
+
} else {
|
|
17022
|
+
this.setVisibleRowsSelection([], true);
|
|
17023
|
+
}
|
|
17024
|
+
return;
|
|
17025
|
+
}
|
|
16866
17026
|
this.update({
|
|
16867
17027
|
defaultSelection: true,
|
|
16868
17028
|
deselectedRows: [],
|
|
@@ -17017,6 +17177,10 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17017
17177
|
this.xcache();
|
|
17018
17178
|
return;
|
|
17019
17179
|
}
|
|
17180
|
+
if (this.targetsVisibleRowsOnly() && this.hasFilteredOutRowsInsideGroup(groupKeys)) {
|
|
17181
|
+
this.setVisibleRowsSelection(groupKeys, true);
|
|
17182
|
+
return;
|
|
17183
|
+
}
|
|
17020
17184
|
const selectedKeys = this.selectedMap.getKeysStartingWith(groupKeys, {
|
|
17021
17185
|
excludeSelf: true
|
|
17022
17186
|
});
|
|
@@ -17045,6 +17209,10 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17045
17209
|
this.xcache();
|
|
17046
17210
|
return;
|
|
17047
17211
|
}
|
|
17212
|
+
if (this.targetsVisibleRowsOnly() && this.hasFilteredOutRowsInsideGroup(groupKeys)) {
|
|
17213
|
+
this.setVisibleRowsSelection(groupKeys, false);
|
|
17214
|
+
return;
|
|
17215
|
+
}
|
|
17048
17216
|
const deselectedKeys = this.deselectedMap.getKeysStartingWith(groupKeys, {
|
|
17049
17217
|
excludeSelf: true
|
|
17050
17218
|
});
|
|
@@ -17143,7 +17311,7 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17143
17311
|
this.selectionCountCache.set(groupKeys, result2);
|
|
17144
17312
|
return result2;
|
|
17145
17313
|
}
|
|
17146
|
-
if (
|
|
17314
|
+
if (this.onlyUsePrimaryKeys && (groupByLength || this.targetsVisibleRowsOnly())) {
|
|
17147
17315
|
const allKeys2 = this.getAllPrimaryKeysInsideGroup(groupKeys);
|
|
17148
17316
|
let selectedCount2 = 0;
|
|
17149
17317
|
let deselectedCount2 = 0;
|
|
@@ -17169,6 +17337,21 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17169
17337
|
this.selectionCountCache.set(groupKeys, result2);
|
|
17170
17338
|
return result2;
|
|
17171
17339
|
}
|
|
17340
|
+
if (groupKeys.length === groupByLength && this.targetsVisibleRowsOnly()) {
|
|
17341
|
+
const { toPrimaryKey } = this.getConfig();
|
|
17342
|
+
let selectedCount2 = 0;
|
|
17343
|
+
let deselectedCount2 = 0;
|
|
17344
|
+
this.getVisibleDataInsideGroup(groupKeys).forEach((data) => {
|
|
17345
|
+
if (this.isRowSelected(toPrimaryKey(data), groupKeys)) {
|
|
17346
|
+
selectedCount2++;
|
|
17347
|
+
} else {
|
|
17348
|
+
deselectedCount2++;
|
|
17349
|
+
}
|
|
17350
|
+
});
|
|
17351
|
+
const result2 = { selectedCount: selectedCount2, deselectedCount: deselectedCount2 };
|
|
17352
|
+
this.selectionCountCache.set(groupKeys, result2);
|
|
17353
|
+
return result2;
|
|
17354
|
+
}
|
|
17172
17355
|
parentSelected = parentSelected ?? this.getGroupRowBooleanSelectionStateFromParent(groupKeys);
|
|
17173
17356
|
let allKeys = this.getGroupKeysDirectlyInsideGroup(groupKeys);
|
|
17174
17357
|
if (groupKeys.length === this.getGroupByLength()) {
|
|
@@ -17192,8 +17375,9 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17192
17375
|
}
|
|
17193
17376
|
let selectedCount = 0;
|
|
17194
17377
|
let deselectedCount = 0;
|
|
17195
|
-
|
|
17196
|
-
|
|
17378
|
+
const { lazyLoad, groupDeepMap } = this.getConfig();
|
|
17379
|
+
if (lazyLoad && !allKeys.length) {
|
|
17380
|
+
const totalChildrenCount = this.getLazyUnfilteredCount(groupKeys) ?? (groupDeepMap?.get(groupKeys)?.totalChildrenCount || 0);
|
|
17197
17381
|
if (parentSelected) {
|
|
17198
17382
|
selectedCount = totalChildrenCount;
|
|
17199
17383
|
deselectedCount = this.deselectedMap.getAllChildrenSizeFor(groupKeys);
|
|
@@ -17216,6 +17400,12 @@ var RowSelectionState = class _RowSelectionState {
|
|
|
17216
17400
|
selectedCount += selCount;
|
|
17217
17401
|
deselectedCount += deselCount;
|
|
17218
17402
|
});
|
|
17403
|
+
const hiddenCount = allKeys.length ? this.getLazyHiddenRowsCount(groupKeys) : 0;
|
|
17404
|
+
if (parentSelected) {
|
|
17405
|
+
selectedCount += hiddenCount;
|
|
17406
|
+
} else {
|
|
17407
|
+
deselectedCount += hiddenCount;
|
|
17408
|
+
}
|
|
17219
17409
|
const result = {
|
|
17220
17410
|
selectedCount,
|
|
17221
17411
|
deselectedCount
|
|
@@ -17235,14 +17425,22 @@ function cloneRowSelection(rowSelection, stateOrGetDataSourceState) {
|
|
|
17235
17425
|
function rowSelectionStateConfigGetter(stateOrStateGetter) {
|
|
17236
17426
|
return () => {
|
|
17237
17427
|
const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
|
|
17428
|
+
const { originalDataArray, postFilterDataArray } = state;
|
|
17429
|
+
const lazyLoad = !!state.lazyLoad;
|
|
17430
|
+
const lazyRoot = lazyLoad ? state.originalLazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]) : void 0;
|
|
17238
17431
|
return {
|
|
17239
|
-
lazyLoad
|
|
17432
|
+
lazyLoad,
|
|
17240
17433
|
toPrimaryKey: state.toPrimaryKey,
|
|
17241
17434
|
onlyUsePrimaryKeys: !state.useGroupKeysForMultiRowSelection,
|
|
17242
17435
|
groupBy: state.groupBy,
|
|
17243
17436
|
groupDeepMap: state.groupDeepMap,
|
|
17244
17437
|
indexer: state.indexer,
|
|
17245
|
-
totalCount: state.unfilteredCount
|
|
17438
|
+
totalCount: lazyLoad ? originalDataArray?.length ?? 0 : state.unfilteredCount,
|
|
17439
|
+
lazyUnfilteredCount: state.groupBy.length ? lazyRoot?.totalChildrenCountUnfiltered : lazyRoot?.totalCountUnfiltered,
|
|
17440
|
+
multiRowSelectionTarget: state.multiRowSelectionTarget,
|
|
17441
|
+
someRowsFilteredOut: !state.lazyLoad && !!originalDataArray && !!postFilterDataArray && postFilterDataArray.length < originalDataArray.length,
|
|
17442
|
+
originalDataArray,
|
|
17443
|
+
postFilterDataArray
|
|
17246
17444
|
};
|
|
17247
17445
|
};
|
|
17248
17446
|
}
|
|
@@ -18177,6 +18375,9 @@ var TreeExpandState = class {
|
|
|
18177
18375
|
};
|
|
18178
18376
|
|
|
18179
18377
|
// src/components/DataSource/TreeSelectionState.ts
|
|
18378
|
+
var toTreePathsMap = (treePaths) => {
|
|
18379
|
+
return Array.isArray(treePaths) ? new DeepMap(treePaths.map((path) => [path, true])) : treePaths;
|
|
18380
|
+
};
|
|
18180
18381
|
var shortestToLongest = (a, b) => a.length - b.length;
|
|
18181
18382
|
var TreeSelectionState = class _TreeSelectionState {
|
|
18182
18383
|
constructor(state, getConfig) {
|
|
@@ -18203,13 +18404,7 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18203
18404
|
}
|
|
18204
18405
|
}
|
|
18205
18406
|
getTreePaths(treePaths) {
|
|
18206
|
-
|
|
18207
|
-
if (Array.isArray(treePaths)) {
|
|
18208
|
-
return new DeepMap(treePaths.map((path) => [path, true]));
|
|
18209
|
-
}
|
|
18210
|
-
return treePaths;
|
|
18211
|
-
}
|
|
18212
|
-
return this.config.treePaths;
|
|
18407
|
+
return treePaths ? toTreePathsMap(treePaths) : this.config.treePaths;
|
|
18213
18408
|
}
|
|
18214
18409
|
withTreePaths(fn, treePaths) {
|
|
18215
18410
|
const initialTreePaths = this.config.treePaths;
|
|
@@ -18282,11 +18477,38 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18282
18477
|
setConfig(getConfig) {
|
|
18283
18478
|
const config = typeof getConfig === "function" ? getConfig() : getConfig;
|
|
18284
18479
|
this.config = {
|
|
18285
|
-
treePaths:
|
|
18286
|
-
strictCheckPaths: config.strictCheckPaths ?? true
|
|
18480
|
+
treePaths: toTreePathsMap(config.treePaths),
|
|
18481
|
+
strictCheckPaths: config.strictCheckPaths ?? true,
|
|
18482
|
+
multiRowSelectionTarget: config.multiRowSelectionTarget,
|
|
18483
|
+
unfilteredTreePaths: config.unfilteredTreePaths ? toTreePathsMap(config.unfilteredTreePaths) : void 0
|
|
18287
18484
|
};
|
|
18288
18485
|
this.xcache();
|
|
18289
18486
|
}
|
|
18487
|
+
hasFilteredOutLeavesInside(nodePath) {
|
|
18488
|
+
const { multiRowSelectionTarget, unfilteredTreePaths, treePaths } = this.config;
|
|
18489
|
+
if (multiRowSelectionTarget !== "visible" || !unfilteredTreePaths || unfilteredTreePaths === treePaths) {
|
|
18490
|
+
return false;
|
|
18491
|
+
}
|
|
18492
|
+
return unfilteredTreePaths.getAllChildrenSizeFor(nodePath) > treePaths.getAllChildrenSizeFor(nodePath);
|
|
18493
|
+
}
|
|
18494
|
+
/**
|
|
18495
|
+
* Sets the selection of each visible leaf node inside the node, by its path,
|
|
18496
|
+
* so the leaf nodes that are filtered out keep their selection
|
|
18497
|
+
*/
|
|
18498
|
+
setVisibleLeafNodesSelection(nodePath, selected) {
|
|
18499
|
+
const { unfilteredTreePaths, treePaths } = this.config;
|
|
18500
|
+
this.xcache();
|
|
18501
|
+
treePaths.getKeysForLeafNodesStartingWith(nodePath).forEach((leafPath) => {
|
|
18502
|
+
if (unfilteredTreePaths.getAllChildrenSizeFor(leafPath) > 0) {
|
|
18503
|
+
return;
|
|
18504
|
+
}
|
|
18505
|
+
this.selectionMap.delete(leafPath);
|
|
18506
|
+
if (this.isNodeSelected(leafPath) !== selected) {
|
|
18507
|
+
this.setSelectionForPath(leafPath, selected);
|
|
18508
|
+
}
|
|
18509
|
+
});
|
|
18510
|
+
this.xcache();
|
|
18511
|
+
}
|
|
18290
18512
|
xcache() {
|
|
18291
18513
|
this.cache.clear();
|
|
18292
18514
|
}
|
|
@@ -18327,6 +18549,10 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18327
18549
|
};
|
|
18328
18550
|
}
|
|
18329
18551
|
deselectAll() {
|
|
18552
|
+
if (this.hasFilteredOutLeavesInside([])) {
|
|
18553
|
+
this.setVisibleLeafNodesSelection([], false);
|
|
18554
|
+
return;
|
|
18555
|
+
}
|
|
18330
18556
|
this.update({
|
|
18331
18557
|
defaultSelection: false,
|
|
18332
18558
|
selectedPaths: [],
|
|
@@ -18334,6 +18560,10 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18334
18560
|
});
|
|
18335
18561
|
}
|
|
18336
18562
|
selectAll() {
|
|
18563
|
+
if (this.hasFilteredOutLeavesInside([])) {
|
|
18564
|
+
this.setVisibleLeafNodesSelection([], true);
|
|
18565
|
+
return;
|
|
18566
|
+
}
|
|
18337
18567
|
this.update({
|
|
18338
18568
|
defaultSelection: true,
|
|
18339
18569
|
deselectedPaths: [],
|
|
@@ -18485,6 +18715,10 @@ var TreeSelectionState = class _TreeSelectionState {
|
|
|
18485
18715
|
if (!nodePath.length) {
|
|
18486
18716
|
return;
|
|
18487
18717
|
}
|
|
18718
|
+
if (this.hasFilteredOutLeavesInside(nodePath)) {
|
|
18719
|
+
this.setVisibleLeafNodesSelection(nodePath, selected);
|
|
18720
|
+
return;
|
|
18721
|
+
}
|
|
18488
18722
|
this.xcache();
|
|
18489
18723
|
const keys = this.selectionMap.getKeysStartingWith(nodePath);
|
|
18490
18724
|
keys.forEach((nodePath2) => {
|
|
@@ -18541,8 +18775,17 @@ function cloneTreeSelection(treeSelection2, stateOrGetState) {
|
|
|
18541
18775
|
function treeSelectionStateConfigGetter(stateOrStateGetter) {
|
|
18542
18776
|
return () => {
|
|
18543
18777
|
const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
|
|
18778
|
+
const { treePaths, unfilteredTreePaths, multiRowSelectionTarget } = state;
|
|
18779
|
+
if (multiRowSelectionTarget === "visible") {
|
|
18780
|
+
return {
|
|
18781
|
+
treePaths,
|
|
18782
|
+
unfilteredTreePaths,
|
|
18783
|
+
multiRowSelectionTarget
|
|
18784
|
+
};
|
|
18785
|
+
}
|
|
18544
18786
|
return {
|
|
18545
|
-
treePaths:
|
|
18787
|
+
treePaths: unfilteredTreePaths ?? treePaths,
|
|
18788
|
+
multiRowSelectionTarget
|
|
18546
18789
|
};
|
|
18547
18790
|
};
|
|
18548
18791
|
}
|
|
@@ -20607,6 +20850,7 @@ var forwardProps3 = (setupState, props) => {
|
|
|
20607
20850
|
treeFilterFunction: 1,
|
|
20608
20851
|
filterValue: 1,
|
|
20609
20852
|
useGroupKeysForMultiRowSelection: (useGroupKeysForMultiRowSelection) => useGroupKeysForMultiRowSelection ?? false,
|
|
20853
|
+
multiRowSelectionTarget: (multiRowSelectionTarget) => multiRowSelectionTarget ?? "all",
|
|
20610
20854
|
filterDelay: (filterDelay) => filterDelay ?? 200,
|
|
20611
20855
|
filterTypes: (filterTypes) => {
|
|
20612
20856
|
return { ...defaultFilterTypes2, ...filterTypes };
|
|
@@ -21670,12 +21914,14 @@ function concludeReducer(params) {
|
|
|
21670
21914
|
"rowSelection",
|
|
21671
21915
|
"cellSelection",
|
|
21672
21916
|
"isRowSelected",
|
|
21917
|
+
"multiRowSelectionTarget",
|
|
21673
21918
|
"originalLazyGroupDataChangeDetect"
|
|
21674
21919
|
]);
|
|
21675
21920
|
const treeSelectionDepsChanged = haveDepsChanged(previousState, state, [
|
|
21676
21921
|
"treeSelection",
|
|
21677
21922
|
"cellSelection",
|
|
21678
21923
|
"isNodeSelected",
|
|
21924
|
+
"multiRowSelectionTarget",
|
|
21679
21925
|
"originalLazyGroupDataChangeDetect"
|
|
21680
21926
|
]);
|
|
21681
21927
|
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
@@ -21809,6 +22055,9 @@ function concludeReducer(params) {
|
|
|
21809
22055
|
const rowSelectionState = state.rowSelection instanceof RowSelectionState ? state.rowSelection : void 0;
|
|
21810
22056
|
const treeExpandState = state.treeExpandState instanceof TreeExpandState ? state.treeExpandState : void 0;
|
|
21811
22057
|
const cellSelectionState = state.cellSelection instanceof CellSelectionState ? state.cellSelection : void 0;
|
|
22058
|
+
if (rowSelectionState) {
|
|
22059
|
+
rowSelectionState.getConfig = rowSelectionStateConfigGetter(state);
|
|
22060
|
+
}
|
|
21812
22061
|
rowSelectionState?.xcache();
|
|
21813
22062
|
let isRowSelected = state.selectionMode === "single-row" ? (rowInfo) => {
|
|
21814
22063
|
return rowInfo.id === state.rowSelection;
|
|
@@ -22103,6 +22352,14 @@ function concludeReducer(params) {
|
|
|
22103
22352
|
}
|
|
22104
22353
|
}
|
|
22105
22354
|
});
|
|
22355
|
+
const { rowSelection } = state;
|
|
22356
|
+
if (rowSelection instanceof RowSelectionState && rowSelection.getLazyHiddenRowsCount([])) {
|
|
22357
|
+
if (rowSelection.defaultSelection) {
|
|
22358
|
+
someRowsSelected = true;
|
|
22359
|
+
} else {
|
|
22360
|
+
allRowsSelected = false;
|
|
22361
|
+
}
|
|
22362
|
+
}
|
|
22106
22363
|
state.allRowsSelected = allRowsSelected;
|
|
22107
22364
|
state.someRowsSelected = someRowsSelected;
|
|
22108
22365
|
if (debugId) {
|
|
@@ -22115,10 +22372,14 @@ function concludeReducer(params) {
|
|
|
22115
22372
|
debugId
|
|
22116
22373
|
).track.DataSource.label.ComputeSelectionCount.start();
|
|
22117
22374
|
}
|
|
22118
|
-
const
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22375
|
+
const selectionCount = state.isTree ? state.treeSelectionState?.getSelectionCountFor([]) : state.rowSelection.getSelectionCountFor([]);
|
|
22376
|
+
if (selectionCount) {
|
|
22377
|
+
state.allRowsSelected = selectionCount.deselectedCount === 0;
|
|
22378
|
+
state.someRowsSelected = selectionCount.selectedCount > 0;
|
|
22379
|
+
} else {
|
|
22380
|
+
state.allRowsSelected = state.totalLeafNodesCount === 0;
|
|
22381
|
+
state.someRowsSelected = false;
|
|
22382
|
+
}
|
|
22122
22383
|
if (debugId) {
|
|
22123
22384
|
marker?.end();
|
|
22124
22385
|
marker = void 0;
|
|
@@ -22217,6 +22478,9 @@ function buildDataSourceDataParams(componentState, overrides, masterContext) {
|
|
|
22217
22478
|
dataSourceParams.lazyLoadStartIndex = 0;
|
|
22218
22479
|
}
|
|
22219
22480
|
dataSourceParams.groupKeys = [];
|
|
22481
|
+
if (componentState.selectionMode === "multi-row") {
|
|
22482
|
+
dataSourceParams.multiRowSelectionTarget = componentState.multiRowSelectionTarget;
|
|
22483
|
+
}
|
|
22220
22484
|
}
|
|
22221
22485
|
if (overrides) {
|
|
22222
22486
|
Object.assign(dataSourceParams, overrides);
|
|
@@ -22293,8 +22557,7 @@ function loadData(data, componentState, actions, overrides, masterContext) {
|
|
|
22293
22557
|
childrenLoading: true,
|
|
22294
22558
|
childrenAvailable: false,
|
|
22295
22559
|
cache: CACHE_DEFAULT,
|
|
22296
|
-
totalCount: 0
|
|
22297
|
-
totalCountUnfiltered: 0
|
|
22560
|
+
totalCount: 0
|
|
22298
22561
|
});
|
|
22299
22562
|
}
|
|
22300
22563
|
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
@@ -22333,7 +22596,9 @@ function loadData(data, componentState, actions, overrides, masterContext) {
|
|
|
22333
22596
|
childrenLoading: false,
|
|
22334
22597
|
childrenAvailable: true,
|
|
22335
22598
|
totalCount: remoteData2.totalCount ?? dataArray2.length,
|
|
22336
|
-
|
|
22599
|
+
// set even when missing, so a previous response's values are not kept
|
|
22600
|
+
totalCountUnfiltered: remoteData2.totalCountUnfiltered,
|
|
22601
|
+
totalChildrenCountUnfiltered: remoteData2.totalChildrenCountUnfiltered,
|
|
22337
22602
|
children: dataArray2,
|
|
22338
22603
|
error: remoteData2.error
|
|
22339
22604
|
};
|
|
@@ -27893,7 +28158,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
27893
28158
|
}
|
|
27894
28159
|
let valid2 = isValidLicense(licenseKey, {
|
|
27895
28160
|
publishedAt: 1624970570587,
|
|
27896
|
-
version: "9.
|
|
28161
|
+
version: "9.3.0"
|
|
27897
28162
|
});
|
|
27898
28163
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
27899
28164
|
return true;
|