form-builder-pro 0.0.9 → 1.0.0
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 +467 -248
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
- package/dist/index.css.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,7 @@ declare const FormSchemaValidation: z.ZodObject<{
|
|
|
89
89
|
interface FormBuilderOptions {
|
|
90
90
|
existingForms?: FormSchema[];
|
|
91
91
|
reusableSections?: FormSection[];
|
|
92
|
+
formTemplates?: FormSchema[];
|
|
92
93
|
mode?: 'create' | 'edit';
|
|
93
94
|
formJson?: FormSchema;
|
|
94
95
|
onSave?: (schema: FormSchema) => void;
|
|
@@ -107,6 +108,8 @@ declare class FormBuilder {
|
|
|
107
108
|
saveSectionAsTemplate(section: FormSection): void;
|
|
108
109
|
applyTemplate(template: FormSection): void;
|
|
109
110
|
updateExistingForms(forms: FormSchema[]): void;
|
|
111
|
+
updateTemplates(templates: FormSection[]): void;
|
|
112
|
+
loadFormTemplates(formTemplates: FormSchema[]): void;
|
|
110
113
|
private setupSubscriptions;
|
|
111
114
|
destroy(): void;
|
|
112
115
|
private render;
|
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ declare const FormSchemaValidation: z.ZodObject<{
|
|
|
89
89
|
interface FormBuilderOptions {
|
|
90
90
|
existingForms?: FormSchema[];
|
|
91
91
|
reusableSections?: FormSection[];
|
|
92
|
+
formTemplates?: FormSchema[];
|
|
92
93
|
mode?: 'create' | 'edit';
|
|
93
94
|
formJson?: FormSchema;
|
|
94
95
|
onSave?: (schema: FormSchema) => void;
|
|
@@ -107,6 +108,8 @@ declare class FormBuilder {
|
|
|
107
108
|
saveSectionAsTemplate(section: FormSection): void;
|
|
108
109
|
applyTemplate(template: FormSection): void;
|
|
109
110
|
updateExistingForms(forms: FormSchema[]): void;
|
|
111
|
+
updateTemplates(templates: FormSection[]): void;
|
|
112
|
+
loadFormTemplates(formTemplates: FormSchema[]): void;
|
|
110
113
|
private setupSubscriptions;
|
|
111
114
|
destroy(): void;
|
|
112
115
|
private render;
|
package/dist/index.js
CHANGED
|
@@ -6897,7 +6897,19 @@ var FormBuilder = class {
|
|
|
6897
6897
|
if (options.reusableSections) {
|
|
6898
6898
|
formStore.getState().setTemplates(options.reusableSections);
|
|
6899
6899
|
}
|
|
6900
|
-
if (options.
|
|
6900
|
+
if (options.formTemplates) {
|
|
6901
|
+
const extractedSections = [];
|
|
6902
|
+
options.formTemplates.forEach((form) => {
|
|
6903
|
+
if (form.sections && Array.isArray(form.sections)) {
|
|
6904
|
+
extractedSections.push(...form.sections);
|
|
6905
|
+
}
|
|
6906
|
+
});
|
|
6907
|
+
if (extractedSections.length > 0) {
|
|
6908
|
+
const existingTemplates = options.reusableSections || [];
|
|
6909
|
+
formStore.getState().setTemplates([...existingTemplates, ...extractedSections]);
|
|
6910
|
+
}
|
|
6911
|
+
}
|
|
6912
|
+
if (options.formJson) {
|
|
6901
6913
|
formStore.getState().setSchema(options.formJson);
|
|
6902
6914
|
} else if (options.mode === "create") ;
|
|
6903
6915
|
this.render();
|
|
@@ -6929,6 +6941,23 @@ var FormBuilder = class {
|
|
|
6929
6941
|
formStore.getState().setExistingForms(forms);
|
|
6930
6942
|
this.render();
|
|
6931
6943
|
}
|
|
6944
|
+
updateTemplates(templates) {
|
|
6945
|
+
formStore.getState().setTemplates(templates);
|
|
6946
|
+
this.render();
|
|
6947
|
+
}
|
|
6948
|
+
loadFormTemplates(formTemplates) {
|
|
6949
|
+
const extractedSections = [];
|
|
6950
|
+
formTemplates.forEach((form) => {
|
|
6951
|
+
if (form.sections && Array.isArray(form.sections)) {
|
|
6952
|
+
extractedSections.push(...form.sections);
|
|
6953
|
+
}
|
|
6954
|
+
});
|
|
6955
|
+
if (extractedSections.length > 0) {
|
|
6956
|
+
const currentTemplates = formStore.getState().templates;
|
|
6957
|
+
formStore.getState().setTemplates([...currentTemplates, ...extractedSections]);
|
|
6958
|
+
this.render();
|
|
6959
|
+
}
|
|
6960
|
+
}
|
|
6932
6961
|
setupSubscriptions() {
|
|
6933
6962
|
this.unsubscribe = formStore.subscribe(() => {
|
|
6934
6963
|
this.render();
|