@angular/forms 21.1.3 → 21.2.0-next.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,132 +1,15 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵFormFieldBindingOptions as _FormFieldBindingOptions, InjectionToken, Injector, ɵCONTROL as _CONTROL, ɵɵcontrolCreate as __controlCreate, ɵcontrolUpdate as _controlUpdate, Signal, ɵFieldState as _FieldState, Provider, WritableSignal, DestroyableInjector } from '@angular/core';
8
+ import { Signal, ɵFieldState as _FieldState, ɵFormFieldBindingOptions as _FormFieldBindingOptions, InjectionToken, Injector, ɵCONTROL as _CONTROL, ɵɵcontrolCreate as __controlCreate, ɵcontrolUpdate as _controlUpdate, Provider, WritableSignal, DestroyableInjector } from '@angular/core';
9
9
  import * as _angular_forms from '@angular/forms';
10
- import { AbstractControl, ValidationErrors, FormControlStatus, ControlValueAccessor, ValidatorFn } from '@angular/forms';
10
+ import { AbstractControl, NgControl, ValidationErrors, FormControlStatus, ControlValueAccessor, ValidatorFn } from '@angular/forms';
11
11
  import { StandardSchemaV1 } from '@standard-schema/spec';
12
12
 
13
- /**
14
- * Represents a combination of `NgControl` and `AbstractControl`.
15
- *
16
- * Note: We have this separate interface, rather than implementing the relevant parts of the two
17
- * controls with something like `InteropNgControl implements Pick<NgControl, ...>, Pick<AbstractControl, ...>`
18
- * because it confuses the internal JS minifier which can cause collisions in field names.
19
- */
20
- interface CombinedControl {
21
- value: any;
22
- valid: boolean;
23
- invalid: boolean;
24
- touched: boolean;
25
- untouched: boolean;
26
- disabled: boolean;
27
- enabled: boolean;
28
- errors: ValidationErrors | null;
29
- pristine: boolean;
30
- dirty: boolean;
31
- status: FormControlStatus;
32
- control: AbstractControl<any, any>;
33
- valueAccessor: ControlValueAccessor | null;
34
- hasValidator(validator: ValidatorFn): boolean;
35
- updateValueAndValidity(): void;
36
- }
37
- /**
38
- * A fake version of `NgControl` provided by the `Field` directive. This allows interoperability
39
- * with a wider range of components designed to work with reactive forms, in particular ones that
40
- * inject the `NgControl`. The interop control does not implement *all* properties and methods of
41
- * the real `NgControl`, but does implement some of the most commonly used ones that have a clear
42
- * equivalent in signal forms.
43
- */
44
- declare class InteropNgControl implements CombinedControl {
45
- protected field: () => FieldState<unknown>;
46
- constructor(field: () => FieldState<unknown>);
47
- readonly control: AbstractControl<any, any>;
48
- get value(): any;
49
- get valid(): boolean;
50
- get invalid(): boolean;
51
- get pending(): boolean | null;
52
- get disabled(): boolean;
53
- get enabled(): boolean;
54
- get errors(): ValidationErrors | null;
55
- get pristine(): boolean;
56
- get dirty(): boolean;
57
- get touched(): boolean;
58
- get untouched(): boolean;
59
- get status(): FormControlStatus;
60
- valueAccessor: ControlValueAccessor | null;
61
- hasValidator(validator: ValidatorFn): boolean;
62
- updateValueAndValidity(): void;
63
- }
64
-
65
- interface FormFieldBindingOptions extends _FormFieldBindingOptions {
66
- /**
67
- * Focuses the binding.
68
- *
69
- * If not specified, Signal Forms will attempt to focus the host element of the `FormField` when
70
- * asked to focus this binding.
71
- */
72
- focus?: VoidFunction;
73
- }
74
- /**
75
- * Lightweight DI token provided by the {@link FormField} directive.
76
- *
77
- * @category control
78
- * @experimental 21.0.0
79
- */
80
- declare const FORM_FIELD: InjectionToken<FormField<unknown>>;
81
- /**
82
- * Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:
83
- * 1. A native HTML input or textarea
84
- * 2. A signal forms custom control that implements `FormValueControl` or `FormCheckboxControl`
85
- * 3. A component that provides a `ControlValueAccessor`. This should only be used for backwards
86
- * compatibility with reactive forms. Prefer options (1) and (2).
87
- *
88
- * This directive has several responsibilities:
89
- * 1. Two-way binds the field state's value with the UI control's value
90
- * 2. Binds additional forms related state on the field state to the UI control (disabled, required, etc.)
91
- * 3. Relays relevant events on the control to the field state (e.g. marks touched on blur)
92
- * 4. Provides a fake `NgControl` that implements a subset of the features available on the
93
- * reactive forms `NgControl`. This is provided to improve interoperability with controls
94
- * designed to work with reactive forms. It should not be used by controls written for signal
95
- * forms.
96
- *
97
- * @category control
98
- * @experimental 21.0.0
99
- */
100
- declare class FormField<T> {
101
- readonly element: HTMLElement;
102
- readonly injector: Injector;
103
- readonly formField: i0.InputSignal<FieldTree<T>>;
104
- readonly state: i0.Signal<[T] extends [_angular_forms.AbstractControl<any, any, any>] ? CompatFieldState<T, string | number> : FieldState<T, string | number>>;
105
- private readonly bindingOptions;
106
- readonly [_CONTROL]: {
107
- readonly create: typeof __controlCreate;
108
- readonly update: typeof _controlUpdate;
109
- };
110
- private config;
111
- /** Any `ControlValueAccessor` instances provided on the host element. */
112
- private readonly controlValueAccessors;
113
- /** A lazily instantiated fake `NgControl`. */
114
- private interopNgControl;
115
- /** Lazily instantiates a fake `NgControl` for this form field. */
116
- protected getOrCreateNgControl(): InteropNgControl;
117
- /**
118
- * Registers this `FormField` as a binding on its associated `FieldState`.
119
- *
120
- * This method should be called at most once for a given `FormField`. A `FormField` placed on a
121
- * custom control (`FormUiControl`) automatically registers that custom control as a binding.
122
- */
123
- registerAsBinding(bindingOptions?: FormFieldBindingOptions): void;
124
- /** Focuses this UI control. */
125
- focus(): void;
126
- static ɵfac: i0.ɵɵFactoryDeclaration<FormField<any>, never>;
127
- static ɵdir: i0.ɵɵDirectiveDeclaration<FormField<any>, "[formField]", never, { "formField": { "alias": "formField"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
128
- }
129
-
130
13
  /**
131
14
  * Sets a value for the {@link MetadataKey} for this field.
132
15
  *
@@ -368,7 +251,7 @@ type ValidationSuccess = null | undefined | void;
368
251
  * @category types
369
252
  * @experimental 21.0.0
370
253
  */
371
- type TreeValidationResult<E extends ValidationError.WithOptionalField = ValidationError.WithOptionalField> = ValidationSuccess | OneOrMany<E>;
254
+ type TreeValidationResult<E extends ValidationError.WithOptionalFieldTree = ValidationError.WithOptionalFieldTree> = ValidationSuccess | OneOrMany<E>;
372
255
  /**
373
256
  * A validation result where all errors explicitly define their target field.
374
257
  *
@@ -469,11 +352,11 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
469
352
  */
470
353
  readonly hidden: Signal<boolean>;
471
354
  readonly disabledReasons: Signal<readonly DisabledReason[]>;
472
- readonly errors: Signal<ValidationError.WithField[]>;
355
+ readonly errors: Signal<ValidationError.WithFieldTree[]>;
473
356
  /**
474
357
  * A signal containing the {@link errors} of the field and its descendants.
475
358
  */
476
- readonly errorSummary: Signal<ValidationError.WithField[]>;
359
+ readonly errorSummary: Signal<ValidationError.WithFieldTree[]>;
477
360
  /**
478
361
  * A signal indicating whether the field's value is currently valid.
479
362
  *
@@ -531,8 +414,9 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
531
414
  /**
532
415
  * Focuses the first UI control in the DOM that is bound to this field state.
533
416
  * If no UI control is bound, does nothing.
417
+ * @param options Optional focus options to pass to the native focus() method.
534
418
  */
535
- focusBoundControl(): void;
419
+ focusBoundControl(options?: FocusOptions): void;
536
420
  }
537
421
  /**
538
422
  * This is FieldState also providing access to the wrapped FormControl.
@@ -710,7 +594,7 @@ type LogicFn<TValue, TReturn, TPathKind extends PathKind = PathKind.Root> = (ctx
710
594
  * @category validation
711
595
  * @experimental 21.0.0
712
596
  */
713
- type FieldValidator<TValue, TPathKind extends PathKind = PathKind.Root> = LogicFn<TValue, ValidationResult<ValidationError.WithoutField>, TPathKind>;
597
+ type FieldValidator<TValue, TPathKind extends PathKind = PathKind.Root> = LogicFn<TValue, ValidationResult<ValidationError.WithoutFieldTree>, TPathKind>;
714
598
  /**
715
599
  * A function that takes the `FieldContext` for the field being validated and returns a
716
600
  * `TreeValidationResult` indicating errors for the field and its sub-fields.
@@ -802,6 +686,106 @@ type ItemType<T extends Object> = T extends ReadonlyArray<any> ? T[number] : T[k
802
686
  */
803
687
  type Debouncer<TValue, TPathKind extends PathKind = PathKind.Root> = (context: FieldContext<TValue, TPathKind>, abortSignal: AbortSignal) => Promise<void> | void;
804
688
 
689
+ /**
690
+ * Properties of both NgControl & AbstractControl that are supported by the InteropNgControl.
691
+ */
692
+ type InteropSharedKeys = 'value' | 'valid' | 'invalid' | 'touched' | 'untouched' | 'disabled' | 'enabled' | 'errors' | 'pristine' | 'dirty' | 'status';
693
+ /**
694
+ * A fake version of `NgControl` provided by the `Field` directive. This allows interoperability
695
+ * with a wider range of components designed to work with reactive forms, in particular ones that
696
+ * inject the `NgControl`. The interop control does not implement *all* properties and methods of
697
+ * the real `NgControl`, but does implement some of the most commonly used ones that have a clear
698
+ * equivalent in signal forms.
699
+ */
700
+ declare class InteropNgControl implements Pick<NgControl, InteropSharedKeys | 'control' | 'valueAccessor'>, Pick<AbstractControl<unknown>, InteropSharedKeys | 'hasValidator'> {
701
+ protected field: () => FieldState<unknown>;
702
+ constructor(field: () => FieldState<unknown>);
703
+ readonly control: AbstractControl<any, any>;
704
+ get value(): any;
705
+ get valid(): boolean;
706
+ get invalid(): boolean;
707
+ get pending(): boolean | null;
708
+ get disabled(): boolean;
709
+ get enabled(): boolean;
710
+ get errors(): ValidationErrors | null;
711
+ get pristine(): boolean;
712
+ get dirty(): boolean;
713
+ get touched(): boolean;
714
+ get untouched(): boolean;
715
+ get status(): FormControlStatus;
716
+ valueAccessor: ControlValueAccessor | null;
717
+ hasValidator(validator: ValidatorFn): boolean;
718
+ updateValueAndValidity(): void;
719
+ }
720
+
721
+ interface FormFieldBindingOptions<TValue> extends _FormFieldBindingOptions {
722
+ /**
723
+ * Focuses the binding.
724
+ *
725
+ * If not specified, Signal Forms will attempt to focus the host element of the `FormField` when
726
+ * asked to focus this binding.
727
+ */
728
+ focus?(options?: FocusOptions): void;
729
+ readonly parseErrors?: Signal<ValidationError.WithoutFieldTree[]>;
730
+ }
731
+ /**
732
+ * Lightweight DI token provided by the {@link FormField} directive.
733
+ *
734
+ * @category control
735
+ * @experimental 21.0.0
736
+ */
737
+ declare const FORM_FIELD: InjectionToken<FormField<unknown>>;
738
+ /**
739
+ * Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:
740
+ * 1. A native HTML input or textarea
741
+ * 2. A signal forms custom control that implements `FormValueControl` or `FormCheckboxControl`
742
+ * 3. A component that provides a `ControlValueAccessor`. This should only be used for backwards
743
+ * compatibility with reactive forms. Prefer options (1) and (2).
744
+ *
745
+ * This directive has several responsibilities:
746
+ * 1. Two-way binds the field state's value with the UI control's value
747
+ * 2. Binds additional forms related state on the field state to the UI control (disabled, required, etc.)
748
+ * 3. Relays relevant events on the control to the field state (e.g. marks touched on blur)
749
+ * 4. Provides a fake `NgControl` that implements a subset of the features available on the
750
+ * reactive forms `NgControl`. This is provided to improve interoperability with controls
751
+ * designed to work with reactive forms. It should not be used by controls written for signal
752
+ * forms.
753
+ *
754
+ * @category control
755
+ * @experimental 21.0.0
756
+ */
757
+ declare class FormField<T> {
758
+ readonly element: HTMLElement;
759
+ readonly injector: Injector;
760
+ readonly fieldTree: i0.InputSignal<FieldTree<T>>;
761
+ readonly state: Signal<[T] extends [_angular_forms.AbstractControl<any, any, any>] ? CompatFieldState<T, string | number> : FieldState<T, string | number>>;
762
+ private readonly bindingOptions;
763
+ /** Errors associated with this form field. */
764
+ readonly errors: Signal<ValidationError.WithFieldTree[]>;
765
+ readonly [_CONTROL]: {
766
+ readonly create: typeof __controlCreate;
767
+ readonly update: typeof _controlUpdate;
768
+ };
769
+ private config;
770
+ /** Any `ControlValueAccessor` instances provided on the host element. */
771
+ private readonly controlValueAccessors;
772
+ /** A lazily instantiated fake `NgControl`. */
773
+ private interopNgControl;
774
+ /** Lazily instantiates a fake `NgControl` for this form field. */
775
+ protected getOrCreateNgControl(): InteropNgControl;
776
+ /**
777
+ * Registers this `FormField` as a binding on its associated `FieldState`.
778
+ *
779
+ * This method should be called at most once for a given `FormField`. A `FormField` placed on a
780
+ * custom control (`FormUiControl`) automatically registers that custom control as a binding.
781
+ */
782
+ registerAsBinding(bindingOptions?: FormFieldBindingOptions<T>): void;
783
+ /** Focuses this UI control. */
784
+ focus(options?: FocusOptions): void;
785
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormField<any>, never>;
786
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormField<any>, "[formField]", ["formField"], { "fieldTree": { "alias": "formField"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
787
+ }
788
+
805
789
  /**
806
790
  * Options used to create a `ValidationError`.
807
791
  */
@@ -815,34 +799,40 @@ interface ValidationErrorOptions {
815
799
  *
816
800
  * @experimental 21.0.0
817
801
  */
818
- type WithField<T> = T & {
802
+ type WithFieldTree<T> = T & {
819
803
  fieldTree: FieldTree<unknown>;
820
804
  };
805
+ /** @deprecated Use `WithFieldTree` instead */
806
+ type WithField<T> = WithFieldTree<T>;
821
807
  /**
822
808
  * A type that allows the given type `T` to optionally have a `field` property.
823
809
  * @template T The type to optionally add a `field` to.
824
810
  *
825
811
  * @experimental 21.0.0
826
812
  */
827
- type WithOptionalField<T> = Omit<T, 'fieldTree'> & {
813
+ type WithOptionalFieldTree<T> = Omit<T, 'fieldTree'> & {
828
814
  fieldTree?: FieldTree<unknown>;
829
815
  };
816
+ /** @deprecated Use `WithOptionalFieldTree` instead */
817
+ type WithOptionalField<T> = WithOptionalFieldTree<T>;
830
818
  /**
831
819
  * A type that ensures the given type `T` does not have a `field` property.
832
820
  * @template T The type to remove the `field` from.
833
821
  *
834
822
  * @experimental 21.0.0
835
823
  */
836
- type WithoutField<T> = T & {
824
+ type WithoutFieldTree<T> = T & {
837
825
  fieldTree: never;
838
826
  };
827
+ /** @deprecated Use `WithoutFieldTree` instead */
828
+ type WithoutField<T> = WithoutFieldTree<T>;
839
829
  /**
840
830
  * Create a required error associated with the target field
841
831
  * @param options The validation error options
842
832
  *
843
833
  * @experimental 21.0.0
844
834
  */
845
- declare function requiredError(options: WithField<ValidationErrorOptions>): RequiredValidationError;
835
+ declare function requiredError(options: WithFieldTree<ValidationErrorOptions>): RequiredValidationError;
846
836
  /**
847
837
  * Create a required error
848
838
  * @param options The optional validation error options
@@ -850,7 +840,7 @@ declare function requiredError(options: WithField<ValidationErrorOptions>): Requ
850
840
  * @category validation
851
841
  * @experimental 21.0.0
852
842
  */
853
- declare function requiredError(options?: ValidationErrorOptions): WithoutField<RequiredValidationError>;
843
+ declare function requiredError(options?: ValidationErrorOptions): WithoutFieldTree<RequiredValidationError>;
854
844
  /**
855
845
  * Create a min value error associated with the target field
856
846
  * @param min The min value constraint
@@ -859,7 +849,7 @@ declare function requiredError(options?: ValidationErrorOptions): WithoutField<R
859
849
  * @category validation
860
850
  * @experimental 21.0.0
861
851
  */
862
- declare function minError(min: number, options: WithField<ValidationErrorOptions>): MinValidationError;
852
+ declare function minError(min: number, options: WithFieldTree<ValidationErrorOptions>): MinValidationError;
863
853
  /**
864
854
  * Create a min value error
865
855
  * @param min The min value constraint
@@ -868,7 +858,7 @@ declare function minError(min: number, options: WithField<ValidationErrorOptions
868
858
  * @category validation
869
859
  * @experimental 21.0.0
870
860
  */
871
- declare function minError(min: number, options?: ValidationErrorOptions): WithoutField<MinValidationError>;
861
+ declare function minError(min: number, options?: ValidationErrorOptions): WithoutFieldTree<MinValidationError>;
872
862
  /**
873
863
  * Create a max value error associated with the target field
874
864
  * @param max The max value constraint
@@ -877,7 +867,7 @@ declare function minError(min: number, options?: ValidationErrorOptions): Withou
877
867
  * @category validation
878
868
  * @experimental 21.0.0
879
869
  */
880
- declare function maxError(max: number, options: WithField<ValidationErrorOptions>): MaxValidationError;
870
+ declare function maxError(max: number, options: WithFieldTree<ValidationErrorOptions>): MaxValidationError;
881
871
  /**
882
872
  * Create a max value error
883
873
  * @param max The max value constraint
@@ -886,7 +876,7 @@ declare function maxError(max: number, options: WithField<ValidationErrorOptions
886
876
  * @category validation
887
877
  * @experimental 21.0.0
888
878
  */
889
- declare function maxError(max: number, options?: ValidationErrorOptions): WithoutField<MaxValidationError>;
879
+ declare function maxError(max: number, options?: ValidationErrorOptions): WithoutFieldTree<MaxValidationError>;
890
880
  /**
891
881
  * Create a minLength error associated with the target field
892
882
  * @param minLength The minLength constraint
@@ -895,7 +885,7 @@ declare function maxError(max: number, options?: ValidationErrorOptions): Withou
895
885
  * @category validation
896
886
  * @experimental 21.0.0
897
887
  */
898
- declare function minLengthError(minLength: number, options: WithField<ValidationErrorOptions>): MinLengthValidationError;
888
+ declare function minLengthError(minLength: number, options: WithFieldTree<ValidationErrorOptions>): MinLengthValidationError;
899
889
  /**
900
890
  * Create a minLength error
901
891
  * @param minLength The minLength constraint
@@ -904,7 +894,7 @@ declare function minLengthError(minLength: number, options: WithField<Validation
904
894
  * @category validation
905
895
  * @experimental 21.0.0
906
896
  */
907
- declare function minLengthError(minLength: number, options?: ValidationErrorOptions): WithoutField<MinLengthValidationError>;
897
+ declare function minLengthError(minLength: number, options?: ValidationErrorOptions): WithoutFieldTree<MinLengthValidationError>;
908
898
  /**
909
899
  * Create a maxLength error associated with the target field
910
900
  * @param maxLength The maxLength constraint
@@ -913,7 +903,7 @@ declare function minLengthError(minLength: number, options?: ValidationErrorOpti
913
903
  * @category validation
914
904
  * @experimental 21.0.0
915
905
  */
916
- declare function maxLengthError(maxLength: number, options: WithField<ValidationErrorOptions>): MaxLengthValidationError;
906
+ declare function maxLengthError(maxLength: number, options: WithFieldTree<ValidationErrorOptions>): MaxLengthValidationError;
917
907
  /**
918
908
  * Create a maxLength error
919
909
  * @param maxLength The maxLength constraint
@@ -922,7 +912,7 @@ declare function maxLengthError(maxLength: number, options: WithField<Validation
922
912
  * @category validation
923
913
  * @experimental 21.0.0
924
914
  */
925
- declare function maxLengthError(maxLength: number, options?: ValidationErrorOptions): WithoutField<MaxLengthValidationError>;
915
+ declare function maxLengthError(maxLength: number, options?: ValidationErrorOptions): WithoutFieldTree<MaxLengthValidationError>;
926
916
  /**
927
917
  * Create a pattern matching error associated with the target field
928
918
  * @param pattern The violated pattern
@@ -931,7 +921,7 @@ declare function maxLengthError(maxLength: number, options?: ValidationErrorOpti
931
921
  * @category validation
932
922
  * @experimental 21.0.0
933
923
  */
934
- declare function patternError(pattern: RegExp, options: WithField<ValidationErrorOptions>): PatternValidationError;
924
+ declare function patternError(pattern: RegExp, options: WithFieldTree<ValidationErrorOptions>): PatternValidationError;
935
925
  /**
936
926
  * Create a pattern matching error
937
927
  * @param pattern The violated pattern
@@ -940,7 +930,7 @@ declare function patternError(pattern: RegExp, options: WithField<ValidationErro
940
930
  * @category validation
941
931
  * @experimental 21.0.0
942
932
  */
943
- declare function patternError(pattern: RegExp, options?: ValidationErrorOptions): WithoutField<PatternValidationError>;
933
+ declare function patternError(pattern: RegExp, options?: ValidationErrorOptions): WithoutFieldTree<PatternValidationError>;
944
934
  /**
945
935
  * Create an email format error associated with the target field
946
936
  * @param options The validation error options
@@ -948,7 +938,7 @@ declare function patternError(pattern: RegExp, options?: ValidationErrorOptions)
948
938
  * @category validation
949
939
  * @experimental 21.0.0
950
940
  */
951
- declare function emailError(options: WithField<ValidationErrorOptions>): EmailValidationError;
941
+ declare function emailError(options: WithFieldTree<ValidationErrorOptions>): EmailValidationError;
952
942
  /**
953
943
  * Create an email format error
954
944
  * @param options The optional validation error options
@@ -956,7 +946,7 @@ declare function emailError(options: WithField<ValidationErrorOptions>): EmailVa
956
946
  * @category validation
957
947
  * @experimental 21.0.0
958
948
  */
959
- declare function emailError(options?: ValidationErrorOptions): WithoutField<EmailValidationError>;
949
+ declare function emailError(options?: ValidationErrorOptions): WithoutFieldTree<EmailValidationError>;
960
950
  /**
961
951
  * Create a standard schema issue error associated with the target field
962
952
  * @param issue The standard schema issue
@@ -965,7 +955,7 @@ declare function emailError(options?: ValidationErrorOptions): WithoutField<Emai
965
955
  * @category validation
966
956
  * @experimental 21.0.0
967
957
  */
968
- declare function standardSchemaError(issue: StandardSchemaV1.Issue, options: WithField<ValidationErrorOptions>): StandardSchemaValidationError;
958
+ declare function standardSchemaError(issue: StandardSchemaV1.Issue, options: WithFieldTree<ValidationErrorOptions>): StandardSchemaValidationError;
969
959
  /**
970
960
  * Create a standard schema issue error
971
961
  * @param issue The standard schema issue
@@ -974,7 +964,7 @@ declare function standardSchemaError(issue: StandardSchemaV1.Issue, options: Wit
974
964
  * @category validation
975
965
  * @experimental 21.0.0
976
966
  */
977
- declare function standardSchemaError(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions): WithoutField<StandardSchemaValidationError>;
967
+ declare function standardSchemaError(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions): WithoutFieldTree<StandardSchemaValidationError>;
978
968
  /**
979
969
  * Common interface for all validation errors.
980
970
  *
@@ -996,14 +986,23 @@ interface ValidationError {
996
986
  }
997
987
  declare namespace ValidationError {
998
988
  /**
999
- * Validation error with a field.
989
+ * Validation error with an associated field tree.
1000
990
  *
1001
991
  * This is returned from field state, e.g., catField.errors() would be of a list of errors with
1002
992
  * `field: catField` bound to state.
1003
993
  */
1004
- interface WithField extends ValidationError {
994
+ interface WithFieldTree extends ValidationError {
1005
995
  /** The field associated with this error. */
1006
996
  readonly fieldTree: FieldTree<unknown>;
997
+ readonly formField?: FormField<unknown>;
998
+ }
999
+ /** @deprecated Use `ValidationError.WithFieldTree` instead */
1000
+ type WithField = WithFieldTree;
1001
+ /**
1002
+ * Validation error with an associated field tree and specific form field binding.
1003
+ */
1004
+ interface WithFormField extends WithFieldTree {
1005
+ readonly formField: FormField<unknown>;
1007
1006
  }
1008
1007
  /**
1009
1008
  * Validation error with optional field.
@@ -1011,19 +1010,24 @@ declare namespace ValidationError {
1011
1010
  * This is generally used in places where the result might have a field.
1012
1011
  * e.g., as a result of a `validateTree`, or when handling form submission.
1013
1012
  */
1014
- interface WithOptionalField extends ValidationError {
1013
+ interface WithOptionalFieldTree extends ValidationError {
1015
1014
  /** The field associated with this error. */
1016
1015
  readonly fieldTree?: FieldTree<unknown>;
1017
1016
  }
1017
+ /** @deprecated Use `ValidationError.WithOptionalFieldTree` instead */
1018
+ type WithOptionalField = WithOptionalFieldTree;
1018
1019
  /**
1019
1020
  * Validation error with no field.
1020
1021
  *
1021
1022
  * This is used to strongly enforce that fields are not allowed in validation result.
1022
1023
  */
1023
- interface WithoutField extends ValidationError {
1024
+ interface WithoutFieldTree extends ValidationError {
1024
1025
  /** The field associated with this error. */
1025
1026
  readonly fieldTree?: never;
1027
+ readonly formField?: never;
1026
1028
  }
1029
+ /** @deprecated Use `ValidationError.WithoutFieldTree` instead */
1030
+ type WithoutField = WithoutFieldTree;
1027
1031
  }
1028
1032
  /**
1029
1033
  * Internal version of `NgValidationError`, we create this separately so we can change its type on
@@ -1284,11 +1288,11 @@ declare class LogicContainer {
1284
1288
  /** Logic that determines if the field is read-only. */
1285
1289
  readonly readonly: BooleanOrLogic;
1286
1290
  /** Logic that produces synchronous validation errors for the field. */
1287
- readonly syncErrors: ArrayMergeIgnoreLogic<ValidationError.WithField, null>;
1291
+ readonly syncErrors: ArrayMergeIgnoreLogic<ValidationError.WithFieldTree, null>;
1288
1292
  /** Logic that produces synchronous validation errors for the field's subtree. */
1289
- readonly syncTreeErrors: ArrayMergeIgnoreLogic<ValidationError.WithField, null>;
1293
+ readonly syncTreeErrors: ArrayMergeIgnoreLogic<ValidationError.WithFieldTree, null>;
1290
1294
  /** Logic that produces asynchronous validation results (errors or 'pending'). */
1291
- readonly asyncErrors: ArrayMergeIgnoreLogic<ValidationError.WithField | 'pending', null>;
1295
+ readonly asyncErrors: ArrayMergeIgnoreLogic<ValidationError.WithFieldTree | 'pending', null>;
1292
1296
  /** A map of metadata keys to the `AbstractLogic` instances that compute their values. */
1293
1297
  private readonly metadata;
1294
1298
  /**
@@ -1385,9 +1389,9 @@ declare class LogicNodeBuilder extends AbstractLogicNodeBuilder {
1385
1389
  addHiddenRule(logic: LogicFn<any, boolean>): void;
1386
1390
  addDisabledReasonRule(logic: LogicFn<any, DisabledReason | undefined>): void;
1387
1391
  addReadonlyRule(logic: LogicFn<any, boolean>): void;
1388
- addSyncErrorRule(logic: LogicFn<any, ValidationResult<ValidationError.WithField>>): void;
1389
- addSyncTreeErrorRule(logic: LogicFn<any, ValidationResult<ValidationError.WithField>>): void;
1390
- addAsyncErrorRule(logic: LogicFn<any, AsyncValidationResult<ValidationError.WithField>>): void;
1392
+ addSyncErrorRule(logic: LogicFn<any, ValidationResult<ValidationError.WithFieldTree>>): void;
1393
+ addSyncTreeErrorRule(logic: LogicFn<any, ValidationResult<ValidationError.WithFieldTree>>): void;
1394
+ addAsyncErrorRule(logic: LogicFn<any, AsyncValidationResult<ValidationError.WithFieldTree>>): void;
1391
1395
  addMetadataRule<T>(key: MetadataKey<unknown, T, any>, logic: LogicFn<any, T>): void;
1392
1396
  getChild(key: PropertyKey): LogicNodeBuilder;
1393
1397
  hasLogic(builder: AbstractLogicNodeBuilder): boolean;
@@ -1638,7 +1642,7 @@ declare class FieldSubmitState {
1638
1642
  */
1639
1643
  readonly selfSubmitting: WritableSignal<boolean>;
1640
1644
  /** Submission errors that are associated with this field. */
1641
- readonly submissionErrors: WritableSignal<readonly ValidationError.WithField[]>;
1645
+ readonly submissionErrors: WritableSignal<readonly ValidationError.WithFieldTree[]>;
1642
1646
  constructor(node: FieldNode);
1643
1647
  /**
1644
1648
  * Whether this form is currently in the process of being submitted.
@@ -1652,14 +1656,14 @@ interface ValidationState {
1652
1656
  * The full set of synchronous tree errors visible to this field. This includes ones that are
1653
1657
  * targeted at a descendant field rather than at this field.
1654
1658
  */
1655
- rawSyncTreeErrors: Signal<ValidationError.WithField[]>;
1659
+ rawSyncTreeErrors: Signal<ValidationError.WithFieldTree[]>;
1656
1660
  /**
1657
1661
  * The full set of synchronous errors for this field, including synchronous tree errors and submission
1658
1662
  * errors. Submission errors are considered "synchronous" because they are imperatively added. From
1659
1663
  * the perspective of the field state they are either there or not, they are never in a pending
1660
1664
  * state.
1661
1665
  */
1662
- syncErrors: Signal<ValidationError.WithField[]>;
1666
+ syncErrors: Signal<ValidationError.WithFieldTree[]>;
1663
1667
  /**
1664
1668
  * Whether the field is considered valid according solely to its synchronous validators.
1665
1669
  * Errors resulting from a previous submit attempt are also considered for this state.
@@ -1670,21 +1674,22 @@ interface ValidationState {
1670
1674
  * targeted at a descendant field rather than at this field, as well as sentinel 'pending' values
1671
1675
  * indicating that the validator is still running and an error could still occur.
1672
1676
  */
1673
- rawAsyncErrors: Signal<(ValidationError.WithField | 'pending')[]>;
1677
+ rawAsyncErrors: Signal<(ValidationError.WithFieldTree | 'pending')[]>;
1674
1678
  /**
1675
1679
  * The asynchronous tree errors visible to this field that are specifically targeted at this field
1676
1680
  * rather than a descendant. This also includes all 'pending' sentinel values, since those could
1677
1681
  * theoretically result in errors for this field.
1678
1682
  */
1679
- asyncErrors: Signal<(ValidationError.WithField | 'pending')[]>;
1683
+ asyncErrors: Signal<(ValidationError.WithFieldTree | 'pending')[]>;
1680
1684
  /**
1681
1685
  * The combined set of all errors that currently apply to this field.
1682
1686
  */
1683
- errors: Signal<ValidationError.WithField[]>;
1687
+ errors: Signal<ValidationError.WithFieldTree[]>;
1688
+ parseErrors: Signal<ValidationError.WithFormField[]>;
1684
1689
  /**
1685
1690
  * The combined set of all errors that currently apply to this field and its descendants.
1686
1691
  */
1687
- errorSummary: Signal<ValidationError.WithField[]>;
1692
+ errorSummary: Signal<ValidationError.WithFieldTree[]>;
1688
1693
  /**
1689
1694
  * Whether this field has any asynchronous validators still pending.
1690
1695
  */
@@ -1764,7 +1769,7 @@ declare class FieldNode implements FieldState<unknown> {
1764
1769
  readonly fieldProxy: FieldTree<any>;
1765
1770
  private readonly pathNode;
1766
1771
  constructor(options: FieldNodeOptions);
1767
- focusBoundControl(): void;
1772
+ focusBoundControl(options?: FocusOptions): void;
1768
1773
  /**
1769
1774
  * Gets the Field directive binding that should be focused when the developer calls
1770
1775
  * `focusBoundControl` on this node.
@@ -1787,8 +1792,9 @@ declare class FieldNode implements FieldState<unknown> {
1787
1792
  private _controlValue;
1788
1793
  get controlValue(): Signal<unknown>;
1789
1794
  get keyInParent(): Signal<string | number>;
1790
- get errors(): Signal<ValidationError.WithField[]>;
1791
- get errorSummary(): Signal<ValidationError.WithField[]>;
1795
+ get errors(): Signal<ValidationError.WithFieldTree[]>;
1796
+ get parseErrors(): Signal<ValidationError.WithFormField[]>;
1797
+ get errorSummary(): Signal<ValidationError.WithFieldTree[]>;
1792
1798
  get pending(): Signal<boolean>;
1793
1799
  get valid(): Signal<boolean>;
1794
1800
  get invalid(): Signal<boolean>;
@@ -2407,4 +2413,4 @@ declare function submit<TModel>(form: FieldTree<TModel>, action: (form: FieldTre
2407
2413
  declare function schema<TValue>(fn: SchemaFn<TValue>): Schema<TValue>;
2408
2414
 
2409
2415
  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 };
2410
- export type { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, Debouncer, DisabledReason, FieldContext, FieldState, FieldTree, FieldValidator, FormFieldBindingOptions, FormOptions, ItemFieldContext, ItemType, LogicFn, MaybeFieldTree, MaybeSchemaPathTree, MetadataSetterType, OneOrMany, ReadonlyArrayLike, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPath, SchemaPathTree, SignalFormsConfig, Subfields, TreeValidationResult, TreeValidator, ValidationResult, ValidationSuccess, Validator, WithField, WithOptionalField, WithoutField };
2416
+ export type { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, Debouncer, DisabledReason, FieldContext, FieldState, FieldTree, FieldValidator, FormFieldBindingOptions, FormOptions, ItemFieldContext, ItemType, LogicFn, MaybeFieldTree, MaybeSchemaPathTree, MetadataSetterType, OneOrMany, ReadonlyArrayLike, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPath, SchemaPathTree, SignalFormsConfig, Subfields, TreeValidationResult, TreeValidator, ValidationResult, ValidationSuccess, Validator, WithField, WithFieldTree, WithOptionalField, WithOptionalFieldTree, WithoutField, WithoutFieldTree };
package/types/forms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */