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

50 lines
1.2 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',
optionLabelProp: 'value',
choiceTransitionName: 'zoom',
showSearch: false,
2016-01-07 19:05:55 +08:00
size: 'default',
// 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-select-lg': size === 'large',
'ant-select-sm': size === 'small',
[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;