@enerjisaformlibrary/formbuilder-react 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -28562,15 +28562,21 @@ function FormBuilder({ initialForm, onSave, onChange, className = '', theme = 'l
28562
28562
  }
28563
28563
  const activeData = active.data.current;
28564
28564
  const overData = over.data.current;
28565
+ // Check for library item (using actual data structure from ComponentLibrary)
28566
+ const isLibraryItem = activeData?.isLibraryItem;
28567
+ const fieldType = activeData?.componentType || activeData?.type;
28568
+ const isCanvas = overData?.type === 'canvas';
28569
+ const isColumn = overData?.type === 'column' || overData?.columnId;
28565
28570
  console.log('[FormBuilder] Checking conditions:', {
28566
- isNew: activeData?.isNew,
28567
- fieldType: activeData?.fieldType,
28568
- isCanvas: overData?.isCanvas,
28569
- columnId: overData?.columnId
28571
+ isLibraryItem,
28572
+ fieldType,
28573
+ isCanvas,
28574
+ isColumn,
28575
+ activeData,
28576
+ overData
28570
28577
  });
28571
- if (activeData?.isNew && activeData?.fieldType) {
28572
- const fieldType = activeData.fieldType;
28573
- if (overData?.isCanvas || overData?.columnId) {
28578
+ if (isLibraryItem && fieldType) {
28579
+ if (isCanvas || isColumn) {
28574
28580
  console.log('[FormBuilder] Adding field:', fieldType);
28575
28581
  addRowWithField({
28576
28582
  type: fieldType,
@@ -28588,7 +28594,7 @@ function FormBuilder({ initialForm, onSave, onChange, className = '', theme = 'l
28588
28594
  }
28589
28595
  }
28590
28596
  else {
28591
- console.log('[FormBuilder] Not a new field drag');
28597
+ console.log('[FormBuilder] Not a library item drag');
28592
28598
  }
28593
28599
  };
28594
28600
  return (jsx(TooltipProvider, { children: jsxs("div", { className: `formbuilder-container ${theme} ${className}`, children: [jsxs(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragOver: handleDragOver, onDragEnd: handleDragEnd, children: [jsxs("div", { className: "flex flex-col h-full", children: [showToolbar && (jsx(Toolbar, { onOpenJsonViewer: () => setJsonViewerOpen(true) })), jsxs("div", { className: "flex flex-1 overflow-hidden", children: [showComponentLibrary && (jsx(ComponentLibrary, {})), jsx("div", { className: "flex-1 overflow-auto", children: jsx(FormCanvas, {}) }), showPropertiesPanel && (jsx(PropertiesPanel, {}))] })] }), jsx(DragOverlay, { children: activeId && activeType && (jsx(DragOverlayContent, { type: activeType })) })] }), jsx(JsonViewerModal, { isOpen: jsonViewerOpen, onClose: () => setJsonViewerOpen(false), schema: form })] }) }));