form-builder-pro 1.0.2 → 1.0.4
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/dist/index.css +43 -0
- package/dist/index.d.mts +54 -36
- package/dist/index.d.ts +54 -36
- package/dist/index.js +397 -210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +397 -210
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -710,12 +710,18 @@ body {
|
|
|
710
710
|
.pointer-events-none {
|
|
711
711
|
pointer-events: none;
|
|
712
712
|
}
|
|
713
|
+
.visible {
|
|
714
|
+
visibility: visible;
|
|
715
|
+
}
|
|
713
716
|
.static {
|
|
714
717
|
position: static;
|
|
715
718
|
}
|
|
716
719
|
.absolute {
|
|
717
720
|
position: absolute;
|
|
718
721
|
}
|
|
722
|
+
.relative {
|
|
723
|
+
position: relative;
|
|
724
|
+
}
|
|
719
725
|
.left-2 {
|
|
720
726
|
left: 0.5rem;
|
|
721
727
|
}
|
|
@@ -725,6 +731,9 @@ body {
|
|
|
725
731
|
.top-2 {
|
|
726
732
|
top: 0.5rem;
|
|
727
733
|
}
|
|
734
|
+
.z-10 {
|
|
735
|
+
z-index: 10;
|
|
736
|
+
}
|
|
728
737
|
.col-span-12 {
|
|
729
738
|
grid-column: span 12 / span 12;
|
|
730
739
|
}
|
|
@@ -743,6 +752,9 @@ body {
|
|
|
743
752
|
.col-span-9 {
|
|
744
753
|
grid-column: span 9 / span 9;
|
|
745
754
|
}
|
|
755
|
+
.m-4 {
|
|
756
|
+
margin: 1rem;
|
|
757
|
+
}
|
|
746
758
|
.mx-auto {
|
|
747
759
|
margin-left: auto;
|
|
748
760
|
margin-right: auto;
|
|
@@ -987,6 +999,9 @@ body {
|
|
|
987
999
|
.border-primary {
|
|
988
1000
|
border-color: hsl(var(--primary));
|
|
989
1001
|
}
|
|
1002
|
+
.border-transparent {
|
|
1003
|
+
border-color: transparent;
|
|
1004
|
+
}
|
|
990
1005
|
.bg-\[\#019FA2\] {
|
|
991
1006
|
--tw-bg-opacity: 1;
|
|
992
1007
|
background-color: rgb(1 159 162 / var(--tw-bg-opacity, 1));
|
|
@@ -1002,6 +1017,10 @@ body {
|
|
|
1002
1017
|
--tw-bg-opacity: 1;
|
|
1003
1018
|
background-color: rgb(219 234 254 / var(--tw-bg-opacity, 1));
|
|
1004
1019
|
}
|
|
1020
|
+
.bg-blue-50 {
|
|
1021
|
+
--tw-bg-opacity: 1;
|
|
1022
|
+
background-color: rgb(239 246 255 / var(--tw-bg-opacity, 1));
|
|
1023
|
+
}
|
|
1005
1024
|
.bg-blue-600 {
|
|
1006
1025
|
--tw-bg-opacity: 1;
|
|
1007
1026
|
background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
|
|
@@ -1070,6 +1089,9 @@ body {
|
|
|
1070
1089
|
.pb-2 {
|
|
1071
1090
|
padding-bottom: 0.5rem;
|
|
1072
1091
|
}
|
|
1092
|
+
.pb-20 {
|
|
1093
|
+
padding-bottom: 5rem;
|
|
1094
|
+
}
|
|
1073
1095
|
.pt-4 {
|
|
1074
1096
|
padding-top: 1rem;
|
|
1075
1097
|
}
|
|
@@ -1174,11 +1196,23 @@ body {
|
|
|
1174
1196
|
.opacity-100 {
|
|
1175
1197
|
opacity: 1;
|
|
1176
1198
|
}
|
|
1199
|
+
.opacity-50 {
|
|
1200
|
+
opacity: 0.5;
|
|
1201
|
+
}
|
|
1177
1202
|
.shadow-sm {
|
|
1178
1203
|
--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
1179
1204
|
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
|
|
1180
1205
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
1181
1206
|
}
|
|
1207
|
+
.ring-2 {
|
|
1208
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
1209
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
1210
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
1211
|
+
}
|
|
1212
|
+
.ring-blue-500 {
|
|
1213
|
+
--tw-ring-opacity: 1;
|
|
1214
|
+
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1));
|
|
1215
|
+
}
|
|
1182
1216
|
.ring-offset-background {
|
|
1183
1217
|
--tw-ring-offset-color: hsl(var(--background));
|
|
1184
1218
|
}
|
|
@@ -1228,6 +1262,11 @@ body {
|
|
|
1228
1262
|
color: hsl(var(--muted-foreground));
|
|
1229
1263
|
}
|
|
1230
1264
|
|
|
1265
|
+
.hover\:border-blue-200:hover {
|
|
1266
|
+
--tw-border-opacity: 1;
|
|
1267
|
+
border-color: rgb(191 219 254 / var(--tw-border-opacity, 1));
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1231
1270
|
.hover\:border-blue-500:hover {
|
|
1232
1271
|
--tw-border-opacity: 1;
|
|
1233
1272
|
border-color: rgb(59 130 246 / var(--tw-border-opacity, 1));
|
|
@@ -1381,6 +1420,10 @@ body {
|
|
|
1381
1420
|
background-color: rgb(30 58 138 / var(--tw-bg-opacity, 1));
|
|
1382
1421
|
}
|
|
1383
1422
|
|
|
1423
|
+
.dark\:bg-blue-900\/20:is(.dark *) {
|
|
1424
|
+
background-color: rgb(30 58 138 / 0.2);
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1384
1427
|
.dark\:bg-gray-800:is(.dark *) {
|
|
1385
1428
|
--tw-bg-opacity: 1;
|
|
1386
1429
|
background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
|
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,12 @@ interface FormField {
|
|
|
35
35
|
row: number;
|
|
36
36
|
column: number;
|
|
37
37
|
};
|
|
38
|
+
groupName?: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
};
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
visible?: boolean;
|
|
38
44
|
}
|
|
39
45
|
interface FormSection {
|
|
40
46
|
id: string;
|
|
@@ -86,6 +92,49 @@ declare const FormSchemaValidation: z.ZodObject<{
|
|
|
86
92
|
}[];
|
|
87
93
|
}>;
|
|
88
94
|
|
|
95
|
+
interface MasterType {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
displayName: string;
|
|
99
|
+
indexes?: any[];
|
|
100
|
+
active: boolean;
|
|
101
|
+
}
|
|
102
|
+
interface FormState {
|
|
103
|
+
schema: FormSchema;
|
|
104
|
+
selectedFieldId: string | null;
|
|
105
|
+
history: FormSchema[];
|
|
106
|
+
historyIndex: number;
|
|
107
|
+
isPreviewMode: boolean;
|
|
108
|
+
existingForms: FormSchema[];
|
|
109
|
+
templates: FormSection[];
|
|
110
|
+
masterTypes: MasterType[];
|
|
111
|
+
}
|
|
112
|
+
interface FormActions {
|
|
113
|
+
setSchema: (schema: FormSchema) => void;
|
|
114
|
+
togglePreview: () => void;
|
|
115
|
+
setExistingForms: (forms: FormSchema[]) => void;
|
|
116
|
+
setTemplates: (templates: FormSection[]) => void;
|
|
117
|
+
setMasterTypes: (masterTypes: MasterType[]) => void;
|
|
118
|
+
loadForm: (formId: string) => void;
|
|
119
|
+
cloneExistingForm: (formId: string) => void;
|
|
120
|
+
importSection: (section: FormSection) => void;
|
|
121
|
+
addSection: () => void;
|
|
122
|
+
removeSection: (sectionId: string) => void;
|
|
123
|
+
updateSection: (sectionId: string, updates: Partial<FormSection>) => void;
|
|
124
|
+
moveSection: (oldIndex: number, newIndex: number) => void;
|
|
125
|
+
addField: (sectionId: string | null, type: FieldType, index?: number) => void;
|
|
126
|
+
removeField: (fieldId: string) => void;
|
|
127
|
+
updateField: (fieldId: string, updates: Partial<FormField>) => void;
|
|
128
|
+
selectField: (fieldId: string | null) => void;
|
|
129
|
+
moveField: (fieldId: string, targetSectionId: string | null, newIndex: number) => void;
|
|
130
|
+
undo: () => void;
|
|
131
|
+
redo: () => void;
|
|
132
|
+
canUndo: () => boolean;
|
|
133
|
+
canRedo: () => boolean;
|
|
134
|
+
addTemplateFields: (targetSectionId: string, template: FormSection, index?: number) => void;
|
|
135
|
+
}
|
|
136
|
+
declare const formStore: zustand_vanilla.StoreApi<FormState & FormActions>;
|
|
137
|
+
|
|
89
138
|
interface FormBuilderOptions {
|
|
90
139
|
existingForms?: FormSchema[];
|
|
91
140
|
reusableSections?: FormSection[];
|
|
@@ -96,6 +145,9 @@ interface FormBuilderOptions {
|
|
|
96
145
|
onClone?: (schema: FormSchema) => void;
|
|
97
146
|
onSectionImported?: (section: FormSection) => void;
|
|
98
147
|
onTemplateSave?: (template: FormSection) => void;
|
|
148
|
+
data?: {
|
|
149
|
+
masterTypes?: MasterType[];
|
|
150
|
+
};
|
|
99
151
|
}
|
|
100
152
|
declare class FormBuilder {
|
|
101
153
|
private container;
|
|
@@ -119,7 +171,7 @@ declare class FormBuilder {
|
|
|
119
171
|
private renderImportList;
|
|
120
172
|
private renderCanvas;
|
|
121
173
|
private renderConfigPanel;
|
|
122
|
-
private
|
|
174
|
+
private initSidebarSortables;
|
|
123
175
|
}
|
|
124
176
|
|
|
125
177
|
declare class FormRenderer {
|
|
@@ -132,40 +184,6 @@ declare class FormRenderer {
|
|
|
132
184
|
private render;
|
|
133
185
|
}
|
|
134
186
|
|
|
135
|
-
interface FormState {
|
|
136
|
-
schema: FormSchema;
|
|
137
|
-
selectedFieldId: string | null;
|
|
138
|
-
history: FormSchema[];
|
|
139
|
-
historyIndex: number;
|
|
140
|
-
isPreviewMode: boolean;
|
|
141
|
-
existingForms: FormSchema[];
|
|
142
|
-
templates: FormSection[];
|
|
143
|
-
}
|
|
144
|
-
interface FormActions {
|
|
145
|
-
setSchema: (schema: FormSchema) => void;
|
|
146
|
-
togglePreview: () => void;
|
|
147
|
-
setExistingForms: (forms: FormSchema[]) => void;
|
|
148
|
-
setTemplates: (templates: FormSection[]) => void;
|
|
149
|
-
loadForm: (formId: string) => void;
|
|
150
|
-
cloneExistingForm: (formId: string) => void;
|
|
151
|
-
importSection: (section: FormSection) => void;
|
|
152
|
-
addSection: () => void;
|
|
153
|
-
removeSection: (sectionId: string) => void;
|
|
154
|
-
updateSection: (sectionId: string, updates: Partial<FormSection>) => void;
|
|
155
|
-
moveSection: (oldIndex: number, newIndex: number) => void;
|
|
156
|
-
addField: (sectionId: string, type: FieldType, index?: number) => void;
|
|
157
|
-
removeField: (fieldId: string) => void;
|
|
158
|
-
updateField: (fieldId: string, updates: Partial<FormField>) => void;
|
|
159
|
-
selectField: (fieldId: string | null) => void;
|
|
160
|
-
moveField: (fieldId: string, targetSectionId: string, newIndex: number) => void;
|
|
161
|
-
undo: () => void;
|
|
162
|
-
redo: () => void;
|
|
163
|
-
canUndo: () => boolean;
|
|
164
|
-
canRedo: () => boolean;
|
|
165
|
-
addTemplateFields: (targetSectionId: string, template: FormSection, index?: number) => void;
|
|
166
|
-
}
|
|
167
|
-
declare const formStore: zustand_vanilla.StoreApi<FormState & FormActions>;
|
|
168
|
-
|
|
169
187
|
/**
|
|
170
188
|
* Transforms Form Builder JSON to Platform JSON
|
|
171
189
|
* @param builderSchema
|
|
@@ -183,4 +201,4 @@ declare const initFormBuilder: (options: FormBuilderOptions & {
|
|
|
183
201
|
containerId: string;
|
|
184
202
|
}) => FormBuilder;
|
|
185
203
|
|
|
186
|
-
export { AsyncOptionSource, FieldType, FieldWidth, FormBuilder, FormBuilderOptions, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ValidationRule, builderToPlatform, formStore, initFormBuilder, platformToBuilder };
|
|
204
|
+
export { AsyncOptionSource, FieldType, FieldWidth, FormBuilder, FormBuilderOptions, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, MasterType, ValidationRule, builderToPlatform, formStore, initFormBuilder, platformToBuilder };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,12 @@ interface FormField {
|
|
|
35
35
|
row: number;
|
|
36
36
|
column: number;
|
|
37
37
|
};
|
|
38
|
+
groupName?: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
};
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
visible?: boolean;
|
|
38
44
|
}
|
|
39
45
|
interface FormSection {
|
|
40
46
|
id: string;
|
|
@@ -86,6 +92,49 @@ declare const FormSchemaValidation: z.ZodObject<{
|
|
|
86
92
|
}[];
|
|
87
93
|
}>;
|
|
88
94
|
|
|
95
|
+
interface MasterType {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
displayName: string;
|
|
99
|
+
indexes?: any[];
|
|
100
|
+
active: boolean;
|
|
101
|
+
}
|
|
102
|
+
interface FormState {
|
|
103
|
+
schema: FormSchema;
|
|
104
|
+
selectedFieldId: string | null;
|
|
105
|
+
history: FormSchema[];
|
|
106
|
+
historyIndex: number;
|
|
107
|
+
isPreviewMode: boolean;
|
|
108
|
+
existingForms: FormSchema[];
|
|
109
|
+
templates: FormSection[];
|
|
110
|
+
masterTypes: MasterType[];
|
|
111
|
+
}
|
|
112
|
+
interface FormActions {
|
|
113
|
+
setSchema: (schema: FormSchema) => void;
|
|
114
|
+
togglePreview: () => void;
|
|
115
|
+
setExistingForms: (forms: FormSchema[]) => void;
|
|
116
|
+
setTemplates: (templates: FormSection[]) => void;
|
|
117
|
+
setMasterTypes: (masterTypes: MasterType[]) => void;
|
|
118
|
+
loadForm: (formId: string) => void;
|
|
119
|
+
cloneExistingForm: (formId: string) => void;
|
|
120
|
+
importSection: (section: FormSection) => void;
|
|
121
|
+
addSection: () => void;
|
|
122
|
+
removeSection: (sectionId: string) => void;
|
|
123
|
+
updateSection: (sectionId: string, updates: Partial<FormSection>) => void;
|
|
124
|
+
moveSection: (oldIndex: number, newIndex: number) => void;
|
|
125
|
+
addField: (sectionId: string | null, type: FieldType, index?: number) => void;
|
|
126
|
+
removeField: (fieldId: string) => void;
|
|
127
|
+
updateField: (fieldId: string, updates: Partial<FormField>) => void;
|
|
128
|
+
selectField: (fieldId: string | null) => void;
|
|
129
|
+
moveField: (fieldId: string, targetSectionId: string | null, newIndex: number) => void;
|
|
130
|
+
undo: () => void;
|
|
131
|
+
redo: () => void;
|
|
132
|
+
canUndo: () => boolean;
|
|
133
|
+
canRedo: () => boolean;
|
|
134
|
+
addTemplateFields: (targetSectionId: string, template: FormSection, index?: number) => void;
|
|
135
|
+
}
|
|
136
|
+
declare const formStore: zustand_vanilla.StoreApi<FormState & FormActions>;
|
|
137
|
+
|
|
89
138
|
interface FormBuilderOptions {
|
|
90
139
|
existingForms?: FormSchema[];
|
|
91
140
|
reusableSections?: FormSection[];
|
|
@@ -96,6 +145,9 @@ interface FormBuilderOptions {
|
|
|
96
145
|
onClone?: (schema: FormSchema) => void;
|
|
97
146
|
onSectionImported?: (section: FormSection) => void;
|
|
98
147
|
onTemplateSave?: (template: FormSection) => void;
|
|
148
|
+
data?: {
|
|
149
|
+
masterTypes?: MasterType[];
|
|
150
|
+
};
|
|
99
151
|
}
|
|
100
152
|
declare class FormBuilder {
|
|
101
153
|
private container;
|
|
@@ -119,7 +171,7 @@ declare class FormBuilder {
|
|
|
119
171
|
private renderImportList;
|
|
120
172
|
private renderCanvas;
|
|
121
173
|
private renderConfigPanel;
|
|
122
|
-
private
|
|
174
|
+
private initSidebarSortables;
|
|
123
175
|
}
|
|
124
176
|
|
|
125
177
|
declare class FormRenderer {
|
|
@@ -132,40 +184,6 @@ declare class FormRenderer {
|
|
|
132
184
|
private render;
|
|
133
185
|
}
|
|
134
186
|
|
|
135
|
-
interface FormState {
|
|
136
|
-
schema: FormSchema;
|
|
137
|
-
selectedFieldId: string | null;
|
|
138
|
-
history: FormSchema[];
|
|
139
|
-
historyIndex: number;
|
|
140
|
-
isPreviewMode: boolean;
|
|
141
|
-
existingForms: FormSchema[];
|
|
142
|
-
templates: FormSection[];
|
|
143
|
-
}
|
|
144
|
-
interface FormActions {
|
|
145
|
-
setSchema: (schema: FormSchema) => void;
|
|
146
|
-
togglePreview: () => void;
|
|
147
|
-
setExistingForms: (forms: FormSchema[]) => void;
|
|
148
|
-
setTemplates: (templates: FormSection[]) => void;
|
|
149
|
-
loadForm: (formId: string) => void;
|
|
150
|
-
cloneExistingForm: (formId: string) => void;
|
|
151
|
-
importSection: (section: FormSection) => void;
|
|
152
|
-
addSection: () => void;
|
|
153
|
-
removeSection: (sectionId: string) => void;
|
|
154
|
-
updateSection: (sectionId: string, updates: Partial<FormSection>) => void;
|
|
155
|
-
moveSection: (oldIndex: number, newIndex: number) => void;
|
|
156
|
-
addField: (sectionId: string, type: FieldType, index?: number) => void;
|
|
157
|
-
removeField: (fieldId: string) => void;
|
|
158
|
-
updateField: (fieldId: string, updates: Partial<FormField>) => void;
|
|
159
|
-
selectField: (fieldId: string | null) => void;
|
|
160
|
-
moveField: (fieldId: string, targetSectionId: string, newIndex: number) => void;
|
|
161
|
-
undo: () => void;
|
|
162
|
-
redo: () => void;
|
|
163
|
-
canUndo: () => boolean;
|
|
164
|
-
canRedo: () => boolean;
|
|
165
|
-
addTemplateFields: (targetSectionId: string, template: FormSection, index?: number) => void;
|
|
166
|
-
}
|
|
167
|
-
declare const formStore: zustand_vanilla.StoreApi<FormState & FormActions>;
|
|
168
|
-
|
|
169
187
|
/**
|
|
170
188
|
* Transforms Form Builder JSON to Platform JSON
|
|
171
189
|
* @param builderSchema
|
|
@@ -183,4 +201,4 @@ declare const initFormBuilder: (options: FormBuilderOptions & {
|
|
|
183
201
|
containerId: string;
|
|
184
202
|
}) => FormBuilder;
|
|
185
203
|
|
|
186
|
-
export { AsyncOptionSource, FieldType, FieldWidth, FormBuilder, FormBuilderOptions, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, ValidationRule, builderToPlatform, formStore, initFormBuilder, platformToBuilder };
|
|
204
|
+
export { AsyncOptionSource, FieldType, FieldWidth, FormBuilder, FormBuilderOptions, FormField, FormRenderer, FormSchema, FormSchemaValidation, FormSection, MasterType, ValidationRule, builderToPlatform, formStore, initFormBuilder, platformToBuilder };
|