From ff4988b41e2e4149b2f57c16412e96bb545e239e Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 15 Feb 2024 10:13:01 -0700 Subject: [PATCH] Split dropdown category tree into its own file, get colors working in tags --- api/js/etemplate/Et2Tree/Et2TreeDropdown.ts | 26 ++++++++++++------- .../Et2Tree/Et2TreeDropdownCategory.ts | 20 ++++++++++++++ api/js/etemplate/etemplate2.ts | 1 + 3 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 api/js/etemplate/Et2Tree/Et2TreeDropdownCategory.ts diff --git a/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts b/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts index 3a1185c9c0..88abad03ed 100644 --- a/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts +++ b/api/js/etemplate/Et2Tree/Et2TreeDropdown.ts @@ -1,4 +1,5 @@ -import {html, LitElement, nothing} from "lit"; +import {LitElement, nothing} from "lit"; +import {html, literal, StaticValue} from "lit/static-html.js"; import {Et2Tree, TreeItemData} from "./Et2Tree"; import {Et2WidgetWithSelectMixin} from "../Et2Select/Et2WidgetWithSelectMixin"; import {property} from "lit/decorators/property.js"; @@ -426,6 +427,17 @@ export class Et2TreeDropdown extends Et2WidgetWithSelectMixin(LitElement) `; } + /** + * Tag used for rendering tags when multiple=true + * Used for creating, finding & filtering options. + * @see createTagNode() + * @returns {string} + */ + public get tagTag() : StaticValue + { + return literal`et2-tag`; + } + tagsTemplate() { const value = this.getValueAsArray(); @@ -443,9 +455,9 @@ export class Et2TreeDropdown extends Et2WidgetWithSelectMixin(LitElement) const isEditable = false && !readonly; const image = option ? this.iconTemplate(option?.option ?? option) : null; const isValid = true; - + const tagName = this.tagTag; return html` -