@enerjisaformlibrary/formbuilder-react 1.0.4 → 1.0.6
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/README.md +0 -35
- package/index.cjs +32 -2
- package/index.cjs.map +1 -1
- package/index.js +32 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types/lib/FormBuilder.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -28530,24 +28530,48 @@ function FormBuilder({ initialForm, onSave, onChange, className = '', theme = 'l
|
|
|
28530
28530
|
}));
|
|
28531
28531
|
const handleDragStart = (event) => {
|
|
28532
28532
|
const { active } = event;
|
|
28533
|
+
console.log('[FormBuilder] Drag started:', {
|
|
28534
|
+
id: active.id,
|
|
28535
|
+
data: active.data.current
|
|
28536
|
+
});
|
|
28533
28537
|
setActiveId(active.id);
|
|
28534
28538
|
if (active.data.current?.type) {
|
|
28535
28539
|
setActiveType(active.data.current.type);
|
|
28536
28540
|
}
|
|
28537
28541
|
};
|
|
28538
|
-
const handleDragOver = (
|
|
28542
|
+
const handleDragOver = (event) => {
|
|
28543
|
+
console.log('[FormBuilder] Drag over:', {
|
|
28544
|
+
activeId: event.active.id,
|
|
28545
|
+
overId: event.over?.id,
|
|
28546
|
+
overData: event.over?.data.current
|
|
28547
|
+
});
|
|
28539
28548
|
};
|
|
28540
28549
|
const handleDragEnd = (event) => {
|
|
28541
28550
|
const { active, over } = event;
|
|
28551
|
+
console.log('[FormBuilder] Drag ended:', {
|
|
28552
|
+
activeId: active.id,
|
|
28553
|
+
activeData: active.data.current,
|
|
28554
|
+
overId: over?.id,
|
|
28555
|
+
overData: over?.data.current
|
|
28556
|
+
});
|
|
28542
28557
|
setActiveId(null);
|
|
28543
28558
|
setActiveType(null);
|
|
28544
|
-
if (!over)
|
|
28559
|
+
if (!over) {
|
|
28560
|
+
console.log('[FormBuilder] No drop target (over is null)');
|
|
28545
28561
|
return;
|
|
28562
|
+
}
|
|
28546
28563
|
const activeData = active.data.current;
|
|
28547
28564
|
const overData = over.data.current;
|
|
28565
|
+
console.log('[FormBuilder] Checking conditions:', {
|
|
28566
|
+
isNew: activeData?.isNew,
|
|
28567
|
+
fieldType: activeData?.fieldType,
|
|
28568
|
+
isCanvas: overData?.isCanvas,
|
|
28569
|
+
columnId: overData?.columnId
|
|
28570
|
+
});
|
|
28548
28571
|
if (activeData?.isNew && activeData?.fieldType) {
|
|
28549
28572
|
const fieldType = activeData.fieldType;
|
|
28550
28573
|
if (overData?.isCanvas || overData?.columnId) {
|
|
28574
|
+
console.log('[FormBuilder] Adding field:', fieldType);
|
|
28551
28575
|
addRowWithField({
|
|
28552
28576
|
type: fieldType,
|
|
28553
28577
|
props: {
|
|
@@ -28559,6 +28583,12 @@ function FormBuilder({ initialForm, onSave, onChange, className = '', theme = 'l
|
|
|
28559
28583
|
customStyle: {},
|
|
28560
28584
|
});
|
|
28561
28585
|
}
|
|
28586
|
+
else {
|
|
28587
|
+
console.log('[FormBuilder] Drop target not canvas or column');
|
|
28588
|
+
}
|
|
28589
|
+
}
|
|
28590
|
+
else {
|
|
28591
|
+
console.log('[FormBuilder] Not a new field drag');
|
|
28562
28592
|
}
|
|
28563
28593
|
};
|
|
28564
28594
|
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 })] }) }));
|