Files
upo-senior-assistant/SeniorAssistant/wwwroot/kendo/2018.1.221/js/kendo.scheduler.dayview.min.js
Giacomo c807c474c4 Init
- aggiunto un po di tutto comeil progetto del prof
2018-09-14 19:38:02 +02:00

27 lines
33 KiB
JavaScript

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