Restore missing click & double click events on tab

This commit is contained in:
nathan 2024-07-15 09:08:37 -06:00
parent 076694187c
commit 041cb3b390
2 changed files with 25 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import {Et2Widget} from "../../Et2Widget/Et2Widget";
import {SlTab} from "@shoelace-style/shoelace";
import shoelace from "../../Styles/shoelace";
import {css} from "lit";
import {property} from "lit/decorators/property.js";
export class Et2Tab extends Et2Widget(SlTab)
{
@ -20,20 +21,31 @@ export class Et2Tab extends Et2Widget(SlTab)
];
}
static get properties()
{
return {
...super.properties,
hidden: {type: Boolean, reflect: true}
}
}
@property({type: Function})
ondblclick;
constructor()
{
super();
this.hidden = false;
}
connectedCallback()
{
super.connectedCallback();
if(this.ondblclick)
{
this.addEventListener("dblclick", this.ondblclick);
}
}
disconnectedCallback()
{
super.disconnectedCallback()
this.removeEventListener("dblclick", this.ondblclick);
}
}
customElements.define("et2-tab", Et2Tab);

View File

@ -272,6 +272,8 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
tabData.push({
"id": index_name,
"label": this.egw().lang(et2_readAttrWithDefault(node, "label", "Tab")),
"onclick": et2_readAttrWithDefault(node, "onclick", ''),
"ondblclick": et2_readAttrWithDefault(node, "ondblclick", ''),
"widget": null,
"widget_options": widget_options,
"contentDiv": null,
@ -347,7 +349,9 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
slot: "nav",
panel: tab.id,
active: index == this._selectedIndex,
hidden: tab.hidden
hidden: tab.hidden,
onclick: tab.onclick,
ondblclick: tab.ondblclick
}, this);
// Set tab label