fix: optimize the type definition of Modal (#41742)

* fix: optimize modal type

* test: update test

* test: update test

* fix: funcModal do not support afterOPenChange

* fix: funcModal do not support afterOPenChange1

* docs: use en exegesis

* docs: use en exegesis
This commit is contained in:
muxin 2023-04-12 10:11:31 +08:00 committed by GitHub
parent 96311fe443
commit a496ecdb5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,34 +36,36 @@ if (canUseDocElement()) {
} }
export interface ModalProps { export interface ModalProps {
/** 对话框是否可见 */ /** Whether the modal dialog is visible or not */
open?: boolean; open?: boolean;
/** 确定按钮 loading */ /** Whether to apply loading visual effect for OK button or not */
confirmLoading?: boolean; confirmLoading?: boolean;
/** 标题 */ /** The modal dialog's title */
title?: React.ReactNode; title?: React.ReactNode;
/** 是否显示右上角的关闭按钮 */ /** Whether a close (x) button is visible on top right of the modal dialog or not */
closable?: boolean; closable?: boolean;
/** 点击确定回调 */ /** Specify a function that will be called when a user clicks the OK button */
onOk?: (e: React.MouseEvent<HTMLButtonElement>) => void; onOk?: (e: React.MouseEvent<HTMLButtonElement>) => void;
/** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */ /** Specify a function that will be called when a user clicks mask, close button on top right or Cancel button */
onCancel?: (e: React.MouseEvent<HTMLButtonElement>) => void; onCancel?: (e: React.MouseEvent<HTMLButtonElement>) => void;
afterClose?: () => void; afterClose?: () => void;
/** 垂直居中 */ /** Callback when the animation ends when Modal is turned on and off */
afterOpenChange?: (open: boolean) => void;
/** Centered Modal */
centered?: boolean; centered?: boolean;
/** 宽度 */ /** Width of the modal dialog */
width?: string | number; width?: string | number;
/** 底部内容 */ /** Footer content */
footer?: React.ReactNode; footer?: React.ReactNode;
/** 确认按钮文字 */ /** Text of the OK button */
okText?: React.ReactNode; okText?: React.ReactNode;
/** 确认按钮类型 */ /** Button `type` of the OK button */
okType?: LegacyButtonType; okType?: LegacyButtonType;
/** 取消按钮文字 */ /** Text of the Cancel button */
cancelText?: React.ReactNode; cancelText?: React.ReactNode;
/** 点击蒙层是否允许关闭 */ /** Whether to close the modal dialog when the mask (area outside the modal) is clicked */
maskClosable?: boolean; maskClosable?: boolean;
/** 强制渲染 Modal */ /** Force render Modal */
forceRender?: boolean; forceRender?: boolean;
okButtonProps?: ButtonProps; okButtonProps?: ButtonProps;
cancelButtonProps?: ButtonProps; cancelButtonProps?: ButtonProps;