@stemy/ngx-dynamic-form 19.5.6 → 19.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/stemy-ngx-dynamic-form.mjs +153 -148
- package/fesm2022/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +1 -1
- package/ngx-dynamic-form/components/dynamic-form-fieldset/dynamic-form-fieldset.component.d.ts +0 -1
- package/ngx-dynamic-form/utils/misc.d.ts +10 -2
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i2 from '@stemy/ngx-utils';
|
|
2
2
|
import { cachedFactory, ReflectUtils, ObjectUtils, LANGUAGE_SERVICE, ForbiddenZone, API_SERVICE, StringUtils, TOASTER_SERVICE, EventsService, NgxUtilsModule } from '@stemy/ngx-utils';
|
|
3
|
-
import { Observable, firstValueFrom, BehaviorSubject,
|
|
3
|
+
import { of, merge, Observable, firstValueFrom, BehaviorSubject, combineLatestWith, switchMap, distinctUntilChanged, first, Subject } from 'rxjs';
|
|
4
|
+
import { debounceTime } from 'rxjs/operators';
|
|
4
5
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { Inject, Injectable, input, output, inject, Renderer2, ElementRef, computed, signal, effect,
|
|
6
|
+
import { Inject, Injectable, untracked, input, output, inject, Renderer2, ElementRef, computed, signal, effect, HostListener, HostBinding, Directive, Type, Component, Injector, ChangeDetectionStrategy, ViewEncapsulation, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
6
7
|
import * as i1 from '@angular/forms';
|
|
7
8
|
import { FormGroup as FormGroup$1, FormArray as FormArray$1, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
8
|
-
import { debounceTime } from 'rxjs/operators';
|
|
9
9
|
import { outputToObservable, toSignal, rxResource } from '@angular/core/rxjs-interop';
|
|
10
10
|
import * as i3 from '@ngx-formly/core';
|
|
11
11
|
import { FieldType, ɵobserve as _observe, FieldArrayType, FieldWrapper, provideFormlyConfig, provideFormlyCore, FormlyModule } from '@ngx-formly/core';
|
|
@@ -221,6 +221,16 @@ function maxValueValidation(max, each) {
|
|
|
221
221
|
function replaceSpecialChars(str, to = "-") {
|
|
222
222
|
return `${str}`.replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
|
|
223
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Creates a new observable that always starts with the controls current value.
|
|
226
|
+
* @param control AbstractControl to retrieve value changes from
|
|
227
|
+
* @param timeout Additional timeout
|
|
228
|
+
*/
|
|
229
|
+
function controlValues(control, timeout = 500) {
|
|
230
|
+
const initial$ = of(control.value); // Emit immediately
|
|
231
|
+
const changes$ = control.valueChanges.pipe(debounceTime(timeout));
|
|
232
|
+
return merge(initial$, changes$);
|
|
233
|
+
}
|
|
224
234
|
function getFieldByPath(field, path) {
|
|
225
235
|
if (field.path === path) {
|
|
226
236
|
return field;
|
|
@@ -311,15 +321,11 @@ function additionalFieldValues(field, values) {
|
|
|
311
321
|
const additional = field.props?.additional || {};
|
|
312
322
|
setFieldProp(field, "additional", additional);
|
|
313
323
|
}
|
|
314
|
-
const MIN_INPUT_NUM = -
|
|
315
|
-
const MAX_INPUT_NUM =
|
|
324
|
+
const MIN_INPUT_NUM = -1999999999;
|
|
325
|
+
const MAX_INPUT_NUM = 1999999999;
|
|
316
326
|
const EDITOR_FORMATS = ["php", "json", "html", "css", "scss"];
|
|
317
327
|
|
|
318
328
|
class ConfigForSchemaWrap {
|
|
319
|
-
opts;
|
|
320
|
-
mode;
|
|
321
|
-
injector;
|
|
322
|
-
schema;
|
|
323
329
|
get labelPrefix() {
|
|
324
330
|
return this.opts.labelPrefix;
|
|
325
331
|
}
|
|
@@ -332,7 +338,6 @@ class ConfigForSchemaWrap {
|
|
|
332
338
|
get context() {
|
|
333
339
|
return this.opts.context;
|
|
334
340
|
}
|
|
335
|
-
fieldCustomizer;
|
|
336
341
|
constructor(opts, mode, injector, schema) {
|
|
337
342
|
this.opts = opts;
|
|
338
343
|
this.mode = mode;
|
|
@@ -439,11 +444,6 @@ function getFormValidationErrors(controls, parentPath = "") {
|
|
|
439
444
|
}
|
|
440
445
|
|
|
441
446
|
class DynamicFormBuilderService {
|
|
442
|
-
injector;
|
|
443
|
-
events;
|
|
444
|
-
api;
|
|
445
|
-
languages;
|
|
446
|
-
language;
|
|
447
447
|
constructor(injector, events, api, languages) {
|
|
448
448
|
this.injector = injector;
|
|
449
449
|
this.events = events;
|
|
@@ -524,24 +524,34 @@ class DynamicFormBuilderService {
|
|
|
524
524
|
data = data || {};
|
|
525
525
|
const type = `${data.type || "text"}`;
|
|
526
526
|
const autocomplete = data.autocomplete || (type === "password" ? "new-password" : "none");
|
|
527
|
-
|
|
527
|
+
const props = {
|
|
528
528
|
type,
|
|
529
529
|
autocomplete,
|
|
530
530
|
pattern: ObjectUtils.isString(data.pattern) ? data.pattern : "",
|
|
531
531
|
step: data.step,
|
|
532
532
|
cols: data.cols || null,
|
|
533
533
|
rows: data.rows || 10,
|
|
534
|
-
min: isNaN(data.min) ? undefined : data.min,
|
|
535
|
-
max: isNaN(data.max) ? undefined : data.max,
|
|
536
|
-
minLength: isNaN(data.minLength) ? 0 : data.minLength,
|
|
537
|
-
maxLength: isNaN(data.maxLength) ? MAX_INPUT_NUM : data.maxLength,
|
|
538
534
|
placeholder: data.placeholder || "",
|
|
539
535
|
indeterminate: data.indeterminate || false,
|
|
540
536
|
suffix: data.suffix || "",
|
|
541
537
|
attributes: {
|
|
542
538
|
autocomplete
|
|
543
539
|
},
|
|
544
|
-
}
|
|
540
|
+
};
|
|
541
|
+
switch (type) {
|
|
542
|
+
case "number":
|
|
543
|
+
case "integer":
|
|
544
|
+
props.min = isNaN(data.min) ? MIN_INPUT_NUM : data.min;
|
|
545
|
+
props.max = isNaN(data.max) ? MAX_INPUT_NUM : data.max;
|
|
546
|
+
break;
|
|
547
|
+
case "string":
|
|
548
|
+
case "text":
|
|
549
|
+
case "textarea":
|
|
550
|
+
props.minLength = isNaN(data.minLength) ? 0 : data.minLength;
|
|
551
|
+
props.maxLength = isNaN(data.maxLength) ? MAX_INPUT_NUM : data.maxLength;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
return this.createFormField(key, type === "checkbox" || type === "textarea" ? type : "input", data, props, parent, options);
|
|
545
555
|
}
|
|
546
556
|
createFormSelect(key, data, parent, options) {
|
|
547
557
|
data = data || {};
|
|
@@ -556,12 +566,12 @@ class DynamicFormBuilderService {
|
|
|
556
566
|
onInit: target => {
|
|
557
567
|
const options = data.options(target);
|
|
558
568
|
const root = target.formControl.root;
|
|
559
|
-
target
|
|
569
|
+
setFieldProp(target, "options", options instanceof Observable
|
|
560
570
|
? options
|
|
561
|
-
: root.
|
|
571
|
+
: controlValues(root).pipe(combineLatestWith(this.language), switchMap(async () => {
|
|
562
572
|
const results = await data.options(target) || [];
|
|
563
573
|
return this.fixSelectOptions(target, results);
|
|
564
|
-
}));
|
|
574
|
+
})));
|
|
565
575
|
}
|
|
566
576
|
});
|
|
567
577
|
return field;
|
|
@@ -709,9 +719,11 @@ class DynamicFormBuilderService {
|
|
|
709
719
|
label: options.labelCustomizer?.(key, data.label, parent, options.labelPrefix)
|
|
710
720
|
?? this.getLabel(key, data.label, parent, options),
|
|
711
721
|
hideLabel: data.hideLabel === true,
|
|
722
|
+
hideRequiredMarker: data.hideRequiredMarker === true,
|
|
712
723
|
formCheck: "nolabel",
|
|
713
724
|
labelPosition: "before",
|
|
714
725
|
additional: {
|
|
726
|
+
...(data.additional || {}),
|
|
715
727
|
classes: data.classes || []
|
|
716
728
|
}
|
|
717
729
|
},
|
|
@@ -768,9 +780,7 @@ class DynamicFormBuilderService {
|
|
|
768
780
|
return [`dynamic-form-field`, `dynamic-form-field-${target.key}`, `dynamic-form-${typeName}`].concat(Array.isArray(classes) ? classes : [classes || ""]).filter(c => c?.length > 0).join(" ");
|
|
769
781
|
},
|
|
770
782
|
additional: (target) => {
|
|
771
|
-
|
|
772
|
-
target.props.additional = target.props.additional || {};
|
|
773
|
-
return target.props.additional;
|
|
783
|
+
return target.props?.additional || {};
|
|
774
784
|
},
|
|
775
785
|
path: target => {
|
|
776
786
|
const tp = target.parent;
|
|
@@ -793,8 +803,8 @@ class DynamicFormBuilderService {
|
|
|
793
803
|
}
|
|
794
804
|
});
|
|
795
805
|
}
|
|
796
|
-
static
|
|
797
|
-
static
|
|
806
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormBuilderService, deps: [{ token: i0.Injector }, { token: i2.EventsService }, { token: API_SERVICE }, { token: LANGUAGE_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
807
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormBuilderService }); }
|
|
798
808
|
}
|
|
799
809
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormBuilderService, decorators: [{
|
|
800
810
|
type: Injectable
|
|
@@ -807,9 +817,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
807
817
|
}] }] });
|
|
808
818
|
|
|
809
819
|
class DynamicFormSchemaService {
|
|
810
|
-
openApi;
|
|
811
|
-
injector;
|
|
812
|
-
builder;
|
|
813
820
|
get api() {
|
|
814
821
|
return this.openApi.api;
|
|
815
822
|
}
|
|
@@ -1046,7 +1053,7 @@ class DynamicFormSchemaService {
|
|
|
1046
1053
|
}
|
|
1047
1054
|
getFormEndpointOptions(property, field) {
|
|
1048
1055
|
const root = field.formControl.root;
|
|
1049
|
-
return root.
|
|
1056
|
+
return controlValues(root).pipe(combineLatestWith(this.builder.language), switchMap(async () => {
|
|
1050
1057
|
const entries = Object.entries(root.controls || {});
|
|
1051
1058
|
const endpoint = entries.reduce((res, [key, control]) => {
|
|
1052
1059
|
return this.replaceOptionsEndpoint(res, key, control.value);
|
|
@@ -1082,11 +1089,8 @@ class DynamicFormSchemaService {
|
|
|
1082
1089
|
current = current.parent || current;
|
|
1083
1090
|
}
|
|
1084
1091
|
control = !path ? control : control.get(path);
|
|
1085
|
-
return control.
|
|
1086
|
-
const
|
|
1087
|
-
const finalOpts = isObservable(currentOpts)
|
|
1088
|
-
? await firstValueFrom(currentOpts)
|
|
1089
|
-
: (Array.isArray(currentOpts) ? currentOpts : []);
|
|
1092
|
+
return controlValues(control).pipe(combineLatestWith(this.builder.language), switchMap(async ([ctrlValue]) => {
|
|
1093
|
+
const finalOpts = await getSelectOptions(current);
|
|
1090
1094
|
return this.builder.fixSelectOptions(field, (!Array.isArray(ctrlValue) ? [] : ctrlValue).map(value => {
|
|
1091
1095
|
const modelOption = finalOpts.find(t => t.value == value);
|
|
1092
1096
|
return { value, label: modelOption?.label || value };
|
|
@@ -1165,18 +1169,14 @@ class DynamicFormSchemaService {
|
|
|
1165
1169
|
validators.itemsMaxValue = maxValueValidation(items.maximum, true);
|
|
1166
1170
|
}
|
|
1167
1171
|
}
|
|
1168
|
-
static
|
|
1169
|
-
static
|
|
1172
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormSchemaService, deps: [{ token: i2.OpenApiService }, { token: i0.Injector }, { token: DynamicFormBuilderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1173
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormSchemaService }); }
|
|
1170
1174
|
}
|
|
1171
1175
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormSchemaService, decorators: [{
|
|
1172
1176
|
type: Injectable
|
|
1173
1177
|
}], ctorParameters: () => [{ type: i2.OpenApiService }, { type: i0.Injector }, { type: DynamicFormBuilderService }] });
|
|
1174
1178
|
|
|
1175
1179
|
class DynamicFormService {
|
|
1176
|
-
fs;
|
|
1177
|
-
fb;
|
|
1178
|
-
injector;
|
|
1179
|
-
api;
|
|
1180
1180
|
constructor(fs, fb, injector, api) {
|
|
1181
1181
|
this.fs = fs;
|
|
1182
1182
|
this.fb = fb;
|
|
@@ -1253,7 +1253,7 @@ class DynamicFormService {
|
|
|
1253
1253
|
});
|
|
1254
1254
|
}
|
|
1255
1255
|
async serializeForm(form, validate = true) {
|
|
1256
|
-
const fields = form.config();
|
|
1256
|
+
const fields = untracked(() => form.config());
|
|
1257
1257
|
if (!fields)
|
|
1258
1258
|
return null;
|
|
1259
1259
|
if (validate) {
|
|
@@ -1308,8 +1308,8 @@ class DynamicFormService {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
});
|
|
1310
1310
|
}
|
|
1311
|
-
static
|
|
1312
|
-
static
|
|
1311
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormService, deps: [{ token: DynamicFormSchemaService }, { token: DynamicFormBuilderService }, { token: i0.Injector }, { token: API_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1312
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormService }); }
|
|
1313
1313
|
}
|
|
1314
1314
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormService, decorators: [{
|
|
1315
1315
|
type: Injectable
|
|
@@ -1319,25 +1319,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1319
1319
|
}] }] });
|
|
1320
1320
|
|
|
1321
1321
|
class AsyncSubmitDirective {
|
|
1322
|
-
method = input(null, { alias: "async-submit" });
|
|
1323
|
-
mode = input("click");
|
|
1324
|
-
form = input();
|
|
1325
|
-
context = input();
|
|
1326
|
-
onSuccess = output();
|
|
1327
|
-
onError = output();
|
|
1328
|
-
toaster = inject(TOASTER_SERVICE);
|
|
1329
|
-
renderer = inject(Renderer2);
|
|
1330
|
-
elem = inject(ElementRef);
|
|
1331
|
-
status = computed(() => {
|
|
1332
|
-
const form = this.form();
|
|
1333
|
-
return form?.status() || null;
|
|
1334
|
-
});
|
|
1335
|
-
group = computed(() => {
|
|
1336
|
-
const form = this.form();
|
|
1337
|
-
return form?.group() || null;
|
|
1338
|
-
});
|
|
1339
|
-
loading = signal(false);
|
|
1340
|
-
callback = signal(null);
|
|
1341
1322
|
get isDisabled() {
|
|
1342
1323
|
return this.status() !== "VALID";
|
|
1343
1324
|
}
|
|
@@ -1345,6 +1326,25 @@ class AsyncSubmitDirective {
|
|
|
1345
1326
|
return this.loading();
|
|
1346
1327
|
}
|
|
1347
1328
|
constructor() {
|
|
1329
|
+
this.method = input(null, { alias: "async-submit" });
|
|
1330
|
+
this.mode = input("click");
|
|
1331
|
+
this.form = input();
|
|
1332
|
+
this.context = input();
|
|
1333
|
+
this.onSuccess = output();
|
|
1334
|
+
this.onError = output();
|
|
1335
|
+
this.toaster = inject(TOASTER_SERVICE);
|
|
1336
|
+
this.renderer = inject(Renderer2);
|
|
1337
|
+
this.elem = inject(ElementRef);
|
|
1338
|
+
this.status = computed(() => {
|
|
1339
|
+
const form = this.form();
|
|
1340
|
+
return form?.status() || null;
|
|
1341
|
+
});
|
|
1342
|
+
this.group = computed(() => {
|
|
1343
|
+
const form = this.form();
|
|
1344
|
+
return form?.group() || null;
|
|
1345
|
+
});
|
|
1346
|
+
this.loading = signal(false);
|
|
1347
|
+
this.callback = signal(null);
|
|
1348
1348
|
if (this.elem.nativeElement.tagName === "BUTTON") {
|
|
1349
1349
|
this.renderer.setAttribute(this.elem.nativeElement, "type", "button");
|
|
1350
1350
|
}
|
|
@@ -1399,8 +1399,8 @@ class AsyncSubmitDirective {
|
|
|
1399
1399
|
this.toaster.error(reason.message, reason.context);
|
|
1400
1400
|
});
|
|
1401
1401
|
}
|
|
1402
|
-
static
|
|
1403
|
-
static
|
|
1402
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncSubmitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1403
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncSubmitDirective, isStandalone: false, selector: "[async-submit]", inputs: { method: { classPropertyName: "method", publicName: "async-submit", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "click()" }, properties: { "class.disabled": "this.isDisabled", "class.loading": "this.isLoading" } }, exportAs: ["async-submit"], ngImport: i0 }); }
|
|
1404
1404
|
}
|
|
1405
1405
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncSubmitDirective, decorators: [{
|
|
1406
1406
|
type: Directive,
|
|
@@ -1421,9 +1421,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1421
1421
|
}] } });
|
|
1422
1422
|
|
|
1423
1423
|
class DynamicFieldType extends FieldType {
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1424
|
+
constructor() {
|
|
1425
|
+
super(...arguments);
|
|
1426
|
+
this.stateChanges = new Subject();
|
|
1427
|
+
this._errorState = false;
|
|
1428
|
+
this._focused = false;
|
|
1429
|
+
}
|
|
1427
1430
|
ngOnDestroy() {
|
|
1428
1431
|
delete this.formField?._control;
|
|
1429
1432
|
this.stateChanges.complete();
|
|
@@ -1510,8 +1513,8 @@ class DynamicFieldType extends FieldType {
|
|
|
1510
1513
|
};
|
|
1511
1514
|
}
|
|
1512
1515
|
}
|
|
1513
|
-
static
|
|
1514
|
-
static
|
|
1516
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFieldType, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1517
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFieldType, isStandalone: false, selector: "dynamic-field-type", usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
|
|
1515
1518
|
}
|
|
1516
1519
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFieldType, decorators: [{
|
|
1517
1520
|
type: Component,
|
|
@@ -1523,55 +1526,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1523
1526
|
}] });
|
|
1524
1527
|
|
|
1525
1528
|
class DynamicFormComponent {
|
|
1526
|
-
builder = inject(DynamicFormBuilderService);
|
|
1527
|
-
events = inject(EventsService);
|
|
1528
|
-
languages = inject(LANGUAGE_SERVICE);
|
|
1529
|
-
labelPrefix = input("label");
|
|
1530
|
-
labelCustomizer = input(null);
|
|
1531
|
-
testId = input("");
|
|
1532
|
-
useTabs = input(false);
|
|
1533
|
-
data = input({});
|
|
1534
|
-
fields = input(null);
|
|
1535
|
-
fieldChanges = new Subject();
|
|
1536
|
-
language = toSignal(this.events.languageChanged, {
|
|
1537
|
-
initialValue: this.languages.currentLanguage
|
|
1538
|
-
});
|
|
1539
|
-
enableTranslations = toSignal(this.events.translationsEnabled, {
|
|
1540
|
-
initialValue: this.languages.enableTranslations
|
|
1541
|
-
});
|
|
1542
|
-
config = computed(() => {
|
|
1543
|
-
const options = {
|
|
1544
|
-
labelPrefix: this.labelPrefix(),
|
|
1545
|
-
labelCustomizer: this.labelCustomizer(),
|
|
1546
|
-
testId: this.testId(),
|
|
1547
|
-
};
|
|
1548
|
-
const fields = this.fields() || this.builder.resolveFormFields(this.data()?.constructor, null, options);
|
|
1549
|
-
return [
|
|
1550
|
-
this.builder.createFormGroup(null, () => fields, {
|
|
1551
|
-
label: "",
|
|
1552
|
-
useTabs: this.useTabs(),
|
|
1553
|
-
hidden: false
|
|
1554
|
-
}, null, options)
|
|
1555
|
-
];
|
|
1556
|
-
});
|
|
1557
|
-
group = computed(() => {
|
|
1558
|
-
this.config();
|
|
1559
|
-
return new FormGroup$1({});
|
|
1560
|
-
});
|
|
1561
|
-
status$ = rxResource({
|
|
1562
|
-
request: () => this.group(),
|
|
1563
|
-
loader: p => p.request.statusChanges,
|
|
1564
|
-
defaultValue: "PENDING"
|
|
1565
|
-
});
|
|
1566
|
-
status = computed(() => this.status$.value());
|
|
1567
|
-
onSubmit = output();
|
|
1568
|
-
options = {
|
|
1569
|
-
fieldChanges: this.fieldChanges,
|
|
1570
|
-
formState: {
|
|
1571
|
-
injector: inject(Injector)
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
1529
|
constructor() {
|
|
1530
|
+
this.builder = inject(DynamicFormBuilderService);
|
|
1531
|
+
this.events = inject(EventsService);
|
|
1532
|
+
this.languages = inject(LANGUAGE_SERVICE);
|
|
1533
|
+
this.labelPrefix = input("label");
|
|
1534
|
+
this.labelCustomizer = input(null);
|
|
1535
|
+
this.testId = input("");
|
|
1536
|
+
this.useTabs = input(false);
|
|
1537
|
+
this.data = input({});
|
|
1538
|
+
this.fields = input(null);
|
|
1539
|
+
this.fieldChanges = new Subject();
|
|
1540
|
+
this.language = toSignal(this.events.languageChanged, {
|
|
1541
|
+
initialValue: this.languages.currentLanguage
|
|
1542
|
+
});
|
|
1543
|
+
this.enableTranslations = toSignal(this.events.translationsEnabled, {
|
|
1544
|
+
initialValue: this.languages.enableTranslations
|
|
1545
|
+
});
|
|
1546
|
+
this.config = computed(() => {
|
|
1547
|
+
const options = {
|
|
1548
|
+
labelPrefix: this.labelPrefix(),
|
|
1549
|
+
labelCustomizer: this.labelCustomizer(),
|
|
1550
|
+
testId: this.testId(),
|
|
1551
|
+
};
|
|
1552
|
+
const fields = this.fields() || this.builder.resolveFormFields(this.data()?.constructor, null, options);
|
|
1553
|
+
return [
|
|
1554
|
+
this.builder.createFormGroup(null, () => fields, {
|
|
1555
|
+
label: "",
|
|
1556
|
+
useTabs: this.useTabs(),
|
|
1557
|
+
hidden: false,
|
|
1558
|
+
additional: {
|
|
1559
|
+
className: "dynamic-form-root-group"
|
|
1560
|
+
}
|
|
1561
|
+
}, null, options)
|
|
1562
|
+
];
|
|
1563
|
+
});
|
|
1564
|
+
this.group = computed(() => {
|
|
1565
|
+
this.config();
|
|
1566
|
+
return new FormGroup$1({});
|
|
1567
|
+
});
|
|
1568
|
+
this.status$ = rxResource({
|
|
1569
|
+
request: () => this.group(),
|
|
1570
|
+
loader: p => p.request.statusChanges,
|
|
1571
|
+
defaultValue: "PENDING"
|
|
1572
|
+
});
|
|
1573
|
+
this.status = computed(() => this.status$.value());
|
|
1574
|
+
this.onSubmit = output();
|
|
1575
|
+
this.options = {
|
|
1576
|
+
fieldChanges: this.fieldChanges,
|
|
1577
|
+
formState: {
|
|
1578
|
+
injector: inject(Injector)
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1575
1581
|
effect(() => {
|
|
1576
1582
|
this.language();
|
|
1577
1583
|
this.enableTranslations();
|
|
@@ -1588,8 +1594,8 @@ class DynamicFormComponent {
|
|
|
1588
1594
|
reset() {
|
|
1589
1595
|
this.options?.resetModel?.();
|
|
1590
1596
|
}
|
|
1591
|
-
static
|
|
1592
|
-
static
|
|
1597
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1598
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormComponent, isStandalone: false, selector: "dynamic-form", inputs: { labelPrefix: { classPropertyName: "labelPrefix", publicName: "labelPrefix", isSignal: true, isRequired: false, transformFunction: null }, labelCustomizer: { classPropertyName: "labelCustomizer", publicName: "labelCustomizer", isSignal: true, isRequired: false, transformFunction: null }, testId: { classPropertyName: "testId", publicName: "testId", isSignal: true, isRequired: false, transformFunction: null }, useTabs: { classPropertyName: "useTabs", publicName: "useTabs", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSubmit: "onSubmit" }, ngImport: i0, template: "@if (config() && group()) {\n <form [formGroup]=\"group()\" (ngSubmit)=\"submit()\" autocomplete=\"off\" role=\"presentation\">\n <input type=\"submit\" [hidden]=\"true\" />\n <formly-form [model]=\"data()\"\n [fields]=\"config()\"\n [form]=\"group()\"\n [options]=\"options\"></formly-form>\n <ng-content></ng-content>\n </form>\n}\n", styles: [".dynamic-form-field.dynamic-form-hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.LegacyFormlyForm, selector: "formly-form" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1593
1599
|
}
|
|
1594
1600
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormComponent, decorators: [{
|
|
1595
1601
|
type: Component,
|
|
@@ -1597,7 +1603,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1597
1603
|
}], ctorParameters: () => [] });
|
|
1598
1604
|
|
|
1599
1605
|
class DynamicFormArrayComponent extends FieldArrayType {
|
|
1600
|
-
|
|
1606
|
+
constructor() {
|
|
1607
|
+
super(...arguments);
|
|
1608
|
+
this.currentTab = signal(0);
|
|
1609
|
+
}
|
|
1601
1610
|
clearItems() {
|
|
1602
1611
|
const control = this.formControl;
|
|
1603
1612
|
while (control.length > 0) {
|
|
@@ -1615,17 +1624,17 @@ class DynamicFormArrayComponent extends FieldArrayType {
|
|
|
1615
1624
|
const length = this.field.fieldGroup.length;
|
|
1616
1625
|
this.currentTab.set(Math.min(this.currentTab(), length - 1));
|
|
1617
1626
|
}
|
|
1618
|
-
static
|
|
1619
|
-
static
|
|
1627
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1628
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormArrayComponent, isStandalone: false, selector: "dynamic-form-array", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "type", "size"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size"], outputs: ["valueChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.GetValuePipe, name: "getValue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1620
1629
|
}
|
|
1621
1630
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, decorators: [{
|
|
1622
1631
|
type: Component,
|
|
1623
|
-
args: [{ standalone: false, selector: "dynamic-form-array", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}\n"] }]
|
|
1632
|
+
args: [{ standalone: false, selector: "dynamic-form-array", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}\n"] }]
|
|
1624
1633
|
}] });
|
|
1625
1634
|
|
|
1626
1635
|
class DynamicFormChipsComponent extends DynamicFieldType {
|
|
1627
|
-
static
|
|
1628
|
-
static
|
|
1636
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormChipsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1637
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormChipsComponent, isStandalone: false, selector: "dynamic-form-chips", usesInheritance: true, ngImport: i0, template: "<chips [formControl]=\"formControl\"\n [type]=\"props.type\"\n [step]=\"props.step\"\n [minLength]=\"props.minLength\"\n [maxLength]=\"props.maxLength\"\n [min]=\"props.min\"\n [max]=\"props.max\"\n [multiple]=\"props.multiple\"\n [formlyAttributes]=\"field\">\n</chips>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.ChipsComponent, selector: "chips", inputs: ["value", "multiple", "disabled", "type", "min", "max", "minLength", "maxLength", "step", "placeholder", "unique", "options"], outputs: ["valueChange"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1629
1638
|
}
|
|
1630
1639
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormChipsComponent, decorators: [{
|
|
1631
1640
|
type: Component,
|
|
@@ -1633,8 +1642,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1633
1642
|
}] });
|
|
1634
1643
|
|
|
1635
1644
|
class DynamicFormFieldComponent extends FieldWrapper {
|
|
1636
|
-
static
|
|
1637
|
-
static
|
|
1645
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1646
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "@if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\" [for]=\"id\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.required && props.hideRequiredMarker !== true) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n<div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\n <formly-validation-message\n [field]=\"field\"\n id=\"{{ id }}-formly-validation-error\"\n role=\"alert\"\n ></formly-validation-message>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1638
1647
|
}
|
|
1639
1648
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
|
|
1640
1649
|
type: Component,
|
|
@@ -1642,21 +1651,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1642
1651
|
}] });
|
|
1643
1652
|
|
|
1644
1653
|
class DynamicFormFieldsetComponent extends FieldWrapper {
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
// console.log(this.field.parent);
|
|
1648
|
-
}
|
|
1649
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1650
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n </div>\n}\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
1654
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1655
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField) {\n @if (itemField.display) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1651
1656
|
}
|
|
1652
1657
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, decorators: [{
|
|
1653
1658
|
type: Component,
|
|
1654
|
-
args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n <
|
|
1659
|
+
args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField) {\n @if (itemField.display) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n </div>\n}\n" }]
|
|
1655
1660
|
}] });
|
|
1656
1661
|
|
|
1657
1662
|
class DynamicFormGroupComponent extends FieldWrapper {
|
|
1658
|
-
static
|
|
1659
|
-
static
|
|
1663
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1664
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (itemField.display) {\n @if (props.useTabs && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\n [classes]=\"['form-fieldset-tab', itemField.valid ? 'valid' : 'invalid']\"\n [label]=\"itemField.props.label\">\n <formly-field [field]=\"itemField\"></formly-field>\n </div>\n } @else {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n }\n </tabs>\n}\n", styles: [".form-fieldset-item.hidden-tab{display:none}.form-fieldset-tab{position:relative;--invalid-bg: rgba(184, 38, 38, 1);--invalid-border: rgba(184, 38, 38, .6);--invalid-color: #ececec;--invalid-box-size: 15px;--invalid-box-pull: -3px}.form-fieldset-tab.invalid>btn .async-target{border:1px solid var(--invalid-border)}.form-fieldset-tab.invalid:after{background:var(--invalid-bg);color:var(--invalid-color);font-size:10px;line-height:var(--invalid-box-size);width:var(--invalid-box-size);height:var(--invalid-box-size);text-align:center;border-radius:5px;content:\"!\";display:block;position:absolute;top:var(--invalid-box-pull);right:var(--invalid-box-pull)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size"], outputs: ["valueChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.IncludesPipe, name: "includes" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1660
1665
|
}
|
|
1661
1666
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, decorators: [{
|
|
1662
1667
|
type: Component,
|
|
@@ -1664,8 +1669,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1664
1669
|
}] });
|
|
1665
1670
|
|
|
1666
1671
|
class DynamicFormUploadComponent extends DynamicFieldType {
|
|
1667
|
-
static
|
|
1668
|
-
static
|
|
1672
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1673
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormUploadComponent, isStandalone: false, selector: "dynamic-form-upload", usesInheritance: true, ngImport: i0, template: "<upload [formControl]=\"formControl\"\n [multiple]=\"props.multiple\"\n [inline]=\"props.inline\"\n [accept]=\"props.accept\"\n [baseUrl]=\"props.url\"\n [makeUpload]=\"props.createUploadData\"\n [formlyAttributes]=\"field\">\n</upload>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.UploadComponent, selector: "upload", inputs: ["value", "disabled", "inline", "accept", "baseUrl", "message", "multiple", "buttonText", "makeUpload", "preProcess"], outputs: ["onUploaded", "onRemove"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1669
1674
|
}
|
|
1670
1675
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, decorators: [{
|
|
1671
1676
|
type: Component,
|
|
@@ -1725,16 +1730,16 @@ class NgxDynamicFormModule {
|
|
|
1725
1730
|
static provideForms(config) {
|
|
1726
1731
|
return makeEnvironmentProviders(NgxDynamicFormModule.getProviders(config));
|
|
1727
1732
|
}
|
|
1728
|
-
static
|
|
1729
|
-
static
|
|
1733
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1734
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormUploadComponent, AsyncSubmitDirective], imports: [CommonModule,
|
|
1730
1735
|
FormsModule,
|
|
1731
1736
|
ReactiveFormsModule,
|
|
1732
1737
|
NgxUtilsModule,
|
|
1733
1738
|
FormlyModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormUploadComponent, AsyncSubmitDirective, FormsModule,
|
|
1734
1739
|
ReactiveFormsModule,
|
|
1735
1740
|
NgxUtilsModule,
|
|
1736
|
-
FormlyModule] });
|
|
1737
|
-
static
|
|
1741
|
+
FormlyModule] }); }
|
|
1742
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, providers: [
|
|
1738
1743
|
...pipes
|
|
1739
1744
|
], imports: [CommonModule,
|
|
1740
1745
|
FormsModule,
|
|
@@ -1743,7 +1748,7 @@ class NgxDynamicFormModule {
|
|
|
1743
1748
|
FormlyModule, FormsModule,
|
|
1744
1749
|
ReactiveFormsModule,
|
|
1745
1750
|
NgxUtilsModule,
|
|
1746
|
-
FormlyModule] });
|
|
1751
|
+
FormlyModule] }); }
|
|
1747
1752
|
}
|
|
1748
1753
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, decorators: [{
|
|
1749
1754
|
type: NgModule,
|
|
@@ -1779,5 +1784,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1779
1784
|
* Generated bundle index. Do not edit.
|
|
1780
1785
|
*/
|
|
1781
1786
|
|
|
1782
|
-
export { AsyncSubmitDirective, DynamicFieldType, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_ID, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, addFieldValidators, additionalFieldValue, additionalFieldValues, clearFieldArray, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, translationValidation };
|
|
1787
|
+
export { AsyncSubmitDirective, DynamicFieldType, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_ID, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, addFieldValidators, additionalFieldValue, additionalFieldValues, clearFieldArray, controlValues, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, translationValidation };
|
|
1783
1788
|
//# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map
|