@firestitch/form 12.4.12 → 12.4.14

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