@firestitch/form 13.3.7 → 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 -689
  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 -2450
  124. package/fesm2015/firestitch-form.mjs.map +1 -1
  125. package/fesm2020/firestitch-form.mjs +2439 -2436
  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,990 +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(filter(() => !this.submitting), switchMap((event) => {
698
- if (this.confirm && this.confirmTabs) {
699
- return this.triggerConfirm()
700
- .pipe(tap((result) => {
701
- if (confirmResultContinue(result)) {
702
- confirmTabGroup.selectedIndex = event.idx;
703
- }
704
- }));
705
- }
706
- confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
707
- return of(null);
708
- }), takeUntil(this._destroy$))
709
- .subscribe();
710
- }
711
- _registerConfirmDialogBackdropEscape() {
712
- if (this._dialogRef) {
713
- this._dialogBackdropEscape = !this._dialogRef?.disableClose;
714
- if (this._dialogBackdropEscape) {
715
- this._dialogRef.backdropClick()
716
- .pipe(takeUntil(this._destroy$))
717
- .subscribe(() => {
718
- this._formClose();
719
- });
720
- this._destroy$
721
- .subscribe(() => {
722
- this._dialogRef.disableClose = false;
723
- });
724
- }
725
- }
726
- }
727
- _registerAutocomplete() {
728
- this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
729
- this.ngForm.form.registerControl = (name, control) => {
730
- const el = this._element.nativeElement.querySelector(`input[name='${name}']`);
731
- if (el) {
732
- if (!el.getAttribute('autocomplete')) {
733
- el.setAttribute('autocomplete', 'none');
734
- el.setAttribute('name', `${name}-${guid()}`);
735
- }
736
- }
737
- return this._registerControl(name, control);
738
- };
739
- }
740
- _registerDirtySubmitButton() {
741
- if (!this.ngForm) {
742
- return;
743
- }
744
- this.ngForm.form.valueChanges
745
- .pipe(takeUntil(this._destroy$))
746
- .subscribe(() => {
747
- this._updateDirtySubmitButtons();
748
- });
749
- this._buttons.changes
750
- .pipe(takeUntil(this._destroy$))
751
- .subscribe(() => {
752
- this._updateDirtySubmitButtons();
753
- });
754
- }
755
- _updateDirtySubmitButtons() {
756
- this._buttons
757
- .filter((button) => button.submit)
758
- .forEach((submitButton) => {
759
- if (!this.confirm || !this.dirtySubmitButton || this.ngForm.dirty || !submitButton.dirtySubmit) {
760
- submitButton.enable();
761
- }
762
- else {
763
- submitButton.disable();
764
- }
765
- });
766
- }
767
- _broadcastSubmittingEvents() {
768
- this._status$.next(FormStatus.Submitting);
769
- this._form.broadcast('submit', this.ngForm);
770
- }
771
- _broadcasValidatingEvents() {
772
- this._status$.next(FormStatus.Validating);
773
- }
774
- _setupActiveSubmitButton() {
775
- this._activeSubmitButton = this._getActiveSubmitButton();
776
- this._resetButtons();
777
- if (this._activeSubmitButton) {
778
- this._activeSubmitButton.process();
779
- }
780
- }
781
- _disableButtons() {
782
- this._buttons.forEach((button) => {
783
- button.disable();
784
- });
785
- }
786
- _waitUntilStatusPending() {
787
- return this.ngForm.statusChanges
788
- .pipe(startWith(this.ngForm.status), first((state) => state !== 'PENDING'));
789
- }
790
- _handleError(e) {
791
- console.log('%c Form Submit ', 'color: white; background-color: #D33F49', 'Error occured');
792
- console.group('Error Details:');
793
- console.log('Message: ', e);
794
- console.log('FormRef: ', this);
795
- if (this.ngForm.invalid) {
796
- const errors = getFormErrors(this.ngForm.control, null);
797
- console.log('Validation Errors: ', errors);
798
- }
799
- console.groupEnd();
800
- this._completeSubmit(false, null);
801
- }
802
- _registerCanDeactivateGuard() {
803
- this._activatedRouteConfig = getActiveRoute(this._route).routeConfig;
804
- if (!this._activatedRouteConfig) {
805
- return;
806
- }
807
- this._form.registerFormDirective(this._activatedRouteConfig.component, this);
808
- if (!Array.isArray(this._activatedRouteConfig.canDeactivate)) {
809
- this._activatedRouteConfig.canDeactivate = [];
810
- }
811
- if (this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard) === -1) {
812
- this._activatedRouteConfig.canDeactivate.push(FormDeactivateGuard);
813
- }
814
- }
815
- _cleanupCanDeactivate() {
816
- if (!this._activatedRouteConfig) {
817
- return;
818
- }
819
- const guardIndex = this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard);
820
- this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
821
- this._form.removeFormDirective(this._activatedRouteConfig.component);
822
- }
823
- }
824
- 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 });
825
- 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 });
826
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDirective, decorators: [{
827
- type: Directive,
828
- args: [{
829
- selector: '[fsForm]',
830
- exportAs: 'fsForm',
831
- }]
832
- }], ctorParameters: function () { return [{ type: i1$2.NgForm, decorators: [{
833
- type: Inject,
834
- args: [NgForm]
835
- }] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$2.FsMessage }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i1.MatDialogRef, decorators: [{
836
- type: Optional
837
- }, {
838
- type: Inject,
839
- args: [MatDialogRef]
840
- }] }, { type: i6.DrawerRef, decorators: [{
841
- type: Optional
842
- }, {
843
- type: Inject,
844
- args: [DrawerRef]
845
- }] }, { type: i2$1.ActivatedRoute }]; }, propDecorators: { wrapperSelector: [{
846
- type: Input
847
- }], messageSelector: [{
848
- type: Input
849
- }], hintSelector: [{
850
- type: Input
851
- }], labelSelector: [{
852
- type: Input
853
- }], autocomplete: [{
854
- type: Input
855
- }], shortcuts: [{
856
- type: Input
857
- }], confirm: [{
858
- type: Input
859
- }], confirmDialog: [{
860
- type: Input
861
- }], confirmDrawer: [{
862
- type: Input
863
- }], confirmBrowser: [{
864
- type: Input
865
- }], confirmTabs: [{
866
- type: Input
867
- }], dirtySubmitButton: [{
868
- type: Input
869
- }], submit: [{
870
- type: Input
871
- }], successDelay: [{
872
- type: Input
873
- }], errorDelay: [{
874
- type: Input
875
- }], tabGroup: [{
876
- type: Input
877
- }], deactivationGuard: [{
878
- type: Input
879
- }], submitEvent: [{
880
- type: Output,
881
- args: ['fsForm']
882
- }], invalid: [{
883
- type: Output
884
- }], valid: [{
885
- type: Output
886
- }], submitted: [{
887
- type: Output
888
- }], reseted: [{
889
- type: Output
890
- }], cleared: [{
891
- type: Output
892
- }], fsFormClass: [{
893
- type: HostBinding,
894
- args: ['class.fs-form']
895
- }], _tabGroups: [{
896
- type: ContentChildren,
897
- 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 }]
898
901
  }] } });
899
902
 
900
- class FsButtonDirective {
901
- constructor(_matButton, _form, _elementRef, _cdRef) {
902
- this._matButton = _matButton;
903
- this._form = _form;
904
- this._elementRef = _elementRef;
905
- this._cdRef = _cdRef;
906
- this.dirtySubmit = true;
907
- this.transitionStyle = null;
908
- this.active = false;
909
- this.submit = false;
910
- this._previousDisabled = false;
911
- this._destroy$ = new Subject();
912
- }
913
- ngOnInit() {
914
- this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
915
- this.form = this.form || this._form;
916
- if (this.form) {
917
- this.form.addButton(this);
918
- if (this.submit) {
919
- fromEvent(this.element, 'click')
920
- .pipe(takeUntil(this._destroy$))
921
- .subscribe(() => {
922
- this.active = true;
923
- });
924
- if (this.dirtySubmit) {
925
- if (this.form.dirtySubmitButton) {
926
- if (!this.form.ngForm.dirty) {
927
- this.disable();
928
- }
929
- }
930
- }
931
- this.transitionStyle = 'none';
932
- setTimeout(() => {
933
- this.transitionStyle = null;
934
- }, 500);
935
- }
936
- }
937
- }
938
- disable() {
939
- if (this._matButton && !this.active) {
940
- this._previousDisabled = this._matButton.disabled;
941
- this._matButton.disabled = true;
942
- this._cdRef.markForCheck();
943
- }
944
- }
945
- enable() {
946
- if (this._matButton) {
947
- this._matButton.disabled = false;
948
- this._matButton.disableRipple = true;
949
- this._cdRef.markForCheck();
950
- }
951
- }
952
- process() {
953
- this.setClass('process');
954
- if (this._matButton) {
955
- this._matButton.disableRipple = true;
956
- }
957
- }
958
- success() {
959
- this.setClass('success');
960
- if (this._matButton) {
961
- this._matButton.disableRipple = false;
962
- }
963
- }
964
- error() {
965
- this.setClass('error');
966
- if (this._matButton) {
967
- this._matButton.disableRipple = false;
968
- }
969
- }
970
- setClass(cls) {
971
- const svg = this._getSvg(cls);
972
- this._resetClass();
973
- this._disableShadowAnimation();
974
- this.element.classList.add(`submit-${cls}`);
975
- this.element.append(svg);
976
- }
977
- get element() {
978
- return this._elementRef.nativeElement;
979
- }
980
- resetActive() {
981
- this.active = false;
982
- }
983
- reset() {
984
- if (!this._previousDisabled) {
985
- this.enable();
986
- }
987
- this.element.querySelectorAll('.svg-icon')
988
- .forEach((el) => {
989
- el.remove();
990
- });
991
- if (this._matButton) {
992
- this._matButton.disableRipple = false;
993
- }
994
- this._resetClass();
995
- }
996
- ngOnDestroy() {
997
- this._destroy$.next();
998
- this._destroy$.complete();
999
- this.form?.removeButton(this);
1000
- }
1001
- _disableShadowAnimation() {
1002
- // .mat-elevation-z2 removes the click shadow animation
1003
- //this.element.classList.add('mat-elevation-z2');
1004
- }
1005
- _resetClass() {
1006
- this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
1007
- }
1008
- _getSvg(type) {
1009
- 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') {
1010
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">
1011
1014
  <g>
1012
1015
  <g class="check">
@@ -1015,1552 +1018,1552 @@ class FsButtonDirective {
1015
1018
  </g>
1016
1019
  </g>
1017
1020
  </g>
1018
- </svg>`, 'text/xml').firstChild;
1019
- }
1020
- if (type === 'process') {
1021
+ </svg>`, 'text/xml').firstChild;
1022
+ }
1023
+ if (type === 'process') {
1021
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">
1022
1025
  <g fill="none" fill-rule="evenodd">
1023
1026
  <g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
1024
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>
1025
1028
  </g>
1026
1029
  </g>
1027
- </svg>`, 'text/xml').firstChild;
1028
- }
1029
- if (type === 'error') {
1030
- 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;
1031
- }
1032
- }
1033
- }
1034
- 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 });
1035
- 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 });
1036
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsButtonDirective, decorators: [{
1037
- type: Directive,
1038
- args: [{
1039
- selector: '[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])',
1040
- }]
1041
- }], ctorParameters: function () { return [{ type: i1$1.MatButton, decorators: [{
1042
- type: Optional
1043
- }, {
1044
- type: Host
1045
- }] }, { type: FsFormDirective, decorators: [{
1046
- type: Optional
1047
- }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { name: [{
1048
- type: Input
1049
- }], dirtySubmit: [{
1050
- type: Input
1051
- }], form: [{
1052
- type: Input
1053
- }], transitionStyle: [{
1054
- type: HostBinding,
1055
- 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']
1056
1059
  }] } });
1057
1060
 
1058
- class FsFormDialogCloseDirective {
1059
- constructor(_form, _dialogRef) {
1060
- this._form = _form;
1061
- this._dialogRef = _dialogRef;
1062
- this.type = 'button';
1063
- this._destroy$ = new Subject();
1064
- }
1065
- closeClick() {
1066
- if (this._form) {
1067
- this._form.triggerConfirm()
1068
- .pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
1069
- .subscribe(() => {
1070
- this._dialogRef.close(this.closeData);
1071
- });
1072
- }
1073
- else {
1074
- this._dialogRef.close(this.closeData);
1075
- }
1076
- }
1077
- ngOnDestroy() {
1078
- this._destroy$.next();
1079
- this._destroy$.complete();
1080
- }
1081
- }
1082
- 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 });
1083
- 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 });
1084
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogCloseDirective, decorators: [{
1085
- type: Directive,
1086
- args: [{
1087
- selector: '[fsFormDialogClose],[fs-form-dialog-close]',
1088
- }]
1089
- }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
1090
- type: Optional
1091
- }] }, { type: i1.MatDialogRef, decorators: [{
1092
- type: Optional
1093
- }] }]; }, propDecorators: { closeData: [{
1094
- type: Input
1095
- }], type: [{
1096
- type: HostBinding,
1097
- args: ['attr.type']
1098
- }], closeClick: [{
1099
- type: HostListener,
1100
- 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']]
1101
1104
  }] } });
1102
1105
 
1103
- class FsFormDialogActionsComponent {
1104
- constructor(_form, _dialogRef, _cdRef) {
1105
- this._form = _form;
1106
- this._dialogRef = _dialogRef;
1107
- this._cdRef = _cdRef;
1108
- this.save = true;
1109
- this.create = false;
1110
- this.close = false;
1111
- this.done = false;
1112
- this.closeData = null;
1113
- this.dirty = false;
1114
- this._destroy$ = new Subject();
1115
- }
1116
- ngOnInit() {
1117
- if (this._form) {
1118
- this._form.ngForm.valueChanges
1119
- .pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
1120
- .subscribe(() => {
1121
- this.dirty = this._form.ngForm.dirty;
1122
- this._cdRef.markForCheck();
1123
- });
1124
- this._form.submitted
1125
- .pipe(delay(50), takeUntil(this._destroy$))
1126
- .subscribe(() => {
1127
- this.dirty = false;
1128
- this._cdRef.markForCheck();
1129
- });
1130
- this._form.reseted
1131
- .pipe(takeUntil(this._destroy$))
1132
- .subscribe(() => {
1133
- this.dirty = false;
1134
- this._cdRef.markForCheck();
1135
- });
1136
- }
1137
- }
1138
- ngOnDestroy() {
1139
- this._destroy$.next();
1140
- this._destroy$.complete();
1141
- }
1142
- }
1143
- 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 });
1144
- 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 });
1145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
1146
- type: Component,
1147
- 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"] }]
1148
- }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
1149
- type: Optional
1150
- }] }, { type: i1.MatDialogRef, decorators: [{
1151
- type: Optional
1152
- }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { save: [{
1153
- type: Input
1154
- }], create: [{
1155
- type: Input
1156
- }], close: [{
1157
- type: Input
1158
- }], done: [{
1159
- type: Input
1160
- }], closeData: [{
1161
- type: Input
1162
- }], name: [{
1163
- 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
1164
1167
  }] } });
1165
1168
 
1166
- class FsFormTemplateComponent {
1167
- constructor() { }
1168
- ngAfterContentInit() {
1169
- debugger;
1170
- const x = this.models;
1171
- this.models.changes.subscribe((x) => {
1172
- debugger;
1173
- });
1174
- }
1175
- ngOnInit() {
1176
- debugger;
1177
- }
1178
- }
1179
- FsFormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1180
- 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 });
1181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateComponent, decorators: [{
1182
- type: Component,
1183
- args: [{ selector: 'fs-form-template', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>" }]
1184
- }], ctorParameters: function () { return []; }, propDecorators: { templateRef: [{
1185
- type: ViewChild,
1186
- args: ['templateRef1']
1187
- }], formTemplate: [{
1188
- type: Input
1189
- }], models: [{
1190
- type: ContentChildren,
1191
- 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 }]
1192
1195
  }] } });
1193
1196
 
1194
- class FsFormTemplateOutletComponent {
1195
- constructor() { }
1196
- ngOnChanges(changes) {
1197
- if (changes.formTemplate?.currentValue) {
1198
- }
1199
- }
1200
- ngAfterContentInit() {
1201
- // const x = this.models;
1202
- // this.models.changes.subscribe((x) => {
1203
- // debugger;
1204
- // });
1205
- }
1206
- }
1207
- FsFormTemplateOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1208
- 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 });
1209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateOutletComponent, decorators: [{
1210
- type: Component,
1211
- 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>" }]
1212
- }], ctorParameters: function () { return []; }, propDecorators: { formTemplate: [{
1213
- type: Input
1214
- }], models: [{
1215
- type: ContentChildren,
1216
- 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 }]
1217
1220
  }] } });
1218
1221
 
1219
- class FsFormTemplateDirective {
1220
- constructor() { }
1221
- ngAfterContentInit() {
1222
- }
1223
- }
1224
- FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1225
- 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 });
1226
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
1227
- type: Directive,
1228
- args: [{
1229
- selector: '[fsFormTemplate]',
1230
- }]
1231
- }], ctorParameters: function () { return []; }, propDecorators: { models: [{
1232
- type: ViewChildren,
1233
- 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]
1234
1237
  }] } });
1235
1238
 
1236
- class FsSubmitButtonDirective extends FsButtonDirective {
1237
- }
1238
- FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1239
- FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
1240
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
1241
- type: Directive,
1242
- args: [{
1243
- selector: 'dummy-selector',
1244
- }]
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
+ }]
1245
1248
  }] });
1246
1249
 
1247
- const ERROR_MESSAGES = {
1248
- required: 'This field is required',
1249
- email: 'This is not a valid email address',
1250
- emails: 'Input valid email addresses, comma separated',
1251
- phone: 'Invalid phone number',
1252
- numeric: 'Value should be numeric',
1253
- integer: 'Value should be an integer',
1254
- min: 'Value should not be less than $(1)',
1255
- max: 'Value should not be greater than $(1)',
1256
- minlength: 'Should not be shorter than $(1) characters',
1257
- maxlength: 'Should not be longer than $(1) characters',
1258
- compare: 'Inputs do not match',
1259
- pattern: 'Value should match pattern $(1)',
1260
- dateRange: 'Invalid date range',
1261
- url: 'This is not a valid url',
1262
- urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
1263
- greater: 'Value must be greater than $(1)',
1264
- lesser: 'Value must be less than $(1)',
1265
- greaterEqual: 'Value must be greater than or equal $(1)',
1266
- 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)',
1267
1270
  };
1268
1271
 
1269
- const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
1270
- const VALIDATE_MESSAGE_PROVIDER = {
1271
- provide: VALIDATE_MESSAGES,
1272
- useFactory: messageProviderFactory,
1273
- };
1274
- function messageProviderFactory() {
1275
- 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 };
1276
1279
  }
1277
1280
 
1278
- class FsControlDirective {
1279
- constructor(_elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
1280
- this._elementRef = _elementRef;
1281
- this.renderer2 = renderer2;
1282
- this.injector = injector;
1283
- this._validateMessages = _validateMessages;
1284
- this.ngControl = ngControl;
1285
- this.formDirective = formDirective;
1286
- this.appendMessageClass = 'fs-form-message';
1287
- this.appendLabelClass = 'fs-form-label';
1288
- this.appendErrorClass = 'fs-form-error';
1289
- this.appendHintClass = 'fs-form-hint';
1290
- this.errors = [];
1291
- this._destroy$ = new Subject();
1292
- if (ngControl) {
1293
- this._control = ngControl.control;
1294
- }
1295
- else {
1296
- console.error('The element does not have a valid ngModel', this._elementRef.nativeElement);
1297
- }
1298
- }
1299
- set validateMessages(messages) {
1300
- this._validateMessages = {
1301
- ...this._validateMessages,
1302
- ...messages,
1303
- };
1304
- }
1305
- ngOnInit() {
1306
- this._setupValidators();
1307
- }
1308
- ngOnDestroy() {
1309
- this._destroy$.next();
1310
- this._destroy$.complete();
1311
- }
1312
- ngAfterContentInit() {
1313
- this._subscribeToStatusChagnes();
1314
- }
1315
- getMessageSelector() {
1316
- if (this.messageSelector === false) {
1317
- return '';
1318
- }
1319
- if (this.messageSelector) {
1320
- return this.messageSelector;
1321
- }
1322
- else if (this.formDirective?.messageSelector) {
1323
- return this.formDirective.messageSelector;
1324
- }
1325
- }
1326
- getHintWrapperSelector() {
1327
- if (this.hintSelector === false) {
1328
- return '';
1329
- }
1330
- if (this.hintSelector) {
1331
- return this.hintSelector;
1332
- }
1333
- else if (this.formDirective?.hintSelector) {
1334
- return this.formDirective.hintSelector;
1335
- }
1336
- }
1337
- getWrapperSelector() {
1338
- if (this.wrapperSelector === false) {
1339
- return '';
1340
- }
1341
- if (this.wrapperSelector) {
1342
- return this.wrapperSelector;
1343
- }
1344
- else if (this.formDirective?.wrapperSelector) {
1345
- return this.formDirective.wrapperSelector;
1346
- }
1347
- }
1348
- getlabelSelector() {
1349
- if (this.labelSelector === false) {
1350
- return '';
1351
- }
1352
- if (this.labelSelector) {
1353
- return this.labelSelector;
1354
- }
1355
- else if (this.formDirective?.labelSelector) {
1356
- return this.formDirective.labelSelector;
1357
- }
1358
- }
1359
- getWrapperElement() {
1360
- const wrapper = this.getWrapper(this._elementRef.nativeElement);
1361
- if (wrapper) {
1362
- return wrapper;
1363
- }
1364
- return this._elementRef.nativeElement;
1365
- }
1366
- /*
1367
- <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.
1368
- <input>
1369
- <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1370
- <div class="fs-form-message"></div>
1371
- <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1372
- </div>
1373
- </mat-form-field>
1374
- */
1375
- render() {
1376
- if (this.ngControl) {
1377
- const renderer = this.renderer2;
1378
- const wrapper = this.getWrapperElement();
1379
- const error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1380
- const shouldErrorBeRendered = this.ngControl.invalid
1381
- && (this.ngControl.dirty || this.formDirective?.ngForm?.submitted);
1382
- if (shouldErrorBeRendered && error) {
1383
- wrapper.classList.add('ng-invalid', 'ng-dirty');
1384
- }
1385
- else {
1386
- wrapper.classList.remove('ng-invalid');
1387
- }
1388
- if (!this.getMessageSelector()) {
1389
- return;
1390
- }
1391
- const messageWrapper = wrapper.querySelector(this.getMessageSelector());
1392
- if (!messageWrapper) {
1393
- return console.warn(`Failed to locate ${this.getMessageSelector()}`, this._elementRef.nativeElement);
1394
- }
1395
- if (this.getlabelSelector()) {
1396
- const labelWrapper = wrapper.querySelector(this.getlabelSelector());
1397
- if (labelWrapper) {
1398
- if (this.appendLabelClass) {
1399
- this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1400
- }
1401
- }
1402
- }
1403
- if (this.appendMessageClass) {
1404
- renderer.addClass(messageWrapper, this.appendMessageClass);
1405
- }
1406
- if (this.getHintWrapperSelector()) {
1407
- const hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1408
- if (hint) {
1409
- renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1410
- if (this.appendHintClass) {
1411
- renderer.addClass(hint, this.appendHintClass);
1412
- }
1413
- }
1414
- }
1415
- let errorWrapper = wrapper.querySelector('.fs-form-error-target');
1416
- if (errorWrapper) {
1417
- errorWrapper.remove();
1418
- }
1419
- if (!shouldErrorBeRendered || !error) {
1420
- return;
1421
- }
1422
- errorWrapper = renderer.createElement('div');
1423
- renderer.addClass(errorWrapper, 'fs-form-error-target');
1424
- renderer.addClass(errorWrapper, this.appendErrorClass);
1425
- renderer.addClass(errorWrapper, `${this.appendErrorClass}-${error.name}`);
1426
- const errorText = renderer.createText(error.message);
1427
- renderer.appendChild(errorWrapper, errorText);
1428
- messageWrapper.appendChild(errorWrapper);
1429
- }
1430
- }
1431
- _subscribeToStatusChagnes() {
1432
- if (this._control) {
1433
- this._control.statusChanges
1434
- .pipe(takeUntil(this._destroy$))
1435
- .subscribe(this.render.bind(this));
1436
- }
1437
- }
1438
- getWrapper(node, count = 0) {
1439
- if (!node || count > 10) {
1440
- return null;
1441
- }
1442
- if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1443
- return node;
1444
- }
1445
- return this.getWrapper(node.parentNode, ++count);
1446
- }
1447
- parseErrorMessage(message, args) {
1448
- values(args)
1449
- .forEach((name) => {
1450
- message = message.replace(/\$\(\d\)/, name);
1451
- });
1452
- return message;
1453
- }
1454
- getError(controlRef) {
1455
- const name = keys(controlRef.control.errors)[0];
1456
- if (!name) {
1457
- return null;
1458
- }
1459
- let message = controlRef.control.errors[name];
1460
- if (this._validateMessages[name]) {
1461
- message = this.parseErrorMessage(this._validateMessages[name], message);
1462
- }
1463
- return { name: name, message: message };
1464
- }
1465
- _setupValidators() {
1466
- const control = this._control;
1467
- if (this.validate) {
1468
- const validators = control.validator
1469
- ? [control.validator, this.validate.bind(this)]
1470
- : this.validate.bind(this);
1471
- control.setValidators(validators);
1472
- }
1473
- if (this.validateAsync) {
1474
- const asyncValidators = control.asyncValidator
1475
- ? [control.asyncValidator, this.validateAsync.bind(this)]
1476
- : this.validateAsync.bind(this);
1477
- control.setAsyncValidators(asyncValidators);
1478
- }
1479
- control.updateValueAndValidity();
1480
- }
1481
- }
1482
- 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 });
1483
- 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: [
1484
- VALIDATE_MESSAGE_PROVIDER,
1485
- ], ngImport: i0 });
1486
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsControlDirective, decorators: [{
1487
- type: Directive,
1488
- args: [{
1489
- selector: '[fsFormControl]',
1490
- providers: [
1491
- VALIDATE_MESSAGE_PROVIDER,
1492
- ],
1493
- }]
1494
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: undefined, decorators: [{
1495
- type: Self
1496
- }, {
1497
- type: Inject,
1498
- args: [VALIDATE_MESSAGES]
1499
- }] }, { type: i1$2.NgControl, decorators: [{
1500
- type: Optional
1501
- }] }, { type: FsFormDirective, decorators: [{
1502
- type: Optional
1503
- }, {
1504
- type: Inject,
1505
- args: [FsFormDirective]
1506
- }] }]; }, propDecorators: { wrapperSelector: [{
1507
- type: Input
1508
- }], messageSelector: [{
1509
- type: Input
1510
- }], hintSelector: [{
1511
- type: Input
1512
- }], labelSelector: [{
1513
- type: Input
1514
- }], appendMessageClass: [{
1515
- type: Input
1516
- }], appendLabelClass: [{
1517
- type: Input
1518
- }], appendErrorClass: [{
1519
- type: Input
1520
- }], appendHintClass: [{
1521
- type: Input
1522
- }], validateMessages: [{
1523
- 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
1524
1527
  }] } });
1525
1528
 
1526
- class FsFormCompareDirective extends FsControlDirective {
1527
- set validationMessage(value) {
1528
- this._validateMessages.compare = value;
1529
- }
1530
- ngOnChanges() {
1531
- this._control.updateValueAndValidity();
1532
- }
1533
- validate(control) {
1534
- if (this.fsFormCompare.value === this._elementRef.nativeElement.value) {
1535
- return null;
1536
- }
1537
- return { compare: true };
1538
- }
1539
- ngAfterViewInit() {
1540
- this.fsFormCompare.addEventListener('keyup', () => {
1541
- this._control.updateValueAndValidity();
1542
- }, false);
1543
- }
1544
- ngOnDestroy() {
1545
- this.fsFormCompare.removeEventListener('keyup', () => {
1546
- this._control.updateValueAndValidity();
1547
- }, false);
1548
- }
1549
- }
1550
- FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1551
- FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
1552
- VALIDATE_MESSAGE_PROVIDER,
1553
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1554
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormCompareDirective, decorators: [{
1555
- type: Directive,
1556
- args: [{
1557
- selector: '[fsFormCompare]',
1558
- providers: [
1559
- VALIDATE_MESSAGE_PROVIDER,
1560
- ],
1561
- }]
1562
- }], propDecorators: { fsFormCompare: [{
1563
- type: Input
1564
- }], validationMessage: [{
1565
- type: Input,
1566
- 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']
1567
1570
  }] } });
1568
1571
 
1569
- class FsValidators {
1570
- static email(control) {
1571
- if (!control.value || email(control.value)) {
1572
- return null;
1573
- }
1574
- return { email: true };
1575
- }
1576
- static emails(control) {
1577
- const model = control.value || '';
1578
- const hasInvalidEmails = model
1579
- .split(',')
1580
- .some((part) => !email(part));
1581
- return hasInvalidEmails ? { email: true } : null;
1582
- }
1583
- static numeric(control) {
1584
- if (isEmpty(control.value) || isNumeric(control.value)) {
1585
- return null;
1586
- }
1587
- return { numeric: true };
1588
- }
1589
- static integer(control) {
1590
- if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1591
- return null;
1592
- }
1593
- return { integer: true };
1594
- }
1595
- static phone(control) {
1596
- if (!control.value || phone(control.value)) {
1597
- return null;
1598
- }
1599
- return { phone: true };
1600
- }
1601
- static url(control, protocolRequired = false) {
1602
- if (!control.value) {
1603
- return null;
1604
- }
1605
- if (!url(control.value)) {
1606
- return { url: true };
1607
- }
1608
- if (protocolRequired) {
1609
- const pattern = new RegExp(/^http(s)?:\/\//gm);
1610
- if (!String(control.value).match(pattern)) {
1611
- return { urlProtocol: true };
1612
- }
1613
- }
1614
- return null;
1615
- }
1616
- static dateRange(control) {
1617
- if (!control.value) {
1618
- return null;
1619
- }
1620
- if (isObject(control.value)) {
1621
- const start = control.value.start;
1622
- const end = control.value.end;
1623
- if ((!start && !end) || (isValid(start) && isValid(end))) {
1624
- return null;
1625
- }
1626
- }
1627
- return { dateRange: true };
1628
- }
1629
- static func(control, formFunction, data) {
1630
- let result;
1631
- let stream$;
1632
- try {
1633
- result = formFunction(control, data);
1634
- }
1635
- catch (err) {
1636
- const error = err instanceof Error ? err.message : err;
1637
- stream$ = throwError(error);
1638
- }
1639
- if (!stream$) {
1640
- if (result instanceof Promise) {
1641
- stream$ = from(result);
1642
- }
1643
- else if (isObservable(result)) {
1644
- stream$ = result;
1645
- }
1646
- else {
1647
- stream$ = of(null);
1648
- }
1649
- }
1650
- return stream$
1651
- .pipe(mapTo(null), catchError((err) => {
1652
- return of({ validationError: err });
1653
- }), take(1));
1654
- }
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
+ }
1655
1658
  }
1656
1659
 
1657
- function isEnabled(value) {
1658
- return value !== 'false' && (value || value === '');
1660
+ function isEnabled(value) {
1661
+ return value !== 'false' && (value || value === '');
1659
1662
  }
1660
1663
 
1661
- class FsFormDateRangeDirective extends FsControlDirective {
1662
- set validationMessage(value) {
1663
- this._validateMessages.dateRange = value;
1664
- }
1665
- ngOnChanges() {
1666
- this._control.updateValueAndValidity();
1667
- }
1668
- validate(control) {
1669
- if (isEnabled(this.fsFormDateRange)) {
1670
- return FsValidators.dateRange(this._control);
1671
- }
1672
- else {
1673
- return null;
1674
- }
1675
- }
1676
- }
1677
- FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1678
- FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
1679
- VALIDATE_MESSAGE_PROVIDER
1680
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1681
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDateRangeDirective, decorators: [{
1682
- type: Directive,
1683
- args: [{
1684
- selector: '[fsFormDateRange]',
1685
- providers: [
1686
- VALIDATE_MESSAGE_PROVIDER
1687
- ],
1688
- }]
1689
- }], propDecorators: { fsFormDateRange: [{
1690
- type: Input
1691
- }], validationMessage: [{
1692
- type: Input,
1693
- 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']
1694
1697
  }] } });
1695
1698
 
1696
- class FsFormEmailDirective extends FsControlDirective {
1697
- set validationMessage(value) {
1698
- this._validateMessages.email = value;
1699
- }
1700
- ngOnChanges() {
1701
- this._control.updateValueAndValidity();
1702
- }
1703
- validate(control) {
1704
- if (isEnabled(this.fsFormEmail)) {
1705
- return FsValidators.email(this._control);
1706
- }
1707
- else {
1708
- return null;
1709
- }
1710
- }
1711
- }
1712
- FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1713
- FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
1714
- VALIDATE_MESSAGE_PROVIDER
1715
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1716
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailDirective, decorators: [{
1717
- type: Directive,
1718
- args: [{
1719
- selector: '[fsFormEmail]',
1720
- providers: [
1721
- VALIDATE_MESSAGE_PROVIDER
1722
- ],
1723
- }]
1724
- }], propDecorators: { fsFormEmail: [{
1725
- type: Input
1726
- }], validationMessage: [{
1727
- type: Input,
1728
- 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']
1729
1732
  }] } });
1730
1733
 
1731
- class FsFormEmailsDirective extends FsControlDirective {
1732
- set validationMessage(value) {
1733
- this._validateMessages.emails = value;
1734
- }
1735
- ngOnChanges() {
1736
- this._control.updateValueAndValidity();
1737
- }
1738
- validate(control) {
1739
- if (isEnabled(this.fsFormEmails)) {
1740
- return FsValidators.emails(this._control);
1741
- }
1742
- else {
1743
- return null;
1744
- }
1745
- }
1746
- }
1747
- FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1748
- FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
1749
- VALIDATE_MESSAGE_PROVIDER
1750
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1751
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailsDirective, decorators: [{
1752
- type: Directive,
1753
- args: [{
1754
- selector: '[fsFormEmails]',
1755
- providers: [
1756
- VALIDATE_MESSAGE_PROVIDER
1757
- ],
1758
- }]
1759
- }], propDecorators: { fsFormEmails: [{
1760
- type: Input
1761
- }], validationMessage: [{
1762
- type: Input,
1763
- 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']
1764
1767
  }] } });
1765
1768
 
1766
- class FsFormFunctionDirective extends FsControlDirective {
1767
- constructor() {
1768
- super(...arguments);
1769
- this.validateOnSubmit = false;
1770
- }
1771
- ngOnChanges() {
1772
- this._control.updateValueAndValidity();
1773
- }
1774
- validateAsync(control) {
1775
- if (this.validateOnSubmit && !this.formDirective.validating) {
1776
- return of(null);
1777
- }
1778
- return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
1779
- }
1780
- }
1781
- FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1782
- FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
1783
- VALIDATE_MESSAGE_PROVIDER,
1784
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1785
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormFunctionDirective, decorators: [{
1786
- type: Directive,
1787
- args: [{
1788
- selector: '[fsFormFunction]',
1789
- providers: [
1790
- VALIDATE_MESSAGE_PROVIDER,
1791
- ],
1792
- }]
1793
- }], propDecorators: { fsFormFunction: [{
1794
- type: Input
1795
- }], fsFormFunctionData: [{
1796
- type: Input
1797
- }], validateOnSubmit: [{
1798
- 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
1799
1802
  }] } });
1800
1803
 
1801
- class FsFormGreaterEqualDirective extends FsControlDirective {
1802
- set validationMessage(value) {
1803
- this._validateMessages.greater = value;
1804
- }
1805
- ngOnChanges() {
1806
- this._control.updateValueAndValidity();
1807
- }
1808
- validate(control) {
1809
- const greater = parseFloat(this.fsFormGreaterEqual);
1810
- const value = parseFloat(this._control.value);
1811
- if (!isNaN(greater) && !isNaN(value) && value < greater) {
1812
- return { greaterEqual: { greater, actual: value } };
1813
- }
1814
- return FsValidators.numeric(this._control);
1815
- }
1816
- }
1817
- FsFormGreaterEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1818
- FsFormGreaterEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormGreaterEqualDirective, selector: "[fsFormGreaterEqual]", inputs: { fsFormGreaterEqual: "fsFormGreaterEqual", validationMessage: ["fsFormGreaterEqualMessage", "validationMessage"] }, providers: [
1819
- VALIDATE_MESSAGE_PROVIDER
1820
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterEqualDirective, decorators: [{
1822
- type: Directive,
1823
- args: [{
1824
- selector: '[fsFormGreaterEqual]',
1825
- providers: [
1826
- VALIDATE_MESSAGE_PROVIDER
1827
- ],
1828
- }]
1829
- }], propDecorators: { fsFormGreaterEqual: [{
1830
- type: Input
1831
- }], validationMessage: [{
1832
- type: Input,
1833
- 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']
1834
1837
  }] } });
1835
1838
 
1836
- class FsFormGreaterDirective extends FsControlDirective {
1837
- set validationMessage(value) {
1838
- this._validateMessages.greater = value;
1839
- }
1840
- ngOnChanges() {
1841
- this._control.updateValueAndValidity();
1842
- }
1843
- validate(control) {
1844
- const greater = parseFloat(this.fsFormGreater);
1845
- const value = parseFloat(this._control.value);
1846
- if (!isNaN(greater) && !isNaN(value) && value <= greater) {
1847
- return { greater: { greater, actual: value } };
1848
- }
1849
- return FsValidators.numeric(this._control);
1850
- }
1851
- }
1852
- FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1853
- FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
1854
- VALIDATE_MESSAGE_PROVIDER
1855
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1856
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterDirective, decorators: [{
1857
- type: Directive,
1858
- args: [{
1859
- selector: '[fsFormGreater]',
1860
- providers: [
1861
- VALIDATE_MESSAGE_PROVIDER
1862
- ],
1863
- }]
1864
- }], propDecorators: { fsFormGreater: [{
1865
- type: Input
1866
- }], validationMessage: [{
1867
- type: Input,
1868
- 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']
1869
1872
  }] } });
1870
1873
 
1871
- class FsFormIntegerDirective extends FsControlDirective {
1872
- set validationMessage(value) {
1873
- this._validateMessages.integer = value;
1874
- }
1875
- ngOnChanges() {
1876
- this._control.updateValueAndValidity();
1877
- }
1878
- validate(control) {
1879
- if (isEnabled(this.fsFormInteger)) {
1880
- return FsValidators.integer(this._control);
1881
- }
1882
- return null;
1883
- }
1884
- }
1885
- FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1886
- FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
1887
- VALIDATE_MESSAGE_PROVIDER,
1888
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1889
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormIntegerDirective, decorators: [{
1890
- type: Directive,
1891
- args: [{
1892
- selector: '[fsFormInteger]',
1893
- providers: [
1894
- VALIDATE_MESSAGE_PROVIDER,
1895
- ],
1896
- }]
1897
- }], propDecorators: { fsFormInteger: [{
1898
- type: Input
1899
- }], validationMessage: [{
1900
- type: Input,
1901
- 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']
1902
1905
  }] } });
1903
1906
 
1904
- class FsFormLesserEqualDirective extends FsControlDirective {
1905
- set validationMessage(value) {
1906
- this._validateMessages.lesser = value;
1907
- }
1908
- ngOnChanges() {
1909
- this._control.updateValueAndValidity();
1910
- }
1911
- validate(control) {
1912
- const lesser = parseFloat(this.fsFormLesserEqual);
1913
- const value = parseFloat(this._control.value);
1914
- if (!isNaN(lesser) && !isNaN(value) && value > lesser) {
1915
- return { lesserEqual: { lesser, actual: value } };
1916
- }
1917
- return FsValidators.numeric(this._control);
1918
- }
1919
- }
1920
- FsFormLesserEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1921
- FsFormLesserEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormLesserEqualDirective, selector: "[fsFormLesserEqual]", inputs: { fsFormLesserEqual: "fsFormLesserEqual", validationMessage: ["fsFormLesserEqualMessage", "validationMessage"] }, providers: [
1922
- VALIDATE_MESSAGE_PROVIDER
1923
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1924
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserEqualDirective, decorators: [{
1925
- type: Directive,
1926
- args: [{
1927
- selector: '[fsFormLesserEqual]',
1928
- providers: [
1929
- VALIDATE_MESSAGE_PROVIDER
1930
- ],
1931
- }]
1932
- }], propDecorators: { fsFormLesserEqual: [{
1933
- type: Input
1934
- }], validationMessage: [{
1935
- type: Input,
1936
- 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']
1937
1940
  }] } });
1938
1941
 
1939
- class FsFormLesserDirective extends FsControlDirective {
1940
- set validationMessage(value) {
1941
- this._validateMessages.lesser = value;
1942
- }
1943
- ngOnChanges() {
1944
- this._control.updateValueAndValidity();
1945
- }
1946
- validate(control) {
1947
- const lesser = parseFloat(this.fsFormLesser);
1948
- const value = parseFloat(this._control.value);
1949
- if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
1950
- return { lesser: { lesser, actual: value } };
1951
- }
1952
- return FsValidators.numeric(this._control);
1953
- }
1954
- }
1955
- FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1956
- FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
1957
- VALIDATE_MESSAGE_PROVIDER
1958
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1959
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserDirective, decorators: [{
1960
- type: Directive,
1961
- args: [{
1962
- selector: '[fsFormLesser]',
1963
- providers: [
1964
- VALIDATE_MESSAGE_PROVIDER
1965
- ],
1966
- }]
1967
- }], propDecorators: { fsFormLesser: [{
1968
- type: Input
1969
- }], validationMessage: [{
1970
- type: Input,
1971
- 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']
1972
1975
  }] } });
1973
1976
 
1974
- class FsFormMaxDirective extends FsControlDirective {
1975
- set validationMessage(value) {
1976
- this._validateMessages.max = value;
1977
- }
1978
- ngOnChanges() {
1979
- this._control.updateValueAndValidity();
1980
- }
1981
- validate(control) {
1982
- return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
1983
- }
1984
- }
1985
- FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1986
- FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
1987
- VALIDATE_MESSAGE_PROVIDER
1988
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1989
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxDirective, decorators: [{
1990
- type: Directive,
1991
- args: [{
1992
- selector: '[fsFormMax]',
1993
- providers: [
1994
- VALIDATE_MESSAGE_PROVIDER
1995
- ],
1996
- }]
1997
- }], propDecorators: { fsFormMax: [{
1998
- type: Input
1999
- }], validationMessage: [{
2000
- type: Input,
2001
- 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']
2002
2005
  }] } });
2003
2006
 
2004
- class FsFormMaxLengthDirective extends FsControlDirective {
2005
- set validationMessage(value) {
2006
- this._validateMessages.maxlength = value;
2007
- }
2008
- ngOnChanges() {
2009
- this._control.updateValueAndValidity();
2010
- }
2011
- validate(control) {
2012
- return Validators.maxLength(this.fsFormMaxLength)(this._control);
2013
- }
2014
- }
2015
- FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2016
- FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
2017
- VALIDATE_MESSAGE_PROVIDER
2018
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2019
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxLengthDirective, decorators: [{
2020
- type: Directive,
2021
- args: [{
2022
- selector: '[fsFormMaxLength]',
2023
- providers: [
2024
- VALIDATE_MESSAGE_PROVIDER
2025
- ],
2026
- }]
2027
- }], propDecorators: { fsFormMaxLength: [{
2028
- type: Input
2029
- }], validationMessage: [{
2030
- type: Input,
2031
- 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']
2032
2035
  }] } });
2033
2036
 
2034
- class FsFormMinDirective extends FsControlDirective {
2035
- set validationMessage(value) {
2036
- this._validateMessages.min = value;
2037
- }
2038
- ngOnChanges() {
2039
- this._control.updateValueAndValidity();
2040
- }
2041
- validate(control) {
2042
- return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
2043
- }
2044
- }
2045
- FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2046
- FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
2047
- VALIDATE_MESSAGE_PROVIDER
2048
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2049
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinDirective, decorators: [{
2050
- type: Directive,
2051
- args: [{
2052
- selector: '[fsFormMin]',
2053
- providers: [
2054
- VALIDATE_MESSAGE_PROVIDER
2055
- ],
2056
- }]
2057
- }], propDecorators: { fsFormMin: [{
2058
- type: Input
2059
- }], validationMessage: [{
2060
- type: Input,
2061
- 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']
2062
2065
  }] } });
2063
2066
 
2064
- class FsFormMinLengthDirective extends FsControlDirective {
2065
- set validationMessage(value) {
2066
- this._validateMessages.minlength = value;
2067
- }
2068
- ngOnChanges() {
2069
- this._control.updateValueAndValidity();
2070
- }
2071
- validate(control) {
2072
- return Validators.minLength(this.fsFormMinLength)(this._control);
2073
- }
2074
- }
2075
- FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2076
- FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
2077
- VALIDATE_MESSAGE_PROVIDER
2078
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2079
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinLengthDirective, decorators: [{
2080
- type: Directive,
2081
- args: [{
2082
- selector: '[fsFormMinLength]',
2083
- providers: [
2084
- VALIDATE_MESSAGE_PROVIDER
2085
- ],
2086
- }]
2087
- }], propDecorators: { fsFormMinLength: [{
2088
- type: Input
2089
- }], validationMessage: [{
2090
- type: Input,
2091
- 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']
2092
2095
  }] } });
2093
2096
 
2094
- /**
2095
- * This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
2096
- *
2097
- * This directive required for automatic validation messages
2098
- */
2099
- class FsFormNoFsValidatorsDirective extends FsControlDirective {
2100
- ngOnChanges() {
2101
- this._control.updateValueAndValidity();
2102
- }
2103
- _subscribeToStatusChagnes() {
2104
- if (!!this._control.validator || !!this._control.asyncValidator) {
2105
- super._subscribeToStatusChagnes();
2106
- }
2107
- }
2108
- }
2109
- FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2110
- 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: [
2111
- VALIDATE_MESSAGE_PROVIDER
2112
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
2114
- type: Directive,
2115
- args: [{
2116
- selector: '[ngModel]' +
2117
- ':not([required])' +
2118
- ':not([fsFormRequired])' +
2119
- ':not([fsFormCompare])' +
2120
- ':not([fsFormDateRange])' +
2121
- ':not([fsFormEmail])' +
2122
- ':not([fsFormEmails])' +
2123
- ':not([fsFormFunction])' +
2124
- ':not([fsFormGreater])' +
2125
- ':not([fsFormGreaterEqual])' +
2126
- ':not([fsFormInteger])' +
2127
- ':not([fsFormLesser])' +
2128
- ':not([fsFormMax])' +
2129
- ':not([fsFormMaxLength])' +
2130
- ':not([fsFormMin])' +
2131
- ':not([fsFormMinLength])' +
2132
- ':not([fsFormNumeric])' +
2133
- ':not([fsFormPattern])' +
2134
- ':not([fsFormPhone])' +
2135
- ':not([fsFormUrl])' +
2136
- ':not([validate])',
2137
- providers: [
2138
- VALIDATE_MESSAGE_PROVIDER
2139
- ],
2140
- }]
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
+ }]
2141
2144
  }] });
2142
2145
 
2143
- class FsFormNumericDirective extends FsControlDirective {
2144
- set validationMessage(value) {
2145
- this._validateMessages.numeric = value;
2146
- }
2147
- ngOnChanges() {
2148
- this._control.updateValueAndValidity();
2149
- }
2150
- validate(control) {
2151
- if (isEnabled(this.fsFormNumeric)) {
2152
- return FsValidators.numeric(this._control);
2153
- }
2154
- else {
2155
- return null;
2156
- }
2157
- }
2158
- }
2159
- FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2160
- FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
2161
- VALIDATE_MESSAGE_PROVIDER
2162
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2163
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNumericDirective, decorators: [{
2164
- type: Directive,
2165
- args: [{
2166
- selector: '[fsFormNumeric]',
2167
- providers: [
2168
- VALIDATE_MESSAGE_PROVIDER
2169
- ],
2170
- }]
2171
- }], propDecorators: { fsFormNumeric: [{
2172
- type: Input
2173
- }], validationMessage: [{
2174
- type: Input,
2175
- 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']
2176
2179
  }] } });
2177
2180
 
2178
- class FsFormPatternDirective extends FsControlDirective {
2179
- set validationMessage(value) {
2180
- this._validateMessages.pattern = value;
2181
- }
2182
- ngOnChanges() {
2183
- this._control.updateValueAndValidity();
2184
- }
2185
- validate(control) {
2186
- return Validators.pattern(this.fsFormPattern)(this._control);
2187
- }
2188
- }
2189
- FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2190
- FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
2191
- VALIDATE_MESSAGE_PROVIDER
2192
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2193
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPatternDirective, decorators: [{
2194
- type: Directive,
2195
- args: [{
2196
- selector: '[fsFormPattern]',
2197
- providers: [
2198
- VALIDATE_MESSAGE_PROVIDER
2199
- ],
2200
- }]
2201
- }], propDecorators: { fsFormPattern: [{
2202
- type: Input
2203
- }], validationMessage: [{
2204
- type: Input,
2205
- 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']
2206
2209
  }] } });
2207
2210
 
2208
- class FsFormPhoneDirective extends FsControlDirective {
2209
- set validationMessage(value) {
2210
- this._validateMessages.phone = value;
2211
- }
2212
- ngOnChanges() {
2213
- this._control.updateValueAndValidity();
2214
- }
2215
- validate(control) {
2216
- if (isEnabled(this.fsFormPhone)) {
2217
- return FsValidators.phone(this._control);
2218
- }
2219
- else {
2220
- return null;
2221
- }
2222
- }
2223
- }
2224
- FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2225
- FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
2226
- VALIDATE_MESSAGE_PROVIDER
2227
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPhoneDirective, decorators: [{
2229
- type: Directive,
2230
- args: [{
2231
- selector: '[fsFormPhone]',
2232
- providers: [
2233
- VALIDATE_MESSAGE_PROVIDER
2234
- ],
2235
- }]
2236
- }], propDecorators: { fsFormPhone: [{
2237
- type: Input
2238
- }], validationMessage: [{
2239
- type: Input,
2240
- 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']
2241
2244
  }] } });
2242
2245
 
2243
- class FsFormRequiredDirective extends FsControlDirective {
2244
- constructor() {
2245
- super(...arguments);
2246
- this.required = false;
2247
- }
2248
- set setFsFormRequired(value) {
2249
- this.required = isEnabled(value);
2250
- }
2251
- set setRequired(value) {
2252
- this.required = isEnabled(value);
2253
- }
2254
- set validationMessage(value) {
2255
- this._validateMessages.required = value;
2256
- }
2257
- ngOnChanges() {
2258
- this._control.updateValueAndValidity();
2259
- }
2260
- validate(control) {
2261
- if (this.required) {
2262
- return Validators.required(this._control);
2263
- }
2264
- return null;
2265
- }
2266
- render() {
2267
- const wrapper = this.getWrapperElement();
2268
- if (wrapper && this.getlabelSelector()) {
2269
- const labelWrapper = wrapper.querySelector(this.getlabelSelector());
2270
- // Adding class fs-form-label-requried adds the * to the label
2271
- if (labelWrapper) {
2272
- if (this.required) {
2273
- this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
2274
- }
2275
- else {
2276
- this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
2277
- }
2278
- }
2279
- }
2280
- super.render();
2281
- }
2282
- }
2283
- FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2284
- 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: [
2285
- VALIDATE_MESSAGE_PROVIDER,
2286
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2287
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormRequiredDirective, decorators: [{
2288
- type: Directive,
2289
- args: [{
2290
- selector: '[fsFormRequired],[ngModel][required]',
2291
- providers: [
2292
- VALIDATE_MESSAGE_PROVIDER,
2293
- ],
2294
- }]
2295
- }], propDecorators: { setFsFormRequired: [{
2296
- type: Input,
2297
- args: ['fsFormRequired']
2298
- }], setRequired: [{
2299
- type: Input,
2300
- args: ['required']
2301
- }], validationMessage: [{
2302
- type: Input,
2303
- 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']
2304
2307
  }] } });
2305
2308
 
2306
- class FsFormUrlDirective extends FsControlDirective {
2307
- constructor() {
2308
- super(...arguments);
2309
- this.fsFormUrlProtocol = true;
2310
- }
2311
- set validationMessage(value) {
2312
- this._validateMessages.url = value;
2313
- }
2314
- ngOnChanges() {
2315
- this._control.updateValueAndValidity();
2316
- }
2317
- validate(control) {
2318
- if (isEnabled(this.fsFormUrl)) {
2319
- return FsValidators.url(this._control, this.fsFormUrlProtocol);
2320
- }
2321
- return null;
2322
- }
2323
- }
2324
- FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2325
- 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: [
2326
- VALIDATE_MESSAGE_PROVIDER,
2327
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2328
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormUrlDirective, decorators: [{
2329
- type: Directive,
2330
- args: [{
2331
- selector: '[fsFormUrl]',
2332
- providers: [
2333
- VALIDATE_MESSAGE_PROVIDER,
2334
- ],
2335
- }]
2336
- }], propDecorators: { fsFormUrl: [{
2337
- type: Input
2338
- }], fsFormUrlProtocol: [{
2339
- type: Input
2340
- }], validationMessage: [{
2341
- type: Input,
2342
- 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']
2343
2346
  }] } });
2344
2347
 
2345
- class FsFormValidateDirective extends FsControlDirective {
2346
- constructor() {
2347
- super(...arguments);
2348
- this.validateOnSubmit = false;
2349
- }
2350
- ngOnChanges() {
2351
- this._control.updateValueAndValidity();
2352
- }
2353
- validateAsync(control) {
2354
- if (this.validateOnSubmit && !this.formDirective.validating) {
2355
- return of(null);
2356
- }
2357
- return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2358
- }
2359
- }
2360
- FsFormValidateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2361
- 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: [
2362
- VALIDATE_MESSAGE_PROVIDER
2363
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
2364
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormValidateDirective, decorators: [{
2365
- type: Directive,
2366
- args: [{
2367
- selector: '[validate]',
2368
- providers: [
2369
- VALIDATE_MESSAGE_PROVIDER
2370
- ],
2371
- }]
2372
- }], propDecorators: { validateFn: [{
2373
- type: Input,
2374
- args: ['validate']
2375
- }], validateFnData: [{
2376
- type: Input,
2377
- args: ['validateData']
2378
- }], validateOnSubmit: [{
2379
- 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
2380
2383
  }] } });
2381
2384
 
2382
- class FsFormModule {
2383
- static forRoot() {
2384
- /**
2385
- * Hack: https://github.com/angular/components/issues/20097
2386
- */
2387
- ErrorStateMatcher.prototype
2388
- .isErrorState = (control, form) => {
2389
- return control?.invalid && control?.touched && control?.dirty;
2390
- };
2391
- return {
2392
- ngModule: FsFormModule,
2393
- };
2394
- }
2395
- }
2396
- FsFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2397
- FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormModule, declarations: [FsFormDirective,
2398
- FsControlDirective,
2399
- FsFormRequiredDirective,
2400
- FsFormMinDirective,
2401
- FsFormMaxDirective,
2402
- FsFormMinLengthDirective,
2403
- FsFormMaxLengthDirective,
2404
- FsFormEmailDirective,
2405
- FsFormEmailsDirective,
2406
- FsFormPhoneDirective,
2407
- FsFormCompareDirective,
2408
- FsFormIntegerDirective,
2409
- FsFormNumericDirective,
2410
- FsFormPatternDirective,
2411
- FsFormFunctionDirective,
2412
- FsFormDateRangeDirective,
2413
- FsFormGreaterDirective,
2414
- FsFormGreaterEqualDirective,
2415
- FsFormLesserDirective,
2416
- FsFormLesserEqualDirective,
2417
- FsFormUrlDirective,
2418
- FsFormDialogCloseDirective,
2419
- FsFormValidateDirective,
2420
- FsFormDialogActionsComponent,
2421
- FsFormNoFsValidatorsDirective,
2422
- FsButtonDirective,
2423
- FsSubmitButtonDirective,
2424
- FsFormTemplateComponent,
2425
- FsFormTemplateDirective,
2426
- FsFormTemplateOutletComponent,
2427
- ConfirmUnsavedComponent], imports: [CommonModule,
2428
- FormsModule,
2429
- MatButtonModule,
2430
- MatDialogModule,
2431
- MatDialogModule,
2432
- FsDialogModule], exports: [FsFormDirective,
2433
- FsControlDirective,
2434
- FsFormRequiredDirective,
2435
- FsFormMinDirective,
2436
- FsFormMaxDirective,
2437
- FsFormMinLengthDirective,
2438
- FsFormMaxLengthDirective,
2439
- FsFormEmailDirective,
2440
- FsFormEmailsDirective,
2441
- FsFormPhoneDirective,
2442
- FsFormCompareDirective,
2443
- FsFormIntegerDirective,
2444
- FsFormNumericDirective,
2445
- FsFormPatternDirective,
2446
- FsFormFunctionDirective,
2447
- FsFormDateRangeDirective,
2448
- FsFormGreaterDirective,
2449
- FsFormGreaterEqualDirective,
2450
- FsFormLesserDirective,
2451
- FsFormLesserEqualDirective,
2452
- FsFormUrlDirective,
2453
- FsFormDialogCloseDirective,
2454
- FsFormValidateDirective,
2455
- FsFormDialogActionsComponent,
2456
- FsFormNoFsValidatorsDirective,
2457
- FsButtonDirective,
2458
- FsSubmitButtonDirective,
2459
- FsFormTemplateComponent,
2460
- FsFormTemplateDirective,
2461
- FsFormTemplateOutletComponent] });
2462
- FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormModule, providers: [
2463
- {
2464
- provide: ErrorStateMatcher,
2465
- useClass: ShowOnDirtyErrorStateMatcher,
2466
- },
2467
- ], imports: [[
2468
- CommonModule,
2469
- FormsModule,
2470
- MatButtonModule,
2471
- MatDialogModule,
2472
- MatDialogModule,
2473
- FsDialogModule,
2474
- ]] });
2475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormModule, decorators: [{
2476
- type: NgModule,
2477
- args: [{
2478
- imports: [
2479
- CommonModule,
2480
- FormsModule,
2481
- MatButtonModule,
2482
- MatDialogModule,
2483
- MatDialogModule,
2484
- FsDialogModule,
2485
- ],
2486
- declarations: [
2487
- FsFormDirective,
2488
- FsControlDirective,
2489
- FsFormRequiredDirective,
2490
- FsFormMinDirective,
2491
- FsFormMaxDirective,
2492
- FsFormMinLengthDirective,
2493
- FsFormMaxLengthDirective,
2494
- FsFormEmailDirective,
2495
- FsFormEmailsDirective,
2496
- FsFormPhoneDirective,
2497
- FsFormCompareDirective,
2498
- FsFormIntegerDirective,
2499
- FsFormNumericDirective,
2500
- FsFormPatternDirective,
2501
- FsFormFunctionDirective,
2502
- FsFormDateRangeDirective,
2503
- FsFormGreaterDirective,
2504
- FsFormGreaterEqualDirective,
2505
- FsFormLesserDirective,
2506
- FsFormLesserEqualDirective,
2507
- FsFormUrlDirective,
2508
- FsFormDialogCloseDirective,
2509
- FsFormValidateDirective,
2510
- FsFormDialogActionsComponent,
2511
- FsFormNoFsValidatorsDirective,
2512
- FsButtonDirective,
2513
- FsSubmitButtonDirective,
2514
- FsFormTemplateComponent,
2515
- FsFormTemplateDirective,
2516
- FsFormTemplateOutletComponent,
2517
- ConfirmUnsavedComponent,
2518
- ],
2519
- exports: [
2520
- FsFormDirective,
2521
- FsControlDirective,
2522
- FsFormRequiredDirective,
2523
- FsFormMinDirective,
2524
- FsFormMaxDirective,
2525
- FsFormMinLengthDirective,
2526
- FsFormMaxLengthDirective,
2527
- FsFormEmailDirective,
2528
- FsFormEmailsDirective,
2529
- FsFormPhoneDirective,
2530
- FsFormCompareDirective,
2531
- FsFormIntegerDirective,
2532
- FsFormNumericDirective,
2533
- FsFormPatternDirective,
2534
- FsFormFunctionDirective,
2535
- FsFormDateRangeDirective,
2536
- FsFormGreaterDirective,
2537
- FsFormGreaterEqualDirective,
2538
- FsFormLesserDirective,
2539
- FsFormLesserEqualDirective,
2540
- FsFormUrlDirective,
2541
- FsFormDialogCloseDirective,
2542
- FsFormValidateDirective,
2543
- FsFormDialogActionsComponent,
2544
- FsFormNoFsValidatorsDirective,
2545
- FsButtonDirective,
2546
- FsSubmitButtonDirective,
2547
- FsFormTemplateComponent,
2548
- FsFormTemplateDirective,
2549
- FsFormTemplateOutletComponent,
2550
- ],
2551
- providers: [
2552
- {
2553
- provide: ErrorStateMatcher,
2554
- useClass: ShowOnDirtyErrorStateMatcher,
2555
- },
2556
- ],
2557
- }]
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
+ }]
2558
2561
  }] });
2559
2562
 
2560
2563
  // Modules
2561
2564
 
2562
- /**
2563
- * Generated bundle index. Do not edit.
2565
+ /**
2566
+ * Generated bundle index. Do not edit.
2564
2567
  */
2565
2568
 
2566
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 };