mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 12:26:35 +00:00
Fix picture card (#5922)
This commit is contained in:
parent
a66d2ca1b9
commit
c9e8bd2e5d
@ -38,7 +38,7 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public hass?: HomeAssistant;
|
@property() public hass?: HomeAssistant;
|
||||||
|
|
||||||
@property() protected _config?: PictureCardConfig;
|
@property() protected _config?: PictureCardConfig;
|
||||||
|
|
||||||
@ -54,6 +54,13 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
|
|||||||
this._config = config;
|
this._config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
||||||
|
if (changedProps.size === 1 && changedProps.has("hass")) {
|
||||||
|
return !changedProps.get("hass");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected updated(changedProps: PropertyValues): void {
|
protected updated(changedProps: PropertyValues): void {
|
||||||
super.updated(changedProps);
|
super.updated(changedProps);
|
||||||
if (!this._config || !this.hass) {
|
if (!this._config || !this.hass) {
|
||||||
|
@ -250,17 +250,17 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
hasAction(entityConf.tap_action) ? "0" : undefined
|
hasAction(entityConf.tap_action) ? "0" : undefined
|
||||||
)}
|
)}
|
||||||
.config=${entityConf}
|
.config=${entityConf}
|
||||||
class="${classMap({
|
class=${classMap({
|
||||||
"state-on": !STATES_OFF.has(stateObj.state),
|
"state-on": !STATES_OFF.has(stateObj.state),
|
||||||
})}"
|
})}
|
||||||
.icon="${entityConf.icon || stateIcon(stateObj)}"
|
.icon=${entityConf.icon || stateIcon(stateObj)}
|
||||||
title="${`
|
title=${`
|
||||||
${computeStateName(stateObj)} : ${computeStateDisplay(
|
${computeStateName(stateObj)} : ${computeStateDisplay(
|
||||||
this.hass!.localize,
|
this.hass!.localize,
|
||||||
stateObj,
|
stateObj,
|
||||||
this.hass!.language
|
this.hass!.language
|
||||||
)}
|
)}
|
||||||
`}"
|
`}
|
||||||
></ha-icon>
|
></ha-icon>
|
||||||
${this._config!.show_state !== true && entityConf.show_state !== true
|
${this._config!.show_state !== true && entityConf.show_state !== true
|
||||||
? html` <div class="state"></div> `
|
? html` <div class="state"></div> `
|
||||||
@ -328,19 +328,12 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
ha-icon {
|
ha-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 8px;
|
|
||||||
color: #a9a9a9;
|
color: #a9a9a9;
|
||||||
}
|
}
|
||||||
|
|
||||||
ha-icon.state-on {
|
ha-icon.state-on {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
ha-icon.show-state {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
padding-top: 4px;
|
|
||||||
}
|
|
||||||
ha-icon:focus {
|
ha-icon:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
background: var(--divider-color);
|
background: var(--divider-color);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user