@solidxai/core-ui 0.1.8-beta.9 → 0.1.9-alpha.0
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/README.md +2 -2
- package/dist/adapters/auth/getSession.d.ts.map +1 -1
- package/dist/adapters/auth/getSession.js +1 -1
- package/dist/adapters/auth/getSession.js.map +1 -1
- package/dist/adapters/auth/getSession.ts +1 -0
- package/dist/adapters/auth/helper.d.ts.map +1 -1
- package/dist/adapters/auth/helper.js +1 -0
- package/dist/adapters/auth/helper.js.map +1 -1
- package/dist/adapters/auth/helper.ts +3 -1
- package/dist/adapters/auth/signIn.d.ts.map +1 -1
- package/dist/adapters/auth/signIn.js +1 -0
- package/dist/adapters/auth/signIn.js.map +1 -1
- package/dist/adapters/auth/signIn.ts +3 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.d.ts +1 -0
- package/dist/adapters/auth/signInWithOAuthAccessCode.d.ts.map +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.js +10 -9
- package/dist/adapters/auth/signInWithOAuthAccessCode.js.map +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.ts +6 -3
- package/dist/adapters/auth/signOut.d.ts.map +1 -1
- package/dist/adapters/auth/signOut.js +7 -1
- package/dist/adapters/auth/signOut.js.map +1 -1
- package/dist/adapters/auth/signOut.ts +7 -1
- package/dist/adapters/auth/types.d.ts +1 -0
- package/dist/adapters/auth/types.d.ts.map +1 -1
- package/dist/adapters/auth/types.js.map +1 -1
- package/dist/adapters/auth/types.ts +1 -0
- package/dist/components/auth/AuthLayout.d.ts +1 -1
- package/dist/components/auth/AuthLayout.d.ts.map +1 -1
- package/dist/components/auth/AuthLayout.js +92 -22
- package/dist/components/auth/AuthLayout.js.map +1 -1
- package/dist/components/auth/AuthLayout.tsx +38 -12
- package/dist/components/auth/AuthSettingsContext.d.ts +10 -0
- package/dist/components/auth/AuthSettingsContext.d.ts.map +1 -0
- package/dist/components/auth/AuthSettingsContext.js +49 -0
- package/dist/components/auth/AuthSettingsContext.js.map +1 -0
- package/dist/components/auth/AuthSettingsContext.tsx +19 -0
- package/dist/components/auth/FacebookAuthChecking.d.ts +2 -0
- package/dist/components/auth/FacebookAuthChecking.d.ts.map +1 -0
- package/dist/components/auth/FacebookAuthChecking.js +98 -0
- package/dist/components/auth/FacebookAuthChecking.js.map +1 -0
- package/dist/components/auth/FacebookAuthChecking.tsx +59 -0
- package/dist/components/auth/ForgotPasswordThankYou.d.ts.map +1 -1
- package/dist/components/auth/ForgotPasswordThankYou.js +3 -7
- package/dist/components/auth/ForgotPasswordThankYou.js.map +1 -1
- package/dist/components/auth/ForgotPasswordThankYou.tsx +4 -9
- package/dist/components/auth/GoogleAuthChecking.d.ts.map +1 -1
- package/dist/components/auth/GoogleAuthChecking.js +10 -16
- package/dist/components/auth/GoogleAuthChecking.js.map +1 -1
- package/dist/components/auth/GoogleAuthChecking.tsx +2 -7
- package/dist/components/auth/MicrosoftAuthChecking.d.ts +2 -0
- package/dist/components/auth/MicrosoftAuthChecking.d.ts.map +1 -0
- package/dist/components/auth/MicrosoftAuthChecking.js +98 -0
- package/dist/components/auth/MicrosoftAuthChecking.js.map +1 -0
- package/dist/components/auth/MicrosoftAuthChecking.tsx +59 -0
- package/dist/components/auth/SolidForgotPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidForgotPassword.js +3 -7
- package/dist/components/auth/SolidForgotPassword.js.map +1 -1
- package/dist/components/auth/SolidForgotPassword.tsx +4 -9
- package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.js +21 -30
- package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.tsx +5 -13
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.js +35 -22
- package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.tsx +28 -16
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +25 -31
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidLogin.tsx +19 -16
- package/dist/components/auth/SolidRegister.d.ts.map +1 -1
- package/dist/components/auth/SolidRegister.js +59 -31
- package/dist/components/auth/SolidRegister.js.map +1 -1
- package/dist/components/auth/SolidRegister.tsx +91 -38
- package/dist/components/auth/SolidResetPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidResetPassword.js +2 -6
- package/dist/components/auth/SolidResetPassword.js.map +1 -1
- package/dist/components/auth/SolidResetPassword.tsx +2 -6
- package/dist/components/common/AuthBanner.js.map +1 -1
- package/dist/components/common/GeneralSettings.d.ts.map +1 -1
- package/dist/components/common/GeneralSettings.js +235 -151
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +1109 -776
- package/dist/components/common/SettingsComponent.d.ts +2 -0
- package/dist/components/common/SettingsComponent.d.ts.map +1 -0
- package/dist/components/common/SettingsComponent.js +351 -0
- package/dist/components/common/SettingsComponent.js.map +1 -0
- package/dist/components/common/SettingsComponent.module.css +421 -0
- package/dist/components/common/SettingsComponent.tsx +582 -0
- package/dist/components/common/SocialMediaLogin.d.ts +8 -1
- package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
- package/dist/components/common/SocialMediaLogin.js +6 -13
- package/dist/components/common/SocialMediaLogin.js.map +1 -1
- package/dist/components/common/SocialMediaLogin.tsx +120 -58
- package/dist/components/common/SolidExport.d.ts.map +1 -1
- package/dist/components/common/SolidExport.js +1 -1
- package/dist/components/common/SolidExport.js.map +1 -1
- package/dist/components/common/SolidExport.tsx +2 -1
- package/dist/components/common/SolidFormStepper.d.ts.map +1 -1
- package/dist/components/common/SolidFormStepper.js +2 -1
- package/dist/components/common/SolidFormStepper.js.map +1 -1
- package/dist/components/common/SolidFormStepper.tsx +2 -1
- package/dist/components/common/solid-export.css +26 -0
- package/dist/components/core/card/SolidCardView.d.ts.map +1 -1
- package/dist/components/core/card/SolidCardView.js +24 -25
- package/dist/components/core/card/SolidCardView.js.map +1 -1
- package/dist/components/core/card/SolidCardView.tsx +22 -27
- package/dist/components/core/card/SolidCardViewConfigure.js +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.js.map +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.tsx +1 -1
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatter.js +39 -9
- package/dist/components/core/chatter/SolidChatter.js.map +1 -1
- package/dist/components/core/chatter/SolidChatter.tsx +42 -7
- package/dist/components/core/chatter/SolidChatterAuditMessage.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.js +19 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.tsx +22 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts +3 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.js +68 -4
- package/dist/components/core/chatter/SolidChatterMessageBox.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.tsx +45 -3
- package/dist/components/core/chatter/chatter.module.css +0 -3
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.js +3 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.module.css +149 -0
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.tsx +3 -1
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.js +9 -8
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.tsx +4 -2
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.js +21 -4
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.tsx +128 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +1 -1
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.d.ts +7 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.js +75 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.ts +45 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.js +81 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.js.map +1 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.tsx +114 -0
- package/dist/components/core/form/SolidFormActionHeader.d.ts +1 -1
- package/dist/components/core/form/SolidFormActionHeader.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.js +10 -5
- package/dist/components/core/form/SolidFormActionHeader.js.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.tsx +33 -4
- package/dist/components/core/form/SolidFormLayouts.js +1 -1
- package/dist/components/core/form/SolidFormLayouts.js.map +1 -1
- package/dist/components/core/form/SolidFormLayouts.tsx +1 -1
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +122 -28
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +111 -10
- package/dist/components/core/form/fields/SolidComputedField.d.ts +25 -0
- package/dist/components/core/form/fields/SolidComputedField.d.ts.map +1 -0
- package/dist/components/core/form/fields/SolidComputedField.js +128 -0
- package/dist/components/core/form/fields/SolidComputedField.js.map +1 -0
- package/dist/components/core/form/fields/SolidComputedField.tsx +134 -0
- package/dist/components/core/form/fields/SolidDateTimeField.js +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.tsx +1 -1
- package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.js +4 -1
- package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.tsx +4 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js +35 -24
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.tsx +30 -14
- package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.js +29 -28
- package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.tsx +17 -12
- package/dist/components/core/form/fields/SolidTimeField.js +1 -1
- package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.tsx +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +2 -2
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js +3 -3
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +0 -5
- package/dist/components/core/kanban/KanbanBoard.js +1 -1
- package/dist/components/core/kanban/KanbanBoard.js.map +1 -1
- package/dist/components/core/kanban/KanbanBoard.tsx +1 -1
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +216 -102
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +204 -72
- package/dist/components/core/kanban/SolidKanbanViewConfigure.js +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.tsx +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.js.map +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +1 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js +2 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +21 -10
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +2 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +18 -10
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +3 -6
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +30 -24
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +2 -2
- package/dist/components/core/list/SolidDataTable.d.ts.map +1 -1
- package/dist/components/core/list/SolidDataTable.js +6 -5
- package/dist/components/core/list/SolidDataTable.js.map +1 -1
- package/dist/components/core/list/SolidDataTable.tsx +6 -5
- package/dist/components/core/list/SolidDataTablePagination.d.ts +15 -0
- package/dist/components/core/list/SolidDataTablePagination.d.ts.map +1 -0
- package/dist/components/core/list/SolidDataTablePagination.js +22 -0
- package/dist/components/core/list/SolidDataTablePagination.js.map +1 -0
- package/dist/components/core/list/SolidDataTablePagination.tsx +71 -0
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.d.ts.map +1 -1
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.js +3 -3
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.js.map +1 -1
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.tsx +1 -0
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +60 -63
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +43 -48
- package/dist/components/core/list/SolidListViewConfigure.d.ts.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.js +32 -3
- package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.tsx +35 -3
- package/dist/components/core/list/SolidListViewRowActionsMenu.js +2 -2
- package/dist/components/core/list/SolidListViewRowActionsMenu.js.map +1 -1
- package/dist/components/core/list/SolidListViewRowActionsMenu.tsx +2 -2
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts.map +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js +6 -7
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js.map +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +9 -10
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +1 -1
- package/dist/components/core/tree/SolidTreeTable.d.ts +1 -1
- package/dist/components/core/tree/SolidTreeTable.d.ts.map +1 -1
- package/dist/components/core/tree/SolidTreeTable.js +78 -78
- package/dist/components/core/tree/SolidTreeTable.js.map +1 -1
- package/dist/components/core/tree/SolidTreeTable.tsx +1 -10
- package/dist/components/core/users/CreateUser.css +27 -2
- package/dist/components/core/users/CreateUser.d.ts.map +1 -1
- package/dist/components/core/users/CreateUser.js +14 -12
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/components/core/users/CreateUser.tsx +18 -2
- package/dist/components/layout/user-profile-menu.d.ts.map +1 -1
- package/dist/components/layout/user-profile-menu.js +17 -15
- package/dist/components/layout/user-profile-menu.js.map +1 -1
- package/dist/components/layout/user-profile-menu.tsx +30 -33
- package/dist/components/shad-cn-ui/SolidAutocomplete.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.js +9 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.tsx +10 -1
- package/dist/components/shad-cn-ui/SolidButton.d.ts +14 -15
- package/dist/components/shad-cn-ui/SolidButton.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidButton.js +13 -3
- package/dist/components/shad-cn-ui/SolidButton.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidButton.tsx +24 -4
- package/dist/components/shad-cn-ui/SolidDatePicker.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.js +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.tsx +2 -0
- package/dist/components/shad-cn-ui/SolidDialog.d.ts +1 -1
- package/dist/components/shad-cn-ui/SolidDialog.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidDialog.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidDialog.tsx +1 -1
- package/dist/components/shad-cn-ui/SolidIcon.d.ts +2 -2
- package/dist/components/shad-cn-ui/SolidIcon.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidIcon.js +3 -4
- package/dist/components/shad-cn-ui/SolidIcon.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidIcon.tsx +12 -15
- package/dist/components/shad-cn-ui/SolidRichTextEditor.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidRichTextEditor.js +9 -1
- package/dist/components/shad-cn-ui/SolidRichTextEditor.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidRichTextEditor.tsx +8 -1
- package/dist/components/shad-cn-ui/SolidTabs.d.ts +2 -1
- package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.js +2 -2
- package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.tsx +12 -1
- package/dist/components/solid-ui/SolidButton.d.ts +14 -0
- package/dist/components/solid-ui/SolidButton.d.ts.map +1 -0
- package/dist/components/solid-ui/SolidButton.js +36 -0
- package/dist/components/solid-ui/SolidButton.js.map +1 -0
- package/dist/components/solid-ui/SolidButton.tsx +54 -0
- package/dist/components/solid-ui/SolidTabs.d.ts +18 -0
- package/dist/components/solid-ui/SolidTabs.d.ts.map +1 -0
- package/dist/components/solid-ui/SolidTabs.js +22 -0
- package/dist/components/solid-ui/SolidTabs.js.map +1 -0
- package/dist/components/solid-ui/SolidTabs.tsx +73 -0
- package/dist/components/solid-ui/index.d.ts +3 -0
- package/dist/components/solid-ui/index.d.ts.map +1 -0
- package/dist/components/solid-ui/index.js +3 -0
- package/dist/components/solid-ui/index.js.map +1 -0
- package/dist/components/solid-ui/index.ts +2 -0
- package/dist/helpers/hydrateRelationRules.js +1 -1
- package/dist/helpers/hydrateRelationRules.js.map +1 -1
- package/dist/helpers/hydrateRelationRules.ts +1 -1
- package/dist/helpers/permissions.js +2 -2
- package/dist/helpers/permissions.js.map +1 -1
- package/dist/helpers/permissions.ts +2 -2
- package/dist/helpers/registry.d.ts +2 -2
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +6 -0
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +9 -2
- package/dist/helpers/settingsPayload.d.ts +32 -0
- package/dist/helpers/settingsPayload.d.ts.map +1 -0
- package/dist/helpers/settingsPayload.js +72 -0
- package/dist/helpers/settingsPayload.js.map +1 -0
- package/dist/helpers/settingsPayload.ts +125 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +7 -0
- package/dist/redux/api/solidChatterMessageApi.d.ts +2 -1
- package/dist/redux/api/solidChatterMessageApi.d.ts.map +1 -1
- package/dist/redux/api/solidChatterMessageApi.js +11 -1
- package/dist/redux/api/solidChatterMessageApi.js.map +1 -1
- package/dist/redux/api/solidChatterMessageApi.ts +10 -1
- package/dist/redux/api/solidEntityApi.d.ts.map +1 -1
- package/dist/redux/api/solidEntityApi.js +14 -1
- package/dist/redux/api/solidEntityApi.js.map +1 -1
- package/dist/redux/api/solidEntityApi.tsx +17 -1
- package/dist/redux/store/createSolidStore.d.ts +1 -1
- package/dist/redux/store/createSolidStore.d.ts.map +1 -1
- package/dist/redux/store/createSolidStore.js +20 -11
- package/dist/redux/store/createSolidStore.js.map +1 -1
- package/dist/redux/store/createSolidStore.ts +20 -11
- package/dist/redux/store/defaultStoreConfig.d.ts +1 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/redux/store/dynamicEntityApiMiddleware.d.ts +10 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.d.ts.map +1 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.js +44 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.js.map +1 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.ts +58 -0
- package/dist/redux/store/dynamicReducerManager.d.ts +10 -0
- package/dist/redux/store/dynamicReducerManager.d.ts.map +1 -0
- package/dist/redux/store/dynamicReducerManager.js +51 -0
- package/dist/redux/store/dynamicReducerManager.js.map +1 -0
- package/dist/redux/store/dynamicReducerManager.ts +51 -0
- package/dist/redux/store/solidEntityApiPool.d.ts +31 -0
- package/dist/redux/store/solidEntityApiPool.d.ts.map +1 -0
- package/dist/redux/store/solidEntityApiPool.js +123 -0
- package/dist/redux/store/solidEntityApiPool.js.map +1 -0
- package/dist/redux/store/solidEntityApiPool.ts +167 -0
- package/dist/resources/globals.css +26 -6
- package/dist/resources/shadcn-base.css +269 -92
- package/dist/resources/solid-responsive.css +22 -4
- package/dist/routes/AppEventListener.js +1 -1
- package/dist/routes/AppEventListener.js.map +1 -1
- package/dist/routes/AppEventListener.tsx +1 -1
- package/dist/routes/SolidRouteMetadataBoundary.d.ts +5 -0
- package/dist/routes/SolidRouteMetadataBoundary.d.ts.map +1 -0
- package/dist/routes/SolidRouteMetadataBoundary.js +72 -0
- package/dist/routes/SolidRouteMetadataBoundary.js.map +1 -0
- package/dist/routes/SolidRouteMetadataBoundary.tsx +77 -0
- package/dist/routes/pages/admin/core/CardPage.js +1 -1
- package/dist/routes/pages/admin/core/CardPage.js.map +1 -1
- package/dist/routes/pages/admin/core/CardPage.tsx +1 -1
- package/dist/routes/pages/admin/core/DiagnosticsPage.d.ts +2 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.js +48 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.js.map +1 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.tsx +167 -0
- package/dist/routes/pages/admin/core/FormPage.js +1 -1
- package/dist/routes/pages/admin/core/FormPage.js.map +1 -1
- package/dist/routes/pages/admin/core/FormPage.tsx +1 -1
- package/dist/routes/pages/admin/core/KanbanPage.js +1 -1
- package/dist/routes/pages/admin/core/KanbanPage.js.map +1 -1
- package/dist/routes/pages/admin/core/KanbanPage.tsx +1 -1
- package/dist/routes/pages/admin/core/ListPage.js +1 -1
- package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.tsx +1 -1
- package/dist/routes/pages/admin/core/SettingsPage.js +2 -2
- package/dist/routes/pages/admin/core/SettingsPage.js.map +1 -1
- package/dist/routes/pages/admin/core/SettingsPage.tsx +2 -2
- package/dist/routes/pages/admin/core/TreePage.js +1 -1
- package/dist/routes/pages/admin/core/TreePage.js.map +1 -1
- package/dist/routes/pages/admin/core/TreePage.tsx +1 -1
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.d.ts +2 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.d.ts.map +1 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.js +6 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.js.map +1 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.tsx +5 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.d.ts +2 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.d.ts.map +1 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.js +6 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.js.map +1 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.tsx +5 -0
- package/dist/routes/pages/studio/StudioLandingPage.d.ts.map +1 -1
- package/dist/routes/pages/studio/StudioLandingPage.js +35 -7
- package/dist/routes/pages/studio/StudioLandingPage.js.map +1 -1
- package/dist/routes/pages/studio/StudioLandingPage.tsx +42 -6
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +49 -24
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +49 -24
- package/dist/routes/types.d.ts +8 -1
- package/dist/routes/types.d.ts.map +1 -1
- package/dist/routes/types.js.map +1 -1
- package/dist/routes/types.ts +10 -0
- package/dist/types/extension-registry.d.ts +1 -0
- package/dist/types/extension-registry.d.ts.map +1 -1
- package/dist/types/extension-registry.js +1 -0
- package/dist/types/extension-registry.js.map +1 -1
- package/dist/types/extension-registry.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/solid-core.d.ts +11 -0
- package/package.json +1 -2
- package/dist/components/auth/SolidOTPVerify.d.ts +0 -3
- package/dist/components/auth/SolidOTPVerify.d.ts.map +0 -1
- package/dist/components/auth/SolidOTPVerify.js +0 -67
- package/dist/components/auth/SolidOTPVerify.js.map +0 -1
- package/dist/components/auth/SolidOTPVerify.tsx +0 -133
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +0 -2
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.js +0 -50
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +0 -70
- package/dist/nextAuth/authProviders.d.ts +0 -4
- package/dist/nextAuth/authProviders.d.ts.map +0 -1
- package/dist/nextAuth/authProviders.js +0 -198
- package/dist/nextAuth/authProviders.js.map +0 -1
- package/dist/nextAuth/authProviders.tsx +0 -232
- package/dist/nextAuth/handleLogout.d.ts +0 -2
- package/dist/nextAuth/handleLogout.d.ts.map +0 -1
- package/dist/nextAuth/handleLogout.js +0 -36
- package/dist/nextAuth/handleLogout.js.map +0 -1
- package/dist/nextAuth/handleLogout.tsx +0 -39
- package/dist/nextAuth/refreshAccessToken.d.ts +0 -2
- package/dist/nextAuth/refreshAccessToken.d.ts.map +0 -1
- package/dist/nextAuth/refreshAccessToken.js +0 -24
- package/dist/nextAuth/refreshAccessToken.js.map +0 -1
- package/dist/nextAuth/refreshAccessToken.tsx +0 -28
- package/dist/redux/features/settingsSlice.d.ts +0 -20
- package/dist/redux/features/settingsSlice.d.ts.map +0 -1
- package/dist/redux/features/settingsSlice.js +0 -39
- package/dist/redux/features/settingsSlice.js.map +0 -1
- package/dist/redux/features/settingsSlice.ts +0 -60
|
@@ -28,6 +28,7 @@ import { SolidSelectionDynamicField } from "./fields/SolidSelectionDynamicField"
|
|
|
28
28
|
import { SolidSelectionStaticField } from "./fields/SolidSelectionStaticField";
|
|
29
29
|
import { SolidShortTextField } from "./fields/SolidShortTextField";
|
|
30
30
|
import { SolidTimeField } from "./fields/SolidTimeField";
|
|
31
|
+
import { SolidComputedField } from "./fields/SolidComputedField";
|
|
31
32
|
import { SolidUiEvent } from "../../../types";
|
|
32
33
|
import { getExtensionComponent, getExtensionFunction } from "../../../helpers/registry";
|
|
33
34
|
import { SolidFormWidgetProps, SolidUiEventResponse } from "../../../types/solid-core";
|
|
@@ -41,6 +42,7 @@ import { hasAnyRole } from "../../../helpers/rolesHelper";
|
|
|
41
42
|
import SolidChatterLocaleTabView from "../locales/SolidChatterLocaleTabView";
|
|
42
43
|
import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
43
44
|
import { useLazyGetMcpUrlQuery, useLazyGetSolidSettingsQuery } from "../../../redux/api/solidSettingsApi";
|
|
45
|
+
import { getSettingsMap } from "../../../helpers/settingsPayload";
|
|
44
46
|
import { SolidFormFooter } from "./SolidFormFooter";
|
|
45
47
|
import { normalizeSolidFormActionPath } from "../../../helpers/routePaths";
|
|
46
48
|
import { showToast } from "../../../redux/features/toastSlice";
|
|
@@ -171,6 +173,9 @@ const fieldFactory = (type: string, fieldContext: SolidFieldProps, setLightboxUr
|
|
|
171
173
|
if (type === 'email') {
|
|
172
174
|
return new SolidEmailField(fieldContext);
|
|
173
175
|
}
|
|
176
|
+
if (type === 'computed') {
|
|
177
|
+
return new SolidComputedField(fieldContext);
|
|
178
|
+
}
|
|
174
179
|
return null;
|
|
175
180
|
}
|
|
176
181
|
|
|
@@ -276,7 +281,7 @@ const SolidSheet = ({ children }: any) => (
|
|
|
276
281
|
// Internal tab data carrier — SolidNotebook reads props from this
|
|
277
282
|
const SolidPageTab = ({ children }: any) => <>{children}</>;
|
|
278
283
|
|
|
279
|
-
const SolidNotebook = ({ children, activeTab, embeded }: any) => {
|
|
284
|
+
const SolidNotebook = ({ children, activeTab, embeded, requestedTab, requestedTabVersion }: any) => {
|
|
280
285
|
const childrenArray = React.Children.toArray(children).filter(child => !!child) as any[];
|
|
281
286
|
|
|
282
287
|
const router = useRouter();
|
|
@@ -286,6 +291,19 @@ const SolidNotebook = ({ children, activeTab, embeded }: any) => {
|
|
|
286
291
|
|
|
287
292
|
const effectiveTab = embeded ? localActiveTab : activeTab;
|
|
288
293
|
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
if (!requestedTab) return;
|
|
296
|
+
const exists = childrenArray.some((child: any) => child.props?.tabKey === requestedTab);
|
|
297
|
+
if (!exists) return;
|
|
298
|
+
if (embeded) {
|
|
299
|
+
setLocalActiveTab(requestedTab);
|
|
300
|
+
} else {
|
|
301
|
+
const queryParams = new URLSearchParams(searchParams.toString());
|
|
302
|
+
queryParams.set('activeTab', requestedTab);
|
|
303
|
+
router.push(`${pathname}?${queryParams.toString()}`);
|
|
304
|
+
}
|
|
305
|
+
}, [requestedTabVersion]);
|
|
306
|
+
|
|
289
307
|
const activeIndex = useMemo(() => {
|
|
290
308
|
const idx = childrenArray.findIndex((child: any) => child.props?.tabKey === effectiveTab);
|
|
291
309
|
return idx >= 0 ? idx : 0;
|
|
@@ -350,6 +368,29 @@ const SolidDynamicWidget = ({ widgetName, formik, field, solidFormViewMetaData,
|
|
|
350
368
|
};
|
|
351
369
|
|
|
352
370
|
|
|
371
|
+
const FormikSubmitWatcher = ({ formik, tabFieldsRef, embeded, searchParams, setRequestedTab, setRequestedTabVersion }: any) => {
|
|
372
|
+
const lastHandledRef = useRef(0);
|
|
373
|
+
useEffect(() => {
|
|
374
|
+
if (formik.submitCount === lastHandledRef.current) return;
|
|
375
|
+
if (formik.isSubmitting) return;
|
|
376
|
+
lastHandledRef.current = formik.submitCount;
|
|
377
|
+
const erroredKeys = Object.keys(formik.errors || {});
|
|
378
|
+
if (erroredKeys.length === 0) return;
|
|
379
|
+
if (!tabFieldsRef.current || tabFieldsRef.current.length === 0) return;
|
|
380
|
+
const currentActive = embeded ? null : (searchParams.get("activeTab") || "");
|
|
381
|
+
const currentHasError = currentActive
|
|
382
|
+
? tabFieldsRef.current.find((t: any) => t.tabKey === currentActive)?.fields.some((f: string) => erroredKeys.includes(f))
|
|
383
|
+
: false;
|
|
384
|
+
if (currentHasError) return;
|
|
385
|
+
const firstErroredTab = tabFieldsRef.current.find((t: any) => t.fields.some((f: string) => erroredKeys.includes(f)));
|
|
386
|
+
if (firstErroredTab) {
|
|
387
|
+
setRequestedTab(firstErroredTab.tabKey);
|
|
388
|
+
setRequestedTabVersion((v: number) => v + 1);
|
|
389
|
+
}
|
|
390
|
+
}, [formik.submitCount, formik.isSubmitting]);
|
|
391
|
+
return null;
|
|
392
|
+
};
|
|
393
|
+
|
|
353
394
|
const SolidPage = ({ attrs, children, key, formik, fields }: any) => {
|
|
354
395
|
const fieldsName = fields.map((f: any) => f.attrs.name);
|
|
355
396
|
const errorCount = formik.submitCount > 0 ? fieldsName.filter((name: any) => !!formik.errors[name]).length : 0;
|
|
@@ -433,6 +474,12 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
433
474
|
const [chatterLocaleWidth, setChatterLocaleWidth] = useState(360);
|
|
434
475
|
const [isResizingChatterLocale, setIsResizingChatterLocale] = useState(false);
|
|
435
476
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
477
|
+
const [isMobileViewport, setIsMobileViewport] = useState(false);
|
|
478
|
+
const solidFormWrapperRef = useRef<HTMLDivElement | null>(null);
|
|
479
|
+
|
|
480
|
+
const tabFieldsRef = useRef<Array<{ tabKey: string; fields: string[] }>>([]);
|
|
481
|
+
const [requestedTab, setRequestedTab] = useState<string | null>(null);
|
|
482
|
+
const [requestedTabVersion, setRequestedTabVersion] = useState(0);
|
|
436
483
|
|
|
437
484
|
const [solidWorkflowFieldValue, setSolidWorkflowFieldValue] = useState<string>("");
|
|
438
485
|
const [defaultTabViewOptionIndex, setDefaultTabViewOptionIndex] = useState<number>(1);
|
|
@@ -450,15 +497,16 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
450
497
|
const actionContext = searchParams.get('actionContext');
|
|
451
498
|
|
|
452
499
|
const [trigger, { data: solidSettingsData }] = useLazyGetSolidSettingsQuery();
|
|
500
|
+
const solidSettingsMap = useMemo(() => getSettingsMap(solidSettingsData), [solidSettingsData]);
|
|
453
501
|
useEffect(() => {
|
|
454
502
|
trigger("") // Fetch settings on mount
|
|
455
503
|
}, [])
|
|
456
504
|
|
|
457
505
|
useEffect(() => {
|
|
458
|
-
if (
|
|
506
|
+
if (solidSettingsMap?.mcpEnabled && solidSettingsMap?.mcpServerUrl) {
|
|
459
507
|
enableSolidXAiPanel();
|
|
460
508
|
}
|
|
461
|
-
}, [
|
|
509
|
+
}, [solidSettingsMap]);
|
|
462
510
|
|
|
463
511
|
|
|
464
512
|
const enableSolidXAiPanel = async () => {
|
|
@@ -479,19 +527,34 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
479
527
|
}
|
|
480
528
|
|
|
481
529
|
const op = useRef(null);
|
|
530
|
+
const MIN_CHATTER_WIDTH = 320;
|
|
531
|
+
const MIN_FORM_SECTION_WIDTH = 420;
|
|
532
|
+
|
|
533
|
+
const getMaxChatterWidth = () => {
|
|
534
|
+
const wrapperWidth = solidFormWrapperRef.current?.getBoundingClientRect().width ?? window.innerWidth;
|
|
535
|
+
return Math.max(MIN_CHATTER_WIDTH, wrapperWidth - MIN_FORM_SECTION_WIDTH);
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
const clampChatterWidth = (width: number) => {
|
|
539
|
+
const maxWidth = getMaxChatterWidth();
|
|
540
|
+
return Math.max(MIN_CHATTER_WIDTH, Math.min(width, maxWidth));
|
|
541
|
+
};
|
|
542
|
+
|
|
482
543
|
useEffect(() => {
|
|
483
544
|
const stored = localStorage.getItem('chatter_locale_width');
|
|
484
545
|
if (stored) {
|
|
485
546
|
const parsed = parseInt(stored, 10);
|
|
486
|
-
const clampedWidth =
|
|
547
|
+
const clampedWidth = clampChatterWidth(parsed);
|
|
487
548
|
setChatterLocaleWidth(clampedWidth);
|
|
488
549
|
}
|
|
489
550
|
}, []);
|
|
490
551
|
useEffect(() => {
|
|
491
552
|
const handleMouseMove = (e: MouseEvent) => {
|
|
492
553
|
if (!isResizingChatterLocale) return;
|
|
493
|
-
const
|
|
494
|
-
const
|
|
554
|
+
const wrapperRect = solidFormWrapperRef.current?.getBoundingClientRect();
|
|
555
|
+
const rightEdge = wrapperRect?.right ?? window.innerWidth;
|
|
556
|
+
const newWidth = rightEdge - e.clientX;
|
|
557
|
+
const clampedWidth = clampChatterWidth(newWidth);
|
|
495
558
|
setChatterLocaleWidth(clampedWidth);
|
|
496
559
|
localStorage.setItem('chatter_locale_width', clampedWidth.toString());
|
|
497
560
|
};
|
|
@@ -511,6 +574,28 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
511
574
|
};
|
|
512
575
|
}, [isResizingChatterLocale]);
|
|
513
576
|
|
|
577
|
+
useEffect(() => {
|
|
578
|
+
const updateViewportFlag = () => setIsMobileViewport(window.innerWidth <= 1199);
|
|
579
|
+
updateViewportFlag();
|
|
580
|
+
window.addEventListener('resize', updateViewportFlag);
|
|
581
|
+
return () => window.removeEventListener('resize', updateViewportFlag);
|
|
582
|
+
}, []);
|
|
583
|
+
|
|
584
|
+
useEffect(() => {
|
|
585
|
+
const handleWindowResize = () => {
|
|
586
|
+
setChatterLocaleWidth((currentWidth) => {
|
|
587
|
+
const clamped = clampChatterWidth(currentWidth);
|
|
588
|
+
if (clamped !== currentWidth) {
|
|
589
|
+
localStorage.setItem('chatter_locale_width', clamped.toString());
|
|
590
|
+
}
|
|
591
|
+
return clamped;
|
|
592
|
+
});
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
window.addEventListener('resize', handleWindowResize);
|
|
596
|
+
return () => window.removeEventListener('resize', handleWindowResize);
|
|
597
|
+
}, []);
|
|
598
|
+
|
|
514
599
|
|
|
515
600
|
useEffect(() => {
|
|
516
601
|
const mode = searchParams.get('viewMode');
|
|
@@ -1202,7 +1287,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
1202
1287
|
});
|
|
1203
1288
|
|
|
1204
1289
|
return (
|
|
1205
|
-
<div className="solid-form-wrapper">
|
|
1290
|
+
<div className="solid-form-wrapper" ref={solidFormWrapperRef}>
|
|
1206
1291
|
<div className="solid-form-section">
|
|
1207
1292
|
<div className="page-header solid-list-toolbar flex-column lg:flex-row">
|
|
1208
1293
|
<div className="flex justify-content-between w-full solid-form-toolbar-row">
|
|
@@ -1266,10 +1351,14 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
1266
1351
|
});
|
|
1267
1352
|
|
|
1268
1353
|
const formFieldOnXXX = async (event: ChangeEvent<HTMLInputElement>, eventType: string) => {
|
|
1354
|
+
// console.log("formFieldOnXXX", eventType, event);
|
|
1269
1355
|
|
|
1270
|
-
// Invoke the formik change
|
|
1356
|
+
// Invoke the formik change
|
|
1271
1357
|
if (eventType === 'onFieldChange') {
|
|
1272
1358
|
formik.handleChange(event);
|
|
1359
|
+
formik.setFieldTouched(event.target.name, true, false);
|
|
1360
|
+
} else if (eventType === 'onFieldBlur') {
|
|
1361
|
+
formik.handleBlur(event);
|
|
1273
1362
|
}
|
|
1274
1363
|
|
|
1275
1364
|
// get details from the form event
|
|
@@ -1443,12 +1532,14 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
1443
1532
|
|
|
1444
1533
|
case "notebook":
|
|
1445
1534
|
if (visible === true) {
|
|
1446
|
-
|
|
1535
|
+
tabFieldsRef.current = [];
|
|
1536
|
+
return <SolidNotebook key={key} activeTab={searchParams.get("activeTab") || ""} embeded={params.embeded} requestedTab={requestedTab} requestedTabVersion={requestedTabVersion}>{children.map((element: any, index: number) => renderFormElementDynamically(element, recursiveFVMD, `${path}.${index}`))}</SolidNotebook>;
|
|
1447
1537
|
}
|
|
1448
1538
|
break;
|
|
1449
1539
|
case "page":
|
|
1450
1540
|
if (visible === true) {
|
|
1451
1541
|
const fields = children.flatMap((child: any) => getLayoutFields(child));
|
|
1542
|
+
tabFieldsRef.current.push({ tabKey: key, fields: fields.map((f: any) => f.attrs.name) });
|
|
1452
1543
|
const pageChildren = children.map((element: any, index: number) => renderFormElementDynamically(element, recursiveFVMD, `${path}.${index}`));
|
|
1453
1544
|
return SolidPage({ children: pageChildren, attrs: attrs, key: key, formik: formik, fields });
|
|
1454
1545
|
}
|
|
@@ -1636,9 +1727,17 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
1636
1727
|
|
|
1637
1728
|
|
|
1638
1729
|
return (
|
|
1639
|
-
<div className="solid-form-wrapper">
|
|
1730
|
+
<div className="solid-form-wrapper" ref={solidFormWrapperRef}>
|
|
1640
1731
|
<div className="solid-form-section">
|
|
1641
1732
|
<form style={{ width: '100%' }} onSubmit={formik.handleSubmit}>
|
|
1733
|
+
<FormikSubmitWatcher
|
|
1734
|
+
formik={formik}
|
|
1735
|
+
tabFieldsRef={tabFieldsRef}
|
|
1736
|
+
embeded={params.embeded}
|
|
1737
|
+
searchParams={searchParams}
|
|
1738
|
+
setRequestedTab={setRequestedTab}
|
|
1739
|
+
setRequestedTabVersion={setRequestedTabVersion}
|
|
1740
|
+
/>
|
|
1642
1741
|
<SolidFormActionHeader
|
|
1643
1742
|
formik={formik}
|
|
1644
1743
|
formData={solidFormViewData?.data}
|
|
@@ -1662,6 +1761,8 @@ const SolidFormView = (params: SolidFormViewProps) => {
|
|
|
1662
1761
|
onStepperUpdate={() => setRefreshChatterMessage(true)}
|
|
1663
1762
|
isSubmitting={isSubmitting}
|
|
1664
1763
|
headerRequestStatusLabel={isSubmitting ? "Saving..." : null}
|
|
1764
|
+
showMobileOpenChatter={isMobileViewport && !isShowChatter && params.embeded !== true}
|
|
1765
|
+
onMobileOpenChatter={() => setShowChatter(true)}
|
|
1665
1766
|
/>
|
|
1666
1767
|
<div className={`px-4 py-3 md:p-4 solid-form-content md:pt-1 ${createMode ? 'solid-create-mode-form-content' : ''} ${params.embeded === true ? 'h-auto' : ''}`} style={{ maxHeight: params.embeded === true ? '80vh' : '', overflowY: 'auto' }}>
|
|
1667
1768
|
{DynamicHeaderComponent && <DynamicHeaderComponent />}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Yup from 'yup';
|
|
2
|
+
import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
|
|
3
|
+
import { SolidFormFieldWidgetProps } from "../../../../types/solid-core";
|
|
4
|
+
/**
|
|
5
|
+
* SolidComputedField
|
|
6
|
+
*
|
|
7
|
+
* Computed fields are server-generated values (e.g. auto-calculated totals, slugs, codes).
|
|
8
|
+
* They are always read-only in the UI and are only shown when a record already exists
|
|
9
|
+
* (i.e., the form is in view or edit mode for an existing record, NOT during creation).
|
|
10
|
+
*/
|
|
11
|
+
export declare class SolidComputedField implements ISolidField {
|
|
12
|
+
private fieldContext;
|
|
13
|
+
constructor(fieldContext: SolidFieldProps);
|
|
14
|
+
updateFormData(_value: any, _formData: FormData): any;
|
|
15
|
+
initialValue(): any;
|
|
16
|
+
validationSchema(): Yup.Schema;
|
|
17
|
+
render(formik: FormikObject): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
renderExtensionRenderMode(widget: string, formik: FormikObject): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Default widget for computed fields — renders as a read-only input in edit mode.
|
|
22
|
+
* Uses the same layout as the short-text view widget for consistency.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DefaultComputedFormWidget: ({ formik, fieldContext }: SolidFormFieldWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=SolidComputedField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolidComputedField.d.ts","sourceRoot":"","sources":["../../../../../src/components/core/form/fields/SolidComputedField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAIzE;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IAElD,OAAO,CAAC,YAAY,CAAkB;gBAE1B,YAAY,EAAE,eAAe;IAIzC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,GAAG,GAAG;IAIrD,YAAY,IAAI,GAAG;IAMnB,gBAAgB,IAAI,GAAG,CAAC,MAAM;IAK9B,MAAM,CAAC,MAAM,EAAE,YAAY;IAoC3B,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;CAYjE;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,6BAA8B,yBAAyB,4CAwC5F,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as Yup from 'yup';
|
|
14
|
+
import styles from './solidFields.module.css';
|
|
15
|
+
import { getExtensionComponent } from "../../../../helpers/registry";
|
|
16
|
+
import { SolidFieldTooltip } from "../../../../components/common/SolidFieldTooltip";
|
|
17
|
+
import { SolidInput } from "../../../shad-cn-ui";
|
|
18
|
+
/**
|
|
19
|
+
* SolidComputedField
|
|
20
|
+
*
|
|
21
|
+
* Computed fields are server-generated values (e.g. auto-calculated totals, slugs, codes).
|
|
22
|
+
* They are always read-only in the UI and are only shown when a record already exists
|
|
23
|
+
* (i.e., the form is in view or edit mode for an existing record, NOT during creation).
|
|
24
|
+
*/
|
|
25
|
+
var SolidComputedField = /** @class */ (function () {
|
|
26
|
+
function SolidComputedField(fieldContext) {
|
|
27
|
+
Object.defineProperty(this, "fieldContext", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
this.fieldContext = fieldContext;
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(SolidComputedField.prototype, "updateFormData", {
|
|
36
|
+
enumerable: false,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: function (_value, _formData) {
|
|
40
|
+
// Computed fields are never submitted — the server calculates them.
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(SolidComputedField.prototype, "initialValue", {
|
|
44
|
+
enumerable: false,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: function () {
|
|
48
|
+
var _a;
|
|
49
|
+
var fieldName = this.fieldContext.field.attrs.name;
|
|
50
|
+
var existingValue = (_a = this.fieldContext.data) === null || _a === void 0 ? void 0 : _a[fieldName];
|
|
51
|
+
return existingValue !== undefined && existingValue !== null ? existingValue : '';
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(SolidComputedField.prototype, "validationSchema", {
|
|
55
|
+
enumerable: false,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: function () {
|
|
59
|
+
// Computed fields are always optional; they are never set by the user.
|
|
60
|
+
return Yup.mixed().nullable();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(SolidComputedField.prototype, "render", {
|
|
64
|
+
enumerable: false,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
value: function (formik) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
var fieldLayoutInfo = this.fieldContext.field;
|
|
70
|
+
var className = ((_a = fieldLayoutInfo.attrs) === null || _a === void 0 ? void 0 : _a.className) || 'field col-12';
|
|
71
|
+
// Computed fields are only relevant for existing records.
|
|
72
|
+
// Check by whether the underlying data has an `id` (record exists).
|
|
73
|
+
var recordExists = !!((_b = this.fieldContext.data) === null || _b === void 0 ? void 0 : _b.id);
|
|
74
|
+
if (!recordExists) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
var viewWidget = fieldLayoutInfo.attrs.viewWidget;
|
|
78
|
+
var editWidget = fieldLayoutInfo.attrs.editWidget;
|
|
79
|
+
if (!editWidget) {
|
|
80
|
+
editWidget = 'DefaultComputedFormWidget';
|
|
81
|
+
}
|
|
82
|
+
if (!viewWidget) {
|
|
83
|
+
viewWidget = 'DefaultComputedFormWidget';
|
|
84
|
+
}
|
|
85
|
+
var viewMode = this.fieldContext.viewMode;
|
|
86
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: className, children: [viewMode === "view" &&
|
|
87
|
+
this.renderExtensionRenderMode(viewWidget, formik), viewMode === "edit" &&
|
|
88
|
+
this.renderExtensionRenderMode(editWidget, formik)] }) }));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(SolidComputedField.prototype, "renderExtensionRenderMode", {
|
|
92
|
+
enumerable: false,
|
|
93
|
+
configurable: true,
|
|
94
|
+
writable: true,
|
|
95
|
+
value: function (widget, formik) {
|
|
96
|
+
var DynamicWidget = getExtensionComponent(widget);
|
|
97
|
+
var widgetProps = {
|
|
98
|
+
formik: formik,
|
|
99
|
+
fieldContext: this.fieldContext,
|
|
100
|
+
};
|
|
101
|
+
return (_jsx(_Fragment, { children: DynamicWidget && _jsx(DynamicWidget, __assign({}, widgetProps)) }));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return SolidComputedField;
|
|
105
|
+
}());
|
|
106
|
+
export { SolidComputedField };
|
|
107
|
+
/**
|
|
108
|
+
* Default widget for computed fields — renders as a read-only input in edit mode.
|
|
109
|
+
* Uses the same layout as the short-text view widget for consistency.
|
|
110
|
+
*/
|
|
111
|
+
export var DefaultComputedFormWidget = function (_a) {
|
|
112
|
+
var _b, _c;
|
|
113
|
+
var formik = _a.formik, fieldContext = _a.fieldContext;
|
|
114
|
+
var fieldMetadata = fieldContext.fieldMetadata;
|
|
115
|
+
var fieldLayoutInfo = fieldContext.field;
|
|
116
|
+
var fieldLabel = (_b = fieldLayoutInfo.attrs.label) !== null && _b !== void 0 ? _b : fieldMetadata === null || fieldMetadata === void 0 ? void 0 : fieldMetadata.displayName;
|
|
117
|
+
var showFieldLabel = (_c = fieldLayoutInfo === null || fieldLayoutInfo === void 0 ? void 0 : fieldLayoutInfo.attrs) === null || _c === void 0 ? void 0 : _c.showLabel;
|
|
118
|
+
var viewMode = fieldContext.viewMode;
|
|
119
|
+
var value = formik.values[fieldLayoutInfo.attrs.name];
|
|
120
|
+
if (viewMode === 'view') {
|
|
121
|
+
// View mode: display as plain text (same as DefaultShortTextFormViewWidget)
|
|
122
|
+
return (_jsxs("div", { className: styles.fieldViewWrapper, children: [showFieldLabel !== false && (_jsx("p", { className: "".concat(styles.fieldViewLabel, " form-field-label"), children: fieldLabel })), _jsx("p", { className: styles.fieldViewValue, children: value && typeof value === 'string' ? value : '' })] }));
|
|
123
|
+
}
|
|
124
|
+
// Edit mode: read-only input to make it clear this is a server-computed value
|
|
125
|
+
return (_jsxs("div", { className: styles.fieldWrapper, children: [showFieldLabel != false &&
|
|
126
|
+
_jsxs("label", { htmlFor: fieldLayoutInfo.attrs.name, className: "".concat(styles.fieldLabel, " form-field-label"), children: [fieldLabel, _jsx(SolidFieldTooltip, { fieldContext: fieldContext })] }), _jsx(SolidInput, { type: "text", id: fieldLayoutInfo.attrs.name, name: fieldLayoutInfo.attrs.name, value: value || '', readOnly: true, disabled: true, className: styles.fieldInput })] }));
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=SolidComputedField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolidComputedField.js","sourceRoot":"","sources":["../../../../../src/components/core/form/fields/SolidComputedField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;GAMG;AACH;IAII,4BAAY,YAA6B;QAFjC;;;;;WAA8B;QAGlC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;;;;;eAED,UAAe,MAAW,EAAE,SAAmB;YAC3C,oEAAoE;QACxE,CAAC;;;;;;eAED;;YACI,IAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;YACrD,IAAM,aAAa,GAAG,MAAA,I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IAED,8EAA8E;IAC9E,OAAO,CACH,eAAK,SAAS,EAAE,MAAM,CAAC,YAAY,aAC9B,cAAc,IAAI,KAAK;gBACpB,iBAAO,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,UAAG,MAAM,CAAC,UAAU,sBAAmB,aACzF,UAAU,EACX,KAAC,iBAAiB,IAAC,YAAY,EAAE,YAAY,GAAI,IAC7C,EAEZ,KAAC,UAAU,IACP,IAAI,EAAC,MAAM,EACX,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAC9B,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,EAChC,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,QAAQ,QACR,QAAQ,QACR,SAAS,EAAE,MAAM,CAAC,UAAU,GAC9B,IACA,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["\nimport * as Yup from 'yup';\nimport styles from './solidFields.module.css';\nimport { FormikObject, ISolidField, SolidFieldProps } from \"./ISolidField\";\nimport { getExtensionComponent } from \"../../../../helpers/registry\";\nimport { SolidFormFieldWidgetProps } from \"../../../../types/solid-core\";\nimport { SolidFieldTooltip } from \"../../../../components/common/SolidFieldTooltip\";\nimport { SolidInput } from \"../../../shad-cn-ui\";\n\n/**\n * SolidComputedField\n *\n * Computed fields are server-generated values (e.g. auto-calculated totals, slugs, codes).\n * They are always read-only in the UI and are only shown when a record already exists\n * (i.e., the form is in view or edit mode for an existing record, NOT during creation).\n */\nexport class SolidComputedField implements ISolidField {\n\n private fieldContext: SolidFieldProps;\n\n constructor(fieldContext: SolidFieldProps) {\n this.fieldContext = fieldContext;\n }\n\n updateFormData(_value: any, _formData: FormData): any {\n // Computed fields are never submitted — the server calculates them.\n }\n\n initialValue(): any {\n const fieldName = this.fieldContext.field.attrs.name;\n const existingValue = this.fieldContext.data?.[fieldName];\n return existingValue !== undefined && existingValue !== null ? existingValue : '';\n }\n\n validationSchema(): Yup.Schema {\n // Computed fields are always optional; they are never set by the user.\n return Yup.mixed().nullable();\n }\n\n render(formik: FormikObject) {\n const fieldLayoutInfo = this.fieldContext.field;\n const className = fieldLayoutInfo.attrs?.className || 'field col-12';\n\n // Computed fields are only relevant for existing records.\n // Check by whether the underlying data has an `id` (record exists).\n const recordExists = !!this.fieldContext.data?.id;\n if (!recordExists) {\n return null;\n }\n\n let viewWidget = fieldLayoutInfo.attrs.viewWidget;\n let editWidget = fieldLayoutInfo.attrs.editWidget;\n if (!editWidget) {\n editWidget = 'DefaultComputedFormWidget';\n }\n if (!viewWidget) {\n viewWidget = 'DefaultComputedFormWidget';\n }\n\n const viewMode: string = this.fieldContext.viewMode;\n\n return (\n <>\n <div className={className}>\n {viewMode === \"view\" &&\n this.renderExtensionRenderMode(viewWidget, formik)\n }\n {viewMode === \"edit\" &&\n this.renderExtensionRenderMode(editWidget, formik)\n }\n </div>\n </>\n );\n }\n\n renderExtensionRenderMode(widget: string, formik: FormikObject) {\n let DynamicWidget = getExtensionComponent(widget);\n const widgetProps: SolidFormFieldWidgetProps = {\n formik: formik,\n fieldContext: this.fieldContext,\n }\n return (\n <>\n {DynamicWidget && <DynamicWidget {...widgetProps} />}\n </>\n )\n }\n}\n\n/**\n * Default widget for computed fields — renders as a read-only input in edit mode.\n * Uses the same layout as the short-text view widget for consistency.\n */\nexport const DefaultComputedFormWidget = ({ formik, fieldContext }: SolidFormFieldWidgetProps) => {\n const fieldMetadata = fieldContext.fieldMetadata;\n const fieldLayoutInfo = fieldContext.field;\n const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata?.displayName;\n const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;\n const viewMode: string = fieldContext.viewMode;\n const value = formik.values[fieldLayoutInfo.attrs.name];\n\n if (viewMode === 'view') {\n // View mode: display as plain text (same as DefaultShortTextFormViewWidget)\n return (\n <div className={styles.fieldViewWrapper}>\n {showFieldLabel !== false && (\n <p className={`${styles.fieldViewLabel} form-field-label`}>{fieldLabel}</p>\n )}\n <p className={styles.fieldViewValue}>{value && typeof value === 'string' ? value : ''}</p>\n </div>\n );\n }\n\n // Edit mode: read-only input to make it clear this is a server-computed value\n return (\n <div className={styles.fieldWrapper}>\n {showFieldLabel != false &&\n <label htmlFor={fieldLayoutInfo.attrs.name} className={`${styles.fieldLabel} form-field-label`}>\n {fieldLabel}\n <SolidFieldTooltip fieldContext={fieldContext} />\n </label>\n }\n <SolidInput\n type=\"text\"\n id={fieldLayoutInfo.attrs.name}\n name={fieldLayoutInfo.attrs.name}\n value={value || ''}\n readOnly\n disabled\n className={styles.fieldInput}\n />\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
import * as Yup from 'yup';
|
|
3
|
+
import styles from './solidFields.module.css';
|
|
4
|
+
import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
|
|
5
|
+
import { getExtensionComponent } from "../../../../helpers/registry";
|
|
6
|
+
import { SolidFormFieldWidgetProps } from "../../../../types/solid-core";
|
|
7
|
+
import { SolidFieldTooltip } from "../../../../components/common/SolidFieldTooltip";
|
|
8
|
+
import { SolidInput } from "../../../shad-cn-ui";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* SolidComputedField
|
|
12
|
+
*
|
|
13
|
+
* Computed fields are server-generated values (e.g. auto-calculated totals, slugs, codes).
|
|
14
|
+
* They are always read-only in the UI and are only shown when a record already exists
|
|
15
|
+
* (i.e., the form is in view or edit mode for an existing record, NOT during creation).
|
|
16
|
+
*/
|
|
17
|
+
export class SolidComputedField implements ISolidField {
|
|
18
|
+
|
|
19
|
+
private fieldContext: SolidFieldProps;
|
|
20
|
+
|
|
21
|
+
constructor(fieldContext: SolidFieldProps) {
|
|
22
|
+
this.fieldContext = fieldContext;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
updateFormData(_value: any, _formData: FormData): any {
|
|
26
|
+
// Computed fields are never submitted — the server calculates them.
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
initialValue(): any {
|
|
30
|
+
const fieldName = this.fieldContext.field.attrs.name;
|
|
31
|
+
const existingValue = this.fieldContext.data?.[fieldName];
|
|
32
|
+
return existingValue !== undefined && existingValue !== null ? existingValue : '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
validationSchema(): Yup.Schema {
|
|
36
|
+
// Computed fields are always optional; they are never set by the user.
|
|
37
|
+
return Yup.mixed().nullable();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render(formik: FormikObject) {
|
|
41
|
+
const fieldLayoutInfo = this.fieldContext.field;
|
|
42
|
+
const className = fieldLayoutInfo.attrs?.className || 'field col-12';
|
|
43
|
+
|
|
44
|
+
// Computed fields are only relevant for existing records.
|
|
45
|
+
// Check by whether the underlying data has an `id` (record exists).
|
|
46
|
+
const recordExists = !!this.fieldContext.data?.id;
|
|
47
|
+
if (!recordExists) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let viewWidget = fieldLayoutInfo.attrs.viewWidget;
|
|
52
|
+
let editWidget = fieldLayoutInfo.attrs.editWidget;
|
|
53
|
+
if (!editWidget) {
|
|
54
|
+
editWidget = 'DefaultComputedFormWidget';
|
|
55
|
+
}
|
|
56
|
+
if (!viewWidget) {
|
|
57
|
+
viewWidget = 'DefaultComputedFormWidget';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const viewMode: string = this.fieldContext.viewMode;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<div className={className}>
|
|
65
|
+
{viewMode === "view" &&
|
|
66
|
+
this.renderExtensionRenderMode(viewWidget, formik)
|
|
67
|
+
}
|
|
68
|
+
{viewMode === "edit" &&
|
|
69
|
+
this.renderExtensionRenderMode(editWidget, formik)
|
|
70
|
+
}
|
|
71
|
+
</div>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
renderExtensionRenderMode(widget: string, formik: FormikObject) {
|
|
77
|
+
let DynamicWidget = getExtensionComponent(widget);
|
|
78
|
+
const widgetProps: SolidFormFieldWidgetProps = {
|
|
79
|
+
formik: formik,
|
|
80
|
+
fieldContext: this.fieldContext,
|
|
81
|
+
}
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
{DynamicWidget && <DynamicWidget {...widgetProps} />}
|
|
85
|
+
</>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Default widget for computed fields — renders as a read-only input in edit mode.
|
|
92
|
+
* Uses the same layout as the short-text view widget for consistency.
|
|
93
|
+
*/
|
|
94
|
+
export const DefaultComputedFormWidget = ({ formik, fieldContext }: SolidFormFieldWidgetProps) => {
|
|
95
|
+
const fieldMetadata = fieldContext.fieldMetadata;
|
|
96
|
+
const fieldLayoutInfo = fieldContext.field;
|
|
97
|
+
const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata?.displayName;
|
|
98
|
+
const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;
|
|
99
|
+
const viewMode: string = fieldContext.viewMode;
|
|
100
|
+
const value = formik.values[fieldLayoutInfo.attrs.name];
|
|
101
|
+
|
|
102
|
+
if (viewMode === 'view') {
|
|
103
|
+
// View mode: display as plain text (same as DefaultShortTextFormViewWidget)
|
|
104
|
+
return (
|
|
105
|
+
<div className={styles.fieldViewWrapper}>
|
|
106
|
+
{showFieldLabel !== false && (
|
|
107
|
+
<p className={`${styles.fieldViewLabel} form-field-label`}>{fieldLabel}</p>
|
|
108
|
+
)}
|
|
109
|
+
<p className={styles.fieldViewValue}>{value && typeof value === 'string' ? value : ''}</p>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Edit mode: read-only input to make it clear this is a server-computed value
|
|
115
|
+
return (
|
|
116
|
+
<div className={styles.fieldWrapper}>
|
|
117
|
+
{showFieldLabel != false &&
|
|
118
|
+
<label htmlFor={fieldLayoutInfo.attrs.name} className={`${styles.fieldLabel} form-field-label`}>
|
|
119
|
+
{fieldLabel}
|
|
120
|
+
<SolidFieldTooltip fieldContext={fieldContext} />
|
|
121
|
+
</label>
|
|
122
|
+
}
|
|
123
|
+
<SolidInput
|
|
124
|
+
type="text"
|
|
125
|
+
id={fieldLayoutInfo.attrs.name}
|
|
126
|
+
name={fieldLayoutInfo.attrs.name}
|
|
127
|
+
value={value || ''}
|
|
128
|
+
readOnly
|
|
129
|
+
disabled
|
|
130
|
+
className={styles.fieldInput}
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
@@ -157,6 +157,6 @@ export var DefaultDateTimeFormViewWidget = function (_a) {
|
|
|
157
157
|
var showFieldLabel = (_c = fieldLayoutInfo === null || fieldLayoutInfo === void 0 ? void 0 : fieldLayoutInfo.attrs) === null || _c === void 0 ? void 0 : _c.showLabel;
|
|
158
158
|
var rawValue = formik.values[fieldName];
|
|
159
159
|
var format = (_d = fieldLayoutInfo.attrs) === null || _d === void 0 ? void 0 : _d.format;
|
|
160
|
-
return (_jsxs("div", { className: styles.fieldViewWrapper, children: [showFieldLabel !== false && (_jsx("p", { className: "".concat(styles.fieldViewLabel, " form-field-label"), children: fieldLabel })), _jsx("p", { className: styles.fieldViewValue, children: _jsx(DateFieldViewComponent, { value: rawValue, format: format, fallback: "-" }) })] }));
|
|
160
|
+
return (_jsxs("div", { className: styles.fieldViewWrapper, children: [showFieldLabel !== false && (_jsx("p", { className: "".concat(styles.fieldViewLabel, " form-field-label"), children: fieldLabel })), _jsx("p", { className: styles.fieldViewValue, children: _jsx(DateFieldViewComponent, { value: rawValue, format: format, showTime: true, fallback: "-" }) })] }));
|
|
161
161
|
};
|
|
162
162
|
//# sourceMappingURL=SolidDateTimeField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidDateTimeField.js","sourceRoot":"","sources":["../../../../../src/components/core/form/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N,MAAM,CAAE,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,0CAAE,QAAQ,EAAE,GAAI,GAC7F,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAA;AAGD,MAAM,CAAC,IAAM,6BAA6B,GAAG,UAAC,EAGlB;;QAFxB,MAAM,YAAA,EACN,YAAY,kBAAA;IAEZ,IAAM,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;IACjD,IAAM,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC;IAE3C,IAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC;IAC7C,IAAM,UAAU,GACZ,MAAA,eAAe,CAAC,KAAK,CAAC,KAAK,mCAAI,aAAa,CAAC,WAAW,CAAC;IAC7D,IAAM,cAAc,GAAG,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,KAAK,0CAAE,SAAS,CAAC;IAEzD,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAM,MAAM,GAAG,MAAA,eAAe,CAAC,KAAK,0CAAE,MAA4B,CAAC;IAEnE,OAAO,CACH,eAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,aAClC,cAAc,KAAK,KAAK,IAAI,CACzB,YAAG,SAAS,EAAE,UAAG,MAAM,CAAC,cAAc,sBAAmB,YACpD,UAAU,GACX,CACP,EACD,YAAG,SAAS,EAAE,MAAM,CAAC,cAAc,YAC/B,KAAC,sBAAsB,IAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAC,GAAG,GAA0B,GAC/F,IACF,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["\nimport { SolidDatePicker } from \"../../../shad-cn-ui/SolidDatePicker\";\nimport { SolidMessage } from \"../../../shad-cn-ui/SolidMessage\";\nimport { buildSyntheticChangeEvent } from \"./fieldEventUtils\";\nimport { useEffect, useRef, useState } from \"react\";\nimport * as Yup from 'yup';\nimport { FormikObject, ISolidField, SolidFieldProps } from \"./ISolidField\";\nimport { getExtensionComponent } from \"../../../../helpers/registry\";\nimport { SolidFormFieldWidgetProps } from \"../../../../types/solid-core\";\nimport { SolidFieldTooltip } from \"../../../../components/common/SolidFieldTooltip\";\nimport { ERROR_MESSAGES } from \"../../../../constants/error-messages\";\nimport { DateFieldViewComponent } from '../../../../components/core/common/DateFieldViewComponent';\nimport dayjs from \"dayjs\";\nimport styles from \"./solidFields.module.css\";\nimport utc from 'dayjs/plugin/utc';\n\ndayjs.extend(utc);\n\nconst toDateValue = (value: any) => {\n if (!value) return null;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n};\n\nexport class SolidDateTimeField implements ISolidField {\n\n private fieldContext: SolidFieldProps;\n\n constructor(fieldContext: SolidFieldProps) {\n this.fieldContext = fieldContext;\n }\n\n updateFormData(value: any, formData: FormData): any {\n const fieldLayoutInfo = this.fieldContext.field;\n if (value instanceof Date && !isNaN(value.getTime())) {\n formData.append(fieldLayoutInfo.attrs.name, dayjs(value).utc().format('YYYY-MM-DD HH:mm:ss'));\n } else if (value) {\n formData.append(fieldLayoutInfo.attrs.name, value);\n }\n }\n\n initialValue(): any {\n const fieldName = this.fieldContext.field.attrs.name;\n const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;\n\n const existingValue = this.fieldContext.data[fieldName];\n\n return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';\n }\n\n validationSchema(): Yup.Schema {\n let schema: Yup.DateSchema<Date | null | undefined> = Yup.date();\n const fieldMetadata = this.fieldContext.fieldMetadata;\n const fieldLayoutInfo = this.fieldContext.field;\n const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;\n\n // 1. required \n if (fieldMetadata.required) {\n schema = schema.required(ERROR_MESSAGES.FIELD_REUQIRED(fieldLabel));\n } else {\n schema = schema.nullable();\n }\n return schema;\n }\n\n render(formik: FormikObject) {\n const fieldMetadata = this.fieldContext.fieldMetadata;\n const fieldLayoutInfo = this.fieldContext.field;\n const className = fieldLayoutInfo.attrs?.className || 'field col-12';\n\n const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];\n let viewWidget = fieldLayoutInfo.attrs.viewWidget;\n let editWidget = fieldLayoutInfo.attrs.editWidget;\n if (!editWidget) {\n editWidget = 'DefaultDateTimeFormEditWidget';\n }\n if (!viewWidget) {\n viewWidget = 'DefaultDateTimeFormViewWidget';\n }\n const viewMode: string = this.fieldContext.viewMode;\n\n return (\n <>\n <div className={className}>\n {viewMode === \"view\" &&\n this.renderExtensionRenderMode(viewWidget, formik)\n }\n {viewMode === \"edit\" && (\n <>\n {editWidget &&\n this.renderExtensionRenderMode(editWidget, formik)\n }\n </>\n )\n }\n </div>\n </>\n );\n }\n renderExtensionRenderMode(widget: string, formik: FormikObject) {\n let DynamicWidget = getExtensionComponent(widget);\n const widgetProps: SolidFormFieldWidgetProps = {\n formik: formik,\n fieldContext: this.fieldContext,\n }\n return (\n <>\n {DynamicWidget && <DynamicWidget {...widgetProps} />}\n </>\n )\n }\n}\n\n\n\n\nexport const DefaultDateTimeFormEditWidget = ({ formik, fieldContext }: SolidFormFieldWidgetProps) => {\n\n const fieldMetadata = fieldContext.fieldMetadata;\n const fieldLayoutInfo = fieldContext.field;\n const className = fieldLayoutInfo.attrs?.className || 'field col-12';\n const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;\n const solidFormViewMetaData = fieldContext.solidFormViewMetaData;\n const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;\n const readOnlyPermission = fieldContext.readOnly;\n\n const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];\n\n const fieldDisabled = fieldLayoutInfo.attrs?.disabled;\n const fieldReadonly = fieldLayoutInfo.attrs?.readonly;\n const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;\n const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;\n\n const parsedValue = toDateValue(formik.values[fieldLayoutInfo.attrs.name]);\n\n const handleChange = (date: Date | null) => {\n const syntheticEvent = buildSyntheticChangeEvent(fieldLayoutInfo.attrs.name, date, \"datetime-local\");\n fieldContext.onChange(syntheticEvent, \"onFieldChange\");\n };\n\n return (\n <div className=\"relative\">\n <div className={styles.fieldWrapper}>\n {showFieldLabel != false &&\n <label htmlFor={fieldLayoutInfo.attrs.name} className={`${styles.fieldLabel} form-field-label`}>{fieldLabel}\n {fieldMetadata.required && <span className=\"text-red-500\"> *</span>}\n <SolidFieldTooltip fieldContext={fieldContext} />\n {/* {fieldDescription && <span className=\"form_field_help\">({fieldDescription}) </span>} */}\n </label>\n }\n <SolidDatePicker\n selected={parsedValue ?? undefined}\n onChange={(date: Date | null) => handleChange(date as Date | null)}\n disabled={formDisabled || fieldDisabled || readOnlyPermission}\n readOnly={formReadonly || fieldReadonly || readOnlyPermission}\n showTimeSelect\n dateFormat=\"yyyy-MM-dd h:mm aa\"\n placeholderText={fieldLayoutInfo.attrs.placeholder}\n className=\"\"\n />\n </div>\n {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (\n <div className=\"absolute mt-1\">\n <SolidMessage severity=\"error\" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />\n </div>\n )}\n </div>\n );\n}\n\n\nexport const DefaultDateTimeFormViewWidget = ({\n formik,\n fieldContext,\n}: SolidFormFieldWidgetProps) => {\n const fieldMetadata = fieldContext.fieldMetadata;\n const fieldLayoutInfo = fieldContext.field;\n\n const fieldName = fieldLayoutInfo.attrs.name;\n const fieldLabel =\n fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;\n const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;\n\n const rawValue = formik.values[fieldName];\n const format = fieldLayoutInfo.attrs?.format as string | undefined;\n\n return (\n <div className={styles.fieldViewWrapper}>\n {showFieldLabel !== false && (\n <p className={`${styles.fieldViewLabel} form-field-label`}>\n {fieldLabel}\n </p>\n )}\n <p className={styles.fieldViewValue}>\n <DateFieldViewComponent value={rawValue} format={format} fallback=\"-\"></DateFieldViewComponent>\n </p>\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SolidDateTimeField.js","sourceRoot":"","sources":["../../../../../src/components/core/form/fields/SolidDateTimeField.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AACnG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAElB,IAAM,WAAW,GAAG,UAAC,KAAU;IAC3B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAM,IAAI,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC,CAAC;AAEF;IAII,4BAAY,YAA6B;QAFjC;;;;;WAA8B;QAGlC,IAAI,C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AAC,GAAG,GAA0B,GAC/G,IACF,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["\nimport { SolidDatePicker } from \"../../../shad-cn-ui/SolidDatePicker\";\nimport { SolidMessage } from \"../../../shad-cn-ui/SolidMessage\";\nimport { buildSyntheticChangeEvent } from \"./fieldEventUtils\";\nimport { useEffect, useRef, useState } from \"react\";\nimport * as Yup from 'yup';\nimport { FormikObject, ISolidField, SolidFieldProps } from \"./ISolidField\";\nimport { getExtensionComponent } from \"../../../../helpers/registry\";\nimport { SolidFormFieldWidgetProps } from \"../../../../types/solid-core\";\nimport { SolidFieldTooltip } from \"../../../../components/common/SolidFieldTooltip\";\nimport { ERROR_MESSAGES } from \"../../../../constants/error-messages\";\nimport { DateFieldViewComponent } from '../../../../components/core/common/DateFieldViewComponent';\nimport dayjs from \"dayjs\";\nimport styles from \"./solidFields.module.css\";\nimport utc from 'dayjs/plugin/utc';\n\ndayjs.extend(utc);\n\nconst toDateValue = (value: any) => {\n if (!value) return null;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n};\n\nexport class SolidDateTimeField implements ISolidField {\n\n private fieldContext: SolidFieldProps;\n\n constructor(fieldContext: SolidFieldProps) {\n this.fieldContext = fieldContext;\n }\n\n updateFormData(value: any, formData: FormData): any {\n const fieldLayoutInfo = this.fieldContext.field;\n if (value instanceof Date && !isNaN(value.getTime())) {\n formData.append(fieldLayoutInfo.attrs.name, dayjs(value).utc().format('YYYY-MM-DD HH:mm:ss'));\n } else if (value) {\n formData.append(fieldLayoutInfo.attrs.name, value);\n }\n }\n\n initialValue(): any {\n const fieldName = this.fieldContext.field.attrs.name;\n const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;\n\n const existingValue = this.fieldContext.data[fieldName];\n\n return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';\n }\n\n validationSchema(): Yup.Schema {\n let schema: Yup.DateSchema<Date | null | undefined> = Yup.date();\n const fieldMetadata = this.fieldContext.fieldMetadata;\n const fieldLayoutInfo = this.fieldContext.field;\n const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;\n\n // 1. required \n if (fieldMetadata.required) {\n schema = schema.required(ERROR_MESSAGES.FIELD_REUQIRED(fieldLabel));\n } else {\n schema = schema.nullable();\n }\n return schema;\n }\n\n render(formik: FormikObject) {\n const fieldMetadata = this.fieldContext.fieldMetadata;\n const fieldLayoutInfo = this.fieldContext.field;\n const className = fieldLayoutInfo.attrs?.className || 'field col-12';\n\n const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];\n let viewWidget = fieldLayoutInfo.attrs.viewWidget;\n let editWidget = fieldLayoutInfo.attrs.editWidget;\n if (!editWidget) {\n editWidget = 'DefaultDateTimeFormEditWidget';\n }\n if (!viewWidget) {\n viewWidget = 'DefaultDateTimeFormViewWidget';\n }\n const viewMode: string = this.fieldContext.viewMode;\n\n return (\n <>\n <div className={className}>\n {viewMode === \"view\" &&\n this.renderExtensionRenderMode(viewWidget, formik)\n }\n {viewMode === \"edit\" && (\n <>\n {editWidget &&\n this.renderExtensionRenderMode(editWidget, formik)\n }\n </>\n )\n }\n </div>\n </>\n );\n }\n renderExtensionRenderMode(widget: string, formik: FormikObject) {\n let DynamicWidget = getExtensionComponent(widget);\n const widgetProps: SolidFormFieldWidgetProps = {\n formik: formik,\n fieldContext: this.fieldContext,\n }\n return (\n <>\n {DynamicWidget && <DynamicWidget {...widgetProps} />}\n </>\n )\n }\n}\n\n\n\n\nexport const DefaultDateTimeFormEditWidget = ({ formik, fieldContext }: SolidFormFieldWidgetProps) => {\n\n const fieldMetadata = fieldContext.fieldMetadata;\n const fieldLayoutInfo = fieldContext.field;\n const className = fieldLayoutInfo.attrs?.className || 'field col-12';\n const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;\n const solidFormViewMetaData = fieldContext.solidFormViewMetaData;\n const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;\n const readOnlyPermission = fieldContext.readOnly;\n\n const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];\n\n const fieldDisabled = fieldLayoutInfo.attrs?.disabled;\n const fieldReadonly = fieldLayoutInfo.attrs?.readonly;\n const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;\n const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;\n\n const parsedValue = toDateValue(formik.values[fieldLayoutInfo.attrs.name]);\n\n const handleChange = (date: Date | null) => {\n const syntheticEvent = buildSyntheticChangeEvent(fieldLayoutInfo.attrs.name, date, \"datetime-local\");\n fieldContext.onChange(syntheticEvent, \"onFieldChange\");\n };\n\n return (\n <div className=\"relative\">\n <div className={styles.fieldWrapper}>\n {showFieldLabel != false &&\n <label htmlFor={fieldLayoutInfo.attrs.name} className={`${styles.fieldLabel} form-field-label`}>{fieldLabel}\n {fieldMetadata.required && <span className=\"text-red-500\"> *</span>}\n <SolidFieldTooltip fieldContext={fieldContext} />\n {/* {fieldDescription && <span className=\"form_field_help\">({fieldDescription}) </span>} */}\n </label>\n }\n <SolidDatePicker\n selected={parsedValue ?? undefined}\n onChange={(date: Date | null) => handleChange(date as Date | null)}\n disabled={formDisabled || fieldDisabled || readOnlyPermission}\n readOnly={formReadonly || fieldReadonly || readOnlyPermission}\n showTimeSelect\n dateFormat=\"yyyy-MM-dd h:mm aa\"\n placeholderText={fieldLayoutInfo.attrs.placeholder}\n className=\"\"\n />\n </div>\n {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (\n <div className=\"absolute mt-1\">\n <SolidMessage severity=\"error\" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />\n </div>\n )}\n </div>\n );\n}\n\n\nexport const DefaultDateTimeFormViewWidget = ({\n formik,\n fieldContext,\n}: SolidFormFieldWidgetProps) => {\n const fieldMetadata = fieldContext.fieldMetadata;\n const fieldLayoutInfo = fieldContext.field;\n\n const fieldName = fieldLayoutInfo.attrs.name;\n const fieldLabel =\n fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;\n const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;\n\n const rawValue = formik.values[fieldName];\n const format = fieldLayoutInfo.attrs?.format as string | undefined;\n\n return (\n <div className={styles.fieldViewWrapper}>\n {showFieldLabel !== false && (\n <p className={`${styles.fieldViewLabel} form-field-label`}>\n {fieldLabel}\n </p>\n )}\n <p className={styles.fieldViewValue}>\n <DateFieldViewComponent value={rawValue} format={format} showTime={true} fallback=\"-\"></DateFieldViewComponent>\n </p>\n </div>\n );\n};\n"]}
|