UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 25.7 kB
module.exports=function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}({0:function(t,e,n){t.exports=n(1383)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},1377:function(t,e){t.exports=require("./kendo.scheduler.view")},1383:function(t,e,n){var o,i,a;!function(r,define){i=[n(1377)],o=r,a="function"==typeof o?o.apply(e,i):o,!(void 0!==a&&(t.exports=a))}(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,a=n;return o=t,o>=i&&o<=a}var i=window.kendo,a=i.ui,r=a.SchedulerView,s=".kendoMonthView",l=t.extend,d=i.date.getDate,u=i.date.MS_PER_DAY,c=6,h=7,f="k-event-inverse",p=i.template('<span class="k-link k-nav-day">#:kendo.toString(date, "dd")#</span>'),v='<div role="gridcell" aria-selected="false" data-#=ns#uid="#=uid#"#if (resources[0]) { #style="background-color:#=resources[0].color #; border-color: #=resources[0].color#"class="k-event"#} else {#class="k-event"#}#><span class="k-event-actions"># if (data.tail || data.middle) {#<span class="k-icon k-i-arrow-60-left"></span>#}## if (data.isException()) {#<span class="k-icon k-i-non-recurrence"></span># } else if (data.isRecurring()) {#<span class="k-icon k-i-reload"></span>#}#</span>{0}<span class="k-event-actions">#if (showDelete) {#<a href="\\#" class="k-link k-event-delete" title="${data.messages.destroy}" aria-label="${data.messages.destroy}"><span class="k-icon k-i-close"></span></a>#}## if (data.head || data.middle) {#<span class="k-icon k-i-arrow-60-right"></span>#}#</span># if (resizable && !data.tail && !data.middle) {#<span class="k-resize-handle k-resize-w"></span>#}## if (resizable && !data.head && !data.middle) {#<span class="k-resize-handle k-resize-e"></span>#}#</div>',_=i.template('<div title="#=title.replace(/"/g,"&\\#34;")#"><div class="k-event-template">#:title#</div></div>'),g=2,y=i.template('<div style="width:#=width#px;left:#=left#px;top:#=top#px" class="k-more-events k-button"><span class="k-icon k-i-more-horizontal"></span></div>'),m=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,a=this._view,r=h,s=a._isVerticallyGrouped(),l="";for(i=0;i<n;i++)l+=a._createRow(t,e,r,s?o:i);return l},_adjustStartDate:function(t){return i.date.addDays(t,h)},_getContent:function(t,e,n){return t({date:e,resources:n})},_getTimeSlotByPosition:function(t,e,n){var o=this._view.groups[n];return o.daySlotByPosition(t,e)},_nextSlotStartDate:function(t){return i.date.nextDay(t)},_createRowsLayout:function(t,e,n){var o=this._view;return o._createRowsLayout(t,e,n)},_createVerticalColumnsLayout:function(t,e,n,o){return o},_createColumnsLayout:function(t,e,n){var o=this._view;return o._createColumnsLayout(t,e,n)},_verticalGroupCount:function(t){var e=this._view;return e._rowCountForLevel(t)},_horizontalGroupCount:function(t){var e=this._view;return e._columnCountForLevel(t)/e._columnOffsetForResource(t)},_positionMobileEvent:function(t,e,n,o,i,a,r){var s,l=this._view;o>1&&(0===r?a=n.end.endDate():r==o-1?i=n.start.startDate():(i=n.start.startDate(),a=n.end.endDate())),s=t.clone({start:i,end:a,head:n.head,tail:n.tail}),l._positionMobileEvent(n,l._createEventElement(s),e)},_positionEvent:function(t,e,n,o,i,a,r){var s,l=this._view;o>1&&(0===r?a=n.end.endDate():r==o-1?i=n.start.startDate():(i=n.start.startDate(),a=n.end.endDate())),s=t.clone({start:i,end:a,head:n.head,tail:n.tail}),l._positionEvent(n,l._createEventElement(s),e)},_addDaySlotCollections:function(t,e,n){var o,a,r,s,l,d,u,f,p,v,_,g=this._view,y=h,m=c;for(o=0;o<t;o++)for(a=0,r=0,g._isVerticallyGrouped()&&(r=o),s=r*m;s<(r+1)*m;s++)for(l=g.groups[o],d=l.addDaySlotCollection(i.date.addDays(n,a),i.date.addDays(n,a+y)),u=e[s],f=u.children,p=0,u.setAttribute("role","row"),g._isVerticallyGrouped()||(p=o),v=p*y;v<(p+1)*y;v++)_=f[v],g.addDaySlot(d,_,n,a),a++},_changePeriodGroupIndex:function(t){var e=this._view;return t?e.groups.length-1:0},_createResizeHint:function(t){var e=this._view,n=t.startSlot().offsetLeft,o=t.start.offsetTop,i=t.innerWidth(),a=t.start.clientHeight-2,s=r.fn._createResizeHint.call(e,n,o,i,a);e._appendResizeHint(s)},_createMoveHint:function(t,e){var n=this._view,o=t.startSlot(),i=t.endSlot(),a=n._createEventElement(e.clone({head:t.head,tail:t.tail}));a.css({left:o.offsetLeft+2,top:o.offsetTop+o.firstChildHeight,height:"auto"===n.options.eventHeight?25:n.options.eventHeight,width:t.innerWidth()-(o.index!==i.index?3:2)}),a.addClass("k-event-drag-hint"),e.inverseColor&&a.addClass(f),n._appendMoveHint(a)}}),D=i.Class.extend({init:function(t){this._view=t},_verticalRowCountForLevel:function(){return 1},_horizontalGroupCountForLevel:function(t){var e=this._view;return e._columnCountForLevel(t+1)/h},_createRows:function(t,e,n){var o,a,r=this._view,s=h,l=r._isVerticallyGrouped(),d="",u=0;if(l){for(o=new Date(t),a=r._groupCount(),u;u<c;u++)d+=r._createRow(o,e,a,u),o=i.date.addDays(o,s);t=i.date.nextDay(t)}else{for(u;u<s;u++)d+=r._createRow(t,e,n,u),t=i.date.nextDay(t);t=i.date.addDays(t,s)}return d},_adjustStartDate:function(t,e){var n=this._view,o=n._isVerticallyGrouped();return o?e?i.date.addDays(t,h*(c-1)+1):i.date.nextDay(t):i.date.addDays(t,h)},_getContent:function(t,e,n,o){return 0===o?t({date:e,resources:n}):""},_getTimeSlotByPosition:function(t,e,n){var o=this._view.groups[n];return o.daySlotByPosition(t,e,!0)},_nextSlotStartDate:function(t){return t},_getCalendarRowsLength:function(){var t=this._view,e=t._isVerticallyGrouped();return e?h:c},_createRowsLayout:function(t,e,n,o){var i=this._view;return i._createDateLayout(o,null,!1)},_createVerticalColumnsLayout:function(t,e,n){var o,a,r=this._view,s=t[0],l=[],d=s.dataSource.view();for(o=0;o<d.length*c;o++)a={text:n({text:i.htmlEncode(i.getter(s.dataTextField)(d[o%d.length])),color:i.getter(s.dataColorField)(d[o%d.length]),field:s.field,title:s.title,name:s.name,value:i.getter(s.dataValueField)(d[o%d.length])}),className:"k-slot-cell"},a.columns=r._createColumnsLayout(t.slice(1),null,n),l.push(a);return l},_createColumnsLayout:function(t,e,n,o){var i=this._view;return i._createColumnsLayout(t,e,n,o,!0)},_verticalGroupCount:function(t){var e=this._view;return e._columnCountForLevel(t)/c},_horizontalGroupCount:function(t){var e=this._view;return e._columnCountForLevel(t)/h},_positionMobileEvent:function(t,e,n,o,i,a){var r,s,l,d,u=this._view,c=n.start.index,h=n.end.index;for(r=n.start.index;r<=n.end.index;r++)s=n.collection._slots[r],l=e.daySlotRanges(s.start,s.start,!0)[0],d=t.clone({start:r===c?i:s.startDate(),end:r===h?a:s.endDate(),head:r!==h||n.head,tail:r!==c||n.tail}),u._positionMobileEvent(l,u._createEventElement(d),e)},_positionEvent:function(t,e,n,o,i,a){var r,s,l,d,u=this._view,c=n.start.index,h=n.end.index;for(r=n.start.index;r<=n.end.index;r++)s=n.collection._slots[r],l=e.daySlotRanges(s.start,s.start,!0)[0],d=t.clone({start:r===c?i:s.startDate(),end:r===h?a:s.endDate(),head:r!==h||n.head,tail:r!==c||n.tail}),u._positionEvent(l,u._createEventElement(d),e)},_addDaySlotCollections:function(t,e,n){var o,a,r,s,l,d,u,f,p,v,_,g,y,m,D=this._view,w=h,x=c,C=D._isVerticallyGrouped();for(o=0;o<w;o++)for(a=0;a<x;a++)for(r=0,s=C?o:a,l=e[s],d=l.children,u=0,l.setAttribute("role","row"),D._isVerticallyGrouped()||(u=o),f=u*t;f<(u+1)*t;f++)p=a*w+o,v=C?f+a*t:f,_=d[v],g=C?f:r,y=D.groups[g],m=0===o?y.addDaySlotCollection(i.date.addDays(n,p),i.date.addDays(n,p+w)):y._daySlotCollections[a],D.addDaySlot(m,_,n,p),r++},_changePeriodGroupIndex:function(t,e,n){var o=this._view;return e&&o._isVerticallyGrouped()?t?o.groups.length-1:0:n},_createResizeHint:function(t){var e,n,o,i,a,s,l,d=this._view;if(d._isVerticallyGrouped())e=t.startSlot().offsetLeft,n=t.start.offsetTop,o=t.startSlot().offsetWidth,i=t.endSlot().offsetTop+t.startSlot().offsetHeight-t.startSlot().offsetTop-2,a=r.fn._createResizeHint.call(d,e,n,o,i),d._appendResizeHint(a);else for(s=t.startSlot().index;s<=t.endSlot().index;s++)l=t.collection._slots[s],e=l.offsetLeft,n=l.offsetTop,o=l.offsetWidth,i=l.offsetHeight-2,a=r.fn._createResizeHint.call(d,e,n,o,i),d._appendResizeHint(a)},_createMoveHint:function(t,e){var n,o,i,a=this._view,r=t.startSlot(),s=t.endSlot();for(n=r.index;n<=s.index;n++)o=t.collection._slots[n],i=a._createEventElement(e.clone({head:t.head,tail:t.tail})),i.css({left:o.offsetLeft,top:o.offsetTop+o.firstChildHeight,height:"auto"===a.options.eventHeight?25:a.options.eventHeight,width:o.offsetWidth-2}),i.addClass("k-event-drag-hint"),e.inverseColor&&i.addClass(f),a._appendMoveHint(i)}});i.ui.scheduler.MonthGroupedView=m,i.ui.scheduler.MonthGroupedByDateView=D,a.MonthView=r.extend({init:function(t,e){var n,o,i,a=this;if(0===e.eventsPerDay&&(e.eventsPerDay=1),0===e.eventHeight&&(e.eventHeight=1),0===e.moreButtonHeight&&(e.moreButtonHeight=1),"string"==typeof e.eventHeight&&"auto"!==e.eventHeight&&(e.eventHeight=25),"auto"===e.eventHeight&&(e.adaptiveSlotHeight=!0),r.fn.init.call(a,t,e),a._groupedView=a._getGroupedView(),n=this._isGroupedByDate(),o=this.options.adaptiveSlotHeight,i=this.options.eventHeight,n===!0&&o===!0)throw Error("Incompatible options: adaptive slot height and date grouping!");if(n===!0&&"auto"===i)throw Error("Incompatible options: auto event height and date grouping!");a.title=a.options.title,a._templates(),a._editable(),a._renderLayout(a.options.date),a._groups()},name:"month",_getGroupedView:function(){return this._isGroupedByDate()?new i.ui.scheduler.MonthGroupedByDateView(this):new i.ui.scheduler.MonthGroupedView(this)},_updateDirection:function(t,e,n,o,i){var a,r,s,l,d;n&&(a=e[0].start,r=e[e.length-1].end,s=a.index===r.index,l=a.collectionIndex===r.collectionIndex,d=i?s&&l||l:s&&l,d&&(t.backward=o))},_changeDate:function(t,e,n){var o,i,a,r=this.groups[t.groupIndex];if(n){if(o=r._getCollections(r.daySlotCollectionCount()),i=e.collectionIndex-1,i>=0)return o[i]._slots[o[i]._slots.length-1]}else if(o=r._getCollections(r.daySlotCollectionCount()),i=e.collectionIndex+1,a=0,o[i]&&o[i]._slots[a])return o[i]._slots[a]},_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,a,r=n?7:1;return e&&(r*=-1),o=i.date.addDays(t.start,r),a=i.date.addDays(t.end,r),!this._isInRange(o,a)&&(t.start=o,t.end=a,(!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,a,r,s;return n||(i=t.groupIndex,a=this.groups.length-1,r=this._isVerticallyGrouped(),s=this.groups[i],!e&&r?(e=s[o?"lastSlot":"firstSlot"](),i+=o?-1:1):e&&!r&&(i=o?a:0),(i<0||i>a)&&(i=o?a: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,v),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)},mobileDateForTitle:function(){return i.format(this.options.selectedMobileDateFormat,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._initSlotHeight(),this.refreshLayout(),this._isVirtualized()&&this._tryRenderContent(),this.content.on("click"+s,".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()})}),this._footer()},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var e=this;e.element.on("click"+s,".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"+s,".k-scheduler-monthview .k-scheduler-content td",function(n){var o,i=t(n.currentTarget).offset(),a=e._slotByPosition(i.left,i.top);a&&(o=e._resourceBySlot(a),e.trigger("add",{eventInfo:l({isAllDay:!0,start:a.startDate(),end:a.startDate()},o)})),n.preventDefault()}),e.options.editable.update!==!1&&e.element.on("dblclick"+s,".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,useClickAsTap:!i.support.browser.edge,filter:".k-scheduler-monthview .k-scheduler-content td",tap:function(n){var o,i,a;e._scrolling||(o=t(n.target).offset(),i=e._slotByPosition(o.left,o.top),i&&(a=e._resourceBySlot(i),e.trigger("add",{eventInfo:l({isAllDay:!0,start:i.startDate(),end:i.startDate()},a)})),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="<tbody>",n=1,o=this._groupedView,i=this.groupedResources;for(i.length&&this._isVerticallyGrouped()&&(n=o._verticalRowCountForLevel(i.length-1)),t=0;t<n;t++)e+=this._createCalendar(t),this._cachedGroupIndex=t;e+="</tbody>",this.content.find("table").html(e)},_virtualContent:function(){var t=this,e="";e+=this._createCalendar(++this._cachedGroupIndex),t.content.find("table tbody").append(e),t._initSlotHeight()},_calcSlotHeight:function(t){var e,n=this.options,o=n.eventHeight,i=n.eventSpacing,a=n.moreButtonHeight,r=this.content.find("table tr td")[0];if("auto"!==o&&r)return e=r.firstChild,Math.round(r.offsetHeight-r.clientHeight+e.offsetTop+e.offsetHeight+g+t*o+(t-1)*i+(g+a)+g)},_initSlotHeight:function(){var t,e=this.options,n=e.eventsPerDay,o=e.eventHeight,i=this._isMobile(),a=this.content.find("table");i||"number"==typeof o&&(a.addClass("k-scheduler-table-auto"),t=this._calcSlotHeight(n),a.find("tr").height(t))},_adjustSlotHeight:function(t){var e,n=this.options,o=n.eventHeight,i=n.eventSpacing,a=n.moreButtonHeight;this._canAdjustSlotHeight===!0&&(e=t._daySlotCollections,this.content.find("table").addClass("k-scheduler-table-auto"),e.forEach(function(t){var e=t._events,n=0,r=t._slots,s=r[0],l=s.element.offsetTop,d=0;r.forEach(function(t){t.eventMeta?t.actualEventCount=t.eventMeta.length:(t.eventMeta=[],t.actualEventCount=0)}),r.forEach(function(t,e){t.eventMeta.forEach(function(n,o){n.startIndex===e&&n.startIndex!==n.endIndex&&r.slice(e,n.endIndex+1).forEach(function(e){var i=e.eventMeta;i.indexOf(n)>-1||(i[i.length]=t.eventMeta[o],e.actualEventCount=i.length,e.dirty=!0)})}),t.dirty===!0&&(t.eventMeta.sort(function(t,e){return t.order-e.order}),delete t.dirty)}),"auto"===o&&r.forEach(function(t,e){var n=t.firstChildTop+t.firstChildHeight+g;t.eventMeta.forEach(function(t,e){t.top=Math.max(t.top,l+n),n=t.top-l+i+t.height})}),r.forEach(function(t,r){var s=t.firstChildTop+t.firstChildHeight+g;t.eventMeta.forEach(function(t){t.top=Math.max(t.top,l+s),s=t.top-l+i+t.height,t.startIndex===r&&(e[n].element[0].style.top=t.top+"px",n++)}),t.eventMeta.length>0?(s-=i,s+=g):s+="auto"===o?25:o,t.more&&(t.more[0].style.top=l+s+"px",s+=g+a),d=Math.max(d,s+1)}),s.element.parentNode.style.height=d+"px",r.forEach(function(t){t.offsetTop=l,t.offsetHeight=d,t.clientHeight=d-1})}.bind(this)))},_createCalendar:function(t){var e,n,o,a=this.startDate(),r=h*c,s=h,l=[a],d="",u=1,f=this._isVerticallyGrouped(),p=this._groupedView,v=this.groupedResources;for(v.length&&(f||(u=p._horizontalGroupCountForLevel(v.length-1))),this._slotIndices={},e=p._getCalendarRowsLength(s,r),n=0;n<e;n++)d+="<tr>",l.push(a),o=n*s,d+=p._createRows(a,o,u,t),a=p._adjustStartDate(a,n===e-1),d+="</tr>";return this._weekStartDates=l,this._endDate=i.date.previousDay(a),d},_createRow:function(t,e,n,o){var a,r=this,s=r._firstDayOfMonth,l=r._lastDayOfMonth,u=r.dayTemplate,c="",h="",f=this._groupedView,p=function(){return r._resourceBySlot({groupIndex:o})};for(a=0;a<n;a++)c="",i.date.isToday(t)&&(c+="k-today"),i.date.isInDateRange(t,s,l)||(c+=" k-other-month"),h+="<td ",""!==c&&(h+='class="'+c+'"'),h+=">",h+=f._getContent(u,t,p,a),h+="</td>",r._slotIndices[d(t).getTime()]=e+a,t=f._nextSlotStartDate(t);return h},_layout:function(){var n,o,i,a=this.calendarInfo(),r=this._isMobile()?a.days.namesShort.map(function(t){return t[0]}):a.days.names,s=e(r,a.firstDay),l=t.map(s,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:"<div>&nbsp;</div>",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,a=o.editable,r=this._isMobile();return e.showDelete=a&&a.destroy!==!1&&!r,e.resizable=a&&a.resize!==!1&&!r,e.ns=i.ns,e.resources=this.eventResources(e),e.inverseColor=!1,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,a=e.lastSlot().end-1,r=i.date.toUtcTime(t.start),s=i.date.toUtcTime(t.end);return(o(r,n,a)||o(s,n,a)||o(n,r,s)||o(a,r,s))&&(!o(s,n,n)||o(s,r,r)||t.isAllDay)},_slotIndex:function(t){return this._slotIndices[d(t).getTime()]},_positionMobileEvent:function(e,n,o){var a,s,l,d,u,c,h,f=e.start;e.start.offsetLeft>e.end.offsetLeft&&(f=e.end),a=e.start.index,s=a,l=3,d=r.collidingEvents(e.events(),a,s),d.push({element:n,start:a,end:s}),u=r.createRows(d),c=e.collection.at(a),h=c.container,h||(h=t(i.format('<div class="k-events-container" style="top:{0};left:{1};width:{2}"></div>',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:a,end:s,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 a,s,l,d,u,c,h,f,p,v,_,m,D,w,x,C,S,H,k=this.options.eventHeight,M=this.options.eventSpacing,b=e.start;for(e.start.offsetLeft>e.end.offsetLeft&&(b=e.end),a=e.start.index,s=e.end.index,l=b.eventCount,d=r.collidingEvents(e.events(),a,s),u=a!==s?3:2,d.push({element:n,start:a,end:s}),c=r.createRows(d),h=0,f=Math.min(c.length,l);h<f;h++)for(p=c[h].events,v="auto"===k?"":b.offsetTop+b.firstChildTop+b.firstChildHeight+g+h*(k+M)+"px",_=0,m=p.length;_<m;_++)p[_].element[0].style.top=v,p[_].element.attr(i.attr("order"),h);if(c.length>l)for(D=a;D<=s;D++)w=e.collection,x=w.at(D),x.more||(x.more=t(y({ns:i.ns,start:D,end:D,width:x.clientWidth-2,left:x.offsetLeft+2,top:"auto"===k?"":x.offsetTop+x.firstChildTop+x.firstChildHeight+g+l*k+(l-1)*M+g})),this.content[0].appendChild(x.more[0]));else e.addEvent({element:n,start:a,end:s,groupIndex:b.groupIndex}),n[0].style.width=e.innerWidth()-u+"px",n[0].style.left=b.offsetLeft+2+"px",n[0].style.height="auto"===k?"":k+"px",o._continuousEvents.push({element:n,uid:n.attr(i.attr("uid")),start:e.start,end:e.end,order:parseInt(n.attr(i.attr("order")),10)}),n.appendTo(this.content),this._inverseEventColor(n),C=e.start.collectionIndex,S=e.start.index,H=o._daySlotCollections[C]._slots[S],H.eventMeta||(H.eventMeta=[]),H.eventMeta.push({height:"auto"===k?n.outerHeight():k,top:0,startIndex:S,endIndex:e.end.index,uid:n.attr(i.attr("uid")),order:parseInt(n.attr(i.attr("order")),10)})},_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;n<this.groups.length;n++)if(o=this._groupedView._getTimeSlotByPosition(t,e,n))return o;return null},_appendResizeHint:function(t){t.appendTo(this.content),this._resizeHint=this._resizeHint.add(t)},_updateResizeHint:function(t,e,n,o){var a,r,s;for(this._removeResizeHint(),a=this.groups[e],r=a.ranges(n,o,!0,t.isAllDay),s=0;s<r.length;s++)this._groupedView._createResizeHint(r[s]);this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(i.toString(i.timezone.toLocalDate(n),"M/dd")),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(i.toString(i.timezone.toLocalDate(o),"M/dd"))},_updateMoveHint:function(t,e,n){var o,a=i.date.toUtcTime(t.start)+n,r=a+t.duration(),s=this.groups[e],l=s.ranges(a,r,!0,t.isAllDay);for(this._removeMoveHint(t.uid),o=0;o<l.length;o++)this._groupedView._createMoveHint(l[o],t)},_appendMoveHint:function(t){t.appendTo(this.content),this._moveHint=this._moveHint.add(t)},_groups:function(){var t,e=this._groupCount(),n=this.content[0].getElementsByTagName("tr"),o=this.startDate();for(this.groups=[],t=0;t<e;t++)this._addResourceView(t);this._groupedView._addDaySlotCollections(e,n,o)},addDaySlot:function(t,e,n,o){var a=i.date.addDays(n,o),r=i.date.MS_PER_DAY,s=this.options.eventsPerDay;n.getHours()!==a.getHours()&&(r+=(n.getHours()-a.getHours())*i.date.MS_PER_HOUR),a=i.date.toUtcTime(a),r+=a,e.setAttribute("role","gridcell"),e.setAttribute("aria-selected",!1),t.addDaySlot(e,a,r,s)},render:function(t){var e,n,o,a;this.content.children(".k-event,.k-more-events,.k-events-container").remove(),this._cachedEvents=t,this._groups(),t=new i.data.Query(t).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray().filter(function(t){return this._isInDateSlot(t)}.bind(this)),e=this.groupedResources,n=this._isMobile(),o=this._isGroupedByDate(),a=this.options.adaptiveSlotHeight,this._canAdjustSlotHeight=n!==!0&&o!==!0&&0===e.length&&a===!0,e.length?this._renderGroups(t,e,0,1):this._renderEvents(t,0),this.refreshLayout(),this.trigger("activate")},_renderEvents:function(t,e){var n=this.groups[e],o=this._groupedView._view,a=o._isMobile();n&&(n._continuousEvents||(n._continuousEvents=[]),a?t.forEach(function(t){for(var e,o=n.slotRanges(t,!0),a=o[0],r=a.start.start,s=a.end.end,l=new Date(a.start.start),d=o[o.length-1].end.end,u=new Date(l),c=new Date(s);l.getTime()<=d&&t.end>=i.timezone.toLocalDate(l)&&t.start<=i.timezone.toLocalDate(d);)e=n.daySlotRanges(u.getTime(),c.getTime(),!0)[0],c.setDate(c.getDate()+1),u.setDate(u.getDate()+1),e&&(e.head=null,e.middle=null,e.tail=null,this._groupedView._positionMobileEvent(t,n,e,1,r,s,0)),l=i.date.addDays(l,1)}.bind(this)):(t.forEach(function(t){var e,o,i=t.start,a=t.end,r=n.slotRanges(t,!0),s=r.length;for(o=0;o<s;o++)e=r[o],this._groupedView._positionEvent(t,n,e,s,i,a,o)}.bind(this)),this._canAdjustSlotHeight===!0&&this._adjustSlotHeight(n)))},_renderGroups:function(t,e,n,o){var a,s,l,d,u=e[0];if(u)for(a=u.dataSource.view(),s=0;s<a.length;s++)l=this._resourceValue(u,a[s]),d=new i.data.Query(t).filter({field:u.field,operator:r.groupEqFilter(l)}).toArray(),e.length>1?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(s),this.element&&this.element.off(s),r.fn.destroy.call(this),this._isMobile()&&this.options.editable&&this.options.editable.create!==!1&&this._addUserEvents.destroy()},events:["remove","add","edit","navigate"],options:{title:"Month",name:"month",eventHeight:25,moreButtonHeight:13,editable:!0,selectedDateFormat:"{0:y}",selectedShortDateFormat:"{0:y}",selectedMobileDateFormat:"{0:MMMM}",groupHeaderTemplate:"#=text#",dayTemplate:p,eventTemplate:_,eventsPerDay:2,adaptiveSlotHeight:!1,eventSpacing:3}})}(window.kendo.jQuery),window.kendo},n(3))}});