toBehaviorFieldPath()
function toBehaviorFieldPath<TForm, TField>(fieldPath): FieldPath<TField>;
Defined in: core/behavior/compose-behavior.ts:46
Преобразовать FieldPath во вложенный путь для композиции behavior схем
Аналог toFieldPath из validation API.
Type Parameters
TForm
TForm
TField
TField
Parameters
fieldPath
Поле для преобразования
FieldPathNode<TForm, TField, unknown> | undefined
Returns
FieldPath<TField>
Вложенный FieldPath
Example
// address-behavior.ts
export const addressBehavior = (path: FieldPath<Address>) => {
watchField(path.country, async (country, ctx) => {
const regions = await fetchRegions(country);
ctx.updateComponentProps(path.region, { options: regions });
});
};
// user-behavior.ts
export const userBehavior = (path: FieldPath<User>) => {
// Композиция: применяем addressBehavior к вложенному полю
addressBehavior(toBehaviorFieldPath(path.address));
};