mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Support expandable in initial form data (#21153)
This commit is contained in:
parent
d00b3cfc61
commit
00f325e961
@ -2,7 +2,7 @@ import type { Selector } from "../../data/selector";
|
|||||||
import type { HaFormSchema } from "./types";
|
import type { HaFormSchema } from "./types";
|
||||||
|
|
||||||
export const computeInitialHaFormData = (
|
export const computeInitialHaFormData = (
|
||||||
schema: HaFormSchema[]
|
schema: HaFormSchema[] | readonly HaFormSchema[]
|
||||||
): Record<string, any> => {
|
): Record<string, any> => {
|
||||||
const data = {};
|
const data = {};
|
||||||
schema.forEach((field) => {
|
schema.forEach((field) => {
|
||||||
@ -36,6 +36,8 @@ export const computeInitialHaFormData = (
|
|||||||
minutes: 0,
|
minutes: 0,
|
||||||
seconds: 0,
|
seconds: 0,
|
||||||
};
|
};
|
||||||
|
} else if (field.type === "expandable") {
|
||||||
|
data[field.name] = computeInitialHaFormData(field.schema);
|
||||||
} else if ("selector" in field) {
|
} else if ("selector" in field) {
|
||||||
const selector: Selector = field.selector;
|
const selector: Selector = field.selector;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user