"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _react=require("react"),React=_interopRequireWildcard(_react),_createReactClass=require("create-react-class"),_createReactClass2=_interopRequireDefault(_createReactClass),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_KeyCode=require("rc-util/es/KeyCode"),_KeyCode2=_interopRequireDefault(_KeyCode),_CalendarHeader=require("./calendar/CalendarHeader"),_CalendarHeader2=_interopRequireDefault(_CalendarHeader),_CalendarFooter=require("./calendar/CalendarFooter"),_CalendarFooter2=_interopRequireDefault(_CalendarFooter),_CalendarMixin=require("./mixin/CalendarMixin"),_CalendarMixin2=_interopRequireDefault(_CalendarMixin),_CommonMixin=require("./mixin/CommonMixin"),_CommonMixin2=_interopRequireDefault(_CommonMixin);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var a={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=e[r]);return a.default=e,a}var MonthCalendar=(0,_createReactClass2.default)({displayName:"MonthCalendar",propTypes:{monthCellRender:PropTypes.func,dateCellRender:PropTypes.func},mixins:[_CommonMixin2.default,_CalendarMixin2.default],getInitialState:function(){return{mode:"month"}},onKeyDown:function(e){var a=e.keyCode,r=e.ctrlKey||e.metaKey,t=this.state.value,n=this.props.disabledDate,l=t;switch(a){case _KeyCode2.default.DOWN:(l=t.clone()).add(3,"months");break;case _KeyCode2.default.UP:(l=t.clone()).add(-3,"months");break;case _KeyCode2.default.LEFT:l=t.clone(),r?l.add(-1,"years"):l.add(-1,"months");break;case _KeyCode2.default.RIGHT:l=t.clone(),r?l.add(1,"years"):l.add(1,"months");break;case _KeyCode2.default.ENTER:return n&&n(t)||this.onSelect(t),e.preventDefault(),1;default:return}if(l!==t)return this.setValue(l),e.preventDefault(),1},handlePanelChange:function(e,a){"date"!==a&&this.setState({mode:a})},render:function(){var e=this.props,a=this.state,r=a.mode,t=a.value,n=React.createElement("div",{className:e.prefixCls+"-month-calendar-content"},React.createElement("div",{className:e.prefixCls+"-month-header-wrap"},React.createElement(_CalendarHeader2.default,{prefixCls:e.prefixCls,mode:r,value:t,locale:e.locale,disabledMonth:e.disabledDate,monthCellRender:e.monthCellRender,monthCellContentRender:e.monthCellContentRender,onMonthSelect:this.onSelect,onValueChange:this.setValue,onPanelChange:this.handlePanelChange})),React.createElement(_CalendarFooter2.default,{prefixCls:e.prefixCls,renderFooter:e.renderFooter}));return this.renderRoot({className:e.prefixCls+"-month-calendar",children:n})}});exports.default=MonthCalendar,module.exports=exports.default;