form-builder-pro 1.2.9 → 1.3.1

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 CHANGED
@@ -863,21 +863,21 @@ body {
863
863
  .inset-0 {
864
864
  inset: 0px;
865
865
  }
866
- .right-1 {
867
- right: 0.25rem;
868
- }
869
866
  .right-2 {
870
867
  right: 0.5rem;
871
868
  }
872
- .right-6 {
873
- right: 1.5rem;
869
+ .right-8 {
870
+ right: 2rem;
874
871
  }
875
- .top-1 {
876
- top: 0.25rem;
872
+ .right-\[16\%\] {
873
+ right: 16%;
877
874
  }
878
875
  .top-2 {
879
876
  top: 0.5rem;
880
877
  }
878
+ .top-\[6px\] {
879
+ top: 6px;
880
+ }
881
881
  .z-10 {
882
882
  z-index: 10;
883
883
  }
@@ -1005,9 +1005,6 @@ body {
1005
1005
  .min-h-\[100px\] {
1006
1006
  min-height: 100px;
1007
1007
  }
1008
- .min-h-\[120px\] {
1009
- min-height: 120px;
1010
- }
1011
1008
  .min-h-\[200px\] {
1012
1009
  min-height: 200px;
1013
1010
  }
@@ -1035,6 +1032,9 @@ body {
1035
1032
  .w-8 {
1036
1033
  width: 2rem;
1037
1034
  }
1035
+ .w-\[256px\] {
1036
+ width: 256px;
1037
+ }
1038
1038
  .w-\[300px\] {
1039
1039
  width: 300px;
1040
1040
  }
@@ -1044,8 +1044,8 @@ body {
1044
1044
  .max-w-2xl {
1045
1045
  max-width: 42rem;
1046
1046
  }
1047
- .max-w-\[180px\] {
1048
- max-width: 180px;
1047
+ .max-w-\[140px\] {
1048
+ max-width: 140px;
1049
1049
  }
1050
1050
  .max-w-full {
1051
1051
  max-width: 100%;
@@ -1254,17 +1254,10 @@ body {
1254
1254
  --tw-bg-opacity: 1;
1255
1255
  background-color: rgb(1 159 162 / var(--tw-bg-opacity, 1));
1256
1256
  }
1257
- .bg-\[\#3b497e\] {
1258
- --tw-bg-opacity: 1;
1259
- background-color: rgb(59 73 126 / var(--tw-bg-opacity, 1));
1260
- }
1261
1257
  .bg-\[\#635bff\] {
1262
1258
  --tw-bg-opacity: 1;
1263
1259
  background-color: rgb(99 91 255 / var(--tw-bg-opacity, 1));
1264
1260
  }
1265
- .bg-\[\#847dff1a\] {
1266
- background-color: #847dff1a;
1267
- }
1268
1261
  .bg-\[\#e7e7ff\] {
1269
1262
  --tw-bg-opacity: 1;
1270
1263
  background-color: rgb(231 231 255 / var(--tw-bg-opacity, 1));
@@ -1331,8 +1324,8 @@ body {
1331
1324
  .p-8 {
1332
1325
  padding: 2rem;
1333
1326
  }
1334
- .p-\[0\.5px\] {
1335
- padding: 0.5px;
1327
+ .p-\[2px\] {
1328
+ padding: 2px;
1336
1329
  }
1337
1330
  .px-1 {
1338
1331
  padding-left: 0.25rem;
@@ -1757,6 +1750,16 @@ input[type="radio"]:checked::after {
1757
1750
  background-color: rgb(1 138 141 / var(--tw-bg-opacity, 1));
1758
1751
  }
1759
1752
 
1753
+ .hover\:bg-\[\#635bff\]:hover {
1754
+ --tw-bg-opacity: 1;
1755
+ background-color: rgb(99 91 255 / var(--tw-bg-opacity, 1));
1756
+ }
1757
+
1758
+ .hover\:bg-\[\#ef2f2f\]:hover {
1759
+ --tw-bg-opacity: 1;
1760
+ background-color: rgb(239 47 47 / var(--tw-bg-opacity, 1));
1761
+ }
1762
+
1760
1763
  .hover\:bg-blue-200:hover {
1761
1764
  --tw-bg-opacity: 1;
1762
1765
  background-color: rgb(191 219 254 / var(--tw-bg-opacity, 1));
@@ -1821,6 +1824,11 @@ input[type="radio"]:checked::after {
1821
1824
  color: rgb(239 68 68 / var(--tw-text-opacity, 1));
1822
1825
  }
1823
1826
 
1827
+ .hover\:text-white:hover {
1828
+ --tw-text-opacity: 1;
1829
+ color: rgb(255 255 255 / var(--tw-text-opacity, 1));
1830
+ }
1831
+
1824
1832
  .hover\:shadow-sm:hover {
1825
1833
  --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
1826
1834
  --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
package/dist/index.js CHANGED
@@ -4610,10 +4610,12 @@ function transformField(field) {
4610
4610
  transformed.optionsSource = field.optionsSource;
4611
4611
  if (field.customOptionsEnabled !== void 0)
4612
4612
  transformed.customOptionsEnabled = field.customOptionsEnabled;
4613
- if (field.groupName !== void 0)
4614
- transformed.groupName = field.groupName;
4615
- if (field.masterTypeName !== void 0)
4616
- transformed.masterTypeName = field.masterTypeName;
4613
+ if (transformed.optionSource === "MASTER") {
4614
+ if (field.groupName !== void 0)
4615
+ transformed.groupName = field.groupName;
4616
+ if (field.masterTypeName !== void 0)
4617
+ transformed.masterTypeName = field.masterTypeName;
4618
+ }
4617
4619
  if ((normalizedType === "select" || normalizedType === "radio" || normalizedType === "checkbox") && field.options && Array.isArray(field.options)) {
4618
4620
  transformed.options = field.options.map((opt, idx) => {
4619
4621
  if (opt && typeof opt === "object" && "label" in opt && "value" in opt) {
@@ -4778,10 +4780,12 @@ function fieldToPayload(field) {
4778
4780
  payload.optionSource = field.optionSource;
4779
4781
  if (field.customOptionsEnabled !== void 0)
4780
4782
  payload.customOptionsEnabled = field.customOptionsEnabled;
4781
- if (field.groupName !== void 0)
4782
- payload.groupName = field.groupName;
4783
- if (field.masterTypeName !== void 0)
4784
- payload.masterTypeName = field.masterTypeName;
4783
+ if (field.optionSource === "MASTER") {
4784
+ if (field.groupName !== void 0)
4785
+ payload.groupName = field.groupName;
4786
+ if (field.masterTypeName !== void 0)
4787
+ payload.masterTypeName = field.masterTypeName;
4788
+ }
4785
4789
  if (field.lookupSourceType !== void 0)
4786
4790
  payload.lookupSourceType = field.lookupSourceType;
4787
4791
  if (field.lookupSource !== void 0)
@@ -6275,7 +6279,7 @@ var FieldRenderer = class {
6275
6279
  const MAX_SIZE_BYTES = MAX_SIZE_MB * 1024 * 1024;
6276
6280
  const container = createElement("div", { className: "image-field-wrapper flex flex-col gap-3 w-full" });
6277
6281
  const previewWrap = createElement("div", {
6278
- className: "relative rounded-md border border-input bg-gray-50 dark:bg-gray-800 overflow-hidden min-h-[120px] flex items-center justify-center"
6282
+ className: "relative rounded-md border border-input bg-gray-50 dark:bg-gray-800 overflow-hidden min-h-[100px] flex items-center justify-center"
6279
6283
  });
6280
6284
  if (imageValue) {
6281
6285
  const img = createElement("img", {
@@ -8932,13 +8936,13 @@ var FieldWrapper = class {
8932
8936
  });
8933
8937
  }
8934
8938
  if (isSelected) {
8935
- fieldWrapper.classList.add("ring-2", "bg-[#847dff1a]", "dark:bg-blue-900/20");
8939
+ fieldWrapper.classList.add("ring-2", "bg-transparent", "dark:bg-blue-900/20");
8936
8940
  }
8937
8941
  fieldWrapper.appendChild(createElement("div", {
8938
- className: `absolute top-2 right-6 cursor-move p-1 rounded bg-[#3b497e] p-[0.5px] mr-1 text-white group-hover:opacity-100 transition-opacity field-handle z-10 ${isSelected ? "opacity-100" : ""}`
8939
- }, [getIcon("GripVertical", 16)]));
8942
+ className: `absolute top-[6px] bg-[#e7e7ff] hover:bg-[#635bff] hover:text-white right-8 cursor-move p-1 rounded p-[2px] mr-1 text-[#635bff] group-hover:opacity-100 transition-opacity field-handle z-10 ${isSelected ? "opacity-100" : ""}`
8943
+ }, [getIcon("GripVertical", 20)]));
8940
8944
  fieldWrapper.appendChild(createElement("button", {
8941
- className: `absolute top-1 right-1 p-1 rounded text-red-500 group-hover:opacity-100 transition-opacity z-10 ${isSelected ? "opacity-100" : ""}`,
8945
+ className: `absolute top-[6px] right-2 rounded text-red-600 bg-[#f7a1a14d] text-red-500 p-1 hover:bg-[#ef2f2f] hover:text-white group-hover:opacity-100 transition-opacity z-10 ${isSelected ? "opacity-100" : ""}`,
8942
8946
  onclick: (e) => {
8943
8947
  e.stopPropagation();
8944
8948
  if (confirm("Delete this field?")) {
@@ -8946,7 +8950,7 @@ var FieldWrapper = class {
8946
8950
  }
8947
8951
  }
8948
8952
  }, [getIcon("Trash2", 16)]));
8949
- const content = createElement("div", { className: "p-3 pointer-events-none" });
8953
+ const content = createElement("div", { className: "p-2 pointer-events-none " });
8950
8954
  content.appendChild(FieldRenderer.render(field, null, void 0, true));
8951
8955
  fieldWrapper.appendChild(content);
8952
8956
  return fieldWrapper;
@@ -9113,7 +9117,7 @@ var SectionList = class {
9113
9117
  }
9114
9118
  render() {
9115
9119
  const listContainer = createElement("div", {
9116
- className: "space-y-6 min-h-[200px] ",
9120
+ className: "space-y-6 ",
9117
9121
  // pb-20 for extra scrolling space
9118
9122
  id: "sections-list",
9119
9123
  "data-drop-zone": "sections"
@@ -9632,7 +9636,7 @@ var FormBuilder = class {
9632
9636
  }, [getIcon("Cog", 20)]);
9633
9637
  right.appendChild(settingsBtn);
9634
9638
  const clearBtn = createElement("button", {
9635
- className: "flex items-center px-3 py-2 text-sm font-medium text-red-600 bg-[#f7a1a14d] text-red-500 rounded-md transition-colors",
9639
+ className: "flex items-center px-3 py-2 text-sm font-medium text-red-600 bg-[#f7a1a14d] text-red-500 hover:bg-[#ef2f2f] hover:text-white rounded-md transition-colors",
9636
9640
  onclick: () => {
9637
9641
  if (confirm("Are you sure?")) {
9638
9642
  formStore.getState().setSchema({ id: "new", title: "New Form", formName: "newForm", sections: [] });
@@ -9640,7 +9644,7 @@ var FormBuilder = class {
9640
9644
  }
9641
9645
  }, [getIcon("Trash2", 16), createElement("span", { className: "", title: "Clear" })]);
9642
9646
  const previewBtn = createElement("button", {
9643
- 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]"}`,
9647
+ className: `flex items-center justify-center px-3 py-2 text-sm font-medium rounded-md transition-colors ${state.isPreviewMode ? "text-[#635bff] bg-[#e7e7ff] hover:bg-[#635bff] hover:text-white" : "text-[#635bff] bg-[#e7e7ff] hover:bg-[#635bff] hover:text-white"}`,
9644
9648
  onclick: (e) => {
9645
9649
  e.preventDefault();
9646
9650
  e.stopPropagation();
@@ -9649,7 +9653,7 @@ var FormBuilder = class {
9649
9653
  title: state.isPreviewMode ? "Exit Preview" : "Preview Form"
9650
9654
  }, [getIcon(state.isPreviewMode ? "X" : "Eye", 16)]);
9651
9655
  const saveBtn = createElement("button", {
9652
- className: "flex items-center px-3 py-2 text-sm font-medium text-[#635bff] bg-[#e7e7ff] rounded-md shadow-sm transition-colors",
9656
+ className: "flex items-center px-3 py-2 text-sm font-medium text-[#635bff] bg-[#e7e7ff] hover:bg-[#635bff] hover:text-white rounded-md shadow-sm transition-colors",
9653
9657
  onclick: () => {
9654
9658
  const schema = formStore.getState().schema;
9655
9659
  const numericFields = schema.sections.flatMap((s) => s.fields).filter((f) => f.type === "number");
@@ -9820,7 +9824,7 @@ var FormBuilder = class {
9820
9824
  const sectionList = new SectionList(state.schema, state.selectedFieldId);
9821
9825
  inner.appendChild(sectionList.getElement());
9822
9826
  const addSectionBtn = createElement("button", {
9823
- 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",
9827
+ className: "w-full mt-6 py-3 dark:border-gray-700 rounded-md text-sm text-gray-500 bg-[#635bff] max-w-[140px] text-white transition-colors flex items-center justify-center font-medium",
9824
9828
  onclick: () => formStore.getState().addSection()
9825
9829
  }, [getIcon("Plus", 20), createElement("span", { className: "ml-2", text: "Add Section" })]);
9826
9830
  inner.appendChild(addSectionBtn);
@@ -10161,112 +10165,6 @@ var FormBuilder = class {
10161
10165
  `show-country-name-${selectedField.id}`
10162
10166
  ));
10163
10167
  }
10164
- if (selectedField.type === "select" && selectedField.optionSource === "MASTER") {
10165
- const masterTypes = formStore.getState().masterTypes;
10166
- const activeMasterTypes = masterTypes.filter((mt) => mt.active === true);
10167
- const dropdownOptionsMap = formStore.getState().dropdownOptionsMap;
10168
- const convertIndexesToOptions = (indexes) => {
10169
- if (!indexes || !Array.isArray(indexes) || indexes.length === 0) {
10170
- return [];
10171
- }
10172
- return indexes.map((item, index2) => {
10173
- if (typeof item === "string") {
10174
- return { label: item, value: item };
10175
- }
10176
- if (typeof item === "object" && item !== null) {
10177
- const label = item.label || item.name || item.displayName || item.text || `Option ${index2 + 1}`;
10178
- const value = item.value || item.id || item.name || String(index2);
10179
- return { label, value };
10180
- }
10181
- return { label: String(item), value: String(item) };
10182
- });
10183
- };
10184
- if (activeMasterTypes.length > 0) {
10185
- const groupNameGroup = createElement("div", { className: "mb-4" });
10186
- groupNameGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Master List" }));
10187
- const groupNameSelect = createElement("select", {
10188
- className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
10189
- onchange: (e) => {
10190
- const selectedEnumName = e.target.value;
10191
- if (selectedEnumName) {
10192
- const selectedMasterType = activeMasterTypes.find((mt) => mt.enumName === selectedEnumName);
10193
- if (selectedMasterType) {
10194
- let options = [];
10195
- if (dropdownOptionsMap && dropdownOptionsMap[selectedEnumName]) {
10196
- options = dropdownOptionsMap[selectedEnumName];
10197
- } else if (selectedMasterType.indexes && selectedMasterType.indexes.length > 0) {
10198
- options = convertIndexesToOptions(selectedMasterType.indexes);
10199
- }
10200
- formStore.getState().updateField(selectedField.id, {
10201
- groupName: {
10202
- id: selectedMasterType.id,
10203
- name: selectedMasterType.name
10204
- },
10205
- masterTypeName: selectedEnumName,
10206
- options: options.length > 0 ? options : void 0
10207
- });
10208
- if (this.options.onGroupSelectionChange) {
10209
- this.options.onGroupSelectionChange({
10210
- fieldId: selectedField.id,
10211
- groupEnumName: selectedEnumName
10212
- });
10213
- }
10214
- }
10215
- } else {
10216
- formStore.getState().updateField(selectedField.id, {
10217
- groupName: void 0,
10218
- masterTypeName: void 0,
10219
- options: void 0
10220
- // Clear options when groupName is cleared
10221
- });
10222
- }
10223
- }
10224
- });
10225
- let currentMasterType;
10226
- if (selectedField.masterTypeName) {
10227
- currentMasterType = activeMasterTypes.find((mt) => mt.enumName === selectedField.masterTypeName);
10228
- } else if (selectedField.groupName) {
10229
- currentMasterType = activeMasterTypes.find(
10230
- (mt) => mt.id === selectedField.groupName?.id || mt.name === selectedField.groupName?.name
10231
- );
10232
- }
10233
- groupNameSelect.appendChild(createElement("option", {
10234
- value: "",
10235
- text: "None",
10236
- selected: !currentMasterType
10237
- }));
10238
- activeMasterTypes.forEach((mt) => {
10239
- const isSelected = currentMasterType && (selectedField.masterTypeName && mt.enumName === selectedField.masterTypeName || selectedField.groupName && (mt.id === selectedField.groupName?.id || mt.name === selectedField.groupName?.name));
10240
- const optionValue = mt.enumName || mt.id || mt.name;
10241
- groupNameSelect.appendChild(createElement("option", {
10242
- value: optionValue,
10243
- text: mt.displayName || mt.name,
10244
- selected: !!isSelected
10245
- }));
10246
- });
10247
- groupNameGroup.appendChild(groupNameSelect);
10248
- body.appendChild(groupNameGroup);
10249
- if (currentMasterType && (!selectedField.options || selectedField.options.length === 0)) {
10250
- let options = [];
10251
- if (currentMasterType.enumName && dropdownOptionsMap && dropdownOptionsMap[currentMasterType.enumName]) {
10252
- options = dropdownOptionsMap[currentMasterType.enumName];
10253
- } else if (currentMasterType.indexes && currentMasterType.indexes.length > 0) {
10254
- options = convertIndexesToOptions(currentMasterType.indexes);
10255
- }
10256
- if (options.length > 0) {
10257
- formStore.getState().updateField(selectedField.id, { options });
10258
- }
10259
- if (selectedField.masterTypeName && !selectedField.groupName) {
10260
- formStore.getState().updateField(selectedField.id, {
10261
- groupName: {
10262
- id: currentMasterType.id,
10263
- name: currentMasterType.name
10264
- }
10265
- });
10266
- }
10267
- }
10268
- }
10269
- }
10270
10168
  if (["select", "checkbox", "radio"].includes(selectedField.type)) {
10271
10169
  const optionSourceHeader = createElement("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3 mt-6", text: "Option Source" });
10272
10170
  body.appendChild(optionSourceHeader);
@@ -10278,12 +10176,18 @@ var FormBuilder = class {
10278
10176
  onchange: (e) => {
10279
10177
  const source = e.target.value;
10280
10178
  const updates = { optionSource: source };
10281
- if (source === "MASTER" && !selectedField.masterTypeName && !selectedField.groupName) ; else if (source === "STATIC") {
10179
+ if (source === "MASTER") ; else if (source === "STATIC") {
10282
10180
  updates.customOptionsEnabled = true;
10181
+ updates.groupName = void 0;
10182
+ updates.masterTypeName = void 0;
10183
+ updates.options = void 0;
10283
10184
  } else if (source === "LOOKUP") {
10284
10185
  if (!selectedField.lookupSourceType) {
10285
10186
  updates.lookupSourceType = "MODULE";
10286
10187
  }
10188
+ updates.groupName = void 0;
10189
+ updates.masterTypeName = void 0;
10190
+ updates.options = void 0;
10287
10191
  }
10288
10192
  formStore.getState().updateField(selectedField.id, updates);
10289
10193
  this.render();
@@ -10296,6 +10200,101 @@ var FormBuilder = class {
10296
10200
  }
10297
10201
  optionSourceGroup.appendChild(optionSourceSelect);
10298
10202
  body.appendChild(optionSourceGroup);
10203
+ if (selectedField.type === "select" && selectedField.optionSource === "MASTER") {
10204
+ const masterTypes = formStore.getState().masterTypes;
10205
+ const activeMasterTypes = masterTypes.filter((mt) => mt.active === true);
10206
+ const dropdownOptionsMap = formStore.getState().dropdownOptionsMap;
10207
+ const convertIndexesToOptions = (indexes) => {
10208
+ if (!indexes || !Array.isArray(indexes) || indexes.length === 0) {
10209
+ return [];
10210
+ }
10211
+ return indexes.map((item, index2) => {
10212
+ if (typeof item === "string") {
10213
+ return { label: item, value: item };
10214
+ }
10215
+ if (typeof item === "object" && item !== null) {
10216
+ const label = item.label || item.name || item.displayName || item.text || `Option ${index2 + 1}`;
10217
+ const value = item.value || item.id || item.name || String(index2);
10218
+ return { label, value };
10219
+ }
10220
+ return { label: String(item), value: String(item) };
10221
+ });
10222
+ };
10223
+ if (activeMasterTypes.length > 0) {
10224
+ const groupNameGroup = createElement("div", { className: "mb-4" });
10225
+ groupNameGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Master List" }));
10226
+ const groupNameSelect = createElement("select", {
10227
+ className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
10228
+ onchange: (e) => {
10229
+ const selectedEnumName = e.target.value;
10230
+ if (selectedEnumName) {
10231
+ const selectedMasterType = activeMasterTypes.find((mt) => mt.enumName === selectedEnumName);
10232
+ if (selectedMasterType) {
10233
+ let options = [];
10234
+ if (dropdownOptionsMap && dropdownOptionsMap[selectedEnumName]) {
10235
+ options = dropdownOptionsMap[selectedEnumName];
10236
+ } else if (selectedMasterType.indexes && selectedMasterType.indexes.length > 0) {
10237
+ options = convertIndexesToOptions(selectedMasterType.indexes);
10238
+ }
10239
+ formStore.getState().updateField(selectedField.id, {
10240
+ groupName: { id: selectedMasterType.id, name: selectedMasterType.name },
10241
+ masterTypeName: selectedEnumName,
10242
+ options: options.length > 0 ? options : void 0
10243
+ });
10244
+ if (this.options.onGroupSelectionChange) {
10245
+ this.options.onGroupSelectionChange({
10246
+ fieldId: selectedField.id,
10247
+ groupEnumName: selectedEnumName
10248
+ });
10249
+ }
10250
+ }
10251
+ } else {
10252
+ formStore.getState().updateField(selectedField.id, {
10253
+ groupName: void 0,
10254
+ masterTypeName: void 0,
10255
+ options: void 0
10256
+ });
10257
+ }
10258
+ }
10259
+ });
10260
+ let currentMasterType;
10261
+ if (selectedField.masterTypeName) {
10262
+ currentMasterType = activeMasterTypes.find((mt) => mt.enumName === selectedField.masterTypeName);
10263
+ } else if (selectedField.groupName) {
10264
+ currentMasterType = activeMasterTypes.find(
10265
+ (mt) => mt.id === selectedField.groupName?.id || mt.name === selectedField.groupName?.name
10266
+ );
10267
+ }
10268
+ groupNameSelect.appendChild(createElement("option", { value: "", text: "None", selected: !currentMasterType }));
10269
+ activeMasterTypes.forEach((mt) => {
10270
+ const isSelected = currentMasterType && (selectedField.masterTypeName && mt.enumName === selectedField.masterTypeName || selectedField.groupName && (mt.id === selectedField.groupName?.id || mt.name === selectedField.groupName?.name));
10271
+ const optionValue = mt.enumName || mt.id || mt.name;
10272
+ groupNameSelect.appendChild(createElement("option", {
10273
+ value: optionValue,
10274
+ text: mt.displayName || mt.name,
10275
+ selected: !!isSelected
10276
+ }));
10277
+ });
10278
+ groupNameGroup.appendChild(groupNameSelect);
10279
+ body.appendChild(groupNameGroup);
10280
+ if (currentMasterType && (!selectedField.options || selectedField.options.length === 0)) {
10281
+ let options = [];
10282
+ if (currentMasterType.enumName && dropdownOptionsMap && dropdownOptionsMap[currentMasterType.enumName]) {
10283
+ options = dropdownOptionsMap[currentMasterType.enumName];
10284
+ } else if (currentMasterType.indexes && currentMasterType.indexes.length > 0) {
10285
+ options = convertIndexesToOptions(currentMasterType.indexes);
10286
+ }
10287
+ if (options.length > 0) {
10288
+ formStore.getState().updateField(selectedField.id, { options });
10289
+ }
10290
+ if (selectedField.masterTypeName && !selectedField.groupName) {
10291
+ formStore.getState().updateField(selectedField.id, {
10292
+ groupName: { id: currentMasterType.id, name: currentMasterType.name }
10293
+ });
10294
+ }
10295
+ }
10296
+ }
10297
+ }
10299
10298
  if (selectedField.type === "select" && selectedField.optionSource === "LOOKUP") {
10300
10299
  const lookupSourceTypeGroup = createElement("div", { className: "mb-4" });
10301
10300
  lookupSourceTypeGroup.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Lookup Source Type" }));
@@ -10493,10 +10492,10 @@ var FormBuilder = class {
10493
10492
  };
10494
10493
  const optionsList = createElement("div", { className: "space-y-2 mb-3" });
10495
10494
  options.forEach((opt, index2) => {
10496
- const optionRow = createElement("div", { className: "flex gap-2 items-center" });
10495
+ const optionRow = createElement("div", { className: "flex gap-2 items-center w-[256px]" });
10497
10496
  const labelInput = createElement("input", {
10498
10497
  type: "text",
10499
- className: "flex-1 px-2 py-1.5 border border-gray-300 dark:border-gray-700 rounded-md bg-transparent text-sm",
10498
+ className: "flex-1 px-2 py-1.5 border border-gray-300 w-full dark:border-gray-700 rounded-md bg-transparent text-sm",
10500
10499
  value: opt.label,
10501
10500
  placeholder: "Option label",
10502
10501
  "data-focus-id": `field-option-label-${selectedField.id}-${index2}`,
@@ -10511,7 +10510,7 @@ var FormBuilder = class {
10511
10510
  });
10512
10511
  const valueInput = createElement("input", {
10513
10512
  type: "text",
10514
- className: "flex-1 px-2 py-1.5 border border-gray-300 dark:border-gray-700 rounded-md bg-transparent text-sm",
10513
+ className: "flex-1 px-2 py-1.5 border border-gray-300 w-full dark:border-gray-700 rounded-md bg-transparent text-sm",
10515
10514
  value: opt.value,
10516
10515
  placeholder: "Option value",
10517
10516
  "data-focus-id": `field-option-value-${selectedField.id}-${index2}`,
@@ -10545,7 +10544,7 @@ var FormBuilder = class {
10545
10544
  body.appendChild(optionsList);
10546
10545
  const addOptionBtn = createElement("button", {
10547
10546
  type: "button",
10548
- className: "w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-700 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",
10547
+ className: "w-full mt-6 py-2 dark:border-gray-700 rounded-md text-sm text-gray-500 bg-[#635bff] text-white transition-colors flex items-center justify-center font-medium transition-colors",
10549
10548
  text: "Add Option",
10550
10549
  onclick: () => {
10551
10550
  const currentOptions = getCurrentOptions();