2015-07-23 22:23:11 +08:00
|
|
|
import React from 'react';
|
2016-03-21 09:22:14 +08:00
|
|
|
import RcSelect, { Option, OptGroup } from 'rc-select';
|
2015-12-06 17:13:06 +08:00
|
|
|
import classNames from 'classnames';
|
2015-06-09 21:16:59 +08:00
|
|
|
|
2016-03-21 09:22:14 +08:00
|
|
|
export default class Select extends React.Component {
|
2016-03-29 14:01:10 +08:00
|
|
|
static Option = Option;
|
|
|
|
static OptGroup = OptGroup;
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
prefixCls: 'ant-select',
|
|
|
|
transitionName: 'slide-up',
|
|
|
|
optionLabelProp: 'children',
|
|
|
|
choiceTransitionName: 'zoom',
|
|
|
|
showSearch: false,
|
|
|
|
}
|
|
|
|
|
2015-07-24 16:05:56 +08:00
|
|
|
render() {
|
2015-12-06 17:13:06 +08:00
|
|
|
let {
|
2016-04-27 20:44:36 +08:00
|
|
|
size, className, combobox, notFoundContent, prefixCls, showSearch,
|
2015-12-06 17:13:06 +08:00
|
|
|
} = this.props;
|
2015-11-12 21:28:02 +08:00
|
|
|
|
2015-12-06 17:13:06 +08:00
|
|
|
const cls = classNames({
|
2016-04-06 15:50:58 +08:00
|
|
|
[`${prefixCls}-lg`]: size === 'large',
|
|
|
|
[`${prefixCls}-sm`]: size === 'small',
|
2015-12-06 17:13:06 +08:00
|
|
|
[className]: !!className,
|
2016-04-27 20:44:36 +08:00
|
|
|
[`${prefixCls}-show-search`]: showSearch,
|
2015-12-06 17:13:06 +08:00
|
|
|
});
|
2015-11-12 21:28:02 +08:00
|
|
|
|
2015-12-06 17:13:06 +08:00
|
|
|
if (combobox) {
|
|
|
|
notFoundContent = null;
|
2015-08-23 16:00:05 +08:00
|
|
|
}
|
2015-12-06 17:13:06 +08:00
|
|
|
|
2015-06-15 17:17:23 +08:00
|
|
|
return (
|
2016-03-21 09:22:14 +08:00
|
|
|
<RcSelect {...this.props}
|
2015-12-06 17:13:06 +08:00
|
|
|
className={cls}
|
|
|
|
notFoundContent={notFoundContent} />
|
2015-06-15 17:17:23 +08:00
|
|
|
);
|
|
|
|
}
|
2016-03-21 09:22:14 +08:00
|
|
|
}
|