Form in ChatInput are displayed correctly!

This commit is contained in:
Josako
2025-06-13 20:30:56 +02:00
parent 2835486599
commit 3c7460f741
5 changed files with 40 additions and 12 deletions

View File

@@ -0,0 +1,11 @@
/* Animation styles for ChatInput component */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Add more ChatInput-specific styles here */
.loading-spinner {
display: inline-block;
animation: spin 1s linear infinite;
}

View File

@@ -567,7 +567,6 @@ export const ChatApp = {
:is-submitting-form="isSubmittingForm" :is-submitting-form="isSubmittingForm"
:api-prefix="apiPrefix" :api-prefix="apiPrefix"
:auto-scroll="true" :auto-scroll="true"
@submit-form="submitForm"
@specialist-error="handleSpecialistError" @specialist-error="handleSpecialistError"
@specialist-complete="handleSpecialistComplete" @specialist-complete="handleSpecialistComplete"
ref="messageHistory" ref="messageHistory"

View File

@@ -4,6 +4,19 @@
// Anders moet je ervoor zorgen dat MaterialIconManager.js eerder wordt geladen // Anders moet je ervoor zorgen dat MaterialIconManager.js eerder wordt geladen
// en iconManager beschikbaar is via window.iconManager // en iconManager beschikbaar is via window.iconManager
// Voeg stylesheet toe voor ChatInput-specifieke stijlen
const addStylesheet = () => {
if (!document.querySelector('link[href*="chat-input.css"]')) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = '/static/assets/css/chat-input.css';
document.head.appendChild(link);
}
};
// Laad de stylesheet
addStylesheet();
export const ChatInput = { export const ChatInput = {
name: 'ChatInput', name: 'ChatInput',
components: { components: {
@@ -235,7 +248,10 @@
}, },
updateFormValues(newValues) { updateFormValues(newValues) {
this.formValues = { ...newValues }; // Controleer of er daadwerkelijk iets is veranderd om recursieve updates te voorkomen
if (JSON.stringify(newValues) !== JSON.stringify(this.formValues)) {
this.formValues = JSON.parse(JSON.stringify(newValues));
}
} }
}, },
template: ` template: `
@@ -260,13 +276,6 @@
<!-- Geen extra knoppen meer onder het formulier, alles gaat via de hoofdverzendknop --> <!-- Geen extra knoppen meer onder het formulier, alles gaat via de hoofdverzendknop -->
</div> </div>
<style>
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<div class="chat-input"> <div class="chat-input">
<!-- Main input area --> <!-- Main input area -->
<div class="input-main"> <div class="input-main">

View File

@@ -65,13 +65,19 @@ export const DynamicForm = {
watch: { watch: {
formValues: { formValues: {
handler(newValues) { handler(newValues) {
this.localFormValues = { ...newValues }; // Gebruik een vlag om recursieve updates te voorkomen
if (JSON.stringify(newValues) !== JSON.stringify(this.localFormValues)) {
this.localFormValues = JSON.parse(JSON.stringify(newValues));
}
}, },
deep: true deep: true
}, },
localFormValues: { localFormValues: {
handler(newValues) { handler(newValues) {
this.$emit('update:formValues', newValues); // Gebruik een vlag om recursieve updates te voorkomen
if (JSON.stringify(newValues) !== JSON.stringify(this.formValues)) {
this.$emit('update:formValues', JSON.parse(JSON.stringify(newValues)));
}
}, },
deep: true deep: true
}, },

View File

@@ -30,7 +30,10 @@ export const FormField = {
return this.modelValue; return this.modelValue;
}, },
set(value) { set(value) {
this.$emit('update:modelValue', value); // Voorkom emit als de waarde niet is veranderd
if (JSON.stringify(value) !== JSON.stringify(this.modelValue)) {
this.$emit('update:modelValue', value);
}
} }
}, },
fieldType() { fieldType() {