' +
'' +
@@ -7296,17 +7915,17 @@ DayTableMixin_1.default.mixInto(DayGrid);
/***/ }),
-/* 62 */
+/* 67 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var util_1 = __webpack_require__(4);
-var Scroller_1 = __webpack_require__(39);
-var View_1 = __webpack_require__(41);
-var BasicViewDateProfileGenerator_1 = __webpack_require__(228);
-var DayGrid_1 = __webpack_require__(61);
+var Scroller_1 = __webpack_require__(41);
+var View_1 = __webpack_require__(43);
+var BasicViewDateProfileGenerator_1 = __webpack_require__(68);
+var DayGrid_1 = __webpack_require__(66);
/* An abstract class for the "basic" views, as well as month view. Renders one or more rows of day cells.
----------------------------------------------------------------------------------------------------------------------*/
// It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
@@ -7351,7 +7970,7 @@ var BasicView = /** @class */ (function (_super) {
this.el.addClass('fc-basic-view').html(this.renderSkeletonHtml());
this.scroller.render();
dayGridContainerEl = this.scroller.el.addClass('fc-day-grid-container');
- dayGridEl = $('').appendTo(dayGridContainerEl);
+ dayGridEl = $('
').appendTo(dayGridContainerEl);
this.el.find('.fc-body > tr > td').append(dayGridContainerEl);
this.dayGrid.headContainerEl = this.el.find('.fc-head-container');
this.dayGrid.setElement(dayGridEl);
@@ -7431,10 +8050,10 @@ var BasicView = /** @class */ (function (_super) {
if (eventLimit && typeof eventLimit !== 'number') {
this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
}
- if (!isAuto) {
+ if (!isAuto) { // should we force dimensions of the scroll container?
this.scroller.setHeight(scrollerHeight);
scrollbarWidths = this.scroller.getScrollbarWidths();
- if (scrollbarWidths.left || scrollbarWidths.right) {
+ if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
util_1.compensateScroll(headRowEl, scrollbarWidths);
// doing the scrollbar compensation might have created text overflow which created more height. redo
scrollerHeight = this.computeScrollerHeight(totalHeight);
@@ -7539,12 +8158,39 @@ function makeDayGridSubclass(SuperClass) {
/***/ }),
-/* 63 */,
-/* 64 */,
-/* 65 */,
-/* 66 */,
-/* 67 */,
-/* 68 */,
+/* 68 */
+/***/ (function(module, exports, __webpack_require__) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = __webpack_require__(2);
+var UnzonedRange_1 = __webpack_require__(5);
+var DateProfileGenerator_1 = __webpack_require__(55);
+var BasicViewDateProfileGenerator = /** @class */ (function (_super) {
+ tslib_1.__extends(BasicViewDateProfileGenerator, _super);
+ function BasicViewDateProfileGenerator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ // Computes the date range that will be rendered.
+ BasicViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
+ var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay); // an UnzonedRange
+ var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
+ var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
+ // year and month views should be aligned with weeks. this is already done for week
+ if (/^(year|month)$/.test(currentRangeUnit)) {
+ start.startOf('week');
+ // make end-of-week if not already
+ if (end.weekday()) {
+ end.add(1, 'week').startOf('week'); // exclusively move backwards
+ }
+ }
+ return new UnzonedRange_1.default(start, end);
+ };
+ return BasicViewDateProfileGenerator;
+}(DateProfileGenerator_1.default));
+exports.default = BasicViewDateProfileGenerator;
+
+
+/***/ }),
/* 69 */,
/* 70 */,
/* 71 */,
@@ -7683,15 +8329,25 @@ function makeDayGridSubclass(SuperClass) {
/* 204 */,
/* 205 */,
/* 206 */,
-/* 207 */
+/* 207 */,
+/* 208 */,
+/* 209 */,
+/* 210 */,
+/* 211 */,
+/* 212 */,
+/* 213 */,
+/* 214 */,
+/* 215 */,
+/* 216 */,
+/* 217 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var UnzonedRange_1 = __webpack_require__(5);
var ComponentFootprint_1 = __webpack_require__(12);
-var EventDefParser_1 = __webpack_require__(49);
+var EventDefParser_1 = __webpack_require__(36);
var EventSource_1 = __webpack_require__(6);
-var util_1 = __webpack_require__(35);
+var util_1 = __webpack_require__(19);
var Constraints = /** @class */ (function () {
function Constraints(eventManager, _calendar) {
this.eventManager = eventManager;
@@ -7793,14 +8449,14 @@ var Constraints = /** @class */ (function () {
}
else if (typeof constraintVal === 'object') {
eventInstances = this.parseEventDefToInstances(constraintVal); // handles recurring events
- if (!eventInstances) {
+ if (!eventInstances) { // invalid input. fallback to parsing footprint directly
return this.parseFootprints(constraintVal);
}
else {
return this.eventInstancesToFootprints(eventInstances);
}
}
- else if (constraintVal != null) {
+ else if (constraintVal != null) { // an ID
eventInstances = this.eventManager.getEventInstancesWithId(constraintVal);
return this.eventInstancesToFootprints(eventInstances);
}
@@ -7849,7 +8505,7 @@ var Constraints = /** @class */ (function () {
Constraints.prototype.parseEventDefToInstances = function (eventInput) {
var eventManager = this.eventManager;
var eventDef = EventDefParser_1.default.parse(eventInput, new EventSource_1.default(this._calendar));
- if (!eventDef) {
+ if (!eventDef) { // invalid
return false;
}
return eventDef.buildInstances(eventManager.currentPeriod.unzonedRange);
@@ -7937,245 +8593,14 @@ function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInst
/***/ }),
-/* 208 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/*
-USAGE:
- import { default as ParsableModelMixin, ParsableModelInterface } from './ParsableModelMixin'
-in class:
- applyProps: ParsableModelInterface['applyProps']
- applyManualStandardProps: ParsableModelInterface['applyManualStandardProps']
- applyMiscProps: ParsableModelInterface['applyMiscProps']
- isStandardProp: ParsableModelInterface['isStandardProp']
- static defineStandardProps = ParsableModelMixin.defineStandardProps
- static copyVerbatimStandardProps = ParsableModelMixin.copyVerbatimStandardProps
-after class:
- ParsableModelMixin.mixInto(TheClass)
-*/
-Object.defineProperty(exports, "__esModule", { value: true });
-var tslib_1 = __webpack_require__(2);
-var util_1 = __webpack_require__(4);
-var Mixin_1 = __webpack_require__(14);
-var ParsableModelMixin = /** @class */ (function (_super) {
- tslib_1.__extends(ParsableModelMixin, _super);
- function ParsableModelMixin() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ParsableModelMixin.defineStandardProps = function (propDefs) {
- var proto = this.prototype;
- if (!proto.hasOwnProperty('standardPropMap')) {
- proto.standardPropMap = Object.create(proto.standardPropMap);
- }
- util_1.copyOwnProps(propDefs, proto.standardPropMap);
- };
- ParsableModelMixin.copyVerbatimStandardProps = function (src, dest) {
- var map = this.prototype.standardPropMap;
- var propName;
- for (propName in map) {
- if (src[propName] != null && // in the src object?
- map[propName] === true // false means "copy verbatim"
- ) {
- dest[propName] = src[propName];
- }
- }
- };
- /*
- Returns true/false for success.
- Meant to be only called ONCE, at object creation.
- */
- ParsableModelMixin.prototype.applyProps = function (rawProps) {
- var standardPropMap = this.standardPropMap;
- var manualProps = {};
- var miscProps = {};
- var propName;
- for (propName in rawProps) {
- if (standardPropMap[propName] === true) {
- this[propName] = rawProps[propName];
- }
- else if (standardPropMap[propName] === false) {
- manualProps[propName] = rawProps[propName];
- }
- else {
- miscProps[propName] = rawProps[propName];
- }
- }
- this.applyMiscProps(miscProps);
- return this.applyManualStandardProps(manualProps);
- };
- /*
- If subclasses override, they must call this supermethod and return the boolean response.
- Meant to be only called ONCE, at object creation.
- */
- ParsableModelMixin.prototype.applyManualStandardProps = function (rawProps) {
- return true;
- };
- /*
- Can be called even after initial object creation.
- */
- ParsableModelMixin.prototype.applyMiscProps = function (rawProps) {
- // subclasses can implement
- };
- /*
- TODO: why is this a method when defineStandardProps is static
- */
- ParsableModelMixin.prototype.isStandardProp = function (propName) {
- return propName in this.standardPropMap;
- };
- return ParsableModelMixin;
-}(Mixin_1.default));
-exports.default = ParsableModelMixin;
-ParsableModelMixin.prototype.standardPropMap = {}; // will be cloned by defineStandardProps
-
-
-/***/ }),
-/* 209 */
-/***/ (function(module, exports) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var EventInstance = /** @class */ (function () {
- function EventInstance(def, dateProfile) {
- this.def = def;
- this.dateProfile = dateProfile;
- }
- EventInstance.prototype.toLegacy = function () {
- var dateProfile = this.dateProfile;
- var obj = this.def.toLegacy();
- obj.start = dateProfile.start.clone();
- obj.end = dateProfile.end ? dateProfile.end.clone() : null;
- return obj;
- };
- return EventInstance;
-}());
-exports.default = EventInstance;
-
-
-/***/ }),
-/* 210 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var tslib_1 = __webpack_require__(2);
-var $ = __webpack_require__(3);
-var moment = __webpack_require__(0);
-var EventDef_1 = __webpack_require__(34);
-var EventInstance_1 = __webpack_require__(209);
-var EventDateProfile_1 = __webpack_require__(17);
-var RecurringEventDef = /** @class */ (function (_super) {
- tslib_1.__extends(RecurringEventDef, _super);
- function RecurringEventDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- RecurringEventDef.prototype.isAllDay = function () {
- return !this.startTime && !this.endTime;
- };
- RecurringEventDef.prototype.buildInstances = function (unzonedRange) {
- var calendar = this.source.calendar;
- var unzonedDate = unzonedRange.getStart();
- var unzonedEnd = unzonedRange.getEnd();
- var zonedDayStart;
- var instanceStart;
- var instanceEnd;
- var instances = [];
- while (unzonedDate.isBefore(unzonedEnd)) {
- // if everyday, or this particular day-of-week
- if (!this.dowHash || this.dowHash[unzonedDate.day()]) {
- zonedDayStart = calendar.applyTimezone(unzonedDate);
- instanceStart = zonedDayStart.clone();
- instanceEnd = null;
- if (this.startTime) {
- instanceStart.time(this.startTime);
- }
- else {
- instanceStart.stripTime();
- }
- if (this.endTime) {
- instanceEnd = zonedDayStart.clone().time(this.endTime);
- }
- instances.push(new EventInstance_1.default(this, // definition
- new EventDateProfile_1.default(instanceStart, instanceEnd, calendar)));
- }
- unzonedDate.add(1, 'days');
- }
- return instances;
- };
- RecurringEventDef.prototype.setDow = function (dowNumbers) {
- if (!this.dowHash) {
- this.dowHash = {};
- }
- for (var i = 0; i < dowNumbers.length; i++) {
- this.dowHash[dowNumbers[i]] = true;
- }
- };
- RecurringEventDef.prototype.clone = function () {
- var def = _super.prototype.clone.call(this);
- if (def.startTime) {
- def.startTime = moment.duration(this.startTime);
- }
- if (def.endTime) {
- def.endTime = moment.duration(this.endTime);
- }
- if (this.dowHash) {
- def.dowHash = $.extend({}, this.dowHash);
- }
- return def;
- };
- return RecurringEventDef;
-}(EventDef_1.default));
-exports.default = RecurringEventDef;
-/*
-HACK to work with TypeScript mixins
-NOTE: if super-method fails, should still attempt to apply
-*/
-RecurringEventDef.prototype.applyProps = function (rawProps) {
- var superSuccess = EventDef_1.default.prototype.applyProps.call(this, rawProps);
- if (rawProps.start) {
- this.startTime = moment.duration(rawProps.start);
- }
- if (rawProps.end) {
- this.endTime = moment.duration(rawProps.end);
- }
- if (rawProps.dow) {
- this.setDow(rawProps.dow);
- }
- return superSuccess;
-};
-// Parsing
-// ---------------------------------------------------------------------------------------------------------------------
-RecurringEventDef.defineStandardProps({
- start: false,
- end: false,
- dow: false
-});
-
-
-/***/ }),
-/* 211 */
-/***/ (function(module, exports) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var EventRange = /** @class */ (function () {
- function EventRange(unzonedRange, eventDef, eventInstance) {
- this.unzonedRange = unzonedRange;
- this.eventDef = eventDef;
- if (eventInstance) {
- this.eventInstance = eventInstance;
- }
- }
- return EventRange;
-}());
-exports.default = EventRange;
-
-
-/***/ }),
-/* 212 */
+/* 218 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var $ = __webpack_require__(3);
-var util_1 = __webpack_require__(35);
-var EventInstanceGroup_1 = __webpack_require__(18);
-var RecurringEventDef_1 = __webpack_require__(210);
+var util_1 = __webpack_require__(19);
+var EventInstanceGroup_1 = __webpack_require__(20);
+var RecurringEventDef_1 = __webpack_require__(54);
var EventSource_1 = __webpack_require__(6);
var BUSINESS_HOUR_EVENT_DEFAULTS = {
start: '09:00',
@@ -8237,12 +8662,521 @@ exports.default = BusinessHourGenerator;
/***/ }),
-/* 213 */
+/* 219 */
+/***/ (function(module, exports, __webpack_require__) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var $ = __webpack_require__(3);
+var util_1 = __webpack_require__(4);
+var Promise_1 = __webpack_require__(21);
+var EmitterMixin_1 = __webpack_require__(13);
+var UnzonedRange_1 = __webpack_require__(5);
+var EventInstanceGroup_1 = __webpack_require__(20);
+var EventPeriod = /** @class */ (function () {
+ function EventPeriod(start, end, timezone) {
+ this.pendingCnt = 0;
+ this.freezeDepth = 0;
+ this.stuntedReleaseCnt = 0;
+ this.releaseCnt = 0;
+ this.start = start;
+ this.end = end;
+ this.timezone = timezone;
+ this.unzonedRange = new UnzonedRange_1.default(start.clone().stripZone(), end.clone().stripZone());
+ this.requestsByUid = {};
+ this.eventDefsByUid = {};
+ this.eventDefsById = {};
+ this.eventInstanceGroupsById = {};
+ }
+ EventPeriod.prototype.isWithinRange = function (start, end) {
+ // TODO: use a range util function?
+ return !start.isBefore(this.start) && !end.isAfter(this.end);
+ };
+ // Requesting and Purging
+ // -----------------------------------------------------------------------------------------------------------------
+ EventPeriod.prototype.requestSources = function (sources) {
+ this.freeze();
+ for (var i = 0; i < sources.length; i++) {
+ this.requestSource(sources[i]);
+ }
+ this.thaw();
+ };
+ EventPeriod.prototype.requestSource = function (source) {
+ var _this = this;
+ var request = { source: source, status: 'pending', eventDefs: null };
+ this.requestsByUid[source.uid] = request;
+ this.pendingCnt += 1;
+ source.fetch(this.start, this.end, this.timezone).then(function (eventDefs) {
+ if (request.status !== 'cancelled') {
+ request.status = 'completed';
+ request.eventDefs = eventDefs;
+ _this.addEventDefs(eventDefs);
+ _this.pendingCnt--;
+ _this.tryRelease();
+ }
+ }, function () {
+ if (request.status !== 'cancelled') {
+ request.status = 'failed';
+ _this.pendingCnt--;
+ _this.tryRelease();
+ }
+ });
+ };
+ EventPeriod.prototype.purgeSource = function (source) {
+ var request = this.requestsByUid[source.uid];
+ if (request) {
+ delete this.requestsByUid[source.uid];
+ if (request.status === 'pending') {
+ request.status = 'cancelled';
+ this.pendingCnt--;
+ this.tryRelease();
+ }
+ else if (request.status === 'completed') {
+ request.eventDefs.forEach(this.removeEventDef.bind(this));
+ }
+ }
+ };
+ EventPeriod.prototype.purgeAllSources = function () {
+ var requestsByUid = this.requestsByUid;
+ var uid;
+ var request;
+ var completedCnt = 0;
+ for (uid in requestsByUid) {
+ request = requestsByUid[uid];
+ if (request.status === 'pending') {
+ request.status = 'cancelled';
+ }
+ else if (request.status === 'completed') {
+ completedCnt++;
+ }
+ }
+ this.requestsByUid = {};
+ this.pendingCnt = 0;
+ if (completedCnt) {
+ this.removeAllEventDefs(); // might release
+ }
+ };
+ // Event Definitions
+ // -----------------------------------------------------------------------------------------------------------------
+ EventPeriod.prototype.getEventDefByUid = function (eventDefUid) {
+ return this.eventDefsByUid[eventDefUid];
+ };
+ EventPeriod.prototype.getEventDefsById = function (eventDefId) {
+ var a = this.eventDefsById[eventDefId];
+ if (a) {
+ return a.slice(); // clone
+ }
+ return [];
+ };
+ EventPeriod.prototype.addEventDefs = function (eventDefs) {
+ for (var i = 0; i < eventDefs.length; i++) {
+ this.addEventDef(eventDefs[i]);
+ }
+ };
+ EventPeriod.prototype.addEventDef = function (eventDef) {
+ var eventDefsById = this.eventDefsById;
+ var eventDefId = eventDef.id;
+ var eventDefs = eventDefsById[eventDefId] || (eventDefsById[eventDefId] = []);
+ var eventInstances = eventDef.buildInstances(this.unzonedRange);
+ var i;
+ eventDefs.push(eventDef);
+ this.eventDefsByUid[eventDef.uid] = eventDef;
+ for (i = 0; i < eventInstances.length; i++) {
+ this.addEventInstance(eventInstances[i], eventDefId);
+ }
+ };
+ EventPeriod.prototype.removeEventDefsById = function (eventDefId) {
+ var _this = this;
+ this.getEventDefsById(eventDefId).forEach(function (eventDef) {
+ _this.removeEventDef(eventDef);
+ });
+ };
+ EventPeriod.prototype.removeAllEventDefs = function () {
+ var isEmpty = $.isEmptyObject(this.eventDefsByUid);
+ this.eventDefsByUid = {};
+ this.eventDefsById = {};
+ this.eventInstanceGroupsById = {};
+ if (!isEmpty) {
+ this.tryRelease();
+ }
+ };
+ EventPeriod.prototype.removeEventDef = function (eventDef) {
+ var eventDefsById = this.eventDefsById;
+ var eventDefs = eventDefsById[eventDef.id];
+ delete this.eventDefsByUid[eventDef.uid];
+ if (eventDefs) {
+ util_1.removeExact(eventDefs, eventDef);
+ if (!eventDefs.length) {
+ delete eventDefsById[eventDef.id];
+ }
+ this.removeEventInstancesForDef(eventDef);
+ }
+ };
+ // Event Instances
+ // -----------------------------------------------------------------------------------------------------------------
+ EventPeriod.prototype.getEventInstances = function () {
+ var eventInstanceGroupsById = this.eventInstanceGroupsById;
+ var eventInstances = [];
+ var id;
+ for (id in eventInstanceGroupsById) {
+ eventInstances.push.apply(eventInstances, // append
+ eventInstanceGroupsById[id].eventInstances);
+ }
+ return eventInstances;
+ };
+ EventPeriod.prototype.getEventInstancesWithId = function (eventDefId) {
+ var eventInstanceGroup = this.eventInstanceGroupsById[eventDefId];
+ if (eventInstanceGroup) {
+ return eventInstanceGroup.eventInstances.slice(); // clone
+ }
+ return [];
+ };
+ EventPeriod.prototype.getEventInstancesWithoutId = function (eventDefId) {
+ var eventInstanceGroupsById = this.eventInstanceGroupsById;
+ var matchingInstances = [];
+ var id;
+ for (id in eventInstanceGroupsById) {
+ if (id !== eventDefId) {
+ matchingInstances.push.apply(matchingInstances, // append
+ eventInstanceGroupsById[id].eventInstances);
+ }
+ }
+ return matchingInstances;
+ };
+ EventPeriod.prototype.addEventInstance = function (eventInstance, eventDefId) {
+ var eventInstanceGroupsById = this.eventInstanceGroupsById;
+ var eventInstanceGroup = eventInstanceGroupsById[eventDefId] ||
+ (eventInstanceGroupsById[eventDefId] = new EventInstanceGroup_1.default());
+ eventInstanceGroup.eventInstances.push(eventInstance);
+ this.tryRelease();
+ };
+ EventPeriod.prototype.removeEventInstancesForDef = function (eventDef) {
+ var eventInstanceGroupsById = this.eventInstanceGroupsById;
+ var eventInstanceGroup = eventInstanceGroupsById[eventDef.id];
+ var removeCnt;
+ if (eventInstanceGroup) {
+ removeCnt = util_1.removeMatching(eventInstanceGroup.eventInstances, function (currentEventInstance) {
+ return currentEventInstance.def === eventDef;
+ });
+ if (!eventInstanceGroup.eventInstances.length) {
+ delete eventInstanceGroupsById[eventDef.id];
+ }
+ if (removeCnt) {
+ this.tryRelease();
+ }
+ }
+ };
+ // Releasing and Freezing
+ // -----------------------------------------------------------------------------------------------------------------
+ EventPeriod.prototype.tryRelease = function () {
+ if (!this.pendingCnt) {
+ if (!this.freezeDepth) {
+ this.release();
+ }
+ else {
+ this.stuntedReleaseCnt++;
+ }
+ }
+ };
+ EventPeriod.prototype.release = function () {
+ this.releaseCnt++;
+ this.trigger('release', this.eventInstanceGroupsById);
+ };
+ EventPeriod.prototype.whenReleased = function () {
+ var _this = this;
+ if (this.releaseCnt) {
+ return Promise_1.default.resolve(this.eventInstanceGroupsById);
+ }
+ else {
+ return Promise_1.default.construct(function (onResolve) {
+ _this.one('release', onResolve);
+ });
+ }
+ };
+ EventPeriod.prototype.freeze = function () {
+ if (!(this.freezeDepth++)) {
+ this.stuntedReleaseCnt = 0;
+ }
+ };
+ EventPeriod.prototype.thaw = function () {
+ if (!(--this.freezeDepth) && this.stuntedReleaseCnt && !this.pendingCnt) {
+ this.release();
+ }
+ };
+ return EventPeriod;
+}());
+exports.default = EventPeriod;
+EmitterMixin_1.default.mixInto(EventPeriod);
+
+
+/***/ }),
+/* 220 */
+/***/ (function(module, exports, __webpack_require__) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var $ = __webpack_require__(3);
+var util_1 = __webpack_require__(4);
+var EventPeriod_1 = __webpack_require__(219);
+var ArrayEventSource_1 = __webpack_require__(56);
+var EventSource_1 = __webpack_require__(6);
+var EventSourceParser_1 = __webpack_require__(38);
+var SingleEventDef_1 = __webpack_require__(9);
+var EventInstanceGroup_1 = __webpack_require__(20);
+var EmitterMixin_1 = __webpack_require__(13);
+var ListenerMixin_1 = __webpack_require__(7);
+var EventManager = /** @class */ (function () {
+ function EventManager(calendar) {
+ this.calendar = calendar;
+ this.stickySource = new ArrayEventSource_1.default(calendar);
+ this.otherSources = [];
+ }
+ EventManager.prototype.requestEvents = function (start, end, timezone, force) {
+ if (force ||
+ !this.currentPeriod ||
+ !this.currentPeriod.isWithinRange(start, end) ||
+ timezone !== this.currentPeriod.timezone) {
+ this.setPeriod(// will change this.currentPeriod
+ new EventPeriod_1.default(start, end, timezone));
+ }
+ return this.currentPeriod.whenReleased();
+ };
+ // Source Adding/Removing
+ // -----------------------------------------------------------------------------------------------------------------
+ EventManager.prototype.addSource = function (eventSource) {
+ this.otherSources.push(eventSource);
+ if (this.currentPeriod) {
+ this.currentPeriod.requestSource(eventSource); // might release
+ }
+ };
+ EventManager.prototype.removeSource = function (doomedSource) {
+ util_1.removeExact(this.otherSources, doomedSource);
+ if (this.currentPeriod) {
+ this.currentPeriod.purgeSource(doomedSource); // might release
+ }
+ };
+ EventManager.prototype.removeAllSources = function () {
+ this.otherSources = [];
+ if (this.currentPeriod) {
+ this.currentPeriod.purgeAllSources(); // might release
+ }
+ };
+ // Source Refetching
+ // -----------------------------------------------------------------------------------------------------------------
+ EventManager.prototype.refetchSource = function (eventSource) {
+ var currentPeriod = this.currentPeriod;
+ if (currentPeriod) {
+ currentPeriod.freeze();
+ currentPeriod.purgeSource(eventSource);
+ currentPeriod.requestSource(eventSource);
+ currentPeriod.thaw();
+ }
+ };
+ EventManager.prototype.refetchAllSources = function () {
+ var currentPeriod = this.currentPeriod;
+ if (currentPeriod) {
+ currentPeriod.freeze();
+ currentPeriod.purgeAllSources();
+ currentPeriod.requestSources(this.getSources());
+ currentPeriod.thaw();
+ }
+ };
+ // Source Querying
+ // -----------------------------------------------------------------------------------------------------------------
+ EventManager.prototype.getSources = function () {
+ return [this.stickySource].concat(this.otherSources);
+ };
+ // like querySources, but accepts multple match criteria (like multiple IDs)
+ EventManager.prototype.multiQuerySources = function (matchInputs) {
+ // coerce into an array
+ if (!matchInputs) {
+ matchInputs = [];
+ }
+ else if (!$.isArray(matchInputs)) {
+ matchInputs = [matchInputs];
+ }
+ var matchingSources = [];
+ var i;
+ // resolve raw inputs to real event source objects
+ for (i = 0; i < matchInputs.length; i++) {
+ matchingSources.push.apply(// append
+ matchingSources, this.querySources(matchInputs[i]));
+ }
+ return matchingSources;
+ };
+ // matchInput can either by a real event source object, an ID, or the function/URL for the source.
+ // returns an array of matching source objects.
+ EventManager.prototype.querySources = function (matchInput) {
+ var sources = this.otherSources;
+ var i;
+ var source;
+ // given a proper event source object
+ for (i = 0; i < sources.length; i++) {
+ source = sources[i];
+ if (source === matchInput) {
+ return [source];
+ }
+ }
+ // an ID match
+ source = this.getSourceById(EventSource_1.default.normalizeId(matchInput));
+ if (source) {
+ return [source];
+ }
+ // parse as an event source
+ matchInput = EventSourceParser_1.default.parse(matchInput, this.calendar);
+ if (matchInput) {
+ return $.grep(sources, function (source) {
+ return isSourcesEquivalent(matchInput, source);
+ });
+ }
+ };
+ /*
+ ID assumed to already be normalized
+ */
+ EventManager.prototype.getSourceById = function (id) {
+ return $.grep(this.otherSources, function (source) {
+ return source.id && source.id === id;
+ })[0];
+ };
+ // Event-Period
+ // -----------------------------------------------------------------------------------------------------------------
+ EventManager.prototype.setPeriod = function (eventPeriod) {
+ if (this.currentPeriod) {
+ this.unbindPeriod(this.currentPeriod);
+ this.currentPeriod = null;
+ }
+ this.currentPeriod = eventPeriod;
+ this.bindPeriod(eventPeriod);
+ eventPeriod.requestSources(this.getSources());
+ };
+ EventManager.prototype.bindPeriod = function (eventPeriod) {
+ this.listenTo(eventPeriod, 'release', function (eventsPayload) {
+ this.trigger('release', eventsPayload);
+ });
+ };
+ EventManager.prototype.unbindPeriod = function (eventPeriod) {
+ this.stopListeningTo(eventPeriod);
+ };
+ // Event Getting/Adding/Removing
+ // -----------------------------------------------------------------------------------------------------------------
+ EventManager.prototype.getEventDefByUid = function (uid) {
+ if (this.currentPeriod) {
+ return this.currentPeriod.getEventDefByUid(uid);
+ }
+ };
+ EventManager.prototype.addEventDef = function (eventDef, isSticky) {
+ if (isSticky) {
+ this.stickySource.addEventDef(eventDef);
+ }
+ if (this.currentPeriod) {
+ this.currentPeriod.addEventDef(eventDef); // might release
+ }
+ };
+ EventManager.prototype.removeEventDefsById = function (eventId) {
+ this.getSources().forEach(function (eventSource) {
+ eventSource.removeEventDefsById(eventId);
+ });
+ if (this.currentPeriod) {
+ this.currentPeriod.removeEventDefsById(eventId); // might release
+ }
+ };
+ EventManager.prototype.removeAllEventDefs = function () {
+ this.getSources().forEach(function (eventSource) {
+ eventSource.removeAllEventDefs();
+ });
+ if (this.currentPeriod) {
+ this.currentPeriod.removeAllEventDefs();
+ }
+ };
+ // Event Mutating
+ // -----------------------------------------------------------------------------------------------------------------
+ /*
+ Returns an undo function.
+ */
+ EventManager.prototype.mutateEventsWithId = function (eventDefId, eventDefMutation) {
+ var currentPeriod = this.currentPeriod;
+ var eventDefs;
+ var undoFuncs = [];
+ if (currentPeriod) {
+ currentPeriod.freeze();
+ eventDefs = currentPeriod.getEventDefsById(eventDefId);
+ eventDefs.forEach(function (eventDef) {
+ // add/remove esp because id might change
+ currentPeriod.removeEventDef(eventDef);
+ undoFuncs.push(eventDefMutation.mutateSingle(eventDef));
+ currentPeriod.addEventDef(eventDef);
+ });
+ currentPeriod.thaw();
+ return function () {
+ currentPeriod.freeze();
+ for (var i = 0; i < eventDefs.length; i++) {
+ currentPeriod.removeEventDef(eventDefs[i]);
+ undoFuncs[i]();
+ currentPeriod.addEventDef(eventDefs[i]);
+ }
+ currentPeriod.thaw();
+ };
+ }
+ return function () { };
+ };
+ /*
+ copies and then mutates
+ */
+ EventManager.prototype.buildMutatedEventInstanceGroup = function (eventDefId, eventDefMutation) {
+ var eventDefs = this.getEventDefsById(eventDefId);
+ var i;
+ var defCopy;
+ var allInstances = [];
+ for (i = 0; i < eventDefs.length; i++) {
+ defCopy = eventDefs[i].clone();
+ if (defCopy instanceof SingleEventDef_1.default) {
+ eventDefMutation.mutateSingle(defCopy);
+ allInstances.push.apply(allInstances, // append
+ defCopy.buildInstances());
+ }
+ }
+ return new EventInstanceGroup_1.default(allInstances);
+ };
+ // Freezing
+ // -----------------------------------------------------------------------------------------------------------------
+ EventManager.prototype.freeze = function () {
+ if (this.currentPeriod) {
+ this.currentPeriod.freeze();
+ }
+ };
+ EventManager.prototype.thaw = function () {
+ if (this.currentPeriod) {
+ this.currentPeriod.thaw();
+ }
+ };
+ // methods that simply forward to EventPeriod
+ EventManager.prototype.getEventDefsById = function (eventDefId) {
+ return this.currentPeriod.getEventDefsById(eventDefId);
+ };
+ EventManager.prototype.getEventInstances = function () {
+ return this.currentPeriod.getEventInstances();
+ };
+ EventManager.prototype.getEventInstancesWithId = function (eventDefId) {
+ return this.currentPeriod.getEventInstancesWithId(eventDefId);
+ };
+ EventManager.prototype.getEventInstancesWithoutId = function (eventDefId) {
+ return this.currentPeriod.getEventInstancesWithoutId(eventDefId);
+ };
+ return EventManager;
+}());
+exports.default = EventManager;
+EmitterMixin_1.default.mixInto(EventManager);
+ListenerMixin_1.default.mixInto(EventManager);
+function isSourcesEquivalent(source0, source1) {
+ return source0.getPrimitive() === source1.getPrimitive();
+}
+
+
+/***/ }),
+/* 221 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
-var Theme_1 = __webpack_require__(19);
+var Theme_1 = __webpack_require__(22);
var StandardTheme = /** @class */ (function (_super) {
tslib_1.__extends(StandardTheme, _super);
function StandardTheme() {
@@ -8286,12 +9220,12 @@ StandardTheme.prototype.iconOverridePrefix = 'fc-icon-';
/***/ }),
-/* 214 */
+/* 222 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
-var Theme_1 = __webpack_require__(19);
+var Theme_1 = __webpack_require__(22);
var JqueryUiTheme = /** @class */ (function (_super) {
tslib_1.__extends(JqueryUiTheme, _super);
function JqueryUiTheme() {
@@ -8336,13 +9270,13 @@ JqueryUiTheme.prototype.iconOverridePrefix = 'ui-icon-';
/***/ }),
-/* 215 */
+/* 223 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
-var Promise_1 = __webpack_require__(20);
+var Promise_1 = __webpack_require__(21);
var EventSource_1 = __webpack_require__(6);
var FuncEventSource = /** @class */ (function (_super) {
tslib_1.__extends(FuncEventSource, _super);
@@ -8352,10 +9286,10 @@ var FuncEventSource = /** @class */ (function (_super) {
FuncEventSource.parse = function (rawInput, calendar) {
var rawProps;
// normalize raw input
- if ($.isFunction(rawInput.events)) {
+ if ($.isFunction(rawInput.events)) { // extended form
rawProps = rawInput;
}
- else if ($.isFunction(rawInput)) {
+ else if ($.isFunction(rawInput)) { // short form
rawProps = { events: rawInput };
}
if (rawProps) {
@@ -8390,14 +9324,14 @@ FuncEventSource.defineStandardProps({
/***/ }),
-/* 216 */
+/* 224 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var util_1 = __webpack_require__(4);
-var Promise_1 = __webpack_require__(20);
+var Promise_1 = __webpack_require__(21);
var EventSource_1 = __webpack_require__(6);
var JsonFeedEventSource = /** @class */ (function (_super) {
tslib_1.__extends(JsonFeedEventSource, _super);
@@ -8407,10 +9341,10 @@ var JsonFeedEventSource = /** @class */ (function (_super) {
JsonFeedEventSource.parse = function (rawInput, calendar) {
var rawProps;
// normalize raw input
- if (typeof rawInput.url === 'string') {
+ if (typeof rawInput.url === 'string') { // extended form
rawProps = rawInput;
}
- else if (typeof rawInput === 'string') {
+ else if (typeof rawInput === 'string') { // short form
rawProps = { url: rawInput };
}
if (rawProps) {
@@ -8515,11 +9449,333 @@ JsonFeedEventSource.defineStandardProps({
/***/ }),
-/* 217 */
+/* 225 */
+/***/ (function(module, exports) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var Iterator = /** @class */ (function () {
+ function Iterator(items) {
+ this.items = items || [];
+ }
+ /* Calls a method on every item passing the arguments through */
+ Iterator.prototype.proxyCall = function (methodName) {
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var results = [];
+ this.items.forEach(function (item) {
+ results.push(item[methodName].apply(item, args));
+ });
+ return results;
+ };
+ return Iterator;
+}());
+exports.default = Iterator;
+
+
+/***/ }),
+/* 226 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
-var EmitterMixin_1 = __webpack_require__(11);
+var $ = __webpack_require__(3);
+var util_1 = __webpack_require__(4);
+var ListenerMixin_1 = __webpack_require__(7);
+/* Creates a clone of an element and lets it track the mouse as it moves
+----------------------------------------------------------------------------------------------------------------------*/
+var MouseFollower = /** @class */ (function () {
+ function MouseFollower(sourceEl, options) {
+ this.isFollowing = false;
+ this.isHidden = false;
+ this.isAnimating = false; // doing the revert animation?
+ this.options = options = options || {};
+ this.sourceEl = sourceEl;
+ this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent
+ }
+ // Causes the element to start following the mouse
+ MouseFollower.prototype.start = function (ev) {
+ if (!this.isFollowing) {
+ this.isFollowing = true;
+ this.y0 = util_1.getEvY(ev);
+ this.x0 = util_1.getEvX(ev);
+ this.topDelta = 0;
+ this.leftDelta = 0;
+ if (!this.isHidden) {
+ this.updatePosition();
+ }
+ if (util_1.getEvIsTouch(ev)) {
+ this.listenTo($(document), 'touchmove', this.handleMove);
+ }
+ else {
+ this.listenTo($(document), 'mousemove', this.handleMove);
+ }
+ }
+ };
+ // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position.
+ // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately.
+ MouseFollower.prototype.stop = function (shouldRevert, callback) {
+ var _this = this;
+ var revertDuration = this.options.revertDuration;
+ var complete = function () {
+ _this.isAnimating = false;
+ _this.removeElement();
+ _this.top0 = _this.left0 = null; // reset state for future updatePosition calls
+ if (callback) {
+ callback();
+ }
+ };
+ if (this.isFollowing && !this.isAnimating) { // disallow more than one stop animation at a time
+ this.isFollowing = false;
+ this.stopListeningTo($(document));
+ if (shouldRevert && revertDuration && !this.isHidden) { // do a revert animation?
+ this.isAnimating = true;
+ this.el.animate({
+ top: this.top0,
+ left: this.left0
+ }, {
+ duration: revertDuration,
+ complete: complete
+ });
+ }
+ else {
+ complete();
+ }
+ }
+ };
+ // Gets the tracking element. Create it if necessary
+ MouseFollower.prototype.getEl = function () {
+ var el = this.el;
+ if (!el) {
+ el = this.el = this.sourceEl.clone()
+ .addClass(this.options.additionalClass || '')
+ .css({
+ position: 'absolute',
+ visibility: '',
+ display: this.isHidden ? 'none' : '',
+ margin: 0,
+ right: 'auto',
+ bottom: 'auto',
+ width: this.sourceEl.width(),
+ height: this.sourceEl.height(),
+ opacity: this.options.opacity || '',
+ zIndex: this.options.zIndex
+ });
+ // we don't want long taps or any mouse interaction causing selection/menus.
+ // would use preventSelection(), but that prevents selectstart, causing problems.
+ el.addClass('fc-unselectable');
+ el.appendTo(this.parentEl);
+ }
+ return el;
+ };
+ // Removes the tracking element if it has already been created
+ MouseFollower.prototype.removeElement = function () {
+ if (this.el) {
+ this.el.remove();
+ this.el = null;
+ }
+ };
+ // Update the CSS position of the tracking element
+ MouseFollower.prototype.updatePosition = function () {
+ var sourceOffset;
+ var origin;
+ this.getEl(); // ensure this.el
+ // make sure origin info was computed
+ if (this.top0 == null) {
+ sourceOffset = this.sourceEl.offset();
+ origin = this.el.offsetParent().offset();
+ this.top0 = sourceOffset.top - origin.top;
+ this.left0 = sourceOffset.left - origin.left;
+ }
+ this.el.css({
+ top: this.top0 + this.topDelta,
+ left: this.left0 + this.leftDelta
+ });
+ };
+ // Gets called when the user moves the mouse
+ MouseFollower.prototype.handleMove = function (ev) {
+ this.topDelta = util_1.getEvY(ev) - this.y0;
+ this.leftDelta = util_1.getEvX(ev) - this.x0;
+ if (!this.isHidden) {
+ this.updatePosition();
+ }
+ };
+ // Temporarily makes the tracking element invisible. Can be called before following starts
+ MouseFollower.prototype.hide = function () {
+ if (!this.isHidden) {
+ this.isHidden = true;
+ if (this.el) {
+ this.el.hide();
+ }
+ }
+ };
+ // Show the tracking element after it has been temporarily hidden
+ MouseFollower.prototype.show = function () {
+ if (this.isHidden) {
+ this.isHidden = false;
+ this.updatePosition();
+ this.getEl().show();
+ }
+ };
+ return MouseFollower;
+}());
+exports.default = MouseFollower;
+ListenerMixin_1.default.mixInto(MouseFollower);
+
+
+/***/ }),
+/* 227 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/* A rectangular panel that is absolutely positioned over other content
+------------------------------------------------------------------------------------------------------------------------
+Options:
+ - className (string)
+ - content (HTML string or jQuery element set)
+ - parentEl
+ - top
+ - left
+ - right (the x coord of where the right edge should be. not a "CSS" right)
+ - autoHide (boolean)
+ - show (callback)
+ - hide (callback)
+*/
+Object.defineProperty(exports, "__esModule", { value: true });
+var $ = __webpack_require__(3);
+var util_1 = __webpack_require__(4);
+var ListenerMixin_1 = __webpack_require__(7);
+var Popover = /** @class */ (function () {
+ function Popover(options) {
+ this.isHidden = true;
+ this.margin = 10; // the space required between the popover and the edges of the scroll container
+ this.options = options || {};
+ }
+ // Shows the popover on the specified position. Renders it if not already
+ Popover.prototype.show = function () {
+ if (this.isHidden) {
+ if (!this.el) {
+ this.render();
+ }
+ this.el.show();
+ this.position();
+ this.isHidden = false;
+ this.trigger('show');
+ }
+ };
+ // Hides the popover, through CSS, but does not remove it from the DOM
+ Popover.prototype.hide = function () {
+ if (!this.isHidden) {
+ this.el.hide();
+ this.isHidden = true;
+ this.trigger('hide');
+ }
+ };
+ // Creates `this.el` and renders content inside of it
+ Popover.prototype.render = function () {
+ var _this = this;
+ var options = this.options;
+ this.el = $('
')
+ .addClass(options.className || '')
+ .css({
+ // position initially to the top left to avoid creating scrollbars
+ top: 0,
+ left: 0
+ })
+ .append(options.content)
+ .appendTo(options.parentEl);
+ // when a click happens on anything inside with a 'fc-close' className, hide the popover
+ this.el.on('click', '.fc-close', function () {
+ _this.hide();
+ });
+ if (options.autoHide) {
+ this.listenTo($(document), 'mousedown', this.documentMousedown);
+ }
+ };
+ // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
+ Popover.prototype.documentMousedown = function (ev) {
+ // only hide the popover if the click happened outside the popover
+ if (this.el && !$(ev.target).closest(this.el).length) {
+ this.hide();
+ }
+ };
+ // Hides and unregisters any handlers
+ Popover.prototype.removeElement = function () {
+ this.hide();
+ if (this.el) {
+ this.el.remove();
+ this.el = null;
+ }
+ this.stopListeningTo($(document), 'mousedown');
+ };
+ // Positions the popover optimally, using the top/left/right options
+ Popover.prototype.position = function () {
+ var options = this.options;
+ var origin = this.el.offsetParent().offset();
+ var width = this.el.outerWidth();
+ var height = this.el.outerHeight();
+ var windowEl = $(window);
+ var viewportEl = util_1.getScrollParent(this.el);
+ var viewportTop;
+ var viewportLeft;
+ var viewportOffset;
+ var top; // the "position" (not "offset") values for the popover
+ var left; //
+ // compute top and left
+ top = options.top || 0;
+ if (options.left !== undefined) {
+ left = options.left;
+ }
+ else if (options.right !== undefined) {
+ left = options.right - width; // derive the left value from the right value
+ }
+ else {
+ left = 0;
+ }
+ if (viewportEl.is(window) || viewportEl.is(document)) { // normalize getScrollParent's result
+ viewportEl = windowEl;
+ viewportTop = 0; // the window is always at the top left
+ viewportLeft = 0; // (and .offset() won't work if called here)
+ }
+ else {
+ viewportOffset = viewportEl.offset();
+ viewportTop = viewportOffset.top;
+ viewportLeft = viewportOffset.left;
+ }
+ // if the window is scrolled, it causes the visible area to be further down
+ viewportTop += windowEl.scrollTop();
+ viewportLeft += windowEl.scrollLeft();
+ // constrain to the view port. if constrained by two edges, give precedence to top/left
+ if (options.viewportConstrain !== false) {
+ top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin);
+ top = Math.max(top, viewportTop + this.margin);
+ left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin);
+ left = Math.max(left, viewportLeft + this.margin);
+ }
+ this.el.css({
+ top: top - origin.top,
+ left: left - origin.left
+ });
+ };
+ // Triggers a callback. Calls a function in the option hash of the same name.
+ // Arguments beyond the first `name` are forwarded on.
+ // TODO: better code reuse for this. Repeat code
+ Popover.prototype.trigger = function (name) {
+ if (this.options[name]) {
+ this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
+ }
+ };
+ return Popover;
+}());
+exports.default = Popover;
+ListenerMixin_1.default.mixInto(Popover);
+
+
+/***/ }),
+/* 228 */
+/***/ (function(module, exports, __webpack_require__) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var EmitterMixin_1 = __webpack_require__(13);
var TaskQueue = /** @class */ (function () {
function TaskQueue() {
this.q = [];
@@ -8585,12 +9841,12 @@ EmitterMixin_1.default.mixInto(TaskQueue);
/***/ }),
-/* 218 */
+/* 229 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
-var TaskQueue_1 = __webpack_require__(217);
+var TaskQueue_1 = __webpack_require__(228);
var RenderQueue = /** @class */ (function (_super) {
tslib_1.__extends(RenderQueue, _super);
function RenderQueue(waitsByNamespace) {
@@ -8617,7 +9873,7 @@ var RenderQueue = /** @class */ (function (_super) {
this.tryStart();
}
}
- if (this.compoundTask(task)) {
+ if (this.compoundTask(task)) { // appended to queue?
if (!this.waitNamespace && waitMs != null) {
this.startWait(namespace, waitMs);
}
@@ -8679,15 +9935,17 @@ var RenderQueue = /** @class */ (function (_super) {
// remove all init/add/remove ops with same namespace, regardless of order
for (i = q.length - 1; i >= 0; i--) {
task = q[i];
- switch (task.type) {
- case 'init':
- shouldAppend = false;
- // the latest destroy is cancelled out by not doing the init
- /* falls through */
- case 'add':
- /* falls through */
- case 'remove':
- q.splice(i, 1); // remove task
+ if (task.namespace === newTask.namespace) {
+ switch (task.type) {
+ case 'init':
+ shouldAppend = false;
+ // the latest destroy is cancelled out by not doing the init
+ /* falls through */
+ case 'add':
+ /* falls through */
+ case 'remove':
+ q.splice(i, 1); // remove task
+ }
}
}
}
@@ -8702,7 +9960,56 @@ exports.default = RenderQueue;
/***/ }),
-/* 219 */
+/* 230 */
+/***/ (function(module, exports, __webpack_require__) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = __webpack_require__(2);
+var Model_1 = __webpack_require__(51);
+var Component = /** @class */ (function (_super) {
+ tslib_1.__extends(Component, _super);
+ function Component() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ Component.prototype.setElement = function (el) {
+ this.el = el;
+ this.bindGlobalHandlers();
+ this.renderSkeleton();
+ this.set('isInDom', true);
+ };
+ Component.prototype.removeElement = function () {
+ this.unset('isInDom');
+ this.unrenderSkeleton();
+ this.unbindGlobalHandlers();
+ this.el.remove();
+ // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
+ // We don't null-out the View's other jQuery element references upon destroy,
+ // so we shouldn't kill this.el either.
+ };
+ Component.prototype.bindGlobalHandlers = function () {
+ // subclasses can override
+ };
+ Component.prototype.unbindGlobalHandlers = function () {
+ // subclasses can override
+ };
+ /*
+ NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender
+ */
+ // Renders the basic structure of the view before any content is rendered
+ Component.prototype.renderSkeleton = function () {
+ // subclasses should implement
+ };
+ // Unrenders the basic structure of the view
+ Component.prototype.unrenderSkeleton = function () {
+ // subclasses should implement
+ };
+ return Component;
+}(Model_1.default));
+exports.default = Component;
+
+
+/***/ }),
+/* 231 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
@@ -8710,10 +10017,10 @@ var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var moment = __webpack_require__(0);
var util_1 = __webpack_require__(4);
-var moment_ext_1 = __webpack_require__(10);
-var date_formatting_1 = __webpack_require__(47);
-var Component_1 = __webpack_require__(237);
-var util_2 = __webpack_require__(35);
+var moment_ext_1 = __webpack_require__(11);
+var date_formatting_1 = __webpack_require__(49);
+var Component_1 = __webpack_require__(230);
+var util_2 = __webpack_require__(19);
var DateComponent = /** @class */ (function (_super) {
tslib_1.__extends(DateComponent, _super);
function DateComponent(_view, _options) {
@@ -8736,7 +10043,7 @@ var DateComponent = /** @class */ (function (_super) {
if (_this.fillRendererClass) {
_this.fillRenderer = new _this.fillRendererClass(_this);
}
- if (_this.eventRendererClass) {
+ if (_this.eventRendererClass) { // fillRenderer is optional -----v
_this.eventRenderer = new _this.eventRendererClass(_this, _this.fillRenderer);
}
if (_this.helperRendererClass && _this.eventRenderer) {
@@ -8846,7 +10153,7 @@ var DateComponent = /** @class */ (function (_super) {
this.eventRenderer.rangeUpdated(); // poorly named now
this.eventRenderer.render(eventsPayload);
}
- else if (this['renderEvents']) {
+ else if (this['renderEvents']) { // legacy
this['renderEvents'](convertEventsPayloadToLegacyArray(eventsPayload));
}
this.callChildren('executeEventRender', arguments);
@@ -8856,7 +10163,7 @@ var DateComponent = /** @class */ (function (_super) {
if (this.eventRenderer) {
this.eventRenderer.unrender();
}
- else if (this['destroyEvents']) {
+ else if (this['destroyEvents']) { // legacy
this['destroyEvents']();
}
};
@@ -8901,7 +10208,7 @@ var DateComponent = /** @class */ (function (_super) {
if (this.hasPublicHandlers('eventAfterRender')) {
segs.forEach(function (seg) {
var legacy;
- if (seg.el) {
+ if (seg.el) { // necessary?
legacy = seg.footprint.getEventLegacy();
_this.publiclyTrigger('eventAfterRender', {
context: legacy,
@@ -8919,7 +10226,7 @@ var DateComponent = /** @class */ (function (_super) {
if (this.hasPublicHandlers('eventDestroy')) {
segs.forEach(function (seg) {
var legacy;
- if (seg.el) {
+ if (seg.el) { // necessary?
legacy = seg.footprint.getEventLegacy();
_this.publiclyTrigger('eventDestroy', {
context: legacy,
@@ -9197,7 +10504,7 @@ var DateComponent = /** @class */ (function (_super) {
}
else {
classes.push('fc-' + util_1.dayIDs[date.day()]);
- if (view.isDateInOtherMonth(date, this.dateProfile)) {
+ if (view.isDateInOtherMonth(date, this.dateProfile)) { // TODO: use DateComponent subclass somehow
classes.push('fc-other-month');
}
today = view.calendar.getNow();
@@ -9277,35 +10584,35 @@ function convertEventsPayloadToLegacyArray(eventsPayload) {
/***/ }),
-/* 220 */
+/* 232 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var $ = __webpack_require__(3);
var moment = __webpack_require__(0);
var util_1 = __webpack_require__(4);
-var options_1 = __webpack_require__(32);
-var Iterator_1 = __webpack_require__(238);
-var GlobalEmitter_1 = __webpack_require__(21);
-var EmitterMixin_1 = __webpack_require__(11);
+var options_1 = __webpack_require__(33);
+var Iterator_1 = __webpack_require__(225);
+var GlobalEmitter_1 = __webpack_require__(23);
+var EmitterMixin_1 = __webpack_require__(13);
var ListenerMixin_1 = __webpack_require__(7);
-var Toolbar_1 = __webpack_require__(239);
-var OptionsManager_1 = __webpack_require__(240);
-var ViewSpecManager_1 = __webpack_require__(241);
-var Constraints_1 = __webpack_require__(207);
-var locale_1 = __webpack_require__(31);
-var moment_ext_1 = __webpack_require__(10);
+var Toolbar_1 = __webpack_require__(257);
+var OptionsManager_1 = __webpack_require__(258);
+var ViewSpecManager_1 = __webpack_require__(259);
+var Constraints_1 = __webpack_require__(217);
+var locale_1 = __webpack_require__(32);
+var moment_ext_1 = __webpack_require__(11);
var UnzonedRange_1 = __webpack_require__(5);
var ComponentFootprint_1 = __webpack_require__(12);
-var EventDateProfile_1 = __webpack_require__(17);
-var EventManager_1 = __webpack_require__(242);
-var BusinessHourGenerator_1 = __webpack_require__(212);
+var EventDateProfile_1 = __webpack_require__(16);
+var EventManager_1 = __webpack_require__(220);
+var BusinessHourGenerator_1 = __webpack_require__(218);
var EventSourceParser_1 = __webpack_require__(38);
-var EventDefParser_1 = __webpack_require__(49);
-var SingleEventDef_1 = __webpack_require__(13);
-var EventDefMutation_1 = __webpack_require__(37);
+var EventDefParser_1 = __webpack_require__(36);
+var SingleEventDef_1 = __webpack_require__(9);
+var EventDefMutation_1 = __webpack_require__(39);
var EventSource_1 = __webpack_require__(6);
-var ThemeRegistry_1 = __webpack_require__(51);
+var ThemeRegistry_1 = __webpack_require__(57);
var Calendar = /** @class */ (function () {
function Calendar(el, overrides) {
this.loadingLevel = 0; // number of simultaneous loading tasks
@@ -9362,16 +10669,16 @@ var Calendar = /** @class */ (function () {
Calendar.prototype.option = function (name, value) {
var newOptionHash;
if (typeof name === 'string') {
- if (value === undefined) {
+ if (value === undefined) { // getter
return this.optionsManager.get(name);
}
- else {
+ else { // setter for individual option
newOptionHash = {};
newOptionHash[name] = value;
this.optionsManager.add(newOptionHash);
}
}
- else if (typeof name === 'object') {
+ else if (typeof name === 'object') { // compound setter with object input
this.optionsManager.add(name);
}
};
@@ -9395,12 +10702,12 @@ var Calendar = /** @class */ (function () {
};
Calendar.prototype.changeView = function (viewName, dateOrRange) {
if (dateOrRange) {
- if (dateOrRange.start && dateOrRange.end) {
+ if (dateOrRange.start && dateOrRange.end) { // a range
this.optionsManager.recordOverrides({
visibleRange: dateOrRange
});
}
- else {
+ else { // a date
this.currentDate = this.moment(dateOrRange).stripZone(); // just like gotoDate
}
}
@@ -9546,7 +10853,7 @@ var Calendar = /** @class */ (function () {
el.toggleClass('fc-ltr', !opts.isRTL);
el.toggleClass('fc-rtl', opts.isRTL);
});
- this.contentEl = $("").prependTo(el);
+ this.contentEl = $("
").prependTo(el);
this.initToolbars();
this.renderHeader();
this.renderFooter();
@@ -9581,12 +10888,12 @@ var Calendar = /** @class */ (function () {
Calendar.prototype.bindViewHandlers = function (view) {
var _this = this;
view.watch('titleForCalendar', ['title'], function (deps) {
- if (view === _this.view) {
+ if (view === _this.view) { // hack
_this.setToolbarsTitle(deps.title);
}
});
view.watch('dateProfileForCalendar', ['dateProfile'], function (deps) {
- if (view === _this.view) {
+ if (view === _this.view) { // hack
_this.currentDate = deps.dateProfile.date; // might have been constrained by view dates
_this.updateToolbarButtons(deps.dateProfile);
}
@@ -9615,7 +10922,7 @@ var Calendar = /** @class */ (function () {
(this.viewsByType[viewType] = this.instantiateView(viewType));
this.bindViewHandlers(newView);
newView.startBatchRender(); // so that setElement+setDate rendering are joined
- newView.setElement($("").appendTo(this.contentEl));
+ newView.setElement($("
").appendTo(this.contentEl));
this.toolbarsManager.proxyCall('activateButton', viewType);
}
if (this.view) {
@@ -9690,19 +10997,19 @@ var Calendar = /** @class */ (function () {
Calendar.prototype._calcSize = function () {
var contentHeightInput = this.opt('contentHeight');
var heightInput = this.opt('height');
- if (typeof contentHeightInput === 'number') {
+ if (typeof contentHeightInput === 'number') { // exists and not 'auto'
this.suggestedViewHeight = contentHeightInput;
}
- else if (typeof contentHeightInput === 'function') {
+ else if (typeof contentHeightInput === 'function') { // exists and is a function
this.suggestedViewHeight = contentHeightInput();
}
- else if (typeof heightInput === 'number') {
+ else if (typeof heightInput === 'number') { // exists and not 'auto'
this.suggestedViewHeight = heightInput - this.queryToolbarsHeight();
}
- else if (typeof heightInput === 'function') {
+ else if (typeof heightInput === 'function') { // exists and is a function
this.suggestedViewHeight = heightInput() - this.queryToolbarsHeight();
}
- else if (heightInput === 'parent') {
+ else if (heightInput === 'parent') { // set to height of parent element
this.suggestedViewHeight = this.el.parent().height() - this.queryToolbarsHeight();
}
else {
@@ -9717,7 +11024,7 @@ var Calendar = /** @class */ (function () {
ev.target === window &&
this.view &&
this.view.isDatesRendered) {
- if (this.updateViewSize(true)) {
+ if (this.updateViewSize(true)) { // isResize=true, returns true on success
this.publiclyTrigger('windowResize', [this.view]);
}
}
@@ -9879,7 +11186,8 @@ var Calendar = /** @class */ (function () {
_week.dow = firstDay;
localeData._week = _week;
}
- if (weekNumberCalculation === 'ISO' ||
+ if ( // whitelist certain kinds of input
+ weekNumberCalculation === 'ISO' ||
weekNumberCalculation === 'local' ||
typeof weekNumberCalculation === 'function') {
localeData._fullCalendar_weekCalc = weekNumberCalculation; // moment-ext will know what to do with it
@@ -9903,7 +11211,7 @@ var Calendar = /** @class */ (function () {
if (this.opt('timezone') === 'local') {
mom = moment_ext_1.default.apply(null, args);
// Force the moment to be local, because momentExt doesn't guarantee it.
- if (mom.hasTime()) {
+ if (mom.hasTime()) { // don't give ambiguously-timed moments a local zone
mom.local();
}
}
@@ -9953,9 +11261,9 @@ var Calendar = /** @class */ (function () {
var timeAdjust = date.time().asMilliseconds() - zonedDate.time().asMilliseconds();
var adjustedZonedDate;
// Safari sometimes has problems with this coersion when near DST. Adjust if necessary. (bug #2396)
- if (timeAdjust) {
+ if (timeAdjust) { // is the time result different than expected?
adjustedZonedDate = zonedDate.clone().add(timeAdjust); // add milliseconds
- if (date.time().asMilliseconds() - adjustedZonedDate.time().asMilliseconds() === 0) {
+ if (date.time().asMilliseconds() - adjustedZonedDate.time().asMilliseconds() === 0) { // does it match perfectly now?
zonedDate = adjustedZonedDate;
}
}
@@ -9983,6 +11291,10 @@ var Calendar = /** @class */ (function () {
end = this.applyTimezone(end);
}
}
+ this.localizeMoment(start);
+ if (end) {
+ this.localizeMoment(end);
+ }
return new EventDateProfile_1.default(start, end, this);
};
// Returns a moment for the current date, as defined by the client's computer or from the `now` option.
@@ -10097,7 +11409,7 @@ var Calendar = /** @class */ (function () {
var idMap = {};
var eventDef;
var i;
- if (legacyQuery == null) {
+ if (legacyQuery == null) { // shortcut for removing all
eventManager.removeAllEventDefs(); // persist=true
}
else {
@@ -10111,7 +11423,7 @@ var Calendar = /** @class */ (function () {
idMap[eventDef.id] = true;
}
eventManager.freeze();
- for (i in idMap) {
+ for (i in idMap) { // reuse `i` as an "id"
eventManager.removeEventDefsById(i); // persist=true
}
eventManager.thaw();
@@ -10210,7 +11522,7 @@ function filterLegacyEventInstances(legacyEventInstances, legacyQuery) {
else if ($.isFunction(legacyQuery)) {
return legacyEventInstances.filter(legacyQuery);
}
- else {
+ else { // an event ID
legacyQuery += ''; // normalize to string
return legacyEventInstances.filter(function (legacyEventInstance) {
// soft comparison because id not be normalized to string
@@ -10223,288 +11535,22 @@ function filterLegacyEventInstances(legacyEventInstances, legacyQuery) {
/***/ }),
-/* 221 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var moment = __webpack_require__(0);
-var util_1 = __webpack_require__(4);
-var UnzonedRange_1 = __webpack_require__(5);
-var DateProfileGenerator = /** @class */ (function () {
- function DateProfileGenerator(_view) {
- this._view = _view;
- }
- DateProfileGenerator.prototype.opt = function (name) {
- return this._view.opt(name);
- };
- DateProfileGenerator.prototype.trimHiddenDays = function (unzonedRange) {
- return this._view.trimHiddenDays(unzonedRange);
- };
- DateProfileGenerator.prototype.msToUtcMoment = function (ms, forceAllDay) {
- return this._view.calendar.msToUtcMoment(ms, forceAllDay);
- };
- /* Date Range Computation
- ------------------------------------------------------------------------------------------------------------------*/
- // Builds a structure with info about what the dates/ranges will be for the "prev" view.
- DateProfileGenerator.prototype.buildPrev = function (currentDateProfile) {
- var prevDate = currentDateProfile.date.clone()
- .startOf(currentDateProfile.currentRangeUnit)
- .subtract(currentDateProfile.dateIncrement);
- return this.build(prevDate, -1);
- };
- // Builds a structure with info about what the dates/ranges will be for the "next" view.
- DateProfileGenerator.prototype.buildNext = function (currentDateProfile) {
- var nextDate = currentDateProfile.date.clone()
- .startOf(currentDateProfile.currentRangeUnit)
- .add(currentDateProfile.dateIncrement);
- return this.build(nextDate, 1);
- };
- // Builds a structure holding dates/ranges for rendering around the given date.
- // Optional direction param indicates whether the date is being incremented/decremented
- // from its previous value. decremented = -1, incremented = 1 (default).
- DateProfileGenerator.prototype.build = function (date, direction, forceToValid) {
- if (forceToValid === void 0) { forceToValid = false; }
- var isDateAllDay = !date.hasTime();
- var validUnzonedRange;
- var minTime = null;
- var maxTime = null;
- var currentInfo;
- var isRangeAllDay;
- var renderUnzonedRange;
- var activeUnzonedRange;
- var isValid;
- validUnzonedRange = this.buildValidRange();
- validUnzonedRange = this.trimHiddenDays(validUnzonedRange);
- if (forceToValid) {
- date = this.msToUtcMoment(validUnzonedRange.constrainDate(date), // returns MS
- isDateAllDay);
- }
- currentInfo = this.buildCurrentRangeInfo(date, direction);
- isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit);
- renderUnzonedRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.unzonedRange), currentInfo.unit, isRangeAllDay);
- renderUnzonedRange = this.trimHiddenDays(renderUnzonedRange);
- activeUnzonedRange = renderUnzonedRange.clone();
- if (!this.opt('showNonCurrentDates')) {
- activeUnzonedRange = activeUnzonedRange.intersect(currentInfo.unzonedRange);
- }
- minTime = moment.duration(this.opt('minTime'));
- maxTime = moment.duration(this.opt('maxTime'));
- activeUnzonedRange = this.adjustActiveRange(activeUnzonedRange, minTime, maxTime);
- activeUnzonedRange = activeUnzonedRange.intersect(validUnzonedRange); // might return null
- if (activeUnzonedRange) {
- date = this.msToUtcMoment(activeUnzonedRange.constrainDate(date), // returns MS
- isDateAllDay);
- }
- // it's invalid if the originally requested date is not contained,
- // or if the range is completely outside of the valid range.
- isValid = currentInfo.unzonedRange.intersectsWith(validUnzonedRange);
- return {
- // constraint for where prev/next operations can go and where events can be dragged/resized to.
- // an object with optional start and end properties.
- validUnzonedRange: validUnzonedRange,
- // range the view is formally responsible for.
- // for example, a month view might have 1st-31st, excluding padded dates
- currentUnzonedRange: currentInfo.unzonedRange,
- // name of largest unit being displayed, like "month" or "week"
- currentRangeUnit: currentInfo.unit,
- isRangeAllDay: isRangeAllDay,
- // dates that display events and accept drag-n-drop
- // will be `null` if no dates accept events
- activeUnzonedRange: activeUnzonedRange,
- // date range with a rendered skeleton
- // includes not-active days that need some sort of DOM
- renderUnzonedRange: renderUnzonedRange,
- // Duration object that denotes the first visible time of any given day
- minTime: minTime,
- // Duration object that denotes the exclusive visible end time of any given day
- maxTime: maxTime,
- isValid: isValid,
- date: date,
- // how far the current date will move for a prev/next operation
- dateIncrement: this.buildDateIncrement(currentInfo.duration)
- // pass a fallback (might be null) ^
- };
- };
- // Builds an object with optional start/end properties.
- // Indicates the minimum/maximum dates to display.
- // not responsible for trimming hidden days.
- DateProfileGenerator.prototype.buildValidRange = function () {
- return this._view.getUnzonedRangeOption('validRange', this._view.calendar.getNow()) ||
- new UnzonedRange_1.default(); // completely open-ended
- };
- // Builds a structure with info about the "current" range, the range that is
- // highlighted as being the current month for example.
- // See build() for a description of `direction`.
- // Guaranteed to have `range` and `unit` properties. `duration` is optional.
- // TODO: accept a MS-time instead of a moment `date`?
- DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) {
- var viewSpec = this._view.viewSpec;
- var duration = null;
- var unit = null;
- var unzonedRange = null;
- var dayCount;
- if (viewSpec.duration) {
- duration = viewSpec.duration;
- unit = viewSpec.durationUnit;
- unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
- }
- else if ((dayCount = this.opt('dayCount'))) {
- unit = 'day';
- unzonedRange = this.buildRangeFromDayCount(date, direction, dayCount);
- }
- else if ((unzonedRange = this.buildCustomVisibleRange(date))) {
- unit = util_1.computeGreatestUnit(unzonedRange.getStart(), unzonedRange.getEnd());
- }
- else {
- duration = this.getFallbackDuration();
- unit = util_1.computeGreatestUnit(duration);
- unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
- }
- return { duration: duration, unit: unit, unzonedRange: unzonedRange };
- };
- DateProfileGenerator.prototype.getFallbackDuration = function () {
- return moment.duration({ days: 1 });
- };
- // Returns a new activeUnzonedRange to have time values (un-ambiguate)
- // minTime or maxTime causes the range to expand.
- DateProfileGenerator.prototype.adjustActiveRange = function (unzonedRange, minTime, maxTime) {
- var start = unzonedRange.getStart();
- var end = unzonedRange.getEnd();
- if (this._view.usesMinMaxTime) {
- if (minTime < 0) {
- start.time(0).add(minTime);
- }
- if (maxTime > 24 * 60 * 60 * 1000) {
- end.time(maxTime - (24 * 60 * 60 * 1000));
- }
- }
- return new UnzonedRange_1.default(start, end);
- };
- // Builds the "current" range when it is specified as an explicit duration.
- // `unit` is the already-computed computeGreatestUnit value of duration.
- // TODO: accept a MS-time instead of a moment `date`?
- DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) {
- var alignment = this.opt('dateAlignment');
- var dateIncrementInput;
- var dateIncrementDuration;
- var start;
- var end;
- var res;
- // compute what the alignment should be
- if (!alignment) {
- dateIncrementInput = this.opt('dateIncrement');
- if (dateIncrementInput) {
- dateIncrementDuration = moment.duration(dateIncrementInput);
- // use the smaller of the two units
- if (dateIncrementDuration < duration) {
- alignment = util_1.computeDurationGreatestUnit(dateIncrementDuration, dateIncrementInput);
- }
- else {
- alignment = unit;
- }
- }
- else {
- alignment = unit;
- }
- }
- // if the view displays a single day or smaller
- if (duration.as('days') <= 1) {
- if (this._view.isHiddenDay(start)) {
- start = this._view.skipHiddenDays(start, direction);
- start.startOf('day');
- }
- }
- function computeRes() {
- start = date.clone().startOf(alignment);
- end = start.clone().add(duration);
- res = new UnzonedRange_1.default(start, end);
- }
- computeRes();
- // if range is completely enveloped by hidden days, go past the hidden days
- if (!this.trimHiddenDays(res)) {
- date = this._view.skipHiddenDays(date, direction);
- computeRes();
- }
- return res;
- };
- // Builds the "current" range when a dayCount is specified.
- // TODO: accept a MS-time instead of a moment `date`?
- DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) {
- var customAlignment = this.opt('dateAlignment');
- var runningCount = 0;
- var start = date.clone();
- var end;
- if (customAlignment) {
- start.startOf(customAlignment);
- }
- start.startOf('day');
- start = this._view.skipHiddenDays(start, direction);
- end = start.clone();
- do {
- end.add(1, 'day');
- if (!this._view.isHiddenDay(end)) {
- runningCount++;
- }
- } while (runningCount < dayCount);
- return new UnzonedRange_1.default(start, end);
- };
- // Builds a normalized range object for the "visible" range,
- // which is a way to define the currentUnzonedRange and activeUnzonedRange at the same time.
- // TODO: accept a MS-time instead of a moment `date`?
- DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) {
- var visibleUnzonedRange = this._view.getUnzonedRangeOption('visibleRange', this._view.calendar.applyTimezone(date) // correct zone. also generates new obj that avoids mutations
- );
- if (visibleUnzonedRange && (visibleUnzonedRange.startMs == null || visibleUnzonedRange.endMs == null)) {
- return null;
- }
- return visibleUnzonedRange;
- };
- // Computes the range that will represent the element/cells for *rendering*,
- // but which may have voided days/times.
- // not responsible for trimming hidden days.
- DateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
- return currentUnzonedRange.clone();
- };
- // Compute the duration value that should be added/substracted to the current date
- // when a prev/next operation happens.
- DateProfileGenerator.prototype.buildDateIncrement = function (fallback) {
- var dateIncrementInput = this.opt('dateIncrement');
- var customAlignment;
- if (dateIncrementInput) {
- return moment.duration(dateIncrementInput);
- }
- else if ((customAlignment = this.opt('dateAlignment'))) {
- return moment.duration(1, customAlignment);
- }
- else if (fallback) {
- return fallback;
- }
- else {
- return moment.duration({ days: 1 });
- }
- };
- return DateProfileGenerator;
-}());
-exports.default = DateProfileGenerator;
-
-
-/***/ }),
-/* 222 */
+/* 233 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var moment = __webpack_require__(0);
-var exportHooks = __webpack_require__(16);
+var exportHooks = __webpack_require__(18);
var util_1 = __webpack_require__(4);
-var moment_ext_1 = __webpack_require__(10);
+var moment_ext_1 = __webpack_require__(11);
var ListenerMixin_1 = __webpack_require__(7);
-var HitDragListener_1 = __webpack_require__(23);
-var SingleEventDef_1 = __webpack_require__(13);
-var EventInstanceGroup_1 = __webpack_require__(18);
+var HitDragListener_1 = __webpack_require__(17);
+var SingleEventDef_1 = __webpack_require__(9);
+var EventInstanceGroup_1 = __webpack_require__(20);
var EventSource_1 = __webpack_require__(6);
-var Interaction_1 = __webpack_require__(15);
+var Interaction_1 = __webpack_require__(14);
var ExternalDropping = /** @class */ (function (_super) {
tslib_1.__extends(ExternalDropping, _super);
function ExternalDropping() {
@@ -10538,13 +11584,13 @@ var ExternalDropping = /** @class */ (function (_super) {
ExternalDropping.prototype.handleDragStart = function (ev, ui) {
var el;
var accept;
- if (this.opt('droppable')) {
+ if (this.opt('droppable')) { // only listen if this setting is on
el = $((ui ? ui.item : null) || ev.target);
// Test that the dragged element passes the dropAccept selector or filter function.
// FYI, the default is "*" (matches all)
accept = this.opt('dropAccept');
if ($.isFunction(accept) ? accept.call(el[0], el) : el.is(accept)) {
- if (!this.isDragging) {
+ if (!this.isDragging) { // prevent double-listening if fired twice
this.listenToExternalDrag(el, ev, ui);
}
}
@@ -10598,7 +11644,7 @@ var ExternalDropping = /** @class */ (function (_super) {
component.unrenderDrag();
},
interactionEnd: function (ev) {
- if (singleEventDef) {
+ if (singleEventDef) { // element was dropped on a valid hit
view.reportExternalDrop(singleEventDef, Boolean(meta.eventProps), // isEvent
Boolean(meta.stick), // isSticky
el, ev, ui);
@@ -10667,7 +11713,7 @@ function getDraggedElMeta(el) {
if (typeof eventProps === 'object') {
eventProps = $.extend({}, eventProps); // make a copy
}
- else {
+ else { // something like 1 or true. still signal event creation
eventProps = {};
}
// pluck special-cased date/time properties
@@ -10704,17 +11750,17 @@ function getDraggedElMeta(el) {
/***/ }),
-/* 223 */
+/* 234 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var util_1 = __webpack_require__(4);
-var EventDefMutation_1 = __webpack_require__(37);
-var EventDefDateMutation_1 = __webpack_require__(50);
-var HitDragListener_1 = __webpack_require__(23);
-var Interaction_1 = __webpack_require__(15);
+var EventDefMutation_1 = __webpack_require__(39);
+var EventDefDateMutation_1 = __webpack_require__(40);
+var HitDragListener_1 = __webpack_require__(17);
+var Interaction_1 = __webpack_require__(14);
var EventResizing = /** @class */ (function (_super) {
tslib_1.__extends(EventResizing, _super);
/*
@@ -10825,7 +11871,7 @@ var EventResizing = /** @class */ (function (_super) {
if (isDragging) {
_this.segResizeStop(seg, ev);
}
- if (resizeMutation) {
+ if (resizeMutation) { // valid date to resize to?
// no need to re-show original, will rerender all anyways. esp important if eventRenderWait
view.reportEventResize(eventInstance, resizeMutation, el, ev);
}
@@ -10896,18 +11942,18 @@ exports.default = EventResizing;
/***/ }),
-/* 224 */
+/* 235 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var util_1 = __webpack_require__(4);
-var EventDefMutation_1 = __webpack_require__(37);
-var EventDefDateMutation_1 = __webpack_require__(50);
-var DragListener_1 = __webpack_require__(54);
-var HitDragListener_1 = __webpack_require__(23);
-var MouseFollower_1 = __webpack_require__(244);
-var Interaction_1 = __webpack_require__(15);
+var EventDefMutation_1 = __webpack_require__(39);
+var EventDefDateMutation_1 = __webpack_require__(40);
+var DragListener_1 = __webpack_require__(59);
+var HitDragListener_1 = __webpack_require__(17);
+var MouseFollower_1 = __webpack_require__(226);
+var Interaction_1 = __webpack_require__(14);
var EventDragging = /** @class */ (function (_super) {
tslib_1.__extends(EventDragging, _super);
/*
@@ -11170,16 +12216,16 @@ exports.default = EventDragging;
/***/ }),
-/* 225 */
+/* 236 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var util_1 = __webpack_require__(4);
-var HitDragListener_1 = __webpack_require__(23);
+var HitDragListener_1 = __webpack_require__(17);
var ComponentFootprint_1 = __webpack_require__(12);
var UnzonedRange_1 = __webpack_require__(5);
-var Interaction_1 = __webpack_require__(15);
+var Interaction_1 = __webpack_require__(14);
var DateSelecting = /** @class */ (function (_super) {
tslib_1.__extends(DateSelecting, _super);
/*
@@ -11240,7 +12286,7 @@ var DateSelecting = /** @class */ (function (_super) {
hitOver: function (hit, isOrig, origHit) {
var origHitFootprint;
var hitFootprint;
- if (origHit) {
+ if (origHit) { // click needs to have started on a hit
origHitFootprint = component.getSafeHitFootprint(origHit);
hitFootprint = component.getSafeHitFootprint(hit);
if (origHitFootprint && hitFootprint) {
@@ -11307,7 +12353,85 @@ exports.default = DateSelecting;
/***/ }),
-/* 226 */
+/* 237 */
+/***/ (function(module, exports, __webpack_require__) {
+
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = __webpack_require__(2);
+var HitDragListener_1 = __webpack_require__(17);
+var Interaction_1 = __webpack_require__(14);
+var DateClicking = /** @class */ (function (_super) {
+ tslib_1.__extends(DateClicking, _super);
+ /*
+ component must implement:
+ - bindDateHandlerToEl
+ - getSafeHitFootprint
+ - getHitEl
+ */
+ function DateClicking(component) {
+ var _this = _super.call(this, component) || this;
+ _this.dragListener = _this.buildDragListener();
+ return _this;
+ }
+ DateClicking.prototype.end = function () {
+ this.dragListener.endInteraction();
+ };
+ DateClicking.prototype.bindToEl = function (el) {
+ var component = this.component;
+ var dragListener = this.dragListener;
+ component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
+ if (!component.shouldIgnoreMouse()) {
+ dragListener.startInteraction(ev);
+ }
+ });
+ component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
+ if (!component.shouldIgnoreTouch()) {
+ dragListener.startInteraction(ev);
+ }
+ });
+ };
+ // Creates a listener that tracks the user's drag across day elements, for day clicking.
+ DateClicking.prototype.buildDragListener = function () {
+ var _this = this;
+ var component = this.component;
+ var dayClickHit; // null if invalid dayClick
+ var dragListener = new HitDragListener_1.default(component, {
+ scroll: this.opt('dragScroll'),
+ interactionStart: function () {
+ dayClickHit = dragListener.origHit;
+ },
+ hitOver: function (hit, isOrig, origHit) {
+ // if user dragged to another cell at any point, it can no longer be a dayClick
+ if (!isOrig) {
+ dayClickHit = null;
+ }
+ },
+ hitOut: function () {
+ dayClickHit = null;
+ },
+ interactionEnd: function (ev, isCancelled) {
+ var componentFootprint;
+ if (!isCancelled && dayClickHit) {
+ componentFootprint = component.getSafeHitFootprint(dayClickHit);
+ if (componentFootprint) {
+ _this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev);
+ }
+ }
+ }
+ });
+ // because dragListener won't be called with any time delay, "dragging" will begin immediately,
+ // which will kill any touchmoving/scrolling. Prevent this.
+ dragListener.shouldCancelTouchScroll = false;
+ dragListener.scrollAlwaysKills = true;
+ return dragListener;
+ };
+ return DateClicking;
+}(Interaction_1.default));
+exports.default = DateClicking;
+
+
+/***/ }),
+/* 238 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
@@ -11315,10 +12439,10 @@ var tslib_1 = __webpack_require__(2);
var moment = __webpack_require__(0);
var $ = __webpack_require__(3);
var util_1 = __webpack_require__(4);
-var Scroller_1 = __webpack_require__(39);
-var View_1 = __webpack_require__(41);
-var TimeGrid_1 = __webpack_require__(227);
-var DayGrid_1 = __webpack_require__(61);
+var Scroller_1 = __webpack_require__(41);
+var View_1 = __webpack_require__(43);
+var TimeGrid_1 = __webpack_require__(239);
+var DayGrid_1 = __webpack_require__(66);
var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
var agendaTimeGridMethods;
var agendaDayGridMethods;
@@ -11333,7 +12457,7 @@ var AgendaView = /** @class */ (function (_super) {
_this.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering
_this.timeGrid = _this.instantiateTimeGrid();
_this.addChild(_this.timeGrid);
- if (_this.opt('allDaySlot')) {
+ if (_this.opt('allDaySlot')) { // should we display the "all-day" area?
_this.dayGrid = _this.instantiateDayGrid(); // the all-day subcomponent of this view
_this.addChild(_this.dayGrid);
}
@@ -11363,7 +12487,7 @@ var AgendaView = /** @class */ (function (_super) {
this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml());
this.scroller.render();
timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container');
- timeGridEl = $('').appendTo(timeGridWrapEl);
+ timeGridEl = $('
');
- };
- // render the event segments in the view
- ListView.prototype.renderSegList = function (allSegs) {
- var segsByDay = this.groupSegsByDay(allSegs); // sparse array
- var dayIndex;
- var daySegs;
- var i;
- var tableEl = $('
');
- var tbodyEl = tableEl.find('tbody');
- for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
- daySegs = segsByDay[dayIndex];
- if (daySegs) {
- // append a day header
- tbodyEl.append(this.dayHeaderHtml(this.dayDates[dayIndex]));
- this.eventRenderer.sortEventSegs(daySegs);
- for (i = 0; i < daySegs.length; i++) {
- tbodyEl.append(daySegs[i].el); // append event row
- }
- }
- }
- this.contentEl.empty().append(tableEl);
- };
- // Returns a sparse array of arrays, segs grouped by their dayIndex
- ListView.prototype.groupSegsByDay = function (segs) {
- var segsByDay = []; // sparse array
- var i;
- var seg;
- for (i = 0; i < segs.length; i++) {
- seg = segs[i];
- (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
- .push(seg);
- }
- return segsByDay;
- };
- // generates the HTML for the day headers that live amongst the event rows
- ListView.prototype.dayHeaderHtml = function (dayDate) {
- var mainFormat = this.opt('listDayFormat');
- var altFormat = this.opt('listDayAltFormat');
- return '
';
- };
- return ListView;
-}(View_1.default));
-exports.default = ListView;
-ListView.prototype.eventRendererClass = ListEventRenderer_1.default;
-ListView.prototype.eventPointingClass = ListEventPointing_1.default;
-
-
-/***/ }),
-/* 231 */,
-/* 232 */,
-/* 233 */,
-/* 234 */,
-/* 235 */,
-/* 236 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var $ = __webpack_require__(3);
-var exportHooks = __webpack_require__(16);
-var util_1 = __webpack_require__(4);
-var Calendar_1 = __webpack_require__(220);
-// for intentional side-effects
-__webpack_require__(10);
-__webpack_require__(47);
-__webpack_require__(256);
-__webpack_require__(257);
-__webpack_require__(260);
-__webpack_require__(261);
-__webpack_require__(262);
-__webpack_require__(263);
-$.fullCalendar = exportHooks;
-$.fn.fullCalendar = function (options) {
- var args = Array.prototype.slice.call(arguments, 1); // for a possible method call
- var res = this; // what this function will return (this jQuery object by default)
- this.each(function (i, _element) {
- var element = $(_element);
- var calendar = element.data('fullCalendar'); // get the existing calendar object (if any)
- var singleRes; // the returned value of this single method call
- // a method call
- if (typeof options === 'string') {
- if (options === 'getCalendar') {
- if (!i) {
- res = calendar;
- }
- }
- else if (options === 'destroy') {
- if (calendar) {
- calendar.destroy();
- element.removeData('fullCalendar');
- }
- }
- else if (!calendar) {
- util_1.warn('Attempting to call a FullCalendar method on an element with no calendar.');
- }
- else if ($.isFunction(calendar[options])) {
- singleRes = calendar[options].apply(calendar, args);
- if (!i) {
- res = singleRes; // record the first method call result
- }
- if (options === 'destroy') {
- element.removeData('fullCalendar');
- }
- }
- else {
- util_1.warn("'" + options + "' is an unknown FullCalendar method.");
- }
- }
- else if (!calendar) {
- calendar = new Calendar_1.default(element, options);
- element.data('fullCalendar', calendar);
- calendar.render();
- }
- });
- return res;
-};
-module.exports = exportHooks;
-
-
-/***/ }),
-/* 237 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var tslib_1 = __webpack_require__(2);
-var Model_1 = __webpack_require__(48);
-var Component = /** @class */ (function (_super) {
- tslib_1.__extends(Component, _super);
- function Component() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- Component.prototype.setElement = function (el) {
- this.el = el;
- this.bindGlobalHandlers();
- this.renderSkeleton();
- this.set('isInDom', true);
- };
- Component.prototype.removeElement = function () {
- this.unset('isInDom');
- this.unrenderSkeleton();
- this.unbindGlobalHandlers();
- this.el.remove();
- // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
- // We don't null-out the View's other jQuery element references upon destroy,
- // so we shouldn't kill this.el either.
- };
- Component.prototype.bindGlobalHandlers = function () {
- // subclasses can override
- };
- Component.prototype.unbindGlobalHandlers = function () {
- // subclasses can override
- };
- /*
- NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender
- */
- // Renders the basic structure of the view before any content is rendered
- Component.prototype.renderSkeleton = function () {
- // subclasses should implement
- };
- // Unrenders the basic structure of the view
- Component.prototype.unrenderSkeleton = function () {
- // subclasses should implement
- };
- return Component;
-}(Model_1.default));
-exports.default = Component;
-
-
-/***/ }),
-/* 238 */
-/***/ (function(module, exports) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var Iterator = /** @class */ (function () {
- function Iterator(items) {
- this.items = items || [];
- }
- /* Calls a method on every item passing the arguments through */
- Iterator.prototype.proxyCall = function (methodName) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- var results = [];
- this.items.forEach(function (item) {
- results.push(item[methodName].apply(item, args));
- });
- return results;
- };
- return Iterator;
-}());
-exports.default = Iterator;
-
-
-/***/ }),
-/* 239 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var $ = __webpack_require__(3);
-var util_1 = __webpack_require__(4);
-/* Toolbar with buttons and title
-----------------------------------------------------------------------------------------------------------------------*/
-var Toolbar = /** @class */ (function () {
- function Toolbar(calendar, toolbarOptions) {
- this.el = null; // mirrors local `el`
- this.viewsWithButtons = [];
- this.calendar = calendar;
- this.toolbarOptions = toolbarOptions;
- }
- // method to update toolbar-specific options, not calendar-wide options
- Toolbar.prototype.setToolbarOptions = function (newToolbarOptions) {
- this.toolbarOptions = newToolbarOptions;
- };
- // can be called repeatedly and will rerender
- Toolbar.prototype.render = function () {
- var sections = this.toolbarOptions.layout;
- var el = this.el;
- if (sections) {
- if (!el) {
- el = this.el = $("");
- }
- else {
- el.empty();
- }
- el.append(this.renderSection('left'))
- .append(this.renderSection('right'))
- .append(this.renderSection('center'))
- .append('');
- }
- else {
- this.removeElement();
- }
- };
- Toolbar.prototype.removeElement = function () {
- if (this.el) {
- this.el.remove();
- this.el = null;
- }
- };
- Toolbar.prototype.renderSection = function (position) {
- var _this = this;
- var calendar = this.calendar;
- var theme = calendar.theme;
- var optionsManager = calendar.optionsManager;
- var viewSpecManager = calendar.viewSpecManager;
- var sectionEl = $('');
- var buttonStr = this.toolbarOptions.layout[position];
- var calendarCustomButtons = optionsManager.get('customButtons') || {};
- var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {};
- var calendarButtonText = optionsManager.get('buttonText') || {};
- if (buttonStr) {
- $.each(buttonStr.split(' '), function (i, buttonGroupStr) {
- var groupChildren = $();
- var isOnlyButtons = true;
- var groupEl;
- $.each(buttonGroupStr.split(','), function (j, buttonName) {
- var customButtonProps;
- var viewSpec;
- var buttonClick;
- var buttonIcon; // only one of these will be set
- var buttonText; // "
- var buttonInnerHtml;
- var buttonClasses;
- var buttonEl;
- var buttonAriaAttr;
- if (buttonName === 'title') {
- groupChildren = groupChildren.add($('
')); // we always want it to take up height
- isOnlyButtons = false;
- }
- else {
- if ((customButtonProps = calendarCustomButtons[buttonName])) {
- buttonClick = function (ev) {
- if (customButtonProps.click) {
- customButtonProps.click.call(buttonEl[0], ev);
- }
- };
- (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) ||
- (buttonIcon = theme.getIconClass(buttonName)) ||
- (buttonText = customButtonProps.text);
- }
- else if ((viewSpec = viewSpecManager.getViewSpec(buttonName))) {
- _this.viewsWithButtons.push(buttonName);
- buttonClick = function () {
- calendar.changeView(buttonName);
- };
- (buttonText = viewSpec.buttonTextOverride) ||
- (buttonIcon = theme.getIconClass(buttonName)) ||
- (buttonText = viewSpec.buttonTextDefault);
- }
- else if (calendar[buttonName]) {
- buttonClick = function () {
- calendar[buttonName]();
- };
- (buttonText = calendarButtonTextOverrides[buttonName]) ||
- (buttonIcon = theme.getIconClass(buttonName)) ||
- (buttonText = calendarButtonText[buttonName]);
- // ^ everything else is considered default
- }
- if (buttonClick) {
- buttonClasses = [
- 'fc-' + buttonName + '-button',
- theme.getClass('button'),
- theme.getClass('stateDefault')
- ];
- if (buttonText) {
- buttonInnerHtml = util_1.htmlEscape(buttonText);
- buttonAriaAttr = '';
- }
- else if (buttonIcon) {
- buttonInnerHtml = "";
- buttonAriaAttr = ' aria-label="' + buttonName + '"';
- }
- buttonEl = $(// type="button" so that it doesn't submit a form
- '')
- .click(function (ev) {
- // don't process clicks for disabled buttons
- if (!buttonEl.hasClass(theme.getClass('stateDisabled'))) {
- buttonClick(ev);
- // after the click action, if the button becomes the "active" tab, or disabled,
- // it should never have a hover class, so remove it now.
- if (buttonEl.hasClass(theme.getClass('stateActive')) ||
- buttonEl.hasClass(theme.getClass('stateDisabled'))) {
- buttonEl.removeClass(theme.getClass('stateHover'));
- }
- }
- })
- .mousedown(function () {
- // the *down* effect (mouse pressed in).
- // only on buttons that are not the "active" tab, or disabled
- buttonEl
- .not('.' + theme.getClass('stateActive'))
- .not('.' + theme.getClass('stateDisabled'))
- .addClass(theme.getClass('stateDown'));
- })
- .mouseup(function () {
- // undo the *down* effect
- buttonEl.removeClass(theme.getClass('stateDown'));
- })
- .hover(function () {
- // the *hover* effect.
- // only on buttons that are not the "active" tab, or disabled
- buttonEl
- .not('.' + theme.getClass('stateActive'))
- .not('.' + theme.getClass('stateDisabled'))
- .addClass(theme.getClass('stateHover'));
- }, function () {
- // undo the *hover* effect
- buttonEl
- .removeClass(theme.getClass('stateHover'))
- .removeClass(theme.getClass('stateDown')); // if mouseleave happens before mouseup
- });
- groupChildren = groupChildren.add(buttonEl);
- }
- }
- });
- if (isOnlyButtons) {
- groupChildren
- .first().addClass(theme.getClass('cornerLeft')).end()
- .last().addClass(theme.getClass('cornerRight')).end();
- }
- if (groupChildren.length > 1) {
- groupEl = $('');
- if (isOnlyButtons) {
- groupEl.addClass(theme.getClass('buttonGroup'));
- }
- groupEl.append(groupChildren);
- sectionEl.append(groupEl);
- }
- else {
- sectionEl.append(groupChildren); // 1 or 0 children
- }
- });
- }
- return sectionEl;
- };
- Toolbar.prototype.updateTitle = function (text) {
- if (this.el) {
- this.el.find('h2').text(text);
- }
- };
- Toolbar.prototype.activateButton = function (buttonName) {
- if (this.el) {
- this.el.find('.fc-' + buttonName + '-button')
- .addClass(this.calendar.theme.getClass('stateActive'));
- }
- };
- Toolbar.prototype.deactivateButton = function (buttonName) {
- if (this.el) {
- this.el.find('.fc-' + buttonName + '-button')
- .removeClass(this.calendar.theme.getClass('stateActive'));
- }
- };
- Toolbar.prototype.disableButton = function (buttonName) {
- if (this.el) {
- this.el.find('.fc-' + buttonName + '-button')
- .prop('disabled', true)
- .addClass(this.calendar.theme.getClass('stateDisabled'));
- }
- };
- Toolbar.prototype.enableButton = function (buttonName) {
- if (this.el) {
- this.el.find('.fc-' + buttonName + '-button')
- .prop('disabled', false)
- .removeClass(this.calendar.theme.getClass('stateDisabled'));
- }
- };
- Toolbar.prototype.getViewsWithButtons = function () {
- return this.viewsWithButtons;
- };
- return Toolbar;
-}());
-exports.default = Toolbar;
-
-
/***/ }),
/* 240 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
-var $ = __webpack_require__(3);
var util_1 = __webpack_require__(4);
-var options_1 = __webpack_require__(32);
-var locale_1 = __webpack_require__(31);
-var Model_1 = __webpack_require__(48);
-var OptionsManager = /** @class */ (function (_super) {
- tslib_1.__extends(OptionsManager, _super);
- function OptionsManager(_calendar, overrides) {
- var _this = _super.call(this) || this;
- _this._calendar = _calendar;
- _this.overrides = $.extend({}, overrides); // make a copy
- _this.dynamicOverrides = {};
- _this.compute();
- return _this;
- }
- OptionsManager.prototype.add = function (newOptionHash) {
- var optionCnt = 0;
- var optionName;
- this.recordOverrides(newOptionHash); // will trigger this model's watchers
- for (optionName in newOptionHash) {
- optionCnt++;
- }
- // special-case handling of single option change.
- // if only one option change, `optionName` will be its name.
- if (optionCnt === 1) {
- if (optionName === 'height' || optionName === 'contentHeight' || optionName === 'aspectRatio') {
- this._calendar.updateViewSize(true); // isResize=true
- return;
- }
- else if (optionName === 'defaultDate') {
- return; // can't change date this way. use gotoDate instead
- }
- else if (optionName === 'businessHours') {
- return; // this model already reacts to this
- }
- else if (/^(event|select)(Overlap|Constraint|Allow)$/.test(optionName)) {
- return; // doesn't affect rendering. only interactions.
- }
- else if (optionName === 'timezone') {
- this._calendar.view.flash('initialEvents');
- return;
- }
- }
- // catch-all. rerender the header and footer and rebuild/rerender the current view
- this._calendar.renderHeader();
- this._calendar.renderFooter();
- // even non-current views will be affected by this option change. do before rerender
- // TODO: detangle
- this._calendar.viewsByType = {};
- this._calendar.reinitView();
- };
- // Computes the flattened options hash for the calendar and assigns to `this.options`.
- // Assumes this.overrides and this.dynamicOverrides have already been initialized.
- OptionsManager.prototype.compute = function () {
- var locale;
- var localeDefaults;
- var isRTL;
- var dirDefaults;
- var rawOptions;
- locale = util_1.firstDefined(// explicit locale option given?
- this.dynamicOverrides.locale, this.overrides.locale);
- localeDefaults = locale_1.localeOptionHash[locale];
- if (!localeDefaults) {
- locale = options_1.globalDefaults.locale;
- localeDefaults = locale_1.localeOptionHash[locale] || {};
- }
- isRTL = util_1.firstDefined(// based on options computed so far, is direction RTL?
- this.dynamicOverrides.isRTL, this.overrides.isRTL, localeDefaults.isRTL, options_1.globalDefaults.isRTL);
- dirDefaults = isRTL ? options_1.rtlDefaults : {};
- this.dirDefaults = dirDefaults;
- this.localeDefaults = localeDefaults;
- rawOptions = options_1.mergeOptions([
- options_1.globalDefaults,
- dirDefaults,
- localeDefaults,
- this.overrides,
- this.dynamicOverrides
- ]);
- locale_1.populateInstanceComputableOptions(rawOptions); // fill in gaps with computed options
- this.reset(rawOptions);
- };
- // stores the new options internally, but does not rerender anything.
- OptionsManager.prototype.recordOverrides = function (newOptionHash) {
- var optionName;
- for (optionName in newOptionHash) {
- this.dynamicOverrides[optionName] = newOptionHash[optionName];
- }
- this._calendar.viewSpecManager.clearCache(); // the dynamic override invalidates the options in this cache, so just clear it
- this.compute(); // this.options needs to be recomputed after the dynamic override
- };
- return OptionsManager;
-}(Model_1.default));
-exports.default = OptionsManager;
-
-
-/***/ }),
-/* 241 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var moment = __webpack_require__(0);
-var $ = __webpack_require__(3);
-var ViewRegistry_1 = __webpack_require__(22);
-var util_1 = __webpack_require__(4);
-var options_1 = __webpack_require__(32);
-var locale_1 = __webpack_require__(31);
-var ViewSpecManager = /** @class */ (function () {
- function ViewSpecManager(optionsManager, _calendar) {
- this.optionsManager = optionsManager;
- this._calendar = _calendar;
- this.clearCache();
- }
- ViewSpecManager.prototype.clearCache = function () {
- this.viewSpecCache = {};
- };
- // Gets information about how to create a view. Will use a cache.
- ViewSpecManager.prototype.getViewSpec = function (viewType) {
- var cache = this.viewSpecCache;
- return cache[viewType] || (cache[viewType] = this.buildViewSpec(viewType));
- };
- // Given a duration singular unit, like "week" or "day", finds a matching view spec.
- // Preference is given to views that have corresponding buttons.
- ViewSpecManager.prototype.getUnitViewSpec = function (unit) {
- var viewTypes;
- var i;
- var spec;
- if ($.inArray(unit, util_1.unitsDesc) !== -1) {
- // put views that have buttons first. there will be duplicates, but oh well
- viewTypes = this._calendar.header.getViewsWithButtons(); // TODO: include footer as well?
- $.each(ViewRegistry_1.viewHash, function (viewType) {
- viewTypes.push(viewType);
- });
- for (i = 0; i < viewTypes.length; i++) {
- spec = this.getViewSpec(viewTypes[i]);
- if (spec) {
- if (spec.singleUnit === unit) {
- return spec;
- }
- }
- }
- }
- };
- // Builds an object with information on how to create a given view
- ViewSpecManager.prototype.buildViewSpec = function (requestedViewType) {
- var viewOverrides = this.optionsManager.overrides.views || {};
- var specChain = []; // for the view. lowest to highest priority
- var defaultsChain = []; // for the view. lowest to highest priority
- var overridesChain = []; // for the view. lowest to highest priority
- var viewType = requestedViewType;
- var spec; // for the view
- var overrides; // for the view
- var durationInput;
- var duration;
- var unit;
- // iterate from the specific view definition to a more general one until we hit an actual View class
- while (viewType) {
- spec = ViewRegistry_1.viewHash[viewType];
- overrides = viewOverrides[viewType];
- viewType = null; // clear. might repopulate for another iteration
- if (typeof spec === 'function') {
- spec = { 'class': spec };
- }
- if (spec) {
- specChain.unshift(spec);
- defaultsChain.unshift(spec.defaults || {});
- durationInput = durationInput || spec.duration;
- viewType = viewType || spec.type;
- }
- if (overrides) {
- overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level
- durationInput = durationInput || overrides.duration;
- viewType = viewType || overrides.type;
- }
- }
- spec = util_1.mergeProps(specChain);
- spec.type = requestedViewType;
- if (!spec['class']) {
- return false;
- }
- // fall back to top-level `duration` option
- durationInput = durationInput ||
- this.optionsManager.dynamicOverrides.duration ||
- this.optionsManager.overrides.duration;
- if (durationInput) {
- duration = moment.duration(durationInput);
- if (duration.valueOf()) {
- unit = util_1.computeDurationGreatestUnit(duration, durationInput);
- spec.duration = duration;
- spec.durationUnit = unit;
- // view is a single-unit duration, like "week" or "day"
- // incorporate options for this. lowest priority
- if (duration.as(unit) === 1) {
- spec.singleUnit = unit;
- overridesChain.unshift(viewOverrides[unit] || {});
- }
- }
- }
- spec.defaults = options_1.mergeOptions(defaultsChain);
- spec.overrides = options_1.mergeOptions(overridesChain);
- this.buildViewSpecOptions(spec);
- this.buildViewSpecButtonText(spec, requestedViewType);
- return spec;
- };
- // Builds and assigns a view spec's options object from its already-assigned defaults and overrides
- ViewSpecManager.prototype.buildViewSpecOptions = function (spec) {
- var optionsManager = this.optionsManager;
- spec.options = options_1.mergeOptions([
- options_1.globalDefaults,
- spec.defaults,
- optionsManager.dirDefaults,
- optionsManager.localeDefaults,
- optionsManager.overrides,
- spec.overrides,
- optionsManager.dynamicOverrides // dynamically set via setter. highest precedence
- ]);
- locale_1.populateInstanceComputableOptions(spec.options);
- };
- // Computes and assigns a view spec's buttonText-related options
- ViewSpecManager.prototype.buildViewSpecButtonText = function (spec, requestedViewType) {
- var optionsManager = this.optionsManager;
- // given an options object with a possible `buttonText` hash, lookup the buttonText for the
- // requested view, falling back to a generic unit entry like "week" or "day"
- function queryButtonText(options) {
- var buttonText = options.buttonText || {};
- return buttonText[requestedViewType] ||
- // view can decide to look up a certain key
- (spec.buttonTextKey ? buttonText[spec.buttonTextKey] : null) ||
- // a key like "month"
- (spec.singleUnit ? buttonText[spec.singleUnit] : null);
- }
- // highest to lowest priority
- spec.buttonTextOverride =
- queryButtonText(optionsManager.dynamicOverrides) ||
- queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence
- spec.overrides.buttonText; // `buttonText` for view-specific options is a string
- // highest to lowest priority. mirrors buildViewSpecOptions
- spec.buttonTextDefault =
- queryButtonText(optionsManager.localeDefaults) ||
- queryButtonText(optionsManager.dirDefaults) ||
- spec.defaults.buttonText || // a single string. from ViewSubclass.defaults
- queryButtonText(options_1.globalDefaults) ||
- (spec.duration ? this._calendar.humanizeDuration(spec.duration) : null) || // like "3 days"
- requestedViewType; // fall back to given view name
- };
- return ViewSpecManager;
-}());
-exports.default = ViewSpecManager;
-
-
-/***/ }),
-/* 242 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var $ = __webpack_require__(3);
-var util_1 = __webpack_require__(4);
-var EventPeriod_1 = __webpack_require__(243);
-var ArrayEventSource_1 = __webpack_require__(52);
-var EventSource_1 = __webpack_require__(6);
-var EventSourceParser_1 = __webpack_require__(38);
-var SingleEventDef_1 = __webpack_require__(13);
-var EventInstanceGroup_1 = __webpack_require__(18);
-var EmitterMixin_1 = __webpack_require__(11);
-var ListenerMixin_1 = __webpack_require__(7);
-var EventManager = /** @class */ (function () {
- function EventManager(calendar) {
- this.calendar = calendar;
- this.stickySource = new ArrayEventSource_1.default(calendar);
- this.otherSources = [];
- }
- EventManager.prototype.requestEvents = function (start, end, timezone, force) {
- if (force ||
- !this.currentPeriod ||
- !this.currentPeriod.isWithinRange(start, end) ||
- timezone !== this.currentPeriod.timezone) {
- this.setPeriod(// will change this.currentPeriod
- new EventPeriod_1.default(start, end, timezone));
- }
- return this.currentPeriod.whenReleased();
- };
- // Source Adding/Removing
- // -----------------------------------------------------------------------------------------------------------------
- EventManager.prototype.addSource = function (eventSource) {
- this.otherSources.push(eventSource);
- if (this.currentPeriod) {
- this.currentPeriod.requestSource(eventSource); // might release
- }
- };
- EventManager.prototype.removeSource = function (doomedSource) {
- util_1.removeExact(this.otherSources, doomedSource);
- if (this.currentPeriod) {
- this.currentPeriod.purgeSource(doomedSource); // might release
- }
- };
- EventManager.prototype.removeAllSources = function () {
- this.otherSources = [];
- if (this.currentPeriod) {
- this.currentPeriod.purgeAllSources(); // might release
- }
- };
- // Source Refetching
- // -----------------------------------------------------------------------------------------------------------------
- EventManager.prototype.refetchSource = function (eventSource) {
- var currentPeriod = this.currentPeriod;
- if (currentPeriod) {
- currentPeriod.freeze();
- currentPeriod.purgeSource(eventSource);
- currentPeriod.requestSource(eventSource);
- currentPeriod.thaw();
- }
- };
- EventManager.prototype.refetchAllSources = function () {
- var currentPeriod = this.currentPeriod;
- if (currentPeriod) {
- currentPeriod.freeze();
- currentPeriod.purgeAllSources();
- currentPeriod.requestSources(this.getSources());
- currentPeriod.thaw();
- }
- };
- // Source Querying
- // -----------------------------------------------------------------------------------------------------------------
- EventManager.prototype.getSources = function () {
- return [this.stickySource].concat(this.otherSources);
- };
- // like querySources, but accepts multple match criteria (like multiple IDs)
- EventManager.prototype.multiQuerySources = function (matchInputs) {
- // coerce into an array
- if (!matchInputs) {
- matchInputs = [];
- }
- else if (!$.isArray(matchInputs)) {
- matchInputs = [matchInputs];
- }
- var matchingSources = [];
- var i;
- // resolve raw inputs to real event source objects
- for (i = 0; i < matchInputs.length; i++) {
- matchingSources.push.apply(// append
- matchingSources, this.querySources(matchInputs[i]));
- }
- return matchingSources;
- };
- // matchInput can either by a real event source object, an ID, or the function/URL for the source.
- // returns an array of matching source objects.
- EventManager.prototype.querySources = function (matchInput) {
- var sources = this.otherSources;
- var i;
- var source;
- // given a proper event source object
- for (i = 0; i < sources.length; i++) {
- source = sources[i];
- if (source === matchInput) {
- return [source];
- }
- }
- // an ID match
- source = this.getSourceById(EventSource_1.default.normalizeId(matchInput));
- if (source) {
- return [source];
- }
- // parse as an event source
- matchInput = EventSourceParser_1.default.parse(matchInput, this.calendar);
- if (matchInput) {
- return $.grep(sources, function (source) {
- return isSourcesEquivalent(matchInput, source);
- });
- }
- };
- /*
- ID assumed to already be normalized
- */
- EventManager.prototype.getSourceById = function (id) {
- return $.grep(this.otherSources, function (source) {
- return source.id && source.id === id;
- })[0];
- };
- // Event-Period
- // -----------------------------------------------------------------------------------------------------------------
- EventManager.prototype.setPeriod = function (eventPeriod) {
- if (this.currentPeriod) {
- this.unbindPeriod(this.currentPeriod);
- this.currentPeriod = null;
- }
- this.currentPeriod = eventPeriod;
- this.bindPeriod(eventPeriod);
- eventPeriod.requestSources(this.getSources());
- };
- EventManager.prototype.bindPeriod = function (eventPeriod) {
- this.listenTo(eventPeriod, 'release', function (eventsPayload) {
- this.trigger('release', eventsPayload);
- });
- };
- EventManager.prototype.unbindPeriod = function (eventPeriod) {
- this.stopListeningTo(eventPeriod);
- };
- // Event Getting/Adding/Removing
- // -----------------------------------------------------------------------------------------------------------------
- EventManager.prototype.getEventDefByUid = function (uid) {
- if (this.currentPeriod) {
- return this.currentPeriod.getEventDefByUid(uid);
- }
- };
- EventManager.prototype.addEventDef = function (eventDef, isSticky) {
- if (isSticky) {
- this.stickySource.addEventDef(eventDef);
- }
- if (this.currentPeriod) {
- this.currentPeriod.addEventDef(eventDef); // might release
- }
- };
- EventManager.prototype.removeEventDefsById = function (eventId) {
- this.getSources().forEach(function (eventSource) {
- eventSource.removeEventDefsById(eventId);
- });
- if (this.currentPeriod) {
- this.currentPeriod.removeEventDefsById(eventId); // might release
- }
- };
- EventManager.prototype.removeAllEventDefs = function () {
- this.getSources().forEach(function (eventSource) {
- eventSource.removeAllEventDefs();
- });
- if (this.currentPeriod) {
- this.currentPeriod.removeAllEventDefs();
- }
- };
- // Event Mutating
- // -----------------------------------------------------------------------------------------------------------------
- /*
- Returns an undo function.
- */
- EventManager.prototype.mutateEventsWithId = function (eventDefId, eventDefMutation) {
- var currentPeriod = this.currentPeriod;
- var eventDefs;
- var undoFuncs = [];
- if (currentPeriod) {
- currentPeriod.freeze();
- eventDefs = currentPeriod.getEventDefsById(eventDefId);
- eventDefs.forEach(function (eventDef) {
- // add/remove esp because id might change
- currentPeriod.removeEventDef(eventDef);
- undoFuncs.push(eventDefMutation.mutateSingle(eventDef));
- currentPeriod.addEventDef(eventDef);
- });
- currentPeriod.thaw();
- return function () {
- currentPeriod.freeze();
- for (var i = 0; i < eventDefs.length; i++) {
- currentPeriod.removeEventDef(eventDefs[i]);
- undoFuncs[i]();
- currentPeriod.addEventDef(eventDefs[i]);
- }
- currentPeriod.thaw();
- };
- }
- return function () { };
- };
- /*
- copies and then mutates
- */
- EventManager.prototype.buildMutatedEventInstanceGroup = function (eventDefId, eventDefMutation) {
- var eventDefs = this.getEventDefsById(eventDefId);
- var i;
- var defCopy;
- var allInstances = [];
- for (i = 0; i < eventDefs.length; i++) {
- defCopy = eventDefs[i].clone();
- if (defCopy instanceof SingleEventDef_1.default) {
- eventDefMutation.mutateSingle(defCopy);
- allInstances.push.apply(allInstances, // append
- defCopy.buildInstances());
- }
- }
- return new EventInstanceGroup_1.default(allInstances);
- };
- // Freezing
- // -----------------------------------------------------------------------------------------------------------------
- EventManager.prototype.freeze = function () {
- if (this.currentPeriod) {
- this.currentPeriod.freeze();
- }
- };
- EventManager.prototype.thaw = function () {
- if (this.currentPeriod) {
- this.currentPeriod.thaw();
- }
- };
- // methods that simply forward to EventPeriod
- EventManager.prototype.getEventDefsById = function (eventDefId) {
- return this.currentPeriod.getEventDefsById(eventDefId);
- };
- EventManager.prototype.getEventInstances = function () {
- return this.currentPeriod.getEventInstances();
- };
- EventManager.prototype.getEventInstancesWithId = function (eventDefId) {
- return this.currentPeriod.getEventInstancesWithId(eventDefId);
- };
- EventManager.prototype.getEventInstancesWithoutId = function (eventDefId) {
- return this.currentPeriod.getEventInstancesWithoutId(eventDefId);
- };
- return EventManager;
-}());
-exports.default = EventManager;
-EmitterMixin_1.default.mixInto(EventManager);
-ListenerMixin_1.default.mixInto(EventManager);
-function isSourcesEquivalent(source0, source1) {
- return source0.getPrimitive() === source1.getPrimitive();
-}
-
-
-/***/ }),
-/* 243 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var $ = __webpack_require__(3);
-var util_1 = __webpack_require__(4);
-var Promise_1 = __webpack_require__(20);
-var EmitterMixin_1 = __webpack_require__(11);
-var UnzonedRange_1 = __webpack_require__(5);
-var EventInstanceGroup_1 = __webpack_require__(18);
-var EventPeriod = /** @class */ (function () {
- function EventPeriod(start, end, timezone) {
- this.pendingCnt = 0;
- this.freezeDepth = 0;
- this.stuntedReleaseCnt = 0;
- this.releaseCnt = 0;
- this.start = start;
- this.end = end;
- this.timezone = timezone;
- this.unzonedRange = new UnzonedRange_1.default(start.clone().stripZone(), end.clone().stripZone());
- this.requestsByUid = {};
- this.eventDefsByUid = {};
- this.eventDefsById = {};
- this.eventInstanceGroupsById = {};
- }
- EventPeriod.prototype.isWithinRange = function (start, end) {
- // TODO: use a range util function?
- return !start.isBefore(this.start) && !end.isAfter(this.end);
- };
- // Requesting and Purging
- // -----------------------------------------------------------------------------------------------------------------
- EventPeriod.prototype.requestSources = function (sources) {
- this.freeze();
- for (var i = 0; i < sources.length; i++) {
- this.requestSource(sources[i]);
- }
- this.thaw();
- };
- EventPeriod.prototype.requestSource = function (source) {
- var _this = this;
- var request = { source: source, status: 'pending', eventDefs: null };
- this.requestsByUid[source.uid] = request;
- this.pendingCnt += 1;
- source.fetch(this.start, this.end, this.timezone).then(function (eventDefs) {
- if (request.status !== 'cancelled') {
- request.status = 'completed';
- request.eventDefs = eventDefs;
- _this.addEventDefs(eventDefs);
- _this.pendingCnt--;
- _this.tryRelease();
- }
- }, function () {
- if (request.status !== 'cancelled') {
- request.status = 'failed';
- _this.pendingCnt--;
- _this.tryRelease();
- }
- });
- };
- EventPeriod.prototype.purgeSource = function (source) {
- var request = this.requestsByUid[source.uid];
- if (request) {
- delete this.requestsByUid[source.uid];
- if (request.status === 'pending') {
- request.status = 'cancelled';
- this.pendingCnt--;
- this.tryRelease();
- }
- else if (request.status === 'completed') {
- request.eventDefs.forEach(this.removeEventDef.bind(this));
- }
- }
- };
- EventPeriod.prototype.purgeAllSources = function () {
- var requestsByUid = this.requestsByUid;
- var uid;
- var request;
- var completedCnt = 0;
- for (uid in requestsByUid) {
- request = requestsByUid[uid];
- if (request.status === 'pending') {
- request.status = 'cancelled';
- }
- else if (request.status === 'completed') {
- completedCnt++;
- }
- }
- this.requestsByUid = {};
- this.pendingCnt = 0;
- if (completedCnt) {
- this.removeAllEventDefs(); // might release
- }
- };
- // Event Definitions
- // -----------------------------------------------------------------------------------------------------------------
- EventPeriod.prototype.getEventDefByUid = function (eventDefUid) {
- return this.eventDefsByUid[eventDefUid];
- };
- EventPeriod.prototype.getEventDefsById = function (eventDefId) {
- var a = this.eventDefsById[eventDefId];
- if (a) {
- return a.slice(); // clone
- }
- return [];
- };
- EventPeriod.prototype.addEventDefs = function (eventDefs) {
- for (var i = 0; i < eventDefs.length; i++) {
- this.addEventDef(eventDefs[i]);
- }
- };
- EventPeriod.prototype.addEventDef = function (eventDef) {
- var eventDefsById = this.eventDefsById;
- var eventDefId = eventDef.id;
- var eventDefs = eventDefsById[eventDefId] || (eventDefsById[eventDefId] = []);
- var eventInstances = eventDef.buildInstances(this.unzonedRange);
- var i;
- eventDefs.push(eventDef);
- this.eventDefsByUid[eventDef.uid] = eventDef;
- for (i = 0; i < eventInstances.length; i++) {
- this.addEventInstance(eventInstances[i], eventDefId);
- }
- };
- EventPeriod.prototype.removeEventDefsById = function (eventDefId) {
- var _this = this;
- this.getEventDefsById(eventDefId).forEach(function (eventDef) {
- _this.removeEventDef(eventDef);
- });
- };
- EventPeriod.prototype.removeAllEventDefs = function () {
- var isEmpty = $.isEmptyObject(this.eventDefsByUid);
- this.eventDefsByUid = {};
- this.eventDefsById = {};
- this.eventInstanceGroupsById = {};
- if (!isEmpty) {
- this.tryRelease();
- }
- };
- EventPeriod.prototype.removeEventDef = function (eventDef) {
- var eventDefsById = this.eventDefsById;
- var eventDefs = eventDefsById[eventDef.id];
- delete this.eventDefsByUid[eventDef.uid];
- if (eventDefs) {
- util_1.removeExact(eventDefs, eventDef);
- if (!eventDefs.length) {
- delete eventDefsById[eventDef.id];
- }
- this.removeEventInstancesForDef(eventDef);
- }
- };
- // Event Instances
- // -----------------------------------------------------------------------------------------------------------------
- EventPeriod.prototype.getEventInstances = function () {
- var eventInstanceGroupsById = this.eventInstanceGroupsById;
- var eventInstances = [];
- var id;
- for (id in eventInstanceGroupsById) {
- eventInstances.push.apply(eventInstances, // append
- eventInstanceGroupsById[id].eventInstances);
- }
- return eventInstances;
- };
- EventPeriod.prototype.getEventInstancesWithId = function (eventDefId) {
- var eventInstanceGroup = this.eventInstanceGroupsById[eventDefId];
- if (eventInstanceGroup) {
- return eventInstanceGroup.eventInstances.slice(); // clone
- }
- return [];
- };
- EventPeriod.prototype.getEventInstancesWithoutId = function (eventDefId) {
- var eventInstanceGroupsById = this.eventInstanceGroupsById;
- var matchingInstances = [];
- var id;
- for (id in eventInstanceGroupsById) {
- if (id !== eventDefId) {
- matchingInstances.push.apply(matchingInstances, // append
- eventInstanceGroupsById[id].eventInstances);
- }
- }
- return matchingInstances;
- };
- EventPeriod.prototype.addEventInstance = function (eventInstance, eventDefId) {
- var eventInstanceGroupsById = this.eventInstanceGroupsById;
- var eventInstanceGroup = eventInstanceGroupsById[eventDefId] ||
- (eventInstanceGroupsById[eventDefId] = new EventInstanceGroup_1.default());
- eventInstanceGroup.eventInstances.push(eventInstance);
- this.tryRelease();
- };
- EventPeriod.prototype.removeEventInstancesForDef = function (eventDef) {
- var eventInstanceGroupsById = this.eventInstanceGroupsById;
- var eventInstanceGroup = eventInstanceGroupsById[eventDef.id];
- var removeCnt;
- if (eventInstanceGroup) {
- removeCnt = util_1.removeMatching(eventInstanceGroup.eventInstances, function (currentEventInstance) {
- return currentEventInstance.def === eventDef;
- });
- if (!eventInstanceGroup.eventInstances.length) {
- delete eventInstanceGroupsById[eventDef.id];
- }
- if (removeCnt) {
- this.tryRelease();
- }
- }
- };
- // Releasing and Freezing
- // -----------------------------------------------------------------------------------------------------------------
- EventPeriod.prototype.tryRelease = function () {
- if (!this.pendingCnt) {
- if (!this.freezeDepth) {
- this.release();
- }
- else {
- this.stuntedReleaseCnt++;
- }
- }
- };
- EventPeriod.prototype.release = function () {
- this.releaseCnt++;
- this.trigger('release', this.eventInstanceGroupsById);
- };
- EventPeriod.prototype.whenReleased = function () {
- var _this = this;
- if (this.releaseCnt) {
- return Promise_1.default.resolve(this.eventInstanceGroupsById);
- }
- else {
- return Promise_1.default.construct(function (onResolve) {
- _this.one('release', onResolve);
- });
- }
- };
- EventPeriod.prototype.freeze = function () {
- if (!(this.freezeDepth++)) {
- this.stuntedReleaseCnt = 0;
- }
- };
- EventPeriod.prototype.thaw = function () {
- if (!(--this.freezeDepth) && this.stuntedReleaseCnt && !this.pendingCnt) {
- this.release();
- }
- };
- return EventPeriod;
-}());
-exports.default = EventPeriod;
-EmitterMixin_1.default.mixInto(EventPeriod);
-
-
-/***/ }),
-/* 244 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var $ = __webpack_require__(3);
-var util_1 = __webpack_require__(4);
-var ListenerMixin_1 = __webpack_require__(7);
-/* Creates a clone of an element and lets it track the mouse as it moves
-----------------------------------------------------------------------------------------------------------------------*/
-var MouseFollower = /** @class */ (function () {
- function MouseFollower(sourceEl, options) {
- this.isFollowing = false;
- this.isHidden = false;
- this.isAnimating = false; // doing the revert animation?
- this.options = options = options || {};
- this.sourceEl = sourceEl;
- this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent
- }
- // Causes the element to start following the mouse
- MouseFollower.prototype.start = function (ev) {
- if (!this.isFollowing) {
- this.isFollowing = true;
- this.y0 = util_1.getEvY(ev);
- this.x0 = util_1.getEvX(ev);
- this.topDelta = 0;
- this.leftDelta = 0;
- if (!this.isHidden) {
- this.updatePosition();
- }
- if (util_1.getEvIsTouch(ev)) {
- this.listenTo($(document), 'touchmove', this.handleMove);
- }
- else {
- this.listenTo($(document), 'mousemove', this.handleMove);
- }
- }
- };
- // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position.
- // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately.
- MouseFollower.prototype.stop = function (shouldRevert, callback) {
- var _this = this;
- var revertDuration = this.options.revertDuration;
- var complete = function () {
- _this.isAnimating = false;
- _this.removeElement();
- _this.top0 = _this.left0 = null; // reset state for future updatePosition calls
- if (callback) {
- callback();
- }
- };
- if (this.isFollowing && !this.isAnimating) {
- this.isFollowing = false;
- this.stopListeningTo($(document));
- if (shouldRevert && revertDuration && !this.isHidden) {
- this.isAnimating = true;
- this.el.animate({
- top: this.top0,
- left: this.left0
- }, {
- duration: revertDuration,
- complete: complete
- });
- }
- else {
- complete();
- }
- }
- };
- // Gets the tracking element. Create it if necessary
- MouseFollower.prototype.getEl = function () {
- var el = this.el;
- if (!el) {
- el = this.el = this.sourceEl.clone()
- .addClass(this.options.additionalClass || '')
- .css({
- position: 'absolute',
- visibility: '',
- display: this.isHidden ? 'none' : '',
- margin: 0,
- right: 'auto',
- bottom: 'auto',
- width: this.sourceEl.width(),
- height: this.sourceEl.height(),
- opacity: this.options.opacity || '',
- zIndex: this.options.zIndex
- });
- // we don't want long taps or any mouse interaction causing selection/menus.
- // would use preventSelection(), but that prevents selectstart, causing problems.
- el.addClass('fc-unselectable');
- el.appendTo(this.parentEl);
- }
- return el;
- };
- // Removes the tracking element if it has already been created
- MouseFollower.prototype.removeElement = function () {
- if (this.el) {
- this.el.remove();
- this.el = null;
- }
- };
- // Update the CSS position of the tracking element
- MouseFollower.prototype.updatePosition = function () {
- var sourceOffset;
- var origin;
- this.getEl(); // ensure this.el
- // make sure origin info was computed
- if (this.top0 == null) {
- sourceOffset = this.sourceEl.offset();
- origin = this.el.offsetParent().offset();
- this.top0 = sourceOffset.top - origin.top;
- this.left0 = sourceOffset.left - origin.left;
- }
- this.el.css({
- top: this.top0 + this.topDelta,
- left: this.left0 + this.leftDelta
- });
- };
- // Gets called when the user moves the mouse
- MouseFollower.prototype.handleMove = function (ev) {
- this.topDelta = util_1.getEvY(ev) - this.y0;
- this.leftDelta = util_1.getEvX(ev) - this.x0;
- if (!this.isHidden) {
- this.updatePosition();
- }
- };
- // Temporarily makes the tracking element invisible. Can be called before following starts
- MouseFollower.prototype.hide = function () {
- if (!this.isHidden) {
- this.isHidden = true;
- if (this.el) {
- this.el.hide();
- }
- }
- };
- // Show the tracking element after it has been temporarily hidden
- MouseFollower.prototype.show = function () {
- if (this.isHidden) {
- this.isHidden = false;
- this.updatePosition();
- this.getEl().show();
- }
- };
- return MouseFollower;
-}());
-exports.default = MouseFollower;
-ListenerMixin_1.default.mixInto(MouseFollower);
-
-
-/***/ }),
-/* 245 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var tslib_1 = __webpack_require__(2);
-var HitDragListener_1 = __webpack_require__(23);
-var Interaction_1 = __webpack_require__(15);
-var DateClicking = /** @class */ (function (_super) {
- tslib_1.__extends(DateClicking, _super);
- /*
- component must implement:
- - bindDateHandlerToEl
- - getSafeHitFootprint
- - getHitEl
- */
- function DateClicking(component) {
- var _this = _super.call(this, component) || this;
- _this.dragListener = _this.buildDragListener();
- return _this;
- }
- DateClicking.prototype.end = function () {
- this.dragListener.endInteraction();
- };
- DateClicking.prototype.bindToEl = function (el) {
- var component = this.component;
- var dragListener = this.dragListener;
- component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
- if (!component.shouldIgnoreMouse()) {
- dragListener.startInteraction(ev);
- }
- });
- component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
- if (!component.shouldIgnoreTouch()) {
- dragListener.startInteraction(ev);
- }
- });
- };
- // Creates a listener that tracks the user's drag across day elements, for day clicking.
- DateClicking.prototype.buildDragListener = function () {
- var _this = this;
- var component = this.component;
- var dayClickHit; // null if invalid dayClick
- var dragListener = new HitDragListener_1.default(component, {
- scroll: this.opt('dragScroll'),
- interactionStart: function () {
- dayClickHit = dragListener.origHit;
- },
- hitOver: function (hit, isOrig, origHit) {
- // if user dragged to another cell at any point, it can no longer be a dayClick
- if (!isOrig) {
- dayClickHit = null;
- }
- },
- hitOut: function () {
- dayClickHit = null;
- },
- interactionEnd: function (ev, isCancelled) {
- var componentFootprint;
- if (!isCancelled && dayClickHit) {
- componentFootprint = component.getSafeHitFootprint(dayClickHit);
- if (componentFootprint) {
- _this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev);
- }
- }
- }
- });
- // because dragListener won't be called with any time delay, "dragging" will begin immediately,
- // which will kill any touchmoving/scrolling. Prevent this.
- dragListener.shouldCancelTouchScroll = false;
- dragListener.scrollAlwaysKills = true;
- return dragListener;
- };
- return DateClicking;
-}(Interaction_1.default));
-exports.default = DateClicking;
-
-
-/***/ }),
-/* 246 */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-var tslib_1 = __webpack_require__(2);
-var util_1 = __webpack_require__(4);
-var EventRenderer_1 = __webpack_require__(42);
+var EventRenderer_1 = __webpack_require__(44);
/*
Only handles foreground segs.
Does not own rendering. Use for low-level util methods by TimeGrid.
@@ -13759,7 +13296,7 @@ var TimeGridEventRenderer = /** @class */ (function (_super) {
this.timeGrid.attachSegsByCol(segsByCol, containerEls);
};
TimeGridEventRenderer.prototype.unrenderFgSegs = function () {
- if (this.fgSegs) {
+ if (this.fgSegs) { // hack
this.fgSegs.forEach(function (seg) {
seg.el.remove();
});
@@ -13831,15 +13368,15 @@ var TimeGridEventRenderer = /** @class */ (function (_super) {
'
' :
'') +
'
' +
- '' +
+ '' +
/* TODO: write CSS for this
(isResizableFromStart ?
- '' :
+ '' :
''
) +
*/
(isResizableFromEnd ?
- '' :
+ '' :
'') +
'';
};
@@ -13880,7 +13417,7 @@ var TimeGridEventRenderer = /** @class */ (function (_super) {
TimeGridEventRenderer.prototype.computeFgSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {
var forwardSegs = seg.forwardSegs;
var i;
- if (seg.forwardCoord === undefined) {
+ if (seg.forwardCoord === undefined) { // not already computed
if (!forwardSegs.length) {
// if there are no forward segments, this segment should butt up against the edge
seg.forwardCoord = 1;
@@ -13924,9 +13461,10 @@ var TimeGridEventRenderer = /** @class */ (function (_super) {
for (i = 0; i < segs.length; i++) {
seg = segs[i];
seg.el.css(this.generateFgSegHorizontalCss(seg));
- // if the height is short, add a className for alternate styling
- if (seg.bottom - seg.top < 30) {
- seg.el.addClass('fc-short');
+ // if the event is short that the title will be cut off,
+ // attach a className that condenses the title into the time area.
+ if (seg.footprint.eventDef.title && seg.bottom - seg.top < 30) {
+ seg.el.addClass('fc-short'); // TODO: "condensed" is a better name
}
}
};
@@ -14010,7 +13548,7 @@ function computeSlotSegPressures(seg) {
var forwardPressure = 0;
var i;
var forwardSeg;
- if (seg.forwardPressure === undefined) {
+ if (seg.forwardPressure === undefined) { // not already computed
for (i = 0; i < forwardSegs.length; i++) {
forwardSeg = forwardSegs[i];
// figure out the child's maximum forward path
@@ -14040,13 +13578,13 @@ function isSlotSegCollision(seg1, seg2) {
/***/ }),
-/* 247 */
+/* 241 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
-var HelperRenderer_1 = __webpack_require__(58);
+var HelperRenderer_1 = __webpack_require__(63);
var TimeGridHelperRenderer = /** @class */ (function (_super) {
tslib_1.__extends(TimeGridHelperRenderer, _super);
function TimeGridHelperRenderer() {
@@ -14081,12 +13619,12 @@ exports.default = TimeGridHelperRenderer;
/***/ }),
-/* 248 */
+/* 242 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
-var FillRenderer_1 = __webpack_require__(57);
+var FillRenderer_1 = __webpack_require__(62);
var TimeGridFillRenderer = /** @class */ (function (_super) {
tslib_1.__extends(TimeGridFillRenderer, _super);
function TimeGridFillRenderer() {
@@ -14117,161 +13655,14 @@ exports.default = TimeGridFillRenderer;
/***/ }),
-/* 249 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/* A rectangular panel that is absolutely positioned over other content
-------------------------------------------------------------------------------------------------------------------------
-Options:
- - className (string)
- - content (HTML string or jQuery element set)
- - parentEl
- - top
- - left
- - right (the x coord of where the right edge should be. not a "CSS" right)
- - autoHide (boolean)
- - show (callback)
- - hide (callback)
-*/
-Object.defineProperty(exports, "__esModule", { value: true });
-var $ = __webpack_require__(3);
-var util_1 = __webpack_require__(4);
-var ListenerMixin_1 = __webpack_require__(7);
-var Popover = /** @class */ (function () {
- function Popover(options) {
- this.isHidden = true;
- this.margin = 10; // the space required between the popover and the edges of the scroll container
- this.options = options || {};
- }
- // Shows the popover on the specified position. Renders it if not already
- Popover.prototype.show = function () {
- if (this.isHidden) {
- if (!this.el) {
- this.render();
- }
- this.el.show();
- this.position();
- this.isHidden = false;
- this.trigger('show');
- }
- };
- // Hides the popover, through CSS, but does not remove it from the DOM
- Popover.prototype.hide = function () {
- if (!this.isHidden) {
- this.el.hide();
- this.isHidden = true;
- this.trigger('hide');
- }
- };
- // Creates `this.el` and renders content inside of it
- Popover.prototype.render = function () {
- var _this = this;
- var options = this.options;
- this.el = $('')
- .addClass(options.className || '')
- .css({
- // position initially to the top left to avoid creating scrollbars
- top: 0,
- left: 0
- })
- .append(options.content)
- .appendTo(options.parentEl);
- // when a click happens on anything inside with a 'fc-close' className, hide the popover
- this.el.on('click', '.fc-close', function () {
- _this.hide();
- });
- if (options.autoHide) {
- this.listenTo($(document), 'mousedown', this.documentMousedown);
- }
- };
- // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
- Popover.prototype.documentMousedown = function (ev) {
- // only hide the popover if the click happened outside the popover
- if (this.el && !$(ev.target).closest(this.el).length) {
- this.hide();
- }
- };
- // Hides and unregisters any handlers
- Popover.prototype.removeElement = function () {
- this.hide();
- if (this.el) {
- this.el.remove();
- this.el = null;
- }
- this.stopListeningTo($(document), 'mousedown');
- };
- // Positions the popover optimally, using the top/left/right options
- Popover.prototype.position = function () {
- var options = this.options;
- var origin = this.el.offsetParent().offset();
- var width = this.el.outerWidth();
- var height = this.el.outerHeight();
- var windowEl = $(window);
- var viewportEl = util_1.getScrollParent(this.el);
- var viewportTop;
- var viewportLeft;
- var viewportOffset;
- var top; // the "position" (not "offset") values for the popover
- var left; //
- // compute top and left
- top = options.top || 0;
- if (options.left !== undefined) {
- left = options.left;
- }
- else if (options.right !== undefined) {
- left = options.right - width; // derive the left value from the right value
- }
- else {
- left = 0;
- }
- if (viewportEl.is(window) || viewportEl.is(document)) {
- viewportEl = windowEl;
- viewportTop = 0; // the window is always at the top left
- viewportLeft = 0; // (and .offset() won't work if called here)
- }
- else {
- viewportOffset = viewportEl.offset();
- viewportTop = viewportOffset.top;
- viewportLeft = viewportOffset.left;
- }
- // if the window is scrolled, it causes the visible area to be further down
- viewportTop += windowEl.scrollTop();
- viewportLeft += windowEl.scrollLeft();
- // constrain to the view port. if constrained by two edges, give precedence to top/left
- if (options.viewportConstrain !== false) {
- top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin);
- top = Math.max(top, viewportTop + this.margin);
- left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin);
- left = Math.max(left, viewportLeft + this.margin);
- }
- this.el.css({
- top: top - origin.top,
- left: left - origin.left
- });
- };
- // Triggers a callback. Calls a function in the option hash of the same name.
- // Arguments beyond the first `name` are forwarded on.
- // TODO: better code reuse for this. Repeat code
- Popover.prototype.trigger = function (name) {
- if (this.options[name]) {
- this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
- }
- };
- return Popover;
-}());
-exports.default = Popover;
-ListenerMixin_1.default.mixInto(Popover);
-
-
-/***/ }),
-/* 250 */
+/* 243 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var util_1 = __webpack_require__(4);
-var EventRenderer_1 = __webpack_require__(42);
+var EventRenderer_1 = __webpack_require__(44);
/* Event-rendering methods for the DayGrid class
----------------------------------------------------------------------------------------------------------------------*/
var DayGridEventRenderer = /** @class */ (function (_super) {
@@ -14326,7 +13717,7 @@ var DayGridEventRenderer = /** @class */ (function (_super) {
var colCnt = this.dayGrid.colCnt;
var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
- var tbody = $('');
+ var tbody = $('');
var segMatrix = []; // lookup for which segments are rendered into which level+col cells
var cellMatrix = []; // lookup for all
elements of the level+col matrix
var loneCellMatrix = []; // lookup for
elements that only take up a single column
@@ -14346,7 +13737,7 @@ var DayGridEventRenderer = /** @class */ (function (_super) {
td.attr('rowspan', parseInt(td.attr('rowspan') || 1, 10) + 1);
}
else {
- td = $('
');
+ td = $('
');
tr.append(td);
}
cellMatrix[i][col] = td;
@@ -14354,25 +13745,25 @@ var DayGridEventRenderer = /** @class */ (function (_super) {
col++;
}
}
- for (i = 0; i < levelCnt; i++) {
+ for (i = 0; i < levelCnt; i++) { // iterate through all levels
levelSegs = segLevels[i];
col = 0;
- tr = $('
');
+ tr = $('
');
segMatrix.push([]);
cellMatrix.push([]);
loneCellMatrix.push([]);
// levelCnt might be 1 even though there are no actual levels. protect against this.
// this single empty row is useful for styling.
if (levelSegs) {
- for (j = 0; j < levelSegs.length; j++) {
+ for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level
seg = levelSegs[j];
emptyCellsUntil(seg.leftCol);
// create a container that occupies or more columns. append the event element.
- td = $('
').append(seg.el);
+ td = $('
').append(seg.el);
if (seg.leftCol !== seg.rightCol) {
td.attr('colspan', seg.rightCol - seg.leftCol + 1);
}
- else {
+ else { // a single-column segment
loneCellMatrix[i][col] = td;
}
while (col <= seg.rightCol) {
@@ -14487,10 +13878,10 @@ var DayGridEventRenderer = /** @class */ (function (_super) {
) +
'' +
(isResizableFromStart ?
- '' :
+ '' :
'') +
(isResizableFromEnd ?
- '' :
+ '' :
'') +
'';
};
@@ -14517,13 +13908,13 @@ function compareDaySegCols(a, b) {
/***/ }),
-/* 251 */
+/* 244 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
-var HelperRenderer_1 = __webpack_require__(58);
+var HelperRenderer_1 = __webpack_require__(63);
var DayGridHelperRenderer = /** @class */ (function (_super) {
tslib_1.__extends(DayGridHelperRenderer, _super);
function DayGridHelperRenderer() {
@@ -14538,7 +13929,7 @@ var DayGridHelperRenderer = /** @class */ (function (_super) {
// inject each new event skeleton into each associated row
this.component.rowEls.each(function (row, rowNode) {
var rowEl = $(rowNode); // the .fc-row
- var skeletonEl = $('
'); // will be absolutely positioned
+ var skeletonEl = $('
'); // will be absolutely positioned
var skeletonTopEl;
var skeletonTop;
// If there is an original segment, match the top position. Otherwise, put it at the row's top level
@@ -14547,7 +13938,7 @@ var DayGridHelperRenderer = /** @class */ (function (_super) {
}
else {
skeletonTopEl = rowEl.find('.fc-content-skeleton tbody');
- if (!skeletonTopEl.length) {
+ if (!skeletonTopEl.length) { // when no events
skeletonTopEl = rowEl.find('.fc-content-skeleton table');
}
skeletonTop = skeletonTopEl.position().top;
@@ -14566,13 +13957,13 @@ exports.default = DayGridHelperRenderer;
/***/ }),
-/* 252 */
+/* 245 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
-var FillRenderer_1 = __webpack_require__(57);
+var FillRenderer_1 = __webpack_require__(62);
var DayGridFillRenderer = /** @class */ (function (_super) {
tslib_1.__extends(DayGridFillRenderer, _super);
function DayGridFillRenderer() {
@@ -14608,15 +13999,19 @@ var DayGridFillRenderer = /** @class */ (function (_super) {
className = type.toLowerCase();
}
skeletonEl = $('
');
+ };
+ // render the event segments in the view
+ ListView.prototype.renderSegList = function (allSegs) {
+ var segsByDay = this.groupSegsByDay(allSegs); // sparse array
+ var dayIndex;
+ var daySegs;
+ var i;
+ var tableEl = $('
');
+ var tbodyEl = tableEl.find('tbody');
+ for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
+ daySegs = segsByDay[dayIndex];
+ if (daySegs) { // sparse array, so might be undefined
+ // append a day header
+ tbodyEl.append(this.dayHeaderHtml(this.dayDates[dayIndex]));
+ this.eventRenderer.sortEventSegs(daySegs);
+ for (i = 0; i < daySegs.length; i++) {
+ tbodyEl.append(daySegs[i].el); // append event row
+ }
+ }
+ }
+ this.contentEl.empty().append(tableEl);
+ };
+ // Returns a sparse array of arrays, segs grouped by their dayIndex
+ ListView.prototype.groupSegsByDay = function (segs) {
+ var segsByDay = []; // sparse array
+ var i;
+ var seg;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
+ .push(seg);
+ }
+ return segsByDay;
+ };
+ // generates the HTML for the day headers that live amongst the event rows
+ ListView.prototype.dayHeaderHtml = function (dayDate) {
+ var mainFormat = this.opt('listDayFormat');
+ var altFormat = this.opt('listDayAltFormat');
+ return '