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;
|
||||
|
||||
|
@ -54,6 +54,13 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
|
|||
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 {
|
||||
super.updated(changedProps);
|
||||
if (!this._config || !this.hass) {
|
||||
|
|
|
@ -250,17 +250,17 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||
hasAction(entityConf.tap_action) ? "0" : undefined
|
||||
)}
|
||||
.config=${entityConf}
|
||||
class="${classMap({
|
||||
class=${classMap({
|
||||
"state-on": !STATES_OFF.has(stateObj.state),
|
||||
})}"
|
||||
.icon="${entityConf.icon || stateIcon(stateObj)}"
|
||||
title="${`
|
||||
})}
|
||||
.icon=${entityConf.icon || stateIcon(stateObj)}
|
||||
title=${`
|
||||
${computeStateName(stateObj)} : ${computeStateDisplay(
|
||||
this.hass!.localize,
|
||||
stateObj,
|
||||
this.hass!.language
|
||||
)}
|
||||
`}"
|
||||
`}
|
||||
></ha-icon>
|
||||
${this._config!.show_state !== true && entityConf.show_state !== true
|
||||
? html` <div class="state"></div> `
|
||||
|
@ -328,19 +328,12 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||
|
||||
ha-icon {
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
color: #a9a9a9;
|
||||
}
|
||||
|
||||
ha-icon.state-on {
|
||||
color: white;
|
||||
}
|
||||
ha-icon.show-state {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
padding-bottom: 4px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
ha-icon:focus {
|
||||
outline: none;
|
||||
background: var(--divider-color);
|
||||
|
|
Loading…
Reference in New Issue