@firestitch/form 12.4.13 → 12.4.14

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