mirror of
https://github.com/home-assistant/frontend.git
synced 2026-11-24 21:59:19 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d075c2109 |
No files matched your search
@@ -5,7 +5,7 @@ import { consume } from "../common/decorators/consume";
|
||||
import { computeDomain } from "../common/entity/compute_domain";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import { internationalizationContext, statesContext } from "../data/context";
|
||||
import { statesContext } from "../data/context";
|
||||
import { computeDeviceClassName } from "../data/entity/device_class";
|
||||
import { HaFilterStates } from "./ha-filter-states";
|
||||
|
||||
@@ -15,10 +15,6 @@ export class HaFilterDeviceClasses extends HaFilterStates {
|
||||
@consume({ context: statesContext, subscribe: true })
|
||||
private _entityStates?: ContextType<typeof statesContext>;
|
||||
|
||||
@state()
|
||||
@consume({ context: internationalizationContext, subscribe: true })
|
||||
private _i18n?: ContextType<typeof internationalizationContext>;
|
||||
|
||||
private _deviceClasses = memoizeOne(
|
||||
(
|
||||
states: ContextType<typeof statesContext>,
|
||||
@@ -47,19 +43,14 @@ export class HaFilterDeviceClasses extends HaFilterStates {
|
||||
);
|
||||
|
||||
protected firstUpdated() {
|
||||
this._i18n?.loadBackendTranslation("entity_component");
|
||||
this._i18n.loadBackendTranslation("entity_component");
|
||||
}
|
||||
|
||||
protected willUpdate() {
|
||||
if (
|
||||
this._entityStates &&
|
||||
this._localize &&
|
||||
this._i18n &&
|
||||
(this.expanded || !this.states)
|
||||
) {
|
||||
if (this._entityStates && this._i18n && (this.expanded || !this.states)) {
|
||||
this.states = this._deviceClasses(
|
||||
this._entityStates,
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
this._i18n.locale.language
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { computeDeviceNameDisplay } from "../common/entity/compute_device_name";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
@@ -37,10 +36,6 @@ interface HaFilterDevicesItem extends HaListVirtualizedItem {
|
||||
|
||||
@customElement("ha-filter-devices")
|
||||
export class HaFilterDevices extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: devicesContext, subscribe: true })
|
||||
@state()
|
||||
private _devicesReg!: ContextType<typeof devicesContext>;
|
||||
@@ -111,13 +106,13 @@ export class HaFilterDevices extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.panel.config.devices.caption")}
|
||||
${this._i18n.localize("ui.panel.config.devices.caption")}
|
||||
${
|
||||
this.value?.length
|
||||
? html`<div class="badge">${this.value?.length}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -142,7 +137,7 @@ export class HaFilterDevices extends LitElement {
|
||||
.rows=${this._devices(
|
||||
this._devicesReg,
|
||||
this._filter || "",
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
this._i18n.locale.language
|
||||
)}
|
||||
.rowRenderer=${this._renderItem}
|
||||
@@ -174,7 +169,7 @@ export class HaFilterDevices extends LitElement {
|
||||
this._devices(
|
||||
this._devicesReg,
|
||||
this._filter || "",
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
this._i18n.locale.language
|
||||
)[ev.detail].id,
|
||||
];
|
||||
@@ -184,7 +179,7 @@ export class HaFilterDevices extends LitElement {
|
||||
const id = this._devices(
|
||||
this._devicesReg,
|
||||
this._filter || "",
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
this._i18n.locale.language
|
||||
)[ev.detail].id;
|
||||
this.value = (this.value ?? []).filter((deviceId) => deviceId !== id);
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { arrayWith, arrayWithout } from "../common/array/array-with";
|
||||
import type {
|
||||
HASSDomCurrentTargetEvent,
|
||||
@@ -34,10 +33,6 @@ import type { HaInputSearch } from "./input/ha-input-search";
|
||||
|
||||
@customElement("ha-filter-domains")
|
||||
export class HaFilterDomains extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: statesContext, subscribe: true })
|
||||
@state()
|
||||
private _states!: ContextType<typeof statesContext>;
|
||||
@@ -66,13 +61,13 @@ export class HaFilterDomains extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.panel.config.domains.caption")}
|
||||
${this._i18n.localize("ui.panel.config.domains.caption")}
|
||||
${
|
||||
this.value?.length
|
||||
? html`<div class="badge">${this.value?.length}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -92,14 +87,14 @@ export class HaFilterDomains extends LitElement {
|
||||
</ha-input-search>
|
||||
<ha-list-selectable
|
||||
multi
|
||||
aria-label=${this._localize("ui.panel.config.domains.caption")}
|
||||
aria-label=${this._i18n.localize("ui.panel.config.domains.caption")}
|
||||
@ha-list-item-selected=${this._handleItemToggled}
|
||||
@ha-list-item-deselected=${this._handleItemToggled}
|
||||
>
|
||||
${repeat(
|
||||
this._domains(
|
||||
this._states,
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
this._i18n.locale.language,
|
||||
this._filter
|
||||
),
|
||||
@@ -117,7 +112,7 @@ export class HaFilterDomains extends LitElement {
|
||||
brand-fallback
|
||||
></ha-domain-icon>
|
||||
<span slot="headline"
|
||||
>${domainToName(this._localize, domain)}</span
|
||||
>${domainToName(this._i18n.localize, domain)}</span
|
||||
>
|
||||
</ha-list-item-option>`
|
||||
)}
|
||||
|
||||
@@ -11,12 +11,10 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { arrayWith, arrayWithout } from "../common/array/array-with";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import { deepEqual } from "../common/util/deep-equal";
|
||||
import {
|
||||
apiContext,
|
||||
@@ -42,10 +40,6 @@ interface EntityItem extends HaListVirtualizedItem {
|
||||
|
||||
@customElement("ha-filter-entities")
|
||||
export class HaFilterEntities extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: statesContext, subscribe: true })
|
||||
@state()
|
||||
private _states!: ContextType<typeof statesContext>;
|
||||
@@ -117,13 +111,13 @@ export class HaFilterEntities extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.panel.config.entities.caption")}
|
||||
${this._i18n.localize("ui.panel.config.entities.caption")}
|
||||
${
|
||||
this.value?.length
|
||||
? html`<div class="badge">${this.value?.length}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -144,7 +138,7 @@ export class HaFilterEntities extends LitElement {
|
||||
</ha-input-search>
|
||||
<ha-list-selectable-virtualized
|
||||
multi
|
||||
aria-label=${this._localize("ui.panel.config.entities.caption")}
|
||||
aria-label=${this._i18n.localize("ui.panel.config.entities.caption")}
|
||||
.rows=${this._currentEntities()}
|
||||
.rowRenderer=${this._renderItem}
|
||||
@ha-list-item-selected=${this._handleItemToggled}
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { computeRTL } from "../common/util/compute_rtl";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
@@ -56,10 +55,6 @@ interface TypeRow {
|
||||
|
||||
@customElement("ha-filter-entity-types")
|
||||
export class HaFilterEntityTypes extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: statesContext, subscribe: true })
|
||||
@state()
|
||||
private _states!: ContextType<typeof statesContext>;
|
||||
@@ -96,13 +91,13 @@ export class HaFilterEntityTypes extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.components.filter-entity-types.caption")}
|
||||
${this._i18n.localize("ui.components.filter-entity-types.caption")}
|
||||
${
|
||||
count
|
||||
? html`<div class="badge">${count}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -118,7 +113,7 @@ export class HaFilterEntityTypes extends LitElement {
|
||||
private _renderContent() {
|
||||
const rows = this._rows(
|
||||
this._states,
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
this._i18n.locale.language,
|
||||
this._filter,
|
||||
this._expandedDomains
|
||||
@@ -138,7 +133,7 @@ export class HaFilterEntityTypes extends LitElement {
|
||||
<ha-list-selectable
|
||||
multi
|
||||
controlled
|
||||
aria-label=${this._localize("ui.components.filter-entity-types.caption")}
|
||||
aria-label=${this._i18n.localize("ui.components.filter-entity-types.caption")}
|
||||
@ha-list-item-selected=${this._handleItemToggled}
|
||||
@ha-list-item-deselected=${this._handleItemToggled}
|
||||
>
|
||||
@@ -191,7 +186,7 @@ export class HaFilterEntityTypes extends LitElement {
|
||||
slot="end"
|
||||
data-domain=${row.domain}
|
||||
.path=${row.expanded ? mdiChevronUp : mdiChevronDown}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
row.expanded
|
||||
? "ui.components.filter-entity-types.collapse"
|
||||
: "ui.components.filter-entity-types.expand"
|
||||
|
||||
@@ -14,11 +14,9 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { computeRTL } from "../common/util/compute_rtl";
|
||||
import { deepEqual } from "../common/util/deep-equal";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import type { AreaRegistryEntry } from "../data/area/area_registry";
|
||||
import type { FloorAreasFilterValue } from "../data/data_table_filters";
|
||||
import {
|
||||
@@ -52,10 +50,6 @@ import type { HaListSelectable } from "./list/ha-list-selectable";
|
||||
|
||||
@customElement("ha-filter-floor-areas")
|
||||
export class HaFilterFloorAreas extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: areasContext, subscribe: true })
|
||||
@state()
|
||||
private _areasReg!: ContextType<typeof areasContext>;
|
||||
@@ -160,13 +154,13 @@ export class HaFilterFloorAreas extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.panel.config.areas.caption")}
|
||||
${this._i18n.localize("ui.panel.config.areas.caption")}
|
||||
${
|
||||
count
|
||||
? html`<div class="badge">${count}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -184,7 +178,7 @@ export class HaFilterFloorAreas extends LitElement {
|
||||
multi
|
||||
@ha-list-item-selected=${this._handleAdded}
|
||||
@ha-list-item-deselected=${this._handleRemoved}
|
||||
aria-label=${this._localize("ui.panel.config.areas.caption")}
|
||||
aria-label=${this._i18n.localize("ui.panel.config.areas.caption")}
|
||||
>
|
||||
<ha-list-item-option
|
||||
appearance="checkbox"
|
||||
@@ -194,7 +188,7 @@ export class HaFilterFloorAreas extends LitElement {
|
||||
.selected=${this.value?.no_area || false}
|
||||
>
|
||||
<span slot="headline">
|
||||
${this._localize("ui.components.area-picker.no_area")}
|
||||
${this._i18n.localize("ui.components.area-picker.no_area")}
|
||||
</span>
|
||||
</ha-list-item-option>
|
||||
${repeat(
|
||||
@@ -242,7 +236,7 @@ export class HaFilterFloorAreas extends LitElement {
|
||||
.path=${mdiTextureBox}
|
||||
></ha-svg-icon>
|
||||
<span slot="headline">
|
||||
${this._localize(
|
||||
${this._i18n.localize(
|
||||
"ui.panel.config.areas.picker.other_areas"
|
||||
)}
|
||||
</span>
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { arrayWith, arrayWithout } from "../common/array/array-with";
|
||||
import type {
|
||||
HASSDomCurrentTargetEvent,
|
||||
@@ -62,9 +61,6 @@ export class HaFilterIntegrations extends LitElement {
|
||||
@consume({ context: internationalizationContext, subscribe: true })
|
||||
private _i18n!: ContextType<typeof internationalizationContext>;
|
||||
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: manifestsContext, subscribe: true })
|
||||
@state()
|
||||
private _manifests?: ContextType<typeof manifestsContext>;
|
||||
@@ -92,13 +88,13 @@ export class HaFilterIntegrations extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.panel.config.integrations.caption")}
|
||||
${this._i18n.localize("ui.panel.config.integrations.caption")}
|
||||
${
|
||||
this.value?.length
|
||||
? html`<div class="badge">${this.value?.length}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -120,7 +116,7 @@ export class HaFilterIntegrations extends LitElement {
|
||||
</ha-input-search>
|
||||
<ha-list-selectable
|
||||
multi
|
||||
aria-label=${this._localize(
|
||||
aria-label=${this._i18n.localize(
|
||||
"ui.panel.config.integrations.caption"
|
||||
)}
|
||||
@ha-list-item-selected=${this._handleItemToggled}
|
||||
@@ -128,7 +124,7 @@ export class HaFilterIntegrations extends LitElement {
|
||||
>
|
||||
${repeat(
|
||||
this._integrations(
|
||||
this._localize,
|
||||
this._i18n.localize,
|
||||
manifests,
|
||||
this._filter,
|
||||
this._i18n.locale.language
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
FilterPanelController,
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { arrayWith, arrayWithout } from "../common/array/array-with";
|
||||
import type {
|
||||
HASSDomCurrentTargetEvent,
|
||||
@@ -20,7 +19,6 @@ import type {
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { navigate } from "../common/navigate";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import { internationalizationContext, labelsContext } from "../data/context";
|
||||
import type { LabelRegistryEntry } from "../data/label/label_registry";
|
||||
import "./ha-expansion-panel";
|
||||
@@ -44,10 +42,6 @@ export class HaFilterLabels extends LitElement {
|
||||
|
||||
@property({ type: Boolean, reflect: true }) public expanded = false;
|
||||
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: internationalizationContext, subscribe: true })
|
||||
@state()
|
||||
private _i18n!: ContextType<typeof internationalizationContext>;
|
||||
@@ -88,13 +82,13 @@ export class HaFilterLabels extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.panel.config.labels.caption")}
|
||||
${this._i18n.localize("ui.panel.config.labels.caption")}
|
||||
${
|
||||
this.value?.length
|
||||
? html`<div class="badge">${this.value?.length}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -114,7 +108,7 @@ export class HaFilterLabels extends LitElement {
|
||||
</ha-input-search>
|
||||
<ha-list-selectable
|
||||
multi
|
||||
aria-label=${this._localize("ui.panel.config.labels.caption")}
|
||||
aria-label=${this._i18n.localize("ui.panel.config.labels.caption")}
|
||||
@ha-list-item-selected=${this._handleItemToggled}
|
||||
@ha-list-item-deselected=${this._handleItemToggled}
|
||||
>
|
||||
@@ -154,7 +148,7 @@ export class HaFilterLabels extends LitElement {
|
||||
<ha-list-item-button @click=${this._manageLabels}>
|
||||
<ha-svg-icon slot="start" .path=${mdiCog}></ha-svg-icon>
|
||||
<span slot="headline"
|
||||
>${this._localize("ui.panel.config.labels.manage_labels")}</span
|
||||
>${this._i18n.localize("ui.panel.config.labels.manage_labels")}</span
|
||||
>
|
||||
</ha-list-item-button>
|
||||
</ha-list-base>
|
||||
|
||||
@@ -17,11 +17,9 @@ import {
|
||||
filterPanelStyles,
|
||||
} from "../common/controllers/filter-panel-controller";
|
||||
import { consume } from "../common/decorators/consume";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import {
|
||||
formattersContext,
|
||||
internationalizationContext,
|
||||
@@ -53,10 +51,6 @@ const GROUP_ICONS: Record<LogbookCauseGroup, string> = {
|
||||
|
||||
@customElement("ha-filter-logbook-causes")
|
||||
export class HaFilterLogbookCauses extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
|
||||
@consume({ context: internationalizationContext, subscribe: true })
|
||||
@state()
|
||||
private _i18n!: ContextType<typeof internationalizationContext>;
|
||||
@@ -89,13 +83,13 @@ export class HaFilterLogbookCauses extends LitElement {
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="header">
|
||||
${this._localize("ui.components.logbook.cause_filter.caption")}
|
||||
${this._i18n.localize("ui.components.logbook.cause_filter.caption")}
|
||||
${
|
||||
count
|
||||
? html`<div class="badge">${count}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
@@ -120,7 +114,7 @@ export class HaFilterLogbookCauses extends LitElement {
|
||||
<ha-list-selectable
|
||||
multi
|
||||
controlled
|
||||
aria-label=${this._localize("ui.components.logbook.cause_filter.caption")}
|
||||
aria-label=${this._i18n.localize("ui.components.logbook.cause_filter.caption")}
|
||||
@ha-list-item-selected=${this._handleItemToggled}
|
||||
@ha-list-item-deselected=${this._handleItemToggled}
|
||||
>
|
||||
@@ -153,7 +147,7 @@ export class HaFilterLogbookCauses extends LitElement {
|
||||
.path=${GROUP_ICONS[group]}
|
||||
></ha-svg-icon>
|
||||
<span slot="headline"
|
||||
>${this._localize(
|
||||
>${this._i18n.localize(
|
||||
`ui.components.logbook.cause_filter.${group}`
|
||||
)}</span
|
||||
>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { ContextType } from "@lit/context";
|
||||
import { mdiFilterVariantRemove } from "@mdi/js";
|
||||
import type { CSSResultGroup } from "lit";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
@@ -14,8 +15,8 @@ import type {
|
||||
HASSDomEvent,
|
||||
} from "../common/dom/fire_event";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import { consumeLocalize } from "../common/decorators/consume-context-entry";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import { consume } from "../common/decorators/consume";
|
||||
import { internationalizationContext } from "../data/context";
|
||||
import "./ha-expansion-panel";
|
||||
import "./ha-icon";
|
||||
import "./ha-icon-button";
|
||||
@@ -55,8 +56,8 @@ const isPair = (item: FilterStateItem): item is FilterStatePair =>
|
||||
@customElement("ha-filter-states")
|
||||
export class HaFilterStates extends LitElement {
|
||||
@state()
|
||||
@consumeLocalize()
|
||||
protected _localize!: LocalizeFunc;
|
||||
@consume({ context: internationalizationContext, subscribe: true })
|
||||
protected _i18n!: ContextType<typeof internationalizationContext>;
|
||||
|
||||
@property() public label?: string;
|
||||
|
||||
@@ -89,7 +90,7 @@ export class HaFilterStates extends LitElement {
|
||||
? html`<div class="badge">${this.value?.length}</div>
|
||||
<ha-icon-button
|
||||
.path=${mdiFilterVariantRemove}
|
||||
.label=${this._localize(
|
||||
.label=${this._i18n.localize(
|
||||
"ui.components.subpage-data-table.clear_filter"
|
||||
)}
|
||||
@click=${this._clearFilter}
|
||||
|
||||
Reference in new issue
Block a user