fix error in mobile template/framework

This commit is contained in:
ralf 2024-09-19 14:49:05 +02:00
parent 7431f0c25a
commit 29b1eaeeb4
2 changed files with 34 additions and 16 deletions

View File

@ -217,6 +217,31 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
this.createTabs(tabData); this.createTabs(tabData);
// Use the height of the first tab if height not set // Use the height of the first tab if height not set
this._sizeTabs();
// 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);
}
}
/**
* Use the height of the first tab if height not set
* @protected
*/
protected _sizeTabs()
{
if(!this.tabHeight && tabData.length > 0) if(!this.tabHeight && tabData.length > 0)
{ {
const firstTab = tabData[0].contentDiv; const firstTab = tabData[0].contentDiv;
@ -246,22 +271,6 @@ 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)

View File

@ -31,6 +31,15 @@ export class Et2TabsMobile extends Et2Tabs
}); });
} }
/**
* Use the height of the first tab if height not set
* @protected
*/
protected _sizeTabs()
{
// no need to do anything, as we use details
}
getAllTabs(includeDisabled = false) getAllTabs(includeDisabled = false)
{ {
const slot = <Et2Details[]><unknown>this.shadowRoot.querySelectorAll('et2-details'); const slot = <Et2Details[]><unknown>this.shadowRoot.querySelectorAll('et2-details');