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