@stemy/ngx-dynamic-form 19.9.16 → 19.9.18

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Inject, Injectable, untracked, input, Renderer2, ElementRef, computed, signal, effect, HostBinding, Directive, Input, Pipe, Type, Component, Injector, output, ChangeDetectionStrategy, ViewEncapsulation, viewChild, makeEnvironmentProviders, NgModule } from '@angular/core';
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
4
  import { cachedFactory, ReflectUtils, ObjectUtils, LANGUAGE_SERVICE, ForbiddenZone, ArrayUtils, API_SERVICE, StringUtils, AsyncMethodBase, EventsService, NgxUtilsModule } from '@stemy/ngx-utils';
5
5
  import { of, merge, Observable, firstValueFrom, BehaviorSubject, combineLatestWith, switchMap, distinctUntilChanged, first, Subject, map, filter } from 'rxjs';
@@ -1831,6 +1831,8 @@ class DynamicFormTemplateDirective {
1831
1831
  this.templates.remove(...this.setting);
1832
1832
  }
1833
1833
  selectType() {
1834
+ if (!this.templates)
1835
+ return null;
1834
1836
  const inputs = Object.keys(this);
1835
1837
  for (const input of inputs) {
1836
1838
  const value = this[input];
@@ -1840,7 +1842,7 @@ class DynamicFormTemplateDirective {
1840
1842
  }
1841
1843
  return null;
1842
1844
  }
1843
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateDirective, deps: [{ token: DynamicFormTemplateService }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1845
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateDirective, deps: [{ token: DynamicFormTemplateService, optional: true }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1844
1846
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", 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 });
1845
1847
  }
1846
1848
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateDirective, decorators: [{
@@ -1855,7 +1857,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
1855
1857
  ng-template[setPrefix],
1856
1858
  ng-template[setSuffix]`
1857
1859
  }]
1858
- }], ctorParameters: () => [{ type: DynamicFormTemplateService }, { type: i0.TemplateRef }], propDecorators: { control: [{
1860
+ }], ctorParameters: () => [{ type: DynamicFormTemplateService, decorators: [{
1861
+ type: Optional
1862
+ }] }, { type: i0.TemplateRef }], propDecorators: { control: [{
1859
1863
  type: Input
1860
1864
  }], label: [{
1861
1865
  type: Input
@@ -2064,7 +2068,7 @@ class DynamicFormComponent {
2064
2068
  const defs = this.fields();
2065
2069
  const fields = Array.isArray(defs) ? defs : null;
2066
2070
  const constructor = this.data()?.constructor;
2067
- const root = (Array.isArray(defs) ? null : defs) ?? this.builder.createFormGroup(null, parent => this.builder.createFieldSets(fields ?? this.builder.resolveFormFields(constructor, parent, options), parent), {
2071
+ const root = (Array.isArray(defs) ? null : defs) ?? this.builder.createFormGroup(null, parent => this.builder.createFieldSets(fields ?? this.builder.resolveFormFields(constructor, parent, options), parent, options), {
2068
2072
  label: "",
2069
2073
  hidden: false,
2070
2074
  useTabs: this.useTabs(),