@solidstarters/solid-core-ui 1.1.211 → 1.1.212

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 (373) hide show
  1. package/dist/components/Svg/DevDocs.tsx +9 -0
  2. package/dist/components/Svg/DocsSvg.tsx +9 -0
  3. package/dist/components/Svg/ExcelSvg.tsx +15 -0
  4. package/dist/components/Svg/FieldSvg.tsx +9 -0
  5. package/dist/components/Svg/FileSvg.tsx +18 -0
  6. package/dist/components/Svg/HomePageModuleSvg.tsx +179 -0
  7. package/dist/components/Svg/ModelSvg.tsx +9 -0
  8. package/dist/components/Svg/ModuleSvg.tsx +9 -0
  9. package/dist/components/Svg/PDFSvg.tsx +15 -0
  10. package/dist/components/Svg/RightArrowSvg.tsx +9 -0
  11. package/dist/components/Svg/SettingsSvg.tsx +9 -0
  12. package/dist/components/auth/AuthLayout.tsx +223 -0
  13. package/dist/components/auth/ForgotPasswordThankYou.tsx +33 -0
  14. package/dist/components/auth/GoogleAuthChecking.tsx +63 -0
  15. package/dist/components/auth/SolidChangeForcePassword.tsx +222 -0
  16. package/dist/components/auth/SolidForgotPassword.tsx +127 -0
  17. package/dist/components/auth/SolidInitialLoginOtp.tsx +271 -0
  18. package/dist/components/auth/SolidInitiateRegisterOtp.tsx +218 -0
  19. package/dist/components/auth/SolidLogin.d.ts.map +1 -1
  20. package/dist/components/auth/SolidLogin.js +14 -8
  21. package/dist/components/auth/SolidLogin.js.map +1 -1
  22. package/dist/components/auth/SolidLogin.tsx +428 -0
  23. package/dist/components/auth/SolidOTPVerify.tsx +133 -0
  24. package/dist/components/auth/SolidRegister.tsx +454 -0
  25. package/dist/components/auth/SolidResetPassword.tsx +194 -0
  26. package/dist/components/common/AuthBanner.tsx +41 -0
  27. package/dist/components/common/AutoCompleteField.tsx +79 -0
  28. package/dist/components/common/BackButton.tsx +72 -0
  29. package/dist/components/common/CancelButton.tsx +61 -0
  30. package/dist/components/common/CodeEditor.tsx +38 -0
  31. package/dist/components/common/CreateButton.tsx +17 -0
  32. package/dist/components/common/DownloadProgressToast.tsx +55 -0
  33. package/dist/components/common/DropzonePlaceholder.tsx +31 -0
  34. package/dist/components/common/DropzoneUpload.tsx +11 -0
  35. package/dist/components/common/FileReaderExt.tsx +20 -0
  36. package/dist/components/common/GeneralSettings.tsx +1225 -0
  37. package/dist/components/common/HeaderDynamicTitles.tsx +13 -0
  38. package/dist/components/common/MarkdownViewer.tsx +84 -0
  39. package/dist/components/common/MultipleSelectAutoCompleteField.tsx +64 -0
  40. package/dist/components/common/NotFound.tsx +22 -0
  41. package/dist/components/common/SingleSelectAutoCompleteField.tsx +73 -0
  42. package/dist/components/common/SocialMediaLogin.tsx +53 -0
  43. package/dist/components/common/SolidAdmin.tsx +6 -0
  44. package/dist/components/common/SolidBreadcrumb.tsx +129 -0
  45. package/dist/components/common/SolidExport.tsx +563 -0
  46. package/dist/components/common/SolidExportStepper.tsx +135 -0
  47. package/dist/components/common/SolidFieldTooltip.tsx +23 -0
  48. package/dist/components/common/SolidFormHeader.tsx +25 -0
  49. package/dist/components/common/SolidFormStepper.tsx +350 -0
  50. package/dist/components/common/SolidModuleHome.tsx +128 -0
  51. package/dist/components/common/SolidPopupContainer.tsx +37 -0
  52. package/dist/components/common/SolidSettings/LlmSettings/AnthropicProviderComponent.tsx +45 -0
  53. package/dist/components/common/SolidSettings/LlmSettings/OpenAiProviderComponent.tsx +45 -0
  54. package/dist/components/common/SolidSettings/SettingDropzoneActivePlaceholder.tsx +20 -0
  55. package/dist/components/common/SolidSettings/SettingsImageRemoveButton.tsx +15 -0
  56. package/dist/components/common/SolidSettings/SolidUploadedImage.tsx +16 -0
  57. package/dist/components/common/SolidThemeLink.tsx +6 -0
  58. package/dist/components/common/SolidThemeProvider.tsx +44 -0
  59. package/dist/components/common/StepperArrows/ActiveArrowStep.tsx +18 -0
  60. package/dist/components/common/StepperArrows/ActiveBeforeStepArrow.tsx +18 -0
  61. package/dist/components/common/StepperArrows/InactiveStepArrow.tsx +19 -0
  62. package/dist/components/common/error.tsx +30 -0
  63. package/dist/components/common/useHandleFormCustomButtonClick.ts +40 -0
  64. package/dist/components/common/useHandleListCustomButtonClick.ts +42 -0
  65. package/dist/components/core/chatter/SolidChatter.tsx +248 -0
  66. package/dist/components/core/chatter/SolidChatterAuditMessage.tsx +35 -0
  67. package/dist/components/core/chatter/SolidChatterCustomMessage.tsx +46 -0
  68. package/dist/components/core/chatter/SolidChatterDateDivider.tsx +16 -0
  69. package/dist/components/core/chatter/SolidChatterHeader.tsx +218 -0
  70. package/dist/components/core/chatter/SolidChatterMessageBox.tsx +163 -0
  71. package/dist/components/core/chatter/SolidMessageComposer.tsx +146 -0
  72. package/dist/components/core/common/AvatarWidget.tsx +55 -0
  73. package/dist/components/core/common/DateFieldViewComponent.tsx +36 -0
  74. package/dist/components/core/common/FilterComponent.tsx +458 -0
  75. package/dist/components/core/common/LoadDynamicJsxComponent.tsx +70 -0
  76. package/dist/components/core/common/PDFViewer.tsx +117 -0
  77. package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.tsx +89 -0
  78. package/dist/components/core/common/SolidAccountSettings/SolidChangePassword.tsx +188 -0
  79. package/dist/components/core/common/SolidAccountSettings/SolidNotifications.tsx +139 -0
  80. package/dist/components/core/common/SolidAccountSettings/SolidPersonalInfo.tsx +311 -0
  81. package/dist/components/core/common/SolidCreateButton.tsx +48 -0
  82. package/dist/components/core/common/SolidGenericImport/DocumentSvg.tsx +15 -0
  83. package/dist/components/core/common/SolidGenericImport/SolidGenericImport.tsx +64 -0
  84. package/dist/components/core/common/SolidGenericImport/SolidImportDropzone.tsx +125 -0
  85. package/dist/components/core/common/SolidGenericImport/SolidImportInstructions.tsx +122 -0
  86. package/dist/components/core/common/SolidGenericImport/SolidImportStepper.tsx +217 -0
  87. package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.tsx +205 -0
  88. package/dist/components/core/common/SolidGenericImport/SolidImportTransactionStatus.tsx +158 -0
  89. package/dist/components/core/common/SolidGenericImport/SolidImportWrapper.tsx +29 -0
  90. package/dist/components/core/common/SolidGlobalSearchElement.tsx +1470 -0
  91. package/dist/components/core/common/SolidLayoutViews.tsx +87 -0
  92. package/dist/components/core/common/SolidListViewOptions.tsx +31 -0
  93. package/dist/components/core/common/SolidLoaders/SolidCircularLoader.tsx +7 -0
  94. package/dist/components/core/common/SolidPasswordHelperText.tsx +34 -0
  95. package/dist/components/core/common/SolidSaveCustomFilterForm.tsx +75 -0
  96. package/dist/components/core/common/SolidSearchBox.tsx +17 -0
  97. package/dist/components/core/common/SolidViewLayoutManager.ts +421 -0
  98. package/dist/components/core/common/SolidXAiIframe.tsx +77 -0
  99. package/dist/components/core/dashboard/SolidDashboard.tsx +332 -0
  100. package/dist/components/core/dashboard/SolidDashboardBody.tsx +117 -0
  101. package/dist/components/core/dashboard/SolidDashboardFilterRequired.tsx +28 -0
  102. package/dist/components/core/dashboard/SolidDashboardHeader.tsx +10 -0
  103. package/dist/components/core/dashboard/SolidDashboardLoading.tsx +55 -0
  104. package/dist/components/core/dashboard/SolidDashboardNotAvailable.tsx +32 -0
  105. package/dist/components/core/dashboard/SolidDashboardRenderError.tsx +29 -0
  106. package/dist/components/core/dashboard/SolidDashboardVariable.tsx +256 -0
  107. package/dist/components/core/dashboard/SolidQuestionRenderer.tsx +78 -0
  108. package/dist/components/core/dashboard/chart-renderers/ChartJsRenderer.tsx +18 -0
  109. package/dist/components/core/dashboard/chart-renderers/PrimeReactDatatableRenderer.tsx +54 -0
  110. package/dist/components/core/dashboard/chart-renderers/init-chartjs.ts +25 -0
  111. package/dist/components/core/dashboard/dashboard-utils.ts +39 -0
  112. package/dist/components/core/extension/solid-core/CustomIcon/StatusIcon.tsx +17 -0
  113. package/dist/components/core/extension/solid-core/dashboardQuestion/ChartFormPreviewWidget.tsx +36 -0
  114. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.ts +18 -0
  115. package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.ts +18 -0
  116. package/dist/components/core/extension/solid-core/modelMetadata/list/DeleteModelRowAction.tsx +114 -0
  117. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.tsx +213 -0
  118. package/dist/components/core/extension/solid-core/moduleMetadata/list/DeleteModuleRowAction.tsx +138 -0
  119. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.tsx +209 -0
  120. package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +131 -0
  121. package/dist/components/core/field/FieldListViewData.tsx +313 -0
  122. package/dist/components/core/filter/SolidBooleanFilterElement.tsx +30 -0
  123. package/dist/components/core/filter/SolidFilterFields.tsx +131 -0
  124. package/dist/components/core/filter/SolidManyToManyFilterElement.tsx +64 -0
  125. package/dist/components/core/filter/SolidManyToOneFilterElement.tsx +61 -0
  126. package/dist/components/core/filter/SolidSelectionDynamicFilterElement.tsx +50 -0
  127. package/dist/components/core/filter/SolidSelectionStaticFilterElement.tsx +32 -0
  128. package/dist/components/core/filter/SolidVarInputsFilterElement.tsx +209 -0
  129. package/dist/components/core/filter/fields/SolidBigintField.tsx +9 -0
  130. package/dist/components/core/filter/fields/SolidBooleanField.tsx +68 -0
  131. package/dist/components/core/filter/fields/SolidComputedField.tsx +23 -0
  132. package/dist/components/core/filter/fields/SolidDateField.tsx +63 -0
  133. package/dist/components/core/filter/fields/SolidDatetimeField.tsx +54 -0
  134. package/dist/components/core/filter/fields/SolidDecimalField.tsx +9 -0
  135. package/dist/components/core/filter/fields/SolidExternalIdField.tsx +52 -0
  136. package/dist/components/core/filter/fields/SolidFloatField.tsx +9 -0
  137. package/dist/components/core/filter/fields/SolidIdField.tsx +46 -0
  138. package/dist/components/core/filter/fields/SolidIntField.tsx +61 -0
  139. package/dist/components/core/filter/fields/SolidLongTextField.tsx +9 -0
  140. package/dist/components/core/filter/fields/SolidMediaMultipleField.tsx +60 -0
  141. package/dist/components/core/filter/fields/SolidMediaSingleField.tsx +62 -0
  142. package/dist/components/core/filter/fields/SolidRelationField.tsx +17 -0
  143. package/dist/components/core/filter/fields/SolidRichTextField.tsx +9 -0
  144. package/dist/components/core/filter/fields/SolidSelectionDynamicField.tsx +52 -0
  145. package/dist/components/core/filter/fields/SolidSelectionStaticField.tsx +54 -0
  146. package/dist/components/core/filter/fields/SolidShortTextField.tsx +60 -0
  147. package/dist/components/core/filter/fields/SolidTimeField.tsx +48 -0
  148. package/dist/components/core/filter/fields/SolidUuidField.tsx +51 -0
  149. package/dist/components/core/filter/fields/relations/SolidRelationManyToManyField.tsx +62 -0
  150. package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.tsx +84 -0
  151. package/dist/components/core/form/SolidFormActionHeader.tsx +497 -0
  152. package/dist/components/core/form/SolidFormFieldRender.tsx +53 -0
  153. package/dist/components/core/form/SolidFormFieldRenderExtension.tsx +26 -0
  154. package/dist/components/core/form/SolidFormFooter.tsx +162 -0
  155. package/dist/components/core/form/SolidFormLayouts.tsx +104 -0
  156. package/dist/components/core/form/SolidFormUserViewLayout.tsx +84 -0
  157. package/dist/components/core/form/SolidFormView.tsx +1856 -0
  158. package/dist/components/core/form/SolidFormViewContextMenuHeaderButton.tsx +52 -0
  159. package/dist/components/core/form/SolidFormViewNormalHeaderButton.tsx +52 -0
  160. package/dist/components/core/form/SolidFormViewShimmerLoading.tsx +109 -0
  161. package/dist/components/core/form/fields/ISolidField.tsx +71 -0
  162. package/dist/components/core/form/fields/SolidBooleanField.tsx +434 -0
  163. package/dist/components/core/form/fields/SolidDateField.tsx +247 -0
  164. package/dist/components/core/form/fields/SolidDateTimeField.tsx +229 -0
  165. package/dist/components/core/form/fields/SolidDecimalField.tsx +171 -0
  166. package/dist/components/core/form/fields/SolidEmailField.tsx +176 -0
  167. package/dist/components/core/form/fields/SolidIntegerField.tsx +282 -0
  168. package/dist/components/core/form/fields/SolidJsonField.tsx +185 -0
  169. package/dist/components/core/form/fields/SolidLongTextField.tsx +618 -0
  170. package/dist/components/core/form/fields/SolidMediaMultipleField.tsx +663 -0
  171. package/dist/components/core/form/fields/SolidMediaSingleField.tsx +547 -0
  172. package/dist/components/core/form/fields/SolidPasswordField.tsx +390 -0
  173. package/dist/components/core/form/fields/SolidRelationField.tsx +56 -0
  174. package/dist/components/core/form/fields/SolidRichTextField.tsx +188 -0
  175. package/dist/components/core/form/fields/SolidSelectionDynamicField.tsx +340 -0
  176. package/dist/components/core/form/fields/SolidSelectionStaticField.tsx +462 -0
  177. package/dist/components/core/form/fields/SolidShortTextField.tsx +399 -0
  178. package/dist/components/core/form/fields/SolidTimeField.tsx +245 -0
  179. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +453 -0
  180. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +1036 -0
  181. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +627 -0
  182. package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +38 -0
  183. package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +64 -0
  184. package/dist/components/core/form/fields/widgets/SolidAiInteractionMessageFieldFormWidget.tsx +135 -0
  185. package/dist/components/core/form/fields/widgets/SolidAiInteractionMetadataFieldFormWidget.tsx +144 -0
  186. package/dist/components/core/form/fields/widgets/SolidIconEditWidget.tsx +265 -0
  187. package/dist/components/core/form/fields/widgets/SolidIconViewWidget.tsx +32 -0
  188. package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.tsx +50 -0
  189. package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.tsx +222 -0
  190. package/dist/components/core/form/fields/widgets/SolidShortTextFieldAvatarWidget.tsx +70 -0
  191. package/dist/components/core/form/widgets/CustomHtml.tsx +20 -0
  192. package/dist/components/core/kanban/KanbanBoard.tsx +150 -0
  193. package/dist/components/core/kanban/KanbanCard.tsx +279 -0
  194. package/dist/components/core/kanban/KanbanColumn.tsx +139 -0
  195. package/dist/components/core/kanban/KanbanUserViewLayout.tsx +84 -0
  196. package/dist/components/core/kanban/SolidKanbanView.tsx +894 -0
  197. package/dist/components/core/kanban/SolidKanbanViewConfigure.tsx +154 -0
  198. package/dist/components/core/kanban/SolidKanbanViewFields.tsx +164 -0
  199. package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +59 -0
  200. package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.tsx +50 -0
  201. package/dist/components/core/kanban/SolidSelectionStaticFilterElement.tsx +32 -0
  202. package/dist/components/core/kanban/SolidVarInputsFilterElement.tsx +184 -0
  203. package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.tsx +9 -0
  204. package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.tsx +16 -0
  205. package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.tsx +23 -0
  206. package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.tsx +14 -0
  207. package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.tsx +13 -0
  208. package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.tsx +9 -0
  209. package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.tsx +12 -0
  210. package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.tsx +9 -0
  211. package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.tsx +14 -0
  212. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.tsx +20 -0
  213. package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.tsx +9 -0
  214. package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +140 -0
  215. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +164 -0
  216. package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.tsx +13 -0
  217. package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.tsx +9 -0
  218. package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.tsx +14 -0
  219. package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.tsx +14 -0
  220. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +121 -0
  221. package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.tsx +12 -0
  222. package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.tsx +13 -0
  223. package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +16 -0
  224. package/dist/components/core/list/ListViewRowActionPopup.tsx +41 -0
  225. package/dist/components/core/list/SolidColumnSelector/SolidListColumnSelector.tsx +242 -0
  226. package/dist/components/core/list/SolidEmptyListViewPlaceholder.tsx +111 -0
  227. package/dist/components/core/list/SolidListView.tsx +2007 -0
  228. package/dist/components/core/list/SolidListViewColumn.tsx +165 -0
  229. package/dist/components/core/list/SolidListViewConfigure.tsx +339 -0
  230. package/dist/components/core/list/SolidListViewHeaderButton.tsx +31 -0
  231. package/dist/components/core/list/SolidListViewHeaderContextMenuButton.tsx +30 -0
  232. package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +41 -0
  233. package/dist/components/core/list/SolidListViewShimmerLoading.tsx +78 -0
  234. package/dist/components/core/list/SolidListingHeader.tsx +42 -0
  235. package/dist/components/core/list/SolidManyToOneFilterElement.tsx +60 -0
  236. package/dist/components/core/list/SolidSelectionDynamicFilterElement.tsx +50 -0
  237. package/dist/components/core/list/SolidSelectionStaticFilterElement.tsx +32 -0
  238. package/dist/components/core/list/SolidTableRowCell.tsx +35 -0
  239. package/dist/components/core/list/SolidVarInputsFilterElement.tsx +184 -0
  240. package/dist/components/core/list/columns/SolidBigintColumn.tsx +9 -0
  241. package/dist/components/core/list/columns/SolidBooleanColumn.tsx +90 -0
  242. package/dist/components/core/list/columns/SolidComputedColumn.tsx +27 -0
  243. package/dist/components/core/list/columns/SolidDateColumn.tsx +90 -0
  244. package/dist/components/core/list/columns/SolidDatetimeColumn.tsx +79 -0
  245. package/dist/components/core/list/columns/SolidDecimalColumn.tsx +9 -0
  246. package/dist/components/core/list/columns/SolidExternalIdColumn.tsx +80 -0
  247. package/dist/components/core/list/columns/SolidFloatColumn.tsx +9 -0
  248. package/dist/components/core/list/columns/SolidIdColumn.tsx +79 -0
  249. package/dist/components/core/list/columns/SolidIntColumn.tsx +87 -0
  250. package/dist/components/core/list/columns/SolidLongTextColumn.tsx +9 -0
  251. package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +301 -0
  252. package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +170 -0
  253. package/dist/components/core/list/columns/SolidRelationColumn.tsx +21 -0
  254. package/dist/components/core/list/columns/SolidRichTextColumn.tsx +9 -0
  255. package/dist/components/core/list/columns/SolidSelectionDynamicColumn.tsx +80 -0
  256. package/dist/components/core/list/columns/SolidSelectionStaticColumn.tsx +81 -0
  257. package/dist/components/core/list/columns/SolidShortTextColumn.tsx +160 -0
  258. package/dist/components/core/list/columns/SolidTimeColumn.tsx +78 -0
  259. package/dist/components/core/list/columns/SolidUuidColumn.tsx +79 -0
  260. package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.tsx +106 -0
  261. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +117 -0
  262. package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.tsx +110 -0
  263. package/dist/components/core/list/widgets/SolidManyToManyRelationAvatarListWidget.tsx +30 -0
  264. package/dist/components/core/list/widgets/SolidManyToOneRelationAvatarListWidget.tsx +30 -0
  265. package/dist/components/core/list/widgets/SolidShortTextAvatarWidget.tsx +70 -0
  266. package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.tsx +21 -0
  267. package/dist/components/core/locales/SolidChatterLocaleTabView.tsx +91 -0
  268. package/dist/components/core/locales/SolidLocale.tsx +127 -0
  269. package/dist/components/core/model/CreateModel.tsx +495 -0
  270. package/dist/components/core/model/FieldMetaData.tsx +263 -0
  271. package/dist/components/core/model/FieldMetaDataForm.tsx +3509 -0
  272. package/dist/components/core/model/FieldSelector.tsx +62 -0
  273. package/dist/components/core/model/ModelListViewData.tsx +384 -0
  274. package/dist/components/core/model/ModelMetaData.tsx +921 -0
  275. package/dist/components/core/module/CreateModule.tsx +617 -0
  276. package/dist/components/core/module/ModuleListViewData.tsx +431 -0
  277. package/dist/components/core/solid-ai/SolidAiMainWrapper.tsx +8 -0
  278. package/dist/components/core/solid-ai/SolidXAIIcon.tsx +37 -0
  279. package/dist/components/core/users/CreateUser.tsx +467 -0
  280. package/dist/components/core/users/CreateUserRole.tsx +212 -0
  281. package/dist/components/core/users/UserListView.tsx +376 -0
  282. package/dist/components/layout/AdminLayout.tsx +57 -0
  283. package/dist/components/layout/AdminSidebar.tsx +65 -0
  284. package/dist/components/layout/AppConfig.tsx +104 -0
  285. package/dist/components/layout/AppSidebar.tsx +232 -0
  286. package/dist/components/layout/ButtonLoader.tsx +7 -0
  287. package/dist/components/layout/CustomPagination.tsx +55 -0
  288. package/dist/components/layout/DashboardHeader.tsx +89 -0
  289. package/dist/components/layout/FilterMenu.tsx +122 -0
  290. package/dist/components/layout/Footer.tsx +13 -0
  291. package/dist/components/layout/GlobalSearch.tsx +37 -0
  292. package/dist/components/layout/Header.tsx +8 -0
  293. package/dist/components/layout/Layout.tsx +205 -0
  294. package/dist/components/layout/ListingHeader.tsx +204 -0
  295. package/dist/components/layout/Loader.tsx +16 -0
  296. package/dist/components/layout/UserSidebar.tsx +53 -0
  297. package/dist/components/layout/context/layoutcontext.tsx +52 -0
  298. package/dist/components/layout/navbar-one.tsx +258 -0
  299. package/dist/components/layout/navbar-two-menu.tsx +72 -0
  300. package/dist/components/layout/navbar-two.tsx +37 -0
  301. package/dist/components/layout/user-profile-menu.tsx +213 -0
  302. package/dist/components/layout/user-profile.tsx +7 -0
  303. package/dist/components/modelsComponents/filterIcon.tsx +9 -0
  304. package/dist/constants/error-messages.ts +238 -0
  305. package/dist/declarations.d.ts +22 -0
  306. package/dist/helpers/AppTitle.tsx +12 -0
  307. package/dist/helpers/ToastContainer.tsx +94 -0
  308. package/dist/helpers/autoCompleteVirtualScroll.ts +41 -0
  309. package/dist/helpers/countries.tsx +260 -0
  310. package/dist/helpers/downloadFileWithProgress.ts +91 -0
  311. package/dist/helpers/downloadMediaFile.tsx +21 -0
  312. package/dist/helpers/getAcceptedFileTypes.tsx +22 -0
  313. package/dist/helpers/getRandomColors.tsx +68 -0
  314. package/dist/helpers/helpers.ts +61 -0
  315. package/dist/helpers/hydrateRelationRules.ts +120 -0
  316. package/dist/helpers/permissions.ts +7 -0
  317. package/dist/helpers/registry.ts +337 -0
  318. package/dist/helpers/resendOtpHelper.tsx +5 -0
  319. package/dist/helpers/revalidate.ts +7 -0
  320. package/dist/helpers/rolesHelper.ts +17 -0
  321. package/dist/helpers/solidIcons.tsx +1831 -0
  322. package/dist/helpers/updatePasswordField.ts +41 -0
  323. package/dist/index.ts +421 -0
  324. package/dist/nextAuth/authProviders.d.ts.map +1 -1
  325. package/dist/nextAuth/authProviders.js +6 -5
  326. package/dist/nextAuth/authProviders.js.map +1 -1
  327. package/dist/nextAuth/authProviders.tsx +232 -0
  328. package/dist/nextAuth/handleLogout.tsx +39 -0
  329. package/dist/nextAuth/refreshAccessToken.tsx +28 -0
  330. package/dist/redux/api/aiInteractionApi.ts +59 -0
  331. package/dist/redux/api/authApi.ts +131 -0
  332. package/dist/redux/api/dashboardApi.ts +56 -0
  333. package/dist/redux/api/dashboardQuestionApi.ts +17 -0
  334. package/dist/redux/api/exportTemplateApi.tsx +59 -0
  335. package/dist/redux/api/fetchBaseQuery.tsx +118 -0
  336. package/dist/redux/api/fieldApi.ts +86 -0
  337. package/dist/redux/api/importTransactionApi.tsx +69 -0
  338. package/dist/redux/api/mediaApi.ts +55 -0
  339. package/dist/redux/api/mediaStorageProviderApi.ts +55 -0
  340. package/dist/redux/api/modelApi.ts +80 -0
  341. package/dist/redux/api/moduleApi.ts +72 -0
  342. package/dist/redux/api/permissionApi.ts +32 -0
  343. package/dist/redux/api/pincodeApi.tsx +56 -0
  344. package/dist/redux/api/roleApi.ts +58 -0
  345. package/dist/redux/api/solidActionApi.ts +66 -0
  346. package/dist/redux/api/solidChatterMessageApi.ts +25 -0
  347. package/dist/redux/api/solidEntityApi.tsx +164 -0
  348. package/dist/redux/api/solidMenuApi.ts +71 -0
  349. package/dist/redux/api/solidServiceApi.ts +31 -0
  350. package/dist/redux/api/solidSettingsApi.tsx +83 -0
  351. package/dist/redux/api/solidViewApi.ts +73 -0
  352. package/dist/redux/api/stateApi.tsx +56 -0
  353. package/dist/redux/api/testApi.ts +21 -0
  354. package/dist/redux/api/userApi.ts +135 -0
  355. package/dist/redux/features/authSlice.ts +19 -0
  356. package/dist/redux/features/dataViewSlice.ts +26 -0
  357. package/dist/redux/features/navbarSlice.ts +21 -0
  358. package/dist/redux/features/popupSlice.ts +37 -0
  359. package/dist/redux/features/settingsSlice.ts +60 -0
  360. package/dist/redux/features/themeSlice.ts +17 -0
  361. package/dist/redux/features/userSlice.ts +28 -0
  362. package/dist/redux/hooks/useSolidPopup.ts +20 -0
  363. package/dist/redux/store/defaultStoreConfig.ts +62 -0
  364. package/dist/styles.ts +4 -0
  365. package/dist/types/handlebars.d.ts +4 -0
  366. package/dist/types/index.d.ts +76 -0
  367. package/dist/types/layout.d.ts +94 -0
  368. package/dist/types/next-auth.d.ts +0 -0
  369. package/dist/types/next.d.ts +46 -0
  370. package/dist/types/solid-core.d.ts +320 -0
  371. package/package.json +1 -1
  372. package/src/components/auth/SolidLogin.tsx +26 -13
  373. package/src/nextAuth/authProviders.tsx +9 -5
@@ -0,0 +1,3509 @@
1
+ 'use client';
2
+ import CodeEditor from "../../../components/common/CodeEditor";
3
+ import { SingleSelectAutoCompleteField } from "../../../components/common/SingleSelectAutoCompleteField";
4
+ import { getSingularAndPlural } from "../../../helpers/helpers";
5
+ import { useGetFieldDefaultMetaDataQuery } from "../../../redux/api/fieldApi";
6
+ import { useLazyGetMediaStorageProvidersQuery } from "../../../redux/api/mediaStorageProviderApi";
7
+ import { useLazyGetModelsQuery, useUpdateUserKeyMutation } from "../../../redux/api/modelApi";
8
+ import { useLazyGetmodulesQuery } from "../../../redux/api/moduleApi";
9
+ import { useFormik } from "formik";
10
+ import { capitalize } from "lodash";
11
+ import { usePathname } from "next/navigation";
12
+ import { AutoComplete } from "primereact/autocomplete";
13
+ import { Button } from "primereact/button";
14
+ import { Calendar } from "primereact/calendar";
15
+ import { Checkbox } from "primereact/checkbox";
16
+ import { Dialog } from "primereact/dialog";
17
+ import { Dropdown, DropdownChangeEvent } from "primereact/dropdown";
18
+ import { InputNumber } from "primereact/inputnumber";
19
+ import { InputText } from "primereact/inputtext";
20
+ import { InputTextarea } from "primereact/inputtextarea";
21
+ import { Message } from "primereact/message";
22
+ import { MultiSelect } from "primereact/multiselect";
23
+ import { RadioButton } from "primereact/radiobutton";
24
+ import { SelectButton } from "primereact/selectbutton";
25
+ import { TabPanel, TabView } from "primereact/tabview";
26
+ import { Toast } from "primereact/toast";
27
+ import { classNames } from "primereact/utils";
28
+ import qs from "qs";
29
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
30
+ import * as Yup from "yup";
31
+ import FieldSelector from "./FieldSelector";
32
+ import { ERROR_MESSAGES } from "../../../constants/error-messages";
33
+ import { getVirtualScrollerOptions } from "../../../helpers/autoCompleteVirtualScroll";
34
+
35
+
36
+
37
+ enum SolidFieldType {
38
+ // numeric types
39
+ int = 'int',
40
+ bigint = 'bigint',
41
+ float = 'float',
42
+ // double = 'double',
43
+ decimal = 'decimal',
44
+
45
+ // text types
46
+ shortText = 'shortText',
47
+ longtext = 'longText',
48
+ richText = 'richText',
49
+ json = 'json',
50
+
51
+ // boolean types
52
+ boolean = 'boolean',
53
+
54
+ // date
55
+ date = 'date',
56
+ datetime = 'datetime',
57
+ time = 'time',
58
+
59
+ // relation
60
+ relation = 'relation',
61
+
62
+ // media
63
+ mediaSingle = 'mediaSingle',
64
+ mediaMultiple = 'mediaMultiple',
65
+
66
+ email = 'email',
67
+ password = 'password',
68
+
69
+ // selection
70
+ selectionStatic = 'selectionStatic',
71
+ selectionDynamic = 'selectionDynamic',
72
+
73
+ computed = 'computed',
74
+
75
+ uuid = 'uuid'
76
+ }
77
+
78
+ const SelectionStaticValues = ({ enumValue, onUpdate, onDelete, onAdd }: any) => {
79
+ const [value, display] = enumValue.split(":");
80
+
81
+ const handleValueChange = (newValue: string) => {
82
+ onUpdate(`${newValue}:${display || ""}`);
83
+ };
84
+
85
+ const handleDisplayChange = (newDisplay: string) => {
86
+ onUpdate(`${value || ""}:${newDisplay}`);
87
+ };
88
+
89
+ return (
90
+ <div className="flex align-items-center gap-2 mt-2">
91
+
92
+ {/* Input field for Value */}
93
+ <InputText
94
+ value={value || ""}
95
+ onChange={(e) => handleValueChange(e.target.value)}
96
+ placeholder="Value"
97
+ className="w-full"
98
+ />
99
+
100
+ {/* Input field for Display */}
101
+ <InputText
102
+ value={display || ""}
103
+ onChange={(e) => handleDisplayChange(e.target.value)}
104
+ placeholder="Display"
105
+ className="w-full"
106
+ />
107
+
108
+
109
+
110
+ {/* Plus Button to add a new row */}
111
+ <Button
112
+ icon="pi pi-plus"
113
+ size="small"
114
+ onClick={onAdd}
115
+ type="button"
116
+ />
117
+
118
+ {/* Trash Button to delete the row */}
119
+ <Button
120
+ icon="pi pi-trash"
121
+ size="small"
122
+ onClick={onDelete}
123
+ outlined
124
+ severity="danger"
125
+ type="button"
126
+ />
127
+ </div>
128
+ );
129
+
130
+ }
131
+
132
+ interface SelectComputedFieldTriggerValuesProps {
133
+ index: number;
134
+ row: {
135
+ moduleName: string;
136
+ modelName: string;
137
+ operations: string[];
138
+ };
139
+ onChange: (index: number, updatedRow: any) => void;
140
+ onDelete: (index: number) => void;
141
+ isLastRow: boolean;
142
+ disableDelete: boolean;
143
+ formik: any;
144
+ isFormFieldValid: (formik: any, field: string) => boolean;
145
+ searchModuleName: (event: any) => Promise<any[]>;
146
+ searchModelName: (event: any) => Promise<any[]>;
147
+ modelMetaData?: any,
148
+ errors?: any,
149
+ touched?: any,
150
+ }
151
+
152
+ const triggerOperationOptions = [
153
+ { label: "beforeInsert", value: "before-insert" },
154
+ { label: "afterInsert", value: "after-insert" },
155
+ { label: "beforeUpdate", value: "before-update" },
156
+ { label: "afterUpdate", value: "after-update" },
157
+ { label: "beforeRemove", value: "before-delete" },
158
+ { label: "afterRemove", value: "after-delete" },
159
+ ];
160
+
161
+ const formatDisplayName = (value: string): string => {
162
+ return value
163
+ .split('-')
164
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
165
+ .join(' ');
166
+ };
167
+
168
+
169
+ const SelectComputedFieldTriggerValues: React.FC<SelectComputedFieldTriggerValuesProps> = ({
170
+ index,
171
+ row,
172
+ onChange,
173
+ onDelete,
174
+ disableDelete,
175
+ formik,
176
+ isFormFieldValid,
177
+ searchModuleName,
178
+ searchModelName,
179
+ modelMetaData,
180
+ errors,
181
+ touched,
182
+ }: any) => {
183
+ const [filteredOperations, setFilteredOperations] = useState<{ label: string; value: string }[]>([]);
184
+
185
+ useEffect(() => {
186
+ if (!row.moduleName && modelMetaData?.module?.name) {
187
+ formik.setFieldValue(`computedFieldTriggerConfig[${index}].moduleName`, modelMetaData?.module?.name);
188
+ }
189
+ if (!row.modelName && modelMetaData?.singularName) {
190
+ formik.setFieldValue(`computedFieldTriggerConfig[${index}].modelName`, modelMetaData?.singularName);
191
+ }
192
+ }, [modelMetaData?.module?.name, modelMetaData?.singularName]);
193
+
194
+ const searchOperations = (event: any) => {
195
+ const query = event.query.toLowerCase();
196
+ setFilteredOperations(
197
+ triggerOperationOptions.filter((item) =>
198
+ item.label.toLowerCase().includes(query)
199
+ )
200
+ );
201
+ };
202
+
203
+ return (
204
+ <div className="flex align-items-start gap-3 mt-2 flex-wrap md:flex-nowrap">
205
+
206
+ <div className="">
207
+ <label
208
+ htmlFor="moduleName"
209
+ className="form-field-label"
210
+ >
211
+ Module
212
+ </label>
213
+ <div className="mt-2">
214
+ <SingleSelectAutoCompleteField
215
+ key={`moduleName-${index}`}
216
+ formik={formik}
217
+ isFormFieldValid={isFormFieldValid}
218
+ fieldName={`computedFieldTriggerConfig[${index}].moduleName`}
219
+ fieldNameId={`computedFieldTriggerConfig[${index}].moduleName`}
220
+ labelKey="displayName"
221
+ valueKey="name"
222
+ searchData={searchModuleName}
223
+ existingData={
224
+ row.moduleName
225
+ ? {
226
+ name: row.moduleName,
227
+ displayName: row.displayName || formatDisplayName(row.moduleName),
228
+ }
229
+ : modelMetaData?.module?.name
230
+ ? {
231
+ name: modelMetaData.module.name,
232
+ displayName: modelMetaData.module.displayName || formatDisplayName(modelMetaData.module.name),
233
+ }
234
+ : null
235
+ }
236
+ />
237
+ </div>
238
+ {errors?.moduleName && (
239
+ <Message severity="error" text={errors.moduleName} />
240
+ )}
241
+ </div>
242
+
243
+ <div className="">
244
+ <label
245
+ htmlFor="modelName"
246
+ className="form-field-label"
247
+ >
248
+ Model
249
+ </label>
250
+ <div className="mt-2">
251
+ <SingleSelectAutoCompleteField
252
+ key={`modelName-${index}`}
253
+ formik={formik}
254
+ isFormFieldValid={isFormFieldValid}
255
+ fieldName={`computedFieldTriggerConfig[${index}].modelName`}
256
+ fieldNameId={`computedFieldTriggerConfig[${index}].modelName`}
257
+ labelKey="displayName"
258
+ valueKey="singularName"
259
+ searchData={searchModelName}
260
+ existingData={
261
+ row.modelName
262
+ ? {
263
+ singularName: row.modelName,
264
+ displayName: row.displayName || formatDisplayName(row.modelName),
265
+ }
266
+ : modelMetaData?.singularName
267
+ ? {
268
+ singularName: modelMetaData?.singularName,
269
+ displayName: modelMetaData?.displayName || formatDisplayName(modelMetaData.displayName),
270
+ }
271
+ : null
272
+ }
273
+ />
274
+ </div>
275
+ {errors?.modelName && (
276
+ <Message severity="error" text={errors.modelName} />
277
+ )}
278
+ </div>
279
+
280
+
281
+ {/* operations */}
282
+ <div>
283
+ <label
284
+ htmlFor="operations"
285
+ className="form-field-label"
286
+ >
287
+ Operations
288
+ </label>
289
+ <div className="mt-2">
290
+ <AutoComplete
291
+ multiple
292
+ dropdown
293
+ value={triggerOperationOptions.filter(opt => (row.operations || []).includes(opt.value))}
294
+ suggestions={filteredOperations}
295
+ completeMethod={searchOperations}
296
+ field="label"
297
+ onChange={(e) =>
298
+ onChange(index, {
299
+ ...row,
300
+ operations: e.value.map((val: any) => val.value),
301
+ })
302
+ }
303
+ placeholder="Select operations"
304
+ className="solid-standard-autocomplete max-w-16rem"
305
+ />
306
+ </div>
307
+ {errors?.operations && (
308
+ <Message severity="error" text={errors.operations} />
309
+ )}
310
+ </div>
311
+
312
+ {/* Trash Button to delete the row */}
313
+ <Button
314
+ icon="pi pi-trash"
315
+ size="small"
316
+ onClick={() => onDelete(index)}
317
+ disabled={disableDelete}
318
+ outlined
319
+ severity="danger"
320
+ type="button"
321
+ />
322
+ </div>
323
+ );
324
+
325
+ }
326
+
327
+ const fieldBasedPayloadFormating = (values: any, currentFields: string[], fieldMetaData: any) => {
328
+ // const booleanFields: string | any[] = [
329
+ // "isSystem",
330
+ // "defaultValue",
331
+ // "required",
332
+ // "unique",
333
+ // "encrypt",
334
+ // "index",
335
+ // "private",
336
+ // "relationCreateInverse"];
337
+ const transformedPayload = currentFields.reduce((acc: any, key: any) => {
338
+ acc[key] = values[key]; // Set key and its value as the same string
339
+ // if (booleanFields.includes(acc[key])) {
340
+ // acc[key] = values[key] == "false" ? "" : true
341
+ // }
342
+ return acc;
343
+ }, {});
344
+ transformedPayload.displayName = transformedPayload.displayName.trim()
345
+
346
+ transformedPayload.identifier = fieldMetaData ? fieldMetaData.identifier : Date.now();
347
+ if (fieldMetaData?.id) {
348
+ transformedPayload.id = fieldMetaData.id
349
+ }
350
+ if (currentFields.includes("mediaStorageProviderId")) {
351
+ transformedPayload.mediaStorageProvider = values.mediaStorageProvider
352
+ }
353
+ if (currentFields.includes("selectionDynamicProviderCtxt")) {
354
+ const prettified = JSON.stringify(JSON.parse(values.selectionDynamicProviderCtxt), null, 2);
355
+
356
+ transformedPayload.selectionDynamicProviderCtxt = prettified
357
+ }
358
+
359
+ if (currentFields.includes("computedFieldValueProviderCtxt")) {
360
+ const prettified = JSON.stringify(JSON.parse(values.computedFieldValueProviderCtxt), null, 2);
361
+ transformedPayload.computedFieldValueProviderCtxt = prettified
362
+ }
363
+
364
+ if (currentFields.includes("computedFieldTriggerConfig")) {
365
+ // const prettified = JSON.stringify(values.computedFieldTriggerConfig, null, 2);
366
+ transformedPayload.computedFieldTriggerConfig = values.computedFieldTriggerConfig
367
+ }
368
+
369
+ if (currentFields.includes("relationCreateInverse")) {
370
+ transformedPayload.relationCreateInverse = values.relationCreateInverse == false ? false : true
371
+ }
372
+ if (transformedPayload.relationType == "many-to-one") {
373
+ transformedPayload.relationCascade = values.relationCascade;
374
+ }
375
+
376
+ if (transformedPayload.relationType == "many-to-many") {
377
+ transformedPayload.isRelationManyToManyOwner = true;
378
+ }
379
+ return transformedPayload
380
+
381
+ }
382
+
383
+ function fetchCurrentFields(solidFieldType: any, fieldDefaultMetaData: any) {
384
+
385
+ if (solidFieldType) {
386
+ const allowedFields = fieldDefaultMetaData?.data?.fieldTypes.filter((e: any) => e.fieldType === solidFieldType);
387
+ if (allowedFields.length > 0) {
388
+ return allowedFields[0].fields
389
+ }
390
+
391
+ }
392
+ return [
393
+ "name",
394
+ "displayName",
395
+ "type",
396
+ "ormType",
397
+ "required",
398
+ "unique",
399
+ "index",
400
+ "private",
401
+ "encrypt",
402
+ "isUserKey"
403
+ ];
404
+
405
+ }
406
+
407
+ const createValidationSchema = (currentFields: any, selectedType: any, allFields: any, fieldMetaData: any, encryptState: any) => {
408
+
409
+ let reservedNames;
410
+
411
+ if (fieldMetaData) {
412
+ reservedNames = allFields.length > 0 ? allFields.filter((i: any) => i.id !== fieldMetaData.id).map((f: any) => f.name) : [];
413
+ } else {
414
+
415
+ reservedNames = allFields.length > 0 ? allFields.map((f: any) => f.name) : [];
416
+ }
417
+
418
+
419
+
420
+ const schema = {
421
+ name: Yup.string()
422
+ // .matches(/^[a-z]+(-[a-z]+)*$/,"Invalid format. Use lowercase letters and hyphens only.")
423
+ .notOneOf(reservedNames, ERROR_MESSAGES.FIELD_ALREADY_USE('Name', 'name'))
424
+ .required(ERROR_MESSAGES.FIELD_REUQIRED('Name')),
425
+ displayName: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Display Name')),
426
+ description: Yup.string().nullable(),
427
+ type: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Type')),
428
+ isSystem: Yup.boolean(),
429
+ // Conditionally add validation rules based on `currentFields`
430
+ ...(currentFields.includes("ormType") && {
431
+ ormType: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Orm Type')),
432
+ }),
433
+ ...(currentFields.includes("length") && {
434
+ length: Yup.number().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Length', 'interger')).nullable(),
435
+ }),
436
+ // ...(currentFields.includes("defaultValue") && {
437
+ // defaultValue: Yup.string().required("Default Value is required"),
438
+ // }),
439
+ // Conditionally validate defaultValue based on SolidFieldType
440
+ ...(currentFields.includes("defaultValue") && {
441
+ defaultValue: Yup.mixed().nullable().when("type", (type: any) => {
442
+ switch (selectedType.value) {
443
+ case "int":
444
+ case "bigint":
445
+ return Yup.number().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Default value', 'integer'))
446
+ .integer(ERROR_MESSAGES.FIELD_MUST_BE_AN('Default value', 'integer'));
447
+ case "float":
448
+ case "decimal":
449
+ return Yup.number().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Default value', 'integer'))
450
+ case "shortText":
451
+ case "longText":
452
+ case "richText":
453
+ case "json":
454
+ return Yup.string().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Default value', 'boolean'))
455
+ case "boolean":
456
+ return Yup.boolean().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Default value', 'boolean'))
457
+ case "date":
458
+ case "datetime":
459
+ case "time":
460
+ return Yup.date().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Default value', 'Date'))
461
+ default:
462
+ return Yup.mixed().nullable(); // Default fallback if no match
463
+ }
464
+ }),
465
+ }),
466
+
467
+ // Add more conditional fields as needed
468
+
469
+ ...(currentFields.includes("regexPattern") && {
470
+ regexPattern: Yup.string(),
471
+ regexPatternNotMatchingErrorMsg: Yup.string(),
472
+ }),
473
+ ...(currentFields.includes("required") && {
474
+ required: Yup.boolean(),
475
+ }),
476
+ ...(currentFields.includes("unique") && {
477
+ unique: Yup.boolean(),
478
+ }),
479
+ ...(currentFields.includes("encrypt") && {
480
+ encrypt: Yup.boolean(),
481
+ }),
482
+ ...(currentFields.includes("encryptionType") && encryptState == true && {
483
+ encryptionType: Yup.string().required(
484
+ ERROR_MESSAGES.FIELD_REUQIRED('Encryption Type Value')
485
+ ),
486
+ }),
487
+ ...(currentFields.includes("decryptWhen") && encryptState == true && {
488
+
489
+ decryptWhen: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Decrypt When Value')),
490
+ }),
491
+ ...(currentFields.includes("index") && {
492
+ index: Yup.boolean(),
493
+ }),
494
+ // ...(currentFields.includes("min") && {
495
+ // min: Yup.number().required("Min is required"),
496
+ // }),
497
+ ...(currentFields.includes("min") && {
498
+ min: Yup.mixed().nullable()
499
+ .when("type", (type: any) => {
500
+ switch (selectedType.value) {
501
+ case "int":
502
+ return Yup.number().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Min', 'interger'))
503
+ .integer(ERROR_MESSAGES.FIELD_MUST_BE_AN('Min', 'interger'));
504
+ case "decimal":
505
+ case "shortText":
506
+ case "longText":
507
+ case "richText":
508
+ case "json":
509
+ return Yup.number().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Min', 'interger'));
510
+ default:
511
+ return Yup.mixed().nullable().nullable(); // Default fallback if no match
512
+ }
513
+ }),
514
+ }),
515
+ // ...(currentFields.includes("max") && {
516
+ // max: Yup.number().required("Max is required"),
517
+ // }),
518
+ ...(currentFields.includes("max") && {
519
+ max: Yup.mixed()
520
+ .when("type", (type: any) => {
521
+ switch (selectedType.value) {
522
+ case "int":
523
+ return Yup.number().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Max', 'interger'))
524
+ .integer(ERROR_MESSAGES.FIELD_MUST_BE_AN('Max', 'interger'))
525
+ .test(
526
+ ERROR_MESSAGES.GREATER_THAN_MIN,
527
+ ERROR_MESSAGES.FIELD_MUST_BE_AN('Max', 'greater than Min'),
528
+ function (value) {
529
+ const { min } = this.parent; // Access sibling field 'min'
530
+ // if (min != null && value == null) {
531
+ // // Trigger error if Min is filled but Max is empty
532
+ // return this.createError({
533
+ // message: "Max is required if Min is specified",
534
+ // });
535
+ // }
536
+ return value == null || value > min; // Validate only if Max exists
537
+ }
538
+ );
539
+
540
+
541
+ case "decimal":
542
+ case "shortText":
543
+ case "longText":
544
+ case "richText":
545
+ case "json":
546
+ return Yup.number().nullable().typeError(ERROR_MESSAGES.FIELD_MUST_BE_AN('Max', 'interger'))
547
+ .test(
548
+ ERROR_MESSAGES.GREATER_THAN_MIN,
549
+ ERROR_MESSAGES.FIELD_MUST_BE_AN('Max', 'greater than Min'),
550
+ function (value) {
551
+ const { min } = this.parent; // Access sibling field 'min'
552
+ // if (min != null && value == null) {
553
+ // // Trigger error if Min is filled but Max is empty
554
+ // return this.createError({
555
+ // message: "Max is required if Min is specified",
556
+ // });
557
+ // }
558
+ return value == null || value > min; // Validate only if Max exists
559
+ }
560
+ );
561
+
562
+
563
+ default:
564
+ return Yup.mixed().nullable().nullable(); // Default fallback if no match
565
+ }
566
+ }),
567
+ }),
568
+ ...(currentFields.includes("private") && {
569
+ private: Yup.boolean(),
570
+ }),
571
+ ...(currentFields.includes("mediaTypes") && {
572
+ mediaTypes: Yup.mixed().required(ERROR_MESSAGES.FIELD_MUST_BE_AN('Media Types', 'Arrays')).required(ERROR_MESSAGES.FIELD_REUQIRED('Media Types')),
573
+ }),
574
+
575
+ ...(currentFields.includes("mediaMaxSizeKb") && {
576
+ mediaMaxSizeKb: Yup.number().required(ERROR_MESSAGES.FIELD_REUQIRED('Media Max Size')),
577
+ }),
578
+ ...(currentFields.includes("mediaStorageProviderId") && {
579
+ mediaStorageProviderId: Yup.number().required(
580
+ ERROR_MESSAGES.FIELD_REUQIRED('Media Storage Provider')
581
+ ),
582
+ }),
583
+ ...(currentFields.includes("mediaStorageProviderId") && {
584
+ mediaStorageProvider: Yup.object().required(
585
+ ERROR_MESSAGES.FIELD_REUQIRED('Media Storage Provider')
586
+ ),
587
+ }),
588
+
589
+ ...(currentFields.includes("mediaEmbedded") && {
590
+ mediaEmbedded: Yup.boolean(),
591
+ }),
592
+ ...(currentFields.includes("relationType") && {
593
+ relationType: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Relation Type ')),
594
+ }),
595
+ ...(currentFields.includes("relationCoModelSingularName") && {
596
+ relationCoModelSingularName: Yup.string().required(
597
+ ERROR_MESSAGES.FIELD_REUQIRED('Relation Model Singular Name')
598
+ ),
599
+ }),
600
+ ...(currentFields.includes("relationCoModelFieldName") && {
601
+ relationCoModelFieldName: Yup.string()
602
+ // .required(
603
+ // "Relation Model Field Name is required"
604
+ // ),
605
+ }),
606
+ ...(currentFields.includes("relationCreateInverse") && {
607
+ relationCreateInverse: Yup.boolean(),
608
+ }),
609
+ ...(currentFields.includes("relationCoModelFieldName") && {
610
+ relationCoModelFieldName: Yup.string().when("relationCreateInverse", (relationCreateInverse: any, schema) => {
611
+ if (relationCreateInverse.length > 0 && relationCreateInverse[0] == true) {
612
+ return schema.required(ERROR_MESSAGES.FIELD_REUQIRED('Relation Co Model Field Name'))
613
+ } else {
614
+ return schema.notRequired();
615
+ }
616
+ }),
617
+ }),
618
+
619
+ // ...(currentFields.includes("relationCascade") && {
620
+ // relationCascade: Yup.string().required(
621
+ // "Relation Cascade Value is required"
622
+ // ),
623
+ // }),
624
+
625
+ // Conditionally validate relationCascade based on relationType
626
+ ...(currentFields.includes("relation") && {
627
+ relationCascade: Yup.string().when("relationType", (relationType: any, schema) => {
628
+ return relationType === "one-to-one"
629
+ ? schema.required(ERROR_MESSAGES.RELATION_CASCADE)
630
+ : schema.notRequired();
631
+ }),
632
+ }),
633
+
634
+
635
+ ...(currentFields.includes("relationModelModuleName") && {
636
+ relationModelModuleName: Yup.string().required(
637
+ ERROR_MESSAGES.FIELD_REUQIRED('Relation Model Module Name Value')
638
+ ),
639
+ }),
640
+
641
+ ...(currentFields.includes("relationFieldFixedFilter") && {
642
+ relationFieldFixedFilter: Yup.string().nullable(),
643
+ }),
644
+
645
+ ...(currentFields.includes("selectionDynamicProvider") && {
646
+ selectionDynamicProvider: Yup.string().required(
647
+ ERROR_MESSAGES.FIELD_REUQIRED('Selection Dynamic Provider Value ')
648
+ ),
649
+ }),
650
+ ...(currentFields.includes("selectionDynamicProviderCtxt") && {
651
+ selectionDynamicProviderCtxt: Yup.string().required(
652
+ ERROR_MESSAGES.FIELD_REUQIRED('Selection Dynamic Provider Context Value')
653
+ ).test(
654
+ ERROR_MESSAGES.IS_VALID_JSON,
655
+ ERROR_MESSAGES.COMPUTED_FIELD_VALIDATE_JSON,
656
+ (value) => {
657
+ if (!value) return false; // Ensure it's required
658
+ try {
659
+ JSON.parse(value); // Check if it's valid JSON
660
+ return true;
661
+ } catch {
662
+ return false;
663
+ }
664
+ }
665
+ ),
666
+ }),
667
+
668
+ ...(currentFields.includes("selectionStaticValues") && {
669
+ selectionStaticValues: Yup.array().of(
670
+ Yup.string().matches(/^[\w\s\d-]+:[\w\s-]+$/, ERROR_MESSAGES.FIELD_REUQIRED('Label and Value'))
671
+ ),
672
+ }),
673
+ ...(currentFields.includes("computedFieldValueProvider") && {
674
+ computedFieldValueProvider: Yup.string().required(
675
+ ERROR_MESSAGES.FIELD_REUQIRED('Computed Field Function Value')
676
+ ),
677
+ }),
678
+ ...(currentFields.includes("computedFieldValueProviderCtxt") && {
679
+ computedFieldValueProviderCtxt: Yup.string().required(
680
+ ERROR_MESSAGES.FIELD_REUQIRED('"Computed Field Value Provider Context Value')
681
+ ).test(
682
+ ERROR_MESSAGES.IS_VALID_JSON,
683
+ ERROR_MESSAGES.COMPUTED_FIELD_VALIDATE_JSON,
684
+ (value) => {
685
+ if (!value) return false; // Ensure it's required
686
+ try {
687
+ JSON.parse(value); // Check if it's valid JSON
688
+ return true;
689
+ } catch {
690
+ return false;
691
+ }
692
+ }
693
+ ),
694
+
695
+ }),
696
+ ...(currentFields.includes("computedFieldValueType") && {
697
+ computedFieldValueType: Yup.string().required(
698
+ ERROR_MESSAGES.FIELD_REUQIRED('Computed Field Value Type')
699
+ ),
700
+ }),
701
+ ...(currentFields.includes("computedFieldTriggerConfig") && {
702
+ computedFieldTriggerConfig: Yup.array()
703
+ .of(
704
+ Yup.object().shape({
705
+ moduleName: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Module name')),
706
+ modelName: Yup.string().required(ERROR_MESSAGES.FIELD_REUQIRED('Model name')),
707
+ operations: Yup.array().of(Yup.string()).min(1, ERROR_MESSAGES.SELECT_ONE_OPERATION),
708
+ })
709
+ )
710
+ .min(1, ERROR_MESSAGES.FIELD_REUQIRED('At least one trigger config'))
711
+ .required(ERROR_MESSAGES.FIELD_REUQIRED('Computed Field Trigger Config')),
712
+ }),
713
+
714
+ // ...(currentFields.includes("columnName") && { columnName: Yup.string().nullable().matches(/^[a-z0-9_]+$/, ERROR_MESSAGES.SNAKE_CASE('column')), }),
715
+ ...(currentFields.includes("isPrimaryKey") && { isPrimaryKey: Yup.boolean(), }),
716
+
717
+
718
+
719
+
720
+ // ...(currentFields.includes("externalIdProvider") && {
721
+ // externalIdProvider: Yup.string().required(
722
+ // "ExternalId Provider Value is required"
723
+ // ),
724
+ // }),
725
+ // ...(currentFields.includes("externalIdProviderCtxt") && {
726
+ // externalIdProviderCtxt: Yup.string().required(
727
+ // "EexternalId Provider Context Value is required"
728
+ // ),
729
+ // }),
730
+ };
731
+
732
+ return Yup.object(schema);
733
+ };
734
+
735
+ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldMetaData, allFields, deleteModelFunction, setVisiblePopup, params, setIsRequiredPopUp, showToaster }: any) => {
736
+ const booleanOptions = ["false", "true"];
737
+ const [isBackPopupVisible, setIsBackPopupVisible] = useState(false);
738
+ const [showColumnName, setShowColumnName] = useState<any>(false);
739
+
740
+ const pathname = usePathname();
741
+
742
+ const toast = useRef<Toast>(null);
743
+ const { data: fieldDefaultMetaData, isLoading, error, refetch } = useGetFieldDefaultMetaDataQuery(null);
744
+ const [currentFields, setCurrentFields] = useState(
745
+ fetchCurrentFields(fieldMetaData && fieldMetaData.type, fieldDefaultMetaData)
746
+ );
747
+
748
+ const [triggerGetMediaStorageProvider, { data: MediaStorageProviderData, isFetching: isMediaStorageProviderFetching, error: MediaStorageProviderError }] = useLazyGetMediaStorageProvidersQuery();
749
+ const [triggerGetModules, { data: moduleData, isFetching: isModuleFetching, error: moduleError }] = useLazyGetmodulesQuery();
750
+ const [triggerGetModels, { data: modelData, isFetching: ismodelFetching, error: modelError }] = useLazyGetModelsQuery();
751
+ const [
752
+ updateUserKey,
753
+ { isLoading: isUpdateUserKeyLoading, isSuccess: isUpdateUserKeySuccess, isError: isUpdateUserKeyError, error: UpdateUserKeyError, data: newModel },
754
+ ] = useUpdateUserKeyMutation();
755
+
756
+
757
+ const [markdownText, setMarkdownText] = useState<string>();
758
+ const [encryptState, setEncryptState] = useState<any>(false);
759
+
760
+ const [showTypeFilter, setShowTypeFilter] = useState(fieldMetaData ? false : true);
761
+ const [selectedType, setSelectedType] = useState(fieldMetaData?.type && { label: fieldMetaData?.type, value: fieldMetaData?.type });
762
+ const [selectedComputedFieldValueType, setSelectedComputedFieldValueType] = useState(fieldMetaData?.computedFieldValueType && { label: fieldMetaData.computedFieldValueType, value: fieldMetaData.computedFieldValueType });
763
+ const [selectionDynamicProvider, setSelectionDynamicProvider] = useState(fieldMetaData?.selectionDynamicProvider && { label: fieldMetaData.selectionDynamicProvider, value: fieldMetaData.selectionDynamicProvider });
764
+ // const [externalIdProvider, setExternalIdProvider] = useState(fieldMetaData?.externalIdProvider && { label: fieldMetaData.externalIdProvider, value: fieldMetaData.externalIdProvider });
765
+ const [selectionStaticValues, setSelectionStaticValues] = useState(fieldMetaData && fieldMetaData.selectionStaticValues && fieldMetaData.selectionStaticValues.length > 0 && fieldMetaData?.selectionStaticValues.filter((line: any) => line.trim() !== "").join("\n"));
766
+ const [filteredComputedFieldValueTypes, setFilteredComputedFieldValueTypes] = useState([]);
767
+ const [
768
+ filteredSelectionDynamicProvider,
769
+ setFilteredSelectionDynamicProvider,
770
+ ] = useState([]);
771
+
772
+ const [ormTypeOptions, setOrmTypeOptions] = useState([]);
773
+ const [selectedOrmType, setSelectedOrmType] = useState<any>(fieldMetaData?.ormType);
774
+
775
+ const [askForUserKeyField, setAskForUserKeyField] = useState(false);
776
+ const [userKeyFieldData, setUserKeyFieldData] = useState([]);
777
+
778
+ const [
779
+ filteredExternalIdProvider,
780
+ setFilteredExternalIdProvider,
781
+ ] = useState([]);
782
+
783
+ const [filteredSelectionEncryptionType, setFilteredSelectionEncryptionType] = useState([]);
784
+
785
+ const [filteredSelectionDecryptWhen, setFilteredSelectionDecryptWhen] = useState([]);
786
+
787
+ const items = Array.from({ length: 100000 }).map((_, i) => ({
788
+ label: `Item #${i}`,
789
+ value: i,
790
+ }));
791
+
792
+ const validationSchema = React.useMemo(
793
+ () => createValidationSchema(currentFields, selectedType, allFields, fieldMetaData, encryptState),
794
+ [currentFields, encryptState]
795
+ );
796
+
797
+ const [typeSelected, setTypeSelected] = useState(false);
798
+
799
+
800
+ const searchMediaTypes = async (event: any) => {
801
+ const query = event.query;
802
+ try {
803
+ const suggestionData: any = fieldDefaultMetaData.data.mediaTypes.filter((t: any) => t.label.toLowerCase().startsWith(query.toLowerCase()));
804
+ return suggestionData;
805
+ } catch (error) {
806
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
807
+ return []
808
+ }
809
+ };
810
+
811
+ const searchMediaStorageProvIderId = async (event: any) => {
812
+ try {
813
+ const query = event.query;
814
+ const queryData = {
815
+ limit: 10,
816
+ offset: 0,
817
+ // filters: {
818
+ // name: {
819
+ // $containsi: query,
820
+ // },
821
+ // },
822
+ };
823
+
824
+ const queryString = qs.stringify(queryData, {
825
+ encodeValuesOnly: true,
826
+ });
827
+
828
+ const result = await triggerGetMediaStorageProvider(queryString).unwrap();
829
+
830
+ if (result && result.records) {
831
+ const updatedSuggestion = [...result.records];
832
+ return updatedSuggestion
833
+ } else {
834
+ return []
835
+ }
836
+ } catch (error) {
837
+ return []
838
+ }
839
+ };
840
+
841
+
842
+ const searchModel = async (event: any) => {
843
+ const query = event.query;
844
+ const queryData = {
845
+ limit: 10,
846
+ offset: 0,
847
+ // filters: {
848
+ // title: {
849
+ // $containsi: query
850
+ // }
851
+ // }
852
+ };
853
+
854
+ const queryString = qs.stringify(queryData, {
855
+ encodeValuesOnly: true
856
+ });
857
+
858
+ // Trigger the API call manually
859
+ const result = await triggerGetModels(queryString).unwrap(); // Unwrap to access the data
860
+
861
+ // Map the API response to AutoComplete format
862
+ if (result && result.records) {
863
+ const filteredMenu = result.records.map((m: any) => (
864
+ {
865
+ label: m.name,
866
+ value: m.id,
867
+ name: m.name,
868
+ id: m.id,
869
+ }
870
+ ));
871
+
872
+ // Update the suggestions in state
873
+ return filteredMenu
874
+ } else {
875
+ // Handle the case where no data is returned
876
+ return []
877
+ }
878
+ };
879
+
880
+
881
+
882
+
883
+ const searchOrmTypes = async (event: any) => {
884
+ const query = event.query;
885
+ try {
886
+
887
+ const ormType = fieldDefaultMetaData.data.ormType[modelMetaData?.dataSourceType];
888
+ const _filteredOrmType = ormType[formik.values.type].ormTypes.map((e: any) => ({ label: e, value: e }))
889
+
890
+ const suggestionData: any = _filteredOrmType.filter((t: any) => t.label.toLowerCase().startsWith(query.toLowerCase()));
891
+ return suggestionData
892
+ } catch (error) {
893
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
894
+ return []
895
+ }
896
+ };
897
+
898
+
899
+
900
+
901
+ const searchRelationModelModuleNames = async (event: any) => {
902
+ try {
903
+ const query = event.query;
904
+ const queryData = {
905
+ limit: 10,
906
+ offset: 0,
907
+ filters: {
908
+ name: {
909
+ $containsi: query,
910
+ },
911
+ },
912
+ };
913
+
914
+ const queryString = qs.stringify(queryData, {
915
+ encodeValuesOnly: true,
916
+ });
917
+
918
+ const result = await triggerGetModules(queryString).unwrap(); // Unwrap to access the data
919
+
920
+ if (result && result.records) {
921
+ const updatedSuggestion = [...result.records];
922
+ return updatedSuggestion
923
+ } else {
924
+ return []
925
+ }
926
+ } catch (error) {
927
+ return []
928
+ }
929
+ };
930
+
931
+ const searchrelationCoModelSingularNames = async (event: any) => {
932
+ try {
933
+ const query = event.query;
934
+ const queryData: any = {
935
+ limit: 10,
936
+ offset: 0,
937
+ filters: {
938
+ module: {
939
+ name: {
940
+ $containsi: formik.values.relationModelModuleName
941
+ }
942
+ }
943
+ }
944
+ };
945
+ if (query) {
946
+ queryData.filters.singularName = {
947
+ $containsi: query,
948
+ };
949
+ }
950
+ const queryString = qs.stringify(queryData, {
951
+ encodeValuesOnly: true,
952
+ });
953
+
954
+ const result = await triggerGetModels(queryString).unwrap(); // Unwrap to access the data
955
+
956
+ if (result && result.records) {
957
+ const updatedSuggestion = [...result.records];
958
+ return updatedSuggestion
959
+ } else {
960
+ return []
961
+ }
962
+ } catch (error) {
963
+ return []
964
+ }
965
+ };
966
+
967
+ const searchModuleName = async (event: any) => {
968
+ try {
969
+ const query = event.query;
970
+ const queryData = {
971
+ limit: 10,
972
+ offset: 0,
973
+ filters: {
974
+ name: {
975
+ $containsi: query,
976
+ },
977
+ },
978
+ };
979
+
980
+ const queryString = qs.stringify(queryData, {
981
+ encodeValuesOnly: true,
982
+ });
983
+
984
+ const result = await triggerGetModules(queryString).unwrap(); // Unwrap to access the data
985
+
986
+ if (result && result.records) {
987
+ const updatedSuggestion = [...result.records];
988
+ return updatedSuggestion
989
+ } else {
990
+ return []
991
+ }
992
+ } catch (error) {
993
+ return []
994
+ }
995
+ };
996
+
997
+ const getSearchModelNameHandler = useCallback(
998
+ (moduleName: string) => {
999
+ return async (event: any) => {
1000
+ try {
1001
+ const query = event.query;
1002
+ const queryData: any = {
1003
+ limit: 10,
1004
+ offset: 0,
1005
+ filters: {
1006
+ module: {
1007
+ name: {
1008
+ $containsi: moduleName,
1009
+ },
1010
+ },
1011
+ },
1012
+ };
1013
+
1014
+ if (query) {
1015
+ queryData.filters.singularName = {
1016
+ $containsi: query,
1017
+ };
1018
+ }
1019
+
1020
+ const queryString = qs.stringify(queryData, { encodeValuesOnly: true });
1021
+ const result = await triggerGetModels(queryString).unwrap();
1022
+ return result?.records ?? [];
1023
+ } catch (error) {
1024
+ return [];
1025
+ }
1026
+ };
1027
+ },
1028
+ [] // or include dependencies like triggerGetModels if needed
1029
+ );
1030
+
1031
+ const searchUserKeyField = () => {
1032
+ return userKeyFieldData;
1033
+ }
1034
+
1035
+ const searchComputedFieldValueType = async (event: any) => {
1036
+ const query = event.query;
1037
+ try {
1038
+
1039
+ const _filteredTypes: any = fieldDefaultMetaData.data.computedFieldValueTypes.filter((t: any) => t.label.toLowerCase().startsWith(query.toLowerCase()));
1040
+
1041
+ setFilteredComputedFieldValueTypes(_filteredTypes);
1042
+ } catch (error) {
1043
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
1044
+ setFilteredComputedFieldValueTypes([]);
1045
+ }
1046
+ };
1047
+
1048
+
1049
+
1050
+ const searchSelectionDynamicProvider = async (event: any) => {
1051
+ const query = event.query;
1052
+ try {
1053
+ const filterredData: any = fieldDefaultMetaData.data.selectionDynamicProviders.filter((t: any) => t.provider.toLowerCase().startsWith(query.toLowerCase()));
1054
+ const transformedData = filterredData.map((e: any) => ({ label: e.provider, value: e.provider, help: e.help }));
1055
+ return transformedData
1056
+ } catch (error) {
1057
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
1058
+ return []
1059
+ }
1060
+ };
1061
+
1062
+
1063
+
1064
+ const searchComputedProvider = async (event: any) => {
1065
+ const query = event.query;
1066
+ try {
1067
+ const filterredData: any = fieldDefaultMetaData.data.computedProviders.filter((t: any) => t.provider.toLowerCase().startsWith(query.toLowerCase()));
1068
+ const transformedData = filterredData.map((e: any) => ({ label: e.provider, value: e.provider, help: e.help }));
1069
+ return transformedData
1070
+ } catch (error) {
1071
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
1072
+ return []
1073
+ }
1074
+ };
1075
+
1076
+ const searchExternalIdProvider = async (event: any) => {
1077
+ const query = event.query;
1078
+ try {
1079
+ const filterredData: any = fieldDefaultMetaData.data.externalIdProviders.filter((t: any) => t.provider.toLowerCase().startsWith(query.toLowerCase()));
1080
+ const transformedData = filterredData.map((e: any) => ({ label: e.provider, value: e.provider, help: e.help }));
1081
+ return transformedData
1082
+ } catch (error) {
1083
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
1084
+ return []
1085
+ }
1086
+ };
1087
+
1088
+
1089
+
1090
+ const searchSelectionEncryptionType = async (event: any) => {
1091
+ const query = event.query;
1092
+ try {
1093
+
1094
+ const _filteredTypes: any = fieldDefaultMetaData.data.encryptionTypes.filter((t: any) => t.label.toLowerCase().startsWith(query.toLowerCase()));
1095
+
1096
+ setFilteredSelectionEncryptionType(_filteredTypes);
1097
+ return _filteredTypes
1098
+ } catch (error) {
1099
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
1100
+ setFilteredSelectionEncryptionType([]);
1101
+ return []
1102
+ }
1103
+ };
1104
+
1105
+ const searchSelectionDecryptWhen = async (event: any) => {
1106
+ const query = event.query;
1107
+ try {
1108
+
1109
+ const _filteredTypes: any = fieldDefaultMetaData.data.decryptWhenTypes.filter((t: any) => t.label.toLowerCase().startsWith(query.toLowerCase()));
1110
+
1111
+ setFilteredSelectionDecryptWhen(_filteredTypes);
1112
+ return _filteredTypes
1113
+ } catch (error) {
1114
+ console.error(ERROR_MESSAGES.FETCHING_ITEMS, error);
1115
+ setFilteredSelectionDecryptWhen([]);
1116
+ return []
1117
+ }
1118
+ };
1119
+
1120
+
1121
+ const isFormFieldValid = (formik: any, fieldName: string) => {
1122
+ return formik.touched[fieldName] && formik.errors[fieldName];
1123
+ };
1124
+
1125
+
1126
+ const mediaStorageProviderId = [
1127
+ { label: "mediaStorageProviderId", value: "mediaStorageProviderId" },
1128
+ { label: "id2", value: "2" },
1129
+ ];
1130
+
1131
+ const selctionValueTypes = [
1132
+ { label: "String", value: "string" },
1133
+ { label: "Int", value: "int" },
1134
+ ];
1135
+
1136
+
1137
+ const relationCreateInverses = [
1138
+ { label: "True", value: "true" },
1139
+ { label: "False", value: "false" },
1140
+ ];
1141
+
1142
+ const [selectedPasswordPolicy, setSelectedPasswordPolicy] = useState<any>(fieldMetaData?.regexPattern);
1143
+ const passwordPolicyOptions = [
1144
+ { label: 'Lowercase and Uppercase Alphabets Required', value: '^(?=.*[a-z])(?=.*[A-Z]).*$' },
1145
+ { label: 'Lowercase and Uppercase Alphabets and Numbers Required', value: '^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).*$' },
1146
+ { label: 'Lowercase and Uppercase Alphabets, Numbers, and Special Characters Required', value: '^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&]).*$' },
1147
+ { label: 'custom', value: 'custom' },
1148
+
1149
+ ];
1150
+
1151
+ const mediaTypesOptions = [
1152
+ { label: 'Image (Supports JPEG, PNG, WEBP, etc.)', value: 'image' },
1153
+ { label: 'Audio (Supports MP3, WAV, AAC, etc.)', value: 'audio' },
1154
+ { label: 'Video (Supports MP4, AVI, MKV, etc.)', value: 'video' },
1155
+ { label: 'File (Supports PDF, DOCX, TXT, etc.)', value: 'file' }
1156
+ ];
1157
+
1158
+
1159
+ const parseComputedFieldTriggerConfig = (input: any) => {
1160
+ try {
1161
+ if (typeof input === "string") {
1162
+ const parsed = JSON.parse(input);
1163
+ return Array.isArray(parsed) ? parsed : [parsed];
1164
+ } else if (Array.isArray(input)) {
1165
+ return input;
1166
+ } else if (typeof input === "object" && input !== null) {
1167
+ return [input];
1168
+ }
1169
+ } catch {
1170
+ return [{ moduleName: "", modelName: "", operations: [] }];
1171
+ }
1172
+
1173
+ return [{ moduleName: "", modelName: "", operations: [] }];
1174
+ };
1175
+
1176
+
1177
+ const initialValues = {
1178
+ name: fieldMetaData ? fieldMetaData?.name : null,
1179
+ displayName: fieldMetaData ? fieldMetaData?.displayName : null,
1180
+ description: fieldMetaData ? fieldMetaData?.description : null,
1181
+ type: fieldMetaData ? fieldMetaData?.type : null,
1182
+ ormType: fieldMetaData ? fieldMetaData?.ormType : null,
1183
+ length: fieldMetaData ? fieldMetaData?.length : null,
1184
+ defaultValue: fieldMetaData ? fieldMetaData?.defaultValue : null,
1185
+ regexPattern: fieldMetaData ? fieldMetaData?.regexPattern : null,
1186
+ regexPatternNotMatchingErrorMsg: fieldMetaData ? fieldMetaData?.regexPatternNotMatchingErrorMsg : "Invalid regex pattern",
1187
+ required: fieldMetaData ? fieldMetaData?.required : false,
1188
+ unique: fieldMetaData ? fieldMetaData?.unique : false,
1189
+ encrypt: fieldMetaData ? fieldMetaData?.encrypt : false,
1190
+ encryptionType: fieldMetaData ? fieldMetaData?.encryptionType : null,
1191
+ decryptWhen: fieldMetaData ? fieldMetaData?.decryptWhen : null,
1192
+ index: fieldMetaData ? fieldMetaData?.index : false,
1193
+ min: fieldMetaData ? fieldMetaData?.min : null,
1194
+ max: fieldMetaData ? fieldMetaData?.max : null,
1195
+ private: fieldMetaData ? fieldMetaData?.private : false,
1196
+ mediaTypes: fieldMetaData ? fieldMetaData?.mediaTypes : null,
1197
+ mediaMaxSizeKb: fieldMetaData ? fieldMetaData?.mediaMaxSizeKb : null,
1198
+ mediaStorageProviderId: fieldMetaData ? fieldMetaData?.mediaStorageProvider?.id : null,
1199
+ mediaStorageProvider: fieldMetaData ? fieldMetaData?.mediaStorageProvider : null,
1200
+ mediaEmbedded: fieldMetaData ? (fieldMetaData?.mediaEmbedded && fieldMetaData?.mediaEmbedded.toString()) : "true",
1201
+ relationType: fieldMetaData ? fieldMetaData?.relationType : null,
1202
+ relationCoModelSingularName: fieldMetaData ? fieldMetaData?.relationCoModelSingularName : null,
1203
+ relationCoModelFieldName: fieldMetaData ? fieldMetaData?.relationCoModelFieldName : null,
1204
+ relationCreateInverse: fieldMetaData ? fieldMetaData?.relationCreateInverse : false,
1205
+ relationCascade: fieldMetaData ? fieldMetaData?.relationCascade : 'cascade',
1206
+ relationModelModuleName: fieldMetaData ? fieldMetaData?.relationModelModuleName : modelMetaData?.module.name,
1207
+ relationFieldFixedFilter: fieldMetaData ? fieldMetaData?.relationFieldFixedFilter : "",
1208
+ selectionDynamicProvider: fieldMetaData ? fieldMetaData?.selectionDynamicProvider : null,
1209
+ selectionDynamicProviderCtxt: fieldMetaData ? fieldMetaData?.selectionDynamicProviderCtxt : "",
1210
+ selectionStaticValues: fieldMetaData ? fieldMetaData?.selectionStaticValues : [""],
1211
+ selectionValueType: fieldMetaData ? fieldMetaData?.selectionValueType : null,
1212
+ computedFieldValueProvider: fieldMetaData ? fieldMetaData?.computedFieldValueProvider : null,
1213
+ computedFieldValueType: fieldMetaData ? fieldMetaData?.computedFieldValueType : null,
1214
+ computedFieldTriggerConfig: parseComputedFieldTriggerConfig(fieldMetaData?.computedFieldTriggerConfig),
1215
+ computedFieldValueProviderCtxt: fieldMetaData ? fieldMetaData?.computedFieldValueProviderCtxt : "",
1216
+ // externalIdProvider: fieldMetaData ? fieldMetaData?.externalIdProvider : null,
1217
+ // externalIdProviderCtxt: fieldMetaData ? fieldMetaData?.externalIdProviderCtxt : "",
1218
+ isSystem: fieldMetaData ? fieldMetaData?.isSystem : false,
1219
+ columnName: fieldMetaData ? fieldMetaData?.columnName : null,
1220
+ isUserKey: fieldMetaData ? fieldMetaData?.isUserKey : false,
1221
+ relationCoModelColumnName: fieldMetaData ? fieldMetaData?.relationCoModelColumnName : null,
1222
+ relationJoinTableName: fieldMetaData ? fieldMetaData?.relationJoinTableName : null,
1223
+ userKey: fieldMetaData ? fieldMetaData?.userKey : null,
1224
+ enableAuditTracking: fieldMetaData ? fieldMetaData?.enableAuditTracking : true,
1225
+ isPrimaryKey: fieldMetaData ? fieldMetaData?.isPrimaryKey : false,
1226
+ isMultiSelect: fieldMetaData ? fieldMetaData?.isMultiSelect : false,
1227
+ };
1228
+
1229
+
1230
+ const formik = useFormik({
1231
+ initialValues,
1232
+ validationSchema,
1233
+ enableReinitialize: true,
1234
+ onSubmit: async (values) => {
1235
+ try {
1236
+ setFieldMetaData((prevItems: any) => {
1237
+ const newFieldData = { ...values, isSystem: values.isSystem == true ? true : '' }
1238
+ const formtatedFieldPayload = fieldBasedPayloadFormating(newFieldData, currentFields, fieldMetaData);
1239
+ const existingIndex = prevItems.findIndex((item: any) => item.identifier === formtatedFieldPayload.identifier);
1240
+ if (existingIndex !== -1) {
1241
+ const updatedItems = [...prevItems];
1242
+ updatedItems[existingIndex] = formtatedFieldPayload;
1243
+ return updatedItems
1244
+ }
1245
+ else {
1246
+ if (params?.id !== 'new' && formtatedFieldPayload?.required && !formtatedFieldPayload?.defaultValue) {
1247
+ setIsRequiredPopUp(true);
1248
+ }
1249
+ return [...prevItems, formtatedFieldPayload]
1250
+ }
1251
+ });
1252
+ if (values.userKey) {
1253
+ const data = {
1254
+ modelName: values.relationCoModelSingularName,
1255
+ fieldName: values.userKey
1256
+ }
1257
+ updateUserKey(data);
1258
+ }
1259
+ // nextTab()
1260
+ setVisiblePopup(false);
1261
+
1262
+ } catch (err) {
1263
+ console.error(ERROR_MESSAGES.CREATE_MODEL, err);
1264
+ }
1265
+ },
1266
+ validateOnBlur: false // Disable validation on blur
1267
+
1268
+
1269
+
1270
+ });
1271
+
1272
+ const showError = async () => {
1273
+ const errors = await formik.validateForm(); // Trigger validation and get the updated errors
1274
+ const errorMessages = Object.values(errors);
1275
+
1276
+
1277
+ if (errorMessages.length > 0) {
1278
+ toast?.current?.show({
1279
+ severity: "error",
1280
+ summary: ERROR_MESSAGES.SEND_REPORT,
1281
+ // sticky: true,
1282
+ life: 3000,
1283
+ //@ts-ignore
1284
+ content: (props) => (
1285
+ <div
1286
+ className="flex flex-column align-items-left"
1287
+ style={{ flex: "1" }}
1288
+ >
1289
+ {errorMessages.map((m, index) => (
1290
+ <div className="flex align-items-center gap-2" key={index}>
1291
+ <span className="font-bold text-900">{String(m)}</span>
1292
+ </div>
1293
+ ))}
1294
+ </div>
1295
+ ),
1296
+ });
1297
+ }
1298
+ };
1299
+
1300
+ useEffect(() => {
1301
+ if (isUpdateUserKeySuccess) {
1302
+ showToaster([newModel?.data?.message], "success");
1303
+ } if (isUpdateUserKeyError) {
1304
+ showToaster(UpdateUserKeyError, 'error')
1305
+ }
1306
+ }, [isUpdateUserKeySuccess, isUpdateUserKeyError])
1307
+
1308
+ const handleTypeSelect = (e: any, label: string) => {
1309
+
1310
+ setShowTypeFilter(false);
1311
+ setSelectedType({ label: label, value: e });
1312
+ formik.setFieldValue("type", e);
1313
+ if (e == "email") {
1314
+ formik.setFieldValue("regexPattern", "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$");
1315
+ } else {
1316
+ formik.setFieldValue("regexPattern", "");
1317
+ }
1318
+ const ormType = fieldDefaultMetaData.data.ormType[modelMetaData?.dataSourceType];
1319
+ const availableOrmTypes = ormType[e];
1320
+ // setFilteredOrmTypes(availableOrmTypes.ormTypes.map((e: any) => ({
1321
+ // label: e,
1322
+ // value: e,
1323
+ // })));
1324
+ // setSelectedOrmType({ label: availableOrmTypes.ormTypes[0], value: availableOrmTypes.ormTypes[0] });
1325
+ setOrmTypeOptions(availableOrmTypes.ormTypes)
1326
+ formik.setFieldValue("ormType", availableOrmTypes.ormTypes[0].label);
1327
+ setSelectedOrmType(availableOrmTypes.ormTypes[0].label)
1328
+ setCurrentFields(
1329
+ fetchCurrentFields(e, fieldDefaultMetaData)
1330
+ );
1331
+ // setTypeSelected(true);
1332
+ }
1333
+
1334
+
1335
+ useEffect((() => {
1336
+ setOrmTypeOptions(fieldDefaultMetaData && formik.values.type && fieldDefaultMetaData.data.ormType[modelMetaData?.dataSourceType][formik.values.type].ormTypes);
1337
+ }), [formik])
1338
+
1339
+
1340
+ useEffect(() => {
1341
+ if (fieldMetaData && fieldMetaData.columnName) {
1342
+ setShowColumnName(true)
1343
+ }
1344
+ }, [fieldMetaData])
1345
+
1346
+ useEffect(() => {
1347
+ const fetchFields = async () => {
1348
+ const queryData: any = {
1349
+ limit: 100,
1350
+ offset: 0,
1351
+ filters: {
1352
+ singularName: {
1353
+ $eq: formik.values.relationCoModelSingularName
1354
+ }
1355
+ },
1356
+ populate: ['fields']
1357
+ };
1358
+ const queryString = qs.stringify(queryData, {
1359
+ encodeValuesOnly: true,
1360
+ });
1361
+ const result = await triggerGetModels(queryString).unwrap();
1362
+
1363
+ if (result && result.records) {
1364
+ if (!result?.records[0]?.userKeyField) {
1365
+ setAskForUserKeyField(true);
1366
+ const validUserKeyFields = result?.records[0]?.fields?.filter(
1367
+ (field: any) => field?.unique === true && field?.type === 'shortText'
1368
+ );
1369
+ setUserKeyFieldData(validUserKeyFields)
1370
+ } else {
1371
+ setAskForUserKeyField(false);
1372
+ setUserKeyFieldData([]);
1373
+ }
1374
+ }
1375
+ }
1376
+ if (formik.values.relationCoModelSingularName) {
1377
+ fetchFields();
1378
+ }
1379
+ }, [formik.values.relationCoModelSingularName])
1380
+
1381
+ const updateEnumValues = (index: number, updatedString: string) => {
1382
+ const updatedValues = formik.values.selectionStaticValues.map((enumValue: string, i: number) =>
1383
+ i === index ? updatedString : enumValue
1384
+ );
1385
+ formik.setFieldValue("selectionStaticValues", updatedValues);
1386
+ };
1387
+
1388
+ const addEnumValue = () => {
1389
+ formik.setFieldValue("selectionStaticValues", [...formik.values.selectionStaticValues, ":"]);
1390
+ };
1391
+
1392
+ const deleteEnumValue = (index: number) => {
1393
+ if (formik.values.selectionStaticValues.length > 1) {
1394
+ const updatedRows = formik.values.selectionStaticValues.filter((_: string, rowIndex: number) => rowIndex !== index);
1395
+ formik.setFieldValue("selectionStaticValues", updatedRows);
1396
+ } else {
1397
+
1398
+ }
1399
+ };
1400
+
1401
+ useEffect(() => {
1402
+ if (formik.dirty) {
1403
+ setIsDirty(true);
1404
+ }
1405
+ }, [formik.dirty]);
1406
+
1407
+ const handleChange = (index: number, updatedRow: any) => {
1408
+ const updatedRows = [...formik.values.computedFieldTriggerConfig];
1409
+ updatedRows[index] = updatedRow;
1410
+ formik.setFieldValue("computedFieldTriggerConfig", updatedRows);
1411
+ };
1412
+
1413
+ const handleAdd = () => {
1414
+ const updatedRows = [
1415
+ ...formik.values.computedFieldTriggerConfig,
1416
+ { moduleName: '', modelName: '', operations: [] }
1417
+ ];
1418
+ formik.setFieldValue("computedFieldTriggerConfig", updatedRows);
1419
+ };
1420
+
1421
+ const handleDelete = (index: number) => {
1422
+ const updatedRows = formik.values.computedFieldTriggerConfig.filter((_: any, i: number) => i !== index);
1423
+ formik.setFieldValue("computedFieldTriggerConfig", updatedRows.length > 0 ? updatedRows : [{ moduleName: '', modelName: '', operations: [] }]);
1424
+ };
1425
+
1426
+ console.log("formik.values.computedFieldTriggerConfig", formik.values.computedFieldTriggerConfig);
1427
+
1428
+ const computedFieldSearchHandlers = useMemo(() => {
1429
+ return formik.values.computedFieldTriggerConfig.map(row =>
1430
+ getSearchModelNameHandler(row.moduleName)
1431
+ );
1432
+ }, [formik.values.computedFieldTriggerConfig]);
1433
+
1434
+
1435
+ return (
1436
+ <div>
1437
+ <Toast ref={toast} />
1438
+ <div>
1439
+ <form onSubmit={formik.handleSubmit}>
1440
+ <div className="solid-field-metadata-form-header">
1441
+ {pathname.includes('create') ?
1442
+ <>
1443
+ <div className="flex align-items-center gap-3">
1444
+ {showTypeFilter === false ?
1445
+ <>
1446
+ <Button
1447
+ text
1448
+ icon='pi pi-arrow-left'
1449
+ size="small"
1450
+ type="button"
1451
+ aria-label="Back"
1452
+ className='max-w-2rem bg-primary-reverse text-color solid-icon-button'
1453
+ onClick={() => {
1454
+ if (!formik.values.displayName) {
1455
+ setShowTypeFilter(true)
1456
+ } else {
1457
+ setIsBackPopupVisible(true)
1458
+ }
1459
+ }
1460
+ }
1461
+ />
1462
+ <div className="form-wrapper-title solid-mobile-text-wrapper text-base">{capitalize(modelMetaData?.displayName)}</div>
1463
+ </>
1464
+ :
1465
+ <div className="flex text-2xl font-bold align-items-center ml-4" style={{ color: '#000' }}>
1466
+ <div className="form-wrapper-title solid-mobile-text-wrapper text-base">Model - {capitalize(modelMetaData?.displayName)}</div>
1467
+ </div>
1468
+ }
1469
+ </div>
1470
+ <div className="flex align-items-center gap-3 close-popup">
1471
+ <Button icon="pi pi-times" rounded text aria-label="Cancel" type="reset" size="small" onClick={() => setVisiblePopup(false)}
1472
+ className='max-w-2rem bg-primary-reverse text-color' />
1473
+ </div>
1474
+ </>
1475
+ :
1476
+ <>
1477
+ <div className="flex align-items-center gap-3">
1478
+ {!fieldMetaData?.id &&
1479
+ <Button
1480
+ text
1481
+ icon='pi pi-arrow-left'
1482
+ size="small"
1483
+ type="button"
1484
+ aria-label="Back"
1485
+ className='max-w-2rem bg-primary-reverse text-color solid-icon-button'
1486
+ onClick={() => {
1487
+ if (!formik.values.displayName) {
1488
+ setShowTypeFilter(true)
1489
+ } else {
1490
+ setIsBackPopupVisible(true)
1491
+ }
1492
+ }
1493
+ } />
1494
+ }
1495
+ {fieldMetaData ?
1496
+
1497
+ <div className="form-wrapper-title solid-mobile-text-wrapper text-base">Edit {capitalize(fieldMetaData?.displayName)}</div>
1498
+ :
1499
+ <div className="form-wrapper-title solid-mobile-text-wrapper text-base">Add New {selectedType?.label && !showTypeFilter && capitalize(selectedType.label)} Field to {capitalize(modelMetaData?.displayName)}</div>
1500
+ }
1501
+ </div>
1502
+ <div className="flex align-items-center gap-3 close-popup">
1503
+ <Button icon="pi pi-times" text aria-label="Cancel" type="reset" size="small" onClick={() => setVisiblePopup(false)}
1504
+ className='max-w-2rem bg-primary-reverse text-color'
1505
+ />
1506
+ </div>
1507
+ </>
1508
+ }
1509
+ </div>
1510
+ {showTypeFilter === true ?
1511
+ <FieldSelector
1512
+ handleTypeSelect={handleTypeSelect}
1513
+ modelMetaData={modelMetaData}
1514
+ ></FieldSelector>
1515
+ :
1516
+ <div className="p-4" style={{ maxHeight: '80vh', overflowY: 'auto', overflowX: 'hidden' }}>
1517
+ <div className="p-d-flex p-jc-center creat-field-for form-dem">
1518
+ <div className="p-fluid" style={{ position: 'relative' }}>
1519
+ {/* <div className="mb-3">
1520
+ <div className="form-wrapper-title">{fieldMetaData ? `Edit ${capitalize(selectedType.label)} Field` : `Add a new ${capitalize(selectedType.label)} Field`}</div>
1521
+ </div> */}
1522
+ <TabView panelContainerClassName="px-0">
1523
+ <TabPanel
1524
+ header="Basic Info"
1525
+ className={(formik.touched.hasOwnProperty("name") && formik.errors.hasOwnProperty("name")) || (formik.touched.hasOwnProperty("displayName") && formik.errors.hasOwnProperty("displayName")) || (formik.touched.hasOwnProperty("displayName") && formik.errors.hasOwnProperty("ormType")) ? "tab-error-heading" : ""}
1526
+ // rightIcon="pi pi-info-circle ml-2"
1527
+ >
1528
+ <div className="formgrid grid">
1529
+ {currentFields.includes("displayName") && (
1530
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-2">
1531
+ <label htmlFor="displayName" className="form-field-label">
1532
+ Display Name
1533
+ </label>
1534
+ <InputText
1535
+ type="text"
1536
+ disabled={fieldMetaData?.id}
1537
+ id="displayName"
1538
+ name="displayName"
1539
+ onChange={(e) => {
1540
+ formik.setFieldValue("displayName", e.target.value);
1541
+ const { toCamelCase, toSnakeCase, toPluralCamelCase } = getSingularAndPlural(e.target.value);
1542
+ formik.setFieldValue("name", toCamelCase);
1543
+ if (showColumnName) {
1544
+ formik.setFieldValue("columnName", toSnakeCase);
1545
+ }
1546
+
1547
+ }}
1548
+ value={formik.values.displayName}
1549
+ className={classNames("", {
1550
+ "p-invalid": isFormFieldValid(
1551
+ formik,
1552
+ "displayName"
1553
+ ),
1554
+ })}
1555
+ />
1556
+ {isFormFieldValid(formik, "displayName") && (
1557
+ <Message
1558
+ severity="error"
1559
+ text={formik?.errors?.displayName?.toString()}
1560
+ />
1561
+ )}
1562
+ </div>
1563
+ )}
1564
+
1565
+
1566
+ {currentFields.includes("name") && (
1567
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3 md:mt-0">
1568
+ <label htmlFor="name" className="form-field-label">
1569
+ Name
1570
+ </label>
1571
+ <InputText
1572
+ disabled={fieldMetaData?.id}
1573
+ type="text"
1574
+ id="name"
1575
+ name="name"
1576
+ onChange={formik.handleChange}
1577
+ value={formik.values.name}
1578
+ className={classNames("", {
1579
+ "p-invalid": isFormFieldValid(formik, "name"),
1580
+ })}
1581
+ />
1582
+ {isFormFieldValid(formik, "name") && (
1583
+ <Message
1584
+ severity="error"
1585
+ text={formik?.errors?.name?.toString()}
1586
+ />
1587
+ )}
1588
+ </div>
1589
+ )}
1590
+ {currentFields.includes("description") && (
1591
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3 md:mt-4">
1592
+ <label htmlFor="description" className="form-field-label">
1593
+ Description
1594
+ </label>
1595
+ <InputTextarea
1596
+ aria-describedby="Description of your field"
1597
+ id="description"
1598
+ name="description"
1599
+ onChange={formik.handleChange}
1600
+ value={formik.values.description}
1601
+ rows={5}
1602
+ cols={30}
1603
+ className={classNames("", {
1604
+ "p-invalid": isFormFieldValid(
1605
+ formik,
1606
+ "description"
1607
+ ),
1608
+ })}
1609
+ />
1610
+ {isFormFieldValid(formik, "description") && (
1611
+ <Message
1612
+ severity="error"
1613
+ text={formik?.errors?.description?.toString()}
1614
+ />
1615
+ )}
1616
+ </div>
1617
+ )}
1618
+
1619
+ {currentFields.includes("columnName") && (
1620
+ <div className="field col-12 md:col-6 mt-4">
1621
+ <div className="flex align-items-center gap-2">
1622
+ <Checkbox onChange={e => {
1623
+ setShowColumnName(e.checked);
1624
+ if (e.checked === true) {
1625
+ const { toCamelCase, toSnakeCase, toPluralCamelCase } = getSingularAndPlural(formik.values.displayName);
1626
+ if (pathname.includes('create')) {
1627
+ formik.setFieldValue("columnName", toSnakeCase);
1628
+ }
1629
+ } else {
1630
+ formik.setFieldValue("columnName", null);
1631
+ }
1632
+
1633
+ }} checked={showColumnName} disabled={fieldMetaData?.id}></Checkbox>
1634
+ <label htmlFor="ingredient1" className="form-field-label">
1635
+ Set Column Name
1636
+ </label>
1637
+ </div>
1638
+ {showColumnName &&
1639
+ <div className="field col-12 flex-flex-column gap-2 mt-4">
1640
+ <label htmlFor="columnName" className="form-field-label">
1641
+ Column Name
1642
+ </label>
1643
+ <InputText
1644
+ disabled={fieldMetaData?.id}
1645
+ type="text"
1646
+ id="columnName"
1647
+ name="columnName"
1648
+ onChange={formik.handleChange}
1649
+ value={formik.values.columnName}
1650
+ className={classNames("", {
1651
+ "p-invalid": isFormFieldValid(formik, "columnName"),
1652
+ })}
1653
+ />
1654
+ {isFormFieldValid(formik, "columnName") && (
1655
+ <Message
1656
+ severity="error"
1657
+ text={formik?.errors?.columnName?.toString()}
1658
+ />
1659
+ )}
1660
+ </div>
1661
+ }
1662
+ </div>
1663
+ )}
1664
+
1665
+
1666
+ {/* {currentFields.includes("type") && (
1667
+ <div className="md:col-6 sm:col-12">
1668
+ <div className="field col-6 flex-flex-column gap-2">
1669
+ <label htmlFor="type" className="form-field-label">
1670
+ Type
1671
+ </label>
1672
+ <AutoComplete
1673
+ value={selectedType}
1674
+ suggestions={filteredTypes}
1675
+ invalid={isFormFieldValid(formik, "type")}
1676
+ completeMethod={searchTypes}
1677
+ virtualScrollerOptions={{ itemSize: 38 }}
1678
+ field="label"
1679
+ className="small-input"
1680
+ dropdown
1681
+ onChange={(e) => {
1682
+ formik.setFieldTouched('type', true); // Manually mark as touched
1683
+ setSelectedType(e.value);
1684
+ formik.setFieldValue("type", e.value.value);
1685
+ if (e.value.value == "email") {
1686
+ formik.setFieldValue("regexPattern", "/^[a-zA-Z0-9. _%+-]+@[a-zA-Z0-9. -]+\\. [a-zA-Z]{2,}$/");
1687
+ } else {
1688
+ formik.setFieldValue("regexPattern", "");
1689
+ }
1690
+ const _filteredOrmType: any = fieldDefaultMetaData.data.ormType.filter((t: any) => t.solidType == e.value.value);
1691
+ setSelectedOrmType(_filteredOrmType[0].value)
1692
+ formik.setFieldValue("ormType", _filteredOrmType[0].value);
1693
+
1694
+ setCurrentFields(
1695
+ fetchCurrentFields(e.value.value, fieldDefaultMetaData)
1696
+ );
1697
+ }}
1698
+
1699
+
1700
+ />
1701
+
1702
+ {isFormFieldValid(formik, "type") && (
1703
+ <Message
1704
+ severity="error"
1705
+ text={formik?.errors?.type?.toString()}
1706
+ />
1707
+ )}
1708
+ </div>
1709
+ </div>
1710
+ )} */}
1711
+
1712
+ </div>
1713
+
1714
+ </TabPanel>
1715
+
1716
+ <TabPanel header="Advanced Config"
1717
+
1718
+ // rightIcon="pi pi-cog ml-2"
1719
+ >
1720
+ {formik?.values?.type?.length > 0 && (
1721
+ <div className="formgrid grid">
1722
+ {currentFields.includes("length") && (
1723
+ <div className="field col-6 flex-flex-column gap-2">
1724
+ <label htmlFor="length" className="form-field-label">
1725
+ Length
1726
+ </label>
1727
+ <InputNumber
1728
+ // type="text"
1729
+ id="length"
1730
+ name="length"
1731
+ onValueChange={formik.handleChange}
1732
+ value={formik.values.length}
1733
+ className={classNames("", {
1734
+ "p-invalid": isFormFieldValid(
1735
+ formik,
1736
+ "length"
1737
+ ),
1738
+ })}
1739
+ />
1740
+ {isFormFieldValid(formik, "length") && (
1741
+ <Message
1742
+ severity="error"
1743
+ text={formik?.errors?.length?.toString()}
1744
+ />
1745
+ )}
1746
+ </div>
1747
+ )}
1748
+ {currentFields.includes("defaultValue") && (
1749
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
1750
+ <label
1751
+ htmlFor="defaultValue"
1752
+ className="form-field-label"
1753
+ >
1754
+ Default Value
1755
+ </label>
1756
+ {/* <InputText
1757
+ type="text"
1758
+ id="defaultValue"
1759
+ name="defaultValue"
1760
+ onChange={formik.handleChange}
1761
+ value={formik.values.defaultValue}
1762
+ className={classNames("", {
1763
+ "p-invalid": isFormFieldValid(
1764
+ formik,
1765
+ "defaultValue"
1766
+ ),
1767
+ })}
1768
+ /> */}
1769
+ {(selectedType.value === "shortText" || selectedType.value === "longText" || selectedType.value === "richText" || selectedType.value === "json" || selectedType.value === "password" || selectedType.value === "selectionStatic") &&
1770
+ <InputText
1771
+ type="text"
1772
+ id="defaultValue"
1773
+ name="defaultValue"
1774
+ onChange={formik.handleChange}
1775
+ value={formik.values.defaultValue}
1776
+ className={classNames("", {
1777
+ "p-invalid": isFormFieldValid(
1778
+ formik,
1779
+ "defaultValue"
1780
+ ),
1781
+ })}
1782
+ />
1783
+ }
1784
+ {(selectedType.value === "float" || selectedType.value === "decimal") &&
1785
+ <InputNumber
1786
+ id="defaultValue"
1787
+ name="defaultValue"
1788
+ minFractionDigits={2}
1789
+ maxFractionDigits={5}
1790
+ value={formik.values.defaultValue}
1791
+ onValueChange={(e) => formik.setFieldValue("defaultValue", e.value)} // Ensure correct value change handling
1792
+ className={classNames("", {
1793
+ "p-invalid": isFormFieldValid(formik, "defaultValue"),
1794
+ })}
1795
+ />
1796
+ }
1797
+ {(selectedType.value === "int" || selectedType.value === "bigint") &&
1798
+ <InputNumber
1799
+ id="defaultValue"
1800
+ name="defaultValue"
1801
+ value={formik.values.defaultValue}
1802
+ onValueChange={(e) => formik.setFieldValue("defaultValue", e.value)} // Ensure correct value change handling
1803
+ className={classNames("", {
1804
+ "p-invalid": isFormFieldValid(formik, "defaultValue"),
1805
+ })}
1806
+ />
1807
+ }
1808
+ {selectedType.value === "boolean" &&
1809
+ <SelectButton
1810
+ value={formik.values.defaultValue ? formik.values.defaultValue : "false"}
1811
+ onChange={(e) => formik.setFieldValue("defaultValue", e.value)} // Custom handling for boolean input
1812
+ options={booleanOptions}
1813
+ className={classNames("", {
1814
+ "p-invalid": isFormFieldValid(formik, "defaultValue"),
1815
+ })}
1816
+ />
1817
+ }
1818
+ {(selectedType.value === "date" || selectedType.value === "datetime" || selectedType.value === "time") &&
1819
+ <Calendar
1820
+ id="defaultValue"
1821
+ name="defaultValue"
1822
+ value={formik.values.defaultValue ? new Date(formik.values.defaultValue) : null}
1823
+ onChange={(e) => formik.setFieldValue("defaultValue", e.value)} // Use setFieldValue for proper handling
1824
+ showTime={formik.values.type === "datetime"} // Show time picker for datetime
1825
+ timeOnly={formik.values.type === "time"} // Time-only for time
1826
+ dateFormat="yy-mm-dd"
1827
+ hourFormat="24" // 24-hour format for time
1828
+ className={classNames("", {
1829
+ "p-invalid": isFormFieldValid(formik, "defaultValue"),
1830
+ })}
1831
+ />
1832
+ }
1833
+ {isFormFieldValid(formik, "defaultValue") && (
1834
+ <Message
1835
+ severity="error"
1836
+ text={formik?.errors?.defaultValue?.toString()}
1837
+ />
1838
+ )}
1839
+ </div>
1840
+ )}
1841
+
1842
+ {currentFields.includes("mediaTypes") && (
1843
+ <div className="field col-12 md:col-6 flex-flex-column gap-2">
1844
+ <label
1845
+ htmlFor="mediaTypes"
1846
+ className="form-field-label"
1847
+ >
1848
+ Media Type
1849
+ </label>
1850
+ {/* <MultipleSelectAutoCompleteField
1851
+ key="mediaTypes"
1852
+ formik={formik}
1853
+ isFormFieldValid={isFormFieldValid}
1854
+ fieldName="mediaTypes"
1855
+ fieldNameId="mediaTypes"
1856
+ labelKey="label"
1857
+ valueKey="value"
1858
+ searchData={searchMediaTypes}
1859
+ existingData={formik.values.mediaTypes}
1860
+ /> */}
1861
+
1862
+ {/* {selectedType.value === "mediaSingle" &&
1863
+ <SingleSelectAutoCompleteField
1864
+ key="mediaTypes"
1865
+ formik={formik}
1866
+ isFormFieldValid={isFormFieldValid}
1867
+ fieldName="mediaTypes"
1868
+ fieldNameId="mediaTypes"
1869
+ labelKey="label"
1870
+ valueKey="value"
1871
+ searchData={searchMediaTypes}
1872
+ existingData={formik.values.mediaTypes}
1873
+ />
1874
+ } */}
1875
+
1876
+ {isFormFieldValid(formik, "mediaTypes") && (
1877
+ <Message
1878
+ severity="error"
1879
+ text={formik?.errors?.mediaTypes?.toString()}
1880
+ />
1881
+ )}
1882
+ <MultiSelect value={formik.values.mediaTypes} onChange={(e) => formik.setFieldValue("mediaTypes", e.value)} options={mediaTypesOptions} optionLabel="label"
1883
+ placeholder="Select Media Types" maxSelectedLabels={3} display="chip" className="" />
1884
+
1885
+
1886
+ {/* <Dropdown
1887
+ id="mediaTypes"
1888
+ name="mediaTypes"
1889
+ multiple
1890
+ value={formik.values.mediaTypes}
1891
+ options={fieldDefaultMetaData.data.mediaTypes}
1892
+ onChange={(e) =>
1893
+ formik.setFieldValue("mediaTypes", e.value)
1894
+ }
1895
+ placeholder="Select a Media Type"
1896
+ className={classNames("", {
1897
+ "p-invalid": isFormFieldValid(
1898
+ formik,
1899
+ "mediaTypes"
1900
+ ),
1901
+ })}
1902
+ /> */}
1903
+
1904
+
1905
+ </div>
1906
+ )}
1907
+ {currentFields.includes("mediaMaxSizeKb") && (
1908
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3 md:mt-0">
1909
+ <label
1910
+ htmlFor="mediaMaxSizeKb"
1911
+ className="form-field-label"
1912
+ >
1913
+ Media Max Size (Mb)
1914
+ </label>
1915
+ <InputNumber
1916
+ id="mediaMaxSizeKb"
1917
+ name="mediaMaxSizeKb"
1918
+ onValueChange={formik.handleChange}
1919
+ value={formik.values.mediaMaxSizeKb}
1920
+ className={classNames("", {
1921
+ "p-invalid": isFormFieldValid(
1922
+ formik,
1923
+ "mediaMaxSizeKb"
1924
+ ),
1925
+ })}
1926
+ />
1927
+
1928
+ {isFormFieldValid(formik, "mediaMaxSizeKb") && (
1929
+ <Message
1930
+ severity="error"
1931
+ text={formik?.errors?.mediaMaxSizeKb?.toString()}
1932
+ />
1933
+ )}
1934
+ </div>
1935
+ )}
1936
+ {currentFields.includes("mediaStorageProviderId") && (
1937
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
1938
+ <label
1939
+ htmlFor="mediaStorageProviderId"
1940
+ className="form-field-label"
1941
+ >
1942
+ Media Storage Provider
1943
+ </label>
1944
+
1945
+ <SingleSelectAutoCompleteField
1946
+ key="mediaStorageProviderId"
1947
+ formik={formik}
1948
+ isFormFieldValid={isFormFieldValid}
1949
+ relationField={true}
1950
+ fieldName="mediaStorageProvider"
1951
+ fieldNameId="mediaStorageProviderId"
1952
+ labelKey="name"
1953
+ valueKey="value"
1954
+ searchData={searchMediaStorageProvIderId}
1955
+ existingData={formik.values.mediaStorageProvider}
1956
+ />
1957
+
1958
+ {isFormFieldValid(
1959
+ formik,
1960
+ "mediaStorageProvider"
1961
+ ) && (
1962
+ <Message
1963
+ severity="error"
1964
+ text={formik?.errors?.mediaStorageProviderId?.toString()}
1965
+ />
1966
+ )}
1967
+ </div>
1968
+ )}
1969
+
1970
+ {currentFields.includes("mediaEmbedded") && (
1971
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
1972
+ <label
1973
+ htmlFor="mediaEmbedded"
1974
+ className="form-field-label"
1975
+ >
1976
+ Media Embedded
1977
+ </label>
1978
+ {/* <InputText
1979
+ type="text"
1980
+ id="mediaEmbedded"
1981
+ name="mediaEmbedded"
1982
+ onChange={formik.handleChange}
1983
+ value={formik.values.mediaEmbedded}
1984
+ className={classNames("", {
1985
+ "p-invalid": isFormFieldValid(
1986
+ formik,
1987
+ "mediaEmbedded"
1988
+ ),
1989
+ })}
1990
+ /> */}
1991
+ <SelectButton
1992
+ value={formik.values.mediaEmbedded}
1993
+ // onChange={formik.handleChange}
1994
+ onChange={(e) => {
1995
+ formik.setFieldValue("mediaEmbedded", e.value);
1996
+ }}
1997
+ options={booleanOptions}
1998
+ className={classNames("", {
1999
+ "p-invalid": isFormFieldValid(
2000
+ formik,
2001
+ "mediaEmbedded"
2002
+ ),
2003
+ })}
2004
+ />
2005
+ {isFormFieldValid(formik, "mediaEmbedded") && (
2006
+ <Message
2007
+ severity="error"
2008
+ text={formik?.errors?.mediaEmbedded?.toString()}
2009
+ />
2010
+ )}
2011
+ </div>
2012
+ )}
2013
+ {currentFields.includes("relationType") && (
2014
+ <div className="field col-12 flex-flex-column gap-2 mt-3">
2015
+ {/* <label
2016
+ htmlFor="relationType"
2017
+ className="form-field-label"
2018
+ >
2019
+ Relation Type
2020
+ </label>
2021
+ <Dropdown
2022
+ id="relationType"
2023
+ name="relationType"
2024
+ value={formik.values.relationType}
2025
+ options={fieldDefaultMetaData.data.relationTypes}
2026
+ onChange={(e) =>
2027
+ formik.setFieldValue("relationType", e.value)
2028
+ }
2029
+ placeholder="Select a Data Source"
2030
+ className={classNames("", {
2031
+ "p-invalid": isFormFieldValid(
2032
+ formik,
2033
+ "relationType"
2034
+ ),
2035
+ })}
2036
+ /> */}
2037
+
2038
+ <label
2039
+ htmlFor="relationType"
2040
+ className="form-field-label "
2041
+ >
2042
+ Relation Type
2043
+ </label>
2044
+ <SelectButton
2045
+ value={formik.values.relationType}
2046
+ options={fieldDefaultMetaData.data.relationTypes}
2047
+ onChange={(e) => {
2048
+ formik.setFieldValue("relationType", e.value);
2049
+ if (e.value === "one-to-many") {
2050
+ formik.setFieldValue("relationCreateInverse", true);
2051
+ }
2052
+ }
2053
+ }
2054
+ className={classNames("", {
2055
+ "p-invalid": isFormFieldValid(formik, "relationType"),
2056
+ })}
2057
+ optionLabel="label"
2058
+ />
2059
+
2060
+ {/* <div className="align-items-center">
2061
+ <div className="flex mt-3">
2062
+ {fieldDefaultMetaData?.data?.relationTypes.map((i: any) => (
2063
+ <div key={i.value} className="mr-3">
2064
+ <RadioButton
2065
+ inputId="ingredient1"
2066
+ name="pizza"
2067
+ value={i.value}
2068
+ onChange={(e) => formik.setFieldValue("relationType", e.value)}
2069
+ checked={formik.values.relationType === i.value}
2070
+ />
2071
+ <label htmlFor="ingredient1" className="form-field-label ml-2">{i.value}</label>
2072
+ </div>
2073
+ ))}
2074
+ </div>
2075
+ </div> */}
2076
+
2077
+ {isFormFieldValid(formik, "relationType") && (
2078
+ <Message
2079
+ severity="error"
2080
+ text={formik?.errors?.relationType?.toString()}
2081
+ />
2082
+ )}
2083
+ </div>
2084
+ )}
2085
+ {currentFields.includes("relationType") && (formik.values.relationType === "many-to-one" || formik.values.relationType === "one-to-many") && (
2086
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2087
+ <label
2088
+ htmlFor="relationCascade"
2089
+ className="form-field-label"
2090
+ >
2091
+ Relation Cascade
2092
+ </label>
2093
+ <Dropdown
2094
+ id="relationCascade"
2095
+ name="relationCascade"
2096
+ value={formik.values.relationCascade}
2097
+ options={fieldDefaultMetaData.data.cascadeTypes}
2098
+ onChange={(e) =>
2099
+ formik.setFieldValue(
2100
+ "relationCascade",
2101
+ e.value
2102
+ )
2103
+ }
2104
+ placeholder="Cascade"
2105
+ className={classNames("w-full", {
2106
+ "p-invalid": isFormFieldValid(
2107
+ formik,
2108
+ "relationCascade"
2109
+ ),
2110
+ })}
2111
+ />
2112
+ {isFormFieldValid(formik, "relationCascade") && (
2113
+ <Message
2114
+ severity="error"
2115
+ text={formik?.errors?.relationCascade?.toString()}
2116
+ />
2117
+ )}
2118
+ </div>
2119
+ )}
2120
+
2121
+ {currentFields.includes("relationModelModuleName") && (
2122
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2123
+ <label
2124
+ htmlFor="relationModelModuleName"
2125
+ className="form-field-label"
2126
+ >
2127
+ Co-Module Name
2128
+ </label>
2129
+
2130
+ <SingleSelectAutoCompleteField
2131
+ key="relationModelModuleName"
2132
+ formik={formik}
2133
+ isFormFieldValid={isFormFieldValid}
2134
+ fieldName="relationModelModuleName"
2135
+ fieldNameId="relationModelModuleName"
2136
+ labelKey="name"
2137
+ valueKey="name"
2138
+ searchData={searchRelationModelModuleNames}
2139
+ existingData={formik.values.relationModelModuleName}
2140
+ additionalAction={(e: any) => {
2141
+ formik.setFieldValue("relationCoModelSingularName", "");
2142
+ formik.setFieldValue("relationCoModelColumnName", "");
2143
+ formik.setFieldValue("relationJoinTableName", "");
2144
+ }}
2145
+ />
2146
+
2147
+ {/* <AutoComplete
2148
+ value={selectedRelationModelModuleName}
2149
+ suggestions={filteredRelationModelModuleNames}
2150
+ invalid={isFormFieldValid(
2151
+ formik,
2152
+ "relationModelModuleName"
2153
+ )}
2154
+ completeMethod={searchRelationModelModuleNames}
2155
+ virtualScrollerOptions={{ itemSize: 38 }}
2156
+ field="label"
2157
+ className="small-input"
2158
+ dropdown
2159
+ onChange={(e) => {
2160
+ setSelectedRelationModelModuleName(e.value);
2161
+ formik.setFieldValue(
2162
+ "relationModelModuleName",
2163
+ e.value
2164
+ );
2165
+ }}
2166
+ /> */}
2167
+
2168
+ {isFormFieldValid(
2169
+ formik,
2170
+ "relationModelModuleName"
2171
+ ) && (
2172
+ <Message
2173
+ severity="error"
2174
+ text={formik?.errors?.relationModelModuleName?.toString()}
2175
+ />
2176
+ )}
2177
+ </div>
2178
+ )}
2179
+
2180
+ {currentFields.includes(
2181
+ "relationCoModelSingularName"
2182
+ ) && (
2183
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2184
+ <label
2185
+ htmlFor="relationCoModelSingularName"
2186
+ className="form-field-label"
2187
+ >
2188
+ Co-Model Name
2189
+ </label>
2190
+
2191
+
2192
+ <SingleSelectAutoCompleteField
2193
+ key="relationCoModelSingularName"
2194
+ formik={formik}
2195
+ isFormFieldValid={isFormFieldValid}
2196
+ fieldName="relationCoModelSingularName"
2197
+ fieldNameId="relationCoModelSingularName"
2198
+ labelKey="displayName"
2199
+ valueKey="singularName"
2200
+ searchData={searchrelationCoModelSingularNames}
2201
+ existingData={formik.values.relationCoModelSingularName}
2202
+ />
2203
+
2204
+ {isFormFieldValid(
2205
+ formik,
2206
+ "relationCoModelSingularName"
2207
+ ) && (
2208
+ <Message
2209
+ severity="error"
2210
+ text={formik?.errors?.relationCoModelSingularName?.toString()}
2211
+ />
2212
+ )}
2213
+ {formik.values.relationType === "one-to-many" &&
2214
+ <p className="fieldSubTitle">This is the child model.</p>
2215
+ }
2216
+ {formik.values.relationType === "many-to-one" &&
2217
+ <p className="fieldSubTitle">This is the parent model.</p>
2218
+ }
2219
+ </div>
2220
+ )}
2221
+ {currentFields.includes("relationCoModelColumnName") && (formik.values.relationType === "many-to-many" || formik.values.relationType === "many-to-one") && (
2222
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2223
+ <label
2224
+ htmlFor="relationCoModelColumnName"
2225
+ className="form-field-label"
2226
+ >
2227
+ Relation Co-Model Column Name
2228
+ </label>
2229
+ <InputText
2230
+ type="text"
2231
+ id="relationCoModelColumnName"
2232
+ name="relationCoModelColumnName"
2233
+ onChange={formik.handleChange}
2234
+ disabled={fieldMetaData?.id}
2235
+ value={formik.values.relationCoModelColumnName}
2236
+ className={classNames("", {
2237
+ "p-invalid": isFormFieldValid(
2238
+ formik,
2239
+ "relationCoModelColumnName"
2240
+ ),
2241
+ })}
2242
+ />
2243
+ {isFormFieldValid(formik, "relationCoModelColumnName") && (
2244
+ <Message
2245
+ severity="error"
2246
+ text={formik?.errors?.relationCoModelColumnName?.toString()}
2247
+ />
2248
+ )}
2249
+ <p className="fieldSubTitle">Allows you to control the column name of the foreign key. Eg. when adding a country field to state model, by default foreign key column in the state table will be called country_id, use this field to create a foreign key with a different name. </p>
2250
+
2251
+ </div>
2252
+ )}
2253
+ {askForUserKeyField && (
2254
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2255
+ <label
2256
+ htmlFor="userKey"
2257
+ className="form-field-label"
2258
+ >
2259
+ Set User Key
2260
+ </label>
2261
+
2262
+ <SingleSelectAutoCompleteField
2263
+ key="userKey"
2264
+ formik={formik}
2265
+ isFormFieldValid={isFormFieldValid}
2266
+ fieldName="userKey"
2267
+ fieldNameId="userKey"
2268
+ labelKey="displayName"
2269
+ valueKey="name"
2270
+ searchData={searchUserKeyField}
2271
+ existingData={formik.values.userKey}
2272
+ />
2273
+ <p className="fieldSubTitle">The co-model you have selected does not have a user key specified. Use the above dropdown to choose from one of the "unique" fields in this co-model to be set as its userkey. User keys are required in co-models being used in many-to-one or one-to-many relations as in SolidX when a many-to-one field is rendered it uses an autocomplete dropdown, and the user key value is what is displayed as the label in the dropdown.</p>
2274
+ {isFormFieldValid(
2275
+ formik,
2276
+ "userKey"
2277
+ ) && (
2278
+ <Message
2279
+ severity="error"
2280
+ text={formik?.errors?.userKey?.toString()}
2281
+ />
2282
+ )}
2283
+ </div>
2284
+ )}
2285
+
2286
+ {currentFields.includes(
2287
+ "relationFieldFixedFilter"
2288
+ ) && (
2289
+ <div className="field col-12 flex-flex-column gap-2 mt-3">
2290
+ <label
2291
+ htmlFor="relationFieldFixedFilter"
2292
+ className="form-field-label"
2293
+ >
2294
+ Relation Field Fixed Filter
2295
+ </label>
2296
+
2297
+ <InputTextarea
2298
+ aria-describedby="Fixed Filter"
2299
+ id="relationFieldFixedFilter"
2300
+ name="relationFieldFixedFilter"
2301
+ onChange={formik.handleChange}
2302
+ value={formik.values.relationFieldFixedFilter}
2303
+ rows={5}
2304
+ cols={30}
2305
+ className={classNames("", {
2306
+ "p-invalid": isFormFieldValid(
2307
+ formik,
2308
+ "relationFieldFixedFilter"
2309
+ ),
2310
+ })}
2311
+ />
2312
+ {/*
2313
+ <InputText
2314
+ type="text"
2315
+ id="relationFieldFixedFilter"
2316
+ name="relationFieldFixedFilter"
2317
+ onChange={formik.handleChange}
2318
+ disabled={fieldMetaData?.id}
2319
+ value={formik.values.relationFieldFixedFilter}
2320
+ className={classNames("", {
2321
+ "p-invalid": isFormFieldValid(
2322
+ formik,
2323
+ "relationFieldFixedFilter"
2324
+ ),
2325
+ })}
2326
+ /> */}
2327
+ {isFormFieldValid(formik, "relationFieldFixedFilter") && (
2328
+ <Message
2329
+ severity="error"
2330
+ text={formik?.errors?.relationFieldFixedFilter?.toString()}
2331
+ />
2332
+ )}
2333
+ <p className="fieldSubTitle">Many to one fields are rendered as autocomplete dropdown on the SolidX ui. Use the fixed filter to load a pre-filtered set of records from the co-model. Please note user input entered in the autocomplete is used to apply a dynamic filter.</p>
2334
+
2335
+ </div>
2336
+ )}
2337
+
2338
+ {currentFields.includes("relationCreateInverse") && (
2339
+ <div className="field col-12 md:col-6 flex flex-column gap-2 mt-3">
2340
+ <label htmlFor="relationCreateInverse" className="form-field-label">
2341
+ Relation Create Inverse
2342
+ </label>
2343
+ <div className="flex align-items-center">
2344
+ <Checkbox
2345
+ inputId="relationCreateInverse"
2346
+ name="relationCreateInverse"
2347
+ checked={formik.values.relationCreateInverse}
2348
+ disabled={formik.values.relationType === "one-to-many" ? true : false}
2349
+ onChange={(e) => formik.setFieldValue("relationCreateInverse", e.checked)}
2350
+ />
2351
+ <label htmlFor="relationCreateInverse" className="ml-2">Create Inverse</label>
2352
+ </div>
2353
+ {isFormFieldValid(formik, "relationCreateInverse") && (
2354
+ <Message severity="error" text={formik?.errors?.relationCreateInverse?.toString()} />
2355
+ )}
2356
+ </div>
2357
+ )}
2358
+
2359
+ {currentFields.includes("relationCoModelFieldName") && formik.values.relationCreateInverse && !formik.values.relationCoModelSingularName && (
2360
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2361
+ <Message text="Please select Co-model" />
2362
+ </div>
2363
+ )}
2364
+ {currentFields.includes("relationCoModelFieldName") && formik.values.relationCreateInverse && formik.values.relationCoModelSingularName && (
2365
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2366
+ <label
2367
+ htmlFor="relationCoModelFieldName"
2368
+ className="form-field-label"
2369
+ >
2370
+ Field Name In {formik.values.relationCoModelSingularName} Model
2371
+ </label>
2372
+ <InputText
2373
+ type="text"
2374
+ id="relationCoModelFieldName"
2375
+ name="relationCoModelFieldName"
2376
+ onChange={formik.handleChange}
2377
+ disabled={fieldMetaData?.id}
2378
+ value={formik.values.relationCoModelFieldName}
2379
+ className={classNames("", {
2380
+ "p-invalid": isFormFieldValid(
2381
+ formik,
2382
+ "relationCoModelFieldName"
2383
+ ),
2384
+ })}
2385
+ />
2386
+ {formik.values.relationType === "one-to-many" &&
2387
+ <p className="fieldSubTitle">This is a field that is created in the child model. In this case a <span style={{fontWeight: "700"}}>{formik.values.relationCoModelFieldName ?? formik.values.relationCoModelSingularName}</span> field will be created in the {formik.values.relationCoModelSingularName} when setting create inverse true.</p>
2388
+ }
2389
+ {formik.values.relationType === "many-to-one" &&
2390
+ <p className="fieldSubTitle">This is a field that is created in the parent model. In this case a <span style={{fontWeight: "700"}}>{formik.values.relationCoModelFieldName ?? `${formik.values.relationCoModelSingularName}s`}</span> field will be created in the {formik.values.relationCoModelSingularName} when setting create inverse true.</p>
2391
+ }
2392
+ {formik.values.relationType === "many-to-many" &&
2393
+ <p className="fieldSubTitle">In this case a {formik.values.relationCoModelFieldName} field will be created in the <span style={{fontWeight: "700"}}>{formik.values.relationCoModelSingularName ?? '{{}}'}</span> when setting create inverse true.</p>
2394
+ }
2395
+ {isFormFieldValid(formik, "relationCoModelFieldName") && (
2396
+ <Message
2397
+ severity="error"
2398
+ text={formik?.errors?.relationCoModelFieldName?.toString()}
2399
+ />
2400
+ )}
2401
+ </div>
2402
+ )}
2403
+
2404
+ {/* {currentFields.includes("joinColumnName") && formik.values.relationType === "many-to-many" && (
2405
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
2406
+ <label
2407
+ htmlFor="joinColumnName"
2408
+ className="form-field-label"
2409
+ >
2410
+ Join Column Name
2411
+ </label>
2412
+ <InputText
2413
+ type="text"
2414
+ id="joinColumnName"
2415
+ name="joinColumnName"
2416
+ onChange={formik.handleChange}
2417
+ value={formik.values.joinColumnName}
2418
+ className={classNames("", {
2419
+ "p-invalid": isFormFieldValid(
2420
+ formik,
2421
+ "joinColumnName"
2422
+ ),
2423
+ })}
2424
+ />
2425
+ {isFormFieldValid(formik, "joinColumnName") && (
2426
+ <Message
2427
+ severity="error"
2428
+ text={formik?.errors?.joinColumnName?.toString()}
2429
+ />
2430
+ )}
2431
+
2432
+ </div>
2433
+ )} */}
2434
+
2435
+
2436
+
2437
+ {currentFields.includes("relationJoinTableName") && formik.values.relationType === "many-to-many" && (
2438
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2439
+ <label
2440
+ htmlFor="relationJoinTableName"
2441
+ className="form-field-label"
2442
+ >
2443
+ Relation Join Table Name
2444
+ </label>
2445
+ <InputText
2446
+ type="text"
2447
+ id="relationJoinTableName"
2448
+ name="relationJoinTableName"
2449
+ onChange={formik.handleChange}
2450
+ disabled={fieldMetaData?.id}
2451
+ value={formik.values.relationJoinTableName}
2452
+ className={classNames("", {
2453
+ "p-invalid": isFormFieldValid(
2454
+ formik,
2455
+ "relationJoinTableName"
2456
+ ),
2457
+ })}
2458
+ />
2459
+ {isFormFieldValid(formik, "relationJoinTableName") && (
2460
+ <Message
2461
+ severity="error"
2462
+ text={formik?.errors?.relationJoinTableName?.toString()}
2463
+ />
2464
+ )}
2465
+
2466
+ </div>
2467
+ )}
2468
+
2469
+ {currentFields.includes("selectionDynamicProvider") && (
2470
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2471
+ <label
2472
+ htmlFor="selectionDynamicProvider"
2473
+ className="form-field-label"
2474
+ >
2475
+ Selection Dynamic Provider
2476
+ </label>
2477
+
2478
+ <SingleSelectAutoCompleteField
2479
+ key="selectionDynamicProvider"
2480
+ formik={formik}
2481
+ isFormFieldValid={isFormFieldValid}
2482
+ // relationField={false}
2483
+ fieldName="selectionDynamicProvider"
2484
+ fieldNameId={null}
2485
+ labelKey="label"
2486
+ valueKey="value"
2487
+ searchData={searchSelectionDynamicProvider}
2488
+ existingData={formik.values.selectionDynamicProvider}
2489
+ additionalAction={(e: any) => setMarkdownText(e.target.value.help)}
2490
+ />
2491
+
2492
+
2493
+ {/* <AutoComplete
2494
+ value={selectionDynamicProvider}
2495
+ suggestions={filteredSelectionDynamicProvider}
2496
+ invalid={isFormFieldValid(
2497
+ formik,
2498
+ "selectionDynamicProvider"
2499
+ )}
2500
+ completeMethod={searchSelectionDynamicProvider}
2501
+ virtualScrollerOptions={{ itemSize: 38 }}
2502
+ field="label"
2503
+ className="small-input"
2504
+ dropdown
2505
+ onChange={(e) => {
2506
+ setSelectionDynamicProvider(e.value);
2507
+ formik.setFieldValue(
2508
+ "selectionDynamicProvider",
2509
+ e.value.value
2510
+ );
2511
+ }}
2512
+ /> */}
2513
+
2514
+ {isFormFieldValid(
2515
+ formik,
2516
+ "selectionDynamicProvider"
2517
+ ) && (
2518
+ <Message
2519
+ severity="error"
2520
+ text={formik?.errors?.selectionDynamicProvider?.toString()}
2521
+ />
2522
+ )}
2523
+ </div>
2524
+ )}
2525
+ {currentFields.includes("selectionValueType") && (
2526
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2527
+ <label
2528
+ htmlFor="selectionValueType"
2529
+ className="form-field-label"
2530
+ >
2531
+ Select Value Type
2532
+ </label>
2533
+ <Dropdown
2534
+ id="selectionValueType"
2535
+ name="selectionValueType"
2536
+ value={formik.values.selectionValueType}
2537
+ options={selctionValueTypes}
2538
+ onChange={(e) =>
2539
+ formik.setFieldValue(
2540
+ "selectionValueType",
2541
+ e.value
2542
+ )
2543
+ }
2544
+ placeholder="Select Value Type"
2545
+ className={classNames("", {
2546
+ "p-invalid": isFormFieldValid(
2547
+ formik,
2548
+ "selectionValueType"
2549
+ ),
2550
+ })}
2551
+ />
2552
+ {isFormFieldValid(
2553
+ formik,
2554
+ "selectionValueType"
2555
+ ) && (
2556
+ <Message
2557
+ severity="error"
2558
+ text={formik?.errors?.selectionValueType?.toString()}
2559
+ />
2560
+ )}
2561
+ </div>
2562
+ )}
2563
+
2564
+ {currentFields.includes("selectionStaticValues") && (
2565
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2566
+ <label
2567
+ htmlFor="selectionStaticValues"
2568
+ className="form-field-label"
2569
+ >
2570
+ Selection Static Values
2571
+ </label>
2572
+ {/* <InputTextarea
2573
+ value={selectionStaticValues}
2574
+ placeholder="male:Male"
2575
+ onChange={(e) => {
2576
+ const data = e.target.value
2577
+ .split("\n")
2578
+ .filter((line) => line.trim() !== "");
2579
+
2580
+ setSelectionStaticValues(e.target.value);
2581
+ formik.setFieldValue(
2582
+ "selectionStaticValues",
2583
+ data
2584
+ );
2585
+ }}
2586
+ rows={5}
2587
+ cols={30}
2588
+ /> */}
2589
+ {formik.values.selectionStaticValues.map((enumValue: string, index: number) => (
2590
+ <SelectionStaticValues
2591
+ key={index}
2592
+ enumValue={enumValue}
2593
+ onUpdate={(updatedString: any) => updateEnumValues(index, updatedString)}
2594
+ onDelete={() => deleteEnumValue(index)}
2595
+ onAdd={addEnumValue}
2596
+ />
2597
+ ))
2598
+ }
2599
+ {isFormFieldValid(
2600
+ formik,
2601
+ "selectionStaticValues"
2602
+ ) && (
2603
+ <Message
2604
+ severity="error"
2605
+ text={formik?.errors?.selectionStaticValues?.toString()}
2606
+ />
2607
+ )}
2608
+ </div>
2609
+ )}
2610
+
2611
+ {currentFields.includes("computedFieldValueType") && (
2612
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2613
+ <label
2614
+ htmlFor="computedFieldValueType"
2615
+ className="form-field-label"
2616
+ >
2617
+ Computed Field Value Type
2618
+ </label>
2619
+ <AutoComplete
2620
+
2621
+ value={selectedComputedFieldValueType}
2622
+ invalid={isFormFieldValid(formik, "computedFieldValueType")}
2623
+ suggestions={filteredComputedFieldValueTypes}
2624
+ completeMethod={searchComputedFieldValueType}
2625
+ // virtualScrollerOptions={{ itemSize: 38 }}
2626
+ virtualScrollerOptions={getVirtualScrollerOptions({
2627
+ itemsLength: filteredComputedFieldValueTypes.length,
2628
+ })}
2629
+ field="label"
2630
+ dropdown
2631
+ className="solid-standard-autocomplete"
2632
+ onChange={(e) => {
2633
+ setSelectedComputedFieldValueType(e.value);
2634
+ formik.setFieldValue("computedFieldValueType", e.value.value);
2635
+ }}
2636
+ />
2637
+
2638
+ {/* <Dropdown
2639
+ id="mediaTypes"
2640
+ name="mediaTypes"
2641
+ value={formik.values.mediaTypes}
2642
+ options={fieldDefaultMetaData.data.mediaTypes}
2643
+ onChange={(e) =>
2644
+ formik.setFieldValue("mediaTypes", e.value)
2645
+ }
2646
+ placeholder="Select a Data Source"
2647
+ className={classNames("", {
2648
+ "p-invalid": isFormFieldValid(
2649
+ formik,
2650
+ "mediaTypes"
2651
+ ),
2652
+ })}
2653
+ /> */}
2654
+ {isFormFieldValid(formik, "computedFieldValueType") && (
2655
+ <Message
2656
+ severity="error"
2657
+ text={formik?.errors?.computedFieldValueType?.toString()}
2658
+ />
2659
+ )}
2660
+ </div>
2661
+ )}
2662
+
2663
+ {currentFields.includes(
2664
+ "computedFieldValueProvider"
2665
+ ) && (
2666
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2667
+ <label
2668
+ htmlFor="computedFieldValueProvider"
2669
+ className="form-field-label"
2670
+ >
2671
+ Computed Field Provider
2672
+ </label>
2673
+ <SingleSelectAutoCompleteField
2674
+ key="computedFieldValueProvider"
2675
+ formik={formik}
2676
+ isFormFieldValid={isFormFieldValid}
2677
+ // relationField={false}
2678
+ fieldName="computedFieldValueProvider"
2679
+ fieldNameId={null}
2680
+ labelKey="label"
2681
+ valueKey="value"
2682
+ searchData={searchComputedProvider}
2683
+ existingData={formik.values.computedFieldValueProvider}
2684
+ additionalAction={(e: any) => setMarkdownText(e.target.value.help)}
2685
+
2686
+ />
2687
+ {isFormFieldValid(
2688
+ formik,
2689
+ "computedFieldValueProvider"
2690
+ ) && (
2691
+ <Message
2692
+ severity="error"
2693
+ text={formik?.errors?.computedFieldValueProvider?.toString()}
2694
+ />
2695
+ )}
2696
+ </div>
2697
+ )}
2698
+ {currentFields.includes(
2699
+ "computedFieldTriggerConfig"
2700
+ ) && (
2701
+ <div className="field col-12 flex-flex-column gap-2 mt-3">
2702
+ {fieldMetaData?.computedFieldTriggerConfig === null
2703
+ &&
2704
+ <div className="mb-3">
2705
+ <Message severity="error" text={`You seem to be using an old configuration of ComputedFieldProvider. Please change your current computed field provider i.e ${fieldMetaData?.computedFieldValueProvider} to implement IEntityComputedFieldProvider before continuing.`} />
2706
+ </div>
2707
+ }
2708
+ <div className="flex align-items-center gap-2">
2709
+ <label
2710
+ htmlFor="computedFieldTriggerConfig"
2711
+ className="form-field-label"
2712
+ >
2713
+ Computed Field Trigger Config
2714
+ </label>
2715
+ <div>
2716
+ <Button
2717
+ icon="pi pi-plus"
2718
+ size="small"
2719
+ onClick={handleAdd}
2720
+ type="button"
2721
+ className="ml-2"
2722
+ />
2723
+ </div>
2724
+ </div>
2725
+ {
2726
+ formik.values.computedFieldTriggerConfig.map((row: any, index: number) => (
2727
+ <SelectComputedFieldTriggerValues
2728
+ key={index}
2729
+ index={index}
2730
+ row={row}
2731
+ onChange={handleChange}
2732
+ onDelete={handleDelete}
2733
+ isLastRow={index === formik.values.computedFieldTriggerConfig.length - 1}
2734
+ disableDelete={formik.values.computedFieldTriggerConfig.length === 1}
2735
+ formik={formik}
2736
+ isFormFieldValid={isFormFieldValid}
2737
+ searchModuleName={searchModuleName}
2738
+ searchModelName={computedFieldSearchHandlers[index]}
2739
+ modelMetaData={modelMetaData}
2740
+ errors={formik.errors.computedFieldTriggerConfig?.[index]}
2741
+ />
2742
+ ))}
2743
+ {typeof formik.errors.computedFieldTriggerConfig === 'string' && (
2744
+ <Message
2745
+ severity="error"
2746
+ text={formik.errors.computedFieldTriggerConfig}
2747
+ />
2748
+ )}
2749
+ </div>
2750
+ )}
2751
+ {/* {currentFields.includes("externalIdProvider") && (
2752
+ <div className="md:col-6 sm:col-12">
2753
+ <div className="field col-6 flex-flex-column gap-2">
2754
+ <label
2755
+ htmlFor="externalIdProvider"
2756
+ className="form-field-label"
2757
+ >
2758
+ External Id Provider
2759
+ </label>
2760
+ <SingleSelectAutoCompleteField
2761
+ key="externalIdProvider"
2762
+ formik={formik}
2763
+ isFormFieldValid={isFormFieldValid}
2764
+ // relationField={false}
2765
+ fieldName="externalIdProvider"
2766
+ fieldNameId={null}
2767
+ labelKey="label"
2768
+ valueKey="value"
2769
+ searchData={searchExternalIdProvider}
2770
+ existingData={formik.values.externalIdProvider}
2771
+ additionalAction={(e: any) => setMarkdownText(e.target.value.help)}
2772
+ />
2773
+
2774
+
2775
+ {isFormFieldValid(
2776
+ formik,
2777
+ "externalIdProvider"
2778
+ ) && (
2779
+ <Message
2780
+ severity="error"
2781
+ text={formik?.errors?.externalIdProvider?.toString()}
2782
+ />
2783
+ )}
2784
+ </div>
2785
+ </div>
2786
+ )} */}
2787
+
2788
+ {currentFields.includes("selectionDynamicProviderCtxt") && (
2789
+ // {/* {markdownText &&
2790
+ // <div className="md:col-12 sm:col-12">
2791
+ // <div className="field col-6 flex-flex-column gap-2">
2792
+ // <label htmlFor="name" className="form-field-label">
2793
+ // Markdown
2794
+ // </label>
2795
+ // <MarkdownViewer data={markdownText}></MarkdownViewer>
2796
+ // </div>
2797
+ // </div>
2798
+ // } */}
2799
+
2800
+ <div className="field col-12 flex-flex-column gap-2 mt-4">
2801
+ <label htmlFor="selectionDynamicProviderCtxt" className="form-field-label">
2802
+ Selection Dynamic Provider Context
2803
+ </label>
2804
+ <CodeEditor
2805
+ formik={formik}
2806
+ field="selectionDynamicProviderCtxt" >
2807
+ </CodeEditor>
2808
+ <div className=" form-field-label mt-4">{markdownText}</div>
2809
+
2810
+ {isFormFieldValid(
2811
+ formik,
2812
+ "selectionDynamicProviderCtxt"
2813
+ ) && (
2814
+ <Message
2815
+ severity="error"
2816
+ text={formik?.errors?.selectionDynamicProviderCtxt?.toString()}
2817
+ />
2818
+ )}
2819
+ </div>
2820
+ // {/* {currentFields.includes("markdown") && ( */}
2821
+
2822
+ )}
2823
+
2824
+ {currentFields.includes("computedFieldValueProviderCtxt") && (
2825
+ <div className="field col-12 flex-flex-column gap-2 mt-4">
2826
+ <label htmlFor="computedFieldValueProviderCtxt" className="form-field-label">
2827
+ Computed Field Value Provider Context
2828
+ </label>
2829
+ <CodeEditor
2830
+ formik={formik}
2831
+ field="computedFieldValueProviderCtxt" >
2832
+ </CodeEditor>
2833
+ <div className="form-field-label mt-4">{markdownText}</div>
2834
+
2835
+ {isFormFieldValid(
2836
+ formik,
2837
+ "computedFieldValueProviderCtxt"
2838
+ ) && (
2839
+ <Message
2840
+ severity="error"
2841
+ text={formik?.errors?.computedFieldValueProviderCtxt?.toString()}
2842
+ />
2843
+ )}
2844
+ </div>
2845
+ )}
2846
+
2847
+ {/* {currentFields.includes("externalIdProviderCtxt") && (
2848
+ <div className="md:col-12 sm:col-12">
2849
+
2850
+ <div className="formgrid grid">
2851
+ {markdownText &&
2852
+ <div className="md:col-12 sm:col-12">
2853
+ <div className="field col-6 flex-flex-column gap-2">
2854
+ <label htmlFor="name" className="form-field-label">
2855
+ Markdown
2856
+ </label>
2857
+ <MarkdownViewer data={markdownText}></MarkdownViewer>
2858
+ </div>
2859
+ </div>
2860
+ }
2861
+ <div className="md:col-12 sm:col-12">
2862
+ <div className="field col-6 flex-flex-column gap-2">
2863
+ <label htmlFor="name" className="form-field-label">
2864
+ External Id Provider Context
2865
+ </label>
2866
+ <CodeEditor
2867
+ formik={formik}
2868
+ field="externalIdProviderCtxt" >
2869
+ </CodeEditor>
2870
+ {isFormFieldValid(
2871
+ formik,
2872
+ "externalIdProviderCtxt"
2873
+ ) && (
2874
+ <Message
2875
+ severity="error"
2876
+ text={formik?.errors?.externalIdProviderCtxt?.toString()}
2877
+ />
2878
+ )}
2879
+ </div>
2880
+ </div>
2881
+
2882
+ </div>
2883
+ </div>
2884
+ )} */}
2885
+
2886
+ </div>
2887
+ )}
2888
+ {(currentFields.includes("regexPattern") || currentFields.includes("min") || currentFields.includes("max") || currentFields.includes("ormType")) && ormTypeOptions && selectedType.value !== 'relation' &&
2889
+ <>
2890
+ <p className="form-wrapper-heading text-base mt-3">Validations</p>
2891
+ <div className="formgrid grid">
2892
+ {(currentFields.includes("regexPattern") && selectedType.value === "password") &&
2893
+ <>
2894
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2895
+ <label
2896
+ htmlFor="regexPattern"
2897
+ className="form-field-label"
2898
+ >
2899
+ Password Policy
2900
+ </label>
2901
+ <Dropdown value={selectedPasswordPolicy} onChange={(e: DropdownChangeEvent) => {
2902
+ setSelectedPasswordPolicy(e.value)
2903
+ if (e.value !== "custom") {
2904
+ formik.setFieldValue('regexPattern', e.value)
2905
+ }
2906
+ }} options={passwordPolicyOptions} optionLabel="label"
2907
+ placeholder="Select a Password Policy"
2908
+ // className="w-full md:w-14rem"
2909
+ className=""
2910
+ panelClassName="password-policy-dropdown-panel"
2911
+ checkmark={true} highlightOnSelect={false} />
2912
+
2913
+ </div>
2914
+ </>
2915
+ }
2916
+ {currentFields.includes("regexPattern") && (
2917
+ <>
2918
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
2919
+ <label
2920
+ htmlFor="regexPattern"
2921
+ className="form-field-label"
2922
+ >
2923
+ Regex Pattern
2924
+ </label>
2925
+ <InputText
2926
+ type="text"
2927
+ id="regexPattern"
2928
+ name="regexPattern"
2929
+ onChange={formik.handleChange}
2930
+ value={formik.values.regexPattern}
2931
+ className={classNames("", {
2932
+ "p-invalid": isFormFieldValid(
2933
+ formik,
2934
+ "regexPattern"
2935
+ ),
2936
+ })}
2937
+ />
2938
+ {isFormFieldValid(formik, "regexPattern") && (
2939
+ <Message
2940
+ severity="error"
2941
+ text={formik?.errors?.regexPattern?.toString()}
2942
+ />
2943
+ )}
2944
+ </div>
2945
+ {currentFields.includes("regexPattern") && (
2946
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3 mb-3 md:mb-3">
2947
+ <label
2948
+ htmlFor="regexPatternNotMatchingErrorMsg"
2949
+ className="form-field-label"
2950
+ >
2951
+ Regex Pattern Not Matching Error Msg
2952
+ </label>
2953
+ <InputText
2954
+ type="text"
2955
+ id="regexPatternNotMatchingErrorMsg"
2956
+ name="regexPatternNotMatchingErrorMsg"
2957
+ onChange={formik.handleChange}
2958
+ value={formik.values.regexPatternNotMatchingErrorMsg}
2959
+ className={classNames("", {
2960
+ "p-invalid": isFormFieldValid(
2961
+ formik,
2962
+ "regexPatternNotMatchingErrorMsg"
2963
+ ),
2964
+ })}
2965
+ />
2966
+ {isFormFieldValid(formik, "regexPatternNotMatchingErrorMsg") && (
2967
+ <Message
2968
+ severity="error"
2969
+ text={formik?.errors?.regexPatternNotMatchingErrorMsg?.toString()}
2970
+ />
2971
+ )}
2972
+ </div>
2973
+ )}
2974
+ </>
2975
+
2976
+ )}
2977
+ {(currentFields.includes("min") || currentFields.includes("max")) &&
2978
+ <>
2979
+ {currentFields.includes("min") && (
2980
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-2 md:mt-3">
2981
+ <label htmlFor="min" className="form-field-label">
2982
+ Min {(selectedType.value !== "int" && selectedType.value !== "decimal") && `(Characters Allowed)`}
2983
+
2984
+ </label>
2985
+ {/* <InputText
2986
+ type="text"
2987
+ id="min"
2988
+ name="min"
2989
+ onChange={formik.handleChange}
2990
+ value={formik.values.min}
2991
+ className={classNames("", {
2992
+ "p-invalid": isFormFieldValid(formik, "min"),
2993
+ })}
2994
+ /> */}
2995
+ {/* <RenderMinValueInput></RenderMinValueInput> */}
2996
+ {(selectedType.value === "int" ||
2997
+ selectedType.value === "decimal" ||
2998
+ selectedType.value === "shortText" ||
2999
+ selectedType.value === "decimal" ||
3000
+ selectedType.value === "longText" ||
3001
+ selectedType.value === "richText" ||
3002
+ selectedType.value === "password" ||
3003
+ selectedType.value === "json") &&
3004
+ <InputNumber
3005
+ id="min"
3006
+ name="min"
3007
+ onValueChange={formik.handleChange}
3008
+ value={formik.values.min}
3009
+ className={classNames("", {
3010
+ "p-invalid": isFormFieldValid(
3011
+ formik,
3012
+ "min"
3013
+ ),
3014
+ })}
3015
+ disabled={fieldMetaData?.id}
3016
+ />
3017
+ }
3018
+
3019
+ {isFormFieldValid(formik, "min") && (
3020
+ <Message
3021
+ severity="error"
3022
+ text={formik?.errors?.min?.toString()}
3023
+ />
3024
+ )}
3025
+ </div>
3026
+ )}
3027
+ {currentFields.includes("max") && (
3028
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
3029
+ <label htmlFor="max" className="form-field-label">
3030
+ Max {(selectedType.value !== "int" &&
3031
+ selectedType.value !== "decimal") && `(Characters allowed)`}
3032
+ </label>
3033
+ {/* <InputText
3034
+ type="text"
3035
+ id="max"
3036
+ name="max"
3037
+ onChange={formik.handleChange}
3038
+ value={formik.values.max}
3039
+ className={classNames("", {
3040
+ "p-invalid": isFormFieldValid(formik, "max"),
3041
+ })}
3042
+ /> */}
3043
+ {(selectedType.value === "int" ||
3044
+ selectedType.value === "decimal" ||
3045
+ selectedType.value === "shortText" ||
3046
+ selectedType.value === "decimal" ||
3047
+ selectedType.value === "longText" ||
3048
+ selectedType.value === "richText" ||
3049
+ selectedType.value === "password" ||
3050
+ selectedType.value === "json") &&
3051
+ <InputNumber
3052
+ id="max"
3053
+ name="max"
3054
+ onValueChange={formik.handleChange}
3055
+ value={formik.values.max}
3056
+ className={classNames("", {
3057
+ "p-invalid": isFormFieldValid(
3058
+ formik,
3059
+ "max"
3060
+ ),
3061
+ })}
3062
+ disabled={fieldMetaData?.id}
3063
+ />
3064
+ }
3065
+
3066
+ {isFormFieldValid(formik, "max") && (
3067
+ <Message
3068
+ severity="error"
3069
+ text={formik?.errors?.max?.toString()}
3070
+ />
3071
+ )}
3072
+ </div>
3073
+ )}
3074
+ </>
3075
+ }
3076
+ {currentFields.includes("ormType") && (
3077
+ <div className="col-12">
3078
+ {ormTypeOptions && ormTypeOptions.length > 1 &&
3079
+ <div className="field col-12 md:col-6 flex-flex-column gap-2 mt-3">
3080
+ <label htmlFor="ormType" className="form-field-label">
3081
+ Type
3082
+ </label>
3083
+ {/* <SingleSelectAutoCompleteField
3084
+ key="ormType"
3085
+ formik={formik}
3086
+ isFormFieldValid={isFormFieldValid}
3087
+ fieldName="ormType"
3088
+ fieldNameId="ormType"
3089
+ labelKey="label"
3090
+ valueKey="value"
3091
+ searchData={searchOrmTypes}
3092
+ existingData={formik.values.ormType}
3093
+ /> */}
3094
+
3095
+ <div className="ormTypeflex">
3096
+ {ormTypeOptions && ormTypeOptions.map((ormType: any) => {
3097
+ return (
3098
+ <>
3099
+ <div key={ormType.key} className="mr-3 align-items-center">
3100
+ <RadioButton inputId={ormType.label} name="ormType" value={ormType.label} onChange={(e) => {
3101
+ formik.setFieldValue("ormType", e.value);
3102
+ setSelectedOrmType(e.value)
3103
+ }} checked={selectedOrmType === ormType.label} />
3104
+ <label htmlFor={ormType.label} className="ml-2">{ormType.label}<br></br>
3105
+ <span className="ml-4 fieldSubTitle">{ormType.description}</span>
3106
+ </label>
3107
+ </div>
3108
+
3109
+ </>
3110
+ );
3111
+ })}
3112
+
3113
+ </div>
3114
+
3115
+ {isFormFieldValid(formik, "ormType") && (
3116
+ <Message
3117
+ severity="error"
3118
+ text={formik?.errors?.ormType?.toString()}
3119
+ />
3120
+ )}
3121
+ </div>
3122
+ }
3123
+
3124
+ </div>
3125
+ )}
3126
+ </div>
3127
+ </>
3128
+ }
3129
+
3130
+ {(formik.values.relationType !== "many-to-many" && formik.values.relationType !== "one-to-many") && <p className="form-wrapper-heading text-base mt-3">Settings</p>}
3131
+ <div className="formgrid grid mt-3 md:mt-0">
3132
+ {currentFields.includes("required") && (formik.values.relationType !== "many-to-many" && formik.values.relationType !== "one-to-many") && (
3133
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3134
+ <div className="flex align-items-center">
3135
+ <Checkbox
3136
+ name="required"
3137
+ onChange={(e) => {
3138
+ formik.setFieldValue("required", e.checked);
3139
+ }}
3140
+ checked={formik.values.required}
3141
+ ></Checkbox>
3142
+ <label htmlFor="ingredient1" className="form-field-label ml-2">
3143
+ Required
3144
+ </label>
3145
+ </div>
3146
+ <p className="text-xs mt-2">You won't be able to create an entry if this field is empty</p>
3147
+
3148
+ {isFormFieldValid(formik, "required") && (
3149
+ <Message
3150
+ severity="error"
3151
+ text={formik?.errors?.required?.toString()}
3152
+ />
3153
+ )}
3154
+ </div>
3155
+ )}
3156
+ {currentFields.includes("unique") && selectedType.value !== 'relation' && (
3157
+ <div className="field col-6 flex-flex-column gap-2">
3158
+ <div className="flex align-items-center">
3159
+ <Checkbox
3160
+ name="unique"
3161
+ onChange={(e) => {
3162
+ formik.setFieldValue("unique", e.checked);
3163
+ formik.setFieldValue("isUserKey", false);
3164
+ }}
3165
+ checked={formik.values.unique}
3166
+ ></Checkbox>
3167
+ <label htmlFor="ingredient1" className="form-field-label ml-2">
3168
+ Unique
3169
+ </label>
3170
+ </div>
3171
+ <p className="text-xs mt-2">You won't be able to create an entry if there is an existing entry with identical content</p>
3172
+
3173
+ {isFormFieldValid(formik, "unique") && (
3174
+ <Message
3175
+ severity="error"
3176
+ text={formik?.errors?.unique?.toString()}
3177
+ />
3178
+ )}
3179
+ </div>
3180
+ )}
3181
+ {currentFields.includes("index") && selectedType.value !== 'relation' && (
3182
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3183
+ <div className="flex align-items-center">
3184
+ <Checkbox
3185
+ name="index"
3186
+ onChange={(e) => {
3187
+ formik.setFieldValue("index", e.checked);
3188
+ }}
3189
+ checked={formik.values.index}
3190
+ ></Checkbox>
3191
+ <label htmlFor="ingredient1" className="form-field-label ml-2">
3192
+ Index
3193
+ </label>
3194
+ </div>
3195
+ {isFormFieldValid(formik, "index") && (
3196
+ <Message
3197
+ severity="error"
3198
+ text={formik?.errors?.index?.toString()}
3199
+ />
3200
+ )}
3201
+ </div>
3202
+ )}
3203
+ {currentFields.includes("private") && selectedType.value !== 'relation' && (
3204
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3205
+ <div className="flex align-items-center">
3206
+ <Checkbox
3207
+ name="private"
3208
+ onChange={(e) => {
3209
+ formik.setFieldValue("private", e.checked);
3210
+ }}
3211
+ checked={formik.values.private}
3212
+ ></Checkbox>
3213
+ <label htmlFor="ingredient1" className="form-field-label ml-2">
3214
+ Private
3215
+ </label>
3216
+ </div>
3217
+ <p className="text-xs mt-2">This field will not show up in the API response</p>
3218
+
3219
+
3220
+ {isFormFieldValid(formik, "private") && (
3221
+ <Message
3222
+ severity="error"
3223
+ text={formik?.errors?.private?.toString()}
3224
+ />
3225
+ )}
3226
+ </div>
3227
+ )}
3228
+ {currentFields.includes("encrypt") && selectedType.value !== 'relation' && (
3229
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3230
+ <div className="flex align-items-center gap-2">
3231
+ <Checkbox
3232
+ name="encrypt"
3233
+ onChange={(e) => {
3234
+ formik.setFieldValue("encrypt", e.checked);
3235
+ setEncryptState(e.checked);
3236
+ }}
3237
+ checked={formik.values.encrypt}
3238
+ ></Checkbox>
3239
+ <label htmlFor="ingredient1" className="form-field-label">
3240
+ Encrypt
3241
+ </label>
3242
+ </div>
3243
+ {isFormFieldValid(formik, "encrypt") && (
3244
+ <Message
3245
+ severity="error"
3246
+ text={formik?.errors?.encrypt?.toString()}
3247
+ />
3248
+ )}
3249
+ </div>
3250
+ )}
3251
+ {currentFields.includes("isMultiSelect") && (
3252
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3253
+ <div className="flex align-items-center">
3254
+ <Checkbox
3255
+ name="isMultiSelect"
3256
+ onChange={(e) => {
3257
+ formik.setFieldValue("isMultiSelect", e.checked);
3258
+ }}
3259
+ checked={formik.values.isMultiSelect}
3260
+ ></Checkbox>
3261
+ <label htmlFor="ingredient1" className="form-field-label ml-2">
3262
+ Is MultiSelect
3263
+ </label>
3264
+ </div>
3265
+ {isFormFieldValid(formik, "isMultiSelect") && (
3266
+ <Message
3267
+ severity="error"
3268
+ text={formik?.errors?.isMultiSelect?.toString()}
3269
+ />
3270
+ )}
3271
+ </div>
3272
+ )}
3273
+ {/* {currentFields.includes("isSystem") && (
3274
+ <div className="md:col-6 sm:col-12">
3275
+ <div className="field">
3276
+ <div className="flex align-items-center">
3277
+ <Checkbox
3278
+ name="isSystem"
3279
+ onChange={(e) => {
3280
+ formik.setFieldValue("isSystem", e.checked);
3281
+ }}
3282
+ checked={formik.values.isSystem}
3283
+ ></Checkbox>
3284
+ <label htmlFor="ingredient1" className="form-field-label">
3285
+ isSystem
3286
+ </label>
3287
+ </div>
3288
+ {isFormFieldValid(formik, "isSystem") && (
3289
+ <Message
3290
+ severity="error"
3291
+ text={formik?.errors?.isSystem?.toString()}
3292
+ />
3293
+ )}
3294
+ </div>
3295
+ </div>
3296
+ )} */}
3297
+ {currentFields.includes("enableAuditTracking") && formik.values.relationType !== "one-to-many" && (
3298
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3299
+ <div className="flex align-items-center gap-2">
3300
+ <Checkbox
3301
+ name="enableAuditTracking"
3302
+ onChange={(e) => {
3303
+ formik.setFieldValue("enableAuditTracking", e.checked);
3304
+ }}
3305
+ checked={formik.values.enableAuditTracking}
3306
+ ></Checkbox>
3307
+ <label htmlFor="ingredient1" className="form-field-label">
3308
+ Enable Audit Tracking
3309
+ </label>
3310
+ </div>
3311
+ <p className="fieldSubTitle">By selecting this option, you are setting audit trail for this field.</p>
3312
+
3313
+ {isFormFieldValid(formik, "enableAuditTracking") && (
3314
+ <Message
3315
+ severity="error"
3316
+ text={formik?.errors?.enableAuditTracking?.toString()}
3317
+ />
3318
+ )}
3319
+ </div>
3320
+ )}
3321
+ {currentFields.includes("isUserKey") && formik.values.unique && (
3322
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3323
+ <div className="flex align-items-center gap-2">
3324
+ <Checkbox
3325
+ name="isUserKey"
3326
+ onChange={(e) => {
3327
+ formik.setFieldValue("isUserKey", e.checked);
3328
+ }}
3329
+ checked={formik.values.isUserKey}
3330
+ ></Checkbox>
3331
+ <label htmlFor="ingredient1" className="form-field-label">
3332
+ Is Userkey
3333
+ </label>
3334
+ </div>
3335
+ <p className="fieldSubTitle">By selecting this option, you are setting this field as the model's user key. Any existing user key configuration will be overwritten</p>
3336
+
3337
+ {isFormFieldValid(formik, "isUserKey") && (
3338
+ <Message
3339
+ severity="error"
3340
+ text={formik?.errors?.isUserKey?.toString()}
3341
+ />
3342
+ )}
3343
+ </div>
3344
+ )}
3345
+ {currentFields.includes("isPrimaryKey") && (modelMetaData?.isLegacyTable || modelMetaData?.isLegacyTableWithId) && (
3346
+ <div className="field col-6 flex-flex-column gap-2 mt-3">
3347
+ <div className="flex align-items-center gap-2">
3348
+ <Checkbox
3349
+ name="isPrimaryKey"
3350
+ onChange={(e) => {
3351
+ formik.setFieldValue("isPrimaryKey", e.checked);
3352
+ }}
3353
+ checked={formik.values.isPrimaryKey}
3354
+ ></Checkbox>
3355
+ <label htmlFor="ingredient1" className="form-field-label">
3356
+ Is Primary Key
3357
+ </label>
3358
+ </div>
3359
+ <p className="fieldSubTitle">By selecting this option, you are setting this field as the primary key for this legacy table.</p>
3360
+
3361
+ {isFormFieldValid(formik, "isPrimaryKey") && (
3362
+ <Message
3363
+ severity="error"
3364
+ text={formik?.errors?.isPrimaryKey?.toString()}
3365
+ />
3366
+ )}
3367
+ </div>
3368
+ )}
3369
+ </div>
3370
+
3371
+
3372
+ {formik.values.encrypt === true && (
3373
+ <div className="formgrid grid mt-2">
3374
+ <div className="md:col-6 sm:col-12">
3375
+ <div className="field col-6 flex-flex-column gap-2">
3376
+ <label
3377
+ htmlFor="encryptionType"
3378
+ className="form-field-label"
3379
+ >
3380
+ Encryption Type
3381
+ </label>
3382
+ {/* <AutoComplete
3383
+ value={selectedEncryptionType}
3384
+ suggestions={filteredSelectionEncryptionType}
3385
+ invalid={isFormFieldValid(
3386
+ formik,
3387
+ "encryptionType"
3388
+ )}
3389
+ completeMethod={searchSelectionEncryptionType}
3390
+ virtualScrollerOptions={{ itemSize: 38 }}
3391
+ field="label"
3392
+ className="small-input"
3393
+ dropdown
3394
+ onChange={(e) => {
3395
+ setSelectedEncryptionType(e.value);
3396
+ formik.setFieldValue("encryptionType", e.value.value);
3397
+ }}
3398
+ /> */}
3399
+
3400
+ <SingleSelectAutoCompleteField
3401
+ key="encryptionType"
3402
+ formik={formik}
3403
+ isFormFieldValid={isFormFieldValid}
3404
+ fieldName="encryptionType"
3405
+ fieldNameId="encryptionType"
3406
+ labelKey="label"
3407
+ valueKey="value"
3408
+ searchData={searchSelectionEncryptionType}
3409
+ existingData={formik.values.encryptionType}
3410
+ />
3411
+ {isFormFieldValid(formik, "encryptionType") && (
3412
+ <Message
3413
+ severity="error"
3414
+ text={formik?.errors?.encryptionType?.toString()}
3415
+ />
3416
+ )}
3417
+ </div>
3418
+ </div>
3419
+ <div className="md:col-6 sm:col-12">
3420
+ <div className="field col-6 flex-flex-column gap-2">
3421
+ <label htmlFor="decryptWhen" className="form-field-label">
3422
+ Decrypt When
3423
+ </label>
3424
+ {/* <AutoComplete
3425
+ value={selectedDecryptWhen}
3426
+ suggestions={filteredSelectionDecryptWhen}
3427
+ invalid={isFormFieldValid(formik, "decryptWhen")}
3428
+ completeMethod={searchSelectionDecryptWhen}
3429
+ virtualScrollerOptions={{ itemSize: 38 }}
3430
+ field="label"
3431
+ className="small-input"
3432
+ dropdown
3433
+ onChange={(e) => {
3434
+ setSelectedeDecryptWhen(e.value);
3435
+ formik.setFieldValue("decryptWhen", e.value.value);
3436
+ }}
3437
+ /> */}
3438
+
3439
+ <SingleSelectAutoCompleteField
3440
+ key="decryptWhen"
3441
+ formik={formik}
3442
+ isFormFieldValid={isFormFieldValid}
3443
+ fieldName="decryptWhen"
3444
+ fieldNameId="decryptWhen"
3445
+ labelKey="label"
3446
+ valueKey="value"
3447
+ searchData={searchSelectionDecryptWhen}
3448
+ existingData={formik.values.decryptWhen}
3449
+ />
3450
+ {isFormFieldValid(formik, "decryptWhen") && (
3451
+ <Message
3452
+ severity="error"
3453
+ text={formik?.errors?.decryptWhen?.toString()}
3454
+ />
3455
+ )}
3456
+ </div>
3457
+ </div>
3458
+ </div>
3459
+ )}
3460
+ </TabPanel>
3461
+ </TabView>
3462
+ <div className="flex gap-3">
3463
+ <div>
3464
+ <Button label="Finish" size="small" onClick={() => showError()} type="submit" />
3465
+ </div>
3466
+ <div>
3467
+ <Button label="Cancel" size="small" severity="secondary" type="reset" onClick={() => setVisiblePopup(false)} outlined />
3468
+ </div>
3469
+ </div>
3470
+ </div>
3471
+ {/* <div className="ml-4">
3472
+ <Button
3473
+ label="Save"
3474
+ onClick={() => showError(formik.validateForm)}
3475
+ type="submit"
3476
+ />
3477
+ </div> */}
3478
+ </div>
3479
+ </div>
3480
+ }
3481
+
3482
+ </form>
3483
+ </div >
3484
+ <Dialog
3485
+ visible={isBackPopupVisible}
3486
+ header="Select Type"
3487
+ headerClassName="text-center"
3488
+ modal
3489
+ className="solid-confirm-dialog"
3490
+ footer={() => (
3491
+ <div className="flex gap-3">
3492
+ <Button label="Yes" icon="pi pi-check" size="small" type="reset" severity="danger" autoFocus onClick={() => {
3493
+ formik.resetForm()
3494
+ setIsBackPopupVisible(false);
3495
+ setShowTypeFilter(true);
3496
+ }} />
3497
+ <Button label="No" icon="pi pi-times" size="small" onClick={() => setIsBackPopupVisible(false)} />
3498
+ </div>
3499
+ )}
3500
+ onHide={() => setIsBackPopupVisible(false)}
3501
+ >
3502
+ <p>You have some unsaved data are you sure you want to go back?</p>
3503
+ </Dialog>
3504
+ </div >
3505
+ );
3506
+ };
3507
+
3508
+
3509
+ export default FieldMetaDataForm;