@olafvv/ngx-dynamic-form 20.0.0 → 20.2.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 +253 -239
- package/fesm2022/olafvv-ngx-dynamic-form.mjs +361 -372
- package/fesm2022/olafvv-ngx-dynamic-form.mjs.map +1 -1
- package/index.d.ts +157 -125
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AsyncPipe, NgClass } from '@angular/common';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Injectable, Inject, Optional,
|
|
2
|
+
import { InjectionToken, Injectable, Inject, Optional, signal, input, Component, viewChild, computed, inject, Injector, ViewContainerRef, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
|
|
4
3
|
import * as i1 from '@angular/forms';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
5
|
+
import { AsyncPipe, NgClass } from '@angular/common';
|
|
6
|
+
import { BehaviorSubject, of, isObservable, map, 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
9
|
import * as i2$1 from '@angular/material/form-field';
|
|
@@ -25,10 +25,13 @@ import { MatRadioModule } from '@angular/material/radio';
|
|
|
25
25
|
import { MatOptionModule } from '@angular/material/core';
|
|
26
26
|
import * as i3$1 from '@angular/material/select';
|
|
27
27
|
import { MatSelectModule } from '@angular/material/select';
|
|
28
|
+
import * as i2$3 from '@angular/material/slide-toggle';
|
|
29
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
28
30
|
import * as i3$2 from '@angular/cdk/text-field';
|
|
29
31
|
|
|
30
|
-
const
|
|
32
|
+
const DYNAMIC_FORM_FIELD_MAP$1 = new InjectionToken('DYNAMIC_FORM_FIELD_MAP');
|
|
31
33
|
|
|
34
|
+
/** @ignore */
|
|
32
35
|
class DynamicFormValidationsService {
|
|
33
36
|
/**
|
|
34
37
|
* Get all Validator Functions from the validator configuration
|
|
@@ -65,65 +68,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
65
68
|
}] });
|
|
66
69
|
|
|
67
70
|
class DynamicFormService {
|
|
68
|
-
constructor(
|
|
69
|
-
this.
|
|
71
|
+
constructor(customMap, fb, validatorsService) {
|
|
72
|
+
this.customMap = customMap;
|
|
70
73
|
this.fb = fb;
|
|
71
74
|
this.validatorsService = validatorsService;
|
|
72
75
|
}
|
|
73
76
|
/**
|
|
74
|
-
* Check if there is a
|
|
77
|
+
* Check if there is a mapping provided to use custom form controls
|
|
75
78
|
* @param model
|
|
76
79
|
* @returns
|
|
77
80
|
*/
|
|
78
81
|
getCustomControlComponentType(model) {
|
|
79
|
-
return
|
|
82
|
+
return this.customMap && this.customMap[model.type] ? this.customMap[model.type] : null;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
85
|
* Create a FormGroup from the provided form configuration.
|
|
83
86
|
* Returns a FormGroup.
|
|
84
87
|
* @param {DynamicFormConfig} config Configuration object of a form
|
|
85
|
-
* @returns {
|
|
88
|
+
* @returns {FormGroup}
|
|
86
89
|
*/
|
|
87
90
|
createFormGroup(config) {
|
|
88
91
|
const group = this.fb.group({});
|
|
89
|
-
config.forEach((
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
group.addControl(controlConfig.name, control);
|
|
98
|
-
});
|
|
92
|
+
config.forEach((controlConfig) => {
|
|
93
|
+
const controlOptions = {
|
|
94
|
+
updateOn: controlConfig.updateOn,
|
|
95
|
+
validators: this.validatorsService.getValidatorFns(controlConfig.validators)
|
|
96
|
+
};
|
|
97
|
+
const controlValueConfig = controlConfig;
|
|
98
|
+
const control = new FormControl({ value: controlValueConfig.value ?? controlValueConfig.defaultValue, disabled: controlValueConfig.disabled }, controlOptions);
|
|
99
|
+
group.addControl(controlConfig.name, control);
|
|
99
100
|
});
|
|
100
101
|
return group;
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
-
* Transform any list (Observable) to a list of DynamicFormFieldOption which is used in any Dynamic Form Field with options (e.g. DynamicSelect).
|
|
104
|
-
* Possible to provide the method with Type definitions to define the provided list type and desired option value type:
|
|
105
|
-
*
|
|
106
|
-
* `dynamicFormService.toDynamicOptionList<T, K>(...)`
|
|
107
|
-
*
|
|
108
|
-
* Generic types:
|
|
109
|
-
* - T = The type of the items in the provided list
|
|
110
|
-
* - K = The type of the value inside an DynamicFormFieldOption. Default is 'string'
|
|
111
|
-
* @param listObs An Observable of a list of items of type T
|
|
112
|
-
* @param labelCb Callback to define the label of the options in the template
|
|
113
|
-
* @param valueCb Callback to define the value of the options. Must return a value of type K (default string)
|
|
114
|
-
* @returns
|
|
115
|
-
*/
|
|
116
|
-
toDynamicOptionListObs(listObs, labelCb, valueCb) {
|
|
117
|
-
return listObs.pipe(map((list) => {
|
|
118
|
-
return list.map((item) => {
|
|
119
|
-
return {
|
|
120
|
-
label: labelCb(item),
|
|
121
|
-
value: valueCb(item)
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormService, deps: [{ token: DYNAMIC_FORM_FIELD_MAP_FN, optional: true }, { token: i1.FormBuilder }, { token: DynamicFormValidationsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
103
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormService, deps: [{ token: DYNAMIC_FORM_FIELD_MAP$1, optional: true }, { token: i1.FormBuilder }, { token: DynamicFormValidationsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
127
104
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormService, providedIn: 'root' }); }
|
|
128
105
|
}
|
|
129
106
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormService, decorators: [{
|
|
@@ -133,61 +110,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
133
110
|
}]
|
|
134
111
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
135
112
|
type: Inject,
|
|
136
|
-
args: [
|
|
113
|
+
args: [DYNAMIC_FORM_FIELD_MAP$1]
|
|
137
114
|
}, {
|
|
138
115
|
type: Optional
|
|
139
116
|
}] }, { type: i1.FormBuilder }, { type: DynamicFormValidationsService }] });
|
|
140
117
|
|
|
141
|
-
/**
|
|
142
|
-
* Base class for the DynamicFormField component classes
|
|
143
|
-
*/
|
|
144
|
-
class DynamicFormFieldBase {
|
|
145
|
-
get id() {
|
|
146
|
-
return this.model.id ?? this.model.name;
|
|
147
|
-
}
|
|
148
|
-
get control() {
|
|
149
|
-
const ctrl = this.group.get(this.model.name);
|
|
150
|
-
if (!ctrl) {
|
|
151
|
-
throw new Error(`Provided FormGroup does not contain a control with the name ${this.model.name}`);
|
|
152
|
-
}
|
|
153
|
-
return ctrl;
|
|
154
|
-
}
|
|
155
|
-
get isValid() {
|
|
156
|
-
return this.control.valid;
|
|
157
|
-
}
|
|
158
|
-
get isInvalid() {
|
|
159
|
-
return this.control.invalid;
|
|
160
|
-
}
|
|
161
|
-
onChange(event) {
|
|
162
|
-
this.change.emit(event);
|
|
163
|
-
}
|
|
164
|
-
resetControl() {
|
|
165
|
-
this.group.get(this.model.name)?.reset();
|
|
166
|
-
}
|
|
167
|
-
hasError(name) {
|
|
168
|
-
return this.control.hasError(name);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
class DynamicButtonTogglesComponent extends DynamicFormFieldBase {
|
|
173
|
-
constructor() {
|
|
174
|
-
super(...arguments);
|
|
175
|
-
this.change = new EventEmitter();
|
|
176
|
-
}
|
|
177
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonTogglesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
178
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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(--mat-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: "ngmodule", type: MatFormFieldModule }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
179
|
-
}
|
|
180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonTogglesComponent, decorators: [{
|
|
181
|
-
type: Component,
|
|
182
|
-
args: [{ imports: [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(--mat-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"] }]
|
|
183
|
-
}], propDecorators: { model: [{
|
|
184
|
-
type: Input
|
|
185
|
-
}], group: [{
|
|
186
|
-
type: Input
|
|
187
|
-
}], change: [{
|
|
188
|
-
type: Output
|
|
189
|
-
}] } });
|
|
190
|
-
|
|
191
118
|
/**
|
|
192
119
|
* Base class for all DynamicFormFields
|
|
193
120
|
*/
|
|
@@ -242,6 +169,79 @@ class DynamicFormFieldValueModel extends DynamicFormFieldModel {
|
|
|
242
169
|
}
|
|
243
170
|
}
|
|
244
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Base class for the DynamicFormField component classes
|
|
174
|
+
*/
|
|
175
|
+
class DynamicFormFieldBase {
|
|
176
|
+
get id() {
|
|
177
|
+
return this.model().id ?? this.model().name;
|
|
178
|
+
}
|
|
179
|
+
get control() {
|
|
180
|
+
const ctrl = this.group().get(this.model().name);
|
|
181
|
+
if (!ctrl) {
|
|
182
|
+
throw new Error(`Provided FormGroup does not contain a control with the name ${this.model().name}`);
|
|
183
|
+
}
|
|
184
|
+
return ctrl;
|
|
185
|
+
}
|
|
186
|
+
get isValid() {
|
|
187
|
+
return this.control.valid;
|
|
188
|
+
}
|
|
189
|
+
get isInvalid() {
|
|
190
|
+
return this.control.invalid;
|
|
191
|
+
}
|
|
192
|
+
resetControl() {
|
|
193
|
+
this.group().get(this.model().name)?.reset();
|
|
194
|
+
}
|
|
195
|
+
hasError(name) {
|
|
196
|
+
return this.control.hasError(name);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
class DynamicButtonTogglesComponent extends DynamicFormFieldBase {
|
|
201
|
+
constructor() {
|
|
202
|
+
super(...arguments);
|
|
203
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
204
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
205
|
+
}
|
|
206
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonTogglesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
207
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicButtonTogglesComponent, isStandalone: true, selector: "dynamic-button-toggles", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div\n class=\"dynamic-button-toggles-wrapper\"\n [formGroup]=\"group()\">\n <mat-button-toggle-group\n [id]=\"id\"\n [formControlName]=\"model().name\"\n [multiple]=\"model().multiple\"\n [vertical]=\"model().vertical\">\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>\n", 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(--mat-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: "ngmodule", type: MatFormFieldModule }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
208
|
+
}
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonTogglesComponent, decorators: [{
|
|
210
|
+
type: Component,
|
|
211
|
+
args: [{ imports: [MatButtonToggleModule, ReactiveFormsModule, AsyncPipe, MatFormFieldModule], selector: 'dynamic-button-toggles', template: "<div\n class=\"dynamic-button-toggles-wrapper\"\n [formGroup]=\"group()\">\n <mat-button-toggle-group\n [id]=\"id\"\n [formControlName]=\"model().name\"\n [multiple]=\"model().multiple\"\n [vertical]=\"model().vertical\">\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>\n", 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(--mat-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"] }]
|
|
212
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
213
|
+
|
|
214
|
+
class DynamicButtonComponent extends DynamicFormFieldBase {
|
|
215
|
+
constructor() {
|
|
216
|
+
super(...arguments);
|
|
217
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
218
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
219
|
+
}
|
|
220
|
+
onClick() {
|
|
221
|
+
this.model().clicked();
|
|
222
|
+
}
|
|
223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
224
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: DynamicButtonComponent, isStandalone: true, selector: "dynamic-button", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-button-wrapper\">\n <button\n [matButton]=\"model().variant\"\n [id]=\"id\"\n [disabled]=\"model().disabled\"\n (click)=\"onClick()\">\n <span>{{ model().label }}</span>\n </button>\n</div>\n", styles: [".dynamic-button-wrapper{display:flex;align-items:center;height:var(--mat-form-field-container-height, 56px)}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] }); }
|
|
225
|
+
}
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonComponent, decorators: [{
|
|
227
|
+
type: Component,
|
|
228
|
+
args: [{ imports: [MatButtonModule], selector: 'dynamic-button', template: "<div class=\"dynamic-button-wrapper\">\n <button\n [matButton]=\"model().variant\"\n [id]=\"id\"\n [disabled]=\"model().disabled\"\n (click)=\"onClick()\">\n <span>{{ model().label }}</span>\n </button>\n</div>\n", styles: [".dynamic-button-wrapper{display:flex;align-items:center;height:var(--mat-form-field-container-height, 56px)}\n"] }]
|
|
229
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
230
|
+
|
|
231
|
+
class DynamicCheckboxComponent extends DynamicFormFieldBase {
|
|
232
|
+
constructor() {
|
|
233
|
+
super(...arguments);
|
|
234
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
235
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
236
|
+
}
|
|
237
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
238
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: DynamicCheckboxComponent, isStandalone: true, selector: "dynamic-checkbox", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"group()\">\n <mat-checkbox\n [checked]=\"model().checked\"\n [formControlName]=\"model().name\"\n [indeterminate]=\"model().indeterminate\"\n [labelPosition]=\"model().labelPosition\"\n [name]=\"model().name\"\n [id]=\"id\">\n <span class=\"checkbox-label\">{{ model().label }}</span>\n </mat-checkbox>\n</ng-container>\n", dependencies: [{ 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: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] }); }
|
|
239
|
+
}
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicCheckboxComponent, decorators: [{
|
|
241
|
+
type: Component,
|
|
242
|
+
args: [{ selector: 'dynamic-checkbox', imports: [ReactiveFormsModule, MatCheckboxModule], template: "<ng-container [formGroup]=\"group()\">\n <mat-checkbox\n [checked]=\"model().checked\"\n [formControlName]=\"model().name\"\n [indeterminate]=\"model().indeterminate\"\n [labelPosition]=\"model().labelPosition\"\n [name]=\"model().name\"\n [id]=\"id\">\n <span class=\"checkbox-label\">{{ model().label }}</span>\n </mat-checkbox>\n</ng-container>\n" }]
|
|
243
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
244
|
+
|
|
245
245
|
/**
|
|
246
246
|
* Base class for any DynamicFormField with options (e.g. DynamicSelect or DynamicAutocomplete)
|
|
247
247
|
*/
|
|
@@ -298,51 +298,17 @@ class DynamicButtonToggles extends DynamicFormFieldOptionModel {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
class DynamicButtonComponent extends DynamicFormFieldBase {
|
|
302
|
-
onClick() {
|
|
303
|
-
this.model.onClick();
|
|
304
|
-
}
|
|
305
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
306
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", 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[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] }); }
|
|
307
|
-
}
|
|
308
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicButtonComponent, decorators: [{
|
|
309
|
-
type: Component,
|
|
310
|
-
args: [{ 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"] }]
|
|
311
|
-
}], propDecorators: { model: [{
|
|
312
|
-
type: Input
|
|
313
|
-
}], group: [{
|
|
314
|
-
type: Input
|
|
315
|
-
}] } });
|
|
316
|
-
|
|
317
301
|
const DYNAMIC_FORM_FIELD_BUTTON = 'button';
|
|
318
302
|
class DynamicButton extends DynamicFormFieldModel {
|
|
319
303
|
constructor(config) {
|
|
320
304
|
super(config);
|
|
321
305
|
this.type = DYNAMIC_FORM_FIELD_BUTTON;
|
|
322
|
-
this.label = config.label
|
|
323
|
-
this.
|
|
306
|
+
this.label = config.label;
|
|
307
|
+
this.variant = config.variant ?? 'text';
|
|
308
|
+
this.clicked = config.clicked;
|
|
324
309
|
}
|
|
325
310
|
}
|
|
326
311
|
|
|
327
|
-
class DynamicCheckboxComponent extends DynamicFormFieldBase {
|
|
328
|
-
constructor() {
|
|
329
|
-
super(...arguments);
|
|
330
|
-
this.change = new EventEmitter();
|
|
331
|
-
}
|
|
332
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
333
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: DynamicCheckboxComponent, isStandalone: true, selector: "dynamic-checkbox", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"group\">\n <mat-checkbox [checked]=\"model.checked\"\n [formControlName]=\"model.name\"\n [indeterminate]=\"model.indeterminate\"\n [labelPosition]=\"model.labelPosition\"\n [name]=\"model.name\"\n [id]=\"id\"\n (change)=\"onChange($event)\">\n\n <span class=\"checkbox-label\">{{model.label}}</span>\n </mat-checkbox>\n</ng-container>", dependencies: [{ 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: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] }); }
|
|
334
|
-
}
|
|
335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicCheckboxComponent, decorators: [{
|
|
336
|
-
type: Component,
|
|
337
|
-
args: [{ selector: 'dynamic-checkbox', imports: [ReactiveFormsModule, MatCheckboxModule], template: "<ng-container [formGroup]=\"group\">\n <mat-checkbox [checked]=\"model.checked\"\n [formControlName]=\"model.name\"\n [indeterminate]=\"model.indeterminate\"\n [labelPosition]=\"model.labelPosition\"\n [name]=\"model.name\"\n [id]=\"id\"\n (change)=\"onChange($event)\">\n\n <span class=\"checkbox-label\">{{model.label}}</span>\n </mat-checkbox>\n</ng-container>" }]
|
|
338
|
-
}], propDecorators: { model: [{
|
|
339
|
-
type: Input
|
|
340
|
-
}], group: [{
|
|
341
|
-
type: Input
|
|
342
|
-
}], change: [{
|
|
343
|
-
type: Output
|
|
344
|
-
}] } });
|
|
345
|
-
|
|
346
312
|
const DYNAMIC_FORM_FIELD_CHECKBOX = 'checkbox';
|
|
347
313
|
class DynamicCheckbox extends DynamicFormFieldValueModel {
|
|
348
314
|
constructor(config) {
|
|
@@ -358,30 +324,8 @@ class DynamicCheckbox extends DynamicFormFieldValueModel {
|
|
|
358
324
|
set checked(checked) {
|
|
359
325
|
this.value = checked;
|
|
360
326
|
}
|
|
361
|
-
toggle() {
|
|
362
|
-
this.checked = !this.checked;
|
|
363
|
-
}
|
|
364
327
|
}
|
|
365
328
|
|
|
366
|
-
class DynamicDatepickerComponent extends DynamicFormFieldBase {
|
|
367
|
-
constructor() {
|
|
368
|
-
super(...arguments);
|
|
369
|
-
this.change = new EventEmitter();
|
|
370
|
-
}
|
|
371
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
372
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicDatepickerComponent, isStandalone: true, selector: "dynamic-datepicker", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [formGroup]=\"group\"\n [id]=\"model.id\"\n color=\"primary\">\n @if (model.label) {\n <mat-label>{{ model.label }}</mat-label>\n }\n\n <input\n matInput\n [min]=\"model.min\"\n [max]=\"model.max\"\n [matDatepicker]=\"picker\" />\n\n @if (model.hint) {\n <mat-hint>{{ model.hint }}</mat-hint>\n }\n\n <mat-datepicker-toggle\n matIconSuffix\n [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n #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 @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ 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", "disabledInteractive"], 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"] }] }); }
|
|
373
|
-
}
|
|
374
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicDatepickerComponent, decorators: [{
|
|
375
|
-
type: Component,
|
|
376
|
-
args: [{ imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule], selector: 'dynamic-datepicker', template: "<mat-form-field\n [formGroup]=\"group\"\n [id]=\"model.id\"\n color=\"primary\">\n @if (model.label) {\n <mat-label>{{ model.label }}</mat-label>\n }\n\n <input\n matInput\n [min]=\"model.min\"\n [max]=\"model.max\"\n [matDatepicker]=\"picker\" />\n\n @if (model.hint) {\n <mat-hint>{{ model.hint }}</mat-hint>\n }\n\n <mat-datepicker-toggle\n matIconSuffix\n [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n #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 @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"] }]
|
|
377
|
-
}], propDecorators: { model: [{
|
|
378
|
-
type: Input
|
|
379
|
-
}], group: [{
|
|
380
|
-
type: Input
|
|
381
|
-
}], change: [{
|
|
382
|
-
type: Output
|
|
383
|
-
}] } });
|
|
384
|
-
|
|
385
329
|
const DYNAMIC_FORM_FIELD_DATEPICKER = 'datepicker';
|
|
386
330
|
class DynamicDatepicker extends DynamicFormFieldValueModel {
|
|
387
331
|
constructor(config) {
|
|
@@ -394,44 +338,6 @@ class DynamicDatepicker extends DynamicFormFieldValueModel {
|
|
|
394
338
|
}
|
|
395
339
|
}
|
|
396
340
|
|
|
397
|
-
class DynamicInputComponent extends DynamicFormFieldBase {
|
|
398
|
-
constructor() {
|
|
399
|
-
super(...arguments);
|
|
400
|
-
this.change = new EventEmitter();
|
|
401
|
-
}
|
|
402
|
-
get valueCount() {
|
|
403
|
-
return this.input?.value ? this.input.value.length : 0;
|
|
404
|
-
}
|
|
405
|
-
get maxCountText() {
|
|
406
|
-
return `${this.valueCount} / ${this.model.maxLength}`;
|
|
407
|
-
}
|
|
408
|
-
get showClear() {
|
|
409
|
-
return !!this.control.value && !this.control.disabled && !this.model.showLoader;
|
|
410
|
-
}
|
|
411
|
-
onChange(event) {
|
|
412
|
-
// Ignore the native HTML 5 change event
|
|
413
|
-
if (event instanceof Event) {
|
|
414
|
-
event.stopPropagation();
|
|
415
|
-
}
|
|
416
|
-
this.change.emit(event);
|
|
417
|
-
}
|
|
418
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
419
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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\n [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n @if (model.label) {\n <mat-label>{{ model.label }}</mat-label>\n }\n\n @if (model.prefix) {\n <span matTextPrefix>{{ model.prefix }}</span>\n }\n\n <input\n 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 @if (showClear) {\n <button\n matSuffix\n mat-icon-button\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n }\n\n @if (model.showLoader()) {\n <div\n matSuffix\n class=\"loader-icon\">\n <mat-spinner\n diameter=\"16\"\n color=\"primary\"></mat-spinner>\n </div>\n }\n\n @if (model.hint) {\n <mat-hint align=\"start\">{{ model.hint }}</mat-hint>\n }\n\n @if (model.maxLength) {\n <mat-hint align=\"end\">{{ maxCountText }}</mat-hint>\n }\n\n @for (validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-form-field .loader-icon{padding:8px}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{appearance:none;margin:0}input[type=number]{appearance:textfield}\n"], dependencies: [{ 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", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { 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"] }] }); }
|
|
420
|
-
}
|
|
421
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicInputComponent, decorators: [{
|
|
422
|
-
type: Component,
|
|
423
|
-
args: [{ imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatButtonModule, MatIconModule, MatProgressSpinnerModule], selector: 'dynamic-input', template: "<mat-form-field\n [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n @if (model.label) {\n <mat-label>{{ model.label }}</mat-label>\n }\n\n @if (model.prefix) {\n <span matTextPrefix>{{ model.prefix }}</span>\n }\n\n <input\n 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 @if (showClear) {\n <button\n matSuffix\n mat-icon-button\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n }\n\n @if (model.showLoader()) {\n <div\n matSuffix\n class=\"loader-icon\">\n <mat-spinner\n diameter=\"16\"\n color=\"primary\"></mat-spinner>\n </div>\n }\n\n @if (model.hint) {\n <mat-hint align=\"start\">{{ model.hint }}</mat-hint>\n }\n\n @if (model.maxLength) {\n <mat-hint align=\"end\">{{ maxCountText }}</mat-hint>\n }\n\n @for (validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-form-field .loader-icon{padding:8px}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{appearance:none;margin:0}input[type=number]{appearance:textfield}\n"] }]
|
|
424
|
-
}], propDecorators: { input: [{
|
|
425
|
-
type: ViewChild,
|
|
426
|
-
args: [MatInput, { static: true }]
|
|
427
|
-
}], model: [{
|
|
428
|
-
type: Input
|
|
429
|
-
}], group: [{
|
|
430
|
-
type: Input
|
|
431
|
-
}], change: [{
|
|
432
|
-
type: Output
|
|
433
|
-
}] } });
|
|
434
|
-
|
|
435
341
|
const DYNAMIC_FORM_FIELD_INPUT = 'input';
|
|
436
342
|
class DynamicInput extends DynamicFormFieldValueModel {
|
|
437
343
|
constructor(config) {
|
|
@@ -452,25 +358,6 @@ class DynamicInput extends DynamicFormFieldValueModel {
|
|
|
452
358
|
}
|
|
453
359
|
}
|
|
454
360
|
|
|
455
|
-
class DymamicRadioGroupComponent extends DynamicFormFieldBase {
|
|
456
|
-
constructor() {
|
|
457
|
-
super(...arguments);
|
|
458
|
-
this.change = new EventEmitter();
|
|
459
|
-
}
|
|
460
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DymamicRadioGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
461
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DymamicRadioGroupComponent, isStandalone: true, selector: "dynamic-radio-group", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<div\n class=\"dynamic-radio-group-wrapper\"\n [formGroup]=\"group\">\n @if (model.label) {\n <label>{{ model.label }}</label>\n }\n <mat-radio-group\n [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\n [value]=\"option.value\"\n [labelPosition]=\"model.labelPosition\">\n {{ option.label }}\n </mat-radio-button>\n }\n </mat-radio-group>\n</div>\n", styles: [".dynamic-radio-group-wrapper label{display:block;font-size:var(--mat-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: 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" }] }); }
|
|
462
|
-
}
|
|
463
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DymamicRadioGroupComponent, decorators: [{
|
|
464
|
-
type: Component,
|
|
465
|
-
args: [{ imports: [NgClass, ReactiveFormsModule, MatRadioModule, AsyncPipe], selector: 'dynamic-radio-group', template: "<div\n class=\"dynamic-radio-group-wrapper\"\n [formGroup]=\"group\">\n @if (model.label) {\n <label>{{ model.label }}</label>\n }\n <mat-radio-group\n [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\n [value]=\"option.value\"\n [labelPosition]=\"model.labelPosition\">\n {{ option.label }}\n </mat-radio-button>\n }\n </mat-radio-group>\n</div>\n", styles: [".dynamic-radio-group-wrapper label{display:block;font-size:var(--mat-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"] }]
|
|
466
|
-
}], propDecorators: { model: [{
|
|
467
|
-
type: Input
|
|
468
|
-
}], group: [{
|
|
469
|
-
type: Input
|
|
470
|
-
}], change: [{
|
|
471
|
-
type: Output
|
|
472
|
-
}] } });
|
|
473
|
-
|
|
474
361
|
const DYNAMIC_FORM_FIELD_RADIO_GROUP = 'radio-group';
|
|
475
362
|
class DynamicRadioGroup extends DynamicFormFieldOptionModel {
|
|
476
363
|
constructor(config) {
|
|
@@ -481,19 +368,6 @@ class DynamicRadioGroup extends DynamicFormFieldOptionModel {
|
|
|
481
368
|
}
|
|
482
369
|
}
|
|
483
370
|
|
|
484
|
-
class DynamicReadonlyComponent extends DynamicFormFieldBase {
|
|
485
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicReadonlyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
486
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: DynamicReadonlyComponent, isStandalone: true, selector: "dynamic-readonly", inputs: { model: "model", group: "group" }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-form-field-readonly\"\n [formGroup]=\"group\"\n [id]=\"id\">\n <div class=\"label\">{{model.label}}</div>\n <span>{{model.value}}</span>\n</div>", styles: [".dynamic-form-field-readonly{width:100%;margin:8px 0;color:var(--mat-theme-text-primary-on-background, rgba(0, 0, 0, .87))}.dynamic-form-field-readonly .label{font-size:var(--mat-typography-body2-font-size, 14px);line-height:var(--mat-typography-body2-line-height, 20px);margin-bottom:8px}\n"], dependencies: [{ 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"] }] }); }
|
|
487
|
-
}
|
|
488
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicReadonlyComponent, decorators: [{
|
|
489
|
-
type: Component,
|
|
490
|
-
args: [{ imports: [ReactiveFormsModule], selector: 'dynamic-readonly', template: "<div class=\"dynamic-form-field-readonly\"\n [formGroup]=\"group\"\n [id]=\"id\">\n <div class=\"label\">{{model.label}}</div>\n <span>{{model.value}}</span>\n</div>", styles: [".dynamic-form-field-readonly{width:100%;margin:8px 0;color:var(--mat-theme-text-primary-on-background, rgba(0, 0, 0, .87))}.dynamic-form-field-readonly .label{font-size:var(--mat-typography-body2-font-size, 14px);line-height:var(--mat-typography-body2-line-height, 20px);margin-bottom:8px}\n"] }]
|
|
491
|
-
}], propDecorators: { model: [{
|
|
492
|
-
type: Input
|
|
493
|
-
}], group: [{
|
|
494
|
-
type: Input
|
|
495
|
-
}] } });
|
|
496
|
-
|
|
497
371
|
const DYNAMIC_FORM_FIELD_READONLY = 'readonly';
|
|
498
372
|
class DynamicReadonly extends DynamicFormFieldValueModel {
|
|
499
373
|
constructor(config) {
|
|
@@ -502,25 +376,6 @@ class DynamicReadonly extends DynamicFormFieldValueModel {
|
|
|
502
376
|
}
|
|
503
377
|
}
|
|
504
378
|
|
|
505
|
-
class DynamicSelectComponent extends DynamicFormFieldBase {
|
|
506
|
-
constructor() {
|
|
507
|
-
super(...arguments);
|
|
508
|
-
this.change = new EventEmitter();
|
|
509
|
-
}
|
|
510
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
511
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicSelectComponent, isStandalone: true, selector: "dynamic-select", inputs: { model: "model", group: "group" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label>{{ model.label }}</mat-label>\n\n <!-- Template for select without grouped options -->\n @if (model.options$ | async; as options) {\n @if (!model.native) {\n <mat-select\n [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 } @else {\n <select\n 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 }\n }\n\n <!-- Template for select with grouped options -->\n @if (model.groupedOptions$ | async; as groupedOptions) {\n @if (!model.native) {\n <mat-select\n [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 </mat-select>\n } @else {\n <select\n matNativeControl\n (selectionchange)=\"onChange($event)\">\n @for (group of groupedOptions; track group.name) {\n =\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 }\n }\n\n @if (model.hint) {\n <mat-hint align=\"start\">{{ model.hint }}</mat-hint>\n }\n\n @for (validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-option{padding-top:8px;padding-bottom:8px}\n"], dependencies: [{ 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", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i3$1.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: MatOptionModule }, { 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", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
512
|
-
}
|
|
513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicSelectComponent, decorators: [{
|
|
514
|
-
type: Component,
|
|
515
|
-
args: [{ imports: [MatFormFieldModule, ReactiveFormsModule, MatSelectModule, MatOptionModule, AsyncPipe, MatInputModule], selector: 'dynamic-select', template: "<mat-form-field\n [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n <mat-label>{{ model.label }}</mat-label>\n\n <!-- Template for select without grouped options -->\n @if (model.options$ | async; as options) {\n @if (!model.native) {\n <mat-select\n [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 } @else {\n <select\n 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 }\n }\n\n <!-- Template for select with grouped options -->\n @if (model.groupedOptions$ | async; as groupedOptions) {\n @if (!model.native) {\n <mat-select\n [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 </mat-select>\n } @else {\n <select\n matNativeControl\n (selectionchange)=\"onChange($event)\">\n @for (group of groupedOptions; track group.name) {\n =\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 }\n }\n\n @if (model.hint) {\n <mat-hint align=\"start\">{{ model.hint }}</mat-hint>\n }\n\n @for (validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-option{padding-top:8px;padding-bottom:8px}\n"] }]
|
|
516
|
-
}], propDecorators: { model: [{
|
|
517
|
-
type: Input
|
|
518
|
-
}], group: [{
|
|
519
|
-
type: Input
|
|
520
|
-
}], change: [{
|
|
521
|
-
type: Output
|
|
522
|
-
}] } });
|
|
523
|
-
|
|
524
379
|
const DYNAMIC_FORM_FIELD_SELECT = 'select';
|
|
525
380
|
class DynamicSelect extends DynamicFormFieldOptionModel {
|
|
526
381
|
constructor(config) {
|
|
@@ -531,53 +386,19 @@ class DynamicSelect extends DynamicFormFieldOptionModel {
|
|
|
531
386
|
}
|
|
532
387
|
}
|
|
533
388
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
super(...arguments);
|
|
537
|
-
this.change = new EventEmitter();
|
|
538
|
-
}
|
|
539
|
-
get valueCount() {
|
|
540
|
-
return this.textarea?.value ? this.textarea.value.length : 0;
|
|
541
|
-
}
|
|
542
|
-
get maxCountText() {
|
|
543
|
-
return `${this.valueCount} / ${this.model.maxLength}`;
|
|
544
|
-
}
|
|
545
|
-
onChange(event) {
|
|
546
|
-
// Ignore the native HTML 5 change event
|
|
547
|
-
if (event instanceof Event) {
|
|
548
|
-
event.stopPropagation();
|
|
549
|
-
}
|
|
550
|
-
this.change.emit(event);
|
|
551
|
-
}
|
|
552
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
553
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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\n [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n @if (model.label) {\n <mat-label>{{ model.label }}</mat-label>\n }\n\n <textarea\n 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 @if (model.hint) {\n <mat-hint align=\"start\">{{ model.hint }}</mat-hint>\n }\n\n @if (model.maxLength) {\n <mat-hint align=\"end\">{{ maxCountText }}</mat-hint>\n }\n\n @for (validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ 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", "disabledInteractive"], 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"] }] }); }
|
|
554
|
-
}
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicTextareaComponent, decorators: [{
|
|
556
|
-
type: Component,
|
|
557
|
-
args: [{ imports: [MatFormFieldModule, MatInputModule, ReactiveFormsModule], selector: 'dynamic-textarea', template: "<mat-form-field\n [formGroup]=\"group\"\n [id]=\"id\"\n color=\"primary\">\n @if (model.label) {\n <mat-label>{{ model.label }}</mat-label>\n }\n\n <textarea\n 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 @if (model.hint) {\n <mat-hint align=\"start\">{{ model.hint }}</mat-hint>\n }\n\n @if (model.maxLength) {\n <mat-hint align=\"end\">{{ maxCountText }}</mat-hint>\n }\n\n @for (validator of model.validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"] }]
|
|
558
|
-
}], propDecorators: { textarea: [{
|
|
559
|
-
type: ViewChild,
|
|
560
|
-
args: [MatInput, { static: true }]
|
|
561
|
-
}], model: [{
|
|
562
|
-
type: Input
|
|
563
|
-
}], group: [{
|
|
564
|
-
type: Input
|
|
565
|
-
}], change: [{
|
|
566
|
-
type: Output
|
|
567
|
-
}] } });
|
|
568
|
-
|
|
569
|
-
const DYNAMIC_FORM_FIELD_TEXTAREA = 'textarea';
|
|
570
|
-
class DynamicTextarea extends DynamicFormFieldValueModel {
|
|
389
|
+
const DYNAMIC_FORM_FIELD_SLIDE_TOGGLE = 'slide-toggle';
|
|
390
|
+
class DynamicSlideToggle extends DynamicFormFieldValueModel {
|
|
571
391
|
constructor(config) {
|
|
572
392
|
super(config);
|
|
573
|
-
this.type =
|
|
574
|
-
this.
|
|
575
|
-
this.
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
this.
|
|
579
|
-
|
|
580
|
-
|
|
393
|
+
this.type = DYNAMIC_FORM_FIELD_SLIDE_TOGGLE;
|
|
394
|
+
this.value = config.value ?? false;
|
|
395
|
+
this.labelPosition = config.labelPosition ?? 'after';
|
|
396
|
+
}
|
|
397
|
+
get checked() {
|
|
398
|
+
return this.value ?? false;
|
|
399
|
+
}
|
|
400
|
+
set checked(checked) {
|
|
401
|
+
this.value = checked;
|
|
581
402
|
}
|
|
582
403
|
}
|
|
583
404
|
|
|
@@ -668,6 +489,170 @@ var RelationOperator;
|
|
|
668
489
|
RelationOperator["OR"] = "OR";
|
|
669
490
|
})(RelationOperator || (RelationOperator = {}));
|
|
670
491
|
|
|
492
|
+
const DYNAMIC_FORM_FIELD_STATIC_TEXT = 'static-text';
|
|
493
|
+
class DynamicStaticText extends DynamicFormFieldValueModel {
|
|
494
|
+
constructor(config) {
|
|
495
|
+
super(config);
|
|
496
|
+
this.type = DYNAMIC_FORM_FIELD_STATIC_TEXT;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const DYNAMIC_FORM_FIELD_TEXTAREA = 'textarea';
|
|
501
|
+
class DynamicTextarea extends DynamicFormFieldValueModel {
|
|
502
|
+
constructor(config) {
|
|
503
|
+
super(config);
|
|
504
|
+
this.type = DYNAMIC_FORM_FIELD_TEXTAREA;
|
|
505
|
+
this.placeholder = config.placeholder ?? '';
|
|
506
|
+
this.minLength = config.minLength ?? 0;
|
|
507
|
+
this.maxLength = config.minLength ?? null;
|
|
508
|
+
this.autocomplete = config.autocomplete ?? 'off';
|
|
509
|
+
this.rows = config.rows ?? 3;
|
|
510
|
+
this.resize = config.resize ?? true;
|
|
511
|
+
this.resizeMaxRows = config.resizeMaxRows ?? null;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
class DynamicDatepickerComponent extends DynamicFormFieldBase {
|
|
516
|
+
constructor() {
|
|
517
|
+
super(...arguments);
|
|
518
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
519
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
520
|
+
}
|
|
521
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
522
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicDatepickerComponent, isStandalone: true, selector: "dynamic-datepicker", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"model().id\"\n color=\"primary\">\n @if (model().label) {\n <mat-label>{{ model().label }}</mat-label>\n }\n\n <input\n matInput\n [min]=\"model().min\"\n [max]=\"model().max\"\n [matDatepicker]=\"picker\" />\n\n @if (model().hint) {\n <mat-hint>{{ model().hint }}</mat-hint>\n }\n\n <mat-datepicker-toggle\n matIconSuffix\n [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n #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 @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ 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", "disabledInteractive"], 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"] }] }); }
|
|
523
|
+
}
|
|
524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicDatepickerComponent, decorators: [{
|
|
525
|
+
type: Component,
|
|
526
|
+
args: [{ imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatDatepickerModule], selector: 'dynamic-datepicker', template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"model().id\"\n color=\"primary\">\n @if (model().label) {\n <mat-label>{{ model().label }}</mat-label>\n }\n\n <input\n matInput\n [min]=\"model().min\"\n [max]=\"model().max\"\n [matDatepicker]=\"picker\" />\n\n @if (model().hint) {\n <mat-hint>{{ model().hint }}</mat-hint>\n }\n\n <mat-datepicker-toggle\n matIconSuffix\n [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n #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 @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"] }]
|
|
527
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
528
|
+
|
|
529
|
+
class DynamicInputComponent extends DynamicFormFieldBase {
|
|
530
|
+
constructor() {
|
|
531
|
+
super(...arguments);
|
|
532
|
+
this.input = viewChild.required(MatInput);
|
|
533
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
534
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
535
|
+
this.typeIsPassword = computed(() => this.model().inputType === 'password', ...(ngDevMode ? [{ debugName: "typeIsPassword" }] : []));
|
|
536
|
+
this.valueCount = computed(() => (this.input()?.value ? this.input().value.length : 0), ...(ngDevMode ? [{ debugName: "valueCount" }] : []));
|
|
537
|
+
this.maxCountText = computed(() => `${this.valueCount()} / ${this.model().maxLength}`, ...(ngDevMode ? [{ debugName: "maxCountText" }] : []));
|
|
538
|
+
this.showClear = computed(() => !!this.valueCount() && !this.control.disabled && !this.model().showLoader, ...(ngDevMode ? [{ debugName: "showClear" }] : []));
|
|
539
|
+
}
|
|
540
|
+
togglePassword() {
|
|
541
|
+
this.input().type = this.input().type === 'password' ? 'text' : 'password';
|
|
542
|
+
}
|
|
543
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
544
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicInputComponent, isStandalone: true, selector: "dynamic-input", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "input", first: true, predicate: MatInput, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"id\"\n color=\"primary\">\n @if (model().label) {\n <mat-label>{{ model().label }}</mat-label>\n }\n\n @if (model().prefix) {\n <span matTextPrefix>{{ model().prefix }}</span>\n }\n\n <input\n 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\n @if (typeIsPassword()) {\n <button\n matSuffix\n mat-icon-button\n (click)=\"togglePassword()\">\n @if (input().type === 'password') {\n <mat-icon fontIcon=\"visibility\"></mat-icon>\n } @else {\n <mat-icon fontIcon=\"visibility_off\"></mat-icon>\n }\n </button>\n }\n\n @if (showClear()) {\n <button\n matSuffix\n mat-icon-button\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n }\n\n @if (model().showLoader()) {\n <div\n matSuffix\n class=\"loader-icon\">\n <mat-spinner\n diameter=\"16\"\n color=\"primary\"></mat-spinner>\n </div>\n }\n\n @if (model().hint) {\n <mat-hint align=\"start\">{{ model().hint }}</mat-hint>\n }\n\n @if (model().maxLength) {\n <mat-hint align=\"end\">{{ maxCountText() }}</mat-hint>\n }\n\n @for (validator of model().validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-form-field .loader-icon{padding:8px}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{appearance:none;margin:0}input[type=number]{appearance:textfield}\n"], dependencies: [{ 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", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { 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"] }] }); }
|
|
545
|
+
}
|
|
546
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicInputComponent, decorators: [{
|
|
547
|
+
type: Component,
|
|
548
|
+
args: [{ imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatButtonModule, MatIconModule, MatProgressSpinnerModule], selector: 'dynamic-input', template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"id\"\n color=\"primary\">\n @if (model().label) {\n <mat-label>{{ model().label }}</mat-label>\n }\n\n @if (model().prefix) {\n <span matTextPrefix>{{ model().prefix }}</span>\n }\n\n <input\n 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\n @if (typeIsPassword()) {\n <button\n matSuffix\n mat-icon-button\n (click)=\"togglePassword()\">\n @if (input().type === 'password') {\n <mat-icon fontIcon=\"visibility\"></mat-icon>\n } @else {\n <mat-icon fontIcon=\"visibility_off\"></mat-icon>\n }\n </button>\n }\n\n @if (showClear()) {\n <button\n matSuffix\n mat-icon-button\n (click)=\"resetControl()\">\n <mat-icon fontIcon=\"clear\"></mat-icon>\n </button>\n }\n\n @if (model().showLoader()) {\n <div\n matSuffix\n class=\"loader-icon\">\n <mat-spinner\n diameter=\"16\"\n color=\"primary\"></mat-spinner>\n </div>\n }\n\n @if (model().hint) {\n <mat-hint align=\"start\">{{ model().hint }}</mat-hint>\n }\n\n @if (model().maxLength) {\n <mat-hint align=\"end\">{{ maxCountText() }}</mat-hint>\n }\n\n @for (validator of model().validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-form-field .loader-icon{padding:8px}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{appearance:none;margin:0}input[type=number]{appearance:textfield}\n"] }]
|
|
549
|
+
}], propDecorators: { input: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatInput), { isSignal: true }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
550
|
+
|
|
551
|
+
class DynamicRadioGroupComponent extends DynamicFormFieldBase {
|
|
552
|
+
constructor() {
|
|
553
|
+
super(...arguments);
|
|
554
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
555
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
556
|
+
}
|
|
557
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicRadioGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
558
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicRadioGroupComponent, isStandalone: true, selector: "dynamic-radio-group", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div\n class=\"dynamic-radio-group-wrapper\"\n [formGroup]=\"group()\">\n @if (model().label) {\n <label>{{ model().label }}</label>\n }\n <mat-radio-group\n [formControlName]=\"model().name\"\n class=\"radio-group\"\n [class.inlint]=\"model().inline\">\n @for (option of model().options$ | async; track option.value) {\n <mat-radio-button\n [value]=\"option.value\"\n [labelPosition]=\"model().labelPosition\">\n {{ option.label }}\n </mat-radio-button>\n }\n </mat-radio-group>\n</div>\n", styles: [".dynamic-radio-group-wrapper label{display:block;font-size:var(--mat-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: "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" }] }); }
|
|
559
|
+
}
|
|
560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicRadioGroupComponent, decorators: [{
|
|
561
|
+
type: Component,
|
|
562
|
+
args: [{ imports: [ReactiveFormsModule, MatRadioModule, AsyncPipe], selector: 'dynamic-radio-group', template: "<div\n class=\"dynamic-radio-group-wrapper\"\n [formGroup]=\"group()\">\n @if (model().label) {\n <label>{{ model().label }}</label>\n }\n <mat-radio-group\n [formControlName]=\"model().name\"\n class=\"radio-group\"\n [class.inlint]=\"model().inline\">\n @for (option of model().options$ | async; track option.value) {\n <mat-radio-button\n [value]=\"option.value\"\n [labelPosition]=\"model().labelPosition\">\n {{ option.label }}\n </mat-radio-button>\n }\n </mat-radio-group>\n</div>\n", styles: [".dynamic-radio-group-wrapper label{display:block;font-size:var(--mat-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"] }]
|
|
563
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
564
|
+
|
|
565
|
+
class DynamicReadonlyComponent extends DynamicFormFieldBase {
|
|
566
|
+
constructor() {
|
|
567
|
+
super(...arguments);
|
|
568
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
569
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
570
|
+
}
|
|
571
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicReadonlyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
572
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: DynamicReadonlyComponent, isStandalone: true, selector: "dynamic-readonly", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div\n class=\"dynamic-form-field-readonly\"\n [formGroup]=\"group()\"\n [id]=\"model().id\">\n <div class=\"label\">{{ model().label }}</div>\n <span>{{ model().value }}</span>\n</div>\n", styles: [".dynamic-form-field-readonly{width:100%;margin:8px 0;color:var(--mat-theme-text-primary-on-background, rgba(0, 0, 0, .87))}.dynamic-form-field-readonly .label{font-size:var(--mat-typography-body2-font-size, 14px);line-height:var(--mat-typography-body2-line-height, 20px);margin-bottom:8px}\n"], dependencies: [{ 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"] }] }); }
|
|
573
|
+
}
|
|
574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicReadonlyComponent, decorators: [{
|
|
575
|
+
type: Component,
|
|
576
|
+
args: [{ imports: [ReactiveFormsModule], selector: 'dynamic-readonly', template: "<div\n class=\"dynamic-form-field-readonly\"\n [formGroup]=\"group()\"\n [id]=\"model().id\">\n <div class=\"label\">{{ model().label }}</div>\n <span>{{ model().value }}</span>\n</div>\n", styles: [".dynamic-form-field-readonly{width:100%;margin:8px 0;color:var(--mat-theme-text-primary-on-background, rgba(0, 0, 0, .87))}.dynamic-form-field-readonly .label{font-size:var(--mat-typography-body2-font-size, 14px);line-height:var(--mat-typography-body2-line-height, 20px);margin-bottom:8px}\n"] }]
|
|
577
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
578
|
+
|
|
579
|
+
class DynamicSelectComponent extends DynamicFormFieldBase {
|
|
580
|
+
constructor() {
|
|
581
|
+
super(...arguments);
|
|
582
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
583
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
584
|
+
}
|
|
585
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
586
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicSelectComponent, isStandalone: true, selector: "dynamic-select", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"model().id\"\n color=\"primary\">\n <mat-label>{{ model().label }}</mat-label>\n\n <!-- Template for select without grouped options -->\n @if (model().options$ | async; as options) {\n @if (!model().native) {\n <mat-select\n [formControlName]=\"model().name\"\n [multiple]=\"model().multiple\">\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 } @else {\n <select matNativeControl>\n @for (option of options; track option.value) {\n <option [value]=\"option.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n }\n\n <!-- Template for select with grouped options -->\n @if (model().groupedOptions$ | async; as groupedOptions) {\n @if (!model().native) {\n <mat-select [formControlName]=\"model().name\">\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 </mat-select>\n } @else {\n <select matNativeControl>\n @for (group of groupedOptions; track group.name) {\n =\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 }\n }\n\n @if (model().hint) {\n <mat-hint align=\"start\">{{ model().hint }}</mat-hint>\n }\n\n @for (validator of model().validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-option{padding-top:8px;padding-bottom:8px}\n"], dependencies: [{ 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", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i3$1.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: MatOptionModule }, { 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", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
587
|
+
}
|
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicSelectComponent, decorators: [{
|
|
589
|
+
type: Component,
|
|
590
|
+
args: [{ imports: [MatFormFieldModule, ReactiveFormsModule, MatSelectModule, MatOptionModule, AsyncPipe, MatInputModule], selector: 'dynamic-select', template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"model().id\"\n color=\"primary\">\n <mat-label>{{ model().label }}</mat-label>\n\n <!-- Template for select without grouped options -->\n @if (model().options$ | async; as options) {\n @if (!model().native) {\n <mat-select\n [formControlName]=\"model().name\"\n [multiple]=\"model().multiple\">\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 } @else {\n <select matNativeControl>\n @for (option of options; track option.value) {\n <option [value]=\"option.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n }\n\n <!-- Template for select with grouped options -->\n @if (model().groupedOptions$ | async; as groupedOptions) {\n @if (!model().native) {\n <mat-select [formControlName]=\"model().name\">\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 </mat-select>\n } @else {\n <select matNativeControl>\n @for (group of groupedOptions; track group.name) {\n =\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 }\n }\n\n @if (model().hint) {\n <mat-hint align=\"start\">{{ model().hint }}</mat-hint>\n }\n\n @for (validator of model().validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}mat-option{padding-top:8px;padding-bottom:8px}\n"] }]
|
|
591
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
592
|
+
|
|
593
|
+
class DynamicSlideToggleComponent extends DynamicFormFieldBase {
|
|
594
|
+
constructor() {
|
|
595
|
+
super(...arguments);
|
|
596
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
597
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
598
|
+
}
|
|
599
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicSlideToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
600
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: DynamicSlideToggleComponent, isStandalone: true, selector: "dynamic-slide-toggle", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<ng-container [formGroup]=\"group()\">\n <mat-slide-toggle\n [formControlName]=\"model().name\"\n [labelPosition]=\"model().labelPosition\"\n [id]=\"id\">\n <span class=\"slide-toggle-label\">{{ model().label }}</span>\n </mat-slide-toggle>\n</ng-container>\n", styles: [".slide-toggle-label{margin-left:var(--slide-toggle-label-spacing, .5rem)}\n"], dependencies: [{ 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: MatSlideToggleModule }, { kind: "component", type: i2$3.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }] }); }
|
|
601
|
+
}
|
|
602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicSlideToggleComponent, decorators: [{
|
|
603
|
+
type: Component,
|
|
604
|
+
args: [{ selector: 'dynamic-slide-toggle', imports: [ReactiveFormsModule, MatSlideToggleModule], template: "<ng-container [formGroup]=\"group()\">\n <mat-slide-toggle\n [formControlName]=\"model().name\"\n [labelPosition]=\"model().labelPosition\"\n [id]=\"id\">\n <span class=\"slide-toggle-label\">{{ model().label }}</span>\n </mat-slide-toggle>\n</ng-container>\n", styles: [".slide-toggle-label{margin-left:var(--slide-toggle-label-spacing, .5rem)}\n"] }]
|
|
605
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
606
|
+
|
|
607
|
+
class DynamicStaticTextComponent extends DynamicFormFieldBase {
|
|
608
|
+
constructor() {
|
|
609
|
+
super(...arguments);
|
|
610
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
611
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
612
|
+
}
|
|
613
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicStaticTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
614
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicStaticTextComponent, isStandalone: true, selector: "dynamic-static-text", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-static-text\">\n @if (model().value?.title) {\n <h3 class=\"dynamic-static-text-title\">{{ model().value?.title }}</h3>\n }\n @if (model().value?.text) {\n <p class=\"dynamic-static-text-body\">{{ model().value?.text }}</p>\n }\n</div>\n", styles: [".dynamic-static-text{margin-bottom:var(--dynamic-static-text-spacing, 1rem)}.dynamic-static-text-title{font-size:var(--dynamic-static-text-title-size, 1.25rem);font-weight:var(--dynamic-static-text-title-font-weight, 600);color:var(--dynamic-static-text-title-color, inherit)}.dynamic-static-text-body{margin:0;font-size:var(--dynamic-static-text-body-size, 1rem);line-height:var(--dynamic-static-text-body-line-height, 1.5);color:var(--dynamic-static-text-body-color, inherit)}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] }); }
|
|
615
|
+
}
|
|
616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicStaticTextComponent, decorators: [{
|
|
617
|
+
type: Component,
|
|
618
|
+
args: [{ selector: 'dynamic-static-text', imports: [ReactiveFormsModule], template: "<div class=\"dynamic-static-text\">\n @if (model().value?.title) {\n <h3 class=\"dynamic-static-text-title\">{{ model().value?.title }}</h3>\n }\n @if (model().value?.text) {\n <p class=\"dynamic-static-text-body\">{{ model().value?.text }}</p>\n }\n</div>\n", styles: [".dynamic-static-text{margin-bottom:var(--dynamic-static-text-spacing, 1rem)}.dynamic-static-text-title{font-size:var(--dynamic-static-text-title-size, 1.25rem);font-weight:var(--dynamic-static-text-title-font-weight, 600);color:var(--dynamic-static-text-title-color, inherit)}.dynamic-static-text-body{margin:0;font-size:var(--dynamic-static-text-body-size, 1rem);line-height:var(--dynamic-static-text-body-line-height, 1.5);color:var(--dynamic-static-text-body-color, inherit)}\n"] }]
|
|
619
|
+
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
620
|
+
|
|
621
|
+
class DynamicTextareaComponent extends DynamicFormFieldBase {
|
|
622
|
+
constructor() {
|
|
623
|
+
super(...arguments);
|
|
624
|
+
this.textarea = viewChild.required(MatInput);
|
|
625
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
626
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
627
|
+
}
|
|
628
|
+
get valueCount() {
|
|
629
|
+
return this.textarea()?.value ? this.textarea().value.length : 0;
|
|
630
|
+
}
|
|
631
|
+
get maxCountText() {
|
|
632
|
+
return `${this.valueCount} / ${this.model().maxLength}`;
|
|
633
|
+
}
|
|
634
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
635
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicTextareaComponent, isStandalone: true, selector: "dynamic-textarea", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "textarea", first: true, predicate: MatInput, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"id\"\n color=\"primary\">\n @if (model().label) {\n <mat-label>{{ model().label }}</mat-label>\n }\n\n <textarea\n 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 </textarea>\n\n @if (model().hint) {\n <mat-hint align=\"start\">{{ model().hint }}</mat-hint>\n }\n\n @if (model().maxLength) {\n <mat-hint align=\"end\">{{ maxCountText }}</mat-hint>\n }\n\n @for (validator of model().validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ 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", "disabledInteractive"], 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"] }] }); }
|
|
636
|
+
}
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicTextareaComponent, decorators: [{
|
|
638
|
+
type: Component,
|
|
639
|
+
args: [{ imports: [MatFormFieldModule, MatInputModule, ReactiveFormsModule], selector: 'dynamic-textarea', template: "<mat-form-field\n [formGroup]=\"group()\"\n [id]=\"id\"\n color=\"primary\">\n @if (model().label) {\n <mat-label>{{ model().label }}</mat-label>\n }\n\n <textarea\n 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 </textarea>\n\n @if (model().hint) {\n <mat-hint align=\"start\">{{ model().hint }}</mat-hint>\n }\n\n @if (model().maxLength) {\n <mat-hint align=\"end\">{{ maxCountText }}</mat-hint>\n }\n\n @for (validator of model().validators; track validator.name) {\n <ng-container ngProjectAs=\"mat-error\">\n @if (hasError(validator.name)) {\n <mat-error>{{ validator.message }}</mat-error>\n }\n </ng-container>\n }\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"] }]
|
|
640
|
+
}], propDecorators: { textarea: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatInput), { isSignal: true }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
641
|
+
|
|
642
|
+
const DYNAMIC_FORM_FIELD_MAP = {
|
|
643
|
+
[DYNAMIC_FORM_FIELD_BUTTON]: DynamicButtonComponent,
|
|
644
|
+
[DYNAMIC_FORM_FIELD_BUTTON_TOGGLES]: DynamicButtonTogglesComponent,
|
|
645
|
+
[DYNAMIC_FORM_FIELD_CHECKBOX]: DynamicCheckboxComponent,
|
|
646
|
+
[DYNAMIC_FORM_FIELD_DATEPICKER]: DynamicDatepickerComponent,
|
|
647
|
+
[DYNAMIC_FORM_FIELD_INPUT]: DynamicInputComponent,
|
|
648
|
+
[DYNAMIC_FORM_FIELD_RADIO_GROUP]: DynamicRadioGroupComponent,
|
|
649
|
+
[DYNAMIC_FORM_FIELD_READONLY]: DynamicReadonlyComponent,
|
|
650
|
+
[DYNAMIC_FORM_FIELD_SELECT]: DynamicSelectComponent,
|
|
651
|
+
[DYNAMIC_FORM_FIELD_SLIDE_TOGGLE]: DynamicSlideToggleComponent,
|
|
652
|
+
[DYNAMIC_FORM_FIELD_STATIC_TEXT]: DynamicStaticTextComponent,
|
|
653
|
+
[DYNAMIC_FORM_FIELD_TEXTAREA]: DynamicTextareaComponent
|
|
654
|
+
};
|
|
655
|
+
|
|
671
656
|
/**
|
|
672
657
|
* Relation action to disable/enable a form control.
|
|
673
658
|
*/
|
|
@@ -715,6 +700,7 @@ const REQUIRED_ACTION = {
|
|
|
715
700
|
*/
|
|
716
701
|
const RELATION_ACTIONS = [DISABLE_ACTION, HIDDEN_ACTION, REQUIRED_ACTION];
|
|
717
702
|
|
|
703
|
+
/** @ignore */
|
|
718
704
|
class DynamicFormRelationsService {
|
|
719
705
|
constructor() {
|
|
720
706
|
this._injector = inject(Injector);
|
|
@@ -729,9 +715,7 @@ class DynamicFormRelationsService {
|
|
|
729
715
|
const conditionReducer = (controls, condition) => {
|
|
730
716
|
const fieldName = condition.path ?? condition.fieldName;
|
|
731
717
|
// Get the control using the provided path or fieldName
|
|
732
|
-
const control = condition.path
|
|
733
|
-
? group.root.get(condition.path)
|
|
734
|
-
: group.get(condition.fieldName);
|
|
718
|
+
const control = condition.path ? group.root.get(condition.path) : group.get(condition.fieldName);
|
|
735
719
|
if (!control) {
|
|
736
720
|
console.warn(`No related form control with the name ${fieldName} found`);
|
|
737
721
|
return controls;
|
|
@@ -818,21 +802,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
818
802
|
}]
|
|
819
803
|
}] });
|
|
820
804
|
|
|
805
|
+
/** @ignore */
|
|
821
806
|
class DynamicFormFieldComponent {
|
|
822
807
|
constructor() {
|
|
823
|
-
this.
|
|
808
|
+
this.componentViewContainer = viewChild.required('componentViewContainer', { read: ViewContainerRef });
|
|
809
|
+
this.model = input.required(...(ngDevMode ? [{ debugName: "model" }] : []));
|
|
810
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
824
811
|
this.dynamicFormService = inject(DynamicFormService);
|
|
825
812
|
this.relationService = inject(DynamicFormRelationsService);
|
|
826
813
|
this.cdRef = inject(ChangeDetectorRef);
|
|
827
814
|
this._subs = new Subscription();
|
|
828
815
|
}
|
|
829
|
-
/**
|
|
816
|
+
/**
|
|
817
|
+
* Get the instance of a control component using the injected custom method or local method
|
|
818
|
+
*/
|
|
830
819
|
get componentType() {
|
|
831
|
-
return this.dynamicFormService.getCustomControlComponentType(this.model) || this.getControlComponentType();
|
|
820
|
+
return this.dynamicFormService.getCustomControlComponentType(this.model()) || this.getControlComponentType();
|
|
832
821
|
}
|
|
833
822
|
ngOnInit() {
|
|
834
|
-
if (this.group) {
|
|
835
|
-
this._control = this.group.get(this.model.name);
|
|
823
|
+
if (this.group()) {
|
|
824
|
+
this._control = this.group().get(this.model().name);
|
|
836
825
|
this.createFormControlComponent();
|
|
837
826
|
this.setSubscriptions();
|
|
838
827
|
}
|
|
@@ -845,51 +834,32 @@ class DynamicFormFieldComponent {
|
|
|
845
834
|
* @returns
|
|
846
835
|
*/
|
|
847
836
|
getControlComponentType() {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return DynamicButtonTogglesComponent;
|
|
853
|
-
case DYNAMIC_FORM_FIELD_CHECKBOX:
|
|
854
|
-
return DynamicCheckboxComponent;
|
|
855
|
-
case DYNAMIC_FORM_FIELD_DATEPICKER:
|
|
856
|
-
return DynamicDatepickerComponent;
|
|
857
|
-
case DYNAMIC_FORM_FIELD_INPUT:
|
|
858
|
-
return DynamicInputComponent;
|
|
859
|
-
case DYNAMIC_FORM_FIELD_RADIO_GROUP:
|
|
860
|
-
return DymamicRadioGroupComponent;
|
|
861
|
-
case DYNAMIC_FORM_FIELD_READONLY:
|
|
862
|
-
return DynamicReadonlyComponent;
|
|
863
|
-
case DYNAMIC_FORM_FIELD_SELECT:
|
|
864
|
-
return DynamicSelectComponent;
|
|
865
|
-
case DYNAMIC_FORM_FIELD_TEXTAREA:
|
|
866
|
-
return DynamicTextareaComponent;
|
|
867
|
-
default:
|
|
868
|
-
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`);
|
|
869
|
-
return null;
|
|
837
|
+
const field = DYNAMIC_FORM_FIELD_MAP[this.model().type];
|
|
838
|
+
if (!field) {
|
|
839
|
+
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`);
|
|
840
|
+
return null;
|
|
870
841
|
}
|
|
842
|
+
return field;
|
|
871
843
|
}
|
|
872
844
|
createFormControlComponent() {
|
|
873
845
|
const component = this.componentType;
|
|
874
846
|
if (component != null) {
|
|
875
|
-
let componentRef = this.componentViewContainer.createComponent(component);
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
componentInstance.group = this.group;
|
|
879
|
-
componentInstance.model = this.model;
|
|
847
|
+
let componentRef = this.componentViewContainer().createComponent(component);
|
|
848
|
+
componentRef.setInput('group', this.group());
|
|
849
|
+
componentRef.setInput('model', this.model());
|
|
880
850
|
}
|
|
881
851
|
}
|
|
882
852
|
/**
|
|
883
853
|
* Setup all necessary subscriptions of the FormControl
|
|
884
854
|
*/
|
|
885
855
|
setSubscriptions() {
|
|
886
|
-
const model = this.model;
|
|
856
|
+
const model = this.model();
|
|
887
857
|
// Subscribe to the value change inside the control to change the value inside the model as well
|
|
888
858
|
this._subs.add(this._control.valueChanges.subscribe((value) => this.onValueChange(value)));
|
|
889
859
|
// Subscribe to the disabled change inside the model to change the disabled state of the FormControl
|
|
890
860
|
this._subs.add(model.disabledChange.subscribe((disabled) => this.onDisabledChange(disabled)));
|
|
891
861
|
// Setup subscriptions for any possible relation
|
|
892
|
-
if (this.model.relations?.length) {
|
|
862
|
+
if (this.model().relations?.length) {
|
|
893
863
|
this.setUpRelations();
|
|
894
864
|
}
|
|
895
865
|
}
|
|
@@ -898,8 +868,8 @@ class DynamicFormFieldComponent {
|
|
|
898
868
|
*/
|
|
899
869
|
setUpRelations() {
|
|
900
870
|
// Array of all FormControls the current model has a relation to
|
|
901
|
-
const relatedFormControls = this.relationService.findRelatedFormField(this.model, this.group);
|
|
902
|
-
const subs = this.relationService.getRelationSubscriptions(relatedFormControls, this.model, this._control);
|
|
871
|
+
const relatedFormControls = this.relationService.findRelatedFormField(this.model(), this.group());
|
|
872
|
+
const subs = this.relationService.getRelationSubscriptions(relatedFormControls, this.model(), this._control);
|
|
903
873
|
// Add all relations as subscription to the main Subscription object
|
|
904
874
|
subs.forEach((sub) => this._subs.add(sub));
|
|
905
875
|
}
|
|
@@ -908,8 +878,8 @@ class DynamicFormFieldComponent {
|
|
|
908
878
|
* @param value
|
|
909
879
|
*/
|
|
910
880
|
onValueChange(value) {
|
|
911
|
-
if (this.model instanceof DynamicFormFieldValueModel && this.model.value !== value) {
|
|
912
|
-
this.model.value = value;
|
|
881
|
+
if (this.model() instanceof DynamicFormFieldValueModel && this.model().value !== value) {
|
|
882
|
+
this.model().value = value;
|
|
913
883
|
}
|
|
914
884
|
}
|
|
915
885
|
/**
|
|
@@ -921,45 +891,35 @@ class DynamicFormFieldComponent {
|
|
|
921
891
|
disabled ? this._control.disable() : this._control.enable();
|
|
922
892
|
this.cdRef.markForCheck();
|
|
923
893
|
}
|
|
924
|
-
onChange(ev) {
|
|
925
|
-
this.change.emit(this.createDynamicFormEvent(ev, 'change'));
|
|
926
|
-
}
|
|
927
|
-
createDynamicFormEvent(event, type) {
|
|
928
|
-
return { event, type, control: this._control, form: this.group, model: this.model };
|
|
929
|
-
}
|
|
930
894
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
931
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
895
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.16", type: DynamicFormFieldComponent, isStandalone: true, selector: "dynamic-form-field", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "componentViewContainer", first: true, predicate: ["componentViewContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div\n [formGroup]=\"group()\"\n [ngClass]=\"['dynamic-form-field-container', 'dynamic-form-field-' + model().type]\">\n <ng-container #componentViewContainer></ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
932
896
|
}
|
|
933
897
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
|
|
934
898
|
type: Component,
|
|
935
|
-
args: [{ imports: [NgClass, ReactiveFormsModule], selector: 'dynamic-form-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div
|
|
936
|
-
}], propDecorators: { componentViewContainer: [{
|
|
937
|
-
type: ViewChild,
|
|
938
|
-
args: ['componentViewContainer', { read: ViewContainerRef, static: true }]
|
|
939
|
-
}], model: [{
|
|
940
|
-
type: Input
|
|
941
|
-
}], group: [{
|
|
942
|
-
type: Input
|
|
943
|
-
}], change: [{
|
|
944
|
-
type: Output
|
|
945
|
-
}] } });
|
|
899
|
+
args: [{ imports: [NgClass, ReactiveFormsModule], selector: 'dynamic-form-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [formGroup]=\"group()\"\n [ngClass]=\"['dynamic-form-field-container', 'dynamic-form-field-' + model().type]\">\n <ng-container #componentViewContainer></ng-container>\n</div>\n" }]
|
|
900
|
+
}], propDecorators: { componentViewContainer: [{ type: i0.ViewChild, args: ['componentViewContainer', { ...{ read: ViewContainerRef }, isSignal: true }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }] } });
|
|
946
901
|
|
|
947
902
|
class DynamicFormComponent {
|
|
948
903
|
constructor() {
|
|
949
|
-
this.
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
904
|
+
this.group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
905
|
+
this.formConfig = input.required(...(ngDevMode ? [{ debugName: "formConfig" }] : []));
|
|
906
|
+
this.layout = input([], ...(ngDevMode ? [{ debugName: "layout" }] : []));
|
|
907
|
+
this.layoutRows = computed(() => {
|
|
908
|
+
if (!this.layout()?.length)
|
|
909
|
+
return null;
|
|
910
|
+
return this.layout().map((row) => row
|
|
911
|
+
.trim()
|
|
912
|
+
.split(/\s+/)
|
|
913
|
+
.map((name) => this.formConfig().find((f) => f.name === name))
|
|
914
|
+
.filter((f) => !!f));
|
|
915
|
+
}, ...(ngDevMode ? [{ debugName: "layoutRows" }] : []));
|
|
956
916
|
}
|
|
957
917
|
/**
|
|
958
918
|
* Get the current value of the form.
|
|
959
919
|
* @param includeDisabledFields Include the disabled fields of the form, is enabled by default
|
|
960
920
|
*/
|
|
961
921
|
getFormValue(includeDisabledFields = true) {
|
|
962
|
-
const formValue = includeDisabledFields ? this.group.getRawValue() : this.group.value;
|
|
922
|
+
const formValue = includeDisabledFields ? this.group().getRawValue() : this.group().value;
|
|
963
923
|
return formValue;
|
|
964
924
|
}
|
|
965
925
|
/**
|
|
@@ -969,30 +929,59 @@ class DynamicFormComponent {
|
|
|
969
929
|
* @returns Observable<unknown>
|
|
970
930
|
*/
|
|
971
931
|
onControlChange(name) {
|
|
972
|
-
const field = this.group.get(name);
|
|
932
|
+
const field = this.group().get(name);
|
|
973
933
|
if (!field) {
|
|
974
934
|
throw new Error(`Cannot find a field with the name ${name} in the FormGroup`);
|
|
975
935
|
}
|
|
976
936
|
return field.valueChanges;
|
|
977
937
|
}
|
|
978
|
-
onChange(event) {
|
|
979
|
-
this.change.emit(event);
|
|
980
|
-
}
|
|
981
938
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
982
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicFormComponent, isStandalone: true, selector: "dynamic-form", inputs: { group: "group", formConfig: "formConfig" },
|
|
939
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DynamicFormComponent, isStandalone: true, selector: "dynamic-form", inputs: { group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null }, formConfig: { classPropertyName: "formConfig", publicName: "formConfig", isSignal: true, isRequired: true, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DynamicFormService], ngImport: i0, template: "@if (layoutRows(); as rows) {\n @for (row of rows; track $index) {\n <div class=\"dynamic-form-row\">\n @for (field of row; track field.id) {\n <dynamic-form-field\n class=\"dynamic-form-field\"\n [style.flex-basis]=\"'var(--field-' + field.name + '-width, auto)'\"\n [style.max-width]=\"'var(--field-' + field.name + '-width, 100%)'\"\n [id]=\"field.id\"\n [hidden]=\"field.hidden\"\n [class]=\"field.type\"\n [group]=\"group()\"\n [model]=\"field\">\n </dynamic-form-field>\n }\n </div>\n }\n} @else {\n @for (field of formConfig(); track $index) {\n <div class=\"dynamic-form-row\">\n <dynamic-form-field\n class=\"dynamic-form-field\"\n [style.flex-basis]=\"'var(--field-' + field.name + '-width, auto)'\"\n [style.max-width]=\"'var(--field-' + field.name + '-width, 100%)'\"\n [id]=\"field.id\"\n [hidden]=\"field.hidden\"\n [class]=\"field.type\"\n [group]=\"group()\"\n [model]=\"field\">\n </dynamic-form-field>\n </div>\n }\n}\n", styles: [".dynamic-form-row{display:flex;flex-wrap:wrap;gap:var(--form-field-spacing, .5rem);margin-bottom:var(--form-field-spacing, .5rem)}.dynamic-form-row .dynamic-form-field{flex:1;min-width:0}.dynamic-form-row .dynamic-form-field.button{flex:0}\n"], dependencies: [{ kind: "component", type: DynamicFormFieldComponent, selector: "dynamic-form-field", inputs: ["model", "group"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
983
940
|
}
|
|
984
941
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DynamicFormComponent, decorators: [{
|
|
985
942
|
type: Component,
|
|
986
|
-
args: [{ imports: [
|
|
987
|
-
}], propDecorators: { group: [{
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
943
|
+
args: [{ imports: [DynamicFormFieldComponent, ReactiveFormsModule], selector: 'dynamic-form', providers: [DynamicFormService], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (layoutRows(); as rows) {\n @for (row of rows; track $index) {\n <div class=\"dynamic-form-row\">\n @for (field of row; track field.id) {\n <dynamic-form-field\n class=\"dynamic-form-field\"\n [style.flex-basis]=\"'var(--field-' + field.name + '-width, auto)'\"\n [style.max-width]=\"'var(--field-' + field.name + '-width, 100%)'\"\n [id]=\"field.id\"\n [hidden]=\"field.hidden\"\n [class]=\"field.type\"\n [group]=\"group()\"\n [model]=\"field\">\n </dynamic-form-field>\n }\n </div>\n }\n} @else {\n @for (field of formConfig(); track $index) {\n <div class=\"dynamic-form-row\">\n <dynamic-form-field\n class=\"dynamic-form-field\"\n [style.flex-basis]=\"'var(--field-' + field.name + '-width, auto)'\"\n [style.max-width]=\"'var(--field-' + field.name + '-width, 100%)'\"\n [id]=\"field.id\"\n [hidden]=\"field.hidden\"\n [class]=\"field.type\"\n [group]=\"group()\"\n [model]=\"field\">\n </dynamic-form-field>\n </div>\n }\n}\n", styles: [".dynamic-form-row{display:flex;flex-wrap:wrap;gap:var(--form-field-spacing, .5rem);margin-bottom:var(--form-field-spacing, .5rem)}.dynamic-form-row .dynamic-form-field{flex:1;min-width:0}.dynamic-form-row .dynamic-form-field.button{flex:0}\n"] }]
|
|
944
|
+
}], propDecorators: { group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }], formConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "formConfig", required: true }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }] } });
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Transform any list to a list of DynamicFormFieldOption which is used in any Dynamic Form Field with options (e.g. DynamicSelect).
|
|
948
|
+
* Possible to provide the method with type definitions to define the provided list type `<T>` and desired option value type `<K>`:
|
|
949
|
+
*
|
|
950
|
+
* `dynamicFormService.toDynamicOptionList<T, K>(...)`
|
|
951
|
+
*
|
|
952
|
+
* Generic types:
|
|
953
|
+
* - T = The type of the items in the provided list
|
|
954
|
+
* - K = The type of the value inside an DynamicFormFieldOption. Default is 'string'
|
|
955
|
+
* @param arr An array of items of type T
|
|
956
|
+
* @param labelFn Callback to define the label of the options in the template
|
|
957
|
+
* @param valueFn Callback to define the value of the options. Must return a value of type K (default string)
|
|
958
|
+
* @returns
|
|
959
|
+
*/
|
|
960
|
+
function arrToDynamicFormOptions(arr, labelFn, valueFn) {
|
|
961
|
+
return arr.map((item) => {
|
|
962
|
+
return {
|
|
963
|
+
label: labelFn(item),
|
|
964
|
+
value: valueFn(item)
|
|
965
|
+
};
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Transform any Observable of a list to a list of DynamicFormFieldOption which is used in any Dynamic Form Field with options (e.g. DynamicSelect).
|
|
970
|
+
* Possible to provide the method with type definitions to define the provided list type `<T>` and desired option value type `<K>`:
|
|
971
|
+
*
|
|
972
|
+
* `dynamicFormService.toDynamicOptionList<T, K>(...)`
|
|
973
|
+
*
|
|
974
|
+
* Generic types:
|
|
975
|
+
* - T = The type of the items in the provided list
|
|
976
|
+
* - K = The type of the value inside an DynamicFormFieldOption. Default is 'string'
|
|
977
|
+
* @param obs An Observable of a list of items of type T
|
|
978
|
+
* @param labelFn Callback to define the label of the options in the template
|
|
979
|
+
* @param valueFn Callback to define the value of the options. Must return a value of type K (default string)
|
|
980
|
+
* @returns
|
|
981
|
+
*/
|
|
982
|
+
function obsToDynamicFormOptions(obs, labelFn, valueFn) {
|
|
983
|
+
return obs.pipe(map((arr) => arrToDynamicFormOptions(arr, labelFn, valueFn)));
|
|
984
|
+
}
|
|
996
985
|
|
|
997
986
|
/*
|
|
998
987
|
* Public API Surface of ngx-dynamic-form
|
|
@@ -1002,5 +991,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1002
991
|
* Generated bundle index. Do not edit.
|
|
1003
992
|
*/
|
|
1004
993
|
|
|
1005
|
-
export { DYNAMIC_FORM_FIELD_BUTTON, DYNAMIC_FORM_FIELD_BUTTON_TOGGLES, DYNAMIC_FORM_FIELD_CHECKBOX, DYNAMIC_FORM_FIELD_DATEPICKER, DYNAMIC_FORM_FIELD_INPUT,
|
|
994
|
+
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$1 as DYNAMIC_FORM_FIELD_MAP, DYNAMIC_FORM_FIELD_RADIO_GROUP, DYNAMIC_FORM_FIELD_READONLY, DYNAMIC_FORM_FIELD_SELECT, DYNAMIC_FORM_FIELD_SLIDE_TOGGLE, DYNAMIC_FORM_FIELD_STATIC_TEXT, DYNAMIC_FORM_FIELD_TEXTAREA, DynamicButton, DynamicButtonToggles, DynamicCheckbox, DynamicDatepicker, DynamicFormComponent, DynamicFormFieldBase, DynamicFormFieldModel, DynamicFormFieldOptionModel, DynamicFormFieldValueModel, DynamicFormService, DynamicFormValidators, DynamicInput, DynamicRadioGroup, DynamicReadonly, DynamicSelect, DynamicSlideToggle, DynamicStaticText, DynamicTextarea, RelationActionType, RelationOperator, arrToDynamicFormOptions, obsToDynamicFormOptions };
|
|
1006
995
|
//# sourceMappingURL=olafvv-ngx-dynamic-form.mjs.map
|