From 03e934ba72b316380c02ec456034dad690f6f6a0 Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Thu, 5 Dec 2024 11:18:18 +0100 Subject: [PATCH] restore not necessary changes --- packages/dataviews/src/normalize-form-fields.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/dataviews/src/normalize-form-fields.ts b/packages/dataviews/src/normalize-form-fields.ts index b0268833f2c85..3cd5f67564d7c 100644 --- a/packages/dataviews/src/normalize-form-fields.ts +++ b/packages/dataviews/src/normalize-form-fields.ts @@ -3,11 +3,11 @@ */ import type { Form } from './types'; -export type NormalizedFormField = { +interface NormalizedFormField { id: string; layout: 'regular' | 'panel'; labelPosition: 'side' | 'top' | 'none'; -}; +} export default function normalizeFormFields( form: Form @@ -20,10 +20,10 @@ export default function normalizeFormFields( const labelPosition = form.labelPosition ?? ( layout === 'regular' ? 'top' : 'side' ); - return Object.entries( form.fields ?? {} ).map( ( [ id, field ] ) => { + return ( form.fields ?? [] ).map( ( field ) => { if ( typeof field === 'string' ) { return { - id, + id: field, layout, labelPosition, }; @@ -35,7 +35,6 @@ export default function normalizeFormFields( ( fieldLayout === 'regular' ? 'top' : 'side' ); return { ...field, - id, layout: fieldLayout, labelPosition: fieldLabelPosition, };