Fix disabled property/attribute was not getting reflected down to node, and Et2Box was missing the disabled style

This commit is contained in:
nathan 2021-09-15 14:59:31 -06:00
parent 23f8bc24c2
commit d68b8fdfe4
2 changed files with 22 additions and 3 deletions

View File

@ -18,6 +18,7 @@ export class Et2Box extends Et2Widget(LitElement) implements et2_IDetachedDOM
static get styles() static get styles()
{ {
return [ return [
...super.styles,
css` css`
:host { :host {
display: block; display: block;

View File

@ -7,7 +7,7 @@ import {et2_cloneObject, et2_csvSplit} from "../et2_core_common";
// @ts-ignore // @ts-ignore
import type {IegwAppLocal} from "../../jsapi/egw_global"; import type {IegwAppLocal} from "../../jsapi/egw_global";
import {ClassWithAttributes, ClassWithInterfaces} from "../et2_core_inheritance"; 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"; import type {et2_container} from "../et2_core_baseWidget";
/** /**
@ -65,10 +65,21 @@ const Et2WidgetMixin = (superClass) =>
protected _dom_id : string = ""; protected _dom_id : string = "";
protected _label : string = ""; protected _label : string = "";
private statustext : string = ""; private statustext : string = "";
protected disabled : Boolean = false; protected disabled : boolean = false;
/** WebComponent **/ /** WebComponent **/
static get styles()
{
return [
...(super.styles ? super.styles : []),
css`
:host([disabled]) {
display: none;
}
`];
}
static get properties() static get properties()
{ {
return { return {
@ -195,7 +206,14 @@ const Et2WidgetMixin = (superClass) =>
*/ */
set_disabled(value : boolean) set_disabled(value : boolean)
{ {
this.disabled = value; if(value)
{
this.setAttribute("disabled", "")
}
else
{
this.removeAttribute("disabled");
}
} }
/** /**