form-builder-pro 1.2.2 → 1.2.3
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.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8795,9 +8795,10 @@ var FormBuilder = class {
|
|
|
8795
8795
|
fields: s.fields.map((f) => ({
|
|
8796
8796
|
id: f.id,
|
|
8797
8797
|
type: f.type,
|
|
8798
|
-
label: f.label
|
|
8799
|
-
|
|
8800
|
-
|
|
8798
|
+
label: f.label,
|
|
8799
|
+
layout: f.layout,
|
|
8800
|
+
width: f.width
|
|
8801
|
+
// Exclude frequently changing text (placeholder, etc.) to prevent re-renders on typing
|
|
8801
8802
|
}))
|
|
8802
8803
|
})),
|
|
8803
8804
|
selectedField: state.selectedFieldId,
|
|
@@ -9268,18 +9269,24 @@ var FormBuilder = class {
|
|
|
9268
9269
|
layoutLabelRow.appendChild(spanValueDisplay);
|
|
9269
9270
|
layoutGroup.appendChild(layoutLabelRow);
|
|
9270
9271
|
const spanButtonsContainer = createElement("div", { className: "grid grid-cols-6 gap-2 mt-2" });
|
|
9272
|
+
const fieldId = selectedField.id;
|
|
9271
9273
|
for (let span = 1; span <= 12; span++) {
|
|
9272
9274
|
const isActive = currentSpan === span;
|
|
9273
9275
|
const spanBtn = createElement("button", {
|
|
9274
9276
|
type: "button",
|
|
9275
|
-
className: `span-preset-btn px-2 py-1.5 text-xs rounded transition-colors ${isActive ? "bg-blue-600 text-white" : "bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,
|
|
9277
|
+
className: `span-preset-btn px-2 py-1.5 text-xs rounded transition-colors cursor-pointer ${isActive ? "bg-blue-600 text-white" : "bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,
|
|
9276
9278
|
text: `${span}`,
|
|
9277
|
-
title: `${span} column${span > 1 ? "s" : ""} (${Math.round(span / 12 * 100)}%)
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9279
|
+
title: `${span} column${span > 1 ? "s" : ""} (${Math.round(span / 12 * 100)}%)`
|
|
9280
|
+
});
|
|
9281
|
+
spanBtn.addEventListener("click", (e) => {
|
|
9282
|
+
e.preventDefault();
|
|
9283
|
+
e.stopPropagation();
|
|
9284
|
+
const state2 = formStore.getState();
|
|
9285
|
+
const field = state2.schema.sections.flatMap((s) => s.fields).find((f) => f.id === fieldId);
|
|
9286
|
+
if (field) {
|
|
9287
|
+
const layout = field.layout || { row: 0, column: 0 };
|
|
9288
|
+
state2.updateField(fieldId, {
|
|
9281
9289
|
layout: { ...layout, span },
|
|
9282
|
-
// Also update width for backward compatibility
|
|
9283
9290
|
width: Math.round(span / 12 * 100)
|
|
9284
9291
|
});
|
|
9285
9292
|
}
|