1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

fix read-only fields in config flow expandables (#28579)

* fix read-only fields in config flow expandables

* types

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
This commit is contained in:
karwosts
2025-12-16 23:29:56 -08:00
committed by GitHub
parent 9e9adfcc90
commit 9f3d6e1fea

View File

@@ -50,14 +50,27 @@ class StepFlowForm extends LitElement {
this.removeEventListener("keydown", this._handleKeyDown);
}
private handleReadOnlyFields = memoizeOne((schema) =>
schema?.map((field) => ({
private handleReadOnlyFields = memoizeOne((schema) => {
function handleReadOnlyField(field: HaFormSchema) {
return {
...field,
...(Object.values((field as HaFormSelector)?.selector ?? {})[0]?.read_only
...(Object.values((field as HaFormSelector)?.selector ?? {})[0]
?.read_only
? { disabled: true }
: {}),
}))
};
}
return schema?.map((field: HaFormSchema) =>
field.type === "expandable" && field.schema
? {
...field,
schema: field.schema.map((sectionField) =>
handleReadOnlyField(sectionField)
),
}
: handleReadOnlyField(field)
);
});
protected render(): TemplateResult {
const step = this.step;