mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 05:47:20 +00:00
Fix entity marker (#10787)
This commit is contained in:
parent
a283acaabf
commit
d43d19190e
@ -2,11 +2,8 @@ import { LitElement, html, css } from "lit";
|
|||||||
import { property } from "lit/decorators";
|
import { property } from "lit/decorators";
|
||||||
import { styleMap } from "lit/directives/style-map";
|
import { styleMap } from "lit/directives/style-map";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { HomeAssistant } from "../../types";
|
|
||||||
|
|
||||||
class HaEntityMarker extends LitElement {
|
class HaEntityMarker extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
|
||||||
|
|
||||||
@property({ attribute: "entity-id" }) public entityId?: string;
|
@property({ attribute: "entity-id" }) public entityId?: string;
|
||||||
|
|
||||||
@property({ attribute: "entity-name" }) public entityName?: string;
|
@property({ attribute: "entity-name" }) public entityName?: string;
|
||||||
@ -26,9 +23,7 @@ class HaEntityMarker extends LitElement {
|
|||||||
? html`<div
|
? html`<div
|
||||||
class="entity-picture"
|
class="entity-picture"
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
"background-image": `url(${this.hass.hassUrl(
|
"background-image": `url(${this.entityPicture})`,
|
||||||
this.entityPicture
|
|
||||||
)})`,
|
|
||||||
})}
|
})}
|
||||||
></div>`
|
></div>`
|
||||||
: this.entityName}
|
: this.entityName}
|
||||||
@ -69,3 +64,9 @@ class HaEntityMarker extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("ha-entity-marker", HaEntityMarker);
|
customElements.define("ha-entity-marker", HaEntityMarker);
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"ha-entity-marker": HaEntityMarker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -412,7 +412,9 @@ export class HaMap extends ReactiveElement {
|
|||||||
<ha-entity-marker
|
<ha-entity-marker
|
||||||
entity-id="${getEntityId(entity)}"
|
entity-id="${getEntityId(entity)}"
|
||||||
entity-name="${entityName}"
|
entity-name="${entityName}"
|
||||||
entity-picture="${entityPicture || ""}"
|
entity-picture="${
|
||||||
|
entityPicture ? this.hass.hassUrl(entityPicture) : ""
|
||||||
|
}"
|
||||||
${
|
${
|
||||||
typeof entity !== "string"
|
typeof entity !== "string"
|
||||||
? `entity-color="${entity.color}"`
|
? `entity-color="${entity.color}"`
|
||||||
|
@ -17,7 +17,6 @@ import "../../../components/ha-card";
|
|||||||
import "../../../components/ha-icon-button";
|
import "../../../components/ha-icon-button";
|
||||||
import { fetchRecent } from "../../../data/history";
|
import { fetchRecent } from "../../../data/history";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import "../../../components/map/ha-entity-marker";
|
|
||||||
import { findEntities } from "../common/find-entities";
|
import { findEntities } from "../common/find-entities";
|
||||||
import { processConfigEntities } from "../common/process-config-entities";
|
import { processConfigEntities } from "../common/process-config-entities";
|
||||||
import { EntityConfig } from "../entity-rows/types";
|
import { EntityConfig } from "../entity-rows/types";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user