import type { FormInstance as RcFormInstance } from 'rc-field-form'; import type { InternalNamePath, NamePath } from 'rc-field-form/lib/interface'; import React from 'react'; import type { Options as ScrollOptions } from 'scroll-into-view-if-needed'; import type { KpSchemaItemProps } from '../Schema/Item'; export interface KpFormInstance extends Omit, 'setFieldsValue'> { scrollToField: (name: NamePath, options?: ScrollOptions) => void; clearFormStore: () => void; setFieldsValue: (value: Values, notify?: boolean) => void; getFieldInstance: (name: NamePath) => any; getFormSource: () => KpSchemaItemProps[]; setFormSource: (source: KpSchemaItemProps[] | ((source?: KpSchemaItemProps[]) => KpSchemaItemProps[])) => void; updateFormItem: (name: NamePath, params: KpSchemaItemProps | ((item: KpSchemaItemProps) => KpSchemaItemProps | Promise)) => Promise; /** This is an internal usage. Do not use in your prod */ __INTERNAL__?: { /** No! Do not use this in your code! */ name?: string; /** No! Do not use this in your code! */ inJsonForm?: boolean; /** No! Do not use this in your code! */ itemRef: (name: InternalNamePath) => (node: React.ReactElement) => void; setControlledCallback: (callbacks: Record | undefined) => void; }; } export default function useForm(form?: KpFormInstance): [Omit, '__INTERNAL__'>];