@gen-epix/ui-client-common 4.3.1 → 4.4.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 +9 -10
- package/dist/@types/mui.d.ts +1 -1
- package/dist/_chunks/ApplicationFooter.js +49 -49
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +23 -22
- package/dist/_chunks/Breadcrumbs.js.map +1 -1
- package/dist/_chunks/CrudPage.js +211 -210
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js.map +1 -1
- package/dist/_chunks/Notifications.js +67 -66
- package/dist/_chunks/Notifications.js.map +1 -1
- package/dist/_chunks/OutageList.js +30 -30
- package/dist/_chunks/OutageList.js.map +1 -1
- package/dist/_chunks/OutageUtil.js +2 -2
- package/dist/_chunks/OutageUtil.js.map +1 -1
- package/dist/_chunks/QueryClientProvider.js +1 -1
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +406 -117
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Reflect.js +642 -0
- package/dist/_chunks/Reflect.js.map +1 -0
- package/dist/_chunks/Table.js +572 -574
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +5 -5
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +1 -1
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +109 -107
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/UserManagerUtil.js +7 -15
- package/dist/_chunks/UserManagerUtil.js.map +1 -1
- package/dist/_chunks/_baseAssignValue.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +8 -8
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseUnset.js +299 -22
- package/dist/_chunks/_baseUnset.js.map +1 -1
- package/dist/_chunks/_cacheHas.js.map +1 -1
- package/dist/_chunks/_setToString.js.map +1 -1
- package/dist/_chunks/decorate.js +9 -0
- package/dist/_chunks/decorateParam.js +8 -0
- package/dist/_chunks/format.js.map +1 -1
- package/dist/_chunks/isArrayLike.js.map +1 -1
- package/dist/_chunks/isObject.js.map +1 -1
- package/dist/_chunks/isSymbol.js.map +1 -1
- package/dist/_chunks/middleware.js +1 -1
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/omit.js +39 -40
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/query.js +13 -17
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/tableStore.js +40 -54
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/toDate.js.map +1 -1
- package/dist/_chunks/useColumnsMenu.js +2 -2
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +31 -30
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +5 -5
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -2
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/TableEventBus/TableEventBus.d.ts +1 -1
- package/dist/classes/TableEventBus/index.js.map +1 -1
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/containers/UiClientCommonContainer/UiClientCommonContainer.d.ts +5 -0
- package/dist/classes/containers/UiClientCommonContainer/index.d.ts +1 -0
- package/dist/classes/containers/UiClientCommonContainer/index.js +17 -0
- package/dist/classes/containers/UiClientCommonContainer/index.js.map +1 -0
- package/dist/classes/filters/BooleanFilter.d.ts +1 -1
- package/dist/classes/filters/DateFilter.d.ts +2 -2
- package/dist/classes/filters/GeoFilter.d.ts +2 -2
- package/dist/classes/filters/MultiSelectFilter.d.ts +2 -2
- package/dist/classes/filters/NumberRangeFilter.d.ts +1 -1
- package/dist/classes/filters/TextFilter.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +5 -3
- package/dist/classes/services/AuthenticationService/index.js +34 -661
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/AuthorizationService.d.ts +4 -4
- package/dist/classes/services/AuthorizationService/index.js +12 -10
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BackendVersionService/BackendVersionService.d.ts +0 -3
- package/dist/classes/services/BackendVersionService/index.js +5 -8
- package/dist/classes/services/BackendVersionService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/BreadcrumbService.d.ts +1 -3
- package/dist/classes/services/BreadcrumbService/index.js +19 -21
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/EmotionCacheService.d.ts +4 -4
- package/dist/classes/services/EmotionCacheService/index.js +17 -14
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/FeatureFlagsService/FeatureFlagsService.d.ts +0 -3
- package/dist/classes/services/FeatureFlagsService/index.js +5 -8
- package/dist/classes/services/FeatureFlagsService/index.js.map +1 -1
- package/dist/classes/services/I18nService/I18nService.d.ts +3 -3
- package/dist/classes/services/I18nService/index.js +25 -29
- package/dist/classes/services/I18nService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/InactivityService.d.ts +6 -3
- package/dist/classes/services/InactivityService/index.js +42 -36
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/LogService.d.ts +7 -4
- package/dist/classes/services/LogService/index.js +39 -32
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/NavigationHistoryService/NavigationHistoryService.d.ts +0 -3
- package/dist/classes/services/NavigationHistoryService/index.js +5 -8
- package/dist/classes/services/NavigationHistoryService/index.js.map +1 -1
- package/dist/classes/services/NotificationService/NotificationService.d.ts +4 -4
- package/dist/classes/services/NotificationService/index.js +21 -21
- package/dist/classes/services/NotificationService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/PageEventBusService.d.ts +4 -3
- package/dist/classes/services/PageEventBusService/index.js +18 -15
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/classes/services/QueryClientService/QueryClientService.d.ts +6 -7
- package/dist/classes/services/QueryClientService/index.js +1 -2
- package/dist/classes/services/RouterService/RouterService.d.ts +6 -9
- package/dist/classes/services/RouterService/index.js +8 -12
- package/dist/classes/services/RouterService/index.js.map +1 -1
- package/dist/classes/services/UserSettingsService/UserSettingsService.d.ts +0 -3
- package/dist/classes/services/UserSettingsService/index.js +5 -8
- package/dist/classes/services/UserSettingsService/index.js.map +1 -1
- package/dist/components/app/App/App.d.ts +5 -1
- package/dist/components/app/App/index.js +31 -37
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/AppRouterProvider/AppRouterProvider.d.ts +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +50 -49
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +42 -41
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/AuthenticationWrapper.d.ts +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +68 -67
- package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
- package/dist/components/app/AuthorizationWrapper/index.js +33 -32
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/RouterRoot.d.ts +1 -1
- package/dist/components/app/RouterRoot/index.js +62 -61
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +38 -37
- package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
- package/dist/components/filters/BooleanFilterField/BooleanFilterField.d.ts +1 -1
- package/dist/components/filters/BooleanFilterField/index.js +5 -5
- package/dist/components/filters/BooleanFilterField/index.js.map +1 -1
- package/dist/components/filters/DateFilterField/DateFilterField.d.ts +1 -1
- package/dist/components/filters/DateFilterField/index.js +3 -3
- package/dist/components/filters/DateFilterField/index.js.map +1 -1
- package/dist/components/filters/GeoFilterField/GeoFilterField.d.ts +1 -1
- package/dist/components/filters/GeoFilterField/index.js +4 -4
- package/dist/components/filters/GeoFilterField/index.js.map +1 -1
- package/dist/components/filters/MultiSelectFilterField/MultiSelectFilterField.d.ts +1 -1
- package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
- package/dist/components/filters/MultiSelectFilterField/index.js.map +1 -1
- package/dist/components/filters/NumberRangeFilterField/NumberRangeFilterField.d.ts +1 -1
- package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
- package/dist/components/filters/NumberRangeFilterField/index.js.map +1 -1
- package/dist/components/filters/TextFilterField/TextFilterField.d.ts +1 -1
- package/dist/components/filters/TextFilterField/index.js +3 -3
- package/dist/components/filters/TextFilterField/index.js.map +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBar.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActions.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActionsFeedbackItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActionsInfotem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActionsNotificationsItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActionsOrganizationSwitcherItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActionsOutagesItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarActionsUserItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/ApplicationBarNavigationMenu.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/UserOrganizationAdminMenuItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/UserOwnOrganizationMenuItem.d.ts +1 -1
- package/dist/components/ui/ApplicationBar/index.js +242 -241
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/ApplicationFooter/ApplicationFooter.d.ts +1 -1
- package/dist/components/ui/ApplicationFooter/ApplicationFooterLink.d.ts +1 -1
- package/dist/components/ui/ApplicationFooter/ApplicationFooterLinkSection.d.ts +1 -1
- package/dist/components/ui/ApplicationFooter/index.js +1 -2
- package/dist/components/ui/Breadcrumbs/Breadcrumb.d.ts +1 -1
- package/dist/components/ui/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/ui/Breadcrumbs/index.js +1 -2
- package/dist/components/ui/ConsentDialog/index.js +11 -6
- package/dist/components/ui/ConsentDialog/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/GenericErrorMessage.d.ts +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +51 -50
- package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
- package/dist/components/ui/LicensesDialog/index.js +66 -69
- package/dist/components/ui/LicensesDialog/index.js.map +1 -1
- package/dist/components/ui/MyPermissionsDialog/index.js +26 -25
- package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
- package/dist/components/ui/NavLink/NavLink.d.ts +1 -1
- package/dist/components/ui/NavLink/index.js +6 -6
- package/dist/components/ui/NavLink/index.js.map +1 -1
- package/dist/components/ui/Notifications/NotificationItem.d.ts +2 -2
- package/dist/components/ui/Notifications/NotificationsDrawer.d.ts +1 -1
- package/dist/components/ui/Notifications/index.js +1 -2
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +69 -76
- package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
- package/dist/components/ui/OutageList/OutageItem.d.ts +1 -1
- package/dist/components/ui/OutageList/OutageList.d.ts +1 -1
- package/dist/components/ui/OutageList/OutageSection.d.ts +1 -1
- package/dist/components/ui/OutageList/index.js +1 -2
- package/dist/components/ui/OutagesDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/PageContainer.d.ts +1 -1
- package/dist/components/ui/PageContainer/index.js +57 -52
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/ResponseHandler/ResponseHandler.d.ts +1 -1
- package/dist/components/ui/ResponseHandler/index.js.map +1 -1
- package/dist/components/ui/Sidebar/SidebarItem.d.ts +2 -2
- package/dist/components/ui/Sidebar/SidebarMenu.d.ts +1 -1
- package/dist/components/ui/Sidebar/SidebarMenuItem.d.ts +2 -2
- package/dist/components/ui/Sidebar/index.js +45 -45
- package/dist/components/ui/Sidebar/index.js.map +1 -1
- package/dist/components/ui/SortableList/SortableList.d.ts +1 -1
- package/dist/components/ui/SortableList/SortableListItem.d.ts +1 -1
- package/dist/components/ui/SortableList/SortableListItemDragHandle.d.ts +1 -1
- package/dist/components/ui/SortableList/SortableOverlay.d.ts +1 -1
- package/dist/components/ui/SortableList/context/SortableListItemContextProvider.d.ts +1 -1
- package/dist/components/ui/Table/Table.d.ts +2 -2
- package/dist/components/ui/Table/TableActionsCell.d.ts +2 -2
- package/dist/components/ui/Table/TableCaption.d.ts +1 -1
- package/dist/components/ui/Table/TableCell.d.ts +2 -2
- package/dist/components/ui/Table/TableCellAsyncContent.d.ts +1 -1
- package/dist/components/ui/Table/TableCheckboxCell.d.ts +2 -2
- package/dist/components/ui/Table/TableCheckboxHeader.d.ts +2 -2
- package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +1 -1
- package/dist/components/ui/Table/TableFilter.d.ts +3 -3
- package/dist/components/ui/Table/TableFiltersSidebarItem.d.ts +2 -2
- package/dist/components/ui/Table/TableHeader.d.ts +1 -1
- package/dist/components/ui/Table/TableHeaderCell.d.ts +2 -2
- package/dist/components/ui/Table/TableHeaderFilter.d.ts +3 -3
- package/dist/components/ui/Table/TableMenu.d.ts +1 -1
- package/dist/components/ui/Table/TableReadableIndexCell.d.ts +2 -2
- package/dist/components/ui/Table/TableSidebarMenu.d.ts +1 -1
- package/dist/components/ui/Table/index.js +1 -2
- package/dist/components/ui/UserFeedbackDialog/index.js +65 -64
- package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
- package/dist/components/ui/UserInactivityConfirmation/UserInactivityConfirmation.d.ts +1 -1
- package/dist/components/ui/UserInactivityConfirmation/index.js +26 -25
- package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
- package/dist/constants/config.constants.d.ts +5 -0
- package/dist/constants/config.constants.js +6 -0
- package/dist/constants/config.constants.js.map +1 -0
- package/dist/constants/{query.js → query.constants.js} +2 -2
- package/dist/constants/query.constants.js.map +1 -0
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +6 -2
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +3 -3
- package/dist/context/uiClientCommonConfigContext/index.js +28 -12
- package/dist/context/uiClientCommonConfigContext/index.js.map +1 -1
- package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +2 -1
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +17 -16
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/useIdentifierIssuerOwnOrganizationQuery.d.ts +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +18 -17
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/useIdentifierIssuerQuery.d.ts +1 -1
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +11 -10
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +22 -21
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/useOrganizationAdminPoliciesQuery.d.ts +1 -1
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +8 -7
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationsQuery/index.js +17 -16
- package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationsQuery/useOrganizationsQuery.d.ts +1 -1
- package/dist/dataHooks/useUsersQuery/index.js +18 -17
- package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
- package/dist/dataHooks/useUsersQuery/useUsersQuery.d.ts +1 -1
- package/dist/hoc/withPermissions/index.js +12 -11
- package/dist/hoc/withPermissions/index.js.map +1 -1
- package/dist/hoc/withPermissions/withPermissions.d.ts +1 -1
- package/dist/hooks/useColumnsMenu/index.js +1 -2
- package/dist/hooks/useColumnsMenu/useColumnsMenu.d.ts +2 -2
- package/dist/hooks/useConfig/index.d.ts +1 -0
- package/dist/hooks/useConfig/index.js +7 -0
- package/dist/hooks/useConfig/index.js.map +1 -0
- package/dist/hooks/useConfig/useConfig.d.ts +2 -0
- package/dist/hooks/useCreateMutation/index.js +25 -24
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useCreateMutation/useCreateMutation.d.ts +1 -1
- package/dist/hooks/useDeleteMutation/index.js +24 -23
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/useDeleteMutation.d.ts +1 -1
- package/dist/hooks/useEditMutation/index.js +33 -32
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/useEditMutation.d.ts +1 -1
- package/dist/hooks/useInitializeTableStore/index.js.map +1 -1
- package/dist/hooks/useInitializeTableStore/useInitializeTableStore.d.ts +1 -1
- package/dist/hooks/useItemQuery/index.js +36 -35
- package/dist/hooks/useItemQuery/index.js.map +1 -1
- package/dist/hooks/useItemQuery/useItemQuery.d.ts +1 -1
- package/dist/hooks/useQueryMemo/index.js +1 -2
- package/dist/hooks/useUpdateBreadcrumb/index.js +10 -9
- package/dist/hooks/useUpdateBreadcrumb/index.js.map +1 -1
- package/dist/hooks/useUpdateDocumentTitle/index.js +4 -3
- package/dist/hooks/useUpdateDocumentTitle/index.js.map +1 -1
- package/dist/models/{admin.js → admin.models.js} +2 -2
- package/dist/models/admin.models.js.map +1 -0
- package/dist/models/api.models.d.ts +16 -0
- package/dist/models/api.models.js +6 -0
- package/dist/models/api.models.js.map +1 -0
- package/dist/models/{dataHooks.d.ts → data-hooks.models.d.ts} +1 -1
- package/dist/models/{table.d.ts → table.models.d.ts} +2 -2
- package/dist/models/{table.js → table.models.js} +2 -2
- package/dist/models/table.models.js.map +1 -0
- package/dist/pages/AcceptInvitationPage/AcceptInvitationPage.d.ts +1 -1
- package/dist/pages/AcceptInvitationPage/index.js +40 -39
- package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
- package/dist/pages/AdminPage/AdminPage.d.ts +1 -1
- package/dist/pages/AdminPage/index.js +39 -38
- package/dist/pages/AdminPage/index.js.map +1 -1
- package/dist/pages/ChooseIdentityProviderPage/ChooseIdentityProviderPage.d.ts +2 -2
- package/dist/pages/ChooseIdentityProviderPage/index.js +38 -37
- package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
- package/dist/pages/CrudPage/CrudPage.d.ts +7 -7
- package/dist/pages/CrudPage/CrudPageDeleteDialog.d.ts +1 -1
- package/dist/pages/CrudPage/CrudPageEditDialog.d.ts +2 -2
- package/dist/pages/CrudPage/index.js +1 -2
- package/dist/pages/ErrorPage/ErrorPage.d.ts +1 -1
- package/dist/pages/ErrorPage/index.js.map +1 -1
- package/dist/pages/IdentifierIssuersAdminPage/IdentifierIssuersAdminPage.d.ts +1 -1
- package/dist/pages/IdentifierIssuersAdminPage/index.js +41 -40
- package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/OrganizationAdminPoliciesAdminPage.d.ts +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +58 -57
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationContactsAdminPage/OrganizationContactsAdminPage.d.ts +1 -1
- package/dist/pages/OrganizationContactsAdminPage/index.js +49 -48
- package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationSitesAdminPage/OrganizationSitesAdminPage.d.ts +1 -1
- package/dist/pages/OrganizationSitesAdminPage/index.js +44 -43
- package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationsAdminPage/OrganizationsAdminPage.d.ts +1 -1
- package/dist/pages/OrganizationsAdminPage/index.js +57 -56
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/OutagesAdminPage.d.ts +1 -1
- package/dist/pages/OutagesAdminPage/index.js +63 -62
- package/dist/pages/OutagesAdminPage/index.js.map +1 -1
- package/dist/pages/PostLoginPage/PostLoginPage.d.ts +1 -1
- package/dist/pages/PostLoginPage/index.js +14 -13
- package/dist/pages/PostLoginPage/index.js.map +1 -1
- package/dist/pages/PostLogoutPage/PostLogoutPage.d.ts +1 -1
- package/dist/pages/PostLogoutPage/index.js +19 -18
- package/dist/pages/PostLogoutPage/index.js.map +1 -1
- package/dist/pages/RouterErrorPage/RouterErrorPage.d.ts +1 -1
- package/dist/pages/RouterErrorPage/index.js.map +1 -1
- package/dist/pages/UserInvitationsAdminPage/UserInvitationsAdminPage.d.ts +1 -1
- package/dist/pages/UserInvitationsAdminPage/index.js +1 -2
- package/dist/pages/UsersAdminPage/UsersAdminPage.d.ts +2 -2
- package/dist/pages/UsersAdminPage/index.js +110 -109
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/routes/adminRoutes.d.ts +1 -1
- package/dist/routes/index.js +1 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/routes.d.ts +1 -1
- package/dist/setup/setup.js.map +1 -1
- package/dist/stores/oidcStore/index.js.map +1 -1
- package/dist/stores/outagesStore/index.js.map +1 -1
- package/dist/stores/outagesStore/outagesStore.d.ts +1 -1
- package/dist/stores/tableStore/TableStoreContextProvider.d.ts +1 -1
- package/dist/stores/tableStore/index.js +1 -2
- package/dist/stores/tableStore/tableStore.d.ts +2 -2
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/AxiosUtil/index.js.map +1 -1
- package/dist/utils/DataHookUtil/DataHookUtil.d.ts +1 -1
- package/dist/utils/DataHookUtil/index.js.map +1 -1
- package/dist/utils/LoadableUtil/LoadableUtil.d.ts +1 -1
- package/dist/utils/LoadableUtil/index.js.map +1 -1
- package/dist/utils/MenuDataUtil/MenuDataUtil.d.ts +1 -1
- package/dist/utils/MenuDataUtil/index.js.map +1 -1
- package/dist/utils/NotificationUtil/index.js.map +1 -1
- package/dist/utils/OutageUtil/OutageUtil.d.ts +1 -1
- package/dist/utils/OutageUtil/index.js +1 -2
- package/dist/utils/StandardConfigUtil/StandardConfigUtil.d.ts +1 -1
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TableUtil/TableUtil.d.ts +4 -4
- package/dist/utils/TableUtil/index.js +1 -2
- package/dist/utils/TimeUtil/index.js.map +1 -1
- package/dist/utils/UserManagerUtil/index.js +1 -2
- package/dist/utils/UserUtil/index.js.map +1 -1
- package/package.json +93 -87
- package/dist/_chunks/_baseGet.js +0 -280
- package/dist/_chunks/_baseGet.js.map +0 -1
- package/dist/_chunks/_baseIteratee.js +0 -274
- package/dist/_chunks/_baseIteratee.js.map +0 -1
- package/dist/_chunks/last.js +0 -13
- package/dist/_chunks/last.js.map +0 -1
- package/dist/_chunks/uniq.js +0 -44
- package/dist/_chunks/uniq.js.map +0 -1
- package/dist/classes/services/ApiService/ApiService.d.ts +0 -19
- package/dist/classes/services/ApiService/index.d.ts +0 -1
- package/dist/classes/services/ApiService/index.js +0 -21
- package/dist/classes/services/ApiService/index.js.map +0 -1
- package/dist/classes/services/ConfigService/ConfigService.d.ts +0 -9
- package/dist/classes/services/ConfigService/index.d.ts +0 -1
- package/dist/classes/services/ConfigService/index.js +0 -21
- package/dist/classes/services/ConfigService/index.js.map +0 -1
- package/dist/constants/query.js.map +0 -1
- package/dist/models/admin.js.map +0 -1
- package/dist/models/api.d.ts +0 -9
- package/dist/models/table.js.map +0 -1
- package/dist/models/theme.js +0 -0
- /package/dist/constants/{query.d.ts → query.constants.d.ts} +0 -0
- /package/dist/models/{admin.d.ts → admin.models.d.ts} +0 -0
- /package/dist/models/{auth.d.ts → auth.models.d.ts} +0 -0
- /package/dist/models/{api.js → auth.models.js} +0 -0
- /package/dist/models/{config.d.ts → config.models.d.ts} +0 -0
- /package/dist/models/{auth.js → config.models.js} +0 -0
- /package/dist/models/{config.js → data-hooks.models.js} +0 -0
- /package/dist/models/{data.d.ts → data.models.d.ts} +0 -0
- /package/dist/models/{data.js → data.models.js} +0 -0
- /package/dist/models/{filter.d.ts → filter.models.d.ts} +0 -0
- /package/dist/models/{dataHooks.js → filter.models.js} +0 -0
- /package/dist/models/{notification.d.ts → notification.models.d.ts} +0 -0
- /package/dist/models/{filter.js → notification.models.js} +0 -0
- /package/dist/models/{outage.d.ts → outage.models.d.ts} +0 -0
- /package/dist/models/{notification.js → outage.models.js} +0 -0
- /package/dist/models/{reactRouter.d.ts → react-router.models.d.ts} +0 -0
- /package/dist/models/{outage.js → react-router.models.js} +0 -0
- /package/dist/models/{theme.d.ts → theme.models.d.ts} +0 -0
- /package/dist/models/{reactRouter.js → theme.models.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/dataHooks/useUsersQuery/useUsersQuery.ts"],"sourcesContent":["import type { UseQueryResult } from '@tanstack/react-query';\nimport { useTranslation } from 'react-i18next';\nimport { useMemo } from 'react';\nimport type { CommonDbUser } from '@gen-epix/api-commondb';\n\nimport type {\n UseMap,\n UseOptions,\n} from '../../models/
|
|
1
|
+
{"version":3,"file":"index.js","names":["rootContainer","useQueryMemo","useUsersQuery","container","API_ORGANIZATION_TOKEN","QueryClientService","COMMON_QUERY_KEY","useUsersMapQuery","usersQuery","useMemo","DataHookUtil","item","useUserOptionsQuery","useTranslation","UserUtil","t"],"sources":["../../../src/dataHooks/useUsersQuery/useUsersQuery.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useTranslation } from 'react-i18next';\nimport { useMemo } from 'react';\nimport type { CommonDbUser } from '@gen-epix/api-commondb';\n\nimport { API_ORGANIZATION_TOKEN } from '../../models/api.models';\nimport type {\n UseMap,\n UseOptions,\n} from '../../models/data-hooks.models';\nimport { DataHookUtil } from '../../utils/DataHookUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { UserUtil } from '../../utils/UserUtil';\n\nexport const useUsersQuery = (): UseQueryResult<CommonDbUser[]> => {\n return useQueryMemo({\n queryFn: async ({ signal }) => {\n const response = await rootContainer.resolve(API_ORGANIZATION_TOKEN).usersGetAll(null, null, { signal });\n return response.data;\n },\n queryKey: rootContainer.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.USERS),\n });\n};\n\nexport const useUsersMapQuery = (): UseMap<CommonDbUser> => {\n const usersQuery = useUsersQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseMapDataHook<CommonDbUser>(usersQuery, item => item.id);\n }, [usersQuery]);\n};\n\nexport const useUserOptionsQuery = (): UseOptions<string> => {\n const usersQuery = useUsersQuery();\n const { t } = useTranslation();\n\n return useMemo(() => {\n return DataHookUtil.createUseOptionsDataHook<CommonDbUser>(usersQuery, item => item.id, item => UserUtil.getUserDisplayValue(item, t));\n }, [t, usersQuery]);\n};\n"],"mappings":";;;;;;;;;;AAiBA,IAAaE,UACJD,EAAa;CAClB,SAAS,OAAO,EAAE,iBAET,MADgBD,EAAc,QAAQI,CAAsB,CAAC,CAAC,YAAY,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,CACvF;CAElB,UAAUJ,EAAc,QAAQK,CAAkB,CAAC,CAAC,cAAcC,EAAiB,KAAK;AAC1F,CAAC,GAGUC,UAA+C;CAC1D,IAAMC,IAAaN,EAAc;CAEjC,OAAOO,QACEC,EAAa,qBAAmCF,IAAY,MAAQG,EAAK,EAAE,GACjF,CAACH,CAAU,CAAC;AACjB,GAEaI,UAAgD;CAC3D,IAAMJ,IAAaN,EAAc,GAC3B,EAAE,SAAMW,EAAe;CAE7B,OAAOJ,QACEC,EAAa,yBAAuCF,IAAY,MAAQG,EAAK,KAAI,MAAQG,EAAS,oBAAoBH,GAAMI,CAAC,CAAC,GACpI,CAACA,GAAGP,CAAU,CAAC;AACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { CommonDbUser } from '@gen-epix/api-commondb';
|
|
3
|
-
import { UseMap, UseOptions } from '../../models/
|
|
3
|
+
import { UseMap, UseOptions } from '../../models/data-hooks.models';
|
|
4
4
|
export declare const useUsersQuery: () => UseQueryResult<CommonDbUser[]>;
|
|
5
5
|
export declare const useUsersMapQuery: () => UseMap<CommonDbUser>;
|
|
6
6
|
export declare const useUserOptionsQuery: () => UseOptions<string>;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { AuthorizationService as e } from "../../classes/services/AuthorizationService/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { container as t } from "tsyringe";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
5
|
//#region src/hoc/withPermissions/withPermissions.tsx
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
if (!
|
|
8
|
-
if (
|
|
9
|
-
let e =
|
|
10
|
-
return /* @__PURE__ */
|
|
6
|
+
var i = (i, a) => {
|
|
7
|
+
let o = (o) => {
|
|
8
|
+
if (!n(() => t.resolve(e), []).doesUserHavePermission(a.requiredPermissions)) {
|
|
9
|
+
if (a.fallback) {
|
|
10
|
+
let e = a.fallback;
|
|
11
|
+
return /* @__PURE__ */ r(e, {});
|
|
11
12
|
}
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ r(i, { ...o });
|
|
15
16
|
};
|
|
16
|
-
return
|
|
17
|
+
return o.displayName = `withPermissions(${i.displayName || i.name})`, o;
|
|
17
18
|
};
|
|
18
19
|
//#endregion
|
|
19
|
-
export {
|
|
20
|
+
export { i as withPermissions };
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hoc/withPermissions/withPermissions.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport type { ComponentType } from 'react';\nimport type { CommonDbApiPermission } from '@gen-epix/api-commondb';\n\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\n\nexport interface WithPermissionsOptions<TApiPermission = CommonDbApiPermission> {\n readonly fallback?: ComponentType | null;\n readonly requiredPermissions: TApiPermission[];\n}\n\nexport const withPermissions = <TApiPermission = CommonDbApiPermission, TProps extends object = Record<string, never>>(\n Component: ComponentType<TProps>,\n options: WithPermissionsOptions<TApiPermission>,\n) => {\n const WrappedComponent = (props: TProps) => {\n const authorizationService = useMemo(() =>
|
|
1
|
+
{"version":3,"file":"index.js","names":["rootContainer","withPermissions","WrappedComponent","useMemo","container","AuthorizationService","options","FallbackComponent","Component","props"],"sources":["../../../src/hoc/withPermissions/withPermissions.tsx"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMemo } from 'react';\nimport type { ComponentType } from 'react';\nimport type { CommonDbApiPermission } from '@gen-epix/api-commondb';\n\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\n\nexport interface WithPermissionsOptions<TApiPermission = CommonDbApiPermission> {\n readonly fallback?: ComponentType | null;\n readonly requiredPermissions: TApiPermission[];\n}\n\nexport const withPermissions = <TApiPermission = CommonDbApiPermission, TProps extends object = Record<string, never>>(\n Component: ComponentType<TProps>,\n options: WithPermissionsOptions<TApiPermission>,\n) => {\n const WrappedComponent = (props: TProps) => {\n const authorizationService = useMemo(() => rootContainer.resolve(AuthorizationService), []);\n\n if (!authorizationService.doesUserHavePermission(options.requiredPermissions as CommonDbApiPermission[])) {\n if (options.fallback) {\n const FallbackComponent = options.fallback;\n return <FallbackComponent />;\n }\n return null;\n }\n\n return <Component {...props} />;\n };\n\n // Set display name for better debugging\n WrappedComponent.displayName = `withPermissions(${Component.displayName || Component.name})`;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;AAYA,IAAaC,KACX,GACA,MACG;CACH,IAAMC,KAAoB,MAAkB;EAG1C,IAAI,CAFyBC,QAAcH,EAAc,QAAQK,CAAoB,GAAG,CAAC,CAEpF,CAAA,CAAqB,uBAAuBC,EAAQ,mBAA8C,GAAG;GACxG,IAAIA,EAAQ,UAAU;IACpB,IAAMC,IAAoBD,EAAQ;IAClC,OAAO,kBAACC,GAAD,CAAoB,CAAA;GAC7B;GACA,OAAO;EACT;EAEA,OAAO,kBAACC,GAAD,EAAW,GAAIC,EAAQ,CAAA;CAChC;CAKA,OAFA,EAAiB,cAAc,mBAAmBD,EAAU,eAAeA,EAAU,KAAK,IAEnFN;AACT"}
|
|
@@ -5,6 +5,6 @@ export interface WithPermissionsOptions<TApiPermission = CommonDbApiPermission>
|
|
|
5
5
|
readonly requiredPermissions: TApiPermission[];
|
|
6
6
|
}
|
|
7
7
|
export declare const withPermissions: <TApiPermission = CommonDbApiPermission, TProps extends object = Record<string, never>>(Component: ComponentType<TProps>, options: WithPermissionsOptions<TApiPermission>) => {
|
|
8
|
-
(props: TProps): import(
|
|
8
|
+
(props: TProps): import('react').JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as useColumnsMenu };
|
|
1
|
+
export { t as useColumnsMenu } from "../../_chunks/useColumnsMenu.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MenuItemData } from '@gen-epix/ui-core-components/models/
|
|
2
|
-
import { HasCellDataFn } from '../../models/table';
|
|
1
|
+
import { MenuItemData } from '@gen-epix/ui-core-components/models/nested-menu.models';
|
|
2
|
+
import { HasCellDataFn } from '../../models/table.models';
|
|
3
3
|
export type UseColumnsMenuProps<TRowData, TDataContext = null> = {
|
|
4
4
|
readonly hasCellData?: HasCellDataFn<TRowData, TDataContext>;
|
|
5
5
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["useConfig","useUiClientCommonConfigContext"],"sources":["../../../src/hooks/useConfig/useConfig.ts"],"sourcesContent":["import type { ConfigBase } from '../../models/config.models';\nimport { useUiClientCommonConfigContext } from '../../context/uiClientCommonConfigContext';\n\nexport const useConfig = <TConfig extends ConfigBase = ConfigBase>(): TConfig => {\n return useUiClientCommonConfigContext<TConfig>().config;\n};\n"],"mappings":";;AAGA,IAAaA,UACJC,EAAwC,CAAC,CAAC"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import {
|
|
1
|
+
import { t as e } from "../../_chunks/QueryClientService.js";
|
|
2
|
+
import { t } from "../../_chunks/useMutation.js";
|
|
3
|
+
import { NotificationUtil as n } from "../../utils/NotificationUtil/index.js";
|
|
4
4
|
import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
|
|
5
5
|
import { StringUtil as i } from "@gen-epix/ui-core/utils/StringUtil";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { container as a } from "tsyringe";
|
|
7
|
+
import { useMemo as o } from "react";
|
|
8
|
+
import { ObjectUtil as s } from "@gen-epix/ui-core/utils/ObjectUtil";
|
|
8
9
|
//#region src/hooks/useCreateMutation/useCreateMutation.ts
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
mutationFn: async (e) =>
|
|
12
|
-
onError: async (
|
|
13
|
-
|
|
10
|
+
var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressNotificationMessage: u, getSuccessNotificationMessage: d, onError: f, onSuccess: p, queryFn: m, resourceQueryKey: h }) => {
|
|
11
|
+
let g = a.resolve(e).queryClient, _ = t({
|
|
12
|
+
mutationFn: async (e) => m(s.deepNullifyEmptyStrings(e)),
|
|
13
|
+
onError: async (t, i, o) => {
|
|
14
|
+
h && g.setQueryData(h, (e) => Array.isArray(e) ? [...e.filter((e) => e?.id !== o.temporaryId)] : e), await a.resolve(e).invalidateQueryKeys(c), f && await f(t, i, o), a.resolve(r).fulfillNotification(o.notificationKey, n.wrapErrorNotificationMessage(l(i, t), t), "error");
|
|
14
15
|
},
|
|
15
16
|
onMutate: async (e) => {
|
|
16
|
-
let t =
|
|
17
|
+
let t = a.resolve(r).showNotification({
|
|
17
18
|
isLoading: !0,
|
|
18
|
-
message:
|
|
19
|
+
message: u(e),
|
|
19
20
|
severity: "info"
|
|
20
21
|
});
|
|
21
|
-
if (
|
|
22
|
-
await
|
|
23
|
-
let n =
|
|
22
|
+
if (h) {
|
|
23
|
+
await g.cancelQueries({ queryKey: h });
|
|
24
|
+
let n = g.getQueryData(h);
|
|
24
25
|
if (Array.isArray(n)) {
|
|
25
26
|
let r = i.createUuid();
|
|
26
|
-
return
|
|
27
|
+
return g.setQueryData(h, (t) => [{
|
|
27
28
|
...e,
|
|
28
29
|
id: r
|
|
29
30
|
}, ...t]), {
|
|
@@ -35,16 +36,16 @@ var s = ({ associationQueryKeys: s, getErrorNotificationMessage: c, getProgressN
|
|
|
35
36
|
}
|
|
36
37
|
return { notificationKey: t };
|
|
37
38
|
},
|
|
38
|
-
onSuccess: async (
|
|
39
|
-
|
|
39
|
+
onSuccess: async (t, n, i) => {
|
|
40
|
+
h && Array.isArray(i?.previousData) && !Array.isArray(t) && g.setQueryData(h, (e) => [t, ...e.filter((e) => e.id !== i.temporaryId)]), await a.resolve(e).invalidateQueryKeys(c), p && await p(t, n, i), a.resolve(r).fulfillNotification(i.notificationKey, d(t, i), "success");
|
|
40
41
|
}
|
|
41
|
-
}),
|
|
42
|
-
return
|
|
43
|
-
isMutating:
|
|
44
|
-
mutate:
|
|
45
|
-
}), [
|
|
42
|
+
}), v = o(() => _.mutate, [_.mutate]), y = o(() => _.isPending, [_.isPending]);
|
|
43
|
+
return o(() => ({
|
|
44
|
+
isMutating: y,
|
|
45
|
+
mutate: v
|
|
46
|
+
}), [y, v]);
|
|
46
47
|
};
|
|
47
48
|
//#endregion
|
|
48
|
-
export {
|
|
49
|
+
export { c as useCreateMutation };
|
|
49
50
|
|
|
50
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useCreateMutation/useCreateMutation.ts"],"sourcesContent":["import { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextCreate<TData> = { notificationKey?: string; previousData?: TData[]; temporaryId?: string };\n\nexport type UseCreateMutationProps<TData extends GenericData | GenericData[], TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TVariables, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextCreate<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly queryFn?: (item: TVariables) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useCreateMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseCreateMutationProps<TData, TVariables>) => {\n const queryClient =
|
|
1
|
+
{"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useCreateMutation","queryClient","container","createMutation","useMutation","queryFn","ObjectUtil","item","resourceQueryKey","oldItems","context","associationQueryKeys","onError","error","variables","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","temporaryId","StringUtil","x","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useCreateMutation/useCreateMutation.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextCreate<TData> = { notificationKey?: string; previousData?: TData[]; temporaryId?: string };\n\nexport type UseCreateMutationProps<TData extends GenericData | GenericData[], TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TVariables, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextCreate<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly queryFn?: (item: TVariables) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useCreateMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseCreateMutationProps<TData, TVariables>) => {\n const queryClient = rootContainer.resolve(QueryClientService).queryClient;\n\n const createMutation = useMutation<TData, Error, TVariables, MutationContextCreate<TData>>({\n mutationFn: async (item) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(item));\n },\n onError: async (error, variables, context) => {\n if (resourceQueryKey) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(item => (item as GenericData)?.id !== context.temporaryId)];\n });\n }\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = rootContainer.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData)) {\n const temporaryId = StringUtil.createUuid();\n queryClient.setQueryData<TData[]>(resourceQueryKey, (oldItems: TData[]) => {\n return [\n {\n ...variables,\n id: temporaryId,\n },\n ...oldItems,\n ] as TData[];\n });\n return { notificationKey, previousData, temporaryId };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n if (resourceQueryKey && Array.isArray(context?.previousData) && !Array.isArray(item)) {\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [\n item,\n ...oldItems.filter(x => x.id !== context.temporaryId),\n ];\n });\n }\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => createMutation.mutate, [createMutation.mutate]);\n const isMutating = useMemo(() => createMutation.isPending, [createMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate }), [isMutating, mutate]);\n};\n"],"mappings":";;;;;;;;;AA0BA,IAAaE,KAAoF,EAC/F,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BAC+C;CAC/C,IAAMC,IAAcH,EAAc,QAAQC,CAAkB,CAAC,CAAC,aAExDI,IAAiBC,EAAoE;EACzF,YAAY,OAAO,MACVC,EAAQC,EAAW,wBAAwBC,CAAI,CAAC;EAEzD,SAAS,OAAO,GAAO,GAAW,MAAY;GAa5C,AAZIC,KACFP,EAAY,aAAsBO,IAAmB,MAC9C,MAAM,QAAQC,CAAQ,IAGpB,CAAC,GAAGA,EAAS,QAAO,MAASF,GAAsB,OAAOG,EAAQ,WAAW,CAAC,IAF5ED,CAGV,GAEH,MAAMX,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBY,CAAoB,GACpFC,KACF,MAAMA,EAAQC,GAAOC,GAAWJ,CAAO,GAEzCR,EAAc,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBM,EAAiB,6BAA6BC,EAA4BH,GAAWD,CAAK,GAAGA,CAAK,GAAG,OAAO;EACtM;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMK,IAAkBpB,EAAc,QAAQiB,CAAmB,CAAC,CAAC,iBAAiB;IAClF,WAAW;IACX,SAASI,EAA+BL,CAAS;IACjD,UAAU;GACZ,CAAC;GACD,IAAIN,GAAkB;IACpB,MAAMP,EAAY,cAAc,EAAE,UAAUO,EAAiB,CAAC;IAC9D,IAAMY,IAAenB,EAAY,aAAsBO,CAAgB;IACvE,IAAI,MAAM,QAAQY,CAAY,GAAG;KAC/B,IAAMC,IAAcC,EAAW,WAAW;KAU1C,OATArB,EAAY,aAAsBO,IAAmB,MAC5C,CACL;MACE,GAAGM;MACH,IAAIO;KACN,GACA,GAAGZ,CACL,CACD,GACM;MAAE;MAAiB;MAAc;KAAY;IACtD;GACF;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAa7C,AAZID,KAAoB,MAAM,QAAQE,GAAS,YAAY,KAAK,CAAC,MAAM,QAAQH,CAAI,KACjFN,EAAY,aAA4BO,IAAmB,MAClD,CACLD,GACA,GAAGE,EAAS,QAAO,MAAKc,EAAE,OAAOb,EAAQ,WAAW,CACtD,CACD,GAEH,MAAMZ,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBY,CAAoB,GACpFa,KACF,MAAMA,EAAUjB,GAAMO,GAAWJ,CAAO,GAE1CR,EAAc,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBe,EAA8BlB,GAAMG,CAAO,GAAG,SAAS;EACjJ;CACF,CAAC,GAGKgB,IAASC,QAAcxB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEyB,IAAaD,QAAcxB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOwB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import {
|
|
1
|
+
import { t as e } from "../../_chunks/QueryClientService.js";
|
|
2
|
+
import { t } from "../../_chunks/useMutation.js";
|
|
3
|
+
import { NotificationUtil as n } from "../../utils/NotificationUtil/index.js";
|
|
4
4
|
import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { container as i } from "tsyringe";
|
|
6
|
+
import { useMemo as a } from "react";
|
|
6
7
|
//#region src/hooks/useDeleteMutation/useDeleteMutation.ts
|
|
7
|
-
var
|
|
8
|
-
let
|
|
9
|
-
mutationFn: async (e) =>
|
|
10
|
-
onError: async (
|
|
11
|
-
|
|
8
|
+
var o = ({ associationQueryKeys: o, getErrorNotificationMessage: s, getProgressNotificationMessage: c, getSuccessNotificationMessage: l, onError: u, onSuccess: d, queryFn: f, resourceQueryKey: p }) => {
|
|
9
|
+
let m = i.resolve(e).queryClient, h = t({
|
|
10
|
+
mutationFn: async (e) => f(e),
|
|
11
|
+
onError: async (t, a, c) => {
|
|
12
|
+
p && m.setQueryData(p, (e) => Array.isArray(e) ? [...e, a] : e), o && await i.resolve(e).invalidateQueryKeys(o), u && await u(t, a, c), i.resolve(r).fulfillNotification(c.notificationKey, n.wrapErrorNotificationMessage(s(a, t), t), "error");
|
|
12
13
|
},
|
|
13
14
|
onMutate: async (e) => {
|
|
14
|
-
let t =
|
|
15
|
+
let t = i.resolve(r).showNotification({
|
|
15
16
|
isLoading: !0,
|
|
16
|
-
message:
|
|
17
|
+
message: c(e),
|
|
17
18
|
severity: "info"
|
|
18
19
|
});
|
|
19
|
-
if (
|
|
20
|
-
await
|
|
21
|
-
let n =
|
|
22
|
-
if (Array.isArray(n) && !Array.isArray(e)) return
|
|
20
|
+
if (p) {
|
|
21
|
+
await m.cancelQueries({ queryKey: p });
|
|
22
|
+
let n = m.getQueryData(p);
|
|
23
|
+
if (Array.isArray(n) && !Array.isArray(e)) return m.setQueryData(p, (t) => t.filter((t) => t.id !== e.id)), {
|
|
23
24
|
notificationKey: t,
|
|
24
25
|
previousData: n
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
return { notificationKey: t };
|
|
28
29
|
},
|
|
29
|
-
onSuccess: async (
|
|
30
|
-
|
|
30
|
+
onSuccess: async (t, n, a) => {
|
|
31
|
+
o && await i.resolve(e).invalidateQueryKeys(o), d && await d(n, a), i.resolve(r).fulfillNotification(a.notificationKey, l(n, a), "success");
|
|
31
32
|
}
|
|
32
|
-
}),
|
|
33
|
-
return
|
|
34
|
-
isMutating:
|
|
35
|
-
mutate:
|
|
36
|
-
}), [
|
|
33
|
+
}), g = a(() => h.mutate, [h.mutate]), _ = a(() => h.isPending, [h.isPending]);
|
|
34
|
+
return a(() => ({
|
|
35
|
+
isMutating: _,
|
|
36
|
+
mutate: g
|
|
37
|
+
}), [_, g]);
|
|
37
38
|
};
|
|
38
39
|
//#endregion
|
|
39
|
-
export {
|
|
40
|
+
export { o as useDeleteMutation };
|
|
40
41
|
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useDeleteMutation/useDeleteMutation.ts"],"sourcesContent":["import { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextDelete<TData> = { notificationKey?: string; previousData?: TData[] };\n\nexport type UseDeleteMutationProps<TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage?: (data: TData, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TData) => ReactElement | string;\n readonly getSuccessNotificationMessage?: (data: TData, context: MutationContextDelete<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly queryFn?: (data: TData) => Promise<unknown>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useDeleteMutation = <TData extends GenericData | GenericData[]>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseDeleteMutationProps<TData>) => {\n const queryClient =
|
|
1
|
+
{"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useDeleteMutation","queryClient","container","deleteMutation","useMutation","queryFn","item","resourceQueryKey","oldItems","associationQueryKeys","onError","error","context","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","i","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useDeleteMutation/useDeleteMutation.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextDelete<TData> = { notificationKey?: string; previousData?: TData[] };\n\nexport type UseDeleteMutationProps<TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage?: (data: TData, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TData) => ReactElement | string;\n readonly getSuccessNotificationMessage?: (data: TData, context: MutationContextDelete<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly queryFn?: (data: TData) => Promise<unknown>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useDeleteMutation = <TData extends GenericData | GenericData[]>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseDeleteMutationProps<TData>) => {\n const queryClient = rootContainer.resolve(QueryClientService).queryClient;\n\n const deleteMutation = useMutation<unknown, Error, TData, MutationContextDelete<TData>>({\n mutationFn: async (item) => {\n return queryFn(item);\n },\n onError: async (error, item, context) => {\n if (resourceQueryKey) {\n queryClient.setQueryData(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems, item];\n });\n }\n if (associationQueryKeys) {\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onError) {\n await onError(error, item, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(item, error), error), 'error');\n },\n onMutate: async (item) => {\n const notificationKey = rootContainer.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(item),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n\n if (Array.isArray(previousData) && !Array.isArray(item)) {\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return oldItems.filter(i => i.id !== item.id);\n });\n return { notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (_data, item, context) => {\n if (associationQueryKeys) {\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onSuccess) {\n await onSuccess(item, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => deleteMutation.mutate, [deleteMutation.mutate]);\n const isMutating = useMemo(() => deleteMutation.isPending, [deleteMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate }), [isMutating, mutate]);\n};\n"],"mappings":";;;;;;;AAwBA,IAAaE,KAAgE,EAC3E,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BACmC;CACnC,IAAMC,IAAcH,EAAc,QAAQC,CAAkB,CAAC,CAAC,aAExDI,IAAiBC,EAAiE;EACtF,YAAY,OAAO,MACVC,EAAQC,CAAI;EAErB,SAAS,OAAO,GAAO,GAAM,MAAY;GAevC,AAdIC,KACFN,EAAY,aAAaM,IAAmB,MACrC,MAAM,QAAQC,CAAQ,IAGpB,CAAC,GAAGA,GAAUF,CAAI,IAFhBE,CAGV,GAECC,KACF,MAAMX,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBU,CAAoB,GAEtFC,KACF,MAAMA,EAAQC,GAAOL,GAAMM,CAAO,GAEpCV,EAAc,QAAQW,CAAmB,CAAC,CAAC,oBAAoBD,EAAQ,iBAAiBE,EAAiB,6BAA6BC,EAA4BT,GAAMK,CAAK,GAAGA,CAAK,GAAG,OAAO;EACjM;EACA,UAAU,OAAO,MAAS;GACxB,IAAMK,IAAkBlB,EAAc,QAAQe,CAAmB,CAAC,CAAC,iBAAiB;IAClF,WAAW;IACX,SAASI,EAA+BX,CAAI;IAC5C,UAAU;GACZ,CAAC;GACD,IAAIC,GAAkB;IACpB,MAAMN,EAAY,cAAc,EAAE,UAAUM,EAAiB,CAAC;IAC9D,IAAMW,IAAejB,EAAY,aAAsBM,CAAgB;IAEvE,IAAI,MAAM,QAAQW,CAAY,KAAK,CAAC,MAAM,QAAQZ,CAAI,GAIpD,OAHAL,EAAY,aAA4BM,IAAmB,MAClDC,EAAS,QAAO,MAAKW,EAAE,OAAOb,EAAK,EAAE,CAC7C,GACM;KAAE;KAAiB;IAAa;GAE3C;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAO,GAAM,MAAY;GAOzC,AANIG,KACF,MAAMX,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBU,CAAoB,GAEtFW,KACF,MAAMA,EAAUd,GAAMM,CAAO,GAE/BV,EAAc,QAAQW,CAAmB,CAAC,CAAC,oBAAoBD,EAAQ,iBAAiBS,EAA8Bf,GAAMM,CAAO,GAAG,SAAS;EACjJ;CACF,CAAC,GAGKU,IAASC,QAAcpB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEqB,IAAaD,QAAcpB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOoB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import {
|
|
1
|
+
import { t as e } from "../../_chunks/QueryClientService.js";
|
|
2
|
+
import { t } from "../../_chunks/useMutation.js";
|
|
3
|
+
import { NotificationUtil as n } from "../../utils/NotificationUtil/index.js";
|
|
4
4
|
import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { container as i } from "tsyringe";
|
|
6
|
+
import { useCallback as a, useMemo as o, useRef as s } from "react";
|
|
7
|
+
import { ObjectUtil as c } from "@gen-epix/ui-core/utils/ObjectUtil";
|
|
7
8
|
//#region src/hooks/useEditMutation/useEditMutation.ts
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
}, []),
|
|
12
|
-
mutationFn:
|
|
13
|
-
onError: async (
|
|
14
|
-
|
|
9
|
+
var l = ({ associationQueryKeys: l, getErrorNotificationMessage: u, getIntermediateItem: d, getProgressNotificationMessage: f, getSuccessNotificationMessage: p, onError: m, onSuccess: h, queryFn: g, resourceQueryKey: _ }) => {
|
|
10
|
+
let v = i.resolve(e).queryClient, y = s(void 0), b = a((e) => {
|
|
11
|
+
y.current = e;
|
|
12
|
+
}, []), x = a(async (e) => g(c.deepNullifyEmptyStrings(e), y.current), [y, g]), S = t({
|
|
13
|
+
mutationFn: x,
|
|
14
|
+
onError: async (t, a, o) => {
|
|
15
|
+
y.current = void 0, _ && Array.isArray(o.previousData) && v.setQueryData(_, (e) => Array.isArray(e) ? [...e.filter((e) => e.id !== o.item.id), o.item] : e), await i.resolve(e).invalidateQueryKeys(l), m && await m(t, a, o), i.resolve(r).fulfillNotification(o.notificationKey, n.wrapErrorNotificationMessage(u(o.item, a, t), t), "error");
|
|
15
16
|
},
|
|
16
17
|
onMutate: async (e) => {
|
|
17
|
-
let t =
|
|
18
|
+
let t = i.resolve(r).showNotification({
|
|
18
19
|
isLoading: !0,
|
|
19
|
-
message:
|
|
20
|
+
message: f(y.current, e),
|
|
20
21
|
severity: "info"
|
|
21
22
|
});
|
|
22
|
-
if (
|
|
23
|
-
if (!
|
|
24
|
-
await
|
|
25
|
-
let n =
|
|
23
|
+
if (_) {
|
|
24
|
+
if (!y.current) throw Error("previousItem is not set");
|
|
25
|
+
await v.cancelQueries({ queryKey: _ });
|
|
26
|
+
let n = v.getQueryData(_);
|
|
26
27
|
if (Array.isArray(n) && !Array.isArray(e)) {
|
|
27
|
-
let r =
|
|
28
|
+
let r = d ? d(e, y.current) : {
|
|
28
29
|
...e,
|
|
29
|
-
id:
|
|
30
|
+
id: y.current.id
|
|
30
31
|
};
|
|
31
|
-
return
|
|
32
|
-
item:
|
|
32
|
+
return v.setQueryData(_, (e) => [...e.filter((e) => e.id !== y.current.id), r]), {
|
|
33
|
+
item: y.current,
|
|
33
34
|
notificationKey: t,
|
|
34
35
|
previousData: n
|
|
35
36
|
};
|
|
@@ -37,21 +38,21 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getIntermedi
|
|
|
37
38
|
}
|
|
38
39
|
return { notificationKey: t };
|
|
39
40
|
},
|
|
40
|
-
onSuccess: async (
|
|
41
|
-
|
|
41
|
+
onSuccess: async (t, n, a) => {
|
|
42
|
+
y.current = void 0, await i.resolve(e).invalidateQueryKeys(l), h && await h(t, n, a), i.resolve(r).fulfillNotification(a.notificationKey, p(t, a), "success");
|
|
42
43
|
}
|
|
43
|
-
}),
|
|
44
|
-
return
|
|
45
|
-
isMutating:
|
|
46
|
-
mutate:
|
|
47
|
-
setPreviousItem:
|
|
44
|
+
}), C = o(() => S.mutate, [S.mutate]), w = o(() => S.isPending, [S.isPending]);
|
|
45
|
+
return o(() => ({
|
|
46
|
+
isMutating: w,
|
|
47
|
+
mutate: C,
|
|
48
|
+
setPreviousItem: b
|
|
48
49
|
}), [
|
|
50
|
+
w,
|
|
49
51
|
C,
|
|
50
|
-
|
|
51
|
-
y
|
|
52
|
+
b
|
|
52
53
|
]);
|
|
53
54
|
};
|
|
54
55
|
//#endregion
|
|
55
|
-
export {
|
|
56
|
+
export { l as useEditMutation };
|
|
56
57
|
|
|
57
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { GenericData } from '../../models/data';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\n\nexport type MutationContextEdit<TData> = { item?: TData; notificationKey?: string; previousData?: TData[] };\n\nexport type UseEditMutationProps<TData, TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TData, variables: TVariables, error: unknown) => ReactElement | string;\n // Optional function to get an intermediate item to be set in the query cache before the mutation is completed.\n // This is useful for optimistic updates where you want to show a temporary state before the mutation is confirmed.\n // The function receives the variables and the previous item, and should return the intermediate item.\n // Only needed if the variables are different from the previous item.\n readonly getIntermediateItem?: (variables: TVariables, previousItem: TData) => TData;\n readonly getProgressNotificationMessage: (data: TData, variables: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextEdit<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly queryFn?: (variables: TVariables, previousData: TData) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useEditMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getIntermediateItem,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseEditMutationProps<TData, TVariables>) => {\n const queryClient =
|
|
1
|
+
{"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useEditMutation","queryClient","container","previousItemRef","useRef","setPreviousItem","useCallback","item","mutationFn","queryFn","ObjectUtil","variables","editMutation","useMutation","resourceQueryKey","context","oldItems","x","associationQueryKeys","onError","error","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","intermediateItem","getIntermediateItem","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\n\nexport type MutationContextEdit<TData> = { item?: TData; notificationKey?: string; previousData?: TData[] };\n\nexport type UseEditMutationProps<TData, TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TData, variables: TVariables, error: unknown) => ReactElement | string;\n // Optional function to get an intermediate item to be set in the query cache before the mutation is completed.\n // This is useful for optimistic updates where you want to show a temporary state before the mutation is confirmed.\n // The function receives the variables and the previous item, and should return the intermediate item.\n // Only needed if the variables are different from the previous item.\n readonly getIntermediateItem?: (variables: TVariables, previousItem: TData) => TData;\n readonly getProgressNotificationMessage: (data: TData, variables: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextEdit<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly queryFn?: (variables: TVariables, previousData: TData) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useEditMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getIntermediateItem,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseEditMutationProps<TData, TVariables>) => {\n const queryClient = rootContainer.resolve(QueryClientService).queryClient;\n const previousItemRef = useRef<TData>(undefined);\n\n const setPreviousItem = useCallback((item: TData) => {\n previousItemRef.current = item;\n }, []);\n\n const mutationFn = useCallback(async (variables: TVariables) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(variables), previousItemRef.current);\n }, [previousItemRef, queryFn]);\n\n const editMutation = useMutation<TData, Error, TVariables, MutationContextEdit<TData>>({\n mutationFn,\n onError: async (error, variables, context) => {\n previousItemRef.current = undefined;\n if (resourceQueryKey && Array.isArray(context.previousData)) {\n queryClient.setQueryData(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(x => (x as GenericData).id !== (context.item as GenericData).id), context.item];\n });\n }\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(context.item, variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = rootContainer.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(previousItemRef.current, variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n if (!previousItemRef.current) {\n throw new Error('previousItem is not set');\n }\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData) && !Array.isArray(variables)) {\n const intermediateItem = getIntermediateItem ? getIntermediateItem(variables, previousItemRef.current) : {\n ...variables,\n id: (previousItemRef.current as GenericData).id,\n } as GenericData;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [...oldItems.filter(x => x.id !== (previousItemRef.current as GenericData).id), intermediateItem] as GenericData[];\n });\n return { item: previousItemRef.current, notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n previousItemRef.current = undefined;\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => editMutation.mutate, [editMutation.mutate]);\n const isMutating = useMemo(() => editMutation.isPending, [editMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate, setPreviousItem }), [isMutating, mutate, setPreviousItem]);\n};\n"],"mappings":";;;;;;;;AAiCA,IAAaE,KAAkF,EAC7F,yBACA,gCACA,wBACA,mCACA,kCACA,YACA,cACA,YACA,0BAC6C;CAC7C,IAAMC,IAAcH,EAAc,QAAQC,CAAkB,CAAC,CAAC,aACxDI,IAAkBC,EAAc,KAAA,CAAS,GAEzCC,IAAkBC,GAAa,MAAgB;EACnD,EAAgB,UAAUC;CAC5B,GAAG,CAAC,CAAC,GAECC,IAAaF,EAAY,OAAO,MAC7BG,EAAQC,EAAW,wBAAwBC,CAAS,GAAGR,EAAgB,OAAO,GACpF,CAACA,GAAiBM,CAAO,CAAC,GAEvBG,IAAeC,EAAkE;EACrF;EACA,SAAS,OAAO,GAAO,GAAW,MAAY;GAc5C,AAbA,EAAgB,UAAU,KAAA,GACtBC,KAAoB,MAAM,QAAQC,EAAQ,YAAY,KACxDd,EAAY,aAAaa,IAAmB,MACrC,MAAM,QAAQE,CAAQ,IAGpB,CAAC,GAAGA,EAAS,QAAO,MAAMC,EAAkB,OAAQF,EAAQ,KAAqB,EAAE,GAAGA,EAAQ,IAAI,IAFhGC,CAGV,GAEH,MAAMlB,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBmB,CAAoB,GACpFC,KACF,MAAMA,EAAQC,GAAOT,GAAWI,CAAO,GAEzCb,EAAc,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBO,EAAiB,6BAA6BC,EAA4BR,EAAQ,MAAMJ,GAAWS,CAAK,GAAGA,CAAK,GAAG,OAAO;EACpN;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMI,IAAkB1B,EAAc,QAAQuB,CAAmB,CAAC,CAAC,iBAAiB;IAClF,WAAW;IACX,SAASI,EAA+BtB,EAAgB,SAASQ,CAAS;IAC1E,UAAU;GACZ,CAAC;GACD,IAAIG,GAAkB;IACpB,IAAI,CAACX,EAAgB,SACnB,MAAU,MAAM,yBAAyB;IAE3C,MAAMF,EAAY,cAAc,EAAE,UAAUa,EAAiB,CAAC;IAC9D,IAAMY,IAAezB,EAAY,aAAsBa,CAAgB;IACvE,IAAI,MAAM,QAAQY,CAAY,KAAK,CAAC,MAAM,QAAQf,CAAS,GAAG;KAC5D,IAAMgB,IAAmBC,IAAsBA,EAAoBjB,GAAWR,EAAgB,OAAO,IAAI;MACvG,GAAGQ;MACH,IAAKR,EAAgB,QAAwB;KAC/C;KAIA,OAHAF,EAAY,aAA4Ba,IAAmB,MAClD,CAAC,GAAGE,EAAS,QAAO,MAAKC,EAAE,OAAQd,EAAgB,QAAwB,EAAE,GAAGwB,CAAgB,CACxG,GACM;MAAE,MAAMxB,EAAgB;MAAS;MAAiB;KAAa;IACxE;GACF;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAM7C,AALA,EAAgB,UAAU,KAAA,GAC1B,MAAML,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBmB,CAAoB,GACpFW,KACF,MAAMA,EAAUtB,GAAMI,GAAWI,CAAO,GAE1Cb,EAAc,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBe,EAA8BvB,GAAMQ,CAAO,GAAG,SAAS;EACjJ;CACF,CAAC,GAGKgB,IAASC,QAAcpB,EAAa,QAAQ,CAACA,EAAa,MAAM,CAAC,GACjEqB,IAAaD,QAAcpB,EAAa,WAAW,CAACA,EAAa,SAAS,CAAC;CACjF,OAAOoB,SAAe;EAAE;EAAY;EAAQ;CAAgB,IAAI;EAACC;EAAYF;EAAQ1B;CAAe,CAAC;AACvG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useInitializeTableStore/useInitializeTableStore.ts"],"sourcesContent":["import { useStore } from 'zustand';\nimport type { StoreApi } from 'zustand';\nimport { useEffect } from 'react';\n\nimport { DEFAULT_FILTER_GROUP } from '../../classes/abstracts/FilterAbstract';\nimport type { TableColumn } from '../../models/table';\nimport type { TableStore } from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\n\nexport type UseInitializeTableStoreKWArgs<TData, TDataContext = null> = {\n readonly columns: TableColumn<TData, TDataContext>[];\n readonly context?: TDataContext;\n readonly createFiltersFromColumns?: boolean;\n readonly rows: TData[];\n readonly store: StoreApi<TableStore<TData, TDataContext>>;\n};\n\n\nexport const useInitializeTableStore = <TData, TDataContext = null>({ columns, context, createFiltersFromColumns, rows, store }: UseInitializeTableStoreKWArgs<TData, TDataContext>) => {\n const setColumns = useStore(store, (state) => state.setColumns);\n const setBaseData = useStore(store, (state) => state.setBaseData);\n const setFilters = useStore(store, (state) => state.setFilters);\n const initialize = useStore(store, (state) => state.initialize);\n\n useEffect(() => {\n if (!columns || !rows) {\n return;\n }\n const abortController = new AbortController();\n setColumns(columns);\n setBaseData(rows);\n if (createFiltersFromColumns) {\n setFilters(TableUtil.createFiltersFromColumns(columns, rows, context), [], [DEFAULT_FILTER_GROUP]);\n }\n\n void initialize(abortController.signal);\n return () => {\n abortController.abort();\n };\n }, [columns, initialize, setColumns, setFilters, setBaseData, createFiltersFromColumns, rows, context]);\n};\n"],"mappings":";;;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["TableUtil","useStore","useInitializeTableStore","setColumns","store","state","setBaseData","setFilters","initialize","columns","rows","abortController","createFiltersFromColumns","context","DEFAULT_FILTER_GROUP"],"sources":["../../../src/hooks/useInitializeTableStore/useInitializeTableStore.ts"],"sourcesContent":["import { useStore } from 'zustand';\nimport type { StoreApi } from 'zustand';\nimport { useEffect } from 'react';\n\nimport { DEFAULT_FILTER_GROUP } from '../../classes/abstracts/FilterAbstract';\nimport type { TableColumn } from '../../models/table.models';\nimport type { TableStore } from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\n\nexport type UseInitializeTableStoreKWArgs<TData, TDataContext = null> = {\n readonly columns: TableColumn<TData, TDataContext>[];\n readonly context?: TDataContext;\n readonly createFiltersFromColumns?: boolean;\n readonly rows: TData[];\n readonly store: StoreApi<TableStore<TData, TDataContext>>;\n};\n\n\nexport const useInitializeTableStore = <TData, TDataContext = null>({ columns, context, createFiltersFromColumns, rows, store }: UseInitializeTableStoreKWArgs<TData, TDataContext>) => {\n const setColumns = useStore(store, (state) => state.setColumns);\n const setBaseData = useStore(store, (state) => state.setBaseData);\n const setFilters = useStore(store, (state) => state.setFilters);\n const initialize = useStore(store, (state) => state.initialize);\n\n useEffect(() => {\n if (!columns || !rows) {\n return;\n }\n const abortController = new AbortController();\n setColumns(columns);\n setBaseData(rows);\n if (createFiltersFromColumns) {\n setFilters(TableUtil.createFiltersFromColumns(columns, rows, context), [], [DEFAULT_FILTER_GROUP]);\n }\n\n void initialize(abortController.signal);\n return () => {\n abortController.abort();\n };\n }, [columns, initialize, setColumns, setFilters, setBaseData, createFiltersFromColumns, rows, context]);\n};\n"],"mappings":";;;;;AAkBA,IAAaE,KAAuD,EAAE,YAAS,YAAS,6BAA0B,SAAM,eAAgE;CACtL,IAAMC,IAAaF,EAASG,IAAQ,MAAUC,EAAM,UAAU,GACxDC,IAAcL,EAASG,IAAQ,MAAUC,EAAM,WAAW,GAC1DE,IAAaN,EAASG,IAAQ,MAAUC,EAAM,UAAU,GACxDG,IAAaP,EAASG,IAAQ,MAAUC,EAAM,UAAU;CAE9D,QAAgB;EACd,IAAI,CAACI,KAAW,CAACC,GACf;EAEF,IAAMC,IAAkB,IAAI,gBAAgB;EAQ5C,OAPAR,EAAWM,CAAO,GAClBH,EAAYI,CAAI,GACZE,KACFL,EAAWP,EAAU,yBAAyBS,GAASC,GAAMG,CAAO,GAAG,CAAC,GAAG,CAACC,CAAoB,CAAC,GAGnGN,EAAgBG,EAAgB,MAAM,SACzB;GACX,EAAgB,MAAM;EACxB;CACF,GAAG;EAACF;EAASD;EAAYL;EAAYI;EAAYD;EAAaM;EAA0BF;EAAMG;CAAO,CAAC;AACxG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StoreApi } from 'zustand';
|
|
2
|
-
import { TableColumn } from '../../models/table';
|
|
2
|
+
import { TableColumn } from '../../models/table.models';
|
|
3
3
|
import { TableStore } from '../../stores/tableStore';
|
|
4
4
|
export type UseInitializeTableStoreKWArgs<TData, TDataContext = null> = {
|
|
5
5
|
readonly columns: TableColumn<TData, TDataContext>[];
|