FIx: delete champs par default

This commit is contained in:
Matthieu
2025-09-25 11:25:43 +02:00
parent bdae2621c5
commit 7980aa186b
17 changed files with 32 additions and 218 deletions

View File

@@ -36,9 +36,6 @@ const sanitizeCustomFields = (fields: any[]): any[] => {
const type = typeof field?.type === 'string' && field.type ? field.type : 'text'
const required = !!field?.required
const defaultValue = typeof field?.defaultValue === 'string' && field.defaultValue.trim().length > 0
? field.defaultValue.trim()
: undefined
let options: string[] | undefined
if (type === 'select') {
@@ -55,9 +52,6 @@ const sanitizeCustomFields = (fields: any[]): any[] => {
}
const result: Record<string, unknown> = { name, type, required }
if (defaultValue !== undefined) {
result.defaultValue = defaultValue
}
if (options) {
result.options = options
}
@@ -178,7 +172,6 @@ const hydrateCustomFields = (fields: any[]): any[] => {
name: field?.name ?? '',
type: field?.type ?? 'text',
required: !!field?.required,
defaultValue: field?.defaultValue ?? '',
options: Array.isArray(field?.options) ? field.options : [],
optionsText: Array.isArray(field?.options) ? field.options.join('\n') : (field?.optionsText ?? ''),
}))
@@ -240,7 +233,6 @@ const mapComponentCustomFields = (fields: any[]) => {
name: field?.name ?? '',
type: field?.type ?? 'text',
required: !!field?.required,
defaultValue: field?.defaultValue ?? '',
options: Array.isArray(field?.options) ? field.options : [],
optionsText: toOptionsText(field),
}))