@zeedhi/common 1.93.1 → 1.94.0

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.
@@ -6936,6 +6936,17 @@ class GridEditable extends Grid {
6936
6936
  }
6937
6937
  return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
6938
6938
  }
6939
+ changeData(data) {
6940
+ super.changeData(data);
6941
+ const { uniqueKey } = this.datasource;
6942
+ const foundRow = data === null || data === void 0 ? void 0 : data.find((row) => (row[uniqueKey] !== 0 && !row[uniqueKey]));
6943
+ if (!foundRow || !this.editedRows[foundRow[uniqueKey]]) {
6944
+ return;
6945
+ }
6946
+ const rows = Object.assign({}, this.editedRows);
6947
+ delete rows[foundRow[uniqueKey]];
6948
+ this.editedRows = rows;
6949
+ }
6939
6950
  }
6940
6951
 
6941
6952
  /**
@@ -13159,7 +13170,27 @@ class TreeGridEditable extends TreeGrid {
13159
13170
  checkLookupData(column, row, componentProps) {
13160
13171
  if (row[column.name] && column.lookupData && componentProps.datasource) {
13161
13172
  componentProps.datasource.data = componentProps.datasource.data || [];
13162
- componentProps.datasource.data.push(column.lookupData[row[column.name]]);
13173
+ const colValue = row[column.name];
13174
+ if (Array.isArray(colValue)) {
13175
+ colValue.forEach((item) => {
13176
+ const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
13177
+ if (column.lookupData[value]) {
13178
+ componentProps.datasource.data.push(column.lookupData[value]);
13179
+ }
13180
+ });
13181
+ return;
13182
+ }
13183
+ if (colValue && typeof colValue === 'object'
13184
+ && Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
13185
+ const value = colValue[componentProps.dataValue];
13186
+ if (column.lookupData[value]) {
13187
+ componentProps.datasource.data.push(column.lookupData[value]);
13188
+ }
13189
+ return;
13190
+ }
13191
+ if (column.lookupData[colValue]) {
13192
+ componentProps.datasource.data.push(column.lookupData[colValue]);
13193
+ }
13163
13194
  }
13164
13195
  }
13165
13196
  checkCompValidity(component) {
@@ -13398,6 +13429,17 @@ class TreeGridEditable extends TreeGrid {
13398
13429
  callCanEditRow(row) {
13399
13430
  return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
13400
13431
  }
13432
+ changeData(data) {
13433
+ super.changeData(data);
13434
+ const { uniqueKey } = this.datasource;
13435
+ const foundRow = data === null || data === void 0 ? void 0 : data.find((row) => (row[uniqueKey] !== 0 && !row[uniqueKey]));
13436
+ if (!foundRow || !this.editedRows[foundRow[uniqueKey]]) {
13437
+ return;
13438
+ }
13439
+ const rows = Object.assign({}, this.editedRows);
13440
+ delete rows[foundRow[uniqueKey]];
13441
+ this.editedRows = rows;
13442
+ }
13401
13443
  }
13402
13444
 
13403
13445
  class Icons {
@@ -6943,6 +6943,17 @@
6943
6943
  }
6944
6944
  return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
6945
6945
  }
6946
+ changeData(data) {
6947
+ super.changeData(data);
6948
+ const { uniqueKey } = this.datasource;
6949
+ const foundRow = data === null || data === void 0 ? void 0 : data.find((row) => (row[uniqueKey] !== 0 && !row[uniqueKey]));
6950
+ if (!foundRow || !this.editedRows[foundRow[uniqueKey]]) {
6951
+ return;
6952
+ }
6953
+ const rows = Object.assign({}, this.editedRows);
6954
+ delete rows[foundRow[uniqueKey]];
6955
+ this.editedRows = rows;
6956
+ }
6946
6957
  }
6947
6958
 
6948
6959
  /**
@@ -13166,7 +13177,27 @@
13166
13177
  checkLookupData(column, row, componentProps) {
13167
13178
  if (row[column.name] && column.lookupData && componentProps.datasource) {
13168
13179
  componentProps.datasource.data = componentProps.datasource.data || [];
13169
- componentProps.datasource.data.push(column.lookupData[row[column.name]]);
13180
+ const colValue = row[column.name];
13181
+ if (Array.isArray(colValue)) {
13182
+ colValue.forEach((item) => {
13183
+ const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
13184
+ if (column.lookupData[value]) {
13185
+ componentProps.datasource.data.push(column.lookupData[value]);
13186
+ }
13187
+ });
13188
+ return;
13189
+ }
13190
+ if (colValue && typeof colValue === 'object'
13191
+ && Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
13192
+ const value = colValue[componentProps.dataValue];
13193
+ if (column.lookupData[value]) {
13194
+ componentProps.datasource.data.push(column.lookupData[value]);
13195
+ }
13196
+ return;
13197
+ }
13198
+ if (column.lookupData[colValue]) {
13199
+ componentProps.datasource.data.push(column.lookupData[colValue]);
13200
+ }
13170
13201
  }
13171
13202
  }
13172
13203
  checkCompValidity(component) {
@@ -13405,6 +13436,17 @@
13405
13436
  callCanEditRow(row) {
13406
13437
  return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
13407
13438
  }
13439
+ changeData(data) {
13440
+ super.changeData(data);
13441
+ const { uniqueKey } = this.datasource;
13442
+ const foundRow = data === null || data === void 0 ? void 0 : data.find((row) => (row[uniqueKey] !== 0 && !row[uniqueKey]));
13443
+ if (!foundRow || !this.editedRows[foundRow[uniqueKey]]) {
13444
+ return;
13445
+ }
13446
+ const rows = Object.assign({}, this.editedRows);
13447
+ delete rows[foundRow[uniqueKey]];
13448
+ this.editedRows = rows;
13449
+ }
13408
13450
  }
13409
13451
 
13410
13452
  class Icons {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.93.1",
3
+ "version": "1.94.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -43,5 +43,5 @@
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
45
  },
46
- "gitHead": "91e236011b279ad56d0bdd51caa41f2910ffd1e5"
46
+ "gitHead": "0f51cae680b4c284f8565c314431600b709e00aa"
47
47
  }
@@ -203,4 +203,5 @@ export declare class GridEditable extends Grid implements IGridEditable {
203
203
  */
204
204
  private changeCell;
205
205
  callCanEditRow(row: IDictionary<any>): any;
206
+ changeData(data?: IDictionary<any>[]): void;
206
207
  }
@@ -188,4 +188,5 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
188
188
  */
189
189
  private changeCell;
190
190
  callCanEditRow(row: IDictionary<any>): boolean;
191
+ changeData(data?: IDictionary<any>[]): void;
191
192
  }