@firestitch/form 12.4.6 → 12.4.8

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