UNPKG

@ccs-design/rc-pro

Version:

ccs design basic react component

33 lines (32 loc) 912 B
import { RefObject } from 'react'; export declare type ShowInstance<T = any> = { show: (record: T) => void; hide: (data?: any) => void; getData: () => any; }; export declare type ShowInstanceRef<T = any> = RefObject<ShowInstance<T>>; /** * hooks 返回值 */ interface UseShowCallBackType<T> { /** 父组件传入参数 */ record: T; /** 向父组件ref写入data数据 */ onCallback: (e: any) => any; } /** * 父调用子组件方法,并传值 * @param funcRef ref对象 * @param options { onShow, onFormart, onHide } * @returns T 传输的数据 * -- deprecated */ export default function useShow<T>(funcRef: RefObject<ShowInstance<T>>, options: { /** show触发事件 */ onShow: (record: T) => void; /** 格式化record */ onFormart?: (record: T) => T; /** hide触发事件 */ onHide?: (data?: any) => void; }): UseShowCallBackType<T>; export {};