"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_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),_tooltip=require("../tooltip"),_tooltip2=_interopRequireDefault(_tooltip),_icon=require("../icon"),_icon2=_interopRequireDefault(_icon),_button=require("../button"),_button2=_interopRequireDefault(_button),_LocaleReceiver=require("../locale-provider/LocaleReceiver"),_LocaleReceiver2=_interopRequireDefault(_LocaleReceiver),_default=require("../locale-provider/default"),_default2=_interopRequireDefault(_default);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 i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&(r[i[l]]=e[i[l]])}return r},Popconfirm=function(e){function t(e){(0,_classCallCheck3.default)(this,t);var a=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.onConfirm=function(e){a.setVisible(!1);var t=a.props.onConfirm;t&&t.call(a,e)},a.onCancel=function(e){a.setVisible(!1);var t=a.props.onCancel;t&&t.call(a,e)},a.onVisibleChange=function(e){a.setVisible(e)},a.saveTooltip=function(e){a.tooltip=e},a.renderOverlay=function(e){var t=a.props,r=t.prefixCls,i=t.title,l=t.cancelText,o=t.okText,n=t.okType;return React.createElement("div",null,React.createElement("div",{className:r+"-inner-content-sm"},React.createElement("div",{className:r+"-message"},React.createElement(_icon2.default,{type:"question-circle"}),React.createElement("div",{className:r+"-message-title"},i)),React.createElement("div",{className:r+"-buttons"},React.createElement(_button2.default,{onClick:a.onCancel,size:"mini"},l||e.cancelText),React.createElement(_button2.default,{onClick:a.onConfirm,type:n,size:"mini"},o||e.okText))))},a.state={visible:e.visible},a}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"componentWillReceiveProps",value:function(e){"visible"in e&&this.setState({visible:e.visible})}},{key:"getPopupDomNode",value:function(){return this.tooltip.getPopupDomNode()}},{key:"setVisible",value:function(e){var t=this.props;"visible"in t||this.setState({visible:e});var r=t.onVisibleChange;r&&r(e)}},{key:"render",value:function(){var e=this.props,t=e.prefixCls,r=e.placement,i=__rest(e,["prefixCls","placement"]),l=React.createElement(_LocaleReceiver2.default,{componentName:"Popconfirm",defaultLocale:_default2.default.Popconfirm},this.renderOverlay);return React.createElement(_tooltip2.default,(0,_extends3.default)({},i,{prefixCls:t,placement:r,onVisibleChange:this.onVisibleChange,visible:this.state.visible,overlay:l,ref:this.saveTooltip}))}}]),t}(React.Component);(exports.default=Popconfirm).defaultProps={prefixCls:"dt-popover",transitionName:"zoom-big",placement:"top",trigger:"click",okType:"primary"},module.exports=exports.default;