@sumaris-net/ngx-components 1.3.5 → 1.3.6

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.
@@ -20582,37 +20582,41 @@
20582
20582
  case 0:
20583
20583
  if (this.saving)
20584
20584
  return [2 /*return*/];
20585
+ if (!!this.form.valid) return [3 /*break*/, 2];
20585
20586
  return [4 /*yield*/, AppFormUtils.waitWhilePending(this.form)];
20586
20587
  case 1:
20587
20588
  _a.sent();
20588
20589
  if (this.form.invalid) {
20589
20590
  AppFormUtils.logFormErrors(this.form);
20591
+ this.form.markAllAsTouched();
20590
20592
  return [2 /*return*/];
20591
20593
  }
20594
+ _a.label = 2;
20595
+ case 2:
20592
20596
  this.submitted = true;
20593
20597
  this.saving = true;
20594
20598
  this.error = undefined;
20595
20599
  newAccount = exports.Account.fromObject(Object.assign(Object.assign({}, (this.accountService.account.asObject())), (this.form.value)));
20596
20600
  console.debug('[account] Saving account...', newAccount);
20597
- _a.label = 2;
20598
- case 2:
20599
- _a.trys.push([2, 4, 5, 6]);
20601
+ _a.label = 3;
20602
+ case 3:
20603
+ _a.trys.push([3, 5, 6, 7]);
20600
20604
  this.disable();
20601
20605
  return [4 /*yield*/, this.accountService.save(newAccount)];
20602
- case 3:
20606
+ case 4:
20603
20607
  _a.sent();
20604
20608
  this.markAsPristine();
20605
- return [3 /*break*/, 6];
20606
- case 4:
20609
+ return [3 /*break*/, 7];
20610
+ case 5:
20607
20611
  err_2 = _a.sent();
20608
20612
  console.error(err_2);
20609
20613
  this.error = err_2 && err_2.message || err_2;
20610
- return [3 /*break*/, 6];
20611
- case 5:
20614
+ return [3 /*break*/, 7];
20615
+ case 6:
20612
20616
  this.saving = false;
20613
20617
  this.enable();
20614
20618
  return [7 /*endfinally*/];
20615
- case 6: return [2 /*return*/];
20619
+ case 7: return [2 /*return*/];
20616
20620
  }
20617
20621
  });
20618
20622
  });
@@ -21199,25 +21203,33 @@
21199
21203
  event === null || event === void 0 ? void 0 : event.preventDefault();
21200
21204
  // Remove all empty controls
21201
21205
  this.propertiesFormHelper.removeAllEmpty();
21202
- if (this.form.invalid && this.debug) {
21206
+ if (!!this.form.valid) return [3 /*break*/, 2];
21207
+ return [4 /*yield*/, AppFormUtils.waitWhilePending(this.form)];
21208
+ case 1:
21209
+ _a.sent();
21210
+ if (this.form.invalid) {
21203
21211
  AppFormUtils.logFormErrors(this.form);
21212
+ this.form.markAllAsTouched();
21213
+ return [2 /*return*/];
21204
21214
  }
21215
+ _a.label = 2;
21216
+ case 2:
21205
21217
  console.debug('[settings] Saving local settings...');
21206
21218
  this.saving = true;
21207
21219
  this.error = undefined;
21208
21220
  return [4 /*yield*/, this.getValue()];
21209
- case 1:
21221
+ case 3:
21210
21222
  data = _a.sent();
21211
21223
  peerChanged = this.form.get('peerUrl').dirty;
21212
21224
  // Clean page history, when peer changed
21213
21225
  if (peerChanged)
21214
21226
  data.pageHistory = [];
21215
- _a.label = 2;
21216
- case 2:
21217
- _a.trys.push([2, 4, 5, 6]);
21227
+ _a.label = 4;
21228
+ case 4:
21229
+ _a.trys.push([4, 6, 7, 8]);
21218
21230
  this.disable();
21219
21231
  return [4 /*yield*/, this.settings.apply(data)];
21220
- case 3:
21232
+ case 5:
21221
21233
  _a.sent();
21222
21234
  this.data = data;
21223
21235
  this.markAsPristine();
@@ -21227,19 +21239,19 @@
21227
21239
  this.network.peer = exports.Peer.parseUrl(data.peerUrl);
21228
21240
  }
21229
21241
  return [2 /*return*/, true];
21230
- case 4:
21242
+ case 6:
21231
21243
  err_1 = _a.sent();
21232
21244
  console.error(err_1);
21233
21245
  this.error = err_1 && err_1.message || err_1;
21234
21246
  return [2 /*return*/, false];
21235
- case 5:
21247
+ case 7:
21236
21248
  this.enable({ emitEvent: false });
21237
21249
  // Apply inheritance
21238
21250
  this.setAccountInheritance(data.accountInheritance, { emitEvent: false });
21239
21251
  this.saving = false;
21240
21252
  this.markForCheck();
21241
21253
  return [7 /*endfinally*/];
21242
- case 6: return [2 /*return*/];
21254
+ case 8: return [2 /*return*/];
21243
21255
  }
21244
21256
  });
21245
21257
  });