From 6fa102dfc56d295687419161a03ccc5da4135ad3 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 13 Feb 2024 11:15:37 -0700 Subject: [PATCH] Get Et2MultiselectTree loading without errors --- .../etemplate/Et2Tree/Et2MultiselectTree.ts | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/api/js/etemplate/Et2Tree/Et2MultiselectTree.ts b/api/js/etemplate/Et2Tree/Et2MultiselectTree.ts index 9aa4a01d7e..29b00ec876 100644 --- a/api/js/etemplate/Et2Tree/Et2MultiselectTree.ts +++ b/api/js/etemplate/Et2Tree/Et2MultiselectTree.ts @@ -1,22 +1,8 @@ -import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget"; -import {SlTree, SlTreeItem} from "@shoelace-style/shoelace"; -import {Et2Link} from "../Et2Link/Et2Link"; -import {et2_no_init} from "../et2_core_common"; -import {egw, framework} from "../../jsapi/egw_global"; -import {SelectOption, find_select_options, cleanSelectOptions} from "../Et2Select/FindSelectOptions"; -import {egwIsMobile} from "../../egw_action/egw_action_common"; -import {Et2WidgetWithSelectMixin} from "../Et2Select/Et2WidgetWithSelectMixin"; -import {LitElement, css, TemplateResult, html, PropertyDeclaration, nothing} from "lit"; +import {SlTreeItem} from "@shoelace-style/shoelace"; +import {html, nothing, TemplateResult} from "lit"; import {repeat} from "lit/directives/repeat.js"; -import shoelace from "../Styles/shoelace"; import {property} from "lit/decorators/property.js"; import {state} from "lit/decorators/state.js"; -import {egw_getActionManager, egw_getAppObjectManager, egwActionObject} from "../../egw_action/egw_action"; -import {et2_action_object_impl} from "../et2_core_DOMWidget"; -import {EgwActionObject} from "../../egw_action/EgwActionObject"; -import {object} from "prop-types"; -import {EgwAction} from "../../egw_action/EgwAction"; -import {query} from "@lion/core"; import {Et2Tree, TreeItemData} from "./Et2Tree"; @@ -46,6 +32,9 @@ export class Et2MultiselectTree extends Et2Tree { constructor() { super(); this.multiple = true; + + this.selectedNodes = []; + this.selectedItems = []; } public set_onchange(_handler: any) @@ -60,6 +49,7 @@ export class Et2MultiselectTree extends Et2Tree { getValue() { let res:string[] = [] + if(this.selectedItems?.length) for (const selectedItem of this.selectedItems) { res.push(selectedItem.id) @@ -135,9 +125,7 @@ export class Et2MultiselectTree extends Et2Tree { } } -// @ts-ignore TypeScript says there's something wrong with types customElements.define("et2-tree-multiple", Et2MultiselectTree); -// @ts-ignore TypeScript says there's something wrong with types customElements.define("et2-tree-cat-multiple", class extends Et2MultiselectTree{});