ggdworkshop/lib/fullcalendar/sched/scheduler.min.js

9 lines
99 KiB
JavaScript
Raw Permalink Normal View History

2017-11-15 18:17:06 +00:00
/*!
* FullCalendar Scheduler v1.8.1
* Docs & License: https://fullcalendar.io/scheduler/
* (c) 2017 Adam Shaw
*/
!function(e){"function"==typeof define&&define.amd?define(["jquery","moment","fullcalendar"],e):"object"==typeof exports?module.exports=e(require("jquery"),require("moment"),require("fullcalendar")):e(jQuery,moment)}(function(e,t){var r=e.fullCalendar;if(r.schedulerVersion="1.8.1",11!==r.internalApiVersion)return void r.warn("v"+r.schedulerVersion+" of FullCalendar Scheduler is incompatible with v"+r.version+" of the core.\nPlease see http://fullcalendar.io/support/ for more information.");var o,n,s,i,l,u,a,c,h,p,d,f,g,y,v,m,R,w,S,b,E,C,H,T,I,D,_,x,z,B,F,M,L,P,W,k,G,A,U,V,q,O,N,j,Y,J,X,Q,$,K,Z,ee,te,re,oe,ne,se,ie,le,ue,ae,ce,he,pe,de,fe,ge,ye,ve,me,Re,we,Se,be,Ee,Ce,He,Te,Ie,De,_e,xe,ze,Be,Fe,Me,Le,Pe=r.Calendar,We=r.Class,ke=r.View,Ge=r.debounce,Ae=r.isInt,Ue=r.removeExact,Ve=r.getScrollbarWidths,qe=r.DragListener,Oe=r.htmlEscape,Ne=r.computeGreatestUnit,je=r.proxy,Ye=r.capitaliseFirstLetter,Je=(r.applyAll,r.EmitterMixin),Xe=r.ListenerMixin,Qe=r.durationHasTime,$e=r.divideRangeByDuration,Ke=r.divideDurationByDuration,Ze=r.multiplyDuration,et=r.parseFieldSpecs,tt=r.compareByFieldSpecs,rt=r.flexibleCompare,ot=r.intersectRects,nt=r.CoordCache,st=r.getContentRect,it=r.getOuterRect,lt=r.Promise,ut=(r.TaskQueue,r.UnzonedRange),at=r.ComponentFootprint,ct=r.EventDef,ht=r.EventSource,pt=r.EventFootprint,dt=r.EventDefMutation,ft=r.cssToStr,gt=r.DateComponent,yt=r.InteractiveDateComponent,vt=r.EventRenderer,mt=r.BusinessHourRenderer,Rt=r.FillRenderer,wt=r.HelperRenderer,St=r.StandardInteractionsMixin,bt=r.DateSelecting,Et=(r.EventPointing,r.EventDragging),Ct=r.EventResizing,Ht=r.ExternalDropping,Tt=r.BusinessHourGenerator,It=(r.EventInstanceGroup,function(e,t){function r(){this.constructor=e}for(var o in t)Dt.call(t,o)&&(e[o]=t[o]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e}),Dt={}.hasOwnProperty,_t=[].indexOf||function(e){for(var t=0,r=this.length;t<r;t++)if(t in this&&this[t]===e)return t;return-1};we=function(e){return e.find("> td").filter(function(e,t){return t.rowSpan<=1})},m=function(t){function o(){o.__super__.constructor.apply(this,arguments),this.requestMovingEnd=Ge(this.reportMovingEnd,500)}var n,s;return It(o,t),o.mixin(Je),o.mixin(Xe),o.prototype.canvas=null,o.prototype.isScrolling=!1,o.prototype.isTouching=!1,o.prototype.isTouchedEver=!1,o.prototype.isMoving=!1,o.prototype.isTouchScrollEnabled=!0,o.prototype.preventTouchScrollHandler=null,o.prototype.render=function(){return o.__super__.render.apply(this,arguments),this.canvas&&(this.canvas.render(),this.canvas.el.appendTo(this.scrollEl)),this.bindHandlers()},o.prototype.destroy=function(){return o.__super__.destroy.apply(this,arguments),this.unbindHandlers()},o.prototype.disableTouchScroll=function(){return this.isTouchScrollEnabled=!1,this.bindPreventTouchScroll()},o.prototype.enableTouchScroll=function(){if(this.isTouchScrollEnabled=!0,!this.isTouching)return this.unbindPreventTouchScroll()},o.prototype.bindPreventTouchScroll=function(){if(!this.preventTouchScrollHandler)return this.scrollEl.on("touchmove",this.preventTouchScrollHandler=r.preventDefault)},o.prototype.unbindPreventTouchScroll=function(){if(this.preventTouchScrollHandler)return this.scrollEl.off("touchmove",this.preventTouchScrollHandler),this.preventTouchScrollHandler=null},o.prototype.bindHandlers=function(){return this.listenTo(this.scrollEl,{scroll:this.reportScroll,touchstart:this.reportTouchStart,touchend:this.reportTouchEnd})},o.prototype.unbindHandlers=function(){return this.stopListeningTo(this.scrollEl)},o.prototype.reportScroll=function(){return this.isScrolling||this.reportScrollStart(),this.trigger("scroll"),this.isMoving=!0,this.requestMovingEnd()},o.prototype.reportScrollStart=function(){if(!this.isScrolling)return this.isScrolling=!0,this.trigger("scrollStart",this.isTouching)},o.prototype.requestMovingEnd=null,o.prototype.reportMovingEnd=function(){if(this.isMoving=!1,!this.isTouching)return this.reportScrollEnd()},o.prototype.reportScrollEnd=function(){if(this.isScrolling)return this.trigger("scrollEnd"),this.isScrolling=!1},o.prototype.reportTouch
var o;return o=s.apply(this,arguments),r?new A(o.unzonedRange,o.isAllDay,r):o},Pe.prototype.getResourceById=function(e){return this.resourceManager.getResourceById(e)},Pe.prototype.getEventResourceId=function(e){return this.getEventResourceIds(e)[0]},Pe.prototype.getEventResourceIds=function(e){var t;return t=this.eventManager.getEventDefByUid(e._id),t?t.getResourceIds():[]},Pe.prototype.setEventResourceId=function(e,t){return this.setEventResourceIds(e,t?[t]:[])},Pe.prototype.setEventResourceIds=function(e,t){var r,o;if(r=this.eventManager.getEventDefByUid(e._id))return r.resourceIds=function(){var e,r,n;for(n=[],e=0,r=t.length;e<r;e++)o=t[e],n.push(W.normalizeId(o));return n}()},Pe.prototype.getResourceEvents=function(t){var r;return r="object"==typeof t?t:this.getResourceById(t),r?this.clientEvents(function(t){return function(o){return e.inArray(r.id,t.getEventResourceIds(o))!==-1}}(this)):[]},Pe.prototype.getEventResource=function(e){return this.getEventResources(e)[0]},Pe.prototype.getEventResources=function(e){var t,r,o,n,s,i,l;if(t="object"==typeof e?e:this.clientEvents(e)[0],l=[],t)for(n=this.getEventResourceIds(t),r=0,o=n.length;r<o;r++)i=n[r],s=this.getResourceById(i),s&&l.push(s);return l},c=Pe.prototype.getPeerEventInstances,h=Pe.prototype.isFootprintAllowed,n=Pe.prototype.buildCurrentBusinessFootprints,u=Pe.prototype.footprintContainsFootprint,a=Pe.prototype.footprintsIntersect,l=Pe.prototype.eventRangeToEventFootprints,p=Pe.prototype.parseFootprints,Pe.prototype.getPeerEventInstances=function(e){var t,r;return r=e.getResourceIds(),t=c.apply(this,arguments),r.length?t.filter(function(e){var t,o,n;if(!e.def.resourceIds.length)return!0;for(t=0,o=r.length;t<o;t++)if(n=r[t],e.def.hasResourceId(n))return!0;return!1}):t},Pe.prototype.isFootprintAllowed=function(e,t,r,o,n){var s,i;return("object"!=typeof r||(s=W.extractIds(r,this),!s.length||e instanceof A&&(i=e.resourceId,_t.call(s,i)>=0)))&&h.apply(this,arguments)},Pe.prototype.buildCurrentBusinessFootprints=function(e){var t,r,o,s,i,l,u,a,c,h,p,d,f,g,y,v,m;for(l=this.resourceManager.getFlatResources(),t=!1,a=0,p=l.length;a<p;a++)y=l[a],y.businessHourGenerator&&(t=!0);if(t){for(m=this.view,u=m.get("businessHourGenerator"),v=m.dateProfile.activeUnzonedRange,o=[],c=0,d=l.length;c<d;c++)if(y=l[c],r=y.businessHourGenerator||u,s=r.buildEventInstanceGroup(e,v))for(g=s.getAllEventRanges(),h=0,f=g.length;h<f;h++)i=g[h],o.push(new A(i.unzonedRange,e,y.id));return o}return n.apply(this,arguments)},Pe.prototype.footprintContainsFootprint=function(e,t){return(!(e instanceof A)||t instanceof A&&t.resourceId===e.resourceId)&&u.apply(this,arguments)},Pe.prototype.footprintsIntersect=function(e,t){return!(e instanceof A&&t instanceof A&&e.resourceId!==t.resourceId)&&a.apply(this,arguments)},Pe.prototype.eventRangeToEventFootprints=function(e){var t,r,o,n,s,i;if(t=e.eventDef,s=t.getResourceIds(),s.length){for(i=[],r=0,o=s.length;r<o;r++)n=s[r],i.push(new pt(new A(e.unzonedRange,t.isAllDay(),n),t,e.eventInstance));return i}return l.apply(this,arguments)},Pe.prototype.parseFootprints=function(e){var t,r,o,n,s,i,l,u,a;if(l=p.apply(this,arguments),a=e.resourceIds||[],e.resourceId&&(a=[e.resourceId].concat(a)),a.length){for(t=[],r=0,n=a.length;r<n;r++)for(u=a[r],o=0,s=l.length;o<s;o++)i=l[o],t.push(new A(i.unzonedRange,i.isAllDay,u));return t}return l},Pe.defaults.refetchResourcesOnNavigate=!1,Pe.defaults.filterResourcesWithEvents=!1,de=ke.prototype.setElement,pe=ke.prototype.removeElement,fe=ke.prototype.triggerViewRender,ke.prototype.canHandleSpecificResources=!1,ke.prototype.setElement=function(){return de.apply(this,arguments),this.watchResources()},ke.prototype.removeElement=function(){return this.unwatchResources(),pe.apply(this,arguments)},ke.prototype.triggerViewRender=function(){return _e(this.opt("schedulerLicenseKey"),this.el),fe.apply(this,arguments)},ke.prototype.watchResources=function(){var e,t;return t=[],e=["initialResources"],this.opt("refetchResourcesOnNavigate")&&t.push("dateProfile"),this.opt("filterResourcesWithEvents")&&e.push("currentEvents"),this.watch("initi
o>F&&(r.warn("slotDuration results in too many cells"),this.slotDuration=null)),this.labelInterval&&this.slotDuration&&(n=Ke(this.labelInterval,this.slotDuration),!Ae(n)||n<1))return r.warn("slotLabelInterval must be a multiple of slotDuration"),this.slotDuration=null},ae.prototype.computeFallbackDuration=function(){var e,r,o,n,s;if(e=null,this.labelInterval||this.slotDuration)for(s=this.ensureLabelInterval(),o=K.length-1;o>=0&&(r=K[o],e=t.duration(r),n=Ke(e,s),!(n>=M));o+=-1);else e=t.duration(g);return e},ae.prototype.ensureLabelInterval=function(){var e,r,o,n,s,i,l,u,a,c;if(e=this.dateProfile.currentUnzonedRange,i=this.labelInterval,!i){if(this.slotDuration){for(o=0,l=K.length;o<l;o++)if(r=K[o],c=t.duration(r),a=Ke(c,this.slotDuration),Ae(a)&&a<=B){i=c;break}i||(i=this.slotDuration)}else for(n=0,u=K.length;n<u&&(r=K[n],i=t.duration(r),s=$e(e.getStart(),e.getEnd(),i),!(s>=M));n++);this.labelInterval=i}return i},ae.prototype.ensureSlotDuration=function(){var e,r,o,n,s,i,l,u,a;if(e=this.dateProfile.currentUnzonedRange,l=this.slotDuration,!l){for(n=this.ensureLabelInterval(),o=0,s=K.length;o<s;o++)if(r=K[o],a=t.duration(r),u=Ke(n,a),Ae(u)&&u>1&&u<=B){l=a;break}l&&(i=$e(e.getStart(),e.getEnd(),l),i>z&&(l=null)),l||(l=n),this.slotDuration=l}return l},ae.prototype.computeHeaderFormats=function(){var e,t,r,o,n,s;switch(o=this.labelInterval,n=Ne(o),s=this.opt("weekNumbers"),e=t=r=null,"week"!==n||s||(n="day"),n){case"year":e="YYYY";break;case"month":this.currentRangeAs("years")>1&&(e="YYYY"),t="MMM";break;case"week":this.currentRangeAs("years")>1&&(e="YYYY"),t=this.opt("shortWeekFormat");break;case"day":this.currentRangeAs("years")>1?e=this.opt("monthYearFormat"):this.currentRangeAs("months")>1&&(e="MMMM"),s&&(t=this.opt("weekFormat")),r="dd D";break;case"hour":s&&(e=this.opt("weekFormat")),this.currentRangeAs("days")>1&&(t=this.opt("dayOfMonthFormat")),r=this.opt("smallTimeFormat");break;case"minute":o.asMinutes()/60>=B?(e=this.opt("hourFormat"),t="[:]mm"):e=this.opt("mediumTimeFormat");break;case"second":o.asSeconds()/60>=B?(e="LT",t="[:]ss"):e="LTS";break;case"millisecond":e="LTS",t="[.]SSS"}return[].concat(e||[],t||[],r||[])},r.views.timeline={"class":ae,defaults:{eventResizableFromStart:!0}},r.views.timelineDay={type:"timeline",duration:{days:1}},r.views.timelineWeek={type:"timeline",duration:{weeks:1}},r.views.timelineMonth={type:"timeline",duration:{months:1}},r.views.timelineYear={type:"timeline",duration:{years:1}},$=function(t){function r(t){this.view=t,r.__super__.constructor.apply(this,arguments),this.isExpanded=this.view.opt("resourcesInitiallyExpanded"),this.children=[],this.trHash={},this.trs=e()}return It(r,t),r.prototype.view=null,r.prototype.parent=null,r.prototype.prevSibling=null,r.prototype.children=null,r.prototype.depth=0,r.prototype.hasOwnRow=!1,r.prototype.trHash=null,r.prototype.trs=null,r.prototype.isExpanded=!1,r.prototype.addChild=function(e,t){var r;return e.removeFromParentAndDom(),r=this.children,null!=t?r.splice(t,0,e):(t=r.length,r.push(e)),e.prevSibling=t>0?r[t-1]:null,t<r.length-1&&(r[t+1].prevSibling=e),e.parent=this,e.depth=this.depth+(this.hasOwnRow?1:0),this.descendantAdded(e)},r.prototype.removeChild=function(e){var t,r,o,n,s,i;for(t=this.children,o=!1,r=n=0,s=t.length;n<s;r=++n)if(i=t[r],i===e){o=!0;break}return!!o&&(r<t.length-1&&(t[r+1].prevSibling=e.prevSibling),t.splice(r,1),e.parent=null,e.prevSibling=null,this.descendantRemoved(e),e)},r.prototype.removeChildren=function(){var e,t,r,o;for(o=this.children,t=0,r=o.length;t<r;t++)e=o[t],this.descendantRemoved(e);return this.children=[]},r.prototype.removeFromParentAndDom=function(){if(this.parent&&this.parent.removeChild(this),this.get("isInDom"))return this.removeElement()},r.prototype.getLastChild=function(){var e;return e=this.children,e[e.length-1]},r.prototype.getPrevRowInDom=function(){var e,t;for(t=this;t;){if(t.prevSibling)for(t=t.prevSibling;e=t.getLastChild();)t=e;else t=t.parent;if(t&&t.get("isInDom"))return t}return null},r.prototype.getLeadingRow=function(){return this.hasOwnRow?this:this.isExpanded&&this.children.lengt
},r.prototype.getResourceRow=function(e){return this.resourceRowHash[e]},r.prototype.renderSelectionFootprint=function(e){var t;return e.resourceId?(t=this.getResourceRow(e.resourceId))?t.renderSelectionFootprint(e):void 0:r.__super__.renderSelectionFootprint.apply(this,arguments)},r.prototype.renderEventResize=function(e,t,r){var o,n,s,i,l,u;n=Ee(e),l=[];for(i in n)s=n[i],u=this.getResourceRow(i),u.helperRenderer.renderEventDraggingFootprints(s,t,r),l.push(function(){var e,t,r;for(r=[],e=0,t=s.length;e<t;e++)o=s[e],r.push(u.renderHighlight(o.componentFootprint));return r}());return l},r.prototype.unrenderEventResize=function(){var e,t,r,o,n;for(r=this.getEventRows(),o=[],e=0,t=r.length;e<t;e++)n=r[e],n.helperRenderer.unrender(),o.push(n.unrenderHighlight());return o},r.prototype.renderDrag=function(e,t,r){var o,n,s,i,l,u,a;if(i=Ee(e),t){for(u in i)l=i[u],a=this.getResourceRow(u),a.helperRenderer.renderEventDraggingFootprints(l,t,r);return!0}for(u in i)for(l=i[u],n=0,s=l.length;n<s;n++)o=l[n],a=this.getResourceRow(u),a.renderHighlight(o.componentFootprint);return!1},r.prototype.unrenderDrag=function(){var e,t,r,o,n;for(r=this.getEventRows(),o=[],e=0,t=r.length;e<t;e++)n=r[e],n.helperRenderer.unrender(),o.push(n.unrenderHighlight());return o},r}(ae),Ee=function(e){var t,r,o,n,s;for(n={},r=0,o=e.length;r<o;r++)t=e[r],(n[s=t.componentFootprint.resourceId]||(n[s]=[])).push(t);return n},r.ResourceTimelineView=J,r.views.timeline.resourceClass=J,Pe.defaults.resourcesInitiallyExpanded=!0,j=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return It(r,t),r.mixin(V),r.prototype.isResourceFootprintsEnabled=!0,r.prototype.renderDates=function(e){return this.dateProfile=e,this.renderSlats()},r.prototype.renderResources=function(e){if(this.registerResources(e),this.renderColumns(),this.headContainerEl)return this.processHeadResourceEls(this.headContainerEl)},r.prototype.getHitFootprint=function(e){var t;return t=r.__super__.getHitFootprint.apply(this,arguments),new A(t.unzonedRange,t.isAllDay,this.getColResource(e.col).id)},r.prototype.componentFootprintToSegs=function(t){var r,o,n,s,i,l,u,a,c,h,p;for(u=this.resourceCnt,o=this.sliceRangeByTimes(t.unzonedRange),h=[],n=0,i=o.length;n<i;n++)for(p=o[n],a=s=0,l=u;s<l;a=s+=1)c=this.flattenedResources[a],t instanceof A&&t.resourceId!==c.id||(r=e.extend({},p),r.resource=c,r.col=this.indicesToCol(a,p.dayIndex),h.push(r));return h},r}(r.TimeGrid),U=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return It(r,t),r.mixin(V),r.prototype.isResourceFootprintsEnabled=!0,r.prototype.renderDates=function(e){return this.dateProfile=e},r.prototype.renderResources=function(e){if(this.registerResources(e),this.renderGrid(),this.headContainerEl)return this.processHeadResourceEls(this.headContainerEl)},r.prototype.getHitFootprint=function(e){var t;return t=r.__super__.getHitFootprint.apply(this,arguments),new A(t.unzonedRange,t.isAllDay,this.getColResource(e.col).id)},r.prototype.componentFootprintToSegs=function(t){var r,o,n,s,i,l,u,a,c,h,p;for(u=this.resourceCnt,o=this.datesAboveResources?this.sliceRangeByDay(t.unzonedRange):this.sliceRangeByRow(t.unzonedRange),h=[],n=0,i=o.length;n<i;n++)for(p=o[n],a=s=0,l=u;s<l;a=s+=1)c=this.flattenedResources[a],t instanceof A&&t.resourceId!==c.id||(r=e.extend({},p),r.resource=c,this.isRTL?(r.leftCol=this.indicesToCol(a,p.lastRowDayIndex),r.rightCol=this.indicesToCol(a,p.firstRowDayIndex)):(r.leftCol=this.indicesToCol(a,p.firstRowDayIndex),r.rightCol=this.indicesToCol(a,p.lastRowDayIndex)),h.push(r));return h},r}(r.DayGrid),k=function(e){function t(){t.__super__.constructor.apply(this,arguments),this.initResourceView()}return It(t,e),t.mixin(X),t.prototype.timeGridClass=j,t.prototype.dayGridClass=U,t}(r.AgendaView),r.ResourceAgendaView=k,r.views.agenda.queryResourceClass=function(e){var t;if(null!=(t=e.options.groupByResource||e.options.groupByDateAndResource)?t:e.duration&&1===e.duration.as("days"))return k},G=function(e){function t(){t.__super__.constructor.apply(this,arguments),this.initResourceView()}return I