@firestitch/form 14.0.2 → 15.0.0

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