@angular/forms 22.0.0-next.4 → 22.0.0-next.5

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": "22.0.0-next.4",
3
+ "version": "22.0.0-next.5",
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": "22.0.0-next.4",
16
- "@angular/common": "22.0.0-next.4",
17
- "@angular/platform-browser": "22.0.0-next.4",
15
+ "@angular/core": "22.0.0-next.5",
16
+ "@angular/common": "22.0.0-next.5",
17
+ "@angular/platform-browser": "22.0.0-next.5",
18
18
  "rxjs": "^6.5.3 || ^7.4.0"
19
19
  },
20
20
  "repository": {
Binary file
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v22.0.0-next.4
2
+ * @license Angular v22.0.0-next.5
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -49,7 +49,7 @@ interface FormSubmitOptions<TRootModel, TSubmittedModel> {
49
49
  * Whether to ignore any of the validators when submitting:
50
50
  * - 'pending': Will submit if there are no invalid validators, pending validators do not block submission (default)
51
51
  * - 'none': Will not submit unless all validators are passing, pending validators block submission
52
- * - 'ignore': Will always submit regardless of invalid or pending validators
52
+ * - 'all': Will always submit regardless of invalid or pending validators
53
53
  */
54
54
  ignoreValidators?: 'pending' | 'none' | 'all';
55
55
  }
@@ -276,25 +276,25 @@ interface ReadonlyFieldState<TValue, TKey extends string | number = string | num
276
276
  *
277
277
  * Applies to `<input>` with a numeric or date `type` attribute and custom controls.
278
278
  */
279
- readonly max?: Signal<number | undefined>;
279
+ readonly max: Signal<number | undefined> | undefined;
280
280
  /**
281
281
  * A signal indicating the field's maximum string length, if applicable.
282
282
  *
283
283
  * Applies to `<input>`, `<textarea>`, and custom controls.
284
284
  */
285
- readonly maxLength?: Signal<number | undefined>;
285
+ readonly maxLength: Signal<number | undefined> | undefined;
286
286
  /**
287
287
  * A signal indicating the field's minimum value, if applicable.
288
288
  *
289
289
  * Applies to `<input>` with a numeric or date `type` attribute and custom controls.
290
290
  */
291
- readonly min?: Signal<number | undefined>;
291
+ readonly min: Signal<number | undefined> | undefined;
292
292
  /**
293
293
  * A signal indicating the field's minimum string length, if applicable.
294
294
  *
295
295
  * Applies to `<input>`, `<textarea>`, and custom controls.
296
296
  */
297
- readonly minLength?: Signal<number | undefined>;
297
+ readonly minLength: Signal<number | undefined> | undefined;
298
298
  /**
299
299
  * A signal of a unique name for the field, by default based on the name of its parent field.
300
300
  */
@@ -437,6 +437,16 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
437
437
  * @param options Options for marking the field as touched.
438
438
  */
439
439
  markAsTouched(options?: MarkAsTouchedOptions): void;
440
+ /**
441
+ * Gets the first validation error of the given kind on this field.
442
+ *
443
+ * This method is reactive and will re-evaluate when the field's errors change if called
444
+ * within a reactive context (e.g. `computed` or `effect`).
445
+ *
446
+ * @param kind The kind of error (e.g. 'required', 'min').
447
+ * @returns The first matching error, or `undefined` if none.
448
+ */
449
+ getError(kind: string): ValidationError.WithFieldTree | undefined;
440
450
  /**
441
451
  * Resets the {@link touched} and {@link dirty} state of the field and its descendants.
442
452
  *
@@ -445,6 +455,10 @@ interface FieldState<TValue, TKey extends string | number = string | number> ext
445
455
  * @param value Optional value to set to the form. If not passed, the value will not be changed.
446
456
  */
447
457
  reset(value?: TValue): void;
458
+ /**
459
+ * Reloads all asynchronous validators for this field and its descendants.
460
+ */
461
+ reloadValidation(): void;
448
462
  }
449
463
  /**
450
464
  * This is FieldState also providing access to the wrapped FormControl.
@@ -805,6 +819,13 @@ declare const MetadataReducer: {
805
819
  };
806
820
  declare function override<T>(): MetadataReducer<T | undefined, T>;
807
821
  declare function override<T>(getInitial: () => T): MetadataReducer<T, T>;
822
+ /**
823
+ * A symbol used to tag a `MetadataKey` as representing an asynchronous validation resource.
824
+ *
825
+ * @category validation
826
+ * @experimental 21.0.0
827
+ */
828
+ declare const IS_ASYNC_VALIDATION_RESOURCE: unique symbol;
808
829
  /**
809
830
  * Represents metadata that is aggregated from multiple parts according to the key's reducer
810
831
  * function. A value can be contributed to the aggregated value for a field using an
@@ -819,10 +840,10 @@ declare function override<T>(getInitial: () => T): MetadataReducer<T, T>;
819
840
  */
820
841
  declare class MetadataKey<TRead, TWrite, TAcc> {
821
842
  readonly reducer: MetadataReducer<TAcc, TWrite>;
822
- readonly create: ((s: Signal<TAcc>) => TRead) | undefined;
843
+ readonly create: ((state: FieldState<unknown>, data: Signal<TAcc>) => TRead) | undefined;
823
844
  private brand;
824
845
  /** Use {@link reducedMetadataKey}. */
825
- protected constructor(reducer: MetadataReducer<TAcc, TWrite>, create: ((s: Signal<TAcc>) => TRead) | undefined);
846
+ protected constructor(reducer: MetadataReducer<TAcc, TWrite>, create: ((state: FieldState<unknown>, data: Signal<TAcc>) => TRead) | undefined);
826
847
  }
827
848
  /**
828
849
  * Extracts the the type that can be set into the given metadata key type using the `metadata()` rule.
@@ -864,7 +885,7 @@ declare function createMetadataKey<TWrite, TAcc>(reducer: MetadataReducer<TAcc,
864
885
  *
865
886
  * @experimental 21.0.0
866
887
  */
867
- declare function createManagedMetadataKey<TRead, TWrite>(create: (s: Signal<TWrite | undefined>) => TRead): MetadataKey<TRead, TWrite, TWrite | undefined>;
888
+ declare function createManagedMetadataKey<TRead, TWrite>(create: (state: FieldState<unknown>, data: Signal<TWrite | undefined>) => TRead): MetadataKey<TRead, TWrite, TWrite | undefined>;
868
889
  /**
869
890
  * Creates a metadata key that exposes a managed value based on the accumulated result of the values
870
891
  * written to the key.
@@ -880,7 +901,7 @@ declare function createManagedMetadataKey<TRead, TWrite>(create: (s: Signal<TWri
880
901
  *
881
902
  * @experimental 21.0.0
882
903
  */
883
- declare function createManagedMetadataKey<TRead, TWrite, TAcc>(create: (s: Signal<TAcc>) => TRead, reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<TRead, TWrite, TAcc>;
904
+ declare function createManagedMetadataKey<TRead, TWrite, TAcc>(create: (state: FieldState<unknown>, data: Signal<TAcc>) => TRead, reducer: MetadataReducer<TAcc, TWrite>): MetadataKey<TRead, TWrite, TAcc>;
884
905
  /**
885
906
  * A {@link MetadataKey} representing whether the field is required.
886
907
  *
@@ -1103,6 +1124,7 @@ declare class FormField<T> {
1103
1124
  /** Any `ControlValueAccessor` instances provided on the host element. */
1104
1125
  private readonly controlValueAccessors;
1105
1126
  private readonly config;
1127
+ private readonly validityMonitor;
1106
1128
  private readonly parseErrorsSource;
1107
1129
  /** A lazily instantiated fake `NgControl`. */
1108
1130
  private _interopNgControl;
@@ -1775,5 +1797,5 @@ declare function submit<TModel>(form: FieldTree<TModel>, action: NoInfer<FormSub
1775
1797
  */
1776
1798
  declare function schema<TValue>(fn: SchemaFn<TValue>): Schema<TValue>;
1777
1799
 
1778
- export { BaseNgValidationError, EmailValidationError, FORM_FIELD, FormField, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MetadataKey, MetadataReducer, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PathKind, PatternValidationError, REQUIRED, RequiredValidationError, SchemaPathRules, StandardSchemaValidationError, ValidationError, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit, validateStandardSchema, ɵNgFieldDirective };
1800
+ export { BaseNgValidationError, EmailValidationError, FORM_FIELD, FormField, IS_ASYNC_VALIDATION_RESOURCE, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MetadataKey, MetadataReducer, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PathKind, PatternValidationError, REQUIRED, RequiredValidationError, SchemaPathRules, StandardSchemaValidationError, ValidationError, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit, validateStandardSchema, ɵNgFieldDirective };
1779
1801
  export type { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, Debouncer, DisabledReason, Field, FieldContext, FieldState, FieldStateByMode, FieldTree, FieldValidator, FormFieldBinding, FormFieldBindingOptions, FormOptions, FormSubmitOptions, IgnoreUnknownProperties, ItemFieldContext, ItemType, LogicFn, MarkAsTouchedOptions, MaybeFieldTree, MaybeSchemaPathTree, MetadataSetterType, OneOrMany, ReadonlyArrayLike, ReadonlyCompatFieldState, ReadonlyFieldState, ReadonlyFieldTree, RemoveStringIndexUnknownKey, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPath, SchemaPathTree, SignalFormsConfig, Subfields, TreeValidationResult, TreeValidator, ValidationErrorOptions, ValidationResult, ValidationSuccess, Validator, WithFieldTree, WithOptionalFieldTree, WithoutFieldTree };
package/types/forms.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v22.0.0-next.4
2
+ * @license Angular v22.0.0-next.5
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 v22.0.0-next.4
2
+ * @license Angular v22.0.0-next.5
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Angular v22.0.0-next.4
2
+ * @license Angular v22.0.0-next.5
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, ResourceRef, InputSignal, InputSignalWithTransform, OutputRef, ModelSignal, WritableSignal } from '@angular/core';
8
+ import { DebounceTimer, Signal, ResourceRef, InputSignal, InputSignalWithTransform, OutputRef, ModelSignal, WritableSignal } from '@angular/core';
9
9
  import { PathKind, SchemaPath, SchemaPathRules, LogicFn, OneOrMany, ValidationError, FieldValidator, FieldContext, TreeValidationResult, TreeValidator, WithOptionalFieldTree, DisabledReason, Debouncer, FieldTree } from './_structure-chunk.js';
10
- export { AsyncValidationResult, BaseNgValidationError, ChildFieldContext, CompatFieldState, CompatSchemaPath, EmailValidationError, FORM_FIELD, Field, FieldState, FieldStateByMode, FormField, FormFieldBinding, FormFieldBindingOptions, FormOptions, FormSubmitOptions, IgnoreUnknownProperties, ItemFieldContext, ItemType, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MarkAsTouchedOptions, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, ReadonlyCompatFieldState, ReadonlyFieldState, ReadonlyFieldTree, RemoveStringIndexUnknownKey, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPathTree, SignalFormsConfig, StandardSchemaValidationError, Subfields, ValidationErrorOptions, ValidationResult, ValidationSuccess, Validator, WithFieldTree, WithoutFieldTree, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit, validateStandardSchema, ɵNgFieldDirective } from './_structure-chunk.js';
10
+ export { AsyncValidationResult, BaseNgValidationError, ChildFieldContext, CompatFieldState, CompatSchemaPath, EmailValidationError, FORM_FIELD, Field, FieldState, FieldStateByMode, FormField, FormFieldBinding, FormFieldBindingOptions, FormOptions, FormSubmitOptions, IS_ASYNC_VALIDATION_RESOURCE, IgnoreUnknownProperties, ItemFieldContext, ItemType, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MarkAsTouchedOptions, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, ReadonlyCompatFieldState, ReadonlyFieldState, ReadonlyFieldTree, RemoveStringIndexUnknownKey, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPathTree, SignalFormsConfig, StandardSchemaValidationError, Subfields, ValidationErrorOptions, ValidationResult, ValidationSuccess, Validator, WithFieldTree, WithoutFieldTree, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit, validateStandardSchema, ɵNgFieldDirective } from './_structure-chunk.js';
11
11
  import { HttpResourceRequest, HttpResourceOptions } from '@angular/common/http';
12
12
  import '@angular/forms';
13
13
  import '@standard-schema/spec';
@@ -267,6 +267,11 @@ interface AsyncValidatorOptions<TValue, TParams, TResult, TPathKind extends Path
267
267
  * @returns The params for the resource.
268
268
  */
269
269
  readonly params: (ctx: FieldContext<TValue, TPathKind>) => TParams;
270
+ /**
271
+ * Duration in milliseconds to wait before triggering the async operation, or a function that
272
+ * returns a promise that resolves when the update should proceed.
273
+ */
274
+ readonly debounce?: DebounceTimer<TParams | undefined>;
270
275
  /**
271
276
  * A function that receives the resource params and returns a resource of the given params.
272
277
  * The given params should be used as is to create the resource.
@@ -352,6 +357,11 @@ interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKind = Pat
352
357
  * The options to use when creating the httpResource.
353
358
  */
354
359
  readonly options?: HttpResourceOptions<TResult, unknown>;
360
+ /**
361
+ * Duration in milliseconds to wait before triggering the async operation, or a function that
362
+ * returns a promise that resolves when the update should proceed.
363
+ */
364
+ readonly debounce?: DebounceTimer<string | HttpResourceRequest | undefined>;
355
365
  }
356
366
  /**
357
367
  * Adds async validation to the field corresponding to the given path based on an httpResource.
@@ -644,7 +654,7 @@ declare function transformedValue<TValue, TRaw>(value: ModelSignal<TValue>, opti
644
654
  * It automatically:
645
655
  * 1. Sets `novalidate` on the form element to disable browser validation.
646
656
  * 2. Listens for the `submit` event, prevents the default behavior, and calls `submit()` on the
647
- * `FieldTree`.
657
+ * `FieldTree` if it defines its own submission options.
648
658
  *
649
659
  * @usageNotes
650
660
  *