@3kles/kles-material-dynamicforms 1.1.20 → 14.0.1

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 (200) hide show
  1. package/esm2020/3kles-kles-material-dynamicforms.mjs +5 -0
  2. package/esm2020/lib/decorators/component.decorator.mjs +7 -0
  3. package/esm2020/lib/directive/dynamic-component.directive.mjs +44 -0
  4. package/esm2020/lib/directive/dynamic-field.directive.mjs +50 -0
  5. package/esm2020/lib/dynamic-form.component.mjs +247 -0
  6. package/esm2020/lib/enums/type.enum.mjs +19 -0
  7. package/esm2020/lib/fields/array.component.mjs +53 -0
  8. package/esm2020/lib/fields/badge.component.mjs +40 -0
  9. package/esm2020/lib/fields/button-form.component.mjs +44 -0
  10. package/esm2020/lib/fields/button-submit.component.mjs +38 -0
  11. package/esm2020/lib/fields/button-toogle-group.component.mjs +51 -0
  12. package/esm2020/lib/fields/buttonchecker-form.component.mjs +44 -0
  13. package/esm2020/lib/fields/buttonfile-form.component.mjs +42 -0
  14. package/esm2020/lib/fields/checkbox.component.mjs +50 -0
  15. package/esm2020/lib/fields/chip.component.mjs +41 -0
  16. package/esm2020/lib/fields/color.component.mjs +84 -0
  17. package/esm2020/lib/fields/date.component.mjs +52 -0
  18. package/esm2020/lib/fields/field.abstract.mjs +57 -0
  19. package/esm2020/lib/fields/group.component.mjs +46 -0
  20. package/esm2020/lib/fields/icon.component.mjs +28 -0
  21. package/esm2020/lib/fields/input.clearable.component.mjs +112 -0
  22. package/esm2020/lib/fields/input.component.mjs +158 -0
  23. package/esm2020/lib/fields/label.component.mjs +40 -0
  24. package/esm2020/lib/fields/line-break.component.mjs +23 -0
  25. package/esm2020/lib/fields/link.component.mjs +32 -0
  26. package/esm2020/lib/fields/list-field.component.mjs +113 -0
  27. package/esm2020/lib/fields/radio.component.mjs +49 -0
  28. package/esm2020/lib/fields/select.component.mjs +210 -0
  29. package/esm2020/lib/fields/select.search.component.mjs +307 -0
  30. package/esm2020/lib/fields/selection-list.component.mjs +63 -0
  31. package/esm2020/lib/fields/slide-toggle.component.mjs +43 -0
  32. package/esm2020/lib/fields/text.component.mjs +40 -0
  33. package/esm2020/lib/fields/textarea.component.mjs +56 -0
  34. package/esm2020/lib/forms/button-control.component.mjs +115 -0
  35. package/esm2020/lib/forms/buttonchecker-control.component.mjs +85 -0
  36. package/esm2020/lib/forms/buttonfile-control.component.mjs +118 -0
  37. package/esm2020/lib/interfaces/component.interface.mjs +2 -0
  38. package/esm2020/lib/interfaces/field.config.interface.mjs +2 -0
  39. package/esm2020/lib/interfaces/field.interface.mjs +2 -0
  40. package/esm2020/lib/interfaces/validator.interface.mjs +2 -0
  41. package/esm2020/lib/kles-material-dynamicforms.module.mjs +191 -0
  42. package/esm2020/lib/matcher/form-error.matcher.mjs +16 -0
  43. package/esm2020/lib/modules/material.module.mjs +278 -0
  44. package/esm2020/lib/pipe/array.pipe.mjs +22 -0
  45. package/esm2020/lib/pipe/transform.pipe.mjs +27 -0
  46. package/esm2020/lib/validators/autocomplete.validator.mjs +23 -0
  47. package/esm2020/public-api.mjs +58 -0
  48. package/fesm2015/3kles-kles-material-dynamicforms.mjs +2829 -0
  49. package/fesm2015/3kles-kles-material-dynamicforms.mjs.map +1 -0
  50. package/fesm2020/3kles-kles-material-dynamicforms.mjs +2826 -0
  51. package/fesm2020/3kles-kles-material-dynamicforms.mjs.map +1 -0
  52. package/{3kles-kles-material-dynamicforms.d.ts → index.d.ts} +1 -1
  53. package/lib/decorators/component.decorator.d.ts +8 -0
  54. package/lib/directive/dynamic-component.directive.d.ts +5 -3
  55. package/lib/directive/dynamic-field.directive.d.ts +7 -5
  56. package/lib/dynamic-form.component.d.ts +6 -3
  57. package/lib/enums/type.enum.d.ts +4 -1
  58. package/lib/fields/array.component.d.ts +5 -2
  59. package/lib/fields/badge.component.d.ts +3 -0
  60. package/lib/fields/button-form.component.d.ts +3 -0
  61. package/lib/fields/button-submit.component.d.ts +3 -0
  62. package/lib/fields/button-toogle-group.component.d.ts +3 -0
  63. package/lib/fields/buttonchecker-form.component.d.ts +3 -0
  64. package/lib/fields/buttonfile-form.component.d.ts +3 -0
  65. package/lib/fields/checkbox.component.d.ts +4 -1
  66. package/lib/fields/chip.component.d.ts +3 -0
  67. package/lib/fields/color.component.d.ts +3 -0
  68. package/lib/fields/date.component.d.ts +3 -0
  69. package/lib/fields/field.abstract.d.ts +6 -6
  70. package/lib/fields/group.component.d.ts +5 -2
  71. package/lib/fields/icon.component.d.ts +3 -0
  72. package/lib/fields/input.clearable.component.d.ts +3 -0
  73. package/lib/fields/input.component.d.ts +3 -0
  74. package/lib/fields/label.component.d.ts +3 -0
  75. package/lib/fields/line-break.component.d.ts +5 -2
  76. package/lib/fields/link.component.d.ts +3 -0
  77. package/lib/fields/list-field.component.d.ts +7 -5
  78. package/lib/fields/radio.component.d.ts +3 -0
  79. package/lib/fields/select.component.d.ts +5 -3
  80. package/lib/fields/select.search.component.d.ts +6 -3
  81. package/lib/fields/selection-list.component.d.ts +3 -0
  82. package/lib/fields/slide-toggle.component.d.ts +3 -0
  83. package/lib/fields/text.component.d.ts +3 -0
  84. package/lib/fields/textarea.component.d.ts +3 -0
  85. package/lib/forms/button-control.component.d.ts +3 -0
  86. package/lib/forms/buttonchecker-control.component.d.ts +3 -0
  87. package/lib/forms/buttonfile-control.component.d.ts +3 -0
  88. package/lib/interfaces/field.config.interface.d.ts +3 -6
  89. package/lib/interfaces/field.interface.d.ts +2 -2
  90. package/lib/kles-material-dynamicforms.module.d.ts +45 -0
  91. package/lib/matcher/form-error.matcher.d.ts +5 -2
  92. package/lib/modules/material.module.d.ts +40 -0
  93. package/lib/pipe/array.pipe.d.ts +3 -0
  94. package/lib/pipe/transform.pipe.d.ts +3 -0
  95. package/package.json +22 -12
  96. package/public-api.d.ts +2 -1
  97. package/3kles-kles-material-dynamicforms.metadata.json +0 -1
  98. package/bundles/3kles-kles-material-dynamicforms.umd.js +0 -1980
  99. package/bundles/3kles-kles-material-dynamicforms.umd.js.map +0 -1
  100. package/bundles/3kles-kles-material-dynamicforms.umd.min.js +0 -16
  101. package/bundles/3kles-kles-material-dynamicforms.umd.min.js.map +0 -1
  102. package/esm2015/3kles-kles-material-dynamicforms.js +0 -6
  103. package/esm2015/lib/directive/dynamic-component.directive.js +0 -50
  104. package/esm2015/lib/directive/dynamic-field.directive.js +0 -95
  105. package/esm2015/lib/dynamic-form.component.js +0 -260
  106. package/esm2015/lib/enums/type.enum.js +0 -16
  107. package/esm2015/lib/fields/array.component.js +0 -37
  108. package/esm2015/lib/fields/badge.component.js +0 -23
  109. package/esm2015/lib/fields/button-form.component.js +0 -31
  110. package/esm2015/lib/fields/button-submit.component.js +0 -23
  111. package/esm2015/lib/fields/button-toogle-group.component.js +0 -35
  112. package/esm2015/lib/fields/buttonchecker-form.component.js +0 -31
  113. package/esm2015/lib/fields/buttonfile-form.component.js +0 -30
  114. package/esm2015/lib/fields/checkbox.component.js +0 -27
  115. package/esm2015/lib/fields/chip.component.js +0 -26
  116. package/esm2015/lib/fields/color.component.js +0 -61
  117. package/esm2015/lib/fields/date.component.js +0 -31
  118. package/esm2015/lib/fields/field.abstract.js +0 -68
  119. package/esm2015/lib/fields/group.component.js +0 -32
  120. package/esm2015/lib/fields/icon.component.js +0 -21
  121. package/esm2015/lib/fields/input.clearable.component.js +0 -59
  122. package/esm2015/lib/fields/input.component.js +0 -104
  123. package/esm2015/lib/fields/label.component.js +0 -26
  124. package/esm2015/lib/fields/line-break.component.js +0 -22
  125. package/esm2015/lib/fields/link.component.js +0 -23
  126. package/esm2015/lib/fields/list-field.component.js +0 -88
  127. package/esm2015/lib/fields/radio.component.js +0 -30
  128. package/esm2015/lib/fields/select.component.js +0 -127
  129. package/esm2015/lib/fields/select.search.component.js +0 -205
  130. package/esm2015/lib/fields/selection-list.component.js +0 -43
  131. package/esm2015/lib/fields/slide-toggle.component.js +0 -27
  132. package/esm2015/lib/fields/text.component.js +0 -23
  133. package/esm2015/lib/fields/textarea.component.js +0 -35
  134. package/esm2015/lib/forms/button-control.component.js +0 -102
  135. package/esm2015/lib/forms/buttonchecker-control.component.js +0 -53
  136. package/esm2015/lib/forms/buttonfile-control.component.js +0 -103
  137. package/esm2015/lib/interfaces/component.interface.js +0 -1
  138. package/esm2015/lib/interfaces/directive.interface.js +0 -1
  139. package/esm2015/lib/interfaces/field.config.interface.js +0 -1
  140. package/esm2015/lib/interfaces/field.interface.js +0 -1
  141. package/esm2015/lib/interfaces/validator.interface.js +0 -1
  142. package/esm2015/lib/kles-material-dynamicforms.module.js +0 -116
  143. package/esm2015/lib/matcher/form-error.matcher.js +0 -9
  144. package/esm2015/lib/modules/material.module.js +0 -129
  145. package/esm2015/lib/pipe/array.pipe.js +0 -20
  146. package/esm2015/lib/pipe/transform.pipe.js +0 -25
  147. package/esm2015/lib/validators/autocomplete.validator.js +0 -23
  148. package/esm2015/public-api.js +0 -51
  149. package/esm5/3kles-kles-material-dynamicforms.js +0 -6
  150. package/esm5/lib/directive/dynamic-component.directive.js +0 -51
  151. package/esm5/lib/directive/dynamic-field.directive.js +0 -96
  152. package/esm5/lib/dynamic-form.component.js +0 -262
  153. package/esm5/lib/enums/type.enum.js +0 -16
  154. package/esm5/lib/fields/array.component.js +0 -31
  155. package/esm5/lib/fields/badge.component.js +0 -24
  156. package/esm5/lib/fields/button-form.component.js +0 -24
  157. package/esm5/lib/fields/button-submit.component.js +0 -24
  158. package/esm5/lib/fields/button-toogle-group.component.js +0 -31
  159. package/esm5/lib/fields/buttonchecker-form.component.js +0 -24
  160. package/esm5/lib/fields/buttonfile-form.component.js +0 -24
  161. package/esm5/lib/fields/checkbox.component.js +0 -22
  162. package/esm5/lib/fields/chip.component.js +0 -22
  163. package/esm5/lib/fields/color.component.js +0 -49
  164. package/esm5/lib/fields/date.component.js +0 -22
  165. package/esm5/lib/fields/field.abstract.js +0 -70
  166. package/esm5/lib/fields/group.component.js +0 -30
  167. package/esm5/lib/fields/icon.component.js +0 -22
  168. package/esm5/lib/fields/input.clearable.component.js +0 -22
  169. package/esm5/lib/fields/input.component.js +0 -73
  170. package/esm5/lib/fields/label.component.js +0 -25
  171. package/esm5/lib/fields/line-break.component.js +0 -23
  172. package/esm5/lib/fields/link.component.js +0 -24
  173. package/esm5/lib/fields/list-field.component.js +0 -68
  174. package/esm5/lib/fields/radio.component.js +0 -22
  175. package/esm5/lib/fields/select.component.js +0 -59
  176. package/esm5/lib/fields/select.search.component.js +0 -119
  177. package/esm5/lib/fields/selection-list.component.js +0 -32
  178. package/esm5/lib/fields/slide-toggle.component.js +0 -22
  179. package/esm5/lib/fields/text.component.js +0 -24
  180. package/esm5/lib/fields/textarea.component.js +0 -25
  181. package/esm5/lib/forms/button-control.component.js +0 -95
  182. package/esm5/lib/forms/buttonchecker-control.component.js +0 -37
  183. package/esm5/lib/forms/buttonfile-control.component.js +0 -119
  184. package/esm5/lib/interfaces/component.interface.js +0 -1
  185. package/esm5/lib/interfaces/directive.interface.js +0 -1
  186. package/esm5/lib/interfaces/field.config.interface.js +0 -1
  187. package/esm5/lib/interfaces/field.interface.js +0 -1
  188. package/esm5/lib/interfaces/validator.interface.js +0 -1
  189. package/esm5/lib/kles-material-dynamicforms.module.js +0 -119
  190. package/esm5/lib/matcher/form-error.matcher.js +0 -11
  191. package/esm5/lib/modules/material.module.js +0 -132
  192. package/esm5/lib/pipe/array.pipe.js +0 -23
  193. package/esm5/lib/pipe/transform.pipe.js +0 -28
  194. package/esm5/lib/validators/autocomplete.validator.js +0 -23
  195. package/esm5/public-api.js +0 -51
  196. package/fesm2015/3kles-kles-material-dynamicforms.js +0 -2087
  197. package/fesm2015/3kles-kles-material-dynamicforms.js.map +0 -1
  198. package/fesm5/3kles-kles-material-dynamicforms.js +0 -1766
  199. package/fesm5/3kles-kles-material-dynamicforms.js.map +0 -1
  200. package/lib/interfaces/directive.interface.d.ts +0 -3
@@ -0,0 +1,2829 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, Input, EventEmitter, Component, Output, Injectable, NgModule, Pipe, ViewChild, ViewChildren, forwardRef, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i2 from '@angular/forms';
6
+ import { Validators, NG_VALUE_ACCESSOR, UntypedFormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
7
+ import * as i6 from '@angular/material/core';
8
+ import { MatNativeDateModule, MatOption, ErrorStateMatcher } from '@angular/material/core';
9
+ import { MatSliderModule } from '@angular/material/slider';
10
+ import * as i4$1 from '@angular/material/button';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import { MatToolbarModule } from '@angular/material/toolbar';
13
+ import * as i4$2 from '@angular/material/icon';
14
+ import { MatIconModule } from '@angular/material/icon';
15
+ import { MatSidenavModule } from '@angular/material/sidenav';
16
+ import * as i2$1 from '@angular/material/badge';
17
+ import { MatBadgeModule } from '@angular/material/badge';
18
+ import * as i4$4 from '@angular/material/list';
19
+ import { MatListModule } from '@angular/material/list';
20
+ import { MatGridListModule } from '@angular/material/grid-list';
21
+ import * as i4 from '@angular/material/form-field';
22
+ import { MatFormFieldModule } from '@angular/material/form-field';
23
+ import * as i6$1 from '@angular/material/datepicker';
24
+ import { MatDatepickerModule } from '@angular/material/datepicker';
25
+ import * as i5 from '@angular/material/input';
26
+ import { MatInputModule } from '@angular/material/input';
27
+ import * as i5$1 from '@angular/material/select';
28
+ import { MatSelectModule } from '@angular/material/select';
29
+ import * as i5$2 from '@angular/material/radio';
30
+ import { MatRadioModule } from '@angular/material/radio';
31
+ import * as i5$3 from '@angular/material/chips';
32
+ import { MatChipsModule } from '@angular/material/chips';
33
+ import * as i7 from '@angular/material/tooltip';
34
+ import { MatTooltipModule } from '@angular/material/tooltip';
35
+ import { MatTableModule } from '@angular/material/table';
36
+ import { MatPaginatorModule } from '@angular/material/paginator';
37
+ import { MatCardModule } from '@angular/material/card';
38
+ import { MatMenuModule } from '@angular/material/menu';
39
+ import { CdkTableModule } from '@angular/cdk/table';
40
+ import { MatTabsModule } from '@angular/material/tabs';
41
+ import * as i8 from '@angular/material/progress-spinner';
42
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
43
+ import * as i6$2 from '@angular/material/checkbox';
44
+ import { MatCheckboxModule } from '@angular/material/checkbox';
45
+ import { MatDialogModule } from '@angular/material/dialog';
46
+ import * as i9 from '@angular/material/autocomplete';
47
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
48
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
49
+ import { MatSortModule } from '@angular/material/sort';
50
+ import { MatExpansionModule } from '@angular/material/expansion';
51
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
52
+ import { MatTreeModule } from '@angular/material/tree';
53
+ import * as i6$3 from '@angular/material/slide-toggle';
54
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
55
+ import * as i7$2 from 'ngx-color-picker';
56
+ import { ColorPickerModule } from 'ngx-color-picker';
57
+ import * as i8$1 from '@angular/cdk/scrolling';
58
+ import { ScrollingModule, CdkScrollable, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
59
+ import * as i4$5 from '@angular/material/button-toggle';
60
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
61
+ import { FlexLayoutModule } from '@angular/flex-layout';
62
+ import * as i7$1 from '@ngx-translate/core';
63
+ import { TranslateModule } from '@ngx-translate/core';
64
+ import { Subject, Observable, of, ReplaySubject } from 'rxjs';
65
+ import { takeUntil, startWith, switchMap, map, take } from 'rxjs/operators';
66
+ import * as i3 from '@angular/flex-layout/extended';
67
+ import { __decorate, __awaiter } from 'tslib';
68
+ import * as i3$1 from '@angular/flex-layout/flex';
69
+ import * as i4$3 from '@angular/cdk/text-field';
70
+ import * as i10 from 'ngx-mat-select-search';
71
+ import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
72
+
73
+ var EnumType;
74
+ (function (EnumType) {
75
+ EnumType["input"] = "input";
76
+ EnumType["select"] = "select";
77
+ EnumType["text"] = "text";
78
+ EnumType["button"] = "button";
79
+ EnumType["checkbox"] = "checkbox";
80
+ EnumType["number"] = "number";
81
+ EnumType["time"] = "time";
82
+ EnumType["date"] = "date";
83
+ EnumType["color"] = "color";
84
+ EnumType["list"] = "list";
85
+ EnumType["multi"] = "multi";
86
+ EnumType["array"] = "array";
87
+ EnumType["group"] = "group";
88
+ EnumType["lineBreak"] = "lineBreak";
89
+ EnumType["badge"] = "badge";
90
+ })(EnumType || (EnumType = {}));
91
+
92
+ const componentMapper = [];
93
+ function FieldMapper(config) {
94
+ return (target) => {
95
+ componentMapper.push({ component: target, type: config.type });
96
+ };
97
+ }
98
+
99
+ class KlesDynamicFieldDirective {
100
+ constructor(container) {
101
+ this.container = container;
102
+ }
103
+ ngOnDestroy() {
104
+ if (this.componentRef) {
105
+ this.componentRef.destroy();
106
+ }
107
+ }
108
+ ngOnInit() {
109
+ this.buildComponent();
110
+ }
111
+ ngOnChanges(changes) {
112
+ if (changes.group) {
113
+ this.group = changes.group.currentValue;
114
+ }
115
+ if (changes.field) {
116
+ this.field = changes.field.currentValue;
117
+ this.buildComponent();
118
+ }
119
+ }
120
+ buildComponent() {
121
+ var _a;
122
+ if (this.componentRef) {
123
+ this.componentRef.destroy();
124
+ }
125
+ this.componentRef = this.container.createComponent(this.field.component
126
+ || ((_a = componentMapper.find(element => element.type === this.field.type)) === null || _a === void 0 ? void 0 : _a.component));
127
+ this.componentRef.instance.field = this.field;
128
+ this.componentRef.instance.group = this.group;
129
+ this.componentRef.instance.siblingFields = this.siblingFields;
130
+ }
131
+ }
132
+ KlesDynamicFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesDynamicFieldDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
133
+ KlesDynamicFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: { field: "field", group: "group", siblingFields: "siblingFields" }, usesOnChanges: true, ngImport: i0 });
134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesDynamicFieldDirective, decorators: [{
135
+ type: Directive,
136
+ args: [{
137
+ selector: '[klesDynamicField]'
138
+ }]
139
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { field: [{
140
+ type: Input
141
+ }], group: [{
142
+ type: Input
143
+ }], siblingFields: [{
144
+ type: Input
145
+ }] } });
146
+
147
+ class KlesDynamicFormComponent {
148
+ constructor(fb) {
149
+ this.fb = fb;
150
+ this.fields = [];
151
+ this.validators = [];
152
+ this.asyncValidators = [];
153
+ // tslint:disable-next-line: no-output-native
154
+ this.submit = new EventEmitter();
155
+ this._onLoaded = new EventEmitter();
156
+ this.direction = 'column';
157
+ this.orientationClass = 'dynamic-form-column';
158
+ this.orientationItemClass = 'dynamic-form-column-item';
159
+ }
160
+ get value() {
161
+ return this.form.value;
162
+ }
163
+ ngOnInit() {
164
+ this.form = this.createForm();
165
+ this.orientationClass = this.direction === 'row' ? 'dynamic-form-row' : 'dynamic-form-column';
166
+ this.orientationItemClass = this.direction === 'row' ? 'dynamic-form-row-item' : 'dynamic-form-column-item';
167
+ this._onLoaded.emit();
168
+ }
169
+ ngOnChanges(changes) {
170
+ var _a, _b, _c, _d;
171
+ if (!((_a = changes.fields) === null || _a === void 0 ? void 0 : _a.firstChange)) {
172
+ this.updateForm();
173
+ // this.form = this.createControl();
174
+ // this.form.controls = {};
175
+ this._onLoaded.emit();
176
+ }
177
+ if (!((_b = changes.validators) === null || _b === void 0 ? void 0 : _b.firstChange) && this.form) {
178
+ this.form.setValidators(this.validators.map(v => v.validator));
179
+ }
180
+ if (!((_c = changes.asyncValidators) === null || _c === void 0 ? void 0 : _c.firstChange) && this.form) {
181
+ this.form.setAsyncValidators(this.asyncValidators.map(v => v.validator));
182
+ }
183
+ if (!((_d = changes.direction) === null || _d === void 0 ? void 0 : _d.firstChange)) {
184
+ this.orientationClass = this.direction === 'row' ? 'dynamic-form-row' : 'dynamic-form-column';
185
+ this.orientationItemClass = this.direction === 'row' ? 'dynamic-form-row-item' : 'dynamic-form-column-item';
186
+ }
187
+ }
188
+ onSubmit(event) {
189
+ event.preventDefault();
190
+ event.stopPropagation();
191
+ if (this.form.valid) {
192
+ this.submit.emit(this.form.value);
193
+ }
194
+ else {
195
+ this.validateAllFormFields(this.form);
196
+ }
197
+ }
198
+ reset() {
199
+ this.form.reset();
200
+ }
201
+ updateForm() {
202
+ Object.keys(this.form.controls).filter(key => {
203
+ return !this.fields.map(field => field.name).includes(key);
204
+ }).forEach(key => {
205
+ this.form.removeControl(key);
206
+ });
207
+ this.fields
208
+ .filter(field => !this.form.controls[field.name])
209
+ .forEach(field => {
210
+ if (field.type === EnumType.lineBreak) {
211
+ return;
212
+ }
213
+ const control = this.createControl(field);
214
+ this.form.addControl(field.name, control);
215
+ });
216
+ }
217
+ createControl(field) {
218
+ if (field.type === EnumType.array) {
219
+ const array = this.fb.array([]);
220
+ if (field.value && Array.isArray(field.value)) {
221
+ if (field.collections && Array.isArray(field.collections)) {
222
+ field.value.forEach(val => {
223
+ const group = this.fb.group({});
224
+ field.collections.forEach(subfield => {
225
+ const data = val[subfield.name] || null;
226
+ const control = this.createControl(Object.assign(Object.assign({}, subfield), (data && { value: data })));
227
+ group.addControl(subfield.name, control);
228
+ });
229
+ array.push(group);
230
+ });
231
+ }
232
+ }
233
+ else {
234
+ const group = this.fb.group({});
235
+ field.collections.forEach(subfield => {
236
+ const control = this.createControl(Object.assign({}, subfield));
237
+ group.addControl(subfield.name, control);
238
+ });
239
+ array.push(group);
240
+ }
241
+ // field.value.forEach((data: any) => {
242
+ // const subGroup = this.fb.group({});
243
+ // field.collections.forEach(subfield => {
244
+ // const control = this.createControl(subfield);
245
+ // subGroup.addControl(subfield.name, control);
246
+ // });
247
+ // array.push(subGroup);
248
+ // });
249
+ return array;
250
+ }
251
+ else if (field.type === EnumType.group) {
252
+ const subGroup = this.fb.group({});
253
+ if (field.collections && Array.isArray(field.collections)) {
254
+ field.collections.forEach(subfield => {
255
+ const control = this.createControl(subfield);
256
+ subGroup.addControl(subfield.name, control);
257
+ });
258
+ }
259
+ return subGroup;
260
+ }
261
+ else {
262
+ const control = this.fb.control(field.value, {
263
+ validators: this.bindValidations(field.validations || []),
264
+ asyncValidators: this.bindAsyncValidations(field.asyncValidations || []),
265
+ updateOn: field.updateOn || 'change'
266
+ });
267
+ if (field.disabled) {
268
+ control.disable();
269
+ }
270
+ return control;
271
+ }
272
+ }
273
+ // private createControl(field: IKlesFieldConfig): AbstractControl {
274
+ // if (field.type === 'listField') {
275
+ // const array = this.fb.array([]);
276
+ // field.value.forEach((data: any) => {
277
+ // const subGroup = this.fb.group({});
278
+ // field.collections.forEach(subfield => {
279
+ // const control = this.fb.control(
280
+ // data[subfield.name] ? data[subfield.name] : null,
281
+ // this.bindValidations(subfield.validations || []),
282
+ // this.bindAsyncValidations(subfield.asyncValidations || [])
283
+ // );
284
+ // subGroup.addControl(subfield.name, control);
285
+ // });
286
+ // array.push(subGroup);
287
+ // });
288
+ // return array;
289
+ // } else if (field.type === 'group') {
290
+ // const subGroup = this.fb.group({});
291
+ // if (field.collections && Array.isArray(field.collections)) {
292
+ // field.collections.forEach(subfield => {
293
+ // const control = this.fb.control(
294
+ // subfield.value,
295
+ // this.bindValidations(subfield.validations || []),
296
+ // this.bindAsyncValidations(subfield.asyncValidations || [])
297
+ // );
298
+ // if (subfield.disabled) {
299
+ // control.disable();
300
+ // }
301
+ // subGroup.addControl(subfield.name, control);
302
+ // });
303
+ // }
304
+ // return subGroup;
305
+ // } else {
306
+ // const control = this.fb.control(
307
+ // field.value,
308
+ // this.bindValidations(field.validations || []),
309
+ // this.bindAsyncValidations(field.asyncValidations || [])
310
+ // );
311
+ // if (field.disabled) {
312
+ // control.disable();
313
+ // }
314
+ // return control;
315
+ // }
316
+ // }
317
+ createForm() {
318
+ const group = this.fb.group({});
319
+ this.fields.forEach(field => {
320
+ if (field.type === EnumType.lineBreak) {
321
+ return;
322
+ }
323
+ const control = this.createControl(field);
324
+ group.addControl(field.name, control);
325
+ });
326
+ group.setValidators(this.validators.map(v => v.validator));
327
+ group.setAsyncValidators(this.asyncValidators.map(v => v.validator));
328
+ return group;
329
+ }
330
+ bindValidations(validations) {
331
+ if (validations.length > 0) {
332
+ const validList = [];
333
+ validations.forEach(valid => {
334
+ validList.push(valid.validator);
335
+ });
336
+ return Validators.compose(validList);
337
+ }
338
+ return null;
339
+ }
340
+ bindAsyncValidations(validations) {
341
+ if (validations.length > 0) {
342
+ const validList = [];
343
+ validations.forEach(valid => {
344
+ validList.push(valid.validator);
345
+ });
346
+ return Validators.composeAsync(validList);
347
+ }
348
+ return null;
349
+ }
350
+ validateAllFormFields(formGroup) {
351
+ Object.keys(formGroup.controls).forEach(field => {
352
+ const control = formGroup.get(field);
353
+ control.markAsTouched({ onlySelf: true });
354
+ });
355
+ }
356
+ }
357
+ KlesDynamicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesDynamicFormComponent, deps: [{ token: i2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component });
358
+ KlesDynamicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesDynamicFormComponent, selector: "app-kles-dynamic-form", inputs: { fields: "fields", validators: "validators", asyncValidators: "asyncValidators", direction: "direction" }, outputs: { submit: "submit", _onLoaded: "_onLoaded" }, exportAs: ["klesDynamicForm"], usesOnChanges: true, ngImport: i0, template: `
359
+ <form class="{{orientationClass}}" [formGroup]="form" (submit)="onSubmit($event)">
360
+ <ng-container *ngFor="let field of fields;" class="{{orientationItemClass}}" klesDynamicField [field]="field" [group]="form" [siblingFields]="fields">
361
+ </ng-container>
362
+ <!--<button (click)="reset()" mat-raised-button color="primary">RESET</button>-->
363
+ </form>
364
+ `, isInline: true, styles: [".dynamic-form-column{display:flex;flex-direction:column}\n", ".dynamic-form-column>*{width:100%}\n", ".dynamic-form-row{display:inline-flex;flex-wrap:wrap;gap:10px}\n", ".dynamic-form-row>*{width:100%}\n", ".dynamic-form-row-item{margin-right:10px}\n", ".dynamic-form-column-item{margin-bottom:10px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: ["field", "group", "siblingFields"] }] });
365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesDynamicFormComponent, decorators: [{
366
+ type: Component,
367
+ args: [{ exportAs: 'klesDynamicForm', selector: 'app-kles-dynamic-form', template: `
368
+ <form class="{{orientationClass}}" [formGroup]="form" (submit)="onSubmit($event)">
369
+ <ng-container *ngFor="let field of fields;" class="{{orientationItemClass}}" klesDynamicField [field]="field" [group]="form" [siblingFields]="fields">
370
+ </ng-container>
371
+ <!--<button (click)="reset()" mat-raised-button color="primary">RESET</button>-->
372
+ </form>
373
+ `, styles: [".dynamic-form-column{display:flex;flex-direction:column}\n", ".dynamic-form-column>*{width:100%}\n", ".dynamic-form-row{display:inline-flex;flex-wrap:wrap;gap:10px}\n", ".dynamic-form-row>*{width:100%}\n", ".dynamic-form-row-item{margin-right:10px}\n", ".dynamic-form-column-item{margin-bottom:10px}\n"] }]
374
+ }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }]; }, propDecorators: { fields: [{
375
+ type: Input
376
+ }], validators: [{
377
+ type: Input
378
+ }], asyncValidators: [{
379
+ type: Input
380
+ }], submit: [{
381
+ type: Output
382
+ }], _onLoaded: [{
383
+ type: Output
384
+ }], direction: [{
385
+ type: Input
386
+ }] } });
387
+
388
+ class KlesComponentDirective {
389
+ constructor(container) {
390
+ this.container = container;
391
+ }
392
+ ngOnInit() {
393
+ this.buildComponent();
394
+ }
395
+ ngOnChanges(changes) {
396
+ if (changes.component && !changes.component.isFirstChange()) {
397
+ this.component = changes.component.currentValue;
398
+ this.buildComponent();
399
+ }
400
+ if (changes.value && !changes.value.isFirstChange()) {
401
+ this.value = changes.value.currentValue;
402
+ this.componentRef.instance.value = this.value;
403
+ }
404
+ }
405
+ buildComponent() {
406
+ if (this.componentRef) {
407
+ this.componentRef.destroy();
408
+ }
409
+ this.componentRef = this.container.createComponent(this.component);
410
+ this.componentRef.instance.component = this.component;
411
+ this.componentRef.instance.value = this.value;
412
+ this.componentRef.instance.field = this.field;
413
+ }
414
+ }
415
+ KlesComponentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
416
+ KlesComponentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: KlesComponentDirective, selector: "[klesComponent]", inputs: { component: "component", value: "value", field: "field" }, usesOnChanges: true, ngImport: i0 });
417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesComponentDirective, decorators: [{
418
+ type: Directive,
419
+ args: [{
420
+ selector: '[klesComponent]'
421
+ }]
422
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { component: [{
423
+ type: Input
424
+ }], value: [{
425
+ type: Input
426
+ }], field: [{
427
+ type: Input
428
+ }] } });
429
+
430
+ class KlesFormErrorStateMatcher {
431
+ constructor() {
432
+ }
433
+ isErrorState(control, form) {
434
+ const isSubmitted = form && form.submitted;
435
+ return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
436
+ }
437
+ }
438
+ KlesFormErrorStateMatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormErrorStateMatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
439
+ KlesFormErrorStateMatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormErrorStateMatcher });
440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormErrorStateMatcher, decorators: [{
441
+ type: Injectable
442
+ }], ctorParameters: function () { return []; } });
443
+
444
+ class MaterialModule {
445
+ }
446
+ MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
447
+ MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: MaterialModule, imports: [CommonModule,
448
+ MatSliderModule,
449
+ MatButtonModule,
450
+ MatToolbarModule,
451
+ MatIconModule,
452
+ MatSidenavModule,
453
+ MatBadgeModule,
454
+ MatListModule,
455
+ MatGridListModule,
456
+ MatFormFieldModule,
457
+ MatInputModule,
458
+ MatSelectModule,
459
+ MatRadioModule,
460
+ MatDatepickerModule,
461
+ MatChipsModule,
462
+ MatTooltipModule,
463
+ MatTableModule,
464
+ MatPaginatorModule,
465
+ MatCardModule,
466
+ MatMenuModule,
467
+ MatTabsModule,
468
+ CdkTableModule,
469
+ MatProgressSpinnerModule,
470
+ MatCheckboxModule,
471
+ MatDialogModule,
472
+ MatAutocompleteModule,
473
+ MatProgressBarModule,
474
+ MatSortModule,
475
+ MatExpansionModule,
476
+ MatNativeDateModule,
477
+ MatSnackBarModule,
478
+ MatTreeModule,
479
+ MatSliderModule,
480
+ MatButtonModule,
481
+ MatSlideToggleModule,
482
+ ColorPickerModule,
483
+ MatButtonToggleModule], exports: [MatButtonModule,
484
+ MatToolbarModule,
485
+ MatIconModule,
486
+ MatSidenavModule,
487
+ MatBadgeModule,
488
+ MatListModule,
489
+ MatGridListModule,
490
+ MatInputModule,
491
+ MatFormFieldModule,
492
+ MatSelectModule,
493
+ MatRadioModule,
494
+ MatDatepickerModule,
495
+ MatChipsModule,
496
+ MatTooltipModule,
497
+ MatTableModule,
498
+ MatPaginatorModule,
499
+ MatCardModule,
500
+ MatMenuModule,
501
+ MatTabsModule,
502
+ CdkTableModule,
503
+ MatProgressSpinnerModule,
504
+ MatCheckboxModule,
505
+ MatDialogModule,
506
+ MatAutocompleteModule,
507
+ MatProgressBarModule,
508
+ MatSortModule,
509
+ MatExpansionModule,
510
+ MatNativeDateModule,
511
+ MatSnackBarModule,
512
+ MatTreeModule,
513
+ MatSliderModule,
514
+ MatButtonModule,
515
+ MatSlideToggleModule,
516
+ ColorPickerModule,
517
+ ScrollingModule,
518
+ CdkScrollable,
519
+ MatButtonToggleModule] });
520
+ MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: MaterialModule, providers: [
521
+ MatDatepickerModule,
522
+ MatDialogModule
523
+ ], imports: [CommonModule,
524
+ MatSliderModule,
525
+ MatButtonModule,
526
+ MatToolbarModule,
527
+ MatIconModule,
528
+ MatSidenavModule,
529
+ MatBadgeModule,
530
+ MatListModule,
531
+ MatGridListModule,
532
+ MatFormFieldModule,
533
+ MatInputModule,
534
+ MatSelectModule,
535
+ MatRadioModule,
536
+ MatDatepickerModule,
537
+ MatChipsModule,
538
+ MatTooltipModule,
539
+ MatTableModule,
540
+ MatPaginatorModule,
541
+ MatCardModule,
542
+ MatMenuModule,
543
+ MatTabsModule,
544
+ CdkTableModule,
545
+ MatProgressSpinnerModule,
546
+ MatCheckboxModule,
547
+ MatDialogModule,
548
+ MatAutocompleteModule,
549
+ MatProgressBarModule,
550
+ MatSortModule,
551
+ MatExpansionModule,
552
+ MatNativeDateModule,
553
+ MatSnackBarModule,
554
+ MatTreeModule,
555
+ MatSliderModule,
556
+ MatButtonModule,
557
+ MatSlideToggleModule,
558
+ ColorPickerModule,
559
+ MatButtonToggleModule, MatButtonModule,
560
+ MatToolbarModule,
561
+ MatIconModule,
562
+ MatSidenavModule,
563
+ MatBadgeModule,
564
+ MatListModule,
565
+ MatGridListModule,
566
+ MatInputModule,
567
+ MatFormFieldModule,
568
+ MatSelectModule,
569
+ MatRadioModule,
570
+ MatDatepickerModule,
571
+ MatChipsModule,
572
+ MatTooltipModule,
573
+ MatTableModule,
574
+ MatPaginatorModule,
575
+ MatCardModule,
576
+ MatMenuModule,
577
+ MatTabsModule,
578
+ CdkTableModule,
579
+ MatProgressSpinnerModule,
580
+ MatCheckboxModule,
581
+ MatDialogModule,
582
+ MatAutocompleteModule,
583
+ MatProgressBarModule,
584
+ MatSortModule,
585
+ MatExpansionModule,
586
+ MatNativeDateModule,
587
+ MatSnackBarModule,
588
+ MatTreeModule,
589
+ MatSliderModule,
590
+ MatButtonModule,
591
+ MatSlideToggleModule,
592
+ ColorPickerModule,
593
+ ScrollingModule,
594
+ MatButtonToggleModule] });
595
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: MaterialModule, decorators: [{
596
+ type: NgModule,
597
+ args: [{
598
+ imports: [
599
+ CommonModule,
600
+ MatSliderModule,
601
+ MatButtonModule,
602
+ MatToolbarModule,
603
+ MatIconModule,
604
+ MatSidenavModule,
605
+ MatBadgeModule,
606
+ MatListModule,
607
+ MatGridListModule,
608
+ MatFormFieldModule,
609
+ MatInputModule,
610
+ MatSelectModule,
611
+ MatRadioModule,
612
+ MatDatepickerModule,
613
+ MatChipsModule,
614
+ MatTooltipModule,
615
+ MatTableModule,
616
+ MatPaginatorModule,
617
+ MatCardModule,
618
+ MatMenuModule,
619
+ MatTabsModule,
620
+ CdkTableModule,
621
+ MatProgressSpinnerModule,
622
+ MatCheckboxModule,
623
+ MatDialogModule,
624
+ MatAutocompleteModule,
625
+ MatProgressBarModule,
626
+ MatSortModule,
627
+ MatExpansionModule,
628
+ MatNativeDateModule,
629
+ MatSnackBarModule,
630
+ MatTreeModule,
631
+ MatSliderModule,
632
+ MatButtonModule,
633
+ MatSlideToggleModule,
634
+ ColorPickerModule,
635
+ MatButtonToggleModule
636
+ ],
637
+ exports: [
638
+ MatButtonModule,
639
+ MatToolbarModule,
640
+ MatIconModule,
641
+ MatSidenavModule,
642
+ MatBadgeModule,
643
+ MatListModule,
644
+ MatGridListModule,
645
+ MatInputModule,
646
+ MatFormFieldModule,
647
+ MatSelectModule,
648
+ MatRadioModule,
649
+ MatDatepickerModule,
650
+ MatChipsModule,
651
+ MatTooltipModule,
652
+ MatTableModule,
653
+ MatPaginatorModule,
654
+ MatCardModule,
655
+ MatMenuModule,
656
+ MatTabsModule,
657
+ CdkTableModule,
658
+ MatProgressSpinnerModule,
659
+ MatCheckboxModule,
660
+ MatDialogModule,
661
+ MatAutocompleteModule,
662
+ MatProgressBarModule,
663
+ MatSortModule,
664
+ MatExpansionModule,
665
+ MatNativeDateModule,
666
+ MatSnackBarModule,
667
+ MatTreeModule,
668
+ MatSliderModule,
669
+ MatButtonModule,
670
+ MatSlideToggleModule,
671
+ ColorPickerModule,
672
+ ScrollingModule,
673
+ CdkScrollable,
674
+ MatButtonToggleModule
675
+ ],
676
+ providers: [
677
+ MatDatepickerModule,
678
+ MatDialogModule
679
+ ]
680
+ }]
681
+ }] });
682
+
683
+ class KlesFieldAbstract {
684
+ constructor() {
685
+ this._onDestroy = new Subject();
686
+ }
687
+ ngOnInit() {
688
+ var _a;
689
+ // this.applyPipeTransform();
690
+ if (this.field.valueChanges) {
691
+ this.field.valueChanges(this.field, this.group, this.siblingFields);
692
+ }
693
+ (_a = this.group.controls[this.field.name]) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(takeUntil(this._onDestroy)).subscribe(val => {
694
+ if (this.field.valueChanges) {
695
+ this.field.valueChanges(this.field, this.group, this.siblingFields, val);
696
+ }
697
+ // this.applyPipeTransform();
698
+ });
699
+ }
700
+ ngAfterViewInit() {
701
+ }
702
+ ngOnDestroy() {
703
+ this._onDestroy.next();
704
+ this._onDestroy.complete();
705
+ }
706
+ applyPipeTransform() {
707
+ if (this.group && this.field) {
708
+ const control = this.group.controls[this.field.name];
709
+ if (control) {
710
+ const val = this.group.controls[this.field.name].value;
711
+ if (this.field.pipeTransform) {
712
+ this.field.pipeTransform.forEach(p => {
713
+ let pipeVal = control.value;
714
+ if (p.options) {
715
+ p.options.forEach(opt => {
716
+ pipeVal = p.pipe.transform(val, opt);
717
+ });
718
+ }
719
+ else {
720
+ pipeVal = p.pipe.transform(val);
721
+ }
722
+ control.patchValue(pipeVal, { onlySelf: true, emitEvent: false });
723
+ });
724
+ }
725
+ }
726
+ }
727
+ }
728
+ }
729
+ KlesFieldAbstract.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFieldAbstract, deps: [], target: i0.ɵɵFactoryTarget.Directive });
730
+ KlesFieldAbstract.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.2", type: KlesFieldAbstract, ngImport: i0 });
731
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFieldAbstract, decorators: [{
732
+ type: Directive
733
+ }] });
734
+
735
+ class KlesFormLabelComponent extends KlesFieldAbstract {
736
+ ngOnInit() {
737
+ this.group.controls[this.field.name].disable();
738
+ super.ngOnInit();
739
+ }
740
+ ngOnDestroy() {
741
+ super.ngOnDestroy();
742
+ }
743
+ }
744
+ KlesFormLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormLabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
745
+ KlesFormLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormLabelComponent, selector: "kles-form-label", usesInheritance: true, ngImport: i0, template: `
746
+ <div [formGroup]="group" >
747
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id"
748
+ [ngClass]="field.ngClass"
749
+ [ngStyle]="{'color':'inherit'}" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType">
750
+ </div>
751
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i3.DefaultStyleDirective, selector: " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormLabelComponent, decorators: [{
753
+ type: Component,
754
+ args: [{
755
+ selector: "kles-form-label",
756
+ template: `
757
+ <div [formGroup]="group" >
758
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id"
759
+ [ngClass]="field.ngClass"
760
+ [ngStyle]="{'color':'inherit'}" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType">
761
+ </div>
762
+ `
763
+ }]
764
+ }] });
765
+
766
+ let KlesFormInputComponent = class KlesFormInputComponent extends KlesFieldAbstract {
767
+ ngOnInit() {
768
+ if (this.field.options instanceof Observable) {
769
+ this.options$ = this.field.options;
770
+ }
771
+ else {
772
+ this.options$ = of(this.field.options);
773
+ }
774
+ this.filteredOption = this.group.get(this.field.name).valueChanges
775
+ .pipe(startWith(''),
776
+ // map(data => data ? this.filterData(data) : this.field.options.slice())
777
+ switchMap(data => data ? this.filterData(data) : this.options$));
778
+ if (!this.field.maxLength) {
779
+ this.field.maxLength = 524288; // Max default input W3C
780
+ }
781
+ super.ngOnInit();
782
+ }
783
+ isPending() {
784
+ return (this.group.controls[this.field.name].pending || this.field.pending);
785
+ }
786
+ filterData(value) {
787
+ let filterValue;
788
+ if (typeof value === 'string' && Object.prototype.toString.call(value) === '[object String]') {
789
+ filterValue = value.toLowerCase();
790
+ }
791
+ else {
792
+ filterValue = value[this.field.property].toLowerCase();
793
+ }
794
+ if (this.field.property) {
795
+ return this.options$
796
+ .pipe(map(options => options.filter(option => option[this.field.property].toLowerCase().indexOf(filterValue) === 0)));
797
+ // return this.field.options
798
+ // .filter(data => data[this.field.property].toLowerCase().indexOf(filterValue) === 0);
799
+ }
800
+ // return this.field.options.filter(data => data.toLowerCase().indexOf(filterValue) === 0);
801
+ return this.options$.pipe(map(options => options.filter(option => option.toLowerCase().indexOf(filterValue) === 0)));
802
+ }
803
+ displayFn(value) {
804
+ if (this.field.displayWith) {
805
+ return this.field.displayWith(value);
806
+ }
807
+ else {
808
+ if (value && this.field && this.field.property) {
809
+ return value[this.field.property] ? value[this.field.property] : '';
810
+ }
811
+ return value ? value : '';
812
+ }
813
+ }
814
+ ngOnDestroy() {
815
+ super.ngOnDestroy();
816
+ }
817
+ };
818
+ KlesFormInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
819
+ KlesFormInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormInputComponent, selector: "kles-form-input", usesInheritance: true, ngImport: i0, template: `
820
+ <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
821
+
822
+ <ng-container *ngIf="field.autocomplete; else notAutoComplete">
823
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
824
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
825
+ [matAutocomplete]="auto">
826
+
827
+ <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
828
+ <ng-container *ngIf="!field.autocompleteComponent">
829
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
830
+ {{field.property ? option[field.property] : option}}
831
+ </mat-option>
832
+ </ng-container>
833
+
834
+ <ng-container *ngIf="field.autocompleteComponent">
835
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
836
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
837
+ </ng-container>
838
+ </mat-option>
839
+ </ng-container>
840
+ </mat-autocomplete>
841
+ </ng-container>
842
+
843
+ <ng-template #notAutoComplete>
844
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
845
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
846
+ </ng-template>
847
+
848
+ <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
849
+
850
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
851
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
852
+ </ng-container>
853
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
854
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
855
+ </ng-container>
856
+ </mat-form-field>
857
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i9.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i9.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: KlesComponentDirective, selector: "[klesComponent]", inputs: ["component", "value", "field"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
858
+ KlesFormInputComponent = __decorate([
859
+ FieldMapper({ type: EnumType.input })
860
+ ], KlesFormInputComponent);
861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormInputComponent, decorators: [{
862
+ type: Component,
863
+ args: [{ selector: 'kles-form-input', template: `
864
+ <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
865
+
866
+ <ng-container *ngIf="field.autocomplete; else notAutoComplete">
867
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
868
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
869
+ [matAutocomplete]="auto">
870
+
871
+ <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
872
+ <ng-container *ngIf="!field.autocompleteComponent">
873
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
874
+ {{field.property ? option[field.property] : option}}
875
+ </mat-option>
876
+ </ng-container>
877
+
878
+ <ng-container *ngIf="field.autocompleteComponent">
879
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
880
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
881
+ </ng-container>
882
+ </mat-option>
883
+ </ng-container>
884
+ </mat-autocomplete>
885
+ </ng-container>
886
+
887
+ <ng-template #notAutoComplete>
888
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
889
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
890
+ </ng-template>
891
+
892
+ <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
893
+
894
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
895
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
896
+ </ng-container>
897
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
898
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
899
+ </ng-container>
900
+ </mat-form-field>
901
+ `, styles: ["mat-form-field{width:100%}\n"] }]
902
+ }] });
903
+
904
+ let KlesFormSubmitButtonComponent = class KlesFormSubmitButtonComponent extends KlesFieldAbstract {
905
+ ngOnInit() {
906
+ super.ngOnInit();
907
+ }
908
+ ngOnDestroy() {
909
+ super.ngOnDestroy();
910
+ }
911
+ };
912
+ KlesFormSubmitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSubmitButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
913
+ KlesFormSubmitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormSubmitButtonComponent, selector: "kles-submit-button", usesInheritance: true, ngImport: i0, template: `
914
+ <div [formGroup]="group">
915
+ <button matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" type="submit" [disabled]="field.disabled" mat-raised-button color="primary">{{field.label}}</button>
916
+ </div>
917
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: i4$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
918
+ KlesFormSubmitButtonComponent = __decorate([
919
+ FieldMapper({ type: EnumType.button })
920
+ ], KlesFormSubmitButtonComponent);
921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSubmitButtonComponent, decorators: [{
922
+ type: Component,
923
+ args: [{ selector: 'kles-submit-button', template: `
924
+ <div [formGroup]="group">
925
+ <button matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" type="submit" [disabled]="field.disabled" mat-raised-button color="primary">{{field.label}}</button>
926
+ </div>
927
+ ` }]
928
+ }] });
929
+
930
+ class KlesTransformPipe {
931
+ transform(value, pipes) {
932
+ if (pipes && pipes.length > 0) {
933
+ return pipes.reduce((acc, p) => {
934
+ if (p.options) {
935
+ p.options.forEach(opt => {
936
+ acc = p.pipe.transform(acc, opt);
937
+ });
938
+ }
939
+ else {
940
+ acc = p.pipe.transform(acc);
941
+ }
942
+ return acc;
943
+ }, value);
944
+ }
945
+ return value;
946
+ }
947
+ }
948
+ KlesTransformPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesTransformPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
949
+ KlesTransformPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: KlesTransformPipe, name: "klesTransform" });
950
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesTransformPipe, decorators: [{
951
+ type: Pipe,
952
+ args: [{ name: 'klesTransform' }]
953
+ }] });
954
+
955
+ let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbstract {
956
+ constructor() {
957
+ super();
958
+ this.compareFn = (o1, o2) => {
959
+ if (this.field.property && o1 && o2) {
960
+ return o1[this.field.property] === o2[this.field.property];
961
+ }
962
+ return o1 === o2;
963
+ };
964
+ }
965
+ ngOnInit() {
966
+ super.ngOnInit();
967
+ if (!(this.field.options instanceof Observable)) {
968
+ this.options$ = of(this.field.options);
969
+ }
970
+ else {
971
+ this.options$ = this.field.options;
972
+ }
973
+ }
974
+ ngOnDestroy() {
975
+ super.ngOnDestroy();
976
+ }
977
+ openChange($event) {
978
+ if (this.field.virtualScroll) {
979
+ if ($event) {
980
+ this.cdkVirtualScrollViewport.scrollToIndex(0);
981
+ this.cdkVirtualScrollViewport.checkViewportSize();
982
+ }
983
+ }
984
+ }
985
+ };
986
+ KlesFormSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
987
+ KlesFormSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormSelectComponent, selector: "kles-form-select", viewQueries: [{ propertyName: "cdkVirtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }, { propertyName: "options", predicate: MatOption, descendants: true }], usesInheritance: true, ngImport: i0, template: `
988
+ <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
989
+ <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id"
990
+ (openedChange)="openChange($event)" [compareWith]="compareFn"
991
+ [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
992
+ <mat-select-trigger *ngIf="field.triggerComponent">
993
+ <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
994
+ </mat-select-trigger>
995
+
996
+
997
+ <ng-container *ngIf="!field.virtualScroll">
998
+ <ng-container *ngIf="!field.autocompleteComponent">
999
+ <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
1000
+ </ng-container>
1001
+
1002
+ <ng-container *ngIf="field.autocompleteComponent">
1003
+ <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1004
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1005
+ </mat-option>
1006
+ </ng-container>
1007
+ </ng-container>
1008
+
1009
+ <ng-container *ngIf="field.virtualScroll">
1010
+ <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=5*48>
1011
+ <ng-container *ngIf="!field.autocompleteComponent">
1012
+ <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1013
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1014
+ </mat-option>
1015
+
1016
+ <ng-container *ngIf="field.multiple">
1017
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1018
+ style="display:none">
1019
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1020
+ </mat-option>
1021
+ </ng-container>
1022
+
1023
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1024
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1025
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1026
+ </mat-option>
1027
+ </ng-container>
1028
+ </ng-container>
1029
+
1030
+ <ng-container *ngIf="field.autocompleteComponent">
1031
+ <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1032
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1033
+ </mat-option>
1034
+ <ng-container *ngIf="field.multiple">
1035
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1036
+ style="display:none">
1037
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1038
+ </mat-option>
1039
+ </ng-container>
1040
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1041
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1042
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1043
+ </mat-option>
1044
+ </ng-container>
1045
+ </ng-container>
1046
+ </cdk-virtual-scroll-viewport>
1047
+
1048
+ </ng-container>
1049
+
1050
+ </mat-select>
1051
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1052
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1053
+ </ng-container>
1054
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1055
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1056
+ </ng-container>
1057
+ </mat-form-field>
1058
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i5$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "directive", type: i5$1.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i8$1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i8$1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i8$1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: KlesComponentDirective, selector: "[klesComponent]", inputs: ["component", "value", "field"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.SlicePipe, name: "slice" }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
1059
+ KlesFormSelectComponent = __decorate([
1060
+ FieldMapper({ type: EnumType.select })
1061
+ ], KlesFormSelectComponent);
1062
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSelectComponent, decorators: [{
1063
+ type: Component,
1064
+ args: [{ selector: 'kles-form-select', template: `
1065
+ <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
1066
+ <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id"
1067
+ (openedChange)="openChange($event)" [compareWith]="compareFn"
1068
+ [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
1069
+ <mat-select-trigger *ngIf="field.triggerComponent">
1070
+ <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
1071
+ </mat-select-trigger>
1072
+
1073
+
1074
+ <ng-container *ngIf="!field.virtualScroll">
1075
+ <ng-container *ngIf="!field.autocompleteComponent">
1076
+ <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
1077
+ </ng-container>
1078
+
1079
+ <ng-container *ngIf="field.autocompleteComponent">
1080
+ <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1081
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1082
+ </mat-option>
1083
+ </ng-container>
1084
+ </ng-container>
1085
+
1086
+ <ng-container *ngIf="field.virtualScroll">
1087
+ <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=5*48>
1088
+ <ng-container *ngIf="!field.autocompleteComponent">
1089
+ <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1090
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1091
+ </mat-option>
1092
+
1093
+ <ng-container *ngIf="field.multiple">
1094
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1095
+ style="display:none">
1096
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1097
+ </mat-option>
1098
+ </ng-container>
1099
+
1100
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1101
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1102
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1103
+ </mat-option>
1104
+ </ng-container>
1105
+ </ng-container>
1106
+
1107
+ <ng-container *ngIf="field.autocompleteComponent">
1108
+ <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1109
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1110
+ </mat-option>
1111
+ <ng-container *ngIf="field.multiple">
1112
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1113
+ style="display:none">
1114
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1115
+ </mat-option>
1116
+ </ng-container>
1117
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1118
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1119
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1120
+ </mat-option>
1121
+ </ng-container>
1122
+ </ng-container>
1123
+ </cdk-virtual-scroll-viewport>
1124
+
1125
+ </ng-container>
1126
+
1127
+ </mat-select>
1128
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1129
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1130
+ </ng-container>
1131
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1132
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1133
+ </ng-container>
1134
+ </mat-form-field>
1135
+ `, styles: ["mat-form-field{width:100%}\n"] }]
1136
+ }], ctorParameters: function () { return []; }, propDecorators: { cdkVirtualScrollViewport: [{
1137
+ type: ViewChild,
1138
+ args: [CdkVirtualScrollViewport]
1139
+ }], options: [{
1140
+ type: ViewChildren,
1141
+ args: [MatOption]
1142
+ }] } });
1143
+
1144
+ class KlesFormDateComponent extends KlesFieldAbstract {
1145
+ ngOnInit() { super.ngOnInit(); }
1146
+ ngOnDestroy() {
1147
+ super.ngOnDestroy();
1148
+ }
1149
+ }
1150
+ KlesFormDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormDateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1151
+ KlesFormDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormDateComponent, selector: "kles-form-datepicker", usesInheritance: true, ngImport: i0, template: `
1152
+ <mat-form-field class="demo-full-width margin-top" [color]="field.color" [formGroup]="group">
1153
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [matDatepicker]="picker" [formControlName]="field.name" [placeholder]="field.placeholder | translate">
1154
+ <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
1155
+ <mat-datepicker #picker></mat-datepicker>
1156
+ <mat-hint></mat-hint>
1157
+
1158
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1159
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1160
+ </ng-container>
1161
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1162
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1163
+ </ng-container>
1164
+ </mat-form-field>
1165
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i6$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i6$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormDateComponent, decorators: [{
1167
+ type: Component,
1168
+ args: [{ selector: "kles-form-datepicker", template: `
1169
+ <mat-form-field class="demo-full-width margin-top" [color]="field.color" [formGroup]="group">
1170
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [matDatepicker]="picker" [formControlName]="field.name" [placeholder]="field.placeholder | translate">
1171
+ <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
1172
+ <mat-datepicker #picker></mat-datepicker>
1173
+ <mat-hint></mat-hint>
1174
+
1175
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1176
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1177
+ </ng-container>
1178
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1179
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1180
+ </ng-container>
1181
+ </mat-form-field>
1182
+ ` }]
1183
+ }] });
1184
+
1185
+ class KlesFormRadioComponent extends KlesFieldAbstract {
1186
+ ngOnInit() { super.ngOnInit(); }
1187
+ ngOnDestroy() {
1188
+ super.ngOnDestroy();
1189
+ }
1190
+ }
1191
+ KlesFormRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1192
+ KlesFormRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormRadioComponent, selector: "kles-form-radiobutton", usesInheritance: true, ngImport: i0, template: `
1193
+ <div [formGroup]="group">
1194
+ <label class="radio-label-padding">{{field.label}}</label>
1195
+ <mat-radio-group matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name">
1196
+ <mat-radio-button *ngFor="let item of field.options" [value]="item">{{item}}</mat-radio-button>
1197
+ </mat-radio-group>
1198
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1199
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1200
+ </ng-container>
1201
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1202
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1203
+ </ng-container>
1204
+ </div>
1205
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "directive", type: i5$2.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { kind: "component", type: i5$2.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormRadioComponent, decorators: [{
1207
+ type: Component,
1208
+ args: [{ selector: 'kles-form-radiobutton', template: `
1209
+ <div [formGroup]="group">
1210
+ <label class="radio-label-padding">{{field.label}}</label>
1211
+ <mat-radio-group matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name">
1212
+ <mat-radio-button *ngFor="let item of field.options" [value]="item">{{item}}</mat-radio-button>
1213
+ </mat-radio-group>
1214
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1215
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1216
+ </ng-container>
1217
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1218
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1219
+ </ng-container>
1220
+ </div>
1221
+ ` }]
1222
+ }] });
1223
+
1224
+ let KlesFormCheckboxComponent = class KlesFormCheckboxComponent extends KlesFieldAbstract {
1225
+ ngOnInit() { super.ngOnInit(); }
1226
+ ngOnDestroy() {
1227
+ super.ngOnDestroy();
1228
+ }
1229
+ };
1230
+ KlesFormCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1231
+ KlesFormCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormCheckboxComponent, selector: "kles-form-checkbox", usesInheritance: true, ngImport: i0, template: `
1232
+ <div [formGroup]="group" >
1233
+ <mat-checkbox matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [indeterminate]="field.indeterminate" [color]="field.color" [formControlName]="field.name">{{field.label | translate}}</mat-checkbox>
1234
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1235
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1236
+ </ng-container>
1237
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1238
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1239
+ </ng-container>
1240
+ </div>
1241
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i6$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1242
+ KlesFormCheckboxComponent = __decorate([
1243
+ FieldMapper({ type: EnumType.checkbox })
1244
+ ], KlesFormCheckboxComponent);
1245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormCheckboxComponent, decorators: [{
1246
+ type: Component,
1247
+ args: [{ selector: 'kles-form-checkbox', template: `
1248
+ <div [formGroup]="group" >
1249
+ <mat-checkbox matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [indeterminate]="field.indeterminate" [color]="field.color" [formControlName]="field.name">{{field.label | translate}}</mat-checkbox>
1250
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1251
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1252
+ </ng-container>
1253
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1254
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1255
+ </ng-container>
1256
+ </div>
1257
+ ` }]
1258
+ }] });
1259
+
1260
+ class KlesFormListFieldComponent extends KlesFieldAbstract {
1261
+ constructor(fb) {
1262
+ super();
1263
+ this.fb = fb;
1264
+ }
1265
+ ngOnInit() {
1266
+ this.formArray = this.group.controls[this.field.name];
1267
+ super.ngOnInit();
1268
+ }
1269
+ createFormGroup() {
1270
+ const group = this.fb.group({});
1271
+ this.field.collections.forEach(item => {
1272
+ const control = this.fb.control(null, this.bindValidations(item.validations || []), this.bindAsyncValidations(item.asyncValidations || []));
1273
+ group.addControl(item.name, control);
1274
+ });
1275
+ return group;
1276
+ }
1277
+ deleteField(index) {
1278
+ this.formArray.removeAt(index);
1279
+ }
1280
+ addField() {
1281
+ this.formArray.push(this.createFormGroup());
1282
+ }
1283
+ bindValidations(validations) {
1284
+ if (validations.length > 0) {
1285
+ const validList = [];
1286
+ validations.forEach(valid => {
1287
+ validList.push(valid.validator);
1288
+ });
1289
+ return Validators.compose(validList);
1290
+ }
1291
+ return null;
1292
+ }
1293
+ bindAsyncValidations(validations) {
1294
+ if (validations.length > 0) {
1295
+ const validList = [];
1296
+ validations.forEach(valid => {
1297
+ validList.push(valid.validator);
1298
+ });
1299
+ return Validators.composeAsync(validList);
1300
+ }
1301
+ return null;
1302
+ }
1303
+ ngOnDestroy() {
1304
+ super.ngOnDestroy();
1305
+ }
1306
+ }
1307
+ KlesFormListFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormListFieldComponent, deps: [{ token: i2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component });
1308
+ KlesFormListFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormListFieldComponent, selector: "kles-form-listfield", usesInheritance: true, ngImport: i0, template: `
1309
+ <div [formGroup]="group" class="form-element">
1310
+ {{field.label | translate}}
1311
+ <button mat-icon-button color="primary" (click)="addField()">
1312
+ <mat-icon>add</mat-icon>
1313
+ </button>
1314
+
1315
+ <div class="dynamic-form" [formGroupName]="field.name">
1316
+ <div *ngFor="let subGroup of formArray.controls let index = index;" fxLayout="row" fxLayoutGap="5px">
1317
+ <ng-container *ngFor="let subfield of field.collections;"
1318
+ dynamicField [field]="subfield" [group]="subGroup">
1319
+ </ng-container>
1320
+ <button mat-icon-button (click)="deleteField(index)" color="primary">
1321
+ <mat-icon>delete_outlined</mat-icon>
1322
+ </button>
1323
+ </div>
1324
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1325
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1326
+ </ng-container>
1327
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1328
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1329
+ </ng-container>
1330
+ </div>
1331
+ </div>
1332
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3$1.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3$1.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "component", type: i4$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1333
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormListFieldComponent, decorators: [{
1334
+ type: Component,
1335
+ args: [{ selector: 'kles-form-listfield', template: `
1336
+ <div [formGroup]="group" class="form-element">
1337
+ {{field.label | translate}}
1338
+ <button mat-icon-button color="primary" (click)="addField()">
1339
+ <mat-icon>add</mat-icon>
1340
+ </button>
1341
+
1342
+ <div class="dynamic-form" [formGroupName]="field.name">
1343
+ <div *ngFor="let subGroup of formArray.controls let index = index;" fxLayout="row" fxLayoutGap="5px">
1344
+ <ng-container *ngFor="let subfield of field.collections;"
1345
+ dynamicField [field]="subfield" [group]="subGroup">
1346
+ </ng-container>
1347
+ <button mat-icon-button (click)="deleteField(index)" color="primary">
1348
+ <mat-icon>delete_outlined</mat-icon>
1349
+ </button>
1350
+ </div>
1351
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1352
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1353
+ </ng-container>
1354
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1355
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1356
+ </ng-container>
1357
+ </div>
1358
+ </div>
1359
+ ` }]
1360
+ }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }]; } });
1361
+
1362
+ class KlesFormColorComponent extends KlesFieldAbstract {
1363
+ ngOnInit() { super.ngOnInit(); }
1364
+ invertColor(hex, bw) {
1365
+ if (hex.indexOf('#') === 0) {
1366
+ hex = hex.slice(1);
1367
+ }
1368
+ // convert 3-digit hex to 6-digits.
1369
+ if (hex.length === 3) {
1370
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
1371
+ }
1372
+ if (hex.length !== 6) {
1373
+ return '#000000';
1374
+ }
1375
+ let r = parseInt(hex.slice(0, 2), 16);
1376
+ let g = parseInt(hex.slice(2, 4), 16);
1377
+ let b = parseInt(hex.slice(4, 6), 16);
1378
+ if (bw) {
1379
+ return (r * 0.299 + g * 0.587 + b * 0.114) > 186
1380
+ ? '#000000'
1381
+ : '#FFFFFF';
1382
+ }
1383
+ // invert color components
1384
+ const r1 = (255 - r).toString(16);
1385
+ const g1 = (255 - g).toString(16);
1386
+ const b1 = (255 - b).toString(16);
1387
+ // pad each with zeros and return
1388
+ return "#" + r1 + g1 + b1;
1389
+ }
1390
+ ngOnDestroy() {
1391
+ super.ngOnDestroy();
1392
+ }
1393
+ }
1394
+ KlesFormColorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormColorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1395
+ KlesFormColorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormColorComponent, selector: "kles-form-color", usesInheritance: true, ngImport: i0, template: `
1396
+ <mat-form-field [formGroup]="group" class="form-element">
1397
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate"
1398
+ [colorPicker]="group.get(field.name).value"
1399
+ [value]="group.get(field.name).value"
1400
+ (colorPickerChange)="group.get(field.name).setValue($event)"
1401
+ class="colorPicker"
1402
+ [style.background]="group.get(field.name).value"
1403
+ [style.color]="invertColor(group.get(field.name).value,true)"
1404
+ [formControlName]="field.name">
1405
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1406
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1407
+ </ng-container>
1408
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1409
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1410
+ </ng-container>
1411
+ </mat-form-field>
1412
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i7$2.ColorPickerDirective, selector: "[colorPicker]", inputs: ["cpWidth", "cpHeight", "cpToggle", "cpDisabled", "cpIgnoredElements", "cpFallbackColor", "cpColorMode", "cpCmykEnabled", "cpOutputFormat", "cpAlphaChannel", "cpDisableInput", "cpDialogDisplay", "cpSaveClickOutside", "cpCloseClickOutside", "cpUseRootViewContainer", "cpPosition", "cpPositionOffset", "cpPositionRelativeToArrow", "cpOKButton", "cpOKButtonText", "cpOKButtonClass", "cpCancelButton", "cpCancelButtonText", "cpCancelButtonClass", "cpPresetLabel", "cpPresetColorsClass", "cpMaxPresetColorsLength", "cpPresetEmptyMessage", "cpPresetEmptyMessageClass", "cpAddColorButton", "cpAddColorButtonText", "cpAddColorButtonClass", "cpRemoveColorButtonClass", "colorPicker", "cpPresetColors"], outputs: ["cpInputChange", "cpToggleChange", "cpSliderChange", "cpSliderDragEnd", "cpSliderDragStart", "colorPickerOpen", "colorPickerClose", "colorPickerCancel", "colorPickerSelect", "colorPickerChange", "cpCmykColorChange", "cpPresetColorsChange"], exportAs: ["ngxColorPicker"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1413
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormColorComponent, decorators: [{
1414
+ type: Component,
1415
+ args: [{ selector: 'kles-form-color', template: `
1416
+ <mat-form-field [formGroup]="group" class="form-element">
1417
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate"
1418
+ [colorPicker]="group.get(field.name).value"
1419
+ [value]="group.get(field.name).value"
1420
+ (colorPickerChange)="group.get(field.name).setValue($event)"
1421
+ class="colorPicker"
1422
+ [style.background]="group.get(field.name).value"
1423
+ [style.color]="invertColor(group.get(field.name).value,true)"
1424
+ [formControlName]="field.name">
1425
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1426
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1427
+ </ng-container>
1428
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1429
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1430
+ </ng-container>
1431
+ </mat-form-field>
1432
+ `, styles: ["mat-form-field{width:100%}\n"] }]
1433
+ }] });
1434
+
1435
+ class KlesButtonComponent {
1436
+ constructor() {
1437
+ this.name = '';
1438
+ this.label = '';
1439
+ this.color = 'accent';
1440
+ this.icon = '';
1441
+ this.iconSvg = '';
1442
+ this.disabled = false;
1443
+ this.classButton = '';
1444
+ this.value = {};
1445
+ this.onChange = () => { };
1446
+ this.onTouched = () => { };
1447
+ }
1448
+ ngOnInit() {
1449
+ }
1450
+ click(event) {
1451
+ this.value.event = this.name;
1452
+ this.onChange(this.value);
1453
+ }
1454
+ writeValue(value) {
1455
+ if (!value) {
1456
+ value = { event: this.name };
1457
+ }
1458
+ if (!value.event) {
1459
+ value.event = this.name;
1460
+ }
1461
+ if (value.uiButton) {
1462
+ const uiButton = value.uiButton;
1463
+ this.label = (uiButton.label) ? uiButton.label : this.label;
1464
+ this.color = (uiButton.color) ? uiButton.color : this.color;
1465
+ this.icon = (uiButton.icon) ? uiButton.icon : this.icon;
1466
+ this.iconSvg = (uiButton.iconSvg) ? uiButton.iconSvg : this.iconSvg;
1467
+ this.disabled = (uiButton.disabled) ? uiButton.disabled : this.disabled;
1468
+ this.classButton = (uiButton.class) ? uiButton.class : this.classButton;
1469
+ }
1470
+ this.value = value;
1471
+ }
1472
+ registerOnChange(fn) {
1473
+ this.onChange = fn;
1474
+ }
1475
+ registerOnTouched(fn) {
1476
+ this.onTouched = fn;
1477
+ }
1478
+ setDisabledState(isDisabled) {
1479
+ this.disabled = isDisabled;
1480
+ }
1481
+ }
1482
+ KlesButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1483
+ KlesButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesButtonComponent, selector: "kles-button", inputs: { name: "name", label: "label", color: "color", icon: "icon", iconSvg: "iconSvg", disabled: "disabled", classButton: "classButton", value: "value", tooltip: "tooltip" }, providers: [
1484
+ {
1485
+ provide: NG_VALUE_ACCESSOR,
1486
+ useExisting: forwardRef(() => KlesButtonComponent),
1487
+ multi: true
1488
+ }
1489
+ ], ngImport: i0, template: `
1490
+ <span>
1491
+ <button mat-button [ngClass]="classButton" [color]="(color)?color:'primary'" [disabled]="disabled"
1492
+ (click)="click($event)" [matTooltip]="tooltip">
1493
+ {{label | translate}}
1494
+ <mat-icon *ngIf="icon">{{icon}}</mat-icon>
1495
+ <mat-icon svgIcon="{{iconSvg}}" *ngIf="iconSvg"></mat-icon>
1496
+ </button>
1497
+ </span>
1498
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: i4$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1499
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesButtonComponent, decorators: [{
1500
+ type: Component,
1501
+ args: [{
1502
+ selector: 'kles-button',
1503
+ template: `
1504
+ <span>
1505
+ <button mat-button [ngClass]="classButton" [color]="(color)?color:'primary'" [disabled]="disabled"
1506
+ (click)="click($event)" [matTooltip]="tooltip">
1507
+ {{label | translate}}
1508
+ <mat-icon *ngIf="icon">{{icon}}</mat-icon>
1509
+ <mat-icon svgIcon="{{iconSvg}}" *ngIf="iconSvg"></mat-icon>
1510
+ </button>
1511
+ </span>
1512
+ `,
1513
+ providers: [
1514
+ {
1515
+ provide: NG_VALUE_ACCESSOR,
1516
+ useExisting: forwardRef(() => KlesButtonComponent),
1517
+ multi: true
1518
+ }
1519
+ ]
1520
+ }]
1521
+ }], propDecorators: { name: [{
1522
+ type: Input
1523
+ }], label: [{
1524
+ type: Input
1525
+ }], color: [{
1526
+ type: Input
1527
+ }], icon: [{
1528
+ type: Input
1529
+ }], iconSvg: [{
1530
+ type: Input
1531
+ }], disabled: [{
1532
+ type: Input
1533
+ }], classButton: [{
1534
+ type: Input
1535
+ }], value: [{
1536
+ type: Input
1537
+ }], tooltip: [{
1538
+ type: Input
1539
+ }] } });
1540
+
1541
+ class KlesFormButtonComponent extends KlesFieldAbstract {
1542
+ ngOnInit() {
1543
+ super.ngOnInit();
1544
+ }
1545
+ ngOnDestroy() {
1546
+ super.ngOnDestroy();
1547
+ }
1548
+ }
1549
+ KlesFormButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1550
+ KlesFormButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormButtonComponent, selector: "kles-form-button", usesInheritance: true, ngImport: i0, template: `
1551
+ <div [formGroup]="group">
1552
+ <kles-button
1553
+ [attr.id]="field.id" [classButton]="field.ngClass"
1554
+ [name]="field.name" [label]="field.label" [color]="field.color"
1555
+ [icon]="field.icon"
1556
+ [iconSvg]="field.iconSvg"
1557
+ [value]="field.value"
1558
+ [formControlName]="field.name"
1559
+ [tooltip]="field.tooltip">
1560
+ </kles-button>
1561
+ </div>
1562
+ `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: KlesButtonComponent, selector: "kles-button", inputs: ["name", "label", "color", "icon", "iconSvg", "disabled", "classButton", "value", "tooltip"] }] });
1563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonComponent, decorators: [{
1564
+ type: Component,
1565
+ args: [{ selector: 'kles-form-button', template: `
1566
+ <div [formGroup]="group">
1567
+ <kles-button
1568
+ [attr.id]="field.id" [classButton]="field.ngClass"
1569
+ [name]="field.name" [label]="field.label" [color]="field.color"
1570
+ [icon]="field.icon"
1571
+ [iconSvg]="field.iconSvg"
1572
+ [value]="field.value"
1573
+ [formControlName]="field.name"
1574
+ [tooltip]="field.tooltip">
1575
+ </kles-button>
1576
+ </div>
1577
+ ` }]
1578
+ }] });
1579
+
1580
+ class KlesButtonCheckerComponent extends KlesButtonComponent {
1581
+ constructor() {
1582
+ super(...arguments);
1583
+ this.value = {
1584
+ busy: false,
1585
+ error: [],
1586
+ event: false
1587
+ };
1588
+ }
1589
+ countError() {
1590
+ return (this.value.error) ? this.value.error.length : 0;
1591
+ }
1592
+ }
1593
+ KlesButtonCheckerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesButtonCheckerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1594
+ KlesButtonCheckerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesButtonCheckerComponent, selector: "kles-button-checker", providers: [
1595
+ {
1596
+ provide: NG_VALUE_ACCESSOR,
1597
+ useExisting: forwardRef(() => KlesButtonCheckerComponent),
1598
+ multi: true
1599
+ }
1600
+ ], usesInheritance: true, ngImport: i0, template: `
1601
+ <span *ngIf="value.error && !value.busy">
1602
+ <kles-button
1603
+ [classButton]="classButton"
1604
+ [name]="name" [label]="label" [color]="color"
1605
+ [icon]="icon" [iconSvg]="iconSvg"
1606
+ [value]="value"
1607
+ [tooltip]="tooltip"
1608
+ [disabled]="disabled"
1609
+ matBadge="{{countError()}}" (click)="click($event)">
1610
+ </kles-button>
1611
+ </span>
1612
+ <span style="text-align: center;">
1613
+ <span style="text-align: center;margin-right: 10px" *ngIf="value.busy||false">
1614
+ <mat-spinner [diameter]="25"></mat-spinner>
1615
+ </span>
1616
+ <span *ngIf="value.message" style="margin-right: 10px">
1617
+ {{value.message|translate}}
1618
+ </span>
1619
+ </span>
1620
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: KlesButtonComponent, selector: "kles-button", inputs: ["name", "label", "color", "icon", "iconSvg", "disabled", "classButton", "value", "tooltip"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesButtonCheckerComponent, decorators: [{
1622
+ type: Component,
1623
+ args: [{
1624
+ selector: 'kles-button-checker',
1625
+ template: `
1626
+ <span *ngIf="value.error && !value.busy">
1627
+ <kles-button
1628
+ [classButton]="classButton"
1629
+ [name]="name" [label]="label" [color]="color"
1630
+ [icon]="icon" [iconSvg]="iconSvg"
1631
+ [value]="value"
1632
+ [tooltip]="tooltip"
1633
+ [disabled]="disabled"
1634
+ matBadge="{{countError()}}" (click)="click($event)">
1635
+ </kles-button>
1636
+ </span>
1637
+ <span style="text-align: center;">
1638
+ <span style="text-align: center;margin-right: 10px" *ngIf="value.busy||false">
1639
+ <mat-spinner [diameter]="25"></mat-spinner>
1640
+ </span>
1641
+ <span *ngIf="value.message" style="margin-right: 10px">
1642
+ {{value.message|translate}}
1643
+ </span>
1644
+ </span>
1645
+ `,
1646
+ providers: [
1647
+ {
1648
+ provide: NG_VALUE_ACCESSOR,
1649
+ useExisting: forwardRef(() => KlesButtonCheckerComponent),
1650
+ multi: true
1651
+ }
1652
+ ]
1653
+ }]
1654
+ }] });
1655
+
1656
+ class KlesFormButtonCheckerComponent extends KlesFieldAbstract {
1657
+ ngOnInit() {
1658
+ super.ngOnInit();
1659
+ }
1660
+ ngOnDestroy() {
1661
+ super.ngOnDestroy();
1662
+ }
1663
+ }
1664
+ KlesFormButtonCheckerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonCheckerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1665
+ KlesFormButtonCheckerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormButtonCheckerComponent, selector: "kles-form-button-checker", usesInheritance: true, ngImport: i0, template: `
1666
+ <div [formGroup]="group">
1667
+ <kles-button-checker
1668
+ [attr.id]="field.id" [classButton]="field.ngClass"
1669
+ [name]="field.name" [label]="field.label" [color]="field.color"
1670
+ [icon]="field.icon"
1671
+ [iconSvg]="field.iconSvg"
1672
+ [value]="field.value"
1673
+ [formControlName]="field.name"
1674
+ [tooltip]="field.tooltip">
1675
+ </kles-button-checker>
1676
+ </div>
1677
+ `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: KlesButtonCheckerComponent, selector: "kles-button-checker" }] });
1678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonCheckerComponent, decorators: [{
1679
+ type: Component,
1680
+ args: [{ selector: 'kles-form-button-checker', template: `
1681
+ <div [formGroup]="group">
1682
+ <kles-button-checker
1683
+ [attr.id]="field.id" [classButton]="field.ngClass"
1684
+ [name]="field.name" [label]="field.label" [color]="field.color"
1685
+ [icon]="field.icon"
1686
+ [iconSvg]="field.iconSvg"
1687
+ [value]="field.value"
1688
+ [formControlName]="field.name"
1689
+ [tooltip]="field.tooltip">
1690
+ </kles-button-checker>
1691
+ </div>
1692
+ ` }]
1693
+ }] });
1694
+
1695
+ class KlesButtonFileComponent extends KlesButtonComponent {
1696
+ constructor() {
1697
+ super(...arguments);
1698
+ this.accept = '*.*';
1699
+ this.fileReader = new FileReader();
1700
+ this.value = {};
1701
+ }
1702
+ click(event) {
1703
+ this.file.nativeElement.click();
1704
+ }
1705
+ writeValue(value) {
1706
+ if (!value) {
1707
+ value = { event: this.name };
1708
+ }
1709
+ if (!value.event) {
1710
+ value.event = this.name;
1711
+ }
1712
+ if (value.uiButton) {
1713
+ const uiButton = value.uiButton;
1714
+ this.label = (uiButton.label) ? uiButton.label : this.label;
1715
+ this.color = (uiButton.color) ? uiButton.color : this.color;
1716
+ this.icon = (uiButton.icon) ? uiButton.icon : this.icon;
1717
+ this.iconSvg = (uiButton.iconSvg) ? uiButton.iconSvg : this.iconSvg;
1718
+ this.disabled = (uiButton.disabled) ? uiButton.disabled : this.disabled;
1719
+ this.classButton = (uiButton.class) ? uiButton.class : this.classButton;
1720
+ }
1721
+ this.value = value;
1722
+ }
1723
+ onFileLoad(fileLoadedEvent) {
1724
+ const textFromFileLoaded = fileLoadedEvent.target.result;
1725
+ this.fileContent = textFromFileLoaded;
1726
+ }
1727
+ onFileSelect(input) {
1728
+ return __awaiter(this, void 0, void 0, function* () {
1729
+ if (input.files.length > 0) {
1730
+ const files = input.files;
1731
+ let fileContent = [];
1732
+ if (files && files.length) {
1733
+ for (let i = 0; i < files.length; i++) {
1734
+ try {
1735
+ fileContent[i] = yield this.readUploadedFile(files[i]);
1736
+ }
1737
+ catch (e) {
1738
+ }
1739
+ }
1740
+ if (fileContent.length === 1) {
1741
+ fileContent = fileContent[0];
1742
+ }
1743
+ }
1744
+ this.value.event = this.name;
1745
+ this.value.fileContent = fileContent;
1746
+ this.onChange(this.value);
1747
+ input.value = '';
1748
+ }
1749
+ });
1750
+ }
1751
+ readUploadedFile(inputFile) {
1752
+ const temporaryFileReader = new FileReader();
1753
+ return new Promise((resolve, reject) => {
1754
+ temporaryFileReader.onerror = () => {
1755
+ temporaryFileReader.abort();
1756
+ const error = new DOMException('Problem parsing input file.');
1757
+ reject(error);
1758
+ };
1759
+ temporaryFileReader.onload = () => {
1760
+ resolve(temporaryFileReader.result);
1761
+ };
1762
+ temporaryFileReader.readAsArrayBuffer(inputFile);
1763
+ });
1764
+ }
1765
+ }
1766
+ KlesButtonFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesButtonFileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1767
+ KlesButtonFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesButtonFileComponent, selector: "kles-button-file", providers: [
1768
+ {
1769
+ provide: NG_VALUE_ACCESSOR,
1770
+ useExisting: forwardRef(() => KlesButtonFileComponent),
1771
+ multi: true
1772
+ }
1773
+ ], viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
1774
+ <input type="file" #file style="display: none" accept="{{accept}}" (change)="onFileSelect($event.target)" multiple />
1775
+ <kles-button
1776
+ [classButton]="classButton"
1777
+ [name]="name" [label]="label" [color]="color"
1778
+ [icon]="icon" [iconSvg]="iconSvg"
1779
+ [disabled]="disabled"
1780
+ [value]="value" (click)="click($event)">
1781
+ </kles-button>
1782
+ `, isInline: true, dependencies: [{ kind: "component", type: KlesButtonComponent, selector: "kles-button", inputs: ["name", "label", "color", "icon", "iconSvg", "disabled", "classButton", "value", "tooltip"] }] });
1783
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesButtonFileComponent, decorators: [{
1784
+ type: Component,
1785
+ args: [{
1786
+ selector: 'kles-button-file',
1787
+ template: `
1788
+ <input type="file" #file style="display: none" accept="{{accept}}" (change)="onFileSelect($event.target)" multiple />
1789
+ <kles-button
1790
+ [classButton]="classButton"
1791
+ [name]="name" [label]="label" [color]="color"
1792
+ [icon]="icon" [iconSvg]="iconSvg"
1793
+ [disabled]="disabled"
1794
+ [value]="value" (click)="click($event)">
1795
+ </kles-button>
1796
+ `,
1797
+ providers: [
1798
+ {
1799
+ provide: NG_VALUE_ACCESSOR,
1800
+ useExisting: forwardRef(() => KlesButtonFileComponent),
1801
+ multi: true
1802
+ }
1803
+ ]
1804
+ }]
1805
+ }], propDecorators: { file: [{
1806
+ type: ViewChild,
1807
+ args: ['file']
1808
+ }] } });
1809
+
1810
+ class KlesFormButtonFileComponent extends KlesFieldAbstract {
1811
+ ngOnInit() {
1812
+ super.ngOnInit();
1813
+ }
1814
+ ngOnDestroy() {
1815
+ super.ngOnDestroy();
1816
+ }
1817
+ }
1818
+ KlesFormButtonFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonFileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1819
+ KlesFormButtonFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormButtonFileComponent, selector: "kles-form-button-file", usesInheritance: true, ngImport: i0, template: `
1820
+ <div [formGroup]="group">
1821
+ <kles-button-file
1822
+ [attr.id]="field.id" [classButton]="field.ngClass"
1823
+ [name]="field.name" [label]="field.label" [color]="field.color"
1824
+ [icon]="field.icon"
1825
+ [iconSvg]="field.iconSvg"
1826
+ [value]="field.value"
1827
+ [formControlName]="field.name">
1828
+ </kles-button-file>
1829
+ </div>
1830
+ `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: KlesButtonFileComponent, selector: "kles-button-file" }] });
1831
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonFileComponent, decorators: [{
1832
+ type: Component,
1833
+ args: [{ selector: 'kles-form-button-file', template: `
1834
+ <div [formGroup]="group">
1835
+ <kles-button-file
1836
+ [attr.id]="field.id" [classButton]="field.ngClass"
1837
+ [name]="field.name" [label]="field.label" [color]="field.color"
1838
+ [icon]="field.icon"
1839
+ [iconSvg]="field.iconSvg"
1840
+ [value]="field.value"
1841
+ [formControlName]="field.name">
1842
+ </kles-button-file>
1843
+ </div>
1844
+ ` }]
1845
+ }] });
1846
+
1847
+ class KlesFormTextareaComponent extends KlesFieldAbstract {
1848
+ ngOnInit() {
1849
+ super.ngOnInit();
1850
+ }
1851
+ ngOnDestroy() {
1852
+ super.ngOnDestroy();
1853
+ }
1854
+ }
1855
+ KlesFormTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1856
+ KlesFormTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormTextareaComponent, selector: "kles-form-textarea", usesInheritance: true, ngImport: i0, template: `
1857
+ <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
1858
+ <textarea matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
1859
+ [formControlName]="field.name" cdkTextareaAutosize [placeholder]="field.placeholder | translate"
1860
+ [cdkAutosizeMinRows]="field.textareaAutoSize?.minRows" [cdkAutosizeMaxRows]="field.textareaAutoSize?.maxRows" [maxlength]="field.maxLength">
1861
+ </textarea>
1862
+
1863
+
1864
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1865
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1866
+ </ng-container>
1867
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1868
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1869
+ </ng-container>
1870
+ </mat-form-field>
1871
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4$3.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
1872
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormTextareaComponent, decorators: [{
1873
+ type: Component,
1874
+ args: [{ selector: 'kles-form-textarea', template: `
1875
+ <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
1876
+ <textarea matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
1877
+ [formControlName]="field.name" cdkTextareaAutosize [placeholder]="field.placeholder | translate"
1878
+ [cdkAutosizeMinRows]="field.textareaAutoSize?.minRows" [cdkAutosizeMaxRows]="field.textareaAutoSize?.maxRows" [maxlength]="field.maxLength">
1879
+ </textarea>
1880
+
1881
+
1882
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1883
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1884
+ </ng-container>
1885
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1886
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1887
+ </ng-container>
1888
+ </mat-form-field>
1889
+ `, styles: ["mat-form-field{width:100%}\n"] }]
1890
+ }] });
1891
+
1892
+ let KlesFormTextComponent = class KlesFormTextComponent extends KlesFieldAbstract {
1893
+ ngOnInit() {
1894
+ super.ngOnInit();
1895
+ }
1896
+ ngOnDestroy() {
1897
+ super.ngOnDestroy();
1898
+ }
1899
+ };
1900
+ KlesFormTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1901
+ KlesFormTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormTextComponent, selector: "kles-form-text", usesInheritance: true, ngImport: i0, template: `
1902
+ <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
1903
+ {{((field.property && group.controls[field.name].value) ? group.controls[field.name].value[field.property] : group.controls[field.name].value) | klesTransform:field.pipeTransform}}
1904
+ </span>
1905
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
1906
+ KlesFormTextComponent = __decorate([
1907
+ FieldMapper({ type: EnumType.text })
1908
+ ], KlesFormTextComponent);
1909
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormTextComponent, decorators: [{
1910
+ type: Component,
1911
+ args: [{
1912
+ selector: 'kles-form-text',
1913
+ template: `
1914
+ <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
1915
+ {{((field.property && group.controls[field.name].value) ? group.controls[field.name].value[field.property] : group.controls[field.name].value) | klesTransform:field.pipeTransform}}
1916
+ </span>
1917
+ `
1918
+ }]
1919
+ }] });
1920
+
1921
+ class KlesFormChipComponent extends KlesFieldAbstract {
1922
+ ngOnInit() { super.ngOnInit(); }
1923
+ ngOnDestroy() {
1924
+ super.ngOnDestroy();
1925
+ }
1926
+ }
1927
+ KlesFormChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormChipComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1928
+ KlesFormChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormChipComponent, selector: "kles-form-chip", usesInheritance: true, ngImport: i0, template: `
1929
+ <div [formGroup]="group">
1930
+ <mat-chip-list>
1931
+ <mat-chip [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" selected [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
1932
+ <mat-icon *ngIf="field.icon">{{field.icon}}</mat-icon>
1933
+ {{group.controls[field.name].value | klesTransform:field.pipeTransform}}
1934
+ </mat-chip>
1935
+ </mat-chip-list>
1936
+ </div>
1937
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i3.DefaultStyleDirective, selector: " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }, { kind: "component", type: i4$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$3.MatChipList, selector: "mat-chip-list", inputs: ["role", "aria-describedby", "errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { kind: "directive", type: i5$3.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "role", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
1938
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormChipComponent, decorators: [{
1939
+ type: Component,
1940
+ args: [{ selector: "kles-form-chip", template: `
1941
+ <div [formGroup]="group">
1942
+ <mat-chip-list>
1943
+ <mat-chip [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" selected [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
1944
+ <mat-icon *ngIf="field.icon">{{field.icon}}</mat-icon>
1945
+ {{group.controls[field.name].value | klesTransform:field.pipeTransform}}
1946
+ </mat-chip>
1947
+ </mat-chip-list>
1948
+ </div>
1949
+ ` }]
1950
+ }] });
1951
+
1952
+ let KlesFormGroupComponent = class KlesFormGroupComponent extends KlesFieldAbstract {
1953
+ ngOnInit() {
1954
+ this.subGroup = this.group.controls[this.field.name];
1955
+ super.ngOnInit();
1956
+ }
1957
+ ngOnDestroy() {
1958
+ super.ngOnDestroy();
1959
+ }
1960
+ };
1961
+ KlesFormGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1962
+ KlesFormGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormGroupComponent, selector: "kles-group", usesInheritance: true, ngImport: i0, template: `
1963
+ <div [formGroup]="group" class="group-container">
1964
+ <div [formGroupName]="field.name" class="group-container" [style.flex-direction]="field.direction || 'inherit'" [ngClass]="field.ngClass"
1965
+ [ngClass]="field.direction === 'column' ? null: 'row'" >
1966
+ <ng-container *ngFor="let subfield of field.collections;" klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
1967
+ </ng-container>
1968
+ </div>
1969
+ </div>
1970
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n", ":host{display:flex;flex-direction:inherit}\n", ".group-container{display:flex;flex-direction:inherit;width:inherit}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: ["field", "group", "siblingFields"] }] });
1971
+ KlesFormGroupComponent = __decorate([
1972
+ FieldMapper({ type: EnumType.group })
1973
+ ], KlesFormGroupComponent);
1974
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormGroupComponent, decorators: [{
1975
+ type: Component,
1976
+ args: [{ selector: 'kles-group', template: `
1977
+ <div [formGroup]="group" class="group-container">
1978
+ <div [formGroupName]="field.name" class="group-container" [style.flex-direction]="field.direction || 'inherit'" [ngClass]="field.ngClass"
1979
+ [ngClass]="field.direction === 'column' ? null: 'row'" >
1980
+ <ng-container *ngFor="let subfield of field.collections;" klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
1981
+ </ng-container>
1982
+ </div>
1983
+ </div>
1984
+ `, styles: ["mat-form-field{width:100%}\n", ":host{display:flex;flex-direction:inherit}\n", ".group-container{display:flex;flex-direction:inherit;width:inherit}\n"] }]
1985
+ }] });
1986
+
1987
+ class KlesFormInputClearableComponent extends KlesFormInputComponent {
1988
+ ngOnDestroy() {
1989
+ super.ngOnDestroy();
1990
+ }
1991
+ }
1992
+ KlesFormInputClearableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormInputClearableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1993
+ KlesFormInputClearableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormInputClearableComponent, selector: "kles-form-input-clearable", usesInheritance: true, ngImport: i0, template: `
1994
+ <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
1995
+
1996
+ <ng-container *ngIf="field.autocomplete; else notAutoComplete">
1997
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
1998
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
1999
+ [matAutocomplete]="auto">
2000
+
2001
+ <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
2002
+ <ng-container *ngIf="!field.autocompleteComponent">
2003
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2004
+ {{field.property ? option[field.property] : option}}
2005
+ </mat-option>
2006
+ </ng-container>
2007
+
2008
+ <ng-container *ngIf="field.autocompleteComponent">
2009
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2010
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
2011
+ </ng-container>
2012
+ </mat-option>
2013
+ </ng-container>
2014
+ </mat-autocomplete>
2015
+ </ng-container>
2016
+
2017
+ <ng-template #notAutoComplete>
2018
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2019
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
2020
+ </ng-template>
2021
+ <button *ngIf="!group.get(field.name).disabled" mat-button matSuffix mat-icon-button aria-label="Clear" type="button"
2022
+ (click)="group.controls[field.name].reset();">
2023
+ <mat-icon>close</mat-icon>
2024
+ </button>
2025
+
2026
+ <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
2027
+
2028
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2029
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2030
+ </ng-container>
2031
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2032
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2033
+ </ng-container>
2034
+ </mat-form-field>
2035
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: i4$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i9.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i9.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: KlesComponentDirective, selector: "[klesComponent]", inputs: ["component", "value", "field"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
2036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormInputClearableComponent, decorators: [{
2037
+ type: Component,
2038
+ args: [{ selector: 'kles-form-input-clearable', template: `
2039
+ <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
2040
+
2041
+ <ng-container *ngIf="field.autocomplete; else notAutoComplete">
2042
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2043
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
2044
+ [matAutocomplete]="auto">
2045
+
2046
+ <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
2047
+ <ng-container *ngIf="!field.autocompleteComponent">
2048
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2049
+ {{field.property ? option[field.property] : option}}
2050
+ </mat-option>
2051
+ </ng-container>
2052
+
2053
+ <ng-container *ngIf="field.autocompleteComponent">
2054
+ <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2055
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
2056
+ </ng-container>
2057
+ </mat-option>
2058
+ </ng-container>
2059
+ </mat-autocomplete>
2060
+ </ng-container>
2061
+
2062
+ <ng-template #notAutoComplete>
2063
+ <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2064
+ [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
2065
+ </ng-template>
2066
+ <button *ngIf="!group.get(field.name).disabled" mat-button matSuffix mat-icon-button aria-label="Clear" type="button"
2067
+ (click)="group.controls[field.name].reset();">
2068
+ <mat-icon>close</mat-icon>
2069
+ </button>
2070
+
2071
+ <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
2072
+
2073
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2074
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2075
+ </ng-container>
2076
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2077
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2078
+ </ng-container>
2079
+ </mat-form-field>
2080
+ `, styles: ["mat-form-field{width:100%}\n"] }]
2081
+ }] });
2082
+
2083
+ class KlesFormIconComponent extends KlesFieldAbstract {
2084
+ ngOnInit() { super.ngOnInit(); }
2085
+ ngOnDestroy() {
2086
+ super.ngOnDestroy();
2087
+ }
2088
+ }
2089
+ KlesFormIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormIconComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2090
+ KlesFormIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormIconComponent, selector: "kles-form-icon", usesInheritance: true, ngImport: i0, template: `
2091
+ <mat-icon [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
2092
+ {{group.controls[field.name].value}}
2093
+ </mat-icon>
2094
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i3.DefaultStyleDirective, selector: " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", inputs: ["ngStyle", "ngStyle.xs", "ngStyle.sm", "ngStyle.md", "ngStyle.lg", "ngStyle.xl", "ngStyle.lt-sm", "ngStyle.lt-md", "ngStyle.lt-lg", "ngStyle.lt-xl", "ngStyle.gt-xs", "ngStyle.gt-sm", "ngStyle.gt-md", "ngStyle.gt-lg"] }, { kind: "component", type: i4$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
2095
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormIconComponent, decorators: [{
2096
+ type: Component,
2097
+ args: [{ selector: "kles-form-icon", template: `
2098
+ <mat-icon [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
2099
+ {{group.controls[field.name].value}}
2100
+ </mat-icon>
2101
+ ` }]
2102
+ }] });
2103
+
2104
+ class KlesFormSelectSearchComponent extends KlesFieldAbstract {
2105
+ constructor() {
2106
+ super(...arguments);
2107
+ this.searchControl = new UntypedFormControl();
2108
+ this.selectAllControl = new UntypedFormControl(false);
2109
+ this.optionsFiltered$ = new ReplaySubject(1);
2110
+ this.compareFn = (o1, o2) => {
2111
+ if (this.field.property && o1 && o2) {
2112
+ return o1[this.field.property] === o2[this.field.property];
2113
+ }
2114
+ return o1 === o2;
2115
+ };
2116
+ }
2117
+ ngOnInit() {
2118
+ super.ngOnInit();
2119
+ if (!(this.field.options instanceof Observable)) {
2120
+ this.options$ = of(this.field.options);
2121
+ }
2122
+ else {
2123
+ this.options$ = this.field.options;
2124
+ }
2125
+ this.searchControl.valueChanges.pipe(startWith(this.searchControl.value), takeUntil(this._onDestroy), switchMap(value => {
2126
+ if (value) {
2127
+ const search = value.toLowerCase();
2128
+ return this.options$.pipe(map(options => {
2129
+ return options
2130
+ .filter(option => {
2131
+ if (this.field.searchKeys && this.field.searchKeys.length) {
2132
+ return this.field.searchKeys.some(searchKey => {
2133
+ if (option[searchKey]) {
2134
+ return option[searchKey].toString().toLowerCase().indexOf(search) > -1;
2135
+ }
2136
+ return false;
2137
+ }) || (this.field.property ?
2138
+ option[this.field.property].toString().toLowerCase().indexOf(search) > -1 : false);
2139
+ }
2140
+ else {
2141
+ if (this.field.property) {
2142
+ return option[this.field.property].toString().toLowerCase().indexOf(search) > -1;
2143
+ }
2144
+ }
2145
+ return option.toString().toLowerCase().indexOf(search) > -1;
2146
+ });
2147
+ }));
2148
+ }
2149
+ else {
2150
+ return this.options$;
2151
+ }
2152
+ })).subscribe(this.optionsFiltered$);
2153
+ this.group.controls[this.field.name]
2154
+ .valueChanges.pipe(takeUntil(this._onDestroy), startWith(this.group.controls[this.field.name].value), switchMap(selected => {
2155
+ return this.optionsFiltered$.pipe(map((options) => options.filter((option) => !(option === null || option === void 0 ? void 0 : option.disabled))), map(options => {
2156
+ if (!selected) {
2157
+ return false;
2158
+ }
2159
+ if (options.length < selected.length) {
2160
+ return options.length > 0 && options.every(o => selected.includes(o));
2161
+ }
2162
+ else {
2163
+ return options.length > 0 && options.length === selected.length && selected.every(s => options.includes(s));
2164
+ }
2165
+ }));
2166
+ })).subscribe(isChecked => {
2167
+ this.selectAllControl.setValue(isChecked);
2168
+ });
2169
+ }
2170
+ ngOnDestroy() {
2171
+ // this._onDestroy.next();
2172
+ super.ngOnDestroy();
2173
+ }
2174
+ toggleAllSelection(state) {
2175
+ if (state.checked) {
2176
+ this.optionsFiltered$.pipe(take(1), map((options) => options.filter((option) => !(option === null || option === void 0 ? void 0 : option.disabled)))).subscribe(options => {
2177
+ if (options.length > 0) {
2178
+ this.group.controls[this.field.name].patchValue(options.slice());
2179
+ }
2180
+ });
2181
+ }
2182
+ else {
2183
+ this.group.controls[this.field.name].patchValue([]);
2184
+ }
2185
+ }
2186
+ openChange($event) {
2187
+ if (this.field.virtualScroll) {
2188
+ if ($event) {
2189
+ this.cdkVirtualScrollViewport.scrollToIndex(0);
2190
+ this.cdkVirtualScrollViewport.checkViewportSize();
2191
+ }
2192
+ }
2193
+ }
2194
+ }
2195
+ KlesFormSelectSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSelectSearchComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2196
+ KlesFormSelectSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormSelectSearchComponent, selector: "kles-form-select-search", viewQueries: [{ propertyName: "cdkVirtualScrollViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }, { propertyName: "options", predicate: MatOption, descendants: true }], usesInheritance: true, ngImport: i0, template: `
2197
+ <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
2198
+ <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2199
+ (openedChange)="openChange($event)" [compareWith]="compareFn"
2200
+ [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
2201
+ <mat-select-trigger *ngIf="field.triggerComponent">
2202
+ <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
2203
+ </mat-select-trigger>
2204
+
2205
+ <ng-container *ngIf="field.virtualScroll">
2206
+ <mat-option>
2207
+ <ngx-mat-select-search [formControl]="searchControl"
2208
+ placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2209
+ </mat-option>
2210
+
2211
+ <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
2212
+ <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2213
+ (change)="toggleAllSelection($event)">
2214
+ {{'selectAll' | translate}}
2215
+ </mat-checkbox>
2216
+ <ng-container *ngIf="!field.autocompleteComponent">
2217
+ <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2218
+
2219
+ <ng-container *ngIf="field.multiple">
2220
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2221
+ style="display:none">
2222
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2223
+ </mat-option>
2224
+ </ng-container>
2225
+
2226
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2227
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2228
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2229
+ </mat-option>
2230
+ </ng-container>
2231
+ </ng-container>
2232
+
2233
+ <ng-container *ngIf="field.autocompleteComponent">
2234
+ <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2235
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2236
+ </mat-option>
2237
+
2238
+ <ng-container *ngIf="field.multiple">
2239
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2240
+ style="display:none">
2241
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2242
+ </mat-option>
2243
+ </ng-container>
2244
+
2245
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2246
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2247
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2248
+ </mat-option>
2249
+ </ng-container>
2250
+ </ng-container>
2251
+ </cdk-virtual-scroll-viewport>
2252
+
2253
+ </ng-container>
2254
+
2255
+ <ng-container *ngIf="!field.virtualScroll">
2256
+
2257
+ <mat-option>
2258
+ <ngx-mat-select-search [formControl]="searchControl"
2259
+ placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2260
+ </mat-option>
2261
+
2262
+ <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2263
+ (change)="toggleAllSelection($event)">
2264
+ {{'selectAll' | translate}}
2265
+ </mat-checkbox>
2266
+
2267
+ <ng-container *ngIf="!field.autocompleteComponent">
2268
+ <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2269
+ </ng-container>
2270
+
2271
+ <ng-container *ngIf="field.autocompleteComponent">
2272
+ <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2273
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2274
+ </mat-option>
2275
+ </ng-container>
2276
+ </ng-container>
2277
+
2278
+
2279
+ </mat-select>
2280
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2281
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2282
+ </ng-container>
2283
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2284
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2285
+ </ng-container>
2286
+ </mat-form-field>
2287
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n", ".selectAll{padding:10px 16px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i5$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "directive", type: i5$1.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i6$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i8$1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i8$1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i8$1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: i10.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "noEntriesFoundLabel", "indexAndLengthScreenReaderText", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toogleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti"], outputs: ["toggleAll"] }, { kind: "directive", type: KlesComponentDirective, selector: "[klesComponent]", inputs: ["component", "value", "field"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.SlicePipe, name: "slice" }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
2288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSelectSearchComponent, decorators: [{
2289
+ type: Component,
2290
+ args: [{ selector: 'kles-form-select-search', template: `
2291
+ <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
2292
+ <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2293
+ (openedChange)="openChange($event)" [compareWith]="compareFn"
2294
+ [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
2295
+ <mat-select-trigger *ngIf="field.triggerComponent">
2296
+ <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
2297
+ </mat-select-trigger>
2298
+
2299
+ <ng-container *ngIf="field.virtualScroll">
2300
+ <mat-option>
2301
+ <ngx-mat-select-search [formControl]="searchControl"
2302
+ placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2303
+ </mat-option>
2304
+
2305
+ <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
2306
+ <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2307
+ (change)="toggleAllSelection($event)">
2308
+ {{'selectAll' | translate}}
2309
+ </mat-checkbox>
2310
+ <ng-container *ngIf="!field.autocompleteComponent">
2311
+ <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2312
+
2313
+ <ng-container *ngIf="field.multiple">
2314
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2315
+ style="display:none">
2316
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2317
+ </mat-option>
2318
+ </ng-container>
2319
+
2320
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2321
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2322
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2323
+ </mat-option>
2324
+ </ng-container>
2325
+ </ng-container>
2326
+
2327
+ <ng-container *ngIf="field.autocompleteComponent">
2328
+ <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2329
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2330
+ </mat-option>
2331
+
2332
+ <ng-container *ngIf="field.multiple">
2333
+ <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2334
+ style="display:none">
2335
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2336
+ </mat-option>
2337
+ </ng-container>
2338
+
2339
+ <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2340
+ <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2341
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2342
+ </mat-option>
2343
+ </ng-container>
2344
+ </ng-container>
2345
+ </cdk-virtual-scroll-viewport>
2346
+
2347
+ </ng-container>
2348
+
2349
+ <ng-container *ngIf="!field.virtualScroll">
2350
+
2351
+ <mat-option>
2352
+ <ngx-mat-select-search [formControl]="searchControl"
2353
+ placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2354
+ </mat-option>
2355
+
2356
+ <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2357
+ (change)="toggleAllSelection($event)">
2358
+ {{'selectAll' | translate}}
2359
+ </mat-checkbox>
2360
+
2361
+ <ng-container *ngIf="!field.autocompleteComponent">
2362
+ <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2363
+ </ng-container>
2364
+
2365
+ <ng-container *ngIf="field.autocompleteComponent">
2366
+ <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2367
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2368
+ </mat-option>
2369
+ </ng-container>
2370
+ </ng-container>
2371
+
2372
+
2373
+ </mat-select>
2374
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2375
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2376
+ </ng-container>
2377
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2378
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2379
+ </ng-container>
2380
+ </mat-form-field>
2381
+ `, styles: ["mat-form-field{width:100%}\n", ".selectAll{padding:10px 16px}\n"] }]
2382
+ }], propDecorators: { cdkVirtualScrollViewport: [{
2383
+ type: ViewChild,
2384
+ args: [CdkVirtualScrollViewport]
2385
+ }], options: [{
2386
+ type: ViewChildren,
2387
+ args: [MatOption]
2388
+ }] } });
2389
+
2390
+ let KlesFormLineBreakComponent = class KlesFormLineBreakComponent extends KlesFieldAbstract {
2391
+ ngOnInit() { super.ngOnInit(); }
2392
+ ngOnDestroy() {
2393
+ super.ngOnDestroy();
2394
+ }
2395
+ };
2396
+ KlesFormLineBreakComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormLineBreakComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2397
+ KlesFormLineBreakComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormLineBreakComponent, selector: "kles-form-line-break", usesInheritance: true, ngImport: i0, template: ``, isInline: true, styles: [":host{flex-basis:100%;display:flex;height:0}\n"] });
2398
+ KlesFormLineBreakComponent = __decorate([
2399
+ FieldMapper({ type: EnumType.lineBreak })
2400
+ ], KlesFormLineBreakComponent);
2401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormLineBreakComponent, decorators: [{
2402
+ type: Component,
2403
+ args: [{ selector: 'kles-form-line-break', template: ``, styles: [":host{flex-basis:100%;display:flex;height:0}\n"] }]
2404
+ }] });
2405
+
2406
+ class ArrayFormatPipe {
2407
+ transform(values, property) {
2408
+ if (values && Array.isArray(values)) {
2409
+ if (property) {
2410
+ return values.map(value => value[property]).filter(Boolean).join(', ');
2411
+ }
2412
+ else {
2413
+ return values.join(', ');
2414
+ }
2415
+ }
2416
+ return '';
2417
+ }
2418
+ }
2419
+ ArrayFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ArrayFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2420
+ ArrayFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: ArrayFormatPipe, name: "arrayFormat" });
2421
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: ArrayFormatPipe, decorators: [{
2422
+ type: Pipe,
2423
+ args: [{ name: 'arrayFormat' }]
2424
+ }] });
2425
+
2426
+ class KlesFormLinkComponent extends KlesFieldAbstract {
2427
+ ngOnInit() {
2428
+ super.ngOnInit();
2429
+ }
2430
+ ngOnDestroy() {
2431
+ super.ngOnDestroy();
2432
+ }
2433
+ }
2434
+ KlesFormLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2435
+ KlesFormLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormLinkComponent, selector: "kles-form-link", usesInheritance: true, ngImport: i0, template: `
2436
+ <a [href]="group.controls[field.name].value" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
2437
+ {{field.label}}
2438
+ </a>
2439
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
2440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormLinkComponent, decorators: [{
2441
+ type: Component,
2442
+ args: [{
2443
+ selector: 'kles-form-link',
2444
+ template: `
2445
+ <a [href]="group.controls[field.name].value" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
2446
+ {{field.label}}
2447
+ </a>
2448
+ `
2449
+ }]
2450
+ }] });
2451
+
2452
+ class KlesFormSlideToggleComponent extends KlesFieldAbstract {
2453
+ ngOnInit() { super.ngOnInit(); }
2454
+ ngOnDestroy() {
2455
+ super.ngOnDestroy();
2456
+ }
2457
+ }
2458
+ KlesFormSlideToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSlideToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2459
+ KlesFormSlideToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormSlideToggleComponent, selector: "kles-form-slide-toggle", usesInheritance: true, ngImport: i0, template: `
2460
+ <div [formGroup]="group" >
2461
+ <mat-slide-toggle matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [color]="field.color" [formControlName]="field.name">{{field.label | translate}}</mat-slide-toggle>
2462
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2463
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2464
+ </ng-container>
2465
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2466
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2467
+ </ng-container>
2468
+ </div>
2469
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i6$3.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }, { kind: "pipe", type: i7$1.TranslatePipe, name: "translate" }] });
2470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSlideToggleComponent, decorators: [{
2471
+ type: Component,
2472
+ args: [{ selector: 'kles-form-slide-toggle', template: `
2473
+ <div [formGroup]="group" >
2474
+ <mat-slide-toggle matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [color]="field.color" [formControlName]="field.name">{{field.label | translate}}</mat-slide-toggle>
2475
+ <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2476
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2477
+ </ng-container>
2478
+ <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2479
+ <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2480
+ </ng-container>
2481
+ </div>
2482
+ ` }]
2483
+ }] });
2484
+
2485
+ class KlesFormSelectionListComponent extends KlesFieldAbstract {
2486
+ ngOnInit() {
2487
+ super.ngOnInit();
2488
+ if (!(this.field.options instanceof Observable)) {
2489
+ this.options$ = of(this.field.options);
2490
+ }
2491
+ else {
2492
+ this.options$ = this.field.options;
2493
+ }
2494
+ }
2495
+ ngOnDestroy() {
2496
+ super.ngOnDestroy();
2497
+ }
2498
+ }
2499
+ KlesFormSelectionListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSelectionListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2500
+ KlesFormSelectionListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormSelectionListComponent, selector: "kles-form-selection-list", usesInheritance: true, ngImport: i0, template: `
2501
+ <div class="margin-top" [formGroup]="group">
2502
+ <mat-selection-list [formControlName]="field.name" [attr.id]="field.id" [multiple]="field.multiple" [ngClass]="field.ngClass">
2503
+ <ng-container *ngIf="!field.autocompleteComponent">
2504
+ <mat-list-option [value]="item" *ngFor="let item of options$ | async;">
2505
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2506
+ </mat-list-option>
2507
+ </ng-container>
2508
+
2509
+ <ng-container *ngIf="field.autocompleteComponent">
2510
+ <mat-list-option *ngFor="let item of options$ | async;" [value]="item">
2511
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2512
+ </mat-list-option>
2513
+ </ng-container>
2514
+ </mat-selection-list>
2515
+ </div>
2516
+ `, isInline: true, styles: ["mat-selection-list{width:100%;height:250px;overflow:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: i4$4.MatSelectionList, selector: "mat-selection-list", inputs: ["disableRipple", "color", "compareWith", "disabled", "multiple"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: i4$4.MatListOption, selector: "mat-list-option", inputs: ["disableRipple", "checkboxPosition", "color", "value", "disabled", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }, { kind: "directive", type: KlesComponentDirective, selector: "[klesComponent]", inputs: ["component", "value", "field"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
2517
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormSelectionListComponent, decorators: [{
2518
+ type: Component,
2519
+ args: [{ selector: 'kles-form-selection-list', template: `
2520
+ <div class="margin-top" [formGroup]="group">
2521
+ <mat-selection-list [formControlName]="field.name" [attr.id]="field.id" [multiple]="field.multiple" [ngClass]="field.ngClass">
2522
+ <ng-container *ngIf="!field.autocompleteComponent">
2523
+ <mat-list-option [value]="item" *ngFor="let item of options$ | async;">
2524
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2525
+ </mat-list-option>
2526
+ </ng-container>
2527
+
2528
+ <ng-container *ngIf="field.autocompleteComponent">
2529
+ <mat-list-option *ngFor="let item of options$ | async;" [value]="item">
2530
+ <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2531
+ </mat-list-option>
2532
+ </ng-container>
2533
+ </mat-selection-list>
2534
+ </div>
2535
+ `, styles: ["mat-selection-list{width:100%;height:250px;overflow:auto}\n"] }]
2536
+ }] });
2537
+
2538
+ let KlesFormBadgeComponent = class KlesFormBadgeComponent extends KlesFieldAbstract {
2539
+ ngOnInit() {
2540
+ super.ngOnInit();
2541
+ }
2542
+ ngOnDestroy() {
2543
+ super.ngOnDestroy();
2544
+ }
2545
+ };
2546
+ KlesFormBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormBadgeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2547
+ KlesFormBadgeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormBadgeComponent, selector: "kles-form-badge", usesInheritance: true, ngImport: i0, template: `
2548
+ <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2549
+ matBadge="{{group.controls[field.name].value}}" matBadgeOverlap="false" matBadgeColor="{{field.color}}">
2550
+ </span>
2551
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i2$1.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
2552
+ KlesFormBadgeComponent = __decorate([
2553
+ FieldMapper({ type: EnumType.badge })
2554
+ ], KlesFormBadgeComponent);
2555
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormBadgeComponent, decorators: [{
2556
+ type: Component,
2557
+ args: [{
2558
+ selector: 'kles-form-badge',
2559
+ template: `
2560
+ <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2561
+ matBadge="{{group.controls[field.name].value}}" matBadgeOverlap="false" matBadgeColor="{{field.color}}">
2562
+ </span>
2563
+ `
2564
+ }]
2565
+ }] });
2566
+
2567
+ class KlesFormButtonToogleGroupComponent extends KlesFieldAbstract {
2568
+ ngOnInit() {
2569
+ super.ngOnInit();
2570
+ if (!(this.field.options instanceof Observable)) {
2571
+ this.options$ = of(this.field.options);
2572
+ }
2573
+ else {
2574
+ this.options$ = this.field.options;
2575
+ }
2576
+ }
2577
+ ngOnDestroy() {
2578
+ super.ngOnDestroy();
2579
+ }
2580
+ }
2581
+ KlesFormButtonToogleGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonToogleGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2582
+ KlesFormButtonToogleGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormButtonToogleGroupComponent, selector: "kles-form-button-toogle-group", usesInheritance: true, ngImport: i0, template: `
2583
+ <div [formGroup]="group" class="form-element">
2584
+ <mat-button-toggle-group [formControlName]="field.name" [multiple]="field.multiple"
2585
+ [attr.id]="field.id" [ngClass]="field.ngClass">
2586
+ <mat-button-toggle *ngFor="let item of options$ | async" [value]="item">
2587
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2588
+ </mat-button-toggle>
2589
+ </mat-button-toggle-group>
2590
+ </div>
2591
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i4$5.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i4$5.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
2592
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormButtonToogleGroupComponent, decorators: [{
2593
+ type: Component,
2594
+ args: [{
2595
+ selector: 'kles-form-button-toogle-group',
2596
+ template: `
2597
+ <div [formGroup]="group" class="form-element">
2598
+ <mat-button-toggle-group [formControlName]="field.name" [multiple]="field.multiple"
2599
+ [attr.id]="field.id" [ngClass]="field.ngClass">
2600
+ <mat-button-toggle *ngFor="let item of options$ | async" [value]="item">
2601
+ {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2602
+ </mat-button-toggle>
2603
+ </mat-button-toggle-group>
2604
+ </div>
2605
+ `
2606
+ }]
2607
+ }] });
2608
+
2609
+ let KlesFormArrayComponent = class KlesFormArrayComponent extends KlesFieldAbstract {
2610
+ ngOnInit() {
2611
+ // this.subGroup = this.group.controls[this.field.name] as FormGroup;
2612
+ super.ngOnInit();
2613
+ this.formArray = this.group.controls[this.field.name];
2614
+ }
2615
+ ngOnDestroy() {
2616
+ super.ngOnDestroy();
2617
+ }
2618
+ };
2619
+ KlesFormArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2620
+ KlesFormArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.2", type: KlesFormArrayComponent, selector: "kles-array", usesInheritance: true, ngImport: i0, template: `
2621
+ <div [formGroup]="group">
2622
+ <ng-container [formArrayName]="field.name">
2623
+ <div class="group-container" *ngFor="let subGroup of formArray.controls let index = index;"
2624
+ [ngClass]="field.direction === 'column' ? 'column': 'row'">
2625
+ <ng-container *ngFor="let subfield of field.collections;"
2626
+ klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
2627
+ </ng-container>
2628
+ </div>
2629
+ </ng-container>
2630
+ </div>
2631
+ `, isInline: true, styles: ["mat-form-field{width:100%}\n", ":host{display:flex;flex-direction:inherit}\n", ".group-container{display:flex;flex-direction:inherit}\n", ".row{gap:10px;flex-direction:row}\n", ".column{flex-direction:column;gap:0px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i3.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: ["field", "group", "siblingFields"] }] });
2632
+ KlesFormArrayComponent = __decorate([
2633
+ FieldMapper({ type: EnumType.array })
2634
+ ], KlesFormArrayComponent);
2635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesFormArrayComponent, decorators: [{
2636
+ type: Component,
2637
+ args: [{ selector: 'kles-array', template: `
2638
+ <div [formGroup]="group">
2639
+ <ng-container [formArrayName]="field.name">
2640
+ <div class="group-container" *ngFor="let subGroup of formArray.controls let index = index;"
2641
+ [ngClass]="field.direction === 'column' ? 'column': 'row'">
2642
+ <ng-container *ngFor="let subfield of field.collections;"
2643
+ klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
2644
+ </ng-container>
2645
+ </div>
2646
+ </ng-container>
2647
+ </div>
2648
+ `, styles: ["mat-form-field{width:100%}\n", ":host{display:flex;flex-direction:inherit}\n", ".group-container{display:flex;flex-direction:inherit}\n", ".row{gap:10px;flex-direction:row}\n", ".column{flex-direction:column;gap:0px}\n"] }]
2649
+ }] });
2650
+
2651
+ const components = [
2652
+ KlesDynamicFormComponent,
2653
+ KlesFormLabelComponent,
2654
+ KlesFormInputComponent,
2655
+ KlesFormInputClearableComponent,
2656
+ KlesFormSubmitButtonComponent,
2657
+ KlesFormBadgeComponent,
2658
+ KlesButtonComponent,
2659
+ KlesFormButtonComponent,
2660
+ KlesButtonCheckerComponent,
2661
+ KlesFormButtonCheckerComponent,
2662
+ KlesButtonFileComponent,
2663
+ KlesFormButtonFileComponent,
2664
+ KlesFormSelectComponent,
2665
+ KlesFormDateComponent,
2666
+ KlesFormRadioComponent,
2667
+ KlesFormCheckboxComponent,
2668
+ KlesFormListFieldComponent,
2669
+ KlesFormColorComponent,
2670
+ KlesFormTextareaComponent,
2671
+ KlesFormTextComponent,
2672
+ KlesFormChipComponent,
2673
+ KlesFormGroupComponent,
2674
+ KlesFormIconComponent,
2675
+ KlesFormSelectSearchComponent,
2676
+ KlesFormLineBreakComponent,
2677
+ KlesFormLinkComponent,
2678
+ KlesFormSlideToggleComponent,
2679
+ KlesFormSelectionListComponent,
2680
+ KlesFormButtonToogleGroupComponent,
2681
+ KlesFormArrayComponent
2682
+ ];
2683
+ const directives = [KlesDynamicFieldDirective, KlesComponentDirective];
2684
+ const pipes = [KlesTransformPipe, ArrayFormatPipe];
2685
+ class KlesMaterialDynamicformsModule {
2686
+ }
2687
+ KlesMaterialDynamicformsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesMaterialDynamicformsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2688
+ KlesMaterialDynamicformsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.2", ngImport: i0, type: KlesMaterialDynamicformsModule, declarations: [KlesDynamicFormComponent,
2689
+ KlesFormLabelComponent,
2690
+ KlesFormInputComponent,
2691
+ KlesFormInputClearableComponent,
2692
+ KlesFormSubmitButtonComponent,
2693
+ KlesFormBadgeComponent,
2694
+ KlesButtonComponent,
2695
+ KlesFormButtonComponent,
2696
+ KlesButtonCheckerComponent,
2697
+ KlesFormButtonCheckerComponent,
2698
+ KlesButtonFileComponent,
2699
+ KlesFormButtonFileComponent,
2700
+ KlesFormSelectComponent,
2701
+ KlesFormDateComponent,
2702
+ KlesFormRadioComponent,
2703
+ KlesFormCheckboxComponent,
2704
+ KlesFormListFieldComponent,
2705
+ KlesFormColorComponent,
2706
+ KlesFormTextareaComponent,
2707
+ KlesFormTextComponent,
2708
+ KlesFormChipComponent,
2709
+ KlesFormGroupComponent,
2710
+ KlesFormIconComponent,
2711
+ KlesFormSelectSearchComponent,
2712
+ KlesFormLineBreakComponent,
2713
+ KlesFormLinkComponent,
2714
+ KlesFormSlideToggleComponent,
2715
+ KlesFormSelectionListComponent,
2716
+ KlesFormButtonToogleGroupComponent,
2717
+ KlesFormArrayComponent, KlesDynamicFieldDirective, KlesComponentDirective, KlesTransformPipe, ArrayFormatPipe], imports: [CommonModule,
2718
+ ReactiveFormsModule,
2719
+ TranslateModule,
2720
+ FlexLayoutModule,
2721
+ FormsModule,
2722
+ MaterialModule,
2723
+ ColorPickerModule,
2724
+ NgxMatSelectSearchModule], exports: [KlesDynamicFormComponent,
2725
+ KlesFormLabelComponent,
2726
+ KlesFormInputComponent,
2727
+ KlesFormInputClearableComponent,
2728
+ KlesFormSubmitButtonComponent,
2729
+ KlesFormBadgeComponent,
2730
+ KlesButtonComponent,
2731
+ KlesFormButtonComponent,
2732
+ KlesButtonCheckerComponent,
2733
+ KlesFormButtonCheckerComponent,
2734
+ KlesButtonFileComponent,
2735
+ KlesFormButtonFileComponent,
2736
+ KlesFormSelectComponent,
2737
+ KlesFormDateComponent,
2738
+ KlesFormRadioComponent,
2739
+ KlesFormCheckboxComponent,
2740
+ KlesFormListFieldComponent,
2741
+ KlesFormColorComponent,
2742
+ KlesFormTextareaComponent,
2743
+ KlesFormTextComponent,
2744
+ KlesFormChipComponent,
2745
+ KlesFormGroupComponent,
2746
+ KlesFormIconComponent,
2747
+ KlesFormSelectSearchComponent,
2748
+ KlesFormLineBreakComponent,
2749
+ KlesFormLinkComponent,
2750
+ KlesFormSlideToggleComponent,
2751
+ KlesFormSelectionListComponent,
2752
+ KlesFormButtonToogleGroupComponent,
2753
+ KlesFormArrayComponent, KlesTransformPipe, ArrayFormatPipe, KlesDynamicFieldDirective, KlesComponentDirective, ColorPickerModule] });
2754
+ KlesMaterialDynamicformsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesMaterialDynamicformsModule, providers: [
2755
+ { provide: ErrorStateMatcher, useClass: KlesFormErrorStateMatcher },
2756
+ pipes
2757
+ ], imports: [CommonModule,
2758
+ ReactiveFormsModule,
2759
+ TranslateModule,
2760
+ FlexLayoutModule,
2761
+ FormsModule,
2762
+ MaterialModule,
2763
+ ColorPickerModule,
2764
+ NgxMatSelectSearchModule, ColorPickerModule] });
2765
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: KlesMaterialDynamicformsModule, decorators: [{
2766
+ type: NgModule,
2767
+ args: [{
2768
+ declarations: [
2769
+ components,
2770
+ directives,
2771
+ pipes
2772
+ ],
2773
+ imports: [
2774
+ CommonModule,
2775
+ ReactiveFormsModule,
2776
+ TranslateModule,
2777
+ FlexLayoutModule,
2778
+ FormsModule,
2779
+ MaterialModule,
2780
+ ColorPickerModule,
2781
+ NgxMatSelectSearchModule
2782
+ ],
2783
+ providers: [
2784
+ { provide: ErrorStateMatcher, useClass: KlesFormErrorStateMatcher },
2785
+ pipes
2786
+ ],
2787
+ exports: [
2788
+ components,
2789
+ pipes,
2790
+ directives,
2791
+ ColorPickerModule
2792
+ ],
2793
+ schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
2794
+ }]
2795
+ }] });
2796
+
2797
+ function autocompleteObjectValidator(optional) {
2798
+ return (control) => {
2799
+ if ((control.value === null || control.value === undefined) && !optional)
2800
+ return { 'invalidAutocompleteObject': { value: control.value } };
2801
+ if (typeof control.value === 'string') {
2802
+ if (control.value === '' && optional)
2803
+ return null;
2804
+ return { 'invalidAutocompleteObject': { value: control.value } };
2805
+ }
2806
+ return null; /* valid option selected */
2807
+ };
2808
+ }
2809
+ function autocompleteStringValidator(validOptions, optional) {
2810
+ return (control) => {
2811
+ if ((control.value === '' || control.value === null) && optional)
2812
+ return null;
2813
+ if (validOptions.indexOf(control.value) !== -1) {
2814
+ return null; /* valid option selected */
2815
+ }
2816
+ return { 'invalidAutocompleteString': { value: control.value } };
2817
+ };
2818
+ }
2819
+
2820
+ /*
2821
+ * Public API Surface of kles-material-dynamicforms
2822
+ */
2823
+
2824
+ /**
2825
+ * Generated bundle index. Do not edit.
2826
+ */
2827
+
2828
+ export { ArrayFormatPipe, EnumType, FieldMapper, KlesButtonCheckerComponent, KlesButtonComponent, KlesButtonFileComponent, KlesComponentDirective, KlesDynamicFieldDirective, KlesDynamicFormComponent, KlesFieldAbstract, KlesFormArrayComponent, KlesFormBadgeComponent, KlesFormButtonCheckerComponent, KlesFormButtonComponent, KlesFormButtonFileComponent, KlesFormButtonToogleGroupComponent, KlesFormCheckboxComponent, KlesFormChipComponent, KlesFormColorComponent, KlesFormDateComponent, KlesFormErrorStateMatcher, KlesFormGroupComponent, KlesFormIconComponent, KlesFormInputClearableComponent, KlesFormInputComponent, KlesFormLabelComponent, KlesFormLineBreakComponent, KlesFormLinkComponent, KlesFormListFieldComponent, KlesFormRadioComponent, KlesFormSelectComponent, KlesFormSelectSearchComponent, KlesFormSelectionListComponent, KlesFormSlideToggleComponent, KlesFormSubmitButtonComponent, KlesFormTextComponent, KlesFormTextareaComponent, KlesMaterialDynamicformsModule, KlesTransformPipe, autocompleteObjectValidator, autocompleteStringValidator, componentMapper };
2829
+ //# sourceMappingURL=3kles-kles-material-dynamicforms.mjs.map