10 lines
23 KiB
JavaScript
10 lines
23 KiB
JavaScript
/*
|
|
* Kendo UI Complete v2013.3.1119 (http://kendoui.com)
|
|
* Copyright 2013 Telerik AD. All rights reserved.
|
|
*
|
|
* Kendo UI Complete commercial licenses may be obtained at
|
|
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
|
|
* If you do not own a commercial license, this file shall be governed by the trial license terms.
|
|
*/
|
|
!function(define){return define(["./kendo.scheduler.view.min"],function(){!function(e){function t(e){var t=new Date(1980,1,1,0,0,0);return l(t,m(e)),t}function a(e,t,a){var s,i=t.getTime(),n=a.getTime();return s=e.getTime(),s>=i&&n>=s}function s(e,t,a,s){return s=s?a>=e:a>e,e>t&&s}function i(e,t,a,s){var i,n=e._continuousEvents,r=n[n.length-1],l=u(t.start.startDate()).getTime();if(s&&r&&u(r.start.startDate()).getTime()==l){for(i=n.length-1;i>-1&&!(n[i].isAllDay||u(n[i].start.startDate()).getTime()<l);i--);n.splice(i+1,0,{element:a,isAllDay:!0,uid:a.attr(o.attr("uid")),start:t.start,end:t.end})}else n.push({element:a,isAllDay:s,uid:a.attr(o.attr("uid")),start:t.start,end:t.end})}function n(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,r=o.ui,l=o.date.setTime,d=r.SchedulerView,h=e.extend,c=e.proxy,u=o.date.getDate,p=o.date.MS_PER_MINUTE,f=o.date.MS_PER_DAY,m=o.date.getMilliseconds,v=".kendoMultiDayView",g=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>'),D=o.template('<div title="(#=kendo.format("{0:t}", start)#): #=title.replace(/"/g,"&\\#34;")#"><div class="k-event-template">${title}</div></div>'),k=o.template("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd M/dd')#</span>"),_='<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>',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.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>',T=d.extend({init:function(e,t){var a=this;d.fn.init.call(a,e,t),a.title=a.options.title||a.options.name,a._workDays=n(a.options),a._templates(),a._editable(),a.calculateDateRange(),a._groups()},_updateResizeHint:function(e,t,a,s){var i,n,r,l,h,c,u,p,f,m,v=e.isMultiDay(),g=this.groups[t],D=g.ranges(a,s,v,e.isAllDay);for(this._removeResizeHint(),i=0;i<D.length;i++)n=D[i],r=n.startSlot(),l=r.offsetWidth,h=r.clientHeight,c=r.offsetTop,v?l=n.innerWidth():(u=n.outerRect(a,s,this.options.snap),c=u.top,h=u.bottom-u.top),p=d.fn._createResizeHint.call(this,this._scrollbarOffset(r.offsetLeft,v),c,l,h),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(s),f))},_updateMoveHint:function(e,t,a){var s,i,n,r,l,d,h,c=e.isMultiDay(),u=this.groups[t],p=o.date.toUtcTime(e.start)+a,f=p+e.duration(),v=u.ranges(p,f,c,e.isAllDay);for(p=o.timezone.toLocalDate(p),f=o.timezone.toLocalDate(f),this._removeMoveHint(),!c&&(0===m(f)||m(f)<m(this.startTime()))&&v.length>1&&v.pop(),s=0;s<v.length;s++)i=v[s],n=i.start,r=this._createEventElement(e.clone({start:p,startTime:p,end:f,endTime:f}),!c),r.addClass("k-event-drag-hint"),l={left:n.offsetLeft+2,top:n.offsetTop},this._isRtl&&(l.left=.1*n.clientWidth+this._scrollbarOffset(n.offsetLeft)+2),c?l.width=i.innerWidth()-4:(d=i.outerRect(p,f,this.options.snap),l.top=d.top,l.height=d.bottom-d.top,l.width=.9*n.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,s,i,n;for(this._isVerticallyGrouped()?(s=this.content.offset(),t+=this.content[0].scrollTop,e+=this.content[0].scrollLeft):s=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day)").find(">div").offset(),s&&(e-=s.left,t-=s.top),e=Math.ceil(e),t=Math.ceil(t),n=0;n<this.groups.length;n++)if(i=this.groups[n],a=i.daySlotByPosition(e,t))return a;for(s&&(e+=s.left,t+=s.top),s=this.content.offset(),e-=s.left,t-=s.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(i=this.groups[n],a=i.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,s,i,n,o,r,l,d,h,c,u,p,f,v,g,D,k=this._timeSlotInterval(),_=this.content.find("tr:not(.k-scheduler-header-all-day)");for(_.attr("role","row"),a=_.length,this._isVerticallyGrouped()&&(a=Math.floor(a/e)),s=0;e>s;s++)for(i=0,this._isVerticallyGrouped()&&(i=s),n=i*a,r=0,this._isVerticallyGrouped()||(r=s);(i+1)*a>n;){for(l=_[n].children,d=this.groups[s],0===n%a&&(o=m(new Date(+this.startTime()))),h=r*t;(r+1)*t>h;h++)c=l[h],u=h%t,p=d.getTimeSlotCollection(u),f=this._dates[u],v=Date.UTC(f.getFullYear(),f.getMonth(),f.getDate()),g=v+o,D=g+k,c.setAttribute("role","gridcell"),c.setAttribute("aria-selected",!1),p.addTimeSlot(c,g,D);o+=k,n++}},_daySlotGroups:function(e,t){var a,s,i,n,r,l,d,h,c,u,p,f;for(a=this._isVerticallyGrouped()?this.element.find(".k-scheduler-header-all-day"):this.element.find(".k-scheduler-header-all-day tr"),a.attr("role","row"),s=0;e>s;s++)for(i=0,this._isVerticallyGrouped()&&(i=s),n=this.groups[s],r=n.getDaySlotCollection(0),l=a[i].children,d=0,this._isVerticallyGrouped()||(d=s),h=0,c=d*t;(d+1)*t>c;c++)u=l[c],0===c%t&&(h=0),p=o.date.addDays(this.startDate(),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,s=this._groupCount(),i=this._columnCountInResourceView();for(this.groups=[],e=0;s>e;e++){for(t=this._addResourceView(e),a=0;i>a;a++)t.addTimeSlotCollection(this._dates[a],o.date.addDays(this._dates[a],1));t.addDaySlotCollection(this._dates[0],this._dates[this._dates.length-1])}this._timeSlotGroups(s,i),this.options.allDaySlot&&this._daySlotGroups(s,i)},options:{name:"MultiDayView",selectedDateFormat:"{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:" ",slotTemplate:" ",allDaySlotTemplate:" ",eventTemplate:g,allDayEventTemplate:D,dateHeaderTemplate:k,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"}},events:["remove","add","edit"],_templates:function(){var e=this.options,t=h({},o.Template,e.templateSettings);this.eventTemplate=this._eventTmpl(e.eventTemplate,y),this.allDayEventTemplate=this._eventTmpl(e.allDayEventTemplate,_),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)},_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(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"+v,".k-scheduler-content td",function(a){var s,i;e(this).parent().hasClass("k-scheduler-header-all-day")||(s=t._slotByPosition(a.pageX,a.pageY),s&&(i=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({start:s.startDate(),end:s.endDate()},i)})),a.preventDefault())}).on("dblclick"+v,".k-scheduler-header-all-day td",function(e){var a,s=t._slotByPosition(e.pageX,e.pageY);s&&(a=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({},{isAllDay:!0,start:o.date.getDate(s.startDate()),end:o.date.getDate(s.startDate())},a)})),e.preventDefault()}),t.options.editable.update!==!1&&t.element.on("dblclick"+v,".k-event",function(a){t.trigger("edit",{uid:e(this).closest(".k-event").attr(o.attr("uid"))}),a.preventDefault()})},_touchEditable:function(){var t=this;t.options.editable.create!==!1&&(t._addUserEvents=new o.UserEvents(t.element,{filter:".k-scheduler-content td",tap:function(a){var s,i;e(a.target).parent().hasClass("k-scheduler-header-all-day")||(s=t._slotByPosition(a.x.location,a.y.location),s&&(i=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({start:s.startDate(),end:s.endDate()},i)})),a.preventDefault())}}),t._allDayUserEvents=new o.UserEvents(t.element,{filter:".k-scheduler-header-all-day td",tap:function(e){var a,s=t._slotByPosition(e.x.location,e.y.location);s&&(a=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({},{isAllDay:!0,start:o.date.getDate(s.startDate()),end:o.date.getDate(s.startDate())},a)})),e.preventDefault()}})),t.options.editable.update!==!1&&(t._editUserEvents=new o.UserEvents(t.element,{filter:".k-event",tap:function(a){var s=e(a.target).closest(".k-event");s.hasClass("k-event-active")||t.trigger("edit",{uid:s.attr(o.attr("uid"))}),a.preventDefault()}}))},_layout:function(e){var t,a,s,i=[],n=[],r=this.options,l=this;for(t=0;t<e.length;t++)a={},a.text=l.dateHeaderTemplate({date:e[t]}),o.date.isToday(e[t])&&(a.className="k-today"),i.push(a);return s=this.groupedResources,r.allDaySlot&&n.push({text:r.messages.allDay,allDay:!0,cellContent:function(t){return t=s.length&&"vertical"!==l._groupOrientation()?t%e.length:t,l.allDaySlotTemplate({date:e[t]})}}),this._forTimeRange(this.startTime(),this.endTime(),function(e,t,a,s){var i=t?l.majorTimeHeaderTemplate:l.minorTimeHeaderTemplate,o={text:i({date:e}),className:s?"k-slot-cell":""};n.push(o)}),s.length&&("vertical"===this._groupOrientation()?n=this._createRowsLayout(s,n):i=this._createColumnsLayout(s,i)),{columns:i,rows:n}},_footer:function(){var t,a,s,i=this.options;i.footer!==!1&&(t='<div class="k-header k-scheduler-footer">',a=i.footer.command,a&&"workDay"===a?(t+='<ul class="k-reset k-header k-toolbar">',t+='<li class="k-state-default k-scheduler-fullday"><a href="#" class="k-link"><span class="k-icon k-i-clock"></span>',t+=(i.showWorkHours?i.messages.showFullDay:i.messages.showWorkDay)+"</a></li>",t+="</ul>"):t+=" ",t+="</div>",this.footer=e(t).appendTo(this.element),s=this,this.footer.on("click"+v,".k-scheduler-fullday",function(e){e.preventDefault(),s.trigger("navigate",{view:s.name||i.name,date:s.startDate(),isWorkDay:!i.showWorkHours})}))},_forTimeRange:function(e,a,s,i){var n,o,r,d,h,c,u,v,g,D,k,_,y,T,w,S;for(e=t(e),a=t(a),r=this,d=m(e),h=m(a),c=r.options.minorTickCount,u=r.options.majorTick*p,v=u/c||1,g=new Date(+e),D=g.getDate(),k=0,_="",o=f/v,d!=h&&(d>h&&(h+=f),o=(h-d)/v),o=Math.round(o);o>k;k++)y=k%(u/v),T=0===y,w=c-1>y,S=y===c-1,_+=s(g,T,w,S),l(g,v,!1);return h&&(n=m(g),D<g.getDate()&&(n+=f),n>h&&(g=new Date(+a))),i&&(_+=i(g)),_},_content:function(e){var t,a,s,i,n=this,r=n.options,l=n.startTime(),d=this.endTime(),h=1,c=1,u=e.length,p="",f=this.groupedResources,m="",v=this.slotTemplate;if(f.length)if("vertical"===n._groupOrientation()){if(c=this._rowCountForLevel(this.rowLevels.length-2),r.allDaySlot){for(m='<tr class="k-scheduler-header-all-day">',t=0,a=e.length;a>t;t++)m+="<td>"+this.allDaySlotTemplate({date:e[t]})+"</td>";m+="</tr>"}}else h=this._columnCountForLevel(this.columnLevels.length-2);for(p+="<tbody>",s=function(t,a){var s,i,r,l,d="",c="";for(d="<tr"+(a?' class="k-middle-row"':"")+">",l=0;h>l;l++)for(s=0,i=u;i>s;s++)c="",o.date.isToday(e[s])&&(c+="k-today"),(o.date.getMilliseconds(t)<o.date.getMilliseconds(n.options.workDayStart)||o.date.getMilliseconds(t)>=o.date.getMilliseconds(n.options.workDayEnd)||!n._isWorkDay(e[s]))&&(c+=" k-nonwork-hour"),d+="<td"+(""!==c?' class="'+c+'"':"")+">",r=o.date.getDate(e[s]),o.date.setTime(r,o.date.getMilliseconds(t)),d+=v({date:r}),d+="</td>";return d+="</tr>"},i=0;c>i;i++)p+=m,p+=this._forTimeRange(l,d,s);p+="</tbody>",this.content.find("table").append(p)},_isWorkDay:function(e){var t,a=e.getDay(),s=this._workDays;for(t=0;t<s.length;t++)if(s[t]===a)return!0;return!1},_render:function(t){var a,s=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),s.datesHeader.on("click"+v,".k-nav-day",function(t){var a=e(t.currentTarget).closest("th"),i=a.offset(),n=s._slotByPosition(i.left,i.top+a.outerHeight());s.trigger("navigate",{view:"day",date:n.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())||f;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.datesHeader&&e.datesHeader.off(v),e.element&&e.element.off(v),d.fn.destroy.call(this),e.footer&&e.footer.remove(),this._isMobile()&&(e.options.editable.create!==!1&&(e._addUserEvents.destroy(),e._allDayUserEvents.destroy()),e.options.editable.update!==!1&&e._editUserEvents.destroy())},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,a=m(e),s=m(this.startTime()),i=t.majorTick/t.minorTickCount*p;return(a-s)/i},_slotIndex:function(e,t){return t?this._dateSlotIndex(e):this._timeSlotIndex(e)},_dateSlotIndex:function(e,t){var s,i,n,r,l=this._dates||[],d=1;for(s=0,i=l.length;i>s;s++)if(n=o.date.getDate(l[s]),r=new Date(o.date.getDate(l[s]).getTime()+f-(t?0:1)),a(e,n,r))return s*d;return-1},_positionAllDayEvent:function(t,a){var s,i,n,o,r,l,h,c=a.innerWidth(),u=a.start.index,p=a.end.index,f=d.collidingEvents(a.events(),u,p),m=this._headerColumnCount||0,v=2,g=u!==p?5:4,D=this._allDayHeaderHeight,k=a.startSlot();for(t.css({left:this._scrollbarOffset(k.offsetLeft+v,!0),width:c-g}),a.addEvent({slotIndex:u,start:u,end:p,element:t}),f.push({slotIndex:u,start:u,end:p,element:t}),s=d.createRows(f),s.length&&s.length>m&&(this._updateAllDayHeaderHeight(D*s.length+D),this._headerColumnCount=s.length),i=a.start.offsetTop,n=0,o=s.length;o>n;n++)for(r=s[n].events,l=0,h=r.length;h>l;l++)e(r[l].element).css({top:i+n*D})},_arrangeColumns:function(e,t,a,s){var i,n,o,r,l,h,c,u,p,f,m,v=s.start;for(e={element:e,slotIndex:v.index,start:t,end:t+a},o=v.clientWidth,r=.1*o,l=s.events(),h=d.collidingEvents(l,e.start,e.end),s.addEvent(e),h.push(e),i=d.createColumns(h),c=(o-r)/i.length,u=0,p=i.length;p>u;u++)for(n=i[u].events,f=0,m=n.length;m>f;f++)n[f].element[0].style.width=c-4+"px",n[f].element[0].style.left=(this._isRtl?this._scrollbarOffset(r):0)+v.offsetLeft+u*c+2+"px"},_positionEvent:function(e,t,a){var s,i,n=e.start,r=e.end;e.startTime&&(n=o.date.getMilliseconds(e.startTime)+o.date.toUtcTime(o.date.getDate(e.start))),e.endTime&&(r=o.date.getMilliseconds(e.endTime)+o.date.toUtcTime(o.date.getDate(e.end))),s=a.innerRect(n,r,!1),i=s.bottom-s.top-2,0>i&&(i=0),t.css({top:s.top,height:i}),this._arrangeColumns(t,s.top,t[0].clientHeight,a)},_eventTmpl:function(e,t){var a,s=this.options,i=h({},o.Template,s.templateSettings),n=i.paramName,r="",l=typeof e,d={storage:{},count:0};return"function"===l?(d.storage["tmpl"+d.count]=e,r+="#=this.tmpl"+d.count+"("+n+")#",d.count++):"string"===l&&(r+=e),a=o.template(o.format(t,r),i),d.count>0&&(a=c(a,d.storage)),a},_createEventElement:function(t,s,i,n){var r,l,d,c=s?this.eventTemplate:this.allDayEventTemplate,p=this.options,v=p.editable,g=this._isMobile(),D=v&&v.destroy!==!1&&!g,k=v&&v.resize!==!1,_=u(this.startDate()),y=u(this.endDate()),T=m(this.startTime()),w=m(this.endTime()),S=m(t.startTime||t.start),b=m(t.endTime||t.end);return T>=w&&(w=m(new Date(this.endTime().getTime()+f-1))),s||t.isAllDay||(y=new Date(y.getTime()+f)),l=t.end,t.isAllDay&&(l=u(t.end)),!a(u(t.start),_,y)&&!a(l,_,y)||s&&T>S&&b>w?r=!0:u(t.start)<_||s&&T>S?n=!0:(l>y&&!s||s&&b>w)&&(i=!0),d=this.eventResources(t),e(c(h({},{ns:o.ns,resizable:k,showDelete:D,middle:r,head:i,tail:n,singleDay:1==this._dates.length,resources:d,inverseColor:d&&d[0]?this._shouldInverseResourceColor(d[0]):!1},t,{start:t.startTime||t.start,end:t.endTime||t.end})))},_isInTimeSlot:function(e){var t,a=this.startTime(),i=this.endTime(),n=e.startTime||e.start,r=e.endTime||e.end;return m(i)===m(o.date.getDate(i))&&(i=o.date.getDate(i),l(i,f-1)),o.date.getDate(r)>o.date.getDate(n)&&(r=o.date.getDate(r),l(r,f-1)),r=m(r),n=m(n),i=m(i),a=m(a),a===n&&n===r?!0:(t=n!==i,s(n,a,i,t)||s(r,a,i,t)||s(a,n,r)||s(i,n,r))},_isInDateSlot:function(e){var t=this.startDate(),s=new Date(this.endDate().getTime()+f-1);return(a(e.start,t,s)||a(e.end,t,s)||a(t,e.start,e.end)||a(s,e.start,e.end))&&(!a(e.end,t,t)||a(e.end,e.start,e.start)||e.isAllDay)},_updateAllDayHeaderHeight:function(e){var t,a=this.element.find(".k-scheduler-header-all-day td");if(a.length)for(a.parent().add(this.element.find(".k-scheduler-times-all-day").parent()).height(e),t=0;t<this.groups.length;t++)this.groups[t].refresh()},_renderEvents:function(e,t){var a,s,n,o,r,l,d,h,c,u,p,m,v,g,D,k=this.datesHeader.find(".k-scheduler-header-wrap > div");for(s=0,n=e.length;n>s;s++)if(a=e[s],this._isInDateSlot(a))if(o=a.isAllDay||a.end.getTime()-a.start.getTime()>=f,r=o&&!this._isVerticallyGrouped()?k:this.content,o)this.options.allDaySlot&&(h=this.groups[t],h._continuousEvents||(h._continuousEvents=[]),d=h.slotRanges(a),l=this._createEventElement(a,!o),this._positionAllDayEvent(l,d[0]),i(h,d[0],l,!0),l.appendTo(r));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],m=a.start,v=a.end,c>1&&(0===u?v=p.end.endDate():u==c-1?m=p.start.startDate():(m=p.start.startDate(),v=p.end.endDate())),g=a.clone({start:m,end:v,startTime:a.startTime,endTime:a.endTime}),this._isInTimeSlot(g)&&(D=p.head,l=this._createEventElement(a,!o,D,p.tail),l.appendTo(r),this._positionEvent(g,l,p),i(h,p,l,!1))},render:function(e){this._headerColumnCount=0,this._groups(),this.element.find(".k-event").remove(),this._updateAllDayHeaderHeight(this._allDayHeaderHeight),e=new o.data.Query(e).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray();var t=this.groupedResources;t.length?this._renderGroups(e,t,0):this._renderEvents(e,0,0),this.refreshLayout(),this.trigger("activate")},_renderGroups:function(e,t,a){var s,i,n,r,l=t[0];if(l)for(s=l.dataSource.view(),i=0;i<s.length;i++)n=this._resourceValue(l,s[i]),r=new o.data.Query(e).filter({field:l.field,operator:d.groupEqFilter(n)}).toArray(),t.length>1?a=this._renderGroups(r,t.slice(1),a++):this._renderEvents(r,a++);return a},_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,s,i){var n=e.isAllDay,o=t[0].start,r=t[t.length-1].end;a&&(i?n||o.index!==r.index||o.collectionIndex!==r.collectionIndex||(e.backward=s):(n&&o.index===r.index||!n&&o.collectionIndex===r.collectionIndex)&&(e.backward=s))},_changeViewPeriod:function(e,t,a){var s,i,n,o;return a?undefined:(s=t?this.previousDate():this.nextDate(),i=e.start,n=e.end,e.start=new Date(s),e.end=new Date(s),o=e.isAllDay?f:m(n),l(e.start,m(i)),l(e.end,o),this._isVerticallyGrouped()||(e.groupIndex=t?this.groups.length-1:0),e.events=[],!0)}});h(!0,r,{MultiDayView:T,DayView:T.extend({options:{title:"Day"},name:"day"}),WeekView:T.extend({options:{title:"Week",selectedDateFormat:"{0:D} - {1:D}"},name:"week",calculateDateRange:function(){var e,t,a=this.options.date,s=o.date.dayOfWeek(a,this.calendarInfo().firstDay,-1),i=[];for(e=0,t=7;t>e;e++)i.push(s),s=o.date.nextDay(s);this._render(i)}}),WorkWeekView:T.extend({options:{title:"Work Week",selectedDateFormat:"{0:D} - {1:D}"},nextDate:function(){return o.date.dayOfWeek(o.date.nextDay(this.endDate()),this.options.workWeekStart,1)},previousDate:function(){return o.date.previousDay(this.startDate())},calculateDateRange:function(){for(var e=this.options.date,t=o.date.dayOfWeek(e,this.options.workWeekStart,-1),a=o.date.dayOfWeek(t,this.options.workWeekEnd,1),s=[];a>=t;)s.push(t),t=o.date.nextDay(t);this._render(s)}})})}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()});
|
|
//@ sourceMappingURL=kendo.scheduler.dayview.min.js.map
|