devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
69 lines (68 loc) • 2.72 kB
JavaScript
/**
* DevExtreme (esm/__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/
*/
import messageLocalization from "../../../common/core/localization/message";
import supportUtils from "../../core/utils/m_support";
import Tooltip from "../../ui/m_tooltip";
import {
TooltipStrategyBase
} from "./m_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) {
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 = supportUtils.touch ? "always" : "onHover";
return result
}
createTooltip(target, dataList) {
const tooltipElement = this.createTooltipElement(APPOINTMENT_TOOLTIP_WRAPPER_CLASS);
const tooltip = this._options.createComponent(tooltipElement, Tooltip, {
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: messageLocalization.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)
}
}