@angular/forms 21.2.0-next.2 → 21.2.0-next.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/forms",
3
- "version": "21.2.0-next.2",
3
+ "version": "21.2.0-next.3",
4
4
  "description": "Angular - directives and services for creating forms",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -12,9 +12,9 @@
12
12
  "@standard-schema/spec": "^1.0.0"
13
13
  },
14
14
  "peerDependencies": {
15
- "@angular/core": "21.2.0-next.2",
16
- "@angular/common": "21.2.0-next.2",
17
- "@angular/platform-browser": "21.2.0-next.2",
15
+ "@angular/core": "21.2.0-next.3",
16
+ "@angular/common": "21.2.0-next.3",
17
+ "@angular/platform-browser": "21.2.0-next.3",
18
18
  "rxjs": "^6.5.3 || ^7.4.0"
19
19
  },
20
20
  "repository": {
Binary file
@@ -1,249 +1,59 @@
1
1
  /**
2
- * @license Angular v21.2.0-next.2
2
+ * @license Angular v21.2.0-next.3
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 { Signal, WritableSignal, InjectionToken, Injector, Provider } from '@angular/core';
8
+ import { WritableSignal, Signal, InjectionToken, Injector, Provider } from '@angular/core';
9
9
  import * as _angular_forms from '@angular/forms';
10
10
  import { AbstractControl, ValidationErrors, FormControlStatus, ControlValueAccessor, ValidatorFn } from '@angular/forms';
11
11
  import { StandardSchemaV1 } from '@standard-schema/spec';
12
12
 
13
13
  /**
14
- * Sets a value for the {@link MetadataKey} for this field.
15
- *
16
- * This value is combined via a reduce operation defined by the particular key,
17
- * since multiple rules in the schema might set values for it.
18
- *
19
- * @param path The target path to set the metadata for.
20
- * @param key The metadata key
21
- * @param logic A function that receives the `FieldContext` and returns a value for the metadata.
22
- * @template TValue The type of value stored in the field the logic is bound to.
23
- * @template TKey The type of metadata key.
24
- * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
25
- *
26
- * @category logic
27
- * @experimental 21.0.0
28
- */
29
- declare function metadata<TValue, TKey extends MetadataKey<any, any, any>, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, key: TKey, logic: NoInfer<LogicFn<TValue, MetadataSetterType<TKey>, TPathKind>>): TKey;
30
- /**
31
- * A reducer that determines the accumulated value for a metadata key by reducing the individual
32
- * values contributed from `metadata()` rules.
33
- *
34
- * @template TAcc The accumulated type of the reduce operation.
35
- * @template TItem The type of the individual items that are reduced over.
36
- * @experimental 21.0.2
37
- */
38
- interface MetadataReducer<TAcc, TItem> {
39
- /** The reduce function. */
40
- reduce: (acc: TAcc, item: TItem) => TAcc;
41
- /** Gets the initial accumulated value. */
42
- getInitial: () => TAcc;
43
- }
44
- declare const MetadataReducer: {
45
- /** Creates a reducer that accumulates a list of its individual item values. */
46
- readonly list: <TItem>() => MetadataReducer<TItem[], TItem | undefined>;
47
- /** Creates a reducer that accumulates the min of its individual item values. */
48
- readonly min: () => MetadataReducer<number | undefined, number | undefined>;
49
- /** Creates a reducer that accumulates a the max of its individual item values. */
50
- readonly max: () => MetadataReducer<number | undefined, number | undefined>;
51
- /** Creates a reducer that logically or's its accumulated value with each individual item value. */
52
- readonly or: () => MetadataReducer<boolean, boolean>;
53
- /** Creates a reducer that logically and's its accumulated value with each individual item value. */
54
- readonly and: () => MetadataReducer<boolean, boolean>;
55
- /** Creates a reducer that always takes the next individual item value as the accumulated value. */
56
- readonly override: typeof override;
57
- };
58
- declare function override<T>(): MetadataReducer<T | undefined, T>;
59
- declare function override<T>(getInitial: () => T): MetadataReducer<T, T>;
60
- /**
61
- * Represents metadata that is aggregated from multiple parts according to the key's reducer
62
- * function. A value can be contributed to the aggregated value for a field using an
63
- * `metadata` rule in the schema. There may be multiple rules in a schema that contribute
64
- * values to the same `MetadataKey` of the same field.
65
- *
66
- * @template TRead The type read from the `FieldState` for this key
67
- * @template TWrite The type written to this key using the `metadata()` rule
68
- * @template TAcc The type of the reducer's accumulated value.
69
- *
70
- * @experimental 21.0.0
71
- */
72
- declare class MetadataKey<TRead, TWrite, TAcc> {
73
- readonly reducer: MetadataReducer<TAcc, TWrite>;
74
- readonly create: ((s: Signal<TAcc>) => TRead) | undefined;
75
- private brand;
76
- /** Use {@link reducedMetadataKey}. */
77
- protected constructor(reducer: MetadataReducer<TAcc, TWrite>, create: ((s: Signal<TAcc>) => TRead) | undefined);
78
- }
79
- /**
80
- * Extracts the the type that can be set into the given metadata key type using the `metadata()` rule.
81
- *
82
- * @template TKey The `MetadataKey` type
83
- *
84
- * @experimental 21.0.0
85
- */
86
- type MetadataSetterType<TKey> = TKey extends MetadataKey<any, infer TWrite, any> ? TWrite : never;
87
- /**
88
- * Creates a metadata key used to contain a computed value.
89
- * The last value set on a given field tree node overrides any previously set values.
90
- *
91
- * @template TWrite The type written to this key using the `metadata()` rule
92
- *
93
- * @experimental 21.0.0
94
- */
95
- declare function createMetadataKey<TWrite>(): MetadataKey<Signal<TWrite | undefined>, TWrite, TWrite | undefined>;
96
- /**
97
- * Creates a metadata key used to contain a computed value.
98
- *
99
- * @param reducer The reducer used to combine individually set values into the final computed value.
100
- * @template TWrite The type written to this key using the `metadata()` rule
101
- * @template TAcc The type of the reducer's accumulated value.
102
- *
103
- * @experimental 21.0.0
104
- */
105
- declare function createMetadataKey<TWrite, TAcc>(reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<Signal<TAcc>, TWrite, TAcc>;
106
- /**
107
- * Creates a metadata key that exposes a managed value based on the accumulated result of the values
108
- * written to the key. The accumulated value takes the last value set on a given field tree node,
109
- * overriding any previously set values.
110
- *
111
- * @param create A function that receives a signal of the accumulated value and returns the managed
112
- * value based on it. This function runs during the construction of the `FieldTree` node,
113
- * and runs in the injection context of that node.
114
- * @template TRead The type read from the `FieldState` for this key
115
- * @template TWrite The type written to this key using the `metadata()` rule
116
- *
117
- * @experimental 21.0.0
118
- */
119
- declare function createManagedMetadataKey<TRead, TWrite>(create: (s: Signal<TWrite | undefined>) => TRead): MetadataKey<TRead, TWrite, TWrite | undefined>;
120
- /**
121
- * Creates a metadata key that exposes a managed value based on the accumulated result of the values
122
- * written to the key.
123
- *
124
- * @param create A function that receives a signal of the accumulated value and returns the managed
125
- * value based on it. This function runs during the construction of the `FieldTree` node,
126
- * and runs in the injection context of that node.
127
- * @param reducer The reducer used to combine individual value written to the key,
128
- * this will determine the accumulated value that the create function receives.
129
- * @template TRead The type read from the `FieldState` for this key
130
- * @template TWrite The type written to this key using the `metadata()` rule
131
- * @template TAcc The type of the reducer's accumulated value.
132
- *
133
- * @experimental 21.0.0
134
- */
135
- declare function createManagedMetadataKey<TRead, TWrite, TAcc>(create: (s: Signal<TAcc>) => TRead, reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<TRead, TWrite, TAcc>;
136
- /**
137
- * A {@link MetadataKey} representing whether the field is required.
138
- *
139
- * @category validation
140
- * @experimental 21.0.0
141
- */
142
- declare const REQUIRED: MetadataKey<Signal<boolean>, boolean, boolean>;
143
- /**
144
- * A {@link MetadataKey} representing the min value of the field.
145
- *
146
- * @category validation
147
- * @experimental 21.0.0
148
- */
149
- declare const MIN: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
150
- /**
151
- * A {@link MetadataKey} representing the max value of the field.
152
- *
153
- * @category validation
154
- * @experimental 21.0.0
155
- */
156
- declare const MAX: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
157
- /**
158
- * A {@link MetadataKey} representing the min length of the field.
159
- *
160
- * @category validation
161
- * @experimental 21.0.0
162
- */
163
- declare const MIN_LENGTH: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
164
- /**
165
- * A {@link MetadataKey} representing the max length of the field.
166
- *
167
- * @category validation
168
- * @experimental 21.0.0
169
- */
170
- declare const MAX_LENGTH: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
171
- /**
172
- * A {@link MetadataKey} representing the patterns the field must match.
173
- *
174
- * @category validation
175
- * @experimental 21.0.0
176
- */
177
- declare const PATTERN: MetadataKey<Signal<RegExp[]>, RegExp | undefined, RegExp[]>;
178
-
179
- /**
180
- * Utility type that removes a string index key when its value is `unknown`,
181
- * i.e. `{[key: string]: unknown}`. It allows specific string keys to pass through, even if their
182
- * value is `unknown`, e.g. `{key: unknown}`.
183
- *
184
- * @experimental 21.0.0
185
- */
186
- type RemoveStringIndexUnknownKey<K, V> = string extends K ? unknown extends V ? never : K : K;
187
- /**
188
- * Utility type that recursively ignores unknown string index properties on the given object.
189
- * We use this on the `TSchema` type in `validateStandardSchema` in order to accommodate Zod's
190
- * `looseObject` which includes `{[key: string]: unknown}` as part of the type.
191
- *
192
- * @experimental 21.0.0
193
- */
194
- type IgnoreUnknownProperties<T> = T extends Record<PropertyKey, unknown> ? {
195
- [K in keyof T as RemoveStringIndexUnknownKey<K, T[K]>]: IgnoreUnknownProperties<T[K]>;
196
- } : T;
197
- /**
198
- * Validates a field using a `StandardSchemaV1` compatible validator (e.g. a Zod validator).
199
- *
200
- * See https://github.com/standard-schema/standard-schema for more about standard schema.
201
- *
202
- * @param path The `FieldPath` to the field to validate.
203
- * @param schema The standard schema compatible validator to use for validation.
204
- * @template TSchema The type validated by the schema. This may be either the full `TValue` type,
205
- * or a partial of it.
206
- * @template TValue The type of value stored in the field being validated.
207
- *
208
- * @see [Signal Form Schema Validation](guide/forms/signals/validation#integration-with-schema-validation-libraries)
209
- * @category validation
210
- * @experimental 21.0.0
211
- */
212
- declare function validateStandardSchema<TSchema, TModel extends IgnoreUnknownProperties<TSchema>>(path: SchemaPath<TModel> & SchemaPathTree<TModel>, schema: StandardSchemaV1<TSchema>): void;
213
- /**
214
- * Create a standard schema issue error associated with the target field
215
- * @param issue The standard schema issue
216
- * @param options The validation error options
217
- *
218
- * @category validation
219
- * @experimental 21.0.0
220
- */
221
- declare function standardSchemaError(issue: StandardSchemaV1.Issue, options: WithFieldTree<ValidationErrorOptions>): StandardSchemaValidationError;
222
- /**
223
- * Create a standard schema issue error
224
- * @param issue The standard schema issue
225
- * @param options The optional validation error options
226
- *
227
- * @category validation
228
- * @experimental 21.0.0
14
+ * Symbol used to retain generic type information when it would otherwise be lost.
229
15
  */
230
- declare function standardSchemaError(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions): WithoutFieldTree<StandardSchemaValidationError>;
16
+ declare const ɵɵTYPE: unique symbol;
231
17
  /**
232
- * An error used to indicate an issue validating against a standard schema.
18
+ * Options that can be specified when submitting a form.
233
19
  *
234
- * @category validation
235
- * @experimental 21.0.0
20
+ * @experimental 21.2.0
236
21
  */
237
- declare class StandardSchemaValidationError extends BaseNgValidationError {
238
- readonly issue: StandardSchemaV1.Issue;
239
- readonly kind = "standardSchema";
240
- constructor(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions);
22
+ interface FormSubmitOptions<TRootModel, TSubmittedModel> {
23
+ /**
24
+ * Function to run when submitting the form data (when form is valid).
25
+ *
26
+ * @param field The contextually relevant field for this action function (the root field when
27
+ * specified during form creation, and the submitted field when specified as part of the
28
+ * `submit()` call)
29
+ * @param detail An object containing the root field of the submitted form as well as the
30
+ * submitted field itself
31
+ */
32
+ action: (field: FieldTree<TRootModel & TSubmittedModel>, detail: {
33
+ root: FieldTree<TRootModel>;
34
+ submitted: FieldTree<TSubmittedModel>;
35
+ }) => Promise<TreeValidationResult>;
36
+ /**
37
+ * Function to run when attempting to submit the form data but validation is failing.
38
+ *
39
+ * @param field The contextually relevant field for this onInvalid function (the root field when
40
+ * specified during form creation, and the submitted field when specified as part of the
41
+ * `submit()` call)
42
+ * @param detail An object containing the root field of the submitted form as well as the
43
+ * submitted field itself
44
+ */
45
+ onInvalid?: (field: FieldTree<TRootModel & TSubmittedModel>, detail: {
46
+ root: FieldTree<TRootModel>;
47
+ submitted: FieldTree<TSubmittedModel>;
48
+ }) => void;
49
+ /**
50
+ * Whether to ignore any of the validators when submitting:
51
+ * - 'pending': Will submit if there are no invalid validators, pending validators do not block submission (default)
52
+ * - 'none': Will not submit unless all validators are passing, pending validators block submission
53
+ * - 'ignore': Will always submit regardless of invalid or pending validators
54
+ */
55
+ ignoreValidators?: 'pending' | 'none' | 'all';
241
56
  }
242
-
243
- /**
244
- * Symbol used to retain generic type information when it would otherwise be lost.
245
- */
246
- declare const ɵɵTYPE: unique symbol;
247
57
  /**
248
58
  * A type that represents either a single value of type `T` or a readonly array of `T`.
249
59
  * @template T The type of the value(s).
@@ -398,6 +208,10 @@ type MaybeFieldTree<TModel, TKey extends string | number = string | number> = (T
398
208
  * @experimental 21.0.0
399
209
  */
400
210
  interface FieldState<TValue, TKey extends string | number = string | number> {
211
+ /**
212
+ * The {@link FieldTree} associated with this field state.
213
+ */
214
+ readonly fieldTree: FieldTree<unknown, TKey>;
401
215
  /**
402
216
  * A writable signal containing the value for this field.
403
217
  *
@@ -823,6 +637,236 @@ type ItemType<T extends Object> = T extends ReadonlyArray<any> ? T[number] : T[k
823
637
  */
824
638
  type Debouncer<TValue, TPathKind extends PathKind = PathKind.Root> = (context: FieldContext<TValue, TPathKind>, abortSignal: AbortSignal) => Promise<void> | void;
825
639
 
640
+ /**
641
+ * Sets a value for the {@link MetadataKey} for this field.
642
+ *
643
+ * This value is combined via a reduce operation defined by the particular key,
644
+ * since multiple rules in the schema might set values for it.
645
+ *
646
+ * @param path The target path to set the metadata for.
647
+ * @param key The metadata key
648
+ * @param logic A function that receives the `FieldContext` and returns a value for the metadata.
649
+ * @template TValue The type of value stored in the field the logic is bound to.
650
+ * @template TKey The type of metadata key.
651
+ * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
652
+ *
653
+ * @category logic
654
+ * @experimental 21.0.0
655
+ */
656
+ declare function metadata<TValue, TKey extends MetadataKey<any, any, any>, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, key: TKey, logic: NoInfer<LogicFn<TValue, MetadataSetterType<TKey>, TPathKind>>): TKey;
657
+ /**
658
+ * A reducer that determines the accumulated value for a metadata key by reducing the individual
659
+ * values contributed from `metadata()` rules.
660
+ *
661
+ * @template TAcc The accumulated type of the reduce operation.
662
+ * @template TItem The type of the individual items that are reduced over.
663
+ * @experimental 21.0.2
664
+ */
665
+ interface MetadataReducer<TAcc, TItem> {
666
+ /** The reduce function. */
667
+ reduce: (acc: TAcc, item: TItem) => TAcc;
668
+ /** Gets the initial accumulated value. */
669
+ getInitial: () => TAcc;
670
+ }
671
+ declare const MetadataReducer: {
672
+ /** Creates a reducer that accumulates a list of its individual item values. */
673
+ readonly list: <TItem>() => MetadataReducer<TItem[], TItem | undefined>;
674
+ /** Creates a reducer that accumulates the min of its individual item values. */
675
+ readonly min: () => MetadataReducer<number | undefined, number | undefined>;
676
+ /** Creates a reducer that accumulates a the max of its individual item values. */
677
+ readonly max: () => MetadataReducer<number | undefined, number | undefined>;
678
+ /** Creates a reducer that logically or's its accumulated value with each individual item value. */
679
+ readonly or: () => MetadataReducer<boolean, boolean>;
680
+ /** Creates a reducer that logically and's its accumulated value with each individual item value. */
681
+ readonly and: () => MetadataReducer<boolean, boolean>;
682
+ /** Creates a reducer that always takes the next individual item value as the accumulated value. */
683
+ readonly override: typeof override;
684
+ };
685
+ declare function override<T>(): MetadataReducer<T | undefined, T>;
686
+ declare function override<T>(getInitial: () => T): MetadataReducer<T, T>;
687
+ /**
688
+ * Represents metadata that is aggregated from multiple parts according to the key's reducer
689
+ * function. A value can be contributed to the aggregated value for a field using an
690
+ * `metadata` rule in the schema. There may be multiple rules in a schema that contribute
691
+ * values to the same `MetadataKey` of the same field.
692
+ *
693
+ * @template TRead The type read from the `FieldState` for this key
694
+ * @template TWrite The type written to this key using the `metadata()` rule
695
+ * @template TAcc The type of the reducer's accumulated value.
696
+ *
697
+ * @experimental 21.0.0
698
+ */
699
+ declare class MetadataKey<TRead, TWrite, TAcc> {
700
+ readonly reducer: MetadataReducer<TAcc, TWrite>;
701
+ readonly create: ((s: Signal<TAcc>) => TRead) | undefined;
702
+ private brand;
703
+ /** Use {@link reducedMetadataKey}. */
704
+ protected constructor(reducer: MetadataReducer<TAcc, TWrite>, create: ((s: Signal<TAcc>) => TRead) | undefined);
705
+ }
706
+ /**
707
+ * Extracts the the type that can be set into the given metadata key type using the `metadata()` rule.
708
+ *
709
+ * @template TKey The `MetadataKey` type
710
+ *
711
+ * @experimental 21.0.0
712
+ */
713
+ type MetadataSetterType<TKey> = TKey extends MetadataKey<any, infer TWrite, any> ? TWrite : never;
714
+ /**
715
+ * Creates a metadata key used to contain a computed value.
716
+ * The last value set on a given field tree node overrides any previously set values.
717
+ *
718
+ * @template TWrite The type written to this key using the `metadata()` rule
719
+ *
720
+ * @experimental 21.0.0
721
+ */
722
+ declare function createMetadataKey<TWrite>(): MetadataKey<Signal<TWrite | undefined>, TWrite, TWrite | undefined>;
723
+ /**
724
+ * Creates a metadata key used to contain a computed value.
725
+ *
726
+ * @param reducer The reducer used to combine individually set values into the final computed value.
727
+ * @template TWrite The type written to this key using the `metadata()` rule
728
+ * @template TAcc The type of the reducer's accumulated value.
729
+ *
730
+ * @experimental 21.0.0
731
+ */
732
+ declare function createMetadataKey<TWrite, TAcc>(reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<Signal<TAcc>, TWrite, TAcc>;
733
+ /**
734
+ * Creates a metadata key that exposes a managed value based on the accumulated result of the values
735
+ * written to the key. The accumulated value takes the last value set on a given field tree node,
736
+ * overriding any previously set values.
737
+ *
738
+ * @param create A function that receives a signal of the accumulated value and returns the managed
739
+ * value based on it. This function runs during the construction of the `FieldTree` node,
740
+ * and runs in the injection context of that node.
741
+ * @template TRead The type read from the `FieldState` for this key
742
+ * @template TWrite The type written to this key using the `metadata()` rule
743
+ *
744
+ * @experimental 21.0.0
745
+ */
746
+ declare function createManagedMetadataKey<TRead, TWrite>(create: (s: Signal<TWrite | undefined>) => TRead): MetadataKey<TRead, TWrite, TWrite | undefined>;
747
+ /**
748
+ * Creates a metadata key that exposes a managed value based on the accumulated result of the values
749
+ * written to the key.
750
+ *
751
+ * @param create A function that receives a signal of the accumulated value and returns the managed
752
+ * value based on it. This function runs during the construction of the `FieldTree` node,
753
+ * and runs in the injection context of that node.
754
+ * @param reducer The reducer used to combine individual value written to the key,
755
+ * this will determine the accumulated value that the create function receives.
756
+ * @template TRead The type read from the `FieldState` for this key
757
+ * @template TWrite The type written to this key using the `metadata()` rule
758
+ * @template TAcc The type of the reducer's accumulated value.
759
+ *
760
+ * @experimental 21.0.0
761
+ */
762
+ declare function createManagedMetadataKey<TRead, TWrite, TAcc>(create: (s: Signal<TAcc>) => TRead, reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<TRead, TWrite, TAcc>;
763
+ /**
764
+ * A {@link MetadataKey} representing whether the field is required.
765
+ *
766
+ * @category validation
767
+ * @experimental 21.0.0
768
+ */
769
+ declare const REQUIRED: MetadataKey<Signal<boolean>, boolean, boolean>;
770
+ /**
771
+ * A {@link MetadataKey} representing the min value of the field.
772
+ *
773
+ * @category validation
774
+ * @experimental 21.0.0
775
+ */
776
+ declare const MIN: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
777
+ /**
778
+ * A {@link MetadataKey} representing the max value of the field.
779
+ *
780
+ * @category validation
781
+ * @experimental 21.0.0
782
+ */
783
+ declare const MAX: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
784
+ /**
785
+ * A {@link MetadataKey} representing the min length of the field.
786
+ *
787
+ * @category validation
788
+ * @experimental 21.0.0
789
+ */
790
+ declare const MIN_LENGTH: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
791
+ /**
792
+ * A {@link MetadataKey} representing the max length of the field.
793
+ *
794
+ * @category validation
795
+ * @experimental 21.0.0
796
+ */
797
+ declare const MAX_LENGTH: MetadataKey<Signal<number | undefined>, number | undefined, number | undefined>;
798
+ /**
799
+ * A {@link MetadataKey} representing the patterns the field must match.
800
+ *
801
+ * @category validation
802
+ * @experimental 21.0.0
803
+ */
804
+ declare const PATTERN: MetadataKey<Signal<RegExp[]>, RegExp | undefined, RegExp[]>;
805
+
806
+ /**
807
+ * Utility type that removes a string index key when its value is `unknown`,
808
+ * i.e. `{[key: string]: unknown}`. It allows specific string keys to pass through, even if their
809
+ * value is `unknown`, e.g. `{key: unknown}`.
810
+ *
811
+ * @experimental 21.0.0
812
+ */
813
+ type RemoveStringIndexUnknownKey<K, V> = string extends K ? unknown extends V ? never : K : K;
814
+ /**
815
+ * Utility type that recursively ignores unknown string index properties on the given object.
816
+ * We use this on the `TSchema` type in `validateStandardSchema` in order to accommodate Zod's
817
+ * `looseObject` which includes `{[key: string]: unknown}` as part of the type.
818
+ *
819
+ * @experimental 21.0.0
820
+ */
821
+ type IgnoreUnknownProperties<T> = T extends Record<PropertyKey, unknown> ? {
822
+ [K in keyof T as RemoveStringIndexUnknownKey<K, T[K]>]: IgnoreUnknownProperties<T[K]>;
823
+ } : T;
824
+ /**
825
+ * Validates a field using a `StandardSchemaV1` compatible validator (e.g. a Zod validator).
826
+ *
827
+ * See https://github.com/standard-schema/standard-schema for more about standard schema.
828
+ *
829
+ * @param path The `FieldPath` to the field to validate.
830
+ * @param schema The standard schema compatible validator to use for validation, or a LogicFn that returns the schema.
831
+ * @template TSchema The type validated by the schema. This may be either the full `TValue` type,
832
+ * or a partial of it.
833
+ * @template TValue The type of value stored in the field being validated.
834
+ *
835
+ * @see [Signal Form Schema Validation](guide/forms/signals/validation#integration-with-schema-validation-libraries)
836
+ * @category validation
837
+ * @experimental 21.0.0
838
+ */
839
+ declare function validateStandardSchema<TSchema, TModel extends IgnoreUnknownProperties<TSchema>>(path: SchemaPath<TModel> & SchemaPathTree<TModel>, schema: StandardSchemaV1<TSchema> | LogicFn<TModel, StandardSchemaV1<unknown> | undefined>): void;
840
+ /**
841
+ * Create a standard schema issue error associated with the target field
842
+ * @param issue The standard schema issue
843
+ * @param options The validation error options
844
+ *
845
+ * @category validation
846
+ * @experimental 21.0.0
847
+ */
848
+ declare function standardSchemaError(issue: StandardSchemaV1.Issue, options: WithFieldTree<ValidationErrorOptions>): StandardSchemaValidationError;
849
+ /**
850
+ * Create a standard schema issue error
851
+ * @param issue The standard schema issue
852
+ * @param options The optional validation error options
853
+ *
854
+ * @category validation
855
+ * @experimental 21.0.0
856
+ */
857
+ declare function standardSchemaError(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions): WithoutFieldTree<StandardSchemaValidationError>;
858
+ /**
859
+ * An error used to indicate an issue validating against a standard schema.
860
+ *
861
+ * @category validation
862
+ * @experimental 21.0.0
863
+ */
864
+ declare class StandardSchemaValidationError extends BaseNgValidationError {
865
+ readonly issue: StandardSchemaV1.Issue;
866
+ readonly kind = "standardSchema";
867
+ constructor(issue: StandardSchemaV1.Issue, options?: ValidationErrorOptions);
868
+ }
869
+
826
870
  /**
827
871
  * Represents a combination of `NgControl` and `AbstractControl`.
828
872
  *
@@ -884,10 +928,6 @@ interface FormFieldBindingOptions {
884
928
  * asked to focus this binding.
885
929
  */
886
930
  readonly focus?: (focusOptions?: FocusOptions) => void;
887
- /**
888
- * Source of parse errors for this binding.
889
- */
890
- readonly parseErrors?: Signal<ValidationError.WithoutFieldTree[]>;
891
931
  }
892
932
  /**
893
933
  * Lightweight DI token provided by the {@link FormField} directive.
@@ -1339,24 +1379,6 @@ interface SignalFormsConfig {
1339
1379
  */
1340
1380
  declare function provideSignalFormsConfig(config: SignalFormsConfig): Provider[];
1341
1381
 
1342
- /**
1343
- * Options that can be specified when submitting a form.
1344
- *
1345
- * @experimental 21.2.0
1346
- */
1347
- interface FormSubmitOptions<TModel> {
1348
- /** Function to run when submitting the form data (when form is valid). */
1349
- action: (form: FieldTree<TModel>) => Promise<TreeValidationResult>;
1350
- /** Function to run when attempting to submit the form data but validation is failing. */
1351
- onInvalid?: (form: FieldTree<TModel>) => void;
1352
- /**
1353
- * Whether to ignore any of the validators when submitting:
1354
- * - 'pending': Will submit if there are no invalid validators, pending validators do not block submission (default)
1355
- * - 'none': Will not submit unless all validators are passing, pending validators block submission
1356
- * - 'ignore': Will always submit regardless of invalid or pending validators
1357
- */
1358
- ignoreValidators?: 'pending' | 'none' | 'all';
1359
- }
1360
1382
  /**
1361
1383
  * Options that may be specified when creating a form.
1362
1384
  *
@@ -1372,7 +1394,7 @@ interface FormOptions<TModel> {
1372
1394
  /** The name of the root form, used in generating name attributes for the fields. */
1373
1395
  name?: string;
1374
1396
  /** Options that define how to handle form submission. */
1375
- submission?: FormSubmitOptions<TModel>;
1397
+ submission?: FormSubmitOptions<TModel, unknown>;
1376
1398
  }
1377
1399
  /**
1378
1400
  * Creates a form wrapped around the given model data. A form is represented as simply a `FieldTree`
@@ -1613,8 +1635,8 @@ declare function applyWhenValue<TValue>(path: SchemaPath<TValue>, predicate: (va
1613
1635
  * @category submission
1614
1636
  * @experimental 21.0.0
1615
1637
  */
1616
- declare function submit<TModel>(form: FieldTree<TModel>, options?: FormSubmitOptions<TModel>): Promise<boolean>;
1617
- declare function submit<TModel>(form: FieldTree<TModel>, action: FormSubmitOptions<TModel>['action']): Promise<boolean>;
1638
+ declare function submit<TModel>(form: FieldTree<TModel>, options?: NoInfer<FormSubmitOptions<unknown, TModel>>): Promise<boolean>;
1639
+ declare function submit<TModel>(form: FieldTree<TModel>, action: NoInfer<FormSubmitOptions<unknown, TModel>['action']>): Promise<boolean>;
1618
1640
  /**
1619
1641
  * Creates a `Schema` that adds logic rules to a form.
1620
1642
  * @param fn A **non-reactive** function that sets up reactive logic rules for the form.
package/types/forms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.2.0-next.2
2
+ * @license Angular v21.2.0-next.3
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.2.0-next.2
2
+ * @license Angular v21.2.0-next.3
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */