@firestitch/form 12.4.1 → 12.4.2
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/app/directives/form/form.directive.d.ts +4 -1
- package/app/interfaces/submit-event.d.ts +1 -0
- package/app/interfaces/submitted-event.d.ts +1 -0
- package/bundles/firestitch-form.umd.js +15 -8
- package/bundles/firestitch-form.umd.js.map +1 -1
- package/esm2015/app/directives/form/form.directive.js +16 -9
- package/esm2015/app/helpers/confirm-unsaved.js +2 -2
- package/esm2015/app/interfaces/submit-event.js +1 -1
- package/esm2015/app/interfaces/submitted-event.js +1 -1
- package/fesm2015/firestitch-form.js +16 -9
- package/fesm2015/firestitch-form.js.map +1 -1
- package/package.json +1 -1
|
@@ -58,6 +58,7 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
58
58
|
private _activatedRouteConfig;
|
|
59
59
|
private _status$;
|
|
60
60
|
private _destroy$;
|
|
61
|
+
private _confirmSubmit;
|
|
61
62
|
constructor(ngForm: NgForm, _form: FsForm, _element: ElementRef, _message: FsMessage, _prompt: FsPrompt, _ngZone: NgZone, _dialogRef: MatDialogRef<any>, _drawerRef: DrawerRef<any>, _route: ActivatedRoute);
|
|
62
63
|
get submitting(): boolean;
|
|
63
64
|
get validating(): boolean;
|
|
@@ -77,7 +78,9 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
77
78
|
reset(): void;
|
|
78
79
|
clear(): void;
|
|
79
80
|
dirty(): void;
|
|
80
|
-
triggerSubmit(
|
|
81
|
+
triggerSubmit(options?: {
|
|
82
|
+
confirmSubmit: boolean;
|
|
83
|
+
}): void;
|
|
81
84
|
triggerConfirm(): Observable<ConfirmResult>;
|
|
82
85
|
enable(): void;
|
|
83
86
|
disable(): void;
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
observer.complete();
|
|
420
420
|
});
|
|
421
421
|
form.ngForm.control.markAsPristine();
|
|
422
|
-
form.
|
|
422
|
+
form.triggerSubmit({ confirmSubmit: true });
|
|
423
423
|
}
|
|
424
424
|
}, function (error) {
|
|
425
425
|
observer.next(exports.ConfirmResult.Review);
|
|
@@ -615,6 +615,7 @@
|
|
|
615
615
|
this._snapshot = {};
|
|
616
616
|
this._status$ = new rxjs.BehaviorSubject(exports.FormStatus.Valid);
|
|
617
617
|
this._destroy$ = new rxjs.Subject();
|
|
618
|
+
this._confirmSubmit = false;
|
|
618
619
|
}
|
|
619
620
|
Object.defineProperty(FsFormDirective.prototype, "submitting", {
|
|
620
621
|
get: function () {
|
|
@@ -754,8 +755,9 @@
|
|
|
754
755
|
this.ngForm.form.markAsDirty();
|
|
755
756
|
this._updateDirtySubmitButtons();
|
|
756
757
|
};
|
|
757
|
-
FsFormDirective.prototype.triggerSubmit = function () {
|
|
758
|
-
this.
|
|
758
|
+
FsFormDirective.prototype.triggerSubmit = function (options) {
|
|
759
|
+
this._confirmSubmit = options === null || options === void 0 ? void 0 : options.confirmSubmit;
|
|
760
|
+
this.ngForm.ngSubmit.emit();
|
|
759
761
|
};
|
|
760
762
|
FsFormDirective.prototype.triggerConfirm = function () {
|
|
761
763
|
var _this = this;
|
|
@@ -788,13 +790,18 @@
|
|
|
788
790
|
.ngSubmit
|
|
789
791
|
.pipe(operators.tap(function (event) {
|
|
790
792
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
791
|
-
}), operators.
|
|
793
|
+
}), operators.map(function (event) {
|
|
794
|
+
return { event: event, confirmSubmit: _this._confirmSubmit };
|
|
795
|
+
}), operators.tap(function () { return _this._confirmSubmit = false; }), operators.filter(function () {
|
|
792
796
|
return [exports.FormStatus.Valid, exports.FormStatus.Invalid]
|
|
793
797
|
.includes(_this._status$.getValue());
|
|
794
|
-
}), operators.tap(function () { return _this._broadcasValidatingEvents(); }), operators.tap(function () { return _this._markControlsAsTouchedAndUpdateValidity(); }), operators.tap(function () { return _this._broadcastSubmittingEvents(); }), operators.switchMap(function () { return _this._waitUntilStatusPending()
|
|
795
|
-
return _this.
|
|
796
|
-
|
|
797
|
-
|
|
798
|
+
}), operators.tap(function () { return _this._broadcasValidatingEvents(); }), operators.tap(function () { return _this._markControlsAsTouchedAndUpdateValidity(); }), operators.tap(function () { return _this._broadcastSubmittingEvents(); }), operators.switchMap(function (data) { return _this._waitUntilStatusPending()
|
|
799
|
+
.pipe(operators.mapTo(data)); }), operators.tap(function () { return _this._setupActiveSubmitButton(); }), operators.tap(function () { return _this._disableButtons(); }), operators.mergeMap(function (data) {
|
|
800
|
+
if (_this.ngForm.status === 'INVALID') {
|
|
801
|
+
return _this._formInvalidState$;
|
|
802
|
+
}
|
|
803
|
+
return _this._formValidState$
|
|
804
|
+
.pipe(operators.map(function (submitEvent) { return (Object.assign(Object.assign({}, submitEvent), { confirmSubmit: data.confirmSubmit })); }));
|
|
798
805
|
}), operators.catchError(function (e, source$) {
|
|
799
806
|
_this._handleError(e);
|
|
800
807
|
return source$;
|