From 4a18963650b1ddd954f80704972c4b6e54ff9c53 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 16 Aug 2024 14:40:25 -0600 Subject: [PATCH] Et2Tabs: Recognise hidden & disabled in the template --- api/js/etemplate/Layout/Et2Tabs/Et2Tabs.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/api/js/etemplate/Layout/Et2Tabs/Et2Tabs.ts b/api/js/etemplate/Layout/Et2Tabs/Et2Tabs.ts index 94f900495f..78b3ac16a4 100644 --- a/api/js/etemplate/Layout/Et2Tabs/Et2Tabs.ts +++ b/api/js/etemplate/Layout/Et2Tabs/Et2Tabs.ts @@ -269,6 +269,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab let selected = ""; this._selectedIndex = -1; let hidden = {}; + if(this.id) { // Set the value for this element @@ -297,7 +298,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab if(nodeName == "tab") { const index_name = et2_readAttrWithDefault(node, "id", ''); - var hide = false; + const hide = et2_readAttrWithDefault(node, "hidden", hidden[index_name]); var widget_options = {}; if(index_name) { @@ -305,10 +306,6 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab { this.selected_index = i; } - if(hidden[index_name]) - { - hide = true; - } // Get the class attribute and add it as widget_options const classAttr = et2_readAttrWithDefault(node, "class", ''); if(classAttr) @@ -326,7 +323,8 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab "contentDiv": null, "flagDiv": null, "tabNode": node, - "hidden": hide, + "hidden": et2_readAttrWithDefault(node, "hidden", hidden[index_name] ?? false), + "disabled": et2_readAttrWithDefault(node, "disabled", false), "XMLNode": null, "promise": null }); @@ -398,6 +396,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab panel: tab.id, active: index == this._selectedIndex, hidden: tab.hidden, + disabled: tab.disabled, onclick: tab.onclick, ondblclick: tab.ondblclick }, this);