mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Name field in helper forms should not init in the error state (#17111)
This commit is contained in:
parent
ede7daad1a
commit
e7c47ef65c
@ -64,7 +64,6 @@ class HaCounterForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -75,10 +74,11 @@ class HaCounterForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -42,7 +42,6 @@ class HaInputBooleanForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -53,10 +52,11 @@ class HaInputBooleanForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -42,7 +42,6 @@ class HaInputButtonForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -53,10 +52,11 @@ class HaInputButtonForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -56,7 +56,6 @@ class HaInputDateTimeForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -67,10 +66,11 @@ class HaInputDateTimeForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -71,7 +71,6 @@ class HaInputNumberForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -82,10 +81,11 @@ class HaInputNumberForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -54,20 +54,20 @@ class HaInputSelectForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<ha-textfield
|
<ha-textfield
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.value=${this._name}
|
.value=${this._name}
|
||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
.configValue=${"name"}
|
.configValue=${"name"}
|
||||||
@input=${this._valueChanged}
|
@input=${this._valueChanged}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
|
@ -61,7 +61,6 @@ class HaInputTextForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -72,10 +71,11 @@ class HaInputTextForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -141,7 +141,6 @@ class HaScheduleForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -152,10 +151,11 @@ class HaScheduleForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
@ -50,7 +50,6 @@ class HaTimerForm extends LitElement {
|
|||||||
if (!this.hass) {
|
if (!this.hass) {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
const nameInvalid = !this._name || this._name.trim() === "";
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div class="form">
|
<div class="form">
|
||||||
@ -61,10 +60,11 @@ class HaTimerForm extends LitElement {
|
|||||||
.label=${this.hass!.localize(
|
.label=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.generic.name"
|
"ui.dialogs.helper_settings.generic.name"
|
||||||
)}
|
)}
|
||||||
.errorMessage=${this.hass!.localize(
|
autoValidate
|
||||||
|
required
|
||||||
|
.validationMessage=${this.hass!.localize(
|
||||||
"ui.dialogs.helper_settings.required_error_msg"
|
"ui.dialogs.helper_settings.required_error_msg"
|
||||||
)}
|
)}
|
||||||
.invalid=${nameInvalid}
|
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-icon-picker
|
<ha-icon-picker
|
||||||
|
Loading…
x
Reference in New Issue
Block a user