@infinite-table/infinite-react 7.2.5 → 7.3.1

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
@@ -249,9 +249,18 @@ type TreeSelectionStateObject = {
249
249
  };
250
250
  type TreeSelectionStateConfigObject = {
251
251
  treePaths: DeepMap<any, true>;
252
+ strictCheckPaths: boolean;
252
253
  };
253
254
  type TreeSelectionStateConfigParam<_T = any> = {
254
- treePaths: TreeSelectionStateConfigObject['treePaths'] | [any[]];
255
+ treePaths: TreeSelectionStateConfigObject['treePaths'] | any[][];
256
+ /**
257
+ * Defaults to true. If false, when checking if a given path is selected,
258
+ * it will not check if the path is in the treePaths, but will only check
259
+ * in the selectionMap.
260
+ *
261
+ * If true, will check for the path both in the treePaths and the selectionMap.
262
+ */
263
+ strictCheckPaths?: boolean;
255
264
  };
256
265
  type GetTreeSelectionStateConfig<T> = TreeSelectionStateConfigParam<T> | (() => TreeSelectionStateConfigParam<T>);
257
266
  type NodeSelectionState = {
@@ -287,9 +296,9 @@ declare class TreeSelectionState<T = any> {
287
296
  getState(): TreeSelectionStateObject;
288
297
  deselectAll(): void;
289
298
  selectAll(): void;
290
- private correctnessChecks;
291
- enableCorrectnessChecks(): void;
292
- disableCorrectnessChecks(): void;
299
+ private strictMode;
300
+ enableStrictMode(): void;
301
+ disableStrictMode(): void;
293
302
  isPathAvailable(nodePath: NodePath): boolean;
294
303
  isNodeSelected(nodePath: NodePath): boolean | null;
295
304
  private isSelfSelected;
package/index.dev.js CHANGED
@@ -1267,7 +1267,7 @@ var useCSSVariableWatch = (params) => {
1267
1267
  useResizeObserver(params.ref, onResize, { earlyAttach: true });
1268
1268
  React2.useLayoutEffect(() => {
1269
1269
  const value = params.ref.current.getBoundingClientRect().height;
1270
- if (value) {
1270
+ if (value != null) {
1271
1271
  lastValueRef.current = value;
1272
1272
  debug2(`Variable ${params.varName} found and equals ${value}.`);
1273
1273
  return params.onChange(value);
@@ -17083,7 +17083,7 @@ var TreeSelectionState = class _TreeSelectionState {
17083
17083
  this.defaultSelection = false;
17084
17084
  this.selectionMap = new DeepMap();
17085
17085
  this.cache = new DeepMap();
17086
- this.correctnessChecks = false;
17086
+ this.strictMode = false;
17087
17087
  const isTreeSelectionStateInstance = state instanceof Object.getPrototypeOf(this).constructor;
17088
17088
  const stateObject = isTreeSelectionStateInstance ? (
17089
17089
  //@ts-ignore
@@ -17094,9 +17094,11 @@ var TreeSelectionState = class _TreeSelectionState {
17094
17094
  treePaths: new DeepMap()
17095
17095
  })
17096
17096
  );
17097
- this.disableCorrectnessChecks();
17097
+ this.disableStrictMode();
17098
17098
  this.update(stateObject);
17099
- this.enableCorrectnessChecks();
17099
+ if (this.config.strictCheckPaths) {
17100
+ this.enableStrictMode();
17101
+ }
17100
17102
  }
17101
17103
  getTreePaths(treePaths) {
17102
17104
  if (treePaths) {
@@ -17178,7 +17180,8 @@ var TreeSelectionState = class _TreeSelectionState {
17178
17180
  setConfig(getConfig) {
17179
17181
  const config = typeof getConfig === "function" ? getConfig() : getConfig;
17180
17182
  this.config = {
17181
- treePaths: Array.isArray(config.treePaths) ? new DeepMap(config.treePaths.map((path) => [path, true])) : config.treePaths
17183
+ treePaths: Array.isArray(config.treePaths) ? new DeepMap(config.treePaths.map((path) => [path, true])) : config.treePaths,
17184
+ strictCheckPaths: config.strictCheckPaths ?? true
17182
17185
  };
17183
17186
  this.xcache();
17184
17187
  }
@@ -17235,14 +17238,14 @@ var TreeSelectionState = class _TreeSelectionState {
17235
17238
  selectedPaths: []
17236
17239
  });
17237
17240
  }
17238
- enableCorrectnessChecks() {
17239
- this.correctnessChecks = true;
17241
+ enableStrictMode() {
17242
+ this.strictMode = true;
17240
17243
  }
17241
- disableCorrectnessChecks() {
17242
- this.correctnessChecks = false;
17244
+ disableStrictMode() {
17245
+ this.strictMode = false;
17243
17246
  }
17244
17247
  isPathAvailable(nodePath) {
17245
- if (!this.correctnessChecks) {
17248
+ if (!this.strictMode) {
17246
17249
  return true;
17247
17250
  }
17248
17251
  const { treePaths } = this.config;
@@ -17280,7 +17283,7 @@ var TreeSelectionState = class _TreeSelectionState {
17280
17283
  let childPaths = selectionMap.getKeysOfFirstChildOnEachBranchStartingWith(nodePath, {
17281
17284
  excludeSelf: true
17282
17285
  }).sort(shortestToLongest);
17283
- if (this.correctnessChecks) {
17286
+ if (this.strictMode) {
17284
17287
  childPaths = childPaths.filter((path) => this.isPathAvailable(path));
17285
17288
  }
17286
17289
  if (!childPaths.length) {
@@ -25825,7 +25828,7 @@ var useLicense = (licenseKey = "") => {
25825
25828
  }
25826
25829
  let valid2 = isValidLicense(licenseKey, {
25827
25830
  publishedAt: 1624970570587,
25828
- version: "7.2.5"
25831
+ version: "7.3.1"
25829
25832
  });
25830
25833
  if (!licenseKey && !valid2 && isInsidePlayground) {
25831
25834
  return true;
package/index.dev.mjs CHANGED
@@ -1199,7 +1199,7 @@ var useCSSVariableWatch = (params) => {
1199
1199
  useResizeObserver(params.ref, onResize, { earlyAttach: true });
1200
1200
  React2.useLayoutEffect(() => {
1201
1201
  const value = params.ref.current.getBoundingClientRect().height;
1202
- if (value) {
1202
+ if (value != null) {
1203
1203
  lastValueRef.current = value;
1204
1204
  debug2(`Variable ${params.varName} found and equals ${value}.`);
1205
1205
  return params.onChange(value);
@@ -17023,7 +17023,7 @@ var TreeSelectionState = class _TreeSelectionState {
17023
17023
  this.defaultSelection = false;
17024
17024
  this.selectionMap = new DeepMap();
17025
17025
  this.cache = new DeepMap();
17026
- this.correctnessChecks = false;
17026
+ this.strictMode = false;
17027
17027
  const isTreeSelectionStateInstance = state instanceof Object.getPrototypeOf(this).constructor;
17028
17028
  const stateObject = isTreeSelectionStateInstance ? (
17029
17029
  //@ts-ignore
@@ -17034,9 +17034,11 @@ var TreeSelectionState = class _TreeSelectionState {
17034
17034
  treePaths: new DeepMap()
17035
17035
  })
17036
17036
  );
17037
- this.disableCorrectnessChecks();
17037
+ this.disableStrictMode();
17038
17038
  this.update(stateObject);
17039
- this.enableCorrectnessChecks();
17039
+ if (this.config.strictCheckPaths) {
17040
+ this.enableStrictMode();
17041
+ }
17040
17042
  }
17041
17043
  getTreePaths(treePaths) {
17042
17044
  if (treePaths) {
@@ -17118,7 +17120,8 @@ var TreeSelectionState = class _TreeSelectionState {
17118
17120
  setConfig(getConfig) {
17119
17121
  const config = typeof getConfig === "function" ? getConfig() : getConfig;
17120
17122
  this.config = {
17121
- treePaths: Array.isArray(config.treePaths) ? new DeepMap(config.treePaths.map((path) => [path, true])) : config.treePaths
17123
+ treePaths: Array.isArray(config.treePaths) ? new DeepMap(config.treePaths.map((path) => [path, true])) : config.treePaths,
17124
+ strictCheckPaths: config.strictCheckPaths ?? true
17122
17125
  };
17123
17126
  this.xcache();
17124
17127
  }
@@ -17175,14 +17178,14 @@ var TreeSelectionState = class _TreeSelectionState {
17175
17178
  selectedPaths: []
17176
17179
  });
17177
17180
  }
17178
- enableCorrectnessChecks() {
17179
- this.correctnessChecks = true;
17181
+ enableStrictMode() {
17182
+ this.strictMode = true;
17180
17183
  }
17181
- disableCorrectnessChecks() {
17182
- this.correctnessChecks = false;
17184
+ disableStrictMode() {
17185
+ this.strictMode = false;
17183
17186
  }
17184
17187
  isPathAvailable(nodePath) {
17185
- if (!this.correctnessChecks) {
17188
+ if (!this.strictMode) {
17186
17189
  return true;
17187
17190
  }
17188
17191
  const { treePaths } = this.config;
@@ -17220,7 +17223,7 @@ var TreeSelectionState = class _TreeSelectionState {
17220
17223
  let childPaths = selectionMap.getKeysOfFirstChildOnEachBranchStartingWith(nodePath, {
17221
17224
  excludeSelf: true
17222
17225
  }).sort(shortestToLongest);
17223
- if (this.correctnessChecks) {
17226
+ if (this.strictMode) {
17224
17227
  childPaths = childPaths.filter((path) => this.isPathAvailable(path));
17225
17228
  }
17226
17229
  if (!childPaths.length) {
@@ -25774,7 +25777,7 @@ var useLicense = (licenseKey = "") => {
25774
25777
  }
25775
25778
  let valid2 = isValidLicense(licenseKey, {
25776
25779
  publishedAt: 1624970570587,
25777
- version: "7.2.5"
25780
+ version: "7.3.1"
25778
25781
  });
25779
25782
  if (!licenseKey && !valid2 && isInsidePlayground) {
25780
25783
  return true;