/**
* Kendo UI v2018.1.117 (http://www.telerik.com/kendo-ui)
* Copyright 2018 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(t,define){define("kendo.scheduler.monthview.min",["kendo.scheduler.view.min"],t)}(function(){return function(t){function e(t,e){return t.slice(e).concat(t.slice(0,e))}function n(t,e){for(var n=e.firstDay,o=new Date(t.getFullYear(),t.getMonth(),0,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());o.getDay()!=n;)i.date.setTime(o,-1*u);return o}function o(t,e,n){var o,i=e,r=n;return o=t,o>=i&&o<=r}var i=window.kendo,r=i.ui,s=r.SchedulerView,a=".kendoMonthView",l=t.extend,d=i.date.getDate,u=i.date.MS_PER_DAY,c=6,h=7,f=i.template('#:kendo.toString(date, "dd")#'),_='
# if(data.tail || data.middle) {##}## if(data.isException()) {## } else if(data.isRecurring()) {##}#{0}
#if (showDelete) {##}## if(data.head || data.middle) {##}## if(resizable && !data.tail && !data.middle) {#
#}## if(resizable && !data.head && !data.middle) {#
#}#
',p=i.template(''),v=i.template('...
'),g=i.Class.extend({init:function(t){this._view=t},_verticalRowCountForLevel:function(t){var e=this._view;return e._rowCountForLevel(t)},_horizontalGroupCountForLevel:function(t){var e=this._view;return e._columnCountForLevel(t)},_getCalendarRowsLength:function(t,e){return e/t},_createRows:function(t,e,n,o){var i,r=this._view,s=h,a=r._isVerticallyGrouped(),l="";for(i=0;i1&&(0===s?r=n.end.endDate():s==o-1?i=n.start.startDate():(i=n.start.startDate(),r=n.end.endDate())),a=t.clone({start:i,end:r,head:n.head,tail:n.tail}),d?l._positionMobileEvent(n,l._createEventElement(a),e):l._positionEvent(n,l._createEventElement(a),e)},_addDaySlotCollections:function(t,e,n){var o,r,s,a,l,d,u,f,_,p,v,g=this._view,m=h,y=c;for(o=0;o=0)return o[i]._slots[o[i]._slots.length-1]}else if(o=s._getCollections(s.daySlotCollectionCount()),i=e.collectionIndex+1,r=0,o[i]&&o[i]._slots[r])return o[i]._slots[r]},_getNextHorizontalRange:function(t,e,n){var o=this._isVerticallyGrouped();return n.startSlot=t[e](n.startSlot,o),n.endSlot=t[e](n.endSlot,o),n},_getNextVerticalRange:function(t,e,n,o){var i=this._isVerticallyGrouped()&&this._isGroupedByDate();return n.startSlot=t[e](n.startSlot,o,i),n.endSlot=t[e](n.endSlot,o,i),n},_changeViewPeriod:function(t,e,n){var o,r,s=n?7:1;return e&&(s*=-1),o=i.date.addDays(t.start,s),r=i.date.addDays(t.end,s),!this._isInRange(o,r)&&(t.start=o,t.end=r,(!n||n&&this._isVerticallyGrouped())&&(t.groupIndex=this._groupedView._changePeriodGroupIndex(e,n,t.groupIndex)),t.events=[],!0)},_continuousSlot:function(t,e,n){var o=t.backward?0:e.length-1,i=this.groups[t.groupIndex];return i.continuousSlot(e[o].start,n)},_changeGroupContinuously:function(t,e,n,o){var i,r,s,a;return n||(i=t.groupIndex,r=this.groups.length-1,s=this._isVerticallyGrouped(),a=this.groups[i],!e&&s?(e=a[o?"lastSlot":"firstSlot"](),i+=o?-1:1):e&&!s&&(i=o?r:0),(i<0||i>r)&&(i=o?r:0,e=null),t.groupIndex=i),e},_normalizeHorizontalSelection:function(t,e,n){var o;return o=n?e[0].start:e[e.length-1].end},_normalizeVerticalSelection:function(t,e){var n;return n=t.backward?e[0].start:e[e.length-1].end},_templates:function(){var t=this.options,e=l({},i.Template,t.templateSettings);this.eventTemplate=this._eventTmpl(t.eventTemplate,_),this.dayTemplate=i.template(t.dayTemplate,e),this.groupHeaderTemplate=i.template(t.groupHeaderTemplate,e)},dateForTitle:function(){return i.format(this.options.selectedDateFormat,this._firstDayOfMonth,this._lastDayOfMonth)},shortDateForTitle:function(){return i.format(this.options.selectedShortDateFormat,this._firstDayOfMonth,this._lastDayOfMonth)},nextDate:function(){return i.date.nextDay(this._lastDayOfMonth)},previousDate:function(){return i.date.previousDay(this._firstDayOfMonth)},startDate:function(){return this._startDate},endDate:function(){return this._endDate},_renderLayout:function(e){var o=this;this._firstDayOfMonth=i.date.firstDayOfMonth(e),this._lastDayOfMonth=i.date.lastDayOfMonth(e),this._startDate=n(e,this.calendarInfo()),this.createLayout(this._layout()),this._content(),this.refreshLayout(),this.content.on("click"+a,".k-nav-day,.k-more-events",function(e){var n=t(e.currentTarget).offset(),i=o._slotByPosition(n.left,n.top);e.preventDefault(),o.trigger("navigate",{view:"day",date:i.startDate()})})},_editable:function(){this.options.editable&&!this._isMobilePhoneView()&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var e=this;e.element.on("click"+a,".k-scheduler-monthview .k-event a:has(.k-i-close)",function(n){e.trigger("remove",{uid:t(this).closest(".k-event").attr(i.attr("uid"))}),n.preventDefault()}),e.options.editable.create!==!1&&e.element.on("dblclick"+a,".k-scheduler-monthview .k-scheduler-content td",function(n){var o,i=t(n.currentTarget).offset(),r=e._slotByPosition(i.left,i.top);r&&(o=e._resourceBySlot(r),e.trigger("add",{eventInfo:l({isAllDay:!0,start:r.startDate(),end:r.startDate()},o)})),n.preventDefault()}),e.options.editable.update!==!1&&e.element.on("dblclick"+a,".k-scheduler-monthview .k-event",function(n){e.trigger("edit",{uid:t(this).closest(".k-event").attr(i.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var e=this,n=0;i.support.mobileOS.android&&(n=5),e.options.editable.create!==!1&&(e._addUserEvents=new i.UserEvents(e.element,{threshold:n,filter:".k-scheduler-monthview .k-scheduler-content td",tap:function(n){var o,i=t(n.target).offset(),r=e._slotByPosition(i.left,i.top);r&&(o=e._resourceBySlot(r),e.trigger("add",{eventInfo:l({isAllDay:!0,start:r.startDate(),end:r.startDate()},o)})),n.preventDefault()}})),e.options.editable.update!==!1&&(e._editUserEvents=new i.UserEvents(e.element,{threshold:n,filter:".k-scheduler-monthview .k-event",tap:function(n){0===t(n.event.target).closest("a:has(.k-i-close)").length&&(e.trigger("edit",{uid:t(n.target).closest(".k-event").attr(i.attr("uid"))}),n.preventDefault())}}))},selectionByElement:function(e){var n=t(e).offset();return this._slotByPosition(n.left,n.top)},_columnCountForLevel:function(t){var e=this.columnLevels[t];return e?e.length:0},_rowCountForLevel:function(t){var e=this.rowLevels[t];return e?e.length:0},_content:function(){var t,e="",n=1,o=this._groupedView,i=this.groupedResources;for(i.length&&this._isVerticallyGrouped()&&(n=o._verticalRowCountForLevel(i.length-1)),t=0;t",this.content.find("table").html(e)},_createCalendar:function(t){var e,n,o,r=this.startDate(),s=h*c,a=h,l=[r],d="",u=1,f=this._isVerticallyGrouped(),_=this._groupedView,p=this.groupedResources;for(p.length&&(f||(u=_._horizontalGroupCountForLevel(p.length-1))),this._slotIndices={},e=_._getCalendarRowsLength(a,s),n=0;n",l.push(r),o=n*a,d+=_._createRows(r,o,u,t),r=_._adjustStartDate(r,n===e-1),d+="";return this._weekStartDates=l,this._endDate=i.date.previousDay(r),d},_createRow:function(t,e,n,o){var r,s=this,a=s._firstDayOfMonth,l=s._lastDayOfMonth,u=s.dayTemplate,c="",h="",f=this._groupedView,_=function(){return s._resourceBySlot({groupIndex:o})};for(r=0;r",h+=f._getContent(u,t,_,r),h+="",s._slotIndices[d(t).getTime()]=e+r,t=f._nextSlotStartDate(t);return h},_layout:function(){var n,o,i,r=this.calendarInfo(),s=this._isMobile()?r.days.namesShort:r.days.names,a=e(s,r.firstDay),l=t.map(a,function(t){return{text:t}}),d=this.groupedResources,u=this._groupedView;if(d.length)if(this._isVerticallyGrouped()){for(o=[],i=0;i<6;i++)o.push({text:"
",className:"k-hidden k-slot-cell"});n=u._createRowsLayout(d,o,this.groupHeaderTemplate,l),l=u._createVerticalColumnsLayout(d,o,this.groupHeaderTemplate,l)}else l=u._createColumnsLayout(d,l,this.groupHeaderTemplate,l);return{columns:l,rows:n}},_createEventElement:function(e){var n,o=this.options,r=o.editable,s=this._isMobile();return e.showDelete=r&&r.destroy!==!1&&!s,e.resizable=r&&r.resize!==!1&&!s,e.ns=i.ns,e.resources=this.eventResources(e),e.inverseColor=!(!e.resources||!e.resources[0])&&this._shouldInverseResourceColor(e.resources[0]),e.messages=o.messages||{destroy:"Delete"},n=t(this.eventTemplate(e)),this.angular("compile",function(){return{elements:n,data:[{dataItem:e}]}}),n},_isInDateSlot:function(t){var e=this.groups[0],n=e.firstSlot().start,r=e.lastSlot().end-1,s=i.date.toUtcTime(t.start),a=i.date.toUtcTime(t.end);return(o(s,n,r)||o(a,n,r)||o(n,s,a)||o(r,s,a))&&(!o(a,n,n)||o(a,s,s)||t.isAllDay)},_slotIndex:function(t){return this._slotIndices[d(t).getTime()]},_positionMobileEvent:function(e,n,o){var r,a,l,d,u,c,h,f=e.start;e.start.offsetLeft>e.end.offsetLeft&&(f=e.end),r=e.start.index,a=r,l=3,d=s.collidingEvents(e.events(),r,a),d.push({element:n,start:r,end:a}),u=s.createRows(d),c=e.collection.at(r),h=c.container,h||(h=t(i.format('',f.offsetTop+f.firstChildTop+f.firstChildHeight+"px",f.offsetLeft+"px",f.offsetWidth+"px")),c.container=h,this.content[0].appendChild(h[0])),u.length<=l&&(e.addEvent({element:n,start:r,end:a,groupIndex:f.groupIndex}),o._continuousEvents.push({element:n,uid:n.attr(i.attr("uid")),start:e.start,end:e.end}),h[0].appendChild(n[0]))},_positionEvent:function(e,n,o){var r,a,l,d,u,c,h,f,_,p,g,m,y,w,D,k=this.options.eventHeight,C=e.start;for(e.start.offsetLeft>e.end.offsetLeft&&(C=e.end),r=e.start.index,a=e.end.index,l=C.eventCount,d=s.collidingEvents(e.events(),r,a),u=r!==a?5:4,d.push({element:n,start:r,end:a}),c=s.createRows(d),h=0,f=Math.min(c.length,l);hl)for(y=r;y<=a;y++){if(w=e.collection,D=w.at(y),D.more)return;D.more=t(v({ns:i.ns,start:y,end:y,width:D.clientWidth-2,left:D.offsetLeft+2,top:D.offsetTop+D.firstChildTop+D.firstChildHeight+l*k+3*l})),this.content[0].appendChild(D.more[0])}else e.addEvent({element:n,start:r,end:a,groupIndex:C.groupIndex}),n[0].style.width=e.innerWidth()-u+"px",n[0].style.left=C.offsetLeft+2+"px",n[0].style.height=k+"px",o._continuousEvents.push({element:n,uid:n.attr(i.attr("uid")),start:e.start,end:e.end}),n.appendTo(this.content)},_slotByPosition:function(t,e){var n,o,i=this.content.offset();for(t-=i.left,e-=i.top,e+=this.content[0].scrollTop,t+=this.content[0].scrollLeft,t=Math.ceil(t),e=Math.ceil(e),n=0;n1?n=this._renderGroups(d,e.slice(1),n++,o+1):this._renderEvents(d,n++);return n},_groupCount:function(){var t=this.groupedResources,e=this._groupedView;return t.length?this._isVerticallyGrouped()?e._verticalGroupCount(t.length-1):e._horizontalGroupCount(t.length):1},_columnOffsetForResource:function(t){return this._columnCountForLevel(t)/this._columnCountForLevel(t-1)},destroy:function(){this.table&&this.table.removeClass("k-scheduler-monthview"),this.content&&this.content.off(a),this.element&&this.element.off(a),s.fn.destroy.call(this),this._isMobile()&&!this._isMobilePhoneView()&&this.options.editable&&(this.options.editable.create!==!1&&this._addUserEvents.destroy(),this.options.editable.update!==!1&&this._editUserEvents.destroy())},events:["remove","add","edit","navigate"],options:{title:"Month",name:"month",eventHeight:25,moreButtonHeight:13,editable:!0,selectedDateFormat:"{0:y}",selectedShortDateFormat:"{0:y}",groupHeaderTemplate:"#=text#",dayTemplate:f,eventTemplate:p}})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()});
//# sourceMappingURL=kendo.scheduler.monthview.min.js.map