Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/forms/signals/compat/src/api/compat_form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/forms/signals/compat/src/api/di.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions packages/forms/signals/src/api/control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/forms/signals/src/api/di.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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[] {
Expand Down
1 change: 1 addition & 0 deletions packages/forms/signals/src/api/rules/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
*
Expand Down
3 changes: 3 additions & 0 deletions packages/forms/signals/src/api/rules/disabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/forms/signals/src/api/rules/hidden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
47 changes: 47 additions & 0 deletions packages/forms/signals/src/api/rules/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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
*/
Expand All @@ -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> {
Expand All @@ -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<
Expand All @@ -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<
Expand All @@ -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> =
Expand All @@ -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<
Expand All @@ -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>(
Expand All @@ -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>(
Expand All @@ -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>(
Expand All @@ -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 {
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/forms/signals/src/api/rules/readonly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
10 changes: 10 additions & 0 deletions packages/forms/signals/src/api/rules/validation/standard_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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> =
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/forms/signals/src/api/rules/validation/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Loading
Loading