Name field in helper forms should not init in the error state (#17111)

This commit is contained in:
karwosts 2023-06-30 08:06:46 -07:00 committed by GitHub
parent ede7daad1a
commit e7c47ef65c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 27 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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