@3kles/kles-material-dynamicforms 15.0.0 → 16.0.3

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 (86) hide show
  1. package/{esm2020 → esm2022}/lib/directive/dynamic-component.directive.mjs +4 -4
  2. package/esm2022/lib/directive/dynamic-field.directive.mjs +83 -0
  3. package/{esm2020 → esm2022}/lib/dynamic-form.component.mjs +6 -6
  4. package/{esm2020 → esm2022}/lib/fields/array.component.mjs +6 -6
  5. package/{esm2020 → esm2022}/lib/fields/badge.component.mjs +6 -6
  6. package/{esm2020 → esm2022}/lib/fields/button-form.component.mjs +6 -6
  7. package/{esm2020 → esm2022}/lib/fields/button-submit.component.mjs +6 -6
  8. package/{esm2020 → esm2022}/lib/fields/button-toogle-group.component.mjs +6 -6
  9. package/{esm2020 → esm2022}/lib/fields/buttonchecker-form.component.mjs +12 -8
  10. package/{esm2020 → esm2022}/lib/fields/buttonfile-form.component.mjs +9 -6
  11. package/{esm2020 → esm2022}/lib/fields/checkbox.component.mjs +6 -6
  12. package/{esm2020 → esm2022}/lib/fields/chip.component.mjs +6 -6
  13. package/esm2022/lib/fields/clear.component.mjs +30 -0
  14. package/{esm2020 → esm2022}/lib/fields/color.component.mjs +8 -8
  15. package/esm2022/lib/fields/date-time.component.mjs +61 -0
  16. package/{esm2020 → esm2022}/lib/fields/date.component.mjs +8 -8
  17. package/{esm2020 → esm2022}/lib/fields/field.abstract.mjs +4 -4
  18. package/{esm2020 → esm2022}/lib/fields/group.component.mjs +6 -6
  19. package/{esm2020 → esm2022}/lib/fields/icon.component.mjs +6 -6
  20. package/{esm2020 → esm2022}/lib/fields/input.clearable.component.mjs +6 -6
  21. package/{esm2020 → esm2022}/lib/fields/input.component.mjs +8 -8
  22. package/{esm2020 → esm2022}/lib/fields/label.component.mjs +6 -6
  23. package/{esm2020 → esm2022}/lib/fields/line-break.component.mjs +4 -4
  24. package/{esm2020 → esm2022}/lib/fields/link.component.mjs +6 -6
  25. package/esm2022/lib/fields/list-field.component.mjs +122 -0
  26. package/{esm2020 → esm2022}/lib/fields/radio.component.mjs +6 -6
  27. package/{esm2020 → esm2022}/lib/fields/range.component.mjs +6 -6
  28. package/{esm2020 → esm2022}/lib/fields/select.component.mjs +8 -8
  29. package/esm2022/lib/fields/select.lazy-search.component.mjs +278 -0
  30. package/esm2022/lib/fields/select.search.component.mjs +396 -0
  31. package/{esm2020 → esm2022}/lib/fields/selection-list.component.mjs +6 -6
  32. package/{esm2020 → esm2022}/lib/fields/slide-toggle.component.mjs +6 -6
  33. package/{esm2020 → esm2022}/lib/fields/text.component.mjs +6 -6
  34. package/{esm2020 → esm2022}/lib/fields/textarea.component.mjs +8 -8
  35. package/esm2022/lib/forms/button-control.component.mjs +121 -0
  36. package/{esm2020 → esm2022}/lib/forms/buttonchecker-control.component.mjs +12 -12
  37. package/esm2022/lib/forms/buttonfile-control.component.mjs +124 -0
  38. package/esm2022/lib/interfaces/field.config.interface.mjs +2 -0
  39. package/esm2022/lib/kles-material-dynamicforms.module.mjs +219 -0
  40. package/{esm2020 → esm2022}/lib/matcher/form-error.matcher.mjs +4 -4
  41. package/esm2022/lib/modules/material.module.mjs +279 -0
  42. package/{esm2020 → esm2022}/lib/pipe/array.pipe.mjs +4 -4
  43. package/{esm2020 → esm2022}/lib/pipe/transform.pipe.mjs +4 -4
  44. package/esm2022/public-api.mjs +72 -0
  45. package/{fesm2020 → fesm2022}/3kles-kles-material-dynamicforms.mjs +623 -537
  46. package/fesm2022/3kles-kles-material-dynamicforms.mjs.map +1 -0
  47. package/lib/directive/dynamic-component.directive.d.ts +1 -1
  48. package/lib/directive/dynamic-field.directive.d.ts +1 -1
  49. package/lib/dynamic-form.component.d.ts +1 -1
  50. package/lib/fields/date-time.component.d.ts +9 -0
  51. package/lib/forms/button-control.component.d.ts +1 -1
  52. package/lib/forms/buttonfile-control.component.d.ts +1 -1
  53. package/lib/interfaces/field.config.interface.d.ts +5 -1
  54. package/lib/kles-material-dynamicforms.module.d.ts +14 -12
  55. package/lib/modules/material.module.d.ts +3 -2
  56. package/package.json +19 -25
  57. package/public-api.d.ts +1 -0
  58. package/esm2020/lib/directive/dynamic-field.directive.mjs +0 -78
  59. package/esm2020/lib/fields/clear.component.mjs +0 -31
  60. package/esm2020/lib/fields/list-field.component.mjs +0 -114
  61. package/esm2020/lib/fields/select.lazy-search.component.mjs +0 -278
  62. package/esm2020/lib/fields/select.search.component.mjs +0 -396
  63. package/esm2020/lib/forms/button-control.component.mjs +0 -119
  64. package/esm2020/lib/forms/buttonfile-control.component.mjs +0 -122
  65. package/esm2020/lib/interfaces/field.config.interface.mjs +0 -2
  66. package/esm2020/lib/kles-material-dynamicforms.module.mjs +0 -208
  67. package/esm2020/lib/modules/material.module.mjs +0 -272
  68. package/esm2020/public-api.mjs +0 -71
  69. package/fesm2015/3kles-kles-material-dynamicforms.mjs +0 -3598
  70. package/fesm2015/3kles-kles-material-dynamicforms.mjs.map +0 -1
  71. package/fesm2020/3kles-kles-material-dynamicforms.mjs.map +0 -1
  72. /package/{esm2020 → esm2022}/3kles-kles-material-dynamicforms.mjs +0 -0
  73. /package/{esm2020 → esm2022}/lib/controls/array.control.mjs +0 -0
  74. /package/{esm2020 → esm2022}/lib/controls/control.interface.mjs +0 -0
  75. /package/{esm2020 → esm2022}/lib/controls/default.control.mjs +0 -0
  76. /package/{esm2020 → esm2022}/lib/controls/group.control.mjs +0 -0
  77. /package/{esm2020 → esm2022}/lib/controls/range.control.mjs +0 -0
  78. /package/{esm2020 → esm2022}/lib/decorators/component.decorator.mjs +0 -0
  79. /package/{esm2020 → esm2022}/lib/enums/type.enum.mjs +0 -0
  80. /package/{esm2020 → esm2022}/lib/factories/field.factory.mjs +0 -0
  81. /package/{esm2020 → esm2022}/lib/interfaces/clear-control.interface.mjs +0 -0
  82. /package/{esm2020 → esm2022}/lib/interfaces/component.interface.mjs +0 -0
  83. /package/{esm2020 → esm2022}/lib/interfaces/directive.interface.mjs +0 -0
  84. /package/{esm2020 → esm2022}/lib/interfaces/field.interface.mjs +0 -0
  85. /package/{esm2020 → esm2022}/lib/interfaces/validator.interface.mjs +0 -0
  86. /package/{esm2020 → esm2022}/lib/validators/autocomplete.validator.mjs +0 -0
@@ -1,3598 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, Injector, Directive, Input, EventEmitter, Output, Injectable, NgModule, HostBinding, 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 { FormControl, Validators, FormControlDirective, FormControlName, NG_VALUE_ACCESSOR, UntypedFormGroup, UntypedFormControl, FormArray, FormGroup, ReactiveFormsModule, FormsModule } from '@angular/forms';
7
- import { concat, of, Subject, Observable, BehaviorSubject, ReplaySubject } from 'rxjs';
8
- import { take, catchError, map, takeUntil, startWith, switchMap, debounceTime } from 'rxjs/operators';
9
- import * as i7$1 from '@angular/material/core';
10
- import { MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule, MatOption, ErrorStateMatcher } from '@angular/material/core';
11
- import * as i4 from '@angular/material/button';
12
- import { MatButtonModule } from '@angular/material/button';
13
- import * as i4$1 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
15
- import { MatSliderModule } from '@angular/material/slider';
16
- import { MatToolbarModule } from '@angular/material/toolbar';
17
- import { MatSidenavModule } from '@angular/material/sidenav';
18
- import * as i2$1 from '@angular/material/badge';
19
- import { MatBadgeModule } from '@angular/material/badge';
20
- import * as i4$3 from '@angular/material/list';
21
- import { MatListModule } from '@angular/material/list';
22
- import { MatGridListModule } from '@angular/material/grid-list';
23
- import * as i5$1 from '@angular/material/form-field';
24
- import { MatFormFieldModule } from '@angular/material/form-field';
25
- import * as i5$2 from '@angular/material/datepicker';
26
- import { MatDatepickerModule } from '@angular/material/datepicker';
27
- import * as i4$2 from '@angular/material/input';
28
- import { MatInputModule } from '@angular/material/input';
29
- import * as i6 from '@angular/material/select';
30
- import { MatSelectModule } from '@angular/material/select';
31
- import * as i5$3 from '@angular/material/radio';
32
- import { MatRadioModule } from '@angular/material/radio';
33
- import * as i5$4 from '@angular/material/chips';
34
- import { MatChipsModule } from '@angular/material/chips';
35
- import * as i5 from '@angular/material/tooltip';
36
- import { MatTooltipModule } from '@angular/material/tooltip';
37
- import { MatTableModule } from '@angular/material/table';
38
- import { MatPaginatorModule } from '@angular/material/paginator';
39
- import { MatCardModule } from '@angular/material/card';
40
- import { MatMenuModule } from '@angular/material/menu';
41
- import { CdkTableModule } from '@angular/cdk/table';
42
- import { MatTabsModule } from '@angular/material/tabs';
43
- import * as i9 from '@angular/material/progress-spinner';
44
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
45
- import * as i10 from '@angular/material/checkbox';
46
- import { MatCheckboxModule } from '@angular/material/checkbox';
47
- import { MatDialogModule } from '@angular/material/dialog';
48
- import * as i9$1 from '@angular/material/autocomplete';
49
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
50
- import { MatProgressBarModule } from '@angular/material/progress-bar';
51
- import { MatSortModule } from '@angular/material/sort';
52
- import { MatExpansionModule } from '@angular/material/expansion';
53
- import { MatSnackBarModule } from '@angular/material/snack-bar';
54
- import { MatTreeModule } from '@angular/material/tree';
55
- import * as i6$2 from '@angular/material/slide-toggle';
56
- import { MatSlideToggleModule } from '@angular/material/slide-toggle';
57
- import * as i7$2 from 'ngx-color-picker';
58
- import { ColorPickerModule } from 'ngx-color-picker';
59
- import * as i11 from '@angular/cdk/scrolling';
60
- import { ScrollingModule, CdkScrollable, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
61
- import * as i4$4 from '@angular/material/button-toggle';
62
- import { MatButtonToggleModule } from '@angular/material/button-toggle';
63
- import { FlexLayoutModule } from '@angular/flex-layout';
64
- import * as i7 from '@ngx-translate/core';
65
- import { TranslateModule } from '@ngx-translate/core';
66
- import * as i3 from '@angular/flex-layout/extended';
67
- import { __decorate, __awaiter } from 'tslib';
68
- import * as i3$1 from '@angular/flex-layout/flex';
69
- import * as i6$1 from '@angular/cdk/text-field';
70
- import * as i12 from 'ngx-mat-select-search';
71
- import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
72
- import { v4 } from 'uuid';
73
-
74
- class KlesFormControl {
75
- constructor(field) {
76
- this.field = field;
77
- }
78
- create() {
79
- const control = new FormControl(this.field.value, {
80
- validators: this.bindValidations(this.field.validations || []),
81
- asyncValidators: this.bindAsyncValidations(this.field.asyncValidations || []),
82
- updateOn: this.field.updateOn || 'change'
83
- });
84
- if (this.field.disabled) {
85
- control.disable();
86
- }
87
- if (this.field.asyncValue) {
88
- concat(of({ value: null, pending: true }), this.field.asyncValue.pipe(take(1), catchError((err) => {
89
- console.error(err);
90
- return of(null);
91
- }), map((value) => ({ value, pending: false })))).subscribe((response) => {
92
- this.field.pending = response.pending;
93
- if (response.pending) {
94
- control.disable({ emitEvent: false });
95
- }
96
- else {
97
- if (!this.field.disabled) {
98
- control.enable({ emitEvent: false });
99
- }
100
- control.setValue(response.value);
101
- this.field.value = response.value;
102
- }
103
- });
104
- }
105
- return control;
106
- }
107
- bindValidations(validations) {
108
- if (validations.length > 0) {
109
- const validList = [];
110
- validations.forEach(valid => {
111
- validList.push(valid.validator);
112
- });
113
- return Validators.compose(validList);
114
- }
115
- return null;
116
- }
117
- bindAsyncValidations(validations) {
118
- if (validations.length > 0) {
119
- const validList = [];
120
- validations.forEach(valid => {
121
- validList.push(valid.validator);
122
- });
123
- return Validators.composeAsync(validList);
124
- }
125
- return null;
126
- }
127
- }
128
-
129
- const klesFieldControlFactory = (field) => {
130
- const factory = new KlesFormControl(field);
131
- return factory.create();
132
- };
133
-
134
- const componentMapper = [];
135
- function FieldMapper(config) {
136
- return (target) => {
137
- componentMapper.push({
138
- component: target,
139
- type: config.type,
140
- factory: config.factory || klesFieldControlFactory
141
- });
142
- };
143
- }
144
-
145
- var EnumType;
146
- (function (EnumType) {
147
- EnumType["input"] = "input";
148
- EnumType["select"] = "select";
149
- EnumType["text"] = "text";
150
- EnumType["button"] = "button";
151
- EnumType["checkbox"] = "checkbox";
152
- EnumType["number"] = "number";
153
- EnumType["time"] = "time";
154
- EnumType["date"] = "date";
155
- EnumType["color"] = "color";
156
- EnumType["list"] = "list";
157
- EnumType["multi"] = "multi";
158
- EnumType["array"] = "array";
159
- EnumType["group"] = "group";
160
- EnumType["lineBreak"] = "lineBreak";
161
- EnumType["badge"] = "badge";
162
- EnumType["range"] = "range";
163
- })(EnumType || (EnumType = {}));
164
-
165
- class KlesFormClearComponent {
166
- clear(event) {
167
- event.stopPropagation();
168
- this.group.controls[this.field.name].reset();
169
- }
170
- }
171
- KlesFormClearComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormClearComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
172
- KlesFormClearComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormClearComponent, selector: "kles-form-clear", ngImport: i0, template: `
173
- <button *ngIf="group.get(field.name).value && !group.get(field.name).disabled" mat-icon-button aria-label="Clear" type="button"
174
- (click)="clear($event)">
175
- <mat-icon>close</mat-icon>
176
- </button>
177
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
178
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormClearComponent, decorators: [{
179
- type: Component,
180
- args: [{
181
- selector: 'kles-form-clear',
182
- template: `
183
- <button *ngIf="group.get(field.name).value && !group.get(field.name).disabled" mat-icon-button aria-label="Clear" type="button"
184
- (click)="clear($event)">
185
- <mat-icon>close</mat-icon>
186
- </button>
187
- `,
188
- }]
189
- }] });
190
-
191
- class KlesDynamicFieldDirective {
192
- constructor(container, injector) {
193
- this.container = container;
194
- this.injector = injector;
195
- this.subComponents = [];
196
- }
197
- ngOnDestroy() {
198
- if (this.componentRef) {
199
- this.componentRef.destroy();
200
- }
201
- }
202
- ngOnInit() {
203
- this.buildComponent();
204
- }
205
- ngOnChanges(changes) {
206
- if (changes.group) {
207
- this.group = changes.group.currentValue;
208
- }
209
- if (changes.field) {
210
- this.field = changes.field.currentValue;
211
- this.buildComponent();
212
- }
213
- }
214
- buildComponent() {
215
- var _a;
216
- if (this.componentRef) {
217
- this.subComponents.forEach(c => c.destroy());
218
- this.subComponents = [];
219
- this.componentRef.destroy();
220
- }
221
- const options = {
222
- providers: this.field.dateOptions ? [
223
- { provide: MAT_DATE_LOCALE, useValue: this.field.dateOptions.language },
224
- { provide: MAT_DATE_FORMATS, useValue: this.field.dateOptions.dateFormat },
225
- ] : [],
226
- parent: this.injector
227
- };
228
- const injector = Injector.create(options);
229
- if (this.field.clearable) {
230
- const composant = this.createSubComponent(this.field.clearableComponent || KlesFormClearComponent);
231
- this.subComponents.push(composant);
232
- }
233
- if (this.field.subComponents) {
234
- this.subComponents.push(...this.field.subComponents.map((subComponent) => this.createSubComponent(subComponent)));
235
- }
236
- this.componentRef = this.container.createComponent(this.field.component
237
- || ((_a = componentMapper.find(element => element.type === this.field.type)) === null || _a === void 0 ? void 0 : _a.component), { injector, projectableNodes: [this.subComponents.map(sub => sub.location.nativeElement)] });
238
- this.componentRef.instance.field = this.field;
239
- this.componentRef.instance.group = this.group;
240
- this.componentRef.instance.siblingFields = this.siblingFields;
241
- }
242
- createSubComponent(componentType) {
243
- const component = this.container.createComponent(componentType);
244
- component.instance.field = this.field;
245
- component.instance.group = this.group;
246
- component.instance.siblingFields = this.siblingFields;
247
- return component;
248
- }
249
- }
250
- KlesDynamicFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesDynamicFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
251
- KlesDynamicFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: KlesDynamicFieldDirective, selector: "[klesDynamicField]", inputs: { field: "field", group: "group", siblingFields: "siblingFields" }, usesOnChanges: true, ngImport: i0 });
252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesDynamicFieldDirective, decorators: [{
253
- type: Directive,
254
- args: [{
255
- selector: '[klesDynamicField]'
256
- }]
257
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Injector }]; }, propDecorators: { field: [{
258
- type: Input
259
- }], group: [{
260
- type: Input
261
- }], siblingFields: [{
262
- type: Input
263
- }] } });
264
-
265
- const originFormControlNgOnChanges = FormControlDirective.prototype.ngOnChanges;
266
- FormControlDirective.prototype.ngOnChanges = function () {
267
- var _a;
268
- this.form.nativeElement = (_a = this.valueAccessor._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
269
- return originFormControlNgOnChanges.apply(this, arguments);
270
- };
271
- const originFormControlNameNgOnChanges = FormControlName.prototype.ngOnChanges;
272
- FormControlName.prototype.ngOnChanges = function () {
273
- var _a;
274
- const result = originFormControlNameNgOnChanges.apply(this, arguments);
275
- this.control.nativeElement = (_a = this.valueAccessor._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
276
- return result;
277
- };
278
- class KlesDynamicFormComponent {
279
- get value() {
280
- return this.form.value;
281
- }
282
- constructor(fb) {
283
- this.fb = fb;
284
- this.fields = [];
285
- this.validators = [];
286
- this.asyncValidators = [];
287
- // tslint:disable-next-line: no-output-native
288
- this.submit = new EventEmitter();
289
- this._onLoaded = new EventEmitter();
290
- this.direction = 'column';
291
- this.orientationClass = 'dynamic-form-column';
292
- this.orientationItemClass = 'dynamic-form-column-item';
293
- }
294
- ngOnInit() {
295
- this.form = this.createForm();
296
- this.orientationClass = this.direction === 'row' ? 'dynamic-form-row' : 'dynamic-form-column';
297
- this.orientationItemClass = this.direction === 'row' ? 'dynamic-form-row-item' : 'dynamic-form-column-item';
298
- this._onLoaded.emit();
299
- }
300
- ngOnChanges(changes) {
301
- var _a, _b, _c, _d;
302
- if (!((_a = changes.fields) === null || _a === void 0 ? void 0 : _a.firstChange)) {
303
- this.updateForm();
304
- // this.form = this.createControl();
305
- // this.form.controls = {};
306
- this._onLoaded.emit();
307
- }
308
- if (!((_b = changes.validators) === null || _b === void 0 ? void 0 : _b.firstChange) && this.form) {
309
- this.form.setValidators(this.validators.map(v => v.validator));
310
- }
311
- if (!((_c = changes.asyncValidators) === null || _c === void 0 ? void 0 : _c.firstChange) && this.form) {
312
- this.form.setAsyncValidators(this.asyncValidators.map(v => v.validator));
313
- }
314
- if (!((_d = changes.direction) === null || _d === void 0 ? void 0 : _d.firstChange)) {
315
- this.orientationClass = this.direction === 'row' ? 'dynamic-form-row' : 'dynamic-form-column';
316
- this.orientationItemClass = this.direction === 'row' ? 'dynamic-form-row-item' : 'dynamic-form-column-item';
317
- }
318
- }
319
- onSubmit(event) {
320
- event.preventDefault();
321
- event.stopPropagation();
322
- if (this.form.valid) {
323
- this.submit.emit(this.form.value);
324
- }
325
- else {
326
- this.validateAllFormFields(this.form);
327
- }
328
- }
329
- reset() {
330
- this.form.reset();
331
- }
332
- updateForm() {
333
- Object.keys(this.form.controls).filter(key => {
334
- return !this.fields.map(field => field.name).includes(key);
335
- }).forEach(key => {
336
- this.form.removeControl(key);
337
- });
338
- this.fields
339
- // .filter(field => !this.form.controls[field.name])
340
- .forEach(field => {
341
- if (field.type === EnumType.lineBreak) {
342
- return;
343
- }
344
- if (this.form.controls[field.name]) {
345
- const control = this.updateControl(field, this.form.controls[field.name]);
346
- this.form.setControl(field.name, control, { emitEvent: false });
347
- }
348
- else {
349
- const control = this.createControl(field);
350
- this.form.addControl(field.name, control);
351
- }
352
- });
353
- }
354
- updateControl(field, control) {
355
- if (field.type === EnumType.array) {
356
- const array = control;
357
- /*TODO*/
358
- return array;
359
- }
360
- else if (field.type === EnumType.group) {
361
- const group = control;
362
- if (field.collections && Array.isArray(field.collections)) {
363
- field.collections.forEach(subfield => {
364
- if (group.controls[subfield]) {
365
- control = this.updateControl(subfield, group.controls[subfield]);
366
- }
367
- else {
368
- control = this.createControl(subfield);
369
- }
370
- group.setControl(subfield.name, control, { emitEvent: false });
371
- });
372
- }
373
- return group;
374
- }
375
- else {
376
- // control.setValidators(this.bindValidations(field.validations || []));
377
- // control.setAsyncValidators(this.bindAsyncValidations(field.asyncValidations || []));
378
- // if (field.value && control.value !== field.value) {
379
- // control.setValue(field.value);
380
- // }
381
- return control;
382
- }
383
- }
384
- createControl(field) {
385
- var _a, _b;
386
- if (field.type) {
387
- return ((_a = componentMapper.find(c => c.type === field.type)) === null || _a === void 0 ? void 0 : _a.factory(field)) || klesFieldControlFactory(field);
388
- }
389
- else {
390
- return ((_b = componentMapper.find(c => c.component === field.component)) === null || _b === void 0 ? void 0 : _b.factory(field)) || klesFieldControlFactory(field);
391
- }
392
- }
393
- createForm() {
394
- const group = this.fb.group({});
395
- this.fields.forEach(field => {
396
- if (field.type === EnumType.lineBreak) {
397
- return;
398
- }
399
- const control = this.createControl(field);
400
- group.addControl(field.name, control);
401
- });
402
- group.setValidators(this.validators.map(v => v.validator));
403
- group.setAsyncValidators(this.asyncValidators.map(v => v.validator));
404
- return group;
405
- }
406
- validateAllFormFields(formGroup) {
407
- Object.keys(formGroup.controls).forEach(field => {
408
- const control = formGroup.get(field);
409
- control.markAsTouched({ onlySelf: true });
410
- });
411
- }
412
- }
413
- KlesDynamicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesDynamicFormComponent, deps: [{ token: i2.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component });
414
- KlesDynamicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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: `
415
- <form class="{{orientationClass}}" [formGroup]="form" (submit)="onSubmit($event)">
416
- <ng-container *ngFor="let field of fields;">
417
- <ng-container *ngIf="field.visible !== false" class="{{orientationItemClass}}" klesDynamicField [field]="field" [group]="form" [siblingFields]="fields">
418
- </ng-container>
419
- </ng-container>
420
- <!--<button (click)="reset()" mat-raised-button color="primary">RESET</button>-->
421
- </form>
422
- `, 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: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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"] }] });
423
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesDynamicFormComponent, decorators: [{
424
- type: Component,
425
- args: [{ exportAs: 'klesDynamicForm', selector: 'app-kles-dynamic-form', template: `
426
- <form class="{{orientationClass}}" [formGroup]="form" (submit)="onSubmit($event)">
427
- <ng-container *ngFor="let field of fields;">
428
- <ng-container *ngIf="field.visible !== false" class="{{orientationItemClass}}" klesDynamicField [field]="field" [group]="form" [siblingFields]="fields">
429
- </ng-container>
430
- </ng-container>
431
- <!--<button (click)="reset()" mat-raised-button color="primary">RESET</button>-->
432
- </form>
433
- `, 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"] }]
434
- }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }]; }, propDecorators: { fields: [{
435
- type: Input
436
- }], validators: [{
437
- type: Input
438
- }], asyncValidators: [{
439
- type: Input
440
- }], submit: [{
441
- type: Output
442
- }], _onLoaded: [{
443
- type: Output
444
- }], direction: [{
445
- type: Input
446
- }] } });
447
-
448
- class KlesComponentDirective {
449
- constructor(container) {
450
- this.container = container;
451
- }
452
- ngOnInit() {
453
- this.buildComponent();
454
- }
455
- ngOnChanges(changes) {
456
- if (changes.component && !changes.component.isFirstChange()) {
457
- this.component = changes.component.currentValue;
458
- this.buildComponent();
459
- }
460
- if (changes.value && !changes.value.isFirstChange()) {
461
- this.value = changes.value.currentValue;
462
- this.componentRef.instance.value = this.value;
463
- }
464
- }
465
- buildComponent() {
466
- if (this.componentRef) {
467
- this.componentRef.destroy();
468
- }
469
- this.componentRef = this.container.createComponent(this.component);
470
- this.componentRef.instance.component = this.component;
471
- this.componentRef.instance.value = this.value;
472
- this.componentRef.instance.field = this.field;
473
- }
474
- }
475
- KlesComponentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
476
- KlesComponentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: KlesComponentDirective, selector: "[klesComponent]", inputs: { component: "component", value: "value", field: "field" }, usesOnChanges: true, ngImport: i0 });
477
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesComponentDirective, decorators: [{
478
- type: Directive,
479
- args: [{
480
- selector: '[klesComponent]'
481
- }]
482
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { component: [{
483
- type: Input
484
- }], value: [{
485
- type: Input
486
- }], field: [{
487
- type: Input
488
- }] } });
489
-
490
- class KlesFormErrorStateMatcher {
491
- constructor() {
492
- }
493
- isErrorState(control, form) {
494
- const isSubmitted = form && form.submitted;
495
- return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
496
- }
497
- }
498
- KlesFormErrorStateMatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormErrorStateMatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
499
- KlesFormErrorStateMatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormErrorStateMatcher });
500
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormErrorStateMatcher, decorators: [{
501
- type: Injectable
502
- }], ctorParameters: function () { return []; } });
503
-
504
- class MaterialModule {
505
- }
506
- MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
507
- MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, imports: [CommonModule,
508
- MatSliderModule,
509
- MatButtonModule,
510
- MatToolbarModule,
511
- MatIconModule,
512
- MatSidenavModule,
513
- MatBadgeModule,
514
- MatListModule,
515
- MatGridListModule,
516
- MatFormFieldModule,
517
- MatInputModule,
518
- MatSelectModule,
519
- MatRadioModule,
520
- MatDatepickerModule,
521
- MatChipsModule,
522
- MatTooltipModule,
523
- MatTableModule,
524
- MatPaginatorModule,
525
- MatCardModule,
526
- MatMenuModule,
527
- MatTabsModule,
528
- CdkTableModule,
529
- MatProgressSpinnerModule,
530
- MatCheckboxModule,
531
- MatDialogModule,
532
- MatAutocompleteModule,
533
- MatProgressBarModule,
534
- MatSortModule,
535
- MatExpansionModule,
536
- MatNativeDateModule,
537
- MatSnackBarModule,
538
- MatTreeModule,
539
- MatSliderModule,
540
- MatSlideToggleModule,
541
- ColorPickerModule,
542
- MatButtonToggleModule], exports: [MatButtonModule,
543
- MatToolbarModule,
544
- MatIconModule,
545
- MatSidenavModule,
546
- MatBadgeModule,
547
- MatListModule,
548
- MatGridListModule,
549
- MatInputModule,
550
- MatFormFieldModule,
551
- MatSelectModule,
552
- MatRadioModule,
553
- MatDatepickerModule,
554
- MatChipsModule,
555
- MatTooltipModule,
556
- MatTableModule,
557
- MatPaginatorModule,
558
- MatCardModule,
559
- MatMenuModule,
560
- MatTabsModule,
561
- CdkTableModule,
562
- MatProgressSpinnerModule,
563
- MatCheckboxModule,
564
- MatDialogModule,
565
- MatAutocompleteModule,
566
- MatProgressBarModule,
567
- MatSortModule,
568
- MatExpansionModule,
569
- MatNativeDateModule,
570
- MatSnackBarModule,
571
- MatTreeModule,
572
- MatSliderModule,
573
- MatSlideToggleModule,
574
- ColorPickerModule,
575
- ScrollingModule,
576
- CdkScrollable,
577
- MatButtonToggleModule] });
578
- MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, providers: [
579
- MatDatepickerModule,
580
- MatDialogModule
581
- ], imports: [CommonModule,
582
- MatSliderModule,
583
- MatButtonModule,
584
- MatToolbarModule,
585
- MatIconModule,
586
- MatSidenavModule,
587
- MatBadgeModule,
588
- MatListModule,
589
- MatGridListModule,
590
- MatFormFieldModule,
591
- MatInputModule,
592
- MatSelectModule,
593
- MatRadioModule,
594
- MatDatepickerModule,
595
- MatChipsModule,
596
- MatTooltipModule,
597
- MatTableModule,
598
- MatPaginatorModule,
599
- MatCardModule,
600
- MatMenuModule,
601
- MatTabsModule,
602
- CdkTableModule,
603
- MatProgressSpinnerModule,
604
- MatCheckboxModule,
605
- MatDialogModule,
606
- MatAutocompleteModule,
607
- MatProgressBarModule,
608
- MatSortModule,
609
- MatExpansionModule,
610
- MatNativeDateModule,
611
- MatSnackBarModule,
612
- MatTreeModule,
613
- MatSliderModule,
614
- MatSlideToggleModule,
615
- ColorPickerModule,
616
- MatButtonToggleModule, MatButtonModule,
617
- MatToolbarModule,
618
- MatIconModule,
619
- MatSidenavModule,
620
- MatBadgeModule,
621
- MatListModule,
622
- MatGridListModule,
623
- MatInputModule,
624
- MatFormFieldModule,
625
- MatSelectModule,
626
- MatRadioModule,
627
- MatDatepickerModule,
628
- MatChipsModule,
629
- MatTooltipModule,
630
- MatTableModule,
631
- MatPaginatorModule,
632
- MatCardModule,
633
- MatMenuModule,
634
- MatTabsModule,
635
- CdkTableModule,
636
- MatProgressSpinnerModule,
637
- MatCheckboxModule,
638
- MatDialogModule,
639
- MatAutocompleteModule,
640
- MatProgressBarModule,
641
- MatSortModule,
642
- MatExpansionModule,
643
- MatNativeDateModule,
644
- MatSnackBarModule,
645
- MatTreeModule,
646
- MatSliderModule,
647
- MatSlideToggleModule,
648
- ColorPickerModule,
649
- ScrollingModule,
650
- MatButtonToggleModule] });
651
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, decorators: [{
652
- type: NgModule,
653
- args: [{
654
- imports: [
655
- CommonModule,
656
- MatSliderModule,
657
- MatButtonModule,
658
- MatToolbarModule,
659
- MatIconModule,
660
- MatSidenavModule,
661
- MatBadgeModule,
662
- MatListModule,
663
- MatGridListModule,
664
- MatFormFieldModule,
665
- MatInputModule,
666
- MatSelectModule,
667
- MatRadioModule,
668
- MatDatepickerModule,
669
- MatChipsModule,
670
- MatTooltipModule,
671
- MatTableModule,
672
- MatPaginatorModule,
673
- MatCardModule,
674
- MatMenuModule,
675
- MatTabsModule,
676
- CdkTableModule,
677
- MatProgressSpinnerModule,
678
- MatCheckboxModule,
679
- MatDialogModule,
680
- MatAutocompleteModule,
681
- MatProgressBarModule,
682
- MatSortModule,
683
- MatExpansionModule,
684
- MatNativeDateModule,
685
- MatSnackBarModule,
686
- MatTreeModule,
687
- MatSliderModule,
688
- MatSlideToggleModule,
689
- ColorPickerModule,
690
- MatButtonToggleModule
691
- ],
692
- exports: [
693
- MatButtonModule,
694
- MatToolbarModule,
695
- MatIconModule,
696
- MatSidenavModule,
697
- MatBadgeModule,
698
- MatListModule,
699
- MatGridListModule,
700
- MatInputModule,
701
- MatFormFieldModule,
702
- MatSelectModule,
703
- MatRadioModule,
704
- MatDatepickerModule,
705
- MatChipsModule,
706
- MatTooltipModule,
707
- MatTableModule,
708
- MatPaginatorModule,
709
- MatCardModule,
710
- MatMenuModule,
711
- MatTabsModule,
712
- CdkTableModule,
713
- MatProgressSpinnerModule,
714
- MatCheckboxModule,
715
- MatDialogModule,
716
- MatAutocompleteModule,
717
- MatProgressBarModule,
718
- MatSortModule,
719
- MatExpansionModule,
720
- MatNativeDateModule,
721
- MatSnackBarModule,
722
- MatTreeModule,
723
- MatSliderModule,
724
- MatSlideToggleModule,
725
- ColorPickerModule,
726
- ScrollingModule,
727
- CdkScrollable,
728
- MatButtonToggleModule
729
- ],
730
- providers: [
731
- MatDatepickerModule,
732
- MatDialogModule
733
- ]
734
- }]
735
- }] });
736
-
737
- class KlesFieldAbstract {
738
- constructor(viewRef) {
739
- this.viewRef = viewRef;
740
- this._onDestroy = new Subject();
741
- }
742
- ngOnInit() {
743
- var _a;
744
- if (this.field.valueChanges) {
745
- this.field.valueChanges(this.field, this.group, this.siblingFields);
746
- }
747
- (_a = this.group.controls[this.field.name]) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(takeUntil(this._onDestroy)).subscribe(val => {
748
- if (this.field.valueChanges) {
749
- this.field.valueChanges(this.field, this.group, this.siblingFields, val);
750
- }
751
- });
752
- if (this.field.directive) {
753
- this.directive = new this.field.directive(this.viewRef, this);
754
- this.directive.ngOnInit();
755
- }
756
- }
757
- ngAfterViewInit() {
758
- var _a;
759
- if (this.directive && this.directive.ngAfterViewInit) {
760
- (_a = this.directive) === null || _a === void 0 ? void 0 : _a.ngAfterViewInit();
761
- }
762
- if (this.field.autofocus) {
763
- setTimeout(() => {
764
- var _a;
765
- (_a = this.group.controls[this.field.name]) === null || _a === void 0 ? void 0 : _a.nativeElement.focus();
766
- });
767
- // console.log('result', (<any>this.group.controls[this.field.name]))
768
- }
769
- }
770
- ngOnDestroy() {
771
- var _a;
772
- (_a = this.directive) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
773
- this._onDestroy.next();
774
- this._onDestroy.complete();
775
- }
776
- applyPipeTransform() {
777
- if (this.group && this.field) {
778
- const control = this.group.controls[this.field.name];
779
- if (control) {
780
- const val = this.group.controls[this.field.name].value;
781
- if (this.field.pipeTransform) {
782
- this.field.pipeTransform.forEach(p => {
783
- let pipeVal = control.value;
784
- if (p.options) {
785
- p.options.forEach(opt => {
786
- pipeVal = p.pipe.transform(val, opt);
787
- });
788
- }
789
- else {
790
- pipeVal = p.pipe.transform(val);
791
- }
792
- control.patchValue(pipeVal, { onlySelf: true, emitEvent: false });
793
- });
794
- }
795
- }
796
- }
797
- }
798
- }
799
- KlesFieldAbstract.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFieldAbstract, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
800
- KlesFieldAbstract.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: KlesFieldAbstract, host: { properties: { "attr.klesDirective": "this.directive" } }, ngImport: i0 });
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFieldAbstract, decorators: [{
802
- type: Directive
803
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { directive: [{
804
- type: HostBinding,
805
- args: ['attr.klesDirective']
806
- }] } });
807
-
808
- class KlesFormLabelComponent extends KlesFieldAbstract {
809
- ngOnInit() {
810
- this.group.controls[this.field.name].disable();
811
- super.ngOnInit();
812
- }
813
- ngOnDestroy() {
814
- super.ngOnDestroy();
815
- }
816
- }
817
- KlesFormLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormLabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
818
- KlesFormLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormLabelComponent, selector: "kles-form-label", usesInheritance: true, ngImport: i0, template: `
819
- <div [formGroup]="group" >
820
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id"
821
- [ngClass]="field.ngClass"
822
- [ngStyle]="{'color':'inherit'}" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType">
823
- </div>
824
- `, 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: i4$2.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: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
825
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormLabelComponent, decorators: [{
826
- type: Component,
827
- args: [{
828
- selector: "kles-form-label",
829
- template: `
830
- <div [formGroup]="group" >
831
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id"
832
- [ngClass]="field.ngClass"
833
- [ngStyle]="{'color':'inherit'}" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType">
834
- </div>
835
- `
836
- }]
837
- }] });
838
-
839
- let KlesFormInputComponent = class KlesFormInputComponent extends KlesFieldAbstract {
840
- ngOnInit() {
841
- if (this.field.options instanceof Observable) {
842
- this.options$ = this.field.options;
843
- }
844
- else if (this.field.options instanceof Function) {
845
- this.options$ = this.field.options();
846
- }
847
- else {
848
- this.options$ = of(this.field.options);
849
- }
850
- this.filteredOption = this.group.get(this.field.name).valueChanges
851
- .pipe(startWith(''),
852
- // map(data => data ? this.filterData(data) : this.field.options.slice())
853
- switchMap(data => data ? this.filterData(data) : this.options$));
854
- if (!this.field.maxLength) {
855
- this.field.maxLength = 524288; // Max default input W3C
856
- }
857
- super.ngOnInit();
858
- }
859
- isPending() {
860
- return (this.group.controls[this.field.name].pending || this.field.pending);
861
- }
862
- filterData(value) {
863
- let filterValue;
864
- if (typeof value === 'string' && Object.prototype.toString.call(value) === '[object String]') {
865
- filterValue = value.toLowerCase();
866
- }
867
- else {
868
- filterValue = value[this.field.property].toLowerCase();
869
- }
870
- if (this.field.property) {
871
- return this.options$
872
- .pipe(map(options => options.filter(option => option[this.field.property].toLowerCase().indexOf(filterValue) === 0)));
873
- // return this.field.options
874
- // .filter(data => data[this.field.property].toLowerCase().indexOf(filterValue) === 0);
875
- }
876
- // return this.field.options.filter(data => data.toLowerCase().indexOf(filterValue) === 0);
877
- return this.options$.pipe(map(options => options.filter(option => option.toLowerCase().indexOf(filterValue) === 0)));
878
- }
879
- displayFn(value) {
880
- if (this.field.displayWith) {
881
- return this.field.displayWith(value);
882
- }
883
- else {
884
- if (value && this.field && this.field.property) {
885
- return value[this.field.property] ? value[this.field.property] : '';
886
- }
887
- return value ? value : '';
888
- }
889
- }
890
- ngOnDestroy() {
891
- super.ngOnDestroy();
892
- }
893
- };
894
- KlesFormInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
895
- KlesFormInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormInputComponent, selector: "kles-form-input", usesInheritance: true, ngImport: i0, template: `
896
- <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
897
-
898
- <ng-container *ngIf="field.autocomplete; else notAutoComplete">
899
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
900
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
901
- [matAutocomplete]="auto">
902
-
903
- <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
904
- <ng-container *ngIf="!field.autocompleteComponent">
905
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
906
- {{field.property ? option[field.property] : option}}
907
- </mat-option>
908
- </ng-container>
909
-
910
- <ng-container *ngIf="field.autocompleteComponent">
911
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
912
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
913
- </ng-container>
914
- </mat-option>
915
- </ng-container>
916
- </mat-autocomplete>
917
- </ng-container>
918
-
919
- <ng-template #notAutoComplete>
920
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
921
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
922
- </ng-template>
923
-
924
- <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
925
-
926
- <div matSuffix>
927
- <ng-content></ng-content>
928
- </div>
929
-
930
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
931
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
932
- </ng-container>
933
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
934
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
935
- </ng-container>
936
- </mat-form-field>
937
- `, 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$2.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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i7$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i9$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i9$1.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.TranslatePipe, name: "translate" }] });
938
- KlesFormInputComponent = __decorate([
939
- FieldMapper({ type: EnumType.input })
940
- ], KlesFormInputComponent);
941
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormInputComponent, decorators: [{
942
- type: Component,
943
- args: [{ selector: 'kles-form-input', template: `
944
- <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
945
-
946
- <ng-container *ngIf="field.autocomplete; else notAutoComplete">
947
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
948
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
949
- [matAutocomplete]="auto">
950
-
951
- <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
952
- <ng-container *ngIf="!field.autocompleteComponent">
953
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
954
- {{field.property ? option[field.property] : option}}
955
- </mat-option>
956
- </ng-container>
957
-
958
- <ng-container *ngIf="field.autocompleteComponent">
959
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
960
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
961
- </ng-container>
962
- </mat-option>
963
- </ng-container>
964
- </mat-autocomplete>
965
- </ng-container>
966
-
967
- <ng-template #notAutoComplete>
968
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
969
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
970
- </ng-template>
971
-
972
- <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
973
-
974
- <div matSuffix>
975
- <ng-content></ng-content>
976
- </div>
977
-
978
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
979
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
980
- </ng-container>
981
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
982
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
983
- </ng-container>
984
- </mat-form-field>
985
- `, styles: ["mat-form-field{width:100%}\n"] }]
986
- }] });
987
-
988
- let KlesFormSubmitButtonComponent = class KlesFormSubmitButtonComponent extends KlesFieldAbstract {
989
- ngOnInit() {
990
- super.ngOnInit();
991
- }
992
- ngOnDestroy() {
993
- super.ngOnDestroy();
994
- }
995
- };
996
- KlesFormSubmitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSubmitButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
997
- KlesFormSubmitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormSubmitButtonComponent, selector: "kles-submit-button", usesInheritance: true, ngImport: i0, template: `
998
- <div [formGroup]="group">
999
- <button matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" type="submit" [disabled]="field.disabled" mat-raised-button color="primary">{{field.label}}</button>
1000
- </div>
1001
- `, 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.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
1002
- KlesFormSubmitButtonComponent = __decorate([
1003
- FieldMapper({ type: EnumType.button })
1004
- ], KlesFormSubmitButtonComponent);
1005
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSubmitButtonComponent, decorators: [{
1006
- type: Component,
1007
- args: [{ selector: 'kles-submit-button', template: `
1008
- <div [formGroup]="group">
1009
- <button matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" type="submit" [disabled]="field.disabled" mat-raised-button color="primary">{{field.label}}</button>
1010
- </div>
1011
- ` }]
1012
- }] });
1013
-
1014
- class KlesTransformPipe {
1015
- transform(value, pipes) {
1016
- if (pipes && pipes.length > 0) {
1017
- return pipes.reduce((acc, p) => {
1018
- if (p.options) {
1019
- p.options.forEach(opt => {
1020
- acc = p.pipe.transform(acc, opt);
1021
- });
1022
- }
1023
- else {
1024
- acc = p.pipe.transform(acc);
1025
- }
1026
- return acc;
1027
- }, value);
1028
- }
1029
- return value;
1030
- }
1031
- }
1032
- KlesTransformPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesTransformPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1033
- KlesTransformPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: KlesTransformPipe, name: "klesTransform" });
1034
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesTransformPipe, decorators: [{
1035
- type: Pipe,
1036
- args: [{ name: 'klesTransform' }]
1037
- }] });
1038
-
1039
- let KlesFormSelectComponent = class KlesFormSelectComponent extends KlesFieldAbstract {
1040
- constructor(viewRef, ref) {
1041
- super(viewRef);
1042
- this.viewRef = viewRef;
1043
- this.ref = ref;
1044
- this.isLoading = false;
1045
- this.openChange$ = new Subject();
1046
- this.compareFn = (o1, o2) => {
1047
- if (this.field.property && o1 && o2) {
1048
- return o1[this.field.property] === o2[this.field.property];
1049
- }
1050
- return o1 === o2;
1051
- };
1052
- }
1053
- ngOnInit() {
1054
- super.ngOnInit();
1055
- if (this.field.lazy) {
1056
- this.isLoading = true;
1057
- if (this.group.controls[this.field.name].value !== undefined && this.group.controls[this.field.name].value !== null) {
1058
- this.options$ = new BehaviorSubject(Array.isArray(this.group.controls[this.field.name].value) ? this.group.controls[this.field.name].value
1059
- : [this.group.controls[this.field.name].value]);
1060
- this.isLoading = false;
1061
- }
1062
- else {
1063
- this.options$ = new BehaviorSubject([]);
1064
- }
1065
- this.openChange$
1066
- .pipe(takeUntil(this._onDestroy), switchMap((isOpen) => {
1067
- if (isOpen) {
1068
- if (this.field.options instanceof Observable) {
1069
- this.isLoading = true;
1070
- return this.field.options.pipe(take(1));
1071
- }
1072
- else if (this.field.options instanceof Function) {
1073
- this.isLoading = true;
1074
- return this.field.options();
1075
- }
1076
- else {
1077
- return of(this.field.options);
1078
- }
1079
- }
1080
- else {
1081
- return of(this.group.controls[this.field.name].value !== undefined && this.group.controls[this.field.name].value !== null
1082
- ? (Array.isArray(this.group.controls[this.field.name].value) ?
1083
- this.group.controls[this.field.name].value : [this.group.controls[this.field.name].value]) : []);
1084
- }
1085
- }))
1086
- .subscribe((options) => {
1087
- this.options$.next(options);
1088
- this.isLoading = false;
1089
- this.ref.markForCheck();
1090
- });
1091
- }
1092
- else {
1093
- if (this.field.options instanceof Observable) {
1094
- this.options$ = this.field.options;
1095
- }
1096
- else if (this.field.options instanceof Function) {
1097
- this.options$ = this.field.options();
1098
- }
1099
- else {
1100
- this.options$ = of(this.field.options);
1101
- }
1102
- }
1103
- }
1104
- ngOnDestroy() {
1105
- super.ngOnDestroy();
1106
- }
1107
- openChange($event) {
1108
- if (this.field.lazy) {
1109
- this.openChange$.next($event);
1110
- // if ($event) {
1111
- // if (!(this.field.options instanceof Observable)) {
1112
- // (this.options$ as BehaviorSubject<any[]>).next(this.field.options);
1113
- // } else {
1114
- // this.isLoading = true;
1115
- // this.field.options.pipe(take(1)).subscribe(options => {
1116
- // (this.options$ as BehaviorSubject<any[]>).next(options);
1117
- // this.isLoading = false;
1118
- // this.ref.markForCheck();
1119
- // });
1120
- // }
1121
- // } else {
1122
- // (this.options$ as BehaviorSubject<any[]>)
1123
- // .next(this.group.controls[this.field.name].value !== undefined ? [this.group.controls[this.field.name].value] : []);
1124
- // this.ref.markForCheck();
1125
- // // this.isLoading = true;
1126
- // }
1127
- }
1128
- if (this.field.virtualScroll) {
1129
- if ($event) {
1130
- this.cdkVirtualScrollViewport.scrollToIndex(0);
1131
- this.cdkVirtualScrollViewport.checkViewportSize();
1132
- }
1133
- }
1134
- }
1135
- };
1136
- KlesFormSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1137
- KlesFormSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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: `
1138
- <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
1139
- <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id"
1140
- (openedChange)="openChange($event)" [compareWith]="compareFn"
1141
- [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
1142
- <mat-select-trigger *ngIf="field.triggerComponent">
1143
- <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
1144
- </mat-select-trigger>
1145
-
1146
- <ng-container *ngIf="!field.virtualScroll">
1147
- <ng-container *ngIf="!field.autocompleteComponent">
1148
- <ng-container *ngIf="!isLoading; else emptyOption">
1149
- <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
1150
- </ng-container>
1151
- </ng-container>
1152
-
1153
- <ng-container *ngIf="field.autocompleteComponent">
1154
- <ng-container *ngIf="!isLoading; else emptyOption">
1155
- <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1156
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1157
- </mat-option>
1158
- </ng-container>
1159
- </ng-container>
1160
- <ng-template #emptyOption>
1161
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
1162
- </ng-template>
1163
- </ng-container>
1164
-
1165
- <ng-container *ngIf="field.virtualScroll">
1166
- <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=5*48>
1167
- <ng-container *ngIf="!field.autocompleteComponent">
1168
- <ng-container *ngIf="!isLoading; else emptyOption">
1169
- <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1170
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1171
- </mat-option>
1172
- </ng-container>
1173
-
1174
- <ng-container *ngIf="field.multiple">
1175
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1176
- style="display:none">
1177
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1178
- </mat-option>
1179
- </ng-container>
1180
-
1181
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1182
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1183
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1184
- </mat-option>
1185
- </ng-container>
1186
- </ng-container>
1187
-
1188
- <ng-container *ngIf="field.autocompleteComponent">
1189
- <ng-container *ngIf="!isLoading; else emptyOption">
1190
- <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1191
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1192
- </mat-option>
1193
- </ng-container>
1194
- <ng-container *ngIf="field.multiple">
1195
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1196
- style="display:none">
1197
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1198
- </mat-option>
1199
- </ng-container>
1200
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1201
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1202
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1203
- </mat-option>
1204
- </ng-container>
1205
- </ng-container>
1206
-
1207
- <ng-template #emptyOption>
1208
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
1209
- </ng-template>
1210
- </cdk-virtual-scroll-viewport>
1211
-
1212
- </ng-container>
1213
-
1214
- </mat-select>
1215
-
1216
- <div matSuffix>
1217
- <ng-content></ng-content>
1218
- </div>
1219
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1220
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1221
- </ng-container>
1222
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1223
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1224
- </ng-container>
1225
- </mat-form-field>
1226
- `, isInline: true, styles: ["mat-form-field{width:100%}\n", "::ng-deep .hide-checkbox .mat-pseudo-checkbox{display:none!important}\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$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.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { 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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "directive", type: i6.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i7$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i11.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i11.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i11.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.TranslatePipe, name: "translate" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
1227
- KlesFormSelectComponent = __decorate([
1228
- FieldMapper({ type: EnumType.select })
1229
- ], KlesFormSelectComponent);
1230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectComponent, decorators: [{
1231
- type: Component,
1232
- args: [{ selector: 'kles-form-select', template: `
1233
- <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
1234
- <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id"
1235
- (openedChange)="openChange($event)" [compareWith]="compareFn"
1236
- [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
1237
- <mat-select-trigger *ngIf="field.triggerComponent">
1238
- <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
1239
- </mat-select-trigger>
1240
-
1241
- <ng-container *ngIf="!field.virtualScroll">
1242
- <ng-container *ngIf="!field.autocompleteComponent">
1243
- <ng-container *ngIf="!isLoading; else emptyOption">
1244
- <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
1245
- </ng-container>
1246
- </ng-container>
1247
-
1248
- <ng-container *ngIf="field.autocompleteComponent">
1249
- <ng-container *ngIf="!isLoading; else emptyOption">
1250
- <mat-option *ngFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1251
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1252
- </mat-option>
1253
- </ng-container>
1254
- </ng-container>
1255
- <ng-template #emptyOption>
1256
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
1257
- </ng-template>
1258
- </ng-container>
1259
-
1260
- <ng-container *ngIf="field.virtualScroll">
1261
- <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=5*48>
1262
- <ng-container *ngIf="!field.autocompleteComponent">
1263
- <ng-container *ngIf="!isLoading; else emptyOption">
1264
- <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1265
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1266
- </mat-option>
1267
- </ng-container>
1268
-
1269
- <ng-container *ngIf="field.multiple">
1270
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1271
- style="display:none">
1272
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1273
- </mat-option>
1274
- </ng-container>
1275
-
1276
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1277
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1278
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
1279
- </mat-option>
1280
- </ng-container>
1281
- </ng-container>
1282
-
1283
- <ng-container *ngIf="field.autocompleteComponent">
1284
- <ng-container *ngIf="!isLoading; else emptyOption">
1285
- <mat-option *cdkVirtualFor="let item of options$ | async" [value]="item" [disabled]="item?.disabled">
1286
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1287
- </mat-option>
1288
- </ng-container>
1289
- <ng-container *ngIf="field.multiple">
1290
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
1291
- style="display:none">
1292
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1293
- </mat-option>
1294
- </ng-container>
1295
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
1296
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
1297
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
1298
- </mat-option>
1299
- </ng-container>
1300
- </ng-container>
1301
-
1302
- <ng-template #emptyOption>
1303
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
1304
- </ng-template>
1305
- </cdk-virtual-scroll-viewport>
1306
-
1307
- </ng-container>
1308
-
1309
- </mat-select>
1310
-
1311
- <div matSuffix>
1312
- <ng-content></ng-content>
1313
- </div>
1314
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1315
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1316
- </ng-container>
1317
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1318
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1319
- </ng-container>
1320
- </mat-form-field>
1321
- `, styles: ["mat-form-field{width:100%}\n", "::ng-deep .hide-checkbox .mat-pseudo-checkbox{display:none!important}\n"] }]
1322
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { cdkVirtualScrollViewport: [{
1323
- type: ViewChild,
1324
- args: [CdkVirtualScrollViewport]
1325
- }], options: [{
1326
- type: ViewChildren,
1327
- args: [MatOption]
1328
- }] } });
1329
-
1330
- class KlesFormDateComponent extends KlesFieldAbstract {
1331
- ngOnInit() { super.ngOnInit(); }
1332
- ngOnDestroy() {
1333
- super.ngOnDestroy();
1334
- }
1335
- }
1336
- KlesFormDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormDateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1337
- KlesFormDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormDateComponent, selector: "kles-form-datepicker", usesInheritance: true, ngImport: i0, template: `
1338
- <mat-form-field class="demo-full-width margin-top" [color]="field.color" [formGroup]="group">
1339
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [matDatepicker]="picker" [formControlName]="field.name" [placeholder]="field.placeholder | translate"
1340
- [min]="field.min" [max]="field.max">
1341
- <div matSuffix>
1342
- <mat-datepicker-toggle [for]="picker"></mat-datepicker-toggle>
1343
- <ng-content></ng-content>
1344
- </div>
1345
- <mat-datepicker #picker></mat-datepicker>
1346
- <mat-hint>{{field.hint}}</mat-hint>
1347
-
1348
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1349
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1350
- </ng-container>
1351
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1352
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1353
- </ng-container>
1354
- </mat-form-field>
1355
- `, 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$2.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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i5$2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
1356
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormDateComponent, decorators: [{
1357
- type: Component,
1358
- args: [{ selector: "kles-form-datepicker", template: `
1359
- <mat-form-field class="demo-full-width margin-top" [color]="field.color" [formGroup]="group">
1360
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [matDatepicker]="picker" [formControlName]="field.name" [placeholder]="field.placeholder | translate"
1361
- [min]="field.min" [max]="field.max">
1362
- <div matSuffix>
1363
- <mat-datepicker-toggle [for]="picker"></mat-datepicker-toggle>
1364
- <ng-content></ng-content>
1365
- </div>
1366
- <mat-datepicker #picker></mat-datepicker>
1367
- <mat-hint>{{field.hint}}</mat-hint>
1368
-
1369
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1370
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1371
- </ng-container>
1372
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1373
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1374
- </ng-container>
1375
- </mat-form-field>
1376
- ` }]
1377
- }] });
1378
-
1379
- class KlesFormRadioComponent extends KlesFieldAbstract {
1380
- ngOnInit() { super.ngOnInit(); }
1381
- ngOnDestroy() {
1382
- super.ngOnDestroy();
1383
- }
1384
- }
1385
- KlesFormRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1386
- KlesFormRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormRadioComponent, selector: "kles-form-radiobutton", usesInheritance: true, ngImport: i0, template: `
1387
- <div [formGroup]="group">
1388
- <label class="radio-label-padding">{{field.label}}</label>
1389
- <mat-radio-group matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name">
1390
- <mat-radio-button *ngFor="let item of field.options" [value]="item">{{item}}</mat-radio-button>
1391
- </mat-radio-group>
1392
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1393
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1394
- </ng-container>
1395
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1396
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1397
- </ng-container>
1398
- </div>
1399
- `, 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: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$3.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { kind: "component", type: i5$3.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
1400
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormRadioComponent, decorators: [{
1401
- type: Component,
1402
- args: [{ selector: 'kles-form-radiobutton', template: `
1403
- <div [formGroup]="group">
1404
- <label class="radio-label-padding">{{field.label}}</label>
1405
- <mat-radio-group matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name">
1406
- <mat-radio-button *ngFor="let item of field.options" [value]="item">{{item}}</mat-radio-button>
1407
- </mat-radio-group>
1408
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1409
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1410
- </ng-container>
1411
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1412
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1413
- </ng-container>
1414
- </div>
1415
- ` }]
1416
- }] });
1417
-
1418
- let KlesFormCheckboxComponent = class KlesFormCheckboxComponent extends KlesFieldAbstract {
1419
- ngOnInit() { super.ngOnInit(); }
1420
- ngOnDestroy() {
1421
- super.ngOnDestroy();
1422
- }
1423
- };
1424
- KlesFormCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1425
- KlesFormCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormCheckboxComponent, selector: "kles-form-checkbox", usesInheritance: true, ngImport: i0, template: `
1426
- <div [formGroup]="group" >
1427
- <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>
1428
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1429
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1430
- </ng-container>
1431
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1432
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1433
- </ng-container>
1434
- </div>
1435
- `, 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: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i10.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
1436
- KlesFormCheckboxComponent = __decorate([
1437
- FieldMapper({ type: EnumType.checkbox })
1438
- ], KlesFormCheckboxComponent);
1439
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormCheckboxComponent, decorators: [{
1440
- type: Component,
1441
- args: [{ selector: 'kles-form-checkbox', template: `
1442
- <div [formGroup]="group" >
1443
- <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>
1444
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1445
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1446
- </ng-container>
1447
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1448
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
1449
- </ng-container>
1450
- </div>
1451
- ` }]
1452
- }] });
1453
-
1454
- class KlesFormListFieldComponent extends KlesFieldAbstract {
1455
- constructor(fb, viewRef) {
1456
- super(viewRef);
1457
- this.fb = fb;
1458
- this.viewRef = viewRef;
1459
- }
1460
- ngOnInit() {
1461
- this.formArray = this.group.controls[this.field.name];
1462
- super.ngOnInit();
1463
- }
1464
- createFormGroup() {
1465
- const group = this.fb.group({});
1466
- this.field.collections.forEach(item => {
1467
- const control = this.fb.control(null, this.bindValidations(item.validations || []), this.bindAsyncValidations(item.asyncValidations || []));
1468
- group.addControl(item.name, control);
1469
- });
1470
- return group;
1471
- }
1472
- deleteField(index) {
1473
- this.formArray.removeAt(index);
1474
- }
1475
- addField() {
1476
- this.formArray.push(this.createFormGroup());
1477
- }
1478
- bindValidations(validations) {
1479
- if (validations.length > 0) {
1480
- const validList = [];
1481
- validations.forEach(valid => {
1482
- validList.push(valid.validator);
1483
- });
1484
- return Validators.compose(validList);
1485
- }
1486
- return null;
1487
- }
1488
- bindAsyncValidations(validations) {
1489
- if (validations.length > 0) {
1490
- const validList = [];
1491
- validations.forEach(valid => {
1492
- validList.push(valid.validator);
1493
- });
1494
- return Validators.composeAsync(validList);
1495
- }
1496
- return null;
1497
- }
1498
- ngOnDestroy() {
1499
- super.ngOnDestroy();
1500
- }
1501
- }
1502
- KlesFormListFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormListFieldComponent, deps: [{ token: i2.UntypedFormBuilder }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
1503
- KlesFormListFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormListFieldComponent, selector: "kles-form-listfield", usesInheritance: true, ngImport: i0, template: `
1504
- <div [formGroup]="group" class="form-element">
1505
- {{field.label | translate}}
1506
- <button mat-icon-button color="primary" (click)="addField()">
1507
- <mat-icon>add</mat-icon>
1508
- </button>
1509
-
1510
- <div class="dynamic-form" [formGroupName]="field.name">
1511
- <div *ngFor="let subGroup of formArray.controls let index = index;" fxLayout="row" fxLayoutGap="5px">
1512
- <ng-container *ngFor="let subfield of field.collections;"
1513
- dynamicField [field]="subfield" [group]="subGroup">
1514
- </ng-container>
1515
- <button mat-icon-button (click)="deleteField(index)" color="primary">
1516
- <mat-icon>delete_outlined</mat-icon>
1517
- </button>
1518
- </div>
1519
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1520
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1521
- </ng-container>
1522
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1523
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1524
- </ng-container>
1525
- </div>
1526
- </div>
1527
- `, 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.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
1528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormListFieldComponent, decorators: [{
1529
- type: Component,
1530
- args: [{ selector: 'kles-form-listfield', template: `
1531
- <div [formGroup]="group" class="form-element">
1532
- {{field.label | translate}}
1533
- <button mat-icon-button color="primary" (click)="addField()">
1534
- <mat-icon>add</mat-icon>
1535
- </button>
1536
-
1537
- <div class="dynamic-form" [formGroupName]="field.name">
1538
- <div *ngFor="let subGroup of formArray.controls let index = index;" fxLayout="row" fxLayoutGap="5px">
1539
- <ng-container *ngFor="let subfield of field.collections;"
1540
- dynamicField [field]="subfield" [group]="subGroup">
1541
- </ng-container>
1542
- <button mat-icon-button (click)="deleteField(index)" color="primary">
1543
- <mat-icon>delete_outlined</mat-icon>
1544
- </button>
1545
- </div>
1546
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1547
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1548
- </ng-container>
1549
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1550
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1551
- </ng-container>
1552
- </div>
1553
- </div>
1554
- ` }]
1555
- }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }, { type: i0.ViewContainerRef }]; } });
1556
-
1557
- class KlesFormColorComponent extends KlesFieldAbstract {
1558
- ngOnInit() { super.ngOnInit(); }
1559
- invertColor(hex, bw) {
1560
- if (hex.indexOf('#') === 0) {
1561
- hex = hex.slice(1);
1562
- }
1563
- // convert 3-digit hex to 6-digits.
1564
- if (hex.length === 3) {
1565
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
1566
- }
1567
- if (hex.length !== 6) {
1568
- return '#000000';
1569
- }
1570
- let r = parseInt(hex.slice(0, 2), 16);
1571
- let g = parseInt(hex.slice(2, 4), 16);
1572
- let b = parseInt(hex.slice(4, 6), 16);
1573
- if (bw) {
1574
- return (r * 0.299 + g * 0.587 + b * 0.114) > 186
1575
- ? '#000000'
1576
- : '#FFFFFF';
1577
- }
1578
- // invert color components
1579
- const r1 = (255 - r).toString(16);
1580
- const g1 = (255 - g).toString(16);
1581
- const b1 = (255 - b).toString(16);
1582
- // pad each with zeros and return
1583
- return "#" + r1 + g1 + b1;
1584
- }
1585
- ngOnDestroy() {
1586
- super.ngOnDestroy();
1587
- }
1588
- }
1589
- KlesFormColorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormColorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1590
- KlesFormColorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormColorComponent, selector: "kles-form-color", usesInheritance: true, ngImport: i0, template: `
1591
- <mat-form-field [formGroup]="group" class="form-element">
1592
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate"
1593
- [colorPicker]="group.get(field.name).value"
1594
- [value]="group.get(field.name).value"
1595
- (colorPickerChange)="group.get(field.name).setValue($event)"
1596
- class="colorPicker"
1597
- [style.background]="group.get(field.name).value"
1598
- [style.color]="invertColor(group.get(field.name).value,true)"
1599
- [formControlName]="field.name">
1600
-
1601
- <div matSuffix>
1602
- <ng-content></ng-content>
1603
- </div>
1604
-
1605
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1606
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1607
- </ng-container>
1608
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1609
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1610
- </ng-container>
1611
- </mat-form-field>
1612
- `, 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$2.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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i5.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.TranslatePipe, name: "translate" }] });
1613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormColorComponent, decorators: [{
1614
- type: Component,
1615
- args: [{ selector: 'kles-form-color', template: `
1616
- <mat-form-field [formGroup]="group" class="form-element">
1617
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [placeholder]="field.placeholder | translate"
1618
- [colorPicker]="group.get(field.name).value"
1619
- [value]="group.get(field.name).value"
1620
- (colorPickerChange)="group.get(field.name).setValue($event)"
1621
- class="colorPicker"
1622
- [style.background]="group.get(field.name).value"
1623
- [style.color]="invertColor(group.get(field.name).value,true)"
1624
- [formControlName]="field.name">
1625
-
1626
- <div matSuffix>
1627
- <ng-content></ng-content>
1628
- </div>
1629
-
1630
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
1631
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1632
- </ng-container>
1633
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
1634
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
1635
- </ng-container>
1636
- </mat-form-field>
1637
- `, styles: ["mat-form-field{width:100%}\n"] }]
1638
- }] });
1639
-
1640
- class KlesButtonComponent {
1641
- constructor() {
1642
- this.name = '';
1643
- this.label = '';
1644
- this.color = 'accent';
1645
- this.icon = '';
1646
- this.iconSvg = '';
1647
- this.disabled = false;
1648
- this.type = 'submit';
1649
- this.classButton = '';
1650
- this.value = {};
1651
- this.onChange = () => { };
1652
- this.onTouched = () => { };
1653
- }
1654
- ngOnInit() {
1655
- }
1656
- click(event) {
1657
- this.value.event = this.name;
1658
- this.onChange(this.value);
1659
- }
1660
- writeValue(value) {
1661
- if (!value) {
1662
- value = { event: this.name };
1663
- }
1664
- if (!value.event) {
1665
- value.event = this.name;
1666
- }
1667
- if (value.uiButton) {
1668
- const uiButton = value.uiButton;
1669
- this.label = (uiButton.label) ? uiButton.label : this.label;
1670
- this.color = (uiButton.color) ? uiButton.color : this.color;
1671
- this.icon = (uiButton.icon) ? uiButton.icon : this.icon;
1672
- this.iconSvg = (uiButton.iconSvg) ? uiButton.iconSvg : this.iconSvg;
1673
- this.disabled = (uiButton.disabled) ? uiButton.disabled : this.disabled;
1674
- this.classButton = (uiButton.class) ? uiButton.class : this.classButton;
1675
- this.type = (uiButton.type) ? uiButton.type : 'submit';
1676
- }
1677
- this.value = value;
1678
- }
1679
- registerOnChange(fn) {
1680
- this.onChange = fn;
1681
- }
1682
- registerOnTouched(fn) {
1683
- this.onTouched = fn;
1684
- }
1685
- setDisabledState(isDisabled) {
1686
- this.disabled = isDisabled;
1687
- }
1688
- }
1689
- KlesButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1690
- KlesButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesButtonComponent, selector: "kles-button", inputs: { name: "name", label: "label", color: "color", icon: "icon", iconSvg: "iconSvg", disabled: "disabled", type: "type", classButton: "classButton", value: "value", tooltip: "tooltip" }, providers: [
1691
- {
1692
- provide: NG_VALUE_ACCESSOR,
1693
- useExisting: forwardRef(() => KlesButtonComponent),
1694
- multi: true
1695
- }
1696
- ], ngImport: i0, template: `
1697
- <span>
1698
- <button mat-button [type]="type" [ngClass]="classButton" [color]="(color)?color:'primary'" [disabled]="disabled"
1699
- (click)="click($event)" [matTooltip]="tooltip">
1700
- {{label | translate}}
1701
- <mat-icon *ngIf="icon">{{icon}}</mat-icon>
1702
- <mat-icon svgIcon="{{iconSvg}}" *ngIf="iconSvg"></mat-icon>
1703
- </button>
1704
- </span>
1705
- `, 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.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
1706
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesButtonComponent, decorators: [{
1707
- type: Component,
1708
- args: [{
1709
- selector: 'kles-button',
1710
- template: `
1711
- <span>
1712
- <button mat-button [type]="type" [ngClass]="classButton" [color]="(color)?color:'primary'" [disabled]="disabled"
1713
- (click)="click($event)" [matTooltip]="tooltip">
1714
- {{label | translate}}
1715
- <mat-icon *ngIf="icon">{{icon}}</mat-icon>
1716
- <mat-icon svgIcon="{{iconSvg}}" *ngIf="iconSvg"></mat-icon>
1717
- </button>
1718
- </span>
1719
- `,
1720
- providers: [
1721
- {
1722
- provide: NG_VALUE_ACCESSOR,
1723
- useExisting: forwardRef(() => KlesButtonComponent),
1724
- multi: true
1725
- }
1726
- ]
1727
- }]
1728
- }], propDecorators: { name: [{
1729
- type: Input
1730
- }], label: [{
1731
- type: Input
1732
- }], color: [{
1733
- type: Input
1734
- }], icon: [{
1735
- type: Input
1736
- }], iconSvg: [{
1737
- type: Input
1738
- }], disabled: [{
1739
- type: Input
1740
- }], type: [{
1741
- type: Input
1742
- }], classButton: [{
1743
- type: Input
1744
- }], value: [{
1745
- type: Input
1746
- }], tooltip: [{
1747
- type: Input
1748
- }] } });
1749
-
1750
- class KlesFormButtonComponent extends KlesFieldAbstract {
1751
- ngOnInit() {
1752
- super.ngOnInit();
1753
- }
1754
- ngOnDestroy() {
1755
- super.ngOnDestroy();
1756
- }
1757
- }
1758
- KlesFormButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1759
- KlesFormButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormButtonComponent, selector: "kles-form-button", usesInheritance: true, ngImport: i0, template: `
1760
- <div [formGroup]="group">
1761
- <kles-button
1762
- [attr.id]="field.id" [classButton]="field.ngClass"
1763
- [name]="field.name" [label]="field.label" [color]="field.color"
1764
- [icon]="field.icon"
1765
- [iconSvg]="field.iconSvg"
1766
- [value]="field.value"
1767
- [formControlName]="field.name"
1768
- [tooltip]="field.tooltip"
1769
- [type]="field.buttonType"
1770
- >
1771
- </kles-button>
1772
- </div>
1773
- `, 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", "type", "classButton", "value", "tooltip"] }] });
1774
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonComponent, decorators: [{
1775
- type: Component,
1776
- args: [{ selector: 'kles-form-button', template: `
1777
- <div [formGroup]="group">
1778
- <kles-button
1779
- [attr.id]="field.id" [classButton]="field.ngClass"
1780
- [name]="field.name" [label]="field.label" [color]="field.color"
1781
- [icon]="field.icon"
1782
- [iconSvg]="field.iconSvg"
1783
- [value]="field.value"
1784
- [formControlName]="field.name"
1785
- [tooltip]="field.tooltip"
1786
- [type]="field.buttonType"
1787
- >
1788
- </kles-button>
1789
- </div>
1790
- ` }]
1791
- }] });
1792
-
1793
- class KlesButtonCheckerComponent extends KlesButtonComponent {
1794
- constructor() {
1795
- super(...arguments);
1796
- this.value = {
1797
- busy: false,
1798
- error: [],
1799
- event: false
1800
- };
1801
- }
1802
- countError() {
1803
- return (this.value.error) ? this.value.error.length : 0;
1804
- }
1805
- }
1806
- KlesButtonCheckerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesButtonCheckerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1807
- KlesButtonCheckerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesButtonCheckerComponent, selector: "kles-button-checker", providers: [
1808
- {
1809
- provide: NG_VALUE_ACCESSOR,
1810
- useExisting: forwardRef(() => KlesButtonCheckerComponent),
1811
- multi: true
1812
- }
1813
- ], usesInheritance: true, ngImport: i0, template: `
1814
- <span *ngIf="value.error && !value.busy">
1815
- <kles-button
1816
- [classButton]="classButton"
1817
- [name]="name" [label]="label" [color]="color"
1818
- [icon]="icon" [iconSvg]="iconSvg"
1819
- [value]="value"
1820
- [tooltip]="tooltip"
1821
- [disabled]="disabled"
1822
- matBadge="{{countError()}}" (click)="click($event)">
1823
- </kles-button>
1824
- </span>
1825
- <span style="text-align: center;">
1826
- <span style="text-align: center;margin-right: 10px" *ngIf="value.busy||false">
1827
- <mat-spinner [diameter]="25"></mat-spinner>
1828
- </span>
1829
- <span *ngIf="value.message" style="margin-right: 10px">
1830
- {{value.message|translate}}
1831
- </span>
1832
- </span>
1833
- `, 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: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: KlesButtonComponent, selector: "kles-button", inputs: ["name", "label", "color", "icon", "iconSvg", "disabled", "type", "classButton", "value", "tooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
1834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesButtonCheckerComponent, decorators: [{
1835
- type: Component,
1836
- args: [{
1837
- selector: 'kles-button-checker',
1838
- template: `
1839
- <span *ngIf="value.error && !value.busy">
1840
- <kles-button
1841
- [classButton]="classButton"
1842
- [name]="name" [label]="label" [color]="color"
1843
- [icon]="icon" [iconSvg]="iconSvg"
1844
- [value]="value"
1845
- [tooltip]="tooltip"
1846
- [disabled]="disabled"
1847
- matBadge="{{countError()}}" (click)="click($event)">
1848
- </kles-button>
1849
- </span>
1850
- <span style="text-align: center;">
1851
- <span style="text-align: center;margin-right: 10px" *ngIf="value.busy||false">
1852
- <mat-spinner [diameter]="25"></mat-spinner>
1853
- </span>
1854
- <span *ngIf="value.message" style="margin-right: 10px">
1855
- {{value.message|translate}}
1856
- </span>
1857
- </span>
1858
- `,
1859
- providers: [
1860
- {
1861
- provide: NG_VALUE_ACCESSOR,
1862
- useExisting: forwardRef(() => KlesButtonCheckerComponent),
1863
- multi: true
1864
- }
1865
- ]
1866
- }]
1867
- }] });
1868
-
1869
- class KlesFormButtonCheckerComponent extends KlesFieldAbstract {
1870
- ngOnInit() {
1871
- super.ngOnInit();
1872
- }
1873
- ngOnDestroy() {
1874
- super.ngOnDestroy();
1875
- }
1876
- }
1877
- KlesFormButtonCheckerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonCheckerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1878
- KlesFormButtonCheckerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormButtonCheckerComponent, selector: "kles-form-button-checker", usesInheritance: true, ngImport: i0, template: `
1879
- <div [formGroup]="group">
1880
- <kles-button-checker
1881
- [attr.id]="field.id" [classButton]="field.ngClass"
1882
- [name]="field.name" [label]="field.label" [color]="field.color"
1883
- [icon]="field.icon"
1884
- [iconSvg]="field.iconSvg"
1885
- [value]="field.value"
1886
- [formControlName]="field.name"
1887
- [tooltip]="field.tooltip">
1888
- </kles-button-checker>
1889
- </div>
1890
- `, 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" }] });
1891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonCheckerComponent, decorators: [{
1892
- type: Component,
1893
- args: [{ selector: 'kles-form-button-checker', template: `
1894
- <div [formGroup]="group">
1895
- <kles-button-checker
1896
- [attr.id]="field.id" [classButton]="field.ngClass"
1897
- [name]="field.name" [label]="field.label" [color]="field.color"
1898
- [icon]="field.icon"
1899
- [iconSvg]="field.iconSvg"
1900
- [value]="field.value"
1901
- [formControlName]="field.name"
1902
- [tooltip]="field.tooltip">
1903
- </kles-button-checker>
1904
- </div>
1905
- ` }]
1906
- }] });
1907
-
1908
- class KlesButtonFileComponent extends KlesButtonComponent {
1909
- constructor() {
1910
- super(...arguments);
1911
- this.accept = '*.*';
1912
- this.fileReader = new FileReader();
1913
- this.value = {};
1914
- }
1915
- click(event) {
1916
- this.file.nativeElement.click();
1917
- }
1918
- writeValue(value) {
1919
- if (!value) {
1920
- value = { event: this.name };
1921
- }
1922
- if (!value.event) {
1923
- value.event = this.name;
1924
- }
1925
- if (value.uiButton) {
1926
- const uiButton = value.uiButton;
1927
- this.label = (uiButton.label) ? uiButton.label : this.label;
1928
- this.color = (uiButton.color) ? uiButton.color : this.color;
1929
- this.icon = (uiButton.icon) ? uiButton.icon : this.icon;
1930
- this.iconSvg = (uiButton.iconSvg) ? uiButton.iconSvg : this.iconSvg;
1931
- this.disabled = (uiButton.disabled) ? uiButton.disabled : this.disabled;
1932
- this.classButton = (uiButton.class) ? uiButton.class : this.classButton;
1933
- this.accept = (uiButton.accept) ? uiButton.accept : this.accept;
1934
- }
1935
- this.value = value;
1936
- }
1937
- onFileLoad(fileLoadedEvent) {
1938
- const textFromFileLoaded = fileLoadedEvent.target.result;
1939
- this.fileContent = textFromFileLoaded;
1940
- }
1941
- onFileSelect(input) {
1942
- return __awaiter(this, void 0, void 0, function* () {
1943
- if (input.files.length > 0) {
1944
- const files = input.files;
1945
- let fileContent = [];
1946
- if (files && files.length) {
1947
- for (let i = 0; i < files.length; i++) {
1948
- try {
1949
- fileContent[i] = yield this.readUploadedFile(files[i]);
1950
- }
1951
- catch (e) {
1952
- }
1953
- }
1954
- if (fileContent.length === 1) {
1955
- fileContent = fileContent[0];
1956
- }
1957
- }
1958
- this.value.event = this.name;
1959
- this.value.fileContent = fileContent;
1960
- this.onChange(this.value);
1961
- input.value = '';
1962
- }
1963
- });
1964
- }
1965
- readUploadedFile(inputFile) {
1966
- const temporaryFileReader = new FileReader();
1967
- return new Promise((resolve, reject) => {
1968
- temporaryFileReader.onerror = () => {
1969
- temporaryFileReader.abort();
1970
- const error = new DOMException('Problem parsing input file.');
1971
- reject(error);
1972
- };
1973
- temporaryFileReader.onload = () => {
1974
- resolve(temporaryFileReader.result);
1975
- };
1976
- temporaryFileReader.readAsArrayBuffer(inputFile);
1977
- });
1978
- }
1979
- }
1980
- KlesButtonFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesButtonFileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1981
- KlesButtonFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesButtonFileComponent, selector: "kles-button-file", inputs: { accept: "accept" }, providers: [
1982
- {
1983
- provide: NG_VALUE_ACCESSOR,
1984
- useExisting: forwardRef(() => KlesButtonFileComponent),
1985
- multi: true
1986
- }
1987
- ], viewQueries: [{ propertyName: "file", first: true, predicate: ["file"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
1988
- <input type="file" #file style="display: none" [accept]="accept" (change)="onFileSelect($event.target)" multiple />
1989
- <kles-button
1990
- [classButton]="classButton"
1991
- [name]="name" [label]="label" [color]="color"
1992
- [icon]="icon" [iconSvg]="iconSvg"
1993
- [disabled]="disabled"
1994
- [value]="value" (click)="click($event)">
1995
- </kles-button>
1996
- `, isInline: true, dependencies: [{ kind: "component", type: KlesButtonComponent, selector: "kles-button", inputs: ["name", "label", "color", "icon", "iconSvg", "disabled", "type", "classButton", "value", "tooltip"] }] });
1997
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesButtonFileComponent, decorators: [{
1998
- type: Component,
1999
- args: [{
2000
- selector: 'kles-button-file',
2001
- template: `
2002
- <input type="file" #file style="display: none" [accept]="accept" (change)="onFileSelect($event.target)" multiple />
2003
- <kles-button
2004
- [classButton]="classButton"
2005
- [name]="name" [label]="label" [color]="color"
2006
- [icon]="icon" [iconSvg]="iconSvg"
2007
- [disabled]="disabled"
2008
- [value]="value" (click)="click($event)">
2009
- </kles-button>
2010
- `,
2011
- providers: [
2012
- {
2013
- provide: NG_VALUE_ACCESSOR,
2014
- useExisting: forwardRef(() => KlesButtonFileComponent),
2015
- multi: true
2016
- }
2017
- ]
2018
- }]
2019
- }], propDecorators: { file: [{
2020
- type: ViewChild,
2021
- args: ['file']
2022
- }], accept: [{
2023
- type: Input
2024
- }] } });
2025
-
2026
- class KlesFormButtonFileComponent extends KlesFieldAbstract {
2027
- ngOnInit() {
2028
- super.ngOnInit();
2029
- }
2030
- ngOnDestroy() {
2031
- super.ngOnDestroy();
2032
- }
2033
- }
2034
- KlesFormButtonFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonFileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2035
- KlesFormButtonFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormButtonFileComponent, selector: "kles-form-button-file", usesInheritance: true, ngImport: i0, template: `
2036
- <div [formGroup]="group">
2037
- <kles-button-file
2038
- [attr.id]="field.id" [classButton]="field.ngClass"
2039
- [name]="field.name" [label]="field.label" [color]="field.color"
2040
- [icon]="field.icon"
2041
- [iconSvg]="field.iconSvg"
2042
- [value]="field.value"
2043
- [formControlName]="field.name"
2044
- [type]="field.buttonType"
2045
- [accept]="field.accept"
2046
- >
2047
- </kles-button-file>
2048
- </div>
2049
- `, 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", inputs: ["accept"] }] });
2050
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonFileComponent, decorators: [{
2051
- type: Component,
2052
- args: [{ selector: 'kles-form-button-file', template: `
2053
- <div [formGroup]="group">
2054
- <kles-button-file
2055
- [attr.id]="field.id" [classButton]="field.ngClass"
2056
- [name]="field.name" [label]="field.label" [color]="field.color"
2057
- [icon]="field.icon"
2058
- [iconSvg]="field.iconSvg"
2059
- [value]="field.value"
2060
- [formControlName]="field.name"
2061
- [type]="field.buttonType"
2062
- [accept]="field.accept"
2063
- >
2064
- </kles-button-file>
2065
- </div>
2066
- ` }]
2067
- }] });
2068
-
2069
- class KlesFormTextareaComponent extends KlesFieldAbstract {
2070
- ngOnInit() {
2071
- super.ngOnInit();
2072
- }
2073
- ngOnDestroy() {
2074
- super.ngOnDestroy();
2075
- }
2076
- }
2077
- KlesFormTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2078
- KlesFormTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormTextareaComponent, selector: "kles-form-textarea", usesInheritance: true, ngImport: i0, template: `
2079
- <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
2080
- <textarea matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2081
- [formControlName]="field.name" cdkTextareaAutosize [placeholder]="field.placeholder | translate"
2082
- [cdkAutosizeMinRows]="field.textareaAutoSize?.minRows" [cdkAutosizeMaxRows]="field.textareaAutoSize?.maxRows" [maxlength]="field.maxLength">
2083
- </textarea>
2084
-
2085
- <div matSuffix>
2086
- <ng-content></ng-content>
2087
- </div>
2088
-
2089
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2090
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2091
- </ng-container>
2092
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2093
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2094
- </ng-container>
2095
- </mat-form-field>
2096
- `, 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$2.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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i6$1.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
2097
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormTextareaComponent, decorators: [{
2098
- type: Component,
2099
- args: [{ selector: 'kles-form-textarea', template: `
2100
- <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
2101
- <textarea matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2102
- [formControlName]="field.name" cdkTextareaAutosize [placeholder]="field.placeholder | translate"
2103
- [cdkAutosizeMinRows]="field.textareaAutoSize?.minRows" [cdkAutosizeMaxRows]="field.textareaAutoSize?.maxRows" [maxlength]="field.maxLength">
2104
- </textarea>
2105
-
2106
- <div matSuffix>
2107
- <ng-content></ng-content>
2108
- </div>
2109
-
2110
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2111
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2112
- </ng-container>
2113
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2114
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2115
- </ng-container>
2116
- </mat-form-field>
2117
- `, styles: ["mat-form-field{width:100%}\n"] }]
2118
- }] });
2119
-
2120
- let KlesFormTextComponent = class KlesFormTextComponent extends KlesFieldAbstract {
2121
- ngOnInit() {
2122
- super.ngOnInit();
2123
- }
2124
- ngOnDestroy() {
2125
- super.ngOnDestroy();
2126
- }
2127
- };
2128
- KlesFormTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2129
- KlesFormTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormTextComponent, selector: "kles-form-text", usesInheritance: true, ngImport: i0, template: `
2130
- <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
2131
- {{((field.property && group.controls[field.name].value) ? group.controls[field.name].value[field.property] : group.controls[field.name].value) | klesTransform:field.pipeTransform}}
2132
- </span>
2133
- `, 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: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
2134
- KlesFormTextComponent = __decorate([
2135
- FieldMapper({ type: EnumType.text })
2136
- ], KlesFormTextComponent);
2137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormTextComponent, decorators: [{
2138
- type: Component,
2139
- args: [{
2140
- selector: 'kles-form-text',
2141
- template: `
2142
- <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
2143
- {{((field.property && group.controls[field.name].value) ? group.controls[field.name].value[field.property] : group.controls[field.name].value) | klesTransform:field.pipeTransform}}
2144
- </span>
2145
- `
2146
- }]
2147
- }] });
2148
-
2149
- class KlesFormChipComponent extends KlesFieldAbstract {
2150
- ngOnInit() { super.ngOnInit(); }
2151
- ngOnDestroy() {
2152
- super.ngOnDestroy();
2153
- }
2154
- }
2155
- KlesFormChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormChipComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2156
- KlesFormChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormChipComponent, selector: "kles-form-chip", usesInheritance: true, ngImport: i0, template: `
2157
- <div [formGroup]="group">
2158
- <mat-chip-listbox>
2159
- <mat-chip-option [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" selected [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
2160
- <mat-icon *ngIf="field.icon">{{field.icon}}</mat-icon>
2161
- {{group.controls[field.name].value | klesTransform:field.pipeTransform}}
2162
- </mat-chip-option>
2163
- </mat-chip-listbox>
2164
- </div>
2165
- `, 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$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$4.MatChipListbox, selector: "mat-chip-listbox", inputs: ["tabIndex", "multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i5$4.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["color", "disabled", "disableRipple", "tabIndex", "selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
2166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormChipComponent, decorators: [{
2167
- type: Component,
2168
- args: [{ selector: "kles-form-chip", template: `
2169
- <div [formGroup]="group">
2170
- <mat-chip-listbox>
2171
- <mat-chip-option [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" selected [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
2172
- <mat-icon *ngIf="field.icon">{{field.icon}}</mat-icon>
2173
- {{group.controls[field.name].value | klesTransform:field.pipeTransform}}
2174
- </mat-chip-option>
2175
- </mat-chip-listbox>
2176
- </div>
2177
- ` }]
2178
- }] });
2179
-
2180
- class KlesFormGroup extends KlesFormControl {
2181
- create() {
2182
- const subGroup = new UntypedFormGroup({});
2183
- if (this.field.collections && Array.isArray(this.field.collections)) {
2184
- this.field.collections.forEach(subfield => {
2185
- var _a, _b, _c, _d, _e, _f;
2186
- let control;
2187
- if (subfield.type) {
2188
- control = ((_a = componentMapper.find(c => c.type === subfield.type)) === null || _a === void 0 ? void 0 : _a.factory(Object.assign(Object.assign({}, subfield), { value: subfield.value || ((_b = this.field.value) === null || _b === void 0 ? void 0 : _b[subfield.name]) })))
2189
- || klesFieldControlFactory(Object.assign(Object.assign({}, subfield), { value: subfield.value || ((_c = this.field.value) === null || _c === void 0 ? void 0 : _c[subfield.name]) }));
2190
- }
2191
- else {
2192
- control = ((_d = componentMapper.find(c => c.component === subfield.component)) === null || _d === void 0 ? void 0 : _d.factory(Object.assign(Object.assign({}, subfield), { value: subfield.value || ((_e = this.field.value) === null || _e === void 0 ? void 0 : _e[subfield.name]) })))
2193
- || klesFieldControlFactory(Object.assign(Object.assign({}, subfield), { value: subfield.value || ((_f = this.field.value) === null || _f === void 0 ? void 0 : _f[subfield.name]) }));
2194
- }
2195
- subGroup.addControl(subfield.name, control);
2196
- });
2197
- }
2198
- if (this.field.disabled) {
2199
- subGroup.disable();
2200
- }
2201
- return subGroup;
2202
- }
2203
- }
2204
-
2205
- let KlesFormGroupComponent = class KlesFormGroupComponent extends KlesFieldAbstract {
2206
- ngOnInit() {
2207
- this.subGroup = this.group.controls[this.field.name];
2208
- super.ngOnInit();
2209
- }
2210
- ngOnDestroy() {
2211
- super.ngOnDestroy();
2212
- }
2213
- };
2214
- KlesFormGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2215
- KlesFormGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormGroupComponent, selector: "kles-group", usesInheritance: true, ngImport: i0, template: `
2216
- <div [formGroup]="group" class="group-container">
2217
- <div [formGroupName]="field.name" class="group-container" [style.flex-direction]="field.direction || 'inherit'" [ngClass]="field.ngClass">
2218
- <ng-container *ngFor="let subfield of field.collections;">
2219
- <ng-container *ngIf="subfield.visible !== false" klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
2220
- </ng-container>
2221
- </ng-container>
2222
- </div>
2223
- </div>
2224
- `, 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: 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.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"] }] });
2225
- KlesFormGroupComponent = __decorate([
2226
- FieldMapper({ type: EnumType.group, factory: (field) => (new KlesFormGroup(field).create()) })
2227
- ], KlesFormGroupComponent);
2228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormGroupComponent, decorators: [{
2229
- type: Component,
2230
- args: [{ selector: 'kles-group', template: `
2231
- <div [formGroup]="group" class="group-container">
2232
- <div [formGroupName]="field.name" class="group-container" [style.flex-direction]="field.direction || 'inherit'" [ngClass]="field.ngClass">
2233
- <ng-container *ngFor="let subfield of field.collections;">
2234
- <ng-container *ngIf="subfield.visible !== false" klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
2235
- </ng-container>
2236
- </ng-container>
2237
- </div>
2238
- </div>
2239
- `, styles: ["mat-form-field{width:100%}\n", ":host{display:flex;flex-direction:inherit}\n", ".group-container{display:flex;flex-direction:inherit;width:inherit}\n"] }]
2240
- }] });
2241
-
2242
- class KlesFormInputClearableComponent extends KlesFormInputComponent {
2243
- ngOnDestroy() {
2244
- super.ngOnDestroy();
2245
- }
2246
- }
2247
- KlesFormInputClearableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormInputClearableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2248
- KlesFormInputClearableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormInputClearableComponent, selector: "kles-form-input-clearable", usesInheritance: true, ngImport: i0, template: `
2249
- <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
2250
-
2251
- <ng-container *ngIf="field.autocomplete; else notAutoComplete">
2252
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2253
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
2254
- [matAutocomplete]="auto">
2255
-
2256
- <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
2257
- <ng-container *ngIf="!field.autocompleteComponent">
2258
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2259
- {{field.property ? option[field.property] : option}}
2260
- </mat-option>
2261
- </ng-container>
2262
-
2263
- <ng-container *ngIf="field.autocompleteComponent">
2264
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2265
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
2266
- </ng-container>
2267
- </mat-option>
2268
- </ng-container>
2269
- </mat-autocomplete>
2270
- </ng-container>
2271
-
2272
- <ng-template #notAutoComplete>
2273
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2274
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
2275
- </ng-template>
2276
- <button *ngIf="!group.get(field.name).disabled" matSuffix mat-icon-button aria-label="Clear" type="button"
2277
- (click)="group.controls[field.name].reset();">
2278
- <mat-icon>close</mat-icon>
2279
- </button>
2280
-
2281
- <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
2282
-
2283
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2284
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2285
- </ng-container>
2286
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2287
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2288
- </ng-container>
2289
- </mat-form-field>
2290
- `, 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.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4$2.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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i7$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i9$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i9$1.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.TranslatePipe, name: "translate" }] });
2291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormInputClearableComponent, decorators: [{
2292
- type: Component,
2293
- args: [{ selector: 'kles-form-input-clearable', template: `
2294
- <mat-form-field [formGroup]="group" [color]="field.color" class="form-element">
2295
-
2296
- <ng-container *ngIf="field.autocomplete; else notAutoComplete">
2297
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2298
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step"
2299
- [matAutocomplete]="auto">
2300
-
2301
- <mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn.bind(this)" [panelWidth]="this.field.panelWidth">
2302
- <ng-container *ngIf="!field.autocompleteComponent">
2303
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2304
- {{field.property ? option[field.property] : option}}
2305
- </mat-option>
2306
- </ng-container>
2307
-
2308
- <ng-container *ngIf="field.autocompleteComponent">
2309
- <mat-option *ngFor="let option of filteredOption | async" [value]="option">
2310
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="option" [field]="field">
2311
- </ng-container>
2312
- </mat-option>
2313
- </ng-container>
2314
- </mat-autocomplete>
2315
- </ng-container>
2316
-
2317
- <ng-template #notAutoComplete>
2318
- <input matInput matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [formControlName]="field.name" [placeholder]="field.placeholder | translate" [type]="field.inputType"
2319
- [maxLength]="field.maxLength" [min]="field.min" [max]="field.max" [step]="field.step">
2320
- </ng-template>
2321
- <button *ngIf="!group.get(field.name).disabled" matSuffix mat-icon-button aria-label="Clear" type="button"
2322
- (click)="group.controls[field.name].reset();">
2323
- <mat-icon>close</mat-icon>
2324
- </button>
2325
-
2326
- <mat-spinner matSuffix mode="indeterminate" *ngIf="isPending()" diameter="17"></mat-spinner>
2327
-
2328
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2329
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2330
- </ng-container>
2331
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2332
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2333
- </ng-container>
2334
- </mat-form-field>
2335
- `, styles: ["mat-form-field{width:100%}\n"] }]
2336
- }] });
2337
-
2338
- class KlesFormIconComponent extends KlesFieldAbstract {
2339
- ngOnInit() { super.ngOnInit(); }
2340
- ngOnDestroy() {
2341
- super.ngOnDestroy();
2342
- }
2343
- }
2344
- KlesFormIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormIconComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2345
- KlesFormIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormIconComponent, selector: "kles-form-icon", usesInheritance: true, ngImport: i0, template: `
2346
- <mat-icon [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
2347
- {{group.controls[field.name].value}}
2348
- </mat-icon>
2349
- `, 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$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
2350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormIconComponent, decorators: [{
2351
- type: Component,
2352
- args: [{ selector: "kles-form-icon", template: `
2353
- <mat-icon [color]="field.color" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass" [ngStyle]="field.ngStyle">
2354
- {{group.controls[field.name].value}}
2355
- </mat-icon>
2356
- ` }]
2357
- }] });
2358
-
2359
- class KlesFormSelectSearchComponent extends KlesFieldAbstract {
2360
- constructor(viewRef, ref) {
2361
- super(viewRef);
2362
- this.viewRef = viewRef;
2363
- this.ref = ref;
2364
- this.searchControl = new UntypedFormControl();
2365
- this.selectAllControl = new UntypedFormControl(false);
2366
- this.isLoading = false;
2367
- this.optionsFiltered$ = new ReplaySubject(1);
2368
- this.openChange$ = new BehaviorSubject(false);
2369
- this.compareFn = (o1, o2) => {
2370
- if (this.field.property && o1 && o2) {
2371
- return o1[this.field.property] === o2[this.field.property];
2372
- }
2373
- return o1 === o2;
2374
- };
2375
- }
2376
- ngOnInit() {
2377
- super.ngOnInit();
2378
- if (this.field.lazy) {
2379
- this.isLoading = true;
2380
- if (this.group.controls[this.field.name].value !== undefined && this.group.controls[this.field.name].value !== null) {
2381
- this.options$ = new BehaviorSubject(Array.isArray(this.group.controls[this.field.name].value) ? this.group.controls[this.field.name].value : [this.group.controls[this.field.name].value]);
2382
- this.isLoading = false;
2383
- }
2384
- else {
2385
- this.options$ = new BehaviorSubject([]);
2386
- }
2387
- this.openChangeEvent();
2388
- }
2389
- else {
2390
- if (this.field.options instanceof Observable) {
2391
- this.options$ = this.field.options;
2392
- }
2393
- else if (this.field.options instanceof Function) {
2394
- this.options$ = this.field.options();
2395
- }
2396
- else {
2397
- this.options$ = of(this.field.options);
2398
- }
2399
- }
2400
- this.searchControl.valueChanges.pipe(takeUntil(this._onDestroy), debounceTime(this.field.debounceTime || 0), startWith(this.searchControl.value), switchMap(value => {
2401
- return concat(of({ loading: true, options: [] }), this.onSearchChange(value).pipe(map((options) => ({ loading: false, options }))));
2402
- })).subscribe(({ loading, options }) => {
2403
- this.isLoading = loading;
2404
- this.optionsFiltered$.next(options);
2405
- this.ref.markForCheck();
2406
- });
2407
- if (this.field.multiple) {
2408
- this.group.controls[this.field.name]
2409
- .valueChanges.pipe(takeUntil(this._onDestroy), startWith(this.group.controls[this.field.name].value), map((selected) => (this.field.property ? selected === null || selected === void 0 ? void 0 : selected.map(s => s[this.field.property]) : selected)), switchMap(selected => {
2410
- return this.optionsFiltered$.pipe(map((options) => options === null || options === void 0 ? void 0 : options.filter((option) => !(option === null || option === void 0 ? void 0 : option.disabled)).map((option) => (this.field.property ? option[this.field.property] : option))), map(options => {
2411
- if (!selected) {
2412
- return false;
2413
- }
2414
- if (options.length < selected.length) {
2415
- return options.length > 0 && options.every(o => selected.includes(o));
2416
- }
2417
- else {
2418
- return options.length > 0 && options.length === selected.length && selected.every(s => options.includes(s));
2419
- }
2420
- }));
2421
- })).subscribe(isChecked => {
2422
- this.selectAllControl.setValue(isChecked);
2423
- });
2424
- }
2425
- }
2426
- ngOnDestroy() {
2427
- // this._onDestroy.next();
2428
- super.ngOnDestroy();
2429
- }
2430
- toggleAllSelection(state) {
2431
- if (state.checked) {
2432
- this.optionsFiltered$.pipe(take(1), map((options) => options.filter((option) => !(option === null || option === void 0 ? void 0 : option.disabled)))).subscribe(options => {
2433
- if (options.length > 0) {
2434
- this.group.controls[this.field.name].patchValue(options.slice());
2435
- }
2436
- });
2437
- }
2438
- else {
2439
- this.group.controls[this.field.name].patchValue([]);
2440
- }
2441
- }
2442
- openChangeEvent() {
2443
- this.openChange$
2444
- .pipe(takeUntil(this._onDestroy), switchMap((isOpen) => {
2445
- return this.onOpenChange(isOpen);
2446
- }))
2447
- .subscribe((options) => {
2448
- this.options$.next(options);
2449
- this.isLoading = false;
2450
- this.ref.markForCheck();
2451
- });
2452
- }
2453
- onOpenChange(isOpen) {
2454
- if (isOpen) {
2455
- if (this.field.options instanceof Observable) {
2456
- this.isLoading = true;
2457
- return this.field.options.pipe(take(1));
2458
- }
2459
- else if (this.field.options instanceof Function) {
2460
- this.isLoading = true;
2461
- return this.field.options().pipe(take(1));
2462
- }
2463
- else {
2464
- return of(this.field.options);
2465
- }
2466
- }
2467
- else {
2468
- return of(this.group.controls[this.field.name].value !== undefined && this.group.controls[this.field.name].value !== null
2469
- ? (Array.isArray(this.group.controls[this.field.name].value) ?
2470
- this.group.controls[this.field.name].value : [this.group.controls[this.field.name].value]) : []);
2471
- }
2472
- }
2473
- onSearchChange(value) {
2474
- if (value) {
2475
- const search = value.toLowerCase();
2476
- return this.options$.pipe(map(options => {
2477
- return options
2478
- .filter(option => {
2479
- if (this.field.searchKeys && this.field.searchKeys.length) {
2480
- return this.field.searchKeys.some(searchKey => {
2481
- if (option[searchKey]) {
2482
- return option[searchKey].toString().toLowerCase().indexOf(search) > -1;
2483
- }
2484
- return false;
2485
- }) || (this.field.property ?
2486
- option[this.field.property].toString().toLowerCase().indexOf(search) > -1 : false);
2487
- }
2488
- else {
2489
- if (this.field.property) {
2490
- return option[this.field.property].toString().toLowerCase().indexOf(search) > -1;
2491
- }
2492
- }
2493
- return option.toString().toLowerCase().indexOf(search) > -1;
2494
- });
2495
- }));
2496
- }
2497
- else {
2498
- return this.options$;
2499
- }
2500
- }
2501
- openChange($event) {
2502
- if (this.field.lazy) {
2503
- this.openChange$.next($event);
2504
- }
2505
- if (this.field.virtualScroll) {
2506
- if ($event) {
2507
- this.cdkVirtualScrollViewport.scrollToIndex(0);
2508
- this.cdkVirtualScrollViewport.checkViewportSize();
2509
- }
2510
- }
2511
- }
2512
- }
2513
- KlesFormSelectSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectSearchComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2514
- KlesFormSelectSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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: `
2515
- <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
2516
- <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2517
- (openedChange)="openChange($event)" [compareWith]="compareFn"
2518
- [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
2519
- <mat-select-trigger *ngIf="field.triggerComponent">
2520
- <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
2521
- </mat-select-trigger>
2522
-
2523
- <ng-container *ngIf="field.virtualScroll">
2524
- <mat-option>
2525
- <ngx-mat-select-search [formControl]="searchControl"
2526
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2527
- </mat-option>
2528
-
2529
- <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
2530
- <ng-container *ngIf="!isLoading; else emptyOption">
2531
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2532
- (change)="toggleAllSelection($event)">
2533
- {{'selectAll' | translate}}
2534
- </mat-checkbox>
2535
- <ng-container *ngIf="!field.autocompleteComponent">
2536
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2537
-
2538
- <ng-container *ngIf="field.multiple">
2539
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2540
- style="display:none">
2541
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2542
- </mat-option>
2543
- </ng-container>
2544
-
2545
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2546
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2547
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2548
- </mat-option>
2549
- </ng-container>
2550
- </ng-container>
2551
-
2552
- <ng-container *ngIf="field.autocompleteComponent">
2553
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2554
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2555
- </mat-option>
2556
-
2557
- <ng-container *ngIf="field.multiple">
2558
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2559
- style="display:none">
2560
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2561
- </mat-option>
2562
- </ng-container>
2563
-
2564
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2565
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2566
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2567
- </mat-option>
2568
- </ng-container>
2569
- </ng-container>
2570
- </ng-container>
2571
- <ng-template #emptyOption>
2572
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
2573
- </ng-template>
2574
- </cdk-virtual-scroll-viewport>
2575
-
2576
- </ng-container>
2577
-
2578
- <ng-container *ngIf="!field.virtualScroll">
2579
- <mat-option>
2580
- <ngx-mat-select-search [formControl]="searchControl"
2581
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2582
- </mat-option>
2583
-
2584
- <ng-container *ngIf="!isLoading; else emptyOption">
2585
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2586
- (change)="toggleAllSelection($event)">
2587
- {{'selectAll' | translate}}
2588
- </mat-checkbox>
2589
- <ng-container *ngIf="!field.autocompleteComponent">
2590
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2591
- </ng-container>
2592
-
2593
- <ng-container *ngIf="field.autocompleteComponent">
2594
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2595
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2596
- </mat-option>
2597
- </ng-container>
2598
- </ng-container>
2599
-
2600
- <ng-template #emptyOption>
2601
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
2602
- </ng-template>
2603
- </ng-container>
2604
- </mat-select>
2605
-
2606
- <div matSuffix>
2607
- <ng-content></ng-content>
2608
- </div>
2609
-
2610
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2611
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2612
- </ng-container>
2613
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2614
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2615
- </ng-container>
2616
- </mat-form-field>
2617
- `, isInline: true, styles: ["mat-form-field{width:100%}\n", ".selectAll{padding:10px 16px}\n", "::ng-deep .hide-checkbox .mat-pseudo-checkbox{display:none!important}\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$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.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { 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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "directive", type: i6.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i7$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i10.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i11.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i11.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i11.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: i12.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "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.TranslatePipe, name: "translate" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
2618
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectSearchComponent, decorators: [{
2619
- type: Component,
2620
- args: [{ selector: 'kles-form-select-search', template: `
2621
- <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
2622
- <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2623
- (openedChange)="openChange($event)" [compareWith]="compareFn"
2624
- [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
2625
- <mat-select-trigger *ngIf="field.triggerComponent">
2626
- <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
2627
- </mat-select-trigger>
2628
-
2629
- <ng-container *ngIf="field.virtualScroll">
2630
- <mat-option>
2631
- <ngx-mat-select-search [formControl]="searchControl"
2632
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2633
- </mat-option>
2634
-
2635
- <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
2636
- <ng-container *ngIf="!isLoading; else emptyOption">
2637
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2638
- (change)="toggleAllSelection($event)">
2639
- {{'selectAll' | translate}}
2640
- </mat-checkbox>
2641
- <ng-container *ngIf="!field.autocompleteComponent">
2642
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2643
-
2644
- <ng-container *ngIf="field.multiple">
2645
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2646
- style="display:none">
2647
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2648
- </mat-option>
2649
- </ng-container>
2650
-
2651
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2652
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2653
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2654
- </mat-option>
2655
- </ng-container>
2656
- </ng-container>
2657
-
2658
- <ng-container *ngIf="field.autocompleteComponent">
2659
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2660
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2661
- </mat-option>
2662
-
2663
- <ng-container *ngIf="field.multiple">
2664
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
2665
- style="display:none">
2666
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2667
- </mat-option>
2668
- </ng-container>
2669
-
2670
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
2671
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
2672
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2673
- </mat-option>
2674
- </ng-container>
2675
- </ng-container>
2676
- </ng-container>
2677
- <ng-template #emptyOption>
2678
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
2679
- </ng-template>
2680
- </cdk-virtual-scroll-viewport>
2681
-
2682
- </ng-container>
2683
-
2684
- <ng-container *ngIf="!field.virtualScroll">
2685
- <mat-option>
2686
- <ngx-mat-select-search [formControl]="searchControl"
2687
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
2688
- </mat-option>
2689
-
2690
- <ng-container *ngIf="!isLoading; else emptyOption">
2691
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
2692
- (change)="toggleAllSelection($event)">
2693
- {{'selectAll' | translate}}
2694
- </mat-checkbox>
2695
- <ng-container *ngIf="!field.autocompleteComponent">
2696
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
2697
- </ng-container>
2698
-
2699
- <ng-container *ngIf="field.autocompleteComponent">
2700
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
2701
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2702
- </mat-option>
2703
- </ng-container>
2704
- </ng-container>
2705
-
2706
- <ng-template #emptyOption>
2707
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
2708
- </ng-template>
2709
- </ng-container>
2710
- </mat-select>
2711
-
2712
- <div matSuffix>
2713
- <ng-content></ng-content>
2714
- </div>
2715
-
2716
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2717
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2718
- </ng-container>
2719
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2720
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
2721
- </ng-container>
2722
- </mat-form-field>
2723
- `, styles: ["mat-form-field{width:100%}\n", ".selectAll{padding:10px 16px}\n", "::ng-deep .hide-checkbox .mat-pseudo-checkbox{display:none!important}\n"] }]
2724
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { cdkVirtualScrollViewport: [{
2725
- type: ViewChild,
2726
- args: [CdkVirtualScrollViewport]
2727
- }], options: [{
2728
- type: ViewChildren,
2729
- args: [MatOption]
2730
- }] } });
2731
-
2732
- let KlesFormLineBreakComponent = class KlesFormLineBreakComponent extends KlesFieldAbstract {
2733
- ngOnInit() { super.ngOnInit(); }
2734
- ngOnDestroy() {
2735
- super.ngOnDestroy();
2736
- }
2737
- };
2738
- KlesFormLineBreakComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormLineBreakComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2739
- KlesFormLineBreakComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormLineBreakComponent, selector: "kles-form-line-break", usesInheritance: true, ngImport: i0, template: ``, isInline: true, styles: [":host{flex-basis:100%;display:flex;height:0}\n"] });
2740
- KlesFormLineBreakComponent = __decorate([
2741
- FieldMapper({ type: EnumType.lineBreak })
2742
- ], KlesFormLineBreakComponent);
2743
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormLineBreakComponent, decorators: [{
2744
- type: Component,
2745
- args: [{ selector: 'kles-form-line-break', template: ``, styles: [":host{flex-basis:100%;display:flex;height:0}\n"] }]
2746
- }] });
2747
-
2748
- class ArrayFormatPipe {
2749
- transform(values, property) {
2750
- if (values && Array.isArray(values)) {
2751
- if (property) {
2752
- return values.map(value => value[property]).filter(Boolean).join(', ');
2753
- }
2754
- else {
2755
- return values.join(', ');
2756
- }
2757
- }
2758
- return '';
2759
- }
2760
- }
2761
- ArrayFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ArrayFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2762
- ArrayFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ArrayFormatPipe, name: "arrayFormat" });
2763
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ArrayFormatPipe, decorators: [{
2764
- type: Pipe,
2765
- args: [{ name: 'arrayFormat' }]
2766
- }] });
2767
-
2768
- class KlesFormLinkComponent extends KlesFieldAbstract {
2769
- ngOnInit() {
2770
- super.ngOnInit();
2771
- }
2772
- ngOnDestroy() {
2773
- super.ngOnDestroy();
2774
- }
2775
- }
2776
- KlesFormLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2777
- KlesFormLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormLinkComponent, selector: "kles-form-link", usesInheritance: true, ngImport: i0, template: `
2778
- <a [href]="group.controls[field.name].value" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
2779
- {{field.label}}
2780
- </a>
2781
- `, 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: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
2782
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormLinkComponent, decorators: [{
2783
- type: Component,
2784
- args: [{
2785
- selector: 'kles-form-link',
2786
- template: `
2787
- <a [href]="group.controls[field.name].value" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass">
2788
- {{field.label}}
2789
- </a>
2790
- `
2791
- }]
2792
- }] });
2793
-
2794
- class KlesFormSlideToggleComponent extends KlesFieldAbstract {
2795
- ngOnInit() { super.ngOnInit(); }
2796
- ngOnDestroy() {
2797
- super.ngOnDestroy();
2798
- }
2799
- }
2800
- KlesFormSlideToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSlideToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2801
- KlesFormSlideToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormSlideToggleComponent, selector: "kles-form-slide-toggle", usesInheritance: true, ngImport: i0, template: `
2802
- <div [formGroup]="group" >
2803
- <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>
2804
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2805
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2806
- </ng-container>
2807
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2808
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2809
- </ng-container>
2810
- </div>
2811
- `, 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: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i6$2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
2812
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSlideToggleComponent, decorators: [{
2813
- type: Component,
2814
- args: [{ selector: 'kles-form-slide-toggle', template: `
2815
- <div [formGroup]="group" >
2816
- <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>
2817
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
2818
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2819
- </ng-container>
2820
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
2821
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message}}</mat-error>
2822
- </ng-container>
2823
- </div>
2824
- ` }]
2825
- }] });
2826
-
2827
- class KlesFormSelectionListComponent extends KlesFieldAbstract {
2828
- ngOnInit() {
2829
- super.ngOnInit();
2830
- if (this.field.options instanceof Observable) {
2831
- this.options$ = this.field.options;
2832
- }
2833
- else if (this.field.options instanceof Function) {
2834
- this.options$ = this.field.options();
2835
- }
2836
- else {
2837
- this.options$ = of(this.field.options);
2838
- }
2839
- }
2840
- ngOnDestroy() {
2841
- super.ngOnDestroy();
2842
- }
2843
- }
2844
- KlesFormSelectionListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectionListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2845
- KlesFormSelectionListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormSelectionListComponent, selector: "kles-form-selection-list", usesInheritance: true, ngImport: i0, template: `
2846
- <div class="margin-top" [formGroup]="group">
2847
- <mat-selection-list [formControlName]="field.name" [attr.id]="field.id" [multiple]="field.multiple" [ngClass]="field.ngClass">
2848
- <ng-container *ngIf="!field.autocompleteComponent">
2849
- <mat-list-option [value]="item" *ngFor="let item of options$ | async;">
2850
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2851
- </mat-list-option>
2852
- </ng-container>
2853
-
2854
- <ng-container *ngIf="field.autocompleteComponent">
2855
- <mat-list-option *ngFor="let item of options$ | async;" [value]="item">
2856
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2857
- </mat-list-option>
2858
- </ng-container>
2859
- </mat-selection-list>
2860
- </div>
2861
- `, 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$3.MatSelectionList, selector: "mat-selection-list", inputs: ["color", "compareWith", "multiple", "hideSingleSelectionIndicator", "disabled"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: i4$3.MatListOption, selector: "mat-list-option", inputs: ["togglePosition", "checkboxPosition", "color", "value", "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" }] });
2862
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectionListComponent, decorators: [{
2863
- type: Component,
2864
- args: [{ selector: 'kles-form-selection-list', template: `
2865
- <div class="margin-top" [formGroup]="group">
2866
- <mat-selection-list [formControlName]="field.name" [attr.id]="field.id" [multiple]="field.multiple" [ngClass]="field.ngClass">
2867
- <ng-container *ngIf="!field.autocompleteComponent">
2868
- <mat-list-option [value]="item" *ngFor="let item of options$ | async;">
2869
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2870
- </mat-list-option>
2871
- </ng-container>
2872
-
2873
- <ng-container *ngIf="field.autocompleteComponent">
2874
- <mat-list-option *ngFor="let item of options$ | async;" [value]="item">
2875
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
2876
- </mat-list-option>
2877
- </ng-container>
2878
- </mat-selection-list>
2879
- </div>
2880
- `, styles: ["mat-selection-list{width:100%;height:250px;overflow:auto}\n"] }]
2881
- }] });
2882
-
2883
- let KlesFormBadgeComponent = class KlesFormBadgeComponent extends KlesFieldAbstract {
2884
- ngOnInit() {
2885
- super.ngOnInit();
2886
- }
2887
- ngOnDestroy() {
2888
- super.ngOnDestroy();
2889
- }
2890
- };
2891
- KlesFormBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormBadgeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2892
- KlesFormBadgeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormBadgeComponent, selector: "kles-form-badge", usesInheritance: true, ngImport: i0, template: `
2893
- <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2894
- matBadge="{{group.controls[field.name].value}}" matBadgeOverlap="false" matBadgeColor="{{field.color}}">
2895
- </span>
2896
- `, 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: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
2897
- KlesFormBadgeComponent = __decorate([
2898
- FieldMapper({ type: EnumType.badge })
2899
- ], KlesFormBadgeComponent);
2900
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormBadgeComponent, decorators: [{
2901
- type: Component,
2902
- args: [{
2903
- selector: 'kles-form-badge',
2904
- template: `
2905
- <span matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
2906
- matBadge="{{group.controls[field.name].value}}" matBadgeOverlap="false" matBadgeColor="{{field.color}}">
2907
- </span>
2908
- `
2909
- }]
2910
- }] });
2911
-
2912
- class KlesFormButtonToogleGroupComponent extends KlesFieldAbstract {
2913
- ngOnInit() {
2914
- super.ngOnInit();
2915
- if (this.field.options instanceof Observable) {
2916
- this.options$ = this.field.options;
2917
- }
2918
- else if (this.field.options instanceof Function) {
2919
- this.options$ = this.field.options();
2920
- }
2921
- else {
2922
- this.options$ = of(this.field.options);
2923
- }
2924
- }
2925
- ngOnDestroy() {
2926
- super.ngOnDestroy();
2927
- }
2928
- }
2929
- KlesFormButtonToogleGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonToogleGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2930
- KlesFormButtonToogleGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormButtonToogleGroupComponent, selector: "kles-form-button-toogle-group", usesInheritance: true, ngImport: i0, template: `
2931
- <div [formGroup]="group" class="form-element">
2932
- <mat-button-toggle-group [formControlName]="field.name" [multiple]="field.multiple"
2933
- [attr.id]="field.id" [ngClass]="field.ngClass">
2934
- <mat-button-toggle *ngFor="let item of options$ | async" [value]="item">
2935
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2936
- </mat-button-toggle>
2937
- </mat-button-toggle-group>
2938
- </div>
2939
- `, 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$4.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i4$4.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" }] });
2940
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormButtonToogleGroupComponent, decorators: [{
2941
- type: Component,
2942
- args: [{
2943
- selector: 'kles-form-button-toogle-group',
2944
- template: `
2945
- <div [formGroup]="group" class="form-element">
2946
- <mat-button-toggle-group [formControlName]="field.name" [multiple]="field.multiple"
2947
- [attr.id]="field.id" [ngClass]="field.ngClass">
2948
- <mat-button-toggle *ngFor="let item of options$ | async" [value]="item">
2949
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
2950
- </mat-button-toggle>
2951
- </mat-button-toggle-group>
2952
- </div>
2953
- `
2954
- }]
2955
- }] });
2956
-
2957
- class KlesFormArray extends KlesFormControl {
2958
- create() {
2959
- const array = new FormArray([], {
2960
- validators: this.bindValidations(this.field.validations || []),
2961
- asyncValidators: this.bindAsyncValidations(this.field.asyncValidations || []),
2962
- updateOn: this.field.updateOn || 'change'
2963
- });
2964
- if (this.field.value && Array.isArray(this.field.value)) {
2965
- if (this.field.collections && Array.isArray(this.field.collections)) {
2966
- this.field.value.forEach(val => {
2967
- const group = new FormGroup({});
2968
- group.addControl('_id', new FormControl(v4()));
2969
- this.field.collections.forEach(subfield => {
2970
- var _a, _b;
2971
- const data = val[subfield.name] || null;
2972
- // const control = new KlesFormControl({ ...subfield, ...(data && { value: data }) }).create();
2973
- let control;
2974
- if (subfield.type) {
2975
- control = ((_a = componentMapper.find(c => c.type === subfield.type)) === null || _a === void 0 ? void 0 : _a.factory(Object.assign(Object.assign({}, subfield), (data && { value: data }))))
2976
- || klesFieldControlFactory(Object.assign(Object.assign({}, subfield), (data && { value: data })));
2977
- }
2978
- else {
2979
- control = ((_b = componentMapper.find(c => c.component === subfield.component)) === null || _b === void 0 ? void 0 : _b.factory(Object.assign(Object.assign({}, subfield), (data && { value: data }))))
2980
- || klesFieldControlFactory(Object.assign(Object.assign({}, subfield), (data && { value: data })));
2981
- }
2982
- group.addControl(subfield.name, control);
2983
- });
2984
- array.push(group);
2985
- });
2986
- }
2987
- }
2988
- else {
2989
- const group = new FormGroup({});
2990
- this.field.collections.forEach(subfield => {
2991
- var _a, _b;
2992
- // const control = new KlesFormControl({ ...subfield }).create();
2993
- let control;
2994
- if (subfield.type) {
2995
- control = ((_a = componentMapper.find(c => c.type === subfield.type)) === null || _a === void 0 ? void 0 : _a.factory(Object.assign({}, subfield)))
2996
- || klesFieldControlFactory(Object.assign({}, subfield));
2997
- }
2998
- else {
2999
- control = ((_b = componentMapper.find(c => c.component === subfield.component)) === null || _b === void 0 ? void 0 : _b.factory(Object.assign({}, subfield)))
3000
- || klesFieldControlFactory(Object.assign({}, subfield));
3001
- }
3002
- group.addControl(subfield.name, control);
3003
- });
3004
- array.push(group);
3005
- }
3006
- if (this.field.disabled) {
3007
- array.disable();
3008
- }
3009
- return array;
3010
- }
3011
- }
3012
-
3013
- let KlesFormArrayComponent = class KlesFormArrayComponent extends KlesFieldAbstract {
3014
- ngOnInit() {
3015
- // this.subGroup = this.group.controls[this.field.name] as FormGroup;
3016
- super.ngOnInit();
3017
- this.formArray = this.group.controls[this.field.name];
3018
- }
3019
- ngOnDestroy() {
3020
- super.ngOnDestroy();
3021
- }
3022
- };
3023
- KlesFormArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3024
- KlesFormArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormArrayComponent, selector: "kles-array", usesInheritance: true, ngImport: i0, template: `
3025
- <div [formGroup]="group">
3026
- <ng-container [formArrayName]="field.name">
3027
- <div class="group-container" *ngFor="let subGroup of formArray.controls let index = index;"
3028
- [ngClass]="field.direction === 'column' ? 'column': 'row'">
3029
- <ng-container *ngFor="let subfield of field.collections;">
3030
- <ng-container *ngIf="subfield.visible !== false"
3031
- klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
3032
- </ng-container>
3033
- </ng-container>
3034
- </div>
3035
- </ng-container>
3036
- </div>
3037
- `, 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: 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.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"] }] });
3038
- KlesFormArrayComponent = __decorate([
3039
- FieldMapper({ type: EnumType.array, factory: (field) => (new KlesFormArray(field).create()) })
3040
- ], KlesFormArrayComponent);
3041
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormArrayComponent, decorators: [{
3042
- type: Component,
3043
- args: [{ selector: 'kles-array', template: `
3044
- <div [formGroup]="group">
3045
- <ng-container [formArrayName]="field.name">
3046
- <div class="group-container" *ngFor="let subGroup of formArray.controls let index = index;"
3047
- [ngClass]="field.direction === 'column' ? 'column': 'row'">
3048
- <ng-container *ngFor="let subfield of field.collections;">
3049
- <ng-container *ngIf="subfield.visible !== false"
3050
- klesDynamicField [field]="subfield" [group]="subGroup" [siblingFields]="field.collections">
3051
- </ng-container>
3052
- </ng-container>
3053
- </div>
3054
- </ng-container>
3055
- </div>
3056
- `, 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"] }]
3057
- }] });
3058
-
3059
- class KlesFormRange extends KlesFormControl {
3060
- create() {
3061
- var _a, _b;
3062
- const range = new FormGroup({
3063
- start: new FormControl((_a = this.field.value) === null || _a === void 0 ? void 0 : _a.start),
3064
- end: new FormControl((_b = this.field.value) === null || _b === void 0 ? void 0 : _b.end),
3065
- }, {
3066
- validators: this.bindValidations(this.field.validations || []),
3067
- asyncValidators: this.bindAsyncValidations(this.field.asyncValidations || []),
3068
- });
3069
- if (this.field.disabled) {
3070
- range.disable();
3071
- }
3072
- return range;
3073
- }
3074
- }
3075
-
3076
- let KlesFormRangeComponent = class KlesFormRangeComponent extends KlesFieldAbstract {
3077
- // range = new FormGroup({
3078
- // start: new FormControl<Date | null>(null),
3079
- // end: new FormControl<Date | null>(null),
3080
- // });
3081
- ngOnInit() { super.ngOnInit(); }
3082
- ngOnDestroy() {
3083
- super.ngOnDestroy();
3084
- }
3085
- };
3086
- KlesFormRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormRangeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3087
- KlesFormRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormRangeComponent, selector: "kles-form-rangepicker", usesInheritance: true, ngImport: i0, template: `
3088
- <mat-form-field [color]="field.color" [formGroup]="group">
3089
-
3090
- <mat-label>{{field.label}}</mat-label>
3091
-
3092
- <mat-date-range-input [formGroupName]="field.name" [rangePicker]="picker" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
3093
- [min]="field.min" [max]="field.max" >
3094
- <input matStartDate formControlName="start" [placeholder]="(field.placeholder?.start ? field.placeholder?.start : '') | translate">
3095
- <input matEndDate formControlName="end" [placeholder]="(field.placeholder?.end ? field.placeholder?.end : '') | translate">
3096
- </mat-date-range-input>
3097
-
3098
- <div matSuffix>
3099
- <mat-datepicker-toggle [for]="picker" matSuffix></mat-datepicker-toggle>
3100
- <ng-content></ng-content>
3101
- </div>
3102
-
3103
- <mat-date-range-picker #picker></mat-date-range-picker>
3104
- <mat-hint>{{field.hint}}</mat-hint>
3105
-
3106
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
3107
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3108
- </ng-container>
3109
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
3110
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3111
- </ng-container>
3112
- </mat-form-field>
3113
- `, 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: 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: "component", type: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i5$2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i5$2.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i5$2.MatStartDate, selector: "input[matStartDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i5$2.MatEndDate, selector: "input[matEndDate]", inputs: ["errorStateMatcher"], outputs: ["dateChange", "dateInput"] }, { kind: "component", type: i5$2.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
3114
- KlesFormRangeComponent = __decorate([
3115
- FieldMapper({ type: EnumType.range, factory: (field) => (new KlesFormRange(field).create()) })
3116
- ], KlesFormRangeComponent);
3117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormRangeComponent, decorators: [{
3118
- type: Component,
3119
- args: [{ selector: "kles-form-rangepicker", template: `
3120
- <mat-form-field [color]="field.color" [formGroup]="group">
3121
-
3122
- <mat-label>{{field.label}}</mat-label>
3123
-
3124
- <mat-date-range-input [formGroupName]="field.name" [rangePicker]="picker" matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
3125
- [min]="field.min" [max]="field.max" >
3126
- <input matStartDate formControlName="start" [placeholder]="(field.placeholder?.start ? field.placeholder?.start : '') | translate">
3127
- <input matEndDate formControlName="end" [placeholder]="(field.placeholder?.end ? field.placeholder?.end : '') | translate">
3128
- </mat-date-range-input>
3129
-
3130
- <div matSuffix>
3131
- <mat-datepicker-toggle [for]="picker" matSuffix></mat-datepicker-toggle>
3132
- <ng-content></ng-content>
3133
- </div>
3134
-
3135
- <mat-date-range-picker #picker></mat-date-range-picker>
3136
- <mat-hint>{{field.hint}}</mat-hint>
3137
-
3138
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
3139
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3140
- </ng-container>
3141
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
3142
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3143
- </ng-container>
3144
- </mat-form-field>
3145
- `, styles: ["mat-form-field{width:100%}\n"] }]
3146
- }] });
3147
-
3148
- class KlesFormSelectLazySearchComponent extends KlesFormSelectSearchComponent {
3149
- constructor(viewRef, ref) {
3150
- super(viewRef, ref);
3151
- this.viewRef = viewRef;
3152
- this.ref = ref;
3153
- }
3154
- ngOnInit() {
3155
- this.field.lazy = true;
3156
- this.field.debounceTime = this.field.debounceTime ? this.field.debounceTime : 500;
3157
- super.ngOnInit();
3158
- }
3159
- ngOnDestroy() {
3160
- super.ngOnDestroy();
3161
- }
3162
- onSearchChange(value) {
3163
- if (this.field.options instanceof Function) {
3164
- if (this.openChange$.getValue() && this.field.options instanceof Function) {
3165
- if (value) {
3166
- return this.field.options(value).pipe(take(1));
3167
- }
3168
- else {
3169
- return this.field.options().pipe(take(1));
3170
- }
3171
- }
3172
- return of(this.group.controls[this.field.name].value ? [this.group.controls[this.field.name].value] : []);
3173
- }
3174
- else {
3175
- return super.onSearchChange(value);
3176
- }
3177
- }
3178
- openChangeEvent() {
3179
- this.openChange$
3180
- .pipe(takeUntil(this._onDestroy), switchMap((isOpen) => {
3181
- return this.onOpenChange(isOpen).pipe(map((options) => ({ options, isOpen })));
3182
- }))
3183
- .subscribe(({ options, isOpen }) => {
3184
- if (!isOpen) {
3185
- this.searchControl.reset(null, { emitEvent: false });
3186
- }
3187
- this.optionsFiltered$.next(options);
3188
- this.isLoading = false;
3189
- this.ref.markForCheck();
3190
- });
3191
- }
3192
- }
3193
- KlesFormSelectLazySearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectLazySearchComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3194
- KlesFormSelectLazySearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: KlesFormSelectLazySearchComponent, selector: "kles-form-select-lazy-search", usesInheritance: true, ngImport: i0, template: `
3195
- <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
3196
- <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
3197
- (openedChange)="openChange($event)" [compareWith]="compareFn"
3198
- [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
3199
- <mat-select-trigger *ngIf="field.triggerComponent">
3200
- <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
3201
- </mat-select-trigger>
3202
-
3203
- <ng-container *ngIf="field.virtualScroll">
3204
- <mat-option>
3205
- <ngx-mat-select-search [formControl]="searchControl" [clearSearchInput]="false"
3206
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
3207
- </mat-option>
3208
-
3209
- <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
3210
- <ng-container *ngIf="!isLoading; else emptyOption">
3211
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
3212
- (change)="toggleAllSelection($event)">
3213
- {{'selectAll' | translate}}
3214
- </mat-checkbox>
3215
- <ng-container *ngIf="!field.autocompleteComponent">
3216
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
3217
-
3218
- <ng-container *ngIf="field.multiple">
3219
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
3220
- style="display:none">
3221
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
3222
- </mat-option>
3223
- </ng-container>
3224
-
3225
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
3226
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
3227
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
3228
- </mat-option>
3229
- </ng-container>
3230
- </ng-container>
3231
-
3232
- <ng-container *ngIf="field.autocompleteComponent">
3233
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
3234
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3235
- </mat-option>
3236
-
3237
- <ng-container *ngIf="field.multiple">
3238
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
3239
- style="display:none">
3240
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3241
- </mat-option>
3242
- </ng-container>
3243
-
3244
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
3245
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
3246
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3247
- </mat-option>
3248
- </ng-container>
3249
- </ng-container>
3250
- </ng-container>
3251
- <ng-template #emptyOption>
3252
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
3253
- </ng-template>
3254
- </cdk-virtual-scroll-viewport>
3255
-
3256
- </ng-container>
3257
-
3258
- <ng-container *ngIf="!field.virtualScroll">
3259
- <mat-option>
3260
- <ngx-mat-select-search [formControl]="searchControl" [clearSearchInput]="false"
3261
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
3262
- </mat-option>
3263
-
3264
- <ng-container *ngIf="!isLoading; else emptyOption">
3265
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
3266
- (change)="toggleAllSelection($event)">
3267
- {{'selectAll' | translate}}
3268
- </mat-checkbox>
3269
- <ng-container *ngIf="!field.autocompleteComponent">
3270
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
3271
- </ng-container>
3272
-
3273
- <ng-container *ngIf="field.autocompleteComponent">
3274
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
3275
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3276
- </mat-option>
3277
- </ng-container>
3278
- </ng-container>
3279
-
3280
- <ng-template #emptyOption>
3281
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
3282
- </ng-template>
3283
- </ng-container>
3284
- </mat-select>
3285
-
3286
- <div matSuffix>
3287
- <ng-content></ng-content>
3288
- </div>
3289
-
3290
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
3291
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3292
- </ng-container>
3293
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
3294
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3295
- </ng-container>
3296
- </mat-form-field>
3297
- `, isInline: true, styles: ["mat-form-field{width:100%}\n", ".selectAll{padding:10px 16px}\n", "::ng-deep .hide-checkbox .mat-pseudo-checkbox{display:none!important}\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$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.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { 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: i5$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i5$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "directive", type: i6.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i7$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i10.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i11.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i11.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i11.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: i12.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "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.TranslatePipe, name: "translate" }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }] });
3298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesFormSelectLazySearchComponent, decorators: [{
3299
- type: Component,
3300
- args: [{ selector: 'kles-form-select-lazy-search', template: `
3301
- <mat-form-field class="margin-top" [color]="field.color" [formGroup]="group">
3302
- <mat-select matTooltip="{{field.tooltip}}" [attr.id]="field.id" [ngClass]="field.ngClass"
3303
- (openedChange)="openChange($event)" [compareWith]="compareFn"
3304
- [placeholder]="field.placeholder | translate" [formControlName]="field.name" [multiple]="field.multiple">
3305
- <mat-select-trigger *ngIf="field.triggerComponent">
3306
- <ng-container klesComponent [component]="field.triggerComponent" [value]="group.controls[field.name].value" [field]="field"></ng-container>
3307
- </mat-select-trigger>
3308
-
3309
- <ng-container *ngIf="field.virtualScroll">
3310
- <mat-option>
3311
- <ngx-mat-select-search [formControl]="searchControl" [clearSearchInput]="false"
3312
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
3313
- </mat-option>
3314
-
3315
- <cdk-virtual-scroll-viewport [itemSize]="field.itemSize || 50" [style.height.px]=4*48>
3316
- <ng-container *ngIf="!isLoading; else emptyOption">
3317
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
3318
- (change)="toggleAllSelection($event)">
3319
- {{'selectAll' | translate}}
3320
- </mat-checkbox>
3321
- <ng-container *ngIf="!field.autocompleteComponent">
3322
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
3323
-
3324
- <ng-container *ngIf="field.multiple">
3325
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
3326
- style="display:none">
3327
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
3328
- </mat-option>
3329
- </ng-container>
3330
-
3331
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
3332
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
3333
- {{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}
3334
- </mat-option>
3335
- </ng-container>
3336
- </ng-container>
3337
-
3338
- <ng-container *ngIf="field.autocompleteComponent">
3339
- <mat-option *cdkVirtualFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
3340
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3341
- </mat-option>
3342
-
3343
- <ng-container *ngIf="field.multiple">
3344
- <mat-option *ngFor="let item of group.controls[field.name].value | slice:0:30" [value]="item"
3345
- style="display:none">
3346
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3347
- </mat-option>
3348
- </ng-container>
3349
-
3350
- <ng-container *ngIf="!field.multiple && group.controls[field.name].value">
3351
- <mat-option *ngFor="let item of [group?.controls[field.name]?.value]" [value]="item" style="display:none">
3352
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3353
- </mat-option>
3354
- </ng-container>
3355
- </ng-container>
3356
- </ng-container>
3357
- <ng-template #emptyOption>
3358
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
3359
- </ng-template>
3360
- </cdk-virtual-scroll-viewport>
3361
-
3362
- </ng-container>
3363
-
3364
- <ng-container *ngIf="!field.virtualScroll">
3365
- <mat-option>
3366
- <ngx-mat-select-search [formControl]="searchControl" [clearSearchInput]="false"
3367
- placeholderLabel="" noEntriesFoundLabel =""></ngx-mat-select-search>
3368
- </mat-option>
3369
-
3370
- <ng-container *ngIf="!isLoading; else emptyOption">
3371
- <mat-checkbox *ngIf="field.multiple" class="selectAll" [formControl]="selectAllControl"
3372
- (change)="toggleAllSelection($event)">
3373
- {{'selectAll' | translate}}
3374
- </mat-checkbox>
3375
- <ng-container *ngIf="!field.autocompleteComponent">
3376
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">{{(field.property ? item[field.property] : item) | klesTransform:field.pipeTransform}}</mat-option>
3377
- </ng-container>
3378
-
3379
- <ng-container *ngIf="field.autocompleteComponent">
3380
- <mat-option *ngFor="let item of optionsFiltered$ | async" [value]="item" [disabled]="item?.disabled">
3381
- <ng-container klesComponent [component]="field.autocompleteComponent" [value]="item" [field]="field"></ng-container>
3382
- </mat-option>
3383
- </ng-container>
3384
- </ng-container>
3385
-
3386
- <ng-template #emptyOption>
3387
- <mat-option class="hide-checkbox" disabled><div fxLayout="row" fxLayoutAlign="space-between center">{{'loading' | translate}}... <mat-spinner class="spinner" diameter="20"></mat-spinner></div></mat-option>
3388
- </ng-template>
3389
- </ng-container>
3390
- </mat-select>
3391
-
3392
- <div matSuffix>
3393
- <ng-content></ng-content>
3394
- </div>
3395
-
3396
- <ng-container *ngFor="let validation of field.validations;" ngProjectAs="mat-error">
3397
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3398
- </ng-container>
3399
- <ng-container *ngFor="let validation of field.asyncValidations;" ngProjectAs="mat-error">
3400
- <mat-error *ngIf="group.get(field.name).hasError(validation.name)">{{validation.message | translate}}</mat-error>
3401
- </ng-container>
3402
- </mat-form-field>
3403
- `, styles: ["mat-form-field{width:100%}\n", ".selectAll{padding:10px 16px}\n", "::ng-deep .hide-checkbox .mat-pseudo-checkbox{display:none!important}\n"] }]
3404
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; } });
3405
-
3406
- const components = [
3407
- KlesDynamicFormComponent,
3408
- KlesFormLabelComponent,
3409
- KlesFormInputComponent,
3410
- KlesFormInputClearableComponent,
3411
- KlesFormSubmitButtonComponent,
3412
- KlesFormBadgeComponent,
3413
- KlesButtonComponent,
3414
- KlesFormButtonComponent,
3415
- KlesButtonCheckerComponent,
3416
- KlesFormButtonCheckerComponent,
3417
- KlesButtonFileComponent,
3418
- KlesFormButtonFileComponent,
3419
- KlesFormSelectComponent,
3420
- KlesFormDateComponent,
3421
- KlesFormRadioComponent,
3422
- KlesFormCheckboxComponent,
3423
- KlesFormListFieldComponent,
3424
- KlesFormColorComponent,
3425
- KlesFormTextareaComponent,
3426
- KlesFormTextComponent,
3427
- KlesFormChipComponent,
3428
- KlesFormGroupComponent,
3429
- KlesFormIconComponent,
3430
- KlesFormSelectSearchComponent,
3431
- KlesFormLineBreakComponent,
3432
- KlesFormLinkComponent,
3433
- KlesFormSlideToggleComponent,
3434
- KlesFormSelectionListComponent,
3435
- KlesFormButtonToogleGroupComponent,
3436
- KlesFormArrayComponent,
3437
- KlesFormRangeComponent,
3438
- KlesFormClearComponent,
3439
- KlesFormSelectLazySearchComponent
3440
- ];
3441
- const directives = [KlesDynamicFieldDirective, KlesComponentDirective];
3442
- const pipes = [KlesTransformPipe, ArrayFormatPipe];
3443
- class KlesMaterialDynamicformsModule {
3444
- }
3445
- KlesMaterialDynamicformsModule.declarations = [
3446
- components,
3447
- directives,
3448
- pipes
3449
- ];
3450
- KlesMaterialDynamicformsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesMaterialDynamicformsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3451
- KlesMaterialDynamicformsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: KlesMaterialDynamicformsModule, declarations: [KlesDynamicFormComponent,
3452
- KlesFormLabelComponent,
3453
- KlesFormInputComponent,
3454
- KlesFormInputClearableComponent,
3455
- KlesFormSubmitButtonComponent,
3456
- KlesFormBadgeComponent,
3457
- KlesButtonComponent,
3458
- KlesFormButtonComponent,
3459
- KlesButtonCheckerComponent,
3460
- KlesFormButtonCheckerComponent,
3461
- KlesButtonFileComponent,
3462
- KlesFormButtonFileComponent,
3463
- KlesFormSelectComponent,
3464
- KlesFormDateComponent,
3465
- KlesFormRadioComponent,
3466
- KlesFormCheckboxComponent,
3467
- KlesFormListFieldComponent,
3468
- KlesFormColorComponent,
3469
- KlesFormTextareaComponent,
3470
- KlesFormTextComponent,
3471
- KlesFormChipComponent,
3472
- KlesFormGroupComponent,
3473
- KlesFormIconComponent,
3474
- KlesFormSelectSearchComponent,
3475
- KlesFormLineBreakComponent,
3476
- KlesFormLinkComponent,
3477
- KlesFormSlideToggleComponent,
3478
- KlesFormSelectionListComponent,
3479
- KlesFormButtonToogleGroupComponent,
3480
- KlesFormArrayComponent,
3481
- KlesFormRangeComponent,
3482
- KlesFormClearComponent,
3483
- KlesFormSelectLazySearchComponent, KlesDynamicFieldDirective, KlesComponentDirective, KlesTransformPipe, ArrayFormatPipe], imports: [CommonModule,
3484
- ReactiveFormsModule,
3485
- TranslateModule,
3486
- FlexLayoutModule,
3487
- FormsModule,
3488
- MaterialModule,
3489
- ColorPickerModule,
3490
- NgxMatSelectSearchModule], exports: [KlesDynamicFormComponent,
3491
- KlesFormLabelComponent,
3492
- KlesFormInputComponent,
3493
- KlesFormInputClearableComponent,
3494
- KlesFormSubmitButtonComponent,
3495
- KlesFormBadgeComponent,
3496
- KlesButtonComponent,
3497
- KlesFormButtonComponent,
3498
- KlesButtonCheckerComponent,
3499
- KlesFormButtonCheckerComponent,
3500
- KlesButtonFileComponent,
3501
- KlesFormButtonFileComponent,
3502
- KlesFormSelectComponent,
3503
- KlesFormDateComponent,
3504
- KlesFormRadioComponent,
3505
- KlesFormCheckboxComponent,
3506
- KlesFormListFieldComponent,
3507
- KlesFormColorComponent,
3508
- KlesFormTextareaComponent,
3509
- KlesFormTextComponent,
3510
- KlesFormChipComponent,
3511
- KlesFormGroupComponent,
3512
- KlesFormIconComponent,
3513
- KlesFormSelectSearchComponent,
3514
- KlesFormLineBreakComponent,
3515
- KlesFormLinkComponent,
3516
- KlesFormSlideToggleComponent,
3517
- KlesFormSelectionListComponent,
3518
- KlesFormButtonToogleGroupComponent,
3519
- KlesFormArrayComponent,
3520
- KlesFormRangeComponent,
3521
- KlesFormClearComponent,
3522
- KlesFormSelectLazySearchComponent, KlesTransformPipe, ArrayFormatPipe, KlesDynamicFieldDirective, KlesComponentDirective, ColorPickerModule] });
3523
- KlesMaterialDynamicformsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesMaterialDynamicformsModule, providers: [
3524
- { provide: ErrorStateMatcher, useClass: KlesFormErrorStateMatcher },
3525
- pipes
3526
- ], imports: [CommonModule,
3527
- ReactiveFormsModule,
3528
- TranslateModule,
3529
- FlexLayoutModule,
3530
- FormsModule,
3531
- MaterialModule,
3532
- ColorPickerModule,
3533
- NgxMatSelectSearchModule, ColorPickerModule] });
3534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KlesMaterialDynamicformsModule, decorators: [{
3535
- type: NgModule,
3536
- args: [{
3537
- declarations: [
3538
- components,
3539
- directives,
3540
- pipes
3541
- ],
3542
- imports: [
3543
- CommonModule,
3544
- ReactiveFormsModule,
3545
- TranslateModule,
3546
- FlexLayoutModule,
3547
- FormsModule,
3548
- MaterialModule,
3549
- ColorPickerModule,
3550
- NgxMatSelectSearchModule
3551
- ],
3552
- providers: [
3553
- { provide: ErrorStateMatcher, useClass: KlesFormErrorStateMatcher },
3554
- pipes
3555
- ],
3556
- exports: [
3557
- components,
3558
- pipes,
3559
- directives,
3560
- ColorPickerModule
3561
- ],
3562
- schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
3563
- }]
3564
- }] });
3565
-
3566
- function autocompleteObjectValidator(optional) {
3567
- return (control) => {
3568
- if ((control.value === null || control.value === undefined) && !optional)
3569
- return { 'invalidAutocompleteObject': { value: control.value } };
3570
- if (typeof control.value === 'string') {
3571
- if (control.value === '' && optional)
3572
- return null;
3573
- return { 'invalidAutocompleteObject': { value: control.value } };
3574
- }
3575
- return null; /* valid option selected */
3576
- };
3577
- }
3578
- function autocompleteStringValidator(validOptions, optional) {
3579
- return (control) => {
3580
- if ((control.value === '' || control.value === null) && optional)
3581
- return null;
3582
- if (validOptions.indexOf(control.value) !== -1) {
3583
- return null; /* valid option selected */
3584
- }
3585
- return { 'invalidAutocompleteString': { value: control.value } };
3586
- };
3587
- }
3588
-
3589
- /*
3590
- * Public API Surface of kles-material-dynamicforms
3591
- */
3592
-
3593
- /**
3594
- * Generated bundle index. Do not edit.
3595
- */
3596
-
3597
- export { ArrayFormatPipe, EnumType, FieldMapper, KlesButtonCheckerComponent, KlesButtonComponent, KlesButtonFileComponent, KlesComponentDirective, KlesDynamicFieldDirective, KlesDynamicFormComponent, KlesFieldAbstract, KlesFormArray, KlesFormArrayComponent, KlesFormBadgeComponent, KlesFormButtonCheckerComponent, KlesFormButtonComponent, KlesFormButtonFileComponent, KlesFormButtonToogleGroupComponent, KlesFormCheckboxComponent, KlesFormChipComponent, KlesFormClearComponent, KlesFormColorComponent, KlesFormControl, KlesFormDateComponent, KlesFormErrorStateMatcher, KlesFormGroup, KlesFormGroupComponent, KlesFormIconComponent, KlesFormInputClearableComponent, KlesFormInputComponent, KlesFormLabelComponent, KlesFormLineBreakComponent, KlesFormLinkComponent, KlesFormListFieldComponent, KlesFormRadioComponent, KlesFormRange, KlesFormRangeComponent, KlesFormSelectComponent, KlesFormSelectLazySearchComponent, KlesFormSelectSearchComponent, KlesFormSelectionListComponent, KlesFormSlideToggleComponent, KlesFormSubmitButtonComponent, KlesFormTextComponent, KlesFormTextareaComponent, KlesMaterialDynamicformsModule, KlesTransformPipe, autocompleteObjectValidator, autocompleteStringValidator, componentMapper, klesFieldControlFactory };
3598
- //# sourceMappingURL=3kles-kles-material-dynamicforms.mjs.map