UNPKG

@progress/kendo-ui

Version:

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

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