=0&&g=0&&uo.layer)||(f.rect.left+=c,f.rect.right+=c,f.rect.top+=d,f.rect.bottom+=d,o=f)}}}return o},e}();function S(e,n){return!e&&!n||Boolean(e)===Boolean(n)&&t.isDateSpansEqual(e.dateSpan,n.dateSpan)}var y=function(e){function n(n){var r=e.call(this,n)||this;r.handlePointerDown=function(e){var t=r.dragging;t.setIgnoreMove(!r.component.isValidDateDownEl(t.pointer.downEl))},r.handleDragEnd=function(e){var t=r.component.context,n=t.calendar,i=t.view;if(!r.dragging.pointer.wasTouchScroll){var o=r.hitDragging,a=o.initialHit,l=o.finalHit;a&&l&&S(a,l)&&n.triggerDateClick(a.dateSpan,a.dayEl,i,e.origEvent)}};var i=n.component;r.dragging=new f(i.el),r.dragging.autoScroller.isEnabled=!1;var o=r.hitDragging=new m(r.dragging,t.interactionSettingsToStore(n));return o.emitter.on("pointerdown",r.handlePointerDown),o.emitter.on("dragend",r.handleDragEnd),r}return r(n,e),n.prototype.destroy=function(){this.dragging.destroy()},n}(t.Interaction),D=function(e){function n(n){var r=e.call(this,n)||this;r.dragSelection=null,r.handlePointerDown=function(e){var t=r,n=t.component,i=t.dragging,o=n.context.options.selectable&&n.isValidDateDownEl(e.origEvent.target);i.setIgnoreMove(!o),i.delay=e.isTouch?function(e){var t=e.context.options,n=t.selectLongPressDelay;null==n&&(n=t.longPressDelay);return n}(n):null},r.handleDragStart=function(e){r.component.context.calendar.unselect(e)},r.handleHitUpdate=function(e,n){var o=r.component.context.calendar,a=null,l=!1;e&&((a=function(e,n,r){var o=e.dateSpan,a=n.dateSpan,l=[o.range.start,o.range.end,a.range.start,a.range.end];l.sort(t.compareNumbers);for(var s={},c=0,d=r;co.start)return g.endDelta=d,g;return null}(s,e,o.subjectEl.classList.contains("fc-start-resizer"),c.range,a.pluginSystem.hooks.eventResizeJoinTransforms)),d&&(g=t.applyMutationToEventStore(l,a.eventUiBases,d,a),h.mutatedEvents=g,r.component.isInteractionValid(h)||(u=!0,d=null,g=null,h.mutatedEvents=null)),g?a.dispatch({type:"SET_EVENT_RESIZE",state:h}):a.dispatch({type:"UNSET_EVENT_RESIZE"}),u?t.disableCursor():t.enableCursor(),n||(d&&S(s,e)&&(d=null),r.validMutation=d,r.mutatedRelevantEvents=g)},r.handleDragEnd=function(e){var n=r.component.context,i=n.calendar,o=n.view,a=r.eventRange.def,l=r.eventRange.instance,s=new t.EventApi(i,a,l),c=r.relevantEvents,d=r.mutatedRelevantEvents;i.publiclyTrigger("eventResizeStop",[{el:r.draggingSeg.el,event:s,jsEvent:e.origEvent,view:o}]),r.validMutation?(i.dispatch({type:"MERGE_EVENTS",eventStore:d}),i.publiclyTrigger("eventResize",[{el:r.draggingSeg.el,startDelta:r.validMutation.startDelta||t.createDuration(0),endDelta:r.validMutation.endDelta||t.createDuration(0),prevEvent:s,event:new t.EventApi(i,d.defs[a.defId],l?d.instances[l.instanceId]:null),revert:function(){i.dispatch({type:"MERGE_EVENTS",eventStore:c})},jsEvent:e.origEvent,view:o}])):i.publiclyTrigger("_noEventResize"),r.draggingSeg=null,r.relevantEvents=null,r.validMutation=null};var o=n.component,a=r.dragging=new f(o.el);a.pointer.selector=".fc-resizer",a.touchScrollAllowed=!1,a.autoScroller.isEnabled=o.context.options.dragScroll;var l=r.hitDragging=new m(r.dragging,t.interactionSettingsToStore(n));return l.emitter.on("pointerdown",r.handlePointerDown),l.emitter.on("dragstart",r.handleDragStart),l.emitter.on("hitupdate",r.handleHitUpdate),l.emitter.on("dragend",r.handleDragEnd),r}return r(n,e),n.prototype.destroy=function(){this.dragging.destroy()},n.prototype.querySeg=function(e){return t.getElSeg(t.elementClosest(e.subjectEl,this.component.fgSegSelector))},n}(t.Interaction);var M=function(){function e(e){var n=this;this.isRecentPointerDateSelect=!1,this.onSelect=function(e){e.jsEvent&&(n.isRecentPointerDateSelect=!0)},this.onDocumentPointerUp=function(e){var r=n,i=r.calendar,o=r.documentPointer,a=i.state;if(!o.wasTouchScroll){if(a.dateSelection&&!n.isRecentPointerDateSelect){var l=i.viewOpt("unselectAuto"),s=i.viewOpt("unselectCancel");!l||l&&t.elementClosest(o.downEl,s)||i.unselect(e)}a.eventSelection&&!t.elementClosest(o.downEl,w.SELECTOR)&&i.dispatch({type:"UNSELECT_EVENT"})}n.isRecentPointerDateSelect=!1},this.calendar=e;var r=this.documentPointer=new s(document);r.shouldIgnoreMove=!0,r.shouldWatchScroll=!1,r.emitter.on("pointerup",this.onDocumentPointerUp),e.on("select",this.onSelect)}return e.prototype.destroy=function(){this.calendar.off("select",this.onSelect),this.documentPointer.destroy()},e}(),b=function(){function e(e,n){var r=this;this.receivingCalendar=null,this.droppableEvent=null,this.suppliedDragMeta=null,this.dragMeta=null,this.handleDragStart=function(e){r.dragMeta=r.buildDragMeta(e.subjectEl)},this.handleHitUpdate=function(e,n,o){var a=r.hitDragging.dragging,l=null,s=null,c=!1,d={affectedEvents:t.createEmptyEventStore(),mutatedEvents:t.createEmptyEventStore(),isEvent:r.dragMeta.create,origSeg:null};e&&(l=e.component.context.calendar,r.canDropElOnCalendar(o.subjectEl,l)&&(s=function(e,n,r){for(var o=i({},n.leftoverProps),a=0,l=r.pluginSystem.hooks.externalDefTransforms;a tag */
+ text-decoration: none;
+ color: inherit;
+}
+
+.fc-list-item-title a[href]:hover {
+ /* hover effect only on titles with hrefs */
+ text-decoration: underline;
+}
+
+/* message when no events */
+.fc-list-empty-wrap2 {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.fc-list-empty-wrap1 {
+ width: 100%;
+ height: 100%;
+ display: table;
+}
+
+.fc-list-empty {
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+}
+
+.fc-unthemed .fc-list-empty {
+ /* theme will provide own background */
+ background-color: #eee;
+}
diff --git a/lib/fullcalendar/list/main.d.ts b/lib/fullcalendar/list/main.d.ts
new file mode 100644
index 0000000..ecbb496
--- /dev/null
+++ b/lib/fullcalendar/list/main.d.ts
@@ -0,0 +1,36 @@
+// Generated by dts-bundle v0.7.3-fork.1
+// Dependencies for this module:
+// ../../../../../@fullcalendar/core
+
+declare module '@fullcalendar/list' {
+ import ListView from '@fullcalendar/list/ListView';
+ export { ListView };
+ const _default: import("@fullcalendar/core").PluginDef;
+ export default _default;
+}
+
+declare module '@fullcalendar/list/ListView' {
+ import { View, ViewProps, ScrollComponent, DateMarker, DateRange, ComponentContext, EventUiHash, EventRenderRange, EventStore, Seg, ViewSpec } from '@fullcalendar/core';
+ export { ListView as default, ListView };
+ class ListView extends View {
+ scroller: ScrollComponent;
+ contentEl: HTMLElement;
+ dayDates: DateMarker[];
+ constructor(viewSpec: ViewSpec, parentEl: HTMLElement);
+ firstContext(context: ComponentContext): void;
+ render(props: ViewProps, context: ComponentContext): void;
+ destroy(): void;
+ _renderSkeleton(context: ComponentContext): void;
+ _unrenderSkeleton(): void;
+ updateSize(isResize: any, viewHeight: any, isAuto: any): void;
+ computeScrollerHeight(viewHeight: any): number;
+ _eventStoreToSegs(eventStore: EventStore, eventUiBases: EventUiHash, dayRanges: DateRange[]): Seg[];
+ eventRangesToSegs(eventRanges: EventRenderRange[], dayRanges: DateRange[]): any[];
+ eventRangeToSegs(eventRange: EventRenderRange, dayRanges: DateRange[]): any[];
+ renderEmptyMessage(): void;
+ renderSegList(allSegs: any): void;
+ groupSegsByDay(segs: any): any[];
+ buildDayHeaderRow(dayDate: any): HTMLTableRowElement;
+ }
+}
+
diff --git a/lib/fullcalendar/list/main.esm.js b/lib/fullcalendar/list/main.esm.js
new file mode 100644
index 0000000..a032269
--- /dev/null
+++ b/lib/fullcalendar/list/main.esm.js
@@ -0,0 +1,348 @@
+/*!
+FullCalendar List View Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+
+import { getAllDayHtml, isMultiDayRange, htmlEscape, FgEventRenderer, memoize, memoizeRendering, ScrollComponent, subtractInnerElHeight, sliceEventStore, intersectRanges, htmlToElement, createFormatter, createElement, buildGotoAnchorHtml, View, startOfDay, addDays, createPlugin } from '@fullcalendar/core';
+
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+};
+
+function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var ListEventRenderer = /** @class */ (function (_super) {
+ __extends(ListEventRenderer, _super);
+ function ListEventRenderer(listView) {
+ var _this = _super.call(this) || this;
+ _this.listView = listView;
+ return _this;
+ }
+ ListEventRenderer.prototype.attachSegs = function (segs) {
+ if (!segs.length) {
+ this.listView.renderEmptyMessage();
+ }
+ else {
+ this.listView.renderSegList(segs);
+ }
+ };
+ ListEventRenderer.prototype.detachSegs = function () {
+ };
+ // generates the HTML for a single event row
+ ListEventRenderer.prototype.renderSegHtml = function (seg) {
+ var _a = this.context, theme = _a.theme, options = _a.options;
+ var eventRange = seg.eventRange;
+ var eventDef = eventRange.def;
+ var eventInstance = eventRange.instance;
+ var eventUi = eventRange.ui;
+ var url = eventDef.url;
+ var classes = ['fc-list-item'].concat(eventUi.classNames);
+ var bgColor = eventUi.backgroundColor;
+ var timeHtml;
+ if (eventDef.allDay) {
+ timeHtml = getAllDayHtml(options);
+ }
+ else if (isMultiDayRange(eventRange.range)) {
+ if (seg.isStart) {
+ timeHtml = htmlEscape(this._getTimeText(eventInstance.range.start, seg.end, false // allDay
+ ));
+ }
+ else if (seg.isEnd) {
+ timeHtml = htmlEscape(this._getTimeText(seg.start, eventInstance.range.end, false // allDay
+ ));
+ }
+ else { // inner segment that lasts the whole day
+ timeHtml = getAllDayHtml(options);
+ }
+ }
+ else {
+ // Display the normal time text for the *event's* times
+ timeHtml = htmlEscape(this.getTimeText(eventRange));
+ }
+ if (url) {
+ classes.push('fc-has-url');
+ }
+ return '' +
+ (this.displayEventTime ?
+ '' +
+ (timeHtml || '') +
+ ' | ' :
+ '') +
+ '' +
+ '' +
+ ' | ' +
+ '' +
+ '' +
+ htmlEscape(eventDef.title || '') +
+ '' +
+ ' | ' +
+ '
';
+ };
+ // like "4:00am"
+ ListEventRenderer.prototype.computeEventTimeFormat = function () {
+ return {
+ hour: 'numeric',
+ minute: '2-digit',
+ meridiem: 'short'
+ };
+ };
+ return ListEventRenderer;
+}(FgEventRenderer));
+
+/*
+Responsible for the scroller, and forwarding event-related actions into the "grid".
+*/
+var ListView = /** @class */ (function (_super) {
+ __extends(ListView, _super);
+ function ListView(viewSpec, parentEl) {
+ var _this = _super.call(this, viewSpec, parentEl) || this;
+ _this.computeDateVars = memoize(computeDateVars);
+ _this.eventStoreToSegs = memoize(_this._eventStoreToSegs);
+ _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
+ var eventRenderer = _this.eventRenderer = new ListEventRenderer(_this);
+ _this.renderContent = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [_this.renderSkeleton]);
+ return _this;
+ }
+ ListView.prototype.firstContext = function (context) {
+ context.calendar.registerInteractiveComponent(this, {
+ el: this.el
+ // TODO: make aware that it doesn't do Hits
+ });
+ };
+ ListView.prototype.render = function (props, context) {
+ _super.prototype.render.call(this, props, context);
+ var _a = this.computeDateVars(props.dateProfile), dayDates = _a.dayDates, dayRanges = _a.dayRanges;
+ this.dayDates = dayDates;
+ this.renderSkeleton(context);
+ this.renderContent(context, this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges));
+ };
+ ListView.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.renderSkeleton.unrender();
+ this.renderContent.unrender();
+ this.context.calendar.unregisterInteractiveComponent(this);
+ };
+ ListView.prototype._renderSkeleton = function (context) {
+ var theme = context.theme;
+ this.el.classList.add('fc-list-view');
+ var listViewClassNames = (theme.getClass('listView') || '').split(' '); // wish we didn't have to do this
+ for (var _i = 0, listViewClassNames_1 = listViewClassNames; _i < listViewClassNames_1.length; _i++) {
+ var listViewClassName = listViewClassNames_1[_i];
+ if (listViewClassName) { // in case input was empty string
+ this.el.classList.add(listViewClassName);
+ }
+ }
+ this.scroller = new ScrollComponent('hidden', // overflow x
+ 'auto' // overflow y
+ );
+ this.el.appendChild(this.scroller.el);
+ this.contentEl = this.scroller.el; // shortcut
+ };
+ ListView.prototype._unrenderSkeleton = function () {
+ // TODO: remove classNames
+ this.scroller.destroy(); // will remove the Grid too
+ };
+ ListView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
+ _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto);
+ this.eventRenderer.computeSizes(isResize);
+ this.eventRenderer.assignSizes(isResize);
+ this.scroller.clear(); // sets height to 'auto' and clears overflow
+ if (!isAuto) {
+ this.scroller.setHeight(this.computeScrollerHeight(viewHeight));
+ }
+ };
+ ListView.prototype.computeScrollerHeight = function (viewHeight) {
+ return viewHeight -
+ subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
+ };
+ ListView.prototype._eventStoreToSegs = function (eventStore, eventUiBases, dayRanges) {
+ return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.nextDayThreshold).fg, dayRanges);
+ };
+ ListView.prototype.eventRangesToSegs = function (eventRanges, dayRanges) {
+ var segs = [];
+ for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) {
+ var eventRange = eventRanges_1[_i];
+ segs.push.apply(segs, this.eventRangeToSegs(eventRange, dayRanges));
+ }
+ return segs;
+ };
+ ListView.prototype.eventRangeToSegs = function (eventRange, dayRanges) {
+ var _a = this.context, dateEnv = _a.dateEnv, nextDayThreshold = _a.nextDayThreshold;
+ var range = eventRange.range;
+ var allDay = eventRange.def.allDay;
+ var dayIndex;
+ var segRange;
+ var seg;
+ var segs = [];
+ for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex++) {
+ segRange = intersectRanges(range, dayRanges[dayIndex]);
+ if (segRange) {
+ seg = {
+ component: this,
+ eventRange: eventRange,
+ start: segRange.start,
+ end: segRange.end,
+ isStart: eventRange.isStart && segRange.start.valueOf() === range.start.valueOf(),
+ isEnd: eventRange.isEnd && segRange.end.valueOf() === range.end.valueOf(),
+ dayIndex: dayIndex
+ };
+ segs.push(seg);
+ // detect when range won't go fully into the next day,
+ // and mutate the latest seg to the be the end.
+ if (!seg.isEnd && !allDay &&
+ dayIndex + 1 < dayRanges.length &&
+ range.end <
+ dateEnv.add(dayRanges[dayIndex + 1].start, nextDayThreshold)) {
+ seg.end = range.end;
+ seg.isEnd = true;
+ break;
+ }
+ }
+ }
+ return segs;
+ };
+ ListView.prototype.renderEmptyMessage = function () {
+ this.contentEl.innerHTML =
+ '' + // TODO: try less wraps
+ '
' +
+ '
' +
+ htmlEscape(this.context.options.noEventsMessage) +
+ '
' +
+ '
' +
+ '
';
+ };
+ // called by ListEventRenderer
+ ListView.prototype.renderSegList = function (allSegs) {
+ var theme = this.context.theme;
+ var segsByDay = this.groupSegsByDay(allSegs); // sparse array
+ var dayIndex;
+ var daySegs;
+ var i;
+ var tableEl = htmlToElement('');
+ var tbodyEl = tableEl.querySelector('tbody');
+ for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
+ daySegs = segsByDay[dayIndex];
+ if (daySegs) { // sparse array, so might be undefined
+ // append a day header
+ tbodyEl.appendChild(this.buildDayHeaderRow(this.dayDates[dayIndex]));
+ daySegs = this.eventRenderer.sortEventSegs(daySegs);
+ for (i = 0; i < daySegs.length; i++) {
+ tbodyEl.appendChild(daySegs[i].el); // append event row
+ }
+ }
+ }
+ this.contentEl.innerHTML = '';
+ this.contentEl.appendChild(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.buildDayHeaderRow = function (dayDate) {
+ var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;
+ var mainFormat = createFormatter(options.listDayFormat); // TODO: cache
+ var altFormat = createFormatter(options.listDayAltFormat); // TODO: cache
+ return createElement('tr', {
+ className: 'fc-list-heading',
+ 'data-date': dateEnv.formatIso(dayDate, { omitTime: true })
+ }, '');
+ };
+ return ListView;
+}(View));
+ListView.prototype.fgSegSelector = '.fc-list-item'; // which elements accept event actions
+function computeDateVars(dateProfile) {
+ var dayStart = startOfDay(dateProfile.renderRange.start);
+ var viewEnd = dateProfile.renderRange.end;
+ var dayDates = [];
+ var dayRanges = [];
+ while (dayStart < viewEnd) {
+ dayDates.push(dayStart);
+ dayRanges.push({
+ start: dayStart,
+ end: addDays(dayStart, 1)
+ });
+ dayStart = addDays(dayStart, 1);
+ }
+ return { dayDates: dayDates, dayRanges: dayRanges };
+}
+
+var main = createPlugin({
+ views: {
+ list: {
+ class: ListView,
+ buttonTextKey: 'list',
+ listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' } // like "January 1, 2016"
+ },
+ listDay: {
+ type: 'list',
+ duration: { days: 1 },
+ listDayFormat: { weekday: 'long' } // day-of-week is all we need. full date is probably in header
+ },
+ listWeek: {
+ type: 'list',
+ duration: { weeks: 1 },
+ listDayFormat: { weekday: 'long' },
+ listDayAltFormat: { month: 'long', day: 'numeric', year: 'numeric' }
+ },
+ listMonth: {
+ type: 'list',
+ duration: { month: 1 },
+ listDayAltFormat: { weekday: 'long' } // day-of-week is nice-to-have
+ },
+ listYear: {
+ type: 'list',
+ duration: { year: 1 },
+ listDayAltFormat: { weekday: 'long' } // day-of-week is nice-to-have
+ }
+ }
+});
+
+export default main;
+export { ListView };
diff --git a/lib/fullcalendar/list/main.js b/lib/fullcalendar/list/main.js
new file mode 100644
index 0000000..84b1234
--- /dev/null
+++ b/lib/fullcalendar/list/main.js
@@ -0,0 +1,356 @@
+/*!
+FullCalendar List View Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core')) :
+ typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) :
+ (global = global || self, factory(global.FullCalendarList = {}, global.FullCalendar));
+}(this, function (exports, core) { 'use strict';
+
+ /*! *****************************************************************************
+ Copyright (c) Microsoft Corporation.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ ***************************************************************************** */
+ /* global Reflect, Promise */
+
+ var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+
+ function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ }
+
+ var ListEventRenderer = /** @class */ (function (_super) {
+ __extends(ListEventRenderer, _super);
+ function ListEventRenderer(listView) {
+ var _this = _super.call(this) || this;
+ _this.listView = listView;
+ return _this;
+ }
+ ListEventRenderer.prototype.attachSegs = function (segs) {
+ if (!segs.length) {
+ this.listView.renderEmptyMessage();
+ }
+ else {
+ this.listView.renderSegList(segs);
+ }
+ };
+ ListEventRenderer.prototype.detachSegs = function () {
+ };
+ // generates the HTML for a single event row
+ ListEventRenderer.prototype.renderSegHtml = function (seg) {
+ var _a = this.context, theme = _a.theme, options = _a.options;
+ var eventRange = seg.eventRange;
+ var eventDef = eventRange.def;
+ var eventInstance = eventRange.instance;
+ var eventUi = eventRange.ui;
+ var url = eventDef.url;
+ var classes = ['fc-list-item'].concat(eventUi.classNames);
+ var bgColor = eventUi.backgroundColor;
+ var timeHtml;
+ if (eventDef.allDay) {
+ timeHtml = core.getAllDayHtml(options);
+ }
+ else if (core.isMultiDayRange(eventRange.range)) {
+ if (seg.isStart) {
+ timeHtml = core.htmlEscape(this._getTimeText(eventInstance.range.start, seg.end, false // allDay
+ ));
+ }
+ else if (seg.isEnd) {
+ timeHtml = core.htmlEscape(this._getTimeText(seg.start, eventInstance.range.end, false // allDay
+ ));
+ }
+ else { // inner segment that lasts the whole day
+ timeHtml = core.getAllDayHtml(options);
+ }
+ }
+ else {
+ // Display the normal time text for the *event's* times
+ timeHtml = core.htmlEscape(this.getTimeText(eventRange));
+ }
+ if (url) {
+ classes.push('fc-has-url');
+ }
+ return '' +
+ (this.displayEventTime ?
+ '' +
+ (timeHtml || '') +
+ ' | ' :
+ '') +
+ '' +
+ '' +
+ ' | ' +
+ '' +
+ '' +
+ core.htmlEscape(eventDef.title || '') +
+ '' +
+ ' | ' +
+ '
';
+ };
+ // like "4:00am"
+ ListEventRenderer.prototype.computeEventTimeFormat = function () {
+ return {
+ hour: 'numeric',
+ minute: '2-digit',
+ meridiem: 'short'
+ };
+ };
+ return ListEventRenderer;
+ }(core.FgEventRenderer));
+
+ /*
+ Responsible for the scroller, and forwarding event-related actions into the "grid".
+ */
+ var ListView = /** @class */ (function (_super) {
+ __extends(ListView, _super);
+ function ListView(viewSpec, parentEl) {
+ var _this = _super.call(this, viewSpec, parentEl) || this;
+ _this.computeDateVars = core.memoize(computeDateVars);
+ _this.eventStoreToSegs = core.memoize(_this._eventStoreToSegs);
+ _this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
+ var eventRenderer = _this.eventRenderer = new ListEventRenderer(_this);
+ _this.renderContent = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [_this.renderSkeleton]);
+ return _this;
+ }
+ ListView.prototype.firstContext = function (context) {
+ context.calendar.registerInteractiveComponent(this, {
+ el: this.el
+ // TODO: make aware that it doesn't do Hits
+ });
+ };
+ ListView.prototype.render = function (props, context) {
+ _super.prototype.render.call(this, props, context);
+ var _a = this.computeDateVars(props.dateProfile), dayDates = _a.dayDates, dayRanges = _a.dayRanges;
+ this.dayDates = dayDates;
+ this.renderSkeleton(context);
+ this.renderContent(context, this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges));
+ };
+ ListView.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.renderSkeleton.unrender();
+ this.renderContent.unrender();
+ this.context.calendar.unregisterInteractiveComponent(this);
+ };
+ ListView.prototype._renderSkeleton = function (context) {
+ var theme = context.theme;
+ this.el.classList.add('fc-list-view');
+ var listViewClassNames = (theme.getClass('listView') || '').split(' '); // wish we didn't have to do this
+ for (var _i = 0, listViewClassNames_1 = listViewClassNames; _i < listViewClassNames_1.length; _i++) {
+ var listViewClassName = listViewClassNames_1[_i];
+ if (listViewClassName) { // in case input was empty string
+ this.el.classList.add(listViewClassName);
+ }
+ }
+ this.scroller = new core.ScrollComponent('hidden', // overflow x
+ 'auto' // overflow y
+ );
+ this.el.appendChild(this.scroller.el);
+ this.contentEl = this.scroller.el; // shortcut
+ };
+ ListView.prototype._unrenderSkeleton = function () {
+ // TODO: remove classNames
+ this.scroller.destroy(); // will remove the Grid too
+ };
+ ListView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
+ _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto);
+ this.eventRenderer.computeSizes(isResize);
+ this.eventRenderer.assignSizes(isResize);
+ this.scroller.clear(); // sets height to 'auto' and clears overflow
+ if (!isAuto) {
+ this.scroller.setHeight(this.computeScrollerHeight(viewHeight));
+ }
+ };
+ ListView.prototype.computeScrollerHeight = function (viewHeight) {
+ return viewHeight -
+ core.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
+ };
+ ListView.prototype._eventStoreToSegs = function (eventStore, eventUiBases, dayRanges) {
+ return this.eventRangesToSegs(core.sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.nextDayThreshold).fg, dayRanges);
+ };
+ ListView.prototype.eventRangesToSegs = function (eventRanges, dayRanges) {
+ var segs = [];
+ for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) {
+ var eventRange = eventRanges_1[_i];
+ segs.push.apply(segs, this.eventRangeToSegs(eventRange, dayRanges));
+ }
+ return segs;
+ };
+ ListView.prototype.eventRangeToSegs = function (eventRange, dayRanges) {
+ var _a = this.context, dateEnv = _a.dateEnv, nextDayThreshold = _a.nextDayThreshold;
+ var range = eventRange.range;
+ var allDay = eventRange.def.allDay;
+ var dayIndex;
+ var segRange;
+ var seg;
+ var segs = [];
+ for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex++) {
+ segRange = core.intersectRanges(range, dayRanges[dayIndex]);
+ if (segRange) {
+ seg = {
+ component: this,
+ eventRange: eventRange,
+ start: segRange.start,
+ end: segRange.end,
+ isStart: eventRange.isStart && segRange.start.valueOf() === range.start.valueOf(),
+ isEnd: eventRange.isEnd && segRange.end.valueOf() === range.end.valueOf(),
+ dayIndex: dayIndex
+ };
+ segs.push(seg);
+ // detect when range won't go fully into the next day,
+ // and mutate the latest seg to the be the end.
+ if (!seg.isEnd && !allDay &&
+ dayIndex + 1 < dayRanges.length &&
+ range.end <
+ dateEnv.add(dayRanges[dayIndex + 1].start, nextDayThreshold)) {
+ seg.end = range.end;
+ seg.isEnd = true;
+ break;
+ }
+ }
+ }
+ return segs;
+ };
+ ListView.prototype.renderEmptyMessage = function () {
+ this.contentEl.innerHTML =
+ '' + // TODO: try less wraps
+ '
' +
+ '
' +
+ core.htmlEscape(this.context.options.noEventsMessage) +
+ '
' +
+ '
' +
+ '
';
+ };
+ // called by ListEventRenderer
+ ListView.prototype.renderSegList = function (allSegs) {
+ var theme = this.context.theme;
+ var segsByDay = this.groupSegsByDay(allSegs); // sparse array
+ var dayIndex;
+ var daySegs;
+ var i;
+ var tableEl = core.htmlToElement('');
+ var tbodyEl = tableEl.querySelector('tbody');
+ for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
+ daySegs = segsByDay[dayIndex];
+ if (daySegs) { // sparse array, so might be undefined
+ // append a day header
+ tbodyEl.appendChild(this.buildDayHeaderRow(this.dayDates[dayIndex]));
+ daySegs = this.eventRenderer.sortEventSegs(daySegs);
+ for (i = 0; i < daySegs.length; i++) {
+ tbodyEl.appendChild(daySegs[i].el); // append event row
+ }
+ }
+ }
+ this.contentEl.innerHTML = '';
+ this.contentEl.appendChild(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.buildDayHeaderRow = function (dayDate) {
+ var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;
+ var mainFormat = core.createFormatter(options.listDayFormat); // TODO: cache
+ var altFormat = core.createFormatter(options.listDayAltFormat); // TODO: cache
+ return core.createElement('tr', {
+ className: 'fc-list-heading',
+ 'data-date': dateEnv.formatIso(dayDate, { omitTime: true })
+ }, '');
+ };
+ return ListView;
+ }(core.View));
+ ListView.prototype.fgSegSelector = '.fc-list-item'; // which elements accept event actions
+ function computeDateVars(dateProfile) {
+ var dayStart = core.startOfDay(dateProfile.renderRange.start);
+ var viewEnd = dateProfile.renderRange.end;
+ var dayDates = [];
+ var dayRanges = [];
+ while (dayStart < viewEnd) {
+ dayDates.push(dayStart);
+ dayRanges.push({
+ start: dayStart,
+ end: core.addDays(dayStart, 1)
+ });
+ dayStart = core.addDays(dayStart, 1);
+ }
+ return { dayDates: dayDates, dayRanges: dayRanges };
+ }
+
+ var main = core.createPlugin({
+ views: {
+ list: {
+ class: ListView,
+ buttonTextKey: 'list',
+ listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' } // like "January 1, 2016"
+ },
+ listDay: {
+ type: 'list',
+ duration: { days: 1 },
+ listDayFormat: { weekday: 'long' } // day-of-week is all we need. full date is probably in header
+ },
+ listWeek: {
+ type: 'list',
+ duration: { weeks: 1 },
+ listDayFormat: { weekday: 'long' },
+ listDayAltFormat: { month: 'long', day: 'numeric', year: 'numeric' }
+ },
+ listMonth: {
+ type: 'list',
+ duration: { month: 1 },
+ listDayAltFormat: { weekday: 'long' } // day-of-week is nice-to-have
+ },
+ listYear: {
+ type: 'list',
+ duration: { year: 1 },
+ listDayAltFormat: { weekday: 'long' } // day-of-week is nice-to-have
+ }
+ }
+ });
+
+ exports.ListView = ListView;
+ exports.default = main;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+}));
diff --git a/lib/fullcalendar/list/main.min.css b/lib/fullcalendar/list/main.min.css
new file mode 100644
index 0000000..18446f4
--- /dev/null
+++ b/lib/fullcalendar/list/main.min.css
@@ -0,0 +1 @@
+.fc-event-dot{display:inline-block;width:10px;height:10px;border-radius:5px}.fc-rtl .fc-list-view{direction:rtl}.fc-list-view{border-width:1px;border-style:solid}.fc .fc-list-table{table-layout:auto}.fc-list-table td{border-width:1px 0 0;padding:8px 14px}.fc-list-table tr:first-child td{border-top-width:0}.fc-list-heading{border-bottom-width:1px}.fc-list-heading td{font-weight:700}.fc-ltr .fc-list-heading-main{float:left}.fc-ltr .fc-list-heading-alt,.fc-rtl .fc-list-heading-main{float:right}.fc-rtl .fc-list-heading-alt{float:left}.fc-list-item.fc-has-url{cursor:pointer}.fc-list-item-marker,.fc-list-item-time{white-space:nowrap;width:1px}.fc-ltr .fc-list-item-marker{padding-right:0}.fc-rtl .fc-list-item-marker{padding-left:0}.fc-list-item-title a{text-decoration:none;color:inherit}.fc-list-item-title a[href]:hover{text-decoration:underline}.fc-list-empty-wrap2{position:absolute;top:0;left:0;right:0;bottom:0}.fc-list-empty-wrap1{width:100%;height:100%;display:table}.fc-list-empty{display:table-cell;vertical-align:middle;text-align:center}.fc-unthemed .fc-list-empty{background-color:#eee}
\ No newline at end of file
diff --git a/lib/fullcalendar/list/main.min.js b/lib/fullcalendar/list/main.min.js
new file mode 100644
index 0000000..a765dd1
--- /dev/null
+++ b/lib/fullcalendar/list/main.min.js
@@ -0,0 +1,6 @@
+/*!
+FullCalendar List View Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],t):t((e=e||self).FullCalendarList={},e.FullCalendar)}(this,(function(e,t){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(e){function n(t){var n=e.call(this)||this;return n.listView=t,n}return r(n,e),n.prototype.attachSegs=function(e){e.length?this.listView.renderSegList(e):this.listView.renderEmptyMessage()},n.prototype.detachSegs=function(){},n.prototype.renderSegHtml=function(e){var n,r=this.context,s=r.theme,o=r.options,i=e.eventRange,a=i.def,l=i.instance,d=i.ui,c=a.url,p=["fc-list-item"].concat(d.classNames),h=d.backgroundColor;return n=a.allDay?t.getAllDayHtml(o):t.isMultiDayRange(i.range)?e.isStart?t.htmlEscape(this._getTimeText(l.range.start,e.end,!1)):e.isEnd?t.htmlEscape(this._getTimeText(e.start,l.range.end,!1)):t.getAllDayHtml(o):t.htmlEscape(this.getTimeText(i)),c&&p.push("fc-has-url"),''+(this.displayEventTime?''+(n||"")+" | ":"")+' | "+t.htmlEscape(a.title||"")+" |
"},n.prototype.computeEventTimeFormat=function(){return{hour:"numeric",minute:"2-digit",meridiem:"short"}},n}(t.FgEventRenderer),o=function(e){function n(n,r){var o=e.call(this,n,r)||this;o.computeDateVars=t.memoize(i),o.eventStoreToSegs=t.memoize(o._eventStoreToSegs),o.renderSkeleton=t.memoizeRendering(o._renderSkeleton,o._unrenderSkeleton);var a=o.eventRenderer=new s(o);return o.renderContent=t.memoizeRendering(a.renderSegs.bind(a),a.unrender.bind(a),[o.renderSkeleton]),o}return r(n,e),n.prototype.firstContext=function(e){e.calendar.registerInteractiveComponent(this,{el:this.el})},n.prototype.render=function(t,n){e.prototype.render.call(this,t,n);var r=this.computeDateVars(t.dateProfile),s=r.dayDates,o=r.dayRanges;this.dayDates=s,this.renderSkeleton(n),this.renderContent(n,this.eventStoreToSegs(t.eventStore,t.eventUiBases,o))},n.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderSkeleton.unrender(),this.renderContent.unrender(),this.context.calendar.unregisterInteractiveComponent(this)},n.prototype._renderSkeleton=function(e){var n=e.theme;this.el.classList.add("fc-list-view");for(var r=0,s=(n.getClass("listView")||"").split(" ");r'+t.htmlEscape(this.context.options.noEventsMessage)+"
"},n.prototype.renderSegList=function(e){var n,r,s,o=this.context.theme,i=this.groupSegsByDay(e),a=t.htmlToElement(''),l=a.querySelector("tbody");for(n=0;n'+(i?t.buildGotoAnchorHtml(o,s,e,{class:"fc-list-heading-main"},t.htmlEscape(s.format(e,i))):"")+(a?t.buildGotoAnchorHtml(o,s,e,{class:"fc-list-heading-alt"},t.htmlEscape(s.format(e,a))):"")+"")},n}(t.View);function i(e){for(var n=t.startOfDay(e.renderRange.start),r=e.renderRange.end,s=[],o=[];n .fc-bg {
+ z-index: 1;
+}
+
+.fc-time-grid .fc-slats,
+.fc-time-grid > hr {
+ /* the
TimeGridView injects when grid is shorter than scroller */
+ position: relative;
+ z-index: 2;
+}
+
+.fc-time-grid .fc-content-col {
+ position: relative;
+ /* because now-indicator lives directly inside */
+}
+
+.fc-time-grid .fc-content-skeleton {
+ position: absolute;
+ z-index: 3;
+ top: 0;
+ left: 0;
+ right: 0;
+}
+
+/* divs within a cell within the fc-content-skeleton */
+.fc-time-grid .fc-business-container {
+ position: relative;
+ z-index: 1;
+}
+
+.fc-time-grid .fc-bgevent-container {
+ position: relative;
+ z-index: 2;
+}
+
+.fc-time-grid .fc-highlight-container {
+ position: relative;
+ z-index: 3;
+}
+
+.fc-time-grid .fc-event-container {
+ position: relative;
+ z-index: 4;
+}
+
+.fc-time-grid .fc-now-indicator-line {
+ z-index: 5;
+}
+
+.fc-time-grid .fc-mirror-container {
+ /* also is fc-event-container */
+ position: relative;
+ z-index: 6;
+}
+
+/* TimeGrid Slats (lines that run horizontally)
+--------------------------------------------------------------------------------------------------*/
+.fc-time-grid .fc-slats td {
+ height: 1.5em;
+ border-bottom: 0;
+ /* each cell is responsible for its top border */
+}
+
+.fc-time-grid .fc-slats .fc-minor td {
+ border-top-style: dotted;
+}
+
+/* TimeGrid Highlighting Slots
+--------------------------------------------------------------------------------------------------*/
+.fc-time-grid .fc-highlight-container {
+ /* a div within a cell within the fc-highlight-skeleton */
+ position: relative;
+ /* scopes the left/right of the fc-highlight to be in the column */
+}
+
+.fc-time-grid .fc-highlight {
+ position: absolute;
+ left: 0;
+ right: 0;
+ /* top and bottom will be in by JS */
+}
+
+/* TimeGrid Event Containment
+--------------------------------------------------------------------------------------------------*/
+.fc-ltr .fc-time-grid .fc-event-container {
+ /* space on the sides of events for LTR (default) */
+ margin: 0 2.5% 0 2px;
+}
+
+.fc-rtl .fc-time-grid .fc-event-container {
+ /* space on the sides of events for RTL */
+ margin: 0 2px 0 2.5%;
+}
+
+.fc-time-grid .fc-event,
+.fc-time-grid .fc-bgevent {
+ position: absolute;
+ z-index: 1;
+ /* scope inner z-index's */
+}
+
+.fc-time-grid .fc-bgevent {
+ /* background events always span full width */
+ left: 0;
+ right: 0;
+}
+
+/* TimeGrid Event Styling
+----------------------------------------------------------------------------------------------------
+We use the full "fc-time-grid-event" class instead of using descendants because the event won't
+be a descendant of the grid when it is being dragged.
+*/
+.fc-time-grid-event {
+ margin-bottom: 1px;
+}
+
+.fc-time-grid-event-inset {
+ -webkit-box-shadow: 0px 0px 0px 1px #fff;
+ box-shadow: 0px 0px 0px 1px #fff;
+}
+
+.fc-time-grid-event.fc-not-start {
+ /* events that are continuing from another day */
+ /* replace space made by the top border with padding */
+ border-top-width: 0;
+ padding-top: 1px;
+ /* remove top rounded corners */
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+}
+
+.fc-time-grid-event.fc-not-end {
+ /* replace space made by the top border with padding */
+ border-bottom-width: 0;
+ padding-bottom: 1px;
+ /* remove bottom rounded corners */
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+}
+
+.fc-time-grid-event .fc-content {
+ overflow: hidden;
+ max-height: 100%;
+}
+
+.fc-time-grid-event .fc-time,
+.fc-time-grid-event .fc-title {
+ padding: 0 1px;
+}
+
+.fc-time-grid-event .fc-time {
+ font-size: 0.85em;
+ white-space: nowrap;
+}
+
+/* short mode, where time and title are on the same line */
+.fc-time-grid-event.fc-short .fc-content {
+ /* don't wrap to second line (now that contents will be inline) */
+ white-space: nowrap;
+}
+
+.fc-time-grid-event.fc-short .fc-time,
+.fc-time-grid-event.fc-short .fc-title {
+ /* put the time and title on the same line */
+ display: inline-block;
+ vertical-align: top;
+}
+
+.fc-time-grid-event.fc-short .fc-time span {
+ display: none;
+ /* don't display the full time text... */
+}
+
+.fc-time-grid-event.fc-short .fc-time:before {
+ content: attr(data-start);
+ /* ...instead, display only the start time */
+}
+
+.fc-time-grid-event.fc-short .fc-time:after {
+ content: " - ";
+ /* seperate with a dash, wrapped in nbsp's */
+}
+
+.fc-time-grid-event.fc-short .fc-title {
+ font-size: 0.85em;
+ /* make the title text the same size as the time */
+ padding: 0;
+ /* undo padding from above */
+}
+
+/* resizer (cursor device) */
+.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer {
+ left: 0;
+ right: 0;
+ bottom: 0;
+ height: 8px;
+ overflow: hidden;
+ line-height: 8px;
+ font-size: 11px;
+ font-family: monospace;
+ text-align: center;
+ cursor: s-resize;
+}
+
+.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer:after {
+ content: "=";
+}
+
+/* resizer (touch device) */
+.fc-time-grid-event.fc-selected .fc-resizer {
+ /* 10x10 dot */
+ border-radius: 5px;
+ border-width: 1px;
+ width: 8px;
+ height: 8px;
+ border-style: solid;
+ border-color: inherit;
+ background: #fff;
+ /* horizontally center */
+ left: 50%;
+ margin-left: -5px;
+ /* center on the bottom edge */
+ bottom: -5px;
+}
+
+/* Now Indicator
+--------------------------------------------------------------------------------------------------*/
+.fc-time-grid .fc-now-indicator-line {
+ border-top-width: 1px;
+ left: 0;
+ right: 0;
+}
+
+/* arrow on axis */
+.fc-time-grid .fc-now-indicator-arrow {
+ margin-top: -5px;
+ /* vertically center on top coordinate */
+}
+
+.fc-ltr .fc-time-grid .fc-now-indicator-arrow {
+ left: 0;
+ /* triangle pointing right... */
+ border-width: 5px 0 5px 6px;
+ border-top-color: transparent;
+ border-bottom-color: transparent;
+}
+
+.fc-rtl .fc-time-grid .fc-now-indicator-arrow {
+ right: 0;
+ /* triangle pointing left... */
+ border-width: 5px 6px 5px 0;
+ border-top-color: transparent;
+ border-bottom-color: transparent;
+}
diff --git a/lib/fullcalendar/timegrid/main.d.ts b/lib/fullcalendar/timegrid/main.d.ts
new file mode 100644
index 0000000..303b516
--- /dev/null
+++ b/lib/fullcalendar/timegrid/main.d.ts
@@ -0,0 +1,224 @@
+// Generated by dts-bundle v0.7.3-fork.1
+// Dependencies for this module:
+// ../../../../../@fullcalendar/core
+// ../../../../../@fullcalendar/daygrid
+
+declare module '@fullcalendar/timegrid' {
+ import AbstractTimeGridView from '@fullcalendar/timegrid/AbstractTimeGridView';
+ import TimeGridView, { buildDayTable } from '@fullcalendar/timegrid/TimeGridView';
+ import { TimeGridSeg } from '@fullcalendar/timegrid/TimeGrid';
+ import { TimeGridSlicer, buildDayRanges } from '@fullcalendar/timegrid/SimpleTimeGrid';
+ export { TimeGridView, AbstractTimeGridView, buildDayTable, buildDayRanges, TimeGridSlicer, TimeGridSeg };
+ export { default as TimeGrid } from '@fullcalendar/timegrid/TimeGrid';
+ const _default: import("@fullcalendar/core").PluginDef;
+ export default _default;
+}
+
+declare module '@fullcalendar/timegrid/AbstractTimeGridView' {
+ import { ScrollComponent, View, ComponentContext, Duration, ViewProps } from '@fullcalendar/core';
+ import { DayGrid } from '@fullcalendar/daygrid';
+ import TimeGrid from '@fullcalendar/timegrid/TimeGrid';
+ import AllDaySplitter from '@fullcalendar/timegrid/AllDaySplitter';
+ export { AbstractTimeGridView as default, AbstractTimeGridView };
+ abstract class AbstractTimeGridView extends View {
+ timeGrid: TimeGrid;
+ dayGrid: DayGrid;
+ scroller: ScrollComponent;
+ axisWidth: any;
+ protected splitter: AllDaySplitter;
+ render(props: ViewProps, context: ComponentContext): void;
+ destroy(): void;
+ _renderSkeleton(context: ComponentContext): void;
+ _unrenderSkeleton(): void;
+ renderSkeletonHtml(): string;
+ getNowIndicatorUnit(): string;
+ unrenderNowIndicator(): void;
+ updateSize(isResize: boolean, viewHeight: number, isAuto: boolean): void;
+ updateBaseSize(isResize: any, viewHeight: any, isAuto: any): void;
+ computeScrollerHeight(viewHeight: any): number;
+ computeDateScroll(duration: Duration): {
+ top: any;
+ };
+ queryDateScroll(): {
+ top: number;
+ };
+ applyDateScroll(scroll: any): void;
+ renderHeadIntroHtml: () => string;
+ axisStyleAttr(): string;
+ renderTimeGridBgIntroHtml: () => string;
+ renderTimeGridIntroHtml: () => string;
+ renderDayGridBgIntroHtml: () => string;
+ renderDayGridIntroHtml: () => string;
+ }
+}
+
+declare module '@fullcalendar/timegrid/TimeGridView' {
+ import { DateProfileGenerator, DateProfile, ComponentContext, DayHeader, DayTable, ViewProps } from '@fullcalendar/core';
+ import { SimpleDayGrid } from '@fullcalendar/daygrid';
+ import SimpleTimeGrid from '@fullcalendar/timegrid/SimpleTimeGrid';
+ import AbstractTimeGridView from '@fullcalendar/timegrid/AbstractTimeGridView';
+ export { TimeGridView as default, TimeGridView };
+ class TimeGridView extends AbstractTimeGridView {
+ header: DayHeader;
+ simpleDayGrid: SimpleDayGrid;
+ simpleTimeGrid: SimpleTimeGrid;
+ render(props: ViewProps, context: ComponentContext): void;
+ _renderSkeleton(context: ComponentContext): void;
+ _unrenderSkeleton(): void;
+ renderNowIndicator(date: any): void;
+ }
+ export function buildDayTable(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator): DayTable;
+}
+
+declare module '@fullcalendar/timegrid/TimeGrid' {
+ import { PositionCache, Duration, DateMarker, DateFormatter, ComponentContext, DateComponent, Seg, EventSegUiInteractionState, DateProfile, Theme } from '@fullcalendar/core';
+ export interface RenderProps {
+ renderBgIntroHtml: () => string;
+ renderIntroHtml: () => string;
+ }
+ export interface TimeGridSeg extends Seg {
+ col: number;
+ start: DateMarker;
+ end: DateMarker;
+ }
+ export interface TimeGridCell {
+ date: DateMarker;
+ htmlAttrs?: string;
+ }
+ export interface TimeGridProps {
+ dateProfile: DateProfile;
+ cells: TimeGridCell[];
+ businessHourSegs: TimeGridSeg[];
+ bgEventSegs: TimeGridSeg[];
+ fgEventSegs: TimeGridSeg[];
+ dateSelectionSegs: TimeGridSeg[];
+ eventSelection: string;
+ eventDrag: EventSegUiInteractionState | null;
+ eventResize: EventSegUiInteractionState | null;
+ }
+ export { TimeGrid as default, TimeGrid };
+ class TimeGrid extends DateComponent {
+ renderProps: RenderProps;
+ slotDuration: Duration;
+ snapDuration: Duration;
+ snapsPerSlot: any;
+ labelFormat: DateFormatter;
+ labelInterval: Duration;
+ colCnt: number;
+ colEls: HTMLElement[];
+ slatContainerEl: HTMLElement;
+ slatEls: HTMLElement[];
+ nowIndicatorEls: HTMLElement[];
+ colPositions: PositionCache;
+ slatPositions: PositionCache;
+ isSlatSizesDirty: boolean;
+ isColSizesDirty: boolean;
+ rootBgContainerEl: HTMLElement;
+ bottomRuleEl: HTMLElement;
+ contentSkeletonEl: HTMLElement;
+ colContainerEls: HTMLElement[];
+ fgContainerEls: HTMLElement[];
+ bgContainerEls: HTMLElement[];
+ mirrorContainerEls: HTMLElement[];
+ highlightContainerEls: HTMLElement[];
+ businessContainerEls: HTMLElement[];
+ constructor(el: HTMLElement, renderProps: RenderProps);
+ _processOptions(options: any): void;
+ computeLabelInterval(slotDuration: any): any;
+ render(props: TimeGridProps, context: ComponentContext): void;
+ destroy(): void;
+ updateSize(isResize: boolean): void;
+ _renderSkeleton(theme: Theme): void;
+ _renderSlats(dateProfile: DateProfile): void;
+ renderSlatRowHtml(dateProfile: DateProfile): string;
+ _renderColumns(cells: TimeGridCell[], dateProfile: DateProfile): void;
+ _unrenderColumns(): void;
+ renderContentSkeleton(): void;
+ unrenderContentSkeleton(): void;
+ groupSegsByCol(segs: any): any[];
+ attachSegsByCol(segsByCol: any, containerEls: HTMLElement[]): void;
+ getNowIndicatorUnit(): string;
+ renderNowIndicator(segs: TimeGridSeg[], date: any): void;
+ unrenderNowIndicator(): void;
+ getTotalSlatHeight(): number;
+ computeDateTop(when: DateMarker, startOfDayDate?: DateMarker): any;
+ computeTimeTop(duration: Duration): any;
+ computeSegVerticals(segs: any): void;
+ assignSegVerticals(segs: any): void;
+ generateSegVerticalCss(seg: any): {
+ top: any;
+ bottom: number;
+ };
+ buildPositionCaches(): void;
+ buildColPositions(): void;
+ buildSlatPositions(): void;
+ positionToHit(positionLeft: any, positionTop: any): {
+ col: any;
+ dateSpan: {
+ range: {
+ start: Date;
+ end: Date;
+ };
+ allDay: boolean;
+ };
+ dayEl: HTMLElement;
+ relativeRect: {
+ left: any;
+ right: any;
+ top: any;
+ bottom: any;
+ };
+ };
+ _renderEventDrag(state: EventSegUiInteractionState): void;
+ _unrenderEventDrag(state: EventSegUiInteractionState): void;
+ _renderEventResize(state: EventSegUiInteractionState): void;
+ _unrenderEventResize(state: EventSegUiInteractionState): void;
+ _renderDateSelection(segs: Seg[]): void;
+ _unrenderDateSelection(segs: Seg[]): void;
+ }
+}
+
+declare module '@fullcalendar/timegrid/SimpleTimeGrid' {
+ import { DateComponent, DateProfile, EventStore, EventUiHash, EventInteractionState, DateSpan, DateRange, DayTable, DateEnv, DateMarker, Slicer, Hit, ComponentContext } from '@fullcalendar/core';
+ import TimeGrid, { TimeGridSeg } from '@fullcalendar/timegrid/TimeGrid';
+ export interface SimpleTimeGridProps {
+ dateProfile: DateProfile | null;
+ dayTable: DayTable;
+ businessHours: EventStore;
+ eventStore: EventStore;
+ eventUiBases: EventUiHash;
+ dateSelection: DateSpan | null;
+ eventSelection: string;
+ eventDrag: EventInteractionState | null;
+ eventResize: EventInteractionState | null;
+ }
+ export { SimpleTimeGrid as default, SimpleTimeGrid };
+ class SimpleTimeGrid extends DateComponent {
+ timeGrid: TimeGrid;
+ constructor(timeGrid: TimeGrid);
+ firstContext(context: ComponentContext): void;
+ destroy(): void;
+ render(props: SimpleTimeGridProps, context: ComponentContext): void;
+ renderNowIndicator(date: DateMarker): void;
+ buildPositionCaches(): void;
+ queryHit(positionLeft: number, positionTop: number): Hit;
+ }
+ export function buildDayRanges(dayTable: DayTable, dateProfile: DateProfile, dateEnv: DateEnv): DateRange[];
+ export class TimeGridSlicer extends Slicer {
+ sliceRange(range: DateRange, dayRanges: DateRange[]): TimeGridSeg[];
+ }
+}
+
+declare module '@fullcalendar/timegrid/AllDaySplitter' {
+ import { Splitter, EventDef, DateSpan } from '@fullcalendar/core';
+ export { AllDaySplitter as default, AllDaySplitter };
+ class AllDaySplitter extends Splitter {
+ getKeyInfo(): {
+ allDay: {};
+ timed: {};
+ };
+ getKeysForDateSpan(dateSpan: DateSpan): string[];
+ getKeysForEventDef(eventDef: EventDef): string[];
+ }
+}
+
diff --git a/lib/fullcalendar/timegrid/main.esm.js b/lib/fullcalendar/timegrid/main.esm.js
new file mode 100644
index 0000000..7038488
--- /dev/null
+++ b/lib/fullcalendar/timegrid/main.esm.js
@@ -0,0 +1,1391 @@
+/*!
+FullCalendar Time Grid Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+
+import { createFormatter, removeElement, computeEventDraggable, computeEventStartResizable, computeEventEndResizable, cssToStr, isMultiDayRange, htmlEscape, compareByFieldSpecs, applyStyle, FgEventRenderer, buildSegCompareObj, FillRenderer, memoize, memoizeRendering, createDuration, wholeDivideDurations, findElements, PositionCache, startOfDay, asRoughMs, formatIsoTimeString, addDurations, htmlToElement, createElement, multiplyDuration, DateComponent, hasBgRendering, Splitter, diffDays, buildGotoAnchorHtml, getAllDayHtml, ScrollComponent, matchCellWidths, uncompensateScroll, compensateScroll, subtractInnerElHeight, View, intersectRanges, Slicer, DayHeader, DaySeries, DayTable, createPlugin } from '@fullcalendar/core';
+import { DayBgRow, DayGrid, SimpleDayGrid } from '@fullcalendar/daygrid';
+
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+};
+
+function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+
+/*
+Only handles foreground segs.
+Does not own rendering. Use for low-level util methods by TimeGrid.
+*/
+var TimeGridEventRenderer = /** @class */ (function (_super) {
+ __extends(TimeGridEventRenderer, _super);
+ function TimeGridEventRenderer(timeGrid) {
+ var _this = _super.call(this) || this;
+ _this.timeGrid = timeGrid;
+ return _this;
+ }
+ TimeGridEventRenderer.prototype.renderSegs = function (context, segs, mirrorInfo) {
+ _super.prototype.renderSegs.call(this, context, segs, mirrorInfo);
+ // TODO: dont do every time. memoize
+ this.fullTimeFormat = createFormatter({
+ hour: 'numeric',
+ minute: '2-digit',
+ separator: this.context.options.defaultRangeSeparator
+ });
+ };
+ // Given an array of foreground segments, render a DOM element for each, computes position,
+ // and attaches to the column inner-container elements.
+ TimeGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
+ var segsByCol = this.timeGrid.groupSegsByCol(segs);
+ // order the segs within each column
+ // TODO: have groupSegsByCol do this?
+ for (var col = 0; col < segsByCol.length; col++) {
+ segsByCol[col] = this.sortEventSegs(segsByCol[col]);
+ }
+ this.segsByCol = segsByCol;
+ this.timeGrid.attachSegsByCol(segsByCol, this.timeGrid.fgContainerEls);
+ };
+ TimeGridEventRenderer.prototype.detachSegs = function (segs) {
+ segs.forEach(function (seg) {
+ removeElement(seg.el);
+ });
+ this.segsByCol = null;
+ };
+ TimeGridEventRenderer.prototype.computeSegSizes = function (allSegs) {
+ var _a = this, timeGrid = _a.timeGrid, segsByCol = _a.segsByCol;
+ var colCnt = timeGrid.colCnt;
+ timeGrid.computeSegVerticals(allSegs); // horizontals relies on this
+ if (segsByCol) {
+ for (var col = 0; col < colCnt; col++) {
+ this.computeSegHorizontals(segsByCol[col]); // compute horizontal coordinates, z-index's, and reorder the array
+ }
+ }
+ };
+ TimeGridEventRenderer.prototype.assignSegSizes = function (allSegs) {
+ var _a = this, timeGrid = _a.timeGrid, segsByCol = _a.segsByCol;
+ var colCnt = timeGrid.colCnt;
+ timeGrid.assignSegVerticals(allSegs); // horizontals relies on this
+ if (segsByCol) {
+ for (var col = 0; col < colCnt; col++) {
+ this.assignSegCss(segsByCol[col]);
+ }
+ }
+ };
+ // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined
+ TimeGridEventRenderer.prototype.computeEventTimeFormat = function () {
+ return {
+ hour: 'numeric',
+ minute: '2-digit',
+ meridiem: false
+ };
+ };
+ // Computes a default `displayEventEnd` value if one is not expliclty defined
+ TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () {
+ return true;
+ };
+ // Renders the HTML for a single event segment's default rendering
+ TimeGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {
+ var eventRange = seg.eventRange;
+ var eventDef = eventRange.def;
+ var eventUi = eventRange.ui;
+ var allDay = eventDef.allDay;
+ var isDraggable = computeEventDraggable(this.context, eventDef, eventUi);
+ var isResizableFromStart = seg.isStart && computeEventStartResizable(this.context, eventDef, eventUi);
+ var isResizableFromEnd = seg.isEnd && computeEventEndResizable(this.context, eventDef, eventUi);
+ var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);
+ var skinCss = cssToStr(this.getSkinCss(eventUi));
+ var timeText;
+ var fullTimeText; // more verbose time text. for the print stylesheet
+ var startTimeText; // just the start time text
+ classes.unshift('fc-time-grid-event');
+ // if the event appears to span more than one day...
+ if (isMultiDayRange(eventRange.range)) {
+ // Don't display time text on segments that run entirely through a day.
+ // That would appear as midnight-midnight and would look dumb.
+ // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
+ if (seg.isStart || seg.isEnd) {
+ var unzonedStart = seg.start;
+ var unzonedEnd = seg.end;
+ timeText = this._getTimeText(unzonedStart, unzonedEnd, allDay); // TODO: give the timezones
+ fullTimeText = this._getTimeText(unzonedStart, unzonedEnd, allDay, this.fullTimeFormat);
+ startTimeText = this._getTimeText(unzonedStart, unzonedEnd, allDay, null, false); // displayEnd=false
+ }
+ }
+ else {
+ // Display the normal time text for the *event's* times
+ timeText = this.getTimeText(eventRange);
+ fullTimeText = this.getTimeText(eventRange, this.fullTimeFormat);
+ startTimeText = this.getTimeText(eventRange, null, false); // displayEnd=false
+ }
+ return '' +
+ '' +
+ (timeText ?
+ '
' +
+ '' + htmlEscape(timeText) + '' +
+ '
' :
+ '') +
+ (eventDef.title ?
+ '
' +
+ htmlEscape(eventDef.title) +
+ '
' :
+ '') +
+ '
' +
+ /* TODO: write CSS for this
+ (isResizableFromStart ?
+ '' :
+ ''
+ ) +
+ */
+ (isResizableFromEnd ?
+ '' :
+ '') +
+ '';
+ };
+ // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.
+ // Assumed the segs are already ordered.
+ // NOTE: Also reorders the given array by date!
+ TimeGridEventRenderer.prototype.computeSegHorizontals = function (segs) {
+ var levels;
+ var level0;
+ var i;
+ levels = buildSlotSegLevels(segs);
+ computeForwardSlotSegs(levels);
+ if ((level0 = levels[0])) {
+ for (i = 0; i < level0.length; i++) {
+ computeSlotSegPressures(level0[i]);
+ }
+ for (i = 0; i < level0.length; i++) {
+ this.computeSegForwardBack(level0[i], 0, 0);
+ }
+ }
+ };
+ // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
+ // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
+ // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
+ //
+ // The segment might be part of a "series", which means consecutive segments with the same pressure
+ // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
+ // segments behind this one in the current series, and `seriesBackwardCoord` is the starting
+ // coordinate of the first segment in the series.
+ TimeGridEventRenderer.prototype.computeSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {
+ var forwardSegs = seg.forwardSegs;
+ var i;
+ 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;
+ }
+ else {
+ // sort highest pressure first
+ this.sortForwardSegs(forwardSegs);
+ // this segment's forwardCoord will be calculated from the backwardCoord of the
+ // highest-pressure forward segment.
+ this.computeSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
+ seg.forwardCoord = forwardSegs[0].backwardCoord;
+ }
+ // calculate the backwardCoord from the forwardCoord. consider the series
+ seg.backwardCoord = seg.forwardCoord -
+ (seg.forwardCoord - seriesBackwardCoord) / // available width for series
+ (seriesBackwardPressure + 1); // # of segments in the series
+ // use this segment's coordinates to computed the coordinates of the less-pressurized
+ // forward segments
+ for (i = 0; i < forwardSegs.length; i++) {
+ this.computeSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);
+ }
+ }
+ };
+ TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) {
+ var objs = forwardSegs.map(buildTimeGridSegCompareObj);
+ var specs = [
+ // put higher-pressure first
+ { field: 'forwardPressure', order: -1 },
+ // put segments that are closer to initial edge first (and favor ones with no coords yet)
+ { field: 'backwardCoord', order: 1 }
+ ].concat(this.context.eventOrderSpecs);
+ objs.sort(function (obj0, obj1) {
+ return compareByFieldSpecs(obj0, obj1, specs);
+ });
+ return objs.map(function (c) {
+ return c._seg;
+ });
+ };
+ // Given foreground event segments that have already had their position coordinates computed,
+ // assigns position-related CSS values to their elements.
+ TimeGridEventRenderer.prototype.assignSegCss = function (segs) {
+ for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
+ var seg = segs_1[_i];
+ applyStyle(seg.el, this.generateSegCss(seg));
+ if (seg.level > 0) {
+ seg.el.classList.add('fc-time-grid-event-inset');
+ }
+ // 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.eventRange.def.title && seg.bottom - seg.top < 30) {
+ seg.el.classList.add('fc-short'); // TODO: "condensed" is a better name
+ }
+ }
+ };
+ // Generates an object with CSS properties/values that should be applied to an event segment element.
+ // Contains important positioning-related properties that should be applied to any event element, customized or not.
+ TimeGridEventRenderer.prototype.generateSegCss = function (seg) {
+ var shouldOverlap = this.context.options.slotEventOverlap;
+ var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point
+ var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point
+ var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first
+ var isRtl = this.context.isRtl;
+ var left; // amount of space from left edge, a fraction of the total width
+ var right; // amount of space from right edge, a fraction of the total width
+ if (shouldOverlap) {
+ // double the width, but don't go beyond the maximum forward coordinate (1.0)
+ forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);
+ }
+ if (isRtl) {
+ left = 1 - forwardCoord;
+ right = backwardCoord;
+ }
+ else {
+ left = backwardCoord;
+ right = 1 - forwardCoord;
+ }
+ props.zIndex = seg.level + 1; // convert from 0-base to 1-based
+ props.left = left * 100 + '%';
+ props.right = right * 100 + '%';
+ if (shouldOverlap && seg.forwardPressure) {
+ // add padding to the edge so that forward stacked events don't cover the resizer's icon
+ props[isRtl ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width
+ }
+ return props;
+ };
+ return TimeGridEventRenderer;
+}(FgEventRenderer));
+// Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is
+// left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.
+function buildSlotSegLevels(segs) {
+ var levels = [];
+ var i;
+ var seg;
+ var j;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ // go through all the levels and stop on the first level where there are no collisions
+ for (j = 0; j < levels.length; j++) {
+ if (!computeSlotSegCollisions(seg, levels[j]).length) {
+ break;
+ }
+ }
+ seg.level = j;
+ (levels[j] || (levels[j] = [])).push(seg);
+ }
+ return levels;
+}
+// For every segment, figure out the other segments that are in subsequent
+// levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
+function computeForwardSlotSegs(levels) {
+ var i;
+ var level;
+ var j;
+ var seg;
+ var k;
+ for (i = 0; i < levels.length; i++) {
+ level = levels[i];
+ for (j = 0; j < level.length; j++) {
+ seg = level[j];
+ seg.forwardSegs = [];
+ for (k = i + 1; k < levels.length; k++) {
+ computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
+ }
+ }
+ }
+}
+// Figure out which path forward (via seg.forwardSegs) results in the longest path until
+// the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
+function computeSlotSegPressures(seg) {
+ var forwardSegs = seg.forwardSegs;
+ var forwardPressure = 0;
+ var i;
+ var forwardSeg;
+ 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
+ computeSlotSegPressures(forwardSeg);
+ // either use the existing maximum, or use the child's forward pressure
+ // plus one (for the forwardSeg itself)
+ forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);
+ }
+ seg.forwardPressure = forwardPressure;
+ }
+}
+// Find all the segments in `otherSegs` that vertically collide with `seg`.
+// Append into an optionally-supplied `results` array and return.
+function computeSlotSegCollisions(seg, otherSegs, results) {
+ if (results === void 0) { results = []; }
+ for (var i = 0; i < otherSegs.length; i++) {
+ if (isSlotSegCollision(seg, otherSegs[i])) {
+ results.push(otherSegs[i]);
+ }
+ }
+ return results;
+}
+// Do these segments occupy the same vertical space?
+function isSlotSegCollision(seg1, seg2) {
+ return seg1.bottom > seg2.top && seg1.top < seg2.bottom;
+}
+function buildTimeGridSegCompareObj(seg) {
+ var obj = buildSegCompareObj(seg);
+ obj.forwardPressure = seg.forwardPressure;
+ obj.backwardCoord = seg.backwardCoord;
+ return obj;
+}
+
+var TimeGridMirrorRenderer = /** @class */ (function (_super) {
+ __extends(TimeGridMirrorRenderer, _super);
+ function TimeGridMirrorRenderer() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TimeGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
+ this.segsByCol = this.timeGrid.groupSegsByCol(segs);
+ this.timeGrid.attachSegsByCol(this.segsByCol, this.timeGrid.mirrorContainerEls);
+ this.sourceSeg = mirrorInfo.sourceSeg;
+ };
+ TimeGridMirrorRenderer.prototype.generateSegCss = function (seg) {
+ var props = _super.prototype.generateSegCss.call(this, seg);
+ var sourceSeg = this.sourceSeg;
+ if (sourceSeg && sourceSeg.col === seg.col) {
+ var sourceSegProps = _super.prototype.generateSegCss.call(this, sourceSeg);
+ props.left = sourceSegProps.left;
+ props.right = sourceSegProps.right;
+ props.marginLeft = sourceSegProps.marginLeft;
+ props.marginRight = sourceSegProps.marginRight;
+ }
+ return props;
+ };
+ return TimeGridMirrorRenderer;
+}(TimeGridEventRenderer));
+
+var TimeGridFillRenderer = /** @class */ (function (_super) {
+ __extends(TimeGridFillRenderer, _super);
+ function TimeGridFillRenderer(timeGrid) {
+ var _this = _super.call(this) || this;
+ _this.timeGrid = timeGrid;
+ return _this;
+ }
+ TimeGridFillRenderer.prototype.attachSegs = function (type, segs) {
+ var timeGrid = this.timeGrid;
+ var containerEls;
+ // TODO: more efficient lookup
+ if (type === 'bgEvent') {
+ containerEls = timeGrid.bgContainerEls;
+ }
+ else if (type === 'businessHours') {
+ containerEls = timeGrid.businessContainerEls;
+ }
+ else if (type === 'highlight') {
+ containerEls = timeGrid.highlightContainerEls;
+ }
+ timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls);
+ return segs.map(function (seg) {
+ return seg.el;
+ });
+ };
+ TimeGridFillRenderer.prototype.computeSegSizes = function (segs) {
+ this.timeGrid.computeSegVerticals(segs);
+ };
+ TimeGridFillRenderer.prototype.assignSegSizes = function (segs) {
+ this.timeGrid.assignSegVerticals(segs);
+ };
+ return TimeGridFillRenderer;
+}(FillRenderer));
+
+/* A component that renders one or more columns of vertical time slots
+----------------------------------------------------------------------------------------------------------------------*/
+// potential nice values for the slot-duration and interval-duration
+// from largest to smallest
+var AGENDA_STOCK_SUB_DURATIONS = [
+ { hours: 1 },
+ { minutes: 30 },
+ { minutes: 15 },
+ { seconds: 30 },
+ { seconds: 15 }
+];
+var TimeGrid = /** @class */ (function (_super) {
+ __extends(TimeGrid, _super);
+ function TimeGrid(el, renderProps) {
+ var _this = _super.call(this, el) || this;
+ _this.isSlatSizesDirty = false;
+ _this.isColSizesDirty = false;
+ _this.processOptions = memoize(_this._processOptions);
+ _this.renderSkeleton = memoizeRendering(_this._renderSkeleton);
+ _this.renderSlats = memoizeRendering(_this._renderSlats, null, [_this.renderSkeleton]);
+ _this.renderColumns = memoizeRendering(_this._renderColumns, _this._unrenderColumns, [_this.renderSkeleton]);
+ _this.renderProps = renderProps;
+ var renderColumns = _this.renderColumns;
+ var eventRenderer = _this.eventRenderer = new TimeGridEventRenderer(_this);
+ var fillRenderer = _this.fillRenderer = new TimeGridFillRenderer(_this);
+ _this.mirrorRenderer = new TimeGridMirrorRenderer(_this);
+ _this.renderBusinessHours = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderColumns]);
+ _this.renderDateSelection = memoizeRendering(_this._renderDateSelection, _this._unrenderDateSelection, [renderColumns]);
+ _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderColumns]);
+ _this.renderBgEvents = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderColumns]);
+ _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
+ _this.renderEventDrag = memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderColumns]);
+ _this.renderEventResize = memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderColumns]);
+ return _this;
+ }
+ /* Options
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Parses various options into properties of this object
+ // MUST have context already set
+ TimeGrid.prototype._processOptions = function (options) {
+ var slotDuration = options.slotDuration, snapDuration = options.snapDuration;
+ var snapsPerSlot;
+ var input;
+ slotDuration = createDuration(slotDuration);
+ snapDuration = snapDuration ? createDuration(snapDuration) : slotDuration;
+ snapsPerSlot = wholeDivideDurations(slotDuration, snapDuration);
+ if (snapsPerSlot === null) {
+ snapDuration = slotDuration;
+ snapsPerSlot = 1;
+ // TODO: say warning?
+ }
+ this.slotDuration = slotDuration;
+ this.snapDuration = snapDuration;
+ this.snapsPerSlot = snapsPerSlot;
+ // might be an array value (for TimelineView).
+ // if so, getting the most granular entry (the last one probably).
+ input = options.slotLabelFormat;
+ if (Array.isArray(input)) {
+ input = input[input.length - 1];
+ }
+ this.labelFormat = createFormatter(input || {
+ hour: 'numeric',
+ minute: '2-digit',
+ omitZeroMinute: true,
+ meridiem: 'short'
+ });
+ input = options.slotLabelInterval;
+ this.labelInterval = input ?
+ createDuration(input) :
+ this.computeLabelInterval(slotDuration);
+ };
+ // Computes an automatic value for slotLabelInterval
+ TimeGrid.prototype.computeLabelInterval = function (slotDuration) {
+ var i;
+ var labelInterval;
+ var slotsPerLabel;
+ // find the smallest stock label interval that results in more than one slots-per-label
+ for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {
+ labelInterval = createDuration(AGENDA_STOCK_SUB_DURATIONS[i]);
+ slotsPerLabel = wholeDivideDurations(labelInterval, slotDuration);
+ if (slotsPerLabel !== null && slotsPerLabel > 1) {
+ return labelInterval;
+ }
+ }
+ return slotDuration; // fall back
+ };
+ /* Rendering
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.render = function (props, context) {
+ this.processOptions(context.options);
+ var cells = props.cells;
+ this.colCnt = cells.length;
+ this.renderSkeleton(context.theme);
+ this.renderSlats(props.dateProfile);
+ this.renderColumns(props.cells, props.dateProfile);
+ this.renderBusinessHours(context, props.businessHourSegs);
+ this.renderDateSelection(props.dateSelectionSegs);
+ this.renderFgEvents(context, props.fgEventSegs);
+ this.renderBgEvents(context, props.bgEventSegs);
+ this.renderEventSelection(props.eventSelection);
+ this.renderEventDrag(props.eventDrag);
+ this.renderEventResize(props.eventResize);
+ };
+ TimeGrid.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ // should unrender everything else too
+ this.renderSlats.unrender();
+ this.renderColumns.unrender();
+ this.renderSkeleton.unrender();
+ };
+ TimeGrid.prototype.updateSize = function (isResize) {
+ var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;
+ if (isResize || this.isSlatSizesDirty) {
+ this.buildSlatPositions();
+ this.isSlatSizesDirty = false;
+ }
+ if (isResize || this.isColSizesDirty) {
+ this.buildColPositions();
+ this.isColSizesDirty = false;
+ }
+ fillRenderer.computeSizes(isResize);
+ eventRenderer.computeSizes(isResize);
+ mirrorRenderer.computeSizes(isResize);
+ fillRenderer.assignSizes(isResize);
+ eventRenderer.assignSizes(isResize);
+ mirrorRenderer.assignSizes(isResize);
+ };
+ TimeGrid.prototype._renderSkeleton = function (theme) {
+ var el = this.el;
+ el.innerHTML =
+ '' +
+ '' +
+ '';
+ this.rootBgContainerEl = el.querySelector('.fc-bg');
+ this.slatContainerEl = el.querySelector('.fc-slats');
+ this.bottomRuleEl = el.querySelector('.fc-divider');
+ };
+ TimeGrid.prototype._renderSlats = function (dateProfile) {
+ var theme = this.context.theme;
+ this.slatContainerEl.innerHTML =
+ '' +
+ this.renderSlatRowHtml(dateProfile) +
+ '
';
+ this.slatEls = findElements(this.slatContainerEl, 'tr');
+ this.slatPositions = new PositionCache(this.el, this.slatEls, false, true // vertical
+ );
+ this.isSlatSizesDirty = true;
+ };
+ // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
+ TimeGrid.prototype.renderSlatRowHtml = function (dateProfile) {
+ var _a = this.context, dateEnv = _a.dateEnv, theme = _a.theme, isRtl = _a.isRtl;
+ var html = '';
+ var dayStart = startOfDay(dateProfile.renderRange.start);
+ var slotTime = dateProfile.minTime;
+ var slotIterator = createDuration(0);
+ var slotDate; // will be on the view's first day, but we only care about its time
+ var isLabeled;
+ var axisHtml;
+ // Calculate the time for each slot
+ while (asRoughMs(slotTime) < asRoughMs(dateProfile.maxTime)) {
+ slotDate = dateEnv.add(dayStart, slotTime);
+ isLabeled = wholeDivideDurations(slotIterator, this.labelInterval) !== null;
+ axisHtml =
+ '' +
+ (isLabeled ?
+ '' + // for matchCellWidths
+ htmlEscape(dateEnv.format(slotDate, this.labelFormat)) +
+ '' :
+ '') +
+ ' | ';
+ html +=
+ '' +
+ (!isRtl ? axisHtml : '') +
+ ' | ' +
+ (isRtl ? axisHtml : '') +
+ '
';
+ slotTime = addDurations(slotTime, this.slotDuration);
+ slotIterator = addDurations(slotIterator, this.slotDuration);
+ }
+ return html;
+ };
+ TimeGrid.prototype._renderColumns = function (cells, dateProfile) {
+ var _a = this.context, calendar = _a.calendar, view = _a.view, isRtl = _a.isRtl, theme = _a.theme, dateEnv = _a.dateEnv;
+ var bgRow = new DayBgRow(this.context);
+ this.rootBgContainerEl.innerHTML =
+ '' +
+ bgRow.renderHtml({
+ cells: cells,
+ dateProfile: dateProfile,
+ renderIntroHtml: this.renderProps.renderBgIntroHtml
+ }) +
+ '
';
+ this.colEls = findElements(this.el, '.fc-day, .fc-disabled-day');
+ for (var col = 0; col < this.colCnt; col++) {
+ calendar.publiclyTrigger('dayRender', [
+ {
+ date: dateEnv.toDate(cells[col].date),
+ el: this.colEls[col],
+ view: view
+ }
+ ]);
+ }
+ if (isRtl) {
+ this.colEls.reverse();
+ }
+ this.colPositions = new PositionCache(this.el, this.colEls, true, // horizontal
+ false);
+ this.renderContentSkeleton();
+ this.isColSizesDirty = true;
+ };
+ TimeGrid.prototype._unrenderColumns = function () {
+ this.unrenderContentSkeleton();
+ };
+ /* Content Skeleton
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Renders the DOM that the view's content will live in
+ TimeGrid.prototype.renderContentSkeleton = function () {
+ var isRtl = this.context.isRtl;
+ var parts = [];
+ var skeletonEl;
+ parts.push(this.renderProps.renderIntroHtml());
+ for (var i = 0; i < this.colCnt; i++) {
+ parts.push('' +
+ '' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' | ');
+ }
+ if (isRtl) {
+ parts.reverse();
+ }
+ skeletonEl = this.contentSkeletonEl = htmlToElement('' +
+ '
' +
+ '' + parts.join('') + '
' +
+ '
' +
+ '
');
+ this.colContainerEls = findElements(skeletonEl, '.fc-content-col');
+ this.mirrorContainerEls = findElements(skeletonEl, '.fc-mirror-container');
+ this.fgContainerEls = findElements(skeletonEl, '.fc-event-container:not(.fc-mirror-container)');
+ this.bgContainerEls = findElements(skeletonEl, '.fc-bgevent-container');
+ this.highlightContainerEls = findElements(skeletonEl, '.fc-highlight-container');
+ this.businessContainerEls = findElements(skeletonEl, '.fc-business-container');
+ if (isRtl) {
+ this.colContainerEls.reverse();
+ this.mirrorContainerEls.reverse();
+ this.fgContainerEls.reverse();
+ this.bgContainerEls.reverse();
+ this.highlightContainerEls.reverse();
+ this.businessContainerEls.reverse();
+ }
+ this.el.appendChild(skeletonEl);
+ };
+ TimeGrid.prototype.unrenderContentSkeleton = function () {
+ removeElement(this.contentSkeletonEl);
+ };
+ // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col
+ TimeGrid.prototype.groupSegsByCol = function (segs) {
+ var segsByCol = [];
+ var i;
+ for (i = 0; i < this.colCnt; i++) {
+ segsByCol.push([]);
+ }
+ for (i = 0; i < segs.length; i++) {
+ segsByCol[segs[i].col].push(segs[i]);
+ }
+ return segsByCol;
+ };
+ // Given segments grouped by column, insert the segments' elements into a parallel array of container
+ // elements, each living within a column.
+ TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) {
+ var col;
+ var segs;
+ var i;
+ for (col = 0; col < this.colCnt; col++) { // iterate each column grouping
+ segs = segsByCol[col];
+ for (i = 0; i < segs.length; i++) {
+ containerEls[col].appendChild(segs[i].el);
+ }
+ }
+ };
+ /* Now Indicator
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.getNowIndicatorUnit = function () {
+ return 'minute'; // will refresh on the minute
+ };
+ TimeGrid.prototype.renderNowIndicator = function (segs, date) {
+ // HACK: if date columns not ready for some reason (scheduler)
+ if (!this.colContainerEls) {
+ return;
+ }
+ var top = this.computeDateTop(date);
+ var nodes = [];
+ var i;
+ // render lines within the columns
+ for (i = 0; i < segs.length; i++) {
+ var lineEl = createElement('div', { className: 'fc-now-indicator fc-now-indicator-line' });
+ lineEl.style.top = top + 'px';
+ this.colContainerEls[segs[i].col].appendChild(lineEl);
+ nodes.push(lineEl);
+ }
+ // render an arrow over the axis
+ if (segs.length > 0) { // is the current time in view?
+ var arrowEl = createElement('div', { className: 'fc-now-indicator fc-now-indicator-arrow' });
+ arrowEl.style.top = top + 'px';
+ this.contentSkeletonEl.appendChild(arrowEl);
+ nodes.push(arrowEl);
+ }
+ this.nowIndicatorEls = nodes;
+ };
+ TimeGrid.prototype.unrenderNowIndicator = function () {
+ if (this.nowIndicatorEls) {
+ this.nowIndicatorEls.forEach(removeElement);
+ this.nowIndicatorEls = null;
+ }
+ };
+ /* Coordinates
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.getTotalSlatHeight = function () {
+ return this.slatContainerEl.getBoundingClientRect().height;
+ };
+ // Computes the top coordinate, relative to the bounds of the grid, of the given date.
+ // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
+ TimeGrid.prototype.computeDateTop = function (when, startOfDayDate) {
+ if (!startOfDayDate) {
+ startOfDayDate = startOfDay(when);
+ }
+ return this.computeTimeTop(createDuration(when.valueOf() - startOfDayDate.valueOf()));
+ };
+ // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).
+ TimeGrid.prototype.computeTimeTop = function (duration) {
+ var len = this.slatEls.length;
+ var dateProfile = this.props.dateProfile;
+ var slatCoverage = (duration.milliseconds - asRoughMs(dateProfile.minTime)) / asRoughMs(this.slotDuration); // floating-point value of # of slots covered
+ var slatIndex;
+ var slatRemainder;
+ // compute a floating-point number for how many slats should be progressed through.
+ // from 0 to number of slats (inclusive)
+ // constrained because minTime/maxTime might be customized.
+ slatCoverage = Math.max(0, slatCoverage);
+ slatCoverage = Math.min(len, slatCoverage);
+ // an integer index of the furthest whole slat
+ // from 0 to number slats (*exclusive*, so len-1)
+ slatIndex = Math.floor(slatCoverage);
+ slatIndex = Math.min(slatIndex, len - 1);
+ // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
+ // could be 1.0 if slatCoverage is covering *all* the slots
+ slatRemainder = slatCoverage - slatIndex;
+ return this.slatPositions.tops[slatIndex] +
+ this.slatPositions.getHeight(slatIndex) * slatRemainder;
+ };
+ // For each segment in an array, computes and assigns its top and bottom properties
+ TimeGrid.prototype.computeSegVerticals = function (segs) {
+ var options = this.context.options;
+ var eventMinHeight = options.timeGridEventMinHeight;
+ var i;
+ var seg;
+ var dayDate;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ dayDate = this.props.cells[seg.col].date;
+ seg.top = this.computeDateTop(seg.start, dayDate);
+ seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.end, dayDate));
+ }
+ };
+ // Given segments that already have their top/bottom properties computed, applies those values to
+ // the segments' elements.
+ TimeGrid.prototype.assignSegVerticals = function (segs) {
+ var i;
+ var seg;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ applyStyle(seg.el, this.generateSegVerticalCss(seg));
+ }
+ };
+ // Generates an object with CSS properties for the top/bottom coordinates of a segment element
+ TimeGrid.prototype.generateSegVerticalCss = function (seg) {
+ return {
+ top: seg.top,
+ bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container
+ };
+ };
+ /* Sizing
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.buildPositionCaches = function () {
+ this.buildColPositions();
+ this.buildSlatPositions();
+ };
+ TimeGrid.prototype.buildColPositions = function () {
+ this.colPositions.build();
+ };
+ TimeGrid.prototype.buildSlatPositions = function () {
+ this.slatPositions.build();
+ };
+ /* Hit System
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.positionToHit = function (positionLeft, positionTop) {
+ var dateEnv = this.context.dateEnv;
+ var _a = this, snapsPerSlot = _a.snapsPerSlot, slatPositions = _a.slatPositions, colPositions = _a.colPositions;
+ var colIndex = colPositions.leftToIndex(positionLeft);
+ var slatIndex = slatPositions.topToIndex(positionTop);
+ if (colIndex != null && slatIndex != null) {
+ var slatTop = slatPositions.tops[slatIndex];
+ var slatHeight = slatPositions.getHeight(slatIndex);
+ var partial = (positionTop - slatTop) / slatHeight; // floating point number between 0 and 1
+ var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat
+ var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
+ var dayDate = this.props.cells[colIndex].date;
+ var time = addDurations(this.props.dateProfile.minTime, multiplyDuration(this.snapDuration, snapIndex));
+ var start = dateEnv.add(dayDate, time);
+ var end = dateEnv.add(start, this.snapDuration);
+ return {
+ col: colIndex,
+ dateSpan: {
+ range: { start: start, end: end },
+ allDay: false
+ },
+ dayEl: this.colEls[colIndex],
+ relativeRect: {
+ left: colPositions.lefts[colIndex],
+ right: colPositions.rights[colIndex],
+ top: slatTop,
+ bottom: slatTop + slatHeight
+ }
+ };
+ }
+ };
+ /* Event Drag Visualization
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype._renderEventDrag = function (state) {
+ if (state) {
+ this.eventRenderer.hideByHash(state.affectedInstances);
+ if (state.isEvent) {
+ this.mirrorRenderer.renderSegs(this.context, state.segs, { isDragging: true, sourceSeg: state.sourceSeg });
+ }
+ else {
+ this.fillRenderer.renderSegs('highlight', this.context, state.segs);
+ }
+ }
+ };
+ TimeGrid.prototype._unrenderEventDrag = function (state) {
+ if (state) {
+ this.eventRenderer.showByHash(state.affectedInstances);
+ if (state.isEvent) {
+ this.mirrorRenderer.unrender(this.context, state.segs, { isDragging: true, sourceSeg: state.sourceSeg });
+ }
+ else {
+ this.fillRenderer.unrender('highlight', this.context);
+ }
+ }
+ };
+ /* Event Resize Visualization
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype._renderEventResize = function (state) {
+ if (state) {
+ this.eventRenderer.hideByHash(state.affectedInstances);
+ this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
+ }
+ };
+ TimeGrid.prototype._unrenderEventResize = function (state) {
+ if (state) {
+ this.eventRenderer.showByHash(state.affectedInstances);
+ this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
+ }
+ };
+ /* Selection
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.
+ TimeGrid.prototype._renderDateSelection = function (segs) {
+ if (segs) {
+ if (this.context.options.selectMirror) {
+ this.mirrorRenderer.renderSegs(this.context, segs, { isSelecting: true });
+ }
+ else {
+ this.fillRenderer.renderSegs('highlight', this.context, segs);
+ }
+ }
+ };
+ TimeGrid.prototype._unrenderDateSelection = function (segs) {
+ if (segs) {
+ if (this.context.options.selectMirror) {
+ this.mirrorRenderer.unrender(this.context, segs, { isSelecting: true });
+ }
+ else {
+ this.fillRenderer.unrender('highlight', this.context);
+ }
+ }
+ };
+ return TimeGrid;
+}(DateComponent));
+
+var AllDaySplitter = /** @class */ (function (_super) {
+ __extends(AllDaySplitter, _super);
+ function AllDaySplitter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ AllDaySplitter.prototype.getKeyInfo = function () {
+ return {
+ allDay: {},
+ timed: {}
+ };
+ };
+ AllDaySplitter.prototype.getKeysForDateSpan = function (dateSpan) {
+ if (dateSpan.allDay) {
+ return ['allDay'];
+ }
+ else {
+ return ['timed'];
+ }
+ };
+ AllDaySplitter.prototype.getKeysForEventDef = function (eventDef) {
+ if (!eventDef.allDay) {
+ return ['timed'];
+ }
+ else if (hasBgRendering(eventDef)) {
+ return ['timed', 'allDay'];
+ }
+ else {
+ return ['allDay'];
+ }
+ };
+ return AllDaySplitter;
+}(Splitter));
+
+var TIMEGRID_ALL_DAY_EVENT_LIMIT = 5;
+var WEEK_HEADER_FORMAT = createFormatter({ week: 'short' });
+/* An abstract class for all timegrid-related views. Displays one more columns with time slots running vertically.
+----------------------------------------------------------------------------------------------------------------------*/
+// Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
+// Responsible for managing width/height.
+var AbstractTimeGridView = /** @class */ (function (_super) {
+ __extends(AbstractTimeGridView, _super);
+ function AbstractTimeGridView() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.splitter = new AllDaySplitter();
+ _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
+ /* Header Render Methods
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Generates the HTML that will go before the day-of week header cells
+ _this.renderHeadIntroHtml = function () {
+ var _a = _this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;
+ var range = _this.props.dateProfile.renderRange;
+ var dayCnt = diffDays(range.start, range.end);
+ var weekText;
+ if (options.weekNumbers) {
+ weekText = dateEnv.format(range.start, WEEK_HEADER_FORMAT);
+ return '' +
+ '';
+ }
+ else {
+ return '';
+ }
+ };
+ /* Time Grid Render Methods
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
+ _this.renderTimeGridBgIntroHtml = function () {
+ var theme = _this.context.theme;
+ return ' | ';
+ };
+ // Generates the HTML that goes before all other types of cells.
+ // Affects content-skeleton, mirror-skeleton, highlight-skeleton for both the time-grid and day-grid.
+ _this.renderTimeGridIntroHtml = function () {
+ return ' | ';
+ };
+ /* Day Grid Render Methods
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Generates the HTML that goes before the all-day cells
+ _this.renderDayGridBgIntroHtml = function () {
+ var _a = _this.context, theme = _a.theme, options = _a.options;
+ return '' +
+ '' +
+ '' + // needed for matchCellWidths
+ getAllDayHtml(options) +
+ '' +
+ ' | ';
+ };
+ // Generates the HTML that goes before all other types of cells.
+ // Affects content-skeleton, mirror-skeleton, highlight-skeleton for both the time-grid and day-grid.
+ _this.renderDayGridIntroHtml = function () {
+ return ' | ';
+ };
+ return _this;
+ }
+ AbstractTimeGridView.prototype.render = function (props, context) {
+ _super.prototype.render.call(this, props, context);
+ this.renderSkeleton(context);
+ };
+ AbstractTimeGridView.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.renderSkeleton.unrender();
+ };
+ AbstractTimeGridView.prototype._renderSkeleton = function (context) {
+ this.el.classList.add('fc-timeGrid-view');
+ this.el.innerHTML = this.renderSkeletonHtml();
+ this.scroller = new ScrollComponent('hidden', // overflow x
+ 'auto' // overflow y
+ );
+ var timeGridWrapEl = this.scroller.el;
+ this.el.querySelector('.fc-body > tr > td').appendChild(timeGridWrapEl);
+ timeGridWrapEl.classList.add('fc-time-grid-container');
+ var timeGridEl = createElement('div', { className: 'fc-time-grid' });
+ timeGridWrapEl.appendChild(timeGridEl);
+ this.timeGrid = new TimeGrid(timeGridEl, {
+ renderBgIntroHtml: this.renderTimeGridBgIntroHtml,
+ renderIntroHtml: this.renderTimeGridIntroHtml
+ });
+ if (context.options.allDaySlot) { // should we display the "all-day" area?
+ this.dayGrid = new DayGrid(// the all-day subcomponent of this view
+ this.el.querySelector('.fc-day-grid'), {
+ renderNumberIntroHtml: this.renderDayGridIntroHtml,
+ renderBgIntroHtml: this.renderDayGridBgIntroHtml,
+ renderIntroHtml: this.renderDayGridIntroHtml,
+ colWeekNumbersVisible: false,
+ cellWeekNumbersVisible: false
+ });
+ // have the day-grid extend it's coordinate area over the
dividing the two grids
+ var dividerEl = this.el.querySelector('.fc-divider');
+ this.dayGrid.bottomCoordPadding = dividerEl.getBoundingClientRect().height;
+ }
+ };
+ AbstractTimeGridView.prototype._unrenderSkeleton = function () {
+ this.el.classList.remove('fc-timeGrid-view');
+ this.timeGrid.destroy();
+ if (this.dayGrid) {
+ this.dayGrid.destroy();
+ }
+ this.scroller.destroy();
+ };
+ /* Rendering
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Builds the HTML skeleton for the view.
+ // The day-grid and time-grid components will render inside containers defined by this HTML.
+ AbstractTimeGridView.prototype.renderSkeletonHtml = function () {
+ var _a = this.context, theme = _a.theme, options = _a.options;
+ return '' +
+ '' +
+ (options.columnHeader ?
+ '' +
+ '' +
+ '' +
+ '
' +
+ '' :
+ '') +
+ '' +
+ '' +
+ '' +
+ (options.allDaySlot ?
+ '' +
+ '' :
+ '') +
+ ' | ' +
+ '
' +
+ '' +
+ '
';
+ };
+ /* Now Indicator
+ ------------------------------------------------------------------------------------------------------------------*/
+ AbstractTimeGridView.prototype.getNowIndicatorUnit = function () {
+ return this.timeGrid.getNowIndicatorUnit();
+ };
+ // subclasses should implement
+ // renderNowIndicator(date: DateMarker) {
+ // }
+ AbstractTimeGridView.prototype.unrenderNowIndicator = function () {
+ this.timeGrid.unrenderNowIndicator();
+ };
+ /* Dimensions
+ ------------------------------------------------------------------------------------------------------------------*/
+ AbstractTimeGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
+ _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first
+ this.timeGrid.updateSize(isResize);
+ if (this.dayGrid) {
+ this.dayGrid.updateSize(isResize);
+ }
+ };
+ // Adjusts the vertical dimensions of the view to the specified values
+ AbstractTimeGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
+ var _this = this;
+ var eventLimit;
+ var scrollerHeight;
+ var scrollbarWidths;
+ // make all axis cells line up
+ this.axisWidth = matchCellWidths(findElements(this.el, '.fc-axis'));
+ // hack to give the view some height prior to timeGrid's columns being rendered
+ // TODO: separate setting height from scroller VS timeGrid.
+ if (!this.timeGrid.colEls) {
+ if (!isAuto) {
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
+ this.scroller.setHeight(scrollerHeight);
+ }
+ return;
+ }
+ // set of fake row elements that must compensate when scroller has scrollbars
+ var noScrollRowEls = findElements(this.el, '.fc-row').filter(function (node) {
+ return !_this.scroller.el.contains(node);
+ });
+ // reset all dimensions back to the original state
+ this.timeGrid.bottomRuleEl.style.display = 'none'; // will be shown later if this
is necessary
+ this.scroller.clear(); // sets height to 'auto' and clears overflow
+ noScrollRowEls.forEach(uncompensateScroll);
+ // limit number of events in the all-day area
+ if (this.dayGrid) {
+ this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
+ eventLimit = this.context.options.eventLimit;
+ if (eventLimit && typeof eventLimit !== 'number') {
+ eventLimit = TIMEGRID_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
+ }
+ if (eventLimit) {
+ this.dayGrid.limitRows(eventLimit);
+ }
+ }
+ if (!isAuto) { // should we force dimensions of the scroll container?
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
+ this.scroller.setHeight(scrollerHeight);
+ scrollbarWidths = this.scroller.getScrollbarWidths();
+ if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
+ // make the all-day and header rows lines up
+ noScrollRowEls.forEach(function (rowEl) {
+ compensateScroll(rowEl, scrollbarWidths);
+ });
+ // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
+ // and reapply the desired height to the scroller.
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
+ this.scroller.setHeight(scrollerHeight);
+ }
+ // guarantees the same scrollbar widths
+ this.scroller.lockOverflow(scrollbarWidths);
+ // if there's any space below the slats, show the horizontal rule.
+ // this won't cause any new overflow, because lockOverflow already called.
+ if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) {
+ this.timeGrid.bottomRuleEl.style.display = '';
+ }
+ }
+ };
+ // given a desired total height of the view, returns what the height of the scroller should be
+ AbstractTimeGridView.prototype.computeScrollerHeight = function (viewHeight) {
+ return viewHeight -
+ subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
+ };
+ /* Scroll
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Computes the initial pre-configured scroll state prior to allowing the user to change it
+ AbstractTimeGridView.prototype.computeDateScroll = function (duration) {
+ var top = this.timeGrid.computeTimeTop(duration);
+ // zoom can give weird floating-point values. rather scroll a little bit further
+ top = Math.ceil(top);
+ if (top) {
+ top++; // to overcome top border that slots beyond the first have. looks better
+ }
+ return { top: top };
+ };
+ AbstractTimeGridView.prototype.queryDateScroll = function () {
+ return { top: this.scroller.getScrollTop() };
+ };
+ AbstractTimeGridView.prototype.applyDateScroll = function (scroll) {
+ if (scroll.top !== undefined) {
+ this.scroller.setScrollTop(scroll.top);
+ }
+ };
+ // Generates an HTML attribute string for setting the width of the axis, if it is known
+ AbstractTimeGridView.prototype.axisStyleAttr = function () {
+ if (this.axisWidth != null) {
+ return 'style="width:' + this.axisWidth + 'px"';
+ }
+ return '';
+ };
+ return AbstractTimeGridView;
+}(View));
+AbstractTimeGridView.prototype.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering
+
+var SimpleTimeGrid = /** @class */ (function (_super) {
+ __extends(SimpleTimeGrid, _super);
+ function SimpleTimeGrid(timeGrid) {
+ var _this = _super.call(this, timeGrid.el) || this;
+ _this.buildDayRanges = memoize(buildDayRanges);
+ _this.slicer = new TimeGridSlicer();
+ _this.timeGrid = timeGrid;
+ return _this;
+ }
+ SimpleTimeGrid.prototype.firstContext = function (context) {
+ context.calendar.registerInteractiveComponent(this, {
+ el: this.timeGrid.el
+ });
+ };
+ SimpleTimeGrid.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.context.calendar.unregisterInteractiveComponent(this);
+ };
+ SimpleTimeGrid.prototype.render = function (props, context) {
+ var dateEnv = this.context.dateEnv;
+ var dateProfile = props.dateProfile, dayTable = props.dayTable;
+ var dayRanges = this.dayRanges = this.buildDayRanges(dayTable, dateProfile, dateEnv);
+ var timeGrid = this.timeGrid;
+ timeGrid.receiveContext(context); // hack because context is used in sliceProps
+ timeGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, null, context.calendar, timeGrid, dayRanges), { dateProfile: dateProfile, cells: dayTable.cells[0] }), context);
+ };
+ SimpleTimeGrid.prototype.renderNowIndicator = function (date) {
+ this.timeGrid.renderNowIndicator(this.slicer.sliceNowDate(date, this.timeGrid, this.dayRanges), date);
+ };
+ SimpleTimeGrid.prototype.buildPositionCaches = function () {
+ this.timeGrid.buildPositionCaches();
+ };
+ SimpleTimeGrid.prototype.queryHit = function (positionLeft, positionTop) {
+ var rawHit = this.timeGrid.positionToHit(positionLeft, positionTop);
+ if (rawHit) {
+ return {
+ component: this.timeGrid,
+ dateSpan: rawHit.dateSpan,
+ dayEl: rawHit.dayEl,
+ rect: {
+ left: rawHit.relativeRect.left,
+ right: rawHit.relativeRect.right,
+ top: rawHit.relativeRect.top,
+ bottom: rawHit.relativeRect.bottom
+ },
+ layer: 0
+ };
+ }
+ };
+ return SimpleTimeGrid;
+}(DateComponent));
+function buildDayRanges(dayTable, dateProfile, dateEnv) {
+ var ranges = [];
+ for (var _i = 0, _a = dayTable.headerDates; _i < _a.length; _i++) {
+ var date = _a[_i];
+ ranges.push({
+ start: dateEnv.add(date, dateProfile.minTime),
+ end: dateEnv.add(date, dateProfile.maxTime)
+ });
+ }
+ return ranges;
+}
+var TimeGridSlicer = /** @class */ (function (_super) {
+ __extends(TimeGridSlicer, _super);
+ function TimeGridSlicer() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TimeGridSlicer.prototype.sliceRange = function (range, dayRanges) {
+ var segs = [];
+ for (var col = 0; col < dayRanges.length; col++) {
+ var segRange = intersectRanges(range, dayRanges[col]);
+ if (segRange) {
+ segs.push({
+ start: segRange.start,
+ end: segRange.end,
+ isStart: segRange.start.valueOf() === range.start.valueOf(),
+ isEnd: segRange.end.valueOf() === range.end.valueOf(),
+ col: col
+ });
+ }
+ }
+ return segs;
+ };
+ return TimeGridSlicer;
+}(Slicer));
+
+var TimeGridView = /** @class */ (function (_super) {
+ __extends(TimeGridView, _super);
+ function TimeGridView() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.buildDayTable = memoize(buildDayTable);
+ return _this;
+ }
+ TimeGridView.prototype.render = function (props, context) {
+ _super.prototype.render.call(this, props, context); // for flags for updateSize. also _renderSkeleton/_unrenderSkeleton
+ var _a = this.props, dateProfile = _a.dateProfile, dateProfileGenerator = _a.dateProfileGenerator;
+ var nextDayThreshold = context.nextDayThreshold;
+ var dayTable = this.buildDayTable(dateProfile, dateProfileGenerator);
+ var splitProps = this.splitter.splitProps(props);
+ if (this.header) {
+ this.header.receiveProps({
+ dateProfile: dateProfile,
+ dates: dayTable.headerDates,
+ datesRepDistinctDays: true,
+ renderIntroHtml: this.renderHeadIntroHtml
+ }, context);
+ }
+ this.simpleTimeGrid.receiveProps(__assign({}, splitProps['timed'], { dateProfile: dateProfile,
+ dayTable: dayTable }), context);
+ if (this.simpleDayGrid) {
+ this.simpleDayGrid.receiveProps(__assign({}, splitProps['allDay'], { dateProfile: dateProfile,
+ dayTable: dayTable,
+ nextDayThreshold: nextDayThreshold, isRigid: false }), context);
+ }
+ this.startNowIndicator(dateProfile, dateProfileGenerator);
+ };
+ TimeGridView.prototype._renderSkeleton = function (context) {
+ _super.prototype._renderSkeleton.call(this, context);
+ if (context.options.columnHeader) {
+ this.header = new DayHeader(this.el.querySelector('.fc-head-container'));
+ }
+ this.simpleTimeGrid = new SimpleTimeGrid(this.timeGrid);
+ if (this.dayGrid) {
+ this.simpleDayGrid = new SimpleDayGrid(this.dayGrid);
+ }
+ };
+ TimeGridView.prototype._unrenderSkeleton = function () {
+ _super.prototype._unrenderSkeleton.call(this);
+ if (this.header) {
+ this.header.destroy();
+ }
+ this.simpleTimeGrid.destroy();
+ if (this.simpleDayGrid) {
+ this.simpleDayGrid.destroy();
+ }
+ };
+ TimeGridView.prototype.renderNowIndicator = function (date) {
+ this.simpleTimeGrid.renderNowIndicator(date);
+ };
+ return TimeGridView;
+}(AbstractTimeGridView));
+function buildDayTable(dateProfile, dateProfileGenerator) {
+ var daySeries = new DaySeries(dateProfile.renderRange, dateProfileGenerator);
+ return new DayTable(daySeries, false);
+}
+
+var main = createPlugin({
+ defaultView: 'timeGridWeek',
+ views: {
+ timeGrid: {
+ class: TimeGridView,
+ allDaySlot: true,
+ slotDuration: '00:30:00',
+ slotEventOverlap: true // a bad name. confused with overlap/constraint system
+ },
+ timeGridDay: {
+ type: 'timeGrid',
+ duration: { days: 1 }
+ },
+ timeGridWeek: {
+ type: 'timeGrid',
+ duration: { weeks: 1 }
+ }
+ }
+});
+
+export default main;
+export { AbstractTimeGridView, TimeGrid, TimeGridSlicer, TimeGridView, buildDayRanges, buildDayTable };
diff --git a/lib/fullcalendar/timegrid/main.js b/lib/fullcalendar/timegrid/main.js
new file mode 100644
index 0000000..d64a8a2
--- /dev/null
+++ b/lib/fullcalendar/timegrid/main.js
@@ -0,0 +1,1403 @@
+/*!
+FullCalendar Time Grid Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core'), require('@fullcalendar/daygrid')) :
+ typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core', '@fullcalendar/daygrid'], factory) :
+ (global = global || self, factory(global.FullCalendarTimeGrid = {}, global.FullCalendar, global.FullCalendarDayGrid));
+}(this, function (exports, core, daygrid) { 'use strict';
+
+ /*! *****************************************************************************
+ Copyright (c) Microsoft Corporation.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ ***************************************************************************** */
+ /* global Reflect, Promise */
+
+ var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+
+ function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ }
+
+ var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
+
+ /*
+ Only handles foreground segs.
+ Does not own rendering. Use for low-level util methods by TimeGrid.
+ */
+ var TimeGridEventRenderer = /** @class */ (function (_super) {
+ __extends(TimeGridEventRenderer, _super);
+ function TimeGridEventRenderer(timeGrid) {
+ var _this = _super.call(this) || this;
+ _this.timeGrid = timeGrid;
+ return _this;
+ }
+ TimeGridEventRenderer.prototype.renderSegs = function (context, segs, mirrorInfo) {
+ _super.prototype.renderSegs.call(this, context, segs, mirrorInfo);
+ // TODO: dont do every time. memoize
+ this.fullTimeFormat = core.createFormatter({
+ hour: 'numeric',
+ minute: '2-digit',
+ separator: this.context.options.defaultRangeSeparator
+ });
+ };
+ // Given an array of foreground segments, render a DOM element for each, computes position,
+ // and attaches to the column inner-container elements.
+ TimeGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
+ var segsByCol = this.timeGrid.groupSegsByCol(segs);
+ // order the segs within each column
+ // TODO: have groupSegsByCol do this?
+ for (var col = 0; col < segsByCol.length; col++) {
+ segsByCol[col] = this.sortEventSegs(segsByCol[col]);
+ }
+ this.segsByCol = segsByCol;
+ this.timeGrid.attachSegsByCol(segsByCol, this.timeGrid.fgContainerEls);
+ };
+ TimeGridEventRenderer.prototype.detachSegs = function (segs) {
+ segs.forEach(function (seg) {
+ core.removeElement(seg.el);
+ });
+ this.segsByCol = null;
+ };
+ TimeGridEventRenderer.prototype.computeSegSizes = function (allSegs) {
+ var _a = this, timeGrid = _a.timeGrid, segsByCol = _a.segsByCol;
+ var colCnt = timeGrid.colCnt;
+ timeGrid.computeSegVerticals(allSegs); // horizontals relies on this
+ if (segsByCol) {
+ for (var col = 0; col < colCnt; col++) {
+ this.computeSegHorizontals(segsByCol[col]); // compute horizontal coordinates, z-index's, and reorder the array
+ }
+ }
+ };
+ TimeGridEventRenderer.prototype.assignSegSizes = function (allSegs) {
+ var _a = this, timeGrid = _a.timeGrid, segsByCol = _a.segsByCol;
+ var colCnt = timeGrid.colCnt;
+ timeGrid.assignSegVerticals(allSegs); // horizontals relies on this
+ if (segsByCol) {
+ for (var col = 0; col < colCnt; col++) {
+ this.assignSegCss(segsByCol[col]);
+ }
+ }
+ };
+ // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined
+ TimeGridEventRenderer.prototype.computeEventTimeFormat = function () {
+ return {
+ hour: 'numeric',
+ minute: '2-digit',
+ meridiem: false
+ };
+ };
+ // Computes a default `displayEventEnd` value if one is not expliclty defined
+ TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () {
+ return true;
+ };
+ // Renders the HTML for a single event segment's default rendering
+ TimeGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) {
+ var eventRange = seg.eventRange;
+ var eventDef = eventRange.def;
+ var eventUi = eventRange.ui;
+ var allDay = eventDef.allDay;
+ var isDraggable = core.computeEventDraggable(this.context, eventDef, eventUi);
+ var isResizableFromStart = seg.isStart && core.computeEventStartResizable(this.context, eventDef, eventUi);
+ var isResizableFromEnd = seg.isEnd && core.computeEventEndResizable(this.context, eventDef, eventUi);
+ var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo);
+ var skinCss = core.cssToStr(this.getSkinCss(eventUi));
+ var timeText;
+ var fullTimeText; // more verbose time text. for the print stylesheet
+ var startTimeText; // just the start time text
+ classes.unshift('fc-time-grid-event');
+ // if the event appears to span more than one day...
+ if (core.isMultiDayRange(eventRange.range)) {
+ // Don't display time text on segments that run entirely through a day.
+ // That would appear as midnight-midnight and would look dumb.
+ // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
+ if (seg.isStart || seg.isEnd) {
+ var unzonedStart = seg.start;
+ var unzonedEnd = seg.end;
+ timeText = this._getTimeText(unzonedStart, unzonedEnd, allDay); // TODO: give the timezones
+ fullTimeText = this._getTimeText(unzonedStart, unzonedEnd, allDay, this.fullTimeFormat);
+ startTimeText = this._getTimeText(unzonedStart, unzonedEnd, allDay, null, false); // displayEnd=false
+ }
+ }
+ else {
+ // Display the normal time text for the *event's* times
+ timeText = this.getTimeText(eventRange);
+ fullTimeText = this.getTimeText(eventRange, this.fullTimeFormat);
+ startTimeText = this.getTimeText(eventRange, null, false); // displayEnd=false
+ }
+ return '' +
+ '' +
+ (timeText ?
+ '
' +
+ '' + core.htmlEscape(timeText) + '' +
+ '
' :
+ '') +
+ (eventDef.title ?
+ '
' +
+ core.htmlEscape(eventDef.title) +
+ '
' :
+ '') +
+ '
' +
+ /* TODO: write CSS for this
+ (isResizableFromStart ?
+ '' :
+ ''
+ ) +
+ */
+ (isResizableFromEnd ?
+ '' :
+ '') +
+ '';
+ };
+ // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.
+ // Assumed the segs are already ordered.
+ // NOTE: Also reorders the given array by date!
+ TimeGridEventRenderer.prototype.computeSegHorizontals = function (segs) {
+ var levels;
+ var level0;
+ var i;
+ levels = buildSlotSegLevels(segs);
+ computeForwardSlotSegs(levels);
+ if ((level0 = levels[0])) {
+ for (i = 0; i < level0.length; i++) {
+ computeSlotSegPressures(level0[i]);
+ }
+ for (i = 0; i < level0.length; i++) {
+ this.computeSegForwardBack(level0[i], 0, 0);
+ }
+ }
+ };
+ // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
+ // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
+ // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
+ //
+ // The segment might be part of a "series", which means consecutive segments with the same pressure
+ // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
+ // segments behind this one in the current series, and `seriesBackwardCoord` is the starting
+ // coordinate of the first segment in the series.
+ TimeGridEventRenderer.prototype.computeSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {
+ var forwardSegs = seg.forwardSegs;
+ var i;
+ 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;
+ }
+ else {
+ // sort highest pressure first
+ this.sortForwardSegs(forwardSegs);
+ // this segment's forwardCoord will be calculated from the backwardCoord of the
+ // highest-pressure forward segment.
+ this.computeSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
+ seg.forwardCoord = forwardSegs[0].backwardCoord;
+ }
+ // calculate the backwardCoord from the forwardCoord. consider the series
+ seg.backwardCoord = seg.forwardCoord -
+ (seg.forwardCoord - seriesBackwardCoord) / // available width for series
+ (seriesBackwardPressure + 1); // # of segments in the series
+ // use this segment's coordinates to computed the coordinates of the less-pressurized
+ // forward segments
+ for (i = 0; i < forwardSegs.length; i++) {
+ this.computeSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);
+ }
+ }
+ };
+ TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) {
+ var objs = forwardSegs.map(buildTimeGridSegCompareObj);
+ var specs = [
+ // put higher-pressure first
+ { field: 'forwardPressure', order: -1 },
+ // put segments that are closer to initial edge first (and favor ones with no coords yet)
+ { field: 'backwardCoord', order: 1 }
+ ].concat(this.context.eventOrderSpecs);
+ objs.sort(function (obj0, obj1) {
+ return core.compareByFieldSpecs(obj0, obj1, specs);
+ });
+ return objs.map(function (c) {
+ return c._seg;
+ });
+ };
+ // Given foreground event segments that have already had their position coordinates computed,
+ // assigns position-related CSS values to their elements.
+ TimeGridEventRenderer.prototype.assignSegCss = function (segs) {
+ for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
+ var seg = segs_1[_i];
+ core.applyStyle(seg.el, this.generateSegCss(seg));
+ if (seg.level > 0) {
+ seg.el.classList.add('fc-time-grid-event-inset');
+ }
+ // 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.eventRange.def.title && seg.bottom - seg.top < 30) {
+ seg.el.classList.add('fc-short'); // TODO: "condensed" is a better name
+ }
+ }
+ };
+ // Generates an object with CSS properties/values that should be applied to an event segment element.
+ // Contains important positioning-related properties that should be applied to any event element, customized or not.
+ TimeGridEventRenderer.prototype.generateSegCss = function (seg) {
+ var shouldOverlap = this.context.options.slotEventOverlap;
+ var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point
+ var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point
+ var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first
+ var isRtl = this.context.isRtl;
+ var left; // amount of space from left edge, a fraction of the total width
+ var right; // amount of space from right edge, a fraction of the total width
+ if (shouldOverlap) {
+ // double the width, but don't go beyond the maximum forward coordinate (1.0)
+ forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);
+ }
+ if (isRtl) {
+ left = 1 - forwardCoord;
+ right = backwardCoord;
+ }
+ else {
+ left = backwardCoord;
+ right = 1 - forwardCoord;
+ }
+ props.zIndex = seg.level + 1; // convert from 0-base to 1-based
+ props.left = left * 100 + '%';
+ props.right = right * 100 + '%';
+ if (shouldOverlap && seg.forwardPressure) {
+ // add padding to the edge so that forward stacked events don't cover the resizer's icon
+ props[isRtl ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width
+ }
+ return props;
+ };
+ return TimeGridEventRenderer;
+ }(core.FgEventRenderer));
+ // Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is
+ // left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.
+ function buildSlotSegLevels(segs) {
+ var levels = [];
+ var i;
+ var seg;
+ var j;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ // go through all the levels and stop on the first level where there are no collisions
+ for (j = 0; j < levels.length; j++) {
+ if (!computeSlotSegCollisions(seg, levels[j]).length) {
+ break;
+ }
+ }
+ seg.level = j;
+ (levels[j] || (levels[j] = [])).push(seg);
+ }
+ return levels;
+ }
+ // For every segment, figure out the other segments that are in subsequent
+ // levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
+ function computeForwardSlotSegs(levels) {
+ var i;
+ var level;
+ var j;
+ var seg;
+ var k;
+ for (i = 0; i < levels.length; i++) {
+ level = levels[i];
+ for (j = 0; j < level.length; j++) {
+ seg = level[j];
+ seg.forwardSegs = [];
+ for (k = i + 1; k < levels.length; k++) {
+ computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
+ }
+ }
+ }
+ }
+ // Figure out which path forward (via seg.forwardSegs) results in the longest path until
+ // the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
+ function computeSlotSegPressures(seg) {
+ var forwardSegs = seg.forwardSegs;
+ var forwardPressure = 0;
+ var i;
+ var forwardSeg;
+ 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
+ computeSlotSegPressures(forwardSeg);
+ // either use the existing maximum, or use the child's forward pressure
+ // plus one (for the forwardSeg itself)
+ forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);
+ }
+ seg.forwardPressure = forwardPressure;
+ }
+ }
+ // Find all the segments in `otherSegs` that vertically collide with `seg`.
+ // Append into an optionally-supplied `results` array and return.
+ function computeSlotSegCollisions(seg, otherSegs, results) {
+ if (results === void 0) { results = []; }
+ for (var i = 0; i < otherSegs.length; i++) {
+ if (isSlotSegCollision(seg, otherSegs[i])) {
+ results.push(otherSegs[i]);
+ }
+ }
+ return results;
+ }
+ // Do these segments occupy the same vertical space?
+ function isSlotSegCollision(seg1, seg2) {
+ return seg1.bottom > seg2.top && seg1.top < seg2.bottom;
+ }
+ function buildTimeGridSegCompareObj(seg) {
+ var obj = core.buildSegCompareObj(seg);
+ obj.forwardPressure = seg.forwardPressure;
+ obj.backwardCoord = seg.backwardCoord;
+ return obj;
+ }
+
+ var TimeGridMirrorRenderer = /** @class */ (function (_super) {
+ __extends(TimeGridMirrorRenderer, _super);
+ function TimeGridMirrorRenderer() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TimeGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) {
+ this.segsByCol = this.timeGrid.groupSegsByCol(segs);
+ this.timeGrid.attachSegsByCol(this.segsByCol, this.timeGrid.mirrorContainerEls);
+ this.sourceSeg = mirrorInfo.sourceSeg;
+ };
+ TimeGridMirrorRenderer.prototype.generateSegCss = function (seg) {
+ var props = _super.prototype.generateSegCss.call(this, seg);
+ var sourceSeg = this.sourceSeg;
+ if (sourceSeg && sourceSeg.col === seg.col) {
+ var sourceSegProps = _super.prototype.generateSegCss.call(this, sourceSeg);
+ props.left = sourceSegProps.left;
+ props.right = sourceSegProps.right;
+ props.marginLeft = sourceSegProps.marginLeft;
+ props.marginRight = sourceSegProps.marginRight;
+ }
+ return props;
+ };
+ return TimeGridMirrorRenderer;
+ }(TimeGridEventRenderer));
+
+ var TimeGridFillRenderer = /** @class */ (function (_super) {
+ __extends(TimeGridFillRenderer, _super);
+ function TimeGridFillRenderer(timeGrid) {
+ var _this = _super.call(this) || this;
+ _this.timeGrid = timeGrid;
+ return _this;
+ }
+ TimeGridFillRenderer.prototype.attachSegs = function (type, segs) {
+ var timeGrid = this.timeGrid;
+ var containerEls;
+ // TODO: more efficient lookup
+ if (type === 'bgEvent') {
+ containerEls = timeGrid.bgContainerEls;
+ }
+ else if (type === 'businessHours') {
+ containerEls = timeGrid.businessContainerEls;
+ }
+ else if (type === 'highlight') {
+ containerEls = timeGrid.highlightContainerEls;
+ }
+ timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls);
+ return segs.map(function (seg) {
+ return seg.el;
+ });
+ };
+ TimeGridFillRenderer.prototype.computeSegSizes = function (segs) {
+ this.timeGrid.computeSegVerticals(segs);
+ };
+ TimeGridFillRenderer.prototype.assignSegSizes = function (segs) {
+ this.timeGrid.assignSegVerticals(segs);
+ };
+ return TimeGridFillRenderer;
+ }(core.FillRenderer));
+
+ /* A component that renders one or more columns of vertical time slots
+ ----------------------------------------------------------------------------------------------------------------------*/
+ // potential nice values for the slot-duration and interval-duration
+ // from largest to smallest
+ var AGENDA_STOCK_SUB_DURATIONS = [
+ { hours: 1 },
+ { minutes: 30 },
+ { minutes: 15 },
+ { seconds: 30 },
+ { seconds: 15 }
+ ];
+ var TimeGrid = /** @class */ (function (_super) {
+ __extends(TimeGrid, _super);
+ function TimeGrid(el, renderProps) {
+ var _this = _super.call(this, el) || this;
+ _this.isSlatSizesDirty = false;
+ _this.isColSizesDirty = false;
+ _this.processOptions = core.memoize(_this._processOptions);
+ _this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton);
+ _this.renderSlats = core.memoizeRendering(_this._renderSlats, null, [_this.renderSkeleton]);
+ _this.renderColumns = core.memoizeRendering(_this._renderColumns, _this._unrenderColumns, [_this.renderSkeleton]);
+ _this.renderProps = renderProps;
+ var renderColumns = _this.renderColumns;
+ var eventRenderer = _this.eventRenderer = new TimeGridEventRenderer(_this);
+ var fillRenderer = _this.fillRenderer = new TimeGridFillRenderer(_this);
+ _this.mirrorRenderer = new TimeGridMirrorRenderer(_this);
+ _this.renderBusinessHours = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderColumns]);
+ _this.renderDateSelection = core.memoizeRendering(_this._renderDateSelection, _this._unrenderDateSelection, [renderColumns]);
+ _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderColumns]);
+ _this.renderBgEvents = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderColumns]);
+ _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]);
+ _this.renderEventDrag = core.memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderColumns]);
+ _this.renderEventResize = core.memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderColumns]);
+ return _this;
+ }
+ /* Options
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Parses various options into properties of this object
+ // MUST have context already set
+ TimeGrid.prototype._processOptions = function (options) {
+ var slotDuration = options.slotDuration, snapDuration = options.snapDuration;
+ var snapsPerSlot;
+ var input;
+ slotDuration = core.createDuration(slotDuration);
+ snapDuration = snapDuration ? core.createDuration(snapDuration) : slotDuration;
+ snapsPerSlot = core.wholeDivideDurations(slotDuration, snapDuration);
+ if (snapsPerSlot === null) {
+ snapDuration = slotDuration;
+ snapsPerSlot = 1;
+ // TODO: say warning?
+ }
+ this.slotDuration = slotDuration;
+ this.snapDuration = snapDuration;
+ this.snapsPerSlot = snapsPerSlot;
+ // might be an array value (for TimelineView).
+ // if so, getting the most granular entry (the last one probably).
+ input = options.slotLabelFormat;
+ if (Array.isArray(input)) {
+ input = input[input.length - 1];
+ }
+ this.labelFormat = core.createFormatter(input || {
+ hour: 'numeric',
+ minute: '2-digit',
+ omitZeroMinute: true,
+ meridiem: 'short'
+ });
+ input = options.slotLabelInterval;
+ this.labelInterval = input ?
+ core.createDuration(input) :
+ this.computeLabelInterval(slotDuration);
+ };
+ // Computes an automatic value for slotLabelInterval
+ TimeGrid.prototype.computeLabelInterval = function (slotDuration) {
+ var i;
+ var labelInterval;
+ var slotsPerLabel;
+ // find the smallest stock label interval that results in more than one slots-per-label
+ for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {
+ labelInterval = core.createDuration(AGENDA_STOCK_SUB_DURATIONS[i]);
+ slotsPerLabel = core.wholeDivideDurations(labelInterval, slotDuration);
+ if (slotsPerLabel !== null && slotsPerLabel > 1) {
+ return labelInterval;
+ }
+ }
+ return slotDuration; // fall back
+ };
+ /* Rendering
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.render = function (props, context) {
+ this.processOptions(context.options);
+ var cells = props.cells;
+ this.colCnt = cells.length;
+ this.renderSkeleton(context.theme);
+ this.renderSlats(props.dateProfile);
+ this.renderColumns(props.cells, props.dateProfile);
+ this.renderBusinessHours(context, props.businessHourSegs);
+ this.renderDateSelection(props.dateSelectionSegs);
+ this.renderFgEvents(context, props.fgEventSegs);
+ this.renderBgEvents(context, props.bgEventSegs);
+ this.renderEventSelection(props.eventSelection);
+ this.renderEventDrag(props.eventDrag);
+ this.renderEventResize(props.eventResize);
+ };
+ TimeGrid.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ // should unrender everything else too
+ this.renderSlats.unrender();
+ this.renderColumns.unrender();
+ this.renderSkeleton.unrender();
+ };
+ TimeGrid.prototype.updateSize = function (isResize) {
+ var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer;
+ if (isResize || this.isSlatSizesDirty) {
+ this.buildSlatPositions();
+ this.isSlatSizesDirty = false;
+ }
+ if (isResize || this.isColSizesDirty) {
+ this.buildColPositions();
+ this.isColSizesDirty = false;
+ }
+ fillRenderer.computeSizes(isResize);
+ eventRenderer.computeSizes(isResize);
+ mirrorRenderer.computeSizes(isResize);
+ fillRenderer.assignSizes(isResize);
+ eventRenderer.assignSizes(isResize);
+ mirrorRenderer.assignSizes(isResize);
+ };
+ TimeGrid.prototype._renderSkeleton = function (theme) {
+ var el = this.el;
+ el.innerHTML =
+ '' +
+ '' +
+ '';
+ this.rootBgContainerEl = el.querySelector('.fc-bg');
+ this.slatContainerEl = el.querySelector('.fc-slats');
+ this.bottomRuleEl = el.querySelector('.fc-divider');
+ };
+ TimeGrid.prototype._renderSlats = function (dateProfile) {
+ var theme = this.context.theme;
+ this.slatContainerEl.innerHTML =
+ '' +
+ this.renderSlatRowHtml(dateProfile) +
+ '
';
+ this.slatEls = core.findElements(this.slatContainerEl, 'tr');
+ this.slatPositions = new core.PositionCache(this.el, this.slatEls, false, true // vertical
+ );
+ this.isSlatSizesDirty = true;
+ };
+ // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
+ TimeGrid.prototype.renderSlatRowHtml = function (dateProfile) {
+ var _a = this.context, dateEnv = _a.dateEnv, theme = _a.theme, isRtl = _a.isRtl;
+ var html = '';
+ var dayStart = core.startOfDay(dateProfile.renderRange.start);
+ var slotTime = dateProfile.minTime;
+ var slotIterator = core.createDuration(0);
+ var slotDate; // will be on the view's first day, but we only care about its time
+ var isLabeled;
+ var axisHtml;
+ // Calculate the time for each slot
+ while (core.asRoughMs(slotTime) < core.asRoughMs(dateProfile.maxTime)) {
+ slotDate = dateEnv.add(dayStart, slotTime);
+ isLabeled = core.wholeDivideDurations(slotIterator, this.labelInterval) !== null;
+ axisHtml =
+ '' +
+ (isLabeled ?
+ '' + // for matchCellWidths
+ core.htmlEscape(dateEnv.format(slotDate, this.labelFormat)) +
+ '' :
+ '') +
+ ' | ';
+ html +=
+ '' +
+ (!isRtl ? axisHtml : '') +
+ ' | ' +
+ (isRtl ? axisHtml : '') +
+ '
';
+ slotTime = core.addDurations(slotTime, this.slotDuration);
+ slotIterator = core.addDurations(slotIterator, this.slotDuration);
+ }
+ return html;
+ };
+ TimeGrid.prototype._renderColumns = function (cells, dateProfile) {
+ var _a = this.context, calendar = _a.calendar, view = _a.view, isRtl = _a.isRtl, theme = _a.theme, dateEnv = _a.dateEnv;
+ var bgRow = new daygrid.DayBgRow(this.context);
+ this.rootBgContainerEl.innerHTML =
+ '' +
+ bgRow.renderHtml({
+ cells: cells,
+ dateProfile: dateProfile,
+ renderIntroHtml: this.renderProps.renderBgIntroHtml
+ }) +
+ '
';
+ this.colEls = core.findElements(this.el, '.fc-day, .fc-disabled-day');
+ for (var col = 0; col < this.colCnt; col++) {
+ calendar.publiclyTrigger('dayRender', [
+ {
+ date: dateEnv.toDate(cells[col].date),
+ el: this.colEls[col],
+ view: view
+ }
+ ]);
+ }
+ if (isRtl) {
+ this.colEls.reverse();
+ }
+ this.colPositions = new core.PositionCache(this.el, this.colEls, true, // horizontal
+ false);
+ this.renderContentSkeleton();
+ this.isColSizesDirty = true;
+ };
+ TimeGrid.prototype._unrenderColumns = function () {
+ this.unrenderContentSkeleton();
+ };
+ /* Content Skeleton
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Renders the DOM that the view's content will live in
+ TimeGrid.prototype.renderContentSkeleton = function () {
+ var isRtl = this.context.isRtl;
+ var parts = [];
+ var skeletonEl;
+ parts.push(this.renderProps.renderIntroHtml());
+ for (var i = 0; i < this.colCnt; i++) {
+ parts.push('' +
+ '' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' | ');
+ }
+ if (isRtl) {
+ parts.reverse();
+ }
+ skeletonEl = this.contentSkeletonEl = core.htmlToElement('' +
+ '
' +
+ '' + parts.join('') + '
' +
+ '
' +
+ '
');
+ this.colContainerEls = core.findElements(skeletonEl, '.fc-content-col');
+ this.mirrorContainerEls = core.findElements(skeletonEl, '.fc-mirror-container');
+ this.fgContainerEls = core.findElements(skeletonEl, '.fc-event-container:not(.fc-mirror-container)');
+ this.bgContainerEls = core.findElements(skeletonEl, '.fc-bgevent-container');
+ this.highlightContainerEls = core.findElements(skeletonEl, '.fc-highlight-container');
+ this.businessContainerEls = core.findElements(skeletonEl, '.fc-business-container');
+ if (isRtl) {
+ this.colContainerEls.reverse();
+ this.mirrorContainerEls.reverse();
+ this.fgContainerEls.reverse();
+ this.bgContainerEls.reverse();
+ this.highlightContainerEls.reverse();
+ this.businessContainerEls.reverse();
+ }
+ this.el.appendChild(skeletonEl);
+ };
+ TimeGrid.prototype.unrenderContentSkeleton = function () {
+ core.removeElement(this.contentSkeletonEl);
+ };
+ // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col
+ TimeGrid.prototype.groupSegsByCol = function (segs) {
+ var segsByCol = [];
+ var i;
+ for (i = 0; i < this.colCnt; i++) {
+ segsByCol.push([]);
+ }
+ for (i = 0; i < segs.length; i++) {
+ segsByCol[segs[i].col].push(segs[i]);
+ }
+ return segsByCol;
+ };
+ // Given segments grouped by column, insert the segments' elements into a parallel array of container
+ // elements, each living within a column.
+ TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) {
+ var col;
+ var segs;
+ var i;
+ for (col = 0; col < this.colCnt; col++) { // iterate each column grouping
+ segs = segsByCol[col];
+ for (i = 0; i < segs.length; i++) {
+ containerEls[col].appendChild(segs[i].el);
+ }
+ }
+ };
+ /* Now Indicator
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.getNowIndicatorUnit = function () {
+ return 'minute'; // will refresh on the minute
+ };
+ TimeGrid.prototype.renderNowIndicator = function (segs, date) {
+ // HACK: if date columns not ready for some reason (scheduler)
+ if (!this.colContainerEls) {
+ return;
+ }
+ var top = this.computeDateTop(date);
+ var nodes = [];
+ var i;
+ // render lines within the columns
+ for (i = 0; i < segs.length; i++) {
+ var lineEl = core.createElement('div', { className: 'fc-now-indicator fc-now-indicator-line' });
+ lineEl.style.top = top + 'px';
+ this.colContainerEls[segs[i].col].appendChild(lineEl);
+ nodes.push(lineEl);
+ }
+ // render an arrow over the axis
+ if (segs.length > 0) { // is the current time in view?
+ var arrowEl = core.createElement('div', { className: 'fc-now-indicator fc-now-indicator-arrow' });
+ arrowEl.style.top = top + 'px';
+ this.contentSkeletonEl.appendChild(arrowEl);
+ nodes.push(arrowEl);
+ }
+ this.nowIndicatorEls = nodes;
+ };
+ TimeGrid.prototype.unrenderNowIndicator = function () {
+ if (this.nowIndicatorEls) {
+ this.nowIndicatorEls.forEach(core.removeElement);
+ this.nowIndicatorEls = null;
+ }
+ };
+ /* Coordinates
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.getTotalSlatHeight = function () {
+ return this.slatContainerEl.getBoundingClientRect().height;
+ };
+ // Computes the top coordinate, relative to the bounds of the grid, of the given date.
+ // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
+ TimeGrid.prototype.computeDateTop = function (when, startOfDayDate) {
+ if (!startOfDayDate) {
+ startOfDayDate = core.startOfDay(when);
+ }
+ return this.computeTimeTop(core.createDuration(when.valueOf() - startOfDayDate.valueOf()));
+ };
+ // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).
+ TimeGrid.prototype.computeTimeTop = function (duration) {
+ var len = this.slatEls.length;
+ var dateProfile = this.props.dateProfile;
+ var slatCoverage = (duration.milliseconds - core.asRoughMs(dateProfile.minTime)) / core.asRoughMs(this.slotDuration); // floating-point value of # of slots covered
+ var slatIndex;
+ var slatRemainder;
+ // compute a floating-point number for how many slats should be progressed through.
+ // from 0 to number of slats (inclusive)
+ // constrained because minTime/maxTime might be customized.
+ slatCoverage = Math.max(0, slatCoverage);
+ slatCoverage = Math.min(len, slatCoverage);
+ // an integer index of the furthest whole slat
+ // from 0 to number slats (*exclusive*, so len-1)
+ slatIndex = Math.floor(slatCoverage);
+ slatIndex = Math.min(slatIndex, len - 1);
+ // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
+ // could be 1.0 if slatCoverage is covering *all* the slots
+ slatRemainder = slatCoverage - slatIndex;
+ return this.slatPositions.tops[slatIndex] +
+ this.slatPositions.getHeight(slatIndex) * slatRemainder;
+ };
+ // For each segment in an array, computes and assigns its top and bottom properties
+ TimeGrid.prototype.computeSegVerticals = function (segs) {
+ var options = this.context.options;
+ var eventMinHeight = options.timeGridEventMinHeight;
+ var i;
+ var seg;
+ var dayDate;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ dayDate = this.props.cells[seg.col].date;
+ seg.top = this.computeDateTop(seg.start, dayDate);
+ seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.end, dayDate));
+ }
+ };
+ // Given segments that already have their top/bottom properties computed, applies those values to
+ // the segments' elements.
+ TimeGrid.prototype.assignSegVerticals = function (segs) {
+ var i;
+ var seg;
+ for (i = 0; i < segs.length; i++) {
+ seg = segs[i];
+ core.applyStyle(seg.el, this.generateSegVerticalCss(seg));
+ }
+ };
+ // Generates an object with CSS properties for the top/bottom coordinates of a segment element
+ TimeGrid.prototype.generateSegVerticalCss = function (seg) {
+ return {
+ top: seg.top,
+ bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container
+ };
+ };
+ /* Sizing
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.buildPositionCaches = function () {
+ this.buildColPositions();
+ this.buildSlatPositions();
+ };
+ TimeGrid.prototype.buildColPositions = function () {
+ this.colPositions.build();
+ };
+ TimeGrid.prototype.buildSlatPositions = function () {
+ this.slatPositions.build();
+ };
+ /* Hit System
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype.positionToHit = function (positionLeft, positionTop) {
+ var dateEnv = this.context.dateEnv;
+ var _a = this, snapsPerSlot = _a.snapsPerSlot, slatPositions = _a.slatPositions, colPositions = _a.colPositions;
+ var colIndex = colPositions.leftToIndex(positionLeft);
+ var slatIndex = slatPositions.topToIndex(positionTop);
+ if (colIndex != null && slatIndex != null) {
+ var slatTop = slatPositions.tops[slatIndex];
+ var slatHeight = slatPositions.getHeight(slatIndex);
+ var partial = (positionTop - slatTop) / slatHeight; // floating point number between 0 and 1
+ var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat
+ var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
+ var dayDate = this.props.cells[colIndex].date;
+ var time = core.addDurations(this.props.dateProfile.minTime, core.multiplyDuration(this.snapDuration, snapIndex));
+ var start = dateEnv.add(dayDate, time);
+ var end = dateEnv.add(start, this.snapDuration);
+ return {
+ col: colIndex,
+ dateSpan: {
+ range: { start: start, end: end },
+ allDay: false
+ },
+ dayEl: this.colEls[colIndex],
+ relativeRect: {
+ left: colPositions.lefts[colIndex],
+ right: colPositions.rights[colIndex],
+ top: slatTop,
+ bottom: slatTop + slatHeight
+ }
+ };
+ }
+ };
+ /* Event Drag Visualization
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype._renderEventDrag = function (state) {
+ if (state) {
+ this.eventRenderer.hideByHash(state.affectedInstances);
+ if (state.isEvent) {
+ this.mirrorRenderer.renderSegs(this.context, state.segs, { isDragging: true, sourceSeg: state.sourceSeg });
+ }
+ else {
+ this.fillRenderer.renderSegs('highlight', this.context, state.segs);
+ }
+ }
+ };
+ TimeGrid.prototype._unrenderEventDrag = function (state) {
+ if (state) {
+ this.eventRenderer.showByHash(state.affectedInstances);
+ if (state.isEvent) {
+ this.mirrorRenderer.unrender(this.context, state.segs, { isDragging: true, sourceSeg: state.sourceSeg });
+ }
+ else {
+ this.fillRenderer.unrender('highlight', this.context);
+ }
+ }
+ };
+ /* Event Resize Visualization
+ ------------------------------------------------------------------------------------------------------------------*/
+ TimeGrid.prototype._renderEventResize = function (state) {
+ if (state) {
+ this.eventRenderer.hideByHash(state.affectedInstances);
+ this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
+ }
+ };
+ TimeGrid.prototype._unrenderEventResize = function (state) {
+ if (state) {
+ this.eventRenderer.showByHash(state.affectedInstances);
+ this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg });
+ }
+ };
+ /* Selection
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.
+ TimeGrid.prototype._renderDateSelection = function (segs) {
+ if (segs) {
+ if (this.context.options.selectMirror) {
+ this.mirrorRenderer.renderSegs(this.context, segs, { isSelecting: true });
+ }
+ else {
+ this.fillRenderer.renderSegs('highlight', this.context, segs);
+ }
+ }
+ };
+ TimeGrid.prototype._unrenderDateSelection = function (segs) {
+ if (segs) {
+ if (this.context.options.selectMirror) {
+ this.mirrorRenderer.unrender(this.context, segs, { isSelecting: true });
+ }
+ else {
+ this.fillRenderer.unrender('highlight', this.context);
+ }
+ }
+ };
+ return TimeGrid;
+ }(core.DateComponent));
+
+ var AllDaySplitter = /** @class */ (function (_super) {
+ __extends(AllDaySplitter, _super);
+ function AllDaySplitter() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ AllDaySplitter.prototype.getKeyInfo = function () {
+ return {
+ allDay: {},
+ timed: {}
+ };
+ };
+ AllDaySplitter.prototype.getKeysForDateSpan = function (dateSpan) {
+ if (dateSpan.allDay) {
+ return ['allDay'];
+ }
+ else {
+ return ['timed'];
+ }
+ };
+ AllDaySplitter.prototype.getKeysForEventDef = function (eventDef) {
+ if (!eventDef.allDay) {
+ return ['timed'];
+ }
+ else if (core.hasBgRendering(eventDef)) {
+ return ['timed', 'allDay'];
+ }
+ else {
+ return ['allDay'];
+ }
+ };
+ return AllDaySplitter;
+ }(core.Splitter));
+
+ var TIMEGRID_ALL_DAY_EVENT_LIMIT = 5;
+ var WEEK_HEADER_FORMAT = core.createFormatter({ week: 'short' });
+ /* An abstract class for all timegrid-related views. Displays one more columns with time slots running vertically.
+ ----------------------------------------------------------------------------------------------------------------------*/
+ // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
+ // Responsible for managing width/height.
+ var AbstractTimeGridView = /** @class */ (function (_super) {
+ __extends(AbstractTimeGridView, _super);
+ function AbstractTimeGridView() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.splitter = new AllDaySplitter();
+ _this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton);
+ /* Header Render Methods
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Generates the HTML that will go before the day-of week header cells
+ _this.renderHeadIntroHtml = function () {
+ var _a = _this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options;
+ var range = _this.props.dateProfile.renderRange;
+ var dayCnt = core.diffDays(range.start, range.end);
+ var weekText;
+ if (options.weekNumbers) {
+ weekText = dateEnv.format(range.start, WEEK_HEADER_FORMAT);
+ return '' +
+ '';
+ }
+ else {
+ return '';
+ }
+ };
+ /* Time Grid Render Methods
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
+ _this.renderTimeGridBgIntroHtml = function () {
+ var theme = _this.context.theme;
+ return ' | ';
+ };
+ // Generates the HTML that goes before all other types of cells.
+ // Affects content-skeleton, mirror-skeleton, highlight-skeleton for both the time-grid and day-grid.
+ _this.renderTimeGridIntroHtml = function () {
+ return ' | ';
+ };
+ /* Day Grid Render Methods
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Generates the HTML that goes before the all-day cells
+ _this.renderDayGridBgIntroHtml = function () {
+ var _a = _this.context, theme = _a.theme, options = _a.options;
+ return '' +
+ '' +
+ '' + // needed for matchCellWidths
+ core.getAllDayHtml(options) +
+ '' +
+ ' | ';
+ };
+ // Generates the HTML that goes before all other types of cells.
+ // Affects content-skeleton, mirror-skeleton, highlight-skeleton for both the time-grid and day-grid.
+ _this.renderDayGridIntroHtml = function () {
+ return ' | ';
+ };
+ return _this;
+ }
+ AbstractTimeGridView.prototype.render = function (props, context) {
+ _super.prototype.render.call(this, props, context);
+ this.renderSkeleton(context);
+ };
+ AbstractTimeGridView.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.renderSkeleton.unrender();
+ };
+ AbstractTimeGridView.prototype._renderSkeleton = function (context) {
+ this.el.classList.add('fc-timeGrid-view');
+ this.el.innerHTML = this.renderSkeletonHtml();
+ this.scroller = new core.ScrollComponent('hidden', // overflow x
+ 'auto' // overflow y
+ );
+ var timeGridWrapEl = this.scroller.el;
+ this.el.querySelector('.fc-body > tr > td').appendChild(timeGridWrapEl);
+ timeGridWrapEl.classList.add('fc-time-grid-container');
+ var timeGridEl = core.createElement('div', { className: 'fc-time-grid' });
+ timeGridWrapEl.appendChild(timeGridEl);
+ this.timeGrid = new TimeGrid(timeGridEl, {
+ renderBgIntroHtml: this.renderTimeGridBgIntroHtml,
+ renderIntroHtml: this.renderTimeGridIntroHtml
+ });
+ if (context.options.allDaySlot) { // should we display the "all-day" area?
+ this.dayGrid = new daygrid.DayGrid(// the all-day subcomponent of this view
+ this.el.querySelector('.fc-day-grid'), {
+ renderNumberIntroHtml: this.renderDayGridIntroHtml,
+ renderBgIntroHtml: this.renderDayGridBgIntroHtml,
+ renderIntroHtml: this.renderDayGridIntroHtml,
+ colWeekNumbersVisible: false,
+ cellWeekNumbersVisible: false
+ });
+ // have the day-grid extend it's coordinate area over the
dividing the two grids
+ var dividerEl = this.el.querySelector('.fc-divider');
+ this.dayGrid.bottomCoordPadding = dividerEl.getBoundingClientRect().height;
+ }
+ };
+ AbstractTimeGridView.prototype._unrenderSkeleton = function () {
+ this.el.classList.remove('fc-timeGrid-view');
+ this.timeGrid.destroy();
+ if (this.dayGrid) {
+ this.dayGrid.destroy();
+ }
+ this.scroller.destroy();
+ };
+ /* Rendering
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Builds the HTML skeleton for the view.
+ // The day-grid and time-grid components will render inside containers defined by this HTML.
+ AbstractTimeGridView.prototype.renderSkeletonHtml = function () {
+ var _a = this.context, theme = _a.theme, options = _a.options;
+ return '' +
+ '' +
+ (options.columnHeader ?
+ '' +
+ '' +
+ '' +
+ '
' +
+ '' :
+ '') +
+ '' +
+ '' +
+ '' +
+ (options.allDaySlot ?
+ '' +
+ '' :
+ '') +
+ ' | ' +
+ '
' +
+ '' +
+ '
';
+ };
+ /* Now Indicator
+ ------------------------------------------------------------------------------------------------------------------*/
+ AbstractTimeGridView.prototype.getNowIndicatorUnit = function () {
+ return this.timeGrid.getNowIndicatorUnit();
+ };
+ // subclasses should implement
+ // renderNowIndicator(date: DateMarker) {
+ // }
+ AbstractTimeGridView.prototype.unrenderNowIndicator = function () {
+ this.timeGrid.unrenderNowIndicator();
+ };
+ /* Dimensions
+ ------------------------------------------------------------------------------------------------------------------*/
+ AbstractTimeGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) {
+ _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first
+ this.timeGrid.updateSize(isResize);
+ if (this.dayGrid) {
+ this.dayGrid.updateSize(isResize);
+ }
+ };
+ // Adjusts the vertical dimensions of the view to the specified values
+ AbstractTimeGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) {
+ var _this = this;
+ var eventLimit;
+ var scrollerHeight;
+ var scrollbarWidths;
+ // make all axis cells line up
+ this.axisWidth = core.matchCellWidths(core.findElements(this.el, '.fc-axis'));
+ // hack to give the view some height prior to timeGrid's columns being rendered
+ // TODO: separate setting height from scroller VS timeGrid.
+ if (!this.timeGrid.colEls) {
+ if (!isAuto) {
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
+ this.scroller.setHeight(scrollerHeight);
+ }
+ return;
+ }
+ // set of fake row elements that must compensate when scroller has scrollbars
+ var noScrollRowEls = core.findElements(this.el, '.fc-row').filter(function (node) {
+ return !_this.scroller.el.contains(node);
+ });
+ // reset all dimensions back to the original state
+ this.timeGrid.bottomRuleEl.style.display = 'none'; // will be shown later if this
is necessary
+ this.scroller.clear(); // sets height to 'auto' and clears overflow
+ noScrollRowEls.forEach(core.uncompensateScroll);
+ // limit number of events in the all-day area
+ if (this.dayGrid) {
+ this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
+ eventLimit = this.context.options.eventLimit;
+ if (eventLimit && typeof eventLimit !== 'number') {
+ eventLimit = TIMEGRID_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
+ }
+ if (eventLimit) {
+ this.dayGrid.limitRows(eventLimit);
+ }
+ }
+ if (!isAuto) { // should we force dimensions of the scroll container?
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
+ this.scroller.setHeight(scrollerHeight);
+ scrollbarWidths = this.scroller.getScrollbarWidths();
+ if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
+ // make the all-day and header rows lines up
+ noScrollRowEls.forEach(function (rowEl) {
+ core.compensateScroll(rowEl, scrollbarWidths);
+ });
+ // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
+ // and reapply the desired height to the scroller.
+ scrollerHeight = this.computeScrollerHeight(viewHeight);
+ this.scroller.setHeight(scrollerHeight);
+ }
+ // guarantees the same scrollbar widths
+ this.scroller.lockOverflow(scrollbarWidths);
+ // if there's any space below the slats, show the horizontal rule.
+ // this won't cause any new overflow, because lockOverflow already called.
+ if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) {
+ this.timeGrid.bottomRuleEl.style.display = '';
+ }
+ }
+ };
+ // given a desired total height of the view, returns what the height of the scroller should be
+ AbstractTimeGridView.prototype.computeScrollerHeight = function (viewHeight) {
+ return viewHeight -
+ core.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
+ };
+ /* Scroll
+ ------------------------------------------------------------------------------------------------------------------*/
+ // Computes the initial pre-configured scroll state prior to allowing the user to change it
+ AbstractTimeGridView.prototype.computeDateScroll = function (duration) {
+ var top = this.timeGrid.computeTimeTop(duration);
+ // zoom can give weird floating-point values. rather scroll a little bit further
+ top = Math.ceil(top);
+ if (top) {
+ top++; // to overcome top border that slots beyond the first have. looks better
+ }
+ return { top: top };
+ };
+ AbstractTimeGridView.prototype.queryDateScroll = function () {
+ return { top: this.scroller.getScrollTop() };
+ };
+ AbstractTimeGridView.prototype.applyDateScroll = function (scroll) {
+ if (scroll.top !== undefined) {
+ this.scroller.setScrollTop(scroll.top);
+ }
+ };
+ // Generates an HTML attribute string for setting the width of the axis, if it is known
+ AbstractTimeGridView.prototype.axisStyleAttr = function () {
+ if (this.axisWidth != null) {
+ return 'style="width:' + this.axisWidth + 'px"';
+ }
+ return '';
+ };
+ return AbstractTimeGridView;
+ }(core.View));
+ AbstractTimeGridView.prototype.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering
+
+ var SimpleTimeGrid = /** @class */ (function (_super) {
+ __extends(SimpleTimeGrid, _super);
+ function SimpleTimeGrid(timeGrid) {
+ var _this = _super.call(this, timeGrid.el) || this;
+ _this.buildDayRanges = core.memoize(buildDayRanges);
+ _this.slicer = new TimeGridSlicer();
+ _this.timeGrid = timeGrid;
+ return _this;
+ }
+ SimpleTimeGrid.prototype.firstContext = function (context) {
+ context.calendar.registerInteractiveComponent(this, {
+ el: this.timeGrid.el
+ });
+ };
+ SimpleTimeGrid.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.context.calendar.unregisterInteractiveComponent(this);
+ };
+ SimpleTimeGrid.prototype.render = function (props, context) {
+ var dateEnv = this.context.dateEnv;
+ var dateProfile = props.dateProfile, dayTable = props.dayTable;
+ var dayRanges = this.dayRanges = this.buildDayRanges(dayTable, dateProfile, dateEnv);
+ var timeGrid = this.timeGrid;
+ timeGrid.receiveContext(context); // hack because context is used in sliceProps
+ timeGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, null, context.calendar, timeGrid, dayRanges), { dateProfile: dateProfile, cells: dayTable.cells[0] }), context);
+ };
+ SimpleTimeGrid.prototype.renderNowIndicator = function (date) {
+ this.timeGrid.renderNowIndicator(this.slicer.sliceNowDate(date, this.timeGrid, this.dayRanges), date);
+ };
+ SimpleTimeGrid.prototype.buildPositionCaches = function () {
+ this.timeGrid.buildPositionCaches();
+ };
+ SimpleTimeGrid.prototype.queryHit = function (positionLeft, positionTop) {
+ var rawHit = this.timeGrid.positionToHit(positionLeft, positionTop);
+ if (rawHit) {
+ return {
+ component: this.timeGrid,
+ dateSpan: rawHit.dateSpan,
+ dayEl: rawHit.dayEl,
+ rect: {
+ left: rawHit.relativeRect.left,
+ right: rawHit.relativeRect.right,
+ top: rawHit.relativeRect.top,
+ bottom: rawHit.relativeRect.bottom
+ },
+ layer: 0
+ };
+ }
+ };
+ return SimpleTimeGrid;
+ }(core.DateComponent));
+ function buildDayRanges(dayTable, dateProfile, dateEnv) {
+ var ranges = [];
+ for (var _i = 0, _a = dayTable.headerDates; _i < _a.length; _i++) {
+ var date = _a[_i];
+ ranges.push({
+ start: dateEnv.add(date, dateProfile.minTime),
+ end: dateEnv.add(date, dateProfile.maxTime)
+ });
+ }
+ return ranges;
+ }
+ var TimeGridSlicer = /** @class */ (function (_super) {
+ __extends(TimeGridSlicer, _super);
+ function TimeGridSlicer() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TimeGridSlicer.prototype.sliceRange = function (range, dayRanges) {
+ var segs = [];
+ for (var col = 0; col < dayRanges.length; col++) {
+ var segRange = core.intersectRanges(range, dayRanges[col]);
+ if (segRange) {
+ segs.push({
+ start: segRange.start,
+ end: segRange.end,
+ isStart: segRange.start.valueOf() === range.start.valueOf(),
+ isEnd: segRange.end.valueOf() === range.end.valueOf(),
+ col: col
+ });
+ }
+ }
+ return segs;
+ };
+ return TimeGridSlicer;
+ }(core.Slicer));
+
+ var TimeGridView = /** @class */ (function (_super) {
+ __extends(TimeGridView, _super);
+ function TimeGridView() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.buildDayTable = core.memoize(buildDayTable);
+ return _this;
+ }
+ TimeGridView.prototype.render = function (props, context) {
+ _super.prototype.render.call(this, props, context); // for flags for updateSize. also _renderSkeleton/_unrenderSkeleton
+ var _a = this.props, dateProfile = _a.dateProfile, dateProfileGenerator = _a.dateProfileGenerator;
+ var nextDayThreshold = context.nextDayThreshold;
+ var dayTable = this.buildDayTable(dateProfile, dateProfileGenerator);
+ var splitProps = this.splitter.splitProps(props);
+ if (this.header) {
+ this.header.receiveProps({
+ dateProfile: dateProfile,
+ dates: dayTable.headerDates,
+ datesRepDistinctDays: true,
+ renderIntroHtml: this.renderHeadIntroHtml
+ }, context);
+ }
+ this.simpleTimeGrid.receiveProps(__assign({}, splitProps['timed'], { dateProfile: dateProfile,
+ dayTable: dayTable }), context);
+ if (this.simpleDayGrid) {
+ this.simpleDayGrid.receiveProps(__assign({}, splitProps['allDay'], { dateProfile: dateProfile,
+ dayTable: dayTable,
+ nextDayThreshold: nextDayThreshold, isRigid: false }), context);
+ }
+ this.startNowIndicator(dateProfile, dateProfileGenerator);
+ };
+ TimeGridView.prototype._renderSkeleton = function (context) {
+ _super.prototype._renderSkeleton.call(this, context);
+ if (context.options.columnHeader) {
+ this.header = new core.DayHeader(this.el.querySelector('.fc-head-container'));
+ }
+ this.simpleTimeGrid = new SimpleTimeGrid(this.timeGrid);
+ if (this.dayGrid) {
+ this.simpleDayGrid = new daygrid.SimpleDayGrid(this.dayGrid);
+ }
+ };
+ TimeGridView.prototype._unrenderSkeleton = function () {
+ _super.prototype._unrenderSkeleton.call(this);
+ if (this.header) {
+ this.header.destroy();
+ }
+ this.simpleTimeGrid.destroy();
+ if (this.simpleDayGrid) {
+ this.simpleDayGrid.destroy();
+ }
+ };
+ TimeGridView.prototype.renderNowIndicator = function (date) {
+ this.simpleTimeGrid.renderNowIndicator(date);
+ };
+ return TimeGridView;
+ }(AbstractTimeGridView));
+ function buildDayTable(dateProfile, dateProfileGenerator) {
+ var daySeries = new core.DaySeries(dateProfile.renderRange, dateProfileGenerator);
+ return new core.DayTable(daySeries, false);
+ }
+
+ var main = core.createPlugin({
+ defaultView: 'timeGridWeek',
+ views: {
+ timeGrid: {
+ class: TimeGridView,
+ allDaySlot: true,
+ slotDuration: '00:30:00',
+ slotEventOverlap: true // a bad name. confused with overlap/constraint system
+ },
+ timeGridDay: {
+ type: 'timeGrid',
+ duration: { days: 1 }
+ },
+ timeGridWeek: {
+ type: 'timeGrid',
+ duration: { weeks: 1 }
+ }
+ }
+ });
+
+ exports.AbstractTimeGridView = AbstractTimeGridView;
+ exports.TimeGrid = TimeGrid;
+ exports.TimeGridSlicer = TimeGridSlicer;
+ exports.TimeGridView = TimeGridView;
+ exports.buildDayRanges = buildDayRanges;
+ exports.buildDayTable = buildDayTable;
+ exports.default = main;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+}));
diff --git a/lib/fullcalendar/timegrid/main.min.css b/lib/fullcalendar/timegrid/main.min.css
new file mode 100644
index 0000000..a1abf91
--- /dev/null
+++ b/lib/fullcalendar/timegrid/main.min.css
@@ -0,0 +1 @@
+@charset "UTF-8";.fc-timeGrid-view .fc-day-grid{position:relative;z-index:2}.fc-timeGrid-view .fc-day-grid .fc-row{min-height:3em}.fc-timeGrid-view .fc-day-grid .fc-row .fc-content-skeleton{padding-bottom:1em}.fc .fc-axis{vertical-align:middle;padding:0 4px;white-space:nowrap}.fc-ltr .fc-axis{text-align:right}.fc-rtl .fc-axis{text-align:left}.fc-time-grid,.fc-time-grid-container{position:relative;z-index:1}.fc-time-grid{min-height:100%}.fc-time-grid table{border:0 hidden transparent}.fc-time-grid>.fc-bg{z-index:1}.fc-time-grid .fc-slats,.fc-time-grid>hr{position:relative;z-index:2}.fc-time-grid .fc-content-col{position:relative}.fc-time-grid .fc-content-skeleton{position:absolute;z-index:3;top:0;left:0;right:0}.fc-time-grid .fc-business-container{position:relative;z-index:1}.fc-time-grid .fc-bgevent-container{position:relative;z-index:2}.fc-time-grid .fc-highlight-container{z-index:3;position:relative}.fc-time-grid .fc-event-container{position:relative;z-index:4}.fc-time-grid .fc-now-indicator-line{z-index:5}.fc-time-grid .fc-mirror-container{position:relative;z-index:6}.fc-time-grid .fc-slats td{height:1.5em;border-bottom:0}.fc-time-grid .fc-slats .fc-minor td{border-top-style:dotted}.fc-time-grid .fc-highlight{position:absolute;left:0;right:0}.fc-ltr .fc-time-grid .fc-event-container{margin:0 2.5% 0 2px}.fc-rtl .fc-time-grid .fc-event-container{margin:0 2px 0 2.5%}.fc-time-grid .fc-bgevent,.fc-time-grid .fc-event{position:absolute;z-index:1}.fc-time-grid .fc-bgevent{left:0;right:0}.fc-time-grid-event{margin-bottom:1px}.fc-time-grid-event-inset{-webkit-box-shadow:0 0 0 1px #fff;box-shadow:0 0 0 1px #fff}.fc-time-grid-event.fc-not-start{border-top-width:0;padding-top:1px;border-top-left-radius:0;border-top-right-radius:0}.fc-time-grid-event.fc-not-end{border-bottom-width:0;padding-bottom:1px;border-bottom-left-radius:0;border-bottom-right-radius:0}.fc-time-grid-event .fc-content{overflow:hidden;max-height:100%}.fc-time-grid-event .fc-time,.fc-time-grid-event .fc-title{padding:0 1px}.fc-time-grid-event .fc-time{font-size:.85em;white-space:nowrap}.fc-time-grid-event.fc-short .fc-content{white-space:nowrap}.fc-time-grid-event.fc-short .fc-time,.fc-time-grid-event.fc-short .fc-title{display:inline-block;vertical-align:top}.fc-time-grid-event.fc-short .fc-time span{display:none}.fc-time-grid-event.fc-short .fc-time:before{content:attr(data-start)}.fc-time-grid-event.fc-short .fc-time:after{content:" - "}.fc-time-grid-event.fc-short .fc-title{font-size:.85em;padding:0}.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer{left:0;right:0;bottom:0;height:8px;overflow:hidden;line-height:8px;font-size:11px;font-family:monospace;text-align:center;cursor:s-resize}.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer:after{content:"="}.fc-time-grid-event.fc-selected .fc-resizer{border-radius:5px;border-width:1px;width:8px;height:8px;border-style:solid;border-color:inherit;background:#fff;left:50%;margin-left:-5px;bottom:-5px}.fc-time-grid .fc-now-indicator-line{border-top-width:1px;left:0;right:0}.fc-time-grid .fc-now-indicator-arrow{margin-top:-5px}.fc-ltr .fc-time-grid .fc-now-indicator-arrow{left:0;border-width:5px 0 5px 6px;border-top-color:transparent;border-bottom-color:transparent}.fc-rtl .fc-time-grid .fc-now-indicator-arrow{right:0;border-width:5px 6px 5px 0;border-top-color:transparent;border-bottom-color:transparent}
\ No newline at end of file
diff --git a/lib/fullcalendar/timegrid/main.min.js b/lib/fullcalendar/timegrid/main.min.js
new file mode 100644
index 0000000..106940f
--- /dev/null
+++ b/lib/fullcalendar/timegrid/main.min.js
@@ -0,0 +1,6 @@
+/*!
+FullCalendar Time Grid Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@fullcalendar/core"),require("@fullcalendar/daygrid")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core","@fullcalendar/daygrid"],t):t((e=e||self).FullCalendarTimeGrid={},e.FullCalendar,e.FullCalendarDayGrid)}(this,(function(e,t,r){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,i=arguments.length;r'+(i?'
'+t.htmlEscape(i)+"
":"")+(a.title?'
'+t.htmlEscape(a.title)+"
":"")+"
"+(u?'':"")+"