@firestitch/form 13.3.6 → 13.3.9

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