diff options
author | Mario <mario@mariovavti.com> | 2023-01-25 13:08:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-01-25 13:08:05 +0000 |
commit | 08e925758e920b898ac2d08710eab2f9638fe276 (patch) | |
tree | fed0f7b2ee8251c6534d446b3166096889c9aeb3 /library/fullcalendar/packages/daygrid | |
parent | 213c8a6eeccc16c34d3a34229a810bd213837c56 (diff) | |
download | volse-hubzilla-08e925758e920b898ac2d08710eab2f9638fe276.tar.gz volse-hubzilla-08e925758e920b898ac2d08710eab2f9638fe276.tar.bz2 volse-hubzilla-08e925758e920b898ac2d08710eab2f9638fe276.zip |
update fullcalendar library
Diffstat (limited to 'library/fullcalendar/packages/daygrid')
-rw-r--r-- | library/fullcalendar/packages/daygrid/LICENSE.txt | 20 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/README.md | 8 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/main.css | 78 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/main.d.ts | 316 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/main.esm.js | 1655 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/main.js | 1669 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/main.min.css | 1 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/main.min.js | 6 | ||||
-rw-r--r-- | library/fullcalendar/packages/daygrid/package.json | 33 |
9 files changed, 0 insertions, 3786 deletions
diff --git a/library/fullcalendar/packages/daygrid/LICENSE.txt b/library/fullcalendar/packages/daygrid/LICENSE.txt deleted file mode 100644 index 2149cfbef..000000000 --- a/library/fullcalendar/packages/daygrid/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2019 Adam Shaw - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/library/fullcalendar/packages/daygrid/README.md b/library/fullcalendar/packages/daygrid/README.md deleted file mode 100644 index e00936542..000000000 --- a/library/fullcalendar/packages/daygrid/README.md +++ /dev/null @@ -1,8 +0,0 @@ - -# FullCalendar Day Grid Plugin - -Display events on Month view or DayGrid view - -[View the docs »](https://fullcalendar.io/docs/month-view) - -This package was created from the [FullCalendar monorepo »](https://github.com/fullcalendar/fullcalendar) diff --git a/library/fullcalendar/packages/daygrid/main.css b/library/fullcalendar/packages/daygrid/main.css deleted file mode 100644 index 81f589554..000000000 --- a/library/fullcalendar/packages/daygrid/main.css +++ /dev/null @@ -1,78 +0,0 @@ -/* DayGridView ---------------------------------------------------------------------------------------------------*/ -/* day row structure */ -.fc-dayGridWeek-view .fc-content-skeleton, -.fc-dayGridDay-view .fc-content-skeleton { - /* there may be week numbers in these views, so no padding-top */ - padding-bottom: 1em; - /* ensure a space at bottom of cell for user selecting/clicking */ -} - -.fc-dayGrid-view .fc-body .fc-row { - min-height: 4em; - /* ensure that all rows are at least this tall */ -} - -/* a "rigid" row will take up a constant amount of height because content-skeleton is absolute */ -.fc-row.fc-rigid { - overflow: hidden; -} - -.fc-row.fc-rigid .fc-content-skeleton { - position: absolute; - top: 0; - left: 0; - right: 0; -} - -/* week and day number styling */ -.fc-day-top.fc-other-month { - opacity: 0.3; -} - -.fc-dayGrid-view .fc-week-number, -.fc-dayGrid-view .fc-day-number { - padding: 2px; -} - -.fc-dayGrid-view th.fc-week-number, -.fc-dayGrid-view th.fc-day-number { - padding: 0 2px; - /* column headers can't have as much v space */ -} - -.fc-ltr .fc-dayGrid-view .fc-day-top .fc-day-number { - float: right; -} - -.fc-rtl .fc-dayGrid-view .fc-day-top .fc-day-number { - float: left; -} - -.fc-ltr .fc-dayGrid-view .fc-day-top .fc-week-number { - float: left; - border-radius: 0 0 3px 0; -} - -.fc-rtl .fc-dayGrid-view .fc-day-top .fc-week-number { - float: right; - border-radius: 0 0 0 3px; -} - -.fc-dayGrid-view .fc-day-top .fc-week-number { - min-width: 1.5em; - text-align: center; - background-color: #f2f2f2; - color: #808080; -} - -/* when week/day number have own column */ -.fc-dayGrid-view td.fc-week-number { - text-align: center; -} - -.fc-dayGrid-view td.fc-week-number > * { - /* work around the way we do column resizing and ensure a minimum width */ - display: inline-block; - min-width: 1.25em; -} diff --git a/library/fullcalendar/packages/daygrid/main.d.ts b/library/fullcalendar/packages/daygrid/main.d.ts deleted file mode 100644 index 312ddd97b..000000000 --- a/library/fullcalendar/packages/daygrid/main.d.ts +++ /dev/null @@ -1,316 +0,0 @@ -// Generated by dts-bundle v0.7.3-fork.1 -// Dependencies for this module: -// ../../../../../@fullcalendar/core - -declare module '@fullcalendar/daygrid' { - export { default as SimpleDayGrid, DayGridSlicer } from '@fullcalendar/daygrid/SimpleDayGrid'; - export { default as DayGrid, DayGridSeg } from '@fullcalendar/daygrid/DayGrid'; - export { default as AbstractDayGridView } from '@fullcalendar/daygrid/AbstractDayGridView'; - export { default as DayGridView, buildDayTable as buildBasicDayTable } from '@fullcalendar/daygrid/DayGridView'; - export { default as DayBgRow } from '@fullcalendar/daygrid/DayBgRow'; - const _default: import("@fullcalendar/core").PluginDef; - export default _default; -} - -declare module '@fullcalendar/daygrid/SimpleDayGrid' { - import { DateProfile, EventStore, EventUiHash, DateSpan, EventInteractionState, DayTable, Duration, DateComponent, DateRange, Slicer, Hit, ComponentContext } from '@fullcalendar/core'; - import { default as DayGrid, DayGridSeg } from '@fullcalendar/daygrid/DayGrid'; - export interface SimpleDayGridProps { - dateProfile: DateProfile | null; - dayTable: DayTable; - nextDayThreshold: Duration; - businessHours: EventStore; - eventStore: EventStore; - eventUiBases: EventUiHash; - dateSelection: DateSpan | null; - eventSelection: string; - eventDrag: EventInteractionState | null; - eventResize: EventInteractionState | null; - isRigid: boolean; - } - export { SimpleDayGrid as default, SimpleDayGrid }; - class SimpleDayGrid extends DateComponent<SimpleDayGridProps> { - dayGrid: DayGrid; - constructor(dayGrid: DayGrid); - firstContext(context: ComponentContext): void; - destroy(): void; - render(props: SimpleDayGridProps, context: ComponentContext): void; - buildPositionCaches(): void; - queryHit(positionLeft: number, positionTop: number): Hit; - } - export class DayGridSlicer extends Slicer<DayGridSeg, [DayTable]> { - sliceRange(dateRange: DateRange, dayTable: DayTable): DayGridSeg[]; - } -} - -declare module '@fullcalendar/daygrid/DayGrid' { - import { PositionCache, DateMarker, DateComponent, EventSegUiInteractionState, Seg, DateProfile, ComponentContext } from '@fullcalendar/core'; - import Popover from '@fullcalendar/daygrid/Popover'; - import DayGridEventRenderer from '@fullcalendar/daygrid/DayGridEventRenderer'; - import DayTile from '@fullcalendar/daygrid/DayTile'; - export interface RenderProps { - renderNumberIntroHtml: (row: number, dayGrid: DayGrid) => string; - renderBgIntroHtml: () => string; - renderIntroHtml: () => string; - colWeekNumbersVisible: boolean; - cellWeekNumbersVisible: boolean; - } - export interface DayGridSeg extends Seg { - row: number; - firstCol: number; - lastCol: number; - } - export interface DayGridCell { - date: DateMarker; - htmlAttrs?: string; - } - export interface DayGridProps { - dateProfile: DateProfile; - cells: DayGridCell[][]; - businessHourSegs: DayGridSeg[]; - bgEventSegs: DayGridSeg[]; - fgEventSegs: DayGridSeg[]; - dateSelectionSegs: DayGridSeg[]; - eventSelection: string; - eventDrag: EventSegUiInteractionState | null; - eventResize: EventSegUiInteractionState | null; - isRigid: boolean; - } - export { DayGrid as default, DayGrid }; - class DayGrid extends DateComponent<DayGridProps> { - eventRenderer: DayGridEventRenderer; - renderProps: RenderProps; - rowCnt: number; - colCnt: number; - bottomCoordPadding: number; - rowEls: HTMLElement[]; - cellEls: HTMLElement[]; - isCellSizesDirty: boolean; - rowPositions: PositionCache; - colPositions: PositionCache; - segPopover: Popover; - segPopoverTile: DayTile; - constructor(el: any, renderProps: RenderProps); - render(props: DayGridProps, context: ComponentContext): void; - destroy(): void; - getCellRange(row: any, col: any): { - start: Date; - end: Date; - }; - updateSegPopoverTile(date?: any, segs?: any): void; - _renderCells(cells: DayGridCell[][], isRigid: boolean): void; - _unrenderCells(): void; - renderDayRowHtml(row: any, isRigid: any): string; - getIsNumbersVisible(): boolean; - getIsDayNumbersVisible(): boolean; - renderNumberTrHtml(row: number): string; - renderNumberCellsHtml(row: any): string; - renderNumberCellHtml(date: any): string; - updateSize(isResize: boolean): void; - buildPositionCaches(): void; - buildColPositions(): void; - buildRowPositions(): void; - positionToHit(leftPosition: any, topPosition: any): { - row: any; - col: any; - dateSpan: { - range: { - start: Date; - end: Date; - }; - allDay: boolean; - }; - dayEl: HTMLElement; - relativeRect: { - left: any; - right: any; - top: any; - bottom: any; - }; - }; - getCellEl(row: any, col: any): HTMLElement; - _renderEventDrag(state: EventSegUiInteractionState): void; - _unrenderEventDrag(state: EventSegUiInteractionState): void; - _renderEventResize(state: EventSegUiInteractionState): void; - _unrenderEventResize(state: EventSegUiInteractionState): void; - removeSegPopover(): void; - limitRows(levelLimit: any): void; - computeRowLevelLimit(row: any): (number | false); - limitRow(row: any, levelLimit: any): void; - unlimitRow(row: any): void; - renderMoreLink(row: any, col: any, hiddenSegs: any): HTMLElement; - showSegPopover(row: any, col: any, moreLink: HTMLElement, segs: any): void; - resliceDaySegs(segs: any, dayDate: any): any[]; - getMoreLinkText(num: any): any; - getCellSegs(row: any, col: any, startLevel?: any): any[]; - } -} - -declare module '@fullcalendar/daygrid/AbstractDayGridView' { - import { ScrollComponent, View, Duration, ComponentContext, ViewProps } from '@fullcalendar/core'; - import DayGrid from '@fullcalendar/daygrid/DayGrid'; - export { AbstractDayGridView as default, AbstractDayGridView }; - abstract class AbstractDayGridView extends View { - scroller: ScrollComponent; - dayGrid: DayGrid; - colWeekNumbersVisible: boolean; - cellWeekNumbersVisible: boolean; - weekNumberWidth: number; - _processOptions(options: any): void; - render(props: ViewProps, context: ComponentContext): void; - destroy(): void; - _renderSkeleton(context: ComponentContext): void; - _unrenderSkeleton(): void; - renderSkeletonHtml(): string; - weekNumberStyleAttr(): string; - hasRigidRows(): boolean; - updateSize(isResize: boolean, viewHeight: number, isAuto: boolean): void; - updateBaseSize(isResize: boolean, viewHeight: number, isAuto: boolean): void; - computeScrollerHeight(viewHeight: any): number; - setGridHeight(height: any, isAuto: any): void; - computeDateScroll(duration: Duration): { - top: number; - }; - queryDateScroll(): { - top: number; - }; - applyDateScroll(scroll: any): void; - renderHeadIntroHtml: () => string; - renderDayGridNumberIntroHtml: (row: number, dayGrid: DayGrid) => string; - renderDayGridBgIntroHtml: () => string; - renderDayGridIntroHtml: () => string; - } -} - -declare module '@fullcalendar/daygrid/DayGridView' { - import { DayHeader, ComponentContext, DateProfileGenerator, DateProfile, ViewProps, DayTable } from '@fullcalendar/core'; - import AbstractDayGridView from '@fullcalendar/daygrid/AbstractDayGridView'; - import SimpleDayGrid from '@fullcalendar/daygrid/SimpleDayGrid'; - export { DayGridView as default, DayGridView }; - class DayGridView extends AbstractDayGridView { - header: DayHeader; - simpleDayGrid: SimpleDayGrid; - dayTable: DayTable; - render(props: ViewProps, context: ComponentContext): void; - _renderSkeleton(context: ComponentContext): void; - _unrenderSkeleton(): void; - } - export function buildDayTable(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator): DayTable; -} - -declare module '@fullcalendar/daygrid/DayBgRow' { - import { ComponentContext, DateMarker, DateProfile } from '@fullcalendar/core'; - export interface DayBgCell { - date: DateMarker; - htmlAttrs?: string; - } - export interface DayBgRowProps { - cells: DayBgCell[]; - dateProfile: DateProfile; - renderIntroHtml?: () => string; - } - export { DayBgRow as default, DayBgRow }; - class DayBgRow { - context: ComponentContext; - constructor(context: ComponentContext); - renderHtml(props: DayBgRowProps): string; - } -} - -declare module '@fullcalendar/daygrid/Popover' { - export interface PopoverOptions { - className?: string; - content?: (el: HTMLElement) => void; - parentEl: HTMLElement; - autoHide?: boolean; - top?: number; - left?: number; - right?: number; - viewportConstrain?: boolean; - } - export { Popover as default, Popover }; - class Popover { - isHidden: boolean; - options: PopoverOptions; - el: HTMLElement; - margin: number; - constructor(options: PopoverOptions); - show(): void; - hide(): void; - render(): void; - documentMousedown: (ev: any) => void; - destroy(): void; - position(): void; - trigger(name: any): void; - } -} - -declare module '@fullcalendar/daygrid/DayGridEventRenderer' { - import { Seg } from '@fullcalendar/core'; - import DayGrid from '@fullcalendar/daygrid/DayGrid'; - import SimpleDayGridEventRenderer from '@fullcalendar/daygrid/SimpleDayGridEventRenderer'; - export { DayGridEventRenderer as default, DayGridEventRenderer }; - class DayGridEventRenderer extends SimpleDayGridEventRenderer { - dayGrid: DayGrid; - rowStructs: any; - constructor(dayGrid: DayGrid); - attachSegs(segs: Seg[], mirrorInfo: any): void; - detachSegs(): void; - renderSegRows(segs: Seg[]): any[]; - renderSegRow(row: any, rowSegs: any): { - row: any; - tbodyEl: HTMLTableSectionElement; - cellMatrix: any[]; - segMatrix: any[]; - segLevels: any[]; - segs: any; - }; - buildSegLevels(segs: Seg[]): any[]; - groupSegRows(segs: Seg[]): any[]; - computeDisplayEventEnd(): boolean; - } -} - -declare module '@fullcalendar/daygrid/DayTile' { - import { DateComponent, Seg, Hit, DateMarker, ComponentContext, EventInstanceHash } from '@fullcalendar/core'; - import SimpleDayGridEventRenderer from '@fullcalendar/daygrid/SimpleDayGridEventRenderer'; - export interface DayTileProps { - date: DateMarker; - fgSegs: Seg[]; - eventSelection: string; - eventDragInstances: EventInstanceHash; - eventResizeInstances: EventInstanceHash; - } - export { DayTile as default, DayTile }; - class DayTile extends DateComponent<DayTileProps> { - segContainerEl: HTMLElement; - constructor(el: HTMLElement); - firstContext(context: ComponentContext): void; - render(props: DayTileProps, context: ComponentContext): void; - destroy(): void; - _renderFrame(date: DateMarker): void; - queryHit(positionLeft: number, positionTop: number, elWidth: number, elHeight: number): Hit | null; - } - export class DayTileEventRenderer extends SimpleDayGridEventRenderer { - dayTile: DayTile; - constructor(dayTile: any); - attachSegs(segs: Seg[]): void; - detachSegs(segs: Seg[]): void; - } -} - -declare module '@fullcalendar/daygrid/SimpleDayGridEventRenderer' { - import { FgEventRenderer, Seg } from '@fullcalendar/core'; - export { SimpleDayGridEventRenderer as default, SimpleDayGridEventRenderer }; - abstract class SimpleDayGridEventRenderer extends FgEventRenderer { - renderSegHtml(seg: Seg, mirrorInfo: any): string; - computeEventTimeFormat(): { - hour: string; - minute: string; - omitZeroMinute: boolean; - meridiem: string; - }; - computeDisplayEventEnd(): boolean; - } -} - diff --git a/library/fullcalendar/packages/daygrid/main.esm.js b/library/fullcalendar/packages/daygrid/main.esm.js deleted file mode 100644 index 5d33b7cfb..000000000 --- a/library/fullcalendar/packages/daygrid/main.esm.js +++ /dev/null @@ -1,1655 +0,0 @@ -/*! -FullCalendar Day Grid Plugin v4.4.2 -Docs & License: https://fullcalendar.io/ -(c) 2019 Adam Shaw -*/ - -import { addWeeks, diffWeeks, DateProfileGenerator, createElement, listenBySelector, removeElement, computeRect, computeClippingRect, applyStyle, computeEventDraggable, computeEventStartResizable, computeEventEndResizable, cssToStr, htmlEscape, FgEventRenderer, appendToElement, prependToElement, htmlToElement, FillRenderer, memoizeRendering, createFormatter, addDays, DateComponent, rangeContainsMarker, getDayClasses, findElements, PositionCache, buildGotoAnchorHtml, findChildren, insertAfterElement, intersectRanges, memoize, ScrollComponent, matchCellWidths, uncompensateScroll, compensateScroll, subtractInnerElHeight, distributeHeight, undistributeHeight, View, Slicer, DayHeader, DaySeries, DayTable, 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 __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);
-}; - -var DayGridDateProfileGenerator = /** @class */ (function (_super) { - __extends(DayGridDateProfileGenerator, _super); - function DayGridDateProfileGenerator() { - return _super !== null && _super.apply(this, arguments) || this; - } - // Computes the date range that will be rendered. - DayGridDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) { - var dateEnv = this.dateEnv; - var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay); - var start = renderRange.start; - var end = renderRange.end; - var endOfWeek; - // year and month views should be aligned with weeks. this is already done for week - if (/^(year|month)$/.test(currentRangeUnit)) { - start = dateEnv.startOfWeek(start); - // make end-of-week if not already - endOfWeek = dateEnv.startOfWeek(end); - if (endOfWeek.valueOf() !== end.valueOf()) { - end = addWeeks(endOfWeek, 1); - } - } - // ensure 6 weeks - if (this.options.monthMode && - this.options.fixedWeekCount) { - var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays - diffWeeks(start, end)); - end = addWeeks(end, 6 - rowCnt); - } - return { start: start, end: end }; - }; - return DayGridDateProfileGenerator; -}(DateProfileGenerator)); - -/* A rectangular panel that is absolutely positioned over other content ------------------------------------------------------------------------------------------------------------------------- -Options: - - className (string) - - content (HTML string, element, or element array) - - parentEl - - top - - left - - right (the x coord of where the right edge should be. not a "CSS" right) - - autoHide (boolean) - - show (callback) - - hide (callback) -*/ -var Popover = /** @class */ (function () { - function Popover(options) { - var _this = this; - this.isHidden = true; - this.margin = 10; // the space required between the popover and the edges of the scroll container - // Triggered when the user clicks *anywhere* in the document, for the autoHide feature - this.documentMousedown = function (ev) { - // only hide the popover if the click happened outside the popover - if (_this.el && !_this.el.contains(ev.target)) { - _this.hide(); - } - }; - this.options = options; - } - // Shows the popover on the specified position. Renders it if not already - Popover.prototype.show = function () { - if (this.isHidden) { - if (!this.el) { - this.render(); - } - this.el.style.display = ''; - this.position(); - this.isHidden = false; - this.trigger('show'); - } - }; - // Hides the popover, through CSS, but does not remove it from the DOM - Popover.prototype.hide = function () { - if (!this.isHidden) { - this.el.style.display = 'none'; - this.isHidden = true; - this.trigger('hide'); - } - }; - // Creates `this.el` and renders content inside of it - Popover.prototype.render = function () { - var _this = this; - var options = this.options; - var el = this.el = createElement('div', { - className: 'fc-popover ' + (options.className || ''), - style: { - top: '0', - left: '0' - } - }); - if (typeof options.content === 'function') { - options.content(el); - } - options.parentEl.appendChild(el); - // when a click happens on anything inside with a 'fc-close' className, hide the popover - listenBySelector(el, 'click', '.fc-close', function (ev) { - _this.hide(); - }); - if (options.autoHide) { - document.addEventListener('mousedown', this.documentMousedown); - } - }; - // Hides and unregisters any handlers - Popover.prototype.destroy = function () { - this.hide(); - if (this.el) { - removeElement(this.el); - this.el = null; - } - document.removeEventListener('mousedown', this.documentMousedown); - }; - // Positions the popover optimally, using the top/left/right options - Popover.prototype.position = function () { - var options = this.options; - var el = this.el; - var elDims = el.getBoundingClientRect(); // only used for width,height - var origin = computeRect(el.offsetParent); - var clippingRect = computeClippingRect(options.parentEl); - var top; // the "position" (not "offset") values for the popover - var left; // - // compute top and left - top = options.top || 0; - if (options.left !== undefined) { - left = options.left; - } - else if (options.right !== undefined) { - left = options.right - elDims.width; // derive the left value from the right value - } - else { - left = 0; - } - // constrain to the view port. if constrained by two edges, give precedence to top/left - top = Math.min(top, clippingRect.bottom - elDims.height - this.margin); - top = Math.max(top, clippingRect.top + this.margin); - left = Math.min(left, clippingRect.right - elDims.width - this.margin); - left = Math.max(left, clippingRect.left + this.margin); - applyStyle(el, { - top: top - origin.top, - left: left - origin.left - }); - }; - // Triggers a callback. Calls a function in the option hash of the same name. - // Arguments beyond the first `name` are forwarded on. - // TODO: better code reuse for this. Repeat code - // can kill this??? - Popover.prototype.trigger = function (name) { - if (this.options[name]) { - this.options[name].apply(this, Array.prototype.slice.call(arguments, 1)); - } - }; - return Popover; -}()); - -/* Event-rendering methods for the DayGrid class -----------------------------------------------------------------------------------------------------------------------*/ -// "Simple" is bad a name. has nothing to do with SimpleDayGrid -var SimpleDayGridEventRenderer = /** @class */ (function (_super) { - __extends(SimpleDayGridEventRenderer, _super); - function SimpleDayGridEventRenderer() { - return _super !== null && _super.apply(this, arguments) || this; - } - // Builds the HTML to be used for the default element for an individual segment - SimpleDayGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) { - var context = this.context; - var eventRange = seg.eventRange; - var eventDef = eventRange.def; - var eventUi = eventRange.ui; - var allDay = eventDef.allDay; - var isDraggable = computeEventDraggable(context, eventDef, eventUi); - var isResizableFromStart = allDay && seg.isStart && computeEventStartResizable(context, eventDef, eventUi); - var isResizableFromEnd = allDay && seg.isEnd && computeEventEndResizable(context, eventDef, eventUi); - var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo); - var skinCss = cssToStr(this.getSkinCss(eventUi)); - var timeHtml = ''; - var timeText; - var titleHtml; - classes.unshift('fc-day-grid-event', 'fc-h-event'); - // Only display a timed events time if it is the starting segment - if (seg.isStart) { - timeText = this.getTimeText(eventRange); - if (timeText) { - timeHtml = '<span class="fc-time">' + htmlEscape(timeText) + '</span>'; - } - } - titleHtml = - '<span class="fc-title">' + - (htmlEscape(eventDef.title || '') || ' ') + // we always want one line of height - '</span>'; - return '<a class="' + classes.join(' ') + '"' + - (eventDef.url ? - ' href="' + htmlEscape(eventDef.url) + '"' : - '') + - (skinCss ? - ' style="' + skinCss + '"' : - '') + - '>' + - '<div class="fc-content">' + - (context.options.dir === 'rtl' ? - titleHtml + ' ' + timeHtml : // put a natural space in between - timeHtml + ' ' + titleHtml // - ) + - '</div>' + - (isResizableFromStart ? - '<div class="fc-resizer fc-start-resizer"></div>' : - '') + - (isResizableFromEnd ? - '<div class="fc-resizer fc-end-resizer"></div>' : - '') + - '</a>'; - }; - // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined - SimpleDayGridEventRenderer.prototype.computeEventTimeFormat = function () { - return { - hour: 'numeric', - minute: '2-digit', - omitZeroMinute: true, - meridiem: 'narrow' - }; - }; - SimpleDayGridEventRenderer.prototype.computeDisplayEventEnd = function () { - return false; // TODO: somehow consider the originating DayGrid's column count - }; - return SimpleDayGridEventRenderer; -}(FgEventRenderer)); - -/* Event-rendering methods for the DayGrid class -----------------------------------------------------------------------------------------------------------------------*/ -var DayGridEventRenderer = /** @class */ (function (_super) { - __extends(DayGridEventRenderer, _super); - function DayGridEventRenderer(dayGrid) { - var _this = _super.call(this) || this; - _this.dayGrid = dayGrid; - return _this; - } - // Renders the given foreground event segments onto the grid - DayGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) { - var rowStructs = this.rowStructs = this.renderSegRows(segs); - // append to each row's content skeleton - this.dayGrid.rowEls.forEach(function (rowNode, i) { - rowNode.querySelector('.fc-content-skeleton > table').appendChild(rowStructs[i].tbodyEl); - }); - // removes the "more.." events popover - if (!mirrorInfo) { - this.dayGrid.removeSegPopover(); - } - }; - // Unrenders all currently rendered foreground event segments - DayGridEventRenderer.prototype.detachSegs = function () { - var rowStructs = this.rowStructs || []; - var rowStruct; - while ((rowStruct = rowStructs.pop())) { - removeElement(rowStruct.tbodyEl); - } - this.rowStructs = null; - }; - // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton. - // Returns an array of rowStruct objects (see the bottom of `renderSegRow`). - // PRECONDITION: each segment shoud already have a rendered and assigned `.el` - DayGridEventRenderer.prototype.renderSegRows = function (segs) { - var rowStructs = []; - var segRows; - var row; - segRows = this.groupSegRows(segs); // group into nested arrays - // iterate each row of segment groupings - for (row = 0; row < segRows.length; row++) { - rowStructs.push(this.renderSegRow(row, segRows[row])); - } - return rowStructs; - }; - // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains - // the segments. Returns object with a bunch of internal data about how the render was calculated. - // NOTE: modifies rowSegs - DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) { - var isRtl = this.context.isRtl; - var dayGrid = this.dayGrid; - var colCnt = dayGrid.colCnt; - var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels - var levelCnt = Math.max(1, segLevels.length); // ensure at least one level - var tbody = document.createElement('tbody'); - var segMatrix = []; // lookup for which segments are rendered into which level+col cells - var cellMatrix = []; // lookup for all <td> elements of the level+col matrix - var loneCellMatrix = []; // lookup for <td> elements that only take up a single column - var i; - var levelSegs; - var col; - var tr; - var j; - var seg; - var td; - // populates empty cells from the current column (`col`) to `endCol` - function emptyCellsUntil(endCol) { - while (col < endCol) { - // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell - td = (loneCellMatrix[i - 1] || [])[col]; - if (td) { - td.rowSpan = (td.rowSpan || 1) + 1; - } - else { - td = document.createElement('td'); - tr.appendChild(td); - } - cellMatrix[i][col] = td; - loneCellMatrix[i][col] = td; - col++; - } - } - for (i = 0; i < levelCnt; i++) { // iterate through all levels - levelSegs = segLevels[i]; - col = 0; - tr = document.createElement('tr'); - segMatrix.push([]); - cellMatrix.push([]); - loneCellMatrix.push([]); - // levelCnt might be 1 even though there are no actual levels. protect against this. - // this single empty row is useful for styling. - if (levelSegs) { - for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level - seg = levelSegs[j]; - var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; - var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol; - emptyCellsUntil(leftCol); - // create a container that occupies or more columns. append the event element. - td = createElement('td', { className: 'fc-event-container' }, seg.el); - if (leftCol !== rightCol) { - td.colSpan = rightCol - leftCol + 1; - } - else { // a single-column segment - loneCellMatrix[i][col] = td; - } - while (col <= rightCol) { - cellMatrix[i][col] = td; - segMatrix[i][col] = seg; - col++; - } - tr.appendChild(td); - } - } - emptyCellsUntil(colCnt); // finish off the row - var introHtml = dayGrid.renderProps.renderIntroHtml(); - if (introHtml) { - if (isRtl) { - appendToElement(tr, introHtml); - } - else { - prependToElement(tr, introHtml); - } - } - tbody.appendChild(tr); - } - return { - row: row, - tbodyEl: tbody, - cellMatrix: cellMatrix, - segMatrix: segMatrix, - segLevels: segLevels, - segs: rowSegs - }; - }; - // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels. - // NOTE: modifies segs - DayGridEventRenderer.prototype.buildSegLevels = function (segs) { - var isRtl = this.context.isRtl; - var colCnt = this.dayGrid.colCnt; - var levels = []; - var i; - var seg; - var j; - // Give preference to elements with certain criteria, so they have - // a chance to be closer to the top. - segs = this.sortEventSegs(segs); - for (i = 0; i < segs.length; i++) { - seg = segs[i]; - // loop through levels, starting with the topmost, until the segment doesn't collide with other segments - for (j = 0; j < levels.length; j++) { - if (!isDaySegCollision(seg, levels[j])) { - break; - } - } - // `j` now holds the desired subrow index - seg.level = j; - seg.leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; // for sorting only - seg.rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol // for sorting only - ; - (levels[j] || (levels[j] = [])).push(seg); - } - // order segments left-to-right. very important if calendar is RTL - for (j = 0; j < levels.length; j++) { - levels[j].sort(compareDaySegCols); - } - return levels; - }; - // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row - DayGridEventRenderer.prototype.groupSegRows = function (segs) { - var segRows = []; - var i; - for (i = 0; i < this.dayGrid.rowCnt; i++) { - segRows.push([]); - } - for (i = 0; i < segs.length; i++) { - segRows[segs[i].row].push(segs[i]); - } - return segRows; - }; - // Computes a default `displayEventEnd` value if one is not expliclty defined - DayGridEventRenderer.prototype.computeDisplayEventEnd = function () { - return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day - }; - return DayGridEventRenderer; -}(SimpleDayGridEventRenderer)); -// Computes whether two segments' columns collide. They are assumed to be in the same row. -function isDaySegCollision(seg, otherSegs) { - var i; - var otherSeg; - for (i = 0; i < otherSegs.length; i++) { - otherSeg = otherSegs[i]; - if (otherSeg.firstCol <= seg.lastCol && - otherSeg.lastCol >= seg.firstCol) { - return true; - } - } - return false; -} -// A cmp function for determining the leftmost event -function compareDaySegCols(a, b) { - return a.leftCol - b.leftCol; -} - -var DayGridMirrorRenderer = /** @class */ (function (_super) { - __extends(DayGridMirrorRenderer, _super); - function DayGridMirrorRenderer() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) { - var sourceSeg = mirrorInfo.sourceSeg; - var rowStructs = this.rowStructs = this.renderSegRows(segs); - // inject each new event skeleton into each associated row - this.dayGrid.rowEls.forEach(function (rowNode, row) { - var skeletonEl = htmlToElement('<div class="fc-mirror-skeleton"><table></table></div>'); // will be absolutely positioned - var skeletonTopEl; - var skeletonTop; - // If there is an original segment, match the top position. Otherwise, put it at the row's top level - if (sourceSeg && sourceSeg.row === row) { - skeletonTopEl = sourceSeg.el; - } - else { - skeletonTopEl = rowNode.querySelector('.fc-content-skeleton tbody'); - if (!skeletonTopEl) { // when no events - skeletonTopEl = rowNode.querySelector('.fc-content-skeleton table'); - } - } - skeletonTop = skeletonTopEl.getBoundingClientRect().top - - rowNode.getBoundingClientRect().top; // the offsetParent origin - skeletonEl.style.top = skeletonTop + 'px'; - skeletonEl.querySelector('table').appendChild(rowStructs[row].tbodyEl); - rowNode.appendChild(skeletonEl); - }); - }; - return DayGridMirrorRenderer; -}(DayGridEventRenderer)); - -var EMPTY_CELL_HTML = '<td style="pointer-events:none"></td>'; -var DayGridFillRenderer = /** @class */ (function (_super) { - __extends(DayGridFillRenderer, _super); - function DayGridFillRenderer(dayGrid) { - var _this = _super.call(this) || this; - _this.fillSegTag = 'td'; // override the default tag name - _this.dayGrid = dayGrid; - return _this; - } - DayGridFillRenderer.prototype.renderSegs = function (type, context, segs) { - // don't render timed background events - if (type === 'bgEvent') { - segs = segs.filter(function (seg) { - return seg.eventRange.def.allDay; - }); - } - _super.prototype.renderSegs.call(this, type, context, segs); - }; - DayGridFillRenderer.prototype.attachSegs = function (type, segs) { - var els = []; - var i; - var seg; - var skeletonEl; - for (i = 0; i < segs.length; i++) { - seg = segs[i]; - skeletonEl = this.renderFillRow(type, seg); - this.dayGrid.rowEls[seg.row].appendChild(skeletonEl); - els.push(skeletonEl); - } - return els; - }; - // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered. - DayGridFillRenderer.prototype.renderFillRow = function (type, seg) { - var dayGrid = this.dayGrid; - var isRtl = this.context.isRtl; - var colCnt = dayGrid.colCnt; - var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; - var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol; - var startCol = leftCol; - var endCol = rightCol + 1; - var className; - var skeletonEl; - var trEl; - if (type === 'businessHours') { - className = 'bgevent'; - } - else { - className = type.toLowerCase(); - } - skeletonEl = htmlToElement('<div class="fc-' + className + '-skeleton">' + - '<table><tr></tr></table>' + - '</div>'); - trEl = skeletonEl.getElementsByTagName('tr')[0]; - if (startCol > 0) { - appendToElement(trEl, - // will create (startCol + 1) td's - new Array(startCol + 1).join(EMPTY_CELL_HTML)); - } - seg.el.colSpan = endCol - startCol; - trEl.appendChild(seg.el); - if (endCol < colCnt) { - appendToElement(trEl, - // will create (colCnt - endCol) td's - new Array(colCnt - endCol + 1).join(EMPTY_CELL_HTML)); - } - var introHtml = dayGrid.renderProps.renderIntroHtml(); - if (introHtml) { - if (isRtl) { - appendToElement(trEl, introHtml); - } - else { - prependToElement(trEl, introHtml); - } - } - return skeletonEl; - }; - return DayGridFillRenderer; -}(FillRenderer)); - -var DayTile = /** @class */ (function (_super) { - __extends(DayTile, _super); - function DayTile(el) { - var _this = _super.call(this, el) || this; - var eventRenderer = _this.eventRenderer = new DayTileEventRenderer(_this); - var renderFrame = _this.renderFrame = memoizeRendering(_this._renderFrame); - _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderFrame]); - _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]); - _this.renderEventDrag = memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]); - _this.renderEventResize = memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]); - return _this; - } - DayTile.prototype.firstContext = function (context) { - context.calendar.registerInteractiveComponent(this, { - el: this.el, - useEventCenter: false - }); - }; - DayTile.prototype.render = function (props, context) { - this.renderFrame(props.date); - this.renderFgEvents(context, props.fgSegs); - this.renderEventSelection(props.eventSelection); - this.renderEventDrag(props.eventDragInstances); - this.renderEventResize(props.eventResizeInstances); - }; - DayTile.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.renderFrame.unrender(); // should unrender everything else - this.context.calendar.unregisterInteractiveComponent(this); - }; - DayTile.prototype._renderFrame = function (date) { - var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options; - var title = dateEnv.format(date, createFormatter(options.dayPopoverFormat) // TODO: cache - ); - this.el.innerHTML = - '<div class="fc-header ' + theme.getClass('popoverHeader') + '">' + - '<span class="fc-title">' + - htmlEscape(title) + - '</span>' + - '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' + - '</div>' + - '<div class="fc-body ' + theme.getClass('popoverContent') + '">' + - '<div class="fc-event-container"></div>' + - '</div>'; - this.segContainerEl = this.el.querySelector('.fc-event-container'); - }; - DayTile.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) { - var date = this.props.date; // HACK - if (positionLeft < elWidth && positionTop < elHeight) { - return { - component: this, - dateSpan: { - allDay: true, - range: { start: date, end: addDays(date, 1) } - }, - dayEl: this.el, - rect: { - left: 0, - top: 0, - right: elWidth, - bottom: elHeight - }, - layer: 1 - }; - } - }; - return DayTile; -}(DateComponent)); -var DayTileEventRenderer = /** @class */ (function (_super) { - __extends(DayTileEventRenderer, _super); - function DayTileEventRenderer(dayTile) { - var _this = _super.call(this) || this; - _this.dayTile = dayTile; - return _this; - } - DayTileEventRenderer.prototype.attachSegs = function (segs) { - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - this.dayTile.segContainerEl.appendChild(seg.el); - } - }; - DayTileEventRenderer.prototype.detachSegs = function (segs) { - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - removeElement(seg.el); - } - }; - return DayTileEventRenderer; -}(SimpleDayGridEventRenderer)); - -var DayBgRow = /** @class */ (function () { - function DayBgRow(context) { - this.context = context; - } - DayBgRow.prototype.renderHtml = function (props) { - var parts = []; - if (props.renderIntroHtml) { - parts.push(props.renderIntroHtml()); - } - for (var _i = 0, _a = props.cells; _i < _a.length; _i++) { - var cell = _a[_i]; - parts.push(renderCellHtml(cell.date, props.dateProfile, this.context, cell.htmlAttrs)); - } - if (!props.cells.length) { - parts.push('<td class="fc-day ' + this.context.theme.getClass('widgetContent') + '"></td>'); - } - if (this.context.options.dir === 'rtl') { - parts.reverse(); - } - return '<tr>' + parts.join('') + '</tr>'; - }; - return DayBgRow; -}()); -function renderCellHtml(date, dateProfile, context, otherAttrs) { - var dateEnv = context.dateEnv, theme = context.theme; - var isDateValid = rangeContainsMarker(dateProfile.activeRange, date); // TODO: called too frequently. cache somehow. - var classes = getDayClasses(date, dateProfile, context); - classes.unshift('fc-day', theme.getClass('widgetContent')); - return '<td class="' + classes.join(' ') + '"' + - (isDateValid ? - ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' : - '') + - (otherAttrs ? - ' ' + otherAttrs : - '') + - '></td>'; -} - -var DAY_NUM_FORMAT = createFormatter({ day: 'numeric' }); -var WEEK_NUM_FORMAT = createFormatter({ week: 'numeric' }); -var DayGrid = /** @class */ (function (_super) { - __extends(DayGrid, _super); - function DayGrid(el, renderProps) { - var _this = _super.call(this, el) || this; - _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid - _this.isCellSizesDirty = false; - _this.renderProps = renderProps; - var eventRenderer = _this.eventRenderer = new DayGridEventRenderer(_this); - var fillRenderer = _this.fillRenderer = new DayGridFillRenderer(_this); - _this.mirrorRenderer = new DayGridMirrorRenderer(_this); - var renderCells = _this.renderCells = memoizeRendering(_this._renderCells, _this._unrenderCells); - _this.renderBusinessHours = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderCells]); - _this.renderDateSelection = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'highlight'), fillRenderer.unrender.bind(fillRenderer, 'highlight'), [renderCells]); - _this.renderBgEvents = memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderCells]); - _this.renderFgEvents = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderCells]); - _this.renderEventSelection = memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]); - _this.renderEventDrag = memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderCells]); - _this.renderEventResize = memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderCells]); - return _this; - } - DayGrid.prototype.render = function (props, context) { - var cells = props.cells; - this.rowCnt = cells.length; - this.colCnt = cells[0].length; - this.renderCells(cells, props.isRigid); - this.renderBusinessHours(context, props.businessHourSegs); - this.renderDateSelection(context, props.dateSelectionSegs); - this.renderBgEvents(context, props.bgEventSegs); - this.renderFgEvents(context, props.fgEventSegs); - this.renderEventSelection(props.eventSelection); - this.renderEventDrag(props.eventDrag); - this.renderEventResize(props.eventResize); - if (this.segPopoverTile) { - this.updateSegPopoverTile(); - } - }; - DayGrid.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.renderCells.unrender(); // will unrender everything else - }; - DayGrid.prototype.getCellRange = function (row, col) { - var start = this.props.cells[row][col].date; - var end = addDays(start, 1); - return { start: start, end: end }; - }; - DayGrid.prototype.updateSegPopoverTile = function (date, segs) { - var ownProps = this.props; - this.segPopoverTile.receiveProps({ - date: date || this.segPopoverTile.props.date, - fgSegs: segs || this.segPopoverTile.props.fgSegs, - eventSelection: ownProps.eventSelection, - eventDragInstances: ownProps.eventDrag ? ownProps.eventDrag.affectedInstances : null, - eventResizeInstances: ownProps.eventResize ? ownProps.eventResize.affectedInstances : null - }, this.context); - }; - /* Date Rendering - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype._renderCells = function (cells, isRigid) { - var _a = this.context, calendar = _a.calendar, view = _a.view, isRtl = _a.isRtl, dateEnv = _a.dateEnv; - var _b = this, rowCnt = _b.rowCnt, colCnt = _b.colCnt; - var html = ''; - var row; - var col; - for (row = 0; row < rowCnt; row++) { - html += this.renderDayRowHtml(row, isRigid); - } - this.el.innerHTML = html; - this.rowEls = findElements(this.el, '.fc-row'); - this.cellEls = findElements(this.el, '.fc-day, .fc-disabled-day'); - if (isRtl) { - this.cellEls.reverse(); - } - this.rowPositions = new PositionCache(this.el, this.rowEls, false, true // vertical - ); - this.colPositions = new PositionCache(this.el, this.cellEls.slice(0, colCnt), // only the first row - true, false // horizontal - ); - // trigger dayRender with each cell's element - for (row = 0; row < rowCnt; row++) { - for (col = 0; col < colCnt; col++) { - calendar.publiclyTrigger('dayRender', [ - { - date: dateEnv.toDate(cells[row][col].date), - el: this.getCellEl(row, col), - view: view - } - ]); - } - } - this.isCellSizesDirty = true; - }; - DayGrid.prototype._unrenderCells = function () { - this.removeSegPopover(); - }; - // Generates the HTML for a single row, which is a div that wraps a table. - // `row` is the row number. - DayGrid.prototype.renderDayRowHtml = function (row, isRigid) { - var theme = this.context.theme; - var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')]; - if (isRigid) { - classes.push('fc-rigid'); - } - var bgRow = new DayBgRow(this.context); - return '' + - '<div class="' + classes.join(' ') + '">' + - '<div class="fc-bg">' + - '<table class="' + theme.getClass('tableGrid') + '">' + - bgRow.renderHtml({ - cells: this.props.cells[row], - dateProfile: this.props.dateProfile, - renderIntroHtml: this.renderProps.renderBgIntroHtml - }) + - '</table>' + - '</div>' + - '<div class="fc-content-skeleton">' + - '<table>' + - (this.getIsNumbersVisible() ? - '<thead>' + - this.renderNumberTrHtml(row) + - '</thead>' : - '') + - '</table>' + - '</div>' + - '</div>'; - }; - DayGrid.prototype.getIsNumbersVisible = function () { - return this.getIsDayNumbersVisible() || - this.renderProps.cellWeekNumbersVisible || - this.renderProps.colWeekNumbersVisible; - }; - DayGrid.prototype.getIsDayNumbersVisible = function () { - return this.rowCnt > 1; - }; - /* Grid Number Rendering - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.renderNumberTrHtml = function (row) { - var isRtl = this.context.isRtl; - var intro = this.renderProps.renderNumberIntroHtml(row, this); - return '' + - '<tr>' + - (isRtl ? '' : intro) + - this.renderNumberCellsHtml(row) + - (isRtl ? intro : '') + - '</tr>'; - }; - DayGrid.prototype.renderNumberCellsHtml = function (row) { - var htmls = []; - var col; - var date; - for (col = 0; col < this.colCnt; col++) { - date = this.props.cells[row][col].date; - htmls.push(this.renderNumberCellHtml(date)); - } - if (this.context.isRtl) { - htmls.reverse(); - } - return htmls.join(''); - }; - // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton. - // The number row will only exist if either day numbers or week numbers are turned on. - DayGrid.prototype.renderNumberCellHtml = function (date) { - var _a = this.context, dateEnv = _a.dateEnv, options = _a.options; - var html = ''; - var isDateValid = rangeContainsMarker(this.props.dateProfile.activeRange, date); // TODO: called too frequently. cache somehow. - var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid; - var classes; - var weekCalcFirstDow; - if (!isDayNumberVisible && !this.renderProps.cellWeekNumbersVisible) { - // no numbers in day cell (week number must be along the side) - return '<td></td>'; // will create an empty space above events :( - } - classes = getDayClasses(date, this.props.dateProfile, this.context); - classes.unshift('fc-day-top'); - if (this.renderProps.cellWeekNumbersVisible) { - weekCalcFirstDow = dateEnv.weekDow; - } - html += '<td class="' + classes.join(' ') + '"' + - (isDateValid ? - ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' : - '') + - '>'; - if (this.renderProps.cellWeekNumbersVisible && (date.getUTCDay() === weekCalcFirstDow)) { - html += buildGotoAnchorHtml(options, dateEnv, { date: date, type: 'week' }, { 'class': 'fc-week-number' }, dateEnv.format(date, WEEK_NUM_FORMAT) // inner HTML - ); - } - if (isDayNumberVisible) { - html += buildGotoAnchorHtml(options, dateEnv, date, { 'class': 'fc-day-number' }, dateEnv.format(date, DAY_NUM_FORMAT) // inner HTML - ); - } - html += '</td>'; - return html; - }; - /* Sizing - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.updateSize = function (isResize) { - var calendar = this.context.calendar; - var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer; - if (isResize || - this.isCellSizesDirty || - calendar.isEventsUpdated // hack - ) { - this.buildPositionCaches(); - this.isCellSizesDirty = false; - } - fillRenderer.computeSizes(isResize); - eventRenderer.computeSizes(isResize); - mirrorRenderer.computeSizes(isResize); - fillRenderer.assignSizes(isResize); - eventRenderer.assignSizes(isResize); - mirrorRenderer.assignSizes(isResize); - }; - DayGrid.prototype.buildPositionCaches = function () { - this.buildColPositions(); - this.buildRowPositions(); - }; - DayGrid.prototype.buildColPositions = function () { - this.colPositions.build(); - }; - DayGrid.prototype.buildRowPositions = function () { - this.rowPositions.build(); - this.rowPositions.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack - }; - /* Hit System - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.positionToHit = function (leftPosition, topPosition) { - var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions; - var col = colPositions.leftToIndex(leftPosition); - var row = rowPositions.topToIndex(topPosition); - if (row != null && col != null) { - return { - row: row, - col: col, - dateSpan: { - range: this.getCellRange(row, col), - allDay: true - }, - dayEl: this.getCellEl(row, col), - relativeRect: { - left: colPositions.lefts[col], - right: colPositions.rights[col], - top: rowPositions.tops[row], - bottom: rowPositions.bottoms[row] - } - }; - } - }; - /* Cell System - ------------------------------------------------------------------------------------------------------------------*/ - // FYI: the first column is the leftmost column, regardless of date - DayGrid.prototype.getCellEl = function (row, col) { - return this.cellEls[row * this.colCnt + col]; - }; - /* Event Drag Visualization - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype._renderEventDrag = function (state) { - if (state) { - this.eventRenderer.hideByHash(state.affectedInstances); - this.fillRenderer.renderSegs('highlight', this.context, state.segs); - } - }; - DayGrid.prototype._unrenderEventDrag = function (state) { - if (state) { - this.eventRenderer.showByHash(state.affectedInstances); - this.fillRenderer.unrender('highlight', this.context); - } - }; - /* Event Resize Visualization - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype._renderEventResize = function (state) { - if (state) { - this.eventRenderer.hideByHash(state.affectedInstances); - this.fillRenderer.renderSegs('highlight', this.context, state.segs); - this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg }); - } - }; - DayGrid.prototype._unrenderEventResize = function (state) { - if (state) { - this.eventRenderer.showByHash(state.affectedInstances); - this.fillRenderer.unrender('highlight', this.context); - this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg }); - } - }; - /* More+ Link Popover - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.removeSegPopover = function () { - if (this.segPopover) { - this.segPopover.hide(); // in handler, will call segPopover's removeElement - } - }; - // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid. - // `levelLimit` can be false (don't limit), a number, or true (should be computed). - DayGrid.prototype.limitRows = function (levelLimit) { - var rowStructs = this.eventRenderer.rowStructs || []; - var row; // row # - var rowLevelLimit; - for (row = 0; row < rowStructs.length; row++) { - this.unlimitRow(row); - if (!levelLimit) { - rowLevelLimit = false; - } - else if (typeof levelLimit === 'number') { - rowLevelLimit = levelLimit; - } - else { - rowLevelLimit = this.computeRowLevelLimit(row); - } - if (rowLevelLimit !== false) { - this.limitRow(row, rowLevelLimit); - } - } - }; - // Computes the number of levels a row will accomodate without going outside its bounds. - // Assumes the row is "rigid" (maintains a constant height regardless of what is inside). - // `row` is the row number. - DayGrid.prototype.computeRowLevelLimit = function (row) { - var rowEl = this.rowEls[row]; // the containing "fake" row div - var rowBottom = rowEl.getBoundingClientRect().bottom; // relative to viewport! - var trEls = findChildren(this.eventRenderer.rowStructs[row].tbodyEl); - var i; - var trEl; - // Reveal one level <tr> at a time and stop when we find one out of bounds - for (i = 0; i < trEls.length; i++) { - trEl = trEls[i]; - trEl.classList.remove('fc-limited'); // reset to original state (reveal) - if (trEl.getBoundingClientRect().bottom > rowBottom) { - return i; - } - } - return false; // should not limit at all - }; - // Limits the given grid row to the maximum number of levels and injects "more" links if necessary. - // `row` is the row number. - // `levelLimit` is a number for the maximum (inclusive) number of levels allowed. - DayGrid.prototype.limitRow = function (row, levelLimit) { - var _this = this; - var colCnt = this.colCnt; - var isRtl = this.context.isRtl; - var rowStruct = this.eventRenderer.rowStructs[row]; - var moreNodes = []; // array of "more" <a> links and <td> DOM nodes - var col = 0; // col #, left-to-right (not chronologically) - var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right - var cellMatrix; // a matrix (by level, then column) of all <td> elements in the row - var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes - var i; - var seg; - var segsBelow; // array of segment objects below `seg` in the current `col` - var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies - var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column) - var td; - var rowSpan; - var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell - var j; - var moreTd; - var moreWrap; - var moreLink; - // Iterates through empty level cells and places "more" links inside if need be - var emptyCellsUntil = function (endCol) { - while (col < endCol) { - segsBelow = _this.getCellSegs(row, col, levelLimit); - if (segsBelow.length) { - td = cellMatrix[levelLimit - 1][col]; - moreLink = _this.renderMoreLink(row, col, segsBelow); - moreWrap = createElement('div', null, moreLink); - td.appendChild(moreWrap); - moreNodes.push(moreWrap); - } - col++; - } - }; - if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit? - levelSegs = rowStruct.segLevels[levelLimit - 1]; - cellMatrix = rowStruct.cellMatrix; - limitedNodes = findChildren(rowStruct.tbodyEl).slice(levelLimit); // get level <tr> elements past the limit - limitedNodes.forEach(function (node) { - node.classList.add('fc-limited'); // hide elements and get a simple DOM-nodes array - }); - // iterate though segments in the last allowable level - for (i = 0; i < levelSegs.length; i++) { - seg = levelSegs[i]; - var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; - var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol; - emptyCellsUntil(leftCol); // process empty cells before the segment - // determine *all* segments below `seg` that occupy the same columns - colSegsBelow = []; - totalSegsBelow = 0; - while (col <= rightCol) { - segsBelow = this.getCellSegs(row, col, levelLimit); - colSegsBelow.push(segsBelow); - totalSegsBelow += segsBelow.length; - col++; - } - if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links? - td = cellMatrix[levelLimit - 1][leftCol]; // the segment's parent cell - rowSpan = td.rowSpan || 1; - segMoreNodes = []; - // make a replacement <td> for each column the segment occupies. will be one for each colspan - for (j = 0; j < colSegsBelow.length; j++) { - moreTd = createElement('td', { className: 'fc-more-cell', rowSpan: rowSpan }); - segsBelow = colSegsBelow[j]; - moreLink = this.renderMoreLink(row, leftCol + j, [seg].concat(segsBelow) // count seg as hidden too - ); - moreWrap = createElement('div', null, moreLink); - moreTd.appendChild(moreWrap); - segMoreNodes.push(moreTd); - moreNodes.push(moreTd); - } - td.classList.add('fc-limited'); - insertAfterElement(td, segMoreNodes); - limitedNodes.push(td); - } - } - emptyCellsUntil(this.colCnt); // finish off the level - rowStruct.moreEls = moreNodes; // for easy undoing later - rowStruct.limitedEls = limitedNodes; // for easy undoing later - } - }; - // Reveals all levels and removes all "more"-related elements for a grid's row. - // `row` is a row number. - DayGrid.prototype.unlimitRow = function (row) { - var rowStruct = this.eventRenderer.rowStructs[row]; - if (rowStruct.moreEls) { - rowStruct.moreEls.forEach(removeElement); - rowStruct.moreEls = null; - } - if (rowStruct.limitedEls) { - rowStruct.limitedEls.forEach(function (limitedEl) { - limitedEl.classList.remove('fc-limited'); - }); - rowStruct.limitedEls = null; - } - }; - // Renders an <a> element that represents hidden event element for a cell. - // Responsible for attaching click handler as well. - DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) { - var _this = this; - var _a = this.context, calendar = _a.calendar, view = _a.view, dateEnv = _a.dateEnv, options = _a.options, isRtl = _a.isRtl; - var a = createElement('a', { className: 'fc-more' }); - a.innerText = this.getMoreLinkText(hiddenSegs.length); - a.addEventListener('click', function (ev) { - var clickOption = options.eventLimitClick; - var _col = isRtl ? _this.colCnt - col - 1 : col; // HACK: props.cells has different dir system? - var date = _this.props.cells[row][_col].date; - var moreEl = ev.currentTarget; - var dayEl = _this.getCellEl(row, col); - var allSegs = _this.getCellSegs(row, col); - // rescope the segments to be within the cell's date - var reslicedAllSegs = _this.resliceDaySegs(allSegs, date); - var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date); - if (typeof clickOption === 'function') { - // the returned value can be an atomic option - clickOption = calendar.publiclyTrigger('eventLimitClick', [ - { - date: dateEnv.toDate(date), - allDay: true, - dayEl: dayEl, - moreEl: moreEl, - segs: reslicedAllSegs, - hiddenSegs: reslicedHiddenSegs, - jsEvent: ev, - view: view - } - ]); - } - if (clickOption === 'popover') { - _this.showSegPopover(row, col, moreEl, reslicedAllSegs); - } - else if (typeof clickOption === 'string') { // a view name - calendar.zoomTo(date, clickOption); - } - }); - return a; - }; - // Reveals the popover that displays all events within a cell - DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) { - var _this = this; - var _a = this.context, calendar = _a.calendar, view = _a.view, theme = _a.theme, isRtl = _a.isRtl; - var _col = isRtl ? this.colCnt - col - 1 : col; // HACK: props.cells has different dir system? - var moreWrap = moreLink.parentNode; // the <div> wrapper around the <a> - var topEl; // the element we want to match the top coordinate of - var options; - if (this.rowCnt === 1) { - topEl = view.el; // will cause the popover to cover any sort of header - } - else { - topEl = this.rowEls[row]; // will align with top of row - } - options = { - className: 'fc-more-popover ' + theme.getClass('popover'), - parentEl: view.el, - top: computeRect(topEl).top, - autoHide: true, - content: function (el) { - _this.segPopoverTile = new DayTile(el); - _this.updateSegPopoverTile(_this.props.cells[row][_col].date, segs); - }, - hide: function () { - _this.segPopoverTile.destroy(); - _this.segPopoverTile = null; - _this.segPopover.destroy(); - _this.segPopover = null; - } - }; - // Determine horizontal coordinate. - // We use the moreWrap instead of the <td> to avoid border confusion. - if (isRtl) { - options.right = computeRect(moreWrap).right + 1; // +1 to be over cell border - } - else { - options.left = computeRect(moreWrap).left - 1; // -1 to be over cell border - } - this.segPopover = new Popover(options); - this.segPopover.show(); - calendar.releaseAfterSizingTriggers(); // hack for eventPositioned - }; - // Given the events within an array of segment objects, reslice them to be in a single day - DayGrid.prototype.resliceDaySegs = function (segs, dayDate) { - var dayStart = dayDate; - var dayEnd = addDays(dayStart, 1); - var dayRange = { start: dayStart, end: dayEnd }; - var newSegs = []; - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - var eventRange = seg.eventRange; - var origRange = eventRange.range; - var slicedRange = intersectRanges(origRange, dayRange); - if (slicedRange) { - newSegs.push(__assign({}, seg, { eventRange: { - def: eventRange.def, - ui: __assign({}, eventRange.ui, { durationEditable: false }), - instance: eventRange.instance, - range: slicedRange - }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() })); - } - } - return newSegs; - }; - // Generates the text that should be inside a "more" link, given the number of events it represents - DayGrid.prototype.getMoreLinkText = function (num) { - var opt = this.context.options.eventLimitText; - if (typeof opt === 'function') { - return opt(num); - } - else { - return '+' + num + ' ' + opt; - } - }; - // Returns segments within a given cell. - // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs. - DayGrid.prototype.getCellSegs = function (row, col, startLevel) { - var segMatrix = this.eventRenderer.rowStructs[row].segMatrix; - var level = startLevel || 0; - var segs = []; - var seg; - while (level < segMatrix.length) { - seg = segMatrix[level][col]; - if (seg) { - segs.push(seg); - } - level++; - } - return segs; - }; - return DayGrid; -}(DateComponent)); - -var WEEK_NUM_FORMAT$1 = createFormatter({ week: 'numeric' }); -/* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells. -----------------------------------------------------------------------------------------------------------------------*/ -// It is a manager for a DayGrid subcomponent, which does most of the heavy lifting. -// It is responsible for managing width/height. -var AbstractDayGridView = /** @class */ (function (_super) { - __extends(AbstractDayGridView, _super); - function AbstractDayGridView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.processOptions = memoize(_this._processOptions); - _this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton); - /* Header Rendering - ------------------------------------------------------------------------------------------------------------------*/ - // Generates the HTML that will go before the day-of week header cells - _this.renderHeadIntroHtml = function () { - var _a = _this.context, theme = _a.theme, options = _a.options; - if (_this.colWeekNumbersVisible) { - return '' + - '<th class="fc-week-number ' + theme.getClass('widgetHeader') + '" ' + _this.weekNumberStyleAttr() + '>' + - '<span>' + // needed for matchCellWidths - htmlEscape(options.weekLabel) + - '</span>' + - '</th>'; - } - return ''; - }; - /* Day Grid Rendering - ------------------------------------------------------------------------------------------------------------------*/ - // Generates the HTML that will go before content-skeleton cells that display the day/week numbers - _this.renderDayGridNumberIntroHtml = function (row, dayGrid) { - var _a = _this.context, options = _a.options, dateEnv = _a.dateEnv; - var weekStart = dayGrid.props.cells[row][0].date; - if (_this.colWeekNumbersVisible) { - return '' + - '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '>' + - buildGotoAnchorHtml(// aside from link, important for matchCellWidths - options, dateEnv, { date: weekStart, type: 'week', forceOff: dayGrid.colCnt === 1 }, dateEnv.format(weekStart, WEEK_NUM_FORMAT$1) // inner HTML - ) + - '</td>'; - } - return ''; - }; - // Generates the HTML that goes before the day bg cells for each day-row - _this.renderDayGridBgIntroHtml = function () { - var theme = _this.context.theme; - if (_this.colWeekNumbersVisible) { - return '<td class="fc-week-number ' + theme.getClass('widgetContent') + '" ' + _this.weekNumberStyleAttr() + '></td>'; - } - return ''; - }; - // Generates the HTML that goes before every other type of row generated by DayGrid. - // Affects mirror-skeleton and highlight-skeleton rows. - _this.renderDayGridIntroHtml = function () { - if (_this.colWeekNumbersVisible) { - return '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '></td>'; - } - return ''; - }; - return _this; - } - AbstractDayGridView.prototype._processOptions = function (options) { - if (options.weekNumbers) { - if (options.weekNumbersWithinDays) { - this.cellWeekNumbersVisible = true; - this.colWeekNumbersVisible = false; - } - else { - this.cellWeekNumbersVisible = false; - this.colWeekNumbersVisible = true; - } - } - else { - this.colWeekNumbersVisible = false; - this.cellWeekNumbersVisible = false; - } - }; - AbstractDayGridView.prototype.render = function (props, context) { - _super.prototype.render.call(this, props, context); - this.processOptions(context.options); - this.renderSkeleton(context); - }; - AbstractDayGridView.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.renderSkeleton.unrender(); - }; - AbstractDayGridView.prototype._renderSkeleton = function (context) { - this.el.classList.add('fc-dayGrid-view'); - this.el.innerHTML = this.renderSkeletonHtml(); - this.scroller = new ScrollComponent('hidden', // overflow x - 'auto' // overflow y - ); - var dayGridContainerEl = this.scroller.el; - this.el.querySelector('.fc-body > tr > td').appendChild(dayGridContainerEl); - dayGridContainerEl.classList.add('fc-day-grid-container'); - var dayGridEl = createElement('div', { className: 'fc-day-grid' }); - dayGridContainerEl.appendChild(dayGridEl); - this.dayGrid = new DayGrid(dayGridEl, { - renderNumberIntroHtml: this.renderDayGridNumberIntroHtml, - renderBgIntroHtml: this.renderDayGridBgIntroHtml, - renderIntroHtml: this.renderDayGridIntroHtml, - colWeekNumbersVisible: this.colWeekNumbersVisible, - cellWeekNumbersVisible: this.cellWeekNumbersVisible - }); - }; - AbstractDayGridView.prototype._unrenderSkeleton = function () { - this.el.classList.remove('fc-dayGrid-view'); - this.dayGrid.destroy(); - this.scroller.destroy(); - }; - // Builds the HTML skeleton for the view. - // The day-grid component will render inside of a container defined by this HTML. - AbstractDayGridView.prototype.renderSkeletonHtml = function () { - var _a = this.context, theme = _a.theme, options = _a.options; - return '' + - '<table class="' + theme.getClass('tableGrid') + '">' + - (options.columnHeader ? - '<thead class="fc-head">' + - '<tr>' + - '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '"> </td>' + - '</tr>' + - '</thead>' : - '') + - '<tbody class="fc-body">' + - '<tr>' + - '<td class="' + theme.getClass('widgetContent') + '"></td>' + - '</tr>' + - '</tbody>' + - '</table>'; - }; - // Generates an HTML attribute string for setting the width of the week number column, if it is known - AbstractDayGridView.prototype.weekNumberStyleAttr = function () { - if (this.weekNumberWidth != null) { - return 'style="width:' + this.weekNumberWidth + 'px"'; - } - return ''; - }; - // Determines whether each row should have a constant height - AbstractDayGridView.prototype.hasRigidRows = function () { - var eventLimit = this.context.options.eventLimit; - return eventLimit && typeof eventLimit !== 'number'; - }; - /* Dimensions - ------------------------------------------------------------------------------------------------------------------*/ - AbstractDayGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) { - _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first - this.dayGrid.updateSize(isResize); - }; - // Refreshes the horizontal dimensions of the view - AbstractDayGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) { - var dayGrid = this.dayGrid; - var eventLimit = this.context.options.eventLimit; - var headRowEl = this.header ? this.header.el : null; // HACK - var scrollerHeight; - var scrollbarWidths; - // hack to give the view some height prior to dayGrid's columns being rendered - // TODO: separate setting height from scroller VS dayGrid. - if (!dayGrid.rowEls) { - if (!isAuto) { - scrollerHeight = this.computeScrollerHeight(viewHeight); - this.scroller.setHeight(scrollerHeight); - } - return; - } - if (this.colWeekNumbersVisible) { - // Make sure all week number cells running down the side have the same width. - this.weekNumberWidth = matchCellWidths(findElements(this.el, '.fc-week-number')); - } - // reset all heights to be natural - this.scroller.clear(); - if (headRowEl) { - uncompensateScroll(headRowEl); - } - dayGrid.removeSegPopover(); // kill the "more" popover if displayed - // is the event limit a constant level number? - if (eventLimit && typeof eventLimit === 'number') { - dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after - } - // distribute the height to the rows - // (viewHeight is a "recommended" value if isAuto) - scrollerHeight = this.computeScrollerHeight(viewHeight); - this.setGridHeight(scrollerHeight, isAuto); - // is the event limit dynamically calculated? - if (eventLimit && typeof eventLimit !== 'number') { - dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set - } - if (!isAuto) { // should we force dimensions of the scroll container? - this.scroller.setHeight(scrollerHeight); - scrollbarWidths = this.scroller.getScrollbarWidths(); - if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars? - if (headRowEl) { - compensateScroll(headRowEl, scrollbarWidths); - } - // doing the scrollbar compensation might have created text overflow which created more height. redo - scrollerHeight = this.computeScrollerHeight(viewHeight); - this.scroller.setHeight(scrollerHeight); - } - // guarantees the same scrollbar widths - this.scroller.lockOverflow(scrollbarWidths); - } - }; - // given a desired total height of the view, returns what the height of the scroller should be - AbstractDayGridView.prototype.computeScrollerHeight = function (viewHeight) { - return viewHeight - - subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller - }; - // Sets the height of just the DayGrid component in this view - AbstractDayGridView.prototype.setGridHeight = function (height, isAuto) { - if (this.context.options.monthMode) { - // if auto, make the height of each row the height that it would be if there were 6 weeks - if (isAuto) { - height *= this.dayGrid.rowCnt / 6; - } - distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows - } - else { - if (isAuto) { - undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding - } - else { - distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows - } - } - }; - /* Scroll - ------------------------------------------------------------------------------------------------------------------*/ - AbstractDayGridView.prototype.computeDateScroll = function (duration) { - return { top: 0 }; - }; - AbstractDayGridView.prototype.queryDateScroll = function () { - return { top: this.scroller.getScrollTop() }; - }; - AbstractDayGridView.prototype.applyDateScroll = function (scroll) { - if (scroll.top !== undefined) { - this.scroller.setScrollTop(scroll.top); - } - }; - return AbstractDayGridView; -}(View)); -AbstractDayGridView.prototype.dateProfileGeneratorClass = DayGridDateProfileGenerator; - -var SimpleDayGrid = /** @class */ (function (_super) { - __extends(SimpleDayGrid, _super); - function SimpleDayGrid(dayGrid) { - var _this = _super.call(this, dayGrid.el) || this; - _this.slicer = new DayGridSlicer(); - _this.dayGrid = dayGrid; - return _this; - } - SimpleDayGrid.prototype.firstContext = function (context) { - context.calendar.registerInteractiveComponent(this, { el: this.dayGrid.el }); - }; - SimpleDayGrid.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.context.calendar.unregisterInteractiveComponent(this); - }; - SimpleDayGrid.prototype.render = function (props, context) { - var dayGrid = this.dayGrid; - var dateProfile = props.dateProfile, dayTable = props.dayTable; - dayGrid.receiveContext(context); // hack because context is used in sliceProps - dayGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, props.nextDayThreshold, context.calendar, dayGrid, dayTable), { dateProfile: dateProfile, cells: dayTable.cells, isRigid: props.isRigid }), context); - }; - SimpleDayGrid.prototype.buildPositionCaches = function () { - this.dayGrid.buildPositionCaches(); - }; - SimpleDayGrid.prototype.queryHit = function (positionLeft, positionTop) { - var rawHit = this.dayGrid.positionToHit(positionLeft, positionTop); - if (rawHit) { - return { - component: this.dayGrid, - 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 SimpleDayGrid; -}(DateComponent)); -var DayGridSlicer = /** @class */ (function (_super) { - __extends(DayGridSlicer, _super); - function DayGridSlicer() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayGridSlicer.prototype.sliceRange = function (dateRange, dayTable) { - return dayTable.sliceRange(dateRange); - }; - return DayGridSlicer; -}(Slicer)); - -var DayGridView = /** @class */ (function (_super) { - __extends(DayGridView, _super); - function DayGridView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildDayTable = memoize(buildDayTable); - return _this; - } - DayGridView.prototype.render = function (props, context) { - _super.prototype.render.call(this, props, context); // will call _renderSkeleton/_unrenderSkeleton - var dateProfile = this.props.dateProfile; - var dayTable = this.dayTable = - this.buildDayTable(dateProfile, props.dateProfileGenerator); - if (this.header) { - this.header.receiveProps({ - dateProfile: dateProfile, - dates: dayTable.headerDates, - datesRepDistinctDays: dayTable.rowCnt === 1, - renderIntroHtml: this.renderHeadIntroHtml - }, context); - } - this.simpleDayGrid.receiveProps({ - dateProfile: dateProfile, - dayTable: dayTable, - businessHours: props.businessHours, - dateSelection: props.dateSelection, - eventStore: props.eventStore, - eventUiBases: props.eventUiBases, - eventSelection: props.eventSelection, - eventDrag: props.eventDrag, - eventResize: props.eventResize, - isRigid: this.hasRigidRows(), - nextDayThreshold: this.context.nextDayThreshold - }, context); - }; - DayGridView.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.simpleDayGrid = new SimpleDayGrid(this.dayGrid); - }; - DayGridView.prototype._unrenderSkeleton = function () { - _super.prototype._unrenderSkeleton.call(this); - if (this.header) { - this.header.destroy(); - } - this.simpleDayGrid.destroy(); - }; - return DayGridView; -}(AbstractDayGridView)); -function buildDayTable(dateProfile, dateProfileGenerator) { - var daySeries = new DaySeries(dateProfile.renderRange, dateProfileGenerator); - return new DayTable(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit)); -} - -var main = createPlugin({ - defaultView: 'dayGridMonth', - views: { - dayGrid: DayGridView, - dayGridDay: { - type: 'dayGrid', - duration: { days: 1 } - }, - dayGridWeek: { - type: 'dayGrid', - duration: { weeks: 1 } - }, - dayGridMonth: { - type: 'dayGrid', - duration: { months: 1 }, - monthMode: true, - fixedWeekCount: true - } - } -}); - -export default main; -export { AbstractDayGridView, DayBgRow, DayGrid, DayGridSlicer, DayGridView, SimpleDayGrid, buildDayTable as buildBasicDayTable }; diff --git a/library/fullcalendar/packages/daygrid/main.js b/library/fullcalendar/packages/daygrid/main.js deleted file mode 100644 index 8ccdef25d..000000000 --- a/library/fullcalendar/packages/daygrid/main.js +++ /dev/null @@ -1,1669 +0,0 @@ -/*! -FullCalendar Day 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')) : - typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) : - (global = global || self, factory(global.FullCalendarDayGrid = {}, 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 __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);
- }; - - var DayGridDateProfileGenerator = /** @class */ (function (_super) { - __extends(DayGridDateProfileGenerator, _super); - function DayGridDateProfileGenerator() { - return _super !== null && _super.apply(this, arguments) || this; - } - // Computes the date range that will be rendered. - DayGridDateProfileGenerator.prototype.buildRenderRange = function (currentRange, currentRangeUnit, isRangeAllDay) { - var dateEnv = this.dateEnv; - var renderRange = _super.prototype.buildRenderRange.call(this, currentRange, currentRangeUnit, isRangeAllDay); - var start = renderRange.start; - var end = renderRange.end; - var endOfWeek; - // year and month views should be aligned with weeks. this is already done for week - if (/^(year|month)$/.test(currentRangeUnit)) { - start = dateEnv.startOfWeek(start); - // make end-of-week if not already - endOfWeek = dateEnv.startOfWeek(end); - if (endOfWeek.valueOf() !== end.valueOf()) { - end = core.addWeeks(endOfWeek, 1); - } - } - // ensure 6 weeks - if (this.options.monthMode && - this.options.fixedWeekCount) { - var rowCnt = Math.ceil(// could be partial weeks due to hiddenDays - core.diffWeeks(start, end)); - end = core.addWeeks(end, 6 - rowCnt); - } - return { start: start, end: end }; - }; - return DayGridDateProfileGenerator; - }(core.DateProfileGenerator)); - - /* A rectangular panel that is absolutely positioned over other content - ------------------------------------------------------------------------------------------------------------------------ - Options: - - className (string) - - content (HTML string, element, or element array) - - parentEl - - top - - left - - right (the x coord of where the right edge should be. not a "CSS" right) - - autoHide (boolean) - - show (callback) - - hide (callback) - */ - var Popover = /** @class */ (function () { - function Popover(options) { - var _this = this; - this.isHidden = true; - this.margin = 10; // the space required between the popover and the edges of the scroll container - // Triggered when the user clicks *anywhere* in the document, for the autoHide feature - this.documentMousedown = function (ev) { - // only hide the popover if the click happened outside the popover - if (_this.el && !_this.el.contains(ev.target)) { - _this.hide(); - } - }; - this.options = options; - } - // Shows the popover on the specified position. Renders it if not already - Popover.prototype.show = function () { - if (this.isHidden) { - if (!this.el) { - this.render(); - } - this.el.style.display = ''; - this.position(); - this.isHidden = false; - this.trigger('show'); - } - }; - // Hides the popover, through CSS, but does not remove it from the DOM - Popover.prototype.hide = function () { - if (!this.isHidden) { - this.el.style.display = 'none'; - this.isHidden = true; - this.trigger('hide'); - } - }; - // Creates `this.el` and renders content inside of it - Popover.prototype.render = function () { - var _this = this; - var options = this.options; - var el = this.el = core.createElement('div', { - className: 'fc-popover ' + (options.className || ''), - style: { - top: '0', - left: '0' - } - }); - if (typeof options.content === 'function') { - options.content(el); - } - options.parentEl.appendChild(el); - // when a click happens on anything inside with a 'fc-close' className, hide the popover - core.listenBySelector(el, 'click', '.fc-close', function (ev) { - _this.hide(); - }); - if (options.autoHide) { - document.addEventListener('mousedown', this.documentMousedown); - } - }; - // Hides and unregisters any handlers - Popover.prototype.destroy = function () { - this.hide(); - if (this.el) { - core.removeElement(this.el); - this.el = null; - } - document.removeEventListener('mousedown', this.documentMousedown); - }; - // Positions the popover optimally, using the top/left/right options - Popover.prototype.position = function () { - var options = this.options; - var el = this.el; - var elDims = el.getBoundingClientRect(); // only used for width,height - var origin = core.computeRect(el.offsetParent); - var clippingRect = core.computeClippingRect(options.parentEl); - var top; // the "position" (not "offset") values for the popover - var left; // - // compute top and left - top = options.top || 0; - if (options.left !== undefined) { - left = options.left; - } - else if (options.right !== undefined) { - left = options.right - elDims.width; // derive the left value from the right value - } - else { - left = 0; - } - // constrain to the view port. if constrained by two edges, give precedence to top/left - top = Math.min(top, clippingRect.bottom - elDims.height - this.margin); - top = Math.max(top, clippingRect.top + this.margin); - left = Math.min(left, clippingRect.right - elDims.width - this.margin); - left = Math.max(left, clippingRect.left + this.margin); - core.applyStyle(el, { - top: top - origin.top, - left: left - origin.left - }); - }; - // Triggers a callback. Calls a function in the option hash of the same name. - // Arguments beyond the first `name` are forwarded on. - // TODO: better code reuse for this. Repeat code - // can kill this??? - Popover.prototype.trigger = function (name) { - if (this.options[name]) { - this.options[name].apply(this, Array.prototype.slice.call(arguments, 1)); - } - }; - return Popover; - }()); - - /* Event-rendering methods for the DayGrid class - ----------------------------------------------------------------------------------------------------------------------*/ - // "Simple" is bad a name. has nothing to do with SimpleDayGrid - var SimpleDayGridEventRenderer = /** @class */ (function (_super) { - __extends(SimpleDayGridEventRenderer, _super); - function SimpleDayGridEventRenderer() { - return _super !== null && _super.apply(this, arguments) || this; - } - // Builds the HTML to be used for the default element for an individual segment - SimpleDayGridEventRenderer.prototype.renderSegHtml = function (seg, mirrorInfo) { - var context = this.context; - var eventRange = seg.eventRange; - var eventDef = eventRange.def; - var eventUi = eventRange.ui; - var allDay = eventDef.allDay; - var isDraggable = core.computeEventDraggable(context, eventDef, eventUi); - var isResizableFromStart = allDay && seg.isStart && core.computeEventStartResizable(context, eventDef, eventUi); - var isResizableFromEnd = allDay && seg.isEnd && core.computeEventEndResizable(context, eventDef, eventUi); - var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd, mirrorInfo); - var skinCss = core.cssToStr(this.getSkinCss(eventUi)); - var timeHtml = ''; - var timeText; - var titleHtml; - classes.unshift('fc-day-grid-event', 'fc-h-event'); - // Only display a timed events time if it is the starting segment - if (seg.isStart) { - timeText = this.getTimeText(eventRange); - if (timeText) { - timeHtml = '<span class="fc-time">' + core.htmlEscape(timeText) + '</span>'; - } - } - titleHtml = - '<span class="fc-title">' + - (core.htmlEscape(eventDef.title || '') || ' ') + // we always want one line of height - '</span>'; - return '<a class="' + classes.join(' ') + '"' + - (eventDef.url ? - ' href="' + core.htmlEscape(eventDef.url) + '"' : - '') + - (skinCss ? - ' style="' + skinCss + '"' : - '') + - '>' + - '<div class="fc-content">' + - (context.options.dir === 'rtl' ? - titleHtml + ' ' + timeHtml : // put a natural space in between - timeHtml + ' ' + titleHtml // - ) + - '</div>' + - (isResizableFromStart ? - '<div class="fc-resizer fc-start-resizer"></div>' : - '') + - (isResizableFromEnd ? - '<div class="fc-resizer fc-end-resizer"></div>' : - '') + - '</a>'; - }; - // Computes a default event time formatting string if `eventTimeFormat` is not explicitly defined - SimpleDayGridEventRenderer.prototype.computeEventTimeFormat = function () { - return { - hour: 'numeric', - minute: '2-digit', - omitZeroMinute: true, - meridiem: 'narrow' - }; - }; - SimpleDayGridEventRenderer.prototype.computeDisplayEventEnd = function () { - return false; // TODO: somehow consider the originating DayGrid's column count - }; - return SimpleDayGridEventRenderer; - }(core.FgEventRenderer)); - - /* Event-rendering methods for the DayGrid class - ----------------------------------------------------------------------------------------------------------------------*/ - var DayGridEventRenderer = /** @class */ (function (_super) { - __extends(DayGridEventRenderer, _super); - function DayGridEventRenderer(dayGrid) { - var _this = _super.call(this) || this; - _this.dayGrid = dayGrid; - return _this; - } - // Renders the given foreground event segments onto the grid - DayGridEventRenderer.prototype.attachSegs = function (segs, mirrorInfo) { - var rowStructs = this.rowStructs = this.renderSegRows(segs); - // append to each row's content skeleton - this.dayGrid.rowEls.forEach(function (rowNode, i) { - rowNode.querySelector('.fc-content-skeleton > table').appendChild(rowStructs[i].tbodyEl); - }); - // removes the "more.." events popover - if (!mirrorInfo) { - this.dayGrid.removeSegPopover(); - } - }; - // Unrenders all currently rendered foreground event segments - DayGridEventRenderer.prototype.detachSegs = function () { - var rowStructs = this.rowStructs || []; - var rowStruct; - while ((rowStruct = rowStructs.pop())) { - core.removeElement(rowStruct.tbodyEl); - } - this.rowStructs = null; - }; - // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton. - // Returns an array of rowStruct objects (see the bottom of `renderSegRow`). - // PRECONDITION: each segment shoud already have a rendered and assigned `.el` - DayGridEventRenderer.prototype.renderSegRows = function (segs) { - var rowStructs = []; - var segRows; - var row; - segRows = this.groupSegRows(segs); // group into nested arrays - // iterate each row of segment groupings - for (row = 0; row < segRows.length; row++) { - rowStructs.push(this.renderSegRow(row, segRows[row])); - } - return rowStructs; - }; - // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains - // the segments. Returns object with a bunch of internal data about how the render was calculated. - // NOTE: modifies rowSegs - DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) { - var isRtl = this.context.isRtl; - var dayGrid = this.dayGrid; - var colCnt = dayGrid.colCnt; - var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels - var levelCnt = Math.max(1, segLevels.length); // ensure at least one level - var tbody = document.createElement('tbody'); - var segMatrix = []; // lookup for which segments are rendered into which level+col cells - var cellMatrix = []; // lookup for all <td> elements of the level+col matrix - var loneCellMatrix = []; // lookup for <td> elements that only take up a single column - var i; - var levelSegs; - var col; - var tr; - var j; - var seg; - var td; - // populates empty cells from the current column (`col`) to `endCol` - function emptyCellsUntil(endCol) { - while (col < endCol) { - // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell - td = (loneCellMatrix[i - 1] || [])[col]; - if (td) { - td.rowSpan = (td.rowSpan || 1) + 1; - } - else { - td = document.createElement('td'); - tr.appendChild(td); - } - cellMatrix[i][col] = td; - loneCellMatrix[i][col] = td; - col++; - } - } - for (i = 0; i < levelCnt; i++) { // iterate through all levels - levelSegs = segLevels[i]; - col = 0; - tr = document.createElement('tr'); - segMatrix.push([]); - cellMatrix.push([]); - loneCellMatrix.push([]); - // levelCnt might be 1 even though there are no actual levels. protect against this. - // this single empty row is useful for styling. - if (levelSegs) { - for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level - seg = levelSegs[j]; - var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; - var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol; - emptyCellsUntil(leftCol); - // create a container that occupies or more columns. append the event element. - td = core.createElement('td', { className: 'fc-event-container' }, seg.el); - if (leftCol !== rightCol) { - td.colSpan = rightCol - leftCol + 1; - } - else { // a single-column segment - loneCellMatrix[i][col] = td; - } - while (col <= rightCol) { - cellMatrix[i][col] = td; - segMatrix[i][col] = seg; - col++; - } - tr.appendChild(td); - } - } - emptyCellsUntil(colCnt); // finish off the row - var introHtml = dayGrid.renderProps.renderIntroHtml(); - if (introHtml) { - if (isRtl) { - core.appendToElement(tr, introHtml); - } - else { - core.prependToElement(tr, introHtml); - } - } - tbody.appendChild(tr); - } - return { - row: row, - tbodyEl: tbody, - cellMatrix: cellMatrix, - segMatrix: segMatrix, - segLevels: segLevels, - segs: rowSegs - }; - }; - // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels. - // NOTE: modifies segs - DayGridEventRenderer.prototype.buildSegLevels = function (segs) { - var isRtl = this.context.isRtl; - var colCnt = this.dayGrid.colCnt; - var levels = []; - var i; - var seg; - var j; - // Give preference to elements with certain criteria, so they have - // a chance to be closer to the top. - segs = this.sortEventSegs(segs); - for (i = 0; i < segs.length; i++) { - seg = segs[i]; - // loop through levels, starting with the topmost, until the segment doesn't collide with other segments - for (j = 0; j < levels.length; j++) { - if (!isDaySegCollision(seg, levels[j])) { - break; - } - } - // `j` now holds the desired subrow index - seg.level = j; - seg.leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; // for sorting only - seg.rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol // for sorting only - ; - (levels[j] || (levels[j] = [])).push(seg); - } - // order segments left-to-right. very important if calendar is RTL - for (j = 0; j < levels.length; j++) { - levels[j].sort(compareDaySegCols); - } - return levels; - }; - // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row - DayGridEventRenderer.prototype.groupSegRows = function (segs) { - var segRows = []; - var i; - for (i = 0; i < this.dayGrid.rowCnt; i++) { - segRows.push([]); - } - for (i = 0; i < segs.length; i++) { - segRows[segs[i].row].push(segs[i]); - } - return segRows; - }; - // Computes a default `displayEventEnd` value if one is not expliclty defined - DayGridEventRenderer.prototype.computeDisplayEventEnd = function () { - return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day - }; - return DayGridEventRenderer; - }(SimpleDayGridEventRenderer)); - // Computes whether two segments' columns collide. They are assumed to be in the same row. - function isDaySegCollision(seg, otherSegs) { - var i; - var otherSeg; - for (i = 0; i < otherSegs.length; i++) { - otherSeg = otherSegs[i]; - if (otherSeg.firstCol <= seg.lastCol && - otherSeg.lastCol >= seg.firstCol) { - return true; - } - } - return false; - } - // A cmp function for determining the leftmost event - function compareDaySegCols(a, b) { - return a.leftCol - b.leftCol; - } - - var DayGridMirrorRenderer = /** @class */ (function (_super) { - __extends(DayGridMirrorRenderer, _super); - function DayGridMirrorRenderer() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayGridMirrorRenderer.prototype.attachSegs = function (segs, mirrorInfo) { - var sourceSeg = mirrorInfo.sourceSeg; - var rowStructs = this.rowStructs = this.renderSegRows(segs); - // inject each new event skeleton into each associated row - this.dayGrid.rowEls.forEach(function (rowNode, row) { - var skeletonEl = core.htmlToElement('<div class="fc-mirror-skeleton"><table></table></div>'); // will be absolutely positioned - var skeletonTopEl; - var skeletonTop; - // If there is an original segment, match the top position. Otherwise, put it at the row's top level - if (sourceSeg && sourceSeg.row === row) { - skeletonTopEl = sourceSeg.el; - } - else { - skeletonTopEl = rowNode.querySelector('.fc-content-skeleton tbody'); - if (!skeletonTopEl) { // when no events - skeletonTopEl = rowNode.querySelector('.fc-content-skeleton table'); - } - } - skeletonTop = skeletonTopEl.getBoundingClientRect().top - - rowNode.getBoundingClientRect().top; // the offsetParent origin - skeletonEl.style.top = skeletonTop + 'px'; - skeletonEl.querySelector('table').appendChild(rowStructs[row].tbodyEl); - rowNode.appendChild(skeletonEl); - }); - }; - return DayGridMirrorRenderer; - }(DayGridEventRenderer)); - - var EMPTY_CELL_HTML = '<td style="pointer-events:none"></td>'; - var DayGridFillRenderer = /** @class */ (function (_super) { - __extends(DayGridFillRenderer, _super); - function DayGridFillRenderer(dayGrid) { - var _this = _super.call(this) || this; - _this.fillSegTag = 'td'; // override the default tag name - _this.dayGrid = dayGrid; - return _this; - } - DayGridFillRenderer.prototype.renderSegs = function (type, context, segs) { - // don't render timed background events - if (type === 'bgEvent') { - segs = segs.filter(function (seg) { - return seg.eventRange.def.allDay; - }); - } - _super.prototype.renderSegs.call(this, type, context, segs); - }; - DayGridFillRenderer.prototype.attachSegs = function (type, segs) { - var els = []; - var i; - var seg; - var skeletonEl; - for (i = 0; i < segs.length; i++) { - seg = segs[i]; - skeletonEl = this.renderFillRow(type, seg); - this.dayGrid.rowEls[seg.row].appendChild(skeletonEl); - els.push(skeletonEl); - } - return els; - }; - // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered. - DayGridFillRenderer.prototype.renderFillRow = function (type, seg) { - var dayGrid = this.dayGrid; - var isRtl = this.context.isRtl; - var colCnt = dayGrid.colCnt; - var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; - var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol; - var startCol = leftCol; - var endCol = rightCol + 1; - var className; - var skeletonEl; - var trEl; - if (type === 'businessHours') { - className = 'bgevent'; - } - else { - className = type.toLowerCase(); - } - skeletonEl = core.htmlToElement('<div class="fc-' + className + '-skeleton">' + - '<table><tr></tr></table>' + - '</div>'); - trEl = skeletonEl.getElementsByTagName('tr')[0]; - if (startCol > 0) { - core.appendToElement(trEl, - // will create (startCol + 1) td's - new Array(startCol + 1).join(EMPTY_CELL_HTML)); - } - seg.el.colSpan = endCol - startCol; - trEl.appendChild(seg.el); - if (endCol < colCnt) { - core.appendToElement(trEl, - // will create (colCnt - endCol) td's - new Array(colCnt - endCol + 1).join(EMPTY_CELL_HTML)); - } - var introHtml = dayGrid.renderProps.renderIntroHtml(); - if (introHtml) { - if (isRtl) { - core.appendToElement(trEl, introHtml); - } - else { - core.prependToElement(trEl, introHtml); - } - } - return skeletonEl; - }; - return DayGridFillRenderer; - }(core.FillRenderer)); - - var DayTile = /** @class */ (function (_super) { - __extends(DayTile, _super); - function DayTile(el) { - var _this = _super.call(this, el) || this; - var eventRenderer = _this.eventRenderer = new DayTileEventRenderer(_this); - var renderFrame = _this.renderFrame = core.memoizeRendering(_this._renderFrame); - _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderFrame]); - _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]); - _this.renderEventDrag = core.memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]); - _this.renderEventResize = core.memoizeRendering(eventRenderer.hideByHash.bind(eventRenderer), eventRenderer.showByHash.bind(eventRenderer), [renderFrame]); - return _this; - } - DayTile.prototype.firstContext = function (context) { - context.calendar.registerInteractiveComponent(this, { - el: this.el, - useEventCenter: false - }); - }; - DayTile.prototype.render = function (props, context) { - this.renderFrame(props.date); - this.renderFgEvents(context, props.fgSegs); - this.renderEventSelection(props.eventSelection); - this.renderEventDrag(props.eventDragInstances); - this.renderEventResize(props.eventResizeInstances); - }; - DayTile.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.renderFrame.unrender(); // should unrender everything else - this.context.calendar.unregisterInteractiveComponent(this); - }; - DayTile.prototype._renderFrame = function (date) { - var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options; - var title = dateEnv.format(date, core.createFormatter(options.dayPopoverFormat) // TODO: cache - ); - this.el.innerHTML = - '<div class="fc-header ' + theme.getClass('popoverHeader') + '">' + - '<span class="fc-title">' + - core.htmlEscape(title) + - '</span>' + - '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' + - '</div>' + - '<div class="fc-body ' + theme.getClass('popoverContent') + '">' + - '<div class="fc-event-container"></div>' + - '</div>'; - this.segContainerEl = this.el.querySelector('.fc-event-container'); - }; - DayTile.prototype.queryHit = function (positionLeft, positionTop, elWidth, elHeight) { - var date = this.props.date; // HACK - if (positionLeft < elWidth && positionTop < elHeight) { - return { - component: this, - dateSpan: { - allDay: true, - range: { start: date, end: core.addDays(date, 1) } - }, - dayEl: this.el, - rect: { - left: 0, - top: 0, - right: elWidth, - bottom: elHeight - }, - layer: 1 - }; - } - }; - return DayTile; - }(core.DateComponent)); - var DayTileEventRenderer = /** @class */ (function (_super) { - __extends(DayTileEventRenderer, _super); - function DayTileEventRenderer(dayTile) { - var _this = _super.call(this) || this; - _this.dayTile = dayTile; - return _this; - } - DayTileEventRenderer.prototype.attachSegs = function (segs) { - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - this.dayTile.segContainerEl.appendChild(seg.el); - } - }; - DayTileEventRenderer.prototype.detachSegs = function (segs) { - for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) { - var seg = segs_2[_i]; - core.removeElement(seg.el); - } - }; - return DayTileEventRenderer; - }(SimpleDayGridEventRenderer)); - - var DayBgRow = /** @class */ (function () { - function DayBgRow(context) { - this.context = context; - } - DayBgRow.prototype.renderHtml = function (props) { - var parts = []; - if (props.renderIntroHtml) { - parts.push(props.renderIntroHtml()); - } - for (var _i = 0, _a = props.cells; _i < _a.length; _i++) { - var cell = _a[_i]; - parts.push(renderCellHtml(cell.date, props.dateProfile, this.context, cell.htmlAttrs)); - } - if (!props.cells.length) { - parts.push('<td class="fc-day ' + this.context.theme.getClass('widgetContent') + '"></td>'); - } - if (this.context.options.dir === 'rtl') { - parts.reverse(); - } - return '<tr>' + parts.join('') + '</tr>'; - }; - return DayBgRow; - }()); - function renderCellHtml(date, dateProfile, context, otherAttrs) { - var dateEnv = context.dateEnv, theme = context.theme; - var isDateValid = core.rangeContainsMarker(dateProfile.activeRange, date); // TODO: called too frequently. cache somehow. - var classes = core.getDayClasses(date, dateProfile, context); - classes.unshift('fc-day', theme.getClass('widgetContent')); - return '<td class="' + classes.join(' ') + '"' + - (isDateValid ? - ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' : - '') + - (otherAttrs ? - ' ' + otherAttrs : - '') + - '></td>'; - } - - var DAY_NUM_FORMAT = core.createFormatter({ day: 'numeric' }); - var WEEK_NUM_FORMAT = core.createFormatter({ week: 'numeric' }); - var DayGrid = /** @class */ (function (_super) { - __extends(DayGrid, _super); - function DayGrid(el, renderProps) { - var _this = _super.call(this, el) || this; - _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid - _this.isCellSizesDirty = false; - _this.renderProps = renderProps; - var eventRenderer = _this.eventRenderer = new DayGridEventRenderer(_this); - var fillRenderer = _this.fillRenderer = new DayGridFillRenderer(_this); - _this.mirrorRenderer = new DayGridMirrorRenderer(_this); - var renderCells = _this.renderCells = core.memoizeRendering(_this._renderCells, _this._unrenderCells); - _this.renderBusinessHours = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'businessHours'), fillRenderer.unrender.bind(fillRenderer, 'businessHours'), [renderCells]); - _this.renderDateSelection = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'highlight'), fillRenderer.unrender.bind(fillRenderer, 'highlight'), [renderCells]); - _this.renderBgEvents = core.memoizeRendering(fillRenderer.renderSegs.bind(fillRenderer, 'bgEvent'), fillRenderer.unrender.bind(fillRenderer, 'bgEvent'), [renderCells]); - _this.renderFgEvents = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [renderCells]); - _this.renderEventSelection = core.memoizeRendering(eventRenderer.selectByInstanceId.bind(eventRenderer), eventRenderer.unselectByInstanceId.bind(eventRenderer), [_this.renderFgEvents]); - _this.renderEventDrag = core.memoizeRendering(_this._renderEventDrag, _this._unrenderEventDrag, [renderCells]); - _this.renderEventResize = core.memoizeRendering(_this._renderEventResize, _this._unrenderEventResize, [renderCells]); - return _this; - } - DayGrid.prototype.render = function (props, context) { - var cells = props.cells; - this.rowCnt = cells.length; - this.colCnt = cells[0].length; - this.renderCells(cells, props.isRigid); - this.renderBusinessHours(context, props.businessHourSegs); - this.renderDateSelection(context, props.dateSelectionSegs); - this.renderBgEvents(context, props.bgEventSegs); - this.renderFgEvents(context, props.fgEventSegs); - this.renderEventSelection(props.eventSelection); - this.renderEventDrag(props.eventDrag); - this.renderEventResize(props.eventResize); - if (this.segPopoverTile) { - this.updateSegPopoverTile(); - } - }; - DayGrid.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.renderCells.unrender(); // will unrender everything else - }; - DayGrid.prototype.getCellRange = function (row, col) { - var start = this.props.cells[row][col].date; - var end = core.addDays(start, 1); - return { start: start, end: end }; - }; - DayGrid.prototype.updateSegPopoverTile = function (date, segs) { - var ownProps = this.props; - this.segPopoverTile.receiveProps({ - date: date || this.segPopoverTile.props.date, - fgSegs: segs || this.segPopoverTile.props.fgSegs, - eventSelection: ownProps.eventSelection, - eventDragInstances: ownProps.eventDrag ? ownProps.eventDrag.affectedInstances : null, - eventResizeInstances: ownProps.eventResize ? ownProps.eventResize.affectedInstances : null - }, this.context); - }; - /* Date Rendering - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype._renderCells = function (cells, isRigid) { - var _a = this.context, calendar = _a.calendar, view = _a.view, isRtl = _a.isRtl, dateEnv = _a.dateEnv; - var _b = this, rowCnt = _b.rowCnt, colCnt = _b.colCnt; - var html = ''; - var row; - var col; - for (row = 0; row < rowCnt; row++) { - html += this.renderDayRowHtml(row, isRigid); - } - this.el.innerHTML = html; - this.rowEls = core.findElements(this.el, '.fc-row'); - this.cellEls = core.findElements(this.el, '.fc-day, .fc-disabled-day'); - if (isRtl) { - this.cellEls.reverse(); - } - this.rowPositions = new core.PositionCache(this.el, this.rowEls, false, true // vertical - ); - this.colPositions = new core.PositionCache(this.el, this.cellEls.slice(0, colCnt), // only the first row - true, false // horizontal - ); - // trigger dayRender with each cell's element - for (row = 0; row < rowCnt; row++) { - for (col = 0; col < colCnt; col++) { - calendar.publiclyTrigger('dayRender', [ - { - date: dateEnv.toDate(cells[row][col].date), - el: this.getCellEl(row, col), - view: view - } - ]); - } - } - this.isCellSizesDirty = true; - }; - DayGrid.prototype._unrenderCells = function () { - this.removeSegPopover(); - }; - // Generates the HTML for a single row, which is a div that wraps a table. - // `row` is the row number. - DayGrid.prototype.renderDayRowHtml = function (row, isRigid) { - var theme = this.context.theme; - var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')]; - if (isRigid) { - classes.push('fc-rigid'); - } - var bgRow = new DayBgRow(this.context); - return '' + - '<div class="' + classes.join(' ') + '">' + - '<div class="fc-bg">' + - '<table class="' + theme.getClass('tableGrid') + '">' + - bgRow.renderHtml({ - cells: this.props.cells[row], - dateProfile: this.props.dateProfile, - renderIntroHtml: this.renderProps.renderBgIntroHtml - }) + - '</table>' + - '</div>' + - '<div class="fc-content-skeleton">' + - '<table>' + - (this.getIsNumbersVisible() ? - '<thead>' + - this.renderNumberTrHtml(row) + - '</thead>' : - '') + - '</table>' + - '</div>' + - '</div>'; - }; - DayGrid.prototype.getIsNumbersVisible = function () { - return this.getIsDayNumbersVisible() || - this.renderProps.cellWeekNumbersVisible || - this.renderProps.colWeekNumbersVisible; - }; - DayGrid.prototype.getIsDayNumbersVisible = function () { - return this.rowCnt > 1; - }; - /* Grid Number Rendering - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.renderNumberTrHtml = function (row) { - var isRtl = this.context.isRtl; - var intro = this.renderProps.renderNumberIntroHtml(row, this); - return '' + - '<tr>' + - (isRtl ? '' : intro) + - this.renderNumberCellsHtml(row) + - (isRtl ? intro : '') + - '</tr>'; - }; - DayGrid.prototype.renderNumberCellsHtml = function (row) { - var htmls = []; - var col; - var date; - for (col = 0; col < this.colCnt; col++) { - date = this.props.cells[row][col].date; - htmls.push(this.renderNumberCellHtml(date)); - } - if (this.context.isRtl) { - htmls.reverse(); - } - return htmls.join(''); - }; - // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton. - // The number row will only exist if either day numbers or week numbers are turned on. - DayGrid.prototype.renderNumberCellHtml = function (date) { - var _a = this.context, dateEnv = _a.dateEnv, options = _a.options; - var html = ''; - var isDateValid = core.rangeContainsMarker(this.props.dateProfile.activeRange, date); // TODO: called too frequently. cache somehow. - var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid; - var classes; - var weekCalcFirstDow; - if (!isDayNumberVisible && !this.renderProps.cellWeekNumbersVisible) { - // no numbers in day cell (week number must be along the side) - return '<td></td>'; // will create an empty space above events :( - } - classes = core.getDayClasses(date, this.props.dateProfile, this.context); - classes.unshift('fc-day-top'); - if (this.renderProps.cellWeekNumbersVisible) { - weekCalcFirstDow = dateEnv.weekDow; - } - html += '<td class="' + classes.join(' ') + '"' + - (isDateValid ? - ' data-date="' + dateEnv.formatIso(date, { omitTime: true }) + '"' : - '') + - '>'; - if (this.renderProps.cellWeekNumbersVisible && (date.getUTCDay() === weekCalcFirstDow)) { - html += core.buildGotoAnchorHtml(options, dateEnv, { date: date, type: 'week' }, { 'class': 'fc-week-number' }, dateEnv.format(date, WEEK_NUM_FORMAT) // inner HTML - ); - } - if (isDayNumberVisible) { - html += core.buildGotoAnchorHtml(options, dateEnv, date, { 'class': 'fc-day-number' }, dateEnv.format(date, DAY_NUM_FORMAT) // inner HTML - ); - } - html += '</td>'; - return html; - }; - /* Sizing - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.updateSize = function (isResize) { - var calendar = this.context.calendar; - var _a = this, fillRenderer = _a.fillRenderer, eventRenderer = _a.eventRenderer, mirrorRenderer = _a.mirrorRenderer; - if (isResize || - this.isCellSizesDirty || - calendar.isEventsUpdated // hack - ) { - this.buildPositionCaches(); - this.isCellSizesDirty = false; - } - fillRenderer.computeSizes(isResize); - eventRenderer.computeSizes(isResize); - mirrorRenderer.computeSizes(isResize); - fillRenderer.assignSizes(isResize); - eventRenderer.assignSizes(isResize); - mirrorRenderer.assignSizes(isResize); - }; - DayGrid.prototype.buildPositionCaches = function () { - this.buildColPositions(); - this.buildRowPositions(); - }; - DayGrid.prototype.buildColPositions = function () { - this.colPositions.build(); - }; - DayGrid.prototype.buildRowPositions = function () { - this.rowPositions.build(); - this.rowPositions.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack - }; - /* Hit System - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.positionToHit = function (leftPosition, topPosition) { - var _a = this, colPositions = _a.colPositions, rowPositions = _a.rowPositions; - var col = colPositions.leftToIndex(leftPosition); - var row = rowPositions.topToIndex(topPosition); - if (row != null && col != null) { - return { - row: row, - col: col, - dateSpan: { - range: this.getCellRange(row, col), - allDay: true - }, - dayEl: this.getCellEl(row, col), - relativeRect: { - left: colPositions.lefts[col], - right: colPositions.rights[col], - top: rowPositions.tops[row], - bottom: rowPositions.bottoms[row] - } - }; - } - }; - /* Cell System - ------------------------------------------------------------------------------------------------------------------*/ - // FYI: the first column is the leftmost column, regardless of date - DayGrid.prototype.getCellEl = function (row, col) { - return this.cellEls[row * this.colCnt + col]; - }; - /* Event Drag Visualization - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype._renderEventDrag = function (state) { - if (state) { - this.eventRenderer.hideByHash(state.affectedInstances); - this.fillRenderer.renderSegs('highlight', this.context, state.segs); - } - }; - DayGrid.prototype._unrenderEventDrag = function (state) { - if (state) { - this.eventRenderer.showByHash(state.affectedInstances); - this.fillRenderer.unrender('highlight', this.context); - } - }; - /* Event Resize Visualization - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype._renderEventResize = function (state) { - if (state) { - this.eventRenderer.hideByHash(state.affectedInstances); - this.fillRenderer.renderSegs('highlight', this.context, state.segs); - this.mirrorRenderer.renderSegs(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg }); - } - }; - DayGrid.prototype._unrenderEventResize = function (state) { - if (state) { - this.eventRenderer.showByHash(state.affectedInstances); - this.fillRenderer.unrender('highlight', this.context); - this.mirrorRenderer.unrender(this.context, state.segs, { isResizing: true, sourceSeg: state.sourceSeg }); - } - }; - /* More+ Link Popover - ------------------------------------------------------------------------------------------------------------------*/ - DayGrid.prototype.removeSegPopover = function () { - if (this.segPopover) { - this.segPopover.hide(); // in handler, will call segPopover's removeElement - } - }; - // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid. - // `levelLimit` can be false (don't limit), a number, or true (should be computed). - DayGrid.prototype.limitRows = function (levelLimit) { - var rowStructs = this.eventRenderer.rowStructs || []; - var row; // row # - var rowLevelLimit; - for (row = 0; row < rowStructs.length; row++) { - this.unlimitRow(row); - if (!levelLimit) { - rowLevelLimit = false; - } - else if (typeof levelLimit === 'number') { - rowLevelLimit = levelLimit; - } - else { - rowLevelLimit = this.computeRowLevelLimit(row); - } - if (rowLevelLimit !== false) { - this.limitRow(row, rowLevelLimit); - } - } - }; - // Computes the number of levels a row will accomodate without going outside its bounds. - // Assumes the row is "rigid" (maintains a constant height regardless of what is inside). - // `row` is the row number. - DayGrid.prototype.computeRowLevelLimit = function (row) { - var rowEl = this.rowEls[row]; // the containing "fake" row div - var rowBottom = rowEl.getBoundingClientRect().bottom; // relative to viewport! - var trEls = core.findChildren(this.eventRenderer.rowStructs[row].tbodyEl); - var i; - var trEl; - // Reveal one level <tr> at a time and stop when we find one out of bounds - for (i = 0; i < trEls.length; i++) { - trEl = trEls[i]; - trEl.classList.remove('fc-limited'); // reset to original state (reveal) - if (trEl.getBoundingClientRect().bottom > rowBottom) { - return i; - } - } - return false; // should not limit at all - }; - // Limits the given grid row to the maximum number of levels and injects "more" links if necessary. - // `row` is the row number. - // `levelLimit` is a number for the maximum (inclusive) number of levels allowed. - DayGrid.prototype.limitRow = function (row, levelLimit) { - var _this = this; - var colCnt = this.colCnt; - var isRtl = this.context.isRtl; - var rowStruct = this.eventRenderer.rowStructs[row]; - var moreNodes = []; // array of "more" <a> links and <td> DOM nodes - var col = 0; // col #, left-to-right (not chronologically) - var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right - var cellMatrix; // a matrix (by level, then column) of all <td> elements in the row - var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes - var i; - var seg; - var segsBelow; // array of segment objects below `seg` in the current `col` - var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies - var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column) - var td; - var rowSpan; - var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell - var j; - var moreTd; - var moreWrap; - var moreLink; - // Iterates through empty level cells and places "more" links inside if need be - var emptyCellsUntil = function (endCol) { - while (col < endCol) { - segsBelow = _this.getCellSegs(row, col, levelLimit); - if (segsBelow.length) { - td = cellMatrix[levelLimit - 1][col]; - moreLink = _this.renderMoreLink(row, col, segsBelow); - moreWrap = core.createElement('div', null, moreLink); - td.appendChild(moreWrap); - moreNodes.push(moreWrap); - } - col++; - } - }; - if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit? - levelSegs = rowStruct.segLevels[levelLimit - 1]; - cellMatrix = rowStruct.cellMatrix; - limitedNodes = core.findChildren(rowStruct.tbodyEl).slice(levelLimit); // get level <tr> elements past the limit - limitedNodes.forEach(function (node) { - node.classList.add('fc-limited'); // hide elements and get a simple DOM-nodes array - }); - // iterate though segments in the last allowable level - for (i = 0; i < levelSegs.length; i++) { - seg = levelSegs[i]; - var leftCol = isRtl ? (colCnt - 1 - seg.lastCol) : seg.firstCol; - var rightCol = isRtl ? (colCnt - 1 - seg.firstCol) : seg.lastCol; - emptyCellsUntil(leftCol); // process empty cells before the segment - // determine *all* segments below `seg` that occupy the same columns - colSegsBelow = []; - totalSegsBelow = 0; - while (col <= rightCol) { - segsBelow = this.getCellSegs(row, col, levelLimit); - colSegsBelow.push(segsBelow); - totalSegsBelow += segsBelow.length; - col++; - } - if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links? - td = cellMatrix[levelLimit - 1][leftCol]; // the segment's parent cell - rowSpan = td.rowSpan || 1; - segMoreNodes = []; - // make a replacement <td> for each column the segment occupies. will be one for each colspan - for (j = 0; j < colSegsBelow.length; j++) { - moreTd = core.createElement('td', { className: 'fc-more-cell', rowSpan: rowSpan }); - segsBelow = colSegsBelow[j]; - moreLink = this.renderMoreLink(row, leftCol + j, [seg].concat(segsBelow) // count seg as hidden too - ); - moreWrap = core.createElement('div', null, moreLink); - moreTd.appendChild(moreWrap); - segMoreNodes.push(moreTd); - moreNodes.push(moreTd); - } - td.classList.add('fc-limited'); - core.insertAfterElement(td, segMoreNodes); - limitedNodes.push(td); - } - } - emptyCellsUntil(this.colCnt); // finish off the level - rowStruct.moreEls = moreNodes; // for easy undoing later - rowStruct.limitedEls = limitedNodes; // for easy undoing later - } - }; - // Reveals all levels and removes all "more"-related elements for a grid's row. - // `row` is a row number. - DayGrid.prototype.unlimitRow = function (row) { - var rowStruct = this.eventRenderer.rowStructs[row]; - if (rowStruct.moreEls) { - rowStruct.moreEls.forEach(core.removeElement); - rowStruct.moreEls = null; - } - if (rowStruct.limitedEls) { - rowStruct.limitedEls.forEach(function (limitedEl) { - limitedEl.classList.remove('fc-limited'); - }); - rowStruct.limitedEls = null; - } - }; - // Renders an <a> element that represents hidden event element for a cell. - // Responsible for attaching click handler as well. - DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) { - var _this = this; - var _a = this.context, calendar = _a.calendar, view = _a.view, dateEnv = _a.dateEnv, options = _a.options, isRtl = _a.isRtl; - var a = core.createElement('a', { className: 'fc-more' }); - a.innerText = this.getMoreLinkText(hiddenSegs.length); - a.addEventListener('click', function (ev) { - var clickOption = options.eventLimitClick; - var _col = isRtl ? _this.colCnt - col - 1 : col; // HACK: props.cells has different dir system? - var date = _this.props.cells[row][_col].date; - var moreEl = ev.currentTarget; - var dayEl = _this.getCellEl(row, col); - var allSegs = _this.getCellSegs(row, col); - // rescope the segments to be within the cell's date - var reslicedAllSegs = _this.resliceDaySegs(allSegs, date); - var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date); - if (typeof clickOption === 'function') { - // the returned value can be an atomic option - clickOption = calendar.publiclyTrigger('eventLimitClick', [ - { - date: dateEnv.toDate(date), - allDay: true, - dayEl: dayEl, - moreEl: moreEl, - segs: reslicedAllSegs, - hiddenSegs: reslicedHiddenSegs, - jsEvent: ev, - view: view - } - ]); - } - if (clickOption === 'popover') { - _this.showSegPopover(row, col, moreEl, reslicedAllSegs); - } - else if (typeof clickOption === 'string') { // a view name - calendar.zoomTo(date, clickOption); - } - }); - return a; - }; - // Reveals the popover that displays all events within a cell - DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) { - var _this = this; - var _a = this.context, calendar = _a.calendar, view = _a.view, theme = _a.theme, isRtl = _a.isRtl; - var _col = isRtl ? this.colCnt - col - 1 : col; // HACK: props.cells has different dir system? - var moreWrap = moreLink.parentNode; // the <div> wrapper around the <a> - var topEl; // the element we want to match the top coordinate of - var options; - if (this.rowCnt === 1) { - topEl = view.el; // will cause the popover to cover any sort of header - } - else { - topEl = this.rowEls[row]; // will align with top of row - } - options = { - className: 'fc-more-popover ' + theme.getClass('popover'), - parentEl: view.el, - top: core.computeRect(topEl).top, - autoHide: true, - content: function (el) { - _this.segPopoverTile = new DayTile(el); - _this.updateSegPopoverTile(_this.props.cells[row][_col].date, segs); - }, - hide: function () { - _this.segPopoverTile.destroy(); - _this.segPopoverTile = null; - _this.segPopover.destroy(); - _this.segPopover = null; - } - }; - // Determine horizontal coordinate. - // We use the moreWrap instead of the <td> to avoid border confusion. - if (isRtl) { - options.right = core.computeRect(moreWrap).right + 1; // +1 to be over cell border - } - else { - options.left = core.computeRect(moreWrap).left - 1; // -1 to be over cell border - } - this.segPopover = new Popover(options); - this.segPopover.show(); - calendar.releaseAfterSizingTriggers(); // hack for eventPositioned - }; - // Given the events within an array of segment objects, reslice them to be in a single day - DayGrid.prototype.resliceDaySegs = function (segs, dayDate) { - var dayStart = dayDate; - var dayEnd = core.addDays(dayStart, 1); - var dayRange = { start: dayStart, end: dayEnd }; - var newSegs = []; - for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) { - var seg = segs_1[_i]; - var eventRange = seg.eventRange; - var origRange = eventRange.range; - var slicedRange = core.intersectRanges(origRange, dayRange); - if (slicedRange) { - newSegs.push(__assign({}, seg, { eventRange: { - def: eventRange.def, - ui: __assign({}, eventRange.ui, { durationEditable: false }), - instance: eventRange.instance, - range: slicedRange - }, isStart: seg.isStart && slicedRange.start.valueOf() === origRange.start.valueOf(), isEnd: seg.isEnd && slicedRange.end.valueOf() === origRange.end.valueOf() })); - } - } - return newSegs; - }; - // Generates the text that should be inside a "more" link, given the number of events it represents - DayGrid.prototype.getMoreLinkText = function (num) { - var opt = this.context.options.eventLimitText; - if (typeof opt === 'function') { - return opt(num); - } - else { - return '+' + num + ' ' + opt; - } - }; - // Returns segments within a given cell. - // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs. - DayGrid.prototype.getCellSegs = function (row, col, startLevel) { - var segMatrix = this.eventRenderer.rowStructs[row].segMatrix; - var level = startLevel || 0; - var segs = []; - var seg; - while (level < segMatrix.length) { - seg = segMatrix[level][col]; - if (seg) { - segs.push(seg); - } - level++; - } - return segs; - }; - return DayGrid; - }(core.DateComponent)); - - var WEEK_NUM_FORMAT$1 = core.createFormatter({ week: 'numeric' }); - /* An abstract class for the daygrid views, as well as month view. Renders one or more rows of day cells. - ----------------------------------------------------------------------------------------------------------------------*/ - // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting. - // It is responsible for managing width/height. - var AbstractDayGridView = /** @class */ (function (_super) { - __extends(AbstractDayGridView, _super); - function AbstractDayGridView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.processOptions = core.memoize(_this._processOptions); - _this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton); - /* Header Rendering - ------------------------------------------------------------------------------------------------------------------*/ - // Generates the HTML that will go before the day-of week header cells - _this.renderHeadIntroHtml = function () { - var _a = _this.context, theme = _a.theme, options = _a.options; - if (_this.colWeekNumbersVisible) { - return '' + - '<th class="fc-week-number ' + theme.getClass('widgetHeader') + '" ' + _this.weekNumberStyleAttr() + '>' + - '<span>' + // needed for matchCellWidths - core.htmlEscape(options.weekLabel) + - '</span>' + - '</th>'; - } - return ''; - }; - /* Day Grid Rendering - ------------------------------------------------------------------------------------------------------------------*/ - // Generates the HTML that will go before content-skeleton cells that display the day/week numbers - _this.renderDayGridNumberIntroHtml = function (row, dayGrid) { - var _a = _this.context, options = _a.options, dateEnv = _a.dateEnv; - var weekStart = dayGrid.props.cells[row][0].date; - if (_this.colWeekNumbersVisible) { - return '' + - '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '>' + - core.buildGotoAnchorHtml(// aside from link, important for matchCellWidths - options, dateEnv, { date: weekStart, type: 'week', forceOff: dayGrid.colCnt === 1 }, dateEnv.format(weekStart, WEEK_NUM_FORMAT$1) // inner HTML - ) + - '</td>'; - } - return ''; - }; - // Generates the HTML that goes before the day bg cells for each day-row - _this.renderDayGridBgIntroHtml = function () { - var theme = _this.context.theme; - if (_this.colWeekNumbersVisible) { - return '<td class="fc-week-number ' + theme.getClass('widgetContent') + '" ' + _this.weekNumberStyleAttr() + '></td>'; - } - return ''; - }; - // Generates the HTML that goes before every other type of row generated by DayGrid. - // Affects mirror-skeleton and highlight-skeleton rows. - _this.renderDayGridIntroHtml = function () { - if (_this.colWeekNumbersVisible) { - return '<td class="fc-week-number" ' + _this.weekNumberStyleAttr() + '></td>'; - } - return ''; - }; - return _this; - } - AbstractDayGridView.prototype._processOptions = function (options) { - if (options.weekNumbers) { - if (options.weekNumbersWithinDays) { - this.cellWeekNumbersVisible = true; - this.colWeekNumbersVisible = false; - } - else { - this.cellWeekNumbersVisible = false; - this.colWeekNumbersVisible = true; - } - } - else { - this.colWeekNumbersVisible = false; - this.cellWeekNumbersVisible = false; - } - }; - AbstractDayGridView.prototype.render = function (props, context) { - _super.prototype.render.call(this, props, context); - this.processOptions(context.options); - this.renderSkeleton(context); - }; - AbstractDayGridView.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.renderSkeleton.unrender(); - }; - AbstractDayGridView.prototype._renderSkeleton = function (context) { - this.el.classList.add('fc-dayGrid-view'); - this.el.innerHTML = this.renderSkeletonHtml(); - this.scroller = new core.ScrollComponent('hidden', // overflow x - 'auto' // overflow y - ); - var dayGridContainerEl = this.scroller.el; - this.el.querySelector('.fc-body > tr > td').appendChild(dayGridContainerEl); - dayGridContainerEl.classList.add('fc-day-grid-container'); - var dayGridEl = core.createElement('div', { className: 'fc-day-grid' }); - dayGridContainerEl.appendChild(dayGridEl); - this.dayGrid = new DayGrid(dayGridEl, { - renderNumberIntroHtml: this.renderDayGridNumberIntroHtml, - renderBgIntroHtml: this.renderDayGridBgIntroHtml, - renderIntroHtml: this.renderDayGridIntroHtml, - colWeekNumbersVisible: this.colWeekNumbersVisible, - cellWeekNumbersVisible: this.cellWeekNumbersVisible - }); - }; - AbstractDayGridView.prototype._unrenderSkeleton = function () { - this.el.classList.remove('fc-dayGrid-view'); - this.dayGrid.destroy(); - this.scroller.destroy(); - }; - // Builds the HTML skeleton for the view. - // The day-grid component will render inside of a container defined by this HTML. - AbstractDayGridView.prototype.renderSkeletonHtml = function () { - var _a = this.context, theme = _a.theme, options = _a.options; - return '' + - '<table class="' + theme.getClass('tableGrid') + '">' + - (options.columnHeader ? - '<thead class="fc-head">' + - '<tr>' + - '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '"> </td>' + - '</tr>' + - '</thead>' : - '') + - '<tbody class="fc-body">' + - '<tr>' + - '<td class="' + theme.getClass('widgetContent') + '"></td>' + - '</tr>' + - '</tbody>' + - '</table>'; - }; - // Generates an HTML attribute string for setting the width of the week number column, if it is known - AbstractDayGridView.prototype.weekNumberStyleAttr = function () { - if (this.weekNumberWidth != null) { - return 'style="width:' + this.weekNumberWidth + 'px"'; - } - return ''; - }; - // Determines whether each row should have a constant height - AbstractDayGridView.prototype.hasRigidRows = function () { - var eventLimit = this.context.options.eventLimit; - return eventLimit && typeof eventLimit !== 'number'; - }; - /* Dimensions - ------------------------------------------------------------------------------------------------------------------*/ - AbstractDayGridView.prototype.updateSize = function (isResize, viewHeight, isAuto) { - _super.prototype.updateSize.call(this, isResize, viewHeight, isAuto); // will call updateBaseSize. important that executes first - this.dayGrid.updateSize(isResize); - }; - // Refreshes the horizontal dimensions of the view - AbstractDayGridView.prototype.updateBaseSize = function (isResize, viewHeight, isAuto) { - var dayGrid = this.dayGrid; - var eventLimit = this.context.options.eventLimit; - var headRowEl = this.header ? this.header.el : null; // HACK - var scrollerHeight; - var scrollbarWidths; - // hack to give the view some height prior to dayGrid's columns being rendered - // TODO: separate setting height from scroller VS dayGrid. - if (!dayGrid.rowEls) { - if (!isAuto) { - scrollerHeight = this.computeScrollerHeight(viewHeight); - this.scroller.setHeight(scrollerHeight); - } - return; - } - if (this.colWeekNumbersVisible) { - // Make sure all week number cells running down the side have the same width. - this.weekNumberWidth = core.matchCellWidths(core.findElements(this.el, '.fc-week-number')); - } - // reset all heights to be natural - this.scroller.clear(); - if (headRowEl) { - core.uncompensateScroll(headRowEl); - } - dayGrid.removeSegPopover(); // kill the "more" popover if displayed - // is the event limit a constant level number? - if (eventLimit && typeof eventLimit === 'number') { - dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after - } - // distribute the height to the rows - // (viewHeight is a "recommended" value if isAuto) - scrollerHeight = this.computeScrollerHeight(viewHeight); - this.setGridHeight(scrollerHeight, isAuto); - // is the event limit dynamically calculated? - if (eventLimit && typeof eventLimit !== 'number') { - dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set - } - if (!isAuto) { // should we force dimensions of the scroll container? - this.scroller.setHeight(scrollerHeight); - scrollbarWidths = this.scroller.getScrollbarWidths(); - if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars? - if (headRowEl) { - core.compensateScroll(headRowEl, scrollbarWidths); - } - // doing the scrollbar compensation might have created text overflow which created more height. redo - scrollerHeight = this.computeScrollerHeight(viewHeight); - this.scroller.setHeight(scrollerHeight); - } - // guarantees the same scrollbar widths - this.scroller.lockOverflow(scrollbarWidths); - } - }; - // given a desired total height of the view, returns what the height of the scroller should be - AbstractDayGridView.prototype.computeScrollerHeight = function (viewHeight) { - return viewHeight - - core.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller - }; - // Sets the height of just the DayGrid component in this view - AbstractDayGridView.prototype.setGridHeight = function (height, isAuto) { - if (this.context.options.monthMode) { - // if auto, make the height of each row the height that it would be if there were 6 weeks - if (isAuto) { - height *= this.dayGrid.rowCnt / 6; - } - core.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows - } - else { - if (isAuto) { - core.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding - } - else { - core.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows - } - } - }; - /* Scroll - ------------------------------------------------------------------------------------------------------------------*/ - AbstractDayGridView.prototype.computeDateScroll = function (duration) { - return { top: 0 }; - }; - AbstractDayGridView.prototype.queryDateScroll = function () { - return { top: this.scroller.getScrollTop() }; - }; - AbstractDayGridView.prototype.applyDateScroll = function (scroll) { - if (scroll.top !== undefined) { - this.scroller.setScrollTop(scroll.top); - } - }; - return AbstractDayGridView; - }(core.View)); - AbstractDayGridView.prototype.dateProfileGeneratorClass = DayGridDateProfileGenerator; - - var SimpleDayGrid = /** @class */ (function (_super) { - __extends(SimpleDayGrid, _super); - function SimpleDayGrid(dayGrid) { - var _this = _super.call(this, dayGrid.el) || this; - _this.slicer = new DayGridSlicer(); - _this.dayGrid = dayGrid; - return _this; - } - SimpleDayGrid.prototype.firstContext = function (context) { - context.calendar.registerInteractiveComponent(this, { el: this.dayGrid.el }); - }; - SimpleDayGrid.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.context.calendar.unregisterInteractiveComponent(this); - }; - SimpleDayGrid.prototype.render = function (props, context) { - var dayGrid = this.dayGrid; - var dateProfile = props.dateProfile, dayTable = props.dayTable; - dayGrid.receiveContext(context); // hack because context is used in sliceProps - dayGrid.receiveProps(__assign({}, this.slicer.sliceProps(props, dateProfile, props.nextDayThreshold, context.calendar, dayGrid, dayTable), { dateProfile: dateProfile, cells: dayTable.cells, isRigid: props.isRigid }), context); - }; - SimpleDayGrid.prototype.buildPositionCaches = function () { - this.dayGrid.buildPositionCaches(); - }; - SimpleDayGrid.prototype.queryHit = function (positionLeft, positionTop) { - var rawHit = this.dayGrid.positionToHit(positionLeft, positionTop); - if (rawHit) { - return { - component: this.dayGrid, - 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 SimpleDayGrid; - }(core.DateComponent)); - var DayGridSlicer = /** @class */ (function (_super) { - __extends(DayGridSlicer, _super); - function DayGridSlicer() { - return _super !== null && _super.apply(this, arguments) || this; - } - DayGridSlicer.prototype.sliceRange = function (dateRange, dayTable) { - return dayTable.sliceRange(dateRange); - }; - return DayGridSlicer; - }(core.Slicer)); - - var DayGridView = /** @class */ (function (_super) { - __extends(DayGridView, _super); - function DayGridView() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.buildDayTable = core.memoize(buildDayTable); - return _this; - } - DayGridView.prototype.render = function (props, context) { - _super.prototype.render.call(this, props, context); // will call _renderSkeleton/_unrenderSkeleton - var dateProfile = this.props.dateProfile; - var dayTable = this.dayTable = - this.buildDayTable(dateProfile, props.dateProfileGenerator); - if (this.header) { - this.header.receiveProps({ - dateProfile: dateProfile, - dates: dayTable.headerDates, - datesRepDistinctDays: dayTable.rowCnt === 1, - renderIntroHtml: this.renderHeadIntroHtml - }, context); - } - this.simpleDayGrid.receiveProps({ - dateProfile: dateProfile, - dayTable: dayTable, - businessHours: props.businessHours, - dateSelection: props.dateSelection, - eventStore: props.eventStore, - eventUiBases: props.eventUiBases, - eventSelection: props.eventSelection, - eventDrag: props.eventDrag, - eventResize: props.eventResize, - isRigid: this.hasRigidRows(), - nextDayThreshold: this.context.nextDayThreshold - }, context); - }; - DayGridView.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.simpleDayGrid = new SimpleDayGrid(this.dayGrid); - }; - DayGridView.prototype._unrenderSkeleton = function () { - _super.prototype._unrenderSkeleton.call(this); - if (this.header) { - this.header.destroy(); - } - this.simpleDayGrid.destroy(); - }; - return DayGridView; - }(AbstractDayGridView)); - function buildDayTable(dateProfile, dateProfileGenerator) { - var daySeries = new core.DaySeries(dateProfile.renderRange, dateProfileGenerator); - return new core.DayTable(daySeries, /year|month|week/.test(dateProfile.currentRangeUnit)); - } - - var main = core.createPlugin({ - defaultView: 'dayGridMonth', - views: { - dayGrid: DayGridView, - dayGridDay: { - type: 'dayGrid', - duration: { days: 1 } - }, - dayGridWeek: { - type: 'dayGrid', - duration: { weeks: 1 } - }, - dayGridMonth: { - type: 'dayGrid', - duration: { months: 1 }, - monthMode: true, - fixedWeekCount: true - } - } - }); - - exports.AbstractDayGridView = AbstractDayGridView; - exports.DayBgRow = DayBgRow; - exports.DayGrid = DayGrid; - exports.DayGridSlicer = DayGridSlicer; - exports.DayGridView = DayGridView; - exports.SimpleDayGrid = SimpleDayGrid; - exports.buildBasicDayTable = buildDayTable; - exports.default = main; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/library/fullcalendar/packages/daygrid/main.min.css b/library/fullcalendar/packages/daygrid/main.min.css deleted file mode 100644 index 55a572412..000000000 --- a/library/fullcalendar/packages/daygrid/main.min.css +++ /dev/null @@ -1 +0,0 @@ -.fc-dayGridDay-view .fc-content-skeleton,.fc-dayGridWeek-view .fc-content-skeleton{padding-bottom:1em}.fc-dayGrid-view .fc-body .fc-row{min-height:4em}.fc-row.fc-rigid{overflow:hidden}.fc-row.fc-rigid .fc-content-skeleton{position:absolute;top:0;left:0;right:0}.fc-day-top.fc-other-month{opacity:.3}.fc-dayGrid-view .fc-day-number,.fc-dayGrid-view .fc-week-number{padding:2px}.fc-dayGrid-view th.fc-day-number,.fc-dayGrid-view th.fc-week-number{padding:0 2px}.fc-ltr .fc-dayGrid-view .fc-day-top .fc-day-number{float:right}.fc-rtl .fc-dayGrid-view .fc-day-top .fc-day-number{float:left}.fc-ltr .fc-dayGrid-view .fc-day-top .fc-week-number{float:left;border-radius:0 0 3px}.fc-rtl .fc-dayGrid-view .fc-day-top .fc-week-number{float:right;border-radius:0 0 0 3px}.fc-dayGrid-view .fc-day-top .fc-week-number{min-width:1.5em;text-align:center;background-color:#f2f2f2;color:grey}.fc-dayGrid-view td.fc-week-number{text-align:center}.fc-dayGrid-view td.fc-week-number>*{display:inline-block;min-width:1.25em}
\ No newline at end of file diff --git a/library/fullcalendar/packages/daygrid/main.min.js b/library/fullcalendar/packages/daygrid/main.min.js deleted file mode 100644 index 21715dfda..000000000 --- a/library/fullcalendar/packages/daygrid/main.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! -FullCalendar Day 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")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],t):t((e=e||self).FullCalendarDayGrid={},e.FullCalendar)}(this,(function(e,t){"use strict";var r=function(e,t){return(r=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 n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.buildRenderRange=function(r,n,i){var o,s=this.dateEnv,l=e.prototype.buildRenderRange.call(this,r,n,i),a=l.start,d=l.end;if(/^(year|month)$/.test(n)&&(a=s.startOfWeek(a),(o=s.startOfWeek(d)).valueOf()!==d.valueOf()&&(d=t.addWeeks(o,1))),this.options.monthMode&&this.options.fixedWeekCount){var c=Math.ceil(t.diffWeeks(a,d));d=t.addWeeks(d,6-c)}return{start:a,end:d}},r}(t.DateProfileGenerator),s=function(){function e(e){var t=this;this.isHidden=!0,this.margin=10,this.documentMousedown=function(e){t.el&&!t.el.contains(e.target)&&t.hide()},this.options=e}return e.prototype.show=function(){this.isHidden&&(this.el||this.render(),this.el.style.display="",this.position(),this.isHidden=!1,this.trigger("show"))},e.prototype.hide=function(){this.isHidden||(this.el.style.display="none",this.isHidden=!0,this.trigger("hide"))},e.prototype.render=function(){var e=this,r=this.options,n=this.el=t.createElement("div",{className:"fc-popover "+(r.className||""),style:{top:"0",left:"0"}});"function"==typeof r.content&&r.content(n),r.parentEl.appendChild(n),t.listenBySelector(n,"click",".fc-close",(function(t){e.hide()})),r.autoHide&&document.addEventListener("mousedown",this.documentMousedown)},e.prototype.destroy=function(){this.hide(),this.el&&(t.removeElement(this.el),this.el=null),document.removeEventListener("mousedown",this.documentMousedown)},e.prototype.position=function(){var e,r,n=this.options,i=this.el,o=i.getBoundingClientRect(),s=t.computeRect(i.offsetParent),l=t.computeClippingRect(n.parentEl);e=n.top||0,r=void 0!==n.left?n.left:void 0!==n.right?n.right-o.width:0,e=Math.min(e,l.bottom-o.height-this.margin),e=Math.max(e,l.top+this.margin),r=Math.min(r,l.right-o.width-this.margin),r=Math.max(r,l.left+this.margin),t.applyStyle(i,{top:e-s.top,left:r-s.left})},e.prototype.trigger=function(e){this.options[e]&&this.options[e].apply(this,Array.prototype.slice.call(arguments,1))},e}(),l=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.renderSegHtml=function(e,r){var n,i,o=this.context,s=e.eventRange,l=s.def,a=s.ui,d=l.allDay,c=t.computeEventDraggable(o,l,a),h=d&&e.isStart&&t.computeEventStartResizable(o,l,a),p=d&&e.isEnd&&t.computeEventEndResizable(o,l,a),u=this.getSegClasses(e,c,h||p,r),f=t.cssToStr(this.getSkinCss(a)),m="";return u.unshift("fc-day-grid-event","fc-h-event"),e.isStart&&(n=this.getTimeText(s))&&(m='<span class="fc-time">'+t.htmlEscape(n)+"</span>"),i='<span class="fc-title">'+(t.htmlEscape(l.title||"")||" ")+"</span>",'<a class="'+u.join(" ")+'"'+(l.url?' href="'+t.htmlEscape(l.url)+'"':"")+(f?' style="'+f+'"':"")+'><div class="fc-content">'+("rtl"===o.options.dir?i+" "+m:m+" "+i)+"</div>"+(h?'<div class="fc-resizer fc-start-resizer"></div>':"")+(p?'<div class="fc-resizer fc-end-resizer"></div>':"")+"</a>"},r.prototype.computeEventTimeFormat=function(){return{hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"}},r.prototype.computeDisplayEventEnd=function(){return!1},r}(t.FgEventRenderer),a=function(e){function r(t){var r=e.call(this)||this;return r.dayGrid=t,r}return n(r,e),r.prototype.attachSegs=function(e,t){var r=this.rowStructs=this.renderSegRows(e);this.dayGrid.rowEls.forEach((function(e,t){e.querySelector(".fc-content-skeleton > table").appendChild(r[t].tbodyEl)})),t||this.dayGrid.removeSegPopover()},r.prototype.detachSegs=function(){for(var e,r=this.rowStructs||[];e=r.pop();)t.removeElement(e.tbodyEl);this.rowStructs=null},r.prototype.renderSegRows=function(e){var t,r,n=[];for(t=this.groupSegRows(e),r=0;r<t.length;r++)n.push(this.renderSegRow(r,t[r]));return n},r.prototype.renderSegRow=function(e,r){var n,i,o,s,l,a,d,c=this.context.isRtl,h=this.dayGrid,p=h.colCnt,u=this.buildSegLevels(r),f=Math.max(1,u.length),m=document.createElement("tbody"),g=[],y=[],v=[];function b(e){for(;o<e;)(d=(v[n-1]||[])[o])?d.rowSpan=(d.rowSpan||1)+1:(d=document.createElement("td"),s.appendChild(d)),y[n][o]=d,v[n][o]=d,o++}for(n=0;n<f;n++){if(i=u[n],o=0,s=document.createElement("tr"),g.push([]),y.push([]),v.push([]),i)for(l=0;l<i.length;l++){a=i[l];var S=c?p-1-a.lastCol:a.firstCol,w=c?p-1-a.firstCol:a.lastCol;for(b(S),d=t.createElement("td",{className:"fc-event-container"},a.el),S!==w?d.colSpan=w-S+1:v[n][o]=d;o<=w;)y[n][o]=d,g[n][o]=a,o++;s.appendChild(d)}b(p);var C=h.renderProps.renderIntroHtml();C&&(c?t.appendToElement(s,C):t.prependToElement(s,C)),m.appendChild(s)}return{row:e,tbodyEl:m,cellMatrix:y,segMatrix:g,segLevels:u,segs:r}},r.prototype.buildSegLevels=function(e){var t,r,n,i=this.context.isRtl,o=this.dayGrid.colCnt,s=[];for(e=this.sortEventSegs(e),t=0;t<e.length;t++){for(r=e[t],n=0;n<s.length&&d(r,s[n]);n++);r.level=n,r.leftCol=i?o-1-r.lastCol:r.firstCol,r.rightCol=i?o-1-r.firstCol:r.lastCol,(s[n]||(s[n]=[])).push(r)}for(n=0;n<s.length;n++)s[n].sort(c);return s},r.prototype.groupSegRows=function(e){var t,r=[];for(t=0;t<this.dayGrid.rowCnt;t++)r.push([]);for(t=0;t<e.length;t++)r[e[t].row].push(e[t]);return r},r.prototype.computeDisplayEventEnd=function(){return 1===this.dayGrid.colCnt},r}(l);function d(e,t){var r,n;for(r=0;r<t.length;r++)if((n=t[r]).firstCol<=e.lastCol&&n.lastCol>=e.firstCol)return!0;return!1}function c(e,t){return e.leftCol-t.leftCol}var h=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.attachSegs=function(e,r){var n=r.sourceSeg,i=this.rowStructs=this.renderSegRows(e);this.dayGrid.rowEls.forEach((function(e,r){var o,s,l=t.htmlToElement('<div class="fc-mirror-skeleton"><table></table></div>');n&&n.row===r?o=n.el:(o=e.querySelector(".fc-content-skeleton tbody"))||(o=e.querySelector(".fc-content-skeleton table")),s=o.getBoundingClientRect().top-e.getBoundingClientRect().top,l.style.top=s+"px",l.querySelector("table").appendChild(i[r].tbodyEl),e.appendChild(l)}))},r}(a),p=function(e){function r(t){var r=e.call(this)||this;return r.fillSegTag="td",r.dayGrid=t,r}return n(r,e),r.prototype.renderSegs=function(t,r,n){"bgEvent"===t&&(n=n.filter((function(e){return e.eventRange.def.allDay}))),e.prototype.renderSegs.call(this,t,r,n)},r.prototype.attachSegs=function(e,t){var r,n,i,o=[];for(r=0;r<t.length;r++)n=t[r],i=this.renderFillRow(e,n),this.dayGrid.rowEls[n.row].appendChild(i),o.push(i);return o},r.prototype.renderFillRow=function(e,r){var n,i,o,s=this.dayGrid,l=this.context.isRtl,a=s.colCnt,d=l?a-1-r.lastCol:r.firstCol,c=(l?a-1-r.firstCol:r.lastCol)+1;n="businessHours"===e?"bgevent":e.toLowerCase(),o=(i=t.htmlToElement('<div class="fc-'+n+'-skeleton"><table><tr></tr></table></div>')).getElementsByTagName("tr")[0],d>0&&t.appendToElement(o,new Array(d+1).join('<td style="pointer-events:none"></td>')),r.el.colSpan=c-d,o.appendChild(r.el),c<a&&t.appendToElement(o,new Array(a-c+1).join('<td style="pointer-events:none"></td>'));var h=s.renderProps.renderIntroHtml();return h&&(l?t.appendToElement(o,h):t.prependToElement(o,h)),i},r}(t.FillRenderer),u=function(e){function r(r){var n=e.call(this,r)||this,i=n.eventRenderer=new f(n),o=n.renderFrame=t.memoizeRendering(n._renderFrame);return n.renderFgEvents=t.memoizeRendering(i.renderSegs.bind(i),i.unrender.bind(i),[o]),n.renderEventSelection=t.memoizeRendering(i.selectByInstanceId.bind(i),i.unselectByInstanceId.bind(i),[n.renderFgEvents]),n.renderEventDrag=t.memoizeRendering(i.hideByHash.bind(i),i.showByHash.bind(i),[o]),n.renderEventResize=t.memoizeRendering(i.hideByHash.bind(i),i.showByHash.bind(i),[o]),n}return n(r,e),r.prototype.firstContext=function(e){e.calendar.registerInteractiveComponent(this,{el:this.el,useEventCenter:!1})},r.prototype.render=function(e,t){this.renderFrame(e.date),this.renderFgEvents(t,e.fgSegs),this.renderEventSelection(e.eventSelection),this.renderEventDrag(e.eventDragInstances),this.renderEventResize(e.eventResizeInstances)},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderFrame.unrender(),this.context.calendar.unregisterInteractiveComponent(this)},r.prototype._renderFrame=function(e){var r=this.context,n=r.theme,i=r.dateEnv,o=r.options,s=i.format(e,t.createFormatter(o.dayPopoverFormat));this.el.innerHTML='<div class="fc-header '+n.getClass("popoverHeader")+'"><span class="fc-title">'+t.htmlEscape(s)+'</span><span class="fc-close '+n.getIconClass("close")+'"></span></div><div class="fc-body '+n.getClass("popoverContent")+'"><div class="fc-event-container"></div></div>',this.segContainerEl=this.el.querySelector(".fc-event-container")},r.prototype.queryHit=function(e,r,n,i){var o=this.props.date;if(e<n&&r<i)return{component:this,dateSpan:{allDay:!0,range:{start:o,end:t.addDays(o,1)}},dayEl:this.el,rect:{left:0,top:0,right:n,bottom:i},layer:1}},r}(t.DateComponent),f=function(e){function r(t){var r=e.call(this)||this;return r.dayTile=t,r}return n(r,e),r.prototype.attachSegs=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];this.dayTile.segContainerEl.appendChild(n.el)}},r.prototype.detachSegs=function(e){for(var r=0,n=e;r<n.length;r++){var i=n[r];t.removeElement(i.el)}},r}(l),m=function(){function e(e){this.context=e}return e.prototype.renderHtml=function(e){var t=[];e.renderIntroHtml&&t.push(e.renderIntroHtml());for(var r=0,n=e.cells;r<n.length;r++){var i=n[r];t.push(g(i.date,e.dateProfile,this.context,i.htmlAttrs))}return e.cells.length||t.push('<td class="fc-day '+this.context.theme.getClass("widgetContent")+'"></td>'),"rtl"===this.context.options.dir&&t.reverse(),"<tr>"+t.join("")+"</tr>"},e}();function g(e,r,n,i){var o=n.dateEnv,s=n.theme,l=t.rangeContainsMarker(r.activeRange,e),a=t.getDayClasses(e,r,n);return a.unshift("fc-day",s.getClass("widgetContent")),'<td class="'+a.join(" ")+'"'+(l?' data-date="'+o.formatIso(e,{omitTime:!0})+'"':"")+(i?" "+i:"")+"></td>"}var y=t.createFormatter({day:"numeric"}),v=t.createFormatter({week:"numeric"}),b=function(e){function r(r,n){var i=e.call(this,r)||this;i.bottomCoordPadding=0,i.isCellSizesDirty=!1,i.renderProps=n;var o=i.eventRenderer=new a(i),s=i.fillRenderer=new p(i);i.mirrorRenderer=new h(i);var l=i.renderCells=t.memoizeRendering(i._renderCells,i._unrenderCells);return i.renderBusinessHours=t.memoizeRendering(s.renderSegs.bind(s,"businessHours"),s.unrender.bind(s,"businessHours"),[l]),i.renderDateSelection=t.memoizeRendering(s.renderSegs.bind(s,"highlight"),s.unrender.bind(s,"highlight"),[l]),i.renderBgEvents=t.memoizeRendering(s.renderSegs.bind(s,"bgEvent"),s.unrender.bind(s,"bgEvent"),[l]),i.renderFgEvents=t.memoizeRendering(o.renderSegs.bind(o),o.unrender.bind(o),[l]),i.renderEventSelection=t.memoizeRendering(o.selectByInstanceId.bind(o),o.unselectByInstanceId.bind(o),[i.renderFgEvents]),i.renderEventDrag=t.memoizeRendering(i._renderEventDrag,i._unrenderEventDrag,[l]),i.renderEventResize=t.memoizeRendering(i._renderEventResize,i._unrenderEventResize,[l]),i}return n(r,e),r.prototype.render=function(e,t){var r=e.cells;this.rowCnt=r.length,this.colCnt=r[0].length,this.renderCells(r,e.isRigid),this.renderBusinessHours(t,e.businessHourSegs),this.renderDateSelection(t,e.dateSelectionSegs),this.renderBgEvents(t,e.bgEventSegs),this.renderFgEvents(t,e.fgEventSegs),this.renderEventSelection(e.eventSelection),this.renderEventDrag(e.eventDrag),this.renderEventResize(e.eventResize),this.segPopoverTile&&this.updateSegPopoverTile()},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderCells.unrender()},r.prototype.getCellRange=function(e,r){var n=this.props.cells[e][r].date;return{start:n,end:t.addDays(n,1)}},r.prototype.updateSegPopoverTile=function(e,t){var r=this.props;this.segPopoverTile.receiveProps({date:e||this.segPopoverTile.props.date,fgSegs:t||this.segPopoverTile.props.fgSegs,eventSelection:r.eventSelection,eventDragInstances:r.eventDrag?r.eventDrag.affectedInstances:null,eventResizeInstances:r.eventResize?r.eventResize.affectedInstances:null},this.context)},r.prototype._renderCells=function(e,r){var n,i,o=this.context,s=o.calendar,l=o.view,a=o.isRtl,d=o.dateEnv,c=this.rowCnt,h=this.colCnt,p="";for(n=0;n<c;n++)p+=this.renderDayRowHtml(n,r);for(this.el.innerHTML=p,this.rowEls=t.findElements(this.el,".fc-row"),this.cellEls=t.findElements(this.el,".fc-day, .fc-disabled-day"),a&&this.cellEls.reverse(),this.rowPositions=new t.PositionCache(this.el,this.rowEls,!1,!0),this.colPositions=new t.PositionCache(this.el,this.cellEls.slice(0,h),!0,!1),n=0;n<c;n++)for(i=0;i<h;i++)s.publiclyTrigger("dayRender",[{date:d.toDate(e[n][i].date),el:this.getCellEl(n,i),view:l}]);this.isCellSizesDirty=!0},r.prototype._unrenderCells=function(){this.removeSegPopover()},r.prototype.renderDayRowHtml=function(e,t){var r=this.context.theme,n=["fc-row","fc-week",r.getClass("dayRow")];t&&n.push("fc-rigid");var i=new m(this.context);return'<div class="'+n.join(" ")+'"><div class="fc-bg"><table class="'+r.getClass("tableGrid")+'">'+i.renderHtml({cells:this.props.cells[e],dateProfile:this.props.dateProfile,renderIntroHtml:this.renderProps.renderBgIntroHtml})+'</table></div><div class="fc-content-skeleton"><table>'+(this.getIsNumbersVisible()?"<thead>"+this.renderNumberTrHtml(e)+"</thead>":"")+"</table></div></div>"},r.prototype.getIsNumbersVisible=function(){return this.getIsDayNumbersVisible()||this.renderProps.cellWeekNumbersVisible||this.renderProps.colWeekNumbersVisible},r.prototype.getIsDayNumbersVisible=function(){return this.rowCnt>1},r.prototype.renderNumberTrHtml=function(e){var t=this.context.isRtl,r=this.renderProps.renderNumberIntroHtml(e,this);return"<tr>"+(t?"":r)+this.renderNumberCellsHtml(e)+(t?r:"")+"</tr>"},r.prototype.renderNumberCellsHtml=function(e){var t,r,n=[];for(t=0;t<this.colCnt;t++)r=this.props.cells[e][t].date,n.push(this.renderNumberCellHtml(r));return this.context.isRtl&&n.reverse(),n.join("")},r.prototype.renderNumberCellHtml=function(e){var r,n,i=this.context,o=i.dateEnv,s=i.options,l="",a=t.rangeContainsMarker(this.props.dateProfile.activeRange,e),d=this.getIsDayNumbersVisible()&&a;return d||this.renderProps.cellWeekNumbersVisible?((r=t.getDayClasses(e,this.props.dateProfile,this.context)).unshift("fc-day-top"),this.renderProps.cellWeekNumbersVisible&&(n=o.weekDow),l+='<td class="'+r.join(" ")+'"'+(a?' data-date="'+o.formatIso(e,{omitTime:!0})+'"':"")+">",this.renderProps.cellWeekNumbersVisible&&e.getUTCDay()===n&&(l+=t.buildGotoAnchorHtml(s,o,{date:e,type:"week"},{class:"fc-week-number"},o.format(e,v))),d&&(l+=t.buildGotoAnchorHtml(s,o,e,{class:"fc-day-number"},o.format(e,y))),l+="</td>"):"<td></td>"},r.prototype.updateSize=function(e){var t=this.context.calendar,r=this.fillRenderer,n=this.eventRenderer,i=this.mirrorRenderer;(e||this.isCellSizesDirty||t.isEventsUpdated)&&(this.buildPositionCaches(),this.isCellSizesDirty=!1),r.computeSizes(e),n.computeSizes(e),i.computeSizes(e),r.assignSizes(e),n.assignSizes(e),i.assignSizes(e)},r.prototype.buildPositionCaches=function(){this.buildColPositions(),this.buildRowPositions()},r.prototype.buildColPositions=function(){this.colPositions.build()},r.prototype.buildRowPositions=function(){this.rowPositions.build(),this.rowPositions.bottoms[this.rowCnt-1]+=this.bottomCoordPadding},r.prototype.positionToHit=function(e,t){var r=this.colPositions,n=this.rowPositions,i=r.leftToIndex(e),o=n.topToIndex(t);if(null!=o&&null!=i)return{row:o,col:i,dateSpan:{range:this.getCellRange(o,i),allDay:!0},dayEl:this.getCellEl(o,i),relativeRect:{left:r.lefts[i],right:r.rights[i],top:n.tops[o],bottom:n.bottoms[o]}}},r.prototype.getCellEl=function(e,t){return this.cellEls[e*this.colCnt+t]},r.prototype._renderEventDrag=function(e){e&&(this.eventRenderer.hideByHash(e.affectedInstances),this.fillRenderer.renderSegs("highlight",this.context,e.segs))},r.prototype._unrenderEventDrag=function(e){e&&(this.eventRenderer.showByHash(e.affectedInstances),this.fillRenderer.unrender("highlight",this.context))},r.prototype._renderEventResize=function(e){e&&(this.eventRenderer.hideByHash(e.affectedInstances),this.fillRenderer.renderSegs("highlight",this.context,e.segs),this.mirrorRenderer.renderSegs(this.context,e.segs,{isResizing:!0,sourceSeg:e.sourceSeg}))},r.prototype._unrenderEventResize=function(e){e&&(this.eventRenderer.showByHash(e.affectedInstances),this.fillRenderer.unrender("highlight",this.context),this.mirrorRenderer.unrender(this.context,e.segs,{isResizing:!0,sourceSeg:e.sourceSeg}))},r.prototype.removeSegPopover=function(){this.segPopover&&this.segPopover.hide()},r.prototype.limitRows=function(e){var t,r,n=this.eventRenderer.rowStructs||[];for(t=0;t<n.length;t++)this.unlimitRow(t),!1!==(r=!!e&&("number"==typeof e?e:this.computeRowLevelLimit(t)))&&this.limitRow(t,r)},r.prototype.computeRowLevelLimit=function(e){var r,n,i=this.rowEls[e].getBoundingClientRect().bottom,o=t.findChildren(this.eventRenderer.rowStructs[e].tbodyEl);for(r=0;r<o.length;r++)if((n=o[r]).classList.remove("fc-limited"),n.getBoundingClientRect().bottom>i)return r;return!1},r.prototype.limitRow=function(e,r){var n,i,o,s,l,a,d,c,h,p,u,f,m,g,y,v=this,b=this.colCnt,S=this.context.isRtl,w=this.eventRenderer.rowStructs[e],C=[],E=0,R=function(n){for(;E<n;)(a=v.getCellSegs(e,E,r)).length&&(h=i[r-1][E],y=v.renderMoreLink(e,E,a),g=t.createElement("div",null,y),h.appendChild(g),C.push(g)),E++};if(r&&r<w.segLevels.length){for(n=w.segLevels[r-1],i=w.cellMatrix,(o=t.findChildren(w.tbodyEl).slice(r)).forEach((function(e){e.classList.add("fc-limited")})),s=0;s<n.length;s++){l=n[s];var H=S?b-1-l.lastCol:l.firstCol,k=S?b-1-l.firstCol:l.lastCol;for(R(H),c=[],d=0;E<=k;)a=this.getCellSegs(e,E,r),c.push(a),d+=a.length,E++;if(d){for(p=(h=i[r-1][H]).rowSpan||1,u=[],f=0;f<c.length;f++)m=t.createElement("td",{className:"fc-more-cell",rowSpan:p}),a=c[f],y=this.renderMoreLink(e,H+f,[l].concat(a)),g=t.createElement("div",null,y),m.appendChild(g),u.push(m),C.push(m);h.classList.add("fc-limited"),t.insertAfterElement(h,u),o.push(h)}}R(this.colCnt),w.moreEls=C,w.limitedEls=o}},r.prototype.unlimitRow=function(e){var r=this.eventRenderer.rowStructs[e];r.moreEls&&(r.moreEls.forEach(t.removeElement),r.moreEls=null),r.limitedEls&&(r.limitedEls.forEach((function(e){e.classList.remove("fc-limited")})),r.limitedEls=null)},r.prototype.renderMoreLink=function(e,r,n){var i=this,o=this.context,s=o.calendar,l=o.view,a=o.dateEnv,d=o.options,c=o.isRtl,h=t.createElement("a",{className:"fc-more"});return h.innerText=this.getMoreLinkText(n.length),h.addEventListener("click",(function(t){var o=d.eventLimitClick,h=c?i.colCnt-r-1:r,p=i.props.cells[e][h].date,u=t.currentTarget,f=i.getCellEl(e,r),m=i.getCellSegs(e,r),g=i.resliceDaySegs(m,p),y=i.resliceDaySegs(n,p);"function"==typeof o&&(o=s.publiclyTrigger("eventLimitClick",[{date:a.toDate(p),allDay:!0,dayEl:f,moreEl:u,segs:g,hiddenSegs:y,jsEvent:t,view:l}])),"popover"===o?i.showSegPopover(e,r,u,g):"string"==typeof o&&s.zoomTo(p,o)})),h},r.prototype.showSegPopover=function(e,r,n,i){var o,l,a=this,d=this.context,c=d.calendar,h=d.view,p=d.theme,f=d.isRtl,m=f?this.colCnt-r-1:r,g=n.parentNode;o=1===this.rowCnt?h.el:this.rowEls[e],l={className:"fc-more-popover "+p.getClass("popover"),parentEl:h.el,top:t.computeRect(o).top,autoHide:!0,content:function(t){a.segPopoverTile=new u(t),a.updateSegPopoverTile(a.props.cells[e][m].date,i)},hide:function(){a.segPopoverTile.destroy(),a.segPopoverTile=null,a.segPopover.destroy(),a.segPopover=null}},f?l.right=t.computeRect(g).right+1:l.left=t.computeRect(g).left-1,this.segPopover=new s(l),this.segPopover.show(),c.releaseAfterSizingTriggers()},r.prototype.resliceDaySegs=function(e,r){for(var n=r,o={start:n,end:t.addDays(n,1)},s=[],l=0,a=e;l<a.length;l++){var d=a[l],c=d.eventRange,h=c.range,p=t.intersectRanges(h,o);p&&s.push(i({},d,{eventRange:{def:c.def,ui:i({},c.ui,{durationEditable:!1}),instance:c.instance,range:p},isStart:d.isStart&&p.start.valueOf()===h.start.valueOf(),isEnd:d.isEnd&&p.end.valueOf()===h.end.valueOf()}))}return s},r.prototype.getMoreLinkText=function(e){var t=this.context.options.eventLimitText;return"function"==typeof t?t(e):"+"+e+" "+t},r.prototype.getCellSegs=function(e,t,r){for(var n,i=this.eventRenderer.rowStructs[e].segMatrix,o=r||0,s=[];o<i.length;)(n=i[o][t])&&s.push(n),o++;return s},r}(t.DateComponent),S=t.createFormatter({week:"numeric"}),w=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.processOptions=t.memoize(r._processOptions),r.renderSkeleton=t.memoizeRendering(r._renderSkeleton,r._unrenderSkeleton),r.renderHeadIntroHtml=function(){var e=r.context,n=e.theme,i=e.options;return r.colWeekNumbersVisible?'<th class="fc-week-number '+n.getClass("widgetHeader")+'" '+r.weekNumberStyleAttr()+"><span>"+t.htmlEscape(i.weekLabel)+"</span></th>":""},r.renderDayGridNumberIntroHtml=function(e,n){var i=r.context,o=i.options,s=i.dateEnv,l=n.props.cells[e][0].date;return r.colWeekNumbersVisible?'<td class="fc-week-number" '+r.weekNumberStyleAttr()+">"+t.buildGotoAnchorHtml(o,s,{date:l,type:"week",forceOff:1===n.colCnt},s.format(l,S))+"</td>":""},r.renderDayGridBgIntroHtml=function(){var e=r.context.theme;return r.colWeekNumbersVisible?'<td class="fc-week-number '+e.getClass("widgetContent")+'" '+r.weekNumberStyleAttr()+"></td>":""},r.renderDayGridIntroHtml=function(){return r.colWeekNumbersVisible?'<td class="fc-week-number" '+r.weekNumberStyleAttr()+"></td>":""},r}return n(r,e),r.prototype._processOptions=function(e){e.weekNumbers?e.weekNumbersWithinDays?(this.cellWeekNumbersVisible=!0,this.colWeekNumbersVisible=!1):(this.cellWeekNumbersVisible=!1,this.colWeekNumbersVisible=!0):(this.colWeekNumbersVisible=!1,this.cellWeekNumbersVisible=!1)},r.prototype.render=function(t,r){e.prototype.render.call(this,t,r),this.processOptions(r.options),this.renderSkeleton(r)},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderSkeleton.unrender()},r.prototype._renderSkeleton=function(e){this.el.classList.add("fc-dayGrid-view"),this.el.innerHTML=this.renderSkeletonHtml(),this.scroller=new t.ScrollComponent("hidden","auto");var r=this.scroller.el;this.el.querySelector(".fc-body > tr > td").appendChild(r),r.classList.add("fc-day-grid-container");var n=t.createElement("div",{className:"fc-day-grid"});r.appendChild(n),this.dayGrid=new b(n,{renderNumberIntroHtml:this.renderDayGridNumberIntroHtml,renderBgIntroHtml:this.renderDayGridBgIntroHtml,renderIntroHtml:this.renderDayGridIntroHtml,colWeekNumbersVisible:this.colWeekNumbersVisible,cellWeekNumbersVisible:this.cellWeekNumbersVisible})},r.prototype._unrenderSkeleton=function(){this.el.classList.remove("fc-dayGrid-view"),this.dayGrid.destroy(),this.scroller.destroy()},r.prototype.renderSkeletonHtml=function(){var e=this.context,t=e.theme,r=e.options;return'<table class="'+t.getClass("tableGrid")+'">'+(r.columnHeader?'<thead class="fc-head"><tr><td class="fc-head-container '+t.getClass("widgetHeader")+'"> </td></tr></thead>':"")+'<tbody class="fc-body"><tr><td class="'+t.getClass("widgetContent")+'"></td></tr></tbody></table>'},r.prototype.weekNumberStyleAttr=function(){return null!=this.weekNumberWidth?'style="width:'+this.weekNumberWidth+'px"':""},r.prototype.hasRigidRows=function(){var e=this.context.options.eventLimit;return e&&"number"!=typeof e},r.prototype.updateSize=function(t,r,n){e.prototype.updateSize.call(this,t,r,n),this.dayGrid.updateSize(t)},r.prototype.updateBaseSize=function(e,r,n){var i,o,s=this.dayGrid,l=this.context.options.eventLimit,a=this.header?this.header.el:null;s.rowEls?(this.colWeekNumbersVisible&&(this.weekNumberWidth=t.matchCellWidths(t.findElements(this.el,".fc-week-number"))),this.scroller.clear(),a&&t.uncompensateScroll(a),s.removeSegPopover(),l&&"number"==typeof l&&s.limitRows(l),i=this.computeScrollerHeight(r),this.setGridHeight(i,n),l&&"number"!=typeof l&&s.limitRows(l),n||(this.scroller.setHeight(i),((o=this.scroller.getScrollbarWidths()).left||o.right)&&(a&&t.compensateScroll(a,o),i=this.computeScrollerHeight(r),this.scroller.setHeight(i)),this.scroller.lockOverflow(o))):n||(i=this.computeScrollerHeight(r),this.scroller.setHeight(i))},r.prototype.computeScrollerHeight=function(e){return e-t.subtractInnerElHeight(this.el,this.scroller.el)},r.prototype.setGridHeight=function(e,r){this.context.options.monthMode?(r&&(e*=this.dayGrid.rowCnt/6),t.distributeHeight(this.dayGrid.rowEls,e,!r)):r?t.undistributeHeight(this.dayGrid.rowEls):t.distributeHeight(this.dayGrid.rowEls,e,!0)},r.prototype.computeDateScroll=function(e){return{top:0}},r.prototype.queryDateScroll=function(){return{top:this.scroller.getScrollTop()}},r.prototype.applyDateScroll=function(e){void 0!==e.top&&this.scroller.setScrollTop(e.top)},r}(t.View);w.prototype.dateProfileGeneratorClass=o;var C=function(e){function t(t){var r=e.call(this,t.el)||this;return r.slicer=new E,r.dayGrid=t,r}return n(t,e),t.prototype.firstContext=function(e){e.calendar.registerInteractiveComponent(this,{el:this.dayGrid.el})},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.context.calendar.unregisterInteractiveComponent(this)},t.prototype.render=function(e,t){var r=this.dayGrid,n=e.dateProfile,o=e.dayTable;r.receiveContext(t),r.receiveProps(i({},this.slicer.sliceProps(e,n,e.nextDayThreshold,t.calendar,r,o),{dateProfile:n,cells:o.cells,isRigid:e.isRigid}),t)},t.prototype.buildPositionCaches=function(){this.dayGrid.buildPositionCaches()},t.prototype.queryHit=function(e,t){var r=this.dayGrid.positionToHit(e,t);if(r)return{component:this.dayGrid,dateSpan:r.dateSpan,dayEl:r.dayEl,rect:{left:r.relativeRect.left,right:r.relativeRect.right,top:r.relativeRect.top,bottom:r.relativeRect.bottom},layer:0}},t}(t.DateComponent),E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.sliceRange=function(e,t){return t.sliceRange(e)},t}(t.Slicer),R=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.buildDayTable=t.memoize(H),r}return n(r,e),r.prototype.render=function(t,r){e.prototype.render.call(this,t,r);var n=this.props.dateProfile,i=this.dayTable=this.buildDayTable(n,t.dateProfileGenerator);this.header&&this.header.receiveProps({dateProfile:n,dates:i.headerDates,datesRepDistinctDays:1===i.rowCnt,renderIntroHtml:this.renderHeadIntroHtml},r),this.simpleDayGrid.receiveProps({dateProfile:n,dayTable:i,businessHours:t.businessHours,dateSelection:t.dateSelection,eventStore:t.eventStore,eventUiBases:t.eventUiBases,eventSelection:t.eventSelection,eventDrag:t.eventDrag,eventResize:t.eventResize,isRigid:this.hasRigidRows(),nextDayThreshold:this.context.nextDayThreshold},r)},r.prototype._renderSkeleton=function(r){e.prototype._renderSkeleton.call(this,r),r.options.columnHeader&&(this.header=new t.DayHeader(this.el.querySelector(".fc-head-container"))),this.simpleDayGrid=new C(this.dayGrid)},r.prototype._unrenderSkeleton=function(){e.prototype._unrenderSkeleton.call(this),this.header&&this.header.destroy(),this.simpleDayGrid.destroy()},r}(w);function H(e,r){var n=new t.DaySeries(e.renderRange,r);return new t.DayTable(n,/year|month|week/.test(e.currentRangeUnit))}var k=t.createPlugin({defaultView:"dayGridMonth",views:{dayGrid:R,dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},monthMode:!0,fixedWeekCount:!0}}});e.AbstractDayGridView=w,e.DayBgRow=m,e.DayGrid=b,e.DayGridSlicer=E,e.DayGridView=R,e.SimpleDayGrid=C,e.buildBasicDayTable=H,e.default=k,Object.defineProperty(e,"__esModule",{value:!0})}));
\ No newline at end of file diff --git a/library/fullcalendar/packages/daygrid/package.json b/library/fullcalendar/packages/daygrid/package.json deleted file mode 100644 index 0db9794e5..000000000 --- a/library/fullcalendar/packages/daygrid/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@fullcalendar/daygrid", - "version": "4.4.2", - "title": "FullCalendar Day Grid Plugin", - "description": "Display events on Month view or DayGrid view", - "keywords": [ - "calendar", - "event", - "full-sized" - ], - "homepage": "https://fullcalendar.io/", - "docs": "https://fullcalendar.io/docs/month-view", - "bugs": "https://fullcalendar.io/reporting-bugs", - "repository": { - "type": "git", - "url": "https://github.com/fullcalendar/fullcalendar.git", - "homepage": "https://github.com/fullcalendar/fullcalendar" - }, - "license": "MIT", - "author": { - "name": "Adam Shaw", - "email": "arshaw@arshaw.com", - "url": "http://arshaw.com/" - }, - "copyright": "2019 Adam Shaw", - "peerDependencies": { - "@fullcalendar/core": "~4.4.0" - }, - "main": "main.js", - "module": "main.esm.js", - "unpkg": "main.min.js", - "types": "main.d.ts" -} |