UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

2,439 lines • 112 kB
/**
 * DevExtreme (cjs/__internal/scheduler/workspaces/work_space.js)
 * Version: 26.1.6
 * Build date: Fri Oct 16 2026
 *
 * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = void 0;
var _translator = require("../../../common/core/animation/translator");
var _click = require("../../../common/core/events/click");
var _contextmenu = require("../../../common/core/events/contextmenu");
var _events_engine = _interopRequireDefault(require("../../../common/core/events/core/events_engine"));
var _drag = require("../../../common/core/events/drag");
var _pointer = _interopRequireDefault(require("../../../common/core/events/pointer"));
var _index = require("../../../common/core/events/utils/index");
var _dom_adapter = _interopRequireDefault(require("../../../core/dom_adapter"));
var _element = require("../../../core/element");
var _renderer = _interopRequireDefault(require("../../../core/renderer"));
var _common = require("../../../core/utils/common");
var _data = require("../../../core/utils/data");
var _date = _interopRequireDefault(require("../../../core/utils/date"));
var _extend = require("../../../core/utils/extend");
var _position = require("../../../core/utils/position");
var _size = require("../../../core/utils/size");
var _type = require("../../../core/utils/type");
var _window = require("../../../core/utils/window");
var _ui = _interopRequireDefault(require("../../../ui/widget/ui.errors"));
var _scroll = require("../../core/utils/scroll");
var _widget = _interopRequireDefault(require("../../core/widget/widget"));
var _index2 = require("../../scheduler/r1/components/index");
var _index3 = require("../../scheduler/r1/utils/index");
var _scrollable = _interopRequireDefault(require("../../ui/scroll_view/scrollable"));
var _classes = require("../classes");
var _constants = require("../constants");
var _global_cache = require("../global_cache");
var _m_appointment_drag_behavior = _interopRequireDefault(require("../m_appointment_drag_behavior"));
var _m_compact_appointments_helper = require("../m_compact_appointments_helper");
var _current_time_shader_vertical = _interopRequireDefault(require("../shaders/current_time_shader_vertical"));
var _table_creator = _interopRequireDefault(require("../table_creator"));
var _appointment_groups_utils = require("../utils/resource_manager/appointment_groups_utils");
var _group_utils = require("../utils/resource_manager/group_utils");
var _skipped_days = require("../utils/skipped_days");
var _cells_selection_controller = require("./cells_selection_controller");
var _cells_selection_state = _interopRequireDefault(require("./cells_selection_state"));
var _position_helper = require("./helpers/position_helper");
var _view_data_provider = _interopRequireDefault(require("./view_model/view_data_provider"));
var _virtual_scrolling = require("./virtual_scrolling");
var _work_space_grouped_strategy_horizontal = _interopRequireDefault(require("./work_space_grouped_strategy_horizontal"));
var _work_space_grouped_strategy_vertical = _interopRequireDefault(require("./work_space_grouped_strategy_vertical"));

function _interopRequireDefault(e) {
    return e && e.__esModule ? e : {
        default: e
    }
}
const {
    tableCreator: tableCreator
} = _table_creator.default;
const DRAGGING_MOUSE_FAULT = 10;
const {
    abstract: widgetAbstract
} = _widget.default;
const abstract = widgetAbstract;
const toMs = _date.default.dateToMilliseconds;
const COMPONENT_CLASS = "dx-scheduler-work-space";
const GROUPED_WORKSPACE_CLASS = "dx-scheduler-work-space-grouped";
const VERTICAL_GROUPED_WORKSPACE_CLASS = "dx-scheduler-work-space-vertical-grouped";
const WORKSPACE_VERTICAL_GROUP_TABLE_CLASS = "dx-scheduler-work-space-vertical-group-table";
const WORKSPACE_WITH_BOTH_SCROLLS_CLASS = "dx-scheduler-work-space-both-scrollbar";
const WORKSPACE_WITH_COUNT_CLASS = "dx-scheduler-work-space-count";
const WORKSPACE_WITH_GROUP_BY_DATE_CLASS = "dx-scheduler-work-space-group-by-date";
const WORKSPACE_WITH_ODD_CELLS_CLASS = "dx-scheduler-work-space-odd-cells";
const TIME_PANEL_CELL_CLASS = "dx-scheduler-time-panel-cell";
const ALL_DAY_PANEL_CLASS = "dx-scheduler-all-day-panel";
const ALL_DAY_TABLE_CLASS = "dx-scheduler-all-day-table";
const ALL_DAY_CONTAINER_CLASS = "dx-scheduler-all-day-appointments";
const ALL_DAY_TABLE_CELL_CLASS = "dx-scheduler-all-day-table-cell";
const WORKSPACE_WITH_ALL_DAY_CLASS = "dx-scheduler-work-space-all-day";
const WORKSPACE_WITH_COLLAPSED_ALL_DAY_CLASS = "dx-scheduler-work-space-all-day-collapsed";
const WORKSPACE_WITH_MOUSE_SELECTION_CLASS = "dx-scheduler-work-space-mouse-selection";
const HORIZONTAL_SIZES_CLASS = "dx-scheduler-cell-sizes-horizontal";
const VERTICAL_SIZES_CLASS = "dx-scheduler-cell-sizes-vertical";
const HEADER_PANEL_CLASS = "dx-scheduler-header-panel";
const HEADER_PANEL_CELL_CLASS = "dx-scheduler-header-panel-cell";
const GROUP_HEADER_CLASS = "dx-scheduler-group-header";
const DATE_TABLE_CELL_CLASS = "dx-scheduler-date-table-cell";
const DATE_TABLE_FOCUSED_CELL_CLASS = "dx-scheduler-focused-cell";
const VIRTUAL_ROW_CLASS = "dx-scheduler-virtual-row";
const DATE_TABLE_DROPPABLE_CELL_CLASS = "dx-scheduler-date-table-droppable-cell";
const SCHEDULER_HEADER_SCROLLABLE_CLASS = "dx-scheduler-header-scrollable";
const SCHEDULER_SIDEBAR_SCROLLABLE_CLASS = "dx-scheduler-sidebar-scrollable";
const SCHEDULER_DATE_TABLE_SCROLLABLE_CLASS = "dx-scheduler-date-table-scrollable";
const SCHEDULER_WORKSPACE_DXPOINTERDOWN_EVENT_NAME = (0, _index.addNamespace)(_pointer.default.down, "dxSchedulerWorkSpace");
const DragEventNames = {
    ENTER: (0, _index.addNamespace)(_drag.enter, "dxSchedulerDateTable"),
    DROP: (0, _index.addNamespace)(_drag.drop, "dxSchedulerDateTable"),
    LEAVE: (0, _index.addNamespace)(_drag.leave, "dxSchedulerDateTable")
};
const SCHEDULER_CELL_DXCLICK_EVENT_NAME = (0, _index.addNamespace)(_click.name, "dxSchedulerDateTable");
const SCHEDULER_CELL_DXPOINTERDOWN_EVENT_NAME = (0, _index.addNamespace)(_pointer.default.down, "dxSchedulerDateTable");
const SCHEDULER_CELL_DXPOINTERUP_EVENT_NAME = (0, _index.addNamespace)(_pointer.default.up, "dxSchedulerDateTable");
const SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME = (0, _index.addNamespace)(_pointer.default.up, "dxSchedulerTable");
const SCHEDULER_CELL_DXPOINTERMOVE_EVENT_NAME = (0, _index.addNamespace)(_pointer.default.move, "dxSchedulerDateTable");
const DATE_TABLE_MIN_CELL_WIDTH = 75;
const DAY_MS = toMs("day");
const HOUR_MS = toMs("hour");
const DRAG_AND_DROP_SELECTOR = `.${_classes.DATE_TABLE_CLASS} td, .${ALL_DAY_TABLE_CLASS} td`;
const CELL_SELECTOR = `.${DATE_TABLE_CELL_CLASS}, .${ALL_DAY_TABLE_CELL_CLASS}`;
const CELL_INDEX_CALCULATION_EPSILON = .05;
const DEFAULT_WORKSPACE_RENDER_OPTIONS = {
    renderComponents: {
        header: true,
        timePanel: true,
        dateTable: true,
        allDayPanel: true
    },
    generateNewData: true
};
class SchedulerWorkSpace extends _widget.default {
    constructor() {
        super(...arguments);
        this.isSelectionStartedOnCell = false;
        this.preventDefaultDragging = false;
        this.dragBehavior = null;
        this.viewDirection = "vertical"
    }
    _activeStateUnit() {
        return CELL_SELECTOR
    }
    get type() {
        return abstract()
    }
    get viewDataProvider() {
        this.viewDataProviderValue ?? (this.viewDataProviderValue = new _view_data_provider.default(this.type));
        return this.viewDataProviderValue
    }
    get cache() {
        this.cacheValue ?? (this.cacheValue = new _global_cache.Cache);
        return this.cacheValue
    }
    get resourceManager() {
        return this.option().getResourceManager()
    }
    get cellsSelectionState() {
        const isFirstInit = null == this.cellsSelectionStateValue;
        this.cellsSelectionStateValue ?? (this.cellsSelectionStateValue = new _cells_selection_state.default(this.viewDataProvider));
        if (isFirstInit) {
            const selectedCellsOption = this.option().selectedCellData;
            if ((null === selectedCellsOption || void 0 === selectedCellsOption ? void 0 : selectedCellsOption.length) > 0) {
                const validSelectedCells = selectedCellsOption.map(selectedCell => {
                    const {
                        groups: groups
                    } = selectedCell;
                    if (!groups || 0 === this.getGroupCount()) {
                        return Object.assign({}, selectedCell, {
                            groupIndex: 0
                        })
                    }
                    const groupIndex = this.getGroupIndexByGroupValues(groups);
                    return Object.assign({}, selectedCell, {
                        groupIndex: groupIndex
                    })
                });
                this.cellsSelectionStateValue.setSelectedCellsByData(validSelectedCells)
            }
        }
        return this.cellsSelectionStateValue
    }
    get cellsSelectionController() {
        this.cellsSelectionControllerValue ?? (this.cellsSelectionControllerValue = new _cells_selection_controller.CellsSelectionController);
        return this.cellsSelectionControllerValue
    }
    get isAllDayPanelVisible() {
        return this.isShowAllDayPanel() && this.supportAllDayRow()
    }
    get verticalGroupTableClass() {
        return WORKSPACE_VERTICAL_GROUP_TABLE_CLASS
    }
    get renovatedHeaderPanelComponent() {
        return _index2.HeaderPanelComponent
    }
    get timeZoneCalculator() {
        return this.option().timeZoneCalculator
    }
    get isDefaultDraggingMode() {
        return "default" === this.option().draggingMode
    }
    notifyObserver(funcName, args) {
        this.invoke(funcName, ...args)
    }
    invoke(funcName) {
        const {
            notifyScheduler: notifyScheduler
        } = this.option();
        if (!notifyScheduler) {
            return
        }
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key]
        }
        return notifyScheduler.invoke(funcName, ...args)
    }
    _supportedKeys() {
        const enterKeydownHandler = e => {
            e.preventDefault();
            e.stopPropagation();
            const selectedCells = this.getSelectedCellsData();
            if (null !== selectedCells && void 0 !== selectedCells && selectedCells.length) {
                var _this$cellClickAction;
                const selectedCellsElement = selectedCells.map(cellData => this.getCellByData(cellData)).filter(cell => Boolean(cell));
                this.showPopup = true;
                const cellElements = selectedCellsElement.map($cell => $cell.get(0));
                null === (_this$cellClickAction = this.cellClickAction) || void 0 === _this$cellClickAction || _this$cellClickAction.call(this, {
                    event: e,
                    cellElement: (0, _element.getPublicElement)((0, _renderer.default)(cellElements)),
                    cellData: selectedCells[0]
                })
            }
        };
        const onArrowPressed = (e, key) => {
            var _this$cellsSelectionS;
            e.preventDefault();
            e.stopPropagation();
            const focusedCellData = null === (_this$cellsSelectionS = this.cellsSelectionState.getFocusedCell()) || void 0 === _this$cellsSelectionS ? void 0 : _this$cellsSelectionS.cellData;
            if (focusedCellData) {
                const isAllDayPanelCell = Boolean(focusedCellData.allDay && !this.isVerticalGroupedWorkSpace());
                const isMultiSelection = Boolean(e.shiftKey);
                const isMultiSelectionAllowed = this.option().allowMultipleCellSelection;
                const isRTL = this.isRTL();
                const groupCount = this.getGroupCount();
                const isGroupedByDate = this.isGroupedByDate();
                const isHorizontalGrouping = this.isHorizontalGroupedWorkSpace();
                const focusedCellPosition = this.viewDataProvider.findCellPositionInMap(focusedCellData);
                const edgeIndices = isHorizontalGrouping && isMultiSelection && !isGroupedByDate ? this.viewDataProvider.getGroupEdgeIndices(focusedCellData.groupIndex ?? 0, isAllDayPanelCell) : this.viewDataProvider.getViewEdgeIndices(isAllDayPanelCell);
                const nextCellData = this.cellsSelectionController.handleArrowClick({
                    focusedCellPosition: focusedCellPosition,
                    edgeIndices: edgeIndices,
                    isRTL: isRTL,
                    isGroupedByDate: isGroupedByDate,
                    groupCount: groupCount,
                    isMultiSelection: isMultiSelection,
                    isMultiSelectionAllowed: isMultiSelectionAllowed,
                    viewType: this.type,
                    key: key,
                    getCellDataByPosition: this.viewDataProvider.getCellData.bind(this.viewDataProvider),
                    isAllDayPanelCell: isAllDayPanelCell,
                    focusedCellData: focusedCellData
                });
                this.processNextSelectedCell(nextCellData, focusedCellData, isMultiSelection && isMultiSelectionAllowed)
            }
        };
        const supportedKeys = {
            enter: enterKeydownHandler,
            space: enterKeydownHandler,
            downArrow: e => {
                onArrowPressed(e, "down")
            },
            upArrow: e => {
                onArrowPressed(e, "up")
            },
            rightArrow: e => {
                onArrowPressed(e, "right")
            },
            leftArrow: e => {
                onArrowPressed(e, "left")
            }
        };
        return (0, _extend.extend)(super._supportedKeys(), supportedKeys)
    }
    isRTL() {
        return this.option().rtlEnabled
    }
    moveToCell($cell, isMultiSelection) {
        if (!(0, _type.isDefined)($cell) || !$cell.length) {
            return
        }
        const isMultiSelectionAllowed = this.option().allowMultipleCellSelection;
        const currentCellData = this.getFullCellData($cell);
        if (!currentCellData) {
            return
        }
        const focusedCell = this.cellsSelectionState.getFocusedCell();
        if (!focusedCell) {
            return
        }
        const focusedCellData = focusedCell.cellData;
        const nextFocusedCellData = this.cellsSelectionController.moveToCell({
            isMultiSelection: isMultiSelection,
            isMultiSelectionAllowed: isMultiSelectionAllowed,
            currentCellData: currentCellData,
            focusedCellData: focusedCellData,
            isVirtualCell: $cell.hasClass(_classes.VIRTUAL_CELL_CLASS)
        });
        this.processNextSelectedCell(nextFocusedCellData, focusedCellData, isMultiSelectionAllowed && isMultiSelection)
    }
    processNextSelectedCell(nextCellData, focusedCellData, isMultiSelection) {
        const nextCellPosition = this.viewDataProvider.findCellPositionInMap(nextCellData);
        if (!nextCellPosition) {
            return
        }
        if (!this.viewDataProvider.isSameCell(focusedCellData, nextCellData)) {
            const $cell = nextCellData.allDay && !this.isVerticalGroupedWorkSpace() ? this.domGetAllDayPanelCell(nextCellPosition.columnIndex) : this.domGetDateCell(nextCellPosition);
            const isNextCellAllDay = nextCellData.allDay;
            this.setSelectedCellsStateAndUpdateSelection(Boolean(isNextCellAllDay), nextCellPosition, isMultiSelection, $cell);
            this.$dateTableScrollable.scrollToElement($cell)
        }
    }
    setSelectedCellsStateAndUpdateSelection(isAllDay, cellPosition, isMultiSelection, $nextFocusedCell) {
        const nextCellCoordinates = {
            rowIndex: cellPosition.rowIndex,
            columnIndex: cellPosition.columnIndex,
            allDay: isAllDay
        };
        this.cellsSelectionState.setFocusedCell(nextCellCoordinates.rowIndex, nextCellCoordinates.columnIndex, isAllDay);
        if (isMultiSelection) {
            this.cellsSelectionState.setSelectedCells(nextCellCoordinates)
        } else {
            this.cellsSelectionState.setSelectedCells(nextCellCoordinates, nextCellCoordinates)
        }
        this.updateCellsSelection();
        this.updateSelectedCellDataOption(this.getSelectedCellsData(), $nextFocusedCell)
    }
    hasAllDayClass($cell) {
        return $cell.hasClass(ALL_DAY_TABLE_CELL_CLASS)
    }
    _focusInHandler(e) {
        const $target = (0, _renderer.default)(e.target);
        const $focusTarget = this._focusTarget();
        const isTargetInsideWorkspace = $target.is($focusTarget) || $target.closest($focusTarget).length > 0;
        if (isTargetInsideWorkspace && this.isCellClick) {
            delete this.isCellClick;
            delete this.contextMenuHandled;
            super._focusInHandler(e);
            this.cellsSelectionState.restoreSelectedAndFocusedCells();
            if (!this.cellsSelectionState.getFocusedCell()) {
                const cellCoordinates = {
                    columnIndex: 0,
                    rowIndex: 0,
                    allDay: this.isVerticalGroupedWorkSpace() && this.isAllDayPanelVisible
                };
                this.cellsSelectionState.setFocusedCell(cellCoordinates.rowIndex, cellCoordinates.columnIndex, cellCoordinates.allDay);
                this.cellsSelectionState.setSelectedCells(cellCoordinates, cellCoordinates)
            }
            this.updateCellsSelection();
            this.updateSelectedCellDataOption(this.getSelectedCellsData())
        }
    }
    _focusOutHandler(e) {
        super._focusOutHandler(e);
        if (!this.contextMenuHandled && !this._disposed) {
            this.cellsSelectionState.releaseSelectedAndFocusedCells();
            this.viewDataProvider.updateViewData(this.generateRenderOptions());
            this.updateCellsSelection()
        }
    }
    _focusTarget() {
        return this.$element()
    }
    _renderFocusTarget() {
        this._focusTarget().attr("tabIndex", -1)
    }
    isVerticalGroupedWorkSpace() {
        var _this$option$groups;
        return Boolean(null === (_this$option$groups = this.option().groups) || void 0 === _this$option$groups ? void 0 : _this$option$groups.length) && "vertical" === this.option().groupOrientation
    }
    isHorizontalGroupedWorkSpace() {
        var _this$option$groups2;
        return Boolean(null === (_this$option$groups2 = this.option().groups) || void 0 === _this$option$groups2 ? void 0 : _this$option$groups2.length) && "horizontal" === this.option().groupOrientation
    }
    isWorkSpaceWithCount() {
        return this.option().intervalCount > 1
    }
    isWorkspaceWithOddCells() {
        return .5 === this.option().hoursInterval && !this.isVirtualScrolling()
    }
    createRAllDayPanelElements() {
        this.$allDayPanel = (0, _renderer.default)("<div>").addClass(ALL_DAY_PANEL_CLASS);
        this.$allDayTitle = (0, _renderer.default)("<div>").appendTo(this.$headerPanelEmptyCell)
    }
    dateTableScrollableConfig() {
        let config = {
            useKeyboard: false,
            bounceEnabled: false,
            updateManually: true,
            onScroll: () => {
                if (this.groupedStrategy instanceof _work_space_grouped_strategy_vertical.default) {
                    this.groupedStrategy.cache.clear()
                }
            },
            onInitialized: _ref => {
                let {
                    component: component
                } = _ref;
                const useKeyboardDisabled = false === (null === component || void 0 === component ? void 0 : component.option().useKeyboard);
                const useNativeEnabled = true === (null === component || void 0 === component ? void 0 : component.option().useNative);
                if (useKeyboardDisabled && useNativeEnabled) {
                    (0, _renderer.default)(null === component || void 0 === component ? void 0 : component.container()).attr("tabindex", -1)
                }
            },
            onOptionChanged: _ref2 => {
                let {
                    fullName: fullName,
                    value: value,
                    component: component
                } = _ref2;
                const useKeyboardDisabled = false === component.option().useKeyboard;
                if (useKeyboardDisabled && "useNative" === fullName && true === value) {
                    (0, _renderer.default)(component.container()).attr("tabindex", -1)
                }
            }
        };
        if (this.needCreateCrossScrolling()) {
            config = (0, _extend.extend)(config, this.createCrossScrollingConfig(config))
        }
        if (this.isVirtualScrolling() && (this.virtualScrollingDispatcher.horizontalScrollingAllowed || this.virtualScrollingDispatcher.height)) {
            const currentOnScroll = config.onScroll;
            config = Object.assign({}, config, {
                onScroll: e => {
                    null === currentOnScroll || void 0 === currentOnScroll || currentOnScroll(e);
                    this.virtualScrollingDispatcher.handleOnScrollEvent(null === e || void 0 === e ? void 0 : e.scrollOffset)
                }
            })
        }
        return config
    }
    createCrossScrollingConfig(_ref3) {
        let {
            onScroll: onScroll
        } = _ref3;
        return {
            direction: "both",
            onScroll: event => {
                var _event$scrollOffset, _event$scrollOffset2;
                null === onScroll || void 0 === onScroll || onScroll(event);
                const top = null === (_event$scrollOffset = event.scrollOffset) || void 0 === _event$scrollOffset ? void 0 : _event$scrollOffset.top;
                const left = null === (_event$scrollOffset2 = event.scrollOffset) || void 0 === _event$scrollOffset2 ? void 0 : _event$scrollOffset2.left;
                if (void 0 !== top) {
                    var _this$scrollSync$side, _this$scrollSync;
                    null === (_this$scrollSync$side = (_this$scrollSync = this.scrollSync).sidebar) || void 0 === _this$scrollSync$side || _this$scrollSync$side.call(_this$scrollSync, {
                        top: top
                    })
                }
                if (void 0 !== left) {
                    var _this$scrollSync$head, _this$scrollSync2;
                    null === (_this$scrollSync$head = (_this$scrollSync2 = this.scrollSync).header) || void 0 === _this$scrollSync$head || _this$scrollSync$head.call(_this$scrollSync2, {
                        left: left
                    })
                }
            },
            onEnd: () => {
                this.option().onScrollEnd()
            }
        }
    }
    headerScrollableConfig() {
        return {
            useKeyboard: false,
            showScrollbar: "never",
            direction: "horizontal",
            useNative: false,
            updateManually: true,
            bounceEnabled: false,
            onScroll: event => {
                var _this$scrollSync$date, _this$scrollSync3;
                null === (_this$scrollSync$date = (_this$scrollSync3 = this.scrollSync).dateTable) || void 0 === _this$scrollSync$date || _this$scrollSync$date.call(_this$scrollSync3, {
                    left: event.scrollOffset.left
                })
            }
        }
    }
    _visibilityChanged(visible) {
        this.cache.clear();
        if (visible) {
            this.updateGroupTableHeight()
        }
        if (visible && this.needCreateCrossScrolling()) {
            this.setTableSizes()
        }
    }
    setTableSizes() {
        this.cache.clear();
        this.attachTableClasses();
        let cellWidth = this.getCellWidth();
        if (cellWidth < this.getCellMinWidth()) {
            cellWidth = this.getCellMinWidth()
        }
        const minWidth = this.getWorkSpaceMinWidth();
        const groupCount = this.getGroupCount();
        const totalCellCount = this.getTotalCellCount(groupCount);
        let width = cellWidth * totalCellCount;
        if (width < minWidth) {
            width = minWidth
        }(0, _size.setWidth)(this.$headerPanel, width);
        (0, _size.setWidth)(this.$dateTable, width);
        if (this.$allDayTable) {
            (0, _size.setWidth)(this.$allDayTable, width)
        }
        this.attachHeaderTableClasses();
        this.updateGroupTableHeight();
        this.updateScrollable()
    }
    getWorkSpaceMinWidth() {
        return this.groupedStrategy.getWorkSpaceMinWidth()
    }
    _dimensionChanged() {
        if (!this._isVisible()) {
            return
        }
        if (this.option().crossScrollingEnabled) {
            this.setTableSizes()
        }
        this.updateHeaderEmptyCellWidth();
        this.updateScrollable();
        this.cache.clear()
    }
    needCreateCrossScrolling() {
        return this.option().crossScrollingEnabled
    }
    getElementClass() {
        return ""
    }
    getRowCount() {
        return this.viewDataProvider.getRowCount({
            intervalCount: this.option().intervalCount,
            currentDate: this.option().currentDate,
            viewType: this.type,
            hoursInterval: this.option().hoursInterval,
            startDayHour: this.option().startDayHour,
            endDayHour: this.option().endDayHour
        })
    }
    getCellCount() {
        return this.viewDataProvider.getCellCount({
            intervalCount: this.option().intervalCount,
            currentDate: this.option().currentDate,
            viewType: this.type,
            hoursInterval: this.option().hoursInterval,
            startDayHour: this.option().startDayHour,
            endDayHour: this.option().endDayHour
        })
    }
    isVirtualModeOn() {
        return "virtual" === this.option().scrolling.mode
    }
    isVirtualScrolling() {
        return this.renovatedRenderSupported() && this.isVirtualModeOn()
    }
    initVirtualScrolling() {
        if (this.virtualScrollingDispatcher) {
            this.virtualScrollingDispatcher.dispose()
        }
        this.virtualScrollingDispatcher = new _virtual_scrolling.VirtualScrollingDispatcher(this.getVirtualScrollingDispatcherOptions());
        this.virtualScrollingDispatcher.attachScrollableEvents();
        this.renderer = new _virtual_scrolling.VirtualScrollingRenderer(this)
    }
    isGroupedAllDayPanel() {
        return (0, _index3.calculateIsGroupedAllDayPanel)(this.option().groups.length, this.option().groupOrientation, this.isAllDayPanelVisible)
    }
    generateRenderOptions() {
        var _this$getToday;
        let isProvideVirtualCellsWidth = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false;
        const groupCount = this.getGroupCount();
        const groupOrientation = groupCount > 0 ? this.option().groupOrientation : this.getDefaultGroupStrategy();
        const renderState = this.virtualScrollingDispatcher.getRenderState();
        const options = Object.assign({
            groupByDate: this.option().groupByDate,
            groupOrientation: groupOrientation,
            today: (null === (_this$getToday = this.getToday) || void 0 === _this$getToday ? void 0 : _this$getToday.call(this)) ?? new Date,
            getResourceManager: this.option().getResourceManager,
            isProvideVirtualCellsWidth: isProvideVirtualCellsWidth,
            isAllDayPanelVisible: this.isAllDayPanelVisible,
            selectedCells: this.cellsSelectionState.getSelectedCells(),
            focusedCell: this.cellsSelectionState.getFocusedCell(),
            headerCellTextFormat: this.getFormat(),
            getDateForHeaderText: (_, date) => date,
            viewOffset: this.option().viewOffset,
            startDayHour: this.option().startDayHour,
            endDayHour: this.option().endDayHour,
            cellDuration: this.getCellDuration(),
            viewType: this.type,
            intervalCount: this.option().intervalCount,
            hoursInterval: this.option().hoursInterval,
            currentDate: this.option().currentDate,
            startDate: this.option().startDate ?? void 0,
            firstDayOfWeek: this.option().firstDayOfWeek ?? 0,
            showCurrentTimeIndicator: this.option().showCurrentTimeIndicator,
            skippedDays: this.option().skippedDays
        }, renderState, {
            startRowIndex: renderState.startRowIndex ?? 0,
            startCellIndex: renderState.startCellIndex ?? 0
        });
        return options
    }
    renovatedRenderSupported() {
        return true
    }
    updateGroupTableHeight() {
        if (this.isVerticalGroupedWorkSpace() && (0, _window.hasWindow)()) {
            this.setHorizontalGroupHeaderCellsHeight()
        }
    }
    updateHeaderEmptyCellWidth() {
        if ((0, _window.hasWindow)() && this.isRenderHeaderPanelEmptyCell()) {
            const timePanelWidth = this.getTimePanelWidth();
            const groupPanelWidth = this.getGroupTableWidth();
            this.$headerPanelEmptyCell.css("width", timePanelWidth + groupPanelWidth)
        }
    }
    updateHeaderPanelScrollbarPadding() {
        if ((0, _window.hasWindow)() && this.$headerPanelContainer) {
            const scrollbarWidth = this.getScrollbarWidth();
            this.$headerPanelContainer.css("paddingRight", `${scrollbarWidth}px`)
        }
    }
    getScrollbarWidth() {
        const containerElement = (0, _renderer.default)(this.$dateTableScrollable.container()).get(0);
        const scrollbarWidth = containerElement.offsetWidth - containerElement.clientWidth;
        return scrollbarWidth
    }
    isGroupsSpecified(groupValues) {
        var _this$option$groups3;
        return (null === (_this$option$groups3 = this.option().groups) || void 0 === _this$option$groups3 ? void 0 : _this$option$groups3.length) && groupValues
    }
    getGroupIndexByGroupValues(groupValues) {
        return groupValues && (0, _appointment_groups_utils.getAppointmentGroupIndex)((0, _appointment_groups_utils.getSafeGroupValues)(groupValues), this.resourceManager.groupsLeafs)[0]
    }
    getViewStartByOptions() {
        return (0, _index3.getViewStartByOptions)(this.option().startDate ?? void 0, this.option().currentDate, this.getTotalViewDuration(), this.option().startDate ? this.calculateViewStartDate() : void 0)
    }
    getTotalViewDuration() {
        return this.viewDataProvider.getIntervalDuration(this.option().intervalCount)
    }
    getHeaderDate() {
        return this.getStartViewDate()
    }
    calculateViewStartDate() {
        return (0, _index3.calculateViewStartDate)(this.option().startDate ?? void 0)
    }
    firstDayOfWeek() {
        return this.viewDataProvider.getFirstDayOfWeek(this.option().firstDayOfWeek ?? 0)
    }
    attachEvents() {
        this.createSelectionChangedAction();
        this.createSelectionEndAction();
        this.attachClickEvent();
        this.attachContextMenuEvent()
    }
    attachClickEvent() {
        const pointerDownAction = this._createAction(e => {
            this.pointerDownHandler(e.event)
        });
        this.createCellClickAction();
        const cellSelector = `.${DATE_TABLE_CELL_CLASS},.${ALL_DAY_TABLE_CELL_CLASS}`;
        const $element = this.$element();
        _events_engine.default.off($element, SCHEDULER_WORKSPACE_DXPOINTERDOWN_EVENT_NAME);
        _events_engine.default.off($element, SCHEDULER_CELL_DXCLICK_EVENT_NAME);
        _events_engine.default.on($element, SCHEDULER_WORKSPACE_DXPOINTERDOWN_EVENT_NAME, e => {
            if ((0, _index.isMouseEvent)(e) && e.which > 1) {
                e.preventDefault();
                return
            }
            pointerDownAction({
                event: e
            })
        });
        _events_engine.default.on($element, SCHEDULER_CELL_DXCLICK_EVENT_NAME, cellSelector, e => {
            var _this$cellClickAction2;
            const $cell = (0, _renderer.default)(e.target);
            null === (_this$cellClickAction2 = this.cellClickAction) || void 0 === _this$cellClickAction2 || _this$cellClickAction2.call(this, {
                event: e,
                cellElement: (0, _element.getPublicElement)($cell),
                cellData: this.getCellData($cell)
            })
        });
        if (this.documentPointerUpHandler) {
            _events_engine.default.off(_dom_adapter.default.getDocument(), SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME, this.documentPointerUpHandler)
        }
        this.documentPointerUpHandler = () => {
            if (this.isSelectionStartedOnCell && !this._disposed) {
                this.fireSelectionEndEvent();
                this.isSelectionStartedOnCell = false
            }
        };
        _events_engine.default.on(_dom_adapter.default.getDocument(), SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME, this.documentPointerUpHandler)
    }
    createWorkspaceOptionAction(optionName, config) {
        return this._createActionByOption(optionName, config)
    }
    createCellClickAction() {
        this.cellClickAction = this.createWorkspaceOptionAction("onCellClick", {
            afterExecute: () => this.cellClickHandler()
        })
    }
    createSelectionChangedAction() {
        this.selectionChangedAction = this.createWorkspaceOptionAction("onSelectionChanged")
    }
    createSelectionEndAction() {
        this.selectionEndAction = this.createWorkspaceOptionAction("onSelectionEnd")
    }
    cellClickHandler() {
        if (this.showPopup) {
            delete this.showPopup;
            this.isSelectionStartedOnCell = false;
            this.handleSelectedCellsClick()
        }
    }
    pointerDownHandler(e) {
        const $target = (0, _renderer.default)(e.target);
        if (!$target.hasClass(DATE_TABLE_CELL_CLASS) && !$target.hasClass(ALL_DAY_TABLE_CELL_CLASS)) {
            this.isCellClick = false;
            this.isSelectionStartedOnCell = false;
            return
        }
        this.isCellClick = true;
        if ($target.hasClass("dx-scheduler-focused-cell")) {
            this.showPopup = true;
            this.isSelectionStartedOnCell = false
        } else {
            this.isSelectionStartedOnCell = true;
            const cellCoordinates = this.getCoordinatesByCell($target);
            const isAllDayCell = this.hasAllDayClass($target);
            this.setSelectedCellsStateAndUpdateSelection(isAllDayCell, cellCoordinates, false, $target)
        }
    }
    handleSelectedCellsClick() {
        const selectedCells = this.getSelectedCellsData();
        const firstCellData = selectedCells[0];
        const lastCellData = selectedCells[selectedCells.length - 1];
        const result = {
            startDate: firstCellData.startDate,
            endDate: lastCellData.endDate,
            startDateUTC: firstCellData.startDateUTC,
            endDateUTC: lastCellData.endDateUTC
        };
        if (void 0 !== lastCellData.allDay) {
            result.allDay = lastCellData.allDay
        }
        this.option().onSelectedCellsClick(result, lastCellData.groups)
    }
    attachContextMenuEvent() {
        this.createContextMenuAction();
        const cellSelector = `.${DATE_TABLE_CELL_CLASS},.${ALL_DAY_TABLE_CELL_CLASS}`;
        const $element = this.$element();
        const eventName = (0, _index.addNamespace)(_contextmenu.name, this.NAME);
        _events_engine.default.off($element, eventName, cellSelector);
        _events_engine.default.on($element, eventName, cellSelector, this.contextMenuHandler.bind(this))
    }
    contextMenuHandler(e) {
        var _this$contextMenuActi;
        const $cell = (0, _renderer.default)(e.target);
        null === (_this$contextMenuActi = this.contextMenuAction) || void 0 === _this$contextMenuActi || _this$contextMenuActi.call(this, {
            event: e,
            cellElement: (0, _element.getPublicElement)($cell),
            cellData: this.getCellData($cell)
        });
        this.contextMenuHandled = true
    }
    createContextMenuAction() {
        this.contextMenuAction = this.createWorkspaceOptionAction("onCellContextMenu")
    }
    getGroupHeaderContainer() {
        if (this.isVerticalGroupedWorkSpace()) {
            return this.$groupTable
        }
        return this.$thead
    }
    updateScrollable() {
        var _this$headerScrollabl, _this$$sidebarScrolla;
        this.$dateTableScrollable.update();
        null === (_this$headerScrollabl = this.headerScrollable) || void 0 === _this$headerScrollabl || _this$headerScrollabl.update();
        null === (_this$$sidebarScrolla = this.$sidebarScrollable) || void 0 === _this$$sidebarScrolla || _this$$sidebarScrolla.update();
        this.updateHeaderPanelScrollbarPadding()
    }
    getTimePanelRowCount() {
        return this.getCellCountInDay()
    }
    getCellCountInDay() {
        const {
            hoursInterval: hoursInterval,
            startDayHour: startDayHour,
            endDayHour: endDayHour
        } = this.option();
        return this.viewDataProvider.getCellCountInDay(startDayHour, endDayHour, hoursInterval)
    }
    getTotalCellCount(groupCount) {
        return this.groupedStrategy.getTotalCellCount(groupCount)
    }
    getTotalRowCount(groupCount, includeAllDayPanelRows) {
        let result = this.groupedStrategy.getTotalRowCount();
        if (includeAllDayPanelRows && this.isAllDayPanelVisible) {
            result += groupCount
        }
        return result
    }
    getGroupIndex(rowIndex, columnIndex) {
        return this.groupedStrategy.getGroupIndex(rowIndex, columnIndex)
    }
    calculateEndDate(startDate) {
        const {
            viewDataGenerator: viewDataGenerator
        } = this.viewDataProvider;
        return viewDataGenerator.calculateEndDate(startDate, viewDataGenerator.getInterval(this.option().hoursInterval), this.option().endDayHour)
    }
    getGroupCount() {
        return this.resourceManager.groupCount()
    }
    attachTablesEvents() {
        const element = this.$element();
        this.attachDragEvents(element);
        this.attachPointerEvents(element)
    }
    detachDragEvents(element) {
        _events_engine.default.off(element, DragEventNames.ENTER);
        _events_engine.default.off(element, DragEventNames.LEAVE);
        _events_engine.default.off(element, DragEventNames.DROP)
    }
    attachDragEvents(element) {
        this.detachDragEvents(element);
        _events_engine.default.on(element, DragEventNames.ENTER, DRAG_AND_DROP_SELECTOR, {
            checkDropTarget: (target, event) => !this.isOutsideScrollable(target, event)
        }, e => {
            if (!this.preventDefaultDragging) {
                this.removeDroppableCellClass();
                (0, _renderer.default)(e.target).addClass(DATE_TABLE_DROPPABLE_CELL_CLASS)
            }
        });
        _events_engine.default.on(element, DragEventNames.LEAVE, () => {
            if (!this.preventDefaultDragging) {
                this.removeDroppableCellClass()
            }
        });
        _events_engine.default.on(element, DragEventNames.DROP, DRAG_AND_DROP_SELECTOR, () => {
            var _this$dragBehavior, _this$dragBehavior$dr;
            if (!this.dragBehavior) {
                return
            }
            if (!(null !== (_this$dragBehavior = this.dragBehavior) && void 0 !== _this$dragBehavior && _this$dragBehavior.dragBetweenComponentsPromise)) {
                this.dragBehavior.removeDroppableClasses();
                return
            }
            null === (_this$dragBehavior$dr = this.dragBehavior.dragBetweenComponentsPromise) || void 0 === _this$dragBehavior$dr || _this$dragBehavior$dr.then(() => {
                var _this$dragBehavior2;
                null === (_this$dragBehavior2 = this.dragBehavior) || void 0 === _this$dragBehavior2 || _this$dragBehavior2.removeDroppableClasses()
            })
        })
    }
    attachPointerEvents(element) {
        let isPointerDown = false;
        _events_engine.default.off(element, SCHEDULER_CELL_DXPOINTERMOVE_EVENT_NAME);
        _events_engine.default.off(element, SCHEDULER_CELL_DXPOINTERDOWN_EVENT_NAME);
        _events_engine.default.on(element, SCHEDULER_CELL_DXPOINTERDOWN_EVENT_NAME, DRAG_AND_DROP_SELECTOR, e => {
            if (((0, _index.isMouseEvent)(e) || e.originalEvent && (0, _index.isMouseEvent)(e.originalEvent)) && 1 === e.which) {
                isPointerDown = true;
                this.$element().addClass(WORKSPACE_WITH_MOUSE_SELECTION_CLASS);
                _events_engine.default.off(_dom_adapter.default.getDocument(), SCHEDULER_CELL_DXPOINTERUP_EVENT_NAME);
                _events_engine.default.on(_dom_adapter.default.getDocument(), SCHEDULER_CELL_DXPOINTERUP_EVENT_NAME, () => {
                    isPointerDown = false;
                    this.$element().removeClass(WORKSPACE_WITH_MOUSE_SELECTION_CLASS)
                })
            }
        });
        _events_engine.default.on(element, SCHEDULER_CELL_DXPOINTERMOVE_EVENT_NAME, DRAG_AND_DROP_SELECTOR, e => {
            if (isPointerDown && this.$dateTableScrollable) {
                e.preventDefault();
                e.stopPropagation();
                this.moveToCell((0, _renderer.default)(e.target), true)
            }
        })
    }
    getFormat() {
        return abstract()
    }
    getWorkArea() {
        return this.$dateTableContainer
    }
    getScrollable() {
        return this.$dateTableScrollable
    }
    getScrollableScrollTop() {
        return this.$dateTableScrollable.scrollTop()
    }
    getGroupedScrollableScrollTop(allDay) {
        return this.groupedStrategy.getScrollableScrollTop(allDay)
    }
    getScrollableScrollLeft() {
        return this.$dateTableScrollable.scrollLeft()
    }
    getScrollableOuterWidth() {
        return this.$dateTableScrollable.scrollWidth()
    }
    getScrollableContainer() {
        return (0, _renderer.default)(this.$dateTableScrollable.container())
    }
    getHeaderPanelHeight() {
        return this.$headerPanel && (0, _size.getOuterHeight)(this.$headerPanel, true)
    }
    getTimePanelWidth() {
        return this.$timePanel && (0, _position.getBoundingRect)(this.$timePanel.get(0)).width
    }
    getGroupTableWidth() {
        return this.$groupTable ? (0, _size.getOuterWidth)(this.$groupTable) : 0
    }
    getWorkSpaceLeftOffset() {
        return this.groupedStrategy.getLeftOffset()
    }
    getCellCoordinatesByIndex(index) {
        const columnIndex = Math.floor(index / this.getRowCount());
        const rowIndex = index - this.getRowCount() * columnIndex;
        return {
            columnIndex: columnIndex,
            rowIndex: rowIndex
        }
    }
    getDateGenerationOptions() {
        var _this$viewDataProvide;
        return {
            startDayHour: this.option().startDayHour,
            endDayHour: this.option().endDayHour,
            hoursInterval: this.option().hoursInterval,
            interval: null === (_this$viewDataProvide = this.viewDataProvider.viewDataGenerator) || void 0 === _this$viewDataProvide ? void 0 : _this$viewDataProvide.getInterval(this.option().hoursInterval),
            intervalCount: this.option().intervalCount,
            startViewDate: this.getStartViewDate(),
            firstDayOfWeek: this.firstDayOfWeek(),
            skippedDays: this.option().skippedDays,
            viewOffset: 0,
            viewType: this.type
        }
    }
    getIntervalBetween(currentDate, allDay) {
        const firstViewDate = this.getStartViewDate();
        const startDayTime = this.option().startDayHour * HOUR_MS;
        const timeZoneOffset = _date.default.getTimezonesDifference(firstViewDate, currentDate);
        const fullInterval = currentDate.getTime() - firstViewDate.getTime() - timeZoneOffset;
        const days = this.getDaysOfInterval(fullInterval, startDayTime);
        const skippedDaysCount = this.getSkippedDaysCount(firstViewDate, days);
        let result = (days - skippedDaysCount) * DAY_MS;
        if (!allDay) {
            const {
                hiddenInterval: hiddenInterval
            } = this.viewDataProvider;
            const visibleDayDuration = this.getVisibleDayDuration();
            result = fullInterval - days * hiddenInterval - skippedDaysCount * visibleDayDuration
        }
        return result
    }
    getSkippedDaysCount(startDate, days) {
        return (0, _skipped_days.getSkippedDaysCount)(startDate, days, this.option().skippedDays)
    }
    getDaysOfInterval(fullInterval, startDayTime) {
        return Math.floor((fullInterval + startDayTime) / DAY_MS)
    }
    updateIndex(index) {
        return index * this.getRowCount()
    }
    getDroppableCell() {
        return this.getDateTables().find(`.${DATE_TABLE_DROPPABLE_CELL_CLASS}`)
    }
    getWorkSpaceWidth() {
        return this.cache.memo("workspaceWidth", () => {
            if (this.needCreateCrossScrolling()) {
                return (0, _position.getBoundingRect)(this.$dateTable.get(0)).width
            }
            const totalWidth = (0, _position.getBoundingRect)(this.$element().get(0)).width;
            const timePanelWidth = this.getTimePanelWidth();
            const groupTableWidth = this.getGroupTableWidth();
            return totalWidth - timePanelWidth - groupTableWidth
        })
    }
    getCellElementByPosition(cellCoordinates, groupIndex, inAllDayRow) {
        const indexes = this.groupedStrategy.prepareCellIndexes(cellCoordinates, groupIndex, inAllDayRow);
        return this.domGetDateCell(indexes)
    }
    domGetDateCell(position) {
        return this.$dateTable.find(`tr:not(.${VIRTUAL_ROW_CLASS})`).eq(position.rowIndex).find(`td:not(.${_classes.VIRTUAL_CELL_CLASS})`).eq(position.columnIndex)
    }
    domGetAllDayPanelCell(columnIndex) {
        return this.$allDayPanel.find("tr").eq(0).find("td").eq(columnIndex)
    }
    getCells(allDay, direction) {
        const cellClass = allDay ? ALL_DAY_TABLE_CELL_CLASS : DATE_TABLE_CELL_CLASS;
        if ("vertical" === direction) {
            let result = [];
            for (let i = 1;; i += 1) {
                const cells = this.$element().find(`tr .${cellClass}:nth-child(${i})`);
                if (!cells.length) {
                    break
                }
                result = result.concat(cells.toArray())
            }
            return (0, _renderer.default)(result)
        }
        return this.$element().find(`.${cellClass}`)
    }
    getFirstAndLastDataTableCell() {
        const selector = this.isVirtualScrolling() ? `.${DATE_TABLE_CELL_CLASS}, .${_classes.VIRTUAL_CELL_CLASS}` : `.${DATE_TABLE_CELL_CLASS}`;
        const $cells = this.$element().find(selector);
        return [$cells.get(0), $cells.get(-1)]
    }
    getAllCells(allDay) {
        if (this.isVerticalGroupedWorkSpace()) {
            return this.$dateTable.find(`td:not(.${_classes.VIRTUAL_CELL_CLASS})`)
        }
        const cellClass = allDay && this.supportAllDayRow() ? ALL_DAY_TABLE_CELL_CLASS : DATE_TABLE_CELL_CLASS;
        return this.$element().find(`.${cellClass}`)
    }
    setHorizontalGroupHeaderCellsHeight() {
        const {
            height: height
        } = (0, _position.getBoundingRect)(this.$dateTable.get(0));
        (0, _size.setOuterHeight)(this.$groupTable, height)
    }
    getGroupHeaderCells() {
        return this.$element().find(`.${GROUP_HEADER_CLASS}`)
    }
    getScrollCoordinates(date, groupIndex, allDay) {
        const currentDate = date || new Date(this.option().currentDate);
        const cell = this.viewDataProvider.findGlobalCellPosition(currentDate, groupIndex, allDay, true);
        if (!cell) {
            return
        }
        currentDate.setHours(cell.cellData.startDate.getHours(), currentDate.getMinutes(), 0, 0);
        return this.virtualScrollingDispatcher.calculateCoordinatesByDataAndPosition(cell.cellData, cell.position, currentDate, (0, _index3.isDateAndTimeView)(this.type), "vertical" === this.viewDirection)
    }
    isOutsideScrollable(target, event) {
        const $dateTableScrollableElement = this.$dateTableScrollable.$element();
        const scrollableSize = (0, _position.getBoundingRect)($dateTableScrollableElement.get(0));
        const window = (0, _window.getWindow)();
        const isTargetInAllDayPanel = !(0, _renderer.default)(target).closest($dateTableScrollableElement).length;
        const isOutsideHorizontalScrollable = event.pageX < scrollableSize.left || event.pageX > scrollableSize.left + scrollableSize.width + (window.scrollX || 0);
        const isOutsideVerticalScrollable = event.pageY < scrollableSize.top || event.pageY > scrollableSize.top + scrollableSize.height + (window.scrollY || 0);
        if (isTargetInAllDayPanel && !isOutsideHorizontalScrollable) {
            return false
        }
        return isOutsideVerticalScrollable || isOutsideHorizontalScrollable
    }
    supportAllDayRow() {
        return true
    }
    keepOriginalHours() {
        return false
    }
    normalizeCellData(cellData) {
        var _this$timeZoneCalcula, _this$timeZoneCalcula2;
        const normalizedCellData = {
            startDate: cellData.startDate ?? new Date,
            endDate: cellData.endDate ?? new Date,
            startDateUTC: cellData.startDate && (null === (_this$timeZoneCalcula = this.timeZoneCalculator) || void 0 === _this$timeZoneCalcula ? void 0 : _this$timeZoneCalcula.createDate(cellData.startDate, "fromGrid")),
            endDateUTC: cellData.endDate && (null === (_this$timeZoneCalcula2 = this.timeZoneCalculator) || void 0 === _this$timeZoneCalcula2 ? void 0 : _this$timeZoneCalcula2.createDate(cellData.endDate, "fromGrid")),
            groups: cellData.groups,
            groupIndex: cellData.groupIndex,
            allDay: cellData.allDay
        };
        return (0, _extend.extend)(true, {}, normalizedCellData)
    }
    getSelectedCellsData() {
        const selected = this.cellsSelectionState.getSelectedCells();
        return (null === selected || void 0 === selected ? void 0 : selected.map(this.normalizeCellData.bind(this))) ?? []
    }
    getCellData($cell) {
        const cellData = this.getFullCellData($cell) ?? {};
        return this.normalizeCellData(cellData)
    }
    getFullCellData($cell) {
        const currentCell = $cell[0];
        if (currentCell) {
            return this.getDataByCell($cell)
        }
        return
    }
    getDataByCell($cell) {
        const rowIndex = $cell.parent().index() - this.virtualScrollingDispatcher.topVirtualRowsCount;
        const columnIndex = $cell.index() - this.virtualScrollingDispatcher.leftVirtualCellsCount;
        const {
            viewDataProvider: viewDataProvider
        } = this;
        const isAllDayCell = this.hasAllDayClass($cell);
        const cellData = viewDataProvider.getCellData(rowIndex, columnIndex, isAllDayCell);
        return cellData || void 0
    }
    isGroupedByDate() {
        return this.option().groupByDate && this.isHorizontalGroupedWorkSpace() && this.getGroupCount() > 0
    }
    getCellIndexByDate(date, inAllDayRow) {
        const {
            viewDataGenerator: viewDataGenerator
        } = this.viewDataProvider;
        const timeInterval = inAllDayRow ? 864e5 : viewDataGenerator.getInterval(this.option().hoursInterval);
        const startViewDateOffset = (0, _index3.getStartViewDateTimeOffset)(this.getStartViewDate(), this.option().startDayHour);
        const dateTimeStamp = this.getIntervalBetween(date, inAllDayRow ?? false) + startViewDateOffset;
        let index = Math.floor(dateTimeStamp / timeInterval);
        if (inAllDayRow) {
            index = this.updateIndex(index)
        }
        if (index < 0) {
            index = 0
        }
        return index
    }
    getDataByDroppableCell() {
        const cellData = this.getCellData((0, _renderer.default)(this.getDroppableCell()));
        const {
            allDay: allDay
        } = cellData;
        const {
            startDate: startDate
        } = cellData;
        const {
            endDate: endDate
        } = cellData;
        return {
            startDate: startDate,
            endDate: endDate,
            allDay: allDay,
            groups: cellData.groups
        }
    }
    getDateRange() {
        return [this.getStartViewDate(), this.getEndViewDateByEndDayHour()]
    }
    getCellMinWidth() {
        return 75
    }
    getCellWidth() {
        return (0, _position_helper.getCellWidth)(this.getDOMElementsMetaData())
    }
    getCellHeight() {
        return (0, _position_helper.getCellHeight)(this.getDOMElementsMetaData())
    }
    getAllDayHeight() {
        return (0, _position_helper.getAllDayHeight)(this.option().showAllDayPanel, this.isVerticalGroupedWorkSpace(), this.getDOMElementsMetaData())
    }
    getIndicatorOffset() {
        return 0
    }
    getIndicationHeight() {
        return 0
    }
    getIndicationWidth() {
        return 0
    }
    getMaxAllowedPosition(groupIndex) {
        return (0, _position_helper.getMaxAllowedPosition)(groupIndex, this.viewDataProvider, this.option().rtlEnabled, this.getDOMElementsMetaData())
    }
    getAllDayOffset() {
        return this.groupedStrategy.getAllDayOffset()
    }
    getCellIndexByCoordinates(coordinates, allDay) {
        const {
            horizontalScrollingState: horizontalScrollingState,
            verticalScrollingState: verticalScrollingState
        } = this.virtualScrollingDispatcher;
        const cellCount = (null === horizontalScrollingState || void 0 === horizontalScrollingState ? void 0 : horizontalScrollingState.itemCount) ?? this.getTotalCellCount(this.getGroupCount());
        const cellWidth = this.getCellWidth();
        const cellHeight = allDay ? this.getAllDayHeight() : this.getCellHeight();
        const leftCoordinateOffset = (null === horizontalScrollingState || void 0 === horizontalScrollingState ? void 0 : horizontalScrollingState.virtualItemSizeBefore) ?? 0;
        const topCoordinateOffset = (null === verticalScrollingState || void 0 === verticalScrollingState ? void 0 : verticalScrollingState.virtualItemSizeBefore) ?? 0;
        const topIndex = Math.floor(Math.floor(coordinates.top - topCoordinateOffset) / Math.floor(cellHeight));
        let leftIndex = (coordinates.left - leftCoordinateOffset) / cellWidth;
        leftIndex = Math.floor(leftIndex + .05);
        if (this.isRTL()) {
            leftIndex = cellCount - leftIndex - 1
        }
        return cellCount * topIndex + leftIndex
    }
    getStartViewDate() {
        return this.viewDataProvider.getStartViewDate()
    }
    getEndViewDate() {
        return this.viewDataProvider.getLastCellEndDate()
    }
    getEndViewDateByEndDayHour() {
        return this.viewDataProvider.getLastViewDateByEndDayHour(this.option().endDayHour)
    }
    getCellDuration() {
        return (0, _index3.getCellDuration)(this.type, this.option().startDayHour, this.option().endDayHour, this.option().hoursInterval)
    }
    getIntervalDuration(allDay) {
        return allDay ? toMs("day") : this.getCellDuration()
    }
    getVisibleDayDuration() {
        const {
            startDayHour: startDayHour,
            endDayHour: endDayHour,
            hoursInterval: hoursInterval
        } = this.option();
        return this.viewDataProvider.getVisibleDayDuration(startDayHour, endDayHour, hoursInterval)
    }
    getGroupBounds(coordinates) {
        const groupBounds = this.groupedStrategy instanceof _work_space_grouped_strategy_vertical.default ? this.getGroupBoundsVertical(coordinates.groupIndex ?? 0) : this.getGroupBoundsHorizontal(coordinates);
        return this.isRTL() && groupBounds ? this.getGroupBoundsRtlCorrection(groupBounds) : groupBounds
    }
    getGroupBoundsVertical(groupIndex) {
        const $firstAndLastCells = this.getFirstAndLastDataTableCell();
        if (this.groupedStrategy instanceof _work_space_grouped_strategy_vertical.default) {
            return this.groupedStrategy.getGroupBoundsOffset(groupIndex, [$firstAndLastCells[0], $firstAndLastCells[1]])
        }
        return
    }
    getGroupBoundsHorizontal(coordinates) {
        const cellCount = this.getCellCount();
        const $cells = this.getCells();
        const cellWidth = this.getCellWidth();
        const {
            groupedDataMap: groupedDataMap
        } = this.viewDataProvider;
        if (this.groupedStrategy instanceof _work_space_grouped_strategy_horizontal.default) {
            return this.groupedStrategy.getGroupBoundsOffset(cellCount, $cells, cellWidth, coordinates, groupedDataMap)
        }
        return
    }
    getGroupBoundsRtlCorrection(groupBounds) {
        const cellWidth = this.getCellWidth();
        return Object.assign({}, groupBounds, {
            left: groupBounds.right - 2 * cellWidth,
            right: groupBounds.left + 2 * cellWidth
        })
    }
    needRecalculateResizableArea() {
        return this.isVerticalGroupedWorkSpace() && 0 !== this.getScrollable().scrollTop()
    }
    getCellByCoordinates(coordinates, allDay) {
        const $cells = this.getCells(allDay);
        const cellIndex = this.getCellIndexByCoordinates(coordinates, allDay);
        return $cells.eq(cellIndex)
    }
    getVisibleBounds() {
        const $scrollable = this.getScrollable().$element();
        const cellHeight = this.getCellHeight();
        const scrolledCellCount = this.getScrollableScrollTop() / cellHeight;
        const totalCellCount = scrolledCellCount + (0, _size.getHeight)($scrollable) / cellHeight;
        const result = {
            top: {
                hours: Math.floor(scrolledCellCount * this.option().hoursInterval) + this.option().startDayHour,
                minutes: scrolledCellCount % 2 ? 30 : 0
            },
            bottom: {
                hours: Math.floor(totalCellCount * this.option().hoursInterval) + this.option().startDayHour,
                minutes: Math.floor(totalCellCount) % 2 ? 30 : 0
            }
        };
        return result
    }
    updateScrollPosition(date, appointmentGroupValues) {
        var _this$timeZoneCalcula3;
        let allDay = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false;
        const newDate = (null === (_this$timeZoneCalcula3 = this.timeZoneCalculator) || void 0 === _this$timeZoneCalcula3 ? void 0 : _this$timeZoneCalcula3.createDate(date, "toGrid")) ?? date;
        const inAllDayRow = allDay && this.isAllDayPanelVisible;
        if (this.needUpdateScrollPosition(newDate, appointmentGroupValues, inAllDayRow)) {
            this.scrollTo(newDate, appointmentGroupValues, inAllDayRow, false)
        }
    }
    needUpdateScrollPosition(date, appointmentGroupValues) {
        let inAllDayRow = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false;
        const cells = this.getCellsInViewport(inAllDayRow);
        const groupIndex = this.isGroupsSpecified(appointmentGroupValues) ? this.getGroupIndexByGroupValues(appointmentGroupValues) : 0;
        const time = date.getTime();
        const trimmedTime = _date.default.trimTime(date).getTime();
        return cells.reduce((currentResult, cell) => {
            const {
                startDate: cellStartDate,
                endDate: cellEndDate,
                groupIndex: cellGroupIndex
            } = this.getCellData(cell);
            const cellStartTime = cellStartDate.getTime();
            const cellEndTime = cellEndDate.getTime();
            if ((!inAllDayRow && cellStartTime <= time && time < cellEndTime || inAllDayRow && trimmedTime === cellStartTime) && groupIndex === cellGroupIndex) {
                return false
            }
            return currentResult
        }, true)
    }
    getCellsInViewport(inAllDayRow) {
        const $scrollable = this.getScrollable().$element();
        const cellHeight = this.getCellHeight();
        const cellWidth = this.getCellWidth();
        const totalColumnCount = this.getTotalCellCount(this.getGroupCount());
        const scrollableScrollTop = this.getScrollableScrollTop();
        const scrollableScrollLeft = this.getScrollableScrollLeft();
        const fullScrolledRowCount = scrollableScrollTop / cellHeight - this.virtualScrollingDispatcher.topVirtualRowsCount;
        let scrolledRowCount = Math.floor(fullScrolledRowCount);
        if (scrollableScrollTop % cellHeight !== 0) {
            scrolledRowCount += 1
        }
        const fullScrolledColumnCount = scrollableScrollLeft / cellWidth;
        let scrolledColumnCount = Math.floor(fullScrolledColumnCount);
        if (scrollableScrollLeft % cellWidth !== 0) {
            scrolledColumnCount += 1
        }
        const rowCount = Math.floor(fullScrolledRowCount + (0, _size.getHeight)($scrollable) / cellHeight);
        const columnCount = Math.floor(fullScrolledColumnCount + (0, _size.getWidth)($scrollable) / cellWidth);
        const $cells = this.getAllCells(inAllDayRow);
        const result = [];
        $cells.toArray().forEach((_, index) => {
            const $cell = $cells.eq(index);
            const columnIndex = index % totalColumnCount;
            const rowIndex = index / totalColumnCount;
            if (scrolledColumnCount <= columnIndex && columnIndex < columnCount && scrolledRowCount <= rowIndex && rowIndex < rowCount) {
                result.push($cell)
            }
        });
        return result
    }
    scrollTo(date, groupValues) {
        let allDay = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : false;
        let throwWarning = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : true;
        let align = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "center";
        if (!this.isValidScrollDate(date, throwWarning)) {
            return
        }
        const groupIndex = this.getGroupCount() && groupValues ? this.getGroupIndexByGroupValues(groupValues) : 0;
        const isScrollToAllDay = allDay && this.isAllDayPanelVisible;
        const coordinates = this.getScrollCoordinates(date, groupIndex, isScrollToAllDay);
        if (!coordinates) {
            return
        }
        const scrollable = this.getScrollable();
        const $scrollable = scrollable.$element();
        const cellWidth = this.getCellWidth();
        const offset = this.option().rtlEnabled ? cellWidth : 0;
        const scrollableHeight = (0, _size.getHeight)($scrollable);
        const scrollableWidth = (0, _size.getWidth)($scrollable);
        const cellHeight = this.getCellHeight();
        const xShift = "start" === align ? 0 : (scrollableWidth - cellWidth) / 2;
        const yShift = "start" === align ? 0 : (scrollableHeight - cellHeight) / 2;
        const left = coordinates.left - scrollable.scrollLeft() - xShift - offset;
        let top = coordinates.top - scrollable.scrollTop() - yShift;
        if (isScrollToAllDay && !this.isVerticalGroupedWorkSpace()) {
            top = 0
        }
        if (this.option().templatesRenderAsynchronously) {
            setTimeout(() => {
                scrollable.scrollBy({
                    left: left,
                    top: top
                })
            })
        } else {
            scrollable.scrollBy({
                left: left,
                top: top
            })
        }
    }
    isValidScrollDate(date) {
        let throwWarning = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : true;
        const {
            viewOffset: viewOffset
        } = this.option();
        const min = new Date(this.getStartViewDate().getTime() + viewOffset);
        const max = new Date(this.getEndViewDate().getTime() + viewOffset);
        if (date < min || date > max) {
            if (throwWarning) {
                _ui.default.log("W1008", date)
            }
            return false
        }
        return true
    }
    needApplyCollectorOffset() {
        return false
    }
    removeDroppableCellClass($cellElement) {
        const $cell = $cellElement ?? this.getDroppableCell();
        null === $cell || void 0 === $cell || $cell.removeClass(DATE_TABLE_DROPPABLE_CELL_CLASS)
    }
    getCoordinatesByCell($cell) {
        const columnIndex = $cell.index() - this.virtualScrollingDispatcher.leftVirtualCellsCount;
        let rowIndex = $cell.parent().index();
        const isAllDayCell = this.hasAllDayClass($cell);
        const isVerticalGrouping = this.isVerticalGroupedWorkSpace();
        if (!(isAllDayCell && !isVerticalGrouping)) {
            rowIndex -= this.virtualScrollingDispatcher.topVirtualRowsCount
        }
        return {
            rowIndex: rowIndex,
            columnIndex: columnIndex
        }
    }
    isShowAllDayPanel() {
        return this.option().showAllDayPanel
    }
    getTimePanelCells() {
        return this.$element().find(`.${TIME_PANEL_CELL_CLASS}`)
    }
    getRDateTableProps() {
        return {
            viewData: this.viewDataProvider.viewData,
            viewContext: this.getR1ComponentsViewContext(),
            dataCellTemplate: this.option().dataCellTemplate,
            addDateTableClass: !this.option().crossScrollingEnabled || this.isVirtualScrolling(),
            groupOrientation: this.option().groupOrientation,
            addVerticalSizesClassToRows: false
        }
    }
    getR1ComponentsViewContext() {
        return {
            view: {
                type: this.type
            },
            crossScrollingEnabled: Boolean(this.option().crossScrollingEnabled)
        }
    }
    updateSelectedCellDataOption(selectedCellData, nextFocusedCell) {
        var _this$selectionChange;
        this.option().selectedCellData = selectedCellData;
        null === (_this$selectionChange = this.selectionChangedAction) || void 0 === _this$selectionChange || _this$selectionChange.call(this, {
            selectedCellData: selectedCellData
        })
    }
    fireSelectionEndEvent() {
        const selectedCellData = this.option().selectedCellData ?? [];
        if (selectedCellData.length > 0 && this.selectionEndAction) {
            this.selectionEndAction({
                selectedCellData: selectedCellData
            })
        }
    }
    getCellByData(cellData) {
        const {
            allDay: allDay
        } = cellData;
        const position = this.viewDataProvider.findCellPositionInMap({
            startDate: cellData.startDate,
            allDay: cellData.allDay,
            groupIndex: cellData.groupIndex,
            index: cellData.index ?? 0
        });
        if (!position) {
            return
        }
        return allDay && !this.isVerticalGroupedWorkSpace() ? this.domGetAllDayPanelCell(position.columnIndex) : this.domGetDateCell(position)
    }
    getDOMElementsMetaData() {
        return this.cache.memo("cellElementsMeta", () => ({
            dateTableCellsMeta: this.getDateTableDOMElementsInfo(),
            allDayPanelCellsMeta: this.getAllDayPanelDOMElementsInfo()
        }))
    }
    getPanelDOMSize(panelName) {
        const getElementSize = element => {
            const {
                width: width,
                height: height
            } = (0, _position.getBoundingRect)(element);
            return {
                width: width,
                height: height
            }
        };
        return "allDayPanel" === panelName ? this.cache.memo("allDayPanelSize", () => getElementSize(this.$allDayPanel.get(0))) : this.cache.memo("regularPanelSize", () => getElementSize(this.getDateTable().get(0)))
    }
    getCollectorDimension(isCollectorCompact, panelName) {
        return this.cache.memo(`collectorSize-${panelName}`, () => _m_compact_appointments_helper.CompactAppointmentsHelper.measureCollectorDimensions("allDayPanel" === panelName ? this.getAllDayContainer() : this.getFixedContainer(), isCollectorCompact))
    }
    getDateTableDOMElementsInfo() {
        const dateTableCells = this.getAllCells(false);
        if (!dateTableCells.length || !(0, _window.hasWindow)()) {
            return [
                [{
                    top: 0,
                    left: 0,
                    width: 0,
                    height: 0
                }]
            ]
        }
        const dateTable = this.getDateTable();
        const dateTableRect = (0, _position.getBoundingRect)(dateTable.get(0));
        const columnsCount = this.viewDataProvider.getColumnsCount();
        const result = [];
        dateTableCells.toArray().forEach((cell, index) => {
            const rowIndex = Math.floor(index / columnsCount);
            if (result.length === rowIndex) {
                result.push([])
            }
            this.addCellMetaData(result[rowIndex], cell, dateTableRect)
        });
        return result
    }
    getAllDayPanelDOMElementsInfo() {
        const result = [];
        if (this.isAllDayPanelVisible && !this.isVerticalGroupedWorkSpace() && (0, _window.hasWindow)()) {
            const allDayCells = this.getAllCells(true);
            if (!allDayCells.length) {
                return [{
                    top: 0,
                    left: 0,
                    width: 0,
                    height: 0
                }]
            }
            const allDayAppointmentContainer = this.$allDayPanel;
            const allDayPanelRect = (0, _position.getBoundingRect)(allDayAppointmentContainer.get(0));
            allDayCells.toArray().forEach(cell => {
                this.addCellMetaData(result, cell, allDayPanelRect)
            })
        }
        return result
    }
    addCellMetaData(cellMetaDataArray, cell, parentRect) {
        const cellRect = (0, _position.getBoundingRect)(cell);
        cellMetaDataArray.push({
            left: cellRect.left - parentRect.left,
            top: cellRect.top - parentRect.top,
            width: cellRect.width,
            height: cellRect.height
        })
    }
    renderRWorkSpace() {
        let {
            header: header,
            timePanel: timePanel,
            dateTable: dateTable,
            allDayPanel: allDayPanel
        } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : DEFAULT_WORKSPACE_RENDER_OPTIONS.renderComponents;
        if (header) {
            this.renderRHeaderPanel()
        }
        if (timePanel) {
            this.renderRTimeTable()
        }
        if (dateTable) {
            this.renderRDateTable()
        }
        if (allDayPanel) {
            this.renderRAllDayPanel()
        }
    }
    renderRDateTable() {
        this.renderRenovatedComponent(this.$dateTable, _index2.DateTableComponent, "renovatedDateTable", this.getRDateTableProps())
    }
    renderRGroupPanel() {
        var _this$option$groups4;
        const options = {
            viewContext: this.getR1ComponentsViewContext(),
            groups: this.option().groups,
            groupOrientation: this.option().groupOrientation,
            groupByDate: this.isGroupedByDate(),
            resourceCellTemplate: this.option().resourceCellTemplate,
            className: this.verticalGroupTableClass,
            groupPanelData: this.viewDataProvider.getGroupPanelData(this.generateRenderOptions())
        };
        if (null !== (_this$option$groups4 = this.option().groups) && void 0 !== _this$option$groups4 && _this$option$groups4.length) {
            this.attachGroupCountClass();
            const $groupHeaderContainer = this.getGroupHeaderContainer();
            if ($groupHeaderContainer) {
                this.renderRenovatedComponent($groupHeaderContainer, _index2.GroupPanelComponent, "renovatedGroupPanel", options)
            }
        } else {
            this.detachGroupCountClass()
        }
    }
    renderRenovatedComponent(parentElement, componentClass, componentName, viewModel) {
        const host = this;
        let component = host[componentName];
        if (!component) {
            const container = (0, _element.getPublicElement)(parentElement);
            const createFn = host._createComponent;
            component = createFn.call(this, container, componentClass, viewModel);
            host[componentName] = component
        } else {
            const $element = component.$element();
            const elementStyle = $element.get(0).style;
            const {
                height: height
            } = elementStyle;
            const {
                width: width
            } = elementStyle;
            component.option(viewModel);
            if (height) {
                (0, _size.setHeight)($element, height)
            }
            if (width) {
                (0, _size.setWidth)($element, width)
            }
        }
    }
    renderRAllDayPanel() {
        const visible = this.isAllDayPanelVisible && !this.isGroupedAllDayPanel();
        if (visible) {
            var _this$virtualScrollin;
            this.updateAllDayVisibility();
            const options = Object.assign({
                viewData: this.viewDataProvider.viewData,
                viewContext: this.getR1ComponentsViewContext(),
                dataCellTemplate: this.option().dataCellTemplate,
                startCellIndex: 0
            }, (null === (_this$virtualScrollin = this.virtualScrollingDispatcher.horizontalVirtualScrolling) || void 0 === _this$virtualScrollin ? void 0 : _this$virtualScrollin.getRenderState()) ?? {});
            if (this.$allDayTable) {
                this.renderRenovatedComponent(this.$allDayTable, _index2.AllDayTableComponent, "renovatedAllDayPanel", options)
            }
            this.renderRenovatedComponent(this.$allDayTitle, _index2.AllDayPanelTitleComponent, "renovatedAllDayPanelTitle", {})
        }
        this.updateAllDayVisibility();
        this.updateScrollable()
    }
    renderRTimeTable() {
        this.renderRenovatedComponent(this.$timePanel, _index2.TimePanelComponent, "renovatedTimePanel", {
            viewContext: this.getR1ComponentsViewContext(),
            timePanelData: this.viewDataProvider.timePanelData,
            timeCellTemplate: this.option().timeCellTemplate,
            groupOrientation: this.option().groupOrientation
        })
    }
    renderRHeaderPanel() {
        var _this$option$groups5;
        let isRenderDateHeader = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : true;
        if (null !== (_this$option$groups5 = this.option().groups) && void 0 !== _this$option$groups5 && _this$option$groups5.length) {
            this.attachGroupCountClass()
        } else {
            this.detachGroupCountClass()
        }
        this.renderRenovatedComponent(this.$thead, this.renovatedHeaderPanelComponent, "renovatedHeaderPanel", {
            viewContext: this.getR1ComponentsViewContext(),
            dateHeaderData: this.viewDataProvider.dateHeaderData,
            groupPanelData: this.viewDataProvider.getGroupPanelData(this.generateRenderOptions()),
            dateCellTemplate: this.option().dateCellTemplate,
            timeCellTemplate: this.option().timeCellTemplate,
            groups: this.option().groups,
            groupByDate: this.isGroupedByDate(),
            groupOrientation: this.option().groupOrientation,
            resourceCellTemplate: this.option().resourceCellTemplate,
            isRenderDateHeader: isRenderDateHeader
        })
    }
    getCellFromDragTarget($dragTarget) {
        if (0 === $dragTarget.length) {
            return null
        }
        const point = this.getPointFromDragTarget($dragTarget);
        return this.getCellFromPoint(point.x, point.y)
    }
    getCellFromPoint(x, y) {
        const elements = _dom_adapter.default.elementsFromPoint(x, y);
        const cell = elements.find(element => element.classList.contains("dx-scheduler-date-table-cell") || element.classList.contains("dx-scheduler-all-day-table-cell"));
        return cell ? (0, _renderer.default)(cell) : null
    }
    getPointFromDragTarget($dragTarget) {
        const dragElementContainer = $dragTarget.get(0);
        const rect = dragElementContainer.getBoundingClientRect();
        const cellWidth = this.getCellWidth();
        const isWideAppointment = rect.width > cellWidth;
        const isNarrowAppointment = rect.width <= 10;
        const x = rect.left;
        const y = rect.top;
        if (isWideAppointment) {
            return {
                x: x + 10,
                y: y + 10
            }
        }
        if (isNarrowAppointment) {
            return {
                x: x,
                y: y
            }
        }
        return {
            x: x + rect.width / 2,
            y: y + 10
        }
    }
    initDragBehavior(scheduler) {
        if (!this.dragBehavior && scheduler) {
            this.dragBehavior = new _m_appointment_drag_behavior.default(scheduler);
            const $rootElement = (0, _renderer.default)(scheduler.element());
            this.createDragBehavior(this.getWorkArea(), $rootElement);
            if (!this.isVerticalGroupedWorkSpace()) {
                this.createDragBehavior(this.$allDayPanel, $rootElement)
            }
        }
    }
    createDragBehavior($targetElement, $rootElement) {
        const options = {
            getItemData: (itemElement, appointments) => appointments._getItemData(itemElement),
            getItemSettings: $itemElement => $itemElement.data(_constants.APPOINTMENT_SETTINGS_KEY)
        };
        this.createDragBehaviorBase($targetElement, $rootElement, options)
    }
    createDragBehaviorBase(targetElement, rootElement, options) {
        const container = this.$element().find(`.${_classes.FIXED_CONTAINER_CLASS}`);
        if (!this.dragBehavior) {
            return
        }
        this.dragBehavior.addTo(targetElement, createDragBehaviorConfig(container, rootElement, this.isDefaultDraggingMode, this.dragBehavior, () => {
            if (!this.isDefaultDraggingMode) {
                this.preventDefaultDragging = false
            }
        }, () => {
            if (!this.isDefaultDraggingMode) {
                this.preventDefaultDragging = true
            }
        }, () => this.getDroppableCell(), () => this.getDateTables(), () => this.removeDroppableCellClass(), () => this.getCellWidth(), options))
    }
    isRenderHeaderPanelEmptyCell() {
        return this.isVerticalGroupedWorkSpace()
    }
    _dispose() {
        super._dispose();
        if (this.documentPointerUpHandler) {
            _events_engine.default.off(_dom_adapter.default.getDocument(), SCHEDULER_TABLE_DXPOINTERUP_EVENT_NAME, this.documentPointerUpHandler);
            this.documentPointerUpHandler = void 0
        }
        this.virtualScrollingDispatcher.dispose()
    }
    _getDefaultOptions() {
        const defaultOptions = Object.assign({}, super._getDefaultOptions(), {
            currentDate: new Date,
            intervalCount: 1,
            startDate: null,
            firstDayOfWeek: void 0,
            startDayHour: 0,
            endDayHour: 24,
            viewOffset: 0,
            hoursInterval: .5,
            cellDuration: 30,
            activeStateEnabled: true,
            hoverStateEnabled: true,
            groups: [],
            showAllDayPanel: true,
            allDayExpanded: false,
            onCellClick: void 0,
            crossScrollingEnabled: false,
            dataCellTemplate: null,
            timeCellTemplate: null,
            resourceCellTemplate: null,
            dateCellTemplate: null,
            allowMultipleCellSelection: true,
            indicatorTime: new Date,
            indicatorUpdateInterval: 5 * toMs("minute"),
            shadeUntilCurrentTime: true,
            groupOrientation: "horizontal",
            selectedCellData: [],
            groupByDate: false,
            skippedDays: void 0,
            scrolling: {
                mode: "standard"
            },
            allDayPanelMode: "all",
            draggingMode: "outlook",
            onScrollEnd: _common.noop,
            getHeaderHeight: void 0,
            renderAppointments: _common.noop,
            onShowAllDayPanel: _common.noop,
            onSelectedCellsClick: _common.noop,
            timeZoneCalculator: void 0,
            schedulerHeight: void 0,
            schedulerWidth: void 0
        });
        return defaultOptions
    }
    _optionChanged(args) {
        switch (args.name) {
            case "startDayHour":
            case "endDayHour":
            case "viewOffset":
            case "dateCellTemplate":
            case "resourceCellTemplate":
            case "dataCellTemplate":
            case "timeCellTemplate":
            case "hoursInterval":
            case "firstDayOfWeek":
            case "currentDate":
            case "startDate":
                this.cleanWorkSpace();
                break;
            case "groups":
                this.cleanView();
                this.removeAllDayElements();
                this.initGrouping();
                this.repaint();
                break;
            case "groupOrientation":
                this.initGroupedStrategy();
                this.createRAllDayPanelElements();
                this.removeAllDayElements();
                this.cleanWorkSpace();
                this.toggleGroupByDateClass();
                break;
            case "showAllDayPanel":
                if (this.isVerticalGroupedWorkSpace()) {
                    this.cleanView();
                    this.removeAllDayElements();
                    this.initGrouping();
                    this.repaint()
                } else {
                    this.renderWorkSpace()
                }
                break;
            case "allDayExpanded":
                this.updateAllDayExpansion();
                this.attachTablesEvents();
                this.updateScrollable();
                break;
            case "onSelectionChanged":
                this.createSelectionChangedAction();
                break;
            case "onSelectionEnd":
                this.createSelectionEndAction();
                break;
            case "onCellClick":
                this.createCellClickAction();
                break;
            case "onCellContextMenu":
                this.attachContextMenuEvent();
                break;
            case "intervalCount":
                this.cleanWorkSpace();
                this.toggleWorkSpaceCountClass();
                break;
            case "groupByDate":
                this.cleanWorkSpace();
                this.toggleGroupByDateClass();
                break;
            case "crossScrollingEnabled":
                this.toggleHorizontalScrollClass();
                this.$dateTableScrollable.option(this.dateTableScrollableConfig());
                break;
            case "allDayPanelMode":
                this.updateShowAllDayPanel();
                this.renderAppointments();
                break;
            case "width":
                super._optionChanged(args);
                this._dimensionChanged();
                break;
            case "timeZoneCalculator":
            case "allowMultipleCellSelection":
            case "selectedCellData":
                break;
            case "scrolling":
                this.repaint();
                break;
            case "schedulerHeight":
            case "schedulerWidth":
                this.virtualScrollingDispatcher.updateDimensions(true);
                break;
            default:
                super._optionChanged(args)
        }
    }
    updateShowAllDayPanel() {
        const isHiddenAllDayPanel = "hidden" === this.option().allDayPanelMode;
        this.option().onShowAllDayPanel(!isHiddenAllDayPanel)
    }
    getVirtualScrollingDispatcherOptions() {
        return {
            getCellHeight: this.getCellHeight.bind(this),
            getCellWidth: this.getCellWidth.bind(this),
            getCellMinWidth: this.getCellMinWidth.bind(this),
            isRTL: this.isRTL.bind(this),
            getSchedulerHeight: () => this.option().schedulerHeight,
            getSchedulerWidth: () => this.option().schedulerWidth,
            getViewHeight: () => (0, _size.getHeight)(this.$element()),
            getViewWidth: () => (0, _size.getWidth)(this.$element()),
            getWindowHeight: () => (0, _window.getWindow)().innerHeight,
            getWindowWidth: () => (0, _window.getWindow)().innerWidth,
            getScrolling: () => this.option().scrolling,
            getScrollableOuterWidth: this.getScrollableOuterWidth.bind(this),
            createAction: this._createAction.bind(this),
            updateRender: this.updateRender.bind(this),
            updateGrid: this.updateGrid.bind(this),
            getGroupCount: this.getGroupCount.bind(this),
            isVerticalGrouping: this.isVerticalGroupedWorkSpace.bind(this),
            getTotalRowCount: this.getTotalRowCount.bind(this),
            getTotalCellCount: this.getTotalCellCount.bind(this)
        }
    }
    cleanWorkSpace() {
        this.cleanView();
        this.toggleGroupedClass();
        this.toggleWorkSpaceWithOddCells();
        this.virtualScrollingDispatcher.updateDimensions(true);
        this.renderView();
        if (this.option().crossScrollingEnabled) {
            this.setTableSizes()
        }
        this.cache.clear()
    }
    _init() {
        this.scrollSync = {};
        this.viewDataProviderValue = null;
        this.cellsSelectionStateValue = null;
        super._init();
        this.initGrouping();
        this.toggleHorizontalScrollClass();
        this.toggleWorkSpaceCountClass();
        this.toggleGroupByDateClass();
        this.toggleWorkSpaceWithOddCells();
        this.$element().addClass(COMPONENT_CLASS).addClass(this.getElementClass())
    }
    initPositionHelper() {
        this.positionHelper = new _position_helper.PositionHelper({
            viewDataProvider: this.viewDataProvider,
            isGroupedByDate: this.isGroupedByDate(),
            rtlEnabled: this.option().rtlEnabled,
            isVerticalGrouping: this.isVerticalGroupedWorkSpace(),
            groupCount: this.getGroupCount(),
            isVirtualScrolling: this.isVirtualScrolling(),
            getDOMMetaDataCallback: this.getDOMElementsMetaData.bind(this)
        })
    }
    initGrouping() {
        this.initGroupedStrategy();
        this.toggleGroupingDirectionClass();
        this.toggleGroupByDateClass()
    }
    isVerticalOrientation() {
        var _this$option$groups6;
        const orientation = null !== (_this$option$groups6 = this.option().groups) && void 0 !== _this$option$groups6 && _this$option$groups6.length ? this.option().groupOrientation : this.getDefaultGroupStrategy();
        return "vertical" === orientation
    }
    initGroupedStrategy() {
        const Strategy = this.isVerticalOrientation() ? _work_space_grouped_strategy_vertical.default : _work_space_grouped_strategy_horizontal.default;
        this.groupedStrategy = new Strategy(this.createGroupedStrategyConfig())
    }
    createGroupedStrategyConfig() {
        return {
            getRowCount: () => this.getRowCount(),
            getCellCount: () => this.getCellCount(),
            getGroupCount: () => this.getGroupCount(),
            getCellHeight: () => this.getCellHeight(),
            getCellWidth: () => this.getCellWidth(),
            getTimePanelWidth: () => this.getTimePanelWidth(),
            getGroupTableWidth: () => this.getGroupTableWidth(),
            getAllDayHeight: () => this.getAllDayHeight(),
            getWorkSpaceWidth: () => this.getWorkSpaceWidth(),
            getWorkSpaceLeftOffset: () => this.getWorkSpaceLeftOffset(),
            getIndicatorOffset: () => this.getIndicatorOffset(),
            getIndicationHeight: () => this.getIndicationHeight(),
            getIndicationWidth: () => this.getIndicationWidth(),
            getScrollableScrollTop: () => this.getScrollable().scrollTop(),
            getScrollableContentElement: () => this.getScrollable().$content().get(0),
            getElement: () => this.$element().get(0),
            getHeaderPanelContainerElement: () => this.$headerPanelContainer.get(0),
            getCellIndexByCoordinates: coordinates => this.getCellIndexByCoordinates(coordinates),
            supportAllDayRow: () => this.supportAllDayRow(),
            isGroupedByDate: () => this.isGroupedByDate(),
            showAllDayPanel: () => this.option().showAllDayPanel,
            startDayHour: () => this.option().startDayHour,
            endDayHour: () => this.option().endDayHour,
            hoursInterval: () => this.option().hoursInterval,
            crossScrollingEnabled: () => this.option().crossScrollingEnabled,
            rtlEnabled: () => this.option().rtlEnabled,
            getHeaderHeight: () => {
                var _this$option$getHeade, _this$option;
                return (null === (_this$option$getHeade = (_this$option = this.option()).getHeaderHeight) || void 0 === _this$option$getHeade ? void 0 : _this$option$getHeade.call(_this$option)) ?? 0
            }
        }
    }
    getDefaultGroupStrategy() {
        return "horizontal"
    }
    toggleHorizontalScrollClass() {
        this.$element().toggleClass(WORKSPACE_WITH_BOTH_SCROLLS_CLASS, this.option().crossScrollingEnabled)
    }
    toggleGroupByDateClass() {
        this.$element().toggleClass(WORKSPACE_WITH_GROUP_BY_DATE_CLASS, this.isGroupedByDate())
    }
    toggleWorkSpaceCountClass() {
        this.$element().toggleClass(WORKSPACE_WITH_COUNT_CLASS, this.isWorkSpaceWithCount())
    }
    toggleWorkSpaceWithOddCells() {
        this.$element().toggleClass(WORKSPACE_WITH_ODD_CELLS_CLASS, this.isWorkspaceWithOddCells())
    }
    toggleGroupingDirectionClass() {
        this.$element().toggleClass(VERTICAL_GROUPED_WORKSPACE_CLASS, this.isVerticalGroupedWorkSpace())
    }
    getDateTableCellClass(rowIndex, columnIndex) {
        const cellClass = `${DATE_TABLE_CELL_CLASS} ${HORIZONTAL_SIZES_CLASS} ${VERTICAL_SIZES_CLASS}`;
        if (void 0 === rowIndex && void 0 === columnIndex) {
            return cellClass
        }
        return this.groupedStrategy.addAdditionalGroupCellClasses(cellClass, (columnIndex ?? 0) + 1, rowIndex ?? 0, columnIndex ?? 0)
    }
    getGroupHeaderClass(i) {
        const cellClass = GROUP_HEADER_CLASS;
        if (void 0 === i) {
            return cellClass
        }
        return this.groupedStrategy.addAdditionalGroupCellClasses(cellClass, i + 1, 0, 0)
    }
    initWorkSpaceUnits() {
        this.$headerPanelContainer = (0, _renderer.default)("<div>").addClass("dx-scheduler-header-panel-container");
        this.$headerTablesContainer = (0, _renderer.default)("<div>").addClass("dx-scheduler-header-tables-container");
        this.$headerPanel = (0, _renderer.default)("<table>").attr("aria-hidden", true);
        this.$thead = (0, _renderer.default)("<thead>").appendTo(this.$headerPanel);
        this.$headerPanelEmptyCell = (0, _renderer.default)("<div>").addClass("dx-scheduler-header-panel-empty-cell");
        this.$allDayTable = (0, _renderer.default)("<table>").attr("aria-hidden", true);
        this.$fixedContainer = (0, _renderer.default)("<div>").addClass(_classes.FIXED_CONTAINER_CLASS);
        this.$allDayContainer = (0, _renderer.default)("<div>").addClass(ALL_DAY_CONTAINER_CLASS);
        this.$dateTableScrollableContent = (0, _renderer.default)("<div>").addClass("dx-scheduler-date-table-scrollable-content");
        this.$sidebarScrollableContent = (0, _renderer.default)("<div>").addClass("dx-scheduler-side-bar-scrollable-content");
        this.initAllDayPanelElements();
        this.createRAllDayPanelElements();
        this.$timePanel = (0, _renderer.default)("<table>").addClass(_classes.TIME_PANEL_CLASS).attr("aria-hidden", true);
        this.$dateTable = (0, _renderer.default)("<table>").attr("aria-hidden", true);
        this.$dateTableContainer = (0, _renderer.default)("<div>").addClass("dx-scheduler-date-table-container");
        this.$groupTable = (0, _renderer.default)("<div>").addClass(WORKSPACE_VERTICAL_GROUP_TABLE_CLASS)
    }
    initAllDayPanelElements() {
        this.allDayTables = []
    }
    initDateTableScrollable() {
        const $dateTableScrollable = (0, _renderer.default)("<div>").addClass("dx-scheduler-date-table-scrollable");
        this.$dateTableScrollable = this._createComponent($dateTableScrollable, _scrollable.default, this.dateTableScrollableConfig());
        this.scrollSync.dateTable = (0, _scroll.getMemoizeScrollTo)(() => this.$dateTableScrollable)
    }
    createWorkSpaceElements() {
        if (this.option().crossScrollingEnabled) {
            this.createWorkSpaceScrollableElements()
        } else {
            this.createWorkSpaceStaticElements()
        }
    }
    createWorkSpaceStaticElements() {
        this.$dateTableContainer.append(this.$dateTable);
        if (this.isVerticalGroupedWorkSpace()) {
            this.$dateTableContainer.append(this.$allDayContainer);
            this.$dateTableScrollableContent.append([this.$groupTable, this.$timePanel, this.$dateTableContainer].filter(Boolean));
            this.$dateTableScrollable.$content().append(this.$dateTableScrollableContent);
            this.$headerTablesContainer.append(this.$headerPanel)
        } else {
            this.$dateTableScrollableContent.append([this.$timePanel, this.$dateTableContainer]);
            this.$dateTableScrollable.$content().append(this.$dateTableScrollableContent);
            this.$headerTablesContainer.append([this.$headerPanel, this.$allDayPanel]);
            this.$allDayPanel.append([this.$allDayContainer, this.$allDayTable].filter(Boolean))
        }
        this.appendHeaderPanelEmptyCellIfNecessary();
        this.$headerPanelContainer.append(this.$headerTablesContainer);
        this.$element().append(this.$fixedContainer).append(this.$headerPanelContainer).append(this.$dateTableScrollable.$element())
    }
    createWorkSpaceScrollableElements() {
        this.$element().append(this.$fixedContainer);
        this.$flexContainer = (0, _renderer.default)("<div>").addClass("dx-scheduler-work-space-flex-container");
        this.createHeaderScrollable();
        this.headerScrollable.$content().append(this.$headerPanel);
        this.appendHeaderPanelEmptyCellIfNecessary();
        this.$headerPanelContainer.append(this.$headerTablesContainer);
        this.$element().append(this.$headerPanelContainer);
        this.$element().append(this.$flexContainer);
        this.createSidebarScrollable();
        this.$flexContainer.append(this.$dateTableScrollable.$element());
        this.$dateTableContainer.append(this.$dateTable);
        this.$dateTableScrollableContent.append(this.$dateTableContainer);
        this.$dateTableScrollable.$content().append(this.$dateTableScrollableContent);
        if (this.isVerticalGroupedWorkSpace()) {
            this.$dateTableContainer.append(this.$allDayContainer);
            this.$sidebarScrollableContent.append([this.$groupTable, this.$timePanel].filter(Boolean))
        } else {
            this.headerScrollable.$content().append(this.$allDayPanel);
            this.$allDayPanel.append([this.$allDayContainer, this.$allDayTable].filter(Boolean));
            this.$sidebarScrollableContent.append(this.$timePanel)
        }
        this.$sidebarScrollable.$content().append(this.$sidebarScrollableContent)
    }
    appendHeaderPanelEmptyCellIfNecessary() {
        if (this.isRenderHeaderPanelEmptyCell()) {
            this.$headerPanelContainer.append(this.$headerPanelEmptyCell)
        }
    }
    createHeaderScrollable() {
        const $headerScrollable = (0, _renderer.default)("<div>").addClass("dx-scheduler-header-scrollable").appendTo(this.$headerTablesContainer);
        this.headerScrollable = this._createComponent($headerScrollable, _scrollable.default, this.headerScrollableConfig());
        this.scrollSync.header = (0, _scroll.getMemoizeScrollTo)(() => this.headerScrollable)
    }
    createSidebarScrollable() {
        const $timePanelScrollable = (0, _renderer.default)("<div>").addClass("dx-scheduler-sidebar-scrollable").appendTo(this.$flexContainer);
        this.$sidebarScrollable = this._createComponent($timePanelScrollable, _scrollable.default, {
            useKeyboard: false,
            showScrollbar: "never",
            direction: "vertical",
            useNative: false,
            updateManually: true,
            bounceEnabled: false,
            onScroll: event => {
                var _this$scrollSync$date2, _this$scrollSync4;
                null === (_this$scrollSync$date2 = (_this$scrollSync4 = this.scrollSync).dateTable) || void 0 === _this$scrollSync$date2 || _this$scrollSync$date2.call(_this$scrollSync4, {
                    top: event.scrollOffset.top
                })
            }
        });
        this.scrollSync.sidebar = (0, _scroll.getMemoizeScrollTo)(() => this.$sidebarScrollable)
    }
    attachTableClasses() {
        this.addTableClass(this.$dateTable, _classes.DATE_TABLE_CLASS);
        if (this.isVerticalGroupedWorkSpace()) {
            const groupCount = this.getGroupCount();
            for (let i = 0; i < groupCount; i += 1) {
                this.addTableClass(this.allDayTables[i], ALL_DAY_TABLE_CLASS)
            }
        }
    }
    attachHeaderTableClasses() {
        this.addTableClass(this.$headerPanel, HEADER_PANEL_CLASS)
    }
    addTableClass($el, className) {
        if ($el && !$el.hasClass(className)) {
            $el.addClass(className)
        }
    }
    _initMarkup() {
        this.cache.clear();
        this.initWorkSpaceUnits();
        this.initVirtualScrolling();
        this.initDateTableScrollable();
        this.createWorkSpaceElements();
        super._initMarkup();
        if (!this.option().crossScrollingEnabled) {
            this.attachTableClasses();
            this.attachHeaderTableClasses()
        }
        this.toggleGroupedClass();
        this.renderView();
        this.attachEvents()
    }
    _render() {
        super._render();
        this.renderDateTimeIndication();
        this.setIndicationUpdateInterval()
    }
    toggleGroupedClass() {
        this.$element().toggleClass(GROUPED_WORKSPACE_CLASS, this.getGroupCount() > 0)
    }
    renderView() {
        if (this.isVerticalGroupedWorkSpace()) {
            this.renderRGroupPanel()
        }
        this.renderWorkSpace();
        this.virtualScrollingDispatcher.updateDimensions();
        this.updateGroupTableHeight();
        this.updateHeaderEmptyCellWidth();
        this.shader = new _current_time_shader_vertical.default(this)
    }
    updateCellsSelection() {
        const renderOptions = this.generateRenderOptions();
        this.viewDataProvider.updateViewData(renderOptions);
        this.renderRWorkSpace({
            timePanel: true,
            dateTable: true,
            allDayPanel: true
        })
    }
    renderDateTimeIndication() {
        return (0, _common.noop)()
    }
    renderCurrentDateTimeLineAndShader() {
        return (0, _common.noop)()
    }
    renderCurrentDateTimeIndication() {
        return (0, _common.noop)()
    }
    setIndicationUpdateInterval() {
        return (0, _common.noop)()
    }
    detachGroupCountClass() {
        _classes.VERTICAL_GROUP_COUNT_CLASSES.forEach(className => {
            this.$element().removeClass(className)
        })
    }
    attachGroupCountClass() {
        const className = this.groupedStrategy.getGroupCountClass(this.option().groups);
        if (className) {
            this.$element().addClass(className)
        }
    }
    getDateHeaderTemplate() {
        return this.option().dateCellTemplate
    }
    updateAllDayVisibility() {
        this.$element().toggleClass(WORKSPACE_WITH_ALL_DAY_CLASS, this.isShowAllDayPanel());
        this.updateAllDayExpansion()
    }
    updateAllDayExpansion() {
        const isExpanded = !this.option().allDayExpanded && this.isShowAllDayPanel();
        this.cache.clear();
        this.$element().toggleClass(WORKSPACE_WITH_COLLAPSED_ALL_DAY_CLASS, isExpanded)
    }
    getDateTables() {
        return this.$allDayTable ? this.$dateTable.add(this.$allDayTable) : this.$dateTable
    }
    getDateTable() {
        return this.$dateTable
    }
    removeAllDayElements() {
        var _this$$allDayTable, _this$$allDayTitle;
        null === (_this$$allDayTable = this.$allDayTable) || void 0 === _this$$allDayTable || _this$$allDayTable.remove();
        null === (_this$$allDayTitle = this.$allDayTitle) || void 0 === _this$$allDayTitle || _this$$allDayTitle.remove()
    }
    cleanView() {
        var _this$shader;
        this.cache.clear();
        this.cleanTableWidths();
        this.cellsSelectionState.clearSelectedAndFocusedCells();
        this.isCellClick = false;
        this.showPopup = false;
        this.interval = void 0;
        this.isSelectionStartedOnCell = false;
        null === (_this$shader = this.shader) || void 0 === _this$shader || _this$shader.clean()
    }
    _clean() {
        _events_engine.default.off(_dom_adapter.default.getDocument(), SCHEDULER_CELL_DXPOINTERUP_EVENT_NAME);
        this.disposeRenovatedComponents();
        super._clean()
    }
    cleanTableWidths() {
        var _this$$allDayTable2;
        this.$headerPanel.css("width", "");
        this.$dateTable.css("width", "");
        null === (_this$$allDayTable2 = this.$allDayTable) || void 0 === _this$$allDayTable2 || _this$$allDayTable2.css("width", "")
    }
    disposeRenovatedComponents() {
        var _this$renovatedAllDay, _this$renovatedDateTa, _this$renovatedTimePa, _this$renovatedGroupP, _this$renovatedHeader;
        null === (_this$renovatedAllDay = this.renovatedAllDayPanel) || void 0 === _this$renovatedAllDay || _this$renovatedAllDay.dispose();
        this.renovatedAllDayPanel = void 0;
        null === (_this$renovatedDateTa = this.renovatedDateTable) || void 0 === _this$renovatedDateTa || _this$renovatedDateTa.dispose();
        this.renovatedDateTable = void 0;
        null === (_this$renovatedTimePa = this.renovatedTimePanel) || void 0 === _this$renovatedTimePa || _this$renovatedTimePa.dispose();
        this.renovatedTimePanel = void 0;
        null === (_this$renovatedGroupP = this.renovatedGroupPanel) || void 0 === _this$renovatedGroupP || _this$renovatedGroupP.dispose();
        this.renovatedGroupPanel = void 0;
        null === (_this$renovatedHeader = this.renovatedHeaderPanel) || void 0 === _this$renovatedHeader || _this$renovatedHeader.dispose();
        this.renovatedHeaderPanel = void 0
    }
    getGroupedStrategy() {
        return this.groupedStrategy
    }
    getFixedContainer() {
        return this.$fixedContainer
    }
    getAllDayContainer() {
        return this.$allDayContainer
    }
    updateRender() {
        this.renderer.updateRender()
    }
    updateGrid() {
        this.renderer._renderGrid()
    }
    renderAppointments() {
        var _this$dragBehavior3;
        this.option().renderAppointments();
        null === (_this$dragBehavior3 = this.dragBehavior) || void 0 === _this$dragBehavior3 || _this$dragBehavior3.updateDragSource(void 0, void 0)
    }
    renderWorkSpace() {
        let {
            generateNewData: generateNewData,
            renderComponents: renderComponents
        } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : DEFAULT_WORKSPACE_RENDER_OPTIONS;
        this.cache.clear();
        this.viewDataProvider.update(this.generateRenderOptions(), generateNewData);
        this.renderRWorkSpace(renderComponents);
        this.initPositionHelper()
    }
    renderGroupHeader() {
        const $container = this.getGroupHeaderContainer();
        const groupCount = this.getGroupCount();
        let cellTemplates = [];
        if (groupCount && $container) {
            const groupRows = this.makeGroupRows(this.option().groups, this.option().groupByDate);
            this.attachGroupCountClass();
            const {
                elements: elements
            } = groupRows;
            $container.append(Array.isArray(elements) ? elements : elements.toArray());
            cellTemplates = groupRows.cellTemplates
        } else {
            this.detachGroupCountClass()
        }
        return cellTemplates
    }
    applyCellTemplates(templates) {
        null === templates || void 0 === templates || templates.forEach(template => {
            template()
        })
    }
    makeGroupRows(groups, groupByDate) {
        const tableCreatorStrategy = this.isVerticalGroupedWorkSpace() ? tableCreator.VERTICAL : tableCreator.HORIZONTAL;
        return tableCreator.makeGroupedTable(tableCreatorStrategy, groups, {
            groupHeaderRowClass: _classes.GROUP_ROW_CLASS,
            groupRowClass: _classes.GROUP_ROW_CLASS,
            groupHeaderClass: this.getGroupHeaderClass.bind(this),
            groupHeaderContentClass: _classes.GROUP_HEADER_CONTENT_CLASS
        }, this.getCellCount() || 1, this.option().resourceCellTemplate, this.getGroupCount(), groupByDate)
    }
    getGroupsForDateHeaderTemplate(templateIndex) {
        let indexMultiplier = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1;
        if (this.isHorizontalGroupedWorkSpace() && !this.isGroupedByDate()) {
            const groupIndex = this.getGroupIndex(0, templateIndex * indexMultiplier);
            const groups = (0, _group_utils.getLeafGroupValues)(this.resourceManager.groupsLeafs, groupIndex);
            return {
                groups: groups,
                groupIndex: groupIndex
            }
        }
        return {}
    }
    getHeaderPanelCellClass(i) {
        const cellClass = `${HEADER_PANEL_CELL_CLASS} ${HORIZONTAL_SIZES_CLASS}`;
        return this.groupedStrategy.addAdditionalGroupCellClasses(cellClass, i + 1, 0, 0, this.isGroupedByDate())
    }
    insertAllDayRowsIntoDateTable() {
        return this.groupedStrategy.insertAllDayRowsIntoDateTable()
    }
}
const domAdapterExt = _dom_adapter.default;
const createDragBehaviorConfig = (container, rootElement, isDefaultDraggingMode, dragBehavior, enableDefaultDragging, disableDefaultDragging, getDroppableCell, getDateTables, removeDroppableCellClass, getCellWidthCallback, options) => {
    const state = {
        dragElement: void 0,
        itemData: void 0
    };
    const isItemDisabled = () => {
        const {
            itemData: itemData
        } = state;
        if (itemData) {
            const getter = (0, _data.compileGetter)("disabled");
            return getter(itemData)
        }
        return true
    };
    const cursorOffset = options.isSetCursorOffset ? () => {
        const $dragElement = (0, _renderer.default)(state.dragElement);
        return {
            x: (0, _size.getWidth)($dragElement) / 2,
            y: (0, _size.getHeight)($dragElement) / 2
        }
    } : void 0;
    return {
        container: container,
        dragTemplate: () => state.dragElement,
        onDragStart: e => {
            if (!isDefaultDraggingMode) {
                disableDefaultDragging()
            }
            if (!e.event) {
                return
            }
            const canceled = e.cancel;
            const $itemElement = (0, _renderer.default)(e.itemElement);
            const appointments = e.component._appointments;
            state.itemData = options.getItemData(e.itemElement, appointments);
            const settings = options.getItemSettings($itemElement, e);
            const {
                initialPosition: initialPosition
            } = options;
            if (!isItemDisabled()) {
                e.event.data = e.event.data ?? {};
                if (!canceled) {
                    if (!("isCompact" in settings && settings.isCompact)) {
                        dragBehavior.updateDragSource(state.itemData, settings)
                    }
                    state.dragElement = ((itemData, settings, appointments) => {
                        const appointmentIndex = appointments.option("items").length;
                        const $item = appointments._renderItem(appointmentIndex, Object.assign({}, settings, {
                            itemData: itemData,
                            isCompact: false,
                            virtual: false,
                            sortedIndex: -1
                        }));
                        return $item
                    })(state.itemData, settings, appointments);
                    e.event.data.itemElement = state.dragElement;
                    e.event.data.initialPosition = initialPosition ?? (0, _translator.locate)((0, _renderer.default)(state.dragElement));
                    e.event.data.itemData = state.itemData;
                    e.event.data.itemSettings = settings;
                    dragBehavior.onDragStart(e.event.data);
                    (0, _translator.resetPosition)((0, _renderer.default)(state.dragElement))
                }
            }
        },
        onDragMove: () => {
            if (isDefaultDraggingMode) {
                return
            }
            const elements = (() => {
                const appointmentWidth = (0, _size.getWidth)(state.dragElement);
                const cellWidth = getCellWidthCallback();
                const isWideAppointment = appointmentWidth > cellWidth;
                const isNarrowAppointment = appointmentWidth <= 10;
                const dragElementContainer = (0, _renderer.default)(state.dragElement).parent().get(0);
                const boundingRect = (0, _position.getBoundingRect)(dragElementContainer);
                const newX = boundingRect.left;
                const newY = boundingRect.top;
                if (isWideAppointment) {
                    return domAdapterExt.elementsFromPoint(newX + 10, newY + 10, dragElementContainer)
                }
                if (isNarrowAppointment) {
                    return domAdapterExt.elementsFromPoint(newX, newY, dragElementContainer)
                }
                return domAdapterExt.elementsFromPoint(newX + appointmentWidth / 2, newY + 10, dragElementContainer)
            })();
            const isMoveUnderControl = Boolean(elements.find(el => el === rootElement.get(0)));
            const dateTables = getDateTables();
            const droppableCell = elements.find(el => {
                const {
                    classList: classList
                } = el;
                const isCurrentSchedulerElement = 1 === dateTables.find(el).length;
                return isCurrentSchedulerElement && (classList.contains(DATE_TABLE_CELL_CLASS) || classList.contains(ALL_DAY_TABLE_CELL_CLASS))
            });
            if (droppableCell) {
                if (!getDroppableCell().is(droppableCell)) {
                    removeDroppableCellClass()
                }(0, _renderer.default)(droppableCell).addClass(DATE_TABLE_DROPPABLE_CELL_CLASS)
            } else if (!isMoveUnderControl) {
                removeDroppableCellClass()
            }
        },
        onDragEnd: e => {
            var _state$dragElement;
            if (!isDefaultDraggingMode) {
                enableDefaultDragging()
            }
            if (!isItemDisabled()) {
                dragBehavior.onDragEnd(e)
            }
            null === (_state$dragElement = state.dragElement) || void 0 === _state$dragElement || _state$dragElement.remove();
            removeDroppableCellClass()
        },
        onDragCancel: e => {
            if (!isDefaultDraggingMode) {
                enableDefaultDragging()
            }
            removeDroppableCellClass();
            (0, _renderer.default)(e.itemElement).removeClass(_classes.APPOINTMENT_DRAG_SOURCE_CLASS)
        },
        cursorOffset: cursorOffset,
        filter: options.filter
    }
};
var _default = exports.default = SchedulerWorkSpace;