@olafvv/ngx-dynamic-form 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/esm2022/lib/components/dynamic-form-field/dynamic-form-field.component.mjs +16 -10
- package/esm2022/lib/controls/button/dynamic-button.component.mjs +3 -4
- package/esm2022/lib/controls/button/dynamic-button.model.mjs +1 -1
- package/esm2022/lib/controls/button-toggles/dynamic-button-toggles.component.mjs +3 -3
- package/esm2022/lib/controls/button-toggles/dynamic-button-toggles.model.mjs +1 -3
- package/esm2022/lib/controls/controls.mjs +2 -1
- package/esm2022/lib/controls/datepicker/dynamic-datepicker.component.mjs +31 -0
- package/esm2022/lib/controls/datepicker/dynamic-datepicker.model.mjs +13 -0
- package/esm2022/lib/controls/input/dynamic-input.component.mjs +6 -4
- package/esm2022/lib/controls/input/dynamic-input.model.mjs +3 -1
- package/esm2022/lib/controls/radio-group/dynamic-radio-group.model.mjs +1 -1
- package/esm2022/lib/controls/readonly/dynamic-readonly.model.mjs +1 -1
- package/esm2022/lib/controls/select/dynamic-select.model.mjs +1 -1
- package/esm2022/lib/controls/textarea/dynamic-textarea.model.mjs +1 -1
- package/esm2022/lib/models/classes/dynamic-form-field-base.mjs +4 -1
- package/esm2022/lib/models/classes/dynamic-form-field-model.mjs +4 -1
- package/esm2022/lib/models/classes/dynamic-form-field-value-model.mjs +11 -11
- package/esm2022/lib/models/interfaces/dynamic-form-field-config.interface.mjs +1 -1
- package/esm2022/lib/models/interfaces/dynamic-form-field-relation.interface.mjs +1 -1
- package/esm2022/lib/services/dynamic-form.service.mjs +2 -2
- package/fesm2022/olafvv-ngx-dynamic-form.mjs +83 -39
- package/fesm2022/olafvv-ngx-dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic-form-field/dynamic-form-field.component.d.ts +1 -0
- package/lib/controls/button/dynamic-button.model.d.ts +11 -1
- package/lib/controls/button-toggles/dynamic-button-toggles.model.d.ts +2 -8
- package/lib/controls/controls.d.ts +1 -0
- package/lib/controls/datepicker/dynamic-datepicker.component.d.ts +13 -0
- package/lib/controls/datepicker/dynamic-datepicker.model.d.ts +21 -0
- package/lib/controls/input/dynamic-input.model.d.ts +6 -2
- package/lib/controls/radio-group/dynamic-radio-group.model.d.ts +2 -2
- package/lib/controls/readonly/dynamic-readonly.model.d.ts +1 -1
- package/lib/controls/select/dynamic-select.model.d.ts +7 -0
- package/lib/controls/textarea/dynamic-textarea.model.d.ts +23 -0
- package/lib/models/classes/dynamic-form-field-base.d.ts +3 -0
- package/lib/models/classes/dynamic-form-field-model.d.ts +3 -0
- package/lib/models/classes/dynamic-form-field-value-model.d.ts +22 -7
- package/lib/models/interfaces/dynamic-form-field-config.interface.d.ts +14 -10
- package/lib/models/interfaces/dynamic-form-field-relation.interface.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { NgIf, NgClass
|
|
1
|
+
import { AsyncPipe, NgIf, NgClass } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Injectable, Inject, Optional, EventEmitter, Component, Input, Output, signal, ViewChild, inject, Injector, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { InjectionToken, Injectable, Inject, Optional, EventEmitter, Component, Input, Output, signal, ViewChild, inject, Injector, ChangeDetectorRef, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { UntypedFormControl, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
6
6
|
import { map, BehaviorSubject, of, isObservable, startWith, distinctUntilChanged, Subscription } from 'rxjs';
|
|
7
7
|
import * as i1$1 from '@angular/material/button-toggle';
|
|
8
8
|
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i2$1 from '@angular/material/form-field';
|
|
10
10
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
11
11
|
import * as i1$2 from '@angular/material/button';
|
|
12
12
|
import { MatButtonModule } from '@angular/material/button';
|
|
13
13
|
import * as i2 from '@angular/material/checkbox';
|
|
14
14
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
15
|
+
import * as i4 from '@angular/material/datepicker';
|
|
16
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
17
|
+
import * as i3 from '@angular/material/input';
|
|
18
|
+
import { MatInputModule, MatInput } from '@angular/material/input';
|
|
15
19
|
import * as i5 from '@angular/material/icon';
|
|
16
20
|
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
-
import * as
|
|
18
|
-
import {
|
|
19
|
-
import * as i2$
|
|
21
|
+
import * as i6 from '@angular/material/progress-spinner';
|
|
22
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
23
|
+
import * as i2$2 from '@angular/material/radio';
|
|
20
24
|
import { MatRadioModule } from '@angular/material/radio';
|
|
21
|
-
import * as i4 from '@angular/material/core';
|
|
25
|
+
import * as i4$1 from '@angular/material/core';
|
|
22
26
|
import { MatOptionModule } from '@angular/material/core';
|
|
23
27
|
import * as i3$1 from '@angular/material/select';
|
|
24
28
|
import { MatSelectModule } from '@angular/material/select';
|
|
@@ -85,11 +89,11 @@ class DynamicFormService {
|
|
|
85
89
|
const group = this.fb.group({});
|
|
86
90
|
config.forEach((row) => {
|
|
87
91
|
row.forEach((controlConfig) => {
|
|
88
|
-
const controlValueConfig = controlConfig;
|
|
89
92
|
const controlOptions = {
|
|
90
93
|
updateOn: controlConfig.updateOn,
|
|
91
94
|
validators: this.validatorsService.getValidatorFns(controlConfig.validators)
|
|
92
95
|
};
|
|
96
|
+
const controlValueConfig = controlConfig;
|
|
93
97
|
const control = new UntypedFormControl({ value: controlValueConfig.value ?? controlValueConfig.defaultValue, disabled: controlValueConfig.disabled }, controlOptions);
|
|
94
98
|
group.addControl(controlConfig.name, control);
|
|
95
99
|
});
|
|
@@ -135,6 +139,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
135
139
|
type: Optional
|
|
136
140
|
}] }, { type: i1.FormBuilder }, { type: DynamicFormValidationsService }] });
|
|
137
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Base class for the DynamicFormField component classes
|
|
144
|
+
*/
|
|
138
145
|
class DynamicFormFieldBase {
|
|
139
146
|
get id() {
|
|
140
147
|
return this.model.id ?? this.model.name;
|
|
@@ -169,11 +176,11 @@ class DynamicButtonTogglesComponent extends DynamicFormFieldBase {
|
|
|
169
176
|
this.change = new EventEmitter();
|
|
170
177
|
}
|
|
171
178
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicButtonTogglesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
172
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicButtonTogglesComponent, isStandalone: true, selector: "dynamic-button-toggles", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-button-toggles-wrapper\"\n [formGroup]=\"group\">\n <
|
|
179
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicButtonTogglesComponent, isStandalone: true, selector: "dynamic-button-toggles", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-button-toggles-wrapper\"\n [formGroup]=\"group\">\n <mat-button-toggle-group [id]=\"id\"\n [formControlName]=\"model.name\"\n [multiple]=\"model.multiple\"\n [vertical]=\"model.vertical\"\n (change)=\"onChange($event)\">\n\n @for(option of model.options$ | async; track option.value) {\n <mat-button-toggle [value]=\"option.value\">{{option.label}}</mat-button-toggle>\n }\n </mat-button-toggle-group>\n</div>", styles: [".dynamic-button-toggles-wrapper{height:var(--mat-form-field-container-height, 56px);display:flex;align-items:center}.dynamic-button-toggles-wrapper label{font-size:var(--mdc-typography-body2-font-size, 14px)}.dynamic-button-toggles-wrapper label.above{display:block;margin-bottom:8px}.dynamic-button-toggles-wrapper label.before{display:inline-block;margin-right:8px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonToggleModule }, { kind: "directive", type: i1$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i1$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatFormFieldModule }] }); }
|
|
173
180
|
}
|
|
174
181
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicButtonTogglesComponent, decorators: [{
|
|
175
182
|
type: Component,
|
|
176
|
-
args: [{ standalone: true, imports: [NgIf, NgClass, MatButtonToggleModule, ReactiveFormsModule, AsyncPipe, MatFormFieldModule], selector: 'dynamic-button-toggles', template: "<div class=\"dynamic-button-toggles-wrapper\"\n [formGroup]=\"group\">\n <
|
|
183
|
+
args: [{ standalone: true, imports: [NgIf, NgClass, MatButtonToggleModule, ReactiveFormsModule, AsyncPipe, MatFormFieldModule], selector: 'dynamic-button-toggles', template: "<div class=\"dynamic-button-toggles-wrapper\"\n [formGroup]=\"group\">\n <mat-button-toggle-group [id]=\"id\"\n [formControlName]=\"model.name\"\n [multiple]=\"model.multiple\"\n [vertical]=\"model.vertical\"\n (change)=\"onChange($event)\">\n\n @for(option of model.options$ | async; track option.value) {\n <mat-button-toggle [value]=\"option.value\">{{option.label}}</mat-button-toggle>\n }\n </mat-button-toggle-group>\n</div>", styles: [".dynamic-button-toggles-wrapper{height:var(--mat-form-field-container-height, 56px);display:flex;align-items:center}.dynamic-button-toggles-wrapper label{font-size:var(--mdc-typography-body2-font-size, 14px)}.dynamic-button-toggles-wrapper label.above{display:block;margin-bottom:8px}.dynamic-button-toggles-wrapper label.before{display:inline-block;margin-right:8px}\n"] }]
|
|
177
184
|
}], propDecorators: { model: [{
|
|
178
185
|
type: Input
|
|
179
186
|
}], group: [{
|
|
@@ -182,6 +189,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
182
189
|
type: Output
|
|
183
190
|
}] } });
|
|
184
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Base class for all DynamicFormFields
|
|
194
|
+
*/
|
|
185
195
|
class DynamicFormFieldModel {
|
|
186
196
|
constructor(config) {
|
|
187
197
|
this.id = config.id ?? config.name;
|
|
@@ -211,25 +221,25 @@ class DynamicFormFieldModel {
|
|
|
211
221
|
}
|
|
212
222
|
}
|
|
213
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Base class for a DynamicFormField with a value
|
|
226
|
+
*/
|
|
214
227
|
class DynamicFormFieldValueModel extends DynamicFormFieldModel {
|
|
215
228
|
constructor(config) {
|
|
216
229
|
super(config);
|
|
217
|
-
this.
|
|
218
|
-
|
|
219
|
-
this._value$ = new BehaviorSubject(
|
|
220
|
-
this.
|
|
221
|
-
}
|
|
222
|
-
get defaultValue() {
|
|
223
|
-
return this._defaultValue;
|
|
224
|
-
}
|
|
225
|
-
set defaultValue(val) {
|
|
226
|
-
this._defaultValue = val;
|
|
230
|
+
this.defaultValue = config.defaultValue ?? null;
|
|
231
|
+
const val = config.value ?? null;
|
|
232
|
+
this._value$ = new BehaviorSubject(val);
|
|
233
|
+
this._valueChanged = config.valueChanged;
|
|
227
234
|
}
|
|
228
235
|
get value() {
|
|
229
236
|
return this._value$.getValue();
|
|
230
237
|
}
|
|
231
238
|
set value(val) {
|
|
232
239
|
this._value$.next(val);
|
|
240
|
+
if (this._valueChanged) {
|
|
241
|
+
this._valueChanged(val);
|
|
242
|
+
}
|
|
233
243
|
}
|
|
234
244
|
}
|
|
235
245
|
|
|
@@ -286,8 +296,6 @@ class DynamicButtonToggles extends DynamicFormFieldOptionModel {
|
|
|
286
296
|
this.type = DYNAMIC_FORM_FIELD_BUTTON_TOGGLES;
|
|
287
297
|
this.multiple = config.multiple ?? false;
|
|
288
298
|
this.vertical = config.vertical ?? false;
|
|
289
|
-
this.showLabel = config.showLabel ?? false;
|
|
290
|
-
this.fieldLabelPosition = config.fieldLabelPosition ?? 'above';
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
301
|
|
|
@@ -296,11 +304,11 @@ class DynamicButtonComponent extends DynamicFormFieldBase {
|
|
|
296
304
|
this.model.onClick();
|
|
297
305
|
}
|
|
298
306
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
299
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DynamicButtonComponent, isStandalone: true, selector: "dynamic-button", inputs: { model: "model", group: "group" }, usesInheritance: true, ngImport: i0, template: "<button mat-button\n
|
|
307
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DynamicButtonComponent, isStandalone: true, selector: "dynamic-button", inputs: { model: "model", group: "group" }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-button-wrapper\">\n <button mat-button\n [id]=\"id\"\n [disabled]=\"model.disabled\"\n (click)=\"onClick()\">\n <span>{{model.label}}</span>\n </button>\n</div>", styles: [".dynamic-button-wrapper{height:var(--mat-form-field-container-height, 56px);display:flex;align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
|
|
300
308
|
}
|
|
301
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicButtonComponent, decorators: [{
|
|
302
310
|
type: Component,
|
|
303
|
-
args: [{ standalone: true, imports: [
|
|
311
|
+
args: [{ standalone: true, imports: [MatButtonModule], selector: 'dynamic-button', template: "<div class=\"dynamic-button-wrapper\">\n <button mat-button\n [id]=\"id\"\n [disabled]=\"model.disabled\"\n (click)=\"onClick()\">\n <span>{{model.label}}</span>\n </button>\n</div>", styles: [".dynamic-button-wrapper{height:var(--mat-form-field-container-height, 56px);display:flex;align-items:center}\n"] }]
|
|
304
312
|
}], propDecorators: { model: [{
|
|
305
313
|
type: Input
|
|
306
314
|
}], group: [{
|
|
@@ -356,6 +364,37 @@ class DynamicCheckbox extends DynamicFormFieldValueModel {
|
|
|
356
364
|
}
|
|
357
365
|
}
|
|
358
366
|
|
|
367
|
+
class DynamicDatepickerComponent extends DynamicFormFieldBase {
|
|
368
|
+
constructor() {
|
|
369
|
+
super(...arguments);
|
|
370
|
+
this.change = new EventEmitter();
|
|
371
|
+
}
|
|
372
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
373
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicDatepickerComponent, isStandalone: true, selector: "dynamic-datepicker", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"model.id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <input matInput\n [min]=\"model.min\"\n [max]=\"model.max\"\n [matDatepicker]=\"picker\">\n\n <mat-hint *ngIf=\"model.hint\">{{model.hint}}</mat-hint>\n\n <mat-datepicker-toggle matIconSuffix\n [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker\n [startAt]=\"model.startAt\"\n [startView]=\"model.startView\"></mat-datepicker>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n\n</mat-form-field>", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i4.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }] }); }
|
|
374
|
+
}
|
|
375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicDatepickerComponent, decorators: [{
|
|
376
|
+
type: Component,
|
|
377
|
+
args: [{ standalone: true, imports: [NgIf, ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule], selector: 'dynamic-datepicker', template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"model.id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <input matInput\n [min]=\"model.min\"\n [max]=\"model.max\"\n [matDatepicker]=\"picker\">\n\n <mat-hint *ngIf=\"model.hint\">{{model.hint}}</mat-hint>\n\n <mat-datepicker-toggle matIconSuffix\n [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker\n [startAt]=\"model.startAt\"\n [startView]=\"model.startView\"></mat-datepicker>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n\n</mat-form-field>", styles: ["mat-form-field{width:100%}\n"] }]
|
|
378
|
+
}], propDecorators: { model: [{
|
|
379
|
+
type: Input
|
|
380
|
+
}], group: [{
|
|
381
|
+
type: Input
|
|
382
|
+
}], change: [{
|
|
383
|
+
type: Output
|
|
384
|
+
}] } });
|
|
385
|
+
|
|
386
|
+
const DYNAMIC_FORM_FIELD_DATEPICKER = 'datepicker';
|
|
387
|
+
class DynamicDatepicker extends DynamicFormFieldValueModel {
|
|
388
|
+
constructor(config) {
|
|
389
|
+
super(config);
|
|
390
|
+
this.type = DYNAMIC_FORM_FIELD_DATEPICKER;
|
|
391
|
+
this.max = config.max ?? null;
|
|
392
|
+
this.min = config.min ?? null;
|
|
393
|
+
this.startAt = config.startAt ?? null;
|
|
394
|
+
this.startView = config.startView ?? 'month';
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
359
398
|
class DynamicInputComponent extends DynamicFormFieldBase {
|
|
360
399
|
constructor() {
|
|
361
400
|
super(...arguments);
|
|
@@ -368,7 +407,7 @@ class DynamicInputComponent extends DynamicFormFieldBase {
|
|
|
368
407
|
return `${this.valueCount} / ${this.model.maxLength}`;
|
|
369
408
|
}
|
|
370
409
|
get showClear() {
|
|
371
|
-
return !!this.control.value && !this.control.disabled;
|
|
410
|
+
return !!this.control.value && !this.control.disabled && !this.model.showLoader;
|
|
372
411
|
}
|
|
373
412
|
onChange(event) {
|
|
374
413
|
// Ignore the native HTML 5 change event
|
|
@@ -378,11 +417,11 @@ class DynamicInputComponent extends DynamicFormFieldBase {
|
|
|
378
417
|
this.change.emit(event);
|
|
379
418
|
}
|
|
380
419
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
381
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicInputComponent, isStandalone: true, selector: "dynamic-input", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, viewQueries: [{ propertyName: "input", first: true, predicate: MatInput, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <span matTextPrefix\n *ngIf=\"model.prefix\">{{model.prefix}}</span>\n\n <input matInput\n [type]=\"model.inputType\"\n [formControlName]=\"model.name\"\n [placeholder]=\"model.placeholder\"\n [attr.min]=\"model.min\"\n [attr.max]=\"model.max\"\n [attr.minLength]=\"model.minLength\"\n [attr.maxLength]=\"model.maxLength\"\n [pattern]=\"model.pattern\"\n [autocomplete]=\"model.autocomplete\"\n (change)=\"onChange($event)\" />\n\n <button matSuffix\n mat-icon-button\n *ngIf=\"showClear\"\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n <mat-hint *ngIf=\"model.maxLength\"\n align=\"end\">{{maxCountText}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type:
|
|
420
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicInputComponent, isStandalone: true, selector: "dynamic-input", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, viewQueries: [{ propertyName: "input", first: true, predicate: MatInput, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <span matTextPrefix\n *ngIf=\"model.prefix\">{{model.prefix}}</span>\n\n <input matInput\n [type]=\"model.inputType\"\n [formControlName]=\"model.name\"\n [placeholder]=\"model.placeholder\"\n [attr.min]=\"model.min\"\n [attr.max]=\"model.max\"\n [attr.minLength]=\"model.minLength\"\n [attr.maxLength]=\"model.maxLength\"\n [pattern]=\"model.pattern\"\n [autocomplete]=\"model.autocomplete\"\n (change)=\"onChange($event)\" />\n\n <button matSuffix\n mat-icon-button\n *ngIf=\"showClear\"\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n\n <div matSuffix\n *ngIf=\"model.showLoader()\"\n class=\"loaderIcon\">\n <mat-spinner diameter=\"16\"\n color=\"primary\"></mat-spinner>\n </div>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n <mat-hint *ngIf=\"model.maxLength\"\n align=\"end\">{{maxCountText}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}mat-form-field .loaderIcon{padding:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i6.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
|
|
382
421
|
}
|
|
383
422
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicInputComponent, decorators: [{
|
|
384
423
|
type: Component,
|
|
385
|
-
args: [{
|
|
424
|
+
args: [{ standalone: true, imports: [NgIf, ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatButtonModule, MatIconModule, MatProgressSpinnerModule], selector: 'dynamic-input', template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <span matTextPrefix\n *ngIf=\"model.prefix\">{{model.prefix}}</span>\n\n <input matInput\n [type]=\"model.inputType\"\n [formControlName]=\"model.name\"\n [placeholder]=\"model.placeholder\"\n [attr.min]=\"model.min\"\n [attr.max]=\"model.max\"\n [attr.minLength]=\"model.minLength\"\n [attr.maxLength]=\"model.maxLength\"\n [pattern]=\"model.pattern\"\n [autocomplete]=\"model.autocomplete\"\n (change)=\"onChange($event)\" />\n\n <button matSuffix\n mat-icon-button\n *ngIf=\"showClear\"\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n\n <div matSuffix\n *ngIf=\"model.showLoader()\"\n class=\"loaderIcon\">\n <mat-spinner diameter=\"16\"\n color=\"primary\"></mat-spinner>\n </div>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n <mat-hint *ngIf=\"model.maxLength\"\n align=\"end\">{{maxCountText}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}mat-form-field .loaderIcon{padding:8px}\n"] }]
|
|
386
425
|
}], propDecorators: { input: [{
|
|
387
426
|
type: ViewChild,
|
|
388
427
|
args: [MatInput, { static: true }]
|
|
@@ -410,6 +449,7 @@ class DynamicInput extends DynamicFormFieldValueModel {
|
|
|
410
449
|
this.autocomplete = config.autocomplete ?? 'off';
|
|
411
450
|
this.prefix = config.prefix ?? null;
|
|
412
451
|
this.hideClearIcon = config.hideClearIcon ?? false;
|
|
452
|
+
this.showLoader = config.showLoader ?? signal(false);
|
|
413
453
|
}
|
|
414
454
|
}
|
|
415
455
|
|
|
@@ -419,7 +459,7 @@ class DymamicRadioGroupComponent extends DynamicFormFieldBase {
|
|
|
419
459
|
this.change = new EventEmitter();
|
|
420
460
|
}
|
|
421
461
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DymamicRadioGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
422
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DymamicRadioGroupComponent, isStandalone: true, selector: "dynamic-radio-group", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-radio-group-wrapper\"\n [formGroup]=\"group\">\n <label *ngIf=\"model.label\">{{model.label}}</label>\n <mat-radio-group [formControlName]=\"model.name\"\n class=\"radio-group\"\n [ngClass]=\"{'inline': model.inline}\"\n (change)=\"onChange($event)\">\n @for(option of model.options$ | async; track option.value) {\n <mat-radio-button [value]=\"option.value\"\n [labelPosition]=\"model.labelPosition\">\n {{option.label}}\n </mat-radio-button>\n }\n </mat-radio-group>\n</div>", styles: [".dynamic-radio-group-wrapper label{display:block;font-size:var(--mdc-typography-body2-font-size, 14px);margin-bottom:8px}.dynamic-radio-group-wrapper .radio-group:not(.inline){display:flex;flex-direction:column;align-items:flex-start}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i2$
|
|
462
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DymamicRadioGroupComponent, isStandalone: true, selector: "dynamic-radio-group", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-radio-group-wrapper\"\n [formGroup]=\"group\">\n <label *ngIf=\"model.label\">{{model.label}}</label>\n <mat-radio-group [formControlName]=\"model.name\"\n class=\"radio-group\"\n [ngClass]=\"{'inline': model.inline}\"\n (change)=\"onChange($event)\">\n @for(option of model.options$ | async; track option.value) {\n <mat-radio-button [value]=\"option.value\"\n [labelPosition]=\"model.labelPosition\">\n {{option.label}}\n </mat-radio-button>\n }\n </mat-radio-group>\n</div>", styles: [".dynamic-radio-group-wrapper label{display:block;font-size:var(--mdc-typography-body2-font-size, 14px);margin-bottom:8px}.dynamic-radio-group-wrapper .radio-group:not(.inline){display:flex;flex-direction:column;align-items:flex-start}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i2$2.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i2$2.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
423
463
|
}
|
|
424
464
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DymamicRadioGroupComponent, decorators: [{
|
|
425
465
|
type: Component,
|
|
@@ -469,7 +509,7 @@ class DynamicSelectComponent extends DynamicFormFieldBase {
|
|
|
469
509
|
this.change = new EventEmitter();
|
|
470
510
|
}
|
|
471
511
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
472
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicSelectComponent, isStandalone: true, selector: "dynamic-select", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label>{{model.label}}</mat-label>\n\n <!-- Template for select without grouped options -->\n <ng-container *ngIf=\"model.options$ | async as options\">\n <ng-container *ngIf=\"!model.native else nativeSelect\">\n <mat-select [formControlName]=\"model.name\"\n [multiple]=\"model.multiple\"\n (selectionChange)=\"onChange($event)\">\n @for(option of options; track option.value) {\n <mat-option [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n }\n </mat-select>\n </ng-container>\n\n <ng-template #nativeSelect>\n <select matNativeControl\n (selectionchange)=\"onChange($event)\">\n @for(option of options; track option.value) {\n <option [value]=\"option.value\">\n {{option.label}}\n </option>\n }\n </select>\n </ng-template>\n </ng-container>\n\n <!-- Template for select with grouped options -->\n <ng-container *ngIf=\"model.groupedOptions$ | async as groupedOptions\">\n <ng-container *ngIf=\"!model.native else nativeSelectGrouped\">\n <mat-select [formControlName]=\"model.name\"\n (selectionChange)=\"onChange($event)\">\n @for(group of groupedOptions; track group.name) {\n <mat-optgroup [label]=\"group.name\">\n @for(option of group.options; track option.value) {\n <mat-option [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n }\n </mat-optgroup>\n }\n\n </mat-select>\n </ng-container>\n\n <ng-template #nativeSelectGrouped>\n <select matNativeControl\n (selectionchange)=\"onChange($event)\">\n @for(group of groupedOptions; track group.name) {=\n <optgroup [label]=\"group.name\">\n @for(option of group.options; track option.value) {\n <option [value]=\"option.value\">\n {{option.label}}\n </option>\n }\n </optgroup>\n }\n </select>\n </ng-template>\n </ng-container>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}mat-option{padding-top:8px;padding-bottom:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type:
|
|
512
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicSelectComponent, isStandalone: true, selector: "dynamic-select", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label>{{model.label}}</mat-label>\n\n <!-- Template for select without grouped options -->\n <ng-container *ngIf=\"model.options$ | async as options\">\n <ng-container *ngIf=\"!model.native else nativeSelect\">\n <mat-select [formControlName]=\"model.name\"\n [multiple]=\"model.multiple\"\n (selectionChange)=\"onChange($event)\">\n @for(option of options; track option.value) {\n <mat-option [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n }\n </mat-select>\n </ng-container>\n\n <ng-template #nativeSelect>\n <select matNativeControl\n (selectionchange)=\"onChange($event)\">\n @for(option of options; track option.value) {\n <option [value]=\"option.value\">\n {{option.label}}\n </option>\n }\n </select>\n </ng-template>\n </ng-container>\n\n <!-- Template for select with grouped options -->\n <ng-container *ngIf=\"model.groupedOptions$ | async as groupedOptions\">\n <ng-container *ngIf=\"!model.native else nativeSelectGrouped\">\n <mat-select [formControlName]=\"model.name\"\n (selectionChange)=\"onChange($event)\">\n @for(group of groupedOptions; track group.name) {\n <mat-optgroup [label]=\"group.name\">\n @for(option of group.options; track option.value) {\n <mat-option [value]=\"option.value\">\n {{option.label}}\n </mat-option>\n }\n </mat-optgroup>\n }\n\n </mat-select>\n </ng-container>\n\n <ng-template #nativeSelectGrouped>\n <select matNativeControl\n (selectionchange)=\"onChange($event)\">\n @for(group of groupedOptions; track group.name) {=\n <optgroup [label]=\"group.name\">\n @for(option of group.options; track option.value) {\n <option [value]=\"option.value\">\n {{option.label}}\n </option>\n }\n </optgroup>\n }\n </select>\n </ng-template>\n </ng-container>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}mat-option{padding-top:8px;padding-bottom:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3$1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i4$1.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: MatOptionModule }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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"] }] }); }
|
|
473
513
|
}
|
|
474
514
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicSelectComponent, decorators: [{
|
|
475
515
|
type: Component,
|
|
@@ -511,7 +551,7 @@ class DynamicTextareaComponent extends DynamicFormFieldBase {
|
|
|
511
551
|
this.change.emit(event);
|
|
512
552
|
}
|
|
513
553
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
514
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicTextareaComponent, isStandalone: true, selector: "dynamic-textarea", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, viewQueries: [{ propertyName: "textarea", first: true, predicate: MatInput, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <textarea matInput\n [cdkTextareaAutosize]=\"model.resize\"\n [cdkAutosizeMinRows]=\"model.rows\"\n [cdkAutosizeMaxRows]=\"model.resizeMaxRows\"\n [id]=\"id\"\n [formControlName]=\"model.name\"\n [placeholder]=\"model.placeholder\"\n [attr.minLength]=\"model.minLength\"\n [attr.maxLength]=\"model.maxLength\"\n [rows]=\"model.rows\"\n [autocomplete]=\"model.autocomplete\"\n (change)=\"onChange($event)\">\n </textarea>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n <mat-hint *ngIf=\"model.maxLength\"\n align=\"end\">{{maxCountText}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type:
|
|
554
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DynamicTextareaComponent, isStandalone: true, selector: "dynamic-textarea", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, viewQueries: [{ propertyName: "textarea", first: true, predicate: MatInput, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label *ngIf=\"model.label\">{{model.label}}</mat-label>\n\n <textarea matInput\n [cdkTextareaAutosize]=\"model.resize\"\n [cdkAutosizeMinRows]=\"model.rows\"\n [cdkAutosizeMaxRows]=\"model.resizeMaxRows\"\n [id]=\"id\"\n [formControlName]=\"model.name\"\n [placeholder]=\"model.placeholder\"\n [attr.minLength]=\"model.minLength\"\n [attr.maxLength]=\"model.maxLength\"\n [rows]=\"model.rows\"\n [autocomplete]=\"model.autocomplete\"\n (change)=\"onChange($event)\">\n </textarea>\n\n <mat-hint *ngIf=\"model.hint\"\n align=\"start\">{{model.hint}}</mat-hint>\n\n <mat-hint *ngIf=\"model.maxLength\"\n align=\"end\">{{maxCountText}}</mat-hint>\n\n @for(validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n <mat-error *ngIf=\"hasError(validator.name)\">{{validator.message}}</mat-error>\n </ng-container>\n }\n</mat-form-field>", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.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: i3$2.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
|
|
515
555
|
}
|
|
516
556
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicTextareaComponent, decorators: [{
|
|
517
557
|
type: Component,
|
|
@@ -768,6 +808,7 @@ class DynamicFormFieldComponent {
|
|
|
768
808
|
this.change = new EventEmitter();
|
|
769
809
|
this.dynamicFormService = inject(DynamicFormService);
|
|
770
810
|
this.relationService = inject(DynamicFormRelationsService);
|
|
811
|
+
this.cdRef = inject(ChangeDetectorRef);
|
|
771
812
|
this._subs = new Subscription();
|
|
772
813
|
}
|
|
773
814
|
/** Get the instance of a control component using the injected custom method or local method */
|
|
@@ -790,22 +831,24 @@ class DynamicFormFieldComponent {
|
|
|
790
831
|
*/
|
|
791
832
|
getControlComponentType() {
|
|
792
833
|
switch (this.model.type) {
|
|
834
|
+
case DYNAMIC_FORM_FIELD_BUTTON:
|
|
835
|
+
return DynamicButtonComponent;
|
|
836
|
+
case DYNAMIC_FORM_FIELD_BUTTON_TOGGLES:
|
|
837
|
+
return DynamicButtonTogglesComponent;
|
|
793
838
|
case DYNAMIC_FORM_FIELD_CHECKBOX:
|
|
794
839
|
return DynamicCheckboxComponent;
|
|
840
|
+
case DYNAMIC_FORM_FIELD_DATEPICKER:
|
|
841
|
+
return DynamicDatepickerComponent;
|
|
795
842
|
case DYNAMIC_FORM_FIELD_INPUT:
|
|
796
843
|
return DynamicInputComponent;
|
|
797
|
-
case
|
|
798
|
-
return
|
|
844
|
+
case DYNAMIC_FORM_FIELD_RADIO_GROUP:
|
|
845
|
+
return DymamicRadioGroupComponent;
|
|
799
846
|
case DYNAMIC_FORM_FIELD_READONLY:
|
|
800
847
|
return DynamicReadonlyComponent;
|
|
801
848
|
case DYNAMIC_FORM_FIELD_SELECT:
|
|
802
849
|
return DynamicSelectComponent;
|
|
803
|
-
case
|
|
804
|
-
return
|
|
805
|
-
case DYNAMIC_FORM_FIELD_BUTTON_TOGGLES:
|
|
806
|
-
return DynamicButtonTogglesComponent;
|
|
807
|
-
case DYNAMIC_FORM_FIELD_RADIO_GROUP:
|
|
808
|
-
return DymamicRadioGroupComponent;
|
|
850
|
+
case DYNAMIC_FORM_FIELD_TEXTAREA:
|
|
851
|
+
return DynamicTextareaComponent;
|
|
809
852
|
default:
|
|
810
853
|
console.warn(`Model of type 'dynamic-${this.model.type}' is not implemented yet. Add this type to dynamic-form-field.component.ts to add support`);
|
|
811
854
|
return null;
|
|
@@ -861,6 +904,7 @@ class DynamicFormFieldComponent {
|
|
|
861
904
|
*/
|
|
862
905
|
onDisabledChange(disabled) {
|
|
863
906
|
disabled ? this._control.disable() : this._control.enable();
|
|
907
|
+
this.cdRef.markForCheck();
|
|
864
908
|
}
|
|
865
909
|
onChange(ev) {
|
|
866
910
|
this.change.emit(this.createDynamicFormEvent(ev, 'change'));
|
|
@@ -943,5 +987,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
943
987
|
* Generated bundle index. Do not edit.
|
|
944
988
|
*/
|
|
945
989
|
|
|
946
|
-
export { DYNAMIC_FORM_FIELD_BUTTON, DYNAMIC_FORM_FIELD_BUTTON_TOGGLES, DYNAMIC_FORM_FIELD_CHECKBOX, DYNAMIC_FORM_FIELD_INPUT, DYNAMIC_FORM_FIELD_MAP_FN, DYNAMIC_FORM_FIELD_RADIO_GROUP, DYNAMIC_FORM_FIELD_READONLY, DYNAMIC_FORM_FIELD_SELECT, DYNAMIC_FORM_FIELD_TEXTAREA, DynamicButton, DynamicButtonToggles, DynamicCheckbox, DynamicFormComponent, DynamicFormFieldBase, DynamicFormFieldModel, DynamicFormFieldOptionModel, DynamicFormFieldValueModel, DynamicFormService, DynamicFormValidators, DynamicInput, DynamicRadioGroup, DynamicReadonly, DynamicSelect, DynamicTextarea, RelationActionType, RelationOperator };
|
|
990
|
+
export { DYNAMIC_FORM_FIELD_BUTTON, DYNAMIC_FORM_FIELD_BUTTON_TOGGLES, DYNAMIC_FORM_FIELD_CHECKBOX, DYNAMIC_FORM_FIELD_DATEPICKER, DYNAMIC_FORM_FIELD_INPUT, DYNAMIC_FORM_FIELD_MAP_FN, DYNAMIC_FORM_FIELD_RADIO_GROUP, DYNAMIC_FORM_FIELD_READONLY, DYNAMIC_FORM_FIELD_SELECT, DYNAMIC_FORM_FIELD_TEXTAREA, DynamicButton, DynamicButtonToggles, DynamicCheckbox, DynamicDatepicker, DynamicFormComponent, DynamicFormFieldBase, DynamicFormFieldModel, DynamicFormFieldOptionModel, DynamicFormFieldValueModel, DynamicFormService, DynamicFormValidators, DynamicInput, DynamicRadioGroup, DynamicReadonly, DynamicSelect, DynamicTextarea, RelationActionType, RelationOperator };
|
|
947
991
|
//# sourceMappingURL=olafvv-ngx-dynamic-form.mjs.map
|