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