devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
130 lines (129 loc) • 3.96 kB
JavaScript
/**
* DevExtreme (esm/__internal/scheduler/workspaces/work_space_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 {
noop
} from "../../../core/utils/common";
import dateUtils from "../../../core/utils/date";
import {
getBoundingRect
} from "../../../core/utils/position";
import {
hasWindow
} from "../../../core/utils/window";
import {
DateTableMonthComponent
} from "../../scheduler/r1/components/index";
import {
formatWeekday,
monthUtils
} from "../../scheduler/r1/utils/index";
import {
utils
} from "../m_utils";
import {
VIEWS
} from "../utils/options/constants_view";
import SchedulerWorkSpace from "./work_space_indicator";
const MONTH_CLASS = "dx-scheduler-work-space-month";
const toMs = dateUtils.dateToMilliseconds;
class SchedulerWorkSpaceMonth extends SchedulerWorkSpace {
get type() {
return VIEWS.MONTH
}
getElementClass() {
return MONTH_CLASS
}
getFormat() {
return formatWeekday
}
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
}
getDateGenerationOptions() {
return Object.assign({}, super.getDateGenerationOptions(), {
cellCountInDay: 1
})
}
getCellWidth() {
const cellWidth = this.cache.memo("cellWidth", () => {
let averageWidth = 0;
const cells = this.getCells().slice(0, 7);
cells.each((index, element) => {
averageWidth += hasWindow() ? getBoundingRect(element).width : 0
});
return 0 === cells.length ? void 0 : averageWidth / 7
});
return cellWidth
}
insertAllDayRowsIntoDateTable() {
return false
}
getCellCoordinatesByIndex(index) {
const rowIndex = Math.floor(index / this.getCellCount());
const columnIndex = index - this.getCellCount() * rowIndex;
return {
rowIndex: rowIndex,
columnIndex: columnIndex
}
}
needCreateCrossScrolling() {
return this.option("crossScrollingEnabled") || this.isVerticalGroupedWorkSpace()
}
getViewStartByOptions() {
return monthUtils.getViewStartByOptions(this.option("startDate"), this.option("currentDate"), this.option("intervalCount"), dateUtils.getFirstMonthDate(this.option("startDate")))
}
updateIndex(index) {
return index
}
isIndicationAvailable() {
return false
}
getIntervalDuration() {
return toMs("day")
}
getTimePanelWidth() {
return 0
}
supportAllDayRow() {
return false
}
keepOriginalHours() {
return true
}
getWorkSpaceLeftOffset() {
return 0
}
needApplyCollectorOffset() {
return true
}
getHeaderDate() {
return this.getViewStartByOptions()
}
renderRAllDayPanel() {}
renderRTimeTable() {}
renderRDateTable() {
utils.renovation.renderComponent(this, this.$dateTable, DateTableMonthComponent, "renovatedDateTable", this.getRDateTableProps())
}
createWorkSpaceElements() {
if (this.isVerticalGroupedWorkSpace()) {
this.createWorkSpaceScrollableElements()
} else {
super.createWorkSpaceElements()
}
}
updateAllDayVisibility() {
return noop()
}
}
registerComponent("dxSchedulerWorkSpaceMonth", SchedulerWorkSpaceMonth);
export default SchedulerWorkSpaceMonth;