export function groupFieldsIntoRows(fields) {
    const rows = [];
    let currentRow = [];
    const flush = () => {
        if (currentRow.length) {
            rows.push(currentRow);
            currentRow = [];
        }
    };
    for (const field of fields) {
        if (field.breakBefore)
            flush();
        if (field.flexGrow != null) {
            currentRow.push(field);
        }
        else {
            flush();
            rows.push([field]);
        }
    }
    flush();
    return rows;
}
export function getFieldFlexStyle(field) {
    if (field.flexGrow == null)
        return undefined;
    return {
        flex: `${field.flexGrow} ${field.flexGrow} ${field.flexBasis ?? 0}`,
    };
}
