Et2TreeDropdown fixes

- Fix ID / tag could be doubled by selecting the same tree node multiple times
- Fix global categories had their marker escaped
This commit is contained in:
nathan 2024-02-14 15:26:39 -07:00
parent 5f26b940e3
commit 2bbac91254

View File

@ -353,7 +353,7 @@ export class Et2TreeDropdown extends Et2WidgetWithSelectMixin(LitElement)
else
{
const id = event?.detail?.selection?.map(i => i.id).pop();
if(id)
if(id && !this.value.includes(id))
{
// Copy so LitElement knows it changed
this.value = [...this.value, id];
@ -468,7 +468,7 @@ export class Et2TreeDropdown extends Et2WidgetWithSelectMixin(LitElement)
@click=${typeof this.onTagClick == "function" ? (e) => this.onTagClick(e, e.target) : nothing}
>
${image ?? nothing}
${option.text.trim()}
${(option.label ?? option.text).trim()}
</et2-tag>
`;
}