@angular/forms 14.1.3 → 14.2.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 (30) 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 +3 -3
  7. package/esm2020/src/directives/ng_model.mjs +3 -3
  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 +3 -3
  14. package/esm2020/src/directives/reactive_directives/form_control_name.mjs +3 -3
  15. package/esm2020/src/directives/reactive_directives/form_group_directive.mjs +3 -3
  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/validators.mjs +27 -27
  20. package/esm2020/src/directives.mjs +4 -4
  21. package/esm2020/src/form_builder.mjs +31 -11
  22. package/esm2020/src/form_providers.mjs +8 -8
  23. package/esm2020/src/model/form_group.mjs +1 -1
  24. package/esm2020/src/version.mjs +1 -1
  25. package/fesm2015/forms.mjs +146 -126
  26. package/fesm2015/forms.mjs.map +1 -1
  27. package/fesm2020/forms.mjs +146 -126
  28. package/fesm2020/forms.mjs.map +1 -1
  29. package/index.d.ts +48 -5
  30. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.1.3
2
+ * @license Angular v14.2.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1915,6 +1915,24 @@ export declare class FormBuilder {
1915
1915
  }, options: {
1916
1916
  [key: string]: any;
1917
1917
  }): FormGroup;
1918
+ /**
1919
+ * @description
1920
+ * Construct a new `FormRecord` instance. Accepts a single generic argument, which is an object
1921
+ * containing all the keys and corresponding inner control types.
1922
+ *
1923
+ * @param controls A collection of child controls. The key for each child is the name
1924
+ * under which it is registered.
1925
+ *
1926
+ * @param options Configuration options object for the `FormRecord`. The object should have the
1927
+ * `AbstractControlOptions` type and might contain the following fields:
1928
+ * * `validators`: A synchronous validator function, or an array of validator functions.
1929
+ * * `asyncValidators`: A single async validator or array of async validator functions.
1930
+ * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur'
1931
+ * | submit').
1932
+ */
1933
+ record<T>(controls: {
1934
+ [key: string]: T;
1935
+ }, options?: AbstractControlOptions | null): FormRecord<ɵElement<T, null>>;
1918
1936
  /** @deprecated Use `nonNullable` instead. */
1919
1937
  control<T>(formState: T | FormControlState<T>, opts: FormControlOptions & {
1920
1938
  initialValueIsDefault: true;
@@ -3030,7 +3048,7 @@ declare type FormHooks = 'change' | 'blur' | 'submit';
3030
3048
  *
3031
3049
  * @publicApi
3032
3050
  */
3033
- export declare class FormRecord<TControl extends AbstractControl<ɵValue<TControl>, ɵRawValue<TControl>> = AbstractControl> extends FormGroup<{
3051
+ export declare class FormRecord<TControl extends AbstractControl = AbstractControl> extends FormGroup<{
3034
3052
  [key: string]: TControl;
3035
3053
  }> {
3036
3054
  }
@@ -4110,6 +4128,14 @@ export declare abstract class NonNullableFormBuilder {
4110
4128
  abstract group<T extends {}>(controls: T, options?: AbstractControlOptions | null): FormGroup<{
4111
4129
  [K in keyof T]: ɵElement<T[K], never>;
4112
4130
  }>;
4131
+ /**
4132
+ * Similar to `FormBuilder#record`, except any implicitly constructed `FormControl`
4133
+ * will be non-nullable (i.e. it will have `nonNullable` set to true). Note
4134
+ * that already-constructed controls will not be altered.
4135
+ */
4136
+ abstract record<T>(controls: {
4137
+ [key: string]: T;
4138
+ }, options?: AbstractControlOptions | null): FormRecord<ɵElement<T, never>>;
4113
4139
  /**
4114
4140
  * Similar to `FormBuilder#array`, except any implicitly constructed `FormControl`
4115
4141
  * will be non-nullable (i.e. it will have `nonNullable` set to true). Note
@@ -4205,6 +4231,16 @@ export declare class PatternValidator extends AbstractValidatorDirective {
4205
4231
  static ɵdir: i0.ɵɵDirectiveDeclaration<PatternValidator, "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", never, { "pattern": "pattern"; }, {}, never, never, false>;
4206
4232
  }
4207
4233
 
4234
+ /**
4235
+ * The compiler may not always be able to prove that the elements of the control config are a tuple
4236
+ * (i.e. occur in a fixed order). This slightly looser type is used for inference, to catch cases
4237
+ * where the compiler cannot prove order and position.
4238
+ *
4239
+ * For example, consider the simple case `fb.group({foo: ['bar', Validators.required]})`. The
4240
+ * compiler will infer this as an array, not as a tuple.
4241
+ */
4242
+ declare type PermissiveControlConfig<T> = Array<T | FormControlState<T> | ValidatorConfig>;
4243
+
4208
4244
  declare const RADIO_VALUE_ACCESSOR: any;
4209
4245
 
4210
4246
  /**
@@ -4717,6 +4753,11 @@ export declare interface Validator {
4717
4753
  registerOnValidatorChange?(fn: () => void): void;
4718
4754
  }
4719
4755
 
4756
+ /**
4757
+ * The union of all validator types that can be accepted by a ControlConfig.
4758
+ */
4759
+ declare type ValidatorConfig = ValidatorFn | AsyncValidatorFn | ValidatorFn[] | AsyncValidatorFn[];
4760
+
4720
4761
  /**
4721
4762
  * @description
4722
4763
  * A function that receives a control and synchronously returns a map of
@@ -5038,6 +5079,10 @@ T
5038
5079
  T
5039
5080
  ] extends [FormGroup<infer U> | undefined] ? FormGroup<U> : [
5040
5081
  T
5082
+ ] extends [FormRecord<infer U>] ? FormRecord<U> : [
5083
+ T
5084
+ ] extends [FormRecord<infer U> | undefined] ? FormRecord<U> : [
5085
+ T
5041
5086
  ] extends [FormArray<infer U>] ? FormArray<U> : [
5042
5087
  T
5043
5088
  ] extends [FormArray<infer U> | undefined] ? FormArray<U> : [
@@ -5048,9 +5093,7 @@ T
5048
5093
  T
5049
5094
  ] extends [FormControlState<infer U>] ? FormControl<U | N> : [
5050
5095
  T
5051
- ] extends [ControlConfig<infer U>] ? FormControl<U | N> : [
5052
- T
5053
- ] extends [Array<infer U | ValidatorFn | ValidatorFn[] | AsyncValidatorFn | AsyncValidatorFn[]>] ? FormControl<U | N> : FormControl<T | N>;
5096
+ ] extends [PermissiveControlConfig<infer U>] ? FormControl<Exclude<U, ValidatorConfig> | N> : FormControl<T | N>;
5054
5097
 
5055
5098
  /**
5056
5099
  * FormArrayRawValue extracts the type of `.getRawValue()` from a FormArray's element type, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/forms",
3
- "version": "14.1.3",
3
+ "version": "14.2.0-rc.0",
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": "14.1.3",
15
- "@angular/common": "14.1.3",
16
- "@angular/platform-browser": "14.1.3",
14
+ "@angular/core": "14.2.0-rc.0",
15
+ "@angular/common": "14.2.0-rc.0",
16
+ "@angular/platform-browser": "14.2.0-rc.0",
17
17
  "rxjs": "^6.5.3 || ^7.4.0"
18
18
  },
19
19
  "repository": {