@solidstarters/solid-core-ui 1.1.69 → 1.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CustomFooter/CustomFooter.tsx +264 -0
- package/dist/components/CustomFooter/FooterForm.tsx +19 -0
- package/dist/components/CustomHeader/CallIcon.tsx +20 -0
- package/dist/components/CustomHeader/CustomDropdown.tsx +175 -0
- package/dist/components/CustomHeader/CustomHeader.tsx +64 -0
- package/dist/components/CustomHeader/EmailIcon.tsx +12 -0
- package/dist/components/CustomHeader/HeaderCart.tsx +15 -0
- package/dist/components/CustomHeader/productNavData.tsx +180 -0
- package/dist/components/FormView/DetailsViews.tsx +46 -0
- package/dist/components/FormView/OrderAddressDetails.tsx +70 -0
- package/dist/components/FormView/OrderPaymentDetails.tsx +18 -0
- package/dist/components/FormView/OrderTableDetails.tsx +36 -0
- package/dist/components/FormView/OrderedProductDetail.tsx +22 -0
- package/dist/components/Svg/ExcelSvg.tsx +15 -0
- package/dist/components/Svg/FileSvg.tsx +19 -0
- package/dist/components/Svg/PDFSvg.tsx +15 -0
- package/dist/components/Svg/RightArrowSvg.d.ts +2 -0
- package/dist/components/Svg/RightArrowSvg.d.ts.map +1 -0
- package/dist/components/Svg/RightArrowSvg.js +5 -0
- package/dist/components/Svg/RightArrowSvg.js.map +1 -0
- package/dist/components/Svg/RightArrowSvg.tsx +9 -0
- package/dist/components/Tag/CustomTag.tsx +50 -0
- package/dist/components/auth/AuthLayout.tsx +140 -0
- package/dist/components/auth/ForgotPasswordThankYou.tsx +48 -0
- package/dist/components/auth/GoogleAuthChecking.tsx +60 -0
- package/dist/components/auth/Login.tsx +155 -0
- package/dist/components/auth/Register.tsx +239 -0
- package/dist/components/auth/SolidChangeForcePassword.tsx +145 -0
- package/dist/components/auth/SolidForgotPassword.tsx +125 -0
- package/dist/components/auth/SolidInitialLoginOtp.tsx +152 -0
- package/dist/components/auth/SolidInitiateRegisterOtp.tsx +141 -0
- package/dist/components/auth/SolidLogin.tsx +275 -0
- package/dist/components/auth/SolidOTPVerify.tsx +132 -0
- package/dist/components/auth/SolidRegister.tsx +348 -0
- package/dist/components/auth/SolidResetPassword.tsx +162 -0
- package/dist/components/common/AuthBanner.tsx +41 -0
- package/dist/components/common/AutoCompleteField.tsx +76 -0
- package/dist/components/common/BackButton.tsx +27 -0
- package/dist/components/common/CancelButton.tsx +48 -0
- package/dist/components/common/CodeEditor.tsx +26 -0
- package/dist/components/common/CreateButton.tsx +17 -0
- package/dist/components/common/DropzonePlaceholder.tsx +31 -0
- package/dist/components/common/DropzoneUpload.tsx +11 -0
- package/dist/components/common/FileReaderExt.tsx +20 -0
- package/dist/components/common/GeneralSettings.tsx +406 -0
- package/dist/components/common/HeaderDynamicTitles.tsx +13 -0
- package/dist/components/common/MarkdownViewer.tsx +16 -0
- package/dist/components/common/MultipleSelectAutoCompleteField.tsx +62 -0
- package/dist/components/common/NotFound.tsx +22 -0
- package/dist/components/common/SingleSelectAutoCompleteField.tsx +67 -0
- package/dist/components/common/SocialMediaLogin.tsx +53 -0
- package/dist/components/common/SolidAdmin.tsx +7 -0
- package/dist/components/common/SolidBreadcrumb.tsx +103 -0
- package/dist/components/common/SolidFormHeader.tsx +22 -0
- package/dist/components/common/SolidFormStepper.tsx +213 -0
- package/dist/components/common/SolidModuleHome.tsx +61 -0
- package/dist/components/common/SolidThemeLink.tsx +5 -0
- package/dist/components/common/SolidThemeProvider.tsx +44 -0
- package/dist/components/common/error.tsx +30 -0
- package/dist/components/core/chatter/SolidChatter.d.ts +7 -0
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -0
- package/dist/components/core/chatter/SolidChatter.js +269 -0
- package/dist/components/core/chatter/SolidChatter.js.map +1 -0
- package/dist/components/core/chatter/SolidChatter.tsx +252 -0
- package/dist/components/core/chatter/SolidChatterDateDivider.d.ts +6 -0
- package/dist/components/core/chatter/SolidChatterDateDivider.d.ts.map +1 -0
- package/dist/components/core/chatter/SolidChatterDateDivider.js +7 -0
- package/dist/components/core/chatter/SolidChatterDateDivider.js.map +1 -0
- package/dist/components/core/chatter/SolidChatterDateDivider.tsx +16 -0
- package/dist/components/core/chatter/SolidChatterHeader.d.ts +17 -0
- package/dist/components/core/chatter/SolidChatterHeader.d.ts.map +1 -0
- package/dist/components/core/chatter/SolidChatterHeader.js +67 -0
- package/dist/components/core/chatter/SolidChatterHeader.js.map +1 -0
- package/dist/components/core/chatter/SolidChatterHeader.tsx +178 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts +19 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts.map +1 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.js +46 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.js.map +1 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.tsx +165 -0
- package/dist/components/core/chatter/SolidMessageComposer.d.ts +7 -0
- package/dist/components/core/chatter/SolidMessageComposer.d.ts.map +1 -0
- package/dist/components/core/chatter/SolidMessageComposer.js +119 -0
- package/dist/components/core/chatter/SolidMessageComposer.js.map +1 -0
- package/dist/components/core/chatter/SolidMessageComposer.tsx +145 -0
- package/dist/components/core/chatter/chatter.module.css +70 -0
- package/dist/components/core/common/FilterComponent.tsx +434 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +70 -0
- package/dist/components/core/common/SolidCreateButton.tsx +20 -0
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +843 -0
- package/dist/components/core/common/SolidLayoutViews.tsx +87 -0
- package/dist/components/core/common/SolidListViewOptions.tsx +31 -0
- package/dist/components/core/common/SolidSaveCustomFilterForm.tsx +74 -0
- package/dist/components/core/common/SolidSearchBox.tsx +17 -0
- package/dist/components/core/common/SolidViewLayoutManager.d.ts +1 -1
- package/dist/components/core/common/SolidViewLayoutManager.ts +85 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeChangeHandler.ts +18 -0
- package/dist/components/core/extension/solid-core/emailTemplate/emailFormTypeLoad.ts +18 -0
- package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.tsx +59 -0
- package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.tsx +38 -0
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts +2 -2
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +123 -0
- package/dist/components/core/field/FieldListViewData.tsx +312 -0
- package/dist/components/core/filter/SolidFilterFields.tsx +128 -0
- package/dist/components/core/filter/SolidManyToOneFilterElement.tsx +60 -0
- package/dist/components/core/filter/SolidSelectionDynamicFilterElement.tsx +50 -0
- package/dist/components/core/filter/SolidSelectionStaticFilterElement.tsx +32 -0
- package/dist/components/core/filter/SolidVarInputsFilterElement.tsx +180 -0
- package/dist/components/core/filter/fields/SolidBigintField.tsx +9 -0
- package/dist/components/core/filter/fields/SolidBooleanField.tsx +50 -0
- package/dist/components/core/filter/fields/SolidComputedField.tsx +23 -0
- package/dist/components/core/filter/fields/SolidDateField.tsx +58 -0
- package/dist/components/core/filter/fields/SolidDatetimeField.tsx +51 -0
- package/dist/components/core/filter/fields/SolidDecimalField.tsx +9 -0
- package/dist/components/core/filter/fields/SolidExternalIdField.tsx +46 -0
- package/dist/components/core/filter/fields/SolidFloatField.tsx +9 -0
- package/dist/components/core/filter/fields/SolidIdField.tsx +46 -0
- package/dist/components/core/filter/fields/SolidIntField.tsx +56 -0
- package/dist/components/core/filter/fields/SolidLongTextField.tsx +9 -0
- package/dist/components/core/filter/fields/SolidMediaMultipleField.tsx +54 -0
- package/dist/components/core/filter/fields/SolidMediaSingleField.tsx +56 -0
- package/dist/components/core/filter/fields/SolidRelationField.tsx +13 -0
- package/dist/components/core/filter/fields/SolidRichTextField.tsx +9 -0
- package/dist/components/core/filter/fields/SolidSelectionDynamicField.tsx +46 -0
- package/dist/components/core/filter/fields/SolidSelectionStaticField.tsx +48 -0
- package/dist/components/core/filter/fields/SolidShortTextField.tsx +54 -0
- package/dist/components/core/filter/fields/SolidTimeField.tsx +45 -0
- package/dist/components/core/filter/fields/SolidUuidField.tsx +45 -0
- package/dist/components/core/filter/fields/relations/SolidRelationManyToOneField.tsx +80 -0
- package/dist/components/core/form/SolidFormLayouts.tsx +104 -0
- package/dist/components/core/form/SolidFormUserViewLayout.tsx +85 -0
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +53 -46
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +1352 -0
- package/dist/components/core/form/fields/ISolidField.tsx +69 -0
- package/dist/components/core/form/fields/SolidBooleanField.d.ts +4 -1
- package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.js +80 -29
- package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.tsx +269 -0
- package/dist/components/core/form/fields/SolidDateField.d.ts +3 -0
- package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateField.js +45 -25
- package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateField.tsx +153 -0
- package/dist/components/core/form/fields/SolidDateTimeField.d.ts +3 -0
- package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.js +44 -25
- package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.tsx +154 -0
- package/dist/components/core/form/fields/SolidDecimalField.d.ts +3 -0
- package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.js +41 -21
- package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.tsx +155 -0
- package/dist/components/core/form/fields/SolidEmailField.d.ts +3 -0
- package/dist/components/core/form/fields/SolidEmailField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidEmailField.js +41 -21
- package/dist/components/core/form/fields/SolidEmailField.js.map +1 -1
- package/dist/components/core/form/fields/SolidEmailField.tsx +168 -0
- package/dist/components/core/form/fields/SolidIntegerField.d.ts +3 -0
- package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.js +41 -21
- package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.tsx +158 -0
- package/dist/components/core/form/fields/SolidJsonField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.js +51 -15
- package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.tsx +173 -0
- package/dist/components/core/form/fields/SolidLongTextField.d.ts +3 -2
- package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.js +33 -52
- package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.tsx +161 -0
- package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.js +262 -153
- package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.tsx +639 -0
- package/dist/components/core/form/fields/SolidMediaSingleField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.js +243 -149
- package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.tsx +522 -0
- package/dist/components/core/form/fields/SolidPasswordField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidPasswordField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidPasswordField.js +50 -20
- package/dist/components/core/form/fields/SolidPasswordField.js.map +1 -1
- package/dist/components/core/form/fields/SolidPasswordField.tsx +187 -0
- package/dist/components/core/form/fields/SolidRelationField.tsx +54 -0
- package/dist/components/core/form/fields/SolidRichTextField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.js +49 -20
- package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.tsx +177 -0
- package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js +88 -60
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.tsx +204 -0
- package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts +5 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.js +88 -27
- package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.tsx +272 -0
- package/dist/components/core/form/fields/SolidShortTextField.d.ts +4 -0
- package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.js +57 -26
- package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.tsx +208 -0
- package/dist/components/core/form/fields/SolidTimeField.d.ts +3 -0
- package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.js +44 -22
- package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.tsx +147 -0
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts +4 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +77 -19
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +309 -0
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts +5 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +136 -107
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +291 -0
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts +5 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +159 -107
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +311 -0
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.d.ts +1 -1
- package/dist/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.d.ts +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +33 -0
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +64 -0
- package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.d.ts +1 -1
- package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.d.ts +1 -1
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts +1 -1
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts +1 -1
- package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.d.ts +3 -0
- package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.js +29 -0
- package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.tsx +46 -0
- package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.d.ts +1 -1
- package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.d.ts +1 -1
- package/dist/components/core/form/widgets/CustomHtml.d.ts +1 -1
- package/dist/components/core/form/widgets/CustomHtml.tsx +19 -0
- package/dist/components/core/kanban/KanbanBoard.tsx +131 -0
- package/dist/components/core/kanban/KanbanCard.tsx +255 -0
- package/dist/components/core/kanban/KanbanColumn.tsx +139 -0
- package/dist/components/core/kanban/KanbanUserViewLayout.tsx +85 -0
- package/dist/components/core/kanban/SolidKanbanView.tsx +803 -0
- package/dist/components/core/kanban/SolidKanbanViewConfigure.tsx +146 -0
- package/dist/components/core/kanban/SolidKanbanViewFields.tsx +164 -0
- package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +59 -0
- package/dist/components/core/kanban/SolidSelectionDynamicFilterElement.tsx +50 -0
- package/dist/components/core/kanban/SolidSelectionStaticFilterElement.tsx +32 -0
- package/dist/components/core/kanban/SolidVarInputsFilterElement.tsx +184 -0
- package/dist/components/core/kanban/kanban-fields/SolidBigintKanbanField.tsx +9 -0
- package/dist/components/core/kanban/kanban-fields/SolidBooleanKanbanField.tsx +13 -0
- package/dist/components/core/kanban/kanban-fields/SolidComputedKanbanField.tsx +23 -0
- package/dist/components/core/kanban/kanban-fields/SolidDateKanbanField.tsx +14 -0
- package/dist/components/core/kanban/kanban-fields/SolidDatetimeKanbanField.tsx +13 -0
- package/dist/components/core/kanban/kanban-fields/SolidDecimalKanbanField.tsx +9 -0
- package/dist/components/core/kanban/kanban-fields/SolidExternalIdKanbanField.tsx +12 -0
- package/dist/components/core/kanban/kanban-fields/SolidFloatKanbanField.tsx +9 -0
- package/dist/components/core/kanban/kanban-fields/SolidIdKanbanField.tsx +14 -0
- package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.tsx +20 -0
- package/dist/components/core/kanban/kanban-fields/SolidLongTextKanbanField.tsx +9 -0
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +136 -0
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +158 -0
- package/dist/components/core/kanban/kanban-fields/SolidRelationKanbanField.tsx +13 -0
- package/dist/components/core/kanban/kanban-fields/SolidRichTextKanbanField.tsx +9 -0
- package/dist/components/core/kanban/kanban-fields/SolidSelectionDynamicKanbanField.tsx +13 -0
- package/dist/components/core/kanban/kanban-fields/SolidSelectionStaticKanbanField.tsx +14 -0
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +6 -6
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +121 -0
- package/dist/components/core/kanban/kanban-fields/SolidTimeKanbanField.tsx +12 -0
- package/dist/components/core/kanban/kanban-fields/SolidUuidKanbanField.tsx +13 -0
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +16 -0
- package/dist/components/core/list/ListViewRowActionPopup.tsx +42 -0
- package/dist/components/core/list/SolidListColumnSelector.tsx +167 -0
- package/dist/components/core/list/SolidListView.js +6 -6
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +961 -0
- package/dist/components/core/list/SolidListViewColumn.tsx +162 -0
- package/dist/components/core/list/SolidListViewConfigure.tsx +198 -0
- package/dist/components/core/list/SolidListingHeader.tsx +42 -0
- package/dist/components/core/list/SolidManyToOneFilterElement.tsx +59 -0
- package/dist/components/core/list/SolidSelectionDynamicFilterElement.tsx +50 -0
- package/dist/components/core/list/SolidSelectionStaticFilterElement.tsx +32 -0
- package/dist/components/core/list/SolidTableRowCell.tsx +12 -0
- package/dist/components/core/list/SolidVarInputsFilterElement.tsx +184 -0
- package/dist/components/core/list/columns/SolidBigintColumn.tsx +9 -0
- package/dist/components/core/list/columns/SolidBooleanColumn.d.ts +2 -0
- package/dist/components/core/list/columns/SolidBooleanColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidBooleanColumn.js +33 -2
- package/dist/components/core/list/columns/SolidBooleanColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidBooleanColumn.tsx +89 -0
- package/dist/components/core/list/columns/SolidComputedColumn.tsx +23 -0
- package/dist/components/core/list/columns/SolidDateColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidDateColumn.js +27 -3
- package/dist/components/core/list/columns/SolidDateColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidDateColumn.tsx +90 -0
- package/dist/components/core/list/columns/SolidDatetimeColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.js +27 -3
- package/dist/components/core/list/columns/SolidDatetimeColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.tsx +79 -0
- package/dist/components/core/list/columns/SolidDecimalColumn.tsx +9 -0
- package/dist/components/core/list/columns/SolidExternalIdColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidExternalIdColumn.js +27 -3
- package/dist/components/core/list/columns/SolidExternalIdColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidExternalIdColumn.tsx +80 -0
- package/dist/components/core/list/columns/SolidFloatColumn.tsx +9 -0
- package/dist/components/core/list/columns/SolidIdColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidIdColumn.js +27 -3
- package/dist/components/core/list/columns/SolidIdColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidIdColumn.tsx +79 -0
- package/dist/components/core/list/columns/SolidIntColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidIntColumn.js +27 -3
- package/dist/components/core/list/columns/SolidIntColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidIntColumn.tsx +87 -0
- package/dist/components/core/list/columns/SolidLongTextColumn.tsx +9 -0
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.d.ts +2 -0
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +48 -22
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +100 -0
- package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts +2 -0
- package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.js +41 -13
- package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +98 -0
- package/dist/components/core/list/columns/SolidRelationColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidRelationColumn.js +7 -0
- package/dist/components/core/list/columns/SolidRelationColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidRelationColumn.tsx +20 -0
- package/dist/components/core/list/columns/SolidRichTextColumn.tsx +9 -0
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.js +27 -3
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.tsx +80 -0
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.js +27 -3
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.tsx +81 -0
- package/dist/components/core/list/columns/SolidShortTextColumn.d.ts +2 -0
- package/dist/components/core/list/columns/SolidShortTextColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidShortTextColumn.js +16 -37
- package/dist/components/core/list/columns/SolidShortTextColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidShortTextColumn.tsx +103 -0
- package/dist/components/core/list/columns/SolidTimeColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidTimeColumn.js +27 -3
- package/dist/components/core/list/columns/SolidTimeColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidTimeColumn.tsx +78 -0
- package/dist/components/core/list/columns/SolidUuidColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidUuidColumn.js +27 -3
- package/dist/components/core/list/columns/SolidUuidColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidUuidColumn.tsx +79 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.d.ts +6 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.d.ts.map +1 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.js +70 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.js.map +1 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.tsx +110 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.d.ts +2 -0
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +42 -17
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +95 -0
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.d.ts +6 -0
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.d.ts.map +1 -0
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.js +70 -0
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.js.map +1 -0
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.tsx +111 -0
- package/dist/components/core/list/widgets/SolidRelationAvatarWidget.d.ts +4 -0
- package/dist/components/core/list/widgets/SolidRelationAvatarWidget.d.ts.map +1 -0
- package/dist/components/core/list/widgets/SolidRelationAvatarWidget.js +60 -0
- package/dist/components/core/list/widgets/SolidRelationAvatarWidget.js.map +1 -0
- package/dist/components/core/list/widgets/SolidRelationAvatarWidget.tsx +89 -0
- package/dist/components/core/list/widgets/SolidShortTextAvatarWidget.d.ts +3 -0
- package/dist/components/core/list/widgets/SolidShortTextAvatarWidget.d.ts.map +1 -0
- package/dist/components/core/list/widgets/SolidShortTextAvatarWidget.js +42 -0
- package/dist/components/core/list/widgets/SolidShortTextAvatarWidget.js.map +1 -0
- package/{src/components/core/list/widgets/SolidUserNameAvatarWidget.tsx → dist/components/core/list/widgets/SolidShortTextAvatarWidget.tsx} +18 -11
- package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.d.ts +2 -1
- package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.d.ts.map +1 -1
- package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.js +4 -4
- package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.js.map +1 -1
- package/dist/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.tsx +21 -0
- package/dist/components/core/model/CreateModel.tsx +476 -0
- package/dist/components/core/model/FieldMetaData.tsx +193 -0
- package/dist/components/core/model/FieldMetaDataForm.js +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.tsx +3048 -0
- package/dist/components/core/model/FieldSelector.tsx +62 -0
- package/dist/components/core/model/ModelListViewData.tsx +383 -0
- package/dist/components/core/model/ModelMetaData.tsx +840 -0
- package/dist/components/core/module/CreateModule.tsx +620 -0
- package/dist/components/core/module/ModuleListViewData.tsx +429 -0
- package/dist/components/core/users/CreateUser.tsx +434 -0
- package/dist/components/core/users/CreateUserRole.tsx +211 -0
- package/dist/components/core/users/UserListView.tsx +374 -0
- package/dist/components/layout/AdminLayout.tsx +62 -0
- package/dist/components/layout/AdminSidebar.tsx +65 -0
- package/dist/components/layout/AppConfig.d.ts +1 -1
- package/dist/components/layout/AppConfig.tsx +104 -0
- package/dist/components/layout/AppSidebar.tsx +225 -0
- package/dist/components/layout/ButtonLoader.tsx +7 -0
- package/dist/components/layout/CustomPagination.tsx +55 -0
- package/dist/components/layout/DashboardHeader.tsx +89 -0
- package/dist/components/layout/FilterMenu.tsx +122 -0
- package/dist/components/layout/Footer.tsx +13 -0
- package/dist/components/layout/GlobalSearch.tsx +37 -0
- package/dist/components/layout/Header.tsx +8 -0
- package/dist/components/layout/Layout.d.ts +1 -1
- package/dist/components/layout/Layout.tsx +136 -0
- package/dist/components/layout/ListingHeader.tsx +204 -0
- package/dist/components/layout/Loader.tsx +16 -0
- package/dist/components/layout/UserSidebar.tsx +53 -0
- package/dist/components/layout/context/layoutcontext.d.ts +1 -1
- package/dist/components/layout/context/layoutcontext.tsx +52 -0
- package/dist/components/layout/navbar-one.tsx +258 -0
- package/dist/components/layout/navbar-two-menu.tsx +73 -0
- package/dist/components/layout/navbar-two.tsx +37 -0
- package/dist/components/layout/user-profile-menu.tsx +120 -0
- package/dist/components/layout/user-profile.tsx +7 -0
- package/dist/components/modelsComponents/filterIcon.tsx +9 -0
- package/dist/components/tables/DemoData.tsx +318 -0
- package/dist/components/tables/DynamicTable.tsx +56 -0
- package/dist/components/tables/ListViewTable.tsx +156 -0
- package/dist/declarations.d.ts +19 -0
- package/dist/helpers/AppTitle.tsx +12 -0
- package/dist/helpers/ToastContainer.tsx +93 -0
- package/dist/helpers/authHeader.ts +20 -0
- package/dist/helpers/countries.tsx +260 -0
- package/dist/helpers/downloadMediaFile.tsx +19 -0
- package/dist/helpers/getAcceptedFileTypes.tsx +22 -0
- package/dist/helpers/getRandomColors.d.ts +4 -0
- package/dist/helpers/getRandomColors.d.ts.map +1 -0
- package/dist/helpers/getRandomColors.js +63 -0
- package/dist/helpers/getRandomColors.js.map +1 -0
- package/dist/helpers/getRandomColors.tsx +68 -0
- package/dist/helpers/helpers.ts +40 -0
- package/dist/helpers/menu.tsx +670 -0
- package/dist/helpers/permissions.ts +19 -0
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +76 -35
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +172 -0
- package/dist/helpers/revalidate.ts +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +642 -0
- package/dist/nextAuth/authProviders.tsx +221 -0
- package/dist/nextAuth/refreshAccessToken.tsx +27 -0
- package/dist/redux/api/articleApi.ts +55 -0
- package/dist/redux/api/authApi.ts +131 -0
- package/dist/redux/api/automationApi.ts +55 -0
- package/dist/redux/api/categoryApi.tsx +46 -0
- package/dist/redux/api/cityApi.tsx +56 -0
- package/dist/redux/api/cmsBannerImageApi.tsx +55 -0
- package/dist/redux/api/countryApi.tsx +56 -0
- package/dist/redux/api/fetchBaseQuery.tsx +15 -0
- package/dist/redux/api/fieldApi.ts +78 -0
- package/dist/redux/api/mediaApi.ts +55 -0
- package/dist/redux/api/mediaStorageProviderApi.ts +55 -0
- package/dist/redux/api/menuApi.tsx +55 -0
- package/dist/redux/api/menuItemsApi.tsx +56 -0
- package/dist/redux/api/modelApi.ts +77 -0
- package/dist/redux/api/moduleApi.ts +72 -0
- package/dist/redux/api/orderAttributeApi.tsx +37 -0
- package/dist/redux/api/permissionApi.ts +32 -0
- package/dist/redux/api/pincodeApi.tsx +56 -0
- package/dist/redux/api/productData.tsx +87 -0
- package/dist/redux/api/radixExtraModelAttributeApi.tsx +37 -0
- package/dist/redux/api/radixModelMetadataApi.tsx +62 -0
- package/dist/redux/api/radixModelsApi.tsx +64 -0
- package/dist/redux/api/ratingApi.ts +55 -0
- package/dist/redux/api/reviewApi.ts +55 -0
- package/dist/redux/api/roleApi.ts +58 -0
- package/dist/redux/api/solidActionApi.ts +66 -0
- package/dist/redux/api/solidChatterMessageApi.d.ts +7 -0
- package/dist/redux/api/solidChatterMessageApi.d.ts.map +1 -0
- package/dist/redux/api/solidChatterMessageApi.js +29 -0
- package/dist/redux/api/solidChatterMessageApi.js.map +1 -0
- package/dist/redux/api/solidChatterMessageApi.ts +30 -0
- package/dist/redux/api/solidEntityApi.tsx +110 -0
- package/dist/redux/api/solidMenuApi.ts +71 -0
- package/dist/redux/api/solidSettingsApi.tsx +47 -0
- package/dist/redux/api/solidViewApi.ts +73 -0
- package/dist/redux/api/stateApi.tsx +56 -0
- package/dist/redux/api/tagApi.ts +55 -0
- package/dist/redux/api/tagGroupApi.tsx +55 -0
- package/dist/redux/api/testApi.ts +21 -0
- package/dist/redux/api/userApi.ts +120 -0
- package/dist/redux/features/authSlice.ts +19 -0
- package/dist/redux/features/dataViewSlice.ts +26 -0
- package/dist/redux/features/navbarSlice.ts +21 -0
- package/dist/redux/features/popupSlice.ts +27 -0
- package/dist/redux/features/themeSlice.ts +17 -0
- package/dist/redux/features/userSlice.ts +28 -0
- package/dist/resources/globals.css +59 -0
- package/dist/types/index.d.ts +60 -0
- package/dist/types/layout.d.ts +94 -0
- package/dist/types/next-auth.d.ts +0 -0
- package/dist/types/next.d.ts +46 -0
- package/dist/types/solid-core.d.ts +139 -0
- package/package.json +4 -3
- package/src/components/Svg/RightArrowSvg.tsx +9 -0
- package/src/components/core/chatter/SolidChatter.tsx +252 -0
- package/src/components/core/chatter/SolidChatterDateDivider.tsx +16 -0
- package/src/components/core/chatter/SolidChatterHeader.tsx +178 -0
- package/src/components/core/chatter/SolidChatterMessageBox.tsx +165 -0
- package/src/components/core/chatter/SolidMessageComposer.tsx +145 -0
- package/src/components/core/chatter/chatter.module.css +70 -0
- package/src/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +2 -2
- package/src/components/core/form/SolidFormView.tsx +166 -136
- package/src/components/core/form/fields/SolidBooleanField.tsx +170 -48
- package/src/components/core/form/fields/SolidDateField.tsx +86 -51
- package/src/components/core/form/fields/SolidDateTimeField.tsx +89 -52
- package/src/components/core/form/fields/SolidDecimalField.tsx +84 -49
- package/src/components/core/form/fields/SolidEmailField.tsx +90 -51
- package/src/components/core/form/fields/SolidIntegerField.tsx +86 -49
- package/src/components/core/form/fields/SolidJsonField.tsx +112 -42
- package/src/components/core/form/fields/SolidLongTextField.tsx +76 -117
- package/src/components/core/form/fields/SolidMediaMultipleField.tsx +474 -258
- package/src/components/core/form/fields/SolidMediaSingleField.tsx +408 -249
- package/src/components/core/form/fields/SolidPasswordField.tsx +112 -55
- package/src/components/core/form/fields/SolidRichTextField.tsx +105 -52
- package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +138 -91
- package/src/components/core/form/fields/SolidSelectionStaticField.tsx +169 -37
- package/src/components/core/form/fields/SolidShortTextField.tsx +131 -74
- package/src/components/core/form/fields/SolidTimeField.tsx +85 -53
- package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +193 -30
- package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +206 -165
- package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +223 -142
- package/src/components/core/form/fields/widgets/SolidRelationFieldAvatarFormWidget.tsx +46 -0
- package/src/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +10 -10
- package/src/components/core/list/SolidListView.tsx +5 -5
- package/src/components/core/list/columns/SolidBooleanColumn.tsx +30 -2
- package/src/components/core/list/columns/SolidDateColumn.tsx +23 -8
- package/src/components/core/list/columns/SolidDatetimeColumn.tsx +24 -8
- package/src/components/core/list/columns/SolidExternalIdColumn.tsx +23 -8
- package/src/components/core/list/columns/SolidIdColumn.tsx +22 -7
- package/src/components/core/list/columns/SolidIntColumn.tsx +22 -7
- package/src/components/core/list/columns/SolidMediaMultipleColumn.tsx +68 -45
- package/src/components/core/list/columns/SolidMediaSingleColumn.tsx +48 -26
- package/src/components/core/list/columns/SolidRelationColumn.tsx +7 -0
- package/src/components/core/list/columns/SolidSelectionDynamicColumn.tsx +22 -7
- package/src/components/core/list/columns/SolidSelectionStaticColumn.tsx +24 -9
- package/src/components/core/list/columns/SolidShortTextColumn.tsx +26 -39
- package/src/components/core/list/columns/SolidTimeColumn.tsx +22 -7
- package/src/components/core/list/columns/SolidUuidColumn.tsx +22 -7
- package/src/components/core/list/columns/relations/SolidRelationManyToManyColumn.tsx +110 -0
- package/src/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +43 -19
- package/src/components/core/list/columns/relations/SolidRelationOneToManyColumn.tsx +111 -0
- package/src/components/core/list/widgets/SolidRelationAvatarWidget.tsx +89 -0
- package/src/components/core/list/widgets/SolidShortTextAvatarWidget.tsx +59 -0
- package/src/components/core/list/widgets/SolidShortTextFieldImageRenderModeWidget.tsx +5 -3
- package/src/components/core/model/FieldMetaDataForm.tsx +1 -1
- package/src/helpers/getRandomColors.tsx +68 -0
- package/src/helpers/registry.ts +89 -38
- package/src/index.ts +1 -0
- package/src/redux/api/solidChatterMessageApi.ts +30 -0
- package/src/resources/globals.css +59 -0
- package/src/types/solid-core.d.ts +24 -16
- package/src/components/core/form/fields/relations/widgets/SolidRelationManyToManyAutocompleteWidget.tsx +0 -74
- package/src/components/core/form/fields/relations/widgets/SolidRelationManyToManyCheckboxWidget.tsx +0 -103
- package/src/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.tsx +0 -79
- package/src/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.tsx +0 -68
- package/src/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.tsx +0 -23
- package/src/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.tsx +0 -13
- package/src/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.tsx +0 -23
- package/src/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.tsx +0 -32
- package/src/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.tsx +0 -17
- package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.tsx +0 -174
- package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.tsx +0 -115
- package/src/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.tsx +0 -11
- package/src/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.tsx +0 -72
- package/src/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.tsx +0 -72
- package/src/components/core/list/widgets/SolidShortTextFieldTextRenderModeWidget.tsx +0 -11
|
@@ -0,0 +1,1352 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { SolidCancelButton } from "@/components/common/CancelButton";
|
|
4
|
+
import { createPermission, deletePermission, updatePermission } from "@/helpers/permissions";
|
|
5
|
+
import { createSolidEntityApi } from "@/redux/api/solidEntityApi";
|
|
6
|
+
import { useGetSolidViewLayoutQuery } from "@/redux/api/solidViewApi";
|
|
7
|
+
import { useLazyCheckIfPermissionExistsQuery } from "@/redux/api/userApi";
|
|
8
|
+
import { FetchBaseQueryError } from "@reduxjs/toolkit/dist/query";
|
|
9
|
+
import { useFormik } from "formik";
|
|
10
|
+
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
11
|
+
import "primeflex/primeflex.css";
|
|
12
|
+
import { Button } from "primereact/button";
|
|
13
|
+
import { Dialog } from "primereact/dialog";
|
|
14
|
+
import { TabPanel, TabView } from "primereact/tabview";
|
|
15
|
+
import { Toast } from "primereact/toast";
|
|
16
|
+
import qs from "qs";
|
|
17
|
+
import { ChangeEvent, useEffect, useRef, useState } from "react";
|
|
18
|
+
import * as Yup from "yup";
|
|
19
|
+
import { FormikObject, ISolidField, SolidFieldProps } from "./fields/ISolidField";
|
|
20
|
+
import { SolidBooleanField } from "./fields/SolidBooleanField";
|
|
21
|
+
import { SolidDateField } from "./fields/SolidDateField";
|
|
22
|
+
import { SolidDateTimeField } from "./fields/SolidDateTimeField";
|
|
23
|
+
import { SolidDecimalField } from "./fields/SolidDecimalField";
|
|
24
|
+
import { SolidIntegerField } from "./fields/SolidIntegerField";
|
|
25
|
+
import { SolidJsonField } from "./fields/SolidJsonField";
|
|
26
|
+
import { SolidLongTextField } from "./fields/SolidLongTextField";
|
|
27
|
+
import { SolidMediaMultipleField } from "./fields/SolidMediaMultipleField";
|
|
28
|
+
import { SolidMediaSingleField } from "./fields/SolidMediaSingleField";
|
|
29
|
+
import { SolidRelationField } from "./fields/SolidRelationField";
|
|
30
|
+
import { SolidRichTextField } from "./fields/SolidRichTextField";
|
|
31
|
+
import { SolidSelectionDynamicField } from "./fields/SolidSelectionDynamicField";
|
|
32
|
+
import { SolidSelectionStaticField } from "./fields/SolidSelectionStaticField";
|
|
33
|
+
import { SolidShortTextField } from "./fields/SolidShortTextField";
|
|
34
|
+
import { SolidTimeField } from "./fields/SolidTimeField";
|
|
35
|
+
import { BackButton } from "@/components/common/BackButton";
|
|
36
|
+
import { OverlayPanel } from "primereact/overlaypanel";
|
|
37
|
+
import { SolidBreadcrumb } from "@/components/common/SolidBreadcrumb";
|
|
38
|
+
import { SolidUiEvent } from "@/types";
|
|
39
|
+
import { getExtensionComponent, getExtensionFunction } from "@/helpers/registry";
|
|
40
|
+
import { SolidFormWidgetProps, SolidLoadForm } from "@/types/solid-core";
|
|
41
|
+
import { SolidPasswordField } from "./fields/SolidPasswordField";
|
|
42
|
+
import { SolidEmailField } from "./fields/SolidEmailField";
|
|
43
|
+
import { Panel } from "primereact/panel";
|
|
44
|
+
import { SolidFormStepper } from "@/components/common/SolidFormStepper";
|
|
45
|
+
import { SolidFormHeader } from "@/components/common/SolidFormHeader";
|
|
46
|
+
import { SolidFormUserViewLayout } from "./SolidFormUserViewLayout";
|
|
47
|
+
import Lightbox from "yet-another-react-lightbox";
|
|
48
|
+
import Counter from "yet-another-react-lightbox/plugins/counter";
|
|
49
|
+
import Download from "yet-another-react-lightbox/plugins/download";
|
|
50
|
+
import "yet-another-react-lightbox/styles.css";
|
|
51
|
+
import "yet-another-react-lightbox/plugins/counter.css";
|
|
52
|
+
import { SolidChatter } from "../chatter/SolidChatter";
|
|
53
|
+
|
|
54
|
+
export type SolidFormViewProps = {
|
|
55
|
+
moduleName: string;
|
|
56
|
+
modelName: string;
|
|
57
|
+
id: string;
|
|
58
|
+
embeded: boolean;
|
|
59
|
+
handlePopupClose?: any,
|
|
60
|
+
customCreateHandler?: any
|
|
61
|
+
inlineCreateAutoSave?: boolean,
|
|
62
|
+
customLayout?: any,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
interface ErrorResponseData {
|
|
67
|
+
message: string;
|
|
68
|
+
statusCode: number;
|
|
69
|
+
error: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const getLayoutFields = (node: any): any => {
|
|
73
|
+
let fields = [];
|
|
74
|
+
|
|
75
|
+
if (node.type === "field") {
|
|
76
|
+
fields.push(node);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (node.children && Array.isArray(node.children)) {
|
|
80
|
+
for (const child of node.children) {
|
|
81
|
+
fields = fields.concat(getLayoutFields(child));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return fields;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const getLayoutFieldsAsObject = (layout: any[]): any => {
|
|
89
|
+
const allFields = layout.flatMap(getLayoutFields);
|
|
90
|
+
return allFields.reduce((result, field) => {
|
|
91
|
+
if (field.attrs.name) {
|
|
92
|
+
result[field.attrs.name] = { ...field };
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}, {});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const fieldFactory = (type: string, fieldContext: SolidFieldProps, setLightboxUrls?: any, setOpenLightbox?: any): ISolidField | null => {
|
|
99
|
+
if (type === 'shortText') {
|
|
100
|
+
return new SolidShortTextField(fieldContext);
|
|
101
|
+
}
|
|
102
|
+
if (type === 'longText') {
|
|
103
|
+
return new SolidLongTextField(fieldContext);
|
|
104
|
+
}
|
|
105
|
+
if (type === 'int' || type === 'bigint') {
|
|
106
|
+
return new SolidIntegerField(fieldContext);
|
|
107
|
+
}
|
|
108
|
+
if (type === 'decimal' || type === 'float') {
|
|
109
|
+
return new SolidDecimalField(fieldContext);
|
|
110
|
+
}
|
|
111
|
+
if (type === 'boolean') {
|
|
112
|
+
return new SolidBooleanField(fieldContext);
|
|
113
|
+
}
|
|
114
|
+
if (type === 'richText') {
|
|
115
|
+
return new SolidRichTextField(fieldContext);
|
|
116
|
+
}
|
|
117
|
+
if (type === 'date') {
|
|
118
|
+
return new SolidDateField(fieldContext);
|
|
119
|
+
}
|
|
120
|
+
if (type === 'datetime') {
|
|
121
|
+
return new SolidDateTimeField(fieldContext);
|
|
122
|
+
}
|
|
123
|
+
if (type === 'time') {
|
|
124
|
+
return new SolidTimeField(fieldContext);
|
|
125
|
+
}
|
|
126
|
+
if (type === 'json') {
|
|
127
|
+
return new SolidJsonField(fieldContext);
|
|
128
|
+
}
|
|
129
|
+
if (type === 'selectionStatic') {
|
|
130
|
+
return new SolidSelectionStaticField(fieldContext);
|
|
131
|
+
}
|
|
132
|
+
if (type === 'selectionDynamic') {
|
|
133
|
+
return new SolidSelectionDynamicField(fieldContext);
|
|
134
|
+
}
|
|
135
|
+
if (type === 'relation') {
|
|
136
|
+
return new SolidRelationField(fieldContext);
|
|
137
|
+
}
|
|
138
|
+
if (type === 'mediaSingle') {
|
|
139
|
+
return new SolidMediaSingleField(fieldContext, setLightboxUrls, setOpenLightbox);
|
|
140
|
+
}
|
|
141
|
+
if (type === 'mediaMultiple') {
|
|
142
|
+
return new SolidMediaMultipleField(fieldContext, setLightboxUrls, setOpenLightbox);
|
|
143
|
+
}
|
|
144
|
+
if (type === 'password') {
|
|
145
|
+
return new SolidPasswordField(fieldContext);
|
|
146
|
+
}
|
|
147
|
+
if (type === 'email') {
|
|
148
|
+
return new SolidEmailField(fieldContext);
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// solidFieldsMetadata={solidFieldsMetadata} solidView={solidView}
|
|
154
|
+
const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, viewMode, onChange, onBlur, setLightboxUrls, setOpenLightbox }: any) => {
|
|
155
|
+
const fieldContext: SolidFieldProps = {
|
|
156
|
+
// field metadata - coming from the field-metadata table.
|
|
157
|
+
fieldMetadata: fieldMetadata,
|
|
158
|
+
// field layout - coming from view.layout
|
|
159
|
+
field: field,
|
|
160
|
+
// initial data
|
|
161
|
+
data: initialEntityData,
|
|
162
|
+
// complete form view metadata - this includes layout of the whole form & metadata about all fields in the corresponding model.
|
|
163
|
+
solidFormViewMetaData: solidFormViewMetaData,
|
|
164
|
+
modelName: modelName,
|
|
165
|
+
readOnly: readOnly,
|
|
166
|
+
viewMode: viewMode,
|
|
167
|
+
onChange: onChange,
|
|
168
|
+
onBlur: onBlur
|
|
169
|
+
}
|
|
170
|
+
const solidField = fieldFactory(fieldMetadata?.type, fieldContext, setLightboxUrls, setOpenLightbox);
|
|
171
|
+
|
|
172
|
+
return solidField?.render(formik);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const SolidGroup = ({ children, attrs }: any) => {
|
|
176
|
+
|
|
177
|
+
const className = attrs.className;
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<div className={className}>
|
|
181
|
+
{attrs.label && <p>{attrs.label}</p>}
|
|
182
|
+
<div className="grid">{children}</div>
|
|
183
|
+
</div>
|
|
184
|
+
// <div className={className}>
|
|
185
|
+
// <div className="s_group">
|
|
186
|
+
// <fieldset>
|
|
187
|
+
// {attrs.label && <p className="s_group_heading">{attrs.label}</p>}
|
|
188
|
+
// <div className="grid">{children}</div>
|
|
189
|
+
// </fieldset>
|
|
190
|
+
// </div>
|
|
191
|
+
|
|
192
|
+
// </div>
|
|
193
|
+
// <div className="formgrid grid">
|
|
194
|
+
// {children}
|
|
195
|
+
// </div>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const SolidRow = ({ children, attrs }: any) => {
|
|
200
|
+
|
|
201
|
+
const className = attrs.className;
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
// <div className={`row ${className}`}>
|
|
205
|
+
|
|
206
|
+
// <div className="s_group">
|
|
207
|
+
// <fieldset>
|
|
208
|
+
// {attrs.label && <p className="s_group_heading">{attrs.label}</p>}
|
|
209
|
+
// <div className="grid">{children}</div>
|
|
210
|
+
// </fieldset>
|
|
211
|
+
// </div>
|
|
212
|
+
|
|
213
|
+
// </div>
|
|
214
|
+
<div className={`row ${className}`}>
|
|
215
|
+
{attrs.label && <p >{attrs.label}</p>}
|
|
216
|
+
<div className="grid">{children}</div>
|
|
217
|
+
</div>
|
|
218
|
+
// <div>{children}</div>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
const SolidColumn = ({ children, attrs }: any) => {
|
|
222
|
+
const className = attrs.className;
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
// first fieldset ui
|
|
226
|
+
|
|
227
|
+
// <div className={`${className}`}>
|
|
228
|
+
// <div className="s_group">
|
|
229
|
+
// <fieldset>
|
|
230
|
+
// {attrs.label && <p className="s_group_heading">{attrs.label}</p>}
|
|
231
|
+
// <div className="grid">{children}</div>
|
|
232
|
+
// </fieldset>
|
|
233
|
+
// </div>
|
|
234
|
+
// </div>
|
|
235
|
+
|
|
236
|
+
//second fieldset ui
|
|
237
|
+
// <div className={`${className}`}>
|
|
238
|
+
// {attrs.label && <p>{attrs.label}</p>}
|
|
239
|
+
// <div className="grid">{children}</div>
|
|
240
|
+
// </div>
|
|
241
|
+
|
|
242
|
+
//figma fieldset ui
|
|
243
|
+
attrs.label ?
|
|
244
|
+
<div className={`${className}`}>
|
|
245
|
+
<Panel header={attrs.label} className="solid-column-panel">
|
|
246
|
+
<div className="grid">{children}</div>
|
|
247
|
+
</Panel>
|
|
248
|
+
{/* <div className="p-fieldset">
|
|
249
|
+
<div className="solid-fieldset-header">
|
|
250
|
+
<div>{attrs.label}</div>
|
|
251
|
+
</div>
|
|
252
|
+
<div className="grid solid-fieldset-content">{children}</div>
|
|
253
|
+
</div> */}
|
|
254
|
+
</div>
|
|
255
|
+
:
|
|
256
|
+
<div className={`${className}`}>
|
|
257
|
+
<div className="grid">{children}</div>
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const SolidSheet = ({ children }: any) => (
|
|
263
|
+
<div className="p-fluid p-grid">
|
|
264
|
+
{children}
|
|
265
|
+
</div>
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const SolidNotebook = ({ children }: any) => {
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<div className="solid-tab-view w-full">
|
|
272
|
+
<TabView>
|
|
273
|
+
{children}
|
|
274
|
+
</TabView>
|
|
275
|
+
</div>
|
|
276
|
+
)
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const SolidDynamicWidget = ({ widgetName, formik, field, solidFormViewMetaData }: any) => {
|
|
280
|
+
const solidView = solidFormViewMetaData.data.solidView;
|
|
281
|
+
const solidFieldsMetadata = solidFormViewMetaData.data.solidFieldsMetadata;
|
|
282
|
+
|
|
283
|
+
let DynamicWidget = getExtensionComponent(widgetName);
|
|
284
|
+
|
|
285
|
+
const widgetProps: SolidFormWidgetProps = {
|
|
286
|
+
formData: formik.values,
|
|
287
|
+
field: field,
|
|
288
|
+
fieldsMetadata: solidFieldsMetadata,
|
|
289
|
+
viewMetadata: solidView
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<div className="solid-tab-view w-full">
|
|
294
|
+
{DynamicWidget && <DynamicWidget {...widgetProps} />}
|
|
295
|
+
</div>
|
|
296
|
+
)
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
const SolidPage = ({ attrs, children, key }: any) => (
|
|
301
|
+
<TabPanel key={key} header={attrs.label} >
|
|
302
|
+
<div className="p-fluid">{children}</div>
|
|
303
|
+
</TabPanel>
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
// Original code...
|
|
307
|
+
// const addLevelToGroups = (layout: any, level = 1) => {
|
|
308
|
+
// return layout.map((element: any) => {
|
|
309
|
+
// if (element.type === "group") {
|
|
310
|
+
// // Add the level to the group's attrs
|
|
311
|
+
// element.attrs = {
|
|
312
|
+
// ...element.attrs,
|
|
313
|
+
// level: level, // Add level information to the attrs
|
|
314
|
+
// // className: level === 1 ? 'col-12' : 'col-6', // Assign className based on level
|
|
315
|
+
// };
|
|
316
|
+
// } else {
|
|
317
|
+
// element.children = addLevelToGroups(element.children, level);
|
|
318
|
+
// }
|
|
319
|
+
// // If the element has children, recursively apply this logic
|
|
320
|
+
// // if (element.children) {
|
|
321
|
+
// // element.children = addLevelToGroups(element.children, level + 1);
|
|
322
|
+
// // }
|
|
323
|
+
|
|
324
|
+
// return element;
|
|
325
|
+
// });
|
|
326
|
+
// };
|
|
327
|
+
|
|
328
|
+
// Fix for immutable objects.
|
|
329
|
+
// const addLevelToGroups = (layout: any, level = 1): any[] => {
|
|
330
|
+
// return layout.map((element: any) => {
|
|
331
|
+
// // Create a new object for immutability
|
|
332
|
+
// const updatedElement = { ...element };
|
|
333
|
+
|
|
334
|
+
// if (updatedElement.type === "group") {
|
|
335
|
+
// // Add level to attrs, creating a new object for immutability
|
|
336
|
+
// updatedElement.attrs = {
|
|
337
|
+
// ...updatedElement.attrs,
|
|
338
|
+
// level: level, // Add level information
|
|
339
|
+
// };
|
|
340
|
+
// }
|
|
341
|
+
|
|
342
|
+
// // If the element has children, recursively apply this logic
|
|
343
|
+
// if (updatedElement.children) {
|
|
344
|
+
// updatedElement.children = addLevelToGroups(updatedElement.children, level + 1);
|
|
345
|
+
// }
|
|
346
|
+
|
|
347
|
+
// return updatedElement;
|
|
348
|
+
// });
|
|
349
|
+
// };
|
|
350
|
+
|
|
351
|
+
const SolidFormView = (params: SolidFormViewProps) => {
|
|
352
|
+
const pathname = usePathname();
|
|
353
|
+
const router = useRouter();
|
|
354
|
+
const toast = useRef<Toast>(null);
|
|
355
|
+
const searchParams = useSearchParams();
|
|
356
|
+
const viewModeFromURL = searchParams.get("viewMode");
|
|
357
|
+
|
|
358
|
+
const [redirectToList, setRedirectToList] = useState(false);
|
|
359
|
+
|
|
360
|
+
const [isDeleteDialogVisible, setDeleteDialogVisible] = useState(false);
|
|
361
|
+
const [isLayoutDialogVisible, setLayoutDialogVisible] = useState(false);
|
|
362
|
+
|
|
363
|
+
const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
|
|
364
|
+
const [viewMode, setViewMode] = useState<"view" | "edit">("view");
|
|
365
|
+
const [openLightbox, setOpenLightbox] = useState(false);
|
|
366
|
+
const [lightboxUrls, setLightboxUrls] = useState([]);
|
|
367
|
+
const [isShowChatter, setShowChatter] = useState(true);
|
|
368
|
+
|
|
369
|
+
const errorFields: string[] = [];
|
|
370
|
+
|
|
371
|
+
const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
|
|
372
|
+
const op = useRef(null);
|
|
373
|
+
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
if (viewModeFromURL === "edit" || viewModeFromURL === "view") {
|
|
376
|
+
setViewMode(viewModeFromURL);
|
|
377
|
+
} else {
|
|
378
|
+
setViewMode("view"); // Default to 'view' if not present
|
|
379
|
+
}
|
|
380
|
+
if (params.id === 'new') {
|
|
381
|
+
setViewMode("edit");
|
|
382
|
+
}
|
|
383
|
+
}, [viewModeFromURL]);
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
// function that updates view mode
|
|
387
|
+
const updateViewMode = (newMode: "view" | "edit") => {
|
|
388
|
+
setViewMode(newMode);
|
|
389
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
390
|
+
params.set("viewMode", newMode);
|
|
391
|
+
router.push(`${pathname}?${params.toString()}`, { scroll: false });
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
useEffect(() => {
|
|
399
|
+
const fetchPermissions = async () => {
|
|
400
|
+
if (params.modelName) {
|
|
401
|
+
const permissionNames = [
|
|
402
|
+
createPermission(params.modelName),
|
|
403
|
+
deletePermission(params.modelName),
|
|
404
|
+
updatePermission(params.modelName)
|
|
405
|
+
]
|
|
406
|
+
const queryData = {
|
|
407
|
+
permissionNames: permissionNames
|
|
408
|
+
};
|
|
409
|
+
const queryString = qs.stringify(queryData, {
|
|
410
|
+
encodeValuesOnly: true
|
|
411
|
+
});
|
|
412
|
+
const response = await triggerCheckIfPermissionExists(queryString);
|
|
413
|
+
setActionsAllowed(response.data.data);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
fetchPermissions();
|
|
417
|
+
}, [params.modelName]);
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
// Create the RTK slices for this entitor (const id of fieldValue) {
|
|
421
|
+
// if (!isInt(id)) {
|
|
422
|
+
// errors.push({ field: this.fieldMetadata.name, error: `Invalid ids in ${commandFieldName}` });
|
|
423
|
+
// }
|
|
424
|
+
// }y
|
|
425
|
+
const entityApi = createSolidEntityApi(params.modelName);
|
|
426
|
+
const {
|
|
427
|
+
useCreateSolidEntityMutation,
|
|
428
|
+
useDeleteSolidEntityMutation,
|
|
429
|
+
useGetSolidEntityByIdQuery,
|
|
430
|
+
useUpdateSolidEntityMutation
|
|
431
|
+
} = entityApi;
|
|
432
|
+
|
|
433
|
+
const [
|
|
434
|
+
createEntity,
|
|
435
|
+
{ isSuccess: isEntityCreateSuccess, isError: isEntityCreateError, error: entityCreateError },
|
|
436
|
+
] = useCreateSolidEntityMutation();
|
|
437
|
+
|
|
438
|
+
const [
|
|
439
|
+
updateEntity,
|
|
440
|
+
{ isSuccess: isEntityUpdateSuceess, isError: isEntityUpdateError, error: entityUpdateError },
|
|
441
|
+
] = useUpdateSolidEntityMutation();
|
|
442
|
+
|
|
443
|
+
const [
|
|
444
|
+
deleteEntity,
|
|
445
|
+
{ isSuccess: isEntityDeleteSuceess, isError: isEntityDeleteError, error: entityDeleteError },
|
|
446
|
+
] = useDeleteSolidEntityMutation();
|
|
447
|
+
|
|
448
|
+
// - - - - - - - - - - - -- - - - - - - - - - - - METADATA here
|
|
449
|
+
// Get the form view layout & metadata first.
|
|
450
|
+
const formViewMetaDataQs = qs.stringify({ ...params, viewType: 'form' }, {
|
|
451
|
+
encodeValuesOnly: true,
|
|
452
|
+
});
|
|
453
|
+
const [formViewMetaData, setFormViewMetaData] = useState({});
|
|
454
|
+
const [formViewLayout, setFormViewLayout] = useState<any>(null);
|
|
455
|
+
const {
|
|
456
|
+
data: solidFormViewMetaData,
|
|
457
|
+
isLoading: solidFormViewMetaDataIsLoading
|
|
458
|
+
} = useGetSolidViewLayoutQuery(formViewMetaDataQs);
|
|
459
|
+
const [refreshChatterMessage, setRefreshChatterMessage] = useState<boolean>(true);
|
|
460
|
+
useEffect(() => {
|
|
461
|
+
if (
|
|
462
|
+
isEntityCreateSuccess == true ||
|
|
463
|
+
isEntityUpdateSuceess == true ||
|
|
464
|
+
isEntityDeleteSuceess == true
|
|
465
|
+
) {
|
|
466
|
+
setRefreshChatterMessage(true);
|
|
467
|
+
// Close The pop in case the form is used in embeded form
|
|
468
|
+
if (params.embeded == true) {
|
|
469
|
+
params.handlePopupClose()
|
|
470
|
+
}
|
|
471
|
+
if (redirectToList === true) {
|
|
472
|
+
|
|
473
|
+
const segments = pathname.split('/').filter(Boolean); // Split and filter empty segments
|
|
474
|
+
const newPath = '/' + segments.slice(0, -2).join('/') + '/list'; // Remove last segment and add "/all"
|
|
475
|
+
router.push(newPath);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}, [isEntityCreateSuccess, isEntityUpdateSuceess, isEntityDeleteSuceess]);
|
|
479
|
+
|
|
480
|
+
function isFetchBaseQueryErrorWithErrorResponse(error: any): error is FetchBaseQueryError & { data: ErrorResponseData } {
|
|
481
|
+
return error && typeof error === 'object' && 'data' in error && 'message' in error.data;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
useEffect(() => {
|
|
485
|
+
const handleError = (errorToast: any) => {
|
|
486
|
+
let errorMessage: any = ['An error occurred'];
|
|
487
|
+
|
|
488
|
+
if (isFetchBaseQueryErrorWithErrorResponse(errorToast)) {
|
|
489
|
+
errorMessage = errorToast.data.message;
|
|
490
|
+
} else {
|
|
491
|
+
errorMessage = ['Something went wrong'];
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
toast.current?.show({
|
|
495
|
+
severity: 'error',
|
|
496
|
+
summary: 'Error',
|
|
497
|
+
detail: errorMessage,
|
|
498
|
+
life: 3000,
|
|
499
|
+
//@ts-ignore
|
|
500
|
+
content: () => (
|
|
501
|
+
<div className="flex flex-column align-items-left" style={{ flex: "1" }}>
|
|
502
|
+
{Array.isArray(errorMessage) ? (
|
|
503
|
+
errorMessage.map((message, index) => (
|
|
504
|
+
<div className="flex align-items-center gap-2" key={index}>
|
|
505
|
+
<span className="font-bold text-900">{message.trim()}</span>
|
|
506
|
+
</div>
|
|
507
|
+
))
|
|
508
|
+
) : (
|
|
509
|
+
<div className="flex align-items-center gap-2">
|
|
510
|
+
<span className="font-bold text-900">{errorMessage?.trim()}</span>
|
|
511
|
+
</div>
|
|
512
|
+
)}
|
|
513
|
+
</div>
|
|
514
|
+
),
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
// Check and handle errors from each API operation
|
|
519
|
+
if (isEntityCreateError) {
|
|
520
|
+
handleError(entityCreateError);
|
|
521
|
+
} else if (isEntityDeleteError) {
|
|
522
|
+
handleError(entityDeleteError);
|
|
523
|
+
} else if (isEntityUpdateError) {
|
|
524
|
+
handleError(entityUpdateError);
|
|
525
|
+
}
|
|
526
|
+
}, [
|
|
527
|
+
isEntityCreateError,
|
|
528
|
+
isEntityDeleteError,
|
|
529
|
+
isEntityUpdateError
|
|
530
|
+
]);
|
|
531
|
+
|
|
532
|
+
const showError = async () => {
|
|
533
|
+
// Trigger validation and get the updated errors
|
|
534
|
+
const errors = await formik.validateForm();
|
|
535
|
+
const errorMessages = Object.values(errors);
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
539
|
+
toast.current?.show({
|
|
540
|
+
severity,
|
|
541
|
+
summary,
|
|
542
|
+
detail,
|
|
543
|
+
life: 3000,
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
const onFormikSubmit = async (values: any) => {
|
|
548
|
+
const solidView = solidFormViewMetaData.data.solidView;
|
|
549
|
+
const solidFieldsMetadata = solidFormViewMetaData.data.solidFieldsMetadata;
|
|
550
|
+
const layoutFieldsObj = getLayoutFieldsAsObject([formViewLayout]);
|
|
551
|
+
|
|
552
|
+
try {
|
|
553
|
+
let formData = new FormData();
|
|
554
|
+
|
|
555
|
+
// Iterate through the keys in the values object
|
|
556
|
+
Object.entries(values).forEach(([key, value]) => {
|
|
557
|
+
|
|
558
|
+
const fieldMetadata = solidFieldsMetadata[key];
|
|
559
|
+
const fieldContext: SolidFieldProps = {
|
|
560
|
+
fieldMetadata: fieldMetadata,
|
|
561
|
+
field: layoutFieldsObj[key],
|
|
562
|
+
data: initialEntityData,
|
|
563
|
+
solidFormViewMetaData: solidFormViewMetaData,
|
|
564
|
+
modelName: params.modelName
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
let solidField = fieldFactory(fieldMetadata?.type, fieldContext);
|
|
568
|
+
|
|
569
|
+
// Append each field to the FormData
|
|
570
|
+
if (value !== undefined && value !== null && solidField) {
|
|
571
|
+
solidField.updateFormData(value, formData);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
});
|
|
575
|
+
if (params.inlineCreateAutoSave === true) {
|
|
576
|
+
params.customCreateHandler(formData);
|
|
577
|
+
} else {
|
|
578
|
+
if (params.id === 'new') {
|
|
579
|
+
// createEntity(formData);
|
|
580
|
+
const result = await createEntity(formData).unwrap();
|
|
581
|
+
showToast("success", "Form saved", "Form saved successfully!");
|
|
582
|
+
if (!params.embeded) {
|
|
583
|
+
const updatedUrl = pathname.replace("new", result?.data?.id);
|
|
584
|
+
router.push(updatedUrl);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
// updateEntity({ id: +params.id, data: formData });
|
|
589
|
+
await updateEntity({ id: +params.id, data: formData }).unwrap();
|
|
590
|
+
// const result = await updateEntity({ id: +params.id, data: formData }).unwrap();
|
|
591
|
+
if (!params.embeded) {
|
|
592
|
+
showToast("success", "Form Updated", "Form updated successfully!");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
} catch (err) {
|
|
598
|
+
console.error("Failed to create Entity: ", err);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
const showFieldError = () => {
|
|
603
|
+
if (errorFields?.length === 0) return;
|
|
604
|
+
errorFields.forEach((error) => {
|
|
605
|
+
toast?.current?.show({
|
|
606
|
+
severity: "error",
|
|
607
|
+
summary: "Metadata Error",
|
|
608
|
+
detail: error,
|
|
609
|
+
life: 3000,
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
// errorFields.length = 0;
|
|
615
|
+
};
|
|
616
|
+
// useEffect(() => {
|
|
617
|
+
// if (errorFields?.length > 0) {
|
|
618
|
+
// showFieldError();
|
|
619
|
+
// }
|
|
620
|
+
// }, [errorFields])
|
|
621
|
+
|
|
622
|
+
// - - - - - - - - - - - -- - - - - - - - - - - - DATA here
|
|
623
|
+
// Fetch the actual data here.
|
|
624
|
+
// This is the initial value of this form, will come from an API call in the case of edit.
|
|
625
|
+
let layoutFields = [];
|
|
626
|
+
let toPopulate = [];
|
|
627
|
+
let toPopulateMedia = [];
|
|
628
|
+
if (solidFormViewMetaData && formViewLayout) {
|
|
629
|
+
const solidView = solidFormViewMetaData.data.solidView;
|
|
630
|
+
const solidFieldsMetadata = solidFormViewMetaData.data.solidFieldsMetadata;
|
|
631
|
+
layoutFields = [formViewLayout].flatMap(getLayoutFields);
|
|
632
|
+
for (let i = 0; i < layoutFields?.length; i++) {
|
|
633
|
+
const formLayoutField = layoutFields[i];
|
|
634
|
+
const fieldMetadata = solidFieldsMetadata[formLayoutField.attrs.name];
|
|
635
|
+
if (fieldMetadata?.type === 'relation') {
|
|
636
|
+
toPopulate.push(fieldMetadata.name);
|
|
637
|
+
}
|
|
638
|
+
if (fieldMetadata?.type === 'mediaSingle' || fieldMetadata?.type === 'mediaMultiple') {
|
|
639
|
+
toPopulateMedia.push(fieldMetadata.name);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
// TODO: Possible optimisation here, we are firing 2 queries to load the form view data object.
|
|
644
|
+
// once without populate & populateMedia and then again once after that.
|
|
645
|
+
const formViewDataQs = qs.stringify({ populate: toPopulate, populateMedia: toPopulateMedia }, {
|
|
646
|
+
encodeValuesOnly: true,
|
|
647
|
+
});
|
|
648
|
+
const [initialEntityData, setInitialEntityData] = useState({});
|
|
649
|
+
const {
|
|
650
|
+
data: solidFormViewData,
|
|
651
|
+
isLoading: solidFormViewDataIsLoading,
|
|
652
|
+
refetch: refetchSolidFormViewData,
|
|
653
|
+
} = useGetSolidEntityByIdQuery({ id: params.id, qs: formViewDataQs }, {
|
|
654
|
+
skip: params.id === 'new'
|
|
655
|
+
});
|
|
656
|
+
useEffect(() => {
|
|
657
|
+
if (params.id !== 'new') {
|
|
658
|
+
refetchSolidFormViewData()
|
|
659
|
+
}
|
|
660
|
+
}, [formViewDataQs])
|
|
661
|
+
|
|
662
|
+
useEffect(() => {
|
|
663
|
+
const handleDynamicLayout = async () => {
|
|
664
|
+
if (solidFormViewMetaData) {
|
|
665
|
+
let formLayout = solidFormViewMetaData;
|
|
666
|
+
const dynamicHeader = solidFormViewMetaData?.data?.solidView?.layout?.onFormLayoutLoad;
|
|
667
|
+
let DynamicFunctionComponent = null;
|
|
668
|
+
const event: SolidLoadForm = {
|
|
669
|
+
fieldsMetadata: solidFormViewMetaData,
|
|
670
|
+
formData: solidFormViewData?.data,
|
|
671
|
+
type: 'onFormLayoutLoad',
|
|
672
|
+
viewMetadata: solidFormViewMetaData?.data?.solidView
|
|
673
|
+
}
|
|
674
|
+
if (dynamicHeader) {
|
|
675
|
+
DynamicFunctionComponent = getExtensionFunction(dynamicHeader);
|
|
676
|
+
if (DynamicFunctionComponent) {
|
|
677
|
+
try {
|
|
678
|
+
const updatedFormLayout = await DynamicFunctionComponent(event);
|
|
679
|
+
if (updatedFormLayout && updatedFormLayout?.layoutChanged && updatedFormLayout?.newLayout) {
|
|
680
|
+
const newFormLayout = {
|
|
681
|
+
...formLayout,
|
|
682
|
+
data: {
|
|
683
|
+
...formLayout.data,
|
|
684
|
+
solidView: {
|
|
685
|
+
...formLayout.data.solidView,
|
|
686
|
+
layout: updatedFormLayout.newLayout
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
formLayout = newFormLayout;
|
|
691
|
+
}
|
|
692
|
+
} catch (error) {
|
|
693
|
+
console.error('Error in DynamicFunctionComponent:', error);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
setFormViewMetaData(formLayout);
|
|
698
|
+
if (params.customLayout) {
|
|
699
|
+
setFormViewLayout(params.customLayout);
|
|
700
|
+
} else {
|
|
701
|
+
setFormViewLayout(formLayout.data.solidView.layout);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
handleDynamicLayout();
|
|
707
|
+
}, [solidFormViewMetaData, solidFormViewData]);
|
|
708
|
+
|
|
709
|
+
useEffect(() => {
|
|
710
|
+
const handleDynamicFunction = async () => {
|
|
711
|
+
if (solidFormViewData) {
|
|
712
|
+
const dynamicHeader = solidFormViewMetaData?.data?.solidView?.layout?.onFormDataLoad;
|
|
713
|
+
|
|
714
|
+
let DynamicFunctionComponent = null;
|
|
715
|
+
let formViewData = solidFormViewData?.data;
|
|
716
|
+
|
|
717
|
+
const event: SolidLoadForm = {
|
|
718
|
+
fieldsMetadata: solidFormViewMetaData,
|
|
719
|
+
formData: solidFormViewData?.data,
|
|
720
|
+
type: dynamicHeader,
|
|
721
|
+
viewMetadata: solidFormViewMetaData?.data?.solidView
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
if (dynamicHeader) {
|
|
725
|
+
DynamicFunctionComponent = getExtensionFunction(dynamicHeader);
|
|
726
|
+
|
|
727
|
+
if (DynamicFunctionComponent) {
|
|
728
|
+
const updatedFormData = await DynamicFunctionComponent(event);
|
|
729
|
+
|
|
730
|
+
if (updatedFormData && updatedFormData?.dataChanged && updatedFormData?.newFormData) {
|
|
731
|
+
formViewData = updatedFormData.newFormData;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
setInitialEntityData(formViewData);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
handleDynamicFunction();
|
|
740
|
+
}, [solidFormViewData]);
|
|
741
|
+
|
|
742
|
+
let formik: FormikObject;
|
|
743
|
+
|
|
744
|
+
// If either the metadata or the data of this form is loading, then we simply render a loading screen...
|
|
745
|
+
if (solidFormViewMetaDataIsLoading || solidFormViewDataIsLoading || !formViewLayout) {
|
|
746
|
+
formik = useFormik({
|
|
747
|
+
initialValues: {},
|
|
748
|
+
validationSchema: Yup.object(),
|
|
749
|
+
enableReinitialize: true,
|
|
750
|
+
onSubmit: onFormikSubmit,
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
return <div>Rendering form...</div>;
|
|
754
|
+
}
|
|
755
|
+
// At this point everything required to render the form is loaded, so we go ahead and start rendering things dynamically...
|
|
756
|
+
else {
|
|
757
|
+
|
|
758
|
+
// Initialize formik...
|
|
759
|
+
const solidView = solidFormViewMetaData.data.solidView;
|
|
760
|
+
const solidFieldsMetadata = solidFormViewMetaData.data.solidFieldsMetadata;
|
|
761
|
+
|
|
762
|
+
const createHeaderTitle = `Create ${solidView.model.displayName}`;
|
|
763
|
+
const editHeaderTitle = `Edit ${solidView.model.displayName}`;
|
|
764
|
+
|
|
765
|
+
const validationSchema = {};
|
|
766
|
+
const initialValues = {};
|
|
767
|
+
|
|
768
|
+
for (let i = 0; i < layoutFields?.length; i++) {
|
|
769
|
+
const formLayoutField = layoutFields[i];
|
|
770
|
+
const fieldMetadata = solidFieldsMetadata[formLayoutField.attrs.name];
|
|
771
|
+
const fieldContext: SolidFieldProps = {
|
|
772
|
+
fieldMetadata: fieldMetadata,
|
|
773
|
+
field: formLayoutField,
|
|
774
|
+
data: initialEntityData,
|
|
775
|
+
solidFormViewMetaData: solidFormViewMetaData,
|
|
776
|
+
modelName: params.modelName
|
|
777
|
+
}
|
|
778
|
+
let solidField = fieldFactory(fieldMetadata?.type, fieldContext);
|
|
779
|
+
if (!fieldMetadata?.type) {
|
|
780
|
+
const errorMessage = formLayoutField.attrs.label;
|
|
781
|
+
if (!errorFields.includes(errorMessage)) {
|
|
782
|
+
errorFields.push(errorMessage);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (solidField) {
|
|
786
|
+
// @ts-ignore
|
|
787
|
+
validationSchema[formLayoutField.attrs.name] = solidField.validationSchema();
|
|
788
|
+
// @ts-ignore
|
|
789
|
+
initialValues[formLayoutField.attrs.name] = solidField.initialValue();
|
|
790
|
+
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
formik = useFormik({
|
|
795
|
+
initialValues: initialValues,
|
|
796
|
+
validationSchema: Yup.object(validationSchema),
|
|
797
|
+
enableReinitialize: true,
|
|
798
|
+
onSubmit: onFormikSubmit,
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
const formFieldOnXXX = async (event: ChangeEvent<HTMLInputElement>, eventType: string) => {
|
|
802
|
+
|
|
803
|
+
// Invoke the formik change
|
|
804
|
+
if (eventType === 'onFieldChange') {
|
|
805
|
+
formik.handleChange(event);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// get details from the form event
|
|
809
|
+
const { name: fieldName, value, type, checked } = event.target;
|
|
810
|
+
// console.log(`${eventType}: formFieldOnXXX ${fieldName} invoked for change with value:`, value);
|
|
811
|
+
|
|
812
|
+
// TODO: check if there is a change handler registered with this form view, load it and fire it.
|
|
813
|
+
const changeHandler = solidView.layout[eventType];
|
|
814
|
+
// console.log(`changeHandler for this form is ${changeHandler}`);
|
|
815
|
+
|
|
816
|
+
if (changeHandler) {
|
|
817
|
+
// Get hold of the dynamic module...
|
|
818
|
+
// const dynamicChangeHandler = await loadDynamicModule(changeHandler);
|
|
819
|
+
const dynamicChangeHandler = getExtensionFunction(changeHandler);
|
|
820
|
+
|
|
821
|
+
// Invoke the dynamic module...
|
|
822
|
+
if (dynamicChangeHandler) {
|
|
823
|
+
const event: SolidUiEvent = {
|
|
824
|
+
fieldsMetadata: solidFieldsMetadata,
|
|
825
|
+
formData: formik.values,
|
|
826
|
+
modifiedField: fieldName,
|
|
827
|
+
modifiedFieldValue: value,
|
|
828
|
+
// @ts-ignore
|
|
829
|
+
// TODO: HP & OR: This will be fixed once we figure out how to get types exported from solid-core-ui
|
|
830
|
+
type: eventType,
|
|
831
|
+
viewMetadata: solidView
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// Invoke the dynamic change handler:
|
|
835
|
+
// TODO: encapsulate in try/catch, catch the exception render in the UI as an error & stop form rendering.
|
|
836
|
+
const updatedFormInfo = await dynamicChangeHandler(event);
|
|
837
|
+
// console.log(`${eventType}: formFieldOnXXX response received: `, updatedFormInfo);
|
|
838
|
+
|
|
839
|
+
// If dataChanged is true, update Formik values
|
|
840
|
+
if (updatedFormInfo?.dataChanged && updatedFormInfo.newFormData) {
|
|
841
|
+
// This does one field at a time.
|
|
842
|
+
// TODO: does the below fire change events again?
|
|
843
|
+
Object.entries(updatedFormInfo.newFormData).forEach(([key, newValue]) => {
|
|
844
|
+
formik.setFieldValue(key, newValue);
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
// This does all at once.
|
|
848
|
+
// formik.setValues({
|
|
849
|
+
// ...formik.values,
|
|
850
|
+
// ...updatedFormInfo.newFormData
|
|
851
|
+
// });
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// if layout has changed then we need to re-render.
|
|
855
|
+
if (updatedFormInfo?.layoutChanged && updatedFormInfo.newLayout) {
|
|
856
|
+
// setFormViewMetaData({ ...formViewMetaData, layout: updatedFormInfo.newLayout });
|
|
857
|
+
// console.log(`Existing form view metadata is: `, formViewMetaData);
|
|
858
|
+
|
|
859
|
+
// TODO: this will trigger a useEffect dependent on formViewMetadata that invokes setFormViewLayout,
|
|
860
|
+
// TODO: which means that this will not work if custom layout has been injected as a prop.
|
|
861
|
+
setFormViewLayout(updatedFormInfo.newLayout);
|
|
862
|
+
setFormViewMetaData((prevMetaData: any) => {
|
|
863
|
+
const updatedFormViewMetadata = {
|
|
864
|
+
...prevMetaData,
|
|
865
|
+
data: {
|
|
866
|
+
...prevMetaData.data,
|
|
867
|
+
solidView: {
|
|
868
|
+
...prevMetaData.data.solidView,
|
|
869
|
+
layout: updatedFormInfo.newLayout,
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
};
|
|
873
|
+
// console.log(`Updated form view metadata is: `, updatedFormViewMetadata);
|
|
874
|
+
return updatedFormViewMetadata;
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
// TODO: Show an error popup and stop form rendering ideallly...
|
|
880
|
+
console.log(`Unable to load dynamic module:`, changeHandler);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// Now render the form dynamically...
|
|
886
|
+
const renderFormElementDynamically: any = (element: any, solidFormViewMetaData: any) => {
|
|
887
|
+
let { type, attrs, body, children } = element;
|
|
888
|
+
|
|
889
|
+
// const key = attrs?.name ?? generateRandomKey();
|
|
890
|
+
const key = attrs?.name;
|
|
891
|
+
let visible = attrs?.visible;
|
|
892
|
+
if (visible === undefined || visible === null) {
|
|
893
|
+
visible = true;
|
|
894
|
+
}
|
|
895
|
+
// console.log(`Resolved visibility of form element ${key} to ${visible}`);
|
|
896
|
+
// console.log(`Form element ${key}: `, attrs);
|
|
897
|
+
|
|
898
|
+
switch (type) {
|
|
899
|
+
case "form":
|
|
900
|
+
if (!children)
|
|
901
|
+
children = [];
|
|
902
|
+
return <div key={key}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</div>;
|
|
903
|
+
case "div":
|
|
904
|
+
if (!children)
|
|
905
|
+
children = [];
|
|
906
|
+
return <div key={key} {...attrs}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</div>
|
|
907
|
+
case "span":
|
|
908
|
+
return <span key={key} {...attrs}>{body}</span>
|
|
909
|
+
case "p":
|
|
910
|
+
return <p key={key} {...attrs}>{body}</p>
|
|
911
|
+
case "h1":
|
|
912
|
+
return <h1 key={key} {...attrs}>{body}</h1>
|
|
913
|
+
case "h2":
|
|
914
|
+
return <h2 key={key} {...attrs}>{body}</h2>
|
|
915
|
+
case "ul":
|
|
916
|
+
if (!children)
|
|
917
|
+
children = [];
|
|
918
|
+
return <ul key={key} {...attrs}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</ul>
|
|
919
|
+
case "li":
|
|
920
|
+
return <li key={key} {...attrs}>{body}</li>
|
|
921
|
+
case "sheet":
|
|
922
|
+
return <SolidSheet key={key}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</SolidSheet>;
|
|
923
|
+
case "group":
|
|
924
|
+
if (visible === true) {
|
|
925
|
+
return <SolidGroup key={key} attrs={attrs}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</SolidGroup>;
|
|
926
|
+
}
|
|
927
|
+
case "row":
|
|
928
|
+
if (visible === true) {
|
|
929
|
+
return <SolidRow key={key} attrs={attrs}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</SolidRow>;
|
|
930
|
+
}
|
|
931
|
+
case "column":
|
|
932
|
+
if (visible === true) {
|
|
933
|
+
return <SolidColumn key={key} attrs={attrs}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</SolidColumn>;
|
|
934
|
+
}
|
|
935
|
+
case "field": {
|
|
936
|
+
if (visible === true) {
|
|
937
|
+
|
|
938
|
+
// const fieldMetadata = solidFieldsMetadata[attrs.name];
|
|
939
|
+
const fieldMetadata = solidFormViewMetaData.data.solidFieldsMetadata[attrs.name];
|
|
940
|
+
// Read only permission if there is no update permission on model and router doesnt contains new
|
|
941
|
+
const readOnlyPermission = !actionsAllowed.includes(`${updatePermission(params.modelName)}`) && params.id !== "new";
|
|
942
|
+
return <SolidField
|
|
943
|
+
key={key}
|
|
944
|
+
field={element}
|
|
945
|
+
formik={formik}
|
|
946
|
+
fieldMetadata={fieldMetadata}
|
|
947
|
+
initialEntityData={solidFormViewData ? solidFormViewData.data : null}
|
|
948
|
+
solidFormViewMetaData={solidFormViewMetaData}
|
|
949
|
+
modelName={params.modelName}
|
|
950
|
+
readOnly={readOnlyPermission}
|
|
951
|
+
viewMode={viewMode}
|
|
952
|
+
onChange={formFieldOnXXX}
|
|
953
|
+
onBlur={formFieldOnXXX}
|
|
954
|
+
setLightboxUrls={setLightboxUrls}
|
|
955
|
+
setOpenLightbox={setOpenLightbox}
|
|
956
|
+
/>;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
case "notebook":
|
|
960
|
+
if (visible === true) {
|
|
961
|
+
return <SolidNotebook key={key}>{children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData))}</SolidNotebook>;
|
|
962
|
+
}
|
|
963
|
+
case "page":
|
|
964
|
+
// console.log(`Resolved visibility of form element ${key} to ${visible}`);
|
|
965
|
+
if (visible === true) {
|
|
966
|
+
const pageChildren = children.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData));
|
|
967
|
+
return SolidPage({ children: pageChildren, attrs: attrs, key: key });
|
|
968
|
+
}
|
|
969
|
+
case "custom":
|
|
970
|
+
if (visible === true) {
|
|
971
|
+
const widgetName = attrs?.widget;
|
|
972
|
+
const fieldMetadata = solidFormViewMetaData.data.solidFieldsMetadata[attrs.name];
|
|
973
|
+
|
|
974
|
+
if (widgetName) {
|
|
975
|
+
// widgetName, formik, field, fieldMetadata, solidFormViewMetaData
|
|
976
|
+
return <SolidDynamicWidget
|
|
977
|
+
key={key}
|
|
978
|
+
widgetName={widgetName}
|
|
979
|
+
field={element}
|
|
980
|
+
formik={formik}
|
|
981
|
+
fieldMetadata={fieldMetadata}
|
|
982
|
+
solidFormViewMetaData={solidFormViewMetaData}
|
|
983
|
+
/>
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
default:
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
const renderFormDynamically = (solidFormViewMetaData: any) => {
|
|
993
|
+
// console.log(`renderFormDynamically invoked....`);
|
|
994
|
+
if (!solidFormViewMetaData) {
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
if (!solidFormViewMetaData.data) {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
const solidView = solidFormViewMetaData.data.solidView;
|
|
1001
|
+
const solidFieldsMetadata = solidFormViewMetaData.data.solidFieldsMetadata;
|
|
1002
|
+
if (!solidView || !solidFieldsMetadata) {
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
if (!solidView || !solidFieldsMetadata) {
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
const updatedLayout = [formViewLayout];
|
|
1010
|
+
|
|
1011
|
+
const dynamicForm = updatedLayout.map((element: any) => renderFormElementDynamically(element, solidFormViewMetaData));
|
|
1012
|
+
|
|
1013
|
+
return dynamicForm;
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
const handleDeleteEntity = async () => {
|
|
1017
|
+
deleteEntity(solidFormViewData.data.id);
|
|
1018
|
+
setDeleteDialogVisible(false);
|
|
1019
|
+
if (params.embeded == true) {
|
|
1020
|
+
setRedirectToList(false)
|
|
1021
|
+
|
|
1022
|
+
} else {
|
|
1023
|
+
setRedirectToList(true)
|
|
1024
|
+
|
|
1025
|
+
}
|
|
1026
|
+
// router.back();
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
const onDeleteClose = () => {
|
|
1030
|
+
setDeleteDialogVisible(false);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
const formActionDropdown = () => {
|
|
1034
|
+
return (
|
|
1035
|
+
<div>
|
|
1036
|
+
<Button
|
|
1037
|
+
outlined
|
|
1038
|
+
severity="secondary"
|
|
1039
|
+
type="button"
|
|
1040
|
+
icon={'pi pi-cog'}
|
|
1041
|
+
size="small"
|
|
1042
|
+
className="surface-card p-0"
|
|
1043
|
+
style={{
|
|
1044
|
+
height: 33.06,
|
|
1045
|
+
width: 33.06
|
|
1046
|
+
}}
|
|
1047
|
+
onClick={(e) =>
|
|
1048
|
+
// @ts-ignore
|
|
1049
|
+
op.current.toggle(e)
|
|
1050
|
+
}
|
|
1051
|
+
/>
|
|
1052
|
+
<OverlayPanel ref={op} className="solid-custom-overlay">
|
|
1053
|
+
<div className="flex flex-column gap-1 p-1">
|
|
1054
|
+
{/* <Button
|
|
1055
|
+
text
|
|
1056
|
+
type="button"
|
|
1057
|
+
className="w-8rem text-left gap-2 text-color"
|
|
1058
|
+
label="Duplicate"
|
|
1059
|
+
size="small"
|
|
1060
|
+
iconPos="left"
|
|
1061
|
+
icon={<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
1062
|
+
<path d="M6 11.9997C5.63333 11.9997 5.31944 11.8691 5.05833 11.608C4.79722 11.3469 4.66667 11.033 4.66667 10.6663V2.66634C4.66667 2.29967 4.79722 1.98579 5.05833 1.72467C5.31944 1.46356 5.63333 1.33301 6 1.33301H12C12.3667 1.33301 12.6806 1.46356 12.9417 1.72467C13.2028 1.98579 13.3333 2.29967 13.3333 2.66634V10.6663C13.3333 11.033 13.2028 11.3469 12.9417 11.608C12.6806 11.8691 12.3667 11.9997 12 11.9997H6ZM6 10.6663H12V2.66634H6V10.6663ZM3.33333 14.6663C2.96667 14.6663 2.65278 14.5358 2.39167 14.2747C2.13056 14.0136 2 13.6997 2 13.333V3.99967H3.33333V13.333H10.6667V14.6663H3.33333Z" fill="black" fill-opacity="0.88" />
|
|
1063
|
+
</svg>}
|
|
1064
|
+
/> */}
|
|
1065
|
+
{params.embeded !== true &&
|
|
1066
|
+
params.id !== "new" &&
|
|
1067
|
+
actionsAllowed.includes(`${deletePermission(params.modelName)}`) &&
|
|
1068
|
+
!formViewLayout.attrs.readonly &&
|
|
1069
|
+
<Button
|
|
1070
|
+
text
|
|
1071
|
+
type="button"
|
|
1072
|
+
className="w-8rem text-left gap-2"
|
|
1073
|
+
label="Delete"
|
|
1074
|
+
size="small"
|
|
1075
|
+
iconPos="left"
|
|
1076
|
+
severity="danger"
|
|
1077
|
+
icon={'pi pi-trash'}
|
|
1078
|
+
onClick={() => setDeleteDialogVisible(true)}
|
|
1079
|
+
/>
|
|
1080
|
+
}
|
|
1081
|
+
<Button
|
|
1082
|
+
text
|
|
1083
|
+
type="button"
|
|
1084
|
+
className="w-8rem text-left gap-2 purple-200"
|
|
1085
|
+
label="Layout"
|
|
1086
|
+
size="small"
|
|
1087
|
+
iconPos="left"
|
|
1088
|
+
severity="contrast"
|
|
1089
|
+
icon={'pi pi-objects-column'}
|
|
1090
|
+
onClick={() => setLayoutDialogVisible(true)}
|
|
1091
|
+
/>
|
|
1092
|
+
</div>
|
|
1093
|
+
</OverlayPanel>
|
|
1094
|
+
</div>
|
|
1095
|
+
)
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// TODO: This was simply to demonstrate how we can use dynamic components, we will remove this and use it in a more sensible way in the layout.
|
|
1099
|
+
// TODO: to demonstrated this you can simply add the below to the layout of the book form view.
|
|
1100
|
+
// TODO: "header": "BookFormViewDynamicComponent",
|
|
1101
|
+
const dynamicHeader = solidView.layout?.header;
|
|
1102
|
+
let DynamicHeaderComponent = null;
|
|
1103
|
+
if (dynamicHeader) {
|
|
1104
|
+
DynamicHeaderComponent = getExtensionComponent(dynamicHeader);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
return (
|
|
1108
|
+
<div className="solid-form-wrapper">
|
|
1109
|
+
<Toast ref={toast} />
|
|
1110
|
+
<div className="solid-form-section" style={{ borderRight: params.embeded !== true ? '1px solid var(--primary-light-color' : '' }} >
|
|
1111
|
+
<form style={{ width: '100%' }} onSubmit={formik.handleSubmit}>
|
|
1112
|
+
<div className="solid-form-header">
|
|
1113
|
+
{params.id === "new" ? (
|
|
1114
|
+
<>
|
|
1115
|
+
<div className="flex align-items-center gap-3">
|
|
1116
|
+
{params.embeded !== true && <BackButton />}
|
|
1117
|
+
<div className="form-wrapper-title"> {createHeaderTitle}</div>
|
|
1118
|
+
</div>
|
|
1119
|
+
<div className="gap-3 flex">
|
|
1120
|
+
{params.embeded !== true &&
|
|
1121
|
+
actionsAllowed.includes(`${createPermission(params.modelName)}`) &&
|
|
1122
|
+
!formViewLayout.attrs.readonly &&
|
|
1123
|
+
formik.dirty &&
|
|
1124
|
+
<div>
|
|
1125
|
+
<Button
|
|
1126
|
+
label="Save"
|
|
1127
|
+
size="small"
|
|
1128
|
+
onClick={() => showError()}
|
|
1129
|
+
type="submit"
|
|
1130
|
+
/>
|
|
1131
|
+
</div>
|
|
1132
|
+
}
|
|
1133
|
+
{/* {params.embeded !== true &&
|
|
1134
|
+
actionsAllowed.includes(`${createPermission(params.modelName)}`) &&
|
|
1135
|
+
!formViewLayout.attrs.readonly &&
|
|
1136
|
+
<div>
|
|
1137
|
+
<Button
|
|
1138
|
+
label="Save & Close"
|
|
1139
|
+
size="small"
|
|
1140
|
+
onClick={() => {
|
|
1141
|
+
setRedirectToList(true);
|
|
1142
|
+
showError()
|
|
1143
|
+
}}
|
|
1144
|
+
type="submit"
|
|
1145
|
+
/>
|
|
1146
|
+
</div>
|
|
1147
|
+
} */}
|
|
1148
|
+
|
|
1149
|
+
{/* Inline */}
|
|
1150
|
+
{params.embeded == true &&
|
|
1151
|
+
actionsAllowed.includes(`${createPermission(params.modelName)}`) &&
|
|
1152
|
+
!formViewLayout.attrs.readonly &&
|
|
1153
|
+
formik.dirty &&
|
|
1154
|
+
<div>
|
|
1155
|
+
<Button
|
|
1156
|
+
label="Save"
|
|
1157
|
+
size="small"
|
|
1158
|
+
onClick={() => {
|
|
1159
|
+
setRedirectToList(false);
|
|
1160
|
+
showError()
|
|
1161
|
+
}}
|
|
1162
|
+
type="submit"
|
|
1163
|
+
/>
|
|
1164
|
+
</div>
|
|
1165
|
+
}
|
|
1166
|
+
{params.embeded == true &&
|
|
1167
|
+
<Button outlined size="small" type="button" label="Close" onClick={() => params.handlePopupClose()} className='bg-primary-reverse' />
|
|
1168
|
+
|
|
1169
|
+
}
|
|
1170
|
+
{params.embeded !== true &&
|
|
1171
|
+
<SolidCancelButton />
|
|
1172
|
+
}
|
|
1173
|
+
{formActionDropdown()}
|
|
1174
|
+
</div>
|
|
1175
|
+
</>
|
|
1176
|
+
) : (
|
|
1177
|
+
<>
|
|
1178
|
+
<div className="flex align-items-center gap-3">
|
|
1179
|
+
{params.embeded !== true && <BackButton />}
|
|
1180
|
+
<div className="form-wrapper-title"> {editHeaderTitle}</div>
|
|
1181
|
+
</div>
|
|
1182
|
+
<div className="gap-3 flex">
|
|
1183
|
+
{params.embeded !== true && viewMode === "view" &&
|
|
1184
|
+
<div>
|
|
1185
|
+
<Button
|
|
1186
|
+
label="Edit"
|
|
1187
|
+
size="small"
|
|
1188
|
+
onClick={() => updateViewMode("edit")}
|
|
1189
|
+
type="button"
|
|
1190
|
+
/>
|
|
1191
|
+
</div>
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
{params.embeded !== true &&
|
|
1195
|
+
actionsAllowed.includes(`${updatePermission(params.modelName)}`) &&
|
|
1196
|
+
!formViewLayout.attrs.readonly &&
|
|
1197
|
+
formik.dirty &&
|
|
1198
|
+
<div>
|
|
1199
|
+
<Button
|
|
1200
|
+
label="Save"
|
|
1201
|
+
size="small"
|
|
1202
|
+
onClick={() => showError()}
|
|
1203
|
+
type="submit"
|
|
1204
|
+
/>
|
|
1205
|
+
</div>
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
{/* Inline */}
|
|
1209
|
+
{params.embeded == true &&
|
|
1210
|
+
actionsAllowed.includes(`${updatePermission(params.modelName)}`) &&
|
|
1211
|
+
!formViewLayout.attrs.readonly &&
|
|
1212
|
+
formik.dirty &&
|
|
1213
|
+
<div>
|
|
1214
|
+
<Button
|
|
1215
|
+
label="Save"
|
|
1216
|
+
size="small"
|
|
1217
|
+
onClick={() => showError()}
|
|
1218
|
+
type="submit"
|
|
1219
|
+
/>
|
|
1220
|
+
</div>
|
|
1221
|
+
}
|
|
1222
|
+
{/* {params.embeded !== true &&
|
|
1223
|
+
actionsAllowed.includes(`${updatePermission(params.modelName)}`) &&
|
|
1224
|
+
!formViewLayout.attrs.readonly &&
|
|
1225
|
+
<div>
|
|
1226
|
+
<Button
|
|
1227
|
+
label="Save & Close"
|
|
1228
|
+
size="small"
|
|
1229
|
+
onClick={() => {
|
|
1230
|
+
setRedirectToList(true);
|
|
1231
|
+
showError()
|
|
1232
|
+
}}
|
|
1233
|
+
type="submit"
|
|
1234
|
+
/>
|
|
1235
|
+
</div>
|
|
1236
|
+
} */}
|
|
1237
|
+
{params.embeded == true &&
|
|
1238
|
+
actionsAllowed.includes(`${deletePermission(params.modelName)}`) &&
|
|
1239
|
+
!formViewLayout.attrs.readonly &&
|
|
1240
|
+
<div>
|
|
1241
|
+
<Button
|
|
1242
|
+
size="small"
|
|
1243
|
+
type="button"
|
|
1244
|
+
label="Delete"
|
|
1245
|
+
severity="danger"
|
|
1246
|
+
onClick={() => setDeleteDialogVisible(true)}
|
|
1247
|
+
/>
|
|
1248
|
+
</div>
|
|
1249
|
+
}
|
|
1250
|
+
{params.embeded == true &&
|
|
1251
|
+
<Button outlined size="small" type="button" label="Close" onClick={() => params.handlePopupClose()} className='bg-primary-reverse' />
|
|
1252
|
+
|
|
1253
|
+
}
|
|
1254
|
+
{params.embeded !== true &&
|
|
1255
|
+
<SolidCancelButton />
|
|
1256
|
+
}
|
|
1257
|
+
{formActionDropdown()}
|
|
1258
|
+
</div>
|
|
1259
|
+
</>
|
|
1260
|
+
)}
|
|
1261
|
+
</div>
|
|
1262
|
+
{/* {params.embeded !== true &&
|
|
1263
|
+
<SolidBreadcrumb
|
|
1264
|
+
solidViewData={solidFormViewMetaData?.data?.solidView?.model}
|
|
1265
|
+
initialEntityData={initialEntityData}
|
|
1266
|
+
/>
|
|
1267
|
+
} */}
|
|
1268
|
+
{params.embeded !== true &&
|
|
1269
|
+
// <div className="solid-form-stepper">
|
|
1270
|
+
<SolidFormHeader
|
|
1271
|
+
// solidFormViewMetaData={solidFormViewMetaData?.data?.solidView?.model}
|
|
1272
|
+
solidFormViewMetaData={solidFormViewMetaData}
|
|
1273
|
+
initialEntityData={initialEntityData}
|
|
1274
|
+
modelName={params.modelName}
|
|
1275
|
+
id={params.id}
|
|
1276
|
+
/>
|
|
1277
|
+
// </div>
|
|
1278
|
+
}
|
|
1279
|
+
<div className="p-4 solid-form-content">
|
|
1280
|
+
{DynamicHeaderComponent && <DynamicHeaderComponent />}
|
|
1281
|
+
{renderFormDynamically(formViewMetaData)}
|
|
1282
|
+
</div>
|
|
1283
|
+
</form>
|
|
1284
|
+
{params.embeded !== true && isShowChatter === true &&
|
|
1285
|
+
<Button
|
|
1286
|
+
icon="pi pi-chevron-right"
|
|
1287
|
+
size="small"
|
|
1288
|
+
text
|
|
1289
|
+
className="chatter-collapse-btn"
|
|
1290
|
+
style={{ width: 30 }}
|
|
1291
|
+
onClick={() => setShowChatter(false)}
|
|
1292
|
+
/>
|
|
1293
|
+
}
|
|
1294
|
+
</div>
|
|
1295
|
+
{params.embeded !== true &&
|
|
1296
|
+
<div className={`chatter-section ${isShowChatter === false ? 'collapsed' : ''}`}>
|
|
1297
|
+
{isShowChatter === false ?
|
|
1298
|
+
<div className="flex flex-column gap-2 justify-content-center p-2">
|
|
1299
|
+
<div className="chatter-collapsed-content">
|
|
1300
|
+
Chatter/Audit Trail
|
|
1301
|
+
</div>
|
|
1302
|
+
<Button
|
|
1303
|
+
icon="pi pi-chevron-left"
|
|
1304
|
+
size="small"
|
|
1305
|
+
className="px-0"
|
|
1306
|
+
style={{ width: 30 }}
|
|
1307
|
+
onClick={() => {setShowChatter(true); setRefreshChatterMessage(true);}}
|
|
1308
|
+
/>
|
|
1309
|
+
</div>
|
|
1310
|
+
: <SolidChatter solidFormViewMetaData={solidFormViewMetaData} id={params.id} refreshChatterMessage={refreshChatterMessage} setRefreshChatterMessage={setRefreshChatterMessage} />
|
|
1311
|
+
}
|
|
1312
|
+
</div>
|
|
1313
|
+
}
|
|
1314
|
+
<Dialog
|
|
1315
|
+
visible={isDeleteDialogVisible}
|
|
1316
|
+
header="Confirm Delete"
|
|
1317
|
+
modal
|
|
1318
|
+
footer={() => (
|
|
1319
|
+
<div className="flex justify-content-center">
|
|
1320
|
+
<Button label="Yes" icon="pi pi-check" className='small-button' severity="danger" autoFocus onClick={() => handleDeleteEntity()} />
|
|
1321
|
+
<Button label="No" icon="pi pi-times" className='small-button' onClick={onDeleteClose} />
|
|
1322
|
+
</div>
|
|
1323
|
+
)}
|
|
1324
|
+
onHide={() => setDeleteDialogVisible(false)}
|
|
1325
|
+
>
|
|
1326
|
+
<p>Are you sure you want to delete?</p>
|
|
1327
|
+
</Dialog>
|
|
1328
|
+
<Dialog
|
|
1329
|
+
visible={isLayoutDialogVisible}
|
|
1330
|
+
header="Change Form Layout"
|
|
1331
|
+
modal
|
|
1332
|
+
onHide={() => setLayoutDialogVisible(false)}
|
|
1333
|
+
contentStyle={{
|
|
1334
|
+
width: 800
|
|
1335
|
+
}}
|
|
1336
|
+
>
|
|
1337
|
+
<SolidFormUserViewLayout solidFormViewMetaData={solidFormViewMetaData} setLayoutDialogVisible={setLayoutDialogVisible} />
|
|
1338
|
+
</Dialog>
|
|
1339
|
+
{openLightbox &&
|
|
1340
|
+
<Lightbox
|
|
1341
|
+
open={openLightbox}
|
|
1342
|
+
plugins={[Counter, Download]}
|
|
1343
|
+
close={() => setOpenLightbox(false)}
|
|
1344
|
+
slides={lightboxUrls}
|
|
1345
|
+
/>
|
|
1346
|
+
}
|
|
1347
|
+
</div>
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
export default SolidFormView;
|