@stemy/ngx-dynamic-form 19.5.11 → 19.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -324,13 +324,6 @@ function setFieldHooks(field, hooks) {
324
324
  : hooks[name];
325
325
  });
326
326
  }
327
- function additionalFieldValue(field, path) {
328
- return ObjectUtils.getValue(field.additional, path, null, false);
329
- }
330
- function additionalFieldValues(field, values) {
331
- const additional = field.props?.additional || {};
332
- setFieldProp(field, "additional", ObjectUtils.assign(additional, values || {}));
333
- }
334
327
  const MIN_INPUT_NUM = -1999999999;
335
328
  const MAX_INPUT_NUM = 1999999999;
336
329
  const EDITOR_FORMATS = ["php", "json", "html", "css", "scss"];
@@ -401,15 +394,6 @@ function convertToDate(value) {
401
394
  function handleConfigs(configs) {
402
395
  return Array.isArray(configs) ? configs : [configs];
403
396
  }
404
- function isStringWithVal(val) {
405
- return typeof val == "string" && val.length > 0;
406
- }
407
- function findRefs(property) {
408
- const refs = Array.isArray(property.allOf)
409
- ? property.allOf.map(o => o.$ref).filter(isStringWithVal)
410
- : [property.items?.$ref, property.$ref].filter(isStringWithVal);
411
- return refs.map(t => t.split("/").pop());
412
- }
413
397
  function arrayItemActionToExpression(actionName) {
414
398
  return (field) => {
415
399
  const action = field.parent?.props?.[actionName];
@@ -515,7 +499,7 @@ class DynamicFormBuilderService {
515
499
  group.push(field);
516
500
  continue;
517
501
  }
518
- // Otherwise just push the fields to the others
502
+ // Otherwise, push the fields to the others
519
503
  others.push(field);
520
504
  }
521
505
  // Create a field-set wrapper for each group and concat the other fields to the end
@@ -529,9 +513,7 @@ class DynamicFormBuilderService {
529
513
  props: {
530
514
  label: this.getLabel(key, key, parent, options),
531
515
  hidden: false,
532
- additional: {
533
- className: `dynamic-form-fieldset dynamic-form-fieldset-${id}`
534
- }
516
+ className: `dynamic-form-fieldset dynamic-form-fieldset-${id}`
535
517
  },
536
518
  hooks: {},
537
519
  expressions: {}
@@ -578,9 +560,10 @@ class DynamicFormBuilderService {
578
560
  const type = `${data.type || "select"}`;
579
561
  const field = this.createFormField(key, type === "radio" ? type : "select", data, {
580
562
  type,
581
- multiple: data.multiple,
563
+ multiple: data.multiple === true,
564
+ allowEmpty: data.allowEmpty === true,
582
565
  groupBy: data.groupBy,
583
- allowEmpty: data.allowEmpty
566
+ invert: data.invert === true
584
567
  }, parent, options);
585
568
  setFieldHooks(field, {
586
569
  onInit: target => {
@@ -622,7 +605,6 @@ class DynamicFormBuilderService {
622
605
  useTabs: data.useTabs === true,
623
606
  }, parent, options);
624
607
  group.defaultValue = {};
625
- group.wrappers = ["form-group"];
626
608
  const result = fields(group);
627
609
  const handleGroup = (fieldGroup) => {
628
610
  group.fieldGroup = fieldGroup;
@@ -658,11 +640,7 @@ class DynamicFormBuilderService {
658
640
  array.fieldArray = {
659
641
  wrappers: ["form-group"],
660
642
  fieldGroup: items,
661
- props: {
662
- additional: {
663
- className: "dynamic-form-field dynamic-form-group",
664
- }
665
- },
643
+ className: "dynamic-form-field dynamic-form-group",
666
644
  defaultValue: [],
667
645
  hooks: {},
668
646
  expressions
@@ -703,15 +681,16 @@ class DynamicFormBuilderService {
703
681
  options = await Promise.all(options.map(async (option) => {
704
682
  const classes = Array.isArray(option.classes) ? option.classes : [`${option.classes}`];
705
683
  option = Object.assign({}, option);
706
- option.className = classes.filter(isStringWithVal).join(" ");
684
+ option.className = classes.filter(ObjectUtils.isStringWithValue).join(" ");
707
685
  option.label = await this.languages.getTranslation(option.label);
708
686
  option.value = option.value ?? option.id;
709
687
  option.id = option.id ?? option.value;
710
688
  return option;
711
689
  }));
712
690
  const control = field.formControl;
713
- field.defaultValue = options[0]?.value ?? null;
714
- if (field.props.multiple || options.length === 0 || options.findIndex(o => o.value === control.value) >= 0)
691
+ const multiple = field.props.multiple;
692
+ field.defaultValue = multiple ? [] : options[0]?.value ?? null;
693
+ if (multiple || options.length === 0 || options.findIndex(o => o.value === control.value) >= 0)
715
694
  return options;
716
695
  control.setValue(field.defaultValue);
717
696
  return options;
@@ -725,8 +704,13 @@ class DynamicFormBuilderService {
725
704
  return labelItems.filter(l => l.length > 0).join(".");
726
705
  }
727
706
  createFormField(key, type, data, props, parent, options) {
707
+ const wrappers = Array.isArray(data.wrappers) ? Array.from(data.wrappers) : [];
708
+ if (type !== "array") {
709
+ wrappers.unshift(!type ? "form-group" : "form-field");
710
+ }
728
711
  const field = {
729
712
  key,
713
+ wrappers,
730
714
  type: data.componentType || type,
731
715
  fieldSet: String(data.fieldSet || ""),
732
716
  resetOnHide: false,
@@ -739,13 +723,12 @@ class DynamicFormBuilderService {
739
723
  label: options.labelCustomizer?.(key, data.label, parent, options.labelPrefix)
740
724
  ?? this.getLabel(key, data.label, parent, options),
741
725
  hideLabel: data.hideLabel === true,
726
+ classes: data.classes || [],
727
+ layout: data.layout || [],
728
+ className: data.className || "",
742
729
  hideRequiredMarker: data.hideRequiredMarker === true,
743
730
  formCheck: "nolabel",
744
- labelPosition: "before",
745
- additional: {
746
- ...(data.additional || {}),
747
- classes: data.classes || []
748
- }
731
+ labelPosition: "before"
749
732
  },
750
733
  modelOptions: {
751
734
  updateOn: "change"
@@ -789,7 +772,7 @@ class DynamicFormBuilderService {
789
772
  if (!target.display) {
790
773
  return `dynamic-form-field dynamic-form-hidden`;
791
774
  }
792
- const { classes, className } = target.additional || {};
775
+ const { classes, layout, className } = target.props || {};
793
776
  if (className) {
794
777
  return className;
795
778
  }
@@ -797,10 +780,7 @@ class DynamicFormBuilderService {
797
780
  const typeName = ObjectUtils.isConstructor(type)
798
781
  ? `${target.type.name}`.toLowerCase().replace("component", "")
799
782
  : type;
800
- return [`dynamic-form-field`, `dynamic-form-field-${target.key}`, `dynamic-form-${typeName}`].concat(Array.isArray(classes) ? classes : [classes || ""]).filter(c => c?.length > 0).join(" ");
801
- },
802
- additional: (target) => {
803
- return target.props?.additional || {};
783
+ return [`dynamic-form-field`, `dynamic-form-field-${target.key}`, `dynamic-form-${typeName}`].concat(Array.isArray(classes) ? classes : [classes || ""], (Array.isArray(layout) ? layout : [layout || ""]).map(layout => `dynamic-form-layout-${layout}`)).filter(c => c?.length > 0).join(" ");
804
784
  },
805
785
  path: target => {
806
786
  const tp = target.parent;
@@ -854,10 +834,7 @@ class DynamicFormSchemaService {
854
834
  async getSchema(name) {
855
835
  return this.openApi.getSchema(name);
856
836
  }
857
- async getFormFieldsForSchema(name, parent, customizeOrOptions) {
858
- const schema = await this.getSchema(name);
859
- if (!schema)
860
- return [];
837
+ async getFormFieldsForSchema(schema, parent, customizeOrOptions) {
861
838
  const options = await toWrapOptions(customizeOrOptions, this.injector, schema);
862
839
  const keys = Object.keys(schema.properties || {});
863
840
  const fields = [];
@@ -875,7 +852,7 @@ class DynamicFormSchemaService {
875
852
  }
876
853
  async getFormFieldForProp(property, options, parent) {
877
854
  const $enum = property.items?.enum || property.enum;
878
- if (Array.isArray($enum) || isStringWithVal(property.optionsPath) || isStringWithVal(property.endpoint)) {
855
+ if (Array.isArray($enum) || ObjectUtils.isStringWithValue(property.optionsPath) || ObjectUtils.isStringWithValue(property.endpoint)) {
879
856
  return this.getFormSelectConfig($enum, property, options, parent);
880
857
  }
881
858
  switch (property.type) {
@@ -892,7 +869,8 @@ class DynamicFormSchemaService {
892
869
  // if (this.checkIsEditorProperty(property)) {
893
870
  // return this.getFormEditorConfig(property, options, parent);
894
871
  // }
895
- if (findRefs(property).length > 0) {
872
+ const refs = await this.openApi.getReferences(property, options.schema);
873
+ if (refs.length > 0) {
896
874
  return this.getFormGroupConfig(property, options, parent);
897
875
  }
898
876
  if (property.format == "file" || property.format == "upload") {
@@ -917,16 +895,21 @@ class DynamicFormSchemaService {
917
895
  return {
918
896
  hidden: property.hidden === true,
919
897
  disabled: property.disabled === true,
898
+ label: property.label,
899
+ hideRequiredMarker: property.hideRequiredMarker === true,
900
+ hideLabel: property.hideLabel === true,
901
+ classes: property.classes,
902
+ layout: property.layout,
920
903
  serialize: property.serialize === true,
921
- componentType: property.componentType,
922
904
  fieldSet: property.fieldSet,
923
- classes: property.classes,
905
+ componentType: property.componentType,
906
+ wrappers: property.wrappers,
924
907
  validators
925
908
  };
926
909
  }
927
910
  async getFormArrayConfig(property, options, parent) {
928
911
  return this.builder.createFormArray(property.id, async (sp) => {
929
- const subSchemas = findRefs(property);
912
+ const subSchemas = await this.openApi.getReferences(property, options.schema);
930
913
  if (subSchemas.length > 0) {
931
914
  const subModels = await Promise.all(subSchemas.map(s => this.getFormFieldsForSchema(s, sp, options)));
932
915
  return mergeFormFields(ObjectUtils.copy(subModels));
@@ -948,9 +931,9 @@ class DynamicFormSchemaService {
948
931
  }
949
932
  async getFormGroupConfig(property, options, parent) {
950
933
  return this.builder.createFormGroup(property.id, async (sp) => {
951
- const subSchemas = findRefs(property);
952
- const subModels = await Promise.all(subSchemas.map(s => this.getFormFieldsForSchema(s, sp, options)));
953
- return mergeFormFields(subModels);
934
+ const subSchemas = await this.openApi.getReferences(property, options.schema);
935
+ const subFields = await Promise.all(subSchemas.map(s => this.getFormFieldsForSchema(s, sp, options)));
936
+ return mergeFormFields(subFields);
954
937
  }, {
955
938
  ...this.getFormFieldData(property, options),
956
939
  }, parent, options);
@@ -999,7 +982,7 @@ class DynamicFormSchemaService {
999
982
  placeholder: property.placeholder || ""
1000
983
  }, parent, options);
1001
984
  }
1002
- // getFormEditorConfig(property: IOpenApiSchemaProperty, options: ConfigForSchemaWrap): DynamicEditorModelConfig {
985
+ // getFormEditorConfig(property: OpenApiSchemaProperty, options: ConfigForSchemaWrap): DynamicEditorModelConfig {
1003
986
  // const sub = property.type == "array" ? property.items || property : property;
1004
987
  // return Object.assign(
1005
988
  // this.getFormControlConfig(property, options),
@@ -1034,6 +1017,7 @@ class DynamicFormSchemaService {
1034
1017
  type: property.format || "select",
1035
1018
  multiple: property.type == "array",
1036
1019
  groupBy: property.groupBy,
1020
+ invert: property.invert,
1037
1021
  allowEmpty: property.allowEmpty
1038
1022
  }, parent, options);
1039
1023
  }
@@ -1059,7 +1043,7 @@ class DynamicFormSchemaService {
1059
1043
  if (Array.isArray($enum)) {
1060
1044
  return this.getFormEnumOptions($enum, property.id, options, field);
1061
1045
  }
1062
- if (isStringWithVal(property.endpoint)) {
1046
+ if (ObjectUtils.isStringWithValue(property.endpoint)) {
1063
1047
  return this.getFormEndpointOptions(property, field);
1064
1048
  }
1065
1049
  return this.getFormPathOptions(property.optionsPath, field);
@@ -1081,8 +1065,10 @@ class DynamicFormSchemaService {
1081
1065
  const endpoint = entries.reduce((res, [key, control]) => {
1082
1066
  return this.replaceOptionsEndpoint(res, key, control.value);
1083
1067
  }, `${property.endpoint}`);
1084
- this.api.cache[endpoint] = this.api.cache[endpoint] || this.api.list(endpoint, this.api.makeListParams(1, -1));
1085
- const data = await this.api.cache[endpoint];
1068
+ const data = await this.api.list(endpoint, this.api.makeListParams(1, -1), {
1069
+ cache: this.api.cached(property.cache),
1070
+ read: String(property.responseProperty || "")
1071
+ });
1086
1072
  const items = ObjectUtils.isArray(data)
1087
1073
  ? data
1088
1074
  : (ObjectUtils.isArray(data.items) ? data.items : []);
@@ -1226,7 +1212,7 @@ class DynamicFormService {
1226
1212
  };
1227
1213
  const schema = await this.fs.getSchema(name);
1228
1214
  const wrapOptions = await toWrapOptions(customizeOrOptions, this.injector, schema, `"DynamicFormService.${restrictedMethod}" is called from a customizer, which is not allowed. Please use DynamicFormSchemaService instead!`);
1229
- const fields = await this.fs.getFormFieldsForSchema(name, config, wrapOptions);
1215
+ const fields = await this.fs.getFormFieldsForSchema(schema, config, wrapOptions);
1230
1216
  const fieldGroup = [...fields];
1231
1217
  config.fieldGroup = fieldGroup;
1232
1218
  // There are no actual fields in the schema, or no schema exists
@@ -1578,9 +1564,7 @@ class DynamicFormComponent {
1578
1564
  label: "",
1579
1565
  useTabs: this.useTabs(),
1580
1566
  hidden: false,
1581
- additional: {
1582
- className: "dynamic-form-root-group"
1583
- }
1567
+ className: "dynamic-form-root-group"
1584
1568
  }, null, options)
1585
1569
  ];
1586
1570
  });
@@ -1646,7 +1630,7 @@ class DynamicFormArrayComponent extends FieldArrayType {
1646
1630
  this.currentTab.set(Math.min(this.currentTab(), length - 1));
1647
1631
  }
1648
1632
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1649
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormArrayComponent, isStandalone: false, selector: "dynamic-form-array", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "type", "size"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size"], outputs: ["valueChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.GetValuePipe, name: "getValue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1633
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormArrayComponent, isStandalone: false, selector: "dynamic-form-array", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "type", "size"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size", "testId", "tabsClass"], outputs: ["valueChange", "selectedChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.GetValuePipe, name: "getValue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1650
1634
  }
1651
1635
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, decorators: [{
1652
1636
  type: Component,
@@ -1662,6 +1646,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1662
1646
  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 [formlyAttributes]=\"field\">\n</chips>\n" }]
1663
1647
  }] });
1664
1648
 
1649
+ class DynamicFormUploadComponent extends DynamicFieldType {
1650
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1651
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormUploadComponent, isStandalone: false, selector: "dynamic-form-upload", usesInheritance: true, ngImport: i0, template: "<upload [formControl]=\"formControl\"\n [multiple]=\"props.multiple\"\n [inline]=\"props.inline\"\n [accept]=\"props.accept\"\n [baseUrl]=\"props.url\"\n [makeUpload]=\"props.createUploadData\"\n [formlyAttributes]=\"field\">\n</upload>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.UploadComponent, selector: "upload", inputs: ["value", "disabled", "inline", "accept", "baseUrl", "message", "multiple", "buttonText", "makeUpload", "preProcess"], outputs: ["onUploaded", "onRemove"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1652
+ }
1653
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, decorators: [{
1654
+ type: Component,
1655
+ 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" }]
1656
+ }] });
1657
+
1658
+ /**
1659
+ * This is just a test wrapper component
1660
+ */
1661
+ class DynamicFormAlertComponent extends FieldWrapper {
1662
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormAlertComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1663
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", 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 });
1664
+ }
1665
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormAlertComponent, decorators: [{
1666
+ type: Component,
1667
+ 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"] }]
1668
+ }] });
1669
+
1665
1670
  class DynamicFormFieldComponent extends FieldWrapper {
1666
1671
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1667
1672
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "@if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\" [for]=\"id\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.required && props.hideRequiredMarker !== true) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n<div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\n <formly-validation-message\n [field]=\"field\"\n id=\"{{ id }}-formly-validation-error\"\n role=\"alert\"\n ></formly-validation-message>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
@@ -1682,32 +1687,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1682
1687
 
1683
1688
  class DynamicFormGroupComponent extends FieldWrapper {
1684
1689
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1685
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (itemField.display) {\n @if (props.useTabs && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\n [classes]=\"['form-fieldset-tab', itemField.valid ? 'valid' : 'invalid']\"\n [label]=\"itemField.props.label\">\n <formly-field [field]=\"itemField\"></formly-field>\n </div>\n } @else {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n }\n </tabs>\n}\n", styles: [".form-fieldset-item.hidden-tab{display:none}.form-fieldset-tab{position:relative;--invalid-bg: rgba(184, 38, 38, 1);--invalid-border: rgba(184, 38, 38, .6);--invalid-color: #ececec;--invalid-box-size: 15px;--invalid-box-pull: -3px}.form-fieldset-tab.invalid>btn .async-target{border:1px solid var(--invalid-border)}.form-fieldset-tab.invalid:after{background:var(--invalid-bg);color:var(--invalid-color);font-size:10px;line-height:var(--invalid-box-size);width:var(--invalid-box-size);height:var(--invalid-box-size);text-align:center;border-radius:5px;content:\"!\";display:block;position:absolute;top:var(--invalid-box-pull);right:var(--invalid-box-pull)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size"], outputs: ["valueChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.IncludesPipe, name: "includes" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1690
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (itemField.display) {\n @if (props.useTabs && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\n [classes]=\"['form-fieldset-tab', itemField.valid ? 'valid' : 'invalid']\"\n [label]=\"itemField.props.label\">\n <formly-field [field]=\"itemField\"></formly-field>\n </div>\n } @else {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n }\n </tabs>\n}\n", styles: [".form-fieldset-item.hidden-tab{display:none}.form-fieldset-tab{position:relative;--invalid-bg: rgba(184, 38, 38, 1);--invalid-border: rgba(184, 38, 38, .6);--invalid-color: #ececec;--invalid-box-size: 15px;--invalid-box-pull: -3px}.form-fieldset-tab.invalid>btn .async-target{border:1px solid var(--invalid-border)}.form-fieldset-tab.invalid:after{background:var(--invalid-bg);color:var(--invalid-color);font-size:10px;line-height:var(--invalid-box-size);width:var(--invalid-box-size);height:var(--invalid-box-size);text-align:center;border-radius:5px;content:\"!\";display:block;position:absolute;top:var(--invalid-box-pull);right:var(--invalid-box-pull)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size", "testId", "tabsClass"], outputs: ["valueChange", "selectedChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.IncludesPipe, name: "includes" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1686
1691
  }
1687
1692
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, decorators: [{
1688
1693
  type: Component,
1689
1694
  args: [{ standalone: false, selector: "dynamic-form-group", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n }\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (itemField.display) {\n @if (props.useTabs && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\n [classes]=\"['form-fieldset-tab', itemField.valid ? 'valid' : 'invalid']\"\n [label]=\"itemField.props.label\">\n <formly-field [field]=\"itemField\"></formly-field>\n </div>\n } @else {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n }\n </tabs>\n}\n", styles: [".form-fieldset-item.hidden-tab{display:none}.form-fieldset-tab{position:relative;--invalid-bg: rgba(184, 38, 38, 1);--invalid-border: rgba(184, 38, 38, .6);--invalid-color: #ececec;--invalid-box-size: 15px;--invalid-box-pull: -3px}.form-fieldset-tab.invalid>btn .async-target{border:1px solid var(--invalid-border)}.form-fieldset-tab.invalid:after{background:var(--invalid-bg);color:var(--invalid-color);font-size:10px;line-height:var(--invalid-box-size);width:var(--invalid-box-size);height:var(--invalid-box-size);text-align:center;border-radius:5px;content:\"!\";display:block;position:absolute;top:var(--invalid-box-pull);right:var(--invalid-box-pull)}\n"] }]
1690
1695
  }] });
1691
1696
 
1692
- class DynamicFormUploadComponent extends DynamicFieldType {
1693
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1694
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormUploadComponent, isStandalone: false, selector: "dynamic-form-upload", usesInheritance: true, ngImport: i0, template: "<upload [formControl]=\"formControl\"\n [multiple]=\"props.multiple\"\n [inline]=\"props.inline\"\n [accept]=\"props.accept\"\n [baseUrl]=\"props.url\"\n [makeUpload]=\"props.createUploadData\"\n [formlyAttributes]=\"field\">\n</upload>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.UploadComponent, selector: "upload", inputs: ["value", "disabled", "inline", "accept", "baseUrl", "message", "multiple", "buttonText", "makeUpload", "preProcess"], outputs: ["onUploaded", "onRemove"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1695
- }
1696
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, decorators: [{
1697
- type: Component,
1698
- 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" }]
1699
- }] });
1700
-
1701
1697
  // --- Components ---
1702
1698
  const components = [
1703
1699
  DynamicFieldType,
1704
1700
  DynamicFormComponent,
1705
1701
  DynamicFormArrayComponent,
1706
1702
  DynamicFormChipsComponent,
1703
+ DynamicFormUploadComponent,
1704
+ DynamicFormAlertComponent,
1707
1705
  DynamicFormFieldComponent,
1708
1706
  DynamicFormFieldsetComponent,
1709
1707
  DynamicFormGroupComponent,
1710
- DynamicFormUploadComponent
1711
1708
  ];
1712
1709
  // --- Directives ---
1713
1710
  const directives = [
@@ -1723,13 +1720,14 @@ class NgxDynamicFormModule {
1723
1720
  provideFormlyCore({
1724
1721
  types: [
1725
1722
  { name: "array", component: DynamicFormArrayComponent },
1726
- { name: "chips", component: DynamicFormChipsComponent, wrappers: ["form-field"] },
1727
- { name: "upload", component: DynamicFormUploadComponent, wrappers: ["form-field"] }
1723
+ { name: "chips", component: DynamicFormChipsComponent },
1724
+ { name: "upload", component: DynamicFormUploadComponent }
1728
1725
  ],
1729
1726
  wrappers: [
1727
+ { name: "form-alert", component: DynamicFormAlertComponent },
1730
1728
  { name: "form-field", component: DynamicFormFieldComponent },
1731
1729
  { name: "form-fieldset", component: DynamicFormFieldsetComponent },
1732
- { name: "form-group", component: DynamicFormGroupComponent }
1730
+ { name: "form-group", component: DynamicFormGroupComponent },
1733
1731
  ],
1734
1732
  extras: {
1735
1733
  resetFieldOnHide: false,
@@ -1752,11 +1750,11 @@ class NgxDynamicFormModule {
1752
1750
  return makeEnvironmentProviders(NgxDynamicFormModule.getProviders(config));
1753
1751
  }
1754
1752
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1755
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormUploadComponent, AsyncSubmitDirective], imports: [CommonModule,
1753
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormUploadComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective], imports: [CommonModule,
1756
1754
  FormsModule,
1757
1755
  ReactiveFormsModule,
1758
1756
  NgxUtilsModule,
1759
- FormlyModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormUploadComponent, AsyncSubmitDirective, FormsModule,
1757
+ FormlyModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormUploadComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, FormsModule,
1760
1758
  ReactiveFormsModule,
1761
1759
  NgxUtilsModule,
1762
1760
  FormlyModule] });
@@ -1805,5 +1803,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1805
1803
  * Generated bundle index. Do not edit.
1806
1804
  */
1807
1805
 
1808
- export { AsyncSubmitDirective, DynamicFieldType, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_ID, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, addFieldValidators, additionalFieldValue, additionalFieldValues, clearFieldArray, controlStatus, controlValues, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, translationValidation };
1806
+ export { AsyncSubmitDirective, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_ID, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, addFieldValidators, clearFieldArray, controlStatus, controlValues, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, translationValidation };
1809
1807
  //# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map