UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

81 lines (80 loc) 3.59 kB
/** * DevExtreme (esm/__internal/scheduler/tooltip_strategies/desktop_tooltip_strategy.js) * Version: 25.2.8 * Build date: Mon Jun 08 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import messageLocalization from "../../../common/core/localization/message"; import supportUtils from "../../core/utils/m_support"; import Tooltip from "../../ui/m_tooltip"; import { TooltipStrategyBase } from "./tooltip_strategy_base"; const APPOINTMENT_TOOLTIP_WRAPPER_CLASS = "dx-scheduler-appointment-tooltip-wrapper"; const MAX_TOOLTIP_HEIGHT = 200; export class DesktopTooltipStrategy extends TooltipStrategyBase { prepareBeforeVisibleChanged(dataList) { var _this$tooltip, _this$extraOptions; null === (_this$tooltip = this.tooltip) || void 0 === _this$tooltip || _this$tooltip.option("position", { my: "bottom", at: "top", boundary: this.getBoundary(dataList), offset: null === (_this$extraOptions = this.extraOptions) || void 0 === _this$extraOptions ? void 0 : _this$extraOptions.offset, collision: "fit flipfit" }) } getBoundary(dataList) { return this._options.isAppointmentInAllDayPanel(dataList[0].appointment) ? this._options.container : this._options.getScrollableContainer() } onShown() { var _this$extraOptions2; super.onShown(); if (null !== (_this$extraOptions2 = this.extraOptions) && void 0 !== _this$extraOptions2 && _this$extraOptions2.isButtonClick) { this.list.focus(); this.list.option("focusedElement", null) } } createListOption(dataList) { const result = super.createListOption(dataList); result.showScrollbar = supportUtils.touch ? "always" : "onHover"; return result } createTooltip(dataList) { var _this$extraOptions3, _this$extraOptions4; const tooltipElement = this.createTooltipElement(APPOINTMENT_TOOLTIP_WRAPPER_CLASS); const tooltip = this._options.createComponent(tooltipElement, Tooltip, { target: this.$target, maxHeight: 200, rtlEnabled: null === (_this$extraOptions3 = this.extraOptions) || void 0 === _this$extraOptions3 ? void 0 : _this$extraOptions3.rtlEnabled, onShown: this.onShown.bind(this), contentTemplate: this.getContentTemplate(dataList), wrapperAttr: { class: APPOINTMENT_TOOLTIP_WRAPPER_CLASS }, _loopFocus: null === (_this$extraOptions4 = this.extraOptions) || void 0 === _this$extraOptions4 ? void 0 : _this$extraOptions4._loopFocus }); tooltip.setAria({ role: "dialog", label: messageLocalization.format("dxScheduler-appointmentListAriaLabel") }); return tooltip } onListInitialized(e) { this._options.onListInitialized(e) } onListRender(e) { var _this$extraOptions5; if (this._options.newAppointments) { return } if (null !== (_this$extraOptions5 = this.extraOptions) && void 0 !== _this$extraOptions5 && _this$extraOptions5.dragBehavior) { this.extraOptions.dragBehavior(e) } } onListItemContextMenu(e) { const contextMenuEventArgs = this._options.createEventArgs(e); this._options.onItemContextMenu(contextMenuEventArgs) } }