packages/ag-grid-docs/src/dist/aui/js/aui.js
// this function is run by jquery .each() where 'this' is the current tabs container
this function is run by jquery .each() where 'this' is the current tabs container
this function is run by jquery . each () where ' this ' is the current tabs container
function calculateResponsiveTabs(tabsContainer, index) {
      var $tabsContainer = (0, _jquery2.default)(tabsContainer);
      var $tabsMenu = $tabsContainer.find('.tabs-menu').first();
      var $visibleTabs = $tabsMenu.find('li:not(.aui-tabs-responsive-trigger-item)');
      var $dropdownTriggerTab = $tabsMenu.find('.aui-tabs-responsive-trigger').parent();
      var $dropdownTrigger = $dropdownTriggerTab.find('a');
      var dropdownId = $dropdownTrigger.attr('aria-controls');
      var $dropdown = (0, _jquery2.default)(document).find('#' + dropdownId).attr('aria-checked', false);
      var isResponsive = $dropdown.length > 0;
      var totalTabsWidth = ResponsiveAdapter.totalTabsWidth($visibleTabs, $dropdown);
      var needsResponsive = totalTabsWidth > $tabsContainer.outerWidth();
      if (!isResponsive && needsResponsive) {
          $dropdownTriggerTab = ResponsiveAdapter.createResponsiveDropdownTrigger($tabsMenu, index);
          $dropdown = ResponsiveAdapter.createResponsiveDropdown($tabsContainer, index);
      }
      $dropdownTrigger.attr('aria-controls', 'aui-tabs-responsive-dropdown-' + index);
      $dropdownTrigger.attr('id', 'aui-tabs-responsive-trigger-' + index);
      $dropdownTrigger.attr('href', 'aui-tabs-responsive-trigger-' + index);
      $dropdown.attr('id', 'aui-tabs-responsive-dropdown-' + index);
      if (needsResponsive) {
          var $newVisibleTabs = ResponsiveAdapter.moveVisibleTabs($visibleTabs.toArray(), $tabsContainer, $dropdownTriggerTab);
          var visibleTabWidth = ResponsiveAdapter.totalVisibleTabWidth($newVisibleTabs);
          var remainingSpace = $tabsContainer.outerWidth() - visibleTabWidth - $dropdownTriggerTab.outerWidth(true);
          var hasSpace = remainingSpace > 0;
          if (hasSpace) {
              var $tabsInDropdown = $dropdown.find('li');
              ResponsiveAdapter.moveInvisibleTabs($tabsInDropdown.toArray(), remainingSpace, $dropdownTriggerTab);
          }
          $dropdown.on('click', 'a', handleTabClick);
          if ($tabsMenu.is(':visible')) {
              $tabsMenu.hide().show();
          }
      }
      if (isResponsive && !needsResponsive) {
          $dropdown.find('li').each(function () {
              ResponsiveAdapter.moveTabOutOfDropdown((0, _jquery2.default)(this), $dropdownTriggerTab);
          });
          ResponsiveAdapter.removeResponsiveDropdown($dropdown, $dropdownTriggerTab);
      }
  }
function calculateResponsiveTabs ( tabsContainer , index ) { var $tabsContainer = ( 0 , _jquery2 . default ) ( tabsContainer ) ; var $tabsMenu = $tabsContainer . find ( '.tabs-menu' ) . first ( ) ; var $visibleTabs = $tabsMenu . find ( 'li:not(.aui-tabs-responsive-trigger-item)' ) ; var $dropdownTriggerTab = $tabsMenu . find ( '.aui-tabs-responsive-trigger' ) . parent ( ) ; var $dropdownTrigger = $dropdownTriggerTab . find ( 'a' ) ; var dropdownId = $dropdownTrigger . attr ( 'aria-controls' ) ; var $dropdown = ( 0 , _jquery2 . default ) ( document ) . find ( '#' + dropdownId ) . attr ( 'aria-checked' , false ) ; var isResponsive = $dropdown . length > 0 ; var totalTabsWidth = ResponsiveAdapter . totalTabsWidth ( $visibleTabs , $dropdown ) ; var needsResponsive = totalTabsWidth > $tabsContainer . outerWidth ( ) ; if ( ! isResponsive && needsResponsive ) { $dropdownTriggerTab = ResponsiveAdapter . createResponsiveDropdownTrigger ( $tabsMenu , index ) ; $dropdown = ResponsiveAdapter . createResponsiveDropdown ( $tabsContainer , index ) ; } $dropdownTrigger . attr ( 'aria-controls' , 'aui-tabs-responsive-dropdown-' + index ) ; $dropdownTrigger . attr ( 'id' , 'aui-tabs-responsive-trigger-' + index ) ; $dropdownTrigger . attr ( 'href' , 'aui-tabs-responsive-trigger-' + index ) ; $dropdown . attr ( 'id' , 'aui-tabs-responsive-dropdown-' + index ) ; if ( needsResponsive ) { var $newVisibleTabs = ResponsiveAdapter . moveVisibleTabs ( $visibleTabs . toArray ( ) , $tabsContainer , $dropdownTriggerTab ) ; var visibleTabWidth = ResponsiveAdapter . totalVisibleTabWidth ( $newVisibleTabs ) ; var remainingSpace = $tabsContainer . outerWidth ( ) - visibleTabWidth - $dropdownTriggerTab . outerWidth ( true ) ; var hasSpace = remainingSpace > 0 ; if ( hasSpace ) { var $tabsInDropdown = $dropdown . find ( 'li' ) ; ResponsiveAdapter . moveInvisibleTabs ( $tabsInDropdown . toArray ( ) , remainingSpace , $dropdownTriggerTab ) ; } $dropdown . on ( 'click' , 'a' , handleTabClick ) ; if ( $tabsMenu . is ( ':visible' ) ) { $tabsMenu . hide ( ) . show ( ) ; } } if ( isResponsive && ! needsResponsive ) { $dropdown . find ( 'li' ) . each ( function ( ) { ResponsiveAdapter . moveTabOutOfDropdown ( ( 0 , _jquery2 . default ) ( this ) , $dropdownTriggerTab ) ; } ) ; ResponsiveAdapter . removeResponsiveDropdown ( $dropdown , $dropdownTriggerTab ) ; } }
this function is run by jquery .each() where 'this' is the current tabs container
this function is run by jquery . each () where ' this ' is the current tabs container
// reset id's in case tabs have changed DOM order /* Workaround for bug in Edge where the dom is just not being re-rendered properly
          It is only triggered for certain widths. Simply taking the element out of the DOM
          and placing it back in causes the browser to re-render, hiding the issue.
          added from AUI-4098 and to be revisited in AUI-4117*/