UNPKG

2.43 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import { PopupProps } from '../overlay';
5import { CloseMode } from '../dialog';
6import CommonProps from '../util';
7
8interface HTMLAttributesWeak extends PopupProps {
9 title?: any;
10 onClose?: any;
11}
12
13export interface DrawerProps extends HTMLAttributesWeak, CommonProps {
14 /**
15 * [废弃]同closeMode, 控制对话框关闭的方式,值可以为字符串或者布尔值,其中字符串是由以下值组成:
16 * **mask** 表示点击遮罩区域可以关闭对话框
17 * **esc** 表示按下 esc 键可以关闭对话框
18 * 如 'mask' 或 'esc,mask'
19 * 如果设置为 true,则以上关闭方式全部生效
20 * 如果设置为 false,则以上关闭方式全部失效
21 */
22 closeable?: 'close' | 'mask' | 'esc' | boolean | 'close,mask' | 'close,esc' | 'mask,esc';
23 /**
24 * [推荐]控制对话框关闭的方式,值可以为字符串或者数组,其中字符串、数组均为以下值的枚举:
25 * **close** 表示点击关闭按钮可以关闭对话框
26 * **mask** 表示点击遮罩区域可以关闭对话框
27 * **esc** 表示按下 esc 键可以关闭对话框
28 * 如 'close' 或 ['close','esc','mask'], []
29 */
30 closeMode?: CloseMode[] | 'close' | 'mask' | 'esc';
31 /**
32 * 隐藏时是否保留子节点,不销毁
33 */
34 cache?: boolean;
35 /**
36 * 标题
37 */
38 title?: React.ReactNode;
39 /**
40 * body上的样式
41 */
42 bodyStyle?: React.CSSProperties;
43 headerStyle?: React.CSSProperties;
44 /**
45 * 显示隐藏时动画的播放方式
46 * @property {String} in 进场动画
47 * @property {String} out 出场动画
48 */
49 animation?: { in: string; out: string; } | boolean;
50 visible?: boolean;
51
52 /**
53 * 宽度,仅在 placement是 left right 的时候生效
54 */
55 width?: number | string;
56
57 /**
58 * 高度,仅在 placement是 top bottom 的时候生效
59 */
60 height?: number | string;
61 /**
62 * 受控模式下(没有 trigger 的时候),只会在关闭时触发,相当于onClose
63 */
64 onVisibleChange?: (visible: boolean, reason: string) => void;
65 onClose?: (reason: string, e: React.MouseEvent) => void;
66 /**
67 * 位于页面的位置
68 */
69 placement?: 'top' | 'right' | 'bottom' | 'left';
70}
71
72export default class Drawer extends React.Component<DrawerProps, any> {
73}