"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),_rcDialog=require("rc-dialog"),_rcDialog2=_interopRequireDefault(_rcDialog),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_addEventListener=require("rc-util/lib/Dom/addEventListener"),_addEventListener2=_interopRequireDefault(_addEventListener),_button=require("../button"),_button2=_interopRequireDefault(_button),_LocaleReceiver=require("../locale-provider/LocaleReceiver"),_LocaleReceiver2=_interopRequireDefault(_LocaleReceiver),_locale=require("./locale");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 mousePosition=void 0,mousePositionEventBinded=void 0,Modal=function(e){function t(){(0,_classCallCheck3.default)(this,t);var l=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return l.handleCancel=function(e){var t=l.props.onCancel;t&&t(e)},l.handleOk=function(e){var t=l.props.onOk;t&&t(e)},l.renderFooter=function(e){var t=l.props,r=t.okText,o=t.okType,n=t.cancelText,i=t.confirmLoading;return React.createElement("div",null,React.createElement(_button2.default,{type:"secondary",onClick:l.handleCancel},n||e.cancelText),React.createElement(_button2.default,{type:o,loading:i,onClick:l.handleOk},r||e.okText))},l}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"componentDidMount",value:function(){mousePositionEventBinded||((0,_addEventListener2.default)(document.documentElement,"click",function(e){mousePosition={x:e.pageX,y:e.pageY},setTimeout(function(){return mousePosition=null},100)}),mousePositionEventBinded=!0)}},{key:"render",value:function(){var e=this.props,t=e.footer,r=e.visible,o=React.createElement(_LocaleReceiver2.default,{componentName:"Modal",defaultLocale:(0,_locale.getConfirmLocale)()},this.renderFooter);return React.createElement(_rcDialog2.default,(0,_extends3.default)({},this.props,{footer:void 0===t?o:t,visible:r,mousePosition:mousePosition,onClose:this.handleCancel}))}}]),t}(React.Component);(exports.default=Modal).defaultProps={prefixCls:"dt-modal",width:550,transitionName:"zoom",maskTransitionName:"fade",confirmLoading:!1,visible:!1,okType:"primary"},Modal.propTypes={prefixCls:PropTypes.string,onOk:PropTypes.func,onCancel:PropTypes.func,okText:PropTypes.node,cancelText:PropTypes.node,width:PropTypes.oneOfType([PropTypes.number,PropTypes.string]),confirmLoading:PropTypes.bool,visible:PropTypes.bool,align:PropTypes.object,footer:PropTypes.node,title:PropTypes.node,closable:PropTypes.bool},module.exports=exports.default;