@stemy/ngx-dynamic-form 19.4.9 → 19.4.12

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.
@@ -1,8 +1,8 @@
1
1
  import * as i2 from '@stemy/ngx-utils';
2
2
  import { cachedFactory, ReflectUtils, ObjectUtils, LANGUAGE_SERVICE, ForbiddenZone, API_SERVICE, StringUtils, TOASTER_SERVICE, EventsService, NgxUtilsModule } from '@stemy/ngx-utils';
3
+ import { Observable, firstValueFrom, BehaviorSubject, distinctUntilChanged, combineLatestWith, switchMap, startWith, isObservable, first, Subject } from 'rxjs';
3
4
  import * as i0 from '@angular/core';
4
5
  import { Inject, Injectable, input, output, inject, Renderer2, ElementRef, computed, signal, effect, HostListener, HostBinding, Directive, Type, Component, Injector, ChangeDetectionStrategy, ViewEncapsulation, makeEnvironmentProviders, NgModule } from '@angular/core';
5
- import { BehaviorSubject, Observable, distinctUntilChanged, combineLatestWith, switchMap, startWith, isObservable, firstValueFrom, first, Subject } from 'rxjs';
6
6
  import * as i1 from '@angular/forms';
7
7
  import { FormGroup as FormGroup$1, FormArray as FormArray$1, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
8
  import { debounceTime } from 'rxjs/operators';
@@ -211,8 +211,39 @@ function getFieldsByPredicate(field, cb) {
211
211
  function getFieldsByKey(field, key) {
212
212
  return getFieldsByPredicate(field, f => f.key === key);
213
213
  }
214
+ async function getSelectOptions(field) {
215
+ const options = field.props?.options || [];
216
+ if (options instanceof Observable) {
217
+ return firstValueFrom(options);
218
+ }
219
+ return options;
220
+ }
221
+ function replaceFieldArray(field, items) {
222
+ const model = field.model || [];
223
+ model.splice(0, model.length, ...items);
224
+ field.options.build(field);
225
+ }
226
+ function clearFieldArray(field) {
227
+ const model = field.model || [];
228
+ model.splice(0, model.length);
229
+ field.options.build(field);
230
+ }
231
+ function insertToFieldArray(field, item, ix) {
232
+ const model = field.model || [];
233
+ ix = ix == null ? model.length : ix;
234
+ model.splice(ix, 0, item);
235
+ field.options.build(field);
236
+ }
237
+ function removeFromFieldArray(field, ix) {
238
+ const model = field.model || [];
239
+ model.splice(ix, 1);
240
+ field.options.build(field);
241
+ }
214
242
  function setFieldHidden(field, hidden = true) {
215
- field.hide = hidden;
243
+ field.props = {
244
+ ...(field.props || {}),
245
+ hidden
246
+ };
216
247
  }
217
248
  function setFieldDisabled(field, disabled = true) {
218
249
  field.props = {
@@ -236,9 +267,7 @@ function setFieldHooks(field, hooks) {
236
267
  });
237
268
  }
238
269
  function additionalFieldValue(field, path) {
239
- field.props = field.props || {};
240
- field.props.additional = field.props.additional || {};
241
- return ObjectUtils.getValue(field.props.additional, path, null, false);
270
+ return ObjectUtils.getValue(field.additional, path, null, false);
242
271
  }
243
272
  function additionalFieldValues(field, values) {
244
273
  field.props = field.props || {};
@@ -323,6 +352,19 @@ function findRefs(property) {
323
352
  : [property.items?.$ref, property.$ref].filter(isStringWithVal);
324
353
  return refs.map(t => t.split("/").pop());
325
354
  }
355
+ function arrayItemActionToExpression(actionName) {
356
+ return (field) => {
357
+ const action = field.parent?.props?.[actionName];
358
+ // Needed to immediately reflect the changes on the view
359
+ field.options.detectChanges(field);
360
+ if (action === false)
361
+ return false;
362
+ // Returns the actual calculated value
363
+ return ObjectUtils.isFunction(action)
364
+ ? action(field.formControl?.value, Number(field.key), field)
365
+ : true;
366
+ };
367
+ }
326
368
  function mergeFormFields(formFields) {
327
369
  const res = [];
328
370
  for (const formModel of formFields) {
@@ -406,9 +448,8 @@ class DynamicFormBuilderService {
406
448
  return true;
407
449
  });
408
450
  for (const field of fields) {
409
- const fsName = field.hide ? null : String(field.fieldSet || "");
410
- // If we have a fieldset name defined and have actual fields for it
411
- // then push the property fields into a group
451
+ const fsName = String(field.fieldSet || "");
452
+ // If we have a fieldset name defined, then push the property fields into a group
412
453
  if (fsName) {
413
454
  const fsId = !parent?.path ? fsName : `${parent.path}.${fsName}`;
414
455
  const group = groups[fsId] || [];
@@ -427,10 +468,12 @@ class DynamicFormBuilderService {
427
468
  parent,
428
469
  fieldGroup: groups[id],
429
470
  wrappers: ["form-fieldset"],
430
- className: `dynamic-form-fieldset dynamic-form-fieldset-${id}`,
431
471
  props: {
432
472
  label: this.getLabel(key, key, parent, options),
433
- hidden: false
473
+ hidden: false,
474
+ additional: {
475
+ className: `dynamic-form-fieldset dynamic-form-fieldset-${id}`
476
+ }
434
477
  },
435
478
  hooks: {},
436
479
  expressions: {}
@@ -507,7 +550,9 @@ class DynamicFormBuilderService {
507
550
  }
508
551
  createFormGroup(key, fields, data, parent, options) {
509
552
  data = data || {};
510
- const group = this.createFormField(key, undefined, data, {}, parent, options);
553
+ const group = this.createFormField(key, undefined, data, {
554
+ useTabs: data.useTabs === true
555
+ }, parent, options);
511
556
  group.wrappers = ["form-group"];
512
557
  const result = fields(group);
513
558
  const handleGroup = (fieldGroup) => {
@@ -525,23 +570,34 @@ class DynamicFormBuilderService {
525
570
  // sortable: data.sortable || false,
526
571
  useTabs: data.useTabs === true,
527
572
  tabsLabel: `${data.tabsLabel || "label"}`,
573
+ insertItem: data.insertItem,
574
+ cloneItem: data.cloneItem,
575
+ moveItem: data.moveItem,
576
+ removeItem: data.removeItem,
528
577
  addItem: data.addItem !== false,
529
- insertItem: data.insertItem !== false,
530
- cloneItem: data.cloneItem !== false,
531
- moveItem: data.moveItem !== false,
532
- removeItem: data.removeItem !== false,
533
578
  clearItems: data.clearItems !== false
534
579
  }, parent, options);
535
580
  const result = fields(array);
536
581
  const handleItems = (items) => {
582
+ const expressions = {
583
+ insertItem: arrayItemActionToExpression("insertItem"),
584
+ cloneItem: arrayItemActionToExpression("cloneItem"),
585
+ moveItem: arrayItemActionToExpression("moveItem"),
586
+ removeItem: arrayItemActionToExpression("removeItem")
587
+ };
537
588
  if (Array.isArray(items)) {
538
589
  array.fieldArray = {
539
590
  wrappers: ["form-group"],
540
- className: "dynamic-form-field dynamic-form-group",
541
591
  fieldGroup: items,
592
+ props: {
593
+ additional: {
594
+ className: "dynamic-form-field dynamic-form-group",
595
+ }
596
+ },
542
597
  hooks: {},
543
- expressions: {}
598
+ expressions
544
599
  };
600
+ this.setExpressions(array.fieldArray, options);
545
601
  return array;
546
602
  }
547
603
  const props = items.props || {};
@@ -559,8 +615,10 @@ class DynamicFormBuilderService {
559
615
  ...items,
560
616
  props: {
561
617
  ...items.props,
562
- label: ""
563
- }
618
+ label: "",
619
+ },
620
+ hooks: {},
621
+ expressions
564
622
  };
565
623
  return array;
566
624
  };
@@ -605,7 +663,6 @@ class DynamicFormBuilderService {
605
663
  const field = {
606
664
  key,
607
665
  validators,
608
- hide: data.hidden === true,
609
666
  type: data.componentType || type,
610
667
  fieldSet: String(data.fieldSet || ""),
611
668
  resetOnHide: false,
@@ -618,11 +675,14 @@ class DynamicFormBuilderService {
618
675
  props: {
619
676
  ...props,
620
677
  disabled: data.disabled === true,
678
+ hidden: data.hidden === true,
621
679
  formCheck: "nolabel",
622
680
  required: !!validators.required,
623
681
  label: options.labelCustomizer?.(key, data.label, parent, options.labelPrefix)
624
682
  ?? this.getLabel(key, data.label, parent, options),
625
- additional: {}
683
+ additional: {
684
+ classes: data.classes || []
685
+ }
626
686
  },
627
687
  modelOptions: {
628
688
  updateOn: "change"
@@ -631,14 +691,7 @@ class DynamicFormBuilderService {
631
691
  hooks: {},
632
692
  expressions: {
633
693
  serializer: () => data.serializer,
634
- serialize: () => data.serialize,
635
- additional: (target) => target.props.additional,
636
- className: (target) => {
637
- const type = ObjectUtils.isConstructor(target.type)
638
- ? `${target.type.name}`.toLowerCase().replace("component", "")
639
- : `${target.type || "group"}`;
640
- return target.hide ? `` : [`dynamic-form-field`, `dynamic-form-field-${target.key}`, `dynamic-form-${type}`].concat(Array.isArray(data.classes) ? data.classes : [data.classes || ""]).filter(c => c?.length > 0).join(" ");
641
- }
694
+ serialize: () => data.serialize
642
695
  }
643
696
  };
644
697
  // Parent object will be available for customizers as a property, until it gets redefined by formly
@@ -652,18 +705,31 @@ class DynamicFormBuilderService {
652
705
  }
653
706
  setExpressions(field, options) {
654
707
  const expressions = {
655
- tabs: target => {
656
- if (target.fieldArray) {
657
- const group = target.fieldGroup || [];
658
- return group.map((g, ix) => {
659
- const label = ObjectUtils.getValue(g.formControl?.value, target.props?.tabsLabel || "label", ix);
660
- return {
661
- value: ix,
662
- label: `${label}`
663
- };
664
- });
708
+ display: target => {
709
+ const display = target.props?.hidden !== true;
710
+ if (target.fieldGroup?.length) {
711
+ return display && target.fieldGroup.some(f => f.display);
712
+ }
713
+ return display;
714
+ },
715
+ className: (target) => {
716
+ if (target.display === false) {
717
+ return `dynamic-form-field dynamic-form-hidden`;
665
718
  }
666
- return [];
719
+ const { classes, className } = target.additional || {};
720
+ if (className) {
721
+ return className;
722
+ }
723
+ const type = String(target.type || "group").replace("formly-", "");
724
+ const typeName = ObjectUtils.isConstructor(type)
725
+ ? `${target.type.name}`.toLowerCase().replace("component", "")
726
+ : type;
727
+ return [`dynamic-form-field`, `dynamic-form-field-${target.key}`, `dynamic-form-${typeName}`].concat(Array.isArray(classes) ? classes : [classes || ""]).filter(c => c?.length > 0).join(" ");
728
+ },
729
+ additional: (target) => {
730
+ target.props = target.props || {};
731
+ target.props.additional = target.props.additional || {};
732
+ return target.props.additional;
667
733
  },
668
734
  path: target => {
669
735
  const tp = target.parent;
@@ -742,34 +808,32 @@ class DynamicFormSchemaService {
742
808
  return this.getFormSelectConfig($enum, property, options, parent);
743
809
  }
744
810
  switch (property.type) {
745
- case "string":
746
- case "number":
747
- case "integer":
748
- case "textarea":
749
- // if (this.checkIsEditorProperty(property)) {
750
- // return this.getFormEditorConfig(property, options, parent);
751
- // }
752
- if (property.format == "textarea") {
753
- return this.getFormTextareaConfig(property, options, parent);
754
- }
755
- if (property.format == "date" || property.format == "date-time") {
756
- return this.getFormDatepickerConfig(property, options, parent);
757
- }
758
- return this.getFormInputConfig(property, options, parent);
759
811
  // case "object":
760
812
  // return this.getFormEditorConfig(property, options, parent);
813
+ case "file":
814
+ case "upload":
815
+ return this.getFormUploadConfig(property, options, parent);
761
816
  case "boolean":
762
817
  return this.getFormCheckboxConfig(property, options, parent);
763
818
  case "array":
764
819
  return this.getFormArrayConfig(property, options, parent);
765
- case "file":
766
- case "upload":
767
- return this.getFormUploadConfig(property, options, parent);
768
820
  }
821
+ // if (this.checkIsEditorProperty(property)) {
822
+ // return this.getFormEditorConfig(property, options, parent);
823
+ // }
769
824
  if (findRefs(property).length > 0) {
770
825
  return this.getFormGroupConfig(property, options, parent);
771
826
  }
772
- return null;
827
+ if (property.format == "file" || property.format == "upload") {
828
+ return this.getFormUploadConfig(property, options, parent);
829
+ }
830
+ if (property.format == "textarea") {
831
+ return this.getFormTextareaConfig(property, options, parent);
832
+ }
833
+ if (property.format == "date" || property.format == "date-time") {
834
+ return this.getFormDatepickerConfig(property, options, parent);
835
+ }
836
+ return this.getFormInputConfig(property, options, parent);
773
837
  }
774
838
  getFormFieldData(property, options) {
775
839
  const validators = {};
@@ -1418,6 +1482,7 @@ class DynamicFormComponent {
1418
1482
  labelPrefix = input("label");
1419
1483
  labelCustomizer = input(null);
1420
1484
  testId = input("");
1485
+ useTabs = input(false);
1421
1486
  data = input({});
1422
1487
  fields = input(null);
1423
1488
  fieldChanges = new Subject();
@@ -1428,11 +1493,19 @@ class DynamicFormComponent {
1428
1493
  initialValue: this.languages.enableTranslations
1429
1494
  });
1430
1495
  config = computed(() => {
1431
- return this.fields() || this.builder.resolveFormFields(this.data()?.constructor, null, {
1496
+ const options = {
1432
1497
  labelPrefix: this.labelPrefix(),
1433
1498
  labelCustomizer: this.labelCustomizer(),
1434
1499
  testId: this.testId(),
1435
- });
1500
+ };
1501
+ const fields = this.fields() || this.builder.resolveFormFields(this.data()?.constructor, null, options);
1502
+ return [
1503
+ this.builder.createFormGroup(null, () => fields, {
1504
+ label: "",
1505
+ useTabs: this.useTabs(),
1506
+ hidden: false
1507
+ }, null, options)
1508
+ ];
1436
1509
  });
1437
1510
  group = computed(() => {
1438
1511
  this.config();
@@ -1470,11 +1543,11 @@ class DynamicFormComponent {
1470
1543
  this.options?.resetModel?.();
1471
1544
  }
1472
1545
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1473
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormComponent, isStandalone: false, selector: "dynamic-form", inputs: { labelPrefix: { classPropertyName: "labelPrefix", publicName: "labelPrefix", isSignal: true, isRequired: false, transformFunction: null }, labelCustomizer: { classPropertyName: "labelCustomizer", publicName: "labelCustomizer", isSignal: true, isRequired: false, transformFunction: null }, testId: { classPropertyName: "testId", publicName: "testId", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSubmit: "onSubmit" }, ngImport: i0, template: "@if (config() && group()) {\n <form [formGroup]=\"group()\" (ngSubmit)=\"submit()\" autocomplete=\"off\" role=\"presentation\">\n <input type=\"submit\" [hidden]=\"true\" />\n <formly-form [model]=\"data()\"\n [fields]=\"config()\"\n [form]=\"group()\"\n [options]=\"options\"></formly-form>\n <ng-content></ng-content>\n </form>\n}\n", 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 });
1546
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormComponent, isStandalone: false, selector: "dynamic-form", inputs: { labelPrefix: { classPropertyName: "labelPrefix", publicName: "labelPrefix", isSignal: true, isRequired: false, transformFunction: null }, labelCustomizer: { classPropertyName: "labelCustomizer", publicName: "labelCustomizer", isSignal: true, isRequired: false, transformFunction: null }, testId: { classPropertyName: "testId", publicName: "testId", isSignal: true, isRequired: false, transformFunction: null }, useTabs: { classPropertyName: "useTabs", publicName: "useTabs", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSubmit: "onSubmit" }, ngImport: i0, template: "@if (config() && group()) {\n <form [formGroup]=\"group()\" (ngSubmit)=\"submit()\" autocomplete=\"off\" role=\"presentation\">\n <input type=\"submit\" [hidden]=\"true\" />\n <formly-form [model]=\"data()\"\n [fields]=\"config()\"\n [form]=\"group()\"\n [options]=\"options\"></formly-form>\n <ng-content></ng-content>\n </form>\n}\n", styles: [".dynamic-form-field.dynamic-form-hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.LegacyFormlyForm, selector: "formly-form" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1474
1547
  }
1475
1548
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormComponent, decorators: [{
1476
1549
  type: Component,
1477
- args: [{ standalone: false, selector: "dynamic-form", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
1550
+ args: [{ standalone: false, selector: "dynamic-form", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (config() && group()) {\n <form [formGroup]=\"group()\" (ngSubmit)=\"submit()\" autocomplete=\"off\" role=\"presentation\">\n <input type=\"submit\" [hidden]=\"true\" />\n <formly-form [model]=\"data()\"\n [fields]=\"config()\"\n [form]=\"group()\"\n [options]=\"options\"></formly-form>\n <ng-content></ng-content>\n </form>\n}\n", styles: [".dynamic-form-field.dynamic-form-hidden{display:none}\n"] }]
1478
1551
  }], ctorParameters: () => [] });
1479
1552
 
1480
1553
  class DynamicFormArrayComponent extends FieldArrayType {
@@ -1497,11 +1570,11 @@ class DynamicFormArrayComponent extends FieldArrayType {
1497
1570
  this.currentTab.set(Math.min(this.currentTab(), length - 1));
1498
1571
  }
1499
1572
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1500
- 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: "<label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n</label>\n<div class=\"field-container\">\n @if (props.useTabs) {\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (field of field.fieldGroup; track field.key; let ix = $index) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(field.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <div class=\"form-array-buttons\">\n @if (props.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (props.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"field\"></formly-field>\n </div>\n }\n </tabs>\n } @else {\n @for (field of field.fieldGroup; track field; let ix = $index) {\n <div class=\"form-array-item\">\n <div class=\"form-array-buttons\">\n @if (props.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (props.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"field\"></formly-field>\n </div>\n }\n }\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", styles: [".form-array-item.hidden-tab{display:none}\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"] }, { 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 });
1573
+ 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 <label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}\n"], 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 });
1501
1574
  }
1502
1575
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, decorators: [{
1503
1576
  type: Component,
1504
- args: [{ standalone: false, selector: "dynamic-form-array", encapsulation: ViewEncapsulation.None, template: "<label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n</label>\n<div class=\"field-container\">\n @if (props.useTabs) {\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (field of field.fieldGroup; track field.key; let ix = $index) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(field.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <div class=\"form-array-buttons\">\n @if (props.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (props.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"field\"></formly-field>\n </div>\n }\n </tabs>\n } @else {\n @for (field of field.fieldGroup; track field; let ix = $index) {\n <div class=\"form-array-item\">\n <div class=\"form-array-buttons\">\n @if (props.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (props.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"field\"></formly-field>\n </div>\n }\n }\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", styles: [".form-array-item.hidden-tab{display:none}\n"] }]
1577
+ args: [{ standalone: false, selector: "dynamic-form-array", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n <label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}\n"] }]
1505
1578
  }] });
1506
1579
 
1507
1580
  class DynamicFormChipsComponent extends DynamicFieldType {
@@ -1515,11 +1588,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1515
1588
 
1516
1589
  class DynamicFormFieldComponent extends FieldWrapper {
1517
1590
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1518
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "<label class=\"field-label\" [for]=\"id\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n <span class=\"field-required\" *ngIf=\"props.required && props.hideRequiredMarker !== true\" aria-hidden=\"true\">*</span>\n</label>\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 id=\"{{ id }}-formly-validation-error\"\n [field]=\"field\"\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 });
1591
+ 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 (field.display) {\n <label class=\"field-label\" [for]=\"id\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n <span class=\"field-required\" *ngIf=\"props.required\" aria-hidden=\"true\">*</span>\n </label>\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}\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 });
1519
1592
  }
1520
1593
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
1521
1594
  type: Component,
1522
- args: [{ standalone: false, selector: "dynamic-form-field", encapsulation: ViewEncapsulation.None, template: "<label class=\"field-label\" [for]=\"id\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n <span class=\"field-required\" *ngIf=\"props.required && props.hideRequiredMarker !== true\" aria-hidden=\"true\">*</span>\n</label>\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 id=\"{{ id }}-formly-validation-error\"\n [field]=\"field\"\n role=\"alert\"\n ></formly-validation-message>\n </div>\n</div>\n" }]
1595
+ args: [{ standalone: false, selector: "dynamic-form-field", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n <label class=\"field-label\" [for]=\"id\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n <span class=\"field-required\" *ngIf=\"props.required\" aria-hidden=\"true\">*</span>\n </label>\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}\n" }]
1523
1596
  }] });
1524
1597
 
1525
1598
  class DynamicFormFieldsetComponent extends FieldWrapper {
@@ -1528,20 +1601,20 @@ class DynamicFormFieldsetComponent extends FieldWrapper {
1528
1601
  // console.log(this.field.parent);
1529
1602
  }
1530
1603
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1531
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "<legend class=\"field-legend\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n</legend>\n<div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1604
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n </div>\n}\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1532
1605
  }
1533
1606
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, decorators: [{
1534
1607
  type: Component,
1535
- args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "<legend class=\"field-legend\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n</legend>\n<div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n</div>\n" }]
1608
+ args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\n </div>\n}\n" }]
1536
1609
  }] });
1537
1610
 
1538
1611
  class DynamicFormGroupComponent extends FieldWrapper {
1539
1612
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1540
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "<label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n</label>\n<ng-container #fieldComponent></ng-container>\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
1613
+ 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 <label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (props.useTabs && itemField.display && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\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 </tabs>\n}\n", styles: [".form-fieldset-item.hidden-tab{display:none}\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 });
1541
1614
  }
1542
1615
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, decorators: [{
1543
1616
  type: Component,
1544
- args: [{ standalone: false, selector: "dynamic-form-group", encapsulation: ViewEncapsulation.None, template: "<label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n</label>\n<ng-container #fieldComponent></ng-container>\n" }]
1617
+ args: [{ standalone: false, selector: "dynamic-form-group", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n <label class=\"field-label\" *ngIf=\"props.label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n </label>\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (props.useTabs && itemField.display && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\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 </tabs>\n}\n", styles: [".form-fieldset-item.hidden-tab{display:none}\n"] }]
1545
1618
  }] });
1546
1619
 
1547
1620
  class DynamicFormUploadComponent extends DynamicFieldType {
@@ -1659,5 +1732,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1659
1732
  * Generated bundle index. Do not edit.
1660
1733
  */
1661
1734
 
1662
- export { AsyncSubmitDirective, DynamicFieldType, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_KEY, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, additionalFieldValue, additionalFieldValues, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, replaceSpecialChars, requiredValidation, setFieldDisabled, setFieldHidden, setFieldHooks, translationValidation, validationMessage };
1735
+ export { AsyncSubmitDirective, DynamicFieldType, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_KEY, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, additionalFieldValue, additionalFieldValues, clearFieldArray, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDisabled, setFieldHidden, setFieldHooks, translationValidation, validationMessage };
1663
1736
  //# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map