| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- /**
- * DevExtreme (ui/scheduler/workspaces/ui.scheduler.timeline_month.js)
- * Version: 19.1.16
- * Build date: Tue Oct 18 2022
- *
- * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
- * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
- */
- "use strict";
- var registerComponent = require("../../../core/component_registrator");
- var SchedulerTimeline = require("./ui.scheduler.timeline");
- var dateUtils = require("../../../core/utils/date");
- var TIMELINE_CLASS = "dx-scheduler-timeline-month";
- var DAY_IN_MILLISECONDS = 864e5;
- var toMs = dateUtils.dateToMilliseconds;
- var SchedulerTimelineMonth = SchedulerTimeline.inherit({
- _renderView: function() {
- this.callBase();
- this._updateScrollable()
- },
- _getElementClass: function() {
- return TIMELINE_CLASS
- },
- _getDateHeaderTemplate: function() {
- return this.option("dateCellTemplate")
- },
- _getHiddenInterval: function() {
- return 0
- },
- _getIndicationFirstViewDate: function() {
- return dateUtils.trimTime(new Date(this._firstViewDate))
- },
- getCellDuration: function() {
- return toMs("day")
- },
- calculateEndViewDate: function(dateOfLastViewCell) {
- return new Date(dateOfLastViewCell.getTime() + this._calculateDayDuration() * toMs("hour"))
- },
- _getCellCount: function() {
- var currentDate = this.option("currentDate");
- var cellCount = 0;
- if (this._isWorkSpaceWithCount()) {
- var intervalCount = this.option("intervalCount");
- for (var i = 1; i <= intervalCount; i++) {
- cellCount += new Date(currentDate.getFullYear(), currentDate.getMonth() + i, 0).getDate()
- }
- } else {
- cellCount = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).getDate()
- }
- return cellCount
- },
- _setFirstViewDate: function() {
- this._firstViewDate = dateUtils.getFirstMonthDate(this.option("currentDate"));
- this._setStartDayHour(this._firstViewDate)
- },
- _getFormat: function() {
- return this._formatWeekdayAndDay
- },
- _getDateByIndex: function(headerIndex) {
- var resultDate = new Date(this._firstViewDate);
- resultDate.setDate(this._firstViewDate.getDate() + headerIndex);
- return resultDate
- },
- _getInterval: function() {
- return DAY_IN_MILLISECONDS
- },
- _getIntervalBetween: function(currentDate) {
- var firstViewDate = this.getStartViewDate();
- var timeZoneOffset = dateUtils.getTimezonesDifference(firstViewDate, currentDate);
- return currentDate.getTime() - (firstViewDate.getTime() - 36e5 * this.option("startDayHour")) - timeZoneOffset
- },
- calculateEndDate: function(startDate) {
- var startDateCopy = new Date(startDate);
- return new Date(startDateCopy.setHours(this.option("endDayHour")))
- },
- _calculateHiddenInterval: function() {
- return 0
- },
- _getDateByCellIndexes: function(rowIndex, cellIndex) {
- var date = this.callBase(rowIndex, cellIndex);
- this._setStartDayHour(date);
- return date
- },
- needUpdateScrollPosition: function(hours, minutes, bounds, date) {
- return this._dateWithinBounds(bounds, date)
- },
- getPositionShift: function() {
- return {
- top: 0,
- left: 0,
- cellPosition: 0
- }
- }
- });
- registerComponent("dxSchedulerTimelineMonth", SchedulerTimelineMonth);
- module.exports = SchedulerTimelineMonth;
|