11import messageLocalization from '@js/common/core/localization/message' ;
2+ import type { dxElementWrapper } from '@js/core/renderer' ;
3+ import type { ContentReadyEvent , ItemContextMenuEvent , Properties as ListProperties } from '@js/ui/list' ;
24import supportUtils from '@ts/core/utils/m_support' ;
35import Tooltip from '@ts/ui/m_tooltip' ;
46
5- import { TooltipStrategyBase } from './m_tooltip_strategy_base' ;
7+ import type { AppointmentTooltipItem } from '../types' ;
8+ import { TooltipStrategyBase } from './tooltip_strategy_base' ;
69
710const APPOINTMENT_TOOLTIP_WRAPPER_CLASS = 'dx-scheduler-appointment-tooltip-wrapper' ;
811const MAX_TOOLTIP_HEIGHT = 200 ;
912
1013export class DesktopTooltipStrategy extends TooltipStrategyBase {
11- protected override prepareBeforeVisibleChanged ( dataList ) {
12- this . tooltip . option ( 'position' , {
14+ protected override prepareBeforeVisibleChanged ( dataList : AppointmentTooltipItem [ ] ) : void {
15+ this . tooltip ? .option ( 'position' , {
1316 my : 'bottom' ,
1417 at : 'top' ,
1518 boundary : this . getBoundary ( dataList ) ,
16- offset : this . extraOptions . offset ,
19+ offset : this . extraOptions ? .offset ,
1720 collision : 'fit flipfit' ,
1821 } ) ;
1922 }
2023
21- private getBoundary ( dataList ) {
22- return this . _options . isAppointmentInAllDayPanel ( dataList [ 0 ] . appointment ) ? this . _options . container : this . _options . getScrollableContainer ( ) ;
24+ private getBoundary ( dataList : AppointmentTooltipItem [ ] ) : dxElementWrapper {
25+ return this . _options . isAppointmentInAllDayPanel ( dataList [ 0 ] . appointment )
26+ ? this . _options . container
27+ : this . _options . getScrollableContainer ( ) ;
2328 }
2429
25- protected override onShown ( ) {
30+ protected override onShown ( ) : void {
2631 super . onShown ( ) ;
27- if ( this . extraOptions . isButtonClick ) {
32+ if ( this . extraOptions ? .isButtonClick ) {
2833 this . list . focus ( ) ;
2934 this . list . option ( 'focusedElement' , null ) ;
3035 }
3136 }
3237
33- // @ts -expect-error
34- protected override createListOption ( target , dataList ) {
35- // @ts -expect-error
36- const result : any = super . createListOption ( target , dataList ) ;
38+ protected override createListOption (
39+ dataList : AppointmentTooltipItem [ ] ,
40+ ) : ListProperties < AppointmentTooltipItem > {
41+ const result = super . createListOption ( dataList ) ;
3742 // T724287 this condition is not covered by tests, because touch variable cannot be overridden.
3843 // In the future, it is necessary to cover the tests
3944 result . showScrollbar = supportUtils . touch ? 'always' : 'onHover' ;
4045 return result ;
4146 }
4247
43- protected override createTooltip ( dataList ) {
48+ protected override createTooltip (
49+ dataList : AppointmentTooltipItem [ ] ,
50+ ) : Tooltip {
4451 const tooltipElement = this . createTooltipElement ( APPOINTMENT_TOOLTIP_WRAPPER_CLASS ) ;
4552
4653 const tooltip = this . _options . createComponent ( tooltipElement , Tooltip , {
4754 target : this . $target ,
4855 maxHeight : MAX_TOOLTIP_HEIGHT ,
49- rtlEnabled : this . extraOptions . rtlEnabled ,
56+ rtlEnabled : this . extraOptions ? .rtlEnabled ,
5057 onShown : this . onShown . bind ( this ) ,
5158 contentTemplate : this . getContentTemplate ( dataList ) ,
5259 wrapperAttr : { class : APPOINTMENT_TOOLTIP_WRAPPER_CLASS } ,
53- tabFocusLoopEnabled : this . extraOptions . tabFocusLoopEnabled ,
54- } ) ;
60+ tabFocusLoopEnabled : this . extraOptions ? .tabFocusLoopEnabled ,
61+ } ) as Tooltip ;
5562
5663 tooltip . setAria ( {
5764 role : 'dialog' ,
@@ -61,11 +68,17 @@ export class DesktopTooltipStrategy extends TooltipStrategyBase {
6168 return tooltip ;
6269 }
6370
64- protected override onListRender ( e ) {
65- return this . extraOptions . dragBehavior && this . extraOptions . dragBehavior ( e ) ;
71+ protected override onListRender (
72+ e : ContentReadyEvent < AppointmentTooltipItem > ,
73+ ) : void {
74+ if ( this . extraOptions ?. dragBehavior ) {
75+ this . extraOptions . dragBehavior ( e ) ;
76+ }
6677 }
6778
68- protected override onListItemContextMenu ( e ) {
79+ protected override onListItemContextMenu (
80+ e : ItemContextMenuEvent < AppointmentTooltipItem > ,
81+ ) : void {
6982 const contextMenuEventArgs = this . _options . createEventArgs ( e ) ;
7083 this . _options . onItemContextMenu ( contextMenuEventArgs ) ;
7184 }
0 commit comments