|
|
/*! FullCalendar Scheduler v1.5.0 Docs & License: http://fullcalendar.io/scheduler/
(c) 2016 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,s,o,n,i,l,u,h,c,a,p,d,f,g,y,v,R,w,m,S,b,C,E,H,T,_,I,D,x,G,B,F,W,M,L,z,k,O,P,q,A,U,V,N,j,Y,Q,X,$,K,J,Z,ee,te,re,se,oe,ne,ie,le,ue,he,ce,ae,pe,de,fe,ge,ye,ve,Re,we,me,Se,be,Ce,Ee,He,Te,_e,Ie,De,xe,Ge,Be,Fe,We,Me,Le,ze,ke,Oe,Pe,qe,Ae,Ue,Ve,Ne,je,Ye=function(e,t){function r(){this.constructor=e}for(var s in t)Qe.call(t,s)&&(e[s]=t[s]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},Qe={}.hasOwnProperty,Xe=[].indexOf||function(e){for(var t=0,r=this.length;t<r;t++)if(t in this&&this[t]===e)return t;return-1},$e=[].slice;return d=e.fullCalendar,d.schedulerVersion="1.5.0",7!==d.internalApiVersion?void d.warn("v"+d.schedulerVersion+" of FullCalendar Scheduler is incompatible with v"+d.version+" of the core.\nPlease see http://fullcalendar.io/support/ for more information."):(s=d.Calendar,n=d.Class,K=d.View,f=d.Grid,be=d.intersectRanges,ue=d.debounce,He=d.isInt,we=d.getScrollbarWidths,h=d.DragListener,Se=d.htmlEscape,re=d.computeIntervalUnit,Pe=d.proxy,ee=d.capitaliseFirstLetter,Z=d.applyAll,c=d.EmitterMixin,v=d.ListenerMixin,pe=d.durationHasTime,ae=d.divideRangeByDuration,ce=d.divideDurationByDuration,Ie=d.multiplyDuration,ke=d.parseFieldSpecs,te=d.compareByFieldSpecs,de=d.flexibleCompare,Ce=d.intersectRects,l=d.CoordCache,fe=d.getContentRect,ge=d.getOuterRect,ie=d.createObject,C=d.Promise,N=d.TaskQueue,ye=function(e){return e.find("> td").filter(function(e,t){return t.rowSpan<=1})},a=function(t){function r(){r.__super__.constructor.apply(this,arguments),this.requestMovingEnd=ue(this.reportMovingEnd,500)}var s,o;return Ye(r,t),r.mixin(c),r.mixin(v),r.prototype.canvas=null,r.prototype.isScrolling=!1,r.prototype.isTouching=!1,r.prototype.isMoving=!1,r.prototype.isTouchScrollEnabled=!0,r.prototype.preventTouchScrollHandler=null,r.prototype.render=function(){return r.__super__.render.apply(this,arguments),this.canvas&&(this.canvas.render(),this.canvas.el.appendTo(this.scrollEl)),this.bindHandlers()},r.prototype.destroy=function(){return r.__super__.destroy.apply(this,arguments),this.unbindHandlers()},r.prototype.disableTouchScroll=function(){return this.isTouchScrollEnabled=!1,this.bindPreventTouchScroll()},r.prototype.enableTouchScroll=function(){if(this.isTouchScrollEnabled=!0,!this.isTouching)return this.unbindPreventTouchScroll()},r.prototype.bindPreventTouchScroll=function(){if(!this.preventTouchScrollHandler)return this.scrollEl.on("touchmove",this.preventTouchScrollHandler=d.preventDefault)},r.prototype.unbindPreventTouchScroll=function(){if(this.preventTouchScrollHandler)return this.scrollEl.off("touchmove",this.preventTouchScrollHandler),this.preventTouchScrollHandler=null},r.prototype.bindHandlers=function(){return this.listenTo(this.scrollEl,{scroll:this.reportScroll,touchstart:this.reportTouchStart,touchend:this.reportTouchEnd})},r.prototype.unbindHandlers=function(){return this.stopListeningTo(this.scrollEl)},r.prototype.reportScroll=function(){return this.isScrolling||this.reportScrollStart(),this.trigger("scroll"),this.isMoving=!0,this.requestMovingEnd()},r.prototype.reportScrollStart=function(){if(!this.isScrolling)return this.isScrolling=!0,this.trigger("scrollStart",this.isTouching)},r.prototype.requestMovingEnd=null,r.prototype.reportMovingEnd=function(){if(this.isMoving=!1,!this.isTouching)return this.reportScrollEnd()},r.prototype.reportScrollEnd=function(){if(this.isScrolling)return this.trigger("scrollEnd"),this.isScrolling=!1},r.prototype.reportTouchStart=function(){return this.isTouching=!0},r.prototype.reportTouchEnd=function(){if(this.isTouching&&(this.isTouching=!1,this.isTouchScrollEnabled&&this.unbindPreventTouchScroll(),!this.isMoving))return this.reportScrollEnd()},r.prototype.getScrollLeft=function(){var e,t,r;if(e=this.scrollEl.css("direction"),t=this.scrollEl[0],r=t.scrollLeft,"rtl"===e)switch(o){case"positive":r=r+t.clientWidth-t.scrollW },getResourceText:function(e){return this.getResourceTextFunc()(e)},getResourceTextFunc:function(){var e;return this.resourceTextFunc?this.resourceTextFunc:(e=this.opt("resourceText"),"function"!=typeof e&&(e=function(e){return e.title||e.id}),this.resourceTextFunc=e)},triggerDayClick:function(e,t,r){var s;return s=this.calendar.resourceManager,this.publiclyTrigger("dayClick",t,this.calendar.applyTimezone(e.start),r,this,s.getResourceById(e.resourceId))},triggerSelect:function(e,t){var r;return r=this.calendar.resourceManager,this.publiclyTrigger("select",null,this.calendar.applyTimezone(e.start),this.calendar.applyTimezone(e.end),t,this,r.getResourceById(e.resourceId))},triggerExternalDrop:function(e,t,r,s,o){if(this.publiclyTrigger("drop",r[0],t.start,s,o,t.resourceId),e)return this.publiclyTrigger("eventReceive",null,e)},reportEventDrop:function(){var e,t,r,s;return t=arguments[0],e=arguments[1],r=3<=arguments.length?$e.call(arguments,2):[],e=this.normalizeDropLocation(e),e.resourceId&&t.resourceIds&&(e.resourceIds=null),(s=K.prototype.reportEventDrop).call.apply(s,[this,t,e].concat($e.call(r)))},reportExternalDrop:function(){var e,t,r,s;return t=arguments[0],e=arguments[1],r=3<=arguments.length?$e.call(arguments,2):[],e=this.normalizeDropLocation(e),(s=K.prototype.reportExternalDrop).call.apply(s,[this,t,e].concat($e.call(r)))},normalizeDropLocation:function(t){var r;return r=e.extend({},t),delete r.resourceId,this.calendar.setEventResourceId(r,t.resourceId),r},filterResourcesWithEvents:function(e,t){var r,s,o,n,i,l,u,h;for(h={},s=0,n=t.length;s<n;s++)for(r=t[s],l=this.calendar.getEventResourceIds(r),o=0,i=l.length;o<i;o++)u=l[o],h[u]=!0;return J(e,h)}},J=function(e,t){var r,s,o,n,i,l;for(o=[],n=0,i=e.length;n<i;n++)l=e[n],l.children.length?(r=J(l.children,t),(r.length||t[l.id])&&(s=ie(l),s.children=r,o.push(s))):t[l.id]&&o.push(l);return o},$=e.extend({},L,{executeResourcesRender:function(e){return this.setResourcesOnGrids(e),this.isDateRendered?this.requestDateRender().then(function(e){return function(){return e.reportResourcesRender()}}(this)):C.resolve()},executeResourcesUnrender:function(e){return null==e&&(e={}),this.unsetResourcesOnGrids(),this.isDateRendered&&!e.skipRerender?this.requestDateRender().then(function(e){return function(){return e.reportResourcesUnrender()}}(this)):(this.reportResourcesUnrender(),C.resolve())},executeDateRender:function(e){return K.prototype.executeDateRender.apply(this,arguments).then(function(e){return function(){if(e.isResourcesSet)return e.reportResourcesRender()}}(this))},executeDateUnrender:function(e){return K.prototype.executeDateUnrender.apply(this,arguments).then(function(e){return function(){if(e.isResourcesSet)return e.reportResourcesUnrender()}}(this))},setResourcesOnGrids:function(e){},unsetResourcesOnGrids:function(){}}),D={allowCrossResource:!0,eventRangeToSpans:function(t,r){var s,o,n,i,l;if(i=this.view.calendar.getEventResourceIds(r),i.length){for(l=[],s=0,o=i.length;s<o;s++)n=i[s],l.push(e.extend({},t,{resourceId:n}));return l}return d.isBgEvent(r)?f.prototype.eventRangeToSpans.apply(this,arguments):[]},fabricateHelperEvent:function(e,t){var r;return r=f.prototype.fabricateHelperEvent.apply(this,arguments),this.view.calendar.setEventResourceId(r,e.resourceId),r},computeEventDrop:function(e,t,r){var s;return s=this.view.isEventStartEditable(r)?f.prototype.computeEventDrop.apply(this,arguments):d.pluckEventDateProps(r),s&&(this.view.isEventResourceEditable(r)?s.resourceId=t.resourceId:s.resourceId=e.resourceId),s},computeExternalDrop:function(e,t){var r;return r=f.prototype.computeExternalDrop.apply(this,arguments),r&&(r.resourceId=e.resourceId),r},computeEventResize:function(e,t,r,s){var o;if(this.allowCrossResource||t.resourceId===r.resourceId)return o=f.prototype.computeEventResize.apply(this,arguments),o&&(o.resourceId=t.resourceId),o},computeSelectionSpan:function(e,t){var r;if(this.allowCrossResource||e.resourceId===t.resourceId)return r=f.prototype.computeSelectionSpan.apply(this,arguments),r&&(r.resourceId=e.resourceId),r}},I={flattenedResources:null,reso s=Math.max(s,se(o));return s},se=function(e){return null==e.top&&(e.top=oe(e.above)),e.top+e.height},Ne=function(e,t){return e.left<t.right&&e.right>t.left},S=18,w=6,R=200,m=1e3,u={months:1},O=[{years:1},{months:1},{days:1},{hours:1},{minutes:30},{minutes:15},{minutes:10},{minutes:5},{minutes:1},{seconds:30},{seconds:15},{seconds:10},{seconds:5},{seconds:1},{milliseconds:500},{milliseconds:100},{milliseconds:10},{milliseconds:1}],j.prototype.initScaleProps=function(){var t,r,s;return this.labelInterval=this.queryDurationOption("slotLabelInterval"),this.slotDuration=this.queryDurationOption("slotDuration"),this.ensureGridDuration(),this.validateLabelAndSlot(),this.ensureLabelInterval(),this.ensureSlotDuration(),t=this.opt("slotLabelFormat"),s=e.type(t),this.headerFormats="array"===s?t:"string"===s?[t]:this.computeHeaderFormats(),this.isTimeScale=pe(this.slotDuration),this.largeUnit=this.isTimeScale?void 0:(r=re(this.slotDuration),/year|month|week/.test(r)?r:void 0),this.emphasizeWeeks=1===this.slotDuration.as("days")&&this.duration.as("weeks")>=2&&!this.opt("businessHours")},j.prototype.queryDurationOption=function(e){var r,s;if(s=this.opt(e),null!=s&&(r=t.duration(s),+r))return r},j.prototype.validateLabelAndSlot=function(){var e,t,r;if(this.labelInterval&&(e=ce(this.duration,this.labelInterval),e>m&&(d.warn("slotLabelInterval results in too many cells"),this.labelInterval=null)),this.slotDuration&&(t=ce(this.duration,this.slotDuration),t>m&&(d.warn("slotDuration results in too many cells"),this.slotDuration=null)),this.labelInterval&&this.slotDuration&&(r=ce(this.labelInterval,this.slotDuration),!He(r)||r<1))return d.warn("slotLabelInterval must be a multiple of slotDuration"),this.slotDuration=null},j.prototype.ensureGridDuration=function(){var e,r,s,o,n;if(e=this.duration,!e){if(e=this.view.intervalDuration,!e)if(this.labelInterval||this.slotDuration)for(n=this.ensureLabelInterval(),s=O.length-1;s>=0&&(r=O[s],e=t.duration(r),o=ce(e,n),!(o>=S));s+=-1);else e=t.duration(u);this.duration=e}return e},j.prototype.ensureLabelInterval=function(){var e,r,s,o,n,i,l,u,h;if(n=this.labelInterval,!n){if(this.duration||this.slotDuration||this.ensureGridDuration(),this.slotDuration){for(r=0,i=O.length;r<i;r++)if(e=O[r],h=t.duration(e),u=ce(h,this.slotDuration),He(u)&&u<=w){n=h;break}n||(n=this.slotDuration)}else for(s=0,l=O.length;s<l&&(e=O[s],n=t.duration(e),o=ce(this.duration,n),!(o>=S));s++);this.labelInterval=n}return n},j.prototype.ensureSlotDuration=function(){var e,r,s,o,n,i,l,u;if(i=this.slotDuration,!i){for(s=this.ensureLabelInterval(),r=0,o=O.length;r<o;r++)if(e=O[r],u=t.duration(e),l=ce(s,u),He(l)&&l>1&&l<=w){i=u;break}i&&this.duration&&(n=ce(this.duration,i),n>R&&(i=null)),i||(i=s),this.slotDuration=i}return i},j.prototype.computeHeaderFormats=function(){var e,t,r,s,o,n,i,l;switch(i=this.view,s=this.duration,o=this.labelInterval,n=re(o),l=this.opt("weekNumbers"),e=t=r=null,"week"!==n||l||(n="day"),n){case"year":e="YYYY";break;case"month":s.asYears()>1&&(e="YYYY"),t="MMM";break;case"week":s.asYears()>1&&(e="YYYY"),t=this.opt("shortWeekFormat");break;case"day":s.asYears()>1?e=this.opt("monthYearFormat"):s.asMonths()>1&&(e="MMMM"),l&&(t=this.opt("weekFormat")),r="dd D";break;case"hour":l&&(e=this.opt("weekFormat")),s.asDays()>1&&(t=this.opt("dayOfMonthFormat")),r=this.opt("smallTimeFormat");break;case"minute":o.asMinutes()/60>=w?(e=this.opt("hourFormat"),t="[:]mm"):e=this.opt("mediumTimeFormat");break;case"second":o.asSeconds()/60>=w?(e="LT",t="[:]ss"):e="LTS";break;case"millisecond":e="LTS",t="[.]SSS"}return[].concat(e||[],t||[],r||[])},d.views.timeline={"class":Y,defaults:{eventResizableFromStart:!0}},d.views.timelineDay={type:"timeline",duration:{days:1}},d.views.timelineWeek={type:"timeline",duration:{weeks:1}},d.views.timelineMonth={type:"timeline",duration:{months:1}},d.views.timelineYear={type:"timeline",duration:{years:1}},M=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ye(r,t),r.mixin(L),r.prototype.canRenderSpecificResources=!0,r.prototype.resourceGrid=null,r.prototype.tbody return this.rowspan+=1,this.renderRowspan(),r.__super__.rowShown.apply(this,arguments)},r.prototype.rowHidden=function(e){return this.rowspan-=1,this.renderRowspan(),r.__super__.rowHidden.apply(this,arguments)},r.prototype.renderRowspan=function(){var t;return this.rowspan?(this.groupTd||(this.groupTd=e('<td class="'+this.view.widgetContentClass+'"/>').append(this.renderGroupContentEl())),this.groupTd.attr("rowspan",this.rowspan),t=this.getLeadingRow().getTr("spreadsheet"),t!==this.leadingTr?(t&&t.prepend(this.groupTd),this.leadingTr=t):void 0):(this.groupTd&&(this.groupTd.remove(),this.groupTd=null),this.leadingTr=null)},r}(z),p=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Ye(t,e),t.prototype.hasOwnRow=!0,t.prototype.segContainerEl=null,t.prototype.segContainerHeight=null,t.prototype.innerEl=null,t.prototype.bgSegContainerEl=null,t.prototype.isSegsRendered=!1,t.prototype.isBusinessHourSegsRendered=!1,t.prototype.businessHourSegs=null,t.prototype.bgSegs=null,t.prototype.fgSegs=null,t.prototype.renderEventContent=function(e){return e.html('<td class="'+this.view.widgetContentClass+'"> <div> <div class="fc-event-container" /> </div> </td>'),this.segContainerEl=e.find(".fc-event-container"),this.innerEl=this.bgSegContainerEl=e.find("td > div"),this.ensureSegsRendered()},t.prototype.ensureSegsRendered=function(){if(!this.isSegsRendered)return this.ensureBusinessHourSegsRendered(),this.bgSegs&&this.view.timeGrid.renderFillInContainer("bgEvent",this,this.bgSegs),this.fgSegs&&this.view.timeGrid.renderFgSegsInContainers([[this,this.fgSegs]]),this.isSegsRendered=!0},t.prototype.ensureBusinessHourSegsRendered=function(){if(this.businessHourSegs&&!this.isBusinessHourSegsRendered)return this.view.timeGrid.renderFillInContainer("businessHours",this,this.businessHourSegs,"bgevent"),this.isBusinessHourSegsRendered=!0},t.prototype.unrenderEventContent=function(){return this.clearBusinessHourSegs(),this.bgSegs=null,this.fgSegs=null,this.isSegsRendered=!1},t.prototype.clearBusinessHourSegs=function(){var e,t,r,s;if(this.businessHourSegs){for(r=this.businessHourSegs,e=0,t=r.length;e<t;e++)s=r[e],s.el&&s.el.remove();this.businessHourSegs=null}return this.isBusinessHourSegsRendered=!1},t}(k),B=function(t){function r(e,t){this.resource=t,r.__super__.constructor.apply(this,arguments)}return Ye(r,t),r.prototype.resource=null,r.prototype.rowAdded=function(e){if(r.__super__.rowAdded.apply(this,arguments),e!==this&&this.isRendered&&1===this.children.length)return this.enableExpanding(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed()},r.prototype.rowRemoved=function(e){if(r.__super__.rowRemoved.apply(this,arguments),e!==this&&this.isRendered&&!this.children.length)return this.disableExpanding()},r.prototype.render=function(){return r.__super__.render.apply(this,arguments),this.children.length>0?this.enableExpanding():this.disableExpanding(),this.view.publiclyTrigger("resourceRender",this.resource,this.resource,this.getTr("spreadsheet").find("> td"),this.getTr("event").find("> td"))},r.prototype.renderEventContent=function(e){return r.__super__.renderEventContent.apply(this,arguments),e.attr("data-resource-id",this.resource.id)},r.prototype.renderSpreadsheetContent=function(t){var r,s,o,n,i,l,u,h,c;for(u=this.resource,l=this.view.colSpecs,n=0,i=l.length;n<i;n++)r=l[n],r.group||(o=r.field?u[r.field]||null:u,c="function"==typeof r.text?r.text(u,o):o,s=e('<div class="fc-cell-content">'+(r.isMain?this.renderGutterHtml():"")+'<span class="fc-cell-text">'+(c?Se(c):" ")+"</span></div>"),"function"==typeof r.render&&(s=r.render(u,s,o)||s),h=e('<td class="'+this.view.widgetContentClass+'"/>').append(s),r.isMain&&h.wrapInner("<div/>"),t.append(h));return t.attr("data-resource-id",u.id)},r.prototype.renderGutterHtml=function(){var e,t,r,s;for(e="",t=r=0,s=this.depth;r<s;t=r+=1)e+='<span class="fc-icon"/>';return e+='<span class="fc-expander-space"><span class="fc-icon"></span></span>'},r}(p),d.views.timeline.resourceClass=M,H=function(e){function t(){return t.__super__.constructor.apply(this,argume
|