docs: add @see references to Signal Forms

This commit is contained in:
SkyZeroZx
2026-06-30 21:53:07 -05:00
committed by Leon Senft
parent cbbb1d8ba1
commit bbbcf8fc7f
22 changed files with 262 additions and 0 deletions
@@ -15,6 +15,8 @@ import {CompatFieldAdapter} from '../compat_field_adapter';
/**
* Options that may be specified when creating a compat form.
*
* @see [Top-down migration using compatForm](guide/forms/signals/migration#top-down-migration-using-compatform)
*
* @category interop
* @publicApi 22.0
*/
@@ -46,6 +48,8 @@ export type CompatFormOptions<TModel> = Omit<FormOptions<TModel>, 'adapter'>;
* structure will match the shape of the model and any changes to the form data will be written to
* the model.
*
* @see [Top-down migration using compatForm](guide/forms/signals/migration#top-down-migration-using-compatform)
*
* @category interop
* @publicApi 22.0
*/
@@ -80,6 +84,8 @@ export function compatForm<TModel>(model: WritableSignal<TModel>): FieldTree<TMo
* When passing a schema, the form options can be passed as a third argument if needed.
* 2. The form options (excluding adapter, since it's provided).
*
* @see [Top-down migration using compatForm](guide/forms/signals/migration#top-down-migration-using-compatform)
*
* @category interop
* @publicApi 22.0
*/
@@ -116,6 +122,8 @@ export function compatForm<TModel>(
* When passing a schema, the form options can be passed as a third argument if needed.
* @param options The form options (excluding adapter, since it's provided).
*
* @see [Top-down migration using compatForm](guide/forms/signals/migration#top-down-migration-using-compatform)
*
* @category interop
* @publicApi 22.0
*/
@@ -12,6 +12,8 @@ import type {SignalFormsConfig} from '../../../src/api/di';
* A value that can be used for `SignalFormsConfig.classes` to automatically add
* the `ng-*` status classes from reactive forms.
*
* @see [Automatic status classes](guide/forms/signals/migration#automatic-status-classes)
*
* @publicApi 22.0
*/
export const NG_STATUS_CLASSES: SignalFormsConfig['classes'] = {
@@ -77,6 +77,8 @@ export type ValueUpdateOptions = {
* </form>
* ```
*
* @see [Binding SignalFormControl](guide/forms/signals/migration#binding-signalformcontrol)
*
* @publicApi 22.0
*/
export class SignalFormControl<T> extends AbstractControl {
@@ -14,6 +14,8 @@ import type {DisabledReason} from './types';
/**
* The base set of properties shared by all form control contracts.
*
* @see [Custom form controls](guide/forms/signals/custom-controls)
*
* @category control
* @publicApi 22.0
*/
@@ -150,6 +152,8 @@ type FormUiControlImplementsFormFieldBindingOptions = Check<
*
* @template TValue The type of `FieldTree` that the implementing component can edit.
*
* @see [Custom form controls](guide/forms/signals/custom-controls)
*
* @category control
* @publicApi 22.0
*/
@@ -179,6 +183,8 @@ export interface FormValueControl<TValue> extends FormUiControl<TValue> {
* implemented, but if they are will be kept in sync with the field state of the field bound to the
* `Field` directive.
*
* @see [Custom form controls](guide/forms/signals/custom-controls)
*
* @category control
* @publicApi 22.0
*/
+4
View File
@@ -13,6 +13,8 @@ import {SIGNAL_FORMS_CONFIG} from '../field/di';
/**
* Configuration options for signal forms.
*
* @see [Automatic status classes](guide/forms/signals/migration#automatic-status-classes)
*
* @publicApi 22.0
*/
export interface SignalFormsConfig {
@@ -25,6 +27,8 @@ export interface SignalFormsConfig {
/**
* Provides configuration options for signal forms.
*
* @see [Automatic status classes](guide/forms/signals/migration#automatic-status-classes)
*
* @publicApi 22.0
*/
export function provideSignalFormsConfig(config: SignalFormsConfig): Provider[] {
@@ -21,6 +21,7 @@ import type {Debouncer, PathKind, SchemaPath, SchemaPathRules} from '../types';
* @param config A debounce configuration, which can be either a debounce duration in milliseconds,
* `'blur'` to debounce until the field is blurred, or a custom {@link Debouncer} function.
*
* @see [Debouncing form updates](guide/forms/signals/form-logic#delay-input-operations-with-debounce)
* @see [Custom form controls](guide/forms/signals/custom-controls) for using `debounce('blur')` with
* a custom `FormValueControl`.
*
@@ -21,6 +21,9 @@ import type {FieldContext, LogicFn, PathKind, SchemaPath, SchemaPathRules} from
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @see [Disabled fields](guide/forms/signals/form-logic#prevent-field-updates-with-disabled)
* @see [Availability state](guide/forms/signals/field-state-management#availability-state)
*
* @category logic
* @publicApi 22.0
*/
@@ -28,6 +28,9 @@ import type {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @see [Hidden fields](guide/forms/signals/form-logic#configuring-hidden-state-on-fields)
* @see [Availability state](guide/forms/signals/field-state-management#availability-state)
*
* @category logic
* @publicApi 22.0
*/
@@ -24,6 +24,9 @@ import type {FieldState, LogicFn, PathKind, SchemaPath, SchemaPathRules} from '.
* @template TKey The type of metadata key.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @see [Field metadata](guide/forms/signals/field-metadata)
* @see [Setting values from a schema](guide/forms/signals/field-metadata#setting-values-from-a-schema)
*
* @category logic
* @publicApi 22.0
*/
@@ -55,6 +58,9 @@ export function metadata<
*
* @template TAcc The accumulated type of the reduce operation.
* @template TItem The type of the individual items that are reduced over.
*
* @see [Combining contributions with reducers](guide/forms/signals/field-metadata#combining-contributions-with-reducers)
*
* @publicApi 22.0
*/
export interface MetadataReducer<TAcc, TItem> {
@@ -130,6 +136,8 @@ function override<T>(getInitial?: () => T): MetadataReducer<T | undefined, T> {
/**
* A symbol used to tag a `MetadataKey` as representing an asynchronous validation resource.
*
* @see [Async validation](guide/forms/signals/validation#async-validation)
*
* @category validation
* @publicApi 22.0
*/
@@ -145,6 +153,8 @@ export const IS_ASYNC_VALIDATION_RESOURCE: unique symbol = Symbol('IS_ASYNC_VALI
* @template TWrite The type written to this key using the `metadata()` rule
* @template TAcc The type of the reducer's accumulated value.
*
* @see [Field metadata](guide/forms/signals/field-metadata)
*
* @publicApi 22.0
*/
export class MetadataKey<TRead, TWrite, TAcc> {
@@ -164,6 +174,9 @@ export class MetadataKey<TRead, TWrite, TAcc> {
* Represents metadata that is used to define a valid limit for a field.
*
* @template TLimit The type the limit value.
*
* @see [Validation constraints](guide/forms/signals/custom-controls#validation-constraints)
*
* @publicApi 22.0
*/
export type LimitKey<TLimit> = MetadataKey<
@@ -183,6 +196,8 @@ declare const LIMIT_SELECTION_KEY: unique symbol;
* This indirection allows rules to bind a {@link LimitKey} of a specific limit type (e.g. `number`
* or `Date`) matching the field's type to a generic {@link MetadataKey}.
*
* @see [Validation constraints](guide/forms/signals/custom-controls#validation-constraints)
*
* @publicApi 22.0
*/
export type LimitSelectionKey = MetadataKey<
@@ -198,6 +213,8 @@ export type LimitSelectionKey = MetadataKey<
*
* @template TKey The `MetadataKey` type
*
* @see [Field metadata](guide/forms/signals/field-metadata)
*
* @publicApi 22.0
*/
export type MetadataSetterType<TKey> =
@@ -209,6 +226,8 @@ export type MetadataSetterType<TKey> =
*
* @template TWrite The type written to this key using the `metadata()` rule
*
* @see [Creating a metadata key](guide/forms/signals/field-metadata#creating-a-metadata-key)
*
* @publicApi 22.0
*/
export function createMetadataKey<TWrite>(): MetadataKey<
@@ -223,6 +242,8 @@ export function createMetadataKey<TWrite>(): MetadataKey<
* @template TWrite The type written to this key using the `metadata()` rule
* @template TAcc The type of the reducer's accumulated value.
*
* @see [Creating a metadata key](guide/forms/signals/field-metadata#creating-a-metadata-key)
*
* @publicApi 22.0
*/
export function createMetadataKey<TWrite, TAcc>(
@@ -247,6 +268,8 @@ export function createMetadataKey<TWrite, TAcc>(
* @template TRead The type read from the `FieldState` for this key
* @template TWrite The type written to this key using the `metadata()` rule
*
* @see [Attaching lifecycle-aware objects with managed metadata](guide/forms/signals/field-metadata#attaching-lifecycle-aware-objects-with-managed-metadata)
*
* @publicApi 22.0
*/
export function createManagedMetadataKey<TRead, TWrite>(
@@ -265,6 +288,8 @@ export function createManagedMetadataKey<TRead, TWrite>(
* @template TWrite The type written to this key using the `metadata()` rule
* @template TAcc The type of the reducer's accumulated value.
*
* @see [Attaching lifecycle-aware objects with managed metadata](guide/forms/signals/field-metadata#attaching-lifecycle-aware-objects-with-managed-metadata)
*
* @publicApi 22.0
*/
export function createManagedMetadataKey<TRead, TWrite, TAcc>(
@@ -284,6 +309,8 @@ export function createManagedMetadataKey<TRead, TWrite, TAcc>(
/**
* Creates a {@link LimitSelectionKey}.
*
* @see [Validation constraints](guide/forms/signals/custom-controls#validation-constraints)
*
* @publicApi 22.0
*/
export function createLimitSelectionKey(): LimitSelectionKey {
@@ -293,6 +320,8 @@ export function createLimitSelectionKey(): LimitSelectionKey {
/**
* A {@link MetadataKey} representing whether the field is required.
*
* @see [Required validation](guide/forms/signals/validation#required)
*
* @category validation
* @publicApi 22.0
*/
@@ -306,6 +335,8 @@ export const REQUIRED: MetadataKey<Signal<boolean>, boolean, boolean> = createMe
* This indirection allows different keys to be used for different types of values with their
* own reducers, such as {@link MIN_DATE} and {@link MIN_NUMBER}.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -314,6 +345,8 @@ export const MIN: LimitSelectionKey = createLimitSelectionKey();
/**
* A {@link MetadataKey} representing the minimum valid value of a date field.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -322,6 +355,8 @@ export const MIN_DATE: LimitKey<Date> = createMetadataKey(MetadataReducer.max())
/**
* A {@link MetadataKey} representing the minimum valid value of a number field.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -333,6 +368,8 @@ export const MIN_NUMBER: LimitKey<number> = createMetadataKey(MetadataReducer.ma
* This indirection allows different keys to be used for different types of values with their
* own reducers, such as {@link MAX_DATE} and {@link MAX_NUMBER}.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -341,6 +378,8 @@ export const MAX: LimitSelectionKey = createLimitSelectionKey();
/**
* A {@link MetadataKey} representing the maximum valid value of a date field.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -349,6 +388,8 @@ export const MAX_DATE: LimitKey<Date> = createMetadataKey(MetadataReducer.min())
/**
* A {@link MetadataKey} representing the maximum valid value of a number field.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -357,6 +398,8 @@ export const MAX_NUMBER: LimitKey<number> = createMetadataKey(MetadataReducer.mi
/**
* A {@link MetadataKey} representing the min length of the field.
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -365,6 +408,8 @@ export const MIN_LENGTH: LimitKey<number> = createMetadataKey(MetadataReducer.ma
/**
* A {@link MetadataKey} representing the max length of the field.
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -373,6 +418,8 @@ export const MAX_LENGTH: LimitKey<number> = createMetadataKey(MetadataReducer.mi
/**
* A {@link MetadataKey} representing the patterns the field must match.
*
* @see [Pattern validation](guide/forms/signals/validation#pattern)
*
* @category validation
* @publicApi 22.0
*/
@@ -20,6 +20,9 @@ import type {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @see [Readonly fields](guide/forms/signals/form-logic#display-uneditable-fields-with-readonly)
* @see [Availability state](guide/forms/signals/field-state-management#availability-state)
*
* @category logic
* @publicApi 22.0
*/
@@ -26,6 +26,8 @@ import {
* i.e. `{[key: string]: unknown}`. It allows specific string keys to pass through, even if their
* value is `unknown`, e.g. `{key: unknown}`.
*
* @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)
*
* @publicApi 22.0
*/
export type RemoveStringIndexUnknownKey<K, V> = string extends K
@@ -39,6 +41,8 @@ export type RemoveStringIndexUnknownKey<K, V> = string extends K
* We use this on the `TSchema` type in `validateStandardSchema` in order to accommodate Zod's
* `looseObject` which includes `{[key: string]: unknown}` as part of the type.
*
* @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)
*
* @publicApi 22.0
*/
export type IgnoreUnknownProperties<T> =
@@ -125,6 +129,8 @@ export function validateStandardSchema<TSchema, TModel extends IgnoreUnknownProp
* @param issue The standard schema issue
* @param options The validation error options
*
* @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)
*
* @category validation
* @publicApi 22.0
*/
@@ -137,6 +143,8 @@ export function standardSchemaError(
* @param issue The standard schema issue
* @param options The optional validation error options
*
* @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)
*
* @category validation
* @publicApi 22.0
*/
@@ -173,6 +181,8 @@ function standardIssueToFormTreeError(
/**
* An error used to indicate an issue validating against a standard schema.
*
* @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)
*
* @category validation
* @publicApi 22.0
*/
@@ -25,6 +25,8 @@ import type {
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @see [Custom validation rules](guide/forms/signals/validation#using-validate)
*
* @category logic
* @publicApi 22.0
*/
@@ -50,7 +50,10 @@ export type MapToErrorsFn<TValue, TResult, TPathKind extends PathKind = PathKind
* @template TParams The type of parameters to the resource.
* @template TResult The type of result returned by the resource
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
* @see [Custom async validation](guide/forms/signals/async-operations#custom-async-validation-with-validateasync)
*
* @category validation
* @publicApi 22.0
*/
@@ -118,6 +121,7 @@ export interface AsyncValidatorOptions<
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
* @see [Custom async validation](guide/forms/signals/async-operations#custom-async-validation-with-validateasync)
* @category validation
* @publicApi 22.0
*/
@@ -26,6 +26,9 @@ import {MapToErrorsFn, validateAsync} from './validate_async';
* @template TResult The type of result returned by the httpResource
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @see [HTTP validation with validateHttp](guide/forms/signals/async-operations#http-validation-with-validatehttp)
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
*
* @category validation
* @publicApi 22.0
*/
@@ -86,6 +89,7 @@ export interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKin
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
* @see [HTTP validation with validateHttp](guide/forms/signals/async-operations#http-validation-with-validatehttp)
* @category validation
* @publicApi 22.0
*/
@@ -20,6 +20,9 @@ import type {FieldContext, PathKind, SchemaPath, SchemaPathRules, TreeValidator}
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @see [Cross-field validation](guide/forms/signals/cross-field-logic#using-validatetree)
* @see [Custom validation rules](guide/forms/signals/validation#using-validatetree)
*
* @category logic
* @publicApi 22.0
*/
@@ -22,6 +22,8 @@ export interface ValidationErrorOptions {
* A type that requires the given type `T` to have a `field` property.
* @template T The type to add a `field` to.
*
* @see [Validation errors](guide/forms/signals/validation#validation-errors)
*
* @publicApi 22.0
*/
export type WithFieldTree<T> = T & {fieldTree: ReadonlyFieldTree<unknown>};
@@ -30,6 +32,8 @@ export type WithFieldTree<T> = T & {fieldTree: ReadonlyFieldTree<unknown>};
* A type that allows the given type `T` to optionally have a `field` property.
* @template T The type to optionally add a `field` to.
*
* @see [Validation errors](guide/forms/signals/validation#validation-errors)
*
* @publicApi 22.0
*/
export type WithOptionalFieldTree<T> = Omit<T, 'fieldTree'> & {
@@ -40,6 +44,8 @@ export type WithOptionalFieldTree<T> = Omit<T, 'fieldTree'> & {
* A type that ensures the given type `T` does not have a `field` property.
* @template T The type to remove the `field` from.
*
* @see [Validation errors](guide/forms/signals/validation#validation-errors)
*
* @publicApi 22.0
*/
export type WithoutFieldTree<T> = T & {fieldTree: never};
@@ -48,6 +54,8 @@ export type WithoutFieldTree<T> = T & {fieldTree: never};
* Create a required error associated with the target field
* @param options The validation error options
*
* @see [Required validation](guide/forms/signals/validation#required)
*
* @publicApi 22.0
*/
export function requiredError(
@@ -57,6 +65,8 @@ export function requiredError(
* Create a required error
* @param options The optional validation error options
*
* @see [Required validation](guide/forms/signals/validation#required)
*
* @category validation
* @publicApi 22.0
*/
@@ -74,6 +84,8 @@ export function requiredError(
* @param min The min value constraint
* @param options The validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -86,6 +98,8 @@ export function minError(
* @param min The min value constraint
* @param options The optional validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -105,6 +119,8 @@ export function minError(
* @param minDate The min date constraint
* @param options The validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -117,6 +133,8 @@ export function minDateError(
* @param minDate The min date constraint
* @param options The optional validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -136,6 +154,8 @@ export function minDateError(
* @param max The max value constraint
* @param options The validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -148,6 +168,8 @@ export function maxError(
* @param max The max value constraint
* @param options The optional validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -167,6 +189,8 @@ export function maxError(
* @param maxDate The max date constraint
* @param options The validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -179,6 +203,8 @@ export function maxDateError(
* @param maxDate The max date constraint
* @param options The optional validation error options
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -198,6 +224,8 @@ export function maxDateError(
* @param minLength The minLength constraint
* @param options The validation error options
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -210,6 +238,8 @@ export function minLengthError(
* @param minLength The minLength constraint
* @param options The optional validation error options
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -229,6 +259,8 @@ export function minLengthError(
* @param maxLength The maxLength constraint
* @param options The validation error options
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -241,6 +273,8 @@ export function maxLengthError(
* @param maxLength The maxLength constraint
* @param options The optional validation error options
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -260,6 +294,8 @@ export function maxLengthError(
* @param pattern The violated pattern
* @param options The validation error options
*
* @see [Pattern validation](guide/forms/signals/validation#pattern)
*
* @category validation
* @publicApi 22.0
*/
@@ -272,6 +308,8 @@ export function patternError(
* @param pattern The violated pattern
* @param options The optional validation error options
*
* @see [Pattern validation](guide/forms/signals/validation#pattern)
*
* @category validation
* @publicApi 22.0
*/
@@ -290,6 +328,8 @@ export function patternError(
* Create an email format error associated with the target field
* @param options The validation error options
*
* @see [Email validation](guide/forms/signals/validation#email)
*
* @category validation
* @publicApi 22.0
*/
@@ -298,6 +338,8 @@ export function emailError(options: WithFieldTree<ValidationErrorOptions>): Emai
* Create an email format error
* @param options The optional validation error options
*
* @see [Email validation](guide/forms/signals/validation#email)
*
* @category validation
* @publicApi 22.0
*/
@@ -383,6 +425,8 @@ export declare namespace ValidationError {
* Internal version of `NgValidationError`, we create this separately so we can change its type on
* the exported version to a type union of the possible sub-classes.
*
* @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)
*
* @publicApi 22.0
*/
export abstract class BaseNgValidationError implements ValidationError {
@@ -408,6 +452,8 @@ export abstract class BaseNgValidationError implements ValidationError {
/**
* An error used to indicate that a required field is empty.
*
* @see [Required validation](guide/forms/signals/validation#required)
*
* @category validation
* @publicApi 22.0
*/
@@ -418,6 +464,8 @@ export class RequiredValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value is lower than the minimum allowed.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -435,6 +483,8 @@ export class MinValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a date value is earlier than the minimum allowed.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -452,6 +502,8 @@ export class MinDateValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value is higher than the maximum allowed.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -469,6 +521,8 @@ export class MaxValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a date value is later than the maximum allowed.
*
* @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)
*
* @category validation
* @publicApi 22.0
*/
@@ -486,6 +540,8 @@ export class MaxDateValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value is shorter than the minimum allowed length.
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -503,6 +559,8 @@ export class MinLengthValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value is longer than the maximum allowed length.
*
* @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)
*
* @category validation
* @publicApi 22.0
*/
@@ -520,6 +578,8 @@ export class MaxLengthValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value does not match the required pattern.
*
* @see [Pattern validation](guide/forms/signals/validation#pattern)
*
* @category validation
* @publicApi 22.0
*/
@@ -537,6 +597,8 @@ export class PatternValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value is not a valid email.
*
* @see [Email validation](guide/forms/signals/validation#email)
*
* @category validation
* @publicApi 22.0
*/
@@ -547,6 +609,8 @@ export class EmailValidationError extends BaseNgValidationError {
/**
* An error used to indicate that a value entered in a native input does not parse.
*
* @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)
*
* @category validation
* @publicApi 22.0
*/
@@ -576,6 +640,8 @@ export class NativeInputParseError extends BaseNgValidationError {
* }
* ```
*
* @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)
*
* @category validation
* @publicApi 22.0
*/
@@ -43,6 +43,8 @@ import type {
/**
* Options that may be specified when creating a form.
*
* @see [Signal Forms setup](guide/forms/signals/overview#setup)
*
* @category structure
* @publicApi 22.0
*/
@@ -96,6 +98,8 @@ export interface FormOptions<TModel> {
* @return A `FieldTree` representing a form around the data model.
* @template TModel The type of the data model.
*
* @see [Creating models](guide/forms/signals/models#creating-models)
*
* @category structure
* @publicApi 22.0
*/
@@ -143,6 +147,8 @@ export function form<TModel>(model: WritableSignal<TModel>): FieldTree<TModel>;
* @return A `FieldTree` representing a form around the data model
* @template TValue The type of the data model.
*
* @see [Creating models](guide/forms/signals/models#creating-models)
*
* @category structure
* @publicApi 22.0
*/
@@ -191,6 +197,8 @@ export function form<TModel>(
* @return A `FieldTree` representing a form around the data model.
* @template TModel The type of the data model.
*
* @see [Creating models](guide/forms/signals/models#creating-models)
*
* @category structure
* @publicApi 22.0
*/
@@ -258,6 +266,8 @@ export function form<TModel>(...args: any[]): FieldTree<TModel> {
* element of the array.
* @template TValue The data type of the item field to apply the schema to.
*
* @see [Array items with applyEach](guide/forms/signals/schemas#array-items-with-applyeach)
*
* @category structure
* @publicApi 22.0
*/
@@ -297,6 +307,8 @@ export function applyEach<TValue extends Object>(
* @param schema The schema to apply to the property
* @template TValue The data type of the field to apply the schema to.
*
* @see [Using the schema with apply](guide/forms/signals/schemas#using-the-schema-with-apply)
*
* @category structure
* @publicApi 22.0
*/
@@ -318,6 +330,8 @@ export function apply<TValue>(
* @param schema The schema to apply to the field when the `logic` function returns `true`.
* @template TValue The data type of the field to apply the schema to.
*
* @see [Conditional schemas with applyWhen](guide/forms/signals/schemas#conditional-schemas-with-applywhen)
*
* @category structure
* @publicApi 22.0
*/
@@ -342,6 +356,8 @@ export function applyWhen<TValue>(
* @template TValue The data type of the field to apply the schema to.
* @template TNarrowed The data type of the schema (a narrowed type of TValue).
*
* @see [Type-narrowing with applyWhenValue](guide/forms/signals/schemas#type-narrowing-with-applywhenvalue)
*
* @category structure
* @publicApi 22.0
*/
@@ -360,6 +376,8 @@ export function applyWhenValue<TValue, TNarrowed extends TValue>(
* @param schema The schema to apply to the field when `predicate` returns `true`.
* @template TValue The data type of the field to apply the schema to.
*
* @see [Type-narrowing with applyWhenValue](guide/forms/signals/schemas#type-narrowing-with-applywhenvalue)
*
* @category structure
* @publicApi 22.0
*/
@@ -414,6 +432,8 @@ export function applyWhenValue(
* @returns Whether the submission was successful.
* @template TModel The data type of the field being submitted.
*
* @see [Form submission](guide/forms/signals/form-submission)
*
* @category submission
* @publicApi 22.0
*/
@@ -481,6 +501,8 @@ export async function submit<TModel>(
* @returns A schema object that implements the given logic.
* @template TValue The value type of a `FieldTree` that this schema binds to.
*
* @see [Create reusable schemas with schema](guide/forms/signals/schemas#create-reusable-schemas-with-schema)
*
* @category structure
* @publicApi 22.0
*/
@@ -35,6 +35,8 @@ export interface ParseResult<TValue> {
/**
* Options for `transformedValue`.
*
* @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)
*
* @publicApi 22.0
*/
export interface TransformedValueOptions<TValue, TRaw> {
@@ -57,6 +59,8 @@ export interface TransformedValueOptions<TValue, TRaw> {
* A writable signal representing a "raw" UI value that is synchronized with a model signal
* via parse/format transformations.
*
* @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)
*
* @category control
* @publicApi 22.0
*/
@@ -110,6 +114,10 @@ export interface TransformedValueSignal<TRaw> extends WritableSignal<TRaw> {
* });
* }
* ```
*
* @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)
*
*/
export function transformedValue<TValue, TRaw>(
value: ModelSignal<TValue>,
+55
View File
@@ -19,6 +19,8 @@ declare const ɵɵTYPE: unique symbol;
/**
* Options that can be specified when submitting a form.
*
* @see [Form submission](guide/forms/signals/form-submission)
*
* @publicApi 22.0
*/
export interface FormSubmitOptions<TRootModel, TSubmittedModel> {
@@ -60,6 +62,8 @@ export interface FormSubmitOptions<TRootModel, TSubmittedModel> {
/**
* Options for the `markAsTouched` method.
*
* @see [Touched state](guide/forms/signals/field-state-management#touched-state)
*
* @publicApi 22.0
*/
export interface MarkAsTouchedOptions {
@@ -115,6 +119,8 @@ export declare namespace PathKind {
/**
* A reason for a field's disablement.
*
* @see [Disabled reasons](guide/forms/signals/form-logic#disabled-reasons)
*
* @category logic
* @publicApi 22.0
*/
@@ -128,6 +134,8 @@ export interface DisabledReason {
/**
* The absence of an error which indicates a successful validation result.
*
* @see [Validation basics](guide/forms/signals/validation#validation-basics)
*
* @category types
* @publicApi 22.0
*/
@@ -144,6 +152,8 @@ export type ValidationSuccess = null | undefined | void;
*
* @template E the type of error (defaults to {@link ValidationError}).
*
* @see [Validation errors](guide/forms/signals/validation#validation-errors)
*
* @category types
* @publicApi 22.0
*/
@@ -161,6 +171,8 @@ export type TreeValidationResult<
*
* @template E the type of error (defaults to {@link ValidationError}).
*
* @see [Validation errors](guide/forms/signals/validation#validation-errors)
*
* @category types
* @publicApi 22.0
*/
@@ -177,6 +189,8 @@ export type ValidationResult<E extends ValidationError = ValidationError> =
*
* @template E the type of error (defaults to {@link ValidationError}).
*
* @see [Async validation](guide/forms/signals/validation#async-validation)
*
* @category types
* @publicApi 22.0
*/
@@ -190,6 +204,8 @@ export type AsyncValidationResult<E extends ValidationError = ValidationError> =
* @template TValue The type of the value stored in the field.
* @template TKey The type of the property key which this field resides under in its parent.
*
* @see [Accessing field state](guide/forms/signals/field-state-management#accessing-field-state)
*
* @category types
* @publicApi 22.0
*/
@@ -308,6 +324,7 @@ export type MaybeFieldTree<
* @template TValue The type of the data which the field is wrapped around.
* @template TKey The type of the property key which this field resides under in its parent.
*
*
* @category structure
* @publicApi 22.0
*/
@@ -493,6 +510,8 @@ export interface ReadonlyFieldState<TValue, TKey extends string | number = strin
* @template TValue The type of the data which the field is wrapped around.
* @template TKey The type of the property key which this field resides under in its parent.
*
* @see [Field state management](guide/forms/signals/field-state-management)
*
* @category structure
* @publicApi 22.0
*/
@@ -567,6 +586,8 @@ export interface FieldState<
/**
* This is FieldState also providing access to the wrapped FormControl.
*
* @see [Migrating existing forms to Signal Forms](guide/forms/signals/migration)
*
* @category interop
* @publicApi 22.0
*/
@@ -585,6 +606,8 @@ export type CompatFieldState<
/**
* A readonly {@link CompatFieldState}.
*
* @see [Migrating existing forms to Signal Forms](guide/forms/signals/migration)
*
* @category interop
* @publicApi 22.0
*/
@@ -610,6 +633,9 @@ export type FieldStateByMode<
/**
* Represents a binding between a field and a UI control through a {@link FormField} directive.
*
* @see [Focus a form control bound to a form field](guide/forms/signals/field-state-management#focus-a-form-control-bound-to-a-form-field)
* @see [How the FormField directive works](guide/forms/signals/custom-controls#how-the-formfield-directive-works)
*
* @publicApi 22.0
*/
export interface FormFieldBinding {
@@ -640,6 +666,9 @@ export interface FormFieldBinding {
/**
* Allows declaring whether the Rules are supported for a given path.
*
* @see [Schemas and schema composability](guide/forms/signals/schemas)
* @see [Migrating existing forms to Signal Forms](guide/forms/signals/migration)
*
* @publicApi 22.0
**/
export type SchemaPathRules = SchemaPathRules.Supported | SchemaPathRules.Unsupported;
@@ -664,6 +693,9 @@ export declare namespace SchemaPathRules {
* @template TValue The type of the data which the form is wrapped around.
* @template TPathKind The kind of path (root field, child field, or item of an array)
*
* @see [The schema function](guide/forms/signals/validation#the-schema-function)
* @see [Schemas and schema composability](guide/forms/signals/schemas)
*
* @category types
* @publicApi 22.0
*/
@@ -682,6 +714,8 @@ export type SchemaPath<
/**
* Schema path used if the value is an AbstractControl.
*
* @see [Migrating existing forms to Signal Forms](guide/forms/signals/migration)
*
* @category interop
* @publicApi 22.0
*/
@@ -705,6 +739,9 @@ export type CompatSchemaPath<
* It mirrors the structure of a given data structure, and allows applying rules to the appropriate
* fields.
*
* @see [The schema function](guide/forms/signals/validation#the-schema-function)
* @see [Schemas and schema composability](guide/forms/signals/schemas)
*
* @publicApi 22.0
*/
export type SchemaPathTree<TModel, TPathKind extends PathKind = PathKind.Root> =
@@ -737,6 +774,8 @@ export type SchemaPathTree<TModel, TPathKind extends PathKind = PathKind.Root> =
* @template TValue The type of the data which the field is wrapped around.
* @template TPathKind The kind of path (root field, child field, or item of an array)
*
* @see [Schemas and schema composability](guide/forms/signals/schemas)
*
* @publicApi 22.0
*/
export type MaybeSchemaPathTree<TModel, TPathKind extends PathKind = PathKind.Root> =
@@ -781,6 +820,8 @@ export type MaybeSchemaPathTree<TModel, TPathKind extends PathKind = PathKind.Ro
*
* @template TModel Data type.
*
* @see [Create reusable schemas with schema](guide/forms/signals/schemas#create-reusable-schemas-with-schema)
*
* @category types
* @publicApi 22.0
*/
@@ -806,6 +847,8 @@ export type Schema<in TModel> = {
* @template TModel Data type.
* @template TPathKind The kind of path this schema function can be bound to.
*
* @see [Schemas and schema composability](guide/forms/signals/schemas)
*
* @category types
* @publicApi 22.0
*/
@@ -819,6 +862,8 @@ export type SchemaFn<TModel, TPathKind extends PathKind = PathKind.Root> = (
* @template TModel The type of data stored in the form that this schema function is attached to.
* @template TPathKind The kind of path this schema function can be bound to.
*
* @see [Schemas and schema composability](guide/forms/signals/schemas)
*
* @category types
* @publicApi 22.0
*/
@@ -848,6 +893,8 @@ export type LogicFn<TValue, TReturn, TPathKind extends PathKind = PathKind.Root>
* @template TValue The type of value stored in the field being validated
* @template TPathKind The kind of path being validated (root field, child field, or item of an array)
*
* @see [Custom validation rules](guide/forms/signals/validation#using-validate)
*
* @category validation
* @publicApi 22.0
*/
@@ -864,6 +911,8 @@ export type FieldValidator<TValue, TPathKind extends PathKind = PathKind.Root> =
* @template TValue The type of value stored in the field being validated
* @template TPathKind The kind of path being validated (root field, child field, or item of an array)
*
* @see [Custom validation rules](guide/forms/signals/validation#using-validatetree)
*
* @category types
* @publicApi 22.0
*/
@@ -894,6 +943,8 @@ export type Validator<TValue, TPathKind extends PathKind = PathKind.Root> = Logi
* Provides access to the state of the current field as well as functions that can be used to look
* up state of other fields based on a `FieldPath`.
*
* @see [Understanding the field context](guide/forms/signals/cross-field-logic#understanding-the-field-context)
*
* @category types
* @publicApi 22.0
*/
@@ -909,6 +960,8 @@ export type FieldContext<
/**
* The base field context that is available for all fields.
*
* @see [Understanding the field context](guide/forms/signals/cross-field-logic#understanding-the-field-context)
*
* @publicApi 22.0
*/
export interface RootFieldContext<TValue> {
@@ -981,6 +1034,8 @@ export type ItemType<T extends Object> = T extends ReadonlyArray<any> ? T[number
* @template TValue The type of value stored in the field.
* @template TPathKind The kind of path the debouncer is applied to (root field, child field, or item of an array).
*
* @see [Debouncing form updates](guide/forms/signals/form-logic#delay-input-operations-with-debounce)
*
* @publicApi 22.0
*/
export type Debouncer<TValue, TPathKind extends PathKind = PathKind.Root> = (
@@ -71,6 +71,8 @@ export interface FormFieldBindingOptions {
/**
* Lightweight DI token provided by the {@link FormField} directive.
*
* @see [Custom form controls](guide/forms/signals/custom-controls)
*
* @category control
* @publicApi 22.0
*/
@@ -95,6 +97,9 @@ export const FORM_FIELD = new InjectionToken<FormField<unknown>>(
* forms.
*
* @category control
*
* @see [How the FormField directive works](guide/forms/signals/custom-controls#how-the-formfield-directive-works)
*
* @publicApi 22.0
*/
@Directive({
@@ -28,6 +28,8 @@ import {FieldNode} from '../field/node';
* </form>
* ```
*
* @see [Setting up form submission with FormRoot](guide/forms/signals/form-submission#setting-up-form-submission-with-formroot)
*
* @publicApi 22.0
*/
@Directive({
@@ -137,6 +137,8 @@ function inferSchemaFromFieldNode(node: FieldNode): JsonSchemaForInference | und
* Creates a provider that configures all signal forms with `experimentalWebMcpTool`
* to be registered as WebMCP tools.
*
* @see [Implicit tools in Signal Forms](ai/webmcp#implicit-tools-in-signal-forms)
*
* @experimental
*/
export function provideExperimentalWebMcpForms(): EnvironmentProviders {