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

9 lines
23 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,p(e)),t}function i(e){var t=[],n=e.workWeekStart;for(t.push(n);e.workWeekEnd!=n;)n>6?n-=7:n++,t.push(n);return t}function o(e){var t,n=0;if(e.columns){for(t=0;e.columns.length>t;t++)n+=o(e.columns[t]);return e.colspan=n,n}return e.colspan=1,1}function r(e,t,n){var i,o,r,s;for(i=e.length-1;i>=0;i--)o=e[i].rectLeft,s=e[i].rectRight,r=t>=o&&s>=t,(r||o>=t&&n>=s||o>=t&&n>=o)&&(t>o&&(t=o),s>n&&(n=s));return a(e,t,n)}function a(e,t,n){var i,o,r=[];for(i=0;e.length>i;i++)o={rectLeft:e[i].rectLeft,rectRight:e[i].rectRight},(t>o.rectLeft&&o.rectRight>t||o.rectLeft>=t&&n>=o.rectRight)&&r.push(e[i]);return r}var s=window.kendo,l=s.ui,c=s.date.setTime,u=l.SchedulerView,d=e.extend,h=e.proxy,f=s.date.getDate,p=s.date.getMilliseconds,g=s.date.MS_PER_DAY,m=s.date.MS_PER_MINUTE,v=".kendoTimelineView",_=s.template('<div><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=s.template("<span class='k-link k-nav-day'>#=kendo.format('{0:m}', date)#</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) {#<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) {#<span class="k-icon k-i-arrow-e"></span>#}#</span>#if(resizable && !data.tail){#<span class="k-resize-handle k-resize-w"></span>#}##if(resizable && !data.head){#<span class="k-resize-handle k-resize-e"></span>#}#</div>',b=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=i(n.options),n._templates(),n._editable(),n.calculateDateRange(),n._groups(),n._currentTime()},name:"timeline",_currentTimeMarkerUpdater:function(){var t,n,i,o,r,a,l,c,u,d,h,f,p=new Date,g=this.options;if(this.datesHeader.find(".k-current-time").remove(),this._isInDateSlot({start:p,end:p}))for(g.currentTimeMarker.useLocalTimezone===!1&&(t=g.dataSource.options.schema.timezone,g.dataSource&&t&&(n=s.timezone.offset(p,t),p=s.timezone.convert(p,p.getTimezoneOffset(),n))),i=g.group&&"vertical"!=g.group.orientation?this.groups.length:1,o=0;i>o;o++){if(r=this.groups[o],a=s.date.toUtcTime(p),l=r.timeSlotRanges(a,a+1),0===l.length)return;c=l[0].collection,u=c.slotByStartDate(p),u&&(d=e("<div class='k-current-time'></div>"),h=this.datesHeader,f=Math.round(l[0].innerRect(p,new Date(p.getTime()+1),!1).left),d.appendTo(h.find(".k-scheduler-header-wrap")).css({left:this._adjustLeftPosition(f),width:"1px",bottom:"1px",top:0}))}},_adjustLeftPosition:function(e){return this._isRtl&&(e-=this.content[0].scrollWidth-this.content[0].offsetWidth),e},_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))},_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(s.attr("uid"))}),n.preventDefault()}),t.options.editable.create!==!1&&t.element.on("dblclick"+v,".k-scheduler-content td",function(e){var n,i=t._slotByPosition(e.pageX,e.pageY);i&&(n=t._resourceBySlot(i),t.trigger("add",{eventInfo:d({start:i.startDate(),end:i.endDate()},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(s.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var t=this,n=0;s.support.mobileOS.android&&(n=5),t.options.editable.create!==!1&&(t._addUserEvents=new s.UserEvents(t.element,{threshold:n,filter:".k-scheduler-content 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({start:i.startDate(),end:i.endDate()},n)})),e.preventDefault()}})),t.options.editable.update!==!1&&(t._editUserEvents=new s.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(s.attr("uid"))}),n.preventDefault()}}))},_slotByPosition:function(e,t){var n,i,o,r,a=this.content,l=a.offset();for(e-=l.left,t-=l.top,this._isRtl?(r=s.support.browser,r.mozilla?(e+=a[0].scrollWidth-a[0].offsetWidth,e+=a[0].scrollLeft):r.msie?(e-=a.scrollLeft(),e+=a[0].scrollWidth-a[0].offsetWidth):r.webkit&&(e+=a[0].scrollLeft)):e+=a[0].scrollLeft,t+=a[0].scrollTop,e=Math.ceil(e),t=Math.ceil(t),o=0;this.groups.length>o;o++)if(i=this.groups[o],n=i.timeSlotByPosition(e,t))return n;return null},options:{name:"TimelineView",title:"Timeline",selectedDateFormat:"{0:D}",selectedShortDateFormat:"{0:d}",date:s.date.today(),startTime:s.date.today(),endTime:s.date.today(),showWorkHours:!1,minorTickCount:2,editable:!0,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,majorTick:60,eventHeight:25,eventMinWidth:0,columnWidth:100,groupHeaderTemplate:"#=text#",majorTimeHeaderTemplate:"#=kendo.toString(date, 't')#",slotTemplate:"&nbsp;",eventTemplate:_,dateHeaderTemplate:w,footer:{command:"workDay"},currentTimeMarker:{updateInterval:1e4,useLocalTimezone:!0},messages:{defaultRowText:"All events",showFullDay:"Show full day",showWorkDay:"Show business hours"}},events:["remove","add","edit"],_templates:function(){var e=this.options,t=d({},s.Template,e.templateSettings);this.eventTemplate=this._eventTmpl(e.eventTemplate,y),this.majorTimeHeaderTemplate=s.template(e.majorTimeHeaderTemplate,t),this.dateHeaderTemplate=s.template(e.dateHeaderTemplate,t),this.slotTemplate=s.template(e.slotTemplate,t),this.groupHeaderTemplate=s.template(e.groupHeaderTemplate,t)},_render:function(t){var n=this;t=t||[],n._dates=t,n._startDate=t[0],n._endDate=t[t.length-1||0],n._calculateSlotRanges(),n.createLayout(n._layout(t)),n._content(t),n._footer(),n._setContentWidth(),n.refreshLayout(),n.datesHeader.on("click"+v,".k-nav-day",function(t){var i=e(t.currentTarget).closest("th"),o=n._slotByPosition(i.offset().left,n.content.offset().top);n.trigger("navigate",{view:"timeline",date:o.startDate()})}),n.timesHeader.find("table tr:last").hide(),n.datesHeader.find("table tr:last").hide()},_setContentWidth:function(){var e=this.content,t=e.width(),n=this.content.find("table"),i=n.find("tr:first").children().length,o=100,r=i*this.options.columnWidth;r>t&&(o=Math.ceil(r/t*100)),n.add(this.datesHeader.find("table")).css("width",o+"%")},_calculateSlotRanges:function(){var e,t,n,i,o=this._dates,r=this.startTime(),a=this.endTime();for(p(a)===p(s.date.getDate(a))&&(a=s.date.getDate(a),c(a,g-1)),a=p(a),r=p(r),e=[],t=0;o.length>t;t++)n=f(o[t]),c(n,r),i=f(o[t]),c(i,a),e.push({start:s.date.toUtcTime(n),end:s.date.toUtcTime(i)});this._slotRanges=e},_forTimeRange:function(e,t,i,o){var r,a,s,l,u,d,h,f,v,_,w,y,b,x,k,C,S,T;for(e=n(e),t=n(t),r=this,a=p(e),s=p(t),l=r.options.minorTickCount,u=r.options.majorTick*m,d=u/l||1,h=new Date(+e),f=h.getDate(),_=0,y="",w=g/d,a!=s&&(a>s&&(s+=g),w=(s-a)/d),w=Math.round(w);w>_;_++)b=_%(u/d),x=0===b,k=l-1>b,C=b===l-1,S=l,w%l!==0&&(T=l>w-(_+1),x&&T&&(S=w%l)),y+=i(h,x,k,C,S),c(h,d,!1);return s&&(v=p(h),f<h.getDate()&&(v+=g),v>s&&(h=new Date(+t))),o&&(y+=o(h)),y},_layout:function(e){var t,n,i,r=[],a=[],s=this,l=[{text:s.options.messages.defaultRowText}],c=[];for(t=0;s.options.minorTickCount>t;t++)c.push({text:"",className:""});for(this._forTimeRange(s.startTime(),s.endTime(),function(e,t,n,i,a){var l,u=s.majorTimeHeaderTemplate;t&&(l={text:u({date:e}),className:i?"k-slot-cell":"",columns:c.slice(0,a)},o(l),r.push(l))}),n=0;e.length>n;n++)a.push({text:s.dateHeaderTemplate({date:e[n]}),className:"k-slot-cell",columns:r.slice(0)});return i=this.groupedResources,i.length&&("vertical"===this._groupOrientation()?l=s._createRowsLayout(i,null,this.groupHeaderTemplate):a=s._createColumnsLayout(i,a,this.groupHeaderTemplate)),{columns:a,rows:l}},_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})}))},_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},_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},_content:function(e){var t,n,i,o,r,a=this,l=a.options,c=a.startTime(),u=this.endTime(),d=1,h=1,f=e.length,p="",g=this.groupedResources,m=this.slotTemplate,v=!1;for(g.length&&(v="vertical"===a._groupOrientation(),v?h=a._groupCount():d=a._groupCount()),p+="<tbody>",t=function(t){var r,c="",u="",d=function(e){return function(){return a._resourceBySlot({groupIndex:e})}};return s.date.isToday(e[o])&&(u+="k-today"),(s.date.getMilliseconds(t)<s.date.getMilliseconds(l.workDayStart)||s.date.getMilliseconds(t)>=s.date.getMilliseconds(l.workDayEnd)||!a._isWorkDay(e[o]))&&(u+=" k-nonwork-hour"),c+="<td"+(""!==u?' class="'+u+'"':"")+">",r=s.date.getDate(e[o]),s.date.setTime(r,s.date.getMilliseconds(t)),c+=m({date:r,resources:d(v?n:i)}),c+="</td>"},n=0;h>n;n++){for(p+="<tr>",i=0;d>i;i++)for(o=0,r=f;r>o;o++)p+=this._forTimeRange(c,u,t);p+="</tr>"}p+="</tbody>",this.content.find("table").append(p)},_groups:function(){var e,t,n,i,o=this._groupCount(),r=this._dates,a=r.length;for(this.groups=[],e=0;o>e;e++)t=this._addResourceView(e),n=r[0],i=r[r.length-1||0],t.addTimeSlotCollection(n,s.date.addDays(i,1));this._timeSlotGroups(o,a)},_isVerticallyGrouped:function(){return this.groupedResources.length&&"vertical"===this._groupOrientation()},_isHorizontallyGrouped:function(){return this.groupedResources.length&&"horizontal"===this._groupOrientation()},_timeSlotGroups:function(e,t){var n,i,o,r,a,s,l,c,u,d,h,f,g,m,v,_,w,y,b=this._timeSlotInterval(),x=this._isVerticallyGrouped(),k=this.content.find("tr"),C=k.length;for(k.attr("role","row"),x&&(C=Math.floor(C/e)),n=0;e>n;n++)for(i=0,o=this.groups[n],x&&(i=n),a=i*C,s=0,x||(s=n),l=k[a].children,c=l.length/(x?1:e),u=c/t,d=0;t>d;d++)for(h=d*u+c*s,r=p(new Date(+this.startTime())),f=0;u>f;f++)g=l[f+h],m=o.getTimeSlotCollection(0),v=this._dates[d],_=Date.UTC(v.getFullYear(),v.getMonth(),v.getDate()),w=_+r,y=w+b,g.setAttribute("role","gridcell"),g.setAttribute("aria-selected",!1),m.addTimeSlot(g,w,y,!0),r+=b},startDate:function(){return this._startDate},endDate:function(){return this._endDate},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},_timeSlotInterval:function(){var e=this.options;return e.majorTick/e.minorTickCount*m},nextDate:function(){return s.date.nextDay(this.endDate())},previousDate:function(){return s.date.previousDay(this.startDate())},calculateDateRange:function(){this._render([this.options.date])},render:function(e){var t,n,i,o,r;for(this._headerColumnCount=0,this._groups(),this.element.find(".k-event").remove(),e=new s.data.Query(e).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray(),t=[],this._eventsByResource(e,this.groupedResources,t),n=[],i=0,o=0;t.length>o;o++)r={groupIndex:o,maxRowCount:0,events:{}},n.push(r),this._renderEvents(t[o],o,r),r.maxRowCount>i&&(i=r.maxRowCount);this._setRowsHeight(n,t.length,i),this._positionEvents(n,t.length),this.trigger("activate")},_positionEvents:function(e,t){var n,i,o,r;for(n=0;t>n;n++){i=e[n].events;for(o in i)r=i[o],this._positionEvent(r)}},_setRowsHeight:function(t,n,i){var o,r,a,s,l,c=this.options.eventHeight+2,u=this._getBottomRowOffset();for(n=this._isVerticallyGrouped()?n:1,o=0;n>o;o++)r=this._isVerticallyGrouped()?t[o].maxRowCount:i,r=r?r:1,a=(c+2)*r+u,s=e(this.times.find("tr")[o]),l=e(this.content.find("tr")[o]),s.height(a),l.height(a);this._setContentWidth(),this.refreshLayout(),this._refreshSlots()},_getBottomRowOffset:function(){var e,t,n=.5*this.options.eventHeight,i=this._isMobile();return i?(e=30,t=60):(e=15,t=30),n>t?n=t:e>n&&(n=e),n},_positionEvent:function(e){var t,n,i,o=this.options.eventHeight+2,r=e.slotRange.innerRect(e.start,e.end,!1),a=this._adjustLeftPosition(r.left),s=r.right-r.left-2;0>s&&(s=0),this.options.eventMinWidth>s&&(t=e.slotRange.collection,n=t._slots[t._slots.length-1],i=n.offsetLeft+n.offsetWidth,s=this.options.eventMinWidth,a+s>i&&(s=i-r.left-2)),e.element.css({top:e.slotRange.start.offsetTop+e.rowIndex*(o+2)+"px",left:a,width:s})},_refreshSlots:function(){for(var e=0;this.groups.length>e;e++)this.groups[e].refresh()},_eventsByResource:function(e,t,n){var i,o,r,a,l=t[0];if(l)for(i=l.dataSource.view(),o=0;i.length>o;o++)r=this._resourceValue(l,i[o]),a=new s.data.Query(e).filter({field:l.field,operator:u.groupEqFilter(r)}).toArray(),t.length>1?this._eventsByResource(a,t.slice(1),n):n.push(a);else n.push(e)},_isInDateSlot:function(e){var t=e.start,n=e.end,i=f(this._startDate),o=s.date.addDays(f(this._endDate),1);return o>t&&n>=i?!0:!1},_isInTimeSlot:function(e){var t,n=e._startTime||s.date.toUtcTime(e.start),i=e._endTime||s.date.toUtcTime(e.end),o=this._slotRanges;for(n===i&&(i+=1),t=0;o.length>t;t++)if(o[t].end>n&&i>o[t].start)return!0;return!1},_adjustEvent:function(e){var t,n=e.start,i=e.end,o=e._time("start"),r=e._time("end"),a=p(this.startTime()),l=p(this.endTime()),u=null,d=null,h=!1,m=!1;return e.isAllDay?(u=f(n),a>o&&(c(u,a),m=!0),d=f(i),l===p(f(this.endTime()))?d=s.date.addDays(d,1):(c(d,l),h=!0)):(l=0===l?g:l,a>o?(u=f(n),c(u,a),m=!0):o>l&&(u=f(n),u=s.date.addDays(u,1),c(u,a),m=!0),r>l?(d=f(i),c(d,l),h=!0):a>r&&(d=f(i),d=s.date.addDays(d,-1),c(d,l),h=!0)),t=e.clone({start:u?u:n,end:d?d:i,_startTime:u?s.date.toUtcTime(u):e._startTime,_endTime:d?s.date.toUtcTime(d):e._endTime,isAllDay:!1}),{occurrence:t,head:h,tail:m}},_renderEvents:function(e,t,n){var i,o,r,a,s,l,c,u,d,h,f;for(o=0,r=e.length;r>o;o++)i=e[o],this._isInDateSlot(i)&&(a=i.isAllDay||i.end.getTime()-i.start.getTime()>=g,s=this.content,(a||this._isInTimeSlot(i))&&(l=this._adjustEvent(i),c=this.groups[t],c._continuousEvents||(c._continuousEvents=[]),u=c.slotRanges(l.occurrence,!1),d=u[0],this._isInTimeSlot(l.occurrence)&&(h=this._createEventElement(l.occurrence,i,d.head||l.head,d.tail||l.tail),h.appendTo(s).css({top:0,height:this.options.eventHeight}),f={start:l.occurrence._startTime||l.occurrence.start,end:l.occurrence._endTime||l.occurrence.end,element:h,uid:i.uid,slotRange:d,rowIndex:0,offsetTop:0},n.events[i.uid]=f,this.addContinuousEvent(c,d,h,i.isAllDay),this._arrangeRows(f,d,n))))},addContinuousEvent:function(e,t,n,i){var o=e._continuousEvents;o.push({element:n,isAllDay:i,uid:n.attr(s.attr("uid")),start:t.start,end:t.end})},_createEventElement:function(t,n,i,o){var r,a,l=this.eventTemplate,c=this.options.editable,u=this._isMobile(),h=c&&c.destroy!==!1&&!u,f=c&&c.resize!==!1,p=n._time("start"),g=n._time("end"),m=n.start,v=n.end,_=this.eventResources(n);return n._startTime&&p!==s.date.getMilliseconds(n.start)&&(m=new Date(p),m=s.timezone.apply(m,"Etc/UTC")),n._endTime&&g!==s.date.getMilliseconds(n.end)&&(v=new Date(g),v=s.timezone.apply(v,"Etc/UTC")),r=d({},{ns:s.ns,resizable:f,showDelete:h,head:i,tail:o,singleDay:1==this._dates.length,resources:_,inverseColor:_&&_[0]?this._shouldInverseResourceColor(_[0]):!1},n,{start:m,end:v}),a=e(l(r)),this.angular("compile",function(){return{elements:a,data:[{dataItem:r}]}}),a},_arrangeRows:function(e,t,n){var i,o,a,s,l,c,d=t.start.index,h=t.end.index,f=e.slotRange.innerRect(e.start,e.end,!1),p=f.right+this.options.eventMinWidth,g=r(t.events(),f.left,p);for(t.addEvent({slotIndex:d,start:d,end:h,rectLeft:f.left,rectRight:p,element:e.element,uid:e.uid}),g.push({start:d,end:h,uid:e.uid}),i=u.createRows(g),i.length>n.maxRowCount&&(n.maxRowCount=i.length),o=0,a=i.length;a>o;o++)for(s=i[o].events,l=0,c=s.length;c>l;l++)n.events[s[l].uid].rowIndex=o},_groupCount:function(){var e=this.groupedResources;return e.length?"vertical"===this._groupOrientation()?this._rowCountForLevel(e.length-1):this._columnCountForLevel(e.length-1):1},_updateEventForSelection:function(e){var t=this._adjustEvent(e.clone());return t.occurrence},_eventOptionsForMove:function(e){return e.isAllDay?{isAllDay:!1}:{}},_updateEventForResize:function(e){e.isAllDay&&e.set("isAllDay",!1)},_updateMoveHint:function(e,t,n){var i,o,r,a,s,l,c,u,d,h,f,p=this.groups[t],g=e.clone({start:e.start,end:e.end}),m=g.duration();for(g.start=new Date(g.start.getTime()+n),g.end=new Date(+g.start+m),i=this._adjustEvent(g),o=p.slotRanges(i.occurrence,!1),this._removeMoveHint(),r=0;o.length>r;r++)a=o[r],s=a.start,l=this._createEventElement(i.occurrence,i.occurrence,!1,!1),l.addClass("k-event-drag-hint"),c=a.innerRect(i.occurrence.start,i.occurrence.end,this.options.snap),u=c.right-c.left-2,0>u&&(u=0),d=this._adjustLeftPosition(c.left),h={left:d,top:s.offsetTop,height:s.offsetHeight-2,width:u},l.css(h),this._moveHint=this._moveHint.add(l);f=this.content,this._moveHint.appendTo(f)},_updateResizeHint:function(e,t,n,i){var o,r,a,l,c,d,h,f,p,g,m=this.groups[t],v=m.ranges(n,i,!1,!1);for(this._removeResizeHint(),o=0;v.length>o;o++)r=v[o],a=r.startSlot(),l=r.innerRect(n,i,!1),l.top=a.offsetTop,c=l.right-l.left,d=a.offsetHeight,h=this._adjustLeftPosition(l.left),f=u.fn._createResizeHint.call(this,h,l.top,c,d),this._resizeHint=this._resizeHint.add(f);p="t",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(s.toString(s.timezone.toLocalDate(n),p)),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(s.toString(s.timezone.toLocalDate(i),p))},selectionByElement:function(e){var t=e.offset();return this._slotByPosition(t.left,t.top)},_updateDirection:function(e,t,n,i,o){var r=t[0].start,a=t[t.length-1].end;n&&!o&&r.index===a.index&&r.collectionIndex===a.collectionIndex&&(e.backward=i)},_changeGroup:function(e,t){var n=t?"prevGroupSlot":"nextGroupSlot",i=this[n](e.start,e.groupIndex,!1);return i&&(e.groupIndex+=t?-1:1),i},prevGroupSlot:function(e,t,n){var i,o=this.groups[t],r=o.ranges(e,e,n,!1)[0].start;if(!(0>=t))return this._isVerticallyGrouped()?r:(i=o._collection(0,n),i.last())},nextGroupSlot:function(e,t,n){var i,o=this.groups[t],r=o.ranges(e,e,n,!1)[0].start;if(!(t>=this.groups.length-1))return this._isVerticallyGrouped()?r:(i=o._collection(0,n),i.first())},_verticalSlots:function(e,t,n,i){var o=i?"leftSlot":"rightSlot",r=t[0].start,a=t[t.length-1].end,s=this.groups[e.groupIndex];return r=s[o](r),a=s[o](a),n||!this._isVerticallyGrouped()||r&&a||(r=a=this._changeGroup(e,i)),{startSlot:r,endSlot:a}},_horizontalSlots:function(e,t,n,i){var o=i?"upSlot":"downSlot",r=t[0].start,a=t[t.length-1].end,s=this.groups[e.groupIndex];return r=s[o](r),a=s[o](a),n||!this._isHorizontallyGrouped()||r&&a||(r=a=this._changeGroup(e,i)),{startSlot:r,endSlot:a}},_changeViewPeriod:function(e,t){var n,i=t?this.previousDate():this.nextDate(),o=e.start,r=e.end;return e.start=new Date(i),e.end=new Date(i),this._isHorizontallyGrouped()&&(e.groupIndex=t?this.groups.length-1:0),n=r-o,t?(r=p(this.endTime()),r=0===r?g:r,c(e.start,r-n),c(e.end,r)):(o=p(this.startTime()),c(e.start,o),c(e.end,o+n)),e.events=[],!0},move:function(e,t,n){var i,o,r,a,l,c=!1,u=this.groups[e.groupIndex],d=s.keys,h=u.ranges(e.start,e.end,!1,!1);if(t===d.DOWN||t===d.UP)c=!0,r=t===d.UP,this._updateDirection(e,h,n,r,!0),a=this._verticalSlots(e,h,n,r);else if((t===d.LEFT||t===d.RIGHT)&&(c=!0,r=t===d.LEFT,this._updateDirection(e,h,n,r,!1),a=this._horizontalSlots(e,h,n,r),(!a.startSlot||!a.endSlot)&&!n&&this._changeViewPeriod(e,r,!1)))return c;return c&&(i=a.startSlot,o=a.endSlot,n?(l=e.backward,l&&i?e.start=i.startDate():!l&&o&&(e.end=o.endDate())):i&&o&&(e.start=i.startDate(),e.end=o.endDate()),e.events=[]),c},destroy:function(){var e=this;e.element&&e.element.off(v),e.footer&&e.footer.remove(),e._currentTimeUpdateTimer&&clearInterval(e._currentTimeUpdateTimer),u.fn.destroy.call(this),this._isMobile()&&e.options.editable&&(e.options.editable.create!==!1&&e._addUserEvents.destroy(),e.options.editable.update!==!1&&e._editUserEvents.destroy())}});d(!0,l,{TimelineView:b,TimelineWeekView:b.extend({options:{name:"TimelineWeekView",title:"Timeline Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWeek",calculateDateRange:function(){var e,t,n=this.options.date,i=s.date.dayOfWeek(n,this.calendarInfo().firstDay,-1),o=[];for(e=0,t=7;t>e;e++)o.push(i),i=s.date.nextDay(i);this._render(o)}}),TimelineWorkWeekView:b.extend({options:{name:"TimelineWorkWeekView",title:"Timeline Work Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWorkWeek",nextDate:function(){return s.date.dayOfWeek(s.date.nextDay(this.endDate()),this.options.workWeekStart,1)},previousDate:function(){return s.date.previousDay(this.startDate())},calculateDateRange:function(){for(var e=this.options.date,t=s.date.dayOfWeek(e,this.options.workWeekStart,-1),n=s.date.dayOfWeek(t,this.options.workWeekEnd,1),i=[];n>=t;)i.push(t),t=s.date.nextDay(t);this._render(i)}}),TimelineMonthView:b.extend({options:{name:"TimelineMonthView",title:"Timeline Month",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",workDayStart:new Date(1980,1,1,0,0,0),workDayEnd:new Date(1980,1,1,23,59,59),footer:!1,majorTick:1440,minorTickCount:1},name:"timelineMonth",calculateDateRange:function(){var e,t,n=this.options.date,i=s.date.firstDayOfMonth(n),o=s.date.lastDayOfMonth(n),r=[];for(e=0,t=o.getDate();t>e;e++)r.push(i),i=s.date.nextDay(i);this._render(r)}})})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});