UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

79 lines (77 loc) 3.13 kB
/** * DevExtreme (cjs/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 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.DesktopTooltipStrategy = void 0; var _message = _interopRequireDefault(require("../../../common/core/localization/message")); var _m_support = _interopRequireDefault(require("../../core/utils/m_support")); var _m_tooltip = _interopRequireDefault(require("../../ui/m_tooltip")); var _m_tooltip_strategy_base = require("./m_tooltip_strategy_base"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e } } const APPOINTMENT_TOOLTIP_WRAPPER_CLASS = "dx-scheduler-appointment-tooltip-wrapper"; const MAX_TOOLTIP_HEIGHT = 200; class DesktopTooltipStrategy extends _m_tooltip_strategy_base.TooltipStrategyBase { _prepareBeforeVisibleChanged(dataList) { this._tooltip.option("position", { my: "bottom", at: "top", boundary: this._getBoundary(dataList), offset: this._extraOptions.offset, collision: "fit flipfit" }) } _getBoundary(dataList) { return this._options.isAppointmentInAllDayPanel(dataList[0].appointment) ? this._options.container : this._options.getScrollableContainer() } _onShown() { super._onShown(); if (this._extraOptions.isButtonClick) { this._list.focus(); this._list.option("focusedElement", null) } } _createListOption(target, dataList) { const result = super._createListOption(target, dataList); result.showScrollbar = _m_support.default.touch ? "always" : "onHover"; return result } _createTooltip(target, dataList) { const tooltipElement = this._createTooltipElement(APPOINTMENT_TOOLTIP_WRAPPER_CLASS); const tooltip = this._options.createComponent(tooltipElement, _m_tooltip.default, { target: target, maxHeight: 200, rtlEnabled: this._extraOptions.rtlEnabled, onShown: this._onShown.bind(this), contentTemplate: this._getContentTemplate(dataList), wrapperAttr: { class: APPOINTMENT_TOOLTIP_WRAPPER_CLASS }, _loopFocus: this._extraOptions._loopFocus }); tooltip.setAria({ role: "dialog", label: _message.default.format("dxScheduler-appointmentListAriaLabel") }); return tooltip } _onListRender(e) { return this._extraOptions.dragBehavior && this._extraOptions.dragBehavior(e) } _onListItemContextMenu(e) { const contextMenuEventArgs = this._options.createEventArgs(e); this._options.onItemContextMenu(contextMenuEventArgs) } } exports.DesktopTooltipStrategy = DesktopTooltipStrategy;