@@ -16,8 +16,8 @@ import {FieldPathNode} from '../schema/path_node';
1616import { assertPathIsCurrent , isSchemaOrSchemaFn , SchemaImpl } from '../schema/schema' ;
1717import { isArray } from '../util/type_guards' ;
1818import type {
19- Field ,
2019 FieldPath ,
20+ FieldTree ,
2121 LogicFn ,
2222 OneOrMany ,
2323 PathKind ,
@@ -73,8 +73,8 @@ function normalizeFormArgs<TValue>(
7373}
7474
7575/**
76- * Creates a form wrapped around the given model data. A form is represented as simply a `Field` of
77- * the model data.
76+ * Creates a form wrapped around the given model data. A form is represented as simply a `FieldTree`
77+ * of the model data.
7878 *
7979 * `form` uses the given model as the source of truth and *does not* maintain its own copy of the
8080 * data. This means that updating the value on a `FieldState` updates the originally passed in model
@@ -92,17 +92,17 @@ function normalizeFormArgs<TValue>(
9292 * @param model A writable signal that contains the model data for the form. The resulting field
9393 * structure will match the shape of the model and any changes to the form data will be written to
9494 * the model.
95- * @return A `Field ` representing a form around the data model.
95+ * @return A `FieldTree ` representing a form around the data model.
9696 * @template TValue The type of the data model.
9797 *
9898 * @category structure
9999 * @experimental 21.0.0
100100 */
101- export function form < TValue > ( model : WritableSignal < TValue > ) : Field < TValue > ;
101+ export function form < TValue > ( model : WritableSignal < TValue > ) : FieldTree < TValue > ;
102102
103103/**
104- * Creates a form wrapped around the given model data. A form is represented as simply a `Field` of
105- * the model data.
104+ * Creates a form wrapped around the given model data. A form is represented as simply a `FieldTree`
105+ * of the model data.
106106 *
107107 * `form` uses the given model as the source of truth and *does not* maintain its own copy of the
108108 * data. This means that updating the value on a `FieldState` updates the originally passed in model
@@ -139,7 +139,7 @@ export function form<TValue>(model: WritableSignal<TValue>): Field<TValue>;
139139 * 1. A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.).
140140 * When passing a schema, the form options can be passed as a third argument if needed.
141141 * 2. The form options
142- * @return A `Field ` representing a form around the data model
142+ * @return A `FieldTree ` representing a form around the data model
143143 * @template TValue The type of the data model.
144144 *
145145 * @category structure
@@ -148,11 +148,11 @@ export function form<TValue>(model: WritableSignal<TValue>): Field<TValue>;
148148export function form < TValue > (
149149 model : WritableSignal < TValue > ,
150150 schemaOrOptions : SchemaOrSchemaFn < TValue > | FormOptions ,
151- ) : Field < TValue > ;
151+ ) : FieldTree < TValue > ;
152152
153153/**
154- * Creates a form wrapped around the given model data. A form is represented as simply a `Field` of
155- * the model data.
154+ * Creates a form wrapped around the given model data. A form is represented as simply a `FieldTree`
155+ * of the model data.
156156 *
157157 * `form` uses the given model as the source of truth and *does not* maintain its own copy of the
158158 * data. This means that updating the value on a `FieldState` updates the originally passed in model
@@ -187,7 +187,7 @@ export function form<TValue>(
187187 * the model.
188188 * @param schema A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.)
189189 * @param options The form options
190- * @return A `Field ` representing a form around the data model.
190+ * @return A `FieldTree ` representing a form around the data model.
191191 * @template TValue The type of the data model.
192192 *
193193 * @category structure
@@ -197,9 +197,9 @@ export function form<TValue>(
197197 model : WritableSignal < TValue > ,
198198 schema : SchemaOrSchemaFn < TValue > ,
199199 options : FormOptions ,
200- ) : Field < TValue > ;
200+ ) : FieldTree < TValue > ;
201201
202- export function form < TValue > ( ...args : any [ ] ) : Field < TValue > {
202+ export function form < TValue > ( ...args : any [ ] ) : FieldTree < TValue > {
203203 const [ model , schema , options ] = normalizeFormArgs < TValue > ( args ) ;
204204 const injector = options ?. injector ?? inject ( Injector ) ;
205205 const pathNode = runInInjectionContext ( injector , ( ) => SchemaImpl . rootCompile ( schema ) ) ;
@@ -208,7 +208,7 @@ export function form<TValue>(...args: any[]): Field<TValue> {
208208 const fieldRoot = FieldNode . newRoot ( fieldManager , model , pathNode , adapter ) ;
209209 fieldManager . createFieldManagementEffect ( fieldRoot . structure ) ;
210210
211- return fieldRoot . fieldProxy as Field < TValue > ;
211+ return fieldRoot . fieldProxy as FieldTree < TValue > ;
212212}
213213
214214/**
@@ -225,8 +225,8 @@ export function form<TValue>(...args: any[]): Field<TValue> {
225225 * });
226226 * ```
227227 *
228- * When binding logic to the array items, the `Field ` for the array item is passed as an additional
229- * argument. This can be used to reference other properties on the item.
228+ * When binding logic to the array items, the `FieldTree ` for the array item is passed as an
229+ * additional argument. This can be used to reference other properties on the item.
230230 *
231231 * @example
232232 * ```
@@ -358,14 +358,14 @@ export function applyWhenValue(
358358}
359359
360360/**
361- * Submits a given `Field ` using the given action function and applies any server errors resulting
362- * from the action to the field. Server errors returned by the `action` will be integrated into the
363- * field as a `ValidationError` on the sub-field indicated by the `field` property of the server
364- * error.
361+ * Submits a given `FieldTree ` using the given action function and applies any server errors
362+ * resulting from the action to the field. Server errors returned by the `action` will be integrated
363+ * into the field as a `ValidationError` on the sub-field indicated by the `field` property of the
364+ * server error.
365365 *
366366 * @example
367367 * ```
368- * async function registerNewUser(registrationForm: Field <{username: string, password: string}>) {
368+ * async function registerNewUser(registrationForm: FieldTree <{username: string, password: string}>) {
369369 * const result = await myClient.registerNewUser(registrationForm().value());
370370 * if (result.errorCode === myClient.ErrorCode.USERNAME_TAKEN) {
371371 * return [{
@@ -392,8 +392,8 @@ export function applyWhenValue(
392392 * @experimental 21.0.0
393393 */
394394export async function submit < TValue > (
395- form : Field < TValue > ,
396- action : ( form : Field < TValue > ) => Promise < TreeValidationResult > ,
395+ form : FieldTree < TValue > ,
396+ action : ( form : FieldTree < TValue > ) => Promise < TreeValidationResult > ,
397397) {
398398 const node = form ( ) as FieldNode ;
399399 markAllAsTouched ( node ) ;
@@ -445,7 +445,7 @@ function setServerErrors(
445445 * Creates a `Schema` that adds logic rules to a form.
446446 * @param fn A **non-reactive** function that sets up reactive logic rules for the form.
447447 * @returns A schema object that implements the given logic.
448- * @template TValue The value type of a `Field ` that this schema binds to.
448+ * @template TValue The value type of a `FieldTree ` that this schema binds to.
449449 *
450450 * @category structure
451451 * @experimental 21.0.0
0 commit comments