"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_rcSelect=require("rc-select"),_rcSelect2=_interopRequireDefault(_rcSelect),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),_LocaleReceiver=require("../locale-provider/LocaleReceiver"),_LocaleReceiver2=_interopRequireDefault(_LocaleReceiver),_default=require("../locale-provider/default"),_default2=_interopRequireDefault(_default),_icon=require("../icon"),_icon2=_interopRequireDefault(_icon);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var __rest=function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)r.indexOf(o[l])<0&&(t[o[l]]=e[o[l]])}return t},SelectPropTypes={prefixCls:PropTypes.string,className:PropTypes.string,size:PropTypes.oneOf(["default","large","small"]),combobox:PropTypes.bool,notFoundContent:PropTypes.any,showSearch:PropTypes.bool,optionLabelProp:PropTypes.string,transitionName:PropTypes.string,choiceTransitionName:PropTypes.string},Select=function(e){function r(){(0,_classCallCheck3.default)(this,r);var b=(0,_possibleConstructorReturn3.default)(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments));return b.saveSelect=function(e){b.rcSelect=e},b.renderSelect=function(e){var r,t=b.props,o=t.prefixCls,l=t.className,a=void 0===l?"":l,n=t.size,s=t.mode,c=t.removeIcon,i=t.clearIcon,u=__rest(t,["prefixCls","className","size","mode","removeIcon","clearIcon"]),p=(0,_classnames2.default)((r={},(0,_defineProperty3.default)(r,o+"-lg","large"===n),(0,_defineProperty3.default)(r,o+"-sm","small"===n),r),a),_=b.props.optionLabelProp,f="combobox"===s;f&&(_=_||"value");var d={multiple:"multiple"===s,tags:"tags"===s,combobox:f},m=c&&(React.isValidElement(c)?React.cloneElement(c,{className:(0,_classnames2.default)(c.props.className,o+"-remove-icon")}):c)||React.createElement(_icon2.default,{type:"close",className:o+"-remove-icon"}),y=i&&(React.isValidElement(i)?React.cloneElement(i,{className:(0,_classnames2.default)(i.props.className,o+"-clear-icon")}):i)||React.createElement(_icon2.default,{type:"close-circle",className:o+"-clear-icon"});return React.createElement(_rcSelect2.default,(0,_extends3.default)({removeIcon:m,clearIcon:y},u,d,{prefixCls:o,className:p,optionLabelProp:_||"children",notFoundContent:b.getNotFoundContent(e),ref:b.saveSelect}))},b}return(0,_inherits3.default)(r,e),(0,_createClass3.default)(r,[{key:"focus",value:function(){this.rcSelect.focus()}},{key:"blur",value:function(){this.rcSelect.blur()}},{key:"getNotFoundContent",value:function(e){var r=this.props,t=r.notFoundContent;return"combobox"===r.mode?void 0===t?null:t:void 0===t?e.notFoundContent:t}},{key:"render",value:function(){return React.createElement(_LocaleReceiver2.default,{componentName:"Select",defaultLocale:_default2.default.Select},this.renderSelect)}}]),r}(React.Component);(exports.default=Select).Option=_rcSelect.Option,Select.OptGroup=_rcSelect.OptGroup,Select.defaultProps={prefixCls:"dt-select",showSearch:!1,transitionName:"slide-up",choiceTransitionName:"zoom"},Select.propTypes=SelectPropTypes,module.exports=exports.default;