UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

72 lines (71 loc) 2.61 kB
/** * DevExtreme (cjs/__internal/scheduler/appointments/rendering_strategies/m_appointments_positioning_strategy_base.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _type = require("../../../../core/utils/type"); const COLLECTOR_DEFAULT_WIDTH = 24; const COLLECTOR_DEFAULT_OFFSET = 3; const COMPACT_THEME_APPOINTMENT_DEFAULT_OFFSET = 22; const APPOINTMENT_MIN_COUNT = 1; const APPOINTMENT_DEFAULT_WIDTH = 40; const COLLECTOR_WIDTH_IN_PERCENTS = 75; const APPOINTMENT_INCREASED_WIDTH = 50; class AppointmentPositioningStrategy { constructor(renderingStrategy) { this._renderingStrategy = renderingStrategy } getDropDownAppointmentWidth(intervalCount, isAllDay) { if (isAllDay || !(0, _type.isDefined)(isAllDay)) { return 75 * this._renderingStrategy.cellWidth / 100 } return 24 } getCollectorTopOffset(allDay) { return 3 } getCollectorLeftOffset() { return 3 } getAppointmentDefaultOffset() { if (this._renderingStrategy._isCompactTheme()) { return 22 } return this._renderingStrategy.appointmentOffset } getDynamicAppointmentCountPerCell() { const renderingStrategy = this._renderingStrategy; const { cellHeight: cellHeight } = renderingStrategy; const allDayCount = Math.floor((cellHeight - renderingStrategy._getAppointmentDefaultOffset()) / renderingStrategy._getAppointmentDefaultHeight()) || this._getAppointmentMinCount(); if (renderingStrategy.allDaySupported()) { return { allDay: "vertical" === renderingStrategy.groupOrientation ? allDayCount : this._renderingStrategy.appointmentCountPerCell, simple: this._calculateDynamicAppointmentCountPerCell() || this._getAppointmentMinCount() } } return allDayCount } getDropDownAppointmentHeight() { return } _getAppointmentMinCount() { return 1 } _calculateDynamicAppointmentCountPerCell() { return Math.floor(this._renderingStrategy._getAppointmentMaxWidth() / 50) } _getAppointmentDefaultWidth() { return 40 } } var _default = exports.default = AppointmentPositioningStrategy;