| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- /**
- * DevExtreme (ui/scheduler/rendering_strategies/ui.scheduler.appointmentsPositioning.strategy.base.js)
- * Version: 19.1.16
- * Build date: Tue Oct 18 2022
- *
- * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
- * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
- */
- "use strict";
- var _type = require("../../../core/utils/type");
- var _type2 = _interopRequireDefault(_type);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- }
- }
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function")
- }
- }
- 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)
- }
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor
- }
- var COLLECTOR_DEFAULT_WIDTH = 24;
- var COMPACT_APPOINTMENT_DEFAULT_OFFSET = 3;
- var COMPACT_THEME_APPOINTMENT_DEFAULT_OFFSET = 22;
- var APPOINTMENT_MIN_COUNT = 1;
- var APPOINTMENT_DEFAULT_WIDTH = 40;
- var COLLECTOR_WIDTH_IN_PERCENTS = 75;
- var APPOINTMENT_INCREASED_WIDTH = 50;
- var AppointmentPositioningStrategy = function() {
- function AppointmentPositioningStrategy(renderingStrategy) {
- _classCallCheck(this, AppointmentPositioningStrategy);
- this._renderingStrategy = renderingStrategy
- }
- _createClass(AppointmentPositioningStrategy, [{
- key: "getRenderingStrategy",
- value: function() {
- return this._renderingStrategy
- }
- }, {
- key: "getDropDownAppointmentWidth",
- value: function(intervalCount, isAllDay) {
- if (isAllDay || !_type2.default.isDefined(isAllDay)) {
- return COLLECTOR_WIDTH_IN_PERCENTS * this.getRenderingStrategy().getDefaultCellWidth() / 100
- } else {
- return COLLECTOR_DEFAULT_WIDTH
- }
- }
- }, {
- key: "getCompactAppointmentTopOffset",
- value: function() {
- return COMPACT_APPOINTMENT_DEFAULT_OFFSET
- }
- }, {
- key: "getCompactAppointmentLeftOffset",
- value: function() {
- return COMPACT_APPOINTMENT_DEFAULT_OFFSET
- }
- }, {
- key: "getAppointmentDefaultOffset",
- value: function() {
- if (this.getRenderingStrategy()._isCompactTheme()) {
- return COMPACT_THEME_APPOINTMENT_DEFAULT_OFFSET
- }
- return this.getRenderingStrategy().instance.option("_appointmentOffset")
- }
- }, {
- key: "getDynamicAppointmentCountPerCell",
- value: function() {
- var renderingStrategy = this.getRenderingStrategy();
- var cellHeight = renderingStrategy.instance.fire("getCellHeight");
- var allDayCount = Math.floor((cellHeight - renderingStrategy._getAppointmentDefaultOffset()) / renderingStrategy._getAppointmentDefaultHeight()) || this._getAppointmentMinCount();
- if (renderingStrategy.hasAllDayAppointments()) {
- return {
- allDay: "vertical" === renderingStrategy.instance._groupOrientation ? allDayCount : renderingStrategy.instance.option("_appointmentCountPerCell"),
- simple: this._calculateDynamicAppointmentCountPerCell() || this._getAppointmentMinCount()
- }
- } else {
- return allDayCount
- }
- }
- }, {
- key: "getDropDownAppointmentHeight",
- value: function() {
- return
- }
- }, {
- key: "_getAppointmentMinCount",
- value: function() {
- return APPOINTMENT_MIN_COUNT
- }
- }, {
- key: "_calculateDynamicAppointmentCountPerCell",
- value: function() {
- return Math.floor(this.getRenderingStrategy()._getAppointmentMaxWidth() / APPOINTMENT_INCREASED_WIDTH)
- }
- }, {
- key: "_getAppointmentDefaultWidth",
- value: function() {
- return APPOINTMENT_DEFAULT_WIDTH
- }
- }]);
- return AppointmentPositioningStrategy
- }();
- module.exports = AppointmentPositioningStrategy;
|