devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
79 lines (77 loc) • 3.11 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/tooltip_strategies/m_desktop_tooltip_strategy.js)
* Version: 25.2.7
* Build date: Tue May 05 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.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;