@stemy/ngx-dynamic-form 19.9.23 → 19.9.25
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 +311 -289
- package/fesm2022/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +6 -6
- package/ngx-dynamic-form/components/dynamic-form-editor/dynamic-form-editor.component.d.ts +6 -0
- package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +19 -18
- package/ngx-dynamic-form/services/dynamic-form-builder.service.d.ts +1 -1
- package/ngx-dynamic-form/services/dynamic-form-schema.service.d.ts +3 -1
- package/ngx-dynamic-form/utils/misc.d.ts +2 -1
- package/package.json +2 -17
- package/public_api.d.ts +2 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, Inject, Injectable, untracked, input, Renderer2, ElementRef, computed, signal, effect, HostBinding, Directive, Input, Optional, Pipe, Type, Component, Injector, output, ChangeDetectionStrategy, ViewEncapsulation, viewChild, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@stemy/ngx-utils';
|
|
4
|
-
import { cachedFactory, ReflectUtils, ObjectUtils, LANGUAGE_SERVICE, ForbiddenZone, ArrayUtils, API_SERVICE, StringUtils, AsyncMethodBase, EventsService, NgxUtilsModule } from '@stemy/ngx-utils';
|
|
5
|
-
import { of, merge, Observable, firstValueFrom, BehaviorSubject, combineLatestWith, switchMap, distinctUntilChanged, first, Subject,
|
|
4
|
+
import { cachedFactory, ReflectUtils, ObjectUtils, LANGUAGE_SERVICE, ForbiddenZone, SetUtils, ArrayUtils, API_SERVICE, StringUtils, AsyncMethodBase, EventsService, NgxUtilsModule } from '@stemy/ngx-utils';
|
|
5
|
+
import { of, merge, map, Observable, firstValueFrom, BehaviorSubject, combineLatestWith, switchMap, distinctUntilChanged, first, Subject, filter } from 'rxjs';
|
|
6
6
|
import { debounceTime } from 'rxjs/operators';
|
|
7
|
-
import { __decorate } from 'tslib';
|
|
8
7
|
import * as i1 from '@angular/forms';
|
|
9
8
|
import { FormGroup as FormGroup$1, FormArray as FormArray$1, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
10
9
|
import { outputToObservable, toSignal, rxResource, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
@@ -131,7 +130,10 @@ function replaceSpecialChars(str, to = "-") {
|
|
|
131
130
|
function controlValues(control, timeout = 500) {
|
|
132
131
|
const initial$ = of(control.value); // Emit immediately
|
|
133
132
|
const changes$ = control.valueChanges.pipe(debounceTime(timeout));
|
|
134
|
-
return merge(initial$, changes$)
|
|
133
|
+
return merge(initial$, changes$).pipe(map(value => {
|
|
134
|
+
console.log(value, "why");
|
|
135
|
+
return value;
|
|
136
|
+
}));
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
139
|
* Creates a new observable that always starts with the controls current status.
|
|
@@ -289,8 +291,17 @@ function isFieldVisible(field) {
|
|
|
289
291
|
let visible = true;
|
|
290
292
|
let current = field;
|
|
291
293
|
while (current && visible) {
|
|
294
|
+
// Discriminator based visibility
|
|
295
|
+
let parent = current.parent;
|
|
296
|
+
while (parent && !parent.key) {
|
|
297
|
+
parent = parent.parent;
|
|
298
|
+
}
|
|
299
|
+
const discriminator = parent?.discriminator;
|
|
300
|
+
const schema = !discriminator ? null : discriminator(parent.parent?.model || {});
|
|
301
|
+
visible = visible && (!schema || current.schemas.size === 0 || current.schemas.has(schema));
|
|
302
|
+
// Field based visibility
|
|
292
303
|
const hiddenFn = current.props?.__hidden;
|
|
293
|
-
const injector =
|
|
304
|
+
const injector = current.options?.formState?.injector;
|
|
294
305
|
visible = visible && (!injector || !hiddenFn?.(current, injector));
|
|
295
306
|
current = current.parent;
|
|
296
307
|
}
|
|
@@ -304,7 +315,8 @@ function isFieldHidden(field) {
|
|
|
304
315
|
}
|
|
305
316
|
const MIN_INPUT_NUM = -1999999999;
|
|
306
317
|
const MAX_INPUT_NUM = 1999999999;
|
|
307
|
-
const
|
|
318
|
+
const EDITOR_TYPES = ["php", "json", "html", "css", "scss"];
|
|
319
|
+
const CUSTOM_INPUT_TYPES = ["checkbox", "textarea", "wysiwyg", "password"];
|
|
308
320
|
|
|
309
321
|
function validationMessage(errorKey) {
|
|
310
322
|
const key = `form.error.${errorKey}`;
|
|
@@ -467,34 +479,54 @@ class ModelUtils {
|
|
|
467
479
|
}
|
|
468
480
|
}
|
|
469
481
|
|
|
482
|
+
var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
483
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
484
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
485
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
486
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
487
|
+
};
|
|
488
|
+
var __metadata$1 = (this && this.__metadata) || function (k, v) {
|
|
489
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
490
|
+
};
|
|
470
491
|
class RichTranslationModel {
|
|
471
|
-
lang = "";
|
|
472
|
-
translation = "";
|
|
473
492
|
constructor(data) {
|
|
493
|
+
this.lang = "";
|
|
494
|
+
this.translation = "";
|
|
474
495
|
if (data)
|
|
475
496
|
Object.assign(this, data);
|
|
476
497
|
}
|
|
477
498
|
}
|
|
478
|
-
__decorate([
|
|
499
|
+
__decorate$1([
|
|
479
500
|
FormSelect({
|
|
480
501
|
options: {
|
|
481
502
|
type: ModelUtils,
|
|
482
503
|
func: ModelUtils.getLanguages
|
|
483
504
|
}
|
|
484
505
|
}),
|
|
485
|
-
FormSerializable()
|
|
506
|
+
FormSerializable(),
|
|
507
|
+
__metadata$1("design:type", String)
|
|
486
508
|
], RichTranslationModel.prototype, "lang", void 0);
|
|
487
|
-
__decorate([
|
|
509
|
+
__decorate$1([
|
|
488
510
|
FormInput({
|
|
489
511
|
type: "wysiwyg"
|
|
490
512
|
}),
|
|
491
|
-
FormSerializable()
|
|
513
|
+
FormSerializable(),
|
|
514
|
+
__metadata$1("design:type", String)
|
|
492
515
|
], RichTranslationModel.prototype, "translation", void 0);
|
|
493
516
|
|
|
517
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
518
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
519
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
520
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
521
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
522
|
+
};
|
|
523
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
524
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
525
|
+
};
|
|
494
526
|
class TranslationModel {
|
|
495
|
-
lang = "";
|
|
496
|
-
translation = "";
|
|
497
527
|
constructor(data) {
|
|
528
|
+
this.lang = "";
|
|
529
|
+
this.translation = "";
|
|
498
530
|
if (data)
|
|
499
531
|
Object.assign(this, data);
|
|
500
532
|
}
|
|
@@ -506,18 +538,16 @@ __decorate([
|
|
|
506
538
|
func: ModelUtils.getLanguages
|
|
507
539
|
}
|
|
508
540
|
}),
|
|
509
|
-
FormSerializable()
|
|
541
|
+
FormSerializable(),
|
|
542
|
+
__metadata("design:type", String)
|
|
510
543
|
], TranslationModel.prototype, "lang", void 0);
|
|
511
544
|
__decorate([
|
|
512
545
|
FormInput(),
|
|
513
|
-
FormSerializable()
|
|
546
|
+
FormSerializable(),
|
|
547
|
+
__metadata("design:type", String)
|
|
514
548
|
], TranslationModel.prototype, "translation", void 0);
|
|
515
549
|
|
|
516
550
|
class ConfigForSchemaWrap {
|
|
517
|
-
opts;
|
|
518
|
-
mode;
|
|
519
|
-
injector;
|
|
520
|
-
schema;
|
|
521
551
|
get labelPrefix() {
|
|
522
552
|
return this.opts.labelPrefix;
|
|
523
553
|
}
|
|
@@ -533,7 +563,6 @@ class ConfigForSchemaWrap {
|
|
|
533
563
|
get context() {
|
|
534
564
|
return this.opts.context;
|
|
535
565
|
}
|
|
536
|
-
fieldCustomizer;
|
|
537
566
|
constructor(opts, mode, injector, schema) {
|
|
538
567
|
this.opts = opts;
|
|
539
568
|
this.mode = mode;
|
|
@@ -611,14 +640,7 @@ function getFormValidationErrors(controls, parentPath = "") {
|
|
|
611
640
|
return errors;
|
|
612
641
|
}
|
|
613
642
|
|
|
614
|
-
const customInputTypes = ["checkbox", "textarea", "wysiwyg", "password"];
|
|
615
643
|
class DynamicFormBuilderService {
|
|
616
|
-
injector;
|
|
617
|
-
events;
|
|
618
|
-
api;
|
|
619
|
-
languages;
|
|
620
|
-
defaultNumericStep;
|
|
621
|
-
language;
|
|
622
644
|
constructor(injector, events, api, languages, defaultNumericStep) {
|
|
623
645
|
this.injector = injector;
|
|
624
646
|
this.events = events;
|
|
@@ -657,7 +679,8 @@ class DynamicFormBuilderService {
|
|
|
657
679
|
return this.setExpressions({
|
|
658
680
|
id,
|
|
659
681
|
parent,
|
|
660
|
-
schemas:
|
|
682
|
+
schemas: new Set(),
|
|
683
|
+
discriminator: parent.discriminator,
|
|
661
684
|
fieldGroup: fields,
|
|
662
685
|
wrappers: ["form-fieldset"],
|
|
663
686
|
props: {
|
|
@@ -670,15 +693,15 @@ class DynamicFormBuilderService {
|
|
|
670
693
|
expressions: {}
|
|
671
694
|
}, options);
|
|
672
695
|
}
|
|
673
|
-
createFieldSets(fields, parent, options,
|
|
696
|
+
createFieldSets(fields, parent, options, data = []) {
|
|
674
697
|
const result = [];
|
|
675
|
-
const
|
|
698
|
+
const fieldSets = {};
|
|
676
699
|
fields = Array.from(fields || [])
|
|
677
700
|
.sort((a, b) => a.priority - b.priority);
|
|
678
701
|
fields.forEach(field => {
|
|
679
702
|
if (this.isFieldset(field)) {
|
|
680
703
|
// This field is an already existing set
|
|
681
|
-
|
|
704
|
+
fieldSets[field.id] = field;
|
|
682
705
|
}
|
|
683
706
|
});
|
|
684
707
|
for (const field of fields) {
|
|
@@ -686,19 +709,20 @@ class DynamicFormBuilderService {
|
|
|
686
709
|
// If we have a fieldset name defined, then push the property fields into a group
|
|
687
710
|
if (fsName) {
|
|
688
711
|
const id = !parent?.path ? fsName : `${parent.path}.${fsName}`;
|
|
689
|
-
const
|
|
690
|
-
let
|
|
691
|
-
if (!
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
result.push(
|
|
712
|
+
const setData = data.find(s => s.id === fsName) || { id: fsName, layout: "" };
|
|
713
|
+
let fieldSet = fieldSets[id];
|
|
714
|
+
if (!fieldSet) {
|
|
715
|
+
fieldSet = this.createFieldSet(setData, [], parent, options);
|
|
716
|
+
fieldSets[id] = fieldSet;
|
|
717
|
+
result.push(fieldSet);
|
|
695
718
|
}
|
|
696
|
-
|
|
719
|
+
SetUtils.merge(fieldSet.schemas, field.schemas);
|
|
720
|
+
fieldSet.fieldGroup.push(field);
|
|
697
721
|
continue;
|
|
698
722
|
}
|
|
699
|
-
else if (field.asFieldSet && !
|
|
723
|
+
else if (field.asFieldSet && !fieldSets[field.id]) {
|
|
700
724
|
const fsName = String(field.key);
|
|
701
|
-
const set =
|
|
725
|
+
const set = data.find(s => s.id === fsName);
|
|
702
726
|
field.id = !parent?.path ? fsName : `${parent.path}.${fsName}`;
|
|
703
727
|
field.wrappers = ["form-fieldset"];
|
|
704
728
|
field.props = {
|
|
@@ -717,7 +741,7 @@ class DynamicFormBuilderService {
|
|
|
717
741
|
}
|
|
718
742
|
createFormInput(key, data, parent, options) {
|
|
719
743
|
data = data || {};
|
|
720
|
-
const type =
|
|
744
|
+
const type = String(data.type || "text");
|
|
721
745
|
const autocomplete = data.autocomplete || (type === "password" ? "new-password" : "none");
|
|
722
746
|
const props = {
|
|
723
747
|
type,
|
|
@@ -755,7 +779,10 @@ class DynamicFormBuilderService {
|
|
|
755
779
|
props.maxLength = isNaN(data.maxLength) ? MAX_INPUT_NUM : data.maxLength;
|
|
756
780
|
break;
|
|
757
781
|
}
|
|
758
|
-
|
|
782
|
+
const fieldType = CUSTOM_INPUT_TYPES.includes(type)
|
|
783
|
+
? type
|
|
784
|
+
: (EDITOR_TYPES.includes(type) ? "editor" : "input");
|
|
785
|
+
return this.createFormField(key, fieldType, data, props, parent, options);
|
|
759
786
|
}
|
|
760
787
|
createFormSelect(key, data, parent, options) {
|
|
761
788
|
data = data || {};
|
|
@@ -779,6 +806,7 @@ class DynamicFormBuilderService {
|
|
|
779
806
|
setFieldProp(target, "options", options instanceof Observable
|
|
780
807
|
? options
|
|
781
808
|
: controlValues(root).pipe(combineLatestWith(this.language), switchMap(async (a, b) => {
|
|
809
|
+
console.log(a, b, "????", target.key, target.formControl?.value);
|
|
782
810
|
const results = await factory(target, this.injector) || [];
|
|
783
811
|
return this.fixSelectOptions(target, results);
|
|
784
812
|
})));
|
|
@@ -855,7 +883,7 @@ class DynamicFormBuilderService {
|
|
|
855
883
|
wrappers: ["form-group"],
|
|
856
884
|
fieldGroup: items,
|
|
857
885
|
className: "dynamic-form-field dynamic-form-group",
|
|
858
|
-
defaultValue:
|
|
886
|
+
defaultValue: {},
|
|
859
887
|
hooks: {},
|
|
860
888
|
expressions
|
|
861
889
|
};
|
|
@@ -888,7 +916,7 @@ class DynamicFormBuilderService {
|
|
|
888
916
|
...items.props,
|
|
889
917
|
label: "",
|
|
890
918
|
},
|
|
891
|
-
defaultValue:
|
|
919
|
+
defaultValue: props.type === "json" ? {} : "",
|
|
892
920
|
hooks: {},
|
|
893
921
|
expressions
|
|
894
922
|
};
|
|
@@ -926,10 +954,10 @@ class DynamicFormBuilderService {
|
|
|
926
954
|
const control = field.formControl;
|
|
927
955
|
const multiple = field.props.multiple;
|
|
928
956
|
if (multiple) {
|
|
957
|
+
if (Array.isArray(control.value))
|
|
958
|
+
return options;
|
|
929
959
|
// Handle if current control value is not an array
|
|
930
|
-
const value =
|
|
931
|
-
? control.value
|
|
932
|
-
: String(control.value || "").split(",");
|
|
960
|
+
const value = String(control.value || "").split(",");
|
|
933
961
|
control.setValue(value);
|
|
934
962
|
return options;
|
|
935
963
|
}
|
|
@@ -981,7 +1009,7 @@ class DynamicFormBuilderService {
|
|
|
981
1009
|
prefixTemplateKey: String(data.prefixTemplateKey || ""),
|
|
982
1010
|
suffixTemplateKey: String(data.suffixTemplateKey || ""),
|
|
983
1011
|
purposes: toStringArray(data.purposes),
|
|
984
|
-
schemas: toStringArray(data.schemas),
|
|
1012
|
+
schemas: new Set(toStringArray(data.schemas)),
|
|
985
1013
|
discriminator: data.discriminator,
|
|
986
1014
|
priority: isNaN(data.priority) ? Number.MAX_SAFE_INTEGER : Number(data.priority),
|
|
987
1015
|
wrappers: wrappers.filter(ObjectUtils.isDefined),
|
|
@@ -1089,10 +1117,10 @@ class DynamicFormBuilderService {
|
|
|
1089
1117
|
});
|
|
1090
1118
|
return field;
|
|
1091
1119
|
}
|
|
1092
|
-
static
|
|
1093
|
-
static
|
|
1120
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormBuilderService, deps: [{ token: i0.Injector }, { token: i2.EventsService }, { token: API_SERVICE }, { token: LANGUAGE_SERVICE }, { token: DEFAULT_NUMERIC_STEP }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1121
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormBuilderService }); }
|
|
1094
1122
|
}
|
|
1095
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormBuilderService, decorators: [{
|
|
1096
1124
|
type: Injectable
|
|
1097
1125
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: i2.EventsService }, { type: undefined, decorators: [{
|
|
1098
1126
|
type: Inject,
|
|
@@ -1107,9 +1135,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1107
1135
|
|
|
1108
1136
|
const PRIORITY_DIFF = 20;
|
|
1109
1137
|
class DynamicFormSchemaService {
|
|
1110
|
-
openApi;
|
|
1111
|
-
injector;
|
|
1112
|
-
builder;
|
|
1113
1138
|
get api() {
|
|
1114
1139
|
return this.openApi.api;
|
|
1115
1140
|
}
|
|
@@ -1128,39 +1153,50 @@ class DynamicFormSchemaService {
|
|
|
1128
1153
|
if (!schema)
|
|
1129
1154
|
return [];
|
|
1130
1155
|
const options = await toWrapOptions(customizeOrOptions, this.injector, schema);
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1156
|
+
return this.getFormFieldsForSchemas(parent, options, schema);
|
|
1157
|
+
}
|
|
1158
|
+
async getFormFieldsForSchemas(parent, options, ...schemas) {
|
|
1159
|
+
const sets = [];
|
|
1160
|
+
const fieldsForSchemas = await Promise.all(schemas.map(async (schema) => {
|
|
1161
|
+
const keys = Object.keys(schema.properties || {});
|
|
1162
|
+
const fields = [];
|
|
1163
|
+
// Collect field set definitions for this schema
|
|
1164
|
+
const schemaSets = Array.isArray(schema.sets) ? schema.sets : [];
|
|
1165
|
+
for (const set of schemaSets) {
|
|
1166
|
+
const existing = sets.find(s => s.id === set.id);
|
|
1167
|
+
if (!existing) {
|
|
1168
|
+
Object.assign(existing, set);
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
sets.push(set);
|
|
1172
|
+
}
|
|
1173
|
+
// Collect all properties of this schema def
|
|
1174
|
+
let priority = Number.MAX_SAFE_INTEGER - (keys.length * PRIORITY_DIFF);
|
|
1175
|
+
for (const key of keys) {
|
|
1176
|
+
const property = schema.properties[key];
|
|
1177
|
+
// Property priority is necessary when merging different schemas
|
|
1178
|
+
property.priority = property.priority ?? (priority += PRIORITY_DIFF);
|
|
1179
|
+
// Generate sub-fields for property
|
|
1180
|
+
const propFields = await this.getFormFieldsForProp(property, schema, options, parent);
|
|
1181
|
+
fields.push(...propFields);
|
|
1182
|
+
}
|
|
1183
|
+
return fields.filter(ObjectUtils.isObject);
|
|
1184
|
+
}));
|
|
1147
1185
|
const res = [];
|
|
1148
|
-
for (const ix in
|
|
1149
|
-
const schema =
|
|
1150
|
-
const fields =
|
|
1186
|
+
for (const ix in schemas) {
|
|
1187
|
+
const schema = schemas[ix];
|
|
1188
|
+
const fields = fieldsForSchemas[ix];
|
|
1151
1189
|
for (const field of fields) {
|
|
1152
|
-
const index = field.key
|
|
1153
|
-
? res.findIndex(t => t.key === field.key)
|
|
1154
|
-
: res.findIndex(t => t.id === field.id);
|
|
1190
|
+
const index = res.findIndex(t => t.key === field.key);
|
|
1155
1191
|
if (index >= 0) {
|
|
1156
|
-
res[index].schemas.
|
|
1192
|
+
res[index].schemas.add(schema.name);
|
|
1157
1193
|
continue;
|
|
1158
1194
|
}
|
|
1159
|
-
field.schemas.
|
|
1195
|
+
field.schemas.add(schema.name);
|
|
1160
1196
|
res.push(field);
|
|
1161
1197
|
}
|
|
1162
1198
|
}
|
|
1163
|
-
return this.builder.createFieldSets(res, parent, options);
|
|
1199
|
+
return this.builder.createFieldSets(res, parent, options, sets);
|
|
1164
1200
|
}
|
|
1165
1201
|
async getFormFieldsForProp(property, schema, options, parent) {
|
|
1166
1202
|
const field = await this.getFormFieldForProp(property, options, parent);
|
|
@@ -1168,8 +1204,8 @@ class DynamicFormSchemaService {
|
|
|
1168
1204
|
}
|
|
1169
1205
|
async getFormFieldForProp(property, options, parent) {
|
|
1170
1206
|
switch (property.type) {
|
|
1171
|
-
|
|
1172
|
-
|
|
1207
|
+
case "object":
|
|
1208
|
+
return this.getFormEditorConfig(property, options, parent);
|
|
1173
1209
|
case "file":
|
|
1174
1210
|
case "upload":
|
|
1175
1211
|
return this.getFormUploadConfig(property, options, parent);
|
|
@@ -1198,11 +1234,16 @@ class DynamicFormSchemaService {
|
|
|
1198
1234
|
if (refs.length > 0) {
|
|
1199
1235
|
return this.getFormGroupConfig(property, options, parent);
|
|
1200
1236
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1237
|
+
if (this.checkIsEditorProperty(property)) {
|
|
1238
|
+
return this.getFormEditorConfig(property, options, parent);
|
|
1239
|
+
}
|
|
1204
1240
|
return this.getFormInputConfig(property, options, parent);
|
|
1205
1241
|
}
|
|
1242
|
+
checkIsEditorProperty(property) {
|
|
1243
|
+
if (!property.format)
|
|
1244
|
+
return false;
|
|
1245
|
+
return EDITOR_TYPES.indexOf(property.format) >= 0 || property.format.endsWith("script");
|
|
1246
|
+
}
|
|
1206
1247
|
getFormFieldData(property, options) {
|
|
1207
1248
|
const validators = {};
|
|
1208
1249
|
const schema = options.schema;
|
|
@@ -1227,7 +1268,7 @@ class DynamicFormSchemaService {
|
|
|
1227
1268
|
fieldSet: property.fieldSet,
|
|
1228
1269
|
labelPrefix: property.labelPrefix,
|
|
1229
1270
|
purposes: property.purposes || property.purpose,
|
|
1230
|
-
discriminator: property.
|
|
1271
|
+
discriminator: property.discriminatorFn,
|
|
1231
1272
|
priority: property.priority,
|
|
1232
1273
|
componentType: property.componentType,
|
|
1233
1274
|
wrappers: wrappers.filter(ObjectUtils.isStringWithValue),
|
|
@@ -1242,7 +1283,7 @@ class DynamicFormSchemaService {
|
|
|
1242
1283
|
return this.builder.createFormArray(property.id, async (sp) => {
|
|
1243
1284
|
const subSchemas = await this.openApi.getReferences(property, options.schema);
|
|
1244
1285
|
if (subSchemas.length > 0) {
|
|
1245
|
-
return this.
|
|
1286
|
+
return this.getFormFieldsForSchemas(sp, options, ...subSchemas);
|
|
1246
1287
|
}
|
|
1247
1288
|
return this.getFormFieldForProp(property.items, options, sp);
|
|
1248
1289
|
}, {
|
|
@@ -1262,7 +1303,7 @@ class DynamicFormSchemaService {
|
|
|
1262
1303
|
async getFormGroupConfig(property, options, parent) {
|
|
1263
1304
|
return this.builder.createFormGroup(property.id, async (sp) => {
|
|
1264
1305
|
const subSchemas = await this.openApi.getReferences(property, options.schema);
|
|
1265
|
-
return this.
|
|
1306
|
+
return this.getFormFieldsForSchemas(sp, options, ...subSchemas);
|
|
1266
1307
|
}, {
|
|
1267
1308
|
...this.getFormFieldData(property, options),
|
|
1268
1309
|
useTabs: property.useTabs
|
|
@@ -1313,25 +1354,12 @@ class DynamicFormSchemaService {
|
|
|
1313
1354
|
placeholder: property.placeholder || ""
|
|
1314
1355
|
}, parent, options);
|
|
1315
1356
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
// convertObject: property.type !== "string",
|
|
1323
|
-
// autoComplete: property.autoComplete || "off",
|
|
1324
|
-
// multiple: property.type == "array",
|
|
1325
|
-
// accept: ObjectUtils.isString(property.accept) ? property.accept : null,
|
|
1326
|
-
// mask: ObjectUtils.isString(property.mask) ? property.mask : null,
|
|
1327
|
-
// pattern: ObjectUtils.isString(property.pattern) ? property.pattern : null,
|
|
1328
|
-
// step: isNaN(sub.step) ? (isNaN(property.step) ? 1 : property.step) : sub.step,
|
|
1329
|
-
// minLength: isNaN(sub.minLength) ? 0 : sub.minLength,
|
|
1330
|
-
// maxLength: isNaN(sub.maxLength) ? MAX_INPUT_NUM : sub.maxLength,
|
|
1331
|
-
// placeholder: property.placeholder || ""
|
|
1332
|
-
// }
|
|
1333
|
-
// );
|
|
1334
|
-
// }
|
|
1357
|
+
getFormEditorConfig(property, options, parent) {
|
|
1358
|
+
return this.builder.createFormInput(property.id, {
|
|
1359
|
+
...this.getFormFieldData(property, options),
|
|
1360
|
+
type: property.format || "json"
|
|
1361
|
+
}, parent, options);
|
|
1362
|
+
}
|
|
1335
1363
|
getFormDatepickerConfig(property, options, parent) {
|
|
1336
1364
|
const type = property.format == "date-time" ? "datetime-local" : "date";
|
|
1337
1365
|
return this.builder.createFormInput(property.id, {
|
|
@@ -1526,18 +1554,14 @@ class DynamicFormSchemaService {
|
|
|
1526
1554
|
validators.enum = enumValidation(items.enum);
|
|
1527
1555
|
}
|
|
1528
1556
|
}
|
|
1529
|
-
static
|
|
1530
|
-
static
|
|
1557
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormSchemaService, deps: [{ token: i2.OpenApiService }, { token: i0.Injector }, { token: DynamicFormBuilderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1558
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormSchemaService }); }
|
|
1531
1559
|
}
|
|
1532
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormSchemaService, decorators: [{
|
|
1533
1561
|
type: Injectable
|
|
1534
1562
|
}], ctorParameters: () => [{ type: i2.OpenApiService }, { type: i0.Injector }, { type: DynamicFormBuilderService }] });
|
|
1535
1563
|
|
|
1536
1564
|
class DynamicFormService {
|
|
1537
|
-
fs;
|
|
1538
|
-
fb;
|
|
1539
|
-
injector;
|
|
1540
|
-
api;
|
|
1541
1565
|
constructor(fs, fb, injector, api) {
|
|
1542
1566
|
this.fs = fs;
|
|
1543
1567
|
this.fb = fb;
|
|
@@ -1590,6 +1614,7 @@ class DynamicFormService {
|
|
|
1590
1614
|
const root = await wrapOptions.customize(config, {
|
|
1591
1615
|
id: FORM_ROOT_ID,
|
|
1592
1616
|
type: "object",
|
|
1617
|
+
discriminator: null,
|
|
1593
1618
|
properties: schema?.properties || {}
|
|
1594
1619
|
}, schema);
|
|
1595
1620
|
// Check if the customized root wrapper returned an array
|
|
@@ -1691,10 +1716,10 @@ class DynamicFormService {
|
|
|
1691
1716
|
}
|
|
1692
1717
|
});
|
|
1693
1718
|
}
|
|
1694
|
-
static
|
|
1695
|
-
static
|
|
1719
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormService, deps: [{ token: DynamicFormSchemaService }, { token: DynamicFormBuilderService }, { token: i0.Injector }, { token: API_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1720
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormService }); }
|
|
1696
1721
|
}
|
|
1697
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormService, decorators: [{
|
|
1698
1723
|
type: Injectable
|
|
1699
1724
|
}], ctorParameters: () => [{ type: DynamicFormSchemaService }, { type: DynamicFormBuilderService }, { type: i0.Injector }, { type: undefined, decorators: [{
|
|
1700
1725
|
type: Inject,
|
|
@@ -1703,10 +1728,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1703
1728
|
|
|
1704
1729
|
const templateTypes = ["control", "label", "input", "prefix", "suffix"];
|
|
1705
1730
|
class DynamicFormTemplateService {
|
|
1706
|
-
globalTemplates;
|
|
1707
|
-
templatesUpdated;
|
|
1708
|
-
templates;
|
|
1709
|
-
globalTemplatePrefix;
|
|
1710
1731
|
get globalPrefix() {
|
|
1711
1732
|
return this.globalTemplatePrefix;
|
|
1712
1733
|
}
|
|
@@ -1747,28 +1768,14 @@ class DynamicFormTemplateService {
|
|
|
1747
1768
|
this.templates.get(type).delete(key);
|
|
1748
1769
|
this.templatesUpdated.next();
|
|
1749
1770
|
}
|
|
1750
|
-
static
|
|
1751
|
-
static
|
|
1771
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplateService, deps: [{ token: i2.GlobalTemplateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1772
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplateService }); }
|
|
1752
1773
|
}
|
|
1753
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplateService, decorators: [{
|
|
1754
1775
|
type: Injectable
|
|
1755
1776
|
}], ctorParameters: () => [{ type: i2.GlobalTemplateService }] });
|
|
1756
1777
|
|
|
1757
1778
|
class AsyncSubmitDirective extends AsyncMethodBase {
|
|
1758
|
-
method = input(null, { alias: "async-submit" });
|
|
1759
|
-
mode = input("click");
|
|
1760
|
-
form = input();
|
|
1761
|
-
renderer = inject(Renderer2);
|
|
1762
|
-
elem = inject(ElementRef);
|
|
1763
|
-
status = computed(() => {
|
|
1764
|
-
const form = this.form();
|
|
1765
|
-
return form?.status() || null;
|
|
1766
|
-
});
|
|
1767
|
-
group = computed(() => {
|
|
1768
|
-
const form = this.form();
|
|
1769
|
-
return form?.group() || null;
|
|
1770
|
-
});
|
|
1771
|
-
callback = signal(null);
|
|
1772
1779
|
get isDisabled() {
|
|
1773
1780
|
return this.status() !== "VALID";
|
|
1774
1781
|
}
|
|
@@ -1777,6 +1784,20 @@ class AsyncSubmitDirective extends AsyncMethodBase {
|
|
|
1777
1784
|
}
|
|
1778
1785
|
constructor() {
|
|
1779
1786
|
super();
|
|
1787
|
+
this.method = input(null, { alias: "async-submit" });
|
|
1788
|
+
this.mode = input("click");
|
|
1789
|
+
this.form = input();
|
|
1790
|
+
this.renderer = inject(Renderer2);
|
|
1791
|
+
this.elem = inject(ElementRef);
|
|
1792
|
+
this.status = computed(() => {
|
|
1793
|
+
const form = this.form();
|
|
1794
|
+
return form?.status() || null;
|
|
1795
|
+
});
|
|
1796
|
+
this.group = computed(() => {
|
|
1797
|
+
const form = this.form();
|
|
1798
|
+
return form?.group() || null;
|
|
1799
|
+
});
|
|
1800
|
+
this.callback = signal(null);
|
|
1780
1801
|
if (this.elem.nativeElement.tagName === "BUTTON") {
|
|
1781
1802
|
this.renderer.setAttribute(this.elem.nativeElement, "type", "button");
|
|
1782
1803
|
}
|
|
@@ -1819,12 +1840,12 @@ class AsyncSubmitDirective extends AsyncMethodBase {
|
|
|
1819
1840
|
getArgs(ev) {
|
|
1820
1841
|
return untracked(() => [this.form(), this.context(), ev]);
|
|
1821
1842
|
}
|
|
1822
|
-
static
|
|
1823
|
-
static
|
|
1843
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: AsyncSubmitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1844
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.22", 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 } }, host: { properties: { "class.disabled": "this.isDisabled", "class.loading": "this.isLoading" } }, providers: [
|
|
1824
1845
|
{ provide: AsyncMethodBase, useExisting: AsyncSubmitDirective }
|
|
1825
|
-
], exportAs: ["async-submit"], usesInheritance: true, ngImport: i0 });
|
|
1846
|
+
], exportAs: ["async-submit"], usesInheritance: true, ngImport: i0 }); }
|
|
1826
1847
|
}
|
|
1827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1848
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: AsyncSubmitDirective, decorators: [{
|
|
1828
1849
|
type: Directive,
|
|
1829
1850
|
args: [{
|
|
1830
1851
|
standalone: false,
|
|
@@ -1843,19 +1864,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1843
1864
|
}] } });
|
|
1844
1865
|
|
|
1845
1866
|
class DynamicFormTemplateDirective {
|
|
1846
|
-
templates;
|
|
1847
|
-
template;
|
|
1848
|
-
control;
|
|
1849
|
-
label;
|
|
1850
|
-
input;
|
|
1851
|
-
prefix;
|
|
1852
|
-
suffix;
|
|
1853
|
-
setPrefix;
|
|
1854
|
-
setSuffix;
|
|
1855
|
-
setting = null;
|
|
1856
1867
|
constructor(templates, template) {
|
|
1857
1868
|
this.templates = templates;
|
|
1858
1869
|
this.template = template;
|
|
1870
|
+
this.setting = null;
|
|
1859
1871
|
}
|
|
1860
1872
|
ngOnChanges() {
|
|
1861
1873
|
this.ngOnDestroy();
|
|
@@ -1881,10 +1893,10 @@ class DynamicFormTemplateDirective {
|
|
|
1881
1893
|
}
|
|
1882
1894
|
return null;
|
|
1883
1895
|
}
|
|
1884
|
-
static
|
|
1885
|
-
static
|
|
1896
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplateDirective, deps: [{ token: DynamicFormTemplateService, optional: true }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1897
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormTemplateDirective, isStandalone: false, selector: "ng-template[control],\n ng-template[label],\n ng-template[input],\n ng-template[prefix],\n ng-template[suffix],\n ng-template[setPrefix],\n ng-template[setSuffix]", inputs: { control: "control", label: "label", input: "input", prefix: "prefix", suffix: "suffix", setPrefix: "setPrefix", setSuffix: "setSuffix" }, usesOnChanges: true, ngImport: i0 }); }
|
|
1886
1898
|
}
|
|
1887
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1899
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplateDirective, decorators: [{
|
|
1888
1900
|
type: Directive,
|
|
1889
1901
|
args: [{
|
|
1890
1902
|
standalone: false,
|
|
@@ -1915,11 +1927,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1915
1927
|
}] } });
|
|
1916
1928
|
|
|
1917
1929
|
class DynamicFormTemplatePipe {
|
|
1918
|
-
templates;
|
|
1919
|
-
templatesUpdated;
|
|
1920
|
-
cachedKey;
|
|
1921
|
-
cachedType;
|
|
1922
|
-
cachedTemplate;
|
|
1923
1930
|
constructor(templates) {
|
|
1924
1931
|
this.templates = templates;
|
|
1925
1932
|
this.cachedKey = null;
|
|
@@ -1948,10 +1955,10 @@ class DynamicFormTemplatePipe {
|
|
|
1948
1955
|
}
|
|
1949
1956
|
return this.cachedTemplate;
|
|
1950
1957
|
}
|
|
1951
|
-
static
|
|
1952
|
-
static
|
|
1958
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplatePipe, deps: [{ token: DynamicFormTemplateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1959
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplatePipe, isStandalone: false, name: "dynamicFormTemplate", pure: false }); }
|
|
1953
1960
|
}
|
|
1954
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1961
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTemplatePipe, decorators: [{
|
|
1955
1962
|
type: Pipe,
|
|
1956
1963
|
args: [{
|
|
1957
1964
|
standalone: false,
|
|
@@ -1961,9 +1968,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1961
1968
|
}], ctorParameters: () => [{ type: DynamicFormTemplateService }] });
|
|
1962
1969
|
|
|
1963
1970
|
class DynamicFieldType extends FieldType {
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1971
|
+
constructor() {
|
|
1972
|
+
super(...arguments);
|
|
1973
|
+
this.stateChanges = new Subject();
|
|
1974
|
+
this._errorState = false;
|
|
1975
|
+
this._focused = false;
|
|
1976
|
+
}
|
|
1967
1977
|
ngOnDestroy() {
|
|
1968
1978
|
delete this.formField?._control;
|
|
1969
1979
|
this.stateChanges.complete();
|
|
@@ -2050,10 +2060,10 @@ class DynamicFieldType extends FieldType {
|
|
|
2050
2060
|
};
|
|
2051
2061
|
}
|
|
2052
2062
|
}
|
|
2053
|
-
static
|
|
2054
|
-
static
|
|
2063
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFieldType, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2064
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFieldType, isStandalone: false, selector: "dynamic-field-type", usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
|
|
2055
2065
|
}
|
|
2056
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2066
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFieldType, decorators: [{
|
|
2057
2067
|
type: Component,
|
|
2058
2068
|
args: [{
|
|
2059
2069
|
standalone: false,
|
|
@@ -2063,76 +2073,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
2063
2073
|
}] });
|
|
2064
2074
|
|
|
2065
2075
|
class DynamicFormComponent {
|
|
2066
|
-
forms;
|
|
2067
|
-
templates;
|
|
2068
|
-
builder = inject(DynamicFormBuilderService);
|
|
2069
|
-
events = inject(EventsService);
|
|
2070
|
-
languages = inject(LANGUAGE_SERVICE);
|
|
2071
|
-
globalTemplatePrefix = input("dynamic-form");
|
|
2072
|
-
labelPrefix = input("label");
|
|
2073
|
-
labelCustomizer = input(null);
|
|
2074
|
-
testId = input("form");
|
|
2075
|
-
useTabs = input(false);
|
|
2076
|
-
legacyLabels = input(false);
|
|
2077
|
-
data = input({});
|
|
2078
|
-
fields = input(null);
|
|
2079
|
-
options = {
|
|
2080
|
-
fieldChanges: new Subject(),
|
|
2081
|
-
formState: {
|
|
2082
|
-
injector: inject(Injector)
|
|
2083
|
-
}
|
|
2084
|
-
};
|
|
2085
|
-
fieldChanges = this.options.fieldChanges.pipe(map(changes => ({
|
|
2086
|
-
...changes,
|
|
2087
|
-
form: this
|
|
2088
|
-
})));
|
|
2089
|
-
init = this.fieldChanges.pipe(first());
|
|
2090
|
-
valueChanges = this.fieldChanges
|
|
2091
|
-
.pipe(filter(c => c.type === "valueChanges"));
|
|
2092
|
-
expressionChanges = this.fieldChanges
|
|
2093
|
-
.pipe(filter(c => c.type === "expressionChanges"));
|
|
2094
|
-
language = toSignal(this.events.languageChanged, {
|
|
2095
|
-
initialValue: this.languages.currentLanguage
|
|
2096
|
-
});
|
|
2097
|
-
enableTranslations = toSignal(this.events.translationsEnabled, {
|
|
2098
|
-
initialValue: this.languages.enableTranslations
|
|
2099
|
-
});
|
|
2100
|
-
config = computed(() => {
|
|
2101
|
-
const options = {
|
|
2102
|
-
labelPrefix: this.labelPrefix(),
|
|
2103
|
-
labelCustomizer: this.labelCustomizer(),
|
|
2104
|
-
legacyLabels: this.legacyLabels(),
|
|
2105
|
-
testId: this.testId(),
|
|
2106
|
-
};
|
|
2107
|
-
const defs = this.fields();
|
|
2108
|
-
const fields = Array.isArray(defs) ? defs : null;
|
|
2109
|
-
const constructor = this.data()?.constructor;
|
|
2110
|
-
const root = (Array.isArray(defs) ? null : defs) ?? this.builder.createFormGroup(null, parent => this.builder.createFieldSets(fields ?? this.builder.resolveFormFields(constructor, parent, options), parent, options), {
|
|
2111
|
-
label: "",
|
|
2112
|
-
hidden: false,
|
|
2113
|
-
useTabs: this.useTabs(),
|
|
2114
|
-
className: "dynamic-form-root-group"
|
|
2115
|
-
});
|
|
2116
|
-
return [root];
|
|
2117
|
-
});
|
|
2118
|
-
group = computed(() => {
|
|
2119
|
-
this.config();
|
|
2120
|
-
return new FormGroup$1({});
|
|
2121
|
-
});
|
|
2122
|
-
status$ = rxResource({
|
|
2123
|
-
request: () => this.group(),
|
|
2124
|
-
loader: p => controlStatus(p.request),
|
|
2125
|
-
defaultValue: "PENDING"
|
|
2126
|
-
});
|
|
2127
|
-
status = computed(() => this.status$.value());
|
|
2128
|
-
onSubmit = output();
|
|
2129
|
-
onFieldChanges = outputFromObservable(this.fieldChanges);
|
|
2130
|
-
onValueChanges = outputFromObservable(this.valueChanges);
|
|
2131
|
-
onExpressionChanges = outputFromObservable(this.expressionChanges);
|
|
2132
|
-
onInit = outputFromObservable(this.init);
|
|
2133
2076
|
constructor(forms, templates) {
|
|
2134
2077
|
this.forms = forms;
|
|
2135
2078
|
this.templates = templates;
|
|
2079
|
+
this.builder = inject(DynamicFormBuilderService);
|
|
2080
|
+
this.events = inject(EventsService);
|
|
2081
|
+
this.languages = inject(LANGUAGE_SERVICE);
|
|
2082
|
+
this.globalTemplatePrefix = input("dynamic-form");
|
|
2083
|
+
this.labelPrefix = input("label");
|
|
2084
|
+
this.labelCustomizer = input(null);
|
|
2085
|
+
this.testId = input("form");
|
|
2086
|
+
this.useTabs = input(false);
|
|
2087
|
+
this.legacyLabels = input(false);
|
|
2088
|
+
this.data = input({});
|
|
2089
|
+
this.fields = input(null);
|
|
2090
|
+
this.options = {
|
|
2091
|
+
fieldChanges: new Subject(),
|
|
2092
|
+
formState: {
|
|
2093
|
+
injector: inject(Injector)
|
|
2094
|
+
}
|
|
2095
|
+
};
|
|
2096
|
+
this.fieldChanges = this.options.fieldChanges.pipe(map(changes => ({
|
|
2097
|
+
...changes,
|
|
2098
|
+
form: this
|
|
2099
|
+
})));
|
|
2100
|
+
this.init = this.fieldChanges.pipe(first());
|
|
2101
|
+
this.valueChanges = this.fieldChanges
|
|
2102
|
+
.pipe(filter(c => c.type === "valueChanges"));
|
|
2103
|
+
this.expressionChanges = this.fieldChanges
|
|
2104
|
+
.pipe(filter(c => c.type === "expressionChanges"));
|
|
2105
|
+
this.language = toSignal(this.events.languageChanged, {
|
|
2106
|
+
initialValue: this.languages.currentLanguage
|
|
2107
|
+
});
|
|
2108
|
+
this.enableTranslations = toSignal(this.events.translationsEnabled, {
|
|
2109
|
+
initialValue: this.languages.enableTranslations
|
|
2110
|
+
});
|
|
2111
|
+
this.config = computed(() => {
|
|
2112
|
+
const options = {
|
|
2113
|
+
labelPrefix: this.labelPrefix(),
|
|
2114
|
+
labelCustomizer: this.labelCustomizer(),
|
|
2115
|
+
legacyLabels: this.legacyLabels(),
|
|
2116
|
+
testId: this.testId(),
|
|
2117
|
+
};
|
|
2118
|
+
const defs = this.fields();
|
|
2119
|
+
const fields = Array.isArray(defs) ? defs : null;
|
|
2120
|
+
const constructor = this.data()?.constructor;
|
|
2121
|
+
const root = (Array.isArray(defs) ? null : defs) ?? this.builder.createFormGroup(null, parent => this.builder.createFieldSets(fields ?? this.builder.resolveFormFields(constructor, parent, options), parent, options), {
|
|
2122
|
+
label: "",
|
|
2123
|
+
hidden: false,
|
|
2124
|
+
useTabs: this.useTabs(),
|
|
2125
|
+
className: "dynamic-form-root-group"
|
|
2126
|
+
});
|
|
2127
|
+
return [root];
|
|
2128
|
+
});
|
|
2129
|
+
this.group = computed(() => {
|
|
2130
|
+
this.config();
|
|
2131
|
+
return new FormGroup$1({});
|
|
2132
|
+
});
|
|
2133
|
+
this.status$ = rxResource({
|
|
2134
|
+
request: () => this.group(),
|
|
2135
|
+
loader: p => controlStatus(p.request),
|
|
2136
|
+
defaultValue: "PENDING"
|
|
2137
|
+
});
|
|
2138
|
+
this.status = computed(() => this.status$.value());
|
|
2139
|
+
this.onSubmit = output();
|
|
2140
|
+
this.onFieldChanges = outputFromObservable(this.fieldChanges);
|
|
2141
|
+
this.onValueChanges = outputFromObservable(this.valueChanges);
|
|
2142
|
+
this.onExpressionChanges = outputFromObservable(this.expressionChanges);
|
|
2143
|
+
this.onInit = outputFromObservable(this.init);
|
|
2136
2144
|
effect(() => {
|
|
2137
2145
|
this.language();
|
|
2138
2146
|
this.enableTranslations();
|
|
@@ -2163,16 +2171,19 @@ class DynamicFormComponent {
|
|
|
2163
2171
|
const field = this.getField(path);
|
|
2164
2172
|
return field?.formControl ?? null;
|
|
2165
2173
|
}
|
|
2166
|
-
static
|
|
2167
|
-
static
|
|
2174
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormComponent, deps: [{ token: DynamicFormService }, { token: DynamicFormTemplateService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2175
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormComponent, isStandalone: false, selector: "dynamic-form", inputs: { globalTemplatePrefix: { classPropertyName: "globalTemplatePrefix", publicName: "globalTemplatePrefix", isSignal: true, isRequired: false, transformFunction: null }, 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 }, legacyLabels: { classPropertyName: "legacyLabels", publicName: "legacyLabels", 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", onFieldChanges: "onFieldChanges", onValueChanges: "onValueChanges", onExpressionChanges: "onExpressionChanges", onInit: "onInit" }, providers: [DynamicFormTemplateService], 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}.dynamic-form-field>.field-label{position:relative}.dynamic-form-field>.field-label>.field-description{font-size:.95em;font-weight:400;color:#777;margin:0}\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 }); }
|
|
2168
2176
|
}
|
|
2169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormComponent, decorators: [{
|
|
2170
2178
|
type: Component,
|
|
2171
2179
|
args: [{ standalone: false, selector: "dynamic-form", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [DynamicFormTemplateService], 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}.dynamic-form-field>.field-label{position:relative}.dynamic-form-field>.field-label>.field-description{font-size:.95em;font-weight:400;color:#777;margin:0}\n"] }]
|
|
2172
2180
|
}], ctorParameters: () => [{ type: DynamicFormService }, { type: DynamicFormTemplateService }] });
|
|
2173
2181
|
|
|
2174
2182
|
class DynamicFormArrayComponent extends FieldArrayType {
|
|
2175
|
-
|
|
2183
|
+
constructor() {
|
|
2184
|
+
super(...arguments);
|
|
2185
|
+
this.currentTab = signal(0);
|
|
2186
|
+
}
|
|
2176
2187
|
clearItems() {
|
|
2177
2188
|
const control = this.formControl;
|
|
2178
2189
|
while (control.length > 0) {
|
|
@@ -2190,29 +2201,41 @@ class DynamicFormArrayComponent extends FieldArrayType {
|
|
|
2190
2201
|
const length = this.field.fieldGroup.length;
|
|
2191
2202
|
this.currentTab.set(Math.min(this.currentTab(), length - 1));
|
|
2192
2203
|
}
|
|
2193
|
-
static
|
|
2194
|
-
static
|
|
2204
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2205
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormArrayComponent, isStandalone: false, selector: "dynamic-form-array", usesInheritance: true, ngImport: i0, template: "@let label = !props.label || props.hideLabel ? null : props.label | translate;\n@if (field.display) {\n @if (label) {\n <label class=\"field-label\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\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\" [attr.data-testid]=\"field.testId + '-remove-item-' + ix\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" [attr.data-testid]=\"field.testId + '-insert-item-' + ix\" (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 [attr.data-testid]=\"field.testId + '-clear-items'\" icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn [attr.data-testid]=\"field.testId + '-add-item'\" icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n\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}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}.field-errors.invalid-feedback{display:block}\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", "path", "classes"] }, { kind: "component", type: i2.BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "path", "type", "size"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size", "testId", "tabsClass"], outputs: ["valueChange", "selectedChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.GetValuePipe, name: "getValue" }, { kind: "pipe", type: i2.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2195
2206
|
}
|
|
2196
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormArrayComponent, decorators: [{
|
|
2197
2208
|
type: Component,
|
|
2198
2209
|
args: [{ standalone: false, selector: "dynamic-form-array", encapsulation: ViewEncapsulation.None, template: "@let label = !props.label || props.hideLabel ? null : props.label | translate;\n@if (field.display) {\n @if (label) {\n <label class=\"field-label\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\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\" [attr.data-testid]=\"field.testId + '-remove-item-' + ix\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" [attr.data-testid]=\"field.testId + '-insert-item-' + ix\" (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 [attr.data-testid]=\"field.testId + '-clear-items'\" icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn [attr.data-testid]=\"field.testId + '-add-item'\" icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n\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}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}.field-errors.invalid-feedback{display:block}\n"] }]
|
|
2199
2210
|
}] });
|
|
2200
2211
|
|
|
2201
2212
|
class DynamicFormChipsComponent extends DynamicFieldType {
|
|
2202
|
-
static
|
|
2203
|
-
static
|
|
2213
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormChipsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2214
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", 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 [strict]=\"props.strict\"\n [options]=\"props.options | formlySelectOptions | async\"\n [testId]=\"field.testId\"\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: ["testId", "value", "multiple", "disabled", "type", "min", "max", "minLength", "maxLength", "step", "placeholder", "unique", "strict", "options"], outputs: ["valueChange"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2204
2215
|
}
|
|
2205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormChipsComponent, decorators: [{
|
|
2206
2217
|
type: Component,
|
|
2207
2218
|
args: [{ standalone: false, selector: "dynamic-form-chips", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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 [strict]=\"props.strict\"\n [options]=\"props.options | formlySelectOptions | async\"\n [testId]=\"field.testId\"\n [formlyAttributes]=\"field\">\n</chips>\n" }]
|
|
2208
2219
|
}] });
|
|
2209
2220
|
|
|
2221
|
+
class DynamicFormEditorComponent extends DynamicFieldType {
|
|
2222
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2223
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormEditorComponent, isStandalone: false, selector: "dynamic-form-editor", usesInheritance: true, ngImport: i0, template: "<code-editor [lang]=\"props.type\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\">\n</code-editor>\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.CodeEditorComponent, selector: "code-editor", inputs: ["value", "lang", "disabled"], outputs: ["valueChange"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2224
|
+
}
|
|
2225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormEditorComponent, decorators: [{
|
|
2226
|
+
type: Component,
|
|
2227
|
+
args: [{ standalone: false, selector: "dynamic-form-editor", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<code-editor [lang]=\"props.type\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\">\n</code-editor>\n" }]
|
|
2228
|
+
}] });
|
|
2229
|
+
|
|
2210
2230
|
class DynamicFormPasswordComponent extends DynamicFieldType {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2231
|
+
constructor() {
|
|
2232
|
+
super(...arguments);
|
|
2233
|
+
this.type = signal("password");
|
|
2234
|
+
this.icon = computed(() => {
|
|
2235
|
+
return this.type() === "password" ? "eye" : "eye-slash";
|
|
2236
|
+
});
|
|
2237
|
+
this.input = viewChild.required("input");
|
|
2238
|
+
}
|
|
2216
2239
|
switchType() {
|
|
2217
2240
|
const el = this.input().nativeElement;
|
|
2218
2241
|
const start = el.selectionStart;
|
|
@@ -2223,27 +2246,24 @@ class DynamicFormPasswordComponent extends DynamicFieldType {
|
|
|
2223
2246
|
el.setSelectionRange(start, end);
|
|
2224
2247
|
});
|
|
2225
2248
|
}
|
|
2226
|
-
static
|
|
2227
|
-
static
|
|
2249
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormPasswordComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2250
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.22", type: DynamicFormPasswordComponent, isStandalone: false, selector: "dynamic-form-password", viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"form-password-group\">\n <input #input\n class=\"form-control\"\n [attr.type]=\"type()\"\n [attr.data-testid]=\"field.testId\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\" />\n <btn type=\"transparent\"\n [icon]=\"icon()\"\n [attr.data-testid]=\"field.testId + '-toggle'\"\n (mousedown)=\"switchType()\"></btn>\n</div>\n", styles: [".form-password-group{position:relative}.form-password-group btn{display:block;position:absolute;aspect-ratio:1;top:0;bottom:0;right:0}\n"], dependencies: [{ 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "path", "type", "size"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2228
2251
|
}
|
|
2229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormPasswordComponent, decorators: [{
|
|
2230
2253
|
type: Component,
|
|
2231
2254
|
args: [{ standalone: false, selector: "dynamic-form-password", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-password-group\">\n <input #input\n class=\"form-control\"\n [attr.type]=\"type()\"\n [attr.data-testid]=\"field.testId\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\" />\n <btn type=\"transparent\"\n [icon]=\"icon()\"\n [attr.data-testid]=\"field.testId + '-toggle'\"\n (mousedown)=\"switchType()\"></btn>\n</div>\n", styles: [".form-password-group{position:relative}.form-password-group btn{display:block;position:absolute;aspect-ratio:1;top:0;bottom:0;right:0}\n"] }]
|
|
2232
2255
|
}] });
|
|
2233
2256
|
|
|
2234
2257
|
class DynamicFormStaticComponent extends DynamicFieldType {
|
|
2235
|
-
static
|
|
2236
|
-
static
|
|
2258
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormStaticComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2259
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormStaticComponent, isStandalone: false, selector: "dynamic-form-chips", usesInheritance: true, ngImport: i0, template: "<unordered-list [listStyle]=\"props.style\" [ngClass]=\"{disabled: props.disabled}\"\n [data]=\"!props.properties ? {value: value} : props.properties | remap: value\">\n <ng-template [type]=\"!props.properties ? 'key' : null\" selector=\"level == 0\" let-item=\"item\"></ng-template>\n <ng-template type=\"value\" selector=\"valueType == 'date'\" let-item=\"item\">\n {{ item.value | date }}\n </ng-template>\n</unordered-list>\n", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.UnorderedListTemplateDirective, selector: "ng-template[type][selector]", inputs: ["type", "selector"] }, { kind: "component", type: i2.UnorderedListComponent, selector: "unordered-list", inputs: ["data", "keyPrefix", "listStyle", "path", "level", "templates"] }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "pipe", type: i2.RemapPipe, name: "remap" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2237
2260
|
}
|
|
2238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormStaticComponent, decorators: [{
|
|
2239
2262
|
type: Component,
|
|
2240
2263
|
args: [{ standalone: false, selector: "dynamic-form-chips", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<unordered-list [listStyle]=\"props.style\" [ngClass]=\"{disabled: props.disabled}\"\n [data]=\"!props.properties ? {value: value} : props.properties | remap: value\">\n <ng-template [type]=\"!props.properties ? 'key' : null\" selector=\"level == 0\" let-item=\"item\"></ng-template>\n <ng-template type=\"value\" selector=\"valueType == 'date'\" let-item=\"item\">\n {{ item.value | date }}\n </ng-template>\n</unordered-list>\n" }]
|
|
2241
2264
|
}] });
|
|
2242
2265
|
|
|
2243
2266
|
class DynamicFormTranslationComponent extends DynamicFormArrayComponent {
|
|
2244
|
-
events;
|
|
2245
|
-
language;
|
|
2246
|
-
subscription;
|
|
2247
2267
|
constructor(events, language) {
|
|
2248
2268
|
super();
|
|
2249
2269
|
this.events = events;
|
|
@@ -2269,10 +2289,10 @@ class DynamicFormTranslationComponent extends DynamicFormArrayComponent {
|
|
|
2269
2289
|
}
|
|
2270
2290
|
this.currentTab.set(index);
|
|
2271
2291
|
}
|
|
2272
|
-
static
|
|
2273
|
-
static
|
|
2292
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTranslationComponent, deps: [{ token: i2.EventsService }, { token: LANGUAGE_SERVICE }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2293
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormTranslationComponent, isStandalone: false, selector: "dynamic-form-translation", 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 @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n @if (ix === currentTab()) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n\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}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}.field-errors.invalid-feedback{display:block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2274
2294
|
}
|
|
2275
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTranslationComponent, decorators: [{
|
|
2276
2296
|
type: Component,
|
|
2277
2297
|
args: [{ standalone: false, selector: "dynamic-form-translation", 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 @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n @if (ix === currentTab()) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n\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}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}.field-errors.invalid-feedback{display:block}\n"] }]
|
|
2278
2298
|
}], ctorParameters: () => [{ type: i2.EventsService }, { type: undefined, decorators: [{
|
|
@@ -2281,19 +2301,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
2281
2301
|
}] }] });
|
|
2282
2302
|
|
|
2283
2303
|
class DynamicFormUploadComponent extends DynamicFieldType {
|
|
2284
|
-
static
|
|
2285
|
-
static
|
|
2304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2305
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", 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 }); }
|
|
2286
2306
|
}
|
|
2287
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormUploadComponent, decorators: [{
|
|
2288
2308
|
type: Component,
|
|
2289
2309
|
args: [{ standalone: false, selector: "dynamic-form-upload", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
|
|
2290
2310
|
}] });
|
|
2291
2311
|
|
|
2292
2312
|
class DynamicFormWysiwygComponent extends DynamicFieldType {
|
|
2293
|
-
static
|
|
2294
|
-
static
|
|
2313
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormWysiwygComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2314
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormWysiwygComponent, isStandalone: false, selector: "dynamic-form-wysiwyg", usesInheritance: true, ngImport: i0, template: "<wysiwyg [formControl]=\"formControl\"\n [formlyAttributes]=\"field\">\n</wysiwyg>\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.WysiwygComponent, selector: "wysiwyg", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2295
2315
|
}
|
|
2296
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormWysiwygComponent, decorators: [{
|
|
2297
2317
|
type: Component,
|
|
2298
2318
|
args: [{ standalone: false, selector: "dynamic-form-wysiwyg", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<wysiwyg [formControl]=\"formControl\"\n [formlyAttributes]=\"field\">\n</wysiwyg>\n" }]
|
|
2299
2319
|
}] });
|
|
@@ -2302,28 +2322,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
2302
2322
|
* This is just a test wrapper component
|
|
2303
2323
|
*/
|
|
2304
2324
|
class DynamicFormAlertComponent extends FieldWrapper {
|
|
2305
|
-
static
|
|
2306
|
-
static
|
|
2325
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormAlertComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2326
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormAlertComponent, isStandalone: false, selector: "dynamic-form-alert", usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-form-alert\">\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".dynamic-form-alert{border:2px dashed red;width:100%}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2307
2327
|
}
|
|
2308
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormAlertComponent, decorators: [{
|
|
2309
2329
|
type: Component,
|
|
2310
2330
|
args: [{ standalone: false, selector: "dynamic-form-alert", encapsulation: ViewEncapsulation.None, template: "<div class=\"dynamic-form-alert\">\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".dynamic-form-alert{border:2px dashed red;width:100%}\n"] }]
|
|
2311
2331
|
}] });
|
|
2312
2332
|
|
|
2313
2333
|
class DynamicFormFieldComponent extends FieldWrapper {
|
|
2314
|
-
static
|
|
2315
|
-
static
|
|
2334
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2335
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "<ng-template #innerLabelTemplate let-label=\"label\">\n <label class=\"field-label\" [for]=\"id\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n @if (props.description) {\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\n }\n </label>\n</ng-template>\n<ng-template #labelTemplate>\n @let label = !props.label || props.hideLabel ? null : props.label | translate;\n @if (label) {\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\n [context]=\"field\"\n [additionalContext]=\"{label: label}\"></ng-container>\n }\n</ng-template>\n<ng-template #inputTemplate>\n <ng-container #fieldComponent></ng-container>\n</ng-template>\n<ng-template #controlTemplate>\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'prefix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n @if (props.labelAlign === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <div class=\"field-container\">\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'input') || inputTemplate\"\n [ngTemplateOutletContext]=\"field\"></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 @if (props.labelAlign === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'suffix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n</ng-template>\n<ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'control') || controlTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\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.NgxTemplateOutletDirective, selector: "[ngxTemplateOutlet]", inputs: ["context", "additionalContext", "ngxTemplateOutlet"] }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: DynamicFormTemplatePipe, name: "dynamicFormTemplate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2316
2336
|
}
|
|
2317
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
|
|
2318
2338
|
type: Component,
|
|
2319
2339
|
args: [{ standalone: false, selector: "dynamic-form-field", encapsulation: ViewEncapsulation.None, template: "<ng-template #innerLabelTemplate let-label=\"label\">\n <label class=\"field-label\" [for]=\"id\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n @if (props.description) {\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\n }\n </label>\n</ng-template>\n<ng-template #labelTemplate>\n @let label = !props.label || props.hideLabel ? null : props.label | translate;\n @if (label) {\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\n [context]=\"field\"\n [additionalContext]=\"{label: label}\"></ng-container>\n }\n</ng-template>\n<ng-template #inputTemplate>\n <ng-container #fieldComponent></ng-container>\n</ng-template>\n<ng-template #controlTemplate>\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'prefix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n @if (props.labelAlign === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <div class=\"field-container\">\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'input') || inputTemplate\"\n [ngTemplateOutletContext]=\"field\"></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 @if (props.labelAlign === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'suffix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n</ng-template>\n<ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'control') || controlTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n" }]
|
|
2320
2340
|
}] });
|
|
2321
2341
|
|
|
2322
2342
|
class DynamicFormFieldsetComponent extends FieldWrapper {
|
|
2323
|
-
static
|
|
2324
|
-
static
|
|
2343
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2344
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@let label = !props.label || props.hideLabel || field.parent.props.useTabs ? null : props.label | translate;\r\n@if (field.display) {\r\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'prefix'\"\r\n [ngTemplateOutletContext]=\"field\"></ng-container>\r\n <legend class=\"field-legend\" *ngIf=\"label\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n </legend>\r\n <div class=\"field-container\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n </div>\r\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'suffix'\"\r\n [ngTemplateOutletContext]=\"field\"></ng-container>\r\n}\r\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: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: DynamicFormTemplatePipe, name: "dynamicFormTemplate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2325
2345
|
}
|
|
2326
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2346
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormFieldsetComponent, decorators: [{
|
|
2327
2347
|
type: Component,
|
|
2328
2348
|
args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "@let label = !props.label || props.hideLabel || field.parent.props.useTabs ? null : props.label | translate;\r\n@if (field.display) {\r\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'prefix'\"\r\n [ngTemplateOutletContext]=\"field\"></ng-container>\r\n <legend class=\"field-legend\" *ngIf=\"label\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n </legend>\r\n <div class=\"field-container\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n </div>\r\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'suffix'\"\r\n [ngTemplateOutletContext]=\"field\"></ng-container>\r\n}\r\n" }]
|
|
2329
2349
|
}] });
|
|
@@ -2332,10 +2352,10 @@ class DynamicFormGroupComponent extends FieldWrapper {
|
|
|
2332
2352
|
get parent() {
|
|
2333
2353
|
return this.field?.parent;
|
|
2334
2354
|
}
|
|
2335
|
-
static
|
|
2336
|
-
static
|
|
2355
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2356
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "<ng-template #innerLabelTemplate let-label=\"label\">\r\n <label class=\"field-label\" [for]=\"id\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n @if (props.markRequired) {\r\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\r\n }\r\n @if (props.description) {\r\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\r\n }\r\n </label>\r\n</ng-template>\r\n<ng-template #labelTemplate>\r\n @let label = !props.label || props.hideLabel || parent?.props?.useTabs ? null : props.label | translate;\r\n @if (label) {\r\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\r\n [context]=\"field\"\r\n [additionalContext]=\"{label: label}\"></ng-container>\r\n }\r\n</ng-template>\r\n@if (field.display) {\r\n @if (props.labelAlign === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n <tabs class=\"field-container\" [testId]=\"(field.testId || 'form') + '-tab'\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n @if (props.useTabs && itemField.fieldGroup) {\r\n <div class=\"form-fieldset-item\"\r\n [tabsItem]=\"itemField.id\"\r\n [classes]=\"['form-fieldset-tab', itemField.valid === false ? 'invalid' : 'valid']\"\r\n [label]=\"itemField.props.label\">\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n </div>\r\n } @else {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n }\r\n @if (showError && field.key !== null) {\r\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\r\n <formly-validation-message\r\n [field]=\"field\"\r\n id=\"{{ id }}-formly-validation-error\"\r\n role=\"alert\"\r\n ></formly-validation-message>\r\n </div>\r\n }\r\n </tabs>\r\n @if (props.labelAlign === \"after\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n}\r\n", styles: [".dynamic-form-group>.field-container{overflow:hidden}.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: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgxTemplateOutletDirective, selector: "[ngxTemplateOutlet]", inputs: ["context", "additionalContext", "ngxTemplateOutlet"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "path", "classes"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size", "testId", "tabsClass"], outputs: ["valueChange", "selectedChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: DynamicFormTemplatePipe, name: "dynamicFormTemplate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2337
2357
|
}
|
|
2338
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2358
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormGroupComponent, decorators: [{
|
|
2339
2359
|
type: Component,
|
|
2340
2360
|
args: [{ standalone: false, selector: "dynamic-form-group", encapsulation: ViewEncapsulation.None, template: "<ng-template #innerLabelTemplate let-label=\"label\">\r\n <label class=\"field-label\" [for]=\"id\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n @if (props.markRequired) {\r\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\r\n }\r\n @if (props.description) {\r\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\r\n }\r\n </label>\r\n</ng-template>\r\n<ng-template #labelTemplate>\r\n @let label = !props.label || props.hideLabel || parent?.props?.useTabs ? null : props.label | translate;\r\n @if (label) {\r\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\r\n [context]=\"field\"\r\n [additionalContext]=\"{label: label}\"></ng-container>\r\n }\r\n</ng-template>\r\n@if (field.display) {\r\n @if (props.labelAlign === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n <tabs class=\"field-container\" [testId]=\"(field.testId || 'form') + '-tab'\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n @if (props.useTabs && itemField.fieldGroup) {\r\n <div class=\"form-fieldset-item\"\r\n [tabsItem]=\"itemField.id\"\r\n [classes]=\"['form-fieldset-tab', itemField.valid === false ? 'invalid' : 'valid']\"\r\n [label]=\"itemField.props.label\">\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n </div>\r\n } @else {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n }\r\n @if (showError && field.key !== null) {\r\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\r\n <formly-validation-message\r\n [field]=\"field\"\r\n id=\"{{ id }}-formly-validation-error\"\r\n role=\"alert\"\r\n ></formly-validation-message>\r\n </div>\r\n }\r\n </tabs>\r\n @if (props.labelAlign === \"after\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n}\r\n", styles: [".dynamic-form-group>.field-container{overflow:hidden}.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"] }]
|
|
2341
2361
|
}] });
|
|
@@ -2346,6 +2366,7 @@ const components = [
|
|
|
2346
2366
|
DynamicFormComponent,
|
|
2347
2367
|
DynamicFormArrayComponent,
|
|
2348
2368
|
DynamicFormChipsComponent,
|
|
2369
|
+
DynamicFormEditorComponent,
|
|
2349
2370
|
DynamicFormPasswordComponent,
|
|
2350
2371
|
DynamicFormStaticComponent,
|
|
2351
2372
|
DynamicFormTranslationComponent,
|
|
@@ -2374,6 +2395,7 @@ class NgxDynamicFormModule {
|
|
|
2374
2395
|
types: [
|
|
2375
2396
|
{ name: "array", component: DynamicFormArrayComponent },
|
|
2376
2397
|
{ name: "chips", component: DynamicFormChipsComponent },
|
|
2398
|
+
{ name: "editor", component: DynamicFormEditorComponent },
|
|
2377
2399
|
{ name: "password", component: DynamicFormPasswordComponent },
|
|
2378
2400
|
{ name: "static", component: DynamicFormStaticComponent },
|
|
2379
2401
|
{ name: "translation", component: DynamicFormTranslationComponent },
|
|
@@ -2413,18 +2435,18 @@ class NgxDynamicFormModule {
|
|
|
2413
2435
|
static provideForms(config) {
|
|
2414
2436
|
return makeEnvironmentProviders(NgxDynamicFormModule.getProviders(config));
|
|
2415
2437
|
}
|
|
2416
|
-
static
|
|
2417
|
-
static
|
|
2438
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2439
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormEditorComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe], imports: [CommonModule,
|
|
2418
2440
|
FormsModule,
|
|
2419
2441
|
ReactiveFormsModule,
|
|
2420
2442
|
NgxUtilsModule,
|
|
2421
2443
|
FormlyModule,
|
|
2422
|
-
FormlySelectModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe, FormsModule,
|
|
2444
|
+
FormlySelectModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormEditorComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe, FormsModule,
|
|
2423
2445
|
ReactiveFormsModule,
|
|
2424
2446
|
NgxUtilsModule,
|
|
2425
2447
|
FormlyModule,
|
|
2426
|
-
FormlySelectModule] });
|
|
2427
|
-
static
|
|
2448
|
+
FormlySelectModule] }); }
|
|
2449
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, providers: [
|
|
2428
2450
|
...pipes
|
|
2429
2451
|
], imports: [CommonModule,
|
|
2430
2452
|
FormsModule,
|
|
@@ -2435,9 +2457,9 @@ class NgxDynamicFormModule {
|
|
|
2435
2457
|
ReactiveFormsModule,
|
|
2436
2458
|
NgxUtilsModule,
|
|
2437
2459
|
FormlyModule,
|
|
2438
|
-
FormlySelectModule] });
|
|
2460
|
+
FormlySelectModule] }); }
|
|
2439
2461
|
}
|
|
2440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, decorators: [{
|
|
2441
2463
|
type: NgModule,
|
|
2442
2464
|
args: [{
|
|
2443
2465
|
declarations: [
|
|
@@ -2473,5 +2495,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
2473
2495
|
* Generated bundle index. Do not edit.
|
|
2474
2496
|
*/
|
|
2475
2497
|
|
|
2476
|
-
export { AsyncSubmitDirective, DEFAULT_NUMERIC_STEP, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormPasswordComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormStaticComponent, DynamicFormTemplateDirective, DynamicFormTemplatePipe, DynamicFormTemplateService, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent,
|
|
2498
|
+
export { AsyncSubmitDirective, DEFAULT_NUMERIC_STEP, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormEditorComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormPasswordComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormStaticComponent, DynamicFormTemplateDirective, DynamicFormTemplatePipe, DynamicFormTemplateService, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, EDITOR_TYPES, FORM_ROOT_ID, FormArray, FormFieldSet, FormGroup, FormInput, FormSelect, FormSerializable, FormStatic, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, RichTranslationModel, TranslationModel, addFieldValidators, arrayLengthValidation, clearFieldArray, controlStatus, controlValues, convertToDate, convertToDateFormat, convertToNumber, customizeFormField, emailValidation, enumValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, isFieldHidden, isFieldVisible, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldMinDate, setFieldProp, setFieldProps, setFieldSerialize, setFieldValue, translationValidation };
|
|
2477
2499
|
//# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map
|