ant-design/components/tree/index.jsx

27 lines
637 B
React
Raw Normal View History

2015-08-03 16:07:21 +08:00
import React from 'react';
2015-08-03 16:11:56 +08:00
import Tree from 'rc-tree';
2015-08-25 11:11:21 +08:00
import animation from '../common/openAnimation';
const AntTree = React.createClass({
2015-08-05 17:38:02 +08:00
getDefaultProps() {
return {
2015-08-19 12:18:10 +08:00
prefixCls: 'ant-tree',
checkable: false,
showIcon: false,
2015-08-05 17:38:02 +08:00
};
},
2015-08-03 16:07:21 +08:00
render() {
2015-08-19 12:18:10 +08:00
const props = this.props;
let checkable = props.checkable;
if (checkable) {
checkable = <span className={`${props.prefixCls}-checkbox-inner`}></span>;
}
2015-08-24 18:28:00 +08:00
return <Tree openAnimation={animation} {...props} checkable={checkable}>
2015-08-03 16:07:21 +08:00
{this.props.children}
2015-08-03 16:11:56 +08:00
</Tree>;
2015-08-03 16:07:21 +08:00
}
});
AntTree.TreeNode = Tree.TreeNode;
export default AntTree;