UNPKG

3.41 kBTypeScriptView Raw
1import * as React from 'react';
2import useModal from './useModal';
3import { LegacyButtonType, ButtonProps } from '../button/button';
4import { DirectionType } from '../config-provider';
5export declare const destroyFns: Array<() => void>;
6export interface ModalProps {
7 /** 对话框是否可见 */
8 visible?: boolean;
9 /** 确定按钮 loading */
10 confirmLoading?: boolean;
11 /** 标题 */
12 title?: React.ReactNode | string;
13 /** 是否显示右上角的关闭按钮 */
14 closable?: boolean;
15 /** 点击确定回调 */
16 onOk?: (e: React.MouseEvent<HTMLElement>) => void;
17 /** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
18 onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
19 afterClose?: () => void;
20 /** 垂直居中 */
21 centered?: boolean;
22 /** 宽度 */
23 width?: string | number;
24 /** 底部内容 */
25 footer?: React.ReactNode;
26 /** 确认按钮文字 */
27 okText?: React.ReactNode;
28 /** 确认按钮类型 */
29 okType?: LegacyButtonType;
30 /** 取消按钮文字 */
31 cancelText?: React.ReactNode;
32 /** 点击蒙层是否允许关闭 */
33 maskClosable?: boolean;
34 /** 强制渲染 Modal */
35 forceRender?: boolean;
36 okButtonProps?: ButtonProps;
37 cancelButtonProps?: ButtonProps;
38 destroyOnClose?: boolean;
39 style?: React.CSSProperties;
40 wrapClassName?: string;
41 maskTransitionName?: string;
42 transitionName?: string;
43 className?: string;
44 getContainer?: string | HTMLElement | getContainerFunc | false | null;
45 zIndex?: number;
46 bodyStyle?: React.CSSProperties;
47 maskStyle?: React.CSSProperties;
48 mask?: boolean;
49 keyboard?: boolean;
50 wrapProps?: any;
51 prefixCls?: string;
52 closeIcon?: React.ReactNode;
53 modalRender?: (node: React.ReactNode) => React.ReactNode;
54 focusTriggerAfterClose?: boolean;
55}
56declare type getContainerFunc = () => HTMLElement;
57export interface ModalFuncProps {
58 prefixCls?: string;
59 className?: string;
60 visible?: boolean;
61 title?: React.ReactNode;
62 closable?: boolean;
63 content?: React.ReactNode;
64 onOk?: (...args: any[]) => any;
65 onCancel?: (...args: any[]) => any;
66 afterClose?: () => void;
67 okButtonProps?: ButtonProps;
68 cancelButtonProps?: ButtonProps;
69 centered?: boolean;
70 width?: string | number;
71 okText?: React.ReactNode;
72 okType?: LegacyButtonType;
73 cancelText?: React.ReactNode;
74 icon?: React.ReactNode;
75 mask?: boolean;
76 maskClosable?: boolean;
77 zIndex?: number;
78 okCancel?: boolean;
79 style?: React.CSSProperties;
80 maskStyle?: React.CSSProperties;
81 type?: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm';
82 keyboard?: boolean;
83 getContainer?: string | HTMLElement | getContainerFunc | false | null;
84 autoFocusButton?: null | 'ok' | 'cancel';
85 transitionName?: string;
86 maskTransitionName?: string;
87 direction?: DirectionType;
88 bodyStyle?: React.CSSProperties;
89 closeIcon?: React.ReactNode;
90 modalRender?: (node: React.ReactNode) => React.ReactNode;
91 focusTriggerAfterClose?: boolean;
92}
93export interface ModalLocale {
94 okText: string;
95 cancelText: string;
96 justOkText: string;
97}
98interface ModalInterface extends React.FC<ModalProps> {
99 useModal: typeof useModal;
100}
101declare const Modal: ModalInterface;
102export default Modal;