mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Only pick entities with location in map card editor (#15839)
This commit is contained in:
parent
b0f3006c4b
commit
952028a7be
@ -5,7 +5,10 @@ import { repeat } from "lit/directives/repeat";
|
||||
import type { SortableEvent } from "sortablejs";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import "../../../components/entity/ha-entity-picker";
|
||||
import type { HaEntityPicker } from "../../../components/entity/ha-entity-picker";
|
||||
import type {
|
||||
HaEntityPicker,
|
||||
HaEntityPickerEntityFilterFunc,
|
||||
} from "../../../components/entity/ha-entity-picker";
|
||||
import "../../../components/ha-icon-button";
|
||||
import { sortableStyles } from "../../../resources/ha-sortable-style";
|
||||
import {
|
||||
@ -21,6 +24,8 @@ export class HuiEntityEditor extends LitElement {
|
||||
|
||||
@property({ attribute: false }) protected entities?: EntityConfig[];
|
||||
|
||||
@property() protected entityFilter?: HaEntityPickerEntityFilterFunc;
|
||||
|
||||
@property() protected label?: string;
|
||||
|
||||
private _entityKeys = new WeakMap<EntityConfig, string>();
|
||||
@ -65,6 +70,7 @@ export class HuiEntityEditor extends LitElement {
|
||||
.hass=${this.hass}
|
||||
.value=${entityConf.entity}
|
||||
.index=${index}
|
||||
.entityFilter=${this.entityFilter}
|
||||
@value-changed=${this._valueChanged}
|
||||
allow-custom-entity
|
||||
></ha-entity-picker>
|
||||
@ -75,6 +81,7 @@ export class HuiEntityEditor extends LitElement {
|
||||
<ha-entity-picker
|
||||
class="add-entity"
|
||||
.hass=${this.hass}
|
||||
.entityFilter=${this.entityFilter}
|
||||
@value-changed=${this._addEntity}
|
||||
></ha-entity-picker>
|
||||
`;
|
||||
|
@ -27,6 +27,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
import { entitiesConfigStruct } from "../structs/entities-struct";
|
||||
import { EntitiesEditorEvent } from "../types";
|
||||
import { configElementStyle } from "./config-elements-style";
|
||||
import { hasLocation } from "../../../../common/entity/has_location";
|
||||
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
@ -93,6 +94,7 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
<hui-entity-editor
|
||||
.hass=${this.hass}
|
||||
.entities=${this._configEntities}
|
||||
.entityFilter=${hasLocation}
|
||||
@entities-changed=${this._entitiesValueChanged}
|
||||
></hui-entity-editor>
|
||||
<h3>
|
||||
|
Loading…
x
Reference in New Issue
Block a user