EOS/Scripts/kendo/2015.3.1111/kendo.scheduler.dayview.min.js
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

9 lines
25 KiB
JavaScript

/*
* Kendo UI v2015.3.1111 (http://www.telerik.com/kendo-ui)
* Copyright 2015 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(e,define){define(["./kendo.scheduler.view.min"],e)}(function(){return function(e,t){function n(e){var t=new Date(1980,1,1,0,0,0);return c(t,m(e)),t}function i(e,t,n){return e>=t&&n>=e}function o(e,t,n,i){return i=i?n>=e:n>e,e>t&&i}function r(e,t,n,i){var o,r=e._continuousEvents,s=r[r.length-1],l=f(t.start.startDate()).getTime();if(i&&s&&f(s.start.startDate()).getTime()==l){for(o=r.length-1;o>-1&&!(r[o].isAllDay||f(r[o].start.startDate()).getTime()<l);o--);r.splice(o+1,0,{element:n,isAllDay:!0,uid:n.attr(a.attr("uid")),start:t.start,end:t.end})}else r.push({element:n,isAllDay:i,uid:n.attr(a.attr("uid")),start:t.start,end:t.end})}function s(e){var t=[],n=e.workWeekStart;for(t.push(n);e.workWeekEnd!=n;)n>6?n-=7:n++,t.push(n);return t}var a=window.kendo,l=a.ui,c=a.date.setTime,u=l.SchedulerView,d=e.extend,h=e.proxy,f=a.date.getDate,p=a.date.MS_PER_MINUTE,g=a.date.MS_PER_DAY,m=a.date.getMilliseconds,v=".kendoMultiDayView",_=a.template('<div title="(#=kendo.format("{0:t} - {1:t}", start, end)#): #=title.replace(/"/g,"&\\#34;")#"><div class="k-event-template k-event-time">#:kendo.format("{0:t} - {1:t}", start, end)#</div><div class="k-event-template">${title}</div></div>'),w=a.template('<div title="(#=kendo.format("{0:t}", start)#): #=title.replace(/"/g,"&\\#34;")#"><div class="k-event-template">${title}</div></div>'),b=a.template("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd M/dd')#</span>"),y='<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#=inverseColor ? " k-event-inverse" : ""#" #} else {#class="k-event"#}#><span class="k-event-actions"># if(data.tail || data.middle) {#<span class="k-icon k-i-arrow-w"></span>#}## if(data.isException()) {#<span class="k-icon k-i-exception"></span># } else if(data.isRecurring()) {#<span class="k-icon k-i-refresh"></span># } #</span>{0}<span class="k-event-actions">#if (showDelete) {#<a href="\\#" class="k-link k-event-delete"><span class="k-icon k-si-close"></span></a>#}## if(data.head || data.middle) {#<span class="k-icon k-i-arrow-e"></span>#}#</span>#if(resizable && !singleDay && !data.tail && !data.middle){#<span class="k-resize-handle k-resize-w"></span>#}##if(resizable && !singleDay && !data.head && !data.middle){#<span class="k-resize-handle k-resize-e"></span>#}#</div>',x='<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#=inverseColor ? " k-event-inverse" : ""#"#} else {#class="k-event"#}#><span class="k-event-actions"># if(data.isException()) {#<span class="k-icon k-i-exception"></span># } else if(data.isRecurring()) {#<span class="k-icon k-i-refresh"></span># } #</span>{0}<span class="k-event-actions">#if (showDelete) {#<a href="\\#" class="k-link k-event-delete"><span class="k-icon k-si-close"></span></a>#}#</span><span class="k-event-top-actions"># if(data.tail || data.middle) {#<span class="k-icon k-i-arrow-n"></span># } #</span><span class="k-event-bottom-actions"># if(data.head || data.middle) {#<span class="k-icon k-i-arrow-s"></span># } #</span># if(resizable && !data.tail && !data.middle) {#<span class="k-resize-handle k-resize-n"></span># } ## if(resizable && !data.head && !data.middle) {#<span class="k-resize-handle k-resize-s"></span># } #</div>',k=u.extend({init:function(e,t){var n=this;u.fn.init.call(n,e,t),n.title=n.options.title||n.options.name,n._workDays=s(n.options),n._templates(),n._editable(),n.calculateDateRange(),n._groups(),n._currentTime()},_currentTimeMarkerUpdater:function(){var t,n,i,o,r,s,l,c,u,d,h=new Date,f=this.options;for(f.currentTimeMarker.useLocalTimezone===!1&&(t=f.dataSource.options.schema.timezone,f.dataSource&&t&&(n=a.timezone.offset(h,t),h=a.timezone.convert(h,h.getTimezoneOffset(),n))),this.times.find(".k-current-time").remove(),i=f.group&&"horizontal"!=f.group.orientation?this.groups.length:1,o=0;i>o;o++){if(r=this.groups[o],s=a.date.toUtcTime(h),l=r.timeSlotRanges(s,s+1),0===l.length)return;c=l[0].collection,u=c.slotByStartDate(h),u&&(d=e("<div class='k-current-time'></div>"),d.appendTo(this.times).css({top:Math.round(l[0].innerRect(h,new Date(h.getTime()+1),!1).top),height:"1px",right:"1px",left:0}))}},_currentTime:function(){var e,n=this,i=n.options.currentTimeMarker;i!==!1&&i.updateInterval!==t&&(e=i.updateInterval,n._currentTimeMarkerUpdater(),n._currentTimeUpdateTimer=setInterval(h(this._currentTimeMarkerUpdater,n),e))},_updateResizeHint:function(e,t,n,i){var o,r,s,l,c,d,h,f,p,g,m=e.isMultiDay(),v=this.groups[t],_=v.ranges(n,i,m,e.isAllDay);for(this._removeResizeHint(),o=0;_.length>o;o++)r=_[o],s=r.startSlot(),l=s.offsetWidth,c=s.clientHeight,d=s.offsetTop,m?l=r.innerWidth():(h=r.outerRect(n,i,this.options.snap),d=h.top,c=h.bottom-h.top),f=u.fn._createResizeHint.call(this,s.offsetLeft,d,l,c),this._resizeHint=this._resizeHint.add(f);p="t",g=this.content,m&&(p="M/dd",g=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day) > div"),g.length||(g=this.content)),this._resizeHint.appendTo(g),this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(a.toString(a.timezone.toLocalDate(n),p)),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(a.toString(a.timezone.toLocalDate(i),p))},_updateMoveHint:function(e,t,n){var i,o,r,s,l,c,u,d=e.isMultiDay(),h=this.groups[t],f=a.date.toUtcTime(e.start)+n,p=f+e.duration(),g=h.ranges(f,p,d,e.isAllDay);for(f=a.timezone.toLocalDate(f),p=a.timezone.toLocalDate(p),this._removeMoveHint(),!d&&(0===m(p)||m(p)<m(this.startTime()))&&g.length>1&&g.pop(),i=0;g.length>i;i++)o=g[i],r=o.start,s=this._createEventElement(e.clone({start:f,end:p}),!d),s.addClass("k-event-drag-hint"),l={left:r.offsetLeft+2,top:r.offsetTop},this._isRtl&&(l.left=.1*r.clientWidth+r.offsetLeft+2),d?l.width=o.innerWidth()-4:(c=o.outerRect(f,p,this.options.snap),l.top=c.top,l.height=c.bottom-c.top,l.width=.9*r.clientWidth-4),s.css(l),this._moveHint=this._moveHint.add(s);u=this.content,d&&(u=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day) > div"),u.length||(u=this.content)),this._moveHint.appendTo(u)},_slotByPosition:function(e,t){var n,i,o,r;for(this._isVerticallyGrouped()?(i=this.content.offset(),t+=this.content[0].scrollTop,e+=this.content[0].scrollLeft):i=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day)").find(">div").offset(),i&&(e-=i.left,t-=i.top),e=Math.ceil(e),t=Math.ceil(t),r=0;this.groups.length>r;r++)if(o=this.groups[r],n=o.daySlotByPosition(e,t))return n;for(i&&(e+=i.left,t+=i.top),i=this.content.offset(),e-=i.left,t-=i.top,this._isVerticallyGrouped()||(t+=this.content[0].scrollTop,e+=this.content[0].scrollLeft),e=Math.ceil(e),t=Math.ceil(t),r=0;this.groups.length>r;r++)if(o=this.groups[r],n=o.timeSlotByPosition(e,t))return n;return null},_groupCount:function(){var e=this.groupedResources;return e.length?"vertical"===this._groupOrientation()?this._rowCountForLevel(e.length-1):this._columnCountForLevel(e.length)/this._columnOffsetForResource(e.length):1},_columnCountInResourceView:function(){var e=this.groupedResources;return!e.length||this._isVerticallyGrouped()?this._columnCountForLevel(0):this._columnOffsetForResource(e.length)},_timeSlotGroups:function(e,t){var n,i,o,r,s,a,l,c,u,d,h,f,p,g,v,_,w=this._timeSlotInterval(),b=this.content.find("tr:not(.k-scheduler-header-all-day)");for(b.attr("role","row"),n=b.length,this._isVerticallyGrouped()&&(n=Math.floor(n/e)),i=0;e>i;i++)for(o=0,this._isVerticallyGrouped()&&(o=i),r=o*n,a=0,this._isVerticallyGrouped()||(a=i);(o+1)*n>r;){for(l=b[r].children,c=this.groups[i],r%n===0&&(s=m(new Date(+this.startTime()))),u=a*t;(a+1)*t>u;u++)d=l[u],h=u%t,f=c.getTimeSlotCollection(h),p=this._dates[h],g=Date.UTC(p.getFullYear(),p.getMonth(),p.getDate()),v=g+s,_=v+w,d.setAttribute("role","gridcell"),d.setAttribute("aria-selected",!1),f.addTimeSlot(d,v,_);s+=w,r++}},_daySlotGroups:function(e,t){var n,i,o,r,s,l,c,u,d,h,f,p;for(n=this.element.find(this._isVerticallyGrouped()?".k-scheduler-header-all-day":".k-scheduler-header-all-day tr"),n.attr("role","row"),i=0;e>i;i++)for(o=0,this._isVerticallyGrouped()&&(o=i),r=this.groups[i],s=r.getDaySlotCollection(0),l=n[o].children,c=0,this._isVerticallyGrouped()||(c=i),u=0,d=c*t;(c+1)*t>d;d++)h=l[d],d%t===0&&(u=0),f=this._dates[u],p=Date.UTC(f.getFullYear(),f.getMonth(),f.getDate()),u++,h.setAttribute("role","gridcell"),h.setAttribute("aria-selected",!1),s.addDaySlot(h,p,p+a.date.MS_PER_DAY)},_groups:function(){var e,t,n,i=this._groupCount(),o=this._columnCountInResourceView();for(this.groups=[],e=0;i>e;e++){for(t=this._addResourceView(e),n=0;o>n;n++)t.addTimeSlotCollection(this._dates[n],a.date.addDays(this._dates[n],1));this.options.allDaySlot&&t.addDaySlotCollection(this._dates[0],a.date.addDays(this._dates[this._dates.length-1],1))}this._timeSlotGroups(i,o),this.options.allDaySlot&&this._daySlotGroups(i,o)},options:{name:"MultiDayView",selectedDateFormat:"{0:D}",selectedShortDateFormat:"{0:d}",allDaySlot:!0,showWorkHours:!1,title:"",startTime:a.date.today(),endTime:a.date.today(),minorTickCount:2,majorTick:60,majorTimeHeaderTemplate:"#=kendo.toString(date, 't')#",minorTimeHeaderTemplate:"&nbsp;",groupHeaderTemplate:"#=text#",slotTemplate:"&nbsp;",allDaySlotTemplate:"&nbsp;",eventTemplate:_,allDayEventTemplate:w,dateHeaderTemplate:b,editable:!0,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,footer:{command:"workDay"},messages:{allDay:"all day",showFullDay:"Show full day",showWorkDay:"Show business hours"},currentTimeMarker:{updateInterval:1e4,useLocalTimezone:!0}},events:["remove","add","edit"],_templates:function(){var e=this.options,t=d({},a.Template,e.templateSettings);this.eventTemplate=this._eventTmpl(e.eventTemplate,x),this.allDayEventTemplate=this._eventTmpl(e.allDayEventTemplate,y),this.majorTimeHeaderTemplate=a.template(e.majorTimeHeaderTemplate,t),this.minorTimeHeaderTemplate=a.template(e.minorTimeHeaderTemplate,t),this.dateHeaderTemplate=a.template(e.dateHeaderTemplate,t),this.slotTemplate=a.template(e.slotTemplate,t),this.allDaySlotTemplate=a.template(e.allDaySlotTemplate,t),this.groupHeaderTemplate=a.template(e.groupHeaderTemplate,t)},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var t=this;t.element.on("click"+v,".k-event a:has(.k-si-close)",function(n){t.trigger("remove",{uid:e(this).closest(".k-event").attr(a.attr("uid"))}),n.preventDefault()}),t.options.editable.create!==!1&&t.element.on("dblclick"+v,".k-scheduler-content td",function(n){var i,o;e(this).parent().hasClass("k-scheduler-header-all-day")||(i=t._slotByPosition(n.pageX,n.pageY),i&&(o=t._resourceBySlot(i),t.trigger("add",{eventInfo:d({start:i.startDate(),end:i.endDate()},o)})),n.preventDefault())}).on("dblclick"+v,".k-scheduler-header-all-day td",function(e){var n,i=t._slotByPosition(e.pageX,e.pageY);i&&(n=t._resourceBySlot(i),t.trigger("add",{eventInfo:d({},{isAllDay:!0,start:a.date.getDate(i.startDate()),end:a.date.getDate(i.startDate())},n)})),e.preventDefault()}),t.options.editable.update!==!1&&t.element.on("dblclick"+v,".k-event",function(n){t.trigger("edit",{uid:e(this).closest(".k-event").attr(a.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var t=this,n=0;a.support.mobileOS.android&&(n=5),t.options.editable.create!==!1&&(t._addUserEvents=new a.UserEvents(t.element,{threshold:n,filter:".k-scheduler-content td",tap:function(n){var i,o;e(n.target).parent().hasClass("k-scheduler-header-all-day")||(i=t._slotByPosition(n.x.location,n.y.location),i&&(o=t._resourceBySlot(i),t.trigger("add",{eventInfo:d({start:i.startDate(),end:i.endDate()},o)})),n.preventDefault())}}),t._allDayUserEvents=new a.UserEvents(t.element,{threshold:n,filter:".k-scheduler-header-all-day td",tap:function(e){var n,i=t._slotByPosition(e.x.location,e.y.location);i&&(n=t._resourceBySlot(i),t.trigger("add",{eventInfo:d({},{isAllDay:!0,start:a.date.getDate(i.startDate()),end:a.date.getDate(i.startDate())},n)})),e.preventDefault()}})),t.options.editable.update!==!1&&(t._editUserEvents=new a.UserEvents(t.element,{threshold:n,filter:".k-event",tap:function(n){var i=e(n.target).closest(".k-event");i.hasClass("k-event-active")||t.trigger("edit",{uid:i.attr(a.attr("uid"))}),n.preventDefault()}}))},_layout:function(e){var t,n,i,o=[],r=[],s=this.options,l=this;for(t=0;e.length>t;t++)n={},n.text=l.dateHeaderTemplate({date:e[t]}),a.date.isToday(e[t])&&(n.className="k-today"),o.push(n);return i=this.groupedResources,s.allDaySlot&&r.push({text:s.messages.allDay,allDay:!0,cellContent:function(t){var n=t;return t=i.length&&"vertical"!==l._groupOrientation()?t%e.length:t,l.allDaySlotTemplate({date:e[t],resources:function(){return l._resourceBySlot({groupIndex:n})}})}}),this._forTimeRange(this.startTime(),this.endTime(),function(e,t,n,i){var o=t?l.majorTimeHeaderTemplate:l.minorTimeHeaderTemplate,s={text:o({date:e}),className:i?"k-slot-cell":""};r.push(s)}),i.length&&("vertical"===this._groupOrientation()?r=this._createRowsLayout(i,r,this.groupHeaderTemplate):o=this._createColumnsLayout(i,o,this.groupHeaderTemplate)),{columns:o,rows:r}},_footer:function(){var t,n,i,o=this.options;o.footer!==!1&&(t='<div class="k-header k-scheduler-footer">',n=o.footer.command,n&&"workDay"===n?(t+='<ul class="k-reset k-header">',t+='<li class="k-state-default k-scheduler-fullday"><a href="#" class="k-link"><span class="k-icon k-i-clock"></span>',t+=(o.showWorkHours?o.messages.showFullDay:o.messages.showWorkDay)+"</a></li>",t+="</ul>"):t+="&nbsp;",t+="</div>",this.footer=e(t).appendTo(this.element),i=this,this.footer.on("click"+v,".k-scheduler-fullday",function(e){e.preventDefault(),i.trigger("navigate",{view:i.name||o.name,date:i.startDate(),isWorkDay:!o.showWorkHours})}))},_forTimeRange:function(e,t,i,o){var r,s,a,l,u,d,h,f,v,_,w,b,y,x,k,C;for(e=n(e),t=n(t),r=this,s=m(e),a=m(t),l=r.options.minorTickCount,u=r.options.majorTick*p,d=u/l||1,h=new Date(+e),f=h.getDate(),_=0,b="",w=g/d,s!=a&&(s>a&&(a+=g),w=(a-s)/d),w=Math.round(w);w>_;_++)y=_%(u/d),x=0===y,k=l-1>y,C=y===l-1,b+=i(h,x,k,C),c(h,d,!1);return a&&(v=m(h),f<h.getDate()&&(v+=g),v>a&&(h=new Date(+t))),o&&(b+=o(h)),b},_content:function(e){var t,n,i,o=this,r=o.options,s=o.startTime(),l=this.endTime(),c=1,u=1,d=e.length,h="",f=this.groupedResources,p=this.slotTemplate,g=this.allDaySlotTemplate,m=!1;for(f.length&&(m="vertical"===o._groupOrientation(),m?(u=this._rowCountForLevel(this.rowLevels.length-2),r.allDaySlot&&(t=function(t){var n,i,r='<tr class="k-scheduler-header-all-day">',s=function(){return o._resourceBySlot({groupIndex:t})};for(n=0,i=e.length;i>n;n++)r+="<td>"+g({date:e[n],resources:s})+"</td>";return r+"</tr>"})):c=this._columnCountForLevel(this.columnLevels.length-2)),h+="<tbody>",n=function(t,n){var r,s,l,u,h="",f="",g=0;for(h="<tr"+(n?' class="k-middle-row"':"")+">",u=function(e){return function(){return o._resourceBySlot({groupIndex:e})}};c>g;g++)for(r=0,s=d;s>r;r++)f="",a.date.isToday(e[r])&&(f+="k-today"),(a.date.getMilliseconds(t)<a.date.getMilliseconds(o.options.workDayStart)||a.date.getMilliseconds(t)>=a.date.getMilliseconds(o.options.workDayEnd)||!o._isWorkDay(e[r]))&&(f+=" k-nonwork-hour"),h+="<td"+(""!==f?' class="'+f+'"':"")+">",l=a.date.getDate(e[r]),a.date.setTime(l,a.date.getMilliseconds(t)),h+=p({date:l,resources:u(m?i:g)}),h+="</td>";return h+="</tr>"},i=0;u>i;i++)h+=t?t(i):"",h+=this._forTimeRange(s,l,n);h+="</tbody>",this.content.find("table").append(h)},_isWorkDay:function(e){var t,n=e.getDay(),i=this._workDays;for(t=0;i.length>t;t++)if(i[t]===n)return!0;return!1},_render:function(t){var n,i=this;t=t||[],this._dates=t,this._startDate=t[0],this._endDate=t[t.length-1||0],this.createLayout(this._layout(t)),this._content(t),this._footer(),this.refreshLayout(),n=this.element.find(".k-scheduler-header-all-day td"),n.length&&(this._allDayHeaderHeight=n.first()[0].clientHeight),i.datesHeader.on("click"+v,".k-nav-day",function(t){var n=e(t.currentTarget).closest("th"),o=n.offset(),r=i._slotByPosition(o.left,o.top+n.outerHeight());i.trigger("navigate",{view:"day",date:r.startDate()})})},startTime:function(){var e=this.options;return e.showWorkHours?e.workDayStart:e.startTime},endTime:function(){var e=this.options;return e.showWorkHours?e.workDayEnd:e.endTime},startDate:function(){return this._startDate},endDate:function(){return this._endDate},_end:function(e){var t=m(this.endTime())||g;return e&&(t=0),new Date(this._endDate.getTime()+t)},nextDate:function(){return a.date.nextDay(this.endDate())},previousDate:function(){return a.date.previousDay(this.startDate())},calculateDateRange:function(){this._render([this.options.date])},destroy:function(){var e=this;e._currentTimeUpdateTimer&&clearInterval(e._currentTimeUpdateTimer),e.datesHeader&&e.datesHeader.off(v),e.element&&e.element.off(v),e.footer&&e.footer.remove(),u.fn.destroy.call(this),this._isMobile()&&e.options.editable&&(e.options.editable.create!==!1&&(e._addUserEvents.destroy(),e._allDayUserEvents.destroy()),e.options.editable.update!==!1&&e._editUserEvents.destroy())},inRange:function(e){var t=u.fn.inRange.call(this,e),n=m(this.startTime()),i=m(this.endTime())||a.date.MS_PER_DAY,o=m(e.start),r=m(e.end)||a.date.MS_PER_DAY;return t&&o>=n&&i>=r},selectionByElement:function(e){var t=e.offset();return this._slotByPosition(t.left,t.top)},_timeSlotInterval:function(){var e=this.options;return e.majorTick/e.minorTickCount*p},_timeSlotIndex:function(e){var t=this.options,n=m(e),i=m(this.startTime()),o=t.majorTick/t.minorTickCount*p;return(n-i)/o},_slotIndex:function(e,t){return t?this._dateSlotIndex(e):this._timeSlotIndex(e)},_dateSlotIndex:function(e,t){var n,o,r,s,l=this._dates||[],c=1;for(n=0,o=l.length;o>n;n++)if(r=a.date.getDate(l[n]),s=new Date(a.date.getDate(l[n]).getTime()+g-(t?0:1)),i(e,r,s))return n*c;return-1},_positionAllDayEvent:function(t,n){var i,o,r,s,a,l,c,d=n.innerWidth(),h=n.start.index,f=n.end.index,p=u.collidingEvents(n.events(),h,f),g=this._headerColumnCount||0,m=2,v=h!==f?5:4,_=this._allDayHeaderHeight,w=n.startSlot();for(t.css({left:w.offsetLeft+m,width:d-v}),n.addEvent({slotIndex:h,start:h,end:f,element:t}),p.push({slotIndex:h,start:h,end:f,element:t}),i=u.createRows(p),i.length&&i.length>g&&(this._headerColumnCount=i.length),o=n.start.offsetTop,r=0,s=i.length;s>r;r++)for(a=i[r].events,l=0,c=a.length;c>l;l++)e(a[l].element).css({top:o+r*_})},_arrangeColumns:function(e,t,n,i){var o,r,s,a,l,c,d,h,f,p,g,m=i.start;for(e={element:e,slotIndex:m.index,start:t,end:t+n},r=m.clientWidth,s=.1*r,l=i.events(),c=u.collidingEvents(l,e.start,e.end),i.addEvent(e),c.push(e),o=u.createColumns(c),d=(r-s)/o.length,h=0,f=o.length;f>h;h++)for(a=o[h].events,p=0,g=a.length;g>p;p++)a[p].element[0].style.width=d-4+"px",a[p].element[0].style.left=(this._isRtl?s:0)+m.offsetLeft+h*d+2+"px"},_positionEvent:function(e,t,n){var i=e._startTime||e.start,o=e._endTime||e.end,r=n.innerRect(i,o,!1),s=r.bottom-r.top-2;0>s&&(s=0),t.css({top:r.top,height:s}),this._arrangeColumns(t,r.top,t[0].clientHeight,n)},_createEventElement:function(t,n,o,r){var s,l,c,u,h,p,v=n?this.eventTemplate:this.allDayEventTemplate,_=this.options,w=_.editable,b=this._isMobile(),y=w&&w.destroy!==!1&&!b,x=w&&w.resize!==!1,k=f(this.startDate()),C=f(this.endDate()),S=m(this.startTime()),T=m(this.endTime()),D=t._time("start"),A=t._time("end");return S>=T&&(T=m(new Date(this.endTime().getTime()+g-1))),n||t.isAllDay||(C=new Date(C.getTime()+g)),l=t.start,c=t.end,t.isAllDay&&(c=f(t.end)),!i(f(l),k,C)&&!i(c,k,C)||n&&S>D&&A>T?s=!0:f(l)<k||n&&S>D?r=!0:(c>C&&!n||n&&A>T)&&(o=!0),u=this.eventResources(t),t._startTime&&D!==a.date.getMilliseconds(t.start)&&(l=new Date(D),l=a.timezone.apply(l,"Etc/UTC")),t._endTime&&A!==a.date.getMilliseconds(t.end)&&(c=new Date(A),c=a.timezone.apply(c,"Etc/UTC")),h=d({},{ns:a.ns,resizable:x,showDelete:y,middle:s,head:o,tail:r,singleDay:1==this._dates.length,resources:u,inverseColor:u&&u[0]?this._shouldInverseResourceColor(u[0]):!1},t,{start:l,end:c}),p=e(v(h)),this.angular("compile",function(){return{elements:p,data:[{dataItem:h}]}}),p},_isInTimeSlot:function(e){var t,n=this.startTime(),i=this.endTime(),r=e._startTime||e.start,s=e._endTime||e.end;return m(i)===m(a.date.getDate(i))&&(i=a.date.getDate(i),c(i,g-1)),e._date("end")>e._date("start")&&(s=+e._date("end")+(g-1)),s-=e._date("end"),r-=e._date("start"),i=m(i),n=m(n),n===r&&r===s?!0:(t=r!==i,o(r,n,i,t)||o(s,n,i,t)||o(n,r,s)||o(i,r,s))},_isInDateSlot:function(e){var t=this.groups[0],n=t.firstSlot().start,o=t.lastSlot().end-1,r=a.date.toUtcTime(e.start),s=a.date.toUtcTime(e.end);return(i(r,n,o)||i(s,n,o)||i(n,r,s)||i(o,r,s))&&(!i(s,n,n)||i(s,r,r)||e.isAllDay)},_updateAllDayHeaderHeight:function(e){var t,n;if(this._height!==e&&(this._height=e,t=this.element.find(".k-scheduler-header-all-day td"),t.length))for(t.parent().add(this.element.find(".k-scheduler-times-all-day").parent()).height(e),n=0;this.groups.length>n;n++)this.groups[n].refresh()},_renderEvents:function(e,t){var n,i,o,s,a,l,c,u,d,h,f,p,m,v,_,w=this.datesHeader.find(".k-scheduler-header-wrap > div");for(i=0,o=e.length;o>i;i++)if(n=e[i],this._isInDateSlot(n))if(s=n.isAllDay||n.end.getTime()-n.start.getTime()>=g,a=s&&!this._isVerticallyGrouped()?w:this.content,s)this.options.allDaySlot&&(u=this.groups[t],u._continuousEvents||(u._continuousEvents=[]),c=u.slotRanges(n),c.length&&(l=this._createEventElement(n,!s),this._positionAllDayEvent(l,c[0]),r(u,c[0],l,!0),l.appendTo(a)));else if(this._isInTimeSlot(n))for(u=this.groups[t],u._continuousEvents||(u._continuousEvents=[]),c=u.slotRanges(n),d=c.length,h=0;d>h;h++)f=c[h],p=n.start,m=n.end,d>1&&(0===h?m=f.end.endDate():h==d-1?p=f.start.startDate():(p=f.start.startDate(),m=f.end.endDate())),v=n.clone({start:p,end:m,_startTime:n._startTime,_endTime:n.endTime}),this._isInTimeSlot(v)&&(_=f.head,l=this._createEventElement(n,!s,_,f.tail),l.appendTo(a),this._positionEvent(v,l,f),r(u,f,l,!1))},render:function(t){var n,o,r,s;for(this._headerColumnCount=0,this._groups(),this.element.find(".k-event").remove(),t=new a.data.Query(t).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray(),n=[],this._eventsByResource(t,this.groupedResources,n),o=e.map(this._dates,function(t){return Math.max.apply(null,e.map(n,function(n){return e.grep(n,function(e){return e.isMultiDay()&&i(t,f(e.start),f(e.end))}).length}))}),r=Math.max.apply(null,o),this._updateAllDayHeaderHeight((r+1)*this._allDayHeaderHeight),s=0;n.length>s;s++)this._renderEvents(n[s],s);this.refreshLayout(),this.trigger("activate")},_eventsByResource:function(e,t,n){var i,o,r,s,l=t[0];if(l)for(i=l.dataSource.view(),o=0;i.length>o;o++)r=this._resourceValue(l,i[o]),s=new a.data.Query(e).filter({field:l.field,operator:u.groupEqFilter(r)}).toArray(),t.length>1?this._eventsByResource(s,t.slice(1),n):n.push(s);else n.push(e)},_columnOffsetForResource:function(e){return this._columnCountForLevel(e)/this._columnCountForLevel(e-1)},_columnCountForLevel:function(e){var t=this.columnLevels[e];return t?t.length:0},_rowCountForLevel:function(e){var t=this.rowLevels[e];return t?t.length:0},clearSelection:function(){this.content.add(this.datesHeader).find(".k-state-selected").removeAttr("id").attr("aria-selected",!1).removeClass("k-state-selected")},_updateDirection:function(e,t,n,i,o){var r=e.isAllDay,s=t[0].start,a=t[t.length-1].end;n&&(o?r||s.index!==a.index||s.collectionIndex!==a.collectionIndex||(e.backward=i):(r&&s.index===a.index||!r&&s.collectionIndex===a.collectionIndex)&&(e.backward=i))},_changeViewPeriod:function(e,n,i){var o,r,s,a;return i?t:(o=n?this.previousDate():this.nextDate(),r=e.start,s=e.end,e.start=new Date(o),e.end=new Date(o),a=e.isAllDay?g:m(s),c(e.start,m(r)),c(e.end,a),this._isVerticallyGrouped()||(e.groupIndex=n?this.groups.length-1:0),e.events=[],!0)}});d(!0,l,{MultiDayView:k,DayView:k.extend({options:{name:"DayView",title:"Day"},name:"day"}),WeekView:k.extend({options:{name:"WeekView",title:"Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}"},name:"week",calculateDateRange:function(){var e,t,n=this.options.date,i=a.date.dayOfWeek(n,this.calendarInfo().firstDay,-1),o=[];for(e=0,t=7;t>e;e++)o.push(i),i=a.date.nextDay(i);this._render(o)}}),WorkWeekView:k.extend({options:{name:"WorkWeekView",title:"Work Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}"},name:"workWeek",nextDate:function(){return a.date.dayOfWeek(a.date.nextDay(this.startDate()),this.calendarInfo().firstDay,1)},previousDate:function(){var e=a.date.dayOfWeek(this.startDate(),this.calendarInfo().firstDay,-1);return a.date.previousDay(e)},calculateDateRange:function(){for(var e=this.options.date,t=a.date.dayOfWeek,n=t(e,this.calendarInfo().firstDay,-1),i=t(n,this.options.workWeekStart,1),o=t(i,this.options.workWeekEnd,1),r=[];o>=i;)r.push(i),i=a.date.nextDay(i);this._render(r)}})})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});