@angular/forms 21.0.8 → 21.0.9

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
  /**
2
- * @license Angular v21.0.8
2
+ * @license Angular v21.0.9
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -42,52 +42,6 @@ declare class InteropNgControl implements Pick<NgControl, InteropSharedKeys | 'c
42
42
  updateValueAndValidity(): void;
43
43
  }
44
44
 
45
- /**
46
- * Lightweight DI token provided by the {@link Field} directive.
47
- *
48
- * @category control
49
- * @experimental 21.0.0
50
- */
51
- declare const FIELD: InjectionToken<Field<unknown>>;
52
- /**
53
- * Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:
54
- * 1. A native HTML input or textarea
55
- * 2. A signal forms custom control that implements `FormValueControl` or `FormCheckboxControl`
56
- * 3. A component that provides a `ControlValueAccessor`. This should only be used for backwards
57
- * compatibility with reactive forms. Prefer options (1) and (2).
58
- *
59
- * This directive has several responsibilities:
60
- * 1. Two-way binds the field's value with the UI control's value
61
- * 2. Binds additional forms related state on the field to the UI control (disabled, required, etc.)
62
- * 3. Relays relevant events on the control to the field (e.g. marks field touched on blur)
63
- * 4. Provides a fake `NgControl` that implements a subset of the features available on the
64
- * reactive forms `NgControl`. This is provided to improve interoperability with controls
65
- * designed to work with reactive forms. It should not be used by controls written for signal
66
- * forms.
67
- *
68
- * @category control
69
- * @experimental 21.0.0
70
- */
71
- declare class Field<T> {
72
- readonly element: HTMLElement;
73
- readonly injector: Injector;
74
- readonly field: i0.InputSignal<FieldTree<T>>;
75
- readonly state: i0.Signal<[T] extends [_angular_forms.AbstractControl<any, any, any>] ? CompatFieldState<T, string | number> : FieldState<T, string | number>>;
76
- readonly [_CONTROL]: {
77
- readonly create: typeof __controlCreate;
78
- readonly update: typeof _controlUpdate;
79
- };
80
- private config;
81
- /** Any `ControlValueAccessor` instances provided on the host element. */
82
- private readonly controlValueAccessors;
83
- /** A lazily instantiated fake `NgControl`. */
84
- private interopNgControl;
85
- /** Lazily instantiates a fake `NgControl` for this field. */
86
- protected getOrCreateNgControl(): InteropNgControl;
87
- static ɵfac: i0.ɵɵFactoryDeclaration<Field<any>, never>;
88
- static ɵdir: i0.ɵɵDirectiveDeclaration<Field<any>, "[field]", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
89
- }
90
-
91
45
  /**
92
46
  * Lightweight DI token provided by the {@link FormField} directive.
93
47
  *
@@ -526,9 +480,9 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
526
480
  */
527
481
  readonly keyInParent: Signal<TKey>;
528
482
  /**
529
- * The {@link Field} directives that bind this field to a UI control.
483
+ * The {@link FormField} directives that bind this field to a UI control.
530
484
  */
531
- readonly formFieldBindings: Signal<readonly (Field<unknown> | FormField<unknown>)[]>;
485
+ readonly formFieldBindings: Signal<readonly FormField<unknown>[]>;
532
486
  /**
533
487
  * Reads a metadata value from the field.
534
488
  * @param key The metadata key to read.
@@ -1171,7 +1125,7 @@ type NgValidationError = RequiredValidationError | MinValidationError | MaxValid
1171
1125
  interface SignalFormsConfig {
1172
1126
  /** A map of CSS class names to predicate functions that determine when to apply them. */
1173
1127
  classes?: {
1174
- [className: string]: (state: Field<unknown> | FormField<unknown>) => boolean;
1128
+ [className: string]: (state: FormField<unknown>) => boolean;
1175
1129
  };
1176
1130
  }
1177
1131
  /**
@@ -1572,7 +1526,7 @@ declare class FieldNodeState {
1572
1526
  */
1573
1527
  markAsUntouched(): void;
1574
1528
  /** The {@link FormField} directives that bind this field to a UI control. */
1575
- readonly formFieldBindings: i0.WritableSignal<readonly (Field<unknown> | FormField<unknown>)[]>;
1529
+ readonly formFieldBindings: i0.WritableSignal<readonly FormField<unknown>[]>;
1576
1530
  constructor(node: FieldNode);
1577
1531
  /**
1578
1532
  * Whether this field is considered dirty.
@@ -1797,7 +1751,7 @@ declare class FieldNode implements FieldState<unknown> {
1797
1751
  get disabledReasons(): Signal<readonly DisabledReason[]>;
1798
1752
  get hidden(): Signal<boolean>;
1799
1753
  get readonly(): Signal<boolean>;
1800
- get formFieldBindings(): Signal<readonly (Field<unknown> | FormField<unknown>)[]>;
1754
+ get formFieldBindings(): Signal<readonly FormField<unknown>[]>;
1801
1755
  get submitting(): Signal<boolean>;
1802
1756
  get name(): Signal<string>;
1803
1757
  get max(): Signal<number | undefined> | undefined;
@@ -2357,7 +2311,7 @@ declare function applyWhenValue<TValue>(path: SchemaPath<TValue>, predicate: (va
2357
2311
  /**
2358
2312
  * Submits a given `FieldTree` using the given action function and applies any submission errors
2359
2313
  * resulting from the action to the field. Submission errors returned by the `action` will be integrated
2360
- * into the field as a `ValidationError` on the sub-field indicated by the `field` property of the
2314
+ * into the field as a `ValidationError` on the sub-field indicated by the `fieldTree` property of the
2361
2315
  * submission error.
2362
2316
  *
2363
2317
  * @example
@@ -2366,8 +2320,9 @@ declare function applyWhenValue<TValue>(path: SchemaPath<TValue>, predicate: (va
2366
2320
  * const result = await myClient.registerNewUser(registrationForm().value());
2367
2321
  * if (result.errorCode === myClient.ErrorCode.USERNAME_TAKEN) {
2368
2322
  * return [{
2369
- * field: registrationForm.username,
2370
- * error: {kind: 'server', message: 'Username already taken'}
2323
+ * fieldTree: registrationForm.username,
2324
+ * kind: 'server',
2325
+ * message: 'Username already taken'
2371
2326
  * }];
2372
2327
  * }
2373
2328
  * return undefined;
@@ -2400,5 +2355,5 @@ declare function submit<TModel>(form: FieldTree<TModel>, action: (form: FieldTre
2400
2355
  */
2401
2356
  declare function schema<TValue>(fn: SchemaFn<TValue>): Schema<TValue>;
2402
2357
 
2403
- export { EmailValidationError, FIELD, FORM_FIELD, Field, FormField, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MetadataKey, MetadataReducer, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PathKind, PatternValidationError, REQUIRED, RequiredValidationError, SchemaPathRules, StandardSchemaValidationError, ValidationError, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit };
2358
+ export { EmailValidationError, FORM_FIELD, FormField, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MetadataKey, MetadataReducer, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PathKind, PatternValidationError, REQUIRED, RequiredValidationError, SchemaPathRules, StandardSchemaValidationError, ValidationError, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit };
2404
2359
  export type { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, Debouncer, DisabledReason, FieldContext, FieldState, FieldTree, FieldValidator, FormOptions, ItemFieldContext, ItemType, LogicFn, MaybeFieldTree, MaybeSchemaPathTree, MetadataSetterType, OneOrMany, ReadonlyArrayLike, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPath, SchemaPathTree, SignalFormsConfig, Subfields, SubmittedStatus, TreeValidationResult, TreeValidator, ValidationResult, ValidationSuccess, Validator, WithField, WithOptionalField, WithoutField };
package/types/forms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.8
2
+ * @license Angular v21.0.9
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.8
2
+ * @license Angular v21.0.9
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Angular v21.0.8
2
+ * @license Angular v21.0.9
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { Signal, ResourceRef, InputSignal, InputSignalWithTransform, ModelSignal, OutputRef } from '@angular/core';
8
8
  import { PathKind, SchemaPath, SchemaPathRules, LogicFn, OneOrMany, ValidationError, SchemaPathTree, FieldValidator, FieldContext, TreeValidationResult, TreeValidator, WithOptionalField, DisabledReason, Debouncer } from './_structure-chunk.js';
9
- export { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, EmailValidationError, FIELD, FORM_FIELD, Field, FieldState, FieldTree, FormField, FormOptions, ItemFieldContext, ItemType, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SignalFormsConfig, StandardSchemaValidationError, Subfields, SubmittedStatus, ValidationResult, ValidationSuccess, Validator, WithField, WithoutField, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit } from './_structure-chunk.js';
9
+ export { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, EmailValidationError, FORM_FIELD, FieldState, FieldTree, FormField, FormOptions, ItemFieldContext, ItemType, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SignalFormsConfig, StandardSchemaValidationError, Subfields, SubmittedStatus, ValidationResult, ValidationSuccess, Validator, WithField, WithoutField, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit } from './_structure-chunk.js';
10
10
  import { StandardSchemaV1 } from '@standard-schema/spec';
11
11
  import { HttpResourceRequest, HttpResourceOptions } from '@angular/common/http';
12
12
  import '@angular/forms';