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