@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
2 lines • 46 kB
JavaScript
module.exports=function(t){function e(n){if(s[n])return s[n].exports;var a=s[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}({0:function(t,e,s){t.exports=s(1271)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},1046:function(t,e){t.exports=require("./kendo.dom")},1113:function(t,e){t.exports=require("./kendo.draganddrop")},1271:function(t,e,s){var n,a,i;!function(r,define){a=[s(1046),s(1272),s(1113)],n=r,i="function"==typeof n?n.apply(e,a):n,!(void 0!==i&&(t.exports=i))}(function(){return function(t){function e(t){return delete t.name,delete t.prefix,delete t.views,t}function s(t){var e=[],s=t.workWeekStart;for(e.push(s);t.workWeekEnd!=s;)s>6?s-=7:s++,e.push(s);return e}function n(){var e=kendo._activeElement();e&&"body"!==e.nodeName.toLowerCase()&&t(e).blur()}var a,i,r=kendo.ui.Widget,o=kendo.dom.element,d=kendo.dom.text,l=kendo.dom.html,h=t.isPlainObject,p=kendo._outerWidth,c=kendo._outerHeight,u=t.extend,f=t.proxy,k=!1,g=kendo.keys,m=kendo.data.Query,_="string",v=".kendoGanttTimeline",y="click",w="dblclick",T="mousemove",D="mouseenter",b="mouseleave",H="keydown",W=".",M=kendo.template("#=kendo.toString(start, 't')#"),x=kendo.template("#=kendo.toString(start, 'ddd M/dd')#"),S=kendo.template("#=kendo.toString(start, 'ddd M/dd')# - #=kendo.toString(kendo.date.addDays(end, -1), 'ddd M/dd')#"),z=kendo.template("#=kendo.toString(start, 'MMM')#"),P=kendo.template("#=kendo.toString(start, 'yyyy')#"),C=kendo.template('<div class="#=styles.marquee#"><div class="#=styles.marqueeColor#"></div></div>'),E=kendo.template('<div style="z-index: 100002;" class="#=styles.tooltipWrapper# k-gantt-resize-hint"><div class="#=styles.tooltipContent#"><div>#=messages.start#: #=kendo.toString(start, format)#</div><div>#=messages.end#: #=kendo.toString(end, format)#</div></div></div>'),N=kendo.template('<div style="z-index: 100002;" class="#=styles.tooltipWrapper#" ><div class="#=styles.tooltipContent#">#=text#%</div><div class="#=styles.tooltipCallout#" style="left:13px;"></div></div>'),I=kendo.template('<div class="#=kendo.htmlEncode(styles.taskDetails)#"><strong>#=kendo.htmlEncode(task.title)#</strong><div class="#=styles.taskDetailsPercent#">#=kendo.toString(task.percentComplete, "p0")#</div><ul class="#=styles.reset#"><li>#=messages.start#: #=kendo.toString(task.start, "h:mm tt ddd, MMM d")#</li><li>#=messages.end#: #=kendo.toString(task.end, "h:mm tt ddd, MMM d")#</li></ul></div>'),R=kendo.template("<span>#=offsetPrefix#: #=offsetText#</span>"),O=kendo.template('<div class="k-task-content"><div>#=plannedStart#: #=startDate#</div><div>#=plannedEnd#: #=endDate#</div></div>'),V="<table style='visibility: hidden;'><tbody><tr style='height:{0}'><td> </td></tr></tbody></table>",F={day:{type:"kendo.ui.GanttDayView"},week:{type:"kendo.ui.GanttWeekView"},month:{type:"kendo.ui.GanttMonthView"},year:{type:"kendo.ui.GanttYearView"}},L={alt:"k-alt",reset:"k-reset",nonWorking:"k-nonwork-hour",header:"k-header",gridHeader:"k-grid-header",gridHeaderWrap:"k-grid-header-wrap",gridContent:"k-grid-content",tasksWrapper:"k-gantt-tables",rowsTable:"k-gantt-rows",columnsTable:"k-gantt-columns",tasksTable:"k-gantt-tasks",dependenciesWrapper:"k-gantt-dependencies",resource:"k-resource",resourceAlt:"k-resource k-alt",task:"k-task",taskSingle:"k-task-single",taskMilestone:"k-task-milestone",taskSummary:"k-task-summary",taskWrap:"k-task-wrap",taskMilestoneWrap:"k-milestone-wrap",taskSummaryWrap:"k-summary-wrap",taskPlanned:"k-task-planned",taskPlannedMoment:"k-task-moment",taskPlannedDuration:"k-task-duration",taskPlannedMomentLeft:"k-moment-left",taskAdvanced:"k-task-advanced",taskDelayed:"k-task-delayed",taskOffset:"k-task-offset",taskOffsetWrap:"k-task-offset-wrap",taskInnerWrap:"k-task-inner-wrap",resourcesWrap:"k-resources-wrap",taskDot:"k-task-dot",taskDotStart:"k-task-start",taskDotEnd:"k-task-end",taskDragHandle:"k-task-draghandle",taskContent:"k-task-content",taskTemplate:"k-task-template",taskActions:"k-task-actions",taskDelete:"k-task-delete",taskComplete:"k-task-complete",taskDetails:"k-task-details",taskDetailsPercent:"k-task-pct",link:"k-link",icon:"k-icon",iconDelete:"k-i-close",taskResizeHandle:"k-resize-handle",taskResizeHandleWest:"k-resize-w",taskResizeHandleEast:"k-resize-e",taskSummaryProgress:"k-task-summary-progress",taskSummaryComplete:"k-task-summary-complete",line:"k-gantt-line",lineHorizontal:"k-gantt-line-h",lineVertical:"k-gantt-line-v",arrowWest:"k-arrow-w",arrowEast:"k-arrow-e",dragHint:"k-drag-hint",dependencyHint:"k-gantt-dependency-hint",tooltipWrapper:"k-tooltip",tooltipContent:"k-tooltip-content",tooltipCallout:"k-callout k-callout-s",callout:"k-callout",marquee:"k-marquee k-gantt-marquee",marqueeColor:"k-marquee-color",offsetTooltipAdvanced:"k-offset-tooltip-advanced",offsetTooltipDelay:"k-offset-tooltip-delayed",plannedTooltip:"k-planned-tooltip"},B=kendo.ui.GanttView=r.extend({init:function(t,e){r.fn.init.call(this,t,e),this.title=this.options.title||this.options.name,this.header=this.element.find(W+B.styles.gridHeader),this.content=this.element.find(W+B.styles.gridContent),this.contentWidth=this.content.width(),this._workDays=s(this.options),this._headerTree=e.headerTree,this._taskTree=e.taskTree,this._taskTemplate=e.taskTemplate?kendo.template(e.taskTemplate,u({},kendo.Template,e.templateSettings)):null,this._dependencyTree=e.dependencyTree,this._taskCoordinates={},this._currentTime()},destroy:function(){r.fn.destroy.call(this),clearTimeout(this._tooltipTimeout),this.headerRow=null,this.header=null,this.content=null,this._dragHint=null,this._resizeHint=null,this._resizeTooltip=null,this._taskTooltip=null,this._percentCompleteResizeTooltip=null,this._headerTree=null,this._taskTree=null,this._dependencyTree=null},options:{showWorkHours:!1,showWorkDays:!1,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,hourSpan:1,slotSize:100,currentTimeMarker:{updateInterval:1e4}},renderLayout:function(){this._slots=this._createSlots(),this._tableWidth=this._calculateTableWidth(),this.createLayout(this._layout()),this._slotDimensions(),this._adjustHeight(),this.content.find(W+B.styles.dependenciesWrapper).width(this._tableWidth)},_adjustHeight:function(){this.content&&this.content.height(this.element.height()-c(this.header))},createLayout:function(t){var e=this._headers(t),s=this._colgroup(),n=this._headerTree,a=o("tbody",null,e),i=o("table",{style:{width:this._tableWidth+"px"},role:"presentation"},[s,a]);n.render([i]),this.headerRow=this.header.find("table:first tr").last()},_slotDimensions:function(){var t,e,s,n,a=this.headerRow[0].children,i=this._timeSlots();for(s=0,n=a.length;s<n;s++)e=a[s],t=i[s],t.offsetLeft=e.offsetLeft,t.offsetWidth=e.offsetWidth},render:function(t){var e,s,n=t.length,a=B.styles,i=this._rowsTable(n),r=this._columnsTable(n),o=this._tasksTable(t),d=this.options.currentTimeMarker,l=this.options.calculatedSize;this._taskTree.render([i,r,o]),e=this.content.find(W+a.rowsTable),l&&(s=l.row*t.length,this.content.find(W+a.tasksTable).height(s),e.height(s)),this._contentHeight=e.height(),this._rowHeight=l?l.row:this._contentHeight/e.find("tr").length,this.content.find(W+a.columnsTable).height(this._contentHeight),d!==!1&&void 0!==d.updateInterval&&this._renderCurrentTime()},_rowsTable:function(t){var e,s,n=[],a=B.styles,i=[null,{className:a.alt}];for(s=0;s<t;s++)e=o("tr",i[s%2],[o("td",null,[d(" ")])]),n.push(e);return this._createTable(1,n,{className:a.rowsTable})},_columnsTable:function(){var t,e,s,n,a,i=[],r=B.styles,l=this._timeSlots(),h=l.length,p=0;for(a=0;a<h;a++)e=l[a],n={},s=e.span,p+=s,1!==s&&(n.colspan=s),e.isNonWorking&&(n.className=r.nonWorking),i.push(o("td",n,[d(" ")]));return t=o("tr",null,i),this._createTable(p,[t],{className:r.columnsTable})},_tasksTable:function(t){var e,s,n,a,i,r,d,l,h,p=[],c=B.styles,u=this._taskCoordinates={},f=this._calculateMilestoneWidth(),g=Math.round(f.width),m=this.options.resourcesField,_=[c.resource,c.resourceAlt],v=this.options.calculatedSize,y=this._calculateResourcesMargin(),w=this._calculateTaskBorderWidth(),T=this.options.showPlannedTasks,D=function(t){var e=n.left,s=e+n.width;i.isMilestone()&&(e-=g/2,s=e+g),u[i.id]={start:e,end:s,rowIndex:t}};for(l=0,h=t.length;l<h;l++)i=t[l],n=this._taskPosition(i),T&&(a=this._taskPositionPlanned(i),a.borderWidth=w),n.borderWidth=w,e=o("tr",null),s=o("td"),i.start<=this.end&&i.end>=this.start&&(s.children.push(this._renderTask(t[l],n,a)),i[m]&&i[m].length&&(r=k?this._tableWidth-n.left:Math.max(n.width||f.clientWidth,0)+n.left,d={width:this._tableWidth-(r+y)+"px"},d[k?"right":"left"]=r+"px",v&&(d.height=v.cell+"px"),s.children.push(o("div",{className:c.resourcesWrap,style:d},this._renderResources(i[m],_[l%2])))),D(l)),e.children.push(s),p.push(e);return this._createTable(1,p,{className:B.styles.tasksTable})},_createTable:function(t,e,s){var n,a,i,r=[];for(i=0;i<t;i++)r.push(o("col"));return n=o("colgroup",null,r),a=o("tbody",null,e),s.style||(s.style={}),s.style.width=this._tableWidth+"px",s.role="presentation",o("table",s,[n,a])},_calculateTableWidth:function(){var t,e,s,n,a=this._timeSlots(),i=0,r=0;for(s=0,n=a.length;s<n;s++)t=a[s].span,r+=t,t>i&&(i=t);return e=Math.round(r*this.options.slotSize/i)},_calculateMilestoneWidth:function(){var e,s,n=B.styles.task+" "+B.styles.taskMilestone,a=t("<div class='"+n+"' style='visibility: hidden; position: absolute'>");return this.content.append(a),s=a[0].getBoundingClientRect(),e={width:s.right-s.left,clientWidth:a[0].clientWidth},a.remove(),e},_calculateResourcesMargin:function(){var e,s=t("<div class='"+B.styles.resourcesWrap+"' style='visibility: hidden; position: absolute'>");return this.content.append(s),e=parseInt(s.css(k?"margin-right":"margin-left"),10),s.remove(),e},_calculateTaskBorderWidth:function(){var e,s,n=B.styles.task+" "+B.styles.taskSingle,a=t("<div class='"+n+"' style='visibility: hidden; position: absolute'>");return this.content.append(a),s=kendo.getComputedStyles(a[0],["border-left-width"]),e=parseFloat(s["border-left-width"],10),a.remove(),e},_renderTask:function(t,e,s){var n,a,i,r,d,l,h,p,c=this.options.editable,u=e.left,f=B.styles,g=f.taskWrap,m=this.options.calculatedSize,_={},v={className:g,style:{left:u+"px"}},y=[],w=0,T=e.width;return m&&(v.style.height=m.cell+"px"),s&&(r=t.isMilestone()?this._renderPlannedMilestone(e,s):this._renderPlannedSingleTask(e,s,t),y.push(r),k&&s.left<=e.left&&(v.style.left=s.left+"px")),t.summary?(a=this._renderSummary(t,e,s),v.className+=" "+f.taskSummaryWrap):t.isMilestone()?(a=this._renderMilestone(t,e),v.className+=" "+f.taskMilestoneWrap):a=this._renderSingleTask(t,e,s),s&&!t.isMilestone()&&t.plannedStart<t.end&&t.plannedEnd>t.start&&t.plannedEnd<t.end?(T=k?e.left+e.width-s.left:s.left+s.width-e.left,p=k?s.left-e.left:e.left+e.width-(s.left+s.width),h=o("div",{className:f.taskOffset,style:{width:p-2*s.borderWidth+"px"}}),c&&c.resize!==!1&&c.update!==!1&&!t.summary&&(c.destroy!==!1&&h.children.push(o("span",{className:f.taskActions},[o("a",{className:f.link+" "+f.taskDelete,href:"#","aria-label":"Delete"},[o("span",{className:f.icon+" "+f.iconDelete})])])),h.children.push(k?o("span",{className:f.taskResizeHandle+" "+f.taskResizeHandleWest,style:{right:e.width-5+"px"}}):o("span",{className:f.taskResizeHandle+" "+f.taskResizeHandleEast}))),l=o("div",{className:f.taskOffsetWrap+" "+f.taskInnerWrap},[a,h]),y.push(l)):y.push(s?o("div",{className:f.taskInnerWrap},[a]):a),n=o("div",v,y),c&&c.dependencyCreate!==!1&&(s&&t.plannedEnd>t.end&&(w=s.left+s.width-e.left-e.width-3+"px"),n.children.push(o("div",{className:f.taskDot+" "+f.taskDotStart})),k&&(w="auto",s&&t.plannedEnd>t.end&&(d=e.left-s.left+"px")),n.children.push(o("div",{className:f.taskDot+" "+f.taskDotEnd,style:{right:w,left:d}}))),t.summary||t.isMilestone()||!c||c.dragPercentComplete===!1||c.update===!1||null!==this._taskTemplate||(i=Math.round(T*t.percentComplete),_[k?"right":"left"]=i+"px",n.children.push(o("div",{className:f.taskDragHandle,style:_}))),n},_renderSingleTask:function(t,e,s){var n,a,i,r,h=B.styles,p=[],c=this.options.editable,u=h.task+" "+h.taskSingle,f=e.width;return s&&(t.plannedEnd&&t.plannedEnd<=t.start?u+=" "+h.taskDelayed:t.plannedEnd&&t.plannedEnd>t.end?u+=" "+h.taskAdvanced:t.plannedEnd&&t.plannedEnd<t.end&&(k?f=f+e.left-s.left:f-=e.left+e.width-s.left-s.width)),n=Math.round(f*t.percentComplete),null!==this._taskTemplate?a=l(this._taskTemplate(t)):(a=d(t.title),p.push(o("div",{className:h.taskComplete,style:{width:n+"px"}}))),i=o("div",{className:h.taskContent},[o("div",{className:h.taskTemplate},[a])]),p.push(i),c&&(c.destroy!==!1&&(!s||!t.plannedEnd||t.end<=t.plannedEnd||t.start>=t.plannedEnd)&&i.children.push(o("span",{className:h.taskActions},[o("a",{className:h.link+" "+h.taskDelete,href:"#","aria-label":"Delete"},[o("span",{className:h.icon+" "+h.iconDelete})])])),c.resize!==!1&&c.update!==!1&&(i.children.push(o("span",{className:h.taskResizeHandle+" "+h.taskResizeHandleWest})),i.children.push(o("span",{className:h.taskResizeHandle+" "+h.taskResizeHandleEast})))),r=o("div",{className:u,"data-uid":t.uid,style:{width:Math.max(f-2*e.borderWidth,0)+"px"}},p)},_renderMilestone:function(t){var e=B.styles,s=e.task+" "+e.taskMilestone,n=this.options.showPlannedTasks;return n&&t.plannedEnd&&t.plannedEnd<t.start?s+=" "+e.taskDelayed:t.plannedStart&&t.plannedStart>t.end&&(s+=" "+e.taskAdvanced),o("div",{className:s,"data-uid":t.uid})},_renderSummary:function(t,e,s){var n,a,i=B.styles,r=e.width,d=i.task+" "+i.taskSummary;return s&&(t.plannedEnd&&t.plannedEnd<=t.start?d+=" "+i.taskDelayed:t.plannedEnd&&t.plannedEnd>t.end?d+=" "+i.taskAdvanced:t.plannedEnd&&t.plannedEnd<t.end&&(k?r=r+e.left-s.left:r-=e.left+e.width-s.left-s.width)),n=Math.round(r*t.percentComplete),a=o("div",{className:d,"data-uid":t.uid,style:{width:r+"px"}},[o("div",{className:i.taskSummaryProgress,style:{width:n+"px"}},[o("div",{className:i.taskSummaryComplete,style:{width:e.width+"px"}})])])},_renderPlannedSingleTask:function(t,e,s){var n,a=B.styles,i=[],r={};return s.plannedStart&&s.plannedEnd?(i.push(o("div",{className:a.taskPlannedMoment+" "+a.taskPlannedMomentLeft})),i.push(o("div",{className:a.taskPlannedDuration,style:{width:Math.max(e.width-2*e.borderWidth-16,0)+"px"}})),i.push(o("div",{className:a.taskPlannedMoment}))):s.plannedStart?i.push(o("div",{className:a.taskPlannedMoment+" "+a.taskPlannedMomentLeft})):s.plannedEnd&&i.push(o("div",{className:a.taskPlannedMoment,style:{"margin-left":Math.max(e.width-5,0)+"px"}})),r=k?{"margin-right":t.left-e.left+t.width-e.width+"px"}:{"margin-left":e.left-t.left+"px"},n=o("div",{className:a.taskPlanned,style:r},i)},_renderPlannedMilestone:function(t,e){var s,n=B.styles,a={};return a=k?{"margin-right":t.left-e.left+"px"}:{"margin-left":e.left-t.left+"px"},s=o("div",{className:n.taskPlanned,style:a},[o("div",{className:n.taskPlannedMoment})])},_renderResources:function(t,e){var s,n,a,i=[];for(n=0,a=t.length;n<a;n++)s=t[n],i.push(o("span",{className:e,style:{color:s.get("color")}},[d(s.get("name"))]));return k&&i.reverse(),i},_taskPosition:function(t){var e=Math.round,s=e(this._offset(k?t.end:t.start)),n=e(this._offset(k?t.start:t.end));return{left:s,width:n-s}},_taskPositionPlanned:function(t){var e=Math.round,s=e(this._offset(k?t.plannedEnd:t.plannedStart)),n=e(this._offset(k?t.plannedStart:t.plannedEnd));return{left:s,width:n-s}},_offset:function(t){var e,s,n,a,i=this._timeSlots(),r=0;return i.length?(a=this._slotIndex("start",t),e=i[a],e.end<t?r=e.offsetWidth:e.start<=t&&(s=t-e.start,n=e.end-e.start,r=s/n*e.offsetWidth),k&&(r=e.offsetWidth+1-r),e.offsetLeft+r):0},_slotIndex:function(t,e,s){var n,a=this._timeSlots(),i=0,r=a.length-1;s&&(a=[].slice.call(a).reverse());do n=Math.ceil((r+i)/2),a[n][t]<e?i=n:(n===r&&n--,r=n);while(i!==r);return s&&(i=a.length-1-i),i},_timeByPosition:function(t,e,s){var n,a,i,r=this._slotByPosition(t);return e?s?r.end:r.start:(n=t-this.element.find(W+B.styles.tasksTable).offset().left,a=r.end-r.start,i=n-r.offsetLeft,k&&(i=r.offsetWidth-i),new Date(r.start.getTime()+a*(i/r.offsetWidth)))},_slotByPosition:function(t){var e=t-this.element.find(W+B.styles.tasksTable).offset().left,s=this._slotIndex("offsetLeft",e,k);return this._timeSlots()[s]},_renderDependencies:function(t){var e,s,n=[],a=this._dependencyTree;for(e=0,s=t.length;e<s;e++)n.push.apply(n,this._renderDependency(t[e]));a.render(n)},_renderDependency:function(t){var e,s,n,a,i=this._taskCoordinates[t.predecessorId],r=this._taskCoordinates[t.successorId];if(!i||!r)return[];for(s="_render"+["FF","FS","SF","SS"][k?3-t.type:t.type],e=this[s](i,r),n=0,a=e.length;n<a;n++)e[n].attr["data-uid"]=t.uid;return e},_renderFF:function(t,e){var s=this._dependencyFF(t,e,!1);return s[s.length-1].children[0]=this._arrow(!0),s},_renderSS:function(t,e){var s=this._dependencyFF(e,t,!0);return s[0].children[0]=this._arrow(!1),s.reverse()},_renderFS:function(t,e){var s=this._dependencyFS(t,e,!1);return s[s.length-1].children[0]=this._arrow(!1),s},_renderSF:function(t,e){var s=this._dependencyFS(e,t,!0);return s[0].children[0]=this._arrow(!0),s.reverse()},_dependencyFF:function(t,e,s){var n,a=this,i=[],r=0,o=0,d=0,l=0,h=s?"start":"end",p=2,c=1,u=this._rowHeight,f=10,k=t.rowIndex*u+Math.floor(u/2)-1,g=e.rowIndex*u+Math.floor(u/2)-1,m=B.styles,_=function(){i.push(a._line(m.line+" "+m.lineHorizontal,{left:r+"px",top:o+"px",width:d+"px"}))},v=function(){i.push(a._line(m.line+" "+m.lineVertical,{left:r+"px",top:o+"px",height:l+"px"}))};return r=t[h],o=k,d=f,n=e[h]-t[h],n>0!==s&&(d=Math.abs(n)+f),s?(r-=d,d-=c,_()):(_(),r+=d-p),g<o?(l=o-g,l+=p,o=g,v()):(l=g-o,l+=p,v(),o+=l-p),d=Math.abs(r-e[h]),s||(d-=c,r-=d),_(),i},_dependencyFS:function(t,e,s){var n=this,a=[],i=0,r=0,o=0,d=0,l=this._rowHeight,h=Math.floor(l/2),p=10,c=2*p,u=e.start-t.end,f=2,k=1,g=t.rowIndex*l+Math.floor(l/2)-1,m=e.rowIndex*l+Math.floor(l/2)-1,_=B.styles,v=function(){a.push(n._line(_.line+" "+_.lineHorizontal,{left:i+"px",top:r+"px",width:o+"px"}))},y=function(){a.push(n._line(_.line+" "+_.lineVertical,{left:i+"px",top:r+"px",height:d+"px"}))};return i=t.end,r=g,o=p,s&&(i+=k,u>c&&(o=u-(p-f)),o-=k),v(),i+=o-f,u<=c&&(d=s?Math.abs(m-g)-h:h,m<g?(r-=d,d+=f,y()):(y(),r+=d),o=t.end-e.start+c,o<p&&(o=p),i-=o-f,v()),m<g?(d=r-m,r=m,d+=f,y()):(d=m-r,y(),r+=d),o=e.start-i,s||(o-=k),v(),a},_line:function(t,e){return o("div",{className:t,style:e})},_arrow:function(t){return o("span",{className:t?B.styles.arrowWest:B.styles.arrowEast})},_colgroup:function(){var t,e,s,n=this._timeSlots(),a=n.length,i=[];for(t=0;t<a;t++)for(e=0,s=n[t].span;e<s;e++)i.push(o("col"));return o("colgroup",null,i)},_createDragHint:function(t){var e,s=B.styles;this._dragHint=t.clone().addClass(s.dragHint).css({cursor:"move"}),e=this._dragHint.find(W+s.taskPlanned),e.css({visibility:"hidden"}),k&&t.find(W+s.taskAdvanced).length>0&&(e.css({"margin-right":"auto",width:0}),this._dragHint.find(W+s.taskDotEnd).css({left:0})),t.closest("td").append(this._dragHint)},_updateDragHint:function(t){var e=this._offset(t);this._dragHint.css({left:e})},_removeDragHint:function(){this._dragHint.remove(),this._dragHint=null},_createResizeHint:function(e){var s,n,a=B.styles,i=this._taskCoordinates[e.id].rowIndex*this._rowHeight,r=this.options,o=r.messages;this._resizeHint=t(C({styles:a})).css({top:0,height:this._contentHeight}),this.content.append(this._resizeHint),this._resizeTooltip=t(E({styles:a,start:e.start,end:e.end,messages:o.views,format:r.resizeTooltipFormat})).css({top:0,left:0}),this.content.append(this._resizeTooltip),this._resizeTooltipWidth=p(this._resizeTooltip),s=c(this._resizeTooltip),n=i-s,n<0&&(n=i+this._rowHeight),this._resizeTooltipTop=n},_updateResizeHint:function(e,s,n){var a=this._offset(k?s:e),i=this._offset(k?e:s),r=i-a,o=n!==k?a:i,d=this._tableWidth-kendo.support.scrollbar(),l=this._resizeTooltipWidth,h=this.options,p=h.messages,c=this.element.find(W+B.styles.tasksTable).offset().left-this.element.find(W+B.styles.tasksWrapper).offset().left;k&&(a+=c),this._resizeHint.css({left:a,width:r}),this._resizeTooltip&&this._resizeTooltip.remove(),o-=Math.round(l/2),o<0?o=0:o+l>d&&(o=d-l),k&&(o+=c),this._resizeTooltip=t(E({styles:B.styles,start:e,end:s,messages:p.views,format:h.resizeTooltipFormat})).css({top:this._resizeTooltipTop,left:o,"min-width":l}).appendTo(this.content)},_removeResizeHint:function(){this._resizeHint.remove(),this._resizeHint=null,this._resizeTooltip.remove(),this._resizeTooltip=null},_updatePercentCompleteTooltip:function(e,s,n){var a,i,r,o;this._removePercentCompleteTooltip(),a=this._percentCompleteResizeTooltip=t(N({styles:B.styles,text:n})).appendTo(this.element),i=Math.round(p(a)/2),r=a.find(W+B.styles.callout),o=Math.round(p(r)/2),a.css({top:e-(c(a)+o),left:s-i}),r.css("left",i-o)},_removePercentCompleteTooltip:function(){this._percentCompleteResizeTooltip&&this._percentCompleteResizeTooltip.remove(),this._percentCompleteResizeTooltip=null},_updateDependencyDragHint:function(t,e){this._removeDependencyDragHint(),this._creteDependencyDragHint(t,e)},_creteDependencyDragHint:function(e,s){var n=B.styles,a=s.x-e.x,i=s.y-e.y,r=Math.sqrt(a*a+i*i),o=Math.atan(i/a);a<0&&(o+=Math.PI),t("<div class='"+n.line+" "+n.lineHorizontal+" "+n.dependencyHint+"'></div>").css({top:e.y,left:e.x,width:r,"transform-origin":"0% 0","-ms-transform-origin":"0% 0","-webkit-transform-origin":"0% 0",transform:"rotate("+o+"rad)","-ms-transform":"rotate("+o+"rad)","-webkit-transform":"rotate("+o+"rad)"}).appendTo(this.content)},_removeDependencyDragHint:function(){this.content.find(W+B.styles.dependencyHint).remove()},_createTaskTooltip:function(e,s,n){var a=B.styles,i=this.options,r=this.content,o=r.offset(),d=kendo.scrollLeft(r),l=t(s).parents("tr").first(),h=l.offset(),p=i.tooltip&&i.tooltip.template?kendo.template(i.tooltip.template):I,u=k?n-(o.left+d+kendo.support.scrollbar()):n-(o.left-d),f=h.top+c(l)-o.top+r.scrollTop(),g=this._taskTooltip=t('<div style="z-index: 100002;" class="'+a.tooltipWrapper+'" ><div class="'+a.taskContent+'"></div></div>');g.css({left:u,top:f}).appendTo(r).find(W+a.taskContent).append(p({styles:a,task:e,messages:i.messages.views})),this._adjustTooltipDimensions(g,h,o,u,d)},_removeTaskTooltip:function(){this._taskTooltip&&this._taskTooltip.remove(),this._taskTooltip=null},_createOffsetTooltip:function(e,s,n){var a,i,r=B.styles,o=this.content,d=o.offset(),l=kendo.scrollLeft(o),h=s.parents("tr").first(),p=h.offset(),u=k?n-(d.left+l+kendo.support.scrollbar()):n-(d.left-l),f=p.top+c(h)-d.top+o.scrollTop(),g=this._offsetTooltip=t('<div style="z-index: 100002;" class="'+r.tooltipWrapper+'" ></div>'),m=Math.round((e.end.getTime()-e.plannedEnd.getTime())/6e4),_=this.options.messages.plannedTasks,v=m%60,y=v+" "+_.minutes;m>=60&&(a=m=Math.floor(m/60),y=a+" "+_.hours,0!==v&&(y+=" "+v+" "+_.minutes),m>=24&&(a=m%24,i=m=Math.floor(m/24),y=i+" "+_.days,0!==a&&(y+=" "+a+" "+_.hours))),g.css({left:u,top:f}).addClass(r.offsetTooltipDelay).appendTo(o).append(R({offsetPrefix:_.offsetTooltipDelay,offsetText:y})),this._adjustTooltipDimensions(g,p,d,u,l)},_removeOffsetTooltip:function(){this._offsetTooltip&&this._offsetTooltip.remove(),this._offsetTooltip=null},_createPlannedTooltip:function(e,s,n){var a=B.styles,i=this.content,r=i.offset(),o=kendo.scrollLeft(i),d=s.parents("tr").first(),l=d.offset(),h=k?n-(r.left+o+kendo.support.scrollbar()):n-(r.left-o),p=l.top+c(d)-r.top+i.scrollTop(),u=this._plannedTooltip=t('<div style="z-index: 100002;" class="'+a.tooltipWrapper+" "+a.plannedTooltip+'" ></div>'),f=this.options.messages.editor;u.css({left:h,top:p}).appendTo(i).append(O({plannedStart:f.plannedStart,startDate:kendo.toString(e.plannedStart,"H:mm tt ddd, MMM dd"),plannedEnd:f.plannedEnd,endDate:kendo.toString(e.plannedEnd,"H:mm tt ddd, MMM dd")})),this._adjustTooltipDimensions(u,l,r,h,o)},_removePlannedTooltip:function(){this._plannedTooltip&&this._plannedTooltip.remove(),this._plannedTooltip=null},_adjustTooltipDimensions:function(t,e,s,n,a){var i,r=this.content,o=r.width();c(t)<e.top-s.top&&t.css("top",e.top-s.top-c(t)+r.scrollTop()),i=p(t),i+n-a>o&&(n-=i,n<a&&(n=a+o-(i+17)),t.css("left",n))},_scrollTo:function(t){var e=t.offset().left,s=t.width(),n=e+s,a=t.closest("tr"),i=a.offset().top,r=a.height(),o=i+r,d=this.content,l=d.offset(),h=l.top,p=d.height(),c=h+p,u=l.left,f=d.width(),k=u+f,g=kendo.support.scrollbar();i<h?d.scrollTop(d.scrollTop()+(i-h)):o>c&&d.scrollTop(d.scrollTop()+(o+g-c)),e<u&&s>f&&n<k||n>k&&s<f?kendo.scrollLeft(d,kendo.scrollLeft(d)+(n+g-k)):(n>k&&s>f&&e>u||e<u&&s<f)&&kendo.scrollLeft(d,kendo.scrollLeft(d)+(e-u))},_scrollToDate:function(t){var e,s=this.start,n=this.end;t>=s&&t<n&&(e=this._offset(t),kendo.support.isRtl(this.element)&&(e=this._tableWidth-e),kendo.scrollLeft(this.content,e))},_timeSlots:function(){return this._slots&&this._slots.length?this._slots[this._slots.length-1]:[]},_headers:function(t){var e,s,n,a,i,r,d,h,p=[],c=B.styles;for(i=0,r=t.length;i<r;i++){for(e=t[i],s=[],d=0,h=e.length;d<h;d++)n=e[d],a=l(n.text),s.push(o("td",{colspan:n.span,className:c.header+(n.isNonWorking?" "+c.nonWorking:"")},[a]));p.push(o("tr",null,s))}return p},_hours:function(t,e){var s,n,a,i=[],r=this.options,o=r.workDayStart.getHours(),d=r.workDayEnd.getHours(),l=r.hourSpan;for(t=new Date(t),e=new Date(e),r.showWorkHours&&t.setHours(o);t<e;)s=new Date(t),a=s.getHours(),n=a>=o&&a<d,s.setHours(s.getHours()+l),a==s.getHours()&&s.setHours(s.getHours()+2*l),r.showWorkHours&&!n||i.push({start:t,end:s,isNonWorking:!n,span:1}),t=s;return i},_days:function(t,e){var s,n,a=[];for(t=new Date(t),e=new Date(e);t<e;)s=e<kendo.date.nextDay(t)?e:kendo.date.nextDay(t),n=this._isWorkDay(t),this.options.showWorkDays&&!n||a.push({start:t,end:s,isNonWorking:!n,span:1}),t=s;return a},_weeks:function(t,e){var s,n,a,i=[],r=this.calendarInfo().firstDay;for(t=new Date(t),e=new Date(e);t<e;)s=kendo.date.dayOfWeek(kendo.date.addDays(t,1),r,1),s>e&&(s=e),n=this._days(t,s),a=n.length,a>0&&i.push({start:n[0].start,end:n[a-1].end,span:a}),t=s;return i},_months:function(t,e){var s,n,a,i,r=[];for(t=new Date(t),e=new Date(e);t<e;)s=new Date(t),n=kendo.date.firstDayOfMonth(new Date(s.setMonth(s.getMonth()+1))),s=e<n?e:n,a=this._days(t,s),i=a.length,i>0&&r.push({start:a[0].start,end:a[i-1].end,span:i}),t=s;return r},_years:function(t,e){var s,n,a,i=[];for(t=new Date(t),e=new Date(e);t<e;)s=new Date(t),s=kendo.date.firstDayOfMonth(new Date(s.setMonth(12))),s>=e&&(s=e),a=s.getMonth()||12,n=a-t.getMonth(),i.push({start:t,end:s,span:n}),t=s;return i},_slotHeaders:function(t,e){var s,n,a,i=[];for(n=0,a=t.length;n<a;n++)s=t[n],i.push({text:e(s),isNonWorking:!!s.isNonWorking,span:s.span});return i},_isWorkDay:function(t){var e,s,n=t.getDay(),a=this._workDays;for(e=0,s=a.length;e<s;e++)if(a[e]===n)return!0;return!1},calendarInfo:function(){return kendo.getCulture().calendars.standard},_renderCurrentTime:function(){var e,s=this._getCurrentTime(),n=this._offset(s),a=t("<div class='k-current-time'></div>"),i=B.styles,r=this.element.find(W+i.tasksWrapper),o=this.element.find(W+i.tasksTable);this.content&&this._timeSlots().length&&(this.content.find(".k-current-time").remove(),e=this._timeSlots()[this._slotIndex("start",s)],s<e.start||s>e.end||(r.length&&o.length&&(n+=o.offset().left-r.offset().left),a.css({left:n+"px",top:"0px",width:"1px",height:this._contentHeight+"px"}).appendTo(this.content)))},_getCurrentTime:function(){return new Date},_currentTime:function(){var t=this.options.currentTimeMarker;t!==!1&&void 0!==t.updateInterval&&(this._renderCurrentTime(),this._currentTimeUpdateTimer=setInterval(f(this._renderCurrentTime,this),t.updateInterval))}});u(!0,B,{styles:L}),kendo.ui.GanttDayView=B.extend({name:"day",options:{timeHeaderTemplate:M,dayHeaderTemplate:x,resizeTooltipFormat:"h:mm tt ddd, MMM d"},range:function(t){var e=this.options.range;this.start=kendo.date.getDate(t.start),this.end=kendo.date.getDate(t.end),(kendo.date.getMilliseconds(t.end)>0||this.end.getTime()===this.start.getTime())&&(this.end=kendo.date.addDays(this.end,1)),e&&e.start&&(this.start=kendo.date.getDate(e.start),this.start.setHours(e.start.getHours())),e&&e.end&&(this.end=kendo.date.getDate(e.end),this.end.setHours(e.end.getHours()))},_createSlots:function(){var t,e,s,n,a=[],i=this._days(this.start,this.end),r=[];for(s=0,n=i.length;s<n;s++)t=i[s],e=this._hours(t.start,t.end),t.span=e.length,r.push.apply(r,e);return a.push(i),a.push(r),a},_layout:function(){var t=[],e=this.options;return t.push(this._slotHeaders(this._slots[0],kendo.template(e.dayHeaderTemplate))),t.push(this._slotHeaders(this._slots[1],kendo.template(e.timeHeaderTemplate))),t}}),kendo.ui.GanttWeekView=B.extend({name:"week",options:{dayHeaderTemplate:x,weekHeaderTemplate:S,resizeTooltipFormat:"h:mm tt ddd, MMM d"},range:function(t){var e,s=this.options.range,n=this.calendarInfo(),a=n.firstDay,i=t.end;a===i.getDay()&&i.setDate(i.getDate()+7),this.start=kendo.date.getDate(kendo.date.dayOfWeek(t.start,a,-1)),this.end=kendo.date.getDate(kendo.date.dayOfWeek(i,a,1)),s&&s.start&&(this.start=kendo.date.getDate(s.start)),s&&s.end&&(e=new Date(s.end),this.end=kendo.date.getDate(e)<s.end?kendo.date.getDate(new Date(e.setDate(e.getDate()+1))):kendo.date.getDate(e))},_createSlots:function(){var t=[];return t.push(this._weeks(this.start,this.end)),t.push(this._days(this.start,this.end)),t},_layout:function(){var t=[],e=this.options;return t.push(this._slotHeaders(this._slots[0],kendo.template(e.weekHeaderTemplate))),t.push(this._slotHeaders(this._slots[1],kendo.template(e.dayHeaderTemplate))),t}}),kendo.ui.GanttMonthView=B.extend({name:"month",options:{weekHeaderTemplate:S,monthHeaderTemplate:z,resizeTooltipFormat:"dddd, MMM d, yyyy"},range:function(t){var e,s=this.options.range;this.start=kendo.date.firstDayOfMonth(t.start),this.end=kendo.date.addDays(kendo.date.getDate(kendo.date.lastDayOfMonth(t.end)),1),s&&s.start&&(this.start=kendo.date.getDate(s.start)),s&&s.end&&(e=new Date(s.end),this.end=kendo.date.getDate(e)<s.end?kendo.date.getDate(new Date(e.setDate(e.getDate()+1))):kendo.date.getDate(e))},_createSlots:function(){var t=[];return t.push(this._months(this.start,this.end)),t.push(this._weeks(this.start,this.end)),t},_layout:function(){var t=[],e=this.options;return t.push(this._slotHeaders(this._slots[0],kendo.template(e.monthHeaderTemplate))),t.push(this._slotHeaders(this._slots[1],kendo.template(e.weekHeaderTemplate))),t}}),kendo.ui.GanttYearView=B.extend({name:"year",options:{yearHeaderTemplate:P,monthHeaderTemplate:z,resizeTooltipFormat:"dddd, MMM d, yyyy"},range:function(t){var e,s=this.options.range;this.start=kendo.date.firstDayOfMonth(new Date(t.start.setMonth(0))),this.end=kendo.date.firstDayOfMonth(new Date(t.end.setMonth(12))),s&&s.start&&(this.start=kendo.date.firstDayOfMonth(s.start)),s&&s.end&&(e=kendo.date.firstDayOfMonth(s.end),this.end=kendo.date.getDate(new Date(e.setMonth(e.getMonth()+1))))},_createSlots:function(){var e=[],s=this._months(this.start,this.end);return t(s).each(function(t,e){e.span=1}),e.push(this._years(this.start,this.end)),e.push(s),e},_layout:function(){var t=[],e=this.options;return t.push(this._slotHeaders(this._slots[0],kendo.template(e.yearHeaderTemplate))),t.push(this._slotHeaders(this._slots[1],kendo.template(e.monthHeaderTemplate))),t}}),a={wrapper:"k-timeline k-grid k-widget",gridHeader:"k-grid-header",gridHeaderWrap:"k-grid-header-wrap",gridContent:"k-grid-content",gridContentWrap:"k-grid-content",tasksWrapper:"k-gantt-tables",dependenciesWrapper:"k-gantt-dependencies",task:"k-task",taskOffset:"k-task-offset",taskOffsetWrap:"k-task-offset-wrap",taskPlanned:"k-task-planned",line:"k-gantt-line",taskResizeHandle:"k-resize-handle",taskResizeHandleWest:"k-resize-w",taskDragHandle:"k-task-draghandle",taskComplete:"k-task-complete",taskDelete:"k-task-delete",taskWrapActive:"k-task-wrap-active",taskWrap:"k-task-wrap",taskDot:"k-task-dot",taskDotStart:"k-task-start",taskDotEnd:"k-task-end",hovered:"k-state-hover",
selected:"k-state-selected",origin:"k-origin"},i=kendo.ui.GanttTimeline=r.extend({init:function(t,e){r.fn.init.call(this,t,e),this.options.views&&this.options.views.length||(this.options.views=["day","week","month"]),k=kendo.support.isRtl(t),this._wrapper(),this._domTrees(),this._views(),this._selectable(),this._draggable(),this._resizable(),this._percentResizeDraggable(),this._createDependencyDraggable(),this._attachEvents(),this._tooltip()},options:{name:"GanttTimeline",messages:{views:{day:"Day",week:"Week",month:"Month",year:"Year",start:"Start",end:"End"}},snap:!0,selectable:!0,editable:!0},destroy:function(){r.fn.destroy.call(this),clearTimeout(this._tooltipTimeout),this._currentTimeUpdateTimer&&clearInterval(this._currentTimeUpdateTimer),this._unbindView(this._selectedView),this._moveDraggable&&this._moveDraggable.destroy(),this._resizeDraggable&&this._resizeDraggable.destroy(),this._percentDraggable&&this._percentDraggable.destroy(),this._dependencyDraggable&&this._dependencyDraggable.destroy(),this.touch&&this.touch.destroy(),this._headerTree=null,this._taskTree=null,this._dependencyTree=null,this.wrapper.off(v),kendo.destroy(this.wrapper)},_wrapper:function(){var e=i.styles,s=this,n=this.options,a=function(){var a,i,r=typeof n.rowHeight===_?n.rowHeight:n.rowHeight+"px",o=t(kendo.format(V,r)),d=s.wrapper.find(W+e.tasksWrapper);return d.append(o),a=c(o.find("tr")),i=o.find("td").height(),o.remove(),{row:a,cell:i}};this.wrapper=this.element.addClass(e.wrapper).append("<div class='"+e.gridHeader+"'><div class='"+e.gridHeaderWrap+"'></div></div>").append("<div class='"+e.gridContentWrap+"'><div class='"+e.tasksWrapper+"'></div><div class='"+e.dependenciesWrapper+"'></div></div>"),n.rowHeight&&(this._calculatedSize=a())},_domTrees:function(){var t=i.styles,e=kendo.dom.Tree,s=this.wrapper;this._headerTree=new e(s.find(W+t.gridHeaderWrap)[0]),this._taskTree=new e(s.find(W+t.tasksWrapper)[0]),this._dependencyTree=new e(s.find(W+t.dependenciesWrapper)[0])},_views:function(){var t,e,s,n,a,i,r,o=this.options.views;for(this.views={},i=0,r=o.length;i<r;i++)t=o[i],e=h(t),e&&t.selectable===!1||(s=e?"string"!=typeof t.type?t.title:t.type:t,n=F[s],n&&(e&&(t.type=n.type),n.title=this.options.messages.views[s]),t=u({title:s},n,e?t:{}),s&&(this.views[s]=t,a&&!t.selected||(a=s)));a&&(this._selectedViewName=a)},view:function(t){return t&&(this._selectView(t),this.trigger("navigate",{view:t,action:"changeView"})),this._selectedView},_selectView:function(t){t&&this.views[t]&&(this._selectedView&&this._unbindView(this._selectedView),this._selectedView=this._initializeView(t),this._selectedViewName=t)},_viewByIndex:function(t){var e,s=this.views;for(e in s){if(!t)return e;t--}},_initializeView:function(t){var s,n,a,i=this.views[t];if(i){if(s=i.type,"string"==typeof s&&(s=kendo.getter(i.type)(window)),!s)throw Error("There is no such view");n={},u(n,this.options.range,i.range),a=i.date||this.options.date,i=new s(this.wrapper,e(u(!0,{headerTree:this._headerTree,taskTree:this._taskTree,dependencyTree:this._dependencyTree,calculatedSize:this._calculatedSize},i,this.options,{date:a,range:n})))}return i},_unbindView:function(t){t&&t.destroy()},_range:function(t){var e,s,n={field:"start",dir:"asc"},a={field:"end",dir:"desc"};return t&&t.length?(e=new m(t).sort(n).toArray()[0].start||new Date,s=new m(t).sort(a).toArray()[0].end||new Date,{start:new Date(e),end:new Date(s)}):{start:new Date,end:new Date}},_render:function(t){var e=this.view(),s=this._range(t),n=e.options.date;this._tasks=t,e.range(s),e.renderLayout(),e.render(t),n&&e._scrollToDate(n)},_renderDependencies:function(t){this.view()._renderDependencies(t)},_taskByUid:function(t){var e,s,n=this._tasks,a=n.length;for(s=0;s<a;s++)if(e=n[s],e.uid===t)return e},_draggable:function(){var t,e,s,a,r=this,o=this.options.snap,d=i.styles,l=this.options.editable,h=function(){r.view()._removeDragHint(),t&&t.css("opacity",1),t=null,e=null,r.dragInProgress=!1};l&&l.move!==!1&&l.update!==!1&&(this._moveDraggable=new kendo.ui.Draggable(this.wrapper,{distance:0,filter:W+d.task+","+W+d.taskOffset,holdToDrag:kendo.support.mobileOS,ignore:W+d.taskResizeHandle}),this._moveDraggable.bind("dragstart",function(n){var i=r.view();return t=n.currentTarget.closest(W+d.taskWrap),e=r._taskByUid(n.currentTarget.parent().find(W+d.task).attr("data-uid")),r.trigger("moveStart",{task:e})?void n.preventDefault():(s=e.start,a=i._timeByPosition(n.x.location,o)-s,i._createDragHint(t),t.css("opacity",.5),clearTimeout(r._tooltipTimeout),void(r.dragInProgress=!0))}).bind("drag",kendo.throttle(function(t){var n,i,d;r.dragInProgress&&(n=r.view(),i=new Date(n._timeByPosition(t.x.location,o)-a),d=i,r.trigger("move",{task:e,start:i})||(s=i,k&&(d=new Date(s.getTime()+e.duration())),n._updateDragHint(d)))},15)).bind("dragend",function(){r.trigger("moveEnd",{task:e,start:s}),h()}).bind("dragcancel",function(){h()}).userEvents.bind("select",function(){n()}))},_resizable:function(){var t,e,s,a,r,o=this,d=this.options.snap,l=i.styles,h=this.options.editable,p=function(){o.view()._removeResizeHint(),t=null,e=null,o.dragInProgress=!1};h&&h.resize!==!1&&h.update!==!1&&(this._resizeDraggable=new kendo.ui.Draggable(this.wrapper,{distance:0,filter:W+l.taskResizeHandle,holdToDrag:!1}),this._resizeDraggable.bind("dragstart",function(n){return r=n.currentTarget.hasClass(l.taskResizeHandleWest),k&&(r=!r),t=n.currentTarget.closest(W+l.taskWrap).find(W+l.task),e=o._taskByUid(t.attr("data-uid")),o.trigger("resizeStart",{task:e})?void n.preventDefault():(s=e.start,a=e.end,o.view()._createResizeHint(e),clearTimeout(o._tooltipTimeout),void(o.dragInProgress=!0))}).bind("drag",kendo.throttle(function(t){var n,i;o.dragInProgress&&(n=o.view(),i=n._timeByPosition(t.x.location,d,!r),r?s=i<a?i:a:a=i>s?i:s,o.trigger("resize",{task:e,start:s,end:a})||n._updateResizeHint(s,a,r))},15)).bind("dragend",function(){o.trigger("resizeEnd",{task:e,resizeStart:r,start:s,end:a}),p()}).bind("dragcancel",function(){p()}).userEvents.bind("select",function(){n()}))},_percentResizeDraggable:function(){var t,e,s,a,r,o,d,l,h,c,u=this,f=i.styles,g=this.options.editable,m=function(){u.view()._removePercentCompleteTooltip(),e=null,t=null,u.dragInProgress=!1},_=function(t){var s=e.siblings(W+f.taskDragHandle);s.length||(s=e.closest(W+f.taskWrap).find(W+f.taskDragHandle)),s.css(k?"right":"left",t),e.find(W+f.taskComplete).width(t)};g&&g.dragPercentComplete!==!1&&g.update!==!1&&(this._percentDraggable=new kendo.ui.Draggable(this.wrapper,{distance:0,filter:W+f.taskDragHandle,holdToDrag:!1}),this._percentDraggable.bind("dragstart",function(n){return u.trigger("percentResizeStart")?void n.preventDefault():(e=n.currentTarget.siblings(W+f.task),e.length||(e=n.currentTarget.closest(W+f.taskWrap).find(W+f.task)),t=u._taskByUid(e.attr("data-uid")),d=t.percentComplete,s=e.offset(),a=this.element.offset(),r=e.find(W+f.taskComplete).width(),o=p(e),clearTimeout(u._tooltipTimeout),void(u.dragInProgress=!0))}).bind("drag",kendo.throttle(function(t){if(u.dragInProgress){c=k?-t.x.initialDelta:t.x.initialDelta;var e=Math.max(0,Math.min(o,r+c));d=Math.round(e/o*100),_(e),l=s.top-a.top,h=s.left+e-a.left,k&&(h+=o-2*e),u.view()._updatePercentCompleteTooltip(l,h,d)}},15)).bind("dragend",function(){u.trigger("percentResizeEnd",{task:t,percentComplete:d/100}),m()}).bind("dragcancel",function(){_(r),m()}).userEvents.bind("select",function(){n()}))},_createDependencyDraggable:function(){var e,s,a,r=this,o=t(),d=t(),l=i.styles,h=this.options.editable,u=function(){e.css("display","").removeClass(l.hovered),e.parent().removeClass(l.origin),e=null,f(!1),d=t(),o=t(),r.view()._removeDependencyDragHint(),r.dragInProgress=!1},f=function(t){d.hasClass(l.origin)||(d.find(W+l.taskDot).css("display",t?"block":""),o.toggleClass(l.hovered,t))};h&&h.dependencyCreate!==!1&&(this._dependencyDraggable=new kendo.ui.Draggable(this.wrapper,{distance:0,filter:W+l.taskDot,holdToDrag:!1}),this._dependencyDraggable.bind("dragstart",function(t){var n,i;return r.trigger("dependencyDragStart")?void t.preventDefault():(e=t.currentTarget.css("display","block").addClass(l.hovered),e.parent().addClass(l.origin),n=e.offset(),i=r.wrapper.find(W+l.tasksWrapper).offset(),s=Math.round(n.left-i.left+c(e)/2),a=Math.round(n.top-i.top+p(e)/2),clearTimeout(r._tooltipTimeout),void(r.dragInProgress=!0))}).bind("drag",kendo.throttle(function(e){var n,i,h,p;r.dragInProgress&&(r.view()._removeDependencyDragHint(),n=t(kendo.elementUnderCursor(e)),i=r.wrapper.find(W+l.tasksWrapper).offset(),h=e.x.location-i.left,p=e.y.location-i.top,r.view()._updateDependencyDragHint({x:s,y:a},{x:h,y:p}),f(!1),o=n.hasClass(l.taskDot)?n:t(),d=n.closest(W+l.taskWrap),f(!0))},15)).bind("dragend",function(){var t,s,n,a,i,d,h;o.length&&(t=e.hasClass(l.taskDotStart),s=o.hasClass(l.taskDotStart),n=t?s?3:2:s?1:0,a=e.siblings(W+l.task),a.length||(a=e.closest(W+l.taskWrap).find(W+l.task)),i=r._taskByUid(a.attr("data-uid")),d=o.siblings(W+l.task),d.length||(d=o.closest(W+l.taskWrap).find(W+l.task)),h=r._taskByUid(d.attr("data-uid")),i!==h&&r.trigger("dependencyDragEnd",{type:n,predecessor:i,successor:h})),u()}).bind("dragcancel",function(){u()}).userEvents.bind("select",function(){n()}))},_selectable:function(){var e=this,s=i.styles;this.options.selectable&&this.wrapper.on(y+v,W+s.task+","+W+s.taskOffset,function(n){n.stopPropagation();var a=t(this).attr("data-uid");a||(a=t(this).closest(W+s.taskWrap).find(W+s.task).data("uid")),n.ctrlKey?e.trigger("clear"):e.trigger("select",{uid:a})}).on(y+v,W+s.taskWrap,function(e){e.stopPropagation(),t(this).css("z-index","0");var n=t(document.elementFromPoint(e.clientX,e.clientY));n.hasClass(s.line)&&n.click(),t(this).css("z-index","")}).on(y+v,W+s.tasksWrapper,function(){e.selectDependency().length>0?e.clearSelection():e.trigger("clear")}).on(y+v,W+s.line,function(t){t.stopPropagation(),e.selectDependency(this)})},select:function(t){var e=this.wrapper.find(t),s=i.styles;return e.length?(this.clearSelection(),e.addClass(s.selected),void(kendo.support.mobileOS&&e.parent().addClass(s.taskWrapActive))):this.wrapper.find(W+s.task+W+s.selected)},selectDependency:function(e){var s,n=this.wrapper.find(e),a=i.styles;return n.length?(this.clearSelection(),this.trigger("clear"),s=t(n).attr("data-uid"),void this.wrapper.find(W+a.line+"[data-uid='"+s+"']").addClass(a.selected)):this.wrapper.find(W+a.line+W+a.selected)},clearSelection:function(){var t=i.styles;this.wrapper.find(W+t.selected).removeClass(t.selected),kendo.support.mobileOS&&this.wrapper.find(W+t.taskWrapActive).removeClass(t.taskWrapActive)},_attachEvents:function(){var e=this,s=i.styles,n=this.options.editable;n&&(this._tabindex(),this.wrapper.on(y+v,W+s.taskDelete,function(n){e.trigger("removeTask",{uid:t(this).closest(W+s.taskWrap).find(W+s.task).attr("data-uid")}),n.stopPropagation(),n.preventDefault()}).on(H+v,function(t){var s,n=e.options.editable;t.keyCode===g.DELETE&&n&&n.dependencyDestroy!==!1&&(s=e.selectDependency(),s.length&&(e.trigger("removeDependency",{uid:s.attr("data-uid")}),e.clearSelection()))}),kendo.support.mobileOS?this.touch=this.wrapper.kendoTouch({filter:W+s.task+","+W+s.taskOffset,doubletap:function(n){e.options.editable.update!==!1&&e.trigger("editTask",{uid:t(n.touch.currentTarget).closest(W+s.taskWrap).find(W+s.task).attr("data-uid")})}}).data("kendoTouch"):this.wrapper.on(w+v,W+s.task+","+W+s.taskOffset,function(n){e.options.editable.update!==!1&&(e.trigger("editTask",{uid:t(this).closest(W+s.taskWrap).find(W+s.task).attr("data-uid")}),n.stopPropagation(),n.preventDefault())}))},_tooltip:function(){var e,s=this,n=this.options.tooltip,a=i.styles,r=function(t){e=t.clientX};n&&n.visible===!1||(kendo.support.mobileOS?(this.wrapper.on(y+v,W+a.taskDelete,function(t){t.stopPropagation(),s.view()._removeTaskTooltip()}).on(b+v,W+a.task,function(e){var n=t(e.relatedTarget).parents(W+a.taskWrap,W+a.task);0===n.length&&s.view()._removeTaskTooltip()}).on(b+v,W+a.taskOffset,function(e){var n=t(e.relatedTarget).parents(W+a.taskWrap,W+a.task);0===n.length&&s.view()._removeOffsetTooltip()}).on(b+v,W+a.taskPlanned,function(e){var n=t(e.relatedTarget).parents(W+a.taskWrap,W+a.task);0===n.length&&s.view()._removePlannedTooltip()}),this.touch&&this.touch.bind("tap",function(e){var n,i=t(e.touch.target),r=e.touch.x.client;i.hasClass(a.task)?(n=s._taskByUid(i.attr("data-uid")),s.view()._taskTooltip&&s.view()._removeTaskTooltip(),s.view()._createTaskTooltip(n,i,r)):(n=s._taskByUid(i.closest(W+a.taskWrap).find(W+a.task).attr("data-uid")),s.view()._offsetTooltip&&s.view()._removeOffsetTooltip(),s.view()._createOffsetTooltip(n,i,r))}).bind("doubletap",function(){s.view()._removeTaskTooltip(),s.view()._removeOffsetTooltip()})):this.wrapper.on(D+v,W+a.task,function(){var n=this,a=s._taskByUid(t(this).attr("data-uid"));s.dragInProgress||(s._tooltipTimeout=setTimeout(function(){s.view()._createTaskTooltip(a,n,e)},800),t(this).on(T,r))}).on(b+v,W+a.task,function(){clearTimeout(s._tooltipTimeout),s.view()._removeTaskTooltip(),t(this).off(T,r)}).on(D+v,W+a.taskOffset,function(){var n=t(this).closest(W+a.taskWrap).find(W+a.task),i=s._taskByUid(n.attr("data-uid"));s.dragInProgress||(s._offsetTooltipTimeout=setTimeout(function(){s.view()._createOffsetTooltip(i,n,e)},800),t(this).on(T,r))}).on(b+v,W+a.taskOffset,function(){clearTimeout(s._offsetTooltipTimeout),s.view()._removeOffsetTooltip(),t(this).off(T,r)}).on(D+v,W+a.taskPlanned,function(){var n=t(this).closest(W+a.taskWrap).find(W+a.task),i=s._taskByUid(n.attr("data-uid"));s._plannedTooltipTimeout=setTimeout(function(){s.view()._createPlannedTooltip(i,n,e)},800),t(this).on(T,r)}).on(b+v,W+a.taskPlanned,function(){clearTimeout(s._plannedTooltipTimeout),s.view()._removePlannedTooltip(),t(this).off(T,r)}))},_setPlanned:function(t){this.options.showPlannedTasks=t,this.view().options.showPlannedTasks=t}}),u(!0,i,{styles:a})}(window.kendo.jQuery),window.kendo},s(3))},1272:function(t,e){t.exports=require("./kendo.touch")}});