| @@ 8594-8625 (lines=32) @@ | ||
| 8591 | self$$1.aria('role', self$$1.parent() instanceof MenuBar ? 'menuitem' : 'button'); |
|
| 8592 | return '<div id="' + id + '" class="' + self$$1.classes + '" tabindex="-1" aria-labelledby="' + id + '">' + '<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>'; |
|
| 8593 | }, |
|
| 8594 | postRender: function () { |
|
| 8595 | var self$$1 = this; |
|
| 8596 | self$$1.on('click', function (e) { |
|
| 8597 | if (e.control === self$$1 && isChildOf$1(e.target, self$$1.getEl())) { |
|
| 8598 | self$$1.focus(); |
|
| 8599 | self$$1.showMenu(!e.aria); |
|
| 8600 | if (e.aria) { |
|
| 8601 | self$$1.menu.items().filter(':visible')[0].focus(); |
|
| 8602 | } |
|
| 8603 | } |
|
| 8604 | }); |
|
| 8605 | self$$1.on('mouseenter', function (e) { |
|
| 8606 | var overCtrl = e.control; |
|
| 8607 | var parent$$1 = self$$1.parent(); |
|
| 8608 | var hasVisibleSiblingMenu; |
|
| 8609 | if (overCtrl && parent$$1 && overCtrl instanceof MenuButton && overCtrl.parent() === parent$$1) { |
|
| 8610 | parent$$1.items().filter('MenuButton').each(function (ctrl) { |
|
| 8611 | if (ctrl.hideMenu && ctrl !== overCtrl) { |
|
| 8612 | if (ctrl.menu && ctrl.menu.visible()) { |
|
| 8613 | hasVisibleSiblingMenu = true; |
|
| 8614 | } |
|
| 8615 | ctrl.hideMenu(); |
|
| 8616 | } |
|
| 8617 | }); |
|
| 8618 | if (hasVisibleSiblingMenu) { |
|
| 8619 | overCtrl.focus(); |
|
| 8620 | overCtrl.showMenu(); |
|
| 8621 | } |
|
| 8622 | } |
|
| 8623 | }); |
|
| 8624 | return self$$1._super(); |
|
| 8625 | }, |
|
| 8626 | bindStates: function () { |
|
| 8627 | var self$$1 = this; |
|
| 8628 | self$$1.state.on('change:menu', function () { |
|
| @@ 8436-8467 (lines=32) @@ | ||
| 8433 | self$$1.aria('role', self$$1.parent() instanceof MenuBar ? 'menuitem' : 'button'); |
|
| 8434 | return '<div id="' + id + '" class="' + self$$1.classes + '" tabindex="-1" aria-labelledby="' + id + '">' + '<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>'; |
|
| 8435 | }, |
|
| 8436 | postRender: function () { |
|
| 8437 | var self$$1 = this; |
|
| 8438 | self$$1.on('click', function (e) { |
|
| 8439 | if (e.control === self$$1 && isChildOf$1(e.target, self$$1.getEl())) { |
|
| 8440 | self$$1.focus(); |
|
| 8441 | self$$1.showMenu(!e.aria); |
|
| 8442 | if (e.aria) { |
|
| 8443 | self$$1.menu.items().filter(':visible')[0].focus(); |
|
| 8444 | } |
|
| 8445 | } |
|
| 8446 | }); |
|
| 8447 | self$$1.on('mouseenter', function (e) { |
|
| 8448 | var overCtrl = e.control; |
|
| 8449 | var parent$$1 = self$$1.parent(); |
|
| 8450 | var hasVisibleSiblingMenu; |
|
| 8451 | if (overCtrl && parent$$1 && overCtrl instanceof MenuButton && overCtrl.parent() === parent$$1) { |
|
| 8452 | parent$$1.items().filter('MenuButton').each(function (ctrl) { |
|
| 8453 | if (ctrl.hideMenu && ctrl !== overCtrl) { |
|
| 8454 | if (ctrl.menu && ctrl.menu.visible()) { |
|
| 8455 | hasVisibleSiblingMenu = true; |
|
| 8456 | } |
|
| 8457 | ctrl.hideMenu(); |
|
| 8458 | } |
|
| 8459 | }); |
|
| 8460 | if (hasVisibleSiblingMenu) { |
|
| 8461 | overCtrl.focus(); |
|
| 8462 | overCtrl.showMenu(); |
|
| 8463 | } |
|
| 8464 | } |
|
| 8465 | }); |
|
| 8466 | return self$$1._super(); |
|
| 8467 | }, |
|
| 8468 | bindStates: function () { |
|
| 8469 | var self$$1 = this; |
|
| 8470 | self$$1.state.on('change:menu', function () { |
|