Refactor Form Submission and Field Management Logic

- Simplified the constructor in StoreFormSubmissionJob for improved readability.
- Enhanced the storeFile method to handle null and empty values more robustly, ensuring better validation of file names.
- Updated StorageFileNameParser to return null for empty file names, improving error handling.
- Refactored OpenForm.vue to optimize form initialization and prevent unnecessary reinitializations, enhancing performance.
- Introduced new methods for managing field groups and preventing recursive updates in OpenForm.vue, improving the overall user experience.
- Enhanced FormEditorSidebar.vue to utilize Pinia store for better state management and clarity.
- Improved FormFieldEdit.vue to prevent page jumps during field editing, ensuring a smoother user experience.
- Added new getters in working_form.js for better page management and navigation within forms.

These changes aim to enhance the maintainability and performance of the form handling logic, providing a more efficient and user-friendly experience.
This commit is contained in:
Julien Nahum
2025-03-25 18:35:16 +01:00
parent 61e9493e1e
commit d63ecd43cc
10 changed files with 348 additions and 75 deletions

View File

@@ -124,6 +124,14 @@ const field = computed(() => {
: null
})
// Only set the page once when the component is mounted
// This prevents page jumps when editing field properties
onMounted(() => {
if (selectedFieldIndex.value !== null) {
workingFormStore.setPageForField(selectedFieldIndex.value)
}
})
const isBlockField = computed(() => {
return field.value && field.value.type.startsWith('nf')
})
@@ -147,6 +155,8 @@ function removeBlock() {
}
function closeSidebar() {
// Explicitly clear the selected field index to prevent issues with subsequent block additions
workingFormStore.selectedFieldIndex = null
workingFormStore.closeEditFieldSidebar()
}