@sotoa-ui/dynamic-form 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,1812 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, inject, DestroyRef, Component, forwardRef, ChangeDetectorRef, ViewContainerRef, EnvironmentInjector, input, Directive, output, effect } from '@angular/core';
|
|
3
|
+
import { distinctUntilChanged, isObservable } from 'rxjs';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as _ from 'lodash-es';
|
|
7
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
|
+
import { debounceTime } from 'rxjs/operators';
|
|
9
|
+
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
10
|
+
import * as i2 from '@angular/material/checkbox';
|
|
11
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
12
|
+
import * as i2$1 from '@angular/material/form-field';
|
|
13
|
+
import { MatError, MatFormFieldModule } from '@angular/material/form-field';
|
|
14
|
+
import * as i3$1 from '@angular/material/icon';
|
|
15
|
+
import { MatIconModule, MatIcon } from '@angular/material/icon';
|
|
16
|
+
import * as i3 from '@angular/material/input';
|
|
17
|
+
import { MatInputModule } from '@angular/material/input';
|
|
18
|
+
import * as i5 from '@angular/material/button';
|
|
19
|
+
import { MatButtonModule, MatButton } from '@angular/material/button';
|
|
20
|
+
import * as i1$1 from '@angular/material/expansion';
|
|
21
|
+
import { MatAccordion, MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle, MatExpansionModule } from '@angular/material/expansion';
|
|
22
|
+
import { MatCardModule } from '@angular/material/card';
|
|
23
|
+
import * as i2$2 from '@angular/material/radio';
|
|
24
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
25
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
26
|
+
import * as i3$2 from '@angular/material/select';
|
|
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';
|
|
30
|
+
|
|
31
|
+
class ConditionsService {
|
|
32
|
+
constructor() {
|
|
33
|
+
}
|
|
34
|
+
checkValidationConditions(validationConditions, dynamicFormDatas) {
|
|
35
|
+
for (const cond of validationConditions) {
|
|
36
|
+
const fieldPath = dynamicFormDatas.idPathMap.get(cond.fieldId);
|
|
37
|
+
console.log(fieldPath);
|
|
38
|
+
if (fieldPath) {
|
|
39
|
+
for (let instance of fieldPath) {
|
|
40
|
+
const field = dynamicFormDatas.pathFieldConfigMap.get(instance);
|
|
41
|
+
console.log(field);
|
|
42
|
+
/*
|
|
43
|
+
if (field) {
|
|
44
|
+
const isConditionOk = this.checkCondition(cond.validation.condition!, pathFieldMap, idPathMap, instance.arrayCode, instance.arrayInstance);
|
|
45
|
+
this.setValidation(field, cond.validation, isConditionOk);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
*/
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/*
|
|
52
|
+
else if (fieldPath) {
|
|
53
|
+
const field = pathFieldMap.get(fieldPath);
|
|
54
|
+
if (field && field.control) {
|
|
55
|
+
const isConditionOk = this.checkCondition(cond.validation.condition!, pathFieldMap, idPathMap, null, null);
|
|
56
|
+
this.setValidation(field, cond.validation, isConditionOk);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
*/
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/*
|
|
64
|
+
setValidation(field: FormField, validation: AcValidator, isConditionOk: boolean) {
|
|
65
|
+
if (isConditionOk) {
|
|
66
|
+
field.control!.addValidators(validation.validator!);
|
|
67
|
+
} else {
|
|
68
|
+
field.control!.removeValidators(validation.validator!);
|
|
69
|
+
}
|
|
70
|
+
field.control!.updateValueAndValidity({emitEvent: false});
|
|
71
|
+
}
|
|
72
|
+
*/
|
|
73
|
+
checkDisplayConditions(displayConditions, dynamicFormDatas) {
|
|
74
|
+
for (const cond of displayConditions) {
|
|
75
|
+
const fieldPath = dynamicFormDatas.idPathMap.get(cond.fieldId);
|
|
76
|
+
console.log(fieldPath);
|
|
77
|
+
/*
|
|
78
|
+
if (isArray(fieldPath)) {
|
|
79
|
+
for (let instance of fieldPath) {
|
|
80
|
+
const field = pathFieldMap.get(instance.path);
|
|
81
|
+
if (field) {
|
|
82
|
+
const isConditionKo = !this.checkCondition(cond.condition, pathFieldMap, idPathMap, instance.arrayCode, instance.arrayInstance);
|
|
83
|
+
this.setHidden(field, isConditionKo);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} else if (fieldPath) {
|
|
87
|
+
const field = pathFieldMap.get(fieldPath);
|
|
88
|
+
if (field) {
|
|
89
|
+
const isConditionKo = !this.checkCondition(cond.condition, pathFieldMap, idPathMap, null, null);
|
|
90
|
+
this.setHidden(field, isConditionKo);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
*/
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ConditionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
98
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ConditionsService, providedIn: 'root' });
|
|
99
|
+
}
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ConditionsService, decorators: [{
|
|
101
|
+
type: Injectable,
|
|
102
|
+
args: [{
|
|
103
|
+
providedIn: 'root'
|
|
104
|
+
}]
|
|
105
|
+
}], ctorParameters: () => [] });
|
|
106
|
+
|
|
107
|
+
class DynamicFormService {
|
|
108
|
+
fb = inject(FormBuilder);
|
|
109
|
+
conditionsService = inject(ConditionsService);
|
|
110
|
+
destroyRef = inject(DestroyRef);
|
|
111
|
+
separator = ".";
|
|
112
|
+
data;
|
|
113
|
+
form;
|
|
114
|
+
displayConditions = [];
|
|
115
|
+
validationConditions = [];
|
|
116
|
+
createForm(fields, validations, updateOn, initialValues) {
|
|
117
|
+
this.data = {
|
|
118
|
+
fields,
|
|
119
|
+
updateOn,
|
|
120
|
+
idPathMap: new Map(),
|
|
121
|
+
pathFieldConfigMap: new Map(),
|
|
122
|
+
pathControlMap: new Map(),
|
|
123
|
+
};
|
|
124
|
+
this.form = this.createGroup(fields, null, initialValues);
|
|
125
|
+
if (validations) {
|
|
126
|
+
for (const valid of validations) {
|
|
127
|
+
if (valid.validator) {
|
|
128
|
+
this.form.addValidators(valid.validator);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
this.setCondition();
|
|
133
|
+
}
|
|
134
|
+
createFormStepper(steps, validations, updateOn, initialValues) {
|
|
135
|
+
this.data = {
|
|
136
|
+
fields: steps,
|
|
137
|
+
updateOn,
|
|
138
|
+
idPathMap: new Map(),
|
|
139
|
+
pathFieldConfigMap: new Map(),
|
|
140
|
+
pathControlMap: new Map(),
|
|
141
|
+
};
|
|
142
|
+
const config = updateOn ? { updateOn } : { updateOn: "change" };
|
|
143
|
+
this.form = this.fb.group({}, config);
|
|
144
|
+
steps.forEach((step) => {
|
|
145
|
+
this.form.addControl(step.name, this.createGroup(step.fields, null, initialValues));
|
|
146
|
+
});
|
|
147
|
+
if (validations) {
|
|
148
|
+
for (const valid of validations) {
|
|
149
|
+
if (valid.validator) {
|
|
150
|
+
this.form.addValidators(valid.validator);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
this.setCondition();
|
|
155
|
+
}
|
|
156
|
+
setCondition() {
|
|
157
|
+
if (this.displayConditions.length > 0 || this.validationConditions.length > 0) {
|
|
158
|
+
this.conditionsService.checkDisplayConditions(this.displayConditions, this.data);
|
|
159
|
+
this.conditionsService.checkValidationConditions(this.validationConditions, this.data);
|
|
160
|
+
this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
161
|
+
if (this.displayConditions.length > 0) {
|
|
162
|
+
this.conditionsService.checkDisplayConditions(this.displayConditions, this.data);
|
|
163
|
+
}
|
|
164
|
+
if (this.validationConditions.length > 0) {
|
|
165
|
+
this.conditionsService.checkValidationConditions(this.validationConditions, this.data);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
createGroup(fields, parentPath, initialValues) {
|
|
171
|
+
const config = { updateOn: this.data?.updateOn ?? "change" };
|
|
172
|
+
const group = this.fb.group({}, config);
|
|
173
|
+
fields.forEach((config) => {
|
|
174
|
+
this.treatField(config, group, parentPath, initialValues);
|
|
175
|
+
});
|
|
176
|
+
return group;
|
|
177
|
+
}
|
|
178
|
+
treatField(config, group, parentPath, initialValues) {
|
|
179
|
+
const path = (parentPath ? parentPath + this.separator : "") + config.name;
|
|
180
|
+
if (!config.id) {
|
|
181
|
+
config.id = config.name;
|
|
182
|
+
}
|
|
183
|
+
if (config.displayCondition) {
|
|
184
|
+
this.displayConditions.push({
|
|
185
|
+
fieldId: config.id,
|
|
186
|
+
condition: config.displayCondition
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (config.type !== "text" && config.type !== "row" && config.type !== "tabs" && config.validations) {
|
|
190
|
+
config.validations.forEach(val => {
|
|
191
|
+
if (val.condition) {
|
|
192
|
+
this.validationConditions.push({
|
|
193
|
+
fieldId: config.id,
|
|
194
|
+
validation: val
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (config.type === "text") {
|
|
200
|
+
this.setFormFieldMapItem(path, config, null);
|
|
201
|
+
}
|
|
202
|
+
else if (config.type === "group") {
|
|
203
|
+
group.addControl(config.name, this.createGroupField(config, parentPath, initialValues));
|
|
204
|
+
}
|
|
205
|
+
else if (config.type === "array") {
|
|
206
|
+
group.addControl(config.name, this.createArray(config, parentPath, initialValues));
|
|
207
|
+
}
|
|
208
|
+
else if (config.type === "row") {
|
|
209
|
+
this.setFormFieldMapItem(path, config, null);
|
|
210
|
+
config.fields.forEach((child) => {
|
|
211
|
+
this.treatField(child, group, parentPath, initialValues);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
else if (config.type === "tabs") {
|
|
215
|
+
const control = this.createGroup(config.tabs.map((x) => x.field), parentPath, initialValues ? initialValues[config.name] : null);
|
|
216
|
+
group.addControl(config.name, control);
|
|
217
|
+
this.setFormFieldMapItem(path, config, control);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
const control = this.createControl(config, initialValues);
|
|
221
|
+
this.setFormFieldMapItem(path, config, control);
|
|
222
|
+
group.addControl(config.name, control);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
createGroupField(groupConfig, parentPath, initialValues) {
|
|
226
|
+
const path = (parentPath ? parentPath + this.separator : "") + groupConfig.name;
|
|
227
|
+
const g = this.createGroup(groupConfig.fields, path, initialValues ? initialValues[groupConfig.name] : null);
|
|
228
|
+
if (groupConfig.validations) {
|
|
229
|
+
const val = groupConfig.validations.filter((x) => x.validator).map((x) => x.validator);
|
|
230
|
+
if (val) {
|
|
231
|
+
// @ts-ignore
|
|
232
|
+
g.addValidators(val);
|
|
233
|
+
}
|
|
234
|
+
const asyncVal = groupConfig.validations.filter((x) => x.asyncValidator).map((x) => x.asyncValidator);
|
|
235
|
+
if (asyncVal) {
|
|
236
|
+
// @ts-ignore
|
|
237
|
+
g.addAsyncValidators(asyncVal);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
this.setFormFieldMapItem(path, groupConfig, g);
|
|
241
|
+
return g;
|
|
242
|
+
}
|
|
243
|
+
createArrayInstance(arrayConfig, arrayPath, instanceNumber, initialValues) {
|
|
244
|
+
const fields = _.cloneDeep(arrayConfig.field.fields);
|
|
245
|
+
const grp = this.createGroup(fields, `${arrayPath}[${instanceNumber}]`, initialValues);
|
|
246
|
+
if (!arrayConfig.instances) {
|
|
247
|
+
arrayConfig.instances = [];
|
|
248
|
+
}
|
|
249
|
+
arrayConfig.instances.push({
|
|
250
|
+
number: instanceNumber,
|
|
251
|
+
group: grp,
|
|
252
|
+
fields,
|
|
253
|
+
});
|
|
254
|
+
return grp;
|
|
255
|
+
}
|
|
256
|
+
createArray(arrayConfig, parentPath, initialValues) {
|
|
257
|
+
const path = (parentPath ? parentPath + this.separator : "") + arrayConfig.name;
|
|
258
|
+
arrayConfig.instances = [];
|
|
259
|
+
const list = [];
|
|
260
|
+
let value = arrayConfig.value;
|
|
261
|
+
if (initialValues && Object.keys(initialValues).indexOf(arrayConfig.name) !== -1) {
|
|
262
|
+
value = initialValues[arrayConfig.name];
|
|
263
|
+
}
|
|
264
|
+
let i = 0;
|
|
265
|
+
if (value) {
|
|
266
|
+
for (const item of value) {
|
|
267
|
+
list.push(this.createArrayInstance(arrayConfig, path, i, item));
|
|
268
|
+
i++;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (arrayConfig.minNbRow && arrayConfig.minNbRow > list.length) {
|
|
272
|
+
while (arrayConfig.minNbRow > list.length) {
|
|
273
|
+
list.push(this.createArrayInstance(arrayConfig, path, i, null));
|
|
274
|
+
i++;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const formArray = this.fb.array(list);
|
|
278
|
+
if (arrayConfig.validations) {
|
|
279
|
+
const val = arrayConfig.validations.filter((x) => x.validator).map((x) => x.validator);
|
|
280
|
+
if (val) {
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
formArray.addValidators(val);
|
|
283
|
+
}
|
|
284
|
+
const asyncVal = arrayConfig.validations.filter((x) => x.asyncValidator).map((x) => x.asyncValidator);
|
|
285
|
+
if (asyncVal) {
|
|
286
|
+
// @ts-ignore
|
|
287
|
+
formArray.addAsyncValidators(asyncVal);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
this.setFormFieldMapItem(path, arrayConfig, formArray);
|
|
291
|
+
return formArray;
|
|
292
|
+
}
|
|
293
|
+
setFormFieldMapItem(path, config, control) {
|
|
294
|
+
if (control) {
|
|
295
|
+
this.data.pathControlMap.set(path, control);
|
|
296
|
+
}
|
|
297
|
+
this.data.pathFieldConfigMap.set(path, config);
|
|
298
|
+
if (!this.data.idPathMap.get(config.id)) {
|
|
299
|
+
this.data.idPathMap.set(config.id, []);
|
|
300
|
+
}
|
|
301
|
+
this.data.idPathMap.get(config.id)?.push(path);
|
|
302
|
+
}
|
|
303
|
+
createControl(config, initialValues) {
|
|
304
|
+
let { disabled, validations, value } = config;
|
|
305
|
+
if (initialValues && Object.keys(initialValues).indexOf(config.name) !== -1) {
|
|
306
|
+
value = initialValues[config.name];
|
|
307
|
+
}
|
|
308
|
+
if (value === undefined) {
|
|
309
|
+
value = null;
|
|
310
|
+
}
|
|
311
|
+
const control = this.fb.control({ disabled, value });
|
|
312
|
+
if (validations) {
|
|
313
|
+
const val = validations.filter((x) => x.validator).map((x) => x.validator);
|
|
314
|
+
if (val) {
|
|
315
|
+
// @ts-ignore
|
|
316
|
+
control.addValidators(val);
|
|
317
|
+
}
|
|
318
|
+
const asyncVal = validations.filter((x) => x.asyncValidator).map((x) => x.asyncValidator);
|
|
319
|
+
if (asyncVal) {
|
|
320
|
+
// @ts-ignore
|
|
321
|
+
control.addAsyncValidators(asyncVal);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return control;
|
|
325
|
+
}
|
|
326
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DynamicFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
327
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DynamicFormService, providedIn: null });
|
|
328
|
+
}
|
|
329
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DynamicFormService, decorators: [{
|
|
330
|
+
type: Injectable,
|
|
331
|
+
args: [{
|
|
332
|
+
providedIn: null
|
|
333
|
+
}]
|
|
334
|
+
}] });
|
|
335
|
+
|
|
336
|
+
class AbstractFieldComponent {
|
|
337
|
+
path;
|
|
338
|
+
field;
|
|
339
|
+
group;
|
|
340
|
+
instancePath;
|
|
341
|
+
dynamicFormService = inject(DynamicFormService);
|
|
342
|
+
get control() {
|
|
343
|
+
return this.group && this.field && this.field.name ? this.group.get(this.field.name) : null;
|
|
344
|
+
}
|
|
345
|
+
get required() {
|
|
346
|
+
return this.group.get(this.field.name)?.hasValidator(Validators.required);
|
|
347
|
+
}
|
|
348
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AbstractFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
349
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: AbstractFieldComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
350
|
+
}
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AbstractFieldComponent, decorators: [{
|
|
352
|
+
type: Component,
|
|
353
|
+
args: [{ standalone: true, template: '' }]
|
|
354
|
+
}] });
|
|
355
|
+
|
|
356
|
+
class AbstractControlFieldComponent extends AbstractFieldComponent {
|
|
357
|
+
destroyRef = inject(DestroyRef);
|
|
358
|
+
uuid;
|
|
359
|
+
ngOnInit() {
|
|
360
|
+
this.uuid = 'sot-field-' + this.field.name + '-' + (Math.random() + 1).toString(36).substring(7);
|
|
361
|
+
if (this.field.onValueChanges) {
|
|
362
|
+
const control = this.group.get(this.field.name);
|
|
363
|
+
if (control) {
|
|
364
|
+
this.field.onValueChanges(control.value, this.dynamicFormService.data, this.group, this.instancePath);
|
|
365
|
+
control.valueChanges.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
366
|
+
this.field.onValueChanges(value, this.dynamicFormService.data, this.group, this.instancePath);
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AbstractControlFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
372
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: AbstractControlFieldComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
373
|
+
}
|
|
374
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AbstractControlFieldComponent, decorators: [{
|
|
375
|
+
type: Component,
|
|
376
|
+
args: [{ standalone: true, template: '' }]
|
|
377
|
+
}] });
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Liste des valeurs possible pour l'attribut autocomplete
|
|
381
|
+
* (https://accessibilite.numerique.gouv.fr/methode/glossaire/#liste-des-valeurs-possibles-pour-l-attribut-autocomplete)
|
|
382
|
+
*/
|
|
383
|
+
var AutocompleteAttribute;
|
|
384
|
+
(function (AutocompleteAttribute) {
|
|
385
|
+
AutocompleteAttribute["Off"] = "off";
|
|
386
|
+
/** Nom complet */
|
|
387
|
+
AutocompleteAttribute["Name"] = "name";
|
|
388
|
+
/** Abréviation, civilité ou titre */
|
|
389
|
+
AutocompleteAttribute["HonorificPrefix"] = "honorific-prefix";
|
|
390
|
+
/** Prénom */
|
|
391
|
+
AutocompleteAttribute["GivenName"] = "given-name";
|
|
392
|
+
/** Prénoms additionnels */
|
|
393
|
+
AutocompleteAttribute["AdditionalName"] = "additional-name";
|
|
394
|
+
/** Nom de famille */
|
|
395
|
+
AutocompleteAttribute["FamilyName"] = "family-name";
|
|
396
|
+
/** Suffixe honorifique */
|
|
397
|
+
AutocompleteAttribute["HonorificSuffix"] = "honorific-suffix";
|
|
398
|
+
/** Surnom, diminutif */
|
|
399
|
+
AutocompleteAttribute["Nickname"] = "nickname";
|
|
400
|
+
/** Fonction, intitulé de poste */
|
|
401
|
+
AutocompleteAttribute["OrganizationTitle"] = "organization-title";
|
|
402
|
+
/** Nom d’utilisateur */
|
|
403
|
+
AutocompleteAttribute["Username"] = "username";
|
|
404
|
+
/**
|
|
405
|
+
* Nouveau mot de passe (par exemple, lors de la création d’un compte
|
|
406
|
+
* ou d’un changement de mot de passe)
|
|
407
|
+
*/
|
|
408
|
+
AutocompleteAttribute["NewPassword"] = "new-password";
|
|
409
|
+
/**
|
|
410
|
+
* Mot de passe actuel pour le compte identifié par le champ username
|
|
411
|
+
* (par exemple, lors d’une connexion)
|
|
412
|
+
*/
|
|
413
|
+
AutocompleteAttribute["CurrentPassword"] = "current-password";
|
|
414
|
+
/**
|
|
415
|
+
* Nom de l’organisation correspondant à la personne, à l’adresse
|
|
416
|
+
* ou à l’information de contact dans les autres champs associés avec ce champ
|
|
417
|
+
*/
|
|
418
|
+
AutocompleteAttribute["Organization"] = "organization";
|
|
419
|
+
/** Adresse postale (multiligne, nouvelles lignes conservées) */
|
|
420
|
+
AutocompleteAttribute["StreetAddress"] = "street-address";
|
|
421
|
+
/** Adresse postale (une ligne par champ, ligne 1) */
|
|
422
|
+
AutocompleteAttribute["AddressLine1"] = "address-line1";
|
|
423
|
+
/** Adresse postale (une ligne par champ, ligne 2) */
|
|
424
|
+
AutocompleteAttribute["AddressLine2"] = "address-line2";
|
|
425
|
+
/** Adresse postale (une ligne par champ, ligne 3) */
|
|
426
|
+
AutocompleteAttribute["AddressLine3"] = "address-line3";
|
|
427
|
+
/** Le niveau administratif le plus détaillé, pour les adresses pourvues de quatre niveaux administratifs */
|
|
428
|
+
AutocompleteAttribute["AddressLevel4"] = "address-level4";
|
|
429
|
+
/** Le troisième niveau administratif, pour les adresses pourvues d’au moins trois niveaux administratifs */
|
|
430
|
+
AutocompleteAttribute["AddressLevel3"] = "address-level3";
|
|
431
|
+
/** Le deuxième niveau administratif, pour les adresses pourvues d’au moins deux niveaux administratifs */
|
|
432
|
+
AutocompleteAttribute["AddressLevel2"] = "address-level2";
|
|
433
|
+
/** Le plus large niveau administratif d’une adresse, c’est-à-dire la province dans laquelle se trouve la localité */
|
|
434
|
+
AutocompleteAttribute["AddressLevel1"] = "address-level1";
|
|
435
|
+
/** Code pays */
|
|
436
|
+
AutocompleteAttribute["Country"] = "country";
|
|
437
|
+
/** Nom de pays */
|
|
438
|
+
AutocompleteAttribute["CountryName"] = "country-name";
|
|
439
|
+
/**
|
|
440
|
+
* Code postal, code CEDEX (si le CEDEX est présent, ajouter “CEDEX”,
|
|
441
|
+
* et ce qui le suit doit être ajouté dans le champ address-level2)
|
|
442
|
+
*/
|
|
443
|
+
AutocompleteAttribute["PostalCode"] = "postal-code";
|
|
444
|
+
/** Nom complet figurant sur le moyen de paiement */
|
|
445
|
+
AutocompleteAttribute["CcName"] = "cc-name";
|
|
446
|
+
/** Prénom figurant sur le moyen de paiement */
|
|
447
|
+
AutocompleteAttribute["CcGivenName"] = "cc-given-name";
|
|
448
|
+
/** Prénoms additionnels figurant sur le moyen de paiement */
|
|
449
|
+
AutocompleteAttribute["CcAdditionalName"] = "cc-additional-name";
|
|
450
|
+
/** Nom de famille figurant sur le moyen de paiement */
|
|
451
|
+
AutocompleteAttribute["CcFamilyName"] = "cc-family-name";
|
|
452
|
+
/** Code identifiant le moyen de paiement (e.g., un numéro de carte bancaire) */
|
|
453
|
+
AutocompleteAttribute["CcNumber"] = "cc-number";
|
|
454
|
+
/** Date d’expiration du moyen de paiement */
|
|
455
|
+
AutocompleteAttribute["CcExp"] = "cc-exp";
|
|
456
|
+
/** Le mois de la date d’expiration du moyen de paiement */
|
|
457
|
+
AutocompleteAttribute["CcExpMonth"] = "cc-exp-month";
|
|
458
|
+
/** L’année de la date d’expiration du moyen de paiement */
|
|
459
|
+
AutocompleteAttribute["CcExpYear"] = "cc-exp-year";
|
|
460
|
+
/**
|
|
461
|
+
* Code de sécurité du moyen de paiement (also known as the card security code (CSC),
|
|
462
|
+
* card validation code (CVC), card verification value (CVV), signature panel code (SPC),
|
|
463
|
+
* credit card ID (CCID), etc.)
|
|
464
|
+
*/
|
|
465
|
+
AutocompleteAttribute["CcCsc"] = "cc-csc";
|
|
466
|
+
/** Type de moyen de paiement (e.g. Visa) */
|
|
467
|
+
AutocompleteAttribute["CcType"] = "cc-type";
|
|
468
|
+
/** La devise qui a la préférence de l’utilisateur lors d’une transaction */
|
|
469
|
+
AutocompleteAttribute["TransactionCurrency"] = "transaction-currency";
|
|
470
|
+
/** Le montant qui a la préférence de l’utilisateur lors d’une transaction (e.g., en réponse à une enchère ou à un prix soldé) */
|
|
471
|
+
AutocompleteAttribute["TransactionAmount"] = "transaction-amount";
|
|
472
|
+
/** Langue préférée */
|
|
473
|
+
AutocompleteAttribute["Language"] = "language";
|
|
474
|
+
/** Date d’anniversaire */
|
|
475
|
+
AutocompleteAttribute["Bday"] = "bday";
|
|
476
|
+
/** Le jour de la date d’anniversaire */
|
|
477
|
+
AutocompleteAttribute["BdayDay"] = "bday-day";
|
|
478
|
+
/** Le mois de la date d’anniversaire */
|
|
479
|
+
AutocompleteAttribute["BdayMonth"] = "bday-month";
|
|
480
|
+
/** L’année de la date d’anniversaire */
|
|
481
|
+
AutocompleteAttribute["BdayYear"] = "bday-year";
|
|
482
|
+
/** Identité de genre */
|
|
483
|
+
AutocompleteAttribute["Sex"] = "sex";
|
|
484
|
+
/**
|
|
485
|
+
* Page d’accueil ou une autre page Web correspondant à l’organisation, la personne,
|
|
486
|
+
* l’adresse ou à l’information de contact dans les autres champs associés avec ce champ
|
|
487
|
+
*/
|
|
488
|
+
AutocompleteAttribute["Url"] = "url";
|
|
489
|
+
/**
|
|
490
|
+
* Photographie, icône ou une autre image correspondant à l’organisation, la personne,
|
|
491
|
+
* l’adresse ou à l’information de contact dans les autres champs associés avec ce champ
|
|
492
|
+
*/
|
|
493
|
+
AutocompleteAttribute["Photo"] = "photo";
|
|
494
|
+
/** Numéro de téléphone complet, y compris le code pays */
|
|
495
|
+
AutocompleteAttribute["Tel"] = "tel";
|
|
496
|
+
/** Code pays du numéro de téléphone */
|
|
497
|
+
AutocompleteAttribute["TelCountryCode"] = "tel-country-code";
|
|
498
|
+
/** Numéro de téléphone sans la partie code pays, avec un préfixe interne au pays, s’il y a lieu */
|
|
499
|
+
AutocompleteAttribute["TelNational"] = "tel-national";
|
|
500
|
+
/** Indicatif régional du numéro de téléphone, avec un préfixe interne au pays, s’il y a lieu */
|
|
501
|
+
AutocompleteAttribute["TelAreaCode"] = "tel-area-code";
|
|
502
|
+
/** Numéro de téléphone sans la partie code pays ni l’indicatif régional */
|
|
503
|
+
AutocompleteAttribute["TelLocal"] = "tel-local";
|
|
504
|
+
/**
|
|
505
|
+
* La première partie du composant du numéro de téléphone qui suit l’indicatif régional,
|
|
506
|
+
* lorsque ce composant est scindé en deux parties
|
|
507
|
+
*/
|
|
508
|
+
AutocompleteAttribute["TelLocalPrefix"] = "tel-local-prefix";
|
|
509
|
+
/**
|
|
510
|
+
* La seconde partie du composant du numéro de téléphone qui suit l’indicatif régional,
|
|
511
|
+
* lorsque ce composant est scindé en deux parties
|
|
512
|
+
*/
|
|
513
|
+
AutocompleteAttribute["TelLocalSuffix"] = "tel-local-suffix";
|
|
514
|
+
/** Numéro de téléphone d’un poste interne */
|
|
515
|
+
AutocompleteAttribute["TelExtension"] = "tel-extension";
|
|
516
|
+
/** Adresse électronique */
|
|
517
|
+
AutocompleteAttribute["Email"] = "email";
|
|
518
|
+
/**
|
|
519
|
+
* URL correspondant d’un protocole de messagerie instantanée
|
|
520
|
+
* (par exemple, "aim:goim?screenname=example" ou "xmpp:fred@example.net")
|
|
521
|
+
*/
|
|
522
|
+
AutocompleteAttribute["Impp"] = "impp";
|
|
523
|
+
})(AutocompleteAttribute || (AutocompleteAttribute = {}));
|
|
524
|
+
|
|
525
|
+
let AcDivTextComponent$2 = class AcDivTextComponent extends AbstractFieldComponent {
|
|
526
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDivTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
527
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcDivTextComponent, isStandalone: true, selector: "sot-div-text", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-text\" [ngClass]=\"field.className\">\n <div [innerHTML]=\"field.label\"></div>\n @if(field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
528
|
+
};
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDivTextComponent$2, decorators: [{
|
|
530
|
+
type: Component,
|
|
531
|
+
args: [{ selector: 'sot-div-text', standalone: true, imports: [NgClass], template: "<div class=\"sot-formfield sot-formfield-text\" [ngClass]=\"field.className\">\n <div [innerHTML]=\"field.label\"></div>\n @if(field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n</div>\n" }]
|
|
532
|
+
}] });
|
|
533
|
+
|
|
534
|
+
let AcFieldCheckboxComponent$2 = class AcFieldCheckboxComponent extends AbstractControlFieldComponent {
|
|
535
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
536
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldCheckboxComponent, isStandalone: true, selector: "sot-field-checkbox", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-checkbox\" [ngClass]=\"field.className\">\r\n <div [formGroup]=\"group\">\r\n <mat-checkbox [formControlName]=\"field.name\"\r\n [id]=\"uuid\"\r\n [aria-describedby]=\"'error-' + uuid\"\r\n >\r\n <div [ngClass]=\"field.labelClassName\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </div>\r\n </mat-checkbox>\r\n\r\n <div [attr.id]=\"'error-' + uuid\" class=\"error-wrapper\" matError>\r\n @if (control && !control.untouched && control.invalid) {\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".error-wrapper{padding:0 16px;font-size:var(--mat-form-field-subscript-text-size, var(--mat-sys-body-small-size));color:var(--mat-form-field-error-text-color, var(--mat-sys-error));line-height:var(--mat-form-field-subscript-text-line-height, var(--mat-app-body-small-line-height))}\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],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }] });
|
|
537
|
+
};
|
|
538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldCheckboxComponent$2, decorators: [{
|
|
539
|
+
type: Component,
|
|
540
|
+
args: [{ selector: 'sot-field-checkbox', standalone: true, imports: [ReactiveFormsModule, NgClass, MatCheckboxModule, MatError], template: "<div class=\"sot-formfield sot-formfield-checkbox\" [ngClass]=\"field.className\">\r\n <div [formGroup]=\"group\">\r\n <mat-checkbox [formControlName]=\"field.name\"\r\n [id]=\"uuid\"\r\n [aria-describedby]=\"'error-' + uuid\"\r\n >\r\n <div [ngClass]=\"field.labelClassName\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </div>\r\n </mat-checkbox>\r\n\r\n <div [attr.id]=\"'error-' + uuid\" class=\"error-wrapper\" matError>\r\n @if (control && !control.untouched && control.invalid) {\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".error-wrapper{padding:0 16px;font-size:var(--mat-form-field-subscript-text-size, var(--mat-sys-body-small-size));color:var(--mat-form-field-error-text-color, var(--mat-sys-error));line-height:var(--mat-form-field-subscript-text-line-height, var(--mat-app-body-small-line-height))}\n"] }]
|
|
541
|
+
}] });
|
|
542
|
+
|
|
543
|
+
let AcFieldInputComponent$2 = class AcFieldInputComponent extends AbstractControlFieldComponent {
|
|
544
|
+
inputType = 'text';
|
|
545
|
+
buttonAction(b) {
|
|
546
|
+
if (b.action && this.field && this.group) {
|
|
547
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
ngOnInit() {
|
|
551
|
+
super.ngOnInit();
|
|
552
|
+
this.inputType = this.field.inputType ?? 'text';
|
|
553
|
+
const control = this.group.get(this.field.name);
|
|
554
|
+
if (control) {
|
|
555
|
+
control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
556
|
+
if (value?.length == 0) {
|
|
557
|
+
control.setValue(null);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
563
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldInputComponent, isStandalone: true, selector: "sot-field-input", usesInheritance: true, ngImport: i0, template: "<div\r\n class=\"sot-formfield sot-formfield-input\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\"\r\n>\r\n <mat-form-field>\r\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\r\n <input matInput\r\n [id]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [type]=\"inputType\"\r\n [readonly]=\"field.readonly\"\r\n [maxlength]=\"field.maxlength ?? 100000000\"\r\n >\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{prefix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\" matSuffix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{suffix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n @if (field.description) {\r\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\r\n }\r\n\r\n @if (control && !control.untouched && control.invalid) {\r\n <mat-error>\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: MatIconModule }, { 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 }] });
|
|
564
|
+
};
|
|
565
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldInputComponent$2, decorators: [{
|
|
566
|
+
type: Component,
|
|
567
|
+
args: [{ selector: 'sot-field-input', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatIconModule, MatInputModule, MatButtonModule], template: "<div\r\n class=\"sot-formfield sot-formfield-input\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\"\r\n>\r\n <mat-form-field>\r\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\r\n <input matInput\r\n [id]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [type]=\"inputType\"\r\n [readonly]=\"field.readonly\"\r\n [maxlength]=\"field.maxlength ?? 100000000\"\r\n >\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{prefix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\" matSuffix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{suffix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n @if (field.description) {\r\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\r\n }\r\n\r\n @if (control && !control.untouched && control.invalid) {\r\n <mat-error>\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\n"] }]
|
|
568
|
+
}] });
|
|
569
|
+
|
|
570
|
+
let AcGroupComponent$2 = class AcGroupComponent extends AbstractControlFieldComponent {
|
|
571
|
+
get subGroup() {
|
|
572
|
+
return this.group.controls[this.field.name];
|
|
573
|
+
}
|
|
574
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
575
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcGroupComponent, isStandalone: true, selector: "sot-group", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-group\" [ngClass]=\"field.className\">\n <fieldset class=\"sot-formfield\">\n @if (field.accordion) {\n <mat-accordion class=\"sot-formfield-array-accordion\" multi>\n <mat-expansion-panel [expanded]=\"field.opened\">\n <mat-expansion-panel-header>\n <mat-panel-title>\n <legend class=\"sot-formfield-group-label\">{{ field.label }}</legend>\n </mat-panel-title>\n </mat-expansion-panel-header>\n @if (field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </mat-expansion-panel>\n </mat-accordion>\n\n } @else {\n <legend\n class=\"sot-fieldset-legend\"\n [ngClass]=\"field.labelClassName\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </legend>\n <div class=\"sot-fieldset-content\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n @for (f of field.fields; track f.type + f.name) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"subGroup\"\n [instancePath]=\"instancePath\"\n ></ng-container>\n </div>\n }\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-group-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n</ng-template>\n", styles: ["fieldset{border:none;padding:0;margin:0}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective$2), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => MatAccordion), selector: "mat-accordion", inputs: ["hideToggle", "displayMode", "togglePosition"], exportAs: ["matAccordion"] }, { kind: "component", type: i0.forwardRef(() => MatExpansionPanel), selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i0.forwardRef(() => MatExpansionPanelHeader), selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i0.forwardRef(() => MatExpansionPanelTitle), selector: "mat-panel-title" }, { kind: "directive", type: i0.forwardRef(() => NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
576
|
+
};
|
|
577
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcGroupComponent$2, decorators: [{
|
|
578
|
+
type: Component,
|
|
579
|
+
args: [{ selector: 'sot-group', standalone: true, imports: [
|
|
580
|
+
forwardRef(() => AcDynamicFieldDirective$2),
|
|
581
|
+
NgClass,
|
|
582
|
+
MatAccordion,
|
|
583
|
+
MatExpansionPanel,
|
|
584
|
+
MatExpansionPanelHeader,
|
|
585
|
+
MatExpansionPanelTitle,
|
|
586
|
+
NgTemplateOutlet
|
|
587
|
+
], template: "<div class=\"sot-formfield sot-formfield-group\" [ngClass]=\"field.className\">\n <fieldset class=\"sot-formfield\">\n @if (field.accordion) {\n <mat-accordion class=\"sot-formfield-array-accordion\" multi>\n <mat-expansion-panel [expanded]=\"field.opened\">\n <mat-expansion-panel-header>\n <mat-panel-title>\n <legend class=\"sot-formfield-group-label\">{{ field.label }}</legend>\n </mat-panel-title>\n </mat-expansion-panel-header>\n @if (field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </mat-expansion-panel>\n </mat-accordion>\n\n } @else {\n <legend\n class=\"sot-fieldset-legend\"\n [ngClass]=\"field.labelClassName\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </legend>\n <div class=\"sot-fieldset-content\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n @for (f of field.fields; track f.type + f.name) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"subGroup\"\n [instancePath]=\"instancePath\"\n ></ng-container>\n </div>\n }\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-group-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n</ng-template>\n", styles: ["fieldset{border:none;padding:0;margin:0}\n"] }]
|
|
588
|
+
}] });
|
|
589
|
+
|
|
590
|
+
let AcArrayComponent$2 = class AcArrayComponent extends AbstractControlFieldComponent {
|
|
591
|
+
dynamicService = inject(DynamicFormService);
|
|
592
|
+
ref = inject(ChangeDetectorRef);
|
|
593
|
+
get array() {
|
|
594
|
+
return this.group.controls[this.field.name];
|
|
595
|
+
}
|
|
596
|
+
constructor() {
|
|
597
|
+
super();
|
|
598
|
+
}
|
|
599
|
+
addItem() {
|
|
600
|
+
const i = this.field.instances.length > 0 ? this.field.instances[this.field.instances.length - 1].number + 1 : 0;
|
|
601
|
+
const fields = _.cloneDeep(this.field.field.fields);
|
|
602
|
+
const grp = this.dynamicService.createGroup(fields, `${this.path}[${i}]`, null);
|
|
603
|
+
this.field.instances.push({
|
|
604
|
+
number: i,
|
|
605
|
+
group: grp,
|
|
606
|
+
fields
|
|
607
|
+
});
|
|
608
|
+
this.array.push(grp);
|
|
609
|
+
this.ref.detectChanges();
|
|
610
|
+
}
|
|
611
|
+
deleteItem(index, inst) {
|
|
612
|
+
/*
|
|
613
|
+
TODO
|
|
614
|
+
this.field.instances!.splice(index, 1);
|
|
615
|
+
for (const key of this.dynamicService.pathFieldMap.keys()) {
|
|
616
|
+
if (key.startsWith(`${this.path}[${inst.number}]`)) {
|
|
617
|
+
this.dynamicFormService.pathFieldMap.delete(key);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
*/
|
|
622
|
+
this.array.removeAt(index);
|
|
623
|
+
this.ref.detectChanges();
|
|
624
|
+
}
|
|
625
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcArrayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
626
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcArrayComponent, isStandalone: true, selector: "sot-array", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-array\" [ngClass]=\"field.className\">\n <fieldset class=\"sot-formfield-wrapper sot-fieldset\">\n @if (field.accordion) {\n <mat-accordion class=\"sot-formfield-array-accordion\" multi>\n <mat-expansion-panel [expanded]=\"field.opened\">\n <mat-expansion-panel-header>\n <mat-panel-title>\n <legend class=\"sot-formfield-array-label\">{{ field.label }}</legend>\n </mat-panel-title>\n </mat-expansion-panel-header>\n @if (field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </mat-expansion-panel>\n </mat-accordion>\n } @else {\n <legend class=\"sot-formfield-array-label\">{{ field.label }}</legend>\n @if (field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n <div class=\"sot-formfield-array-content\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"sot-formfield-array\" [formGroup]=\"group\">\n <div [formArrayName]=\"field.name\">\n @for (inst of field.instances; track inst; let i = $index) {\n <fieldset class=\"sot-formfield-array-element\"\n [ngClass]=\"field.elementClassName\">\n <legend class=\"sot-formfield-array-element-label\">\n {{ field.itemLabel ?? 'Item' }} {{ inst.number + 1 }}\n </legend>\n <div class=\"sot-formfield-array-element-content\"\n [ngClass]=\"field.elementContentClassName\">\n @for (f of inst.fields; track f.name + f.type) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"inst.group\"\n [instancePath]=\"path + '[' + inst.number + ']'\"\n ></ng-container>\n </div>\n }\n </div>\n <div class=\"sot-formfield-array-element-action\">\n @if (!field.disabled && (!field.minNbRow || field.minNbRow < array.controls.length)) {\n <button type=\"button\" mat-raised-button (click)=\"deleteItem(i, inst)\">\n @if (field.deleteButton && field.deleteButton.matIcon) {\n <mat-icon [title]=\"field.deleteButton!.title ? field.deleteButton!.title : ''\">\n {{ field.deleteButton!.matIcon }}\n </mat-icon>\n }\n {{ field.deleteButton ? field.deleteButton.label : 'Supprimer' }}\n </button>\n }\n </div>\n </fieldset>\n }\n @if (!field.disabled && (!field.maxNbRow || field.maxNbRow > array.controls.length)) {\n <div class=\"sot-formfield-array-add-button\">\n <button mat-raised-button\n color=\"primary\"\n type=\"button\"\n (click)=\"addItem()\"\n >\n @if (field.addButton && field.addButton.matIcon) {\n <mat-icon [title]=\"field.addButton!.title ? field.addButton!.title : ''\">\n {{ field.addButton!.matIcon }}\n </mat-icon>\n }\n {{ field.addButton ? field.addButton.label : 'Ajouter' }}\n </button>\n </div>\n }\n <mat-error>\n @for (validation of field.validations; track validation) {\n @if (array && !array.untouched && array.hasError(validation.name)) {\n {{ validation.message }}\n }\n }\n </mat-error>\n </div>\n </div>\n</ng-template>\n", styles: ["fieldset.dynamic-field-array{border:none;padding:0;margin:0}.dynamic-field-array-add-button{padding:2rem 0}.dynamic-field-array{margin-bottom:2rem}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective$2), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "ngmodule", type: i0.forwardRef(() => MatExpansionModule) }, { kind: "directive", type: i0.forwardRef(() => i1$1.MatAccordion), selector: "mat-accordion", inputs: ["hideToggle", "displayMode", "togglePosition"], exportAs: ["matAccordion"] }, { kind: "component", type: i0.forwardRef(() => i1$1.MatExpansionPanel), selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i0.forwardRef(() => i1$1.MatExpansionPanelHeader), selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "directive", type: i0.forwardRef(() => i1$1.MatExpansionPanelTitle), selector: "mat-panel-title" }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i0.forwardRef(() => MatIcon), selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i0.forwardRef(() => 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"] }, { kind: "ngmodule", type: i0.forwardRef(() => MatCardModule) }, { kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => i1.NgControlStatusGroup), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i0.forwardRef(() => i1.FormGroupDirective), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i0.forwardRef(() => i1.FormArrayName), selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i0.forwardRef(() => MatError), selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i0.forwardRef(() => NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
627
|
+
};
|
|
628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcArrayComponent$2, decorators: [{
|
|
629
|
+
type: Component,
|
|
630
|
+
args: [{ selector: "sot-array", standalone: true, imports: [
|
|
631
|
+
forwardRef(() => AcDynamicFieldDirective$2),
|
|
632
|
+
MatExpansionModule,
|
|
633
|
+
NgClass,
|
|
634
|
+
MatIcon,
|
|
635
|
+
MatButton,
|
|
636
|
+
MatCardModule,
|
|
637
|
+
ReactiveFormsModule,
|
|
638
|
+
MatError,
|
|
639
|
+
NgTemplateOutlet
|
|
640
|
+
], template: "<div class=\"sot-formfield sot-formfield-array\" [ngClass]=\"field.className\">\n <fieldset class=\"sot-formfield-wrapper sot-fieldset\">\n @if (field.accordion) {\n <mat-accordion class=\"sot-formfield-array-accordion\" multi>\n <mat-expansion-panel [expanded]=\"field.opened\">\n <mat-expansion-panel-header>\n <mat-panel-title>\n <legend class=\"sot-formfield-array-label\">{{ field.label }}</legend>\n </mat-panel-title>\n </mat-expansion-panel-header>\n @if (field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </mat-expansion-panel>\n </mat-accordion>\n } @else {\n <legend class=\"sot-formfield-array-label\">{{ field.label }}</legend>\n @if (field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n <div class=\"sot-formfield-array-content\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"sot-formfield-array\" [formGroup]=\"group\">\n <div [formArrayName]=\"field.name\">\n @for (inst of field.instances; track inst; let i = $index) {\n <fieldset class=\"sot-formfield-array-element\"\n [ngClass]=\"field.elementClassName\">\n <legend class=\"sot-formfield-array-element-label\">\n {{ field.itemLabel ?? 'Item' }} {{ inst.number + 1 }}\n </legend>\n <div class=\"sot-formfield-array-element-content\"\n [ngClass]=\"field.elementContentClassName\">\n @for (f of inst.fields; track f.name + f.type) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"inst.group\"\n [instancePath]=\"path + '[' + inst.number + ']'\"\n ></ng-container>\n </div>\n }\n </div>\n <div class=\"sot-formfield-array-element-action\">\n @if (!field.disabled && (!field.minNbRow || field.minNbRow < array.controls.length)) {\n <button type=\"button\" mat-raised-button (click)=\"deleteItem(i, inst)\">\n @if (field.deleteButton && field.deleteButton.matIcon) {\n <mat-icon [title]=\"field.deleteButton!.title ? field.deleteButton!.title : ''\">\n {{ field.deleteButton!.matIcon }}\n </mat-icon>\n }\n {{ field.deleteButton ? field.deleteButton.label : 'Supprimer' }}\n </button>\n }\n </div>\n </fieldset>\n }\n @if (!field.disabled && (!field.maxNbRow || field.maxNbRow > array.controls.length)) {\n <div class=\"sot-formfield-array-add-button\">\n <button mat-raised-button\n color=\"primary\"\n type=\"button\"\n (click)=\"addItem()\"\n >\n @if (field.addButton && field.addButton.matIcon) {\n <mat-icon [title]=\"field.addButton!.title ? field.addButton!.title : ''\">\n {{ field.addButton!.matIcon }}\n </mat-icon>\n }\n {{ field.addButton ? field.addButton.label : 'Ajouter' }}\n </button>\n </div>\n }\n <mat-error>\n @for (validation of field.validations; track validation) {\n @if (array && !array.untouched && array.hasError(validation.name)) {\n {{ validation.message }}\n }\n }\n </mat-error>\n </div>\n </div>\n</ng-template>\n", styles: ["fieldset.dynamic-field-array{border:none;padding:0;margin:0}.dynamic-field-array-add-button{padding:2rem 0}.dynamic-field-array{margin-bottom:2rem}\n"] }]
|
|
641
|
+
}], ctorParameters: () => [] });
|
|
642
|
+
|
|
643
|
+
let AcRowComponent$2 = class AcRowComponent extends AbstractFieldComponent {
|
|
644
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcRowComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
645
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcRowComponent, isStandalone: true, selector: "sot-row", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-row\" [ngClass]=\"field.className\">\n @for (f of field.fields; track f.type + f.name) {\n <div\n [hidden]=\"f.hidden\"\n [ngClass]=\"f.hostClassName\">\n <ng-container\n sotDynamicField\n [path]=\"path + '.' + f.name\"\n [type]=\"f.type\"\n [field]=\"f\"\n [group]=\"group\"\n [instancePath]=\"instancePath\"\n >\n </ng-container>\n </div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective$2), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }] });
|
|
646
|
+
};
|
|
647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcRowComponent$2, decorators: [{
|
|
648
|
+
type: Component,
|
|
649
|
+
args: [{ selector: 'sot-row', standalone: true, imports: [
|
|
650
|
+
ReactiveFormsModule,
|
|
651
|
+
NgClass,
|
|
652
|
+
forwardRef(() => AcDynamicFieldDirective$2),
|
|
653
|
+
AcDynamicFieldDirective$2
|
|
654
|
+
], template: "<div class=\"sot-formfield sot-formfield-row\" [ngClass]=\"field.className\">\n @for (f of field.fields; track f.type + f.name) {\n <div\n [hidden]=\"f.hidden\"\n [ngClass]=\"f.hostClassName\">\n <ng-container\n sotDynamicField\n [path]=\"path + '.' + f.name\"\n [type]=\"f.type\"\n [field]=\"f\"\n [group]=\"group\"\n [instancePath]=\"instancePath\"\n >\n </ng-container>\n </div>\n }\n</div>\n" }]
|
|
655
|
+
}] });
|
|
656
|
+
|
|
657
|
+
let PasswordValidators$2 = class PasswordValidators {
|
|
658
|
+
static patternValidator(regex, error) {
|
|
659
|
+
return (control) => {
|
|
660
|
+
if (!control.value) {
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
const valid = regex.test(control.value);
|
|
664
|
+
return valid ? null : error;
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
let AcFieldPasswordComponent$2 = class AcFieldPasswordComponent extends AbstractControlFieldComponent {
|
|
670
|
+
inputType = 'password';
|
|
671
|
+
showPasswordLabel;
|
|
672
|
+
hidePasswordLabel;
|
|
673
|
+
iconErrorLabel;
|
|
674
|
+
iconSuccessLabel;
|
|
675
|
+
buttonAction(b) {
|
|
676
|
+
if (b.action && this.field && this.group) {
|
|
677
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
ngOnInit() {
|
|
681
|
+
super.ngOnInit();
|
|
682
|
+
this.showPasswordLabel = this.field.labels?.showPassword ?? "Show password";
|
|
683
|
+
this.hidePasswordLabel = this.field.labels?.hidePassword ?? "Hide password";
|
|
684
|
+
this.iconSuccessLabel = this.field.labels?.iconSuccess ?? "Success";
|
|
685
|
+
this.iconErrorLabel = this.field.labels?.iconError ?? "Error";
|
|
686
|
+
if (this.control) {
|
|
687
|
+
this.control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
688
|
+
if (value?.length == 0) {
|
|
689
|
+
this.control.setValue(null);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
this.setPasswordValidators();
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
tooglePassword() {
|
|
696
|
+
this.inputType = this.inputType === 'password' ? 'text' : 'password';
|
|
697
|
+
}
|
|
698
|
+
get minLengthValid() {
|
|
699
|
+
return this.control.value && !this.control.hasError("minlength");
|
|
700
|
+
}
|
|
701
|
+
get maxLengthValid() {
|
|
702
|
+
return this.control.value && !this.control.hasError("maxlength");
|
|
703
|
+
}
|
|
704
|
+
get requiresDigitValid() {
|
|
705
|
+
return this.control.value && !this.control.hasError("requiresDigit");
|
|
706
|
+
}
|
|
707
|
+
get requiresUppercaseValid() {
|
|
708
|
+
return this.control.value && !this.control.hasError("requiresUppercase");
|
|
709
|
+
}
|
|
710
|
+
get requiresLowercaseValid() {
|
|
711
|
+
return this.control.value && !this.control.hasError("requiresLowercase");
|
|
712
|
+
}
|
|
713
|
+
get requiresSpecialCharsValid() {
|
|
714
|
+
return this.control.value && !this.control.hasError("requiresSpecialChars");
|
|
715
|
+
}
|
|
716
|
+
setPasswordValidators() {
|
|
717
|
+
if (this.field.minlength) {
|
|
718
|
+
this.control?.addValidators(Validators.minLength(this.field.minlength));
|
|
719
|
+
}
|
|
720
|
+
if (this.field.maxlength) {
|
|
721
|
+
this.control?.addValidators(Validators.maxLength(this.field.maxlength));
|
|
722
|
+
}
|
|
723
|
+
if (this.field.requiresDigit) {
|
|
724
|
+
this.control?.addValidators(PasswordValidators$2.patternValidator(/(?=.*[0-9])/, {
|
|
725
|
+
requiresDigit: true
|
|
726
|
+
}));
|
|
727
|
+
}
|
|
728
|
+
if (this.field.requiresUppercase) {
|
|
729
|
+
this.control?.addValidators(PasswordValidators$2.patternValidator(/(?=.*[A-Z])/, {
|
|
730
|
+
requiresUppercase: true
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
733
|
+
if (this.field.requiresLowercase) {
|
|
734
|
+
this.control?.addValidators(PasswordValidators$2.patternValidator(/(?=.*[a-z])/, {
|
|
735
|
+
requiresLowercase: true
|
|
736
|
+
}));
|
|
737
|
+
}
|
|
738
|
+
if (this.field.requiresSpecialChars) {
|
|
739
|
+
const chars = this.field.specialChars?.join("") ?? "$@^!%*?&";
|
|
740
|
+
const regex = "(?=.*[" + chars + "])";
|
|
741
|
+
this.control?.addValidators(PasswordValidators$2.patternValidator(new RegExp(regex), {
|
|
742
|
+
requiresSpecialChars: true
|
|
743
|
+
}));
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldPasswordComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
747
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldPasswordComponent, isStandalone: true, selector: "sot-field-password", usesInheritance: true, ngImport: i0, template: "<div\r\n class=\"sot-formfield sot-formfield-password\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\"\r\n>\r\n <mat-form-field>\r\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\r\n <input matInput\r\n [id]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [type]=\"inputType\"\r\n [aria-describedby]=\"uuid + '-description'\"\r\n >\r\n <button type=\"button\" mat-icon-button matSuffix (click)=\"tooglePassword()\"\r\n [attr.aria-label]=\"inputType === 'password' ? showPasswordLabel : hidePasswordLabel\"\r\n [attr.aria-pressed]=\"inputType === 'password'\">\r\n <mat-icon>{{ inputType === 'password' ? 'visibility_off' : 'visibility' }}</mat-icon>\r\n </button>\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{prefix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\" matSuffix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{suffix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n @if (field.description) {\r\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\r\n }\r\n\r\n @if (control && !control.untouched && control.invalid) {\r\n <mat-error>\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <ul class=\"password-description\" [id]=\"uuid + '-description'\">\r\n @if (field.minlength) {\r\n <li [ngClass]=\"{ 'text-success': minLengthValid, 'text-error': !minLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"minLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.minlength ?? \"Must be at least 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.maxlength) {\r\n <li [ngClass]=\"{ 'text-success': maxLengthValid, 'text-error': !maxLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"maxLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.maxlength ?? \"Must be at most 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.requiresDigit) {\r\n <li [ngClass]=\"{ 'text-success': requiresDigitValid, 'text-error': !requiresDigitValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresDigitValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresDigit ?? \"Must contain at least 1 digit\" }}\r\n </li>\r\n }\r\n @if (field.requiresUppercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresUppercaseValid, 'text-error': !requiresUppercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresUppercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresUppercase ?? \"Must contain at least 1 uppercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresLowercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresLowercaseValid, 'text-error': !requiresLowercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresLowercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresLowercase ?? \"Must contain at least 1 lowercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresSpecialChars) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresSpecialCharsValid, 'text-error': !requiresSpecialCharsValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresSpecialCharsValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresSpecialChars ?? \"Must contain at least 1 special character\" }}\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}.password-description{list-style-type:none;margin-block-start:0}.password-description li{display:flex;flex-direction:row;align-items:center}.password-description li mat-icon{margin-right:.5rem}.password-description li.text-error{color:var(--mat-form-field-error-text-color, var(--mat-app-error))}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: MatIconModule }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }] });
|
|
748
|
+
};
|
|
749
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldPasswordComponent$2, decorators: [{
|
|
750
|
+
type: Component,
|
|
751
|
+
args: [{ selector: 'sot-field-password', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatIconModule, MatInputModule, MatButtonModule], template: "<div\r\n class=\"sot-formfield sot-formfield-password\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\"\r\n>\r\n <mat-form-field>\r\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\r\n <input matInput\r\n [id]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [type]=\"inputType\"\r\n [aria-describedby]=\"uuid + '-description'\"\r\n >\r\n <button type=\"button\" mat-icon-button matSuffix (click)=\"tooglePassword()\"\r\n [attr.aria-label]=\"inputType === 'password' ? showPasswordLabel : hidePasswordLabel\"\r\n [attr.aria-pressed]=\"inputType === 'password'\">\r\n <mat-icon>{{ inputType === 'password' ? 'visibility_off' : 'visibility' }}</mat-icon>\r\n </button>\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{prefix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\" matSuffix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{suffix.label}}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n @if (field.description) {\r\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\r\n }\r\n\r\n @if (control && !control.untouched && control.invalid) {\r\n <mat-error>\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <ul class=\"password-description\" [id]=\"uuid + '-description'\">\r\n @if (field.minlength) {\r\n <li [ngClass]=\"{ 'text-success': minLengthValid, 'text-error': !minLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"minLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.minlength ?? \"Must be at least 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.maxlength) {\r\n <li [ngClass]=\"{ 'text-success': maxLengthValid, 'text-error': !maxLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"maxLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.maxlength ?? \"Must be at most 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.requiresDigit) {\r\n <li [ngClass]=\"{ 'text-success': requiresDigitValid, 'text-error': !requiresDigitValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresDigitValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresDigit ?? \"Must contain at least 1 digit\" }}\r\n </li>\r\n }\r\n @if (field.requiresUppercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresUppercaseValid, 'text-error': !requiresUppercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresUppercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresUppercase ?? \"Must contain at least 1 uppercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresLowercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresLowercaseValid, 'text-error': !requiresLowercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresLowercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresLowercase ?? \"Must contain at least 1 lowercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresSpecialChars) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresSpecialCharsValid, 'text-error': !requiresSpecialCharsValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresSpecialCharsValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresSpecialChars ?? \"Must contain at least 1 special character\" }}\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}.password-description{list-style-type:none;margin-block-start:0}.password-description li{display:flex;flex-direction:row;align-items:center}.password-description li mat-icon{margin-right:.5rem}.password-description li.text-error{color:var(--mat-form-field-error-text-color, var(--mat-app-error))}\n"] }]
|
|
752
|
+
}] });
|
|
753
|
+
|
|
754
|
+
let AcFieldRadioButtonComponent$2 = class AcFieldRadioButtonComponent extends AbstractControlFieldComponent {
|
|
755
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldRadioButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
756
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldRadioButtonComponent, isStandalone: true, selector: "sot-field-radio-button", usesInheritance: true, ngImport: i0, template: "<fieldset\r\n class=\"sot-formfield sot-formfield-radiobutton\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\"\r\n>\r\n <legend [attr.id]=\"'radiobutton-'+uuid\" class=\"sot-formfield-radiobutton-label\">\r\n {{ field.label }} {{ !!required ? '*' : '' }}\r\n @if (field.description) {\r\n <span class=\"radiobutton-description\">{{ field.description }}</span>\r\n }\r\n </legend>\r\n <mat-radio-group class=\"sot-formfield-radiobutton-content\"\r\n [id]=\"uuid\"\r\n [attr.aria-labelledby]=\"'radiobutton-'+uuid\"\r\n [formControlName]=\"field.name\"\r\n [ngClass]=\"{'verticalAlign': field.verticalAlign, 'horizontalAlign': !field.verticalAlign}\"\r\n >\r\n @if (field.options) {\r\n @for (item of field.options; track item) {\r\n <mat-radio-button\r\n class=\"sot-formfield-radiobutton-item\"\r\n [ngClass]=\"field.radioButtonClassName\"\r\n [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n <span class=\"item-label\">{{ field.labelKey ? item[field.labelKey!] : item }}</span>\r\n @if (field.descriptionKey) {\r\n <span class=\"item-description\">{{ item[field.descriptionKey] }}</span>\r\n }\r\n </mat-radio-button>\r\n }\r\n }\r\n </mat-radio-group>\r\n <mat-error>\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n</fieldset>\r\n", styles: [".verticalAlign{display:flex;flex-direction:column}.horizontalAlign{display:flex;flex-direction:row;gap:2rem}.sot-formfield-radiobutton-label{display:flex;flex-direction:column}.sot-formfield-radiobutton-item ::ng-deep label{display:flex;flex-direction:column}\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],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "ngmodule", type: MatIconModule }] });
|
|
757
|
+
};
|
|
758
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldRadioButtonComponent$2, decorators: [{
|
|
759
|
+
type: Component,
|
|
760
|
+
args: [{ selector: 'sot-field-radio-button', standalone: true, imports: [ReactiveFormsModule, NgClass, MatRadioModule, MatError, MatTooltipModule, MatIconModule], template: "<fieldset\r\n class=\"sot-formfield sot-formfield-radiobutton\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\"\r\n>\r\n <legend [attr.id]=\"'radiobutton-'+uuid\" class=\"sot-formfield-radiobutton-label\">\r\n {{ field.label }} {{ !!required ? '*' : '' }}\r\n @if (field.description) {\r\n <span class=\"radiobutton-description\">{{ field.description }}</span>\r\n }\r\n </legend>\r\n <mat-radio-group class=\"sot-formfield-radiobutton-content\"\r\n [id]=\"uuid\"\r\n [attr.aria-labelledby]=\"'radiobutton-'+uuid\"\r\n [formControlName]=\"field.name\"\r\n [ngClass]=\"{'verticalAlign': field.verticalAlign, 'horizontalAlign': !field.verticalAlign}\"\r\n >\r\n @if (field.options) {\r\n @for (item of field.options; track item) {\r\n <mat-radio-button\r\n class=\"sot-formfield-radiobutton-item\"\r\n [ngClass]=\"field.radioButtonClassName\"\r\n [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n <span class=\"item-label\">{{ field.labelKey ? item[field.labelKey!] : item }}</span>\r\n @if (field.descriptionKey) {\r\n <span class=\"item-description\">{{ item[field.descriptionKey] }}</span>\r\n }\r\n </mat-radio-button>\r\n }\r\n }\r\n </mat-radio-group>\r\n <mat-error>\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n</fieldset>\r\n", styles: [".verticalAlign{display:flex;flex-direction:column}.horizontalAlign{display:flex;flex-direction:row;gap:2rem}.sot-formfield-radiobutton-label{display:flex;flex-direction:column}.sot-formfield-radiobutton-item ::ng-deep label{display:flex;flex-direction:column}\n"] }]
|
|
761
|
+
}] });
|
|
762
|
+
|
|
763
|
+
let AcFieldSelectComponent$2 = class AcFieldSelectComponent extends AbstractControlFieldComponent {
|
|
764
|
+
options = [];
|
|
765
|
+
ngOnInit() {
|
|
766
|
+
super.ngOnInit();
|
|
767
|
+
if (isObservable(this.field.options)) {
|
|
768
|
+
this.field.options.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((options) => {
|
|
769
|
+
this.options = options;
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
this.options = this.field.options;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
buttonAction(b) {
|
|
777
|
+
if (b.action && this.field && this.group) {
|
|
778
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
782
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldSelectComponent, isStandalone: true, selector: "sot-field-select", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-select\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\">\r\n <mat-form-field>\r\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\r\n <mat-select\r\n [id]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n panelClass=\"sot-formfield-select-panel\">\r\n @if (field.resetOption) {\r\n <mat-option [value]=\"undefined\">\r\n {{ field.resetOptionLabel }}\r\n </mat-option>\r\n }\r\n @if (field.options) {\r\n @if (field.groupLabelKey) {\r\n @for (group of options; track group) {\r\n <mat-optgroup [label]=\"field.groupLabelKey ? group[field.groupLabelKey] : ''\">\r\n @if (field.groupOptionsKey && group[field.groupOptionsKey]) {\r\n @for (item of group[field.groupOptionsKey]; track item) {\r\n <mat-option [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </mat-option>\r\n }\r\n }\r\n </mat-optgroup>\r\n }\r\n } @else {\r\n @for (item of options; track item) {\r\n <mat-option [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </mat-option>\r\n }\r\n }\r\n }\r\n </mat-select>\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\" matSuffix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @if (field.description) {\r\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\r\n }\r\n <mat-error>\r\n @if (control && !control.untouched && control.invalid) {\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n }\r\n </mat-error>\r\n </mat-form-field>\r\n</div>\r\n", styles: [".sot-formfield-select mat-form-field{width:100%}.sot-formfield-select mat-form-field[hidden]{display:none}::ng-deep .sot-formfield-select-panel .mdc-list-item__primary-text{width:100%}.sot-formfield-select-prefix,.sot-formfield-select-suffix{padding:0 .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],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: MatSelectModule }, { kind: "component", type: i3$2.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$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i3$2.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }] });
|
|
783
|
+
};
|
|
784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldSelectComponent$2, decorators: [{
|
|
785
|
+
type: Component,
|
|
786
|
+
args: [{ selector: 'sot-field-select', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatSelectModule], template: "<div class=\"sot-formfield sot-formfield-select\"\r\n [ngClass]=\"field.className\"\r\n [formGroup]=\"group\">\r\n <mat-form-field>\r\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\r\n <mat-select\r\n [id]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n panelClass=\"sot-formfield-select-panel\">\r\n @if (field.resetOption) {\r\n <mat-option [value]=\"undefined\">\r\n {{ field.resetOptionLabel }}\r\n </mat-option>\r\n }\r\n @if (field.options) {\r\n @if (field.groupLabelKey) {\r\n @for (group of options; track group) {\r\n <mat-optgroup [label]=\"field.groupLabelKey ? group[field.groupLabelKey] : ''\">\r\n @if (field.groupOptionsKey && group[field.groupOptionsKey]) {\r\n @for (item of group[field.groupOptionsKey]; track item) {\r\n <mat-option [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </mat-option>\r\n }\r\n }\r\n </mat-optgroup>\r\n }\r\n } @else {\r\n @for (item of options; track item) {\r\n <mat-option [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </mat-option>\r\n }\r\n }\r\n }\r\n </mat-select>\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\" matSuffix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n @if (field.description) {\r\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\r\n }\r\n <mat-error>\r\n @if (control && !control.untouched && control.invalid) {\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n }\r\n </mat-error>\r\n </mat-form-field>\r\n</div>\r\n", styles: [".sot-formfield-select mat-form-field{width:100%}.sot-formfield-select mat-form-field[hidden]{display:none}::ng-deep .sot-formfield-select-panel .mdc-list-item__primary-text{width:100%}.sot-formfield-select-prefix,.sot-formfield-select-suffix{padding:0 .5rem}\n"] }]
|
|
787
|
+
}] });
|
|
788
|
+
|
|
789
|
+
let AcFieldTextareaComponent$2 = class AcFieldTextareaComponent extends AbstractControlFieldComponent {
|
|
790
|
+
buttonAction(b) {
|
|
791
|
+
if (b.action && this.field && this.group) {
|
|
792
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
796
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldTextareaComponent, isStandalone: true, selector: "sot-field-textarea", usesInheritance: true, ngImport: i0, template: "<div\n class=\"sot-formfield sot-formfield-textarea\"\n [ngClass]=\"field.className\"\n [formGroup]=\"group\"\n>\n <mat-form-field>\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\n <textarea matInput\n [id]=\"uuid\"\n [formControlName]=\"field.name\"\n [readonly]=\"field.readonly\"\n [required]=\"!!required\"\n [rows]=\"field.rows\"\n ></textarea>\n\n @for (b of field.prefixes; track b) {\n <span class=\"sot-formfield-prefix\" matPrefix>\n @if (b.action) {\n <button type=\"button\"\n [attr.aria-label]=\"b.actionAriaLabel\"\n (click)=\"buttonAction(b)\"\n >{{b.label}}</button>\n } @else {\n <span [innerHTML]=\"b.label\"></span>\n }\n </span>\n }\n @for (b of field.suffixes; track b) {\n <span class=\"sot-formfield-suffix\" matSuffix>\n @if (b.action) {\n <button type=\"button\"\n [attr.aria-label]=\"b.actionAriaLabel\"\n (click)=\"buttonAction(b)\"\n >{{b.label}}</button>\n } @else {\n <span [innerHTML]=\"b.label\"></span>\n }\n </span>\n }\n @if (field.description) {\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\n }\n\n @if (control && !control.untouched && control.invalid) {\n <mat-error>\n @for (validation of field.validations; track validation) {\n @if (control.hasError(validation.name)) {\n {{ validation.message }}\n }\n }\n </mat-error>\n }\n </mat-form-field>\n</div>\n", styles: [".sot-formfield-textarea mat-form-field{width:100%}.sot-formfield-textarea mat-form-field[hidden]{display:none}.sot-formfield-textarea .sot-formfield-textarea-prefix,.sot-formfield-textarea .sot-formfield-textarea-suffix{padding:0 .5rem}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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 }] });
|
|
797
|
+
};
|
|
798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldTextareaComponent$2, decorators: [{
|
|
799
|
+
type: Component,
|
|
800
|
+
args: [{ selector: 'sot-field-textarea', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatInputModule, MatButtonModule], template: "<div\n class=\"sot-formfield sot-formfield-textarea\"\n [ngClass]=\"field.className\"\n [formGroup]=\"group\"\n>\n <mat-form-field>\n <mat-label><span [innerHTML]=\"field.label\"></span></mat-label>\n <textarea matInput\n [id]=\"uuid\"\n [formControlName]=\"field.name\"\n [readonly]=\"field.readonly\"\n [required]=\"!!required\"\n [rows]=\"field.rows\"\n ></textarea>\n\n @for (b of field.prefixes; track b) {\n <span class=\"sot-formfield-prefix\" matPrefix>\n @if (b.action) {\n <button type=\"button\"\n [attr.aria-label]=\"b.actionAriaLabel\"\n (click)=\"buttonAction(b)\"\n >{{b.label}}</button>\n } @else {\n <span [innerHTML]=\"b.label\"></span>\n }\n </span>\n }\n @for (b of field.suffixes; track b) {\n <span class=\"sot-formfield-suffix\" matSuffix>\n @if (b.action) {\n <button type=\"button\"\n [attr.aria-label]=\"b.actionAriaLabel\"\n (click)=\"buttonAction(b)\"\n >{{b.label}}</button>\n } @else {\n <span [innerHTML]=\"b.label\"></span>\n }\n </span>\n }\n @if (field.description) {\n <mat-hint align=\"start\"> {{ field.description }}</mat-hint>\n }\n\n @if (control && !control.untouched && control.invalid) {\n <mat-error>\n @for (validation of field.validations; track validation) {\n @if (control.hasError(validation.name)) {\n {{ validation.message }}\n }\n }\n </mat-error>\n }\n </mat-form-field>\n</div>\n", styles: [".sot-formfield-textarea mat-form-field{width:100%}.sot-formfield-textarea mat-form-field[hidden]{display:none}.sot-formfield-textarea .sot-formfield-textarea-prefix,.sot-formfield-textarea .sot-formfield-textarea-suffix{padding:0 .5rem}\n"] }]
|
|
801
|
+
}] });
|
|
802
|
+
|
|
803
|
+
let AcFieldToggleComponent$2 = class AcFieldToggleComponent extends AbstractControlFieldComponent {
|
|
804
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
805
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldToggleComponent, isStandalone: true, selector: "sot-field-toggle", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-toggle\" [ngClass]=\"field.className\">\r\n <div [formGroup]=\"group\">\r\n <mat-slide-toggle\r\n [formControlName]=\"field.name\"\r\n [attr.id]=\"'toggle-' + field.name\"\r\n [labelPosition]=\"field.labelPosition ?? 'after'\"\r\n >\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"red\">*</span>\r\n }\r\n </mat-slide-toggle>\r\n\r\n <div class=\"messages-group\" [attr.id]=\"'toggle-' + field.name + '-error'\" aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p>{{ validation.message }}</p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatCheckboxModule }, { 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"] }] });
|
|
806
|
+
};
|
|
807
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldToggleComponent$2, decorators: [{
|
|
808
|
+
type: Component,
|
|
809
|
+
args: [{ selector: 'sot-field-toggle', standalone: true, imports: [ReactiveFormsModule, NgClass, MatCheckboxModule, MatError, MatSlideToggleModule], template: "<div class=\"sot-formfield sot-formfield-toggle\" [ngClass]=\"field.className\">\r\n <div [formGroup]=\"group\">\r\n <mat-slide-toggle\r\n [formControlName]=\"field.name\"\r\n [attr.id]=\"'toggle-' + field.name\"\r\n [labelPosition]=\"field.labelPosition ?? 'after'\"\r\n >\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"red\">*</span>\r\n }\r\n </mat-slide-toggle>\r\n\r\n <div class=\"messages-group\" [attr.id]=\"'toggle-' + field.name + '-error'\" aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p>{{ validation.message }}</p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
810
|
+
}] });
|
|
811
|
+
|
|
812
|
+
const components$2 = {
|
|
813
|
+
text: AcDivTextComponent$2,
|
|
814
|
+
group: AcGroupComponent$2,
|
|
815
|
+
array: AcArrayComponent$2,
|
|
816
|
+
row: AcRowComponent$2,
|
|
817
|
+
checkbox: AcFieldCheckboxComponent$2,
|
|
818
|
+
input: AcFieldInputComponent$2,
|
|
819
|
+
password: AcFieldPasswordComponent$2,
|
|
820
|
+
radio: AcFieldRadioButtonComponent$2,
|
|
821
|
+
select: AcFieldSelectComponent$2,
|
|
822
|
+
textarea: AcFieldTextareaComponent$2,
|
|
823
|
+
toggle: AcFieldToggleComponent$2,
|
|
824
|
+
/*
|
|
825
|
+
date: AcFieldDateComponent,
|
|
826
|
+
autocomplete: AcFieldAutocompleteComponent,
|
|
827
|
+
customField: AcFieldCustomComponent,
|
|
828
|
+
tabs: AcTabsComponent,
|
|
829
|
+
file: AcFieldFileComponent,
|
|
830
|
+
|
|
831
|
+
*/
|
|
832
|
+
};
|
|
833
|
+
let AcDynamicFieldDirective$2 = class AcDynamicFieldDirective {
|
|
834
|
+
container = inject(ViewContainerRef);
|
|
835
|
+
injector = inject(EnvironmentInjector);
|
|
836
|
+
type = input.required(...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
837
|
+
path = input.required(...(ngDevMode ? [{ debugName: "path" }] : []));
|
|
838
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
|
|
839
|
+
group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
840
|
+
instancePath = input(...(ngDevMode ? [undefined, { debugName: "instancePath" }] : []));
|
|
841
|
+
component;
|
|
842
|
+
ngOnChanges(changes) {
|
|
843
|
+
if (!components$2[this.field().type]) {
|
|
844
|
+
const supportedTypes = Object.keys(components$2).join(", ");
|
|
845
|
+
throw new Error(`Trying to use an unsupported type (${this.field().type}).
|
|
846
|
+
Supported types: ${supportedTypes}`);
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
if (!this.component || changes["type"]) {
|
|
850
|
+
this.container.clear();
|
|
851
|
+
this.component = this.container.createComponent(components$2[this.field().type], {
|
|
852
|
+
environmentInjector: this.injector
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
this.component.instance.field = this.field();
|
|
856
|
+
this.component.instance.group = this.group();
|
|
857
|
+
this.component.instance.instancePath = this.instancePath();
|
|
858
|
+
this.component.instance.path = this.path();
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDynamicFieldDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
862
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: AcDynamicFieldDirective, isStandalone: true, selector: "[sotDynamicField]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, path: { classPropertyName: "path", publicName: "path", isSignal: true, isRequired: true, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null }, instancePath: { classPropertyName: "instancePath", publicName: "instancePath", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0 });
|
|
863
|
+
};
|
|
864
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDynamicFieldDirective$2, decorators: [{
|
|
865
|
+
type: Directive,
|
|
866
|
+
args: [{
|
|
867
|
+
selector: "[sotDynamicField]",
|
|
868
|
+
standalone: true
|
|
869
|
+
}]
|
|
870
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], path: [{ type: i0.Input, args: [{ isSignal: true, alias: "path", required: true }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }], instancePath: [{ type: i0.Input, args: [{ isSignal: true, alias: "instancePath", required: false }] }] } });
|
|
871
|
+
|
|
872
|
+
class AcMaterialDynamicFormComponent {
|
|
873
|
+
dynamicFormService = inject(DynamicFormService);
|
|
874
|
+
destroyRef = inject(DestroyRef);
|
|
875
|
+
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
876
|
+
initialValues = input(...(ngDevMode ? [undefined, { debugName: "initialValues" }] : []));
|
|
877
|
+
formCancel = output();
|
|
878
|
+
formSubmit = output();
|
|
879
|
+
formChange = output();
|
|
880
|
+
get form() {
|
|
881
|
+
return this.dynamicFormService.form;
|
|
882
|
+
}
|
|
883
|
+
get controls() {
|
|
884
|
+
return this.form ? this.form.controls : null;
|
|
885
|
+
}
|
|
886
|
+
get changes() {
|
|
887
|
+
return this.form ? this.form.valueChanges : null;
|
|
888
|
+
}
|
|
889
|
+
get valid() {
|
|
890
|
+
return this.form ? this.form.valid : null;
|
|
891
|
+
}
|
|
892
|
+
get value() {
|
|
893
|
+
return this.form ? this.form.value : null;
|
|
894
|
+
}
|
|
895
|
+
constructor() {
|
|
896
|
+
effect(() => {
|
|
897
|
+
if (!this.form && this.config() != null) {
|
|
898
|
+
this.createForm();
|
|
899
|
+
}
|
|
900
|
+
if (this.initialValues() && this.form && this.form.pristine) {
|
|
901
|
+
this.setValue(this.initialValues());
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
createForm() {
|
|
906
|
+
this.dynamicFormService.createForm(this.config().fields, this.config().validations, this.config().updateOn, this.initialValues());
|
|
907
|
+
this.formChange.emit(this.form);
|
|
908
|
+
this.form.valueChanges
|
|
909
|
+
.pipe(distinctUntilChanged(), debounceTime(this.config().debounceTime ?? 0), takeUntilDestroyed(this.destroyRef))
|
|
910
|
+
.subscribe(() => {
|
|
911
|
+
this.formChange.emit(this.form);
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
setValue(values) {
|
|
915
|
+
this.form.setValue(values);
|
|
916
|
+
this.form.updateValueAndValidity();
|
|
917
|
+
}
|
|
918
|
+
onClickButton(button) {
|
|
919
|
+
if (button.type === 'reset') {
|
|
920
|
+
this.reset();
|
|
921
|
+
}
|
|
922
|
+
if (button.action) {
|
|
923
|
+
button.action(this.form);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
reset() {
|
|
927
|
+
this.form.reset();
|
|
928
|
+
this.formCancel.emit();
|
|
929
|
+
}
|
|
930
|
+
handleSubmit(event) {
|
|
931
|
+
if (event) {
|
|
932
|
+
event.preventDefault();
|
|
933
|
+
event.stopPropagation();
|
|
934
|
+
}
|
|
935
|
+
if (this.form.valid) {
|
|
936
|
+
this.formSubmit.emit(this.form);
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
this.form.markAllAsTouched();
|
|
940
|
+
_.defer(() => {
|
|
941
|
+
this.focusFirstInvalidControl();
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
focusFirstInvalidControl() {
|
|
946
|
+
// TODO
|
|
947
|
+
}
|
|
948
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcMaterialDynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
949
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcMaterialDynamicFormComponent, isStandalone: true, selector: "sot-material-dynamic-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, initialValues: { classPropertyName: "initialValues", publicName: "initialValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formCancel: "formCancel", formSubmit: "formSubmit", formChange: "formChange" }, providers: [DynamicFormService], exportAs: ["dynamicForm"], ngImport: i0, template: "@if (form && config()) {\r\n <form class=\"dynamic-form\"\r\n [formGroup]=\"form\"\r\n (submit)=\"handleSubmit($event)\"\r\n [ngClass]=\"config()!.className?.form\">\r\n @if (this.config()!.fields) {\r\n <div class=\"dynamic-form-content\"\r\n [ngClass]=\"config()!.className?.formContent\">\r\n @for (field of config()!.fields; track field.type + field.name) {\r\n <div [hidden]=\"!!field.hidden\"\r\n [ngClass]=\"field.hostClassName\">\r\n <ng-container\r\n sotDynamicField\r\n [path]=\"field.name\"\r\n [type]=\"field.type\"\r\n [field]=\"field\"\r\n [group]=\"form\"\r\n >\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- TODO Revoir l'affichage des erreurs -->\r\n @if (config()!.validations && form && !form.untouched && form.invalid) {\r\n <mat-error class=\"dynamic-form-error\">\r\n @for (validation of config()!.validations!; track validation) {\r\n @if (form.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n @if (config()!.buttons) {\r\n <div class=\"dynamic-form-buttons\" [ngClass]=\"config()!.className?.formButtons\">\r\n @for (button of config()!.buttons; track $index) {\r\n <!-- TODO\r\n <sot-button [type]=\"button.type\"\r\n [className]=\"button.className\"\r\n [matType]=\"button.matButtonType ?? 'raised'\"\r\n [disabled]=\"button.disabledIfFormNoValid && form.invalid\"\r\n [matIcon]=\"button.matIcon\"\r\n [label]=\"button.label\"\r\n [title]=\"button.title\"\r\n [ariaLabel]=\"button.ariaLabel\"\r\n (buttonClick)=\"onClickButton(button)\"\r\n ></sot-button>\r\n -->\r\n }\r\n </div>\r\n }\r\n </form>\r\n}\r\n", styles: [".dynamic-form-horizontal{display:flex;flex-direction:row;flex-wrap:wrap}.dynamic-form-buttons{display:flex;flex-direction:row;gap:2rem;margin-bottom:2rem}.dynamic-form-error{margin-bottom:2rem}\n"], dependencies: [{ kind: "directive", type: AcDynamicFieldDirective$2, selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
950
|
+
}
|
|
951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcMaterialDynamicFormComponent, decorators: [{
|
|
952
|
+
type: Component,
|
|
953
|
+
args: [{ exportAs: 'dynamicForm', selector: 'sot-material-dynamic-form', standalone: true, imports: [AcDynamicFieldDirective$2, NgClass, ReactiveFormsModule, MatError, MatIconModule, MatButtonModule], providers: [DynamicFormService], template: "@if (form && config()) {\r\n <form class=\"dynamic-form\"\r\n [formGroup]=\"form\"\r\n (submit)=\"handleSubmit($event)\"\r\n [ngClass]=\"config()!.className?.form\">\r\n @if (this.config()!.fields) {\r\n <div class=\"dynamic-form-content\"\r\n [ngClass]=\"config()!.className?.formContent\">\r\n @for (field of config()!.fields; track field.type + field.name) {\r\n <div [hidden]=\"!!field.hidden\"\r\n [ngClass]=\"field.hostClassName\">\r\n <ng-container\r\n sotDynamicField\r\n [path]=\"field.name\"\r\n [type]=\"field.type\"\r\n [field]=\"field\"\r\n [group]=\"form\"\r\n >\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- TODO Revoir l'affichage des erreurs -->\r\n @if (config()!.validations && form && !form.untouched && form.invalid) {\r\n <mat-error class=\"dynamic-form-error\">\r\n @for (validation of config()!.validations!; track validation) {\r\n @if (form.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n @if (config()!.buttons) {\r\n <div class=\"dynamic-form-buttons\" [ngClass]=\"config()!.className?.formButtons\">\r\n @for (button of config()!.buttons; track $index) {\r\n <!-- TODO\r\n <sot-button [type]=\"button.type\"\r\n [className]=\"button.className\"\r\n [matType]=\"button.matButtonType ?? 'raised'\"\r\n [disabled]=\"button.disabledIfFormNoValid && form.invalid\"\r\n [matIcon]=\"button.matIcon\"\r\n [label]=\"button.label\"\r\n [title]=\"button.title\"\r\n [ariaLabel]=\"button.ariaLabel\"\r\n (buttonClick)=\"onClickButton(button)\"\r\n ></sot-button>\r\n -->\r\n }\r\n </div>\r\n }\r\n </form>\r\n}\r\n", styles: [".dynamic-form-horizontal{display:flex;flex-direction:row;flex-wrap:wrap}.dynamic-form-buttons{display:flex;flex-direction:row;gap:2rem;margin-bottom:2rem}.dynamic-form-error{margin-bottom:2rem}\n"] }]
|
|
954
|
+
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], initialValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValues", required: false }] }], formCancel: [{ type: i0.Output, args: ["formCancel"] }], formSubmit: [{ type: i0.Output, args: ["formSubmit"] }], formChange: [{ type: i0.Output, args: ["formChange"] }] } });
|
|
955
|
+
|
|
956
|
+
let AcDivTextComponent$1 = class AcDivTextComponent extends AbstractFieldComponent {
|
|
957
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDivTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
958
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcDivTextComponent, isStandalone: true, selector: "sot-div-text", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-text\" [ngClass]=\"field.className\">\n <div [innerHTML]=\"field.label\"></div>\n @if(field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
959
|
+
};
|
|
960
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDivTextComponent$1, decorators: [{
|
|
961
|
+
type: Component,
|
|
962
|
+
args: [{ selector: 'sot-div-text', standalone: true, imports: [NgClass], template: "<div class=\"sot-formfield sot-formfield-text\" [ngClass]=\"field.className\">\n <div [innerHTML]=\"field.label\"></div>\n @if(field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n</div>\n" }]
|
|
963
|
+
}] });
|
|
964
|
+
|
|
965
|
+
let AcFieldCheckboxComponent$1 = class AcFieldCheckboxComponent extends AbstractControlFieldComponent {
|
|
966
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
967
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldCheckboxComponent, isStandalone: true, selector: "sot-field-checkbox", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-checkbox\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-checkbox-group\"\r\n [ngClass]=\"{\r\n 'fr-checkbox-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-checkbox-group--valid': control && !control.untouched && control.valid,\r\n 'fr-checkbox-group--disabled': control && control.disabled,\r\n }\">\r\n <input\r\n type=\"checkbox\"\r\n [formControlName]=\"field.name\"\r\n [attr.id]=\"'sot-checkbox-' + uuid\"\r\n [ngClass]=\"{\r\n 'fr-checkbox--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-checkbox--valid': control && !control.untouched && control.valid,\r\n 'fr-checkbox--disabled': control && control.disabled,\r\n }\" />\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-checkbox-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-checkbox-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".error-wrapper{padding:0 16px;font-size:var(--mat-form-field-subscript-text-size, var(--mat-sys-body-small-size));color:var(--mat-form-field-error-text-color, var(--mat-sys-error));line-height:var(--mat-form-field-subscript-text-line-height, var(--mat-app-body-small-line-height))}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatCheckboxModule }] });
|
|
968
|
+
};
|
|
969
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldCheckboxComponent$1, decorators: [{
|
|
970
|
+
type: Component,
|
|
971
|
+
args: [{ selector: 'sot-field-checkbox', standalone: true, imports: [ReactiveFormsModule, NgClass, MatCheckboxModule, MatError], template: "<div class=\"sot-formfield sot-formfield-checkbox\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-checkbox-group\"\r\n [ngClass]=\"{\r\n 'fr-checkbox-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-checkbox-group--valid': control && !control.untouched && control.valid,\r\n 'fr-checkbox-group--disabled': control && control.disabled,\r\n }\">\r\n <input\r\n type=\"checkbox\"\r\n [formControlName]=\"field.name\"\r\n [attr.id]=\"'sot-checkbox-' + uuid\"\r\n [ngClass]=\"{\r\n 'fr-checkbox--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-checkbox--valid': control && !control.untouched && control.valid,\r\n 'fr-checkbox--disabled': control && control.disabled,\r\n }\" />\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-checkbox-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-checkbox-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".error-wrapper{padding:0 16px;font-size:var(--mat-form-field-subscript-text-size, var(--mat-sys-body-small-size));color:var(--mat-form-field-error-text-color, var(--mat-sys-error));line-height:var(--mat-form-field-subscript-text-line-height, var(--mat-app-body-small-line-height))}\n"] }]
|
|
972
|
+
}] });
|
|
973
|
+
|
|
974
|
+
let AcFieldInputComponent$1 = class AcFieldInputComponent extends AbstractControlFieldComponent {
|
|
975
|
+
inputType = 'text';
|
|
976
|
+
buttonAction(b) {
|
|
977
|
+
if (b.action && this.field && this.group) {
|
|
978
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
ngOnInit() {
|
|
982
|
+
super.ngOnInit();
|
|
983
|
+
this.inputType = this.field.inputType ?? 'text';
|
|
984
|
+
const control = this.group.get(this.field.name);
|
|
985
|
+
if (control) {
|
|
986
|
+
control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
987
|
+
if (value?.length == 0) {
|
|
988
|
+
control.setValue(null);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
994
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldInputComponent, isStandalone: true, selector: "sot-field-input", usesInheritance: true, ngImport: i0, template: "<div class=\"form-field-input\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-input-group\"\r\n [ngClass]=\"{\r\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input-group--valid': control && !control.untouched && control.valid,\r\n 'fr-input-group--disabled': control && control.disabled,\r\n }\">\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"fr-input\"\r\n [ngClass]=\"{\r\n 'fr-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input--valid': control && !control.untouched && control.valid,\r\n 'fr-input--disabled': (control && control.disabled) || field.readonly,\r\n }\"\r\n [type]=\"field.inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [readonly]=\"field.readonly\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i2$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
995
|
+
};
|
|
996
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldInputComponent$1, decorators: [{
|
|
997
|
+
type: Component,
|
|
998
|
+
args: [{ selector: 'sot-field-input', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatIconModule, MatInputModule, MatButtonModule], template: "<div class=\"form-field-input\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-input-group\"\r\n [ngClass]=\"{\r\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input-group--valid': control && !control.untouched && control.valid,\r\n 'fr-input-group--disabled': control && control.disabled,\r\n }\">\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"fr-input\"\r\n [ngClass]=\"{\r\n 'fr-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input--valid': control && !control.untouched && control.valid,\r\n 'fr-input--disabled': (control && control.disabled) || field.readonly,\r\n }\"\r\n [type]=\"field.inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [readonly]=\"field.readonly\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\n"] }]
|
|
999
|
+
}] });
|
|
1000
|
+
|
|
1001
|
+
let AcGroupComponent$1 = class AcGroupComponent extends AbstractControlFieldComponent {
|
|
1002
|
+
get subGroup() {
|
|
1003
|
+
return this.group.controls[this.field.name];
|
|
1004
|
+
}
|
|
1005
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1006
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcGroupComponent, isStandalone: true, selector: "sot-group", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-group\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield\"\n [ngClass]=\"{\n 'fr-accordion': field.accordion,\n }\"\n >\n @if (field.accordion) {\n <legend\n class=\"fr-accordion__title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"fr-accordion__btn\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'group-content-' + field.name\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n </button>\n </legend>\n <div\n class=\"fr-collapse\"\n [ngClass]=\"{ 'fr-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'group-content-' + field.name\">\n @if (field.description) {\n <p class=\"fr-hint-text\">{{ field.description }}</p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n\n } @else {\n <legend [ngClass]=\"field.labelClassName\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n </legend>\n <div *ngTemplateOutlet=\"groupFields\"></div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"\">\n @for (f of field.fields; track f.type + f.name) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"subGroup\"\n [instancePath]=\"instancePath\"\n ></ng-container>\n </div>\n }\n </div>\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-group-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n</ng-template>\n", styles: ["fieldset{border:none;padding:0;margin:0}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective$1), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1007
|
+
};
|
|
1008
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcGroupComponent$1, decorators: [{
|
|
1009
|
+
type: Component,
|
|
1010
|
+
args: [{ selector: 'sot-group', standalone: true, imports: [
|
|
1011
|
+
forwardRef(() => AcDynamicFieldDirective$1),
|
|
1012
|
+
NgClass,
|
|
1013
|
+
MatAccordion,
|
|
1014
|
+
MatExpansionPanel,
|
|
1015
|
+
MatExpansionPanelHeader,
|
|
1016
|
+
MatExpansionPanelTitle,
|
|
1017
|
+
NgTemplateOutlet
|
|
1018
|
+
], template: "<div class=\"sot-formfield sot-formfield-group\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield\"\n [ngClass]=\"{\n 'fr-accordion': field.accordion,\n }\"\n >\n @if (field.accordion) {\n <legend\n class=\"fr-accordion__title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"fr-accordion__btn\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'group-content-' + field.name\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n </button>\n </legend>\n <div\n class=\"fr-collapse\"\n [ngClass]=\"{ 'fr-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'group-content-' + field.name\">\n @if (field.description) {\n <p class=\"fr-hint-text\">{{ field.description }}</p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n\n } @else {\n <legend [ngClass]=\"field.labelClassName\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n </legend>\n <div *ngTemplateOutlet=\"groupFields\"></div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"\">\n @for (f of field.fields; track f.type + f.name) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"subGroup\"\n [instancePath]=\"instancePath\"\n ></ng-container>\n </div>\n }\n </div>\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-group-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n</ng-template>\n", styles: ["fieldset{border:none;padding:0;margin:0}\n"] }]
|
|
1019
|
+
}] });
|
|
1020
|
+
|
|
1021
|
+
let AcArrayComponent$1 = class AcArrayComponent extends AbstractControlFieldComponent {
|
|
1022
|
+
dynamicService = inject(DynamicFormService);
|
|
1023
|
+
ref = inject(ChangeDetectorRef);
|
|
1024
|
+
get array() {
|
|
1025
|
+
return this.group.controls[this.field.name];
|
|
1026
|
+
}
|
|
1027
|
+
constructor() {
|
|
1028
|
+
super();
|
|
1029
|
+
}
|
|
1030
|
+
addItem() {
|
|
1031
|
+
const i = this.field.instances.length > 0 ? this.field.instances[this.field.instances.length - 1].number + 1 : 0;
|
|
1032
|
+
const fields = _.cloneDeep(this.field.field.fields);
|
|
1033
|
+
const grp = this.dynamicService.createGroup(fields, `${this.path}[${i}]`, null);
|
|
1034
|
+
this.field.instances.push({
|
|
1035
|
+
number: i,
|
|
1036
|
+
group: grp,
|
|
1037
|
+
fields
|
|
1038
|
+
});
|
|
1039
|
+
this.array.push(grp);
|
|
1040
|
+
this.ref.detectChanges();
|
|
1041
|
+
}
|
|
1042
|
+
deleteItem(index, inst) {
|
|
1043
|
+
/*
|
|
1044
|
+
TODO
|
|
1045
|
+
this.field.instances!.splice(index, 1);
|
|
1046
|
+
for (const key of this.dynamicService.pathFieldMap.keys()) {
|
|
1047
|
+
if (key.startsWith(`${this.path}[${inst.number}]`)) {
|
|
1048
|
+
this.dynamicFormService.pathFieldMap.delete(key);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
*/
|
|
1053
|
+
this.array.removeAt(index);
|
|
1054
|
+
this.ref.detectChanges();
|
|
1055
|
+
}
|
|
1056
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcArrayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1057
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcArrayComponent, isStandalone: true, selector: "sot-array", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-array\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield-wrapper sot-fieldset\"\n [ngClass]=\"{'fr-accordion': field.accordion}\"\n >\n @if (field.accordion) {\n <legend\n class=\"fr-accordion__title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"fr-accordion__btn\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'array-content-' + uuid\">\n {{ field.label }}\n </button>\n </legend>\n <div\n class=\"fr-collapse\"\n [ngClass]=\"{ 'fr-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'array-content-' + uuid\">\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n } @else {\n <legend [ngClass]=\"field.labelClassName\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n </legend>\n <div [attr.id]=\"'array-content-' + uuid\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"sot-formfield-array\" [formGroup]=\"group\">\n <div [formArrayName]=\"field.name\">\n @for (inst of field.instances; track inst; let i = $index) {\n <fieldset class=\"sot-formfield-array-element\"\n [ngClass]=\"field.elementClassName\">\n <legend class=\"sot-formfield-array-element-label\">\n {{ field.itemLabel ?? 'Item' }} {{ inst.number + 1 }}\n </legend>\n <div class=\"sot-formfield-array-element-content\"\n [ngClass]=\"field.elementContentClassName\">\n @for (f of inst.fields; track f.name + f.type) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"inst.group\"\n [instancePath]=\"path + '[' + inst.number + ']'\"\n ></ng-container>\n </div>\n }\n </div>\n <div class=\"sot-formfield-array-element-action\">\n @if (!field.disabled && (!field.minNbRow || field.minNbRow < array.controls.length)) {\n <button type=\"button\"\n class=\"fr-btn\"\n (click)=\"deleteItem(i, inst)\"\n >\n {{ field.deleteButton?.label ?? 'Delete' }}\n </button>\n }\n </div>\n </fieldset>\n }\n @if (!field.disabled && (!field.maxNbRow || field.maxNbRow > array.controls.length)) {\n <div class=\"sot-formfield-array-add-button\">\n <button type=\"button\"\n class=\"fr-btn\"\n (click)=\"addItem()\"\n >\n {{ field.addButton?.label ?? 'Add' }}\n </button>\n </div>\n }\n <div\n class=\"fr-messages-group\"\n [attr.id]=\"'fr-array-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"fr-message fr-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n </div>\n</ng-template>\n", styles: ["fieldset.dynamic-field-array{border:none;padding:0;margin:0}.dynamic-field-array-add-button{padding:2rem 0}.dynamic-field-array{margin-bottom:2rem}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective$1), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "ngmodule", type: i0.forwardRef(() => MatExpansionModule) }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: i0.forwardRef(() => MatCardModule) }, { kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => i1.NgControlStatusGroup), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i0.forwardRef(() => i1.FormGroupDirective), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i0.forwardRef(() => i1.FormArrayName), selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i0.forwardRef(() => NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1058
|
+
};
|
|
1059
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcArrayComponent$1, decorators: [{
|
|
1060
|
+
type: Component,
|
|
1061
|
+
args: [{ selector: "sot-array", standalone: true, imports: [
|
|
1062
|
+
forwardRef(() => AcDynamicFieldDirective$1),
|
|
1063
|
+
MatExpansionModule,
|
|
1064
|
+
NgClass,
|
|
1065
|
+
MatIcon,
|
|
1066
|
+
MatButton,
|
|
1067
|
+
MatCardModule,
|
|
1068
|
+
ReactiveFormsModule,
|
|
1069
|
+
MatError,
|
|
1070
|
+
NgTemplateOutlet
|
|
1071
|
+
], template: "<div class=\"sot-formfield sot-formfield-array\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield-wrapper sot-fieldset\"\n [ngClass]=\"{'fr-accordion': field.accordion}\"\n >\n @if (field.accordion) {\n <legend\n class=\"fr-accordion__title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"fr-accordion__btn\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'array-content-' + uuid\">\n {{ field.label }}\n </button>\n </legend>\n <div\n class=\"fr-collapse\"\n [ngClass]=\"{ 'fr-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'array-content-' + uuid\">\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n } @else {\n <legend [ngClass]=\"field.labelClassName\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n </legend>\n <div [attr.id]=\"'array-content-' + uuid\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"sot-formfield-array\" [formGroup]=\"group\">\n <div [formArrayName]=\"field.name\">\n @for (inst of field.instances; track inst; let i = $index) {\n <fieldset class=\"sot-formfield-array-element\"\n [ngClass]=\"field.elementClassName\">\n <legend class=\"sot-formfield-array-element-label\">\n {{ field.itemLabel ?? 'Item' }} {{ inst.number + 1 }}\n </legend>\n <div class=\"sot-formfield-array-element-content\"\n [ngClass]=\"field.elementContentClassName\">\n @for (f of inst.fields; track f.name + f.type) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"inst.group\"\n [instancePath]=\"path + '[' + inst.number + ']'\"\n ></ng-container>\n </div>\n }\n </div>\n <div class=\"sot-formfield-array-element-action\">\n @if (!field.disabled && (!field.minNbRow || field.minNbRow < array.controls.length)) {\n <button type=\"button\"\n class=\"fr-btn\"\n (click)=\"deleteItem(i, inst)\"\n >\n {{ field.deleteButton?.label ?? 'Delete' }}\n </button>\n }\n </div>\n </fieldset>\n }\n @if (!field.disabled && (!field.maxNbRow || field.maxNbRow > array.controls.length)) {\n <div class=\"sot-formfield-array-add-button\">\n <button type=\"button\"\n class=\"fr-btn\"\n (click)=\"addItem()\"\n >\n {{ field.addButton?.label ?? 'Add' }}\n </button>\n </div>\n }\n <div\n class=\"fr-messages-group\"\n [attr.id]=\"'fr-array-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"fr-message fr-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n </div>\n</ng-template>\n", styles: ["fieldset.dynamic-field-array{border:none;padding:0;margin:0}.dynamic-field-array-add-button{padding:2rem 0}.dynamic-field-array{margin-bottom:2rem}\n"] }]
|
|
1072
|
+
}], ctorParameters: () => [] });
|
|
1073
|
+
|
|
1074
|
+
let AcRowComponent$1 = class AcRowComponent extends AbstractFieldComponent {
|
|
1075
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcRowComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1076
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcRowComponent, isStandalone: true, selector: "sot-row", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-row\" [ngClass]=\"field.className\">\n @for (f of field.fields; track f.type + f.name) {\n <div\n [hidden]=\"f.hidden\"\n [ngClass]=\"f.hostClassName\">\n <ng-container\n sotDynamicField\n [path]=\"path + '.' + f.name\"\n [type]=\"f.type\"\n [field]=\"f\"\n [group]=\"group\"\n [instancePath]=\"instancePath\"\n >\n </ng-container>\n </div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective$1), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }] });
|
|
1077
|
+
};
|
|
1078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcRowComponent$1, decorators: [{
|
|
1079
|
+
type: Component,
|
|
1080
|
+
args: [{ selector: 'sot-row', standalone: true, imports: [
|
|
1081
|
+
ReactiveFormsModule,
|
|
1082
|
+
NgClass,
|
|
1083
|
+
forwardRef(() => AcDynamicFieldDirective$1),
|
|
1084
|
+
AcDynamicFieldDirective$1
|
|
1085
|
+
], template: "<div class=\"sot-formfield sot-formfield-row\" [ngClass]=\"field.className\">\n @for (f of field.fields; track f.type + f.name) {\n <div\n [hidden]=\"f.hidden\"\n [ngClass]=\"f.hostClassName\">\n <ng-container\n sotDynamicField\n [path]=\"path + '.' + f.name\"\n [type]=\"f.type\"\n [field]=\"f\"\n [group]=\"group\"\n [instancePath]=\"instancePath\"\n >\n </ng-container>\n </div>\n }\n</div>\n" }]
|
|
1086
|
+
}] });
|
|
1087
|
+
|
|
1088
|
+
let PasswordValidators$1 = class PasswordValidators {
|
|
1089
|
+
static patternValidator(regex, error) {
|
|
1090
|
+
return (control) => {
|
|
1091
|
+
if (!control.value) {
|
|
1092
|
+
return null;
|
|
1093
|
+
}
|
|
1094
|
+
const valid = regex.test(control.value);
|
|
1095
|
+
return valid ? null : error;
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
let AcFieldPasswordComponent$1 = class AcFieldPasswordComponent extends AbstractControlFieldComponent {
|
|
1101
|
+
inputType = 'password';
|
|
1102
|
+
showPasswordLabel;
|
|
1103
|
+
hidePasswordLabel;
|
|
1104
|
+
iconErrorLabel;
|
|
1105
|
+
iconSuccessLabel;
|
|
1106
|
+
buttonAction(b) {
|
|
1107
|
+
if (b.action && this.field && this.group) {
|
|
1108
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
ngOnInit() {
|
|
1112
|
+
super.ngOnInit();
|
|
1113
|
+
this.showPasswordLabel = this.field.labels?.showPassword ?? "Show password";
|
|
1114
|
+
this.hidePasswordLabel = this.field.labels?.hidePassword ?? "Hide password";
|
|
1115
|
+
this.iconSuccessLabel = this.field.labels?.iconSuccess ?? "Success";
|
|
1116
|
+
this.iconErrorLabel = this.field.labels?.iconError ?? "Error";
|
|
1117
|
+
if (this.control) {
|
|
1118
|
+
this.control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
1119
|
+
if (value?.length == 0) {
|
|
1120
|
+
this.control.setValue(null);
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
this.setPasswordValidators();
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
tooglePassword() {
|
|
1127
|
+
this.inputType = this.inputType === 'password' ? 'text' : 'password';
|
|
1128
|
+
}
|
|
1129
|
+
get minLengthValid() {
|
|
1130
|
+
return this.control.value && !this.control.hasError("minlength");
|
|
1131
|
+
}
|
|
1132
|
+
get maxLengthValid() {
|
|
1133
|
+
return this.control.value && !this.control.hasError("maxlength");
|
|
1134
|
+
}
|
|
1135
|
+
get requiresDigitValid() {
|
|
1136
|
+
return this.control.value && !this.control.hasError("requiresDigit");
|
|
1137
|
+
}
|
|
1138
|
+
get requiresUppercaseValid() {
|
|
1139
|
+
return this.control.value && !this.control.hasError("requiresUppercase");
|
|
1140
|
+
}
|
|
1141
|
+
get requiresLowercaseValid() {
|
|
1142
|
+
return this.control.value && !this.control.hasError("requiresLowercase");
|
|
1143
|
+
}
|
|
1144
|
+
get requiresSpecialCharsValid() {
|
|
1145
|
+
return this.control.value && !this.control.hasError("requiresSpecialChars");
|
|
1146
|
+
}
|
|
1147
|
+
setPasswordValidators() {
|
|
1148
|
+
if (this.field.minlength) {
|
|
1149
|
+
this.control?.addValidators(Validators.minLength(this.field.minlength));
|
|
1150
|
+
}
|
|
1151
|
+
if (this.field.maxlength) {
|
|
1152
|
+
this.control?.addValidators(Validators.maxLength(this.field.maxlength));
|
|
1153
|
+
}
|
|
1154
|
+
if (this.field.requiresDigit) {
|
|
1155
|
+
this.control?.addValidators(PasswordValidators$1.patternValidator(/(?=.*[0-9])/, {
|
|
1156
|
+
requiresDigit: true
|
|
1157
|
+
}));
|
|
1158
|
+
}
|
|
1159
|
+
if (this.field.requiresUppercase) {
|
|
1160
|
+
this.control?.addValidators(PasswordValidators$1.patternValidator(/(?=.*[A-Z])/, {
|
|
1161
|
+
requiresUppercase: true
|
|
1162
|
+
}));
|
|
1163
|
+
}
|
|
1164
|
+
if (this.field.requiresLowercase) {
|
|
1165
|
+
this.control?.addValidators(PasswordValidators$1.patternValidator(/(?=.*[a-z])/, {
|
|
1166
|
+
requiresLowercase: true
|
|
1167
|
+
}));
|
|
1168
|
+
}
|
|
1169
|
+
if (this.field.requiresSpecialChars) {
|
|
1170
|
+
const chars = this.field.specialChars?.join("") ?? "$@^!%*?&";
|
|
1171
|
+
const regex = "(?=.*[" + chars + "])";
|
|
1172
|
+
this.control?.addValidators(PasswordValidators$1.patternValidator(new RegExp(regex), {
|
|
1173
|
+
requiresSpecialChars: true
|
|
1174
|
+
}));
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldPasswordComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1178
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldPasswordComponent, isStandalone: true, selector: "sot-field-password", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-password\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-input-group\"\r\n [ngClass]=\"{\r\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input-group--valid': control && !control.untouched && control.valid,\r\n 'fr-input-group--disabled': (control && control.disabled),\r\n }\">\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"fr-input\"\r\n [ngClass]=\"{\r\n 'fr-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input--valid': control && !control.untouched && control.valid,\r\n 'fr-input--disabled': (control && control.disabled),\r\n }\"\r\n [type]=\"inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n <button type=\"button\" class=\"fr-button\"\r\n (click)=\"tooglePassword()\"\r\n [attr.aria-label]=\"inputType === 'password' ? showPasswordLabel : hidePasswordLabel\"\r\n [attr.aria-pressed]=\"inputType === 'password'\">\r\n @if(inputType === 'password') {\r\n <span aria-hidden=\"true\" class=\"fr-icon-eye-off-fill\"></span>\r\n } @else {\r\n <span aria-hidden=\"true\" class=\"fr-icon-eye-fill\"></span>\r\n }\r\n </button>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n <ul class=\"password-description\" [id]=\"uuid + '-description'\">\r\n @if (field.minlength) {\r\n <li [ngClass]=\"{ 'text-success': minLengthValid, 'text-error': !minLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"minLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.minlength ?? \"Must be at least 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.maxlength) {\r\n <li [ngClass]=\"{ 'text-success': maxLengthValid, 'text-error': !maxLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"maxLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.maxlength ?? \"Must be at most 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.requiresDigit) {\r\n <li [ngClass]=\"{ 'text-success': requiresDigitValid, 'text-error': !requiresDigitValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresDigitValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresDigit ?? \"Must contain at least 1 digit\" }}\r\n </li>\r\n }\r\n @if (field.requiresUppercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresUppercaseValid, 'text-error': !requiresUppercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresUppercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresUppercase ?? \"Must contain at least 1 uppercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresLowercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresLowercaseValid, 'text-error': !requiresLowercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresLowercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresLowercase ?? \"Must contain at least 1 lowercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresSpecialChars) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresSpecialCharsValid, 'text-error': !requiresSpecialCharsValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresSpecialCharsValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresSpecialChars ?? \"Must contain at least 1 special character\" }}\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}.password-description{list-style-type:none;margin-block-start:0}.password-description li{display:flex;flex-direction:row;align-items:center}.password-description li mat-icon{margin-right:.5rem}.password-description li.text-error{color:var(--mat-form-field-error-text-color, var(--mat-app-error))}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i2$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
1179
|
+
};
|
|
1180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldPasswordComponent$1, decorators: [{
|
|
1181
|
+
type: Component,
|
|
1182
|
+
args: [{ selector: 'sot-field-password', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatIconModule, MatInputModule, MatButtonModule], template: "<div class=\"sot-formfield sot-formfield-password\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-input-group\"\r\n [ngClass]=\"{\r\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input-group--valid': control && !control.untouched && control.valid,\r\n 'fr-input-group--disabled': (control && control.disabled),\r\n }\">\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"fr-input\"\r\n [ngClass]=\"{\r\n 'fr-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input--valid': control && !control.untouched && control.valid,\r\n 'fr-input--disabled': (control && control.disabled),\r\n }\"\r\n [type]=\"inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n <button type=\"button\" class=\"fr-button\"\r\n (click)=\"tooglePassword()\"\r\n [attr.aria-label]=\"inputType === 'password' ? showPasswordLabel : hidePasswordLabel\"\r\n [attr.aria-pressed]=\"inputType === 'password'\">\r\n @if(inputType === 'password') {\r\n <span aria-hidden=\"true\" class=\"fr-icon-eye-off-fill\"></span>\r\n } @else {\r\n <span aria-hidden=\"true\" class=\"fr-icon-eye-fill\"></span>\r\n }\r\n </button>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n <ul class=\"password-description\" [id]=\"uuid + '-description'\">\r\n @if (field.minlength) {\r\n <li [ngClass]=\"{ 'text-success': minLengthValid, 'text-error': !minLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"minLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.minlength ?? \"Must be at least 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.maxlength) {\r\n <li [ngClass]=\"{ 'text-success': maxLengthValid, 'text-error': !maxLengthValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"maxLengthValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.maxlength ?? \"Must be at most 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.requiresDigit) {\r\n <li [ngClass]=\"{ 'text-success': requiresDigitValid, 'text-error': !requiresDigitValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresDigitValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresDigit ?? \"Must contain at least 1 digit\" }}\r\n </li>\r\n }\r\n @if (field.requiresUppercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresUppercaseValid, 'text-error': !requiresUppercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresUppercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresUppercase ?? \"Must contain at least 1 uppercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresLowercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresLowercaseValid, 'text-error': !requiresLowercaseValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresLowercaseValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresLowercase ?? \"Must contain at least 1 lowercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresSpecialChars) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresSpecialCharsValid, 'text-error': !requiresSpecialCharsValid }\">\r\n <mat-icon [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"\r\n [fontIcon]=\"requiresSpecialCharsValid ? 'check' : 'error'\"></mat-icon>\r\n {{ field.labels?.requiresSpecialChars ?? \"Must contain at least 1 special character\" }}\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input mat-form-field{width:100%}.sot-formfield-input mat-form-field[hidden]{display:none}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}.password-description{list-style-type:none;margin-block-start:0}.password-description li{display:flex;flex-direction:row;align-items:center}.password-description li mat-icon{margin-right:.5rem}.password-description li.text-error{color:var(--mat-form-field-error-text-color, var(--mat-app-error))}\n"] }]
|
|
1183
|
+
}] });
|
|
1184
|
+
|
|
1185
|
+
let AcFieldRadioButtonComponent$1 = class AcFieldRadioButtonComponent extends AbstractControlFieldComponent {
|
|
1186
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldRadioButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1187
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldRadioButtonComponent, isStandalone: true, selector: "sot-field-radio-button", usesInheritance: true, ngImport: i0, template: "<div\r\n class=\"form-field-radio\"\r\n [hidden]=\"field.hidden\"\r\n [ngClass]=\"field.className\">\r\n <fieldset\r\n class=\"fr-fieldset\"\r\n [ngClass]=\"{\r\n 'fr-fieldset--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-fieldset--valid': control && !control.untouched && control.valid,\r\n 'fr-fieldset--disabled': control && control.disabled,\r\n }\"\r\n [id]=\"'radio-' + uuid\"\r\n [attr.aria-labelledby]=\"'radio-legend-' + uuid\"\r\n [formGroup]=\"group\">\r\n <legend\r\n class=\"fr-fieldset__legend--regular fr-fieldset__legend\"\r\n [ngClass]=\"field.labelClassName\"\r\n [id]=\"'radio-legend-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </legend>\r\n @if(field.options) {\r\n @for (item of field.options; track item; let i = $index) {\r\n <div\r\n class=\"fr-fieldset__element\"\r\n [ngClass]=\"{ 'fr-fieldset__element--inline': !field.verticalAlign }\">\r\n <div class=\"fr-radio-group\">\r\n <input\r\n type=\"radio\"\r\n [id]=\"'radio-' + uuid + '-' + i\"\r\n [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [attr.name]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [attr.disabled]=\"field.disabledKey && !!item[field.disabledKey] ? true : undefined\"/>\r\n <label\r\n class=\"fr-label\"\r\n [for]=\"'radio-' + uuid + '-' + i\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n @if (field.descriptionKey) {\r\n <span class=\"fr-hint-text\">{{ item[field.descriptionKey] }}</span>\r\n }\r\n </label>\r\n </div>\r\n </div>\r\n }\r\n }\r\n @if (control && !control.untouched && control.invalid) {\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'text-radio-' + uuid + '-error'\"\r\n aria-live=\"polite\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n <p class=\"fr-error-text\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n }\r\n </fieldset>\r\n</div>\r\n", styles: [".verticalAlign{display:flex;flex-direction:column}.horizontalAlign{display:flex;flex-direction:row;gap:2rem}.sot-formfield-radiobutton-label{display:flex;flex-direction:column}.sot-formfield-radiobutton-item ::ng-deep label{display:flex;flex-direction:column}\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.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "ngmodule", type: MatIconModule }] });
|
|
1188
|
+
};
|
|
1189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldRadioButtonComponent$1, decorators: [{
|
|
1190
|
+
type: Component,
|
|
1191
|
+
args: [{ selector: 'sot-field-radio-button', standalone: true, imports: [ReactiveFormsModule, NgClass, MatRadioModule, MatError, MatTooltipModule, MatIconModule], template: "<div\r\n class=\"form-field-radio\"\r\n [hidden]=\"field.hidden\"\r\n [ngClass]=\"field.className\">\r\n <fieldset\r\n class=\"fr-fieldset\"\r\n [ngClass]=\"{\r\n 'fr-fieldset--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-fieldset--valid': control && !control.untouched && control.valid,\r\n 'fr-fieldset--disabled': control && control.disabled,\r\n }\"\r\n [id]=\"'radio-' + uuid\"\r\n [attr.aria-labelledby]=\"'radio-legend-' + uuid\"\r\n [formGroup]=\"group\">\r\n <legend\r\n class=\"fr-fieldset__legend--regular fr-fieldset__legend\"\r\n [ngClass]=\"field.labelClassName\"\r\n [id]=\"'radio-legend-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </legend>\r\n @if(field.options) {\r\n @for (item of field.options; track item; let i = $index) {\r\n <div\r\n class=\"fr-fieldset__element\"\r\n [ngClass]=\"{ 'fr-fieldset__element--inline': !field.verticalAlign }\">\r\n <div class=\"fr-radio-group\">\r\n <input\r\n type=\"radio\"\r\n [id]=\"'radio-' + uuid + '-' + i\"\r\n [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [attr.name]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [attr.disabled]=\"field.disabledKey && !!item[field.disabledKey] ? true : undefined\"/>\r\n <label\r\n class=\"fr-label\"\r\n [for]=\"'radio-' + uuid + '-' + i\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n @if (field.descriptionKey) {\r\n <span class=\"fr-hint-text\">{{ item[field.descriptionKey] }}</span>\r\n }\r\n </label>\r\n </div>\r\n </div>\r\n }\r\n }\r\n @if (control && !control.untouched && control.invalid) {\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'text-radio-' + uuid + '-error'\"\r\n aria-live=\"polite\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control.hasError(validation.name)) {\r\n <p class=\"fr-error-text\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n }\r\n </fieldset>\r\n</div>\r\n", styles: [".verticalAlign{display:flex;flex-direction:column}.horizontalAlign{display:flex;flex-direction:row;gap:2rem}.sot-formfield-radiobutton-label{display:flex;flex-direction:column}.sot-formfield-radiobutton-item ::ng-deep label{display:flex;flex-direction:column}\n"] }]
|
|
1192
|
+
}] });
|
|
1193
|
+
|
|
1194
|
+
let AcFieldSelectComponent$1 = class AcFieldSelectComponent extends AbstractControlFieldComponent {
|
|
1195
|
+
options = [];
|
|
1196
|
+
ngOnInit() {
|
|
1197
|
+
super.ngOnInit();
|
|
1198
|
+
if (isObservable(this.field.options)) {
|
|
1199
|
+
this.field.options.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((options) => {
|
|
1200
|
+
this.options = options;
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
else {
|
|
1204
|
+
this.options = this.field.options;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
buttonAction(b) {
|
|
1208
|
+
if (b.action && this.field && this.group) {
|
|
1209
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1213
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldSelectComponent, isStandalone: true, selector: "sot-field-select", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-select\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-select-group\"\r\n [ngClass]=\"{\r\n 'fr-select-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-select-group--valid': control && !control.untouched && control.valid,\r\n 'fr-select-group--disabled': control && control.disabled,\r\n }\">\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-select-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n <select\r\n class=\"fr-select\"\r\n [ngClass]=\"{\r\n 'fr-select--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-select--valid': control && !control.untouched && control.valid,\r\n 'fr-select--disabled': control && control.disabled,\r\n }\"\r\n [attr.id]=\"'sot-select-' + uuid\"\r\n [formControlName]=\"field.name\">\r\n @if (field.resetOption) {\r\n <option [ngValue]=\"undefined\">\r\n {{ field.resetOptionLabel }}\r\n </option>\r\n }\r\n\r\n @if (field.options) {\r\n @if (field.groupLabelKey) {\r\n @for (group of options; track group) {\r\n <optgroup [label]=\"field.groupLabelKey ? group[field.groupLabelKey] : ''\">\r\n @if (field.groupOptionsKey && group[field.groupOptionsKey]) {\r\n @for (item of group[field.groupOptionsKey]; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n </optgroup>\r\n }\r\n } @else {\r\n @for (item of options; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n\r\n }\r\n </select>\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-select-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-select mat-form-field{width:100%}.sot-formfield-select mat-form-field[hidden]{display:none}::ng-deep .sot-formfield-select-panel .mdc-list-item__primary-text{width:100%}.sot-formfield-select-prefix,.sot-formfield-select-suffix{padding:0 .5rem}\n"], dependencies: [{ 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.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i2$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatSelectModule }] });
|
|
1214
|
+
};
|
|
1215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldSelectComponent$1, decorators: [{
|
|
1216
|
+
type: Component,
|
|
1217
|
+
args: [{ selector: 'sot-field-select', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatSelectModule], template: "<div class=\"sot-formfield sot-formfield-select\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-select-group\"\r\n [ngClass]=\"{\r\n 'fr-select-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-select-group--valid': control && !control.untouched && control.valid,\r\n 'fr-select-group--disabled': control && control.disabled,\r\n }\">\r\n <label\r\n class=\"fr-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-select-' + uuid\">\r\n {{ field.label }}\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"fr-hint-text\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n <select\r\n class=\"fr-select\"\r\n [ngClass]=\"{\r\n 'fr-select--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-select--valid': control && !control.untouched && control.valid,\r\n 'fr-select--disabled': control && control.disabled,\r\n }\"\r\n [attr.id]=\"'sot-select-' + uuid\"\r\n [formControlName]=\"field.name\">\r\n @if (field.resetOption) {\r\n <option [ngValue]=\"undefined\">\r\n {{ field.resetOptionLabel }}\r\n </option>\r\n }\r\n\r\n @if (field.options) {\r\n @if (field.groupLabelKey) {\r\n @for (group of options; track group) {\r\n <optgroup [label]=\"field.groupLabelKey ? group[field.groupLabelKey] : ''\">\r\n @if (field.groupOptionsKey && group[field.groupOptionsKey]) {\r\n @for (item of group[field.groupOptionsKey]; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n </optgroup>\r\n }\r\n } @else {\r\n @for (item of options; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n\r\n }\r\n </select>\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-prefix\" matPrefix>\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"fr-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-select-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-select mat-form-field{width:100%}.sot-formfield-select mat-form-field[hidden]{display:none}::ng-deep .sot-formfield-select-panel .mdc-list-item__primary-text{width:100%}.sot-formfield-select-prefix,.sot-formfield-select-suffix{padding:0 .5rem}\n"] }]
|
|
1218
|
+
}] });
|
|
1219
|
+
|
|
1220
|
+
let AcFieldTextareaComponent$1 = class AcFieldTextareaComponent extends AbstractControlFieldComponent {
|
|
1221
|
+
buttonAction(b) {
|
|
1222
|
+
if (b.action && this.field && this.group) {
|
|
1223
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1227
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldTextareaComponent, isStandalone: true, selector: "sot-field-textarea", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-textarea\" [ngClass]=\" field.className\">\n <div\n [formGroup]=\"group\"\n class=\"fr-input-group\"\n [ngClass]=\"{\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\n 'fr-input-group--valid': control && !control.untouched && control.valid ,\n 'fr-input-group--disabled': control && control.disabled,\n }\">\n <label\n class=\"fr-label\"\n [ngClass]=\"field.labelClassName\"\n [attr.for]=\"'sot-textarea-' + uuid\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n </label>\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\n @for (prefix of field.prefixes; track prefix) {\n <span class=\"sot-formfield-prefix\" matPrefix>\n @if (prefix.action) {\n <button type=\"button\"\n class=\"fr-button\"\n [attr.aria-label]=\"prefix.actionAriaLabel\"\n (click)=\"buttonAction(prefix)\"\n >{{ prefix.label }}</button>\n } @else {\n <span [innerHTML]=\"prefix.label\"></span>\n }\n </span>\n }\n\n <textarea\n class=\"fr-input\"\n [ngClass]=\"{\n 'fr-input--error': control && !control.untouched && !control.valid && !control.disabled,\n 'fr-input--valid': control && !control.untouched && control.valid ,\n 'fr-input--disabled': control && control.disabled,\n }\"\n [attr.id]=\"'sot-textarea-' + uuid\"\n [formControlName]=\"field.name\"\n [required]=\"!!required\"\n [readonly]=\"field.readonly\"\n [rows]=\"field.rows\"\n [maxlength]=\"field.maxlength ?? 10000000\">\n </textarea>\n\n @for (suffix of field.suffixes; track suffix) {\n <span class=\"sot-formfield-suffix\">\n @if (suffix.action) {\n <button type=\"button\"\n class=\"fr-button\"\n [attr.aria-label]=\"suffix.actionAriaLabel\"\n (click)=\"buttonAction(suffix)\"\n >{{ suffix.label }}</button>\n } @else {\n <span [innerHTML]=\"suffix.label\"></span>\n }\n </span>\n }\n </div>\n <div\n class=\"fr-messages-group\"\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"fr-error-text\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n</div>\n", styles: [".sot-formfield-textarea mat-form-field{width:100%}.sot-formfield-textarea mat-form-field[hidden]{display:none}.sot-formfield-textarea .sot-formfield-textarea-prefix,.sot-formfield-textarea .sot-formfield-textarea-suffix{padding:0 .5rem}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i2$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
1228
|
+
};
|
|
1229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldTextareaComponent$1, decorators: [{
|
|
1230
|
+
type: Component,
|
|
1231
|
+
args: [{ selector: 'sot-field-textarea', standalone: true, imports: [ReactiveFormsModule, NgClass, MatFormFieldModule, MatInputModule, MatButtonModule], template: "<div class=\"sot-formfield sot-formfield-textarea\" [ngClass]=\" field.className\">\n <div\n [formGroup]=\"group\"\n class=\"fr-input-group\"\n [ngClass]=\"{\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\n 'fr-input-group--valid': control && !control.untouched && control.valid ,\n 'fr-input-group--disabled': control && control.disabled,\n }\">\n <label\n class=\"fr-label\"\n [ngClass]=\"field.labelClassName\"\n [attr.for]=\"'sot-textarea-' + uuid\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"fr-hint-text\">{{ field.description }}</span>\n }\n </label>\n <div class=\"fr-input-wrap fr-input-wrap--addon\">\n @for (prefix of field.prefixes; track prefix) {\n <span class=\"sot-formfield-prefix\" matPrefix>\n @if (prefix.action) {\n <button type=\"button\"\n class=\"fr-button\"\n [attr.aria-label]=\"prefix.actionAriaLabel\"\n (click)=\"buttonAction(prefix)\"\n >{{ prefix.label }}</button>\n } @else {\n <span [innerHTML]=\"prefix.label\"></span>\n }\n </span>\n }\n\n <textarea\n class=\"fr-input\"\n [ngClass]=\"{\n 'fr-input--error': control && !control.untouched && !control.valid && !control.disabled,\n 'fr-input--valid': control && !control.untouched && control.valid ,\n 'fr-input--disabled': control && control.disabled,\n }\"\n [attr.id]=\"'sot-textarea-' + uuid\"\n [formControlName]=\"field.name\"\n [required]=\"!!required\"\n [readonly]=\"field.readonly\"\n [rows]=\"field.rows\"\n [maxlength]=\"field.maxlength ?? 10000000\">\n </textarea>\n\n @for (suffix of field.suffixes; track suffix) {\n <span class=\"sot-formfield-suffix\">\n @if (suffix.action) {\n <button type=\"button\"\n class=\"fr-button\"\n [attr.aria-label]=\"suffix.actionAriaLabel\"\n (click)=\"buttonAction(suffix)\"\n >{{ suffix.label }}</button>\n } @else {\n <span [innerHTML]=\"suffix.label\"></span>\n }\n </span>\n }\n </div>\n <div\n class=\"fr-messages-group\"\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"fr-error-text\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n</div>\n", styles: [".sot-formfield-textarea mat-form-field{width:100%}.sot-formfield-textarea mat-form-field[hidden]{display:none}.sot-formfield-textarea .sot-formfield-textarea-prefix,.sot-formfield-textarea .sot-formfield-textarea-suffix{padding:0 .5rem}\n"] }]
|
|
1232
|
+
}] });
|
|
1233
|
+
|
|
1234
|
+
let AcFieldToggleComponent$1 = class AcFieldToggleComponent extends AbstractControlFieldComponent {
|
|
1235
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1236
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldToggleComponent, isStandalone: true, selector: "sot-field-toggle", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-toogle\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-input-group\"\r\n [ngClass]=\"{\r\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input-group--valid': control && !control.untouched && control.valid ,\r\n 'fr-input-group--disabled': control && control.disabled,\r\n }\">\r\n <div class=\"fr-toggle\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"fr-toggle__input\"\r\n [attr.id]=\"'toggle-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [attr.disabled]=\"field.disabled\"/>\r\n <label\r\n class=\"fr-toggle__label\"\r\n [attr.for]=\"'toggle-' + uuid\"\r\n [attr.data-fr-checked-label]=\"field.checkedLabel\"\r\n [attr.data-fr-unchecked-label]=\"field.uncheckedLabel\"\r\n >{{ field.label }}\r\n @if (required) {\r\n <span class=\"red\">*</span>\r\n }\r\n </label>\r\n <p\r\n class=\"fr-hint-text\">\r\n {{ field.description }}\r\n </p>\r\n </div>\r\n\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.CheckboxRequiredValidator, selector: "input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]" }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "ngmodule", type: MatSlideToggleModule }] });
|
|
1237
|
+
};
|
|
1238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldToggleComponent$1, decorators: [{
|
|
1239
|
+
type: Component,
|
|
1240
|
+
args: [{ selector: 'sot-field-toggle', standalone: true, imports: [ReactiveFormsModule, NgClass, MatCheckboxModule, MatError, MatSlideToggleModule], template: "<div class=\"sot-formfield sot-formfield-toogle\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"fr-input-group\"\r\n [ngClass]=\"{\r\n 'fr-input-group--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'fr-input-group--valid': control && !control.untouched && control.valid ,\r\n 'fr-input-group--disabled': control && control.disabled,\r\n }\">\r\n <div class=\"fr-toggle\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"fr-toggle__input\"\r\n [attr.id]=\"'toggle-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [attr.disabled]=\"field.disabled\"/>\r\n <label\r\n class=\"fr-toggle__label\"\r\n [attr.for]=\"'toggle-' + uuid\"\r\n [attr.data-fr-checked-label]=\"field.checkedLabel\"\r\n [attr.data-fr-unchecked-label]=\"field.uncheckedLabel\"\r\n >{{ field.label }}\r\n @if (required) {\r\n <span class=\"red\">*</span>\r\n }\r\n </label>\r\n <p\r\n class=\"fr-hint-text\">\r\n {{ field.description }}\r\n </p>\r\n </div>\r\n\r\n <div\r\n class=\"fr-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"fr-message fr-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
1241
|
+
}] });
|
|
1242
|
+
|
|
1243
|
+
const components$1 = {
|
|
1244
|
+
group: AcGroupComponent$1,
|
|
1245
|
+
array: AcArrayComponent$1,
|
|
1246
|
+
row: AcRowComponent$1,
|
|
1247
|
+
text: AcDivTextComponent$1,
|
|
1248
|
+
checkbox: AcFieldCheckboxComponent$1,
|
|
1249
|
+
input: AcFieldInputComponent$1,
|
|
1250
|
+
password: AcFieldPasswordComponent$1,
|
|
1251
|
+
radio: AcFieldRadioButtonComponent$1,
|
|
1252
|
+
select: AcFieldSelectComponent$1,
|
|
1253
|
+
textarea: AcFieldTextareaComponent$1,
|
|
1254
|
+
toggle: AcFieldToggleComponent$1,
|
|
1255
|
+
/*
|
|
1256
|
+
date: AcFieldDateComponent,
|
|
1257
|
+
autocomplete: AcFieldAutocompleteComponent,
|
|
1258
|
+
customField: AcFieldCustomComponent,
|
|
1259
|
+
tabs: AcTabsComponent,
|
|
1260
|
+
file: AcFieldFileComponent,
|
|
1261
|
+
*/
|
|
1262
|
+
};
|
|
1263
|
+
let AcDynamicFieldDirective$1 = class AcDynamicFieldDirective {
|
|
1264
|
+
container = inject(ViewContainerRef);
|
|
1265
|
+
injector = inject(EnvironmentInjector);
|
|
1266
|
+
type = input.required(...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
1267
|
+
path = input.required(...(ngDevMode ? [{ debugName: "path" }] : []));
|
|
1268
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
|
|
1269
|
+
group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
1270
|
+
instancePath = input(...(ngDevMode ? [undefined, { debugName: "instancePath" }] : []));
|
|
1271
|
+
component;
|
|
1272
|
+
ngOnChanges(changes) {
|
|
1273
|
+
if (!components$1[this.field().type]) {
|
|
1274
|
+
const supportedTypes = Object.keys(components$1).join(", ");
|
|
1275
|
+
throw new Error(`Trying to use an unsupported type (${this.field().type}).
|
|
1276
|
+
Supported types: ${supportedTypes}`);
|
|
1277
|
+
}
|
|
1278
|
+
else {
|
|
1279
|
+
if (!this.component || changes["type"]) {
|
|
1280
|
+
this.container.clear();
|
|
1281
|
+
this.component = this.container.createComponent(components$1[this.field().type], {
|
|
1282
|
+
environmentInjector: this.injector
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
this.component.instance.field = this.field();
|
|
1286
|
+
this.component.instance.group = this.group();
|
|
1287
|
+
this.component.instance.instancePath = this.instancePath();
|
|
1288
|
+
this.component.instance.path = this.path();
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDynamicFieldDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1292
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: AcDynamicFieldDirective, isStandalone: true, selector: "[sotDynamicField]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, path: { classPropertyName: "path", publicName: "path", isSignal: true, isRequired: true, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null }, instancePath: { classPropertyName: "instancePath", publicName: "instancePath", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0 });
|
|
1293
|
+
};
|
|
1294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDynamicFieldDirective$1, decorators: [{
|
|
1295
|
+
type: Directive,
|
|
1296
|
+
args: [{
|
|
1297
|
+
selector: "[sotDynamicField]",
|
|
1298
|
+
standalone: true
|
|
1299
|
+
}]
|
|
1300
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], path: [{ type: i0.Input, args: [{ isSignal: true, alias: "path", required: true }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }], instancePath: [{ type: i0.Input, args: [{ isSignal: true, alias: "instancePath", required: false }] }] } });
|
|
1301
|
+
|
|
1302
|
+
class AcDsfrDynamicFormComponent {
|
|
1303
|
+
dynamicFormService = inject(DynamicFormService);
|
|
1304
|
+
destroyRef = inject(DestroyRef);
|
|
1305
|
+
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
1306
|
+
initialValues = input(...(ngDevMode ? [undefined, { debugName: "initialValues" }] : []));
|
|
1307
|
+
formCancel = output();
|
|
1308
|
+
formSubmit = output();
|
|
1309
|
+
formChange = output();
|
|
1310
|
+
get form() {
|
|
1311
|
+
return this.dynamicFormService.form;
|
|
1312
|
+
}
|
|
1313
|
+
get controls() {
|
|
1314
|
+
return this.form ? this.form.controls : null;
|
|
1315
|
+
}
|
|
1316
|
+
get changes() {
|
|
1317
|
+
return this.form ? this.form.valueChanges : null;
|
|
1318
|
+
}
|
|
1319
|
+
get valid() {
|
|
1320
|
+
return this.form ? this.form.valid : null;
|
|
1321
|
+
}
|
|
1322
|
+
get value() {
|
|
1323
|
+
return this.form ? this.form.value : null;
|
|
1324
|
+
}
|
|
1325
|
+
constructor() {
|
|
1326
|
+
effect(() => {
|
|
1327
|
+
if (!this.form && this.config() != null) {
|
|
1328
|
+
this.createForm();
|
|
1329
|
+
}
|
|
1330
|
+
if (this.initialValues() && this.form && this.form.pristine) {
|
|
1331
|
+
this.setValue(this.initialValues());
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
createForm() {
|
|
1336
|
+
this.dynamicFormService.createForm(this.config().fields, this.config().validations, this.config().updateOn, this.initialValues());
|
|
1337
|
+
this.formChange.emit(this.form);
|
|
1338
|
+
this.form.valueChanges
|
|
1339
|
+
.pipe(distinctUntilChanged(), debounceTime(this.config().debounceTime ?? 0), takeUntilDestroyed(this.destroyRef))
|
|
1340
|
+
.subscribe(() => {
|
|
1341
|
+
this.formChange.emit(this.form);
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
setValue(values) {
|
|
1345
|
+
this.form.setValue(values);
|
|
1346
|
+
this.form.updateValueAndValidity();
|
|
1347
|
+
}
|
|
1348
|
+
onClickButton(button) {
|
|
1349
|
+
if (button.type === 'reset') {
|
|
1350
|
+
this.reset();
|
|
1351
|
+
}
|
|
1352
|
+
if (button.action) {
|
|
1353
|
+
button.action(this.form);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
reset() {
|
|
1357
|
+
this.form.reset();
|
|
1358
|
+
this.formCancel.emit();
|
|
1359
|
+
}
|
|
1360
|
+
handleSubmit(event) {
|
|
1361
|
+
if (event) {
|
|
1362
|
+
event.preventDefault();
|
|
1363
|
+
event.stopPropagation();
|
|
1364
|
+
}
|
|
1365
|
+
if (this.form.valid) {
|
|
1366
|
+
this.formSubmit.emit(this.form);
|
|
1367
|
+
}
|
|
1368
|
+
else {
|
|
1369
|
+
this.form.markAllAsTouched();
|
|
1370
|
+
_.defer(() => {
|
|
1371
|
+
this.focusFirstInvalidControl();
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
focusFirstInvalidControl() {
|
|
1376
|
+
// TODO
|
|
1377
|
+
}
|
|
1378
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDsfrDynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1379
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcDsfrDynamicFormComponent, isStandalone: true, selector: "sot-dsfr-dynamic-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, initialValues: { classPropertyName: "initialValues", publicName: "initialValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formCancel: "formCancel", formSubmit: "formSubmit", formChange: "formChange" }, providers: [DynamicFormService], exportAs: ["dynamicForm"], ngImport: i0, template: "@if (form && config()) {\r\n <form class=\"dynamic-form\"\r\n [formGroup]=\"form\"\r\n (submit)=\"handleSubmit($event)\"\r\n [ngClass]=\"config()!.className?.form\">\r\n @if (this.config()!.fields) {\r\n <div class=\"dynamic-form-content\"\r\n [ngClass]=\"config()!.className?.formContent\">\r\n @for (field of config()!.fields; track field.type + field.name) {\r\n <div [hidden]=\"!!field.hidden\"\r\n [ngClass]=\"field.hostClassName\">\r\n <ng-container\r\n sotDynamicField\r\n [path]=\"field.name\"\r\n [type]=\"field.type\"\r\n [field]=\"field\"\r\n [group]=\"form\"\r\n >\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- TODO Revoir l'affichage des erreurs -->\r\n @if (config()!.validations && form && !form.untouched && form.invalid) {\r\n <mat-error class=\"dynamic-form-error\">\r\n @for (validation of config()!.validations!; track validation) {\r\n @if (form.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n @if (config()!.buttons) {\r\n <div class=\"dynamic-form-buttons\" [ngClass]=\"config()!.className?.formButtons\">\r\n @for (button of config()!.buttons; track $index) {\r\n <!-- TODO\r\n <sot-button [type]=\"button.type\"\r\n [className]=\"button.className\"\r\n [matType]=\"button.matButtonType ?? 'raised'\"\r\n [disabled]=\"button.disabledIfFormNoValid && form.invalid\"\r\n [matIcon]=\"button.matIcon\"\r\n [label]=\"button.label\"\r\n [title]=\"button.title\"\r\n [ariaLabel]=\"button.ariaLabel\"\r\n (buttonClick)=\"onClickButton(button)\"\r\n ></sot-button>\r\n -->\r\n }\r\n </div>\r\n }\r\n </form>\r\n}\r\n", styles: [".dynamic-form-horizontal{display:flex;flex-direction:row;flex-wrap:wrap}.dynamic-form-buttons{display:flex;flex-direction:row;gap:2rem;margin-bottom:2rem}.dynamic-form-error{margin-bottom:2rem}\n"], dependencies: [{ kind: "directive", type: AcDynamicFieldDirective$1, selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
1380
|
+
}
|
|
1381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDsfrDynamicFormComponent, decorators: [{
|
|
1382
|
+
type: Component,
|
|
1383
|
+
args: [{ exportAs: 'dynamicForm', selector: 'sot-dsfr-dynamic-form', standalone: true, imports: [AcDynamicFieldDirective$1, NgClass, ReactiveFormsModule, MatError, MatIconModule, MatButtonModule], providers: [DynamicFormService], template: "@if (form && config()) {\r\n <form class=\"dynamic-form\"\r\n [formGroup]=\"form\"\r\n (submit)=\"handleSubmit($event)\"\r\n [ngClass]=\"config()!.className?.form\">\r\n @if (this.config()!.fields) {\r\n <div class=\"dynamic-form-content\"\r\n [ngClass]=\"config()!.className?.formContent\">\r\n @for (field of config()!.fields; track field.type + field.name) {\r\n <div [hidden]=\"!!field.hidden\"\r\n [ngClass]=\"field.hostClassName\">\r\n <ng-container\r\n sotDynamicField\r\n [path]=\"field.name\"\r\n [type]=\"field.type\"\r\n [field]=\"field\"\r\n [group]=\"form\"\r\n >\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <!-- TODO Revoir l'affichage des erreurs -->\r\n @if (config()!.validations && form && !form.untouched && form.invalid) {\r\n <mat-error class=\"dynamic-form-error\">\r\n @for (validation of config()!.validations!; track validation) {\r\n @if (form.hasError(validation.name)) {\r\n {{ validation.message }}\r\n }\r\n }\r\n </mat-error>\r\n }\r\n @if (config()!.buttons) {\r\n <div class=\"dynamic-form-buttons\" [ngClass]=\"config()!.className?.formButtons\">\r\n @for (button of config()!.buttons; track $index) {\r\n <!-- TODO\r\n <sot-button [type]=\"button.type\"\r\n [className]=\"button.className\"\r\n [matType]=\"button.matButtonType ?? 'raised'\"\r\n [disabled]=\"button.disabledIfFormNoValid && form.invalid\"\r\n [matIcon]=\"button.matIcon\"\r\n [label]=\"button.label\"\r\n [title]=\"button.title\"\r\n [ariaLabel]=\"button.ariaLabel\"\r\n (buttonClick)=\"onClickButton(button)\"\r\n ></sot-button>\r\n -->\r\n }\r\n </div>\r\n }\r\n </form>\r\n}\r\n", styles: [".dynamic-form-horizontal{display:flex;flex-direction:row;flex-wrap:wrap}.dynamic-form-buttons{display:flex;flex-direction:row;gap:2rem;margin-bottom:2rem}.dynamic-form-error{margin-bottom:2rem}\n"] }]
|
|
1384
|
+
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], initialValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValues", required: false }] }], formCancel: [{ type: i0.Output, args: ["formCancel"] }], formSubmit: [{ type: i0.Output, args: ["formSubmit"] }], formChange: [{ type: i0.Output, args: ["formChange"] }] } });
|
|
1385
|
+
|
|
1386
|
+
class AcDivTextComponent extends AbstractFieldComponent {
|
|
1387
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDivTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1388
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcDivTextComponent, isStandalone: true, selector: "sot-div-text", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-text\" [ngClass]=\"field.className\">\n <div [innerHTML]=\"field.label\"></div>\n @if(field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1389
|
+
}
|
|
1390
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDivTextComponent, decorators: [{
|
|
1391
|
+
type: Component,
|
|
1392
|
+
args: [{ selector: 'sot-div-text', standalone: true, imports: [NgClass], template: "<div class=\"sot-formfield sot-formfield-text\" [ngClass]=\"field.className\">\n <div [innerHTML]=\"field.label\"></div>\n @if(field.description) {\n <p [innerHTML]=\"field.description\"></p>\n }\n</div>\n" }]
|
|
1393
|
+
}] });
|
|
1394
|
+
|
|
1395
|
+
class AcFieldCheckboxComponent extends AbstractControlFieldComponent {
|
|
1396
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1397
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldCheckboxComponent, isStandalone: true, selector: "sot-field-checkbox", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-checkbox\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\">\r\n <input\r\n type=\"checkbox\"\r\n [formControlName]=\"field.name\"\r\n [attr.id]=\"'sot-checkbox-' + uuid\"\r\n [ngClass]=\"{\r\n 'sot-checkbox--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-checkbox--valid': control && !control.untouched && control.valid,\r\n 'sot-checkbox--disabled': control && control.disabled,\r\n }\" />\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-checkbox-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-checkbox-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1398
|
+
}
|
|
1399
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldCheckboxComponent, decorators: [{
|
|
1400
|
+
type: Component,
|
|
1401
|
+
args: [{ selector: 'sot-field-checkbox', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-checkbox\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\">\r\n <input\r\n type=\"checkbox\"\r\n [formControlName]=\"field.name\"\r\n [attr.id]=\"'sot-checkbox-' + uuid\"\r\n [ngClass]=\"{\r\n 'sot-checkbox--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-checkbox--valid': control && !control.untouched && control.valid,\r\n 'sot-checkbox--disabled': control && control.disabled,\r\n }\" />\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-checkbox-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-checkbox-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
1402
|
+
}] });
|
|
1403
|
+
|
|
1404
|
+
class AcFieldInputComponent extends AbstractControlFieldComponent {
|
|
1405
|
+
inputType = 'text';
|
|
1406
|
+
buttonAction(b) {
|
|
1407
|
+
if (b.action && this.field && this.group) {
|
|
1408
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
ngOnInit() {
|
|
1412
|
+
super.ngOnInit();
|
|
1413
|
+
this.inputType = this.field.inputType ?? 'text';
|
|
1414
|
+
const control = this.group.get(this.field.name);
|
|
1415
|
+
if (control) {
|
|
1416
|
+
control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
1417
|
+
if (value?.length == 0) {
|
|
1418
|
+
control.setValue(null);
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1424
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldInputComponent, isStandalone: true, selector: "sot-field-input", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-input\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': (control && control.disabled),\r\n }\">\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"sot-input-wrapper\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\">\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"sot-input\"\r\n [ngClass]=\"{\r\n 'sot-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-input--valid': control && !control.untouched && control.valid,\r\n 'sot-input--disabled': (control && control.disabled),\r\n }\"\r\n [type]=\"field.inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [readonly]=\"field.readonly\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\">\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-input{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1425
|
+
}
|
|
1426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldInputComponent, decorators: [{
|
|
1427
|
+
type: Component,
|
|
1428
|
+
args: [{ selector: 'sot-field-input', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-input\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': (control && control.disabled),\r\n }\">\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"sot-input-wrapper\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\">\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"sot-input\"\r\n [ngClass]=\"{\r\n 'sot-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-input--valid': control && !control.untouched && control.valid,\r\n 'sot-input--disabled': (control && control.disabled),\r\n }\"\r\n [type]=\"field.inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [readonly]=\"field.readonly\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\">\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-input{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\n"] }]
|
|
1429
|
+
}] });
|
|
1430
|
+
|
|
1431
|
+
class AcGroupComponent extends AbstractControlFieldComponent {
|
|
1432
|
+
get subGroup() {
|
|
1433
|
+
return this.group.controls[this.field.name];
|
|
1434
|
+
}
|
|
1435
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1436
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcGroupComponent, isStandalone: true, selector: "sot-group", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-group\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield\"\n [ngClass]=\"{\n 'sot-accordion': field.accordion,\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-formfield--valid': control && !control.untouched && control.valid,\n 'sot-formfield--disabled': (control && control.disabled),\n }\"\n >\n @if (field.accordion) {\n <legend\n class=\"sot-accordion-title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"sot-accordion-button\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'group-content-' + uuid\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n </button>\n </legend>\n\n <div\n class=\"sot-collapse sot-accordion-content sot-fieldset-content\"\n [ngClass]=\"{ 'sot-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'group-content-' + uuid\">\n @if (field.description) {\n <p class=\"sot-label-description\">{{ field.description }}</p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n\n\n } @else {\n <legend\n class=\"sot-fieldset-legend\"\n [ngClass]=\"field.labelClassName\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </legend>\n <div class=\"sot-fieldset-content\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n @for (f of field.fields; track f.type + f.name) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"subGroup\"\n [instancePath]=\"instancePath\"\n ></ng-container>\n </div>\n }\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-group-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n</ng-template>\n", styles: ["fieldset{border:none;padding:0;margin:0}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1437
|
+
}
|
|
1438
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcGroupComponent, decorators: [{
|
|
1439
|
+
type: Component,
|
|
1440
|
+
args: [{ selector: 'sot-group', standalone: true, imports: [
|
|
1441
|
+
forwardRef(() => AcDynamicFieldDirective),
|
|
1442
|
+
NgClass,
|
|
1443
|
+
NgTemplateOutlet
|
|
1444
|
+
], template: "<div class=\"sot-formfield sot-formfield-group\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield\"\n [ngClass]=\"{\n 'sot-accordion': field.accordion,\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-formfield--valid': control && !control.untouched && control.valid,\n 'sot-formfield--disabled': (control && control.disabled),\n }\"\n >\n @if (field.accordion) {\n <legend\n class=\"sot-accordion-title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"sot-accordion-button\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'group-content-' + uuid\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n </button>\n </legend>\n\n <div\n class=\"sot-collapse sot-accordion-content sot-fieldset-content\"\n [ngClass]=\"{ 'sot-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'group-content-' + uuid\">\n @if (field.description) {\n <p class=\"sot-label-description\">{{ field.description }}</p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n\n\n } @else {\n <legend\n class=\"sot-fieldset-legend\"\n [ngClass]=\"field.labelClassName\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </legend>\n <div class=\"sot-fieldset-content\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n @for (f of field.fields; track f.type + f.name) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"subGroup\"\n [instancePath]=\"instancePath\"\n ></ng-container>\n </div>\n }\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-group-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n</ng-template>\n", styles: ["fieldset{border:none;padding:0;margin:0}\n"] }]
|
|
1445
|
+
}] });
|
|
1446
|
+
|
|
1447
|
+
class AcArrayComponent extends AbstractControlFieldComponent {
|
|
1448
|
+
dynamicService = inject(DynamicFormService);
|
|
1449
|
+
ref = inject(ChangeDetectorRef);
|
|
1450
|
+
get array() {
|
|
1451
|
+
return this.group.controls[this.field.name];
|
|
1452
|
+
}
|
|
1453
|
+
constructor() {
|
|
1454
|
+
super();
|
|
1455
|
+
}
|
|
1456
|
+
addItem() {
|
|
1457
|
+
const i = this.field.instances.length > 0 ? this.field.instances[this.field.instances.length - 1].number + 1 : 0;
|
|
1458
|
+
const fields = _.cloneDeep(this.field.field.fields);
|
|
1459
|
+
const grp = this.dynamicService.createGroup(fields, `${this.path}[${i}]`, null);
|
|
1460
|
+
this.field.instances.push({
|
|
1461
|
+
number: i,
|
|
1462
|
+
group: grp,
|
|
1463
|
+
fields
|
|
1464
|
+
});
|
|
1465
|
+
this.array.push(grp);
|
|
1466
|
+
this.ref.detectChanges();
|
|
1467
|
+
}
|
|
1468
|
+
deleteItem(index, inst) {
|
|
1469
|
+
/*
|
|
1470
|
+
TODO
|
|
1471
|
+
this.field.instances!.splice(index, 1);
|
|
1472
|
+
for (const key of this.dynamicService.pathFieldMap.keys()) {
|
|
1473
|
+
if (key.startsWith(`${this.path}[${inst.number}]`)) {
|
|
1474
|
+
this.dynamicFormService.pathFieldMap.delete(key);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
*/
|
|
1479
|
+
this.array.removeAt(index);
|
|
1480
|
+
this.ref.detectChanges();
|
|
1481
|
+
}
|
|
1482
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcArrayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1483
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcArrayComponent, isStandalone: true, selector: "sot-array", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-array\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield-wrapper sot-fieldset\"\n [ngClass]=\"{\n 'sot-accordion': field.accordion,\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-formfield--valid': control && !control.untouched && control.valid,\n 'sot-formfield--disabled': (control && control.disabled),\n }\"\n >\n @if (field.accordion) {\n <legend\n class=\"sot-accordion-title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"sot-accordion-button\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'array-content-' + uuid\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n </button>\n </legend>\n <div\n class=\"sot-collapse sot-accordion-content sot-fieldset-content\"\n [ngClass]=\"{ 'sot-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'array-content-' + uuid\">\n @if (field.description) {\n <p class=\"sot-label-description\">{{ field.description }}</p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n } @else {\n <legend\n class=\"sot-fieldset-legend\"\n [ngClass]=\"field.labelClassName\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </legend>\n <div class=\"sot-fieldset-content\"\n [attr.id]=\"'array-content-' + uuid\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"sot-formfield-array\" [formGroup]=\"group\">\n <div [formArrayName]=\"field.name\">\n @for (inst of field.instances; track inst; let i = $index) {\n <fieldset class=\"sot-formfield-array-element\"\n [ngClass]=\"field.elementClassName\">\n <legend class=\"sot-formfield-array-element-label\">\n {{ field.itemLabel ?? 'Item' }} {{ inst.number + 1 }}\n </legend>\n <div class=\"sot-formfield-array-element-content\"\n [ngClass]=\"field.elementContentClassName\">\n @for (f of inst.fields; track f.name + f.type) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"inst.group\"\n [instancePath]=\"path + '[' + inst.number + ']'\"\n ></ng-container>\n </div>\n }\n </div>\n <div class=\"sot-formfield-array-element-action\">\n @if (!field.disabled && (!field.minNbRow || field.minNbRow < array.controls.length)) {\n <button type=\"button\"\n class=\"sot-button\"\n (click)=\"deleteItem(i, inst)\"\n >\n {{ field.deleteButton?.label ?? 'Delete' }}\n </button>\n }\n </div>\n </fieldset>\n }\n @if (!field.disabled && (!field.maxNbRow || field.maxNbRow > array.controls.length)) {\n <div class=\"sot-formfield-array-add-button\">\n <button type=\"button\"\n class=\"sot-button\"\n (click)=\"addItem()\"\n >\n {{ field.addButton?.label ?? 'Add' }}\n </button>\n </div>\n }\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-array-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n </div>\n</ng-template>\n", styles: ["fieldset.dynamic-field-array{border:none;padding:0;margin:0}.dynamic-field-array-add-button{padding:2rem 0}.dynamic-field-array{margin-bottom:2rem}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => i1.NgControlStatusGroup), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i0.forwardRef(() => i1.FormGroupDirective), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i0.forwardRef(() => i1.FormArrayName), selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i0.forwardRef(() => NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1484
|
+
}
|
|
1485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcArrayComponent, decorators: [{
|
|
1486
|
+
type: Component,
|
|
1487
|
+
args: [{ selector: "sot-array", standalone: true, imports: [
|
|
1488
|
+
forwardRef(() => AcDynamicFieldDirective),
|
|
1489
|
+
NgClass,
|
|
1490
|
+
ReactiveFormsModule,
|
|
1491
|
+
NgTemplateOutlet
|
|
1492
|
+
], template: "<div class=\"sot-formfield sot-formfield-array\" [ngClass]=\"field.className\">\n <fieldset\n class=\"sot-formfield-wrapper sot-fieldset\"\n [ngClass]=\"{\n 'sot-accordion': field.accordion,\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-formfield--valid': control && !control.untouched && control.valid,\n 'sot-formfield--disabled': (control && control.disabled),\n }\"\n >\n @if (field.accordion) {\n <legend\n class=\"sot-accordion-title\"\n [ngClass]=\"field.labelClassName\">\n <button\n type=\"button\"\n class=\"sot-accordion-button\"\n [attr.aria-expanded]=\"!!field.opened\"\n [attr.aria-controls]=\"'array-content-' + uuid\">\n {{ field.label }}\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n </button>\n </legend>\n <div\n class=\"sot-collapse sot-accordion-content sot-fieldset-content\"\n [ngClass]=\"{ 'sot-collapse--expanded': !!field.opened }\"\n [attr.id]=\"'array-content-' + uuid\">\n @if (field.description) {\n <p class=\"sot-label-description\">{{ field.description }}</p>\n }\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n } @else {\n <legend\n class=\"sot-fieldset-legend\"\n [ngClass]=\"field.labelClassName\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </legend>\n <div class=\"sot-fieldset-content\"\n [attr.id]=\"'array-content-' + uuid\">\n <div *ngTemplateOutlet=\"groupFields\"></div>\n </div>\n }\n </fieldset>\n</div>\n\n<ng-template #groupFields>\n <div class=\"sot-formfield-array\" [formGroup]=\"group\">\n <div [formArrayName]=\"field.name\">\n @for (inst of field.instances; track inst; let i = $index) {\n <fieldset class=\"sot-formfield-array-element\"\n [ngClass]=\"field.elementClassName\">\n <legend class=\"sot-formfield-array-element-label\">\n {{ field.itemLabel ?? 'Item' }} {{ inst.number + 1 }}\n </legend>\n <div class=\"sot-formfield-array-element-content\"\n [ngClass]=\"field.elementContentClassName\">\n @for (f of inst.fields; track f.name + f.type) {\n <div [hidden]=\"f.hidden\" [ngClass]=\"f.hostClassName\">\n <ng-container sotDynamicField\n [type]=\"f.type\"\n [path]=\"path + '.' + f.name\"\n [field]=\"f\"\n [group]=\"inst.group\"\n [instancePath]=\"path + '[' + inst.number + ']'\"\n ></ng-container>\n </div>\n }\n </div>\n <div class=\"sot-formfield-array-element-action\">\n @if (!field.disabled && (!field.minNbRow || field.minNbRow < array.controls.length)) {\n <button type=\"button\"\n class=\"sot-button\"\n (click)=\"deleteItem(i, inst)\"\n >\n {{ field.deleteButton?.label ?? 'Delete' }}\n </button>\n }\n </div>\n </fieldset>\n }\n @if (!field.disabled && (!field.maxNbRow || field.maxNbRow > array.controls.length)) {\n <div class=\"sot-formfield-array-add-button\">\n <button type=\"button\"\n class=\"sot-button\"\n (click)=\"addItem()\"\n >\n {{ field.addButton?.label ?? 'Add' }}\n </button>\n </div>\n }\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-array-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n </div>\n</ng-template>\n", styles: ["fieldset.dynamic-field-array{border:none;padding:0;margin:0}.dynamic-field-array-add-button{padding:2rem 0}.dynamic-field-array{margin-bottom:2rem}\n"] }]
|
|
1493
|
+
}], ctorParameters: () => [] });
|
|
1494
|
+
|
|
1495
|
+
class AcRowComponent extends AbstractFieldComponent {
|
|
1496
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcRowComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1497
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcRowComponent, isStandalone: true, selector: "sot-row", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-row\" [ngClass]=\"field.className\">\n @for (f of field.fields; track f.type + f.name) {\n <div\n [hidden]=\"f.hidden\"\n [ngClass]=\"f.hostClassName\">\n <ng-container\n sotDynamicField\n [path]=\"path + '.' + f.name\"\n [type]=\"f.type\"\n [field]=\"f\"\n [group]=\"group\"\n [instancePath]=\"instancePath\"\n >\n </ng-container>\n </div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => AcDynamicFieldDirective), selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }] });
|
|
1498
|
+
}
|
|
1499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcRowComponent, decorators: [{
|
|
1500
|
+
type: Component,
|
|
1501
|
+
args: [{ selector: 'sot-row', standalone: true, imports: [
|
|
1502
|
+
ReactiveFormsModule,
|
|
1503
|
+
NgClass,
|
|
1504
|
+
forwardRef(() => AcDynamicFieldDirective)
|
|
1505
|
+
], template: "<div class=\"sot-formfield sot-formfield-row\" [ngClass]=\"field.className\">\n @for (f of field.fields; track f.type + f.name) {\n <div\n [hidden]=\"f.hidden\"\n [ngClass]=\"f.hostClassName\">\n <ng-container\n sotDynamicField\n [path]=\"path + '.' + f.name\"\n [type]=\"f.type\"\n [field]=\"f\"\n [group]=\"group\"\n [instancePath]=\"instancePath\"\n >\n </ng-container>\n </div>\n }\n</div>\n" }]
|
|
1506
|
+
}] });
|
|
1507
|
+
|
|
1508
|
+
class PasswordValidators {
|
|
1509
|
+
static patternValidator(regex, error) {
|
|
1510
|
+
return (control) => {
|
|
1511
|
+
if (!control.value) {
|
|
1512
|
+
return null;
|
|
1513
|
+
}
|
|
1514
|
+
const valid = regex.test(control.value);
|
|
1515
|
+
return valid ? null : error;
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
class AcFieldPasswordComponent extends AbstractControlFieldComponent {
|
|
1521
|
+
inputType = 'password';
|
|
1522
|
+
showPasswordLabel;
|
|
1523
|
+
hidePasswordLabel;
|
|
1524
|
+
iconErrorLabel;
|
|
1525
|
+
iconSuccessLabel;
|
|
1526
|
+
buttonAction(b) {
|
|
1527
|
+
if (b.action && this.field && this.group) {
|
|
1528
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
ngOnInit() {
|
|
1532
|
+
super.ngOnInit();
|
|
1533
|
+
this.showPasswordLabel = this.field.labels?.showPassword ?? "Show password";
|
|
1534
|
+
this.hidePasswordLabel = this.field.labels?.hidePassword ?? "Hide password";
|
|
1535
|
+
this.iconSuccessLabel = this.field.labels?.iconSuccess ?? "Success";
|
|
1536
|
+
this.iconErrorLabel = this.field.labels?.iconError ?? "Error";
|
|
1537
|
+
if (this.control) {
|
|
1538
|
+
this.control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {
|
|
1539
|
+
if (value?.length == 0) {
|
|
1540
|
+
this.control.setValue(null);
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
this.setPasswordValidators();
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
tooglePassword() {
|
|
1547
|
+
this.inputType = this.inputType === 'password' ? 'text' : 'password';
|
|
1548
|
+
}
|
|
1549
|
+
get minLengthValid() {
|
|
1550
|
+
return this.control.value && !this.control.hasError("minlength");
|
|
1551
|
+
}
|
|
1552
|
+
get maxLengthValid() {
|
|
1553
|
+
return this.control.value && !this.control.hasError("maxlength");
|
|
1554
|
+
}
|
|
1555
|
+
get requiresDigitValid() {
|
|
1556
|
+
return this.control.value && !this.control.hasError("requiresDigit");
|
|
1557
|
+
}
|
|
1558
|
+
get requiresUppercaseValid() {
|
|
1559
|
+
return this.control.value && !this.control.hasError("requiresUppercase");
|
|
1560
|
+
}
|
|
1561
|
+
get requiresLowercaseValid() {
|
|
1562
|
+
return this.control.value && !this.control.hasError("requiresLowercase");
|
|
1563
|
+
}
|
|
1564
|
+
get requiresSpecialCharsValid() {
|
|
1565
|
+
return this.control.value && !this.control.hasError("requiresSpecialChars");
|
|
1566
|
+
}
|
|
1567
|
+
setPasswordValidators() {
|
|
1568
|
+
if (this.field.minlength) {
|
|
1569
|
+
this.control?.addValidators(Validators.minLength(this.field.minlength));
|
|
1570
|
+
}
|
|
1571
|
+
if (this.field.maxlength) {
|
|
1572
|
+
this.control?.addValidators(Validators.maxLength(this.field.maxlength));
|
|
1573
|
+
}
|
|
1574
|
+
if (this.field.requiresDigit) {
|
|
1575
|
+
this.control?.addValidators(PasswordValidators.patternValidator(/(?=.*[0-9])/, {
|
|
1576
|
+
requiresDigit: true
|
|
1577
|
+
}));
|
|
1578
|
+
}
|
|
1579
|
+
if (this.field.requiresUppercase) {
|
|
1580
|
+
this.control?.addValidators(PasswordValidators.patternValidator(/(?=.*[A-Z])/, {
|
|
1581
|
+
requiresUppercase: true
|
|
1582
|
+
}));
|
|
1583
|
+
}
|
|
1584
|
+
if (this.field.requiresLowercase) {
|
|
1585
|
+
this.control?.addValidators(PasswordValidators.patternValidator(/(?=.*[a-z])/, {
|
|
1586
|
+
requiresLowercase: true
|
|
1587
|
+
}));
|
|
1588
|
+
}
|
|
1589
|
+
if (this.field.requiresSpecialChars) {
|
|
1590
|
+
const chars = this.field.specialChars?.join("") ?? "$@^!%*?&";
|
|
1591
|
+
const regex = "(?=.*[" + chars + "])";
|
|
1592
|
+
this.control?.addValidators(PasswordValidators.patternValidator(new RegExp(regex), {
|
|
1593
|
+
requiresSpecialChars: true
|
|
1594
|
+
}));
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldPasswordComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1598
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldPasswordComponent, isStandalone: true, selector: "sot-field-password", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-password\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': (control && control.disabled),\r\n }\">\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"sot-input-wrapper\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\">\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"sot-input\"\r\n [ngClass]=\"{\r\n 'sot-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-input--valid': control && !control.untouched && control.valid,\r\n 'sot-input--disabled': (control && control.disabled),\r\n }\"\r\n [type]=\"inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n <button type=\"button\" class=\"sot-button\"\r\n (click)=\"tooglePassword()\"\r\n [attr.aria-label]=\"inputType === 'password' ? showPasswordLabel : hidePasswordLabel\"\r\n [attr.aria-pressed]=\"inputType === 'password'\">\r\n @if(inputType === 'password') {\r\n <span aria-hidden=\"true\" class=\"sot-icon-eye-off-fill\"></span>\r\n } @else {\r\n <span aria-hidden=\"true\" class=\"sot-icon-eye-fill\"></span>\r\n }\r\n </button>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\">\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n <ul class=\"password-description\" [id]=\"uuid + '-description'\">\r\n @if (field.minlength) {\r\n <li [ngClass]=\"{ 'text-success': minLengthValid, 'text-error': !minLengthValid }\">\r\n <span [ngClass]=\"minLengthValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.minlength ?? \"Must be at least 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.maxlength) {\r\n <li [ngClass]=\"{ 'text-success': maxLengthValid, 'text-error': !maxLengthValid }\">\r\n <span [ngClass]=\"maxLengthValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"maxLengthValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.maxlength ?? \"Must be at most 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.requiresDigit) {\r\n <li [ngClass]=\"{ 'text-success': requiresDigitValid, 'text-error': !requiresDigitValid }\">\r\n <span [ngClass]=\"requiresDigitValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresDigitValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresDigit ?? \"Must contain at least 1 digit\" }}\r\n </li>\r\n }\r\n @if (field.requiresUppercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresUppercaseValid, 'text-error': !requiresUppercaseValid }\">\r\n <span [ngClass]=\"requiresUppercaseValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresUppercaseValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresUppercase ?? \"Must contain at least 1 uppercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresLowercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresLowercaseValid, 'text-error': !requiresLowercaseValid }\">\r\n <span [ngClass]=\"requiresLowercaseValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresLowercaseValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresLowercase ?? \"Must contain at least 1 lowercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresSpecialChars) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresSpecialCharsValid, 'text-error': !requiresSpecialCharsValid }\">\r\n <span [ngClass]=\"requiresSpecialCharsValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresSpecialCharsValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresSpecialChars ?? \"Must contain at least 1 special character\" }}\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}.password-description{list-style-type:none;margin-block-start:0}.password-description li{display:flex;flex-direction:row;align-items:center}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1599
|
+
}
|
|
1600
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldPasswordComponent, decorators: [{
|
|
1601
|
+
type: Component,
|
|
1602
|
+
args: [{ selector: 'sot-field-password', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-password\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': (control && control.disabled),\r\n }\">\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-input-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"sot-input-wrapper\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\">\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n\r\n <input\r\n class=\"sot-input\"\r\n [ngClass]=\"{\r\n 'sot-input--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-input--valid': control && !control.untouched && control.valid,\r\n 'sot-input--disabled': (control && control.disabled),\r\n }\"\r\n [type]=\"inputType\"\r\n [attr.id]=\"'sot-input-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [autocomplete]=\"field.autocomplete ?? 'off'\"\r\n [maxlength]=\"field.maxlength ?? 10000000\"/>\r\n\r\n <button type=\"button\" class=\"sot-button\"\r\n (click)=\"tooglePassword()\"\r\n [attr.aria-label]=\"inputType === 'password' ? showPasswordLabel : hidePasswordLabel\"\r\n [attr.aria-pressed]=\"inputType === 'password'\">\r\n @if(inputType === 'password') {\r\n <span aria-hidden=\"true\" class=\"sot-icon-eye-off-fill\"></span>\r\n } @else {\r\n <span aria-hidden=\"true\" class=\"sot-icon-eye-fill\"></span>\r\n }\r\n </button>\r\n\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\">\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n\r\n <ul class=\"password-description\" [id]=\"uuid + '-description'\">\r\n @if (field.minlength) {\r\n <li [ngClass]=\"{ 'text-success': minLengthValid, 'text-error': !minLengthValid }\">\r\n <span [ngClass]=\"minLengthValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"minLengthValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.minlength ?? \"Must be at least 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.maxlength) {\r\n <li [ngClass]=\"{ 'text-success': maxLengthValid, 'text-error': !maxLengthValid }\">\r\n <span [ngClass]=\"maxLengthValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"maxLengthValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.maxlength ?? \"Must be at most 8 characters long\" }}\r\n </li>\r\n }\r\n @if (field.requiresDigit) {\r\n <li [ngClass]=\"{ 'text-success': requiresDigitValid, 'text-error': !requiresDigitValid }\">\r\n <span [ngClass]=\"requiresDigitValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresDigitValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresDigit ?? \"Must contain at least 1 digit\" }}\r\n </li>\r\n }\r\n @if (field.requiresUppercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresUppercaseValid, 'text-error': !requiresUppercaseValid }\">\r\n <span [ngClass]=\"requiresUppercaseValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresUppercaseValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresUppercase ?? \"Must contain at least 1 uppercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresLowercase) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresLowercaseValid, 'text-error': !requiresLowercaseValid }\">\r\n <span [ngClass]=\"requiresLowercaseValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresLowercaseValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresLowercase ?? \"Must contain at least 1 lowercase character\" }}\r\n </li>\r\n }\r\n @if (field.requiresSpecialChars) {\r\n <li\r\n [ngClass]=\"{ 'text-success': requiresSpecialCharsValid, 'text-error': !requiresSpecialCharsValid }\">\r\n <span [ngClass]=\"requiresSpecialCharsValid ? 'check' : 'error'\"\r\n [attr.aria-label]=\"requiresSpecialCharsValid ? iconSuccessLabel : iconErrorLabel\"></span>\r\n {{ field.labels?.requiresSpecialChars ?? \"Must contain at least 1 special character\" }}\r\n </li>\r\n }\r\n </ul>\r\n</div>\r\n\r\n", styles: [".sot-formfield-input{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}.password-description{list-style-type:none;margin-block-start:0}.password-description li{display:flex;flex-direction:row;align-items:center}\n"] }]
|
|
1603
|
+
}] });
|
|
1604
|
+
|
|
1605
|
+
class AcFieldRadioButtonComponent extends AbstractControlFieldComponent {
|
|
1606
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldRadioButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldRadioButtonComponent, isStandalone: true, selector: "sot-field-radio-button", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-radio\" [ngClass]=\"field.className\">\r\n <fieldset\r\n class=\"sot-formfield-wrapper sot-fieldset\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\"\r\n [id]=\"'radio-' + uuid\"\r\n [attr.aria-labelledby]=\"'radio-legend-' + uuid\"\r\n [formGroup]=\"group\">\r\n <legend\r\n class=\"sot-fieldset-legend\"\r\n [ngClass]=\"field.labelClassName\"\r\n [id]=\"'radio-legend-' + uuid\">\r\n <span class=\"sot-legend-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </legend>\r\n @if (field.options) {\r\n @for (item of field.options; track item; let i = $index) {\r\n <div\r\n class=\"sot-fieldset-element\"\r\n [ngClass]=\"{ 'sot-fieldset--inline': !field.verticalAlign }\">\r\n <div class=\"sot-radio-group\">\r\n <input\r\n type=\"radio\"\r\n [id]=\"'radio-' + uuid + '-' + i\"\r\n [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [attr.name]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [attr.disabled]=\"field.disabledKey && !!item[field.disabledKey] ? true : undefined\"\r\n [ngClass]=\"{\r\n 'sot-radio--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-radio--valid': control && !control.untouched && control.valid,\r\n 'sot-radio--disabled': control && control.disabled,\r\n }\"/>\r\n <label\r\n class=\"sot-label\"\r\n [for]=\"'radio-' + uuid + '-' + i\">\r\n <span class=\"sot-label-text\"\r\n [innerHTML]=\"field.labelKey ? item[field.labelKey!] : item\"></span>\r\n @if (field.descriptionKey) {\r\n <span class=\"sot-label-description\">{{ item[field.descriptionKey] }}</span>\r\n }\r\n </label>\r\n </div>\r\n </div>\r\n }\r\n }\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-radio-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </fieldset>\r\n</div>\r\n", styles: [".verticalAlign{display:flex;flex-direction:column}.horizontalAlign{display:flex;flex-direction:row;gap:2rem}.sot-formfield-radiobutton-label{display:flex;flex-direction:column}.sot-formfield-radiobutton-item ::ng-deep label{display:flex;flex-direction:column}\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.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1608
|
+
}
|
|
1609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldRadioButtonComponent, decorators: [{
|
|
1610
|
+
type: Component,
|
|
1611
|
+
args: [{ selector: 'sot-field-radio-button', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-radio\" [ngClass]=\"field.className\">\r\n <fieldset\r\n class=\"sot-formfield-wrapper sot-fieldset\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\"\r\n [id]=\"'radio-' + uuid\"\r\n [attr.aria-labelledby]=\"'radio-legend-' + uuid\"\r\n [formGroup]=\"group\">\r\n <legend\r\n class=\"sot-fieldset-legend\"\r\n [ngClass]=\"field.labelClassName\"\r\n [id]=\"'radio-legend-' + uuid\">\r\n <span class=\"sot-legend-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </legend>\r\n @if (field.options) {\r\n @for (item of field.options; track item; let i = $index) {\r\n <div\r\n class=\"sot-fieldset-element\"\r\n [ngClass]=\"{ 'sot-fieldset--inline': !field.verticalAlign }\">\r\n <div class=\"sot-radio-group\">\r\n <input\r\n type=\"radio\"\r\n [id]=\"'radio-' + uuid + '-' + i\"\r\n [value]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [attr.name]=\"uuid\"\r\n [formControlName]=\"field.name\"\r\n [attr.disabled]=\"field.disabledKey && !!item[field.disabledKey] ? true : undefined\"\r\n [ngClass]=\"{\r\n 'sot-radio--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-radio--valid': control && !control.untouched && control.valid,\r\n 'sot-radio--disabled': control && control.disabled,\r\n }\"/>\r\n <label\r\n class=\"sot-label\"\r\n [for]=\"'radio-' + uuid + '-' + i\">\r\n <span class=\"sot-label-text\"\r\n [innerHTML]=\"field.labelKey ? item[field.labelKey!] : item\"></span>\r\n @if (field.descriptionKey) {\r\n <span class=\"sot-label-description\">{{ item[field.descriptionKey] }}</span>\r\n }\r\n </label>\r\n </div>\r\n </div>\r\n }\r\n }\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-radio-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </fieldset>\r\n</div>\r\n", styles: [".verticalAlign{display:flex;flex-direction:column}.horizontalAlign{display:flex;flex-direction:row;gap:2rem}.sot-formfield-radiobutton-label{display:flex;flex-direction:column}.sot-formfield-radiobutton-item ::ng-deep label{display:flex;flex-direction:column}\n"] }]
|
|
1612
|
+
}] });
|
|
1613
|
+
|
|
1614
|
+
class AcFieldSelectComponent extends AbstractControlFieldComponent {
|
|
1615
|
+
options = [];
|
|
1616
|
+
ngOnInit() {
|
|
1617
|
+
super.ngOnInit();
|
|
1618
|
+
if (isObservable(this.field.options)) {
|
|
1619
|
+
this.field.options.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((options) => {
|
|
1620
|
+
this.options = options;
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
else {
|
|
1624
|
+
this.options = this.field.options;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
buttonAction(b) {
|
|
1628
|
+
if (b.action && this.field && this.group) {
|
|
1629
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1633
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldSelectComponent, isStandalone: true, selector: "sot-field-select", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-select\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\">\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-select-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"sot-input-wrapper\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\">\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n <select\r\n class=\"sot-select\"\r\n [ngClass]=\"{\r\n 'sot-select--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-select--valid': control && !control.untouched && control.valid,\r\n 'sot-select--disabled': control && control.disabled,\r\n }\"\r\n [attr.id]=\"'sot-select-' + uuid\"\r\n [formControlName]=\"field.name\">\r\n @if (field.resetOption) {\r\n <option [ngValue]=\"undefined\">\r\n {{ field.resetOptionLabel }}\r\n </option>\r\n }\r\n\r\n @if (field.options) {\r\n @if (field.groupLabelKey) {\r\n @for (group of options; track group) {\r\n <optgroup [label]=\"field.groupLabelKey ? group[field.groupLabelKey] : ''\">\r\n @if (field.groupOptionsKey && group[field.groupOptionsKey]) {\r\n @for (item of group[field.groupOptionsKey]; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n </optgroup>\r\n }\r\n } @else {\r\n @for (item of options; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n\r\n }\r\n </select>\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\">\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-select-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-select{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\n"], dependencies: [{ 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.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1634
|
+
}
|
|
1635
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldSelectComponent, decorators: [{
|
|
1636
|
+
type: Component,
|
|
1637
|
+
args: [{ selector: 'sot-field-select', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-select\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\">\r\n <label\r\n class=\"sot-label\"\r\n [ngClass]=\"field.labelClassName\"\r\n [attr.for]=\"'sot-select-' + uuid\">\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n <div class=\"sot-input-wrapper\">\r\n @for (prefix of field.prefixes; track prefix) {\r\n <span class=\"sot-formfield-prefix\">\r\n @if (prefix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"prefix.actionAriaLabel\"\r\n (click)=\"buttonAction(prefix)\"\r\n >{{ prefix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"prefix.label\"></span>\r\n }\r\n </span>\r\n }\r\n <select\r\n class=\"sot-select\"\r\n [ngClass]=\"{\r\n 'sot-select--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-select--valid': control && !control.untouched && control.valid,\r\n 'sot-select--disabled': control && control.disabled,\r\n }\"\r\n [attr.id]=\"'sot-select-' + uuid\"\r\n [formControlName]=\"field.name\">\r\n @if (field.resetOption) {\r\n <option [ngValue]=\"undefined\">\r\n {{ field.resetOptionLabel }}\r\n </option>\r\n }\r\n\r\n @if (field.options) {\r\n @if (field.groupLabelKey) {\r\n @for (group of options; track group) {\r\n <optgroup [label]=\"field.groupLabelKey ? group[field.groupLabelKey] : ''\">\r\n @if (field.groupOptionsKey && group[field.groupOptionsKey]) {\r\n @for (item of group[field.groupOptionsKey]; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n </optgroup>\r\n }\r\n } @else {\r\n @for (item of options; track item) {\r\n <option\r\n [ngValue]=\"field.valueKey ? item[field.valueKey] : item\"\r\n [disabled]=\"field.disabledKey ? item[field.disabledKey] : false\">\r\n {{ field.labelKey ? item[field.labelKey!] : item }}\r\n </option>\r\n }\r\n }\r\n\r\n }\r\n </select>\r\n @for (suffix of field.suffixes; track suffix) {\r\n <span class=\"sot-formfield-suffix\">\r\n @if (suffix.action) {\r\n <button type=\"button\"\r\n class=\"sot-button\"\r\n [attr.aria-label]=\"suffix.actionAriaLabel\"\r\n (click)=\"buttonAction(suffix)\"\r\n >{{ suffix.label }}</button>\r\n } @else {\r\n <span [innerHTML]=\"suffix.label\"></span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-select-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".sot-formfield-select{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\n"] }]
|
|
1638
|
+
}] });
|
|
1639
|
+
|
|
1640
|
+
class AcFieldToggleComponent extends AbstractControlFieldComponent {
|
|
1641
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldToggleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1642
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldToggleComponent, isStandalone: true, selector: "sot-field-toggle", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-toogle\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid ,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\">\r\n <div class=\"sot-toggle\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"sot-toggle-input\"\r\n [attr.id]=\"'sot-toggle-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [attr.disabled]=\"field.disabled\"\r\n [ngClass]=\"{\r\n 'sot-toggle--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-toggle--valid': control && !control.untouched && control.valid,\r\n 'sot-toggle--disabled': control && control.disabled,\r\n }\"/>\r\n <label\r\n class=\"sot-toggle-label\"\r\n [attr.for]=\"'sot-toggle-' + uuid\"\r\n [attr.data-sot-checked-label]=\"field.checkedLabel\"\r\n [attr.data-sot-unchecked-label]=\"field.uncheckedLabel\"\r\n >\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.CheckboxRequiredValidator, selector: "input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]" }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1643
|
+
}
|
|
1644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldToggleComponent, decorators: [{
|
|
1645
|
+
type: Component,
|
|
1646
|
+
args: [{ selector: 'sot-field-toggle', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-toogle\" [ngClass]=\"field.className\">\r\n <div\r\n [formGroup]=\"group\"\r\n class=\"sot-formfield-wrapper\"\r\n [ngClass]=\"{\r\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-formfield--valid': control && !control.untouched && control.valid ,\r\n 'sot-formfield--disabled': control && control.disabled,\r\n }\">\r\n <div class=\"sot-toggle\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"sot-toggle-input\"\r\n [attr.id]=\"'sot-toggle-' + uuid\"\r\n [formControlName]=\"field.name\"\r\n [required]=\"!!required\"\r\n [attr.disabled]=\"field.disabled\"\r\n [ngClass]=\"{\r\n 'sot-toggle--error': control && !control.untouched && !control.valid && !control.disabled,\r\n 'sot-toggle--valid': control && !control.untouched && control.valid,\r\n 'sot-toggle--disabled': control && control.disabled,\r\n }\"/>\r\n <label\r\n class=\"sot-toggle-label\"\r\n [attr.for]=\"'sot-toggle-' + uuid\"\r\n [attr.data-sot-checked-label]=\"field.checkedLabel\"\r\n [attr.data-sot-unchecked-label]=\"field.uncheckedLabel\"\r\n >\r\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\r\n @if (required) {\r\n <span class=\"sot-label-required\">*</span>\r\n }\r\n @if (field.description) {\r\n <span class=\"sot-label-description\">{{ field.description }}</span>\r\n }\r\n </label>\r\n </div>\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of field.validations; track validation) {\r\n @if (control && !control.untouched && control.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
1647
|
+
}] });
|
|
1648
|
+
|
|
1649
|
+
class AcFieldTextareaComponent extends AbstractControlFieldComponent {
|
|
1650
|
+
buttonAction(b) {
|
|
1651
|
+
if (b.action && this.field && this.group) {
|
|
1652
|
+
b.action(this.field, this.group, this.dynamicFormService.data);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1656
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcFieldTextareaComponent, isStandalone: true, selector: "sot-field-textarea", usesInheritance: true, ngImport: i0, template: "<div class=\"sot-formfield sot-formfield-textarea\" [ngClass]=\" field.className\">\n <div\n [formGroup]=\"group\"\n class=\"sot-formfield-wrapper\"\n [ngClass]=\"{\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-formfield--valid': control && !control.untouched && control.valid ,\n 'sot-formfield--disabled': control && control.disabled,\n }\">\n <label\n class=\"sot-label\"\n [ngClass]=\"field.labelClassName\"\n [attr.for]=\"'sot-textarea-' + uuid\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </label>\n <div class=\"sot-input-wrapper\">\n @for (prefix of field.prefixes; track prefix) {\n <span class=\"sot-formfield-prefix\">\n @if (prefix.action) {\n <button type=\"button\"\n class=\"sot-button\"\n [attr.aria-label]=\"prefix.actionAriaLabel\"\n (click)=\"buttonAction(prefix)\"\n >{{ prefix.label }}</button>\n } @else {\n <span [innerHTML]=\"prefix.label\"></span>\n }\n </span>\n }\n\n <textarea\n class=\"sot-textarea\"\n [ngClass]=\"{\n 'sot-input--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-input--valid': control && !control.untouched && control.valid ,\n 'sot-input--disabled': control && control.disabled,\n }\"\n [attr.id]=\"'sot-textarea-' + uuid\"\n [formControlName]=\"field.name\"\n [required]=\"!!required\"\n [readonly]=\"field.readonly\"\n [rows]=\"field.rows\"\n [maxlength]=\"field.maxlength ?? 10000000\">\n </textarea>\n\n @for (suffix of field.suffixes; track suffix) {\n <span class=\"sot-formfield-suffix\">\n @if (suffix.action) {\n <button type=\"button\"\n class=\"sot-button\"\n [attr.aria-label]=\"suffix.actionAriaLabel\"\n (click)=\"buttonAction(suffix)\"\n >{{ suffix.label }}</button>\n } @else {\n <span [innerHTML]=\"suffix.label\"></span>\n }\n </span>\n }\n </div>\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n</div>\n", styles: [".sot-formfield-textarea{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\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],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1657
|
+
}
|
|
1658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcFieldTextareaComponent, decorators: [{
|
|
1659
|
+
type: Component,
|
|
1660
|
+
args: [{ selector: 'sot-field-textarea', standalone: true, imports: [ReactiveFormsModule, NgClass], template: "<div class=\"sot-formfield sot-formfield-textarea\" [ngClass]=\" field.className\">\n <div\n [formGroup]=\"group\"\n class=\"sot-formfield-wrapper\"\n [ngClass]=\"{\n 'sot-formfield--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-formfield--valid': control && !control.untouched && control.valid ,\n 'sot-formfield--disabled': control && control.disabled,\n }\">\n <label\n class=\"sot-label\"\n [ngClass]=\"field.labelClassName\"\n [attr.for]=\"'sot-textarea-' + uuid\">\n <span class=\"sot-label-text\" [innerHTML]=\"field.label\"></span>\n @if (required) {\n <span class=\"sot-label-required\">*</span>\n }\n @if (field.description) {\n <span class=\"sot-label-description\">{{ field.description }}</span>\n }\n </label>\n <div class=\"sot-input-wrapper\">\n @for (prefix of field.prefixes; track prefix) {\n <span class=\"sot-formfield-prefix\">\n @if (prefix.action) {\n <button type=\"button\"\n class=\"sot-button\"\n [attr.aria-label]=\"prefix.actionAriaLabel\"\n (click)=\"buttonAction(prefix)\"\n >{{ prefix.label }}</button>\n } @else {\n <span [innerHTML]=\"prefix.label\"></span>\n }\n </span>\n }\n\n <textarea\n class=\"sot-textarea\"\n [ngClass]=\"{\n 'sot-input--error': control && !control.untouched && !control.valid && !control.disabled,\n 'sot-input--valid': control && !control.untouched && control.valid ,\n 'sot-input--disabled': control && control.disabled,\n }\"\n [attr.id]=\"'sot-textarea-' + uuid\"\n [formControlName]=\"field.name\"\n [required]=\"!!required\"\n [readonly]=\"field.readonly\"\n [rows]=\"field.rows\"\n [maxlength]=\"field.maxlength ?? 10000000\">\n </textarea>\n\n @for (suffix of field.suffixes; track suffix) {\n <span class=\"sot-formfield-suffix\">\n @if (suffix.action) {\n <button type=\"button\"\n class=\"sot-button\"\n [attr.aria-label]=\"suffix.actionAriaLabel\"\n (click)=\"buttonAction(suffix)\"\n >{{ suffix.label }}</button>\n } @else {\n <span [innerHTML]=\"suffix.label\"></span>\n }\n </span>\n }\n </div>\n <div\n class=\"sot-messages-group\"\n [attr.id]=\"'sot-input-' + uuid + '-error'\"\n aria-live=\"assertive\">\n @for (validation of field.validations; track validation) {\n @if (control && !control.untouched && control.hasError(validation.name)) {\n <p class=\"sot-message sot-message--error\">\n {{ validation.message }}\n </p>\n }\n }\n </div>\n </div>\n</div>\n", styles: [".sot-formfield-textarea{width:100%}.sot-formfield-prefix,.sot-formfield-suffix{padding:0 .5rem}\n"] }]
|
|
1661
|
+
}] });
|
|
1662
|
+
|
|
1663
|
+
const components = {
|
|
1664
|
+
group: AcGroupComponent,
|
|
1665
|
+
array: AcArrayComponent,
|
|
1666
|
+
row: AcRowComponent,
|
|
1667
|
+
text: AcDivTextComponent,
|
|
1668
|
+
checkbox: AcFieldCheckboxComponent,
|
|
1669
|
+
input: AcFieldInputComponent,
|
|
1670
|
+
password: AcFieldPasswordComponent,
|
|
1671
|
+
radio: AcFieldRadioButtonComponent,
|
|
1672
|
+
select: AcFieldSelectComponent,
|
|
1673
|
+
textarea: AcFieldTextareaComponent,
|
|
1674
|
+
toggle: AcFieldToggleComponent,
|
|
1675
|
+
/*
|
|
1676
|
+
date: AcFieldDateComponent,
|
|
1677
|
+
autocomplete: AcFieldAutocompleteComponent,
|
|
1678
|
+
customField: AcFieldCustomComponent,
|
|
1679
|
+
tabs: AcTabsComponent,
|
|
1680
|
+
file: AcFieldFileComponent,
|
|
1681
|
+
|
|
1682
|
+
*/
|
|
1683
|
+
};
|
|
1684
|
+
class AcDynamicFieldDirective {
|
|
1685
|
+
container = inject(ViewContainerRef);
|
|
1686
|
+
injector = inject(EnvironmentInjector);
|
|
1687
|
+
type = input.required(...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
1688
|
+
path = input.required(...(ngDevMode ? [{ debugName: "path" }] : []));
|
|
1689
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
|
|
1690
|
+
group = input.required(...(ngDevMode ? [{ debugName: "group" }] : []));
|
|
1691
|
+
instancePath = input(...(ngDevMode ? [undefined, { debugName: "instancePath" }] : []));
|
|
1692
|
+
component;
|
|
1693
|
+
ngOnChanges(changes) {
|
|
1694
|
+
if (!components[this.field().type]) {
|
|
1695
|
+
const supportedTypes = Object.keys(components).join(", ");
|
|
1696
|
+
throw new Error(`Trying to use an unsupported type (${this.field().type}).
|
|
1697
|
+
Supported types: ${supportedTypes}`);
|
|
1698
|
+
}
|
|
1699
|
+
else {
|
|
1700
|
+
if (!this.component || changes["type"]) {
|
|
1701
|
+
this.container.clear();
|
|
1702
|
+
this.component = this.container.createComponent(components[this.field().type], {
|
|
1703
|
+
environmentInjector: this.injector
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
this.component.instance.field = this.field();
|
|
1707
|
+
this.component.instance.group = this.group();
|
|
1708
|
+
this.component.instance.instancePath = this.instancePath();
|
|
1709
|
+
this.component.instance.path = this.path();
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDynamicFieldDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1713
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: AcDynamicFieldDirective, isStandalone: true, selector: "[sotDynamicField]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, path: { classPropertyName: "path", publicName: "path", isSignal: true, isRequired: true, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null }, instancePath: { classPropertyName: "instancePath", publicName: "instancePath", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0 });
|
|
1714
|
+
}
|
|
1715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcDynamicFieldDirective, decorators: [{
|
|
1716
|
+
type: Directive,
|
|
1717
|
+
args: [{
|
|
1718
|
+
selector: "[sotDynamicField]",
|
|
1719
|
+
standalone: true
|
|
1720
|
+
}]
|
|
1721
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], path: [{ type: i0.Input, args: [{ isSignal: true, alias: "path", required: true }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }], instancePath: [{ type: i0.Input, args: [{ isSignal: true, alias: "instancePath", required: false }] }] } });
|
|
1722
|
+
|
|
1723
|
+
class AcClassicDynamicFormComponent {
|
|
1724
|
+
dynamicFormService = inject(DynamicFormService);
|
|
1725
|
+
destroyRef = inject(DestroyRef);
|
|
1726
|
+
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
1727
|
+
initialValues = input(...(ngDevMode ? [undefined, { debugName: "initialValues" }] : []));
|
|
1728
|
+
formCancel = output();
|
|
1729
|
+
formSubmit = output();
|
|
1730
|
+
formChange = output();
|
|
1731
|
+
get form() {
|
|
1732
|
+
return this.dynamicFormService.form;
|
|
1733
|
+
}
|
|
1734
|
+
get controls() {
|
|
1735
|
+
return this.form ? this.form.controls : null;
|
|
1736
|
+
}
|
|
1737
|
+
get changes() {
|
|
1738
|
+
return this.form ? this.form.valueChanges : null;
|
|
1739
|
+
}
|
|
1740
|
+
get valid() {
|
|
1741
|
+
return this.form ? this.form.valid : null;
|
|
1742
|
+
}
|
|
1743
|
+
get value() {
|
|
1744
|
+
return this.form ? this.form.value : null;
|
|
1745
|
+
}
|
|
1746
|
+
constructor() {
|
|
1747
|
+
effect(() => {
|
|
1748
|
+
if (!this.form && this.config() != null) {
|
|
1749
|
+
this.createForm();
|
|
1750
|
+
}
|
|
1751
|
+
if (this.initialValues() && this.form && this.form.pristine) {
|
|
1752
|
+
this.setValue(this.initialValues());
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
createForm() {
|
|
1757
|
+
this.dynamicFormService.createForm(this.config().fields, this.config().validations, this.config().updateOn, this.initialValues());
|
|
1758
|
+
this.formChange.emit(this.form);
|
|
1759
|
+
this.form.valueChanges
|
|
1760
|
+
.pipe(distinctUntilChanged(), debounceTime(this.config().debounceTime ?? 0), takeUntilDestroyed(this.destroyRef))
|
|
1761
|
+
.subscribe(() => {
|
|
1762
|
+
this.formChange.emit(this.form);
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
setValue(values) {
|
|
1766
|
+
this.form.setValue(values);
|
|
1767
|
+
this.form.updateValueAndValidity();
|
|
1768
|
+
}
|
|
1769
|
+
onClickButton(button) {
|
|
1770
|
+
if (button.type === 'reset') {
|
|
1771
|
+
this.reset();
|
|
1772
|
+
}
|
|
1773
|
+
if (button.action) {
|
|
1774
|
+
button.action(this.form);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
reset() {
|
|
1778
|
+
this.form.reset();
|
|
1779
|
+
this.formCancel.emit();
|
|
1780
|
+
}
|
|
1781
|
+
handleSubmit(event) {
|
|
1782
|
+
if (event) {
|
|
1783
|
+
event.preventDefault();
|
|
1784
|
+
event.stopPropagation();
|
|
1785
|
+
}
|
|
1786
|
+
if (this.form.valid) {
|
|
1787
|
+
this.formSubmit.emit(this.form);
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
this.form.markAllAsTouched();
|
|
1791
|
+
_.defer(() => {
|
|
1792
|
+
this.focusFirstInvalidControl();
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
focusFirstInvalidControl() {
|
|
1797
|
+
// TODO
|
|
1798
|
+
}
|
|
1799
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcClassicDynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1800
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: AcClassicDynamicFormComponent, isStandalone: true, selector: "sot-classic-dynamic-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, initialValues: { classPropertyName: "initialValues", publicName: "initialValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formCancel: "formCancel", formSubmit: "formSubmit", formChange: "formChange" }, providers: [DynamicFormService], exportAs: ["dynamicForm"], ngImport: i0, template: "@if (form && config()) {\r\n <form class=\"dynamic-form\"\r\n [formGroup]=\"form\"\r\n (submit)=\"handleSubmit($event)\"\r\n [ngClass]=\"config()!.className?.form\">\r\n @if (this.config()!.fields) {\r\n <div class=\"dynamic-form-content\"\r\n [ngClass]=\"config()!.className?.formContent\">\r\n @for (field of config()!.fields; track field.type + field.name) {\r\n <div [hidden]=\"!!field.hidden\"\r\n [ngClass]=\"field.hostClassName\">\r\n <ng-container\r\n sotDynamicField\r\n [path]=\"field.name\"\r\n [type]=\"field.type\"\r\n [field]=\"field\"\r\n [group]=\"form\"\r\n >\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-form-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of config()!.validations; track validation) {\r\n @if (form && !form.untouched && form.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n @if (config()!.buttons) {\r\n <div class=\"dynamic-form-buttons\" [ngClass]=\"config()!.className?.formButtons\">\r\n @for (button of config()!.buttons; track $index) {\r\n <!-- TODO\r\n <sot-button [type]=\"button.type\"\r\n [className]=\"button.className\"\r\n [matType]=\"button.matButtonType ?? 'raised'\"\r\n [disabled]=\"button.disabledIfFormNoValid && form.invalid\"\r\n [matIcon]=\"button.matIcon\"\r\n [label]=\"button.label\"\r\n [title]=\"button.title\"\r\n [ariaLabel]=\"button.ariaLabel\"\r\n (buttonClick)=\"onClickButton(button)\"\r\n ></sot-button>\r\n -->\r\n }\r\n </div>\r\n }\r\n </form>\r\n}\r\n", styles: [".dynamic-form-horizontal{display:flex;flex-direction:row;flex-wrap:wrap}.dynamic-form-buttons{display:flex;flex-direction:row;gap:2rem;margin-bottom:2rem}.dynamic-form-error{margin-bottom:2rem}\n"], dependencies: [{ kind: "directive", type: AcDynamicFieldDirective, selector: "[sotDynamicField]", inputs: ["type", "path", "field", "group", "instancePath"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
1801
|
+
}
|
|
1802
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AcClassicDynamicFormComponent, decorators: [{
|
|
1803
|
+
type: Component,
|
|
1804
|
+
args: [{ exportAs: 'dynamicForm', selector: 'sot-classic-dynamic-form', standalone: true, imports: [AcDynamicFieldDirective, NgClass, ReactiveFormsModule, MatError, MatIconModule, MatButtonModule], providers: [DynamicFormService], template: "@if (form && config()) {\r\n <form class=\"dynamic-form\"\r\n [formGroup]=\"form\"\r\n (submit)=\"handleSubmit($event)\"\r\n [ngClass]=\"config()!.className?.form\">\r\n @if (this.config()!.fields) {\r\n <div class=\"dynamic-form-content\"\r\n [ngClass]=\"config()!.className?.formContent\">\r\n @for (field of config()!.fields; track field.type + field.name) {\r\n <div [hidden]=\"!!field.hidden\"\r\n [ngClass]=\"field.hostClassName\">\r\n <ng-container\r\n sotDynamicField\r\n [path]=\"field.name\"\r\n [type]=\"field.type\"\r\n [field]=\"field\"\r\n [group]=\"form\"\r\n >\r\n </ng-container>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div\r\n class=\"sot-messages-group\"\r\n [attr.id]=\"'sot-form-error'\"\r\n aria-live=\"assertive\">\r\n @for (validation of config()!.validations; track validation) {\r\n @if (form && !form.untouched && form.hasError(validation.name)) {\r\n <p class=\"sot-message sot-message--error\">\r\n {{ validation.message }}\r\n </p>\r\n }\r\n }\r\n </div>\r\n @if (config()!.buttons) {\r\n <div class=\"dynamic-form-buttons\" [ngClass]=\"config()!.className?.formButtons\">\r\n @for (button of config()!.buttons; track $index) {\r\n <!-- TODO\r\n <sot-button [type]=\"button.type\"\r\n [className]=\"button.className\"\r\n [matType]=\"button.matButtonType ?? 'raised'\"\r\n [disabled]=\"button.disabledIfFormNoValid && form.invalid\"\r\n [matIcon]=\"button.matIcon\"\r\n [label]=\"button.label\"\r\n [title]=\"button.title\"\r\n [ariaLabel]=\"button.ariaLabel\"\r\n (buttonClick)=\"onClickButton(button)\"\r\n ></sot-button>\r\n -->\r\n }\r\n </div>\r\n }\r\n </form>\r\n}\r\n", styles: [".dynamic-form-horizontal{display:flex;flex-direction:row;flex-wrap:wrap}.dynamic-form-buttons{display:flex;flex-direction:row;gap:2rem;margin-bottom:2rem}.dynamic-form-error{margin-bottom:2rem}\n"] }]
|
|
1805
|
+
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], initialValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValues", required: false }] }], formCancel: [{ type: i0.Output, args: ["formCancel"] }], formSubmit: [{ type: i0.Output, args: ["formSubmit"] }], formChange: [{ type: i0.Output, args: ["formChange"] }] } });
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* Generated bundle index. Do not edit.
|
|
1809
|
+
*/
|
|
1810
|
+
|
|
1811
|
+
export { AbstractControlFieldComponent, AbstractFieldComponent, AcClassicDynamicFormComponent, AcDsfrDynamicFormComponent, AcMaterialDynamicFormComponent, AutocompleteAttribute, ConditionsService, DynamicFormService };
|
|
1812
|
+
//# sourceMappingURL=sotoa-ui-dynamic-form.mjs.map
|