import { ReactNode, CSSProperties, MouseEvent } from 'react'; import { ButtonProps } from '../button'; /** * @title Drawer */ export interface DrawerProps { style?: CSSProperties; className?: string | string[]; /** * 设置抽屉的 zIndex */ zIndex?: number; children?: ReactNode; /** * 设置外层容器的类名 */ wrapClassName?: string | string[]; /** * 弹出框的标题(设置为 null 时,不显示标题栏) */ title?: ReactNode; /** * 自定义按钮确认和取消按钮,为 null 的话没有按钮组 */ footer?: ReactNode; /** * 头部的样式 */ headerStyle?: CSSProperties; /** * 内容区域的样式 */ bodyStyle?: CSSProperties; /** * 设置遮罩层的样式 */ maskStyle?: CSSProperties; /** * 确认按钮文案 */ okText?: ReactNode; /** * 取消按钮文案 */ cancelText?: ReactNode; /** * 确认按钮的 props */ okButtonProps?: ButtonProps; /** * 取消按钮的 props */ cancelButtonProps?: ButtonProps; /** * 抽屉的方向 `top` `right` `bottom` `left` * @defaultValue right */ placement?: 'top' | 'right' | 'bottom' | 'left'; /** * 抽屉的宽度,`placement`为 `left` `right` 时生效 * @defaultValue 250 */ width?: string | number; /** * 抽屉的高度,`placement`为 `top` `bottom` 时生效 * @defaultValue 250 */ height?: string | number; /** * 按 `ESC` 键关闭 * @defaultValue true */ escToExit?: boolean; /** * 是否显示遮罩 * @defaultValue true */ mask?: boolean; /** * 是否显示弹出框 */ visible?: boolean; /** * 是否显示右上角关闭按钮 * @defaultValue true */ closable?: boolean; /** * 自定义右上角关闭按钮 * @version 2.49.0 */ closeIcon?: ReactNode; /** * 点击蒙层是否可以关闭 * @defaultValue true */ maskClosable?: boolean; /** * 确认按钮是否为加载中状态 */ confirmLoading?: boolean; /** * 是否在初次打开对话框时才渲染 dom。 * @defaultValue true */ mountOnEnter?: boolean; /** * 是否在隐藏的时候销毁 DOM 结构 */ unmountOnExit?: boolean; /** * 点击确认按钮的回调 */ onOk?: (e: Event) => void; /** * 关闭弹出框的回调 */ onCancel?: (e: MouseEvent | Event) => void; /** * 抽屉打开之后的回调 */ afterOpen?: () => void; /** * 抽屉关闭之后的回调 */ afterClose?: () => void; /** * 指定弹出框挂载的父节点 * @defaultValue () => document.body */ getPopupContainer?: () => Element; /** * 抽屉里的弹出框 `Select` `Tooltip` 等挂载的容器,默认挂载在对话框内。 */ getChildrenPopupContainer?: (node: HTMLElement) => Element; /** * 是否默认聚焦第一个可聚焦元素,只在 `focusLock` 开启时生效。 * @defaultValue true */ autoFocus?: boolean; /** * 是否将焦点锁定在弹出框内。 * @defaultValue true */ focusLock?: boolean; }