export const FormField = { name: 'FormField', // Static method for direct rendering renderComponent(container, props, app) { console.log('🔍 [DEBUG] FormField.renderComponent() aangeroepen'); if (!container) { console.error('Container element niet gevonden voor FormField'); return null; } console.log('🔍 [DEBUG] FormField container gevonden, Vue app aanmaken'); try { // Maak een nieuwe Vue app instantie met dit component const instance = app.mount(container); console.log('🔍 [DEBUG] FormField component succesvol gemount'); return instance; } catch (error) { console.error('🚨 [ERROR] Fout bij mounten FormField component:', error); return null; } }, props: { field: { type: Object, required: true, validator: (field) => { return field.name && field.type; } }, fieldId: { type: String, required: true }, modelValue: { default: null } }, emits: ['update:modelValue'], computed: { value: { get() { // Gebruik default waarde als modelValue undefined is if (this.modelValue === undefined || this.modelValue === null) { if (this.field.type === 'boolean') { return this.field.default === true; } return this.field.default !== undefined ? this.field.default : ''; } return this.modelValue; }, set(value) { // Voorkom emit als de waarde niet is veranderd if (JSON.stringify(value) !== JSON.stringify(this.modelValue)) { this.$emit('update:modelValue', value); } } }, fieldType() { // Map Python types naar HTML input types const typeMap = { 'str': 'text', 'string': 'text', 'int': 'number', 'integer': 'number', 'float': 'number', 'text': 'textarea', 'enum': 'select', 'options': 'radio', 'boolean': 'checkbox' }; return typeMap[this.field.type] || this.field.type; }, stepValue() { return this.field.type === 'float' ? 'any' : 1; }, description() { return this.field.description || ''; } }, methods: { handleFileUpload(event) { const file = event.target.files[0]; if (file) { this.value = file; } } }, template: `
{{ field.context }}
Geen opties beschikbaar voor dit veld.
Geen opties beschikbaar voor dit veld.
{{ field.context }}
` };