@gen-epix/ui-client-common 4.5.0 → 4.6.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 +5 -4
- package/dist/@types/mui.d.ts +13 -5
- package/dist/@types/ui-client-common.d.ts +1 -0
- package/dist/_chunks/ApplicationFooter.js +45 -46
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +14 -15
- package/dist/_chunks/CrudPage.js +301 -302
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js +1 -2
- package/dist/_chunks/GeoFilter.js.map +1 -1
- package/dist/_chunks/Notifications.js +52 -53
- package/dist/_chunks/OutageList.js +30 -31
- package/dist/_chunks/OutageList.js.map +1 -1
- package/dist/_chunks/OutageUtil.js +4 -8
- package/dist/_chunks/OutageUtil.js.map +1 -1
- package/dist/_chunks/QueryClientProvider.js +1 -2
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +101 -395
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Reflect.js +1 -2
- package/dist/_chunks/Table.js +523 -522
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +10 -20
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +18 -20
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +78 -79
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/UserManagerUtil.js +212 -213
- package/dist/_chunks/UserManagerUtil.js.map +1 -1
- package/dist/_chunks/_baseAssignValue.js +1 -2
- package/dist/_chunks/_baseFlatten.js +9 -10
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseGet.js +279 -0
- package/dist/_chunks/_baseGet.js.map +1 -0
- package/dist/_chunks/_baseIteratee.js +273 -0
- package/dist/_chunks/_baseIteratee.js.map +1 -0
- package/dist/_chunks/_baseUnset.js +22 -300
- package/dist/_chunks/_baseUnset.js.map +1 -1
- package/dist/_chunks/_cacheHas.js +1 -2
- package/dist/_chunks/_setToString.js +1 -2
- package/dist/_chunks/decorate.js +1 -2
- package/dist/_chunks/decorateParam.js +1 -2
- package/dist/_chunks/format.js +27 -54
- package/dist/_chunks/format.js.map +1 -1
- package/dist/_chunks/isArrayLike.js +1 -2
- package/dist/_chunks/isObject.js +1 -2
- package/dist/_chunks/isSymbol.js +1 -2
- package/dist/_chunks/last.js +12 -0
- package/dist/_chunks/last.js.map +1 -0
- package/dist/_chunks/middleware.js +2 -3
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/omit.js +42 -42
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/query.js +8 -15
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react.js +2 -3
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/rolldown-runtime.js +2 -3
- package/dist/_chunks/tableStore.js +231 -224
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/toDate.js +8 -14
- package/dist/_chunks/toDate.js.map +1 -1
- package/dist/_chunks/uniq.js +43 -0
- package/dist/_chunks/uniq.js.map +1 -0
- package/dist/_chunks/useColumnsMenu.js +3 -6
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +24 -26
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +33 -22
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -2
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -4
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/TableEventBus/index.js +1 -2
- package/dist/classes/abstracts/FilterAbstract/index.js +4 -3
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/index.js +15 -16
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/index.js +5 -6
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BackendVersionService/index.js +4 -4
- package/dist/classes/services/BackendVersionService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/index.js +16 -39
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/index.js +10 -10
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/FeatureFlagsService/index.js +1 -2
- package/dist/classes/services/I18nService/index.js +12 -12
- package/dist/classes/services/I18nService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/index.js +13 -14
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/index.js +40 -35
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/NavigationHistoryService/index.js +1 -2
- package/dist/classes/services/NotificationService/index.js +9 -10
- package/dist/classes/services/NotificationService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/index.js +14 -11
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/classes/services/RouterService/index.js +4 -8
- package/dist/classes/services/RouterService/index.js.map +1 -1
- package/dist/classes/services/UserSettingsService/index.js +1 -2
- package/dist/components/app/App/App.d.ts +1 -1
- package/dist/components/app/App/index.js +35 -40
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +29 -30
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +48 -47
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +36 -37
- package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
- package/dist/components/app/AuthorizationWrapper/index.js +20 -21
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +53 -52
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +22 -23
- package/dist/components/filters/BooleanFilterField/index.js +6 -7
- package/dist/components/filters/DateFilterField/index.js +4 -5
- package/dist/components/filters/GeoFilterField/index.js +5 -6
- package/dist/components/filters/MultiSelectFilterField/index.js +5 -6
- package/dist/components/filters/NumberRangeFilterField/index.js +4 -5
- package/dist/components/filters/TextFilterField/index.js +4 -5
- package/dist/components/ui/ApplicationBar/index.js +189 -190
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/ConsentDialog/index.js +1 -2
- package/dist/components/ui/GenericErrorMessage/index.js +30 -31
- package/dist/components/ui/LicensesDialog/index.js +39 -40
- package/dist/components/ui/LicensesDialog/index.js.map +1 -1
- package/dist/components/ui/MyPermissionsDialog/index.js +17 -18
- package/dist/components/ui/NavLink/index.js +7 -8
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +22 -23
- package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
- package/dist/components/ui/OutagesDialog/index.js +1 -2
- package/dist/components/ui/PageContainer/index.js +25 -26
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/ResponseHandler/index.js +1 -2
- package/dist/components/ui/Sidebar/index.js +31 -32
- package/dist/components/ui/UserFeedbackDialog/index.js +13 -14
- package/dist/components/ui/UserInactivityConfirmation/index.js +1 -2
- package/dist/constants/api.constants.js +1 -2
- package/dist/constants/config.constants.d.ts +0 -2
- package/dist/constants/config.constants.js +3 -4
- package/dist/constants/config.constants.js.map +1 -1
- package/dist/constants/query.constants.js +1 -2
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +13 -14
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +15 -16
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +13 -14
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +14 -15
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +5 -6
- package/dist/dataHooks/useOrganizationsQuery/index.js +14 -15
- package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
- package/dist/dataHooks/useUsersQuery/index.js +11 -12
- package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
- package/dist/hoc/withPermissions/index.js +1 -2
- package/dist/hooks/useConfig/index.js +3 -4
- package/dist/hooks/useConfig/index.js.map +1 -1
- package/dist/hooks/useCreateMutation/index.js +13 -14
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/index.js +17 -11
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/index.js +49 -35
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useInitializeTableStore/index.js +1 -2
- package/dist/hooks/useItemQuery/index.js +5 -6
- package/dist/hooks/useItemQuery/index.js.map +1 -1
- package/dist/hooks/useUpdateBreadcrumb/index.js +1 -2
- package/dist/hooks/useUpdateDocumentTitle/index.js +1 -2
- package/dist/locale/en.json +1 -0
- package/dist/locale/nl.json +1 -0
- package/dist/models/admin.models.js +1 -2
- package/dist/models/admin.models.js.map +1 -1
- package/dist/models/config.models.d.ts +1 -5
- package/dist/models/table.models.js +1 -2
- package/dist/models/table.models.js.map +1 -1
- package/dist/models/theme.models.d.ts +19 -16
- package/dist/pages/AcceptInvitationPage/index.js +26 -27
- package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
- package/dist/pages/AdminPage/index.js +17 -18
- package/dist/pages/ChooseIdentityProviderPage/index.js +22 -23
- package/dist/pages/ErrorPage/index.js +1 -2
- package/dist/pages/IdentifierIssuersAdminPage/index.js +6 -7
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +6 -7
- package/dist/pages/OrganizationContactsAdminPage/index.js +7 -8
- package/dist/pages/OrganizationSitesAdminPage/index.js +10 -11
- package/dist/pages/OrganizationsAdminPage/index.js +14 -15
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +21 -22
- package/dist/pages/PostLoginPage/index.js +8 -9
- package/dist/pages/PostLoginPage/index.js.map +1 -1
- package/dist/pages/PostLogoutPage/index.js +9 -10
- package/dist/pages/RouterErrorPage/index.js +1 -2
- package/dist/pages/UsersAdminPage/index.js +40 -41
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/routes/index.js +1 -2
- package/dist/setup/setup.js +12 -6
- package/dist/setup/setup.js.map +1 -1
- package/dist/stores/oidcStore/index.js +1 -2
- package/dist/stores/outagesStore/index.js +1 -2
- package/dist/theme/demoTheme/index.js +18 -17
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/AxiosUtil/index.js +1 -2
- package/dist/utils/DataHookUtil/index.js +2 -3
- package/dist/utils/DataHookUtil/index.js.map +1 -1
- package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
- package/dist/utils/DependencyContainerUtil/index.js +10 -16
- package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
- package/dist/utils/LoadableUtil/index.js +1 -2
- package/dist/utils/MenuDataUtil/index.js +2 -3
- package/dist/utils/MenuDataUtil/index.js.map +1 -1
- package/dist/utils/NotificationUtil/index.js +1 -2
- package/dist/utils/StandardConfigUtil/index.js +1 -6
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TimeUtil/index.js +2 -3
- package/dist/utils/TimeUtil/index.js.map +1 -1
- package/dist/utils/UserUtil/index.js +1 -2
- package/package.json +26 -29
- package/dist/context/ClientCommonConfigContext/ClientCommonConfigContext.d.ts +0 -9
- package/dist/context/ClientCommonConfigContext/ClientCommonConfigContextProvider.d.ts +0 -6
- package/dist/context/ClientCommonConfigContext/index.d.ts +0 -3
- package/dist/context/ClientCommonConfigContext/index.js +0 -34
- package/dist/context/ClientCommonConfigContext/index.js.map +0 -1
- package/dist/context/ClientCommonConfigContext/useClientCommonConfigContext.d.ts +0 -3
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { UserUtil as e } from "../../utils/UserUtil/index.js";
|
|
2
|
-
import { t } from "../../
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DataHookUtil as t } from "../../utils/DataHookUtil/index.js";
|
|
3
|
+
import { API_ORGANIZATION_TOKEN as n } from "../../constants/api.constants.js";
|
|
4
|
+
import { t as r } from "../../_chunks/useQueryMemo.js";
|
|
5
|
+
import { t as i } from "../../_chunks/QueryClientService.js";
|
|
6
6
|
import { COMMON_QUERY_KEY as a } from "../../constants/query.constants.js";
|
|
7
7
|
import { container as o } from "tsyringe";
|
|
8
8
|
import { useMemo as s } from "react";
|
|
9
9
|
import { useTranslation as c } from "react-i18next";
|
|
10
|
-
|
|
11
|
-
var l = () =>
|
|
12
|
-
queryFn: async ({ signal: e }) => (await o.resolve(
|
|
13
|
-
queryKey: o.resolve(
|
|
10
|
+
// src/dataHooks/useUsersQuery/useUsersQuery.ts
|
|
11
|
+
var l = () => r({
|
|
12
|
+
queryFn: async ({ signal: e }) => (await o.resolve(n).usersGetAll(null, null, { signal: e })).data,
|
|
13
|
+
queryKey: o.resolve(i).getGenericKey(a.USERS)
|
|
14
14
|
}), u = () => {
|
|
15
15
|
let e = l();
|
|
16
|
-
return s(() =>
|
|
16
|
+
return s(() => t.createUseMapDataHook(e, (e) => e.id), [e]);
|
|
17
17
|
}, d = () => {
|
|
18
|
-
let
|
|
19
|
-
return s(() =>
|
|
18
|
+
let n = l(), { t: r } = c();
|
|
19
|
+
return s(() => t.createUseOptionsDataHook(n, (e) => e.id, (t) => e.getUserDisplayValue(t, r)), [r, n]);
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { d as useUserOptionsQuery, u as useUsersMapQuery, l as useUsersQuery };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useQueryMemo","useUsersQuery","container","API_ORGANIZATION_TOKEN","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useQueryMemo","QueryClientService","useUsersQuery","container","API_ORGANIZATION_TOKEN","COMMON_QUERY_KEY","useUsersMapQuery","usersQuery","useMemo","DataHookUtil","item","useUserOptionsQuery","useTranslation","UserUtil","t"],"sources":["../../../src/dataHooks/useUsersQuery/useUsersQuery.ts"],"sourcesContent":["import { container } 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 '../../constants/api.constants';\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 container.resolve(API_ORGANIZATION_TOKEN).usersGetAll(null, null, { signal });\n return response.data;\n },\n queryKey: container.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,UACJF,EAAa;CAClB,SAAS,OAAO,EAAE,iBAET,MADgBG,EAAU,QAAQC,CAAsB,CAAC,CAAC,YAAY,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,CACnF;CAElB,UAAUD,EAAU,QAAQF,CAAkB,CAAC,CAAC,cAAcI,EAAiB,KAAK;AACtF,CAAC,GAGUC,UAA+C;CAC1D,IAAMC,IAAaL,EAAc;CAEjC,OAAOM,QACEC,EAAa,qBAAmCF,IAAY,MAAQG,EAAK,EAAE,GACjF,CAACH,CAAU,CAAC;AACjB,GAEaI,UAAgD;CAC3D,IAAMJ,IAAaL,EAAc,GAC3B,EAAE,SAAMU,EAAe;CAE7B,OAAOJ,QACEC,EAAa,yBAAuCF,IAAY,MAAQG,EAAK,KAAI,MAAQG,EAAS,oBAAoBH,GAAMI,CAAC,CAAC,GACpI,CAACA,GAAGP,CAAU,CAAC;AACpB"}
|
|
@@ -2,7 +2,7 @@ import { AuthorizationService as e } from "../../classes/services/AuthorizationS
|
|
|
2
2
|
import { container as t } from "tsyringe";
|
|
3
3
|
import { useMemo as n } from "react";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/hoc/withPermissions/withPermissions.tsx
|
|
6
6
|
var i = (i, a) => {
|
|
7
7
|
let o = (o) => {
|
|
8
8
|
if (!n(() => t.resolve(e), []).doesUserHavePermission(a.requiredPermissions)) {
|
|
@@ -16,7 +16,6 @@ var i = (i, a) => {
|
|
|
16
16
|
};
|
|
17
17
|
return o.displayName = `withPermissions(${i.displayName || i.name})`, o;
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { i as withPermissions };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var t = () => e()
|
|
4
|
-
//#endregion
|
|
1
|
+
import { DependencyContainerUtil as e } from "../../utils/DependencyContainerUtil/index.js";
|
|
2
|
+
// src/hooks/useConfig/useConfig.ts
|
|
3
|
+
var t = () => e.resolveConfig();
|
|
5
4
|
export { t as useConfig };
|
|
6
5
|
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useConfig","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useConfig","DependencyContainerUtil"],"sources":["../../../src/hooks/useConfig/useConfig.ts"],"sourcesContent":["import type { ConfigBase } from '../../models/config.models';\nimport { DependencyContainerUtil } from '../../utils/DependencyContainerUtil';\n\n// eslint-disable-next-line @eslint-react/no-unnecessary-use-prefix\nexport const useConfig = <TConfig extends ConfigBase = ConfigBase>(): TConfig => {\n return DependencyContainerUtil.resolveConfig<TConfig>();\n};\n"],"mappings":";;AAIA,IAAaA,UACJC,EAAwB,cAAuB"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import {
|
|
1
|
+
import { NotificationUtil as e } from "../../utils/NotificationUtil/index.js";
|
|
2
|
+
import { t } from "../../_chunks/QueryClientService.js";
|
|
3
|
+
import { t as n } from "../../_chunks/useMutation.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 { StringUtil as a } from "@gen-epix/ui-core/utils/StringUtil";
|
|
7
7
|
import { useMemo as o } from "react";
|
|
8
8
|
import { ObjectUtil as s } from "@gen-epix/ui-core/utils/ObjectUtil";
|
|
9
|
-
|
|
9
|
+
// src/hooks/useCreateMutation/useCreateMutation.ts
|
|
10
10
|
var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressNotificationMessage: u, getSuccessNotificationMessage: d, onError: f, onSuccess: p, queryFn: m, resourceQueryKey: h }) => {
|
|
11
|
-
let g =
|
|
11
|
+
let g = i.resolve(t).queryClient, _ = n({
|
|
12
12
|
mutationFn: async (e) => m(s.deepNullifyEmptyStrings(e)),
|
|
13
|
-
onError: async (
|
|
14
|
-
h && g.setQueryData(h, (e) => Array.isArray(e) ? [...e.filter((e) => e?.id !== o.temporaryId)] : e), await
|
|
13
|
+
onError: async (n, a, o) => {
|
|
14
|
+
h && g.setQueryData(h, (e) => Array.isArray(e) ? [...e.filter((e) => e?.id !== o.temporaryId)] : e), await i.resolve(t).invalidateQueryKeys(c), f && await f(n, a, o), i.resolve(r).fulfillNotification(o.notificationKey, e.wrapErrorNotificationMessage(l(a, n), n), "error");
|
|
15
15
|
},
|
|
16
16
|
onMutate: async (e) => {
|
|
17
|
-
let t =
|
|
17
|
+
let t = i.resolve(r).showNotification({
|
|
18
18
|
isLoading: !0,
|
|
19
19
|
message: u(e),
|
|
20
20
|
severity: "info"
|
|
@@ -23,7 +23,7 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressN
|
|
|
23
23
|
await g.cancelQueries({ queryKey: h });
|
|
24
24
|
let n = g.getQueryData(h);
|
|
25
25
|
if (Array.isArray(n)) {
|
|
26
|
-
let r =
|
|
26
|
+
let r = a.createUuid();
|
|
27
27
|
return g.setQueryData(h, (t) => [{
|
|
28
28
|
...e,
|
|
29
29
|
id: r
|
|
@@ -36,8 +36,8 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressN
|
|
|
36
36
|
}
|
|
37
37
|
return { notificationKey: t };
|
|
38
38
|
},
|
|
39
|
-
onSuccess: async (
|
|
40
|
-
h && Array.isArray(
|
|
39
|
+
onSuccess: async (e, n, a) => {
|
|
40
|
+
h && Array.isArray(a?.previousData) && !Array.isArray(e) && g.setQueryData(h, (t) => [e, ...t.filter((e) => e.id !== a.temporaryId)]), await i.resolve(t).invalidateQueryKeys(c), p && await p(e, n, a), i.resolve(r).fulfillNotification(a.notificationKey, d(e, a), "success");
|
|
41
41
|
}
|
|
42
42
|
}), v = o(() => _.mutate, [_.mutate]), y = o(() => _.isPending, [_.isPending]);
|
|
43
43
|
return o(() => ({
|
|
@@ -45,7 +45,6 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressN
|
|
|
45
45
|
mutate: v
|
|
46
46
|
}), [y, v]);
|
|
47
47
|
};
|
|
48
|
-
//#endregion
|
|
49
48
|
export { c as useCreateMutation };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useMutation","useCreateMutation","queryClient","container","QueryClientService","createMutation","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 } 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 = container.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 container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = container.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 container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n container.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,IAAaC,KAAoF,EAC/F,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BAC+C;CAC/C,IAAMC,IAAcC,EAAU,QAAQC,CAAkB,CAAC,CAAC,aAEpDC,IAAiBL,EAAoE;EACzF,YAAY,OAAO,MACVM,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,MAAMP,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBQ,CAAoB,GAChFC,KACF,MAAMA,EAAQC,GAAOC,GAAWJ,CAAO,GAEzCR,EAAU,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBM,EAAiB,6BAA6BC,EAA4BH,GAAWD,CAAK,GAAGA,CAAK,GAAG,OAAO;EAClM;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMK,IAAkBhB,EAAU,QAAQa,CAAmB,CAAC,CAAC,iBAAiB;IAC9E,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,MAAMR,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBQ,CAAoB,GAChFa,KACF,MAAMA,EAAUjB,GAAMO,GAAWJ,CAAO,GAE1CR,EAAU,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBe,EAA8BlB,GAAMG,CAAO,GAAG,SAAS;EAC7I;CACF,CAAC,GAGKgB,IAASC,QAAcvB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEwB,IAAaD,QAAcvB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOuB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import {
|
|
1
|
+
import { NotificationUtil as e } from "../../utils/NotificationUtil/index.js";
|
|
2
|
+
import { t } from "../../_chunks/QueryClientService.js";
|
|
3
|
+
import { t as n } from "../../_chunks/useMutation.js";
|
|
4
4
|
import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
|
|
5
5
|
import { container as i } from "tsyringe";
|
|
6
6
|
import { useMemo as a } from "react";
|
|
7
|
-
|
|
7
|
+
// src/hooks/useDeleteMutation/useDeleteMutation.ts
|
|
8
8
|
var o = ({ associationQueryKeys: o, getErrorNotificationMessage: s, getProgressNotificationMessage: c, getSuccessNotificationMessage: l, onError: u, onSuccess: d, queryFn: f, resourceQueryKey: p }) => {
|
|
9
|
-
let m = i.resolve(
|
|
10
|
-
mutationFn: async (e) =>
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
let m = i.resolve(t).queryClient, h = n({
|
|
10
|
+
mutationFn: async (e) => {
|
|
11
|
+
if (!f) throw Error("Delete mutation queryFn is required");
|
|
12
|
+
return f(e);
|
|
13
|
+
},
|
|
14
|
+
onError: async (n, a, c) => {
|
|
15
|
+
p && Array.isArray(c.previousData) && m.setQueryData(p, c.previousData), o && await i.resolve(t).invalidateQueryKeys(o), u && await u(n, a, c);
|
|
16
|
+
let l = s?.(a, n) ?? String(n);
|
|
17
|
+
i.resolve(r).fulfillNotification(c.notificationKey, e.wrapErrorNotificationMessage(l, n), "error");
|
|
13
18
|
},
|
|
14
19
|
onMutate: async (e) => {
|
|
15
20
|
let t = i.resolve(r).showNotification({
|
|
@@ -27,8 +32,10 @@ var o = ({ associationQueryKeys: o, getErrorNotificationMessage: s, getProgressN
|
|
|
27
32
|
}
|
|
28
33
|
return { notificationKey: t };
|
|
29
34
|
},
|
|
30
|
-
onSuccess: async (
|
|
31
|
-
o && await i.resolve(
|
|
35
|
+
onSuccess: async (e, n, a) => {
|
|
36
|
+
o && await i.resolve(t).invalidateQueryKeys(o), d && await d(n, a);
|
|
37
|
+
let s = l?.(n, a) ?? "Deleted successfully";
|
|
38
|
+
i.resolve(r).fulfillNotification(a.notificationKey, s, "success");
|
|
32
39
|
}
|
|
33
40
|
}), g = a(() => h.mutate, [h.mutate]), _ = a(() => h.isPending, [h.isPending]);
|
|
34
41
|
return a(() => ({
|
|
@@ -36,7 +43,6 @@ var o = ({ associationQueryKeys: o, getErrorNotificationMessage: s, getProgressN
|
|
|
36
43
|
mutate: g
|
|
37
44
|
}), [_, g]);
|
|
38
45
|
};
|
|
39
|
-
//#endregion
|
|
40
46
|
export { o as useDeleteMutation };
|
|
41
47
|
|
|
42
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useMutation","useDeleteMutation","queryClient","container","QueryClientService","deleteMutation","queryFn","item","resourceQueryKey","context","associationQueryKeys","onError","error","errorMessage","getErrorNotificationMessage","NotificationService","NotificationUtil","notificationKey","getProgressNotificationMessage","previousData","oldItems","i","onSuccess","successMessage","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useDeleteMutation/useDeleteMutation.ts"],"sourcesContent":["import { container } 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 = container.resolve(QueryClientService).queryClient;\n\n const deleteMutation = useMutation<unknown, Error, TData, MutationContextDelete<TData>>({\n mutationFn: async (item) => {\n if (!queryFn) {\n throw new Error('Delete mutation queryFn is required');\n }\n return queryFn(item);\n },\n onError: async (error, item, context) => {\n if (resourceQueryKey && Array.isArray(context.previousData)) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, context.previousData);\n }\n if (associationQueryKeys) {\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onError) {\n await onError(error, item, context);\n }\n const errorMessage = getErrorNotificationMessage?.(item, error) ?? String(error);\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(errorMessage, error), 'error');\n },\n onMutate: async (item) => {\n const notificationKey = container.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 container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onSuccess) {\n await onSuccess(item, context);\n }\n const successMessage = getSuccessNotificationMessage?.(item, context) ?? 'Deleted successfully';\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, successMessage, '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,IAAaC,KAAgE,EAC3E,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BACmC;CACnC,IAAMC,IAAcC,EAAU,QAAQC,CAAkB,CAAC,CAAC,aAEpDC,IAAiBL,EAAiE;EACtF,YAAY,OAAO,MAAS;GAC1B,IAAI,CAACM,GACH,MAAU,MAAM,qCAAqC;GAEvD,OAAOA,EAAQC,CAAI;EACrB;EACA,SAAS,OAAO,GAAO,GAAM,MAAY;GAOvC,AANIC,KAAoB,MAAM,QAAQC,EAAQ,YAAY,KACxDP,EAAY,aAAsBM,GAAkBC,EAAQ,YAAY,GAEtEC,KACF,MAAMP,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBM,CAAoB,GAElFC,KACF,MAAMA,EAAQC,GAAOL,GAAME,CAAO;GAEpC,IAAMI,IAAeC,IAA8BP,GAAMK,CAAK,KAAK,OAAOA,CAAK;GAC/E,EAAU,QAAQG,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBO,EAAiB,6BAA6BH,GAAcD,CAAK,GAAG,OAAO;EACjK;EACA,UAAU,OAAO,MAAS;GACxB,IAAMK,IAAkBd,EAAU,QAAQY,CAAmB,CAAC,CAAC,iBAAiB;IAC9E,WAAW;IACX,SAASG,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,MAClDY,EAAS,QAAO,MAAKC,EAAE,OAAOd,EAAK,EAAE,CAC7C,GACM;KAAE;KAAiB;IAAa;GAE3C;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAO,GAAM,MAAY;GAIzC,AAHIG,KACF,MAAMP,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBM,CAAoB,GAElFY,KACF,MAAMA,EAAUf,GAAME,CAAO;GAE/B,IAAMc,IAAiBC,IAAgCjB,GAAME,CAAO,KAAK;GACzE,EAAU,QAAQM,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBc,GAAgB,SAAS;EAC/G;CACF,CAAC,GAGKE,IAASC,QAAcrB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEsB,IAAaD,QAAcrB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOqB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
|
|
@@ -1,58 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import {
|
|
1
|
+
import { NotificationUtil as e } from "../../utils/NotificationUtil/index.js";
|
|
2
|
+
import { t } from "../../_chunks/QueryClientService.js";
|
|
3
|
+
import { t as n } from "../../_chunks/useMutation.js";
|
|
4
4
|
import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
|
|
5
5
|
import { container as i } from "tsyringe";
|
|
6
6
|
import { useCallback as a, useMemo as o, useRef as s } from "react";
|
|
7
7
|
import { ObjectUtil as c } from "@gen-epix/ui-core/utils/ObjectUtil";
|
|
8
|
-
|
|
9
|
-
var l = ({ associationQueryKeys:
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
}, []),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
// src/hooks/useEditMutation/useEditMutation.ts
|
|
9
|
+
var l = (e) => !Array.isArray(e), u = ({ associationQueryKeys: u, getErrorNotificationMessage: d, getIntermediateItem: f, getProgressNotificationMessage: p, getSuccessNotificationMessage: m, onError: h, onSuccess: g, queryFn: _, resourceQueryKey: v }) => {
|
|
10
|
+
let y = i.resolve(t).queryClient, b = s(void 0), x = a((e) => {
|
|
11
|
+
b.current = e;
|
|
12
|
+
}, []), S = a(async (e) => {
|
|
13
|
+
if (!_) throw Error("Edit mutation queryFn is required");
|
|
14
|
+
return _(c.deepNullifyEmptyStrings(e), b.current);
|
|
15
|
+
}, [b, _]), C = n({
|
|
16
|
+
mutationFn: S,
|
|
17
|
+
onError: async (n, a, o) => {
|
|
18
|
+
b.current = void 0;
|
|
19
|
+
let s = o ?? {};
|
|
20
|
+
v && Array.isArray(s.previousData) && y.setQueryData(v, s.previousData), await i.resolve(t).invalidateQueryKeys(u), h && await h(n, a, s);
|
|
21
|
+
let c = s.item ? d(s.item, a, n) : String(n);
|
|
22
|
+
s.notificationKey && i.resolve(r).fulfillNotification(s.notificationKey, e.wrapErrorNotificationMessage(c, n), "error");
|
|
16
23
|
},
|
|
17
24
|
onMutate: async (e) => {
|
|
18
|
-
let t =
|
|
25
|
+
let t = b.current;
|
|
26
|
+
if (!t) throw Error("previousItem is not set");
|
|
27
|
+
let n = i.resolve(r).showNotification({
|
|
19
28
|
isLoading: !0,
|
|
20
|
-
message:
|
|
29
|
+
message: p(t, e),
|
|
21
30
|
severity: "info"
|
|
22
31
|
});
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let r = d ? d(e, y.current) : {
|
|
32
|
+
if (v) {
|
|
33
|
+
await y.cancelQueries({ queryKey: v });
|
|
34
|
+
let r = y.getQueryData(v);
|
|
35
|
+
if (Array.isArray(r) && !Array.isArray(e)) {
|
|
36
|
+
let i = f ? f(e, t) : {
|
|
29
37
|
...e,
|
|
30
|
-
id:
|
|
38
|
+
id: t.id
|
|
31
39
|
};
|
|
32
|
-
return
|
|
33
|
-
item:
|
|
34
|
-
notificationKey:
|
|
35
|
-
previousData:
|
|
40
|
+
return y.setQueryData(v, (e) => e.map((e) => e.id === t.id ? i : e)), {
|
|
41
|
+
item: t,
|
|
42
|
+
notificationKey: n,
|
|
43
|
+
previousData: r
|
|
36
44
|
};
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
|
-
return {
|
|
47
|
+
return {
|
|
48
|
+
item: t,
|
|
49
|
+
notificationKey: n
|
|
50
|
+
};
|
|
40
51
|
},
|
|
41
|
-
onSuccess: async (
|
|
42
|
-
|
|
52
|
+
onSuccess: async (e, n, a) => {
|
|
53
|
+
if (b.current = void 0, v && Array.isArray(a?.previousData) && l(e)) {
|
|
54
|
+
let t = a.item?.id;
|
|
55
|
+
y.setQueryData(v, (n) => Array.isArray(n) ? n.map((n) => n.id === t ? e : n) : n);
|
|
56
|
+
}
|
|
57
|
+
await i.resolve(t).invalidateQueryKeys(u), g && await g(e, n, a), i.resolve(r).fulfillNotification(a.notificationKey, m(e, a), "success");
|
|
43
58
|
}
|
|
44
|
-
}),
|
|
59
|
+
}), w = o(() => C.mutate, [C.mutate]), T = o(() => C.isPending, [C.isPending]);
|
|
45
60
|
return o(() => ({
|
|
46
|
-
isMutating:
|
|
47
|
-
mutate:
|
|
48
|
-
setPreviousItem:
|
|
61
|
+
isMutating: T,
|
|
62
|
+
mutate: w,
|
|
63
|
+
setPreviousItem: x
|
|
49
64
|
}), [
|
|
65
|
+
T,
|
|
50
66
|
w,
|
|
51
|
-
|
|
52
|
-
b
|
|
67
|
+
x
|
|
53
68
|
]);
|
|
54
69
|
};
|
|
55
|
-
|
|
56
|
-
export { l as useEditMutation };
|
|
70
|
+
export { u as useEditMutation };
|
|
57
71
|
|
|
58
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useMutation","isSingleGenericData","item","useEditMutation","queryClient","container","QueryClientService","previousItemRef","useRef","setPreviousItem","useCallback","mutationFn","queryFn","ObjectUtil","variables","editMutation","safeContext","context","resourceQueryKey","associationQueryKeys","onError","error","errorMessage","getErrorNotificationMessage","NotificationService","NotificationUtil","previousItem","notificationKey","getProgressNotificationMessage","previousData","intermediateItem","getIntermediateItem","oldItems","x","previousItemId","oldItem","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { container } 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\nconst isSingleGenericData = (item: GenericData | GenericData[]): item is GenericData => !Array.isArray(item);\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 = container.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 if (!queryFn) {\n throw new Error('Edit mutation queryFn is required');\n }\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 const safeContext: MutationContextEdit<TData> = context ?? {};\n if (resourceQueryKey && Array.isArray(safeContext.previousData)) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, safeContext.previousData);\n }\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, safeContext);\n }\n const errorMessage = safeContext.item\n ? getErrorNotificationMessage(safeContext.item, variables, error)\n : String(error);\n if (safeContext.notificationKey) {\n container.resolve(NotificationService).fulfillNotification(safeContext.notificationKey, NotificationUtil.wrapErrorNotificationMessage(errorMessage, error), 'error');\n }\n },\n onMutate: async (variables) => {\n const previousItem = previousItemRef.current;\n if (!previousItem) {\n throw new Error('previousItem is not set');\n }\n const notificationKey = container.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(previousItem, variables),\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(variables)) {\n const intermediateItem = getIntermediateItem ? getIntermediateItem(variables, previousItem) : {\n ...variables,\n id: (previousItem as GenericData).id,\n } as GenericData;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return oldItems.map(x => x.id === (previousItem as GenericData).id ? intermediateItem : x) as GenericData[];\n });\n return { item: previousItem, notificationKey, previousData };\n }\n }\n return { item: previousItem, notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n previousItemRef.current = undefined;\n if (resourceQueryKey && Array.isArray(context?.previousData) && isSingleGenericData(item)) {\n const previousItemId = (context.item as GenericData)?.id;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return oldItems.map(oldItem => oldItem.id === previousItemId ? item : oldItem);\n });\n }\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n container.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,IAAMC,KAAuB,MAA2D,CAAC,MAAM,QAAQC,CAAI,GAE9FC,KAAkF,EAC7F,yBACA,gCACA,wBACA,mCACA,kCACA,YACA,cACA,YACA,0BAC6C;CAC7C,IAAMC,IAAcC,EAAU,QAAQC,CAAkB,CAAC,CAAC,aACpDC,IAAkBC,EAAc,KAAA,CAAS,GAEzCC,IAAkBC,GAAa,MAAgB;EACnD,EAAgB,UAAUR;CAC5B,GAAG,CAAC,CAAC,GAECS,IAAaD,EAAY,OAAO,MAA0B;EAC9D,IAAI,CAACE,GACH,MAAU,MAAM,mCAAmC;EAErD,OAAOA,EAAQC,EAAW,wBAAwBC,CAAS,GAAGP,EAAgB,OAAO;CACvF,GAAG,CAACA,GAAiBK,CAAO,CAAC,GAEvBG,IAAef,EAAkE;EACrF;EACA,SAAS,OAAO,GAAO,GAAW,MAAY;GAC5C,EAAgB,UAAU,KAAA;GAC1B,IAAMgB,IAA0CC,KAAW,CAAC;GAK5D,AAJIC,KAAoB,MAAM,QAAQF,EAAY,YAAY,KAC5DZ,EAAY,aAAsBc,GAAkBF,EAAY,YAAY,GAE9E,MAAMX,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBa,CAAoB,GAChFC,KACF,MAAMA,EAAQC,GAAOP,GAAWE,CAAW;GAE7C,IAAMM,IAAeN,EAAY,OAC7BO,EAA4BP,EAAY,MAAMF,GAAWO,CAAK,IAC9D,OAAOA,CAAK;GAChB,AAAIL,EAAY,mBACdX,EAAU,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBR,EAAY,iBAAiBS,EAAiB,6BAA6BH,GAAcD,CAAK,GAAG,OAAO;EAEvK;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMK,IAAenB,EAAgB;GACrC,IAAI,CAACmB,GACH,MAAU,MAAM,yBAAyB;GAE3C,IAAMC,IAAkBtB,EAAU,QAAQmB,CAAmB,CAAC,CAAC,iBAAiB;IAC9E,WAAW;IACX,SAASI,EAA+BF,GAAcZ,CAAS;IAC/D,UAAU;GACZ,CAAC;GACD,IAAII,GAAkB;IACpB,MAAMd,EAAY,cAAc,EAAE,UAAUc,EAAiB,CAAC;IAC9D,IAAMW,IAAezB,EAAY,aAAsBc,CAAgB;IAEvE,IAAI,MAAM,QAAQW,CAAY,KAAK,CAAC,MAAM,QAAQf,CAAS,GAAG;KAC5D,IAAMgB,IAAmBC,IAAsBA,EAAoBjB,GAAWY,CAAY,IAAI;MAC5F,GAAGZ;MACH,IAAKY,EAA6B;KACpC;KAIA,OAHAtB,EAAY,aAA4Bc,IAAmB,MAClDc,EAAS,KAAI,MAAKC,EAAE,OAAQP,EAA6B,KAAKI,IAAmBG,CAAC,CAC1F,GACM;MAAE,MAAMP;MAAc;MAAiB;KAAa;IAC7D;GACF;GACA,OAAO;IAAE,MAAMA;IAAc;GAAgB;EAC/C;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAE7C,IADA,EAAgB,UAAU,KAAA,GACtBR,KAAoB,MAAM,QAAQD,GAAS,YAAY,KAAKhB,EAAoBC,CAAI,GAAG;IACzF,IAAMgC,IAAkBjB,EAAQ,MAAsB;IACtD,EAAY,aAA4BC,IAAmB,MACpD,MAAM,QAAQc,CAAQ,IAGpBA,EAAS,KAAI,MAAWG,EAAQ,OAAOD,IAAiBhC,IAAOiC,CAAO,IAFpEH,CAGV;GACH;GAKA,AAJA,MAAM3B,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBa,CAAoB,GAChFiB,KACF,MAAMA,EAAUlC,GAAMY,GAAWG,CAAO,GAE1CZ,EAAU,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBP,EAAQ,iBAAiBoB,EAA8BnC,GAAMe,CAAO,GAAG,SAAS;EAC7I;CACF,CAAC,GAGKqB,IAASC,QAAcxB,EAAa,QAAQ,CAACA,EAAa,MAAM,CAAC,GACjEyB,IAAaD,QAAcxB,EAAa,WAAW,CAACA,EAAa,SAAS,CAAC;CACjF,OAAOwB,SAAe;EAAE;EAAY;EAAQ;CAAgB,IAAI;EAACC;EAAYF;EAAQ7B;CAAe,CAAC;AACvG"}
|
|
@@ -2,7 +2,7 @@ import { t as e } from "../../_chunks/TableUtil.js";
|
|
|
2
2
|
import { DEFAULT_FILTER_GROUP as t } from "../../classes/abstracts/FilterAbstract/index.js";
|
|
3
3
|
import { t as n } from "../../_chunks/react.js";
|
|
4
4
|
import { useEffect as r } from "react";
|
|
5
|
-
|
|
5
|
+
// src/hooks/useInitializeTableStore/useInitializeTableStore.ts
|
|
6
6
|
var i = ({ columns: i, context: a, createFiltersFromColumns: o, rows: s, store: c }) => {
|
|
7
7
|
let l = n(c, (e) => e.setColumns), u = n(c, (e) => e.setBaseData), d = n(c, (e) => e.setFilters), f = n(c, (e) => e.initialize);
|
|
8
8
|
r(() => {
|
|
@@ -22,7 +22,6 @@ var i = ({ columns: i, context: a, createFiltersFromColumns: o, rows: s, store:
|
|
|
22
22
|
a
|
|
23
23
|
]);
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { i as useInitializeTableStore };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as e } from "../../_chunks/
|
|
2
|
-
import { t } from "../../_chunks/
|
|
1
|
+
import { t as e } from "../../_chunks/useQueryMemo.js";
|
|
2
|
+
import { t } from "../../_chunks/QueryClientService.js";
|
|
3
3
|
import { container as n } from "tsyringe";
|
|
4
4
|
import { useEffect as r, useMemo as i, useState as a } from "react";
|
|
5
|
-
|
|
5
|
+
// src/hooks/useItemQuery/useItemQuery.ts
|
|
6
6
|
var o = [
|
|
7
7
|
"added",
|
|
8
8
|
"removed",
|
|
9
9
|
"updated"
|
|
10
10
|
], s = ({ baseQueryKey: s, itemId: c, useQueryOptions: l }) => {
|
|
11
|
-
let { queryCache: u } = n.resolve(
|
|
11
|
+
let { queryCache: u } = n.resolve(t), [d, f] = a(n.resolve(t).getItemFromCache(s, c)), p = e({
|
|
12
12
|
...l,
|
|
13
13
|
enabled: !d && l.enabled,
|
|
14
|
-
queryKey: n.resolve(
|
|
14
|
+
queryKey: n.resolve(t).getGenericKey(s, c)
|
|
15
15
|
});
|
|
16
16
|
return r(() => {
|
|
17
17
|
let e = u.subscribe((e) => {
|
|
@@ -56,7 +56,6 @@ var o = [
|
|
|
56
56
|
p.error
|
|
57
57
|
]);
|
|
58
58
|
};
|
|
59
|
-
//#endregion
|
|
60
59
|
export { s as useItemQuery };
|
|
61
60
|
|
|
62
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useQueryMemo","eventTypes","useItemQuery","container","QueryClientService","itemFromCache","setItemFromCache","useState","baseQueryKey","itemId","useQueryResult","useQueryOptions","useEffect","removeListener","queryCache","event","list","newValue","item","useMemo"],"sources":["../../../src/hooks/useItemQuery/useItemQuery.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport {\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type {\n QueryCacheNotifyEvent,\n UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { GenericData } from '../../models/data.models';\nimport { useQueryMemo } from '../useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UseItemQueryProps<T extends GenericData, TQueryKey extends string = string> = {\n readonly baseQueryKey: TQueryKey;\n readonly itemId: string;\n readonly useQueryOptions: Omit<UseQueryOptions<T>, 'queryKey'>;\n};\n\nconst eventTypes: QueryCacheNotifyEvent['type'][] = ['added', 'removed', 'updated'];\n\nexport const useItemQuery = <T extends GenericData>({\n baseQueryKey,\n itemId,\n useQueryOptions,\n}: UseItemQueryProps<T>) => {\n const { queryCache } = container.resolve(QueryClientService);\n const [itemFromCache, setItemFromCache] = useState<T>(container.resolve(QueryClientService).getItemFromCache<T>(baseQueryKey, itemId));\n\n const useQueryResult = useQueryMemo({\n ...useQueryOptions,\n enabled: !itemFromCache && useQueryOptions.enabled,\n queryKey: container.resolve(QueryClientService).getGenericKey(baseQueryKey, itemId),\n });\n\n useEffect(() => {\n const handleQueryCacheEvent = (event: QueryCacheNotifyEvent) => {\n if (Array.isArray(event.query.queryKey) && event.query.queryKey[0] === baseQueryKey && eventTypes.includes(event.type)) {\n if (event.query.queryKey.length === 1) {\n const list = (event.query.state.data as T[]);\n if (event.type === 'removed') {\n setItemFromCache(undefined);\n return;\n }\n if (!list) {\n return;\n }\n const newValue = list?.find(item => item.id === itemId);\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n } else if (event.query.queryKey.length === 2 && (event.query.state.data as T)?.id === itemId) {\n const newValue = event.query.state.data as T;\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n }\n }\n };\n\n const removeListener = queryCache.subscribe(handleQueryCacheEvent);\n return () => {\n removeListener();\n };\n }, [baseQueryKey, itemId, queryCache, itemFromCache]);\n\n\n const result = useMemo(() => {\n return {\n data: itemFromCache || useQueryResult.data,\n error: itemFromCache ? false : useQueryResult.error,\n isEnabled: itemFromCache ? true : useQueryResult.isEnabled,\n isFetching: itemFromCache ? false : useQueryResult.isFetching,\n isLoading: itemFromCache ? false : useQueryResult.isLoading,\n isPending: itemFromCache ? false : useQueryResult.isPending,\n };\n }, [itemFromCache, useQueryResult.data, useQueryResult.isLoading, useQueryResult.isPending, useQueryResult.isFetching, useQueryResult.isEnabled, useQueryResult.error]);\n\n return result;\n};\n"],"mappings":";;;;;AAqBA,IAAMC,IAA8C;CAAC;CAAS;CAAW;AAAS,GAErEC,KAAuC,EAClD,iBACA,WACA,yBAC0B;CAC1B,IAAM,EAAE,kBAAeC,EAAU,QAAQC,CAAkB,GACrD,CAACC,GAAeC,KAAoBC,EAAYJ,EAAU,QAAQC,CAAkB,CAAC,CAAC,iBAAoBI,GAAcC,CAAM,CAAC,GAE/HC,IAAiBV,EAAa;EAClC,GAAGW;EACH,SAAS,CAACN,KAAiBM,EAAgB;EAC3C,UAAUR,EAAU,QAAQC,CAAkB,CAAC,CAAC,cAAcI,GAAcC,CAAM;CACpF,CAAC;CA6CD,OA3CAG,QAAgB;EAyBd,IAAMC,IAAiBC,EAAW,WAxBH,MAAiC;GAC9D,IAAI,MAAM,QAAQC,EAAM,MAAM,QAAQ,KAAKA,EAAM,MAAM,SAAS,OAAOP,KAAgBP,EAAW,SAASc,EAAM,IAAI,GAAG;IACtH,IAAIA,EAAM,MAAM,SAAS,WAAW,GAAG;KACrC,IAAMC,IAAQD,EAAM,MAAM,MAAM;KAChC,IAAIA,EAAM,SAAS,WAAW;MAC5B,EAAiB,KAAA,CAAS;MAC1B;KACF;KACA,IAAI,CAACC,GACH;KAEF,IAAMC,IAAWD,GAAM,MAAK,MAAQE,EAAK,OAAOT,CAAM;KACtD,AAAI,KAAK,UAAUJ,CAAa,MAAM,KAAK,UAAUY,CAAQ,KAC3DX,EAAiBW,CAAQ;IAE7B,OAAO,IAAIF,EAAM,MAAM,SAAS,WAAW,KAAMA,EAAM,MAAM,MAAM,MAAY,OAAON,GAAQ;KAC5F,IAAMQ,IAAWF,EAAM,MAAM,MAAM;KACnC,AAAI,KAAK,UAAUV,CAAa,MAAM,KAAK,UAAUY,CAAQ,KAC3DX,EAAiBW,CAAQ;IAE7B;GACF;EACF,CAEiE;EACjE,aAAa;GACX,EAAe;EACjB;CACF,GAAG;EAACT;EAAcC;EAAQK;EAAYT;CAAa,CAAC,GAGrCc,SACN;EACL,MAAMd,KAAiBK,EAAe;EACtC,OAAO,MAAwBA,EAAe;EAC9C,WAAWL,IAAgB,KAAOK,EAAe;EACjD,YAAY,MAAwBA,EAAe;EACnD,WAAW,MAAwBA,EAAe;EAClD,WAAW,MAAwBA,EAAe;CACpD,IACC;EAACL;EAAeK,EAAe;EAAMA,EAAe;EAAWA,EAAe;EAAWA,EAAe;EAAYA,EAAe;EAAWA,EAAe;CAAK,CAE9J;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BreadcrumbService as e } from "../../classes/services/BreadcrumbService/index.js";
|
|
2
2
|
import { container as t } from "tsyringe";
|
|
3
3
|
import { useCallback as n, useEffect as r } from "react";
|
|
4
|
-
|
|
4
|
+
// src/hooks/useUpdateBreadcrumb/useUpdateBreadcrumb.ts
|
|
5
5
|
var i = (i) => {
|
|
6
6
|
let a = n((n) => {
|
|
7
7
|
t.resolve(e).update(i, n);
|
|
@@ -10,7 +10,6 @@ var i = (i) => {
|
|
|
10
10
|
t.resolve(e).remove(i);
|
|
11
11
|
}, [i]), a;
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { i as useUpdateBreadcrumb };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useConfig as e } from "../useConfig/index.js";
|
|
2
2
|
import { useEffect as t } from "react";
|
|
3
|
-
|
|
3
|
+
// src/hooks/useUpdateDocumentTitle/useUpdateDocumentTitle.ts
|
|
4
4
|
var n = (n) => {
|
|
5
5
|
let r = e();
|
|
6
6
|
t(() => {
|
|
7
7
|
document.title = `${r.applicationName} - ${n}`;
|
|
8
8
|
}, [r.applicationName, n]);
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { n as useUpdateDocumentTitle };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
package/dist/locale/en.json
CHANGED
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"Enable all with data": "Enable all with data",
|
|
115
115
|
"Error": "Error",
|
|
116
116
|
"Error anonymizing user: {{userName}}": "Error anonymizing user: {{userName}}",
|
|
117
|
+
"Error loading organization admins": "Error loading organization admins",
|
|
117
118
|
"Execute": "Execute",
|
|
118
119
|
"Expected end: ": "Expected end: ",
|
|
119
120
|
"Expected start: ": "Expected start: ",
|
package/dist/locale/nl.json
CHANGED
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"Enable all with data": "Alles met data inschakelen",
|
|
115
115
|
"Error": "Fout",
|
|
116
116
|
"Error anonymizing user: {{userName}}": "Fout bij anonimiseren van gebruiker: {{userName}}",
|
|
117
|
+
"Error loading organization admins": "Fout bij het laden van de organisatiebeheerders",
|
|
117
118
|
"Execute": "Uitvoeren",
|
|
118
119
|
"Expected end: ": "Verwacht einde: ",
|
|
119
120
|
"Expected start: ": "Verwachte start: ",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/models/admin.models.ts
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
3
|
return e.ACCESS_RIGHTS = "ACCESS_RIGHTS", e.HELPERS = "HELPERS", e.REFERENCE_DATA = "REFERENCE_DATA", e.SYSTEM = "SYSTEM", e.USERS_AND_ORGANIZATIONS = "USERS_AND_ORGANIZATIONS", e;
|
|
4
4
|
}({});
|
|
5
|
-
//#endregion
|
|
6
5
|
export { e as ADMIN_PAGE_CATEGORY };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=admin.models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.models.js","names":["ADMIN_PAGE_CATEGORY","\"ACCESS_RIGHTS\"","\"HELPERS\"","\"REFERENCE_DATA\"","\"SYSTEM\"","\"USERS_AND_ORGANIZATIONS\""],"sources":["../../src/models/admin.models.ts"],"sourcesContent":["export enum ADMIN_PAGE_CATEGORY {\n ACCESS_RIGHTS = 'ACCESS_RIGHTS',\n HELPERS = 'HELPERS',\n REFERENCE_DATA = 'REFERENCE_DATA',\n SYSTEM = 'SYSTEM',\n USERS_AND_ORGANIZATIONS = 'USERS_AND_ORGANIZATIONS',\n}\n"],"mappings":";AAAA,IAAYA,IAAL,yBAAA,GAAA;
|
|
1
|
+
{"version":3,"file":"admin.models.js","names":["ADMIN_PAGE_CATEGORY","\"ACCESS_RIGHTS\"","\"HELPERS\"","\"REFERENCE_DATA\"","\"SYSTEM\"","\"USERS_AND_ORGANIZATIONS\""],"sources":["../../src/models/admin.models.ts"],"sourcesContent":["export enum ADMIN_PAGE_CATEGORY {\n ACCESS_RIGHTS = 'ACCESS_RIGHTS',\n HELPERS = 'HELPERS',\n REFERENCE_DATA = 'REFERENCE_DATA',\n SYSTEM = 'SYSTEM',\n USERS_AND_ORGANIZATIONS = 'USERS_AND_ORGANIZATIONS',\n}\n"],"mappings":";AAAA,IAAYA,IAAL,yBAAA,GAAA;C,OACL,EAAAC,gBAAA,iBACA,EAAAC,UAAA,WACA,EAAAC,iBAAA,kBACA,EAAAC,SAAA,UACA,EAAAC,0BAAA,2B;AACF,EAAA,CAAA,CAAA"}
|