mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-28 15:27:20 +00:00
Ensure conditional
rows getting state_color
value (#10708)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
a5be143c3b
commit
e91d1777d0
@ -289,7 +289,8 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
private renderEntity(entityConf: LovelaceRowConfig): TemplateResult {
|
private renderEntity(entityConf: LovelaceRowConfig): TemplateResult {
|
||||||
const element = createRowElement(
|
const element = createRowElement(
|
||||||
!("type" in entityConf) && this._config!.state_color
|
(!("type" in entityConf) || entityConf.type === "conditional") &&
|
||||||
|
this._config!.state_color
|
||||||
? ({
|
? ({
|
||||||
state_color: true,
|
state_color: true,
|
||||||
...(entityConf as EntityConfig),
|
...(entityConf as EntityConfig),
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
|
import { EntityCardConfig } from "../cards/types";
|
||||||
import { HuiConditionalBase } from "../components/hui-conditional-base";
|
import { HuiConditionalBase } from "../components/hui-conditional-base";
|
||||||
import { createRowElement } from "../create-element/create-row-element";
|
import { createRowElement } from "../create-element/create-row-element";
|
||||||
import { ConditionalRowConfig, LovelaceRow } from "../entity-rows/types";
|
import {
|
||||||
|
ConditionalRowConfig,
|
||||||
|
EntityConfig,
|
||||||
|
LovelaceRow,
|
||||||
|
} from "../entity-rows/types";
|
||||||
|
|
||||||
@customElement("hui-conditional-row")
|
@customElement("hui-conditional-row")
|
||||||
class HuiConditionalRow extends HuiConditionalBase implements LovelaceRow {
|
class HuiConditionalRow extends HuiConditionalBase implements LovelaceRow {
|
||||||
@ -12,7 +17,14 @@ class HuiConditionalRow extends HuiConditionalBase implements LovelaceRow {
|
|||||||
throw new Error("No row configured");
|
throw new Error("No row configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
this._element = createRowElement(config.row) as LovelaceRow;
|
this._element = createRowElement(
|
||||||
|
(config as EntityCardConfig).state_color
|
||||||
|
? ({
|
||||||
|
state_color: true,
|
||||||
|
...(config.row as EntityConfig),
|
||||||
|
} as EntityConfig)
|
||||||
|
: config.row
|
||||||
|
) as LovelaceRow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user