import * as moment from 'moment' import * as $ from 'jquery' import { matchCellWidths, uncompensateScroll, compensateScroll, subtractInnerElHeight, htmlEscape, copyOwnProps } from '../util' import Scroller from '../common/Scroller' import View from '../View' import TimeGrid from './TimeGrid' import DayGrid from '../basic/DayGrid' const AGENDA_ALL_DAY_EVENT_LIMIT = 5 let agendaTimeGridMethods let agendaDayGridMethods /* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically. ----------------------------------------------------------------------------------------------------------------------*/ // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on). // Responsible for managing width/height. export default class AgendaView extends View { // initialized after class timeGridClass: any // class used to instantiate the timeGrid. subclasses can override dayGridClass: any // class used to instantiate the dayGrid. subclasses can override timeGrid: any // the main time-grid subcomponent of this view dayGrid: any // the "all-day" subcomponent. if all-day is turned off, this will be null scroller: any axisWidth: any // the width of the time axis running down the side usesMinMaxTime: boolean = true // indicates that minTime/maxTime affects rendering constructor(calendar, viewSpec) { super(calendar, viewSpec) this.timeGrid = this.instantiateTimeGrid() this.addChild(this.timeGrid) if (this.opt('allDaySlot')) { // should we display the "all-day" area? this.dayGrid = this.instantiateDayGrid() // the all-day subcomponent of this view this.addChild(this.dayGrid) } this.scroller = new Scroller({ overflowX: 'hidden', overflowY: 'auto' }) } // Instantiates the TimeGrid object this view needs. Draws from this.timeGridClass instantiateTimeGrid() { let timeGrid = new this.timeGridClass(this) copyOwnProps(agendaTimeGridMethods, timeGrid) return timeGrid } // Instantiates the DayGrid object this view might need. Draws from this.dayGridClass instantiateDayGrid() { let dayGrid = new this.dayGridClass(this) copyOwnProps(agendaDayGridMethods, dayGrid) return dayGrid } /* Rendering ------------------------------------------------------------------------------------------------------------------*/ renderSkeleton() { let timeGridWrapEl let timeGridEl this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml()) this.scroller.render() timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container') timeGridEl = $('
').appendTo(timeGridWrapEl) this.el.find('.fc-body > tr > td').append(timeGridWrapEl) this.timeGrid.headContainerEl = this.el.find('.fc-head-container') this.timeGrid.setElement(timeGridEl) if (this.dayGrid) { this.dayGrid.setElement(this.el.find('.fc-day-grid')) // have the day-grid extend it's coordinate area over the| ' + ' |
| ' +
(this.dayGrid ?
'' +
' ' : '' ) + ' | ' +
'