From d68b8fdfe4034ae14518d6e3d00be18c9b1f229a Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 15 Sep 2021 14:59:31 -0600 Subject: [PATCH] Fix disabled property/attribute was not getting reflected down to node, and Et2Box was missing the disabled style --- api/js/etemplate/Et2Box/Et2Box.ts | 1 + api/js/etemplate/Et2Widget/Et2Widget.ts | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Box/Et2Box.ts b/api/js/etemplate/Et2Box/Et2Box.ts index 97bcdaf18d..403b29b238 100644 --- a/api/js/etemplate/Et2Box/Et2Box.ts +++ b/api/js/etemplate/Et2Box/Et2Box.ts @@ -18,6 +18,7 @@ export class Et2Box extends Et2Widget(LitElement) implements et2_IDetachedDOM static get styles() { return [ + ...super.styles, css` :host { display: block; diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 0942fb8bd2..cf29d0db4d 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -7,7 +7,7 @@ import {et2_cloneObject, et2_csvSplit} from "../et2_core_common"; // @ts-ignore import type {IegwAppLocal} from "../../jsapi/egw_global"; import {ClassWithAttributes, ClassWithInterfaces} from "../et2_core_inheritance"; -import {dedupeMixin} from "@lion/core"; +import {css, dedupeMixin} from "@lion/core"; import type {et2_container} from "../et2_core_baseWidget"; /** @@ -65,10 +65,21 @@ const Et2WidgetMixin = (superClass) => protected _dom_id : string = ""; protected _label : string = ""; private statustext : string = ""; - protected disabled : Boolean = false; + protected disabled : boolean = false; /** WebComponent **/ + static get styles() + { + return [ + ...(super.styles ? super.styles : []), + css` + :host([disabled]) { + display: none; + } + `]; + } + static get properties() { return { @@ -195,7 +206,14 @@ const Et2WidgetMixin = (superClass) => */ set_disabled(value : boolean) { - this.disabled = value; + if(value) + { + this.setAttribute("disabled", "") + } + else + { + this.removeAttribute("disabled"); + } } /**