function renderChildEntries()

in packages/bonito-ui/src/components/form/list-form-layout.tsx [106:129]


function renderChildEntries<V extends FormValues>(
    entries: IterableIterator<Entry<V>>,
    rows: JSX.Element[],
    parentKey: string = ""
) {
    for (const entry of entries) {
        const key = `${parentKey}.${entry.name}`;
        if (entry instanceof AbstractParameter) {
            rows.push(<ParameterRow key={key} param={entry} />);
        } else if (entry instanceof ReactItem) {
            rows.push(<ItemRow key={key} item={entry} />);
        } else if (entry instanceof Section) {
            rows.push(<SectionTitle key={key} section={entry} />);
            if (entry.childEntriesCount > 0) {
                renderChildEntries(entry.childEntries(), rows, key);
            }
        } else if (entry instanceof SubForm) {
            rows.push(<SubFormTitle key={key} subForm={entry} />);
            if (entry.childEntriesCount > 0) {
                renderChildEntries(entry.childEntries(), rows, key);
            }
        }
    }
}