UNPKG

1.74 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5
6interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
7 title?: any;
8}
9
10export interface PanelProps extends HTMLAttributesWeak, CommonProps {
11 /**
12 * 样式类名的品牌前缀
13 */
14 prefix?: string;
15
16 /**
17 * 子组件接受行内样式
18 */
19 style?: React.CSSProperties;
20
21 /**
22 * 是否禁止用户操作
23 */
24 disabled?: boolean;
25
26 /**
27 * 标题
28 */
29 title?: React.ReactNode;
30
31 /**
32 * 扩展class
33 */
34 className?: string;
35}
36
37export class Panel extends React.Component<PanelProps, any> {}
38
39type data = {
40 title?: React.ReactNode;
41 content?: React.ReactNode;
42 disabled?: boolean;
43 key?: string;
44 [propName: string]: any;
45}
46
47export interface CollapseProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
48 /**
49 * 样式前缀
50 */
51 prefix?: string;
52
53 /**
54 * 组件接受行内样式
55 */
56 style?: React.CSSProperties;
57
58 /**
59 * 使用数据模型构建
60 */
61 dataSource?: Array<data>;
62
63 /**
64 * 默认展开keys
65 */
66 defaultExpandedKeys?: Array<string>;
67
68 /**
69 * 受控展开keys
70 */
71 expandedKeys?: Array<string>;
72
73 /**
74 * 展开状态发升变化时候的回调
75 */
76 onExpand?: (expandedKeys: Array<string>) => void;
77
78 /**
79 * 所有禁用
80 */
81 disabled?: boolean;
82
83 /**
84 * 扩展class
85 */
86 className?: string;
87
88 /**
89 * 手风琴模式,一次只能打开一个
90 */
91 accordion?: boolean;
92}
93
94export default class Collapse extends React.Component<CollapseProps, any> {
95 static Panel: typeof Panel;
96}