mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Ajout des composants manquant dans le FormTemplateBuilder [N3WTS-17]
This commit is contained in:
@ -29,13 +29,23 @@ import {
|
||||
Code,
|
||||
Eye,
|
||||
EyeOff,
|
||||
Phone,
|
||||
Radio,
|
||||
ToggleLeft,
|
||||
CheckSquare,
|
||||
FileUp,
|
||||
} from 'lucide-react';
|
||||
|
||||
const FIELD_TYPES_ICON = {
|
||||
text: { icon: TextCursorInput },
|
||||
email: { icon: AtSign },
|
||||
phone: { icon: Phone },
|
||||
date: { icon: Calendar },
|
||||
select: { icon: ChevronDown },
|
||||
radio: { icon: Radio },
|
||||
checkbox: { icon: CheckSquare },
|
||||
toggle: { icon: ToggleLeft },
|
||||
file: { icon: FileUp },
|
||||
textarea: { icon: Type },
|
||||
paragraph: { icon: AlignLeft },
|
||||
heading1: { icon: Heading1 },
|
||||
@ -224,10 +234,22 @@ export default function FormTemplateBuilder() {
|
||||
id: isContentTypeOnly
|
||||
? undefined
|
||||
: generateFieldId(data.label || 'field'),
|
||||
options: data.type === 'select' ? currentField.options : undefined,
|
||||
options: ['select', 'radio'].includes(data.type)
|
||||
? currentField.options
|
||||
: undefined,
|
||||
icon: data.icon || currentField.icon || undefined,
|
||||
placeholder: data.placeholder || undefined,
|
||||
text: isContentTypeOnly ? data.text : undefined,
|
||||
checked: ['checkbox', 'toggle'].includes(data.type)
|
||||
? currentField.checked
|
||||
: undefined,
|
||||
horizontal:
|
||||
data.type === 'checkbox' ? currentField.horizontal : undefined,
|
||||
acceptTypes: data.type === 'file' ? currentField.acceptTypes : undefined,
|
||||
maxSize: data.type === 'file' ? currentField.maxSize : undefined,
|
||||
validation: ['phone', 'email', 'text'].includes(data.type)
|
||||
? currentField.validation
|
||||
: undefined,
|
||||
};
|
||||
|
||||
// Nettoyer les propriétés undefined
|
||||
@ -247,9 +269,7 @@ export default function FormTemplateBuilder() {
|
||||
|
||||
setFormConfig({ ...formConfig, fields: newFields });
|
||||
setEditingIndex(-1);
|
||||
};
|
||||
|
||||
// Modifier un champ existant
|
||||
}; // Modifier un champ existant
|
||||
const editField = (index) => {
|
||||
setEditingIndex(index);
|
||||
setShowAddFieldModal(true);
|
||||
|
||||
Reference in New Issue
Block a user