diff --git a/bower.json b/bower.json index d9d8a3cef..aa9317a78 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "fullcalendar-scheduler", "title": "FullCalendar Scheduler", - "version": "0.0.0", + "version": "1.3.0-beta", "description": "A premium add-on to FullCalendar for displaying events and resources", "homepage": "http://fullcalendar.io/scheduler/", "repository": { diff --git a/dist/scheduler.css b/dist/scheduler.css new file mode 100644 index 000000000..911c69d76 --- /dev/null +++ b/dist/scheduler.css @@ -0,0 +1,509 @@ +/*! + * FullCalendar Scheduler v1.3.0-beta + * Docs & License: http://fullcalendar.io/scheduler/ + * (c) 2015 Adam Shaw + */ + +/* TODO: break this file up */ + +/* Scroller +--------------------------------------------------------------------------------------------------*/ + +.fc-scroller-clip { + overflow: hidden; /* for clipping scrollbars */ + position: relative; /* so things like scrollfollowers can attach to this */ +} + +/* supresses rendering of native scrollbars */ +/* on .fc-scroller */ +.fc-no-scrollbars { + background: rgba(255, 255, 255, 0); /* hack for dynamic DOM nodes (in Chrome OSX at least) */ +} +.fc-no-scrollbars::-webkit-scrollbar { + width: 0; + height: 0; +} + +.fc-scroller-canvas { + position: relative; /* origin for bg */ + box-sizing: border-box; /* so that padding (for gutter) will be part of height */ + min-height: 100%; +} + +.fc-scroller-canvas > .fc-bg { + z-index: 1; /* make default? */ +} + +.fc-scroller-canvas > .fc-content { + z-index: 2; /* make default? */ + position: relative; /* origin for inner content */ + border-style: solid; + border-width: 0; +} + +/* for themed, hard to get the border-color, so just forget it (REVISIT) */ +.ui-widget .fc-scroller-canvas > .fc-content { + border-color: transparent; +} + +.fc-scroller-canvas.fc-gutter-left > .fc-content { border-left-width: 1px; margin-left: -1px } +.fc-scroller-canvas.fc-gutter-right > .fc-content { border-right-width: 1px; margin-right: -1px } +.fc-scroller-canvas.fc-gutter-top > .fc-content { border-top-width: 1px; margin-top: -1px } +.fc-scroller-canvas.fc-gutter-bottom > .fc-content { border-bottom-width: 1px; margin-bottom: -1px } + + +/* View Structure +--------------------------------------------------------------------------------------------------*/ + +.fc-rtl .fc-timeline { + direction: rtl; +} + +.fc-timeline .fc-divider { + width: 3px; + border-style: double; /* overcome neighboring borders */ +} + +.fc-timeline .fc-head > tr > .fc-divider { + border-bottom: 0; +} + +.fc-timeline .fc-body > tr > .fc-divider { + border-top: 0; +} + +.fc-timeline .fc-body .fc-divider.ui-widget-header { + background-image: none; +} + +.fc-scrolled .fc-head .fc-scroller { + z-index: 2; /* so drop shadow will go above body panes */ +} + +.fc-timeline.fc-scrolled .fc-head .fc-scroller { + box-shadow: 0 3px 4px rgba(0,0,0,0.075); +} + +.fc-timeline .fc-body .fc-scroller { + z-index: 1; +} + +/* +on all tables that expand to the edges, kill the outer border, +because the container elements take care of it +*/ +.fc-timeline .fc-scroller-canvas > div > table, +.fc-timeline .fc-scroller-canvas > div > div > table { + border-style: hidden; +} + + +/* Table Cell Common +--------------------------------------------------------------------------------------------------*/ + +.fc-timeline th, +.fc-timeline td { + white-space: nowrap; +} + +.fc-timeline .fc-cell-content { + overflow: hidden; +} + +.fc-timeline .fc-cell-text { + padding-left: 4px; + padding-right: 4px; +} + +.fc-timeline .fc-col-resizer { + cursor: col-resize; +} + +/* +Cells at the start of a week +TODO: figure out better styling + +.fc-ltr .fc-timeline .fc-em-cell div { + border-left: 3px solid #eee; + height: 100%; +} +.fc-rtl .fc-timeline .fc-em-cell { + border-right-width: 3px; +} +*/ + +/* head */ + +.fc-timeline th { + vertical-align: middle; +} + +.fc-timeline .fc-head .fc-cell-content { + padding-top: 3px; + padding-bottom: 3px; +} + +/* body */ + +.fc-timeline .fc-body .ui-widget-content { + background-image: none; +} + + +/* Resource Area +--------------------------------------------------------------------------------------------------*/ + +.fc-resource-area { + width: 30%; +} + +.fc-resource-area col { + width: 40%; + min-width: 70px; /* will be read by JS */ +} + +.fc-resource-area col.fc-main-col { + width: 60%; /* make the first column in a nested setup bigger */ +} + + +.fc-flat .fc-expander-space { /* fc-flat is opposite of fc-nested */ + display: none; +} + + +.fc-ltr .fc-resource-area tr > * { + text-align: left; +} +.fc-rtl .fc-resource-area tr > * { + text-align: right; +} + +.fc-resource-area .fc-cell-content { + padding-left: 4px; + padding-right: 4px; +} + +/* head */ + +.fc-resource-area .fc-super th { + text-align: center; +} + +.fc-resource-area th > div { + position: relative; +} + +.fc-resource-area th .fc-cell-content { + position: relative; + z-index: 1; +} + +.fc-resource-area th .fc-col-resizer { + position: absolute; + z-index: 2; + top: 0; + bottom: 0; + width: 5px; +} + +.fc-ltr .fc-resource-area th .fc-col-resizer { + right: -3px; +} +.fc-rtl .fc-resource-area th .fc-col-resizer { + left: -3px; +} + +/* body */ + +tr.fc-collapsed > td, /* before the transition (prevents initial flicker) */ +tr.fc-transitioning > td { /* during the transition */ + overflow: hidden; /* prevents absolutely-positioned events from bleeding out */ +} + +tr.fc-transitioning > td > div { + transition: margin-top 0.2s; +} + +tr.fc-collapsed > td > div { + margin-top: -10px; +} + + +.fc-body .fc-resource-area .fc-cell-content { /* might BE the cell */ + padding-top: 8px; + padding-bottom: 8px; +} + +.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content { /* might BE the cell */ + padding-top: 5px; + padding-bottom: 5px; +} + +.fc-resource-area .fc-icon { /* the expander and spacers before the expander */ + font-size: .9em; + vertical-align: middle; + margin-top: -2%; +} + +.fc-resource-area .fc-expander { + cursor: pointer; + color: #666; /* for the icon within */ +} + + +/* Time Area +--------------------------------------------------------------------------------------------------*/ + +.fc-time-area col { + min-width: 2.2em; /* detected by JS */ +} + +/* head */ + +.fc-ltr .fc-time-area .fc-chrono th { + text-align: left; +} +.fc-rtl .fc-time-area .fc-chrono th { + text-align: right; +} + +/* body slats (vertical lines) */ + +.fc-time-area .fc-slats { /* fc-bg is responsible for a lot of this now! */ + position: absolute; + z-index: 1; + top: 0; + left: 0; + right: 0; + bottom: 0; +} + +.fc-time-area .fc-slats table { + height: 100%; +} + +.fc-time-area .fc-slats .fc-minor { + border-style: dotted; +} + +.fc-time-area .fc-slats td { + border-width: 0 1px; /* need to do this. sometimes -1 margin wouldn't hide the dotted */ +} + +.fc-ltr .fc-time-area .fc-slats td { + border-right-width: 0; +} +.fc-rtl .fc-time-area .fc-slats td { + border-left-width: 0; +} + +/* body content containers + can be within rows or directly within the pane's content +*/ + +.fc-time-area .fc-bgevent-container, +.fc-time-area .fc-highlight-container { + position: absolute; + z-index: 2; /* only for directly within pane. not for row. overridden later */ + top: 0; + bottom: 0; + width: 0; +} + +.fc-ltr .fc-time-area .fc-helper-container, /* only within row */ +.fc-ltr .fc-time-area .fc-bgevent-container, +.fc-ltr .fc-time-area .fc-highlight-container { + left: 0; +} +.fc-rtl .fc-time-area .fc-helper-container, /* only within row */ +.fc-rtl .fc-time-area .fc-bgevent-container, +.fc-rtl .fc-time-area .fc-highlight-container { + right: 0; +} + +.fc-time-area .fc-bgevent, +.fc-time-area .fc-highlight { + position: absolute; + top: 0; + bottom: 0; +} + +/* body resource rows */ + +.fc-time-area .fc-rows { + position: relative; + z-index: 3; +} + +.fc-time-area .fc-rows .ui-widget-content { + background: none; +} + +.fc-time-area .fc-rows td > div { + position: relative; +} + +.fc-time-area .fc-rows .fc-bgevent-container, +.fc-time-area .fc-rows .fc-highlight-container { + z-index: 1; +} + +.fc-time-area .fc-event-container { + position: relative; + z-index: 2; /* above bgevent and highlight */ + width: 0; /* for event positioning. will end up on correct side based on dir */ +} + +.fc-time-area .fc-helper-container { /* also an fc-event-container */ + position: absolute; + z-index: 3; + top: 0; +} + +.fc-time-area .fc-event-container { + padding-bottom: 8px; + top: -1px; +} + +.fc-time-area tr:first-child .fc-event-container { + top: 0; +} + +.fc-no-overlap .fc-time-area .fc-event-container { + padding-bottom: 0; + top: 0; +} + + +/* Now Indicator +--------------------------------------------------------------------------------------------------*/ + +.fc-timeline .fc-now-indicator { /* both the arrow and the line */ + z-index: 3; /* one above scroller's fc-content */ + top: 0; +} + +.fc-time-area .fc-now-indicator-arrow { + margin: 0 -6px; /* 5, then one more to counteract scroller's negative margins */ + /* triangle pointing down... */ + border-width: 6px 5px 0 5px; + border-left-color: transparent; + border-right-color: transparent; +} + +.fc-time-area .fc-now-indicator-line { + margin: 0 -1px; /* counteract scroller's negative margins */ + bottom: 0; + border-left-width: 1px; +} + + +/* Time Grid Events +--------------------------------------------------------------------------------------------------*/ + +.fc-timeline-event { + position: absolute; + border-radius: 0; + padding: 2px 0; + margin-bottom: 1px; +} + +.fc-no-overlap .fc-timeline-event { + padding: 5px 0; + margin-bottom: 0; +} + +/* don't overlap grid lines at the event's end */ +.fc-ltr .fc-timeline-event { margin-right: 1px } +.fc-rtl .fc-timeline-event { margin-left: 1px } + +.fc-timeline-event .fc-content { + padding: 0 1px; + white-space: nowrap; + overflow: hidden; +} + +.fc-timeline-event .fc-time { + font-weight: bold; + padding: 0 1px; +} + +.fc-rtl .fc-timeline-event .fc-time { + display: inline-block; /* will force it on the other side */ +} + +.fc-timeline-event .fc-title { + padding: 0 1px; +} + +.fc-timeline-event.fc-selected .fc-bg { + display: none; /* hide semi-white background, to appear darker */ +} + + +/* follower logic */ + + +.fc-ltr .fc-timeline-event .fc-title { + padding-left: 10px; + margin-left: -8px; +} +.fc-rtl .fc-timeline-event .fc-title { + padding-right: 10px; + margin-right: -8px; +} + +.fc-ltr .fc-timeline-event.fc-not-start .fc-title { + margin-left: -2px; +} +.fc-rtl .fc-timeline-event.fc-not-start .fc-title { + margin-right: -2px; +} + +.fc-timeline-event.fc-not-start .fc-title, +.fc-body .fc-time-area .fc-following { + position: relative; +} + +.fc-timeline-event.fc-not-start .fc-title:before, +.fc-body .fc-time-area .fc-following:before { /* generic arrow */ + content: ""; + position: absolute; + top: 50%; + margin-top: -5px; + border: 5px solid #000; + border-top-color: transparent; + border-bottom-color: transparent; + opacity: .5; +} + +.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before, +.fc-ltr .fc-body .fc-time-area .fc-following:before { /* LTR. left pointing arrow */ + border-left: 0; + left: 2px; +} + +.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before, +.fc-rtl .fc-body .fc-time-area .fc-following:before { /* RTL. right pointing arrow */ + border-right: 0; + right: 2px; +} + + +/* License Message +--------------------------------------------------------------------------------------------------*/ + +.fc-license-message { + position: absolute; + z-index: 99999; + bottom: 1px; + left: 1px; + background: #eee; + border-color: #ddd; + border-style: solid; + border-width: 1px 1px 0 0; + padding: 2px 4px; + font-size: 12px; + border-top-right-radius: 3px; +} diff --git a/dist/scheduler.js b/dist/scheduler.js new file mode 100644 index 000000000..f30b0fc7e --- /dev/null +++ b/dist/scheduler.js @@ -0,0 +1,5857 @@ + +/*! +FullCalendar Scheduler v1.3.0-beta +Docs & License: http://fullcalendar.io/scheduler/ +(c) 2015 Adam Shaw + */ +(function(factory) { + if (typeof define === 'function' && define.amd) { + define([ 'jquery', 'moment' ], factory); + } + else { + factory(jQuery, moment); + } +})(function($, moment) {; +var COL_MIN_WIDTH, Calendar, CalendarExtension, Class, ClippedScroller, CoordCache, DEFAULT_GRID_DURATION, DragListener, EmitterMixin, EnhancedScroller, EventRow, FC, Grid, HRowGroup, LICENSE_INFO_URL, ListenerMixin, MAX_AUTO_CELLS, MAX_AUTO_SLOTS_PER_LABEL, MAX_CELLS, MIN_AUTO_LABELS, PRESET_LICENSE_KEYS, RELEASE_DATE, ResourceAgendaView, ResourceBasicView, ResourceDayGrid, ResourceDayTableMixin, ResourceGridMixin, ResourceManager, ResourceMonthView, ResourceRow, ResourceTimeGrid, ResourceTimelineGrid, ResourceTimelineView, ResourceViewMixin, RowGroup, RowParent, STOCK_SUB_DURATIONS, ScrollFollower, ScrollFollowerSprite, ScrollJoiner, ScrollerCanvas, Spreadsheet, TimelineGrid, TimelineView, UPGRADE_WINDOW, VRowGroup, View, applyAll, capitaliseFirstLetter, compareByFieldSpecs, computeIntervalUnit, computeOffsetForSeg, computeOffsetForSegs, copyRect, cssToStr, debounce, detectWarningInContainer, divideDurationByDuration, divideRangeByDuration, durationHasTime, flexibleCompare, getContentRect, getOuterRect, getOwnCells, getRectHeight, getRectWidth, getScrollbarWidths, hContainRect, htmlEscape, intersectRanges, intersectRects, isImmuneUrl, isInt, isValidKey, joinRects, multiplyDuration, origDisplayEvents, origDisplayView, origGetSegClasses, origRenderSkeleton, origUnrenderSkeleton, parseFieldSpecs, processLicenseKey, proxy, renderingWarningInContainer, testRectContains, testRectHContains, testRectVContains, timeRowSegsCollide, vContainRect, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty, + slice = [].slice; + +FC = $.fullCalendar; + +FC.schedulerVersion = "1.3.0-beta"; + +if (FC.internalApiVersion !== 3) { + FC.warn('v' + FC.schedulerVersion + ' of FullCalendar Scheduler ' + 'is incompatible with v' + FC.version + ' of the core.\n' + 'Please see http://fullcalendar.io/support/ for more information.'); + return; +} + +Calendar = FC.Calendar; + +Class = FC.Class; + +View = FC.View; + +Grid = FC.Grid; + +intersectRanges = FC.intersectRanges; + +debounce = FC.debounce; + +isInt = FC.isInt; + +getScrollbarWidths = FC.getScrollbarWidths; + +DragListener = FC.DragListener; + +htmlEscape = FC.htmlEscape; + +computeIntervalUnit = FC.computeIntervalUnit; + +proxy = FC.proxy; + +capitaliseFirstLetter = FC.capitaliseFirstLetter; + +applyAll = FC.applyAll; + +EmitterMixin = FC.EmitterMixin; + +ListenerMixin = FC.ListenerMixin; + +durationHasTime = FC.durationHasTime; + +divideRangeByDuration = FC.divideRangeByDuration; + +divideDurationByDuration = FC.divideDurationByDuration; + +multiplyDuration = FC.multiplyDuration; + +parseFieldSpecs = FC.parseFieldSpecs; + +compareByFieldSpecs = FC.compareByFieldSpecs; + +flexibleCompare = FC.flexibleCompare; + +intersectRects = FC.intersectRects; + +CoordCache = FC.CoordCache; + +getContentRect = FC.getContentRect; + +getOuterRect = FC.getOuterRect; + + +/* +Given a jQuery set, returns the 's that do not have multi-line rowspans. +Would use the [rowspan] selector, but never not defined in IE8. + */ + +getOwnCells = function(trs) { + return trs.find('> td').filter(function(i, tdNode) { + return tdNode.rowSpan <= 1; + }); +}; + + +/* +A Scroller with additional functionality: +- optional ScrollerCanvas for content +- fired events for scroll start/end +- cross-browser normalization of horizontal scroll for RTL + */ + +EnhancedScroller = (function(superClass) { + var detectRtlScrollSystem, rtlScrollSystem; + + extend(EnhancedScroller, superClass); + + EnhancedScroller.mixin(EmitterMixin); + + EnhancedScroller.mixin(ListenerMixin); + + EnhancedScroller.prototype.canvas = null; + + EnhancedScroller.prototype.isScrolling = false; + + EnhancedScroller.prototype.isTouching = false; + + EnhancedScroller.prototype.isMoving = false; + + EnhancedScroller.prototype.isTouchScrollEnabled = true; + + EnhancedScroller.prototype.preventTouchScrollHandler = null; + + function EnhancedScroller() { + EnhancedScroller.__super__.constructor.apply(this, arguments); + this.requestMovingEnd = debounce(this.reportMovingEnd, 500); + } + + EnhancedScroller.prototype.render = function() { + EnhancedScroller.__super__.render.apply(this, arguments); + if (this.canvas) { + this.canvas.render(); + this.canvas.el.appendTo(this.scrollEl); + } + return this.bindHandlers(); + }; + + EnhancedScroller.prototype.destroy = function() { + EnhancedScroller.__super__.destroy.apply(this, arguments); + return this.unbindHandlers(); + }; + + EnhancedScroller.prototype.disableTouchScroll = function() { + this.isTouchScrollEnabled = false; + return this.bindPreventTouchScroll(); + }; + + EnhancedScroller.prototype.enableTouchScroll = function() { + this.isTouchScrollEnabled = true; + if (!this.isTouching) { + return this.unbindPreventTouchScroll(); + } + }; + + EnhancedScroller.prototype.bindPreventTouchScroll = function() { + if (!this.preventTouchScrollHandler) { + return this.scrollEl.on('touchmove', this.preventTouchScrollHandler = FC.preventDefault); + } + }; + + EnhancedScroller.prototype.unbindPreventTouchScroll = function() { + if (this.preventTouchScrollHandler) { + this.scrollEl.off('touchmove', this.preventTouchScrollHandler); + return this.preventTouchScrollHandler = null; + } + }; + + EnhancedScroller.prototype.bindHandlers = function() { + return this.listenTo(this.scrollEl, { + scroll: this.reportScroll, + touchstart: this.reportTouchStart, + touchend: this.reportTouchEnd + }); + }; + + EnhancedScroller.prototype.unbindHandlers = function() { + return this.stopListeningTo(this.scrollEl); + }; + + EnhancedScroller.prototype.reportScroll = function() { + if (!this.isScrolling) { + this.reportScrollStart(); + } + this.trigger('scroll'); + this.isMoving = true; + return this.requestMovingEnd(); + }; + + EnhancedScroller.prototype.reportScrollStart = function() { + if (!this.isScrolling) { + this.isScrolling = true; + return this.trigger('scrollStart', this.isTouching); + } + }; + + EnhancedScroller.prototype.requestMovingEnd = null; + + EnhancedScroller.prototype.reportMovingEnd = function() { + this.isMoving = false; + if (!this.isTouching) { + return this.reportScrollEnd(); + } + }; + + EnhancedScroller.prototype.reportScrollEnd = function() { + if (this.isScrolling) { + this.trigger('scrollEnd'); + return this.isScrolling = false; + } + }; + + EnhancedScroller.prototype.reportTouchStart = function() { + return this.isTouching = true; + }; + + EnhancedScroller.prototype.reportTouchEnd = function() { + if (this.isTouching) { + this.isTouching = false; + if (this.isTouchScrollEnabled) { + this.unbindPreventTouchScroll(); + } + if (!this.isMoving) { + return this.reportScrollEnd(); + } + } + }; + + + /* + If RTL, and scrolled to the left, returns NEGATIVE value (like Firefox) + */ + + EnhancedScroller.prototype.getScrollLeft = function() { + var direction, node, val; + direction = this.scrollEl.css('direction'); + node = this.scrollEl[0]; + val = node.scrollLeft; + if (direction === 'rtl') { + switch (rtlScrollSystem) { + case 'positive': + val = val + node.clientWidth - node.scrollWidth; + break; + case 'reverse': + val = -val; + } + } + return val; + }; + + + /* + Accepts a NEGATIVE value for when scrolled in RTL + */ + + EnhancedScroller.prototype.setScrollLeft = function(val) { + var direction, node; + direction = this.scrollEl.css('direction'); + node = this.scrollEl[0]; + if (direction === 'rtl') { + switch (rtlScrollSystem) { + case 'positive': + val = val - node.clientWidth + node.scrollWidth; + break; + case 'reverse': + val = -val; + } + } + return node.scrollLeft = val; + }; + + + /* + Always returns the number of pixels scrolled from the leftmost position (even if RTL). + Always positive. + */ + + EnhancedScroller.prototype.getScrollFromLeft = function() { + var direction, node, val; + direction = this.scrollEl.css('direction'); + node = this.scrollEl[0]; + val = node.scrollLeft; + if (direction === 'rtl') { + switch (rtlScrollSystem) { + case 'negative': + val = val - node.clientWidth + node.scrollWidth; + break; + case 'reverse': + val = -val - node.clientWidth + node.scrollWidth; + } + } + return val; + }; + + EnhancedScroller.prototype.getNativeScrollLeft = function() { + return this.scrollEl[0].scrollLeft; + }; + + EnhancedScroller.prototype.setNativeScrollLeft = function(val) { + return this.scrollEl[0].scrollLeft = val; + }; + + rtlScrollSystem = null; + + detectRtlScrollSystem = function() { + var el, node, system; + el = $('
A
').appendTo('body'); + node = el[0]; + system = node.scrollLeft > 0 ? 'positive' : (node.scrollLeft = 1, el.scrollLeft > 0 ? 'reverse' : 'negative'); + el.remove(); + return system; + }; + + $(function() { + return rtlScrollSystem = detectRtlScrollSystem(); + }); + + return EnhancedScroller; + +})(FC.Scroller); + + +/* +A Scroller, but with a wrapping div that allows "clipping" away of native scrollbars, +giving the appearance that there are no scrollbars. + */ + +ClippedScroller = (function(superClass) { + extend(ClippedScroller, superClass); + + ClippedScroller.prototype.isHScrollbarsClipped = false; + + ClippedScroller.prototype.isVScrollbarsClipped = false; + + + /* + Received overflows can be set to 'clipped', meaning scrollbars shouldn't be visible + to the user, but the area should still scroll. + */ + + function ClippedScroller() { + ClippedScroller.__super__.constructor.apply(this, arguments); + if (this.overflowX === 'clipped-scroll') { + this.overflowX = 'scroll'; + this.isHScrollbarsClipped = true; + } + if (this.overflowY === 'clipped-scroll') { + this.overflowY = 'scroll'; + this.isVScrollbarsClipped = true; + } + } + + ClippedScroller.prototype.renderEl = function() { + var scrollEl; + scrollEl = ClippedScroller.__super__.renderEl.apply(this, arguments); + return $('
').append(scrollEl); + }; + + ClippedScroller.prototype.updateSize = function() { + var cssProps, scrollEl, scrollbarWidths; + scrollEl = this.scrollEl; + scrollbarWidths = getScrollbarWidths(scrollEl); + cssProps = { + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0 + }; + if (this.isHScrollbarsClipped) { + cssProps.marginTop = -scrollbarWidths.top; + cssProps.marginBottom = -scrollbarWidths.bottom; + } + if (this.isVScrollbarsClipped) { + cssProps.marginLeft = -scrollbarWidths.left; + cssProps.marginRight = -scrollbarWidths.right; + } + scrollEl.css(cssProps); + return scrollEl.toggleClass('fc-no-scrollbars', (this.isHScrollbarsClipped || this.overflowX === 'hidden') && (this.isVScrollbarsClipped || this.overflowY === 'hidden') && !(scrollbarWidths.top || scrollbarWidths.bottom || scrollbarWidths.left || scrollbarWidths.right)); + }; + + + /* + Accounts for 'clipped' scrollbars + */ + + ClippedScroller.prototype.getScrollbarWidths = function() { + var widths; + widths = getScrollbarWidths(this.scrollEl); + if (this.isHScrollbarsClipped) { + widths.top = 0; + widths.bottom = 0; + } + if (this.isVScrollbarsClipped) { + widths.left = 0; + widths.right = 0; + } + return widths; + }; + + return ClippedScroller; + +})(EnhancedScroller); + + +/* +A rectangular area of content that lives within a Scroller. +Can have "gutters", areas of dead spacing around the perimeter. +Also very useful for forcing a width, which a Scroller cannot do alone. +Has a content area that lives above a background area. + */ + +ScrollerCanvas = (function() { + ScrollerCanvas.prototype.el = null; + + ScrollerCanvas.prototype.contentEl = null; + + ScrollerCanvas.prototype.bgEl = null; + + ScrollerCanvas.prototype.gutters = null; + + ScrollerCanvas.prototype.width = null; + + ScrollerCanvas.prototype.minWidth = null; + + function ScrollerCanvas() { + this.gutters = {}; + } + + ScrollerCanvas.prototype.render = function() { + this.el = $('
'); + this.contentEl = this.el.find('.fc-content'); + return this.bgEl = this.el.find('.fc-bg'); + }; + + + /* + If falsy, resets all the gutters to 0 + */ + + ScrollerCanvas.prototype.setGutters = function(gutters) { + if (!gutters) { + this.gutters = {}; + } else { + $.extend(this.gutters, gutters); + } + return this.updateSize(); + }; + + ScrollerCanvas.prototype.setWidth = function(width1) { + this.width = width1; + return this.updateSize(); + }; + + ScrollerCanvas.prototype.setMinWidth = function(minWidth1) { + this.minWidth = minWidth1; + return this.updateSize(); + }; + + ScrollerCanvas.prototype.clearWidth = function() { + this.width = null; + this.minWidth = null; + return this.updateSize(); + }; + + ScrollerCanvas.prototype.updateSize = function() { + var gutters; + gutters = this.gutters; + this.el.toggleClass('fc-gutter-left', Boolean(gutters.left)).toggleClass('fc-gutter-right', Boolean(gutters.right)).toggleClass('fc-gutter-top', Boolean(gutters.top)).toggleClass('fc-gutter-bottom', Boolean(gutters.bottom)).css({ + paddingLeft: gutters.left || '', + paddingRight: gutters.right || '', + paddingTop: gutters.top || '', + paddingBottom: gutters.bottom || '', + width: this.width != null ? this.width + (gutters.left || 0) + (gutters.right || 0) : '', + minWidth: this.minWidth != null ? this.minWidth + (gutters.left || 0) + (gutters.right || 0) : '' + }); + return this.bgEl.css({ + left: gutters.left || '', + right: gutters.right || '', + top: gutters.top || '', + bottom: gutters.bottom || '' + }); + }; + + return ScrollerCanvas; + +})(); + +ScrollJoiner = (function() { + ScrollJoiner.prototype.axis = null; + + ScrollJoiner.prototype.scrollers = null; + + ScrollJoiner.prototype.masterScroller = null; + + function ScrollJoiner(axis, scrollers) { + var j, len, ref, scroller; + this.axis = axis; + this.scrollers = scrollers; + ref = this.scrollers; + for (j = 0, len = ref.length; j < len; j++) { + scroller = ref[j]; + this.initScroller(scroller); + } + return; + } + + ScrollJoiner.prototype.initScroller = function(scroller) { + scroller.scrollEl.on('wheel mousewheel DomMouseScroll MozMousePixelScroll', (function(_this) { + return function() { + _this.assignMasterScroller(scroller); + }; + })(this)); + return scroller.on('scrollStart', (function(_this) { + return function() { + if (!_this.masterScroller) { + return _this.assignMasterScroller(scroller); + } + }; + })(this)).on('scroll', (function(_this) { + return function() { + var j, len, otherScroller, ref, results; + if (scroller === _this.masterScroller) { + ref = _this.scrollers; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + otherScroller = ref[j]; + if (otherScroller !== scroller) { + switch (_this.axis) { + case 'horizontal': + results.push(otherScroller.setNativeScrollLeft(scroller.getNativeScrollLeft())); + break; + case 'vertical': + results.push(otherScroller.setScrollTop(scroller.getScrollTop())); + break; + default: + results.push(void 0); + } + } else { + results.push(void 0); + } + } + return results; + } + }; + })(this)).on('scrollEnd', (function(_this) { + return function() { + if (scroller === _this.masterScroller) { + return _this.unassignMasterScroller(); + } + }; + })(this)); + }; + + ScrollJoiner.prototype.assignMasterScroller = function(scroller) { + var j, len, otherScroller, ref; + this.unassignMasterScroller(); + this.masterScroller = scroller; + ref = this.scrollers; + for (j = 0, len = ref.length; j < len; j++) { + otherScroller = ref[j]; + if (otherScroller !== scroller) { + otherScroller.disableTouchScroll(); + } + } + }; + + ScrollJoiner.prototype.unassignMasterScroller = function() { + var j, len, otherScroller, ref; + if (this.masterScroller) { + ref = this.scrollers; + for (j = 0, len = ref.length; j < len; j++) { + otherScroller = ref[j]; + otherScroller.enableTouchScroll(); + } + this.masterScroller = null; + } + }; + + ScrollJoiner.prototype.update = function() { + var allWidths, i, j, k, len, len1, maxBottom, maxLeft, maxRight, maxTop, ref, scroller, widths; + allWidths = (function() { + var j, len, ref, results; + ref = this.scrollers; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + scroller = ref[j]; + results.push(scroller.getScrollbarWidths()); + } + return results; + }).call(this); + maxLeft = maxRight = maxTop = maxBottom = 0; + for (j = 0, len = allWidths.length; j < len; j++) { + widths = allWidths[j]; + maxLeft = Math.max(maxLeft, widths.left); + maxRight = Math.max(maxRight, widths.right); + maxTop = Math.max(maxTop, widths.top); + maxBottom = Math.max(maxBottom, widths.bottom); + } + ref = this.scrollers; + for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { + scroller = ref[i]; + widths = allWidths[i]; + scroller.canvas.setGutters(this.axis === 'horizontal' ? { + left: maxLeft - widths.left, + right: maxRight - widths.right + } : { + top: maxTop - widths.top, + bottom: maxBottom - widths.bottom + }); + } + }; + + return ScrollJoiner; + +})(); + +ScrollFollower = (function() { + ScrollFollower.prototype.scroller = null; + + ScrollFollower.prototype.scrollbarWidths = null; + + ScrollFollower.prototype.sprites = null; + + ScrollFollower.prototype.viewportRect = null; + + ScrollFollower.prototype.contentOffset = null; + + ScrollFollower.prototype.isHFollowing = true; + + ScrollFollower.prototype.isVFollowing = false; + + ScrollFollower.prototype.containOnNaturalLeft = false; + + ScrollFollower.prototype.containOnNaturalRight = false; + + ScrollFollower.prototype.minTravel = 0; + + ScrollFollower.prototype.isForcedRelative = false; + + function ScrollFollower(scroller) { + this.scroller = scroller; + this.sprites = []; + if (FC.isTouchEnabled) { + this.isForcedRelative = true; + } + scroller.on((FC.isTouchEnabled ? 'scrollEnd' : 'scroll'), (function(_this) { + return function() { + return _this.handleScroll(); + }; + })(this)); + } + + ScrollFollower.prototype.setSprites = function(sprites) { + var j, len, sprite; + this.clearSprites(); + if (sprites instanceof $) { + return this.sprites = (function() { + var j, len, results; + results = []; + for (j = 0, len = sprites.length; j < len; j++) { + sprite = sprites[j]; + results.push(new ScrollFollowerSprite($(sprite), this)); + } + return results; + }).call(this); + } else { + for (j = 0, len = sprites.length; j < len; j++) { + sprite = sprites[j]; + sprite.follower = this; + } + return this.sprites = sprites; + } + }; + + ScrollFollower.prototype.clearSprites = function() { + var j, len, ref, sprite; + ref = this.sprites; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + sprite.clear(); + } + return this.sprites = []; + }; + + ScrollFollower.prototype.handleScroll = function() { + this.updateViewport(); + return this.updatePositions(); + }; + + ScrollFollower.prototype.cacheDimensions = function() { + var j, len, ref, sprite; + this.updateViewport(); + this.scrollbarWidths = this.scroller.getScrollbarWidths(); + this.contentOffset = this.scroller.canvas.el.offset(); + ref = this.sprites; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + sprite.cacheDimensions(); + } + }; + + ScrollFollower.prototype.updateViewport = function() { + var left, scroller, top; + scroller = this.scroller; + left = scroller.getScrollFromLeft(); + top = scroller.getScrollTop(); + return this.viewportRect = { + left: left, + right: left + scroller.getClientWidth(), + top: top, + bottom: top + scroller.getClientHeight() + }; + }; + + ScrollFollower.prototype.forceRelative = function() { + var j, len, ref, results, sprite; + if (!this.isForcedRelative) { + this.isForcedRelative = true; + ref = this.sprites; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + if (sprite.doAbsolute) { + results.push(sprite.assignPosition()); + } else { + results.push(void 0); + } + } + return results; + } + }; + + ScrollFollower.prototype.clearForce = function() { + var j, len, ref, results, sprite; + if (this.isForcedRelative && !FC.isTouchEnabled) { + this.isForcedRelative = false; + ref = this.sprites; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + results.push(sprite.assignPosition()); + } + return results; + } + }; + + ScrollFollower.prototype.update = function() { + this.cacheDimensions(); + return this.updatePositions(); + }; + + ScrollFollower.prototype.updatePositions = function() { + var j, len, ref, sprite; + ref = this.sprites; + for (j = 0, len = ref.length; j < len; j++) { + sprite = ref[j]; + sprite.updatePosition(); + } + }; + + ScrollFollower.prototype.getContentRect = function(el) { + return getContentRect(el, this.contentOffset); + }; + + ScrollFollower.prototype.getBoundingRect = function(el) { + return getOuterRect(el, this.contentOffset); + }; + + return ScrollFollower; + +})(); + +ScrollFollowerSprite = (function() { + ScrollFollowerSprite.prototype.follower = null; + + ScrollFollowerSprite.prototype.el = null; + + ScrollFollowerSprite.prototype.absoluteEl = null; + + ScrollFollowerSprite.prototype.naturalRect = null; + + ScrollFollowerSprite.prototype.parentRect = null; + + ScrollFollowerSprite.prototype.containerRect = null; + + ScrollFollowerSprite.prototype.isEnabled = true; + + ScrollFollowerSprite.prototype.isHFollowing = false; + + ScrollFollowerSprite.prototype.isVFollowing = false; + + ScrollFollowerSprite.prototype.doAbsolute = false; + + ScrollFollowerSprite.prototype.isAbsolute = false; + + ScrollFollowerSprite.prototype.isCentered = false; + + ScrollFollowerSprite.prototype.rect = null; + + ScrollFollowerSprite.prototype.isBlock = false; + + ScrollFollowerSprite.prototype.naturalWidth = null; + + function ScrollFollowerSprite(el1, follower1) { + this.el = el1; + this.follower = follower1 != null ? follower1 : null; + this.isBlock = this.el.css('display') === 'block'; + this.el.css('position', 'relative'); + } + + ScrollFollowerSprite.prototype.disable = function() { + if (this.isEnabled) { + this.isEnabled = false; + this.resetPosition(); + return this.unabsolutize(); + } + }; + + ScrollFollowerSprite.prototype.enable = function() { + if (!this.isEnabled) { + this.isEnabled = true; + return this.assignPosition(); + } + }; + + ScrollFollowerSprite.prototype.clear = function() { + this.disable(); + this.follower = null; + return this.absoluteEl = null; + }; + + ScrollFollowerSprite.prototype.cacheDimensions = function() { + var containerRect, follower, isCentered, isHFollowing, isVFollowing, minTravel, naturalRect, parentEl; + isHFollowing = false; + isVFollowing = false; + isCentered = false; + this.naturalWidth = this.el.width(); + this.resetPosition(); + follower = this.follower; + naturalRect = this.naturalRect = follower.getBoundingRect(this.el); + parentEl = this.el.parent(); + this.parentRect = follower.getBoundingRect(parentEl); + containerRect = this.containerRect = joinRects(follower.getContentRect(parentEl), naturalRect); + minTravel = follower.minTravel; + if (follower.containOnNaturalLeft) { + containerRect.left = naturalRect.left; + } + if (follower.containOnNaturalRight) { + containerRect.right = naturalRect.right; + } + if (follower.isHFollowing) { + if (getRectWidth(containerRect) - getRectWidth(naturalRect) >= minTravel) { + isCentered = this.el.css('text-align') === 'center'; + isHFollowing = true; + } + } + if (follower.isVFollowing) { + if (getRectHeight(containerRect) - getRectHeight(naturalRect) >= minTravel) { + isVFollowing = true; + } + } + this.isHFollowing = isHFollowing; + this.isVFollowing = isVFollowing; + return this.isCentered = isCentered; + }; + + ScrollFollowerSprite.prototype.updatePosition = function() { + this.computePosition(); + return this.assignPosition(); + }; + + ScrollFollowerSprite.prototype.resetPosition = function() { + return this.el.css({ + top: '', + left: '' + }); + }; + + ScrollFollowerSprite.prototype.computePosition = function() { + var containerRect, doAbsolute, parentRect, rect, rectWidth, subjectRect, viewportRect, visibleParentRect; + viewportRect = this.follower.viewportRect; + parentRect = this.parentRect; + containerRect = this.containerRect; + visibleParentRect = intersectRects(viewportRect, parentRect); + rect = null; + doAbsolute = false; + if (visibleParentRect) { + rect = copyRect(this.naturalRect); + subjectRect = intersectRects(rect, parentRect); + if ((this.isCentered && !testRectContains(viewportRect, parentRect)) || (subjectRect && !testRectContains(viewportRect, subjectRect))) { + doAbsolute = true; + if (this.isHFollowing) { + if (this.isCentered) { + rectWidth = getRectWidth(rect); + rect.left = (visibleParentRect.left + visibleParentRect.right) / 2 - rectWidth / 2; + rect.right = rect.left + rectWidth; + } else { + if (!hContainRect(rect, viewportRect)) { + doAbsolute = false; + } + } + if (hContainRect(rect, containerRect)) { + doAbsolute = false; + } + } + if (this.isVFollowing) { + if (!vContainRect(rect, viewportRect)) { + doAbsolute = false; + } + if (vContainRect(rect, containerRect)) { + doAbsolute = false; + } + } + if (!testRectContains(viewportRect, rect)) { + doAbsolute = false; + } + } + } + this.rect = rect; + return this.doAbsolute = doAbsolute; + }; + + ScrollFollowerSprite.prototype.assignPosition = function() { + var left, top; + if (this.isEnabled) { + if (!this.rect) { + return this.unabsolutize(); + } else if (this.doAbsolute && !this.follower.isForcedRelative) { + this.absolutize(); + return this.absoluteEl.css({ + top: this.rect.top - this.follower.viewportRect.top + this.follower.scrollbarWidths.top, + left: this.rect.left - this.follower.viewportRect.left + this.follower.scrollbarWidths.left, + width: this.isBlock ? this.naturalWidth : '' + }); + } else { + top = this.rect.top - this.naturalRect.top; + left = this.rect.left - this.naturalRect.left; + this.unabsolutize(); + return this.el.toggleClass('fc-following', Boolean(top || left)).css({ + top: top, + left: left + }); + } + } + }; + + ScrollFollowerSprite.prototype.absolutize = function() { + if (!this.isAbsolute) { + if (!this.absoluteEl) { + this.absoluteEl = this.buildAbsoluteEl(); + } + this.absoluteEl.appendTo(this.follower.scroller.el); + this.el.css('visibility', 'hidden'); + return this.isAbsolute = true; + } + }; + + ScrollFollowerSprite.prototype.unabsolutize = function() { + if (this.isAbsolute) { + this.absoluteEl.detach(); + this.el.css('visibility', ''); + return this.isAbsolute = false; + } + }; + + ScrollFollowerSprite.prototype.buildAbsoluteEl = function() { + return this.el.clone().addClass('fc-following').css({ + 'position': 'absolute', + 'z-index': 1000, + 'font-weight': this.el.css('font-weight'), + 'font-size': this.el.css('font-size'), + 'font-family': this.el.css('font-family'), + 'color': this.el.css('color'), + 'padding-top': this.el.css('padding-top'), + 'padding-bottom': this.el.css('padding-bottom'), + 'padding-left': this.el.css('padding-left'), + 'padding-right': this.el.css('padding-right'), + 'pointer-events': 'none' + }); + }; + + return ScrollFollowerSprite; + +})(); + +copyRect = function(rect) { + return { + left: rect.left, + right: rect.right, + top: rect.top, + bottom: rect.bottom + }; +}; + +getRectWidth = function(rect) { + return rect.right - rect.left; +}; + +getRectHeight = function(rect) { + return rect.bottom - rect.top; +}; + +testRectContains = function(rect, innerRect) { + return testRectHContains(rect, innerRect) && testRectVContains(rect, innerRect); +}; + +testRectHContains = function(rect, innerRect) { + return innerRect.left >= rect.left && innerRect.right <= rect.right; +}; + +testRectVContains = function(rect, innerRect) { + return innerRect.top >= rect.top && innerRect.bottom <= rect.bottom; +}; + +hContainRect = function(rect, outerRect) { + if (rect.left < outerRect.left) { + rect.right = outerRect.left + getRectWidth(rect); + rect.left = outerRect.left; + return true; + } else if (rect.right > outerRect.right) { + rect.left = outerRect.right - getRectWidth(rect); + rect.right = outerRect.right; + return true; + } else { + return false; + } +}; + +vContainRect = function(rect, outerRect) { + if (rect.top < outerRect.top) { + rect.bottom = outerRect.top + getRectHeight(rect); + rect.top = outerRect.top; + return true; + } else if (rect.bottom > outerRect.bottom) { + rect.top = outerRect.bottom - getRectHeight(rect); + rect.bottom = outerRect.bottom; + return true; + } else { + return false; + } +}; + +joinRects = function(rect1, rect2) { + return { + left: Math.min(rect1.left, rect2.left), + right: Math.max(rect1.right, rect2.right), + top: Math.min(rect1.top, rect2.top), + bottom: Math.max(rect1.bottom, rect2.bottom) + }; +}; + +CalendarExtension = (function(superClass) { + extend(CalendarExtension, superClass); + + function CalendarExtension() { + return CalendarExtension.__super__.constructor.apply(this, arguments); + } + + CalendarExtension.prototype.resourceManager = null; + + CalendarExtension.prototype.initialize = function() { + return this.resourceManager = new ResourceManager(this); + }; + + CalendarExtension.prototype.instantiateView = function(viewType) { + var spec, viewClass; + spec = this.getViewSpec(viewType); + viewClass = spec['class']; + if (this.options.resources && spec.options.resources !== false) { + if (spec.queryResourceClass) { + viewClass = spec.queryResourceClass(spec) || viewClass; + } else if (spec.resourceClass) { + viewClass = spec.resourceClass; + } + } + return new viewClass(this, viewType, spec.options, spec.duration); + }; + + CalendarExtension.prototype.getResources = function() { + return this.resourceManager.topLevelResources; + }; + + CalendarExtension.prototype.addResource = function(resourceInput, scroll) { + var promise; + if (scroll == null) { + scroll = false; + } + promise = this.resourceManager.addResource(resourceInput); + if (scroll && this.view.scrollToResource) { + promise.done((function(_this) { + return function(resource) { + return _this.view.scrollToResource(resource); + }; + })(this)); + } + }; + + CalendarExtension.prototype.removeResource = function(idOrResource) { + return this.resourceManager.removeResource(idOrResource); + }; + + CalendarExtension.prototype.refetchResources = function() { + this.resourceManager.fetchResources(); + }; + + CalendarExtension.prototype.rerenderResources = function() { + this.resourceManager.resetResources(); + }; + + CalendarExtension.prototype.getPeerEvents = function(span, event) { + var filteredPeerEvents, isPeer, j, k, l, len, len1, len2, newResourceId, newResourceIds, peerEvent, peerEvents, peerResourceId, peerResourceIds; + peerEvents = CalendarExtension.__super__.getPeerEvents.apply(this, arguments); + newResourceIds = span.resourceId ? [span.resourceId] : event ? this.getEventResourceIds(event) : []; + filteredPeerEvents = []; + for (j = 0, len = peerEvents.length; j < len; j++) { + peerEvent = peerEvents[j]; + isPeer = false; + peerResourceIds = this.getEventResourceIds(peerEvent); + if (!peerResourceIds.length || !newResourceIds.length) { + isPeer = true; + } else { + for (k = 0, len1 = peerResourceIds.length; k < len1; k++) { + peerResourceId = peerResourceIds[k]; + for (l = 0, len2 = newResourceIds.length; l < len2; l++) { + newResourceId = newResourceIds[l]; + if (newResourceId === peerResourceId) { + isPeer = true; + break; + } + } + } + } + if (isPeer) { + filteredPeerEvents.push(peerEvent); + } + } + return filteredPeerEvents; + }; + + CalendarExtension.prototype.buildSelectSpan = function(startInput, endInput, resourceId) { + var span; + span = CalendarExtension.__super__.buildSelectSpan.apply(this, arguments); + if (resourceId) { + span.resourceId = resourceId; + } + return span; + }; + + CalendarExtension.prototype.getResourceById = function(id) { + return this.resourceManager.getResourceById(id); + }; + + CalendarExtension.prototype.getEventResourceId = function(event) { + return this.getEventResourceIds(event)[0]; + }; + + CalendarExtension.prototype.getEventResourceIds = function(event) { + var j, len, normalResourceId, normalResourceIds, ref, ref1, ref2, resourceId; + resourceId = String((ref = (ref1 = event[this.getEventResourceField()]) != null ? ref1 : event.resourceId) != null ? ref : ''); + if (resourceId) { + return [resourceId]; + } else if (event.resourceIds) { + normalResourceIds = []; + ref2 = event.resourceIds; + for (j = 0, len = ref2.length; j < len; j++) { + resourceId = ref2[j]; + normalResourceId = String(resourceId != null ? resourceId : ''); + if (normalResourceId) { + normalResourceIds.push(normalResourceId); + } + } + return normalResourceIds; + } else { + return []; + } + }; + + CalendarExtension.prototype.setEventResourceId = function(event, resourceId) { + return event[this.getEventResourceField()] = String(resourceId != null ? resourceId : ''); + }; + + CalendarExtension.prototype.getEventResourceField = function() { + return this.options['eventResourceField'] || 'resourceId'; + }; + + CalendarExtension.prototype.getResourceEvents = function(idOrResource) { + var resource; + resource = typeof idOrResource === 'object' ? idOrResource : this.getResourceById(idOrResource); + if (resource) { + return this.clientEvents((function(_this) { + return function(event) { + return $.inArray(resource.id, _this.getEventResourceIds(event)) !== -1; + }; + })(this)); + } else { + return []; + } + }; + + CalendarExtension.prototype.getEventResource = function(idOrEvent) { + return this.getEventResources(idOrEvent)[0]; + }; + + CalendarExtension.prototype.getEventResources = function(idOrEvent) { + var event, j, len, ref, resource, resourceId, resources; + event = typeof idOrEvent === 'object' ? idOrEvent : this.clientEvents(idOrEvent)[0]; + resources = []; + if (event) { + ref = this.getEventResourceIds(event); + for (j = 0, len = ref.length; j < len; j++) { + resourceId = ref[j]; + resource = this.getResourceById(resourceId); + if (resource) { + resources.push(resource); + } + } + } + return resources; + }; + + return CalendarExtension; + +})(Calendar); + +Calendar.prototype = CalendarExtension.prototype; + +origDisplayView = View.prototype.displayView; + +origRenderSkeleton = View.prototype.renderSkeleton; + +origUnrenderSkeleton = View.prototype.unrenderSkeleton; + +origDisplayEvents = View.prototype.displayEvents; + +View.prototype.isResourcesBound = false; + +View.prototype.settingResources = null; + +View.prototype.displayView = function() { + origDisplayView.apply(this, arguments); + processLicenseKey(this.calendar.options.schedulerLicenseKey, this.el); + this.bindResources(); + return this.whenResources(); +}; + +View.prototype.unrenderSkeleton = function() { + origUnrenderSkeleton.apply(this, arguments); + return this.unbindResources(); +}; + +View.prototype.displayEvents = function(events) { + return this.whenResources((function(_this) { + return function() { + return origDisplayEvents.call(_this, events); + }; + })(this)); +}; + +View.prototype.bindResources = function() { + var setResources; + if (!this.isResourcesBound) { + this.isResourcesBound = true; + this.settingResources = $.Deferred(); + setResources = (function(_this) { + return function(resources) { + _this.setResources(resources); + return _this.settingResources.resolve(); + }; + })(this); + this.listenTo(this.calendar.resourceManager, { + set: setResources, + unset: this.unsetResources, + reset: this.resetResources, + add: this.addResource, + remove: this.removeResource + }); + if (this.calendar.resourceManager.hasFetched()) { + return setResources(this.calendar.resourceManager.topLevelResources); + } else { + return this.calendar.resourceManager.getResources(); + } + } +}; + +View.prototype.unbindResources = function() { + if (this.isResourcesBound) { + this.stopListeningTo(this.calendar.resourceManager); + if (this.settingResources.state() === 'resolved') { + this.unsetResources(); + } + this.settingResources = null; + return this.isResourcesBound = false; + } +}; + +View.prototype.whenResources = function(thenFunc) { + if (this.settingResources.state() === 'resolved') { + return $.when(thenFunc ? thenFunc() : void 0); + } else if (thenFunc) { + return this.settingResources.then(thenFunc); + } else { + return this.settingResources.promise(); + } +}; + +View.prototype.setResources = function(resources) {}; + +View.prototype.unsetResources = function() {}; + +View.prototype.resetResources = function(resources) { + return this.calendar.rerenderEvents(); +}; + +View.prototype.addResource = function(resource) { + return this.resetResources(this.calendar.resourceManager.topLevelResources); +}; + +View.prototype.removeResource = function(resource) { + return this.resetResources(this.calendar.resourceManager.topLevelResources); +}; + +origGetSegClasses = Grid.prototype.getSegClasses; + +Grid.prototype.getSegClasses = function(seg) { + var classes, j, len, ref, resource; + classes = origGetSegClasses.apply(this, arguments); + ref = this.getSegResources(seg); + for (j = 0, len = ref.length; j < len; j++) { + resource = ref[j]; + classes = classes.concat(resource.eventClassName || []); + } + return classes; +}; + +Grid.prototype.getSegSkinCss = function(seg) { + var event, eventColor, getResourceBackgroundColor, getResourceBorderColor, getResourceTextColor, optionColor, resources, source, sourceColor, view; + view = this.view; + event = seg.event; + source = event.source || {}; + eventColor = event.color; + sourceColor = source.color; + optionColor = view.opt('eventColor'); + resources = this.getSegResources(seg); + getResourceBackgroundColor = function() { + var currentResource, j, len, val; + val = null; + for (j = 0, len = resources.length; j < len; j++) { + currentResource = resources[j]; + while (currentResource && !val) { + val = currentResource.eventBackgroundColor || currentResource.eventColor; + currentResource = currentResource._parent; + } + } + return val; + }; + getResourceBorderColor = function() { + var currentResource, j, len, val; + val = null; + for (j = 0, len = resources.length; j < len; j++) { + currentResource = resources[j]; + while (currentResource && !val) { + val = currentResource.eventBorderColor || currentResource.eventColor; + currentResource = currentResource._parent; + } + } + return val; + }; + getResourceTextColor = function() { + var currentResource, j, len, val; + val = null; + for (j = 0, len = resources.length; j < len; j++) { + currentResource = resources[j]; + while (currentResource && !val) { + val = currentResource.eventTextColor; + currentResource = currentResource._parent; + } + } + return val; + }; + return { + 'background-color': event.backgroundColor || eventColor || getResourceBackgroundColor() || source.backgroundColor || sourceColor || view.opt('eventBackgroundColor') || optionColor, + 'border-color': event.borderColor || eventColor || getResourceBorderColor() || source.borderColor || sourceColor || view.opt('eventBorderColor') || optionColor, + 'color': event.textColor || getResourceTextColor() || source.textColor || view.opt('eventTextColor') + }; +}; + +Grid.prototype.getSegResources = function(seg) { + if (seg.resource) { + return [seg.resource]; + } else { + return this.view.calendar.getEventResources(seg.event); + } +}; + +ResourceManager = (function(superClass) { + extend(ResourceManager, superClass); + + ResourceManager.mixin(EmitterMixin); + + ResourceManager.resourceGuid = 1; + + ResourceManager.ajaxDefaults = { + dataType: 'json', + cache: false + }; + + ResourceManager.prototype.calendar = null; + + ResourceManager.prototype.topLevelResources = null; + + ResourceManager.prototype.resourcesById = null; + + ResourceManager.prototype.fetching = null; + + function ResourceManager(calendar1) { + this.calendar = calendar1; + this.initializeCache(); + } + + ResourceManager.prototype.hasFetched = function() { + return this.fetching && this.fetching.state() === 'resolved'; + }; + + ResourceManager.prototype.getResources = function() { + var getting; + if (!this.fetching) { + getting = $.Deferred(); + this.fetchResources().done(function(resources) { + return getting.resolve(resources); + }).fail(function() { + return getting.resolve([]); + }); + return getting; + } else { + return $.Deferred().resolve(this.topLevelResources).promise(); + } + }; + + ResourceManager.prototype.fetchResources = function() { + var prevFetching; + prevFetching = this.fetching; + return $.when(prevFetching).then((function(_this) { + return function() { + return _this.fetching = _this.fetchResourceInputs().then(function(resourceInputs) { + _this.setResources(resourceInputs, Boolean(prevFetching)); + return _this.topLevelResources; + }); + }; + })(this)); + }; + + ResourceManager.prototype.fetchResourceInputs = function() { + var deferred, promise, source; + deferred = $.Deferred(); + source = this.calendar.options['resources']; + if ($.type(source) === 'string') { + source = { + url: source + }; + } + switch ($.type(source)) { + case 'function': + source((function(_this) { + return function(resourceInputs) { + return deferred.resolve(resourceInputs); + }; + })(this)); + break; + case 'object': + promise = $.ajax($.extend({}, ResourceManager.ajaxDefaults, source)); + break; + case 'array': + deferred.resolve(source); + break; + default: + deferred.resolve([]); + } + promise || (promise = deferred.promise()); + if (!promise.state() === 'pending') { + this.calendar.pushLoading(); + promise.always(function() { + return this.calendar.popLoading(); + }); + } + return promise; + }; + + ResourceManager.prototype.resetResources = function() { + return this.getResources().then((function(_this) { + return function() { + return _this.trigger('reset', _this.topLevelResources); + }; + })(this)); + }; + + ResourceManager.prototype.getResourceById = function(id) { + return this.resourcesById[id]; + }; + + ResourceManager.prototype.initializeCache = function() { + this.topLevelResources = []; + return this.resourcesById = {}; + }; + + ResourceManager.prototype.setResources = function(resourceInputs, isReset) { + var j, len, resource, resourceInput, resources, validResources; + this.initializeCache(); + resources = (function() { + var j, len, results; + results = []; + for (j = 0, len = resourceInputs.length; j < len; j++) { + resourceInput = resourceInputs[j]; + results.push(this.buildResource(resourceInput)); + } + return results; + }).call(this); + validResources = (function() { + var j, len, results; + results = []; + for (j = 0, len = resources.length; j < len; j++) { + resource = resources[j]; + if (this.addResourceToIndex(resource)) { + results.push(resource); + } + } + return results; + }).call(this); + for (j = 0, len = validResources.length; j < len; j++) { + resource = validResources[j]; + this.addResourceToTree(resource); + } + if (isReset) { + this.trigger('reset', this.topLevelResources); + } else { + this.trigger('set', this.topLevelResources); + } + return this.calendar.trigger('resourcesSet', null, this.topLevelResources); + }; + + ResourceManager.prototype.addResource = function(resourceInput) { + return $.when(this.fetching).then((function(_this) { + return function() { + var resource; + resource = _this.buildResource(resourceInput); + if (_this.addResourceToIndex(resource)) { + _this.addResourceToTree(resource); + _this.trigger('add', resource); + return resource; + } else { + return false; + } + }; + })(this)); + }; + + ResourceManager.prototype.addResourceToIndex = function(resource) { + var child, j, len, ref; + if (this.resourcesById[resource.id]) { + return false; + } else { + this.resourcesById[resource.id] = resource; + ref = resource.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + this.addResourceToIndex(child); + } + return true; + } + }; + + ResourceManager.prototype.addResourceToTree = function(resource) { + var parent, parentId, ref, siblings; + if (!resource.parent) { + parentId = String((ref = resource['parentId']) != null ? ref : ''); + if (parentId) { + parent = this.resourcesById[parentId]; + if (parent) { + resource.parent = parent; + siblings = parent.children; + } else { + return false; + } + } else { + siblings = this.topLevelResources; + } + siblings.push(resource); + } + return true; + }; + + ResourceManager.prototype.removeResource = function(idOrResource) { + var id; + id = typeof idOrResource === 'object' ? idOrResource.id : idOrResource; + return $.when(this.fetching).then((function(_this) { + return function() { + var resource; + resource = _this.removeResourceFromIndex(id); + if (resource) { + _this.removeResourceFromTree(resource); + _this.trigger('remove', resource); + } + return resource; + }; + })(this)); + }; + + ResourceManager.prototype.removeResourceFromIndex = function(resourceId) { + var child, j, len, ref, resource; + resource = this.resourcesById[resourceId]; + if (resource) { + delete this.resourcesById[resourceId]; + ref = resource.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + this.removeResourceFromIndex(child.id); + } + return resource; + } else { + return false; + } + }; + + ResourceManager.prototype.removeResourceFromTree = function(resource, siblings) { + var i, j, len, sibling; + if (siblings == null) { + siblings = this.topLevelResources; + } + for (i = j = 0, len = siblings.length; j < len; i = ++j) { + sibling = siblings[i]; + if (sibling === resource) { + resource.parent = null; + siblings.splice(i, 1); + return true; + } + if (this.removeResourceFromTree(resource, sibling.children)) { + return true; + } + } + return false; + }; + + ResourceManager.prototype.buildResource = function(resourceInput) { + var child, childInput, rawClassName, ref, resource; + resource = $.extend({}, resourceInput); + resource.id = String((ref = resourceInput.id) != null ? ref : '_fc' + ResourceManager.resourceGuid++); + rawClassName = resourceInput.eventClassName; + resource.eventClassName = (function() { + switch ($.type(rawClassName)) { + case 'string': + return rawClassName.split(/\s+/); + case 'array': + return rawClassName; + default: + return []; + } + })(); + resource.children = (function() { + var j, len, ref1, ref2, results; + ref2 = (ref1 = resourceInput.children) != null ? ref1 : []; + results = []; + for (j = 0, len = ref2.length; j < len; j++) { + childInput = ref2[j]; + child = this.buildResource(childInput); + child.parent = resource; + results.push(child); + } + return results; + }).call(this); + return resource; + }; + + return ResourceManager; + +})(Class); + +ResourceViewMixin = { + resourceTextFunc: null, + unsetResources: function() { + return this.clearEvents(); + }, + resetResources: function(resources) { + var scrollState; + scrollState = this.queryScroll(); + this.unsetResources(); + this.setResources(resources); + this.setScroll(scrollState); + return this.calendar.rerenderEvents(); + }, + getResourceText: function(resource) { + return this.getResourceTextFunc()(resource); + }, + getResourceTextFunc: function() { + var func; + if (this.resourceTextFunc) { + return this.resourceTextFunc; + } else { + func = this.opt('resourceText'); + if (typeof func !== 'function') { + func = function(resource) { + return resource.title || resource.id; + }; + } + return this.resourceTextFunc = func; + } + }, + triggerDayClick: function(span, dayEl, ev) { + var resourceManager; + resourceManager = this.calendar.resourceManager; + return this.trigger('dayClick', dayEl, this.calendar.applyTimezone(span.start), ev, this, resourceManager.getResourceById(span.resourceId)); + }, + triggerSelect: function(span, ev) { + var resourceManager; + resourceManager = this.calendar.resourceManager; + return this.trigger('select', null, this.calendar.applyTimezone(span.start), this.calendar.applyTimezone(span.end), ev, this, resourceManager.getResourceById(span.resourceId)); + }, + triggerExternalDrop: function(event, dropLocation, el, ev, ui) { + this.trigger('drop', el[0], dropLocation.start, ev, ui, dropLocation.resourceId); + if (event) { + return this.trigger('eventReceive', null, event); + } + }, + + /* Hacks + * ------------------------------------------------------------------------------------------------------------------ + These triggers usually call mutateEvent with dropLocation, which causes an event modification and rerender. + But mutateEvent isn't aware of eventResourceField, so it might be setting the wrong property. Workaround. + TODO: normalize somewhere else. maybe make a hook in core. + */ + reportEventDrop: function() { + var dropLocation, event, otherArgs, ref; + event = arguments[0], dropLocation = arguments[1], otherArgs = 3 <= arguments.length ? slice.call(arguments, 2) : []; + dropLocation = this.normalizeDropLocation(dropLocation); + if (dropLocation.resourceId && event.resourceIds) { + dropLocation.resourceIds = null; + } + return (ref = View.prototype.reportEventDrop).call.apply(ref, [this, event, dropLocation].concat(slice.call(otherArgs))); + }, + reportExternalDrop: function() { + var dropLocation, meta, otherArgs, ref; + meta = arguments[0], dropLocation = arguments[1], otherArgs = 3 <= arguments.length ? slice.call(arguments, 2) : []; + dropLocation = this.normalizeDropLocation(dropLocation); + return (ref = View.prototype.reportExternalDrop).call.apply(ref, [this, meta, dropLocation].concat(slice.call(otherArgs))); + }, + normalizeDropLocation: function(dropLocation) { + var out; + out = $.extend({}, dropLocation); + delete out.resourceId; + this.calendar.setEventResourceId(out, dropLocation.resourceId); + return out; + } +}; + +ResourceGridMixin = { + allowCrossResource: true, + eventRangeToSpans: function(range, event) { + var j, len, resourceId, resourceIds, results; + resourceIds = this.view.calendar.getEventResourceIds(event); + if (resourceIds.length) { + results = []; + for (j = 0, len = resourceIds.length; j < len; j++) { + resourceId = resourceIds[j]; + results.push($.extend({}, range, { + resourceId: resourceId + })); + } + return results; + } else if (FC.isBgEvent(event)) { + return Grid.prototype.eventRangeToSpans.apply(this, arguments); + } else { + return []; + } + }, + fabricateHelperEvent: function(eventLocation, seg) { + var event; + event = Grid.prototype.fabricateHelperEvent.apply(this, arguments); + this.view.calendar.setEventResourceId(event, eventLocation.resourceId); + return event; + }, + computeEventDrop: function(startSpan, endSpan, event) { + var allowResourceChange, dropLocation; + allowResourceChange = true; + if (!allowResourceChange && startSpan.resourceId !== endSpan.resourceId) { + return null; + } + dropLocation = Grid.prototype.computeEventDrop.apply(this, arguments); + if (dropLocation) { + dropLocation.resourceId = endSpan.resourceId; + } + return dropLocation; + }, + computeExternalDrop: function(span, meta) { + var dropLocation; + dropLocation = Grid.prototype.computeExternalDrop.apply(this, arguments); + if (dropLocation) { + dropLocation.resourceId = span.resourceId; + } + return dropLocation; + }, + computeEventResize: function(type, startSpan, endSpan, event) { + var resizeLocation; + if (!this.allowCrossResource && startSpan.resourceId !== endSpan.resourceId) { + return; + } + resizeLocation = Grid.prototype.computeEventResize.apply(this, arguments); + if (resizeLocation) { + resizeLocation.resourceId = startSpan.resourceId; + } + return resizeLocation; + }, + computeSelectionSpan: function(startSpan, endSpan) { + var selectionSpan; + if (!this.allowCrossResource && startSpan.resourceId !== endSpan.resourceId) { + return; + } + selectionSpan = Grid.prototype.computeSelectionSpan.apply(this, arguments); + if (selectionSpan) { + selectionSpan.resourceId = startSpan.resourceId; + } + return selectionSpan; + } +}; + + +/* +Requirements: +- must be a Grid +- grid must have a view that's a ResourceView +- DayTableMixin must already be mixed in + */ + +ResourceDayTableMixin = { + flattenedResources: null, + resourceCnt: 0, + datesAboveResources: false, + allowCrossResource: false, + setResources: function(resources) { + this.flattenedResources = this.flattenResources(resources); + this.resourceCnt = this.flattenedResources.length; + return this.updateDayTableCols(); + }, + unsetResources: function() { + this.flattenedResources = null; + this.resourceCnt = 0; + return this.updateDayTableCols(); + }, + flattenResources: function(resources) { + var orderSpecs, orderVal, res, sortFunc; + orderVal = this.view.opt('resourceOrder'); + if (orderVal) { + orderSpecs = parseFieldSpecs(orderVal); + sortFunc = function(a, b) { + return compareByFieldSpecs(a, b, orderSpecs); + }; + } else { + sortFunc = null; + } + res = []; + this.accumulateResources(resources, sortFunc, res); + return res; + }, + accumulateResources: function(resources, sortFunc, res) { + var j, len, resource, results, sortedResources; + if (sortFunc) { + sortedResources = resources.slice(0); + sortedResources.sort(sortFunc); + } else { + sortedResources = resources; + } + results = []; + for (j = 0, len = sortedResources.length; j < len; j++) { + resource = sortedResources[j]; + res.push(resource); + results.push(this.accumulateResources(resource.children, sortFunc, res)); + } + return results; + }, + updateDayTableCols: function() { + this.datesAboveResources = this.view.opt('groupByDateAndResource'); + return FC.DayTableMixin.updateDayTableCols.call(this); + }, + computeColCnt: function() { + return (this.resourceCnt || 1) * this.daysPerRow; + }, + getColDayIndex: function(col) { + if (this.isRTL) { + col = this.colCnt - 1 - col; + } + if (this.datesAboveResources) { + return Math.floor(col / (this.resourceCnt || 1)); + } else { + return col % this.daysPerRow; + } + }, + getColResource: function(col) { + return this.flattenedResources[this.getColResourceIndex(col)]; + }, + getColResourceIndex: function(col) { + if (this.isRTL) { + col = this.colCnt - 1 - col; + } + if (this.datesAboveResources) { + return col % (this.resourceCnt || 1); + } else { + return Math.floor(col / this.daysPerRow); + } + }, + indicesToCol: function(resourceIndex, dayIndex) { + var col; + col = this.datesAboveResources ? dayIndex * (this.resourceCnt || 1) + resourceIndex : resourceIndex * this.daysPerRow + dayIndex; + if (this.isRTL) { + col = this.colCnt - 1 - col; + } + return col; + }, + renderHeadTrHtml: function() { + if (!this.resourceCnt) { + return FC.DayTableMixin.renderHeadTrHtml.call(this); + } else { + if (this.daysPerRow > 1) { + if (this.datesAboveResources) { + return this.renderHeadDateAndResourceHtml(); + } else { + return this.renderHeadResourceAndDateHtml(); + } + } else { + return this.renderHeadResourceHtml(); + } + } + }, + renderHeadResourceHtml: function() { + var j, len, ref, resource, resourceHtmls; + resourceHtmls = []; + ref = this.flattenedResources; + for (j = 0, len = ref.length; j < len; j++) { + resource = ref[j]; + resourceHtmls.push(this.renderHeadResourceCellHtml(resource)); + } + return this.wrapTr(resourceHtmls, 'renderHeadIntroHtml'); + }, + renderHeadResourceAndDateHtml: function() { + var date, dateHtmls, dayIndex, j, k, len, ref, ref1, resource, resourceHtmls; + resourceHtmls = []; + dateHtmls = []; + ref = this.flattenedResources; + for (j = 0, len = ref.length; j < len; j++) { + resource = ref[j]; + resourceHtmls.push(this.renderHeadResourceCellHtml(resource, null, this.daysPerRow)); + for (dayIndex = k = 0, ref1 = this.daysPerRow; k < ref1; dayIndex = k += 1) { + date = this.dayDates[dayIndex].clone(); + dateHtmls.push(this.renderHeadResourceDateCellHtml(date, resource)); + } + } + return this.wrapTr(resourceHtmls, 'renderHeadIntroHtml') + this.wrapTr(dateHtmls, 'renderHeadIntroHtml'); + }, + renderHeadDateAndResourceHtml: function() { + var date, dateHtmls, dayIndex, j, k, len, ref, ref1, resource, resourceHtmls; + dateHtmls = []; + resourceHtmls = []; + for (dayIndex = j = 0, ref = this.daysPerRow; j < ref; dayIndex = j += 1) { + date = this.dayDates[dayIndex].clone(); + dateHtmls.push(this.renderHeadDateCellHtml(date, this.resourceCnt)); + ref1 = this.flattenedResources; + for (k = 0, len = ref1.length; k < len; k++) { + resource = ref1[k]; + resourceHtmls.push(this.renderHeadResourceCellHtml(resource, date)); + } + } + return this.wrapTr(dateHtmls, 'renderHeadIntroHtml') + this.wrapTr(resourceHtmls, 'renderHeadIntroHtml'); + }, + renderHeadResourceCellHtml: function(resource, date, colspan) { + return ' 1 ? ' colspan="' + colspan + '"' : '') + '>' + htmlEscape(this.view.getResourceText(resource)) + ''; + }, + renderHeadResourceDateCellHtml: function(date, resource, colspan) { + return this.renderHeadDateCellHtml(date, colspan, 'data-resource-id="' + resource.id + '"'); + }, + processHeadResourceEls: function(containerEl) { + return containerEl.find('.fc-resource-cell').each((function(_this) { + return function(col, node) { + var resource; + if (_this.datesAboveResources) { + resource = _this.getColResource(col); + } else { + resource = _this.flattenedResources[_this.isRTL ? _this.flattenedResources.length - 1 - col : col]; + } + return _this.view.trigger('resourceRender', resource, resource, $(node), $()); + }; + })(this)); + }, + renderBgCellsHtml: function(row) { + var col, date, htmls, j, ref, resource; + if (!this.resourceCnt) { + return FC.DayTableMixin.renderBgCellsHtml.call(this, row); + } else { + htmls = []; + for (col = j = 0, ref = this.colCnt; j < ref; col = j += 1) { + date = this.getCellDate(row, col); + resource = this.getColResource(col); + htmls.push(this.renderResourceBgCellHtml(date, resource)); + } + return htmls.join(''); + } + }, + renderResourceBgCellHtml: function(date, resource) { + return this.renderBgCellHtml(date, 'data-resource-id="' + resource.id + '"'); + }, + wrapTr: function(cellHtmls, introMethodName) { + if (this.isRTL) { + cellHtmls.reverse(); + return '' + cellHtmls.join('') + this[introMethodName]() + ''; + } else { + return '' + this[introMethodName]() + cellHtmls.join('') + ''; + } + } +}; + +ResourceDayGrid = (function(superClass) { + extend(ResourceDayGrid, superClass); + + function ResourceDayGrid() { + return ResourceDayGrid.__super__.constructor.apply(this, arguments); + } + + ResourceDayGrid.mixin(ResourceGridMixin); + + ResourceDayGrid.mixin(ResourceDayTableMixin); + + ResourceDayGrid.prototype.getHitSpan = function(hit) { + var span; + span = ResourceDayGrid.__super__.getHitSpan.apply(this, arguments); + if (this.resourceCnt) { + span.resourceId = this.getColResource(hit.col).id; + } + return span; + }; + + ResourceDayGrid.prototype.spanToSegs = function(span) { + var copy, genericSegs, j, k, l, len, len1, ref, resourceCnt, resourceIndex, resourceObj, resourceSegs, seg; + resourceCnt = this.resourceCnt; + genericSegs = this.datesAboveResources ? this.sliceRangeByDay(span) : this.sliceRangeByRow(span); + if (!resourceCnt) { + for (j = 0, len = genericSegs.length; j < len; j++) { + seg = genericSegs[j]; + if (this.isRTL) { + seg.leftCol = seg.lastRowDayIndex; + seg.rightCol = seg.firstRowDayIndex; + } else { + seg.leftCol = seg.firstRowDayIndex; + seg.rightCol = seg.lastRowDayIndex; + } + } + return genericSegs; + } else { + resourceSegs = []; + for (k = 0, len1 = genericSegs.length; k < len1; k++) { + seg = genericSegs[k]; + for (resourceIndex = l = 0, ref = resourceCnt; l < ref; resourceIndex = l += 1) { + resourceObj = this.flattenedResources[resourceIndex]; + if (!span.resourceId || span.resourceId === resourceObj.id) { + copy = $.extend({}, seg); + copy.resource = resourceObj; + if (this.isRTL) { + copy.leftCol = this.indicesToCol(resourceIndex, seg.lastRowDayIndex); + copy.rightCol = this.indicesToCol(resourceIndex, seg.firstRowDayIndex); + } else { + copy.leftCol = this.indicesToCol(resourceIndex, seg.firstRowDayIndex); + copy.rightCol = this.indicesToCol(resourceIndex, seg.lastRowDayIndex); + } + resourceSegs.push(copy); + } + } + } + return resourceSegs; + } + }; + + return ResourceDayGrid; + +})(FC.DayGrid); + +ResourceTimeGrid = (function(superClass) { + extend(ResourceTimeGrid, superClass); + + function ResourceTimeGrid() { + return ResourceTimeGrid.__super__.constructor.apply(this, arguments); + } + + ResourceTimeGrid.mixin(ResourceGridMixin); + + ResourceTimeGrid.mixin(ResourceDayTableMixin); + + ResourceTimeGrid.prototype.getHitSpan = function(hit) { + var span; + span = ResourceTimeGrid.__super__.getHitSpan.apply(this, arguments); + if (this.resourceCnt) { + span.resourceId = this.getColResource(hit.col).id; + } + return span; + }; + + ResourceTimeGrid.prototype.spanToSegs = function(span) { + var copy, genericSegs, j, k, l, len, len1, ref, resourceCnt, resourceIndex, resourceObj, resourceSegs, seg; + resourceCnt = this.resourceCnt; + genericSegs = this.sliceRangeByTimes(span); + if (!resourceCnt) { + for (j = 0, len = genericSegs.length; j < len; j++) { + seg = genericSegs[j]; + seg.col = seg.dayIndex; + } + return genericSegs; + } else { + resourceSegs = []; + for (k = 0, len1 = genericSegs.length; k < len1; k++) { + seg = genericSegs[k]; + for (resourceIndex = l = 0, ref = resourceCnt; l < ref; resourceIndex = l += 1) { + resourceObj = this.flattenedResources[resourceIndex]; + if (!span.resourceId || span.resourceId === resourceObj.id) { + copy = $.extend({}, seg); + copy.resource = resourceObj; + copy.col = this.indicesToCol(resourceIndex, seg.dayIndex); + resourceSegs.push(copy); + } + } + } + return resourceSegs; + } + }; + + return ResourceTimeGrid; + +})(FC.TimeGrid); + +TimelineView = (function(superClass) { + extend(TimelineView, superClass); + + function TimelineView() { + return TimelineView.__super__.constructor.apply(this, arguments); + } + + TimelineView.prototype.timeGrid = null; + + TimelineView.prototype.isScrolled = false; + + TimelineView.prototype.initialize = function() { + this.timeGrid = this.instantiateGrid(); + return this.intervalDuration = this.timeGrid.duration; + }; + + TimelineView.prototype.instantiateGrid = function() { + return new TimelineGrid(this); + }; + + TimelineView.prototype.setRange = function(range) { + TimelineView.__super__.setRange.apply(this, arguments); + return this.timeGrid.setRange(range); + }; + + TimelineView.prototype.renderSkeleton = function() { + this.el.addClass('fc-timeline'); + if (this.opt('eventOverlap') === false) { + this.el.addClass('fc-no-overlap'); + } + this.el.html(this.renderSkeletonHtml()); + return this.renderTimeGridSkeleton(); + }; + + TimelineView.prototype.renderSkeletonHtml = function() { + return '
'; + }; + + TimelineView.prototype.renderTimeGridSkeleton = function() { + this.timeGrid.setElement(this.el.find('tbody .fc-time-area')); + this.timeGrid.headEl = this.el.find('thead .fc-time-area'); + this.timeGrid.renderSkeleton(); + this.isScrolled = false; + return this.timeGrid.bodyScroller.on('scroll', proxy(this, 'handleBodyScroll')); + }; + + TimelineView.prototype.handleBodyScroll = function(top, left) { + if (top) { + if (!this.isScrolled) { + this.isScrolled = true; + return this.el.addClass('fc-scrolled'); + } + } else { + if (this.isScrolled) { + this.isScrolled = false; + return this.el.removeClass('fc-scrolled'); + } + } + }; + + TimelineView.prototype.unrenderSkeleton = function() { + this.timeGrid.removeElement(); + this.handleBodyScroll(0); + return TimelineView.__super__.unrenderSkeleton.apply(this, arguments); + }; + + TimelineView.prototype.renderDates = function() { + return this.timeGrid.renderDates(); + }; + + TimelineView.prototype.unrenderDates = function() { + return this.timeGrid.unrenderDates(); + }; + + TimelineView.prototype.renderBusinessHours = function() { + return this.timeGrid.renderBusinessHours(); + }; + + TimelineView.prototype.unrenderBusinessHours = function() { + return this.timeGrid.unrenderBusinessHours(); + }; + + TimelineView.prototype.getNowIndicatorUnit = function() { + return this.timeGrid.getNowIndicatorUnit(); + }; + + TimelineView.prototype.renderNowIndicator = function(date) { + return this.timeGrid.renderNowIndicator(date); + }; + + TimelineView.prototype.unrenderNowIndicator = function() { + return this.timeGrid.unrenderNowIndicator(); + }; + + TimelineView.prototype.prepareHits = function() { + return this.timeGrid.prepareHits(); + }; + + TimelineView.prototype.releaseHits = function() { + return this.timeGrid.releaseHits(); + }; + + TimelineView.prototype.queryHit = function(leftOffset, topOffset) { + return this.timeGrid.queryHit(leftOffset, topOffset); + }; + + TimelineView.prototype.getHitSpan = function(hit) { + return this.timeGrid.getHitSpan(hit); + }; + + TimelineView.prototype.getHitEl = function(hit) { + return this.timeGrid.getHitEl(hit); + }; + + TimelineView.prototype.updateWidth = function() { + return this.timeGrid.updateWidth(); + }; + + TimelineView.prototype.setHeight = function(totalHeight, isAuto) { + var bodyHeight; + if (isAuto) { + bodyHeight = 'auto'; + } else { + bodyHeight = totalHeight - this.timeGrid.headHeight() - this.queryMiscHeight(); + } + return this.timeGrid.bodyScroller.setHeight(bodyHeight); + }; + + TimelineView.prototype.queryMiscHeight = function() { + return this.el.outerHeight() - this.timeGrid.headScroller.el.outerHeight() - this.timeGrid.bodyScroller.el.outerHeight(); + }; + + TimelineView.prototype.computeInitialScroll = function(prevScrollState) { + return this.timeGrid.computeInitialScroll(prevScrollState); + }; + + TimelineView.prototype.queryScroll = function() { + return this.timeGrid.queryScroll(); + }; + + TimelineView.prototype.setScroll = function(state) { + return this.timeGrid.setScroll(state); + }; + + TimelineView.prototype.renderEvents = function(events) { + this.timeGrid.renderEvents(events); + return this.updateWidth(); + }; + + TimelineView.prototype.unrenderEvents = function() { + this.timeGrid.unrenderEvents(); + return this.updateWidth(); + }; + + TimelineView.prototype.renderDrag = function(dropLocation, seg) { + return this.timeGrid.renderDrag(dropLocation, seg); + }; + + TimelineView.prototype.unrenderDrag = function() { + return this.timeGrid.unrenderDrag(); + }; + + TimelineView.prototype.getEventSegs = function() { + return this.timeGrid.getEventSegs(); + }; + + TimelineView.prototype.renderSelection = function(range) { + return this.timeGrid.renderSelection(range); + }; + + TimelineView.prototype.unrenderSelection = function() { + return this.timeGrid.unrenderSelection(); + }; + + return TimelineView; + +})(View); + +cssToStr = FC.cssToStr; + +TimelineGrid = (function(superClass) { + extend(TimelineGrid, superClass); + + TimelineGrid.prototype.slotDates = null; + + TimelineGrid.prototype.slotCnt = null; + + TimelineGrid.prototype.snapCnt = null; + + TimelineGrid.prototype.snapsPerSlot = null; + + TimelineGrid.prototype.snapDiffToIndex = null; + + TimelineGrid.prototype.snapIndexToDiff = null; + + TimelineGrid.prototype.headEl = null; + + TimelineGrid.prototype.slatContainerEl = null; + + TimelineGrid.prototype.slatEls = null; + + TimelineGrid.prototype.containerCoordCache = null; + + TimelineGrid.prototype.slatCoordCache = null; + + TimelineGrid.prototype.slatInnerCoordCache = null; + + TimelineGrid.prototype.headScroller = null; + + TimelineGrid.prototype.bodyScroller = null; + + TimelineGrid.prototype.joiner = null; + + TimelineGrid.prototype.follower = null; + + TimelineGrid.prototype.eventTitleFollower = null; + + TimelineGrid.prototype.minTime = null; + + TimelineGrid.prototype.maxTime = null; + + TimelineGrid.prototype.timeWindowMs = null; + + TimelineGrid.prototype.slotDuration = null; + + TimelineGrid.prototype.snapDuration = null; + + TimelineGrid.prototype.duration = null; + + TimelineGrid.prototype.labelInterval = null; + + TimelineGrid.prototype.headerFormats = null; + + TimelineGrid.prototype.isTimeScale = null; + + TimelineGrid.prototype.largeUnit = null; + + TimelineGrid.prototype.emphasizeWeeks = false; + + TimelineGrid.prototype.titleFollower = null; + + TimelineGrid.prototype.segContainerEl = null; + + TimelineGrid.prototype.segContainerHeight = null; + + TimelineGrid.prototype.bgSegContainerEl = null; + + TimelineGrid.prototype.helperEls = null; + + TimelineGrid.prototype.innerEl = null; + + function TimelineGrid() { + var input; + TimelineGrid.__super__.constructor.apply(this, arguments); + this.initScaleProps(); + this.minTime = moment.duration(this.opt('minTime') || '00:00'); + this.maxTime = moment.duration(this.opt('maxTime') || '24:00'); + this.timeWindowMs = this.maxTime - this.minTime; + this.snapDuration = (input = this.opt('snapDuration')) ? moment.duration(input) : this.slotDuration; + this.minResizeDuration = this.snapDuration; + this.snapsPerSlot = divideDurationByDuration(this.slotDuration, this.snapDuration); + this.slotWidth = this.opt('slotWidth'); + } + + TimelineGrid.prototype.opt = function(name) { + return this.view.opt(name); + }; + + TimelineGrid.prototype.isValidDate = function(date) { + var ms; + if (this.view.isHiddenDay(date)) { + return false; + } else if (this.isTimeScale) { + ms = date.time() - this.minTime; + ms = ((ms % 86400000) + 86400000) % 86400000; + return ms < this.timeWindowMs; + } else { + return true; + } + }; + + TimelineGrid.prototype.computeDisplayEventTime = function() { + return !this.isTimeScale; + }; + + TimelineGrid.prototype.computeDisplayEventEnd = function() { + return false; + }; + + TimelineGrid.prototype.computeEventTimeFormat = function() { + return this.opt('extraSmallTimeFormat'); + }; + + + /* + Makes the given date consistent with isTimeScale/largeUnit, + so, either removes the times, ensures a time, or makes it the startOf largeUnit. + Strips all timezones. Returns new copy. + TODO: should maybe be called "normalizeRangeDate". + */ + + TimelineGrid.prototype.normalizeGridDate = function(date) { + var normalDate; + if (this.isTimeScale) { + normalDate = date.clone(); + if (!normalDate.hasTime()) { + normalDate.time(0); + } + } else { + normalDate = date.clone().stripTime(); + if (this.largeUnit) { + normalDate.startOf(this.largeUnit); + } + } + return normalDate; + }; + + TimelineGrid.prototype.normalizeGridRange = function(range) { + var adjustedEnd, normalRange; + if (this.isTimeScale) { + normalRange = { + start: this.normalizeGridDate(range.start), + end: this.normalizeGridDate(range.end) + }; + } else { + normalRange = this.view.computeDayRange(range); + if (this.largeUnit) { + normalRange.start.startOf(this.largeUnit); + adjustedEnd = normalRange.end.clone().startOf(this.largeUnit); + if (!adjustedEnd.isSame(normalRange.end) || !adjustedEnd.isAfter(normalRange.start)) { + adjustedEnd.add(this.slotDuration); + } + normalRange.end = adjustedEnd; + } + } + return normalRange; + }; + + TimelineGrid.prototype.rangeUpdated = function() { + var date, slotDates; + this.start = this.normalizeGridDate(this.start).add(this.minTime); + this.end = this.normalizeGridDate(this.end).subtract(1, 'day').add(this.maxTime); + slotDates = []; + date = this.start.clone(); + while (date < this.end) { + if (this.isValidDate(date)) { + slotDates.push(date.clone()); + } + date.add(this.slotDuration); + } + this.slotDates = slotDates; + return this.updateGridDates(); + }; + + TimelineGrid.prototype.updateGridDates = function() { + var date, snapDiff, snapDiffToIndex, snapIndex, snapIndexToDiff; + snapIndex = -1; + snapDiff = 0; + snapDiffToIndex = []; + snapIndexToDiff = []; + date = this.start.clone(); + while (date < this.end) { + if (this.isValidDate(date)) { + snapIndex++; + snapDiffToIndex.push(snapIndex); + snapIndexToDiff.push(snapDiff); + } else { + snapDiffToIndex.push(snapIndex + 0.5); + } + date.add(this.snapDuration); + snapDiff++; + } + this.snapDiffToIndex = snapDiffToIndex; + this.snapIndexToDiff = snapIndexToDiff; + this.snapCnt = snapIndex + 1; + return this.slotCnt = this.snapCnt / this.snapsPerSlot; + }; + + TimelineGrid.prototype.spanToSegs = function(span) { + var normalRange, seg; + normalRange = this.normalizeGridRange(span); + if (this.computeDateSnapCoverage(span.start) < this.computeDateSnapCoverage(span.end)) { + seg = intersectRanges(normalRange, this); + if (seg) { + if (seg.isStart && !this.isValidDate(seg.start)) { + seg.isStart = false; + } + if (seg.isEnd && seg.end && !this.isValidDate(seg.end.clone().subtract(1))) { + seg.isEnd = false; + } + return [seg]; + } + } + return []; + }; + + TimelineGrid.prototype.prepareHits = function() { + return this.buildCoords(); + }; + + TimelineGrid.prototype.queryHit = function(leftOffset, topOffset) { + var containerCoordCache, localSnapIndex, partial, slatCoordCache, slatIndex, slatLeft, slatRight, slatWidth, snapIndex, snapLeft, snapRight, snapsPerSlot; + snapsPerSlot = this.snapsPerSlot; + slatCoordCache = this.slatCoordCache; + containerCoordCache = this.containerCoordCache; + if (containerCoordCache.getVerticalIndex(topOffset) != null) { + slatIndex = slatCoordCache.getHorizontalIndex(leftOffset); + if (slatIndex != null) { + slatWidth = slatCoordCache.getWidth(slatIndex); + if (this.isRTL) { + slatRight = slatCoordCache.getRightOffset(slatIndex); + partial = (slatRight - leftOffset) / slatWidth; + localSnapIndex = Math.floor(partial * snapsPerSlot); + snapIndex = slatIndex * snapsPerSlot + localSnapIndex; + snapRight = slatRight - (localSnapIndex / snapsPerSlot) * slatWidth; + snapLeft = snapRight - ((localSnapIndex + 1) / snapsPerSlot) * slatWidth; + } else { + slatLeft = slatCoordCache.getLeftOffset(slatIndex); + partial = (leftOffset - slatLeft) / slatWidth; + localSnapIndex = Math.floor(partial * snapsPerSlot); + snapIndex = slatIndex * snapsPerSlot + localSnapIndex; + snapLeft = slatLeft + (localSnapIndex / snapsPerSlot) * slatWidth; + snapRight = slatLeft + ((localSnapIndex + 1) / snapsPerSlot) * slatWidth; + } + return { + snap: snapIndex, + component: this, + left: snapLeft, + right: snapRight, + top: containerCoordCache.getTopOffset(0), + bottom: containerCoordCache.getBottomOffset(0) + }; + } + } + }; + + TimelineGrid.prototype.getHitSpan = function(hit) { + return this.getSnapRange(hit.snap); + }; + + TimelineGrid.prototype.getHitEl = function(hit) { + return this.getSnapEl(hit.snap); + }; + + TimelineGrid.prototype.getSnapRange = function(snapIndex) { + var end, start; + start = this.start.clone(); + start.add(multiplyDuration(this.snapDuration, this.snapIndexToDiff[snapIndex])); + end = start.clone().add(this.snapDuration); + return { + start: start, + end: end + }; + }; + + TimelineGrid.prototype.getSnapEl = function(snapIndex) { + return this.slatEls.eq(Math.floor(snapIndex / this.snapsPerSlot)); + }; + + TimelineGrid.prototype.renderSkeleton = function() { + this.headScroller = new ClippedScroller({ + overflowX: 'clipped-scroll', + overflowY: 'hidden' + }); + this.headScroller.canvas = new ScrollerCanvas(); + this.headScroller.render(); + this.headEl.append(this.headScroller.el); + this.bodyScroller = new ClippedScroller(); + this.bodyScroller.canvas = new ScrollerCanvas(); + this.bodyScroller.render(); + this.el.append(this.bodyScroller.el); + this.innerEl = this.bodyScroller.canvas.contentEl; + this.slatContainerEl = $('
').appendTo(this.bodyScroller.canvas.bgEl); + this.segContainerEl = $('
').appendTo(this.bodyScroller.canvas.contentEl); + this.bgSegContainerEl = this.bodyScroller.canvas.bgEl; + this.containerCoordCache = new CoordCache({ + els: this.bodyScroller.canvas.el, + isHorizontal: true, + isVertical: true + }); + this.joiner = new ScrollJoiner('horizontal', [this.headScroller, this.bodyScroller]); + if (true) { + this.follower = new ScrollFollower(this.headScroller); + } + if (true) { + this.eventTitleFollower = new ScrollFollower(this.bodyScroller); + this.eventTitleFollower.minTravel = 50; + if (this.isRTL) { + this.eventTitleFollower.containOnNaturalRight = true; + } else { + this.eventTitleFollower.containOnNaturalLeft = true; + } + } + return TimelineGrid.__super__.renderSkeleton.apply(this, arguments); + }; + + TimelineGrid.prototype.headColEls = null; + + TimelineGrid.prototype.slatColEls = null; + + TimelineGrid.prototype.renderDates = function() { + var date, i, j, len, ref; + this.headScroller.canvas.contentEl.html(this.renderHeadHtml()); + this.headColEls = this.headScroller.canvas.contentEl.find('col'); + this.slatContainerEl.html(this.renderSlatHtml()); + this.slatColEls = this.slatContainerEl.find('col'); + this.slatEls = this.slatContainerEl.find('td'); + this.slatCoordCache = new CoordCache({ + els: this.slatEls, + isHorizontal: true + }); + this.slatInnerCoordCache = new CoordCache({ + els: this.slatEls.find('> div'), + isHorizontal: true, + offsetParent: this.bodyScroller.canvas.el + }); + ref = this.slotDates; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + date = ref[i]; + this.view.trigger('dayRender', null, date, this.slatEls.eq(i)); + } + if (this.follower) { + return this.follower.setSprites(this.headEl.find('tr:not(:last-child) span')); + } + }; + + TimelineGrid.prototype.unrenderDates = function() { + if (this.follower) { + this.follower.clearSprites(); + } + this.headScroller.canvas.contentEl.empty(); + this.slatContainerEl.empty(); + this.headScroller.canvas.clearWidth(); + return this.bodyScroller.canvas.clearWidth(); + }; + + TimelineGrid.prototype.renderHeadHtml = function() { + var cell, cellRows, date, dateData, format, formats, html, i, isChrono, isLast, isSuperRow, isWeekStart, j, k, l, labelInterval, leadingCell, len, len1, len2, len3, len4, len5, len6, m, n, newCell, p, prevWeekNumber, q, row, rowCells, slatHtml, slotCells, slotDates, text, weekNumber; + labelInterval = this.labelInterval; + formats = this.headerFormats; + cellRows = (function() { + var j, len, results; + results = []; + for (j = 0, len = formats.length; j < len; j++) { + format = formats[j]; + results.push([]); + } + return results; + })(); + leadingCell = null; + prevWeekNumber = null; + slotDates = this.slotDates; + slotCells = []; + for (j = 0, len = slotDates.length; j < len; j++) { + date = slotDates[j]; + weekNumber = date.week(); + isWeekStart = this.emphasizeWeeks && prevWeekNumber !== null && prevWeekNumber !== weekNumber; + for (row = k = 0, len1 = formats.length; k < len1; row = ++k) { + format = formats[row]; + rowCells = cellRows[row]; + leadingCell = rowCells[rowCells.length - 1]; + isSuperRow = formats.length > 1 && row < formats.length - 1; + newCell = null; + if (isSuperRow) { + text = date.format(format); + dateData = date.format(); + if (!leadingCell || leadingCell.text !== text) { + newCell = { + text: text, + dateData: dateData, + colspan: 1 + }; + } else { + leadingCell.colspan += 1; + } + } else { + if (!leadingCell || isInt(divideRangeByDuration(this.start, date, labelInterval))) { + text = date.format(format); + dateData = date.format(); + newCell = { + text: text, + dateData: dateData, + colspan: 1 + }; + } else { + leadingCell.colspan += 1; + } + } + if (newCell) { + newCell.weekStart = isWeekStart; + rowCells.push(newCell); + } + } + slotCells.push({ + weekStart: isWeekStart + }); + prevWeekNumber = weekNumber; + } + isChrono = labelInterval > this.slotDuration; + html = ''; + html += ''; + for (l = 0, len2 = slotDates.length; l < len2; l++) { + date = slotDates[l]; + html += ''; + } + html += ''; + html += ''; + for (i = m = 0, len3 = cellRows.length; m < len3; i = ++m) { + rowCells = cellRows[i]; + isLast = i === cellRows.length - 1; + html += ''; + for (n = 0, len4 = rowCells.length; n < len4; n++) { + cell = rowCells[n]; + html += ''; + } + html += ''; + } + html += '
1 ? ' colspan="' + cell.colspan + '"' : '') + '>' + '
' + '' + htmlEscape(cell.text) + '' + '
' + '
'; + slatHtml = ''; + slatHtml += ''; + for (p = 0, len5 = slotCells.length; p < len5; p++) { + cell = slotCells[p]; + slatHtml += ''; + } + slatHtml += ''; + slatHtml += ''; + for (i = q = 0, len6 = slotCells.length; q < len6; i = ++q) { + cell = slotCells[i]; + date = slotDates[i]; + slatHtml += this.slatCellHtml(date, cell.weekStart); + } + slatHtml += '
'; + this._slatHtml = slatHtml; + return html; + }; + + TimelineGrid.prototype.renderSlatHtml = function() { + return this._slatHtml; + }; + + TimelineGrid.prototype.slatCellHtml = function(date, isEm) { + var classes; + if (this.isTimeScale) { + classes = []; + classes.push(isInt(divideRangeByDuration(this.start, date, this.labelInterval)) ? 'fc-major' : 'fc-minor'); + } else { + classes = this.getDayClasses(date); + classes.push('fc-day'); + } + classes.unshift(this.view.widgetContentClass); + if (isEm) { + classes.push('fc-em-cell'); + } + return '
'; + }; + + TimelineGrid.prototype.businessHourSegs = null; + + TimelineGrid.prototype.renderBusinessHours = function() { + var events, segs; + if (!this.largeUnit) { + events = this.view.calendar.getBusinessHoursEvents(!this.isTimeScale); + segs = this.businessHourSegs = this.eventsToSegs(events); + return this.renderFill('businessHours', segs, 'bgevent'); + } + }; + + TimelineGrid.prototype.unrenderBusinessHours = function() { + return this.unrenderFill('businessHours'); + }; + + TimelineGrid.prototype.nowIndicatorEls = null; + + TimelineGrid.prototype.getNowIndicatorUnit = function() { + if (this.isTimeScale) { + return computeIntervalUnit(this.slotDuration); + } + }; + + TimelineGrid.prototype.renderNowIndicator = function(date) { + var coord, css, nodes; + nodes = []; + date = this.normalizeGridDate(date); + if (date >= this.start && date < this.end) { + coord = this.dateToCoord(date); + css = this.isRTL ? { + right: -coord + } : { + left: coord + }; + nodes.push($("
").css(css).appendTo(this.headScroller.canvas.el)[0]); + nodes.push($("
").css(css).appendTo(this.bodyScroller.canvas.el)[0]); + } + return this.nowIndicatorEls = $(nodes); + }; + + TimelineGrid.prototype.unrenderNowIndicator = function() { + if (this.nowIndicatorEls) { + this.nowIndicatorEls.remove(); + return this.nowIndicatorEls = null; + } + }; + + TimelineGrid.prototype.explicitSlotWidth = null; + + TimelineGrid.prototype.defaultSlotWidth = null; + + TimelineGrid.prototype.updateWidth = function() { + var availableWidth, containerMinWidth, containerWidth, nonLastSlotWidth, slotWidth; + slotWidth = Math.round(this.slotWidth || (this.slotWidth = this.computeSlotWidth())); + containerWidth = slotWidth * this.slotDates.length; + containerMinWidth = ''; + nonLastSlotWidth = slotWidth; + availableWidth = this.bodyScroller.getClientWidth(); + if (availableWidth > containerWidth) { + containerMinWidth = availableWidth; + containerWidth = ''; + nonLastSlotWidth = Math.floor(availableWidth / this.slotDates.length); + } + this.headScroller.canvas.setWidth(containerWidth); + this.headScroller.canvas.setMinWidth(containerMinWidth); + this.bodyScroller.canvas.setWidth(containerWidth); + this.bodyScroller.canvas.setMinWidth(containerMinWidth); + this.headColEls.slice(0, -1).add(this.slatColEls.slice(0, -1)).width(nonLastSlotWidth); + this.headScroller.updateSize(); + this.bodyScroller.updateSize(); + this.joiner.update(); + this.buildCoords(); + this.updateSegPositions(); + if (this.follower) { + this.follower.update(); + } + if (this.eventTitleFollower) { + return this.eventTitleFollower.update(); + } + }; + + TimelineGrid.prototype.computeSlotWidth = function() { + var headerWidth, innerEls, maxInnerWidth, minWidth, slotWidth, slotsPerLabel; + maxInnerWidth = 0; + innerEls = this.headEl.find('tr:last-child th span'); + innerEls.each(function(i, node) { + var innerWidth; + innerWidth = $(node).outerWidth(); + return maxInnerWidth = Math.max(maxInnerWidth, innerWidth); + }); + headerWidth = maxInnerWidth + 1; + slotsPerLabel = divideDurationByDuration(this.labelInterval, this.slotDuration); + slotWidth = Math.ceil(headerWidth / slotsPerLabel); + minWidth = this.headColEls.eq(0).css('min-width'); + if (minWidth) { + minWidth = parseInt(minWidth, 10); + if (minWidth) { + slotWidth = Math.max(slotWidth, minWidth); + } + } + return slotWidth; + }; + + TimelineGrid.prototype.buildCoords = function() { + this.containerCoordCache.build(); + this.slatCoordCache.build(); + return this.slatInnerCoordCache.build(); + }; + + TimelineGrid.prototype.computeDateSnapCoverage = function(date) { + var snapCoverage, snapDiff, snapDiffInt; + snapDiff = divideRangeByDuration(this.start, date, this.snapDuration); + if (snapDiff < 0) { + return 0; + } else if (snapDiff >= this.snapDiffToIndex.length) { + return this.snapCnt; + } else { + snapDiffInt = Math.floor(snapDiff); + snapCoverage = this.snapDiffToIndex[snapDiffInt]; + if (isInt(snapCoverage)) { + snapCoverage += snapDiff - snapDiffInt; + } else { + snapCoverage = Math.ceil(snapCoverage); + } + return snapCoverage; + } + }; + + TimelineGrid.prototype.dateToCoord = function(date) { + var coordCache, partial, slotCoverage, slotIndex, snapCoverage; + snapCoverage = this.computeDateSnapCoverage(date); + slotCoverage = snapCoverage / this.snapsPerSlot; + slotIndex = Math.floor(slotCoverage); + slotIndex = Math.min(slotIndex, this.slotCnt - 1); + partial = slotCoverage - slotIndex; + coordCache = this.slatInnerCoordCache; + if (this.isRTL) { + return (coordCache.getRightPosition(slotIndex) - coordCache.getWidth(slotIndex) * partial) - this.containerCoordCache.getWidth(0); + } else { + return coordCache.getLeftPosition(slotIndex) + coordCache.getWidth(slotIndex) * partial; + } + }; + + TimelineGrid.prototype.rangeToCoords = function(range) { + if (this.isRTL) { + return { + right: this.dateToCoord(range.start), + left: this.dateToCoord(range.end) + }; + } else { + return { + left: this.dateToCoord(range.start), + right: this.dateToCoord(range.end) + }; + } + }; + + TimelineGrid.prototype.headHeight = function() { + var table; + table = this.headScroller.canvas.contentEl.find('table'); + return table.height.apply(table, arguments); + }; + + TimelineGrid.prototype.updateSegPositions = function() { + var coords, j, len, seg, segs; + segs = (this.segs || []).concat(this.businessHourSegs || []); + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + coords = this.rangeToCoords(seg); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + } + }; + + TimelineGrid.prototype.computeInitialScroll = function(prevState) { + var left, scrollTime; + left = 0; + if (this.isTimeScale) { + scrollTime = this.opt('scrollTime'); + if (scrollTime) { + scrollTime = moment.duration(scrollTime); + left = this.dateToCoord(this.start.clone().time(scrollTime)); + } + } + return { + left: left, + top: 0 + }; + }; + + TimelineGrid.prototype.queryScroll = function() { + return { + left: this.bodyScroller.getScrollLeft(), + top: this.bodyScroller.getScrollTop() + }; + }; + + TimelineGrid.prototype.setScroll = function(state) { + this.headScroller.setScrollLeft(state.left); + this.headScroller.setScrollLeft(state.left); + return this.bodyScroller.setScrollTop(state.top); + }; + + TimelineGrid.prototype.renderFgSegs = function(segs) { + segs = this.renderFgSegEls(segs); + this.renderFgSegsInContainers([[this, segs]]); + this.updateSegFollowers(segs); + return segs; + }; + + TimelineGrid.prototype.unrenderFgSegs = function() { + this.clearSegFollowers(); + return this.unrenderFgContainers([this]); + }; + + TimelineGrid.prototype.renderFgSegsInContainers = function(pairs) { + var container, coords, j, k, l, len, len1, len2, len3, len4, len5, len6, len7, m, n, p, q, r, ref, ref1, ref2, ref3, results, seg, segs; + for (j = 0, len = pairs.length; j < len; j++) { + ref = pairs[j], container = ref[0], segs = ref[1]; + for (k = 0, len1 = segs.length; k < len1; k++) { + seg = segs[k]; + coords = this.rangeToCoords(seg); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + } + } + for (l = 0, len2 = pairs.length; l < len2; l++) { + ref1 = pairs[l], container = ref1[0], segs = ref1[1]; + for (m = 0, len3 = segs.length; m < len3; m++) { + seg = segs[m]; + seg.el.appendTo(container.segContainerEl); + } + } + for (n = 0, len4 = pairs.length; n < len4; n++) { + ref2 = pairs[n], container = ref2[0], segs = ref2[1]; + for (p = 0, len5 = segs.length; p < len5; p++) { + seg = segs[p]; + seg.height = seg.el.outerHeight(true); + } + this.buildSegLevels(segs); + container.segContainerHeight = computeOffsetForSegs(segs); + } + results = []; + for (q = 0, len6 = pairs.length; q < len6; q++) { + ref3 = pairs[q], container = ref3[0], segs = ref3[1]; + for (r = 0, len7 = segs.length; r < len7; r++) { + seg = segs[r]; + seg.el.css('top', seg.top); + } + results.push(container.segContainerEl.height(container.segContainerHeight)); + } + return results; + }; + + TimelineGrid.prototype.buildSegLevels = function(segs) { + var belowSeg, isLevelCollision, j, k, l, len, len1, len2, level, placedSeg, ref, ref1, segLevels, unplacedSeg; + segLevels = []; + this.sortEventSegs(segs); + for (j = 0, len = segs.length; j < len; j++) { + unplacedSeg = segs[j]; + unplacedSeg.above = []; + level = 0; + while (level < segLevels.length) { + isLevelCollision = false; + ref = segLevels[level]; + for (k = 0, len1 = ref.length; k < len1; k++) { + placedSeg = ref[k]; + if (timeRowSegsCollide(unplacedSeg, placedSeg)) { + unplacedSeg.above.push(placedSeg); + isLevelCollision = true; + } + } + if (isLevelCollision) { + level += 1; + } else { + break; + } + } + (segLevels[level] || (segLevels[level] = [])).push(unplacedSeg); + level += 1; + while (level < segLevels.length) { + ref1 = segLevels[level]; + for (l = 0, len2 = ref1.length; l < len2; l++) { + belowSeg = ref1[l]; + if (timeRowSegsCollide(unplacedSeg, belowSeg)) { + belowSeg.above.push(unplacedSeg); + } + } + level += 1; + } + } + return segLevels; + }; + + TimelineGrid.prototype.unrenderFgContainers = function(containers) { + var container, j, len, results; + results = []; + for (j = 0, len = containers.length; j < len; j++) { + container = containers[j]; + container.segContainerEl.empty(); + container.segContainerEl.height(''); + results.push(container.segContainerHeight = null); + } + return results; + }; + + TimelineGrid.prototype.fgSegHtml = function(seg, disableResizing) { + var classes, event, isDraggable, isResizableFromEnd, isResizableFromStart, timeText; + event = seg.event; + isDraggable = this.view.isEventDraggable(event); + isResizableFromStart = seg.isStart && this.view.isEventResizableFromStart(event); + isResizableFromEnd = seg.isEnd && this.view.isEventResizableFromEnd(event); + classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd); + classes.unshift('fc-timeline-event', 'fc-h-event'); + timeText = this.getEventTimeText(event); + return '' + '
' + (timeText ? '' + htmlEscape(timeText) + '' : '') + '' + (event.title ? htmlEscape(event.title) : ' ') + '' + '
' + '
' + (isResizableFromStart ? '
' : '') + (isResizableFromEnd ? '
' : '') + '
'; + }; + + TimelineGrid.prototype.updateSegFollowers = function(segs) { + var j, len, seg, sprites, titleEl; + if (this.eventTitleFollower) { + sprites = []; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + titleEl = seg.el.find('.fc-title'); + if (titleEl.length) { + sprites.push(new ScrollFollowerSprite(titleEl)); + } + } + return this.eventTitleFollower.setSprites(sprites); + } + }; + + TimelineGrid.prototype.clearSegFollowers = function() { + if (this.eventTitleFollower) { + return this.eventTitleFollower.clearSprites(); + } + }; + + TimelineGrid.prototype.segDragStart = function() { + TimelineGrid.__super__.segDragStart.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.forceRelative(); + } + }; + + TimelineGrid.prototype.segDragEnd = function() { + TimelineGrid.__super__.segDragEnd.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.clearForce(); + } + }; + + TimelineGrid.prototype.segResizeStart = function() { + TimelineGrid.__super__.segResizeStart.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.forceRelative(); + } + }; + + TimelineGrid.prototype.segResizeEnd = function() { + TimelineGrid.__super__.segResizeEnd.apply(this, arguments); + if (this.eventTitleFollower) { + return this.eventTitleFollower.clearForce(); + } + }; + + TimelineGrid.prototype.renderHelper = function(event, sourceSeg) { + var segs; + segs = this.eventToSegs(event); + segs = this.renderFgSegEls(segs); + return this.renderHelperSegsInContainers([[this, segs]], sourceSeg); + }; + + TimelineGrid.prototype.renderHelperSegsInContainers = function(pairs, sourceSeg) { + var containerObj, coords, helperContainerEl, helperNodes, j, k, l, len, len1, len2, len3, m, ref, ref1, ref2, seg, segNodes, segs; + helperNodes = []; + segNodes = []; + for (j = 0, len = pairs.length; j < len; j++) { + ref = pairs[j], containerObj = ref[0], segs = ref[1]; + for (k = 0, len1 = segs.length; k < len1; k++) { + seg = segs[k]; + coords = this.rangeToCoords(seg); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + if (sourceSeg && sourceSeg.resourceId === ((ref1 = containerObj.resource) != null ? ref1.id : void 0)) { + seg.el.css('top', sourceSeg.el.css('top')); + } else { + seg.el.css('top', 0); + } + } + } + for (l = 0, len2 = pairs.length; l < len2; l++) { + ref2 = pairs[l], containerObj = ref2[0], segs = ref2[1]; + helperContainerEl = $('
').appendTo(containerObj.innerEl); + helperNodes.push(helperContainerEl[0]); + for (m = 0, len3 = segs.length; m < len3; m++) { + seg = segs[m]; + helperContainerEl.append(seg.el); + segNodes.push(seg.el[0]); + } + } + if (this.helperEls) { + this.helperEls = this.helperEls.add($(helperNodes)); + } else { + this.helperEls = $(helperNodes); + } + return $(segNodes); + }; + + TimelineGrid.prototype.unrenderHelper = function() { + if (this.helperEls) { + this.helperEls.remove(); + return this.helperEls = null; + } + }; + + TimelineGrid.prototype.renderEventResize = function(resizeLocation, seg) { + this.renderHighlight(this.eventToSpan(resizeLocation)); + return this.renderEventLocationHelper(resizeLocation, seg); + }; + + TimelineGrid.prototype.unrenderEventResize = function() { + this.unrenderHighlight(); + return this.unrenderHelper(); + }; + + TimelineGrid.prototype.renderFill = function(type, segs, className) { + segs = this.renderFillSegEls(type, segs); + this.renderFillInContainers(type, [[this, segs]], className); + return segs; + }; + + TimelineGrid.prototype.renderFillInContainers = function(type, pairs, className) { + var containerObj, j, len, ref, results, segs; + results = []; + for (j = 0, len = pairs.length; j < len; j++) { + ref = pairs[j], containerObj = ref[0], segs = ref[1]; + results.push(this.renderFillInContainer(type, containerObj, segs, className)); + } + return results; + }; + + TimelineGrid.prototype.renderFillInContainer = function(type, containerObj, segs, className) { + var containerEl, coords, j, len, seg; + if (segs.length) { + className || (className = type.toLowerCase()); + containerEl = $('
').appendTo(containerObj.bgSegContainerEl); + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + coords = this.rangeToCoords(seg); + seg.el.css({ + left: (seg.left = coords.left), + right: -(seg.right = coords.right) + }); + seg.el.appendTo(containerEl); + } + if (this.elsByFill[type]) { + return this.elsByFill[type] = this.elsByFill[type].add(containerEl); + } else { + return this.elsByFill[type] = containerEl; + } + } + }; + + TimelineGrid.prototype.renderDrag = function(dropLocation, seg) { + if (seg) { + return this.renderEventLocationHelper(dropLocation, seg); + } else { + this.renderHighlight(this.eventToSpan(dropLocation)); + return null; + } + }; + + TimelineGrid.prototype.unrenderDrag = function() { + this.unrenderHelper(); + return this.unrenderHighlight(); + }; + + return TimelineGrid; + +})(Grid); + +computeOffsetForSegs = function(segs) { + var j, len, max, seg; + max = 0; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + max = Math.max(max, computeOffsetForSeg(seg)); + } + return max; +}; + +computeOffsetForSeg = function(seg) { + if (seg.top == null) { + seg.top = computeOffsetForSegs(seg.above); + } + return seg.top + seg.height; +}; + +timeRowSegsCollide = function(seg0, seg1) { + return seg0.left < seg1.right && seg0.right > seg1.left; +}; + +MIN_AUTO_LABELS = 18; + +MAX_AUTO_SLOTS_PER_LABEL = 6; + +MAX_AUTO_CELLS = 200; + +MAX_CELLS = 1000; + +DEFAULT_GRID_DURATION = { + months: 1 +}; + +STOCK_SUB_DURATIONS = [ + { + 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 + } +]; + +TimelineGrid.prototype.initScaleProps = function() { + var input, slotUnit, type; + this.labelInterval = this.queryDurationOption('slotLabelInterval'); + this.slotDuration = this.queryDurationOption('slotDuration'); + this.ensureGridDuration(); + this.validateLabelAndSlot(); + this.ensureLabelInterval(); + this.ensureSlotDuration(); + input = this.opt('slotLabelFormat'); + type = $.type(input); + this.headerFormats = type === 'array' ? input : type === 'string' ? [input] : this.computeHeaderFormats(); + this.isTimeScale = durationHasTime(this.slotDuration); + this.largeUnit = !this.isTimeScale ? (slotUnit = computeIntervalUnit(this.slotDuration), /year|month|week/.test(slotUnit) ? slotUnit : void 0) : void 0; + return this.emphasizeWeeks = this.slotDuration.as('days') === 1 && this.duration.as('weeks') >= 2 && !this.opt('businessHours'); + + /* + console.log('view duration =', @duration.humanize()) + console.log('label interval =', @labelInterval.humanize()) + console.log('slot duration =', @slotDuration.humanize()) + console.log('header formats =', @headerFormats) + console.log('isTimeScale', @isTimeScale) + console.log('largeUnit', @largeUnit) + */ +}; + +TimelineGrid.prototype.queryDurationOption = function(name) { + var dur, input; + input = this.opt(name); + if (input != null) { + dur = moment.duration(input); + if (+dur) { + return dur; + } + } +}; + +TimelineGrid.prototype.validateLabelAndSlot = function() { + var labelCnt, slotCnt, slotsPerLabel; + if (this.labelInterval) { + labelCnt = divideDurationByDuration(this.duration, this.labelInterval); + if (labelCnt > MAX_CELLS) { + FC.warn('slotLabelInterval results in too many cells'); + this.labelInterval = null; + } + } + if (this.slotDuration) { + slotCnt = divideDurationByDuration(this.duration, this.slotDuration); + if (slotCnt > MAX_CELLS) { + FC.warn('slotDuration results in too many cells'); + this.slotDuration = null; + } + } + if (this.labelInterval && this.slotDuration) { + slotsPerLabel = divideDurationByDuration(this.labelInterval, this.slotDuration); + if (!isInt(slotsPerLabel) || slotsPerLabel < 1) { + FC.warn('slotLabelInterval must be a multiple of slotDuration'); + return this.slotDuration = null; + } + } +}; + +TimelineGrid.prototype.ensureGridDuration = function() { + var gridDuration, input, j, labelCnt, labelInterval; + gridDuration = this.duration; + if (!gridDuration) { + gridDuration = this.view.intervalDuration; + if (!gridDuration) { + if (!this.labelInterval && !this.slotDuration) { + gridDuration = moment.duration(DEFAULT_GRID_DURATION); + } else { + labelInterval = this.ensureLabelInterval(); + for (j = STOCK_SUB_DURATIONS.length - 1; j >= 0; j += -1) { + input = STOCK_SUB_DURATIONS[j]; + gridDuration = moment.duration(input); + labelCnt = divideDurationByDuration(gridDuration, labelInterval); + if (labelCnt >= MIN_AUTO_LABELS) { + break; + } + } + } + } + this.duration = gridDuration; + } + return gridDuration; +}; + +TimelineGrid.prototype.ensureLabelInterval = function() { + var input, j, k, labelCnt, labelInterval, len, len1, slotsPerLabel, tryLabelInterval; + labelInterval = this.labelInterval; + if (!labelInterval) { + if (!this.duration && !this.slotDuration) { + this.ensureGridDuration(); + } + if (this.slotDuration) { + for (j = 0, len = STOCK_SUB_DURATIONS.length; j < len; j++) { + input = STOCK_SUB_DURATIONS[j]; + tryLabelInterval = moment.duration(input); + slotsPerLabel = divideDurationByDuration(tryLabelInterval, this.slotDuration); + if (isInt(slotsPerLabel) && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { + labelInterval = tryLabelInterval; + break; + } + } + if (!labelInterval) { + labelInterval = this.slotDuration; + } + } else { + for (k = 0, len1 = STOCK_SUB_DURATIONS.length; k < len1; k++) { + input = STOCK_SUB_DURATIONS[k]; + labelInterval = moment.duration(input); + labelCnt = divideDurationByDuration(this.duration, labelInterval); + if (labelCnt >= MIN_AUTO_LABELS) { + break; + } + } + } + this.labelInterval = labelInterval; + } + return labelInterval; +}; + +TimelineGrid.prototype.ensureSlotDuration = function() { + var input, j, labelInterval, len, slotCnt, slotDuration, slotsPerLabel, trySlotDuration; + slotDuration = this.slotDuration; + if (!slotDuration) { + labelInterval = this.ensureLabelInterval(); + for (j = 0, len = STOCK_SUB_DURATIONS.length; j < len; j++) { + input = STOCK_SUB_DURATIONS[j]; + trySlotDuration = moment.duration(input); + slotsPerLabel = divideDurationByDuration(labelInterval, trySlotDuration); + if (isInt(slotsPerLabel) && slotsPerLabel > 1 && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) { + slotDuration = trySlotDuration; + break; + } + } + if (slotDuration && this.duration) { + slotCnt = divideDurationByDuration(this.duration, slotDuration); + if (slotCnt > MAX_AUTO_CELLS) { + slotDuration = null; + } + } + if (!slotDuration) { + slotDuration = labelInterval; + } + this.slotDuration = slotDuration; + } + return slotDuration; +}; + +TimelineGrid.prototype.computeHeaderFormats = function() { + var format0, format1, format2, gridDuration, labelInterval, unit, view, weekNumbersVisible; + view = this.view; + gridDuration = this.duration; + labelInterval = this.labelInterval; + unit = computeIntervalUnit(labelInterval); + weekNumbersVisible = this.opt('weekNumbers'); + format0 = format1 = format2 = null; + if (unit === 'week' && !weekNumbersVisible) { + unit = 'day'; + } + switch (unit) { + case 'year': + format0 = 'YYYY'; + break; + case 'month': + if (gridDuration.asYears() > 1) { + format0 = 'YYYY'; + } + format1 = 'MMM'; + break; + case 'week': + if (gridDuration.asYears() > 1) { + format0 = 'YYYY'; + } + format1 = this.opt('shortWeekFormat'); + break; + case 'day': + if (gridDuration.asYears() > 1) { + format0 = this.opt('monthYearFormat'); + } else if (gridDuration.asMonths() > 1) { + format0 = 'MMMM'; + } + if (weekNumbersVisible) { + format1 = this.opt('weekFormat'); + } + format2 = 'dd D'; + break; + case 'hour': + if (weekNumbersVisible) { + format0 = this.opt('weekFormat'); + } + if (gridDuration.asDays() > 1) { + format1 = this.opt('dayOfMonthFormat'); + } + format2 = this.opt('smallTimeFormat'); + break; + case 'minute': + if (labelInterval.asMinutes() / 60 >= MAX_AUTO_SLOTS_PER_LABEL) { + format0 = this.opt('hourFormat'); + format1 = '[:]mm'; + } else { + format0 = this.opt('mediumTimeFormat'); + } + break; + case 'second': + if (labelInterval.asSeconds() / 60 >= MAX_AUTO_SLOTS_PER_LABEL) { + format0 = 'LT'; + format1 = '[:]ss'; + } else { + format0 = 'LTS'; + } + break; + case 'millisecond': + format0 = 'LTS'; + format1 = '[.]SSS'; + } + return [].concat(format0 || [], format1 || [], format2 || []); +}; + +FC.views.timeline = { + "class": TimelineView, + defaults: { + eventResizableFromStart: true + } +}; + +FC.views.timelineDay = { + type: 'timeline', + duration: { + days: 1 + } +}; + +FC.views.timelineWeek = { + type: 'timeline', + duration: { + weeks: 1 + } +}; + +FC.views.timelineMonth = { + type: 'timeline', + duration: { + months: 1 + } +}; + +FC.views.timelineYear = { + type: 'timeline', + duration: { + years: 1 + } +}; + +ResourceTimelineView = (function(superClass) { + extend(ResourceTimelineView, superClass); + + function ResourceTimelineView() { + return ResourceTimelineView.__super__.constructor.apply(this, arguments); + } + + ResourceTimelineView.mixin(ResourceViewMixin); + + ResourceTimelineView.prototype.resourceGrid = null; + + ResourceTimelineView.prototype.tbodyHash = null; + + ResourceTimelineView.prototype.joiner = null; + + ResourceTimelineView.prototype.dividerEls = null; + + ResourceTimelineView.prototype.superHeaderText = null; + + ResourceTimelineView.prototype.isVGrouping = null; + + ResourceTimelineView.prototype.isHGrouping = null; + + ResourceTimelineView.prototype.groupSpecs = null; + + ResourceTimelineView.prototype.colSpecs = null; + + ResourceTimelineView.prototype.orderSpecs = null; + + ResourceTimelineView.prototype.rowHierarchy = null; + + ResourceTimelineView.prototype.resourceRowHash = null; + + ResourceTimelineView.prototype.nestingCnt = 0; + + ResourceTimelineView.prototype.isNesting = null; + + ResourceTimelineView.prototype.dividerWidth = null; + + ResourceTimelineView.prototype.initialize = function() { + ResourceTimelineView.__super__.initialize.apply(this, arguments); + this.processResourceOptions(); + this.resourceGrid = new Spreadsheet(this); + this.rowHierarchy = new RowParent(this); + return this.resourceRowHash = {}; + }; + + ResourceTimelineView.prototype.instantiateGrid = function() { + return new ResourceTimelineGrid(this); + }; + + ResourceTimelineView.prototype.processResourceOptions = function() { + var allColSpecs, allOrderSpecs, colSpec, defaultLabelText, groupColSpecs, groupSpec, groupSpecs, hGroupField, isGroup, isHGrouping, isVGrouping, j, k, l, labelText, len, len1, len2, orderSpec, plainColSpecs, plainOrderSpecs, superHeaderText; + allColSpecs = this.opt('resourceColumns') || []; + labelText = this.opt('resourceLabelText'); + defaultLabelText = 'Resources'; + superHeaderText = null; + if (!allColSpecs.length) { + allColSpecs.push({ + labelText: labelText || defaultLabelText, + text: this.getResourceTextFunc() + }); + } else { + superHeaderText = labelText; + } + plainColSpecs = []; + groupColSpecs = []; + groupSpecs = []; + isVGrouping = false; + isHGrouping = false; + for (j = 0, len = allColSpecs.length; j < len; j++) { + colSpec = allColSpecs[j]; + if (colSpec.group) { + groupColSpecs.push(colSpec); + } else { + plainColSpecs.push(colSpec); + } + } + plainColSpecs[0].isMain = true; + if (groupColSpecs.length) { + groupSpecs = groupColSpecs; + isVGrouping = true; + } else { + hGroupField = this.opt('resourceGroupField'); + if (hGroupField) { + isHGrouping = true; + groupSpecs.push({ + field: hGroupField, + text: this.opt('resourceGroupText'), + render: this.opt('resourceGroupRender') + }); + } + } + allOrderSpecs = parseFieldSpecs(this.opt('resourceOrder')); + plainOrderSpecs = []; + for (k = 0, len1 = allOrderSpecs.length; k < len1; k++) { + orderSpec = allOrderSpecs[k]; + isGroup = false; + for (l = 0, len2 = groupSpecs.length; l < len2; l++) { + groupSpec = groupSpecs[l]; + if (groupSpec.field === orderSpec.field) { + groupSpec.order = orderSpec.order; + isGroup = true; + break; + } + } + if (!isGroup) { + plainOrderSpecs.push(orderSpec); + } + } + this.superHeaderText = superHeaderText; + this.isVGrouping = isVGrouping; + this.isHGrouping = isHGrouping; + this.groupSpecs = groupSpecs; + this.colSpecs = groupColSpecs.concat(plainColSpecs); + return this.orderSpecs = plainOrderSpecs; + }; + + ResourceTimelineView.prototype.renderSkeleton = function() { + ResourceTimelineView.__super__.renderSkeleton.apply(this, arguments); + this.renderResourceGridSkeleton(); + this.tbodyHash = { + spreadsheet: this.resourceGrid.tbodyEl, + event: this.timeGrid.tbodyEl + }; + this.joiner = new ScrollJoiner('vertical', [this.resourceGrid.bodyScroller, this.timeGrid.bodyScroller]); + return this.initDividerMoving(); + }; + + ResourceTimelineView.prototype.renderSkeletonHtml = function() { + return '
'; + }; + + ResourceTimelineView.prototype.renderResourceGridSkeleton = function() { + this.resourceGrid.el = this.el.find('tbody .fc-resource-area'); + this.resourceGrid.headEl = this.el.find('thead .fc-resource-area'); + return this.resourceGrid.renderSkeleton(); + }; + + ResourceTimelineView.prototype.initDividerMoving = function() { + var ref; + this.dividerEls = this.el.find('.fc-divider'); + this.dividerWidth = (ref = this.opt('resourceAreaWidth')) != null ? ref : this.resourceGrid.tableWidth; + if (this.dividerWidth != null) { + this.positionDivider(this.dividerWidth); + } + return this.dividerEls.on('mousedown', (function(_this) { + return function(ev) { + return _this.dividerMousedown(ev); + }; + })(this)); + }; + + ResourceTimelineView.prototype.dividerMousedown = function(ev) { + var dragListener, isRTL, maxWidth, minWidth, origWidth; + isRTL = this.opt('isRTL'); + minWidth = 30; + maxWidth = this.el.width() - 30; + origWidth = this.getNaturalDividerWidth(); + dragListener = new DragListener({ + dragStart: (function(_this) { + return function() { + return _this.dividerEls.addClass('fc-active'); + }; + })(this), + drag: (function(_this) { + return function(dx, dy) { + var width; + if (isRTL) { + width = origWidth - dx; + } else { + width = origWidth + dx; + } + width = Math.max(width, minWidth); + width = Math.min(width, maxWidth); + _this.dividerWidth = width; + _this.positionDivider(width); + return _this.updateWidth(); + }; + })(this), + dragEnd: (function(_this) { + return function() { + return _this.dividerEls.removeClass('fc-active'); + }; + })(this) + }); + return dragListener.startInteraction(ev); + }; + + ResourceTimelineView.prototype.getNaturalDividerWidth = function() { + return this.el.find('.fc-resource-area').width(); + }; + + ResourceTimelineView.prototype.positionDivider = function(w) { + return this.el.find('.fc-resource-area').width(w); + }; + + ResourceTimelineView.prototype.renderEvents = function(events) { + this.timeGrid.renderEvents(events); + this.syncRowHeights(); + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.unrenderEvents = function() { + this.timeGrid.unrenderEvents(); + this.syncRowHeights(); + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.updateWidth = function() { + ResourceTimelineView.__super__.updateWidth.apply(this, arguments); + this.resourceGrid.updateWidth(); + this.joiner.update(); + if (this.cellFollower) { + return this.cellFollower.update(); + } + }; + + ResourceTimelineView.prototype.updateHeight = function(isResize) { + ResourceTimelineView.__super__.updateHeight.apply(this, arguments); + if (isResize) { + return this.syncRowHeights(); + } + }; + + ResourceTimelineView.prototype.setHeight = function(totalHeight, isAuto) { + var bodyHeight, headHeight; + headHeight = this.syncHeadHeights(); + if (isAuto) { + bodyHeight = 'auto'; + } else { + bodyHeight = totalHeight - headHeight - this.queryMiscHeight(); + } + this.timeGrid.bodyScroller.setHeight(bodyHeight); + return this.resourceGrid.bodyScroller.setHeight(bodyHeight); + }; + + ResourceTimelineView.prototype.queryMiscHeight = function() { + return this.el.outerHeight() - Math.max(this.resourceGrid.headScroller.el.outerHeight(), this.timeGrid.headScroller.el.outerHeight()) - Math.max(this.resourceGrid.bodyScroller.el.outerHeight(), this.timeGrid.bodyScroller.el.outerHeight()); + }; + + ResourceTimelineView.prototype.syncHeadHeights = function() { + var headHeight; + this.resourceGrid.headHeight('auto'); + this.timeGrid.headHeight('auto'); + headHeight = Math.max(this.resourceGrid.headHeight(), this.timeGrid.headHeight()); + this.resourceGrid.headHeight(headHeight); + this.timeGrid.headHeight(headHeight); + return headHeight; + }; + + ResourceTimelineView.prototype.scrollToResource = function(resource) { + return this.timeGrid.scrollToResource(resource); + }; + + ResourceTimelineView.prototype.setResources = function(resources) { + var j, len, resource; + this.batchRows(); + for (j = 0, len = resources.length; j < len; j++) { + resource = resources[j]; + this.insertResource(resource); + } + this.rowHierarchy.show(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + }; + + ResourceTimelineView.prototype.unsetResources = function() { + this.clearEvents(); + this.batchRows(); + this.rowHierarchy.removeChildren(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + }; + + + /* + TODO: the scenario where there were previously unassociated events that are now + attached to this resource. should render those events immediately. + + Responsible for rendering the new resource + */ + + ResourceTimelineView.prototype.addResource = function(resource) { + this.insertResource(resource); + return this.reinitializeCellFollowers(); + }; + + ResourceTimelineView.prototype.removeResource = function(resource) { + var row; + row = this.getResourceRow(resource.id); + if (row) { + this.batchRows(); + row.remove(); + this.unbatchRows(); + return this.reinitializeCellFollowers(); + } + }; + + ResourceTimelineView.prototype.cellFollower = null; + + ResourceTimelineView.prototype.reinitializeCellFollowers = function() { + var cellContent, j, len, nodes, ref, row; + if (this.cellFollower) { + this.cellFollower.clearSprites(); + } + this.cellFollower = new ScrollFollower(this.resourceGrid.bodyScroller); + this.cellFollower.isHFollowing = false; + this.cellFollower.isVFollowing = true; + nodes = []; + ref = this.rowHierarchy.getNodes(); + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row instanceof VRowGroup) { + if (row.groupTd) { + cellContent = row.groupTd.find('.fc-cell-content'); + if (cellContent.length) { + nodes.push(cellContent[0]); + } + } + } + } + return this.cellFollower.setSprites($(nodes)); + }; + + ResourceTimelineView.prototype.insertResource = function(resource, parentResourceRow) { + var childResource, j, len, parentId, ref, results, row; + row = new ResourceRow(this, resource); + if (parentResourceRow == null) { + parentId = resource.parentId; + if (parentId) { + parentResourceRow = this.getResourceRow(parentId); + } + } + if (parentResourceRow) { + this.insertRowAsChild(row, parentResourceRow); + } else { + this.insertRow(row); + } + ref = resource.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + childResource = ref[j]; + results.push(this.insertResource(childResource, row)); + } + return results; + }; + + ResourceTimelineView.prototype.insertRow = function(row, parent, groupSpecs) { + var group; + if (parent == null) { + parent = this.rowHierarchy; + } + if (groupSpecs == null) { + groupSpecs = this.groupSpecs; + } + if (groupSpecs.length) { + group = this.ensureResourceGroup(row, parent, groupSpecs[0]); + if (group instanceof HRowGroup) { + return this.insertRowAsChild(row, group); + } else { + return this.insertRow(row, group, groupSpecs.slice(1)); + } + } else { + return this.insertRowAsChild(row, parent); + } + }; + + ResourceTimelineView.prototype.insertRowAsChild = function(row, parent) { + return parent.addChild(row, this.computeChildRowPosition(row, parent)); + }; + + ResourceTimelineView.prototype.computeChildRowPosition = function(child, parent) { + var cmp, i, j, len, ref, sibling; + if (this.orderSpecs.length) { + ref = parent.children; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + sibling = ref[i]; + cmp = this.compareResources(sibling.resource || {}, child.resource || {}); + if (cmp > 0) { + return i; + } + } + } + return null; + }; + + ResourceTimelineView.prototype.compareResources = function(a, b) { + return compareByFieldSpecs(a, b, this.orderSpecs); + }; + + ResourceTimelineView.prototype.ensureResourceGroup = function(row, parent, spec) { + var cmp, group, groupValue, i, j, k, len, len1, ref, ref1, testGroup; + groupValue = (row.resource || {})[spec.field]; + group = null; + if (spec.order) { + ref = parent.children; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + testGroup = ref[i]; + cmp = flexibleCompare(testGroup.groupValue, groupValue) * spec.order; + if (cmp === 0) { + group = testGroup; + break; + } else if (cmp > 0) { + break; + } + } + } else { + ref1 = parent.children; + for (i = k = 0, len1 = ref1.length; k < len1; i = ++k) { + testGroup = ref1[i]; + if (testGroup.groupValue === groupValue) { + group = testGroup; + break; + } + } + } + if (!group) { + if (this.isVGrouping) { + group = new VRowGroup(this, spec, groupValue); + } else { + group = new HRowGroup(this, spec, groupValue); + } + parent.addChild(group, i); + } + return group; + }; + + ResourceTimelineView.prototype.pairSegsWithRows = function(segs) { + var j, len, pair, pairs, pairsById, resourceId, rowObj, seg; + pairs = []; + pairsById = {}; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + resourceId = seg.resourceId; + if (resourceId) { + rowObj = this.getResourceRow(resourceId); + if (rowObj) { + pair = pairsById[resourceId]; + if (!pair) { + pair = [rowObj, []]; + pairs.push(pair); + pairsById[resourceId] = pair; + } + pair[1].push(seg); + } + } + } + return pairs; + }; + + ResourceTimelineView.prototype.rowAdded = function(row) { + var isNesting, wasNesting; + if (row instanceof ResourceRow) { + this.resourceRowHash[row.resource.id] = row; + } + wasNesting = this.isNesting; + isNesting = Boolean(this.nestingCnt += row.depth ? 1 : 0); + if (wasNesting !== isNesting) { + this.el.toggleClass('fc-nested', isNesting); + this.el.toggleClass('fc-flat', !isNesting); + } + return this.isNesting = isNesting; + }; + + ResourceTimelineView.prototype.rowRemoved = function(row) { + var isNesting, wasNesting; + if (row instanceof ResourceRow) { + delete this.resourceRowHash[row.resource.id]; + } + wasNesting = this.isNesting; + isNesting = Boolean(this.nestingCnt -= row.depth ? 1 : 0); + if (wasNesting !== isNesting) { + this.el.toggleClass('fc-nested', isNesting); + this.el.toggleClass('fc-flat', !isNesting); + } + return this.isNesting = isNesting; + }; + + ResourceTimelineView.prototype.batchRowDepth = 0; + + ResourceTimelineView.prototype.shownRowBatch = null; + + ResourceTimelineView.prototype.hiddenRowBatch = null; + + ResourceTimelineView.prototype.batchRows = function() { + if (!(this.batchRowDepth++)) { + this.shownRowBatch = []; + return this.hiddenRowBatch = []; + } + }; + + ResourceTimelineView.prototype.unbatchRows = function() { + if (!(--this.batchRowDepth)) { + if (this.hiddenRowBatch.length) { + this.rowsHidden(this.hiddenRowBatch); + } + if (this.shownRowBatch.length) { + this.rowsShown(this.shownRowBatch); + } + this.hiddenRowBatch = null; + return this.shownRowBatch = null; + } + }; + + ResourceTimelineView.prototype.rowShown = function(row) { + if (this.shownRowBatch) { + return this.shownRowBatch.push(row); + } else { + return this.rowsShown([row]); + } + }; + + ResourceTimelineView.prototype.rowHidden = function(row) { + if (this.hiddenRowBatch) { + return this.hiddenRowBatch.push(row); + } else { + return this.rowsHidden([row]); + } + }; + + ResourceTimelineView.prototype.rowsShown = function(rows) { + this.syncRowHeights(rows); + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.rowsHidden = function(rows) { + return this.updateWidth(); + }; + + ResourceTimelineView.prototype.syncRowHeights = function(visibleRows, safe) { + var h, h1, h2, i, innerHeights, j, k, len, len1, row; + if (safe == null) { + safe = false; + } + if (visibleRows == null) { + visibleRows = this.getVisibleRows(); + } + for (j = 0, len = visibleRows.length; j < len; j++) { + row = visibleRows[j]; + row.setTrInnerHeight(''); + } + innerHeights = (function() { + var k, len1, results; + results = []; + for (k = 0, len1 = visibleRows.length; k < len1; k++) { + row = visibleRows[k]; + h = row.getMaxTrInnerHeight(); + if (safe) { + h += h % 2; + } + results.push(h); + } + return results; + })(); + for (i = k = 0, len1 = visibleRows.length; k < len1; i = ++k) { + row = visibleRows[i]; + row.setTrInnerHeight(innerHeights[i]); + } + if (!safe) { + h1 = this.resourceGrid.tbodyEl.height(); + h2 = this.timeGrid.tbodyEl.height(); + if (Math.abs(h1 - h2) > 1) { + return this.syncRowHeights(visibleRows, true); + } + } + }; + + ResourceTimelineView.prototype.getVisibleRows = function() { + var j, len, ref, results, row; + ref = this.rowHierarchy.getRows(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row.isShown) { + results.push(row); + } + } + return results; + }; + + ResourceTimelineView.prototype.getEventRows = function() { + var j, len, ref, results, row; + ref = this.rowHierarchy.getRows(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row instanceof EventRow) { + results.push(row); + } + } + return results; + }; + + ResourceTimelineView.prototype.getResourceRow = function(resourceId) { + return this.resourceRowHash[resourceId]; + }; + + ResourceTimelineView.prototype.setScroll = function(state) { + ResourceTimelineView.__super__.setScroll.apply(this, arguments); + return this.resourceGrid.bodyScroller.setScrollTop(state.top); + }; + + return ResourceTimelineView; + +})(TimelineView); + +ResourceTimelineGrid = (function(superClass) { + extend(ResourceTimelineGrid, superClass); + + function ResourceTimelineGrid() { + return ResourceTimelineGrid.__super__.constructor.apply(this, arguments); + } + + ResourceTimelineGrid.mixin(ResourceGridMixin); + + ResourceTimelineGrid.prototype.eventRows = null; + + ResourceTimelineGrid.prototype.shownEventRows = null; + + ResourceTimelineGrid.prototype.tbodyEl = null; + + ResourceTimelineGrid.prototype.rowCoordCache = null; + + ResourceTimelineGrid.prototype.spanToSegs = function(span) { + var calendar, j, len, resourceId, seg, segs; + segs = ResourceTimelineGrid.__super__.spanToSegs.apply(this, arguments); + calendar = this.view.calendar; + resourceId = span.resourceId; + if (resourceId) { + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + seg.resource = calendar.getResourceById(resourceId); + seg.resourceId = resourceId; + } + } + return segs; + }; + + ResourceTimelineGrid.prototype.prepareHits = function() { + var row, trArray; + ResourceTimelineGrid.__super__.prepareHits.apply(this, arguments); + this.eventRows = this.view.getEventRows(); + this.shownEventRows = (function() { + var j, len, ref, results; + ref = this.eventRows; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + if (row.isShown) { + results.push(row); + } + } + return results; + }).call(this); + trArray = (function() { + var j, len, ref, results; + ref = this.shownEventRows; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + row = ref[j]; + results.push(row.getTr('event')[0]); + } + return results; + }).call(this); + this.rowCoordCache = new CoordCache({ + els: trArray, + isVertical: true + }); + return this.rowCoordCache.build(); + }; + + ResourceTimelineGrid.prototype.releaseHits = function() { + ResourceTimelineGrid.__super__.releaseHits.apply(this, arguments); + this.eventRows = null; + this.shownEventRows = null; + return this.rowCoordCache.clear(); + }; + + ResourceTimelineGrid.prototype.queryHit = function(leftOffset, topOffset) { + var rowIndex, simpleHit; + simpleHit = ResourceTimelineGrid.__super__.queryHit.apply(this, arguments); + if (simpleHit) { + rowIndex = this.rowCoordCache.getVerticalIndex(topOffset); + if (rowIndex != null) { + return { + resourceId: this.shownEventRows[rowIndex].resource.id, + snap: simpleHit.snap, + component: this, + left: simpleHit.left, + right: simpleHit.right, + top: this.rowCoordCache.getTopOffset(rowIndex), + bottom: this.rowCoordCache.getBottomOffset(rowIndex) + }; + } + } + }; + + ResourceTimelineGrid.prototype.getHitSpan = function(hit) { + var span; + span = this.getSnapRange(hit.snap); + span.resourceId = hit.resourceId; + return span; + }; + + ResourceTimelineGrid.prototype.getHitEl = function(hit) { + return this.getSnapEl(hit.snap); + }; + + ResourceTimelineGrid.prototype.renderSkeleton = function() { + var rowContainerEl; + ResourceTimelineGrid.__super__.renderSkeleton.apply(this, arguments); + this.segContainerEl.remove(); + this.segContainerEl = null; + rowContainerEl = $('
').appendTo(this.bodyScroller.canvas.contentEl); + return this.tbodyEl = rowContainerEl.find('tbody'); + }; + + ResourceTimelineGrid.prototype.renderFgSegs = function(segs) { + var containerObj, containerSegs, j, len, pair, pairs, visiblePairs; + segs = this.renderFgSegEls(segs); + pairs = this.view.pairSegsWithRows(segs); + visiblePairs = []; + for (j = 0, len = pairs.length; j < len; j++) { + pair = pairs[j]; + containerObj = pair[0], containerSegs = pair[1]; + containerObj.fgSegs = containerSegs; + if (containerObj.isShown) { + containerObj.isSegsRendered = true; + visiblePairs.push(pair); + } + } + this.renderFgSegsInContainers(visiblePairs); + this.updateSegFollowers(segs); + return segs; + }; + + ResourceTimelineGrid.prototype.unrenderFgSegs = function() { + var eventRow, eventRows, j, len; + this.clearSegFollowers(); + eventRows = this.view.getEventRows(); + for (j = 0, len = eventRows.length; j < len; j++) { + eventRow = eventRows[j]; + eventRow.fgSegs = null; + eventRow.isSegsRendered = false; + } + return this.unrenderFgContainers(eventRows); + }; + + ResourceTimelineGrid.prototype.renderFill = function(type, segs, className) { + var j, k, len, len1, nonResourceSegs, pair, pairs, resourceSegs, rowObj, rowSegs, seg, visiblePairs; + segs = this.renderFillSegEls(type, segs); + resourceSegs = []; + nonResourceSegs = []; + for (j = 0, len = segs.length; j < len; j++) { + seg = segs[j]; + if (seg.resourceId) { + resourceSegs.push(seg); + } else { + nonResourceSegs.push(seg); + } + } + pairs = this.view.pairSegsWithRows(resourceSegs); + visiblePairs = []; + for (k = 0, len1 = pairs.length; k < len1; k++) { + pair = pairs[k]; + rowObj = pair[0], rowSegs = pair[1]; + if (type === 'bgEvent') { + rowObj.bgSegs = rowSegs; + } + if (rowObj.isShown) { + visiblePairs.push(pair); + } + } + if (nonResourceSegs.length) { + visiblePairs.unshift([this, nonResourceSegs]); + } + this.renderFillInContainers(type, visiblePairs, className); + return segs; + }; + + ResourceTimelineGrid.prototype.renderHelper = function(event, sourceSeg) { + var pairs, segs; + segs = this.eventToSegs(event); + segs = this.renderFgSegEls(segs); + pairs = this.view.pairSegsWithRows(segs); + return this.renderHelperSegsInContainers(pairs, sourceSeg); + }; + + ResourceTimelineGrid.prototype.computeInitialScroll = function(prevState) { + var state; + state = ResourceTimelineGrid.__super__.computeInitialScroll.apply(this, arguments); + if (prevState) { + state.resourceId = prevState.resourceId; + state.bottom = prevState.bottom; + } + return state; + }; + + ResourceTimelineGrid.prototype.queryScroll = function() { + var el, elBottom, j, len, ref, rowObj, scrollerTop, state; + state = ResourceTimelineGrid.__super__.queryScroll.apply(this, arguments); + scrollerTop = this.bodyScroller.scrollEl.offset().top; + ref = this.view.getVisibleRows(); + for (j = 0, len = ref.length; j < len; j++) { + rowObj = ref[j]; + if (rowObj.resource) { + el = rowObj.getTr('event'); + elBottom = el.offset().top + el.outerHeight(); + if (elBottom > scrollerTop) { + state.resourceId = rowObj.resource.id; + state.bottom = elBottom - scrollerTop; + break; + } + } + } + return state; + }; + + ResourceTimelineGrid.prototype.setScroll = function(state) { + var el, elBottom, innerTop, row; + if (state.resourceId) { + row = this.view.getResourceRow(state.resourceId); + if (row) { + el = row.getTr('event'); + if (el) { + innerTop = this.bodyScroller.canvas.el.offset().top; + elBottom = el.offset().top + el.outerHeight(); + state.top = elBottom - state.bottom - innerTop; + } + } + } + return ResourceTimelineGrid.__super__.setScroll.call(this, state); + }; + + ResourceTimelineGrid.prototype.scrollToResource = function(resource) { + var el, innerTop, row, scrollTop; + row = this.view.getResourceRow(resource.id); + if (row) { + el = row.getTr('event'); + if (el) { + innerTop = this.bodyScroller.canvas.el.offset().top; + scrollTop = el.offset().top - innerTop; + return this.bodyScroller.scrollEl.scrollTop(scrollTop); + } + } + }; + + return ResourceTimelineGrid; + +})(TimelineGrid); + +COL_MIN_WIDTH = 30; + +Spreadsheet = (function() { + Spreadsheet.prototype.view = null; + + Spreadsheet.prototype.headEl = null; + + Spreadsheet.prototype.el = null; + + Spreadsheet.prototype.tbodyEl = null; + + Spreadsheet.prototype.headScroller = null; + + Spreadsheet.prototype.bodyScroller = null; + + Spreadsheet.prototype.joiner = null; + + function Spreadsheet(view1) { + var colSpec; + this.view = view1; + this.isRTL = this.view.opt('isRTL'); + this.givenColWidths = this.colWidths = (function() { + var j, len, ref, results; + ref = this.view.colSpecs; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + colSpec = ref[j]; + results.push(colSpec.width); + } + return results; + }).call(this); + } + + Spreadsheet.prototype.colGroupHtml = ''; + + Spreadsheet.prototype.headTable = null; + + Spreadsheet.prototype.headColEls = null; + + Spreadsheet.prototype.headCellEls = null; + + Spreadsheet.prototype.bodyColEls = null; + + Spreadsheet.prototype.bodyTable = null; + + Spreadsheet.prototype.renderSkeleton = function() { + this.headScroller = new ClippedScroller({ + overflowX: 'clipped-scroll', + overflowY: 'hidden' + }); + this.headScroller.canvas = new ScrollerCanvas(); + this.headScroller.render(); + this.headScroller.canvas.contentEl.html(this.renderHeadHtml()); + this.headEl.append(this.headScroller.el); + this.bodyScroller = new ClippedScroller({ + overflowY: 'clipped-scroll' + }); + this.bodyScroller.canvas = new ScrollerCanvas(); + this.bodyScroller.render(); + this.bodyScroller.canvas.contentEl.html('' + this.colGroupHtml + '
'); + this.tbodyEl = this.bodyScroller.canvas.contentEl.find('tbody'); + this.el.append(this.bodyScroller.el); + this.joiner = new ScrollJoiner('horizontal', [this.headScroller, this.bodyScroller]); + this.headTable = this.headEl.find('table'); + this.headColEls = this.headEl.find('col'); + this.headCellEls = this.headScroller.canvas.contentEl.find('tr:last-child th'); + this.bodyColEls = this.el.find('col'); + this.bodyTable = this.el.find('table'); + this.colMinWidths = this.computeColMinWidths(); + this.applyColWidths(); + return this.initColResizing(); + }; + + Spreadsheet.prototype.renderHeadHtml = function() { + var colGroupHtml, colSpecs, html, i, isLast, isMainCol, j, k, len, len1, o; + colSpecs = this.view.colSpecs; + html = ''; + colGroupHtml = ''; + for (j = 0, len = colSpecs.length; j < len; j++) { + o = colSpecs[j]; + if (o.isMain) { + colGroupHtml += ''; + } else { + colGroupHtml += ''; + } + } + colGroupHtml += ''; + this.colGroupHtml = colGroupHtml; + html += colGroupHtml; + html += ''; + if (this.view.superHeaderText) { + html += '' + '' + ''; + } + html += ''; + isMainCol = true; + for (i = k = 0, len1 = colSpecs.length; k < len1; i = ++k) { + o = colSpecs[i]; + isLast = i === colSpecs.length - 1; + html += ''; + } + html += ''; + html += '
' + '
' + '' + htmlEscape(this.view.superHeaderText) + '' + '
' + '
' + '
' + '
' + (o.isMain ? '' + '' + '' : '') + '' + htmlEscape(o.labelText || '') + '' + '
' + (!isLast ? '
' : '') + '
' + '
'; + return html; + }; + + Spreadsheet.prototype.givenColWidths = null; + + Spreadsheet.prototype.colWidths = null; + + Spreadsheet.prototype.colMinWidths = null; + + Spreadsheet.prototype.tableWidth = null; + + Spreadsheet.prototype.tableMinWidth = null; + + Spreadsheet.prototype.initColResizing = function() { + return this.headEl.find('th .fc-col-resizer').each((function(_this) { + return function(i, resizerEl) { + resizerEl = $(resizerEl); + return resizerEl.on('mousedown', function(ev) { + return _this.colResizeMousedown(i, ev, resizerEl); + }); + }; + })(this)); + }; + + Spreadsheet.prototype.colResizeMousedown = function(i, ev, resizerEl) { + var colWidths, dragListener, minWidth, origColWidth; + colWidths = this.colWidths = this.queryColWidths(); + colWidths.pop(); + colWidths.push(null); + origColWidth = colWidths[i]; + minWidth = Math.min(this.colMinWidths[i], COL_MIN_WIDTH); + dragListener = new DragListener({ + dragStart: (function(_this) { + return function() { + return resizerEl.addClass('fc-active'); + }; + })(this), + drag: (function(_this) { + return function(dx, dy) { + var width; + width = origColWidth + (_this.isRTL ? -dx : dx); + width = Math.max(width, minWidth); + colWidths[i] = width; + return _this.applyColWidths(); + }; + })(this), + dragEnd: (function(_this) { + return function() { + return resizerEl.removeClass('fc-active'); + }; + })(this) + }); + return dragListener.startInteraction(ev); + }; + + Spreadsheet.prototype.applyColWidths = function() { + var allNumbers, anyPercentages, colMinWidths, colWidth, colWidths, cssWidth, cssWidths, defaultCssWidth, i, j, k, l, len, len1, len2, tableMinWidth, total; + colMinWidths = this.colMinWidths; + colWidths = this.colWidths; + allNumbers = true; + anyPercentages = false; + total = 0; + for (j = 0, len = colWidths.length; j < len; j++) { + colWidth = colWidths[j]; + if (typeof colWidth === 'number') { + total += colWidth; + } else { + allNumbers = false; + if (colWidth) { + anyPercentages = true; + } + } + } + defaultCssWidth = anyPercentages && !this.view.isHGrouping ? 'auto' : ''; + cssWidths = (function() { + var k, len1, results; + results = []; + for (i = k = 0, len1 = colWidths.length; k < len1; i = ++k) { + colWidth = colWidths[i]; + results.push(colWidth != null ? colWidth : defaultCssWidth); + } + return results; + })(); + tableMinWidth = 0; + for (i = k = 0, len1 = cssWidths.length; k < len1; i = ++k) { + cssWidth = cssWidths[i]; + tableMinWidth += typeof cssWidth === 'number' ? cssWidth : colMinWidths[i]; + } + for (i = l = 0, len2 = cssWidths.length; l < len2; i = ++l) { + cssWidth = cssWidths[i]; + this.headColEls.eq(i).width(cssWidth); + this.bodyColEls.eq(i).width(cssWidth); + } + this.headScroller.canvas.setMinWidth(tableMinWidth); + this.bodyScroller.canvas.setMinWidth(tableMinWidth); + this.tableMinWidth = tableMinWidth; + return this.tableWidth = allNumbers ? total : void 0; + }; + + Spreadsheet.prototype.computeColMinWidths = function() { + var i, j, len, ref, results, width; + ref = this.givenColWidths; + results = []; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + width = ref[i]; + if (typeof width === 'number') { + results.push(width); + } else { + results.push(parseInt(this.headColEls.eq(i).css('min-width')) || COL_MIN_WIDTH); + } + } + return results; + }; + + Spreadsheet.prototype.queryColWidths = function() { + var j, len, node, ref, results; + ref = this.headCellEls; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + node = ref[j]; + results.push($(node).outerWidth()); + } + return results; + }; + + Spreadsheet.prototype.updateWidth = function() { + this.headScroller.updateSize(); + this.bodyScroller.updateSize(); + this.joiner.update(); + if (this.follower) { + return this.follower.update(); + } + }; + + Spreadsheet.prototype.headHeight = function() { + var table; + table = this.headScroller.canvas.contentEl.find('table'); + return table.height.apply(table, arguments); + }; + + return Spreadsheet; + +})(); + + +/* +An abstract node in a row-hierarchy tree. +May be a self-contained single row, a row with subrows, +OR a grouping of rows without its own distinct row. + */ + +RowParent = (function() { + RowParent.prototype.view = null; + + RowParent.prototype.parent = null; + + RowParent.prototype.prevSibling = null; + + RowParent.prototype.children = null; + + RowParent.prototype.depth = 0; + + RowParent.prototype.hasOwnRow = false; + + RowParent.prototype.trHash = null; + + RowParent.prototype.trs = null; + + RowParent.prototype.isRendered = false; + + RowParent.prototype.isExpanded = true; + + RowParent.prototype.isShown = false; + + function RowParent(view1) { + this.view = view1; + this.children = []; + this.trHash = {}; + this.trs = $(); + } + + + /* + Adds the given node as a child. + Will be inserted at the `index`. If not given, will be appended to the end. + */ + + RowParent.prototype.addChild = function(child, index) { + var children, j, len, node, ref; + child.remove(); + children = this.children; + if (index != null) { + children.splice(index, 0, child); + } else { + index = children.length; + children.push(child); + } + child.prevSibling = index > 0 ? children[index - 1] : null; + if (index < children.length - 1) { + children[index + 1].prevSibling = child; + } + child.parent = this; + child.depth = this.depth + (this.hasOwnRow ? 1 : 0); + ref = child.getNodes(); + for (j = 0, len = ref.length; j < len; j++) { + node = ref[j]; + node.added(); + } + if (this.isShown && this.isExpanded) { + return child.show(); + } + }; + + + /* + Removes the given child from the node. Assumes it is a direct child. + If not a direct child, returns false and nothing happens. + Unrenders the child and triggers handlers. + */ + + RowParent.prototype.removeChild = function(child) { + var children, i, isFound, j, k, len, len1, ref, row, testChild; + children = this.children; + isFound = false; + for (i = j = 0, len = children.length; j < len; i = ++j) { + testChild = children[i]; + if (testChild === child) { + isFound = true; + break; + } + } + if (!isFound) { + return false; + } else { + if (i < children.length - 1) { + children[i + 1].prevSibling = child.prevSibling; + } + children.splice(i, 1); + child.recursivelyUnrender(); + ref = child.getNodes(); + for (k = 0, len1 = ref.length; k < len1; k++) { + row = ref[k]; + row.removed(); + } + child.parent = null; + child.prevSibling = null; + return child; + } + }; + + + /* + Removes all of the node's children from the hierarchy. Unrenders them and triggers callbacks. + NOTE: batchRows/unbatchRows should probably be called before this happens :( + */ + + RowParent.prototype.removeChildren = function() { + var child, j, k, len, len1, ref, ref1; + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.recursivelyUnrender(); + } + ref1 = this.getDescendants(); + for (k = 0, len1 = ref1.length; k < len1; k++) { + child = ref1[k]; + child.removed(); + } + return this.children = []; + }; + + + /* + Removes this node from its parent + */ + + RowParent.prototype.remove = function() { + if (this.parent) { + return this.parent.removeChild(this); + } + }; + + + /* + Gets the last direct child node + */ + + RowParent.prototype.getLastChild = function() { + var children; + children = this.children; + return children[children.length - 1]; + }; + + + /* + Walks backward in the hierarchy to find the previous row leaf node. + When looking at the hierarchy in a flat linear fashion, this is the revealed row just before the current. + */ + + RowParent.prototype.getPrevRow = function() { + var lastChild, node; + node = this; + while (node) { + if (node.prevSibling) { + node = node.prevSibling; + while ((lastChild = node.getLastChild())) { + node = lastChild; + } + } else { + node = node.parent; + } + if (node && node.hasOwnRow && node.isShown) { + return node; + } + } + return null; + }; + + + /* + Returns the first node in the subtree that has a revealed row + */ + + RowParent.prototype.getLeadingRow = function() { + if (this.hasOwnRow) { + return this; + } else if (this.isExpanded && this.children.length) { + return this.children[0].getLeadingRow(); + } + }; + + + /* + Generates a flat array containing all the row-nodes of the subtree. Descendants + self + */ + + RowParent.prototype.getRows = function(batchArray) { + var child, j, len, ref; + if (batchArray == null) { + batchArray = []; + } + if (this.hasOwnRow) { + batchArray.push(this); + } + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.getRows(batchArray); + } + return batchArray; + }; + + + /* + Generates a flat array containing all the nodes (row/non-row) of the subtree. Descendants + self + */ + + RowParent.prototype.getNodes = function(batchArray) { + var child, j, len, ref; + if (batchArray == null) { + batchArray = []; + } + batchArray.push(this); + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.getNodes(batchArray); + } + return batchArray; + }; + + + /* + Generates a flat array containing all the descendant nodes the current node + */ + + RowParent.prototype.getDescendants = function() { + var batchArray, child, j, len, ref; + batchArray = []; + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.getNodes(batchArray); + } + return batchArray; + }; + + + /* + Builds and populates the TRs for each row type. Inserts them into the DOM. + Does this only for this single row. Not recursive. If not a row (hasOwnRow=false), does not render anything. + PRECONDITION: assumes the parent has already been rendered. + */ + + RowParent.prototype.render = function() { + var prevRow, ref, renderMethodName, tbody, tr, trNodes, type; + this.trHash = {}; + trNodes = []; + if (this.hasOwnRow) { + prevRow = this.getPrevRow(); + ref = this.view.tbodyHash; + for (type in ref) { + tbody = ref[type]; + tr = $(''); + this.trHash[type] = tr; + trNodes.push(tr[0]); + renderMethodName = 'render' + capitaliseFirstLetter(type) + 'Content'; + if (this[renderMethodName]) { + this[renderMethodName](tr); + } + if (prevRow) { + prevRow.trHash[type].after(tr); + } else { + tbody.prepend(tr); + } + } + } + this.trs = $(trNodes).on('click', '.fc-expander', proxy(this, 'toggleExpanded')); + return this.isRendered = true; + }; + + + /* + Unpopulates and removes all of this row's TRs from the DOM. Only for this single row. Not recursive. + Will trigger "hidden". + */ + + RowParent.prototype.unrender = function() { + var ref, tr, type, unrenderMethodName; + if (this.isRendered) { + ref = this.trHash; + for (type in ref) { + tr = ref[type]; + unrenderMethodName = 'unrender' + capitaliseFirstLetter(type) + 'Content'; + if (this[unrenderMethodName]) { + this[unrenderMethodName](tr); + } + } + this.trHash = {}; + this.trs.remove(); + this.trs = $(); + this.isRendered = false; + this.isShown = false; + return this.hidden(); + } + }; + + + /* + Like unrender(), but does it for this row AND all descendants. + NOTE: batchRows/unbatchRows should probably be called before this happens :( + */ + + RowParent.prototype.recursivelyUnrender = function() { + var child, j, len, ref, results; + this.unrender(); + ref = this.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + results.push(child.recursivelyUnrender()); + } + return results; + }; + + + /* + A simple getter for retrieving a TR jQuery object of a certain row type + */ + + RowParent.prototype.getTr = function(type) { + return this.trHash[type]; + }; + + + /* + Renders this row if not already rendered, making sure it is visible. + Also renders descendants of this subtree, based on whether they are expanded or not. + NOTE: If called externally, batchRows/unbatchRows should probably be called before this happens :( + */ + + RowParent.prototype.show = function() { + var child, j, len, ref, results; + if (!this.isShown) { + if (!this.isRendered) { + this.render(); + } else { + this.trs.css('display', ''); + } + if (this.ensureSegsRendered) { + this.ensureSegsRendered(); + } + if (this.isExpanded) { + this.indicateExpanded(); + } else { + this.indicateCollapsed(); + } + this.isShown = true; + this.shown(); + if (this.isExpanded) { + ref = this.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + results.push(child.show()); + } + return results; + } + } + }; + + + /* + Temporarily hides this node's TRs (if applicable) as well as all nodes in the subtree + */ + + RowParent.prototype.hide = function() { + var child, j, len, ref, results; + if (this.isShown) { + if (this.isRendered) { + this.trs.hide(); + } + this.isShown = false; + this.hidden(); + if (this.isExpanded) { + ref = this.children; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + results.push(child.hide()); + } + return results; + } + } + }; + + + /* + Reveals this node's children if they have not already been revealed. Changes any expander icon. + */ + + RowParent.prototype.expand = function() { + var child, j, len, ref; + if (!this.isExpanded) { + this.isExpanded = true; + this.indicateExpanded(); + this.view.batchRows(); + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.show(); + } + this.view.unbatchRows(); + return this.animateExpand(); + } + }; + + + /* + Hides this node's children if they are not already hidden. Changes any expander icon. + */ + + RowParent.prototype.collapse = function() { + var child, j, len, ref; + if (this.isExpanded) { + this.isExpanded = false; + this.indicateCollapsed(); + this.view.batchRows(); + ref = this.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + child.hide(); + } + return this.view.unbatchRows(); + } + }; + + + /* + Switches between expanded/collapsed states + */ + + RowParent.prototype.toggleExpanded = function() { + if (this.isExpanded) { + return this.collapse(); + } else { + return this.expand(); + } + }; + + + /* + Changes the expander icon to the "expanded" state + */ + + RowParent.prototype.indicateExpanded = function() { + return this.trs.find('.fc-expander .fc-icon').removeClass(this.getCollapsedIcon()).addClass(this.getExpandedIcon()); + }; + + + /* + Changes the expander icon to the "collapsed" state + */ + + RowParent.prototype.indicateCollapsed = function() { + return this.trs.find('.fc-expander .fc-icon').removeClass(this.getExpandedIcon()).addClass(this.getCollapsedIcon()); + }; + + + /* + */ + + RowParent.prototype.enableExpanding = function() { + return this.trs.find('.fc-expander-space').addClass('fc-expander'); + }; + + + /* + */ + + RowParent.prototype.disableExpanding = function() { + return this.trs.find('.fc-expander-space').removeClass('fc-expander').find('.fc-icon').removeClass(this.getExpandedIcon()).removeClass(this.getCollapsedIcon()); + }; + + RowParent.prototype.getExpandedIcon = function() { + return 'fc-icon-down-triangle'; + }; + + RowParent.prototype.getCollapsedIcon = function() { + var dir; + dir = this.view.isRTL ? 'left' : 'right'; + return 'fc-icon-' + dir + '-triangle'; + }; + + + /* + Causes a slide-down CSS transition to demonstrate that the expand has happened + */ + + RowParent.prototype.animateExpand = function() { + var ref, ref1, trs; + trs = (ref = this.children[0]) != null ? (ref1 = ref.getLeadingRow()) != null ? ref1.trs : void 0 : void 0; + if (trs) { + trs.addClass('fc-collapsed'); + setTimeout(function() { + trs.addClass('fc-transitioning'); + return trs.removeClass('fc-collapsed'); + }); + return trs.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { + return trs.removeClass('fc-transitioning'); + }); + } + }; + + + /* + Find each TRs "inner div" (div within first cell). This div controls each TRs height. + Returns the max pixel height. + */ + + RowParent.prototype.getMaxTrInnerHeight = function() { + var max; + max = 0; + $.each(this.trHash, (function(_this) { + return function(type, tr) { + var innerEl; + innerEl = getOwnCells(tr).find('> div:not(.fc-cell-content):first'); + return max = Math.max(innerEl.height(), max); + }; + })(this)); + return max; + }; + + + /* + Find each TRs "inner div" and sets all of their heights to the same value. + */ + + RowParent.prototype.setTrInnerHeight = function(height) { + return $.each(this.trHash, (function(_this) { + return function(type, tr) { + return getOwnCells(tr).find('> div:not(.fc-cell-content):first').height(height); + }; + })(this)); + }; + + + /* + Triggered when the current node has been shown (either freshly rendered or re-shown) + when it had previously been unrendered or hidden. `shown` does not bubble up the hierarchy. + */ + + RowParent.prototype.shown = function() { + if (this.hasOwnRow) { + return this.rowShown(this); + } + }; + + + /* + Triggered when the current node has been hidden (either temporarily or permanently) + when it had previously been shown. `hidden` does not bubble up the hierarchy. + */ + + RowParent.prototype.hidden = function() { + if (this.hasOwnRow) { + return this.rowHidden(this); + } + }; + + + /* + Just like `shown`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowShown = function(row) { + return (this.parent || this.view).rowShown(row); + }; + + + /* + Just like `hidden`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowHidden = function(row) { + return (this.parent || this.view).rowHidden(row); + }; + + + /* + Triggered when the current node has been added to the hierarchy. `added` does not bubble up. + */ + + RowParent.prototype.added = function() { + if (this.hasOwnRow) { + return this.rowAdded(this); + } + }; + + + /* + Triggered when the current node has been removed from the hierarchy. `removed` does not bubble up. + */ + + RowParent.prototype.removed = function() { + if (this.hasOwnRow) { + return this.rowRemoved(this); + } + }; + + + /* + Just like `added`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowAdded = function(row) { + return (this.parent || this.view).rowAdded(row); + }; + + + /* + Just like `removed`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy. + */ + + RowParent.prototype.rowRemoved = function(row) { + return (this.parent || this.view).rowRemoved(row); + }; + + return RowParent; + +})(); + + +/* +An abstract node in a row-hierarchy tree that contains other nodes. +Will have some sort of rendered label indicating the grouping, +up to the subclass for determining what to do with it. + */ + +RowGroup = (function(superClass) { + extend(RowGroup, superClass); + + RowGroup.prototype.groupSpec = null; + + RowGroup.prototype.groupValue = null; + + function RowGroup(view, groupSpec1, groupValue1) { + this.groupSpec = groupSpec1; + this.groupValue = groupValue1; + RowGroup.__super__.constructor.apply(this, arguments); + } + + + /* + Called when this row (if it renders a row) or a subrow is removed + */ + + RowGroup.prototype.rowRemoved = function(row) { + RowGroup.__super__.rowRemoved.apply(this, arguments); + if (row !== this && !this.children.length) { + return this.remove(); + } + }; + + + /* + Renders the content wrapper element that will be inserted into this row's TD cell + */ + + RowGroup.prototype.renderGroupContentEl = function() { + var contentEl, filter; + contentEl = $('
').append(this.renderGroupTextEl()); + filter = this.groupSpec.render; + if (typeof filter === 'function') { + contentEl = filter(contentEl, this.groupValue) || contentEl; + } + return contentEl; + }; + + + /* + Renders the text span element that will be inserted into this row's TD cell. + Goes within the content element. + */ + + RowGroup.prototype.renderGroupTextEl = function() { + var filter, text; + text = this.groupValue || ''; + filter = this.groupSpec.text; + if (typeof filter === 'function') { + text = filter(text) || text; + } + return $('').text(text); + }; + + return RowGroup; + +})(RowParent); + + +/* +A row grouping that renders as a single solid row that spans width-wise (like a horizontal rule) + */ + +HRowGroup = (function(superClass) { + extend(HRowGroup, superClass); + + function HRowGroup() { + return HRowGroup.__super__.constructor.apply(this, arguments); + } + + HRowGroup.prototype.hasOwnRow = true; + + + /* + Renders this row's TR for the "spreadsheet" quadrant, the area with info about each resource + */ + + HRowGroup.prototype.renderSpreadsheetContent = function(tr) { + var contentEl; + contentEl = this.renderGroupContentEl(); + contentEl.prepend('' + '' + ''); + return $('').attr('colspan', this.view.colSpecs.length).append($('
').append(contentEl)).appendTo(tr); + }; + + + /* + Renders this row's TR for the quadrant that contains a resource's events + */ + + HRowGroup.prototype.renderEventContent = function(tr) { + return tr.append('
'); + }; + + return HRowGroup; + +})(RowGroup); + + +/* +A row grouping that renders as a tall multi-cell vertical span in the "spreadsheet" area + */ + +VRowGroup = (function(superClass) { + extend(VRowGroup, superClass); + + function VRowGroup() { + return VRowGroup.__super__.constructor.apply(this, arguments); + } + + VRowGroup.prototype.rowspan = 0; + + VRowGroup.prototype.leadingTr = null; + + VRowGroup.prototype.groupTd = null; + + + /* + Called when a row somewhere within the grouping is shown + */ + + VRowGroup.prototype.rowShown = function(row) { + this.rowspan += 1; + this.renderRowspan(); + return VRowGroup.__super__.rowShown.apply(this, arguments); + }; + + + /* + Called when a row somewhere within the grouping is hidden + */ + + VRowGroup.prototype.rowHidden = function(row) { + this.rowspan -= 1; + this.renderRowspan(); + return VRowGroup.__super__.rowHidden.apply(this, arguments); + }; + + + /* + Makes sure the groupTd has the correct rowspan / place in the DOM. + PRECONDITION: in the case of multiple group nesting, a child's renderRowspan() + will be called before the parent's renderRowspan(). + */ + + VRowGroup.prototype.renderRowspan = function() { + var leadingTr; + if (this.rowspan) { + if (!this.groupTd) { + this.groupTd = $('').append(this.renderGroupContentEl()); + } + this.groupTd.attr('rowspan', this.rowspan); + leadingTr = this.getLeadingRow().getTr('spreadsheet'); + if (leadingTr !== this.leadingTr) { + if (leadingTr) { + leadingTr.prepend(this.groupTd); + } + return this.leadingTr = leadingTr; + } + } else { + if (this.groupTd) { + this.groupTd.remove(); + this.groupTd = null; + } + return this.leadingTr = null; + } + }; + + return VRowGroup; + +})(RowGroup); + +EventRow = (function(superClass) { + extend(EventRow, superClass); + + function EventRow() { + return EventRow.__super__.constructor.apply(this, arguments); + } + + EventRow.prototype.hasOwnRow = true; + + EventRow.prototype.segContainerEl = null; + + EventRow.prototype.segContainerHeight = null; + + EventRow.prototype.innerEl = null; + + EventRow.prototype.bgSegContainerEl = null; + + EventRow.prototype.isSegsRendered = false; + + EventRow.prototype.bgSegs = null; + + EventRow.prototype.fgSegs = null; + + EventRow.prototype.renderEventContent = function(tr) { + tr.html('
'); + this.segContainerEl = tr.find('.fc-event-container'); + this.innerEl = this.bgSegContainerEl = tr.find('td > div'); + return this.ensureSegsRendered(); + }; + + EventRow.prototype.ensureSegsRendered = function() { + if (!this.isSegsRendered) { + if (this.bgSegs) { + this.view.timeGrid.renderFillInContainer('bgEvent', this, this.bgSegs); + } + if (this.fgSegs) { + this.view.timeGrid.renderFgSegsInContainers([[this, this.fgSegs]]); + } + return this.isSegsRendered = true; + } + }; + + EventRow.prototype.unrenderEventContent = function() { + this.bgSegs = null; + this.fgSegs = null; + return this.isSegsRendered = false; + }; + + return EventRow; + +})(RowParent); + + +/* +A row that renders information about a particular resource, as well as it events (handled by superclass) + */ + +ResourceRow = (function(superClass) { + extend(ResourceRow, superClass); + + ResourceRow.prototype.resource = null; + + function ResourceRow(view, resource1) { + this.resource = resource1; + ResourceRow.__super__.constructor.apply(this, arguments); + } + + + /* + Called when a row in the tree has been added + */ + + ResourceRow.prototype.rowAdded = function(row) { + ResourceRow.__super__.rowAdded.apply(this, arguments); + if (row !== this && this.isRendered) { + if (this.children.length === 1) { + this.enableExpanding(); + if (this.isExpanded) { + return this.indicateExpanded(); + } else { + return this.indicateCollapsed(); + } + } + } + }; + + + /* + Called when a row in the tree has been removed + */ + + ResourceRow.prototype.rowRemoved = function(row) { + ResourceRow.__super__.rowRemoved.apply(this, arguments); + if (row !== this && this.isRendered) { + if (!this.children.length) { + return this.disableExpanding(); + } + } + }; + + ResourceRow.prototype.render = function() { + ResourceRow.__super__.render.apply(this, arguments); + if (this.children.length > 0) { + this.enableExpanding(); + } else { + this.disableExpanding(); + } + return this.view.trigger('resourceRender', this.resource, this.resource, this.getTr('spreadsheet').find('> td'), this.getTr('event').find('> td')); + }; + + ResourceRow.prototype.renderEventContent = function(tr) { + ResourceRow.__super__.renderEventContent.apply(this, arguments); + return tr.attr('data-resource-id', this.resource.id); + }; + + + /* + Populates the TR with cells containing data about the resource + */ + + ResourceRow.prototype.renderSpreadsheetContent = function(tr) { + var colSpec, contentEl, input, j, len, ref, resource, td, text; + resource = this.resource; + ref = this.view.colSpecs; + for (j = 0, len = ref.length; j < len; j++) { + colSpec = ref[j]; + if (colSpec.group) { + continue; + } + input = colSpec.field ? resource[colSpec.field] || null : resource; + text = typeof colSpec.text === 'function' ? colSpec.text(resource, input) : input; + contentEl = $('
' + (colSpec.isMain ? this.renderGutterHtml() : '') + '' + (text ? htmlEscape(text) : ' ') + '' + '
'); + if (typeof colSpec.render === 'function') { + contentEl = colSpec.render(resource, contentEl, input) || contentEl; + } + td = $('').append(contentEl); + if (colSpec.isMain) { + td.wrapInner('
'); + } + tr.append(td); + } + return tr.attr('data-resource-id', resource.id); + }; + + + /* + Renders the HTML responsible for the subrow expander area, + as well as the space before it (used to align expanders of similar depths) + */ + + ResourceRow.prototype.renderGutterHtml = function() { + var html, i, j, ref; + html = ''; + for (i = j = 0, ref = this.depth; j < ref; i = j += 1) { + html += ''; + } + html += '' + '' + ''; + return html; + }; + + return ResourceRow; + +})(EventRow); + +FC.views.timeline.resourceClass = ResourceTimelineView; + +ResourceAgendaView = (function(superClass) { + extend(ResourceAgendaView, superClass); + + function ResourceAgendaView() { + return ResourceAgendaView.__super__.constructor.apply(this, arguments); + } + + ResourceAgendaView.mixin(ResourceViewMixin); + + ResourceAgendaView.prototype.timeGridClass = ResourceTimeGrid; + + ResourceAgendaView.prototype.dayGridClass = ResourceDayGrid; + + ResourceAgendaView.prototype.renderHead = function() { + ResourceAgendaView.__super__.renderHead.apply(this, arguments); + return this.timeGrid.processHeadResourceEls(this.headContainerEl); + }; + + ResourceAgendaView.prototype.setResources = function(resources) { + this.timeGrid.setResources(resources); + if (this.dayGrid) { + this.dayGrid.setResources(resources); + } + this.clearView(); + return this.displayView(); + }; + + ResourceAgendaView.prototype.unsetResources = function() { + this.clearEvents(); + this.timeGrid.unsetResources(); + if (this.dayGrid) { + this.dayGrid.unsetResources(); + } + this.clearView(); + return this.displayView(); + }; + + return ResourceAgendaView; + +})(FC.AgendaView); + +FC.views.agenda.queryResourceClass = function(viewSpec) { + var ref; + if ((ref = viewSpec.options.groupByResource || viewSpec.options.groupByDateAndResource) != null ? ref : viewSpec.duration.as('days') === 1) { + return ResourceAgendaView; + } +}; + +ResourceBasicView = (function(superClass) { + extend(ResourceBasicView, superClass); + + function ResourceBasicView() { + return ResourceBasicView.__super__.constructor.apply(this, arguments); + } + + ResourceBasicView.mixin(ResourceViewMixin); + + ResourceBasicView.prototype.dayGridClass = ResourceDayGrid; + + ResourceBasicView.prototype.renderHead = function() { + ResourceBasicView.__super__.renderHead.apply(this, arguments); + return this.dayGrid.processHeadResourceEls(this.headContainerEl); + }; + + ResourceBasicView.prototype.setResources = function(resources) { + this.dayGrid.setResources(resources); + this.clearView(); + return this.displayView(); + }; + + ResourceBasicView.prototype.unsetResources = function() { + this.clearEvents(); + this.dayGrid.unsetResources(); + this.clearView(); + return this.displayView(); + }; + + return ResourceBasicView; + +})(FC.BasicView); + +ResourceMonthView = (function(superClass) { + extend(ResourceMonthView, superClass); + + function ResourceMonthView() { + return ResourceMonthView.__super__.constructor.apply(this, arguments); + } + + ResourceMonthView.mixin(ResourceViewMixin); + + ResourceMonthView.prototype.dayGridClass = ResourceDayGrid; + + ResourceMonthView.prototype.renderHead = function() { + ResourceMonthView.__super__.renderHead.apply(this, arguments); + return this.dayGrid.processHeadResourceEls(this.headContainerEl); + }; + + ResourceMonthView.prototype.setResources = function(resources) { + this.dayGrid.setResources(resources); + this.clearView(); + return this.displayView(); + }; + + ResourceMonthView.prototype.unsetResources = function() { + this.clearEvents(); + this.dayGrid.unsetResources(); + this.clearView(); + return this.displayView(); + }; + + return ResourceMonthView; + +})(FC.MonthView); + +FC.views.basic.queryResourceClass = function(viewSpec) { + var ref; + if ((ref = viewSpec.options.groupByResource || viewSpec.options.groupByDateAndResource) != null ? ref : viewSpec.duration.as('days') === 1) { + return ResourceBasicView; + } +}; + +FC.views.month.queryResourceClass = function(viewSpec) { + if (viewSpec.options.groupByResource || viewSpec.options.groupByDateAndResource) { + return ResourceMonthView; + } +}; + +RELEASE_DATE = '2016-03-26'; + +UPGRADE_WINDOW = { + years: 1, + weeks: 1 +}; + +LICENSE_INFO_URL = 'http://fullcalendar.io/scheduler/license/'; + +PRESET_LICENSE_KEYS = ['GPL-My-Project-Is-Open-Source', 'CC-Attribution-NonCommercial-NoDerivatives']; + +processLicenseKey = function(key, containerEl) { + if (!isImmuneUrl(window.location.href) && !isValidKey(key)) { + if (!detectWarningInContainer(containerEl)) { + return renderingWarningInContainer('Please use a valid license key. More Info', containerEl); + } + } +}; + + +/* +This decryption is not meant to be bulletproof. Just a way to remind about an upgrade. + */ + +isValidKey = function(key) { + var minPurchaseDate, parts, purchaseDate, releaseDate; + if ($.inArray(key, PRESET_LICENSE_KEYS) !== -1) { + return true; + } + parts = (key || '').match(/^(\d+)\-fcs\-(\d+)$/); + if (parts && parts[1].length === 10) { + purchaseDate = moment.utc(parseInt(parts[2]) * 1000); + releaseDate = moment.utc(FC.mockSchedulerReleaseDate || RELEASE_DATE); + if (releaseDate.isValid()) { + minPurchaseDate = releaseDate.clone().subtract(UPGRADE_WINDOW); + if (purchaseDate.isAfter(minPurchaseDate)) { + return true; + } + } + } + return false; +}; + +isImmuneUrl = function(url) { + return Boolean(url.match(/\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/)); +}; + +renderingWarningInContainer = function(messageHtml, containerEl) { + return containerEl.append($('
').html(messageHtml)); +}; + +detectWarningInContainer = function(containerEl) { + return containerEl.find('.fc-license-message').length >= 1; +}; + +}); diff --git a/dist/scheduler.min.css b/dist/scheduler.min.css new file mode 100644 index 000000000..8827bf973 --- /dev/null +++ b/dist/scheduler.min.css @@ -0,0 +1,5 @@ +/*! + * FullCalendar Scheduler v1.3.0-beta + * Docs & License: http://fullcalendar.io/scheduler/ + * (c) 2015 Adam Shaw + */.fc-resource-area .fc-cell-content,.fc-timeline .fc-cell-text{padding-left:4px;padding-right:4px}.fc-resource-area th>div,.fc-scroller-canvas,.fc-scroller-canvas>.fc-content,.fc-scroller-clip{position:relative}.fc-scroller-clip,.fc-timeline .fc-cell-content,tr.fc-collapsed>td,tr.fc-transitioning>td{overflow:hidden}.fc-no-scrollbars{background:rgba(255,255,255,0)}.fc-timeline .fc-body .fc-divider.ui-widget-header,.fc-timeline .fc-body .ui-widget-content{background-image:none}.fc-no-scrollbars::-webkit-scrollbar{width:0;height:0}.fc-scroller-canvas{box-sizing:border-box;min-height:100%}.fc-scroller-canvas>.fc-bg{z-index:1}.fc-scroller-canvas>.fc-content{z-index:2;border-style:solid;border-width:0}.ui-widget .fc-scroller-canvas>.fc-content{border-color:transparent}.fc-scroller-canvas.fc-gutter-left>.fc-content{border-left-width:1px;margin-left:-1px}.fc-scroller-canvas.fc-gutter-right>.fc-content{border-right-width:1px;margin-right:-1px}.fc-scroller-canvas.fc-gutter-top>.fc-content{border-top-width:1px;margin-top:-1px}.fc-scroller-canvas.fc-gutter-bottom>.fc-content{border-bottom-width:1px;margin-bottom:-1px}.fc-rtl .fc-timeline{direction:rtl}.fc-timeline .fc-divider{width:3px;border-style:double}.fc-timeline .fc-head>tr>.fc-divider{border-bottom:0}.fc-timeline .fc-body>tr>.fc-divider{border-top:0}.fc-scrolled .fc-head .fc-scroller{z-index:2}.fc-timeline.fc-scrolled .fc-head .fc-scroller{box-shadow:0 3px 4px rgba(0,0,0,.075)}.fc-timeline .fc-body .fc-scroller{z-index:1}.fc-timeline .fc-scroller-canvas>div>div>table,.fc-timeline .fc-scroller-canvas>div>table{border-style:hidden}.fc-timeline td,.fc-timeline th{white-space:nowrap}.fc-timeline .fc-col-resizer{cursor:col-resize}.fc-timeline th{vertical-align:middle}.fc-timeline .fc-head .fc-cell-content{padding-top:3px;padding-bottom:3px}.fc-resource-area{width:30%}.fc-resource-area col{width:40%;min-width:70px}.fc-resource-area col.fc-main-col{width:60%}.fc-flat .fc-expander-space{display:none}.fc-ltr .fc-resource-area tr>*{text-align:left}.fc-rtl .fc-resource-area tr>*{text-align:right}.fc-resource-area .fc-super th{text-align:center}.fc-resource-area th .fc-cell-content{position:relative;z-index:1}.fc-resource-area th .fc-col-resizer,.fc-time-area .fc-bgevent,.fc-time-area .fc-highlight,.fc-time-area .fc-slats{bottom:0;top:0;position:absolute}.fc-resource-area th .fc-col-resizer{z-index:2;width:5px}.fc-ltr .fc-resource-area th .fc-col-resizer{right:-3px}.fc-rtl .fc-resource-area th .fc-col-resizer{left:-3px}tr.fc-transitioning>td>div{transition:margin-top .2s}tr.fc-collapsed>td>div{margin-top:-10px}.fc-body .fc-resource-area .fc-cell-content{padding-top:8px;padding-bottom:8px}.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content{padding-top:5px;padding-bottom:5px}.fc-resource-area .fc-icon{font-size:.9em;vertical-align:middle;margin-top:-2%}.fc-resource-area .fc-expander{cursor:pointer;color:#666}.fc-time-area col{min-width:2.2em}.fc-ltr .fc-time-area .fc-chrono th{text-align:left}.fc-rtl .fc-time-area .fc-chrono th{text-align:right}.fc-time-area .fc-slats{z-index:1;left:0;right:0}.fc-time-area .fc-slats table{height:100%}.fc-time-area .fc-slats .fc-minor{border-style:dotted}.fc-time-area .fc-slats td{border-width:0 1px}.fc-ltr .fc-time-area .fc-slats td{border-right-width:0}.fc-rtl .fc-time-area .fc-slats td{border-left-width:0}.fc-time-area .fc-bgevent-container,.fc-time-area .fc-highlight-container{position:absolute;z-index:2;top:0;bottom:0;width:0}.fc-ltr .fc-time-area .fc-bgevent-container,.fc-ltr .fc-time-area .fc-helper-container,.fc-ltr .fc-time-area .fc-highlight-container{left:0}.fc-rtl .fc-time-area .fc-bgevent-container,.fc-rtl .fc-time-area .fc-helper-container,.fc-rtl .fc-time-area .fc-highlight-container{right:0}.fc-time-area .fc-rows{position:relative;z-index:3}.fc-time-area .fc-rows .ui-widget-content{background:0 0}.fc-time-area .fc-rows td>div{position:relative}.fc-time-area .fc-rows .fc-bgevent-container,.fc-time-area .fc-rows .fc-highlight-container{z-index:1}.fc-time-area .fc-event-container{position:relative;z-index:2;width:0}.fc-time-area .fc-helper-container{position:absolute;z-index:3;top:0}.fc-time-area .fc-event-container{padding-bottom:8px;top:-1px}.fc-time-area tr:first-child .fc-event-container{top:0}.fc-no-overlap .fc-time-area .fc-event-container{padding-bottom:0;top:0}.fc-timeline .fc-now-indicator{z-index:3;top:0}.fc-time-area .fc-now-indicator-arrow{margin:0 -6px;border-width:6px 5px 0;border-left-color:transparent;border-right-color:transparent}.fc-time-area .fc-now-indicator-line{margin:0 -1px;bottom:0;border-left-width:1px}.fc-timeline-event{position:absolute;border-radius:0;padding:2px 0;margin-bottom:1px}.fc-no-overlap .fc-timeline-event{padding:5px 0;margin-bottom:0}.fc-ltr .fc-timeline-event{margin-right:1px}.fc-rtl .fc-timeline-event{margin-left:1px}.fc-timeline-event .fc-content{padding:0 1px;white-space:nowrap;overflow:hidden}.fc-timeline-event .fc-time{font-weight:700;padding:0 1px}.fc-rtl .fc-timeline-event .fc-time{display:inline-block}.fc-timeline-event .fc-title{padding:0 1px}.fc-timeline-event.fc-selected .fc-bg{display:none}.fc-ltr .fc-timeline-event .fc-title{padding-left:10px;margin-left:-8px}.fc-rtl .fc-timeline-event .fc-title{padding-right:10px;margin-right:-8px}.fc-ltr .fc-timeline-event.fc-not-start .fc-title{margin-left:-2px}.fc-rtl .fc-timeline-event.fc-not-start .fc-title{margin-right:-2px}.fc-body .fc-time-area .fc-following,.fc-timeline-event.fc-not-start .fc-title{position:relative}.fc-body .fc-time-area .fc-following:before,.fc-timeline-event.fc-not-start .fc-title:before{content:"";position:absolute;top:50%;margin-top:-5px;border:5px solid #000;border-top-color:transparent;border-bottom-color:transparent;opacity:.5}.fc-ltr .fc-body .fc-time-area .fc-following:before,.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before{border-left:0;left:2px}.fc-rtl .fc-body .fc-time-area .fc-following:before,.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before{border-right:0;right:2px}.fc-license-message{position:absolute;z-index:99999;bottom:1px;left:1px;background:#eee;border-color:#ddd;border-style:solid;border-width:1px 1px 0 0;padding:2px 4px;font-size:12px;border-top-right-radius:3px} \ No newline at end of file diff --git a/dist/scheduler.min.js b/dist/scheduler.min.js new file mode 100644 index 000000000..e27427911 --- /dev/null +++ b/dist/scheduler.min.js @@ -0,0 +1,8 @@ +/*! +FullCalendar Scheduler v1.3.0-beta +Docs & License: http://fullcalendar.io/scheduler/ +(c) 2015 Adam Shaw + */ +!function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):t(jQuery,moment)}(function(t,e){var r,o,i,n,s,l,u,a,h,c,p,d,f,g,y,v,m,w,R,S,b,C,E,T,H,_,I,D,x,F,G,M,W,L,B,k,z,V,P,A,O,N,q,Y,j,U,X,$,K,Q,J,Z,tt,et,rt,ot,it,nt,st,lt,ut,at,ht,ct,pt,dt,ft,gt,yt,vt,mt,wt,Rt,St,bt,Ct,Et,Tt,Ht,_t,It,Dt,xt,Ft,Gt,Mt,Wt,Lt,Bt,kt,zt=function(t,e){function r(){this.constructor=t}for(var o in e)Vt.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},Vt={}.hasOwnProperty,Pt=[].slice;return d=t.fullCalendar,d.schedulerVersion="1.3.0-beta",3!==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."):(o=d.Calendar,n=d.Class,X=d.View,f=d.Grid,vt=d.intersectRanges,ot=d.debounce,Rt=d.isInt,ft=d.getScrollbarWidths,a=d.DragListener,yt=d.htmlEscape,J=d.computeIntervalUnit,Ft=d.proxy,K=d.capitaliseFirstLetter,$=d.applyAll,h=d.EmitterMixin,v=d.ListenerMixin,lt=d.durationHasTime,st=d.divideRangeByDuration,nt=d.divideDurationByDuration,Ct=d.multiplyDuration,Dt=d.parseFieldSpecs,Q=d.compareByFieldSpecs,ut=d.flexibleCompare,mt=d.intersectRects,l=d.CoordCache,at=d.getContentRect,ht=d.getOuterRect,ct=function(t){return t.find("> td").filter(function(t,e){return e.rowSpan<=1})},c=function(e){function r(){r.__super__.constructor.apply(this,arguments),this.requestMovingEnd=ot(this.reportMovingEnd,500)}var o,i;return zt(r,e),r.mixin(h),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(){return this.isTouchScrollEnabled=!0,this.isTouching?void 0:this.unbindPreventTouchScroll()},r.prototype.bindPreventTouchScroll=function(){return this.preventTouchScrollHandler?void 0:this.scrollEl.on("touchmove",this.preventTouchScrollHandler=d.preventDefault)},r.prototype.unbindPreventTouchScroll=function(){return this.preventTouchScrollHandler?(this.scrollEl.off("touchmove",this.preventTouchScrollHandler),this.preventTouchScrollHandler=null):void 0},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(){return this.isScrolling?void 0:(this.isScrolling=!0,this.trigger("scrollStart",this.isTouching))},r.prototype.requestMovingEnd=null,r.prototype.reportMovingEnd=function(){return this.isMoving=!1,this.isTouching?void 0:this.reportScrollEnd()},r.prototype.reportScrollEnd=function(){return this.isScrolling?(this.trigger("scrollEnd"),this.isScrolling=!1):void 0},r.prototype.reportTouchStart=function(){return this.isTouching=!0},r.prototype.reportTouchEnd=function(){return this.isTouching&&(this.isTouching=!1,this.isTouchScrollEnabled&&this.unbindPreventTouchScroll(),!this.isMoving)?this.reportScrollEnd():void 0},r.prototype.getScrollLeft=function(){var t,e,r;if(t=this.scrollEl.css("direction"),e=this.scrollEl[0],r=e.scrollLeft,"rtl"===t)switch(i){case"positive":r=r+e.clientWidth-e.scrollWidth;break;case"reverse":r=-r}return r},r.prototype.setScrollLeft=function(t){var e,r;if(e=this.scrollEl.css("direction"),r=this.scrollEl[0],"rtl"===e)switch(i){case"positive":t=t-r.clientWidth+r.scrollWidth;break;case"reverse":t=-t}return r.scrollLeft=t},r.prototype.getScrollFromLeft=function(){var t,e,r;if(t=this.scrollEl.css("direction"),e=this.scrollEl[0],r=e.scrollLeft,"rtl"===t)switch(i){case"negative":r=r-e.clientWidth+e.scrollWidth;break;case"reverse":r=-r-e.clientWidth+e.scrollWidth}return r},r.prototype.getNativeScrollLeft=function(){return this.scrollEl[0].scrollLeft},r.prototype.setNativeScrollLeft=function(t){return this.scrollEl[0].scrollLeft=t},i=null,o=function(){var e,r,o;return e=t('
A
').appendTo("body"),r=e[0],o=r.scrollLeft>0?"positive":(r.scrollLeft=1,e.scrollLeft>0?"reverse":"negative"),e.remove(),o},t(function(){return i=o()}),r}(d.Scroller),s=function(e){function r(){r.__super__.constructor.apply(this,arguments),"clipped-scroll"===this.overflowX&&(this.overflowX="scroll",this.isHScrollbarsClipped=!0),"clipped-scroll"===this.overflowY&&(this.overflowY="scroll",this.isVScrollbarsClipped=!0)}return zt(r,e),r.prototype.isHScrollbarsClipped=!1,r.prototype.isVScrollbarsClipped=!1,r.prototype.renderEl=function(){var e;return e=r.__super__.renderEl.apply(this,arguments),t('
').append(e)},r.prototype.updateSize=function(){var t,e,r;return e=this.scrollEl,r=ft(e),t={marginLeft:0,marginRight:0,marginTop:0,marginBottom:0},this.isHScrollbarsClipped&&(t.marginTop=-r.top,t.marginBottom=-r.bottom),this.isVScrollbarsClipped&&(t.marginLeft=-r.left,t.marginRight=-r.right),e.css(t),e.toggleClass("fc-no-scrollbars",(this.isHScrollbarsClipped||"hidden"===this.overflowX)&&(this.isVScrollbarsClipped||"hidden"===this.overflowY)&&!(r.top||r.bottom||r.left||r.right))},r.prototype.getScrollbarWidths=function(){var t;return t=ft(this.scrollEl),this.isHScrollbarsClipped&&(t.top=0,t.bottom=0),this.isVScrollbarsClipped&&(t.left=0,t.right=0),t},r}(c),O=function(){function e(){this.gutters={}}return e.prototype.el=null,e.prototype.contentEl=null,e.prototype.bgEl=null,e.prototype.gutters=null,e.prototype.width=null,e.prototype.minWidth=null,e.prototype.render=function(){return this.el=t('
'),this.contentEl=this.el.find(".fc-content"),this.bgEl=this.el.find(".fc-bg")},e.prototype.setGutters=function(e){return e?t.extend(this.gutters,e):this.gutters={},this.updateSize()},e.prototype.setWidth=function(t){return this.width=t,this.updateSize()},e.prototype.setMinWidth=function(t){return this.minWidth=t,this.updateSize()},e.prototype.clearWidth=function(){return this.width=null,this.minWidth=null,this.updateSize()},e.prototype.updateSize=function(){var t;return t=this.gutters,this.el.toggleClass("fc-gutter-left",Boolean(t.left)).toggleClass("fc-gutter-right",Boolean(t.right)).toggleClass("fc-gutter-top",Boolean(t.top)).toggleClass("fc-gutter-bottom",Boolean(t.bottom)).css({paddingLeft:t.left||"",paddingRight:t.right||"",paddingTop:t.top||"",paddingBottom:t.bottom||"",width:null!=this.width?this.width+(t.left||0)+(t.right||0):"",minWidth:null!=this.minWidth?this.minWidth+(t.left||0)+(t.right||0):""}),this.bgEl.css({left:t.left||"",right:t.right||"",top:t.top||"",bottom:t.bottom||""})},e}(),A=function(){function t(t,e){var r,o,i,n;for(this.axis=t,this.scrollers=e,i=this.scrollers,r=0,o=i.length;o>r;r++)n=i[r],this.initScroller(n)}return t.prototype.axis=null,t.prototype.scrollers=null,t.prototype.masterScroller=null,t.prototype.initScroller=function(t){return t.scrollEl.on("wheel mousewheel DomMouseScroll MozMousePixelScroll",function(e){return function(){e.assignMasterScroller(t)}}(this)),t.on("scrollStart",function(e){return function(){return e.masterScroller?void 0:e.assignMasterScroller(t)}}(this)).on("scroll",function(e){return function(){var r,o,i,n,s;if(t===e.masterScroller){for(n=e.scrollers,s=[],r=0,o=n.length;o>r;r++)if(i=n[r],i!==t)switch(e.axis){case"horizontal":s.push(i.setNativeScrollLeft(t.getNativeScrollLeft()));break;case"vertical":s.push(i.setScrollTop(t.getScrollTop()));break;default:s.push(void 0)}else s.push(void 0);return s}}}(this)).on("scrollEnd",function(e){return function(){return t===e.masterScroller?e.unassignMasterScroller():void 0}}(this))},t.prototype.assignMasterScroller=function(t){var e,r,o,i;for(this.unassignMasterScroller(),this.masterScroller=t,i=this.scrollers,e=0,r=i.length;r>e;e++)o=i[e],o!==t&&o.disableTouchScroll()},t.prototype.unassignMasterScroller=function(){var t,e,r,o;if(this.masterScroller){for(o=this.scrollers,t=0,e=o.length;e>t;t++)r=o[t],r.enableTouchScroll();this.masterScroller=null}},t.prototype.update=function(){var t,e,r,o,i,n,s,l,u,a,h,c,p;for(t=function(){var t,e,r,o;for(r=this.scrollers,o=[],t=0,e=r.length;e>t;t++)c=r[t],o.push(c.getScrollbarWidths());return o}.call(this),l=u=a=s=0,r=0,i=t.length;i>r;r++)p=t[r],l=Math.max(l,p.left),u=Math.max(u,p.right),a=Math.max(a,p.top),s=Math.max(s,p.bottom);for(h=this.scrollers,e=o=0,n=h.length;n>o;e=++o)c=h[e],p=t[e],c.canvas.setGutters("horizontal"===this.axis?{left:l-p.left,right:u-p.right}:{top:a-p.top,bottom:s-p.bottom})},t}(),V=function(){function e(t){this.scroller=t,this.sprites=[],d.isTouchEnabled&&(this.isForcedRelative=!0),t.on(d.isTouchEnabled?"scrollEnd":"scroll",function(t){return function(){return t.handleScroll()}}(this))}return e.prototype.scroller=null,e.prototype.scrollbarWidths=null,e.prototype.sprites=null,e.prototype.viewportRect=null,e.prototype.contentOffset=null,e.prototype.isHFollowing=!0,e.prototype.isVFollowing=!1,e.prototype.containOnNaturalLeft=!1,e.prototype.containOnNaturalRight=!1,e.prototype.minTravel=0,e.prototype.isForcedRelative=!1,e.prototype.setSprites=function(e){var r,o,i;if(this.clearSprites(),e instanceof t)return this.sprites=function(){var r,o,n;for(n=[],r=0,o=e.length;o>r;r++)i=e[r],n.push(new P(t(i),this));return n}.call(this);for(r=0,o=e.length;o>r;r++)i=e[r],i.follower=this;return this.sprites=e},e.prototype.clearSprites=function(){var t,e,r,o;for(r=this.sprites,t=0,e=r.length;e>t;t++)o=r[t],o.clear();return this.sprites=[]},e.prototype.handleScroll=function(){return this.updateViewport(),this.updatePositions()},e.prototype.cacheDimensions=function(){var t,e,r,o;for(this.updateViewport(),this.scrollbarWidths=this.scroller.getScrollbarWidths(),this.contentOffset=this.scroller.canvas.el.offset(),r=this.sprites,t=0,e=r.length;e>t;t++)o=r[t],o.cacheDimensions()},e.prototype.updateViewport=function(){var t,e,r;return e=this.scroller,t=e.getScrollFromLeft(),r=e.getScrollTop(),this.viewportRect={left:t,right:t+e.getClientWidth(),top:r,bottom:r+e.getClientHeight()}},e.prototype.forceRelative=function(){var t,e,r,o,i;if(!this.isForcedRelative){for(this.isForcedRelative=!0,r=this.sprites,o=[],t=0,e=r.length;e>t;t++)i=r[t],o.push(i.doAbsolute?i.assignPosition():void 0);return o}},e.prototype.clearForce=function(){var t,e,r,o,i;if(this.isForcedRelative&&!d.isTouchEnabled){for(this.isForcedRelative=!1,r=this.sprites,o=[],t=0,e=r.length;e>t;t++)i=r[t],o.push(i.assignPosition());return o}},e.prototype.update=function(){return this.cacheDimensions(),this.updatePositions()},e.prototype.updatePositions=function(){var t,e,r,o;for(r=this.sprites,t=0,e=r.length;e>t;t++)o=r[t],o.updatePosition()},e.prototype.getContentRect=function(t){return at(t,this.contentOffset)},e.prototype.getBoundingRect=function(t){return ht(t,this.contentOffset)},e}(),P=function(){function t(t,e){this.el=t,this.follower=null!=e?e:null,this.isBlock="block"===this.el.css("display"),this.el.css("position","relative")}return t.prototype.follower=null,t.prototype.el=null,t.prototype.absoluteEl=null,t.prototype.naturalRect=null,t.prototype.parentRect=null,t.prototype.containerRect=null,t.prototype.isEnabled=!0,t.prototype.isHFollowing=!1,t.prototype.isVFollowing=!1,t.prototype.doAbsolute=!1,t.prototype.isAbsolute=!1,t.prototype.isCentered=!1,t.prototype.rect=null,t.prototype.isBlock=!1,t.prototype.naturalWidth=null,t.prototype.disable=function(){return this.isEnabled?(this.isEnabled=!1,this.resetPosition(),this.unabsolutize()):void 0},t.prototype.enable=function(){return this.isEnabled?void 0:(this.isEnabled=!0,this.assignPosition())},t.prototype.clear=function(){return this.disable(),this.follower=null,this.absoluteEl=null},t.prototype.cacheDimensions=function(){var t,e,r,o,i,n,s,l;return o=!1,i=!1,r=!1,this.naturalWidth=this.el.width(),this.resetPosition(),e=this.follower,s=this.naturalRect=e.getBoundingRect(this.el),l=this.el.parent(),this.parentRect=e.getBoundingRect(l),t=this.containerRect=bt(e.getContentRect(l),s),n=e.minTravel,e.containOnNaturalLeft&&(t.left=s.left),e.containOnNaturalRight&&(t.right=s.right),e.isHFollowing&&dt(t)-dt(s)>=n&&(r="center"===this.el.css("text-align"),o=!0),e.isVFollowing&&pt(t)-pt(s)>=n&&(i=!0),this.isHFollowing=o,this.isVFollowing=i,this.isCentered=r},t.prototype.updatePosition=function(){return this.computePosition(),this.assignPosition()},t.prototype.resetPosition=function(){return this.el.css({top:"",left:""})},t.prototype.computePosition=function(){var t,e,r,o,i,n,s,l;return s=this.follower.viewportRect,r=this.parentRect,t=this.containerRect,l=mt(s,r),o=null,e=!1,l&&(o=et(this.naturalRect),n=mt(o,r),(this.isCentered&&!Mt(s,r)||n&&!Mt(s,n))&&(e=!0,this.isHFollowing&&(this.isCentered?(i=dt(o),o.left=(l.left+l.right)/2-i/2,o.right=o.left+i):gt(o,s)||(e=!1),gt(o,t)&&(e=!1)),this.isVFollowing&&(kt(o,s)||(e=!1),kt(o,t)&&(e=!1)),Mt(s,o)||(e=!1))),this.rect=o,this.doAbsolute=e},t.prototype.assignPosition=function(){var t,e;return this.isEnabled?this.rect?this.doAbsolute&&!this.follower.isForcedRelative?(this.absolutize(),this.absoluteEl.css({top:this.rect.top-this.follower.viewportRect.top+this.follower.scrollbarWidths.top,left:this.rect.left-this.follower.viewportRect.left+this.follower.scrollbarWidths.left,width:this.isBlock?this.naturalWidth:""})):(e=this.rect.top-this.naturalRect.top,t=this.rect.left-this.naturalRect.left,this.unabsolutize(),this.el.toggleClass("fc-following",Boolean(e||t)).css({top:e,left:t})):this.unabsolutize():void 0},t.prototype.absolutize=function(){return this.isAbsolute?void 0:(this.absoluteEl||(this.absoluteEl=this.buildAbsoluteEl()),this.absoluteEl.appendTo(this.follower.scroller.el),this.el.css("visibility","hidden"),this.isAbsolute=!0)},t.prototype.unabsolutize=function(){return this.isAbsolute?(this.absoluteEl.detach(),this.el.css("visibility",""),this.isAbsolute=!1):void 0},t.prototype.buildAbsoluteEl=function(){return this.el.clone().addClass("fc-following").css({position:"absolute","z-index":1e3,"font-weight":this.el.css("font-weight"),"font-size":this.el.css("font-size"),"font-family":this.el.css("font-family"),color:this.el.css("color"),"padding-top":this.el.css("padding-top"),"padding-bottom":this.el.css("padding-bottom"),"padding-left":this.el.css("padding-left"),"padding-right":this.el.css("padding-right"),"pointer-events":"none"})},t}(),et=function(t){return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},dt=function(t){return t.right-t.left},pt=function(t){return t.bottom-t.top},Mt=function(t,e){return Wt(t,e)&&Lt(t,e)},Wt=function(t,e){return e.left>=t.left&&e.right<=t.right},Lt=function(t,e){return e.top>=t.top&&e.bottom<=t.bottom},gt=function(t,e){return t.lefte.right?(t.left=e.right-dt(t),t.right=e.right,!0):!1},kt=function(t,e){return t.tope.bottom?(t.top=e.bottom-pt(t),t.bottom=e.bottom,!0):!1},bt=function(t,e){return{left:Math.min(t.left,e.left),right:Math.max(t.right,e.right),top:Math.min(t.top,e.top),bottom:Math.max(t.bottom,e.bottom)}},i=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.prototype.resourceManager=null,r.prototype.initialize=function(){return this.resourceManager=new D(this)},r.prototype.instantiateView=function(t){var e,r;return e=this.getViewSpec(t),r=e["class"],this.options.resources&&e.options.resources!==!1&&(e.queryResourceClass?r=e.queryResourceClass(e)||r:e.resourceClass&&(r=e.resourceClass)),new r(this,t,e.options,e.duration)},r.prototype.getResources=function(){return this.resourceManager.topLevelResources},r.prototype.addResource=function(t,e){var r;null==e&&(e=!1),r=this.resourceManager.addResource(t),e&&this.view.scrollToResource&&r.done(function(t){return function(e){return t.view.scrollToResource(e)}}(this))},r.prototype.removeResource=function(t){return this.resourceManager.removeResource(t)},r.prototype.refetchResources=function(){this.resourceManager.fetchResources()},r.prototype.rerenderResources=function(){this.resourceManager.resetResources()},r.prototype.getPeerEvents=function(t,e){var o,i,n,s,l,u,a,h,c,p,d,f,g,y;for(f=r.__super__.getPeerEvents.apply(this,arguments),p=t.resourceId?[t.resourceId]:e?this.getEventResourceIds(e):[],o=[],n=0,u=f.length;u>n;n++){if(d=f[n],i=!1,y=this.getEventResourceIds(d),y.length&&p.length){for(s=0,a=y.length;a>s;s++)for(g=y[s],l=0,h=p.length;h>l;l++)if(c=p[l],c===g){i=!0;break}}else i=!0;i&&o.push(d)}return o},r.prototype.buildSelectSpan=function(t,e,o){var i;return i=r.__super__.buildSelectSpan.apply(this,arguments),o&&(i.resourceId=o),i},r.prototype.getResourceById=function(t){return this.resourceManager.getResourceById(t)},r.prototype.getEventResourceId=function(t){return this.getEventResourceIds(t)[0]},r.prototype.getEventResourceIds=function(t){var e,r,o,i,n,s,l,u;if(u=String(null!=(n=null!=(s=t[this.getEventResourceField()])?s:t.resourceId)?n:""))return[u];if(t.resourceIds){for(i=[],l=t.resourceIds,e=0,r=l.length;r>e;e++)u=l[e],o=String(null!=u?u:""),o&&i.push(o);return i}return[]},r.prototype.setEventResourceId=function(t,e){return t[this.getEventResourceField()]=String(null!=e?e:"")},r.prototype.getEventResourceField=function(){return this.options.eventResourceField||"resourceId"},r.prototype.getResourceEvents=function(e){var r;return r="object"==typeof e?e:this.getResourceById(e),r?this.clientEvents(function(e){return function(o){return-1!==t.inArray(r.id,e.getEventResourceIds(o))}}(this)):[]},r.prototype.getEventResource=function(t){return this.getEventResources(t)[0]},r.prototype.getEventResources=function(t){var e,r,o,i,n,s,l;if(e="object"==typeof t?t:this.clientEvents(t)[0],l=[],e)for(i=this.getEventResourceIds(e),r=0,o=i.length;o>r;r++)s=i[r],n=this.getResourceById(s),n&&l.push(n);return l},r}(o),o.prototype=i.prototype,Tt=X.prototype.displayView,_t=X.prototype.renderSkeleton,It=X.prototype.unrenderSkeleton,Et=X.prototype.displayEvents,X.prototype.isResourcesBound=!1,X.prototype.settingResources=null,X.prototype.displayView=function(){return Tt.apply(this,arguments),xt(this.calendar.options.schedulerLicenseKey,this.el),this.bindResources(),this.whenResources()},X.prototype.unrenderSkeleton=function(){return It.apply(this,arguments),this.unbindResources()},X.prototype.displayEvents=function(t){return this.whenResources(function(e){return function(){return Et.call(e,t)}}(this))},X.prototype.bindResources=function(){var e;return this.isResourcesBound?void 0:(this.isResourcesBound=!0,this.settingResources=t.Deferred(),e=function(t){return function(e){return t.setResources(e),t.settingResources.resolve()}}(this),this.listenTo(this.calendar.resourceManager,{set:e,unset:this.unsetResources,reset:this.resetResources,add:this.addResource,remove:this.removeResource}),this.calendar.resourceManager.hasFetched()?e(this.calendar.resourceManager.topLevelResources):this.calendar.resourceManager.getResources())},X.prototype.unbindResources=function(){return this.isResourcesBound?(this.stopListeningTo(this.calendar.resourceManager),"resolved"===this.settingResources.state()&&this.unsetResources(),this.settingResources=null,this.isResourcesBound=!1):void 0},X.prototype.whenResources=function(e){return"resolved"===this.settingResources.state()?t.when(e?e():void 0):e?this.settingResources.then(e):this.settingResources.promise()},X.prototype.setResources=function(t){},X.prototype.unsetResources=function(){},X.prototype.resetResources=function(t){return this.calendar.rerenderEvents()},X.prototype.addResource=function(t){return this.resetResources(this.calendar.resourceManager.topLevelResources)},X.prototype.removeResource=function(t){return this.resetResources(this.calendar.resourceManager.topLevelResources)},Ht=f.prototype.getSegClasses,f.prototype.getSegClasses=function(t){var e,r,o,i,n;for(e=Ht.apply(this,arguments),i=this.getSegResources(t),r=0,o=i.length;o>r;r++)n=i[r],e=e.concat(n.eventClassName||[]);return e},f.prototype.getSegSkinCss=function(t){var e,r,o,i,n,s,l,u,a,h;return h=this.view,e=t.event,u=e.source||{},r=e.color,a=u.color,s=h.opt("eventColor"),l=this.getSegResources(t),o=function(){var t,e,r,o;for(o=null,e=0,r=l.length;r>e;e++)for(t=l[e];t&&!o;)o=t.eventBackgroundColor||t.eventColor,t=t._parent;return o},i=function(){var t,e,r,o;for(o=null,e=0,r=l.length;r>e;e++)for(t=l[e];t&&!o;)o=t.eventBorderColor||t.eventColor,t=t._parent;return o},n=function(){var t,e,r,o;for(o=null,e=0,r=l.length;r>e;e++)for(t=l[e];t&&!o;)o=t.eventTextColor,t=t._parent;return o},{"background-color":e.backgroundColor||r||o()||u.backgroundColor||a||h.opt("eventBackgroundColor")||s,"border-color":e.borderColor||r||i()||u.borderColor||a||h.opt("eventBorderColor")||s,color:e.textColor||n()||u.textColor||h.opt("eventTextColor")}},f.prototype.getSegResources=function(t){return t.resource?[t.resource]:this.view.calendar.getEventResources(t.event)},D=function(e){function r(t){this.calendar=t,this.initializeCache()}return zt(r,e),r.mixin(h),r.resourceGuid=1,r.ajaxDefaults={dataType:"json",cache:!1},r.prototype.calendar=null,r.prototype.topLevelResources=null,r.prototype.resourcesById=null,r.prototype.fetching=null,r.prototype.hasFetched=function(){return this.fetching&&"resolved"===this.fetching.state()},r.prototype.getResources=function(){var e;return this.fetching?t.Deferred().resolve(this.topLevelResources).promise():(e=t.Deferred(),this.fetchResources().done(function(t){return e.resolve(t)}).fail(function(){return e.resolve([])}),e)},r.prototype.fetchResources=function(){var e;return e=this.fetching,t.when(e).then(function(t){return function(){return t.fetching=t.fetchResourceInputs().then(function(r){return t.setResources(r,Boolean(e)),t.topLevelResources})}}(this))},r.prototype.fetchResourceInputs=function(){var e,o,i;switch(e=t.Deferred(),i=this.calendar.options.resources,"string"===t.type(i)&&(i={url:i}),t.type(i)){case"function":i(function(t){return function(t){return e.resolve(t)}}(this));break;case"object":o=t.ajax(t.extend({},r.ajaxDefaults,i));break;case"array":e.resolve(i);break;default:e.resolve([])}return o||(o=e.promise()),"pending"===!o.state()&&(this.calendar.pushLoading(),o.always(function(){return this.calendar.popLoading()})),o},r.prototype.resetResources=function(){return this.getResources().then(function(t){return function(){return t.trigger("reset",t.topLevelResources)}}(this))},r.prototype.getResourceById=function(t){return this.resourcesById[t]},r.prototype.initializeCache=function(){return this.topLevelResources=[],this.resourcesById={}},r.prototype.setResources=function(t,e){var r,o,i,n,s,l;for(this.initializeCache(),s=function(){var e,r,o;for(o=[],e=0,r=t.length;r>e;e++)n=t[e],o.push(this.buildResource(n));return o}.call(this),l=function(){var t,e,r;for(r=[],t=0,e=s.length;e>t;t++)i=s[t],this.addResourceToIndex(i)&&r.push(i);return r}.call(this),r=0,o=l.length;o>r;r++)i=l[r],this.addResourceToTree(i);return e?this.trigger("reset",this.topLevelResources):this.trigger("set",this.topLevelResources),this.calendar.trigger("resourcesSet",null,this.topLevelResources)},r.prototype.addResource=function(e){return t.when(this.fetching).then(function(t){return function(){var r;return r=t.buildResource(e),t.addResourceToIndex(r)?(t.addResourceToTree(r),t.trigger("add",r),r):!1}}(this))},r.prototype.addResourceToIndex=function(t){var e,r,o,i;if(this.resourcesById[t.id])return!1;for(this.resourcesById[t.id]=t,i=t.children,r=0,o=i.length;o>r;r++)e=i[r],this.addResourceToIndex(e);return!0},r.prototype.addResourceToTree=function(t){var e,r,o,i;if(!t.parent){if(r=String(null!=(o=t.parentId)?o:"")){if(e=this.resourcesById[r],!e)return!1;t.parent=e,i=e.children}else i=this.topLevelResources;i.push(t)}return!0},r.prototype.removeResource=function(e){var r;return r="object"==typeof e?e.id:e,t.when(this.fetching).then(function(t){return function(){var e;return e=t.removeResourceFromIndex(r),e&&(t.removeResourceFromTree(e),t.trigger("remove",e)),e}}(this))},r.prototype.removeResourceFromIndex=function(t){var e,r,o,i,n;if(n=this.resourcesById[t]){for(delete this.resourcesById[t],i=n.children,r=0,o=i.length;o>r;r++)e=i[r],this.removeResourceFromIndex(e.id);return n}return!1},r.prototype.removeResourceFromTree=function(t,e){var r,o,i,n;for(null==e&&(e=this.topLevelResources),r=o=0,i=e.length;i>o;r=++o){if(n=e[r],n===t)return t.parent=null,e.splice(r,1),!0;if(this.removeResourceFromTree(t,n.children))return!0}return!1},r.prototype.buildResource=function(e){var o,i,n,s,l;return l=t.extend({},e),l.id=String(null!=(s=e.id)?s:"_fc"+r.resourceGuid++),n=e.eventClassName,l.eventClassName=function(){switch(t.type(n)){case"string":return n.split(/\s+/);case"array":return n;default:return[]}}(),l.children=function(){var t,r,n,s,u;for(s=null!=(n=e.children)?n:[],u=[],t=0,r=s.length;r>t;t++)i=s[t],o=this.buildResource(i),o.parent=l,u.push(o);return u}.call(this),l},r}(n),L={resourceTextFunc:null,unsetResources:function(){return this.clearEvents()},resetResources:function(t){var e;return e=this.queryScroll(),this.unsetResources(),this.setResources(t),this.setScroll(e),this.calendar.rerenderEvents()},getResourceText:function(t){return this.getResourceTextFunc()(t)},getResourceTextFunc:function(){var t;return this.resourceTextFunc?this.resourceTextFunc:(t=this.opt("resourceText"),"function"!=typeof t&&(t=function(t){return t.title||t.id}),this.resourceTextFunc=t)},triggerDayClick:function(t,e,r){var o;return o=this.calendar.resourceManager,this.trigger("dayClick",e,this.calendar.applyTimezone(t.start),r,this,o.getResourceById(t.resourceId))},triggerSelect:function(t,e){var r;return r=this.calendar.resourceManager,this.trigger("select",null,this.calendar.applyTimezone(t.start),this.calendar.applyTimezone(t.end),e,this,r.getResourceById(t.resourceId))},triggerExternalDrop:function(t,e,r,o,i){return this.trigger("drop",r[0],e.start,o,i,e.resourceId),t?this.trigger("eventReceive",null,t):void 0},reportEventDrop:function(){var t,e,r,o;return e=arguments[0],t=arguments[1],r=3<=arguments.length?Pt.call(arguments,2):[],t=this.normalizeDropLocation(t),t.resourceId&&e.resourceIds&&(t.resourceIds=null),(o=X.prototype.reportEventDrop).call.apply(o,[this,e,t].concat(Pt.call(r)))},reportExternalDrop:function(){var t,e,r,o;return e=arguments[0],t=arguments[1],r=3<=arguments.length?Pt.call(arguments,2):[],t=this.normalizeDropLocation(t),(o=X.prototype.reportExternalDrop).call.apply(o,[this,e,t].concat(Pt.call(r)))},normalizeDropLocation:function(e){var r;return r=t.extend({},e),delete r.resourceId,this.calendar.setEventResourceId(r,e.resourceId),r}},I={allowCrossResource:!0,eventRangeToSpans:function(e,r){var o,i,n,s,l;if(s=this.view.calendar.getEventResourceIds(r),s.length){for(l=[],o=0,i=s.length;i>o;o++)n=s[o],l.push(t.extend({},e,{resourceId:n}));return l}return d.isBgEvent(r)?f.prototype.eventRangeToSpans.apply(this,arguments):[]},fabricateHelperEvent:function(t,e){var r;return r=f.prototype.fabricateHelperEvent.apply(this,arguments),this.view.calendar.setEventResourceId(r,t.resourceId),r},computeEventDrop:function(t,e,r){var o,i;return o=!0,o||t.resourceId===e.resourceId?(i=f.prototype.computeEventDrop.apply(this,arguments),i&&(i.resourceId=e.resourceId),i):null},computeExternalDrop:function(t,e){var r;return r=f.prototype.computeExternalDrop.apply(this,arguments),r&&(r.resourceId=t.resourceId),r},computeEventResize:function(t,e,r,o){var i;if(this.allowCrossResource||e.resourceId===r.resourceId)return i=f.prototype.computeEventResize.apply(this,arguments),i&&(i.resourceId=e.resourceId),i},computeSelectionSpan:function(t,e){var r;if(this.allowCrossResource||t.resourceId===e.resourceId)return r=f.prototype.computeSelectionSpan.apply(this,arguments),r&&(r.resourceId=t.resourceId),r}},_={flattenedResources:null,resourceCnt:0,datesAboveResources:!1,allowCrossResource:!1,setResources:function(t){return this.flattenedResources=this.flattenResources(t),this.resourceCnt=this.flattenedResources.length,this.updateDayTableCols()},unsetResources:function(){return this.flattenedResources=null,this.resourceCnt=0,this.updateDayTableCols()},flattenResources:function(t){var e,r,o,i;return r=this.view.opt("resourceOrder"),r?(e=Dt(r),i=function(t,r){return Q(t,r,e)}):i=null,o=[],this.accumulateResources(t,i,o),o},accumulateResources:function(t,e,r){var o,i,n,s,l;for(e?(l=t.slice(0),l.sort(e)):l=t,s=[],o=0,i=l.length;i>o;o++)n=l[o],r.push(n),s.push(this.accumulateResources(n.children,e,r));return s},updateDayTableCols:function(){return this.datesAboveResources=this.view.opt("groupByDateAndResource"),d.DayTableMixin.updateDayTableCols.call(this)},computeColCnt:function(){return(this.resourceCnt||1)*this.daysPerRow},getColDayIndex:function(t){return this.isRTL&&(t=this.colCnt-1-t),this.datesAboveResources?Math.floor(t/(this.resourceCnt||1)):t%this.daysPerRow},getColResource:function(t){return this.flattenedResources[this.getColResourceIndex(t)]},getColResourceIndex:function(t){return this.isRTL&&(t=this.colCnt-1-t),this.datesAboveResources?t%(this.resourceCnt||1):Math.floor(t/this.daysPerRow)},indicesToCol:function(t,e){var r;return r=this.datesAboveResources?e*(this.resourceCnt||1)+t:t*this.daysPerRow+e,this.isRTL&&(r=this.colCnt-1-r),r},renderHeadTrHtml:function(){return this.resourceCnt?this.daysPerRow>1?this.datesAboveResources?this.renderHeadDateAndResourceHtml():this.renderHeadResourceAndDateHtml():this.renderHeadResourceHtml():d.DayTableMixin.renderHeadTrHtml.call(this)},renderHeadResourceHtml:function(){var t,e,r,o,i;for(i=[],r=this.flattenedResources,t=0,e=r.length;e>t;t++)o=r[t],i.push(this.renderHeadResourceCellHtml(o));return this.wrapTr(i,"renderHeadIntroHtml")},renderHeadResourceAndDateHtml:function(){var t,e,r,o,i,n,s,l,u,a;for(a=[],e=[],s=this.flattenedResources,o=0,n=s.length;n>o;o++)for(u=s[o],a.push(this.renderHeadResourceCellHtml(u,null,this.daysPerRow)),r=i=0,l=this.daysPerRow;l>i;r=i+=1)t=this.dayDates[r].clone(),e.push(this.renderHeadResourceDateCellHtml(t,u));return this.wrapTr(a,"renderHeadIntroHtml")+this.wrapTr(e,"renderHeadIntroHtml")},renderHeadDateAndResourceHtml:function(){var t,e,r,o,i,n,s,l,u,a;for(e=[],a=[],r=o=0,s=this.daysPerRow;s>o;r=o+=1)for(t=this.dayDates[r].clone(),e.push(this.renderHeadDateCellHtml(t,this.resourceCnt)),l=this.flattenedResources,i=0,n=l.length;n>i;i++)u=l[i],a.push(this.renderHeadResourceCellHtml(u,t));return this.wrapTr(e,"renderHeadIntroHtml")+this.wrapTr(a,"renderHeadIntroHtml")},renderHeadResourceCellHtml:function(t,e,r){return'1?' colspan="'+r+'"':"")+">"+yt(this.view.getResourceText(t))+""},renderHeadResourceDateCellHtml:function(t,e,r){return this.renderHeadDateCellHtml(t,r,'data-resource-id="'+e.id+'"')},processHeadResourceEls:function(e){return e.find(".fc-resource-cell").each(function(e){return function(r,o){var i;return i=e.datesAboveResources?e.getColResource(r):e.flattenedResources[e.isRTL?e.flattenedResources.length-1-r:r],e.view.trigger("resourceRender",i,i,t(o),t())}}(this))},renderBgCellsHtml:function(t){var e,r,o,i,n,s;if(this.resourceCnt){for(o=[],e=i=0,n=this.colCnt;n>i;e=i+=1)r=this.getCellDate(t,e),s=this.getColResource(e),o.push(this.renderResourceBgCellHtml(r,s));return o.join("")}return d.DayTableMixin.renderBgCellsHtml.call(this,t)},renderResourceBgCellHtml:function(t,e){ +return this.renderBgCellHtml(t,'data-resource-id="'+e.id+'"')},wrapTr:function(t,e){return this.isRTL?(t.reverse(),""+t.join("")+this[e]()+""):""+this[e]()+t.join("")+""}},H=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.mixin(I),r.mixin(_),r.prototype.getHitSpan=function(t){var e;return e=r.__super__.getHitSpan.apply(this,arguments),this.resourceCnt&&(e.resourceId=this.getColResource(t.col).id),e},r.prototype.spanToSegs=function(e){var r,o,i,n,s,l,u,a,h,c,p,d,f;if(h=this.resourceCnt,o=this.datesAboveResources?this.sliceRangeByDay(e):this.sliceRangeByRow(e),h){for(d=[],n=0,u=o.length;u>n;n++)for(f=o[n],c=s=0,a=h;a>s;c=s+=1)p=this.flattenedResources[c],e.resourceId&&e.resourceId!==p.id||(r=t.extend({},f),r.resource=p,this.isRTL?(r.leftCol=this.indicesToCol(c,f.lastRowDayIndex),r.rightCol=this.indicesToCol(c,f.firstRowDayIndex)):(r.leftCol=this.indicesToCol(c,f.firstRowDayIndex),r.rightCol=this.indicesToCol(c,f.lastRowDayIndex)),d.push(r));return d}for(i=0,l=o.length;l>i;i++)f=o[i],this.isRTL?(f.leftCol=f.lastRowDayIndex,f.rightCol=f.firstRowDayIndex):(f.leftCol=f.firstRowDayIndex,f.rightCol=f.lastRowDayIndex);return o},r}(d.DayGrid),G=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.mixin(I),r.mixin(_),r.prototype.getHitSpan=function(t){var e;return e=r.__super__.getHitSpan.apply(this,arguments),this.resourceCnt&&(e.resourceId=this.getColResource(t.col).id),e},r.prototype.spanToSegs=function(e){var r,o,i,n,s,l,u,a,h,c,p,d,f;if(h=this.resourceCnt,o=this.sliceRangeByTimes(e),h){for(d=[],n=0,u=o.length;u>n;n++)for(f=o[n],c=s=0,a=h;a>s;c=s+=1)p=this.flattenedResources[c],e.resourceId&&e.resourceId!==p.id||(r=t.extend({},f),r.resource=p,r.col=this.indicesToCol(c,f.dayIndex),d.push(r));return d}for(i=0,l=o.length;l>i;i++)f=o[i],f.col=f.dayIndex;return o},r}(d.TimeGrid),Y=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return zt(e,t),e.prototype.timeGrid=null,e.prototype.isScrolled=!1,e.prototype.initialize=function(){return this.timeGrid=this.instantiateGrid(),this.intervalDuration=this.timeGrid.duration},e.prototype.instantiateGrid=function(){return new q(this)},e.prototype.setRange=function(t){return e.__super__.setRange.apply(this,arguments),this.timeGrid.setRange(t)},e.prototype.renderSkeleton=function(){return this.el.addClass("fc-timeline"),this.opt("eventOverlap")===!1&&this.el.addClass("fc-no-overlap"),this.el.html(this.renderSkeletonHtml()),this.renderTimeGridSkeleton()},e.prototype.renderSkeletonHtml=function(){return'
'},e.prototype.renderTimeGridSkeleton=function(){return this.timeGrid.setElement(this.el.find("tbody .fc-time-area")),this.timeGrid.headEl=this.el.find("thead .fc-time-area"),this.timeGrid.renderSkeleton(),this.isScrolled=!1,this.timeGrid.bodyScroller.on("scroll",Ft(this,"handleBodyScroll"))},e.prototype.handleBodyScroll=function(t,e){if(t){if(!this.isScrolled)return this.isScrolled=!0,this.el.addClass("fc-scrolled")}else if(this.isScrolled)return this.isScrolled=!1,this.el.removeClass("fc-scrolled")},e.prototype.unrenderSkeleton=function(){return this.timeGrid.removeElement(),this.handleBodyScroll(0),e.__super__.unrenderSkeleton.apply(this,arguments)},e.prototype.renderDates=function(){return this.timeGrid.renderDates()},e.prototype.unrenderDates=function(){return this.timeGrid.unrenderDates()},e.prototype.renderBusinessHours=function(){return this.timeGrid.renderBusinessHours()},e.prototype.unrenderBusinessHours=function(){return this.timeGrid.unrenderBusinessHours()},e.prototype.getNowIndicatorUnit=function(){return this.timeGrid.getNowIndicatorUnit()},e.prototype.renderNowIndicator=function(t){return this.timeGrid.renderNowIndicator(t)},e.prototype.unrenderNowIndicator=function(){return this.timeGrid.unrenderNowIndicator()},e.prototype.prepareHits=function(){return this.timeGrid.prepareHits()},e.prototype.releaseHits=function(){return this.timeGrid.releaseHits()},e.prototype.queryHit=function(t,e){return this.timeGrid.queryHit(t,e)},e.prototype.getHitSpan=function(t){return this.timeGrid.getHitSpan(t)},e.prototype.getHitEl=function(t){return this.timeGrid.getHitEl(t)},e.prototype.updateWidth=function(){return this.timeGrid.updateWidth()},e.prototype.setHeight=function(t,e){var r;return r=e?"auto":t-this.timeGrid.headHeight()-this.queryMiscHeight(),this.timeGrid.bodyScroller.setHeight(r)},e.prototype.queryMiscHeight=function(){return this.el.outerHeight()-this.timeGrid.headScroller.el.outerHeight()-this.timeGrid.bodyScroller.el.outerHeight()},e.prototype.computeInitialScroll=function(t){return this.timeGrid.computeInitialScroll(t)},e.prototype.queryScroll=function(){return this.timeGrid.queryScroll()},e.prototype.setScroll=function(t){return this.timeGrid.setScroll(t)},e.prototype.renderEvents=function(t){return this.timeGrid.renderEvents(t),this.updateWidth()},e.prototype.unrenderEvents=function(){return this.timeGrid.unrenderEvents(),this.updateWidth()},e.prototype.renderDrag=function(t,e){return this.timeGrid.renderDrag(t,e)},e.prototype.unrenderDrag=function(){return this.timeGrid.unrenderDrag()},e.prototype.getEventSegs=function(){return this.timeGrid.getEventSegs()},e.prototype.renderSelection=function(t){return this.timeGrid.renderSelection(t)},e.prototype.unrenderSelection=function(){return this.timeGrid.unrenderSelection()},e}(X),rt=d.cssToStr,q=function(r){function o(){var t;o.__super__.constructor.apply(this,arguments),this.initScaleProps(),this.minTime=e.duration(this.opt("minTime")||"00:00"),this.maxTime=e.duration(this.opt("maxTime")||"24:00"),this.timeWindowMs=this.maxTime-this.minTime,this.snapDuration=(t=this.opt("snapDuration"))?e.duration(t):this.slotDuration,this.minResizeDuration=this.snapDuration,this.snapsPerSlot=nt(this.slotDuration,this.snapDuration),this.slotWidth=this.opt("slotWidth")}return zt(o,r),o.prototype.slotDates=null,o.prototype.slotCnt=null,o.prototype.snapCnt=null,o.prototype.snapsPerSlot=null,o.prototype.snapDiffToIndex=null,o.prototype.snapIndexToDiff=null,o.prototype.headEl=null,o.prototype.slatContainerEl=null,o.prototype.slatEls=null,o.prototype.containerCoordCache=null,o.prototype.slatCoordCache=null,o.prototype.slatInnerCoordCache=null,o.prototype.headScroller=null,o.prototype.bodyScroller=null,o.prototype.joiner=null,o.prototype.follower=null,o.prototype.eventTitleFollower=null,o.prototype.minTime=null,o.prototype.maxTime=null,o.prototype.timeWindowMs=null,o.prototype.slotDuration=null,o.prototype.snapDuration=null,o.prototype.duration=null,o.prototype.labelInterval=null,o.prototype.headerFormats=null,o.prototype.isTimeScale=null,o.prototype.largeUnit=null,o.prototype.emphasizeWeeks=!1,o.prototype.titleFollower=null,o.prototype.segContainerEl=null,o.prototype.segContainerHeight=null,o.prototype.bgSegContainerEl=null,o.prototype.helperEls=null,o.prototype.innerEl=null,o.prototype.opt=function(t){return this.view.opt(t)},o.prototype.isValidDate=function(t){var e;return this.view.isHiddenDay(t)?!1:this.isTimeScale?(e=t.time()-this.minTime,e=(e%864e5+864e5)%864e5,e').appendTo(this.bodyScroller.canvas.bgEl),this.segContainerEl=t('
').appendTo(this.bodyScroller.canvas.contentEl),this.bgSegContainerEl=this.bodyScroller.canvas.bgEl,this.containerCoordCache=new l({els:this.bodyScroller.canvas.el,isHorizontal:!0,isVertical:!0}),this.joiner=new A("horizontal",[this.headScroller,this.bodyScroller]),this.follower=new V(this.headScroller),this.eventTitleFollower=new V(this.bodyScroller),this.eventTitleFollower.minTravel=50,this.isRTL?this.eventTitleFollower.containOnNaturalRight=!0:this.eventTitleFollower.containOnNaturalLeft=!0,o.__super__.renderSkeleton.apply(this,arguments)},o.prototype.headColEls=null,o.prototype.slatColEls=null,o.prototype.renderDates=function(){var t,e,r,o,i;for(this.headScroller.canvas.contentEl.html(this.renderHeadHtml()),this.headColEls=this.headScroller.canvas.contentEl.find("col"),this.slatContainerEl.html(this.renderSlatHtml()),this.slatColEls=this.slatContainerEl.find("col"),this.slatEls=this.slatContainerEl.find("td"),this.slatCoordCache=new l({els:this.slatEls,isHorizontal:!0}),this.slatInnerCoordCache=new l({els:this.slatEls.find("> div"),isHorizontal:!0,offsetParent:this.bodyScroller.canvas.el}),i=this.slotDates,e=r=0,o=i.length;o>r;e=++r)t=i[e],this.view.trigger("dayRender",null,t,this.slatEls.eq(e));return this.follower?this.follower.setSprites(this.headEl.find("tr:not(:last-child) span")):void 0},o.prototype.unrenderDates=function(){return this.follower&&this.follower.clearSprites(),this.headScroller.canvas.contentEl.empty(),this.slatContainerEl.empty(),this.headScroller.canvas.clearWidth(),this.bodyScroller.canvas.clearWidth()},o.prototype.renderHeadHtml=function(){var t,e,r,o,i,n,s,l,u,a,h,c,p,d,f,g,y,v,m,w,R,S,b,C,E,T,H,_,I,D,x,F,G,M,W,L,B;for(g=this.labelInterval,n=this.headerFormats,e=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)i=n[t],r.push([]);return r}(),y=null,I=null,W=this.slotDates,M=[],p=0,v=W.length;v>p;p++){for(r=W[p],B=r.week(),c=this.emphasizeWeeks&&null!==I&&I!==B,x=d=0,m=n.length;m>d;x=++d)i=n[x],F=e[x],y=F[F.length-1],h=n.length>1&&xthis.slotDuration,s="",s+="",f=0,w=W.length;w>f;f++)r=W[f],s+="";for(s+="",s+="",l=E=0,R=e.length;R>E;l=++E){for(F=e[l],a=l===e.length-1,s+="",T=0,S=F.length;S>T;T++)t=F[T],s+='";s+=""}for(s+="
1?' colspan="'+t.colspan+'"':"")+'>
'+yt(t.text)+"
",G="",G+="",_=0,b=M.length;b>_;_++)t=M[_],G+="";for(G+="",G+="",l=D=0,C=M.length;C>D;l=++D)t=M[l],r=W[l],G+=this.slatCellHtml(r,t.weekStart);return G+="
",this._slatHtml=G,s},o.prototype.renderSlatHtml=function(){return this._slatHtml},o.prototype.slatCellHtml=function(t,e){var r;return this.isTimeScale?(r=[],r.push(Rt(st(this.start,t,this.labelInterval))?"fc-major":"fc-minor")):(r=this.getDayClasses(t),r.push("fc-day")),r.unshift(this.view.widgetContentClass),e&&r.push("fc-em-cell"),'
'},o.prototype.businessHourSegs=null,o.prototype.renderBusinessHours=function(){var t,e;return this.largeUnit?void 0:(t=this.view.calendar.getBusinessHoursEvents(!this.isTimeScale),e=this.businessHourSegs=this.eventsToSegs(t),this.renderFill("businessHours",e,"bgevent"))},o.prototype.unrenderBusinessHours=function(){return this.unrenderFill("businessHours")},o.prototype.nowIndicatorEls=null,o.prototype.getNowIndicatorUnit=function(){return this.isTimeScale?J(this.slotDuration):void 0},o.prototype.renderNowIndicator=function(e){var r,o,i;return i=[],e=this.normalizeGridDate(e),e>=this.start&&e
").css(o).appendTo(this.headScroller.canvas.el)[0]),i.push(t("
").css(o).appendTo(this.bodyScroller.canvas.el)[0])),this.nowIndicatorEls=t(i)},o.prototype.unrenderNowIndicator=function(){return this.nowIndicatorEls?(this.nowIndicatorEls.remove(),this.nowIndicatorEls=null):void 0},o.prototype.explicitSlotWidth=null,o.prototype.defaultSlotWidth=null,o.prototype.updateWidth=function(){var t,e,r,o,i;return i=Math.round(this.slotWidth||(this.slotWidth=this.computeSlotWidth())),r=i*this.slotDates.length,e="",o=i,t=this.bodyScroller.getClientWidth(),t>r&&(e=t,r="",o=Math.floor(t/this.slotDates.length)),this.headScroller.canvas.setWidth(r),this.headScroller.canvas.setMinWidth(e),this.bodyScroller.canvas.setWidth(r),this.bodyScroller.canvas.setMinWidth(e),this.headColEls.slice(0,-1).add(this.slatColEls.slice(0,-1)).width(o),this.headScroller.updateSize(),this.bodyScroller.updateSize(),this.joiner.update(),this.buildCoords(),this.updateSegPositions(),this.follower&&this.follower.update(),this.eventTitleFollower?this.eventTitleFollower.update():void 0},o.prototype.computeSlotWidth=function(){var e,r,o,i,n,s;return o=0,r=this.headEl.find("tr:last-child th span"),r.each(function(e,r){var i;return i=t(r).outerWidth(),o=Math.max(o,i)}),e=o+1,s=nt(this.labelInterval,this.slotDuration),n=Math.ceil(e/s),i=this.headColEls.eq(0).css("min-width"),i&&(i=parseInt(i,10),i&&(n=Math.max(n,i))),n},o.prototype.buildCoords=function(){return this.containerCoordCache.build(),this.slatCoordCache.build(),this.slatInnerCoordCache.build()},o.prototype.computeDateSnapCoverage=function(t){var e,r,o;return r=st(this.start,t,this.snapDuration),0>r?0:r>=this.snapDiffToIndex.length?this.snapCnt:(o=Math.floor(r),e=this.snapDiffToIndex[o],Rt(e)?e+=r-o:e=Math.ceil(e),e)},o.prototype.dateToCoord=function(t){var e,r,o,i,n;return n=this.computeDateSnapCoverage(t),o=n/this.snapsPerSlot,i=Math.floor(o),i=Math.min(i,this.slotCnt-1),r=o-i,e=this.slatInnerCoordCache,this.isRTL?e.getRightPosition(i)-e.getWidth(i)*r-this.containerCoordCache.getWidth(0):e.getLeftPosition(i)+e.getWidth(i)*r},o.prototype.rangeToCoords=function(t){return this.isRTL?{right:this.dateToCoord(t.start),left:this.dateToCoord(t.end)}:{left:this.dateToCoord(t.start),right:this.dateToCoord(t.end)}},o.prototype.headHeight=function(){var t;return t=this.headScroller.canvas.contentEl.find("table"),t.height.apply(t,arguments)},o.prototype.updateSegPositions=function(){var t,e,r,o,i;for(i=(this.segs||[]).concat(this.businessHourSegs||[]),e=0,r=i.length;r>e;e++)o=i[e],t=this.rangeToCoords(o),o.el.css({left:o.left=t.left,right:-(o.right=t.right)})},o.prototype.computeInitialScroll=function(t){var r,o;return r=0,this.isTimeScale&&(o=this.opt("scrollTime"),o&&(o=e.duration(o),r=this.dateToCoord(this.start.clone().time(o)))),{left:r,top:0}},o.prototype.queryScroll=function(){return{left:this.bodyScroller.getScrollLeft(),top:this.bodyScroller.getScrollTop()}},o.prototype.setScroll=function(t){return this.headScroller.setScrollLeft(t.left),this.headScroller.setScrollLeft(t.left),this.bodyScroller.setScrollTop(t.top)},o.prototype.renderFgSegs=function(t){return t=this.renderFgSegEls(t),this.renderFgSegsInContainers([[this,t]]),this.updateSegFollowers(t),t},o.prototype.unrenderFgSegs=function(){return this.clearSegFollowers(),this.unrenderFgContainers([this])},o.prototype.renderFgSegsInContainers=function(t){var e,r,o,i,n,s,l,u,a,h,c,p,d,f,g,y,v,m,w,R,S,b,C,E,T;for(o=0,s=t.length;s>o;o++)for(w=t[o],e=w[0],T=w[1],i=0,l=T.length;l>i;i++)E=T[i],r=this.rangeToCoords(E),E.el.css({left:E.left=r.left,right:-(E.right=r.right)});for(n=0,u=t.length;u>n;n++)for(R=t[n],e=R[0],T=R[1],f=0,a=T.length;a>f;f++)E=T[f],E.el.appendTo(e.segContainerEl);for(g=0,h=t.length;h>g;g++){for(S=t[g],e=S[0],T=S[1],y=0,c=T.length;c>y;y++)E=T[y],E.height=E.el.outerHeight(!0);this.buildSegLevels(T),e.segContainerHeight=tt(T)}for(C=[],v=0,p=t.length;p>v;v++){for(b=t[v],e=b[0],T=b[1],m=0,d=T.length;d>m;m++)E=T[m],E.el.css("top",E.top);C.push(e.segContainerEl.height(e.segContainerHeight))}return C},o.prototype.buildSegLevels=function(t){var e,r,o,i,n,s,l,u,a,h,c,p,d,f;for(d=[],this.sortEventSegs(t),o=0,s=t.length;s>o;o++){for(f=t[o],f.above=[],a=0;ai;i++)h=c[i],Bt(f,h)&&(f.above.push(h),r=!0);if(!r)break;a+=1}for((d[a]||(d[a]=[])).push(f),a+=1;an;n++)e=p[n],Bt(f,e)&&e.above.push(f);a+=1}}return d},o.prototype.unrenderFgContainers=function(t){var e,r,o,i;for(i=[],r=0,o=t.length;o>r;r++)e=t[r],e.segContainerEl.empty(),e.segContainerEl.height(""),i.push(e.segContainerHeight=null);return i},o.prototype.fgSegHtml=function(t,e){var r,o,i,n,s,l;return o=t.event,i=this.view.isEventDraggable(o),s=t.isStart&&this.view.isEventResizableFromStart(o),n=t.isEnd&&this.view.isEventResizableFromEnd(o),r=this.getSegClasses(t,i,s||n),r.unshift("fc-timeline-event","fc-h-event"),l=this.getEventTimeText(o),'
'+(l?''+yt(l)+"":"")+''+(o.title?yt(o.title):" ")+'
'+(s?'
':"")+(n?'
':"")+"
"},o.prototype.updateSegFollowers=function(t){var e,r,o,i,n;if(this.eventTitleFollower){for(i=[],e=0,r=t.length;r>e;e++)o=t[e],n=o.el.find(".fc-title"),n.length&&i.push(new P(n));return this.eventTitleFollower.setSprites(i)}},o.prototype.clearSegFollowers=function(){return this.eventTitleFollower?this.eventTitleFollower.clearSprites():void 0},o.prototype.segDragStart=function(){return o.__super__.segDragStart.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.forceRelative():void 0},o.prototype.segDragEnd=function(){return o.__super__.segDragEnd.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.clearForce():void 0},o.prototype.segResizeStart=function(){return o.__super__.segResizeStart.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.forceRelative():void 0},o.prototype.segResizeEnd=function(){return o.__super__.segResizeEnd.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.clearForce():void 0},o.prototype.renderHelper=function(t,e){var r;return r=this.eventToSegs(t),r=this.renderFgSegEls(r),this.renderHelperSegsInContainers([[this,r]],e)},o.prototype.renderHelperSegsInContainers=function(e,r){var o,i,n,s,l,u,a,h,c,p,d,f,g,y,v,m,w,R;for(s=[],w=[],l=0,h=e.length;h>l;l++)for(g=e[l],o=g[0],R=g[1],u=0,c=R.length;c>u;u++)m=R[u],i=this.rangeToCoords(m),m.el.css({left:m.left=i.left,right:-(m.right=i.right)}),r&&r.resourceId===(null!=(y=o.resource)?y.id:void 0)?m.el.css("top",r.el.css("top")):m.el.css("top",0);for(a=0,p=e.length;p>a;a++)for(v=e[a],o=v[0],R=v[1],n=t('
').appendTo(o.innerEl),s.push(n[0]),f=0,d=R.length;d>f;f++)m=R[f],n.append(m.el),w.push(m.el[0]);return this.helperEls=this.helperEls?this.helperEls.add(t(s)):t(s),t(w)},o.prototype.unrenderHelper=function(){return this.helperEls?(this.helperEls.remove(),this.helperEls=null):void 0},o.prototype.renderEventResize=function(t,e){return this.renderHighlight(this.eventToSpan(t)),this.renderEventLocationHelper(t,e)},o.prototype.unrenderEventResize=function(){return this.unrenderHighlight(),this.unrenderHelper()},o.prototype.renderFill=function(t,e,r){return e=this.renderFillSegEls(t,e),this.renderFillInContainers(t,[[this,e]],r),e},o.prototype.renderFillInContainers=function(t,e,r){var o,i,n,s,l,u;for(l=[],i=0,n=e.length;n>i;i++)s=e[i],o=s[0],u=s[1],l.push(this.renderFillInContainer(t,o,u,r));return l},o.prototype.renderFillInContainer=function(e,r,o,i){var n,s,l,u,a;if(o.length){for(i||(i=e.toLowerCase()),n=t('
').appendTo(r.bgSegContainerEl),l=0,u=o.length;u>l;l++)a=o[l],s=this.rangeToCoords(a),a.el.css({left:a.left=s.left,right:-(a.right=s.right)}),a.el.appendTo(n);return this.elsByFill[e]=this.elsByFill[e]?this.elsByFill[e].add(n):n}},o.prototype.renderDrag=function(t,e){return e?this.renderEventLocationHelper(t,e):(this.renderHighlight(this.eventToSpan(t)),null)},o.prototype.unrenderDrag=function(){return this.unrenderHelper(),this.unrenderHighlight()},o}(f),tt=function(t){var e,r,o,i;for(o=0,e=0,r=t.length;r>e;e++)i=t[e],o=Math.max(o,Z(i));return o},Z=function(t){return null==t.top&&(t.top=tt(t.above)),t.top+t.height},Bt=function(t,e){return t.lefte.left},S=18,w=6,m=200,R=1e3,u={months:1},z=[{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}],q.prototype.initScaleProps=function(){var e,r,o;return this.labelInterval=this.queryDurationOption("slotLabelInterval"),this.slotDuration=this.queryDurationOption("slotDuration"),this.ensureGridDuration(),this.validateLabelAndSlot(),this.ensureLabelInterval(),this.ensureSlotDuration(),e=this.opt("slotLabelFormat"),o=t.type(e),this.headerFormats="array"===o?e:"string"===o?[e]:this.computeHeaderFormats(),this.isTimeScale=lt(this.slotDuration),this.largeUnit=this.isTimeScale?void 0:(r=J(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")},q.prototype.queryDurationOption=function(t){var r,o;return o=this.opt(t),null!=o&&(r=e.duration(o),+r)?r:void 0},q.prototype.validateLabelAndSlot=function(){var t,e,r;return this.labelInterval&&(t=nt(this.duration,this.labelInterval),t>R&&(d.warn("slotLabelInterval results in too many cells"),this.labelInterval=null)),this.slotDuration&&(e=nt(this.duration,this.slotDuration),e>R&&(d.warn("slotDuration results in too many cells"),this.slotDuration=null)),this.labelInterval&&this.slotDuration&&(r=nt(this.labelInterval,this.slotDuration),!Rt(r)||1>r)?(d.warn("slotLabelInterval must be a multiple of slotDuration"),this.slotDuration=null):void 0},q.prototype.ensureGridDuration=function(){var t,r,o,i,n;if(t=this.duration,!t){if(t=this.view.intervalDuration,!t)if(this.labelInterval||this.slotDuration)for(n=this.ensureLabelInterval(),o=z.length-1;o>=0&&(r=z[o],t=e.duration(r),i=nt(t,n),!(i>=S));o+=-1);else t=e.duration(u);this.duration=t}return t},q.prototype.ensureLabelInterval=function(){var t,r,o,i,n,s,l,u,a;if(n=this.labelInterval,!n){if(this.duration||this.slotDuration||this.ensureGridDuration(),this.slotDuration){for(r=0,s=z.length;s>r;r++)if(t=z[r],a=e.duration(t),u=nt(a,this.slotDuration),Rt(u)&&w>=u){n=a;break}n||(n=this.slotDuration)}else for(o=0,l=z.length;l>o&&(t=z[o],n=e.duration(t),i=nt(this.duration,n),!(i>=S));o++);this.labelInterval=n}return n},q.prototype.ensureSlotDuration=function(){var t,r,o,i,n,s,l,u;if(s=this.slotDuration,!s){for(o=this.ensureLabelInterval(),r=0,i=z.length;i>r;r++)if(t=z[r],u=e.duration(t),l=nt(o,u),Rt(l)&&l>1&&w>=l){s=u;break}s&&this.duration&&(n=nt(this.duration,s),n>m&&(s=null)),s||(s=o),this.slotDuration=s}return s},q.prototype.computeHeaderFormats=function(){var t,e,r,o,i,n,s,l;switch(s=this.view,o=this.duration,i=this.labelInterval,n=J(i),l=this.opt("weekNumbers"),t=e=r=null,"week"!==n||l||(n="day"),n){case"year":t="YYYY";break;case"month":o.asYears()>1&&(t="YYYY"),e="MMM";break;case"week":o.asYears()>1&&(t="YYYY"),e=this.opt("shortWeekFormat");break;case"day":o.asYears()>1?t=this.opt("monthYearFormat"):o.asMonths()>1&&(t="MMMM"),l&&(e=this.opt("weekFormat")),r="dd D";break;case"hour":l&&(t=this.opt("weekFormat")),o.asDays()>1&&(e=this.opt("dayOfMonthFormat")),r=this.opt("smallTimeFormat");break;case"minute":i.asMinutes()/60>=w?(t=this.opt("hourFormat"),e="[:]mm"):t=this.opt("mediumTimeFormat");break;case"second":i.asSeconds()/60>=w?(t="LT",e="[:]ss"):t="LTS";break;case"millisecond":t="LTS",e="[.]SSS"}return[].concat(t||[],e||[],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}},W=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.mixin(L),r.prototype.resourceGrid=null,r.prototype.tbodyHash=null,r.prototype.joiner=null,r.prototype.dividerEls=null,r.prototype.superHeaderText=null,r.prototype.isVGrouping=null,r.prototype.isHGrouping=null,r.prototype.groupSpecs=null,r.prototype.colSpecs=null,r.prototype.orderSpecs=null,r.prototype.rowHierarchy=null,r.prototype.resourceRowHash=null,r.prototype.nestingCnt=0,r.prototype.isNesting=null,r.prototype.dividerWidth=null,r.prototype.initialize=function(){return r.__super__.initialize.apply(this,arguments),this.processResourceOptions(),this.resourceGrid=new N(this),this.rowHierarchy=new k(this),this.resourceRowHash={}},r.prototype.instantiateGrid=function(){return new M(this)},r.prototype.processResourceOptions=function(){var t,e,r,o,i,n,s,l,u,a,h,c,p,d,f,g,y,v,m,w,R,S;for(t=this.opt("resourceColumns")||[],f=this.opt("resourceLabelText"),o="Resources",S=null,t.length?S=f:t.push({labelText:f||o,text:this.getResourceTextFunc()}),w=[],i=[],s=[],h=!1,a=!1,c=0,g=t.length;g>c;c++)r=t[c],r.group?i.push(r):w.push(r);for(w[0].isMain=!0,i.length?(s=i,h=!0):(l=this.opt("resourceGroupField"),l&&(a=!0,s.push({field:l,text:this.opt("resourceGroupText"),render:this.opt("resourceGroupRender")}))),e=Dt(this.opt("resourceOrder")),R=[],p=0,y=e.length;y>p;p++){for(m=e[p],u=!1,d=0,v=s.length;v>d;d++)if(n=s[d],n.field===m.field){n.order=m.order,u=!0;break}u||R.push(m)}return this.superHeaderText=S,this.isVGrouping=h,this.isHGrouping=a,this.groupSpecs=s,this.colSpecs=i.concat(w),this.orderSpecs=R},r.prototype.renderSkeleton=function(){return r.__super__.renderSkeleton.apply(this,arguments),this.renderResourceGridSkeleton(),this.tbodyHash={spreadsheet:this.resourceGrid.tbodyEl,event:this.timeGrid.tbodyEl},this.joiner=new A("vertical",[this.resourceGrid.bodyScroller,this.timeGrid.bodyScroller]),this.initDividerMoving()},r.prototype.renderSkeletonHtml=function(){return'
'},r.prototype.renderResourceGridSkeleton=function(){return this.resourceGrid.el=this.el.find("tbody .fc-resource-area"),this.resourceGrid.headEl=this.el.find("thead .fc-resource-area"),this.resourceGrid.renderSkeleton()},r.prototype.initDividerMoving=function(){var t;return this.dividerEls=this.el.find(".fc-divider"),this.dividerWidth=null!=(t=this.opt("resourceAreaWidth"))?t:this.resourceGrid.tableWidth,null!=this.dividerWidth&&this.positionDivider(this.dividerWidth),this.dividerEls.on("mousedown",function(t){return function(e){return t.dividerMousedown(e)}}(this))},r.prototype.dividerMousedown=function(t){var e,r,o,i,n;return r=this.opt("isRTL"),i=30,o=this.el.width()-30,n=this.getNaturalDividerWidth(),e=new a({dragStart:function(t){return function(){return t.dividerEls.addClass("fc-active")}}(this),drag:function(t){return function(e,s){var l;return l=r?n-e:n+e,l=Math.max(l,i),l=Math.min(l,o),t.dividerWidth=l,t.positionDivider(l),t.updateWidth()}}(this),dragEnd:function(t){return function(){return t.dividerEls.removeClass("fc-active")}}(this)}),e.startInteraction(t)},r.prototype.getNaturalDividerWidth=function(){return this.el.find(".fc-resource-area").width()},r.prototype.positionDivider=function(t){return this.el.find(".fc-resource-area").width(t)},r.prototype.renderEvents=function(t){return this.timeGrid.renderEvents(t),this.syncRowHeights(),this.updateWidth()},r.prototype.unrenderEvents=function(){return this.timeGrid.unrenderEvents(),this.syncRowHeights(),this.updateWidth()},r.prototype.updateWidth=function(){return r.__super__.updateWidth.apply(this,arguments),this.resourceGrid.updateWidth(),this.joiner.update(),this.cellFollower?this.cellFollower.update():void 0},r.prototype.updateHeight=function(t){return r.__super__.updateHeight.apply(this,arguments),t?this.syncRowHeights():void 0},r.prototype.setHeight=function(t,e){var r,o;return o=this.syncHeadHeights(),r=e?"auto":t-o-this.queryMiscHeight(),this.timeGrid.bodyScroller.setHeight(r),this.resourceGrid.bodyScroller.setHeight(r)},r.prototype.queryMiscHeight=function(){return this.el.outerHeight()-Math.max(this.resourceGrid.headScroller.el.outerHeight(),this.timeGrid.headScroller.el.outerHeight())-Math.max(this.resourceGrid.bodyScroller.el.outerHeight(),this.timeGrid.bodyScroller.el.outerHeight())},r.prototype.syncHeadHeights=function(){var t;return this.resourceGrid.headHeight("auto"),this.timeGrid.headHeight("auto"),t=Math.max(this.resourceGrid.headHeight(),this.timeGrid.headHeight()), +this.resourceGrid.headHeight(t),this.timeGrid.headHeight(t),t},r.prototype.scrollToResource=function(t){return this.timeGrid.scrollToResource(t)},r.prototype.setResources=function(t){var e,r,o;for(this.batchRows(),e=0,r=t.length;r>e;e++)o=t[e],this.insertResource(o);return this.rowHierarchy.show(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.unsetResources=function(){return this.clearEvents(),this.batchRows(),this.rowHierarchy.removeChildren(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.addResource=function(t){return this.insertResource(t),this.reinitializeCellFollowers()},r.prototype.removeResource=function(t){var e;return e=this.getResourceRow(t.id),e?(this.batchRows(),e.remove(),this.unbatchRows(),this.reinitializeCellFollowers()):void 0},r.prototype.cellFollower=null,r.prototype.reinitializeCellFollowers=function(){var e,r,o,i,n,s;for(this.cellFollower&&this.cellFollower.clearSprites(),this.cellFollower=new V(this.resourceGrid.bodyScroller),this.cellFollower.isHFollowing=!1,this.cellFollower.isVFollowing=!0,i=[],n=this.rowHierarchy.getNodes(),r=0,o=n.length;o>r;r++)s=n[r],s instanceof U&&s.groupTd&&(e=s.groupTd.find(".fc-cell-content"),e.length&&i.push(e[0]));return this.cellFollower.setSprites(t(i))},r.prototype.insertResource=function(t,e){var r,o,i,n,s,l,u;for(u=new F(this,t),null==e&&(n=t.parentId,n&&(e=this.getResourceRow(n))),e?this.insertRowAsChild(u,e):this.insertRow(u),s=t.children,l=[],o=0,i=s.length;i>o;o++)r=s[o],l.push(this.insertResource(r,u));return l},r.prototype.insertRow=function(t,e,r){var o;return null==e&&(e=this.rowHierarchy),null==r&&(r=this.groupSpecs),r.length?(o=this.ensureResourceGroup(t,e,r[0]),o instanceof g?this.insertRowAsChild(t,o):this.insertRow(t,o,r.slice(1))):this.insertRowAsChild(t,e)},r.prototype.insertRowAsChild=function(t,e){return e.addChild(t,this.computeChildRowPosition(t,e))},r.prototype.computeChildRowPosition=function(t,e){var r,o,i,n,s,l;if(this.orderSpecs.length)for(s=e.children,o=i=0,n=s.length;n>i;o=++i)if(l=s[o],r=this.compareResources(l.resource||{},t.resource||{}),r>0)return o;return null},r.prototype.compareResources=function(t,e){return Q(t,e,this.orderSpecs)},r.prototype.ensureResourceGroup=function(t,e,r){var o,i,n,s,l,u,a,h,c,p,d;if(n=(t.resource||{})[r.field],i=null,r.order)for(c=e.children,s=l=0,a=c.length;a>l;s=++l){if(d=c[s],o=ut(d.groupValue,n)*r.order,0===o){i=d;break}if(o>0)break}else for(p=e.children,s=u=0,h=p.length;h>u;s=++u)if(d=p[s],d.groupValue===n){i=d;break}return i||(i=this.isVGrouping?new U(this,r,n):new g(this,r,n),e.addChild(i,s)),i},r.prototype.pairSegsWithRows=function(t){var e,r,o,i,n,s,l,u;for(i=[],n={},e=0,r=t.length;r>e;e++)u=t[e],s=u.resourceId,s&&(l=this.getResourceRow(s),l&&(o=n[s],o||(o=[l,[]],i.push(o),n[s]=o),o[1].push(u)));return i},r.prototype.rowAdded=function(t){var e,r;return t instanceof F&&(this.resourceRowHash[t.resource.id]=t),r=this.isNesting,e=Boolean(this.nestingCnt+=t.depth?1:0),r!==e&&(this.el.toggleClass("fc-nested",e),this.el.toggleClass("fc-flat",!e)),this.isNesting=e},r.prototype.rowRemoved=function(t){var e,r;return t instanceof F&&delete this.resourceRowHash[t.resource.id],r=this.isNesting,e=Boolean(this.nestingCnt-=t.depth?1:0),r!==e&&(this.el.toggleClass("fc-nested",e),this.el.toggleClass("fc-flat",!e)),this.isNesting=e},r.prototype.batchRowDepth=0,r.prototype.shownRowBatch=null,r.prototype.hiddenRowBatch=null,r.prototype.batchRows=function(){return this.batchRowDepth++?void 0:(this.shownRowBatch=[],this.hiddenRowBatch=[])},r.prototype.unbatchRows=function(){return--this.batchRowDepth?void 0:(this.hiddenRowBatch.length&&this.rowsHidden(this.hiddenRowBatch),this.shownRowBatch.length&&this.rowsShown(this.shownRowBatch),this.hiddenRowBatch=null,this.shownRowBatch=null)},r.prototype.rowShown=function(t){return this.shownRowBatch?this.shownRowBatch.push(t):this.rowsShown([t])},r.prototype.rowHidden=function(t){return this.hiddenRowBatch?this.hiddenRowBatch.push(t):this.rowsHidden([t])},r.prototype.rowsShown=function(t){return this.syncRowHeights(t),this.updateWidth()},r.prototype.rowsHidden=function(t){return this.updateWidth()},r.prototype.syncRowHeights=function(t,e){var r,o,i,n,s,l,u,a,h,c;for(null==e&&(e=!1),null==t&&(t=this.getVisibleRows()),l=0,a=t.length;a>l;l++)c=t[l],c.setTrInnerHeight("");for(s=function(){var o,i,n;for(n=[],o=0,i=t.length;i>o;o++)c=t[o],r=c.getMaxTrInnerHeight(),e&&(r+=r%2),n.push(r);return n}(),n=u=0,h=t.length;h>u;n=++u)c=t[n],c.setTrInnerHeight(s[n]);return!e&&(o=this.resourceGrid.tbodyEl.height(),i=this.timeGrid.tbodyEl.height(),Math.abs(o-i)>1)?this.syncRowHeights(t,!0):void 0},r.prototype.getVisibleRows=function(){var t,e,r,o,i;for(r=this.rowHierarchy.getRows(),o=[],t=0,e=r.length;e>t;t++)i=r[t],i.isShown&&o.push(i);return o},r.prototype.getEventRows=function(){var t,e,r,o,i;for(r=this.rowHierarchy.getRows(),o=[],t=0,e=r.length;e>t;t++)i=r[t],i instanceof p&&o.push(i);return o},r.prototype.getResourceRow=function(t){return this.resourceRowHash[t]},r.prototype.setScroll=function(t){return r.__super__.setScroll.apply(this,arguments),this.resourceGrid.bodyScroller.setScrollTop(t.top)},r}(Y),M=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.mixin(I),r.prototype.eventRows=null,r.prototype.shownEventRows=null,r.prototype.tbodyEl=null,r.prototype.rowCoordCache=null,r.prototype.spanToSegs=function(t){var e,o,i,n,s,l;if(l=r.__super__.spanToSegs.apply(this,arguments),e=this.view.calendar,n=t.resourceId)for(o=0,i=l.length;i>o;o++)s=l[o],s.resource=e.getResourceById(n),s.resourceId=n;return l},r.prototype.prepareHits=function(){var t,e;return r.__super__.prepareHits.apply(this,arguments),this.eventRows=this.view.getEventRows(),this.shownEventRows=function(){var e,r,o,i;for(o=this.eventRows,i=[],e=0,r=o.length;r>e;e++)t=o[e],t.isShown&&i.push(t);return i}.call(this),e=function(){var e,r,o,i;for(o=this.shownEventRows,i=[],e=0,r=o.length;r>e;e++)t=o[e],i.push(t.getTr("event")[0]);return i}.call(this),this.rowCoordCache=new l({els:e,isVertical:!0}),this.rowCoordCache.build()},r.prototype.releaseHits=function(){return r.__super__.releaseHits.apply(this,arguments),this.eventRows=null,this.shownEventRows=null,this.rowCoordCache.clear()},r.prototype.queryHit=function(t,e){var o,i;return i=r.__super__.queryHit.apply(this,arguments),i&&(o=this.rowCoordCache.getVerticalIndex(e),null!=o)?{resourceId:this.shownEventRows[o].resource.id,snap:i.snap,component:this,left:i.left,right:i.right,top:this.rowCoordCache.getTopOffset(o),bottom:this.rowCoordCache.getBottomOffset(o)}:void 0},r.prototype.getHitSpan=function(t){var e;return e=this.getSnapRange(t.snap),e.resourceId=t.resourceId,e},r.prototype.getHitEl=function(t){return this.getSnapEl(t.snap)},r.prototype.renderSkeleton=function(){var e;return r.__super__.renderSkeleton.apply(this,arguments),this.segContainerEl.remove(),this.segContainerEl=null,e=t('
').appendTo(this.bodyScroller.canvas.contentEl),this.tbodyEl=e.find("tbody")},r.prototype.renderFgSegs=function(t){var e,r,o,i,n,s,l;for(t=this.renderFgSegEls(t),s=this.view.pairSegsWithRows(t),l=[],o=0,i=s.length;i>o;o++)n=s[o],e=n[0],r=n[1],e.fgSegs=r,e.isShown&&(e.isSegsRendered=!0,l.push(n));return this.renderFgSegsInContainers(l),this.updateSegFollowers(t),t},r.prototype.unrenderFgSegs=function(){var t,e,r,o;for(this.clearSegFollowers(),e=this.view.getEventRows(),r=0,o=e.length;o>r;r++)t=e[r],t.fgSegs=null,t.isSegsRendered=!1;return this.unrenderFgContainers(e)},r.prototype.renderFill=function(t,e,r){var o,i,n,s,l,u,a,h,c,p,d,f;for(e=this.renderFillSegEls(t,e),h=[],l=[],o=0,n=e.length;n>o;o++)d=e[o],d.resourceId?h.push(d):l.push(d);for(a=this.view.pairSegsWithRows(h),f=[],i=0,s=a.length;s>i;i++)u=a[i],c=u[0],p=u[1],"bgEvent"===t&&(c.bgSegs=p),c.isShown&&f.push(u);return l.length&&f.unshift([this,l]),this.renderFillInContainers(t,f,r),e},r.prototype.renderHelper=function(t,e){var r,o;return o=this.eventToSegs(t),o=this.renderFgSegEls(o),r=this.view.pairSegsWithRows(o),this.renderHelperSegsInContainers(r,e)},r.prototype.computeInitialScroll=function(t){var e;return e=r.__super__.computeInitialScroll.apply(this,arguments),t&&(e.resourceId=t.resourceId,e.bottom=t.bottom),e},r.prototype.queryScroll=function(){var t,e,o,i,n,s,l,u;for(u=r.__super__.queryScroll.apply(this,arguments),l=this.bodyScroller.scrollEl.offset().top,n=this.view.getVisibleRows(),o=0,i=n.length;i>o;o++)if(s=n[o],s.resource&&(t=s.getTr("event"),e=t.offset().top+t.outerHeight(),e>l)){u.resourceId=s.resource.id,u.bottom=e-l;break}return u},r.prototype.setScroll=function(t){var e,o,i,n;return t.resourceId&&(n=this.view.getResourceRow(t.resourceId),n&&(e=n.getTr("event"),e&&(i=this.bodyScroller.canvas.el.offset().top,o=e.offset().top+e.outerHeight(),t.top=o-t.bottom-i))),r.__super__.setScroll.call(this,t)},r.prototype.scrollToResource=function(t){var e,r,o,i;return o=this.view.getResourceRow(t.id),o&&(e=o.getTr("event"))?(r=this.bodyScroller.canvas.el.offset().top,i=e.offset().top-r,this.bodyScroller.scrollEl.scrollTop(i)):void 0},r}(q),r=30,N=function(){function e(t){var e;this.view=t,this.isRTL=this.view.opt("isRTL"),this.givenColWidths=this.colWidths=function(){var t,r,o,i;for(o=this.view.colSpecs,i=[],t=0,r=o.length;r>t;t++)e=o[t],i.push(e.width);return i}.call(this)}return e.prototype.view=null,e.prototype.headEl=null,e.prototype.el=null,e.prototype.tbodyEl=null,e.prototype.headScroller=null,e.prototype.bodyScroller=null,e.prototype.joiner=null,e.prototype.colGroupHtml="",e.prototype.headTable=null,e.prototype.headColEls=null,e.prototype.headCellEls=null,e.prototype.bodyColEls=null,e.prototype.bodyTable=null,e.prototype.renderSkeleton=function(){return this.headScroller=new s({overflowX:"clipped-scroll",overflowY:"hidden"}),this.headScroller.canvas=new O,this.headScroller.render(),this.headScroller.canvas.contentEl.html(this.renderHeadHtml()),this.headEl.append(this.headScroller.el),this.bodyScroller=new s({overflowY:"clipped-scroll"}),this.bodyScroller.canvas=new O,this.bodyScroller.render(),this.bodyScroller.canvas.contentEl.html(""+this.colGroupHtml+"
"),this.tbodyEl=this.bodyScroller.canvas.contentEl.find("tbody"),this.el.append(this.bodyScroller.el),this.joiner=new A("horizontal",[this.headScroller,this.bodyScroller]),this.headTable=this.headEl.find("table"),this.headColEls=this.headEl.find("col"),this.headCellEls=this.headScroller.canvas.contentEl.find("tr:last-child th"),this.bodyColEls=this.el.find("col"),this.bodyTable=this.el.find("table"),this.colMinWidths=this.computeColMinWidths(),this.applyColWidths(),this.initColResizing()},e.prototype.renderHeadHtml=function(){var t,e,r,o,i,n,s,l,u,a,h;for(e=this.view.colSpecs,r="",t="",s=0,u=e.length;u>s;s++)h=e[s],t+=h.isMain?'':"";for(t+="",this.colGroupHtml=t,r+=t,r+="",this.view.superHeaderText&&(r+='"),r+="",n=!0,o=l=0,a=e.length;a>l;o=++l)h=e[o],i=o===e.length-1,r+='";return r+="",r+="
'+yt(this.view.superHeaderText)+"
'+(h.isMain?'':"")+''+yt(h.labelText||"")+"
"+(i?"":'
')+"
"},e.prototype.givenColWidths=null,e.prototype.colWidths=null,e.prototype.colMinWidths=null,e.prototype.tableWidth=null,e.prototype.tableMinWidth=null,e.prototype.initColResizing=function(){return this.headEl.find("th .fc-col-resizer").each(function(e){return function(r,o){return o=t(o),o.on("mousedown",function(t){return e.colResizeMousedown(r,t,o)})}}(this))},e.prototype.colResizeMousedown=function(t,e,o){var i,n,s,l;return i=this.colWidths=this.queryColWidths(),i.pop(),i.push(null),l=i[t],s=Math.min(this.colMinWidths[t],r),n=new a({dragStart:function(t){return function(){return o.addClass("fc-active")}}(this),drag:function(e){return function(r,o){var n;return n=l+(e.isRTL?-r:r),n=Math.max(n,s),i[t]=n,e.applyColWidths()}}(this),dragEnd:function(t){return function(){return o.removeClass("fc-active")}}(this)}),n.startInteraction(e)},e.prototype.applyColWidths=function(){var t,e,r,o,i,n,s,l,u,a,h,c,p,d,f,g,y;for(r=this.colMinWidths,i=this.colWidths,t=!0,e=!1,y=0,a=0,p=i.length;p>a;a++)o=i[a],"number"==typeof o?y+=o:(t=!1,o&&(e=!0));for(l=e&&!this.view.isHGrouping?"auto":"",s=function(){var t,e,r;for(r=[],u=t=0,e=i.length;e>t;u=++t)o=i[u],r.push(null!=o?o:l);return r}(),g=0,u=h=0,d=s.length;d>h;u=++h)n=s[u],g+="number"==typeof n?n:r[u];for(u=c=0,f=s.length;f>c;u=++c)n=s[u],this.headColEls.eq(u).width(n),this.bodyColEls.eq(u).width(n);return this.headScroller.canvas.setMinWidth(g),this.bodyScroller.canvas.setMinWidth(g),this.tableMinWidth=g,this.tableWidth=t?y:void 0},e.prototype.computeColMinWidths=function(){var t,e,o,i,n,s;for(i=this.givenColWidths,n=[],t=e=0,o=i.length;o>e;t=++e)s=i[t],n.push("number"==typeof s?s:parseInt(this.headColEls.eq(t).css("min-width"))||r);return n},e.prototype.queryColWidths=function(){var e,r,o,i,n;for(i=this.headCellEls,n=[],e=0,r=i.length;r>e;e++)o=i[e],n.push(t(o).outerWidth());return n},e.prototype.updateWidth=function(){return this.headScroller.updateSize(),this.bodyScroller.updateSize(),this.joiner.update(),this.follower?this.follower.update():void 0},e.prototype.headHeight=function(){var t;return t=this.headScroller.canvas.contentEl.find("table"),t.height.apply(t,arguments)},e}(),k=function(){function e(e){this.view=e,this.children=[],this.trHash={},this.trs=t()}return e.prototype.view=null,e.prototype.parent=null,e.prototype.prevSibling=null,e.prototype.children=null,e.prototype.depth=0,e.prototype.hasOwnRow=!1,e.prototype.trHash=null,e.prototype.trs=null,e.prototype.isRendered=!1,e.prototype.isExpanded=!0,e.prototype.isShown=!1,e.prototype.addChild=function(t,e){var r,o,i,n,s;for(t.remove(),r=this.children,null!=e?r.splice(e,0,t):(e=r.length,r.push(t)),t.prevSibling=e>0?r[e-1]:null,eo;o++)n=s[o],n.added();return this.isShown&&this.isExpanded?t.show():void 0},e.prototype.removeChild=function(t){var e,r,o,i,n,s,l,u,a,h;for(e=this.children,o=!1,r=i=0,s=e.length;s>i;r=++i)if(h=e[r],h===t){o=!0;break}if(o){for(rn;n++)a=u[n],a.removed();return t.parent=null,t.prevSibling=null,t}return!1},e.prototype.removeChildren=function(){var t,e,r,o,i,n,s;for(n=this.children,e=0,o=n.length;o>e;e++)t=n[e],t.recursivelyUnrender();for(s=this.getDescendants(),r=0,i=s.length;i>r;r++)t=s[r],t.removed();return this.children=[]},e.prototype.remove=function(){return this.parent?this.parent.removeChild(this):void 0},e.prototype.getLastChild=function(){var t;return t=this.children,t[t.length-1]},e.prototype.getPrevRow=function(){var t,e;for(e=this;e;){if(e.prevSibling)for(e=e.prevSibling;t=e.getLastChild();)e=t;else e=e.parent;if(e&&e.hasOwnRow&&e.isShown)return e}return null},e.prototype.getLeadingRow=function(){return this.hasOwnRow?this:this.isExpanded&&this.children.length?this.children[0].getLeadingRow():void 0},e.prototype.getRows=function(t){var e,r,o,i;for(null==t&&(t=[]),this.hasOwnRow&&t.push(this),i=this.children,r=0,o=i.length;o>r;r++)e=i[r],e.getRows(t);return t},e.prototype.getNodes=function(t){var e,r,o,i;for(null==t&&(t=[]),t.push(this),i=this.children,r=0,o=i.length;o>r;r++)e=i[r],e.getNodes(t);return t},e.prototype.getDescendants=function(){var t,e,r,o,i;for(t=[],i=this.children,r=0,o=i.length;o>r;r++)e=i[r],e.getNodes(t);return t},e.prototype.render=function(){var e,r,o,i,n,s,l;if(this.trHash={},s=[],this.hasOwnRow){e=this.getPrevRow(),r=this.view.tbodyHash;for(l in r)i=r[l],n=t(""),this.trHash[l]=n,s.push(n[0]),o="render"+K(l)+"Content",this[o]&&this[o](n),e?e.trHash[l].after(n):i.prepend(n)}return this.trs=t(s).on("click",".fc-expander",Ft(this,"toggleExpanded")),this.isRendered=!0},e.prototype.unrender=function(){var e,r,o,i;if(this.isRendered){e=this.trHash;for(o in e)r=e[o],i="unrender"+K(o)+"Content",this[i]&&this[i](r);return this.trHash={},this.trs.remove(),this.trs=t(),this.isRendered=!1,this.isShown=!1,this.hidden()}},e.prototype.recursivelyUnrender=function(){var t,e,r,o,i;for(this.unrender(),o=this.children,i=[],e=0,r=o.length;r>e;e++)t=o[e],i.push(t.recursivelyUnrender());return i},e.prototype.getTr=function(t){return this.trHash[t]},e.prototype.show=function(){var t,e,r,o,i;if(!this.isShown&&(this.isRendered?this.trs.css("display",""):this.render(),this.ensureSegsRendered&&this.ensureSegsRendered(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed(),this.isShown=!0,this.shown(),this.isExpanded)){for(o=this.children,i=[],e=0,r=o.length;r>e;e++)t=o[e],i.push(t.show());return i}},e.prototype.hide=function(){var t,e,r,o,i;if(this.isShown&&(this.isRendered&&this.trs.hide(),this.isShown=!1,this.hidden(),this.isExpanded)){for(o=this.children,i=[],e=0,r=o.length;r>e;e++)t=o[e],i.push(t.hide());return i}},e.prototype.expand=function(){var t,e,r,o;if(!this.isExpanded){for(this.isExpanded=!0,this.indicateExpanded(),this.view.batchRows(),o=this.children,e=0,r=o.length;r>e;e++)t=o[e],t.show();return this.view.unbatchRows(),this.animateExpand()}},e.prototype.collapse=function(){var t,e,r,o;if(this.isExpanded){for(this.isExpanded=!1,this.indicateCollapsed(),this.view.batchRows(),o=this.children,e=0,r=o.length;r>e;e++)t=o[e],t.hide();return this.view.unbatchRows()}},e.prototype.toggleExpanded=function(){return this.isExpanded?this.collapse():this.expand()},e.prototype.indicateExpanded=function(){return this.trs.find(".fc-expander .fc-icon").removeClass(this.getCollapsedIcon()).addClass(this.getExpandedIcon())},e.prototype.indicateCollapsed=function(){return this.trs.find(".fc-expander .fc-icon").removeClass(this.getExpandedIcon()).addClass(this.getCollapsedIcon())},e.prototype.enableExpanding=function(){return this.trs.find(".fc-expander-space").addClass("fc-expander")},e.prototype.disableExpanding=function(){return this.trs.find(".fc-expander-space").removeClass("fc-expander").find(".fc-icon").removeClass(this.getExpandedIcon()).removeClass(this.getCollapsedIcon())},e.prototype.getExpandedIcon=function(){return"fc-icon-down-triangle"},e.prototype.getCollapsedIcon=function(){var t;return t=this.view.isRTL?"left":"right","fc-icon-"+t+"-triangle"},e.prototype.animateExpand=function(){var t,e,r;return r=null!=(t=this.children[0])&&null!=(e=t.getLeadingRow())?e.trs:void 0,r?(r.addClass("fc-collapsed"),setTimeout(function(){return r.addClass("fc-transitioning"),r.removeClass("fc-collapsed")}),r.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){return r.removeClass("fc-transitioning")})):void 0},e.prototype.getMaxTrInnerHeight=function(){var e;return e=0,t.each(this.trHash,function(t){return function(t,r){var o;return o=ct(r).find("> div:not(.fc-cell-content):first"),e=Math.max(o.height(),e)}}(this)),e},e.prototype.setTrInnerHeight=function(e){return t.each(this.trHash,function(t){return function(t,r){return ct(r).find("> div:not(.fc-cell-content):first").height(e)}}(this))},e.prototype.shown=function(){return this.hasOwnRow?this.rowShown(this):void 0},e.prototype.hidden=function(){return this.hasOwnRow?this.rowHidden(this):void 0},e.prototype.rowShown=function(t){return(this.parent||this.view).rowShown(t)},e.prototype.rowHidden=function(t){return(this.parent||this.view).rowHidden(t)},e.prototype.added=function(){return this.hasOwnRow?this.rowAdded(this):void 0},e.prototype.removed=function(){return this.hasOwnRow?this.rowRemoved(this):void 0},e.prototype.rowAdded=function(t){return(this.parent||this.view).rowAdded(t)},e.prototype.rowRemoved=function(t){return(this.parent||this.view).rowRemoved(t)},e}(),B=function(e){function r(t,e,o){this.groupSpec=e,this.groupValue=o,r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.prototype.groupSpec=null,r.prototype.groupValue=null,r.prototype.rowRemoved=function(t){return r.__super__.rowRemoved.apply(this,arguments),t===this||this.children.length?void 0:this.remove()},r.prototype.renderGroupContentEl=function(){var e,r;return e=t('
').append(this.renderGroupTextEl()),r=this.groupSpec.render,"function"==typeof r&&(e=r(e,this.groupValue)||e),e},r.prototype.renderGroupTextEl=function(){var e,r;return r=this.groupValue||"",e=this.groupSpec.text,"function"==typeof e&&(r=e(r)||r),t('').text(r)},r}(k),g=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.prototype.hasOwnRow=!0,r.prototype.renderSpreadsheetContent=function(e){var r;return r=this.renderGroupContentEl(),r.prepend(''),t('').attr("colspan",this.view.colSpecs.length).append(t("
").append(r)).appendTo(e)},r.prototype.renderEventContent=function(t){return t.append('
')},r}(B),U=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.prototype.rowspan=0,r.prototype.leadingTr=null,r.prototype.groupTd=null,r.prototype.rowShown=function(t){return this.rowspan+=1,this.renderRowspan(),r.__super__.rowShown.apply(this,arguments)},r.prototype.rowHidden=function(t){return this.rowspan-=1,this.renderRowspan(),r.__super__.rowHidden.apply(this,arguments)},r.prototype.renderRowspan=function(){var e;return this.rowspan?(this.groupTd||(this.groupTd=t('').append(this.renderGroupContentEl())),this.groupTd.attr("rowspan",this.rowspan),e=this.getLeadingRow().getTr("spreadsheet"),e!==this.leadingTr?(e&&e.prepend(this.groupTd),this.leadingTr=e):void 0):(this.groupTd&&(this.groupTd.remove(),this.groupTd=null),this.leadingTr=null)},r}(B),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return zt(e,t),e.prototype.hasOwnRow=!0,e.prototype.segContainerEl=null,e.prototype.segContainerHeight=null,e.prototype.innerEl=null,e.prototype.bgSegContainerEl=null,e.prototype.isSegsRendered=!1,e.prototype.bgSegs=null,e.prototype.fgSegs=null,e.prototype.renderEventContent=function(t){return t.html('
'),this.segContainerEl=t.find(".fc-event-container"),this.innerEl=this.bgSegContainerEl=t.find("td > div"),this.ensureSegsRendered()},e.prototype.ensureSegsRendered=function(){return this.isSegsRendered?void 0:(this.bgSegs&&this.view.timeGrid.renderFillInContainer("bgEvent",this,this.bgSegs),this.fgSegs&&this.view.timeGrid.renderFgSegsInContainers([[this,this.fgSegs]]),this.isSegsRendered=!0)},e.prototype.unrenderEventContent=function(){return this.bgSegs=null,this.fgSegs=null,this.isSegsRendered=!1},e}(k),F=function(e){function r(t,e){this.resource=e,r.__super__.constructor.apply(this,arguments)}return zt(r,e),r.prototype.resource=null,r.prototype.rowAdded=function(t){return r.__super__.rowAdded.apply(this,arguments),t!==this&&this.isRendered&&1===this.children.length?(this.enableExpanding(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed()):void 0},r.prototype.rowRemoved=function(t){return r.__super__.rowRemoved.apply(this,arguments),t!==this&&this.isRendered&&!this.children.length?this.disableExpanding():void 0},r.prototype.render=function(){return r.__super__.render.apply(this,arguments),this.children.length>0?this.enableExpanding():this.disableExpanding(),this.view.trigger("resourceRender",this.resource,this.resource,this.getTr("spreadsheet").find("> td"),this.getTr("event").find("> td"))},r.prototype.renderEventContent=function(t){return r.__super__.renderEventContent.apply(this,arguments),t.attr("data-resource-id",this.resource.id)},r.prototype.renderSpreadsheetContent=function(e){var r,o,i,n,s,l,u,a,h;for(u=this.resource,l=this.view.colSpecs,n=0,s=l.length;s>n;n++)r=l[n],r.group||(i=r.field?u[r.field]||null:u,h="function"==typeof r.text?r.text(u,i):i,o=t('
'+(r.isMain?this.renderGutterHtml():"")+''+(h?yt(h):" ")+"
"),"function"==typeof r.render&&(o=r.render(u,o,i)||o),a=t('').append(o),r.isMain&&a.wrapInner("
"),e.append(a));return e.attr("data-resource-id",u.id)},r.prototype.renderGutterHtml=function(){var t,e,r,o;for(t="",e=r=0,o=this.depth;o>r;e=r+=1)t+='';return t+=''},r}(p),d.views.timeline.resourceClass=W,E=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return zt(e,t),e.mixin(L),e.prototype.timeGridClass=G,e.prototype.dayGridClass=H,e.prototype.renderHead=function(){return e.__super__.renderHead.apply(this,arguments),this.timeGrid.processHeadResourceEls(this.headContainerEl)},e.prototype.setResources=function(t){return this.timeGrid.setResources(t),this.dayGrid&&this.dayGrid.setResources(t),this.clearView(),this.displayView()},e.prototype.unsetResources=function(){return this.clearEvents(),this.timeGrid.unsetResources(),this.dayGrid&&this.dayGrid.unsetResources(),this.clearView(),this.displayView()},e}(d.AgendaView),d.views.agenda.queryResourceClass=function(t){var e;return(null!=(e=t.options.groupByResource||t.options.groupByDateAndResource)?e:1===t.duration.as("days"))?E:void 0},T=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return zt(e,t),e.mixin(L),e.prototype.dayGridClass=H,e.prototype.renderHead=function(){return e.__super__.renderHead.apply(this,arguments),this.dayGrid.processHeadResourceEls(this.headContainerEl)},e.prototype.setResources=function(t){return this.dayGrid.setResources(t),this.clearView(),this.displayView()},e.prototype.unsetResources=function(){return this.clearEvents(),this.dayGrid.unsetResources(),this.clearView(),this.displayView()},e}(d.BasicView),x=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return zt(e,t),e.mixin(L),e.prototype.dayGridClass=H,e.prototype.renderHead=function(){return e.__super__.renderHead.apply(this,arguments),this.dayGrid.processHeadResourceEls(this.headContainerEl)},e.prototype.setResources=function(t){return this.dayGrid.setResources(t),this.clearView(),this.displayView()},e.prototype.unsetResources=function(){return this.clearEvents(),this.dayGrid.unsetResources(),this.clearView(),this.displayView()},e}(d.MonthView),d.views.basic.queryResourceClass=function(t){var e;return(null!=(e=t.options.groupByResource||t.options.groupByDateAndResource)?e:1===t.duration.as("days"))?T:void 0},d.views.month.queryResourceClass=function(t){return t.options.groupByResource||t.options.groupByDateAndResource?x:void 0},C="2016-03-26",j={years:1,weeks:1},y="http://fullcalendar.io/scheduler/license/",b=["GPL-My-Project-Is-Open-Source","CC-Attribution-NonCommercial-NoDerivatives"],xt=function(t,e){return wt(window.location.href)||St(t)||it(e)?void 0:Gt('Please use a valid license key. More Info',e)},St=function(r){var o,i,n,s;return-1!==t.inArray(r,b)?!0:(i=(r||"").match(/^(\d+)\-fcs\-(\d+)$/),i&&10===i[1].length&&(n=e.utc(1e3*parseInt(i[2])),s=e.utc(d.mockSchedulerReleaseDate||C),s.isValid()&&(o=s.clone().subtract(j),n.isAfter(o)))?!0:!1)},wt=function(t){return Boolean(t.match(/\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/))},Gt=function(e,r){return r.append(t('
').html(e))},void(it=function(t){return t.find(".fc-license-message").length>=1}))}); \ No newline at end of file diff --git a/package.json b/package.json index 4b7a68726..f4043f145 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fullcalendar-scheduler", "title": "FullCalendar Scheduler", - "version": "0.0.0", + "version": "1.3.0-beta", "description": "A premium add-on to FullCalendar for displaying events and resources", "homepage": "http://fullcalendar.io/scheduler/", "repository": {