form-builder-pro 1.3.9 → 1.4.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 +32 -0
- package/dist/index.js +55 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7439,6 +7439,18 @@ var FormRenderer = class {
|
|
|
7439
7439
|
grid.appendChild(fieldWrapper);
|
|
7440
7440
|
});
|
|
7441
7441
|
sectionEl.appendChild(grid);
|
|
7442
|
+
if (section.repeatable === true) {
|
|
7443
|
+
const addLabel = section.addButtonLabel && section.addButtonLabel.trim() || "+ Add";
|
|
7444
|
+
const addRow = createElement("div", { className: "mt-3 flex justify-start" });
|
|
7445
|
+
addRow.appendChild(
|
|
7446
|
+
createElement("button", {
|
|
7447
|
+
type: "button",
|
|
7448
|
+
className: "px-4 py-2 text-sm font-medium rounded-md border border-[#019FA2] text-[#019FA2] dark:text-[#4dd4d6] dark:border-[#019FA2] bg-transparent hover:bg-[#019FA2]/10 transition-colors",
|
|
7449
|
+
text: addLabel
|
|
7450
|
+
})
|
|
7451
|
+
);
|
|
7452
|
+
sectionEl.appendChild(addRow);
|
|
7453
|
+
}
|
|
7442
7454
|
form.appendChild(sectionEl);
|
|
7443
7455
|
});
|
|
7444
7456
|
const submitBtn = createElement("button", {
|
|
@@ -9914,6 +9926,21 @@ var Section = class _Section {
|
|
|
9914
9926
|
nestedWrap.appendChild(nestedList);
|
|
9915
9927
|
sectionEl.appendChild(nestedWrap);
|
|
9916
9928
|
}
|
|
9929
|
+
if (this.section.repeatable === true) {
|
|
9930
|
+
const addLabel = this.section.addButtonLabel && this.section.addButtonLabel.trim() || "+ Add";
|
|
9931
|
+
const footer = createElement("div", {
|
|
9932
|
+
className: "px-4 pb-4 pt-2 flex justify-start border-t border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/30"
|
|
9933
|
+
});
|
|
9934
|
+
footer.appendChild(
|
|
9935
|
+
createElement("button", {
|
|
9936
|
+
type: "button",
|
|
9937
|
+
className: "px-4 py-2 text-sm font-medium rounded-md border border-[#019FA2] text-[#019FA2] dark:text-[#4dd4d6] dark:border-[#019FA2] bg-white dark:bg-gray-900 hover:bg-[#019FA2]/10 transition-colors",
|
|
9938
|
+
text: addLabel,
|
|
9939
|
+
onclick: (e) => e.preventDefault()
|
|
9940
|
+
})
|
|
9941
|
+
);
|
|
9942
|
+
sectionEl.appendChild(footer);
|
|
9943
|
+
}
|
|
9917
9944
|
this.initFieldSortable(fieldsGrid);
|
|
9918
9945
|
return sectionEl;
|
|
9919
9946
|
}
|
|
@@ -10272,6 +10299,7 @@ var FormBuilder = class {
|
|
|
10272
10299
|
collapsible: s.collapsible,
|
|
10273
10300
|
parentGroupId: s.parentGroupId,
|
|
10274
10301
|
repeatable: s.repeatable,
|
|
10302
|
+
addButtonLabel: s.addButtonLabel,
|
|
10275
10303
|
minInstances: s.minInstances,
|
|
10276
10304
|
maxInstances: s.maxInstances,
|
|
10277
10305
|
css: s.css,
|
|
@@ -11162,11 +11190,37 @@ var FormBuilder = class {
|
|
|
11162
11190
|
this.createCheckboxField(
|
|
11163
11191
|
"Allow multiple instances",
|
|
11164
11192
|
section.repeatable === true,
|
|
11165
|
-
(checked) => formStore.getState().updateSection(sectionId, {
|
|
11193
|
+
(checked) => formStore.getState().updateSection(sectionId, {
|
|
11194
|
+
repeatable: checked,
|
|
11195
|
+
...checked ? {} : { addButtonLabel: null }
|
|
11196
|
+
}),
|
|
11166
11197
|
`group-repeatable-${sectionId}`
|
|
11167
11198
|
)
|
|
11168
11199
|
);
|
|
11169
11200
|
if (section.repeatable === true) {
|
|
11201
|
+
const addLabelWrap = createElement("div", { className: "mb-2" });
|
|
11202
|
+
addLabelWrap.appendChild(
|
|
11203
|
+
createElement("label", {
|
|
11204
|
+
className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1",
|
|
11205
|
+
text: "Add Button Label"
|
|
11206
|
+
})
|
|
11207
|
+
);
|
|
11208
|
+
addLabelWrap.appendChild(
|
|
11209
|
+
createElement("input", {
|
|
11210
|
+
type: "text",
|
|
11211
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
11212
|
+
value: section.addButtonLabel ?? "",
|
|
11213
|
+
placeholder: "e.g. + Billing Address",
|
|
11214
|
+
"data-focus-id": `group-add-btn-label-${sectionId}`,
|
|
11215
|
+
oninput: (e) => {
|
|
11216
|
+
const raw = e.target.value;
|
|
11217
|
+
formStore.getState().updateSection(sectionId, {
|
|
11218
|
+
addButtonLabel: raw === "" ? null : raw
|
|
11219
|
+
});
|
|
11220
|
+
}
|
|
11221
|
+
})
|
|
11222
|
+
);
|
|
11223
|
+
body.appendChild(addLabelWrap);
|
|
11170
11224
|
const minG = createElement("div", { className: "mb-2" });
|
|
11171
11225
|
minG.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Min Instances" }));
|
|
11172
11226
|
minG.appendChild(createElement("input", {
|