feat: drag & drop des champs personnalisés
This commit is contained in:
@@ -139,12 +139,15 @@ const parseOptions = (field = {}) => {
|
||||
const normalizeCustomFields = (fields = []) =>
|
||||
fields
|
||||
.filter(field => field?.name && field.name.trim() !== '')
|
||||
.map(field => ({
|
||||
.map((field, index) => ({
|
||||
name: field.name,
|
||||
type: field.type || '',
|
||||
required: !!field.required,
|
||||
options: parseOptions(field)
|
||||
options: parseOptions(field),
|
||||
orderIndex: typeof field.orderIndex === 'number' ? field.orderIndex : index
|
||||
}))
|
||||
.sort((a, b) => (a.orderIndex ?? 0) - (b.orderIndex ?? 0))
|
||||
.map((field, index) => ({ ...field, orderIndex: index }))
|
||||
|
||||
const toIntegerOrNull = (value, fallback = null) => {
|
||||
if (value === '' || value === undefined || value === null) {
|
||||
|
||||
Reference in New Issue
Block a user