@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/README.md +0 -13
- package/index.cjs +14 -8
- package/index.cjs.map +1 -1
- package/index.js +14 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types/lib/FormBuilder.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -36,19 +36,6 @@ function App() {
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
## Props
|
|
40
|
-
|
|
41
|
-
| Prop | Type | Default | Description |
|
|
42
|
-
|------|------|---------|-------------|
|
|
43
|
-
| `initialForm` | `FormSchema` | - | Initial form data to load |
|
|
44
|
-
| `onChange` | `(form: FormSchema) => void` | - | Called when form changes |
|
|
45
|
-
| `onSave` | `(form: FormSchema) => void` | - | Called when save is triggered |
|
|
46
|
-
| `theme` | `'light' \| 'dark'` | `'light'` | Color theme |
|
|
47
|
-
| `showToolbar` | `boolean` | `true` | Show/hide toolbar |
|
|
48
|
-
| `showComponentLibrary` | `boolean` | `true` | Show/hide component library |
|
|
49
|
-
| `showPropertiesPanel` | `boolean` | `true` | Show/hide properties panel |
|
|
50
|
-
| `className` | `string` | - | Additional CSS class |
|
|
51
|
-
|
|
52
39
|
## Features
|
|
53
40
|
|
|
54
41
|
- 20+ field types (input, textarea, dropdown, checkbox, radio, date, file, signature, rating, etc.)
|
package/index.cjs
CHANGED
|
@@ -28582,15 +28582,21 @@ function FormBuilder({ initialForm, onSave, onChange, className = '', theme = 'l
|
|
|
28582
28582
|
}
|
|
28583
28583
|
const activeData = active.data.current;
|
|
28584
28584
|
const overData = over.data.current;
|
|
28585
|
+
// Check for library item (using actual data structure from ComponentLibrary)
|
|
28586
|
+
const isLibraryItem = activeData?.isLibraryItem;
|
|
28587
|
+
const fieldType = activeData?.componentType || activeData?.type;
|
|
28588
|
+
const isCanvas = overData?.type === 'canvas';
|
|
28589
|
+
const isColumn = overData?.type === 'column' || overData?.columnId;
|
|
28585
28590
|
console.log('[FormBuilder] Checking conditions:', {
|
|
28586
|
-
|
|
28587
|
-
fieldType
|
|
28588
|
-
isCanvas
|
|
28589
|
-
|
|
28591
|
+
isLibraryItem,
|
|
28592
|
+
fieldType,
|
|
28593
|
+
isCanvas,
|
|
28594
|
+
isColumn,
|
|
28595
|
+
activeData,
|
|
28596
|
+
overData
|
|
28590
28597
|
});
|
|
28591
|
-
if (
|
|
28592
|
-
|
|
28593
|
-
if (overData?.isCanvas || overData?.columnId) {
|
|
28598
|
+
if (isLibraryItem && fieldType) {
|
|
28599
|
+
if (isCanvas || isColumn) {
|
|
28594
28600
|
console.log('[FormBuilder] Adding field:', fieldType);
|
|
28595
28601
|
addRowWithField({
|
|
28596
28602
|
type: fieldType,
|
|
@@ -28608,7 +28614,7 @@ function FormBuilder({ initialForm, onSave, onChange, className = '', theme = 'l
|
|
|
28608
28614
|
}
|
|
28609
28615
|
}
|
|
28610
28616
|
else {
|
|
28611
|
-
console.log('[FormBuilder] Not a
|
|
28617
|
+
console.log('[FormBuilder] Not a library item drag');
|
|
28612
28618
|
}
|
|
28613
28619
|
};
|
|
28614
28620
|
return (jsxRuntime.jsx(TooltipProvider, { children: jsxRuntime.jsxs("div", { className: `formbuilder-container ${theme} ${className}`, children: [jsxRuntime.jsxs(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragOver: handleDragOver, onDragEnd: handleDragEnd, children: [jsxRuntime.jsxs("div", { className: "flex flex-col h-full", children: [showToolbar && (jsxRuntime.jsx(Toolbar, { onOpenJsonViewer: () => setJsonViewerOpen(true) })), jsxRuntime.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [showComponentLibrary && (jsxRuntime.jsx(ComponentLibrary, {})), jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntime.jsx(FormCanvas, {}) }), showPropertiesPanel && (jsxRuntime.jsx(PropertiesPanel, {}))] })] }), jsxRuntime.jsx(DragOverlay, { children: activeId && activeType && (jsxRuntime.jsx(DragOverlayContent, { type: activeType })) })] }), jsxRuntime.jsx(JsonViewerModal, { isOpen: jsonViewerOpen, onClose: () => setJsonViewerOpen(false), schema: form })] }) }));
|