UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

69 lines (67 loc) 2.87 kB
/** * DevExtreme (cjs/renovation/ui/scheduler/workspaces/base/utils.js) * Version: 21.2.3 * Build date: Thu Oct 28 2021 * * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; exports.getTotalRowCount = exports.getTotalCellCount = exports.getRowCountWithAllDayRow = exports.getHiddenInterval = exports.getDateForHeaderText = exports.createCellElementMetaData = void 0; var _date = _interopRequireDefault(require("../../../../../core/utils/date")); var _utils = require("../../../../../ui/scheduler/resources/utils"); var _utils2 = require("../utils"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } var DAY_MS = _date.default.dateToMilliseconds("day"); var HOUR_MS = _date.default.dateToMilliseconds("hour"); var getTotalRowCount = function(rowCount, groupOrientation, groups, isAllDayPanelVisible) { var isVerticalGrouping = (0, _utils2.isVerticalGroupingApplied)(groups, groupOrientation); var groupCount = (0, _utils.getGroupCount)(groups); var totalRowCount = isVerticalGrouping ? rowCount * groupCount : rowCount; return isAllDayPanelVisible ? totalRowCount + groupCount : totalRowCount }; exports.getTotalRowCount = getTotalRowCount; var getTotalCellCount = function(cellCount, groupOrientation, groups) { var isHorizontalGrouping = (0, _utils2.isHorizontalGroupingApplied)(groups, groupOrientation); var groupCount = (0, _utils.getGroupCount)(groups); return isHorizontalGrouping ? cellCount * groupCount : cellCount }; exports.getTotalCellCount = getTotalCellCount; var getRowCountWithAllDayRow = function(rowCount, isAllDayPanelVisible) { return isAllDayPanelVisible ? rowCount + 1 : rowCount }; exports.getRowCountWithAllDayRow = getRowCountWithAllDayRow; var getHiddenInterval = function(hoursInterval, cellCountInDay) { var visibleInterval = hoursInterval * cellCountInDay * HOUR_MS; return DAY_MS - visibleInterval }; exports.getHiddenInterval = getHiddenInterval; var createCellElementMetaData = function(tableRect, cellRect) { var bottom = cellRect.bottom, height = cellRect.height, left = cellRect.left, right = cellRect.right, top = cellRect.top, width = cellRect.width, x = cellRect.x, y = cellRect.y; return { right: right, bottom: bottom, left: left - tableRect.left, top: top - tableRect.top, width: width, height: height, x: x, y: y } }; exports.createCellElementMetaData = createCellElementMetaData; var getDateForHeaderText = function(_, date) { return date }; exports.getDateForHeaderText = getDateForHeaderText;