@firestitch/form 12.4.7 → 12.4.9

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 +34 -34
  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 -2834
  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 +149 -149
  53. package/esm2015/app/directives/form/form.directive.js +696 -694
  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 +264 -264
  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 -2271
  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,1999 +22,2001 @@ 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: 'center' });
334
- }
335
- return throwError('Form validation error');
336
- }
337
- get _submitter() {
338
- return this._activeSubmitButton
339
- ? this._activeSubmitButton.name
340
- : null;
341
- }
342
- ngOnInit() {
343
- if (this.deactivationGuard) {
344
- this._registerCanDeactivateGuard();
345
- }
346
- this._registerConfirmDialogBackdropEscape();
347
- this._listenHotKeys();
348
- this._listenWindowClose();
349
- this._listenSubmit();
350
- this._listenFormStatus();
351
- if (!this.autocomplete) {
352
- this._registerAutocomplete();
353
- }
354
- }
355
- ngOnChanges(changes) {
356
- if (changes.confirm) {
357
- this._updateDirtySubmitButtons();
358
- }
359
- }
360
- ngAfterContentInit() {
361
- this._registerConfirm();
362
- this._registerConfirmDialogClose();
363
- this._registerConfirmDrawerClose();
364
- this._registerConfirmTabs();
365
- this._registerDrawerClose();
366
- this._registerDirtySubmitButton();
367
- }
368
- ngOnDestroy() {
369
- this._cleanupCanDeactivate();
370
- this._destroy$.next();
371
- this._destroy$.complete();
372
- }
373
- createSnapshot() {
374
- this._snapshot = this.ngForm.value;
375
- }
376
- getSnapshot() {
377
- return this._snapshot || {};
378
- }
379
- reset() {
380
- this.ngForm.resetForm();
381
- Object.keys(this.ngForm.controls)
382
- .forEach((name) => {
383
- const control = this.ngForm.controls[name];
384
- control.reset(this._snapshot[name]);
385
- });
386
- this.reseted.emit();
387
- }
388
- clear() {
389
- this.ngForm.resetForm();
390
- this.cleared.emit();
391
- }
392
- dirty() {
393
- this.ngForm.form.markAsDirty();
394
- this._updateDirtySubmitButtons();
395
- }
396
- triggerSubmit(options) {
397
- this._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
- this._form.removeFormDirective(this._activatedRouteConfig.component);
832
- }
833
- }
834
- FsFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2.FsMessage }, { token: i1.FsPrompt }, { token: i0.NgZone }, { token: MatDialogRef, optional: true }, { token: DrawerRef, optional: true }, { token: i3.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
835
- FsFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, queries: [{ propertyName: "formDialogClose", predicate: FsFormDialogCloseDirective, descendants: true }, { propertyName: "_tabGroups", predicate: MatTabGroup, descendants: true }], usesOnChanges: true, ngImport: i0 });
836
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDirective, decorators: [{
837
- type: Directive,
838
- args: [{
839
- selector: '[fsForm]',
840
- }]
841
- }], ctorParameters: function () { return [{ type: i1$1.NgForm, decorators: [{
842
- type: Inject,
843
- args: [NgForm]
844
- }] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2.FsMessage }, { type: i1.FsPrompt }, { type: i0.NgZone }, { type: i2$1.MatDialogRef, decorators: [{
845
- type: Optional
846
- }, {
847
- type: Inject,
848
- args: [MatDialogRef]
849
- }] }, { type: i7.DrawerRef, decorators: [{
850
- type: Optional
851
- }, {
852
- type: Inject,
853
- args: [DrawerRef]
854
- }] }, { type: i3.ActivatedRoute }]; }, propDecorators: { wrapperSelector: [{
855
- type: Input
856
- }], messageSelector: [{
857
- type: Input
858
- }], hintSelector: [{
859
- type: Input
860
- }], labelSelector: [{
861
- type: Input
862
- }], autocomplete: [{
863
- type: Input
864
- }], shortcuts: [{
865
- type: Input
866
- }], confirm: [{
867
- type: Input
868
- }], confirmDialog: [{
869
- type: Input
870
- }], confirmDrawer: [{
871
- type: Input
872
- }], confirmBrowser: [{
873
- type: Input
874
- }], confirmTabs: [{
875
- type: Input
876
- }], dirtySubmitButton: [{
877
- type: Input
878
- }], submit: [{
879
- type: Input
880
- }], successDelay: [{
881
- type: Input
882
- }], errorDelay: [{
883
- type: Input
884
- }], tabGroup: [{
885
- type: Input
886
- }], deactivationGuard: [{
887
- type: Input
888
- }], submitEvent: [{
889
- type: Output,
890
- args: ['fsForm']
891
- }], invalid: [{
892
- type: Output
893
- }], valid: [{
894
- type: Output
895
- }], submitted: [{
896
- type: Output
897
- }], reseted: [{
898
- type: Output
899
- }], cleared: [{
900
- type: Output
901
- }], fsFormClass: [{
902
- type: HostBinding,
903
- args: ['class.fs-form']
904
- }], formDialogClose: [{
905
- type: ContentChildren,
906
- args: [FsFormDialogCloseDirective, { descendants: true }]
907
- }], _tabGroups: [{
908
- type: ContentChildren,
909
- args: [MatTabGroup, { descendants: true }]
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 }]
910
912
  }] } });
911
913
 
912
- const ERROR_MESSAGES = {
913
- required: 'This field is required',
914
- email: 'This is not a valid email address',
915
- emails: 'Input valid email addresses, comma separated',
916
- phone: 'Invalid phone number',
917
- numeric: 'Value should be numeric',
918
- integer: 'Value should be an integer',
919
- min: 'Value should not be less than $(1)',
920
- max: 'Value should not be greater than $(1)',
921
- minlength: 'Should not be shorter than $(1) characters',
922
- maxlength: 'Should not be longer than $(1) characters',
923
- compare: 'Inputs do not match',
924
- pattern: 'Value should match pattern $(1)',
925
- dateRange: 'Invalid date range',
926
- url: 'This is not a valid url',
927
- urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
928
- greater: 'Value must be greater than $(1)',
929
- lesser: 'Value must be less than $(1)',
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)',
930
932
  };
931
933
 
932
- const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
933
- const VALIDATE_MESSAGE_PROVIDER = {
934
- provide: VALIDATE_MESSAGES,
935
- useFactory: messageProviderFactory,
936
- };
937
- function messageProviderFactory() {
938
- return Object.assign({}, ERROR_MESSAGES);
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);
939
941
  }
940
942
 
941
- class FsControlDirective {
942
- constructor(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
943
- this.elementRef = elementRef;
944
- this.renderer2 = renderer2;
945
- this.injector = injector;
946
- this._validateMessages = _validateMessages;
947
- this.ngControl = ngControl;
948
- this.formDirective = formDirective;
949
- this.appendMessageClass = 'fs-form-message';
950
- this.appendLabelClass = 'fs-form-label';
951
- this.appendErrorClass = 'fs-form-error';
952
- this.appendHintClass = 'fs-form-hint';
953
- this.errors = [];
954
- // protected _validateMessages = { ...ERROR_MESSAGES };
955
- this._destroy$ = new Subject();
956
- if (ngControl) {
957
- this._control = ngControl.control;
958
- }
959
- else {
960
- console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
961
- }
962
- }
963
- set validateMessages(messages) {
964
- this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
965
- }
966
- ngOnInit() {
967
- this._setupValidators();
968
- }
969
- ngOnDestroy() {
970
- this._destroy$.next();
971
- this._destroy$.complete();
972
- }
973
- ngAfterContentInit() {
974
- if (this._control) {
975
- /*
976
- Ensure that statusChanges has one subscription per control. Multiple can happen
977
- when multiple fsForm validation directives are applied to the same element
978
- */
979
- if (!this._control.statusChangesSubscribe) {
980
- this._control.statusChanges
981
- .pipe(takeUntil(this._destroy$))
982
- .subscribe(this.render.bind(this));
983
- this._control.statusChangesSubscribe = true;
984
- }
985
- }
986
- }
987
- getMessageSelector() {
988
- var _a;
989
- if (this.messageSelector === false) {
990
- return '';
991
- }
992
- if (this.messageSelector) {
993
- return this.messageSelector;
994
- }
995
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
996
- return this.formDirective.messageSelector;
997
- }
998
- }
999
- getHintWrapperSelector() {
1000
- var _a;
1001
- if (this.hintSelector === false) {
1002
- return '';
1003
- }
1004
- if (this.hintSelector) {
1005
- return this.hintSelector;
1006
- }
1007
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
1008
- return this.formDirective.hintSelector;
1009
- }
1010
- }
1011
- getWrapperSelector() {
1012
- var _a;
1013
- if (this.wrapperSelector === false) {
1014
- return '';
1015
- }
1016
- if (this.wrapperSelector) {
1017
- return this.wrapperSelector;
1018
- }
1019
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
1020
- return this.formDirective.wrapperSelector;
1021
- }
1022
- }
1023
- getlabelSelector() {
1024
- var _a;
1025
- if (this.labelSelector === false) {
1026
- return '';
1027
- }
1028
- if (this.labelSelector) {
1029
- return this.labelSelector;
1030
- }
1031
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
1032
- return this.formDirective.labelSelector;
1033
- }
1034
- }
1035
- getWrapperElement() {
1036
- const wrapper = this.getWrapper(this.elementRef.nativeElement);
1037
- if (wrapper) {
1038
- return wrapper;
1039
- }
1040
- return this.elementRef.nativeElement;
1041
- }
1042
- /*
1043
- <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.
1044
- <input>
1045
- <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1046
- <div class="fs-form-message"></div>
1047
- <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1048
- </div>
1049
- </mat-form-field>
1050
- */
1051
- render() {
1052
- var _a, _b;
1053
- if (this.ngControl) {
1054
- const renderer = this.renderer2;
1055
- const wrapper = this.getWrapperElement();
1056
- const error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1057
- const shouldErrorBeRendered = this.ngControl.invalid
1058
- && (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
1059
- if (shouldErrorBeRendered && error) {
1060
- wrapper.classList.add('ng-invalid', 'ng-dirty');
1061
- }
1062
- else {
1063
- wrapper.classList.remove('ng-invalid');
1064
- }
1065
- if (!this.getMessageSelector()) {
1066
- return;
1067
- }
1068
- const messageWrapper = wrapper.querySelector(this.getMessageSelector());
1069
- if (!messageWrapper) {
1070
- return console.warn('Failed to locate ' + this.getMessageSelector(), this.elementRef.nativeElement);
1071
- }
1072
- if (this.getlabelSelector()) {
1073
- const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1074
- if (labelWrapper) {
1075
- if (this.appendLabelClass) {
1076
- this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1077
- }
1078
- }
1079
- }
1080
- if (this.appendMessageClass) {
1081
- renderer.addClass(messageWrapper, this.appendMessageClass);
1082
- }
1083
- if (this.getHintWrapperSelector()) {
1084
- const hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1085
- if (hint) {
1086
- renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1087
- if (this.appendHintClass) {
1088
- renderer.addClass(hint, this.appendHintClass);
1089
- }
1090
- }
1091
- }
1092
- let errorWrapper = wrapper.querySelector('.fs-form-error-target');
1093
- if (errorWrapper) {
1094
- errorWrapper.remove();
1095
- }
1096
- if (!shouldErrorBeRendered || !error) {
1097
- return;
1098
- }
1099
- errorWrapper = renderer.createElement('div');
1100
- renderer.addClass(errorWrapper, 'fs-form-error-target');
1101
- renderer.addClass(errorWrapper, this.appendErrorClass);
1102
- renderer.addClass(errorWrapper, this.appendErrorClass + '-' + error.name);
1103
- const errorText = renderer.createText(error.message);
1104
- renderer.appendChild(errorWrapper, errorText);
1105
- messageWrapper.appendChild(errorWrapper);
1106
- }
1107
- }
1108
- getWrapper(node, count = 0) {
1109
- if (!node || count > 10) {
1110
- return null;
1111
- }
1112
- if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1113
- return node;
1114
- }
1115
- return this.getWrapper(node.parentNode, ++count);
1116
- }
1117
- parseErrorMessage(message, args) {
1118
- values(args)
1119
- .forEach((name) => {
1120
- message = message.replace(/\$\(\d\)/, name);
1121
- });
1122
- return message;
1123
- }
1124
- getError(controlRef) {
1125
- const name = keys(controlRef.control.errors)[0];
1126
- if (!name) {
1127
- return null;
1128
- }
1129
- let message = controlRef.control.errors[name];
1130
- if (this._validateMessages[name]) {
1131
- message = this.parseErrorMessage(this._validateMessages[name], message);
1132
- }
1133
- return { name: name, message: message };
1134
- }
1135
- _setupValidators() {
1136
- const control = this._control;
1137
- if (this.validate) {
1138
- const validators = control.validator
1139
- ? [control.validator, this.validate.bind(this)]
1140
- : this.validate.bind(this);
1141
- control.setValidators(validators);
1142
- }
1143
- if (this.validateAsync) {
1144
- const asyncValidators = control.asyncValidator
1145
- ? [control.asyncValidator, this.validateAsync.bind(this)]
1146
- : this.validateAsync.bind(this);
1147
- control.setAsyncValidators(asyncValidators);
1148
- }
1149
- control.updateValueAndValidity();
1150
- }
1151
- }
1152
- 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 });
1153
- 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: [
1154
- VALIDATE_MESSAGE_PROVIDER
1155
- ], ngImport: i0 });
1156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsControlDirective, decorators: [{
1157
- type: Directive,
1158
- args: [{
1159
- selector: '[fsFormControl]',
1160
- providers: [
1161
- VALIDATE_MESSAGE_PROVIDER
1162
- ],
1163
- }]
1164
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: undefined, decorators: [{
1165
- type: Self
1166
- }, {
1167
- type: Inject,
1168
- args: [VALIDATE_MESSAGES]
1169
- }] }, { type: i1$1.NgControl, decorators: [{
1170
- type: Optional
1171
- }] }, { type: FsFormDirective, decorators: [{
1172
- type: Optional
1173
- }, {
1174
- type: Inject,
1175
- args: [FsFormDirective]
1176
- }] }]; }, propDecorators: { wrapperSelector: [{
1177
- type: Input
1178
- }], messageSelector: [{
1179
- type: Input
1180
- }], hintSelector: [{
1181
- type: Input
1182
- }], labelSelector: [{
1183
- type: Input
1184
- }], appendMessageClass: [{
1185
- type: Input
1186
- }], appendLabelClass: [{
1187
- type: Input
1188
- }], appendErrorClass: [{
1189
- type: Input
1190
- }], appendHintClass: [{
1191
- type: Input
1192
- }], validateMessages: [{
1193
- 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
+ /*
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
1194
1196
  }] } });
1195
1197
 
1196
- function isEnabled(value) {
1197
- return value !== 'false' && (value || value === '');
1198
+ function isEnabled(value) {
1199
+ return value !== 'false' && (value || value === '');
1198
1200
  }
1199
1201
 
1200
- class FsFormRequiredDirective extends FsControlDirective {
1201
- constructor() {
1202
- super(...arguments);
1203
- this.required = false;
1204
- }
1205
- set setFsFormRequired(value) {
1206
- this.required = isEnabled(value);
1207
- }
1208
- set setRequired(value) {
1209
- this.required = isEnabled(value);
1210
- }
1211
- set validationMessage(value) {
1212
- this._validateMessages.required = value;
1213
- }
1214
- ngOnChanges() {
1215
- this._control.updateValueAndValidity();
1216
- }
1217
- validate(control) {
1218
- if (this.required) {
1219
- return Validators.required(this._control);
1220
- }
1221
- else {
1222
- return null;
1223
- }
1224
- }
1225
- render() {
1226
- const wrapper = this.getWrapperElement();
1227
- if (wrapper && this.getlabelSelector()) {
1228
- const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1229
- // Adding class fs-form-label-requried adds the * to the label
1230
- if (labelWrapper) {
1231
- if (this.required) {
1232
- this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
1233
- }
1234
- else {
1235
- this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
1236
- }
1237
- }
1238
- }
1239
- super.render();
1240
- }
1241
- }
1242
- FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1243
- 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: [
1244
- VALIDATE_MESSAGE_PROVIDER
1245
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormRequiredDirective, decorators: [{
1247
- type: Directive,
1248
- args: [{
1249
- selector: '[fsFormRequired],[ngModel][required]',
1250
- providers: [
1251
- VALIDATE_MESSAGE_PROVIDER
1252
- ],
1253
- }]
1254
- }], propDecorators: { setFsFormRequired: [{
1255
- type: Input,
1256
- args: ['fsFormRequired']
1257
- }], setRequired: [{
1258
- type: Input,
1259
- args: ['required']
1260
- }], validationMessage: [{
1261
- type: Input,
1262
- args: ['fsFormRequiredMessage']
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']
1263
1265
  }] } });
1264
1266
 
1265
- class FsValidators {
1266
- static email(control) {
1267
- if (!control.value || email(control.value)) {
1268
- return null;
1269
- }
1270
- return { email: true };
1271
- }
1272
- static emails(control) {
1273
- const model = control.value || '';
1274
- const hasInvalidEmails = model
1275
- .split(',')
1276
- .some((part) => !email(part));
1277
- return hasInvalidEmails ? { email: true } : null;
1278
- }
1279
- static numeric(control) {
1280
- if (isEmpty(control.value) || isNumeric(control.value)) {
1281
- return null;
1282
- }
1283
- else {
1284
- return { numeric: true };
1285
- }
1286
- }
1287
- static integer(control) {
1288
- if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1289
- return null;
1290
- }
1291
- else {
1292
- return { integer: true };
1293
- }
1294
- }
1295
- static phone(control) {
1296
- if (!control.value || phone(control.value)) {
1297
- return null;
1298
- }
1299
- return { phone: true };
1300
- }
1301
- static url(control, protocolRequired = false) {
1302
- if (!control.value) {
1303
- return null;
1304
- }
1305
- if (!url(control.value)) {
1306
- return { url: true };
1307
- }
1308
- if (protocolRequired) {
1309
- const pattern = new RegExp(/^http(s)?:\/\//gm);
1310
- if (!String(control.value).match(pattern)) {
1311
- return { urlProtocol: true };
1312
- }
1313
- }
1314
- return null;
1315
- }
1316
- static dateRange(control) {
1317
- if (!control.value) {
1318
- return null;
1319
- }
1320
- if (isObject(control.value)) {
1321
- const start = control.value.start;
1322
- const end = control.value.end;
1323
- if ((!start && !end) || (isValid(start) && isValid(end))) {
1324
- return null;
1325
- }
1326
- }
1327
- return { dateRange: true };
1328
- }
1329
- static func(control, formFunction, data) {
1330
- let result;
1331
- let stream$;
1332
- try {
1333
- result = formFunction(control, data);
1334
- }
1335
- catch (err) {
1336
- err = err instanceof Error ? err.message : err;
1337
- stream$ = throwError(err);
1338
- }
1339
- if (!stream$) {
1340
- if (result instanceof Promise) {
1341
- stream$ = from(result);
1342
- }
1343
- else if (isObservable(result)) {
1344
- stream$ = result;
1345
- }
1346
- else {
1347
- stream$ = of(null);
1348
- }
1349
- }
1350
- return stream$
1351
- .pipe(map(() => null), catchError((err) => {
1352
- return of({ validationError: err });
1353
- }), take(1));
1354
- }
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
+ }
1355
1357
  }
1356
1358
 
1357
- class FsFormMinDirective extends FsControlDirective {
1358
- set validationMessage(value) {
1359
- this._validateMessages.min = value;
1360
- }
1361
- ngOnChanges() {
1362
- this._control.updateValueAndValidity();
1363
- }
1364
- validate(control) {
1365
- return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
1366
- }
1367
- }
1368
- FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1369
- FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
1370
- VALIDATE_MESSAGE_PROVIDER
1371
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1372
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinDirective, decorators: [{
1373
- type: Directive,
1374
- args: [{
1375
- selector: '[fsFormMin]',
1376
- providers: [
1377
- VALIDATE_MESSAGE_PROVIDER
1378
- ],
1379
- }]
1380
- }], propDecorators: { fsFormMin: [{
1381
- type: Input
1382
- }], validationMessage: [{
1383
- type: Input,
1384
- args: ['fsFormMinMessage']
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']
1385
1387
  }] } });
1386
1388
 
1387
- class FsFormMaxDirective extends FsControlDirective {
1388
- set validationMessage(value) {
1389
- this._validateMessages.max = value;
1390
- }
1391
- ngOnChanges() {
1392
- this._control.updateValueAndValidity();
1393
- }
1394
- validate(control) {
1395
- return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
1396
- }
1397
- }
1398
- FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1399
- FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
1400
- VALIDATE_MESSAGE_PROVIDER
1401
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxDirective, decorators: [{
1403
- type: Directive,
1404
- args: [{
1405
- selector: '[fsFormMax]',
1406
- providers: [
1407
- VALIDATE_MESSAGE_PROVIDER
1408
- ],
1409
- }]
1410
- }], propDecorators: { fsFormMax: [{
1411
- type: Input
1412
- }], validationMessage: [{
1413
- type: Input,
1414
- args: ['fsFormMaxMessage']
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']
1415
1417
  }] } });
1416
1418
 
1417
- class FsFormMinLengthDirective extends FsControlDirective {
1418
- set validationMessage(value) {
1419
- this._validateMessages.minlength = value;
1420
- }
1421
- ngOnChanges() {
1422
- this._control.updateValueAndValidity();
1423
- }
1424
- validate(control) {
1425
- return Validators.minLength(this.fsFormMinLength)(this._control);
1426
- }
1427
- }
1428
- FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1429
- FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
1430
- VALIDATE_MESSAGE_PROVIDER
1431
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMinLengthDirective, decorators: [{
1433
- type: Directive,
1434
- args: [{
1435
- selector: '[fsFormMinLength]',
1436
- providers: [
1437
- VALIDATE_MESSAGE_PROVIDER
1438
- ],
1439
- }]
1440
- }], propDecorators: { fsFormMinLength: [{
1441
- type: Input
1442
- }], validationMessage: [{
1443
- type: Input,
1444
- args: ['fsFormMinLengthMessage']
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']
1445
1447
  }] } });
1446
1448
 
1447
- class FsFormMaxLengthDirective extends FsControlDirective {
1448
- set validationMessage(value) {
1449
- this._validateMessages.maxlength = value;
1450
- }
1451
- ngOnChanges() {
1452
- this._control.updateValueAndValidity();
1453
- }
1454
- validate(control) {
1455
- return Validators.maxLength(this.fsFormMaxLength)(this._control);
1456
- }
1457
- }
1458
- FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1459
- FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
1460
- VALIDATE_MESSAGE_PROVIDER
1461
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1462
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormMaxLengthDirective, decorators: [{
1463
- type: Directive,
1464
- args: [{
1465
- selector: '[fsFormMaxLength]',
1466
- providers: [
1467
- VALIDATE_MESSAGE_PROVIDER
1468
- ],
1469
- }]
1470
- }], propDecorators: { fsFormMaxLength: [{
1471
- type: Input
1472
- }], validationMessage: [{
1473
- type: Input,
1474
- args: ['fsFormMaxLengthMessage']
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']
1475
1477
  }] } });
1476
1478
 
1477
- class FsFormEmailDirective extends FsControlDirective {
1478
- set validationMessage(value) {
1479
- this._validateMessages.email = value;
1480
- }
1481
- ngOnChanges() {
1482
- this._control.updateValueAndValidity();
1483
- }
1484
- validate(control) {
1485
- if (isEnabled(this.fsFormEmail)) {
1486
- return FsValidators.email(this._control);
1487
- }
1488
- else {
1489
- return null;
1490
- }
1491
- }
1492
- }
1493
- FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1494
- FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
1495
- VALIDATE_MESSAGE_PROVIDER
1496
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1497
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailDirective, decorators: [{
1498
- type: Directive,
1499
- args: [{
1500
- selector: '[fsFormEmail]',
1501
- providers: [
1502
- VALIDATE_MESSAGE_PROVIDER
1503
- ],
1504
- }]
1505
- }], propDecorators: { fsFormEmail: [{
1506
- type: Input
1507
- }], validationMessage: [{
1508
- type: Input,
1509
- args: ['fsFormEmailMessage']
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']
1510
1512
  }] } });
1511
1513
 
1512
- class FsFormEmailsDirective extends FsControlDirective {
1513
- set validationMessage(value) {
1514
- this._validateMessages.emails = value;
1515
- }
1516
- ngOnChanges() {
1517
- this._control.updateValueAndValidity();
1518
- }
1519
- validate(control) {
1520
- if (isEnabled(this.fsFormEmails)) {
1521
- return FsValidators.emails(this._control);
1522
- }
1523
- else {
1524
- return null;
1525
- }
1526
- }
1527
- }
1528
- FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1529
- FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
1530
- VALIDATE_MESSAGE_PROVIDER
1531
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1532
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormEmailsDirective, decorators: [{
1533
- type: Directive,
1534
- args: [{
1535
- selector: '[fsFormEmails]',
1536
- providers: [
1537
- VALIDATE_MESSAGE_PROVIDER
1538
- ],
1539
- }]
1540
- }], propDecorators: { fsFormEmails: [{
1541
- type: Input
1542
- }], validationMessage: [{
1543
- type: Input,
1544
- args: ['fsFormEmailsMessage']
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']
1545
1547
  }] } });
1546
1548
 
1547
- class FsFormPhoneDirective extends FsControlDirective {
1548
- set validationMessage(value) {
1549
- this._validateMessages.phone = value;
1550
- }
1551
- ngOnChanges() {
1552
- this._control.updateValueAndValidity();
1553
- }
1554
- validate(control) {
1555
- if (isEnabled(this.fsFormPhone)) {
1556
- return FsValidators.phone(this._control);
1557
- }
1558
- else {
1559
- return null;
1560
- }
1561
- }
1562
- }
1563
- FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1564
- FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
1565
- VALIDATE_MESSAGE_PROVIDER
1566
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1567
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPhoneDirective, decorators: [{
1568
- type: Directive,
1569
- args: [{
1570
- selector: '[fsFormPhone]',
1571
- providers: [
1572
- VALIDATE_MESSAGE_PROVIDER
1573
- ],
1574
- }]
1575
- }], propDecorators: { fsFormPhone: [{
1576
- type: Input
1577
- }], validationMessage: [{
1578
- type: Input,
1579
- args: ['fsFormPhoneMessage']
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']
1580
1582
  }] } });
1581
1583
 
1582
- class FsFormCompareDirective extends FsControlDirective {
1583
- set validationMessage(value) {
1584
- this._validateMessages.compare = value;
1585
- }
1586
- ngOnChanges() {
1587
- this._control.updateValueAndValidity();
1588
- }
1589
- validate(control) {
1590
- if (this.fsFormCompare.value === this.elementRef.nativeElement.value) {
1591
- return null;
1592
- }
1593
- else {
1594
- return { compare: true };
1595
- }
1596
- }
1597
- ngAfterViewInit() {
1598
- this.fsFormCompare.addEventListener('keyup', () => {
1599
- this._control.updateValueAndValidity();
1600
- }, false);
1601
- }
1602
- ngOnDestroy() {
1603
- this.fsFormCompare.removeEventListener('keyup', () => {
1604
- this._control.updateValueAndValidity();
1605
- }, false);
1606
- }
1607
- }
1608
- FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1609
- FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
1610
- VALIDATE_MESSAGE_PROVIDER,
1611
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormCompareDirective, decorators: [{
1613
- type: Directive,
1614
- args: [{
1615
- selector: '[fsFormCompare]',
1616
- providers: [
1617
- VALIDATE_MESSAGE_PROVIDER,
1618
- ],
1619
- }]
1620
- }], propDecorators: { fsFormCompare: [{
1621
- type: Input
1622
- }], validationMessage: [{
1623
- type: Input,
1624
- args: ['fsFormCompareMessage']
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']
1625
1627
  }] } });
1626
1628
 
1627
- class FsFormIntegerDirective extends FsControlDirective {
1628
- set validationMessage(value) {
1629
- this._validateMessages.integer = value;
1630
- }
1631
- ngOnChanges() {
1632
- this._control.updateValueAndValidity();
1633
- }
1634
- validate(control) {
1635
- if (isEnabled(this.fsFormInteger)) {
1636
- return FsValidators.integer(this._control);
1637
- }
1638
- else {
1639
- return null;
1640
- }
1641
- }
1642
- }
1643
- FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1644
- FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
1645
- VALIDATE_MESSAGE_PROVIDER
1646
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormIntegerDirective, decorators: [{
1648
- type: Directive,
1649
- args: [{
1650
- selector: '[fsFormInteger]',
1651
- providers: [
1652
- VALIDATE_MESSAGE_PROVIDER
1653
- ],
1654
- }]
1655
- }], propDecorators: { fsFormInteger: [{
1656
- type: Input
1657
- }], validationMessage: [{
1658
- type: Input,
1659
- args: ['fsFormIntegerMessage']
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']
1660
1662
  }] } });
1661
1663
 
1662
- class FsFormNumericDirective extends FsControlDirective {
1663
- set validationMessage(value) {
1664
- this._validateMessages.numeric = value;
1665
- }
1666
- ngOnChanges() {
1667
- this._control.updateValueAndValidity();
1668
- }
1669
- validate(control) {
1670
- if (isEnabled(this.fsFormNumeric)) {
1671
- return FsValidators.numeric(this._control);
1672
- }
1673
- else {
1674
- return null;
1675
- }
1676
- }
1677
- }
1678
- FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1679
- FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
1680
- VALIDATE_MESSAGE_PROVIDER
1681
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNumericDirective, decorators: [{
1683
- type: Directive,
1684
- args: [{
1685
- selector: '[fsFormNumeric]',
1686
- providers: [
1687
- VALIDATE_MESSAGE_PROVIDER
1688
- ],
1689
- }]
1690
- }], propDecorators: { fsFormNumeric: [{
1691
- type: Input
1692
- }], validationMessage: [{
1693
- type: Input,
1694
- args: ['fsFormNumericMessage']
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']
1695
1697
  }] } });
1696
1698
 
1697
- class FsFormPatternDirective extends FsControlDirective {
1698
- set validationMessage(value) {
1699
- this._validateMessages.pattern = value;
1700
- }
1701
- ngOnChanges() {
1702
- this._control.updateValueAndValidity();
1703
- }
1704
- validate(control) {
1705
- return Validators.pattern(this.fsFormPattern)(this._control);
1706
- }
1707
- }
1708
- FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1709
- FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
1710
- VALIDATE_MESSAGE_PROVIDER
1711
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1712
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormPatternDirective, decorators: [{
1713
- type: Directive,
1714
- args: [{
1715
- selector: '[fsFormPattern]',
1716
- providers: [
1717
- VALIDATE_MESSAGE_PROVIDER
1718
- ],
1719
- }]
1720
- }], propDecorators: { fsFormPattern: [{
1721
- type: Input
1722
- }], validationMessage: [{
1723
- type: Input,
1724
- args: ['fsFormPatternMessage']
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']
1725
1727
  }] } });
1726
1728
 
1727
- class FsFormFunctionDirective extends FsControlDirective {
1728
- constructor() {
1729
- super(...arguments);
1730
- this.validateOnSubmit = false;
1731
- }
1732
- ngOnChanges() {
1733
- this._control.updateValueAndValidity();
1734
- }
1735
- validateAsync(control) {
1736
- if (this.validateOnSubmit && !this.formDirective.validating) {
1737
- return of(null);
1738
- }
1739
- return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
1740
- }
1741
- }
1742
- FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1743
- FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
1744
- VALIDATE_MESSAGE_PROVIDER
1745
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1746
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormFunctionDirective, decorators: [{
1747
- type: Directive,
1748
- args: [{
1749
- selector: '[fsFormFunction]',
1750
- providers: [
1751
- VALIDATE_MESSAGE_PROVIDER
1752
- ],
1753
- }]
1754
- }], propDecorators: { fsFormFunction: [{
1755
- type: Input
1756
- }], fsFormFunctionData: [{
1757
- type: Input
1758
- }], validateOnSubmit: [{
1759
- type: Input
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
1760
1762
  }] } });
1761
1763
 
1762
- class FsFormGreaterDirective extends FsControlDirective {
1763
- set validationMessage(value) {
1764
- this._validateMessages.greater = value;
1765
- }
1766
- ngOnChanges() {
1767
- this._control.updateValueAndValidity();
1768
- }
1769
- validate(control) {
1770
- const greater = parseFloat(this.fsFormGreater);
1771
- const value = parseFloat(this._control.value);
1772
- if (!isNaN(greater) && !isNaN(value) && value <= greater) {
1773
- return { greater: { greater, actual: value } };
1774
- }
1775
- return FsValidators.numeric(this._control);
1776
- }
1777
- }
1778
- FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1779
- FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
1780
- VALIDATE_MESSAGE_PROVIDER
1781
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormGreaterDirective, decorators: [{
1783
- type: Directive,
1784
- args: [{
1785
- selector: '[fsFormGreater]',
1786
- providers: [
1787
- VALIDATE_MESSAGE_PROVIDER
1788
- ],
1789
- }]
1790
- }], propDecorators: { fsFormGreater: [{
1791
- type: Input
1792
- }], validationMessage: [{
1793
- type: Input,
1794
- args: ['fsFormGreaterMessage']
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']
1795
1797
  }] } });
1796
1798
 
1797
- class FsFormDateRangeDirective extends FsControlDirective {
1798
- set validationMessage(value) {
1799
- this._validateMessages.dateRange = value;
1800
- }
1801
- ngOnChanges() {
1802
- this._control.updateValueAndValidity();
1803
- }
1804
- validate(control) {
1805
- if (isEnabled(this.fsFormDateRange)) {
1806
- return FsValidators.dateRange(this._control);
1807
- }
1808
- else {
1809
- return null;
1810
- }
1811
- }
1812
- }
1813
- FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1814
- FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
1815
- VALIDATE_MESSAGE_PROVIDER
1816
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1817
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDateRangeDirective, decorators: [{
1818
- type: Directive,
1819
- args: [{
1820
- selector: '[fsFormDateRange]',
1821
- providers: [
1822
- VALIDATE_MESSAGE_PROVIDER
1823
- ],
1824
- }]
1825
- }], propDecorators: { fsFormDateRange: [{
1826
- type: Input
1827
- }], validationMessage: [{
1828
- type: Input,
1829
- args: ['fsFormDateRangeMessage']
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']
1830
1832
  }] } });
1831
1833
 
1832
- class FsFormLesserDirective extends FsControlDirective {
1833
- set validationMessage(value) {
1834
- this._validateMessages.lesser = value;
1835
- }
1836
- ngOnChanges() {
1837
- this._control.updateValueAndValidity();
1838
- }
1839
- validate(control) {
1840
- const lesser = parseFloat(this.fsFormLesser);
1841
- const value = parseFloat(this._control.value);
1842
- if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
1843
- return { lesser: { lesser, actual: value } };
1844
- }
1845
- return FsValidators.numeric(this._control);
1846
- }
1847
- }
1848
- FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1849
- FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
1850
- VALIDATE_MESSAGE_PROVIDER
1851
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1852
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormLesserDirective, decorators: [{
1853
- type: Directive,
1854
- args: [{
1855
- selector: '[fsFormLesser]',
1856
- providers: [
1857
- VALIDATE_MESSAGE_PROVIDER
1858
- ],
1859
- }]
1860
- }], propDecorators: { fsFormLesser: [{
1861
- type: Input
1862
- }], validationMessage: [{
1863
- type: Input,
1864
- args: ['fsFormLesserMessage']
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']
1865
1867
  }] } });
1866
1868
 
1867
- class FsFormUrlDirective extends FsControlDirective {
1868
- constructor() {
1869
- super(...arguments);
1870
- this.fsFormUrlProtocol = false;
1871
- }
1872
- set validationMessage(value) {
1873
- this._validateMessages.url = value;
1874
- }
1875
- ngOnChanges() {
1876
- this._control.updateValueAndValidity();
1877
- }
1878
- validate(control) {
1879
- if (isEnabled(this.fsFormUrl)) {
1880
- return FsValidators.url(this._control, this.fsFormUrlProtocol);
1881
- }
1882
- else {
1883
- return null;
1884
- }
1885
- }
1886
- }
1887
- FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1888
- 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: [
1889
- VALIDATE_MESSAGE_PROVIDER
1890
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormUrlDirective, decorators: [{
1892
- type: Directive,
1893
- args: [{
1894
- selector: '[fsFormUrl]',
1895
- providers: [
1896
- VALIDATE_MESSAGE_PROVIDER
1897
- ],
1898
- }]
1899
- }], propDecorators: { fsFormUrl: [{
1900
- type: Input
1901
- }], fsFormUrlProtocol: [{
1902
- type: Input
1903
- }], validationMessage: [{
1904
- type: Input,
1905
- args: ['fsFormUrlMessage']
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']
1906
1908
  }] } });
1907
1909
 
1908
- class FsButtonDirective {
1909
- constructor(_matButton, _form, _elementRef, _cdRef) {
1910
- this._matButton = _matButton;
1911
- this._form = _form;
1912
- this._elementRef = _elementRef;
1913
- this._cdRef = _cdRef;
1914
- this.dirtySubmit = true;
1915
- this.transitionStyle = null;
1916
- this.active = false;
1917
- this.submit = false;
1918
- this._previousDisabled = false;
1919
- this._destroy$ = new Subject();
1920
- }
1921
- ngOnInit() {
1922
- this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
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') {
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
+ if (this._form) {
1926
+ this._form.addButton(this);
1927
+ if (this.submit) {
1928
+ fromEvent(this.element, 'click')
1929
+ .pipe(takeUntil(this._destroy$))
1930
+ .subscribe(() => {
1931
+ this.active = true;
1932
+ });
1933
+ if (this.dirtySubmit) {
1934
+ if (this._form.dirtySubmitButton) {
1935
+ if (!this._form.ngForm.dirty) {
1936
+ this.disable();
1937
+ }
1938
+ }
1939
+ }
1940
+ this.transitionStyle = 'none';
1941
+ setTimeout(() => {
1942
+ this.transitionStyle = null;
1943
+ }, 500);
1944
+ }
1945
+ }
1946
+ }
1947
+ disable() {
1948
+ if (this._matButton && !this.active) {
1949
+ this._previousDisabled = this._matButton.disabled;
1950
+ this._matButton.disabled = true;
1951
+ this._cdRef.markForCheck();
1952
+ }
1953
+ }
1954
+ enable() {
1955
+ if (this._matButton) {
1956
+ this._matButton.disabled = false;
1957
+ this._matButton.disableRipple = true;
1958
+ this._cdRef.markForCheck();
1959
+ }
1960
+ }
1961
+ process() {
1962
+ this.setClass('process');
1963
+ if (this._matButton) {
1964
+ this._matButton.disableRipple = true;
1965
+ }
1966
+ }
1967
+ success() {
1968
+ this.setClass('success');
1969
+ if (this._matButton) {
1970
+ this._matButton.disableRipple = false;
1971
+ }
1972
+ }
1973
+ error() {
1974
+ this.setClass('error');
1975
+ if (this._matButton) {
1976
+ this._matButton.disableRipple = false;
1977
+ }
1978
+ }
1979
+ setClass(cls) {
1980
+ const svg = this._getSvg(cls);
1981
+ this._resetClass();
1982
+ this._disableShadowAnimation();
1983
+ this.element.classList.add(`submit-${cls}`);
1984
+ this.element.append(svg);
1985
+ }
1986
+ get element() {
1987
+ return this._elementRef.nativeElement;
1988
+ }
1989
+ resetActive() {
1990
+ this.active = false;
1991
+ }
1992
+ reset() {
1993
+ if (!this._previousDisabled) {
1994
+ this.enable();
1995
+ }
1996
+ this.element.querySelectorAll('.svg-icon')
1997
+ .forEach((el) => {
1998
+ el.remove();
1999
+ });
2000
+ if (this._matButton) {
2001
+ this._matButton.disableRipple = false;
2002
+ }
2003
+ this._resetClass();
2004
+ }
2005
+ ngOnDestroy() {
2006
+ var _a;
2007
+ this._destroy$.next();
2008
+ this._destroy$.complete();
2009
+ (_a = this._form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
2010
+ }
2011
+ _disableShadowAnimation() {
2012
+ // .mat-elevation-z2 removes the click shadow animation
2013
+ //this.element.classList.add('mat-elevation-z2');
2014
+ }
2015
+ _resetClass() {
2016
+ this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2017
+ }
2018
+ _getSvg(type) {
2019
+ if (type === 'success') {
2018
2020
  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">
2019
2021
  <g>
2020
2022
  <g class="check">
@@ -2023,368 +2025,368 @@ class FsButtonDirective {
2023
2025
  </g>
2024
2026
  </g>
2025
2027
  </g>
2026
- </svg>`, 'text/xml').firstChild;
2027
- }
2028
- if (type === 'process') {
2028
+ </svg>`, 'text/xml').firstChild;
2029
+ }
2030
+ if (type === 'process') {
2029
2031
  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">
2030
2032
  <g fill="none" fill-rule="evenodd">
2031
2033
  <g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
2032
2034
  <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>
2033
2035
  </g>
2034
2036
  </g>
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" }, 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
- }], transitionStyle: [{
2060
- type: HostBinding,
2061
- args: ['style.transition']
2037
+ </svg>`, 'text/xml').firstChild;
2038
+ }
2039
+ if (type === 'error') {
2040
+ 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;
2041
+ }
2042
+ }
2043
+ }
2044
+ 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 });
2045
+ FsButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: { name: "name", dirtySubmit: "dirtySubmit" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0 });
2046
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsButtonDirective, decorators: [{
2047
+ type: Directive,
2048
+ args: [{
2049
+ selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
2050
+ }]
2051
+ }], ctorParameters: function () { return [{ type: i1$2.MatButton, decorators: [{
2052
+ type: Optional
2053
+ }, {
2054
+ type: Host
2055
+ }] }, { type: FsFormDirective, decorators: [{
2056
+ type: Optional
2057
+ }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { name: [{
2058
+ type: Input
2059
+ }], dirtySubmit: [{
2060
+ type: Input
2061
+ }], transitionStyle: [{
2062
+ type: HostBinding,
2063
+ args: ['style.transition']
2062
2064
  }] } });
2063
2065
 
2064
- class FsFormValidateDirective extends FsControlDirective {
2065
- constructor() {
2066
- super(...arguments);
2067
- this.validateOnSubmit = false;
2068
- }
2069
- ngOnChanges() {
2070
- this._control.updateValueAndValidity();
2071
- }
2072
- validateAsync(control) {
2073
- if (this.validateOnSubmit && !this.formDirective.validating) {
2074
- return of(null);
2075
- }
2076
- return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2077
- }
2078
- }
2079
- FsFormValidateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2080
- 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: [
2081
- VALIDATE_MESSAGE_PROVIDER
2082
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2083
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormValidateDirective, decorators: [{
2084
- type: Directive,
2085
- args: [{
2086
- selector: '[validate]',
2087
- providers: [
2088
- VALIDATE_MESSAGE_PROVIDER
2089
- ],
2090
- }]
2091
- }], propDecorators: { validateFn: [{
2092
- type: Input,
2093
- args: ['validate']
2094
- }], validateFnData: [{
2095
- type: Input,
2096
- args: ['validateData']
2097
- }], validateOnSubmit: [{
2098
- 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
2099
2101
  }] } });
2100
2102
 
2101
- class FsFormDialogActionsComponent {
2102
- constructor(_form, _dialogRef, _cdRef) {
2103
- this._form = _form;
2104
- this._dialogRef = _dialogRef;
2105
- this._cdRef = _cdRef;
2106
- this.save = true;
2107
- this.create = false;
2108
- this.close = false;
2109
- this.done = false;
2110
- this.closeData = null;
2111
- this.dirty = false;
2112
- this._destroy$ = new Subject();
2113
- }
2114
- ngOnInit() {
2115
- if (this._form) {
2116
- this._form.ngForm.valueChanges
2117
- .pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
2118
- .subscribe(() => {
2119
- this.dirty = this._form.ngForm.dirty;
2120
- this._cdRef.markForCheck();
2121
- });
2122
- this._form.submitted
2123
- .pipe(delay(50), takeUntil(this._destroy$))
2124
- .subscribe(() => {
2125
- this.dirty = false;
2126
- this._cdRef.markForCheck();
2127
- });
2128
- this._form.reseted
2129
- .pipe(takeUntil(this._destroy$))
2130
- .subscribe(() => {
2131
- this.dirty = false;
2132
- this._cdRef.markForCheck();
2133
- });
2134
- }
2135
- }
2136
- closeClick() {
2137
- if (this._form) {
2138
- this._form.triggerConfirm()
2139
- .pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
2140
- .subscribe(() => {
2141
- this._dialogRef.close(this.closeData);
2142
- });
2143
- }
2144
- else {
2145
- this._dialogRef.close(this.closeData);
2146
- }
2147
- }
2148
- ngOnDestroy() {
2149
- this._destroy$.next();
2150
- this._destroy$.complete();
2151
- }
2152
- }
2153
- 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 });
2154
- 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"] }, { 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 });
2155
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
2156
- type: Component,
2157
- args: [{
2158
- selector: 'fs-form-dialog-actions',
2159
- templateUrl: './form-dialog-actions.component.html',
2160
- styleUrls: ['./form-dialog-actions.component.scss'],
2161
- changeDetection: ChangeDetectionStrategy.OnPush,
2162
- }]
2163
- }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
2164
- type: Optional
2165
- }] }, { type: i2$1.MatDialogRef, decorators: [{
2166
- type: Optional
2167
- }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { save: [{
2168
- type: Input
2169
- }], create: [{
2170
- type: Input
2171
- }], close: [{
2172
- type: Input
2173
- }], done: [{
2174
- type: Input
2175
- }], closeData: [{
2176
- type: Input
2177
- }], name: [{
2178
- 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"] }, { 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
2179
2181
  }] } });
2180
2182
 
2181
- /**
2182
- * This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
2183
- *
2184
- * This directive required for automatic validation messages
2185
- */
2186
- class FsFormNoFsValidatorsDirective extends FsControlDirective {
2187
- ngOnChanges() {
2188
- this._control.updateValueAndValidity();
2189
- }
2190
- }
2191
- FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2192
- 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: [
2193
- VALIDATE_MESSAGE_PROVIDER
2194
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
2196
- type: Directive,
2197
- args: [{
2198
- selector: '[ngModel]' +
2199
- ':not([required])' +
2200
- ':not([fsFormRequired])' +
2201
- ':not([fsFormCompare])' +
2202
- ':not([fsFormDateRange])' +
2203
- ':not([fsFormEmail])' +
2204
- ':not([fsFormEmails])' +
2205
- ':not([fsFormFunction])' +
2206
- ':not([fsFormGreater])' +
2207
- ':not([fsFormInteger])' +
2208
- ':not([fsFormLesser])' +
2209
- ':not([fsFormMax])' +
2210
- ':not([fsFormMaxLength])' +
2211
- ':not([fsFormMin])' +
2212
- ':not([fsFormMinLength])' +
2213
- ':not([fsFormNumeric])' +
2214
- ':not([fsFormPattern])' +
2215
- ':not([fsFormPhone])' +
2216
- ':not([fsFormUrl])' +
2217
- ':not([validate])',
2218
- providers: [
2219
- VALIDATE_MESSAGE_PROVIDER
2220
- ],
2221
- }]
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
+ }]
2222
2224
  }] });
2223
2225
 
2224
- class FsSubmitButtonDirective extends FsButtonDirective {
2225
- }
2226
- FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2227
- FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
2228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
2229
- type: Directive,
2230
- args: [{
2231
- selector: 'dummy-selector',
2232
- }]
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
+ }]
2233
2235
  }] });
2234
2236
 
2235
- class FsFormModule {
2236
- static forRoot() {
2237
- /**
2238
- * Hack: https://github.com/angular/components/issues/20097
2239
- */
2240
- ErrorStateMatcher.prototype.isErrorState = (control, form) => {
2241
- 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);
2242
- };
2243
- return {
2244
- ngModule: FsFormModule,
2245
- };
2246
- }
2247
- }
2248
- FsFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2249
- FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, declarations: [FsFormDirective,
2250
- FsControlDirective,
2251
- FsFormRequiredDirective,
2252
- FsFormMinDirective,
2253
- FsFormMaxDirective,
2254
- FsFormMinLengthDirective,
2255
- FsFormMaxLengthDirective,
2256
- FsFormEmailDirective,
2257
- FsFormEmailsDirective,
2258
- FsFormPhoneDirective,
2259
- FsFormCompareDirective,
2260
- FsFormIntegerDirective,
2261
- FsFormNumericDirective,
2262
- FsFormPatternDirective,
2263
- FsFormFunctionDirective,
2264
- FsFormDateRangeDirective,
2265
- FsFormGreaterDirective,
2266
- FsFormLesserDirective,
2267
- FsFormUrlDirective,
2268
- FsFormDialogCloseDirective,
2269
- FsFormValidateDirective,
2270
- FsFormDialogActionsComponent,
2271
- FsFormNoFsValidatorsDirective,
2272
- FsButtonDirective,
2273
- FsSubmitButtonDirective], imports: [CommonModule,
2274
- FormsModule,
2275
- MatButtonModule,
2276
- MatDialogModule], exports: [FsFormDirective,
2277
- FsControlDirective,
2278
- FsFormRequiredDirective,
2279
- FsFormMinDirective,
2280
- FsFormMaxDirective,
2281
- FsFormMinLengthDirective,
2282
- FsFormMaxLengthDirective,
2283
- FsFormEmailDirective,
2284
- FsFormEmailsDirective,
2285
- FsFormPhoneDirective,
2286
- FsFormCompareDirective,
2287
- FsFormIntegerDirective,
2288
- FsFormNumericDirective,
2289
- FsFormPatternDirective,
2290
- FsFormFunctionDirective,
2291
- FsFormDateRangeDirective,
2292
- FsFormGreaterDirective,
2293
- FsFormLesserDirective,
2294
- FsFormUrlDirective,
2295
- FsFormDialogCloseDirective,
2296
- FsFormValidateDirective,
2297
- FsFormDialogActionsComponent,
2298
- FsFormNoFsValidatorsDirective,
2299
- FsButtonDirective,
2300
- FsSubmitButtonDirective] });
2301
- FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, providers: [
2302
- {
2303
- provide: ErrorStateMatcher,
2304
- useClass: ShowOnDirtyErrorStateMatcher,
2305
- },
2306
- ], imports: [[
2307
- CommonModule,
2308
- FormsModule,
2309
- MatButtonModule,
2310
- MatDialogModule,
2311
- ]] });
2312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFormModule, decorators: [{
2313
- type: NgModule,
2314
- args: [{
2315
- imports: [
2316
- CommonModule,
2317
- FormsModule,
2318
- MatButtonModule,
2319
- MatDialogModule,
2320
- ],
2321
- declarations: [
2322
- FsFormDirective,
2323
- FsControlDirective,
2324
- FsFormRequiredDirective,
2325
- FsFormMinDirective,
2326
- FsFormMaxDirective,
2327
- FsFormMinLengthDirective,
2328
- FsFormMaxLengthDirective,
2329
- FsFormEmailDirective,
2330
- FsFormEmailsDirective,
2331
- FsFormPhoneDirective,
2332
- FsFormCompareDirective,
2333
- FsFormIntegerDirective,
2334
- FsFormNumericDirective,
2335
- FsFormPatternDirective,
2336
- FsFormFunctionDirective,
2337
- FsFormDateRangeDirective,
2338
- FsFormGreaterDirective,
2339
- FsFormLesserDirective,
2340
- FsFormUrlDirective,
2341
- FsFormDialogCloseDirective,
2342
- FsFormValidateDirective,
2343
- FsFormDialogActionsComponent,
2344
- FsFormNoFsValidatorsDirective,
2345
- FsButtonDirective,
2346
- FsSubmitButtonDirective,
2347
- ],
2348
- exports: [
2349
- FsFormDirective,
2350
- FsControlDirective,
2351
- FsFormRequiredDirective,
2352
- FsFormMinDirective,
2353
- FsFormMaxDirective,
2354
- FsFormMinLengthDirective,
2355
- FsFormMaxLengthDirective,
2356
- FsFormEmailDirective,
2357
- FsFormEmailsDirective,
2358
- FsFormPhoneDirective,
2359
- FsFormCompareDirective,
2360
- FsFormIntegerDirective,
2361
- FsFormNumericDirective,
2362
- FsFormPatternDirective,
2363
- FsFormFunctionDirective,
2364
- FsFormDateRangeDirective,
2365
- FsFormGreaterDirective,
2366
- FsFormLesserDirective,
2367
- FsFormUrlDirective,
2368
- FsFormDialogCloseDirective,
2369
- FsFormValidateDirective,
2370
- FsFormDialogActionsComponent,
2371
- FsFormNoFsValidatorsDirective,
2372
- FsButtonDirective,
2373
- FsSubmitButtonDirective,
2374
- ],
2375
- providers: [
2376
- {
2377
- provide: ErrorStateMatcher,
2378
- useClass: ShowOnDirtyErrorStateMatcher,
2379
- },
2380
- ],
2381
- }]
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
+ }]
2382
2384
  }] });
2383
2385
 
2384
2386
  // Modules
2385
2387
 
2386
- /**
2387
- * Generated bundle index. Do not edit.
2388
+ /**
2389
+ * Generated bundle index. Do not edit.
2388
2390
  */
2389
2391
 
2390
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 };