@plumile/backoffice-react 0.1.153 → 0.1.154
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 +1 -0
- package/lib/esm/auth/login/loginPage.css.js +1 -0
- package/lib/esm/components/backoffice/hub/backofficeHubTemplate.css.js +0 -2
- package/lib/esm/pages/BackofficeDashboardPage.helpers.js +2 -2
- package/lib/esm/pages/BackofficeDashboardPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardPage.js +38 -51
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardWidgetContent.js +97 -100
- package/lib/esm/pages/BackofficeDashboardWidgetContent.js.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts +0 -4
- package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardWidgetContent.d.ts +1 -2
- package/lib/types/pages/BackofficeDashboardWidgetContent.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* empty css */
|
|
1
2
|
/* empty css */
|
|
2
3
|
//#region src/auth/login/loginPage.css.ts
|
|
3
4
|
var e = "txvbqbfpn txvbqbh4x txvbqbheb", t = "txvbqbfpn txvbqbh4x txvbqb19uf", n = "txvbqb1bg3 txvbqb9j txvbqbo7v txvbqbny4", r = "txvbqbey txvbqb1bg3 txvbqbfpn txvbqbhdl txvbqbs00 txvbqbp6j", i = "txvbqb1b9r txvbqbk07 txvbqbfvs txvbqb2wi txvbqb1bk3", a = "txvbqbey txvbqbfpn txvbqbh7g txvbqbhdy txvbqblt7 txvbqbrza", o = "w8yhmy0 txvbqb1b4r txvbqb1tv txvbqb2rt txvbqb1bhb txvbqbv txvbqbhbf txvbqbwvi txvbqb3f txvbqb7h txvbqb76 txvbqb7t txvbqb1etp txvbqb1gct", s = "txvbqb10o0 txvbqb11ll txvbqb12j6 txvbqbxv9 txvbqbc7z txvbqbc27 txvbqbci3 txvbqbce4", c = "txvbqbfpn txvbqbh4x txvbqbheb", l = "txvbqb19uf", u = "txvbqbo7v txvbqbam txvbqbhbs txvbqb1bhb txvbqbmu1", d = "txvbqbrzn", f = "w8yhmy1 txvbqb1f2 txvbqb29r txvbqb2sj txvbqb1bhb txvbqb1b9n txvbqb7h txvbqb75 txvbqb7t";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
|
-
/* empty css */
|
|
3
1
|
/* empty css */
|
|
4
2
|
//#region src/components/backoffice/hub/backofficeHubTemplate.css.ts
|
|
5
3
|
var e = "txvbqbfpn txvbqbh4x txvbqbheo", t = "txvbqbtyf", n = "txvbqbfpn txvbqbh4x txvbqbhf1", r = "txvbqbfpn txvbqbh4x txvbqbhdy", i = "txvbqbfpn txvbqbel txvbqbhdy", a = "txvbqbfqq txvbqbey txvbqbls4 txvbqb19h2 txvbqbjmh txvbqb2tz txvbqb1b83 txvbqb28o txvbqb2sj txvbqb1d9 txvbqb1bg3 txvbqbh6d txvbqbsdq", o = "txvbqbfpn txvbqbh4x txvbqbhd8 txvbqbv7x", s = "txvbqba9 txvbqbhbf txvbqb1bg1 txvbqbo7v", c = "txvbqb1bg5 txvbqb9j", l = "txvbqbfq0 txvbqbje6 txvbqbhdy", u = "u4nszr0 txvbqbfpn txvbqbel txvbqbhdy txvbqbwwl txvbqb2tz txvbqb28o txvbqb2sj txvbqb1d9 txvbqb1b7z txvbqb1bg1 txvbqb3f txvbqbv7x txvbqb7g txvbqb76 txvbqb7t", d = "txvbqbfqq txvbqbey txvbqbls4 txvbqb19hf txvbqbjmu txvbqb2tz txvbqb1b83 txvbqb1bg3 txvbqbh6d", f = "txvbqbfpn txvbqbh4x txvbqbhd8 txvbqbv7x", p = "txvbqbhbf txvbqb1bg1 txvbqbws9", m = "txvbqb1bg5 txvbqb9j txvbqbo5p txvbqbws9", h = "txvbqb1bg5 txvbqb96 txvbqbhb2 txvbqb6a txvbqbmur";
|
|
@@ -12,8 +12,8 @@ var e = (e, t) => e(t), t = (e, t) => {
|
|
|
12
12
|
case "statusSummary": return e.title == null ? t.title : e.title;
|
|
13
13
|
default: return t.title;
|
|
14
14
|
}
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
//#endregion
|
|
17
|
-
export { t as getWidgetLabel,
|
|
17
|
+
export { t as getWidgetLabel, e as resolveLabel };
|
|
18
18
|
|
|
19
19
|
//# sourceMappingURL=BackofficeDashboardPage.helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardPage.helpers.js","names":[],"sources":["../../../src/pages/BackofficeDashboardPage.helpers.ts"],"sourcesContent":["import type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { TFunction } from 'i18next';\
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardPage.helpers.js","names":[],"sources":["../../../src/pages/BackofficeDashboardPage.helpers.ts"],"sourcesContent":["import type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { TFunction } from 'i18next';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const getWidgetLabel = (\n widget: BackofficeDashboardWidget,\n config: BackofficeDashboardConfig,\n): I18nLabel => {\n switch (widget.kind) {\n case 'entityCount':\n case 'shortcut':\n return widget.label;\n case 'billingUsageChart':\n case 'tablePreview':\n case 'textBlock':\n return widget.title;\n case 'recentItems':\n case 'metricGroup':\n case 'quickActions':\n case 'statusSummary':\n if (widget.title != null) {\n return widget.title;\n }\n return config.title;\n default:\n return config.title;\n }\n};\n"],"mappings":";AAOA,IAAa,KAAgB,GAAkB,MACtC,EAAM,CAAI,GAGN,KACX,GACA,MACc;CACd,QAAQ,EAAO,MAAf;EACE,KAAK;EACL,KAAK,YACH,OAAO,EAAO;EAChB,KAAK;EACL,KAAK;EACL,KAAK,aACH,OAAO,EAAO;EAChB,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,iBAIH,OAHI,EAAO,SAAS,OAGb,EAAO,QAFL,EAAO;EAGlB,SACE,OAAO,EAAO;CAClB;AACF"}
|
|
@@ -9,66 +9,59 @@ import { loadingBody as c, tileBody as l, tileCount as u } from "./backofficeDas
|
|
|
9
9
|
import { Suspense as d, lazy as f } from "react";
|
|
10
10
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
11
|
import { useTranslation as h } from "react-i18next";
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { DashboardGrid as S, DashboardGridItem as C } from "@plumile/ui/components/dashboard/dashboard_grid/DashboardGrid.js";
|
|
12
|
+
import { Spinner as g } from "@plumile/ui/backoffice/atoms/spinner/Spinner.js";
|
|
13
|
+
import { BackofficeEmptyState as _ } from "@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js";
|
|
14
|
+
import { DetailPageTemplate as v } from "@plumile/ui/backoffice/templates/detail_page_template/DetailPageTemplate.js";
|
|
15
|
+
import { DashboardPanel as y } from "@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js";
|
|
16
|
+
import { DashboardQuickActions as b } from "@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js";
|
|
17
|
+
import { DashboardGrid as x, DashboardGridItem as S } from "@plumile/ui/components/dashboard/dashboard_grid/DashboardGrid.js";
|
|
19
18
|
//#region src/pages/BackofficeDashboardPage.tsx
|
|
20
|
-
var
|
|
19
|
+
var C = f(async () => ({ default: (await import("./BackofficeDashboardWidgetContent.js")).BackofficeDashboardWidgetContent })), w = () => {
|
|
21
20
|
let { t } = e();
|
|
22
|
-
return /* @__PURE__ */ p(
|
|
23
|
-
},
|
|
21
|
+
return /* @__PURE__ */ p(_, { title: t("common.notAvailable") });
|
|
22
|
+
}, T = () => {
|
|
24
23
|
let { t } = e();
|
|
25
24
|
return /* @__PURE__ */ m("div", {
|
|
26
25
|
className: c,
|
|
27
|
-
children: [/* @__PURE__ */ p(
|
|
26
|
+
children: [/* @__PURE__ */ p(g, { ariaLabel: t("common.loading") }), /* @__PURE__ */ p("span", { children: t("common.loading") })]
|
|
28
27
|
});
|
|
29
|
-
},
|
|
28
|
+
}, E = (e) => e ?? "m", D = (e) => {
|
|
30
29
|
if (e.layout?.span != null) return e.layout.span;
|
|
31
|
-
let t =
|
|
30
|
+
let t = E(e.size);
|
|
32
31
|
return t === "s" ? 3 : t === "m" ? 4 : t === "l" ? 6 : t === "xl" ? 8 : 12;
|
|
33
|
-
},
|
|
34
|
-
let { t:
|
|
35
|
-
return /* @__PURE__ */ p(
|
|
32
|
+
}, O = (e) => e.layout?.tabletSpan, k = ({ config: t }) => {
|
|
33
|
+
let { t: r } = h(), { t: i } = e();
|
|
34
|
+
return /* @__PURE__ */ p(v, {
|
|
36
35
|
header: {
|
|
37
|
-
title: s(t.title,
|
|
38
|
-
subtitle: (t.subtitle == null ? void 0 : s(t.subtitle,
|
|
36
|
+
title: s(t.title, r),
|
|
37
|
+
subtitle: (t.subtitle == null ? void 0 : s(t.subtitle, r)) ?? i("dashboard.subtitle")
|
|
39
38
|
},
|
|
40
|
-
children: /* @__PURE__ */ p(
|
|
39
|
+
children: /* @__PURE__ */ p(x, {
|
|
41
40
|
columns: 12,
|
|
42
41
|
children: t.widgets.map((e) => {
|
|
43
|
-
let
|
|
44
|
-
return /* @__PURE__ */ p(
|
|
42
|
+
let i = s(o(e, t), r);
|
|
43
|
+
return /* @__PURE__ */ p(S, {
|
|
45
44
|
minHeight: e.minHeight ?? "auto",
|
|
46
|
-
span:
|
|
47
|
-
tabletSpan:
|
|
45
|
+
span: D(e),
|
|
46
|
+
tabletSpan: O(e),
|
|
48
47
|
children: /* @__PURE__ */ p(n, {
|
|
49
|
-
fallback: () => /* @__PURE__ */ p(
|
|
50
|
-
title:
|
|
51
|
-
children: /* @__PURE__ */ p(
|
|
48
|
+
fallback: () => /* @__PURE__ */ p(y, {
|
|
49
|
+
title: i,
|
|
50
|
+
children: /* @__PURE__ */ p(w, {})
|
|
52
51
|
}),
|
|
53
52
|
children: /* @__PURE__ */ p(d, {
|
|
54
|
-
fallback: /* @__PURE__ */ p(
|
|
55
|
-
title:
|
|
56
|
-
children: /* @__PURE__ */ p(
|
|
53
|
+
fallback: /* @__PURE__ */ p(y, {
|
|
54
|
+
title: i,
|
|
55
|
+
children: /* @__PURE__ */ p(T, {})
|
|
57
56
|
}),
|
|
58
|
-
children: /* @__PURE__ */ p(
|
|
59
|
-
widget: e,
|
|
60
|
-
globalData: r
|
|
61
|
-
})
|
|
57
|
+
children: /* @__PURE__ */ p(C, { widget: e })
|
|
62
58
|
})
|
|
63
59
|
})
|
|
64
60
|
}, e.id);
|
|
65
61
|
})
|
|
66
62
|
})
|
|
67
63
|
});
|
|
68
|
-
},
|
|
69
|
-
config: e,
|
|
70
|
-
globalData: w(e.query, {}, { fetchPolicy: "store-or-network" })
|
|
71
|
-
}), N = ({ prepared: n }) => {
|
|
64
|
+
}, A = ({ prepared: n }) => {
|
|
72
65
|
let { t: o } = h(), { t: c } = e(), { entities: d } = t(), f = a(), g = n?.config ?? f, _ = i(c);
|
|
73
66
|
if (g == null) {
|
|
74
67
|
let e = Object.values(d).filter((e) => e.kind === "list-detail" && e.hasList).map((e) => ({
|
|
@@ -77,23 +70,23 @@ var { useLazyLoadQuery: w } = g, T = f(async () => ({ default: (await import("./
|
|
|
77
70
|
})).sort((e, t) => e.label.localeCompare(t.label));
|
|
78
71
|
return /* @__PURE__ */ p(r, {
|
|
79
72
|
breadcrumb: _,
|
|
80
|
-
children: /* @__PURE__ */ p(
|
|
73
|
+
children: /* @__PURE__ */ p(v, {
|
|
81
74
|
header: {
|
|
82
75
|
title: c("dashboard.title"),
|
|
83
76
|
subtitle: c("dashboard.subtitle")
|
|
84
77
|
},
|
|
85
|
-
children: /* @__PURE__ */ p(
|
|
78
|
+
children: /* @__PURE__ */ p(x, {
|
|
86
79
|
columns: 12,
|
|
87
|
-
children: e.map(({ config: e, label: t }) => /* @__PURE__ */ p(
|
|
80
|
+
children: e.map(({ config: e, label: t }) => /* @__PURE__ */ p(S, {
|
|
88
81
|
span: 4,
|
|
89
|
-
children: /* @__PURE__ */ p(
|
|
82
|
+
children: /* @__PURE__ */ p(y, {
|
|
90
83
|
title: t,
|
|
91
84
|
children: /* @__PURE__ */ m("div", {
|
|
92
85
|
className: l,
|
|
93
86
|
children: [/* @__PURE__ */ p("div", {
|
|
94
87
|
className: u,
|
|
95
88
|
children: c("common.notAvailable")
|
|
96
|
-
}), /* @__PURE__ */ p(
|
|
89
|
+
}), /* @__PURE__ */ p(b, { actions: [{
|
|
97
90
|
id: e.id,
|
|
98
91
|
href: e.routes.list,
|
|
99
92
|
label: c("dashboard.actions.openList")
|
|
@@ -105,18 +98,12 @@ var { useLazyLoadQuery: w } = g, T = f(async () => ({ default: (await import("./
|
|
|
105
98
|
})
|
|
106
99
|
});
|
|
107
100
|
}
|
|
108
|
-
return
|
|
109
|
-
breadcrumb: _,
|
|
110
|
-
children: /* @__PURE__ */ p(j, {
|
|
111
|
-
config: g,
|
|
112
|
-
globalData: null
|
|
113
|
-
})
|
|
114
|
-
}) : /* @__PURE__ */ p(r, {
|
|
101
|
+
return /* @__PURE__ */ p(r, {
|
|
115
102
|
breadcrumb: _,
|
|
116
|
-
children: /* @__PURE__ */ p(
|
|
103
|
+
children: /* @__PURE__ */ p(k, { config: g })
|
|
117
104
|
});
|
|
118
105
|
};
|
|
119
106
|
//#endregion
|
|
120
|
-
export {
|
|
107
|
+
export { A as BackofficeDashboardPage, A as default };
|
|
121
108
|
|
|
122
109
|
//# sourceMappingURL=BackofficeDashboardPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardPage.js","names":[],"sources":["../../../src/pages/BackofficeDashboardPage.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport { lazy, type JSX, Suspense } from 'react';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n BackofficeDashboardWidgetSpan,\n BackofficeDashboardWidgetTabletSpan,\n BackofficeDashboardWidgetSize,\n} from '@plumile/backoffice-core/types.js';\nimport { Spinner } from '@plumile/ui/backoffice/atoms/spinner/Spinner.js';\nimport { BackofficeEmptyState } from '@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js';\nimport { DetailPageTemplate } from '@plumile/ui/backoffice/templates/detail_page_template/DetailPageTemplate.js';\nimport { DashboardPanel } from '@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js';\nimport { DashboardQuickActions } from '@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js';\nimport {\n DashboardGrid,\n DashboardGridItem,\n} from '@plumile/ui/components/dashboard/dashboard_grid/DashboardGrid.js';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeDashboardConfig } from '../provider/useBackofficeLazyValue.js';\nimport type { BackofficePreparedDashboardRoute } from '../router/createBackofficeRoutes.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildDashboardBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport {\n getWidgetLabel,\n resolveLabel,\n} from './BackofficeDashboardPage.helpers.js';\n\nimport * as styles from './backofficeDashboardPage.css.js';\n\nconst { useLazyLoadQuery } = ReactRelay;\n\nconst LazyBackofficeDashboardWidgetContent = lazy(async () => {\n const module = await import('./BackofficeDashboardWidgetContent.js');\n return {\n default: module.BackofficeDashboardWidgetContent,\n };\n});\n\nconst DashboardUnavailableState = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return <BackofficeEmptyState title={t('common.notAvailable')} />;\n};\n\nconst DashboardLoadingState = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return (\n <div className={styles.loadingBody}>\n <Spinner ariaLabel={t('common.loading')} />\n <span>{t('common.loading')}</span>\n </div>\n );\n};\n\nconst resolveWidgetSize = (\n size: BackofficeDashboardWidgetSize | undefined,\n): BackofficeDashboardWidgetSize => {\n return size ?? 'm';\n};\n\nconst resolveWidgetSpan = (\n widget: BackofficeDashboardWidget,\n): BackofficeDashboardWidgetSpan => {\n if (widget.layout?.span != null) {\n return widget.layout.span;\n }\n\n const size = resolveWidgetSize(widget.size);\n if (size === 's') {\n return 3;\n }\n if (size === 'm') {\n return 4;\n }\n if (size === 'l') {\n return 6;\n }\n if (size === 'xl') {\n return 8;\n }\n return 12;\n};\n\nconst resolveWidgetTabletSpan = (\n widget: BackofficeDashboardWidget,\n): BackofficeDashboardWidgetTabletSpan | undefined => {\n return widget.layout?.tabletSpan;\n};\n\ntype DashboardContentProps = {\n config: BackofficeDashboardConfig;\n globalData: unknown;\n};\n\nconst DashboardContent = ({\n config,\n globalData,\n}: DashboardContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n\n const title = resolveLabel(config.title, tApp);\n const subtitle =\n config.subtitle != null ? resolveLabel(config.subtitle, tApp) : undefined;\n\n return (\n <DetailPageTemplate\n header={{\n title,\n subtitle: subtitle ?? t('dashboard.subtitle'),\n }}\n >\n <DashboardGrid columns={12}>\n {config.widgets.map((widget) => {\n const widgetTitle = resolveLabel(\n getWidgetLabel(widget, config),\n tApp,\n );\n return (\n <DashboardGridItem\n key={widget.id}\n minHeight={widget.minHeight ?? 'auto'}\n span={resolveWidgetSpan(widget)}\n tabletSpan={resolveWidgetTabletSpan(widget)}\n >\n <BackofficeErrorBoundary\n fallback={() => {\n return (\n <DashboardPanel title={widgetTitle}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }}\n >\n <Suspense\n fallback={\n <DashboardPanel title={widgetTitle}>\n <DashboardLoadingState />\n </DashboardPanel>\n }\n >\n <LazyBackofficeDashboardWidgetContent\n widget={widget}\n globalData={globalData}\n />\n </Suspense>\n </BackofficeErrorBoundary>\n </DashboardGridItem>\n );\n })}\n </DashboardGrid>\n </DetailPageTemplate>\n );\n};\n\ntype DashboardWithQueryProps = {\n config: BackofficeDashboardConfig;\n};\n\nconst DashboardWithQuery = ({\n config,\n}: DashboardWithQueryProps): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(\n config.query as never,\n {},\n { fetchPolicy: 'store-or-network' },\n );\n\n return <DashboardContent config={config} globalData={data} />;\n};\n\nexport type BackofficeDashboardPageProps = {\n prepared?: BackofficePreparedDashboardRoute | null;\n};\n\nexport const BackofficeDashboardPage = ({\n prepared,\n}: BackofficeDashboardPageProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const rootDashboard = useBackofficeDashboardConfig();\n const dashboard = prepared?.config ?? rootDashboard;\n const breadcrumb = buildDashboardBreadcrumb(t);\n\n if (dashboard == null) {\n const items = Object.values(entities)\n .filter((config) => {\n return config.kind === 'list-detail' && config.hasList;\n })\n .map((config) => {\n return {\n config,\n label: resolveLabel(config.label, tApp),\n };\n })\n .sort((left, right) => {\n return left.label.localeCompare(right.label);\n });\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DetailPageTemplate\n header={{\n title: t('dashboard.title'),\n subtitle: t('dashboard.subtitle'),\n }}\n >\n <DashboardGrid columns={12}>\n {items.map(({ config, label }) => {\n return (\n <DashboardGridItem key={config.id} span={4}>\n <DashboardPanel title={label}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>\n {t('common.notAvailable')}\n </div>\n <DashboardQuickActions\n actions={[\n {\n id: config.id,\n href: config.routes.list,\n label: t('dashboard.actions.openList'),\n },\n ]}\n />\n </div>\n </DashboardPanel>\n </DashboardGridItem>\n );\n })}\n </DashboardGrid>\n </DetailPageTemplate>\n </BackofficeRightPageLayout>\n );\n }\n\n if (dashboard.query != null) {\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardWithQuery config={dashboard} />\n </BackofficeRightPageLayout>\n );\n }\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardContent config={dashboard} globalData={null} />\n </BackofficeRightPageLayout>\n );\n};\n\nexport default BackofficeDashboardPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,IAAM,EAAE,kBAAA,MAAqB,GAEvB,IAAuC,EAAK,aAEzC,EACL,UAAS,MAFU,OAAO,0CAEV,iCAClB,EACD,GAEK,UAA+C;CACnD,IAAM,EAAE,MAAM,EAA8B;CAE5C,OAAO,kBAAC,GAAD,EAAsB,OAAO,EAAE,qBAAqB,EAAI,CAAA;AACjE,GAEM,UAA2C;CAC/C,IAAM,EAAE,MAAM,EAA8B;CAE5C,OACE,kBAAC,OAAD;EAAK,WAAW;YAAhB,CACE,kBAAC,GAAD,EAAS,WAAW,EAAE,gBAAgB,EAAI,CAAA,GAC1C,kBAAC,QAAD,EAAA,UAAO,EAAE,gBAAgB,EAAQ,CAAA,CAC9B;;AAET,GAEM,KACJ,MAEO,KAAQ,KAGX,KACJ,MACkC;CAClC,IAAI,EAAO,QAAQ,QAAQ,MACzB,OAAO,EAAO,OAAO;CAGvB,IAAM,IAAO,EAAkB,EAAO,IAAI;CAa1C,OAZI,MAAS,MACJ,IAEL,MAAS,MACJ,IAEL,MAAS,MACJ,IAEL,MAAS,OACJ,IAEF;AACT,GAEM,KACJ,MAEO,EAAO,QAAQ,YAQlB,KAAoB,EACxB,WACA,oBACwC;CACxC,IAAM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GACA,OAAO,EAAa,EAAO,OAAO,CAAI;EACxC,EACD,EACA,MAAM,GAAM,MACJ,EAAK,MAAM,cAAc,EAAM,KAAK,CAC5C;EAEH,OACE,kBAAC,GAAD;GAAuC;aACrC,kBAAC,GAAD;IACE,QAAQ;KACN,OAAO,EAAE,iBAAiB;KAC1B,UAAU,EAAE,oBAAoB;IAClC;cAEA,kBAAC,GAAD;KAAe,SAAS;eACrB,EAAM,KAAK,EAAE,WAAQ,eAElB,kBAAC,GAAD;MAAmC,MAAM;gBACvC,kBAAC,GAAD;OAAgB,OAAO;iBACrB,kBAAC,OAAD;QAAK,WAAW;kBAAhB,CACE,kBAAC,OAAD;SAAK,WAAW;mBACb,EAAE,qBAAqB;QACrB,CAAA,GACL,kBAAC,GAAD,EACE,SAAS,CACP;SACE,IAAI,EAAO;SACX,MAAM,EAAO,OAAO;SACpB,OAAO,EAAE,4BAA4B;QACvC,CACF,EACD,CAAA,CACE;;MACS,CAAA;KACC,GAjBK,EAAO,EAiBZ,CAEtB;IACY,CAAA;GACG,CAAA;EACK,CAAA;CAE/B;CAUA,OARI,EAAU,SAAS,OASrB,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD;GAAkB,QAAQ;GAAW,YAAY;EAAO,CAAA;CAC/B,CAAA,IATzB,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD,EAAoB,QAAQ,EAAY,CAAA;CACf,CAAA;AASjC"}
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardPage.js","names":[],"sources":["../../../src/pages/BackofficeDashboardPage.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport { lazy, type JSX, Suspense } from 'react';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n BackofficeDashboardWidgetSpan,\n BackofficeDashboardWidgetTabletSpan,\n BackofficeDashboardWidgetSize,\n} from '@plumile/backoffice-core/types.js';\nimport { Spinner } from '@plumile/ui/backoffice/atoms/spinner/Spinner.js';\nimport { BackofficeEmptyState } from '@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js';\nimport { DetailPageTemplate } from '@plumile/ui/backoffice/templates/detail_page_template/DetailPageTemplate.js';\nimport { DashboardPanel } from '@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js';\nimport { DashboardQuickActions } from '@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js';\nimport {\n DashboardGrid,\n DashboardGridItem,\n} from '@plumile/ui/components/dashboard/dashboard_grid/DashboardGrid.js';\nimport { useTranslation } from 'react-i18next';\n\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeDashboardConfig } from '../provider/useBackofficeLazyValue.js';\nimport type { BackofficePreparedDashboardRoute } from '../router/createBackofficeRoutes.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildDashboardBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport {\n getWidgetLabel,\n resolveLabel,\n} from './BackofficeDashboardPage.helpers.js';\n\nimport * as styles from './backofficeDashboardPage.css.js';\n\nconst LazyBackofficeDashboardWidgetContent = lazy(async () => {\n const module = await import('./BackofficeDashboardWidgetContent.js');\n return {\n default: module.BackofficeDashboardWidgetContent,\n };\n});\n\nconst DashboardUnavailableState = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return <BackofficeEmptyState title={t('common.notAvailable')} />;\n};\n\nconst DashboardLoadingState = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return (\n <div className={styles.loadingBody}>\n <Spinner ariaLabel={t('common.loading')} />\n <span>{t('common.loading')}</span>\n </div>\n );\n};\n\nconst resolveWidgetSize = (\n size: BackofficeDashboardWidgetSize | undefined,\n): BackofficeDashboardWidgetSize => {\n return size ?? 'm';\n};\n\nconst resolveWidgetSpan = (\n widget: BackofficeDashboardWidget,\n): BackofficeDashboardWidgetSpan => {\n if (widget.layout?.span != null) {\n return widget.layout.span;\n }\n\n const size = resolveWidgetSize(widget.size);\n if (size === 's') {\n return 3;\n }\n if (size === 'm') {\n return 4;\n }\n if (size === 'l') {\n return 6;\n }\n if (size === 'xl') {\n return 8;\n }\n return 12;\n};\n\nconst resolveWidgetTabletSpan = (\n widget: BackofficeDashboardWidget,\n): BackofficeDashboardWidgetTabletSpan | undefined => {\n return widget.layout?.tabletSpan;\n};\n\ntype DashboardContentProps = {\n config: BackofficeDashboardConfig;\n};\n\nconst DashboardContent = ({ config }: DashboardContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n\n const title = resolveLabel(config.title, tApp);\n const subtitle =\n config.subtitle != null ? resolveLabel(config.subtitle, tApp) : undefined;\n\n return (\n <DetailPageTemplate\n header={{\n title,\n subtitle: subtitle ?? t('dashboard.subtitle'),\n }}\n >\n <DashboardGrid columns={12}>\n {config.widgets.map((widget) => {\n const widgetTitle = resolveLabel(\n getWidgetLabel(widget, config),\n tApp,\n );\n return (\n <DashboardGridItem\n key={widget.id}\n minHeight={widget.minHeight ?? 'auto'}\n span={resolveWidgetSpan(widget)}\n tabletSpan={resolveWidgetTabletSpan(widget)}\n >\n <BackofficeErrorBoundary\n fallback={() => {\n return (\n <DashboardPanel title={widgetTitle}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }}\n >\n <Suspense\n fallback={\n <DashboardPanel title={widgetTitle}>\n <DashboardLoadingState />\n </DashboardPanel>\n }\n >\n <LazyBackofficeDashboardWidgetContent widget={widget} />\n </Suspense>\n </BackofficeErrorBoundary>\n </DashboardGridItem>\n );\n })}\n </DashboardGrid>\n </DetailPageTemplate>\n );\n};\n\nexport type BackofficeDashboardPageProps = {\n prepared?: BackofficePreparedDashboardRoute | null;\n};\n\nexport const BackofficeDashboardPage = ({\n prepared,\n}: BackofficeDashboardPageProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const rootDashboard = useBackofficeDashboardConfig();\n const dashboard = prepared?.config ?? rootDashboard;\n const breadcrumb = buildDashboardBreadcrumb(t);\n\n if (dashboard == null) {\n const items = Object.values(entities)\n .filter((config) => {\n return config.kind === 'list-detail' && config.hasList;\n })\n .map((config) => {\n return {\n config,\n label: resolveLabel(config.label, tApp),\n };\n })\n .sort((left, right) => {\n return left.label.localeCompare(right.label);\n });\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DetailPageTemplate\n header={{\n title: t('dashboard.title'),\n subtitle: t('dashboard.subtitle'),\n }}\n >\n <DashboardGrid columns={12}>\n {items.map(({ config, label }) => {\n return (\n <DashboardGridItem key={config.id} span={4}>\n <DashboardPanel title={label}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>\n {t('common.notAvailable')}\n </div>\n <DashboardQuickActions\n actions={[\n {\n id: config.id,\n href: config.routes.list,\n label: t('dashboard.actions.openList'),\n },\n ]}\n />\n </div>\n </DashboardPanel>\n </DashboardGridItem>\n );\n })}\n </DashboardGrid>\n </DetailPageTemplate>\n </BackofficeRightPageLayout>\n );\n }\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardContent config={dashboard} />\n </BackofficeRightPageLayout>\n );\n};\n\nexport default BackofficeDashboardPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,IAAM,IAAuC,EAAK,aAEzC,EACL,UAAS,MAFU,OAAO,0CAEV,iCAClB,EACD,GAEK,UAA+C;CACnD,IAAM,EAAE,MAAM,EAA8B;CAE5C,OAAO,kBAAC,GAAD,EAAsB,OAAO,EAAE,qBAAqB,EAAI,CAAA;AACjE,GAEM,UAA2C;CAC/C,IAAM,EAAE,MAAM,EAA8B;CAE5C,OACE,kBAAC,OAAD;EAAK,WAAW;YAAhB,CACE,kBAAC,GAAD,EAAS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E,GAAG,MAAS,EAAe,GAC7B,EAAE,SAAM,EAA8B,GACtC,EAAE,gBAAa,EAAoB,GACnC,IAAgB,EAA6B,GAC7C,IAAY,GAAU,UAAU,GAChC,IAAa,EAAyB,CAAC;CAE7C,IAAI,KAAa,MAAM;EACrB,IAAM,IAAQ,OAAO,OAAO,CAAQ,EACjC,QAAQ,MACA,EAAO,SAAS,iBAAiB,EAAO,OAChD,EACA,KAAK,OACG;GACL;GACA,OAAO,EAAa,EAAO,OAAO,CAAI;EACxC,EACD,EACA,MAAM,GAAM,MACJ,EAAK,MAAM,cAAc,EAAM,KAAK,CAC5C;EAEH,OACE,kBAAC,GAAD;GAAuC;aACrC,kBAAC,GAAD;IACE,QAAQ;KACN,OAAO,EAAE,iBAAiB;KAC1B,UAAU,EAAE,oBAAoB;IAClC;cAEA,kBAAC,GAAD;KAAe,SAAS;eACrB,EAAM,KAAK,EAAE,WAAQ,eAElB,kBAAC,GAAD;MAAmC,MAAM;gBACvC,kBAAC,GAAD;OAAgB,OAAO;iBACrB,kBAAC,OAAD;QAAK,WAAW;kBAAhB,CACE,kBAAC,OAAD;SAAK,WAAW;mBACb,EAAE,qBAAqB;QACrB,CAAA,GACL,kBAAC,GAAD,EACE,SAAS,CACP;SACE,IAAI,EAAO;SACX,MAAM,EAAO,OAAO;SACpB,OAAO,EAAE,4BAA4B;QACvC,CACF,EACD,CAAA,CACE;;MACS,CAAA;KACC,GAjBK,EAAO,EAiBZ,CAEtB;IACY,CAAA;GACG,CAAA;EACK,CAAA;CAE/B;CAEA,OACE,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD,EAAkB,QAAQ,EAAY,CAAA;CACb,CAAA;AAE/B"}
|
|
@@ -2,70 +2,70 @@ import { useBackofficeReactTranslation as e } from "../i18n/useBackofficeReactTr
|
|
|
2
2
|
import { useBackofficeConfig as t } from "../provider/BackofficeConfigContext.js";
|
|
3
3
|
import { BackofficeBillingUsageChart as n } from "../components/backoffice/billing/BackofficeBillingUsageChart.js";
|
|
4
4
|
import { buildDataTableColumns as r } from "../components/backoffice/columns/buildDataTableColumns.js";
|
|
5
|
-
import {
|
|
6
|
-
import { tileBody as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { useTranslation as
|
|
9
|
-
import * as
|
|
10
|
-
import { BackofficeEmptyState as
|
|
11
|
-
import { DashboardPanel as
|
|
12
|
-
import { DashboardQuickActions as
|
|
13
|
-
import { DashboardMetricGroup as
|
|
14
|
-
import { DashboardStatusList as
|
|
15
|
-
import { DataTable as
|
|
5
|
+
import { resolveLabel as i } from "./BackofficeDashboardPage.helpers.js";
|
|
6
|
+
import { tileBody as a, tileCount as o } from "./backofficeDashboardPage.css.js";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
import { useTranslation as l } from "react-i18next";
|
|
9
|
+
import * as u from "react-relay";
|
|
10
|
+
import { BackofficeEmptyState as d } from "@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js";
|
|
11
|
+
import { DashboardPanel as f } from "@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js";
|
|
12
|
+
import { DashboardQuickActions as p } from "@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js";
|
|
13
|
+
import { DashboardMetricGroup as m } from "@plumile/ui/components/dashboard/dashboard_metric_group/DashboardMetricGroup.js";
|
|
14
|
+
import { DashboardStatusList as h } from "@plumile/ui/components/dashboard/dashboard_status_list/DashboardStatusList.js";
|
|
15
|
+
import { DataTable as g } from "@plumile/ui/components/data-table/DataTable.js";
|
|
16
16
|
//#region src/pages/BackofficeDashboardWidgetContent.tsx
|
|
17
|
-
var { useLazyLoadQuery:
|
|
17
|
+
var { useLazyLoadQuery: _ } = u, v = () => {
|
|
18
18
|
let { t } = e();
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
},
|
|
21
|
-
let { t:
|
|
22
|
-
if (
|
|
23
|
-
title:
|
|
19
|
+
return /* @__PURE__ */ s(d, { title: t("common.notAvailable") });
|
|
20
|
+
}, y = ({ widget: u, data: d }) => {
|
|
21
|
+
let { t: _ } = l(), { t: y } = e(), { entities: b } = t(), x = u.description == null ? void 0 : i(u.description, _), S = () => u.dataSource === "query" && d != null ? u.resolve(d) : null;
|
|
22
|
+
if (u.kind === "textBlock") return /* @__PURE__ */ s(f, {
|
|
23
|
+
title: i(u.title, _),
|
|
24
24
|
subtitle: x,
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
-
className:
|
|
27
|
-
children:
|
|
25
|
+
children: /* @__PURE__ */ s("div", {
|
|
26
|
+
className: a,
|
|
27
|
+
children: i(u.body, _)
|
|
28
28
|
})
|
|
29
29
|
});
|
|
30
|
-
if (
|
|
31
|
-
let e = b[
|
|
32
|
-
return e == null ? /* @__PURE__ */
|
|
30
|
+
if (u.kind === "shortcut") {
|
|
31
|
+
let e = b[u.entityId], t = i(u.label, _);
|
|
32
|
+
return e == null ? /* @__PURE__ */ s(f, {
|
|
33
33
|
title: t,
|
|
34
34
|
subtitle: x,
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
}) : e.kind === "tool" ? /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ s(v, {})
|
|
36
|
+
}) : e.kind === "tool" ? /* @__PURE__ */ s(f, {
|
|
37
37
|
title: t,
|
|
38
38
|
subtitle: x,
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ s(p, { actions: [{
|
|
40
40
|
id: e.id,
|
|
41
41
|
href: e.routes.list,
|
|
42
|
-
label:
|
|
42
|
+
label: y("dashboard.actions.openTool")
|
|
43
43
|
}] })
|
|
44
|
-
}) : /* @__PURE__ */
|
|
44
|
+
}) : /* @__PURE__ */ s(f, {
|
|
45
45
|
title: t,
|
|
46
46
|
subtitle: x,
|
|
47
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ s(p, { actions: [{
|
|
48
48
|
id: e.id,
|
|
49
49
|
href: e.routes.list,
|
|
50
|
-
label:
|
|
50
|
+
label: y("dashboard.actions.openList")
|
|
51
51
|
}] })
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
55
|
-
let e = S(
|
|
56
|
-
if (e == null) return /* @__PURE__ */
|
|
57
|
-
title:
|
|
54
|
+
if (u.kind === "tablePreview") {
|
|
55
|
+
let e = S();
|
|
56
|
+
if (e == null) return /* @__PURE__ */ s(f, {
|
|
57
|
+
title: i(u.title, _),
|
|
58
58
|
subtitle: x,
|
|
59
|
-
children: /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ s(v, {})
|
|
60
60
|
});
|
|
61
61
|
let t = r(e.columns, {
|
|
62
|
-
tApp:
|
|
63
|
-
t:
|
|
62
|
+
tApp: _,
|
|
63
|
+
t: y
|
|
64
64
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
title:
|
|
65
|
+
return /* @__PURE__ */ s(f, {
|
|
66
|
+
title: i(u.title, _),
|
|
67
67
|
subtitle: x,
|
|
68
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ s(g, {
|
|
69
69
|
columns: t,
|
|
70
70
|
rows: e.rows,
|
|
71
71
|
getRowId: (e, t) => {
|
|
@@ -78,116 +78,113 @@ var { useLazyLoadQuery: v } = d, y = () => {
|
|
|
78
78
|
})
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
82
|
-
let e = S(
|
|
83
|
-
return e == null ? /* @__PURE__ */
|
|
84
|
-
emptyState: /* @__PURE__ */
|
|
81
|
+
if (u.kind === "metricGroup") {
|
|
82
|
+
let e = S();
|
|
83
|
+
return e == null ? /* @__PURE__ */ s(v, {}) : /* @__PURE__ */ s(m, {
|
|
84
|
+
emptyState: /* @__PURE__ */ s(v, {}),
|
|
85
85
|
metrics: e.map((e) => ({
|
|
86
86
|
id: e.id,
|
|
87
87
|
href: e.href,
|
|
88
|
-
label:
|
|
89
|
-
value: e.value ??
|
|
90
|
-
hint: e.meta == null ? void 0 :
|
|
88
|
+
label: i(e.label, _),
|
|
89
|
+
value: e.value ?? y("common.notAvailable"),
|
|
90
|
+
hint: e.meta == null ? void 0 : i(e.meta, _)
|
|
91
91
|
}))
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
if (
|
|
95
|
-
let e = S(
|
|
96
|
-
return e == null ? /* @__PURE__ */
|
|
94
|
+
if (u.kind === "billingUsageChart") {
|
|
95
|
+
let e = S(), t = i(u.title, _);
|
|
96
|
+
return e == null ? /* @__PURE__ */ s(f, {
|
|
97
97
|
title: t,
|
|
98
98
|
subtitle: x,
|
|
99
|
-
children: /* @__PURE__ */
|
|
100
|
-
}) : /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ s(v, {})
|
|
100
|
+
}) : /* @__PURE__ */ s(f, {
|
|
101
101
|
title: t,
|
|
102
102
|
subtitle: x,
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
ariaLabel:
|
|
103
|
+
children: /* @__PURE__ */ s(n, {
|
|
104
|
+
ariaLabel: i(u.ariaLabel, _),
|
|
105
105
|
buckets: e.buckets,
|
|
106
|
-
categories:
|
|
106
|
+
categories: u.categories.map((e) => ({
|
|
107
107
|
id: e.id,
|
|
108
|
-
label:
|
|
108
|
+
label: i(e.label, _),
|
|
109
109
|
color: e.color
|
|
110
110
|
})),
|
|
111
111
|
currency: e.currency,
|
|
112
|
-
emptyLabel:
|
|
112
|
+
emptyLabel: i(u.emptyLabel, _),
|
|
113
113
|
from: e.from,
|
|
114
|
-
rangePrefix:
|
|
114
|
+
rangePrefix: i(u.rangePrefix, _),
|
|
115
115
|
to: e.to,
|
|
116
116
|
totalAmount: e.totalAmount
|
|
117
117
|
})
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
if (
|
|
121
|
-
title:
|
|
120
|
+
if (u.kind === "quickActions") return /* @__PURE__ */ s(f, {
|
|
121
|
+
title: u.title == null ? y("dashboard.actions.openTool") : i(u.title, _),
|
|
122
122
|
subtitle: x,
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
-
layout:
|
|
125
|
-
emptyState: /* @__PURE__ */
|
|
126
|
-
actions:
|
|
123
|
+
children: /* @__PURE__ */ s(p, {
|
|
124
|
+
layout: u.layout?.zone === "aside" ? "stack" : "grid",
|
|
125
|
+
emptyState: /* @__PURE__ */ s(v, {}),
|
|
126
|
+
actions: u.actions.map((e) => ({
|
|
127
127
|
id: e.id,
|
|
128
128
|
href: e.href,
|
|
129
|
-
label:
|
|
129
|
+
label: i(e.label, _)
|
|
130
130
|
}))
|
|
131
131
|
})
|
|
132
132
|
});
|
|
133
|
-
if (
|
|
134
|
-
let e = S(
|
|
135
|
-
return e == null ? /* @__PURE__ */
|
|
136
|
-
title:
|
|
133
|
+
if (u.kind === "statusSummary") {
|
|
134
|
+
let e = S();
|
|
135
|
+
return e == null ? /* @__PURE__ */ s(f, {
|
|
136
|
+
title: u.title == null ? void 0 : i(u.title, _),
|
|
137
137
|
subtitle: x,
|
|
138
|
-
children: /* @__PURE__ */
|
|
139
|
-
}) : /* @__PURE__ */
|
|
140
|
-
title:
|
|
138
|
+
children: /* @__PURE__ */ s(v, {})
|
|
139
|
+
}) : /* @__PURE__ */ s(f, {
|
|
140
|
+
title: u.title == null ? void 0 : i(u.title, _),
|
|
141
141
|
subtitle: x,
|
|
142
|
-
children: /* @__PURE__ */
|
|
143
|
-
emptyState: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ s(h, {
|
|
143
|
+
emptyState: /* @__PURE__ */ s(v, {}),
|
|
144
144
|
items: e.map((e) => ({
|
|
145
145
|
id: e.id,
|
|
146
146
|
href: e.href,
|
|
147
|
-
label:
|
|
148
|
-
value: e.value ??
|
|
147
|
+
label: i(e.label, _),
|
|
148
|
+
value: e.value ?? y("common.notAvailable")
|
|
149
149
|
}))
|
|
150
150
|
})
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
if (
|
|
154
|
-
title:
|
|
153
|
+
if (u.kind === "recentItems") return /* @__PURE__ */ s(f, {
|
|
154
|
+
title: u.title == null ? y("dashboard.title") : i(u.title, _),
|
|
155
155
|
subtitle: x,
|
|
156
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ s(v, {})
|
|
157
157
|
});
|
|
158
|
-
let C = b[
|
|
159
|
-
if (C?.kind !== "list-detail") return /* @__PURE__ */
|
|
160
|
-
title:
|
|
158
|
+
let C = b[u.entityId];
|
|
159
|
+
if (C?.kind !== "list-detail") return /* @__PURE__ */ s(f, {
|
|
160
|
+
title: i(u.label, _),
|
|
161
161
|
subtitle: x,
|
|
162
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ s(v, {})
|
|
163
163
|
});
|
|
164
|
-
let w = S(
|
|
165
|
-
return typeof w?.count == "number" && (T = w.count), /* @__PURE__ */
|
|
166
|
-
title:
|
|
164
|
+
let w = S(), T = y("common.notAvailable");
|
|
165
|
+
return typeof w?.count == "number" && (T = w.count), /* @__PURE__ */ s(f, {
|
|
166
|
+
title: i(u.label, _),
|
|
167
167
|
subtitle: x,
|
|
168
|
-
children: /* @__PURE__ */
|
|
169
|
-
className:
|
|
170
|
-
children: [/* @__PURE__ */
|
|
171
|
-
className:
|
|
168
|
+
children: /* @__PURE__ */ c("div", {
|
|
169
|
+
className: a,
|
|
170
|
+
children: [/* @__PURE__ */ s("div", {
|
|
171
|
+
className: o,
|
|
172
172
|
children: T
|
|
173
|
-
}), /* @__PURE__ */
|
|
174
|
-
emptyState: /* @__PURE__ */
|
|
173
|
+
}), /* @__PURE__ */ s(p, {
|
|
174
|
+
emptyState: /* @__PURE__ */ s(v, {}),
|
|
175
175
|
actions: [{
|
|
176
176
|
id: C.id,
|
|
177
177
|
href: C.routes.list,
|
|
178
|
-
label:
|
|
178
|
+
label: y("dashboard.actions.openList")
|
|
179
179
|
}]
|
|
180
180
|
})]
|
|
181
181
|
})
|
|
182
182
|
});
|
|
183
|
-
},
|
|
184
|
-
widget: e,
|
|
185
|
-
globalData: v(e.query, {}, { fetchPolicy: "store-or-network" })
|
|
186
|
-
}), S = ({ widget: e, globalData: t }) => i(e) ? /* @__PURE__ */ c(x, { widget: e }) : /* @__PURE__ */ c(b, {
|
|
183
|
+
}, b = ({ widget: e }) => /* @__PURE__ */ s(y, {
|
|
187
184
|
widget: e,
|
|
188
|
-
|
|
189
|
-
});
|
|
185
|
+
data: _(e.query, e.variables, { fetchPolicy: "store-or-network" })
|
|
186
|
+
}), x = ({ widget: e }) => e.dataSource === "query" ? /* @__PURE__ */ s(b, { widget: e }) : /* @__PURE__ */ s(y, { widget: e });
|
|
190
187
|
//#endregion
|
|
191
|
-
export {
|
|
188
|
+
export { x as BackofficeDashboardWidgetContent, x as default };
|
|
192
189
|
|
|
193
190
|
//# sourceMappingURL=BackofficeDashboardWidgetContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardWidgetContent.js","names":[],"sources":["../../../src/pages/BackofficeDashboardWidgetContent.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport { type JSX } from 'react';\nimport type {\n BackofficeDashboardWidget,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport { BackofficeEmptyState } from '@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js';\nimport { DashboardMetricGroup } from '@plumile/ui/components/dashboard/dashboard_metric_group/DashboardMetricGroup.js';\nimport { DashboardPanel } from '@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js';\nimport { DashboardQuickActions } from '@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js';\nimport { DashboardStatusList } from '@plumile/ui/components/dashboard/dashboard_status_list/DashboardStatusList.js';\nimport { DataTable } from '@plumile/ui/components/data-table/DataTable.js';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { GraphQLTaggedNode, OperationType } from 'relay-runtime';\n\nimport { BackofficeBillingUsageChart } from '../components/backoffice/billing/BackofficeBillingUsageChart.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport {\n hasWidgetQuery,\n resolveLabel,\n} from './BackofficeDashboardPage.helpers.js';\n\nimport * as styles from './backofficeDashboardPage.css.js';\n\nconst { useLazyLoadQuery } = ReactRelay;\n\nexport type BackofficeDashboardWidgetContentProps = {\n widget: BackofficeDashboardWidget;\n globalData: unknown;\n};\n\nconst DashboardUnavailableState = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return <BackofficeEmptyState title={t('common.notAvailable')} />;\n};\n\nconst WidgetContentBody = ({\n widget,\n globalData,\n}: BackofficeDashboardWidgetContentProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const description =\n widget.description != null\n ? resolveLabel(widget.description, tApp)\n : undefined;\n\n const resolveData = (data: unknown): unknown => {\n if ('resolve' in widget && widget.resolve != null) {\n return widget.resolve(data);\n }\n return null;\n };\n\n if (widget.kind === 'textBlock') {\n const title = resolveLabel(widget.title, tApp);\n const body = resolveLabel(widget.body, tApp);\n return (\n <DashboardPanel title={title} subtitle={description}>\n <div className={styles.tileBody}>{body}</div>\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'shortcut') {\n const entity = entities[widget.entityId];\n const title = resolveLabel(widget.label, tApp);\n if (entity == null) {\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n if (entity.kind === 'tool') {\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardQuickActions\n actions={[\n {\n id: entity.id,\n href: entity.routes.list,\n label: t('dashboard.actions.openTool'),\n },\n ]}\n />\n </DashboardPanel>\n );\n }\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardQuickActions\n actions={[\n {\n id: entity.id,\n href: entity.routes.list,\n label: t('dashboard.actions.openList'),\n },\n ]}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'tablePreview') {\n const resolved = resolveData(globalData) as {\n columns: readonly unknown[];\n rows: readonly unknown[];\n } | null;\n if (resolved == null) {\n return (\n <DashboardPanel\n title={resolveLabel(widget.title, tApp)}\n subtitle={description}\n >\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n const columns = buildDataTableColumns(resolved.columns as never, {\n tApp,\n t,\n });\n const title = resolveLabel(widget.title, tApp);\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DataTable\n columns={columns}\n rows={resolved.rows}\n getRowId={(row, index) => {\n if (row != null && typeof row === 'object') {\n const record = row as Record<string, unknown>;\n const { id } = record;\n if (typeof id === 'string' && id.trim() !== '') {\n return id;\n }\n }\n return String(index);\n }}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'metricGroup') {\n const resolved = resolveData(globalData) as\n | readonly {\n id: string;\n label: I18nLabel;\n value: string | number | null;\n meta?: I18nLabel;\n href?: string;\n }[]\n | null;\n if (resolved == null) {\n return <DashboardUnavailableState />;\n }\n return (\n <DashboardMetricGroup\n emptyState={<DashboardUnavailableState />}\n metrics={resolved.map((metric) => {\n return {\n id: metric.id,\n href: metric.href,\n label: resolveLabel(metric.label, tApp),\n value: metric.value ?? t('common.notAvailable'),\n hint:\n metric.meta != null ? resolveLabel(metric.meta, tApp) : undefined,\n };\n })}\n />\n );\n }\n\n if (widget.kind === 'billingUsageChart') {\n const resolved = resolveData(globalData) as {\n currency: string;\n totalAmount: number;\n from: string | null;\n to: string | null;\n buckets: readonly {\n day: string;\n category: string;\n value: number;\n }[];\n } | null;\n const title = resolveLabel(widget.title, tApp);\n if (resolved == null) {\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n\n return (\n <DashboardPanel title={title} subtitle={description}>\n <BackofficeBillingUsageChart\n ariaLabel={resolveLabel(widget.ariaLabel, tApp)}\n buckets={resolved.buckets}\n categories={widget.categories.map((category) => {\n return {\n id: category.id,\n label: resolveLabel(category.label, tApp),\n color: category.color,\n };\n })}\n currency={resolved.currency}\n emptyLabel={resolveLabel(widget.emptyLabel, tApp)}\n from={resolved.from}\n rangePrefix={resolveLabel(widget.rangePrefix, tApp)}\n to={resolved.to}\n totalAmount={resolved.totalAmount}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'quickActions') {\n const title =\n widget.title != null\n ? resolveLabel(widget.title, tApp)\n : t('dashboard.actions.openTool');\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardQuickActions\n layout={widget.layout?.zone === 'aside' ? 'stack' : 'grid'}\n emptyState={<DashboardUnavailableState />}\n actions={widget.actions.map((action) => {\n return {\n id: action.id,\n href: action.href,\n label: resolveLabel(action.label, tApp),\n };\n })}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'statusSummary') {\n const resolved = resolveData(globalData) as\n | readonly {\n id: string;\n label: I18nLabel;\n value: string | number | null;\n href?: string;\n }[]\n | null;\n if (resolved == null) {\n const title =\n widget.title != null ? resolveLabel(widget.title, tApp) : undefined;\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n const title =\n widget.title != null ? resolveLabel(widget.title, tApp) : undefined;\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardStatusList\n emptyState={<DashboardUnavailableState />}\n items={resolved.map((item) => {\n return {\n id: item.id,\n href: item.href,\n label: resolveLabel(item.label, tApp),\n value: item.value ?? t('common.notAvailable'),\n };\n })}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'recentItems') {\n const title =\n widget.title != null\n ? resolveLabel(widget.title, tApp)\n : t('dashboard.title');\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n\n const entityManifest = entities[widget.entityId];\n if (entityManifest?.kind !== 'list-detail') {\n return (\n <DashboardPanel\n title={resolveLabel(widget.label, tApp)}\n subtitle={description}\n >\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n const resolved = resolveData(globalData) as { count: number | null } | null;\n let countLabel: number | string = t('common.notAvailable');\n if (typeof resolved?.count === 'number') {\n countLabel = resolved.count;\n }\n const title = resolveLabel(widget.label, tApp);\n return (\n <DashboardPanel title={title} subtitle={description}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>{countLabel}</div>\n <DashboardQuickActions\n emptyState={<DashboardUnavailableState />}\n actions={[\n {\n id: entityManifest.id,\n href: entityManifest.routes.list,\n label: t('dashboard.actions.openList'),\n },\n ]}\n />\n </div>\n </DashboardPanel>\n );\n};\n\nconst WidgetWithQuery = ({\n widget,\n}: {\n widget: BackofficeDashboardWidget & { query: GraphQLTaggedNode };\n}): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(\n widget.query,\n {},\n {\n fetchPolicy: 'store-or-network',\n },\n );\n\n return <WidgetContentBody widget={widget} globalData={data} />;\n};\n\nexport const BackofficeDashboardWidgetContent = ({\n widget,\n globalData,\n}: BackofficeDashboardWidgetContentProps): JSX.Element | null => {\n if (hasWidgetQuery(widget)) {\n return <WidgetWithQuery widget={widget} />;\n }\n\n return <WidgetContentBody widget={widget} globalData={globalData} />;\n};\n\nexport default BackofficeDashboardWidgetContent;\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAM,EAAE,kBAAA,MAAqB,GAOvB,UAA+C;CACnD,IAAM,EAAE,MAAM,EAA8B;CAE5C,OAAO,kBAAC,GAAD,EAAsB,OAAO,EAAE,qBAAqB,EAAI,CAAA;AACjE,GAEM,KAAqB,EACzB,WACA,oBAC+D;CAC/D,IAAM,EAAE,GAAG,MAAS,EAAe,GAC7B,EAAE,SAAM,EAA8B,GACtC,EAAE,gBAAa,EAAoB,GACnC,IACJ,EAAO,eAAe,OAElB,KAAA,IADA,EAAa,EAAO,aAAa,CAAI,GAGrC,KAAe,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CAA4B,CAAA;CACd,CAAA;CAGpB,IAAM,IAAW,EAAY,CAAU,GACnC,IAA8B,EAAE,qBAAqB;CAKzD,OAJI,OAAO,GAAU,SAAU,aAC7B,IAAa,EAAS,QAItB,kBAAC,GAAD;EAAuB,OAFX,EAAa,EAAO,OAAO,CAEhB;EAAO,UAAU;YACtC,kBAAC,OAAD;GAAK,WAAW;aAAhB,CACE,kBAAC,OAAD;IAAK,WAAW;cAAmB;GAAgB,CAAA,GACnD,kBAAC,GAAD;IACE,YAAY,kBAAC,GAAD,CAA4B,CAAA;IACxC,SAAS,CACP;KACE,IAAI,EAAe;KACnB,MAAM,EAAe,OAAO;KAC5B,OAAO,EAAE,4BAA4B;IACvC,CACF;GACD,CAAA,CACE;;CACS,CAAA;AAEpB,GAEM,KAAmB,EACvB,gBAYO,kBAAC,GAAD;CAA2B;CAAQ,YAR7B,EACX,EAAO,OACP,CAAC,GACD,EACE,aAAa,mBACf,CAGoD;AAAO,CAAA,GAGlD,KAAoC,EAC/C,WACA,oBAEI,EAAe,CAAM,IAChB,kBAAC,GAAD,EAAyB,UAAS,CAAA,IAGpC,kBAAC,GAAD;CAA2B;CAAoB;AAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardWidgetContent.js","names":[],"sources":["../../../src/pages/BackofficeDashboardWidgetContent.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport { type JSX } from 'react';\nimport type {\n BackofficeDashboardWidget,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport { BackofficeEmptyState } from '@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js';\nimport { DashboardMetricGroup } from '@plumile/ui/components/dashboard/dashboard_metric_group/DashboardMetricGroup.js';\nimport { DashboardPanel } from '@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js';\nimport { DashboardQuickActions } from '@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js';\nimport { DashboardStatusList } from '@plumile/ui/components/dashboard/dashboard_status_list/DashboardStatusList.js';\nimport { DataTable } from '@plumile/ui/components/data-table/DataTable.js';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport { BackofficeBillingUsageChart } from '../components/backoffice/billing/BackofficeBillingUsageChart.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { resolveLabel } from './BackofficeDashboardPage.helpers.js';\n\nimport * as styles from './backofficeDashboardPage.css.js';\n\nconst { useLazyLoadQuery } = ReactRelay;\n\nexport type BackofficeDashboardWidgetContentProps = {\n widget: BackofficeDashboardWidget;\n};\n\ntype WidgetContentBodyProps = BackofficeDashboardWidgetContentProps & {\n data?: OperationType['response'];\n};\n\nconst DashboardUnavailableState = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return <BackofficeEmptyState title={t('common.notAvailable')} />;\n};\n\nconst WidgetContentBody = ({\n widget,\n data,\n}: WidgetContentBodyProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const description =\n widget.description != null\n ? resolveLabel(widget.description, tApp)\n : undefined;\n\n const resolveData = (): unknown => {\n if (widget.dataSource === 'query' && data != null) {\n return widget.resolve(data);\n }\n return null;\n };\n\n if (widget.kind === 'textBlock') {\n const title = resolveLabel(widget.title, tApp);\n const body = resolveLabel(widget.body, tApp);\n return (\n <DashboardPanel title={title} subtitle={description}>\n <div className={styles.tileBody}>{body}</div>\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'shortcut') {\n const entity = entities[widget.entityId];\n const title = resolveLabel(widget.label, tApp);\n if (entity == null) {\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n if (entity.kind === 'tool') {\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardQuickActions\n actions={[\n {\n id: entity.id,\n href: entity.routes.list,\n label: t('dashboard.actions.openTool'),\n },\n ]}\n />\n </DashboardPanel>\n );\n }\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardQuickActions\n actions={[\n {\n id: entity.id,\n href: entity.routes.list,\n label: t('dashboard.actions.openList'),\n },\n ]}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'tablePreview') {\n const resolved = resolveData() as {\n columns: readonly unknown[];\n rows: readonly unknown[];\n } | null;\n if (resolved == null) {\n return (\n <DashboardPanel\n title={resolveLabel(widget.title, tApp)}\n subtitle={description}\n >\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n const columns = buildDataTableColumns(resolved.columns as never, {\n tApp,\n t,\n });\n const title = resolveLabel(widget.title, tApp);\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DataTable\n columns={columns}\n rows={resolved.rows}\n getRowId={(row, index) => {\n if (row != null && typeof row === 'object') {\n const record = row as Record<string, unknown>;\n const { id } = record;\n if (typeof id === 'string' && id.trim() !== '') {\n return id;\n }\n }\n return String(index);\n }}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'metricGroup') {\n const resolved = resolveData() as\n | readonly {\n id: string;\n label: I18nLabel;\n value: string | number | null;\n meta?: I18nLabel;\n href?: string;\n }[]\n | null;\n if (resolved == null) {\n return <DashboardUnavailableState />;\n }\n return (\n <DashboardMetricGroup\n emptyState={<DashboardUnavailableState />}\n metrics={resolved.map((metric) => {\n return {\n id: metric.id,\n href: metric.href,\n label: resolveLabel(metric.label, tApp),\n value: metric.value ?? t('common.notAvailable'),\n hint:\n metric.meta != null ? resolveLabel(metric.meta, tApp) : undefined,\n };\n })}\n />\n );\n }\n\n if (widget.kind === 'billingUsageChart') {\n const resolved = resolveData() as {\n currency: string;\n totalAmount: number;\n from: string | null;\n to: string | null;\n buckets: readonly {\n day: string;\n category: string;\n value: number;\n }[];\n } | null;\n const title = resolveLabel(widget.title, tApp);\n if (resolved == null) {\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n\n return (\n <DashboardPanel title={title} subtitle={description}>\n <BackofficeBillingUsageChart\n ariaLabel={resolveLabel(widget.ariaLabel, tApp)}\n buckets={resolved.buckets}\n categories={widget.categories.map((category) => {\n return {\n id: category.id,\n label: resolveLabel(category.label, tApp),\n color: category.color,\n };\n })}\n currency={resolved.currency}\n emptyLabel={resolveLabel(widget.emptyLabel, tApp)}\n from={resolved.from}\n rangePrefix={resolveLabel(widget.rangePrefix, tApp)}\n to={resolved.to}\n totalAmount={resolved.totalAmount}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'quickActions') {\n const title =\n widget.title != null\n ? resolveLabel(widget.title, tApp)\n : t('dashboard.actions.openTool');\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardQuickActions\n layout={widget.layout?.zone === 'aside' ? 'stack' : 'grid'}\n emptyState={<DashboardUnavailableState />}\n actions={widget.actions.map((action) => {\n return {\n id: action.id,\n href: action.href,\n label: resolveLabel(action.label, tApp),\n };\n })}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'statusSummary') {\n const resolved = resolveData() as\n | readonly {\n id: string;\n label: I18nLabel;\n value: string | number | null;\n href?: string;\n }[]\n | null;\n if (resolved == null) {\n const title =\n widget.title != null ? resolveLabel(widget.title, tApp) : undefined;\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n const title =\n widget.title != null ? resolveLabel(widget.title, tApp) : undefined;\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardStatusList\n emptyState={<DashboardUnavailableState />}\n items={resolved.map((item) => {\n return {\n id: item.id,\n href: item.href,\n label: resolveLabel(item.label, tApp),\n value: item.value ?? t('common.notAvailable'),\n };\n })}\n />\n </DashboardPanel>\n );\n }\n\n if (widget.kind === 'recentItems') {\n const title =\n widget.title != null\n ? resolveLabel(widget.title, tApp)\n : t('dashboard.title');\n return (\n <DashboardPanel title={title} subtitle={description}>\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n\n const entityManifest = entities[widget.entityId];\n if (entityManifest?.kind !== 'list-detail') {\n return (\n <DashboardPanel\n title={resolveLabel(widget.label, tApp)}\n subtitle={description}\n >\n <DashboardUnavailableState />\n </DashboardPanel>\n );\n }\n const resolved = resolveData() as { count: number | null } | null;\n let countLabel: number | string = t('common.notAvailable');\n if (typeof resolved?.count === 'number') {\n countLabel = resolved.count;\n }\n const title = resolveLabel(widget.label, tApp);\n return (\n <DashboardPanel title={title} subtitle={description}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>{countLabel}</div>\n <DashboardQuickActions\n emptyState={<DashboardUnavailableState />}\n actions={[\n {\n id: entityManifest.id,\n href: entityManifest.routes.list,\n label: t('dashboard.actions.openList'),\n },\n ]}\n />\n </div>\n </DashboardPanel>\n );\n};\n\nconst WidgetWithQuery = ({\n widget,\n}: {\n widget: Extract<BackofficeDashboardWidget, { dataSource: 'query' }>;\n}): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(widget.query, widget.variables, {\n fetchPolicy: 'store-or-network',\n });\n\n return <WidgetContentBody widget={widget} data={data} />;\n};\n\nexport const BackofficeDashboardWidgetContent = ({\n widget,\n}: BackofficeDashboardWidgetContentProps): JSX.Element | null => {\n if (widget.dataSource === 'query') {\n return <WidgetWithQuery widget={widget} />;\n }\n\n return <WidgetContentBody widget={widget} />;\n};\n\nexport default BackofficeDashboardWidgetContent;\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,IAAM,EAAE,kBAAA,MAAqB,GAUvB,UAA+C;CACnD,IAAM,EAAE,MAAM,EAA8B;CAE5C,OAAO,kBAAC,GAAD,EAAsB,OAAO,EAAE,qBAAqB,EAAI,CAAA;AACjE,GAEM,KAAqB,EACzB,WACA,cACgD;CAChD,IAAM,EAAE,GAAG,MAAS,EAA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GAAgB,SAAS,eAC3B,OACE,kBAAC,GAAD;EACE,OAAO,EAAa,EAAO,OAAO,CAAI;EACtC,UAAU;YAEV,kBAAC,GAAD,CAA4B,CAAA;CACd,CAAA;CAGpB,IAAM,IAAW,EAAY,GACzB,IAA8B,EAAE,qBAAqB;CAKzD,OAJI,OAAO,GAAU,SAAU,aAC7B,IAAa,EAAS,QAItB,kBAAC,GAAD;EAAuB,OAFX,EAAa,EAAO,OAAO,CAEhB;EAAO,UAAU;YACtC,kBAAC,OAAD;GAAK,WAAW;aAAhB,CACE,kBAAC,OAAD;IAAK,WAAW;cAAmB;GAAgB,CAAA,GACnD,kBAAC,GAAD;IACE,YAAY,kBAAC,GAAD,CAA4B,CAAA;IACxC,SAAS,CACP;KACE,IAAI,EAAe;KACnB,MAAM,EAAe,OAAO;KAC5B,OAAO,EAAE,4BAA4B;IACvC,CACF;GACD,CAAA,CACE;;CACS,CAAA;AAEpB,GAEM,KAAmB,EACvB,gBAQO,kBAAC,GAAD;CAA2B;CAAc,MAJnC,EAAgC,EAAO,OAAO,EAAO,WAAW,EAC3E,aAAa,mBACf,CAEgD;AAAO,CAAA,GAG5C,KAAoC,EAC/C,gBAEI,EAAO,eAAe,UACjB,kBAAC,GAAD,EAAyB,UAAS,CAAA,IAGpC,kBAAC,GAAD,EAA2B,UAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardPage.d.ts","sourceRoot":"","sources":["../../../src/pages/BackofficeDashboardPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,GAAG,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardPage.d.ts","sourceRoot":"","sources":["../../../src/pages/BackofficeDashboardPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,GAAG,EAAY,MAAM,OAAO,CAAC;AAuBjD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AAgI5F,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,EAAE,gCAAgC,GAAG,IAAI,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,eAErC,4BAA4B,KAAG,GAAG,CAAC,OAiErC,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { BackofficeDashboardConfig, BackofficeDashboardWidget, I18nLabel } from '@plumile/backoffice-core/types.js';
|
|
2
2
|
import type { TFunction } from 'i18next';
|
|
3
|
-
import type { GraphQLTaggedNode } from 'relay-runtime';
|
|
4
3
|
export declare const resolveLabel: (label: I18nLabel, tApp: TFunction) => string;
|
|
5
4
|
export declare const getWidgetLabel: (widget: BackofficeDashboardWidget, config: BackofficeDashboardConfig) => I18nLabel;
|
|
6
|
-
export declare const hasWidgetQuery: (widget: BackofficeDashboardWidget) => widget is BackofficeDashboardWidget & {
|
|
7
|
-
query: GraphQLTaggedNode;
|
|
8
|
-
};
|
|
9
5
|
//# sourceMappingURL=BackofficeDashboardPage.helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardPage.helpers.d.ts","sourceRoot":"","sources":["../../../src/pages/BackofficeDashboardPage.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,SAAS,EACV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardPage.helpers.d.ts","sourceRoot":"","sources":["../../../src/pages/BackofficeDashboardPage.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,SAAS,EACV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,EAAE,MAAM,SAAS,KAAG,MAEhE,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,yBAAyB,EACjC,QAAQ,yBAAyB,KAChC,SAoBF,CAAC"}
|
|
@@ -2,8 +2,7 @@ import { type JSX } from 'react';
|
|
|
2
2
|
import type { BackofficeDashboardWidget } from '@plumile/backoffice-core/types.js';
|
|
3
3
|
export type BackofficeDashboardWidgetContentProps = {
|
|
4
4
|
widget: BackofficeDashboardWidget;
|
|
5
|
-
globalData: unknown;
|
|
6
5
|
};
|
|
7
|
-
export declare const BackofficeDashboardWidgetContent: ({ widget,
|
|
6
|
+
export declare const BackofficeDashboardWidgetContent: ({ widget, }: BackofficeDashboardWidgetContentProps) => JSX.Element | null;
|
|
8
7
|
export default BackofficeDashboardWidgetContent;
|
|
9
8
|
//# sourceMappingURL=BackofficeDashboardWidgetContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardWidgetContent.d.ts","sourceRoot":"","sources":["../../../src/pages/BackofficeDashboardWidgetContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardWidgetContent.d.ts","sourceRoot":"","sources":["../../../src/pages/BackofficeDashboardWidgetContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,mCAAmC,CAAC;AAqB3C,MAAM,MAAM,qCAAqC,GAAG;IAClD,MAAM,EAAE,yBAAyB,CAAC;CACnC,CAAC;AA0TF,eAAO,MAAM,gCAAgC,GAAI,aAE9C,qCAAqC,KAAG,GAAG,CAAC,OAAO,GAAG,IAMxD,CAAC;AAEF,eAAe,gCAAgC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumile/backoffice-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.154",
|
|
4
4
|
"description": "React provider and pages for Kronex backoffice",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
},
|
|
172
172
|
"dependencies": {
|
|
173
173
|
"graphql-ws": "6.0.8",
|
|
174
|
-
"i18next": "^26.
|
|
174
|
+
"i18next": "^26.3.0",
|
|
175
175
|
"i18next-browser-languagedetector": "8.2.1",
|
|
176
176
|
"react-i18next": "^17.0.8",
|
|
177
177
|
"react-qr-code": "^2.0.21",
|
|
@@ -179,15 +179,15 @@
|
|
|
179
179
|
"tslib": "^2.8.1"
|
|
180
180
|
},
|
|
181
181
|
"devDependencies": {
|
|
182
|
-
"@plumile/auth": "^0.1.
|
|
183
|
-
"@plumile/backoffice-core": "^0.1.
|
|
184
|
-
"@plumile/filter-query": "^0.1.
|
|
185
|
-
"@plumile/router": "^0.1.
|
|
186
|
-
"@plumile/ui": "^0.1.
|
|
182
|
+
"@plumile/auth": "^0.1.154",
|
|
183
|
+
"@plumile/backoffice-core": "^0.1.154",
|
|
184
|
+
"@plumile/filter-query": "^0.1.154",
|
|
185
|
+
"@plumile/router": "^0.1.154",
|
|
186
|
+
"@plumile/ui": "^0.1.154",
|
|
187
187
|
"@types/react": "19.2.15",
|
|
188
188
|
"@types/react-dom": "19.2.3",
|
|
189
189
|
"@types/relay-runtime": "20.1.1",
|
|
190
|
-
"i18next": "26.
|
|
190
|
+
"i18next": "26.3.0",
|
|
191
191
|
"react": "19.2.6",
|
|
192
192
|
"react-dom": "19.2.6",
|
|
193
193
|
"react-relay": "21.0.0",
|
|
@@ -196,12 +196,12 @@
|
|
|
196
196
|
"typescript": "6.0.3"
|
|
197
197
|
},
|
|
198
198
|
"peerDependencies": {
|
|
199
|
-
"@plumile/auth": "^0.1.
|
|
200
|
-
"@plumile/backoffice-core": "^0.1.
|
|
201
|
-
"@plumile/filter-query": "^0.1.
|
|
202
|
-
"@plumile/router": "^0.1.
|
|
203
|
-
"@plumile/ui": "^0.1.
|
|
204
|
-
"i18next": "^26.
|
|
199
|
+
"@plumile/auth": "^0.1.153",
|
|
200
|
+
"@plumile/backoffice-core": "^0.1.153",
|
|
201
|
+
"@plumile/filter-query": "^0.1.153",
|
|
202
|
+
"@plumile/router": "^0.1.153",
|
|
203
|
+
"@plumile/ui": "^0.1.153",
|
|
204
|
+
"i18next": "^26.3.0",
|
|
205
205
|
"react": "^19.2.6",
|
|
206
206
|
"react-dom": "^19.2.6",
|
|
207
207
|
"react-i18next": "^17.0.8",
|