Only show "required" indicator if we have a selector label (#12241)

This commit is contained in:
Philip Allgaier 2022-04-07 00:11:12 +02:00 committed by GitHub
parent bbca7b762b
commit cfa048ea4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 5 deletions

View File

@ -131,7 +131,7 @@ export class HaBaseTimeInput extends LitElement {
protected render(): TemplateResult {
return html`
${this.label
? html`<label>${this.label}${this.required ? "*" : ""}</label>`
? html`<label>${this.label}${this.required ? " *" : ""}</label>`
: ""}
<div class="time-input-wrap">
${this.enableDay

View File

@ -53,7 +53,7 @@ class HaLabeledSlider extends PolymerElement {
}
_getTitle() {
return `${this.caption}${this.required ? "*" : ""}`;
return `${this.caption}${this.caption && this.required ? " *" : ""}`;
}
static get properties() {

View File

@ -26,7 +26,7 @@ export class HaColorTempSelector extends LitElement {
<ha-labeled-slider
pin
icon="hass:thermometer"
.caption=${this.label}
.caption=${this.label || ""}
.min=${this.selector.color_temp.min_mireds ?? 153}
.max=${this.selector.color_temp.max_mireds ?? 500}
.value=${this.value}

View File

@ -30,7 +30,7 @@ export class HaNumberSelector extends LitElement {
const isBox = this.selector.number.mode === "box";
return html`
${this.label}${this.required ? "*" : ""}
${this.label ? html`${this.label}${this.required ? " *" : ""}` : ""}
<div class="input">
${!isBox
? html`<ha-slider

View File

@ -61,7 +61,9 @@ export class HaYamlEditor extends LitElement {
return html``;
}
return html`
${this.label ? html`<p>${this.label}${this.required ? "*" : ""}</p>` : ""}
${this.label
? html`<p>${this.label}${this.required ? " *" : ""}</p>`
: ""}
<ha-code-editor
.hass=${this.hass}
.value=${this._yaml}