1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 64× 64× 64× 64× 64× 1× 28609× 1× 63× 63× 63× 63× 63× 63× 63× 1× 63× 46× 17× 1× 2276× 61× 1× 90× 90× 90× 1× 90× 90× 90× 90× 90× 90× 90× 90× 87× 5× 5× 87× 1× 27× 27× 27× 27× 1× 1× 27× 27× 27× 27× 1148× 1148× 1148× 1148× 218× 218× 218× 15× 1148× 27× 1× 11× 11× 11× 11× 11× 11× 1× 26× 26× 26× 26× 20× 14× 14× 6× 6× 4× 4× 4× 4× 4× 2× 26× 1× 1159× 1159× 1159× 1× 27× 27× 30× 30× 27× 1× 98× 98× 98× 98× 98× 1× 12× 12× 12× 12× 12× 12× 12× 12× 1× 53× 1× 97× 24× 24× 97× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { 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); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); define(["require", "exports", "@syncfusion/ej2-base", "../event-renderer/agenda-base", "./month", "../base/util", "../base/constant", "../base/css-constant"], function (require, exports, ej2_base_1, agenda_base_1, month_1, util, events, cls) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var MonthAgenda = (function (_super) { __extends(MonthAgenda, _super); function MonthAgenda(parent) { var _this = _super.call(this, parent) || this; _this.dayNameFormat = 'narrow'; _this.viewClass = 'e-month-agenda-view'; _this.monthAgendaDate = new Date('' + parent.selectedDate); return _this; } MonthAgenda.prototype.getModuleName = function () { return 'monthAgenda'; }; MonthAgenda.prototype.renderAppointmentContainer = function () { var contentArea = this.getContentAreaElement(); var wrapperContainer = ej2_base_1.createElement('div', { className: cls.WRAPPER_CONTAINER_CLASS }); contentArea.appendChild(wrapperContainer); var appWrap = ej2_base_1.createElement('div', { className: cls.APPOINTMENT_WRAP_CLASS }); wrapperContainer.appendChild(appWrap); this.appendAppContainer(appWrap); this.setEventWrapperHeight(); }; MonthAgenda.prototype.getDayNameFormat = function () { if (this.parent.isAdaptive) { return 'narrow'; } return 'abbreviated'; }; MonthAgenda.prototype.updateSelectedCellClass = function (data) { if (util.resetTime(data.date).getTime() === util.resetTime(this.monthAgendaDate).getTime()) { data.className.push(cls.SELECTED_CELL_CLASS); } }; MonthAgenda.prototype.setEventWrapperHeight = function () { var headerHeight = (this.parent.headerModule ? this.parent.headerModule.getHeaderElement().offsetHeight : 0) + 2; var resourceWrapper = this.parent.element.querySelector('.' + cls.RESOURCE_HEADER_TOOLBAR); if (resourceWrapper) { headerHeight += resourceWrapper.offsetHeight; } var contentArea = this.getContentAreaElement().firstElementChild; var dateHeader = this.element.querySelector('.' + cls.DATE_HEADER_WRAP_CLASS); var availHeight = this.parent.element.offsetHeight - headerHeight - dateHeader.offsetHeight; var contentAreaHeight = (this.parent.activeViewOptions.interval > 1) ? Math.round(availHeight * 0.8) : contentArea.offsetHeight; var appContainerHeight = availHeight - contentAreaHeight; var wrapperContainer = this.element.querySelector('.' + cls.WRAPPER_CONTAINER_CLASS); var eventWrapper = this.element.querySelector('.' + cls.APPOINTMENT_WRAP_CLASS); if (this.parent.height !== 'auto') { if (this.parent.activeViewOptions.interval > 1) { contentArea.style.height = ej2_base_1.formatUnit(contentAreaHeight); ej2_base_1.EventHandler.add(contentArea, 'scroll', this.onContentScroll, this); } wrapperContainer.style.height = eventWrapper.style.height = ej2_base_1.formatUnit(appContainerHeight); } }; MonthAgenda.prototype.onDataReady = function (args) { this.setEventWrapperHeight(); this.clearElements(); var eventCollection = args.processedData; if (this.parent.uiStateValues.isGroupAdaptive) { var resource = this.parent.resourceBase.lastResourceLevel[this.parent.uiStateValues.groupIndex]; eventCollection = this.parent.eventBase.filterEventsByResource(resource, eventCollection); } this.agendaBase = this.getAgendaBase(); this.parent.eventsProcessed = this.agendaBase.processAgendaEvents(eventCollection); var count = 0; for (var _i = 0, _a = this.renderDates; _i < _a.length; _i++) { var date = _a[_i]; var filterData = this.appointmentFiltering(date); var workCell = this.element.querySelectorAll('.' + cls.WORK_CELLS_CLASS)[parseInt(count.toString(), 10)]; if (filterData.length > 0) { Eif (!workCell.querySelector('.' + cls.APPOINTMENT_INDICATOR_CLASS)) { workCell.appendChild(ej2_base_1.createElement('div', { className: cls.APPOINTMENT_INDICATOR_CLASS })); } if (date.getTime() === util.resetTime(new Date(this.monthAgendaDate.getTime())).getTime()) { this.onEventRender(filterData, date); } } count++; } this.parent.notify(events.eventsLoaded, {}); }; MonthAgenda.prototype.onCellClick = function (event) { Eif (this.parent.quickPopup) { this.parent.quickPopup.quickPopupHide(); } var filterData = this.appointmentFiltering(event.startTime); this.onEventRender(filterData, event.startTime); this.parent.notify(events.eventsLoaded, {}); this.monthAgendaDate = new Date('' + event.startTime); }; MonthAgenda.prototype.onEventRender = function (events, date) { this.agendaBase = this.getAgendaBase(); var appWrap = this.element.querySelector('.' + cls.APPOINTMENT_WRAP_CLASS); util.removeChildren(appWrap); if (this.parent.activeViewOptions.group.resources.length === 0 || this.parent.uiStateValues.isGroupAdaptive) { if (events.length > 0) { var appContainer = ej2_base_1.createElement('div', { className: cls.APPOINTMENT_CONTAINER_CLASS }); appWrap.appendChild(this.agendaBase.createAgendaContentElement('data', events, appContainer)); } else { this.appendAppContainer(appWrap); } } else { if (events.length > 0) { var table = this.createTableLayout(); var tBody = table.querySelector('tbody'); this.agendaBase.calculateResourceTableElement(tBody, 1, date); table.appendChild(tBody); appWrap.appendChild(table); } else { this.appendAppContainer(appWrap); } } this.agendaBase.wireEventActions(); }; MonthAgenda.prototype.appointmentFiltering = function (date) { var dateStart = util.resetTime(new Date(date.getTime())); var dateEnd = util.setTime(new Date(dateStart.getTime()), util.MS_PER_DAY); return this.parent.eventBase.filterEvents(dateStart, dateEnd); }; MonthAgenda.prototype.clearElements = function () { var appointmentIndicators = [].slice.call(this.element.querySelectorAll('.' + cls.APPOINTMENT_INDICATOR_CLASS)); for (var _i = 0, appointmentIndicators_1 = appointmentIndicators; _i < appointmentIndicators_1.length; _i++) { var appointmentIndicator = appointmentIndicators_1[_i]; ej2_base_1.remove(appointmentIndicator); } this.appendAppContainer(this.element.querySelector('.' + cls.APPOINTMENT_WRAP_CLASS)); }; MonthAgenda.prototype.appendAppContainer = function (appWrap) { var app = ej2_base_1.createElement('div', { className: cls.APPOINTMENT_CONTAINER_CLASS }); ej2_base_1.addClass([app], cls.AGENDA_NO_EVENT_CLASS); app.innerHTML = this.parent.localeObj.getConstant('noEvents'); util.removeChildren(appWrap); appWrap.appendChild(app); }; MonthAgenda.prototype.getNextPreviousDate = function (type) { var selectedDate = this.parent.selectedDate; var interval = (type === 'next') ? this.parent.activeViewOptions.interval : -this.parent.activeViewOptions.interval; var navigateDate = util.addMonths(this.parent.selectedDate, interval); var month = (type === 'next') ? 2 : 0; var lastDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth() + month, 0).getDate(); var date = (lastDate >= this.monthAgendaDate.getDate()) ? this.monthAgendaDate.getDate() : lastDate; this.monthAgendaDate = new Date(navigateDate.getFullYear(), navigateDate.getMonth(), date); return this.monthAgendaDate; }; MonthAgenda.prototype.getAgendaBase = function () { return this.agendaBase || new agenda_base_1.AgendaBase(this.parent); }; MonthAgenda.prototype.destroy = function () { if (this.agendaBase) { this.agendaBase.destroy(); this.agendaBase = null; } _super.prototype.destroy.call(this); }; return MonthAgenda; }(month_1.Month)); exports.MonthAgenda = MonthAgenda; }); |