Et2Tabs: Better handling of child nodes

This commit is contained in:
nathan 2024-08-13 15:45:43 -06:00
parent 087a35d72e
commit 1e06b9cfc5

View File

@ -245,6 +245,22 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
} }
}) })
} }
// Load any additional child nodes
for(let i = 0; i < _node.childNodes.length; i++)
{
let node = _node.childNodes[i];
let widgetType = node.nodeName.toLowerCase();
// Skip text & already handled nodes
if(["#comment", "#text", "tabs", "tabpanels"].includes(widgetType))
{
continue;
}
// Create the new element
this.createElementFromNode(node);
}
} }
_readTabs(tabData, tabs) _readTabs(tabData, tabs)
@ -308,6 +324,7 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
"widget_options": widget_options, "widget_options": widget_options,
"contentDiv": null, "contentDiv": null,
"flagDiv": null, "flagDiv": null,
"tabNode": node,
"hidden": hide, "hidden": hide,
"XMLNode": null, "XMLNode": null,
"promise": null "promise": null
@ -386,6 +403,11 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
// Set tab label // Set tab label
tab.flagDiv.appendChild(document.createTextNode(tab.label)); tab.flagDiv.appendChild(document.createTextNode(tab.label));
if(tab.tabNode && tab.tabNode.children.length)
{
tab.flagDiv.loadFromXML(tab.tabNode);
}
}); });
tabData.forEach((tab, index) => tabData.forEach((tab, index) =>
{ {