From 72c61184ae1d7218ecaf331a82f7ca77227e6583 Mon Sep 17 00:00:00 2001 From: Afiq Date: Tue, 27 May 2025 11:11:10 +0800 Subject: [PATCH] Refactor Form Components and Enhance JavaScript Execution - Removed unnecessary event propagation handling in ComponentPreview.vue for cleaner interaction. - Adjusted FormBuilderConfiguration.vue to ensure proper min attribute placement for maxFiles input. - Updated FormScriptEngine.vue to allow global CSS injection and added new notification helper functions for success, error, and info messages. - Enhanced FormTemplatesModal.vue with a new CSS & JavaScript test form template, demonstrating real-time calculations and dynamic field updates. - Improved documentation to include a comprehensive JavaScript API reference and updated user guides for better clarity on dynamic form functionalities. - Added new fields to the JSON schema for custom scripts and CSS, enhancing form configuration capabilities. - Updated formBuilder.js to include a method for updating preview form data, improving state management during form interactions. --- components/ComponentPreview.vue | 7 +- components/FormBuilderConfiguration.vue | 4 +- components/FormScriptEngine.vue | 153 +++-- components/FormTemplatesModal.vue | 242 +++++++- components/RsModal.vue | 4 +- doc/README.md | 15 +- doc/form-builder/JAVASCRIPT_API.md | 767 ++++++++++++++++++++++++ doc/form-builder/TECHNICAL_GUIDE.md | 728 +++++++++++++++++++++- doc/form-builder/USER_GUIDE.md | 291 ++++++++- pages/form-builder/index.vue | 380 +++++++----- prisma/json/json-schema.json | 29 + stores/formBuilder.js | 5 + 12 files changed, 2429 insertions(+), 196 deletions(-) create mode 100644 doc/form-builder/JAVASCRIPT_API.md diff --git a/components/ComponentPreview.vue b/components/ComponentPreview.vue index 8503ff0..f5a85a7 100644 --- a/components/ComponentPreview.vue +++ b/components/ComponentPreview.vue @@ -47,9 +47,6 @@ :multiple="component.props.multiple || undefined" :maxSize="component.props.maxSize || undefined" :maxFiles="component.props.maxFiles || undefined" - :preserve-events="isPreview" - @input.capture.stop="isPreview ? $event.stopPropagation() : null" - @click.capture.stop="isPreview ? $event.stopPropagation() : null" :classes="component.type === 'checkbox' ? { wrapper: 'mb-1', options: 'space-y-0.5' @@ -124,7 +121,7 @@ - +

@@ -349,7 +346,7 @@
- +
Unknown component type: {{ component.type }}
diff --git a/components/FormBuilderConfiguration.vue b/components/FormBuilderConfiguration.vue index 7085561..03de8e3 100644 --- a/components/FormBuilderConfiguration.vue +++ b/components/FormBuilderConfiguration.vue @@ -446,8 +446,8 @@ name="maxFiles" v-model="configModel.maxFiles" help="Maximum number of files" - min="1" - /> + min="1" + />
diff --git a/components/FormScriptEngine.vue b/components/FormScriptEngine.vue index c765a3e..bffc849 100644 --- a/components/FormScriptEngine.vue +++ b/components/FormScriptEngine.vue @@ -1,7 +1,7 @@