11import { mdiDragHorizontalVariant } from "@mdi/js" ;
22import { css , html , LitElement , nothing } from "lit" ;
3- import { customElement , property , state } from "lit/decorators" ;
3+ import { customElement , property } from "lit/decorators" ;
44import { repeat } from "lit/directives/repeat" ;
5- import { consumeLocalize } from "../../../common/decorators/consume-context-entry" ;
6- import { fireEvent , type HASSDomEvent } from "../../../common/dom/fire_event" ;
7- import type { LocalizeFunc } from "../../../common/translations/localize" ;
8- import type { HaEntityPicker } from "../../../components/entity/ha-entity-picker" ;
9- import "../../../components/entity/ha-entity-picker" ;
10- import "../../../components/ha-sortable" ;
11- import "../../../components/ha-svg-icon" ;
12- import type { HaEntityPickerEntityFilterFunc } from "../../../data/entity/entity" ;
13- import type { ValueChangedEvent } from "../../../types" ;
14- import "./home-favorite-entity-list-item" ;
15-
16- @customElement ( "home-favorites-editor" )
17- export class HomeFavoritesEditor extends LitElement {
5+ import { fireEvent , type HASSDomEvent } from "../../common/dom/fire_event" ;
6+ import type { HaEntityPicker } from "./ha-entity-picker" ;
7+ import "./ha-entity-picker" ;
8+ import "../ha-sortable" ;
9+ import "../ha-svg-icon" ;
10+ import type { HaEntityPickerEntityFilterFunc } from "../../data/entity/entity" ;
11+ import type { ValueChangedEvent } from "../../types" ;
12+ import "./ha-favorite-entity-list-item" ;
13+
14+ @customElement ( "ha-favorites-editor" )
15+ export class HaFavoritesEditor extends LitElement {
1816 @property ( { attribute : false } ) public favorites : string [ ] = [ ] ;
1917
2018 @property ( ) public label ?: string ;
@@ -26,45 +24,36 @@ export class HomeFavoritesEditor extends LitElement {
2624
2725 @property ( { attribute : "add-button-label" } ) public addButtonLabel ?: string ;
2826
29- @state ( )
30- @consumeLocalize ( )
31- private _localize ! : LocalizeFunc ;
32-
3327 protected render ( ) {
3428 return html `
3529 ${ this . label ? html `<p class= "field-label" > ${ this . label } </ p> ` : nothing }
3630 ${
3731 this . helper ? html `<p class= "field-helper" > ${ this . helper } </ p> ` : nothing
3832 }
3933 <ha- sor table handle-selector= ".handle" @item-moved = ${ this . _moved } >
40- <div class= "home -list" >
34+ <div class= "favorites -list" >
4135 ${ repeat (
4236 this . favorites ,
4337 ( entityId ) => entityId ,
4438 ( entityId , index ) => html `
45- <div class= "home-list-item favorite-row" >
39+ <div class= "favorite-row" >
4640 <div class= "handle" >
4741 <ha- svg- icon .path = ${ mdiDragHorizontalVariant } > </ ha- svg- icon>
4842 </ div>
49- <home -favor ite-entity- lis t- item
43+ <ha - favor ite-entity- lis t- item
5044 class= "favorite-content"
5145 .entityId = ${ entityId }
5246 .index = ${ index }
5347 @delete-favorite-entity = ${ this . _remove }
54- > </ home -favor ite-entity- lis t- item>
48+ > </ ha - favor ite-entity- lis t- item>
5549 </ div>
5650 `
5751 ) }
5852 </ div>
5953 </ ha- sor table>
6054 <ha- entity- picker
6155 add- butto n
62- .addButtonLabel = ${
63- this . addButtonLabel ??
64- this . _localize (
65- "ui.panel.lovelace.editor.strategy.home.add_favorite_entity"
66- )
67- }
56+ .addButtonLabel = ${ this . addButtonLabel }
6857 .excludeEntities = ${ this . favorites }
6958 .entityFilter = ${ this . entityFilter }
7059 @value-changed = ${ this . _add }
@@ -115,7 +104,7 @@ export class HomeFavoritesEditor extends LitElement {
115104 color : var (--secondary-text-color );
116105 font-size : 12px ;
117106 }
118- .home -list {
107+ .favorites -list {
119108 display : flex;
120109 flex-direction : column;
121110 }
@@ -144,6 +133,6 @@ export class HomeFavoritesEditor extends LitElement {
144133
145134declare global {
146135 interface HTMLElementTagNameMap {
147- "home -favorites-editor" : HomeFavoritesEditor ;
136+ "ha -favorites-editor" : HaFavoritesEditor ;
148137 }
149138}
0 commit comments