@firestitch/form 12.4.20 → 12.4.21
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 +6 -4
- package/bundles/firestitch-form.umd.js +32 -19
- package/bundles/firestitch-form.umd.js.map +1 -1
- package/esm2015/app/directives/form/form.directive.js +30 -26
- package/fesm2015/firestitch-form.js +29 -25
- package/fesm2015/firestitch-form.js.map +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
37
37
|
confirmBrowser: boolean;
|
|
38
38
|
confirmTabs: boolean;
|
|
39
39
|
dirtySubmitButton: boolean;
|
|
40
|
-
submit
|
|
40
|
+
set submit(submit$: (event: SubmitEvent) => Observable<any>);
|
|
41
41
|
successDelay: number;
|
|
42
42
|
errorDelay: number;
|
|
43
43
|
tabGroup: MatTabGroup;
|
|
@@ -48,7 +48,6 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
48
48
|
submitted: EventEmitter<SubmitEvent>;
|
|
49
49
|
reseted: EventEmitter<SubmitEvent>;
|
|
50
50
|
cleared: EventEmitter<SubmitEvent>;
|
|
51
|
-
submitRegistered: EventEmitter<any>;
|
|
52
51
|
fsFormClass: boolean;
|
|
53
52
|
formDialogClose: QueryList<FsFormDialogCloseDirective>;
|
|
54
53
|
private _tabGroups;
|
|
@@ -61,6 +60,7 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
61
60
|
private _status$;
|
|
62
61
|
private _destroy$;
|
|
63
62
|
private _confirmed;
|
|
63
|
+
private _submit$;
|
|
64
64
|
constructor(ngForm: NgForm, _form: FsForm, _element: ElementRef, _message: FsMessage, _prompt: FsPrompt, _ngZone: NgZone, _cdRef: ChangeDetectorRef, _dialogRef: MatDialogRef<any>, _drawerRef: DrawerRef<any>, _route: ActivatedRoute);
|
|
65
65
|
get submitting(): boolean;
|
|
66
66
|
get validating(): boolean;
|
|
@@ -71,7 +71,9 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
71
71
|
private get _submitter();
|
|
72
72
|
ngOnInit(): void;
|
|
73
73
|
ngOnChanges(changes: SimpleChanges): void;
|
|
74
|
-
|
|
74
|
+
get hasSubmit(): boolean;
|
|
75
|
+
clearSubmit(): void;
|
|
76
|
+
registerSubmit(submit$: Observable<any>): void;
|
|
75
77
|
ngAfterContentInit(): void;
|
|
76
78
|
ngOnDestroy(): void;
|
|
77
79
|
createSnapshot(): void;
|
|
@@ -121,5 +123,5 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
|
|
|
121
123
|
private _registerCanDeactivateGuard;
|
|
122
124
|
private _cleanupCanDeactivate;
|
|
123
125
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsFormDirective, [null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, null]>;
|
|
124
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<FsFormDirective, "[fsForm]", never, { "wrapperSelector": "wrapperSelector"; "messageSelector": "messageSelector"; "hintSelector": "hintSelector"; "labelSelector": "labelSelector"; "autocomplete": "autocomplete"; "shortcuts": "shortcuts"; "confirm": "confirm"; "confirmDialog": "confirmDialog"; "confirmDrawer": "confirmDrawer"; "confirmBrowser": "confirmBrowser"; "confirmTabs": "confirmTabs"; "dirtySubmitButton": "dirtySubmitButton"; "submit": "submit"; "successDelay": "successDelay"; "errorDelay": "errorDelay"; "tabGroup": "tabGroup"; "deactivationGuard": "deactivationGuard"; }, { "submitEvent": "fsForm"; "invalid": "invalid"; "valid": "valid"; "submitted": "submitted"; "reseted": "reseted"; "cleared": "cleared";
|
|
126
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FsFormDirective, "[fsForm]", never, { "wrapperSelector": "wrapperSelector"; "messageSelector": "messageSelector"; "hintSelector": "hintSelector"; "labelSelector": "labelSelector"; "autocomplete": "autocomplete"; "shortcuts": "shortcuts"; "confirm": "confirm"; "confirmDialog": "confirmDialog"; "confirmDrawer": "confirmDrawer"; "confirmBrowser": "confirmBrowser"; "confirmTabs": "confirmTabs"; "dirtySubmitButton": "dirtySubmitButton"; "submit": "submit"; "successDelay": "successDelay"; "errorDelay": "errorDelay"; "tabGroup": "tabGroup"; "deactivationGuard": "deactivationGuard"; }, { "submitEvent": "fsForm"; "invalid": "invalid"; "valid": "valid"; "submitted": "submitted"; "reseted": "reseted"; "cleared": "cleared"; }, ["formDialogClose", "_tabGroups"]>;
|
|
125
127
|
}
|
|
@@ -609,7 +609,6 @@
|
|
|
609
609
|
this.submitted = new i0.EventEmitter();
|
|
610
610
|
this.reseted = new i0.EventEmitter();
|
|
611
611
|
this.cleared = new i0.EventEmitter();
|
|
612
|
-
this.submitRegistered = new i0.EventEmitter();
|
|
613
612
|
this.fsFormClass = true;
|
|
614
613
|
this._tabGroups = new i0.QueryList();
|
|
615
614
|
this._buttons = new i0.QueryList();
|
|
@@ -618,7 +617,15 @@
|
|
|
618
617
|
this._status$ = new rxjs.BehaviorSubject(exports.FormStatus.Valid);
|
|
619
618
|
this._destroy$ = new rxjs.Subject();
|
|
620
619
|
this._confirmed = false;
|
|
620
|
+
this._submit$ = null;
|
|
621
621
|
}
|
|
622
|
+
Object.defineProperty(FsFormDirective.prototype, "submit", {
|
|
623
|
+
set: function (submit$) {
|
|
624
|
+
this._submit$ = submit$;
|
|
625
|
+
},
|
|
626
|
+
enumerable: false,
|
|
627
|
+
configurable: true
|
|
628
|
+
});
|
|
622
629
|
Object.defineProperty(FsFormDirective.prototype, "submitting", {
|
|
623
630
|
get: function () {
|
|
624
631
|
return this._status$.getValue() === exports.FormStatus.Submitting;
|
|
@@ -658,20 +665,15 @@
|
|
|
658
665
|
var submittedEvent = {
|
|
659
666
|
ngForm: this.ngForm,
|
|
660
667
|
submitter: this._submitter,
|
|
661
|
-
response: null
|
|
668
|
+
response: null,
|
|
662
669
|
};
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
var result = this.submit(this._submitEvent);
|
|
667
|
-
if (!rxjs.isObservable(result)) {
|
|
668
|
-
return rxjs.of(submittedEvent);
|
|
669
|
-
}
|
|
670
|
-
return result
|
|
670
|
+
var submit$ = this._submit$ ?
|
|
671
|
+
this._submit$(this._submitEvent) : rxjs.of(submittedEvent);
|
|
672
|
+
return submit$
|
|
671
673
|
.pipe(operators.map(function (response) {
|
|
672
674
|
submittedEvent.response = response;
|
|
673
675
|
return submittedEvent;
|
|
674
|
-
}));
|
|
676
|
+
}), operators.takeUntil(this._destroy$));
|
|
675
677
|
},
|
|
676
678
|
enumerable: false,
|
|
677
679
|
configurable: true
|
|
@@ -720,11 +722,24 @@
|
|
|
720
722
|
this._updateDirtySubmitButtons();
|
|
721
723
|
}
|
|
722
724
|
};
|
|
723
|
-
FsFormDirective.prototype
|
|
725
|
+
Object.defineProperty(FsFormDirective.prototype, "hasSubmit", {
|
|
726
|
+
get: function () {
|
|
727
|
+
return this._submit$ !== null;
|
|
728
|
+
},
|
|
729
|
+
enumerable: false,
|
|
730
|
+
configurable: true
|
|
731
|
+
});
|
|
732
|
+
FsFormDirective.prototype.clearSubmit = function () {
|
|
733
|
+
var _this = this;
|
|
734
|
+
this._submit$ = null;
|
|
735
|
+
setTimeout(function () {
|
|
736
|
+
_this._cdRef.markForCheck();
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
FsFormDirective.prototype.registerSubmit = function (submit$) {
|
|
724
740
|
var _this = this;
|
|
725
|
-
this.
|
|
741
|
+
this._submit$ = function () { return submit$; };
|
|
726
742
|
setTimeout(function () {
|
|
727
|
-
_this.submitRegistered.emit();
|
|
728
743
|
_this._cdRef.markForCheck();
|
|
729
744
|
});
|
|
730
745
|
};
|
|
@@ -1107,7 +1122,7 @@
|
|
|
1107
1122
|
};
|
|
1108
1123
|
FsFormDirective.prototype._registerConfirmDialogBackdropEscape = function () {
|
|
1109
1124
|
var _this = this;
|
|
1110
|
-
this._dialogBackdropEscape = this._dialogRef && this._dialogRef.disableClose
|
|
1125
|
+
this._dialogBackdropEscape = this._dialogRef && !this._dialogRef.disableClose;
|
|
1111
1126
|
if (this._dialogRef && !this._dialogRef.disableClose) {
|
|
1112
1127
|
this._dialogRef.disableClose = true;
|
|
1113
1128
|
this._dialogRef.backdropClick()
|
|
@@ -1127,7 +1142,7 @@
|
|
|
1127
1142
|
this.ngForm.form.registerControl = function (name, control) {
|
|
1128
1143
|
var el = _this._element.nativeElement.querySelector("input[name='" + name + "']");
|
|
1129
1144
|
if (el) {
|
|
1130
|
-
el.setAttribute('name', name +
|
|
1145
|
+
el.setAttribute('name', name + "_" + common.guid());
|
|
1131
1146
|
if (!el.getAttribute('autocomplete')) {
|
|
1132
1147
|
el.setAttribute('autocomplete', 'none');
|
|
1133
1148
|
}
|
|
@@ -1223,7 +1238,7 @@
|
|
|
1223
1238
|
return FsFormDirective;
|
|
1224
1239
|
}());
|
|
1225
1240
|
FsFormDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, deps: [{ token: i1$1.NgForm }, { token: FsForm }, { token: i0__namespace.ElementRef }, { token: i2__namespace.FsMessage }, { token: i1__namespace.FsPrompt }, { token: i0__namespace.NgZone }, { token: i0__namespace.ChangeDetectorRef }, { token: i2$1.MatDialogRef, optional: true }, { token: i7.DrawerRef, optional: true }, { token: i3__namespace.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1226
|
-
FsFormDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared"
|
|
1241
|
+
FsFormDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, queries: [{ propertyName: "formDialogClose", predicate: FsFormDialogCloseDirective, descendants: true }, { propertyName: "_tabGroups", predicate: tabs.MatTabGroup, descendants: true }], usesOnChanges: true, ngImport: i0__namespace });
|
|
1227
1242
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, decorators: [{
|
|
1228
1243
|
type: i0.Directive,
|
|
1229
1244
|
args: [{
|
|
@@ -1291,8 +1306,6 @@
|
|
|
1291
1306
|
type: i0.Output
|
|
1292
1307
|
}], cleared: [{
|
|
1293
1308
|
type: i0.Output
|
|
1294
|
-
}], submitRegistered: [{
|
|
1295
|
-
type: i0.Output
|
|
1296
1309
|
}], fsFormClass: [{
|
|
1297
1310
|
type: i0.HostBinding,
|
|
1298
1311
|
args: ['class.fs-form']
|