@infinite-table/infinite-react 6.0.1 → 6.0.3

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
@@ -2231,21 +2231,17 @@ declare type TreeExpandStateApi<T> = {
2231
2231
  getNodeDataByPath(nodePath: any[]): T | null;
2232
2232
  getRowInfoByPath(nodePath: any[]): InfiniteTableRowInfo<T> | null;
2233
2233
  };
2234
- declare type TreeSelectionApi<T> = {
2234
+ declare type TreeSelectionApi<_T = any> = {
2235
2235
  get allRowsSelected(): boolean;
2236
2236
  isNodeSelected(nodePath: NodePath$1): boolean | null;
2237
2237
  selectNode(nodePath: NodePath$1): void;
2238
2238
  setNodeSelection(nodePath: NodePath$1, selected: boolean): void;
2239
2239
  deselectNode(nodePath: NodePath$1): void;
2240
2240
  toggleNodeSelection(nodePath: NodePath$1): void;
2241
- getRowInfoByNodePath(nodePath: NodePath$1): InfiniteTableRowInfo<T> | null;
2242
- getIndexByNodePath(nodePath: NodePath$1): number;
2243
- getDataByNodePath(nodePath: NodePath$1): T | null;
2244
2241
  selectAll(): void;
2245
2242
  expandAll(): void;
2246
2243
  collapseAll(): void;
2247
2244
  deselectAll(): void;
2248
- updateDataByNodePath(data: Partial<T>, nodePath: NodePath$1, options?: DataSourceCRUDParam): void;
2249
2245
  };
2250
2246
  declare type TreeApi<T> = TreeExpandStateApi<T> & TreeSelectionApi<T>;
2251
2247
 
@@ -2597,6 +2593,7 @@ interface DataSourceApi<T> {
2597
2593
  getRowInfoArray: () => InfiniteTableRowInfo<T>[];
2598
2594
  getDataByPrimaryKey(id: any): T | null;
2599
2595
  getDataByNodePath(nodePath: NodePath$1): T | null;
2596
+ getDataByIndex(index: number): T | null;
2600
2597
  getRowInfoByIndex(index: number): InfiniteTableRowInfo<T> | null;
2601
2598
  getRowInfoByPrimaryKey(id: any): InfiniteTableRowInfo<T> | null;
2602
2599
  getRowInfoByNodePath(nodePath: NodePath$1): InfiniteTableRowInfo<T> | null;
@@ -2604,6 +2601,7 @@ interface DataSourceApi<T> {
2604
2601
  getIndexByNodePath(nodePath: NodePath$1): number;
2605
2602
  getPrimaryKeyByIndex(id: any): any;
2606
2603
  getNodePathById(id: any): NodePath$1 | null;
2604
+ getNodePathByIndex(index: number): NodePath$1 | null;
2607
2605
  get treeApi(): TreeApi<T>;
2608
2606
  updateData(data: Partial<T>, options?: DataSourceCRUDParam): Promise<any>;
2609
2607
  updateDataByNodePath(data: Partial<T>, nodePath: NodePath$1, options?: DataSourceUpdateParam): Promise<any>;
package/index.dev.js CHANGED
@@ -9206,13 +9206,10 @@ function InfiniteTableColumnCellFn(props) {
9206
9206
  let fn = void 0;
9207
9207
  const renderForNodeOrLeaf = isParentNode ? renderFunctions.renderTreeIconForParentNode : renderFunctions.renderTreeIconForLeafNode;
9208
9208
  fn = renderForNodeOrLeaf || // for parents, fallback to the renderTreeIcon as well
9209
- (isParentNode ? renderFunctions.renderTreeIcon : void 0);
9209
+ typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
9210
9210
  if (fn === true) {
9211
9211
  fn = defaultRenderTreeIcon;
9212
9212
  }
9213
- if (!fn) {
9214
- fn = void 0;
9215
- }
9216
9213
  if (fn) {
9217
9214
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React36.createElement(
9218
9215
  RenderCellHookComponent,
@@ -14964,18 +14961,6 @@ function getTreeApi(param) {
14964
14961
  } else {
14965
14962
  this.selectNode(nodePath);
14966
14963
  }
14967
- },
14968
- getDataByNodePath(nodePath) {
14969
- return dataSourceApi.getDataByNodePath(nodePath);
14970
- },
14971
- updateDataByNodePath(data, nodePath, options) {
14972
- return dataSourceApi.updateDataByNodePath(data, nodePath, options);
14973
- },
14974
- getRowInfoByNodePath(nodePath) {
14975
- return dataSourceApi.getRowInfoByNodePath(nodePath);
14976
- },
14977
- getIndexByNodePath(nodePath) {
14978
- return dataSourceApi.getIndexByNodePath(nodePath);
14979
14964
  }
14980
14965
  };
14981
14966
  return api;
@@ -15216,6 +15201,10 @@ var DataSourceApiImpl = class {
15216
15201
  const map2 = this.getState().idToPathMap;
15217
15202
  return map2.get(id) ?? null;
15218
15203
  };
15204
+ this.getNodePathByIndex = (index) => {
15205
+ const rowInfo = this.getRowInfoByIndex(index);
15206
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15207
+ };
15219
15208
  this.getPrimaryKeyByIndex = (index) => {
15220
15209
  const rowInfo = this.getRowInfoByIndex(index);
15221
15210
  return rowInfo ? rowInfo.id : void 0;
@@ -15223,6 +15212,13 @@ var DataSourceApiImpl = class {
15223
15212
  this.getOriginalDataArray = () => {
15224
15213
  return this.getState().originalDataArray;
15225
15214
  };
15215
+ this.getDataByIndex = (index) => {
15216
+ const rowInfo = this.getRowInfoByIndex(index);
15217
+ if (!rowInfo) {
15218
+ return null;
15219
+ }
15220
+ return rowInfo.data;
15221
+ };
15226
15222
  this.getDataByPrimaryKey = (id) => {
15227
15223
  const { indexer } = this.getState();
15228
15224
  return indexer.getDataForPrimaryKey(id) ?? null;
@@ -22067,7 +22063,7 @@ var useLicense = (licenseKey = "") => {
22067
22063
  }
22068
22064
  let valid2 = isValidLicense(licenseKey, {
22069
22065
  publishedAt: 1624970570587,
22070
- version: "6.0.1"
22066
+ version: "6.0.3"
22071
22067
  });
22072
22068
  if (!licenseKey && !valid2 && isInsidePlayground) {
22073
22069
  return true;
@@ -26295,8 +26291,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26295
26291
  // src/components/TreeGrid/TreeDataSource.tsx
26296
26292
  var React70 = __toESM(require("react"));
26297
26293
  function TreeDataSource(props) {
26298
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26299
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26294
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26295
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26300
26296
  }
26301
26297
 
26302
26298
  // src/components/TreeGrid/TreeGrid.tsx
package/index.dev.mjs CHANGED
@@ -9155,13 +9155,10 @@ function InfiniteTableColumnCellFn(props) {
9155
9155
  let fn = void 0;
9156
9156
  const renderForNodeOrLeaf = isParentNode ? renderFunctions.renderTreeIconForParentNode : renderFunctions.renderTreeIconForLeafNode;
9157
9157
  fn = renderForNodeOrLeaf || // for parents, fallback to the renderTreeIcon as well
9158
- (isParentNode ? renderFunctions.renderTreeIcon : void 0);
9158
+ typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
9159
9159
  if (fn === true) {
9160
9160
  fn = defaultRenderTreeIcon;
9161
9161
  }
9162
- if (!fn) {
9163
- fn = void 0;
9164
- }
9165
9162
  if (fn) {
9166
9163
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React36.createElement(
9167
9164
  RenderCellHookComponent,
@@ -14913,18 +14910,6 @@ function getTreeApi(param) {
14913
14910
  } else {
14914
14911
  this.selectNode(nodePath);
14915
14912
  }
14916
- },
14917
- getDataByNodePath(nodePath) {
14918
- return dataSourceApi.getDataByNodePath(nodePath);
14919
- },
14920
- updateDataByNodePath(data, nodePath, options) {
14921
- return dataSourceApi.updateDataByNodePath(data, nodePath, options);
14922
- },
14923
- getRowInfoByNodePath(nodePath) {
14924
- return dataSourceApi.getRowInfoByNodePath(nodePath);
14925
- },
14926
- getIndexByNodePath(nodePath) {
14927
- return dataSourceApi.getIndexByNodePath(nodePath);
14928
14913
  }
14929
14914
  };
14930
14915
  return api;
@@ -15165,6 +15150,10 @@ var DataSourceApiImpl = class {
15165
15150
  const map2 = this.getState().idToPathMap;
15166
15151
  return map2.get(id) ?? null;
15167
15152
  };
15153
+ this.getNodePathByIndex = (index) => {
15154
+ const rowInfo = this.getRowInfoByIndex(index);
15155
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15156
+ };
15168
15157
  this.getPrimaryKeyByIndex = (index) => {
15169
15158
  const rowInfo = this.getRowInfoByIndex(index);
15170
15159
  return rowInfo ? rowInfo.id : void 0;
@@ -15172,6 +15161,13 @@ var DataSourceApiImpl = class {
15172
15161
  this.getOriginalDataArray = () => {
15173
15162
  return this.getState().originalDataArray;
15174
15163
  };
15164
+ this.getDataByIndex = (index) => {
15165
+ const rowInfo = this.getRowInfoByIndex(index);
15166
+ if (!rowInfo) {
15167
+ return null;
15168
+ }
15169
+ return rowInfo.data;
15170
+ };
15175
15171
  this.getDataByPrimaryKey = (id) => {
15176
15172
  const { indexer } = this.getState();
15177
15173
  return indexer.getDataForPrimaryKey(id) ?? null;
@@ -22025,7 +22021,7 @@ var useLicense = (licenseKey = "") => {
22025
22021
  }
22026
22022
  let valid2 = isValidLicense(licenseKey, {
22027
22023
  publishedAt: 1624970570587,
22028
- version: "6.0.1"
22024
+ version: "6.0.3"
22029
22025
  });
22030
22026
  if (!licenseKey && !valid2 && isInsidePlayground) {
22031
22027
  return true;
@@ -26263,8 +26259,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26263
26259
  // src/components/TreeGrid/TreeDataSource.tsx
26264
26260
  import * as React70 from "react";
26265
26261
  function TreeDataSource(props) {
26266
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26267
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26262
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26263
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26268
26264
  }
26269
26265
 
26270
26266
  // src/components/TreeGrid/TreeGrid.tsx
package/index.js CHANGED
@@ -9206,13 +9206,10 @@ function InfiniteTableColumnCellFn(props) {
9206
9206
  let fn = void 0;
9207
9207
  const renderForNodeOrLeaf = isParentNode ? renderFunctions.renderTreeIconForParentNode : renderFunctions.renderTreeIconForLeafNode;
9208
9208
  fn = renderForNodeOrLeaf || // for parents, fallback to the renderTreeIcon as well
9209
- (isParentNode ? renderFunctions.renderTreeIcon : void 0);
9209
+ typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
9210
9210
  if (fn === true) {
9211
9211
  fn = defaultRenderTreeIcon;
9212
9212
  }
9213
- if (!fn) {
9214
- fn = void 0;
9215
- }
9216
9213
  if (fn) {
9217
9214
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React36.createElement(
9218
9215
  RenderCellHookComponent,
@@ -14964,18 +14961,6 @@ function getTreeApi(param) {
14964
14961
  } else {
14965
14962
  this.selectNode(nodePath);
14966
14963
  }
14967
- },
14968
- getDataByNodePath(nodePath) {
14969
- return dataSourceApi.getDataByNodePath(nodePath);
14970
- },
14971
- updateDataByNodePath(data, nodePath, options) {
14972
- return dataSourceApi.updateDataByNodePath(data, nodePath, options);
14973
- },
14974
- getRowInfoByNodePath(nodePath) {
14975
- return dataSourceApi.getRowInfoByNodePath(nodePath);
14976
- },
14977
- getIndexByNodePath(nodePath) {
14978
- return dataSourceApi.getIndexByNodePath(nodePath);
14979
14964
  }
14980
14965
  };
14981
14966
  return api;
@@ -15216,6 +15201,10 @@ var DataSourceApiImpl = class {
15216
15201
  const map2 = this.getState().idToPathMap;
15217
15202
  return map2.get(id) ?? null;
15218
15203
  };
15204
+ this.getNodePathByIndex = (index) => {
15205
+ const rowInfo = this.getRowInfoByIndex(index);
15206
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15207
+ };
15219
15208
  this.getPrimaryKeyByIndex = (index) => {
15220
15209
  const rowInfo = this.getRowInfoByIndex(index);
15221
15210
  return rowInfo ? rowInfo.id : void 0;
@@ -15223,6 +15212,13 @@ var DataSourceApiImpl = class {
15223
15212
  this.getOriginalDataArray = () => {
15224
15213
  return this.getState().originalDataArray;
15225
15214
  };
15215
+ this.getDataByIndex = (index) => {
15216
+ const rowInfo = this.getRowInfoByIndex(index);
15217
+ if (!rowInfo) {
15218
+ return null;
15219
+ }
15220
+ return rowInfo.data;
15221
+ };
15226
15222
  this.getDataByPrimaryKey = (id) => {
15227
15223
  const { indexer } = this.getState();
15228
15224
  return indexer.getDataForPrimaryKey(id) ?? null;
@@ -22067,7 +22063,7 @@ var useLicense = (licenseKey = "") => {
22067
22063
  }
22068
22064
  let valid2 = isValidLicense(licenseKey, {
22069
22065
  publishedAt: 1624970570587,
22070
- version: "6.0.1"
22066
+ version: "6.0.3"
22071
22067
  });
22072
22068
  if (!licenseKey && !valid2 && isInsidePlayground) {
22073
22069
  return true;
@@ -26295,8 +26291,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26295
26291
  // src/components/TreeGrid/TreeDataSource.tsx
26296
26292
  var React70 = __toESM(require("react"));
26297
26293
  function TreeDataSource(props) {
26298
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26299
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26294
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26295
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26300
26296
  }
26301
26297
 
26302
26298
  // src/components/TreeGrid/TreeGrid.tsx
package/index.mjs CHANGED
@@ -9155,13 +9155,10 @@ function InfiniteTableColumnCellFn(props) {
9155
9155
  let fn = void 0;
9156
9156
  const renderForNodeOrLeaf = isParentNode ? renderFunctions.renderTreeIconForParentNode : renderFunctions.renderTreeIconForLeafNode;
9157
9157
  fn = renderForNodeOrLeaf || // for parents, fallback to the renderTreeIcon as well
9158
- (isParentNode ? renderFunctions.renderTreeIcon : void 0);
9158
+ typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
9159
9159
  if (fn === true) {
9160
9160
  fn = defaultRenderTreeIcon;
9161
9161
  }
9162
- if (!fn) {
9163
- fn = void 0;
9164
- }
9165
9162
  if (fn) {
9166
9163
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React36.createElement(
9167
9164
  RenderCellHookComponent,
@@ -14913,18 +14910,6 @@ function getTreeApi(param) {
14913
14910
  } else {
14914
14911
  this.selectNode(nodePath);
14915
14912
  }
14916
- },
14917
- getDataByNodePath(nodePath) {
14918
- return dataSourceApi.getDataByNodePath(nodePath);
14919
- },
14920
- updateDataByNodePath(data, nodePath, options) {
14921
- return dataSourceApi.updateDataByNodePath(data, nodePath, options);
14922
- },
14923
- getRowInfoByNodePath(nodePath) {
14924
- return dataSourceApi.getRowInfoByNodePath(nodePath);
14925
- },
14926
- getIndexByNodePath(nodePath) {
14927
- return dataSourceApi.getIndexByNodePath(nodePath);
14928
14913
  }
14929
14914
  };
14930
14915
  return api;
@@ -15165,6 +15150,10 @@ var DataSourceApiImpl = class {
15165
15150
  const map2 = this.getState().idToPathMap;
15166
15151
  return map2.get(id) ?? null;
15167
15152
  };
15153
+ this.getNodePathByIndex = (index) => {
15154
+ const rowInfo = this.getRowInfoByIndex(index);
15155
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15156
+ };
15168
15157
  this.getPrimaryKeyByIndex = (index) => {
15169
15158
  const rowInfo = this.getRowInfoByIndex(index);
15170
15159
  return rowInfo ? rowInfo.id : void 0;
@@ -15172,6 +15161,13 @@ var DataSourceApiImpl = class {
15172
15161
  this.getOriginalDataArray = () => {
15173
15162
  return this.getState().originalDataArray;
15174
15163
  };
15164
+ this.getDataByIndex = (index) => {
15165
+ const rowInfo = this.getRowInfoByIndex(index);
15166
+ if (!rowInfo) {
15167
+ return null;
15168
+ }
15169
+ return rowInfo.data;
15170
+ };
15175
15171
  this.getDataByPrimaryKey = (id) => {
15176
15172
  const { indexer } = this.getState();
15177
15173
  return indexer.getDataForPrimaryKey(id) ?? null;
@@ -22025,7 +22021,7 @@ var useLicense = (licenseKey = "") => {
22025
22021
  }
22026
22022
  let valid2 = isValidLicense(licenseKey, {
22027
22023
  publishedAt: 1624970570587,
22028
- version: "6.0.1"
22024
+ version: "6.0.3"
22029
22025
  });
22030
22026
  if (!licenseKey && !valid2 && isInsidePlayground) {
22031
22027
  return true;
@@ -26263,8 +26259,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26263
26259
  // src/components/TreeGrid/TreeDataSource.tsx
26264
26260
  import * as React70 from "react";
26265
26261
  function TreeDataSource(props) {
26266
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26267
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26262
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26263
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26268
26264
  }
26269
26265
 
26270
26266
  // src/components/TreeGrid/TreeGrid.tsx
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.1",
28
+ "version": "6.0.3",
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": 1730116744150
37
+ "publishedAt": 1730129049591
38
38
  }