Et2Tabs: Recognise hidden & disabled in the template

This commit is contained in:
nathan 2024-08-16 14:40:25 -06:00 committed by ralf
parent ecd7b4557d
commit 11812e36b6

View File

@ -269,6 +269,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
let selected = ""; let selected = "";
this._selectedIndex = -1; this._selectedIndex = -1;
let hidden = {}; let hidden = {};
if(this.id) if(this.id)
{ {
// Set the value for this element // Set the value for this element
@ -297,7 +298,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
if(nodeName == "tab") if(nodeName == "tab")
{ {
const index_name = et2_readAttrWithDefault(node, "id", ''); const index_name = et2_readAttrWithDefault(node, "id", '');
var hide = false; const hide = et2_readAttrWithDefault(node, "hidden", hidden[index_name]);
var widget_options = {}; var widget_options = {};
if(index_name) if(index_name)
{ {
@ -305,10 +306,6 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
{ {
this.selected_index = i; this.selected_index = i;
} }
if(hidden[index_name])
{
hide = true;
}
// Get the class attribute and add it as widget_options // Get the class attribute and add it as widget_options
const classAttr = et2_readAttrWithDefault(node, "class", ''); const classAttr = et2_readAttrWithDefault(node, "class", '');
if(classAttr) if(classAttr)
@ -326,7 +323,8 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
"contentDiv": null, "contentDiv": null,
"flagDiv": null, "flagDiv": null,
"tabNode": node, "tabNode": node,
"hidden": hide, "hidden": et2_readAttrWithDefault(node, "hidden", hidden[index_name] ?? false),
"disabled": et2_readAttrWithDefault(node, "disabled", false),
"XMLNode": null, "XMLNode": null,
"promise": null "promise": null
}); });
@ -398,6 +396,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
panel: tab.id, panel: tab.id,
active: index == this._selectedIndex, active: index == this._selectedIndex,
hidden: tab.hidden, hidden: tab.hidden,
disabled: tab.disabled,
onclick: tab.onclick, onclick: tab.onclick,
ondblclick: tab.ondblclick ondblclick: tab.ondblclick
}, this); }, this);