form-builder-pro 0.0.1 → 0.0.2
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 +30 -52
- package/dist/index.css +9 -144
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +28 -13
- package/dist/index.d.ts +28 -13
- package/dist/index.js +38656 -1093
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38653 -1066
- package/dist/index.mjs.map +1 -1
- package/package.json +46 -57
- package/dist/web-components.d.mts +0 -3
- package/dist/web-components.d.ts +0 -3
- package/dist/web-components.js +0 -1139
- package/dist/web-components.js.map +0 -1
- package/dist/web-components.mjs +0 -1114
- package/dist/web-components.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import * as zustand from 'zustand';
|
|
4
|
-
export { registerWebComponents } from './web-components.mjs';
|
|
2
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
5
3
|
|
|
6
4
|
type FieldType = 'text' | 'textarea' | 'number' | 'date' | 'select' | 'checkbox' | 'radio' | 'toggle' | 'file' | 'email' | 'phone';
|
|
7
5
|
type FieldWidth = '25%' | '50%' | '100%';
|
|
@@ -71,14 +69,29 @@ declare const FormSchemaValidation: z.ZodObject<{
|
|
|
71
69
|
}[];
|
|
72
70
|
}>;
|
|
73
71
|
|
|
74
|
-
declare
|
|
72
|
+
declare class FormBuilder {
|
|
73
|
+
private container;
|
|
74
|
+
private unsubscribe;
|
|
75
|
+
constructor(container: HTMLElement);
|
|
76
|
+
private setupSubscriptions;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
private render;
|
|
79
|
+
private renderToolbar;
|
|
80
|
+
private renderToolbox;
|
|
81
|
+
private renderCanvas;
|
|
82
|
+
private renderConfigPanel;
|
|
83
|
+
private initSortable;
|
|
84
|
+
}
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
declare class FormRenderer {
|
|
87
|
+
private container;
|
|
88
|
+
private schema;
|
|
89
|
+
private data;
|
|
90
|
+
private onSubmit?;
|
|
91
|
+
constructor(container: HTMLElement, schema: FormSchema, onSubmit?: (data: any) => void);
|
|
92
|
+
setSchema(schema: FormSchema): void;
|
|
93
|
+
private render;
|
|
80
94
|
}
|
|
81
|
-
declare const FormRenderer: React.FC<FormRendererProps>;
|
|
82
95
|
|
|
83
96
|
interface FormState {
|
|
84
97
|
schema: FormSchema;
|
|
@@ -86,22 +99,24 @@ interface FormState {
|
|
|
86
99
|
history: FormSchema[];
|
|
87
100
|
historyIndex: number;
|
|
88
101
|
isPreviewMode: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface FormActions {
|
|
89
104
|
setSchema: (schema: FormSchema) => void;
|
|
90
105
|
togglePreview: () => void;
|
|
91
106
|
addSection: () => void;
|
|
92
107
|
removeSection: (sectionId: string) => void;
|
|
93
108
|
updateSection: (sectionId: string, updates: Partial<FormSection>) => void;
|
|
94
|
-
moveSection: (
|
|
109
|
+
moveSection: (oldIndex: number, newIndex: number) => void;
|
|
95
110
|
addField: (sectionId: string, type: FieldType, index?: number) => void;
|
|
96
111
|
removeField: (fieldId: string) => void;
|
|
97
112
|
updateField: (fieldId: string, updates: Partial<FormField>) => void;
|
|
98
113
|
selectField: (fieldId: string | null) => void;
|
|
99
|
-
moveField: (
|
|
114
|
+
moveField: (fieldId: string, targetSectionId: string, newIndex: number) => void;
|
|
100
115
|
undo: () => void;
|
|
101
116
|
redo: () => void;
|
|
102
117
|
canUndo: () => boolean;
|
|
103
118
|
canRedo: () => boolean;
|
|
104
119
|
}
|
|
105
|
-
declare const
|
|
120
|
+
declare const formStore: zustand_vanilla.StoreApi<FormState & FormActions>;
|
|
106
121
|
|
|
107
|
-
export { FieldType, FieldWidth, FormBuilder, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ValidationRule,
|
|
122
|
+
export { FieldType, FieldWidth, FormBuilder, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ValidationRule, formStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import * as zustand from 'zustand';
|
|
4
|
-
export { registerWebComponents } from './web-components.js';
|
|
2
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
5
3
|
|
|
6
4
|
type FieldType = 'text' | 'textarea' | 'number' | 'date' | 'select' | 'checkbox' | 'radio' | 'toggle' | 'file' | 'email' | 'phone';
|
|
7
5
|
type FieldWidth = '25%' | '50%' | '100%';
|
|
@@ -71,14 +69,29 @@ declare const FormSchemaValidation: z.ZodObject<{
|
|
|
71
69
|
}[];
|
|
72
70
|
}>;
|
|
73
71
|
|
|
74
|
-
declare
|
|
72
|
+
declare class FormBuilder {
|
|
73
|
+
private container;
|
|
74
|
+
private unsubscribe;
|
|
75
|
+
constructor(container: HTMLElement);
|
|
76
|
+
private setupSubscriptions;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
private render;
|
|
79
|
+
private renderToolbar;
|
|
80
|
+
private renderToolbox;
|
|
81
|
+
private renderCanvas;
|
|
82
|
+
private renderConfigPanel;
|
|
83
|
+
private initSortable;
|
|
84
|
+
}
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
declare class FormRenderer {
|
|
87
|
+
private container;
|
|
88
|
+
private schema;
|
|
89
|
+
private data;
|
|
90
|
+
private onSubmit?;
|
|
91
|
+
constructor(container: HTMLElement, schema: FormSchema, onSubmit?: (data: any) => void);
|
|
92
|
+
setSchema(schema: FormSchema): void;
|
|
93
|
+
private render;
|
|
80
94
|
}
|
|
81
|
-
declare const FormRenderer: React.FC<FormRendererProps>;
|
|
82
95
|
|
|
83
96
|
interface FormState {
|
|
84
97
|
schema: FormSchema;
|
|
@@ -86,22 +99,24 @@ interface FormState {
|
|
|
86
99
|
history: FormSchema[];
|
|
87
100
|
historyIndex: number;
|
|
88
101
|
isPreviewMode: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface FormActions {
|
|
89
104
|
setSchema: (schema: FormSchema) => void;
|
|
90
105
|
togglePreview: () => void;
|
|
91
106
|
addSection: () => void;
|
|
92
107
|
removeSection: (sectionId: string) => void;
|
|
93
108
|
updateSection: (sectionId: string, updates: Partial<FormSection>) => void;
|
|
94
|
-
moveSection: (
|
|
109
|
+
moveSection: (oldIndex: number, newIndex: number) => void;
|
|
95
110
|
addField: (sectionId: string, type: FieldType, index?: number) => void;
|
|
96
111
|
removeField: (fieldId: string) => void;
|
|
97
112
|
updateField: (fieldId: string, updates: Partial<FormField>) => void;
|
|
98
113
|
selectField: (fieldId: string | null) => void;
|
|
99
|
-
moveField: (
|
|
114
|
+
moveField: (fieldId: string, targetSectionId: string, newIndex: number) => void;
|
|
100
115
|
undo: () => void;
|
|
101
116
|
redo: () => void;
|
|
102
117
|
canUndo: () => boolean;
|
|
103
118
|
canRedo: () => boolean;
|
|
104
119
|
}
|
|
105
|
-
declare const
|
|
120
|
+
declare const formStore: zustand_vanilla.StoreApi<FormState & FormActions>;
|
|
106
121
|
|
|
107
|
-
export { FieldType, FieldWidth, FormBuilder, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ValidationRule,
|
|
122
|
+
export { FieldType, FieldWidth, FormBuilder, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ValidationRule, formStore };
|