import type { OnEventProps, RendererProps, SchemaBoolean, SchemaNode, ThemeProps } from 'jamis-core';
import type { BadgeObject, BaseSchema, DialogSchemaBase, DrawerSchemaBase, FeedbackDialog, SchemaApi, SchemaClassName, SchemaCollection, SchemaExpression, SchemaIcon, SchemaReload, SchemaTooltip, SchemaTpl, SizeUnit, StaticControlSchemaBase, ToastSchemaBase, TourConfig } from '../types';
interface Button {
    type: 'submit' | 'button' | 'reset';
    label?: string;
    icon?: string;
    size?: string;
    disabled?: boolean;
    className?: string;
}
export type ButtonLevel = 'info' | 'success' | 'warning' | 'danger' | 'link' | 'primary' | 'dark' | 'light' | 'secondary' | 'enhance' | 'default';
/**
 * @deprecated 过期, 和ActionObject重复了
 */
export interface ActionOld extends Button {
    actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'selectAll' | 'changeTabKey' | 'click' | 'stopAutoRefresh';
    api?: SchemaApi;
    asyncApi?: SchemaApi;
    payload?: any;
    dialog?: SchemaNode;
    to?: string;
    target?: string;
    link?: string;
    url?: string;
    cc?: string;
    bcc?: string;
    subject?: string;
    body?: string;
    mergeData?: boolean;
    reload?: string;
    messages?: {
        success?: string;
        failed?: string;
    };
    feedback?: any;
    required?: Array<string>;
    [propName: string]: any;
}
export interface ButtonSchema extends BaseSchema, OnEventProps {
    /**
     * 指定按钮类型，支持 button、submit或者reset三种类型。
     * 兼容action类型写法, 但会被转换成button
     */
    type: 'button' | 'submit' | 'reset' | 'action';
    /**
     * 其他各个具体的schema会指定明确的actionType
     */
    actionType?: string;
    /**
     * 透传渲染器的路径
     * @inner 内部使用
     */
    __$path?: string;
    /**
     * 是否为块状展示，默认为内联。
     */
    block?: boolean;
    /**
     * 禁用时的文案提示。
     */
    disabledTip?: string;
    /**
     * 按钮图标， antd图标的类名, 如LeftOutlined
     */
    icon?: SchemaIcon;
    iconExpr?: SchemaExpression;
    /**
     * icon 上的css 类名
     */
    iconClassName?: SchemaClassName;
    /**
     * 右侧按钮图标， iconfont 的类名
     */
    rightIcon?: SchemaIcon;
    /**
     * 右侧 icon 上的 css 类名
     */
    rightIconClassName?: SchemaClassName;
    /**
     * loading 上的css 类名
     */
    loadingClassName?: SchemaClassName;
    /**
     * 按钮文字
     */
    label?: string;
    /**
     * 按钮样式
     */
    level?: ButtonLevel;
    /**
     * @deprecated 通过 level 来配置
     */
    primary?: boolean;
    /**
     * 按钮大小
     */
    size?: SizeUnit;
    tooltip?: SchemaTooltip;
    tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
    /**
     * 提示文字，配置了操作前会要求用户确认。
     */
    confirmText?: string;
    /**
     * 如果按钮在form中，配置此属性会要求用户把指定的字段通过验证后才会触发行为。
     */
    required?: Array<string>;
    /**
     * 激活状态时的样式
     */
    activeLevel?: ButtonLevel;
    /**
     * 激活状态时的类名
     */
    activeClassName?: string;
    /**
     * 如果按钮在弹框中，可以配置这个动作完成后是否关闭弹窗，或者指定关闭目标弹框。
     */
    close?: boolean | string;
    /**
     * 当按钮时批量操作按钮时，默认必须有勾选元素才能可点击，如果此属性配置成 false，则没有点选成员也能点击。
     */
    requireSelected?: boolean;
    /**
     * 是否将弹框中数据 merge 到父级作用域。
     */
    mergeData?: boolean;
    /**
     * 可以指定让谁来触发这个动作。
     */
    target?: string;
    /**
     * 点击后的禁止倒计时（秒）
     */
    countDown?: number;
    /** 点击后的禁止倒计时（秒）表达式 */
    countDownExpr?: SchemaExpression;
    /**
     * 倒计时文字自定义
     */
    countDownTpl?: string;
    /**
     * 角标
     */
    badge?: BadgeObject;
    /**
     * 键盘快捷键
     */
    hotKey?: string;
    /**
     * 是否显示loading效果
     */
    loadingOn?: string;
    /**
     * 子内容
     */
    body?: SchemaCollection;
    /** 是否是激活态 */
    active?: boolean;
    /**
     * 是否禁止冒泡
     */
    stopPropagation?: boolean;
    stopPropagationOn?: SchemaBoolean;
    /**
     * 自定义事件处理函数
     */
    onClick?: (event: React.SyntheticEvent<HTMLElement>, props: ActionProps) => any;
}
export interface AjaxActionSchema extends ButtonSchema {
    /**
     * 指定为发送 ajax 的行为。
     */
    actionType: 'ajax';
    /**
     * 配置 ajax 发送地址
     */
    api: SchemaApi;
    feedback?: FeedbackDialog;
    reload?: SchemaReload;
    redirect?: string;
    ignoreConfirm?: boolean;
    /** 接口请求消息提示 */
    messages?: {
        success: string;
        failed: string;
    };
}
export interface DownloadActionSchema extends Omit<AjaxActionSchema, 'actionType'> {
    /**
     * 指定为下载行为
     */
    actionType: 'download';
}
export interface SaveAsActionSchema extends Omit<AjaxActionSchema, 'actionType'> {
    /**
     * 指定为保存到本地
     */
    actionType: 'saveAs';
}
export interface UrlActionSchema extends ButtonSchema {
    /**
     * 指定为打开链接
     */
    actionType: 'url';
    /**
     * 是否新窗口打开
     */
    blank?: boolean;
    /**
     * 打开的目标地址
     */
    url: string;
}
export interface DialogActionSchema extends ButtonSchema {
    /**
     * 指定为打开弹窗
     */
    actionType: 'dialog';
    /**
     * 弹框详情
     *
     */
    dialog: DialogSchemaBase;
    /**
     * 是否有下一个的表达式，正常可以不用配置，如果想要刷掉某些数据可以配置这个。
     */
    nextCondition?: SchemaExpression;
    reload?: SchemaReload;
    redirect?: string;
}
export interface DrawerActionSchema extends ButtonSchema {
    /**
     * 指定为打开弹窗，抽出式弹窗
     */
    actionType: 'drawer';
    /**
     * 抽出式弹框详情
     *
     */
    drawer: DrawerSchemaBase;
    /**
     * 是否有下一个的表达式，正常可以不用配置，如果想要刷掉某些数据可以配置这个。
     */
    nextCondition?: SchemaExpression;
    reload?: SchemaReload;
    redirect?: string;
}
export interface ToastActionSchema extends ButtonSchema {
    /**
     * 指定为打开弹窗，抽出式弹窗
     */
    actionType: 'toast';
    /**
     * 轻提示详情
     *
     */
    toast: ToastSchemaBase;
}
export interface CopyActionSchema extends ButtonSchema {
    /**
     * 指定为复制内容行为
     */
    actionType: 'copy';
    /**
     * 复制啥内容由此配置，支持模板语法。
     */
    copy: SchemaTpl;
}
export interface LinkActionSchema extends ButtonSchema {
    /**
     * 指定为打开链接行为，跟 url 不同的时这个行为为单页模式。
     */
    actionType: 'link';
    /**
     * 是否新窗口打开
     */
    blank?: boolean;
    /**
     * 跳转到哪？支持配置相对路径。
     */
    link: string;
}
export interface ReloadActionSchema extends ButtonSchema {
    /**
     * 指定为刷新目标组件。
     */
    actionType: 'reload';
    /**
     * 指定目标组件。
     */
    target?: SchemaReload;
}
export interface EmailActionSchema extends Omit<ButtonSchema, 'body'> {
    /**
     * 指定为打开邮箱行为
     */
    actionType: 'email';
    /**
     * 收件人邮箱
     */
    to: string;
    /**
     * 抄送邮箱
     */
    cc?: string;
    /**
     * 匿名抄送邮箱
     */
    bcc?: string;
    /**
     * 邮件主题
     */
    subject?: string;
    /**
     * 邮件正文
     */
    body?: string;
}
export interface OtherActionSchema extends ButtonSchema {
    actionType: 'prev' | 'next' | 'cancel' | 'close' | 'submit' | 'confirm' | 'add' | 'reset' | 'reset-and-submit';
}
export interface TourAction extends ButtonSchema {
    actionType: 'tour';
    tourConfig: TourConfig;
}
/**
 * 按钮动作渲染器。
 *
 */
export type ActionSchema = ButtonSchema | AjaxActionSchema | DownloadActionSchema | UrlActionSchema | LinkActionSchema | DialogActionSchema | DrawerActionSchema | ToastActionSchema | CopyActionSchema | ReloadActionSchema | EmailActionSchema | OtherActionSchema | TourAction;
export interface StaticActionSchema extends Omit<ActionSchema, 'type'>, Omit<StaticControlSchemaBase, 'label' | 'required'> {
    type?: `static-${ActionSchema['type']}`;
}
type OmitButtonSchema = 'type' | 'className' | 'iconClassName' | 'rightIconClassName' | 'loadingClassName' | 'onClick' | 'actionType';
export interface ActionProps extends Omit<RendererProps, 'onAction'>, ThemeProps, Omit<Partial<ButtonSchema>, OmitButtonSchema>, Omit<Partial<AjaxActionSchema>, OmitButtonSchema>, Omit<Partial<UrlActionSchema>, OmitButtonSchema>, Omit<Partial<LinkActionSchema>, OmitButtonSchema>, Omit<Partial<DialogActionSchema>, OmitButtonSchema>, Omit<Partial<DrawerActionSchema>, OmitButtonSchema>, Omit<Partial<ToastSchemaBase>, OmitButtonSchema>, Omit<Partial<CopyActionSchema>, OmitButtonSchema>, Omit<Partial<ReloadActionSchema>, OmitButtonSchema>, Omit<Partial<EmailActionSchema>, 'body' | OmitButtonSchema>, Omit<Partial<OtherActionSchema>, OmitButtonSchema>, Omit<Partial<TourAction>, OmitButtonSchema> {
    actionType?: ActionSchema['actionType'];
    onAction?: (e: React.MouseEvent<any> | void | null, action: ActionSchema) => void;
    onActionSensor?: (promise?: Promise<any>) => void;
    isCurrentUrl?: (link: string) => boolean;
    onClick?: ((e: React.MouseEvent<any>, props: any) => void) | string | Function | null;
    componentClass?: React.ComponentType | 'a' | 'button' | 'div' | 'input';
    tooltipContainer?: any;
    isMenuItem?: boolean;
    active?: boolean;
    [propName: string]: any;
}
export {};
