MCPcopy Index your code
hub / github.com/TanStack/form / FieldGroupApi

Class FieldGroupApi

packages/form-core/src/FieldGroupApi.ts:112–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112export class FieldGroupApi<
113 in out TFormData,
114 in out TFieldGroupData,
115 in out TFields extends
116 | DeepKeysOfType<TFormData, TFieldGroupData | null | undefined>
117 | FieldsMap<TFormData, TFieldGroupData>,
118 in out TOnMount extends undefined | FormValidateOrFn<TFormData>,
119 in out TOnChange extends undefined | FormValidateOrFn<TFormData>,
120 in out TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>,
121 in out TOnBlur extends undefined | FormValidateOrFn<TFormData>,
122 in out TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>,
123 in out TOnSubmit extends undefined | FormValidateOrFn<TFormData>,
124 in out TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>,
125 in out TOnDynamic extends undefined | FormValidateOrFn<TFormData>,
126 in out TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>,
127 in out TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>,
128 in out TSubmitMeta = never,
129> implements FieldManipulator<TFieldGroupData, TSubmitMeta>
130{
131 /**
132 * The form that called this field group.
133 */
134 readonly form: FormApi<
135 TFormData,
136 TOnMount,
137 TOnChange,
138 TOnChangeAsync,
139 TOnBlur,
140 TOnBlurAsync,
141 TOnSubmit,
142 TOnSubmitAsync,
143 TOnDynamic,
144 TOnDynamicAsync,
145 TOnServer,
146 TSubmitMeta
147 >
148
149 readonly fieldsMap: TFields
150
151 /**
152 * Get the true name of the field. Not required within `Field` or `AppField`.
153 * @private
154 */
155 getFormFieldName = <TField extends DeepKeys<TFieldGroupData>>(
156 subfield: TField,
157 ): DeepKeys<TFormData> => {
158 if (typeof this.fieldsMap === 'string') {
159 return concatenatePaths(this.fieldsMap, subfield)
160 }
161
162 const firstAccessor = makePathArray(subfield)[0]
163 if (typeof firstAccessor !== 'string') {
164 // top-level arrays cannot be mapped
165 return ''
166 }
167
168 const restOfPath = subfield.slice(firstAccessor.length)
169 const formMappedPath =

Callers

nothing calls this directly

Calls 3

concatenatePathsFunction · 0.90
makePathArrayFunction · 0.90
mountMethod · 0.45

Tested by

no test coverage detected