@erpsquad/common 1.8.119 → 1.8.122

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.
Files changed (291) hide show
  1. package/dist/_virtual/index/index.esm.js +2 -4
  2. package/dist/_virtual/index/index.esm.js.map +1 -1
  3. package/dist/_virtual/index/index.esm10.js +3 -3
  4. package/dist/_virtual/index/index.esm2.js +3 -3
  5. package/dist/_virtual/index/index.esm3.js +3 -3
  6. package/dist/_virtual/index/index.esm4.js +3 -3
  7. package/dist/_virtual/index/index.esm5.js +3 -3
  8. package/dist/_virtual/index/index.esm6.js +3 -3
  9. package/dist/_virtual/index/index.esm7.js +4 -2
  10. package/dist/_virtual/index/index.esm7.js.map +1 -1
  11. package/dist/_virtual/index/index.esm8.js +3 -3
  12. package/dist/_virtual/index/index.esm9.js +3 -3
  13. package/dist/_virtual/index/index.js +1 -1
  14. package/dist/_virtual/index/index10.js +1 -1
  15. package/dist/_virtual/index/index2.js +1 -1
  16. package/dist/_virtual/index/index3.js +1 -1
  17. package/dist/_virtual/index/index4.js +1 -1
  18. package/dist/_virtual/index/index5.js +1 -1
  19. package/dist/_virtual/index/index6.js +1 -1
  20. package/dist/_virtual/index/index7.js +1 -1
  21. package/dist/_virtual/index/index8.js +1 -1
  22. package/dist/_virtual/index/index9.js +1 -1
  23. package/dist/components/accordion/accordion.d.ts +1 -1
  24. package/dist/components/action-bar/action-bar.d.ts +1 -1
  25. package/dist/components/checkbox/checkbox.d.ts +1 -1
  26. package/dist/components/date-picker/date-picker.d.ts +1 -1
  27. package/dist/components/footer/footer.d.ts +1 -1
  28. package/dist/components/form-control/form-builder/form-builder-element/media.d.ts +1 -1
  29. package/dist/components/form-control/form-builder/form-builder-element/phone.d.ts +1 -1
  30. package/dist/components/form-control/form-builder/form-builder-element/select.d.ts +1 -1
  31. package/dist/components/form-control/form-builder/form-builder-element/text.d.ts +1 -1
  32. package/dist/components/form-control/form-builder/form-builder-element/time.d.ts +1 -1
  33. package/dist/components/form-control/form-parser/form-parser/index.esm.js +11 -3
  34. package/dist/components/form-control/form-parser/form-parser/index.esm.js.map +1 -1
  35. package/dist/components/form-control/form-parser/form-parser/index.js +4 -4
  36. package/dist/components/form-control/form-parser/form-parser/index.js.map +1 -1
  37. package/dist/components/form-control/form-parser/form-parser.d.ts +0 -1
  38. package/dist/components/form-control/form-parser/form-switcher.d.ts +1 -1
  39. package/dist/components/icons/action-arrow.d.ts +3 -3
  40. package/dist/components/icons/add-circle.d.ts +3 -3
  41. package/dist/components/icons/arrow-bidirectional.d.ts +3 -3
  42. package/dist/components/icons/arrow-circle-down.d.ts +3 -3
  43. package/dist/components/icons/arrow-down-three.d.ts +3 -3
  44. package/dist/components/icons/arrow-down-two.d.ts +3 -3
  45. package/dist/components/icons/arrow-down.d.ts +3 -3
  46. package/dist/components/icons/arrow-up-down.d.ts +3 -3
  47. package/dist/components/icons/arrow-up-two.d.ts +3 -3
  48. package/dist/components/icons/assignments.d.ts +3 -3
  49. package/dist/components/icons/blank-circle.d.ts +3 -3
  50. package/dist/components/icons/block-filled.d.ts +3 -3
  51. package/dist/components/icons/calendar-add.d.ts +3 -3
  52. package/dist/components/icons/calendar.d.ts +3 -3
  53. package/dist/components/icons/checkbox-square.d.ts +3 -3
  54. package/dist/components/icons/circular-arrow-setting.d.ts +3 -3
  55. package/dist/components/icons/clock.d.ts +3 -3
  56. package/dist/components/icons/close.d.ts +3 -3
  57. package/dist/components/icons/coin-outline.d.ts +3 -3
  58. package/dist/components/icons/copy.d.ts +3 -3
  59. package/dist/components/icons/coupon.d.ts +3 -3
  60. package/dist/components/icons/cross-hire.d.ts +3 -3
  61. package/dist/components/icons/custom-styled-icon.d.ts +3 -3
  62. package/dist/components/icons/dashboard.d.ts +3 -3
  63. package/dist/components/icons/document-download.d.ts +3 -3
  64. package/dist/components/icons/document.d.ts +3 -3
  65. package/dist/components/icons/dollar-circle-filled.d.ts +3 -3
  66. package/dist/components/icons/dollar-circle.d.ts +3 -3
  67. package/dist/components/icons/edit.d.ts +3 -3
  68. package/dist/components/icons/email.d.ts +3 -3
  69. package/dist/components/icons/export.d.ts +3 -3
  70. package/dist/components/icons/eye-off.d.ts +3 -3
  71. package/dist/components/icons/eye-plus-circle.d.ts +3 -3
  72. package/dist/components/icons/eye.d.ts +3 -3
  73. package/dist/components/icons/filled-circle.d.ts +3 -3
  74. package/dist/components/icons/filter-remove.d.ts +3 -3
  75. package/dist/components/icons/filter.d.ts +3 -3
  76. package/dist/components/icons/folder-save.d.ts +3 -3
  77. package/dist/components/icons/grid.d.ts +3 -3
  78. package/dist/components/icons/hashtag.d.ts +3 -3
  79. package/dist/components/icons/image.d.ts +3 -3
  80. package/dist/components/icons/import.d.ts +3 -3
  81. package/dist/components/icons/info-circle.d.ts +3 -3
  82. package/dist/components/icons/info.d.ts +3 -3
  83. package/dist/components/icons/link-horizontal.d.ts +3 -3
  84. package/dist/components/icons/link.d.ts +3 -3
  85. package/dist/components/icons/location.d.ts +3 -3
  86. package/dist/components/icons/lowest-lead-time.d.ts +3 -3
  87. package/dist/components/icons/lowest-min-qty.d.ts +3 -3
  88. package/dist/components/icons/lowest-price.d.ts +3 -3
  89. package/dist/components/icons/more.d.ts +3 -3
  90. package/dist/components/icons/notification.d.ts +3 -3
  91. package/dist/components/icons/paper-clip.d.ts +3 -3
  92. package/dist/components/icons/paragraph.d.ts +3 -3
  93. package/dist/components/icons/payment-request.d.ts +3 -3
  94. package/dist/components/icons/phone.d.ts +3 -3
  95. package/dist/components/icons/printer.d.ts +3 -3
  96. package/dist/components/icons/process-calendar.d.ts +3 -3
  97. package/dist/components/icons/promotion.d.ts +3 -3
  98. package/dist/components/icons/radio-button.d.ts +3 -3
  99. package/dist/components/icons/receipt-filled.d.ts +3 -3
  100. package/dist/components/icons/receipt-outline.d.ts +3 -3
  101. package/dist/components/icons/receipt.d.ts +3 -3
  102. package/dist/components/icons/refresh-icon.d.ts +3 -3
  103. package/dist/components/icons/replace.d.ts +3 -3
  104. package/dist/components/icons/save.d.ts +3 -3
  105. package/dist/components/icons/search-status.d.ts +3 -3
  106. package/dist/components/icons/search.d.ts +3 -3
  107. package/dist/components/icons/settings-fallback.d.ts +3 -3
  108. package/dist/components/icons/sort-arrow-icon.d.ts +3 -3
  109. package/dist/components/icons/stacked-layer.d.ts +3 -3
  110. package/dist/components/icons/start-filled.d.ts +3 -3
  111. package/dist/components/icons/three-dot-icon.d.ts +3 -3
  112. package/dist/components/icons/tick-circle-filled.d.ts +3 -3
  113. package/dist/components/icons/tick-circle.d.ts +3 -3
  114. package/dist/components/icons/tick-octagon.d.ts +3 -3
  115. package/dist/components/icons/tick.d.ts +3 -3
  116. package/dist/components/icons/toggle-switch.d.ts +3 -3
  117. package/dist/components/icons/trash.d.ts +3 -3
  118. package/dist/components/icons/wave.d.ts +3 -3
  119. package/dist/components/icons/with-out-tick-octagon.d.ts +3 -3
  120. package/dist/components/icons/work-centre.d.ts +3 -3
  121. package/dist/components/index.esm.js +2 -2
  122. package/dist/components/index.js +1 -1
  123. package/dist/components/location-select.d.ts +1 -1
  124. package/dist/components/material-editable-table/material-editable-table.d.ts +1 -1
  125. package/dist/components/material-table/material-table.d.ts +1 -1
  126. package/dist/components/phone-input/phone-input.d.ts +1 -1
  127. package/dist/components/radio/radio.d.ts +1 -1
  128. package/dist/components/select/select.d.ts +1 -1
  129. package/dist/components/switches/android-12-switch.d.ts +3 -1
  130. package/dist/components/text-field/text-field.d.ts +1 -1
  131. package/dist/components/time-picker/time-picker.d.ts +1 -1
  132. package/dist/components/upload-media/upload-media.d.ts +1 -1
  133. package/dist/hooks/useUomFieldUpdater/index.esm.js +1 -1
  134. package/dist/hooks/useUomFieldUpdater/index.esm.js.map +1 -1
  135. package/dist/hooks/useUomFieldUpdater/index.js +1 -1
  136. package/dist/hooks/useUomFieldUpdater/index.js.map +1 -1
  137. package/dist/index.esm.js +75 -75
  138. package/dist/index.js +1 -1
  139. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
  140. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
  141. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js.map +1 -1
  142. package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
  143. package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
  144. package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
  145. package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
  146. package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
  147. package/dist/node_modules/@mui/system/createStyled/index.js.map +1 -1
  148. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
  149. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
  150. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js.map +1 -1
  151. package/dist/node_modules/prop-types/checkPropTypes/index.esm.js +48 -55
  152. package/dist/node_modules/prop-types/checkPropTypes/index.esm.js.map +1 -1
  153. package/dist/node_modules/prop-types/checkPropTypes/index.js +1 -1
  154. package/dist/node_modules/prop-types/checkPropTypes/index.js.map +1 -1
  155. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.esm.js +2 -2
  156. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.esm.js.map +1 -1
  157. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.js +1 -1
  158. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.js.map +1 -1
  159. package/dist/node_modules/prop-types/index/index.esm.js +1 -1
  160. package/dist/node_modules/prop-types/index/index.js +1 -1
  161. package/dist/node_modules/prop-types/index/index.js.map +1 -1
  162. package/dist/src/components/accordion/accordion.d.ts +1 -1
  163. package/dist/src/components/action-bar/action-bar.d.ts +1 -1
  164. package/dist/src/components/checkbox/checkbox.d.ts +1 -1
  165. package/dist/src/components/date-picker/date-picker.d.ts +1 -1
  166. package/dist/src/components/footer/footer.d.ts +1 -1
  167. package/dist/src/components/form-control/form-builder/form-builder-element/media.d.ts +1 -1
  168. package/dist/src/components/form-control/form-builder/form-builder-element/phone.d.ts +1 -1
  169. package/dist/src/components/form-control/form-builder/form-builder-element/select.d.ts +1 -1
  170. package/dist/src/components/form-control/form-builder/form-builder-element/text.d.ts +1 -1
  171. package/dist/src/components/form-control/form-builder/form-builder-element/time.d.ts +1 -1
  172. package/dist/src/components/form-control/form-parser/form-parser.d.ts +0 -1
  173. package/dist/src/components/form-control/form-parser/form-switcher.d.ts +1 -1
  174. package/dist/src/components/icons/action-arrow.d.ts +3 -3
  175. package/dist/src/components/icons/add-circle.d.ts +3 -3
  176. package/dist/src/components/icons/arrow-bidirectional.d.ts +3 -3
  177. package/dist/src/components/icons/arrow-circle-down.d.ts +3 -3
  178. package/dist/src/components/icons/arrow-down-three.d.ts +3 -3
  179. package/dist/src/components/icons/arrow-down-two.d.ts +3 -3
  180. package/dist/src/components/icons/arrow-down.d.ts +3 -3
  181. package/dist/src/components/icons/arrow-up-down.d.ts +3 -3
  182. package/dist/src/components/icons/arrow-up-two.d.ts +3 -3
  183. package/dist/src/components/icons/assignments.d.ts +3 -3
  184. package/dist/src/components/icons/blank-circle.d.ts +3 -3
  185. package/dist/src/components/icons/block-filled.d.ts +3 -3
  186. package/dist/src/components/icons/calendar-add.d.ts +3 -3
  187. package/dist/src/components/icons/calendar.d.ts +3 -3
  188. package/dist/src/components/icons/checkbox-square.d.ts +3 -3
  189. package/dist/src/components/icons/circular-arrow-setting.d.ts +3 -3
  190. package/dist/src/components/icons/clock.d.ts +3 -3
  191. package/dist/src/components/icons/close.d.ts +3 -3
  192. package/dist/src/components/icons/coin-outline.d.ts +3 -3
  193. package/dist/src/components/icons/copy.d.ts +3 -3
  194. package/dist/src/components/icons/coupon.d.ts +3 -3
  195. package/dist/src/components/icons/cross-hire.d.ts +3 -3
  196. package/dist/src/components/icons/custom-styled-icon.d.ts +3 -3
  197. package/dist/src/components/icons/dashboard.d.ts +3 -3
  198. package/dist/src/components/icons/document-download.d.ts +3 -3
  199. package/dist/src/components/icons/document.d.ts +3 -3
  200. package/dist/src/components/icons/dollar-circle-filled.d.ts +3 -3
  201. package/dist/src/components/icons/dollar-circle.d.ts +3 -3
  202. package/dist/src/components/icons/edit.d.ts +3 -3
  203. package/dist/src/components/icons/email.d.ts +3 -3
  204. package/dist/src/components/icons/export.d.ts +3 -3
  205. package/dist/src/components/icons/eye-off.d.ts +3 -3
  206. package/dist/src/components/icons/eye-plus-circle.d.ts +3 -3
  207. package/dist/src/components/icons/eye.d.ts +3 -3
  208. package/dist/src/components/icons/filled-circle.d.ts +3 -3
  209. package/dist/src/components/icons/filter-remove.d.ts +3 -3
  210. package/dist/src/components/icons/filter.d.ts +3 -3
  211. package/dist/src/components/icons/folder-save.d.ts +3 -3
  212. package/dist/src/components/icons/grid.d.ts +3 -3
  213. package/dist/src/components/icons/hashtag.d.ts +3 -3
  214. package/dist/src/components/icons/image.d.ts +3 -3
  215. package/dist/src/components/icons/import.d.ts +3 -3
  216. package/dist/src/components/icons/info-circle.d.ts +3 -3
  217. package/dist/src/components/icons/info.d.ts +3 -3
  218. package/dist/src/components/icons/link-horizontal.d.ts +3 -3
  219. package/dist/src/components/icons/link.d.ts +3 -3
  220. package/dist/src/components/icons/location.d.ts +3 -3
  221. package/dist/src/components/icons/lowest-lead-time.d.ts +3 -3
  222. package/dist/src/components/icons/lowest-min-qty.d.ts +3 -3
  223. package/dist/src/components/icons/lowest-price.d.ts +3 -3
  224. package/dist/src/components/icons/more.d.ts +3 -3
  225. package/dist/src/components/icons/notification.d.ts +3 -3
  226. package/dist/src/components/icons/paper-clip.d.ts +3 -3
  227. package/dist/src/components/icons/paragraph.d.ts +3 -3
  228. package/dist/src/components/icons/payment-request.d.ts +3 -3
  229. package/dist/src/components/icons/phone.d.ts +3 -3
  230. package/dist/src/components/icons/printer.d.ts +3 -3
  231. package/dist/src/components/icons/process-calendar.d.ts +3 -3
  232. package/dist/src/components/icons/promotion.d.ts +3 -3
  233. package/dist/src/components/icons/radio-button.d.ts +3 -3
  234. package/dist/src/components/icons/receipt-filled.d.ts +3 -3
  235. package/dist/src/components/icons/receipt-outline.d.ts +3 -3
  236. package/dist/src/components/icons/receipt.d.ts +3 -3
  237. package/dist/src/components/icons/refresh-icon.d.ts +3 -3
  238. package/dist/src/components/icons/replace.d.ts +3 -3
  239. package/dist/src/components/icons/save.d.ts +3 -3
  240. package/dist/src/components/icons/search-status.d.ts +3 -3
  241. package/dist/src/components/icons/search.d.ts +3 -3
  242. package/dist/src/components/icons/settings-fallback.d.ts +3 -3
  243. package/dist/src/components/icons/sort-arrow-icon.d.ts +3 -3
  244. package/dist/src/components/icons/stacked-layer.d.ts +3 -3
  245. package/dist/src/components/icons/start-filled.d.ts +3 -3
  246. package/dist/src/components/icons/three-dot-icon.d.ts +3 -3
  247. package/dist/src/components/icons/tick-circle-filled.d.ts +3 -3
  248. package/dist/src/components/icons/tick-circle.d.ts +3 -3
  249. package/dist/src/components/icons/tick-octagon.d.ts +3 -3
  250. package/dist/src/components/icons/tick.d.ts +3 -3
  251. package/dist/src/components/icons/toggle-switch.d.ts +3 -3
  252. package/dist/src/components/icons/trash.d.ts +3 -3
  253. package/dist/src/components/icons/wave.d.ts +3 -3
  254. package/dist/src/components/icons/with-out-tick-octagon.d.ts +3 -3
  255. package/dist/src/components/icons/work-centre.d.ts +3 -3
  256. package/dist/src/components/location-select.d.ts +1 -1
  257. package/dist/src/components/material-editable-table/material-editable-table.d.ts +1 -1
  258. package/dist/src/components/material-table/material-table.d.ts +1 -1
  259. package/dist/src/components/phone-input/phone-input.d.ts +1 -1
  260. package/dist/src/components/radio/radio.d.ts +1 -1
  261. package/dist/src/components/select/select.d.ts +1 -1
  262. package/dist/src/components/switches/android-12-switch.d.ts +3 -1
  263. package/dist/src/components/text-field/text-field.d.ts +1 -1
  264. package/dist/src/components/time-picker/time-picker.d.ts +1 -1
  265. package/dist/src/components/upload-media/upload-media.d.ts +1 -1
  266. package/dist/src/utils/common-utility.d.ts +1 -1
  267. package/dist/src/utils/form-builder-deconversion.d.ts +0 -43
  268. package/dist/style.css +69 -69
  269. package/dist/utils/api/index.esm.js +20 -1
  270. package/dist/utils/api/index.esm.js.map +1 -1
  271. package/dist/utils/api/index.js +1 -1
  272. package/dist/utils/api/index.js.map +1 -1
  273. package/dist/utils/common-utility.d.ts +1 -1
  274. package/dist/utils/constant/index.esm.js +1 -1
  275. package/dist/utils/constant/index.esm.js.map +1 -1
  276. package/dist/utils/constant/index.js +1 -1
  277. package/dist/utils/constant/index.js.map +1 -1
  278. package/dist/utils/form-builder-deconversion/index.esm.js +5 -4
  279. package/dist/utils/form-builder-deconversion/index.esm.js.map +1 -1
  280. package/dist/utils/form-builder-deconversion/index.js +1 -1
  281. package/dist/utils/form-builder-deconversion/index.js.map +1 -1
  282. package/dist/utils/form-builder-deconversion.d.ts +0 -43
  283. package/dist/utils/index.esm.js +4 -4
  284. package/dist/utils/index.js +1 -1
  285. package/dist/views/form-builder/custom-form/index.esm.js +1 -1
  286. package/dist/views/form-builder/custom-form/index.js +17 -17
  287. package/dist/views/form-builder/custom-form/index.js.map +1 -1
  288. package/dist/views/form-builder/utils/common/index.esm.js +1 -1
  289. package/dist/views/form-builder/utils/common/index.js +1 -1
  290. package/dist/views/form-builder/utils/common/index.js.map +1 -1
  291. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utils/form-builder-deconversion.ts"],"sourcesContent":["export type ItemType = {\n section_name: any;\n is_system_field: boolean;\n field_type: string;\n label: string;\n name?: string;\n placeholder: string;\n default_value: any;\n validation: any[];\n is_multiline: any;\n section_order: any;\n option?: any;\n time_format?: string;\n currency?: string;\n field_properties: {\n is_accordion?: boolean;\n float_step?: any;\n options: any;\n is_multiselect: any;\n title: string;\n title_position: \"start\" | \"end\";\n is_multiline: boolean\n is_checked: boolean\n table: string,\n table_columns: string[]\n table_rows?: any\n is_multiple: boolean\n enable_footer?: boolean\n footer_action?: 'add'\n other_buttons?:React.ReactNode[]\n };\n is_section_field?: true;\n section_type?: \"default\" | \"Form switcher section\";\n form_switcher_label?: string;\n form_switcher_name?: string;\n switcher_forms?: {\n value?: string;\n name?: string;\n id?: number;\n }[];\n is_accordion?: boolean;\n}\n\nconst getFirstNonSectionField = (formData: any[]) => {\n const firstField = formData?.find((field) => !field.is_section_field)\n return firstField\n}\n\nconst formBuilderDeConversion = (formData: any) => {\n const outputData: any = {};\n if (formData.length === 0) {\n return outputData;\n }\n\n const firstItem = getFirstNonSectionField(formData);\n\n if (firstItem?.tab_name) {\n outputData.tab = <any>[];\n let currentTab: {\n title: string;\n data: any;\n remove_tab?: any;\n tab_order?: any;\n } | null = null;\n let currentSection: {\n label: string;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach((item: any) => {\n if (item?.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n currentSection = null\n sectionOrder = sectionOrder++\n } else {\n if (!currentTab || currentTab.title !== item.tab_name) {\n\n currentTab = {\n tab_order: item.tab_order || 1,\n title: item.tab_name,\n data: [],\n };\n const checkIfTabExist = outputData.tab.find(tab => tab.title === currentTab?.title)\n\n if (!checkIfTabExist) {\n outputData.tab.push(currentTab);\n } else {\n currentTab = checkIfTabExist\n }\n currentSection = null;\n }\n\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = currentTab.data.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n currentTab.data.push({ ...otherSectionDetails, ...currentSection });\n } else {\n currentSection = checkIfSectionExist\n }\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label || \"\",\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find((v: { type: string }) => v.type === \"min_val\")\n ?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find((v: { type: string }) => v.type === \"max_val\")\n ?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties.float_step && {\n float_step: item.field_properties.float_step.toString(),\n }),\n ...(item.field_properties.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\" || item.field_type === \"radioButton\") && {\n title: item.field_properties?.title ? item.field_properties?.title : '',\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n if (currentSection) {\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n currentTab.remove_tab = currentTab.data.some(\n (section: { members: any[] }) =>\n section.members.some(\n (member: { type: string }) => member.type === \"system\",\n ),\n );\n }\n }\n });\n } else {\n // Convert to sections format\n outputData.section = [];\n let currentSection: {\n label: any;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach(\n (item: ItemType) => {\n if (item.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n sectionOrder = sectionOrder++\n currentSection = null\n } else {\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = outputData?.section?.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n outputData.section.push({ ...otherSectionDetails, ...currentSection });\n } else {\n currentSection = checkIfSectionExist\n }\n\n // outputData.section.push({ ...otherSectionDetails, ...currentSection });\n\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label,\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_val\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_val\",\n )?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties?.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties?.float_step && {\n float_step: Number(item.field_properties.float_step),\n }),\n ...(item.field_properties?.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties?.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\") && {\n title: item.field_properties?.title ? item.field_properties?.title : item.label,\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n }\n }\n );\n }\n\n return outputData;\n};\n\n\n\nfunction formatText(key: string): string {\n return key ? key\n .split(/[:_-]/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \") : key;\n}\n\nexport const convertTableColumns = (columns: string[]) => {\n if (!Array.isArray(columns)) return [];\n\n return columns.map(column => {\n if (typeof column === 'object') {\n return { ...column }\n } else {\n const colArr = column.split(\".\").filter(str => str)\n const header = colArr.length ? (colArr.length > 1 ? formatText(colArr[colArr.length - 1]) : formatText(colArr[0])) : \"-\"\n\n return {\n header,\n accessorKey: column,\n visible: true,\n }\n }\n })\n}\n\nexport { formBuilderDeConversion };\nexport default formBuilderDeConversion;\n"],"names":["formBuilderDeConversion","formData","outputData","length","firstItem","find","field","is_section_field","getFirstNonSectionField","tab_name","tab","currentTab","currentSection","otherSectionDetails","sectionOrder","forEach","item","field_type","label","is_accordion","section_type","form_switcher_label","form_switcher_name","switcher_forms","disabled","Boolean","title","tab_order","data","checkIfTabExist","push","section_name","section_order","_a","field_properties","members","remove_section","is_system_field","checkIfSectionExist","section","thenValidations","_c","_b","validation","v","type","member","id","Date","now","Math","random","placeholder","default_value","time_format","option","currency","min_length","_d","value","max_length","_e","_f","_g","is_multiline","is_required","_h","_i","is_unique","_j","float_step","toString","options","is_multiselect","_k","enable_footer","_l","footer_action","is_future_dates_allowed","_m","is_past_dates_allowed","_n","max_size","_o","is_multiple","_p","_q","_r","title_position","_s","is_checked","_t","table","_u","table_columns","convertTableColumns","_v","table_rows","_w","otherButtons","_x","other_buttons","some","remove_tab","Number","_y","_z","_A","_B","_C","formatText","key","split","map","word","charAt","toUpperCase","slice","join","columns","Array","isArray","column","colArr","filter","str","header","accessorKey","visible"],"mappings":"oEA2CA,MAKMA,EAA2BC,IAC/B,MAAMC,EAAkB,CAAA,EACxB,GAAwB,IAApBD,EAASE,OACX,OAAOD,EAGT,MAAME,EAXwB,CAACH,GACZ,MAAAA,OAAA,EAAAA,EAAUI,KAAMC,IAAWA,EAAMC,kBAUlCC,CAAwBP,GAE1C,SAAIG,WAAWK,SAAU,CACvBP,EAAWQ,IAAW,GACtB,IAAIC,EAKO,KACPC,EAMO,KACPC,EAA2B,CAAA,EAC3BC,EAAoB,KAExBb,EAASc,QAASC,wDAChB,S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AAL,EAAA2E,EAAuBR,gBAAiB,KAI1DzF,EAAeuB,QAAQL,KAAKgB,GAE1BlC,EAAeuB,QAAQmE,KAAMxD,GAAgC,WAAhBA,EAAOD,MAEpDjC,EAAewB,gBAAiB,EAEhCxB,EAAewB,gBAAiB,CAEpC,GAGN,CAEA,OAAOlC,GAKT,SAAS4G,EAAWC,GAClB,OAAOA,EAAMA,EACVC,MAAM,SACNC,IAAKC,GAASA,EAAKC,OAAO,GAAGC,cAAgBF,EAAKG,MAAM,IACxDC,KAAK,KAAOP,CACjB,CAEO,MAAMhB,EAAuBwB,GAC7BC,MAAMC,QAAQF,GAEZA,EAAQN,IAAIS,IACjB,GAAsB,iBAAXA,EACT,MAAO,IAAKA,GACP,CACL,MAAMC,EAASD,EAAOV,MAAM,KAAKY,UAAcC,GAG/C,MAAO,CACLC,OAHaH,EAAOxH,OAAUwH,EAAOxH,OAAS,EAAI2G,EAAWa,EAAOA,EAAOxH,OAAS,IAAM2G,EAAWa,EAAO,IAAO,IAInHI,YAAaL,EACbM,SAAS,EAEb,IAdkC"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/form-builder-deconversion.ts"],"sourcesContent":["type ItemType = {\n section_name: any;\n is_system_field: boolean;\n field_type: string;\n label: string;\n name?: string;\n placeholder: string;\n default_value: any;\n validation: any[];\n is_multiline: any;\n section_order: any;\n option?: any;\n time_format?: string;\n currency?: string;\n field_properties: {\n is_accordion?: boolean;\n float_step?: any;\n options: any;\n is_multiselect: any;\n title: string;\n title_position: \"start\" | \"end\";\n is_multiline: boolean\n is_checked: boolean\n table: string,\n table_columns: string[]\n table_rows?: any\n is_multiple: boolean\n enable_footer?: boolean\n footer_action?: 'add'\n other_buttons?: React.ReactNode[]\n };\n is_section_field?: true;\n section_type?: \"default\" | \"Form switcher section\";\n form_switcher_label?: string;\n form_switcher_name?: string;\n switcher_forms?: {\n value?: string;\n name?: string;\n id?: number;\n }[];\n is_accordion?: boolean;\n}\n\nconst getFirstNonSectionField = (formData: any[]) => {\n const firstField = formData?.find((field) => !field.is_section_field)\n return firstField\n}\n\nconst formBuilderDeConversion = (formData: any) => {\n const outputData: any = {};\n if (formData.length === 0) {\n return outputData;\n }\n\n const firstItem = getFirstNonSectionField(formData);\n\n if (firstItem?.tab_name) {\n outputData.tab = <any>[];\n let currentTab: {\n title: string;\n data: any;\n remove_tab?: any;\n tab_order?: any;\n } | null = null;\n let currentSection: {\n label: string;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach((item: any) => {\n if (item?.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n currentSection = null\n sectionOrder = sectionOrder++\n } else {\n if (!currentTab || currentTab.title !== item.tab_name) {\n\n currentTab = {\n tab_order: item.tab_order || 1,\n title: item.tab_name,\n data: [],\n };\n const checkIfTabExist = outputData.tab.find(tab => tab.title === currentTab?.title)\n\n if (!checkIfTabExist) {\n outputData.tab.push(currentTab);\n } else {\n currentTab = checkIfTabExist\n }\n currentSection = null;\n }\n\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = currentTab.data.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n // Merge section details and update currentSection reference to the actual pushed object\n currentSection = { ...otherSectionDetails, ...currentSection };\n currentTab.data.push(currentSection);\n } else {\n currentSection = checkIfSectionExist\n }\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label || \"\",\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find((v: { type: string }) => v.type === \"min_val\")\n ?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find((v: { type: string }) => v.type === \"max_val\")\n ?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties.float_step && {\n float_step: item.field_properties.float_step.toString(),\n }),\n ...(item.field_properties.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\" || item.field_type === \"radioButton\") && {\n title: item.field_properties?.title ? item.field_properties?.title : '',\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n if (currentSection) {\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n currentTab.remove_tab = currentTab.data.some(\n (section: { members: any[] }) =>\n section.members.some(\n (member: { type: string }) => member.type === \"system\",\n ),\n );\n }\n }\n });\n } else {\n // Convert to sections format\n outputData.section = [];\n let currentSection: {\n label: any;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach(\n (item: ItemType) => {\n if (item.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n sectionOrder = sectionOrder++\n currentSection = null\n } else {\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = outputData?.section?.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n // Merge section details and update currentSection reference to the actual pushed object\n currentSection = { ...otherSectionDetails, ...currentSection };\n outputData.section.push(currentSection);\n } else {\n currentSection = checkIfSectionExist\n }\n\n // outputData.section.push({ ...otherSectionDetails, ...currentSection });\n\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label,\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_val\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_val\",\n )?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties?.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties?.float_step && {\n float_step: Number(item.field_properties.float_step),\n }),\n ...(item.field_properties?.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties?.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\") && {\n title: item.field_properties?.title ? item.field_properties?.title : item.label,\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n }\n }\n );\n }\n\n return outputData;\n};\n\n\n\nfunction formatText(key: string): string {\n return key ? key\n .split(/[:_-]/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \") : key;\n}\n\nexport const convertTableColumns = (columns: string[]) => {\n if (!Array.isArray(columns)) return [];\n\n return columns.map(column => {\n if (typeof column === 'object') {\n return { ...column }\n } else {\n const colArr = column.split(\".\").filter(str => str)\n const header = colArr.length ? (colArr.length > 1 ? formatText(colArr[colArr.length - 1]) : formatText(colArr[0])) : \"-\"\n\n return {\n header,\n accessorKey: column,\n visible: true,\n }\n }\n })\n}\n\nexport default formBuilderDeConversion;\n"],"names":["formatText","key","split","map","word","charAt","toUpperCase","slice","join","convertTableColumns","columns","Array","isArray","column","colArr","filter","str","header","length","accessorKey","visible","formData","outputData","firstItem","find","field","is_section_field","getFirstNonSectionField","tab_name","tab","currentTab","currentSection","otherSectionDetails","sectionOrder","forEach","item","field_type","label","is_accordion","section_type","form_switcher_label","form_switcher_name","switcher_forms","disabled","Boolean","title","tab_order","data","checkIfTabExist","push","section_name","section_order","_a","field_properties","members","remove_section","is_system_field","checkIfSectionExist","section","thenValidations","_c","_b","validation","v","type","member","id","Date","now","Math","random","placeholder","default_value","time_format","option","currency","min_length","_d","value","max_length","_e","_f","_g","is_multiline","is_required","_h","_i","is_unique","_j","float_step","toString","options","is_multiselect","_k","enable_footer","_l","footer_action","is_future_dates_allowed","_m","is_past_dates_allowed","_n","max_size","_o","is_multiple","_p","_q","_r","title_position","_s","is_checked","_t","table","_u","table_columns","_v","table_rows","_w","otherButtons","_x","other_buttons","some","remove_tab","Number","_y","_z","_A","_B","_C"],"mappings":"aAyZA,SAASA,EAAWC,GAClB,OAAOA,EAAMA,EACVC,MAAM,SACNC,IAAKC,GAASA,EAAKC,OAAO,GAAGC,cAAgBF,EAAKG,MAAM,IACxDC,KAAK,KAAOP,CACjB,wDAEO,MAAMQ,EAAuBC,GAC7BC,MAAMC,QAAQF,GAEZA,EAAQP,IAAIU,IACjB,GAAsB,iBAAXA,EACT,MAAO,IAAKA,GACP,CACL,MAAMC,EAASD,EAAOX,MAAM,KAAKa,UAAcC,GAG/C,MAAO,CACLC,OAHaH,EAAOI,OAAUJ,EAAOI,OAAS,EAAIlB,EAAWc,EAAOA,EAAOI,OAAS,IAAMlB,EAAWc,EAAO,IAAO,IAInHK,YAAaN,EACbO,S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,OAAAW,EAAAnF,EAAKkB,uBAAL,EAAAiE,EAAuBX,iBAAkB,MACzDE,WAAY,OAAAc,EAAAxF,EAAKkB,uBAAL,EAAAsE,EAAuBd,eAEZ,UAApB1E,EAAKC,YAA2B,CACnC2E,MAAO,OAAAa,EAAAzF,EAAKkB,uBAAL,EAAAuE,EAAuBb,MAC9BE,cAAexG,EAAoB,OAAAoH,EAAA1F,EAAKkB,2BAAkB4D,eAC1DE,WAAY,OAAAW,EAAA3F,EAAKkB,uBAAL,EAAAyE,EAAuBX,WACnCE,cAAc,OAAAU,EAAA5F,EAAKkB,uBAAL,EAAA0E,EAAuBR,gBAAiB,KAI1DxF,EAAeuB,QAAQL,KAAKgB,GAE1BlC,EAAeuB,QAAQkE,KAAMvD,GAAgC,WAAhBA,EAAOD,MAEpDjC,EAAewB,gBAAiB,EAEhCxB,EAAewB,gBAAiB,CAEpC,GAGN,CAEA,OAAOjC"}
@@ -1,46 +1,3 @@
1
- export type ItemType = {
2
- section_name: any;
3
- is_system_field: boolean;
4
- field_type: string;
5
- label: string;
6
- name?: string;
7
- placeholder: string;
8
- default_value: any;
9
- validation: any[];
10
- is_multiline: any;
11
- section_order: any;
12
- option?: any;
13
- time_format?: string;
14
- currency?: string;
15
- field_properties: {
16
- is_accordion?: boolean;
17
- float_step?: any;
18
- options: any;
19
- is_multiselect: any;
20
- title: string;
21
- title_position: "start" | "end";
22
- is_multiline: boolean;
23
- is_checked: boolean;
24
- table: string;
25
- table_columns: string[];
26
- table_rows?: any;
27
- is_multiple: boolean;
28
- enable_footer?: boolean;
29
- footer_action?: 'add';
30
- other_buttons?: React.ReactNode[];
31
- };
32
- is_section_field?: true;
33
- section_type?: "default" | "Form switcher section";
34
- form_switcher_label?: string;
35
- form_switcher_name?: string;
36
- switcher_forms?: {
37
- value?: string;
38
- name?: string;
39
- id?: number;
40
- }[];
41
- is_accordion?: boolean;
42
- };
43
1
  declare const formBuilderDeConversion: (formData: any) => any;
44
2
  export declare const convertTableColumns: (columns: string[]) => any[];
45
- export { formBuilderDeConversion };
46
3
  export default formBuilderDeConversion;
@@ -13,7 +13,7 @@ import { deFormatText } from "./deformat-text/index.esm.js";
13
13
  import { specificFilters, subModuleMappings } from "./export-filters/index.esm.js";
14
14
  import { fileSize } from "./fileSize/index.esm.js";
15
15
  import { formBuilderConversion } from "./form-builder-conversion/index.esm.js";
16
- import { convertTableColumns, formBuilderDeConversion } from "./form-builder-deconversion/index.esm.js";
16
+ import { convertTableColumns, default as default2 } from "./form-builder-deconversion/index.esm.js";
17
17
  import { convertToUnderscore, formatLabel, formatText } from "./format-text/index.esm.js";
18
18
  import "./i18n/index.esm.js";
19
19
  import { fetchLanguages } from "./language/index.esm.js";
@@ -23,7 +23,7 @@ import { createParameterizedNavigationHandler, migrateRoutesToUseParams, migrate
23
23
  import { getEntityId, navigateWithId } from "./navigation-utils/index.esm.js";
24
24
  import { convertRoutesToUseIdParams, generateRouteWithId, navigateToRouteWithId, updatePathnameWithIdParams } from "./route-utils/index.esm.js";
25
25
  import { loadModuleTranslations } from "./translations/index.esm.js";
26
- import { default as default2 } from "i18next";
26
+ import { default as default3 } from "i18next";
27
27
  import { setBaseUrl } from "../api-client/api.rbac/api/index.esm.js";
28
28
  import { setBaseUrl as setBaseUrl2 } from "../api-client/api.drive/api/index.esm.js";
29
29
  import { setBaseUrl as setBaseUrl3 } from "../api-client/api.system-feature/api/index.esm.js";
@@ -92,7 +92,7 @@ export {
92
92
  filterCoaByCompanyIdOrNull,
93
93
  findById,
94
94
  formBuilderConversion,
95
- formBuilderDeConversion,
95
+ default2 as formBuilderDeConversion,
96
96
  formatAmount,
97
97
  formatAmountWithCurrency,
98
98
  formatAmountWithCurrencyData,
@@ -149,7 +149,7 @@ export {
149
149
  handleCompareDateRangeSync,
150
150
  handleRegularUpload,
151
151
  hasValue,
152
- default2 as i18n,
152
+ default3 as i18n,
153
153
  initializeApiBaseUrls,
154
154
  initializeApiConfig,
155
155
  isApiConfigInitialized,
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./api/index.js"),t=require("./api-config/index.js"),r=require("./calculation/index.js"),a=require("./color/index.js"),o=require("./common-utility/index.js"),s=require("./common/index.js"),i=require("./constant/index.js"),n=require("./country/index.js"),p=require("./date-range/index.js"),l=require("./dateFormat/index.js"),d=require("./dateValidation/index.js"),x=require("./deformat-text/index.js"),m=require("./export-filters/index.js"),u=require("./fileSize/index.js"),c=require("./form-builder-conversion/index.js"),g=require("./form-builder-deconversion/index.js"),D=require("./format-text/index.js");require("./i18n/index.js");var f=require("./language/index.js"),T=require("./menu-filter/index.js"),I=require("./metaComponent/index.js"),y=require("./migration-utils/index.js"),A=require("./navigation-utils/index.js"),F=require("./route-utils/index.js"),E=require("./translations/index.js"),S=require("i18next"),C=require("../api-client/api.rbac/api/index.js"),h=require("../api-client/api.drive/api/index.js"),N=require("../api-client/api.system-feature/api/index.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var O=/* @__PURE__ */R(S);exports.apiConfigurations=e.apiConfigurations,exports.fetchApi=e.fetchApi,exports.getCurrency=e.getCurrency,exports.getItems=e.getItems,exports.getOptions=e.getOptions,exports.initializeApiBaseUrls=e.initializeApiBaseUrls,exports.getApiConfig=t.getApiConfig,exports.getApiConfigSafe=t.getApiConfigSafe,exports.initializeApiConfig=t.initializeApiConfig,exports.isApiConfigInitialized=t.isApiConfigInitialized,exports.onApiConfigReady=t.onApiConfigReady,exports.resetApiConfig=t.resetApiConfig,exports.calculateEntries=r.calculateEntries,exports.blue=a.blue,exports.error=a.error,exports.green=a.green,exports.lightGreen=a.lightGreen,exports.magenta=a.magenta,exports.neutral=a.neutral,exports.olive=a.olive,exports.primaryGreen=a.primaryGreen,exports.red=a.red,exports.getFileNamesFromUrls=o.getFileNamesFromUrls,exports.getFileNamesFromUrlsAsLink=o.getFileNamesFromUrlsAsLink,exports.renderEmptyRowsFallback=o.renderEmptyRowsFallback,exports.renderValueField=o.renderValueField,exports.transformTableColumns=o.transformTableColumns,exports.InvoiceStatus=s.InvoiceStatus,exports.addOrEditArray=s.addOrEditArray,exports.appendConditionSafely=s.appendConditionSafely,exports.calculateAmountData=s.calculateAmountData,exports.calculatePeriods=s.calculatePeriods,exports.checkDuplicateTracking=s.checkDuplicateTracking,exports.checkForDuplicate=s.checkForDuplicate,exports.checkSkuAndItemName=s.checkSkuAndItemName,exports.createdOnAndBy=s.createdOnAndBy,exports.defaultCompany=s.defaultCompany,exports.defaultCurrencyFormat=s.defaultCurrencyFormat,exports.defaultCurrencySymbol=s.defaultCurrencySymbol,exports.displayPhone=s.displayPhone,exports.downloadDoc=s.downloadDoc,exports.downloadFile=s.downloadFile,exports.fetchAssemblyItemData=s.fetchAssemblyItemData,exports.fetchCompanyLocations=s.fetchCompanyLocations,exports.fetchDataLocally=s.fetchDataLocally,exports.fetchExchageRate=s.fetchExchageRate,exports.fetchItems=s.fetchItems,exports.fetchOptions=s.fetchOptions,exports.fetchRentalResponseItems=s.fetchRentalResponseItems,exports.fetchRfqItemsByIdForResponse=s.fetchRfqItemsByIdForResponse,exports.filterAccessibleModules=s.filterAccessibleModules,exports.filterCoaByCompanyIdOrNull=s.filterCoaByCompanyIdOrNull,exports.findById=s.findById,exports.formatAmount=s.formatAmount,exports.formatAmountWithCurrency=s.formatAmountWithCurrency,exports.formatAmountWithCurrencyData=s.formatAmountWithCurrencyData,exports.formatDateForPayload=s.formatDateForPayload,exports.formatDateTimeForPayload=s.formatDateTimeForPayload,exports.formatEmptyDataToNull=s.formatEmptyDataToNull,exports.formatResponseDatesToDayJS=s.formatResponseDatesToDayJS,exports.formatResponseOnlyDatesToDayJS=s.formatResponseOnlyDatesToDayJS,exports.formatTimeForPayload=s.formatTimeForPayload,exports.generateAndFormatStringFromObj=s.generateAndFormatStringFromObj,exports.generateFields=s.generateFields,exports.generateQueryString=s.generateQueryString,exports.generateRandomId=s.generateRandomId,exports.getAccessibleModules=s.getAccessibleModules,exports.getCountryIdByName=s.getCountryIdByName,exports.getErrorMessage=s.getErrorMessage,exports.getExcelExportTemplate=s.getExcelExportTemplate,exports.getExcelTemplateGenerateTemplate=s.getExcelTemplateGenerateTemplate,exports.getFieldFilters=s.getFieldFilters,exports.getFileName=s.getFileName,exports.getLabelValuePairs=s.getLabelValuePairs,exports.getName=s.getName,exports.getNestedValue=s.getNestedValue,exports.getNextScheduleDate=s.getNextScheduleDate,exports.getOperatorLabel=s.getOperatorLabel,exports.getOptionsData=s.getOptionsData,exports.getPartyDependentData=s.getPartyDependentData,exports.getPartyName=s.getPartyName,exports.getSlicedValue=s.getSlicedValue,exports.getTaxAmountDataFromMultipleTaxCodes=s.getTaxAmountDataFromMultipleTaxCodes,exports.getTaxAmountFromMultipleTaxCodes=s.getTaxAmountFromMultipleTaxCodes,exports.getToken=s.getToken,exports.handleRegularUpload=s.handleRegularUpload,exports.hasValue=s.hasValue,exports.isBetweenTheDates=s.isBetweenTheDates,exports.isJSONString=s.isJSONString,exports.isJsonParse=s.isJsonParse,exports.manageItems=s.manageItems,exports.mapApiPayload=s.mapApiPayload,exports.mapAsyncApiPayload=s.mapAsyncApiPayload,exports.matchedMaterialCostingTypeLabel=s.matchedMaterialCostingTypeLabel,exports.omitDataKeys=s.omitDataKeys,exports.partyDuplicateCheck=s.partyDuplicateCheck,exports.partyEmailIds=s.partyEmailIds,exports.postImportSheet=s.postImportSheet,exports.remainingMaterialCostingTypes=s.remainingMaterialCostingTypes,exports.removeIdFromObject=s.removeIdFromObject,exports.removeIdStaticIdsFromMongoObject=s.removeIdStaticIdsFromMongoObject,exports.setRateBasedOnPriceRules=s.setRateBasedOnPriceRules,exports.showSnackBar=s.showSnackBar,exports.skuGenerator=s.skuGenerator,exports.toFixedWithNumbers=s.toFixedWithNumbers,exports.updateFieldsDisabledState=s.updateFieldsDisabledState,exports.uploadAttachments=s.uploadAttachments,exports.uploadFiles=s.uploadFiles,exports.validateDiscountValidity=s.validateDiscountValidity,exports.INVENTORY_ADD_MODE_DISABLED_FIELDS=i.INVENTORY_ADD_MODE_DISABLED_FIELDS,exports.INVENTORY_ALWAYS_DISABLED_FIELDS=i.INVENTORY_ALWAYS_DISABLED_FIELDS,exports.INVENTORY_EDIT_MODE_DISABLED_FIELDS=i.INVENTORY_EDIT_MODE_DISABLED_FIELDS,exports.INVENTORY_FIELDS_TO_BE_DISABLED=i.INVENTORY_FIELDS_TO_BE_DISABLED,exports.INVENTORY_MATERIAL_COSTING_TYPE_ARR=i.INVENTORY_MATERIAL_COSTING_TYPE_ARR,exports.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS=i.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS,exports.INVENTORY_VARIANT_DISABLED_FIELDS=i.INVENTORY_VARIANT_DISABLED_FIELDS,exports.SECTION_TYPES=i.SECTION_TYPES,exports.responseItemDetailsColumns=i.responseItemDetailsColumns,exports.getCountry=n.getCountry,exports.RANGE=p.RANGE,exports.handleCompareDateRange=p.handleCompareDateRange,exports.handleCompareDateRangeSync=p.handleCompareDateRangeSync,exports.UTCDateFormat=l.UTCDateFormat,exports.dateFormat=l.dateFormat,exports.formatDataTime=l.formatDataTime,exports.formatDate=l.formatDate,exports.formatOnlyTime=l.formatOnlyTime,exports.formatUtcDate=l.formatUtcDate,exports.getMinutesFromTime=l.getMinutesFromTime,exports.getTimeFromMinutes=l.getTimeFromMinutes,exports.COMMON_DATE_VALIDATIONS=d.COMMON_DATE_VALIDATIONS,exports.anyDateValidation=d.anyDateValidation,exports.businessDateValidation=d.businessDateValidation,exports.conditionalDateValidation=d.conditionalDateValidation,exports.createCustomMessages=d.createCustomMessages,exports.createDateValidation=d.createDateValidation,exports.dateRangeValidation=d.dateRangeValidation,exports.dateTimeValidation=d.dateTimeValidation,exports.dateValidation=d.dateValidation,exports.futureDateValidation=d.futureDateValidation,exports.pastDateValidation=d.pastDateValidation,exports.deFormatText=x.deFormatText,exports.specificFilters=m.specificFilters,exports.subModuleMappings=m.subModuleMappings,exports.fileSize=u.fileSize,exports.formBuilderConversion=c.formBuilderConversion,exports.convertTableColumns=g.convertTableColumns,exports.formBuilderDeConversion=g.formBuilderDeConversion,exports.convertToUnderscore=D.convertToUnderscore,exports.formatLabel=D.formatLabel,exports.formatText=D.formatText,exports.fetchLanguages=f.fetchLanguages,exports.MenuFilter=T.MenuFilter,exports.MenuFilterService=T.MenuFilterService,exports.ModuleAccessService=T.ModuleAccessService,exports.StorageUtils=T.StorageUtils,exports.MetaComponent=I.MetaComponent,exports.createParameterizedNavigationHandler=y.createParameterizedNavigationHandler,exports.migrateRoutesToUseParams=y.migrateRoutesToUseParams,exports.migrateToPathWithId=y.migrateToPathWithId,exports.updateTableConfigForParameterizedNavigation=y.updateTableConfigForParameterizedNavigation,exports.getEntityId=A.getEntityId,exports.navigateWithId=A.navigateWithId,exports.convertRoutesToUseIdParams=F.convertRoutesToUseIdParams,exports.generateRouteWithId=F.generateRouteWithId,exports.navigateToRouteWithId=F.navigateToRouteWithId,exports.updatePathnameWithIdParams=F.updatePathnameWithIdParams,exports.loadModuleTranslations=E.loadModuleTranslations,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return O.default}}),exports.setRoleURL=C.setBaseUrl,exports.setDriveURL=h.setBaseUrl,exports.setSystemFeatureURL=N.setBaseUrl;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./api/index.js"),t=require("./api-config/index.js"),r=require("./calculation/index.js"),a=require("./color/index.js"),o=require("./common-utility/index.js"),s=require("./common/index.js"),i=require("./constant/index.js"),n=require("./country/index.js"),p=require("./date-range/index.js"),l=require("./dateFormat/index.js"),d=require("./dateValidation/index.js"),x=require("./deformat-text/index.js"),m=require("./export-filters/index.js"),u=require("./fileSize/index.js"),c=require("./form-builder-conversion/index.js"),g=require("./form-builder-deconversion/index.js"),D=require("./format-text/index.js");require("./i18n/index.js");var f=require("./language/index.js"),T=require("./menu-filter/index.js"),I=require("./metaComponent/index.js"),y=require("./migration-utils/index.js"),A=require("./navigation-utils/index.js"),F=require("./route-utils/index.js"),E=require("./translations/index.js"),S=require("i18next"),C=require("../api-client/api.rbac/api/index.js"),h=require("../api-client/api.drive/api/index.js"),N=require("../api-client/api.system-feature/api/index.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var O=/* @__PURE__ */R(S);exports.apiConfigurations=e.apiConfigurations,exports.fetchApi=e.fetchApi,exports.getCurrency=e.getCurrency,exports.getItems=e.getItems,exports.getOptions=e.getOptions,exports.initializeApiBaseUrls=e.initializeApiBaseUrls,exports.getApiConfig=t.getApiConfig,exports.getApiConfigSafe=t.getApiConfigSafe,exports.initializeApiConfig=t.initializeApiConfig,exports.isApiConfigInitialized=t.isApiConfigInitialized,exports.onApiConfigReady=t.onApiConfigReady,exports.resetApiConfig=t.resetApiConfig,exports.calculateEntries=r.calculateEntries,exports.blue=a.blue,exports.error=a.error,exports.green=a.green,exports.lightGreen=a.lightGreen,exports.magenta=a.magenta,exports.neutral=a.neutral,exports.olive=a.olive,exports.primaryGreen=a.primaryGreen,exports.red=a.red,exports.getFileNamesFromUrls=o.getFileNamesFromUrls,exports.getFileNamesFromUrlsAsLink=o.getFileNamesFromUrlsAsLink,exports.renderEmptyRowsFallback=o.renderEmptyRowsFallback,exports.renderValueField=o.renderValueField,exports.transformTableColumns=o.transformTableColumns,exports.InvoiceStatus=s.InvoiceStatus,exports.addOrEditArray=s.addOrEditArray,exports.appendConditionSafely=s.appendConditionSafely,exports.calculateAmountData=s.calculateAmountData,exports.calculatePeriods=s.calculatePeriods,exports.checkDuplicateTracking=s.checkDuplicateTracking,exports.checkForDuplicate=s.checkForDuplicate,exports.checkSkuAndItemName=s.checkSkuAndItemName,exports.createdOnAndBy=s.createdOnAndBy,exports.defaultCompany=s.defaultCompany,exports.defaultCurrencyFormat=s.defaultCurrencyFormat,exports.defaultCurrencySymbol=s.defaultCurrencySymbol,exports.displayPhone=s.displayPhone,exports.downloadDoc=s.downloadDoc,exports.downloadFile=s.downloadFile,exports.fetchAssemblyItemData=s.fetchAssemblyItemData,exports.fetchCompanyLocations=s.fetchCompanyLocations,exports.fetchDataLocally=s.fetchDataLocally,exports.fetchExchageRate=s.fetchExchageRate,exports.fetchItems=s.fetchItems,exports.fetchOptions=s.fetchOptions,exports.fetchRentalResponseItems=s.fetchRentalResponseItems,exports.fetchRfqItemsByIdForResponse=s.fetchRfqItemsByIdForResponse,exports.filterAccessibleModules=s.filterAccessibleModules,exports.filterCoaByCompanyIdOrNull=s.filterCoaByCompanyIdOrNull,exports.findById=s.findById,exports.formatAmount=s.formatAmount,exports.formatAmountWithCurrency=s.formatAmountWithCurrency,exports.formatAmountWithCurrencyData=s.formatAmountWithCurrencyData,exports.formatDateForPayload=s.formatDateForPayload,exports.formatDateTimeForPayload=s.formatDateTimeForPayload,exports.formatEmptyDataToNull=s.formatEmptyDataToNull,exports.formatResponseDatesToDayJS=s.formatResponseDatesToDayJS,exports.formatResponseOnlyDatesToDayJS=s.formatResponseOnlyDatesToDayJS,exports.formatTimeForPayload=s.formatTimeForPayload,exports.generateAndFormatStringFromObj=s.generateAndFormatStringFromObj,exports.generateFields=s.generateFields,exports.generateQueryString=s.generateQueryString,exports.generateRandomId=s.generateRandomId,exports.getAccessibleModules=s.getAccessibleModules,exports.getCountryIdByName=s.getCountryIdByName,exports.getErrorMessage=s.getErrorMessage,exports.getExcelExportTemplate=s.getExcelExportTemplate,exports.getExcelTemplateGenerateTemplate=s.getExcelTemplateGenerateTemplate,exports.getFieldFilters=s.getFieldFilters,exports.getFileName=s.getFileName,exports.getLabelValuePairs=s.getLabelValuePairs,exports.getName=s.getName,exports.getNestedValue=s.getNestedValue,exports.getNextScheduleDate=s.getNextScheduleDate,exports.getOperatorLabel=s.getOperatorLabel,exports.getOptionsData=s.getOptionsData,exports.getPartyDependentData=s.getPartyDependentData,exports.getPartyName=s.getPartyName,exports.getSlicedValue=s.getSlicedValue,exports.getTaxAmountDataFromMultipleTaxCodes=s.getTaxAmountDataFromMultipleTaxCodes,exports.getTaxAmountFromMultipleTaxCodes=s.getTaxAmountFromMultipleTaxCodes,exports.getToken=s.getToken,exports.handleRegularUpload=s.handleRegularUpload,exports.hasValue=s.hasValue,exports.isBetweenTheDates=s.isBetweenTheDates,exports.isJSONString=s.isJSONString,exports.isJsonParse=s.isJsonParse,exports.manageItems=s.manageItems,exports.mapApiPayload=s.mapApiPayload,exports.mapAsyncApiPayload=s.mapAsyncApiPayload,exports.matchedMaterialCostingTypeLabel=s.matchedMaterialCostingTypeLabel,exports.omitDataKeys=s.omitDataKeys,exports.partyDuplicateCheck=s.partyDuplicateCheck,exports.partyEmailIds=s.partyEmailIds,exports.postImportSheet=s.postImportSheet,exports.remainingMaterialCostingTypes=s.remainingMaterialCostingTypes,exports.removeIdFromObject=s.removeIdFromObject,exports.removeIdStaticIdsFromMongoObject=s.removeIdStaticIdsFromMongoObject,exports.setRateBasedOnPriceRules=s.setRateBasedOnPriceRules,exports.showSnackBar=s.showSnackBar,exports.skuGenerator=s.skuGenerator,exports.toFixedWithNumbers=s.toFixedWithNumbers,exports.updateFieldsDisabledState=s.updateFieldsDisabledState,exports.uploadAttachments=s.uploadAttachments,exports.uploadFiles=s.uploadFiles,exports.validateDiscountValidity=s.validateDiscountValidity,exports.INVENTORY_ADD_MODE_DISABLED_FIELDS=i.INVENTORY_ADD_MODE_DISABLED_FIELDS,exports.INVENTORY_ALWAYS_DISABLED_FIELDS=i.INVENTORY_ALWAYS_DISABLED_FIELDS,exports.INVENTORY_EDIT_MODE_DISABLED_FIELDS=i.INVENTORY_EDIT_MODE_DISABLED_FIELDS,exports.INVENTORY_FIELDS_TO_BE_DISABLED=i.INVENTORY_FIELDS_TO_BE_DISABLED,exports.INVENTORY_MATERIAL_COSTING_TYPE_ARR=i.INVENTORY_MATERIAL_COSTING_TYPE_ARR,exports.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS=i.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS,exports.INVENTORY_VARIANT_DISABLED_FIELDS=i.INVENTORY_VARIANT_DISABLED_FIELDS,exports.SECTION_TYPES=i.SECTION_TYPES,exports.responseItemDetailsColumns=i.responseItemDetailsColumns,exports.getCountry=n.getCountry,exports.RANGE=p.RANGE,exports.handleCompareDateRange=p.handleCompareDateRange,exports.handleCompareDateRangeSync=p.handleCompareDateRangeSync,exports.UTCDateFormat=l.UTCDateFormat,exports.dateFormat=l.dateFormat,exports.formatDataTime=l.formatDataTime,exports.formatDate=l.formatDate,exports.formatOnlyTime=l.formatOnlyTime,exports.formatUtcDate=l.formatUtcDate,exports.getMinutesFromTime=l.getMinutesFromTime,exports.getTimeFromMinutes=l.getTimeFromMinutes,exports.COMMON_DATE_VALIDATIONS=d.COMMON_DATE_VALIDATIONS,exports.anyDateValidation=d.anyDateValidation,exports.businessDateValidation=d.businessDateValidation,exports.conditionalDateValidation=d.conditionalDateValidation,exports.createCustomMessages=d.createCustomMessages,exports.createDateValidation=d.createDateValidation,exports.dateRangeValidation=d.dateRangeValidation,exports.dateTimeValidation=d.dateTimeValidation,exports.dateValidation=d.dateValidation,exports.futureDateValidation=d.futureDateValidation,exports.pastDateValidation=d.pastDateValidation,exports.deFormatText=x.deFormatText,exports.specificFilters=m.specificFilters,exports.subModuleMappings=m.subModuleMappings,exports.fileSize=u.fileSize,exports.formBuilderConversion=c.formBuilderConversion,exports.convertTableColumns=g.convertTableColumns,exports.formBuilderDeConversion=g.default,exports.convertToUnderscore=D.convertToUnderscore,exports.formatLabel=D.formatLabel,exports.formatText=D.formatText,exports.fetchLanguages=f.fetchLanguages,exports.MenuFilter=T.MenuFilter,exports.MenuFilterService=T.MenuFilterService,exports.ModuleAccessService=T.ModuleAccessService,exports.StorageUtils=T.StorageUtils,exports.MetaComponent=I.MetaComponent,exports.createParameterizedNavigationHandler=y.createParameterizedNavigationHandler,exports.migrateRoutesToUseParams=y.migrateRoutesToUseParams,exports.migrateToPathWithId=y.migrateToPathWithId,exports.updateTableConfigForParameterizedNavigation=y.updateTableConfigForParameterizedNavigation,exports.getEntityId=A.getEntityId,exports.navigateWithId=A.navigateWithId,exports.convertRoutesToUseIdParams=F.convertRoutesToUseIdParams,exports.generateRouteWithId=F.generateRouteWithId,exports.navigateToRouteWithId=F.navigateToRouteWithId,exports.updatePathnameWithIdParams=F.updatePathnameWithIdParams,exports.loadModuleTranslations=E.loadModuleTranslations,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return O.default}}),exports.setRoleURL=C.setBaseUrl,exports.setDriveURL=h.setBaseUrl,exports.setSystemFeatureURL=N.setBaseUrl;
2
2
  //# sourceMappingURL=index.js.map
@@ -20,7 +20,7 @@ import { Radio } from "../../../components/radio/radio/index.esm.js";
20
20
  import { SECTION_TYPES } from "../../../utils/constant/index.esm.js";
21
21
  import { ErpLoader } from "../../../components/loaders/erp-loader/index.esm.js";
22
22
  import { getErrorMessage } from "../../../utils/common/index.esm.js";
23
- import { FormParser } from "../../../components/form-control/form-parser/form-parser/index.esm.js";
23
+ import FormParser from "../../../components/form-control/form-parser/form-parser/index.esm.js";
24
24
  import { patchFormDataById, getFormDataById, getFieldsByFormId } from "../redux/actionCreator/index.esm.js";
25
25
  import { element } from "../field_properties/index.esm.js";
26
26
  import { TextEditForm } from "../element-edit-forms/text/index.esm.js";
@@ -1,30 +1,30 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-router-dom"),i=require("react-hook-form"),o=require("react-dnd"),n=require("react-dnd-html5-backend"),s=require("react-i18next"),l=,/* empty css */a=,/* empty css */d=,/* empty css */c=,/* empty css */u=,/* empty css */m=,/* empty css */f=,/* empty css */h=,/* empty css */p=,/* empty css */b=,/* empty css */v=,/* empty css */y=,/* empty css */_=,/* empty css */x=,/* empty css */g=,/* empty css */S=,/* empty css */j=,/* empty css */N=,/* empty css */k=,/* empty css */C=,/* empty css */q=,/* empty css */E=,/* empty css */w=,/* empty css */O=,/* empty css */F=;/* empty css */;/* empty css */var B=,/* empty css */J=,/* empty css */A=,/* empty css */M=,/* empty css */T=,/* empty css */I=,/* empty css */P=;/* empty css */const D=e=>!isNaN(Number(e))&&isFinite(Number(e)),G=e=>JSON.parse(JSON.stringify(e)),L=(e="")=>({uniqueStringId:`${Date.now()}${e}${Math.random().toString(36).substr(2,9)}`});function U(){const{t:U}=s.useTranslation(),V=p.useAppDispatch(),$=r.useNavigate(),R=r.useLocation(),H=R.state??[],W=p.useAppSelector(e=>e.formBuilder),{control:z}=i.useForm({reValidateMode:"onBlur"}),{fields:Y,append:K,remove:Q,update:X,move:Z,insert:ee}=i.useFieldArray({control:z,name:"members"}),{fields:te,append:re,remove:ie,update:oe}=i.useFieldArray({control:z,name:"section"}),[ne,se]=t.useState(""),[le,ae]=t.useState(),[de,ce]=t.useState(),[ue,me]=t.useState([]),[fe,he]=t.useState(null),[pe,be]=t.useState(),[ve,ye]=t.useState([]),[_e,xe]=t.useState({}),[ge,Se]=t.useState(),[je,Ne]=t.useState(!1),[ke,Ce]=t.useState(!1),[qe,Ee]=t.useState(),[we,Oe]=t.useState(!0),[Fe,Be]=t.useState([]),[Je,Ae]=t.useState(0),[Me,Te]=t.useState(!1),[Ie,Pe]=t.useState(!1),[De,Ge]=t.useState(null),[Le,Ue]=t.useState(null),[Ve,$e]=t.useState(),Re=R.pathname.split("/")[2],He=F.generateModulePath(Re);F.useFormDataEffect(W,Fe,Je,{removeSection:ie,remove:Q,setTabsData:Be,append:K,appendSection:re});const We=t.useCallback(r=>{try{if(!r||"string"!=typeof r)/* @__PURE__ */
2
- return e.jsx("div",{className:"text-gray-500 p-4",children:"Select a field to edit"});const i=r.toLowerCase().trim(),o={text:["text","number","email","phone","date","time","url","currency","file","geolocation","image","relation","info","tagsinput"],select:["select"],section:["section"],checkbox:["checkbox","togglebutton","radiobutton"],table:["table"]},n={element:fe,handlePropertyValueUpdate:ot,handleWidthChange:rt,handleColumnSelect:it,fields:(null==W?void 0:W.fields)||[]},s={element:fe,handlePropertyValueUpdate:ot,handleSelectOptionValueUpdate:nt,handleWidthChange:rt,handleColumnSelect:it};return o.text.includes(i)?/* @__PURE__ */t.createElement(k.TextEditForm,{...n,key:`text-form-${(null==fe?void 0:fe.id)||"default"}`}):o.select.includes(i)?/* @__PURE__ */t.createElement(C.SelectEditForm,{...s,key:`select-form-${(null==fe?void 0:fe.id)||"default"}`}):o.section.includes(i)?/* @__PURE__ */e.jsx(q.SectionEditForm,{element:_e,handlePropertyValueUpdate:tt},`section-form-${(null==_e?void 0:_e.id)||"default"}`):o.checkbox.includes(i)?/* @__PURE__ */t.createElement(E.CheckboxEditForm,{...s,key:`checkbox-form-${(null==fe?void 0:fe.id)||"default"}`}):o.table.includes(i)?/* @__PURE__ */e.jsx(w.default,{element:fe,handlePropertyValueUpdate:ot,handleColumnsUpdate:st,fields:(null==W?void 0:W.fields)||[]},`table-form-${(null==fe?void 0:fe.id)||"default"}`):/* @__PURE__ */e.jsxs("div",{className:"text-gray-500 p-4 border border-gray-200 rounded",children:[
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-router-dom"),i=require("react-hook-form"),n=require("react-dnd"),o=require("react-dnd-html5-backend"),s=require("react-i18next"),l=,/* empty css */a=,/* empty css */d=,/* empty css */c=,/* empty css */u=,/* empty css */m=,/* empty css */f=,/* empty css */h=,/* empty css */p=,/* empty css */b=,/* empty css */v=,/* empty css */y=,/* empty css */_=,/* empty css */x=,/* empty css */g=,/* empty css */S=,/* empty css */j=,/* empty css */N=,/* empty css */k=,/* empty css */C=,/* empty css */q=,/* empty css */E=,/* empty css */w=,/* empty css */O=,/* empty css */B=;/* empty css */;/* empty css */var F=,/* empty css */J=,/* empty css */A=,/* empty css */M=,/* empty css */T=,/* empty css */I=,/* empty css */D=;/* empty css */const P=e=>!isNaN(Number(e))&&isFinite(Number(e)),G=e=>JSON.parse(JSON.stringify(e)),L=(e="")=>({uniqueStringId:`${Date.now()}${e}${Math.random().toString(36).substr(2,9)}`});function U(){const{t:U}=s.useTranslation(),V=p.useAppDispatch(),$=r.useNavigate(),R=r.useLocation(),H=R.state??[],W=p.useAppSelector(e=>e.formBuilder),{control:z}=i.useForm({reValidateMode:"onBlur"}),{fields:Y,append:K,remove:Q,update:X,move:Z,insert:ee}=i.useFieldArray({control:z,name:"members"}),{fields:te,append:re,remove:ie,update:ne}=i.useFieldArray({control:z,name:"section"}),[oe,se]=t.useState(""),[le,ae]=t.useState(),[de,ce]=t.useState(),[ue,me]=t.useState([]),[fe,he]=t.useState(null),[pe,be]=t.useState(),[ve,ye]=t.useState([]),[_e,xe]=t.useState({}),[ge,Se]=t.useState(),[je,Ne]=t.useState(!1),[ke,Ce]=t.useState(!1),[qe,Ee]=t.useState(),[we,Oe]=t.useState(!0),[Be,Fe]=t.useState([]),[Je,Ae]=t.useState(0),[Me,Te]=t.useState(!1),[Ie,De]=t.useState(!1),[Pe,Ge]=t.useState(null),[Le,Ue]=t.useState(null),[Ve,$e]=t.useState(),Re=R.pathname.split("/")[2],He=B.generateModulePath(Re);B.useFormDataEffect(W,Be,Je,{removeSection:ie,remove:Q,setTabsData:Fe,append:K,appendSection:re});const We=t.useCallback(r=>{try{if(!r||"string"!=typeof r)/* @__PURE__ */
2
+ return e.jsx("div",{className:"text-gray-500 p-4",children:"Select a field to edit"});const i=r.toLowerCase().trim(),n={text:["text","number","email","phone","date","time","url","currency","file","geolocation","image","relation","info","tagsinput"],select:["select"],section:["section"],checkbox:["checkbox","togglebutton","radiobutton"],table:["table"]},o={element:fe,handlePropertyValueUpdate:nt,handleWidthChange:rt,handleColumnSelect:it,fields:(null==W?void 0:W.fields)||[]},s={element:fe,handlePropertyValueUpdate:nt,handleSelectOptionValueUpdate:ot,handleWidthChange:rt,handleColumnSelect:it};return n.text.includes(i)?/* @__PURE__ */t.createElement(k.TextEditForm,{...o,key:`text-form-${(null==fe?void 0:fe.id)||"default"}`}):n.select.includes(i)?/* @__PURE__ */t.createElement(C.SelectEditForm,{...s,key:`select-form-${(null==fe?void 0:fe.id)||"default"}`}):n.section.includes(i)?/* @__PURE__ */e.jsx(q.SectionEditForm,{element:_e,handlePropertyValueUpdate:tt},`section-form-${(null==_e?void 0:_e.id)||"default"}`):n.checkbox.includes(i)?/* @__PURE__ */t.createElement(E.CheckboxEditForm,{...s,key:`checkbox-form-${(null==fe?void 0:fe.id)||"default"}`}):n.table.includes(i)?/* @__PURE__ */e.jsx(w.default,{element:fe,handlePropertyValueUpdate:nt,handleColumnsUpdate:st,fields:(null==W?void 0:W.fields)||[]},`table-form-${(null==fe?void 0:fe.id)||"default"}`):/* @__PURE__ */e.jsxs("div",{className:"text-gray-500 p-4 border border-gray-200 rounded",children:[
3
3
  /* @__PURE__ */e.jsx("p",{className:"font-medium",children:"Unknown Field Type"}),
4
4
  /* @__PURE__ */e.jsxs("p",{className:"text-sm mt-1",children:['Field type "',r,'" is not supported. Please select a valid field to edit.']})]})}catch(i){/* @__PURE__ */
5
5
  return e.jsxs("div",{className:"text-red-500 p-4 border border-red-200 rounded bg-red-50",children:[
6
6
  /* @__PURE__ */e.jsx("p",{className:"font-medium",children:"Error Loading Form"}),
7
- /* @__PURE__ */e.jsx("p",{className:"text-sm mt-1",children:"There was an error loading the property edit form. Please try again."})]})}},[fe,_e,W]),ze=t.useCallback(()=>{var e;try{if(!(null==(e=N.element)?void 0:e.section))return;const{uniqueStringId:t}=L("-"),r={...G(N.element.section),id:t};r.switcher_forms&&(r.switcher_forms=r.switcher_forms.map(e=>({...e,id:L("-").uniqueStringId})));const i=te.length;re(r),ae(i),se("section");const o={field_type:r.field_type,section_type:r.section_type,switcher_forms:r.switcher_forms,form_switcher_label:r.form_switcher_label,form_switcher_name:r.form_switcher_name,label:r.label,is_accordion:r.is_accordion,id:r.id??i};xe(o),Se(i),We(r.field_type)}catch(t){}},[N.element,te,re,ae,se,xe,Se,We]),Ye=t.useCallback(()=>{try{const e=G(ve);e.forEach((e,t)=>{e.members=Y.filter(e=>(null==e?void 0:e.section_order)===t)});const t=e.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),r=!(null==Fe?void 0:Fe.length)&&t,i={tab_order:Fe.length+1,title:"data",remove_tab:r,data:(null==Fe?void 0:Fe.length)?[]:e};Be(e=>[...e,i])}catch(e){}},[ve,Y,Fe,Be]),Ke=t.useCallback((e,t)=>{try{if(!D(e)||!(null==t?void 0:t.trim()))return;Be(r=>r.map(r=>r.tab_order===e?{...r,title:t.trim()}:r))}catch(r){}},[Be]),Qe=t.useCallback(e=>{try{if(!D(e))return;const t=Fe.filter(t=>t.tab_order!==e).map(t=>({...t,tab_order:t.tab_order>e?t.tab_order-1:t.tab_order}));if(Be(t),Je==e&&Ae((null==t?void 0:t.length)-1),t.length>0){const e=t.find(e=>e.tab_order===(Je??0)+1);if(null==e?void 0:e.data){const t=e.data.map(({field_type:e,label:t,is_accordion:r,id:i,remove_section:o})=>({field_type:e,label:t,is_accordion:r,id:i,remove_section:o})),r=e.data.flatMap(e=>{var t;return(null==(t=e.members)?void 0:t.map(e=>({...e})))||[]});Q(),ie(),r.forEach(e=>K(e)),t.forEach(e=>re(e))}}else Q(),ie()}catch(t){}},[Fe,Je,Be,Q,ie,K,re]),Xe=t.useCallback(e=>{try{const t=e.target.dataset.position;if(!t||!D(t))return;const r=Number(t);if(r<0||r>=ue.length)return;ce(r);const i=G(ue[r]);be(r),he(i),se("element")}catch(t){}},[ue,ce,be,he,se]),Ze=t.useCallback(e=>{try{const t=e.target.dataset.position;if(!t||!D(t))return;const r=Number(t);if(r<0||r>=ve.length)return;ae(r);const i=G(ve[r]);Se(r),xe(i),se("section")}catch(t){}},[ve,ae,Se,xe,se]),et=t.useCallback((e,t)=>{var r,i;try{const o=e.currentTarget,n=null==(r=null==o?void 0:o.dataset)?void 0:r.position;if(void 0===n||!D(n))return;const s=Number(n);if(s<0)return;if(!(null==(i=N.element)?void 0:i.text))return;const l={...G(N.element.text),...t,section_order:s,type:"custom",is_new:!0,custom_width:Math.floor(6),is_fullwidth:!1,is_system_field:Boolean(null==t?void 0:t.is_system_field),id:L().uniqueStringId};ae(s),K(l);const a=Y.length;ce(a),se("element"),be(a),he(l),We(l.field_type)}catch(o){}},[N.element,Y,ae,K,ce,se,be,he,We]),tt=t.useCallback((e,t)=>{try{const{name:r,type:i,checked:o,value:n}=e.target;if(!r)return;const s=void 0!==t?t:"checkbox"===i?o:n;_e[r]!==s&&xe(e=>({...e,[r]:s}))}catch(r){}},[_e,xe]),rt=t.useCallback(e=>{try{if(!D(e)||e<1||e>12)return;he(t=>({...t,custom_width:e}))}catch(t){}},[he]),it=t.useCallback(e=>{try{const t=Number(e.target.value);if(!D(t)||t<=0)return;const r=Math.floor(12/t);if(r<=0)return;Y.forEach((e,t)=>{X(t,{...e,custom_width:r})})}catch(t){}},[Y,X]),ot=t.useCallback((e,t,r,i)=>{var o;try{const n=(()=>{var o;return i||(void 0!==r?r:void 0!==t?t:null==(o=null==e?void 0:e.target)?void 0:o.value)})(),s=G(fe);if((null==(o=null==e?void 0:e.target)?void 0:o.name)&&(s[e.target.name]="checkbox"===e.target.type?e.target.checked:n),i){const{uniqueStringId:e}=L(),t={...N.element[i],section_form_id:null==s?void 0:s.section_form_id,is_form_switcher_section:null==s?void 0:s.is_form_switcher_section,section_order:s.section_order,id:e,type:"custom",is_system_field:Boolean(null==s?void 0:s.is_system_field),is_new:!0,column_width:(null==s?void 0:s.column_width)||6,custom_width:(null==s?void 0:s.custom_width)||6};he(t)}else JSON.stringify(fe)!==JSON.stringify(s)&&he({...fe,...s})}catch(n){}},[fe,N.element,he]),nt=t.useCallback(e=>{try{if(!Array.isArray(e))return;const t=G(fe);t.options=[...e];const{uniqueStringId:r}=L("-");JSON.stringify(fe.options)!==JSON.stringify(e)&&he({...fe,...t,id:r})}catch(t){}},[fe,he]),st=t.useCallback(e=>{try{if(!Array.isArray(e))return;const t=G(fe);t.table_columns=[...e];const{uniqueStringId:r}=L("-");JSON.stringify(fe.table_columns)!==JSON.stringify(e)&&he({...fe,...t,id:r})}catch(t){}},[fe,he]),lt=t.useCallback(e=>{try{if(!D(e)||e<0||e>=te.length)return;Ee(e),ie(e);const t=[];Y.forEach((r,i)=>{(null==r?void 0:r.section_order)===e&&t.push(i)}),t.reverse().forEach(e=>{Q(e)}),Ne(!0)}catch(t){}},[te,Y,Ee,ie,Q,Ne]),at=t.useCallback(e=>{try{if(!D(e)||e<0||e>=te.length)return;Pe(!0),Se(e),ae(e);const t={...G(te[e]),is_accordion:!0};oe(e,t),se("section"),xe(t),We(t.field_type)}catch(t){}},[te,Pe,Se,ae,oe,se,xe,We]),dt=t.useCallback(()=>{try{const e=G(ve);e.forEach((e,t)=>{e.members=Y.filter(e=>(null==e?void 0:e.section_order)===t)});const t=e.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),r=Number(Je);if(D(r)&&r>=0&&r<Fe.length){const i=[...Fe];i[r]={...i[r],data:e,remove_tab:t},Be(i),Q(),ie(),ce(void 0),se(""),ae(void 0)}}catch(e){}},[ve,Y,Je,Fe,Be]),ct=t.useMemo(()=>ve&&Y?ve.map((e,t)=>({...e,members:Y.filter(e=>(null==e?void 0:e.section_order)===t)})):null,[ve,Y]),ut=t.useMemo(()=>ct?(null==Fe?void 0:Fe.length)?{tab:Fe}:{section:ct}:null,[Fe,ct]),mt=t.useMemo(()=>ut?h.formBuilderConversion(ut):null,[ut]),ft=t.useCallback(()=>{mt&&Ue(mt)},[mt,Ue]),ht=t.useCallback(()=>{Ue(null)},[]),pt=t.useCallback(async()=>{var e;try{if(!ve||!Array.isArray(ve))return;if(!Y||!Array.isArray(Y))return;if(!(null==H?void 0:H._id))return;let i;try{i=structuredClone(ve)}catch(t){i=JSON.parse(JSON.stringify(ve))}i.forEach((e,t)=>{e&&"object"==typeof e&&(e.members=Y.filter(e=>e&&"object"==typeof e&&"number"==typeof e.section_order&&e.section_order===t))});const o=i.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),n=Number(Je);let s=[...Fe];D(n)&&n>=0&&n<Fe.length&&(s=[...Fe],s[n]={...s[n],data:i,remove_tab:o},Be(s));const a=(null==s?void 0:s.length)>0?{tab:s}:{section:i};if("function"!=typeof h.formBuilderConversion)return;let d;try{d=h.formBuilderConversion(a)}catch(r){return}if(!d)return;const c={gridCol:2,fields:d},u=await V(j.patchFormDataById({id:H._id,data:c}));if("rejected"===u.meta.requestStatus){const t=g.getErrorMessage(null==(e=null==u?void 0:u.error)?void 0:e.message);l.enqueueSnackbar(t,{variant:"error"})}else l.enqueueSnackbar("Form updated successfully",{variant:"success"}),$(He)}catch(i){const e=(null==i?void 0:i.message)||"Something went wrong while updating the form";l.enqueueSnackbar(e,{variant:"error"})}},[ve,Y,Fe,null==H?void 0:H._id,void 0,V,h.formBuilderConversion]),bt=e=>{const t={...Y[e],type:"custom"};t&&ee(e+1,t),ce(e+1),se("element"),be(e+1),he(t),We(t.field_type)},vt=[{link:He,label:"Forms"},{link:"",label:b.formatLabel(null==H?void 0:H.name)},{link:"",label:"Edit Form"}];t.useEffect(()=>{je&&(Y.forEach((e,t)=>{void 0!==qe&&Boolean(null==qe?void 0:qe.toString)&&e.section_order>qe&&X(t,{...e,section_order:e.section_order-1})}),Ne(!1),Ce(!0),Ee(void 0),se(""))},[je]),t.useEffect(()=>{W.isSuccess&&$(He)},[W.isSuccess]),t.useEffect(()=>{W.isError&&Ge({type:"alert",message:W.error})},[W.error,W.isError]),t.useEffect(()=>{if("number"!=typeof pe||"string"!=typeof pe){const e=Number(pe);if(ue[e]){const t=JSON.parse(JSON.stringify(ue[e]));X(e,{...t})}}},[ue]),t.useEffect(()=>{const e=ue.map((e,t)=>t===Number(pe)?{...fe}:{...e});me(e)},[fe]),t.useEffect(()=>{if(Y.length!==ue.length&&me(JSON.parse(JSON.stringify(Y))),Boolean(Me)&&JSON.stringify(Y)!==JSON.stringify(ue)){me(JSON.parse(JSON.stringify(Y))),Te(!1);const e=pe&&Y[pe];e&&se("element"),e&&he(e),e&&We(e.field_type)}ke&&JSON.stringify(Y)!==JSON.stringify(ue)&&(me(JSON.parse(JSON.stringify(Y))),Ce(!1))},[Y,Me]),t.useEffect(()=>{if("number"!=typeof ge||"string"!=typeof ge){const e=Number(ge);if(ve[e]){const t=JSON.parse(JSON.stringify(ve[e]));oe(e,{...t})}}},[ve]),t.useEffect(()=>{const e=ve.map((e,t)=>t===Number(ge)?{...e,..._e}:{...e});ye(e)},[_e]),t.useEffect(()=>{te.length!==ve.length&&ye(JSON.parse(JSON.stringify(te))),JSON.stringify(ve)!==JSON.stringify(te)&&Ie&&(ye(JSON.parse(JSON.stringify(te))),Pe(!1))},[te]),t.useEffect(()=>{},[]);const yt=t.useCallback(async()=>{Oe(!0);try{(null==H?void 0:H._id)&&(Be([]),await V(j.getFormDataById(null==H?void 0:H._id)),await V(j.getFieldsByFormId({id:null==H?void 0:H._id})))}finally{Oe(!1)}},[null==H?void 0:H._id]);t.useEffect(()=>{yt()},[yt]);const _t=e=>e&&Object.keys(e).length>0,xt=()=>/* @__PURE__ */e.jsx(f.Typography,{type:"s5",color:"theme.secondary.800",className:"formSection--Text",children:"Select a field to edit its properties."}),gt=(e,t="text")=>(null==e?void 0:e.field_type)||t,St=t.useMemo(()=>{if(!ne)/* @__PURE__ */
8
- return e.jsx(xt,{});if("element"===ne){if(!_t(Y))/* @__PURE__ */
9
- return e.jsx(xt,{});const t=gt(fe);return We(t)}if("section"===ne){if(!_t(te))/* @__PURE__ */
7
+ /* @__PURE__ */e.jsx("p",{className:"text-sm mt-1",children:"There was an error loading the property edit form. Please try again."})]})}},[fe,_e,W]),ze=t.useCallback(()=>{var e;try{if(!(null==(e=N.element)?void 0:e.section))return;const{uniqueStringId:t}=L("-"),r={...G(N.element.section),id:t};r.switcher_forms&&(r.switcher_forms=r.switcher_forms.map(e=>({...e,id:L("-").uniqueStringId})));const i=te.length;re(r),ae(i),se("section");const n={field_type:r.field_type,section_type:r.section_type,switcher_forms:r.switcher_forms,form_switcher_label:r.form_switcher_label,form_switcher_name:r.form_switcher_name,label:r.label,is_accordion:r.is_accordion,id:r.id??i};xe(n),Se(i),We(r.field_type)}catch(t){}},[N.element,te,re,ae,se,xe,Se,We]),Ye=t.useCallback(()=>{try{const e=G(ve);e.forEach((e,t)=>{e.members=Y.filter(e=>(null==e?void 0:e.section_order)===t)});const t=e.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),r=!(null==Be?void 0:Be.length)&&t,i={tab_order:Be.length+1,title:"data",remove_tab:r,data:(null==Be?void 0:Be.length)?[]:e};Fe(e=>[...e,i])}catch(e){}},[ve,Y,Be,Fe]),Ke=t.useCallback((e,t)=>{try{if(!P(e)||!(null==t?void 0:t.trim()))return;Fe(r=>r.map(r=>r.tab_order===e?{...r,title:t.trim()}:r))}catch(r){}},[Fe]),Qe=t.useCallback(e=>{try{if(!P(e))return;const t=Be.filter(t=>t.tab_order!==e).map(t=>({...t,tab_order:t.tab_order>e?t.tab_order-1:t.tab_order}));if(Fe(t),Je==e&&Ae((null==t?void 0:t.length)-1),t.length>0){const e=t.find(e=>e.tab_order===(Je??0)+1);if(null==e?void 0:e.data){const t=e.data.map(({field_type:e,label:t,is_accordion:r,id:i,remove_section:n})=>({field_type:e,label:t,is_accordion:r,id:i,remove_section:n})),r=e.data.flatMap(e=>{var t;return(null==(t=e.members)?void 0:t.map(e=>({...e})))||[]});Q(),ie(),r.forEach(e=>K(e)),t.forEach(e=>re(e))}}else Q(),ie()}catch(t){}},[Be,Je,Fe,Q,ie,K,re]),Xe=t.useCallback(e=>{try{const t=e.target.dataset.position;if(!t||!P(t))return;const r=Number(t);if(r<0||r>=ue.length)return;ce(r);const i=G(ue[r]);be(r),he(i),se("element")}catch(t){}},[ue,ce,be,he,se]),Ze=t.useCallback(e=>{try{const t=e.target.dataset.position;if(!t||!P(t))return;const r=Number(t);if(r<0||r>=ve.length)return;ae(r);const i=G(ve[r]);Se(r),xe(i),se("section")}catch(t){}},[ve,ae,Se,xe,se]),et=t.useCallback((e,t)=>{var r,i;try{const n=e.currentTarget,o=null==(r=null==n?void 0:n.dataset)?void 0:r.position;if(void 0===o||!P(o))return;const s=Number(o);if(s<0)return;if(!(null==(i=N.element)?void 0:i.text))return;const l={...G(N.element.text),...t,section_order:s,type:"custom",is_new:!0,custom_width:Math.floor(6),is_fullwidth:!1,is_system_field:Boolean(null==t?void 0:t.is_system_field),id:L().uniqueStringId};ae(s),K(l);const a=Y.length;ce(a),se("element"),be(a),he(l),We(l.field_type)}catch(n){}},[N.element,Y,ae,K,ce,se,be,he,We]),tt=t.useCallback((e,t)=>{try{const{name:r,type:i,checked:n,value:o}=e.target;if(!r)return;const s=void 0!==t?t:"checkbox"===i?n:o;_e[r]!==s&&xe(e=>({...e,[r]:s}))}catch(r){}},[_e,xe]),rt=t.useCallback(e=>{try{if(!P(e)||e<1||e>12)return;he(t=>({...t,custom_width:e}))}catch(t){}},[he]),it=t.useCallback(e=>{try{const t=Number(e.target.value);if(!P(t)||t<=0)return;const r=Math.floor(12/t);if(r<=0)return;Y.forEach((e,t)=>{X(t,{...e,custom_width:r})})}catch(t){}},[Y,X]),nt=t.useCallback((e,t,r,i)=>{var n;try{const o=(()=>{var n;return i||(void 0!==r?r:void 0!==t?t:null==(n=null==e?void 0:e.target)?void 0:n.value)})(),s=G(fe);if((null==(n=null==e?void 0:e.target)?void 0:n.name)&&(s[e.target.name]="checkbox"===e.target.type?e.target.checked:o),i){const{uniqueStringId:e}=L(),t={...N.element[i],section_form_id:null==s?void 0:s.section_form_id,is_form_switcher_section:null==s?void 0:s.is_form_switcher_section,section_order:s.section_order,id:e,type:"custom",is_system_field:Boolean(null==s?void 0:s.is_system_field),is_new:!0,column_width:(null==s?void 0:s.column_width)||6,custom_width:(null==s?void 0:s.custom_width)||6};he(t)}else JSON.stringify(fe)!==JSON.stringify(s)&&he({...fe,...s})}catch(o){}},[fe,N.element,he]),ot=t.useCallback(e=>{try{if(!Array.isArray(e))return;const t=G(fe);t.options=[...e];const{uniqueStringId:r}=L("-");JSON.stringify(fe.options)!==JSON.stringify(e)&&he({...fe,...t,id:r})}catch(t){}},[fe,he]),st=t.useCallback(e=>{try{if(!Array.isArray(e))return;const t=G(fe);t.table_columns=[...e];const{uniqueStringId:r}=L("-");JSON.stringify(fe.table_columns)!==JSON.stringify(e)&&he({...fe,...t,id:r})}catch(t){}},[fe,he]),lt=t.useCallback(e=>{try{if(!P(e)||e<0||e>=te.length)return;Ee(e),ie(e);const t=[];Y.forEach((r,i)=>{(null==r?void 0:r.section_order)===e&&t.push(i)}),t.reverse().forEach(e=>{Q(e)}),Ne(!0)}catch(t){}},[te,Y,Ee,ie,Q,Ne]),at=t.useCallback(e=>{try{if(!P(e)||e<0||e>=te.length)return;De(!0),Se(e),ae(e);const t={...G(te[e]),is_accordion:!0};ne(e,t),se("section"),xe(t),We(t.field_type)}catch(t){}},[te,De,Se,ae,ne,se,xe,We]),dt=t.useCallback(()=>{try{const e=G(ve);e.forEach((e,t)=>{e.members=Y.filter(e=>(null==e?void 0:e.section_order)===t)});const t=e.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),r=Number(Je);if(P(r)&&r>=0&&r<Be.length){const i=[...Be];i[r]={...i[r],data:e,remove_tab:t},Fe(i),Q(),ie(),ce(void 0),se(""),ae(void 0)}}catch(e){}},[ve,Y,Je,Be,Fe]),ct=t.useMemo(()=>ve&&Y?ve.map((e,t)=>({...e,members:Y.filter(e=>(null==e?void 0:e.section_order)===t)})):null,[ve,Y]),ut=t.useMemo(()=>ct?(null==Be?void 0:Be.length)?{tab:Be}:{section:ct}:null,[Be,ct]),mt=t.useMemo(()=>ut?h.formBuilderConversion(ut):null,[ut]),ft=t.useCallback(()=>{mt&&Ue(mt)},[mt,Ue]),ht=t.useCallback(()=>{Ue(null)},[]),pt=t.useCallback(async()=>{var e;try{if(!ve||!Array.isArray(ve))return;if(!Y||!Array.isArray(Y))return;if(!(null==H?void 0:H._id))return;let i;try{i=structuredClone(ve)}catch(t){i=JSON.parse(JSON.stringify(ve))}i.forEach((e,t)=>{e&&"object"==typeof e&&(e.members=Y.filter(e=>e&&"object"==typeof e&&"number"==typeof e.section_order&&e.section_order===t))});const n=i.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),o=Number(Je);let s=[...Be];P(o)&&o>=0&&o<Be.length&&(s=[...Be],s[o]={...s[o],data:i,remove_tab:n},Fe(s));const a=(null==s?void 0:s.length)>0?{tab:s}:{section:i};if("function"!=typeof h.formBuilderConversion)return;let d;try{d=h.formBuilderConversion(a)}catch(r){return}if(!d)return;const c={gridCol:2,fields:d},u=await V(j.patchFormDataById({id:H._id,data:c}));if("rejected"===u.meta.requestStatus){const t=g.getErrorMessage(null==(e=null==u?void 0:u.error)?void 0:e.message);l.enqueueSnackbar(t,{variant:"error"})}else l.enqueueSnackbar("Form updated successfully",{variant:"success"}),$(He)}catch(i){const e=(null==i?void 0:i.message)||"Something went wrong while updating the form";l.enqueueSnackbar(e,{variant:"error"})}},[ve,Y,Be,null==H?void 0:H._id,void 0,V,h.formBuilderConversion]),bt=e=>{const t={...Y[e],type:"custom"};t&&ee(e+1,t),ce(e+1),se("element"),be(e+1),he(t),We(t.field_type)},vt=[{link:He,label:"Forms"},{link:"",label:b.formatLabel(null==H?void 0:H.name)},{link:"",label:"Edit Form"}];t.useEffect(()=>{je&&(Y.forEach((e,t)=>{void 0!==qe&&Boolean(null==qe?void 0:qe.toString)&&e.section_order>qe&&X(t,{...e,section_order:e.section_order-1})}),Ne(!1),Ce(!0),Ee(void 0),se(""))},[je]),t.useEffect(()=>{W.isSuccess&&$(He)},[W.isSuccess]),t.useEffect(()=>{W.isError&&Ge({type:"alert",message:W.error})},[W.error,W.isError]),t.useEffect(()=>{if("number"!=typeof pe||"string"!=typeof pe){const e=Number(pe);if(ue[e]){const t=JSON.parse(JSON.stringify(ue[e]));X(e,{...t})}}},[ue]),t.useEffect(()=>{const e=ue.map((e,t)=>t===Number(pe)?{...fe}:{...e});me(e)},[fe]),t.useEffect(()=>{if(Y.length!==ue.length&&me(JSON.parse(JSON.stringify(Y))),Boolean(Me)&&JSON.stringify(Y)!==JSON.stringify(ue)){me(JSON.parse(JSON.stringify(Y))),Te(!1);const e=pe&&Y[pe];e&&se("element"),e&&he(e),e&&We(e.field_type)}ke&&JSON.stringify(Y)!==JSON.stringify(ue)&&(me(JSON.parse(JSON.stringify(Y))),Ce(!1))},[Y,Me]),t.useEffect(()=>{if("number"!=typeof ge||"string"!=typeof ge){const e=Number(ge);if(ve[e]){const t=JSON.parse(JSON.stringify(ve[e]));ne(e,{...t})}}},[ve]),t.useEffect(()=>{const e=ve.map((e,t)=>t===Number(ge)?{...e,..._e}:{...e});ye(e)},[_e]),t.useEffect(()=>{te.length!==ve.length&&ye(JSON.parse(JSON.stringify(te))),JSON.stringify(ve)!==JSON.stringify(te)&&Ie&&(ye(JSON.parse(JSON.stringify(te))),De(!1))},[te]),t.useEffect(()=>{},[]);const yt=t.useCallback(async()=>{Oe(!0);try{(null==H?void 0:H._id)&&(Fe([]),await V(j.getFormDataById(null==H?void 0:H._id)),await V(j.getFieldsByFormId({id:null==H?void 0:H._id})))}finally{Oe(!1)}},[null==H?void 0:H._id]);t.useEffect(()=>{yt()},[yt]);const _t=e=>e&&Object.keys(e).length>0,xt=()=>/* @__PURE__ */e.jsx(f.Typography,{type:"s5",color:"theme.secondary.800",className:"formSection--Text",children:"Select a field to edit its properties."}),gt=(e,t="text")=>(null==e?void 0:e.field_type)||t,St=t.useMemo(()=>{if(!oe)/* @__PURE__ */
8
+ return e.jsx(xt,{});if("element"===oe){if(!_t(Y))/* @__PURE__ */
9
+ return e.jsx(xt,{});const t=gt(fe);return We(t)}if("section"===oe){if(!_t(te))/* @__PURE__ */
10
10
  return e.jsx(xt,{});const t=gt(_e);return We(t)}/* @__PURE__ */
11
- return e.jsx(xt,{})},[ne,Object.keys(Y).length,Object.keys(te).length,null==fe?void 0:fe.field_type,null==fe?void 0:fe.field_properties,null==_e?void 0:_e.field_type,null==_e?void 0:_e.field_properties,We]);
11
+ return e.jsx(xt,{})},[oe,Object.keys(Y).length,Object.keys(te).length,null==fe?void 0:fe.field_type,null==fe?void 0:fe.field_properties,null==_e?void 0:_e.field_type,null==_e?void 0:_e.field_properties,We]);
12
12
  /* @__PURE__ */
13
- return e.jsx(B.default,{position:"relative",children:we?/* @__PURE__ */e.jsx(x.ErpLoader,{}):/* @__PURE__ */e.jsxs(o.DndProvider,{backend:n.HTML5Backend,children:[
13
+ return e.jsx(F.default,{position:"relative",children:we?/* @__PURE__ */e.jsx(x.ErpLoader,{}):/* @__PURE__ */e.jsxs(n.DndProvider,{backend:o.HTML5Backend,children:[
14
14
  /* @__PURE__ */e.jsx(m.FormHeader,{breadCrumbPath:vt,children:/* @__PURE__ */e.jsxs("div",{className:"formSection--Buttons",children:[
15
15
  /* @__PURE__ */e.jsx(d.DynamicButton,{variant:"outlined",className:"formSection--PreviewButton",text:"Preview",onClick:()=>{Le?ht():ft()},disable:!(null==Y?void 0:Y.length),startIcon:Le?/* @__PURE__ */e.jsx(J.EyeOff,{}):/* @__PURE__ */e.jsx(A.Eye,{})}),
16
- /* @__PURE__ */e.jsx(d.DynamicButton,{variant:"contained",type:"submit",text:"Update",onClick:pt,disable:Le})]})}),Le?/* @__PURE__ */e.jsx(S.FormParser,{data:Le||[],handleFormSubmit:e=>{},className:"form-container",fieldArrayName:"form-builder-preview",getFormMethods:e=>$e({...e})}):/* @__PURE__ */e.jsxs(M.default,{className:"formSection--Grid",container:!0,children:[
16
+ /* @__PURE__ */e.jsx(d.DynamicButton,{variant:"contained",type:"submit",text:"Update",onClick:pt,disable:Le})]})}),Le?/* @__PURE__ */e.jsx(S.default,{data:Le||[],handleFormSubmit:e=>{},className:"form-container",fieldArrayName:"form-builder-preview",getFormMethods:e=>$e({...e})}):/* @__PURE__ */e.jsxs(M.default,{className:"formSection--Grid",container:!0,children:[
17
17
  /* @__PURE__ */e.jsx(M.default,{item:!0,xs:9,component:"form",sx:{position:"relative",background:"#F5F6F5",padding:"0.75rem"},children:/* @__PURE__ */e.jsxs(M.default,{className:"formSection--GridContainer",children:[
18
- /* @__PURE__ */e.jsxs(B.default,{className:"formSection--Tab",children:[Fe&&/* @__PURE__ */e.jsx(c.TabBar,{tabs:Fe,onEditTabTitle:Ke,activeValue:Je,setActiveValue:Ae,handleTabChange:()=>{dt()},handleRemoveTab:Qe,containerProps:{mb:0}}),
18
+ /* @__PURE__ */e.jsxs(F.default,{className:"formSection--Tab",children:[Be&&/* @__PURE__ */e.jsx(c.TabBar,{tabs:Be,onEditTabTitle:Ke,activeValue:Je,setActiveValue:Ae,handleTabChange:()=>{dt()},handleRemoveTab:Qe,containerProps:{mb:0}}),
19
19
  /* @__PURE__ */e.jsx(d.DynamicButton,{variant:"outlined",text:"Add Tab",onClick:Ye,style:{color:"#292D32",margin:"0.5rem"}})]}),
20
- /* @__PURE__ */e.jsxs("div",{className:"formSection--Form",children:[null==te?void 0:te.map((t,r)=>{var i;const o=Y.filter(e=>e.section_order===r),n=t.section_type===_.SECTION_TYPES.FORM_SWITCH_SECTION,s=null==(i=null==t?void 0:t.switcher_forms)?void 0:i.map(e=>({...e,formMembers:Y.filter(t=>t.section_form_id===e.id)}));/* @__PURE__ */
21
- return e.jsxs(a.DynamicSectionHOC,{index:r,label:U(t.label),onClick:Ze,position:r,fieldArrayName:"section",isFormSwitcher:n,activeIndex:le===r,removeSection:()=>lt(r),handleAccordion:()=>at(r),handleAddButton:e=>et(e),remove_section:t.remove_section,children:[n?/* @__PURE__ */e.jsxs("div",{style:{width:"100%"},children:[
20
+ /* @__PURE__ */e.jsxs("div",{className:"formSection--Form",children:[null==te?void 0:te.map((t,r)=>{var i;const n=Y.filter(e=>e.section_order===r),o=t.section_type===_.SECTION_TYPES.FORM_SWITCH_SECTION,s=null==(i=null==t?void 0:t.switcher_forms)?void 0:i.map(e=>({...e,formMembers:Y.filter(t=>t.section_form_id===e.id)}));/* @__PURE__ */
21
+ return e.jsxs(a.DynamicSectionHOC,{index:r,label:U(t.label),onClick:Ze,position:r,fieldArrayName:"section",isFormSwitcher:o,activeIndex:le===r,removeSection:()=>lt(r),handleAccordion:()=>at(r),handleAddButton:e=>et(e),remove_section:t.remove_section,children:[o?/* @__PURE__ */e.jsxs("div",{style:{width:"100%"},children:[
22
22
  /* @__PURE__ */e.jsx(f.Typography,{type:"s5",style:{fontWeight:500},color:"theme.secondary.800",children:t.form_switcher_label}),
23
- /* @__PURE__ */e.jsx(T.default,{"aria-labelledby":"theme-radio-buttons-group-label",name:t.form_switcher_name||t.form_switcher_label,children:null==s?void 0:s.map(({name:t,id:i,formMembers:o})=>/* @__PURE__ */e.jsxs(e.Fragment,{children:[
23
+ /* @__PURE__ */e.jsx(T.default,{"aria-labelledby":"theme-radio-buttons-group-label",name:t.form_switcher_name||t.form_switcher_label,children:null==s?void 0:s.map(({name:t,id:i,formMembers:n})=>/* @__PURE__ */e.jsxs(e.Fragment,{children:[
24
24
  /* @__PURE__ */e.jsx("div",{children:/* @__PURE__ */e.jsx(I.default,{value:t,control:/* @__PURE__ */e.jsx(y.Radio,{}),label:U(t),disabled:!0},i)}),
25
- /* @__PURE__ */e.jsx(M.default,{container:!0,sx:{mb:3},children:/* @__PURE__ */e.jsx(O.default,{sectionMembers:o||[],members:Y,activeMember:de,control:z,t:U,element:N.element,images:u.images,elementJSON:fe,remove:Q,move:Z,handleElementSelection:Xe,setElementSwap:Te,handleDuplicateElement:bt,setSelectedHoc:se,setActiveMember:ce})}),
26
- /* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add",variant:"outlined",className:"formSection--PreviewButton","data-position":r,onClick:e=>et(e,{section_form_id:i,is_form_switcher_section:!0}),startIcon:/* @__PURE__ */e.jsx(P.default,{})})]}))})]}):null,!n&&/* @__PURE__ */e.jsx(O.default,{sectionMembers:o||[],members:Y,activeMember:de,control:z,t:U,element:N.element,images:u.images,elementJSON:fe,remove:Q,move:Z,handleElementSelection:Xe,setElementSwap:Te,handleDuplicateElement:bt,setSelectedHoc:se,setActiveMember:ce})]})}),
27
- /* @__PURE__ */e.jsx("div",{className:"formSection--Section",children:/* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add a section",variant:"outlined",className:"formSection--PreviewButton",onClick:ze,startIcon:/* @__PURE__ */e.jsx(P.default,{})})})]})]})}),
28
- /* @__PURE__ */e.jsx(M.default,{item:!0,xs:3,className:Boolean(ne)&&((null==Y?void 0:Y.length)||te.length)?"formSection--RightGrid":"formSection--RightGrid formSection--Text",children:St})]}),
29
- /* @__PURE__ */e.jsx(v.Toast,{open:Boolean(De),type:null==De?void 0:De.type,message:null==De?void 0:De.message,handleClose:()=>Ge(null),anchorOrigin:{horizontal:"right",vertical:"bottom"}})]})})}exports.CustomForm=U,exports.default=U;
25
+ /* @__PURE__ */e.jsx(M.default,{container:!0,sx:{mb:3},children:/* @__PURE__ */e.jsx(O.default,{sectionMembers:n||[],members:Y,activeMember:de,control:z,t:U,element:N.element,images:u.images,elementJSON:fe,remove:Q,move:Z,handleElementSelection:Xe,setElementSwap:Te,handleDuplicateElement:bt,setSelectedHoc:se,setActiveMember:ce})}),
26
+ /* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add",variant:"outlined",className:"formSection--PreviewButton","data-position":r,onClick:e=>et(e,{section_form_id:i,is_form_switcher_section:!0}),startIcon:/* @__PURE__ */e.jsx(D.default,{})})]}))})]}):null,!o&&/* @__PURE__ */e.jsx(O.default,{sectionMembers:n||[],members:Y,activeMember:de,control:z,t:U,element:N.element,images:u.images,elementJSON:fe,remove:Q,move:Z,handleElementSelection:Xe,setElementSwap:Te,handleDuplicateElement:bt,setSelectedHoc:se,setActiveMember:ce})]})}),
27
+ /* @__PURE__ */e.jsx("div",{className:"formSection--Section",children:/* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add a section",variant:"outlined",className:"formSection--PreviewButton",onClick:ze,startIcon:/* @__PURE__ */e.jsx(D.default,{})})})]})]})}),
28
+ /* @__PURE__ */e.jsx(M.default,{item:!0,xs:3,className:Boolean(oe)&&((null==Y?void 0:Y.length)||te.length)?"formSection--RightGrid":"formSection--RightGrid formSection--Text",children:St})]}),
29
+ /* @__PURE__ */e.jsx(v.Toast,{open:Boolean(Pe),type:null==Pe?void 0:Pe.type,message:null==Pe?void 0:Pe.message,handleClose:()=>Ge(null),anchorOrigin:{horizontal:"right",vertical:"bottom"}})]})})}exports.CustomForm=U,exports.default=U;
30
30
  //# sourceMappingURL=index.js.map