@plumile/backoffice-react 0.1.171 → 0.1.172
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/authRefreshNotice.css.js +0 -1
- package/lib/esm/auth/login/loginPage.css.js +1 -0
- package/lib/esm/components/backoffice/filters/BackofficeFilterAction.js +9 -9
- package/lib/esm/components/backoffice/filters/DeferredFilterSearchInput.js +4 -4
- package/lib/esm/components/backoffice/list/RowFlagsCell.css.js +0 -1
- package/lib/esm/components/backoffice/refs/BackofficeLazyEntityCount.js +16 -15
- package/lib/esm/components/backoffice/refs/BackofficeLazyEntityCount.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js +43 -35
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js.map +1 -1
- package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +1 -0
- package/lib/esm/components/backoffice/refs/backofficeRelatedCountLink.css.js +2 -2
- package/lib/esm/components/backoffice/refs/backofficeRelatedCountLink.css.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +182 -182
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/i18n/locales/en/backofficeReact.js +1 -8
- package/lib/esm/i18n/locales/en/backofficeReact.js.map +1 -1
- package/lib/esm/i18n/locales/fr/backofficeReact.js +1 -9
- package/lib/esm/i18n/locales/fr/backofficeReact.js.map +1 -1
- package/lib/esm/index.js +22 -22
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js +138 -85
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +139 -183
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js +185 -203
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +33 -33
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/backofficeEntityDetailPage.css.js +2 -2
- package/lib/esm/pages/backofficeEntityDetailPage.css.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/types/components/backoffice/refs/BackofficeLazyEntityCount.d.ts +7 -5
- package/lib/types/components/backoffice/refs/BackofficeLazyEntityCount.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeRelatedCountLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/backofficeRelatedCountLink.css.d.ts +1 -0
- package/lib/types/components/backoffice/refs/backofficeRelatedCountLink.css.d.ts.map +1 -1
- package/lib/types/i18n/resources.d.ts +0 -15
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailLayoutPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts +2 -13
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -1
- package/lib/types/pages/backofficeEntityDetailPage.css.d.ts +1 -0
- package/lib/types/pages/backofficeEntityDetailPage.css.d.ts.map +1 -1
- package/package.json +6 -6
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js +0 -63
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js.map +0 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js +0 -134
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationLink.d.ts +0 -11
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationLink.d.ts.map +0 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationListBlock.d.ts +0 -10
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationListBlock.d.ts.map +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { useBackofficeReactTranslation as e } from "../../../i18n/useBackofficeReactTranslation.js";
|
|
2
2
|
import { useBackofficeConfig as t } from "../../../provider/BackofficeConfigContext.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { canFilterValue as n, resolveFilterForColumn as r, resolveFilterForWhereKey as i } from "../../../filters/filterHelpers.js";
|
|
4
|
+
import { useBackofficeListFilterContext as a } from "../scaffolds/BackofficeListFilterContext.js";
|
|
5
5
|
import { action as o, icon as s } from "./backofficeFilterAction.css.js";
|
|
6
6
|
import { jsx as c } from "react/jsx-runtime";
|
|
7
7
|
import { useTranslation as l } from "react-i18next";
|
|
8
8
|
import u from "@plumile/router/routing/Link.js";
|
|
9
9
|
import { buildBackofficeListLink as d } from "@plumile/backoffice-core/state/buildListHref.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { SidebarSearchSvg as f } from "@plumile/ui/icons/SidebarSearchSvg.js";
|
|
11
|
+
import { setWhereValue as p } from "@plumile/backoffice-core/filters/where.js";
|
|
12
12
|
//#region src/components/backoffice/filters/BackofficeFilterAction.tsx
|
|
13
13
|
var m = (e, t) => e(t), h = (h) => {
|
|
14
|
-
let { t: g } = l(), { t: _ } = e(), { filterColumnAliases: v } = t(), { whereKey: y, value: b, path: x, label: S, listConfig: C } = h, w =
|
|
14
|
+
let { t: g } = l(), { t: _ } = e(), { filterColumnAliases: v } = t(), { whereKey: y, value: b, path: x, label: S, listConfig: C } = h, w = a(), T = null;
|
|
15
15
|
if (C == null ? w != null && (T = w.config) : T = C, T == null) return null;
|
|
16
|
-
let E =
|
|
17
|
-
if (E == null && x == null && (E =
|
|
18
|
-
let D = m(E.label, g), O = S ?? _("filters.actions.filterBy", { label: D }), k = /* @__PURE__ */ c(
|
|
16
|
+
let E = i(T, y, x);
|
|
17
|
+
if (E == null && x == null && (E = r(T, y, v)), E == null || !n(E, b)) return null;
|
|
18
|
+
let D = m(E.label, g), O = S ?? _("filters.actions.filterBy", { label: D }), k = /* @__PURE__ */ c(f, {
|
|
19
19
|
width: 14,
|
|
20
20
|
height: 14,
|
|
21
21
|
className: s,
|
|
@@ -31,7 +31,7 @@ var m = (e, t) => e(t), h = (h) => {
|
|
|
31
31
|
},
|
|
32
32
|
children: k
|
|
33
33
|
});
|
|
34
|
-
let A =
|
|
34
|
+
let A = p(T.listDefaults?.where ?? T.list.defaultState?.where ?? null, y, b, x);
|
|
35
35
|
return /* @__PURE__ */ c(u, {
|
|
36
36
|
to: d(T, { where: A }),
|
|
37
37
|
className: o,
|
|
@@ -4,8 +4,8 @@ import { useEffect as a, useState as o } from "react";
|
|
|
4
4
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
5
|
import { Input as l } from "@plumile/ui/atomic/atoms/input/Input.js";
|
|
6
6
|
import { ModalCloseSvg as u } from "@plumile/ui/icons/ModalCloseSvg.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { SidebarSearchSvg as d } from "@plumile/ui/icons/SidebarSearchSvg.js";
|
|
8
|
+
import { CheckSvg as f } from "@plumile/ui/icons/CheckSvg.js";
|
|
9
9
|
//#region src/components/backoffice/filters/DeferredFilterSearchInput.tsx
|
|
10
10
|
var p = ({ value: p, placeholder: m, ariaLabel: h, className: g, inputMode: _ = "search", type: v = "text", onApply: y }) => {
|
|
11
11
|
let { t: b } = e(), [x, S] = o(p);
|
|
@@ -52,7 +52,7 @@ var p = ({ value: p, placeholder: m, ariaLabel: h, className: g, inputMode: _ =
|
|
|
52
52
|
"aria-label": O,
|
|
53
53
|
size: "small",
|
|
54
54
|
fullWidth: !0,
|
|
55
|
-
leftIcon: /* @__PURE__ */ s(
|
|
55
|
+
leftIcon: /* @__PURE__ */ s(d, {
|
|
56
56
|
width: 18,
|
|
57
57
|
height: 18,
|
|
58
58
|
"aria-hidden": "true"
|
|
@@ -66,7 +66,7 @@ var p = ({ value: p, placeholder: m, ariaLabel: h, className: g, inputMode: _ =
|
|
|
66
66
|
"aria-label": A,
|
|
67
67
|
title: A,
|
|
68
68
|
disabled: !E,
|
|
69
|
-
children: /* @__PURE__ */ s(
|
|
69
|
+
children: /* @__PURE__ */ s(f, {
|
|
70
70
|
width: 16,
|
|
71
71
|
height: 16,
|
|
72
72
|
"aria-hidden": "true"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
/* empty css */
|
|
3
2
|
//#region src/components/backoffice/list/RowFlagsCell.css.ts
|
|
4
3
|
var e = "txvbqb10m7 txvbqb11js txvbqb12h0 txvbqbxt3 txvbqbls4", t = "txvbqbfqq txvbqbey txvbqbls4 txvbqbi8n txvbqb19uf", n = "qbwcuex qbwcuer txvbqbfqq txvbqbey txvbqbls4 txvbqbh6d txvbqbo4m qbwcue11 qbwcuev txvbqb19h2 txvbqbjmh txvbqbvat txvbqbub2";
|
|
@@ -10,31 +10,32 @@ var o = "store-or-network", s = ({ count: e, where: t, fetchKey: n, children: s
|
|
|
10
10
|
fetchKey: n
|
|
11
11
|
}), u = e.getCount(l);
|
|
12
12
|
return u == null ? null : s == null ? /* @__PURE__ */ i(r, { children: u }) : /* @__PURE__ */ i(r, { children: s(u) });
|
|
13
|
-
}, c = ({
|
|
14
|
-
fallback: () => /* @__PURE__ */ i(r, { children:
|
|
13
|
+
}, c = ({ loadingFallback: t, errorFallback: a = null, ...o }) => /* @__PURE__ */ i(e, {
|
|
14
|
+
fallback: () => /* @__PURE__ */ i(r, { children: a }),
|
|
15
15
|
children: /* @__PURE__ */ i(n, {
|
|
16
16
|
fallback: t,
|
|
17
|
-
children: /* @__PURE__ */ i(s, { ...
|
|
17
|
+
children: /* @__PURE__ */ i(s, { ...o })
|
|
18
18
|
})
|
|
19
|
-
}), l = ({ entity: e,
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
let
|
|
23
|
-
return
|
|
24
|
-
count:
|
|
25
|
-
where:
|
|
19
|
+
}), l = ({ entity: e, loadingFallback: n, where: a }) => {
|
|
20
|
+
let o = t([e]);
|
|
21
|
+
if (o.status !== "loaded") return /* @__PURE__ */ i(r, { children: n });
|
|
22
|
+
let c = o.modules[e]?.config;
|
|
23
|
+
return c == null ? null : /* @__PURE__ */ i(s, {
|
|
24
|
+
count: c.list.count,
|
|
25
|
+
where: a
|
|
26
26
|
});
|
|
27
|
-
}, u = ({ entity: t, where:
|
|
28
|
-
fallback: () =>
|
|
27
|
+
}, u = ({ entity: t, errorFallback: a = null, loadingFallback: o, where: s }) => /* @__PURE__ */ i(e, {
|
|
28
|
+
fallback: () => /* @__PURE__ */ i(r, { children: a }),
|
|
29
29
|
children: /* @__PURE__ */ i(n, {
|
|
30
|
-
fallback:
|
|
30
|
+
fallback: o,
|
|
31
31
|
children: /* @__PURE__ */ i(l, {
|
|
32
32
|
entity: t,
|
|
33
|
-
|
|
33
|
+
loadingFallback: o,
|
|
34
|
+
where: s
|
|
34
35
|
})
|
|
35
36
|
})
|
|
36
37
|
});
|
|
37
38
|
//#endregion
|
|
38
|
-
export {
|
|
39
|
+
export { u as BackofficeLazyEntityCount, u as default, c as BackofficeLazyEntityCountLabel };
|
|
39
40
|
|
|
40
41
|
//# sourceMappingURL=BackofficeLazyEntityCount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeLazyEntityCount.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeLazyEntityCount.tsx"],"sourcesContent":["import { Suspense, type JSX, type ReactNode } from 'react';\nimport { useLazyLoadQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport type { BackofficeRuntimeEntityCountConfig } from '@plumile/backoffice-core/types.js';\n\nimport { useBackofficeListEntitiesLoader } from '../../../provider/useBackofficeEntityLoader.js';\nimport { BackofficeErrorBoundary } from '../errors/BackofficeErrorBoundary.js';\n\nconst COUNT_FETCH_POLICY = 'store-or-network' as const;\n\nexport type BackofficeLazyEntityCountProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = {\n entity: string;\n where: Where | null;\n};\n\
|
|
1
|
+
{"version":3,"file":"BackofficeLazyEntityCount.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeLazyEntityCount.tsx"],"sourcesContent":["import { Suspense, type JSX, type ReactNode } from 'react';\nimport { useLazyLoadQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport type { BackofficeRuntimeEntityCountConfig } from '@plumile/backoffice-core/types.js';\n\nimport { useBackofficeListEntitiesLoader } from '../../../provider/useBackofficeEntityLoader.js';\nimport { BackofficeErrorBoundary } from '../errors/BackofficeErrorBoundary.js';\n\nconst COUNT_FETCH_POLICY = 'store-or-network' as const;\n\nexport type BackofficeLazyEntityCountProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = {\n entity: string;\n where: Where | null;\n loadingFallback: ReactNode;\n errorFallback?: ReactNode;\n};\n\ntype BackofficeEntityCountValueProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = {\n count: BackofficeRuntimeEntityCountConfig<Where>;\n where: Where | null;\n fetchKey?: string | number;\n children?: (value: number) => ReactNode;\n};\n\nexport type BackofficeLazyEntityCountLabelProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = BackofficeEntityCountValueProps<Where> & {\n loadingFallback: ReactNode;\n errorFallback?: ReactNode;\n};\n\nconst BackofficeEntityCountValue = <\n Where extends Record<string, unknown> = Record<string, unknown>,\n>({\n count,\n where,\n fetchKey,\n children,\n}: BackofficeEntityCountValueProps<Where>): JSX.Element | null => {\n const variables = count.buildVariables({ where });\n const data = useLazyLoadQuery<OperationType>(count.query, variables, {\n fetchPolicy: COUNT_FETCH_POLICY,\n fetchKey,\n });\n const value = count.getCount(data);\n if (value == null) {\n return null;\n }\n if (children == null) {\n return <>{value}</>;\n }\n return <>{children(value)}</>;\n};\n\nexport const BackofficeLazyEntityCountLabel = <\n Where extends Record<string, unknown> = Record<string, unknown>,\n>({\n loadingFallback,\n errorFallback = null,\n ...props\n}: BackofficeLazyEntityCountLabelProps<Where>): JSX.Element => {\n return (\n <BackofficeErrorBoundary\n fallback={() => {\n return <>{errorFallback}</>;\n }}\n >\n <Suspense fallback={loadingFallback}>\n <BackofficeEntityCountValue {...props} />\n </Suspense>\n </BackofficeErrorBoundary>\n );\n};\n\nconst BackofficeLazyEntityCountBody = ({\n entity,\n loadingFallback,\n where,\n}: BackofficeLazyEntityCountProps): JSX.Element | null => {\n const relatedEntitiesState = useBackofficeListEntitiesLoader([entity]);\n if (relatedEntitiesState.status !== 'loaded') {\n return <>{loadingFallback}</>;\n }\n\n const config = relatedEntitiesState.modules[entity]?.config;\n if (config == null) {\n return null;\n }\n\n return <BackofficeEntityCountValue count={config.list.count} where={where} />;\n};\n\nexport const BackofficeLazyEntityCount = ({\n entity,\n errorFallback = null,\n loadingFallback,\n where,\n}: BackofficeLazyEntityCountProps): JSX.Element | null => {\n return (\n <BackofficeErrorBoundary\n fallback={() => {\n return <>{errorFallback}</>;\n }}\n >\n <Suspense fallback={loadingFallback}>\n <BackofficeLazyEntityCountBody\n entity={entity}\n loadingFallback={loadingFallback}\n where={where}\n />\n </Suspense>\n </BackofficeErrorBoundary>\n );\n};\n\nexport default BackofficeLazyEntityCount;\n"],"mappings":";;;;;;AASA,IAAM,IAAqB,oBA2BrB,KAEJ,EACA,UACA,UACA,aACA,kBACgE;CAChE,IAAM,IAAY,EAAM,eAAe,EAAE,SAAM,CAAC,GAC1C,IAAO,EAAgC,EAAM,OAAO,GAAW;EACnE,aAAa;EACb;CACF,CAAC,GACK,IAAQ,EAAM,SAAS,CAAI;CAOjC,OANI,KAAS,OACJ,OAEL,KAAY,OACP,kBAAA,GAAA,EAAA,UAAG,EAAQ,CAAA,IAEb,kBAAA,GAAA,EAAA,UAAG,EAAS,CAAK,EAAI,CAAA;AAC9B,GAEa,KAEX,EACA,oBACA,mBAAgB,MAChB,GAAG,QAGD,kBAAC,GAAD;CACE,gBACS,kBAAA,GAAA,EAAA,UAAG,EAAgB,CAAA;WAG5B,kBAAC,GAAD;EAAU,UAAU;YAClB,kBAAC,GAAD,EAA4B,GAAI,EAAQ,CAAA;CAChC,CAAA;AACa,CAAA,GAIvB,KAAiC,EACrC,WACA,oBACA,eACwD;CACxD,IAAM,IAAuB,EAAgC,CAAC,CAAM,CAAC;CACrE,IAAI,EAAqB,WAAW,UAClC,OAAO,kBAAA,GAAA,EAAA,UAAG,EAAkB,CAAA;CAG9B,IAAM,IAAS,EAAqB,QAAQ,IAAS;CAKrD,OAJI,KAAU,OACL,OAGF,kBAAC,GAAD;EAA4B,OAAO,EAAO,KAAK;EAAc;CAAQ,CAAA;AAC9E,GAEa,KAA6B,EACxC,WACA,mBAAgB,MAChB,oBACA,eAGE,kBAAC,GAAD;CACE,gBACS,kBAAA,GAAA,EAAA,UAAG,EAAgB,CAAA;WAG5B,kBAAC,GAAD;EAAU,UAAU;YAClB,kBAAC,GAAD;GACU;GACS;GACV;EACR,CAAA;CACO,CAAA;AACa,CAAA"}
|
|
@@ -3,48 +3,56 @@ import { useBackofficeConfig as t } from "../../../provider/BackofficeConfigCont
|
|
|
3
3
|
import { resolveBackofficeLink as n } from "../links/resolveBackofficeLink.js";
|
|
4
4
|
import { BackofficeInlineLink as r } from "../links/BackofficeInlineLink.js";
|
|
5
5
|
import { BackofficeLazyEntityCount as i } from "./BackofficeLazyEntityCount.js";
|
|
6
|
-
import { count as a,
|
|
7
|
-
import { useContext as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { useTranslation as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
6
|
+
import { count as a, countLoading as o, icon as s, link as c } from "./backofficeRelatedCountLink.css.js";
|
|
7
|
+
import { useContext as l } from "react";
|
|
8
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
9
|
+
import { useTranslation as d } from "react-i18next";
|
|
10
|
+
import { Spinner as f } from "@plumile/ui/backoffice/atoms/spinner/Spinner.js";
|
|
11
|
+
import p from "@plumile/router/routing/RoutingContext.js";
|
|
12
|
+
import { buildBackofficeListLink as m } from "@plumile/backoffice-core/state/buildListHref.js";
|
|
12
13
|
//#region src/components/backoffice/refs/BackofficeRelatedCountLink.tsx
|
|
13
|
-
var
|
|
14
|
-
let { t:
|
|
15
|
-
if (
|
|
16
|
-
let
|
|
17
|
-
entity:
|
|
18
|
-
|
|
14
|
+
var h = ({ count: h, entity: g, where: _ }) => {
|
|
15
|
+
let { t: v } = d(), { t: y } = e(), { entities: b, entityManifest: x, entityRegistry: S, sidebar: C } = t(), w = l(p), T = b[g];
|
|
16
|
+
if (T == null) return /* @__PURE__ */ u("span", { children: h ?? 0 });
|
|
17
|
+
let E = y("relations.openFilteredList", { label: T.label(v) }), D = y("common.loading"), O = S.getLoadedListEntity(g), k = /* @__PURE__ */ u(i, {
|
|
18
|
+
entity: g,
|
|
19
|
+
loadingFallback: /* @__PURE__ */ u("span", {
|
|
20
|
+
className: o,
|
|
21
|
+
children: /* @__PURE__ */ u(f, {
|
|
22
|
+
ariaLabel: D,
|
|
23
|
+
size: 12
|
|
24
|
+
})
|
|
25
|
+
}),
|
|
26
|
+
where: _
|
|
19
27
|
});
|
|
20
|
-
typeof
|
|
21
|
-
let
|
|
28
|
+
typeof h == "number" && Number.isFinite(h) && (k = h);
|
|
29
|
+
let A = {
|
|
22
30
|
kind: "entity-list",
|
|
23
|
-
entityId:
|
|
24
|
-
state: { where:
|
|
25
|
-
},
|
|
26
|
-
let t =
|
|
31
|
+
entityId: g,
|
|
32
|
+
state: { where: _ }
|
|
33
|
+
}, j = async (e) => {
|
|
34
|
+
let t = m((await S.loadListEntity(g)).config, { where: _ }), n = "";
|
|
27
35
|
t.search !== "" && (n = `?${t.search}`), e.push({
|
|
28
36
|
pathname: t.pathname,
|
|
29
37
|
search: n,
|
|
30
38
|
hash: ""
|
|
31
39
|
});
|
|
32
40
|
};
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
target:
|
|
35
|
-
className:
|
|
36
|
-
title:
|
|
37
|
-
ariaLabel:
|
|
41
|
+
return /* @__PURE__ */ u(r, {
|
|
42
|
+
target: A,
|
|
43
|
+
className: c,
|
|
44
|
+
title: E,
|
|
45
|
+
ariaLabel: E,
|
|
38
46
|
onClick: (e) => {
|
|
39
|
-
if (
|
|
47
|
+
if (O != null || w == null || e.defaultPrevented || e.button !== 0 || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
40
48
|
e.preventDefault();
|
|
41
|
-
let { history: t } =
|
|
42
|
-
|
|
49
|
+
let { history: t } = w;
|
|
50
|
+
j(t).catch(() => {
|
|
43
51
|
let e = n({
|
|
44
|
-
target:
|
|
45
|
-
manifest:
|
|
46
|
-
sidebar:
|
|
47
|
-
tApp:
|
|
52
|
+
target: A,
|
|
53
|
+
manifest: x,
|
|
54
|
+
sidebar: C,
|
|
55
|
+
tApp: v
|
|
48
56
|
}), r = new URL(e.href, window.location.origin);
|
|
49
57
|
t.push({
|
|
50
58
|
pathname: r.pathname,
|
|
@@ -53,18 +61,18 @@ var p = ({ count: p, entity: m, where: h }) => {
|
|
|
53
61
|
});
|
|
54
62
|
});
|
|
55
63
|
},
|
|
56
|
-
endAdornment: /* @__PURE__ */
|
|
57
|
-
className:
|
|
64
|
+
endAdornment: /* @__PURE__ */ u("span", {
|
|
65
|
+
className: s,
|
|
58
66
|
"aria-hidden": "true",
|
|
59
67
|
children: "›"
|
|
60
68
|
}),
|
|
61
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ u("span", {
|
|
62
70
|
className: a,
|
|
63
|
-
children:
|
|
71
|
+
children: k
|
|
64
72
|
})
|
|
65
73
|
});
|
|
66
74
|
};
|
|
67
75
|
//#endregion
|
|
68
|
-
export {
|
|
76
|
+
export { h as BackofficeRelatedCountLink, h as default };
|
|
69
77
|
|
|
70
78
|
//# 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, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\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';\nimport { BackofficeLazyEntityCount } from './BackofficeLazyEntityCount.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 const targetManifest = entities[entity];\n if (targetManifest == null) {\n return <span>{count ?? 0}</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 let countNode: ReactNode = (\n <BackofficeLazyEntityCount
|
|
1
|
+
{"version":3,"file":"BackofficeRelatedCountLink.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeRelatedCountLink.tsx"],"sourcesContent":["import { useContext, type JSX, type MouseEvent, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\n\nimport { buildBackofficeListLink } from '@plumile/backoffice-core/state/buildListHref.js';\nimport { Spinner } from '@plumile/ui/backoffice/atoms/spinner/Spinner.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';\nimport { BackofficeLazyEntityCount } from './BackofficeLazyEntityCount.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 const targetManifest = entities[entity];\n if (targetManifest == null) {\n return <span>{count ?? 0}</span>;\n }\n const entityLabel = targetManifest.label(tApp);\n const actionLabel = t('relations.openFilteredList', {\n label: entityLabel,\n });\n const loadingLabel = t('common.loading');\n const loadedEntity = entityRegistry.getLoadedListEntity(entity);\n let countNode: ReactNode = (\n <BackofficeLazyEntityCount\n entity={entity}\n loadingFallback={\n <span className={styles.countLoading}>\n <Spinner ariaLabel={loadingLabel} size={12} />\n </span>\n }\n where={where}\n />\n );\n if (typeof count === 'number' && Number.isFinite(count)) {\n countNode = count;\n }\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}>{countNode}</span>\n </BackofficeInlineLink>\n );\n};\n\nexport default BackofficeRelatedCountLink;\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAa,KAEX,EACA,OAAA,GACA,WACA,eACyD;CACzD,IAAM,EAAE,GAAG,MAAS,EAAe,GAC7B,EAAE,SAAM,EAA8B,GACtC,EAAE,aAAU,mBAAgB,mBAAgB,eAChD,EAAoB,GAChB,IAAU,EAAW,CAAc,GACnC,IAAiB,EAAS;CAChC,IAAI,KAAkB,MACpB,OAAO,kBAAC,QAAD,EAAA,UAAO,KAAS,EAAQ,CAAA;CAGjC,IAAM,IAAc,EAAE,8BAA8B,EAClD,OAFkB,EAAe,MAAM,CAEhC,EACT,CAAC,GACK,IAAe,EAAE,gBAAgB,GACjC,IAAe,EAAe,oBAAoB,CAAM,GAC1D,IACF,kBAAC,GAAD;EACU;EACR,iBACE,kBAAC,QAAD;GAAM,WAAW;aACf,kBAAC,GAAD;IAAS,WAAW;IAAc,MAAM;GAAK,CAAA;EACzC,CAAA;EAED;CACR,CAAA;CAEH,AAAI,OAAO,KAAU,YAAY,OAAO,SAAS,CAAK,MACpD,IAAY;CAEd,IAAM,IAAS;EACb,MAAM;EACN,UAAU;EACV,OAAO,EAAE,SAAM;CACjB,GAEM,IAA2B,OAC/B,MACkB;EAElB,IAAM,IAAO,GAAwB,MADZ,EAAe,eAAe,CAAM,GACb,QAAQ,EAAE,SAAM,CAAC,GAE7D,IAAS;EAKb,AAJI,EAAK,WAAW,OAClB,IAAS,IAAI,EAAK,WAGpB,EAAQ,KAAK;GACX,UAAU,EAAK;GACf;GACA,MAAM;EACR,CAAC;CACH;CAkCA,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,eAAe;GACrB,IAAM,EAAE,eAAY;GACpB,EAAyB,CAAO,EAAE,YAAY;IAC5C,IAAM,IAAO,EAAsB;KACjC;KACA,UAAU;KACV;KACA;IACF,CAAC,GACK,IAAc,IAAI,IAAI,EAAK,MAAM,OAAO,SAAS,MAAM;IAC7D,EAAQ,KAAK;KACX,UAAU,EAAY;KACtB,QAAQ,EAAY;KACpB,MAAM,EAAY;IACpB,CAAC;GACH,CAAC;EACH;EASI,cACE,kBAAC,QAAD;GAAM,WAAW;GAAa,eAAY;aAAO;EAE3C,CAAA;YAGR,kBAAC,QAAD;GAAM,WAAW;aAAe;EAAgB,CAAA;CAC5B,CAAA;AAE1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
//#region src/components/backoffice/refs/backofficeRelatedCountLink.css.ts
|
|
3
|
-
var e = "qbwcuem qbwcuek txvbqb10mk txvbqb11k5 txvbqb12hd txvbqbxtg txvbqbfqq txvbqbey txvbqbls4 txvbqbhd8 txvbqbvb6 txvbqb1bg1 txvbqb1b81 txvbqb1d9 txvbqb2sj txvbqb29r txvbqb2wi txvbqbhbf txvbqbo4m txvbqb3f txvbqb7g txvbqb75 txvbqb7t qbwcuel txvbqb1etp txvbqb1cst txvbqb1dth txvbqb1e2l qbwcue0 txvbqb1ffs txvbqb1ga0", t = "txvbqbv8n txvbqb18dp txvbqbh86", n = "kk18lv0 txvbqbh6d txvbqb1bg3 txvbqb9j txvbqbo4m txvbqb7h txvbqb75 txvbqb7t";
|
|
3
|
+
var e = "qbwcuem qbwcuek txvbqb10mk txvbqb11k5 txvbqb12hd txvbqbxtg txvbqbfqq txvbqbey txvbqbls4 txvbqbhd8 txvbqbvb6 txvbqb1bg1 txvbqb1b81 txvbqb1d9 txvbqb2sj txvbqb29r txvbqb2wi txvbqbhbf txvbqbo4m txvbqb3f txvbqb7g txvbqb75 txvbqb7t qbwcuel txvbqb1etp txvbqb1cst txvbqb1dth txvbqb1e2l qbwcue0 txvbqb1ffs txvbqb1ga0", t = "txvbqbv8n txvbqb18dp txvbqbh86", n = "txvbqbfqq txvbqbey txvbqbls4 txvbqb19fm txvbqbjl1 txvbqb1bg5", r = "kk18lv0 txvbqbh6d txvbqb1bg3 txvbqb9j txvbqbo4m txvbqb7h txvbqb75 txvbqb7t";
|
|
4
4
|
//#endregion
|
|
5
|
-
export { t as count, n as icon, e as link };
|
|
5
|
+
export { t as count, n as countLoading, r as icon, e as link };
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=backofficeRelatedCountLink.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backofficeRelatedCountLink.css.js","names":[],"sources":["../../../../../src/components/backoffice/refs/backofficeRelatedCountLink.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { sprinkles } from '@plumile/ui/theme/sprinkles.css.js';\nimport { pillLink } from '@plumile/ui/theme/styleRecipes.css.js';\nimport { vars } from '@plumile/ui/theme/themeContract.css.js';\n\nexport const link = pillLink;\n\nexport const count = sprinkles({\n minWidth: 2,\n textAlign: 'center',\n fontVariantNumeric: 'tabular-nums',\n});\n\nexport const icon = style([\n sprinkles({\n flexShrink: 0,\n color: 'textSecondary',\n fontSize: 'sm',\n lineHeight: 'none',\n transitionProperty: 'colors',\n transitionDuration: 120,\n transitionTimingFunction: 'ease',\n }),\n {\n selectors: {\n [`${link}:hover &`]: {\n color: vars.colors.brandPrimaryRed,\n },\n },\n },\n]);\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"backofficeRelatedCountLink.css.js","names":[],"sources":["../../../../../src/components/backoffice/refs/backofficeRelatedCountLink.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { sprinkles } from '@plumile/ui/theme/sprinkles.css.js';\nimport { pillLink } from '@plumile/ui/theme/styleRecipes.css.js';\nimport { vars } from '@plumile/ui/theme/themeContract.css.js';\n\nexport const link = pillLink;\n\nexport const count = sprinkles({\n minWidth: 2,\n textAlign: 'center',\n fontVariantNumeric: 'tabular-nums',\n});\n\nexport const countLoading = sprinkles({\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 4,\n height: 4,\n color: 'textMuted',\n});\n\nexport const icon = style([\n sprinkles({\n flexShrink: 0,\n color: 'textSecondary',\n fontSize: 'sm',\n lineHeight: 'none',\n transitionProperty: 'colors',\n transitionDuration: 120,\n transitionTimingFunction: 'ease',\n }),\n {\n selectors: {\n [`${link}:hover &`]: {\n color: vars.colors.brandPrimaryRed,\n },\n },\n },\n]);\n"],"mappings":""}
|