ant-design/components/tree-select/index.jsx

48 lines
1.1 KiB
React
Raw Normal View History

2015-12-28 19:16:02 +08:00
import React from 'react';
import TreeSelect, { TreeNode } from 'rc-tree-select';
import classNames from 'classnames';
2015-12-31 14:38:35 +08:00
// import animation from '../common/openAnimation';
2015-12-28 19:16:02 +08:00
const AntTreeSelect = React.createClass({
getDefaultProps() {
return {
2015-12-31 14:38:35 +08:00
prefixCls: 'ant-tree-select',
2015-12-28 19:16:02 +08:00
transitionName: 'slide-up',
choiceTransitionName: 'zoom',
showSearch: false,
2016-01-07 19:05:55 +08:00
// openAnimation: animation,
2015-12-28 19:16:02 +08:00
};
},
render() {
const props = this.props;
let {
size, className, combobox, notFoundContent
} = this.props;
const cls = classNames({
'ant-tree-select-lg': size === 'large',
'ant-tree-select-sm': size === 'small',
2015-12-28 19:16:02 +08:00
[className]: !!className,
});
if (combobox) {
notFoundContent = null;
}
2015-12-31 14:38:35 +08:00
let checkable = props.treeCheckable;
2015-12-28 19:16:02 +08:00
if (checkable) {
2015-12-31 14:38:35 +08:00
checkable = <span className={`${props.prefixCls}-tree-checkbox-inner`}></span>;
2015-12-28 19:16:02 +08:00
}
return (
<TreeSelect {...this.props}
2015-12-31 14:38:35 +08:00
treeCheckable={checkable}
2015-12-28 19:16:02 +08:00
className={cls}
notFoundContent={notFoundContent} />
);
}
});
AntTreeSelect.TreeNode = TreeNode;
export default AntTreeSelect;