@ngx-formly/core 7.0.0 → 7.0.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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Type, TemplateRef, ComponentRef, ChangeDetectorRef, ɵNoopNgZone as _NoopNgZone, VERSION, Input, ViewChildren, Directive, ChangeDetectionStrategy, Component, Injectable, ViewContainerRef, ViewChild, Optional, InjectionToken, Inject, EventEmitter, ContentChildren, Output, NgModule } from '@angular/core';
2
+ import { Type, TemplateRef, ComponentRef, ChangeDetectorRef, ɵNoopNgZone as _NoopNgZone, VERSION, Input, ViewChildren, Directive, ChangeDetectionStrategy, Component, Injectable, ViewContainerRef, ViewChild, Optional, InjectionToken, inject, Inject, EventEmitter, ContentChildren, Output, NgModule } from '@angular/core';
3
3
  import { isObservable, Observable, Subject, of, merge } from 'rxjs';
4
4
  import * as i2 from '@angular/forms';
5
5
  import { AbstractControl, UntypedFormArray, UntypedFormGroup, FormControl, UntypedFormControl, Validators, NgControl } from '@angular/forms';
@@ -1405,15 +1405,23 @@ class FormlyTemplate {
1405
1405
  this.name = this.name || 'formly-group';
1406
1406
  }
1407
1407
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1408
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FormlyTemplate, selector: "[formlyTemplate]", inputs: { name: ["formlyTemplate", "name"] }, usesOnChanges: true, ngImport: i0 }); }
1408
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FormlyTemplate, isStandalone: true, selector: "[formlyTemplate]", inputs: { name: ["formlyTemplate", "name"] }, usesOnChanges: true, ngImport: i0 }); }
1409
1409
  }
1410
1410
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyTemplate, decorators: [{
1411
1411
  type: Directive,
1412
- args: [{ selector: '[formlyTemplate]' }]
1412
+ args: [{ selector: '[formlyTemplate]', standalone: true }]
1413
1413
  }], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { name: [{
1414
1414
  type: Input,
1415
1415
  args: ['formlyTemplate']
1416
1416
  }] } });
1417
+ class LegacyFormlyTemplate extends FormlyTemplate {
1418
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyTemplate, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1419
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyTemplate, selector: "[formlyTemplate]", usesInheritance: true, ngImport: i0 }); }
1420
+ }
1421
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyTemplate, decorators: [{
1422
+ type: Directive,
1423
+ args: [{ selector: '[formlyTemplate]', standalone: false }]
1424
+ }] });
1417
1425
  // workarround for https://github.com/angular/angular/issues/43227#issuecomment-904173738
1418
1426
  class FormlyFieldTemplates {
1419
1427
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldTemplates, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -1759,7 +1767,21 @@ const provideFormlyCore = (configs = []) => {
1759
1767
  ];
1760
1768
  };
1761
1769
  const provideFormlyConfig = (configs = []) => {
1762
- return [{ provide: FORMLY_CONFIG, multi: true, useValue: configs }];
1770
+ return {
1771
+ provide: FORMLY_CONFIG,
1772
+ multi: true,
1773
+ useFactory: () => {
1774
+ const currentConfig = inject(FORMLY_CONFIG, {
1775
+ skipSelf: true,
1776
+ optional: true,
1777
+ });
1778
+ if (currentConfig) {
1779
+ currentConfig.push(configs);
1780
+ return currentConfig;
1781
+ }
1782
+ return configs;
1783
+ },
1784
+ };
1763
1785
  };
1764
1786
 
1765
1787
  class FormlyFormBuilder {
@@ -1991,8 +2013,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1991
2013
  args: [FormlyTemplate]
1992
2014
  }] } });
1993
2015
  class LegacyFormlyForm extends FormlyForm {
2016
+ set templates(templates) {
2017
+ this.fieldTemplates.templates = templates;
2018
+ }
1994
2019
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyForm, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1995
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyForm, selector: "formly-form", providers: [FormlyFormBuilder, FormlyFieldTemplates], usesInheritance: true, ngImport: i0, template: '<formly-field [field]="field"></formly-field>', isInline: true, dependencies: [{ kind: "component", type: LegacyFormlyField, selector: "formly-field" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2020
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyForm, selector: "formly-form", providers: [FormlyFormBuilder, FormlyFieldTemplates], queries: [{ propertyName: "templates", predicate: LegacyFormlyTemplate }], usesInheritance: true, ngImport: i0, template: '<formly-field [field]="field"></formly-field>', isInline: true, dependencies: [{ kind: "component", type: LegacyFormlyField, selector: "formly-field" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1996
2021
  }
1997
2022
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyForm, decorators: [{
1998
2023
  type: Component,
@@ -2003,7 +2028,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2003
2028
  changeDetection: ChangeDetectionStrategy.OnPush,
2004
2029
  standalone: false,
2005
2030
  }]
2006
- }] });
2031
+ }], propDecorators: { templates: [{
2032
+ type: ContentChildren,
2033
+ args: [LegacyFormlyTemplate]
2034
+ }] } });
2007
2035
 
2008
2036
  /**
2009
2037
  * Allow to link the `field` HTML attributes (`id`, `name` ...) and Event attributes (`focus`, `blur` ...) to an element in the DOM.
@@ -2379,7 +2407,7 @@ class FormlyModule {
2379
2407
  ngModule: FormlyModule,
2380
2408
  providers: [
2381
2409
  { provide: FORMLY_CONFIG, multi: true, useFactory: withDefaultConfig, deps: [FormlyConfig] },
2382
- { provide: FORMLY_CONFIG, useValue: config, multi: true },
2410
+ provideFormlyConfig(config),
2383
2411
  FormlyConfig,
2384
2412
  FormlyFormBuilder,
2385
2413
  ],
@@ -2390,19 +2418,19 @@ class FormlyModule {
2390
2418
  ngModule: FormlyModule,
2391
2419
  providers: [
2392
2420
  { provide: FORMLY_CONFIG, multi: true, useFactory: withDefaultConfig, deps: [FormlyConfig] },
2393
- { provide: FORMLY_CONFIG, useValue: config, multi: true },
2421
+ provideFormlyConfig(config),
2394
2422
  FormlyFormBuilder,
2395
2423
  ],
2396
2424
  };
2397
2425
  }
2398
2426
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2399
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, declarations: [FormlyTemplate,
2427
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, declarations: [LegacyFormlyTemplate,
2400
2428
  LegacyFormlyForm,
2401
2429
  LegacyFormlyField,
2402
2430
  LegacyFormlyAttributes,
2403
2431
  LegacyFormlyValidationMessage,
2404
2432
  FormlyGroup,
2405
- FormlyTemplateType], imports: [CommonModule], exports: [FormlyTemplate,
2433
+ FormlyTemplateType], imports: [CommonModule], exports: [LegacyFormlyTemplate,
2406
2434
  LegacyFormlyForm,
2407
2435
  LegacyFormlyField,
2408
2436
  LegacyFormlyAttributes,
@@ -2414,7 +2442,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2414
2442
  type: NgModule,
2415
2443
  args: [{
2416
2444
  declarations: [
2417
- FormlyTemplate,
2445
+ LegacyFormlyTemplate,
2418
2446
  LegacyFormlyForm,
2419
2447
  LegacyFormlyField,
2420
2448
  LegacyFormlyAttributes,
@@ -2423,7 +2451,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2423
2451
  FormlyTemplateType,
2424
2452
  ],
2425
2453
  exports: [
2426
- FormlyTemplate,
2454
+ LegacyFormlyTemplate,
2427
2455
  LegacyFormlyForm,
2428
2456
  LegacyFormlyField,
2429
2457
  LegacyFormlyAttributes,
@@ -2442,5 +2470,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2442
2470
  * Generated bundle index. Do not edit.
2443
2471
  */
2444
2472
 
2445
- export { FORMLY_CONFIG, FieldArrayType, FieldType, FieldWrapper, FormlyAttributes, FormlyConfig, FormlyField, FormlyForm, FormlyFormBuilder, FormlyModule, FormlyValidationMessage, LegacyFormlyAttributes, LegacyFormlyField, LegacyFormlyForm, LegacyFormlyValidationMessage, provideFormlyConfig, provideFormlyCore, FormlyGroup as ɵFormlyGroup, FormlyTemplate as ɵFormlyTemplate, clone as ɵclone, defineHiddenProp as ɵdefineHiddenProp, getFieldValue as ɵgetFieldValue, hasKey as ɵhasKey, observe as ɵobserve, reverseDeepMerge as ɵreverseDeepMerge };
2473
+ export { FORMLY_CONFIG, FieldArrayType, FieldType, FieldWrapper, FormlyAttributes, FormlyConfig, FormlyField, FormlyForm, FormlyFormBuilder, FormlyModule, FormlyTemplate, FormlyValidationMessage, LegacyFormlyAttributes, LegacyFormlyField, LegacyFormlyForm, LegacyFormlyValidationMessage, provideFormlyConfig, provideFormlyCore, FormlyGroup as ɵFormlyGroup, LegacyFormlyTemplate as ɵFormlyTemplate, clone as ɵclone, defineHiddenProp as ɵdefineHiddenProp, getFieldValue as ɵgetFieldValue, hasKey as ɵhasKey, observe as ɵobserve, reverseDeepMerge as ɵreverseDeepMerge };
2446
2474
  //# sourceMappingURL=ngx-formly-core.mjs.map