devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
96 lines (91 loc) • 3.73 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/appointments/rendering_strategies/m_appointments_positioning_strategy_adaptive.js)
* Version: 23.2.6
* Build date: Wed May 01 2024
*
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _m_appointments_positioning_strategy_base = _interopRequireDefault(require("./m_appointments_positioning_strategy_base"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
}
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass)
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, p) {
o.__proto__ = p;
return o
};
return _setPrototypeOf(o, p)
}
const COLLECTOR_ADAPTIVE_SIZE = 28;
const COLLECTOR_ADAPTIVE_BOTTOM_OFFSET = 40;
const ADAPTIVE_APPOINTMENT_DEFAULT_OFFSET = 35;
const ADAPTIVE_APPOINTMENT_DEFAULT_WIDTH = 30;
let AdaptivePositioningStrategy = function(_AppointmentPositioni) {
_inheritsLoose(AdaptivePositioningStrategy, _AppointmentPositioni);
function AdaptivePositioningStrategy() {
return _AppointmentPositioni.apply(this, arguments) || this
}
var _proto = AdaptivePositioningStrategy.prototype;
_proto.getDropDownAppointmentWidth = function(intervalCount, isAllDay) {
return this.getDropDownButtonAdaptiveSize()
};
_proto.getDropDownButtonAdaptiveSize = function() {
return 28
};
_proto.getCollectorTopOffset = function(allDay) {
const renderingStrategy = this._renderingStrategy;
if (renderingStrategy.allDaySupported() && allDay) {
return (renderingStrategy.allDayHeight - renderingStrategy.getDropDownButtonAdaptiveSize()) / 2
}
return this._renderingStrategy.cellHeight - 40
};
_proto.getCollectorLeftOffset = function() {
const collectorWidth = this._renderingStrategy.getDropDownAppointmentWidth();
return (this._renderingStrategy.cellWidth - collectorWidth) / 2
};
_proto.getAppointmentDefaultOffset = function() {
return 35
};
_proto.getDynamicAppointmentCountPerCell = function() {
const renderingStrategy = this._renderingStrategy;
if (renderingStrategy.allDaySupported()) {
return {
allDay: 0,
simple: this._calculateDynamicAppointmentCountPerCell() || this._getAppointmentMinCount()
}
}
return 0
};
_proto.getDropDownAppointmentHeight = function() {
return 28
};
_proto._getAppointmentMinCount = function() {
return 0
};
_proto._getAppointmentDefaultWidth = function() {
const renderingStrategy = this._renderingStrategy;
if (renderingStrategy.allDaySupported()) {
return 30
}
return _AppointmentPositioni.prototype._getAppointmentDefaultWidth.call(this)
};
_proto._calculateDynamicAppointmentCountPerCell = function() {
return Math.floor(this._renderingStrategy._getAppointmentMaxWidth() / this._renderingStrategy._getAppointmentDefaultWidth())
};
return AdaptivePositioningStrategy
}(_m_appointments_positioning_strategy_base.default);
var _default = AdaptivePositioningStrategy;
exports.default = _default;