import { BasicApi, EmitFn } from '../types';
import { FormInstance } from 'element-plus';
import { Ref, Reactive, ComputedRef, ShallowRef } from 'vue';
import { DEFAULT_INFO_KEY, DEFAULT_CREATE_KEY, DEFAULT_UPDATE_KEY } from '../config';
export declare type ModifyArgs = [post?: Record<string, any>, need?: Array<string>, url?: string, callback?: Function];
export interface UseFormApi {
    [DEFAULT_CREATE_KEY]: string;
    [DEFAULT_UPDATE_KEY]: string;
    [DEFAULT_INFO_KEY]: string;
}
export interface UseFormReturnType<T extends Record<string, any>> {
    modal: Ref<boolean>;
    form: ShallowRef<FormInstance | undefined>;
    formData: Reactive<T>;
    trimData: (items: T) => T;
    setField: <S extends Record<string, unknown>, D extends Record<string, unknown>>(target: S, data: D, need?: string[]) => S;
    title: ComputedRef<(k?: string) => string>;
    open: (need?: Array<string>) => void;
    modify: (...args: ModifyArgs) => void;
    clean: () => void;
    closed: (refresh?: boolean) => void;
    submit: (close?: boolean, _url?: string) => void;
    requesting: ComputedRef<boolean>;
    executing: ComputedRef<boolean>;
}
/**
 * @description 处理表单
 * @param {any} emit 事件
 * @param {T} initialData 初始数据
 * @param {BasicApi} api 接口
 * @param {string} createUrl 创建地址
 * @param {string} updateUrl 更新地址
 * @param {string[]} clearCacheKey 清除缓存key
 * @returns {
 *  modal: Ref<boolean>,
 *  form: ShallowRef<FormInstance>,
 *  formData: Reactive<T>,
 *  trimData: (items: T) => T,
 *  setField: (target: S, data: D, need?: string[]) => S,
 *  title: ComputedRef<() => string>,
 *  open: (need?: Array<string>) => void,
 *  modify: (...args: ModifyArgs) => void,
 *  clean: () => void,
 *  closed: (refresh?: boolean) => void,
 *  submit: (close?: boolean, _url?: string) => void,
 *  requesting: ComputedRef<boolean>,
 *  executing: ComputedRef<boolean>
 * } 表单
 */
export declare const useForm: <T extends Record<string, any>, E extends string = string>(emit: EmitFn<E> | undefined, initialData: T, api: BasicApi<UseFormApi>, createUrl?: string, updateUrl?: string, clearCacheKey?: string[]) => UseFormReturnType<T>;
