@infinite-table/infinite-react 6.0.2 → 6.0.4

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
@@ -2601,6 +2601,7 @@ interface DataSourceApi<T> {
2601
2601
  getIndexByNodePath(nodePath: NodePath$1): number;
2602
2602
  getPrimaryKeyByIndex(id: any): any;
2603
2603
  getNodePathById(id: any): NodePath$1 | null;
2604
+ getNodePathByIndex(index: number): NodePath$1 | null;
2604
2605
  get treeApi(): TreeApi<T>;
2605
2606
  updateData(data: Partial<T>, options?: DataSourceCRUDParam): Promise<any>;
2606
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,
@@ -15204,6 +15201,10 @@ var DataSourceApiImpl = class {
15204
15201
  const map2 = this.getState().idToPathMap;
15205
15202
  return map2.get(id) ?? null;
15206
15203
  };
15204
+ this.getNodePathByIndex = (index) => {
15205
+ const rowInfo = this.getRowInfoByIndex(index);
15206
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15207
+ };
15207
15208
  this.getPrimaryKeyByIndex = (index) => {
15208
15209
  const rowInfo = this.getRowInfoByIndex(index);
15209
15210
  return rowInfo ? rowInfo.id : void 0;
@@ -17311,6 +17312,7 @@ function deriveStateFromProps(params) {
17311
17312
  });
17312
17313
  return acc;
17313
17314
  }, {});
17315
+ const treeProps = props;
17314
17316
  let selectionMode = props.selectionMode;
17315
17317
  if (selectionMode === void 0) {
17316
17318
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17324,6 +17326,12 @@ function deriveStateFromProps(params) {
17324
17326
  selectionMode = "single-row";
17325
17327
  }
17326
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
+ }
17327
17335
  selectionMode = selectionMode ?? false;
17328
17336
  }
17329
17337
  }
@@ -17378,7 +17386,6 @@ function deriveStateFromProps(params) {
17378
17386
  }
17379
17387
  const primaryKeyDescriptor = state.primaryKey;
17380
17388
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17381
- const treeProps = props;
17382
17389
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17383
17390
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17384
17391
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22062,7 +22069,7 @@ var useLicense = (licenseKey = "") => {
22062
22069
  }
22063
22070
  let valid2 = isValidLicense(licenseKey, {
22064
22071
  publishedAt: 1624970570587,
22065
- version: "6.0.2"
22072
+ version: "6.0.4"
22066
22073
  });
22067
22074
  if (!licenseKey && !valid2 && isInsidePlayground) {
22068
22075
  return true;
@@ -26290,8 +26297,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26290
26297
  // src/components/TreeGrid/TreeDataSource.tsx
26291
26298
  var React70 = __toESM(require("react"));
26292
26299
  function TreeDataSource(props) {
26293
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26294
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26300
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26301
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26295
26302
  }
26296
26303
 
26297
26304
  // 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,
@@ -15153,6 +15150,10 @@ var DataSourceApiImpl = class {
15153
15150
  const map2 = this.getState().idToPathMap;
15154
15151
  return map2.get(id) ?? null;
15155
15152
  };
15153
+ this.getNodePathByIndex = (index) => {
15154
+ const rowInfo = this.getRowInfoByIndex(index);
15155
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15156
+ };
15156
15157
  this.getPrimaryKeyByIndex = (index) => {
15157
15158
  const rowInfo = this.getRowInfoByIndex(index);
15158
15159
  return rowInfo ? rowInfo.id : void 0;
@@ -17260,6 +17261,7 @@ function deriveStateFromProps(params) {
17260
17261
  });
17261
17262
  return acc;
17262
17263
  }, {});
17264
+ const treeProps = props;
17263
17265
  let selectionMode = props.selectionMode;
17264
17266
  if (selectionMode === void 0) {
17265
17267
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17273,6 +17275,12 @@ function deriveStateFromProps(params) {
17273
17275
  selectionMode = "single-row";
17274
17276
  }
17275
17277
  }
17278
+ if (!selectionMode) {
17279
+ const treeSelectionProp = treeProps.treeSelection ?? treeProps.defaultTreeSelection;
17280
+ if (treeSelectionProp !== void 0) {
17281
+ selectionMode = typeof treeSelectionProp === "object" ? "multi-row" : "single-row";
17282
+ }
17283
+ }
17276
17284
  selectionMode = selectionMode ?? false;
17277
17285
  }
17278
17286
  }
@@ -17327,7 +17335,6 @@ function deriveStateFromProps(params) {
17327
17335
  }
17328
17336
  const primaryKeyDescriptor = state.primaryKey;
17329
17337
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17330
- const treeProps = props;
17331
17338
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17332
17339
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17333
17340
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22020,7 +22027,7 @@ var useLicense = (licenseKey = "") => {
22020
22027
  }
22021
22028
  let valid2 = isValidLicense(licenseKey, {
22022
22029
  publishedAt: 1624970570587,
22023
- version: "6.0.2"
22030
+ version: "6.0.4"
22024
22031
  });
22025
22032
  if (!licenseKey && !valid2 && isInsidePlayground) {
22026
22033
  return true;
@@ -26258,8 +26265,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26258
26265
  // src/components/TreeGrid/TreeDataSource.tsx
26259
26266
  import * as React70 from "react";
26260
26267
  function TreeDataSource(props) {
26261
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26262
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26268
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26269
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26263
26270
  }
26264
26271
 
26265
26272
  // 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,
@@ -15204,6 +15201,10 @@ var DataSourceApiImpl = class {
15204
15201
  const map2 = this.getState().idToPathMap;
15205
15202
  return map2.get(id) ?? null;
15206
15203
  };
15204
+ this.getNodePathByIndex = (index) => {
15205
+ const rowInfo = this.getRowInfoByIndex(index);
15206
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15207
+ };
15207
15208
  this.getPrimaryKeyByIndex = (index) => {
15208
15209
  const rowInfo = this.getRowInfoByIndex(index);
15209
15210
  return rowInfo ? rowInfo.id : void 0;
@@ -17311,6 +17312,7 @@ function deriveStateFromProps(params) {
17311
17312
  });
17312
17313
  return acc;
17313
17314
  }, {});
17315
+ const treeProps = props;
17314
17316
  let selectionMode = props.selectionMode;
17315
17317
  if (selectionMode === void 0) {
17316
17318
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17324,6 +17326,12 @@ function deriveStateFromProps(params) {
17324
17326
  selectionMode = "single-row";
17325
17327
  }
17326
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
+ }
17327
17335
  selectionMode = selectionMode ?? false;
17328
17336
  }
17329
17337
  }
@@ -17378,7 +17386,6 @@ function deriveStateFromProps(params) {
17378
17386
  }
17379
17387
  const primaryKeyDescriptor = state.primaryKey;
17380
17388
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17381
- const treeProps = props;
17382
17389
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17383
17390
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17384
17391
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22062,7 +22069,7 @@ var useLicense = (licenseKey = "") => {
22062
22069
  }
22063
22070
  let valid2 = isValidLicense(licenseKey, {
22064
22071
  publishedAt: 1624970570587,
22065
- version: "6.0.2"
22072
+ version: "6.0.4"
22066
22073
  });
22067
22074
  if (!licenseKey && !valid2 && isInsidePlayground) {
22068
22075
  return true;
@@ -26290,8 +26297,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26290
26297
  // src/components/TreeGrid/TreeDataSource.tsx
26291
26298
  var React70 = __toESM(require("react"));
26292
26299
  function TreeDataSource(props) {
26293
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26294
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26300
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26301
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26295
26302
  }
26296
26303
 
26297
26304
  // 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,
@@ -15153,6 +15150,10 @@ var DataSourceApiImpl = class {
15153
15150
  const map2 = this.getState().idToPathMap;
15154
15151
  return map2.get(id) ?? null;
15155
15152
  };
15153
+ this.getNodePathByIndex = (index) => {
15154
+ const rowInfo = this.getRowInfoByIndex(index);
15155
+ return rowInfo && rowInfo.isTreeNode ? rowInfo.nodePath : null;
15156
+ };
15156
15157
  this.getPrimaryKeyByIndex = (index) => {
15157
15158
  const rowInfo = this.getRowInfoByIndex(index);
15158
15159
  return rowInfo ? rowInfo.id : void 0;
@@ -17260,6 +17261,7 @@ function deriveStateFromProps(params) {
17260
17261
  });
17261
17262
  return acc;
17262
17263
  }, {});
17264
+ const treeProps = props;
17263
17265
  let selectionMode = props.selectionMode;
17264
17266
  if (selectionMode === void 0) {
17265
17267
  if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
@@ -17273,6 +17275,12 @@ function deriveStateFromProps(params) {
17273
17275
  selectionMode = "single-row";
17274
17276
  }
17275
17277
  }
17278
+ if (!selectionMode) {
17279
+ const treeSelectionProp = treeProps.treeSelection ?? treeProps.defaultTreeSelection;
17280
+ if (treeSelectionProp !== void 0) {
17281
+ selectionMode = typeof treeSelectionProp === "object" ? "multi-row" : "single-row";
17282
+ }
17283
+ }
17276
17284
  selectionMode = selectionMode ?? false;
17277
17285
  }
17278
17286
  }
@@ -17327,7 +17335,6 @@ function deriveStateFromProps(params) {
17327
17335
  }
17328
17336
  const primaryKeyDescriptor = state.primaryKey;
17329
17337
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17330
- const treeProps = props;
17331
17338
  let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17332
17339
  if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17333
17340
  const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
@@ -22020,7 +22027,7 @@ var useLicense = (licenseKey = "") => {
22020
22027
  }
22021
22028
  let valid2 = isValidLicense(licenseKey, {
22022
22029
  publishedAt: 1624970570587,
22023
- version: "6.0.2"
22030
+ version: "6.0.4"
22024
22031
  });
22025
22032
  if (!licenseKey && !valid2 && isInsidePlayground) {
22026
22033
  return true;
@@ -26258,8 +26265,8 @@ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTable
26258
26265
  // src/components/TreeGrid/TreeDataSource.tsx
26259
26266
  import * as React70 from "react";
26260
26267
  function TreeDataSource(props) {
26261
- const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26262
- return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26268
+ const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
26269
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, null, props.children ?? null);
26263
26270
  }
26264
26271
 
26265
26272
  // 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.2",
28
+ "version": "6.0.4",
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": 1730121214427
37
+ "publishedAt": 1730132637668
38
38
  }