@angular/forms 15.0.0-next.5 → 15.0.0-rc.0

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.
Files changed (35) hide show
  1. package/esm2020/src/directives/abstract_form_group_directive.mjs +3 -3
  2. package/esm2020/src/directives/checkbox_value_accessor.mjs +3 -3
  3. package/esm2020/src/directives/control_value_accessor.mjs +6 -6
  4. package/esm2020/src/directives/default_value_accessor.mjs +3 -3
  5. package/esm2020/src/directives/ng_control_status.mjs +6 -6
  6. package/esm2020/src/directives/ng_form.mjs +13 -7
  7. package/esm2020/src/directives/ng_model.mjs +13 -7
  8. package/esm2020/src/directives/ng_model_group.mjs +3 -3
  9. package/esm2020/src/directives/ng_no_validate_directive.mjs +3 -3
  10. package/esm2020/src/directives/number_value_accessor.mjs +3 -3
  11. package/esm2020/src/directives/radio_control_value_accessor.mjs +10 -10
  12. package/esm2020/src/directives/range_value_accessor.mjs +3 -3
  13. package/esm2020/src/directives/reactive_directives/form_control_directive.mjs +13 -7
  14. package/esm2020/src/directives/reactive_directives/form_control_name.mjs +3 -3
  15. package/esm2020/src/directives/reactive_directives/form_group_directive.mjs +14 -8
  16. package/esm2020/src/directives/reactive_directives/form_group_name.mjs +6 -6
  17. package/esm2020/src/directives/select_control_value_accessor.mjs +6 -6
  18. package/esm2020/src/directives/select_multiple_control_value_accessor.mjs +6 -6
  19. package/esm2020/src/directives/shared.mjs +19 -5
  20. package/esm2020/src/directives/validators.mjs +27 -27
  21. package/esm2020/src/directives.mjs +6 -5
  22. package/esm2020/src/form_builder.mjs +9 -9
  23. package/esm2020/src/form_providers.mjs +37 -10
  24. package/esm2020/src/forms.mjs +4 -4
  25. package/esm2020/src/model/abstract_model.mjs +6 -1
  26. package/esm2020/src/model/form_array.mjs +7 -1
  27. package/esm2020/src/model/form_control.mjs +7 -1
  28. package/esm2020/src/model/form_group.mjs +13 -1
  29. package/esm2020/src/version.mjs +1 -1
  30. package/fesm2015/forms.mjs +235 -140
  31. package/fesm2015/forms.mjs.map +1 -1
  32. package/fesm2020/forms.mjs +233 -140
  33. package/fesm2020/forms.mjs.map +1 -1
  34. package/index.d.ts +88 -14
  35. package/package.json +5 -5
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.5
2
+ * @license Angular v15.0.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -523,6 +523,11 @@ export declare abstract class AbstractControl<TValue = any, TRawValue extends TV
523
523
  *
524
524
  * Calling `setErrors` also updates the validity of the parent control.
525
525
  *
526
+ * @param opts Configuration options that determine how the control propagates
527
+ * changes and emits events after the control errors are set.
528
+ * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
529
+ * observable emits an event after the errors are set.
530
+ *
526
531
  * @usageNotes
527
532
  *
528
533
  * ### Manually set the errors for a control
@@ -1027,6 +1032,14 @@ declare class BuiltInControlValueAccessor extends BaseControlValueAccessor {
1027
1032
  static ɵdir: i0.ɵɵDirectiveDeclaration<BuiltInControlValueAccessor, never, never, {}, {}, never, never, false, never>;
1028
1033
  }
1029
1034
 
1035
+ /**
1036
+ * Token to provide to allow SetDisabledState to always be called when a CVA is added, regardless of
1037
+ * whether the control is disabled or enabled.
1038
+ *
1039
+ * @see `FormsModule.withConfig`
1040
+ */
1041
+ declare const CALL_SET_DISABLED_STATE: InjectionToken<SetDisabledStateOption>;
1042
+
1030
1043
  /**
1031
1044
  * @description
1032
1045
  * Provider which adds `CheckboxRequiredValidator` to the `NG_VALIDATORS` multi-provider list.
@@ -2237,6 +2250,7 @@ declare const formControlBinding_2: any;
2237
2250
  */
2238
2251
  export declare class FormControlDirective extends NgControl implements OnChanges, OnDestroy {
2239
2252
  private _ngModelWarningConfig;
2253
+ private callSetDisabledState?;
2240
2254
  /**
2241
2255
  * Internal reference to the view model value.
2242
2256
  * @nodoc
@@ -2256,7 +2270,7 @@ export declare class FormControlDirective extends NgControl implements OnChanges
2256
2270
  model: any;
2257
2271
  /** @deprecated as of v6 */
2258
2272
  update: EventEmitter<any>;
2259
- constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null);
2273
+ constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null, callSetDisabledState?: SetDisabledStateOption | undefined);
2260
2274
  /** @nodoc */
2261
2275
  ngOnChanges(changes: SimpleChanges): void;
2262
2276
  /** @nodoc */
@@ -2280,7 +2294,7 @@ export declare class FormControlDirective extends NgControl implements OnChanges
2280
2294
  */
2281
2295
  viewToModelUpdate(newValue: any): void;
2282
2296
  private _isControlChanged;
2283
- static ɵfac: i0.ɵɵFactoryDeclaration<FormControlDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
2297
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormControlDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
2284
2298
  static ɵdir: i0.ɵɵDirectiveDeclaration<FormControlDirective, "[formControl]", ["ngForm"], { "form": "formControl"; "isDisabled": "disabled"; "model": "ngModel"; }, { "update": "ngModelChange"; }, never, never, false, never>;
2285
2299
  }
2286
2300
 
@@ -2811,6 +2825,7 @@ export declare class FormGroup<TControl extends {
2811
2825
  * @publicApi
2812
2826
  */
2813
2827
  export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
2828
+ private callSetDisabledState?;
2814
2829
  /**
2815
2830
  * @description
2816
2831
  * Reports whether the form submission has been triggered.
@@ -2841,7 +2856,7 @@ export declare class FormGroupDirective extends ControlContainer implements Form
2841
2856
  * Emits an event when the form submission has been triggered.
2842
2857
  */
2843
2858
  ngSubmit: EventEmitter<any>;
2844
- constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
2859
+ constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
2845
2860
  /** @nodoc */
2846
2861
  ngOnChanges(changes: SimpleChanges): void;
2847
2862
  /** @nodoc */
@@ -2956,7 +2971,7 @@ export declare class FormGroupDirective extends ControlContainer implements Form
2956
2971
  private _updateRegistrations;
2957
2972
  private _updateValidators;
2958
2973
  private _checkFormPresent;
2959
- static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupDirective, [{ optional: true; self: true; }, { optional: true; self: true; }]>;
2974
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupDirective, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
2960
2975
  static ɵdir: i0.ɵɵDirectiveDeclaration<FormGroupDirective, "[formGroup]", ["ngForm"], { "form": "formGroup"; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
2961
2976
  }
2962
2977
 
@@ -3148,6 +3163,17 @@ export declare interface FormRecord<TControl> {
3148
3163
  * @publicApi
3149
3164
  */
3150
3165
  export declare class FormsModule {
3166
+ /**
3167
+ * @description
3168
+ * Provides options for configuring the forms module.
3169
+ *
3170
+ * @param opts An object of configuration options
3171
+ * * `callSetDisabledState` Configures whether to `always` call `setDisabledState`, which is more
3172
+ * correct, or to only call it `whenDisabled`, which is the legacy behavior.
3173
+ */
3174
+ static withConfig(opts: {
3175
+ callSetDisabledState?: SetDisabledStateOption;
3176
+ }): ModuleWithProviders<ReactiveFormsModule>;
3151
3177
  static ɵfac: i0.ɵɵFactoryDeclaration<FormsModule, never>;
3152
3178
  static ɵmod: i0.ɵɵNgModuleDeclaration<FormsModule, [typeof i1_2.NgModel, typeof i2_2.NgModelGroup, typeof i3_2.NgForm], never, [typeof i4_2.ɵInternalFormsSharedModule, typeof i1_2.NgModel, typeof i2_2.NgModelGroup, typeof i3_2.NgForm]>;
3153
3179
  static ɵinj: i0.ɵɵInjectorDeclaration<FormsModule>;
@@ -3188,7 +3214,7 @@ declare namespace i10 {
3188
3214
 
3189
3215
  declare namespace i1_2 {
3190
3216
  export {
3191
- formControlBinding,
3217
+ formControlBinding_2 as formControlBinding,
3192
3218
  NgModel
3193
3219
  }
3194
3220
  }
@@ -3219,7 +3245,7 @@ declare namespace i3 {
3219
3245
 
3220
3246
  declare namespace i3_2 {
3221
3247
  export {
3222
- formDirectiveProvider,
3248
+ formDirectiveProvider_2 as formDirectiveProvider,
3223
3249
  NgForm
3224
3250
  }
3225
3251
  }
@@ -3256,6 +3282,7 @@ declare namespace i4_2 {
3256
3282
  SelectControlValueAccessor,
3257
3283
  ɵNgSelectMultipleOption as NgSelectMultipleOption,
3258
3284
  SelectMultipleControlValueAccessor,
3285
+ CALL_SET_DISABLED_STATE,
3259
3286
  SHARED_FORM_DIRECTIVES,
3260
3287
  TEMPLATE_DRIVEN_DIRECTIVES,
3261
3288
  REACTIVE_DRIVEN_DIRECTIVES,
@@ -3274,7 +3301,7 @@ declare namespace i5 {
3274
3301
  declare namespace i5_2 {
3275
3302
  export {
3276
3303
  NG_MODEL_WITH_FORM_CONTROL_WARNING,
3277
- formControlBinding_2 as formControlBinding,
3304
+ formControlBinding,
3278
3305
  FormControlDirective
3279
3306
  }
3280
3307
  }
@@ -3288,7 +3315,7 @@ declare namespace i6 {
3288
3315
 
3289
3316
  declare namespace i6_2 {
3290
3317
  export {
3291
- formDirectiveProvider_2 as formDirectiveProvider,
3318
+ formDirectiveProvider,
3292
3319
  FormGroupDirective
3293
3320
  }
3294
3321
  }
@@ -3335,6 +3362,38 @@ declare namespace i9 {
3335
3362
  }
3336
3363
  }
3337
3364
 
3365
+ /**
3366
+ * @description
3367
+ * Asserts that the given control is an instance of `FormArray`
3368
+ *
3369
+ * @publicApi
3370
+ */
3371
+ export declare const isFormArray: (control: unknown) => control is FormArray<any>;
3372
+
3373
+ /**
3374
+ * @description
3375
+ * Asserts that the given control is an instance of `FormControl`
3376
+ *
3377
+ * @publicApi
3378
+ */
3379
+ export declare const isFormControl: (control: unknown) => control is FormControl<any>;
3380
+
3381
+ /**
3382
+ * @description
3383
+ * Asserts that the given control is an instance of `FormGroup`
3384
+ *
3385
+ * @publicApi
3386
+ */
3387
+ export declare const isFormGroup: (control: unknown) => control is FormGroup<any>;
3388
+
3389
+ /**
3390
+ * @description
3391
+ * Asserts that the given control is an instance of `FormRecord`
3392
+ *
3393
+ * @publicApi
3394
+ */
3395
+ export declare const isFormRecord: (control: unknown) => control is FormRecord<AbstractControl<any, any>>;
3396
+
3338
3397
  /**
3339
3398
  * @description
3340
3399
  * Provider which adds `MaxLengthValidator` to the `NG_VALIDATORS` multi-provider list.
@@ -3709,6 +3768,7 @@ declare const ngControlStatusHost: {
3709
3768
  * @publicApi
3710
3769
  */
3711
3770
  export declare class NgForm extends ControlContainer implements Form, AfterViewInit {
3771
+ private callSetDisabledState?;
3712
3772
  /**
3713
3773
  * @description
3714
3774
  * Returns whether the form submission has been triggered.
@@ -3737,7 +3797,7 @@ export declare class NgForm extends ControlContainer implements Form, AfterViewI
3737
3797
  options: {
3738
3798
  updateOn?: FormHooks;
3739
3799
  };
3740
- constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
3800
+ constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
3741
3801
  /** @nodoc */
3742
3802
  ngAfterViewInit(): void;
3743
3803
  /**
@@ -3844,7 +3904,7 @@ export declare class NgForm extends ControlContainer implements Form, AfterViewI
3844
3904
  resetForm(value?: any): void;
3845
3905
  private _setUpdateStrategy;
3846
3906
  private _findContainer;
3847
- static ɵfac: i0.ɵɵFactoryDeclaration<NgForm, [{ optional: true; self: true; }, { optional: true; self: true; }]>;
3907
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgForm, [{ optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
3848
3908
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgForm, "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", ["ngForm"], { "options": "ngFormOptions"; }, { "ngSubmit": "ngSubmit"; }, never, never, false, never>;
3849
3909
  }
3850
3910
 
@@ -3946,6 +4006,7 @@ declare const ngGroupStatusHost: {
3946
4006
  */
3947
4007
  export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
3948
4008
  private _changeDetectorRef?;
4009
+ private callSetDisabledState?;
3949
4010
  readonly control: FormControl;
3950
4011
  /** @nodoc */
3951
4012
  static ngAcceptInputType_isDisabled: boolean | string;
@@ -3997,7 +4058,7 @@ export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
3997
4058
  * the view model updates.
3998
4059
  */
3999
4060
  update: EventEmitter<any>;
4000
- constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _changeDetectorRef?: ChangeDetectorRef | null | undefined);
4061
+ constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _changeDetectorRef?: ChangeDetectorRef | null | undefined, callSetDisabledState?: SetDisabledStateOption | undefined);
4001
4062
  /** @nodoc */
4002
4063
  ngOnChanges(changes: SimpleChanges): void;
4003
4064
  /** @nodoc */
@@ -4030,7 +4091,7 @@ export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
4030
4091
  private _updateValue;
4031
4092
  private _updateDisabled;
4032
4093
  private _getPath;
4033
- static ɵfac: i0.ɵɵFactoryDeclaration<NgModel, [{ optional: true; host: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }]>;
4094
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgModel, [{ optional: true; host: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
4034
4095
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgModel, "[ngModel]:not([formControlName]):not([formControl])", ["ngModel"], { "name": "name"; "isDisabled": "disabled"; "model": "ngModel"; "options": "ngModelOptions"; }, { "update": "ngModelChange"; }, never, never, false, never>;
4035
4096
  }
4036
4097
 
@@ -4416,9 +4477,12 @@ export declare class ReactiveFormsModule {
4416
4477
  * @param opts An object of configuration options
4417
4478
  * * `warnOnNgModelWithFormControl` Configures when to emit a warning when an `ngModel`
4418
4479
  * binding is used with reactive form directives.
4480
+ * * `callSetDisabledState` Configures whether to `always` call `setDisabledState`, which is more
4481
+ * correct, or to only call it `whenDisabled`, which is the legacy behavior.
4419
4482
  */
4420
4483
  static withConfig(opts: {
4421
- /** @deprecated as of v6 */ warnOnNgModelWithFormControl: 'never' | 'once' | 'always';
4484
+ /** @deprecated as of v6 */ warnOnNgModelWithFormControl?: 'never' | 'once' | 'always';
4485
+ callSetDisabledState?: SetDisabledStateOption;
4422
4486
  }): ModuleWithProviders<ReactiveFormsModule>;
4423
4487
  static ɵfac: i0.ɵɵFactoryDeclaration<ReactiveFormsModule, never>;
4424
4488
  static ɵmod: i0.ɵɵNgModuleDeclaration<ReactiveFormsModule, [typeof i5_2.FormControlDirective, typeof i6_2.FormGroupDirective, typeof i7_2.FormControlName, typeof i8_2.FormGroupName, typeof i8_2.FormArrayName], never, [typeof i4_2.ɵInternalFormsSharedModule, typeof i5_2.FormControlDirective, typeof i6_2.FormGroupDirective, typeof i7_2.FormControlName, typeof i8_2.FormGroupName, typeof i8_2.FormArrayName]>;
@@ -4609,6 +4673,16 @@ export declare class SelectMultipleControlValueAccessor extends BuiltInControlVa
4609
4673
  static ɵdir: i0.ɵɵDirectiveDeclaration<SelectMultipleControlValueAccessor, "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", never, { "compareWith": "compareWith"; }, {}, never, never, false, never>;
4610
4674
  }
4611
4675
 
4676
+ /**
4677
+ * The type for CALL_SET_DISABLED_STATE. If `always`, then ControlValueAccessor will always call
4678
+ * `setDisabledState` when attached, which is the most correct behavior. Otherwise, it will only be
4679
+ * called when disabled, which is the legacy behavior for compatibility.
4680
+ *
4681
+ * @publicApi
4682
+ * @see `FormsModule.withConfig`
4683
+ */
4684
+ export declare type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
4685
+
4612
4686
  declare const SHARED_FORM_DIRECTIVES: Type<any>[];
4613
4687
 
4614
4688
  declare const TEMPLATE_DRIVEN_DIRECTIVES: Type<any>[];
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@angular/forms",
3
- "version": "15.0.0-next.5",
3
+ "version": "15.0.0-rc.0",
4
4
  "description": "Angular - directives and services for creating forms",
5
5
  "author": "angular",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": "^14.15.0 || >=16.10.0"
8
+ "node": "^14.20.0 || ^16.13.0 || >=18.10.0"
9
9
  },
10
10
  "dependencies": {
11
11
  "tslib": "^2.3.0"
12
12
  },
13
13
  "peerDependencies": {
14
- "@angular/core": "15.0.0-next.5",
15
- "@angular/common": "15.0.0-next.5",
16
- "@angular/platform-browser": "15.0.0-next.5",
14
+ "@angular/core": "15.0.0-rc.0",
15
+ "@angular/common": "15.0.0-rc.0",
16
+ "@angular/platform-browser": "15.0.0-rc.0",
17
17
  "rxjs": "^6.5.3 || ^7.4.0"
18
18
  },
19
19
  "repository": {