@ngx-formly/core 7.0.0-next.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,11 +1,11 @@
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';
6
6
  import { tap, map, distinctUntilChanged, startWith, debounceTime, filter, switchMap, take } from 'rxjs/operators';
7
7
  import * as i1 from '@angular/platform-browser';
8
- import * as i1$1 from '@angular/common';
8
+ import * as i2$1 from '@angular/common';
9
9
  import { DOCUMENT, AsyncPipe, CommonModule } from '@angular/common';
10
10
 
11
11
  function disableTreeValidityCall(form, callback) {
@@ -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 }); }
@@ -1710,17 +1718,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1710
1718
  /** @ignore */
1711
1719
  class FormlyGroup extends FieldType {
1712
1720
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyGroup, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1713
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyGroup, selector: "formly-group", host: { properties: { "class": "field.fieldGroupClassName || \"\"" } }, usesInheritance: true, ngImport: i0, template: `
1714
- <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
1721
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: FormlyGroup, selector: "formly-group", host: { properties: { "class": "field.fieldGroupClassName || \"\"" } }, usesInheritance: true, ngImport: i0, template: `
1722
+ @for (f of field.fieldGroup; track $index) {
1723
+ <formly-field [field]="f"></formly-field>
1724
+ }
1715
1725
  <ng-content></ng-content>
1716
- `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: LegacyFormlyField, selector: "formly-field" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1726
+ `, isInline: true, dependencies: [{ kind: "component", type: LegacyFormlyField, selector: "formly-field" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1717
1727
  }
1718
1728
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyGroup, decorators: [{
1719
1729
  type: Component,
1720
1730
  args: [{
1721
1731
  selector: 'formly-group',
1722
1732
  template: `
1723
- <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
1733
+ @for (f of field.fieldGroup; track $index) {
1734
+ <formly-field [field]="f"></formly-field>
1735
+ }
1724
1736
  <ng-content></ng-content>
1725
1737
  `,
1726
1738
  host: {
@@ -1755,7 +1767,21 @@ const provideFormlyCore = (configs = []) => {
1755
1767
  ];
1756
1768
  };
1757
1769
  const provideFormlyConfig = (configs = []) => {
1758
- 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
+ };
1759
1785
  };
1760
1786
 
1761
1787
  class FormlyFormBuilder {
@@ -1987,8 +2013,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1987
2013
  args: [FormlyTemplate]
1988
2014
  }] } });
1989
2015
  class LegacyFormlyForm extends FormlyForm {
2016
+ set templates(templates) {
2017
+ this.fieldTemplates.templates = templates;
2018
+ }
1990
2019
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyForm, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1991
- 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 }); }
1992
2021
  }
1993
2022
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyForm, decorators: [{
1994
2023
  type: Component,
@@ -1999,7 +2028,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1999
2028
  changeDetection: ChangeDetectionStrategy.OnPush,
2000
2029
  standalone: false,
2001
2030
  }]
2002
- }] });
2031
+ }], propDecorators: { templates: [{
2032
+ type: ContentChildren,
2033
+ args: [LegacyFormlyTemplate]
2034
+ }] } });
2003
2035
 
2004
2036
  /**
2005
2037
  * Allow to link the `field` HTML attributes (`id`, `name` ...) and Event attributes (`focus`, `blur` ...) to an element in the DOM.
@@ -2262,7 +2294,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2262
2294
  }] } });
2263
2295
  class LegacyFormlyValidationMessage extends FormlyValidationMessage {
2264
2296
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyValidationMessage, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2265
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyValidationMessage, selector: "formly-validation-message", usesInheritance: true, ngImport: i0, template: '{{ errorMessage$ | async }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2297
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LegacyFormlyValidationMessage, selector: "formly-validation-message", usesInheritance: true, ngImport: i0, template: '{{ errorMessage$ | async }}', isInline: true, dependencies: [{ kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2266
2298
  }
2267
2299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LegacyFormlyValidationMessage, decorators: [{
2268
2300
  type: Component,
@@ -2375,7 +2407,7 @@ class FormlyModule {
2375
2407
  ngModule: FormlyModule,
2376
2408
  providers: [
2377
2409
  { provide: FORMLY_CONFIG, multi: true, useFactory: withDefaultConfig, deps: [FormlyConfig] },
2378
- { provide: FORMLY_CONFIG, useValue: config, multi: true },
2410
+ provideFormlyConfig(config),
2379
2411
  FormlyConfig,
2380
2412
  FormlyFormBuilder,
2381
2413
  ],
@@ -2386,19 +2418,19 @@ class FormlyModule {
2386
2418
  ngModule: FormlyModule,
2387
2419
  providers: [
2388
2420
  { provide: FORMLY_CONFIG, multi: true, useFactory: withDefaultConfig, deps: [FormlyConfig] },
2389
- { provide: FORMLY_CONFIG, useValue: config, multi: true },
2421
+ provideFormlyConfig(config),
2390
2422
  FormlyFormBuilder,
2391
2423
  ],
2392
2424
  };
2393
2425
  }
2394
2426
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2395
- 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,
2396
2428
  LegacyFormlyForm,
2397
2429
  LegacyFormlyField,
2398
2430
  LegacyFormlyAttributes,
2399
2431
  LegacyFormlyValidationMessage,
2400
2432
  FormlyGroup,
2401
- FormlyTemplateType], imports: [CommonModule], exports: [FormlyTemplate,
2433
+ FormlyTemplateType], imports: [CommonModule], exports: [LegacyFormlyTemplate,
2402
2434
  LegacyFormlyForm,
2403
2435
  LegacyFormlyField,
2404
2436
  LegacyFormlyAttributes,
@@ -2410,7 +2442,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2410
2442
  type: NgModule,
2411
2443
  args: [{
2412
2444
  declarations: [
2413
- FormlyTemplate,
2445
+ LegacyFormlyTemplate,
2414
2446
  LegacyFormlyForm,
2415
2447
  LegacyFormlyField,
2416
2448
  LegacyFormlyAttributes,
@@ -2419,7 +2451,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2419
2451
  FormlyTemplateType,
2420
2452
  ],
2421
2453
  exports: [
2422
- FormlyTemplate,
2454
+ LegacyFormlyTemplate,
2423
2455
  LegacyFormlyForm,
2424
2456
  LegacyFormlyField,
2425
2457
  LegacyFormlyAttributes,
@@ -2438,5 +2470,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
2438
2470
  * Generated bundle index. Do not edit.
2439
2471
  */
2440
2472
 
2441
- 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 };
2442
2474
  //# sourceMappingURL=ngx-formly-core.mjs.map