devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
91 lines (89 loc) • 3.91 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/tooltip_strategies/desktop_tooltip_strategy.js)
* Version: 26.1.3
* Build date: Wed Jun 10 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 _tooltip_strategy_base = require("./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 _tooltip_strategy_base.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 = _m_support.default.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, _m_tooltip.default, {
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
},
tabFocusLoopEnabled: null === (_this$extraOptions4 = this.extraOptions) || void 0 === _this$extraOptions4 ? void 0 : _this$extraOptions4.tabFocusLoopEnabled
});
tooltip.setAria({
role: "dialog",
label: _message.default.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)
}
}
exports.DesktopTooltipStrategy = DesktopTooltipStrategy;