@infinite-table/infinite-react 6.0.7 → 6.0.8

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
@@ -2222,6 +2222,7 @@ declare class DataSourceCache<DataType, PrimaryKeyType = string> {
2222
2222
  getMutations: () => Map<PrimaryKeyType, DataSourceMutation<DataType>[]>;
2223
2223
  getTreeMutations: () => DeepMap<NodePath$1<any>, DataSourceMutation<DataType>[]>;
2224
2224
  getMutationsArray: () => DataSourceMutation<DataType>[];
2225
+ getTreeMutationsArray: () => DataSourceMutation<DataType>[];
2225
2226
  }
2226
2227
 
2227
2228
  declare type TreeExpandStateApi<T> = {
@@ -2608,7 +2609,10 @@ interface DataSourceApi<T> {
2608
2609
  updateData(data: Partial<T>, options?: DataSourceCRUDParam): Promise<any>;
2609
2610
  updateDataByNodePath(data: Partial<T>, nodePath: NodePath$1, options?: DataSourceUpdateParam): Promise<any>;
2610
2611
  updateDataArray(data: Partial<T>[], options?: DataSourceCRUDParam): Promise<any>;
2611
- updateDataArrayByNodePath(data: Partial<T>[], nodePaths: NodePath$1[], options?: DataSourceUpdateParam): Promise<any>;
2612
+ updateDataArrayByNodePath(updateInfo: {
2613
+ data: Partial<T>;
2614
+ nodePath: NodePath$1;
2615
+ }[], options?: DataSourceUpdateParam): Promise<any>;
2612
2616
  flush(): Promise<any>;
2613
2617
  removeDataByPrimaryKey(id: any, options?: DataSourceCRUDParam): Promise<any>;
2614
2618
  removeDataByNodePath(nodePath: NodePath$1, options?: DataSourceCRUDParam): Promise<any>;
package/index.dev.js CHANGED
@@ -10660,8 +10660,11 @@ var Indexer = class {
10660
10660
  arr = arr.concat();
10661
10661
  }
10662
10662
  if (!arr.length && cache) {
10663
- const cacheInfo = cache.getMutationsArray();
10664
- if (cacheInfo && cacheInfo.length) {
10663
+ if (!cache.isEmpty()) {
10664
+ const cacheInfo = [
10665
+ ...cache.getMutationsArray(),
10666
+ ...cache.getTreeMutationsArray()
10667
+ ];
10665
10668
  for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
10666
10669
  const info = cacheInfo[cacheIndex];
10667
10670
  if (info.type === "insert") {
@@ -13145,6 +13148,9 @@ var DataSourceCache = class {
13145
13148
  this.getMutationsArray = () => {
13146
13149
  return Array.from(this.primaryKeyToData.values()).flat();
13147
13150
  };
13151
+ this.getTreeMutationsArray = () => {
13152
+ return Array.from(this.nodePathToData.values()).flat();
13153
+ };
13148
13154
  }
13149
13155
  static clone(cache, { light = false } = {}) {
13150
13156
  const clone = new DataSourceCache();
@@ -13282,9 +13288,23 @@ var DataSourceApiImpl = class {
13282
13288
  return result;
13283
13289
  };
13284
13290
  this.updateDataByNodePath = (data, nodePath, options) => {
13285
- return this.updateDataArrayByNodePath([data], [nodePath], options);
13291
+ return this.updateDataArrayByNodePath(
13292
+ [
13293
+ {
13294
+ data,
13295
+ nodePath
13296
+ }
13297
+ ],
13298
+ options
13299
+ );
13286
13300
  };
13287
- this.updateDataArrayByNodePath = (data, nodePaths, options) => {
13301
+ this.updateDataArrayByNodePath = (updateInfo, options) => {
13302
+ const data = [];
13303
+ const nodePaths = [];
13304
+ updateInfo.forEach((info) => {
13305
+ data.push(info.data);
13306
+ nodePaths.push(info.nodePath);
13307
+ });
13288
13308
  const result = this.batchOperation({
13289
13309
  type: "update",
13290
13310
  array: data,
@@ -15563,7 +15583,8 @@ function getColumnRenderParam(options) {
15563
15583
  all: null,
15564
15584
  value: typeof value === "boolean" ? `${value}` : value,
15565
15585
  selectionCheckBox: null,
15566
- groupIcon: null
15586
+ groupIcon: null,
15587
+ treeIcon: null
15567
15588
  },
15568
15589
  selectCurrentRow: () => {
15569
15590
  if (rowInfo.isTreeNode) {
@@ -16110,6 +16131,14 @@ function InfiniteTableColumnCellFn(props) {
16110
16131
  typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
16111
16132
  if (fn === true) {
16112
16133
  fn = defaultRenderTreeIcon;
16134
+ } else if (fn) {
16135
+ renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
16136
+ RenderCellHookComponent,
16137
+ {
16138
+ render: defaultRenderTreeIcon,
16139
+ renderParam
16140
+ }
16141
+ );
16113
16142
  }
16114
16143
  if (fn) {
16115
16144
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
@@ -22145,7 +22174,7 @@ var useLicense = (licenseKey = "") => {
22145
22174
  }
22146
22175
  let valid2 = isValidLicense(licenseKey, {
22147
22176
  publishedAt: 1624970570587,
22148
- version: "6.0.7"
22177
+ version: "6.0.8"
22149
22178
  });
22150
22179
  if (!licenseKey && !valid2 && isInsidePlayground) {
22151
22180
  return true;
package/index.dev.mjs CHANGED
@@ -10609,8 +10609,11 @@ var Indexer = class {
10609
10609
  arr = arr.concat();
10610
10610
  }
10611
10611
  if (!arr.length && cache) {
10612
- const cacheInfo = cache.getMutationsArray();
10613
- if (cacheInfo && cacheInfo.length) {
10612
+ if (!cache.isEmpty()) {
10613
+ const cacheInfo = [
10614
+ ...cache.getMutationsArray(),
10615
+ ...cache.getTreeMutationsArray()
10616
+ ];
10614
10617
  for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
10615
10618
  const info = cacheInfo[cacheIndex];
10616
10619
  if (info.type === "insert") {
@@ -13099,6 +13102,9 @@ var DataSourceCache = class {
13099
13102
  this.getMutationsArray = () => {
13100
13103
  return Array.from(this.primaryKeyToData.values()).flat();
13101
13104
  };
13105
+ this.getTreeMutationsArray = () => {
13106
+ return Array.from(this.nodePathToData.values()).flat();
13107
+ };
13102
13108
  }
13103
13109
  static clone(cache, { light = false } = {}) {
13104
13110
  const clone = new DataSourceCache();
@@ -13236,9 +13242,23 @@ var DataSourceApiImpl = class {
13236
13242
  return result;
13237
13243
  };
13238
13244
  this.updateDataByNodePath = (data, nodePath, options) => {
13239
- return this.updateDataArrayByNodePath([data], [nodePath], options);
13245
+ return this.updateDataArrayByNodePath(
13246
+ [
13247
+ {
13248
+ data,
13249
+ nodePath
13250
+ }
13251
+ ],
13252
+ options
13253
+ );
13240
13254
  };
13241
- this.updateDataArrayByNodePath = (data, nodePaths, options) => {
13255
+ this.updateDataArrayByNodePath = (updateInfo, options) => {
13256
+ const data = [];
13257
+ const nodePaths = [];
13258
+ updateInfo.forEach((info) => {
13259
+ data.push(info.data);
13260
+ nodePaths.push(info.nodePath);
13261
+ });
13242
13262
  const result = this.batchOperation({
13243
13263
  type: "update",
13244
13264
  array: data,
@@ -15517,7 +15537,8 @@ function getColumnRenderParam(options) {
15517
15537
  all: null,
15518
15538
  value: typeof value === "boolean" ? `${value}` : value,
15519
15539
  selectionCheckBox: null,
15520
- groupIcon: null
15540
+ groupIcon: null,
15541
+ treeIcon: null
15521
15542
  },
15522
15543
  selectCurrentRow: () => {
15523
15544
  if (rowInfo.isTreeNode) {
@@ -16064,6 +16085,14 @@ function InfiniteTableColumnCellFn(props) {
16064
16085
  typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
16065
16086
  if (fn === true) {
16066
16087
  fn = defaultRenderTreeIcon;
16088
+ } else if (fn) {
16089
+ renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
16090
+ RenderCellHookComponent,
16091
+ {
16092
+ render: defaultRenderTreeIcon,
16093
+ renderParam
16094
+ }
16095
+ );
16067
16096
  }
16068
16097
  if (fn) {
16069
16098
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
@@ -22103,7 +22132,7 @@ var useLicense = (licenseKey = "") => {
22103
22132
  }
22104
22133
  let valid2 = isValidLicense(licenseKey, {
22105
22134
  publishedAt: 1624970570587,
22106
- version: "6.0.7"
22135
+ version: "6.0.8"
22107
22136
  });
22108
22137
  if (!licenseKey && !valid2 && isInsidePlayground) {
22109
22138
  return true;
package/index.js CHANGED
@@ -10660,8 +10660,11 @@ var Indexer = class {
10660
10660
  arr = arr.concat();
10661
10661
  }
10662
10662
  if (!arr.length && cache) {
10663
- const cacheInfo = cache.getMutationsArray();
10664
- if (cacheInfo && cacheInfo.length) {
10663
+ if (!cache.isEmpty()) {
10664
+ const cacheInfo = [
10665
+ ...cache.getMutationsArray(),
10666
+ ...cache.getTreeMutationsArray()
10667
+ ];
10665
10668
  for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
10666
10669
  const info = cacheInfo[cacheIndex];
10667
10670
  if (info.type === "insert") {
@@ -13145,6 +13148,9 @@ var DataSourceCache = class {
13145
13148
  this.getMutationsArray = () => {
13146
13149
  return Array.from(this.primaryKeyToData.values()).flat();
13147
13150
  };
13151
+ this.getTreeMutationsArray = () => {
13152
+ return Array.from(this.nodePathToData.values()).flat();
13153
+ };
13148
13154
  }
13149
13155
  static clone(cache, { light = false } = {}) {
13150
13156
  const clone = new DataSourceCache();
@@ -13282,9 +13288,23 @@ var DataSourceApiImpl = class {
13282
13288
  return result;
13283
13289
  };
13284
13290
  this.updateDataByNodePath = (data, nodePath, options) => {
13285
- return this.updateDataArrayByNodePath([data], [nodePath], options);
13291
+ return this.updateDataArrayByNodePath(
13292
+ [
13293
+ {
13294
+ data,
13295
+ nodePath
13296
+ }
13297
+ ],
13298
+ options
13299
+ );
13286
13300
  };
13287
- this.updateDataArrayByNodePath = (data, nodePaths, options) => {
13301
+ this.updateDataArrayByNodePath = (updateInfo, options) => {
13302
+ const data = [];
13303
+ const nodePaths = [];
13304
+ updateInfo.forEach((info) => {
13305
+ data.push(info.data);
13306
+ nodePaths.push(info.nodePath);
13307
+ });
13288
13308
  const result = this.batchOperation({
13289
13309
  type: "update",
13290
13310
  array: data,
@@ -15563,7 +15583,8 @@ function getColumnRenderParam(options) {
15563
15583
  all: null,
15564
15584
  value: typeof value === "boolean" ? `${value}` : value,
15565
15585
  selectionCheckBox: null,
15566
- groupIcon: null
15586
+ groupIcon: null,
15587
+ treeIcon: null
15567
15588
  },
15568
15589
  selectCurrentRow: () => {
15569
15590
  if (rowInfo.isTreeNode) {
@@ -16110,6 +16131,14 @@ function InfiniteTableColumnCellFn(props) {
16110
16131
  typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
16111
16132
  if (fn === true) {
16112
16133
  fn = defaultRenderTreeIcon;
16134
+ } else if (fn) {
16135
+ renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
16136
+ RenderCellHookComponent,
16137
+ {
16138
+ render: defaultRenderTreeIcon,
16139
+ renderParam
16140
+ }
16141
+ );
16113
16142
  }
16114
16143
  if (fn) {
16115
16144
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
@@ -22145,7 +22174,7 @@ var useLicense = (licenseKey = "") => {
22145
22174
  }
22146
22175
  let valid2 = isValidLicense(licenseKey, {
22147
22176
  publishedAt: 1624970570587,
22148
- version: "6.0.7"
22177
+ version: "6.0.8"
22149
22178
  });
22150
22179
  if (!licenseKey && !valid2 && isInsidePlayground) {
22151
22180
  return true;
package/index.mjs CHANGED
@@ -10609,8 +10609,11 @@ var Indexer = class {
10609
10609
  arr = arr.concat();
10610
10610
  }
10611
10611
  if (!arr.length && cache) {
10612
- const cacheInfo = cache.getMutationsArray();
10613
- if (cacheInfo && cacheInfo.length) {
10612
+ if (!cache.isEmpty()) {
10613
+ const cacheInfo = [
10614
+ ...cache.getMutationsArray(),
10615
+ ...cache.getTreeMutationsArray()
10616
+ ];
10614
10617
  for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
10615
10618
  const info = cacheInfo[cacheIndex];
10616
10619
  if (info.type === "insert") {
@@ -13099,6 +13102,9 @@ var DataSourceCache = class {
13099
13102
  this.getMutationsArray = () => {
13100
13103
  return Array.from(this.primaryKeyToData.values()).flat();
13101
13104
  };
13105
+ this.getTreeMutationsArray = () => {
13106
+ return Array.from(this.nodePathToData.values()).flat();
13107
+ };
13102
13108
  }
13103
13109
  static clone(cache, { light = false } = {}) {
13104
13110
  const clone = new DataSourceCache();
@@ -13236,9 +13242,23 @@ var DataSourceApiImpl = class {
13236
13242
  return result;
13237
13243
  };
13238
13244
  this.updateDataByNodePath = (data, nodePath, options) => {
13239
- return this.updateDataArrayByNodePath([data], [nodePath], options);
13245
+ return this.updateDataArrayByNodePath(
13246
+ [
13247
+ {
13248
+ data,
13249
+ nodePath
13250
+ }
13251
+ ],
13252
+ options
13253
+ );
13240
13254
  };
13241
- this.updateDataArrayByNodePath = (data, nodePaths, options) => {
13255
+ this.updateDataArrayByNodePath = (updateInfo, options) => {
13256
+ const data = [];
13257
+ const nodePaths = [];
13258
+ updateInfo.forEach((info) => {
13259
+ data.push(info.data);
13260
+ nodePaths.push(info.nodePath);
13261
+ });
13242
13262
  const result = this.batchOperation({
13243
13263
  type: "update",
13244
13264
  array: data,
@@ -15517,7 +15537,8 @@ function getColumnRenderParam(options) {
15517
15537
  all: null,
15518
15538
  value: typeof value === "boolean" ? `${value}` : value,
15519
15539
  selectionCheckBox: null,
15520
- groupIcon: null
15540
+ groupIcon: null,
15541
+ treeIcon: null
15521
15542
  },
15522
15543
  selectCurrentRow: () => {
15523
15544
  if (rowInfo.isTreeNode) {
@@ -16064,6 +16085,14 @@ function InfiniteTableColumnCellFn(props) {
16064
16085
  typeof renderFunctions.renderTreeIcon === "function" ? renderFunctions.renderTreeIcon : isParentNode && renderFunctions.renderTreeIcon === true ? defaultRenderTreeIcon : void 0;
16065
16086
  if (fn === true) {
16066
16087
  fn = defaultRenderTreeIcon;
16088
+ } else if (fn) {
16089
+ renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
16090
+ RenderCellHookComponent,
16091
+ {
16092
+ render: defaultRenderTreeIcon,
16093
+ renderParam
16094
+ }
16095
+ );
16067
16096
  }
16068
16097
  if (fn) {
16069
16098
  renderParam.renderBag.treeIcon = /* @__PURE__ */ React38.createElement(
@@ -22103,7 +22132,7 @@ var useLicense = (licenseKey = "") => {
22103
22132
  }
22104
22133
  let valid2 = isValidLicense(licenseKey, {
22105
22134
  publishedAt: 1624970570587,
22106
- version: "6.0.7"
22135
+ version: "6.0.8"
22107
22136
  });
22108
22137
  if (!licenseKey && !valid2 && isInsidePlayground) {
22109
22138
  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.7",
28
+ "version": "6.0.8",
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": 1730215290304
37
+ "publishedAt": 1730286088785
38
38
  }