"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),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),_Input=require("./Input"),_Input2=_interopRequireDefault(_Input),_icon=require("../icon"),_icon2=_interopRequireDefault(_icon),_button=require("../button"),_button2=_interopRequireDefault(_button);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var __rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&(r[n[u]]=e[n[u]])}return r},Search=function(e){function r(){(0,_classCallCheck3.default)(this,r);var t=(0,_possibleConstructorReturn3.default)(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments));return t.onSearch=function(){var e=t.props.onSearch;e&&e(t.input.input.value),t.input.focus()},t.saveInput=function(e){t.input=e},t}return(0,_inherits3.default)(r,e),(0,_createClass3.default)(r,[{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"render",value:function(){var e,t=this.props,r=t.className,n=t.prefixCls,u=t.inputPrefixCls,i=t.size,s=t.enterButton,a=t.suffix,l=__rest(t,["className","prefixCls","inputPrefixCls","size","enterButton","suffix"]);delete l.onSearch;var o=s?React.createElement(_button2.default,{className:n+"-button",type:"primary",size:i,onClick:this.onSearch,key:"enterButton"},!0===s?React.createElement(_icon2.default,{type:"search"}):s):React.createElement(_icon2.default,{className:n+"-icon",type:"search",key:"searchIcon"}),c=a?[a,o]:o,p=(0,_classnames2.default)(n,r,(e={},(0,_defineProperty3.default)(e,n+"-enter-button",!!s),(0,_defineProperty3.default)(e,n+"-"+i,!!i),e));return React.createElement(_Input2.default,(0,_extends3.default)({onPressEnter:this.onSearch},l,{size:i,className:p,prefixCls:u,suffix:c,ref:this.saveInput}))}}]),r}(React.Component);(exports.default=Search).defaultProps={inputPrefixCls:"dt-input",prefixCls:"dt-input-search",enterButton:!1},module.exports=exports.default;