@sumaris-net/ngx-components 18.8.22 → 18.8.23

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.
@@ -34378,11 +34378,15 @@ class AppTable {
34378
34378
  const newRow = await this.addRowToTable(row.id + 1);
34379
34379
  if (!newRow)
34380
34380
  throw new Error('Cannot add new row to table');
34381
- const json = { ...row.currentData, id: null };
34381
+ const json = row.cloneData();
34382
+ // Clean id and updateDate
34383
+ EntityUtils.cleanIdAndUpdateDate(json);
34382
34384
  // Reset some properties (e.g. rankOrder, etc)
34383
- if (opts && opts.skipProperties) {
34385
+ if (isNotEmptyArray(opts?.skipProperties)) {
34384
34386
  const newData = newRow.currentData;
34385
- opts.skipProperties.forEach((key) => (json[key] = newData[key]));
34387
+ opts.skipProperties.forEach((path) => {
34388
+ setPropertyByPath(json, path, getPropertyByPath(newData, path));
34389
+ });
34386
34390
  }
34387
34391
  if (newRow.validator) {
34388
34392
  newRow.validator.patchValue(json);
@@ -37092,11 +37096,15 @@ class AppAsyncTable {
37092
37096
  const newRow = await this.addRowToTable(row.id + 1);
37093
37097
  if (!newRow)
37094
37098
  throw new Error('Cannot add new row to table');
37095
- const json = { ...row.currentData, id: null };
37099
+ const json = row.cloneData();
37100
+ // Clean id and updateDate
37101
+ EntityUtils.cleanIdAndUpdateDate(json);
37096
37102
  // Reset some properties (e.g. rankOrder, etc)
37097
- if (opts && opts.skipProperties) {
37103
+ if (isNotEmptyArray(opts?.skipProperties)) {
37098
37104
  const newData = newRow.currentData;
37099
- opts.skipProperties.forEach((key) => (json[key] = newData[key]));
37105
+ opts.skipProperties.forEach((path) => {
37106
+ setPropertyByPath(json, path, getPropertyByPath(newData, path));
37107
+ });
37100
37108
  }
37101
37109
  if (newRow.validator) {
37102
37110
  newRow.validator.patchValue(json);