@syncfusion/ej2-schedule
Version:
Flexible scheduling library with more built-in features and enhanced customization options similar to outlook and google calendar, allowing the users to plan and manage their appointments with efficient data-binding support.
1,396 lines (1,392 loc) • 1.51 MB
JavaScript
import { createElement, remove, isNullOrUndefined, closest, addClass, removeClass, append, extend, formatUnit, Touch, EventHandler, Browser, KeyboardEvents, HijriParser, getValue, getDefaultDateObject, cldrData, prepend, setStyleAttribute, Animation, initializeCSPTemplate, L10n, classList, detach, Property, Event, NotifyPropertyChanges, Component, SanitizeHtmlHelper, ChildProperty, Complex, Internationalization, compile, getElement, Collection, Draggable, print as print$1 } from '@syncfusion/ej2-base';
import { Popup, Dialog, isCollide, Tooltip, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
import { Toolbar, TreeView } from '@syncfusion/ej2-navigations';
import { Calendar, DatePicker, DateTimePicker } from '@syncfusion/ej2-calendars';
import { DataManager, Query, Predicate, Deferred } from '@syncfusion/ej2-data';
import { Button, RadioButton, CheckBox } from '@syncfusion/ej2-buttons';
import { FormValidator, Input, NumericTextBox } from '@syncfusion/ej2-inputs';
import { DropDownList, MultiSelect } from '@syncfusion/ej2-dropdowns';
import { ListBase } from '@syncfusion/ej2-lists';
import { Workbook } from '@syncfusion/ej2-excel-export';
/**
* Constants
*/
/** @private */
var cellClick = 'cellClick';
/** @private */
var cellDoubleClick = 'cellDoubleClick';
/** @private */
var moreEventsClick = 'moreEventsClick';
/** @private */
var select = 'select';
/** @private */
var hover = 'hover';
/** @private */
var actionBegin = 'actionBegin';
/** @private */
var actionComplete = 'actionComplete';
/** @private */
var actionFailure = 'actionFailure';
/** @private */
var navigating = 'navigating';
/** @private */
var renderCell = 'renderCell';
/** @private */
var eventClick = 'eventClick';
/** @private */
var eventDoubleClick = 'eventDoubleClick';
/** @private */
var eventRendered = 'eventRendered';
/** @private */
var dataBinding = 'dataBinding';
/** @private */
var dataBound = 'dataBound';
/** @private */
var popupOpen = 'popupOpen';
/** @private */
var popupClose = 'popupClose';
/** @private */
var dragStart = 'dragStart';
/** @private */
var drag = 'drag';
/** @private */
var dragStop = 'dragStop';
/** @private */
var resizeStart = 'resizeStart';
/** @private */
var resizing = 'resizing';
/** @private */
var resizeStop = 'resizeStop';
/** @private */
var inlineClick = 'inlineClick';
/** @private */
var cellSelect = 'cellSelect';
/** @private */
var virtualScrollStart = 'virtualScrollStart';
/** @private */
var virtualScrollStop = 'virtualScrollStop';
/** @private */
var noEvents = 'noEvents';
/** @private */
var agendaCells = 'agendaCells';
/** @private */
var resourceHeader = 'resourceHeader';
/** @private */
var dateHeader = 'dateHeader';
/** @private */
var beforePaste = 'beforePaste';
/** @private */
var beforePrint = 'beforePrint';
/** @private */
var excelExport = 'excelExport';
/** @private */
var tooltipOpen = 'tooltipOpen';
/**
* Specifies schedule internal events
*/
/** @private */
var initialLoad = 'initial-load';
/** @private */
var initialEnd = 'initial-end';
/** @private */
var print = 'print';
/** @private */
var dataReady = 'data-ready';
/** @private */
var eventsLoaded = 'events-loaded';
/** @private */
var contentReady = 'content-ready';
/** @private */
var scroll = 'scroll';
/** @private */
var virtualScroll = 'virtual-scroll';
/** @private */
var scrollUiUpdate = 'scroll-ui-update';
/** @private */
var uiUpdate = 'ui-update';
/** @private */
var documentClick = 'document-click';
/** @private */
var documentPaste = 'document-paste';
/** @private */
var cellMouseDown = 'cell-mouse-down';
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Schedule common utilities
*/
var WEEK_LENGTH = 7;
var DEFAULT_WEEKS = 6;
var MS_PER_DAY = 86400000;
var MS_PER_MINUTE = 60000;
/**
* Method to get height from element
*
* @param {Element} container Accepts the DOM element
* @param {string} elementClass Accepts the element class
* @param {boolean} isTransformed Accepts the boolean value that indicates the status of the transform style applied to the element
* @returns {number} Returns the height of the element
*/
function getElementHeightFromClass(container, elementClass, isTransformed) {
var height = 0;
var el = createElement('div', { className: elementClass }).cloneNode();
el.style.visibility = 'hidden';
el.style.position = 'absolute';
container.appendChild(el);
height = getElementHeight(el, isTransformed);
remove(el);
return height;
}
/**
* Method to get width from element
*
* @param {Element} container Accepts the DOM element
* @param {string} elementClass Accepts the element class
* @param {boolean} isTransformed Accepts the boolean value that indicates the status of the transform style applied to the element
* @returns {number} Returns the width of the element
*/
function getElementWidthFromClass(container, elementClass, isTransformed) {
var width = 0;
var el = createElement('div', { className: elementClass }).cloneNode();
el.style.visibility = 'hidden';
el.style.position = 'absolute';
container.appendChild(el);
width = getElementWidth(el, isTransformed);
remove(el);
return width;
}
/**
* Method to get translateY value
*
* @param {HTMLElement | Element} element Accepts the DOM element
* @returns {number} Returns the translateY value of given element
*/
function getTranslateY(element) {
var style = getComputedStyle(element);
return window.WebKitCSSMatrix ?
new WebKitCSSMatrix(style.webkitTransform).m42 : 0;
}
/**
* Method to get translateX value
*
* @param {HTMLElement | Element} element Accepts the DOM element
* @returns {number} Returns the translateX value of given element
*/
function getTranslateX(element) {
var style = getComputedStyle(element);
return window.WebKitCSSMatrix ?
new WebKitCSSMatrix(style.webkitTransform).m41 : 0;
}
/**
* Method to get week first date
*
* @param {Date} date Accepts the date object
* @param {number} firstDayOfWeek Accepts the first day of week number
* @returns {Date} Returns the date object
*/
function getWeekFirstDate(date, firstDayOfWeek) {
var date1 = new Date(date.getTime());
firstDayOfWeek = (firstDayOfWeek - date1.getDay() + 7 * (-1)) % 7;
return new Date(date1.setDate(date1.getDate() + (isNaN(firstDayOfWeek) ? 0 : firstDayOfWeek)));
}
/**
* Method to get week last date
*
* @param {Date} date Accepts the date object
* @param {number} firstDayOfWeek Accepts the first day of week number
* @returns {Date} Returns the date object
*/
function getWeekLastDate(date, firstDayOfWeek) {
var weekFirst = getWeekFirstDate(date, firstDayOfWeek);
var weekLast = new Date(weekFirst.getFullYear(), weekFirst.getMonth(), weekFirst.getDate() + 6);
return new Date(weekLast.getTime());
}
/**
* Method to get first date of month
*
* @param {Date} date Accepts the date object
* @returns {Date} Returns the date object
*/
function firstDateOfMonth(date) {
return new Date(date.getFullYear(), date.getMonth(), 1);
}
/**
* Method to get last date of month
*
* @param {Date} date Accepts the date object
* @returns {Date} Returns the date object
*/
function lastDateOfMonth(date) {
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
}
/**
* Method to get week number
*
* @param {Date} date Accepts the date object
* @returns {number} Returns the week number
*/
function getWeekNumber(date) {
var date1 = new Date(date.getFullYear(), 0, 1).valueOf();
var currentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()).valueOf();
var dayOfYear = ((currentDate - date1 + MS_PER_DAY) / MS_PER_DAY);
return Math.ceil(dayOfYear / 7);
}
/**
* Method to get week middle date
*
* @param {Date} weekFirst Accepts the week first date object
* @param {Date} weekLast Accepts the week last date object
* @returns {Date} Returns the date object
*/
function getWeekMiddleDate(weekFirst, weekLast) {
return new Date(weekLast.valueOf() - ((weekLast.valueOf() - weekFirst.valueOf()) / 2));
}
/**
* Method to set time to date object
*
* @param {Date} date Accepts the date object
* @param {number} time Accepts the milliseconds
* @returns {Date} Returns the date object
*/
function setTime(date, time) {
var tzOffsetBefore = date.getTimezoneOffset();
var d = new Date(date.getTime() + time);
var tzOffsetDiff = d.getTimezoneOffset() - tzOffsetBefore;
date.setTime(d.getTime() + tzOffsetDiff * MS_PER_MINUTE);
return date;
}
/**
* Method the reset hours in date object
*
* @param {Date} date Accepts the date object
* @returns {Date} Returns the date object
*/
function resetTime(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
/**
* Method to get milliseconds from date object
*
* @param {Date} date Accepts the date object
* @returns {number} Returns the milliseconds from date object
*/
function getDateInMs(date) {
var localOffset = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0).getTimezoneOffset();
var dateOffset = date.getTimezoneOffset();
var timezoneOffset = dateOffset - localOffset;
return ((date.getTime() - new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0).getTime())
- (timezoneOffset * 60 * 1000));
}
/**
* Method to get date count between two dates
*
* @param {Date} startDate Accepts the date object
* @param {Date} endDate Accepts the date object
* @returns {number} Returns the date count
*/
function getDateCount(startDate, endDate) {
return Math.ceil((endDate.getTime() - startDate.getTime()) / MS_PER_DAY);
}
/**
* Method to add no of days in date object
*
* @param {Date} date Accepts the date object
* @param {number} noOfDays Accepts the number of days count
* @returns {Date} Returns the date object
*/
function addDays(date, noOfDays) {
date = new Date('' + date);
return new Date(date.setDate(date.getDate() + noOfDays));
}
/**
* Method to add no of months in date object
*
* @param {Date} date Accepts the date object
* @param {number} noOfMonths Accepts the number of month count
* @returns {Date} Returns the date object
*/
function addMonths(date, noOfMonths) {
date = new Date('' + date);
var day = date.getDate();
date.setDate(1);
date.setMonth(date.getMonth() + noOfMonths);
date.setDate(Math.min(day, getMaxDays(date)));
return date;
}
/**
* Method to add no of years in date object
*
* @param {Date} date Accepts the date object
* @param {number} noOfYears Accepts the number of month count
* @returns {Date} Returns the date object
*/
function addYears(date, noOfYears) {
date = new Date('' + date);
var day = date.getDate();
date.setDate(1);
date.setFullYear(date.getFullYear() + noOfYears);
date.setDate(Math.min(day, getMaxDays(date)));
return date;
}
/**
* Method to get start and end hours
*
* @param {Date} date Accepts the date object
* @param {Date} startHour Accepts the start hour date object
* @param {Date} endHour Accepts the end hour date object
* @returns {Object} Returns the start and end hour date objects
*/
function getStartEndHours(date, startHour, endHour) {
var date1 = new Date(date.getTime());
date1.setHours(startHour.getHours());
date1.setMinutes(startHour.getMinutes());
date1.setSeconds(startHour.getSeconds());
var date2 = new Date(date.getTime());
if (endHour.getHours() === 0) {
date2 = addDays(date2, 1);
}
else {
date2.setHours(endHour.getHours());
date2.setMinutes(endHour.getMinutes());
date2.setSeconds(endHour.getSeconds());
}
return { startHour: date1, endHour: date2 };
}
/**
* Method to get month last date
*
* @param {Date} date Accepts the date object
* @returns {number} Returns the month last date
*/
function getMaxDays(date) {
return lastDateOfMonth(date).getDate();
}
/**
* Method to get days count between two dates
*
* @param {Date} startDate Accepts the date object
* @param {Date} endDate Accepts the date object
* @returns {number} Returns the days count
*/
function getDaysCount(startDate, endDate) {
var strTime = resetTime(new Date(startDate));
var endTime = resetTime(new Date(endDate));
return Math.round((endTime.getTime() - strTime.getTime()) / MS_PER_DAY);
}
/**
* Method to get date object from date string
*
* @param {string} date Accepts the date string
* @returns {Date} Returns the date object
*/
function getDateFromString(date) {
return date.indexOf('Date') !== -1 ? new Date(parseInt(date.match(/\d+/g).toString(), 10)) :
date.indexOf('T') !== -1 ? new Date(date) : new Date(date.replace(/-/g, '/'));
}
/** @private */
var scrollWidth = null;
/** @private */
var pixelRatio = null;
/**
* Method to get scrollbar width
*
* @returns {number} Returns the scrollbar width
* @private
*/
function getScrollBarWidth() {
if (scrollWidth !== null) {
return scrollWidth;
}
if (pixelRatio === null) {
pixelRatio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth;
}
var divNode = createElement('div');
var value = 0;
divNode.style.cssText = 'width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;';
document.body.appendChild(divNode);
var ratio = (devicePixelRatio) ? (devicePixelRatio.toFixed(2) === '1.10' || devicePixelRatio <= 1) ?
Math.ceil(devicePixelRatio % 1) : Math.floor(devicePixelRatio % 1) : 0;
value = (divNode.offsetWidth - divNode.clientWidth - ratio) | 0;
document.body.removeChild(divNode);
return scrollWidth = value;
}
/**
* Method to reset scrollbar width
*
* @private
* @returns {void}
*/
function resetScrollbarWidth() {
var zoomPixelRatio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth;
if (pixelRatio && pixelRatio !== zoomPixelRatio) {
scrollWidth = null;
pixelRatio = zoomPixelRatio;
}
}
/**
* Method to find the index from data collection
*
* @param {Object} data Accepts the data as object
* @param {string} field Accepts the field name
* @param {string} value Accepts the value name
* @param {Object} event Accepts the data as object
* @param {Object[]} resourceCollection Accepts the data collections
* @returns {number} Returns the index number
*/
// eslint-disable-next-line max-len
function findIndexInData(data, field, value, event, resourceCollection) {
for (var i = 0, length_1 = data.length; i < length_1; i++) {
if (data[parseInt(i.toString(), 10)]["" + field] === value) {
if (event) {
var field_1 = resourceCollection.slice(-2)[0].field;
var res = (event["" + field_1] instanceof Array ? event["" + field_1] : [event["" + field_1]]);
var resData = res.join(',');
if (resData.includes(data[parseInt(i.toString(), 10)][resourceCollection.slice(-1)[0].groupIDField])) {
return i;
}
}
else {
return i;
}
}
}
return -1;
}
/**
* Method to get element outer height
*
* @param {HTMLElement} element Accepts the DOM element
* @returns {number} Returns the outer height of the given element
*/
function getOuterHeight(element) {
var style = getComputedStyle(element);
return element.offsetHeight + (parseInt(style.marginTop, 10) || 0) + (parseInt(style.marginBottom, 10) || 0);
}
/**
* Method to remove child elements
*
* @param {HTMLElement | Element} element Accepts the DOM element
* @returns {void}
*/
function removeChildren(element) {
var elementChildren = [].slice.call(element.children);
for (var _i = 0, elementChildren_1 = elementChildren; _i < elementChildren_1.length; _i++) {
var elementChild = elementChildren_1[_i];
element.removeChild(elementChild);
}
}
/**
* Method to check DST is present or not in date object
*
* @param {Date} date Accepts the date object
* @returns {boolean} Returns the boolean value for either DST is present or not
*/
function isDaylightSavingTime(date) {
var jan = new Date(date.getFullYear(), 0, 1);
var jul = new Date(date.getFullYear(), 6, 1);
return date.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
}
/**
* Method to get UTC time value from date
*
* @param {Date} date Accepts the date
* @returns {number} Returns the UTC time value
*/
function getUniversalTime(date) {
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
var milliseconds = date.getMilliseconds();
return Date.UTC(year, month, day, hours, minutes, seconds, milliseconds);
}
/**
* Method to check the device
*
* @returns {boolean} Returns the boolean value for either device is present or not.
*/
function isMobile() {
return window.navigator.userAgent.toLowerCase().indexOf('mobi') > -1;
}
/**
* Method to check the IPad device
*
* @returns {boolean} Returns the boolean value for either IPad device is present or not.
*/
function isIPadDevice() {
return window.navigator.userAgent.toLowerCase().indexOf('ipad') > -1;
}
/**
* Method to capitalize the first word in string
*
* @param {string} inputString Accepts the string value
* @param {string} type Accepts the string type
* @returns {string} Returns the output string
*/
function capitalizeFirstWord(inputString, type) {
if (type === 'multiple') {
inputString = inputString.split(' ').map(function (e) { return e.charAt(0).toLocaleUpperCase() + e.substring(1); }).join(' ');
}
else if (type === 'single') {
if (inputString[0] >= '0' && inputString[0] <= '9') {
var array = inputString.match(/[a-zA-Z]/);
inputString = isNullOrUndefined(array) ? inputString :
inputString.slice(0, array.index) + inputString[array.index].toLocaleUpperCase() + inputString.slice(array.index + 1);
}
inputString = inputString[0].toLocaleUpperCase() + inputString.slice(1);
}
return inputString;
}
/**
* Method to get element cell width
*
* @param {HTMLElement} element Accepts the DOM element
* @param {boolean} isTransformed Accepts the boolean value that indicates the status of the transform style applied to the element
* @returns {number} Returns the width of the given element
*/
function getElementWidth(element, isTransformed) {
return isTransformed ? element.offsetWidth : element.getBoundingClientRect().width;
}
/**
* Method to get element cell Height
*
* @param {HTMLElement} element Accepts the DOM element
* @param {boolean} isTransformed Accepts the boolean value that indicates the status of the transform style applied to the element
* @returns {number} Returns the Height of the given element
*/
function getElementHeight(element, isTransformed) {
return isTransformed ? element.offsetHeight : element.getBoundingClientRect().height;
}
/**
* Method to get element cell Top
*
* @param {HTMLElement} element Accepts the DOM element
* @param {boolean} isTransformed Accepts the boolean value that indicates the status of the transform style applied to the element
* @returns {number} Returns the top value of the given element
*/
function getElementTop(element, isTransformed) {
return isTransformed ? element.offsetTop : element.getBoundingClientRect().top;
}
/**
* CSS Constants
*/
/** @private */
var ROOT = 'e-schedule';
/** @private */
var RTL = 'e-rtl';
/** @private */
var DEVICE_CLASS = 'e-device';
/** @private */
var ADAPTIVE_CLASS = 'e-adaptive';
/** @private */
var MULTI_DRAG = 'e-multi-drag';
/** @private */
var ICON = 'e-icons';
/** @private */
var ENABLE_CLASS = 'e-enable';
/** @private */
var DISABLE_CLASS = 'e-disable';
/** @private */
var TABLE_CONTAINER_CLASS = 'e-table-container';
/** @private */
var SCHEDULE_TABLE_CLASS = 'e-schedule-table';
/** @private */
var ALLDAY_CELLS_CLASS = 'e-all-day-cells';
/** @private */
var HEADER_POPUP_CLASS = 'e-header-popup';
/** @private */
var HEADER_CALENDAR_CLASS = 'e-header-calendar';
/** @private */
var ALLDAY_ROW_CLASS = 'e-all-day-row';
/** @private */
var CONTENT_TABLE_CLASS = 'e-content-table';
/** @private */
var WORK_CELLS_CLASS = 'e-work-cells';
/** @private */
var WORK_HOURS_CLASS = 'e-work-hours';
/** @private */
var POPUP_OPEN = 'e-popup-open';
/** @private */
var POPUP_CLOSE = 'e-popup-close';
/** @private */
var DATE_HEADER_WRAP_CLASS = 'e-date-header-wrap';
/** @private */
var DATE_HEADER_CONTAINER_CLASS = 'e-date-header-container';
/** @private */
var HEADER_CELLS_CLASS = 'e-header-cells';
/** @private */
var HEADER_WEEK_CELLS_CLASS = 'e-header-week-cell';
/** @private */
var HEADER_MONTH_CELLS_CLASS = 'e-header-month-cell';
/** @private */
var HEADER_YEAR_CELLS_CLASS = 'e-header-year-cell';
/** @private */
var WORKDAY_CLASS = 'e-work-days';
/** @private */
var OTHERMONTH_CLASS = 'e-other-month';
/** @private */
var CURRENT_DAY_CLASS = 'e-current-day';
/** @private */
var CURRENTDATE_CLASS = 'e-current-date';
/** @private */
var CURRENT_PANEL_CLASS = 'e-current-panel';
/** @private */
var PREVIOUS_PANEL_CLASS = 'e-previous-panel';
/** @private */
var NEXT_PANEL_CLASS = 'e-next-panel';
/** @private */
var PREVIOUS_DATE_CLASS = 'e-prev';
/** @private */
var NEXT_DATE_CLASS = 'e-next';
/** @private */
var TRANSLATE_CLASS = 'e-translate';
/** @private */
var LEFT_INDENT_CLASS = 'e-left-indent';
/** @private */
var LEFT_INDENT_WRAP_CLASS = 'e-left-indent-wrap';
/** @private */
var EVENT_TABLE_CLASS = 'e-event-table';
/** @private */
var RESOURCE_LEFT_TD_CLASS = 'e-resource-left-td';
/** @private */
var RESOURCE_GROUP_CELLS_CLASS = 'e-resource-group-cells';
/** @private */
var RESOURCE_TEXT_CLASS = 'e-resource-text';
/** @private */
var RESOURCE_COLUMN_WRAP_CLASS = 'e-resource-column-wrap';
/** @private */
var RESOURCE_COLUMN_TABLE_CLASS = 'e-resource-column-table';
/** @private */
var RESOURCE_CHILD_CLASS = 'e-child-node';
/** @private */
var RESOURCE_PARENT_CLASS = 'e-parent-node';
/** @private */
var RESOURCE_EXPAND_CLASS = 'e-resource-expand';
/** @private */
var RESOURCE_COLLAPSE_CLASS = 'e-resource-collapse';
/** @private */
var RESOURCE_TREE_ICON_CLASS = 'e-resource-tree-icon';
/** @private */
var RESOURCE_CELLS_CLASS = 'e-resource-cells';
/** @private */
var TIME_CELLS_WRAP_CLASS = 'e-time-cells-wrap';
/** @private */
var TIME_CELLS_CLASS = 'e-time-cells';
/** @private */
var TIME_SLOT_CLASS = 'e-time-slots';
/** @private */
var ALTERNATE_CELLS_CLASS = 'e-alternate-cells';
/** @private */
var CURRENT_TIME_CLASS = 'e-current-time';
/** @private */
var CURRENT_TIMELINE_CLASS = 'e-current-timeline';
/** @private */
var PREVIOUS_TIMELINE_CLASS = 'e-previous-timeline';
/** @private */
var HIDE_CHILDS_CLASS = 'e-hide-childs';
/** @private */
var SCROLL_CONTAINER_CLASS = 'e-scroll-container';
/** @private */
var TIMELINE_WRAPPER_CLASS = 'e-timeline-wrapper';
/** @private */
var APPOINTMENT_WRAPPER_CLASS = 'e-appointment-wrapper';
/** @private */
var APPOINTMENT_WRAPPER_HIDDEN_CLASS = 'e-appointment-wrapper-hidden';
/** @private */
var DAY_WRAPPER_CLASS = 'e-day-wrapper';
/** @private */
var TOOLBAR_CONTAINER = 'e-schedule-toolbar-container';
/** @private */
var RESOURCE_TOOLBAR_CONTAINER = 'e-schedule-resource-toolbar-container';
/** @private */
var HEADER_TOOLBAR = 'e-schedule-toolbar';
/** @private */
var RESOURCE_HEADER_TOOLBAR = 'e-schedule-resource-toolbar';
/** @private */
var SELECTED_CELL_CLASS = 'e-selected-cell';
/** @private */
var WEEK_NUMBER_WRAPPER_CLASS = 'e-week-number-wrapper';
/** @private */
var WEEK_NUMBER_CLASS = 'e-week-number';
/** @private */
var APPOINTMENT_WRAP_CLASS = 'e-appointment-wrap';
/** @private */
var WRAPPER_CONTAINER_CLASS = 'e-wrapper-container';
/** @private */
var APPOINTMENT_CONTAINER_CLASS = 'e-appointment-container';
/** @private */
var APPOINTMENT_CLASS = 'e-appointment';
/** @private */
var BLOCK_APPOINTMENT_CLASS = 'e-block-appointment';
/** @private */
var BLOCK_INDICATOR_CLASS = 'e-block-indicator';
/** @private */
var APPOINTMENT_BORDER = 'e-appointment-border';
/** @private */
var APPOINTMENT_DETAILS = 'e-appointment-details';
/** @private */
var SUBJECT_WRAP = 'e-subject-wrap';
/** @private */
var RESOURCE_NAME = 'e-resource-name';
/** @private */
var APPOINTMENT_TIME = 'e-time';
/** @private */
var TABLE_WRAP_CLASS = 'e-table-wrap';
/** @private */
var OUTER_TABLE_CLASS = 'e-outer-table';
/** @private */
var CONTENT_WRAP_CLASS = 'e-content-wrap';
/** @private */
var VIRTUAL_TRACK_CLASS = 'e-virtual-track';
/** @private */
var AGENDA_CELLS_CLASS = 'e-agenda-cells';
/** @private */
var AGENDA_CURRENT_DAY_CLASS = 'e-current-day';
/** @private */
var AGENDA_SELECTED_CELL = 'e-active-appointment-agenda';
/** @private */
var MONTH_HEADER_CLASS = 'e-month-header';
/** @private */
var AGENDA_HEADER_CLASS = 'e-day-date-header';
/** @private */
var AGENDA_RESOURCE_CLASS = 'e-resource-column';
/** @private */
var AGENDA_DATE_CLASS = 'e-date-column';
/** @private */
var NAVIGATE_CLASS = 'e-navigate';
/** @private */
var DATE_HEADER_CLASS = 'e-date-header';
/** @private */
var AGENDA_DAY_BORDER_CLASS = 'e-day-border';
/** @private */
var DATE_BORDER_CLASS = 'e-date-border';
/** @private */
var AGENDA_DAY_PADDING_CLASS = 'e-day-padding';
/** @private */
var DATE_TIME_CLASS = 'e-date-time';
/** @private */
var DATE_TIME_WRAPPER_CLASS = 'e-date-time-wrapper';
/** @private */
var AGENDA_EMPTY_EVENT_CLASS = 'e-empty-event';
/** @private */
var AGENDA_NO_EVENT_CLASS = 'e-no-event';
/** @private */
var APPOINTMENT_INDICATOR_CLASS = 'e-appointment-indicator';
/** @private */
var EVENT_INDICATOR_CLASS = 'e-indicator';
/** @private */
var EVENT_ICON_UP_CLASS = 'e-up-icon';
/** @private */
var EVENT_ICON_DOWN_CLASS = 'e-down-icon';
/** @private */
var EVENT_ICON_LEFT_CLASS = 'e-left-icon';
/** @private */
var EVENT_ICON_RIGHT_CLASS = 'e-right-icon';
/** @private */
var EVENT_ACTION_CLASS = 'e-event-action';
/** @private */
var NEW_EVENT_CLASS = 'e-new-event';
/** @private */
var CLONE_ELEMENT_CLASS = 'e-schedule-event-clone';
/** @private */
var MONTH_CLONE_ELEMENT_CLASS = 'e-month-event';
/** @private */
var CLONE_TIME_INDICATOR_CLASS = 'e-clone-time-indicator';
/** @private */
var DRAG_CLONE_CLASS = 'e-drag-clone';
/** @private */
var EVENT_RESIZE_CLASS = 'e-event-resize';
/** @private */
var RESIZE_CLONE_CLASS = 'e-resize-clone';
/** @private */
var LEFT_RESIZE_HANDLER = 'e-left-handler';
/** @private */
var RIGHT_RESIZE_HANDLER = 'e-right-handler';
/** @private */
var TOP_RESIZE_HANDLER = 'e-top-handler';
/** @private */
var BOTTOM_RESIZE_HANDLER = 'e-bottom-handler';
/** @private */
var EVENT_RECURRENCE_ICON_CLASS = 'e-recurrence-icon';
/** @private */
var EVENT_RECURRENCE_EDIT_ICON_CLASS = 'e-recurrence-edit-icon';
/** @private */
var HEADER_ROW_CLASS = 'e-header-row';
/** @private */
var ALLDAY_APPOINTMENT_WRAPPER_CLASS = 'e-all-day-appointment-wrapper';
/** @private */
var ALLDAY_APPOINTMENT_CLASS = 'e-all-day-appointment';
/** @private */
var EVENT_COUNT_CLASS = 'e-appointment-hide';
/** @private */
var ROW_COUNT_WRAPPER_CLASS = 'e-row-count-wrapper';
/** @private */
var ALLDAY_APPOINTMENT_SECTION_CLASS = 'e-all-day-appointment-section';
/** @private */
var APPOINTMENT_ROW_EXPAND_CLASS = 'e-appointment-expand';
/** @private */
var APPOINTMENT_ROW_COLLAPSE_CLASS = 'e-appointment-collapse';
/** @private */
var MORE_INDICATOR_CLASS = 'e-more-indicator';
/** @private */
var CELL_POPUP_CLASS = 'e-cell-popup';
/** @private */
var EVENT_POPUP_CLASS = 'e-event-popup';
/** @private */
var MULTIPLE_EVENT_POPUP_CLASS = 'e-multiple-event-popup';
/** @private */
var POPUP_HEADER_CLASS = 'e-popup-header';
/** @private */
var POPUP_HEADER_ICON_WRAPPER = 'e-header-icon-wrapper';
/** @private */
var POPUP_CONTENT_CLASS = 'e-popup-content';
/** @private */
var POPUP_FOOTER_CLASS = 'e-popup-footer';
/** @private */
var DATE_TIME_DETAILS_CLASS = 'e-date-time-details';
/** @private */
var RECURRENCE_SUMMARY_CLASS = 'e-recurrence-summary';
/** @private */
var QUICK_POPUP_EVENT_DETAILS_CLASS = 'e-event-details';
/** @private */
var EVENT_CREATE_CLASS = 'e-event-create';
/** @private */
var EDIT_EVENT_CLASS = 'e-event-edit';
/** @private */
var DELETE_EVENT_CLASS = 'e-event-delete';
/** @private */
var TEXT_ELLIPSIS = 'e-text-ellipsis';
/** @private */
var MORE_POPUP_WRAPPER_CLASS = 'e-more-popup-wrapper';
/** @private */
var MORE_EVENT_POPUP_CLASS = 'e-more-event-popup';
/** @private */
var MORE_EVENT_HEADER_CLASS = 'e-more-event-header';
/** @private */
var MORE_EVENT_DATE_HEADER_CLASS = 'e-more-event-date-header';
/** @private */
var MORE_EVENT_HEADER_DAY_CLASS = 'e-header-day';
/** @private */
var MORE_EVENT_HEADER_DATE_CLASS = 'e-header-date';
/** @private */
var MORE_EVENT_CLOSE_CLASS = 'e-more-event-close';
/** @private */
var MORE_EVENT_CONTENT_CLASS = 'e-more-event-content';
/** @private */
var MORE_EVENT_WRAPPER_CLASS = 'e-more-appointment-wrapper';
/** @private */
var QUICK_DIALOG_CLASS = 'e-quick-dialog';
/** @private */
var QUICK_DIALOG_OCCURRENCE_CLASS = 'e-quick-dialog-occurrence-event';
/** @private */
var QUICK_DIALOG_SERIES_CLASS = 'e-quick-dialog-series-event';
/** @private */
var QUICK_DIALOG_FOLLOWING_EVENTS_CLASS = 'e-quick-dialog-following-events';
/** @private */
var FOLLOWING_EVENTS_DIALOG = 'e-following-events-dialog';
/** @private */
var QUICK_DIALOG_DELETE_CLASS = 'e-quick-dialog-delete';
/** @private */
var QUICK_DIALOG_CANCEL_CLASS = 'e-quick-dialog-cancel';
/** @private */
var QUICK_DIALOG_ALERT_OK = 'e-quick-alertok';
/** @private */
var QUICK_DIALOG_ALERT_CANCEL = 'e-quick-alertcancel';
/** @private */
var QUICK_DIALOG_ALERT_FOLLOWING = 'e-quick-alertfollowing';
/** @private */
var QUICK_DIALOG_ALERT_BTN_CLASS = 'e-quick-dialog-alert-btn';
/** @private */
var EVENT_WINDOW_DIALOG_CLASS = 'e-schedule-dialog';
/** @private */
var FORM_CONTAINER_CLASS = 'e-form-container';
/** @private */
var FORM_CLASS = 'e-schedule-form';
/** @private */
var EVENT_WINDOW_ALLDAY_TZ_DIV_CLASS = 'e-all-day-time-zone-row';
/** @private */
var EVENT_WINDOW_ALL_DAY_CLASS = 'e-all-day';
/** @private */
var TIME_ZONE_CLASS = 'e-time-zone';
/** @private */
var TIME_ZONE_ICON_CLASS = 'e-time-zone-icon';
/** @private */
var TIME_ZONE_DETAILS_CLASS = 'e-time-zone-details';
/** @private */
var EVENT_WINDOW_REPEAT_DIV_CLASS = 'e-repeat-parent-row';
/** @private */
var EVENT_WINDOW_REPEAT_CLASS = 'e-repeat';
/** @private */
var EVENT_WINDOW_TITLE_LOCATION_DIV_CLASS = 'e-title-location-row';
/** @private */
var SUBJECT_CLASS = 'e-subject';
/** @private */
var LOCATION_CLASS = 'e-location';
/** @private */
var LOCATION_ICON_CLASS = 'e-location-icon';
/** @private */
var LOCATION_DETAILS_CLASS = 'e-location-details';
/** @private */
var EVENT_WINDOW_START_END_DIV_CLASS = 'e-start-end-row';
/** @private */
var EVENT_WINDOW_START_CLASS = 'e-start';
/** @private */
var EVENT_WINDOW_END_CLASS = 'e-end';
/** @private */
var EVENT_WINDOW_RESOURCES_DIV_CLASS = 'e-resources-row';
/** @private */
var DESCRIPTION_CLASS = 'e-description';
/** @private */
var DESCRIPTION_ICON_CLASS = 'e-description-icon';
/** @private */
var DESCRIPTION_DETAILS_CLASS = 'e-description-details';
/** @private */
var EVENT_WINDOW_TIME_ZONE_DIV_CLASS = 'e-time-zone-row';
/** @private */
var EVENT_WINDOW_START_TZ_CLASS = 'e-start-time-zone';
/** @private */
var EVENT_WINDOW_END_TZ_CLASS = 'e-end-time-zone';
/** @private */
var EVENT_WINDOW_BACK_ICON_CLASS = 'e-back-icon';
/** @private */
var EVENT_WINDOW_SAVE_ICON_CLASS = 'e-save-icon';
/** @private */
var EVENT_WINDOW_CANCEL_BUTTON_CLASS = 'e-event-cancel';
/** @private */
var EVENT_WINDOW_SAVE_BUTTON_CLASS = 'e-event-save';
/** @private */
var EVENT_WINDOW_DIALOG_PARENT_CLASS = 'e-dialog-parent';
/** @private */
var EVENT_WINDOW_TITLE_TEXT_CLASS = 'e-title-text';
/** @private */
var EVENT_WINDOW_ICON_DISABLE_CLASS = 'e-icon-disable';
/** @private */
var EDIT_CLASS = 'e-edit';
/** @private */
var EDIT_ICON_CLASS = 'e-edit-icon';
/** @private */
var DELETE_CLASS = 'e-delete';
/** @private */
var DELETE_ICON_CLASS = 'e-delete-icon';
/** @private */
var CLOSE_CLASS = 'e-close';
/** @private */
var CLOSE_ICON_CLASS = 'e-close-icon';
/** @private */
var ERROR_VALIDATION_CLASS = 'e-schedule-error';
/** @private */
var EVENT_TOOLTIP_ROOT_CLASS = 'e-schedule-event-tooltip';
/** @private */
var TOOLTIP_HIDDEN_CLASS = 'e-tooltip-hidden';
/** @private */
var ALLDAY_ROW_ANIMATE_CLASS = 'e-animate';
/** @private */
var TIMESCALE_DISABLE = 'e-timescale-disable';
/** @private */
var DISABLE_DATE = 'e-disable-date';
/** @private */
var HIDDEN_CLASS = 'e-hidden';
/** @private */
var DISABLE_DATES = 'e-disable-dates';
/** @private */
var POPUP_WRAPPER_CLASS = 'e-quick-popup-wrapper';
/** @private */
var POPUP_TABLE_CLASS = 'e-popup-table';
/** @private */
var RESOURCE_MENU = 'e-resource-menu';
/** @private */
var RESOURCE_MENU_ICON = 'e-icon-menu';
/** @private */
var RESOURCE_LEVEL_TITLE = 'e-resource-level-title';
/** @private */
var RESOURCE_TREE = 'e-resource-tree';
/** @private */
var RESOURCE_TREE_POPUP_OVERLAY = 'e-resource-tree-popup-overlay';
/** @private */
var RESOURCE_TREE_POPUP = 'e-resource-tree-popup';
/** @private */
var RESOURCE_CLASS = 'e-resource';
/** @private */
var RESOURCE_ICON_CLASS = 'e-resource-icon';
/** @private */
var RESOURCE_DETAILS_CLASS = 'e-resource-details';
/** @private */
var DATE_TIME_ICON_CLASS = 'e-date-time-icon';
/** @private */
var VIRTUAL_SCROLL_CLASS = 'e-virtual-scroll';
/** @private */
var ICON_DISABLE_CLASS = 'e-icon-disable';
/** @private */
var AUTO_HEIGHT = 'e-auto-height';
/** @private */
var IGNORE_WHITESPACE = 'e-ignore-whitespace';
/** @private */
var EVENT_TEMPLATE = 'e-template';
/** @private */
var READ_ONLY = 'e-read-only';
/** @private */
var MONTH_HEADER_WRAPPER = 'e-month-header-wrapper';
/** @private */
var INLINE_SUBJECT_CLASS = 'e-inline-subject';
/** @private */
var INLINE_APPOINTMENT_CLASS = 'e-inline-appointment';
/** @private */
var INLINE_EDIT_CLASS = 'e-inline-edit';
/** @hidden */
var SCROLL_HIDDEN = 'e-scroll-hidden';
/** @private */
var ALLDAY_APPOINTMENT_SCROLL = 'e-all-day-scroll';
/** @private */
var ALLDAY_APPOINTMENT_AUTO = 'e-all-day-auto';
/** @private */
var CLIPBOARD_CLASS = 'e-clipboard';
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(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);
};
/**
* Header module
*/
var HeaderRenderer = /** @__PURE__ @class */ (function () {
function HeaderRenderer(parent) {
this.parent = parent;
this.l10n = this.parent.localeObj;
this.renderHeader();
this.addEventListener();
}
HeaderRenderer.prototype.addEventListener = function () {
this.parent.on(documentClick, this.closeHeaderPopup, this);
};
HeaderRenderer.prototype.removeEventListener = function () {
this.parent.off(documentClick, this.closeHeaderPopup);
};
HeaderRenderer.prototype.closeHeaderPopup = function (e) {
var closestEle = closest(e.event.target, '.e-date-range,.e-header-popup,.e-day,.e-selected');
var closestPop = closest(e.event.target, '.e-hor-nav,.e-toolbar-pop');
var contentWrap = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS);
var toolbarPop = this.parent.element.querySelector('.e-toolbar-pop');
if (this.parent.isAdaptive) {
if (!isNullOrUndefined(closestPop) && (closestPop.classList.contains('e-toolbar-pop') ||
closestPop.classList.contains('e-hor-nav')) && !(closestPop.classList.contains('e-hor-nav') &&
toolbarPop && toolbarPop.classList.contains(POPUP_OPEN))) {
addClass([contentWrap], SCROLL_HIDDEN);
}
else {
removeClass([contentWrap], SCROLL_HIDDEN);
var popupEle = this.element.querySelector('.e-toolbar-pop');
if (!isNullOrUndefined(popupEle)) {
var popupObj = popupEle.ej2_instances[0];
if (popupObj && !(!isNullOrUndefined(closestPop) && closestPop.classList.contains('e-hor-nav') &&
popupEle.classList.contains(POPUP_OPEN))) {
popupObj.hide();
}
}
}
}
if (!isNullOrUndefined(closestEle)) {
return;
}
this.hideHeaderPopup();
};
HeaderRenderer.prototype.hideHeaderPopup = function () {
if (this.headerPopup) {
this.headerPopup.hide();
}
};
HeaderRenderer.prototype.renderHeader = function () {
this.element = createElement('div', { className: TOOLBAR_CONTAINER });
var toolbarEle = createElement('div', { className: HEADER_TOOLBAR });
this.element.appendChild(toolbarEle);
this.parent.element.insertBefore(this.element, this.parent.element.firstElementChild);
this.renderToolbar();
};
HeaderRenderer.prototype.renderToolbar = function () {
var _this = this;
var items = (this.parent.toolbarItems && this.parent.toolbarItems.length > 0) ?
this.getToolbarItems() : this.getItems();
this.parent.trigger(actionBegin, { requestType: 'toolbarItemRendering', items: items }, function (args) {
_this.toolbarObj = new Toolbar({
items: args.items,
overflowMode: 'Popup',
clicked: _this.toolbarClickHandler.bind(_this),
created: _this.toolbarCreateHandler.bind(_this),
enableRtl: _this.parent.enableRtl,
enableHtmlSanitizer: _this.parent.enableHtmlSanitizer,
locale: _this.parent.locale
});
_this.toolbarObj.isStringTemplate = true;
_this.toolbarObj.root = _this.parent.root ? _this.parent.root : _this.parent;
_this.toolbarObj.appendTo(_this.parent.element.querySelector('.' + HEADER_TOOLBAR));
_this.toolbarObj.element.setAttribute('aria-label', 'Scheduler');
var prevNavEle = _this.toolbarObj.element.querySelector('.e-prev');
if (prevNavEle) {
prevNavEle.firstElementChild.setAttribute('title', _this.l10n.getConstant('previous'));
}
var nextNavEle = _this.toolbarObj.element.querySelector('.e-next');
if (nextNavEle) {
nextNavEle.firstElementChild.setAttribute('title', _this.l10n.getConstant('next'));
}
_this.updateAddIcon();
_this.updateActiveView();
_this.parent.trigger(actionComplete, { requestType: 'toolBarItemRendered', items: _this.toolbarObj.items });
});
};
HeaderRenderer.prototype.updateItems = function () {
var _this = this;
if (this.toolbarObj) {
var items = this.getItems();
this.parent.trigger(actionBegin, { requestType: 'toolbarItemRendering', items: items }, function (args) {
_this.toolbarObj.items = args.items;
_this.toolbarObj.dataBind();
_this.parent.trigger(actionComplete, { requestType: 'toolBarItemRendered', items: _this.toolbarObj.items });
});
}
};
HeaderRenderer.prototype.getPopUpRelativeElement = function () {
if (this.parent.isAdaptive) {
return this.toolbarObj.element;
}
return this.element.querySelector('.e-date-range');
};
HeaderRenderer.prototype.setDayOfWeek = function (index) {
if (this.headerCalendar) {
this.headerCalendar.firstDayOfWeek = index;
this.headerCalendar.dataBind();
}
};
HeaderRenderer.prototype.setCalendarDate = function (date) {
if (this.headerCalendar) {
this.headerCalendar.value = date;
this.headerCalendar.dataBind();
}
};
HeaderRenderer.prototype.setCalendarMinMaxDate = function () {
if (this.headerCalendar) {
this.headerCalendar.min = this.parent.minDate;
this.headerCalendar.max = this.parent.maxDate;
this.headerCalendar.dataBind();
}
};
HeaderRenderer.prototype.getCalendarView = function () {
if (['Month', 'MonthAgenda', 'TimelineMonth'].indexOf(this.parent.currentView) > -1) {
return 'Year';
}
else if (['Year', 'TimelineYear'].indexOf(this.parent.currentView) > -1) {
return 'Decade';
}
else {
return 'Month';
}
};
HeaderRenderer.prototype.setCalendarView = function () {
if (this.headerCalendar) {
var calendarView = this.getCalendarView();
this.headerCalendar.depth = calendarView;
this.headerCalendar.start = calendarView;
this.headerCalendar.refresh();
}
};
HeaderRenderer.prototype.updateActiveView = function () {
var selEle = [].slice.call(this.toolbarObj.element.querySelectorAll('.e-views'));
removeClass(selEle, ['e-active-view']);
if (selEle.length > 0 && selEle[this.parent.viewIndex]) {
addClass([selEle[this.parent.viewIndex]], ['e-active-view']);
}
};
HeaderRenderer.prototype.updateDateRange = function (date) {
var selEle = this.toolbarObj.element.querySelector('.e-date-range');
if (!selEle) {
return;
}
selEle.firstElementChild.setAttribute('aria-haspopup', 'true');
var textEle = selEle.querySelector('.e-tbar-btn-text');
if (this.parent.activeViewOptions.dateRangeTemplate) {
textEle.textContent = '';
var args = {
startDate: this.parent.activeView.getStartDate(),
endDate: this.parent.activeView.getEndDate(), currentView: this.parent.currentView
};
var viewName = this.parent.activeViewOptions.dateRangeTemplateName;
var templateId = this.parent.element.id + '_' + viewName + 'dateRangeTemplate';
var dateTemplate = [].slice.call(this.parent.getDateRangeTemplate()(args, this.parent, 'dateRangeTemplate', templateId, false, undefined, undefined, this.parent.root));
append(dateTemplate, textEle);
}
else {
var text = this.parent.activeView.getDateRangeText(date);
selEle.firstElementChild.setAttribute('aria-label', text);
textEle.textContent = text;
}
this.refresh();
};
HeaderRenderer.prototype.refresh = function () {
if (this.toolbarObj) {
this.toolbarObj.refreshOverflow();
}
};
HeaderRenderer.prototype.updateAddIcon = function () {
var addEle = this.toolbarObj.element.querySelector('.e-add');
if (addEle) {
if (!this.parent.eventSettings.allowAdding) {
addClass([addEle], HIDDEN_CLASS);
}
else {
removeClass([addEle], HIDDEN_CLASS);
}
}
};
HeaderRenderer.prototype.getDateRangeText = function () {
var dateString = this.parent.globalize.formatDate(this.parent.selectedDate, {
format: 'MMMM y', calendar: this.parent.getCalendarMode()
});
return capitalizeFirstWord(dateString, 'single');
};
HeaderRenderer.prototype.getItemModel = function (propItem) {
var item = {};
if (propItem.id) {
item.id = propItem.id;
}
if (propItem.text) {
item.text = propItem.text;
}
if (propItem.tooltipText) {
item.tooltipText = propItem.tooltipText;
}
if (propItem.prefixIcon) {
item.prefixIcon = propItem.prefixIcon;
}
if (propItem.cssClass) {
item.cssClass = propItem.cssClass;
}
if (propItem.showTextOn !== 'Both') {
item.showTextOn = propItem.showTextOn;
}
if (propItem.template) {
item.template = propItem.template;
}
if (propItem.disabled) {
item.disabled = propItem.disabled;
}
if (propItem.width !== 'auto') {
item.width = propItem.width;
}
if (propItem.suffixIcon) {
item.suffixIcon = propItem.suffixIcon;
}
if (propItem.align !== 'Left') {
item.align = propItem.align;
}
if (propItem.overflow !== 'None') {
item.overflow = propItem.overflow;
}
if (propItem.htmlAttributes) {
item.htmlAttributes = propItem.htmlAttributes;
}
if (propItem.type !== 'Button') {
item.type = propItem.type;
}
if (propItem.visible !== true) {
item.visible = propItem.visible;
}
if (propItem.showAlwaysInPopup) {
item.showAlwaysInPopup = propItem.showAlwaysInPopup;
}
if (propItem.tabIndex !== -1) {
item.tabIndex = propItem.tabIndex;
}
return item;
};
HeaderRenderer.prototype.getToolbarItems = function () {
var items = [];
var propItem;
for (var _i = 0, _a = this.parent.toolbarItems; _i < _a.length; _i++) {
var item = _a[_i];
propItem = this.getItemModel(item);
var tbItem = void 0;
if (item.name) {
switch (item.name) {
case 'Today':
tbItem = {
showAlwaysInPopup: (this.parent.isAdaptive || this.parent.enableAdaptiveUI), prefixIcon: 'e-icon-today',
text: this.l10n.getConstant('today'), cssClass: 'e-today', overflow: 'Show'
};
tbItem.align = propItem.align ? propItem.align : item.align;
items.push(__assign({}, tbItem, propItem));
break;
case 'Previous':
tbItem = {
prefixIcon: 'e-icon-prev', tooltipText: 'Previous', overflow: 'Show',
cssClass: 'e-prev', htmlAttributes: { 'role': 'navigation' }
};
tbItem.align = propItem.align ? propItem.align : item.align;
items.push(__assign({}, tbItem, propItem));
break;
case 'Next':
tbItem = {
prefixIcon: 'e-icon-next', tooltipText: 'Next', overflow: 'Show',
cssClass: 'e-next', htmlAttributes: { 'role': 'navigation' }
};
tbItem.align = propItem.align ? propItem.align : item.align;
items.push(__assign({}, tbItem, propItem));
break;
case 'DateRangeText':
tbItem = {
text: this.getDateRangeText(), suffixIcon: 'e-icon-down-arrow', cssClass: 'e-date-range',
overflow: 'Show',
htmlAttributes: { 'aria-atomic': 'true', 'aria-live': 'assertive', 'role': 'navigation' }
};
tbItem.align = propItem.align ? propItem.align : item.align;
items.push(__assign({}, tbItem, propItem));
break;
case 'NewEvent':
tbItem = {
showAlwaysInPopup: (this.parent.isAdaptive || this.parent.enableAdaptiveUI), prefixIcon: 'e-icon-add',
text: this.l10n.getConstant('newEvent'), cssClass: 'e-add', overflow: 'Show'
};
tbItem.align = propItem.align ? propItem.align : item.align;
items.push(__assign({}, tbItem, propItem));
break;
case 'Views':
if (!isNullOrUndefined(this.parent.views) && this.parent.views.length > 1) {
for (var _b = 0, _c = this.parent.views; _b < _c.length; _b++) {
var view = _c[_b];
tbItem = this.getItemObject(view);
tbItem.align = propItem.align ? propItem.align : item.align;
items.push(__assign({}, tbItem, propItem));
}
}
break;
case 'Custom':
items.push(item);
break;
}
}
else {
items.push(item);
}
}
return items;
};
HeaderRenderer.prototype.getItems = function () {
var items = [];
items.push({
align: 'Left', prefixIcon: 'e-icon-prev', tooltipText: 'Previous', overflow: 'Show',
cssClass: 'e-prev'
});
items.push({
align: 'Left', prefixIcon: 'e-icon-next', tooltipText: 'Next', overflow: 'Show',
cssClass: 'e-next'
});
items.push({
align: 'Left', text: this.getDateRangeText(), suffixIcon: 'e-icon-down-arrow', cssClass: 'e-date-range',
overflow: 'Show',
htmlAttributes: { 'aria-atomic': 'true', 'aria-live': 'assertive' }
});
if (this.parent.isAdaptive || this.parent.en