@angular/forms 21.0.0-next.7 → 21.0.0-next.8

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.0.0-next.7",
3
+ "version": "21.0.0-next.8",
4
4
  "description": "Angular - directives and services for creating forms",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -11,9 +11,9 @@
11
11
  "tslib": "^2.3.0"
12
12
  },
13
13
  "peerDependencies": {
14
- "@angular/core": "21.0.0-next.7",
15
- "@angular/common": "21.0.0-next.7",
16
- "@angular/platform-browser": "21.0.0-next.7",
14
+ "@angular/core": "21.0.0-next.8",
15
+ "@angular/common": "21.0.0-next.8",
16
+ "@angular/platform-browser": "21.0.0-next.8",
17
17
  "@standard-schema/spec": "^1.0.0",
18
18
  "rxjs": "^6.5.3 || ^7.4.0"
19
19
  },
package/types/forms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.7
2
+ * @license Angular v21.0.0-next.8
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1100,6 +1100,8 @@ declare class FormArray<TControl extends AbstractControl<any> = any> extends Abs
1100
1100
  * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1101
1101
  * `valueChanges` observables emit events with the latest status and value when the control is
1102
1102
  * inserted. When false, no events are emitted.
1103
+ *
1104
+ * NOTE: Pushing to the FormArray will not mark it dirty. If you want to mark if dirty, call `markAsDirty()`.
1103
1105
  */
1104
1106
  push(control: TControl | Array<TControl>, options?: {
1105
1107
  emitEvent?: boolean;
@@ -1116,6 +1118,8 @@ declare class FormArray<TControl extends AbstractControl<any> = any> extends Abs
1116
1118
  * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1117
1119
  * `valueChanges` observables emit events with the latest status and value when the control is
1118
1120
  * inserted. When false, no events are emitted.
1121
+ *
1122
+ * NOTE: Inserting to the FormArray will not mark it dirty. If you want to mark if dirty, call `markAsDirty()`.
1119
1123
  */
1120
1124
  insert(index: number, control: TControl, options?: {
1121
1125
  emitEvent?: boolean;
@@ -1131,6 +1135,8 @@ declare class FormArray<TControl extends AbstractControl<any> = any> extends Abs
1131
1135
  * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1132
1136
  * `valueChanges` observables emit events with the latest status and value when the control is
1133
1137
  * removed. When false, no events are emitted.
1138
+ *
1139
+ * NOTE: Removing the FormArray will not mark it dirty. If you want to mark if dirty, call `markAsDirty()`.
1134
1140
  */
1135
1141
  removeAt(index: number, options?: {
1136
1142
  emitEvent?: boolean;
@@ -1345,6 +1351,8 @@ declare const UntypedFormArray: UntypedFormArrayCtor;
1345
1351
  * @description
1346
1352
  * Asserts that the given control is an instance of `FormArray`
1347
1353
  *
1354
+ * @see [Utility functions for narrowing form control types](guide/forms/reactive-forms#utility-functions-for-narrowing-form-control-types)
1355
+ *
1348
1356
  * @publicApi
1349
1357
  */
1350
1358
  declare const isFormArray: (control: unknown) => control is FormArray;
@@ -1695,6 +1703,8 @@ declare const UntypedFormControl: UntypedFormControlCtor;
1695
1703
  * @description
1696
1704
  * Asserts that the given control is an instance of `FormControl`
1697
1705
  *
1706
+ * @see [Utility functions for narrowing form control types](guide/forms/reactive-forms#utility-functions-for-narrowing-form-control-types)
1707
+ *
1698
1708
  * @publicApi
1699
1709
  */
1700
1710
  declare const isFormControl: (control: unknown) => control is FormControl;
@@ -2120,6 +2130,8 @@ declare const UntypedFormGroup: UntypedFormGroupCtor;
2120
2130
  * @description
2121
2131
  * Asserts that the given control is an instance of `FormGroup`
2122
2132
  *
2133
+ * @see [Utility functions for narrowing form control types](guide/forms/reactive-forms#utility-functions-for-narrowing-form-control-types)
2134
+ *
2123
2135
  * @publicApi
2124
2136
  */
2125
2137
  declare const isFormGroup: (control: unknown) => control is FormGroup;
@@ -2233,6 +2245,8 @@ interface FormRecord<TControl> {
2233
2245
  * @description
2234
2246
  * Asserts that the given control is an instance of `FormRecord`
2235
2247
  *
2248
+ * @see [Utility functions for narrowing form control types](guide/forms/reactive-forms#utility-functions-for-narrowing-form-control-types)
2249
+ *
2236
2250
  * @publicApi
2237
2251
  */
2238
2252
  declare const isFormRecord: (control: unknown) => control is FormRecord;
@@ -2269,6 +2283,8 @@ declare abstract class ControlEvent<T = any> {
2269
2283
  /**
2270
2284
  * Event fired when the value of a control changes.
2271
2285
  *
2286
+ * @see {@link AbstractControl.events}
2287
+ *
2272
2288
  * @publicApi
2273
2289
  */
2274
2290
  declare class ValueChangeEvent<T> extends ControlEvent<T> {
@@ -2279,6 +2295,8 @@ declare class ValueChangeEvent<T> extends ControlEvent<T> {
2279
2295
  /**
2280
2296
  * Event fired when the control's pristine state changes (pristine <=> dirty).
2281
2297
  *
2298
+ * @see {@link AbstractControl.events}
2299
+ *
2282
2300
  * @publicApi */
2283
2301
  declare class PristineChangeEvent extends ControlEvent {
2284
2302
  readonly pristine: boolean;
@@ -2288,6 +2306,8 @@ declare class PristineChangeEvent extends ControlEvent {
2288
2306
  /**
2289
2307
  * Event fired when the control's touched status changes (touched <=> untouched).
2290
2308
  *
2309
+ * @see {@link AbstractControl.events}
2310
+ *
2291
2311
  * @publicApi
2292
2312
  */
2293
2313
  declare class TouchedChangeEvent extends ControlEvent {
@@ -2298,6 +2318,8 @@ declare class TouchedChangeEvent extends ControlEvent {
2298
2318
  /**
2299
2319
  * Event fired when the control's status changes.
2300
2320
  *
2321
+ * @see {@link AbstractControl.events}
2322
+ *
2301
2323
  * @publicApi
2302
2324
  */
2303
2325
  declare class StatusChangeEvent extends ControlEvent {
@@ -2308,6 +2330,8 @@ declare class StatusChangeEvent extends ControlEvent {
2308
2330
  /**
2309
2331
  * Event fired when a form is submitted
2310
2332
  *
2333
+ * @see {@link AbstractControl.events}
2334
+ *
2311
2335
  * @publicApi
2312
2336
  */
2313
2337
  declare class FormSubmittedEvent extends ControlEvent {
@@ -2317,6 +2341,8 @@ declare class FormSubmittedEvent extends ControlEvent {
2317
2341
  /**
2318
2342
  * Event fired when a form is reset.
2319
2343
  *
2344
+ * @see {@link AbstractControl.events}
2345
+ *
2320
2346
  * @publicApi
2321
2347
  */
2322
2348
  declare class FormResetEvent extends ControlEvent {
@@ -2635,6 +2661,7 @@ declare abstract class AbstractControl<TValue = any, TRawValue extends TValue =
2635
2661
  * `events` of the parent control instead.
2636
2662
  * For other event types, the events are emitted after the parent control has been updated.
2637
2663
  *
2664
+ * @see [Unified control state change events](guide/forms/reactive-forms#unified-control-state-change-events)
2638
2665
  */
2639
2666
  readonly events: Observable<ControlEvent<TValue>>;
2640
2667
  /**
@@ -4063,7 +4090,7 @@ type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
4063
4090
  *
4064
4091
  * To inspect the properties of the associated `FormControl` (like the validity state),
4065
4092
  * export the directive into a local template variable using `ngModel` as the key (ex:
4066
- * `#myVar="ngModel"`). You can then access the control using the directive's `control` property.
4093
+ * `#myVar="ngModel"`). You can then access the control using the directive's `field` property.
4067
4094
  * However, the most commonly used properties (like `valid` and `dirty`) also exist on the control
4068
4095
  * for direct access. See a full list of properties directly available in
4069
4096
  * `AbstractControlDirective`.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.7
2
+ * @license Angular v21.0.0-next.8
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -10,9 +10,9 @@ import { InjectionToken, ɵControl as _Control, ɵCONTROL as _CONTROL, ɵFieldSt
10
10
  import { StandardSchemaV1 } from '@standard-schema/spec';
11
11
 
12
12
  /**
13
- * Lightweight DI token provided by the {@link Control} directive.
13
+ * Lightweight DI token provided by the {@link Field} directive.
14
14
  */
15
- declare const CONTROL: InjectionToken<Control<unknown>>;
15
+ declare const FIELD: InjectionToken<Field<unknown>>;
16
16
  /**
17
17
  * Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:
18
18
  * 1. A native HTML input or textarea
@@ -34,14 +34,14 @@ declare const CONTROL: InjectionToken<Control<unknown>>;
34
34
  * @category control
35
35
  * @experimental 21.0.0
36
36
  */
37
- declare class Control<T> implements _Control<T> {
37
+ declare class Field<T> implements _Control<T> {
38
38
  private readonly injector;
39
39
  readonly field: i0.InputSignal<FieldTree<T>>;
40
40
  readonly state: i0.Signal<FieldState<T, string | number>>;
41
41
  readonly [_CONTROL]: undefined;
42
42
  register(): void;
43
- static ɵfac: i0.ɵɵFactoryDeclaration<Control<any>, never>;
44
- static ɵdir: i0.ɵɵDirectiveDeclaration<Control<any>, "[control]", never, { "field": { "alias": "control"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
43
+ static ɵfac: i0.ɵɵFactoryDeclaration<Field<any>, never>;
44
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Field<any>, "[field]", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
45
45
  }
46
46
 
47
47
  /**
@@ -762,9 +762,9 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
762
762
  */
763
763
  readonly keyInParent: Signal<TKey>;
764
764
  /**
765
- * A signal containing the `Control` directives this field is currently bound to.
765
+ * The {@link Field} directives that bind this field to a UI control.
766
766
  */
767
- readonly controls: Signal<readonly Control<unknown>[]>;
767
+ readonly fieldBindings: Signal<readonly Field<unknown>[]>;
768
768
  /**
769
769
  * Reads an aggregate property value from the field.
770
770
  * @param prop The property to read.
@@ -1073,93 +1073,93 @@ declare function validateHttp<TValue, TResult = unknown, TPathKind extends PathK
1073
1073
  */
1074
1074
  interface FormUiControl {
1075
1075
  /**
1076
- * An input to receive the errors for the field. If implemented, the `Control` directive will
1076
+ * An input to receive the errors for the field. If implemented, the `Field` directive will
1077
1077
  * automatically bind errors from the bound field to this input.
1078
1078
  */
1079
1079
  readonly errors?: InputSignal<readonly WithOptionalField<ValidationError>[]>;
1080
1080
  /**
1081
- * An input to receive the disabled status for the field. If implemented, the `Control` directive
1081
+ * An input to receive the disabled status for the field. If implemented, the `Field` directive
1082
1082
  * will automatically bind the disabled status from the bound field to this input.
1083
1083
  */
1084
1084
  readonly disabled?: InputSignal<boolean>;
1085
1085
  /**
1086
- * An input to receive the reasons for the disablement of the field. If implemented, the `Control`
1086
+ * An input to receive the reasons for the disablement of the field. If implemented, the `Field`
1087
1087
  * directive will automatically bind the disabled reason from the bound field to this input.
1088
1088
  */
1089
1089
  readonly disabledReasons?: InputSignal<readonly WithOptionalField<DisabledReason>[]>;
1090
1090
  /**
1091
- * An input to receive the readonly status for the field. If implemented, the `Control` directive
1091
+ * An input to receive the readonly status for the field. If implemented, the `Field` directive
1092
1092
  * will automatically bind the readonly status from the bound field to this input.
1093
1093
  */
1094
1094
  readonly readonly?: InputSignal<boolean>;
1095
1095
  /**
1096
- * An input to receive the hidden status for the field. If implemented, the `Control` directive
1096
+ * An input to receive the hidden status for the field. If implemented, the `Field` directive
1097
1097
  * will automatically bind the hidden status from the bound field to this input.
1098
1098
  */
1099
1099
  readonly hidden?: InputSignal<boolean>;
1100
1100
  /**
1101
- * An input to receive the invalid status for the field. If implemented, the `Control` directive
1101
+ * An input to receive the invalid status for the field. If implemented, the `Field` directive
1102
1102
  * will automatically bind the invalid status from the bound field to this input.
1103
1103
  */
1104
1104
  readonly invalid?: InputSignal<boolean>;
1105
1105
  /**
1106
- * An input to receive the pending status for the field. If implemented, the `Control` directive
1106
+ * An input to receive the pending status for the field. If implemented, the `Field` directive
1107
1107
  * will automatically bind the pending status from the bound field to this input.
1108
1108
  */
1109
1109
  readonly pending?: InputSignal<boolean>;
1110
1110
  /**
1111
- * An input to receive the touched status for the field. If implemented, the `Control` directive
1111
+ * An input to receive the touched status for the field. If implemented, the `Field` directive
1112
1112
  * will automatically bind the touched status from the bound field to this input.
1113
1113
  */
1114
1114
  readonly touched?: ModelSignal<boolean> | InputSignal<boolean> | OutputRef<boolean>;
1115
1115
  /**
1116
- * An input to receive the dirty status for the field. If implemented, the `Control` directive
1116
+ * An input to receive the dirty status for the field. If implemented, the `Field` directive
1117
1117
  * will automatically bind the dirty status from the bound field to this input.
1118
1118
  */
1119
1119
  readonly dirty?: InputSignal<boolean>;
1120
1120
  /**
1121
- * An input to receive the name for the field. If implemented, the `Control` directive will
1121
+ * An input to receive the name for the field. If implemented, the `Field` directive will
1122
1122
  * automatically bind the name from the bound field to this input.
1123
1123
  */
1124
1124
  readonly name?: InputSignal<string>;
1125
1125
  /**
1126
- * An input to receive the required status for the field. If implemented, the `Control` directive
1126
+ * An input to receive the required status for the field. If implemented, the `Field` directive
1127
1127
  * will automatically bind the required status from the bound field to this input.
1128
1128
  */
1129
1129
  readonly required?: InputSignal<boolean>;
1130
1130
  /**
1131
- * An input to receive the min value for the field. If implemented, the `Control` directive will
1131
+ * An input to receive the min value for the field. If implemented, the `Field` directive will
1132
1132
  * automatically bind the min value from the bound field to this input.
1133
1133
  */
1134
1134
  readonly min?: InputSignal<number | undefined>;
1135
1135
  /**
1136
- * An input to receive the min length for the field. If implemented, the `Control` directive will
1136
+ * An input to receive the min length for the field. If implemented, the `Field` directive will
1137
1137
  * automatically bind the min length from the bound field to this input.
1138
1138
  */
1139
1139
  readonly minLength?: InputSignal<number | undefined>;
1140
1140
  /**
1141
- * An input to receive the max value for the field. If implemented, the `Control` directive will
1141
+ * An input to receive the max value for the field. If implemented, the `Field` directive will
1142
1142
  * automatically bind the max value from the bound field to this input.
1143
1143
  */
1144
1144
  readonly max?: InputSignal<number | undefined>;
1145
1145
  /**
1146
- * An input to receive the max length for the field. If implemented, the `Control` directive will
1146
+ * An input to receive the max length for the field. If implemented, the `Field` directive will
1147
1147
  * automatically bind the max length from the bound field to this input.
1148
1148
  */
1149
1149
  readonly maxLength?: InputSignal<number | undefined>;
1150
1150
  /**
1151
- * An input to receive the value patterns for the field. If implemented, the `Control` directive
1151
+ * An input to receive the value patterns for the field. If implemented, the `Field` directive
1152
1152
  * will automatically bind the value patterns from the bound field to this input.
1153
1153
  */
1154
1154
  readonly pattern?: InputSignal<readonly RegExp[]>;
1155
1155
  }
1156
1156
  /**
1157
1157
  * A contract for a form control that edits a `FieldTree` of type `TValue`. Any component that
1158
- * implements this contract can be used with the `Control` directive.
1158
+ * implements this contract can be used with the `Field` directive.
1159
1159
  *
1160
1160
  * Many of the properties declared on this contract are optional. They do not need to be
1161
1161
  * implemented, but if they are will be kept in sync with the field state of the field bound to the
1162
- * `Control` directive.
1162
+ * `Field` directive.
1163
1163
  *
1164
1164
  * @template TValue The type of `FieldTree` that the implementing component can edit.
1165
1165
  *
@@ -1169,23 +1169,23 @@ interface FormUiControl {
1169
1169
  interface FormValueControl<TValue> extends FormUiControl {
1170
1170
  /**
1171
1171
  * The value is the only required property in this contract. A component that wants to integrate
1172
- * with the `Control` directive via this contract, *must* provide a `model()` that will be kept in
1172
+ * with the `Field` directive via this contract, *must* provide a `model()` that will be kept in
1173
1173
  * sync with the value of the bound `FieldTree`.
1174
1174
  */
1175
1175
  readonly value: ModelSignal<TValue>;
1176
1176
  /**
1177
1177
  * The implementing component *must not* define a `checked` property. This is reserved for
1178
- * components that want to integrate with the `Control` directive as a checkbox.
1178
+ * components that want to integrate with the `Field` directive as a checkbox.
1179
1179
  */
1180
1180
  readonly checked?: undefined;
1181
1181
  }
1182
1182
  /**
1183
1183
  * A contract for a form control that edits a boolean checkbox `FieldTree`. Any component that
1184
- * implements this contract can be used with the `Control` directive.
1184
+ * implements this contract can be used with the `Field` directive.
1185
1185
  *
1186
1186
  * Many of the properties declared on this contract are optional. They do not need to be
1187
1187
  * implemented, but if they are will be kept in sync with the field state of the field bound to the
1188
- * `Control` directive.
1188
+ * `Field` directive.
1189
1189
  *
1190
1190
  * @category control
1191
1191
  * @experimental 21.0.0
@@ -1193,13 +1193,13 @@ interface FormValueControl<TValue> extends FormUiControl {
1193
1193
  interface FormCheckboxControl extends FormUiControl {
1194
1194
  /**
1195
1195
  * The checked is the only required property in this contract. A component that wants to integrate
1196
- * with the `Control` directive, *must* provide a `model()` that will be kept in sync with the
1196
+ * with the `Field` directive, *must* provide a `model()` that will be kept in sync with the
1197
1197
  * value of the bound `FieldTree`.
1198
1198
  */
1199
1199
  readonly checked: ModelSignal<boolean>;
1200
1200
  /**
1201
1201
  * The implementing component *must not* define a `value` property. This is reserved for
1202
- * components that want to integrate with the `Control` directive as a standard input.
1202
+ * components that want to integrate with the `Field` directive as a standard input.
1203
1203
  */
1204
1204
  readonly value?: undefined;
1205
1205
  }
@@ -1721,8 +1721,8 @@ declare class FieldNodeState {
1721
1721
  * Marks this specific field as not touched.
1722
1722
  */
1723
1723
  markAsUntouched(): void;
1724
- /** The UI controls the field is currently bound to. */
1725
- readonly controls: i0.WritableSignal<readonly Control<unknown>[]>;
1724
+ /** The {@link Field} directives that bind this field to a UI control. */
1725
+ readonly fieldBindings: i0.WritableSignal<readonly Field<unknown>[]>;
1726
1726
  constructor(node: FieldNode);
1727
1727
  /**
1728
1728
  * Whether this field is considered dirty.
@@ -1932,7 +1932,7 @@ declare class FieldNode implements FieldState<unknown> {
1932
1932
  get disabledReasons(): Signal<readonly DisabledReason[]>;
1933
1933
  get hidden(): Signal<boolean>;
1934
1934
  get readonly(): Signal<boolean>;
1935
- get controls(): Signal<readonly Control<unknown>[]>;
1935
+ get fieldBindings(): Signal<readonly Field<unknown>[]>;
1936
1936
  get submitting(): Signal<boolean>;
1937
1937
  get name(): Signal<string>;
1938
1938
  get max(): Signal<number | undefined>;
@@ -2650,5 +2650,5 @@ type IgnoreUnknownProperties<T> = T extends Record<PropertyKey, unknown> ? {
2650
2650
  */
2651
2651
  declare function validateStandardSchema<TSchema, TValue extends IgnoreUnknownProperties<TSchema>>(path: FieldPath<TValue>, schema: StandardSchemaV1<TSchema>): void;
2652
2652
 
2653
- export { AggregateProperty, CONTROL, Control, CustomValidationError, EmailValidationError, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PathKind, PatternValidationError, Property, REQUIRED, RequiredValidationError, StandardSchemaValidationError, aggregateProperty, andProperty, apply, applyEach, applyWhen, applyWhenValue, createProperty, customError, disabled, email, emailError, form, hidden, listProperty, max, maxError, maxLength, maxLengthError, maxProperty, min, minError, minLength, minLengthError, minProperty, orProperty, pattern, patternError, property, readonly, reducedProperty, required, requiredError, schema, standardSchemaError, submit, validate, validateAsync, validateHttp, validateStandardSchema, validateTree };
2653
+ export { AggregateProperty, CustomValidationError, EmailValidationError, FIELD, Field, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PathKind, PatternValidationError, Property, REQUIRED, RequiredValidationError, StandardSchemaValidationError, aggregateProperty, andProperty, apply, applyEach, applyWhen, applyWhenValue, createProperty, customError, disabled, email, emailError, form, hidden, listProperty, max, maxError, maxLength, maxLengthError, maxProperty, min, minError, minLength, minLengthError, minProperty, orProperty, pattern, patternError, property, readonly, reducedProperty, required, requiredError, schema, standardSchemaError, submit, validate, validateAsync, validateHttp, validateStandardSchema, validateTree };
2654
2654
  export type { AsyncValidationResult, AsyncValidatorOptions, ChildFieldContext, DisabledReason, FieldContext, FieldPath, FieldState, FieldTree, FieldValidationResult, FieldValidator, FormCheckboxControl, FormOptions, FormUiControl, FormValueControl, HttpValidatorOptions, IgnoreUnknownProperties, ItemFieldContext, LogicFn, MapToErrorsFn, MaybeFieldPath, MaybeFieldTree, Mutable, OneOrMany, ReadonlyArrayLike, RemoveStringIndexUnknownKey, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, Subfields, SubmittedStatus, TreeValidationResult, TreeValidator, ValidationError, ValidationResult, ValidationSuccess, Validator, WithField, WithOptionalField, WithoutField };