@angular/forms 20.2.3 → 21.0.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.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.2.3
2
+ * @license Angular v21.0.0-next.1
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -3643,7 +3643,7 @@ declare class NgControlStatus extends AbstractControlStatus {
3643
3643
  declare class NgControlStatusGroup extends AbstractControlStatus {
3644
3644
  constructor(cd: ControlContainer);
3645
3645
  static ɵfac: i0.ɵɵFactoryDeclaration<NgControlStatusGroup, [{ optional: true; self: true; }]>;
3646
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgControlStatusGroup, "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]", never, {}, {}, never, never, false, never>;
3646
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgControlStatusGroup, "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]", never, {}, {}, never, never, false, never>;
3647
3647
  }
3648
3648
 
3649
3649
  /**
@@ -3736,28 +3736,12 @@ declare class FormControlName extends NgControl implements OnChanges, OnDestroy
3736
3736
  /**
3737
3737
  * @description
3738
3738
  *
3739
- * Binds an existing `FormGroup` or `FormRecord` to a DOM element.
3740
- *
3741
- * This directive accepts an existing `FormGroup` instance. It will then use this
3742
- * `FormGroup` instance to match any child `FormControl`, `FormGroup`/`FormRecord`,
3743
- * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
3744
- * and `FormArrayName` directives.
3745
- *
3746
- * @see [Reactive Forms Guide](guide/forms/reactive-forms)
3747
- * @see {@link AbstractControl}
3748
- *
3749
- * @usageNotes
3750
- * ### Register Form Group
3751
- *
3752
- * The following example registers a `FormGroup` with first name and last name controls,
3753
- * and listens for the *ngSubmit* event when the button is clicked.
3754
- *
3755
- * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
3739
+ * Abstract class for top-level form directives (FormArrayDirective, FormGroupDirective) who bind an
3740
+ * existing `Form` to a DOM element.
3756
3741
  *
3757
- * @ngModule ReactiveFormsModule
3758
3742
  * @publicApi
3759
3743
  */
3760
- declare class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
3744
+ declare abstract class AbstractFormDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
3761
3745
  private callSetDisabledState?;
3762
3746
  /**
3763
3747
  * @description
@@ -3783,19 +3767,23 @@ declare class FormGroupDirective extends ControlContainer implements Form, OnCha
3783
3767
  directives: FormControlName[];
3784
3768
  /**
3785
3769
  * @description
3786
- * Tracks the `FormGroup` bound to this directive.
3770
+ * Tracks the form bound to this directive.
3787
3771
  */
3788
- form: FormGroup;
3772
+ abstract form: AbstractControl;
3789
3773
  /**
3790
3774
  * @description
3791
3775
  * Emits an event when the form submission has been triggered.
3792
3776
  */
3793
- ngSubmit: EventEmitter<any>;
3777
+ abstract ngSubmit: EventEmitter<any>;
3794
3778
  constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
3795
- /** @docs-private */
3779
+ /** @nodoc */
3796
3780
  ngOnChanges(changes: SimpleChanges): void;
3797
- /** @docs-private */
3781
+ /** @nodoc */
3798
3782
  ngOnDestroy(): void;
3783
+ /** @nodoc */
3784
+ protected onChanges(changes: SimpleChanges): void;
3785
+ /** @nodoc */
3786
+ protected onDestroy(): void;
3799
3787
  /**
3800
3788
  * @description
3801
3789
  * Returns this directive's instance.
@@ -3803,9 +3791,9 @@ declare class FormGroupDirective extends ControlContainer implements Form, OnCha
3803
3791
  get formDirective(): Form;
3804
3792
  /**
3805
3793
  * @description
3806
- * Returns the `FormGroup` bound to this directive.
3794
+ * Returns the Form bound to this directive.
3807
3795
  */
3808
- get control(): FormGroup;
3796
+ abstract get control(): AbstractControl;
3809
3797
  /**
3810
3798
  * @description
3811
3799
  * Returns an array representing the path to this group. Because this directive
@@ -3854,6 +3842,13 @@ declare class FormGroupDirective extends ControlContainer implements Form, OnCha
3854
3842
  * @param dir The `FormGroupName` directive instance.
3855
3843
  */
3856
3844
  getFormGroup(dir: FormGroupName): FormGroup;
3845
+ /**
3846
+ * @description
3847
+ * Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
3848
+ *
3849
+ * @param dir The `FormArrayName` directive instance.
3850
+ */
3851
+ getFormArray(dir: FormArrayName): FormArray;
3857
3852
  /**
3858
3853
  * Performs the necessary setup when a `FormArrayName` directive instance is added to the view.
3859
3854
  *
@@ -3867,13 +3862,6 @@ declare class FormGroupDirective extends ControlContainer implements Form, OnCha
3867
3862
  * @param dir The `FormArrayName` directive instance.
3868
3863
  */
3869
3864
  removeFormArray(dir: FormArrayName): void;
3870
- /**
3871
- * @description
3872
- * Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
3873
- *
3874
- * @param dir The `FormArrayName` directive instance.
3875
- */
3876
- getFormArray(dir: FormArrayName): FormArray;
3877
3865
  /**
3878
3866
  * Sets the new value for the provided `FormControlName` directive.
3879
3867
  *
@@ -3881,14 +3869,6 @@ declare class FormGroupDirective extends ControlContainer implements Form, OnCha
3881
3869
  * @param value The new value for the directive's control.
3882
3870
  */
3883
3871
  updateModel(dir: FormControlName, value: any): void;
3884
- /**
3885
- * @description
3886
- * Method called with the "submit" event is triggered on the form.
3887
- * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
3888
- *
3889
- * @param $event The "submit" event object
3890
- */
3891
- onSubmit($event: Event): boolean;
3892
3872
  /**
3893
3873
  * @description
3894
3874
  * Method called when the "reset" event is triggered on the form.
@@ -3898,18 +3878,27 @@ declare class FormGroupDirective extends ControlContainer implements Form, OnCha
3898
3878
  * @description
3899
3879
  * Resets the form to an initial value and resets its submitted status.
3900
3880
  *
3901
- * @param value The new value for the form, `undefined` by default
3881
+ * @param value The new value for the form.
3902
3882
  */
3903
3883
  resetForm(value?: any, options?: {
3904
3884
  onlySelf?: boolean;
3905
3885
  emitEvent?: boolean;
3906
3886
  }): void;
3887
+ /**
3888
+ * @description
3889
+ * Method called with the "submit" event is triggered on the form.
3890
+ * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
3891
+ *
3892
+ * @param $event The "submit" event object
3893
+ */
3894
+ onSubmit($event: Event): boolean;
3907
3895
  private _setUpFormContainer;
3908
3896
  private _cleanUpFormContainer;
3909
3897
  private _updateRegistrations;
3910
3898
  private _updateValidators;
3911
- static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
3912
- static ɵdir: i0.ɵɵDirectiveDeclaration<FormGroupDirective, "[formGroup]", ["ngForm"], { "form": { "alias": "formGroup"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
3899
+ private _checkFormPresent;
3900
+ static ɵfac: i0.ɵɵFactoryDeclaration<AbstractFormDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
3901
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractFormDirective, never, never, {}, {}, never, never, true, never>;
3913
3902
  }
3914
3903
 
3915
3904
  /**
@@ -3979,12 +3968,12 @@ declare class FormGroupName extends AbstractFormGroupDirective implements OnInit
3979
3968
  *
3980
3969
  * Syncs a nested `FormArray` to a DOM element.
3981
3970
  *
3982
- * This directive is designed to be used with a parent `FormGroupDirective` (selector:
3983
- * `[formGroup]`).
3971
+ * This directive is designed to be used with a parent `FormGroupDirective`/`FormGroupArray` (selector:
3972
+ * `[formGroup]`/`[formArray]`).
3984
3973
  *
3985
3974
  * It accepts the string name of the nested `FormArray` you want to link, and
3986
3975
  * will look for a `FormArray` registered with that name in the parent
3987
- * `FormGroup` instance you passed into `FormGroupDirective`.
3976
+ * `FormGroup`/`FormArray` instance you passed into `FormGroupDirective`/`FormGroupArray`.
3988
3977
  *
3989
3978
  * @see [Reactive Forms Guide](guide/forms/reactive-forms)
3990
3979
  * @see {@link AbstractControl}
@@ -4030,7 +4019,7 @@ declare class FormArrayName extends ControlContainer implements OnInit, OnDestro
4030
4019
  * @description
4031
4020
  * The top-level directive for this group if present, otherwise null.
4032
4021
  */
4033
- get formDirective(): FormGroupDirective | null;
4022
+ get formDirective(): AbstractFormDirective | null;
4034
4023
  /**
4035
4024
  * @description
4036
4025
  * Returns an array that represents the path from the top-level form to this control.
@@ -4467,7 +4456,49 @@ declare class NgForm extends ControlContainer implements Form, AfterViewInit {
4467
4456
  private _setUpdateStrategy;
4468
4457
  private _findContainer;
4469
4458
  static ɵfac: i0.ɵɵFactoryDeclaration<NgForm, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
4470
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgForm, "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", ["ngForm"], { "options": { "alias": "ngFormOptions"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
4459
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgForm, "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", ["ngForm"], { "options": { "alias": "ngFormOptions"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
4460
+ }
4461
+
4462
+ /**
4463
+ * @description
4464
+ *
4465
+ * Binds an existing `FormArray` to a DOM element.
4466
+ *
4467
+ * This directive accepts an existing `FormArray` instance. It will then use this
4468
+ * `FormArray` instance to match any child `FormControl`, `FormGroup`/`FormRecord`,
4469
+ * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
4470
+ * and `FormArrayName` directives.
4471
+ *
4472
+ * @see [Reactive Forms Guide](guide/reactive-forms)
4473
+ * @see {@link AbstractControl}
4474
+ *
4475
+ * @usageNotes
4476
+ * ### Register Form Array
4477
+ *
4478
+ * The following example registers a `FormArray` with first name and last name controls,
4479
+ * and listens for the *ngSubmit* event when the button is clicked.
4480
+ *
4481
+ * @ngModule ReactiveFormsModule
4482
+ * @publicApi
4483
+ */
4484
+ declare class FormArrayDirective extends AbstractFormDirective {
4485
+ /**
4486
+ * @description
4487
+ * Tracks the `FormArray` bound to this directive.
4488
+ */
4489
+ form: FormArray;
4490
+ /**
4491
+ * @description
4492
+ * Emits an event when the form submission has been triggered.
4493
+ */
4494
+ ngSubmit: EventEmitter<any>;
4495
+ /**
4496
+ * @description
4497
+ * Returns the `FormArray` bound to this directive.
4498
+ */
4499
+ get control(): FormArray;
4500
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormArrayDirective, never>;
4501
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormArrayDirective, "[formArray]", ["ngForm"], { "form": { "alias": "formArray"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
4471
4502
  }
4472
4503
 
4473
4504
  /**
@@ -4541,6 +4572,50 @@ declare class FormControlDirective extends NgControl implements OnChanges, OnDes
4541
4572
  static ɵdir: i0.ɵɵDirectiveDeclaration<FormControlDirective, "[formControl]", ["ngForm"], { "form": { "alias": "formControl"; "required": false; }; "isDisabled": { "alias": "disabled"; "required": false; }; "model": { "alias": "ngModel"; "required": false; }; }, { "update": "ngModelChange"; }, never, never, false, never>;
4542
4573
  }
4543
4574
 
4575
+ /**
4576
+ * @description
4577
+ *
4578
+ * Binds an existing `FormGroup` or `FormRecord` to a DOM element.
4579
+ *
4580
+ * This directive accepts an existing `FormGroup` instance. It will then use this
4581
+ * `FormGroup` instance to match any child `FormControl`, `FormGroup`/`FormRecord`,
4582
+ * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
4583
+ * and `FormArrayName` directives.
4584
+ *
4585
+ * @see [Reactive Forms Guide](guide/forms/reactive-forms)
4586
+ * @see {@link AbstractControl}
4587
+ *
4588
+ * @usageNotes
4589
+ * ### Register Form Group
4590
+ *
4591
+ * The following example registers a `FormGroup` with first name and last name controls,
4592
+ * and listens for the *ngSubmit* event when the button is clicked.
4593
+ *
4594
+ * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
4595
+ *
4596
+ * @ngModule ReactiveFormsModule
4597
+ * @publicApi
4598
+ */
4599
+ declare class FormGroupDirective extends AbstractFormDirective {
4600
+ /**
4601
+ * @description
4602
+ * Tracks the `FormGroup` bound to this directive.
4603
+ */
4604
+ form: FormGroup;
4605
+ /**
4606
+ * @description
4607
+ * Emits an event when the form submission has been triggered.
4608
+ */
4609
+ ngSubmit: EventEmitter<any>;
4610
+ /**
4611
+ * @description
4612
+ * Returns the `FormGroup` bound to this directive.
4613
+ */
4614
+ get control(): FormGroup;
4615
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupDirective, never>;
4616
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FormGroupDirective, "[formGroup]", ["ngForm"], { "form": { "alias": "formGroup"; "required": false; }; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
4617
+ }
4618
+
4544
4619
  /**
4545
4620
  * Internal module used for sharing directives between FormsModule and ReactiveFormsModule
4546
4621
  */
@@ -5235,9 +5310,9 @@ declare class ReactiveFormsModule {
5235
5310
  callSetDisabledState?: SetDisabledStateOption;
5236
5311
  }): ModuleWithProviders<ReactiveFormsModule>;
5237
5312
  static ɵfac: i0.ɵɵFactoryDeclaration<ReactiveFormsModule, never>;
5238
- static ɵmod: i0.ɵɵNgModuleDeclaration<ReactiveFormsModule, [typeof FormControlDirective, typeof FormGroupDirective, typeof FormControlName, typeof FormGroupName, typeof FormArrayName], never, [typeof ɵInternalFormsSharedModule, typeof FormControlDirective, typeof FormGroupDirective, typeof FormControlName, typeof FormGroupName, typeof FormArrayName]>;
5313
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ReactiveFormsModule, [typeof FormControlDirective, typeof FormGroupDirective, typeof FormArrayDirective, typeof FormControlName, typeof FormGroupName, typeof FormArrayName], never, [typeof ɵInternalFormsSharedModule, typeof FormControlDirective, typeof FormGroupDirective, typeof FormArrayDirective, typeof FormControlName, typeof FormGroupName, typeof FormArrayName]>;
5239
5314
  static ɵinj: i0.ɵɵInjectorDeclaration<ReactiveFormsModule>;
5240
5315
  }
5241
5316
 
5242
- export { AbstractControl, AbstractControlDirective, AbstractFormGroupDirective, COMPOSITION_BUFFER_MODE, CheckboxControlValueAccessor, CheckboxRequiredValidator, ControlContainer, ControlEvent, DefaultValueAccessor, EmailValidator, FormArray, FormArrayName, FormBuilder, FormControl, FormControlDirective, FormControlName, FormGroup, FormGroupDirective, FormGroupName, FormRecord, FormResetEvent, FormSubmittedEvent, FormsModule, MaxLengthValidator, MaxValidator, MinLengthValidator, MinValidator, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl, NgControlStatus, NgControlStatusGroup, NgForm, NgModel, NgModelGroup, NgSelectOption, NonNullableFormBuilder, NumberValueAccessor, PatternValidator, PristineChangeEvent, RadioControlValueAccessor, RangeValueAccessor, ReactiveFormsModule, RequiredValidator, SelectControlValueAccessor, SelectMultipleControlValueAccessor, StatusChangeEvent, TouchedChangeEvent, UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, VERSION, Validators, ValueChangeEvent, isFormArray, isFormControl, isFormGroup, isFormRecord, ɵInternalFormsSharedModule, ɵNgNoValidate, ɵNgSelectMultipleOption };
5317
+ export { AbstractControl, AbstractControlDirective, AbstractFormDirective, AbstractFormGroupDirective, COMPOSITION_BUFFER_MODE, CheckboxControlValueAccessor, CheckboxRequiredValidator, ControlContainer, ControlEvent, DefaultValueAccessor, EmailValidator, FormArray, FormArrayDirective, FormArrayName, FormBuilder, FormControl, FormControlDirective, FormControlName, FormGroup, FormGroupDirective, FormGroupName, FormRecord, FormResetEvent, FormSubmittedEvent, FormsModule, MaxLengthValidator, MaxValidator, MinLengthValidator, MinValidator, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl, NgControlStatus, NgControlStatusGroup, NgForm, NgModel, NgModelGroup, NgSelectOption, NonNullableFormBuilder, NumberValueAccessor, PatternValidator, PristineChangeEvent, RadioControlValueAccessor, RangeValueAccessor, ReactiveFormsModule, RequiredValidator, SelectControlValueAccessor, SelectMultipleControlValueAccessor, StatusChangeEvent, TouchedChangeEvent, UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, VERSION, Validators, ValueChangeEvent, isFormArray, isFormControl, isFormGroup, isFormRecord, ɵInternalFormsSharedModule, ɵNgNoValidate, ɵNgSelectMultipleOption };
5243
5318
  export type { AbstractControlOptions, AsyncValidator, AsyncValidatorFn, ControlConfig, ControlValueAccessor, Form, FormControlOptions, FormControlState, FormControlStatus, SetDisabledStateOption, ValidationErrors, Validator, ValidatorFn, ɵCoerceStrArrToNumArr, ɵElement, ɵFormArrayRawValue, ɵFormArrayValue, ɵFormControlCtor, ɵFormGroupRawValue, ɵFormGroupValue, ɵGetProperty, ɵNavigate, ɵOptionalKeys, ɵRawValue, ɵTokenize, ɵTypedOrUntyped, ɵValue, ɵWriteable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/forms",
3
- "version": "20.2.3",
3
+ "version": "21.0.0-next.1",
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": "20.2.3",
15
- "@angular/common": "20.2.3",
16
- "@angular/platform-browser": "20.2.3",
14
+ "@angular/core": "21.0.0-next.1",
15
+ "@angular/common": "21.0.0-next.1",
16
+ "@angular/platform-browser": "21.0.0-next.1",
17
17
  "rxjs": "^6.5.3 || ^7.4.0"
18
18
  },
19
19
  "repository": {