devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
679 lines • 80.5 kB
JavaScript
/**
* DevExtreme (esm/renovation/ui/scheduler/workspaces/base/work_space.js)
* Version: 22.1.9
* Build date: Tue Apr 18 2023
*
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
var _excluded = ["accessKey", "activeStateEnabled", "allDayAppointments", "allDayPanelExpanded", "allDayPanelMode", "allowMultipleCellSelection", "appointmentCollectorTemplate", "appointmentTemplate", "appointments", "cellDuration", "className", "crossScrollingEnabled", "currentDate", "dataCellTemplate", "dateCellTemplate", "disabled", "endDayHour", "firstDayOfWeek", "focusStateEnabled", "groupByDate", "groupOrientation", "groups", "height", "hint", "hoursInterval", "hoverStateEnabled", "indicatorTime", "indicatorUpdateInterval", "intervalCount", "maxAppointmentsPerCell", "onClick", "onKeyDown", "onViewRendered", "resourceCellTemplate", "rtlEnabled", "schedulerHeight", "schedulerWidth", "scrolling", "selectedCellData", "shadeUntilCurrentTime", "showAllDayPanel", "showCurrentTimeIndicator", "startDate", "startDayHour", "startViewDate", "tabIndex", "timeCellTemplate", "type", "visible", "width"];
import {
createComponentVNode,
normalizeProps
} from "inferno";
import {
InfernoEffect,
InfernoComponent
} from "@devextreme/runtime/inferno";
import {
subscribeToDXPointerDownEvent,
subscribeToDXPointerMoveEvent,
subscribeToScrollEvent
} from "../../../../utils/subscribe_to_event";
import {
combineClasses
} from "../../../../utils/combine_classes";
import {
OrdinaryLayout
} from "./ordinary_layout";
import {
VirtualScrollingDispatcher
} from "../../../../../ui/scheduler/workspaces/ui.scheduler.virtual_scrolling";
import ViewDataProvider from "../../../../../ui/scheduler/workspaces/view_model/view_data_provider";
import {
createCellElementMetaData,
createVirtualScrollingOptions,
DATE_TABLE_MIN_CELL_WIDTH,
getCellIndices,
getDateTableWidth,
getSelectedCells,
isCellAllDay
} from "./utils";
import {
WorkSpaceProps
} from "../props";
import {
getViewRenderConfigByType
} from "./work_space_config";
import {
isGroupingByDate,
isHorizontalGroupingApplied,
isVerticalGroupingApplied
} from "../utils";
import {
CrossScrollingLayout
} from "./cross_scrolling_layout";
import {
getViewDataGeneratorByViewType
} from "../../../../../ui/scheduler/workspaces/view_model/utils";
import {
calculateIsGroupedAllDayPanel
} from "../../view_model/to_test/views/utils/base";
import {
DateHeaderDataGenerator
} from "../../../../../ui/scheduler/workspaces/view_model/date_header_data_generator";
import {
TimePanelDataGenerator
} from "../../../../../ui/scheduler/workspaces/view_model/time_panel_data_generator";
import {
CellsSelectionController
} from "../../../../../ui/scheduler/workspaces/cells_selection_controller";
import {
getGroupPanelData
} from "../../view_model/group_panel/utils";
import {
getWindow
} from "../../../../../core/utils/window";
import domAdapter from "../../../../../core/dom_adapter";
import {
ConfigContext
} from "../../../../common/config_context";
import pointerEvents from "../../../../../events/pointer";
import eventsEngine from "../../../../../events/core/events_engine";
import {
isMouseEvent
} from "../../../../../events/utils/index";
import {
ALL_DAY_PANEL_CELL_CLASS,
DATE_TABLE_CELL_CLASS
} from "../const";
import {
DiagnosticUtils
} from "../../../../utils/diagnostic";
var DATA_CELL_SELECTOR = ".".concat(DATE_TABLE_CELL_CLASS, ", .").concat(ALL_DAY_PANEL_CELL_CLASS);
var defaultVirtualScrollingMetaData = {
cellHeight: 50,
cellWidth: DATE_TABLE_MIN_CELL_WIDTH,
viewWidth: 300,
viewHeight: 300,
scrollableWidth: 300,
windowHeight: 300,
windowWidth: 300
};
var calculateDefaultVirtualScrollingState = options => {
var completeColumnCount = options.completeViewDataMap[0].length;
var completeRowCount = options.completeViewDataMap.length;
options.virtualScrollingDispatcher.setViewOptions(createVirtualScrollingOptions({
cellHeight: defaultVirtualScrollingMetaData.cellHeight,
cellWidth: defaultVirtualScrollingMetaData.cellWidth,
schedulerHeight: options.schedulerHeight,
schedulerWidth: options.schedulerWidth,
viewHeight: defaultVirtualScrollingMetaData.viewHeight,
viewWidth: defaultVirtualScrollingMetaData.viewWidth,
scrolling: options.scrolling,
scrollableWidth: defaultVirtualScrollingMetaData.scrollableWidth,
groups: options.groups,
isVerticalGrouping: options.isVerticalGrouping,
completeRowCount: completeRowCount,
completeColumnCount: completeColumnCount,
windowHeight: defaultVirtualScrollingMetaData.windowHeight,
windowWidth: defaultVirtualScrollingMetaData.windowWidth,
rtlEnabled: options.rtlEnabled
}));
options.virtualScrollingDispatcher.createVirtualScrolling();
options.virtualScrollingDispatcher.updateDimensions(true);
return options.virtualScrollingDispatcher.getRenderState()
};
export var prepareGenerationOptions = (workSpaceProps, renderConfig, isAllDayPanelVisible, virtualStartIndices) => {
var {
cellDuration: cellDuration,
currentDate: currentDate,
endDayHour: endDayHour,
firstDayOfWeek: firstDayOfWeek,
groupByDate: groupByDate,
groupOrientation: groupOrientation,
groups: groups,
hoursInterval: hoursInterval,
intervalCount: intervalCount,
startDate: startDate,
startDayHour: startDayHour,
type: type
} = workSpaceProps;
var {
getDateForHeaderText: getDateForHeaderText,
headerCellTextFormat: headerCellTextFormat,
isGenerateWeekDaysHeaderData: isGenerateWeekDaysHeaderData,
isProvideVirtualCellsWidth: isProvideVirtualCellsWidth,
isRenderTimePanel: isRenderTimePanel
} = renderConfig;
return {
startRowIndex: virtualStartIndices.startRowIndex,
startCellIndex: virtualStartIndices.startCellIndex,
groupOrientation: groupOrientation,
groupByDate: groupByDate,
groups: groups,
isProvideVirtualCellsWidth: isProvideVirtualCellsWidth,
isAllDayPanelVisible: isAllDayPanelVisible,
selectedCells: void 0,
focusedCell: void 0,
headerCellTextFormat: headerCellTextFormat,
getDateForHeaderText: getDateForHeaderText,
startDayHour: startDayHour,
endDayHour: endDayHour,
cellDuration: cellDuration,
viewType: type,
intervalCount: intervalCount,
hoursInterval: hoursInterval,
currentDate: currentDate,
startDate: startDate,
firstDayOfWeek: firstDayOfWeek,
isGenerateTimePanelData: isRenderTimePanel,
isGenerateWeekDaysHeaderData: isGenerateWeekDaysHeaderData
}
};
export var viewFunction = _ref => {
var {
allDayPanelRef: allDayPanelRef,
classes: classes,
dateHeaderData: dateHeaderData,
dateTableRef: dateTableRef,
groupOrientation: groupOrientation,
groupPanelData: groupPanelData,
groupPanelHeight: groupPanelHeight,
groupPanelRef: groupPanelRef,
headerEmptyCellWidth: headerEmptyCellWidth,
isAllDayPanelVisible: isAllDayPanelVisible,
isGroupedByDate: isGroupedByDate,
isRenderHeaderEmptyCell: isRenderHeaderEmptyCell,
isStandaloneAllDayPanel: isStandaloneAllDayPanel,
isVerticalGrouping: isVerticalGrouping,
layoutRef: layoutRef,
onScrollableScroll: onScrollableScroll,
props: {
allDayAppointments: allDayAppointments,
allDayPanelExpanded: allDayPanelExpanded,
appointments: appointments,
dataCellTemplate: dataCellTemplate,
dateCellTemplate: dateCellTemplate,
groups: groups,
intervalCount: intervalCount,
resourceCellTemplate: resourceCellTemplate,
timeCellTemplate: timeCellTemplate
},
renderConfig: {
groupPanelClassName: groupPanelClassName,
isCreateCrossScrolling: isCreateCrossScrolling,
isRenderDateHeader: isRenderDateHeader,
isRenderTimePanel: isRenderTimePanel,
isUseMonthDateTable: isUseMonthDateTable,
isUseTimelineHeader: isUseTimelineHeader,
scrollingDirection: scrollingDirection
},
tablesWidth: tablesWidth,
timePanelData: timePanelData,
timePanelRef: timePanelRef,
viewData: viewData,
widgetElementRef: widgetElementRef
} = _ref;
var Layout = isCreateCrossScrolling ? CrossScrollingLayout : OrdinaryLayout;
return createComponentVNode(2, Layout, {
viewData: viewData,
dateHeaderData: dateHeaderData,
timePanelData: timePanelData,
groupPanelData: groupPanelData,
dataCellTemplate: dataCellTemplate,
dateCellTemplate: dateCellTemplate,
timeCellTemplate: timeCellTemplate,
resourceCellTemplate: resourceCellTemplate,
groups: groups,
groupByDate: isGroupedByDate,
groupOrientation: groupOrientation,
groupPanelClassName: groupPanelClassName,
intervalCount: intervalCount,
isUseMonthDateTable: isUseMonthDateTable,
isUseTimelineHeader: isUseTimelineHeader,
isRenderTimePanel: isRenderTimePanel,
isAllDayPanelCollapsed: !allDayPanelExpanded,
isAllDayPanelVisible: isAllDayPanelVisible,
isRenderDateHeader: isRenderDateHeader,
isRenderHeaderEmptyCell: isRenderHeaderEmptyCell,
isRenderGroupPanel: isVerticalGrouping,
isStandaloneAllDayPanel: isStandaloneAllDayPanel,
scrollingDirection: scrollingDirection,
groupPanelHeight: groupPanelHeight,
headerEmptyCellWidth: headerEmptyCellWidth,
tablesWidth: tablesWidth,
onScroll: onScrollableScroll,
className: classes,
dateTableRef: dateTableRef,
allDayPanelRef: allDayPanelRef,
timePanelRef: timePanelRef,
groupPanelRef: groupPanelRef,
widgetElementRef: widgetElementRef,
appointments: appointments,
allDayAppointments: allDayAppointments
}, null, layoutRef)
};
import {
createRef as infernoCreateRef
} from "inferno";
var getTemplate = TemplateProp => TemplateProp && (TemplateProp.defaultProps ? props => normalizeProps(createComponentVNode(2, TemplateProp, _extends({}, props))) : TemplateProp);
export class WorkSpace extends InfernoComponent {
constructor(props) {
super(props);
this.dateTableRef = infernoCreateRef();
this.allDayPanelRef = infernoCreateRef();
this.timePanelRef = infernoCreateRef();
this.groupPanelRef = infernoCreateRef();
this.layoutRef = infernoCreateRef();
this.widgetElementRef = infernoCreateRef();
this.__getterCache = {};
this.state = {
groupPanelHeight: void 0,
headerEmptyCellWidth: void 0,
tablesWidth: void 0,
virtualScrolling: new VirtualScrollingDispatcher,
virtualScrollingData: void 0,
cellsSelectionState: null,
isPointerDown: false
};
this.diagnosticEffect = this.diagnosticEffect.bind(this);
this.headerEmptyCellWidthEffect = this.headerEmptyCellWidthEffect.bind(this);
this.tablesWidthEffect = this.tablesWidthEffect.bind(this);
this.virtualScrollingMetaDataEffect = this.virtualScrollingMetaDataEffect.bind(this);
this.groupPanelHeightEffect = this.groupPanelHeightEffect.bind(this);
this.onWindowScrollEffect = this.onWindowScrollEffect.bind(this);
this.pointerEventsEffect = this.pointerEventsEffect.bind(this);
this.onViewRendered = this.onViewRendered.bind(this);
this.pointerUpEffect = this.pointerUpEffect.bind(this);
this.createDateTableElementsMeta = this.createDateTableElementsMeta.bind(this);
this.createAllDayPanelElementsMeta = this.createAllDayPanelElementsMeta.bind(this);
this.onWindowScroll = this.onWindowScroll.bind(this);
this.onScrollableScroll = this.onScrollableScroll.bind(this);
this.onScroll = this.onScroll.bind(this);
this.onPointerDown = this.onPointerDown.bind(this);
this.onPointerUp = this.onPointerUp.bind(this);
this.onPointerMove = this.onPointerMove.bind(this)
}
get config() {
if ("ConfigContext" in this.context) {
return this.context.ConfigContext
}
return ConfigContext
}
createEffects() {
return [new InfernoEffect(this.diagnosticEffect, [this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]), new InfernoEffect(this.headerEmptyCellWidthEffect, [this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]), new InfernoEffect(this.tablesWidthEffect, [this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]), new InfernoEffect(this.virtualScrollingMetaDataEffect, [this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]), new InfernoEffect(this.groupPanelHeightEffect, [this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]), new InfernoEffect(this.onWindowScrollEffect, [this.state.virtualScrolling, this.state.virtualScrollingData]), new InfernoEffect(this.pointerEventsEffect, [this.props.cellDuration, this.props.currentDate, this.props.endDayHour, this.props.firstDayOfWeek, this.props.groups, this.props.hoursInterval, this.props.intervalCount, this.props.startDate, this.props.startDayHour, this.props.type, this.props.groupByDate, this.props.startViewDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.showAllDayPanel, this.state.virtualScrollingData, this.props.schedulerHeight, this.props.schedulerWidth, this.props.scrolling, this.state.virtualScrolling, this.state.isPointerDown, this.state.cellsSelectionState]), new InfernoEffect(this.onViewRendered, [this.props.allDayPanelExpanded, this.props.cellDuration, this.props.crossScrollingEnabled, this.props.currentDate, this.props.endDayHour, this.props.firstDayOfWeek, this.props.groupByDate, this.props.groupOrientation, this.props.type, this.props.intervalCount, this.props.groups, this.props.hoursInterval, this.props.onViewRendered, this.props.scrolling, this.props.showAllDayPanel, this.props.startDate, this.props.startDayHour, this.props.startViewDate, this.state.virtualScrollingData, this.props.schedulerHeight, this.props.schedulerWidth, this.state.virtualScrolling, this.state.tablesWidth]), new InfernoEffect(this.pointerUpEffect, [])]
}
updateEffects() {
var _this$_effects$, _this$_effects$2, _this$_effects$3, _this$_effects$4, _this$_effects$5, _this$_effects$6, _this$_effects$7, _this$_effects$8;
null === (_this$_effects$ = this._effects[0]) || void 0 === _this$_effects$ ? void 0 : _this$_effects$.update([this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]);
null === (_this$_effects$2 = this._effects[1]) || void 0 === _this$_effects$2 ? void 0 : _this$_effects$2.update([this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]);
null === (_this$_effects$3 = this._effects[2]) || void 0 === _this$_effects$3 ? void 0 : _this$_effects$3.update([this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]);
null === (_this$_effects$4 = this._effects[3]) || void 0 === _this$_effects$4 ? void 0 : _this$_effects$4.update([this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]);
null === (_this$_effects$5 = this._effects[4]) || void 0 === _this$_effects$5 ? void 0 : _this$_effects$5.update([this.props, this.state.groupPanelHeight, this.state.headerEmptyCellWidth, this.state.tablesWidth, this.state.virtualScrolling, this.state.virtualScrollingData, this.state.cellsSelectionState, this.state.isPointerDown, this.config, this.props.dataCellTemplate, this.props.dateCellTemplate, this.props.timeCellTemplate, this.props.resourceCellTemplate, this.props.appointmentTemplate, this.props.appointmentCollectorTemplate, this.props.intervalCount, this.props.groups, this.props.groupByDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.startDayHour, this.props.endDayHour, this.props.firstDayOfWeek, this.props.currentDate, this.props.startDate, this.props.startViewDate, this.props.hoursInterval, this.props.showAllDayPanel, this.props.allDayPanelExpanded, this.props.allowMultipleCellSelection, this.props.indicatorTime, this.props.indicatorUpdateInterval, this.props.shadeUntilCurrentTime, this.props.selectedCellData, this.props.scrolling, this.props.cellDuration, this.props.showCurrentTimeIndicator, this.props.schedulerHeight, this.props.schedulerWidth, this.props.type, this.props.maxAppointmentsPerCell, this.props.allDayPanelMode, this.props.onViewRendered, this.props.appointments, this.props.allDayAppointments, this.props.className, this.props.accessKey, this.props.activeStateEnabled, this.props.disabled, this.props.focusStateEnabled, this.props.height, this.props.hint, this.props.hoverStateEnabled, this.props.onClick, this.props.onKeyDown, this.props.rtlEnabled, this.props.tabIndex, this.props.visible, this.props.width]);
null === (_this$_effects$6 = this._effects[5]) || void 0 === _this$_effects$6 ? void 0 : _this$_effects$6.update([this.state.virtualScrolling, this.state.virtualScrollingData]);
null === (_this$_effects$7 = this._effects[6]) || void 0 === _this$_effects$7 ? void 0 : _this$_effects$7.update([this.props.cellDuration, this.props.currentDate, this.props.endDayHour, this.props.firstDayOfWeek, this.props.groups, this.props.hoursInterval, this.props.intervalCount, this.props.startDate, this.props.startDayHour, this.props.type, this.props.groupByDate, this.props.startViewDate, this.props.groupOrientation, this.props.crossScrollingEnabled, this.props.showAllDayPanel, this.state.virtualScrollingData, this.props.schedulerHeight, this.props.schedulerWidth, this.props.scrolling, this.state.virtualScrolling, this.state.isPointerDown, this.state.cellsSelectionState]);
null === (_this$_effects$8 = this._effects[7]) || void 0 === _this$_effects$8 ? void 0 : _this$_effects$8.update([this.props.allDayPanelExpanded, this.props.cellDuration, this.props.crossScrollingEnabled, this.props.currentDate, this.props.endDayHour, this.props.firstDayOfWeek, this.props.groupByDate, this.props.groupOrientation, this.props.type, this.props.intervalCount, this.props.groups, this.props.hoursInterval, this.props.onViewRendered, this.props.scrolling, this.props.showAllDayPanel, this.props.startDate, this.props.startDayHour, this.props.startViewDate, this.state.virtualScrollingData, this.props.schedulerHeight, this.props.schedulerWidth, this.state.virtualScrolling, this.state.tablesWidth])
}
diagnosticEffect() {
DiagnosticUtils.incrementRenderCount("scheduler_workspace")
}
headerEmptyCellWidthEffect() {
var _this$timePanelRef$cu, _this$timePanelRef$cu2, _this$groupPanelRef$c, _this$groupPanelRef$c2;
var timePanelWidth = null !== (_this$timePanelRef$cu = null === (_this$timePanelRef$cu2 = this.timePanelRef.current) || void 0 === _this$timePanelRef$cu2 ? void 0 : _this$timePanelRef$cu2.getBoundingClientRect().width) && void 0 !== _this$timePanelRef$cu ? _this$timePanelRef$cu : 0;
var groupPanelWidth = null !== (_this$groupPanelRef$c = null === (_this$groupPanelRef$c2 = this.groupPanelRef.current) || void 0 === _this$groupPanelRef$c2 ? void 0 : _this$groupPanelRef$c2.getBoundingClientRect().width) && void 0 !== _this$groupPanelRef$c ? _this$groupPanelRef$c : 0;
this.setState(__state_argument => ({
headerEmptyCellWidth: timePanelWidth + groupPanelWidth
}))
}
tablesWidthEffect() {
if (this.isCalculateTablesWidth) {
var {
currentDate: currentDate,
endDayHour: endDayHour,
groups: groups,
hoursInterval: hoursInterval,
intervalCount: intervalCount,
startDayHour: startDayHour,
type: viewType
} = this.props;
this.setState(__state_argument => ({
tablesWidth: getDateTableWidth(this.layoutRef.current.getScrollableWidth(), this.dateTableRef.current, this.viewDataProvider, {
intervalCount: intervalCount,
currentDate: currentDate,
viewType: viewType,
hoursInterval: hoursInterval,
startDayHour: startDayHour,
endDayHour: endDayHour,
groups: groups,
groupOrientation: this.groupOrientation
})
}))
}
}
virtualScrollingMetaDataEffect() {
var dateTableCell = this.dateTableRef.current.querySelector("td:not(.dx-scheduler-virtual-cell)");
var cellRect = dateTableCell.getBoundingClientRect();
var cellHeight = Math.floor(cellRect.height);
var cellWidth = Math.floor(cellRect.width);
var scrollableWidth = this.layoutRef.current.getScrollableWidth();
var widgetRect = this.widgetElementRef.current.getBoundingClientRect();
var viewHeight = widgetRect.height;
var viewWidth = widgetRect.width;
var windowHeight = getWindow().innerHeight;
var windowWidth = getWindow().innerWidth;
var nextSizes = {
cellHeight: cellHeight,
cellWidth: cellWidth,
scrollableWidth: scrollableWidth,
viewHeight: viewHeight,
viewWidth: viewWidth,
windowHeight: windowHeight,
windowWidth: windowWidth
};
var isNextMetaDataNotEqualToCurrent = !this.state.virtualScrollingData || Object.entries(nextSizes).some(_ref2 => {
var [key, value] = _ref2;
return value !== this.state.virtualScrollingData.sizes[key]
});
if (isNextMetaDataNotEqualToCurrent) {
var _this$config;
var {
groups: groups,
schedulerHeight: schedulerHeight,
schedulerWidth: schedulerWidth,
scrolling: scrolling
} = this.props;
var completeColumnCount = this.completeViewDataMap[0].length;
var completeRowCount = this.completeViewDataMap.length;
this.state.virtualScrolling.setViewOptions(createVirtualScrollingOptions({
cellHeight: nextSizes.cellHeight,
cellWidth: nextSizes.cellWidth,
schedulerHeight: schedulerHeight,
schedulerWidth: schedulerWidth,
viewHeight: nextSizes.viewHeight,
viewWidth: nextSizes.viewWidth,
scrolling: scrolling,
scrollableWidth: nextSizes.scrollableWidth,
groups: groups,
isVerticalGrouping: this.isVerticalGrouping,
completeRowCount: completeRowCount,
completeColumnCount: completeColumnCount,
windowHeight: nextSizes.windowHeight,
windowWidth: nextSizes.windowWidth,
rtlEnabled: !!(null !== (_this$config = this.config) && void 0 !== _this$config && _this$config.rtlEnabled)
}));
this.state.virtualScrolling.createVirtualScrolling();
this.state.virtualScrolling.updateDimensions(true);
this.setState(__state_argument => ({
virtualScrollingData: {
state: this.state.virtualScrolling.getRenderState(),
sizes: nextSizes
}
}))
}
}
groupPanelHeightEffect() {
this.setState(__state_argument => {
var _this$dateTableRef$cu;
return {
groupPanelHeight: null === (_this$dateTableRef$cu = this.dateTableRef.current) || void 0 === _this$dateTableRef$cu ? void 0 : _this$dateTableRef$cu.getBoundingClientRect().height
}
})
}
onWindowScrollEffect() {
if (this.state.virtualScrolling.isAttachWindowScrollEvent()) {
return subscribeToScrollEvent(domAdapter.getDocument(), () => this.onWindowScroll())
}
return
}
pointerEventsEffect() {
var disposePointerDown = subscribeToDXPointerDownEvent(this.widgetElementRef.current, e => this.onPointerDown(e));
var disposePointerMove = subscribeToDXPointerMoveEvent(this.widgetElementRef.current, e => this.onPointerMove(e));
return () => {
disposePointerDown();
disposePointerMove()
}
}
onViewRendered() {
var {
allDayPanelExpanded: allDayPanelExpanded,
cellDuration: cellDuration,
crossScrollingEnabled: crossScrollingEnabled,
currentDate: currentDate,
endDayHour: endDayHour,
firstDayOfWeek: firstDayOfWeek,
groupByDate: groupByDate,
groupOrientation: groupOrientation,
groups: groups,
hoursInterval: hoursInterval,
intervalCount: intervalCount,
onViewRendered: onViewRendered,
scrolling: scrolling,
showAllDayPanel: showAllDayPanel,
startDate: startDate,
startDayHour: startDayHour,
type: viewType
} = this.props;
var tableWidths = getDateTableWidth(this.layoutRef.current.getScrollableWidth(), this.dateTableRef.current, this.viewDataProvider, {
intervalCount: intervalCount,
currentDate: currentDate,
viewType: viewType,
hoursInterval: hoursInterval,
startDayHour: startDayHour,
endDayHour: endDayHour,
groups: groups,
groupOrientation: this.groupOrientation
});
if (!this.isCalculateTablesWidth || tableWidths === this.state.tablesWidth) {
var columnCount = this.viewDataMap.dateTableMap[0].length;
var dateTableCellsMeta = this.createDateTableElementsMeta(columnCount);
var allDayPanelCellsMeta = this.createAllDayPanelElementsMeta();
onViewRendered({
viewDataProvider: this.viewDataProvider,
cellsMetaData: {
dateTableCellsMeta: dateTableCellsMeta,
allDayPanelCellsMeta: allDayPanelCellsMeta
},
viewDataProviderValidationOptions: {
intervalCount: intervalCount,
currentDate: currentDate,
type: viewType,
hoursInterval: hoursInterval,
startDayHour: startDayHour,
endDayHour: endDayHour,
groups: groups,
groupOrientation: groupOrientation,
groupByDate: groupByDate,
crossScrollingEnabled: crossScrollingEnabled,
firstDayOfWeek: firstDayOfWeek,
startDate: startDate,
showAllDayPanel: showAllDayPanel,
allDayPanelExpanded: allDayPanelExpanded,
scrolling: scrolling,
cellDuration: cellDuration
}
})
}
}
pointerUpEffect() {
var onPointerUp = e => this.onPointerUp(e);
eventsEngine.on(domAdapter.getDocument(), pointerEvents.up, onPointerUp);
return () => {
eventsEngine.off(domAdapter.getDocument(), pointerEvents.up, onPointerUp)
}
}
get renderConfig() {
if (void 0 !== this.__getterCache.renderConfig) {
return this.__getterCache.renderConfig
}
return this.__getterCache.renderConfig = (() => getViewRenderConfigByType(this.props.type, this.props.crossScrollingEnabled, this.props.intervalCount, this.props.groups, this.props.groupOrientation))()
}
get groupOrientation() {
var {
groupOrientation: groupOrientation
} = this.props;
var {
defaultGroupOrientation: defaultGroupOrientation
} = this.renderConfig;
return null !== groupOrientation && void 0 !== groupOrientation ? groupOrientation : defaultGroupOrientation
}
get isVerticalGrouping() {
return isVerticalGroupingApplied(this.props.groups, this.groupOrientation)
}
get isHorizontalGrouping() {
return isHorizontalGroupingApplied(this.props.groups, this.groupOrientation)
}
get isGroupedByDate() {
return isGroupingByDate(this.props.groups, this.groupOrientation, this.props.groupByDate)
}
get isAllDayPanelVisible() {
var {
showAllDayPanel: showAllDayPanel
} = this.props;
var {
isAllDayPanelSupported: isAllDayPanelSupported
} = this.renderConfig;
return isAllDayPanelSupported && showAllDayPanel
}
get viewDataGenerator() {
if (void 0 !== this.__getterCache.viewDataGenerator) {
return this.__getterCache.viewDataGenerator
}
return this.__getterCache.viewDataGenerator = (() => getViewDataGeneratorByViewType(this.props.type))()
}
get dateHeaderDataGenerator() {
if (void 0 !== this.__getterCache.dateHeaderDataGenerator) {
return this.__getterCache.dateHeaderDataGenerator
}
return this.__getterCache.dateHeaderDataGenerator = (() => new DateHeaderDataGenerator(this.viewDataGenerator))()
}
get timePanelDataGenerator() {
if (void 0 !== this.__getterCache.timePanelDataGenerator) {
return this.__getterCache.timePanelDataGenerator
}
return this.__getterCache.timePanelDataGenerator = (() => new TimePanelDataGenerator(this.viewDataGenerator))()
}
get completeViewDataMap() {
if (void 0 !== this.__getterCache.completeViewDataMap) {
return this.__getterCache.completeViewDataMap
}
return this.__getterCache.completeViewDataMap = (() => {
var {
cellDuration: cellDuration,
currentDate: currentDate,
endDayHour: endDayHour,
firstDayOfWeek: firstDayOfWeek,
groupByDate: groupByDate,
groups: groups,
hoursInterval: hoursInterval,
intervalCount: intervalCount,
startDate: startDate,
startDayHour: startDayHour,
type: type
} = this.props;
return this.viewDataGenerator.getCompleteViewDataMap({
currentDate: currentDate,
startDate: startDate,
startDayHour: startDayHour,
endDayHour: endDayHour,
groupByDate: groupByDate,
groups: groups,
intervalCount: intervalCount,
firstDayOfWeek: firstDayOfWeek,
hoursInterval: hoursInterval,
cellDuration: cellDuration,
startViewDate: this.props.startViewDate,
groupOrientation: this.groupOrientation,
isVerticalGrouping: this.isVerticalGrouping,
isHorizontalGrouping: this.isHorizontalGrouping,
isGroupedByDate: this.isGroupedByDate,
isAllDayPanelVisible: this.isAllDayPanelVisible,
viewType: type,
interval: this.viewDataGenerator.getInterval(hoursInterval)
})
})()
}
get correctedVirtualScrollingState() {
if (void 0 !== this.__getterCache.correctedVirtualScrollingState) {
return this.__getterCache.correctedVirtualScrollingState
}
return this.__getterCache.correctedVirtualScrollingState = (() => {
var _this$state$virtualSc;
var result = null === (_this$state$virtualSc = this.state.virtualScrollingData) || void 0 === _this$state$virtualSc ? void 0 : _this$state$virtualSc.state;
if (!result) {
var {
groups: groups,
schedulerHeight: schedulerHeight,
schedulerWidth: schedulerWidth,
scrolling: scrolling
} = this.props;
result = calculateDefaultVirtualScrollingState({
virtualScrollingDispatcher: this.state.virtualScrolling,
scrolling: scrolling,
groups: groups,
completeViewDataMap: this.completeViewDataMap,
isVerticalGrouping: this.isVerticalGrouping,
schedulerHeight: schedulerHeight,
schedulerWidth: schedulerWidth,
rtlEnabled: false
})
}
return _extends({
startCellIndex: 0,
startRowIndex: 0
}, result)
})()
}
get viewDataMap() {
if (void 0 !== this.__getterCache.viewDataMap) {
return this.__getterCache.viewDataMap
}
return this.__getterCache.viewDataMap = (() => this.viewDataGenerator.generateViewDataMap(this.completeViewDataMap, _extends({}, this.correctedVirtualScrollingState, {
isVerticalGrouping: this.isVerticalGrouping,
isAllDayPanelVisible: this.isAllDayPanelVisible
})))()
}
get viewDataMapWithSelection() {
if (void 0 !== this.__getterCache.viewDataMapWithSelection) {
return this.__getterCache.viewDataMapWithSelection
}
return this.__getterCache.viewDataMapWithSelection = (() => {
if (!this.state.cellsSelectionState) {
return this.viewDataMap
}
return this.viewDataGenerator.markSelectedAndFocusedCells(this.viewDataMap, this.state.cellsSelectionState)
})()
}
get viewData() {
if (void 0 !== this.__getterCache.viewData) {
return this.__getterCache.viewData
}
return this.__getterCache.viewData = (() => {
var {
groups: groups
} = this.props;
var result = this.viewDataGenerator.getViewDataFromMap(this.completeViewDataMap, this.viewDataMapWithSelection, _extends({}, this.correctedVirtualScrollingState, {
isProvideVirtualCellsWidth: this.renderConfig.isProvideVirtualCellsWidth,
isVerticalGrouping: this.isVerticalGrouping,
isAllDayPanelVisible: this.isAllDayPanelVisible,
isGroupedAllDayPanel: calculateIsGroupedAllDayPanel(groups, this.groupOrientation, this.isAllDayPanelVisible)
}));
return result
})()
}
get completeDateHeaderData() {
if (void 0 !== this.__getterCache.completeDateHeaderData) {
return this.__getterCache.completeDateHeaderData
}
return this.__getterCache.completeDateHeaderData = (() => {
var {
currentDate: currentDate,
endDayHour: endDayHour,
groups: groups,
hoursInterval: hoursInterval,
intervalCount: intervalCount,
startDayHour: startDayHour,
type: viewType
} = this.p