form-builder-pro 1.2.3 → 1.2.5
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 +82 -38
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +87 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8619,12 +8619,14 @@ var SectionList = class {
|
|
|
8619
8619
|
// src/builder/FormBuilder.ts
|
|
8620
8620
|
var advancedCssPanelState = /* @__PURE__ */ new Map();
|
|
8621
8621
|
var FormBuilder = class {
|
|
8622
|
-
//
|
|
8622
|
+
// For requestAnimationFrame debouncing
|
|
8623
8623
|
constructor(container, options = {}) {
|
|
8624
8624
|
__publicField(this, "container");
|
|
8625
8625
|
__publicField(this, "unsubscribe");
|
|
8626
8626
|
__publicField(this, "options");
|
|
8627
8627
|
__publicField(this, "lastRenderedSchemaHash", "");
|
|
8628
|
+
// Cache to detect meaningful changes
|
|
8629
|
+
__publicField(this, "pendingRenderId", null);
|
|
8628
8630
|
__publicField(this, "activeTab", "fields");
|
|
8629
8631
|
if (!container) {
|
|
8630
8632
|
throw new Error("Builder container not found. Please ensure the container element exists before initializing FormBuilder.");
|
|
@@ -8782,34 +8784,43 @@ var FormBuilder = class {
|
|
|
8782
8784
|
}
|
|
8783
8785
|
setupSubscriptions() {
|
|
8784
8786
|
let lastPreviewMode = null;
|
|
8785
|
-
|
|
8787
|
+
const performRender = () => {
|
|
8788
|
+
this.pendingRenderId = null;
|
|
8786
8789
|
const state = formStore.getState();
|
|
8787
8790
|
const previewModeChanged = lastPreviewMode !== null && lastPreviewMode !== state.isPreviewMode;
|
|
8788
8791
|
lastPreviewMode = state.isPreviewMode;
|
|
8789
8792
|
const schemaHash = JSON.stringify({
|
|
8790
8793
|
sections: state.schema.sections.map((s) => ({
|
|
8791
8794
|
id: s.id,
|
|
8792
|
-
title
|
|
8795
|
+
// Exclude title - prevents re-renders on section name typing
|
|
8793
8796
|
fields: s.fields.map((f) => ({
|
|
8794
8797
|
id: f.id,
|
|
8795
8798
|
type: f.type,
|
|
8796
|
-
label
|
|
8799
|
+
// Exclude label - prevents re-renders on field name typing
|
|
8797
8800
|
layout: f.layout,
|
|
8798
|
-
width: f.width
|
|
8799
|
-
|
|
8801
|
+
width: f.width,
|
|
8802
|
+
css: f.css
|
|
8800
8803
|
}))
|
|
8801
8804
|
})),
|
|
8802
8805
|
selectedField: state.selectedFieldId,
|
|
8803
8806
|
isPreviewMode: state.isPreviewMode
|
|
8804
|
-
// Include preview mode in hash
|
|
8805
8807
|
});
|
|
8806
8808
|
if (schemaHash !== this.lastRenderedSchemaHash || previewModeChanged) {
|
|
8807
8809
|
this.lastRenderedSchemaHash = schemaHash;
|
|
8808
8810
|
this.render();
|
|
8809
8811
|
}
|
|
8812
|
+
};
|
|
8813
|
+
this.unsubscribe = formStore.subscribe(() => {
|
|
8814
|
+
if (this.pendingRenderId == null) {
|
|
8815
|
+
this.pendingRenderId = requestAnimationFrame(() => performRender.call(this));
|
|
8816
|
+
}
|
|
8810
8817
|
});
|
|
8811
8818
|
}
|
|
8812
8819
|
destroy() {
|
|
8820
|
+
if (this.pendingRenderId != null) {
|
|
8821
|
+
cancelAnimationFrame(this.pendingRenderId);
|
|
8822
|
+
this.pendingRenderId = null;
|
|
8823
|
+
}
|
|
8813
8824
|
this.unsubscribe();
|
|
8814
8825
|
this.container.innerHTML = "";
|
|
8815
8826
|
}
|
|
@@ -8913,13 +8924,13 @@ var FormBuilder = class {
|
|
|
8913
8924
|
main.appendChild(previewContainer2);
|
|
8914
8925
|
}
|
|
8915
8926
|
} else {
|
|
8916
|
-
const toolboxWrapper = createElement("div", { className: "form-builder-toolbox-wrapper w-full md:w-
|
|
8927
|
+
const toolboxWrapper = createElement("div", { className: "form-builder-toolbox-wrapper w-full md:w-[14rem] bg-white dark:bg-gray-900 border-r md:border-r border-b md:border-b-0 border-gray-200 dark:border-gray-800" });
|
|
8917
8928
|
toolboxWrapper.appendChild(this.renderToolbox());
|
|
8918
8929
|
main.appendChild(toolboxWrapper);
|
|
8919
8930
|
const canvasWrapper2 = createElement("div", { className: "form-builder-canvas flex-1 overflow-y-auto" });
|
|
8920
8931
|
canvasWrapper2.appendChild(this.renderCanvas(state));
|
|
8921
8932
|
main.appendChild(canvasWrapper2);
|
|
8922
|
-
const configWrapper = createElement("div", { className: "form-builder-config-wrapper w-full md:w-
|
|
8933
|
+
const configWrapper = createElement("div", { className: "form-builder-config-wrapper w-full md:w-[17rem] bg-white dark:bg-gray-900 border-l md:border-l border-t md:border-t-0 border-gray-200 dark:border-gray-800 overflow-hidden" });
|
|
8923
8934
|
configWrapper.appendChild(this.renderConfigPanel(state, focusState));
|
|
8924
8935
|
main.appendChild(configWrapper);
|
|
8925
8936
|
}
|
|
@@ -8958,12 +8969,12 @@ var FormBuilder = class {
|
|
|
8958
8969
|
}
|
|
8959
8970
|
}
|
|
8960
8971
|
renderToolbar(state) {
|
|
8961
|
-
const toolbar = createElement("div", { className: "flex items-center justify-between p-
|
|
8972
|
+
const toolbar = createElement("div", { className: "flex items-center justify-between p-2 pl-[95px] border-b bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-800" });
|
|
8962
8973
|
const left = createElement("div", { className: "flex items-center " });
|
|
8963
8974
|
left.appendChild(createElement("h1", { className: "text-xl font-semibold mb-2 text-primary hidden mr-4", text: "" }));
|
|
8964
8975
|
if (state.existingForms && state.existingForms.length > 0) {
|
|
8965
8976
|
const formSelect = createElement("select", {
|
|
8966
|
-
className: "px-3 py-2 border border-gray-
|
|
8977
|
+
className: "px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent text-sm mr-2",
|
|
8967
8978
|
onchange: (e) => {
|
|
8968
8979
|
const formId = e.target.value;
|
|
8969
8980
|
if (formId) {
|
|
@@ -9028,7 +9039,7 @@ var FormBuilder = class {
|
|
|
9028
9039
|
}, [getIcon("Cog", 20)]);
|
|
9029
9040
|
right.appendChild(settingsBtn);
|
|
9030
9041
|
const clearBtn = createElement("button", {
|
|
9031
|
-
className: "flex items-center px-3 py-2 text-sm font-medium text-red-600 bg-red-500
|
|
9042
|
+
className: "flex items-center px-3 py-2 text-sm font-medium text-red-600 bg-[#f7a1a14d] text-red-500 rounded-md transition-colors",
|
|
9032
9043
|
onclick: () => {
|
|
9033
9044
|
if (confirm("Are you sure?")) {
|
|
9034
9045
|
formStore.getState().setSchema({ id: "new", title: "New Form", formName: "newForm", sections: [] });
|
|
@@ -9036,7 +9047,7 @@ var FormBuilder = class {
|
|
|
9036
9047
|
}
|
|
9037
9048
|
}, [getIcon("Trash2", 16), createElement("span", { className: "", title: "Clear" })]);
|
|
9038
9049
|
const previewBtn = createElement("button", {
|
|
9039
|
-
className: `flex items-center justify-center px-3 py-2 text-sm font-medium rounded-md transition-colors ${state.isPreviewMode ? "
|
|
9050
|
+
className: `flex items-center justify-center px-3 py-2 text-sm font-medium rounded-md transition-colors ${state.isPreviewMode ? "text-[#635bff] bg-[#e7e7ff] " : "text-[#635bff] bg-[#e7e7ff]"}`,
|
|
9040
9051
|
onclick: (e) => {
|
|
9041
9052
|
e.preventDefault();
|
|
9042
9053
|
e.stopPropagation();
|
|
@@ -9045,7 +9056,7 @@ var FormBuilder = class {
|
|
|
9045
9056
|
title: state.isPreviewMode ? "Exit Preview" : "Preview Form"
|
|
9046
9057
|
}, [getIcon(state.isPreviewMode ? "X" : "Eye", 16)]);
|
|
9047
9058
|
const saveBtn = createElement("button", {
|
|
9048
|
-
className: "flex items-center px-3 py-2 text-sm font-medium text-
|
|
9059
|
+
className: "flex items-center px-3 py-2 text-sm font-medium text-[#635bff] bg-[#e7e7ff] rounded-md shadow-sm transition-colors",
|
|
9049
9060
|
onclick: () => {
|
|
9050
9061
|
const schema = formStore.getState().schema;
|
|
9051
9062
|
console.log("[Form Builder] Schema being sent to app:", JSON.stringify(schema, null, 2));
|
|
@@ -9053,7 +9064,7 @@ var FormBuilder = class {
|
|
|
9053
9064
|
this.options.onSave(schema);
|
|
9054
9065
|
}
|
|
9055
9066
|
}
|
|
9056
|
-
}, [
|
|
9067
|
+
}, [createElement("span", { className: "", text: "Save" })]);
|
|
9057
9068
|
right.appendChild(clearBtn);
|
|
9058
9069
|
right.appendChild(previewBtn);
|
|
9059
9070
|
right.appendChild(saveBtn);
|
|
@@ -9061,24 +9072,29 @@ var FormBuilder = class {
|
|
|
9061
9072
|
return toolbar;
|
|
9062
9073
|
}
|
|
9063
9074
|
renderToolbox() {
|
|
9064
|
-
const toolbox = createElement("div", { className: "
|
|
9065
|
-
const tabs = createElement("div", { className: "flex border-b border-gray-200 dark:border-gray-800
|
|
9066
|
-
const createTab = (id, label) => {
|
|
9075
|
+
const toolbox = createElement("div", { className: " dark:bg-gray-900 flex flex-col h-full" });
|
|
9076
|
+
const tabs = createElement("div", { className: "flex border-b border-gray-200 dark:border-gray-800 " });
|
|
9077
|
+
const createTab = (id, label, icon, tooltip) => {
|
|
9067
9078
|
const isActive = this.activeTab === id;
|
|
9068
|
-
|
|
9069
|
-
className: `flex-1 py-3 text-
|
|
9070
|
-
|
|
9079
|
+
const btn = createElement("button", {
|
|
9080
|
+
className: `flex-1 flex items-center justify-center py-3 text-base font-bold transition-colors ${isActive ? "text-[#635bff] bg-[#e7e7ff] " : "text-gray-500 hover:text-gray-700 dark:text-gray-400"}`,
|
|
9081
|
+
title: tooltip || label,
|
|
9082
|
+
"aria-label": tooltip || label,
|
|
9071
9083
|
onclick: () => {
|
|
9072
9084
|
this.activeTab = id;
|
|
9073
9085
|
this.render();
|
|
9074
9086
|
}
|
|
9075
|
-
}
|
|
9087
|
+
}, [
|
|
9088
|
+
getIcon(icon || "ListBullet", 16),
|
|
9089
|
+
createElement("span", { className: "hidden sm:inline-block", text: label })
|
|
9090
|
+
]);
|
|
9091
|
+
return btn;
|
|
9076
9092
|
};
|
|
9077
|
-
tabs.appendChild(createTab("fields", "
|
|
9078
|
-
tabs.appendChild(createTab("templates", "
|
|
9079
|
-
tabs.appendChild(createTab("import", "Import"));
|
|
9093
|
+
tabs.appendChild(createTab("fields", "", "ListBullet", "Field types"));
|
|
9094
|
+
tabs.appendChild(createTab("templates", "", "DocumentText", "Saved templates"));
|
|
9095
|
+
tabs.appendChild(createTab("import", "", "Upload", "Import sections"));
|
|
9080
9096
|
toolbox.appendChild(tabs);
|
|
9081
|
-
const content = createElement("div", { className: "flex-1 overflow-y-auto p-4 bg-
|
|
9097
|
+
const content = createElement("div", { className: "flex-1 overflow-y-auto p-4 bg-[#e7e7ff]" });
|
|
9082
9098
|
if (this.activeTab === "fields") {
|
|
9083
9099
|
const list = createElement("div", { className: "grid grid-cols-2 gap-3", id: "toolbox-list" });
|
|
9084
9100
|
FIELD_TYPES.forEach((field) => {
|
|
@@ -9160,7 +9176,7 @@ var FormBuilder = class {
|
|
|
9160
9176
|
}
|
|
9161
9177
|
renderCanvas(state) {
|
|
9162
9178
|
const canvas = createElement("div", {
|
|
9163
|
-
className: "flex-1 dark:bg-gray-950 p-4 md:p-
|
|
9179
|
+
className: "flex-1 dark:bg-gray-950 p-4 md:p-4 overflow-y-auto",
|
|
9164
9180
|
onclick: (e) => {
|
|
9165
9181
|
if (e.target === canvas || e.target === canvas.firstElementChild) {
|
|
9166
9182
|
formStore.getState().selectField(null);
|
|
@@ -9181,7 +9197,7 @@ var FormBuilder = class {
|
|
|
9181
9197
|
const sectionList = new SectionList(state.schema, state.selectedFieldId);
|
|
9182
9198
|
inner.appendChild(sectionList.getElement());
|
|
9183
9199
|
const addSectionBtn = createElement("button", {
|
|
9184
|
-
className: "w-full mt-6 py-3 dark:border-gray-700 rounded-
|
|
9200
|
+
className: "w-full mt-6 py-3 dark:border-gray-700 rounded-md text-sm text-gray-500 bg-[#635bff] max-w-[180px] text-white transition-colors flex items-center justify-center font-medium",
|
|
9185
9201
|
onclick: () => formStore.getState().addSection()
|
|
9186
9202
|
}, [getIcon("Plus", 20), createElement("span", { className: "ml-2", text: "Add Section" })]);
|
|
9187
9203
|
inner.appendChild(addSectionBtn);
|
|
@@ -9191,7 +9207,7 @@ var FormBuilder = class {
|
|
|
9191
9207
|
// Helper method to create a modern checkbox field with better UX
|
|
9192
9208
|
createCheckboxField(label, checked, onChange, id) {
|
|
9193
9209
|
const uniqueId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
9194
|
-
const container = createElement("div", { className: "flex items-center gap-3 py-
|
|
9210
|
+
const container = createElement("div", { className: "flex items-center gap-3 py-1 px-1 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors cursor-pointer" });
|
|
9195
9211
|
const checkbox = createElement("input", {
|
|
9196
9212
|
type: "checkbox",
|
|
9197
9213
|
id: uniqueId,
|
|
@@ -9228,11 +9244,11 @@ var FormBuilder = class {
|
|
|
9228
9244
|
onclick: () => formStore.getState().selectField(null)
|
|
9229
9245
|
}, [getIcon("X", 20)]));
|
|
9230
9246
|
panel.appendChild(header);
|
|
9231
|
-
const body = createElement("div", { className: "flex-1 overflow-y-auto p-4 space-y-
|
|
9247
|
+
const body = createElement("div", { className: "flex-1 overflow-y-auto p-4 px-2 space-y-3", id: "config-panel-body" });
|
|
9232
9248
|
const labelGroup = createElement("div");
|
|
9233
|
-
labelGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9249
|
+
labelGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Label" }));
|
|
9234
9250
|
labelGroup.appendChild(createElement("input", {
|
|
9235
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9251
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9236
9252
|
value: selectedField.label,
|
|
9237
9253
|
"data-focus-id": `field-label-${selectedField.id}`,
|
|
9238
9254
|
oninput: (e) => {
|
|
@@ -9241,9 +9257,9 @@ var FormBuilder = class {
|
|
|
9241
9257
|
}));
|
|
9242
9258
|
body.appendChild(labelGroup);
|
|
9243
9259
|
const placeholderGroup = createElement("div");
|
|
9244
|
-
placeholderGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9260
|
+
placeholderGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Placeholder" }));
|
|
9245
9261
|
placeholderGroup.appendChild(createElement("input", {
|
|
9246
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9262
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9247
9263
|
value: selectedField.placeholder || "",
|
|
9248
9264
|
"data-focus-id": `field-placeholder-${selectedField.id}`,
|
|
9249
9265
|
oninput: (e) => {
|
|
@@ -9272,7 +9288,7 @@ var FormBuilder = class {
|
|
|
9272
9288
|
const isActive = currentSpan === span;
|
|
9273
9289
|
const spanBtn = createElement("button", {
|
|
9274
9290
|
type: "button",
|
|
9275
|
-
className: `span-preset-btn px-2 py-1.5 text-xs rounded transition-colors cursor-pointer ${isActive ? "bg-
|
|
9291
|
+
className: `span-preset-btn px-2 py-1.5 text-xs rounded transition-colors cursor-pointer ${isActive ? "bg-[#e7e7ff] text-[#635bff] font-semibold" : "bg-white border-2 border-[#e7e7ff] dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,
|
|
9276
9292
|
text: `${span}`,
|
|
9277
9293
|
title: `${span} column${span > 1 ? "s" : ""} (${Math.round(span / 12 * 100)}%)`
|
|
9278
9294
|
});
|
|
@@ -9368,9 +9384,9 @@ var FormBuilder = class {
|
|
|
9368
9384
|
};
|
|
9369
9385
|
if (activeMasterTypes.length > 0) {
|
|
9370
9386
|
const groupNameGroup = createElement("div", { className: "mb-4" });
|
|
9371
|
-
groupNameGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9387
|
+
groupNameGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Master List" }));
|
|
9372
9388
|
const groupNameSelect = createElement("select", {
|
|
9373
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9389
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9374
9390
|
onchange: (e) => {
|
|
9375
9391
|
const selectedEnumName = e.target.value;
|
|
9376
9392
|
if (selectedEnumName) {
|
|
@@ -9456,9 +9472,9 @@ var FormBuilder = class {
|
|
|
9456
9472
|
const optionSourceHeader = createElement("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 mt-6", text: "Option Source" });
|
|
9457
9473
|
body.appendChild(optionSourceHeader);
|
|
9458
9474
|
const optionSourceGroup = createElement("div", { className: "mb-4" });
|
|
9459
|
-
optionSourceGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9475
|
+
optionSourceGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Source Type" }));
|
|
9460
9476
|
const optionSourceSelect = createElement("select", {
|
|
9461
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9477
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9462
9478
|
value: selectedField.optionSource || "STATIC",
|
|
9463
9479
|
onchange: (e) => {
|
|
9464
9480
|
const source = e.target.value;
|
|
@@ -9483,9 +9499,9 @@ var FormBuilder = class {
|
|
|
9483
9499
|
body.appendChild(optionSourceGroup);
|
|
9484
9500
|
if (selectedField.type === "select" && selectedField.optionSource === "LOOKUP") {
|
|
9485
9501
|
const lookupSourceTypeGroup = createElement("div", { className: "mb-4" });
|
|
9486
|
-
lookupSourceTypeGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9502
|
+
lookupSourceTypeGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Lookup Source Type" }));
|
|
9487
9503
|
const lookupSourceTypeSelect = createElement("select", {
|
|
9488
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9504
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9489
9505
|
value: selectedField.lookupSourceType || "MODULE",
|
|
9490
9506
|
onchange: (e) => {
|
|
9491
9507
|
const lookupSourceType = e.target.value;
|
|
@@ -9504,9 +9520,9 @@ var FormBuilder = class {
|
|
|
9504
9520
|
if (selectedField.lookupSourceType === "MODULE") {
|
|
9505
9521
|
const moduleList = this.options.moduleList || [];
|
|
9506
9522
|
const lookupSourceGroup = createElement("div", { className: "mb-4" });
|
|
9507
|
-
lookupSourceGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9523
|
+
lookupSourceGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Lookup Source" }));
|
|
9508
9524
|
const lookupSourceSelect = createElement("select", {
|
|
9509
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9525
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9510
9526
|
value: selectedField.lookupSource || "",
|
|
9511
9527
|
onchange: (e) => {
|
|
9512
9528
|
const lookupSource = e.target.value;
|
|
@@ -9541,9 +9557,9 @@ var FormBuilder = class {
|
|
|
9541
9557
|
const masterTypes = formStore.getState().masterTypes;
|
|
9542
9558
|
const activeMasterTypes = masterTypes.filter((mt) => mt.active === true);
|
|
9543
9559
|
const lookupSourceGroup = createElement("div", { className: "mb-4" });
|
|
9544
|
-
lookupSourceGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9560
|
+
lookupSourceGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Lookup Source" }));
|
|
9545
9561
|
const lookupSourceSelect = createElement("select", {
|
|
9546
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9562
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9547
9563
|
value: selectedField.lookupSource || "",
|
|
9548
9564
|
onchange: (e) => {
|
|
9549
9565
|
const lookupSource = e.target.value;
|
|
@@ -9577,9 +9593,9 @@ var FormBuilder = class {
|
|
|
9577
9593
|
body.appendChild(lookupSourceGroup);
|
|
9578
9594
|
}
|
|
9579
9595
|
const lookupValueFieldGroup = createElement("div", { className: "mb-4" });
|
|
9580
|
-
lookupValueFieldGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9596
|
+
lookupValueFieldGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Lookup Value Field" }));
|
|
9581
9597
|
const lookupValueFieldSelect = createElement("select", {
|
|
9582
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9598
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9583
9599
|
value: selectedField.lookupValueField || "",
|
|
9584
9600
|
disabled: !selectedField.lookupSource,
|
|
9585
9601
|
onchange: (e) => {
|
|
@@ -9602,9 +9618,9 @@ var FormBuilder = class {
|
|
|
9602
9618
|
lookupValueFieldGroup.appendChild(lookupValueFieldSelect);
|
|
9603
9619
|
body.appendChild(lookupValueFieldGroup);
|
|
9604
9620
|
const lookupLabelFieldGroup = createElement("div", { className: "mb-4" });
|
|
9605
|
-
lookupLabelFieldGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9621
|
+
lookupLabelFieldGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Lookup Label Field" }));
|
|
9606
9622
|
const lookupLabelFieldSelect = createElement("select", {
|
|
9607
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9623
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9608
9624
|
value: selectedField.lookupLabelField || "",
|
|
9609
9625
|
disabled: !selectedField.lookupSource,
|
|
9610
9626
|
onchange: (e) => {
|
|
@@ -9768,10 +9784,10 @@ var FormBuilder = class {
|
|
|
9768
9784
|
const validationElements = [];
|
|
9769
9785
|
if (["text", "textarea", "email", "password"].includes(selectedField.type)) {
|
|
9770
9786
|
const minLenGroup = createElement("div", { className: "mb-3" });
|
|
9771
|
-
minLenGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9787
|
+
minLenGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Min Length" }));
|
|
9772
9788
|
minLenGroup.appendChild(createElement("input", {
|
|
9773
9789
|
type: "number",
|
|
9774
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9790
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9775
9791
|
value: getRuleValue("minLength") || "",
|
|
9776
9792
|
placeholder: "e.g. 3",
|
|
9777
9793
|
onchange: (e) => {
|
|
@@ -9781,10 +9797,10 @@ var FormBuilder = class {
|
|
|
9781
9797
|
}));
|
|
9782
9798
|
validationElements.push(minLenGroup);
|
|
9783
9799
|
const maxLenGroup = createElement("div", { className: "mb-3" });
|
|
9784
|
-
maxLenGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9800
|
+
maxLenGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Max Length" }));
|
|
9785
9801
|
maxLenGroup.appendChild(createElement("input", {
|
|
9786
9802
|
type: "number",
|
|
9787
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9803
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9788
9804
|
value: getRuleValue("maxLength") || "",
|
|
9789
9805
|
placeholder: "e.g. 100",
|
|
9790
9806
|
onchange: (e) => {
|
|
@@ -9794,7 +9810,7 @@ var FormBuilder = class {
|
|
|
9794
9810
|
}));
|
|
9795
9811
|
validationElements.push(maxLenGroup);
|
|
9796
9812
|
const regexGroup = createElement("div", { className: "mb-3" });
|
|
9797
|
-
regexGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9813
|
+
regexGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Regex Pattern" }));
|
|
9798
9814
|
const updateExamples = (examplesList2, regex, preset) => {
|
|
9799
9815
|
examplesList2.innerHTML = "";
|
|
9800
9816
|
let testCases = [];
|
|
@@ -9860,7 +9876,7 @@ var FormBuilder = class {
|
|
|
9860
9876
|
const presetGroup = createElement("div", { className: "mb-2" });
|
|
9861
9877
|
presetGroup.appendChild(createElement("label", { className: "block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1", text: "Regex Presets (Optional)" }));
|
|
9862
9878
|
const presetSelect = createElement("select", {
|
|
9863
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9879
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent text-sm",
|
|
9864
9880
|
value: selectedPresetId,
|
|
9865
9881
|
onchange: (e) => {
|
|
9866
9882
|
const presetId = e.target.value;
|
|
@@ -9900,7 +9916,7 @@ var FormBuilder = class {
|
|
|
9900
9916
|
}
|
|
9901
9917
|
regexInput = createElement("input", {
|
|
9902
9918
|
type: "text",
|
|
9903
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9919
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9904
9920
|
value: currentRegex,
|
|
9905
9921
|
placeholder: selectedField.type === "email" ? "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" : "e.g. ^[A-Z]+$",
|
|
9906
9922
|
"data-focus-id": `field-regex-${selectedField.id}`,
|
|
@@ -9953,10 +9969,10 @@ var FormBuilder = class {
|
|
|
9953
9969
|
}
|
|
9954
9970
|
if (selectedField.type === "checkbox") {
|
|
9955
9971
|
const minSelectedGroup = createElement("div", { className: "mb-3" });
|
|
9956
|
-
minSelectedGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9972
|
+
minSelectedGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Min Selected" }));
|
|
9957
9973
|
minSelectedGroup.appendChild(createElement("input", {
|
|
9958
9974
|
type: "number",
|
|
9959
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9975
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9960
9976
|
value: getRuleValue("minSelected"),
|
|
9961
9977
|
placeholder: "e.g. 1",
|
|
9962
9978
|
min: "0",
|
|
@@ -9967,10 +9983,10 @@ var FormBuilder = class {
|
|
|
9967
9983
|
}));
|
|
9968
9984
|
validationElements.push(minSelectedGroup);
|
|
9969
9985
|
const maxSelectedGroup = createElement("div", { className: "mb-3" });
|
|
9970
|
-
maxSelectedGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
9986
|
+
maxSelectedGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Max Selected" }));
|
|
9971
9987
|
maxSelectedGroup.appendChild(createElement("input", {
|
|
9972
9988
|
type: "number",
|
|
9973
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
9989
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9974
9990
|
value: getRuleValue("maxSelected"),
|
|
9975
9991
|
placeholder: "e.g. 2",
|
|
9976
9992
|
min: "1",
|
|
@@ -9983,10 +9999,10 @@ var FormBuilder = class {
|
|
|
9983
9999
|
}
|
|
9984
10000
|
if (selectedField.type === "date") {
|
|
9985
10001
|
const minDateGroup = createElement("div", { className: "mb-3" });
|
|
9986
|
-
minDateGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
10002
|
+
minDateGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Minimum Date" }));
|
|
9987
10003
|
minDateGroup.appendChild(createElement("input", {
|
|
9988
10004
|
type: "date",
|
|
9989
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
10005
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
9990
10006
|
value: validationObj.minDate || "",
|
|
9991
10007
|
onchange: (e) => {
|
|
9992
10008
|
const val = e.target.value;
|
|
@@ -9995,10 +10011,10 @@ var FormBuilder = class {
|
|
|
9995
10011
|
}));
|
|
9996
10012
|
validationElements.push(minDateGroup);
|
|
9997
10013
|
const maxDateGroup = createElement("div", { className: "mb-3" });
|
|
9998
|
-
maxDateGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
10014
|
+
maxDateGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Maximum Date" }));
|
|
9999
10015
|
maxDateGroup.appendChild(createElement("input", {
|
|
10000
10016
|
type: "date",
|
|
10001
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
10017
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
|
|
10002
10018
|
value: validationObj.maxDate || "",
|
|
10003
10019
|
onchange: (e) => {
|
|
10004
10020
|
const val = e.target.value;
|
|
@@ -10037,9 +10053,9 @@ var FormBuilder = class {
|
|
|
10037
10053
|
state2.updateField(selectedField.id, updatePayload);
|
|
10038
10054
|
};
|
|
10039
10055
|
const paddingGroup = createElement("div", { className: "mb-3" });
|
|
10040
|
-
paddingGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
10056
|
+
paddingGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Padding" }));
|
|
10041
10057
|
const paddingSelect = createElement("select", {
|
|
10042
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
10058
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-white dark:bg-gray-800 text-sm",
|
|
10043
10059
|
onchange: (e) => {
|
|
10044
10060
|
updateStyleProp("padding", e.target.value);
|
|
10045
10061
|
}
|
|
@@ -10058,7 +10074,7 @@ var FormBuilder = class {
|
|
|
10058
10074
|
paddingGroup.appendChild(paddingSelect);
|
|
10059
10075
|
body.appendChild(paddingGroup);
|
|
10060
10076
|
const bgColorGroup = createElement("div", { className: "mb-3" });
|
|
10061
|
-
bgColorGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
10077
|
+
bgColorGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Background Color" }));
|
|
10062
10078
|
const bgColorRow = createElement("div", { className: "flex items-center gap-2" });
|
|
10063
10079
|
const bgColorInput = createElement("input", {
|
|
10064
10080
|
type: "color",
|
|
@@ -10083,7 +10099,7 @@ var FormBuilder = class {
|
|
|
10083
10099
|
bgColorGroup.appendChild(bgColorRow);
|
|
10084
10100
|
body.appendChild(bgColorGroup);
|
|
10085
10101
|
const alignGroup = createElement("div", { className: "mb-3" });
|
|
10086
|
-
alignGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
10102
|
+
alignGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Text Alignment" }));
|
|
10087
10103
|
const alignButtonsRow = createElement("div", { className: "flex gap-1" });
|
|
10088
10104
|
const alignments = [
|
|
10089
10105
|
{ value: "left", icon: "AlignLeft" },
|
|
@@ -10107,10 +10123,10 @@ var FormBuilder = class {
|
|
|
10107
10123
|
alignGroup.appendChild(alignButtonsRow);
|
|
10108
10124
|
body.appendChild(alignGroup);
|
|
10109
10125
|
const cssClassGroup = createElement("div", { className: "mb-3" });
|
|
10110
|
-
cssClassGroup.appendChild(createElement("label", { className: "block text-sm font-
|
|
10126
|
+
cssClassGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Custom CSS Class" }));
|
|
10111
10127
|
cssClassGroup.appendChild(createElement("input", {
|
|
10112
10128
|
type: "text",
|
|
10113
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
10129
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent text-sm",
|
|
10114
10130
|
value: selectedField.css?.class || "",
|
|
10115
10131
|
placeholder: "e.g. my-custom-class",
|
|
10116
10132
|
"data-focus-id": `field-css-class-${selectedField.id}`,
|
|
@@ -10162,7 +10178,7 @@ var FormBuilder = class {
|
|
|
10162
10178
|
initialCssStyleValue = preservedValue;
|
|
10163
10179
|
}
|
|
10164
10180
|
const cssStyleTextarea = createElement("textarea", {
|
|
10165
|
-
className: "w-full px-3 py-2 border border-gray-
|
|
10181
|
+
className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent text-xs font-mono",
|
|
10166
10182
|
rows: 3,
|
|
10167
10183
|
placeholder: '{"padding": "8px", "backgroundColor": "#f0f0f0"}',
|
|
10168
10184
|
"data-focus-id": cssStyleId,
|