devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
115 lines (113 loc) • 5.45 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/shaders/current_time_shader_vertical.js)
* Version: 25.2.7
* Build date: Tue May 05 2026
*
* Copyright (c) 2012 - 2026 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 _renderer = _interopRequireDefault(require("../../../core/renderer"));
var _size = require("../../../core/utils/size");
var _current_time_shader = _interopRequireDefault(require("./current_time_shader"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
const DATE_TIME_SHADER_ALL_DAY_CLASS = "dx-scheduler-date-time-shader-all-day";
const DATE_TIME_SHADER_TOP_CLASS = "dx-scheduler-date-time-shader-top";
const DATE_TIME_SHADER_BOTTOM_CLASS = "dx-scheduler-date-time-shader-bottom";
class VerticalCurrentTimeShader extends _current_time_shader.default {
renderShader() {
let shaderHeight = this.getShaderHeight();
const maxHeight = this.getShaderMaxHeight();
const isSolidShader = shaderHeight > maxHeight;
if (shaderHeight > maxHeight) {
shaderHeight = maxHeight
}(0, _size.setHeight)(this.$shader, shaderHeight);
const groupCount = this.workSpace._getGroupCount() || 1;
if (this.workSpace.isGroupedByDate()) {
this.renderGroupedByDateShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader)
} else {
this.renderShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader)
}
}
renderShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader) {
for (let i = 0; i < groupCount; i += 1) {
const shaderWidth = this.getShaderWidth();
this.renderTopShader(this.$shader, shaderHeight, shaderWidth, i);
if (!isSolidShader) {
this.renderBottomShader(this.$shader, maxHeight, shaderHeight, shaderWidth, i)
}
this.renderAllDayShader(shaderWidth, i)
}
}
renderGroupedByDateShaderParts(groupCount, shaderHeight, maxHeight, isSolidShader) {
const shaderWidth = this.getShaderWidth();
const bottomShaderWidth = shaderHeight < 0 ? shaderWidth : shaderWidth - this.workSpace.getCellWidth();
const normalizedShaderHeight = Math.max(shaderHeight, 0);
this.renderTopShader(this.$shader, normalizedShaderHeight, shaderWidth * groupCount, 0);
if (!isSolidShader) {
this.renderBottomShader(this.$shader, maxHeight, normalizedShaderHeight, bottomShaderWidth * groupCount + this.workSpace.getCellWidth(), 0)
}
this.renderAllDayShader(shaderWidth * groupCount, 0)
}
renderTopShader($shader, height, width, i) {
this.$topShader = (0, _renderer.default)("<div>").addClass(DATE_TIME_SHADER_TOP_CLASS);
if (width) {
(0, _size.setWidth)(this.$topShader, width)
}
if (height) {
(0, _size.setHeight)(this.$topShader, height)
}
this.$topShader.css("marginTop", this.getShaderTopOffset(i));
this.$topShader.css("left", this.getShaderOffset(i, width));
$shader.append(this.$topShader)
}
renderBottomShader($shader, maxHeight, height, width, i) {
this.$bottomShader = (0, _renderer.default)("<div>").addClass(DATE_TIME_SHADER_BOTTOM_CLASS);
const shaderWidth = height < 0 ? width : width - this.workSpace.getCellWidth();
const shaderHeight = height < 0 ? maxHeight : maxHeight - height;
(0, _size.setWidth)(this.$bottomShader, shaderWidth);
(0, _size.setHeight)(this.$bottomShader, shaderHeight);
this.$bottomShader.css("left", this.getShaderOffset(i, width - this.workSpace.getCellWidth()));
$shader.append(this.$bottomShader)
}
renderAllDayShader(shaderWidth, i) {
if (this.workSpace.option("showAllDayPanel")) {
this.$allDayIndicator = (0, _renderer.default)("<div>").addClass(DATE_TIME_SHADER_ALL_DAY_CLASS);
(0, _size.setHeight)(this.$allDayIndicator, this.workSpace.getAllDayHeight());
(0, _size.setWidth)(this.$allDayIndicator, shaderWidth);
this.$allDayIndicator.css("left", this.getShaderOffset(i, shaderWidth));
this.workSpace._$allDayPanel.prepend(this.$allDayIndicator)
}
}
getShaderOffset(i, width) {
return this.workSpace.getGroupedStrategy().getShaderOffset(i, width)
}
getShaderTopOffset(i) {
return this.workSpace.getGroupedStrategy().getShaderTopOffset(i)
}
getShaderHeight() {
return this.workSpace.getGroupedStrategy().getShaderHeight()
}
getShaderMaxHeight() {
return this.workSpace.getGroupedStrategy().getShaderMaxHeight()
}
getShaderWidth() {
return this.workSpace.getGroupedStrategy().getShaderWidth()
}
clean() {
var _this$workSpace;
super.clean();
if (null !== (_this$workSpace = this.workSpace) && void 0 !== _this$workSpace && _this$workSpace._$allDayPanel) {
this.workSpace._$allDayPanel.find(`.${DATE_TIME_SHADER_ALL_DAY_CLASS}`).remove()
}
}
}
var _default = exports.default = VerticalCurrentTimeShader;