FIx: delete champs par default
This commit is contained in:
@@ -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),
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user