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