mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure tab minimum size not applied when there is space for all
This commit is contained in:
parent
00c2dae969
commit
8716e7e601
@ -22,6 +22,7 @@ RED.tabs = (function() {
|
|||||||
function createTabs(options) {
|
function createTabs(options) {
|
||||||
var tabs = {};
|
var tabs = {};
|
||||||
var currentTabWidth;
|
var currentTabWidth;
|
||||||
|
var currentActiveTabWidth = 0;
|
||||||
|
|
||||||
var ul = $("#"+options.id)
|
var ul = $("#"+options.id)
|
||||||
ul.addClass("red-ui-tabs");
|
ul.addClass("red-ui-tabs");
|
||||||
@ -53,7 +54,9 @@ RED.tabs = (function() {
|
|||||||
}
|
}
|
||||||
if (options.hasOwnProperty("minimumActiveTabWidth")) {
|
if (options.hasOwnProperty("minimumActiveTabWidth")) {
|
||||||
ul.children().css({"width":currentTabWidth+"%"});
|
ul.children().css({"width":currentTabWidth+"%"});
|
||||||
link.parent().css({"width":options.minimumActiveTabWidth});
|
if (currentActiveTabWidth !== 0) {
|
||||||
|
link.parent().css({"width":currentActiveTabWidth});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
ul.children().css({"transition": ""});
|
ul.children().css({"transition": ""});
|
||||||
@ -67,16 +70,21 @@ RED.tabs = (function() {
|
|||||||
var tabCount = tabs.size();
|
var tabCount = tabs.size();
|
||||||
var tabWidth = (width-6-(tabCount*7))/tabCount;
|
var tabWidth = (width-6-(tabCount*7))/tabCount;
|
||||||
currentTabWidth = 100*tabWidth/width;
|
currentTabWidth = 100*tabWidth/width;
|
||||||
|
currentActiveTabWidth = currentTabWidth+"%";
|
||||||
|
|
||||||
if (options.hasOwnProperty("minimumActiveTabWidth")) {
|
if (options.hasOwnProperty("minimumActiveTabWidth")) {
|
||||||
if (tabWidth < options.minimumActiveTabWidth) {
|
if (tabWidth < options.minimumActiveTabWidth) {
|
||||||
tabCount -= 1;
|
tabCount -= 1;
|
||||||
tabWidth = (width-7-options.minimumActiveTabWidth-(tabCount*7))/tabCount;
|
tabWidth = (width-7-options.minimumActiveTabWidth-(tabCount*7))/tabCount;
|
||||||
currentTabWidth = 100*tabWidth/width;
|
currentTabWidth = 100*tabWidth/width;
|
||||||
|
currentActiveTabWidth = options.minimumActiveTabWidth+"px";
|
||||||
|
} else {
|
||||||
|
currentActiveTabWidth = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tabs.css({width:currentTabWidth+"%"});
|
tabs.css({width:currentTabWidth+"%"});
|
||||||
|
if (currentActiveTabWidth !== 0) {
|
||||||
ul.find("li.red-ui-tab.active").css({"width":options.minimumActiveTabWidth});
|
ul.find("li.red-ui-tab.active").css({"width":options.minimumActiveTabWidth});
|
||||||
} else {
|
|
||||||
tabs.css({width:currentTabWidth+"%"});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user