@firestitch/form 12.4.0 → 12.4.2

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