Fix labels on new more info (#15983)

This commit is contained in:
Paul Bottein 2023-03-31 15:57:35 +02:00 committed by GitHub
parent d97ddcd31a
commit 33ec1e15a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 19 deletions

View File

@ -25,8 +25,6 @@ export type ControlSelectOption = {
export class HaControlSelect extends LitElement {
@property({ type: Boolean, reflect: true }) disabled = false;
@property() public label?: string;
@property() public options?: ControlSelectOption[];
@property() public value?: string;

View File

@ -2,7 +2,6 @@ import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
import { customElement, property, state } from "lit/decorators";
import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one";
import { computeAttributeNameDisplay } from "../../../../common/entity/compute_attribute_display";
import { stateColorCss } from "../../../../common/entity/state_color";
import { supportsFeature } from "../../../../common/entity/supports-feature";
import "../../../../components/ha-control-select";
@ -13,6 +12,7 @@ import {
AlarmMode,
ALARM_MODES,
} from "../../../../data/alarm_control_panel";
import { UNAVAILABLE } from "../../../../data/entity";
import { HomeAssistant } from "../../../../types";
import { showEnterCodeDialogDialog } from "./show-enter-code-dialog";
@ -117,16 +117,14 @@ export class HaMoreInfoAlarmControlPanelModes extends LitElement {
.options=${options}
.value=${this._currentMode}
@value-changed=${this._valueChanged}
.label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
"percentage"
.ariaLabel=${this.hass.localize(
"ui.dialogs.more_info_control.alarm_control_panel.modes_label"
)}
style=${styleMap({
"--control-select-color": color,
"--modes-count": modes.length.toString(),
})}
.disabled=${this.stateObj!.state === UNAVAILABLE}
>
</ha-control-select>
`;

View File

@ -108,6 +108,7 @@ export class HaMoreInfoFanSpeed extends LitElement {
style=${styleMap({
"--control-select-color": color,
})}
.disabled=${this.stateObj.state === UNAVAILABLE}
>
</ha-control-select>
`;
@ -116,9 +117,9 @@ export class HaMoreInfoFanSpeed extends LitElement {
return html`
<ha-control-slider
vertical
.value=${this.value}
min="0"
max="100"
.value=${this.value}
.step=${this.stateObj.attributes.percentage_step ?? 1}
@value-changed=${this._valueChanged}
.ariaLabel=${computeAttributeNameDisplay(

View File

@ -4,7 +4,6 @@ import { css, html, LitElement, PropertyValues, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one";
import { computeAttributeNameDisplay } from "../../../common/entity/compute_attribute_display";
import { computeDomain } from "../../../common/entity/compute_domain";
import { stateColorCss } from "../../../common/entity/state_color";
import { supportsFeature } from "../../../common/entity/supports-feature";
@ -18,6 +17,7 @@ import {
AlarmMode,
ALARM_MODES,
} from "../../../data/alarm_control_panel";
import { UNAVAILABLE } from "../../../data/entity";
import { showEnterCodeDialogDialog } from "../../../dialogs/more-info/components/alarm_control_panel/show-enter-code-dialog";
import { HomeAssistant } from "../../../types";
import { LovelaceTileFeature, LovelaceTileFeatureEditor } from "../types";
@ -199,16 +199,14 @@ class HuiAlarmModeTileFeature
.value=${this._currentMode}
@value-changed=${this._valueChanged}
hide-label
.label=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
"percentage"
.ariaLabel=${this.hass.localize(
"ui.dialogs.more_info_control.alarm_control_panel.modes_label"
)}
style=${styleMap({
"--control-select-color": color,
"--modes-count": modes.length.toString(),
})}
.disabled=${this.stateObj!.state === UNAVAILABLE}
>
</ha-control-select>
</div>

View File

@ -100,12 +100,13 @@ class HuiFanSpeedTileFeature extends LitElement implements LovelaceTileFeature {
.value=${speed}
@value-changed=${this._speedValueChanged}
hide-label
.label=${computeAttributeNameDisplay(
.ariaLabel=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
"percentage"
)}
.disabled=${this.stateObj!.state === UNAVAILABLE}
>
</ha-control-select>
</div>
@ -124,14 +125,14 @@ class HuiFanSpeedTileFeature extends LitElement implements LovelaceTileFeature {
min="0"
max="100"
.step=${this.stateObj.attributes.percentage_step ?? 1}
.disabled=${this.stateObj!.state === UNAVAILABLE}
@value-changed=${this._valueChanged}
.label=${computeAttributeNameDisplay(
.ariaLabel=${computeAttributeNameDisplay(
this.hass.localize,
this.stateObj,
this.hass.entities,
"percentage"
)}
.disabled=${this.stateObj!.state === UNAVAILABLE}
></ha-control-slider>
</div>
`;

View File

@ -929,6 +929,7 @@
}
},
"alarm_control_panel": {
"modes_label": "Modes",
"modes": {
"away": "Away",
"home": "Home",
@ -4463,7 +4464,7 @@
},
"alarm-modes": {
"label": "Alarm modes",
"modes": "Modes",
"modes": "[%key:ui::dialogs::more_info_control::alarm_control_panel::modes_label%]",
"modes_list": {
"away": "[%key:ui::dialogs::more_info_control::alarm_control_panel::modes::away%]",
"home": "[%key:ui::dialogs::more_info_control::alarm_control_panel::modes::home%]",