From 5edd7dc7821903b1c6ffc390e83ffb3f0840ad22 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 17 May 2022 10:04:39 -0600 Subject: [PATCH] Do a better extending Et2WidgetWithSelectMixin and using what it provides --- .../Et2DropdownButton/Et2DropdownButton.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts b/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts index 79826e792a..04dadbb912 100644 --- a/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts +++ b/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts @@ -11,7 +11,7 @@ import {Et2Button} from "../Et2Button/Et2Button"; import {SlButtonGroup, SlDropdown} from "@shoelace-style/shoelace"; -import {css, html, repeat, TemplateResult} from "@lion/core"; +import {css, html, TemplateResult} from "@lion/core"; import {Et2widgetWithSelectMixin} from "../Et2Select/Et2WidgetWithSelectMixin"; import {SelectOption} from "../Et2Select/FindSelectOptions"; import {buttonStyles} from "../Et2Button/ButtonStyles"; @@ -119,20 +119,17 @@ export class Et2DropdownButton extends Et2widgetWithSelectMixin(Et2Button) { return html` - ${this.label} + ${this.label} - ${repeat(this.select_options, (option : SelectOption) => option.value, option => - this._itemTemplate(option) - )} `; } - protected _itemTemplate(option : SelectOption) : TemplateResult + protected _optionTemplate(option : SelectOption) : TemplateResult { let icon = option.icon ? html` ` : ''; @@ -167,6 +164,11 @@ export class Et2DropdownButton extends Et2widgetWithSelectMixin(Et2Button) this.requestUpdate("value", oldValue); } + get _optionTargetNode() + { + return this.shadowRoot.querySelector("sl-menu"); + } + get buttonNode() { return this.shadowRoot.querySelector("#main");