ant-design/components/collapse/index.tsx

38 lines
913 B
TypeScript
Raw Normal View History

import RcCollapse from 'rc-collapse';
2016-09-21 11:54:53 +08:00
import React from 'react';
2015-07-11 10:17:58 +08:00
2016-06-24 15:20:48 +08:00
export interface CollapseProps {
2016-07-13 11:14:24 +08:00
activeKey?: Array<string> | string;
2016-06-24 15:20:48 +08:00
/** 初始化选中面板的key */
2016-07-13 11:14:24 +08:00
defaultActiveKey?: Array<string>;
2016-06-24 15:20:48 +08:00
/** accordion 为 true 的时候,一次只可以打开一个面板 */
2016-07-13 17:22:23 +08:00
accordion?: boolean;
2016-07-13 11:14:24 +08:00
/** 切换面板的回调 */
2016-07-13 17:22:23 +08:00
onChange?: (key: string) => void;
2016-07-13 11:14:24 +08:00
style?: React.CSSProperties;
2016-06-24 15:20:48 +08:00
}
2016-07-07 20:25:03 +08:00
export interface CollapsePanelProps {
2016-06-24 15:20:48 +08:00
/** 对应 activeKey */
2016-07-13 11:14:24 +08:00
key: string;
/** 面板头内容 */
header: React.ReactNode;
style?: React.CSSProperties;
2016-06-24 15:20:48 +08:00
}
2016-07-07 20:25:03 +08:00
export class CollapsePanel extends React.Component<CollapsePanelProps, {}> {
2016-06-24 15:20:48 +08:00
}
export default class Collapse extends React.Component<CollapseProps, any> {
static Panel: typeof CollapsePanel = RcCollapse.Panel;
static defaultProps = {
prefixCls: 'ant-collapse',
2016-07-13 11:14:24 +08:00
};
2015-07-11 10:17:58 +08:00
render() {
return <RcCollapse {...this.props} />;
2015-07-11 10:17:58 +08:00
}
}