Merge from support/3.0.2

This commit is contained in:
denis.flaven@combodo.com
2023-03-29 16:56:42 +02:00
3 changed files with 46 additions and 6 deletions

View File

@@ -124,5 +124,15 @@ $.widget( "itop.regulartabs", $.ui.tabs, {
this._off( prevPanels.not( this.panels ) );
}
},
});
// JQuery UI overload
disable: function(index){
let panel = this._getPanelForTab( index );
panel.css({display: 'none'});
this._super( index );
},
enable: function(index) {
let panel = this._getPanelForTab( index );
panel.css({display: 'block'});
this._super( index );
},
});

View File

@@ -377,4 +377,15 @@ $.widget( "itop.scrollabletabs", $.ui.tabs, {
setTab : function(tab){
this.active = tab;
},
});
// JQuery UI overload
disable: function(index){
let panel = this._getPanelForTab( this.tabs[index] );
panel.css({display: 'none'});
this._super( index );
},
enable: function(index) {
let panel = this._getPanelForTab( this.tabs[index] );
panel.css({display: 'block'});
this._super( index );
},
});

View File

@@ -297,6 +297,10 @@ $(function()
const sTabId = oTabHeaderElem.attr('data-tab-id');
const oMatchingExtraTabElem = this.element.find(this.js_selectors.extra_tab_toggler+'[href="#'+sTabId+'"]');
// Disabled tabs are never added to the ExtraTabs list
if (oTabHeaderElem.attr('aria-disabled') == 'true') {
bIsVisible = true;
}
// Manually check if the tab header is visible if the info isn't passed
if (bIsVisible === null) {
bIsVisible = CombodoGlobalToolbox.IsElementVisibleToTheUser(oTabHeaderElem[0], true, 2);
@@ -326,7 +330,7 @@ $(function()
* @return {string} The [data-tab-id] of the iIdx-th tab (zero based). Can return undefined if it has not [data-tab-id] attribute
* @private
*/
_getTabIdFromTabIndex(iIdx) {
_getTabIdFromTabIndex: function(iIdx) {
return this.element.children(this.js_selectors.tabs_list).children(this.js_selectors.tab_header).eq(iIdx).attr('data-tab-id');
},
/**
@@ -334,10 +338,25 @@ $(function()
* @return {number} The index (zero based) of the tab. If no matching tab, 0 will be returned.
* @private
*/
_getTabIndexFromTabId(sId) {
_getTabIndexFromTabId: function(sId) {
const oTabElem = this.element.children(this.js_selectors.tabs_list).children(this.js_selectors.tab_header+'[data-tab-id="'+sId+'"]');
return oTabElem.length === 0 ? 0 : oTabElem.prevAll().length;
}
},
_getTabElementFromTabIndex: function(iIdx) {
return this.element.children(this.js_selectors.tabs_list).children(this.js_selectors.tab_header).eq(iIdx);
},
disableTab: function(iIdx){
let tabsWidget = this.GetTabsWidget();
tabsWidget.disable(iIdx);
let tabElement = this._getTabElementFromTabIndex(iIdx);
this._updateTabHeaderDisplay(tabElement);
},
enableTab: function(iIdx){
let tabsWidget = this.GetTabsWidget();
tabsWidget.enable(iIdx);
let tabElement = this._getTabElementFromTabIndex(iIdx);
this._updateTabHeaderDisplay(tabElement);
}
});
});