UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

93 lines (88 loc) 3.68 kB
/** * DevExtreme (cjs/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.js) * Version: 23.2.6 * Build date: Wed May 01 2024 * * Copyright (c) 2012 - 2024 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 _support = require("../../../core/utils/support"); var _tooltip = _interopRequireDefault(require("../../../ui/tooltip")); var _m_tooltip_strategy_base = require("./m_tooltip_strategy_base"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass) } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, p) { o.__proto__ = p; return o }; return _setPrototypeOf(o, p) } const APPOINTMENT_TOOLTIP_WRAPPER_CLASS = "dx-scheduler-appointment-tooltip-wrapper"; const MAX_TOOLTIP_HEIGHT = 200; let DesktopTooltipStrategy = function(_TooltipStrategyBase) { _inheritsLoose(DesktopTooltipStrategy, _TooltipStrategyBase); function DesktopTooltipStrategy() { return _TooltipStrategyBase.apply(this, arguments) || this } var _proto = DesktopTooltipStrategy.prototype; _proto._prepareBeforeVisibleChanged = function(dataList) { this._tooltip.option("position", { my: "bottom", at: "top", boundary: this._getBoundary(dataList), offset: this._extraOptions.offset, collision: "fit flipfit" }) }; _proto._getBoundary = function(dataList) { return this._options.isAppointmentInAllDayPanel(dataList[0].appointment) ? this._options.container : this._options.getScrollableContainer() }; _proto._onShown = function() { _TooltipStrategyBase.prototype._onShown.call(this); if (this._extraOptions.isButtonClick) { this._list.focus(); this._list.option("focusedElement", null) } }; _proto._createListOption = function(target, dataList) { const result = _TooltipStrategyBase.prototype._createListOption.call(this, target, dataList); result.showScrollbar = _support.touch ? "always" : "onHover"; return result }; _proto._createTooltip = function(target, dataList) { const tooltip = this._createTooltipElement(APPOINTMENT_TOOLTIP_WRAPPER_CLASS); return this._options.createComponent(tooltip, _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 } }) }; _proto._onListRender = function(e) { return this._extraOptions.dragBehavior && this._extraOptions.dragBehavior(e) }; _proto._onListItemContextMenu = function(e) { const contextMenuEventArgs = this._options.createEventArgs(e); this._options.onItemContextMenu(contextMenuEventArgs) }; return DesktopTooltipStrategy }(_m_tooltip_strategy_base.TooltipStrategyBase); exports.DesktopTooltipStrategy = DesktopTooltipStrategy;