@sumaris-net/ngx-components 1.19.2 → 1.19.3

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.
@@ -19663,12 +19663,41 @@
19663
19663
  AppForm.prototype.cancel = function () {
19664
19664
  this.onCancel.emit();
19665
19665
  };
19666
- AppForm.prototype.doSubmit = function (event) {
19667
- if (!this.form || !this.form.valid) {
19668
- this.markAllAsTouched({ emitEvent: true });
19669
- return;
19670
- }
19671
- this.onSubmit.emit(event);
19666
+ /**
19667
+ *
19668
+ * @param event
19669
+ * @param opts allow to skip validation check, using {checkValid: false}
19670
+ */
19671
+ AppForm.prototype.doSubmit = function (event, opts) {
19672
+ return __awaiter(this, void 0, void 0, function () {
19673
+ return __generator(this, function (_b) {
19674
+ switch (_b.label) {
19675
+ case 0:
19676
+ if (!this._form) {
19677
+ this.markAllAsTouched({ emitEvent: true });
19678
+ return [2 /*return*/];
19679
+ }
19680
+ if (!((!opts || opts.checkValid !== false) && !this._form.valid)) return [3 /*break*/, 2];
19681
+ // Wait validation end
19682
+ return [4 /*yield*/, AppFormUtils.waitWhilePending(this._form)];
19683
+ case 1:
19684
+ // Wait validation end
19685
+ _b.sent();
19686
+ // Form is invalid: exit (+ log if debug)
19687
+ if (this._form.invalid) {
19688
+ this.markAllAsTouched({ emitEvent: true });
19689
+ if (this.debug)
19690
+ AppFormUtils.logFormErrors(this._form);
19691
+ return [2 /*return*/];
19692
+ }
19693
+ _b.label = 2;
19694
+ case 2:
19695
+ // Emit event
19696
+ this.onSubmit.emit(event);
19697
+ return [2 /*return*/];
19698
+ }
19699
+ });
19700
+ });
19672
19701
  };
19673
19702
  AppForm.prototype.setForm = function (form) {
19674
19703
  var _this = this;
@@ -20953,25 +20982,41 @@
20953
20982
  this.onCancel.emit();
20954
20983
  };
20955
20984
  AuthForm.prototype.doSubmit = function (event) {
20956
- var _this = this;
20957
- if (event) {
20958
- event.preventDefault();
20959
- event.stopPropagation();
20960
- }
20961
- if (this.form.invalid || this.loading)
20962
- return;
20963
- this.markAsLoading();
20964
- var data = this.form.value;
20965
- this.showPwd = false; // Hide password
20966
- this.error = null; // Reset error
20967
- this.registerSubscription(this.onSubmit
20968
- .pipe(operators.debounceTime(500))
20969
- .subscribe(function (res) { return _this.markAsLoaded(); }));
20970
- setTimeout(function () { return _this.onSubmit.emit({
20971
- username: data.username,
20972
- password: data.password,
20973
- offline: data.offline
20974
- }); });
20985
+ return __awaiter(this, void 0, void 0, function () {
20986
+ var data;
20987
+ var _this = this;
20988
+ return __generator(this, function (_a) {
20989
+ switch (_a.label) {
20990
+ case 0:
20991
+ if (event) {
20992
+ event.preventDefault();
20993
+ event.stopPropagation();
20994
+ }
20995
+ if (this.loading)
20996
+ return [2 /*return*/];
20997
+ if (!!this.form.valid) return [3 /*break*/, 2];
20998
+ return [4 /*yield*/, AppFormUtils.waitWhilePending(this.form)];
20999
+ case 1:
21000
+ _a.sent();
21001
+ if (this.form.invalid) {
21002
+ AppFormUtils.logFormErrors(this.form);
21003
+ return [2 /*return*/]; // Skip if invalid
21004
+ }
21005
+ _a.label = 2;
21006
+ case 2:
21007
+ this.markAsLoading();
21008
+ data = this.form.value;
21009
+ this.showPwd = false; // Hide password
21010
+ this.error = null; // Reset error
21011
+ setTimeout(function () { return _this.onSubmit.emit({
21012
+ username: data.username,
21013
+ password: data.password,
21014
+ offline: data.offline
21015
+ }); });
21016
+ return [2 /*return*/];
21017
+ }
21018
+ });
21019
+ });
20975
21020
  };
20976
21021
  AuthForm.prototype.register = function () {
20977
21022
  var _this = this;