acud
Version:
acg react 组件库
50 lines (49 loc) • 1.75 kB
TypeScript
import * as React from 'react';
export interface ModalFuncProps {
prefixCls?: string;
/** 对话框标题 */
title?: React.ReactNode;
/** 对话框内容 */
content?: React.ReactNode;
/** 点击确定回调 */
onOk?: (e: React.MouseEvent<HTMLElement>) => (void | Promise<any>);
/** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
afterClose?: () => void;
/** 自定义icon */
icon?: React.ReactNode;
/** 弹框宽度 */
width?: number | string;
/** 确认按钮文字 */
okText?: string;
/** 取消按钮文字 */
cancelText?: string;
/** 点击蒙层是否允许关闭 */
maskClosable?: boolean;
/** 是否强制渲染 DialogBox */
forceRender?: boolean;
/** 关闭时是否销毁 DialogBox 里的子元素 */
destroyOnClose?: boolean;
style?: React.CSSProperties;
className?: string;
/** 指定DialogBox挂载的html节点 */
getContainer?: HTMLElement | (() => HTMLElement) | null;
/** 设置 DialogBox 的 z-index */
zIndex?: number;
/** 是否支持键盘 esc 关闭 */
keyboard?: boolean;
/** 自定义关闭图标 */
closeIcon?: React.ReactNode;
/** 是否显示右上角的关闭按钮 */
closable?: boolean;
}
export interface DialogBoxProps extends ModalFuncProps {
/** 是否有取消按钮 */
cancelBtn?: boolean;
onClose?: (...args: any[]) => void;
visible?: boolean;
type: 'confirm' | 'success' | 'info' | 'error' | 'warning';
confirmLoading?: boolean;
}
declare const DialogBox: React.FC<DialogBoxProps>;
export default DialogBox;