import _extends from"babel-runtime/helpers/extends";import*as React from"react";import createReactClass from"create-react-class";import*as PropTypes from"prop-types";import CalendarHeader from"../calendar/CalendarHeader";import DateTable from"../date/DateTable";import DateInput from"../date/DateInput";import{getTimeConfig}from"../util/index";var CalendarPart=createReactClass({displayName:"CalendarPart",propTypes:{prefixCls:PropTypes.string,value:PropTypes.any,hoverValue:PropTypes.any,selectedValue:PropTypes.any,direction:PropTypes.any,locale:PropTypes.any,showDateInput:PropTypes.bool,showTimePicker:PropTypes.bool,format:PropTypes.any,placeholder:PropTypes.any,disabledDate:PropTypes.any,timePicker:PropTypes.any,disabledTime:PropTypes.any,onInputSelect:PropTypes.func,timePickerDisabledTime:PropTypes.object,enableNext:PropTypes.any,enablePrev:PropTypes.any},render:function(){var e=this.props,a=e.prefixCls,t=e.value,r=e.hoverValue,l=e.selectedValue,o=e.mode,n=e.direction,s=e.locale,p=e.format,i=e.placeholder,d=e.disabledDate,c=e.timePicker,m=e.disabledTime,y=e.timePickerDisabledTime,u=e.showTimePicker,P=e.onInputSelect,T=e.enablePrev,b=e.enableNext,h=u&&c,f=h&&m?getTimeConfig(l,m):null,C=a+"-range",v={locale:s,value:t,prefixCls:a,showTimePicker:u},D="left"===n?0:1,x=h&&React.cloneElement(c,_extends({showHour:!0,showMinute:!0,showSecond:!0},c.props,f,y,{onChange:P,defaultOpenValue:t,value:l[D]})),R=e.showDateInput&&React.createElement(DateInput,{format:p,locale:s,prefixCls:a,timePicker:c,disabledDate:d,placeholder:i,disabledTime:m,value:t,showClear:!1,selectedValue:l[D],onChange:P});return React.createElement("div",{className:C+"-part "+C+"-"+n},R,React.createElement("div",{style:{outline:"none"}},React.createElement(CalendarHeader,_extends({},v,{mode:o,enableNext:b,enablePrev:T,onValueChange:e.onValueChange,onPanelChange:e.onPanelChange,disabledMonth:e.disabledMonth})),u?React.createElement("div",{className:a+"-time-picker"},React.createElement("div",{className:a+"-time-picker-panel"},x)):null,React.createElement("div",{className:a+"-body"},React.createElement(DateTable,_extends({},v,{hoverValue:r,selectedValue:l,dateRender:e.dateRender,onSelect:e.onSelect,onDayHover:e.onDayHover,disabledDate:d,showWeekNumber:e.showWeekNumber})))))}});export default CalendarPart;