diff --git a/components/FormBuilderComponents.vue b/components/FormBuilderComponents.vue index e78ff9a..1f96b2d 100644 --- a/components/FormBuilderComponents.vue +++ b/components/FormBuilderComponents.vue @@ -1,33 +1,114 @@ @@ -262,23 +343,10 @@ const availableComponents = [ } ]; -// Group components by category -const groupedComponents = computed(() => { - const grouped = {}; - - availableComponents.forEach(component => { - if (!grouped[component.category]) { - grouped[component.category] = { - category: component.category, - components: [] - }; - } - - grouped[component.category].components.push(component); - }); - - return Object.values(grouped); -}); +// Get components by category for rendering in sections +const getComponentsByCategory = (category) => { + return availableComponents.filter(component => component.category === category); +}; // Check if component matches search query const matchesSearch = (component) => { @@ -298,32 +366,29 @@ const onDragStart = (event, component) => { // Set the drag data event.dataTransfer.effectAllowed = 'copy'; event.dataTransfer.setData('component', JSON.stringify(component)); - - // Let browser handle the drag image naturally - // Don't call emit here to avoid double component creation }; -// Add a click handler for adding components directly +// Add a component directly via click const addComponent = (component) => { emit('add-component', component); }; \ No newline at end of file diff --git a/pages/form-builder/index.vue b/pages/form-builder/index.vue index f7913be..02be666 100644 --- a/pages/form-builder/index.vue +++ b/pages/form-builder/index.vue @@ -58,22 +58,14 @@
-

- Available Components -

+

Components

- - +
-
+
@@ -81,16 +73,18 @@

Form Canvas

- Drag components to build your form + Drag components to build your form

Configuration