mesa-fab-approval/Fab2ApprovalSystem/Scripts/kendo/kendo.scheduler.monthview.min.js
Jonathan Ouellette 580e90f6a2 initial add
2022-09-27 14:10:30 -07:00

10 lines
14 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(t){function e(t,e){return t.slice(e).concat(t.slice(0,e))}function n(t,e){for(var n=e.firstDay,s=new Date(t.getFullYear(),t.getMonth(),0,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());s.getDay()!=n;)i.date.setTime(s,-1*c);return s}function s(t,e,n){var s,i=e.getTime(),o=n.getTime();return s=t.getTime(),s>=i&&o>=s}var i=window.kendo,o=i.ui,r=o.SchedulerView,a=".kendoMonthView",l=t.extend,d=t.proxy,h=i.date.getDate,c=i.date.MS_PER_DAY,u=6,f=7,p=i.template('<span class="k-link k-nav-day">#:kendo.toString(date, "dd")#</span>'),v='<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 && !data.tail && !data.middle) {#<span class="k-resize-handle k-resize-w"></span>#}## if(resizable && !data.head && !data.middle) {#<span class="k-resize-handle k-resize-e"></span>#}#</div>',g=i.template('<div title="#=title.replace(/"/g,"&\\#34;")#"><div class="k-event-template">#:title#</div></div>'),_=i.template('<div style="width:#=width#px;left:#=left#px;top:#=top#px" class="k-more-events k-button"><span>...</span></div>');o.MonthView=r.extend({init:function(t,e){var n=this;r.fn.init.call(n,t,e),n.title=n.options.title,n.name="month",n._templates(),n._editable(),n._renderLayout(n.options.date),n._groups()},_updateDirection:function(t,e,n,s,i){var o,r,a,l,d;n&&(o=e[0].start,r=e[e.length-1].end,a=o.index===r.index,l=o.collectionIndex===r.collectionIndex,d=i?a&&l||l:a&&l,d&&(t.backward=s))},_changeViewPeriod:function(t,e,n){var s=n?7:1;return e&&(s*=-1),t.start=i.date.addDays(t.start,s),t.end=i.date.addDays(t.end,s),(!n||n&&this._isVerticallyGrouped())&&(t.groupIndex=e?this.groups.length-1:0),t.events=[],!0},_continuousSlot:function(t,e,n){var s=t.backward?0:e.length-1,i=this.groups[t.groupIndex];return i.continuousSlot(e[s].start,n)},_changeGroupContinuously:function(t,e,n,s){var i,o,r,a;return n||(i=t.groupIndex,o=this.groups.length-1,r=this._isVerticallyGrouped(),a=this.groups[i],!e&&r?(e=a[s?"lastSlot":"firstSlot"](),i+=s?-1:1):e&&!r&&(i=s?o:0),(0>i||i>o)&&(i=s?o:0,e=null),t.groupIndex=i),e},_normalizeHorizontalSelection:function(t,e,n){var s;return s=n?e[0].start:e[e.length-1].end},_normalizeVerticalSelection:function(t,e){var n;return n=t.backward?e[0].start:e[e.length-1].end},_templates:function(){var t=this.options,e=l({},i.Template,t.templateSettings);this.eventTemplate=this._eventTmpl(t.eventTemplate),this.dayTemplate=i.template(t.dayTemplate,e)},dateForTitle:function(){return i.format(this.options.selectedDateFormat,this._firstDayOfMonth,this._lastDayOfMonth)},nextDate:function(){return i.date.nextDay(this._lastDayOfMonth)},previousDate:function(){return i.date.previousDay(this._firstDayOfMonth)},startDate:function(){return this._startDate},endDate:function(){return this._endDate},_renderLayout:function(e){var s=this;this._firstDayOfMonth=i.date.firstDayOfMonth(e),this._lastDayOfMonth=i.date.lastDayOfMonth(e),this._startDate=n(e,this.calendarInfo()),this.createLayout(this._layout()),this._content(),this.refreshLayout(),this.content.on("click"+a,".k-nav-day,.k-more-events",function(e){var n=t(e.currentTarget).offset(),i=s._slotByPosition(n.left,n.top);e.preventDefault(),s.trigger("navigate",{view:"day",date:i.startDate()})})},_editable:function(){this.options.editable&&!this._isMobilePhoneView()&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var e=this;e.element.on("click"+a,".k-scheduler-monthview .k-event a:has(.k-si-close)",function(n){e.trigger("remove",{uid:t(this).closest(".k-event").attr(i.attr("uid"))}),n.preventDefault()}),e.options.editable.create!==!1&&e.element.on("dblclick"+a,".k-scheduler-monthview .k-scheduler-content td",function(n){var s,i=t(n.currentTarget).offset(),o=e._slotByPosition(i.left,i.top);o&&(s=e._resourceBySlot(o),e.trigger("add",{eventInfo:l({isAllDay:!0,start:o.startDate(),end:o.startDate()},s)})),n.preventDefault()}),e.options.editable.update!==!1&&e.element.on("dblclick"+a,".k-scheduler-monthview .k-event",function(n){e.trigger("edit",{uid:t(this).closest(".k-event").attr(i.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var e=this;e.options.editable.create!==!1&&(e._addUserEvents=new i.UserEvents(e.element,{filter:".k-scheduler-monthview .k-scheduler-content td",tap:function(n){var s,i=t(n.target).offset(),o=e._slotByPosition(i.left,i.top);o&&(s=e._resourceBySlot(o),e.trigger("add",{eventInfo:l({isAllDay:!0,start:o.startDate(),end:o.startDate()},s)})),n.preventDefault()}})),e.options.editable.update!==!1&&(e._editUserEvents=new i.UserEvents(e.element,{filter:".k-scheduler-monthview .k-event",tap:function(n){0===t(n.event.target).closest("a:has(.k-si-close)").length&&(e.trigger("edit",{uid:t(n.target).closest(".k-event").attr(i.attr("uid"))}),n.preventDefault())}}))},selectionByElement:function(e){var n=t(e).offset();return this._slotByPosition(n.left,n.top)},_columnCountForLevel:function(t){var e=this.columnLevels[t];return e?e.length:0},_rowCountForLevel:function(t){var e=this.rowLevels[t];return e?e.length:0},_content:function(){var t,e="<tbody>",n=1,s=this.groupedResources;for(s.length&&this._isVerticallyGrouped()&&(n=this._rowCountForLevel(s.length-1)),t=0;n>t;t++)e+=this._createCalendar();e+="</tbody>",this.content.find("table").html(e)},_createCalendar:function(){var t,e,n,s=this.startDate(),o=f*u,r=f,a=[s],l="",d=1,h=this.groupedResources;for(h.length&&(this._isVerticallyGrouped()||(d=this._columnCountForLevel(h.length-1))),this._slotIndices={},t=0;o/r>t;t++){for(l+="<tr>",a.push(s),e=t*r,n=0;d>n;n++)l+=this._createRow(s,e,r);s=i.date.addDays(s,r),l+="</tr>"}return this._weekStartDates=a,this._endDate=i.date.previousDay(s),l},_createRow:function(t,e,n){var s,o=this._firstDayOfMonth,r=this._lastDayOfMonth,a=this.dayTemplate,l="",d="";for(s=0;n>s;s++)l="",i.date.isToday(t)&&(l+="k-today"),i.date.isInDateRange(t,o,r)||(l+=" k-other-month"),d+="<td ",""!==l&&(d+='class="'+l+'"'),d+=">",d+=a({date:t}),d+="</td>",this._slotIndices[h(t).getTime()]=e+s,t=i.date.nextDay(t);return d},_layout:function(){var n,s,i,o=this.calendarInfo(),r=this._isMobile()?o.days.namesShort:o.days.names,a=e(r,o.firstDay),l=t.map(a,function(t){return{text:t}}),d=this.groupedResources;if(d.length)if(this._isVerticallyGrouped()){for(s=[],i=0;6>i;i++)s.push({text:"<div>&nbsp;</div>",className:"k-hidden k-slot-cell"});n=this._createRowsLayout(d,s)}else l=this._createColumnsLayout(d,l);return{columns:l,rows:n}},_eventTmpl:function(t){var e,n=this.options,s=l({},i.Template,n.templateSettings),o=s.paramName,r="",a=typeof t,h={storage:{},count:0};return"function"===a?(h.storage["tmpl"+h.count]=t,r+="#=this.tmpl"+h.count+"("+o+")#",h.count++):"string"===a&&(r+=t),e=i.template(i.format(v,r),s),h.count>0&&(e=d(e,h.storage)),e},_createEventElement:function(e){var n=this.options,s=n.editable,o=this._isMobile();return e.showDelete=s&&s.destroy!==!1&&!o,e.resizable=s&&s.resize!==!1&&!o,e.ns=i.ns,e.resources=this.eventResources(e),e.inverseColor=e.resources&&e.resources[0]?this._shouldInverseResourceColor(e.resources[0]):!1,t(this.eventTemplate(e))},_isInDateSlot:function(t){var e=this.startDate(),n=new Date(this.endDate().getTime()+c-1);return(s(t.start,e,n)||s(t.end,e,n)||s(e,t.start,t.end)||s(n,t.start,t.end))&&(!s(t.end,e,e)||s(t.end,t.start,t.start)||t.isAllDay)},_slotIndex:function(t){return this._slotIndices[h(t).getTime()]},_positionMobileEvent:function(e,n,s){var o,a,l,d,h,c,u,f=e.start;e.start.offsetLeft>e.end.offsetLeft&&(f=e.end),o=e.start.index,a=o,l=3,d=r.collidingEvents(e.events(),o,a),d.push({element:n,start:o,end:a}),h=r.createRows(d),c=e.collection.at(o),u=c.container,u||(u=t(i.format('<div class="k-events-container" style="top:{0};left:{1};width:{2}"/>',f.offsetTop+f.firstChildTop+f.firstChildHeight-3+"px",f.offsetLeft+"px",f.offsetWidth+"px")),c.container=u,this.content[0].appendChild(u[0])),h.length<=l&&(e.addEvent({element:n,start:o,end:a,groupIndex:f.groupIndex}),s._continuousEvents.push({element:n,uid:n.attr(i.attr("uid")),start:e.start,end:e.end}),u[0].appendChild(n[0]))},_positionEvent:function(e,n,s){var o,a,l,d,h,c,u,f,p,v,g,m,y,k,D,w=this.options.eventHeight,b=e.start;for(e.start.offsetLeft>e.end.offsetLeft&&(b=e.end),o=e.start.index,a=e.end.index,l=b.eventCount,d=r.collidingEvents(e.events(),o,a),h=o!==a?5:4,d.push({element:n,start:o,end:a}),c=r.createRows(d),u=0,f=Math.min(c.length,l);f>u;u++)for(p=c[u].events,v=b.offsetTop+b.firstChildHeight+u*w+3*u+"px",g=0,m=p.length;m>g;g++)p[g].element[0].style.top=v;if(c.length>l)for(y=o;a>=y;y++){if(k=e.collection,D=k.at(y),D.more)return;D.more=t(_({ns:i.ns,start:y,end:y,width:D.clientWidth-2,left:this._scrollbarOffset(D.offsetLeft+2),top:D.offsetTop+D.firstChildHeight+l*w+3*l})),this.content[0].appendChild(D.more[0])}else e.addEvent({element:n,start:o,end:a,groupIndex:b.groupIndex}),n[0].style.width=e.innerWidth()-h+"px",n[0].style.left=this._scrollbarOffset(b.offsetLeft+2)+"px",n[0].style.height=w+"px",s._continuousEvents.push({element:n,uid:n.attr(i.attr("uid")),start:e.start,end:e.end}),this.content[0].appendChild(n[0])},_slotByPosition:function(t,e){var n,s,i=this.content.offset();for(t-=i.left,e-=i.top,e+=this.content[0].scrollTop,t+=this.content[0].scrollLeft,t=Math.ceil(t),e=Math.ceil(e),n=0;n<this.groups.length;n++)if(s=this.groups[n].daySlotByPosition(t,e))return s;return null},_createResizeHint:function(t){var e,n,s,i,o=t.startSlot().offsetLeft;o=this._scrollbarOffset(o),e=t.start.offsetTop,n=t.innerWidth(),s=t.start.clientHeight-2,i=r.fn._createResizeHint.call(this,o,e,n,s),i.appendTo(this.content),this._resizeHint=this._resizeHint.add(i)},_updateResizeHint:function(t,e,n,s){var o,r,a;for(this._removeResizeHint(),o=this.groups[e],r=o.ranges(n,s,!0,t.isAllDay),a=0;a<r.length;a++)this._createResizeHint(r[a]);this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(i.toString(i.timezone.toLocalDate(n),"M/dd")),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(i.toString(i.timezone.toLocalDate(s),"M/dd"))},_updateMoveHint:function(t,e,n){var s,o,r,a,l,d=i.date.toUtcTime(t.start)+n,h=d+t.duration(),c=this.groups[e],u=c.ranges(d,h,!0,t.isAllDay);for(this._removeMoveHint(),s=0;s<u.length;s++)o=u[s],r=o.startSlot(),a=o.endSlot(),l=this._createEventElement(t.clone({head:o.head,tail:o.tail})),l.css({left:r.offsetLeft+2,top:r.offsetTop+r.firstChildHeight,height:this.options.eventHeight,width:o.innerWidth()-(r.index!==a.index?5:4)}),l.addClass("k-event-drag-hint"),l.appendTo(this.content),this._moveHint=this._moveHint.add(l)},_groups:function(){var t,e,n,s,o,r,a,l,d,h,c,p,v,g,_,m,y,k=this._groupCount(),D=f,w=u;for(this.groups=[],t=0;k>t;t++)this._addResourceView(t);for(e=this.content[0].getElementsByTagName("tr"),n=0;k>n;n++)for(s=0,o=0,this._isVerticallyGrouped()&&(o=n),r=o*w;(o+1)*w>r;r++)for(a=this.groups[n],l=a.addDaySlotCollection(i.date.addDays(this.startDate(),s),i.date.addDays(this.startDate(),s+D)),d=e[r],h=d.children,c=0,d.setAttribute("role","row"),this._isVerticallyGrouped()||(c=n),p=c*D;(c+1)*D>p;p++)v=h[p],g=v.clientHeight,_=v.firstChild.offsetHeight+3,m=i.date.toUtcTime(i.date.addDays(this.startDate(),s)),s++,y=Math.floor((g-_)/(this.options.eventHeight+3))-1,v.setAttribute("role","gridcell"),v.setAttribute("aria-selected",!1),l.addDaySlot(v,m,m+i.date.MS_PER_DAY,y)},render:function(t){this.content.children(".k-event,.k-more-events,.k-events-container").remove(),this._groups(),t=new i.data.Query(t).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray();var e=this.groupedResources;e.length?this._renderGroups(t,e,0,1):this._renderEvents(t,0),this.refreshLayout(),this.trigger("activate")},_renderEvents:function(t,e){var n,s,i,o,r,a,l,d,h,c,u,f=this._isMobilePhoneView();for(s=0,i=t.length;i>s;s++)if(n=t[s],this._isInDateSlot(n))for(o=this.groups[e],o._continuousEvents||(o._continuousEvents=[]),r=o.slotRanges(n,!0),a=r.length,l=0;a>l;l++)d=r[l],h=n.start,c=n.end,a>1&&(0===l?c=d.end.endDate():l==a-1?h=d.start.startDate():(h=d.start.startDate(),c=d.end.endDate())),u=n.clone({start:h,end:c,head:d.head,tail:d.tail}),f?this._positionMobileEvent(d,this._createEventElement(u),o):this._positionEvent(d,this._createEventElement(u),o)},_renderGroups:function(t,e,n,s){var o,a,l,d,h=e[0];if(h)for(o=h.dataSource.view(),a=0;a<o.length;a++)l=this._resourceValue(h,o[a]),d=new i.data.Query(t).filter({field:h.field,operator:r.groupEqFilter(l)}).toArray(),e.length>1?n=this._renderGroups(d,e.slice(1),n++,s+1):this._renderEvents(d,n++);return n},_groupCount:function(){var t=this.groupedResources;return t.length?this._isVerticallyGrouped()?this._rowCountForLevel(t.length-1):this._columnCountForLevel(t.length)/this._columnOffsetForResource(t.length):1},_columnOffsetForResource:function(t){return this._columnCountForLevel(t)/this._columnCountForLevel(t-1)},destroy:function(){this.table&&this.table.removeClass("k-scheduler-monthview"),this.content&&this.content.off(a),this.element&&this.element.off(a),r.fn.destroy.call(this),this._isMobile()&&!this._isMobilePhoneView()&&(this.options.editable.create!==!1&&this._addUserEvents.destroy(),this.options.editable.update!==!1&&this._editUserEvents.destroy())},events:["remove","add","edit","navigate"],options:{title:"Month",name:"month",eventHeight:25,editable:!0,selectedDateFormat:"{0:y}",dayTemplate:p,eventTemplate:g}})}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(t,e){return e()});
//@ sourceMappingURL=kendo.scheduler.monthview.min.js.map