@plumile/backoffice-react 0.1.107 → 0.1.109
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/lib/esm/auth/TotpQrCode.js +1 -1
- package/lib/esm/auth/TotpQrCode.js.map +1 -1
- package/lib/esm/auth/login/EmailCapturePanel.js +27 -23
- package/lib/esm/auth/login/EmailCapturePanel.js.map +1 -1
- package/lib/esm/auth/login/MfaChallengeForm.js +38 -36
- package/lib/esm/auth/login/MfaChallengeForm.js.map +1 -1
- package/lib/esm/auth/login/PasskeyLoginForm.js +40 -37
- package/lib/esm/auth/login/PasskeyLoginForm.js.map +1 -1
- package/lib/esm/auth/pages/AcceptInvitationScreen.js +63 -62
- package/lib/esm/auth/pages/AcceptInvitationScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js +56 -55
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js +45 -45
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js.map +1 -1
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js +1 -0
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js +44 -39
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeCopyButton.js +15 -0
- package/lib/esm/components/backoffice/detail/BackofficeCopyButton.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailActionBar.js +11 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailActionBar.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailBlock.js +7 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailBlock.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailHeader.js +15 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailHeader.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailPage.js +19 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailPage.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js +47 -40
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js +83 -90
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailTable.js +8 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailTable.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeEmptyValue.js +7 -0
- package/lib/esm/components/backoffice/detail/BackofficeEmptyValue.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js +8 -0
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js.map +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeTechnicalFacts.js +2 -0
- package/lib/esm/components/backoffice/filters/EntityFilterValue.js +16 -8
- package/lib/esm/components/backoffice/filters/EntityFilterValue.js.map +1 -1
- package/lib/esm/components/backoffice/filters/EntityIdFilterField.js +85 -53
- package/lib/esm/components/backoffice/filters/EntityIdFilterField.js.map +1 -1
- package/lib/esm/components/backoffice/filters/entityIdFilterField.css.js +2 -2
- package/lib/esm/components/backoffice/filters/entityIdFilterField.css.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js +53 -48
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js +2 -2
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.js +15 -11
- package/lib/esm/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js +50 -23
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js.map +1 -1
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js +69 -69
- package/lib/esm/components/backoffice/layout/sidebarUtils.js +16 -16
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js +29 -0
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js.map +1 -0
- package/lib/esm/components/backoffice/links/BackofficeLink.js +21 -0
- package/lib/esm/components/backoffice/links/BackofficeLink.js.map +1 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkContent.js +26 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkContent.js.map +1 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkLabel.js +19 -0
- package/lib/esm/components/backoffice/links/BackofficeLinkLabel.js.map +1 -0
- package/lib/esm/components/backoffice/links/backofficeLink.css.js +7 -0
- package/lib/esm/components/backoffice/links/backofficeLink.css.js.map +1 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js +81 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js.map +1 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js +50 -0
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js.map +1 -0
- package/lib/esm/components/backoffice/links/types.js +0 -0
- package/lib/esm/components/backoffice/links/useBackofficeLink.js +21 -0
- package/lib/esm/components/backoffice/links/useBackofficeLink.js.map +1 -0
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js +1 -0
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js +2 -2
- package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/shared/EntityPickerList.js +27 -21
- package/lib/esm/components/backoffice/pickers/shared/EntityPickerList.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeEntityIdRef.js +27 -27
- package/lib/esm/components/backoffice/refs/BackofficeEntityIdRef.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeEntityLink.js +24 -21
- package/lib/esm/components/backoffice/refs/BackofficeEntityLink.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js +45 -44
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +277 -227
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/shared/BackofficeFilterableCell.js +25 -30
- package/lib/esm/components/backoffice/shared/BackofficeFilterableCell.js.map +1 -1
- package/lib/esm/i18n/locales/en/backofficeReact.js +8 -0
- package/lib/esm/i18n/locales/en/backofficeReact.js.map +1 -1
- package/lib/esm/i18n/locales/fr/backofficeReact.js +8 -0
- package/lib/esm/i18n/locales/fr/backofficeReact.js.map +1 -1
- package/lib/esm/index.js +88 -73
- package/lib/esm/pages/BackofficeDashboardPage.js +1 -5
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +231 -222
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js +170 -54
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +196 -207
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/BackofficeHubPage.js +21 -21
- package/lib/esm/pages/BackofficeLayoutPage.js +7 -7
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/router/createBackofficeRoutes.js +132 -126
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/types/auth/login/EmailCapturePanel.d.ts.map +1 -1
- package/lib/types/auth/login/MfaChallengeForm.d.ts.map +1 -1
- package/lib/types/auth/login/PasskeyLoginForm.d.ts.map +1 -1
- package/lib/types/auth/pages/AcceptInvitationScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/PasswordResetCompleteScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/PasswordResetRequestScreen.d.ts.map +1 -1
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts +0 -1
- package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeCopyButton.d.ts +8 -0
- package/lib/types/components/backoffice/detail/BackofficeCopyButton.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailActionBar.d.ts +9 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailActionBar.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailBlock.d.ts +7 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailBlock.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailHeader.d.ts +12 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailHeader.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.d.ts +16 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.stories.d.ts +11 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailPage.stories.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationListBlock.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailTable.d.ts +6 -0
- package/lib/types/components/backoffice/detail/BackofficeDetailTable.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeEmptyValue.d.ts +7 -0
- package/lib/types/components/backoffice/detail/BackofficeEmptyValue.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts +8 -0
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts.map +1 -0
- package/lib/types/components/backoffice/detail/BackofficeTechnicalFacts.d.ts +2 -0
- package/lib/types/components/backoffice/detail/BackofficeTechnicalFacts.d.ts.map +1 -0
- package/lib/types/components/backoffice/filters/EntityFilterValue.d.ts +5 -1
- package/lib/types/components/backoffice/filters/EntityFilterValue.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/EntityIdFilterField.d.ts +1 -0
- package/lib/types/components/backoffice/filters/EntityIdFilterField.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/entityIdFilterField.css.d.ts +5 -2
- package/lib/types/components/backoffice/filters/entityIdFilterField.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.d.ts +1 -0
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts +10 -8
- package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/types.d.ts +10 -5
- package/lib/types/components/backoffice/layout/breadcrumb/types.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +6 -2
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts +18 -0
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts +13 -0
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/BackofficeLinkContent.d.ts +10 -0
- package/lib/types/components/backoffice/links/BackofficeLinkContent.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/BackofficeLinkLabel.d.ts +12 -0
- package/lib/types/components/backoffice/links/BackofficeLinkLabel.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/backofficeLink.css.d.ts +4 -0
- package/lib/types/components/backoffice/links/backofficeLink.css.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts +15 -0
- package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/resolveBackofficeTargetIcon.d.ts +8 -0
- package/lib/types/components/backoffice/links/resolveBackofficeTargetIcon.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/types.d.ts +45 -0
- package/lib/types/components/backoffice/links/types.d.ts.map +1 -0
- package/lib/types/components/backoffice/links/useBackofficeLink.d.ts +7 -0
- package/lib/types/components/backoffice/links/useBackofficeLink.d.ts.map +1 -0
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/entityIdPickerDialog.css.d.ts +2 -0
- package/lib/types/components/backoffice/pickers/entityIdPickerDialog.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/shared/EntityPickerList.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeEntityLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeRelatedCountLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
- package/lib/types/components/backoffice/shared/BackofficeFilterableCell.d.ts +6 -3
- package/lib/types/components/backoffice/shared/BackofficeFilterableCell.d.ts.map +1 -1
- package/lib/types/i18n/resources.d.ts +16 -0
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/index.d.ts +24 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts +49 -22
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
- package/lib/types/provider/types.d.ts +26 -22
- package/lib/types/provider/types.d.ts.map +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts +36 -1
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,65 +1,66 @@
|
|
|
1
1
|
import { useBackofficeReactTranslation as e } from "../../../i18n/useBackofficeReactTranslation.js";
|
|
2
2
|
import { useBackofficeConfig as t } from "../../../provider/BackofficeConfigContext.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { resolveBackofficeLink as n } from "../links/resolveBackofficeLink.js";
|
|
4
|
+
import { BackofficeInlineLink as r } from "../links/BackofficeInlineLink.js";
|
|
5
|
+
import { count as i, icon as a, link as o } from "./backofficeRelatedCountLink.css.js";
|
|
6
|
+
import { useContext as s } from "react";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
import { useTranslation as l } from "react-i18next";
|
|
9
|
+
import { RoutingContext as u } from "@plumile/router";
|
|
10
|
+
import { buildBackofficeListLink as d } from "@plumile/backoffice-core/state/buildListHref.js";
|
|
9
11
|
//#region src/components/backoffice/refs/BackofficeRelatedCountLink.tsx
|
|
10
|
-
var
|
|
11
|
-
let { t:
|
|
12
|
-
typeof
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
var f = ({ count: f, entity: p, where: m }) => {
|
|
13
|
+
let { t: h } = l(), { t: g } = e(), { entities: _, entityManifest: v, entityRegistry: y, sidebar: b } = t(), x = s(u), S = 0;
|
|
14
|
+
typeof f == "number" && Number.isFinite(f) && (S = f);
|
|
15
|
+
let C = _[p];
|
|
16
|
+
if (C == null) return /* @__PURE__ */ c("span", { children: S });
|
|
17
|
+
let w = g("relations.openFilteredList", { label: C.label(h) }), T = y.getLoadedListEntity(p), E = {
|
|
18
|
+
kind: "entity-list",
|
|
19
|
+
entityId: p,
|
|
20
|
+
state: { where: m }
|
|
21
|
+
}, D = async (e) => {
|
|
22
|
+
let t = d((await y.loadListEntity(p)).config, { where: m }), n = "";
|
|
19
23
|
t.search !== "" && (n = `?${t.search}`), e.push({
|
|
20
24
|
pathname: t.pathname,
|
|
21
25
|
search: n,
|
|
22
26
|
hash: ""
|
|
23
27
|
});
|
|
24
28
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
className:
|
|
28
|
-
title:
|
|
29
|
-
|
|
29
|
+
return /* @__PURE__ */ c(r, {
|
|
30
|
+
target: E,
|
|
31
|
+
className: o,
|
|
32
|
+
title: w,
|
|
33
|
+
ariaLabel: w,
|
|
30
34
|
onClick: (e) => {
|
|
31
|
-
if (
|
|
35
|
+
if (T != null || x == null || e.defaultPrevented || e.button !== 0 || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
32
36
|
e.preventDefault();
|
|
33
|
-
let { history: t } =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
T.search !== "" && (e = `?${T.search}`), t.push({
|
|
46
|
-
pathname: T.pathname,
|
|
47
|
-
search: e,
|
|
48
|
-
hash: ""
|
|
37
|
+
let { history: t } = x;
|
|
38
|
+
D(t).catch(() => {
|
|
39
|
+
let e = n({
|
|
40
|
+
target: E,
|
|
41
|
+
manifest: v,
|
|
42
|
+
sidebar: b,
|
|
43
|
+
tApp: h
|
|
44
|
+
}), r = new URL(e.href, window.location.origin);
|
|
45
|
+
t.push({
|
|
46
|
+
pathname: r.pathname,
|
|
47
|
+
search: r.search,
|
|
48
|
+
hash: r.hash
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
},
|
|
52
|
-
|
|
53
|
-
className:
|
|
54
|
-
children: x
|
|
55
|
-
}), /* @__PURE__ */ o("span", {
|
|
56
|
-
className: r,
|
|
52
|
+
endAdornment: /* @__PURE__ */ c("span", {
|
|
53
|
+
className: a,
|
|
57
54
|
"aria-hidden": "true",
|
|
58
55
|
children: "›"
|
|
59
|
-
})
|
|
56
|
+
}),
|
|
57
|
+
children: /* @__PURE__ */ c("span", {
|
|
58
|
+
className: i,
|
|
59
|
+
children: S
|
|
60
|
+
})
|
|
60
61
|
});
|
|
61
62
|
};
|
|
62
63
|
//#endregion
|
|
63
|
-
export {
|
|
64
|
+
export { f as BackofficeRelatedCountLink, f as default };
|
|
64
65
|
|
|
65
66
|
//# sourceMappingURL=BackofficeRelatedCountLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeRelatedCountLink.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeRelatedCountLink.tsx"],"sourcesContent":["import { useContext, type JSX, type MouseEvent } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {
|
|
1
|
+
{"version":3,"file":"BackofficeRelatedCountLink.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeRelatedCountLink.tsx"],"sourcesContent":["import { useContext, type JSX, type MouseEvent } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { RoutingContext } from '@plumile/router';\n\nimport { buildBackofficeListLink } from '@plumile/backoffice-core/state/buildListHref.js';\nimport { useBackofficeConfig } from '../../../provider/BackofficeConfigContext.js';\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\nimport { BackofficeInlineLink } from '../links/BackofficeInlineLink.js';\nimport { resolveBackofficeLink } from '../links/resolveBackofficeLink.js';\nimport type { BackofficeLinkTarget } from '../links/types.js';\n\nimport * as styles from './backofficeRelatedCountLink.css.js';\n\nexport type BackofficeRelatedCountLinkProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = {\n count: number | null | undefined;\n entity: string;\n where: Where;\n};\n\nexport const BackofficeRelatedCountLink = <\n Where extends Record<string, unknown> = Record<string, unknown>,\n>({\n count,\n entity,\n where,\n}: BackofficeRelatedCountLinkProps<Where>): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities, entityManifest, entityRegistry, sidebar } =\n useBackofficeConfig();\n const routing = useContext(RoutingContext);\n let resolvedCount = 0;\n if (typeof count === 'number' && Number.isFinite(count)) {\n resolvedCount = count;\n }\n const targetManifest = entities[entity];\n if (targetManifest == null) {\n return <span>{resolvedCount}</span>;\n }\n const entityLabel = targetManifest.label(tApp);\n const actionLabel = t('relations.openFilteredList', {\n label: entityLabel,\n });\n const loadedEntity = entityRegistry.getLoadedListEntity(entity);\n const target = {\n kind: 'entity-list',\n entityId: entity,\n state: { where },\n } as BackofficeLinkTarget;\n\n const navigateWithLoadedEntity = async (\n history: NonNullable<typeof routing>['history'],\n ): Promise<void> => {\n const listEntity = await entityRegistry.loadListEntity(entity);\n const next = buildBackofficeListLink(listEntity.config, { where });\n\n let search = '';\n if (next.search !== '') {\n search = `?${next.search}`;\n }\n\n history.push({\n pathname: next.pathname,\n search,\n hash: '',\n });\n };\n\n const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {\n if (\n loadedEntity != null ||\n routing == null ||\n event.defaultPrevented ||\n event.button !== 0 ||\n event.metaKey ||\n event.altKey ||\n event.ctrlKey ||\n event.shiftKey\n ) {\n return;\n }\n\n event.preventDefault();\n const { history } = routing;\n navigateWithLoadedEntity(history).catch(() => {\n const link = resolveBackofficeLink({\n target,\n manifest: entityManifest,\n sidebar,\n tApp,\n });\n const fallbackUrl = new URL(link.href, window.location.origin);\n history.push({\n pathname: fallbackUrl.pathname,\n search: fallbackUrl.search,\n hash: fallbackUrl.hash,\n });\n });\n };\n\n return (\n <BackofficeInlineLink\n target={target}\n className={styles.link}\n title={actionLabel}\n ariaLabel={actionLabel}\n onClick={handleClick}\n endAdornment={\n <span className={styles.icon} aria-hidden=\"true\">\n ›\n </span>\n }\n >\n <span className={styles.count}>{resolvedCount}</span>\n </BackofficeInlineLink>\n );\n};\n\nexport default BackofficeRelatedCountLink;\n"],"mappings":";;;;;;;;;;;AAqBA,IAAa,KAEX,EACA,OAAA,GACA,WACA,eACyD;CACzD,IAAM,EAAE,GAAG,MAAS,GAAgB,EAC9B,EAAE,SAAM,GAA+B,EACvC,EAAE,aAAU,mBAAgB,mBAAgB,eAChD,GAAqB,EACjB,IAAU,EAAW,EAAe,EACtC,IAAgB;CACpB,AAAI,OAAO,KAAU,YAAY,OAAO,SAAS,EAAM,KACrD,IAAgB;CAElB,IAAM,IAAiB,EAAS;CAChC,IAAI,KAAkB,MACpB,OAAO,kBAAC,QAAD,EAAA,UAAO,GAAqB,CAAA;CAGrC,IAAM,IAAc,EAAE,8BAA8B,EAClD,OAFkB,EAAe,MAAM,EAEhC,EACR,CAAC,EACI,IAAe,EAAe,oBAAoB,EAAO,EACzD,IAAS;EACb,MAAM;EACN,UAAU;EACV,OAAO,EAAE,UAAO;EACjB,EAEK,IAA2B,OAC/B,MACkB;EAElB,IAAM,IAAO,GAAwB,MADZ,EAAe,eAAe,EAAO,EACd,QAAQ,EAAE,UAAO,CAAC,EAE9D,IAAS;EAKb,AAJI,EAAK,WAAW,OAClB,IAAS,IAAI,EAAK,WAGpB,EAAQ,KAAK;GACX,UAAU,EAAK;GACf;GACA,MAAM;GACP,CAAC;;CAmCJ,OACE,kBAAC,GAAD;EACU;EACR,WAAW;EACX,OAAO;EACP,WAAW;EACX,UAtCiB,MAAyC;GAC5D,IACE,KAAgB,QAChB,KAAW,QACX,EAAM,oBACN,EAAM,WAAW,KACjB,EAAM,WACN,EAAM,UACN,EAAM,WACN,EAAM,UAEN;GAGF,EAAM,gBAAgB;GACtB,IAAM,EAAE,eAAY;GACpB,EAAyB,EAAQ,CAAC,YAAY;IAC5C,IAAM,IAAO,EAAsB;KACjC;KACA,UAAU;KACV;KACA;KACD,CAAC,EACI,IAAc,IAAI,IAAI,EAAK,MAAM,OAAO,SAAS,OAAO;IAC9D,EAAQ,KAAK;KACX,UAAU,EAAY;KACtB,QAAQ,EAAY;KACpB,MAAM,EAAY;KACnB,CAAC;KACF;;EAUA,cACE,kBAAC,QAAD;GAAM,WAAW;GAAa,eAAY;aAAO;GAE1C,CAAA;YAGT,kBAAC,QAAD;GAAM,WAAW;aAAe;GAAqB,CAAA;EAChC,CAAA"}
|