@firestitch/form 12.4.10 → 12.4.11

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 (103) hide show
  1. package/app/components/form-dialog-actions/form-dialog-actions.component.d.ts +23 -23
  2. package/app/consts/error-messages.const.d.ts +19 -19
  3. package/app/directives/button.directive.d.ts +35 -35
  4. package/app/directives/form/form.directive.d.ts +122 -122
  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 -6
  43. package/app/interfaces/submitted-event.d.ts +7 -7
  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 +2836 -2839
  49. package/bundles/firestitch-form.umd.js.map +1 -1
  50. package/esm2015/app/components/form-dialog-actions/form-dialog-actions.component.js +91 -91
  51. package/esm2015/app/consts/error-messages.const.js +19 -19
  52. package/esm2015/app/directives/button.directive.js +152 -152
  53. package/esm2015/app/directives/form/form.directive.js +695 -695
  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 +262 -265
  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 +71 -71
  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 +1 -1
  92. package/esm2015/app/interfaces/submitted-event.js +1 -1
  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 +2273 -2276
  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
@@ -22,2002 +22,1999 @@ import { first, filter, map, take, mergeMap, tap, switchMap, mapTo, catchError,
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.triggerSubmit({ confirmed: true });
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({ confirmed: 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
- this._confirmed = 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: 'nearest' });
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._confirmed = options === null || options === void 0 ? void 0 : options.confirmed;
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, confirmed: this._confirmed };
434
- }), tap(() => this._confirmed = false), filter(() => {
435
- return [FormStatus.Valid, FormStatus.Invalid]
436
- .includes(this._status$.getValue());
437
- }), tap(() => this._broadcasValidatingEvents()), tap(() => this.validate()), 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), { confirmed: data.confirmed }))));
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
- validate() {
453
- Object.values(this.ngForm.controls)
454
- .forEach((control) => {
455
- control.markAsDirty();
456
- control.markAsTouched();
457
- control.updateValueAndValidity();
458
- });
459
- }
460
- _listenFormStatus() {
461
- this._status$
462
- .pipe(takeUntil(this._destroy$))
463
- .subscribe((formStatus) => {
464
- const cls = [FormStatus.Submitting, FormStatus.Validating];
465
- const classList = this._element.nativeElement.classList;
466
- classList.remove(...cls);
467
- if (cls.indexOf(formStatus) !== -1) {
468
- classList.add(formStatus);
469
- }
470
- });
471
- }
472
- _listenWindowClose() {
473
- fromEvent(window, 'beforeunload')
474
- .pipe(takeUntil(this._destroy$))
475
- .subscribe((event) => {
476
- if (this.confirm && this.confirmBrowser && this.ngForm.dirty) {
477
- event.returnValue = false;
478
- }
479
- });
480
- }
481
- _listenHotKeys() {
482
- this._ngZone.runOutsideAngular(() => {
483
- fromEvent(document, 'keydown')
484
- .pipe(takeUntil(this._destroy$))
485
- .subscribe((event) => {
486
- if (this._dialogBackdropEscape && event.code === 'Escape') {
487
- const dialog = document.getElementById(this._dialogRef.id);
488
- const paths = event.composedPath();
489
- if (paths) {
490
- paths.forEach(item => {
491
- if (dialog === item) {
492
- this._ngZone.run(() => {
493
- this._formClose();
494
- });
495
- }
496
- });
497
- }
498
- }
499
- if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
500
- event.preventDefault();
501
- if (this.shortcuts) {
502
- if (this._elementInForm(document.activeElement)) {
503
- this.ngForm.ngSubmit.next();
504
- }
505
- }
506
- }
507
- });
508
- });
509
- }
510
- _formClose() {
511
- if (this.confirm && this.confirmDialog) {
512
- this.triggerConfirm()
513
- .pipe(filter((result) => confirmResultContinue(result)), switchMap((result) => {
514
- return result === ConfirmResult.Pristine || result === ConfirmResult.Discard
515
- ? of(null)
516
- : this.submitted.asObservable();
517
- }), takeUntil(this._destroy$))
518
- .subscribe((result) => {
519
- this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
520
- });
521
- }
522
- else {
523
- this._dialogRef.close(null);
524
- }
525
- }
526
- _registerDialogClose(directive) {
527
- if (!directive.registered) {
528
- directive.registered = true;
529
- directive.clicked$
530
- .pipe(takeUntil(this._destroy$))
531
- .subscribe(() => {
532
- this._formClose();
533
- });
534
- }
535
- }
536
- _getActiveSubmitButton() {
537
- const submitButtons = this._buttons
538
- .filter((button) => button.submit);
539
- const activeButton = submitButtons
540
- .find(button => {
541
- return button.active;
542
- });
543
- return activeButton ? activeButton : submitButtons[0];
544
- }
545
- _elementInForm(el) {
546
- if (el.isSameNode(this._element.nativeElement)) {
547
- return true;
548
- }
549
- else if (el.parentElement) {
550
- return this._elementInForm(el.parentElement);
551
- }
552
- return false;
553
- }
554
- _completeSubmit(success, submitEvent) {
555
- if (success) {
556
- this.ngForm.control.markAsPristine();
557
- this.createSnapshot();
558
- this.submitted.emit(submitEvent);
559
- }
560
- else {
561
- this._resetButtons();
562
- }
563
- if (this._activeSubmitButton) {
564
- if (success) {
565
- this._activeSubmitButton.success();
566
- }
567
- else {
568
- this._activeSubmitButton.error();
569
- }
570
- }
571
- this._status$.next(FormStatus.Submitted);
572
- if (success) {
573
- this._status$.next(FormStatus.Success);
574
- }
575
- else {
576
- this._status$.next(FormStatus.Error);
577
- }
578
- this._status$.next(FormStatus.Completing);
579
- const resetDelay = success ? this.successDelay : this.errorDelay;
580
- of(true)
581
- .pipe(delay(resetDelay), first(), takeUntil(this._destroy$)).subscribe(() => {
582
- if (this.ngForm.form.status === 'VALID') {
583
- this._status$.next(FormStatus.Valid);
584
- }
585
- else {
586
- this._status$.next(FormStatus.Invalid);
587
- }
588
- this._resetButtons();
589
- this._resetActiveButtons();
590
- this._updateDirtySubmitButtons();
591
- });
592
- }
593
- _resetButtons() {
594
- this._buttons.forEach((button) => {
595
- button.reset();
596
- });
597
- }
598
- _resetActiveButtons() {
599
- this._buttons.forEach((button) => {
600
- button.resetActive();
601
- });
602
- }
603
- _registerConfirm() {
604
- this.ngForm.form.valueChanges
605
- .pipe(takeUntil(this._destroy$))
606
- .subscribe((changes) => {
607
- if (this.confirm) {
608
- const existing = Object.keys(this._snapshot);
609
- Object.keys(changes)
610
- .forEach((name) => {
611
- if (existing.indexOf(name) === -1) {
612
- this._snapshot[name] = changes[name];
613
- }
614
- });
615
- }
616
- });
617
- }
618
- _registerDrawerClose() {
619
- if (this._drawerRef) {
620
- this._drawerRef.closeStart$
621
- .pipe(takeUntil(this._destroy$))
622
- .subscribe((subscriber) => {
623
- if (this.submitting) {
624
- this._status$
625
- .pipe(filter((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this._destroy$))
626
- .subscribe((status) => {
627
- if (status === FormStatus.Success) {
628
- subscriber.next();
629
- subscriber.complete();
630
- }
631
- else {
632
- subscriber.error();
633
- }
634
- });
635
- }
636
- else {
637
- subscriber.next();
638
- subscriber.complete();
639
- }
640
- });
641
- }
642
- }
643
- _registerConfirmDrawerClose() {
644
- if (this._drawerRef) {
645
- this._drawerRef.closeStart$
646
- .pipe(switchMap((subscriber) => {
647
- return iif(() => this.confirm && this.confirmDrawer, this.triggerConfirm()
648
- .pipe(map((result) => confirmResultContinue(result)), tap((result) => {
649
- if (result) {
650
- subscriber.next();
651
- subscriber.complete();
652
- }
653
- })), defer(() => {
654
- subscriber.next();
655
- subscriber.complete();
656
- }));
657
- }), takeUntil(this._destroy$))
658
- .subscribe();
659
- }
660
- }
661
- _registerConfirmTabs() {
662
- if (this.tabGroup) {
663
- this.registerConfirmTabGroup(this.tabGroup);
664
- }
665
- this.registerConfirmTabGroups(this._tabGroups.toArray());
666
- this._tabGroups.changes
667
- .pipe(takeUntil(this._destroy$))
668
- .subscribe(() => {
669
- this.registerConfirmTabGroups(this._tabGroups.toArray());
670
- });
671
- }
672
- registerConfirmTabGroups(tabGroups) {
673
- tabGroups.forEach((tabGroup) => {
674
- this.registerConfirmTabGroup(tabGroup);
675
- });
676
- }
677
- registerConfirmTabGroup(tabGroup) {
678
- const confirmTabGroup = tabGroup;
679
- if (!confirmTabGroup._originalHandleClick) {
680
- confirmTabGroup._originalHandleClick = tabGroup._handleClick;
681
- confirmTabGroup._handlClick$ = new Subject();
682
- confirmTabGroup._handleClick = (tab, tabHeader, idx) => {
683
- if (confirmTabGroup._handlClick$.observers.length) {
684
- confirmTabGroup._handlClick$.next({ tab, tabHeader, idx });
685
- }
686
- else {
687
- confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
688
- }
689
- };
690
- }
691
- confirmTabGroup._handlClick$
692
- .pipe(takeUntil(this._destroy$))
693
- .subscribe((event) => {
694
- if (!this.submitting) {
695
- if (this.confirm && this.confirmTabs) {
696
- this.triggerConfirm()
697
- .pipe(takeUntil(this._destroy$))
698
- .subscribe((result) => {
699
- if (confirmResultContinue(result)) {
700
- confirmTabGroup.selectedIndex = event.idx;
701
- }
702
- });
703
- }
704
- else {
705
- confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
706
- }
707
- }
708
- });
709
- }
710
- _registerConfirmDialogClose() {
711
- if (this._dialogRef) {
712
- this.formDialogClose.forEach(item => {
713
- this._registerDialogClose(item);
714
- });
715
- this.formDialogClose.changes
716
- .pipe(takeUntil(this._destroy$))
717
- .subscribe((e) => {
718
- e.forEach(item => {
719
- this._registerDialogClose(item);
720
- });
721
- });
722
- }
723
- }
724
- _registerConfirmDialogBackdropEscape() {
725
- this._dialogBackdropEscape = this._dialogRef && this._dialogRef.disableClose !== true;
726
- if (this._dialogRef && !this._dialogRef.disableClose) {
727
- this._dialogRef.disableClose = true;
728
- this._dialogRef.backdropClick()
729
- .pipe(takeUntil(this._destroy$))
730
- .subscribe(() => {
731
- this._formClose();
732
- });
733
- this._destroy$
734
- .subscribe(() => {
735
- this._dialogRef.disableClose = false;
736
- });
737
- }
738
- }
739
- _registerAutocomplete() {
740
- this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
741
- this.ngForm.form.registerControl = (name, control) => {
742
- const el = this._element.nativeElement.querySelector(`input[name='${name}']`);
743
- if (el) {
744
- el.setAttribute('name', name + '_' + guid());
745
- if (!el.getAttribute('autocomplete')) {
746
- el.setAttribute('autocomplete', 'none');
747
- }
748
- }
749
- return this._registerControl(name, control);
750
- };
751
- }
752
- _registerDirtySubmitButton() {
753
- if (!this.ngForm) {
754
- return;
755
- }
756
- this.ngForm.form.valueChanges
757
- .pipe(takeUntil(this._destroy$))
758
- .subscribe(() => {
759
- this._updateDirtySubmitButtons();
760
- });
761
- this._buttons.changes
762
- .pipe(takeUntil(this._destroy$))
763
- .subscribe(() => {
764
- this._updateDirtySubmitButtons();
765
- });
766
- }
767
- _updateDirtySubmitButtons() {
768
- this._buttons
769
- .filter((button) => button.submit)
770
- .forEach((submitButton) => {
771
- if (!this.confirm || !this.dirtySubmitButton || this.ngForm.dirty || !submitButton.dirtySubmit) {
772
- submitButton.enable();
773
- }
774
- else {
775
- submitButton.disable();
776
- }
777
- });
778
- }
779
- _broadcastSubmittingEvents() {
780
- this._status$.next(FormStatus.Submitting);
781
- this._form.broadcast('submit', this.ngForm);
782
- }
783
- _broadcasValidatingEvents() {
784
- this._status$.next(FormStatus.Validating);
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
- const guardIndex = this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard);
832
- this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
833
- this._form.removeFormDirective(this._activatedRouteConfig.component);
834
- }
835
- }
836
- 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 });
837
- 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 });
838
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDirective, decorators: [{
839
- type: Directive,
840
- args: [{
841
- selector: '[fsForm]',
842
- }]
843
- }], ctorParameters: function () { return [{ type: i1$1.NgForm, decorators: [{
844
- type: Inject,
845
- args: [NgForm]
846
- }] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2.FsMessage }, { type: i1.FsPrompt }, { type: i0.NgZone }, { type: i2$1.MatDialogRef, decorators: [{
847
- type: Optional
848
- }, {
849
- type: Inject,
850
- args: [MatDialogRef]
851
- }] }, { type: i7.DrawerRef, decorators: [{
852
- type: Optional
853
- }, {
854
- type: Inject,
855
- args: [DrawerRef]
856
- }] }, { type: i3.ActivatedRoute }]; }, propDecorators: { wrapperSelector: [{
857
- type: Input
858
- }], messageSelector: [{
859
- type: Input
860
- }], hintSelector: [{
861
- type: Input
862
- }], labelSelector: [{
863
- type: Input
864
- }], autocomplete: [{
865
- type: Input
866
- }], shortcuts: [{
867
- type: Input
868
- }], confirm: [{
869
- type: Input
870
- }], confirmDialog: [{
871
- type: Input
872
- }], confirmDrawer: [{
873
- type: Input
874
- }], confirmBrowser: [{
875
- type: Input
876
- }], confirmTabs: [{
877
- type: Input
878
- }], dirtySubmitButton: [{
879
- type: Input
880
- }], submit: [{
881
- type: Input
882
- }], successDelay: [{
883
- type: Input
884
- }], errorDelay: [{
885
- type: Input
886
- }], tabGroup: [{
887
- type: Input
888
- }], deactivationGuard: [{
889
- type: Input
890
- }], submitEvent: [{
891
- type: Output,
892
- args: ['fsForm']
893
- }], invalid: [{
894
- type: Output
895
- }], valid: [{
896
- type: Output
897
- }], submitted: [{
898
- type: Output
899
- }], reseted: [{
900
- type: Output
901
- }], cleared: [{
902
- type: Output
903
- }], fsFormClass: [{
904
- type: HostBinding,
905
- args: ['class.fs-form']
906
- }], formDialogClose: [{
907
- type: ContentChildren,
908
- args: [FsFormDialogCloseDirective, { descendants: true }]
909
- }], _tabGroups: [{
910
- type: ContentChildren,
911
- 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._confirmed = 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: 'nearest' });
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._confirmed = options === null || options === void 0 ? void 0 : options.confirmed;
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, confirmed: this._confirmed };
434
+ }), tap(() => this._confirmed = false), filter(() => {
435
+ return [FormStatus.Valid, FormStatus.Invalid]
436
+ .includes(this._status$.getValue());
437
+ }), tap(() => this._broadcasValidatingEvents()), tap(() => this.validate()), 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), { confirmed: data.confirmed }))));
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
+ validate() {
453
+ Object.values(this.ngForm.controls)
454
+ .forEach((control) => {
455
+ control.markAsDirty();
456
+ control.markAsTouched();
457
+ control.updateValueAndValidity();
458
+ });
459
+ }
460
+ _listenFormStatus() {
461
+ this._status$
462
+ .pipe(takeUntil(this._destroy$))
463
+ .subscribe((formStatus) => {
464
+ const cls = [FormStatus.Submitting, FormStatus.Validating];
465
+ const classList = this._element.nativeElement.classList;
466
+ classList.remove(...cls);
467
+ if (cls.indexOf(formStatus) !== -1) {
468
+ classList.add(formStatus);
469
+ }
470
+ });
471
+ }
472
+ _listenWindowClose() {
473
+ fromEvent(window, 'beforeunload')
474
+ .pipe(takeUntil(this._destroy$))
475
+ .subscribe((event) => {
476
+ if (this.confirm && this.confirmBrowser && this.ngForm.dirty) {
477
+ event.returnValue = false;
478
+ }
479
+ });
480
+ }
481
+ _listenHotKeys() {
482
+ this._ngZone.runOutsideAngular(() => {
483
+ fromEvent(document, 'keydown')
484
+ .pipe(takeUntil(this._destroy$))
485
+ .subscribe((event) => {
486
+ if (this._dialogBackdropEscape && event.code === 'Escape') {
487
+ const dialog = document.getElementById(this._dialogRef.id);
488
+ const paths = event.composedPath();
489
+ if (paths) {
490
+ paths.forEach(item => {
491
+ if (dialog === item) {
492
+ this._ngZone.run(() => {
493
+ this._formClose();
494
+ });
495
+ }
496
+ });
497
+ }
498
+ }
499
+ if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
500
+ event.preventDefault();
501
+ if (this.shortcuts) {
502
+ if (this._elementInForm(document.activeElement)) {
503
+ this.ngForm.ngSubmit.next();
504
+ }
505
+ }
506
+ }
507
+ });
508
+ });
509
+ }
510
+ _formClose() {
511
+ if (this.confirm && this.confirmDialog) {
512
+ this.triggerConfirm()
513
+ .pipe(filter((result) => confirmResultContinue(result)), switchMap((result) => {
514
+ return result === ConfirmResult.Pristine || result === ConfirmResult.Discard
515
+ ? of(null)
516
+ : this.submitted.asObservable();
517
+ }), takeUntil(this._destroy$))
518
+ .subscribe((result) => {
519
+ this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
520
+ });
521
+ }
522
+ else {
523
+ this._dialogRef.close(null);
524
+ }
525
+ }
526
+ _registerDialogClose(directive) {
527
+ if (!directive.registered) {
528
+ directive.registered = true;
529
+ directive.clicked$
530
+ .pipe(takeUntil(this._destroy$))
531
+ .subscribe(() => {
532
+ this._formClose();
533
+ });
534
+ }
535
+ }
536
+ _getActiveSubmitButton() {
537
+ const submitButtons = this._buttons
538
+ .filter((button) => button.submit);
539
+ const activeButton = submitButtons
540
+ .find(button => {
541
+ return button.active;
542
+ });
543
+ return activeButton ? activeButton : submitButtons[0];
544
+ }
545
+ _elementInForm(el) {
546
+ if (el.isSameNode(this._element.nativeElement)) {
547
+ return true;
548
+ }
549
+ else if (el.parentElement) {
550
+ return this._elementInForm(el.parentElement);
551
+ }
552
+ return false;
553
+ }
554
+ _completeSubmit(success, submitEvent) {
555
+ if (success) {
556
+ this.ngForm.control.markAsPristine();
557
+ this.createSnapshot();
558
+ this.submitted.emit(submitEvent);
559
+ }
560
+ else {
561
+ this._resetButtons();
562
+ }
563
+ if (this._activeSubmitButton) {
564
+ if (success) {
565
+ this._activeSubmitButton.success();
566
+ }
567
+ else {
568
+ this._activeSubmitButton.error();
569
+ }
570
+ }
571
+ this._status$.next(FormStatus.Submitted);
572
+ if (success) {
573
+ this._status$.next(FormStatus.Success);
574
+ }
575
+ else {
576
+ this._status$.next(FormStatus.Error);
577
+ }
578
+ this._status$.next(FormStatus.Completing);
579
+ const resetDelay = success ? this.successDelay : this.errorDelay;
580
+ of(true)
581
+ .pipe(delay(resetDelay), first(), takeUntil(this._destroy$)).subscribe(() => {
582
+ if (this.ngForm.form.status === 'VALID') {
583
+ this._status$.next(FormStatus.Valid);
584
+ }
585
+ else {
586
+ this._status$.next(FormStatus.Invalid);
587
+ }
588
+ this._resetButtons();
589
+ this._resetActiveButtons();
590
+ this._updateDirtySubmitButtons();
591
+ });
592
+ }
593
+ _resetButtons() {
594
+ this._buttons.forEach((button) => {
595
+ button.reset();
596
+ });
597
+ }
598
+ _resetActiveButtons() {
599
+ this._buttons.forEach((button) => {
600
+ button.resetActive();
601
+ });
602
+ }
603
+ _registerConfirm() {
604
+ this.ngForm.form.valueChanges
605
+ .pipe(takeUntil(this._destroy$))
606
+ .subscribe((changes) => {
607
+ if (this.confirm) {
608
+ const existing = Object.keys(this._snapshot);
609
+ Object.keys(changes)
610
+ .forEach((name) => {
611
+ if (existing.indexOf(name) === -1) {
612
+ this._snapshot[name] = changes[name];
613
+ }
614
+ });
615
+ }
616
+ });
617
+ }
618
+ _registerDrawerClose() {
619
+ if (this._drawerRef) {
620
+ this._drawerRef.closeStart$
621
+ .pipe(takeUntil(this._destroy$))
622
+ .subscribe((subscriber) => {
623
+ if (this.submitting) {
624
+ this._status$
625
+ .pipe(filter((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this._destroy$))
626
+ .subscribe((status) => {
627
+ if (status === FormStatus.Success) {
628
+ subscriber.next();
629
+ subscriber.complete();
630
+ }
631
+ else {
632
+ subscriber.error();
633
+ }
634
+ });
635
+ }
636
+ else {
637
+ subscriber.next();
638
+ subscriber.complete();
639
+ }
640
+ });
641
+ }
642
+ }
643
+ _registerConfirmDrawerClose() {
644
+ if (this._drawerRef) {
645
+ this._drawerRef.closeStart$
646
+ .pipe(switchMap((subscriber) => {
647
+ return iif(() => this.confirm && this.confirmDrawer, this.triggerConfirm()
648
+ .pipe(map((result) => confirmResultContinue(result)), tap((result) => {
649
+ if (result) {
650
+ subscriber.next();
651
+ subscriber.complete();
652
+ }
653
+ })), defer(() => {
654
+ subscriber.next();
655
+ subscriber.complete();
656
+ }));
657
+ }), takeUntil(this._destroy$))
658
+ .subscribe();
659
+ }
660
+ }
661
+ _registerConfirmTabs() {
662
+ if (this.tabGroup) {
663
+ this.registerConfirmTabGroup(this.tabGroup);
664
+ }
665
+ this.registerConfirmTabGroups(this._tabGroups.toArray());
666
+ this._tabGroups.changes
667
+ .pipe(takeUntil(this._destroy$))
668
+ .subscribe(() => {
669
+ this.registerConfirmTabGroups(this._tabGroups.toArray());
670
+ });
671
+ }
672
+ registerConfirmTabGroups(tabGroups) {
673
+ tabGroups.forEach((tabGroup) => {
674
+ this.registerConfirmTabGroup(tabGroup);
675
+ });
676
+ }
677
+ registerConfirmTabGroup(tabGroup) {
678
+ const confirmTabGroup = tabGroup;
679
+ if (!confirmTabGroup._originalHandleClick) {
680
+ confirmTabGroup._originalHandleClick = tabGroup._handleClick;
681
+ confirmTabGroup._handlClick$ = new Subject();
682
+ confirmTabGroup._handleClick = (tab, tabHeader, idx) => {
683
+ if (confirmTabGroup._handlClick$.observers.length) {
684
+ confirmTabGroup._handlClick$.next({ tab, tabHeader, idx });
685
+ }
686
+ else {
687
+ confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
688
+ }
689
+ };
690
+ }
691
+ confirmTabGroup._handlClick$
692
+ .pipe(takeUntil(this._destroy$))
693
+ .subscribe((event) => {
694
+ if (!this.submitting) {
695
+ if (this.confirm && this.confirmTabs) {
696
+ this.triggerConfirm()
697
+ .pipe(takeUntil(this._destroy$))
698
+ .subscribe((result) => {
699
+ if (confirmResultContinue(result)) {
700
+ confirmTabGroup.selectedIndex = event.idx;
701
+ }
702
+ });
703
+ }
704
+ else {
705
+ confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
706
+ }
707
+ }
708
+ });
709
+ }
710
+ _registerConfirmDialogClose() {
711
+ if (this._dialogRef) {
712
+ this.formDialogClose.forEach(item => {
713
+ this._registerDialogClose(item);
714
+ });
715
+ this.formDialogClose.changes
716
+ .pipe(takeUntil(this._destroy$))
717
+ .subscribe((e) => {
718
+ e.forEach(item => {
719
+ this._registerDialogClose(item);
720
+ });
721
+ });
722
+ }
723
+ }
724
+ _registerConfirmDialogBackdropEscape() {
725
+ this._dialogBackdropEscape = this._dialogRef && this._dialogRef.disableClose !== true;
726
+ if (this._dialogRef && !this._dialogRef.disableClose) {
727
+ this._dialogRef.disableClose = true;
728
+ this._dialogRef.backdropClick()
729
+ .pipe(takeUntil(this._destroy$))
730
+ .subscribe(() => {
731
+ this._formClose();
732
+ });
733
+ this._destroy$
734
+ .subscribe(() => {
735
+ this._dialogRef.disableClose = false;
736
+ });
737
+ }
738
+ }
739
+ _registerAutocomplete() {
740
+ this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
741
+ this.ngForm.form.registerControl = (name, control) => {
742
+ const el = this._element.nativeElement.querySelector(`input[name='${name}']`);
743
+ if (el) {
744
+ el.setAttribute('name', name + '_' + guid());
745
+ if (!el.getAttribute('autocomplete')) {
746
+ el.setAttribute('autocomplete', 'none');
747
+ }
748
+ }
749
+ return this._registerControl(name, control);
750
+ };
751
+ }
752
+ _registerDirtySubmitButton() {
753
+ if (!this.ngForm) {
754
+ return;
755
+ }
756
+ this.ngForm.form.valueChanges
757
+ .pipe(takeUntil(this._destroy$))
758
+ .subscribe(() => {
759
+ this._updateDirtySubmitButtons();
760
+ });
761
+ this._buttons.changes
762
+ .pipe(takeUntil(this._destroy$))
763
+ .subscribe(() => {
764
+ this._updateDirtySubmitButtons();
765
+ });
766
+ }
767
+ _updateDirtySubmitButtons() {
768
+ this._buttons
769
+ .filter((button) => button.submit)
770
+ .forEach((submitButton) => {
771
+ if (!this.confirm || !this.dirtySubmitButton || this.ngForm.dirty || !submitButton.dirtySubmit) {
772
+ submitButton.enable();
773
+ }
774
+ else {
775
+ submitButton.disable();
776
+ }
777
+ });
778
+ }
779
+ _broadcastSubmittingEvents() {
780
+ this._status$.next(FormStatus.Submitting);
781
+ this._form.broadcast('submit', this.ngForm);
782
+ }
783
+ _broadcasValidatingEvents() {
784
+ this._status$.next(FormStatus.Validating);
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
+ const guardIndex = this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard);
832
+ this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
833
+ this._form.removeFormDirective(this._activatedRouteConfig.component);
834
+ }
835
+ }
836
+ 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 });
837
+ 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 });
838
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDirective, decorators: [{
839
+ type: Directive,
840
+ args: [{
841
+ selector: '[fsForm]',
842
+ }]
843
+ }], ctorParameters: function () { return [{ type: i1$1.NgForm, decorators: [{
844
+ type: Inject,
845
+ args: [NgForm]
846
+ }] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2.FsMessage }, { type: i1.FsPrompt }, { type: i0.NgZone }, { type: i2$1.MatDialogRef, decorators: [{
847
+ type: Optional
848
+ }, {
849
+ type: Inject,
850
+ args: [MatDialogRef]
851
+ }] }, { type: i7.DrawerRef, decorators: [{
852
+ type: Optional
853
+ }, {
854
+ type: Inject,
855
+ args: [DrawerRef]
856
+ }] }, { type: i3.ActivatedRoute }]; }, propDecorators: { wrapperSelector: [{
857
+ type: Input
858
+ }], messageSelector: [{
859
+ type: Input
860
+ }], hintSelector: [{
861
+ type: Input
862
+ }], labelSelector: [{
863
+ type: Input
864
+ }], autocomplete: [{
865
+ type: Input
866
+ }], shortcuts: [{
867
+ type: Input
868
+ }], confirm: [{
869
+ type: Input
870
+ }], confirmDialog: [{
871
+ type: Input
872
+ }], confirmDrawer: [{
873
+ type: Input
874
+ }], confirmBrowser: [{
875
+ type: Input
876
+ }], confirmTabs: [{
877
+ type: Input
878
+ }], dirtySubmitButton: [{
879
+ type: Input
880
+ }], submit: [{
881
+ type: Input
882
+ }], successDelay: [{
883
+ type: Input
884
+ }], errorDelay: [{
885
+ type: Input
886
+ }], tabGroup: [{
887
+ type: Input
888
+ }], deactivationGuard: [{
889
+ type: Input
890
+ }], submitEvent: [{
891
+ type: Output,
892
+ args: ['fsForm']
893
+ }], invalid: [{
894
+ type: Output
895
+ }], valid: [{
896
+ type: Output
897
+ }], submitted: [{
898
+ type: Output
899
+ }], reseted: [{
900
+ type: Output
901
+ }], cleared: [{
902
+ type: Output
903
+ }], fsFormClass: [{
904
+ type: HostBinding,
905
+ args: ['class.fs-form']
906
+ }], formDialogClose: [{
907
+ type: ContentChildren,
908
+ args: [FsFormDialogCloseDirective, { descendants: true }]
909
+ }], _tabGroups: [{
910
+ type: ContentChildren,
911
+ args: [MatTabGroup, { descendants: true }]
912
912
  }] } });
913
913
 
914
- const ERROR_MESSAGES = {
915
- required: 'This field is required',
916
- email: 'This is not a valid email address',
917
- emails: 'Input valid email addresses, comma separated',
918
- phone: 'Invalid phone number',
919
- numeric: 'Value should be numeric',
920
- integer: 'Value should be an integer',
921
- min: 'Value should not be less than $(1)',
922
- max: 'Value should not be greater than $(1)',
923
- minlength: 'Should not be shorter than $(1) characters',
924
- maxlength: 'Should not be longer than $(1) characters',
925
- compare: 'Inputs do not match',
926
- pattern: 'Value should match pattern $(1)',
927
- dateRange: 'Invalid date range',
928
- url: 'This is not a valid url',
929
- urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
930
- greater: 'Value must be greater than $(1)',
931
- lesser: 'Value must be less than $(1)',
914
+ const ERROR_MESSAGES = {
915
+ required: 'This field is required',
916
+ email: 'This is not a valid email address',
917
+ emails: 'Input valid email addresses, comma separated',
918
+ phone: 'Invalid phone number',
919
+ numeric: 'Value should be numeric',
920
+ integer: 'Value should be an integer',
921
+ min: 'Value should not be less than $(1)',
922
+ max: 'Value should not be greater than $(1)',
923
+ minlength: 'Should not be shorter than $(1) characters',
924
+ maxlength: 'Should not be longer than $(1) characters',
925
+ compare: 'Inputs do not match',
926
+ pattern: 'Value should match pattern $(1)',
927
+ dateRange: 'Invalid date range',
928
+ url: 'This is not a valid url',
929
+ urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
930
+ greater: 'Value must be greater than $(1)',
931
+ lesser: 'Value must be less than $(1)',
932
932
  };
933
933
 
934
- const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
935
- const VALIDATE_MESSAGE_PROVIDER = {
936
- provide: VALIDATE_MESSAGES,
937
- useFactory: messageProviderFactory,
938
- };
939
- function messageProviderFactory() {
940
- return Object.assign({}, ERROR_MESSAGES);
934
+ const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
935
+ const VALIDATE_MESSAGE_PROVIDER = {
936
+ provide: VALIDATE_MESSAGES,
937
+ useFactory: messageProviderFactory,
938
+ };
939
+ function messageProviderFactory() {
940
+ return Object.assign({}, ERROR_MESSAGES);
941
941
  }
942
942
 
943
- class FsControlDirective {
944
- constructor(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
945
- this.elementRef = elementRef;
946
- this.renderer2 = renderer2;
947
- this.injector = injector;
948
- this._validateMessages = _validateMessages;
949
- this.ngControl = ngControl;
950
- this.formDirective = formDirective;
951
- this.appendMessageClass = 'fs-form-message';
952
- this.appendLabelClass = 'fs-form-label';
953
- this.appendErrorClass = 'fs-form-error';
954
- this.appendHintClass = 'fs-form-hint';
955
- this.errors = [];
956
- // protected _validateMessages = { ...ERROR_MESSAGES };
957
- this._destroy$ = new Subject();
958
- if (ngControl) {
959
- this._control = ngControl.control;
960
- }
961
- else {
962
- console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
963
- }
964
- }
965
- set validateMessages(messages) {
966
- this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
967
- }
968
- ngOnInit() {
969
- this._setupValidators();
970
- }
971
- ngOnDestroy() {
972
- this._destroy$.next();
973
- this._destroy$.complete();
974
- }
975
- ngAfterContentInit() {
976
- if (this._control) {
977
- /*
978
- Ensure that statusChanges has one subscription per control. Multiple can happen
979
- when multiple fsForm validation directives are applied to the same element
980
- */
981
- if (!this._control.statusChangesSubscribe) {
982
- this._control.statusChanges
983
- .pipe(takeUntil(this._destroy$))
984
- .subscribe(this.render.bind(this));
985
- this._control.statusChangesSubscribe = true;
986
- }
987
- }
988
- }
989
- getMessageSelector() {
990
- var _a;
991
- if (this.messageSelector === false) {
992
- return '';
993
- }
994
- if (this.messageSelector) {
995
- return this.messageSelector;
996
- }
997
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
998
- return this.formDirective.messageSelector;
999
- }
1000
- }
1001
- getHintWrapperSelector() {
1002
- var _a;
1003
- if (this.hintSelector === false) {
1004
- return '';
1005
- }
1006
- if (this.hintSelector) {
1007
- return this.hintSelector;
1008
- }
1009
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
1010
- return this.formDirective.hintSelector;
1011
- }
1012
- }
1013
- getWrapperSelector() {
1014
- var _a;
1015
- if (this.wrapperSelector === false) {
1016
- return '';
1017
- }
1018
- if (this.wrapperSelector) {
1019
- return this.wrapperSelector;
1020
- }
1021
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
1022
- return this.formDirective.wrapperSelector;
1023
- }
1024
- }
1025
- getlabelSelector() {
1026
- var _a;
1027
- if (this.labelSelector === false) {
1028
- return '';
1029
- }
1030
- if (this.labelSelector) {
1031
- return this.labelSelector;
1032
- }
1033
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
1034
- return this.formDirective.labelSelector;
1035
- }
1036
- }
1037
- getWrapperElement() {
1038
- const wrapper = this.getWrapper(this.elementRef.nativeElement);
1039
- if (wrapper) {
1040
- return wrapper;
1041
- }
1042
- return this.elementRef.nativeElement;
1043
- }
1044
- /*
1045
- <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.
1046
- <input>
1047
- <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1048
- <div class="fs-form-message"></div>
1049
- <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1050
- </div>
1051
- </mat-form-field>
1052
- */
1053
- render() {
1054
- var _a, _b;
1055
- if (this.ngControl) {
1056
- const renderer = this.renderer2;
1057
- const wrapper = this.getWrapperElement();
1058
- const error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1059
- const shouldErrorBeRendered = this.ngControl.invalid
1060
- && (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
1061
- if (shouldErrorBeRendered && error) {
1062
- wrapper.classList.add('ng-invalid', 'ng-dirty');
1063
- }
1064
- else {
1065
- wrapper.classList.remove('ng-invalid');
1066
- }
1067
- if (!this.getMessageSelector()) {
1068
- return;
1069
- }
1070
- const messageWrapper = wrapper.querySelector(this.getMessageSelector());
1071
- if (!messageWrapper) {
1072
- return console.warn('Failed to locate ' + this.getMessageSelector(), this.elementRef.nativeElement);
1073
- }
1074
- if (this.getlabelSelector()) {
1075
- const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1076
- if (labelWrapper) {
1077
- if (this.appendLabelClass) {
1078
- this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1079
- }
1080
- }
1081
- }
1082
- if (this.appendMessageClass) {
1083
- renderer.addClass(messageWrapper, this.appendMessageClass);
1084
- }
1085
- if (this.getHintWrapperSelector()) {
1086
- const hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1087
- if (hint) {
1088
- renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1089
- if (this.appendHintClass) {
1090
- renderer.addClass(hint, this.appendHintClass);
1091
- }
1092
- }
1093
- }
1094
- let errorWrapper = wrapper.querySelector('.fs-form-error-target');
1095
- if (errorWrapper) {
1096
- errorWrapper.remove();
1097
- }
1098
- if (!shouldErrorBeRendered || !error) {
1099
- return;
1100
- }
1101
- errorWrapper = renderer.createElement('div');
1102
- renderer.addClass(errorWrapper, 'fs-form-error-target');
1103
- renderer.addClass(errorWrapper, this.appendErrorClass);
1104
- renderer.addClass(errorWrapper, this.appendErrorClass + '-' + error.name);
1105
- const errorText = renderer.createText(error.message);
1106
- renderer.appendChild(errorWrapper, errorText);
1107
- messageWrapper.appendChild(errorWrapper);
1108
- }
1109
- }
1110
- getWrapper(node, count = 0) {
1111
- if (!node || count > 10) {
1112
- return null;
1113
- }
1114
- if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1115
- return node;
1116
- }
1117
- return this.getWrapper(node.parentNode, ++count);
1118
- }
1119
- parseErrorMessage(message, args) {
1120
- values(args)
1121
- .forEach((name) => {
1122
- message = message.replace(/\$\(\d\)/, name);
1123
- });
1124
- return message;
1125
- }
1126
- getError(controlRef) {
1127
- const name = keys(controlRef.control.errors)[0];
1128
- if (!name) {
1129
- return null;
1130
- }
1131
- let message = controlRef.control.errors[name];
1132
- if (this._validateMessages[name]) {
1133
- message = this.parseErrorMessage(this._validateMessages[name], message);
1134
- }
1135
- return { name: name, message: message };
1136
- }
1137
- _setupValidators() {
1138
- const control = this._control;
1139
- if (this.validate) {
1140
- const validators = control.validator
1141
- ? [control.validator, this.validate.bind(this)]
1142
- : this.validate.bind(this);
1143
- control.setValidators(validators);
1144
- }
1145
- if (this.validateAsync) {
1146
- const asyncValidators = control.asyncValidator
1147
- ? [control.asyncValidator, this.validateAsync.bind(this)]
1148
- : this.validateAsync.bind(this);
1149
- control.setAsyncValidators(asyncValidators);
1150
- }
1151
- control.updateValueAndValidity();
1152
- }
1153
- }
1154
- 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 });
1155
- 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: [
1156
- VALIDATE_MESSAGE_PROVIDER
1157
- ], ngImport: i0 });
1158
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsControlDirective, decorators: [{
1159
- type: Directive,
1160
- args: [{
1161
- selector: '[fsFormControl]',
1162
- providers: [
1163
- VALIDATE_MESSAGE_PROVIDER
1164
- ],
1165
- }]
1166
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: undefined, decorators: [{
1167
- type: Self
1168
- }, {
1169
- type: Inject,
1170
- args: [VALIDATE_MESSAGES]
1171
- }] }, { type: i1$1.NgControl, decorators: [{
1172
- type: Optional
1173
- }] }, { type: FsFormDirective, decorators: [{
1174
- type: Optional
1175
- }, {
1176
- type: Inject,
1177
- args: [FsFormDirective]
1178
- }] }]; }, propDecorators: { wrapperSelector: [{
1179
- type: Input
1180
- }], messageSelector: [{
1181
- type: Input
1182
- }], hintSelector: [{
1183
- type: Input
1184
- }], labelSelector: [{
1185
- type: Input
1186
- }], appendMessageClass: [{
1187
- type: Input
1188
- }], appendLabelClass: [{
1189
- type: Input
1190
- }], appendErrorClass: [{
1191
- type: Input
1192
- }], appendHintClass: [{
1193
- type: Input
1194
- }], validateMessages: [{
1195
- type: Input
943
+ class FsControlDirective {
944
+ constructor(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
945
+ this.elementRef = elementRef;
946
+ this.renderer2 = renderer2;
947
+ this.injector = injector;
948
+ this._validateMessages = _validateMessages;
949
+ this.ngControl = ngControl;
950
+ this.formDirective = formDirective;
951
+ this.appendMessageClass = 'fs-form-message';
952
+ this.appendLabelClass = 'fs-form-label';
953
+ this.appendErrorClass = 'fs-form-error';
954
+ this.appendHintClass = 'fs-form-hint';
955
+ this.errors = [];
956
+ // protected _validateMessages = { ...ERROR_MESSAGES };
957
+ this._destroy$ = new Subject();
958
+ if (ngControl) {
959
+ this._control = ngControl.control;
960
+ }
961
+ else {
962
+ console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
963
+ }
964
+ }
965
+ set validateMessages(messages) {
966
+ this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
967
+ }
968
+ ngOnInit() {
969
+ this._setupValidators();
970
+ }
971
+ ngOnDestroy() {
972
+ this._destroy$.next();
973
+ this._destroy$.complete();
974
+ }
975
+ ngAfterContentInit() {
976
+ if (this._control) {
977
+ this._control.statusChanges
978
+ .pipe(takeUntil(this._destroy$))
979
+ .subscribe(this.render.bind(this));
980
+ }
981
+ }
982
+ getMessageSelector() {
983
+ var _a;
984
+ if (this.messageSelector === false) {
985
+ return '';
986
+ }
987
+ if (this.messageSelector) {
988
+ return this.messageSelector;
989
+ }
990
+ else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
991
+ return this.formDirective.messageSelector;
992
+ }
993
+ }
994
+ getHintWrapperSelector() {
995
+ var _a;
996
+ if (this.hintSelector === false) {
997
+ return '';
998
+ }
999
+ if (this.hintSelector) {
1000
+ return this.hintSelector;
1001
+ }
1002
+ else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
1003
+ return this.formDirective.hintSelector;
1004
+ }
1005
+ }
1006
+ getWrapperSelector() {
1007
+ var _a;
1008
+ if (this.wrapperSelector === false) {
1009
+ return '';
1010
+ }
1011
+ if (this.wrapperSelector) {
1012
+ return this.wrapperSelector;
1013
+ }
1014
+ else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
1015
+ return this.formDirective.wrapperSelector;
1016
+ }
1017
+ }
1018
+ getlabelSelector() {
1019
+ var _a;
1020
+ if (this.labelSelector === false) {
1021
+ return '';
1022
+ }
1023
+ if (this.labelSelector) {
1024
+ return this.labelSelector;
1025
+ }
1026
+ else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
1027
+ return this.formDirective.labelSelector;
1028
+ }
1029
+ }
1030
+ getWrapperElement() {
1031
+ const wrapper = this.getWrapper(this.elementRef.nativeElement);
1032
+ if (wrapper) {
1033
+ return wrapper;
1034
+ }
1035
+ return this.elementRef.nativeElement;
1036
+ }
1037
+ /*
1038
+ <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.
1039
+ <input>
1040
+ <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1041
+ <div class="fs-form-message"></div>
1042
+ <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1043
+ </div>
1044
+ </mat-form-field>
1045
+ */
1046
+ render() {
1047
+ var _a, _b;
1048
+ if (this._control.statusChangesSubscribe) {
1049
+ return;
1050
+ }
1051
+ this._control.statusChangesSubscribe = true;
1052
+ if (this.ngControl) {
1053
+ const renderer = this.renderer2;
1054
+ const wrapper = this.getWrapperElement();
1055
+ const error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1056
+ const shouldErrorBeRendered = this.ngControl.invalid
1057
+ && (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
1058
+ if (shouldErrorBeRendered && error) {
1059
+ wrapper.classList.add('ng-invalid', 'ng-dirty');
1060
+ }
1061
+ else {
1062
+ wrapper.classList.remove('ng-invalid');
1063
+ }
1064
+ if (!this.getMessageSelector()) {
1065
+ return;
1066
+ }
1067
+ const messageWrapper = wrapper.querySelector(this.getMessageSelector());
1068
+ if (!messageWrapper) {
1069
+ return console.warn('Failed to locate ' + this.getMessageSelector(), this.elementRef.nativeElement);
1070
+ }
1071
+ if (this.getlabelSelector()) {
1072
+ const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1073
+ if (labelWrapper) {
1074
+ if (this.appendLabelClass) {
1075
+ this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1076
+ }
1077
+ }
1078
+ }
1079
+ if (this.appendMessageClass) {
1080
+ renderer.addClass(messageWrapper, this.appendMessageClass);
1081
+ }
1082
+ if (this.getHintWrapperSelector()) {
1083
+ const hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1084
+ if (hint) {
1085
+ renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1086
+ if (this.appendHintClass) {
1087
+ renderer.addClass(hint, this.appendHintClass);
1088
+ }
1089
+ }
1090
+ }
1091
+ let errorWrapper = wrapper.querySelector('.fs-form-error-target');
1092
+ if (errorWrapper) {
1093
+ errorWrapper.remove();
1094
+ }
1095
+ if (!shouldErrorBeRendered || !error) {
1096
+ return;
1097
+ }
1098
+ errorWrapper = renderer.createElement('div');
1099
+ renderer.addClass(errorWrapper, 'fs-form-error-target');
1100
+ renderer.addClass(errorWrapper, this.appendErrorClass);
1101
+ renderer.addClass(errorWrapper, this.appendErrorClass + '-' + error.name);
1102
+ const errorText = renderer.createText(error.message);
1103
+ renderer.appendChild(errorWrapper, errorText);
1104
+ messageWrapper.appendChild(errorWrapper);
1105
+ }
1106
+ }
1107
+ getWrapper(node, count = 0) {
1108
+ if (!node || count > 10) {
1109
+ return null;
1110
+ }
1111
+ if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1112
+ return node;
1113
+ }
1114
+ return this.getWrapper(node.parentNode, ++count);
1115
+ }
1116
+ parseErrorMessage(message, args) {
1117
+ values(args)
1118
+ .forEach((name) => {
1119
+ message = message.replace(/\$\(\d\)/, name);
1120
+ });
1121
+ return message;
1122
+ }
1123
+ getError(controlRef) {
1124
+ const name = keys(controlRef.control.errors)[0];
1125
+ if (!name) {
1126
+ return null;
1127
+ }
1128
+ let message = controlRef.control.errors[name];
1129
+ if (this._validateMessages[name]) {
1130
+ message = this.parseErrorMessage(this._validateMessages[name], message);
1131
+ }
1132
+ return { name: name, message: message };
1133
+ }
1134
+ _setupValidators() {
1135
+ const control = this._control;
1136
+ if (this.validate) {
1137
+ const validators = control.validator
1138
+ ? [control.validator, this.validate.bind(this)]
1139
+ : this.validate.bind(this);
1140
+ control.setValidators(validators);
1141
+ }
1142
+ if (this.validateAsync) {
1143
+ const asyncValidators = control.asyncValidator
1144
+ ? [control.asyncValidator, this.validateAsync.bind(this)]
1145
+ : this.validateAsync.bind(this);
1146
+ control.setAsyncValidators(asyncValidators);
1147
+ }
1148
+ control.updateValueAndValidity();
1149
+ }
1150
+ }
1151
+ 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 });
1152
+ 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: [
1153
+ VALIDATE_MESSAGE_PROVIDER
1154
+ ], ngImport: i0 });
1155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsControlDirective, decorators: [{
1156
+ type: Directive,
1157
+ args: [{
1158
+ selector: '[fsFormControl]',
1159
+ providers: [
1160
+ VALIDATE_MESSAGE_PROVIDER
1161
+ ],
1162
+ }]
1163
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: undefined, decorators: [{
1164
+ type: Self
1165
+ }, {
1166
+ type: Inject,
1167
+ args: [VALIDATE_MESSAGES]
1168
+ }] }, { type: i1$1.NgControl, decorators: [{
1169
+ type: Optional
1170
+ }] }, { type: FsFormDirective, decorators: [{
1171
+ type: Optional
1172
+ }, {
1173
+ type: Inject,
1174
+ args: [FsFormDirective]
1175
+ }] }]; }, propDecorators: { wrapperSelector: [{
1176
+ type: Input
1177
+ }], messageSelector: [{
1178
+ type: Input
1179
+ }], hintSelector: [{
1180
+ type: Input
1181
+ }], labelSelector: [{
1182
+ type: Input
1183
+ }], appendMessageClass: [{
1184
+ type: Input
1185
+ }], appendLabelClass: [{
1186
+ type: Input
1187
+ }], appendErrorClass: [{
1188
+ type: Input
1189
+ }], appendHintClass: [{
1190
+ type: Input
1191
+ }], validateMessages: [{
1192
+ type: Input
1196
1193
  }] } });
1197
1194
 
1198
- function isEnabled(value) {
1199
- return value !== 'false' && (value || value === '');
1195
+ function isEnabled(value) {
1196
+ return value !== 'false' && (value || value === '');
1200
1197
  }
1201
1198
 
1202
- class FsFormRequiredDirective extends FsControlDirective {
1203
- constructor() {
1204
- super(...arguments);
1205
- this.required = false;
1206
- }
1207
- set setFsFormRequired(value) {
1208
- this.required = isEnabled(value);
1209
- }
1210
- set setRequired(value) {
1211
- this.required = isEnabled(value);
1212
- }
1213
- set validationMessage(value) {
1214
- this._validateMessages.required = value;
1215
- }
1216
- ngOnChanges() {
1217
- this._control.updateValueAndValidity();
1218
- }
1219
- validate(control) {
1220
- if (this.required) {
1221
- return Validators.required(this._control);
1222
- }
1223
- else {
1224
- return null;
1225
- }
1226
- }
1227
- render() {
1228
- const wrapper = this.getWrapperElement();
1229
- if (wrapper && this.getlabelSelector()) {
1230
- const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1231
- // Adding class fs-form-label-requried adds the * to the label
1232
- if (labelWrapper) {
1233
- if (this.required) {
1234
- this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
1235
- }
1236
- else {
1237
- this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
1238
- }
1239
- }
1240
- }
1241
- super.render();
1242
- }
1243
- }
1244
- FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1245
- 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: [
1246
- VALIDATE_MESSAGE_PROVIDER
1247
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1248
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormRequiredDirective, decorators: [{
1249
- type: Directive,
1250
- args: [{
1251
- selector: '[fsFormRequired],[ngModel][required]',
1252
- providers: [
1253
- VALIDATE_MESSAGE_PROVIDER
1254
- ],
1255
- }]
1256
- }], propDecorators: { setFsFormRequired: [{
1257
- type: Input,
1258
- args: ['fsFormRequired']
1259
- }], setRequired: [{
1260
- type: Input,
1261
- args: ['required']
1262
- }], validationMessage: [{
1263
- type: Input,
1264
- args: ['fsFormRequiredMessage']
1199
+ class FsFormRequiredDirective extends FsControlDirective {
1200
+ constructor() {
1201
+ super(...arguments);
1202
+ this.required = false;
1203
+ }
1204
+ set setFsFormRequired(value) {
1205
+ this.required = isEnabled(value);
1206
+ }
1207
+ set setRequired(value) {
1208
+ this.required = isEnabled(value);
1209
+ }
1210
+ set validationMessage(value) {
1211
+ this._validateMessages.required = value;
1212
+ }
1213
+ ngOnChanges() {
1214
+ this._control.updateValueAndValidity();
1215
+ }
1216
+ validate(control) {
1217
+ if (this.required) {
1218
+ return Validators.required(this._control);
1219
+ }
1220
+ else {
1221
+ return null;
1222
+ }
1223
+ }
1224
+ render() {
1225
+ const wrapper = this.getWrapperElement();
1226
+ if (wrapper && this.getlabelSelector()) {
1227
+ const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1228
+ // Adding class fs-form-label-requried adds the * to the label
1229
+ if (labelWrapper) {
1230
+ if (this.required) {
1231
+ this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
1232
+ }
1233
+ else {
1234
+ this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
1235
+ }
1236
+ }
1237
+ }
1238
+ super.render();
1239
+ }
1240
+ }
1241
+ FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1242
+ 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: [
1243
+ VALIDATE_MESSAGE_PROVIDER
1244
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormRequiredDirective, decorators: [{
1246
+ type: Directive,
1247
+ args: [{
1248
+ selector: '[fsFormRequired],[ngModel][required]',
1249
+ providers: [
1250
+ VALIDATE_MESSAGE_PROVIDER
1251
+ ],
1252
+ }]
1253
+ }], propDecorators: { setFsFormRequired: [{
1254
+ type: Input,
1255
+ args: ['fsFormRequired']
1256
+ }], setRequired: [{
1257
+ type: Input,
1258
+ args: ['required']
1259
+ }], validationMessage: [{
1260
+ type: Input,
1261
+ args: ['fsFormRequiredMessage']
1265
1262
  }] } });
1266
1263
 
1267
- class FsValidators {
1268
- static email(control) {
1269
- if (!control.value || email(control.value)) {
1270
- return null;
1271
- }
1272
- return { email: true };
1273
- }
1274
- static emails(control) {
1275
- const model = control.value || '';
1276
- const hasInvalidEmails = model
1277
- .split(',')
1278
- .some((part) => !email(part));
1279
- return hasInvalidEmails ? { email: true } : null;
1280
- }
1281
- static numeric(control) {
1282
- if (isEmpty(control.value) || isNumeric(control.value)) {
1283
- return null;
1284
- }
1285
- else {
1286
- return { numeric: true };
1287
- }
1288
- }
1289
- static integer(control) {
1290
- if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1291
- return null;
1292
- }
1293
- else {
1294
- return { integer: true };
1295
- }
1296
- }
1297
- static phone(control) {
1298
- if (!control.value || phone(control.value)) {
1299
- return null;
1300
- }
1301
- return { phone: true };
1302
- }
1303
- static url(control, protocolRequired = false) {
1304
- if (!control.value) {
1305
- return null;
1306
- }
1307
- if (!url(control.value)) {
1308
- return { url: true };
1309
- }
1310
- if (protocolRequired) {
1311
- const pattern = new RegExp(/^http(s)?:\/\//gm);
1312
- if (!String(control.value).match(pattern)) {
1313
- return { urlProtocol: true };
1314
- }
1315
- }
1316
- return null;
1317
- }
1318
- static dateRange(control) {
1319
- if (!control.value) {
1320
- return null;
1321
- }
1322
- if (isObject(control.value)) {
1323
- const start = control.value.start;
1324
- const end = control.value.end;
1325
- if ((!start && !end) || (isValid(start) && isValid(end))) {
1326
- return null;
1327
- }
1328
- }
1329
- return { dateRange: true };
1330
- }
1331
- static func(control, formFunction, data) {
1332
- let result;
1333
- let stream$;
1334
- try {
1335
- result = formFunction(control, data);
1336
- }
1337
- catch (err) {
1338
- err = err instanceof Error ? err.message : err;
1339
- stream$ = throwError(err);
1340
- }
1341
- if (!stream$) {
1342
- if (result instanceof Promise) {
1343
- stream$ = from(result);
1344
- }
1345
- else if (isObservable(result)) {
1346
- stream$ = result;
1347
- }
1348
- else {
1349
- stream$ = of(null);
1350
- }
1351
- }
1352
- return stream$
1353
- .pipe(map(() => null), catchError((err) => {
1354
- return of({ validationError: err });
1355
- }), take(1));
1356
- }
1264
+ class FsValidators {
1265
+ static email(control) {
1266
+ if (!control.value || email(control.value)) {
1267
+ return null;
1268
+ }
1269
+ return { email: true };
1270
+ }
1271
+ static emails(control) {
1272
+ const model = control.value || '';
1273
+ const hasInvalidEmails = model
1274
+ .split(',')
1275
+ .some((part) => !email(part));
1276
+ return hasInvalidEmails ? { email: true } : null;
1277
+ }
1278
+ static numeric(control) {
1279
+ if (isEmpty(control.value) || isNumeric(control.value)) {
1280
+ return null;
1281
+ }
1282
+ else {
1283
+ return { numeric: true };
1284
+ }
1285
+ }
1286
+ static integer(control) {
1287
+ if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1288
+ return null;
1289
+ }
1290
+ else {
1291
+ return { integer: true };
1292
+ }
1293
+ }
1294
+ static phone(control) {
1295
+ if (!control.value || phone(control.value)) {
1296
+ return null;
1297
+ }
1298
+ return { phone: true };
1299
+ }
1300
+ static url(control, protocolRequired = false) {
1301
+ if (!control.value) {
1302
+ return null;
1303
+ }
1304
+ if (!url(control.value)) {
1305
+ return { url: true };
1306
+ }
1307
+ if (protocolRequired) {
1308
+ const pattern = new RegExp(/^http(s)?:\/\//gm);
1309
+ if (!String(control.value).match(pattern)) {
1310
+ return { urlProtocol: true };
1311
+ }
1312
+ }
1313
+ return null;
1314
+ }
1315
+ static dateRange(control) {
1316
+ if (!control.value) {
1317
+ return null;
1318
+ }
1319
+ if (isObject(control.value)) {
1320
+ const start = control.value.start;
1321
+ const end = control.value.end;
1322
+ if ((!start && !end) || (isValid(start) && isValid(end))) {
1323
+ return null;
1324
+ }
1325
+ }
1326
+ return { dateRange: true };
1327
+ }
1328
+ static func(control, formFunction, data) {
1329
+ let result;
1330
+ let stream$;
1331
+ try {
1332
+ result = formFunction(control, data);
1333
+ }
1334
+ catch (err) {
1335
+ err = err instanceof Error ? err.message : err;
1336
+ stream$ = throwError(err);
1337
+ }
1338
+ if (!stream$) {
1339
+ if (result instanceof Promise) {
1340
+ stream$ = from(result);
1341
+ }
1342
+ else if (isObservable(result)) {
1343
+ stream$ = result;
1344
+ }
1345
+ else {
1346
+ stream$ = of(null);
1347
+ }
1348
+ }
1349
+ return stream$
1350
+ .pipe(map(() => null), catchError((err) => {
1351
+ return of({ validationError: err });
1352
+ }), take(1));
1353
+ }
1357
1354
  }
1358
1355
 
1359
- class FsFormMinDirective extends FsControlDirective {
1360
- set validationMessage(value) {
1361
- this._validateMessages.min = value;
1362
- }
1363
- ngOnChanges() {
1364
- this._control.updateValueAndValidity();
1365
- }
1366
- validate(control) {
1367
- return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
1368
- }
1369
- }
1370
- FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1371
- FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
1372
- VALIDATE_MESSAGE_PROVIDER
1373
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinDirective, decorators: [{
1375
- type: Directive,
1376
- args: [{
1377
- selector: '[fsFormMin]',
1378
- providers: [
1379
- VALIDATE_MESSAGE_PROVIDER
1380
- ],
1381
- }]
1382
- }], propDecorators: { fsFormMin: [{
1383
- type: Input
1384
- }], validationMessage: [{
1385
- type: Input,
1386
- args: ['fsFormMinMessage']
1356
+ class FsFormMinDirective extends FsControlDirective {
1357
+ set validationMessage(value) {
1358
+ this._validateMessages.min = value;
1359
+ }
1360
+ ngOnChanges() {
1361
+ this._control.updateValueAndValidity();
1362
+ }
1363
+ validate(control) {
1364
+ return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
1365
+ }
1366
+ }
1367
+ FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1368
+ FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
1369
+ VALIDATE_MESSAGE_PROVIDER
1370
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinDirective, decorators: [{
1372
+ type: Directive,
1373
+ args: [{
1374
+ selector: '[fsFormMin]',
1375
+ providers: [
1376
+ VALIDATE_MESSAGE_PROVIDER
1377
+ ],
1378
+ }]
1379
+ }], propDecorators: { fsFormMin: [{
1380
+ type: Input
1381
+ }], validationMessage: [{
1382
+ type: Input,
1383
+ args: ['fsFormMinMessage']
1387
1384
  }] } });
1388
1385
 
1389
- class FsFormMaxDirective extends FsControlDirective {
1390
- set validationMessage(value) {
1391
- this._validateMessages.max = value;
1392
- }
1393
- ngOnChanges() {
1394
- this._control.updateValueAndValidity();
1395
- }
1396
- validate(control) {
1397
- return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
1398
- }
1399
- }
1400
- FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1401
- FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
1402
- VALIDATE_MESSAGE_PROVIDER
1403
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1404
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxDirective, decorators: [{
1405
- type: Directive,
1406
- args: [{
1407
- selector: '[fsFormMax]',
1408
- providers: [
1409
- VALIDATE_MESSAGE_PROVIDER
1410
- ],
1411
- }]
1412
- }], propDecorators: { fsFormMax: [{
1413
- type: Input
1414
- }], validationMessage: [{
1415
- type: Input,
1416
- args: ['fsFormMaxMessage']
1386
+ class FsFormMaxDirective extends FsControlDirective {
1387
+ set validationMessage(value) {
1388
+ this._validateMessages.max = value;
1389
+ }
1390
+ ngOnChanges() {
1391
+ this._control.updateValueAndValidity();
1392
+ }
1393
+ validate(control) {
1394
+ return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
1395
+ }
1396
+ }
1397
+ FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1398
+ FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
1399
+ VALIDATE_MESSAGE_PROVIDER
1400
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxDirective, decorators: [{
1402
+ type: Directive,
1403
+ args: [{
1404
+ selector: '[fsFormMax]',
1405
+ providers: [
1406
+ VALIDATE_MESSAGE_PROVIDER
1407
+ ],
1408
+ }]
1409
+ }], propDecorators: { fsFormMax: [{
1410
+ type: Input
1411
+ }], validationMessage: [{
1412
+ type: Input,
1413
+ args: ['fsFormMaxMessage']
1417
1414
  }] } });
1418
1415
 
1419
- class FsFormMinLengthDirective extends FsControlDirective {
1420
- set validationMessage(value) {
1421
- this._validateMessages.minlength = value;
1422
- }
1423
- ngOnChanges() {
1424
- this._control.updateValueAndValidity();
1425
- }
1426
- validate(control) {
1427
- return Validators.minLength(this.fsFormMinLength)(this._control);
1428
- }
1429
- }
1430
- FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1431
- FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
1432
- VALIDATE_MESSAGE_PROVIDER
1433
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1434
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinLengthDirective, decorators: [{
1435
- type: Directive,
1436
- args: [{
1437
- selector: '[fsFormMinLength]',
1438
- providers: [
1439
- VALIDATE_MESSAGE_PROVIDER
1440
- ],
1441
- }]
1442
- }], propDecorators: { fsFormMinLength: [{
1443
- type: Input
1444
- }], validationMessage: [{
1445
- type: Input,
1446
- args: ['fsFormMinLengthMessage']
1416
+ class FsFormMinLengthDirective extends FsControlDirective {
1417
+ set validationMessage(value) {
1418
+ this._validateMessages.minlength = value;
1419
+ }
1420
+ ngOnChanges() {
1421
+ this._control.updateValueAndValidity();
1422
+ }
1423
+ validate(control) {
1424
+ return Validators.minLength(this.fsFormMinLength)(this._control);
1425
+ }
1426
+ }
1427
+ FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1428
+ FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
1429
+ VALIDATE_MESSAGE_PROVIDER
1430
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinLengthDirective, decorators: [{
1432
+ type: Directive,
1433
+ args: [{
1434
+ selector: '[fsFormMinLength]',
1435
+ providers: [
1436
+ VALIDATE_MESSAGE_PROVIDER
1437
+ ],
1438
+ }]
1439
+ }], propDecorators: { fsFormMinLength: [{
1440
+ type: Input
1441
+ }], validationMessage: [{
1442
+ type: Input,
1443
+ args: ['fsFormMinLengthMessage']
1447
1444
  }] } });
1448
1445
 
1449
- class FsFormMaxLengthDirective extends FsControlDirective {
1450
- set validationMessage(value) {
1451
- this._validateMessages.maxlength = value;
1452
- }
1453
- ngOnChanges() {
1454
- this._control.updateValueAndValidity();
1455
- }
1456
- validate(control) {
1457
- return Validators.maxLength(this.fsFormMaxLength)(this._control);
1458
- }
1459
- }
1460
- FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1461
- FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
1462
- VALIDATE_MESSAGE_PROVIDER
1463
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1464
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxLengthDirective, decorators: [{
1465
- type: Directive,
1466
- args: [{
1467
- selector: '[fsFormMaxLength]',
1468
- providers: [
1469
- VALIDATE_MESSAGE_PROVIDER
1470
- ],
1471
- }]
1472
- }], propDecorators: { fsFormMaxLength: [{
1473
- type: Input
1474
- }], validationMessage: [{
1475
- type: Input,
1476
- args: ['fsFormMaxLengthMessage']
1446
+ class FsFormMaxLengthDirective extends FsControlDirective {
1447
+ set validationMessage(value) {
1448
+ this._validateMessages.maxlength = value;
1449
+ }
1450
+ ngOnChanges() {
1451
+ this._control.updateValueAndValidity();
1452
+ }
1453
+ validate(control) {
1454
+ return Validators.maxLength(this.fsFormMaxLength)(this._control);
1455
+ }
1456
+ }
1457
+ FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1458
+ FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
1459
+ VALIDATE_MESSAGE_PROVIDER
1460
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxLengthDirective, decorators: [{
1462
+ type: Directive,
1463
+ args: [{
1464
+ selector: '[fsFormMaxLength]',
1465
+ providers: [
1466
+ VALIDATE_MESSAGE_PROVIDER
1467
+ ],
1468
+ }]
1469
+ }], propDecorators: { fsFormMaxLength: [{
1470
+ type: Input
1471
+ }], validationMessage: [{
1472
+ type: Input,
1473
+ args: ['fsFormMaxLengthMessage']
1477
1474
  }] } });
1478
1475
 
1479
- class FsFormEmailDirective extends FsControlDirective {
1480
- set validationMessage(value) {
1481
- this._validateMessages.email = value;
1482
- }
1483
- ngOnChanges() {
1484
- this._control.updateValueAndValidity();
1485
- }
1486
- validate(control) {
1487
- if (isEnabled(this.fsFormEmail)) {
1488
- return FsValidators.email(this._control);
1489
- }
1490
- else {
1491
- return null;
1492
- }
1493
- }
1494
- }
1495
- FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1496
- FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
1497
- VALIDATE_MESSAGE_PROVIDER
1498
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1499
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailDirective, decorators: [{
1500
- type: Directive,
1501
- args: [{
1502
- selector: '[fsFormEmail]',
1503
- providers: [
1504
- VALIDATE_MESSAGE_PROVIDER
1505
- ],
1506
- }]
1507
- }], propDecorators: { fsFormEmail: [{
1508
- type: Input
1509
- }], validationMessage: [{
1510
- type: Input,
1511
- args: ['fsFormEmailMessage']
1476
+ class FsFormEmailDirective extends FsControlDirective {
1477
+ set validationMessage(value) {
1478
+ this._validateMessages.email = value;
1479
+ }
1480
+ ngOnChanges() {
1481
+ this._control.updateValueAndValidity();
1482
+ }
1483
+ validate(control) {
1484
+ if (isEnabled(this.fsFormEmail)) {
1485
+ return FsValidators.email(this._control);
1486
+ }
1487
+ else {
1488
+ return null;
1489
+ }
1490
+ }
1491
+ }
1492
+ FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1493
+ FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
1494
+ VALIDATE_MESSAGE_PROVIDER
1495
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailDirective, decorators: [{
1497
+ type: Directive,
1498
+ args: [{
1499
+ selector: '[fsFormEmail]',
1500
+ providers: [
1501
+ VALIDATE_MESSAGE_PROVIDER
1502
+ ],
1503
+ }]
1504
+ }], propDecorators: { fsFormEmail: [{
1505
+ type: Input
1506
+ }], validationMessage: [{
1507
+ type: Input,
1508
+ args: ['fsFormEmailMessage']
1512
1509
  }] } });
1513
1510
 
1514
- class FsFormEmailsDirective extends FsControlDirective {
1515
- set validationMessage(value) {
1516
- this._validateMessages.emails = value;
1517
- }
1518
- ngOnChanges() {
1519
- this._control.updateValueAndValidity();
1520
- }
1521
- validate(control) {
1522
- if (isEnabled(this.fsFormEmails)) {
1523
- return FsValidators.emails(this._control);
1524
- }
1525
- else {
1526
- return null;
1527
- }
1528
- }
1529
- }
1530
- FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1531
- FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
1532
- VALIDATE_MESSAGE_PROVIDER
1533
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailsDirective, decorators: [{
1535
- type: Directive,
1536
- args: [{
1537
- selector: '[fsFormEmails]',
1538
- providers: [
1539
- VALIDATE_MESSAGE_PROVIDER
1540
- ],
1541
- }]
1542
- }], propDecorators: { fsFormEmails: [{
1543
- type: Input
1544
- }], validationMessage: [{
1545
- type: Input,
1546
- args: ['fsFormEmailsMessage']
1511
+ class FsFormEmailsDirective extends FsControlDirective {
1512
+ set validationMessage(value) {
1513
+ this._validateMessages.emails = value;
1514
+ }
1515
+ ngOnChanges() {
1516
+ this._control.updateValueAndValidity();
1517
+ }
1518
+ validate(control) {
1519
+ if (isEnabled(this.fsFormEmails)) {
1520
+ return FsValidators.emails(this._control);
1521
+ }
1522
+ else {
1523
+ return null;
1524
+ }
1525
+ }
1526
+ }
1527
+ FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1528
+ FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
1529
+ VALIDATE_MESSAGE_PROVIDER
1530
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailsDirective, decorators: [{
1532
+ type: Directive,
1533
+ args: [{
1534
+ selector: '[fsFormEmails]',
1535
+ providers: [
1536
+ VALIDATE_MESSAGE_PROVIDER
1537
+ ],
1538
+ }]
1539
+ }], propDecorators: { fsFormEmails: [{
1540
+ type: Input
1541
+ }], validationMessage: [{
1542
+ type: Input,
1543
+ args: ['fsFormEmailsMessage']
1547
1544
  }] } });
1548
1545
 
1549
- class FsFormPhoneDirective extends FsControlDirective {
1550
- set validationMessage(value) {
1551
- this._validateMessages.phone = value;
1552
- }
1553
- ngOnChanges() {
1554
- this._control.updateValueAndValidity();
1555
- }
1556
- validate(control) {
1557
- if (isEnabled(this.fsFormPhone)) {
1558
- return FsValidators.phone(this._control);
1559
- }
1560
- else {
1561
- return null;
1562
- }
1563
- }
1564
- }
1565
- FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1566
- FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
1567
- VALIDATE_MESSAGE_PROVIDER
1568
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1569
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPhoneDirective, decorators: [{
1570
- type: Directive,
1571
- args: [{
1572
- selector: '[fsFormPhone]',
1573
- providers: [
1574
- VALIDATE_MESSAGE_PROVIDER
1575
- ],
1576
- }]
1577
- }], propDecorators: { fsFormPhone: [{
1578
- type: Input
1579
- }], validationMessage: [{
1580
- type: Input,
1581
- args: ['fsFormPhoneMessage']
1546
+ class FsFormPhoneDirective extends FsControlDirective {
1547
+ set validationMessage(value) {
1548
+ this._validateMessages.phone = value;
1549
+ }
1550
+ ngOnChanges() {
1551
+ this._control.updateValueAndValidity();
1552
+ }
1553
+ validate(control) {
1554
+ if (isEnabled(this.fsFormPhone)) {
1555
+ return FsValidators.phone(this._control);
1556
+ }
1557
+ else {
1558
+ return null;
1559
+ }
1560
+ }
1561
+ }
1562
+ FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1563
+ FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
1564
+ VALIDATE_MESSAGE_PROVIDER
1565
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPhoneDirective, decorators: [{
1567
+ type: Directive,
1568
+ args: [{
1569
+ selector: '[fsFormPhone]',
1570
+ providers: [
1571
+ VALIDATE_MESSAGE_PROVIDER
1572
+ ],
1573
+ }]
1574
+ }], propDecorators: { fsFormPhone: [{
1575
+ type: Input
1576
+ }], validationMessage: [{
1577
+ type: Input,
1578
+ args: ['fsFormPhoneMessage']
1582
1579
  }] } });
1583
1580
 
1584
- class FsFormCompareDirective extends FsControlDirective {
1585
- set validationMessage(value) {
1586
- this._validateMessages.compare = value;
1587
- }
1588
- ngOnChanges() {
1589
- this._control.updateValueAndValidity();
1590
- }
1591
- validate(control) {
1592
- if (this.fsFormCompare.value === this.elementRef.nativeElement.value) {
1593
- return null;
1594
- }
1595
- else {
1596
- return { compare: true };
1597
- }
1598
- }
1599
- ngAfterViewInit() {
1600
- this.fsFormCompare.addEventListener('keyup', () => {
1601
- this._control.updateValueAndValidity();
1602
- }, false);
1603
- }
1604
- ngOnDestroy() {
1605
- this.fsFormCompare.removeEventListener('keyup', () => {
1606
- this._control.updateValueAndValidity();
1607
- }, false);
1608
- }
1609
- }
1610
- FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1611
- FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
1612
- VALIDATE_MESSAGE_PROVIDER,
1613
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormCompareDirective, decorators: [{
1615
- type: Directive,
1616
- args: [{
1617
- selector: '[fsFormCompare]',
1618
- providers: [
1619
- VALIDATE_MESSAGE_PROVIDER,
1620
- ],
1621
- }]
1622
- }], propDecorators: { fsFormCompare: [{
1623
- type: Input
1624
- }], validationMessage: [{
1625
- type: Input,
1626
- args: ['fsFormCompareMessage']
1581
+ class FsFormCompareDirective extends FsControlDirective {
1582
+ set validationMessage(value) {
1583
+ this._validateMessages.compare = value;
1584
+ }
1585
+ ngOnChanges() {
1586
+ this._control.updateValueAndValidity();
1587
+ }
1588
+ validate(control) {
1589
+ if (this.fsFormCompare.value === this.elementRef.nativeElement.value) {
1590
+ return null;
1591
+ }
1592
+ else {
1593
+ return { compare: true };
1594
+ }
1595
+ }
1596
+ ngAfterViewInit() {
1597
+ this.fsFormCompare.addEventListener('keyup', () => {
1598
+ this._control.updateValueAndValidity();
1599
+ }, false);
1600
+ }
1601
+ ngOnDestroy() {
1602
+ this.fsFormCompare.removeEventListener('keyup', () => {
1603
+ this._control.updateValueAndValidity();
1604
+ }, false);
1605
+ }
1606
+ }
1607
+ FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1608
+ FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
1609
+ VALIDATE_MESSAGE_PROVIDER,
1610
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormCompareDirective, decorators: [{
1612
+ type: Directive,
1613
+ args: [{
1614
+ selector: '[fsFormCompare]',
1615
+ providers: [
1616
+ VALIDATE_MESSAGE_PROVIDER,
1617
+ ],
1618
+ }]
1619
+ }], propDecorators: { fsFormCompare: [{
1620
+ type: Input
1621
+ }], validationMessage: [{
1622
+ type: Input,
1623
+ args: ['fsFormCompareMessage']
1627
1624
  }] } });
1628
1625
 
1629
- class FsFormIntegerDirective extends FsControlDirective {
1630
- set validationMessage(value) {
1631
- this._validateMessages.integer = value;
1632
- }
1633
- ngOnChanges() {
1634
- this._control.updateValueAndValidity();
1635
- }
1636
- validate(control) {
1637
- if (isEnabled(this.fsFormInteger)) {
1638
- return FsValidators.integer(this._control);
1639
- }
1640
- else {
1641
- return null;
1642
- }
1643
- }
1644
- }
1645
- FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1646
- FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
1647
- VALIDATE_MESSAGE_PROVIDER
1648
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1649
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormIntegerDirective, decorators: [{
1650
- type: Directive,
1651
- args: [{
1652
- selector: '[fsFormInteger]',
1653
- providers: [
1654
- VALIDATE_MESSAGE_PROVIDER
1655
- ],
1656
- }]
1657
- }], propDecorators: { fsFormInteger: [{
1658
- type: Input
1659
- }], validationMessage: [{
1660
- type: Input,
1661
- args: ['fsFormIntegerMessage']
1626
+ class FsFormIntegerDirective extends FsControlDirective {
1627
+ set validationMessage(value) {
1628
+ this._validateMessages.integer = value;
1629
+ }
1630
+ ngOnChanges() {
1631
+ this._control.updateValueAndValidity();
1632
+ }
1633
+ validate(control) {
1634
+ if (isEnabled(this.fsFormInteger)) {
1635
+ return FsValidators.integer(this._control);
1636
+ }
1637
+ else {
1638
+ return null;
1639
+ }
1640
+ }
1641
+ }
1642
+ FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1643
+ FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
1644
+ VALIDATE_MESSAGE_PROVIDER
1645
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1646
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormIntegerDirective, decorators: [{
1647
+ type: Directive,
1648
+ args: [{
1649
+ selector: '[fsFormInteger]',
1650
+ providers: [
1651
+ VALIDATE_MESSAGE_PROVIDER
1652
+ ],
1653
+ }]
1654
+ }], propDecorators: { fsFormInteger: [{
1655
+ type: Input
1656
+ }], validationMessage: [{
1657
+ type: Input,
1658
+ args: ['fsFormIntegerMessage']
1662
1659
  }] } });
1663
1660
 
1664
- class FsFormNumericDirective extends FsControlDirective {
1665
- set validationMessage(value) {
1666
- this._validateMessages.numeric = value;
1667
- }
1668
- ngOnChanges() {
1669
- this._control.updateValueAndValidity();
1670
- }
1671
- validate(control) {
1672
- if (isEnabled(this.fsFormNumeric)) {
1673
- return FsValidators.numeric(this._control);
1674
- }
1675
- else {
1676
- return null;
1677
- }
1678
- }
1679
- }
1680
- FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1681
- FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
1682
- VALIDATE_MESSAGE_PROVIDER
1683
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1684
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNumericDirective, decorators: [{
1685
- type: Directive,
1686
- args: [{
1687
- selector: '[fsFormNumeric]',
1688
- providers: [
1689
- VALIDATE_MESSAGE_PROVIDER
1690
- ],
1691
- }]
1692
- }], propDecorators: { fsFormNumeric: [{
1693
- type: Input
1694
- }], validationMessage: [{
1695
- type: Input,
1696
- args: ['fsFormNumericMessage']
1661
+ class FsFormNumericDirective extends FsControlDirective {
1662
+ set validationMessage(value) {
1663
+ this._validateMessages.numeric = value;
1664
+ }
1665
+ ngOnChanges() {
1666
+ this._control.updateValueAndValidity();
1667
+ }
1668
+ validate(control) {
1669
+ if (isEnabled(this.fsFormNumeric)) {
1670
+ return FsValidators.numeric(this._control);
1671
+ }
1672
+ else {
1673
+ return null;
1674
+ }
1675
+ }
1676
+ }
1677
+ FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1678
+ FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
1679
+ VALIDATE_MESSAGE_PROVIDER
1680
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1681
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNumericDirective, decorators: [{
1682
+ type: Directive,
1683
+ args: [{
1684
+ selector: '[fsFormNumeric]',
1685
+ providers: [
1686
+ VALIDATE_MESSAGE_PROVIDER
1687
+ ],
1688
+ }]
1689
+ }], propDecorators: { fsFormNumeric: [{
1690
+ type: Input
1691
+ }], validationMessage: [{
1692
+ type: Input,
1693
+ args: ['fsFormNumericMessage']
1697
1694
  }] } });
1698
1695
 
1699
- class FsFormPatternDirective extends FsControlDirective {
1700
- set validationMessage(value) {
1701
- this._validateMessages.pattern = value;
1702
- }
1703
- ngOnChanges() {
1704
- this._control.updateValueAndValidity();
1705
- }
1706
- validate(control) {
1707
- return Validators.pattern(this.fsFormPattern)(this._control);
1708
- }
1709
- }
1710
- FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1711
- FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
1712
- VALIDATE_MESSAGE_PROVIDER
1713
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1714
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPatternDirective, decorators: [{
1715
- type: Directive,
1716
- args: [{
1717
- selector: '[fsFormPattern]',
1718
- providers: [
1719
- VALIDATE_MESSAGE_PROVIDER
1720
- ],
1721
- }]
1722
- }], propDecorators: { fsFormPattern: [{
1723
- type: Input
1724
- }], validationMessage: [{
1725
- type: Input,
1726
- args: ['fsFormPatternMessage']
1696
+ class FsFormPatternDirective extends FsControlDirective {
1697
+ set validationMessage(value) {
1698
+ this._validateMessages.pattern = value;
1699
+ }
1700
+ ngOnChanges() {
1701
+ this._control.updateValueAndValidity();
1702
+ }
1703
+ validate(control) {
1704
+ return Validators.pattern(this.fsFormPattern)(this._control);
1705
+ }
1706
+ }
1707
+ FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1708
+ FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
1709
+ VALIDATE_MESSAGE_PROVIDER
1710
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPatternDirective, decorators: [{
1712
+ type: Directive,
1713
+ args: [{
1714
+ selector: '[fsFormPattern]',
1715
+ providers: [
1716
+ VALIDATE_MESSAGE_PROVIDER
1717
+ ],
1718
+ }]
1719
+ }], propDecorators: { fsFormPattern: [{
1720
+ type: Input
1721
+ }], validationMessage: [{
1722
+ type: Input,
1723
+ args: ['fsFormPatternMessage']
1727
1724
  }] } });
1728
1725
 
1729
- class FsFormFunctionDirective extends FsControlDirective {
1730
- constructor() {
1731
- super(...arguments);
1732
- this.validateOnSubmit = false;
1733
- }
1734
- ngOnChanges() {
1735
- this._control.updateValueAndValidity();
1736
- }
1737
- validateAsync(control) {
1738
- if (this.validateOnSubmit && !this.formDirective.validating) {
1739
- return of(null);
1740
- }
1741
- return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
1742
- }
1743
- }
1744
- FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1745
- FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
1746
- VALIDATE_MESSAGE_PROVIDER
1747
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1748
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormFunctionDirective, decorators: [{
1749
- type: Directive,
1750
- args: [{
1751
- selector: '[fsFormFunction]',
1752
- providers: [
1753
- VALIDATE_MESSAGE_PROVIDER
1754
- ],
1755
- }]
1756
- }], propDecorators: { fsFormFunction: [{
1757
- type: Input
1758
- }], fsFormFunctionData: [{
1759
- type: Input
1760
- }], validateOnSubmit: [{
1761
- type: Input
1726
+ class FsFormFunctionDirective extends FsControlDirective {
1727
+ constructor() {
1728
+ super(...arguments);
1729
+ this.validateOnSubmit = false;
1730
+ }
1731
+ ngOnChanges() {
1732
+ this._control.updateValueAndValidity();
1733
+ }
1734
+ validateAsync(control) {
1735
+ if (this.validateOnSubmit && !this.formDirective.validating) {
1736
+ return of(null);
1737
+ }
1738
+ return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
1739
+ }
1740
+ }
1741
+ FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1742
+ FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
1743
+ VALIDATE_MESSAGE_PROVIDER
1744
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1745
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormFunctionDirective, decorators: [{
1746
+ type: Directive,
1747
+ args: [{
1748
+ selector: '[fsFormFunction]',
1749
+ providers: [
1750
+ VALIDATE_MESSAGE_PROVIDER
1751
+ ],
1752
+ }]
1753
+ }], propDecorators: { fsFormFunction: [{
1754
+ type: Input
1755
+ }], fsFormFunctionData: [{
1756
+ type: Input
1757
+ }], validateOnSubmit: [{
1758
+ type: Input
1762
1759
  }] } });
1763
1760
 
1764
- class FsFormGreaterDirective extends FsControlDirective {
1765
- set validationMessage(value) {
1766
- this._validateMessages.greater = value;
1767
- }
1768
- ngOnChanges() {
1769
- this._control.updateValueAndValidity();
1770
- }
1771
- validate(control) {
1772
- const greater = parseFloat(this.fsFormGreater);
1773
- const value = parseFloat(this._control.value);
1774
- if (!isNaN(greater) && !isNaN(value) && value <= greater) {
1775
- return { greater: { greater, actual: value } };
1776
- }
1777
- return FsValidators.numeric(this._control);
1778
- }
1779
- }
1780
- FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1781
- FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
1782
- VALIDATE_MESSAGE_PROVIDER
1783
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1784
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormGreaterDirective, decorators: [{
1785
- type: Directive,
1786
- args: [{
1787
- selector: '[fsFormGreater]',
1788
- providers: [
1789
- VALIDATE_MESSAGE_PROVIDER
1790
- ],
1791
- }]
1792
- }], propDecorators: { fsFormGreater: [{
1793
- type: Input
1794
- }], validationMessage: [{
1795
- type: Input,
1796
- args: ['fsFormGreaterMessage']
1761
+ class FsFormGreaterDirective extends FsControlDirective {
1762
+ set validationMessage(value) {
1763
+ this._validateMessages.greater = value;
1764
+ }
1765
+ ngOnChanges() {
1766
+ this._control.updateValueAndValidity();
1767
+ }
1768
+ validate(control) {
1769
+ const greater = parseFloat(this.fsFormGreater);
1770
+ const value = parseFloat(this._control.value);
1771
+ if (!isNaN(greater) && !isNaN(value) && value <= greater) {
1772
+ return { greater: { greater, actual: value } };
1773
+ }
1774
+ return FsValidators.numeric(this._control);
1775
+ }
1776
+ }
1777
+ FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1778
+ FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
1779
+ VALIDATE_MESSAGE_PROVIDER
1780
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1781
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormGreaterDirective, decorators: [{
1782
+ type: Directive,
1783
+ args: [{
1784
+ selector: '[fsFormGreater]',
1785
+ providers: [
1786
+ VALIDATE_MESSAGE_PROVIDER
1787
+ ],
1788
+ }]
1789
+ }], propDecorators: { fsFormGreater: [{
1790
+ type: Input
1791
+ }], validationMessage: [{
1792
+ type: Input,
1793
+ args: ['fsFormGreaterMessage']
1797
1794
  }] } });
1798
1795
 
1799
- class FsFormDateRangeDirective extends FsControlDirective {
1800
- set validationMessage(value) {
1801
- this._validateMessages.dateRange = value;
1802
- }
1803
- ngOnChanges() {
1804
- this._control.updateValueAndValidity();
1805
- }
1806
- validate(control) {
1807
- if (isEnabled(this.fsFormDateRange)) {
1808
- return FsValidators.dateRange(this._control);
1809
- }
1810
- else {
1811
- return null;
1812
- }
1813
- }
1814
- }
1815
- FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1816
- FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
1817
- VALIDATE_MESSAGE_PROVIDER
1818
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1819
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDateRangeDirective, decorators: [{
1820
- type: Directive,
1821
- args: [{
1822
- selector: '[fsFormDateRange]',
1823
- providers: [
1824
- VALIDATE_MESSAGE_PROVIDER
1825
- ],
1826
- }]
1827
- }], propDecorators: { fsFormDateRange: [{
1828
- type: Input
1829
- }], validationMessage: [{
1830
- type: Input,
1831
- args: ['fsFormDateRangeMessage']
1796
+ class FsFormDateRangeDirective extends FsControlDirective {
1797
+ set validationMessage(value) {
1798
+ this._validateMessages.dateRange = value;
1799
+ }
1800
+ ngOnChanges() {
1801
+ this._control.updateValueAndValidity();
1802
+ }
1803
+ validate(control) {
1804
+ if (isEnabled(this.fsFormDateRange)) {
1805
+ return FsValidators.dateRange(this._control);
1806
+ }
1807
+ else {
1808
+ return null;
1809
+ }
1810
+ }
1811
+ }
1812
+ FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1813
+ FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
1814
+ VALIDATE_MESSAGE_PROVIDER
1815
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1816
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDateRangeDirective, decorators: [{
1817
+ type: Directive,
1818
+ args: [{
1819
+ selector: '[fsFormDateRange]',
1820
+ providers: [
1821
+ VALIDATE_MESSAGE_PROVIDER
1822
+ ],
1823
+ }]
1824
+ }], propDecorators: { fsFormDateRange: [{
1825
+ type: Input
1826
+ }], validationMessage: [{
1827
+ type: Input,
1828
+ args: ['fsFormDateRangeMessage']
1832
1829
  }] } });
1833
1830
 
1834
- class FsFormLesserDirective extends FsControlDirective {
1835
- set validationMessage(value) {
1836
- this._validateMessages.lesser = value;
1837
- }
1838
- ngOnChanges() {
1839
- this._control.updateValueAndValidity();
1840
- }
1841
- validate(control) {
1842
- const lesser = parseFloat(this.fsFormLesser);
1843
- const value = parseFloat(this._control.value);
1844
- if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
1845
- return { lesser: { lesser, actual: value } };
1846
- }
1847
- return FsValidators.numeric(this._control);
1848
- }
1849
- }
1850
- FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1851
- FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
1852
- VALIDATE_MESSAGE_PROVIDER
1853
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1854
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormLesserDirective, decorators: [{
1855
- type: Directive,
1856
- args: [{
1857
- selector: '[fsFormLesser]',
1858
- providers: [
1859
- VALIDATE_MESSAGE_PROVIDER
1860
- ],
1861
- }]
1862
- }], propDecorators: { fsFormLesser: [{
1863
- type: Input
1864
- }], validationMessage: [{
1865
- type: Input,
1866
- args: ['fsFormLesserMessage']
1831
+ class FsFormLesserDirective extends FsControlDirective {
1832
+ set validationMessage(value) {
1833
+ this._validateMessages.lesser = value;
1834
+ }
1835
+ ngOnChanges() {
1836
+ this._control.updateValueAndValidity();
1837
+ }
1838
+ validate(control) {
1839
+ const lesser = parseFloat(this.fsFormLesser);
1840
+ const value = parseFloat(this._control.value);
1841
+ if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
1842
+ return { lesser: { lesser, actual: value } };
1843
+ }
1844
+ return FsValidators.numeric(this._control);
1845
+ }
1846
+ }
1847
+ FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1848
+ FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
1849
+ VALIDATE_MESSAGE_PROVIDER
1850
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1851
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormLesserDirective, decorators: [{
1852
+ type: Directive,
1853
+ args: [{
1854
+ selector: '[fsFormLesser]',
1855
+ providers: [
1856
+ VALIDATE_MESSAGE_PROVIDER
1857
+ ],
1858
+ }]
1859
+ }], propDecorators: { fsFormLesser: [{
1860
+ type: Input
1861
+ }], validationMessage: [{
1862
+ type: Input,
1863
+ args: ['fsFormLesserMessage']
1867
1864
  }] } });
1868
1865
 
1869
- class FsFormUrlDirective extends FsControlDirective {
1870
- constructor() {
1871
- super(...arguments);
1872
- this.fsFormUrlProtocol = false;
1873
- }
1874
- set validationMessage(value) {
1875
- this._validateMessages.url = value;
1876
- }
1877
- ngOnChanges() {
1878
- this._control.updateValueAndValidity();
1879
- }
1880
- validate(control) {
1881
- if (isEnabled(this.fsFormUrl)) {
1882
- return FsValidators.url(this._control, this.fsFormUrlProtocol);
1883
- }
1884
- else {
1885
- return null;
1886
- }
1887
- }
1888
- }
1889
- FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1890
- 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: [
1891
- VALIDATE_MESSAGE_PROVIDER
1892
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1893
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormUrlDirective, decorators: [{
1894
- type: Directive,
1895
- args: [{
1896
- selector: '[fsFormUrl]',
1897
- providers: [
1898
- VALIDATE_MESSAGE_PROVIDER
1899
- ],
1900
- }]
1901
- }], propDecorators: { fsFormUrl: [{
1902
- type: Input
1903
- }], fsFormUrlProtocol: [{
1904
- type: Input
1905
- }], validationMessage: [{
1906
- type: Input,
1907
- args: ['fsFormUrlMessage']
1866
+ class FsFormUrlDirective extends FsControlDirective {
1867
+ constructor() {
1868
+ super(...arguments);
1869
+ this.fsFormUrlProtocol = false;
1870
+ }
1871
+ set validationMessage(value) {
1872
+ this._validateMessages.url = value;
1873
+ }
1874
+ ngOnChanges() {
1875
+ this._control.updateValueAndValidity();
1876
+ }
1877
+ validate(control) {
1878
+ if (isEnabled(this.fsFormUrl)) {
1879
+ return FsValidators.url(this._control, this.fsFormUrlProtocol);
1880
+ }
1881
+ else {
1882
+ return null;
1883
+ }
1884
+ }
1885
+ }
1886
+ FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1887
+ 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: [
1888
+ VALIDATE_MESSAGE_PROVIDER
1889
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1890
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormUrlDirective, decorators: [{
1891
+ type: Directive,
1892
+ args: [{
1893
+ selector: '[fsFormUrl]',
1894
+ providers: [
1895
+ VALIDATE_MESSAGE_PROVIDER
1896
+ ],
1897
+ }]
1898
+ }], propDecorators: { fsFormUrl: [{
1899
+ type: Input
1900
+ }], fsFormUrlProtocol: [{
1901
+ type: Input
1902
+ }], validationMessage: [{
1903
+ type: Input,
1904
+ args: ['fsFormUrlMessage']
1908
1905
  }] } });
1909
1906
 
1910
- class FsButtonDirective {
1911
- constructor(_matButton, _form, _elementRef, _cdRef) {
1912
- this._matButton = _matButton;
1913
- this._form = _form;
1914
- this._elementRef = _elementRef;
1915
- this._cdRef = _cdRef;
1916
- this.dirtySubmit = true;
1917
- this.transitionStyle = null;
1918
- this.active = false;
1919
- this.submit = false;
1920
- this._previousDisabled = false;
1921
- this._destroy$ = new Subject();
1922
- }
1923
- ngOnInit() {
1924
- this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
1925
- this.form = this.form || this._form;
1926
- if (this.form) {
1927
- this.form.addButton(this);
1928
- if (this.submit) {
1929
- fromEvent(this.element, 'click')
1930
- .pipe(takeUntil(this._destroy$))
1931
- .subscribe(() => {
1932
- this.active = true;
1933
- });
1934
- if (this.dirtySubmit) {
1935
- if (this.form.dirtySubmitButton) {
1936
- if (!this.form.ngForm.dirty) {
1937
- this.disable();
1938
- }
1939
- }
1940
- }
1941
- this.transitionStyle = 'none';
1942
- setTimeout(() => {
1943
- this.transitionStyle = null;
1944
- }, 500);
1945
- }
1946
- }
1947
- }
1948
- disable() {
1949
- if (this._matButton && !this.active) {
1950
- this._previousDisabled = this._matButton.disabled;
1951
- this._matButton.disabled = true;
1952
- this._cdRef.markForCheck();
1953
- }
1954
- }
1955
- enable() {
1956
- if (this._matButton) {
1957
- this._matButton.disabled = false;
1958
- this._matButton.disableRipple = true;
1959
- this._cdRef.markForCheck();
1960
- }
1961
- }
1962
- process() {
1963
- this.setClass('process');
1964
- if (this._matButton) {
1965
- this._matButton.disableRipple = true;
1966
- }
1967
- }
1968
- success() {
1969
- this.setClass('success');
1970
- if (this._matButton) {
1971
- this._matButton.disableRipple = false;
1972
- }
1973
- }
1974
- error() {
1975
- this.setClass('error');
1976
- if (this._matButton) {
1977
- this._matButton.disableRipple = false;
1978
- }
1979
- }
1980
- setClass(cls) {
1981
- const svg = this._getSvg(cls);
1982
- this._resetClass();
1983
- this._disableShadowAnimation();
1984
- this.element.classList.add(`submit-${cls}`);
1985
- this.element.append(svg);
1986
- }
1987
- get element() {
1988
- return this._elementRef.nativeElement;
1989
- }
1990
- resetActive() {
1991
- this.active = false;
1992
- }
1993
- reset() {
1994
- if (!this._previousDisabled) {
1995
- this.enable();
1996
- }
1997
- this.element.querySelectorAll('.svg-icon')
1998
- .forEach((el) => {
1999
- el.remove();
2000
- });
2001
- if (this._matButton) {
2002
- this._matButton.disableRipple = false;
2003
- }
2004
- this._resetClass();
2005
- }
2006
- ngOnDestroy() {
2007
- var _a;
2008
- this._destroy$.next();
2009
- this._destroy$.complete();
2010
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
2011
- }
2012
- _disableShadowAnimation() {
2013
- // .mat-elevation-z2 removes the click shadow animation
2014
- //this.element.classList.add('mat-elevation-z2');
2015
- }
2016
- _resetClass() {
2017
- this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2018
- }
2019
- _getSvg(type) {
2020
- if (type === 'success') {
1907
+ class FsButtonDirective {
1908
+ constructor(_matButton, _form, _elementRef, _cdRef) {
1909
+ this._matButton = _matButton;
1910
+ this._form = _form;
1911
+ this._elementRef = _elementRef;
1912
+ this._cdRef = _cdRef;
1913
+ this.dirtySubmit = true;
1914
+ this.transitionStyle = null;
1915
+ this.active = false;
1916
+ this.submit = false;
1917
+ this._previousDisabled = false;
1918
+ this._destroy$ = new Subject();
1919
+ }
1920
+ ngOnInit() {
1921
+ this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
1922
+ this.form = this.form || this._form;
1923
+ if (this.form) {
1924
+ this.form.addButton(this);
1925
+ if (this.submit) {
1926
+ fromEvent(this.element, 'click')
1927
+ .pipe(takeUntil(this._destroy$))
1928
+ .subscribe(() => {
1929
+ this.active = true;
1930
+ });
1931
+ if (this.dirtySubmit) {
1932
+ if (this.form.dirtySubmitButton) {
1933
+ if (!this.form.ngForm.dirty) {
1934
+ this.disable();
1935
+ }
1936
+ }
1937
+ }
1938
+ this.transitionStyle = 'none';
1939
+ setTimeout(() => {
1940
+ this.transitionStyle = null;
1941
+ }, 500);
1942
+ }
1943
+ }
1944
+ }
1945
+ disable() {
1946
+ if (this._matButton && !this.active) {
1947
+ this._previousDisabled = this._matButton.disabled;
1948
+ this._matButton.disabled = true;
1949
+ this._cdRef.markForCheck();
1950
+ }
1951
+ }
1952
+ enable() {
1953
+ if (this._matButton) {
1954
+ this._matButton.disabled = false;
1955
+ this._matButton.disableRipple = true;
1956
+ this._cdRef.markForCheck();
1957
+ }
1958
+ }
1959
+ process() {
1960
+ this.setClass('process');
1961
+ if (this._matButton) {
1962
+ this._matButton.disableRipple = true;
1963
+ }
1964
+ }
1965
+ success() {
1966
+ this.setClass('success');
1967
+ if (this._matButton) {
1968
+ this._matButton.disableRipple = false;
1969
+ }
1970
+ }
1971
+ error() {
1972
+ this.setClass('error');
1973
+ if (this._matButton) {
1974
+ this._matButton.disableRipple = false;
1975
+ }
1976
+ }
1977
+ setClass(cls) {
1978
+ const svg = this._getSvg(cls);
1979
+ this._resetClass();
1980
+ this._disableShadowAnimation();
1981
+ this.element.classList.add(`submit-${cls}`);
1982
+ this.element.append(svg);
1983
+ }
1984
+ get element() {
1985
+ return this._elementRef.nativeElement;
1986
+ }
1987
+ resetActive() {
1988
+ this.active = false;
1989
+ }
1990
+ reset() {
1991
+ if (!this._previousDisabled) {
1992
+ this.enable();
1993
+ }
1994
+ this.element.querySelectorAll('.svg-icon')
1995
+ .forEach((el) => {
1996
+ el.remove();
1997
+ });
1998
+ if (this._matButton) {
1999
+ this._matButton.disableRipple = false;
2000
+ }
2001
+ this._resetClass();
2002
+ }
2003
+ ngOnDestroy() {
2004
+ var _a;
2005
+ this._destroy$.next();
2006
+ this._destroy$.complete();
2007
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
2008
+ }
2009
+ _disableShadowAnimation() {
2010
+ // .mat-elevation-z2 removes the click shadow animation
2011
+ //this.element.classList.add('mat-elevation-z2');
2012
+ }
2013
+ _resetClass() {
2014
+ this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2015
+ }
2016
+ _getSvg(type) {
2017
+ if (type === 'success') {
2021
2018
  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">
2022
2019
  <g>
2023
2020
  <g class="check">
@@ -2026,370 +2023,370 @@ class FsButtonDirective {
2026
2023
  </g>
2027
2024
  </g>
2028
2025
  </g>
2029
- </svg>`, 'text/xml').firstChild;
2030
- }
2031
- if (type === 'process') {
2026
+ </svg>`, 'text/xml').firstChild;
2027
+ }
2028
+ if (type === 'process') {
2032
2029
  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">
2033
2030
  <g fill="none" fill-rule="evenodd">
2034
2031
  <g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
2035
2032
  <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>
2036
2033
  </g>
2037
2034
  </g>
2038
- </svg>`, 'text/xml').firstChild;
2039
- }
2040
- if (type === 'error') {
2041
- 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;
2042
- }
2043
- }
2044
- }
2045
- 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 });
2046
- 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", form: "form" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0 });
2047
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsButtonDirective, decorators: [{
2048
- type: Directive,
2049
- args: [{
2050
- selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
2051
- }]
2052
- }], ctorParameters: function () { return [{ type: i1$2.MatButton, decorators: [{
2053
- type: Optional
2054
- }, {
2055
- type: Host
2056
- }] }, { type: FsFormDirective, decorators: [{
2057
- type: Optional
2058
- }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { name: [{
2059
- type: Input
2060
- }], dirtySubmit: [{
2061
- type: Input
2062
- }], form: [{
2063
- type: Input
2064
- }], transitionStyle: [{
2065
- type: HostBinding,
2066
- args: ['style.transition']
2035
+ </svg>`, 'text/xml').firstChild;
2036
+ }
2037
+ if (type === 'error') {
2038
+ 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;
2039
+ }
2040
+ }
2041
+ }
2042
+ 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 });
2043
+ 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", form: "form" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0 });
2044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsButtonDirective, decorators: [{
2045
+ type: Directive,
2046
+ args: [{
2047
+ selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
2048
+ }]
2049
+ }], ctorParameters: function () { return [{ type: i1$2.MatButton, decorators: [{
2050
+ type: Optional
2051
+ }, {
2052
+ type: Host
2053
+ }] }, { type: FsFormDirective, decorators: [{
2054
+ type: Optional
2055
+ }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { name: [{
2056
+ type: Input
2057
+ }], dirtySubmit: [{
2058
+ type: Input
2059
+ }], form: [{
2060
+ type: Input
2061
+ }], transitionStyle: [{
2062
+ type: HostBinding,
2063
+ args: ['style.transition']
2067
2064
  }] } });
2068
2065
 
2069
- class FsFormValidateDirective extends FsControlDirective {
2070
- constructor() {
2071
- super(...arguments);
2072
- this.validateOnSubmit = false;
2073
- }
2074
- ngOnChanges() {
2075
- this._control.updateValueAndValidity();
2076
- }
2077
- validateAsync(control) {
2078
- if (this.validateOnSubmit && !this.formDirective.validating) {
2079
- return of(null);
2080
- }
2081
- return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2082
- }
2083
- }
2084
- FsFormValidateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2085
- 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: [
2086
- VALIDATE_MESSAGE_PROVIDER
2087
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2088
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormValidateDirective, decorators: [{
2089
- type: Directive,
2090
- args: [{
2091
- selector: '[validate]',
2092
- providers: [
2093
- VALIDATE_MESSAGE_PROVIDER
2094
- ],
2095
- }]
2096
- }], propDecorators: { validateFn: [{
2097
- type: Input,
2098
- args: ['validate']
2099
- }], validateFnData: [{
2100
- type: Input,
2101
- args: ['validateData']
2102
- }], validateOnSubmit: [{
2103
- type: Input
2066
+ class FsFormValidateDirective extends FsControlDirective {
2067
+ constructor() {
2068
+ super(...arguments);
2069
+ this.validateOnSubmit = false;
2070
+ }
2071
+ ngOnChanges() {
2072
+ this._control.updateValueAndValidity();
2073
+ }
2074
+ validateAsync(control) {
2075
+ if (this.validateOnSubmit && !this.formDirective.validating) {
2076
+ return of(null);
2077
+ }
2078
+ return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2079
+ }
2080
+ }
2081
+ FsFormValidateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2082
+ 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: [
2083
+ VALIDATE_MESSAGE_PROVIDER
2084
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2085
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormValidateDirective, decorators: [{
2086
+ type: Directive,
2087
+ args: [{
2088
+ selector: '[validate]',
2089
+ providers: [
2090
+ VALIDATE_MESSAGE_PROVIDER
2091
+ ],
2092
+ }]
2093
+ }], propDecorators: { validateFn: [{
2094
+ type: Input,
2095
+ args: ['validate']
2096
+ }], validateFnData: [{
2097
+ type: Input,
2098
+ args: ['validateData']
2099
+ }], validateOnSubmit: [{
2100
+ type: Input
2104
2101
  }] } });
2105
2102
 
2106
- class FsFormDialogActionsComponent {
2107
- constructor(_form, _dialogRef, _cdRef) {
2108
- this._form = _form;
2109
- this._dialogRef = _dialogRef;
2110
- this._cdRef = _cdRef;
2111
- this.save = true;
2112
- this.create = false;
2113
- this.close = false;
2114
- this.done = false;
2115
- this.closeData = null;
2116
- this.dirty = false;
2117
- this._destroy$ = new Subject();
2118
- }
2119
- ngOnInit() {
2120
- if (this._form) {
2121
- this._form.ngForm.valueChanges
2122
- .pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
2123
- .subscribe(() => {
2124
- this.dirty = this._form.ngForm.dirty;
2125
- this._cdRef.markForCheck();
2126
- });
2127
- this._form.submitted
2128
- .pipe(delay(50), takeUntil(this._destroy$))
2129
- .subscribe(() => {
2130
- this.dirty = false;
2131
- this._cdRef.markForCheck();
2132
- });
2133
- this._form.reseted
2134
- .pipe(takeUntil(this._destroy$))
2135
- .subscribe(() => {
2136
- this.dirty = false;
2137
- this._cdRef.markForCheck();
2138
- });
2139
- }
2140
- }
2141
- closeClick() {
2142
- if (this._form) {
2143
- this._form.triggerConfirm()
2144
- .pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
2145
- .subscribe(() => {
2146
- this._dialogRef.close(this.closeData);
2147
- });
2148
- }
2149
- else {
2150
- this._dialogRef.close(this.closeData);
2151
- }
2152
- }
2153
- ngOnDestroy() {
2154
- this._destroy$.next();
2155
- this._destroy$.complete();
2156
- }
2157
- }
2158
- 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 });
2159
- 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", done: "done", 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=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [matDialogClose]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <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}@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", "form"] }, { 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 });
2160
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
2161
- type: Component,
2162
- args: [{
2163
- selector: 'fs-form-dialog-actions',
2164
- templateUrl: './form-dialog-actions.component.html',
2165
- styleUrls: ['./form-dialog-actions.component.scss'],
2166
- changeDetection: ChangeDetectionStrategy.OnPush,
2167
- }]
2168
- }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
2169
- type: Optional
2170
- }] }, { type: i2$1.MatDialogRef, decorators: [{
2171
- type: Optional
2172
- }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { save: [{
2173
- type: Input
2174
- }], create: [{
2175
- type: Input
2176
- }], close: [{
2177
- type: Input
2178
- }], done: [{
2179
- type: Input
2180
- }], closeData: [{
2181
- type: Input
2182
- }], name: [{
2183
- type: Input
2103
+ class FsFormDialogActionsComponent {
2104
+ constructor(_form, _dialogRef, _cdRef) {
2105
+ this._form = _form;
2106
+ this._dialogRef = _dialogRef;
2107
+ this._cdRef = _cdRef;
2108
+ this.save = true;
2109
+ this.create = false;
2110
+ this.close = false;
2111
+ this.done = false;
2112
+ this.closeData = null;
2113
+ this.dirty = false;
2114
+ this._destroy$ = new Subject();
2115
+ }
2116
+ ngOnInit() {
2117
+ if (this._form) {
2118
+ this._form.ngForm.valueChanges
2119
+ .pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
2120
+ .subscribe(() => {
2121
+ this.dirty = this._form.ngForm.dirty;
2122
+ this._cdRef.markForCheck();
2123
+ });
2124
+ this._form.submitted
2125
+ .pipe(delay(50), takeUntil(this._destroy$))
2126
+ .subscribe(() => {
2127
+ this.dirty = false;
2128
+ this._cdRef.markForCheck();
2129
+ });
2130
+ this._form.reseted
2131
+ .pipe(takeUntil(this._destroy$))
2132
+ .subscribe(() => {
2133
+ this.dirty = false;
2134
+ this._cdRef.markForCheck();
2135
+ });
2136
+ }
2137
+ }
2138
+ closeClick() {
2139
+ if (this._form) {
2140
+ this._form.triggerConfirm()
2141
+ .pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
2142
+ .subscribe(() => {
2143
+ this._dialogRef.close(this.closeData);
2144
+ });
2145
+ }
2146
+ else {
2147
+ this._dialogRef.close(this.closeData);
2148
+ }
2149
+ }
2150
+ ngOnDestroy() {
2151
+ this._destroy$.next();
2152
+ this._destroy$.complete();
2153
+ }
2154
+ }
2155
+ 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 });
2156
+ 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", done: "done", 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=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [matDialogClose]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <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}@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", "form"] }, { 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 });
2157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
2158
+ type: Component,
2159
+ args: [{
2160
+ selector: 'fs-form-dialog-actions',
2161
+ templateUrl: './form-dialog-actions.component.html',
2162
+ styleUrls: ['./form-dialog-actions.component.scss'],
2163
+ changeDetection: ChangeDetectionStrategy.OnPush,
2164
+ }]
2165
+ }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
2166
+ type: Optional
2167
+ }] }, { type: i2$1.MatDialogRef, decorators: [{
2168
+ type: Optional
2169
+ }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { save: [{
2170
+ type: Input
2171
+ }], create: [{
2172
+ type: Input
2173
+ }], close: [{
2174
+ type: Input
2175
+ }], done: [{
2176
+ type: Input
2177
+ }], closeData: [{
2178
+ type: Input
2179
+ }], name: [{
2180
+ type: Input
2184
2181
  }] } });
2185
2182
 
2186
- /**
2187
- * This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
2188
- *
2189
- * This directive required for automatic validation messages
2190
- */
2191
- class FsFormNoFsValidatorsDirective extends FsControlDirective {
2192
- ngOnChanges() {
2193
- this._control.updateValueAndValidity();
2194
- }
2195
- }
2196
- FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2197
- 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: [
2198
- VALIDATE_MESSAGE_PROVIDER
2199
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
2201
- type: Directive,
2202
- args: [{
2203
- selector: '[ngModel]' +
2204
- ':not([required])' +
2205
- ':not([fsFormRequired])' +
2206
- ':not([fsFormCompare])' +
2207
- ':not([fsFormDateRange])' +
2208
- ':not([fsFormEmail])' +
2209
- ':not([fsFormEmails])' +
2210
- ':not([fsFormFunction])' +
2211
- ':not([fsFormGreater])' +
2212
- ':not([fsFormInteger])' +
2213
- ':not([fsFormLesser])' +
2214
- ':not([fsFormMax])' +
2215
- ':not([fsFormMaxLength])' +
2216
- ':not([fsFormMin])' +
2217
- ':not([fsFormMinLength])' +
2218
- ':not([fsFormNumeric])' +
2219
- ':not([fsFormPattern])' +
2220
- ':not([fsFormPhone])' +
2221
- ':not([fsFormUrl])' +
2222
- ':not([validate])',
2223
- providers: [
2224
- VALIDATE_MESSAGE_PROVIDER
2225
- ],
2226
- }]
2183
+ /**
2184
+ * This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
2185
+ *
2186
+ * This directive required for automatic validation messages
2187
+ */
2188
+ class FsFormNoFsValidatorsDirective extends FsControlDirective {
2189
+ ngOnChanges() {
2190
+ this._control.updateValueAndValidity();
2191
+ }
2192
+ }
2193
+ FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2194
+ 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: [
2195
+ VALIDATE_MESSAGE_PROVIDER
2196
+ ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2197
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
2198
+ type: Directive,
2199
+ args: [{
2200
+ selector: '[ngModel]' +
2201
+ ':not([required])' +
2202
+ ':not([fsFormRequired])' +
2203
+ ':not([fsFormCompare])' +
2204
+ ':not([fsFormDateRange])' +
2205
+ ':not([fsFormEmail])' +
2206
+ ':not([fsFormEmails])' +
2207
+ ':not([fsFormFunction])' +
2208
+ ':not([fsFormGreater])' +
2209
+ ':not([fsFormInteger])' +
2210
+ ':not([fsFormLesser])' +
2211
+ ':not([fsFormMax])' +
2212
+ ':not([fsFormMaxLength])' +
2213
+ ':not([fsFormMin])' +
2214
+ ':not([fsFormMinLength])' +
2215
+ ':not([fsFormNumeric])' +
2216
+ ':not([fsFormPattern])' +
2217
+ ':not([fsFormPhone])' +
2218
+ ':not([fsFormUrl])' +
2219
+ ':not([validate])',
2220
+ providers: [
2221
+ VALIDATE_MESSAGE_PROVIDER
2222
+ ],
2223
+ }]
2227
2224
  }] });
2228
2225
 
2229
- class FsSubmitButtonDirective extends FsButtonDirective {
2230
- }
2231
- FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2232
- FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
2233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
2234
- type: Directive,
2235
- args: [{
2236
- selector: 'dummy-selector',
2237
- }]
2226
+ class FsSubmitButtonDirective extends FsButtonDirective {
2227
+ }
2228
+ FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2229
+ FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
2230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
2231
+ type: Directive,
2232
+ args: [{
2233
+ selector: 'dummy-selector',
2234
+ }]
2238
2235
  }] });
2239
2236
 
2240
- class FsFormModule {
2241
- static forRoot() {
2242
- /**
2243
- * Hack: https://github.com/angular/components/issues/20097
2244
- */
2245
- ErrorStateMatcher.prototype.isErrorState = (control, form) => {
2246
- 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);
2247
- };
2248
- return {
2249
- ngModule: FsFormModule,
2250
- };
2251
- }
2252
- }
2253
- FsFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2254
- FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, declarations: [FsFormDirective,
2255
- FsControlDirective,
2256
- FsFormRequiredDirective,
2257
- FsFormMinDirective,
2258
- FsFormMaxDirective,
2259
- FsFormMinLengthDirective,
2260
- FsFormMaxLengthDirective,
2261
- FsFormEmailDirective,
2262
- FsFormEmailsDirective,
2263
- FsFormPhoneDirective,
2264
- FsFormCompareDirective,
2265
- FsFormIntegerDirective,
2266
- FsFormNumericDirective,
2267
- FsFormPatternDirective,
2268
- FsFormFunctionDirective,
2269
- FsFormDateRangeDirective,
2270
- FsFormGreaterDirective,
2271
- FsFormLesserDirective,
2272
- FsFormUrlDirective,
2273
- FsFormDialogCloseDirective,
2274
- FsFormValidateDirective,
2275
- FsFormDialogActionsComponent,
2276
- FsFormNoFsValidatorsDirective,
2277
- FsButtonDirective,
2278
- FsSubmitButtonDirective], imports: [CommonModule,
2279
- FormsModule,
2280
- MatButtonModule,
2281
- MatDialogModule], exports: [FsFormDirective,
2282
- FsControlDirective,
2283
- FsFormRequiredDirective,
2284
- FsFormMinDirective,
2285
- FsFormMaxDirective,
2286
- FsFormMinLengthDirective,
2287
- FsFormMaxLengthDirective,
2288
- FsFormEmailDirective,
2289
- FsFormEmailsDirective,
2290
- FsFormPhoneDirective,
2291
- FsFormCompareDirective,
2292
- FsFormIntegerDirective,
2293
- FsFormNumericDirective,
2294
- FsFormPatternDirective,
2295
- FsFormFunctionDirective,
2296
- FsFormDateRangeDirective,
2297
- FsFormGreaterDirective,
2298
- FsFormLesserDirective,
2299
- FsFormUrlDirective,
2300
- FsFormDialogCloseDirective,
2301
- FsFormValidateDirective,
2302
- FsFormDialogActionsComponent,
2303
- FsFormNoFsValidatorsDirective,
2304
- FsButtonDirective,
2305
- FsSubmitButtonDirective] });
2306
- FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, providers: [
2307
- {
2308
- provide: ErrorStateMatcher,
2309
- useClass: ShowOnDirtyErrorStateMatcher,
2310
- },
2311
- ], imports: [[
2312
- CommonModule,
2313
- FormsModule,
2314
- MatButtonModule,
2315
- MatDialogModule,
2316
- ]] });
2317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, decorators: [{
2318
- type: NgModule,
2319
- args: [{
2320
- imports: [
2321
- CommonModule,
2322
- FormsModule,
2323
- MatButtonModule,
2324
- MatDialogModule,
2325
- ],
2326
- declarations: [
2327
- FsFormDirective,
2328
- FsControlDirective,
2329
- FsFormRequiredDirective,
2330
- FsFormMinDirective,
2331
- FsFormMaxDirective,
2332
- FsFormMinLengthDirective,
2333
- FsFormMaxLengthDirective,
2334
- FsFormEmailDirective,
2335
- FsFormEmailsDirective,
2336
- FsFormPhoneDirective,
2337
- FsFormCompareDirective,
2338
- FsFormIntegerDirective,
2339
- FsFormNumericDirective,
2340
- FsFormPatternDirective,
2341
- FsFormFunctionDirective,
2342
- FsFormDateRangeDirective,
2343
- FsFormGreaterDirective,
2344
- FsFormLesserDirective,
2345
- FsFormUrlDirective,
2346
- FsFormDialogCloseDirective,
2347
- FsFormValidateDirective,
2348
- FsFormDialogActionsComponent,
2349
- FsFormNoFsValidatorsDirective,
2350
- FsButtonDirective,
2351
- FsSubmitButtonDirective,
2352
- ],
2353
- exports: [
2354
- FsFormDirective,
2355
- FsControlDirective,
2356
- FsFormRequiredDirective,
2357
- FsFormMinDirective,
2358
- FsFormMaxDirective,
2359
- FsFormMinLengthDirective,
2360
- FsFormMaxLengthDirective,
2361
- FsFormEmailDirective,
2362
- FsFormEmailsDirective,
2363
- FsFormPhoneDirective,
2364
- FsFormCompareDirective,
2365
- FsFormIntegerDirective,
2366
- FsFormNumericDirective,
2367
- FsFormPatternDirective,
2368
- FsFormFunctionDirective,
2369
- FsFormDateRangeDirective,
2370
- FsFormGreaterDirective,
2371
- FsFormLesserDirective,
2372
- FsFormUrlDirective,
2373
- FsFormDialogCloseDirective,
2374
- FsFormValidateDirective,
2375
- FsFormDialogActionsComponent,
2376
- FsFormNoFsValidatorsDirective,
2377
- FsButtonDirective,
2378
- FsSubmitButtonDirective,
2379
- ],
2380
- providers: [
2381
- {
2382
- provide: ErrorStateMatcher,
2383
- useClass: ShowOnDirtyErrorStateMatcher,
2384
- },
2385
- ],
2386
- }]
2237
+ class FsFormModule {
2238
+ static forRoot() {
2239
+ /**
2240
+ * Hack: https://github.com/angular/components/issues/20097
2241
+ */
2242
+ ErrorStateMatcher.prototype.isErrorState = (control, form) => {
2243
+ 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);
2244
+ };
2245
+ return {
2246
+ ngModule: FsFormModule,
2247
+ };
2248
+ }
2249
+ }
2250
+ FsFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2251
+ FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, declarations: [FsFormDirective,
2252
+ FsControlDirective,
2253
+ FsFormRequiredDirective,
2254
+ FsFormMinDirective,
2255
+ FsFormMaxDirective,
2256
+ FsFormMinLengthDirective,
2257
+ FsFormMaxLengthDirective,
2258
+ FsFormEmailDirective,
2259
+ FsFormEmailsDirective,
2260
+ FsFormPhoneDirective,
2261
+ FsFormCompareDirective,
2262
+ FsFormIntegerDirective,
2263
+ FsFormNumericDirective,
2264
+ FsFormPatternDirective,
2265
+ FsFormFunctionDirective,
2266
+ FsFormDateRangeDirective,
2267
+ FsFormGreaterDirective,
2268
+ FsFormLesserDirective,
2269
+ FsFormUrlDirective,
2270
+ FsFormDialogCloseDirective,
2271
+ FsFormValidateDirective,
2272
+ FsFormDialogActionsComponent,
2273
+ FsFormNoFsValidatorsDirective,
2274
+ FsButtonDirective,
2275
+ FsSubmitButtonDirective], imports: [CommonModule,
2276
+ FormsModule,
2277
+ MatButtonModule,
2278
+ MatDialogModule], exports: [FsFormDirective,
2279
+ FsControlDirective,
2280
+ FsFormRequiredDirective,
2281
+ FsFormMinDirective,
2282
+ FsFormMaxDirective,
2283
+ FsFormMinLengthDirective,
2284
+ FsFormMaxLengthDirective,
2285
+ FsFormEmailDirective,
2286
+ FsFormEmailsDirective,
2287
+ FsFormPhoneDirective,
2288
+ FsFormCompareDirective,
2289
+ FsFormIntegerDirective,
2290
+ FsFormNumericDirective,
2291
+ FsFormPatternDirective,
2292
+ FsFormFunctionDirective,
2293
+ FsFormDateRangeDirective,
2294
+ FsFormGreaterDirective,
2295
+ FsFormLesserDirective,
2296
+ FsFormUrlDirective,
2297
+ FsFormDialogCloseDirective,
2298
+ FsFormValidateDirective,
2299
+ FsFormDialogActionsComponent,
2300
+ FsFormNoFsValidatorsDirective,
2301
+ FsButtonDirective,
2302
+ FsSubmitButtonDirective] });
2303
+ FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, providers: [
2304
+ {
2305
+ provide: ErrorStateMatcher,
2306
+ useClass: ShowOnDirtyErrorStateMatcher,
2307
+ },
2308
+ ], imports: [[
2309
+ CommonModule,
2310
+ FormsModule,
2311
+ MatButtonModule,
2312
+ MatDialogModule,
2313
+ ]] });
2314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, decorators: [{
2315
+ type: NgModule,
2316
+ args: [{
2317
+ imports: [
2318
+ CommonModule,
2319
+ FormsModule,
2320
+ MatButtonModule,
2321
+ MatDialogModule,
2322
+ ],
2323
+ declarations: [
2324
+ FsFormDirective,
2325
+ FsControlDirective,
2326
+ FsFormRequiredDirective,
2327
+ FsFormMinDirective,
2328
+ FsFormMaxDirective,
2329
+ FsFormMinLengthDirective,
2330
+ FsFormMaxLengthDirective,
2331
+ FsFormEmailDirective,
2332
+ FsFormEmailsDirective,
2333
+ FsFormPhoneDirective,
2334
+ FsFormCompareDirective,
2335
+ FsFormIntegerDirective,
2336
+ FsFormNumericDirective,
2337
+ FsFormPatternDirective,
2338
+ FsFormFunctionDirective,
2339
+ FsFormDateRangeDirective,
2340
+ FsFormGreaterDirective,
2341
+ FsFormLesserDirective,
2342
+ FsFormUrlDirective,
2343
+ FsFormDialogCloseDirective,
2344
+ FsFormValidateDirective,
2345
+ FsFormDialogActionsComponent,
2346
+ FsFormNoFsValidatorsDirective,
2347
+ FsButtonDirective,
2348
+ FsSubmitButtonDirective,
2349
+ ],
2350
+ exports: [
2351
+ FsFormDirective,
2352
+ FsControlDirective,
2353
+ FsFormRequiredDirective,
2354
+ FsFormMinDirective,
2355
+ FsFormMaxDirective,
2356
+ FsFormMinLengthDirective,
2357
+ FsFormMaxLengthDirective,
2358
+ FsFormEmailDirective,
2359
+ FsFormEmailsDirective,
2360
+ FsFormPhoneDirective,
2361
+ FsFormCompareDirective,
2362
+ FsFormIntegerDirective,
2363
+ FsFormNumericDirective,
2364
+ FsFormPatternDirective,
2365
+ FsFormFunctionDirective,
2366
+ FsFormDateRangeDirective,
2367
+ FsFormGreaterDirective,
2368
+ FsFormLesserDirective,
2369
+ FsFormUrlDirective,
2370
+ FsFormDialogCloseDirective,
2371
+ FsFormValidateDirective,
2372
+ FsFormDialogActionsComponent,
2373
+ FsFormNoFsValidatorsDirective,
2374
+ FsButtonDirective,
2375
+ FsSubmitButtonDirective,
2376
+ ],
2377
+ providers: [
2378
+ {
2379
+ provide: ErrorStateMatcher,
2380
+ useClass: ShowOnDirtyErrorStateMatcher,
2381
+ },
2382
+ ],
2383
+ }]
2387
2384
  }] });
2388
2385
 
2389
2386
  // Modules
2390
2387
 
2391
- /**
2392
- * Generated bundle index. Do not edit.
2388
+ /**
2389
+ * Generated bundle index. Do not edit.
2393
2390
  */
2394
2391
 
2395
2392
  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 };