@firestitch/form 13.3.6 → 13.3.9

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