@firestitch/form 14.0.2 → 15.0.0

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 +44 -44
  62. package/esm2020/app/components/confirm-unsaved/index.mjs +1 -1
  63. package/esm2020/app/components/form-dialog-actions/form-dialog-actions.component.mjs +75 -75
  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 +152 -152
  72. package/esm2020/app/directives/form/form.directive.mjs +689 -689
  73. package/esm2020/app/directives/form/index.mjs +1 -1
  74. package/esm2020/app/directives/form-dialog-close.directive.mjs +54 -54
  75. package/esm2020/app/directives/form-template.directive.mjs +20 -20
  76. package/esm2020/app/directives/index.mjs +6 -6
  77. package/esm2020/app/directives/submit-button.directive.mjs +14 -14
  78. package/esm2020/app/directives/validators/compare.directive.mjs +47 -47
  79. package/esm2020/app/directives/validators/control.directive.mjs +258 -258
  80. package/esm2020/app/directives/validators/daterange.directive.mjs +41 -41
  81. package/esm2020/app/directives/validators/email.directive.mjs +41 -41
  82. package/esm2020/app/directives/validators/emails.directive.mjs +41 -41
  83. package/esm2020/app/directives/validators/function.directive.mjs +41 -41
  84. package/esm2020/app/directives/validators/greater-equal.directive.mjs +40 -40
  85. package/esm2020/app/directives/validators/greater.directive.mjs +40 -40
  86. package/esm2020/app/directives/validators/index.mjs +22 -22
  87. package/esm2020/app/directives/validators/integer.directive.mjs +39 -39
  88. package/esm2020/app/directives/validators/lesser-equal.directive.mjs +40 -40
  89. package/esm2020/app/directives/validators/lesser.directive.mjs +40 -40
  90. package/esm2020/app/directives/validators/max.directive.mjs +36 -36
  91. package/esm2020/app/directives/validators/maxlength.directive.mjs +35 -35
  92. package/esm2020/app/directives/validators/min.directive.mjs +36 -36
  93. package/esm2020/app/directives/validators/minlength.directive.mjs +35 -35
  94. package/esm2020/app/directives/validators/no-fs-validators.directive.mjs +53 -53
  95. package/esm2020/app/directives/validators/numeric.directive.mjs +41 -41
  96. package/esm2020/app/directives/validators/pattern.directive.mjs +35 -35
  97. package/esm2020/app/directives/validators/phone.directive.mjs +41 -41
  98. package/esm2020/app/directives/validators/required.directive.mjs +69 -69
  99. package/esm2020/app/directives/validators/url.directive.mjs +45 -45
  100. package/esm2020/app/directives/validators/validate.directive.mjs +43 -43
  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 +209 -209
  105. package/esm2020/app/guards/form-deactivate.guard.mjs +42 -42
  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 +92 -92
  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 +2448 -2448
  124. package/fesm2015/firestitch-form.mjs.map +1 -1
  125. package/fesm2020/firestitch-form.mjs +2434 -2434
  126. package/fesm2020/firestitch-form.mjs.map +1 -1
  127. package/index.d.ts +5 -5
  128. package/package.json +1 -1
  129. package/public_api.d.ts +34 -34
@@ -23,1035 +23,1035 @@ 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: "14.3.0", ngImport: i0, type: ConfirmUnsavedComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
54
- ConfirmUnsavedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.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"], dependencies: [{ kind: "component", 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"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
55
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.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: "15.2.10", ngImport: i0, type: ConfirmUnsavedComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
54
+ ConfirmUnsavedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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"], dependencies: [{ kind: "component", type: i1$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i3.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout", "dock", "dockable", "fullscreenPercent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: "14.3.0", ngImport: i0, type: FsForm, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
171
- FsForm.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsForm, providedIn: 'root' });
172
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.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: "15.2.10", ngImport: i0, type: FsForm, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
171
+ FsForm.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsForm, providedIn: 'root' });
172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: "14.3.0", ngImport: i0, type: FormDeactivateGuard, deps: [{ token: FsForm }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
203
- FormDeactivateGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FormDeactivateGuard, providedIn: 'root' });
204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.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: "15.2.10", ngImport: i0, type: FormDeactivateGuard, deps: [{ token: FsForm }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
203
+ FormDeactivateGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FormDeactivateGuard, providedIn: 'root' });
204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FormDeactivateGuard, decorators: [{
205
+ type: Injectable,
206
+ args: [{
207
+ providedIn: 'root',
208
+ }]
209
209
  }], ctorParameters: function () { return [{ type: FsForm }, { type: i2.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 UntypedFormGroup) {
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 UntypedFormGroup) {
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: "14.3.0", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2$1.FsMessage }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: MatDialogRef, optional: true }, { token: DrawerRef, optional: true }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
825
- FsFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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$1.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.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
+ set submit(submit$) {
237
+ this._submit$ = submit$;
238
+ }
239
+ get submit() {
240
+ return this._submit$;
241
+ }
242
+ constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
243
+ this.ngForm = ngForm;
244
+ this._form = _form;
245
+ this._element = _element;
246
+ this._message = _message;
247
+ this._ngZone = _ngZone;
248
+ this._cdRef = _cdRef;
249
+ this._dialogRef = _dialogRef;
250
+ this._drawerRef = _drawerRef;
251
+ this._route = _route;
252
+ this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
253
+ this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
254
+ this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
255
+ this.labelSelector = '.fs-form-label,.mat-form-field-label';
256
+ this.autocomplete = false;
257
+ this.shortcuts = true; // Ctrl + s
258
+ this.confirm = true;
259
+ this.confirmDialog = true;
260
+ this.confirmDrawer = true;
261
+ this.confirmBrowser = true;
262
+ this.confirmTabs = true;
263
+ this.dirtySubmitButton = true;
264
+ this.successDelay = 0;
265
+ this.errorDelay = 1000;
266
+ this.deactivationGuard = true;
267
+ this.submitEvent = new EventEmitter();
268
+ this.invalid = new EventEmitter();
269
+ this.valid = new EventEmitter();
270
+ this.submitted = new EventEmitter();
271
+ this.reseted = new EventEmitter();
272
+ this.cleared = new EventEmitter();
273
+ this.fsFormClass = true;
274
+ this._tabGroups = new QueryList();
275
+ this._buttons = new QueryList();
276
+ this._dialogBackdropEscape = false;
277
+ this._snapshot = {};
278
+ this._status$ = new BehaviorSubject(FormStatus.Valid);
279
+ this._destroy$ = new Subject();
280
+ this._confirmed = false;
281
+ this._submit$ = null;
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: "15.2.10", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2$1.FsMessage }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: MatDialogRef, optional: true }, { token: DrawerRef, optional: true }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
825
+ FsFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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$1.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.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 }]
898
898
  }] } });
899
899
 
900
- class FsFormDialogCloseDirective {
901
- constructor(_form, _dialogRef) {
902
- this._form = _form;
903
- this._dialogRef = _dialogRef;
904
- this.type = 'button';
905
- this._destroy$ = new Subject();
906
- }
907
- closeClick() {
908
- if (this._form) {
909
- this._form.triggerConfirm()
910
- .pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
911
- .subscribe(() => {
912
- this._dialogRef.close(this.closeData);
913
- });
914
- }
915
- else {
916
- this._dialogRef.close(this.closeData);
917
- }
918
- }
919
- ngOnDestroy() {
920
- this._destroy$.next();
921
- this._destroy$.complete();
922
- }
923
- }
924
- FsFormDialogCloseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDialogCloseDirective, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
925
- FsFormDialogCloseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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 });
926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormDialogCloseDirective, decorators: [{
927
- type: Directive,
928
- args: [{
929
- selector: '[fsFormDialogClose],[fs-form-dialog-close]',
930
- }]
931
- }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
932
- type: Optional
933
- }] }, { type: i1.MatDialogRef, decorators: [{
934
- type: Optional
935
- }] }]; }, propDecorators: { closeData: [{
936
- type: Input
937
- }], type: [{
938
- type: HostBinding,
939
- args: ['attr.type']
940
- }], closeClick: [{
941
- type: HostListener,
942
- args: ['click', ['$event.target']]
900
+ class FsFormDialogCloseDirective {
901
+ constructor(_form, _dialogRef) {
902
+ this._form = _form;
903
+ this._dialogRef = _dialogRef;
904
+ this.type = 'button';
905
+ this._destroy$ = new Subject();
906
+ }
907
+ closeClick() {
908
+ if (this._form) {
909
+ this._form.triggerConfirm()
910
+ .pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
911
+ .subscribe(() => {
912
+ this._dialogRef.close(this.closeData);
913
+ });
914
+ }
915
+ else {
916
+ this._dialogRef.close(this.closeData);
917
+ }
918
+ }
919
+ ngOnDestroy() {
920
+ this._destroy$.next();
921
+ this._destroy$.complete();
922
+ }
923
+ }
924
+ FsFormDialogCloseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsFormDialogCloseDirective, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
925
+ FsFormDialogCloseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: { closeData: "closeData" }, host: { listeners: { "click": "closeClick($event.target)" }, properties: { "attr.type": "this.type" } }, ngImport: i0 });
926
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsFormDialogCloseDirective, decorators: [{
927
+ type: Directive,
928
+ args: [{
929
+ selector: '[fsFormDialogClose],[fs-form-dialog-close]',
930
+ }]
931
+ }], ctorParameters: function () { return [{ type: FsFormDirective, decorators: [{
932
+ type: Optional
933
+ }] }, { type: i1.MatDialogRef, decorators: [{
934
+ type: Optional
935
+ }] }]; }, propDecorators: { closeData: [{
936
+ type: Input
937
+ }], type: [{
938
+ type: HostBinding,
939
+ args: ['attr.type']
940
+ }], closeClick: [{
941
+ type: HostListener,
942
+ args: ['click', ['$event.target']]
943
943
  }] } });
944
944
 
945
- class FsButtonDirective {
946
- constructor(_matButton, _form, _elementRef, _cdRef) {
947
- this._matButton = _matButton;
948
- this._form = _form;
949
- this._elementRef = _elementRef;
950
- this._cdRef = _cdRef;
951
- this.dirtySubmit = true;
952
- this.transitionStyle = null;
953
- this.active = false;
954
- this.submit = false;
955
- this._previousDisabled = false;
956
- this._destroy$ = new Subject();
957
- }
958
- ngOnInit() {
959
- this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
960
- this.form = this.form || this._form;
961
- if (this.form) {
962
- this.form.addButton(this);
963
- if (this.submit) {
964
- fromEvent(this.element, 'click')
965
- .pipe(takeUntil(this._destroy$))
966
- .subscribe(() => {
967
- this.active = true;
968
- });
969
- if (this.dirtySubmit) {
970
- if (this.form.dirtySubmitButton) {
971
- if (!this.form.ngForm.dirty) {
972
- this.disable();
973
- }
974
- }
975
- }
976
- this.transitionStyle = 'none';
977
- setTimeout(() => {
978
- this.transitionStyle = null;
979
- }, 500);
980
- }
981
- }
982
- }
983
- disable() {
984
- if (this._matButton && !this.active) {
985
- this._previousDisabled = this._matButton.disabled;
986
- this._matButton.disabled = true;
987
- this._cdRef.markForCheck();
988
- }
989
- }
990
- enable() {
991
- if (this._matButton) {
992
- this._matButton.disabled = false;
993
- this._matButton.disableRipple = true;
994
- this._cdRef.markForCheck();
995
- }
996
- }
997
- process() {
998
- this.setClass('process');
999
- if (this._matButton) {
1000
- this._matButton.disableRipple = true;
1001
- }
1002
- }
1003
- success() {
1004
- this.setClass('success');
1005
- if (this._matButton) {
1006
- this._matButton.disableRipple = false;
1007
- }
1008
- }
1009
- error() {
1010
- this.setClass('error');
1011
- if (this._matButton) {
1012
- this._matButton.disableRipple = false;
1013
- }
1014
- }
1015
- setClass(cls) {
1016
- const svg = this._getSvg(cls);
1017
- this._resetClass();
1018
- this._disableShadowAnimation();
1019
- this.element.classList.add(`submit-${cls}`);
1020
- this.element.append(svg);
1021
- }
1022
- get element() {
1023
- return this._elementRef.nativeElement;
1024
- }
1025
- resetActive() {
1026
- this.active = false;
1027
- }
1028
- reset() {
1029
- if (!this._previousDisabled) {
1030
- this.enable();
1031
- }
1032
- this.element.querySelectorAll('.svg-icon')
1033
- .forEach((el) => {
1034
- el.remove();
1035
- });
1036
- if (this._matButton) {
1037
- this._matButton.disableRipple = false;
1038
- }
1039
- this._resetClass();
1040
- }
1041
- ngOnDestroy() {
1042
- this._destroy$.next();
1043
- this._destroy$.complete();
1044
- this.form?.removeButton(this);
1045
- }
1046
- _disableShadowAnimation() {
1047
- // .mat-elevation-z2 removes the click shadow animation
1048
- //this.element.classList.add('mat-elevation-z2');
1049
- }
1050
- _resetClass() {
1051
- this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
1052
- }
1053
- _getSvg(type) {
1054
- if (type === 'success') {
945
+ class FsButtonDirective {
946
+ constructor(_matButton, _form, _elementRef, _cdRef) {
947
+ this._matButton = _matButton;
948
+ this._form = _form;
949
+ this._elementRef = _elementRef;
950
+ this._cdRef = _cdRef;
951
+ this.dirtySubmit = true;
952
+ this.transitionStyle = null;
953
+ this.active = false;
954
+ this.submit = false;
955
+ this._previousDisabled = false;
956
+ this._destroy$ = new Subject();
957
+ }
958
+ ngOnInit() {
959
+ this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
960
+ this.form = this.form || this._form;
961
+ if (this.form) {
962
+ this.form.addButton(this);
963
+ if (this.submit) {
964
+ fromEvent(this.element, 'click')
965
+ .pipe(takeUntil(this._destroy$))
966
+ .subscribe(() => {
967
+ this.active = true;
968
+ });
969
+ if (this.dirtySubmit) {
970
+ if (this.form.dirtySubmitButton) {
971
+ if (!this.form.ngForm.dirty) {
972
+ this.disable();
973
+ }
974
+ }
975
+ }
976
+ this.transitionStyle = 'none';
977
+ setTimeout(() => {
978
+ this.transitionStyle = null;
979
+ }, 500);
980
+ }
981
+ }
982
+ }
983
+ disable() {
984
+ if (this._matButton && !this.active) {
985
+ this._previousDisabled = this._matButton.disabled;
986
+ this._matButton.disabled = true;
987
+ this._cdRef.markForCheck();
988
+ }
989
+ }
990
+ enable() {
991
+ if (this._matButton) {
992
+ this._matButton.disabled = false;
993
+ this._matButton.disableRipple = true;
994
+ this._cdRef.markForCheck();
995
+ }
996
+ }
997
+ process() {
998
+ this.setClass('process');
999
+ if (this._matButton) {
1000
+ this._matButton.disableRipple = true;
1001
+ }
1002
+ }
1003
+ success() {
1004
+ this.setClass('success');
1005
+ if (this._matButton) {
1006
+ this._matButton.disableRipple = false;
1007
+ }
1008
+ }
1009
+ error() {
1010
+ this.setClass('error');
1011
+ if (this._matButton) {
1012
+ this._matButton.disableRipple = false;
1013
+ }
1014
+ }
1015
+ setClass(cls) {
1016
+ const svg = this._getSvg(cls);
1017
+ this._resetClass();
1018
+ this._disableShadowAnimation();
1019
+ this.element.classList.add(`submit-${cls}`);
1020
+ this.element.append(svg);
1021
+ }
1022
+ get element() {
1023
+ return this._elementRef.nativeElement;
1024
+ }
1025
+ resetActive() {
1026
+ this.active = false;
1027
+ }
1028
+ reset() {
1029
+ if (!this._previousDisabled) {
1030
+ this.enable();
1031
+ }
1032
+ this.element.querySelectorAll('.svg-icon')
1033
+ .forEach((el) => {
1034
+ el.remove();
1035
+ });
1036
+ if (this._matButton) {
1037
+ this._matButton.disableRipple = false;
1038
+ }
1039
+ this._resetClass();
1040
+ }
1041
+ ngOnDestroy() {
1042
+ this._destroy$.next();
1043
+ this._destroy$.complete();
1044
+ this.form?.removeButton(this);
1045
+ }
1046
+ _disableShadowAnimation() {
1047
+ // .mat-elevation-z2 removes the click shadow animation
1048
+ //this.element.classList.add('mat-elevation-z2');
1049
+ }
1050
+ _resetClass() {
1051
+ this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
1052
+ }
1053
+ _getSvg(type) {
1054
+ if (type === 'success') {
1055
1055
  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">
1056
1056
  <g>
1057
1057
  <g class="check">
@@ -1060,1505 +1060,1505 @@ class FsButtonDirective {
1060
1060
  </g>
1061
1061
  </g>
1062
1062
  </g>
1063
- </svg>`, 'text/xml').firstChild;
1064
- }
1065
- if (type === 'process') {
1063
+ </svg>`, 'text/xml').firstChild;
1064
+ }
1065
+ if (type === 'process') {
1066
1066
  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">
1067
1067
  <g fill="none" fill-rule="evenodd">
1068
1068
  <g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
1069
1069
  <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>
1070
1070
  </g>
1071
1071
  </g>
1072
- </svg>`, 'text/xml').firstChild;
1073
- }
1074
- if (type === 'error') {
1075
- 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;
1076
- }
1077
- }
1078
- }
1079
- FsButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.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 });
1080
- FsButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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 });
1081
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsButtonDirective, decorators: [{
1082
- type: Directive,
1083
- args: [{
1084
- selector: '[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])',
1085
- }]
1086
- }], ctorParameters: function () { return [{ type: i1$1.MatButton, decorators: [{
1087
- type: Optional
1088
- }, {
1089
- type: Host
1090
- }] }, { type: FsFormDirective, decorators: [{
1091
- type: Optional
1092
- }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { name: [{
1093
- type: Input
1094
- }], dirtySubmit: [{
1095
- type: Input
1096
- }], form: [{
1097
- type: Input
1098
- }], transitionStyle: [{
1099
- type: HostBinding,
1100
- args: ['style.transition']
1072
+ </svg>`, 'text/xml').firstChild;
1073
+ }
1074
+ if (type === 'error') {
1075
+ 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;
1076
+ }
1077
+ }
1078
+ }
1079
+ FsButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", 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 });
1080
+ FsButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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 });
1081
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsButtonDirective, decorators: [{
1082
+ type: Directive,
1083
+ args: [{
1084
+ selector: '[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])',
1085
+ }]
1086
+ }], ctorParameters: function () { return [{ type: i1$1.MatButton, decorators: [{
1087
+ type: Optional
1088
+ }, {
1089
+ type: Host
1090
+ }] }, { type: FsFormDirective, decorators: [{
1091
+ type: Optional
1092
+ }] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { name: [{
1093
+ type: Input
1094
+ }], dirtySubmit: [{
1095
+ type: Input
1096
+ }], form: [{
1097
+ type: Input
1098
+ }], transitionStyle: [{
1099
+ type: HostBinding,
1100
+ args: ['style.transition']
1101
1101
  }] } });
1102
1102
 
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: "14.3.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: "14.0.0", version: "14.3.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"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", 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"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: ["closeData"] }, { kind: "directive", 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.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
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: "15.2.10", 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: "14.0.0", version: "15.2.10", 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"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i1$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: ["closeData"] }, { kind: "directive", 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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
1164
1164
  }] } });
1165
1165
 
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: "14.3.0", ngImport: i0, type: FsFormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1180
- FsFormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.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: "14.3.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 }]
1166
+ class FsFormTemplateComponent {
1167
+ ngAfterContentInit() {
1168
+ debugger;
1169
+ const x = this.models;
1170
+ this.models.changes.subscribe((x) => {
1171
+ debugger;
1172
+ });
1173
+ }
1174
+ ngOnInit() {
1175
+ debugger;
1176
+ }
1177
+ constructor() { }
1178
+ }
1179
+ FsFormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsFormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1180
+ FsFormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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 }]
1192
1192
  }] } });
1193
1193
 
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: "14.3.0", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1208
- FsFormTemplateOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.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>", dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3$1.JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.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 }]
1194
+ class FsFormTemplateOutletComponent {
1195
+ ngOnChanges(changes) {
1196
+ if (changes.formTemplate?.currentValue) {
1197
+ }
1198
+ }
1199
+ ngAfterContentInit() {
1200
+ // const x = this.models;
1201
+ // this.models.changes.subscribe((x) => {
1202
+ // debugger;
1203
+ // });
1204
+ }
1205
+ constructor() { }
1206
+ }
1207
+ FsFormTemplateOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1208
+ FsFormTemplateOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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>", dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i3$1.JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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 }]
1217
1217
  }] } });
1218
1218
 
1219
- class FsFormTemplateDirective {
1220
- constructor() { }
1221
- ngAfterContentInit() {
1222
- }
1223
- }
1224
- FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1225
- FsFormTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
1226
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.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]
1219
+ class FsFormTemplateDirective {
1220
+ constructor() { }
1221
+ ngAfterContentInit() {
1222
+ }
1223
+ }
1224
+ FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1225
+ FsFormTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
1226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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]
1234
1234
  }] } });
1235
1235
 
1236
- class FsSubmitButtonDirective extends FsButtonDirective {
1237
- }
1238
- FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1239
- FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
1240
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
1241
- type: Directive,
1242
- args: [{
1243
- selector: 'dummy-selector',
1244
- }]
1236
+ class FsSubmitButtonDirective extends FsButtonDirective {
1237
+ }
1238
+ FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1239
+ FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
1240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
1241
+ type: Directive,
1242
+ args: [{
1243
+ selector: 'dummy-selector',
1244
+ }]
1245
1245
  }] });
1246
1246
 
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)',
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)',
1267
1267
  };
1268
1268
 
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 };
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 };
1276
1276
  }
1277
1277
 
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: "14.3.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: "14.0.0", version: "14.3.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: "14.3.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
1278
+ class FsControlDirective {
1279
+ set validateMessages(messages) {
1280
+ this._validateMessages = {
1281
+ ...this._validateMessages,
1282
+ ...messages,
1283
+ };
1284
+ }
1285
+ constructor(_elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
1286
+ this._elementRef = _elementRef;
1287
+ this.renderer2 = renderer2;
1288
+ this.injector = injector;
1289
+ this._validateMessages = _validateMessages;
1290
+ this.ngControl = ngControl;
1291
+ this.formDirective = formDirective;
1292
+ this.appendMessageClass = 'fs-form-message';
1293
+ this.appendLabelClass = 'fs-form-label';
1294
+ this.appendErrorClass = 'fs-form-error';
1295
+ this.appendHintClass = 'fs-form-hint';
1296
+ this.errors = [];
1297
+ this._destroy$ = new Subject();
1298
+ if (ngControl) {
1299
+ this._control = ngControl.control;
1300
+ }
1301
+ else {
1302
+ console.error('The element does not have a valid ngModel', this._elementRef.nativeElement);
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: "15.2.10", 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: "14.0.0", version: "15.2.10", 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: "15.2.10", 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
1524
1524
  }] } });
1525
1525
 
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: "14.3.0", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1551
- FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1551
+ FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1567
1567
  }] } });
1568
1568
 
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
- }
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
+ }
1655
1655
  }
1656
1656
 
1657
- function isEnabled(value) {
1658
- return value !== 'false' && (value || value === '');
1657
+ function isEnabled(value) {
1658
+ return value !== 'false' && (value || value === '');
1659
1659
  }
1660
1660
 
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: "14.3.0", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1678
- FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1678
+ FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1694
1694
  }] } });
1695
1695
 
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: "14.3.0", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1713
- FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1713
+ FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1729
1729
  }] } });
1730
1730
 
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: "14.3.0", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1748
- FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1748
+ FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1764
1764
  }] } });
1765
1765
 
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: "14.3.0", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1782
- FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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
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: "15.2.10", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1782
+ FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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
1799
1799
  }] } });
1800
1800
 
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: "14.3.0", ngImport: i0, type: FsFormGreaterEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1818
- FsFormGreaterEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormGreaterEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1818
+ FsFormGreaterEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1834
1834
  }] } });
1835
1835
 
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: "14.3.0", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1853
- FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1853
+ FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1869
1869
  }] } });
1870
1870
 
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: "14.3.0", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1886
- FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1886
+ FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1902
1902
  }] } });
1903
1903
 
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: "14.3.0", ngImport: i0, type: FsFormLesserEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1921
- FsFormLesserEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormLesserEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1921
+ FsFormLesserEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1937
1937
  }] } });
1938
1938
 
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: "14.3.0", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1956
- FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1956
+ FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
1972
1972
  }] } });
1973
1973
 
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: "14.3.0", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1986
- FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1986
+ FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2002
2002
  }] } });
2003
2003
 
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: "14.3.0", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2016
- FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2016
+ FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2032
2032
  }] } });
2033
2033
 
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: "14.3.0", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2046
- FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2046
+ FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2062
2062
  }] } });
2063
2063
 
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: "14.3.0", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2076
- FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2076
+ FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2092
2092
  }] } });
2093
2093
 
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: "14.3.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2110
- FsFormNoFsValidatorsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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
- }]
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: "15.2.10", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2110
+ FsFormNoFsValidatorsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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
+ }]
2141
2141
  }] });
2142
2142
 
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: "14.3.0", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2160
- FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2160
+ FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2176
2176
  }] } });
2177
2177
 
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: "14.3.0", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2190
- FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2190
+ FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2206
2206
  }] } });
2207
2207
 
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: "14.3.0", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2225
- FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2225
+ FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2241
2241
  }] } });
2242
2242
 
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: "14.3.0", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2284
- FsFormRequiredDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2284
+ FsFormRequiredDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2304
2304
  }] } });
2305
2305
 
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: "14.3.0", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2325
- FsFormUrlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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']
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: "15.2.10", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2325
+ FsFormUrlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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']
2343
2343
  }] } });
2344
2344
 
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: "14.3.0", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2361
- FsFormValidateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.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: "14.3.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
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: "15.2.10", ngImport: i0, type: FsFormValidateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2361
+ FsFormValidateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", 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
2380
2380
  }] } });
2381
2381
 
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: "14.3.0", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2397
- FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.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: "14.3.0", ngImport: i0, type: FsFormModule, providers: [
2463
- {
2464
- provide: ErrorStateMatcher,
2465
- useClass: ShowOnDirtyErrorStateMatcher,
2466
- },
2467
- ], imports: [CommonModule,
2468
- FormsModule,
2469
- MatButtonModule,
2470
- MatDialogModule,
2471
- MatDialogModule,
2472
- FsDialogModule] });
2473
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FsFormModule, decorators: [{
2474
- type: NgModule,
2475
- args: [{
2476
- imports: [
2477
- CommonModule,
2478
- FormsModule,
2479
- MatButtonModule,
2480
- MatDialogModule,
2481
- MatDialogModule,
2482
- FsDialogModule,
2483
- ],
2484
- declarations: [
2485
- FsFormDirective,
2486
- FsControlDirective,
2487
- FsFormRequiredDirective,
2488
- FsFormMinDirective,
2489
- FsFormMaxDirective,
2490
- FsFormMinLengthDirective,
2491
- FsFormMaxLengthDirective,
2492
- FsFormEmailDirective,
2493
- FsFormEmailsDirective,
2494
- FsFormPhoneDirective,
2495
- FsFormCompareDirective,
2496
- FsFormIntegerDirective,
2497
- FsFormNumericDirective,
2498
- FsFormPatternDirective,
2499
- FsFormFunctionDirective,
2500
- FsFormDateRangeDirective,
2501
- FsFormGreaterDirective,
2502
- FsFormGreaterEqualDirective,
2503
- FsFormLesserDirective,
2504
- FsFormLesserEqualDirective,
2505
- FsFormUrlDirective,
2506
- FsFormDialogCloseDirective,
2507
- FsFormValidateDirective,
2508
- FsFormDialogActionsComponent,
2509
- FsFormNoFsValidatorsDirective,
2510
- FsButtonDirective,
2511
- FsSubmitButtonDirective,
2512
- FsFormTemplateComponent,
2513
- FsFormTemplateDirective,
2514
- FsFormTemplateOutletComponent,
2515
- ConfirmUnsavedComponent,
2516
- ],
2517
- exports: [
2518
- FsFormDirective,
2519
- FsControlDirective,
2520
- FsFormRequiredDirective,
2521
- FsFormMinDirective,
2522
- FsFormMaxDirective,
2523
- FsFormMinLengthDirective,
2524
- FsFormMaxLengthDirective,
2525
- FsFormEmailDirective,
2526
- FsFormEmailsDirective,
2527
- FsFormPhoneDirective,
2528
- FsFormCompareDirective,
2529
- FsFormIntegerDirective,
2530
- FsFormNumericDirective,
2531
- FsFormPatternDirective,
2532
- FsFormFunctionDirective,
2533
- FsFormDateRangeDirective,
2534
- FsFormGreaterDirective,
2535
- FsFormGreaterEqualDirective,
2536
- FsFormLesserDirective,
2537
- FsFormLesserEqualDirective,
2538
- FsFormUrlDirective,
2539
- FsFormDialogCloseDirective,
2540
- FsFormValidateDirective,
2541
- FsFormDialogActionsComponent,
2542
- FsFormNoFsValidatorsDirective,
2543
- FsButtonDirective,
2544
- FsSubmitButtonDirective,
2545
- FsFormTemplateComponent,
2546
- FsFormTemplateDirective,
2547
- FsFormTemplateOutletComponent,
2548
- ],
2549
- providers: [
2550
- {
2551
- provide: ErrorStateMatcher,
2552
- useClass: ShowOnDirtyErrorStateMatcher,
2553
- },
2554
- ],
2555
- }]
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: "15.2.10", ngImport: i0, type: FsFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2397
+ FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", 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: "15.2.10", ngImport: i0, type: FsFormModule, providers: [
2463
+ {
2464
+ provide: ErrorStateMatcher,
2465
+ useClass: ShowOnDirtyErrorStateMatcher,
2466
+ },
2467
+ ], imports: [CommonModule,
2468
+ FormsModule,
2469
+ MatButtonModule,
2470
+ MatDialogModule,
2471
+ MatDialogModule,
2472
+ FsDialogModule] });
2473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FsFormModule, decorators: [{
2474
+ type: NgModule,
2475
+ args: [{
2476
+ imports: [
2477
+ CommonModule,
2478
+ FormsModule,
2479
+ MatButtonModule,
2480
+ MatDialogModule,
2481
+ MatDialogModule,
2482
+ FsDialogModule,
2483
+ ],
2484
+ declarations: [
2485
+ FsFormDirective,
2486
+ FsControlDirective,
2487
+ FsFormRequiredDirective,
2488
+ FsFormMinDirective,
2489
+ FsFormMaxDirective,
2490
+ FsFormMinLengthDirective,
2491
+ FsFormMaxLengthDirective,
2492
+ FsFormEmailDirective,
2493
+ FsFormEmailsDirective,
2494
+ FsFormPhoneDirective,
2495
+ FsFormCompareDirective,
2496
+ FsFormIntegerDirective,
2497
+ FsFormNumericDirective,
2498
+ FsFormPatternDirective,
2499
+ FsFormFunctionDirective,
2500
+ FsFormDateRangeDirective,
2501
+ FsFormGreaterDirective,
2502
+ FsFormGreaterEqualDirective,
2503
+ FsFormLesserDirective,
2504
+ FsFormLesserEqualDirective,
2505
+ FsFormUrlDirective,
2506
+ FsFormDialogCloseDirective,
2507
+ FsFormValidateDirective,
2508
+ FsFormDialogActionsComponent,
2509
+ FsFormNoFsValidatorsDirective,
2510
+ FsButtonDirective,
2511
+ FsSubmitButtonDirective,
2512
+ FsFormTemplateComponent,
2513
+ FsFormTemplateDirective,
2514
+ FsFormTemplateOutletComponent,
2515
+ ConfirmUnsavedComponent,
2516
+ ],
2517
+ exports: [
2518
+ FsFormDirective,
2519
+ FsControlDirective,
2520
+ FsFormRequiredDirective,
2521
+ FsFormMinDirective,
2522
+ FsFormMaxDirective,
2523
+ FsFormMinLengthDirective,
2524
+ FsFormMaxLengthDirective,
2525
+ FsFormEmailDirective,
2526
+ FsFormEmailsDirective,
2527
+ FsFormPhoneDirective,
2528
+ FsFormCompareDirective,
2529
+ FsFormIntegerDirective,
2530
+ FsFormNumericDirective,
2531
+ FsFormPatternDirective,
2532
+ FsFormFunctionDirective,
2533
+ FsFormDateRangeDirective,
2534
+ FsFormGreaterDirective,
2535
+ FsFormGreaterEqualDirective,
2536
+ FsFormLesserDirective,
2537
+ FsFormLesserEqualDirective,
2538
+ FsFormUrlDirective,
2539
+ FsFormDialogCloseDirective,
2540
+ FsFormValidateDirective,
2541
+ FsFormDialogActionsComponent,
2542
+ FsFormNoFsValidatorsDirective,
2543
+ FsButtonDirective,
2544
+ FsSubmitButtonDirective,
2545
+ FsFormTemplateComponent,
2546
+ FsFormTemplateDirective,
2547
+ FsFormTemplateOutletComponent,
2548
+ ],
2549
+ providers: [
2550
+ {
2551
+ provide: ErrorStateMatcher,
2552
+ useClass: ShowOnDirtyErrorStateMatcher,
2553
+ },
2554
+ ],
2555
+ }]
2556
2556
  }] });
2557
2557
 
2558
2558
  // Modules
2559
2559
 
2560
- /**
2561
- * Generated bundle index. Do not edit.
2560
+ /**
2561
+ * Generated bundle index. Do not edit.
2562
2562
  */
2563
2563
 
2564
2564
  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 };