@@ -11,7 +11,7 @@ import { noop } from '@js/core/utils/common';
1111import { extend } from '@js/core/utils/extend' ;
1212import { each } from '@js/core/utils/iterator' ;
1313import { getOuterWidth } from '@js/core/utils/size' ;
14- import { isDefined , isObject , isPlainObject } from '@js/core/utils/type' ;
14+ import { isDefined , isObject } from '@js/core/utils/type' ;
1515import type { DxEvent , EventInfo } from '@js/events' ;
1616import Button from '@js/ui/button' ;
1717import type dxMenuBase from '@js/ui/context_menu/ui.menu_base' ;
@@ -406,50 +406,47 @@ class Menu extends MenuBase<MenuProperties> {
406406 this . _hamburger = new Button ( $ ( '<div>' ) . addClass ( DX_ADAPTIVE_HAMBURGER_BUTTON_CLASS ) , {
407407 icon : 'menu' ,
408408 activeStateEnabled : false ,
409- onClick : this . _toggleTreeView . bind ( this ) ,
409+ onClick : ( ) : void => {
410+ this . _toggleTreeView ( ) ;
411+ } ,
410412 } ) ;
411413
412414 return this . _hamburger . $element ( ) ;
413415 }
414416
415- _toggleTreeView ( state : boolean ) : void {
416- if ( isPlainObject ( state ) ) {
417- const { visible } = this . _overlay ?. option ( ) ?? { } ;
418-
419- // eslint-disable-next-line no-param-reassign
420- state = ! visible ;
421- }
417+ _toggleTreeView ( visible ?: boolean ) : void {
418+ const isTreeViewVisible = visible ?? ! this . _overlay ?. option ( ) ?. visible ;
422419
423- this . _overlay ?. option ( 'visible' , state ) ;
420+ this . _overlay ?. option ( 'visible' , isTreeViewVisible ) ;
424421
425- if ( state ) {
422+ if ( isTreeViewVisible ) {
426423 this . _treeView ?. focus ( ) ;
427424 }
428- this . _toggleHamburgerActiveState ( state ) ;
425+ this . _toggleHamburgerActiveState ( isTreeViewVisible ) ;
429426 }
430427
431428 _toggleHamburgerActiveState ( isActive : boolean ) : void {
432429 this . _hamburger ?. $element ( ) . toggleClass ( DX_STATE_ACTIVE_CLASS , isActive ) ;
433430 }
434431
435- _toggleAdaptiveMode ( state : boolean ) : void {
432+ _toggleAdaptiveMode ( isAdaptive : boolean ) : void {
436433 const $menuItemsContainer = this . $element ( ) . find ( `.${ DX_MENU_HORIZONTAL_CLASS } ` ) ;
437434 const $adaptiveElements = this . $element ( ) . find ( `.${ DX_ADAPTIVE_MODE_CLASS } ` ) ;
438435
439- if ( state ) {
436+ if ( isAdaptive ) {
440437 this . _hideVisibleSubmenu ( ) ;
441438 } else {
442439 this . _treeView ?. collapseAll ( ) ;
443440 if ( this . _overlay ) {
444- this . _toggleTreeView ( state ) ;
441+ this . _toggleTreeView ( isAdaptive ) ;
445442 }
446443 }
447444
448- this . _setAriaRole ( state ) ;
445+ this . _setAriaRole ( isAdaptive ) ;
449446 // @ts -expect-error ts-error
450- $menuItemsContainer . toggle ( ! state ) ;
447+ $menuItemsContainer . toggle ( ! isAdaptive ) ;
451448 // @ts -expect-error ts-error
452- $adaptiveElements . toggle ( state ) ;
449+ $adaptiveElements . toggle ( isAdaptive ) ;
453450 }
454451
455452 _removeAdaptivity ( ) : void {
@@ -1158,10 +1155,7 @@ class Menu extends MenuBase<MenuProperties> {
11581155 return submenu ;
11591156 }
11601157
1161- // eslint-disable-next-line no-param-reassign
1162- itemData = itemData ?? this . _getItemData ( $itemElement ) as Item ;
1163-
1164- const node = this . _dataAdapter . getNodeByItem ( itemData ) ;
1158+ const node = this . _dataAdapter . getNodeByItem ( itemData ?? this . _getItemData ( $itemElement ) ) ;
11651159
11661160 if ( node && this . _hasChildren ( node ) ) {
11671161 return this . _renderSubmenuItems ( node , $itemElement ) ;
0 commit comments