From a496ecdb5dc66b15b22be54a74e1b3253e9e0a59 Mon Sep 17 00:00:00 2001 From: muxin <434980373@qq.com> Date: Wed, 12 Apr 2023 10:11:31 +0800 Subject: [PATCH] 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 --- components/modal/Modal.tsx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index b369b944a4..4bf98b2f8a 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -36,34 +36,36 @@ if (canUseDocElement()) { } export interface ModalProps { - /** 对话框是否可见 */ + /** Whether the modal dialog is visible or not */ open?: boolean; - /** 确定按钮 loading */ + /** Whether to apply loading visual effect for OK button or not */ confirmLoading?: boolean; - /** 标题 */ + /** The modal dialog's title */ title?: React.ReactNode; - /** 是否显示右上角的关闭按钮 */ + /** Whether a close (x) button is visible on top right of the modal dialog or not */ closable?: boolean; - /** 点击确定回调 */ + /** Specify a function that will be called when a user clicks the OK button */ onOk?: (e: React.MouseEvent) => 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) => void; afterClose?: () => void; - /** 垂直居中 */ + /** Callback when the animation ends when Modal is turned on and off */ + afterOpenChange?: (open: boolean) => void; + /** Centered Modal */ centered?: boolean; - /** 宽度 */ + /** Width of the modal dialog */ width?: string | number; - /** 底部内容 */ + /** Footer content */ footer?: React.ReactNode; - /** 确认按钮文字 */ + /** Text of the OK button */ okText?: React.ReactNode; - /** 确认按钮类型 */ + /** Button `type` of the OK button */ okType?: LegacyButtonType; - /** 取消按钮文字 */ + /** Text of the Cancel button */ cancelText?: React.ReactNode; - /** 点击蒙层是否允许关闭 */ + /** Whether to close the modal dialog when the mask (area outside the modal) is clicked */ maskClosable?: boolean; - /** 强制渲染 Modal */ + /** Force render Modal */ forceRender?: boolean; okButtonProps?: ButtonProps; cancelButtonProps?: ButtonProps;