2015-07-23 22:23:11 +08:00
|
|
|
import React from 'react';
|
|
|
|
import Select from 'rc-select';
|
2015-06-09 21:16:59 +08:00
|
|
|
|
2015-09-01 16:18:46 +08:00
|
|
|
let AntSelect = React.createClass({
|
2015-07-24 16:05:56 +08:00
|
|
|
getDefaultProps() {
|
2015-06-15 17:17:23 +08:00
|
|
|
return {
|
2015-06-15 21:18:08 +08:00
|
|
|
prefixCls: 'ant-select',
|
2015-06-16 14:54:31 +08:00
|
|
|
transitionName: 'slide-up',
|
2015-07-22 12:37:20 +08:00
|
|
|
optionLabelProp: 'children',
|
2015-12-02 14:59:48 +08:00
|
|
|
choiceTransitionName: 'zoom',
|
2015-10-22 21:01:52 +08:00
|
|
|
showSearch: false,
|
|
|
|
size: 'default'
|
2015-06-15 17:17:23 +08:00
|
|
|
};
|
|
|
|
},
|
2015-07-24 16:05:56 +08:00
|
|
|
render() {
|
2015-11-12 21:28:02 +08:00
|
|
|
const {size, className, combobox, notFoundContent} = this.props;
|
|
|
|
|
|
|
|
let sizeClass = null;
|
|
|
|
if (size === 'large') {
|
2015-08-10 15:39:50 +08:00
|
|
|
sizeClass = 'ant-select-lg';
|
2015-11-12 21:28:02 +08:00
|
|
|
} else if (size === 'small') {
|
2015-08-10 15:39:50 +08:00
|
|
|
sizeClass = 'ant-select-sm';
|
2015-08-10 13:22:50 +08:00
|
|
|
}
|
2015-11-12 21:28:02 +08:00
|
|
|
|
|
|
|
const classNames = [];
|
|
|
|
|
|
|
|
if (className) {
|
|
|
|
classNames.push(className);
|
|
|
|
}
|
|
|
|
if (sizeClass) {
|
|
|
|
classNames.push(sizeClass);
|
2015-08-23 16:00:05 +08:00
|
|
|
}
|
2015-06-15 17:17:23 +08:00
|
|
|
return (
|
2015-11-12 21:28:02 +08:00
|
|
|
<Select {...this.props} className={classNames.join(' ')} notFoundContent={combobox ? null : notFoundContent} />
|
2015-06-15 17:17:23 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
2015-07-29 12:50:41 +08:00
|
|
|
|
|
|
|
AntSelect.Option = Select.Option;
|
2015-08-01 17:51:55 +08:00
|
|
|
AntSelect.OptGroup = Select.OptGroup;
|
2015-07-29 12:50:41 +08:00
|
|
|
|
|
|
|
export default AntSelect;
|