UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

78 lines (76 loc) 3.16 kB
/** * DevExtreme (cjs/__internal/scheduler/shaders/current_time_shader_horizontal.js) * Version: 26.1.3 * Build date: Wed Jun 10 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 _position = require("../../../core/utils/position"); 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 } } class HorizontalCurrentTimeShader extends _current_time_shader.default { renderShader(isHorizontalGroupedWorkSpace, groupCount, cellCount) { const effectiveGroupCount = isHorizontalGroupedWorkSpace ? groupCount : 1; for (let i = 0; i < effectiveGroupCount; i += 1) { const isFirstShader = 0 === i; const $shader = isFirstShader ? this.$shader : this.createShader(); if (this.workSpace.isGroupedByDate()) { this.customizeGroupedByDateShader($shader, i, groupCount, cellCount) } else { this.customizeShader($shader, i, cellCount) } if (!isFirstShader) { this.shader.push($shader) } } } customizeShader($shader, groupIndex, dateTableCellCount) { const shaderWidth = this.workSpace.getIndicationWidth(); this.applyShaderWidth($shader, shaderWidth); if (groupIndex >= 1) { const { workSpace: workSpace } = this; const indicationWidth = dateTableCellCount * workSpace.getCellWidth(); $shader.css("left", indicationWidth) } else { $shader.css("left", 0) } } applyShaderWidth($shader, width) { const maxWidth = (0, _position.getBoundingRect)(this.$container.get(0)).width; if (width > 0) { (0, _size.setWidth)($shader, Math.min(width, maxWidth)) } } customizeGroupedByDateShader($shader, groupIndex, shaderGroupCount, dateTableCellCount) { const indicationCellCount = this.workSpace.getIndicationCellCount(); const integerPart = Math.floor(indicationCellCount); const fractionPart = indicationCellCount - integerPart; const isFirstShaderPart = 0 === groupIndex; const { workSpace: workSpace } = this; const shaderWidth = isFirstShaderPart ? workSpace.getIndicationWidth() : fractionPart * workSpace.getCellWidth(); let shaderLeft = 0; this.applyShaderWidth($shader, shaderWidth); if (isFirstShaderPart) { shaderLeft = dateTableCellCount * workSpace.getCellWidth() * groupIndex } else { shaderLeft = workSpace.getCellWidth() * integerPart * shaderGroupCount + groupIndex * workSpace.getCellWidth() } $shader.css("left", shaderLeft) } } var _default = exports.default = HorizontalCurrentTimeShader;