You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

9 years ago
import React from 'react';
import RcTreeSelect, { TreeNode, SHOW_ALL, SHOW_PARENT, SHOW_CHILD } from 'rc-tree-select';
9 years ago
import classNames from 'classnames';
export default class TreeSelect extends React.Component {
9 years ago
render() {
const props = this.props;
let {
size, className, combobox, notFoundContent, prefixCls
9 years ago
} = this.props;
const cls = classNames({
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
9 years ago
[className]: !!className,
});
if (combobox) {
notFoundContent = null;
}
9 years ago
let checkable = props.treeCheckable;
9 years ago
if (checkable) {
checkable = <span className={`${prefixCls}-tree-checkbox-inner`}></span>;
9 years ago
}
return (
<RcTreeSelect {...this.props}
9 years ago
treeCheckable={checkable}
9 years ago
className={cls}
notFoundContent={notFoundContent} />
);
}
}
9 years ago
TreeSelect.defaultProps = {
prefixCls: 'ant-select',
transitionName: 'slide-up',
choiceTransitionName: 'zoom',
showSearch: false,
};
TreeSelect.TreeNode = TreeNode;
TreeSelect.SHOW_ALL = SHOW_ALL;
TreeSelect.SHOW_PARENT = SHOW_PARENT;
TreeSelect.SHOW_CHILD = SHOW_CHILD;