UNPKG

@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
!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.min","kendo.icons.min"],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,i=n.SchedulerView,o=".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,"&#34;")}"><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,i){for(var o=this._view,r=o._isVerticallyGrouped(),a="",s=0;s<n;s++)a+=o._createRow(t,e,7,r?i: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,i){return i},_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,i,o,r,a){var s=this._view;i>1&&(0===a?r=n.end.endDate():a==i-1?o=n.start.startDate():(o=n.start.startDate(),r=n.end.endDate()));var l=t.clone({start:new Date(o),end:new Date(r),head:n.head,tail:n.tail});s._positionMobileEvent(n,s._createEventElement(l),e)},_positionEvent:function(t,e,n,i,o,r,a){var s=this._view;i>1&&(0===a?r=n.end.endDate():a==i-1?o=n.start.startDate():(o=n.start.startDate(),r=n.end.endDate()));var l=t.clone({start:o,end:r,head:n.head,tail:n.tail});s._positionEvent(n,s._createEventElement(l),e)},_addDaySlotCollections:function(t,n,i){for(var o=this._view,r=0;r<t;r++){var a=0,s=0;o._isVerticallyGrouped()&&(s=r);for(var l=6*s;l<6*(s+1);l++){var d=o.groups[r].addDaySlotCollection(e.date.addDays(i,a),e.date.addDays(i,a+7)),u=n[l].children,h=0;o._isVerticallyGrouped()||(h=r);for(var c=7*h;c<7*(h+1);c++){var f=u[c];o.addDaySlot(d,f,i,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,r=t.innerWidth(),a=t.start.clientHeight-2,s=i.fn._createResizeHint.call(e,n,o,r,a);e._appendResizeHint(s)},_createMoveHint:function(t,e){var n=this._view,i=t.startSlot(),o=t.endSlot(),r=n._createEventElement(e.clone({head:t.head,tail:t.tail}));r.css({left:i.offsetLeft+2,top:i.offsetTop+i.firstChildHeight,height:"auto"===n.options.eventHeight?25:n.options.eventHeight,width:t.innerWidth()-(i.index!==o.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,i){var o=this._view,r="",a=0;if(o._isVerticallyGrouped()){for(var s=new Date(t),l=o._groupCount();a<6;a++)r+=o._createRow(s,n,l,a),s=e.date.addDays(s,7);t=e.date.nextDay(t)}else{for(;a<7;a++)r+=o._createRow(t,n,i,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,i){return 0===i?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,i){return this._view._createDateLayout(i,null,!1)},_createVerticalColumnsLayout:function(t,n,i){for(var o=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:i({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=o._createColumnsLayout(t.slice(1),null,i,null,null,d),a.push(u)}return a},_createColumnsLayout:function(t,e,n,i){return this._view._createColumnsLayout(t,e,n,i,!0)},_verticalGroupCount:function(t){return this._view._columnCountForLevel(t)/6},_horizontalGroupCount:function(t){return this._view._columnCountForLevel(t)/7},_positionMobileEvent:function(t,e,n,i,o,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?o: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,i,o,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?o: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,i){for(var o=this._view,r=o._isVerticallyGrouped(),a=0;a<7;a++)for(var s=0;s<6;s++){var l=0,d=n[r?a:s].children,u=0;o._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,_=o.groups[p];c=0===a?_.addDaySlotCollection(e.date.addDays(i,f),e.date.addDays(i,f+7)):_._daySlotCollections[s],o.addDaySlot(c,v,i,f),l++}}},_changePeriodGroupIndex:function(t,e,n){var i=this._view;return e&&i._isVerticallyGrouped()?t?i.groups.length-1:0:n},_createResizeHint:function(t){var e,n,o,r,a,s=this._view;if(s._isVerticallyGrouped())e=t.startSlot().offsetLeft,n=t.start.offsetTop,o=t.startSlot().offsetWidth,r=t.endSlot().offsetTop+t.startSlot().offsetHeight-t.startSlot().offsetTop-2,a=i.fn._createResizeHint.call(s,e,n,o,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,o=d.offsetWidth,r=d.offsetHeight-2,a=i.fn._createResizeHint.call(s,e,n,o,r),s._appendResizeHint(a)}},_createMoveHint:function(t,e){for(var n=this._view,i=t.startSlot(),o=t.endSlot(),r=i.index;r<=o.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 i;return(i=t)>=e&&i<=n}e.ui.scheduler.MonthGroupedView=v,e.ui.scheduler.MonthGroupedByDateView=p,n.MonthView=i.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),i.fn.init.call(n,t,e),n._groupedView=n._getGroupedView();var o=this._isGroupedByDate(),r=this.options.adaptiveSlotHeight,a=this.options.eventHeight;if(!0===o&&!0===r)throw new Error("Incompatible options: adaptive slot height and date grouping!");if(!0===o&&"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,i,o){if(n){var r=e[0].start,a=e[e.length-1].end,s=r.index===a.index,l=r.collectionIndex===a.collectionIndex;(o?s&&l||l:s&&l)&&(t.backward=i)}},_changeDate:function(t,e,n){var i,o,r=this.groups[t.groupIndex];if(n){if(i=r._getCollections(r.daySlotCollectionCount()),(o=e.collectionIndex-1)>=0)return i[o]._slots[i[o]._slots.length-1]}else{if((i=r._getCollections(r.daySlotCollectionCount()))[o=e.collectionIndex+1]&&i[o]._slots[0])return i[o]._slots[0]}},_getNextHorizontalRange:function(t,e,n){var i=this._isVerticallyGrouped();return n.startSlot=t[e](n.startSlot,i),n.endSlot=t[e](n.endSlot,i),n},_getNextVerticalRange:function(t,e,n,i){var o=this._isVerticallyGrouped()&&this._isGroupedByDate();return n.startSlot=t[e](n.startSlot,i,o),n.endSlot=t[e](n.endSlot,i,o),n},_changeViewPeriod:function(t,n,i){var o,r,a=i?7:1;return n&&(a*=-1),o=e.date.addDays(t.start,a),r=e.date.addDays(t.end,a),!this._isInRange(o,r)&&(t.start=o,t.end=r,(!i||i&&this._isVerticallyGrouped())&&(t.groupIndex=this._groupedView._changePeriodGroupIndex(n,i,t.groupIndex)),t.events=[],!0)},_continuousSlot:function(t,e,n){var i=t.backward?0:e.length-1;return this.groups[t.groupIndex].continuousSlot(e[i].start,n)},_changeGroupContinuously:function(t,e,n,i){if(!n){var o=t.groupIndex,r=this.groups.length-1,a=this._isVerticallyGrouped(),s=this.groups[o];!e&&a?(e=s[i?"lastSlot":"firstSlot"](),o+=i?-1:1):e&&!a&&(o=i?r:0),(o<0||o>r)&&(o=i?r:0,e=null),t.groupIndex=o}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 i=this;this._firstDayOfMonth=e.date.firstDayOfMonth(n),this._lastDayOfMonth=e.date.lastDayOfMonth(n),this._startDate=function(t,n){var i=n.firstDay,o=new Date(t.getFullYear(),t.getMonth(),0,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());for(;o.getDay()!=i;)e.date.setTime(o,-1*l);return o}(n,this.calendarInfo()),this.createLayout(this._layout()),this._content(),this._initSlotHeight(),this._initTimesHeight(),this.refreshLayout(),this._isVirtualized()&&this._tryRenderContent(),this.content.on("click"+o,".k-nav-day,.k-more-events",(function(e){var n=t(e.currentTarget).offset(),o=i._slotByPosition(n.left,n.top);e.preventDefault(),i.trigger("navigate",{view:"day",date:o.startDate()})})),this._footer()},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var n=this;n.element.on("click"+o,".k-scheduler-monthview .k-event a:has(.k-i-x),.k-scheduler-monthview .k-event a:has(.k-svg-i-x)",(function(i){n.trigger("remove",{uid:t(this).closest(".k-event").attr(e.attr("uid"))}),i.preventDefault()})),!1!==n.options.editable.create&&n.element.on("dblclick"+o,".k-scheduler-monthview .k-scheduler-content > table td",(function(e){var i=t(e.currentTarget).offset(),o=n._slotByPosition(i.left,i.top);if(o){var a=n._resourceBySlot(o);n.trigger("add",{eventInfo:r({isAllDay:!0,start:o.startDate(),end:o.startDate()},a)})}e.preventDefault()})),!1!==n.options.editable.update&&n.element.on("dblclick"+o,".k-scheduler-monthview .k-event",(function(i){n.trigger("edit",{uid:t(this).closest(".k-event").attr(e.attr("uid"))}),i.preventDefault()}))},_touchEditable:function(){var n=this,i=0;e.support.mobileOS.android&&(i=5),!1!==n.options.editable.create&&(n._addUserEvents=new e.UserEvents(n.element,{threshold:i,useClickAsTap:!e.support.browser.edge,filter:".k-scheduler-monthview .k-scheduler-content td",tap:function(e){if(!n._scrolling){var i=t(e.target).offset(),o=n._slotByPosition(i.left,i.top);if(o){var a=n._resourceBySlot(o);n.trigger("add",{eventInfo:r({isAllDay:!0,start:o.startDate(),end:o.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,i=this.groupedResources;i.length&&this._isVerticallyGrouped()&&(e=n._verticalRowCountForLevel(i.length-1));for(var o=0;o<e;o++)t+=this._createCalendar(o),this._cachedGroupIndex=o;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,i=n.eventHeight,o=n.eventSpacing,r=n.moreButtonHeight,a=this.content.find("table tr td")[0];if("auto"!==i&&a)return e=a.firstChild,Math.round(a.offsetHeight-a.clientHeight+e.offsetTop+e.offsetHeight+2+t*i+(t-1)*o+(2+r)+2)},_initSlotHeight:function(){var t,e=this.options,n=e.eventsPerDay,i=e.eventHeight,o=this._isMobile(),r=this.content.find("table");o||"number"==typeof i&&(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,i=n.eventHeight,o=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 i=t.eventMeta[e];if(i.startIndex!==n)return;if(i.startIndex===i.endIndex)return;s.slice(n,i.endIndex+1).forEach((function(n){var o=n.eventMeta;o.indexOf(i)>-1||(o[o.length]=t.eventMeta[e],n.actualEventCount=o.length,n.dirty=!0)}))}!0===t.dirty&&(e._sortEventMeta(t),delete t.dirty)})),"auto"===i&&s.forEach((function(t,e){let n=t.firstChildTop+t.firstChildHeight+2;for(let e=0;e<t.eventMeta.length;e++){let i=t.eventMeta[e];i.top=Math.max(i.top,d+n),n=i.top-d+o+i.height}})),s.forEach((function(t,e){var s=t.firstChildTop+t.firstChildHeight+2;for(let i=0;i<t.eventMeta.length;i++){let r=t.eventMeta[i];r.top=Math.max(r.top,d+s),s=r.top-d+o+r.height,r.startIndex===e&&(n[a].element[0].style.top=r.top+"px",a++)}t.eventMeta.length>0?(s-=o,s+=2):s+="auto"===i?25:i,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(),i=t.content[0];e&&!n&&e.height(i.clientHeight)},_createCalendar:function(t){var n=this.startDate(),i=[n],o="",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++){o+="<tr>",i.push(n);var h=7*u;o+=s._createRows(n,h,r,t),n=s._adjustStartDate(n,u===d-1),o+="</tr>"}return this._weekStartDates=i,this._endDate=e.date.previousDay(n),o},_createRow:function(t,n,i,o){for(var r=this,a=r._firstDayOfMonth,l=r._lastDayOfMonth,d=r.dayTemplate,u="",h="",c=this._groupedView,f=function(){return r._resourceBySlot({groupIndex:o})},v=0;v<i;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(),i=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),o=t.map(i,(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>&nbsp;</div>",className:"k-hidden k-slot-cell"});e=a._createRowsLayout(r,s,this.groupHeaderTemplate,o),o=a._createVerticalColumnsLayout(r,s,this.groupHeaderTemplate,o)}else o=a._createColumnsLayout(r,o,this.groupHeaderTemplate,o);return{columns:o,rows:e}},_createEventElement:function(n){var i=this.options,o=i.editable,r=this._isMobile();n.showDelete=o&&!1!==o.destroy&&!r,n.resizable=o&&!1!==o.resize&&!r,n.ns=e.ns,n.resources=this.eventResources(n),n.inverseColor=!1,n.messages=i.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],i=n.firstSlot().start,o=n.lastSlot().end-1,r=e.date.toUtcTime(t.start),a=e.date.toUtcTime(t.end);return(_(r,i,o)||_(a,i,o)||_(i,r,a)||_(o,r,a))&&(!_(a,i,i)||_(a,r,r)||t.isAllDay)},_slotIndex:function(t){return this._slotIndices[s(t).getTime()]},_positionMobileEvent:function(n,o,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=i.collidingEvents(n.events(),u,h);c.push({element:o,start:u,end:h});var f=i.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:o,start:u,end:h,groupIndex:s.groupIndex}),r._continuousEvents.push({element:o,uid:o.attr(e.attr("uid")),start:n.start,end:n.end}),p[0].appendChild(o[0]))},_positionEvent:function(n,o,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=i.collidingEvents(n.events(),d,u),v=d!==u?3:2;c.push({element:o,start:d,end:u});for(var p=i.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:o,start:d,end:u,groupIndex:l.groupIndex}),o[0].style.width=n.innerWidth()-v+"px",o[0].style.left=l.offsetLeft+2+"px",o[0].style.height="auto"===a?"":a+"px",r._continuousEvents.push({element:o,uid:o.attr(e.attr("uid")),start:n.start,end:n.end,order:parseInt(o.attr(e.attr("order")),10)}),o.appendTo(this.content),this._inverseEventColor(o);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?o.outerHeight():a,top:0,startIndex:H,endIndex:n.end.index,uid:o.attr(e.attr("uid")),order:parseInt(o.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 i=0;i<this.groups.length;i++){var o=this._groupedView._getTimeSlotByPosition(t,e,i);if(o)return o}return null},_appendResizeHint:function(t){t.appendTo(this.content),this._resizeHint=this._resizeHint.add(t)},_updateResizeHint:function(t,n,i,o){this._removeResizeHint();for(var r=this.groups[n].ranges(i,o,!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(i),"M/dd")),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(e.toString(e.timezone.toLocalDate(o),"M/dd"))},_updateMoveHint:function(t,n,i){var o=e.date.toUtcTime(t.start)+i,r=o+t.duration(),a=this.groups[n].ranges(o,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 i=0;i<t;i++)this._addResourceView(i);this._groupedView._addDaySlotCollections(t,e,n)},addDaySlot:function(t,n,i,o){var r=e.date.addDays(i,o),a=e.date.MS_PER_DAY,s=this.options.eventsPerDay;i.getHours()!==r.getHours()&&(a+=(i.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,i=this._isMobile(),o=this._isGroupedByDate(),r=this.options.adaptiveSlotHeight;this._canAdjustSlotHeight=!0!==i&&!0!==o&&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 i=this.groups[n],o=this._groupedView._view._isMobile();i&&(i._continuousEvents||(i._continuousEvents=[]),o?t.forEach(function(t){for(var n=i.slotRanges(t,!0),o=n[0],r=o.start.start,a=o.end.end,s=new Date(o.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=i.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,i,h,1,r,a,0)),s=e.date.addDays(s,1)}}.bind(this)):(t.forEach(function(t){for(var e,n=t.start,o=t.end,r=i.slotRanges(t,!0),a=r.length,s=0;s<a;s++)e=r[s],this._groupedView._positionEvent(t,i,e,a,n,o,s)}.bind(this)),!0===this._canAdjustSlotHeight&&this._adjustSlotHeight(i)))},_renderGroups:function(t,n,o,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:i.groupEqFilter(u)}).toArray();n.length>1?o=this._renderGroups(h,n.slice(1),o++,r+1,u):this._renderEvents(h,o++)}}return o},_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(o),this.element&&this.element.off(o),i.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