Use webcomponent for tabs

+ handle tabs set by variable better
This commit is contained in:
nathan 2022-08-02 14:53:15 -06:00
parent 87198dc7a8
commit d438b4e355
2 changed files with 15 additions and 6 deletions

View File

@ -13,7 +13,7 @@
use EGroupware\Api;
// add et2- prefix to following widgets/tags, if NO <overlay legacy="true"
const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box))(/?|\s[^>]*)>#m';
const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|tabbox))(/?|\s[^>]*)>#m';
const ADD_ET2_PREFIX_LAST_GROUP = 4;
// unconditional of legacy add et2- prefix to this widgets

View File

@ -12,6 +12,7 @@ import {Et2Widget, loadWebComponent} from "../../Et2Widget/Et2Widget";
import {et2_directChildrenByTagName, et2_filteredNodeIterator, et2_readAttrWithDefault} from "../../et2_core_xml";
import {css, PropertyValues} from "@lion/core";
import shoelace from "../../Styles/shoelace";
import {et2_createWidget} from "../../et2_core_widget";
export class Et2Tabs extends Et2Widget(SlTabGroup)
@ -306,11 +307,19 @@ export class Et2Tabs extends Et2Widget(SlTabGroup)
}, this);
// Tab content
let tabContent = tab.contentDiv.createElementFromNode(tab.XMLNode);
tab.contentDiv.appendChild(
typeof window.customElements.get(tab.XMLNode.nodeName) == "undefined" ?
tabContent.getDOMNode() : tabContent
);
if(tab.XMLNode)
{
// Just read the XMLNode
let tabContent = tab.contentDiv.createElementFromNode(tab.XMLNode);
tab.contentDiv.appendChild(
typeof window.customElements.get(tab.XMLNode.nodeName) == "undefined" ?
tabContent.getDOMNode() : tabContent
);
}
else
{
et2_createWidget('template', tab.widget_options, tab.contentDiv);
}
return tab.contentDiv;
}