UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

1,116 lines (1,107 loc) • 95.8 kB
/** * DevExtreme (cjs/ui/scheduler/ui.scheduler.js) * Version: 21.2.4 * Build date: Mon Dec 06 2021 * * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; exports.default = void 0; var _component_registrator = _interopRequireDefault(require("../../core/component_registrator")); var _config = _interopRequireDefault(require("../../core/config")); var _devices = _interopRequireDefault(require("../../core/devices")); var _renderer = _interopRequireDefault(require("../../core/renderer")); var _bindable_template = require("../../core/templates/bindable_template"); var _empty_template = require("../../core/templates/empty_template"); var _array = require("../../core/utils/array"); var _callbacks = _interopRequireDefault(require("../../core/utils/callbacks")); var _common = require("../../core/utils/common"); var _data = require("../../core/utils/data"); var _position = require("../../core/utils/position"); var _date = _interopRequireDefault(require("../../core/utils/date")); var _date_serialization = _interopRequireDefault(require("../../core/utils/date_serialization")); var _deferred = require("../../core/utils/deferred"); var _extend = require("../../core/utils/extend"); var _iterator = require("../../core/utils/iterator"); var _type = require("../../core/utils/type"); var _window = require("../../core/utils/window"); var _data_helper = _interopRequireDefault(require("../../data_helper")); var _visibility_change = require("../../events/visibility_change"); var _date2 = _interopRequireDefault(require("../../localization/date")); var _message = _interopRequireDefault(require("../../localization/message")); var _dialog = require("../dialog"); var _themes = require("../themes"); var _ui = _interopRequireDefault(require("../widget/ui.errors")); var _ui2 = _interopRequireDefault(require("../widget/ui.widget")); var _popup = require("./appointmentPopup/popup"); var _form = require("./appointmentPopup/form"); var _compactAppointmentsHelper = require("./compactAppointmentsHelper"); var _desktopTooltipStrategy = require("./tooltip_strategies/desktopTooltipStrategy"); var _mobileTooltipStrategy = require("./tooltip_strategies/mobileTooltipStrategy"); var _loading = require("./loading"); var _appointmentCollection = _interopRequireDefault(require("./appointments/appointmentCollection")); var _appointments = _interopRequireDefault(require("./appointments.layout_manager")); var _header = require("./header/header"); var _subscribes = _interopRequireDefault(require("./subscribes")); var _recurrence = require("./recurrence"); var _utils = _interopRequireDefault(require("./utils.timeZone")); var _uiScheduler = _interopRequireDefault(require("./workspaces/ui.scheduler.agenda")); var _uiScheduler2 = _interopRequireDefault(require("./workspaces/ui.scheduler.timeline_day")); var _uiScheduler3 = _interopRequireDefault(require("./workspaces/ui.scheduler.timeline_month")); var _uiScheduler4 = _interopRequireDefault(require("./workspaces/ui.scheduler.timeline_week")); var _uiScheduler5 = _interopRequireDefault(require("./workspaces/ui.scheduler.timeline_work_week")); var _uiScheduler6 = _interopRequireDefault(require("./workspaces/ui.scheduler.work_space_day")); var _uiScheduler7 = _interopRequireDefault(require("./workspaces/ui.scheduler.work_space_month")); var _uiScheduler8 = _interopRequireDefault(require("./workspaces/ui.scheduler.work_space_week")); var _uiScheduler9 = _interopRequireDefault(require("./workspaces/ui.scheduler.work_space_work_week")); var _appointmentAdapter = require("./appointmentAdapter"); var _dataStructures = require("./dataStructures"); var _utils2 = require("./utils"); var _instanceFactory = require("./instanceFactory"); var _utils3 = require("./resources/utils"); var _expressionUtils = require("./expressionUtils"); var _base = require("../../renovation/ui/scheduler/view_model/to_test/views/utils/base"); var _render2 = require("./appointments/render"); var _agendaResourceProcessor = require("./resources/agendaResourceProcessor"); var _appointmentDataProvider = require("./appointments/dataProvider/appointmentDataProvider"); var _utils4 = require("./appointments/dataProvider/utils"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _extends() { _extends = Object.assign || function(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key] } } } return target }; return _extends.apply(this, arguments) } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }) } else { obj[key] = value } return obj } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true } Object.defineProperty(target, descriptor.key, descriptor) } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) { _defineProperties(Constructor.prototype, protoProps) } if (staticProps) { _defineProperties(Constructor, staticProps) } return Constructor } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass) } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function(o, p) { o.__proto__ = p; return o }; return _setPrototypeOf(o, p) } var MINUTES_IN_HOUR = 60; var WIDGET_CLASS = "dx-scheduler"; var WIDGET_SMALL_CLASS = "".concat(WIDGET_CLASS, "-small"); var WIDGET_ADAPTIVE_CLASS = "".concat(WIDGET_CLASS, "-adaptive"); var WIDGET_READONLY_CLASS = "".concat(WIDGET_CLASS, "-readonly"); var WIDGET_SMALL_WIDTH = 400; var FULL_DATE_FORMAT = "yyyyMMddTHHmmss"; var UTC_FULL_DATE_FORMAT = FULL_DATE_FORMAT + "Z"; var DEFAULT_AGENDA_DURATION = 7; var DEFAULT_APPOINTMENT_TEMPLATE_NAME = "item"; var DEFAULT_APPOINTMENT_COLLECTOR_TEMPLATE_NAME = "appointmentCollector"; var DEFAULT_DROP_DOWN_APPOINTMENT_TEMPLATE_NAME = "dropDownAppointment"; var VIEWS_CONFIG = { day: { workSpace: _uiScheduler6.default, renderingStrategy: "vertical" }, week: { workSpace: _uiScheduler8.default, renderingStrategy: "vertical" }, workWeek: { workSpace: _uiScheduler9.default, renderingStrategy: "vertical" }, month: { workSpace: _uiScheduler7.default, renderingStrategy: "horizontalMonth" }, timelineDay: { workSpace: _uiScheduler2.default, renderingStrategy: "horizontal" }, timelineWeek: { workSpace: _uiScheduler4.default, renderingStrategy: "horizontal" }, timelineWorkWeek: { workSpace: _uiScheduler5.default, renderingStrategy: "horizontal" }, timelineMonth: { workSpace: _uiScheduler3.default, renderingStrategy: "horizontalMonthLine" }, agenda: { workSpace: _uiScheduler.default, renderingStrategy: "agenda" } }; var StoreEventNames = { ADDING: "onAppointmentAdding", ADDED: "onAppointmentAdded", DELETING: "onAppointmentDeleting", DELETED: "onAppointmentDeleted", UPDATING: "onAppointmentUpdating", UPDATED: "onAppointmentUpdated" }; var RECURRENCE_EDITING_MODE = { SERIES: "editSeries", OCCURENCE: "editOccurence", CANCEL: "cancel" }; var Scheduler = function(_Widget) { _inheritsLoose(Scheduler, _Widget); function Scheduler() { return _Widget.apply(this, arguments) || this } var _proto = Scheduler.prototype; _proto._getDefaultOptions = function() { var defaultOptions = (0, _extend.extend)(_Widget.prototype._getDefaultOptions.call(this), { views: ["day", "week"], currentView: "day", currentDate: _date.default.trimTime(new Date), min: void 0, max: void 0, dateSerializationFormat: void 0, firstDayOfWeek: void 0, groups: [], resources: [], loadedResources: [], resourceLoaderMap: new Map, dataSource: null, customizeDateNavigatorText: void 0, appointmentTemplate: DEFAULT_APPOINTMENT_TEMPLATE_NAME, dropDownAppointmentTemplate: DEFAULT_DROP_DOWN_APPOINTMENT_TEMPLATE_NAME, appointmentCollectorTemplate: DEFAULT_APPOINTMENT_COLLECTOR_TEMPLATE_NAME, dataCellTemplate: null, timeCellTemplate: null, resourceCellTemplate: null, dateCellTemplate: null, startDayHour: 0, endDayHour: 24, editing: { allowAdding: true, allowDeleting: true, allowDragging: true, allowResizing: true, allowUpdating: true, allowTimeZoneEditing: false }, showAllDayPanel: true, showCurrentTimeIndicator: true, shadeUntilCurrentTime: false, indicatorUpdateInterval: 3e5, indicatorTime: void 0, recurrenceEditMode: "dialog", cellDuration: 30, maxAppointmentsPerCell: "auto", selectedCellData: [], groupByDate: false, onAppointmentRendered: null, onAppointmentClick: null, onAppointmentDblClick: null, onAppointmentContextMenu: null, onCellClick: null, onCellContextMenu: null, onAppointmentAdding: null, onAppointmentAdded: null, onAppointmentUpdating: null, onAppointmentUpdated: null, onAppointmentDeleting: null, onAppointmentDeleted: null, onAppointmentFormOpening: null, appointmentTooltipTemplate: "appointmentTooltip", appointmentPopupTemplate: "appointmentPopup", crossScrollingEnabled: false, useDropDownViewSwitcher: false, startDateExpr: "startDate", endDateExpr: "endDate", textExpr: "text", descriptionExpr: "description", allDayExpr: "allDay", recurrenceRuleExpr: "recurrenceRule", recurrenceExceptionExpr: "recurrenceException", disabledExpr: "disabled", remoteFiltering: false, timeZone: "", startDateTimeZoneExpr: "startDateTimeZone", endDateTimeZoneExpr: "endDateTimeZone", noDataText: _message.default.format("dxCollectionWidget-noDataText"), adaptivityEnabled: false, allowMultipleCellSelection: true, scrolling: { mode: "standard" }, renovateRender: true, _draggingMode: "outlook", _appointmentTooltipOffset: { x: 0, y: 0 }, _appointmentTooltipButtonsPosition: "bottom", _appointmentTooltipOpenButtonText: _message.default.format("dxScheduler-openAppointment"), _dropDownButtonIcon: "overflow", _appointmentCountPerCell: 2, _collectorOffset: 0, _appointmentOffset: 26, toolbar: [{ location: "before", defaultElement: "dateNavigator" }, { location: "after", defaultElement: "viewSwitcher" }] }); return (0, _extend.extend)(true, defaultOptions, { integrationOptions: { useDeferUpdateForTemplates: false } }) }; _proto._setDeprecatedOptions = function() { _Widget.prototype._setDeprecatedOptions.call(this); (0, _extend.extend)(this._deprecatedOptions, { dropDownAppointmentTemplate: { since: "19.2", message: "appointmentTooltipTemplate" } }) }; _proto._defaultOptionsRules = function() { return _Widget.prototype._defaultOptionsRules.call(this).concat([{ device: function() { return "desktop" === _devices.default.real().deviceType && !_devices.default.isSimulator() }, options: { focusStateEnabled: true } }, { device: function() { return !_devices.default.current().generic }, options: { useDropDownViewSwitcher: true, editing: { allowDragging: false, allowResizing: false } } }, { device: function() { return (0, _themes.isMaterial)() }, options: { useDropDownViewSwitcher: true, dateCellTemplate: function(data, index, element) { var text = data.text; text.split(" ").forEach((function(text, index) { var span = (0, _renderer.default)("<span>").text(text).addClass("dx-scheduler-header-panel-cell-date"); (0, _renderer.default)(element).append(span); if (!index) { (0, _renderer.default)(element).append(" ") } })) }, _appointmentTooltipOffset: { x: 0, y: 11 }, _appointmentTooltipButtonsPosition: "top", _appointmentTooltipOpenButtonText: null, _dropDownButtonIcon: "chevrondown", _appointmentCountPerCell: 1, _collectorOffset: 20, _appointmentOffset: 30 } }]) }; _proto._postponeDataSourceLoading = function(promise) { this.postponedOperations.add("_reloadDataSource", this._reloadDataSource.bind(this), promise) }; _proto._postponeResourceLoading = function() { var _this = this; var whenLoaded = this.postponedOperations.add("loadResources", (function() { var groups = _this._getCurrentViewOption("groups"); return (0, _utils3.loadResources)(groups, _this.option("resources"), _this.option("resourceLoaderMap")) })); var resolveCallbacks = new _deferred.Deferred; whenLoaded.done((function(resources) { _this.option("loadedResources", resources); resolveCallbacks.resolve(resources) })); this._postponeDataSourceLoading(whenLoaded); return resolveCallbacks.promise() }; _proto._optionChanged = function(args) { var _this$_header, _this$_header2, _this$_header4, _this2 = this; var value = args.value; var name = args.name; switch (args.name) { case "customizeDateNavigatorText": this._updateOption("header", name, value); break; case "firstDayOfWeek": this._updateOption("workSpace", name, value); this._updateOption("header", name, value); break; case "currentDate": value = this._dateOption(name); value = _date.default.trimTime(new Date(value)); this.option("selectedCellData", []); this._workSpace.option(name, new Date(value)); null === (_this$_header = this._header) || void 0 === _this$_header ? void 0 : _this$_header.option(name, new Date(value)); null === (_this$_header2 = this._header) || void 0 === _this$_header2 ? void 0 : _this$_header2.option("startViewDate", this.getStartViewDate()); this._appointments.option("items", []); this._filterAppointmentsByDate(); this._postponeDataSourceLoading(); break; case "dataSource": this._initDataSource(); this.appointmentDataProvider.setDataSource(this._dataSource); this._postponeResourceLoading().done((function(resources) { _this2._filterAppointmentsByDate(); _this2._updateOption("workSpace", "showAllDayPanel", _this2.option("showAllDayPanel")) })); break; case "min": case "max": value = this._dateOption(name); this._updateOption("header", name, new Date(value)); this._updateOption("workSpace", name, new Date(value)); break; case "views": this.modelProvider.updateCurrentView(); if (this._getCurrentViewOptions()) { this.repaint() } else { var _this$_header3; null === (_this$_header3 = this._header) || void 0 === _this$_header3 ? void 0 : _this$_header3.option(name, value) } break; case "useDropDownViewSwitcher": null === (_this$_header4 = this._header) || void 0 === _this$_header4 ? void 0 : _this$_header4.option(name, value); break; case "currentView": this.modelProvider.updateCurrentView(); this._validateDayHours(); this._validateCellDuration(); this._appointments.option({ items: [], allowDrag: this._allowDragging(), allowResize: this._allowResizing(), itemTemplate: this._getAppointmentTemplate("appointmentTemplate") }); this._postponeResourceLoading().done((function(resources) { _this2._refreshWorkSpace(resources); _this2._updateHeader(); _this2._filterAppointmentsByDate(); _this2._appointments.option("allowAllDayResize", "day" !== value) })); break; case "appointmentTemplate": this._appointments.option("itemTemplate", value); break; case "dateCellTemplate": case "resourceCellTemplate": case "dataCellTemplate": case "timeCellTemplate": this.repaint(); break; case "groups": this._postponeResourceLoading().done((function(resources) { _this2._refreshWorkSpace(resources); _this2._filterAppointmentsByDate() })); break; case "resources": this._dataAccessors.resources = (0, _utils3.createExpressions)(this.option("resources")); this.agendaResourceProcessor.initializeState(value); this.updateFactoryInstances(); this._postponeResourceLoading().done((function(resources) { _this2._appointments.option("items", []); _this2._refreshWorkSpace(resources); _this2._filterAppointmentsByDate() })); break; case "startDayHour": case "endDayHour": this._validateDayHours(); this.updateFactoryInstances(); this._appointments.option("items", []); this._updateOption("workSpace", name, value); this._appointments.repaint(); this._filterAppointmentsByDate(); this._postponeDataSourceLoading(); break; case StoreEventNames.ADDING: case StoreEventNames.ADDED: case StoreEventNames.UPDATING: case StoreEventNames.UPDATED: case StoreEventNames.DELETING: case StoreEventNames.DELETED: case "onAppointmentFormOpening": this._actions[name] = this._createActionByOption(name); break; case "onAppointmentRendered": this._appointments.option("onItemRendered", this._getAppointmentRenderedAction()); break; case "onAppointmentClick": this._appointments.option("onItemClick", this._createActionByOption(name)); break; case "onAppointmentDblClick": this._appointments.option(name, this._createActionByOption(name)); break; case "onAppointmentContextMenu": this._appointments.option("onItemContextMenu", this._createActionByOption(name)); break; case "noDataText": case "allowMultipleCellSelection": case "selectedCellData": case "accessKey": case "onCellClick": case "onCellContextMenu": this._workSpace.option(name, value); break; case "crossScrollingEnabled": this._postponeResourceLoading().done((function(resources) { _this2._appointments.option("items", []); _this2._refreshWorkSpace(resources); if (_this2._readyToRenderAppointments) { _this2._appointments.option("items", _this2._getAppointmentsToRepaint()) } })); break; case "cellDuration": this._validateCellDuration(); this._appointments.option("items", []); if (this._readyToRenderAppointments) { this._updateOption("workSpace", "hoursInterval", value / 60); this._appointments.option("items", this._getAppointmentsToRepaint()) } break; case "tabIndex": case "focusStateEnabled": this._updateOption("header", name, value); this._updateOption("workSpace", name, value); this._appointments.option(name, value); _Widget.prototype._optionChanged.call(this, args); break; case "width": this._updateOption("header", name, value); if (this.option("crossScrollingEnabled")) { this._updateOption("workSpace", "width", value) } this._updateOption("workSpace", "schedulerWidth", value); _Widget.prototype._optionChanged.call(this, args); this._dimensionChanged(); break; case "height": _Widget.prototype._optionChanged.call(this, args); this._dimensionChanged(); this._updateOption("workSpace", "schedulerHeight", value); break; case "editing": this._initEditing(); var editing = this._editing; this._bringEditingModeToAppointments(editing); this.hideAppointmentTooltip(); this._cleanPopup(); break; case "showAllDayPanel": this.updateFactoryInstances(); this._postponeResourceLoading().done((function(resources) { _this2._filterAppointmentsByDate(); _this2._updateOption("workSpace", "allDayExpanded", value); _this2._updateOption("workSpace", name, value) })); break; case "showCurrentTimeIndicator": case "indicatorTime": case "indicatorUpdateInterval": case "shadeUntilCurrentTime": case "groupByDate": this._updateOption("workSpace", name, value); this.repaint(); break; case "appointmentDragging": case "appointmentTooltipTemplate": case "appointmentPopupTemplate": case "recurrenceEditMode": case "remoteFiltering": case "timeZone": this.updateFactoryInstances(); this.repaint(); break; case "dropDownAppointmentTemplate": case "appointmentCollectorTemplate": case "_appointmentTooltipOffset": case "_appointmentTooltipButtonsPosition": case "_appointmentTooltipOpenButtonText": case "_dropDownButtonIcon": case "_appointmentCountPerCell": case "_collectorOffset": case "_appointmentOffset": this.repaint(); break; case "dateSerializationFormat": case "maxAppointmentsPerCell": break; case "startDateExpr": case "endDateExpr": case "startDateTimeZoneExpr": case "endDateTimeZoneExpr": case "textExpr": case "descriptionExpr": case "allDayExpr": case "recurrenceRuleExpr": case "recurrenceExceptionExpr": case "disabledExpr": this._updateExpression(name, value); this.appointmentDataProvider.updateDataAccessors(this._dataAccessors); this._initAppointmentTemplate(); this.repaint(); break; case "adaptivityEnabled": this._toggleAdaptiveClass(); this.repaint(); break; case "scrolling": this.option("crossScrollingEnabled", this._isHorizontalVirtualScrolling() || this.option("crossScrollingEnabled")); this._updateOption("workSpace", args.fullName, value); break; case "renovateRender": this._updateOption("workSpace", name, value); break; case "_draggingMode": this._workSpace.option("draggingMode", value); break; case "toolbar": this._header ? this._header.option("items", value) : this.repaint(); break; case "loadedResources": case "resourceLoaderMap": break; default: _Widget.prototype._optionChanged.call(this, args) } }; _proto._updateHeader = function() { var _this$_header5; null === (_this$_header5 = this._header) || void 0 === _this$_header5 ? void 0 : _this$_header5.option({ intervalCount: this._getViewCountConfig().intervalCount, startViewDate: this.getStartViewDate(), min: this._dateOption("min"), max: this._dateOption("max"), currentDate: this._dateOption("currentDate"), firstDayOfWeek: this.getFirstDayOfWeek(), currentView: this.modelProvider.currentView }) }; _proto._dateOption = function(optionName) { var optionValue = this._getCurrentViewOption(optionName); return _date_serialization.default.deserializeDate(optionValue) }; _proto._getSerializationFormat = function(optionName) { var value = this._getCurrentViewOption(optionName); if ("number" === typeof value) { return "number" } if (!(0, _type.isString)(value)) { return } return _date_serialization.default.getDateSerializationFormat(value) }; _proto._bringEditingModeToAppointments = function(editing) { var editingConfig = { allowDelete: editing.allowUpdating && editing.allowDeleting }; if (!this._isAgenda()) { editingConfig.allowDrag = editing.allowDragging; editingConfig.allowResize = editing.allowResizing; editingConfig.allowAllDayResize = editing.allowResizing && this._supportAllDayResizing() } this._appointments.option(editingConfig); this.repaint() }; _proto._isAgenda = function() { return "agenda" === this.getLayoutManager().appointmentRenderingStrategyName }; _proto._allowDragging = function() { return this._editing.allowDragging && !this._isAgenda() }; _proto._allowResizing = function() { return this._editing.allowResizing && !this._isAgenda() }; _proto._allowAllDayResizing = function() { return this._editing.allowResizing && this._supportAllDayResizing() }; _proto._supportAllDayResizing = function() { return this.modelProvider.supportAllDayResizing() }; _proto._isAllDayExpanded = function(items) { return this.option("showAllDayPanel") && this.appointmentDataProvider.hasAllDayAppointments(items) }; _proto._getTimezoneOffsetByOption = function(date) { return _utils.default.calculateTimezoneByValue(this.option("timeZone"), date) }; _proto._filterAppointmentsByDate = function() { var dateRange = this._workSpace.getDateRange(); var timeZoneCalculator = (0, _instanceFactory.getTimeZoneCalculator)(this.key); var startDate = timeZoneCalculator.createDate(dateRange[0], { path: "fromGrid" }); var endDate = timeZoneCalculator.createDate(dateRange[1], { path: "fromGrid" }); this.appointmentDataProvider.filterByDate(startDate, endDate, this.option("remoteFiltering"), this.option("dateSerializationFormat")) }; _proto._reloadDataSource = function() { var result = new _deferred.Deferred; if (this._dataSource) { this._dataSource.load().done(function() { (0, _loading.hide)(); this._fireContentReadyAction(result) }.bind(this)).fail((function() { (0, _loading.hide)(); result.reject() })); this._dataSource.isLoading() && (0, _loading.show)({ container: this.$element(), position: { of: this.$element() } }) } else { this._fireContentReadyAction(result) } return result.promise() }; _proto._fireContentReadyAction = function(result) { var contentReadyBase = _Widget.prototype._fireContentReadyAction.bind(this); var fireContentReady = function() { contentReadyBase(); null === result || void 0 === result ? void 0 : result.resolve() }; if (this._workSpaceRecalculation) { var _this$_workSpaceRecal; null === (_this$_workSpaceRecal = this._workSpaceRecalculation) || void 0 === _this$_workSpaceRecal ? void 0 : _this$_workSpaceRecal.done((function() { fireContentReady() })) } else { fireContentReady() } }; _proto._dimensionChanged = function() { this._toggleSmallClass(); if (!this._isAgenda() && this.filteredItems && this._isVisible()) { this._workSpace.option("allDayExpanded", this._isAllDayExpanded(this.filteredItems)); this._workSpace._dimensionChanged(); var appointments = this.getLayoutManager().createAppointmentsMap(this.filteredItems); this._appointments.option("items", appointments) } this.hideAppointmentTooltip(); this._appointmentPopup.triggerResize(); this._appointmentPopup.updatePopupFullScreenMode() }; _proto._clean = function() { this._cleanPopup(); _Widget.prototype._clean.call(this) }; _proto._toggleSmallClass = function() { var width = (0, _position.getBoundingRect)(this.$element().get(0)).width; this.$element().toggleClass(WIDGET_SMALL_CLASS, width < WIDGET_SMALL_WIDTH) }; _proto._toggleAdaptiveClass = function() { this.$element().toggleClass(WIDGET_ADAPTIVE_CLASS, this.option("adaptivityEnabled")) }; _proto._visibilityChanged = function(visible) { visible && this._dimensionChanged() }; _proto._dataSourceOptions = function() { return { paginate: false } }; _proto._init = function() { this._initExpressions({ startDate: this.option("startDateExpr"), endDate: this.option("endDateExpr"), startDateTimeZone: this.option("startDateTimeZoneExpr"), endDateTimeZone: this.option("endDateTimeZoneExpr"), allDay: this.option("allDayExpr"), text: this.option("textExpr"), description: this.option("descriptionExpr"), recurrenceRule: this.option("recurrenceRuleExpr"), recurrenceException: this.option("recurrenceExceptionExpr"), disabled: this.option("disabledExpr") }); _Widget.prototype._init.call(this); this._initDataSource(); this.$element().addClass(WIDGET_CLASS); this._initEditing(); this.updateFactoryInstances(); this._initActions(); this._compactAppointmentsHelper = new _compactAppointmentsHelper.CompactAppointmentsHelper(this); this._asyncTemplatesTimers = []; this._dataSourceLoadedCallback = (0, _callbacks.default)(); this._subscribes = _subscribes.default; this.agendaResourceProcessor = new _agendaResourceProcessor.AgendaResourceProcessor(this.option("resources")) }; _proto.createAppointmentDataProvider = function() { var _this3 = this; this.appointmentDataProvider = new _appointmentDataProvider.AppointmentDataProvider({ dataSource: this._dataSource, dataAccessors: this._dataAccessors, timeZoneCalculator: (0, _instanceFactory.getTimeZoneCalculator)(this.key), dateSerializationFormat: this.option("dateSerializationFormat"), resources: this.option("resources"), startDayHour: this._getCurrentViewOption("startDayHour"), endDayHour: this._getCurrentViewOption("endDayHour"), appointmentDuration: this._getCurrentViewOption("cellDuration"), showAllDayPanel: this.option("showAllDayPanel"), getLoadedResources: function() { return _this3.option("loadedResources") }, getIsVirtualScrolling: function() { return _this3.isVirtualScrolling() }, getSupportAllDayRow: function() { return _this3._workSpace.supportAllDayRow() }, getViewType: function() { return _this3._workSpace.type }, getViewDirection: function() { return _this3._workSpace.viewDirection }, getDateRange: function() { return _this3._workSpace.getDateRange() }, getGroupCount: function() { return _this3._workSpace._getGroupCount() }, getViewDataProvider: function() { return _this3._workSpace.viewDataProvider } }) }; _proto.updateFactoryInstances = function() { var model = this._options._optionManager._options; if (!(0, _type.isDefined)(this.key)) { this.key = (0, _instanceFactory.generateKey)(); (0, _instanceFactory.createModelProvider)(this.key, model) } if (this.getWorkSpace()) { this.createAppointmentDataProvider() }(0, _instanceFactory.createFactoryInstances)({ key: this.key, model: model, timeZone: this.option("timeZone") }) }; _proto._initTemplates = function() { this._initAppointmentTemplate(); this._templateManager.addDefaultTemplates({ appointmentTooltip: new _empty_template.EmptyTemplate, dropDownAppointment: new _empty_template.EmptyTemplate }); _Widget.prototype._initTemplates.call(this) }; _proto._initAppointmentTemplate = function() { var _this4 = this; var expr = this._dataAccessors.expr; var createGetter = function(property) { return (0, _data.compileGetter)("appointmentData.".concat(property)) }; var getDate = function(getter) { return function(data) { var value = getter(data); if (value instanceof Date) { return value.valueOf() } return value } }; this._templateManager.addDefaultTemplates(_defineProperty({}, "item", new _bindable_template.BindableTemplate((function($container, data, model) { return _this4.getAppointmentsInstance()._renderAppointmentTemplate($container, data, model) }), ["html", "text", "startDate", "endDate", "allDay", "description", "recurrenceRule", "recurrenceException", "startDateTimeZone", "endDateTimeZone"], this.option("integrationOptions.watchMethod"), { text: createGetter(expr.textExpr), startDate: getDate(createGetter(expr.startDateExpr)), endDate: getDate(createGetter(expr.endDateExpr)), startDateTimeZone: createGetter(expr.startDateTimeZoneExpr), endDateTimeZone: createGetter(expr.endDateTimeZoneExpr), allDay: createGetter(expr.allDayExpr), recurrenceRule: createGetter(expr.recurrenceRuleExpr) }))) }; _proto._renderContent = function() { this._renderContentImpl() }; _proto._dataSourceChangedHandler = function(result) { if (this._readyToRenderAppointments) { this._workSpaceRecalculation.done(function() { this._renderAppointments(); this.getWorkSpace().onDataSourceChanged(this.filteredItems) }.bind(this)) } }; _proto.isVirtualScrolling = function() { var _currentViewOptions$s; var workspace = this.getWorkSpace(); if (workspace) { return workspace.isVirtualScrolling() } var currentViewOptions = this._getCurrentViewOptions(); var scrolling = this.option("scrolling"); return "virtual" === (null === scrolling || void 0 === scrolling ? void 0 : scrolling.mode) || "virtual" === (null === currentViewOptions || void 0 === currentViewOptions ? void 0 : null === (_currentViewOptions$s = currentViewOptions.scrolling) || void 0 === _currentViewOptions$s ? void 0 : _currentViewOptions$s.mode) }; _proto._filterAppointments = function() { this.filteredItems = this.appointmentDataProvider.filter() }; _proto._renderAppointments = function() { var workspace = this.getWorkSpace(); this._filterAppointments(); workspace.option("allDayExpanded", this._isAllDayExpanded(this.filteredItems)); var viewModel = []; if (this._isVisible()) { viewModel = this._getAppointmentsToRepaint() } if (this.modelProvider.isRenovatedAppointments) { (0, _render2.renderAppointments)({ instance: this, $dateTable: this.getWorkSpace()._getDateTable(), viewModel: viewModel }) } else { this._appointments.option("items", viewModel) } this.appointmentDataProvider.cleanState() }; _proto._getAppointmentsToRepaint = function() { var layoutManager = this.getLayoutManager(); var appointmentsMap = layoutManager.createAppointmentsMap(this.filteredItems); if (this.modelProvider.isRenovatedAppointments) { var appointmentTemplate = this.option("appointmentTemplate") !== DEFAULT_APPOINTMENT_TEMPLATE_NAME ? this.option("appointmentTemplate") : void 0; return { appointments: appointmentsMap, appointmentTemplate: appointmentTemplate } } return layoutManager.getRepaintedAppointments(appointmentsMap, this.getAppointmentsInstance().option("items")) }; _proto._initExpressions = function(fields) { this._dataAccessors = _utils2.utils.dataAccessors.create(fields, this._dataAccessors, (0, _config.default)().forceIsoDateParsing, this.option("dateSerializationFormat")); this._dataAccessors.resources = (0, _utils3.createExpressions)(this.option("resources")) }; _proto._updateExpression = function(name, value) { var exprObj = {}; exprObj[name.replace("Expr", "")] = value; this._initExpressions(exprObj) }; _proto.getResourceDataAccessors = function() { return this._dataAccessors.resources }; _proto._initEditing = function() { var editing = this.option("editing"); this._editing = { allowAdding: !!editing, allowUpdating: !!editing, allowDeleting: !!editing, allowResizing: !!editing, allowDragging: !!editing }; if ((0, _type.isObject)(editing)) { this._editing = (0, _extend.extend)(this._editing, editing) } this._editing.allowDragging = this._editing.allowDragging && this._editing.allowUpdating; this._editing.allowResizing = this._editing.allowResizing && this._editing.allowUpdating; this.$element().toggleClass(WIDGET_READONLY_CLASS, this._isReadOnly()) }; _proto._isReadOnly = function() { var result = true; var editing = this._editing; for (var prop in editing) { if (Object.prototype.hasOwnProperty.call(editing, prop)) { result = result && !editing[prop] } } return result }; _proto._dispose = function() { var _this$_recurrenceDial; this._appointmentTooltip && this._appointmentTooltip.dispose(); null === (_this$_recurrenceDial = this._recurrenceDialog) || void 0 === _this$_recurrenceDial ? void 0 : _this$_recurrenceDial.hide(RECURRENCE_EDITING_MODE.CANCEL); this.hideAppointmentPopup(); this.hideAppointmentTooltip(); this._asyncTemplatesTimers.forEach(clearTimeout); this._asyncTemplatesTimers = []; _Widget.prototype._dispose.call(this); (0, _instanceFactory.disposeFactoryInstances)(this.key) }; _proto._initActions = function() { this._actions = { onAppointmentAdding: this._createActionByOption(StoreEventNames.ADDING), onAppointmentAdded: this._createActionByOption(StoreEventNames.ADDED), onAppointmentUpdating: this._createActionByOption(StoreEventNames.UPDATING), onAppointmentUpdated: this._createActionByOption(StoreEventNames.UPDATED), onAppointmentDeleting: this._createActionByOption(StoreEventNames.DELETING), onAppointmentDeleted: this._createActionByOption(StoreEventNames.DELETED), onAppointmentFormOpening: this._createActionByOption("onAppointmentFormOpening") } }; _proto._getAppointmentRenderedAction = function() { return this._createActionByOption("onAppointmentRendered", { excludeValidators: ["disabled", "readOnly"] }) }; _proto._renderFocusTarget = function() { return (0, _common.noop)() }; _proto._initMarkup = function() { var _this5 = this; _Widget.prototype._initMarkup.call(this); this._validateDayHours(); this._validateCellDuration(); this.modelProvider.updateCurrentView(); this._renderMainContainer(); this._renderHeader(); this._layoutManager = new _appointments.default(this); this._appointments = this._createComponent("<div>", _appointmentCollection.default, this._appointmentsConfig()); this._appointments.option("itemTemplate", this._getAppointmentTemplate("appointmentTemplate")); this._appointmentTooltip = new(this.option("adaptivityEnabled") ? _mobileTooltipStrategy.MobileTooltipStrategy : _desktopTooltipStrategy.DesktopTooltipStrategy)(this._getAppointmentTooltipOptions()); this._appointmentForm = this.createAppointmentForm(); this._appointmentPopup = this.createAppointmentPopup(this._appointmentForm); if (this._isDataSourceLoaded() || this._isDataSourceLoading()) { this._initMarkupCore(this.option("loadedResources")); this._dataSourceChangedHandler(this._dataSource.items()); this._fireContentReadyAction() } else { var groups = this._getCurrentViewOption("groups"); (0, _utils3.loadResources)(groups, this.option("resources"), this.option("resourceLoaderMap")).done((function(resources) { _this5.option("loadedResources", resources); _this5._initMarkupCore(resources); _this5._reloadDataSource() })) } }; _proto._renderMainContainer = function() { this._mainContainer = (0, _renderer.default)("<div>").addClass("dx-scheduler-container"); this.$element().append(this._mainContainer) }; _proto.createAppointmentForm = function() { var _this6 = this; var scheduler = { createResourceEditorModel: function() { return (0, _utils3.createResourceEditorModel)(_this6.option("resources"), _this6.option("loadedResources")) }, getDataAccessors: function() { return _this6._dataAccessors }, createComponent: function(element, component, options) { return _this6._createComponent(element, component, options) }, getEditingConfig: function() { return _this6._editing }, getFirstDayOfWeek: function() { return _this6.option("firstDayOfWeek") }, getStartDayHour: function() { return _this6.option("startDayHour") }, getCalculatedEndDate: function(startDateWithStartHour) { return _this6._workSpace.calculateEndDate(startDateWithStartHour) } }; return new _form.AppointmentForm(scheduler) }; _proto.createAppointmentPopup = function(form) { var _this7 = this; var scheduler = { getKey: function() { return _this7.key }, getElement: function() { return _this7.$element() }, createComponent: function(element, component, options) { return _this7._createComponent(element, component, options) }, focus: function() { return _this7.focus() }, getResourcesFromItem: function(rawAppointment) { return (0, _utils3.getResourcesFromItem)(_this7.option("resources"), _this7.getResourceDataAccessors(), rawAppointment, true) }, getEditingConfig: function() { return _this7._editing }, getTimeZoneCalculator: function() { return (0, _instanceFactory.getTimeZoneCalculator)(_this7.key) }, getDataAccessors: function() { return _this7._dataAccessors }, getAppointmentFormOpening: function() { return _this7._actions.onAppointmentFormOpening }, processActionResult: function(arg, canceled) { return _this7._processActionResult(arg, canceled) }, addAppointment: function(appointment) { return _this7.addAppointment(appointment) }, updateAppointment: function(sourceAppointment, updatedAppointment) { return _this7.updateAppointment(sourceAppointment, updatedAppointment) }, updateScrollPosition: function(startDate, resourceItem, inAllDayRow) { _this7._workSpace.updateScrollPosition(startDate, resourceItem, inAllDayRow) } }; return new _popup.AppointmentPopup(scheduler, form) }; _proto._getAppointmentTooltipOptions = function() {