///
import { MaybePromise } from '@teamix/utils';
export interface BaseAction {
/** 事件触发方式,默认是 onClick */
trigger?: string;
/** 事件发生时,是否执行 e.preventDefault() 方法 */
preventDefault?: boolean;
/** 事件发生时,是否执行 e.stopPropagation() 方法 */
stopPropagation?: boolean;
/** 事件执行前的处理函数
* 如果返回 false 或者 Promise,则停止 Action 执行。
* 如果返回 true 或者 Promise,则正常执行 Action。
* 如果返回其他对象,则正常执行 Action,并把返回的对象放到接下来 Action 的上下文中。
*/
beforeAction?: () => MaybePromise;
/** 事件开始执行后的回调函数 */
onTrigger?: () => void;
/** 事件开始执行完毕的回调函数 */
onFinish?: (params?: any) => any;
}
export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any, e: React.MouseEvent) => void): {
[x: string]: (e: React.MouseEvent) => Promise;
};
export default eventHandler;