Pass helper to ha-form subtypes (#14165)

This commit is contained in:
Steve Repsher 2022-10-25 06:29:05 -04:00 committed by GitHub
parent 62ac9155fc
commit ab1b778439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View File

@ -11,7 +11,9 @@ export class HaFormFloat extends LitElement implements HaFormElement {
@property({ attribute: false }) public data!: HaFormFloatData;
@property() public label!: string;
@property() public label?: string;
@property() public helper?: string;
@property({ type: Boolean }) public disabled = false;
@ -29,6 +31,8 @@ export class HaFormFloat extends LitElement implements HaFormElement {
type="numeric"
inputMode="decimal"
.label=${this.label}
.helper=${this.helper}
helperPersistent
.value=${this.data !== undefined ? this.data : ""}
.disabled=${this.disabled}
.required=${this.schema.required}

View File

@ -21,6 +21,8 @@ export class HaFormInteger extends LitElement implements HaFormElement {
@property() public label?: string;
@property() public helper?: string;
@property({ type: Boolean }) public disabled = false;
@query("ha-textfield ha-slider") private _input?:
@ -74,6 +76,8 @@ export class HaFormInteger extends LitElement implements HaFormElement {
type="number"
inputMode="numeric"
.label=${this.label}
.helper=${this.helper}
helperPersistent
.value=${this.data !== undefined ? this.data : ""}
.disabled=${this.disabled}
.required=${this.schema.required}

View File

@ -19,7 +19,9 @@ export class HaFormSelect extends LitElement implements HaFormElement {
@property() public data!: HaFormSelectData;
@property() public label!: string;
@property() public label?: string;
@property() public helper?: string;
@property({ type: Boolean }) public disabled = false;
@ -41,6 +43,7 @@ export class HaFormSelect extends LitElement implements HaFormElement {
.schema=${this.schema}
.value=${this.data}
.label=${this.label}
.helper=${this.helper}
.disabled=${this.disabled}
.required=${this.schema.required}
.selector=${this._selectSchema(this.schema.options)}

View File

@ -92,6 +92,7 @@ export class HaForm extends LitElement implements HaFormElement {
schema: item,
data: getValue(this.data, item),
label: this._computeLabel(item, this.data),
helper: this._computeHelper(item),
disabled: this.disabled,
hass: this.hass,
computeLabel: this.computeLabel,