@infinite-table/infinite-react 6.0.3 → 6.0.5

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 CHANGED
@@ -89,6 +89,7 @@ declare class DeepMap<KeyType, ValueType> {
89
89
  fill(initial?: [KeyType[], ValueType][]): void;
90
90
  getValuesStartingWith(keys: KeyType[], excludeSelf?: boolean, depthLimit?: number): ValueType[];
91
91
  getEntriesStartingWith(keys: KeyType[], excludeSelf?: boolean, depthLimit?: number): [KeyType[], ValueType][];
92
+ getUnnestedKeysStartingWith(keys: KeyType[], excludeSelf?: boolean, depthLimit?: number): KeyType[][];
92
93
  getKeysStartingWith(keys: KeyType[], excludeSelf?: boolean, depthLimit?: number): KeyType[][];
93
94
  private getStartingWith;
94
95
  private getMapAt;
package/index.dev.js CHANGED
@@ -215,7 +215,7 @@ var DeepMap = class {
215
215
  depthLimit !== void 0 ? depthLimit - 1 : void 0
216
216
  ) : void 0;
217
217
  if (pair.hasOwnProperty("value")) {
218
- fn(pair.value, keys, i, next);
218
+ fn(pair.value, keys, i, next, pair);
219
219
  i++;
220
220
  } else {
221
221
  next?.();
@@ -269,6 +269,57 @@ var DeepMap = class {
269
269
  );
270
270
  return result;
271
271
  }
272
+ getUnnestedKeysStartingWith(keys, excludeSelf, depthLimit) {
273
+ const pairs = [];
274
+ const fn = (pair2) => {
275
+ pairs.push(pair2);
276
+ };
277
+ let currentMap = this.map;
278
+ let pair;
279
+ let stop = false;
280
+ if (keys.length) {
281
+ for (let i = 0, len = keys.length; i < len; i++) {
282
+ const key = keys[i];
283
+ pair = currentMap.get(key);
284
+ if (!pair || !pair.map) {
285
+ stop = true;
286
+ if (i === len - 1) {
287
+ stop = true;
288
+ break;
289
+ } else {
290
+ return [];
291
+ }
292
+ }
293
+ currentMap = pair.map;
294
+ }
295
+ } else {
296
+ if (!excludeSelf) {
297
+ const hasEmptyKey = currentMap.has(this.emptyKey);
298
+ if (hasEmptyKey) {
299
+ return [[]];
300
+ }
301
+ }
302
+ }
303
+ if (pair && pair.value !== void 0) {
304
+ if (!excludeSelf) {
305
+ fn({ ...pair, keys });
306
+ stop = true;
307
+ }
308
+ }
309
+ if (stop) {
310
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
311
+ }
312
+ this.visitWithNext(
313
+ keys,
314
+ (_value, keys2, _i, _next, pair2) => {
315
+ fn({ ...pair2, keys: keys2 });
316
+ },
317
+ currentMap,
318
+ depthLimit,
319
+ excludeSelf
320
+ );
321
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
322
+ }
272
323
  getKeysStartingWith(keys, excludeSelf, depthLimit) {
273
324
  const result = [];
274
325
  this.getStartingWith(
@@ -14618,7 +14669,7 @@ var TreeSelectionState = class {
14618
14669
  const leafCount = this.getLeafNodesCount(nodePath);
14619
14670
  let currentSelectionState = this.isSelfSelected(nodePath);
14620
14671
  const { selectionMap } = this;
14621
- const childPaths = selectionMap.getKeysStartingWith(nodePath, true).sort(shortestToLongest);
14672
+ const childPaths = selectionMap.getUnnestedKeysStartingWith(nodePath, true).sort(shortestToLongest);
14622
14673
  if (!childPaths.length) {
14623
14674
  if (currentSelectionState !== null) {
14624
14675
  const res2 = leafCount ? currentSelectionState : (
@@ -17312,6 +17363,7 @@ function deriveStateFromProps(params) {
17312
17363
  });
17313
17364
  return acc;
17314
17365
  }, {});
17366
+ const treeProps = props;
17315
17367
  let selectionMode = props.selectionMode;
17316
17368
  if (selectionMode === void 0) {
17317
17369
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17325,6 +17377,12 @@ function deriveStateFromProps(params) {
17325
17377
  selectionMode = "single-row";
17326
17378
  }
17327
17379
  }
17380
+ if (!selectionMode) {
17381
+ const treeSelectionProp = treeProps.treeSelection ?? treeProps.defaultTreeSelection;
17382
+ if (treeSelectionProp !== void 0) {
17383
+ selectionMode = typeof treeSelectionProp === "object" ? "multi-row" : "single-row";
17384
+ }
17385
+ }
17328
17386
  selectionMode = selectionMode ?? false;
17329
17387
  }
17330
17388
  }
@@ -17379,7 +17437,6 @@ function deriveStateFromProps(params) {
17379
17437
  }
17380
17438
  const primaryKeyDescriptor = state.primaryKey;
17381
17439
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17382
- const treeProps = props;
17383
17440
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17384
17441
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17385
17442
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22063,7 +22120,7 @@ var useLicense = (licenseKey = "") => {
22063
22120
  }
22064
22121
  let valid2 = isValidLicense(licenseKey, {
22065
22122
  publishedAt: 1624970570587,
22066
- version: "6.0.3"
22123
+ version: "6.0.5"
22067
22124
  });
22068
22125
  if (!licenseKey && !valid2 && isInsidePlayground) {
22069
22126
  return true;
package/index.dev.mjs CHANGED
@@ -145,7 +145,7 @@ var DeepMap = class {
145
145
  depthLimit !== void 0 ? depthLimit - 1 : void 0
146
146
  ) : void 0;
147
147
  if (pair.hasOwnProperty("value")) {
148
- fn(pair.value, keys, i, next);
148
+ fn(pair.value, keys, i, next, pair);
149
149
  i++;
150
150
  } else {
151
151
  next?.();
@@ -199,6 +199,57 @@ var DeepMap = class {
199
199
  );
200
200
  return result;
201
201
  }
202
+ getUnnestedKeysStartingWith(keys, excludeSelf, depthLimit) {
203
+ const pairs = [];
204
+ const fn = (pair2) => {
205
+ pairs.push(pair2);
206
+ };
207
+ let currentMap = this.map;
208
+ let pair;
209
+ let stop = false;
210
+ if (keys.length) {
211
+ for (let i = 0, len = keys.length; i < len; i++) {
212
+ const key = keys[i];
213
+ pair = currentMap.get(key);
214
+ if (!pair || !pair.map) {
215
+ stop = true;
216
+ if (i === len - 1) {
217
+ stop = true;
218
+ break;
219
+ } else {
220
+ return [];
221
+ }
222
+ }
223
+ currentMap = pair.map;
224
+ }
225
+ } else {
226
+ if (!excludeSelf) {
227
+ const hasEmptyKey = currentMap.has(this.emptyKey);
228
+ if (hasEmptyKey) {
229
+ return [[]];
230
+ }
231
+ }
232
+ }
233
+ if (pair && pair.value !== void 0) {
234
+ if (!excludeSelf) {
235
+ fn({ ...pair, keys });
236
+ stop = true;
237
+ }
238
+ }
239
+ if (stop) {
240
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
241
+ }
242
+ this.visitWithNext(
243
+ keys,
244
+ (_value, keys2, _i, _next, pair2) => {
245
+ fn({ ...pair2, keys: keys2 });
246
+ },
247
+ currentMap,
248
+ depthLimit,
249
+ excludeSelf
250
+ );
251
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
252
+ }
202
253
  getKeysStartingWith(keys, excludeSelf, depthLimit) {
203
254
  const result = [];
204
255
  this.getStartingWith(
@@ -14567,7 +14618,7 @@ var TreeSelectionState = class {
14567
14618
  const leafCount = this.getLeafNodesCount(nodePath);
14568
14619
  let currentSelectionState = this.isSelfSelected(nodePath);
14569
14620
  const { selectionMap } = this;
14570
- const childPaths = selectionMap.getKeysStartingWith(nodePath, true).sort(shortestToLongest);
14621
+ const childPaths = selectionMap.getUnnestedKeysStartingWith(nodePath, true).sort(shortestToLongest);
14571
14622
  if (!childPaths.length) {
14572
14623
  if (currentSelectionState !== null) {
14573
14624
  const res2 = leafCount ? currentSelectionState : (
@@ -17261,6 +17312,7 @@ function deriveStateFromProps(params) {
17261
17312
  });
17262
17313
  return acc;
17263
17314
  }, {});
17315
+ const treeProps = props;
17264
17316
  let selectionMode = props.selectionMode;
17265
17317
  if (selectionMode === void 0) {
17266
17318
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17274,6 +17326,12 @@ function deriveStateFromProps(params) {
17274
17326
  selectionMode = "single-row";
17275
17327
  }
17276
17328
  }
17329
+ if (!selectionMode) {
17330
+ const treeSelectionProp = treeProps.treeSelection ?? treeProps.defaultTreeSelection;
17331
+ if (treeSelectionProp !== void 0) {
17332
+ selectionMode = typeof treeSelectionProp === "object" ? "multi-row" : "single-row";
17333
+ }
17334
+ }
17277
17335
  selectionMode = selectionMode ?? false;
17278
17336
  }
17279
17337
  }
@@ -17328,7 +17386,6 @@ function deriveStateFromProps(params) {
17328
17386
  }
17329
17387
  const primaryKeyDescriptor = state.primaryKey;
17330
17388
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17331
- const treeProps = props;
17332
17389
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17333
17390
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17334
17391
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22021,7 +22078,7 @@ var useLicense = (licenseKey = "") => {
22021
22078
  }
22022
22079
  let valid2 = isValidLicense(licenseKey, {
22023
22080
  publishedAt: 1624970570587,
22024
- version: "6.0.3"
22081
+ version: "6.0.5"
22025
22082
  });
22026
22083
  if (!licenseKey && !valid2 && isInsidePlayground) {
22027
22084
  return true;
package/index.js CHANGED
@@ -215,7 +215,7 @@ var DeepMap = class {
215
215
  depthLimit !== void 0 ? depthLimit - 1 : void 0
216
216
  ) : void 0;
217
217
  if (pair.hasOwnProperty("value")) {
218
- fn(pair.value, keys, i, next);
218
+ fn(pair.value, keys, i, next, pair);
219
219
  i++;
220
220
  } else {
221
221
  next?.();
@@ -269,6 +269,57 @@ var DeepMap = class {
269
269
  );
270
270
  return result;
271
271
  }
272
+ getUnnestedKeysStartingWith(keys, excludeSelf, depthLimit) {
273
+ const pairs = [];
274
+ const fn = (pair2) => {
275
+ pairs.push(pair2);
276
+ };
277
+ let currentMap = this.map;
278
+ let pair;
279
+ let stop = false;
280
+ if (keys.length) {
281
+ for (let i = 0, len = keys.length; i < len; i++) {
282
+ const key = keys[i];
283
+ pair = currentMap.get(key);
284
+ if (!pair || !pair.map) {
285
+ stop = true;
286
+ if (i === len - 1) {
287
+ stop = true;
288
+ break;
289
+ } else {
290
+ return [];
291
+ }
292
+ }
293
+ currentMap = pair.map;
294
+ }
295
+ } else {
296
+ if (!excludeSelf) {
297
+ const hasEmptyKey = currentMap.has(this.emptyKey);
298
+ if (hasEmptyKey) {
299
+ return [[]];
300
+ }
301
+ }
302
+ }
303
+ if (pair && pair.value !== void 0) {
304
+ if (!excludeSelf) {
305
+ fn({ ...pair, keys });
306
+ stop = true;
307
+ }
308
+ }
309
+ if (stop) {
310
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
311
+ }
312
+ this.visitWithNext(
313
+ keys,
314
+ (_value, keys2, _i, _next, pair2) => {
315
+ fn({ ...pair2, keys: keys2 });
316
+ },
317
+ currentMap,
318
+ depthLimit,
319
+ excludeSelf
320
+ );
321
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
322
+ }
272
323
  getKeysStartingWith(keys, excludeSelf, depthLimit) {
273
324
  const result = [];
274
325
  this.getStartingWith(
@@ -14618,7 +14669,7 @@ var TreeSelectionState = class {
14618
14669
  const leafCount = this.getLeafNodesCount(nodePath);
14619
14670
  let currentSelectionState = this.isSelfSelected(nodePath);
14620
14671
  const { selectionMap } = this;
14621
- const childPaths = selectionMap.getKeysStartingWith(nodePath, true).sort(shortestToLongest);
14672
+ const childPaths = selectionMap.getUnnestedKeysStartingWith(nodePath, true).sort(shortestToLongest);
14622
14673
  if (!childPaths.length) {
14623
14674
  if (currentSelectionState !== null) {
14624
14675
  const res2 = leafCount ? currentSelectionState : (
@@ -17312,6 +17363,7 @@ function deriveStateFromProps(params) {
17312
17363
  });
17313
17364
  return acc;
17314
17365
  }, {});
17366
+ const treeProps = props;
17315
17367
  let selectionMode = props.selectionMode;
17316
17368
  if (selectionMode === void 0) {
17317
17369
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17325,6 +17377,12 @@ function deriveStateFromProps(params) {
17325
17377
  selectionMode = "single-row";
17326
17378
  }
17327
17379
  }
17380
+ if (!selectionMode) {
17381
+ const treeSelectionProp = treeProps.treeSelection ?? treeProps.defaultTreeSelection;
17382
+ if (treeSelectionProp !== void 0) {
17383
+ selectionMode = typeof treeSelectionProp === "object" ? "multi-row" : "single-row";
17384
+ }
17385
+ }
17328
17386
  selectionMode = selectionMode ?? false;
17329
17387
  }
17330
17388
  }
@@ -17379,7 +17437,6 @@ function deriveStateFromProps(params) {
17379
17437
  }
17380
17438
  const primaryKeyDescriptor = state.primaryKey;
17381
17439
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17382
- const treeProps = props;
17383
17440
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17384
17441
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17385
17442
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22063,7 +22120,7 @@ var useLicense = (licenseKey = "") => {
22063
22120
  }
22064
22121
  let valid2 = isValidLicense(licenseKey, {
22065
22122
  publishedAt: 1624970570587,
22066
- version: "6.0.3"
22123
+ version: "6.0.5"
22067
22124
  });
22068
22125
  if (!licenseKey && !valid2 && isInsidePlayground) {
22069
22126
  return true;
package/index.mjs CHANGED
@@ -145,7 +145,7 @@ var DeepMap = class {
145
145
  depthLimit !== void 0 ? depthLimit - 1 : void 0
146
146
  ) : void 0;
147
147
  if (pair.hasOwnProperty("value")) {
148
- fn(pair.value, keys, i, next);
148
+ fn(pair.value, keys, i, next, pair);
149
149
  i++;
150
150
  } else {
151
151
  next?.();
@@ -199,6 +199,57 @@ var DeepMap = class {
199
199
  );
200
200
  return result;
201
201
  }
202
+ getUnnestedKeysStartingWith(keys, excludeSelf, depthLimit) {
203
+ const pairs = [];
204
+ const fn = (pair2) => {
205
+ pairs.push(pair2);
206
+ };
207
+ let currentMap = this.map;
208
+ let pair;
209
+ let stop = false;
210
+ if (keys.length) {
211
+ for (let i = 0, len = keys.length; i < len; i++) {
212
+ const key = keys[i];
213
+ pair = currentMap.get(key);
214
+ if (!pair || !pair.map) {
215
+ stop = true;
216
+ if (i === len - 1) {
217
+ stop = true;
218
+ break;
219
+ } else {
220
+ return [];
221
+ }
222
+ }
223
+ currentMap = pair.map;
224
+ }
225
+ } else {
226
+ if (!excludeSelf) {
227
+ const hasEmptyKey = currentMap.has(this.emptyKey);
228
+ if (hasEmptyKey) {
229
+ return [[]];
230
+ }
231
+ }
232
+ }
233
+ if (pair && pair.value !== void 0) {
234
+ if (!excludeSelf) {
235
+ fn({ ...pair, keys });
236
+ stop = true;
237
+ }
238
+ }
239
+ if (stop) {
240
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
241
+ }
242
+ this.visitWithNext(
243
+ keys,
244
+ (_value, keys2, _i, _next, pair2) => {
245
+ fn({ ...pair2, keys: keys2 });
246
+ },
247
+ currentMap,
248
+ depthLimit,
249
+ excludeSelf
250
+ );
251
+ return pairs.sort(SORT_ASC_REVISION).map((pair2) => pair2.keys);
252
+ }
202
253
  getKeysStartingWith(keys, excludeSelf, depthLimit) {
203
254
  const result = [];
204
255
  this.getStartingWith(
@@ -14567,7 +14618,7 @@ var TreeSelectionState = class {
14567
14618
  const leafCount = this.getLeafNodesCount(nodePath);
14568
14619
  let currentSelectionState = this.isSelfSelected(nodePath);
14569
14620
  const { selectionMap } = this;
14570
- const childPaths = selectionMap.getKeysStartingWith(nodePath, true).sort(shortestToLongest);
14621
+ const childPaths = selectionMap.getUnnestedKeysStartingWith(nodePath, true).sort(shortestToLongest);
14571
14622
  if (!childPaths.length) {
14572
14623
  if (currentSelectionState !== null) {
14573
14624
  const res2 = leafCount ? currentSelectionState : (
@@ -17261,6 +17312,7 @@ function deriveStateFromProps(params) {
17261
17312
  });
17262
17313
  return acc;
17263
17314
  }, {});
17315
+ const treeProps = props;
17264
17316
  let selectionMode = props.selectionMode;
17265
17317
  if (selectionMode === void 0) {
17266
17318
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17274,6 +17326,12 @@ function deriveStateFromProps(params) {
17274
17326
  selectionMode = "single-row";
17275
17327
  }
17276
17328
  }
17329
+ if (!selectionMode) {
17330
+ const treeSelectionProp = treeProps.treeSelection ?? treeProps.defaultTreeSelection;
17331
+ if (treeSelectionProp !== void 0) {
17332
+ selectionMode = typeof treeSelectionProp === "object" ? "multi-row" : "single-row";
17333
+ }
17334
+ }
17277
17335
  selectionMode = selectionMode ?? false;
17278
17336
  }
17279
17337
  }
@@ -17328,7 +17386,6 @@ function deriveStateFromProps(params) {
17328
17386
  }
17329
17387
  const primaryKeyDescriptor = state.primaryKey;
17330
17388
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17331
- const treeProps = props;
17332
17389
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17333
17390
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17334
17391
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22021,7 +22078,7 @@ var useLicense = (licenseKey = "") => {
22021
22078
  }
22022
22079
  let valid2 = isValidLicense(licenseKey, {
22023
22080
  publishedAt: 1624970570587,
22024
- version: "6.0.3"
22081
+ version: "6.0.5"
22025
22082
  });
22026
22083
  if (!licenseKey && !valid2 && isInsidePlayground) {
22027
22084
  return true;
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.3",
28
+ "version": "6.0.5",
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": 1730129049591
37
+ "publishedAt": 1730204782243
38
38
  }