@infinite-table/infinite-react 6.0.6 → 6.0.8
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 +5 -1
- package/index.dev.js +65 -32
- package/index.dev.mjs +65 -32
- package/index.js +65 -32
- package/index.mjs +65 -32
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -2222,6 +2222,7 @@ declare class DataSourceCache<DataType, PrimaryKeyType = string> {
|
|
|
2222
2222
|
getMutations: () => Map<PrimaryKeyType, DataSourceMutation<DataType>[]>;
|
|
2223
2223
|
getTreeMutations: () => DeepMap<NodePath$1<any>, DataSourceMutation<DataType>[]>;
|
|
2224
2224
|
getMutationsArray: () => DataSourceMutation<DataType>[];
|
|
2225
|
+
getTreeMutationsArray: () => DataSourceMutation<DataType>[];
|
|
2225
2226
|
}
|
|
2226
2227
|
|
|
2227
2228
|
declare type TreeExpandStateApi<T> = {
|
|
@@ -2608,7 +2609,10 @@ interface DataSourceApi<T> {
|
|
|
2608
2609
|
updateData(data: Partial<T>, options?: DataSourceCRUDParam): Promise<any>;
|
|
2609
2610
|
updateDataByNodePath(data: Partial<T>, nodePath: NodePath$1, options?: DataSourceUpdateParam): Promise<any>;
|
|
2610
2611
|
updateDataArray(data: Partial<T>[], options?: DataSourceCRUDParam): Promise<any>;
|
|
2611
|
-
updateDataArrayByNodePath(
|
|
2612
|
+
updateDataArrayByNodePath(updateInfo: {
|
|
2613
|
+
data: Partial<T>;
|
|
2614
|
+
nodePath: NodePath$1;
|
|
2615
|
+
}[], options?: DataSourceUpdateParam): Promise<any>;
|
|
2612
2616
|
flush(): Promise<any>;
|
|
2613
2617
|
removeDataByPrimaryKey(id: any, options?: DataSourceCRUDParam): Promise<any>;
|
|
2614
2618
|
removeDataByNodePath(nodePath: NodePath$1, options?: DataSourceCRUDParam): Promise<any>;
|
package/index.dev.js
CHANGED
|
@@ -10660,8 +10660,11 @@ var Indexer = class {
|
|
|
10660
10660
|
arr = arr.concat();
|
|
10661
10661
|
}
|
|
10662
10662
|
if (!arr.length && cache) {
|
|
10663
|
-
|
|
10664
|
-
|
|
10663
|
+
if (!cache.isEmpty()) {
|
|
10664
|
+
const cacheInfo = [
|
|
10665
|
+
...cache.getMutationsArray(),
|
|
10666
|
+
...cache.getTreeMutationsArray()
|
|
10667
|
+
];
|
|
10665
10668
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
10666
10669
|
const info = cacheInfo[cacheIndex];
|
|
10667
10670
|
if (info.type === "insert") {
|
|
@@ -12099,9 +12102,9 @@ function getRowInfoArray(getState) {
|
|
|
12099
12102
|
}
|
|
12100
12103
|
|
|
12101
12104
|
// src/components/DataSource/TreeApi.ts
|
|
12102
|
-
function cloneTreeSelection(
|
|
12105
|
+
function cloneTreeSelection(treeSelection2, stateOrGetState) {
|
|
12103
12106
|
return new TreeSelectionState(
|
|
12104
|
-
|
|
12107
|
+
treeSelection2,
|
|
12105
12108
|
treeSelectionStateConfigGetter(stateOrGetState)
|
|
12106
12109
|
);
|
|
12107
12110
|
}
|
|
@@ -12116,7 +12119,7 @@ function treeSelectionStateConfigGetter(stateOrStateGetter) {
|
|
|
12116
12119
|
var TreeApiImpl = class {
|
|
12117
12120
|
constructor(param) {
|
|
12118
12121
|
this.setNodeSelection = (nodePath, selected) => {
|
|
12119
|
-
const { treeSelectionState:
|
|
12122
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12120
12123
|
if (selectionMode === "single-row") {
|
|
12121
12124
|
this.actions.treeSelection = selected ? nodePath[nodePath.length - 1] : null;
|
|
12122
12125
|
return;
|
|
@@ -12124,11 +12127,11 @@ var TreeApiImpl = class {
|
|
|
12124
12127
|
if (selectionMode !== "multi-row") {
|
|
12125
12128
|
throw "Selection mode is not multi-row or single-row";
|
|
12126
12129
|
}
|
|
12127
|
-
if (!(
|
|
12130
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12128
12131
|
throw "Invalid tree selection";
|
|
12129
12132
|
}
|
|
12130
12133
|
const treeSelectionState = new TreeSelectionState(
|
|
12131
|
-
|
|
12134
|
+
treeSelection2,
|
|
12132
12135
|
treeSelectionStateConfigGetter(this.getState)
|
|
12133
12136
|
);
|
|
12134
12137
|
treeSelectionState.setNodeSelection(nodePath, selected);
|
|
@@ -12251,15 +12254,15 @@ var TreeApiImpl = class {
|
|
|
12251
12254
|
return null;
|
|
12252
12255
|
}
|
|
12253
12256
|
selectAll() {
|
|
12254
|
-
const { treeSelectionState:
|
|
12257
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12255
12258
|
if (selectionMode !== "multi-row") {
|
|
12256
12259
|
throw "Selection mode is not multi-row";
|
|
12257
12260
|
}
|
|
12258
|
-
if (!(
|
|
12261
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12259
12262
|
throw "Invalid node selection";
|
|
12260
12263
|
}
|
|
12261
12264
|
const treeSelectionState = new TreeSelectionState(
|
|
12262
|
-
|
|
12265
|
+
treeSelection2,
|
|
12263
12266
|
treeSelectionStateConfigGetter(this.getState)
|
|
12264
12267
|
);
|
|
12265
12268
|
treeSelectionState.selectAll();
|
|
@@ -12267,15 +12270,15 @@ var TreeApiImpl = class {
|
|
|
12267
12270
|
this.actions.treeSelection = treeSelectionState;
|
|
12268
12271
|
}
|
|
12269
12272
|
deselectAll() {
|
|
12270
|
-
const { treeSelectionState:
|
|
12273
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12271
12274
|
if (selectionMode !== "multi-row") {
|
|
12272
12275
|
throw "Selection mode is not multi-row";
|
|
12273
12276
|
}
|
|
12274
|
-
if (!(
|
|
12277
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12275
12278
|
throw "Invalid node selection";
|
|
12276
12279
|
}
|
|
12277
12280
|
const treeSelectionState = new TreeSelectionState(
|
|
12278
|
-
|
|
12281
|
+
treeSelection2,
|
|
12279
12282
|
treeSelectionStateConfigGetter(this.getState)
|
|
12280
12283
|
);
|
|
12281
12284
|
treeSelectionState.deselectAll();
|
|
@@ -12283,21 +12286,25 @@ var TreeApiImpl = class {
|
|
|
12283
12286
|
this.actions.treeSelection = treeSelectionState;
|
|
12284
12287
|
}
|
|
12285
12288
|
isNodeSelected(nodePath) {
|
|
12286
|
-
const {
|
|
12289
|
+
const {
|
|
12290
|
+
treeSelectionState,
|
|
12291
|
+
treeSelection: singleTreeSelection,
|
|
12292
|
+
selectionMode
|
|
12293
|
+
} = this.getState();
|
|
12287
12294
|
if (selectionMode === "single-row") {
|
|
12288
12295
|
const pk = nodePath[nodePath.length - 1];
|
|
12289
|
-
if (Array.isArray(
|
|
12296
|
+
if (Array.isArray(singleTreeSelection)) {
|
|
12290
12297
|
return treeSelection.join(",") === nodePath.join(",");
|
|
12291
12298
|
}
|
|
12292
|
-
return
|
|
12299
|
+
return singleTreeSelection === pk;
|
|
12293
12300
|
}
|
|
12294
12301
|
if (selectionMode !== "multi-row") {
|
|
12295
12302
|
throw "Selection mode is not multi-row or single-row";
|
|
12296
12303
|
}
|
|
12297
|
-
if (!(
|
|
12304
|
+
if (!(treeSelectionState instanceof TreeSelectionState)) {
|
|
12298
12305
|
throw "Invalid tree selection";
|
|
12299
12306
|
}
|
|
12300
|
-
return
|
|
12307
|
+
return treeSelectionState.isNodeSelected(nodePath);
|
|
12301
12308
|
}
|
|
12302
12309
|
selectNode(nodePath) {
|
|
12303
12310
|
this.setNodeSelection(nodePath, true);
|
|
@@ -12817,10 +12824,10 @@ function getMappedCallbacks() {
|
|
|
12817
12824
|
]
|
|
12818
12825
|
};
|
|
12819
12826
|
},
|
|
12820
|
-
treeSelection: (
|
|
12827
|
+
treeSelection: (treeSelection2, state) => {
|
|
12821
12828
|
if (state.selectionMode === "single-row") {
|
|
12822
12829
|
const callbackParams2 = [
|
|
12823
|
-
|
|
12830
|
+
treeSelection2,
|
|
12824
12831
|
{ selectionMode: "single-row" }
|
|
12825
12832
|
];
|
|
12826
12833
|
return {
|
|
@@ -12828,7 +12835,7 @@ function getMappedCallbacks() {
|
|
|
12828
12835
|
};
|
|
12829
12836
|
}
|
|
12830
12837
|
const callbackParams = [
|
|
12831
|
-
|
|
12838
|
+
treeSelection2.getState(),
|
|
12832
12839
|
{
|
|
12833
12840
|
selectionMode: "multi-row",
|
|
12834
12841
|
lastUpdatedNodePath: state.lastSelectionUpdatedNodePathRef.current,
|
|
@@ -13141,6 +13148,9 @@ var DataSourceCache = class {
|
|
|
13141
13148
|
this.getMutationsArray = () => {
|
|
13142
13149
|
return Array.from(this.primaryKeyToData.values()).flat();
|
|
13143
13150
|
};
|
|
13151
|
+
this.getTreeMutationsArray = () => {
|
|
13152
|
+
return Array.from(this.nodePathToData.values()).flat();
|
|
13153
|
+
};
|
|
13144
13154
|
}
|
|
13145
13155
|
static clone(cache, { light = false } = {}) {
|
|
13146
13156
|
const clone = new DataSourceCache();
|
|
@@ -13278,9 +13288,23 @@ var DataSourceApiImpl = class {
|
|
|
13278
13288
|
return result;
|
|
13279
13289
|
};
|
|
13280
13290
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
13281
|
-
return this.updateDataArrayByNodePath(
|
|
13291
|
+
return this.updateDataArrayByNodePath(
|
|
13292
|
+
[
|
|
13293
|
+
{
|
|
13294
|
+
data,
|
|
13295
|
+
nodePath
|
|
13296
|
+
}
|
|
13297
|
+
],
|
|
13298
|
+
options
|
|
13299
|
+
);
|
|
13282
13300
|
};
|
|
13283
|
-
this.updateDataArrayByNodePath = (
|
|
13301
|
+
this.updateDataArrayByNodePath = (updateInfo, options) => {
|
|
13302
|
+
const data = [];
|
|
13303
|
+
const nodePaths = [];
|
|
13304
|
+
updateInfo.forEach((info) => {
|
|
13305
|
+
data.push(info.data);
|
|
13306
|
+
nodePaths.push(info.nodePath);
|
|
13307
|
+
});
|
|
13284
13308
|
const result = this.batchOperation({
|
|
13285
13309
|
type: "update",
|
|
13286
13310
|
array: data,
|
|
@@ -15559,7 +15583,8 @@ function getColumnRenderParam(options) {
|
|
|
15559
15583
|
all: null,
|
|
15560
15584
|
value: typeof value === "boolean" ? `${value}` : value,
|
|
15561
15585
|
selectionCheckBox: null,
|
|
15562
|
-
groupIcon: null
|
|
15586
|
+
groupIcon: null,
|
|
15587
|
+
treeIcon: null
|
|
15563
15588
|
},
|
|
15564
15589
|
selectCurrentRow: () => {
|
|
15565
15590
|
if (rowInfo.isTreeNode) {
|
|
@@ -16106,6 +16131,14 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
16106
16131
|
typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
|
|
16107
16132
|
if (fn === true) {
|
|
16108
16133
|
fn = defaultRenderTreeIcon;
|
|
16134
|
+
} else if (fn) {
|
|
16135
|
+
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
16136
|
+
RenderCellHookComponent,
|
|
16137
|
+
{
|
|
16138
|
+
render: defaultRenderTreeIcon,
|
|
16139
|
+
renderParam
|
|
16140
|
+
}
|
|
16141
|
+
);
|
|
16109
16142
|
}
|
|
16110
16143
|
if (fn) {
|
|
16111
16144
|
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
@@ -22141,7 +22174,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22141
22174
|
}
|
|
22142
22175
|
let valid2 = isValidLicense(licenseKey, {
|
|
22143
22176
|
publishedAt: 1624970570587,
|
|
22144
|
-
version: "6.0.
|
|
22177
|
+
version: "6.0.8"
|
|
22145
22178
|
});
|
|
22146
22179
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22147
22180
|
return true;
|
|
@@ -22693,7 +22726,7 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22693
22726
|
selectionMode,
|
|
22694
22727
|
groupBy,
|
|
22695
22728
|
rowSelection,
|
|
22696
|
-
treeSelectionState:
|
|
22729
|
+
treeSelectionState: treeSelection2,
|
|
22697
22730
|
isTree
|
|
22698
22731
|
} = dataSourceState;
|
|
22699
22732
|
if (keyboardSelection === false) {
|
|
@@ -22712,9 +22745,9 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22712
22745
|
return false;
|
|
22713
22746
|
}
|
|
22714
22747
|
if (key === "a" && (ctrlKey || metaKey)) {
|
|
22715
|
-
if (isTree &&
|
|
22748
|
+
if (isTree && treeSelection2) {
|
|
22716
22749
|
const treeSelectionState = cloneTreeSelection2(
|
|
22717
|
-
|
|
22750
|
+
treeSelection2
|
|
22718
22751
|
);
|
|
22719
22752
|
treeSelectionState.selectAll();
|
|
22720
22753
|
dataSourceActions.treeSelection = treeSelectionState;
|
|
@@ -23116,8 +23149,8 @@ async function onKeyDown(context, event) {
|
|
|
23116
23149
|
cloneRowSelection: (rowSelection) => {
|
|
23117
23150
|
return cloneRowSelection(rowSelection, context.getDataSourceState);
|
|
23118
23151
|
},
|
|
23119
|
-
cloneTreeSelection: (
|
|
23120
|
-
return cloneTreeSelection(
|
|
23152
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23153
|
+
return cloneTreeSelection(treeSelection2, context.getDataSourceState);
|
|
23121
23154
|
}
|
|
23122
23155
|
};
|
|
23123
23156
|
if (handleKeyboardSelection(keyboardHandlerContext, event)) {
|
|
@@ -23196,8 +23229,8 @@ function useEventHandlersContext() {
|
|
|
23196
23229
|
actions,
|
|
23197
23230
|
getDataSourceState,
|
|
23198
23231
|
dataSourceActions,
|
|
23199
|
-
cloneTreeSelection: (
|
|
23200
|
-
return cloneTreeSelection(
|
|
23232
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23233
|
+
return cloneTreeSelection(treeSelection2, getDataSourceState);
|
|
23201
23234
|
},
|
|
23202
23235
|
cloneRowSelection: (rowSelection) => {
|
|
23203
23236
|
return cloneRowSelection(rowSelection, getDataSourceState);
|
package/index.dev.mjs
CHANGED
|
@@ -10609,8 +10609,11 @@ var Indexer = class {
|
|
|
10609
10609
|
arr = arr.concat();
|
|
10610
10610
|
}
|
|
10611
10611
|
if (!arr.length && cache) {
|
|
10612
|
-
|
|
10613
|
-
|
|
10612
|
+
if (!cache.isEmpty()) {
|
|
10613
|
+
const cacheInfo = [
|
|
10614
|
+
...cache.getMutationsArray(),
|
|
10615
|
+
...cache.getTreeMutationsArray()
|
|
10616
|
+
];
|
|
10614
10617
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
10615
10618
|
const info = cacheInfo[cacheIndex];
|
|
10616
10619
|
if (info.type === "insert") {
|
|
@@ -12048,9 +12051,9 @@ function getRowInfoArray(getState) {
|
|
|
12048
12051
|
}
|
|
12049
12052
|
|
|
12050
12053
|
// src/components/DataSource/TreeApi.ts
|
|
12051
|
-
function cloneTreeSelection(
|
|
12054
|
+
function cloneTreeSelection(treeSelection2, stateOrGetState) {
|
|
12052
12055
|
return new TreeSelectionState(
|
|
12053
|
-
|
|
12056
|
+
treeSelection2,
|
|
12054
12057
|
treeSelectionStateConfigGetter(stateOrGetState)
|
|
12055
12058
|
);
|
|
12056
12059
|
}
|
|
@@ -12065,7 +12068,7 @@ function treeSelectionStateConfigGetter(stateOrStateGetter) {
|
|
|
12065
12068
|
var TreeApiImpl = class {
|
|
12066
12069
|
constructor(param) {
|
|
12067
12070
|
this.setNodeSelection = (nodePath, selected) => {
|
|
12068
|
-
const { treeSelectionState:
|
|
12071
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12069
12072
|
if (selectionMode === "single-row") {
|
|
12070
12073
|
this.actions.treeSelection = selected ? nodePath[nodePath.length - 1] : null;
|
|
12071
12074
|
return;
|
|
@@ -12073,11 +12076,11 @@ var TreeApiImpl = class {
|
|
|
12073
12076
|
if (selectionMode !== "multi-row") {
|
|
12074
12077
|
throw "Selection mode is not multi-row or single-row";
|
|
12075
12078
|
}
|
|
12076
|
-
if (!(
|
|
12079
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12077
12080
|
throw "Invalid tree selection";
|
|
12078
12081
|
}
|
|
12079
12082
|
const treeSelectionState = new TreeSelectionState(
|
|
12080
|
-
|
|
12083
|
+
treeSelection2,
|
|
12081
12084
|
treeSelectionStateConfigGetter(this.getState)
|
|
12082
12085
|
);
|
|
12083
12086
|
treeSelectionState.setNodeSelection(nodePath, selected);
|
|
@@ -12200,15 +12203,15 @@ var TreeApiImpl = class {
|
|
|
12200
12203
|
return null;
|
|
12201
12204
|
}
|
|
12202
12205
|
selectAll() {
|
|
12203
|
-
const { treeSelectionState:
|
|
12206
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12204
12207
|
if (selectionMode !== "multi-row") {
|
|
12205
12208
|
throw "Selection mode is not multi-row";
|
|
12206
12209
|
}
|
|
12207
|
-
if (!(
|
|
12210
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12208
12211
|
throw "Invalid node selection";
|
|
12209
12212
|
}
|
|
12210
12213
|
const treeSelectionState = new TreeSelectionState(
|
|
12211
|
-
|
|
12214
|
+
treeSelection2,
|
|
12212
12215
|
treeSelectionStateConfigGetter(this.getState)
|
|
12213
12216
|
);
|
|
12214
12217
|
treeSelectionState.selectAll();
|
|
@@ -12216,15 +12219,15 @@ var TreeApiImpl = class {
|
|
|
12216
12219
|
this.actions.treeSelection = treeSelectionState;
|
|
12217
12220
|
}
|
|
12218
12221
|
deselectAll() {
|
|
12219
|
-
const { treeSelectionState:
|
|
12222
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12220
12223
|
if (selectionMode !== "multi-row") {
|
|
12221
12224
|
throw "Selection mode is not multi-row";
|
|
12222
12225
|
}
|
|
12223
|
-
if (!(
|
|
12226
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12224
12227
|
throw "Invalid node selection";
|
|
12225
12228
|
}
|
|
12226
12229
|
const treeSelectionState = new TreeSelectionState(
|
|
12227
|
-
|
|
12230
|
+
treeSelection2,
|
|
12228
12231
|
treeSelectionStateConfigGetter(this.getState)
|
|
12229
12232
|
);
|
|
12230
12233
|
treeSelectionState.deselectAll();
|
|
@@ -12232,21 +12235,25 @@ var TreeApiImpl = class {
|
|
|
12232
12235
|
this.actions.treeSelection = treeSelectionState;
|
|
12233
12236
|
}
|
|
12234
12237
|
isNodeSelected(nodePath) {
|
|
12235
|
-
const {
|
|
12238
|
+
const {
|
|
12239
|
+
treeSelectionState,
|
|
12240
|
+
treeSelection: singleTreeSelection,
|
|
12241
|
+
selectionMode
|
|
12242
|
+
} = this.getState();
|
|
12236
12243
|
if (selectionMode === "single-row") {
|
|
12237
12244
|
const pk = nodePath[nodePath.length - 1];
|
|
12238
|
-
if (Array.isArray(
|
|
12245
|
+
if (Array.isArray(singleTreeSelection)) {
|
|
12239
12246
|
return treeSelection.join(",") === nodePath.join(",");
|
|
12240
12247
|
}
|
|
12241
|
-
return
|
|
12248
|
+
return singleTreeSelection === pk;
|
|
12242
12249
|
}
|
|
12243
12250
|
if (selectionMode !== "multi-row") {
|
|
12244
12251
|
throw "Selection mode is not multi-row or single-row";
|
|
12245
12252
|
}
|
|
12246
|
-
if (!(
|
|
12253
|
+
if (!(treeSelectionState instanceof TreeSelectionState)) {
|
|
12247
12254
|
throw "Invalid tree selection";
|
|
12248
12255
|
}
|
|
12249
|
-
return
|
|
12256
|
+
return treeSelectionState.isNodeSelected(nodePath);
|
|
12250
12257
|
}
|
|
12251
12258
|
selectNode(nodePath) {
|
|
12252
12259
|
this.setNodeSelection(nodePath, true);
|
|
@@ -12766,10 +12773,10 @@ function getMappedCallbacks() {
|
|
|
12766
12773
|
]
|
|
12767
12774
|
};
|
|
12768
12775
|
},
|
|
12769
|
-
treeSelection: (
|
|
12776
|
+
treeSelection: (treeSelection2, state) => {
|
|
12770
12777
|
if (state.selectionMode === "single-row") {
|
|
12771
12778
|
const callbackParams2 = [
|
|
12772
|
-
|
|
12779
|
+
treeSelection2,
|
|
12773
12780
|
{ selectionMode: "single-row" }
|
|
12774
12781
|
];
|
|
12775
12782
|
return {
|
|
@@ -12777,7 +12784,7 @@ function getMappedCallbacks() {
|
|
|
12777
12784
|
};
|
|
12778
12785
|
}
|
|
12779
12786
|
const callbackParams = [
|
|
12780
|
-
|
|
12787
|
+
treeSelection2.getState(),
|
|
12781
12788
|
{
|
|
12782
12789
|
selectionMode: "multi-row",
|
|
12783
12790
|
lastUpdatedNodePath: state.lastSelectionUpdatedNodePathRef.current,
|
|
@@ -13095,6 +13102,9 @@ var DataSourceCache = class {
|
|
|
13095
13102
|
this.getMutationsArray = () => {
|
|
13096
13103
|
return Array.from(this.primaryKeyToData.values()).flat();
|
|
13097
13104
|
};
|
|
13105
|
+
this.getTreeMutationsArray = () => {
|
|
13106
|
+
return Array.from(this.nodePathToData.values()).flat();
|
|
13107
|
+
};
|
|
13098
13108
|
}
|
|
13099
13109
|
static clone(cache, { light = false } = {}) {
|
|
13100
13110
|
const clone = new DataSourceCache();
|
|
@@ -13232,9 +13242,23 @@ var DataSourceApiImpl = class {
|
|
|
13232
13242
|
return result;
|
|
13233
13243
|
};
|
|
13234
13244
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
13235
|
-
return this.updateDataArrayByNodePath(
|
|
13245
|
+
return this.updateDataArrayByNodePath(
|
|
13246
|
+
[
|
|
13247
|
+
{
|
|
13248
|
+
data,
|
|
13249
|
+
nodePath
|
|
13250
|
+
}
|
|
13251
|
+
],
|
|
13252
|
+
options
|
|
13253
|
+
);
|
|
13236
13254
|
};
|
|
13237
|
-
this.updateDataArrayByNodePath = (
|
|
13255
|
+
this.updateDataArrayByNodePath = (updateInfo, options) => {
|
|
13256
|
+
const data = [];
|
|
13257
|
+
const nodePaths = [];
|
|
13258
|
+
updateInfo.forEach((info) => {
|
|
13259
|
+
data.push(info.data);
|
|
13260
|
+
nodePaths.push(info.nodePath);
|
|
13261
|
+
});
|
|
13238
13262
|
const result = this.batchOperation({
|
|
13239
13263
|
type: "update",
|
|
13240
13264
|
array: data,
|
|
@@ -15513,7 +15537,8 @@ function getColumnRenderParam(options) {
|
|
|
15513
15537
|
all: null,
|
|
15514
15538
|
value: typeof value === "boolean" ? `${value}` : value,
|
|
15515
15539
|
selectionCheckBox: null,
|
|
15516
|
-
groupIcon: null
|
|
15540
|
+
groupIcon: null,
|
|
15541
|
+
treeIcon: null
|
|
15517
15542
|
},
|
|
15518
15543
|
selectCurrentRow: () => {
|
|
15519
15544
|
if (rowInfo.isTreeNode) {
|
|
@@ -16060,6 +16085,14 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
16060
16085
|
typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
|
|
16061
16086
|
if (fn === true) {
|
|
16062
16087
|
fn = defaultRenderTreeIcon;
|
|
16088
|
+
} else if (fn) {
|
|
16089
|
+
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
16090
|
+
RenderCellHookComponent,
|
|
16091
|
+
{
|
|
16092
|
+
render: defaultRenderTreeIcon,
|
|
16093
|
+
renderParam
|
|
16094
|
+
}
|
|
16095
|
+
);
|
|
16063
16096
|
}
|
|
16064
16097
|
if (fn) {
|
|
16065
16098
|
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
@@ -22099,7 +22132,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22099
22132
|
}
|
|
22100
22133
|
let valid2 = isValidLicense(licenseKey, {
|
|
22101
22134
|
publishedAt: 1624970570587,
|
|
22102
|
-
version: "6.0.
|
|
22135
|
+
version: "6.0.8"
|
|
22103
22136
|
});
|
|
22104
22137
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22105
22138
|
return true;
|
|
@@ -22651,7 +22684,7 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22651
22684
|
selectionMode,
|
|
22652
22685
|
groupBy,
|
|
22653
22686
|
rowSelection,
|
|
22654
|
-
treeSelectionState:
|
|
22687
|
+
treeSelectionState: treeSelection2,
|
|
22655
22688
|
isTree
|
|
22656
22689
|
} = dataSourceState;
|
|
22657
22690
|
if (keyboardSelection === false) {
|
|
@@ -22670,9 +22703,9 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22670
22703
|
return false;
|
|
22671
22704
|
}
|
|
22672
22705
|
if (key === "a" && (ctrlKey || metaKey)) {
|
|
22673
|
-
if (isTree &&
|
|
22706
|
+
if (isTree && treeSelection2) {
|
|
22674
22707
|
const treeSelectionState = cloneTreeSelection2(
|
|
22675
|
-
|
|
22708
|
+
treeSelection2
|
|
22676
22709
|
);
|
|
22677
22710
|
treeSelectionState.selectAll();
|
|
22678
22711
|
dataSourceActions.treeSelection = treeSelectionState;
|
|
@@ -23074,8 +23107,8 @@ async function onKeyDown(context, event) {
|
|
|
23074
23107
|
cloneRowSelection: (rowSelection) => {
|
|
23075
23108
|
return cloneRowSelection(rowSelection, context.getDataSourceState);
|
|
23076
23109
|
},
|
|
23077
|
-
cloneTreeSelection: (
|
|
23078
|
-
return cloneTreeSelection(
|
|
23110
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23111
|
+
return cloneTreeSelection(treeSelection2, context.getDataSourceState);
|
|
23079
23112
|
}
|
|
23080
23113
|
};
|
|
23081
23114
|
if (handleKeyboardSelection(keyboardHandlerContext, event)) {
|
|
@@ -23154,8 +23187,8 @@ function useEventHandlersContext() {
|
|
|
23154
23187
|
actions,
|
|
23155
23188
|
getDataSourceState,
|
|
23156
23189
|
dataSourceActions,
|
|
23157
|
-
cloneTreeSelection: (
|
|
23158
|
-
return cloneTreeSelection(
|
|
23190
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23191
|
+
return cloneTreeSelection(treeSelection2, getDataSourceState);
|
|
23159
23192
|
},
|
|
23160
23193
|
cloneRowSelection: (rowSelection) => {
|
|
23161
23194
|
return cloneRowSelection(rowSelection, getDataSourceState);
|
package/index.js
CHANGED
|
@@ -10660,8 +10660,11 @@ var Indexer = class {
|
|
|
10660
10660
|
arr = arr.concat();
|
|
10661
10661
|
}
|
|
10662
10662
|
if (!arr.length && cache) {
|
|
10663
|
-
|
|
10664
|
-
|
|
10663
|
+
if (!cache.isEmpty()) {
|
|
10664
|
+
const cacheInfo = [
|
|
10665
|
+
...cache.getMutationsArray(),
|
|
10666
|
+
...cache.getTreeMutationsArray()
|
|
10667
|
+
];
|
|
10665
10668
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
10666
10669
|
const info = cacheInfo[cacheIndex];
|
|
10667
10670
|
if (info.type === "insert") {
|
|
@@ -12099,9 +12102,9 @@ function getRowInfoArray(getState) {
|
|
|
12099
12102
|
}
|
|
12100
12103
|
|
|
12101
12104
|
// src/components/DataSource/TreeApi.ts
|
|
12102
|
-
function cloneTreeSelection(
|
|
12105
|
+
function cloneTreeSelection(treeSelection2, stateOrGetState) {
|
|
12103
12106
|
return new TreeSelectionState(
|
|
12104
|
-
|
|
12107
|
+
treeSelection2,
|
|
12105
12108
|
treeSelectionStateConfigGetter(stateOrGetState)
|
|
12106
12109
|
);
|
|
12107
12110
|
}
|
|
@@ -12116,7 +12119,7 @@ function treeSelectionStateConfigGetter(stateOrStateGetter) {
|
|
|
12116
12119
|
var TreeApiImpl = class {
|
|
12117
12120
|
constructor(param) {
|
|
12118
12121
|
this.setNodeSelection = (nodePath, selected) => {
|
|
12119
|
-
const { treeSelectionState:
|
|
12122
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12120
12123
|
if (selectionMode === "single-row") {
|
|
12121
12124
|
this.actions.treeSelection = selected ? nodePath[nodePath.length - 1] : null;
|
|
12122
12125
|
return;
|
|
@@ -12124,11 +12127,11 @@ var TreeApiImpl = class {
|
|
|
12124
12127
|
if (selectionMode !== "multi-row") {
|
|
12125
12128
|
throw "Selection mode is not multi-row or single-row";
|
|
12126
12129
|
}
|
|
12127
|
-
if (!(
|
|
12130
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12128
12131
|
throw "Invalid tree selection";
|
|
12129
12132
|
}
|
|
12130
12133
|
const treeSelectionState = new TreeSelectionState(
|
|
12131
|
-
|
|
12134
|
+
treeSelection2,
|
|
12132
12135
|
treeSelectionStateConfigGetter(this.getState)
|
|
12133
12136
|
);
|
|
12134
12137
|
treeSelectionState.setNodeSelection(nodePath, selected);
|
|
@@ -12251,15 +12254,15 @@ var TreeApiImpl = class {
|
|
|
12251
12254
|
return null;
|
|
12252
12255
|
}
|
|
12253
12256
|
selectAll() {
|
|
12254
|
-
const { treeSelectionState:
|
|
12257
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12255
12258
|
if (selectionMode !== "multi-row") {
|
|
12256
12259
|
throw "Selection mode is not multi-row";
|
|
12257
12260
|
}
|
|
12258
|
-
if (!(
|
|
12261
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12259
12262
|
throw "Invalid node selection";
|
|
12260
12263
|
}
|
|
12261
12264
|
const treeSelectionState = new TreeSelectionState(
|
|
12262
|
-
|
|
12265
|
+
treeSelection2,
|
|
12263
12266
|
treeSelectionStateConfigGetter(this.getState)
|
|
12264
12267
|
);
|
|
12265
12268
|
treeSelectionState.selectAll();
|
|
@@ -12267,15 +12270,15 @@ var TreeApiImpl = class {
|
|
|
12267
12270
|
this.actions.treeSelection = treeSelectionState;
|
|
12268
12271
|
}
|
|
12269
12272
|
deselectAll() {
|
|
12270
|
-
const { treeSelectionState:
|
|
12273
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12271
12274
|
if (selectionMode !== "multi-row") {
|
|
12272
12275
|
throw "Selection mode is not multi-row";
|
|
12273
12276
|
}
|
|
12274
|
-
if (!(
|
|
12277
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12275
12278
|
throw "Invalid node selection";
|
|
12276
12279
|
}
|
|
12277
12280
|
const treeSelectionState = new TreeSelectionState(
|
|
12278
|
-
|
|
12281
|
+
treeSelection2,
|
|
12279
12282
|
treeSelectionStateConfigGetter(this.getState)
|
|
12280
12283
|
);
|
|
12281
12284
|
treeSelectionState.deselectAll();
|
|
@@ -12283,21 +12286,25 @@ var TreeApiImpl = class {
|
|
|
12283
12286
|
this.actions.treeSelection = treeSelectionState;
|
|
12284
12287
|
}
|
|
12285
12288
|
isNodeSelected(nodePath) {
|
|
12286
|
-
const {
|
|
12289
|
+
const {
|
|
12290
|
+
treeSelectionState,
|
|
12291
|
+
treeSelection: singleTreeSelection,
|
|
12292
|
+
selectionMode
|
|
12293
|
+
} = this.getState();
|
|
12287
12294
|
if (selectionMode === "single-row") {
|
|
12288
12295
|
const pk = nodePath[nodePath.length - 1];
|
|
12289
|
-
if (Array.isArray(
|
|
12296
|
+
if (Array.isArray(singleTreeSelection)) {
|
|
12290
12297
|
return treeSelection.join(",") === nodePath.join(",");
|
|
12291
12298
|
}
|
|
12292
|
-
return
|
|
12299
|
+
return singleTreeSelection === pk;
|
|
12293
12300
|
}
|
|
12294
12301
|
if (selectionMode !== "multi-row") {
|
|
12295
12302
|
throw "Selection mode is not multi-row or single-row";
|
|
12296
12303
|
}
|
|
12297
|
-
if (!(
|
|
12304
|
+
if (!(treeSelectionState instanceof TreeSelectionState)) {
|
|
12298
12305
|
throw "Invalid tree selection";
|
|
12299
12306
|
}
|
|
12300
|
-
return
|
|
12307
|
+
return treeSelectionState.isNodeSelected(nodePath);
|
|
12301
12308
|
}
|
|
12302
12309
|
selectNode(nodePath) {
|
|
12303
12310
|
this.setNodeSelection(nodePath, true);
|
|
@@ -12817,10 +12824,10 @@ function getMappedCallbacks() {
|
|
|
12817
12824
|
]
|
|
12818
12825
|
};
|
|
12819
12826
|
},
|
|
12820
|
-
treeSelection: (
|
|
12827
|
+
treeSelection: (treeSelection2, state) => {
|
|
12821
12828
|
if (state.selectionMode === "single-row") {
|
|
12822
12829
|
const callbackParams2 = [
|
|
12823
|
-
|
|
12830
|
+
treeSelection2,
|
|
12824
12831
|
{ selectionMode: "single-row" }
|
|
12825
12832
|
];
|
|
12826
12833
|
return {
|
|
@@ -12828,7 +12835,7 @@ function getMappedCallbacks() {
|
|
|
12828
12835
|
};
|
|
12829
12836
|
}
|
|
12830
12837
|
const callbackParams = [
|
|
12831
|
-
|
|
12838
|
+
treeSelection2.getState(),
|
|
12832
12839
|
{
|
|
12833
12840
|
selectionMode: "multi-row",
|
|
12834
12841
|
lastUpdatedNodePath: state.lastSelectionUpdatedNodePathRef.current,
|
|
@@ -13141,6 +13148,9 @@ var DataSourceCache = class {
|
|
|
13141
13148
|
this.getMutationsArray = () => {
|
|
13142
13149
|
return Array.from(this.primaryKeyToData.values()).flat();
|
|
13143
13150
|
};
|
|
13151
|
+
this.getTreeMutationsArray = () => {
|
|
13152
|
+
return Array.from(this.nodePathToData.values()).flat();
|
|
13153
|
+
};
|
|
13144
13154
|
}
|
|
13145
13155
|
static clone(cache, { light = false } = {}) {
|
|
13146
13156
|
const clone = new DataSourceCache();
|
|
@@ -13278,9 +13288,23 @@ var DataSourceApiImpl = class {
|
|
|
13278
13288
|
return result;
|
|
13279
13289
|
};
|
|
13280
13290
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
13281
|
-
return this.updateDataArrayByNodePath(
|
|
13291
|
+
return this.updateDataArrayByNodePath(
|
|
13292
|
+
[
|
|
13293
|
+
{
|
|
13294
|
+
data,
|
|
13295
|
+
nodePath
|
|
13296
|
+
}
|
|
13297
|
+
],
|
|
13298
|
+
options
|
|
13299
|
+
);
|
|
13282
13300
|
};
|
|
13283
|
-
this.updateDataArrayByNodePath = (
|
|
13301
|
+
this.updateDataArrayByNodePath = (updateInfo, options) => {
|
|
13302
|
+
const data = [];
|
|
13303
|
+
const nodePaths = [];
|
|
13304
|
+
updateInfo.forEach((info) => {
|
|
13305
|
+
data.push(info.data);
|
|
13306
|
+
nodePaths.push(info.nodePath);
|
|
13307
|
+
});
|
|
13284
13308
|
const result = this.batchOperation({
|
|
13285
13309
|
type: "update",
|
|
13286
13310
|
array: data,
|
|
@@ -15559,7 +15583,8 @@ function getColumnRenderParam(options) {
|
|
|
15559
15583
|
all: null,
|
|
15560
15584
|
value: typeof value === "boolean" ? `${value}` : value,
|
|
15561
15585
|
selectionCheckBox: null,
|
|
15562
|
-
groupIcon: null
|
|
15586
|
+
groupIcon: null,
|
|
15587
|
+
treeIcon: null
|
|
15563
15588
|
},
|
|
15564
15589
|
selectCurrentRow: () => {
|
|
15565
15590
|
if (rowInfo.isTreeNode) {
|
|
@@ -16106,6 +16131,14 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
16106
16131
|
typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
|
|
16107
16132
|
if (fn === true) {
|
|
16108
16133
|
fn = defaultRenderTreeIcon;
|
|
16134
|
+
} else if (fn) {
|
|
16135
|
+
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
16136
|
+
RenderCellHookComponent,
|
|
16137
|
+
{
|
|
16138
|
+
render: defaultRenderTreeIcon,
|
|
16139
|
+
renderParam
|
|
16140
|
+
}
|
|
16141
|
+
);
|
|
16109
16142
|
}
|
|
16110
16143
|
if (fn) {
|
|
16111
16144
|
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
@@ -22141,7 +22174,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22141
22174
|
}
|
|
22142
22175
|
let valid2 = isValidLicense(licenseKey, {
|
|
22143
22176
|
publishedAt: 1624970570587,
|
|
22144
|
-
version: "6.0.
|
|
22177
|
+
version: "6.0.8"
|
|
22145
22178
|
});
|
|
22146
22179
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22147
22180
|
return true;
|
|
@@ -22693,7 +22726,7 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22693
22726
|
selectionMode,
|
|
22694
22727
|
groupBy,
|
|
22695
22728
|
rowSelection,
|
|
22696
|
-
treeSelectionState:
|
|
22729
|
+
treeSelectionState: treeSelection2,
|
|
22697
22730
|
isTree
|
|
22698
22731
|
} = dataSourceState;
|
|
22699
22732
|
if (keyboardSelection === false) {
|
|
@@ -22712,9 +22745,9 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22712
22745
|
return false;
|
|
22713
22746
|
}
|
|
22714
22747
|
if (key === "a" && (ctrlKey || metaKey)) {
|
|
22715
|
-
if (isTree &&
|
|
22748
|
+
if (isTree && treeSelection2) {
|
|
22716
22749
|
const treeSelectionState = cloneTreeSelection2(
|
|
22717
|
-
|
|
22750
|
+
treeSelection2
|
|
22718
22751
|
);
|
|
22719
22752
|
treeSelectionState.selectAll();
|
|
22720
22753
|
dataSourceActions.treeSelection = treeSelectionState;
|
|
@@ -23116,8 +23149,8 @@ async function onKeyDown(context, event) {
|
|
|
23116
23149
|
cloneRowSelection: (rowSelection) => {
|
|
23117
23150
|
return cloneRowSelection(rowSelection, context.getDataSourceState);
|
|
23118
23151
|
},
|
|
23119
|
-
cloneTreeSelection: (
|
|
23120
|
-
return cloneTreeSelection(
|
|
23152
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23153
|
+
return cloneTreeSelection(treeSelection2, context.getDataSourceState);
|
|
23121
23154
|
}
|
|
23122
23155
|
};
|
|
23123
23156
|
if (handleKeyboardSelection(keyboardHandlerContext, event)) {
|
|
@@ -23196,8 +23229,8 @@ function useEventHandlersContext() {
|
|
|
23196
23229
|
actions,
|
|
23197
23230
|
getDataSourceState,
|
|
23198
23231
|
dataSourceActions,
|
|
23199
|
-
cloneTreeSelection: (
|
|
23200
|
-
return cloneTreeSelection(
|
|
23232
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23233
|
+
return cloneTreeSelection(treeSelection2, getDataSourceState);
|
|
23201
23234
|
},
|
|
23202
23235
|
cloneRowSelection: (rowSelection) => {
|
|
23203
23236
|
return cloneRowSelection(rowSelection, getDataSourceState);
|
package/index.mjs
CHANGED
|
@@ -10609,8 +10609,11 @@ var Indexer = class {
|
|
|
10609
10609
|
arr = arr.concat();
|
|
10610
10610
|
}
|
|
10611
10611
|
if (!arr.length && cache) {
|
|
10612
|
-
|
|
10613
|
-
|
|
10612
|
+
if (!cache.isEmpty()) {
|
|
10613
|
+
const cacheInfo = [
|
|
10614
|
+
...cache.getMutationsArray(),
|
|
10615
|
+
...cache.getTreeMutationsArray()
|
|
10616
|
+
];
|
|
10614
10617
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
10615
10618
|
const info = cacheInfo[cacheIndex];
|
|
10616
10619
|
if (info.type === "insert") {
|
|
@@ -12048,9 +12051,9 @@ function getRowInfoArray(getState) {
|
|
|
12048
12051
|
}
|
|
12049
12052
|
|
|
12050
12053
|
// src/components/DataSource/TreeApi.ts
|
|
12051
|
-
function cloneTreeSelection(
|
|
12054
|
+
function cloneTreeSelection(treeSelection2, stateOrGetState) {
|
|
12052
12055
|
return new TreeSelectionState(
|
|
12053
|
-
|
|
12056
|
+
treeSelection2,
|
|
12054
12057
|
treeSelectionStateConfigGetter(stateOrGetState)
|
|
12055
12058
|
);
|
|
12056
12059
|
}
|
|
@@ -12065,7 +12068,7 @@ function treeSelectionStateConfigGetter(stateOrStateGetter) {
|
|
|
12065
12068
|
var TreeApiImpl = class {
|
|
12066
12069
|
constructor(param) {
|
|
12067
12070
|
this.setNodeSelection = (nodePath, selected) => {
|
|
12068
|
-
const { treeSelectionState:
|
|
12071
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12069
12072
|
if (selectionMode === "single-row") {
|
|
12070
12073
|
this.actions.treeSelection = selected ? nodePath[nodePath.length - 1] : null;
|
|
12071
12074
|
return;
|
|
@@ -12073,11 +12076,11 @@ var TreeApiImpl = class {
|
|
|
12073
12076
|
if (selectionMode !== "multi-row") {
|
|
12074
12077
|
throw "Selection mode is not multi-row or single-row";
|
|
12075
12078
|
}
|
|
12076
|
-
if (!(
|
|
12079
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12077
12080
|
throw "Invalid tree selection";
|
|
12078
12081
|
}
|
|
12079
12082
|
const treeSelectionState = new TreeSelectionState(
|
|
12080
|
-
|
|
12083
|
+
treeSelection2,
|
|
12081
12084
|
treeSelectionStateConfigGetter(this.getState)
|
|
12082
12085
|
);
|
|
12083
12086
|
treeSelectionState.setNodeSelection(nodePath, selected);
|
|
@@ -12200,15 +12203,15 @@ var TreeApiImpl = class {
|
|
|
12200
12203
|
return null;
|
|
12201
12204
|
}
|
|
12202
12205
|
selectAll() {
|
|
12203
|
-
const { treeSelectionState:
|
|
12206
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12204
12207
|
if (selectionMode !== "multi-row") {
|
|
12205
12208
|
throw "Selection mode is not multi-row";
|
|
12206
12209
|
}
|
|
12207
|
-
if (!(
|
|
12210
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12208
12211
|
throw "Invalid node selection";
|
|
12209
12212
|
}
|
|
12210
12213
|
const treeSelectionState = new TreeSelectionState(
|
|
12211
|
-
|
|
12214
|
+
treeSelection2,
|
|
12212
12215
|
treeSelectionStateConfigGetter(this.getState)
|
|
12213
12216
|
);
|
|
12214
12217
|
treeSelectionState.selectAll();
|
|
@@ -12216,15 +12219,15 @@ var TreeApiImpl = class {
|
|
|
12216
12219
|
this.actions.treeSelection = treeSelectionState;
|
|
12217
12220
|
}
|
|
12218
12221
|
deselectAll() {
|
|
12219
|
-
const { treeSelectionState:
|
|
12222
|
+
const { treeSelectionState: treeSelection2, selectionMode } = this.getState();
|
|
12220
12223
|
if (selectionMode !== "multi-row") {
|
|
12221
12224
|
throw "Selection mode is not multi-row";
|
|
12222
12225
|
}
|
|
12223
|
-
if (!(
|
|
12226
|
+
if (!(treeSelection2 instanceof TreeSelectionState)) {
|
|
12224
12227
|
throw "Invalid node selection";
|
|
12225
12228
|
}
|
|
12226
12229
|
const treeSelectionState = new TreeSelectionState(
|
|
12227
|
-
|
|
12230
|
+
treeSelection2,
|
|
12228
12231
|
treeSelectionStateConfigGetter(this.getState)
|
|
12229
12232
|
);
|
|
12230
12233
|
treeSelectionState.deselectAll();
|
|
@@ -12232,21 +12235,25 @@ var TreeApiImpl = class {
|
|
|
12232
12235
|
this.actions.treeSelection = treeSelectionState;
|
|
12233
12236
|
}
|
|
12234
12237
|
isNodeSelected(nodePath) {
|
|
12235
|
-
const {
|
|
12238
|
+
const {
|
|
12239
|
+
treeSelectionState,
|
|
12240
|
+
treeSelection: singleTreeSelection,
|
|
12241
|
+
selectionMode
|
|
12242
|
+
} = this.getState();
|
|
12236
12243
|
if (selectionMode === "single-row") {
|
|
12237
12244
|
const pk = nodePath[nodePath.length - 1];
|
|
12238
|
-
if (Array.isArray(
|
|
12245
|
+
if (Array.isArray(singleTreeSelection)) {
|
|
12239
12246
|
return treeSelection.join(",") === nodePath.join(",");
|
|
12240
12247
|
}
|
|
12241
|
-
return
|
|
12248
|
+
return singleTreeSelection === pk;
|
|
12242
12249
|
}
|
|
12243
12250
|
if (selectionMode !== "multi-row") {
|
|
12244
12251
|
throw "Selection mode is not multi-row or single-row";
|
|
12245
12252
|
}
|
|
12246
|
-
if (!(
|
|
12253
|
+
if (!(treeSelectionState instanceof TreeSelectionState)) {
|
|
12247
12254
|
throw "Invalid tree selection";
|
|
12248
12255
|
}
|
|
12249
|
-
return
|
|
12256
|
+
return treeSelectionState.isNodeSelected(nodePath);
|
|
12250
12257
|
}
|
|
12251
12258
|
selectNode(nodePath) {
|
|
12252
12259
|
this.setNodeSelection(nodePath, true);
|
|
@@ -12766,10 +12773,10 @@ function getMappedCallbacks() {
|
|
|
12766
12773
|
]
|
|
12767
12774
|
};
|
|
12768
12775
|
},
|
|
12769
|
-
treeSelection: (
|
|
12776
|
+
treeSelection: (treeSelection2, state) => {
|
|
12770
12777
|
if (state.selectionMode === "single-row") {
|
|
12771
12778
|
const callbackParams2 = [
|
|
12772
|
-
|
|
12779
|
+
treeSelection2,
|
|
12773
12780
|
{ selectionMode: "single-row" }
|
|
12774
12781
|
];
|
|
12775
12782
|
return {
|
|
@@ -12777,7 +12784,7 @@ function getMappedCallbacks() {
|
|
|
12777
12784
|
};
|
|
12778
12785
|
}
|
|
12779
12786
|
const callbackParams = [
|
|
12780
|
-
|
|
12787
|
+
treeSelection2.getState(),
|
|
12781
12788
|
{
|
|
12782
12789
|
selectionMode: "multi-row",
|
|
12783
12790
|
lastUpdatedNodePath: state.lastSelectionUpdatedNodePathRef.current,
|
|
@@ -13095,6 +13102,9 @@ var DataSourceCache = class {
|
|
|
13095
13102
|
this.getMutationsArray = () => {
|
|
13096
13103
|
return Array.from(this.primaryKeyToData.values()).flat();
|
|
13097
13104
|
};
|
|
13105
|
+
this.getTreeMutationsArray = () => {
|
|
13106
|
+
return Array.from(this.nodePathToData.values()).flat();
|
|
13107
|
+
};
|
|
13098
13108
|
}
|
|
13099
13109
|
static clone(cache, { light = false } = {}) {
|
|
13100
13110
|
const clone = new DataSourceCache();
|
|
@@ -13232,9 +13242,23 @@ var DataSourceApiImpl = class {
|
|
|
13232
13242
|
return result;
|
|
13233
13243
|
};
|
|
13234
13244
|
this.updateDataByNodePath = (data, nodePath, options) => {
|
|
13235
|
-
return this.updateDataArrayByNodePath(
|
|
13245
|
+
return this.updateDataArrayByNodePath(
|
|
13246
|
+
[
|
|
13247
|
+
{
|
|
13248
|
+
data,
|
|
13249
|
+
nodePath
|
|
13250
|
+
}
|
|
13251
|
+
],
|
|
13252
|
+
options
|
|
13253
|
+
);
|
|
13236
13254
|
};
|
|
13237
|
-
this.updateDataArrayByNodePath = (
|
|
13255
|
+
this.updateDataArrayByNodePath = (updateInfo, options) => {
|
|
13256
|
+
const data = [];
|
|
13257
|
+
const nodePaths = [];
|
|
13258
|
+
updateInfo.forEach((info) => {
|
|
13259
|
+
data.push(info.data);
|
|
13260
|
+
nodePaths.push(info.nodePath);
|
|
13261
|
+
});
|
|
13238
13262
|
const result = this.batchOperation({
|
|
13239
13263
|
type: "update",
|
|
13240
13264
|
array: data,
|
|
@@ -15513,7 +15537,8 @@ function getColumnRenderParam(options) {
|
|
|
15513
15537
|
all: null,
|
|
15514
15538
|
value: typeof value === "boolean" ? `${value}` : value,
|
|
15515
15539
|
selectionCheckBox: null,
|
|
15516
|
-
groupIcon: null
|
|
15540
|
+
groupIcon: null,
|
|
15541
|
+
treeIcon: null
|
|
15517
15542
|
},
|
|
15518
15543
|
selectCurrentRow: () => {
|
|
15519
15544
|
if (rowInfo.isTreeNode) {
|
|
@@ -16060,6 +16085,14 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
16060
16085
|
typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
|
|
16061
16086
|
if (fn === true) {
|
|
16062
16087
|
fn = defaultRenderTreeIcon;
|
|
16088
|
+
} else if (fn) {
|
|
16089
|
+
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
16090
|
+
RenderCellHookComponent,
|
|
16091
|
+
{
|
|
16092
|
+
render: defaultRenderTreeIcon,
|
|
16093
|
+
renderParam
|
|
16094
|
+
}
|
|
16095
|
+
);
|
|
16063
16096
|
}
|
|
16064
16097
|
if (fn) {
|
|
16065
16098
|
renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
|
|
@@ -22099,7 +22132,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
22099
22132
|
}
|
|
22100
22133
|
let valid2 = isValidLicense(licenseKey, {
|
|
22101
22134
|
publishedAt: 1624970570587,
|
|
22102
|
-
version: "6.0.
|
|
22135
|
+
version: "6.0.8"
|
|
22103
22136
|
});
|
|
22104
22137
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
22105
22138
|
return true;
|
|
@@ -22651,7 +22684,7 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22651
22684
|
selectionMode,
|
|
22652
22685
|
groupBy,
|
|
22653
22686
|
rowSelection,
|
|
22654
|
-
treeSelectionState:
|
|
22687
|
+
treeSelectionState: treeSelection2,
|
|
22655
22688
|
isTree
|
|
22656
22689
|
} = dataSourceState;
|
|
22657
22690
|
if (keyboardSelection === false) {
|
|
@@ -22670,9 +22703,9 @@ function handleKeyboardSelection(context, keyboardEvent) {
|
|
|
22670
22703
|
return false;
|
|
22671
22704
|
}
|
|
22672
22705
|
if (key === "a" && (ctrlKey || metaKey)) {
|
|
22673
|
-
if (isTree &&
|
|
22706
|
+
if (isTree && treeSelection2) {
|
|
22674
22707
|
const treeSelectionState = cloneTreeSelection2(
|
|
22675
|
-
|
|
22708
|
+
treeSelection2
|
|
22676
22709
|
);
|
|
22677
22710
|
treeSelectionState.selectAll();
|
|
22678
22711
|
dataSourceActions.treeSelection = treeSelectionState;
|
|
@@ -23074,8 +23107,8 @@ async function onKeyDown(context, event) {
|
|
|
23074
23107
|
cloneRowSelection: (rowSelection) => {
|
|
23075
23108
|
return cloneRowSelection(rowSelection, context.getDataSourceState);
|
|
23076
23109
|
},
|
|
23077
|
-
cloneTreeSelection: (
|
|
23078
|
-
return cloneTreeSelection(
|
|
23110
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23111
|
+
return cloneTreeSelection(treeSelection2, context.getDataSourceState);
|
|
23079
23112
|
}
|
|
23080
23113
|
};
|
|
23081
23114
|
if (handleKeyboardSelection(keyboardHandlerContext, event)) {
|
|
@@ -23154,8 +23187,8 @@ function useEventHandlersContext() {
|
|
|
23154
23187
|
actions,
|
|
23155
23188
|
getDataSourceState,
|
|
23156
23189
|
dataSourceActions,
|
|
23157
|
-
cloneTreeSelection: (
|
|
23158
|
-
return cloneTreeSelection(
|
|
23190
|
+
cloneTreeSelection: (treeSelection2) => {
|
|
23191
|
+
return cloneTreeSelection(treeSelection2, getDataSourceState);
|
|
23159
23192
|
},
|
|
23160
23193
|
cloneRowSelection: (rowSelection) => {
|
|
23161
23194
|
return cloneRowSelection(rowSelection, getDataSourceState);
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/infinite-table/infinite-react/issues"
|
|
27
27
|
},
|
|
28
|
-
"version": "6.0.
|
|
28
|
+
"version": "6.0.8",
|
|
29
29
|
"main": "index.js",
|
|
30
30
|
"module": "index.mjs",
|
|
31
31
|
"typings": "index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "Commercial & Open Source",
|
|
36
36
|
"//": "will be updated at build time",
|
|
37
|
-
"publishedAt":
|
|
37
|
+
"publishedAt": 1730286088785
|
|
38
38
|
}
|