@infinite-table/infinite-react 6.0.12 → 6.0.14

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
@@ -2300,21 +2300,24 @@ declare class GroupRowsState<KeyType extends any = any> extends BooleanDeepColle
2300
2300
  toggleGroupRow(keys: KeyType[]): void;
2301
2301
  }
2302
2302
 
2303
+ declare type IndexerOptions<DataType, PrimaryKeyType> = {
2304
+ toPrimaryKey: (data: DataType) => PrimaryKeyType;
2305
+ cache?: DataSourceCache<DataType, PrimaryKeyType>;
2306
+ getNodeChildren?: TreeParams<DataType, PrimaryKeyType>['getNodeChildren'];
2307
+ isLeafNode?: TreeParams<DataType, PrimaryKeyType>['isLeafNode'];
2308
+ nodesKey: string | undefined;
2309
+ };
2303
2310
  declare class Indexer<DataType, PrimaryKeyType = string> {
2304
2311
  primaryKeyToData: Map<PrimaryKeyType, DataType>;
2305
2312
  nodePathsToData: DeepMap<PrimaryKeyType, DataType>;
2313
+ private removeNodePath;
2314
+ private remove;
2306
2315
  private add;
2307
2316
  private addNodePath;
2308
2317
  clear: () => void;
2309
2318
  getDataForPrimaryKey: (primaryKey: PrimaryKeyType) => DataType | undefined;
2310
2319
  getDataForNodePath: (nodePath: NodePath$1<any>) => DataType | undefined;
2311
- indexArray: (arr: DataType[], options: {
2312
- toPrimaryKey: (data: DataType) => PrimaryKeyType;
2313
- cache?: DataSourceCache<DataType, PrimaryKeyType> | undefined;
2314
- getNodeChildren?: ((item: DataType) => DataType[] | null) | undefined;
2315
- isLeafNode?: ((item: DataType) => boolean) | undefined;
2316
- nodesKey: string | undefined;
2317
- }) => DataType[];
2320
+ indexArray: (arr: DataType[], options: IndexerOptions<DataType, PrimaryKeyType>) => DataType[];
2318
2321
  }
2319
2322
 
2320
2323
  declare class RowDisabledState<KeyType = any> extends BooleanCollectionState<RowDisabledStateObject<KeyType>, KeyType> {
@@ -6023,6 +6026,12 @@ declare type PivotBy<DataType, KeyType> = Omit<GroupBy<DataType, KeyType>, 'colu
6023
6026
  columnGroup: InfiniteTablePivotFinalColumnGroup<DataType, KeyType>;
6024
6027
  }) => ColumnTypeWithInherit<Partial<InfiniteTablePivotFinalColumnGroup<DataType>>>);
6025
6028
  };
6029
+ declare type TreeParams<DataType, _KeyType> = {
6030
+ isLeafNode: (item: DataType) => boolean;
6031
+ getNodeChildren: (item: DataType) => null | DataType[];
6032
+ toKey: (item: DataType) => any;
6033
+ reducers?: Record<string, DataSourceAggregationReducer<DataType, any>>;
6034
+ };
6026
6035
  declare type GroupParams<DataType, KeyType> = {
6027
6036
  groupBy: GroupBy<DataType, KeyType>[];
6028
6037
  defaultToKey?: (value: any, item: DataType) => GroupKeyType<KeyType>;
package/index.dev.js CHANGED
@@ -13855,12 +13855,59 @@ var Indexer = class {
13855
13855
  constructor() {
13856
13856
  this.primaryKeyToData = /* @__PURE__ */ new Map();
13857
13857
  this.nodePathsToData = new DeepMap();
13858
+ this.removeNodePath = (nodePath, options) => {
13859
+ this.nodePathsToData.delete(nodePath);
13860
+ this.remove(nodePath[nodePath.length - 1]);
13861
+ if (!options) {
13862
+ return;
13863
+ }
13864
+ const data = this.nodePathsToData.get(nodePath);
13865
+ if (data) {
13866
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13867
+ //@ts-ignore
13868
+ data[options.nodesKey]
13869
+ ) : null;
13870
+ if (children && Array.isArray(children)) {
13871
+ for (let i = 0, len = children.length; i < len; i++) {
13872
+ const child = children[i];
13873
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13874
+ this.removeNodePath(childPath, options);
13875
+ }
13876
+ }
13877
+ }
13878
+ };
13879
+ this.remove = (primaryKey) => {
13880
+ this.primaryKeyToData.delete(primaryKey);
13881
+ };
13858
13882
  this.add = (primaryKey, data) => {
13859
13883
  this.primaryKeyToData.set(primaryKey, data);
13860
13884
  };
13861
- this.addNodePath = (nodePath, data) => {
13885
+ this.addNodePath = (nodePath, data, options) => {
13886
+ if (false) {
13887
+ if (this.nodePathsToData.has(nodePath)) {
13888
+ console.warn(
13889
+ `There is a problem! The node at path [${nodePath.join(
13890
+ "/"
13891
+ )}] is already in the indexer! You're doing too much work!`
13892
+ );
13893
+ }
13894
+ }
13862
13895
  this.nodePathsToData.set(nodePath, data);
13863
13896
  this.add(nodePath[nodePath.length - 1], data);
13897
+ if (!options) {
13898
+ return;
13899
+ }
13900
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13901
+ //@ts-ignore
13902
+ data[options.nodesKey]
13903
+ ) : null;
13904
+ if (children && Array.isArray(children)) {
13905
+ for (let i = 0, len = children.length; i < len; i++) {
13906
+ const child = children[i];
13907
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13908
+ this.addNodePath(childPath, child, options);
13909
+ }
13910
+ }
13864
13911
  };
13865
13912
  this.clear = () => {
13866
13913
  this.primaryKeyToData.clear();
@@ -13894,7 +13941,7 @@ var Indexer = class {
13894
13941
  if (info.type === "insert") {
13895
13942
  const insertPK = toPrimaryKey(info.data);
13896
13943
  if (isTree) {
13897
- this.addNodePath([insertPK], info.data);
13944
+ this.addNodePath([insertPK], info.data, options);
13898
13945
  } else {
13899
13946
  this.add(insertPK, info.data);
13900
13947
  }
@@ -13921,9 +13968,9 @@ var Indexer = class {
13921
13968
  const info = cacheInfo[cacheIndex];
13922
13969
  if (info.type === "delete" && !deleted) {
13923
13970
  if (isTreeModeForNode) {
13924
- this.nodePathsToData.delete(nodePath);
13971
+ this.removeNodePath(nodePath, options);
13925
13972
  } else {
13926
- this.primaryKeyToData.delete(pk);
13973
+ this.remove(pk);
13927
13974
  }
13928
13975
  deleted = true;
13929
13976
  arr2.splice(i, 1);
@@ -13934,13 +13981,6 @@ var Indexer = class {
13934
13981
  arr2[i] = item;
13935
13982
  }
13936
13983
  if (info.type === "insert") {
13937
- const insertPK = toPrimaryKey(info.data);
13938
- if (isTreeModeForNode) {
13939
- const currentPath = [...parentPath, insertPK];
13940
- this.addNodePath(currentPath, info.data);
13941
- } else {
13942
- this.add(insertPK, info.data);
13943
- }
13944
13984
  if (info.position === "before") {
13945
13985
  arr2.splice(i, 0, info.data);
13946
13986
  i--;
@@ -13957,6 +13997,7 @@ var Indexer = class {
13957
13997
  }
13958
13998
  if (!deleted) {
13959
13999
  if (isTreeModeForNode) {
14000
+ this.addNodePath(nodePath, item);
13960
14001
  const isLeaf = isLeafNode(item);
13961
14002
  let children = isLeaf ? null : getNodeChildren(item);
13962
14003
  if (!isLeaf && Array.isArray(children)) {
@@ -13967,7 +14008,6 @@ var Indexer = class {
13967
14008
  indexArray(children, parentPath);
13968
14009
  parentPath.pop();
13969
14010
  }
13970
- this.addNodePath(nodePath, item);
13971
14011
  } else {
13972
14012
  this.add(pk, item);
13973
14013
  }
@@ -15326,7 +15366,16 @@ var DataSourceApiImpl = class {
15326
15366
  };
15327
15367
  this.getDataByNodePath = (nodePath) => {
15328
15368
  const { indexer } = this.getState();
15329
- return indexer.getDataForNodePath(nodePath) ?? null;
15369
+ const data = indexer.getDataForNodePath(nodePath);
15370
+ if (!data) {
15371
+ console.warn(
15372
+ `getDataByNodePath: no data found for nodePath: "${nodePath.join(
15373
+ " / "
15374
+ )}"`
15375
+ );
15376
+ return null;
15377
+ }
15378
+ return data;
15330
15379
  };
15331
15380
  /**
15332
15381
  * Replaces all data in the DataSource with the provided data.
@@ -22219,7 +22268,7 @@ var useLicense = (licenseKey = "") => {
22219
22268
  }
22220
22269
  let valid2 = isValidLicense(licenseKey, {
22221
22270
  publishedAt: 1624970570587,
22222
- version: "6.0.12"
22271
+ version: "6.0.14"
22223
22272
  });
22224
22273
  if (!licenseKey && !valid2 && isInsidePlayground) {
22225
22274
  return true;
package/index.dev.mjs CHANGED
@@ -13804,12 +13804,59 @@ var Indexer = class {
13804
13804
  constructor() {
13805
13805
  this.primaryKeyToData = /* @__PURE__ */ new Map();
13806
13806
  this.nodePathsToData = new DeepMap();
13807
+ this.removeNodePath = (nodePath, options) => {
13808
+ this.nodePathsToData.delete(nodePath);
13809
+ this.remove(nodePath[nodePath.length - 1]);
13810
+ if (!options) {
13811
+ return;
13812
+ }
13813
+ const data = this.nodePathsToData.get(nodePath);
13814
+ if (data) {
13815
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13816
+ //@ts-ignore
13817
+ data[options.nodesKey]
13818
+ ) : null;
13819
+ if (children && Array.isArray(children)) {
13820
+ for (let i = 0, len = children.length; i < len; i++) {
13821
+ const child = children[i];
13822
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13823
+ this.removeNodePath(childPath, options);
13824
+ }
13825
+ }
13826
+ }
13827
+ };
13828
+ this.remove = (primaryKey) => {
13829
+ this.primaryKeyToData.delete(primaryKey);
13830
+ };
13807
13831
  this.add = (primaryKey, data) => {
13808
13832
  this.primaryKeyToData.set(primaryKey, data);
13809
13833
  };
13810
- this.addNodePath = (nodePath, data) => {
13834
+ this.addNodePath = (nodePath, data, options) => {
13835
+ if (false) {
13836
+ if (this.nodePathsToData.has(nodePath)) {
13837
+ console.warn(
13838
+ `There is a problem! The node at path [${nodePath.join(
13839
+ "/"
13840
+ )}] is already in the indexer! You're doing too much work!`
13841
+ );
13842
+ }
13843
+ }
13811
13844
  this.nodePathsToData.set(nodePath, data);
13812
13845
  this.add(nodePath[nodePath.length - 1], data);
13846
+ if (!options) {
13847
+ return;
13848
+ }
13849
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13850
+ //@ts-ignore
13851
+ data[options.nodesKey]
13852
+ ) : null;
13853
+ if (children && Array.isArray(children)) {
13854
+ for (let i = 0, len = children.length; i < len; i++) {
13855
+ const child = children[i];
13856
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13857
+ this.addNodePath(childPath, child, options);
13858
+ }
13859
+ }
13813
13860
  };
13814
13861
  this.clear = () => {
13815
13862
  this.primaryKeyToData.clear();
@@ -13843,7 +13890,7 @@ var Indexer = class {
13843
13890
  if (info.type === "insert") {
13844
13891
  const insertPK = toPrimaryKey(info.data);
13845
13892
  if (isTree) {
13846
- this.addNodePath([insertPK], info.data);
13893
+ this.addNodePath([insertPK], info.data, options);
13847
13894
  } else {
13848
13895
  this.add(insertPK, info.data);
13849
13896
  }
@@ -13870,9 +13917,9 @@ var Indexer = class {
13870
13917
  const info = cacheInfo[cacheIndex];
13871
13918
  if (info.type === "delete" && !deleted) {
13872
13919
  if (isTreeModeForNode) {
13873
- this.nodePathsToData.delete(nodePath);
13920
+ this.removeNodePath(nodePath, options);
13874
13921
  } else {
13875
- this.primaryKeyToData.delete(pk);
13922
+ this.remove(pk);
13876
13923
  }
13877
13924
  deleted = true;
13878
13925
  arr2.splice(i, 1);
@@ -13883,13 +13930,6 @@ var Indexer = class {
13883
13930
  arr2[i] = item;
13884
13931
  }
13885
13932
  if (info.type === "insert") {
13886
- const insertPK = toPrimaryKey(info.data);
13887
- if (isTreeModeForNode) {
13888
- const currentPath = [...parentPath, insertPK];
13889
- this.addNodePath(currentPath, info.data);
13890
- } else {
13891
- this.add(insertPK, info.data);
13892
- }
13893
13933
  if (info.position === "before") {
13894
13934
  arr2.splice(i, 0, info.data);
13895
13935
  i--;
@@ -13906,6 +13946,7 @@ var Indexer = class {
13906
13946
  }
13907
13947
  if (!deleted) {
13908
13948
  if (isTreeModeForNode) {
13949
+ this.addNodePath(nodePath, item);
13909
13950
  const isLeaf = isLeafNode(item);
13910
13951
  let children = isLeaf ? null : getNodeChildren(item);
13911
13952
  if (!isLeaf && Array.isArray(children)) {
@@ -13916,7 +13957,6 @@ var Indexer = class {
13916
13957
  indexArray(children, parentPath);
13917
13958
  parentPath.pop();
13918
13959
  }
13919
- this.addNodePath(nodePath, item);
13920
13960
  } else {
13921
13961
  this.add(pk, item);
13922
13962
  }
@@ -15275,7 +15315,16 @@ var DataSourceApiImpl = class {
15275
15315
  };
15276
15316
  this.getDataByNodePath = (nodePath) => {
15277
15317
  const { indexer } = this.getState();
15278
- return indexer.getDataForNodePath(nodePath) ?? null;
15318
+ const data = indexer.getDataForNodePath(nodePath);
15319
+ if (!data) {
15320
+ console.warn(
15321
+ `getDataByNodePath: no data found for nodePath: "${nodePath.join(
15322
+ " / "
15323
+ )}"`
15324
+ );
15325
+ return null;
15326
+ }
15327
+ return data;
15279
15328
  };
15280
15329
  /**
15281
15330
  * Replaces all data in the DataSource with the provided data.
@@ -22177,7 +22226,7 @@ var useLicense = (licenseKey = "") => {
22177
22226
  }
22178
22227
  let valid2 = isValidLicense(licenseKey, {
22179
22228
  publishedAt: 1624970570587,
22180
- version: "6.0.12"
22229
+ version: "6.0.14"
22181
22230
  });
22182
22231
  if (!licenseKey && !valid2 && isInsidePlayground) {
22183
22232
  return true;
package/index.js CHANGED
@@ -13855,12 +13855,59 @@ var Indexer = class {
13855
13855
  constructor() {
13856
13856
  this.primaryKeyToData = /* @__PURE__ */ new Map();
13857
13857
  this.nodePathsToData = new DeepMap();
13858
+ this.removeNodePath = (nodePath, options) => {
13859
+ this.nodePathsToData.delete(nodePath);
13860
+ this.remove(nodePath[nodePath.length - 1]);
13861
+ if (!options) {
13862
+ return;
13863
+ }
13864
+ const data = this.nodePathsToData.get(nodePath);
13865
+ if (data) {
13866
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13867
+ //@ts-ignore
13868
+ data[options.nodesKey]
13869
+ ) : null;
13870
+ if (children && Array.isArray(children)) {
13871
+ for (let i = 0, len = children.length; i < len; i++) {
13872
+ const child = children[i];
13873
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13874
+ this.removeNodePath(childPath, options);
13875
+ }
13876
+ }
13877
+ }
13878
+ };
13879
+ this.remove = (primaryKey) => {
13880
+ this.primaryKeyToData.delete(primaryKey);
13881
+ };
13858
13882
  this.add = (primaryKey, data) => {
13859
13883
  this.primaryKeyToData.set(primaryKey, data);
13860
13884
  };
13861
- this.addNodePath = (nodePath, data) => {
13885
+ this.addNodePath = (nodePath, data, options) => {
13886
+ if (false) {
13887
+ if (this.nodePathsToData.has(nodePath)) {
13888
+ console.warn(
13889
+ `There is a problem! The node at path [${nodePath.join(
13890
+ "/"
13891
+ )}] is already in the indexer! You're doing too much work!`
13892
+ );
13893
+ }
13894
+ }
13862
13895
  this.nodePathsToData.set(nodePath, data);
13863
13896
  this.add(nodePath[nodePath.length - 1], data);
13897
+ if (!options) {
13898
+ return;
13899
+ }
13900
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13901
+ //@ts-ignore
13902
+ data[options.nodesKey]
13903
+ ) : null;
13904
+ if (children && Array.isArray(children)) {
13905
+ for (let i = 0, len = children.length; i < len; i++) {
13906
+ const child = children[i];
13907
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13908
+ this.addNodePath(childPath, child, options);
13909
+ }
13910
+ }
13864
13911
  };
13865
13912
  this.clear = () => {
13866
13913
  this.primaryKeyToData.clear();
@@ -13894,7 +13941,7 @@ var Indexer = class {
13894
13941
  if (info.type === "insert") {
13895
13942
  const insertPK = toPrimaryKey(info.data);
13896
13943
  if (isTree) {
13897
- this.addNodePath([insertPK], info.data);
13944
+ this.addNodePath([insertPK], info.data, options);
13898
13945
  } else {
13899
13946
  this.add(insertPK, info.data);
13900
13947
  }
@@ -13921,9 +13968,9 @@ var Indexer = class {
13921
13968
  const info = cacheInfo[cacheIndex];
13922
13969
  if (info.type === "delete" && !deleted) {
13923
13970
  if (isTreeModeForNode) {
13924
- this.nodePathsToData.delete(nodePath);
13971
+ this.removeNodePath(nodePath, options);
13925
13972
  } else {
13926
- this.primaryKeyToData.delete(pk);
13973
+ this.remove(pk);
13927
13974
  }
13928
13975
  deleted = true;
13929
13976
  arr2.splice(i, 1);
@@ -13934,13 +13981,6 @@ var Indexer = class {
13934
13981
  arr2[i] = item;
13935
13982
  }
13936
13983
  if (info.type === "insert") {
13937
- const insertPK = toPrimaryKey(info.data);
13938
- if (isTreeModeForNode) {
13939
- const currentPath = [...parentPath, insertPK];
13940
- this.addNodePath(currentPath, info.data);
13941
- } else {
13942
- this.add(insertPK, info.data);
13943
- }
13944
13984
  if (info.position === "before") {
13945
13985
  arr2.splice(i, 0, info.data);
13946
13986
  i--;
@@ -13957,6 +13997,7 @@ var Indexer = class {
13957
13997
  }
13958
13998
  if (!deleted) {
13959
13999
  if (isTreeModeForNode) {
14000
+ this.addNodePath(nodePath, item);
13960
14001
  const isLeaf = isLeafNode(item);
13961
14002
  let children = isLeaf ? null : getNodeChildren(item);
13962
14003
  if (!isLeaf && Array.isArray(children)) {
@@ -13967,7 +14008,6 @@ var Indexer = class {
13967
14008
  indexArray(children, parentPath);
13968
14009
  parentPath.pop();
13969
14010
  }
13970
- this.addNodePath(nodePath, item);
13971
14011
  } else {
13972
14012
  this.add(pk, item);
13973
14013
  }
@@ -15326,7 +15366,16 @@ var DataSourceApiImpl = class {
15326
15366
  };
15327
15367
  this.getDataByNodePath = (nodePath) => {
15328
15368
  const { indexer } = this.getState();
15329
- return indexer.getDataForNodePath(nodePath) ?? null;
15369
+ const data = indexer.getDataForNodePath(nodePath);
15370
+ if (!data) {
15371
+ console.warn(
15372
+ `getDataByNodePath: no data found for nodePath: "${nodePath.join(
15373
+ " / "
15374
+ )}"`
15375
+ );
15376
+ return null;
15377
+ }
15378
+ return data;
15330
15379
  };
15331
15380
  /**
15332
15381
  * Replaces all data in the DataSource with the provided data.
@@ -22219,7 +22268,7 @@ var useLicense = (licenseKey = "") => {
22219
22268
  }
22220
22269
  let valid2 = isValidLicense(licenseKey, {
22221
22270
  publishedAt: 1624970570587,
22222
- version: "6.0.12"
22271
+ version: "6.0.14"
22223
22272
  });
22224
22273
  if (!licenseKey && !valid2 && isInsidePlayground) {
22225
22274
  return true;
package/index.mjs CHANGED
@@ -13804,12 +13804,59 @@ var Indexer = class {
13804
13804
  constructor() {
13805
13805
  this.primaryKeyToData = /* @__PURE__ */ new Map();
13806
13806
  this.nodePathsToData = new DeepMap();
13807
+ this.removeNodePath = (nodePath, options) => {
13808
+ this.nodePathsToData.delete(nodePath);
13809
+ this.remove(nodePath[nodePath.length - 1]);
13810
+ if (!options) {
13811
+ return;
13812
+ }
13813
+ const data = this.nodePathsToData.get(nodePath);
13814
+ if (data) {
13815
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13816
+ //@ts-ignore
13817
+ data[options.nodesKey]
13818
+ ) : null;
13819
+ if (children && Array.isArray(children)) {
13820
+ for (let i = 0, len = children.length; i < len; i++) {
13821
+ const child = children[i];
13822
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13823
+ this.removeNodePath(childPath, options);
13824
+ }
13825
+ }
13826
+ }
13827
+ };
13828
+ this.remove = (primaryKey) => {
13829
+ this.primaryKeyToData.delete(primaryKey);
13830
+ };
13807
13831
  this.add = (primaryKey, data) => {
13808
13832
  this.primaryKeyToData.set(primaryKey, data);
13809
13833
  };
13810
- this.addNodePath = (nodePath, data) => {
13834
+ this.addNodePath = (nodePath, data, options) => {
13835
+ if (false) {
13836
+ if (this.nodePathsToData.has(nodePath)) {
13837
+ console.warn(
13838
+ `There is a problem! The node at path [${nodePath.join(
13839
+ "/"
13840
+ )}] is already in the indexer! You're doing too much work!`
13841
+ );
13842
+ }
13843
+ }
13811
13844
  this.nodePathsToData.set(nodePath, data);
13812
13845
  this.add(nodePath[nodePath.length - 1], data);
13846
+ if (!options) {
13847
+ return;
13848
+ }
13849
+ const children = options.getNodeChildren ? options.getNodeChildren(data) : options.nodesKey ? (
13850
+ //@ts-ignore
13851
+ data[options.nodesKey]
13852
+ ) : null;
13853
+ if (children && Array.isArray(children)) {
13854
+ for (let i = 0, len = children.length; i < len; i++) {
13855
+ const child = children[i];
13856
+ const childPath = [...nodePath, options.toPrimaryKey(child)];
13857
+ this.addNodePath(childPath, child, options);
13858
+ }
13859
+ }
13813
13860
  };
13814
13861
  this.clear = () => {
13815
13862
  this.primaryKeyToData.clear();
@@ -13843,7 +13890,7 @@ var Indexer = class {
13843
13890
  if (info.type === "insert") {
13844
13891
  const insertPK = toPrimaryKey(info.data);
13845
13892
  if (isTree) {
13846
- this.addNodePath([insertPK], info.data);
13893
+ this.addNodePath([insertPK], info.data, options);
13847
13894
  } else {
13848
13895
  this.add(insertPK, info.data);
13849
13896
  }
@@ -13870,9 +13917,9 @@ var Indexer = class {
13870
13917
  const info = cacheInfo[cacheIndex];
13871
13918
  if (info.type === "delete" && !deleted) {
13872
13919
  if (isTreeModeForNode) {
13873
- this.nodePathsToData.delete(nodePath);
13920
+ this.removeNodePath(nodePath, options);
13874
13921
  } else {
13875
- this.primaryKeyToData.delete(pk);
13922
+ this.remove(pk);
13876
13923
  }
13877
13924
  deleted = true;
13878
13925
  arr2.splice(i, 1);
@@ -13883,13 +13930,6 @@ var Indexer = class {
13883
13930
  arr2[i] = item;
13884
13931
  }
13885
13932
  if (info.type === "insert") {
13886
- const insertPK = toPrimaryKey(info.data);
13887
- if (isTreeModeForNode) {
13888
- const currentPath = [...parentPath, insertPK];
13889
- this.addNodePath(currentPath, info.data);
13890
- } else {
13891
- this.add(insertPK, info.data);
13892
- }
13893
13933
  if (info.position === "before") {
13894
13934
  arr2.splice(i, 0, info.data);
13895
13935
  i--;
@@ -13906,6 +13946,7 @@ var Indexer = class {
13906
13946
  }
13907
13947
  if (!deleted) {
13908
13948
  if (isTreeModeForNode) {
13949
+ this.addNodePath(nodePath, item);
13909
13950
  const isLeaf = isLeafNode(item);
13910
13951
  let children = isLeaf ? null : getNodeChildren(item);
13911
13952
  if (!isLeaf && Array.isArray(children)) {
@@ -13916,7 +13957,6 @@ var Indexer = class {
13916
13957
  indexArray(children, parentPath);
13917
13958
  parentPath.pop();
13918
13959
  }
13919
- this.addNodePath(nodePath, item);
13920
13960
  } else {
13921
13961
  this.add(pk, item);
13922
13962
  }
@@ -15275,7 +15315,16 @@ var DataSourceApiImpl = class {
15275
15315
  };
15276
15316
  this.getDataByNodePath = (nodePath) => {
15277
15317
  const { indexer } = this.getState();
15278
- return indexer.getDataForNodePath(nodePath) ?? null;
15318
+ const data = indexer.getDataForNodePath(nodePath);
15319
+ if (!data) {
15320
+ console.warn(
15321
+ `getDataByNodePath: no data found for nodePath: "${nodePath.join(
15322
+ " / "
15323
+ )}"`
15324
+ );
15325
+ return null;
15326
+ }
15327
+ return data;
15279
15328
  };
15280
15329
  /**
15281
15330
  * Replaces all data in the DataSource with the provided data.
@@ -22177,7 +22226,7 @@ var useLicense = (licenseKey = "") => {
22177
22226
  }
22178
22227
  let valid2 = isValidLicense(licenseKey, {
22179
22228
  publishedAt: 1624970570587,
22180
- version: "6.0.12"
22229
+ version: "6.0.14"
22181
22230
  });
22182
22231
  if (!licenseKey && !valid2 && isInsidePlayground) {
22183
22232
  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.12",
28
+ "version": "6.0.14",
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": 1731321598951
37
+ "publishedAt": 1731510719445
38
38
  }