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 { protected render(): TemplateResult {
return html` return html`
${this.label ${this.label
? html`<label>${this.label}${this.required ? "*" : ""}</label>` ? html`<label>${this.label}${this.required ? " *" : ""}</label>`
: ""} : ""}
<div class="time-input-wrap"> <div class="time-input-wrap">
${this.enableDay ${this.enableDay

View File

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

View File

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

View File

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

View File

@ -61,7 +61,9 @@ export class HaYamlEditor extends LitElement {
return html``; return html``;
} }
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 <ha-code-editor
.hass=${this.hass} .hass=${this.hass}
.value=${this._yaml} .value=${this._yaml}