@firestitch/form 13.3.9 → 14.0.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/components/confirm-unsaved/confirm-unsaved.component.d.ts +21 -21
- package/app/components/confirm-unsaved/index.d.ts +1 -1
- package/app/components/form-dialog-actions/form-dialog-actions.component.d.ts +22 -22
- package/app/components/form-dialog-actions/index.d.ts +1 -1
- package/app/components/form-template/form-template.component.d.ts +13 -13
- package/app/components/form-template/index.d.ts +1 -1
- package/app/components/form-template-outlet/form-template-outlet.component.d.ts +13 -13
- package/app/components/form-template-outlet/index.d.ts +1 -1
- package/app/components/index.d.ts +4 -4
- package/app/consts/error-messages.const.d.ts +21 -21
- package/app/directives/button.directive.d.ts +35 -35
- package/app/directives/form/form.directive.d.ts +122 -122
- package/app/directives/form/index.d.ts +1 -1
- package/app/directives/form-dialog-close.directive.d.ts +16 -16
- package/app/directives/form-template.directive.d.ts +10 -10
- package/app/directives/index.d.ts +6 -6
- package/app/directives/submit-button.directive.d.ts +6 -6
- package/app/directives/validators/compare.directive.d.ts +15 -15
- package/app/directives/validators/control.directive.d.ts +49 -49
- package/app/directives/validators/daterange.directive.d.ts +13 -13
- package/app/directives/validators/email.directive.d.ts +13 -13
- package/app/directives/validators/emails.directive.d.ts +13 -13
- package/app/directives/validators/function.directive.d.ts +15 -15
- package/app/directives/validators/greater-equal.directive.d.ts +13 -13
- package/app/directives/validators/greater.directive.d.ts +13 -13
- package/app/directives/validators/index.d.ts +22 -22
- package/app/directives/validators/integer.directive.d.ts +13 -13
- package/app/directives/validators/lesser-equal.directive.d.ts +13 -13
- package/app/directives/validators/lesser.directive.d.ts +13 -13
- package/app/directives/validators/max.directive.d.ts +13 -13
- package/app/directives/validators/maxlength.directive.d.ts +13 -13
- package/app/directives/validators/min.directive.d.ts +13 -13
- package/app/directives/validators/minlength.directive.d.ts +13 -13
- package/app/directives/validators/no-fs-validators.directive.d.ts +14 -14
- package/app/directives/validators/numeric.directive.d.ts +13 -13
- package/app/directives/validators/pattern.directive.d.ts +13 -13
- package/app/directives/validators/phone.directive.d.ts +13 -13
- package/app/directives/validators/required.directive.d.ts +16 -16
- package/app/directives/validators/url.directive.d.ts +14 -14
- package/app/directives/validators/validate.directive.d.ts +15 -15
- package/app/enums/confirm-result.d.ts +7 -7
- package/app/enums/form-status.d.ts +10 -10
- package/app/enums/index.d.ts +2 -2
- package/app/fs-form.module.d.ts +44 -44
- package/app/guards/form-deactivate.guard.d.ts +12 -12
- package/app/helpers/confirm-result-continue.d.ts +1 -1
- package/app/helpers/get-active-route.d.ts +2 -2
- package/app/helpers/get-form-errors.d.ts +2 -2
- package/app/helpers/index.d.ts +1 -1
- package/app/helpers/is-enabled.d.ts +1 -1
- package/app/interfaces/async-validator.d.ts +14 -14
- package/app/interfaces/confirm-config.d.ts +7 -7
- package/app/interfaces/confirm-tab-group.d.ts +10 -10
- package/app/interfaces/index.d.ts +4 -4
- package/app/interfaces/submit-event.d.ts +6 -6
- package/app/interfaces/submitted-event.d.ts +7 -7
- package/app/interfaces/validator.d.ts +13 -13
- package/app/providers/validate-messages.provider.d.ts +27 -27
- package/app/services/fsform.service.d.ts +20 -20
- package/app/validators/validators.d.ts +12 -12
- package/esm2020/app/components/confirm-unsaved/confirm-unsaved.component.mjs +43 -43
- package/esm2020/app/components/confirm-unsaved/index.mjs +1 -1
- package/esm2020/app/components/form-dialog-actions/form-dialog-actions.component.mjs +74 -74
- package/esm2020/app/components/form-dialog-actions/index.mjs +1 -1
- package/esm2020/app/components/form-template/form-template.component.mjs +31 -31
- package/esm2020/app/components/form-template/index.mjs +2 -2
- package/esm2020/app/components/form-template-outlet/form-template-outlet.component.mjs +30 -30
- package/esm2020/app/components/form-template-outlet/index.mjs +2 -2
- package/esm2020/app/components/index.mjs +4 -4
- package/esm2020/app/consts/error-messages.const.mjs +21 -21
- package/esm2020/app/directives/button.directive.mjs +151 -151
- package/esm2020/app/directives/form/form.directive.mjs +689 -692
- package/esm2020/app/directives/form/index.mjs +1 -1
- package/esm2020/app/directives/form-dialog-close.directive.mjs +53 -53
- package/esm2020/app/directives/form-template.directive.mjs +19 -19
- package/esm2020/app/directives/index.mjs +6 -6
- package/esm2020/app/directives/submit-button.directive.mjs +13 -13
- package/esm2020/app/directives/validators/compare.directive.mjs +46 -46
- package/esm2020/app/directives/validators/control.directive.mjs +257 -257
- package/esm2020/app/directives/validators/daterange.directive.mjs +40 -40
- package/esm2020/app/directives/validators/email.directive.mjs +40 -40
- package/esm2020/app/directives/validators/emails.directive.mjs +40 -40
- package/esm2020/app/directives/validators/function.directive.mjs +40 -40
- package/esm2020/app/directives/validators/greater-equal.directive.mjs +39 -39
- package/esm2020/app/directives/validators/greater.directive.mjs +39 -39
- package/esm2020/app/directives/validators/index.mjs +22 -22
- package/esm2020/app/directives/validators/integer.directive.mjs +38 -38
- package/esm2020/app/directives/validators/lesser-equal.directive.mjs +39 -39
- package/esm2020/app/directives/validators/lesser.directive.mjs +39 -39
- package/esm2020/app/directives/validators/max.directive.mjs +35 -35
- package/esm2020/app/directives/validators/maxlength.directive.mjs +34 -34
- package/esm2020/app/directives/validators/min.directive.mjs +35 -35
- package/esm2020/app/directives/validators/minlength.directive.mjs +34 -34
- package/esm2020/app/directives/validators/no-fs-validators.directive.mjs +52 -52
- package/esm2020/app/directives/validators/numeric.directive.mjs +40 -40
- package/esm2020/app/directives/validators/pattern.directive.mjs +34 -34
- package/esm2020/app/directives/validators/phone.directive.mjs +40 -40
- package/esm2020/app/directives/validators/required.directive.mjs +68 -68
- package/esm2020/app/directives/validators/url.directive.mjs +44 -44
- package/esm2020/app/directives/validators/validate.directive.mjs +42 -42
- package/esm2020/app/enums/confirm-result.mjs +8 -8
- package/esm2020/app/enums/form-status.mjs +11 -11
- package/esm2020/app/enums/index.mjs +2 -2
- package/esm2020/app/fs-form.module.mjs +209 -211
- package/esm2020/app/guards/form-deactivate.guard.mjs +41 -41
- package/esm2020/app/helpers/confirm-result-continue.mjs +4 -4
- package/esm2020/app/helpers/get-active-route.mjs +6 -6
- package/esm2020/app/helpers/get-form-errors.mjs +25 -25
- package/esm2020/app/helpers/index.mjs +1 -1
- package/esm2020/app/helpers/is-enabled.mjs +3 -3
- package/esm2020/app/interfaces/async-validator.mjs +1 -1
- package/esm2020/app/interfaces/confirm-config.mjs +1 -1
- package/esm2020/app/interfaces/confirm-tab-group.mjs +1 -1
- package/esm2020/app/interfaces/index.mjs +4 -4
- package/esm2020/app/interfaces/submit-event.mjs +1 -1
- package/esm2020/app/interfaces/submitted-event.mjs +1 -1
- package/esm2020/app/interfaces/validator.mjs +1 -1
- package/esm2020/app/providers/validate-messages.provider.mjs +10 -10
- package/esm2020/app/services/fsform.service.mjs +91 -91
- package/esm2020/app/validators/validators.mjs +92 -92
- package/esm2020/firestitch-form.mjs +4 -4
- package/esm2020/public_api.mjs +36 -36
- package/fesm2015/firestitch-form.mjs +2457 -2461
- package/fesm2015/firestitch-form.mjs.map +1 -1
- package/fesm2020/firestitch-form.mjs +2443 -2448
- package/fesm2020/firestitch-form.mjs.map +1 -1
- package/{firestitch-form.d.ts → index.d.ts} +5 -5
- package/package.json +3 -3
- package/public_api.d.ts +34 -34
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as i3$1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Component, ChangeDetectionStrategy, Inject, Injectable, EventEmitter, QueryList, Directive, Optional, Input, Output, HostBinding, ContentChildren,
|
|
4
|
+
import { Component, ChangeDetectionStrategy, Inject, Injectable, EventEmitter, QueryList, Directive, Optional, Input, Output, HostBinding, ContentChildren, HostListener, Host, ViewChild, ViewChildren, InjectionToken, Self, NgModule } from '@angular/core';
|
|
5
5
|
import * as i1$2 from '@angular/forms';
|
|
6
|
-
import {
|
|
6
|
+
import { UntypedFormGroup, NgForm, NgModel, Validators, FormsModule } from '@angular/forms';
|
|
7
7
|
import * as i1$1 from '@angular/material/button';
|
|
8
8
|
import { MatButtonModule } from '@angular/material/button';
|
|
9
9
|
import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core';
|
|
10
10
|
import * as i1 from '@angular/material/dialog';
|
|
11
11
|
import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';
|
|
12
|
-
import * as
|
|
12
|
+
import * as i3 from '@firestitch/dialog';
|
|
13
13
|
import { FsDialogModule } from '@firestitch/dialog';
|
|
14
14
|
import { Subject, of, merge, BehaviorSubject, throwError, fromEvent, iif, defer, from, isObservable } from 'rxjs';
|
|
15
15
|
import { filter, map, switchMap, first, mapTo, take, takeUntil, mergeMap, tap, catchError, delay, startWith } from 'rxjs/operators';
|
|
@@ -17,1001 +17,1046 @@ import { MatTabGroup } from '@angular/material/tabs';
|
|
|
17
17
|
import { guid, email, isEmpty, isNumeric, phone, url } from '@firestitch/common';
|
|
18
18
|
import * as i6 from '@firestitch/drawer';
|
|
19
19
|
import { DrawerRef } from '@firestitch/drawer';
|
|
20
|
-
import * as i2$
|
|
20
|
+
import * as i2$1 from '@firestitch/message';
|
|
21
21
|
import { MessageMode } from '@firestitch/message';
|
|
22
|
-
import * as i2
|
|
22
|
+
import * as i2 from '@angular/router';
|
|
23
23
|
import { values, keys, isObject } from 'lodash-es';
|
|
24
24
|
import { isValid } from 'date-fns';
|
|
25
25
|
|
|
26
|
-
class ConfirmUnsavedComponent {
|
|
27
|
-
constructor(_data, _dialogRef) {
|
|
28
|
-
this._data = _data;
|
|
29
|
-
this._dialogRef = _dialogRef;
|
|
30
|
-
this._destroy$ = new Subject();
|
|
31
|
-
}
|
|
32
|
-
ngOnInit() {
|
|
33
|
-
this.saveLabel = this._data.saveLabel;
|
|
34
|
-
this.discardLabel = this._data.discardLabel;
|
|
35
|
-
this.cancelLabel = this._data.cancelLabel;
|
|
36
|
-
this.message = this._data.message;
|
|
37
|
-
this.title = this._data.title;
|
|
38
|
-
}
|
|
39
|
-
save() {
|
|
40
|
-
this._dialogRef.close('save');
|
|
41
|
-
}
|
|
42
|
-
discard() {
|
|
43
|
-
this._dialogRef.close('discard');
|
|
44
|
-
}
|
|
45
|
-
cancel() {
|
|
46
|
-
this._dialogRef.close(null);
|
|
47
|
-
}
|
|
48
|
-
ngOnDestroy() {
|
|
49
|
-
this._destroy$.next();
|
|
50
|
-
this._destroy$.complete();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
ConfirmUnsavedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
54
|
-
ConfirmUnsavedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
55
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
56
|
-
type: Component,
|
|
57
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-dialog>\n <h1 mat-dialog-title>{{title}}</h1>\n <mat-dialog-content>\n {{message}}\n </mat-dialog-content> \n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n fsFormButtonStandalone\n mat-button>\n {{saveLabel}}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n fsFormButtonStandalone\n mat-button>\n {{discardLabel}}\n </button> \n <button\n type=\"button\"\n (click)=\"cancel()\"\n fsFormButtonStandalone\n mat-button>\n {{cancelLabel}}\n </button> \n </mat-dialog-actions>\n</fs-dialog>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
58
|
-
}], ctorParameters: function () {
|
|
59
|
-
return [{ type: undefined, decorators: [{
|
|
60
|
-
type: Inject,
|
|
61
|
-
args: [MAT_DIALOG_DATA]
|
|
62
|
-
}] }, { type: i1.MatDialogRef }];
|
|
26
|
+
class ConfirmUnsavedComponent {
|
|
27
|
+
constructor(_data, _dialogRef) {
|
|
28
|
+
this._data = _data;
|
|
29
|
+
this._dialogRef = _dialogRef;
|
|
30
|
+
this._destroy$ = new Subject();
|
|
31
|
+
}
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
this.saveLabel = this._data.saveLabel;
|
|
34
|
+
this.discardLabel = this._data.discardLabel;
|
|
35
|
+
this.cancelLabel = this._data.cancelLabel;
|
|
36
|
+
this.message = this._data.message;
|
|
37
|
+
this.title = this._data.title;
|
|
38
|
+
}
|
|
39
|
+
save() {
|
|
40
|
+
this._dialogRef.close('save');
|
|
41
|
+
}
|
|
42
|
+
discard() {
|
|
43
|
+
this._dialogRef.close('discard');
|
|
44
|
+
}
|
|
45
|
+
cancel() {
|
|
46
|
+
this._dialogRef.close(null);
|
|
47
|
+
}
|
|
48
|
+
ngOnDestroy() {
|
|
49
|
+
this._destroy$.next();
|
|
50
|
+
this._destroy$.complete();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
ConfirmUnsavedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ConfirmUnsavedComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
54
|
+
ConfirmUnsavedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ConfirmUnsavedComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>{{title}}</h1>\n <mat-dialog-content>\n {{message}}\n </mat-dialog-content> \n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n fsFormButtonStandalone\n mat-button>\n {{saveLabel}}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n fsFormButtonStandalone\n mat-button>\n {{discardLabel}}\n </button> \n <button\n type=\"button\"\n (click)=\"cancel()\"\n fsFormButtonStandalone\n mat-button>\n {{cancelLabel}}\n </button> \n </mat-dialog-actions>\n</fs-dialog>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], dependencies: [{ kind: "component", type: i1$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ConfirmUnsavedComponent, decorators: [{
|
|
56
|
+
type: Component,
|
|
57
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-dialog>\n <h1 mat-dialog-title>{{title}}</h1>\n <mat-dialog-content>\n {{message}}\n </mat-dialog-content> \n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n fsFormButtonStandalone\n mat-button>\n {{saveLabel}}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n fsFormButtonStandalone\n mat-button>\n {{discardLabel}}\n </button> \n <button\n type=\"button\"\n (click)=\"cancel()\"\n fsFormButtonStandalone\n mat-button>\n {{cancelLabel}}\n </button> \n </mat-dialog-actions>\n</fs-dialog>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
58
|
+
}], ctorParameters: function () {
|
|
59
|
+
return [{ type: undefined, decorators: [{
|
|
60
|
+
type: Inject,
|
|
61
|
+
args: [MAT_DIALOG_DATA]
|
|
62
|
+
}] }, { type: i1.MatDialogRef }];
|
|
63
63
|
} });
|
|
64
64
|
|
|
65
|
-
var ConfirmResult;
|
|
66
|
-
(function (ConfirmResult) {
|
|
67
|
-
ConfirmResult["Save"] = "save";
|
|
68
|
-
ConfirmResult["Discard"] = "discard";
|
|
69
|
-
ConfirmResult["Review"] = "review";
|
|
70
|
-
ConfirmResult["Invalid"] = "invalid";
|
|
71
|
-
ConfirmResult["Pristine"] = "pristine";
|
|
65
|
+
var ConfirmResult;
|
|
66
|
+
(function (ConfirmResult) {
|
|
67
|
+
ConfirmResult["Save"] = "save";
|
|
68
|
+
ConfirmResult["Discard"] = "discard";
|
|
69
|
+
ConfirmResult["Review"] = "review";
|
|
70
|
+
ConfirmResult["Invalid"] = "invalid";
|
|
71
|
+
ConfirmResult["Pristine"] = "pristine";
|
|
72
72
|
})(ConfirmResult || (ConfirmResult = {}));
|
|
73
73
|
|
|
74
|
-
function confirmResultContinue(result) {
|
|
75
|
-
return result === ConfirmResult.Discard || result === ConfirmResult.Save || result === ConfirmResult.Pristine;
|
|
74
|
+
function confirmResultContinue(result) {
|
|
75
|
+
return result === ConfirmResult.Discard || result === ConfirmResult.Save || result === ConfirmResult.Pristine;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
function getActiveRoute(route) {
|
|
79
|
-
while (route.firstChild) {
|
|
80
|
-
route = route.firstChild;
|
|
81
|
-
}
|
|
82
|
-
return route;
|
|
78
|
+
function getActiveRoute(route) {
|
|
79
|
+
while (route.firstChild) {
|
|
80
|
+
route = route.firstChild;
|
|
81
|
+
}
|
|
82
|
+
return route;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
var FormStatus;
|
|
86
|
-
(function (FormStatus) {
|
|
87
|
-
FormStatus["Valid"] = "valid";
|
|
88
|
-
FormStatus["Invalid"] = "invalid";
|
|
89
|
-
FormStatus["Validating"] = "validating";
|
|
90
|
-
FormStatus["Submitting"] = "submitting";
|
|
91
|
-
FormStatus["Submitted"] = "submitted";
|
|
92
|
-
FormStatus["Error"] = "error";
|
|
93
|
-
FormStatus["Success"] = "success";
|
|
94
|
-
FormStatus["Completing"] = "completing";
|
|
85
|
+
var FormStatus;
|
|
86
|
+
(function (FormStatus) {
|
|
87
|
+
FormStatus["Valid"] = "valid";
|
|
88
|
+
FormStatus["Invalid"] = "invalid";
|
|
89
|
+
FormStatus["Validating"] = "validating";
|
|
90
|
+
FormStatus["Submitting"] = "submitting";
|
|
91
|
+
FormStatus["Submitted"] = "submitted";
|
|
92
|
+
FormStatus["Error"] = "error";
|
|
93
|
+
FormStatus["Success"] = "success";
|
|
94
|
+
FormStatus["Completing"] = "completing";
|
|
95
95
|
})(FormStatus || (FormStatus = {}));
|
|
96
96
|
|
|
97
|
-
class FsForm {
|
|
98
|
-
constructor(_dialog) {
|
|
99
|
-
this._dialog = _dialog;
|
|
100
|
-
// value is array for future possibilities of extension
|
|
101
|
-
this._formDirectiveStore = new WeakMap();
|
|
102
|
-
this._eventBus = new Subject();
|
|
103
|
-
}
|
|
104
|
-
// @deprecated
|
|
105
|
-
broadcast(key, data) {
|
|
106
|
-
this._eventBus.next({ key, data });
|
|
107
|
-
}
|
|
108
|
-
// @deprecated
|
|
109
|
-
on(key) {
|
|
110
|
-
return this._eventBus.asObservable()
|
|
111
|
-
.pipe(filter((event) => event.key === key), map((event) => event.data));
|
|
112
|
-
}
|
|
113
|
-
registerFormDirective(routeComponent, directive) {
|
|
114
|
-
const directives = this.getFormDirectives(routeComponent) || [];
|
|
115
|
-
directives.push(directive);
|
|
116
|
-
this._formDirectiveStore.set(routeComponent, directives);
|
|
117
|
-
}
|
|
118
|
-
getFormDirectives(routeComponent) {
|
|
119
|
-
return this._formDirectiveStore.get(routeComponent);
|
|
120
|
-
}
|
|
121
|
-
removeFormDirective(routeComponent) {
|
|
122
|
-
this._formDirectiveStore.delete(routeComponent);
|
|
123
|
-
}
|
|
124
|
-
confirmUnsaved(directives) {
|
|
125
|
-
// TODO support for multiple directives per page
|
|
126
|
-
const form = directives[0];
|
|
127
|
-
if (!form.confirm || !form.ngForm.dirty) {
|
|
128
|
-
return of(ConfirmResult.Pristine);
|
|
129
|
-
}
|
|
130
|
-
let title = 'You Have Unsaved Changes';
|
|
131
|
-
let message = 'What would you like to do with your changes?';
|
|
132
|
-
let saveLabel = 'Save & Continue';
|
|
133
|
-
let discardLabel = 'Discard Changes & Continue';
|
|
134
|
-
let cancelLabel = 'Review Changes';
|
|
135
|
-
if (typeof form.confirm === 'object') {
|
|
136
|
-
title = form.confirm.title || title;
|
|
137
|
-
message = form.confirm.message || message;
|
|
138
|
-
saveLabel = form.confirm.saveLabel || saveLabel;
|
|
139
|
-
discardLabel = form.confirm.discardLabel || discardLabel;
|
|
140
|
-
cancelLabel = form.confirm.cancelLabel || cancelLabel;
|
|
141
|
-
}
|
|
142
|
-
return this._dialog.open(ConfirmUnsavedComponent, {
|
|
143
|
-
data: {
|
|
144
|
-
title,
|
|
145
|
-
message,
|
|
146
|
-
saveLabel,
|
|
147
|
-
discardLabel,
|
|
148
|
-
cancelLabel,
|
|
149
|
-
},
|
|
150
|
-
width: 'auto',
|
|
151
|
-
})
|
|
152
|
-
.afterClosed()
|
|
153
|
-
.pipe(switchMap((result) => {
|
|
154
|
-
if (!result) {
|
|
155
|
-
return of(ConfirmResult.Review);
|
|
156
|
-
}
|
|
157
|
-
if (result === 'discard') {
|
|
158
|
-
form.reset();
|
|
159
|
-
return of(ConfirmResult.Discard);
|
|
160
|
-
}
|
|
161
|
-
if (result === 'save') {
|
|
162
|
-
form.ngForm.control.markAsPristine();
|
|
163
|
-
form.triggerSubmit({ confirmed: true });
|
|
164
|
-
return merge(form.submitted
|
|
165
|
-
.pipe(first(), mapTo(ConfirmResult.Save)), form.invalid
|
|
166
|
-
.pipe(first(), mapTo(ConfirmResult.Invalid)))
|
|
167
|
-
.pipe(take(1));
|
|
168
|
-
}
|
|
169
|
-
}));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
FsForm.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
173
|
-
FsForm.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
175
|
-
type: Injectable,
|
|
176
|
-
args: [{
|
|
177
|
-
providedIn: 'root',
|
|
178
|
-
}]
|
|
97
|
+
class FsForm {
|
|
98
|
+
constructor(_dialog) {
|
|
99
|
+
this._dialog = _dialog;
|
|
100
|
+
// value is array for future possibilities of extension
|
|
101
|
+
this._formDirectiveStore = new WeakMap();
|
|
102
|
+
this._eventBus = new Subject();
|
|
103
|
+
}
|
|
104
|
+
// @deprecated
|
|
105
|
+
broadcast(key, data) {
|
|
106
|
+
this._eventBus.next({ key, data });
|
|
107
|
+
}
|
|
108
|
+
// @deprecated
|
|
109
|
+
on(key) {
|
|
110
|
+
return this._eventBus.asObservable()
|
|
111
|
+
.pipe(filter((event) => event.key === key), map((event) => event.data));
|
|
112
|
+
}
|
|
113
|
+
registerFormDirective(routeComponent, directive) {
|
|
114
|
+
const directives = this.getFormDirectives(routeComponent) || [];
|
|
115
|
+
directives.push(directive);
|
|
116
|
+
this._formDirectiveStore.set(routeComponent, directives);
|
|
117
|
+
}
|
|
118
|
+
getFormDirectives(routeComponent) {
|
|
119
|
+
return this._formDirectiveStore.get(routeComponent);
|
|
120
|
+
}
|
|
121
|
+
removeFormDirective(routeComponent) {
|
|
122
|
+
this._formDirectiveStore.delete(routeComponent);
|
|
123
|
+
}
|
|
124
|
+
confirmUnsaved(directives) {
|
|
125
|
+
// TODO support for multiple directives per page
|
|
126
|
+
const form = directives[0];
|
|
127
|
+
if (!form.confirm || !form.ngForm.dirty) {
|
|
128
|
+
return of(ConfirmResult.Pristine);
|
|
129
|
+
}
|
|
130
|
+
let title = 'You Have Unsaved Changes';
|
|
131
|
+
let message = 'What would you like to do with your changes?';
|
|
132
|
+
let saveLabel = 'Save & Continue';
|
|
133
|
+
let discardLabel = 'Discard Changes & Continue';
|
|
134
|
+
let cancelLabel = 'Review Changes';
|
|
135
|
+
if (typeof form.confirm === 'object') {
|
|
136
|
+
title = form.confirm.title || title;
|
|
137
|
+
message = form.confirm.message || message;
|
|
138
|
+
saveLabel = form.confirm.saveLabel || saveLabel;
|
|
139
|
+
discardLabel = form.confirm.discardLabel || discardLabel;
|
|
140
|
+
cancelLabel = form.confirm.cancelLabel || cancelLabel;
|
|
141
|
+
}
|
|
142
|
+
return this._dialog.open(ConfirmUnsavedComponent, {
|
|
143
|
+
data: {
|
|
144
|
+
title,
|
|
145
|
+
message,
|
|
146
|
+
saveLabel,
|
|
147
|
+
discardLabel,
|
|
148
|
+
cancelLabel,
|
|
149
|
+
},
|
|
150
|
+
width: 'auto',
|
|
151
|
+
})
|
|
152
|
+
.afterClosed()
|
|
153
|
+
.pipe(switchMap((result) => {
|
|
154
|
+
if (!result) {
|
|
155
|
+
return of(ConfirmResult.Review);
|
|
156
|
+
}
|
|
157
|
+
if (result === 'discard') {
|
|
158
|
+
form.reset();
|
|
159
|
+
return of(ConfirmResult.Discard);
|
|
160
|
+
}
|
|
161
|
+
if (result === 'save') {
|
|
162
|
+
form.ngForm.control.markAsPristine();
|
|
163
|
+
form.triggerSubmit({ confirmed: true });
|
|
164
|
+
return merge(form.submitted
|
|
165
|
+
.pipe(first(), mapTo(ConfirmResult.Save)), form.invalid
|
|
166
|
+
.pipe(first(), mapTo(ConfirmResult.Invalid)))
|
|
167
|
+
.pipe(take(1));
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
FsForm.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsForm, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
173
|
+
FsForm.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsForm, providedIn: 'root' });
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsForm, decorators: [{
|
|
175
|
+
type: Injectable,
|
|
176
|
+
args: [{
|
|
177
|
+
providedIn: 'root',
|
|
178
|
+
}]
|
|
179
179
|
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
|
|
180
180
|
|
|
181
|
-
class FormDeactivateGuard {
|
|
182
|
-
constructor(_form, _route) {
|
|
183
|
-
this._form = _form;
|
|
184
|
-
this._route = _route;
|
|
185
|
-
}
|
|
186
|
-
canDeactivate() {
|
|
187
|
-
const route = getActiveRoute(this._route);
|
|
188
|
-
if (!route) {
|
|
189
|
-
console.error('Can not find route for FormDeactivateGuard checks');
|
|
190
|
-
return of(true);
|
|
191
|
-
}
|
|
192
|
-
const directives = this._form
|
|
193
|
-
.getFormDirectives(route.routeConfig.component);
|
|
194
|
-
if (!Array.isArray(directives) || directives.length === 0) {
|
|
195
|
-
console.error('Can not find a valid FsFormDirective');
|
|
196
|
-
return of(true);
|
|
197
|
-
}
|
|
198
|
-
return this._form.confirmUnsaved(directives)
|
|
199
|
-
.pipe(map((result) => {
|
|
200
|
-
return confirmResultContinue(result);
|
|
201
|
-
}));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
FormDeactivateGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
205
|
-
FormDeactivateGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
206
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
207
|
-
type: Injectable,
|
|
208
|
-
args: [{
|
|
209
|
-
providedIn: 'root',
|
|
210
|
-
}]
|
|
211
|
-
}], ctorParameters: function () { return [{ type: FsForm }, { type: i2
|
|
181
|
+
class FormDeactivateGuard {
|
|
182
|
+
constructor(_form, _route) {
|
|
183
|
+
this._form = _form;
|
|
184
|
+
this._route = _route;
|
|
185
|
+
}
|
|
186
|
+
canDeactivate() {
|
|
187
|
+
const route = getActiveRoute(this._route);
|
|
188
|
+
if (!route) {
|
|
189
|
+
console.error('Can not find route for FormDeactivateGuard checks');
|
|
190
|
+
return of(true);
|
|
191
|
+
}
|
|
192
|
+
const directives = this._form
|
|
193
|
+
.getFormDirectives(route.routeConfig.component);
|
|
194
|
+
if (!Array.isArray(directives) || directives.length === 0) {
|
|
195
|
+
console.error('Can not find a valid FsFormDirective');
|
|
196
|
+
return of(true);
|
|
197
|
+
}
|
|
198
|
+
return this._form.confirmUnsaved(directives)
|
|
199
|
+
.pipe(map((result) => {
|
|
200
|
+
return confirmResultContinue(result);
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
FormDeactivateGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormDeactivateGuard, deps: [{ token: FsForm }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
205
|
+
FormDeactivateGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormDeactivateGuard, providedIn: 'root' });
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormDeactivateGuard, decorators: [{
|
|
207
|
+
type: Injectable,
|
|
208
|
+
args: [{
|
|
209
|
+
providedIn: 'root',
|
|
210
|
+
}]
|
|
211
|
+
}], ctorParameters: function () { return [{ type: FsForm }, { type: i2.ActivatedRoute }]; } });
|
|
212
212
|
|
|
213
|
-
function getFormErrors(control, key) {
|
|
214
|
-
let errors = null;
|
|
215
|
-
if (control.invalid && control.errors) {
|
|
216
|
-
errors = {
|
|
217
|
-
[key]: Object.assign({}, control.errors),
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
if (control instanceof
|
|
221
|
-
Object.entries(control.controls)
|
|
222
|
-
.forEach(([name, childControl]) => {
|
|
223
|
-
const childErrors = getFormErrors(childControl, name);
|
|
224
|
-
if (childErrors) {
|
|
225
|
-
if (!errors) {
|
|
226
|
-
errors = Object.assign({}, childErrors);
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
Object.assign(errors, childErrors);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
return errors;
|
|
213
|
+
function getFormErrors(control, key) {
|
|
214
|
+
let errors = null;
|
|
215
|
+
if (control.invalid && control.errors) {
|
|
216
|
+
errors = {
|
|
217
|
+
[key]: Object.assign({}, control.errors),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
if (control instanceof UntypedFormGroup) {
|
|
221
|
+
Object.entries(control.controls)
|
|
222
|
+
.forEach(([name, childControl]) => {
|
|
223
|
+
const childErrors = getFormErrors(childControl, name);
|
|
224
|
+
if (childErrors) {
|
|
225
|
+
if (!errors) {
|
|
226
|
+
errors = Object.assign({}, childErrors);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
Object.assign(errors, childErrors);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return errors;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
class FsFormDirective {
|
|
238
|
-
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
|
|
239
|
-
this.ngForm = ngForm;
|
|
240
|
-
this._form = _form;
|
|
241
|
-
this._element = _element;
|
|
242
|
-
this._message = _message;
|
|
243
|
-
this._ngZone = _ngZone;
|
|
244
|
-
this._cdRef = _cdRef;
|
|
245
|
-
this._dialogRef = _dialogRef;
|
|
246
|
-
this._drawerRef = _drawerRef;
|
|
247
|
-
this._route = _route;
|
|
248
|
-
this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
|
|
249
|
-
this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
|
|
250
|
-
this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
|
|
251
|
-
this.labelSelector = '.fs-form-label,.mat-form-field-label';
|
|
252
|
-
this.autocomplete = false;
|
|
253
|
-
this.shortcuts = true; // Ctrl + s
|
|
254
|
-
this.confirm = true;
|
|
255
|
-
this.confirmDialog = true;
|
|
256
|
-
this.confirmDrawer = true;
|
|
257
|
-
this.confirmBrowser = true;
|
|
258
|
-
this.confirmTabs = true;
|
|
259
|
-
this.dirtySubmitButton = true;
|
|
260
|
-
this.successDelay = 0;
|
|
261
|
-
this.errorDelay = 1000;
|
|
262
|
-
this.deactivationGuard = true;
|
|
263
|
-
this.submitEvent = new EventEmitter();
|
|
264
|
-
this.invalid = new EventEmitter();
|
|
265
|
-
this.valid = new EventEmitter();
|
|
266
|
-
this.submitted = new EventEmitter();
|
|
267
|
-
this.reseted = new EventEmitter();
|
|
268
|
-
this.cleared = new EventEmitter();
|
|
269
|
-
this.fsFormClass = true;
|
|
270
|
-
this._tabGroups = new QueryList();
|
|
271
|
-
this._buttons = new QueryList();
|
|
272
|
-
this._dialogBackdropEscape = false;
|
|
273
|
-
this._snapshot = {};
|
|
274
|
-
this._status$ = new BehaviorSubject(FormStatus.Valid);
|
|
275
|
-
this._destroy$ = new Subject();
|
|
276
|
-
this._confirmed = false;
|
|
277
|
-
this._submit$ = null;
|
|
278
|
-
}
|
|
279
|
-
set submit(submit$) {
|
|
280
|
-
this._submit$ = submit$;
|
|
281
|
-
}
|
|
282
|
-
get submit() {
|
|
283
|
-
return this._submit$;
|
|
284
|
-
}
|
|
285
|
-
get submitting() {
|
|
286
|
-
return this._status$.getValue() === FormStatus.Submitting;
|
|
287
|
-
}
|
|
288
|
-
get validating() {
|
|
289
|
-
return this._status$.getValue() === FormStatus.Validating;
|
|
290
|
-
}
|
|
291
|
-
get completing() {
|
|
292
|
-
return this._status$.getValue() === FormStatus.Completing;
|
|
293
|
-
}
|
|
294
|
-
get _submitEvent() {
|
|
295
|
-
return {
|
|
296
|
-
ngForm: this.ngForm,
|
|
297
|
-
submitter: this._submitter,
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
get _formValidState$() {
|
|
301
|
-
this._form.broadcast('valid', this._submitEvent);
|
|
302
|
-
this.submitEvent.emit(this._submitEvent);
|
|
303
|
-
this.valid.emit(this._submitEvent);
|
|
304
|
-
const submittedEvent = {
|
|
305
|
-
ngForm: this.ngForm,
|
|
306
|
-
submitter: this._submitter,
|
|
307
|
-
response: null,
|
|
308
|
-
};
|
|
309
|
-
const submit$ = this._submit$ ?
|
|
310
|
-
this._submit$(this._submitEvent) : of(submittedEvent);
|
|
311
|
-
return submit$
|
|
312
|
-
.pipe(map((response) => {
|
|
313
|
-
submittedEvent.response = response;
|
|
314
|
-
return submittedEvent;
|
|
315
|
-
}), takeUntil(this._destroy$));
|
|
316
|
-
}
|
|
317
|
-
get _formInvalidState$() {
|
|
318
|
-
this._form.broadcast('invalid', this._submitEvent);
|
|
319
|
-
if (this.invalid) {
|
|
320
|
-
this.invalid.emit(this._submitEvent);
|
|
321
|
-
}
|
|
322
|
-
const message = 'Please review errors highlighted in red';
|
|
323
|
-
this._message.error(message, { mode: MessageMode.Toast });
|
|
324
|
-
const el = this._element.nativeElement.querySelector('.ng-invalid');
|
|
325
|
-
if (el) {
|
|
326
|
-
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
327
|
-
}
|
|
328
|
-
return throwError('Form validation error');
|
|
329
|
-
}
|
|
330
|
-
get _submitter() {
|
|
331
|
-
return this._activeSubmitButton
|
|
332
|
-
? this._activeSubmitButton.name
|
|
333
|
-
: null;
|
|
334
|
-
}
|
|
335
|
-
ngOnInit() {
|
|
336
|
-
if (this.deactivationGuard) {
|
|
337
|
-
this._registerCanDeactivateGuard();
|
|
338
|
-
}
|
|
339
|
-
this._registerConfirmDialogBackdropEscape();
|
|
340
|
-
this._listenHotKeys();
|
|
341
|
-
this._listenWindowClose();
|
|
342
|
-
this._listenSubmit();
|
|
343
|
-
this._listenFormStatus();
|
|
344
|
-
if (!this.autocomplete) {
|
|
345
|
-
this._registerAutocomplete();
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
ngOnChanges(changes) {
|
|
349
|
-
if (changes.confirm) {
|
|
350
|
-
this._updateDirtySubmitButtons();
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
clearSubmit() {
|
|
354
|
-
this._submit$ = null;
|
|
355
|
-
setTimeout(() => {
|
|
356
|
-
this._cdRef.markForCheck();
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
registerSubmit(submit$) {
|
|
360
|
-
this._submit$ = submit$;
|
|
361
|
-
setTimeout(() => {
|
|
362
|
-
this._cdRef.markForCheck();
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
ngAfterContentInit() {
|
|
366
|
-
this._registerConfirm();
|
|
367
|
-
this._registerConfirmDrawerClose();
|
|
368
|
-
this._registerConfirmTabs();
|
|
369
|
-
this._registerDrawerClose();
|
|
370
|
-
this._registerDirtySubmitButton();
|
|
371
|
-
}
|
|
372
|
-
ngOnDestroy() {
|
|
373
|
-
this._cleanupCanDeactivate();
|
|
374
|
-
this._destroy$.next();
|
|
375
|
-
this._destroy$.complete();
|
|
376
|
-
}
|
|
377
|
-
createSnapshot() {
|
|
378
|
-
this._snapshot = this.ngForm.value;
|
|
379
|
-
}
|
|
380
|
-
getSnapshot() {
|
|
381
|
-
return this._snapshot || {};
|
|
382
|
-
}
|
|
383
|
-
reset() {
|
|
384
|
-
this.ngForm.resetForm();
|
|
385
|
-
Object.keys(this.ngForm.controls)
|
|
386
|
-
.forEach((name) => {
|
|
387
|
-
const control = this.ngForm.controls[name];
|
|
388
|
-
control.reset(this._snapshot[name]);
|
|
389
|
-
});
|
|
390
|
-
this.reseted.emit();
|
|
391
|
-
}
|
|
392
|
-
clear() {
|
|
393
|
-
this.ngForm.resetForm();
|
|
394
|
-
this.cleared.emit();
|
|
395
|
-
}
|
|
396
|
-
dirty() {
|
|
397
|
-
this.ngForm.form.markAsDirty();
|
|
398
|
-
this._updateDirtySubmitButtons();
|
|
399
|
-
}
|
|
400
|
-
triggerSubmit(options) {
|
|
401
|
-
this._confirmed = options === null || options === void 0 ? void 0 : options.confirmed;
|
|
402
|
-
this.ngForm.ngSubmit.emit();
|
|
403
|
-
}
|
|
404
|
-
triggerConfirm() {
|
|
405
|
-
const submitted = this.submitting ? this.submitted.asObservable() : of({});
|
|
406
|
-
return submitted
|
|
407
|
-
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved([this])));
|
|
408
|
-
}
|
|
409
|
-
enable() {
|
|
410
|
-
this.ngForm.control.enable();
|
|
411
|
-
this._updateDirtySubmitButtons();
|
|
412
|
-
}
|
|
413
|
-
disable() {
|
|
414
|
-
this.ngForm.control.disable();
|
|
415
|
-
this._buttons.forEach((button) => {
|
|
416
|
-
button.disable();
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
addButton(button) {
|
|
420
|
-
this._buttons.reset([
|
|
421
|
-
...this._buttons.toArray(),
|
|
422
|
-
button,
|
|
423
|
-
]);
|
|
424
|
-
}
|
|
425
|
-
removeButton(button) {
|
|
426
|
-
this._buttons.reset([
|
|
427
|
-
...this._buttons.toArray()
|
|
428
|
-
.filter((item) => (button !== item)),
|
|
429
|
-
]);
|
|
430
|
-
}
|
|
431
|
-
validate() {
|
|
432
|
-
Object.values(this.ngForm.controls)
|
|
433
|
-
.forEach((control) => {
|
|
434
|
-
control.markAsDirty();
|
|
435
|
-
control.markAsTouched();
|
|
436
|
-
control.updateValueAndValidity();
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
_listenSubmit() {
|
|
440
|
-
this.ngForm
|
|
441
|
-
.ngSubmit
|
|
442
|
-
.pipe(tap((event) => {
|
|
443
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
444
|
-
}), map((event) => {
|
|
445
|
-
return { event, confirmed: this._confirmed };
|
|
446
|
-
}), tap(() => this._confirmed = false), filter(() => {
|
|
447
|
-
return [FormStatus.Valid, FormStatus.Invalid]
|
|
448
|
-
.includes(this._status$.getValue());
|
|
449
|
-
}), tap(() => this._broadcasValidatingEvents()), tap(() => this.validate()), tap(() => this._broadcastSubmittingEvents()), switchMap((data) => this._waitUntilStatusPending()
|
|
450
|
-
.pipe(mapTo(data))), tap(() => this._setupActiveSubmitButton()), tap(() => this._disableButtons()), mergeMap((data) => {
|
|
451
|
-
if (this.ngForm.status === 'INVALID') {
|
|
452
|
-
return this._formInvalidState$;
|
|
453
|
-
}
|
|
454
|
-
return this._formValidState$
|
|
455
|
-
.pipe(map((submitEvent) => (Object.assign(Object.assign({}, submitEvent), { confirmed: data.confirmed }))));
|
|
456
|
-
}), catchError((e, source$) => {
|
|
457
|
-
this._handleError(e);
|
|
458
|
-
return source$;
|
|
459
|
-
}), tap((submittedEvent) => {
|
|
460
|
-
this._completeSubmit(true, submittedEvent);
|
|
461
|
-
}), takeUntil(this._destroy$))
|
|
462
|
-
.subscribe();
|
|
463
|
-
}
|
|
464
|
-
_listenFormStatus() {
|
|
465
|
-
this._status$
|
|
466
|
-
.pipe(takeUntil(this._destroy$))
|
|
467
|
-
.subscribe((formStatus) => {
|
|
468
|
-
const cls = [FormStatus.Submitting, FormStatus.Validating];
|
|
469
|
-
const classList = this._element.nativeElement.classList;
|
|
470
|
-
classList.remove(...cls);
|
|
471
|
-
if (cls.indexOf(formStatus) !== -1) {
|
|
472
|
-
classList.add(formStatus);
|
|
473
|
-
}
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
_listenWindowClose() {
|
|
477
|
-
fromEvent(window, 'beforeunload')
|
|
478
|
-
.pipe(takeUntil(this._destroy$))
|
|
479
|
-
.subscribe((event) => {
|
|
480
|
-
if (this.confirm && this.confirmBrowser && this.ngForm.dirty) {
|
|
481
|
-
event.returnValue = false;
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
_activeDialog(el, dialog) {
|
|
486
|
-
if (el.isSameNode(dialog)) {
|
|
487
|
-
return true;
|
|
488
|
-
}
|
|
489
|
-
else if (el.parentElement) {
|
|
490
|
-
return this._activeDialog(el.parentElement, dialog);
|
|
491
|
-
}
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
494
|
-
_listenHotKeys() {
|
|
495
|
-
this._ngZone.runOutsideAngular(() => {
|
|
496
|
-
fromEvent(document, 'keydown')
|
|
497
|
-
.pipe(takeUntil(this._destroy$))
|
|
498
|
-
.subscribe((event) => {
|
|
499
|
-
if (this._dialogBackdropEscape && event.code === 'Escape') {
|
|
500
|
-
const cdkOverlayPane = Array
|
|
501
|
-
.from(document.querySelectorAll('.cdk-overlay-pane')).pop();
|
|
502
|
-
const activeDialog = this
|
|
503
|
-
._activeDialog(document.getElementById(this._dialogRef.id), cdkOverlayPane);
|
|
504
|
-
if (activeDialog) {
|
|
505
|
-
this._ngZone.run(() => {
|
|
506
|
-
this._formClose();
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
|
|
511
|
-
event.preventDefault();
|
|
512
|
-
if (this.shortcuts) {
|
|
513
|
-
if (this._elementInForm(document.activeElement)) {
|
|
514
|
-
this.ngForm.ngSubmit.next();
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
_formClose() {
|
|
522
|
-
if (this.confirm && this.confirmDialog) {
|
|
523
|
-
this.triggerConfirm()
|
|
524
|
-
.pipe(filter((result) => confirmResultContinue(result)), switchMap((result) => {
|
|
525
|
-
return result === ConfirmResult.Pristine || result === ConfirmResult.Discard
|
|
526
|
-
? of(null)
|
|
527
|
-
: this.submitted.asObservable();
|
|
528
|
-
}), takeUntil(this._destroy$))
|
|
529
|
-
.subscribe((result) => {
|
|
530
|
-
this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
this._dialogRef.close(null);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
_getActiveSubmitButton() {
|
|
538
|
-
const submitButtons = this._buttons
|
|
539
|
-
.filter((button) => button.submit);
|
|
540
|
-
const activeButton = submitButtons
|
|
541
|
-
.find((button) => {
|
|
542
|
-
return button.active;
|
|
543
|
-
});
|
|
544
|
-
return activeButton ? activeButton : submitButtons[0];
|
|
545
|
-
}
|
|
546
|
-
_elementInForm(el) {
|
|
547
|
-
if (el.isSameNode(this._element.nativeElement)) {
|
|
548
|
-
return true;
|
|
549
|
-
}
|
|
550
|
-
else if (el.parentElement) {
|
|
551
|
-
return this._elementInForm(el.parentElement);
|
|
552
|
-
}
|
|
553
|
-
return false;
|
|
554
|
-
}
|
|
555
|
-
_completeSubmit(success, submitEvent) {
|
|
556
|
-
if (success) {
|
|
557
|
-
this.ngForm.control.markAsPristine();
|
|
558
|
-
this.createSnapshot();
|
|
559
|
-
this.submitted.emit(submitEvent);
|
|
560
|
-
}
|
|
561
|
-
else {
|
|
562
|
-
this._resetButtons();
|
|
563
|
-
}
|
|
564
|
-
if (this._activeSubmitButton) {
|
|
565
|
-
if (success) {
|
|
566
|
-
this._activeSubmitButton.success();
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
this._activeSubmitButton.error();
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
this._status$.next(FormStatus.Submitted);
|
|
573
|
-
if (success) {
|
|
574
|
-
this._status$.next(FormStatus.Success);
|
|
575
|
-
}
|
|
576
|
-
else {
|
|
577
|
-
this._status$.next(FormStatus.Error);
|
|
578
|
-
}
|
|
579
|
-
this._status$.next(FormStatus.Completing);
|
|
580
|
-
const resetDelay = success ? this.successDelay : this.errorDelay;
|
|
581
|
-
of(true)
|
|
582
|
-
.pipe(delay(resetDelay), first(), takeUntil(this._destroy$)).subscribe(() => {
|
|
583
|
-
if (this.ngForm.form.status === 'VALID') {
|
|
584
|
-
this._status$.next(FormStatus.Valid);
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
this._status$.next(FormStatus.Invalid);
|
|
588
|
-
}
|
|
589
|
-
this._resetButtons();
|
|
590
|
-
this._resetActiveButtons();
|
|
591
|
-
this._updateDirtySubmitButtons();
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
_resetButtons() {
|
|
595
|
-
this._buttons.forEach((button) => {
|
|
596
|
-
button.reset();
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
_resetActiveButtons() {
|
|
600
|
-
this._buttons.forEach((button) => {
|
|
601
|
-
button.resetActive();
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
_registerConfirm() {
|
|
605
|
-
this.ngForm.form.valueChanges
|
|
606
|
-
.pipe(takeUntil(this._destroy$))
|
|
607
|
-
.subscribe((changes) => {
|
|
608
|
-
if (this._dialogBackdropEscape && this._dialogRef) {
|
|
609
|
-
this._dialogRef.disableClose = true;
|
|
610
|
-
}
|
|
611
|
-
if (this.confirm) {
|
|
612
|
-
const existing = Object.keys(this._snapshot);
|
|
613
|
-
Object.keys(changes)
|
|
614
|
-
.forEach((name) => {
|
|
615
|
-
if (existing.indexOf(name) === -1) {
|
|
616
|
-
this._snapshot[name] = changes[name];
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
_registerDrawerClose() {
|
|
623
|
-
if (this._drawerRef) {
|
|
624
|
-
this._drawerRef.closeStart$
|
|
625
|
-
.pipe(takeUntil(this._destroy$))
|
|
626
|
-
.subscribe((subscriber) => {
|
|
627
|
-
if (this.submitting) {
|
|
628
|
-
this._status$
|
|
629
|
-
.pipe(filter((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this._destroy$))
|
|
630
|
-
.subscribe((status) => {
|
|
631
|
-
if (status === FormStatus.Success) {
|
|
632
|
-
subscriber.next();
|
|
633
|
-
subscriber.complete();
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
subscriber.error();
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
else {
|
|
641
|
-
subscriber.next();
|
|
642
|
-
subscriber.complete();
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
_registerConfirmDrawerClose() {
|
|
648
|
-
if (this._drawerRef) {
|
|
649
|
-
this._drawerRef.closeStart$
|
|
650
|
-
.pipe(switchMap((subscriber) => {
|
|
651
|
-
return iif(() => this.confirm && this.confirmDrawer, this.triggerConfirm()
|
|
652
|
-
.pipe(map((result) => confirmResultContinue(result)), tap((result) => {
|
|
653
|
-
if (result) {
|
|
654
|
-
subscriber.next();
|
|
655
|
-
subscriber.complete();
|
|
656
|
-
}
|
|
657
|
-
})), defer(() => {
|
|
658
|
-
subscriber.next();
|
|
659
|
-
subscriber.complete();
|
|
660
|
-
}));
|
|
661
|
-
}), takeUntil(this._destroy$))
|
|
662
|
-
.subscribe();
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
_registerConfirmTabs() {
|
|
666
|
-
if (this.tabGroup) {
|
|
667
|
-
this._registerConfirmTabGroup(this.tabGroup);
|
|
668
|
-
}
|
|
669
|
-
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
670
|
-
this._tabGroups.changes
|
|
671
|
-
.pipe(takeUntil(this._destroy$))
|
|
672
|
-
.subscribe(() => {
|
|
673
|
-
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
_registerConfirmTabGroups(tabGroups) {
|
|
677
|
-
tabGroups.forEach((tabGroup) => {
|
|
678
|
-
this._registerConfirmTabGroup(tabGroup);
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
_registerConfirmTabGroup(tabGroup) {
|
|
682
|
-
const confirmTabGroup = tabGroup;
|
|
683
|
-
if (!confirmTabGroup._originalHandleClick) {
|
|
684
|
-
confirmTabGroup._originalHandleClick = tabGroup._handleClick;
|
|
685
|
-
confirmTabGroup._handlClick$ = new Subject();
|
|
686
|
-
confirmTabGroup._handleClick = (tab, tabHeader, idx) => {
|
|
687
|
-
if (confirmTabGroup._handlClick$.observers.length) {
|
|
688
|
-
confirmTabGroup._handlClick$.next({ tab, tabHeader, idx });
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
confirmTabGroup._handlClick$
|
|
696
|
-
.pipe(
|
|
697
|
-
.
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
.
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
.
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
.
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
this._activeSubmitButton
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
console.log('
|
|
794
|
-
console.
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}
|
|
839
|
-
type:
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
type:
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
type: Input
|
|
851
|
-
}],
|
|
852
|
-
type: Input
|
|
853
|
-
}],
|
|
854
|
-
type: Input
|
|
855
|
-
}],
|
|
856
|
-
type: Input
|
|
857
|
-
}],
|
|
858
|
-
type: Input
|
|
859
|
-
}],
|
|
860
|
-
type: Input
|
|
861
|
-
}],
|
|
862
|
-
type: Input
|
|
863
|
-
}],
|
|
864
|
-
type: Input
|
|
865
|
-
}],
|
|
866
|
-
type: Input
|
|
867
|
-
}],
|
|
868
|
-
type: Input
|
|
869
|
-
}],
|
|
870
|
-
type: Input
|
|
871
|
-
}],
|
|
872
|
-
type: Input
|
|
873
|
-
}],
|
|
874
|
-
type: Input
|
|
875
|
-
}],
|
|
876
|
-
type: Input
|
|
877
|
-
}],
|
|
878
|
-
type: Input
|
|
879
|
-
}],
|
|
880
|
-
type: Input
|
|
881
|
-
}],
|
|
882
|
-
type:
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}],
|
|
887
|
-
type: Output
|
|
888
|
-
}],
|
|
889
|
-
type: Output
|
|
890
|
-
}],
|
|
891
|
-
type: Output
|
|
892
|
-
}],
|
|
893
|
-
type: Output
|
|
894
|
-
}],
|
|
895
|
-
type:
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
237
|
+
class FsFormDirective {
|
|
238
|
+
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
|
|
239
|
+
this.ngForm = ngForm;
|
|
240
|
+
this._form = _form;
|
|
241
|
+
this._element = _element;
|
|
242
|
+
this._message = _message;
|
|
243
|
+
this._ngZone = _ngZone;
|
|
244
|
+
this._cdRef = _cdRef;
|
|
245
|
+
this._dialogRef = _dialogRef;
|
|
246
|
+
this._drawerRef = _drawerRef;
|
|
247
|
+
this._route = _route;
|
|
248
|
+
this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
|
|
249
|
+
this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
|
|
250
|
+
this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
|
|
251
|
+
this.labelSelector = '.fs-form-label,.mat-form-field-label';
|
|
252
|
+
this.autocomplete = false;
|
|
253
|
+
this.shortcuts = true; // Ctrl + s
|
|
254
|
+
this.confirm = true;
|
|
255
|
+
this.confirmDialog = true;
|
|
256
|
+
this.confirmDrawer = true;
|
|
257
|
+
this.confirmBrowser = true;
|
|
258
|
+
this.confirmTabs = true;
|
|
259
|
+
this.dirtySubmitButton = true;
|
|
260
|
+
this.successDelay = 0;
|
|
261
|
+
this.errorDelay = 1000;
|
|
262
|
+
this.deactivationGuard = true;
|
|
263
|
+
this.submitEvent = new EventEmitter();
|
|
264
|
+
this.invalid = new EventEmitter();
|
|
265
|
+
this.valid = new EventEmitter();
|
|
266
|
+
this.submitted = new EventEmitter();
|
|
267
|
+
this.reseted = new EventEmitter();
|
|
268
|
+
this.cleared = new EventEmitter();
|
|
269
|
+
this.fsFormClass = true;
|
|
270
|
+
this._tabGroups = new QueryList();
|
|
271
|
+
this._buttons = new QueryList();
|
|
272
|
+
this._dialogBackdropEscape = false;
|
|
273
|
+
this._snapshot = {};
|
|
274
|
+
this._status$ = new BehaviorSubject(FormStatus.Valid);
|
|
275
|
+
this._destroy$ = new Subject();
|
|
276
|
+
this._confirmed = false;
|
|
277
|
+
this._submit$ = null;
|
|
278
|
+
}
|
|
279
|
+
set submit(submit$) {
|
|
280
|
+
this._submit$ = submit$;
|
|
281
|
+
}
|
|
282
|
+
get submit() {
|
|
283
|
+
return this._submit$;
|
|
284
|
+
}
|
|
285
|
+
get submitting() {
|
|
286
|
+
return this._status$.getValue() === FormStatus.Submitting;
|
|
287
|
+
}
|
|
288
|
+
get validating() {
|
|
289
|
+
return this._status$.getValue() === FormStatus.Validating;
|
|
290
|
+
}
|
|
291
|
+
get completing() {
|
|
292
|
+
return this._status$.getValue() === FormStatus.Completing;
|
|
293
|
+
}
|
|
294
|
+
get _submitEvent() {
|
|
295
|
+
return {
|
|
296
|
+
ngForm: this.ngForm,
|
|
297
|
+
submitter: this._submitter,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
get _formValidState$() {
|
|
301
|
+
this._form.broadcast('valid', this._submitEvent);
|
|
302
|
+
this.submitEvent.emit(this._submitEvent);
|
|
303
|
+
this.valid.emit(this._submitEvent);
|
|
304
|
+
const submittedEvent = {
|
|
305
|
+
ngForm: this.ngForm,
|
|
306
|
+
submitter: this._submitter,
|
|
307
|
+
response: null,
|
|
308
|
+
};
|
|
309
|
+
const submit$ = this._submit$ ?
|
|
310
|
+
this._submit$(this._submitEvent) : of(submittedEvent);
|
|
311
|
+
return submit$
|
|
312
|
+
.pipe(map((response) => {
|
|
313
|
+
submittedEvent.response = response;
|
|
314
|
+
return submittedEvent;
|
|
315
|
+
}), takeUntil(this._destroy$));
|
|
316
|
+
}
|
|
317
|
+
get _formInvalidState$() {
|
|
318
|
+
this._form.broadcast('invalid', this._submitEvent);
|
|
319
|
+
if (this.invalid) {
|
|
320
|
+
this.invalid.emit(this._submitEvent);
|
|
321
|
+
}
|
|
322
|
+
const message = 'Please review errors highlighted in red';
|
|
323
|
+
this._message.error(message, { mode: MessageMode.Toast });
|
|
324
|
+
const el = this._element.nativeElement.querySelector('.ng-invalid');
|
|
325
|
+
if (el) {
|
|
326
|
+
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
327
|
+
}
|
|
328
|
+
return throwError('Form validation error');
|
|
329
|
+
}
|
|
330
|
+
get _submitter() {
|
|
331
|
+
return this._activeSubmitButton
|
|
332
|
+
? this._activeSubmitButton.name
|
|
333
|
+
: null;
|
|
334
|
+
}
|
|
335
|
+
ngOnInit() {
|
|
336
|
+
if (this.deactivationGuard) {
|
|
337
|
+
this._registerCanDeactivateGuard();
|
|
338
|
+
}
|
|
339
|
+
this._registerConfirmDialogBackdropEscape();
|
|
340
|
+
this._listenHotKeys();
|
|
341
|
+
this._listenWindowClose();
|
|
342
|
+
this._listenSubmit();
|
|
343
|
+
this._listenFormStatus();
|
|
344
|
+
if (!this.autocomplete) {
|
|
345
|
+
this._registerAutocomplete();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
ngOnChanges(changes) {
|
|
349
|
+
if (changes.confirm) {
|
|
350
|
+
this._updateDirtySubmitButtons();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
clearSubmit() {
|
|
354
|
+
this._submit$ = null;
|
|
355
|
+
setTimeout(() => {
|
|
356
|
+
this._cdRef.markForCheck();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
registerSubmit(submit$) {
|
|
360
|
+
this._submit$ = submit$;
|
|
361
|
+
setTimeout(() => {
|
|
362
|
+
this._cdRef.markForCheck();
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
ngAfterContentInit() {
|
|
366
|
+
this._registerConfirm();
|
|
367
|
+
this._registerConfirmDrawerClose();
|
|
368
|
+
this._registerConfirmTabs();
|
|
369
|
+
this._registerDrawerClose();
|
|
370
|
+
this._registerDirtySubmitButton();
|
|
371
|
+
}
|
|
372
|
+
ngOnDestroy() {
|
|
373
|
+
this._cleanupCanDeactivate();
|
|
374
|
+
this._destroy$.next();
|
|
375
|
+
this._destroy$.complete();
|
|
376
|
+
}
|
|
377
|
+
createSnapshot() {
|
|
378
|
+
this._snapshot = this.ngForm.value;
|
|
379
|
+
}
|
|
380
|
+
getSnapshot() {
|
|
381
|
+
return this._snapshot || {};
|
|
382
|
+
}
|
|
383
|
+
reset() {
|
|
384
|
+
this.ngForm.resetForm();
|
|
385
|
+
Object.keys(this.ngForm.controls)
|
|
386
|
+
.forEach((name) => {
|
|
387
|
+
const control = this.ngForm.controls[name];
|
|
388
|
+
control.reset(this._snapshot[name]);
|
|
389
|
+
});
|
|
390
|
+
this.reseted.emit();
|
|
391
|
+
}
|
|
392
|
+
clear() {
|
|
393
|
+
this.ngForm.resetForm();
|
|
394
|
+
this.cleared.emit();
|
|
395
|
+
}
|
|
396
|
+
dirty() {
|
|
397
|
+
this.ngForm.form.markAsDirty();
|
|
398
|
+
this._updateDirtySubmitButtons();
|
|
399
|
+
}
|
|
400
|
+
triggerSubmit(options) {
|
|
401
|
+
this._confirmed = options === null || options === void 0 ? void 0 : options.confirmed;
|
|
402
|
+
this.ngForm.ngSubmit.emit();
|
|
403
|
+
}
|
|
404
|
+
triggerConfirm() {
|
|
405
|
+
const submitted = this.submitting ? this.submitted.asObservable() : of({});
|
|
406
|
+
return submitted
|
|
407
|
+
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved([this])));
|
|
408
|
+
}
|
|
409
|
+
enable() {
|
|
410
|
+
this.ngForm.control.enable();
|
|
411
|
+
this._updateDirtySubmitButtons();
|
|
412
|
+
}
|
|
413
|
+
disable() {
|
|
414
|
+
this.ngForm.control.disable();
|
|
415
|
+
this._buttons.forEach((button) => {
|
|
416
|
+
button.disable();
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
addButton(button) {
|
|
420
|
+
this._buttons.reset([
|
|
421
|
+
...this._buttons.toArray(),
|
|
422
|
+
button,
|
|
423
|
+
]);
|
|
424
|
+
}
|
|
425
|
+
removeButton(button) {
|
|
426
|
+
this._buttons.reset([
|
|
427
|
+
...this._buttons.toArray()
|
|
428
|
+
.filter((item) => (button !== item)),
|
|
429
|
+
]);
|
|
430
|
+
}
|
|
431
|
+
validate() {
|
|
432
|
+
Object.values(this.ngForm.controls)
|
|
433
|
+
.forEach((control) => {
|
|
434
|
+
control.markAsDirty();
|
|
435
|
+
control.markAsTouched();
|
|
436
|
+
control.updateValueAndValidity();
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
_listenSubmit() {
|
|
440
|
+
this.ngForm
|
|
441
|
+
.ngSubmit
|
|
442
|
+
.pipe(tap((event) => {
|
|
443
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
444
|
+
}), map((event) => {
|
|
445
|
+
return { event, confirmed: this._confirmed };
|
|
446
|
+
}), tap(() => this._confirmed = false), filter(() => {
|
|
447
|
+
return [FormStatus.Valid, FormStatus.Invalid]
|
|
448
|
+
.includes(this._status$.getValue());
|
|
449
|
+
}), tap(() => this._broadcasValidatingEvents()), tap(() => this.validate()), tap(() => this._broadcastSubmittingEvents()), switchMap((data) => this._waitUntilStatusPending()
|
|
450
|
+
.pipe(mapTo(data))), tap(() => this._setupActiveSubmitButton()), tap(() => this._disableButtons()), mergeMap((data) => {
|
|
451
|
+
if (this.ngForm.status === 'INVALID') {
|
|
452
|
+
return this._formInvalidState$;
|
|
453
|
+
}
|
|
454
|
+
return this._formValidState$
|
|
455
|
+
.pipe(map((submitEvent) => (Object.assign(Object.assign({}, submitEvent), { confirmed: data.confirmed }))));
|
|
456
|
+
}), catchError((e, source$) => {
|
|
457
|
+
this._handleError(e);
|
|
458
|
+
return source$;
|
|
459
|
+
}), tap((submittedEvent) => {
|
|
460
|
+
this._completeSubmit(true, submittedEvent);
|
|
461
|
+
}), takeUntil(this._destroy$))
|
|
462
|
+
.subscribe();
|
|
463
|
+
}
|
|
464
|
+
_listenFormStatus() {
|
|
465
|
+
this._status$
|
|
466
|
+
.pipe(takeUntil(this._destroy$))
|
|
467
|
+
.subscribe((formStatus) => {
|
|
468
|
+
const cls = [FormStatus.Submitting, FormStatus.Validating];
|
|
469
|
+
const classList = this._element.nativeElement.classList;
|
|
470
|
+
classList.remove(...cls);
|
|
471
|
+
if (cls.indexOf(formStatus) !== -1) {
|
|
472
|
+
classList.add(formStatus);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
_listenWindowClose() {
|
|
477
|
+
fromEvent(window, 'beforeunload')
|
|
478
|
+
.pipe(takeUntil(this._destroy$))
|
|
479
|
+
.subscribe((event) => {
|
|
480
|
+
if (this.confirm && this.confirmBrowser && this.ngForm.dirty) {
|
|
481
|
+
event.returnValue = false;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
_activeDialog(el, dialog) {
|
|
486
|
+
if (el.isSameNode(dialog)) {
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
else if (el.parentElement) {
|
|
490
|
+
return this._activeDialog(el.parentElement, dialog);
|
|
491
|
+
}
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
_listenHotKeys() {
|
|
495
|
+
this._ngZone.runOutsideAngular(() => {
|
|
496
|
+
fromEvent(document, 'keydown')
|
|
497
|
+
.pipe(takeUntil(this._destroy$))
|
|
498
|
+
.subscribe((event) => {
|
|
499
|
+
if (this._dialogBackdropEscape && event.code === 'Escape') {
|
|
500
|
+
const cdkOverlayPane = Array
|
|
501
|
+
.from(document.querySelectorAll('.cdk-overlay-pane')).pop();
|
|
502
|
+
const activeDialog = this
|
|
503
|
+
._activeDialog(document.getElementById(this._dialogRef.id), cdkOverlayPane);
|
|
504
|
+
if (activeDialog) {
|
|
505
|
+
this._ngZone.run(() => {
|
|
506
|
+
this._formClose();
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
|
|
511
|
+
event.preventDefault();
|
|
512
|
+
if (this.shortcuts) {
|
|
513
|
+
if (this._elementInForm(document.activeElement)) {
|
|
514
|
+
this.ngForm.ngSubmit.next();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
_formClose() {
|
|
522
|
+
if (this.confirm && this.confirmDialog) {
|
|
523
|
+
this.triggerConfirm()
|
|
524
|
+
.pipe(filter((result) => confirmResultContinue(result)), switchMap((result) => {
|
|
525
|
+
return result === ConfirmResult.Pristine || result === ConfirmResult.Discard
|
|
526
|
+
? of(null)
|
|
527
|
+
: this.submitted.asObservable();
|
|
528
|
+
}), takeUntil(this._destroy$))
|
|
529
|
+
.subscribe((result) => {
|
|
530
|
+
this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
this._dialogRef.close(null);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
_getActiveSubmitButton() {
|
|
538
|
+
const submitButtons = this._buttons
|
|
539
|
+
.filter((button) => button.submit);
|
|
540
|
+
const activeButton = submitButtons
|
|
541
|
+
.find((button) => {
|
|
542
|
+
return button.active;
|
|
543
|
+
});
|
|
544
|
+
return activeButton ? activeButton : submitButtons[0];
|
|
545
|
+
}
|
|
546
|
+
_elementInForm(el) {
|
|
547
|
+
if (el.isSameNode(this._element.nativeElement)) {
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
else if (el.parentElement) {
|
|
551
|
+
return this._elementInForm(el.parentElement);
|
|
552
|
+
}
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
_completeSubmit(success, submitEvent) {
|
|
556
|
+
if (success) {
|
|
557
|
+
this.ngForm.control.markAsPristine();
|
|
558
|
+
this.createSnapshot();
|
|
559
|
+
this.submitted.emit(submitEvent);
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
this._resetButtons();
|
|
563
|
+
}
|
|
564
|
+
if (this._activeSubmitButton) {
|
|
565
|
+
if (success) {
|
|
566
|
+
this._activeSubmitButton.success();
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
this._activeSubmitButton.error();
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
this._status$.next(FormStatus.Submitted);
|
|
573
|
+
if (success) {
|
|
574
|
+
this._status$.next(FormStatus.Success);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
this._status$.next(FormStatus.Error);
|
|
578
|
+
}
|
|
579
|
+
this._status$.next(FormStatus.Completing);
|
|
580
|
+
const resetDelay = success ? this.successDelay : this.errorDelay;
|
|
581
|
+
of(true)
|
|
582
|
+
.pipe(delay(resetDelay), first(), takeUntil(this._destroy$)).subscribe(() => {
|
|
583
|
+
if (this.ngForm.form.status === 'VALID') {
|
|
584
|
+
this._status$.next(FormStatus.Valid);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
this._status$.next(FormStatus.Invalid);
|
|
588
|
+
}
|
|
589
|
+
this._resetButtons();
|
|
590
|
+
this._resetActiveButtons();
|
|
591
|
+
this._updateDirtySubmitButtons();
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
_resetButtons() {
|
|
595
|
+
this._buttons.forEach((button) => {
|
|
596
|
+
button.reset();
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
_resetActiveButtons() {
|
|
600
|
+
this._buttons.forEach((button) => {
|
|
601
|
+
button.resetActive();
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
_registerConfirm() {
|
|
605
|
+
this.ngForm.form.valueChanges
|
|
606
|
+
.pipe(takeUntil(this._destroy$))
|
|
607
|
+
.subscribe((changes) => {
|
|
608
|
+
if (this._dialogBackdropEscape && this._dialogRef) {
|
|
609
|
+
this._dialogRef.disableClose = true;
|
|
610
|
+
}
|
|
611
|
+
if (this.confirm) {
|
|
612
|
+
const existing = Object.keys(this._snapshot);
|
|
613
|
+
Object.keys(changes)
|
|
614
|
+
.forEach((name) => {
|
|
615
|
+
if (existing.indexOf(name) === -1) {
|
|
616
|
+
this._snapshot[name] = changes[name];
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
_registerDrawerClose() {
|
|
623
|
+
if (this._drawerRef) {
|
|
624
|
+
this._drawerRef.closeStart$
|
|
625
|
+
.pipe(takeUntil(this._destroy$))
|
|
626
|
+
.subscribe((subscriber) => {
|
|
627
|
+
if (this.submitting) {
|
|
628
|
+
this._status$
|
|
629
|
+
.pipe(filter((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this._destroy$))
|
|
630
|
+
.subscribe((status) => {
|
|
631
|
+
if (status === FormStatus.Success) {
|
|
632
|
+
subscriber.next();
|
|
633
|
+
subscriber.complete();
|
|
634
|
+
}
|
|
635
|
+
else {
|
|
636
|
+
subscriber.error();
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
subscriber.next();
|
|
642
|
+
subscriber.complete();
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
_registerConfirmDrawerClose() {
|
|
648
|
+
if (this._drawerRef) {
|
|
649
|
+
this._drawerRef.closeStart$
|
|
650
|
+
.pipe(switchMap((subscriber) => {
|
|
651
|
+
return iif(() => this.confirm && this.confirmDrawer, this.triggerConfirm()
|
|
652
|
+
.pipe(map((result) => confirmResultContinue(result)), tap((result) => {
|
|
653
|
+
if (result) {
|
|
654
|
+
subscriber.next();
|
|
655
|
+
subscriber.complete();
|
|
656
|
+
}
|
|
657
|
+
})), defer(() => {
|
|
658
|
+
subscriber.next();
|
|
659
|
+
subscriber.complete();
|
|
660
|
+
}));
|
|
661
|
+
}), takeUntil(this._destroy$))
|
|
662
|
+
.subscribe();
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
_registerConfirmTabs() {
|
|
666
|
+
if (this.tabGroup) {
|
|
667
|
+
this._registerConfirmTabGroup(this.tabGroup);
|
|
668
|
+
}
|
|
669
|
+
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
670
|
+
this._tabGroups.changes
|
|
671
|
+
.pipe(takeUntil(this._destroy$))
|
|
672
|
+
.subscribe(() => {
|
|
673
|
+
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
_registerConfirmTabGroups(tabGroups) {
|
|
677
|
+
tabGroups.forEach((tabGroup) => {
|
|
678
|
+
this._registerConfirmTabGroup(tabGroup);
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
_registerConfirmTabGroup(tabGroup) {
|
|
682
|
+
const confirmTabGroup = tabGroup;
|
|
683
|
+
if (!confirmTabGroup._originalHandleClick) {
|
|
684
|
+
confirmTabGroup._originalHandleClick = tabGroup._handleClick;
|
|
685
|
+
confirmTabGroup._handlClick$ = new Subject();
|
|
686
|
+
confirmTabGroup._handleClick = (tab, tabHeader, idx) => {
|
|
687
|
+
if (confirmTabGroup._handlClick$.observers.length) {
|
|
688
|
+
confirmTabGroup._handlClick$.next({ tab, tabHeader, idx });
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
confirmTabGroup._handlClick$
|
|
696
|
+
.pipe(filter(() => !this.submitting), switchMap((event) => {
|
|
697
|
+
if (this.confirm && this.confirmTabs) {
|
|
698
|
+
return this.triggerConfirm()
|
|
699
|
+
.pipe(tap((result) => {
|
|
700
|
+
if (confirmResultContinue(result)) {
|
|
701
|
+
confirmTabGroup.selectedIndex = event.idx;
|
|
702
|
+
}
|
|
703
|
+
}));
|
|
704
|
+
}
|
|
705
|
+
confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
|
|
706
|
+
return of(null);
|
|
707
|
+
}), takeUntil(this._destroy$))
|
|
708
|
+
.subscribe();
|
|
709
|
+
}
|
|
710
|
+
_registerConfirmDialogBackdropEscape() {
|
|
711
|
+
var _a;
|
|
712
|
+
if (this._dialogRef) {
|
|
713
|
+
this._dialogBackdropEscape = !((_a = this._dialogRef) === null || _a === void 0 ? void 0 : _a.disableClose);
|
|
714
|
+
if (this._dialogBackdropEscape) {
|
|
715
|
+
this._dialogRef.backdropClick()
|
|
716
|
+
.pipe(takeUntil(this._destroy$))
|
|
717
|
+
.subscribe(() => {
|
|
718
|
+
this._formClose();
|
|
719
|
+
});
|
|
720
|
+
this._destroy$
|
|
721
|
+
.subscribe(() => {
|
|
722
|
+
this._dialogRef.disableClose = false;
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
_registerAutocomplete() {
|
|
728
|
+
this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
|
|
729
|
+
this.ngForm.form.registerControl = (name, control) => {
|
|
730
|
+
const el = this._element.nativeElement.querySelector(`input[name='${name}']`);
|
|
731
|
+
if (el) {
|
|
732
|
+
if (!el.getAttribute('autocomplete')) {
|
|
733
|
+
el.setAttribute('autocomplete', 'none');
|
|
734
|
+
el.setAttribute('name', `${name}-${guid()}`);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return this._registerControl(name, control);
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
_registerDirtySubmitButton() {
|
|
741
|
+
if (!this.ngForm) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
this.ngForm.form.valueChanges
|
|
745
|
+
.pipe(takeUntil(this._destroy$))
|
|
746
|
+
.subscribe(() => {
|
|
747
|
+
this._updateDirtySubmitButtons();
|
|
748
|
+
});
|
|
749
|
+
this._buttons.changes
|
|
750
|
+
.pipe(takeUntil(this._destroy$))
|
|
751
|
+
.subscribe(() => {
|
|
752
|
+
this._updateDirtySubmitButtons();
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
_updateDirtySubmitButtons() {
|
|
756
|
+
this._buttons
|
|
757
|
+
.filter((button) => button.submit)
|
|
758
|
+
.forEach((submitButton) => {
|
|
759
|
+
if (!this.confirm || !this.dirtySubmitButton || this.ngForm.dirty || !submitButton.dirtySubmit) {
|
|
760
|
+
submitButton.enable();
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
submitButton.disable();
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
_broadcastSubmittingEvents() {
|
|
768
|
+
this._status$.next(FormStatus.Submitting);
|
|
769
|
+
this._form.broadcast('submit', this.ngForm);
|
|
770
|
+
}
|
|
771
|
+
_broadcasValidatingEvents() {
|
|
772
|
+
this._status$.next(FormStatus.Validating);
|
|
773
|
+
}
|
|
774
|
+
_setupActiveSubmitButton() {
|
|
775
|
+
this._activeSubmitButton = this._getActiveSubmitButton();
|
|
776
|
+
this._resetButtons();
|
|
777
|
+
if (this._activeSubmitButton) {
|
|
778
|
+
this._activeSubmitButton.process();
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
_disableButtons() {
|
|
782
|
+
this._buttons.forEach((button) => {
|
|
783
|
+
button.disable();
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
_waitUntilStatusPending() {
|
|
787
|
+
return this.ngForm.statusChanges
|
|
788
|
+
.pipe(startWith(this.ngForm.status), first((state) => state !== 'PENDING'));
|
|
789
|
+
}
|
|
790
|
+
_handleError(e) {
|
|
791
|
+
console.log('%c Form Submit ', 'color: white; background-color: #D33F49', 'Error occured');
|
|
792
|
+
console.group('Error Details:');
|
|
793
|
+
console.log('Message: ', e);
|
|
794
|
+
console.log('FormRef: ', this);
|
|
795
|
+
if (this.ngForm.invalid) {
|
|
796
|
+
const errors = getFormErrors(this.ngForm.control, null);
|
|
797
|
+
console.log('Validation Errors: ', errors);
|
|
798
|
+
}
|
|
799
|
+
console.groupEnd();
|
|
800
|
+
this._completeSubmit(false, null);
|
|
801
|
+
}
|
|
802
|
+
_registerCanDeactivateGuard() {
|
|
803
|
+
this._activatedRouteConfig = getActiveRoute(this._route).routeConfig;
|
|
804
|
+
if (!this._activatedRouteConfig) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
this._form.registerFormDirective(this._activatedRouteConfig.component, this);
|
|
808
|
+
if (!Array.isArray(this._activatedRouteConfig.canDeactivate)) {
|
|
809
|
+
this._activatedRouteConfig.canDeactivate = [];
|
|
810
|
+
}
|
|
811
|
+
if (this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard) === -1) {
|
|
812
|
+
this._activatedRouteConfig.canDeactivate.push(FormDeactivateGuard);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
_cleanupCanDeactivate() {
|
|
816
|
+
if (!this._activatedRouteConfig) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const guardIndex = this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard);
|
|
820
|
+
this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
|
|
821
|
+
this._form.removeFormDirective(this._activatedRouteConfig.component);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
FsFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2$1.FsMessage }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: MatDialogRef, optional: true }, { token: DrawerRef, optional: true }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
|
|
825
|
+
FsFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", 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: "_tabGroups", predicate: MatTabGroup, descendants: true }], exportAs: ["fsForm"], usesOnChanges: true, ngImport: i0 });
|
|
826
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDirective, decorators: [{
|
|
827
|
+
type: Directive,
|
|
828
|
+
args: [{
|
|
829
|
+
selector: '[fsForm]',
|
|
830
|
+
exportAs: 'fsForm',
|
|
831
|
+
}]
|
|
832
|
+
}], ctorParameters: function () {
|
|
833
|
+
return [{ type: i1$2.NgForm, decorators: [{
|
|
834
|
+
type: Inject,
|
|
835
|
+
args: [NgForm]
|
|
836
|
+
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$1.FsMessage }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i1.MatDialogRef, decorators: [{
|
|
837
|
+
type: Optional
|
|
838
|
+
}, {
|
|
839
|
+
type: Inject,
|
|
840
|
+
args: [MatDialogRef]
|
|
841
|
+
}] }, { type: i6.DrawerRef, decorators: [{
|
|
842
|
+
type: Optional
|
|
843
|
+
}, {
|
|
844
|
+
type: Inject,
|
|
845
|
+
args: [DrawerRef]
|
|
846
|
+
}] }, { type: i2.ActivatedRoute }];
|
|
847
|
+
}, propDecorators: { wrapperSelector: [{
|
|
848
|
+
type: Input
|
|
849
|
+
}], messageSelector: [{
|
|
850
|
+
type: Input
|
|
851
|
+
}], hintSelector: [{
|
|
852
|
+
type: Input
|
|
853
|
+
}], labelSelector: [{
|
|
854
|
+
type: Input
|
|
855
|
+
}], autocomplete: [{
|
|
856
|
+
type: Input
|
|
857
|
+
}], shortcuts: [{
|
|
858
|
+
type: Input
|
|
859
|
+
}], confirm: [{
|
|
860
|
+
type: Input
|
|
861
|
+
}], confirmDialog: [{
|
|
862
|
+
type: Input
|
|
863
|
+
}], confirmDrawer: [{
|
|
864
|
+
type: Input
|
|
865
|
+
}], confirmBrowser: [{
|
|
866
|
+
type: Input
|
|
867
|
+
}], confirmTabs: [{
|
|
868
|
+
type: Input
|
|
869
|
+
}], dirtySubmitButton: [{
|
|
870
|
+
type: Input
|
|
871
|
+
}], submit: [{
|
|
872
|
+
type: Input
|
|
873
|
+
}], successDelay: [{
|
|
874
|
+
type: Input
|
|
875
|
+
}], errorDelay: [{
|
|
876
|
+
type: Input
|
|
877
|
+
}], tabGroup: [{
|
|
878
|
+
type: Input
|
|
879
|
+
}], deactivationGuard: [{
|
|
880
|
+
type: Input
|
|
881
|
+
}], submitEvent: [{
|
|
882
|
+
type: Output,
|
|
883
|
+
args: ['fsForm']
|
|
884
|
+
}], invalid: [{
|
|
885
|
+
type: Output
|
|
886
|
+
}], valid: [{
|
|
887
|
+
type: Output
|
|
888
|
+
}], submitted: [{
|
|
889
|
+
type: Output
|
|
890
|
+
}], reseted: [{
|
|
891
|
+
type: Output
|
|
892
|
+
}], cleared: [{
|
|
893
|
+
type: Output
|
|
894
|
+
}], fsFormClass: [{
|
|
895
|
+
type: HostBinding,
|
|
896
|
+
args: ['class.fs-form']
|
|
897
|
+
}], _tabGroups: [{
|
|
898
|
+
type: ContentChildren,
|
|
899
|
+
args: [MatTabGroup, { descendants: true }]
|
|
900
|
+
}] } });
|
|
901
|
+
|
|
902
|
+
class FsFormDialogCloseDirective {
|
|
903
|
+
constructor(_form, _dialogRef) {
|
|
904
|
+
this._form = _form;
|
|
905
|
+
this._dialogRef = _dialogRef;
|
|
906
|
+
this.type = 'button';
|
|
907
|
+
this._destroy$ = new Subject();
|
|
908
|
+
}
|
|
909
|
+
closeClick() {
|
|
910
|
+
if (this._form) {
|
|
911
|
+
this._form.triggerConfirm()
|
|
912
|
+
.pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
913
|
+
.subscribe(() => {
|
|
914
|
+
this._dialogRef.close(this.closeData);
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
this._dialogRef.close(this.closeData);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
ngOnDestroy() {
|
|
922
|
+
this._destroy$.next();
|
|
923
|
+
this._destroy$.complete();
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
FsFormDialogCloseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDialogCloseDirective, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
927
|
+
FsFormDialogCloseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: { closeData: "closeData" }, host: { listeners: { "click": "closeClick($event.target)" }, properties: { "attr.type": "this.type" } }, ngImport: i0 });
|
|
928
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDialogCloseDirective, decorators: [{
|
|
929
|
+
type: Directive,
|
|
930
|
+
args: [{
|
|
931
|
+
selector: '[fsFormDialogClose],[fs-form-dialog-close]',
|
|
932
|
+
}]
|
|
933
|
+
}], ctorParameters: function () {
|
|
934
|
+
return [{ type: FsFormDirective, decorators: [{
|
|
935
|
+
type: Optional
|
|
936
|
+
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
937
|
+
type: Optional
|
|
938
|
+
}] }];
|
|
939
|
+
}, propDecorators: { closeData: [{
|
|
940
|
+
type: Input
|
|
941
|
+
}], type: [{
|
|
942
|
+
type: HostBinding,
|
|
943
|
+
args: ['attr.type']
|
|
944
|
+
}], closeClick: [{
|
|
945
|
+
type: HostListener,
|
|
946
|
+
args: ['click', ['$event.target']]
|
|
902
947
|
}] } });
|
|
903
948
|
|
|
904
|
-
class FsButtonDirective {
|
|
905
|
-
constructor(_matButton, _form, _elementRef, _cdRef) {
|
|
906
|
-
this._matButton = _matButton;
|
|
907
|
-
this._form = _form;
|
|
908
|
-
this._elementRef = _elementRef;
|
|
909
|
-
this._cdRef = _cdRef;
|
|
910
|
-
this.dirtySubmit = true;
|
|
911
|
-
this.transitionStyle = null;
|
|
912
|
-
this.active = false;
|
|
913
|
-
this.submit = false;
|
|
914
|
-
this._previousDisabled = false;
|
|
915
|
-
this._destroy$ = new Subject();
|
|
916
|
-
}
|
|
917
|
-
ngOnInit() {
|
|
918
|
-
this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
|
|
919
|
-
this.form = this.form || this._form;
|
|
920
|
-
if (this.form) {
|
|
921
|
-
this.form.addButton(this);
|
|
922
|
-
if (this.submit) {
|
|
923
|
-
fromEvent(this.element, 'click')
|
|
924
|
-
.pipe(takeUntil(this._destroy$))
|
|
925
|
-
.subscribe(() => {
|
|
926
|
-
this.active = true;
|
|
927
|
-
});
|
|
928
|
-
if (this.dirtySubmit) {
|
|
929
|
-
if (this.form.dirtySubmitButton) {
|
|
930
|
-
if (!this.form.ngForm.dirty) {
|
|
931
|
-
this.disable();
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
this.transitionStyle = 'none';
|
|
936
|
-
setTimeout(() => {
|
|
937
|
-
this.transitionStyle = null;
|
|
938
|
-
}, 500);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
disable() {
|
|
943
|
-
if (this._matButton && !this.active) {
|
|
944
|
-
this._previousDisabled = this._matButton.disabled;
|
|
945
|
-
this._matButton.disabled = true;
|
|
946
|
-
this._cdRef.markForCheck();
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
enable() {
|
|
950
|
-
if (this._matButton) {
|
|
951
|
-
this._matButton.disabled = false;
|
|
952
|
-
this._matButton.disableRipple = true;
|
|
953
|
-
this._cdRef.markForCheck();
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
process() {
|
|
957
|
-
this.setClass('process');
|
|
958
|
-
if (this._matButton) {
|
|
959
|
-
this._matButton.disableRipple = true;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
success() {
|
|
963
|
-
this.setClass('success');
|
|
964
|
-
if (this._matButton) {
|
|
965
|
-
this._matButton.disableRipple = false;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
error() {
|
|
969
|
-
this.setClass('error');
|
|
970
|
-
if (this._matButton) {
|
|
971
|
-
this._matButton.disableRipple = false;
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
setClass(cls) {
|
|
975
|
-
const svg = this._getSvg(cls);
|
|
976
|
-
this._resetClass();
|
|
977
|
-
this._disableShadowAnimation();
|
|
978
|
-
this.element.classList.add(`submit-${cls}`);
|
|
979
|
-
this.element.append(svg);
|
|
980
|
-
}
|
|
981
|
-
get element() {
|
|
982
|
-
return this._elementRef.nativeElement;
|
|
983
|
-
}
|
|
984
|
-
resetActive() {
|
|
985
|
-
this.active = false;
|
|
986
|
-
}
|
|
987
|
-
reset() {
|
|
988
|
-
if (!this._previousDisabled) {
|
|
989
|
-
this.enable();
|
|
990
|
-
}
|
|
991
|
-
this.element.querySelectorAll('.svg-icon')
|
|
992
|
-
.forEach((el) => {
|
|
993
|
-
el.remove();
|
|
994
|
-
});
|
|
995
|
-
if (this._matButton) {
|
|
996
|
-
this._matButton.disableRipple = false;
|
|
997
|
-
}
|
|
998
|
-
this._resetClass();
|
|
999
|
-
}
|
|
1000
|
-
ngOnDestroy() {
|
|
1001
|
-
var _a;
|
|
1002
|
-
this._destroy$.next();
|
|
1003
|
-
this._destroy$.complete();
|
|
1004
|
-
(_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
|
|
1005
|
-
}
|
|
1006
|
-
_disableShadowAnimation() {
|
|
1007
|
-
// .mat-elevation-z2 removes the click shadow animation
|
|
1008
|
-
//this.element.classList.add('mat-elevation-z2');
|
|
1009
|
-
}
|
|
1010
|
-
_resetClass() {
|
|
1011
|
-
this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
|
|
1012
|
-
}
|
|
1013
|
-
_getSvg(type) {
|
|
1014
|
-
if (type === 'success') {
|
|
949
|
+
class FsButtonDirective {
|
|
950
|
+
constructor(_matButton, _form, _elementRef, _cdRef) {
|
|
951
|
+
this._matButton = _matButton;
|
|
952
|
+
this._form = _form;
|
|
953
|
+
this._elementRef = _elementRef;
|
|
954
|
+
this._cdRef = _cdRef;
|
|
955
|
+
this.dirtySubmit = true;
|
|
956
|
+
this.transitionStyle = null;
|
|
957
|
+
this.active = false;
|
|
958
|
+
this.submit = false;
|
|
959
|
+
this._previousDisabled = false;
|
|
960
|
+
this._destroy$ = new Subject();
|
|
961
|
+
}
|
|
962
|
+
ngOnInit() {
|
|
963
|
+
this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
|
|
964
|
+
this.form = this.form || this._form;
|
|
965
|
+
if (this.form) {
|
|
966
|
+
this.form.addButton(this);
|
|
967
|
+
if (this.submit) {
|
|
968
|
+
fromEvent(this.element, 'click')
|
|
969
|
+
.pipe(takeUntil(this._destroy$))
|
|
970
|
+
.subscribe(() => {
|
|
971
|
+
this.active = true;
|
|
972
|
+
});
|
|
973
|
+
if (this.dirtySubmit) {
|
|
974
|
+
if (this.form.dirtySubmitButton) {
|
|
975
|
+
if (!this.form.ngForm.dirty) {
|
|
976
|
+
this.disable();
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
this.transitionStyle = 'none';
|
|
981
|
+
setTimeout(() => {
|
|
982
|
+
this.transitionStyle = null;
|
|
983
|
+
}, 500);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
disable() {
|
|
988
|
+
if (this._matButton && !this.active) {
|
|
989
|
+
this._previousDisabled = this._matButton.disabled;
|
|
990
|
+
this._matButton.disabled = true;
|
|
991
|
+
this._cdRef.markForCheck();
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
enable() {
|
|
995
|
+
if (this._matButton) {
|
|
996
|
+
this._matButton.disabled = false;
|
|
997
|
+
this._matButton.disableRipple = true;
|
|
998
|
+
this._cdRef.markForCheck();
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
process() {
|
|
1002
|
+
this.setClass('process');
|
|
1003
|
+
if (this._matButton) {
|
|
1004
|
+
this._matButton.disableRipple = true;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
success() {
|
|
1008
|
+
this.setClass('success');
|
|
1009
|
+
if (this._matButton) {
|
|
1010
|
+
this._matButton.disableRipple = false;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
error() {
|
|
1014
|
+
this.setClass('error');
|
|
1015
|
+
if (this._matButton) {
|
|
1016
|
+
this._matButton.disableRipple = false;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
setClass(cls) {
|
|
1020
|
+
const svg = this._getSvg(cls);
|
|
1021
|
+
this._resetClass();
|
|
1022
|
+
this._disableShadowAnimation();
|
|
1023
|
+
this.element.classList.add(`submit-${cls}`);
|
|
1024
|
+
this.element.append(svg);
|
|
1025
|
+
}
|
|
1026
|
+
get element() {
|
|
1027
|
+
return this._elementRef.nativeElement;
|
|
1028
|
+
}
|
|
1029
|
+
resetActive() {
|
|
1030
|
+
this.active = false;
|
|
1031
|
+
}
|
|
1032
|
+
reset() {
|
|
1033
|
+
if (!this._previousDisabled) {
|
|
1034
|
+
this.enable();
|
|
1035
|
+
}
|
|
1036
|
+
this.element.querySelectorAll('.svg-icon')
|
|
1037
|
+
.forEach((el) => {
|
|
1038
|
+
el.remove();
|
|
1039
|
+
});
|
|
1040
|
+
if (this._matButton) {
|
|
1041
|
+
this._matButton.disableRipple = false;
|
|
1042
|
+
}
|
|
1043
|
+
this._resetClass();
|
|
1044
|
+
}
|
|
1045
|
+
ngOnDestroy() {
|
|
1046
|
+
var _a;
|
|
1047
|
+
this._destroy$.next();
|
|
1048
|
+
this._destroy$.complete();
|
|
1049
|
+
(_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
|
|
1050
|
+
}
|
|
1051
|
+
_disableShadowAnimation() {
|
|
1052
|
+
// .mat-elevation-z2 removes the click shadow animation
|
|
1053
|
+
//this.element.classList.add('mat-elevation-z2');
|
|
1054
|
+
}
|
|
1055
|
+
_resetClass() {
|
|
1056
|
+
this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
|
|
1057
|
+
}
|
|
1058
|
+
_getSvg(type) {
|
|
1059
|
+
if (type === 'success') {
|
|
1015
1060
|
return new DOMParser().parseFromString(`<svg class="svg-icon svg-icon-success" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 38 38" style="enable-background:new 0 0 38 38;" xml:space="preserve" width="38px" height="38px">
|
|
1016
1061
|
<g>
|
|
1017
1062
|
<g class="check">
|
|
@@ -1020,1563 +1065,1514 @@ class FsButtonDirective {
|
|
|
1020
1065
|
</g>
|
|
1021
1066
|
</g>
|
|
1022
1067
|
</g>
|
|
1023
|
-
</svg>`, 'text/xml').firstChild;
|
|
1024
|
-
}
|
|
1025
|
-
if (type === 'process') {
|
|
1068
|
+
</svg>`, 'text/xml').firstChild;
|
|
1069
|
+
}
|
|
1070
|
+
if (type === 'process') {
|
|
1026
1071
|
return new DOMParser().parseFromString(`<svg class="svg-icon svg-icon-process" width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg">
|
|
1027
1072
|
<g fill="none" fill-rule="evenodd">
|
|
1028
1073
|
<g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
|
|
1029
1074
|
<path d="M36 18c0-9.94-8.06-18-18-18"><animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur=".7s" repeatCount="indefinite"/></path>
|
|
1030
1075
|
</g>
|
|
1031
1076
|
</g>
|
|
1032
|
-
</svg>`, 'text/xml').firstChild;
|
|
1033
|
-
}
|
|
1034
|
-
if (type === 'error') {
|
|
1035
|
-
return new DOMParser().parseFromString('<svg class="svg-icon svg-icon-error" xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 16 16"><g><path d="M8 1c3.9 0 7 3.1 7 7s-3.1 7-7 7-7-3.1-7-7 3.1-7 7-7zM8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8v0z" data-original="#444444" data-old_color="#444444"/><path d="M12.2 10.8l-2.8-2.8 2.8-2.8-1.4-1.4-2.8 2.8-2.8-2.8-1.4 1.4 2.8 2.8-2.8 2.8 1.4 1.4 2.8-2.8 2.8 2.8z"/></g> </svg>', 'text/xml').firstChild;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
FsButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1040
|
-
FsButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1041
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1042
|
-
type: Directive,
|
|
1043
|
-
args: [{
|
|
1044
|
-
selector: '[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])',
|
|
1045
|
-
}]
|
|
1046
|
-
}], ctorParameters: function () {
|
|
1047
|
-
return [{ type: i1$1.MatButton, decorators: [{
|
|
1048
|
-
type: Optional
|
|
1049
|
-
}, {
|
|
1050
|
-
type: Host
|
|
1051
|
-
}] }, { type: FsFormDirective, decorators: [{
|
|
1052
|
-
type: Optional
|
|
1053
|
-
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
|
|
1054
|
-
}, propDecorators: { name: [{
|
|
1055
|
-
type: Input
|
|
1056
|
-
}], dirtySubmit: [{
|
|
1057
|
-
type: Input
|
|
1058
|
-
}], form: [{
|
|
1059
|
-
type: Input
|
|
1060
|
-
}], transitionStyle: [{
|
|
1061
|
-
type: HostBinding,
|
|
1062
|
-
args: ['style.transition']
|
|
1063
|
-
}] } });
|
|
1064
|
-
|
|
1065
|
-
class FsFormDialogCloseDirective {
|
|
1066
|
-
constructor(_form, _dialogRef) {
|
|
1067
|
-
this._form = _form;
|
|
1068
|
-
this._dialogRef = _dialogRef;
|
|
1069
|
-
this.type = 'button';
|
|
1070
|
-
this._destroy$ = new Subject();
|
|
1071
|
-
}
|
|
1072
|
-
closeClick() {
|
|
1073
|
-
if (this._form) {
|
|
1074
|
-
this._form.triggerConfirm()
|
|
1075
|
-
.pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
1076
|
-
.subscribe(() => {
|
|
1077
|
-
this._dialogRef.close(this.closeData);
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
else {
|
|
1081
|
-
this._dialogRef.close(this.closeData);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
ngOnDestroy() {
|
|
1085
|
-
this._destroy$.next();
|
|
1086
|
-
this._destroy$.complete();
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
FsFormDialogCloseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogCloseDirective, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1090
|
-
FsFormDialogCloseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: { closeData: "closeData" }, host: { listeners: { "click": "closeClick($event.target)" }, properties: { "attr.type": "this.type" } }, ngImport: i0 });
|
|
1091
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogCloseDirective, decorators: [{
|
|
1092
|
-
type: Directive,
|
|
1093
|
-
args: [{
|
|
1094
|
-
selector: '[fsFormDialogClose],[fs-form-dialog-close]',
|
|
1095
|
-
}]
|
|
1096
|
-
}], ctorParameters: function () {
|
|
1097
|
-
return [{ type: FsFormDirective, decorators: [{
|
|
1098
|
-
type: Optional
|
|
1099
|
-
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
1100
|
-
type: Optional
|
|
1101
|
-
}] }];
|
|
1102
|
-
}, propDecorators: { closeData: [{
|
|
1103
|
-
type: Input
|
|
1104
|
-
}], type: [{
|
|
1105
|
-
type: HostBinding,
|
|
1106
|
-
args: ['attr.type']
|
|
1107
|
-
}], closeClick: [{
|
|
1108
|
-
type: HostListener,
|
|
1109
|
-
args: ['click', ['$event.target']]
|
|
1077
|
+
</svg>`, 'text/xml').firstChild;
|
|
1078
|
+
}
|
|
1079
|
+
if (type === 'error') {
|
|
1080
|
+
return new DOMParser().parseFromString('<svg class="svg-icon svg-icon-error" xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 16 16"><g><path d="M8 1c3.9 0 7 3.1 7 7s-3.1 7-7 7-7-3.1-7-7 3.1-7 7-7zM8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8v0z" data-original="#444444" data-old_color="#444444"/><path d="M12.2 10.8l-2.8-2.8 2.8-2.8-1.4-1.4-2.8 2.8-2.8-2.8-1.4 1.4 2.8 2.8-2.8 2.8 1.4 1.4 2.8-2.8 2.8 2.8z"/></g> </svg>', 'text/xml').firstChild;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
FsButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsButtonDirective, deps: [{ token: i1$1.MatButton, host: true, optional: true }, { token: FsFormDirective, optional: true }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1085
|
+
FsButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsButtonDirective, selector: "[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])", inputs: { name: "name", dirtySubmit: "dirtySubmit", form: "form" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0 });
|
|
1086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsButtonDirective, decorators: [{
|
|
1087
|
+
type: Directive,
|
|
1088
|
+
args: [{
|
|
1089
|
+
selector: '[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])',
|
|
1090
|
+
}]
|
|
1091
|
+
}], ctorParameters: function () {
|
|
1092
|
+
return [{ type: i1$1.MatButton, decorators: [{
|
|
1093
|
+
type: Optional
|
|
1094
|
+
}, {
|
|
1095
|
+
type: Host
|
|
1096
|
+
}] }, { type: FsFormDirective, decorators: [{
|
|
1097
|
+
type: Optional
|
|
1098
|
+
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
|
|
1099
|
+
}, propDecorators: { name: [{
|
|
1100
|
+
type: Input
|
|
1101
|
+
}], dirtySubmit: [{
|
|
1102
|
+
type: Input
|
|
1103
|
+
}], form: [{
|
|
1104
|
+
type: Input
|
|
1105
|
+
}], transitionStyle: [{
|
|
1106
|
+
type: HostBinding,
|
|
1107
|
+
args: ['style.transition']
|
|
1110
1108
|
}] } });
|
|
1111
1109
|
|
|
1112
|
-
class FsFormDialogActionsComponent {
|
|
1113
|
-
constructor(_form, _dialogRef, _cdRef) {
|
|
1114
|
-
this._form = _form;
|
|
1115
|
-
this._dialogRef = _dialogRef;
|
|
1116
|
-
this._cdRef = _cdRef;
|
|
1117
|
-
this.save = true;
|
|
1118
|
-
this.create = false;
|
|
1119
|
-
this.close = false;
|
|
1120
|
-
this.done = false;
|
|
1121
|
-
this.closeData = null;
|
|
1122
|
-
this.dirty = false;
|
|
1123
|
-
this._destroy$ = new Subject();
|
|
1124
|
-
}
|
|
1125
|
-
ngOnInit() {
|
|
1126
|
-
if (this._form) {
|
|
1127
|
-
this._form.ngForm.valueChanges
|
|
1128
|
-
.pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1129
|
-
.subscribe(() => {
|
|
1130
|
-
this.dirty = this._form.ngForm.dirty;
|
|
1131
|
-
this._cdRef.markForCheck();
|
|
1132
|
-
});
|
|
1133
|
-
this._form.submitted
|
|
1134
|
-
.pipe(delay(50), takeUntil(this._destroy$))
|
|
1135
|
-
.subscribe(() => {
|
|
1136
|
-
this.dirty = false;
|
|
1137
|
-
this._cdRef.markForCheck();
|
|
1138
|
-
});
|
|
1139
|
-
this._form.reseted
|
|
1140
|
-
.pipe(takeUntil(this._destroy$))
|
|
1141
|
-
.subscribe(() => {
|
|
1142
|
-
this.dirty = false;
|
|
1143
|
-
this._cdRef.markForCheck();
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
ngOnDestroy() {
|
|
1148
|
-
this._destroy$.next();
|
|
1149
|
-
this._destroy$.complete();
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
FsFormDialogActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1153
|
-
FsFormDialogActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1155
|
-
type: Component,
|
|
1156
|
-
args: [{ selector: 'fs-form-dialog-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
1157
|
-
}], ctorParameters: function () {
|
|
1158
|
-
return [{ type: FsFormDirective, decorators: [{
|
|
1159
|
-
type: Optional
|
|
1160
|
-
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
1161
|
-
type: Optional
|
|
1162
|
-
}] }, { type: i0.ChangeDetectorRef }];
|
|
1163
|
-
}, propDecorators: { save: [{
|
|
1164
|
-
type: Input
|
|
1165
|
-
}], create: [{
|
|
1166
|
-
type: Input
|
|
1167
|
-
}], close: [{
|
|
1168
|
-
type: Input
|
|
1169
|
-
}], done: [{
|
|
1170
|
-
type: Input
|
|
1171
|
-
}], closeData: [{
|
|
1172
|
-
type: Input
|
|
1173
|
-
}], name: [{
|
|
1174
|
-
type: Input
|
|
1110
|
+
class FsFormDialogActionsComponent {
|
|
1111
|
+
constructor(_form, _dialogRef, _cdRef) {
|
|
1112
|
+
this._form = _form;
|
|
1113
|
+
this._dialogRef = _dialogRef;
|
|
1114
|
+
this._cdRef = _cdRef;
|
|
1115
|
+
this.save = true;
|
|
1116
|
+
this.create = false;
|
|
1117
|
+
this.close = false;
|
|
1118
|
+
this.done = false;
|
|
1119
|
+
this.closeData = null;
|
|
1120
|
+
this.dirty = false;
|
|
1121
|
+
this._destroy$ = new Subject();
|
|
1122
|
+
}
|
|
1123
|
+
ngOnInit() {
|
|
1124
|
+
if (this._form) {
|
|
1125
|
+
this._form.ngForm.valueChanges
|
|
1126
|
+
.pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1127
|
+
.subscribe(() => {
|
|
1128
|
+
this.dirty = this._form.ngForm.dirty;
|
|
1129
|
+
this._cdRef.markForCheck();
|
|
1130
|
+
});
|
|
1131
|
+
this._form.submitted
|
|
1132
|
+
.pipe(delay(50), takeUntil(this._destroy$))
|
|
1133
|
+
.subscribe(() => {
|
|
1134
|
+
this.dirty = false;
|
|
1135
|
+
this._cdRef.markForCheck();
|
|
1136
|
+
});
|
|
1137
|
+
this._form.reseted
|
|
1138
|
+
.pipe(takeUntil(this._destroy$))
|
|
1139
|
+
.subscribe(() => {
|
|
1140
|
+
this.dirty = false;
|
|
1141
|
+
this._cdRef.markForCheck();
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
ngOnDestroy() {
|
|
1146
|
+
this._destroy$.next();
|
|
1147
|
+
this._destroy$.complete();
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
FsFormDialogActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDialogActionsComponent, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1151
|
+
FsFormDialogActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", done: "done", closeData: "closeData", name: "name" }, ngImport: i0, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i1$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: ["closeData"] }, { kind: "directive", type: FsButtonDirective, selector: "[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])", inputs: ["name", "dirtySubmit", "form"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
|
|
1153
|
+
type: Component,
|
|
1154
|
+
args: [{ selector: 'fs-form-dialog-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
1155
|
+
}], ctorParameters: function () {
|
|
1156
|
+
return [{ type: FsFormDirective, decorators: [{
|
|
1157
|
+
type: Optional
|
|
1158
|
+
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
1159
|
+
type: Optional
|
|
1160
|
+
}] }, { type: i0.ChangeDetectorRef }];
|
|
1161
|
+
}, propDecorators: { save: [{
|
|
1162
|
+
type: Input
|
|
1163
|
+
}], create: [{
|
|
1164
|
+
type: Input
|
|
1165
|
+
}], close: [{
|
|
1166
|
+
type: Input
|
|
1167
|
+
}], done: [{
|
|
1168
|
+
type: Input
|
|
1169
|
+
}], closeData: [{
|
|
1170
|
+
type: Input
|
|
1171
|
+
}], name: [{
|
|
1172
|
+
type: Input
|
|
1175
1173
|
}] } });
|
|
1176
1174
|
|
|
1177
|
-
class FsFormTemplateComponent {
|
|
1178
|
-
constructor() { }
|
|
1179
|
-
ngAfterContentInit() {
|
|
1180
|
-
debugger;
|
|
1181
|
-
const x = this.models;
|
|
1182
|
-
this.models.changes.subscribe((x) => {
|
|
1183
|
-
debugger;
|
|
1184
|
-
});
|
|
1185
|
-
}
|
|
1186
|
-
ngOnInit() {
|
|
1187
|
-
debugger;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
FsFormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1191
|
-
FsFormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1192
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1193
|
-
type: Component,
|
|
1194
|
-
args: [{ selector: 'fs-form-template', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>" }]
|
|
1195
|
-
}], ctorParameters: function () { return []; }, propDecorators: { templateRef: [{
|
|
1196
|
-
type: ViewChild,
|
|
1197
|
-
args: ['templateRef1']
|
|
1198
|
-
}], formTemplate: [{
|
|
1199
|
-
type: Input
|
|
1200
|
-
}], models: [{
|
|
1201
|
-
type: ContentChildren,
|
|
1202
|
-
args: [NgModel, { descendants: true }]
|
|
1175
|
+
class FsFormTemplateComponent {
|
|
1176
|
+
constructor() { }
|
|
1177
|
+
ngAfterContentInit() {
|
|
1178
|
+
debugger;
|
|
1179
|
+
const x = this.models;
|
|
1180
|
+
this.models.changes.subscribe((x) => {
|
|
1181
|
+
debugger;
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
ngOnInit() {
|
|
1185
|
+
debugger;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
FsFormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1189
|
+
FsFormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FsFormTemplateComponent, selector: "fs-form-template", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef1"], descendants: true }], ngImport: i0, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateComponent, decorators: [{
|
|
1191
|
+
type: Component,
|
|
1192
|
+
args: [{ selector: 'fs-form-template', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>" }]
|
|
1193
|
+
}], ctorParameters: function () { return []; }, propDecorators: { templateRef: [{
|
|
1194
|
+
type: ViewChild,
|
|
1195
|
+
args: ['templateRef1']
|
|
1196
|
+
}], formTemplate: [{
|
|
1197
|
+
type: Input
|
|
1198
|
+
}], models: [{
|
|
1199
|
+
type: ContentChildren,
|
|
1200
|
+
args: [NgModel, { descendants: true }]
|
|
1203
1201
|
}] } });
|
|
1204
1202
|
|
|
1205
|
-
class FsFormTemplateOutletComponent {
|
|
1206
|
-
constructor() { }
|
|
1207
|
-
ngOnChanges(changes) {
|
|
1208
|
-
var _a;
|
|
1209
|
-
if ((_a = changes.formTemplate) === null || _a === void 0 ? void 0 : _a.currentValue) {
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
ngAfterContentInit() {
|
|
1213
|
-
// const x = this.models;
|
|
1214
|
-
// this.models.changes.subscribe((x) => {
|
|
1215
|
-
// debugger;
|
|
1216
|
-
// });
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
FsFormTemplateOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1220
|
-
FsFormTemplateOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1222
|
-
type: Component,
|
|
1223
|
-
args: [{ selector: 'fs-form-template-outlet', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>" }]
|
|
1224
|
-
}], ctorParameters: function () { return []; }, propDecorators: { formTemplate: [{
|
|
1225
|
-
type: Input
|
|
1226
|
-
}], models: [{
|
|
1227
|
-
type: ContentChildren,
|
|
1228
|
-
args: [NgModel, { descendants: true }]
|
|
1203
|
+
class FsFormTemplateOutletComponent {
|
|
1204
|
+
constructor() { }
|
|
1205
|
+
ngOnChanges(changes) {
|
|
1206
|
+
var _a;
|
|
1207
|
+
if ((_a = changes.formTemplate) === null || _a === void 0 ? void 0 : _a.currentValue) {
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
ngAfterContentInit() {
|
|
1211
|
+
// const x = this.models;
|
|
1212
|
+
// this.models.changes.subscribe((x) => {
|
|
1213
|
+
// debugger;
|
|
1214
|
+
// });
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
FsFormTemplateOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1218
|
+
FsFormTemplateOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FsFormTemplateOutletComponent, selector: "fs-form-template-outlet", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>", dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3$1.JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1219
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateOutletComponent, decorators: [{
|
|
1220
|
+
type: Component,
|
|
1221
|
+
args: [{ selector: 'fs-form-template-outlet', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>" }]
|
|
1222
|
+
}], ctorParameters: function () { return []; }, propDecorators: { formTemplate: [{
|
|
1223
|
+
type: Input
|
|
1224
|
+
}], models: [{
|
|
1225
|
+
type: ContentChildren,
|
|
1226
|
+
args: [NgModel, { descendants: true }]
|
|
1229
1227
|
}] } });
|
|
1230
1228
|
|
|
1231
|
-
class FsFormTemplateDirective {
|
|
1232
|
-
constructor() { }
|
|
1233
|
-
ngAfterContentInit() {
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1237
|
-
FsFormTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1239
|
-
type: Directive,
|
|
1240
|
-
args: [{
|
|
1241
|
-
selector: '[fsFormTemplate]',
|
|
1242
|
-
}]
|
|
1243
|
-
}], ctorParameters: function () { return []; }, propDecorators: { models: [{
|
|
1244
|
-
type: ViewChildren,
|
|
1245
|
-
args: [NgModel]
|
|
1229
|
+
class FsFormTemplateDirective {
|
|
1230
|
+
constructor() { }
|
|
1231
|
+
ngAfterContentInit() {
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1235
|
+
FsFormTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
|
|
1236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
|
|
1237
|
+
type: Directive,
|
|
1238
|
+
args: [{
|
|
1239
|
+
selector: '[fsFormTemplate]',
|
|
1240
|
+
}]
|
|
1241
|
+
}], ctorParameters: function () { return []; }, propDecorators: { models: [{
|
|
1242
|
+
type: ViewChildren,
|
|
1243
|
+
args: [NgModel]
|
|
1246
1244
|
}] } });
|
|
1247
1245
|
|
|
1248
|
-
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
1249
|
-
}
|
|
1250
|
-
FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1251
|
-
FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1253
|
-
type: Directive,
|
|
1254
|
-
args: [{
|
|
1255
|
-
selector: 'dummy-selector',
|
|
1256
|
-
}]
|
|
1246
|
+
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
1247
|
+
}
|
|
1248
|
+
FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1249
|
+
FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
|
|
1250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
|
|
1251
|
+
type: Directive,
|
|
1252
|
+
args: [{
|
|
1253
|
+
selector: 'dummy-selector',
|
|
1254
|
+
}]
|
|
1257
1255
|
}] });
|
|
1258
1256
|
|
|
1259
|
-
const ERROR_MESSAGES = {
|
|
1260
|
-
required: 'This field is required',
|
|
1261
|
-
email: 'This is not a valid email address',
|
|
1262
|
-
emails: 'Input valid email addresses, comma separated',
|
|
1263
|
-
phone: 'Invalid phone number',
|
|
1264
|
-
numeric: 'Value should be numeric',
|
|
1265
|
-
integer: 'Value should be an integer',
|
|
1266
|
-
min: 'Value should not be less than $(1)',
|
|
1267
|
-
max: 'Value should not be greater than $(1)',
|
|
1268
|
-
minlength: 'Should not be shorter than $(1) characters',
|
|
1269
|
-
maxlength: 'Should not be longer than $(1) characters',
|
|
1270
|
-
compare: 'Inputs do not match',
|
|
1271
|
-
pattern: 'Value should match pattern $(1)',
|
|
1272
|
-
dateRange: 'Invalid date range',
|
|
1273
|
-
url: 'This is not a valid url',
|
|
1274
|
-
urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
|
|
1275
|
-
greater: 'Value must be greater than $(1)',
|
|
1276
|
-
lesser: 'Value must be less than $(1)',
|
|
1277
|
-
greaterEqual: 'Value must be greater than or equal $(1)',
|
|
1278
|
-
lesserEqual: 'Value must be less than or equal $(1)',
|
|
1257
|
+
const ERROR_MESSAGES = {
|
|
1258
|
+
required: 'This field is required',
|
|
1259
|
+
email: 'This is not a valid email address',
|
|
1260
|
+
emails: 'Input valid email addresses, comma separated',
|
|
1261
|
+
phone: 'Invalid phone number',
|
|
1262
|
+
numeric: 'Value should be numeric',
|
|
1263
|
+
integer: 'Value should be an integer',
|
|
1264
|
+
min: 'Value should not be less than $(1)',
|
|
1265
|
+
max: 'Value should not be greater than $(1)',
|
|
1266
|
+
minlength: 'Should not be shorter than $(1) characters',
|
|
1267
|
+
maxlength: 'Should not be longer than $(1) characters',
|
|
1268
|
+
compare: 'Inputs do not match',
|
|
1269
|
+
pattern: 'Value should match pattern $(1)',
|
|
1270
|
+
dateRange: 'Invalid date range',
|
|
1271
|
+
url: 'This is not a valid url',
|
|
1272
|
+
urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
|
|
1273
|
+
greater: 'Value must be greater than $(1)',
|
|
1274
|
+
lesser: 'Value must be less than $(1)',
|
|
1275
|
+
greaterEqual: 'Value must be greater than or equal $(1)',
|
|
1276
|
+
lesserEqual: 'Value must be less than or equal $(1)',
|
|
1279
1277
|
};
|
|
1280
1278
|
|
|
1281
|
-
const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
|
|
1282
|
-
const VALIDATE_MESSAGE_PROVIDER = {
|
|
1283
|
-
provide: VALIDATE_MESSAGES,
|
|
1284
|
-
useFactory: messageProviderFactory,
|
|
1285
|
-
};
|
|
1286
|
-
function messageProviderFactory() {
|
|
1287
|
-
return Object.assign({}, ERROR_MESSAGES);
|
|
1279
|
+
const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
|
|
1280
|
+
const VALIDATE_MESSAGE_PROVIDER = {
|
|
1281
|
+
provide: VALIDATE_MESSAGES,
|
|
1282
|
+
useFactory: messageProviderFactory,
|
|
1283
|
+
};
|
|
1284
|
+
function messageProviderFactory() {
|
|
1285
|
+
return Object.assign({}, ERROR_MESSAGES);
|
|
1288
1286
|
}
|
|
1289
1287
|
|
|
1290
|
-
class FsControlDirective {
|
|
1291
|
-
constructor(_elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
|
|
1292
|
-
this._elementRef = _elementRef;
|
|
1293
|
-
this.renderer2 = renderer2;
|
|
1294
|
-
this.injector = injector;
|
|
1295
|
-
this._validateMessages = _validateMessages;
|
|
1296
|
-
this.ngControl = ngControl;
|
|
1297
|
-
this.formDirective = formDirective;
|
|
1298
|
-
this.appendMessageClass = 'fs-form-message';
|
|
1299
|
-
this.appendLabelClass = 'fs-form-label';
|
|
1300
|
-
this.appendErrorClass = 'fs-form-error';
|
|
1301
|
-
this.appendHintClass = 'fs-form-hint';
|
|
1302
|
-
this.errors = [];
|
|
1303
|
-
this._destroy$ = new Subject();
|
|
1304
|
-
if (ngControl) {
|
|
1305
|
-
this._control = ngControl.control;
|
|
1306
|
-
}
|
|
1307
|
-
else {
|
|
1308
|
-
console.error('The element does not have a valid ngModel', this._elementRef.nativeElement);
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
set validateMessages(messages) {
|
|
1312
|
-
this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
|
|
1313
|
-
}
|
|
1314
|
-
ngOnInit() {
|
|
1315
|
-
this._setupValidators();
|
|
1316
|
-
}
|
|
1317
|
-
ngOnDestroy() {
|
|
1318
|
-
this._destroy$.next();
|
|
1319
|
-
this._destroy$.complete();
|
|
1320
|
-
}
|
|
1321
|
-
ngAfterContentInit() {
|
|
1322
|
-
this._subscribeToStatusChagnes();
|
|
1323
|
-
}
|
|
1324
|
-
getMessageSelector() {
|
|
1325
|
-
var _a;
|
|
1326
|
-
if (this.messageSelector === false) {
|
|
1327
|
-
return '';
|
|
1328
|
-
}
|
|
1329
|
-
if (this.messageSelector) {
|
|
1330
|
-
return this.messageSelector;
|
|
1331
|
-
}
|
|
1332
|
-
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
|
|
1333
|
-
return this.formDirective.messageSelector;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
getHintWrapperSelector() {
|
|
1337
|
-
var _a;
|
|
1338
|
-
if (this.hintSelector === false) {
|
|
1339
|
-
return '';
|
|
1340
|
-
}
|
|
1341
|
-
if (this.hintSelector) {
|
|
1342
|
-
return this.hintSelector;
|
|
1343
|
-
}
|
|
1344
|
-
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
|
|
1345
|
-
return this.formDirective.hintSelector;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
getWrapperSelector() {
|
|
1349
|
-
var _a;
|
|
1350
|
-
if (this.wrapperSelector === false) {
|
|
1351
|
-
return '';
|
|
1352
|
-
}
|
|
1353
|
-
if (this.wrapperSelector) {
|
|
1354
|
-
return this.wrapperSelector;
|
|
1355
|
-
}
|
|
1356
|
-
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
|
|
1357
|
-
return this.formDirective.wrapperSelector;
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
getlabelSelector() {
|
|
1361
|
-
var _a;
|
|
1362
|
-
if (this.labelSelector === false) {
|
|
1363
|
-
return '';
|
|
1364
|
-
}
|
|
1365
|
-
if (this.labelSelector) {
|
|
1366
|
-
return this.labelSelector;
|
|
1367
|
-
}
|
|
1368
|
-
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
|
|
1369
|
-
return this.formDirective.labelSelector;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
getWrapperElement() {
|
|
1373
|
-
const wrapper = this.getWrapper(this._elementRef.nativeElement);
|
|
1374
|
-
if (wrapper) {
|
|
1375
|
-
return wrapper;
|
|
1376
|
-
}
|
|
1377
|
-
return this._elementRef.nativeElement;
|
|
1378
|
-
}
|
|
1379
|
-
/*
|
|
1380
|
-
<mat-form-field class="mat-form-field"> <-- Field Wrapper Class. Look for parents from the native element with the matching wrapperSelector. If not found defaults to native element.
|
|
1381
|
-
<input>
|
|
1382
|
-
<div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
|
|
1383
|
-
<div class="fs-form-message"></div>
|
|
1384
|
-
<div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
|
|
1385
|
-
</div>
|
|
1386
|
-
</mat-form-field>
|
|
1387
|
-
*/
|
|
1388
|
-
render() {
|
|
1389
|
-
var _a, _b;
|
|
1390
|
-
if (this.ngControl) {
|
|
1391
|
-
const renderer = this.renderer2;
|
|
1392
|
-
const wrapper = this.getWrapperElement();
|
|
1393
|
-
const error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
|
|
1394
|
-
const shouldErrorBeRendered = this.ngControl.invalid
|
|
1395
|
-
&& (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
|
|
1396
|
-
if (shouldErrorBeRendered && error) {
|
|
1397
|
-
wrapper.classList.add('ng-invalid', 'ng-dirty');
|
|
1398
|
-
}
|
|
1399
|
-
else {
|
|
1400
|
-
wrapper.classList.remove('ng-invalid');
|
|
1401
|
-
}
|
|
1402
|
-
if (!this.getMessageSelector()) {
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
const messageWrapper = wrapper.querySelector(this.getMessageSelector());
|
|
1406
|
-
if (!messageWrapper) {
|
|
1407
|
-
return console.warn(`Failed to locate ${this.getMessageSelector()}`, this._elementRef.nativeElement);
|
|
1408
|
-
}
|
|
1409
|
-
if (this.getlabelSelector()) {
|
|
1410
|
-
const labelWrapper = wrapper.querySelector(this.getlabelSelector());
|
|
1411
|
-
if (labelWrapper) {
|
|
1412
|
-
if (this.appendLabelClass) {
|
|
1413
|
-
this.renderer2.addClass(labelWrapper, this.appendLabelClass);
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
if (this.appendMessageClass) {
|
|
1418
|
-
renderer.addClass(messageWrapper, this.appendMessageClass);
|
|
1419
|
-
}
|
|
1420
|
-
if (this.getHintWrapperSelector()) {
|
|
1421
|
-
const hint = messageWrapper.querySelector(this.getHintWrapperSelector());
|
|
1422
|
-
if (hint) {
|
|
1423
|
-
renderer.setStyle(hint, 'display', error ? 'none' : 'block');
|
|
1424
|
-
if (this.appendHintClass) {
|
|
1425
|
-
renderer.addClass(hint, this.appendHintClass);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
let errorWrapper = wrapper.querySelector('.fs-form-error-target');
|
|
1430
|
-
if (errorWrapper) {
|
|
1431
|
-
errorWrapper.remove();
|
|
1432
|
-
}
|
|
1433
|
-
if (!shouldErrorBeRendered || !error) {
|
|
1434
|
-
return;
|
|
1435
|
-
}
|
|
1436
|
-
errorWrapper = renderer.createElement('div');
|
|
1437
|
-
renderer.addClass(errorWrapper, 'fs-form-error-target');
|
|
1438
|
-
renderer.addClass(errorWrapper, this.appendErrorClass);
|
|
1439
|
-
renderer.addClass(errorWrapper, `${this.appendErrorClass}-${error.name}`);
|
|
1440
|
-
const errorText = renderer.createText(error.message);
|
|
1441
|
-
renderer.appendChild(errorWrapper, errorText);
|
|
1442
|
-
messageWrapper.appendChild(errorWrapper);
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
_subscribeToStatusChagnes() {
|
|
1446
|
-
if (this._control) {
|
|
1447
|
-
this._control.statusChanges
|
|
1448
|
-
.pipe(takeUntil(this._destroy$))
|
|
1449
|
-
.subscribe(this.render.bind(this));
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
getWrapper(node, count = 0) {
|
|
1453
|
-
if (!node || count > 10) {
|
|
1454
|
-
return null;
|
|
1455
|
-
}
|
|
1456
|
-
if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
|
|
1457
|
-
return node;
|
|
1458
|
-
}
|
|
1459
|
-
return this.getWrapper(node.parentNode, ++count);
|
|
1460
|
-
}
|
|
1461
|
-
parseErrorMessage(message, args) {
|
|
1462
|
-
values(args)
|
|
1463
|
-
.forEach((name) => {
|
|
1464
|
-
message = message.replace(/\$\(\d\)/, name);
|
|
1465
|
-
});
|
|
1466
|
-
return message;
|
|
1467
|
-
}
|
|
1468
|
-
getError(controlRef) {
|
|
1469
|
-
const name = keys(controlRef.control.errors)[0];
|
|
1470
|
-
if (!name) {
|
|
1471
|
-
return null;
|
|
1472
|
-
}
|
|
1473
|
-
let message = controlRef.control.errors[name];
|
|
1474
|
-
if (this._validateMessages[name]) {
|
|
1475
|
-
message = this.parseErrorMessage(this._validateMessages[name], message);
|
|
1476
|
-
}
|
|
1477
|
-
return { name: name, message: message };
|
|
1478
|
-
}
|
|
1479
|
-
_setupValidators() {
|
|
1480
|
-
const control = this._control;
|
|
1481
|
-
if (this.validate) {
|
|
1482
|
-
const validators = control.validator
|
|
1483
|
-
? [control.validator, this.validate.bind(this)]
|
|
1484
|
-
: this.validate.bind(this);
|
|
1485
|
-
control.setValidators(validators);
|
|
1486
|
-
}
|
|
1487
|
-
if (this.validateAsync) {
|
|
1488
|
-
const asyncValidators = control.asyncValidator
|
|
1489
|
-
? [control.asyncValidator, this.validateAsync.bind(this)]
|
|
1490
|
-
: this.validateAsync.bind(this);
|
|
1491
|
-
control.setAsyncValidators(asyncValidators);
|
|
1492
|
-
}
|
|
1493
|
-
control.updateValueAndValidity();
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
FsControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1497
|
-
FsControlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1498
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1499
|
-
], ngImport: i0 });
|
|
1500
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1501
|
-
type: Directive,
|
|
1502
|
-
args: [{
|
|
1503
|
-
selector: '[fsFormControl]',
|
|
1504
|
-
providers: [
|
|
1505
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1506
|
-
],
|
|
1507
|
-
}]
|
|
1508
|
-
}], ctorParameters: function () {
|
|
1509
|
-
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: undefined, decorators: [{
|
|
1510
|
-
type: Self
|
|
1511
|
-
}, {
|
|
1512
|
-
type: Inject,
|
|
1513
|
-
args: [VALIDATE_MESSAGES]
|
|
1514
|
-
}] }, { type: i1$2.NgControl, decorators: [{
|
|
1515
|
-
type: Optional
|
|
1516
|
-
}] }, { type: FsFormDirective, decorators: [{
|
|
1517
|
-
type: Optional
|
|
1518
|
-
}, {
|
|
1519
|
-
type: Inject,
|
|
1520
|
-
args: [FsFormDirective]
|
|
1521
|
-
}] }];
|
|
1522
|
-
}, propDecorators: { wrapperSelector: [{
|
|
1523
|
-
type: Input
|
|
1524
|
-
}], messageSelector: [{
|
|
1525
|
-
type: Input
|
|
1526
|
-
}], hintSelector: [{
|
|
1527
|
-
type: Input
|
|
1528
|
-
}], labelSelector: [{
|
|
1529
|
-
type: Input
|
|
1530
|
-
}], appendMessageClass: [{
|
|
1531
|
-
type: Input
|
|
1532
|
-
}], appendLabelClass: [{
|
|
1533
|
-
type: Input
|
|
1534
|
-
}], appendErrorClass: [{
|
|
1535
|
-
type: Input
|
|
1536
|
-
}], appendHintClass: [{
|
|
1537
|
-
type: Input
|
|
1538
|
-
}], validateMessages: [{
|
|
1539
|
-
type: Input
|
|
1288
|
+
class FsControlDirective {
|
|
1289
|
+
constructor(_elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
|
|
1290
|
+
this._elementRef = _elementRef;
|
|
1291
|
+
this.renderer2 = renderer2;
|
|
1292
|
+
this.injector = injector;
|
|
1293
|
+
this._validateMessages = _validateMessages;
|
|
1294
|
+
this.ngControl = ngControl;
|
|
1295
|
+
this.formDirective = formDirective;
|
|
1296
|
+
this.appendMessageClass = 'fs-form-message';
|
|
1297
|
+
this.appendLabelClass = 'fs-form-label';
|
|
1298
|
+
this.appendErrorClass = 'fs-form-error';
|
|
1299
|
+
this.appendHintClass = 'fs-form-hint';
|
|
1300
|
+
this.errors = [];
|
|
1301
|
+
this._destroy$ = new Subject();
|
|
1302
|
+
if (ngControl) {
|
|
1303
|
+
this._control = ngControl.control;
|
|
1304
|
+
}
|
|
1305
|
+
else {
|
|
1306
|
+
console.error('The element does not have a valid ngModel', this._elementRef.nativeElement);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
set validateMessages(messages) {
|
|
1310
|
+
this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
|
|
1311
|
+
}
|
|
1312
|
+
ngOnInit() {
|
|
1313
|
+
this._setupValidators();
|
|
1314
|
+
}
|
|
1315
|
+
ngOnDestroy() {
|
|
1316
|
+
this._destroy$.next();
|
|
1317
|
+
this._destroy$.complete();
|
|
1318
|
+
}
|
|
1319
|
+
ngAfterContentInit() {
|
|
1320
|
+
this._subscribeToStatusChagnes();
|
|
1321
|
+
}
|
|
1322
|
+
getMessageSelector() {
|
|
1323
|
+
var _a;
|
|
1324
|
+
if (this.messageSelector === false) {
|
|
1325
|
+
return '';
|
|
1326
|
+
}
|
|
1327
|
+
if (this.messageSelector) {
|
|
1328
|
+
return this.messageSelector;
|
|
1329
|
+
}
|
|
1330
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
|
|
1331
|
+
return this.formDirective.messageSelector;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
getHintWrapperSelector() {
|
|
1335
|
+
var _a;
|
|
1336
|
+
if (this.hintSelector === false) {
|
|
1337
|
+
return '';
|
|
1338
|
+
}
|
|
1339
|
+
if (this.hintSelector) {
|
|
1340
|
+
return this.hintSelector;
|
|
1341
|
+
}
|
|
1342
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
|
|
1343
|
+
return this.formDirective.hintSelector;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
getWrapperSelector() {
|
|
1347
|
+
var _a;
|
|
1348
|
+
if (this.wrapperSelector === false) {
|
|
1349
|
+
return '';
|
|
1350
|
+
}
|
|
1351
|
+
if (this.wrapperSelector) {
|
|
1352
|
+
return this.wrapperSelector;
|
|
1353
|
+
}
|
|
1354
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
|
|
1355
|
+
return this.formDirective.wrapperSelector;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
getlabelSelector() {
|
|
1359
|
+
var _a;
|
|
1360
|
+
if (this.labelSelector === false) {
|
|
1361
|
+
return '';
|
|
1362
|
+
}
|
|
1363
|
+
if (this.labelSelector) {
|
|
1364
|
+
return this.labelSelector;
|
|
1365
|
+
}
|
|
1366
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
|
|
1367
|
+
return this.formDirective.labelSelector;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
getWrapperElement() {
|
|
1371
|
+
const wrapper = this.getWrapper(this._elementRef.nativeElement);
|
|
1372
|
+
if (wrapper) {
|
|
1373
|
+
return wrapper;
|
|
1374
|
+
}
|
|
1375
|
+
return this._elementRef.nativeElement;
|
|
1376
|
+
}
|
|
1377
|
+
/*
|
|
1378
|
+
<mat-form-field class="mat-form-field"> <-- Field Wrapper Class. Look for parents from the native element with the matching wrapperSelector. If not found defaults to native element.
|
|
1379
|
+
<input>
|
|
1380
|
+
<div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
|
|
1381
|
+
<div class="fs-form-message"></div>
|
|
1382
|
+
<div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
|
|
1383
|
+
</div>
|
|
1384
|
+
</mat-form-field>
|
|
1385
|
+
*/
|
|
1386
|
+
render() {
|
|
1387
|
+
var _a, _b;
|
|
1388
|
+
if (this.ngControl) {
|
|
1389
|
+
const renderer = this.renderer2;
|
|
1390
|
+
const wrapper = this.getWrapperElement();
|
|
1391
|
+
const error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
|
|
1392
|
+
const shouldErrorBeRendered = this.ngControl.invalid
|
|
1393
|
+
&& (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
|
|
1394
|
+
if (shouldErrorBeRendered && error) {
|
|
1395
|
+
wrapper.classList.add('ng-invalid', 'ng-dirty');
|
|
1396
|
+
}
|
|
1397
|
+
else {
|
|
1398
|
+
wrapper.classList.remove('ng-invalid');
|
|
1399
|
+
}
|
|
1400
|
+
if (!this.getMessageSelector()) {
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
const messageWrapper = wrapper.querySelector(this.getMessageSelector());
|
|
1404
|
+
if (!messageWrapper) {
|
|
1405
|
+
return console.warn(`Failed to locate ${this.getMessageSelector()}`, this._elementRef.nativeElement);
|
|
1406
|
+
}
|
|
1407
|
+
if (this.getlabelSelector()) {
|
|
1408
|
+
const labelWrapper = wrapper.querySelector(this.getlabelSelector());
|
|
1409
|
+
if (labelWrapper) {
|
|
1410
|
+
if (this.appendLabelClass) {
|
|
1411
|
+
this.renderer2.addClass(labelWrapper, this.appendLabelClass);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
if (this.appendMessageClass) {
|
|
1416
|
+
renderer.addClass(messageWrapper, this.appendMessageClass);
|
|
1417
|
+
}
|
|
1418
|
+
if (this.getHintWrapperSelector()) {
|
|
1419
|
+
const hint = messageWrapper.querySelector(this.getHintWrapperSelector());
|
|
1420
|
+
if (hint) {
|
|
1421
|
+
renderer.setStyle(hint, 'display', error ? 'none' : 'block');
|
|
1422
|
+
if (this.appendHintClass) {
|
|
1423
|
+
renderer.addClass(hint, this.appendHintClass);
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
let errorWrapper = wrapper.querySelector('.fs-form-error-target');
|
|
1428
|
+
if (errorWrapper) {
|
|
1429
|
+
errorWrapper.remove();
|
|
1430
|
+
}
|
|
1431
|
+
if (!shouldErrorBeRendered || !error) {
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
errorWrapper = renderer.createElement('div');
|
|
1435
|
+
renderer.addClass(errorWrapper, 'fs-form-error-target');
|
|
1436
|
+
renderer.addClass(errorWrapper, this.appendErrorClass);
|
|
1437
|
+
renderer.addClass(errorWrapper, `${this.appendErrorClass}-${error.name}`);
|
|
1438
|
+
const errorText = renderer.createText(error.message);
|
|
1439
|
+
renderer.appendChild(errorWrapper, errorText);
|
|
1440
|
+
messageWrapper.appendChild(errorWrapper);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
_subscribeToStatusChagnes() {
|
|
1444
|
+
if (this._control) {
|
|
1445
|
+
this._control.statusChanges
|
|
1446
|
+
.pipe(takeUntil(this._destroy$))
|
|
1447
|
+
.subscribe(this.render.bind(this));
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
getWrapper(node, count = 0) {
|
|
1451
|
+
if (!node || count > 10) {
|
|
1452
|
+
return null;
|
|
1453
|
+
}
|
|
1454
|
+
if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
|
|
1455
|
+
return node;
|
|
1456
|
+
}
|
|
1457
|
+
return this.getWrapper(node.parentNode, ++count);
|
|
1458
|
+
}
|
|
1459
|
+
parseErrorMessage(message, args) {
|
|
1460
|
+
values(args)
|
|
1461
|
+
.forEach((name) => {
|
|
1462
|
+
message = message.replace(/\$\(\d\)/, name);
|
|
1463
|
+
});
|
|
1464
|
+
return message;
|
|
1465
|
+
}
|
|
1466
|
+
getError(controlRef) {
|
|
1467
|
+
const name = keys(controlRef.control.errors)[0];
|
|
1468
|
+
if (!name) {
|
|
1469
|
+
return null;
|
|
1470
|
+
}
|
|
1471
|
+
let message = controlRef.control.errors[name];
|
|
1472
|
+
if (this._validateMessages[name]) {
|
|
1473
|
+
message = this.parseErrorMessage(this._validateMessages[name], message);
|
|
1474
|
+
}
|
|
1475
|
+
return { name: name, message: message };
|
|
1476
|
+
}
|
|
1477
|
+
_setupValidators() {
|
|
1478
|
+
const control = this._control;
|
|
1479
|
+
if (this.validate) {
|
|
1480
|
+
const validators = control.validator
|
|
1481
|
+
? [control.validator, this.validate.bind(this)]
|
|
1482
|
+
: this.validate.bind(this);
|
|
1483
|
+
control.setValidators(validators);
|
|
1484
|
+
}
|
|
1485
|
+
if (this.validateAsync) {
|
|
1486
|
+
const asyncValidators = control.asyncValidator
|
|
1487
|
+
? [control.asyncValidator, this.validateAsync.bind(this)]
|
|
1488
|
+
: this.validateAsync.bind(this);
|
|
1489
|
+
control.setAsyncValidators(asyncValidators);
|
|
1490
|
+
}
|
|
1491
|
+
control.updateValueAndValidity();
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
FsControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsControlDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1$2.NgControl, optional: true }, { token: FsFormDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1495
|
+
FsControlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsControlDirective, selector: "[fsFormControl]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", appendMessageClass: "appendMessageClass", appendLabelClass: "appendLabelClass", appendErrorClass: "appendErrorClass", appendHintClass: "appendHintClass", validateMessages: "validateMessages" }, providers: [
|
|
1496
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1497
|
+
], ngImport: i0 });
|
|
1498
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsControlDirective, decorators: [{
|
|
1499
|
+
type: Directive,
|
|
1500
|
+
args: [{
|
|
1501
|
+
selector: '[fsFormControl]',
|
|
1502
|
+
providers: [
|
|
1503
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1504
|
+
],
|
|
1505
|
+
}]
|
|
1506
|
+
}], ctorParameters: function () {
|
|
1507
|
+
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: undefined, decorators: [{
|
|
1508
|
+
type: Self
|
|
1509
|
+
}, {
|
|
1510
|
+
type: Inject,
|
|
1511
|
+
args: [VALIDATE_MESSAGES]
|
|
1512
|
+
}] }, { type: i1$2.NgControl, decorators: [{
|
|
1513
|
+
type: Optional
|
|
1514
|
+
}] }, { type: FsFormDirective, decorators: [{
|
|
1515
|
+
type: Optional
|
|
1516
|
+
}, {
|
|
1517
|
+
type: Inject,
|
|
1518
|
+
args: [FsFormDirective]
|
|
1519
|
+
}] }];
|
|
1520
|
+
}, propDecorators: { wrapperSelector: [{
|
|
1521
|
+
type: Input
|
|
1522
|
+
}], messageSelector: [{
|
|
1523
|
+
type: Input
|
|
1524
|
+
}], hintSelector: [{
|
|
1525
|
+
type: Input
|
|
1526
|
+
}], labelSelector: [{
|
|
1527
|
+
type: Input
|
|
1528
|
+
}], appendMessageClass: [{
|
|
1529
|
+
type: Input
|
|
1530
|
+
}], appendLabelClass: [{
|
|
1531
|
+
type: Input
|
|
1532
|
+
}], appendErrorClass: [{
|
|
1533
|
+
type: Input
|
|
1534
|
+
}], appendHintClass: [{
|
|
1535
|
+
type: Input
|
|
1536
|
+
}], validateMessages: [{
|
|
1537
|
+
type: Input
|
|
1540
1538
|
}] } });
|
|
1541
1539
|
|
|
1542
|
-
class FsFormCompareDirective extends FsControlDirective {
|
|
1543
|
-
set validationMessage(value) {
|
|
1544
|
-
this._validateMessages.compare = value;
|
|
1545
|
-
}
|
|
1546
|
-
ngOnChanges() {
|
|
1547
|
-
this._control.updateValueAndValidity();
|
|
1548
|
-
}
|
|
1549
|
-
validate(control) {
|
|
1550
|
-
if (this.fsFormCompare.value === this._elementRef.nativeElement.value) {
|
|
1551
|
-
return null;
|
|
1552
|
-
}
|
|
1553
|
-
return { compare: true };
|
|
1554
|
-
}
|
|
1555
|
-
ngAfterViewInit() {
|
|
1556
|
-
this.fsFormCompare.addEventListener('keyup', () => {
|
|
1557
|
-
this._control.updateValueAndValidity();
|
|
1558
|
-
}, false);
|
|
1559
|
-
}
|
|
1560
|
-
ngOnDestroy() {
|
|
1561
|
-
this.fsFormCompare.removeEventListener('keyup', () => {
|
|
1562
|
-
this._control.updateValueAndValidity();
|
|
1563
|
-
}, false);
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1567
|
-
FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1568
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1569
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1570
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1571
|
-
type: Directive,
|
|
1572
|
-
args: [{
|
|
1573
|
-
selector: '[fsFormCompare]',
|
|
1574
|
-
providers: [
|
|
1575
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1576
|
-
],
|
|
1577
|
-
}]
|
|
1578
|
-
}], propDecorators: { fsFormCompare: [{
|
|
1579
|
-
type: Input
|
|
1580
|
-
}], validationMessage: [{
|
|
1581
|
-
type: Input,
|
|
1582
|
-
args: ['fsFormCompareMessage']
|
|
1540
|
+
class FsFormCompareDirective extends FsControlDirective {
|
|
1541
|
+
set validationMessage(value) {
|
|
1542
|
+
this._validateMessages.compare = value;
|
|
1543
|
+
}
|
|
1544
|
+
ngOnChanges() {
|
|
1545
|
+
this._control.updateValueAndValidity();
|
|
1546
|
+
}
|
|
1547
|
+
validate(control) {
|
|
1548
|
+
if (this.fsFormCompare.value === this._elementRef.nativeElement.value) {
|
|
1549
|
+
return null;
|
|
1550
|
+
}
|
|
1551
|
+
return { compare: true };
|
|
1552
|
+
}
|
|
1553
|
+
ngAfterViewInit() {
|
|
1554
|
+
this.fsFormCompare.addEventListener('keyup', () => {
|
|
1555
|
+
this._control.updateValueAndValidity();
|
|
1556
|
+
}, false);
|
|
1557
|
+
}
|
|
1558
|
+
ngOnDestroy() {
|
|
1559
|
+
this.fsFormCompare.removeEventListener('keyup', () => {
|
|
1560
|
+
this._control.updateValueAndValidity();
|
|
1561
|
+
}, false);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1565
|
+
FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
|
|
1566
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1567
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormCompareDirective, decorators: [{
|
|
1569
|
+
type: Directive,
|
|
1570
|
+
args: [{
|
|
1571
|
+
selector: '[fsFormCompare]',
|
|
1572
|
+
providers: [
|
|
1573
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1574
|
+
],
|
|
1575
|
+
}]
|
|
1576
|
+
}], propDecorators: { fsFormCompare: [{
|
|
1577
|
+
type: Input
|
|
1578
|
+
}], validationMessage: [{
|
|
1579
|
+
type: Input,
|
|
1580
|
+
args: ['fsFormCompareMessage']
|
|
1583
1581
|
}] } });
|
|
1584
1582
|
|
|
1585
|
-
class FsValidators {
|
|
1586
|
-
static email(control) {
|
|
1587
|
-
if (!control.value || email(control.value)) {
|
|
1588
|
-
return null;
|
|
1589
|
-
}
|
|
1590
|
-
return { email: true };
|
|
1591
|
-
}
|
|
1592
|
-
static emails(control) {
|
|
1593
|
-
const model = control.value || '';
|
|
1594
|
-
const hasInvalidEmails = model
|
|
1595
|
-
.split(',')
|
|
1596
|
-
.some((part) => !email(part));
|
|
1597
|
-
return hasInvalidEmails ? { email: true } : null;
|
|
1598
|
-
}
|
|
1599
|
-
static numeric(control) {
|
|
1600
|
-
if (isEmpty(control.value) || isNumeric(control.value)) {
|
|
1601
|
-
return null;
|
|
1602
|
-
}
|
|
1603
|
-
return { numeric: true };
|
|
1604
|
-
}
|
|
1605
|
-
static integer(control) {
|
|
1606
|
-
if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
|
|
1607
|
-
return null;
|
|
1608
|
-
}
|
|
1609
|
-
return { integer: true };
|
|
1610
|
-
}
|
|
1611
|
-
static phone(control) {
|
|
1612
|
-
if (!control.value || phone(control.value)) {
|
|
1613
|
-
return null;
|
|
1614
|
-
}
|
|
1615
|
-
return { phone: true };
|
|
1616
|
-
}
|
|
1617
|
-
static url(control, protocolRequired = false) {
|
|
1618
|
-
if (!control.value) {
|
|
1619
|
-
return null;
|
|
1620
|
-
}
|
|
1621
|
-
if (!url(control.value)) {
|
|
1622
|
-
return { url: true };
|
|
1623
|
-
}
|
|
1624
|
-
if (protocolRequired) {
|
|
1625
|
-
const pattern = new RegExp(/^http(s)?:\/\//gm);
|
|
1626
|
-
if (!String(control.value).match(pattern)) {
|
|
1627
|
-
return { urlProtocol: true };
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
return null;
|
|
1631
|
-
}
|
|
1632
|
-
static dateRange(control) {
|
|
1633
|
-
if (!control.value) {
|
|
1634
|
-
return null;
|
|
1635
|
-
}
|
|
1636
|
-
if (isObject(control.value)) {
|
|
1637
|
-
const start = control.value.start;
|
|
1638
|
-
const end = control.value.end;
|
|
1639
|
-
if ((!start && !end) || (isValid(start) && isValid(end))) {
|
|
1640
|
-
return null;
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
return { dateRange: true };
|
|
1644
|
-
}
|
|
1645
|
-
static func(control, formFunction, data) {
|
|
1646
|
-
let result;
|
|
1647
|
-
let stream$;
|
|
1648
|
-
try {
|
|
1649
|
-
result = formFunction(control, data);
|
|
1650
|
-
}
|
|
1651
|
-
catch (err) {
|
|
1652
|
-
const error = err instanceof Error ? err.message : err;
|
|
1653
|
-
stream$ = throwError(error);
|
|
1654
|
-
}
|
|
1655
|
-
if (!stream$) {
|
|
1656
|
-
if (result instanceof Promise) {
|
|
1657
|
-
stream$ = from(result);
|
|
1658
|
-
}
|
|
1659
|
-
else if (isObservable(result)) {
|
|
1660
|
-
stream$ = result;
|
|
1661
|
-
}
|
|
1662
|
-
else {
|
|
1663
|
-
stream$ = of(null);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
return stream$
|
|
1667
|
-
.pipe(mapTo(null), catchError((err) => {
|
|
1668
|
-
return of({ validationError: err });
|
|
1669
|
-
}), take(1));
|
|
1670
|
-
}
|
|
1583
|
+
class FsValidators {
|
|
1584
|
+
static email(control) {
|
|
1585
|
+
if (!control.value || email(control.value)) {
|
|
1586
|
+
return null;
|
|
1587
|
+
}
|
|
1588
|
+
return { email: true };
|
|
1589
|
+
}
|
|
1590
|
+
static emails(control) {
|
|
1591
|
+
const model = control.value || '';
|
|
1592
|
+
const hasInvalidEmails = model
|
|
1593
|
+
.split(',')
|
|
1594
|
+
.some((part) => !email(part));
|
|
1595
|
+
return hasInvalidEmails ? { email: true } : null;
|
|
1596
|
+
}
|
|
1597
|
+
static numeric(control) {
|
|
1598
|
+
if (isEmpty(control.value) || isNumeric(control.value)) {
|
|
1599
|
+
return null;
|
|
1600
|
+
}
|
|
1601
|
+
return { numeric: true };
|
|
1602
|
+
}
|
|
1603
|
+
static integer(control) {
|
|
1604
|
+
if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
|
|
1605
|
+
return null;
|
|
1606
|
+
}
|
|
1607
|
+
return { integer: true };
|
|
1608
|
+
}
|
|
1609
|
+
static phone(control) {
|
|
1610
|
+
if (!control.value || phone(control.value)) {
|
|
1611
|
+
return null;
|
|
1612
|
+
}
|
|
1613
|
+
return { phone: true };
|
|
1614
|
+
}
|
|
1615
|
+
static url(control, protocolRequired = false) {
|
|
1616
|
+
if (!control.value) {
|
|
1617
|
+
return null;
|
|
1618
|
+
}
|
|
1619
|
+
if (!url(control.value)) {
|
|
1620
|
+
return { url: true };
|
|
1621
|
+
}
|
|
1622
|
+
if (protocolRequired) {
|
|
1623
|
+
const pattern = new RegExp(/^http(s)?:\/\//gm);
|
|
1624
|
+
if (!String(control.value).match(pattern)) {
|
|
1625
|
+
return { urlProtocol: true };
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
return null;
|
|
1629
|
+
}
|
|
1630
|
+
static dateRange(control) {
|
|
1631
|
+
if (!control.value) {
|
|
1632
|
+
return null;
|
|
1633
|
+
}
|
|
1634
|
+
if (isObject(control.value)) {
|
|
1635
|
+
const start = control.value.start;
|
|
1636
|
+
const end = control.value.end;
|
|
1637
|
+
if ((!start && !end) || (isValid(start) && isValid(end))) {
|
|
1638
|
+
return null;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
return { dateRange: true };
|
|
1642
|
+
}
|
|
1643
|
+
static func(control, formFunction, data) {
|
|
1644
|
+
let result;
|
|
1645
|
+
let stream$;
|
|
1646
|
+
try {
|
|
1647
|
+
result = formFunction(control, data);
|
|
1648
|
+
}
|
|
1649
|
+
catch (err) {
|
|
1650
|
+
const error = err instanceof Error ? err.message : err;
|
|
1651
|
+
stream$ = throwError(error);
|
|
1652
|
+
}
|
|
1653
|
+
if (!stream$) {
|
|
1654
|
+
if (result instanceof Promise) {
|
|
1655
|
+
stream$ = from(result);
|
|
1656
|
+
}
|
|
1657
|
+
else if (isObservable(result)) {
|
|
1658
|
+
stream$ = result;
|
|
1659
|
+
}
|
|
1660
|
+
else {
|
|
1661
|
+
stream$ = of(null);
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
return stream$
|
|
1665
|
+
.pipe(mapTo(null), catchError((err) => {
|
|
1666
|
+
return of({ validationError: err });
|
|
1667
|
+
}), take(1));
|
|
1668
|
+
}
|
|
1671
1669
|
}
|
|
1672
1670
|
|
|
1673
|
-
function isEnabled(value) {
|
|
1674
|
-
return value !== 'false' && (value || value === '');
|
|
1671
|
+
function isEnabled(value) {
|
|
1672
|
+
return value !== 'false' && (value || value === '');
|
|
1675
1673
|
}
|
|
1676
1674
|
|
|
1677
|
-
class FsFormDateRangeDirective extends FsControlDirective {
|
|
1678
|
-
set validationMessage(value) {
|
|
1679
|
-
this._validateMessages.dateRange = value;
|
|
1680
|
-
}
|
|
1681
|
-
ngOnChanges() {
|
|
1682
|
-
this._control.updateValueAndValidity();
|
|
1683
|
-
}
|
|
1684
|
-
validate(control) {
|
|
1685
|
-
if (isEnabled(this.fsFormDateRange)) {
|
|
1686
|
-
return FsValidators.dateRange(this._control);
|
|
1687
|
-
}
|
|
1688
|
-
else {
|
|
1689
|
-
return null;
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1694
|
-
FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1695
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1696
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1697
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1698
|
-
type: Directive,
|
|
1699
|
-
args: [{
|
|
1700
|
-
selector: '[fsFormDateRange]',
|
|
1701
|
-
providers: [
|
|
1702
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1703
|
-
],
|
|
1704
|
-
}]
|
|
1705
|
-
}], propDecorators: { fsFormDateRange: [{
|
|
1706
|
-
type: Input
|
|
1707
|
-
}], validationMessage: [{
|
|
1708
|
-
type: Input,
|
|
1709
|
-
args: ['fsFormDateRangeMessage']
|
|
1675
|
+
class FsFormDateRangeDirective extends FsControlDirective {
|
|
1676
|
+
set validationMessage(value) {
|
|
1677
|
+
this._validateMessages.dateRange = value;
|
|
1678
|
+
}
|
|
1679
|
+
ngOnChanges() {
|
|
1680
|
+
this._control.updateValueAndValidity();
|
|
1681
|
+
}
|
|
1682
|
+
validate(control) {
|
|
1683
|
+
if (isEnabled(this.fsFormDateRange)) {
|
|
1684
|
+
return FsValidators.dateRange(this._control);
|
|
1685
|
+
}
|
|
1686
|
+
else {
|
|
1687
|
+
return null;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1692
|
+
FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
|
|
1693
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1694
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDateRangeDirective, decorators: [{
|
|
1696
|
+
type: Directive,
|
|
1697
|
+
args: [{
|
|
1698
|
+
selector: '[fsFormDateRange]',
|
|
1699
|
+
providers: [
|
|
1700
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1701
|
+
],
|
|
1702
|
+
}]
|
|
1703
|
+
}], propDecorators: { fsFormDateRange: [{
|
|
1704
|
+
type: Input
|
|
1705
|
+
}], validationMessage: [{
|
|
1706
|
+
type: Input,
|
|
1707
|
+
args: ['fsFormDateRangeMessage']
|
|
1710
1708
|
}] } });
|
|
1711
1709
|
|
|
1712
|
-
class FsFormEmailDirective extends FsControlDirective {
|
|
1713
|
-
set validationMessage(value) {
|
|
1714
|
-
this._validateMessages.email = value;
|
|
1715
|
-
}
|
|
1716
|
-
ngOnChanges() {
|
|
1717
|
-
this._control.updateValueAndValidity();
|
|
1718
|
-
}
|
|
1719
|
-
validate(control) {
|
|
1720
|
-
if (isEnabled(this.fsFormEmail)) {
|
|
1721
|
-
return FsValidators.email(this._control);
|
|
1722
|
-
}
|
|
1723
|
-
else {
|
|
1724
|
-
return null;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1729
|
-
FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1730
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1731
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1732
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1733
|
-
type: Directive,
|
|
1734
|
-
args: [{
|
|
1735
|
-
selector: '[fsFormEmail]',
|
|
1736
|
-
providers: [
|
|
1737
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1738
|
-
],
|
|
1739
|
-
}]
|
|
1740
|
-
}], propDecorators: { fsFormEmail: [{
|
|
1741
|
-
type: Input
|
|
1742
|
-
}], validationMessage: [{
|
|
1743
|
-
type: Input,
|
|
1744
|
-
args: ['fsFormEmailMessage']
|
|
1710
|
+
class FsFormEmailDirective extends FsControlDirective {
|
|
1711
|
+
set validationMessage(value) {
|
|
1712
|
+
this._validateMessages.email = value;
|
|
1713
|
+
}
|
|
1714
|
+
ngOnChanges() {
|
|
1715
|
+
this._control.updateValueAndValidity();
|
|
1716
|
+
}
|
|
1717
|
+
validate(control) {
|
|
1718
|
+
if (isEnabled(this.fsFormEmail)) {
|
|
1719
|
+
return FsValidators.email(this._control);
|
|
1720
|
+
}
|
|
1721
|
+
else {
|
|
1722
|
+
return null;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1727
|
+
FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
|
|
1728
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1729
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1730
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormEmailDirective, decorators: [{
|
|
1731
|
+
type: Directive,
|
|
1732
|
+
args: [{
|
|
1733
|
+
selector: '[fsFormEmail]',
|
|
1734
|
+
providers: [
|
|
1735
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1736
|
+
],
|
|
1737
|
+
}]
|
|
1738
|
+
}], propDecorators: { fsFormEmail: [{
|
|
1739
|
+
type: Input
|
|
1740
|
+
}], validationMessage: [{
|
|
1741
|
+
type: Input,
|
|
1742
|
+
args: ['fsFormEmailMessage']
|
|
1745
1743
|
}] } });
|
|
1746
1744
|
|
|
1747
|
-
class FsFormEmailsDirective extends FsControlDirective {
|
|
1748
|
-
set validationMessage(value) {
|
|
1749
|
-
this._validateMessages.emails = value;
|
|
1750
|
-
}
|
|
1751
|
-
ngOnChanges() {
|
|
1752
|
-
this._control.updateValueAndValidity();
|
|
1753
|
-
}
|
|
1754
|
-
validate(control) {
|
|
1755
|
-
if (isEnabled(this.fsFormEmails)) {
|
|
1756
|
-
return FsValidators.emails(this._control);
|
|
1757
|
-
}
|
|
1758
|
-
else {
|
|
1759
|
-
return null;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1764
|
-
FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1765
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1766
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1767
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1768
|
-
type: Directive,
|
|
1769
|
-
args: [{
|
|
1770
|
-
selector: '[fsFormEmails]',
|
|
1771
|
-
providers: [
|
|
1772
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1773
|
-
],
|
|
1774
|
-
}]
|
|
1775
|
-
}], propDecorators: { fsFormEmails: [{
|
|
1776
|
-
type: Input
|
|
1777
|
-
}], validationMessage: [{
|
|
1778
|
-
type: Input,
|
|
1779
|
-
args: ['fsFormEmailsMessage']
|
|
1745
|
+
class FsFormEmailsDirective extends FsControlDirective {
|
|
1746
|
+
set validationMessage(value) {
|
|
1747
|
+
this._validateMessages.emails = value;
|
|
1748
|
+
}
|
|
1749
|
+
ngOnChanges() {
|
|
1750
|
+
this._control.updateValueAndValidity();
|
|
1751
|
+
}
|
|
1752
|
+
validate(control) {
|
|
1753
|
+
if (isEnabled(this.fsFormEmails)) {
|
|
1754
|
+
return FsValidators.emails(this._control);
|
|
1755
|
+
}
|
|
1756
|
+
else {
|
|
1757
|
+
return null;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1762
|
+
FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
|
|
1763
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1764
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormEmailsDirective, decorators: [{
|
|
1766
|
+
type: Directive,
|
|
1767
|
+
args: [{
|
|
1768
|
+
selector: '[fsFormEmails]',
|
|
1769
|
+
providers: [
|
|
1770
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1771
|
+
],
|
|
1772
|
+
}]
|
|
1773
|
+
}], propDecorators: { fsFormEmails: [{
|
|
1774
|
+
type: Input
|
|
1775
|
+
}], validationMessage: [{
|
|
1776
|
+
type: Input,
|
|
1777
|
+
args: ['fsFormEmailsMessage']
|
|
1780
1778
|
}] } });
|
|
1781
1779
|
|
|
1782
|
-
class FsFormFunctionDirective extends FsControlDirective {
|
|
1783
|
-
constructor() {
|
|
1784
|
-
super(...arguments);
|
|
1785
|
-
this.validateOnSubmit = false;
|
|
1786
|
-
}
|
|
1787
|
-
ngOnChanges() {
|
|
1788
|
-
this._control.updateValueAndValidity();
|
|
1789
|
-
}
|
|
1790
|
-
validateAsync(control) {
|
|
1791
|
-
if (this.validateOnSubmit && !this.formDirective.validating) {
|
|
1792
|
-
return of(null);
|
|
1793
|
-
}
|
|
1794
|
-
return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1798
|
-
FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1799
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1800
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1801
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1802
|
-
type: Directive,
|
|
1803
|
-
args: [{
|
|
1804
|
-
selector: '[fsFormFunction]',
|
|
1805
|
-
providers: [
|
|
1806
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1807
|
-
],
|
|
1808
|
-
}]
|
|
1809
|
-
}], propDecorators: { fsFormFunction: [{
|
|
1810
|
-
type: Input
|
|
1811
|
-
}], fsFormFunctionData: [{
|
|
1812
|
-
type: Input
|
|
1813
|
-
}], validateOnSubmit: [{
|
|
1814
|
-
type: Input
|
|
1780
|
+
class FsFormFunctionDirective extends FsControlDirective {
|
|
1781
|
+
constructor() {
|
|
1782
|
+
super(...arguments);
|
|
1783
|
+
this.validateOnSubmit = false;
|
|
1784
|
+
}
|
|
1785
|
+
ngOnChanges() {
|
|
1786
|
+
this._control.updateValueAndValidity();
|
|
1787
|
+
}
|
|
1788
|
+
validateAsync(control) {
|
|
1789
|
+
if (this.validateOnSubmit && !this.formDirective.validating) {
|
|
1790
|
+
return of(null);
|
|
1791
|
+
}
|
|
1792
|
+
return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1796
|
+
FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
|
|
1797
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1798
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1799
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormFunctionDirective, decorators: [{
|
|
1800
|
+
type: Directive,
|
|
1801
|
+
args: [{
|
|
1802
|
+
selector: '[fsFormFunction]',
|
|
1803
|
+
providers: [
|
|
1804
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1805
|
+
],
|
|
1806
|
+
}]
|
|
1807
|
+
}], propDecorators: { fsFormFunction: [{
|
|
1808
|
+
type: Input
|
|
1809
|
+
}], fsFormFunctionData: [{
|
|
1810
|
+
type: Input
|
|
1811
|
+
}], validateOnSubmit: [{
|
|
1812
|
+
type: Input
|
|
1815
1813
|
}] } });
|
|
1816
1814
|
|
|
1817
|
-
class FsFormGreaterEqualDirective extends FsControlDirective {
|
|
1818
|
-
set validationMessage(value) {
|
|
1819
|
-
this._validateMessages.greater = value;
|
|
1820
|
-
}
|
|
1821
|
-
ngOnChanges() {
|
|
1822
|
-
this._control.updateValueAndValidity();
|
|
1823
|
-
}
|
|
1824
|
-
validate(control) {
|
|
1825
|
-
const greater = parseFloat(this.fsFormGreaterEqual);
|
|
1826
|
-
const value = parseFloat(this._control.value);
|
|
1827
|
-
if (!isNaN(greater) && !isNaN(value) && value < greater) {
|
|
1828
|
-
return { greaterEqual: { greater, actual: value } };
|
|
1829
|
-
}
|
|
1830
|
-
return FsValidators.numeric(this._control);
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
FsFormGreaterEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1834
|
-
FsFormGreaterEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1835
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1836
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1837
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1838
|
-
type: Directive,
|
|
1839
|
-
args: [{
|
|
1840
|
-
selector: '[fsFormGreaterEqual]',
|
|
1841
|
-
providers: [
|
|
1842
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1843
|
-
],
|
|
1844
|
-
}]
|
|
1845
|
-
}], propDecorators: { fsFormGreaterEqual: [{
|
|
1846
|
-
type: Input
|
|
1847
|
-
}], validationMessage: [{
|
|
1848
|
-
type: Input,
|
|
1849
|
-
args: ['fsFormGreaterEqualMessage']
|
|
1815
|
+
class FsFormGreaterEqualDirective extends FsControlDirective {
|
|
1816
|
+
set validationMessage(value) {
|
|
1817
|
+
this._validateMessages.greater = value;
|
|
1818
|
+
}
|
|
1819
|
+
ngOnChanges() {
|
|
1820
|
+
this._control.updateValueAndValidity();
|
|
1821
|
+
}
|
|
1822
|
+
validate(control) {
|
|
1823
|
+
const greater = parseFloat(this.fsFormGreaterEqual);
|
|
1824
|
+
const value = parseFloat(this._control.value);
|
|
1825
|
+
if (!isNaN(greater) && !isNaN(value) && value < greater) {
|
|
1826
|
+
return { greaterEqual: { greater, actual: value } };
|
|
1827
|
+
}
|
|
1828
|
+
return FsValidators.numeric(this._control);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
FsFormGreaterEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormGreaterEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1832
|
+
FsFormGreaterEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormGreaterEqualDirective, selector: "[fsFormGreaterEqual]", inputs: { fsFormGreaterEqual: "fsFormGreaterEqual", validationMessage: ["fsFormGreaterEqualMessage", "validationMessage"] }, providers: [
|
|
1833
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1834
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1835
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormGreaterEqualDirective, decorators: [{
|
|
1836
|
+
type: Directive,
|
|
1837
|
+
args: [{
|
|
1838
|
+
selector: '[fsFormGreaterEqual]',
|
|
1839
|
+
providers: [
|
|
1840
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1841
|
+
],
|
|
1842
|
+
}]
|
|
1843
|
+
}], propDecorators: { fsFormGreaterEqual: [{
|
|
1844
|
+
type: Input
|
|
1845
|
+
}], validationMessage: [{
|
|
1846
|
+
type: Input,
|
|
1847
|
+
args: ['fsFormGreaterEqualMessage']
|
|
1850
1848
|
}] } });
|
|
1851
1849
|
|
|
1852
|
-
class FsFormGreaterDirective extends FsControlDirective {
|
|
1853
|
-
set validationMessage(value) {
|
|
1854
|
-
this._validateMessages.greater = value;
|
|
1855
|
-
}
|
|
1856
|
-
ngOnChanges() {
|
|
1857
|
-
this._control.updateValueAndValidity();
|
|
1858
|
-
}
|
|
1859
|
-
validate(control) {
|
|
1860
|
-
const greater = parseFloat(this.fsFormGreater);
|
|
1861
|
-
const value = parseFloat(this._control.value);
|
|
1862
|
-
if (!isNaN(greater) && !isNaN(value) && value <= greater) {
|
|
1863
|
-
return { greater: { greater, actual: value } };
|
|
1864
|
-
}
|
|
1865
|
-
return FsValidators.numeric(this._control);
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1869
|
-
FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1870
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1871
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1872
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1873
|
-
type: Directive,
|
|
1874
|
-
args: [{
|
|
1875
|
-
selector: '[fsFormGreater]',
|
|
1876
|
-
providers: [
|
|
1877
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1878
|
-
],
|
|
1879
|
-
}]
|
|
1880
|
-
}], propDecorators: { fsFormGreater: [{
|
|
1881
|
-
type: Input
|
|
1882
|
-
}], validationMessage: [{
|
|
1883
|
-
type: Input,
|
|
1884
|
-
args: ['fsFormGreaterMessage']
|
|
1850
|
+
class FsFormGreaterDirective extends FsControlDirective {
|
|
1851
|
+
set validationMessage(value) {
|
|
1852
|
+
this._validateMessages.greater = value;
|
|
1853
|
+
}
|
|
1854
|
+
ngOnChanges() {
|
|
1855
|
+
this._control.updateValueAndValidity();
|
|
1856
|
+
}
|
|
1857
|
+
validate(control) {
|
|
1858
|
+
const greater = parseFloat(this.fsFormGreater);
|
|
1859
|
+
const value = parseFloat(this._control.value);
|
|
1860
|
+
if (!isNaN(greater) && !isNaN(value) && value <= greater) {
|
|
1861
|
+
return { greater: { greater, actual: value } };
|
|
1862
|
+
}
|
|
1863
|
+
return FsValidators.numeric(this._control);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1867
|
+
FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
|
|
1868
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1869
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1870
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormGreaterDirective, decorators: [{
|
|
1871
|
+
type: Directive,
|
|
1872
|
+
args: [{
|
|
1873
|
+
selector: '[fsFormGreater]',
|
|
1874
|
+
providers: [
|
|
1875
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1876
|
+
],
|
|
1877
|
+
}]
|
|
1878
|
+
}], propDecorators: { fsFormGreater: [{
|
|
1879
|
+
type: Input
|
|
1880
|
+
}], validationMessage: [{
|
|
1881
|
+
type: Input,
|
|
1882
|
+
args: ['fsFormGreaterMessage']
|
|
1885
1883
|
}] } });
|
|
1886
1884
|
|
|
1887
|
-
class FsFormIntegerDirective extends FsControlDirective {
|
|
1888
|
-
set validationMessage(value) {
|
|
1889
|
-
this._validateMessages.integer = value;
|
|
1890
|
-
}
|
|
1891
|
-
ngOnChanges() {
|
|
1892
|
-
this._control.updateValueAndValidity();
|
|
1893
|
-
}
|
|
1894
|
-
validate(control) {
|
|
1895
|
-
if (isEnabled(this.fsFormInteger)) {
|
|
1896
|
-
return FsValidators.integer(this._control);
|
|
1897
|
-
}
|
|
1898
|
-
return null;
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1902
|
-
FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1903
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1904
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1905
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1906
|
-
type: Directive,
|
|
1907
|
-
args: [{
|
|
1908
|
-
selector: '[fsFormInteger]',
|
|
1909
|
-
providers: [
|
|
1910
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
1911
|
-
],
|
|
1912
|
-
}]
|
|
1913
|
-
}], propDecorators: { fsFormInteger: [{
|
|
1914
|
-
type: Input
|
|
1915
|
-
}], validationMessage: [{
|
|
1916
|
-
type: Input,
|
|
1917
|
-
args: ['fsFormIntegerMessage']
|
|
1885
|
+
class FsFormIntegerDirective extends FsControlDirective {
|
|
1886
|
+
set validationMessage(value) {
|
|
1887
|
+
this._validateMessages.integer = value;
|
|
1888
|
+
}
|
|
1889
|
+
ngOnChanges() {
|
|
1890
|
+
this._control.updateValueAndValidity();
|
|
1891
|
+
}
|
|
1892
|
+
validate(control) {
|
|
1893
|
+
if (isEnabled(this.fsFormInteger)) {
|
|
1894
|
+
return FsValidators.integer(this._control);
|
|
1895
|
+
}
|
|
1896
|
+
return null;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1900
|
+
FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
|
|
1901
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1902
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormIntegerDirective, decorators: [{
|
|
1904
|
+
type: Directive,
|
|
1905
|
+
args: [{
|
|
1906
|
+
selector: '[fsFormInteger]',
|
|
1907
|
+
providers: [
|
|
1908
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1909
|
+
],
|
|
1910
|
+
}]
|
|
1911
|
+
}], propDecorators: { fsFormInteger: [{
|
|
1912
|
+
type: Input
|
|
1913
|
+
}], validationMessage: [{
|
|
1914
|
+
type: Input,
|
|
1915
|
+
args: ['fsFormIntegerMessage']
|
|
1918
1916
|
}] } });
|
|
1919
1917
|
|
|
1920
|
-
class FsFormLesserEqualDirective extends FsControlDirective {
|
|
1921
|
-
set validationMessage(value) {
|
|
1922
|
-
this._validateMessages.lesser = value;
|
|
1923
|
-
}
|
|
1924
|
-
ngOnChanges() {
|
|
1925
|
-
this._control.updateValueAndValidity();
|
|
1926
|
-
}
|
|
1927
|
-
validate(control) {
|
|
1928
|
-
const lesser = parseFloat(this.fsFormLesserEqual);
|
|
1929
|
-
const value = parseFloat(this._control.value);
|
|
1930
|
-
if (!isNaN(lesser) && !isNaN(value) && value > lesser) {
|
|
1931
|
-
return { lesserEqual: { lesser, actual: value } };
|
|
1932
|
-
}
|
|
1933
|
-
return FsValidators.numeric(this._control);
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
FsFormLesserEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1937
|
-
FsFormLesserEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1938
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1939
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1940
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1941
|
-
type: Directive,
|
|
1942
|
-
args: [{
|
|
1943
|
-
selector: '[fsFormLesserEqual]',
|
|
1944
|
-
providers: [
|
|
1945
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1946
|
-
],
|
|
1947
|
-
}]
|
|
1948
|
-
}], propDecorators: { fsFormLesserEqual: [{
|
|
1949
|
-
type: Input
|
|
1950
|
-
}], validationMessage: [{
|
|
1951
|
-
type: Input,
|
|
1952
|
-
args: ['fsFormLesserEqualMessage']
|
|
1918
|
+
class FsFormLesserEqualDirective extends FsControlDirective {
|
|
1919
|
+
set validationMessage(value) {
|
|
1920
|
+
this._validateMessages.lesser = value;
|
|
1921
|
+
}
|
|
1922
|
+
ngOnChanges() {
|
|
1923
|
+
this._control.updateValueAndValidity();
|
|
1924
|
+
}
|
|
1925
|
+
validate(control) {
|
|
1926
|
+
const lesser = parseFloat(this.fsFormLesserEqual);
|
|
1927
|
+
const value = parseFloat(this._control.value);
|
|
1928
|
+
if (!isNaN(lesser) && !isNaN(value) && value > lesser) {
|
|
1929
|
+
return { lesserEqual: { lesser, actual: value } };
|
|
1930
|
+
}
|
|
1931
|
+
return FsValidators.numeric(this._control);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
FsFormLesserEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormLesserEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1935
|
+
FsFormLesserEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormLesserEqualDirective, selector: "[fsFormLesserEqual]", inputs: { fsFormLesserEqual: "fsFormLesserEqual", validationMessage: ["fsFormLesserEqualMessage", "validationMessage"] }, providers: [
|
|
1936
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1937
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormLesserEqualDirective, decorators: [{
|
|
1939
|
+
type: Directive,
|
|
1940
|
+
args: [{
|
|
1941
|
+
selector: '[fsFormLesserEqual]',
|
|
1942
|
+
providers: [
|
|
1943
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1944
|
+
],
|
|
1945
|
+
}]
|
|
1946
|
+
}], propDecorators: { fsFormLesserEqual: [{
|
|
1947
|
+
type: Input
|
|
1948
|
+
}], validationMessage: [{
|
|
1949
|
+
type: Input,
|
|
1950
|
+
args: ['fsFormLesserEqualMessage']
|
|
1953
1951
|
}] } });
|
|
1954
1952
|
|
|
1955
|
-
class FsFormLesserDirective extends FsControlDirective {
|
|
1956
|
-
set validationMessage(value) {
|
|
1957
|
-
this._validateMessages.lesser = value;
|
|
1958
|
-
}
|
|
1959
|
-
ngOnChanges() {
|
|
1960
|
-
this._control.updateValueAndValidity();
|
|
1961
|
-
}
|
|
1962
|
-
validate(control) {
|
|
1963
|
-
const lesser = parseFloat(this.fsFormLesser);
|
|
1964
|
-
const value = parseFloat(this._control.value);
|
|
1965
|
-
if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
|
|
1966
|
-
return { lesser: { lesser, actual: value } };
|
|
1967
|
-
}
|
|
1968
|
-
return FsValidators.numeric(this._control);
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1972
|
-
FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1973
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1974
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1975
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1976
|
-
type: Directive,
|
|
1977
|
-
args: [{
|
|
1978
|
-
selector: '[fsFormLesser]',
|
|
1979
|
-
providers: [
|
|
1980
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1981
|
-
],
|
|
1982
|
-
}]
|
|
1983
|
-
}], propDecorators: { fsFormLesser: [{
|
|
1984
|
-
type: Input
|
|
1985
|
-
}], validationMessage: [{
|
|
1986
|
-
type: Input,
|
|
1987
|
-
args: ['fsFormLesserMessage']
|
|
1953
|
+
class FsFormLesserDirective extends FsControlDirective {
|
|
1954
|
+
set validationMessage(value) {
|
|
1955
|
+
this._validateMessages.lesser = value;
|
|
1956
|
+
}
|
|
1957
|
+
ngOnChanges() {
|
|
1958
|
+
this._control.updateValueAndValidity();
|
|
1959
|
+
}
|
|
1960
|
+
validate(control) {
|
|
1961
|
+
const lesser = parseFloat(this.fsFormLesser);
|
|
1962
|
+
const value = parseFloat(this._control.value);
|
|
1963
|
+
if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
|
|
1964
|
+
return { lesser: { lesser, actual: value } };
|
|
1965
|
+
}
|
|
1966
|
+
return FsValidators.numeric(this._control);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1970
|
+
FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
|
|
1971
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1972
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1973
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormLesserDirective, decorators: [{
|
|
1974
|
+
type: Directive,
|
|
1975
|
+
args: [{
|
|
1976
|
+
selector: '[fsFormLesser]',
|
|
1977
|
+
providers: [
|
|
1978
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1979
|
+
],
|
|
1980
|
+
}]
|
|
1981
|
+
}], propDecorators: { fsFormLesser: [{
|
|
1982
|
+
type: Input
|
|
1983
|
+
}], validationMessage: [{
|
|
1984
|
+
type: Input,
|
|
1985
|
+
args: ['fsFormLesserMessage']
|
|
1988
1986
|
}] } });
|
|
1989
1987
|
|
|
1990
|
-
class FsFormMaxDirective extends FsControlDirective {
|
|
1991
|
-
set validationMessage(value) {
|
|
1992
|
-
this._validateMessages.max = value;
|
|
1993
|
-
}
|
|
1994
|
-
ngOnChanges() {
|
|
1995
|
-
this._control.updateValueAndValidity();
|
|
1996
|
-
}
|
|
1997
|
-
validate(control) {
|
|
1998
|
-
return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2002
|
-
FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2003
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2004
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2005
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2006
|
-
type: Directive,
|
|
2007
|
-
args: [{
|
|
2008
|
-
selector: '[fsFormMax]',
|
|
2009
|
-
providers: [
|
|
2010
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2011
|
-
],
|
|
2012
|
-
}]
|
|
2013
|
-
}], propDecorators: { fsFormMax: [{
|
|
2014
|
-
type: Input
|
|
2015
|
-
}], validationMessage: [{
|
|
2016
|
-
type: Input,
|
|
2017
|
-
args: ['fsFormMaxMessage']
|
|
1988
|
+
class FsFormMaxDirective extends FsControlDirective {
|
|
1989
|
+
set validationMessage(value) {
|
|
1990
|
+
this._validateMessages.max = value;
|
|
1991
|
+
}
|
|
1992
|
+
ngOnChanges() {
|
|
1993
|
+
this._control.updateValueAndValidity();
|
|
1994
|
+
}
|
|
1995
|
+
validate(control) {
|
|
1996
|
+
return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2000
|
+
FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
|
|
2001
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2002
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2003
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMaxDirective, decorators: [{
|
|
2004
|
+
type: Directive,
|
|
2005
|
+
args: [{
|
|
2006
|
+
selector: '[fsFormMax]',
|
|
2007
|
+
providers: [
|
|
2008
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2009
|
+
],
|
|
2010
|
+
}]
|
|
2011
|
+
}], propDecorators: { fsFormMax: [{
|
|
2012
|
+
type: Input
|
|
2013
|
+
}], validationMessage: [{
|
|
2014
|
+
type: Input,
|
|
2015
|
+
args: ['fsFormMaxMessage']
|
|
2018
2016
|
}] } });
|
|
2019
2017
|
|
|
2020
|
-
class FsFormMaxLengthDirective extends FsControlDirective {
|
|
2021
|
-
set validationMessage(value) {
|
|
2022
|
-
this._validateMessages.maxlength = value;
|
|
2023
|
-
}
|
|
2024
|
-
ngOnChanges() {
|
|
2025
|
-
this._control.updateValueAndValidity();
|
|
2026
|
-
}
|
|
2027
|
-
validate(control) {
|
|
2028
|
-
return Validators.maxLength(this.fsFormMaxLength)(this._control);
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2032
|
-
FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2033
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2034
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2035
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2036
|
-
type: Directive,
|
|
2037
|
-
args: [{
|
|
2038
|
-
selector: '[fsFormMaxLength]',
|
|
2039
|
-
providers: [
|
|
2040
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2041
|
-
],
|
|
2042
|
-
}]
|
|
2043
|
-
}], propDecorators: { fsFormMaxLength: [{
|
|
2044
|
-
type: Input
|
|
2045
|
-
}], validationMessage: [{
|
|
2046
|
-
type: Input,
|
|
2047
|
-
args: ['fsFormMaxLengthMessage']
|
|
2018
|
+
class FsFormMaxLengthDirective extends FsControlDirective {
|
|
2019
|
+
set validationMessage(value) {
|
|
2020
|
+
this._validateMessages.maxlength = value;
|
|
2021
|
+
}
|
|
2022
|
+
ngOnChanges() {
|
|
2023
|
+
this._control.updateValueAndValidity();
|
|
2024
|
+
}
|
|
2025
|
+
validate(control) {
|
|
2026
|
+
return Validators.maxLength(this.fsFormMaxLength)(this._control);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2030
|
+
FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
|
|
2031
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2032
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMaxLengthDirective, decorators: [{
|
|
2034
|
+
type: Directive,
|
|
2035
|
+
args: [{
|
|
2036
|
+
selector: '[fsFormMaxLength]',
|
|
2037
|
+
providers: [
|
|
2038
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2039
|
+
],
|
|
2040
|
+
}]
|
|
2041
|
+
}], propDecorators: { fsFormMaxLength: [{
|
|
2042
|
+
type: Input
|
|
2043
|
+
}], validationMessage: [{
|
|
2044
|
+
type: Input,
|
|
2045
|
+
args: ['fsFormMaxLengthMessage']
|
|
2048
2046
|
}] } });
|
|
2049
2047
|
|
|
2050
|
-
class FsFormMinDirective extends FsControlDirective {
|
|
2051
|
-
set validationMessage(value) {
|
|
2052
|
-
this._validateMessages.min = value;
|
|
2053
|
-
}
|
|
2054
|
-
ngOnChanges() {
|
|
2055
|
-
this._control.updateValueAndValidity();
|
|
2056
|
-
}
|
|
2057
|
-
validate(control) {
|
|
2058
|
-
return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2062
|
-
FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2063
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2064
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2065
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2066
|
-
type: Directive,
|
|
2067
|
-
args: [{
|
|
2068
|
-
selector: '[fsFormMin]',
|
|
2069
|
-
providers: [
|
|
2070
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2071
|
-
],
|
|
2072
|
-
}]
|
|
2073
|
-
}], propDecorators: { fsFormMin: [{
|
|
2074
|
-
type: Input
|
|
2075
|
-
}], validationMessage: [{
|
|
2076
|
-
type: Input,
|
|
2077
|
-
args: ['fsFormMinMessage']
|
|
2048
|
+
class FsFormMinDirective extends FsControlDirective {
|
|
2049
|
+
set validationMessage(value) {
|
|
2050
|
+
this._validateMessages.min = value;
|
|
2051
|
+
}
|
|
2052
|
+
ngOnChanges() {
|
|
2053
|
+
this._control.updateValueAndValidity();
|
|
2054
|
+
}
|
|
2055
|
+
validate(control) {
|
|
2056
|
+
return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2060
|
+
FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
|
|
2061
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2062
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMinDirective, decorators: [{
|
|
2064
|
+
type: Directive,
|
|
2065
|
+
args: [{
|
|
2066
|
+
selector: '[fsFormMin]',
|
|
2067
|
+
providers: [
|
|
2068
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2069
|
+
],
|
|
2070
|
+
}]
|
|
2071
|
+
}], propDecorators: { fsFormMin: [{
|
|
2072
|
+
type: Input
|
|
2073
|
+
}], validationMessage: [{
|
|
2074
|
+
type: Input,
|
|
2075
|
+
args: ['fsFormMinMessage']
|
|
2078
2076
|
}] } });
|
|
2079
2077
|
|
|
2080
|
-
class FsFormMinLengthDirective extends FsControlDirective {
|
|
2081
|
-
set validationMessage(value) {
|
|
2082
|
-
this._validateMessages.minlength = value;
|
|
2083
|
-
}
|
|
2084
|
-
ngOnChanges() {
|
|
2085
|
-
this._control.updateValueAndValidity();
|
|
2086
|
-
}
|
|
2087
|
-
validate(control) {
|
|
2088
|
-
return Validators.minLength(this.fsFormMinLength)(this._control);
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2092
|
-
FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2093
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2094
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2095
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2096
|
-
type: Directive,
|
|
2097
|
-
args: [{
|
|
2098
|
-
selector: '[fsFormMinLength]',
|
|
2099
|
-
providers: [
|
|
2100
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2101
|
-
],
|
|
2102
|
-
}]
|
|
2103
|
-
}], propDecorators: { fsFormMinLength: [{
|
|
2104
|
-
type: Input
|
|
2105
|
-
}], validationMessage: [{
|
|
2106
|
-
type: Input,
|
|
2107
|
-
args: ['fsFormMinLengthMessage']
|
|
2078
|
+
class FsFormMinLengthDirective extends FsControlDirective {
|
|
2079
|
+
set validationMessage(value) {
|
|
2080
|
+
this._validateMessages.minlength = value;
|
|
2081
|
+
}
|
|
2082
|
+
ngOnChanges() {
|
|
2083
|
+
this._control.updateValueAndValidity();
|
|
2084
|
+
}
|
|
2085
|
+
validate(control) {
|
|
2086
|
+
return Validators.minLength(this.fsFormMinLength)(this._control);
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2090
|
+
FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
|
|
2091
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2092
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2093
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormMinLengthDirective, decorators: [{
|
|
2094
|
+
type: Directive,
|
|
2095
|
+
args: [{
|
|
2096
|
+
selector: '[fsFormMinLength]',
|
|
2097
|
+
providers: [
|
|
2098
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2099
|
+
],
|
|
2100
|
+
}]
|
|
2101
|
+
}], propDecorators: { fsFormMinLength: [{
|
|
2102
|
+
type: Input
|
|
2103
|
+
}], validationMessage: [{
|
|
2104
|
+
type: Input,
|
|
2105
|
+
args: ['fsFormMinLengthMessage']
|
|
2108
2106
|
}] } });
|
|
2109
2107
|
|
|
2110
|
-
/**
|
|
2111
|
-
* This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
|
|
2112
|
-
*
|
|
2113
|
-
* This directive required for automatic validation messages
|
|
2114
|
-
*/
|
|
2115
|
-
class FsFormNoFsValidatorsDirective extends FsControlDirective {
|
|
2116
|
-
ngOnChanges() {
|
|
2117
|
-
this._control.updateValueAndValidity();
|
|
2118
|
-
}
|
|
2119
|
-
_subscribeToStatusChagnes() {
|
|
2120
|
-
if (!!this._control.validator || !!this._control.asyncValidator) {
|
|
2121
|
-
super._subscribeToStatusChagnes();
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2126
|
-
FsFormNoFsValidatorsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2127
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2128
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2129
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2130
|
-
type: Directive,
|
|
2131
|
-
args: [{
|
|
2132
|
-
selector: '[ngModel]' +
|
|
2133
|
-
':not([required])' +
|
|
2134
|
-
':not([fsFormRequired])' +
|
|
2135
|
-
':not([fsFormCompare])' +
|
|
2136
|
-
':not([fsFormDateRange])' +
|
|
2137
|
-
':not([fsFormEmail])' +
|
|
2138
|
-
':not([fsFormEmails])' +
|
|
2139
|
-
':not([fsFormFunction])' +
|
|
2140
|
-
':not([fsFormGreater])' +
|
|
2141
|
-
':not([fsFormGreaterEqual])' +
|
|
2142
|
-
':not([fsFormInteger])' +
|
|
2143
|
-
':not([fsFormLesser])' +
|
|
2144
|
-
':not([fsFormMax])' +
|
|
2145
|
-
':not([fsFormMaxLength])' +
|
|
2146
|
-
':not([fsFormMin])' +
|
|
2147
|
-
':not([fsFormMinLength])' +
|
|
2148
|
-
':not([fsFormNumeric])' +
|
|
2149
|
-
':not([fsFormPattern])' +
|
|
2150
|
-
':not([fsFormPhone])' +
|
|
2151
|
-
':not([fsFormUrl])' +
|
|
2152
|
-
':not([validate])',
|
|
2153
|
-
providers: [
|
|
2154
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2155
|
-
],
|
|
2156
|
-
}]
|
|
2108
|
+
/**
|
|
2109
|
+
* This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
|
|
2110
|
+
*
|
|
2111
|
+
* This directive required for automatic validation messages
|
|
2112
|
+
*/
|
|
2113
|
+
class FsFormNoFsValidatorsDirective extends FsControlDirective {
|
|
2114
|
+
ngOnChanges() {
|
|
2115
|
+
this._control.updateValueAndValidity();
|
|
2116
|
+
}
|
|
2117
|
+
_subscribeToStatusChagnes() {
|
|
2118
|
+
if (!!this._control.validator || !!this._control.asyncValidator) {
|
|
2119
|
+
super._subscribeToStatusChagnes();
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2124
|
+
FsFormNoFsValidatorsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormGreaterEqual]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])", providers: [
|
|
2125
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2126
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
|
|
2128
|
+
type: Directive,
|
|
2129
|
+
args: [{
|
|
2130
|
+
selector: '[ngModel]' +
|
|
2131
|
+
':not([required])' +
|
|
2132
|
+
':not([fsFormRequired])' +
|
|
2133
|
+
':not([fsFormCompare])' +
|
|
2134
|
+
':not([fsFormDateRange])' +
|
|
2135
|
+
':not([fsFormEmail])' +
|
|
2136
|
+
':not([fsFormEmails])' +
|
|
2137
|
+
':not([fsFormFunction])' +
|
|
2138
|
+
':not([fsFormGreater])' +
|
|
2139
|
+
':not([fsFormGreaterEqual])' +
|
|
2140
|
+
':not([fsFormInteger])' +
|
|
2141
|
+
':not([fsFormLesser])' +
|
|
2142
|
+
':not([fsFormMax])' +
|
|
2143
|
+
':not([fsFormMaxLength])' +
|
|
2144
|
+
':not([fsFormMin])' +
|
|
2145
|
+
':not([fsFormMinLength])' +
|
|
2146
|
+
':not([fsFormNumeric])' +
|
|
2147
|
+
':not([fsFormPattern])' +
|
|
2148
|
+
':not([fsFormPhone])' +
|
|
2149
|
+
':not([fsFormUrl])' +
|
|
2150
|
+
':not([validate])',
|
|
2151
|
+
providers: [
|
|
2152
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2153
|
+
],
|
|
2154
|
+
}]
|
|
2157
2155
|
}] });
|
|
2158
2156
|
|
|
2159
|
-
class FsFormNumericDirective extends FsControlDirective {
|
|
2160
|
-
set validationMessage(value) {
|
|
2161
|
-
this._validateMessages.numeric = value;
|
|
2162
|
-
}
|
|
2163
|
-
ngOnChanges() {
|
|
2164
|
-
this._control.updateValueAndValidity();
|
|
2165
|
-
}
|
|
2166
|
-
validate(control) {
|
|
2167
|
-
if (isEnabled(this.fsFormNumeric)) {
|
|
2168
|
-
return FsValidators.numeric(this._control);
|
|
2169
|
-
}
|
|
2170
|
-
else {
|
|
2171
|
-
return null;
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2176
|
-
FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2177
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2178
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2179
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2180
|
-
type: Directive,
|
|
2181
|
-
args: [{
|
|
2182
|
-
selector: '[fsFormNumeric]',
|
|
2183
|
-
providers: [
|
|
2184
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2185
|
-
],
|
|
2186
|
-
}]
|
|
2187
|
-
}], propDecorators: { fsFormNumeric: [{
|
|
2188
|
-
type: Input
|
|
2189
|
-
}], validationMessage: [{
|
|
2190
|
-
type: Input,
|
|
2191
|
-
args: ['fsFormNumericMessage']
|
|
2157
|
+
class FsFormNumericDirective extends FsControlDirective {
|
|
2158
|
+
set validationMessage(value) {
|
|
2159
|
+
this._validateMessages.numeric = value;
|
|
2160
|
+
}
|
|
2161
|
+
ngOnChanges() {
|
|
2162
|
+
this._control.updateValueAndValidity();
|
|
2163
|
+
}
|
|
2164
|
+
validate(control) {
|
|
2165
|
+
if (isEnabled(this.fsFormNumeric)) {
|
|
2166
|
+
return FsValidators.numeric(this._control);
|
|
2167
|
+
}
|
|
2168
|
+
else {
|
|
2169
|
+
return null;
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2174
|
+
FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
|
|
2175
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2176
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormNumericDirective, decorators: [{
|
|
2178
|
+
type: Directive,
|
|
2179
|
+
args: [{
|
|
2180
|
+
selector: '[fsFormNumeric]',
|
|
2181
|
+
providers: [
|
|
2182
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2183
|
+
],
|
|
2184
|
+
}]
|
|
2185
|
+
}], propDecorators: { fsFormNumeric: [{
|
|
2186
|
+
type: Input
|
|
2187
|
+
}], validationMessage: [{
|
|
2188
|
+
type: Input,
|
|
2189
|
+
args: ['fsFormNumericMessage']
|
|
2192
2190
|
}] } });
|
|
2193
2191
|
|
|
2194
|
-
class FsFormPatternDirective extends FsControlDirective {
|
|
2195
|
-
set validationMessage(value) {
|
|
2196
|
-
this._validateMessages.pattern = value;
|
|
2197
|
-
}
|
|
2198
|
-
ngOnChanges() {
|
|
2199
|
-
this._control.updateValueAndValidity();
|
|
2200
|
-
}
|
|
2201
|
-
validate(control) {
|
|
2202
|
-
return Validators.pattern(this.fsFormPattern)(this._control);
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2206
|
-
FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2207
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2208
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2209
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2210
|
-
type: Directive,
|
|
2211
|
-
args: [{
|
|
2212
|
-
selector: '[fsFormPattern]',
|
|
2213
|
-
providers: [
|
|
2214
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2215
|
-
],
|
|
2216
|
-
}]
|
|
2217
|
-
}], propDecorators: { fsFormPattern: [{
|
|
2218
|
-
type: Input
|
|
2219
|
-
}], validationMessage: [{
|
|
2220
|
-
type: Input,
|
|
2221
|
-
args: ['fsFormPatternMessage']
|
|
2192
|
+
class FsFormPatternDirective extends FsControlDirective {
|
|
2193
|
+
set validationMessage(value) {
|
|
2194
|
+
this._validateMessages.pattern = value;
|
|
2195
|
+
}
|
|
2196
|
+
ngOnChanges() {
|
|
2197
|
+
this._control.updateValueAndValidity();
|
|
2198
|
+
}
|
|
2199
|
+
validate(control) {
|
|
2200
|
+
return Validators.pattern(this.fsFormPattern)(this._control);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2204
|
+
FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
|
|
2205
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2206
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormPatternDirective, decorators: [{
|
|
2208
|
+
type: Directive,
|
|
2209
|
+
args: [{
|
|
2210
|
+
selector: '[fsFormPattern]',
|
|
2211
|
+
providers: [
|
|
2212
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2213
|
+
],
|
|
2214
|
+
}]
|
|
2215
|
+
}], propDecorators: { fsFormPattern: [{
|
|
2216
|
+
type: Input
|
|
2217
|
+
}], validationMessage: [{
|
|
2218
|
+
type: Input,
|
|
2219
|
+
args: ['fsFormPatternMessage']
|
|
2222
2220
|
}] } });
|
|
2223
2221
|
|
|
2224
|
-
class FsFormPhoneDirective extends FsControlDirective {
|
|
2225
|
-
set validationMessage(value) {
|
|
2226
|
-
this._validateMessages.phone = value;
|
|
2227
|
-
}
|
|
2228
|
-
ngOnChanges() {
|
|
2229
|
-
this._control.updateValueAndValidity();
|
|
2230
|
-
}
|
|
2231
|
-
validate(control) {
|
|
2232
|
-
if (isEnabled(this.fsFormPhone)) {
|
|
2233
|
-
return FsValidators.phone(this._control);
|
|
2234
|
-
}
|
|
2235
|
-
else {
|
|
2236
|
-
return null;
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2241
|
-
FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2242
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2243
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2245
|
-
type: Directive,
|
|
2246
|
-
args: [{
|
|
2247
|
-
selector: '[fsFormPhone]',
|
|
2248
|
-
providers: [
|
|
2249
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2250
|
-
],
|
|
2251
|
-
}]
|
|
2252
|
-
}], propDecorators: { fsFormPhone: [{
|
|
2253
|
-
type: Input
|
|
2254
|
-
}], validationMessage: [{
|
|
2255
|
-
type: Input,
|
|
2256
|
-
args: ['fsFormPhoneMessage']
|
|
2222
|
+
class FsFormPhoneDirective extends FsControlDirective {
|
|
2223
|
+
set validationMessage(value) {
|
|
2224
|
+
this._validateMessages.phone = value;
|
|
2225
|
+
}
|
|
2226
|
+
ngOnChanges() {
|
|
2227
|
+
this._control.updateValueAndValidity();
|
|
2228
|
+
}
|
|
2229
|
+
validate(control) {
|
|
2230
|
+
if (isEnabled(this.fsFormPhone)) {
|
|
2231
|
+
return FsValidators.phone(this._control);
|
|
2232
|
+
}
|
|
2233
|
+
else {
|
|
2234
|
+
return null;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2239
|
+
FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
|
|
2240
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2241
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormPhoneDirective, decorators: [{
|
|
2243
|
+
type: Directive,
|
|
2244
|
+
args: [{
|
|
2245
|
+
selector: '[fsFormPhone]',
|
|
2246
|
+
providers: [
|
|
2247
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2248
|
+
],
|
|
2249
|
+
}]
|
|
2250
|
+
}], propDecorators: { fsFormPhone: [{
|
|
2251
|
+
type: Input
|
|
2252
|
+
}], validationMessage: [{
|
|
2253
|
+
type: Input,
|
|
2254
|
+
args: ['fsFormPhoneMessage']
|
|
2257
2255
|
}] } });
|
|
2258
2256
|
|
|
2259
|
-
class FsFormRequiredDirective extends FsControlDirective {
|
|
2260
|
-
constructor() {
|
|
2261
|
-
super(...arguments);
|
|
2262
|
-
this.required = false;
|
|
2263
|
-
}
|
|
2264
|
-
set setFsFormRequired(value) {
|
|
2265
|
-
this.required = isEnabled(value);
|
|
2266
|
-
}
|
|
2267
|
-
set setRequired(value) {
|
|
2268
|
-
this.required = isEnabled(value);
|
|
2269
|
-
}
|
|
2270
|
-
set validationMessage(value) {
|
|
2271
|
-
this._validateMessages.required = value;
|
|
2272
|
-
}
|
|
2273
|
-
ngOnChanges() {
|
|
2274
|
-
this._control.updateValueAndValidity();
|
|
2275
|
-
}
|
|
2276
|
-
validate(control) {
|
|
2277
|
-
if (this.required) {
|
|
2278
|
-
return Validators.required(this._control);
|
|
2279
|
-
}
|
|
2280
|
-
return null;
|
|
2281
|
-
}
|
|
2282
|
-
render() {
|
|
2283
|
-
const wrapper = this.getWrapperElement();
|
|
2284
|
-
if (wrapper && this.getlabelSelector()) {
|
|
2285
|
-
const labelWrapper = wrapper.querySelector(this.getlabelSelector());
|
|
2286
|
-
// Adding class fs-form-label-requried adds the * to the label
|
|
2287
|
-
if (labelWrapper) {
|
|
2288
|
-
if (this.required) {
|
|
2289
|
-
this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
|
|
2290
|
-
}
|
|
2291
|
-
else {
|
|
2292
|
-
this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
super.render();
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2300
|
-
FsFormRequiredDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2301
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
2302
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2304
|
-
type: Directive,
|
|
2305
|
-
args: [{
|
|
2306
|
-
selector: '[fsFormRequired],[ngModel][required]',
|
|
2307
|
-
providers: [
|
|
2308
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
2309
|
-
],
|
|
2310
|
-
}]
|
|
2311
|
-
}], propDecorators: { setFsFormRequired: [{
|
|
2312
|
-
type: Input,
|
|
2313
|
-
args: ['fsFormRequired']
|
|
2314
|
-
}], setRequired: [{
|
|
2315
|
-
type: Input,
|
|
2316
|
-
args: ['required']
|
|
2317
|
-
}], validationMessage: [{
|
|
2318
|
-
type: Input,
|
|
2319
|
-
args: ['fsFormRequiredMessage']
|
|
2257
|
+
class FsFormRequiredDirective extends FsControlDirective {
|
|
2258
|
+
constructor() {
|
|
2259
|
+
super(...arguments);
|
|
2260
|
+
this.required = false;
|
|
2261
|
+
}
|
|
2262
|
+
set setFsFormRequired(value) {
|
|
2263
|
+
this.required = isEnabled(value);
|
|
2264
|
+
}
|
|
2265
|
+
set setRequired(value) {
|
|
2266
|
+
this.required = isEnabled(value);
|
|
2267
|
+
}
|
|
2268
|
+
set validationMessage(value) {
|
|
2269
|
+
this._validateMessages.required = value;
|
|
2270
|
+
}
|
|
2271
|
+
ngOnChanges() {
|
|
2272
|
+
this._control.updateValueAndValidity();
|
|
2273
|
+
}
|
|
2274
|
+
validate(control) {
|
|
2275
|
+
if (this.required) {
|
|
2276
|
+
return Validators.required(this._control);
|
|
2277
|
+
}
|
|
2278
|
+
return null;
|
|
2279
|
+
}
|
|
2280
|
+
render() {
|
|
2281
|
+
const wrapper = this.getWrapperElement();
|
|
2282
|
+
if (wrapper && this.getlabelSelector()) {
|
|
2283
|
+
const labelWrapper = wrapper.querySelector(this.getlabelSelector());
|
|
2284
|
+
// Adding class fs-form-label-requried adds the * to the label
|
|
2285
|
+
if (labelWrapper) {
|
|
2286
|
+
if (this.required) {
|
|
2287
|
+
this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
|
|
2288
|
+
}
|
|
2289
|
+
else {
|
|
2290
|
+
this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
super.render();
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2298
|
+
FsFormRequiredDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: { setFsFormRequired: ["fsFormRequired", "setFsFormRequired"], setRequired: ["required", "setRequired"], validationMessage: ["fsFormRequiredMessage", "validationMessage"] }, providers: [
|
|
2299
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
2300
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormRequiredDirective, decorators: [{
|
|
2302
|
+
type: Directive,
|
|
2303
|
+
args: [{
|
|
2304
|
+
selector: '[fsFormRequired],[ngModel][required]',
|
|
2305
|
+
providers: [
|
|
2306
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
2307
|
+
],
|
|
2308
|
+
}]
|
|
2309
|
+
}], propDecorators: { setFsFormRequired: [{
|
|
2310
|
+
type: Input,
|
|
2311
|
+
args: ['fsFormRequired']
|
|
2312
|
+
}], setRequired: [{
|
|
2313
|
+
type: Input,
|
|
2314
|
+
args: ['required']
|
|
2315
|
+
}], validationMessage: [{
|
|
2316
|
+
type: Input,
|
|
2317
|
+
args: ['fsFormRequiredMessage']
|
|
2320
2318
|
}] } });
|
|
2321
2319
|
|
|
2322
|
-
class FsFormUrlDirective extends FsControlDirective {
|
|
2323
|
-
constructor() {
|
|
2324
|
-
super(...arguments);
|
|
2325
|
-
this.fsFormUrlProtocol = true;
|
|
2326
|
-
}
|
|
2327
|
-
set validationMessage(value) {
|
|
2328
|
-
this._validateMessages.url = value;
|
|
2329
|
-
}
|
|
2330
|
-
ngOnChanges() {
|
|
2331
|
-
this._control.updateValueAndValidity();
|
|
2332
|
-
}
|
|
2333
|
-
validate(control) {
|
|
2334
|
-
if (isEnabled(this.fsFormUrl)) {
|
|
2335
|
-
return FsValidators.url(this._control, this.fsFormUrlProtocol);
|
|
2336
|
-
}
|
|
2337
|
-
return null;
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2341
|
-
FsFormUrlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2342
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
2343
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2344
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2345
|
-
type: Directive,
|
|
2346
|
-
args: [{
|
|
2347
|
-
selector: '[fsFormUrl]',
|
|
2348
|
-
providers: [
|
|
2349
|
-
VALIDATE_MESSAGE_PROVIDER,
|
|
2350
|
-
],
|
|
2351
|
-
}]
|
|
2352
|
-
}], propDecorators: { fsFormUrl: [{
|
|
2353
|
-
type: Input
|
|
2354
|
-
}], fsFormUrlProtocol: [{
|
|
2355
|
-
type: Input
|
|
2356
|
-
}], validationMessage: [{
|
|
2357
|
-
type: Input,
|
|
2358
|
-
args: ['fsFormUrlMessage']
|
|
2320
|
+
class FsFormUrlDirective extends FsControlDirective {
|
|
2321
|
+
constructor() {
|
|
2322
|
+
super(...arguments);
|
|
2323
|
+
this.fsFormUrlProtocol = true;
|
|
2324
|
+
}
|
|
2325
|
+
set validationMessage(value) {
|
|
2326
|
+
this._validateMessages.url = value;
|
|
2327
|
+
}
|
|
2328
|
+
ngOnChanges() {
|
|
2329
|
+
this._control.updateValueAndValidity();
|
|
2330
|
+
}
|
|
2331
|
+
validate(control) {
|
|
2332
|
+
if (isEnabled(this.fsFormUrl)) {
|
|
2333
|
+
return FsValidators.url(this._control, this.fsFormUrlProtocol);
|
|
2334
|
+
}
|
|
2335
|
+
return null;
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2339
|
+
FsFormUrlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormUrlDirective, selector: "[fsFormUrl]", inputs: { fsFormUrl: "fsFormUrl", fsFormUrlProtocol: "fsFormUrlProtocol", validationMessage: ["fsFormUrlMessage", "validationMessage"] }, providers: [
|
|
2340
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
2341
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormUrlDirective, decorators: [{
|
|
2343
|
+
type: Directive,
|
|
2344
|
+
args: [{
|
|
2345
|
+
selector: '[fsFormUrl]',
|
|
2346
|
+
providers: [
|
|
2347
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
2348
|
+
],
|
|
2349
|
+
}]
|
|
2350
|
+
}], propDecorators: { fsFormUrl: [{
|
|
2351
|
+
type: Input
|
|
2352
|
+
}], fsFormUrlProtocol: [{
|
|
2353
|
+
type: Input
|
|
2354
|
+
}], validationMessage: [{
|
|
2355
|
+
type: Input,
|
|
2356
|
+
args: ['fsFormUrlMessage']
|
|
2359
2357
|
}] } });
|
|
2360
2358
|
|
|
2361
|
-
class FsFormValidateDirective extends FsControlDirective {
|
|
2362
|
-
constructor() {
|
|
2363
|
-
super(...arguments);
|
|
2364
|
-
this.validateOnSubmit = false;
|
|
2365
|
-
}
|
|
2366
|
-
ngOnChanges() {
|
|
2367
|
-
this._control.updateValueAndValidity();
|
|
2368
|
-
}
|
|
2369
|
-
validateAsync(control) {
|
|
2370
|
-
if (this.validateOnSubmit && !this.formDirective.validating) {
|
|
2371
|
-
return of(null);
|
|
2372
|
-
}
|
|
2373
|
-
return FsValidators.func(this._control, this.validateFn, this.validateFnData);
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
FsFormValidateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2377
|
-
FsFormValidateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
2378
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2379
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2380
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2381
|
-
type: Directive,
|
|
2382
|
-
args: [{
|
|
2383
|
-
selector: '[validate]',
|
|
2384
|
-
providers: [
|
|
2385
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2386
|
-
],
|
|
2387
|
-
}]
|
|
2388
|
-
}], propDecorators: { validateFn: [{
|
|
2389
|
-
type: Input,
|
|
2390
|
-
args: ['validate']
|
|
2391
|
-
}], validateFnData: [{
|
|
2392
|
-
type: Input,
|
|
2393
|
-
args: ['validateData']
|
|
2394
|
-
}], validateOnSubmit: [{
|
|
2395
|
-
type: Input
|
|
2359
|
+
class FsFormValidateDirective extends FsControlDirective {
|
|
2360
|
+
constructor() {
|
|
2361
|
+
super(...arguments);
|
|
2362
|
+
this.validateOnSubmit = false;
|
|
2363
|
+
}
|
|
2364
|
+
ngOnChanges() {
|
|
2365
|
+
this._control.updateValueAndValidity();
|
|
2366
|
+
}
|
|
2367
|
+
validateAsync(control) {
|
|
2368
|
+
if (this.validateOnSubmit && !this.formDirective.validating) {
|
|
2369
|
+
return of(null);
|
|
2370
|
+
}
|
|
2371
|
+
return FsValidators.func(this._control, this.validateFn, this.validateFnData);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
FsFormValidateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2375
|
+
FsFormValidateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormValidateDirective, selector: "[validate]", inputs: { validateFn: ["validate", "validateFn"], validateFnData: ["validateData", "validateFnData"], validateOnSubmit: "validateOnSubmit" }, providers: [
|
|
2376
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2377
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormValidateDirective, decorators: [{
|
|
2379
|
+
type: Directive,
|
|
2380
|
+
args: [{
|
|
2381
|
+
selector: '[validate]',
|
|
2382
|
+
providers: [
|
|
2383
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2384
|
+
],
|
|
2385
|
+
}]
|
|
2386
|
+
}], propDecorators: { validateFn: [{
|
|
2387
|
+
type: Input,
|
|
2388
|
+
args: ['validate']
|
|
2389
|
+
}], validateFnData: [{
|
|
2390
|
+
type: Input,
|
|
2391
|
+
args: ['validateData']
|
|
2392
|
+
}], validateOnSubmit: [{
|
|
2393
|
+
type: Input
|
|
2396
2394
|
}] } });
|
|
2397
2395
|
|
|
2398
|
-
class FsFormModule {
|
|
2399
|
-
static forRoot() {
|
|
2400
|
-
/**
|
|
2401
|
-
* Hack: https://github.com/angular/components/issues/20097
|
|
2402
|
-
*/
|
|
2403
|
-
ErrorStateMatcher.prototype
|
|
2404
|
-
.isErrorState = (control, form) => {
|
|
2405
|
-
return (control === null || control === void 0 ? void 0 : control.invalid) && (control === null || control === void 0 ? void 0 : control.touched) && (control === null || control === void 0 ? void 0 : control.dirty);
|
|
2406
|
-
};
|
|
2407
|
-
return {
|
|
2408
|
-
ngModule: FsFormModule,
|
|
2409
|
-
};
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
FsFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2413
|
-
FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
2414
|
-
FsControlDirective,
|
|
2415
|
-
FsFormRequiredDirective,
|
|
2416
|
-
FsFormMinDirective,
|
|
2417
|
-
FsFormMaxDirective,
|
|
2418
|
-
FsFormMinLengthDirective,
|
|
2419
|
-
FsFormMaxLengthDirective,
|
|
2420
|
-
FsFormEmailDirective,
|
|
2421
|
-
FsFormEmailsDirective,
|
|
2422
|
-
FsFormPhoneDirective,
|
|
2423
|
-
FsFormCompareDirective,
|
|
2424
|
-
FsFormIntegerDirective,
|
|
2425
|
-
FsFormNumericDirective,
|
|
2426
|
-
FsFormPatternDirective,
|
|
2427
|
-
FsFormFunctionDirective,
|
|
2428
|
-
FsFormDateRangeDirective,
|
|
2429
|
-
FsFormGreaterDirective,
|
|
2430
|
-
FsFormGreaterEqualDirective,
|
|
2431
|
-
FsFormLesserDirective,
|
|
2432
|
-
FsFormLesserEqualDirective,
|
|
2433
|
-
FsFormUrlDirective,
|
|
2434
|
-
FsFormDialogCloseDirective,
|
|
2435
|
-
FsFormValidateDirective,
|
|
2436
|
-
FsFormDialogActionsComponent,
|
|
2437
|
-
FsFormNoFsValidatorsDirective,
|
|
2438
|
-
FsButtonDirective,
|
|
2439
|
-
FsSubmitButtonDirective,
|
|
2440
|
-
FsFormTemplateComponent,
|
|
2441
|
-
FsFormTemplateDirective,
|
|
2442
|
-
FsFormTemplateOutletComponent,
|
|
2443
|
-
ConfirmUnsavedComponent], imports: [CommonModule,
|
|
2444
|
-
FormsModule,
|
|
2445
|
-
MatButtonModule,
|
|
2446
|
-
MatDialogModule,
|
|
2447
|
-
MatDialogModule,
|
|
2448
|
-
FsDialogModule], exports: [FsFormDirective,
|
|
2449
|
-
FsControlDirective,
|
|
2450
|
-
FsFormRequiredDirective,
|
|
2451
|
-
FsFormMinDirective,
|
|
2452
|
-
FsFormMaxDirective,
|
|
2453
|
-
FsFormMinLengthDirective,
|
|
2454
|
-
FsFormMaxLengthDirective,
|
|
2455
|
-
FsFormEmailDirective,
|
|
2456
|
-
FsFormEmailsDirective,
|
|
2457
|
-
FsFormPhoneDirective,
|
|
2458
|
-
FsFormCompareDirective,
|
|
2459
|
-
FsFormIntegerDirective,
|
|
2460
|
-
FsFormNumericDirective,
|
|
2461
|
-
FsFormPatternDirective,
|
|
2462
|
-
FsFormFunctionDirective,
|
|
2463
|
-
FsFormDateRangeDirective,
|
|
2464
|
-
FsFormGreaterDirective,
|
|
2465
|
-
FsFormGreaterEqualDirective,
|
|
2466
|
-
FsFormLesserDirective,
|
|
2467
|
-
FsFormLesserEqualDirective,
|
|
2468
|
-
FsFormUrlDirective,
|
|
2469
|
-
FsFormDialogCloseDirective,
|
|
2470
|
-
FsFormValidateDirective,
|
|
2471
|
-
FsFormDialogActionsComponent,
|
|
2472
|
-
FsFormNoFsValidatorsDirective,
|
|
2473
|
-
FsButtonDirective,
|
|
2474
|
-
FsSubmitButtonDirective,
|
|
2475
|
-
FsFormTemplateComponent,
|
|
2476
|
-
FsFormTemplateDirective,
|
|
2477
|
-
FsFormTemplateOutletComponent] });
|
|
2478
|
-
FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2479
|
-
{
|
|
2480
|
-
provide: ErrorStateMatcher,
|
|
2481
|
-
useClass: ShowOnDirtyErrorStateMatcher,
|
|
2482
|
-
},
|
|
2483
|
-
], imports: [
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
],
|
|
2573
|
-
}]
|
|
2396
|
+
class FsFormModule {
|
|
2397
|
+
static forRoot() {
|
|
2398
|
+
/**
|
|
2399
|
+
* Hack: https://github.com/angular/components/issues/20097
|
|
2400
|
+
*/
|
|
2401
|
+
ErrorStateMatcher.prototype
|
|
2402
|
+
.isErrorState = (control, form) => {
|
|
2403
|
+
return (control === null || control === void 0 ? void 0 : control.invalid) && (control === null || control === void 0 ? void 0 : control.touched) && (control === null || control === void 0 ? void 0 : control.dirty);
|
|
2404
|
+
};
|
|
2405
|
+
return {
|
|
2406
|
+
ngModule: FsFormModule,
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
FsFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2411
|
+
FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: FsFormModule, declarations: [FsFormDirective,
|
|
2412
|
+
FsControlDirective,
|
|
2413
|
+
FsFormRequiredDirective,
|
|
2414
|
+
FsFormMinDirective,
|
|
2415
|
+
FsFormMaxDirective,
|
|
2416
|
+
FsFormMinLengthDirective,
|
|
2417
|
+
FsFormMaxLengthDirective,
|
|
2418
|
+
FsFormEmailDirective,
|
|
2419
|
+
FsFormEmailsDirective,
|
|
2420
|
+
FsFormPhoneDirective,
|
|
2421
|
+
FsFormCompareDirective,
|
|
2422
|
+
FsFormIntegerDirective,
|
|
2423
|
+
FsFormNumericDirective,
|
|
2424
|
+
FsFormPatternDirective,
|
|
2425
|
+
FsFormFunctionDirective,
|
|
2426
|
+
FsFormDateRangeDirective,
|
|
2427
|
+
FsFormGreaterDirective,
|
|
2428
|
+
FsFormGreaterEqualDirective,
|
|
2429
|
+
FsFormLesserDirective,
|
|
2430
|
+
FsFormLesserEqualDirective,
|
|
2431
|
+
FsFormUrlDirective,
|
|
2432
|
+
FsFormDialogCloseDirective,
|
|
2433
|
+
FsFormValidateDirective,
|
|
2434
|
+
FsFormDialogActionsComponent,
|
|
2435
|
+
FsFormNoFsValidatorsDirective,
|
|
2436
|
+
FsButtonDirective,
|
|
2437
|
+
FsSubmitButtonDirective,
|
|
2438
|
+
FsFormTemplateComponent,
|
|
2439
|
+
FsFormTemplateDirective,
|
|
2440
|
+
FsFormTemplateOutletComponent,
|
|
2441
|
+
ConfirmUnsavedComponent], imports: [CommonModule,
|
|
2442
|
+
FormsModule,
|
|
2443
|
+
MatButtonModule,
|
|
2444
|
+
MatDialogModule,
|
|
2445
|
+
MatDialogModule,
|
|
2446
|
+
FsDialogModule], exports: [FsFormDirective,
|
|
2447
|
+
FsControlDirective,
|
|
2448
|
+
FsFormRequiredDirective,
|
|
2449
|
+
FsFormMinDirective,
|
|
2450
|
+
FsFormMaxDirective,
|
|
2451
|
+
FsFormMinLengthDirective,
|
|
2452
|
+
FsFormMaxLengthDirective,
|
|
2453
|
+
FsFormEmailDirective,
|
|
2454
|
+
FsFormEmailsDirective,
|
|
2455
|
+
FsFormPhoneDirective,
|
|
2456
|
+
FsFormCompareDirective,
|
|
2457
|
+
FsFormIntegerDirective,
|
|
2458
|
+
FsFormNumericDirective,
|
|
2459
|
+
FsFormPatternDirective,
|
|
2460
|
+
FsFormFunctionDirective,
|
|
2461
|
+
FsFormDateRangeDirective,
|
|
2462
|
+
FsFormGreaterDirective,
|
|
2463
|
+
FsFormGreaterEqualDirective,
|
|
2464
|
+
FsFormLesserDirective,
|
|
2465
|
+
FsFormLesserEqualDirective,
|
|
2466
|
+
FsFormUrlDirective,
|
|
2467
|
+
FsFormDialogCloseDirective,
|
|
2468
|
+
FsFormValidateDirective,
|
|
2469
|
+
FsFormDialogActionsComponent,
|
|
2470
|
+
FsFormNoFsValidatorsDirective,
|
|
2471
|
+
FsButtonDirective,
|
|
2472
|
+
FsSubmitButtonDirective,
|
|
2473
|
+
FsFormTemplateComponent,
|
|
2474
|
+
FsFormTemplateDirective,
|
|
2475
|
+
FsFormTemplateOutletComponent] });
|
|
2476
|
+
FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormModule, providers: [
|
|
2477
|
+
{
|
|
2478
|
+
provide: ErrorStateMatcher,
|
|
2479
|
+
useClass: ShowOnDirtyErrorStateMatcher,
|
|
2480
|
+
},
|
|
2481
|
+
], imports: [CommonModule,
|
|
2482
|
+
FormsModule,
|
|
2483
|
+
MatButtonModule,
|
|
2484
|
+
MatDialogModule,
|
|
2485
|
+
MatDialogModule,
|
|
2486
|
+
FsDialogModule] });
|
|
2487
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormModule, decorators: [{
|
|
2488
|
+
type: NgModule,
|
|
2489
|
+
args: [{
|
|
2490
|
+
imports: [
|
|
2491
|
+
CommonModule,
|
|
2492
|
+
FormsModule,
|
|
2493
|
+
MatButtonModule,
|
|
2494
|
+
MatDialogModule,
|
|
2495
|
+
MatDialogModule,
|
|
2496
|
+
FsDialogModule,
|
|
2497
|
+
],
|
|
2498
|
+
declarations: [
|
|
2499
|
+
FsFormDirective,
|
|
2500
|
+
FsControlDirective,
|
|
2501
|
+
FsFormRequiredDirective,
|
|
2502
|
+
FsFormMinDirective,
|
|
2503
|
+
FsFormMaxDirective,
|
|
2504
|
+
FsFormMinLengthDirective,
|
|
2505
|
+
FsFormMaxLengthDirective,
|
|
2506
|
+
FsFormEmailDirective,
|
|
2507
|
+
FsFormEmailsDirective,
|
|
2508
|
+
FsFormPhoneDirective,
|
|
2509
|
+
FsFormCompareDirective,
|
|
2510
|
+
FsFormIntegerDirective,
|
|
2511
|
+
FsFormNumericDirective,
|
|
2512
|
+
FsFormPatternDirective,
|
|
2513
|
+
FsFormFunctionDirective,
|
|
2514
|
+
FsFormDateRangeDirective,
|
|
2515
|
+
FsFormGreaterDirective,
|
|
2516
|
+
FsFormGreaterEqualDirective,
|
|
2517
|
+
FsFormLesserDirective,
|
|
2518
|
+
FsFormLesserEqualDirective,
|
|
2519
|
+
FsFormUrlDirective,
|
|
2520
|
+
FsFormDialogCloseDirective,
|
|
2521
|
+
FsFormValidateDirective,
|
|
2522
|
+
FsFormDialogActionsComponent,
|
|
2523
|
+
FsFormNoFsValidatorsDirective,
|
|
2524
|
+
FsButtonDirective,
|
|
2525
|
+
FsSubmitButtonDirective,
|
|
2526
|
+
FsFormTemplateComponent,
|
|
2527
|
+
FsFormTemplateDirective,
|
|
2528
|
+
FsFormTemplateOutletComponent,
|
|
2529
|
+
ConfirmUnsavedComponent,
|
|
2530
|
+
],
|
|
2531
|
+
exports: [
|
|
2532
|
+
FsFormDirective,
|
|
2533
|
+
FsControlDirective,
|
|
2534
|
+
FsFormRequiredDirective,
|
|
2535
|
+
FsFormMinDirective,
|
|
2536
|
+
FsFormMaxDirective,
|
|
2537
|
+
FsFormMinLengthDirective,
|
|
2538
|
+
FsFormMaxLengthDirective,
|
|
2539
|
+
FsFormEmailDirective,
|
|
2540
|
+
FsFormEmailsDirective,
|
|
2541
|
+
FsFormPhoneDirective,
|
|
2542
|
+
FsFormCompareDirective,
|
|
2543
|
+
FsFormIntegerDirective,
|
|
2544
|
+
FsFormNumericDirective,
|
|
2545
|
+
FsFormPatternDirective,
|
|
2546
|
+
FsFormFunctionDirective,
|
|
2547
|
+
FsFormDateRangeDirective,
|
|
2548
|
+
FsFormGreaterDirective,
|
|
2549
|
+
FsFormGreaterEqualDirective,
|
|
2550
|
+
FsFormLesserDirective,
|
|
2551
|
+
FsFormLesserEqualDirective,
|
|
2552
|
+
FsFormUrlDirective,
|
|
2553
|
+
FsFormDialogCloseDirective,
|
|
2554
|
+
FsFormValidateDirective,
|
|
2555
|
+
FsFormDialogActionsComponent,
|
|
2556
|
+
FsFormNoFsValidatorsDirective,
|
|
2557
|
+
FsButtonDirective,
|
|
2558
|
+
FsSubmitButtonDirective,
|
|
2559
|
+
FsFormTemplateComponent,
|
|
2560
|
+
FsFormTemplateDirective,
|
|
2561
|
+
FsFormTemplateOutletComponent,
|
|
2562
|
+
],
|
|
2563
|
+
providers: [
|
|
2564
|
+
{
|
|
2565
|
+
provide: ErrorStateMatcher,
|
|
2566
|
+
useClass: ShowOnDirtyErrorStateMatcher,
|
|
2567
|
+
},
|
|
2568
|
+
],
|
|
2569
|
+
}]
|
|
2574
2570
|
}] });
|
|
2575
2571
|
|
|
2576
2572
|
// Modules
|
|
2577
2573
|
|
|
2578
|
-
/**
|
|
2579
|
-
* Generated bundle index. Do not edit.
|
|
2574
|
+
/**
|
|
2575
|
+
* Generated bundle index. Do not edit.
|
|
2580
2576
|
*/
|
|
2581
2577
|
|
|
2582
2578
|
export { ConfirmResult, FormDeactivateGuard, FormStatus, FsButtonDirective, FsControlDirective, FsForm, FsFormCompareDirective, FsFormDateRangeDirective, FsFormDialogActionsComponent, FsFormDialogCloseDirective, FsFormDirective, FsFormEmailDirective, FsFormEmailsDirective, FsFormFunctionDirective, FsFormGreaterDirective, FsFormGreaterEqualDirective, FsFormIntegerDirective, FsFormLesserDirective, FsFormLesserEqualDirective, FsFormMaxDirective, FsFormMaxLengthDirective, FsFormMinDirective, FsFormMinLengthDirective, FsFormModule, FsFormNoFsValidatorsDirective, FsFormNumericDirective, FsFormPatternDirective, FsFormPhoneDirective, FsFormRequiredDirective, FsFormTemplateComponent, FsFormTemplateDirective, FsFormTemplateOutletComponent, FsFormUrlDirective, FsFormValidateDirective, FsSubmitButtonDirective, FsValidators };
|