mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Use localizeValue in ha-form-expandable and ha-form-grid (#22114)
Pass localizeValue to ha-form-expandable and ha-form-grid
This commit is contained in:
parent
5d71d4c0a1
commit
49576189af
@ -30,6 +30,10 @@ export class HaFormExpendable extends LitElement implements HaFormElement {
|
|||||||
options?: { path?: string[] }
|
options?: { path?: string[] }
|
||||||
) => string;
|
) => string;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public localizeValue?: (
|
||||||
|
key: string
|
||||||
|
) => string;
|
||||||
|
|
||||||
private _renderDescription() {
|
private _renderDescription() {
|
||||||
const description = this.computeHelper?.(this.schema);
|
const description = this.computeHelper?.(this.schema);
|
||||||
return description ? html`<p>${description}</p>` : nothing;
|
return description ? html`<p>${description}</p>` : nothing;
|
||||||
@ -86,6 +90,7 @@ export class HaFormExpendable extends LitElement implements HaFormElement {
|
|||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabel}
|
.computeLabel=${this._computeLabel}
|
||||||
.computeHelper=${this._computeHelper}
|
.computeHelper=${this._computeHelper}
|
||||||
|
.localizeValue=${this.localizeValue}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
</div>
|
</div>
|
||||||
</ha-expansion-panel>
|
</ha-expansion-panel>
|
||||||
|
@ -35,6 +35,10 @@ export class HaFormGrid extends LitElement implements HaFormElement {
|
|||||||
schema: HaFormSchema
|
schema: HaFormSchema
|
||||||
) => string;
|
) => string;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public localizeValue?: (
|
||||||
|
key: string
|
||||||
|
) => string;
|
||||||
|
|
||||||
public async focus() {
|
public async focus() {
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
this.renderRoot.querySelector("ha-form")?.focus();
|
this.renderRoot.querySelector("ha-form")?.focus();
|
||||||
@ -65,6 +69,7 @@ export class HaFormGrid extends LitElement implements HaFormElement {
|
|||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this.computeLabel}
|
.computeLabel=${this.computeLabel}
|
||||||
.computeHelper=${this.computeHelper}
|
.computeHelper=${this.computeHelper}
|
||||||
|
.localizeValue=${this.localizeValue}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
|
@ -163,6 +163,7 @@ export class HaForm extends LitElement implements HaFormElement {
|
|||||||
localize: this.hass?.localize,
|
localize: this.hass?.localize,
|
||||||
computeLabel: this.computeLabel,
|
computeLabel: this.computeLabel,
|
||||||
computeHelper: this.computeHelper,
|
computeHelper: this.computeHelper,
|
||||||
|
localizeValue: this.localizeValue,
|
||||||
context: this._generateContext(item),
|
context: this._generateContext(item),
|
||||||
...this.getFormProperties(),
|
...this.getFormProperties(),
|
||||||
})}
|
})}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user