form-builder-pro 0.0.8 → 0.0.10
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.map +1 -1
- 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 +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6895,7 +6895,19 @@ var FormBuilder = class {
|
|
|
6895
6895
|
if (options.reusableSections) {
|
|
6896
6896
|
formStore.getState().setTemplates(options.reusableSections);
|
|
6897
6897
|
}
|
|
6898
|
-
if (options.
|
|
6898
|
+
if (options.formTemplates) {
|
|
6899
|
+
const extractedSections = [];
|
|
6900
|
+
options.formTemplates.forEach((form) => {
|
|
6901
|
+
if (form.sections && Array.isArray(form.sections)) {
|
|
6902
|
+
extractedSections.push(...form.sections);
|
|
6903
|
+
}
|
|
6904
|
+
});
|
|
6905
|
+
if (extractedSections.length > 0) {
|
|
6906
|
+
const existingTemplates = options.reusableSections || [];
|
|
6907
|
+
formStore.getState().setTemplates([...existingTemplates, ...extractedSections]);
|
|
6908
|
+
}
|
|
6909
|
+
}
|
|
6910
|
+
if (options.formJson) {
|
|
6899
6911
|
formStore.getState().setSchema(options.formJson);
|
|
6900
6912
|
} else if (options.mode === "create") ;
|
|
6901
6913
|
this.render();
|
|
@@ -6927,6 +6939,23 @@ var FormBuilder = class {
|
|
|
6927
6939
|
formStore.getState().setExistingForms(forms);
|
|
6928
6940
|
this.render();
|
|
6929
6941
|
}
|
|
6942
|
+
updateTemplates(templates) {
|
|
6943
|
+
formStore.getState().setTemplates(templates);
|
|
6944
|
+
this.render();
|
|
6945
|
+
}
|
|
6946
|
+
loadFormTemplates(formTemplates) {
|
|
6947
|
+
const extractedSections = [];
|
|
6948
|
+
formTemplates.forEach((form) => {
|
|
6949
|
+
if (form.sections && Array.isArray(form.sections)) {
|
|
6950
|
+
extractedSections.push(...form.sections);
|
|
6951
|
+
}
|
|
6952
|
+
});
|
|
6953
|
+
if (extractedSections.length > 0) {
|
|
6954
|
+
const currentTemplates = formStore.getState().templates;
|
|
6955
|
+
formStore.getState().setTemplates([...currentTemplates, ...extractedSections]);
|
|
6956
|
+
this.render();
|
|
6957
|
+
}
|
|
6958
|
+
}
|
|
6930
6959
|
setupSubscriptions() {
|
|
6931
6960
|
this.unsubscribe = formStore.subscribe(() => {
|
|
6932
6961
|
this.render();
|