Add initial field to the helper input_number in UI (#13378)

This commit is contained in:
alvinchen1 2022-08-13 17:29:33 -04:00 committed by GitHub
parent 651cafc464
commit e0448be24d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,8 @@ class HaInputNumberForm extends LitElement {
@state() private _min?: number;
@state() private _initial?: number;
@state() private _mode?: string;
@state() private _step?: number;
@ -42,6 +44,7 @@ class HaInputNumberForm extends LitElement {
this._min = item.min ?? 0;
this._mode = item.mode || "slider";
this._step = item.step ?? 1;
this._initial = item.initial ?? 0;
this._unit_of_measurement = item.unit_of_measurement;
} else {
this._item = {
@ -54,6 +57,7 @@ class HaInputNumberForm extends LitElement {
this._min = 0;
this._mode = "slider";
this._step = 1;
this._initial = 0;
}
}
@ -112,6 +116,15 @@ class HaInputNumberForm extends LitElement {
"ui.dialogs.helper_settings.input_number.max"
)}
></ha-textfield>
<ha-textfield
.value=${this._initial}
.configValue=${"initial"}
type="number"
@input=${this._valueChanged}
.label=${this.hass!.localize(
"ui.dialogs.helper_settings.input_number.initial"
)}
></ha-textfield>
${this.hass.userData?.showAdvanced
? html`
<div class="layout horizontal center justified">

View File

@ -916,6 +916,7 @@
"pattern": "Regex pattern for client-side validation"
},
"input_number": {
"initial": "Initial value",
"min": "Minimum value",
"max": "Maximum value",
"mode": "Display mode",