UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

77 lines (76 loc) 2.56 kB
/** * DevExtreme (esm/__internal/scheduler/workspaces/timeline_month.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/ */ import registerComponent from "../../../core/component_registrator"; import dateUtils from "../../../core/utils/date"; import { HeaderPanelComponent } from "../../scheduler/r1/components/index"; import { formatWeekdayAndDay, monthUtils } from "../../scheduler/r1/utils/index"; import { VIEWS } from "../utils/options/constants_view"; import SchedulerTimeline from "./timeline"; const TIMELINE_CLASS = "dx-scheduler-timeline-month"; class SchedulerTimelineMonth extends SchedulerTimeline { constructor() { super(...arguments); this.viewDirection = "horizontal" } get type() { return VIEWS.TIMELINE_MONTH } get renovatedHeaderPanelComponent() { return HeaderPanelComponent } renderView() { super.renderView(); this.updateScrollable() } getElementClass() { return TIMELINE_CLASS } getDateHeaderTemplate() { return this.option("dateCellTemplate") } calculateDurationInCells(timeDiff) { return timeDiff / this.getCellDuration() } isIndicatorVisible() { return true } getFormat() { return formatWeekdayAndDay } getIntervalBetween(currentDate) { const firstViewDate = this.getStartViewDate(); const timeZoneOffset = dateUtils.getTimezonesDifference(firstViewDate, currentDate); const startDayHour = this.option("startDayHour"); return currentDate.getTime() - (firstViewDate.getTime() - 36e5 * startDayHour) - timeZoneOffset } getViewStartByOptions() { const currentDate = this.option("currentDate") ?? new Date; const startDate = this.option("startDate") ?? currentDate; const firstMonthDate = dateUtils.getFirstMonthDate(startDate) ?? startDate; return monthUtils.getViewStartByOptions(startDate, currentDate, this.option("intervalCount"), firstMonthDate) } generateRenderOptions() { const options = super.generateRenderOptions(true); return Object.assign({}, options, { getDateForHeaderText: (_, date) => date }) } keepOriginalHours() { return true } } registerComponent("dxSchedulerTimelineMonth", SchedulerTimelineMonth); export default SchedulerTimelineMonth;