@plumile/backoffice-react 0.1.151 → 0.1.153
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 +0 -1
- package/lib/esm/components/backoffice/hub/backofficeHubTemplate.css.js +2 -0
- package/lib/esm/pages/BackofficeDashboardPage.js +73 -244
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardWidgetContent.js +193 -0
- package/lib/esm/pages/BackofficeDashboardWidgetContent.js.map +1 -0
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js +8 -10
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +261 -246
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailUnknownPageRedirect.js +10 -9
- package/lib/esm/pages/BackofficeEntityDetailUnknownPageRedirect.js.map +1 -1
- package/lib/esm/pages/BackofficeRedirect.js +13 -0
- package/lib/esm/pages/BackofficeRedirect.js.map +1 -0
- package/lib/esm/router/createBackofficeRoutes.js +100 -97
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardWidgetContent.d.ts +9 -0
- package/lib/types/pages/BackofficeDashboardWidgetContent.d.ts.map +1 -0
- 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 -2
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailUnknownPageRedirect.d.ts.map +1 -1
- package/lib/types/pages/BackofficeRedirect.d.ts +7 -0
- package/lib/types/pages/BackofficeRedirect.d.ts.map +1 -0
- package/lib/types/router/createBackofficeRoutes.d.ts +3 -1
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { useBackofficeReactTranslation as e } from "../i18n/useBackofficeReactTranslation.js";
|
|
2
|
+
import { useBackofficeConfig as t } from "../provider/BackofficeConfigContext.js";
|
|
3
|
+
import { BackofficeBillingUsageChart as n } from "../components/backoffice/billing/BackofficeBillingUsageChart.js";
|
|
4
|
+
import { buildDataTableColumns as r } from "../components/backoffice/columns/buildDataTableColumns.js";
|
|
5
|
+
import { hasWidgetQuery as i, resolveLabel as a } from "./BackofficeDashboardPage.helpers.js";
|
|
6
|
+
import { tileBody as o, tileCount as s } from "./backofficeDashboardPage.css.js";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { useTranslation as u } from "react-i18next";
|
|
9
|
+
import * as d from "react-relay";
|
|
10
|
+
import { BackofficeEmptyState as f } from "@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js";
|
|
11
|
+
import { DashboardPanel as p } from "@plumile/ui/components/dashboard/dashboard_panel/DashboardPanel.js";
|
|
12
|
+
import { DashboardQuickActions as m } from "@plumile/ui/components/dashboard/dashboard_quick_actions/DashboardQuickActions.js";
|
|
13
|
+
import { DashboardMetricGroup as h } from "@plumile/ui/components/dashboard/dashboard_metric_group/DashboardMetricGroup.js";
|
|
14
|
+
import { DashboardStatusList as g } from "@plumile/ui/components/dashboard/dashboard_status_list/DashboardStatusList.js";
|
|
15
|
+
import { DataTable as _ } from "@plumile/ui/components/data-table/DataTable.js";
|
|
16
|
+
//#region src/pages/BackofficeDashboardWidgetContent.tsx
|
|
17
|
+
var { useLazyLoadQuery: v } = d, y = () => {
|
|
18
|
+
let { t } = e();
|
|
19
|
+
return /* @__PURE__ */ c(f, { title: t("common.notAvailable") });
|
|
20
|
+
}, b = ({ widget: i, globalData: d }) => {
|
|
21
|
+
let { t: f } = u(), { t: v } = e(), { entities: b } = t(), x = i.description == null ? void 0 : a(i.description, f), S = (e) => "resolve" in i && i.resolve != null ? i.resolve(e) : null;
|
|
22
|
+
if (i.kind === "textBlock") return /* @__PURE__ */ c(p, {
|
|
23
|
+
title: a(i.title, f),
|
|
24
|
+
subtitle: x,
|
|
25
|
+
children: /* @__PURE__ */ c("div", {
|
|
26
|
+
className: o,
|
|
27
|
+
children: a(i.body, f)
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
if (i.kind === "shortcut") {
|
|
31
|
+
let e = b[i.entityId], t = a(i.label, f);
|
|
32
|
+
return e == null ? /* @__PURE__ */ c(p, {
|
|
33
|
+
title: t,
|
|
34
|
+
subtitle: x,
|
|
35
|
+
children: /* @__PURE__ */ c(y, {})
|
|
36
|
+
}) : e.kind === "tool" ? /* @__PURE__ */ c(p, {
|
|
37
|
+
title: t,
|
|
38
|
+
subtitle: x,
|
|
39
|
+
children: /* @__PURE__ */ c(m, { actions: [{
|
|
40
|
+
id: e.id,
|
|
41
|
+
href: e.routes.list,
|
|
42
|
+
label: v("dashboard.actions.openTool")
|
|
43
|
+
}] })
|
|
44
|
+
}) : /* @__PURE__ */ c(p, {
|
|
45
|
+
title: t,
|
|
46
|
+
subtitle: x,
|
|
47
|
+
children: /* @__PURE__ */ c(m, { actions: [{
|
|
48
|
+
id: e.id,
|
|
49
|
+
href: e.routes.list,
|
|
50
|
+
label: v("dashboard.actions.openList")
|
|
51
|
+
}] })
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (i.kind === "tablePreview") {
|
|
55
|
+
let e = S(d);
|
|
56
|
+
if (e == null) return /* @__PURE__ */ c(p, {
|
|
57
|
+
title: a(i.title, f),
|
|
58
|
+
subtitle: x,
|
|
59
|
+
children: /* @__PURE__ */ c(y, {})
|
|
60
|
+
});
|
|
61
|
+
let t = r(e.columns, {
|
|
62
|
+
tApp: f,
|
|
63
|
+
t: v
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ c(p, {
|
|
66
|
+
title: a(i.title, f),
|
|
67
|
+
subtitle: x,
|
|
68
|
+
children: /* @__PURE__ */ c(_, {
|
|
69
|
+
columns: t,
|
|
70
|
+
rows: e.rows,
|
|
71
|
+
getRowId: (e, t) => {
|
|
72
|
+
if (typeof e == "object" && e) {
|
|
73
|
+
let { id: t } = e;
|
|
74
|
+
if (typeof t == "string" && t.trim() !== "") return t;
|
|
75
|
+
}
|
|
76
|
+
return String(t);
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (i.kind === "metricGroup") {
|
|
82
|
+
let e = S(d);
|
|
83
|
+
return e == null ? /* @__PURE__ */ c(y, {}) : /* @__PURE__ */ c(h, {
|
|
84
|
+
emptyState: /* @__PURE__ */ c(y, {}),
|
|
85
|
+
metrics: e.map((e) => ({
|
|
86
|
+
id: e.id,
|
|
87
|
+
href: e.href,
|
|
88
|
+
label: a(e.label, f),
|
|
89
|
+
value: e.value ?? v("common.notAvailable"),
|
|
90
|
+
hint: e.meta == null ? void 0 : a(e.meta, f)
|
|
91
|
+
}))
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (i.kind === "billingUsageChart") {
|
|
95
|
+
let e = S(d), t = a(i.title, f);
|
|
96
|
+
return e == null ? /* @__PURE__ */ c(p, {
|
|
97
|
+
title: t,
|
|
98
|
+
subtitle: x,
|
|
99
|
+
children: /* @__PURE__ */ c(y, {})
|
|
100
|
+
}) : /* @__PURE__ */ c(p, {
|
|
101
|
+
title: t,
|
|
102
|
+
subtitle: x,
|
|
103
|
+
children: /* @__PURE__ */ c(n, {
|
|
104
|
+
ariaLabel: a(i.ariaLabel, f),
|
|
105
|
+
buckets: e.buckets,
|
|
106
|
+
categories: i.categories.map((e) => ({
|
|
107
|
+
id: e.id,
|
|
108
|
+
label: a(e.label, f),
|
|
109
|
+
color: e.color
|
|
110
|
+
})),
|
|
111
|
+
currency: e.currency,
|
|
112
|
+
emptyLabel: a(i.emptyLabel, f),
|
|
113
|
+
from: e.from,
|
|
114
|
+
rangePrefix: a(i.rangePrefix, f),
|
|
115
|
+
to: e.to,
|
|
116
|
+
totalAmount: e.totalAmount
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (i.kind === "quickActions") return /* @__PURE__ */ c(p, {
|
|
121
|
+
title: i.title == null ? v("dashboard.actions.openTool") : a(i.title, f),
|
|
122
|
+
subtitle: x,
|
|
123
|
+
children: /* @__PURE__ */ c(m, {
|
|
124
|
+
layout: i.layout?.zone === "aside" ? "stack" : "grid",
|
|
125
|
+
emptyState: /* @__PURE__ */ c(y, {}),
|
|
126
|
+
actions: i.actions.map((e) => ({
|
|
127
|
+
id: e.id,
|
|
128
|
+
href: e.href,
|
|
129
|
+
label: a(e.label, f)
|
|
130
|
+
}))
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
if (i.kind === "statusSummary") {
|
|
134
|
+
let e = S(d);
|
|
135
|
+
return e == null ? /* @__PURE__ */ c(p, {
|
|
136
|
+
title: i.title == null ? void 0 : a(i.title, f),
|
|
137
|
+
subtitle: x,
|
|
138
|
+
children: /* @__PURE__ */ c(y, {})
|
|
139
|
+
}) : /* @__PURE__ */ c(p, {
|
|
140
|
+
title: i.title == null ? void 0 : a(i.title, f),
|
|
141
|
+
subtitle: x,
|
|
142
|
+
children: /* @__PURE__ */ c(g, {
|
|
143
|
+
emptyState: /* @__PURE__ */ c(y, {}),
|
|
144
|
+
items: e.map((e) => ({
|
|
145
|
+
id: e.id,
|
|
146
|
+
href: e.href,
|
|
147
|
+
label: a(e.label, f),
|
|
148
|
+
value: e.value ?? v("common.notAvailable")
|
|
149
|
+
}))
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (i.kind === "recentItems") return /* @__PURE__ */ c(p, {
|
|
154
|
+
title: i.title == null ? v("dashboard.title") : a(i.title, f),
|
|
155
|
+
subtitle: x,
|
|
156
|
+
children: /* @__PURE__ */ c(y, {})
|
|
157
|
+
});
|
|
158
|
+
let C = b[i.entityId];
|
|
159
|
+
if (C?.kind !== "list-detail") return /* @__PURE__ */ c(p, {
|
|
160
|
+
title: a(i.label, f),
|
|
161
|
+
subtitle: x,
|
|
162
|
+
children: /* @__PURE__ */ c(y, {})
|
|
163
|
+
});
|
|
164
|
+
let w = S(d), T = v("common.notAvailable");
|
|
165
|
+
return typeof w?.count == "number" && (T = w.count), /* @__PURE__ */ c(p, {
|
|
166
|
+
title: a(i.label, f),
|
|
167
|
+
subtitle: x,
|
|
168
|
+
children: /* @__PURE__ */ l("div", {
|
|
169
|
+
className: o,
|
|
170
|
+
children: [/* @__PURE__ */ c("div", {
|
|
171
|
+
className: s,
|
|
172
|
+
children: T
|
|
173
|
+
}), /* @__PURE__ */ c(m, {
|
|
174
|
+
emptyState: /* @__PURE__ */ c(y, {}),
|
|
175
|
+
actions: [{
|
|
176
|
+
id: C.id,
|
|
177
|
+
href: C.routes.list,
|
|
178
|
+
label: v("dashboard.actions.openList")
|
|
179
|
+
}]
|
|
180
|
+
})]
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}, x = ({ widget: e }) => /* @__PURE__ */ c(b, {
|
|
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, {
|
|
187
|
+
widget: e,
|
|
188
|
+
globalData: t
|
|
189
|
+
});
|
|
190
|
+
//#endregion
|
|
191
|
+
export { S as BackofficeDashboardWidgetContent, S as default };
|
|
192
|
+
|
|
193
|
+
//# sourceMappingURL=BackofficeDashboardWidgetContent.js.map
|
|
@@ -0,0 +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,MACf,aAAa,KAAU,EAAO,WAAW,OACpC,EAAO,QAAQ,CAAI,IAErB;CAGT,IAAI,EAAO,SAAS,aAGlB,OACE,kBAAC,GAAD;EAAuB,OAHX,EAAa,EAAO,OAAO,CAGhB;EAAO,UAAU;YACtC,kBAAC,OAAD;GAAK,WAAW;aAHP,EAAa,EAAO,MAAM,CAGD;EAAU,CAAA;CAC9B,CAAA;CAIpB,IAAI,EAAO,SAAS,YAAY;EAC9B,IAAM,IAAS,EAAS,EAAO,WACzB,IAAQ,EAAa,EAAO,OAAO,CAAI;EAuB7C,OAtBI,KAAU,OAEV,kBAAC,GAAD;GAAuB;GAAO,UAAU;aACtC,kBAAC,GAAD,CAA4B,CAAA;EACd,CAAA,IAGhB,EAAO,SAAS,SAEhB,kBAAC,GAAD;GAAuB;GAAO,UAAU;aACtC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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,15 +1,13 @@
|
|
|
1
1
|
import { BackofficeEntityDetailLayoutContextProvider as e } from "./detail/BackofficeEntityDetailLayoutContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import i from "
|
|
2
|
+
import { BackofficeRedirect as t } from "./BackofficeRedirect.js";
|
|
3
|
+
import { Fragment as n, jsx as r } from "react/jsx-runtime";
|
|
4
|
+
import * as i from "react-relay";
|
|
5
5
|
//#region src/pages/BackofficeEntityDetailLayoutPage.tsx
|
|
6
|
-
var { useFragment: a, usePreloadedQuery: o } =
|
|
7
|
-
let l = o(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: { layoutView: r.layoutPage.toView(d) },
|
|
12
|
-
children: /* @__PURE__ */ n(t, { children: c })
|
|
6
|
+
var { useFragment: a, usePreloadedQuery: o } = i, s = ({ config: i, prepared: s, children: c }) => {
|
|
7
|
+
let l = o(i.layoutPage.query, s.layoutQuery), u = i.layoutPage.resolveNode(l, { id: s.id }), d = a(i.layoutPage.fragment, u);
|
|
8
|
+
return u == null ? /* @__PURE__ */ r(t, { to: i.routes.list }) : /* @__PURE__ */ r(e, {
|
|
9
|
+
value: { layoutView: i.layoutPage.toView(d) },
|
|
10
|
+
children: /* @__PURE__ */ r(n, { children: c })
|
|
13
11
|
});
|
|
14
12
|
};
|
|
15
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeEntityDetailLayoutPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailLayoutPage.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"BackofficeEntityDetailLayoutPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailLayoutPage.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport * as ReactRelay from 'react-relay';\n\nimport type {\n BackofficeEntityManifestItem,\n BackofficePreparedDetailLayoutRoute,\n BackofficeResolvedDetailLayoutFacetConfig,\n} from '@plumile/backoffice-core/types.js';\nimport { BackofficeEntityDetailLayoutContextProvider } from './detail/BackofficeEntityDetailLayoutContext.js';\nimport { BackofficeRedirect } from './BackofficeRedirect.js';\n\nconst { useFragment, usePreloadedQuery } = ReactRelay;\n\nexport type BackofficeEntityDetailLayoutPageProps = {\n entityManifest: BackofficeEntityManifestItem;\n config: BackofficeResolvedDetailLayoutFacetConfig;\n prepared: BackofficePreparedDetailLayoutRoute;\n children?: ReactNode;\n};\n\nexport const BackofficeEntityDetailLayoutPage = ({\n config,\n prepared,\n children,\n}: BackofficeEntityDetailLayoutPageProps): JSX.Element => {\n const layoutQueryData = usePreloadedQuery(\n config.layoutPage.query,\n prepared.layoutQuery,\n );\n const layoutNodeRef = config.layoutPage.resolveNode(layoutQueryData, {\n id: prepared.id,\n });\n\n const layoutNode = useFragment(\n config.layoutPage.fragment,\n layoutNodeRef as never,\n );\n\n if (layoutNodeRef == null) {\n return <BackofficeRedirect to={config.routes.list} />;\n }\n\n const layoutView = config.layoutPage.toView(layoutNode);\n\n return (\n <BackofficeEntityDetailLayoutContextProvider\n value={{\n layoutView,\n }}\n >\n <>{children}</>\n </BackofficeEntityDetailLayoutContextProvider>\n );\n};\n\nexport default BackofficeEntityDetailLayoutPage;\n"],"mappings":";;;;;AAWA,IAAM,EAAE,aAAA,GAAa,mBAAA,MAAsB,GAS9B,KAAoC,EAC/C,WACA,aACA,kBACwD;CACxD,IAAM,IAAkB,EACtB,EAAO,WAAW,OAClB,EAAS,WACX,GACM,IAAgB,EAAO,WAAW,YAAY,GAAiB,EACnE,IAAI,EAAS,GACf,CAAC,GAEK,IAAa,EACjB,EAAO,WAAW,UAClB,CACF;CAQA,OANI,KAAiB,OACZ,kBAAC,GAAD,EAAoB,IAAI,EAAO,OAAO,KAAO,CAAA,IAMpD,kBAAC,GAAD;EACE,OAAO,EACL,YALa,EAAO,WAAW,OAAO,CAKtC,EACF;YAEA,kBAAA,GAAA,EAAG,YAAW,CAAA;CAC6B,CAAA;AAEjD"}
|