@plumile/backoffice-react 0.1.84 → 0.1.86

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.
Files changed (69) hide show
  1. package/README.md +113 -77
  2. package/lib/esm/{AcceptInvitationScreen-5-0EtE15.js → AcceptInvitationScreen-dnOvRx4Z.js} +2 -2
  3. package/lib/esm/{AcceptInvitationScreen-5-0EtE15.js.map → AcceptInvitationScreen-dnOvRx4Z.js.map} +1 -1
  4. package/lib/esm/{BackofficeAcceptInvitationPage-FPbn31YK.js → BackofficeAcceptInvitationPage-CGht2ka0.js} +3 -9
  5. package/lib/esm/{BackofficeAcceptInvitationPage-FPbn31YK.js.map → BackofficeAcceptInvitationPage-CGht2ka0.js.map} +1 -1
  6. package/lib/esm/{BackofficeDashboardPage-C7lIVeA1.js → BackofficeDashboardPage-h1OWb_rV.js} +31 -32
  7. package/lib/esm/BackofficeDashboardPage-h1OWb_rV.js.map +1 -0
  8. package/lib/esm/BackofficeEntityDetailPage-CIyGKwVP.js +1044 -0
  9. package/lib/esm/BackofficeEntityDetailPage-CIyGKwVP.js.map +1 -0
  10. package/lib/esm/BackofficeEntityListPage-DmZozSNk.js +402 -0
  11. package/lib/esm/BackofficeEntityListPage-DmZozSNk.js.map +1 -0
  12. package/lib/esm/{BackofficeLayoutPage-Da4y2B0i.js → BackofficeLayoutPage-DtFDn_nU.js} +2 -2
  13. package/lib/esm/BackofficeLayoutPage-DtFDn_nU.js.map +1 -0
  14. package/lib/esm/{BackofficeLoginPage-Dc61SyMV.js → BackofficeLoginPage-BvOPqbKO.js} +3 -8
  15. package/lib/esm/{BackofficeLoginPage-Dc61SyMV.js.map → BackofficeLoginPage-BvOPqbKO.js.map} +1 -1
  16. package/lib/esm/{BackofficePasswordResetCompletePage-CvoHqhBS.js → BackofficePasswordResetCompletePage-ZLhghfhC.js} +1 -2
  17. package/lib/esm/{BackofficePasswordResetCompletePage-CvoHqhBS.js.map → BackofficePasswordResetCompletePage-ZLhghfhC.js.map} +1 -1
  18. package/lib/esm/{BackofficePasswordResetRequestPage-DDNcCf3_.js → BackofficePasswordResetRequestPage-BLNHQD79.js} +1 -3
  19. package/lib/esm/{BackofficePasswordResetRequestPage-DDNcCf3_.js.map → BackofficePasswordResetRequestPage-BLNHQD79.js.map} +1 -1
  20. package/lib/esm/{BackofficeRightPageLayout-F8ipegrl.js → BackofficeRightPageLayout-DZQvIHnj.js} +2 -2
  21. package/lib/esm/{BackofficeRightPageLayout-F8ipegrl.js.map → BackofficeRightPageLayout-DZQvIHnj.js.map} +1 -1
  22. package/lib/esm/EntityIdPickerDialog-DbTnDU4v.js.map +1 -1
  23. package/lib/esm/backoffice-react.js +164 -167
  24. package/lib/esm/backoffice-react.js.map +1 -1
  25. package/lib/esm/{environment-BJeJTbIN.js → environment-BXoBq_6e.js} +72 -73
  26. package/lib/esm/environment-BXoBq_6e.js.map +1 -0
  27. package/lib/esm/{synchronizeAuthStatusQuery-Dr6AEFhi.js → synchronizeAuthStatusQuery-By_lNCnP.js} +2 -2
  28. package/lib/esm/{synchronizeAuthStatusQuery-Dr6AEFhi.js.map → synchronizeAuthStatusQuery-By_lNCnP.js.map} +1 -1
  29. package/lib/esm/{useAuth-CjdysxLB.js → useAuth-OVPPa9bO.js} +2 -2
  30. package/lib/esm/useAuth-OVPPa9bO.js.map +1 -0
  31. package/lib/esm/{useBackofficeAuth-BshabGXc.js → useBackofficeAuth-BvEoEqnB.js} +2 -2
  32. package/lib/esm/{useBackofficeAuth-BshabGXc.js.map → useBackofficeAuth-BvEoEqnB.js.map} +1 -1
  33. package/lib/types/hooks/useBackofficeSidebarPins.d.ts +4 -0
  34. package/lib/types/hooks/useBackofficeSidebarPins.d.ts.map +1 -1
  35. package/lib/types/i18n/createI18nInstance.d.ts +8 -0
  36. package/lib/types/i18n/createI18nInstance.d.ts.map +1 -1
  37. package/lib/types/i18n/mergeResourceLanguages.d.ts +4 -0
  38. package/lib/types/i18n/mergeResourceLanguages.d.ts.map +1 -1
  39. package/lib/types/modules/base64.d.ts.map +1 -1
  40. package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
  41. package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts +9 -0
  42. package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -0
  43. package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
  44. package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts +14 -0
  45. package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts.map +1 -0
  46. package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts +150 -0
  47. package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -0
  48. package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
  49. package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts +29 -0
  50. package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts.map +1 -0
  51. package/lib/types/provider/entityRegistry.d.ts +5 -0
  52. package/lib/types/provider/entityRegistry.d.ts.map +1 -1
  53. package/lib/types/provider/useBackofficeEntityLoader.d.ts +5 -0
  54. package/lib/types/provider/useBackofficeEntityLoader.d.ts.map +1 -1
  55. package/lib/types/relay/envHelpers.d.ts +6 -0
  56. package/lib/types/relay/envHelpers.d.ts.map +1 -1
  57. package/lib/types/relay/environment.d.ts +26 -0
  58. package/lib/types/relay/environment.d.ts.map +1 -1
  59. package/lib/types/router/createBackofficeRoutes.d.ts +12 -1
  60. package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
  61. package/package.json +12 -12
  62. package/lib/esm/BackofficeDashboardPage-C7lIVeA1.js.map +0 -1
  63. package/lib/esm/BackofficeEntityDetailPage-BljQmWsw.js +0 -991
  64. package/lib/esm/BackofficeEntityDetailPage-BljQmWsw.js.map +0 -1
  65. package/lib/esm/BackofficeEntityListPage-BneDsGo-.js +0 -385
  66. package/lib/esm/BackofficeEntityListPage-BneDsGo-.js.map +0 -1
  67. package/lib/esm/BackofficeLayoutPage-Da4y2B0i.js.map +0 -1
  68. package/lib/esm/environment-BJeJTbIN.js.map +0 -1
  69. package/lib/esm/useAuth-CjdysxLB.js.map +0 -1
@@ -1,991 +0,0 @@
1
- import { t as e } from "./useRelayEnvironment-vQ86aW-n.js";
2
- import { n as t } from "./BackofficeConfigContext-R0t1owTI.js";
3
- import { n, t as r } from "./useBackofficeReactTranslation-WfXU8kCf.js";
4
- import "./EntityFilterValue-B5ZGHO_u.js";
5
- import { n as i } from "./EntityIdPickerDialog-DbTnDU4v.js";
6
- import { a, n as o, r as s, t as c } from "./BackofficeDetailPayload-iVx66o_6.js";
7
- import { i as l } from "./mutationResult-CcQMY13J.js";
8
- import { t as u } from "./pageResolution-hAQA5C6S.js";
9
- import { n as d, t as f } from "./BackofficeRightPageLayout-F8ipegrl.js";
10
- import "./BackofficeTopbarPortalContext-iD7dm4_h.js";
11
- import { n as p, t as m } from "./toastViewAction-BGTS7vqm.js";
12
- import { n as h } from "./buildBreadcrumbs-CqF9Nh6x.js";
13
- import { n as g } from "./BackofficeEntityDetailLayoutContext-C_tBqkVq.js";
14
- import { i as ee, n as _, r as v, t as y } from "./LazyBackofficeEntityActionFormDialog-BE3wVfU6.js";
15
- import { Suspense as b, useCallback as x, useContext as S, useMemo as C, useState as w } from "react";
16
- import { useTranslation as T } from "react-i18next";
17
- import { HttpRedirect as E, Link as D, RoutingContext as O } from "@plumile/router";
18
- import { BackofficeKeyValueList as k, BackofficePageHeader as te, BackofficeRelationsMenu as A, BackofficeTableSkeleton as j, BackofficeTabs as ne, Button as M, ChatCheckSvg as N, DataTable as P, DetailPageTemplate as re, FormattedDate as F, HighlightCode as I, KeyOffSvg as L, KeySvg as ie, LazyBackofficeJsonViewer as R, LazyMarkdownRenderer as z, LinkButton as ae, LockOpenSvg as B, LockSvg as V, RobotCheckSvg as H, RobotXSvg as U, RocketOffSvg as oe, RocketSvg as se, SettingsCheckSvg as ce, SettingsXSvg as le, ShieldLockSvg as W, ShieldOffSvg as ue, Tag as G, XBadgeSvg as de, cx as fe, useToast as pe } from "@plumile/ui";
19
- import * as me from "react-relay";
20
- import { commitMutation as he, useFragment as ge, usePreloadedQuery as _e } from "react-relay";
21
- import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
22
- import { BACKOFFICE_DATE_TIME_OPTIONS as ve, BACKOFFICE_LIST_REFETCH_POLICY as ye, BACKOFFICE_RELATED_TAB_PAGE_SIZE as Y } from "@plumile/backoffice-core/constants.js";
23
- import { buildBackofficeFallbackListHref as be, buildBackofficeListHref as xe, buildBackofficeListLink as Se } from "@plumile/backoffice-core/state/buildListHref.js";
24
- import { setWhereValue as Ce } from "@plumile/backoffice-core/filters/where.js";
25
- //#region src/components/backoffice/scaffolds/BackofficeEntityDetailScaffold.tsx
26
- var we = ({ node: e, render: t, notFound: n }) => {
27
- let { t: i } = r(), a = n ?? i("detail.notFound");
28
- return e == null ? /* @__PURE__ */ q(K, { children: a }) : t(e) ?? /* @__PURE__ */ q(K, { children: a });
29
- }, Te = "txvbqb9ip txvbqbcp txvbqbao7", Ee = "_1lzrtns0 txvbqb9ip txvbqbcp", De = "_1lzrtns1", Oe = ({ tone: e, icon: t, label: n }) => {
30
- let r = t != null, i = null;
31
- return r && (i = /* @__PURE__ */ q("span", {
32
- className: Ee,
33
- children: t
34
- })), /* @__PURE__ */ q(G, {
35
- tone: e,
36
- children: /* @__PURE__ */ J("span", {
37
- className: Te,
38
- children: [i, /* @__PURE__ */ q("span", {
39
- className: De,
40
- children: n
41
- })]
42
- })
43
- });
44
- }, ke = "txvbqb9jg txvbqbcp txvbqbao7 txvbqbajy", Ae = "txvbqb9jg txvbqbcp txvbqbany", je = ({ tag: e, value: t }) => /* @__PURE__ */ J("span", {
45
- className: ke,
46
- children: [e != null && /* @__PURE__ */ q(G, {
47
- tone: e.tone,
48
- children: e.label
49
- }), /* @__PURE__ */ q("span", {
50
- className: Ae,
51
- children: t
52
- })]
53
- }), Me = "txvbqb9ip txvbqbai7 txvbqbaop", Ne = "txvbqb9ip txvbqbai7 txvbqbao7 txvbqblb7 txvbqb1ry", Pe = "txvbqb1cp txvbqb1qg txvbqbwp txvbqbv45", Fe = "txvbqb9ip txvbqbai7 txvbqbany", Ie = "txvbqbal7 txvbqb8y txvbqbva3", Le = "txvbqbamp", Re = "txvbqb8y", ze = ({ title: e, description: t, items: n }) => {
54
- let { t: i } = r();
55
- return n.length === 0 ? null : /* @__PURE__ */ q(s, {
56
- title: e,
57
- description: t,
58
- children: /* @__PURE__ */ q("div", {
59
- className: Me,
60
- children: n.map((e, t) => {
61
- let n = i("common.notAvailable");
62
- return e.details != null && (n = o(e.details)), /* @__PURE__ */ J("div", {
63
- className: fe(Ne, Pe),
64
- children: [/* @__PURE__ */ J("div", {
65
- className: Fe,
66
- children: [/* @__PURE__ */ q("span", {
67
- className: Ie,
68
- children: e.code
69
- }), /* @__PURE__ */ q("span", {
70
- className: Le,
71
- children: e.message
72
- })]
73
- }), /* @__PURE__ */ q("div", {
74
- className: Re,
75
- children: /* @__PURE__ */ q(z, { content: n })
76
- })]
77
- }, `${e.code}-${t}`);
78
- })
79
- })
80
- });
81
- }, { useLazyLoadQuery: Be, usePaginationFragment: Ve } = me, He = ({ title: e, config: t, entities: n, whereKey: i, value: a, path: o }) => {
82
- let { t: s } = T(), { t: c } = r();
83
- if (t.list.kind === "records") return null;
84
- let l = t.list, u = t.listDefaults ?? l.defaultState ?? {
85
- where: null,
86
- sort: null
87
- }, [f, p] = w({
88
- where: u.where,
89
- sort: u.sort ?? null
90
- }), m = C(() => a == null || a.trim() === "" ? null : Ce(f.where, i, a, o), [
91
- o,
92
- f.where,
93
- a,
94
- i
95
- ]), h = m ?? f.where, g = f.sort ?? u.sort, y = C(() => ({
96
- where: h,
97
- sort: g,
98
- count: Y,
99
- cursor: null
100
- }), [h, g]), b = C(() => l.buildVariables == null ? y : l.buildVariables(y), [l, y]), S = Be(l.query, b, { fetchPolicy: "store-or-network" }), { data: E, loadNext: D, hasNext: O, isLoadingNext: k, refetch: te } = Ve(l.fragment, S), A = l.getConnection(E), j = C(() => A.edges.map((e) => l.toRow(e.node)), [A.edges, l]), ne = C(() => d(l.columns, {
101
- tApp: s,
102
- t: c,
103
- resolveEntityHref: (e, t) => {
104
- let r = n[e];
105
- return r == null ? null : r.routes.detail(t);
106
- }
107
- }), [
108
- n,
109
- l.columns,
110
- c,
111
- s
112
- ]), M = x((e) => l.getRowId(e), [l]), { onRefresh: N } = v({
113
- refetch: te,
114
- variables: y,
115
- defaults: C(() => ({
116
- where: m ?? u.where,
117
- sort: u.sort,
118
- count: Y,
119
- cursor: null
120
- }), [
121
- u.sort,
122
- u.where,
123
- m
124
- ]),
125
- fetchPolicy: ye,
126
- buildVariables: l.buildVariables
127
- }), P = ee({
128
- hasNext: O,
129
- isLoadingNext: k,
130
- loadNext: D,
131
- count: Y
132
- });
133
- return /* @__PURE__ */ q(_, {
134
- config: t,
135
- state: f,
136
- pushState: (e) => {
137
- p(e);
138
- },
139
- header: { title: e },
140
- rows: j,
141
- columns: ne,
142
- getRowId: M,
143
- hasNextPage: O,
144
- isLoadingMore: k,
145
- onLoadMore: P,
146
- onRefresh: N,
147
- totalCount: A.totalCount ?? null,
148
- variant: "embedded"
149
- });
150
- }, Ue = ({ title: e, targetId: n, whereKey: r, value: a, path: o }) => {
151
- let { entities: s } = t(), c = i(C(() => [n], [n]));
152
- if (c.status === "loading") return /* @__PURE__ */ q(j, { rows: 6 });
153
- if (c.status === "error") return null;
154
- let l = c.modules[n]?.config;
155
- return l == null ? null : /* @__PURE__ */ q(He, {
156
- title: e,
157
- config: l,
158
- entities: s,
159
- whereKey: r,
160
- value: a,
161
- path: o
162
- });
163
- }, We = ({ title: e, target: t, whereKey: r, value: i, path: a }) => /* @__PURE__ */ q(n, {
164
- fallback: () => /* @__PURE__ */ q(j, { rows: 6 }),
165
- children: /* @__PURE__ */ q(b, {
166
- fallback: /* @__PURE__ */ q(j, { rows: 6 }),
167
- children: /* @__PURE__ */ q(Ue, {
168
- title: e,
169
- targetId: t,
170
- whereKey: r,
171
- value: i,
172
- path: a
173
- })
174
- })
175
- }), Ge = "txvbqb9ip txvbqbcp txvbqbao7 txvbqbajy", Ke = "txvbqb9ip txvbqbai7 txvbqbaog", qe = "txvbqb9ip txvbqbcp txvbqbao7 txvbqbajy", Je = "txvbqb9ip txvbqbai7 txvbqbao7";
176
- //#endregion
177
- //#region src/i18n/useBackofficeFormats.ts
178
- function Ye() {
179
- let { t: e } = r();
180
- function t(t) {
181
- return e("format.number", { value: t });
182
- }
183
- function n(t) {
184
- return e("format.currency", { value: t });
185
- }
186
- function i(t) {
187
- return e("format.percent", { value: t });
188
- }
189
- return {
190
- formatNumber: t,
191
- formatCurrency: n,
192
- formatPercent: i
193
- };
194
- }
195
- //#endregion
196
- //#region src/pages/detail/buildTabsItems.ts
197
- var Xe = (e) => e.pages.map((t) => ({
198
- id: t.id,
199
- label: t.label(e.tApp),
200
- to: e.detailPageHref(e.id, t.id)
201
- })), X = (e, t) => e(t), Ze = (e) => typeof e == "object" && !!e && !Array.isArray(e), Qe = (e) => {
202
- throw Error(`Unexpected value: ${String(e)}`);
203
- }, $e = (e, t, n) => {
204
- switch (e) {
205
- case "yesNo": return t ? {
206
- tone: "success",
207
- label: n("common.boolean.yes")
208
- } : {
209
- tone: "neutral",
210
- label: n("common.boolean.no")
211
- };
212
- case "capability": return t ? {
213
- tone: "success",
214
- label: n("flags.capability.allowed"),
215
- icon: /* @__PURE__ */ q(W, {
216
- width: 14,
217
- height: 14,
218
- "aria-hidden": "true"
219
- })
220
- } : {
221
- tone: "neutral",
222
- label: n("flags.capability.denied"),
223
- icon: /* @__PURE__ */ q(ue, {
224
- width: 14,
225
- height: 14,
226
- "aria-hidden": "true"
227
- })
228
- };
229
- case "enabled": return t ? {
230
- tone: "success",
231
- label: n("flags.enabled.enabled"),
232
- icon: /* @__PURE__ */ q(ce, {
233
- width: 14,
234
- height: 14,
235
- "aria-hidden": "true"
236
- })
237
- } : {
238
- tone: "neutral",
239
- label: n("flags.enabled.disabled"),
240
- icon: /* @__PURE__ */ q(le, {
241
- width: 14,
242
- height: 14,
243
- "aria-hidden": "true"
244
- })
245
- };
246
- case "failure": return t ? {
247
- tone: "danger",
248
- label: n("flags.failure.failed"),
249
- icon: /* @__PURE__ */ q(de, {
250
- width: 14,
251
- height: 14,
252
- "aria-hidden": "true"
253
- })
254
- } : {
255
- tone: "success",
256
- label: n("flags.failure.ok"),
257
- icon: /* @__PURE__ */ q(N, {
258
- width: 14,
259
- height: 14,
260
- "aria-hidden": "true"
261
- })
262
- };
263
- case "encrypted": return t ? {
264
- tone: "info",
265
- label: n("flags.encrypted.encrypted"),
266
- icon: /* @__PURE__ */ q(ie, {
267
- width: 14,
268
- height: 14,
269
- "aria-hidden": "true"
270
- })
271
- } : {
272
- tone: "neutral",
273
- label: n("flags.encrypted.notEncrypted"),
274
- icon: /* @__PURE__ */ q(L, {
275
- width: 14,
276
- height: 14,
277
- "aria-hidden": "true"
278
- })
279
- };
280
- case "locked": return t ? {
281
- tone: "warning",
282
- label: n("flags.locked.locked"),
283
- icon: /* @__PURE__ */ q(V, {
284
- width: 14,
285
- height: 14,
286
- "aria-hidden": "true"
287
- })
288
- } : {
289
- tone: "success",
290
- label: n("flags.locked.unlocked"),
291
- icon: /* @__PURE__ */ q(B, {
292
- width: 14,
293
- height: 14,
294
- "aria-hidden": "true"
295
- })
296
- };
297
- case "default": return t ? {
298
- tone: "info",
299
- label: n("flags.default.default")
300
- } : {
301
- tone: "neutral",
302
- label: n("flags.default.notDefault")
303
- };
304
- case "agentManaged": return t ? {
305
- tone: "info",
306
- label: n("flags.agentManaged.agentManaged"),
307
- icon: /* @__PURE__ */ q(H, {
308
- width: 14,
309
- height: 14,
310
- "aria-hidden": "true"
311
- })
312
- } : {
313
- tone: "neutral",
314
- label: n("flags.agentManaged.userManaged"),
315
- icon: /* @__PURE__ */ q(U, {
316
- width: 14,
317
- height: 14,
318
- "aria-hidden": "true"
319
- })
320
- };
321
- case "deployedProduction": return t ? {
322
- tone: "success",
323
- label: n("flags.deployedProduction.deployed"),
324
- icon: /* @__PURE__ */ q(se, {
325
- width: 14,
326
- height: 14,
327
- "aria-hidden": "true"
328
- })
329
- } : {
330
- tone: "neutral",
331
- label: n("flags.deployedProduction.notDeployed"),
332
- icon: /* @__PURE__ */ q(oe, {
333
- width: 14,
334
- height: 14,
335
- "aria-hidden": "true"
336
- })
337
- };
338
- case "forced": return t ? {
339
- tone: "warning",
340
- label: n("flags.forced.forced")
341
- } : {
342
- tone: "neutral",
343
- label: n("flags.forced.normal")
344
- };
345
- default: return Qe(e);
346
- }
347
- }, et = (e) => {
348
- if (!Ze(e)) return null;
349
- for (let t of Object.values(e)) if (Ze(t) && ("status" in t || "result" in t)) return t;
350
- return null;
351
- }, tt = (e) => e.kind === "route", nt = (e) => e.kind === "mutation", rt = (e) => e.kind === "formMutation", Z = (e, t) => typeof e == "function" ? e(t) : e ?? null, it = (e) => {
352
- if (e == null) return null;
353
- let t = e.trim();
354
- return t === "" ? null : t;
355
- }, Q = (e) => e == null ? !0 : typeof e == "string" ? e.trim() === "" : !1, $ = (e, t) => typeof e == "function" ? e(t) : e, at = (e, t) => {
356
- let { tApp: n, t: r, resolveEntityHref: i } = t, a = r("common.notAvailable");
357
- if (e.type === "text") {
358
- let t = Z(e.value, n);
359
- return Q(t) ? a : t;
360
- }
361
- if (e.type === "entityRef") {
362
- let { id: t } = e;
363
- if (t == null || t.trim() === "") return a;
364
- let r = Z(e.label, n), o = r != null && String(r).trim() !== "" ? r : null;
365
- if (o == null) return a;
366
- let s = i?.(e.entity, t) ?? null;
367
- return s == null ? o : /* @__PURE__ */ q(D, {
368
- to: s,
369
- children: o
370
- });
371
- }
372
- let { href: o } = e;
373
- if (o == null || o.trim() === "") return a;
374
- let s = Z(e.label, n);
375
- return Q(s) ? a : /* @__PURE__ */ q(D, {
376
- to: o,
377
- children: s
378
- });
379
- }, ot = (e, t, n) => {
380
- let { tApp: r, t: i, resolveEntityHref: o, formatNumber: s, formatCurrency: c, formatPercent: l, relationEntityListRoutes: u, resolveRelationItem: d } = n, f = [], p = [], m = [], h = i("common.notAvailable");
381
- return e.forEach((e, n) => {
382
- let g = `${e.type}-${n}`;
383
- switch (e.type) {
384
- case "text": {
385
- let n = Z(e.value(t), r);
386
- f.push({
387
- id: g,
388
- label: X(e.label, r),
389
- size: e.size,
390
- value: n,
391
- copyValue: e.copyValue?.(t) ?? void 0,
392
- fullWidth: e.fullWidth
393
- });
394
- break;
395
- }
396
- case "badge": {
397
- let n = Z(e.value(t), r), i = n == null ? "" : String(n), a = $(e.tone, t), o = i.trim() === "" ? null : /* @__PURE__ */ q(G, {
398
- tone: a,
399
- children: i
400
- });
401
- f.push({
402
- id: g,
403
- label: X(e.label, r),
404
- size: e.size,
405
- value: o
406
- });
407
- break;
408
- }
409
- case "badgeRow": {
410
- let n = e.items(t).map((e) => {
411
- let t = Z(e.label, r), n = t == null ? "" : String(t);
412
- return {
413
- ...e,
414
- label: n
415
- };
416
- }), i = n.length > 0 ? /* @__PURE__ */ q(a, { items: n }) : null;
417
- f.push({
418
- id: g,
419
- label: X(e.label, r),
420
- size: e.size,
421
- value: i,
422
- fullWidth: e.fullWidth
423
- });
424
- break;
425
- }
426
- case "dateTime": {
427
- let n = e.value(t);
428
- f.push({
429
- id: g,
430
- label: X(e.label, r),
431
- size: e.size,
432
- value: /* @__PURE__ */ q(F, {
433
- value: n,
434
- options: ve,
435
- fallback: i("common.notAvailable")
436
- })
437
- });
438
- break;
439
- }
440
- case "number": {
441
- let n = e.value(t), i = null;
442
- n != null && (i = e.format === "currency" ? c(n) : e.format === "percent" ? l(n) : s(n)), f.push({
443
- id: g,
444
- label: X(e.label, r),
445
- size: e.size,
446
- value: i
447
- });
448
- break;
449
- }
450
- case "flag": {
451
- let n = e.value(t), a = null;
452
- if (n != null) {
453
- let t = $e(e.variant, n, i);
454
- a = /* @__PURE__ */ q(Oe, {
455
- tone: t.tone,
456
- icon: t.icon,
457
- label: t.label
458
- });
459
- }
460
- f.push({
461
- id: g,
462
- label: X(e.label, r),
463
- size: e.size,
464
- value: a
465
- });
466
- break;
467
- }
468
- case "entityRef": {
469
- let n = e.id(t), i = null;
470
- if (n != null && n.trim() !== "") {
471
- let r = e.value?.(t), a = r != null && r.trim() !== "" ? r : null, s = o?.(e.entity, n) ?? null;
472
- a != null && (i = s == null ? a : /* @__PURE__ */ q(D, {
473
- to: s,
474
- children: a
475
- }));
476
- }
477
- f.push({
478
- id: g,
479
- label: X(e.label, r),
480
- size: e.size,
481
- value: i ?? h
482
- });
483
- break;
484
- }
485
- case "link": {
486
- let n = e.href(t), i = e.value(t), a = n != null && n.trim() !== "" && !Q(i) ? /* @__PURE__ */ q(D, {
487
- to: n,
488
- children: i
489
- }) : null;
490
- f.push({
491
- id: g,
492
- label: X(e.label, r),
493
- size: e.size,
494
- value: a
495
- });
496
- break;
497
- }
498
- case "taggedValue": {
499
- let n = e.tag(t), a = at(e.value(t), {
500
- tApp: r,
501
- t: i,
502
- resolveEntityHref: o
503
- }), s = n == null ? null : {
504
- ...n,
505
- label: (() => {
506
- let e = Z(n.label, r);
507
- return e == null ? "" : String(e);
508
- })()
509
- }, c = s != null || a != null ? /* @__PURE__ */ q(je, {
510
- tag: s,
511
- value: a
512
- }) : null;
513
- f.push({
514
- id: g,
515
- label: X(e.label, r),
516
- size: e.size,
517
- value: c,
518
- fullWidth: e.fullWidth
519
- });
520
- break;
521
- }
522
- case "relation": {
523
- let n = it(e.value(t));
524
- if (n == null) break;
525
- let i = u[e.entity];
526
- if (i == null) break;
527
- let a = X(e.label, r), o = e.count?.(t) ?? null, s = Ce(null, e.whereKey, n, e.path);
528
- if (s == null) break;
529
- p.push(d({
530
- id: g,
531
- label: a,
532
- count: o,
533
- entityId: e.entity,
534
- filterId: e.filterId,
535
- listRoute: i,
536
- path: e.path,
537
- value: n,
538
- where: s,
539
- whereKey: e.whereKey
540
- }));
541
- break;
542
- }
543
- case "custom": {
544
- let n = e.render(t);
545
- if (n == null) break;
546
- if (e.label != null) {
547
- f.push({
548
- id: g,
549
- label: X(e.label, r),
550
- size: e.size,
551
- value: n,
552
- fullWidth: e.fullWidth
553
- });
554
- break;
555
- }
556
- m.push(/* @__PURE__ */ q("div", { children: n }, g));
557
- break;
558
- }
559
- default: break;
560
- }
561
- }), {
562
- items: f,
563
- relationItems: p,
564
- customNodes: m
565
- };
566
- }, st = (e, t, n) => {
567
- let { tApp: r, t: i, resolveEntityHref: a } = n, o = i("common.notAvailable");
568
- if (e.type === "dateTime") return /* @__PURE__ */ q(F, {
569
- value: e.value(t),
570
- options: ve,
571
- fallback: o
572
- });
573
- if (e.type === "entityRef") {
574
- let n = e.id(t);
575
- if (n == null || n.trim() === "") return o;
576
- let i = Z(e.value?.(t), r), s = i != null && String(i).trim() !== "" ? i : null;
577
- if (s == null) return o;
578
- let c = a?.(e.entity, n) ?? null;
579
- return c == null ? s : /* @__PURE__ */ q(D, {
580
- to: c,
581
- children: s
582
- });
583
- }
584
- if (e.type === "link") {
585
- let n = e.href(t), i = Z(e.value(t), r);
586
- return n == null || n.trim() === "" || Q(i) ? o : /* @__PURE__ */ q(D, {
587
- to: n,
588
- children: i
589
- });
590
- }
591
- let s = Z(e.value(t), r);
592
- return Q(s) ? o : s;
593
- }, ct = (e, t, n) => {
594
- if (e.type === "badgeRow") {
595
- let r = e.items(t).map((e) => {
596
- let t = Z(e.label, n), r = t == null ? "" : String(t);
597
- return {
598
- ...e,
599
- label: r
600
- };
601
- });
602
- return r.length === 0 ? void 0 : /* @__PURE__ */ q(a, { items: r });
603
- }
604
- let r = Z(e.value(t), n), i = r == null ? "" : String(r);
605
- if (i.trim() !== "") return /* @__PURE__ */ q(G, {
606
- tone: $(e.tone, t),
607
- children: i
608
- });
609
- }, lt = (e, t, n) => {
610
- let { tApp: r, t: i, resolveEntityHref: a } = n, o = e.titleValue?.(t, r) ?? X(e.title, r), s = o.trim() === "" ? X(e.title, r) : o, c;
611
- if (e.subtitleItems != null && e.subtitleItems.length > 0) {
612
- let n = e.subtitleSeparator ?? " / ", o = [], { subtitleItems: s } = e;
613
- s.forEach((e, c) => {
614
- let l = e.value(t);
615
- o.push(/* @__PURE__ */ q("span", { children: at(l, {
616
- tApp: r,
617
- t: i,
618
- resolveEntityHref: a
619
- }) }, e.id)), c < s.length - 1 && o.push(/* @__PURE__ */ q("span", { children: n }, `${e.id}-sep`));
620
- }), c = /* @__PURE__ */ q("span", { children: o });
621
- } else {
622
- let n = e.subtitleValue?.(t, r) ?? (e.subtitle == null ? null : X(e.subtitle, r));
623
- c = n != null && n.trim() !== "" ? n : void 0;
624
- }
625
- let l = [];
626
- e.badges != null && e.badges.forEach((e, n) => {
627
- let i = X(e.label, r), a = Z(e.value(t), r), o = a == null ? "" : String(a);
628
- if (o.trim() === "") return;
629
- let s = $(e.tone, t);
630
- l.push(/* @__PURE__ */ q(G, {
631
- tone: s,
632
- children: `${i}: ${o}`
633
- }, `${i}-${n}`));
634
- });
635
- let u;
636
- e.status != null && (u = ct(e.status, t, r));
637
- let d = e.meta?.map((e, n) => {
638
- let o = X(e.label, r), s = st(e, t, {
639
- tApp: r,
640
- t: i,
641
- resolveEntityHref: a
642
- });
643
- return {
644
- id: `${o}-${n}`,
645
- label: o,
646
- value: s
647
- };
648
- });
649
- return {
650
- title: s,
651
- subtitle: c,
652
- badges: l.length > 0 ? /* @__PURE__ */ q(K, { children: l }) : void 0,
653
- status: u,
654
- items: d
655
- };
656
- }, ut = (e, t, n) => {
657
- let { tApp: r, t: i, resolveEntityHref: a } = n;
658
- return e == null || e.length === 0 ? [] : e.map((e, o) => {
659
- let l = n.keyPrefix == null ? `${e.kind}-${o}` : `${n.keyPrefix}-${e.kind}-${o}`;
660
- if (e.kind === "custom") {
661
- let n = e.render(t);
662
- return n == null ? null : e.label == null ? /* @__PURE__ */ q("div", { children: n }, l) : /* @__PURE__ */ q(s, {
663
- title: X(e.label, r),
664
- children: n
665
- }, l);
666
- }
667
- let u = X(e.label, r), f = e.description == null ? void 0 : X(e.description, r);
668
- if (e.kind === "relationList") {
669
- let n = e.value(t);
670
- return /* @__PURE__ */ q(We, {
671
- title: u,
672
- target: e.target,
673
- whereKey: e.whereKey,
674
- value: n,
675
- path: e.path
676
- }, l);
677
- }
678
- if (e.kind === "table") {
679
- let n = e.rows(t);
680
- return /* @__PURE__ */ q(s, {
681
- title: u,
682
- description: f,
683
- children: /* @__PURE__ */ q(P, {
684
- columns: d(e.columns, {
685
- tApp: r,
686
- t: i,
687
- resolveEntityHref: a
688
- }),
689
- rows: n,
690
- getRowId: (e, t) => {
691
- if (typeof e == "object" && e) {
692
- let t = e.id;
693
- if (typeof t == "string" && t.trim() !== "") return t;
694
- }
695
- return String(t);
696
- }
697
- })
698
- }, l);
699
- }
700
- if (e.kind === "json") return /* @__PURE__ */ q(s, {
701
- title: u,
702
- description: f,
703
- children: /* @__PURE__ */ q(R, {
704
- value: e.value(t),
705
- title: u
706
- })
707
- }, l);
708
- if (e.kind === "code") {
709
- let n = e.value(t);
710
- return /* @__PURE__ */ q(s, {
711
- title: u,
712
- description: f,
713
- children: /* @__PURE__ */ q(I, {
714
- badgeLabel: i("tools.output"),
715
- copyCode: n,
716
- fallbackCodeText: n
717
- })
718
- }, l);
719
- }
720
- return e.kind === "payload" ? /* @__PURE__ */ q(c, {
721
- title: u,
722
- description: f,
723
- content: e.value(t),
724
- format: e.format
725
- }, l) : e.kind === "errorList" ? /* @__PURE__ */ q(ze, {
726
- title: u,
727
- description: f,
728
- items: e.errors(t)
729
- }, l) : /* @__PURE__ */ q(s, {
730
- title: u,
731
- description: f,
732
- children: /* @__PURE__ */ q(k, { items: e.items.map((e, n) => {
733
- let a = X(e.label, r), o = Z(e.value(t), r);
734
- return {
735
- id: `${a}-${n}`,
736
- label: a,
737
- value: o ?? i("common.notAvailable")
738
- };
739
- }) })
740
- }, l);
741
- });
742
- }, dt = ({ config: n, prepared: i }) => {
743
- let { t: a } = T(), { t: o } = r(), { formatNumber: c, formatCurrency: d, formatPercent: ee } = Ye(), { entities: _, entityRegistry: v } = t(), { layoutView: b } = g(), x = S(O), D = e(), j = pe(), [N, P] = w({}), [F, I] = w(null), L = u({
744
- mainPage: n.pages.mainPage,
745
- subPages: n.pages.subPages,
746
- activePagePath: i.pagePath,
747
- node: b
748
- }), ie = L.activePage ?? n.pages.mainPage, R = L.pages.length > 0 ? L.pages : [n.pages.mainPage], z = (e, t) => {
749
- P((n) => n[e] === t ? n : {
750
- ...n,
751
- [e]: t
752
- });
753
- }, { page: B } = n, V = _e(B.query, i.pageQuery), H = B.resolveNode(V, {
754
- id: i.id,
755
- detailId: i.detailId
756
- });
757
- if (H == null) throw new E(n.routes.list);
758
- let U = ge(B.fragment, H), oe = C(() => Object.fromEntries(B.content.flatMap((e) => e.kind === "section" ? e.fields.flatMap((e) => e.type === "relation" ? [e.entity] : []) : []).flatMap((e) => {
759
- let t = _[e];
760
- return t?.hasList === !0 ? [[e, t.routes.list]] : [];
761
- })), [_, B.content]);
762
- return /* @__PURE__ */ q(we, {
763
- node: U,
764
- render: (e) => {
765
- let t = B.toView(e), r = Xe({
766
- pages: R,
767
- id: i.id,
768
- tApp: a,
769
- detailPageHref: n.routes.detailPage
770
- }), u = (e, t) => {
771
- let n = _[e];
772
- return n == null ? null : n.routes.detail(t);
773
- }, g = ({ id: e, label: t, count: n, entityId: r, filterId: i, listRoute: a, path: o, value: s, where: c, whereKey: l }) => {
774
- let u = v.getLoadedListEntity(r);
775
- return {
776
- id: e,
777
- label: t,
778
- count: n,
779
- href: u == null ? be(a, c, [{
780
- id: i ?? (o == null ? l : `${l}.${o.join(".")}`),
781
- value: s
782
- }]) : xe(u.config, { where: c }),
783
- onClick: async (e) => {
784
- if (x == null || e.defaultPrevented || e.button !== 0 || e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
785
- e.preventDefault();
786
- let t = Se((await v.loadListEntity(r)).config, { where: c });
787
- x.history.push({
788
- pathname: t.pathname,
789
- search: t.search === "" ? "" : `?${t.search}`,
790
- hash: ""
791
- });
792
- }
793
- };
794
- }, S = lt(n.header, b, {
795
- tApp: a,
796
- t: o,
797
- resolveEntityHref: u
798
- }), C = h({
799
- config: n,
800
- tApp: a,
801
- entityId: i.id,
802
- layoutView: b,
803
- pageLabel: ie.label(a)
804
- }), w = B.actions ?? [], T = [];
805
- if (w.length > 0) {
806
- let e = w.filter((e) => e.isVisible == null ? !0 : e.isVisible(t));
807
- e.length > 0 && (T = e.map((e) => {
808
- let n = X(e.label, a), r = e.ariaLabel == null ? n : X(e.ariaLabel, a), i = e.variant ?? "secondary", s = e.size ?? "small", c = N[e.id] ?? !1, u = c || e.isDisabled?.(t) === !0;
809
- return tt(e) ? /* @__PURE__ */ q(ae, {
810
- to: e.to(t),
811
- variant: i,
812
- size: s,
813
- isDisabled: u,
814
- "aria-label": r,
815
- children: n
816
- }, e.id) : rt(e) ? /* @__PURE__ */ q(M, {
817
- type: "button",
818
- variant: i,
819
- size: s,
820
- isLoading: !1,
821
- disabled: u,
822
- onClick: () => {
823
- I(e.id);
824
- },
825
- "aria-label": r,
826
- children: n
827
- }, e.id) : nt(e) ? /* @__PURE__ */ q(M, {
828
- type: "button",
829
- variant: i,
830
- size: s,
831
- isLoading: c,
832
- disabled: u,
833
- onClick: () => {
834
- if (c) return;
835
- let n = e.getVariables(t);
836
- z(e.id, !0), he(D, {
837
- mutation: e.mutation,
838
- variables: n,
839
- updater: (n) => {
840
- e.updater?.(n, t);
841
- },
842
- onCompleted: (n) => {
843
- z(e.id, !1);
844
- let r = et(n);
845
- if (r != null) {
846
- let n = o("actions.form.errors.invalidPayload");
847
- e.toasts?.error?.message == null ? e.toasts?.error?.title != null && (n = X(e.toasts.error.title, a)) : n = X(e.toasts.error.message, a);
848
- let i = l(r, {
849
- defaultErrorMessage: n,
850
- mapReason: (n) => {
851
- let r = e.mapErrorReason?.(n, t);
852
- return r == null ? null : typeof r == "function" ? X(r, a) : String(r);
853
- }
854
- });
855
- if (!i.ok) {
856
- let n = Error(i.message);
857
- if (e.onError?.(n, t), e.toasts?.error != null) {
858
- let t = m(e.toasts.error, a);
859
- j.error(t.title, t.message);
860
- }
861
- return;
862
- }
863
- }
864
- if (e.onCompleted?.(n, t), e.toasts?.success != null) {
865
- let r = m(e.toasts.success, a), i = p({
866
- toast: e.toasts.success,
867
- response: n,
868
- node: t,
869
- tApp: a,
870
- entities: _,
871
- defaultLabel: o("actions.view"),
872
- navigateTo: (e) => {
873
- x?.history.push({ pathname: e });
874
- }
875
- });
876
- j.push({
877
- kind: "info",
878
- title: r.title,
879
- message: r.message,
880
- actions: i
881
- });
882
- }
883
- },
884
- onError: (n) => {
885
- if (z(e.id, !1), e.onError?.(n, t), e.toasts?.error != null) {
886
- let t = m(e.toasts.error, a);
887
- j.error(t.title, t.message);
888
- }
889
- }
890
- });
891
- },
892
- "aria-label": r,
893
- children: n
894
- }, e.id) : null;
895
- }));
896
- }
897
- let E = w.find((e) => e.id === F), { content: O } = B, P = [], L = [], V = [];
898
- O.forEach((e, n) => {
899
- let r = (e.placement ?? "primary") === "secondary" ? L : P;
900
- if (e.kind === "section") {
901
- let i = X(e.title, a), l = e.description == null ? void 0 : X(e.description, a), { items: f, relationItems: p, customNodes: m } = ot(e.fields, t, {
902
- tApp: a,
903
- t: o,
904
- resolveEntityHref: u,
905
- formatNumber: c,
906
- formatCurrency: d,
907
- formatPercent: ee,
908
- relationEntityListRoutes: oe,
909
- resolveRelationItem: g
910
- });
911
- if (p.forEach((e) => {
912
- V.some((t) => t.id === e.id) || V.push(e);
913
- }), !(f.length > 0 || m.length > 0)) return;
914
- r.push(/* @__PURE__ */ q(s, {
915
- title: i,
916
- description: l,
917
- items: f.length > 0 ? f : void 0,
918
- children: m
919
- }, `${i}-${n}`));
920
- return;
921
- }
922
- let i = ut([e], t, {
923
- tApp: a,
924
- t: o,
925
- resolveEntityHref: u,
926
- keyPrefix: String(n)
927
- })[0];
928
- i != null && r.push(i);
929
- });
930
- let H = V.length > 0 ? /* @__PURE__ */ q(A, {
931
- label: o("relations.menu.label"),
932
- items: V
933
- }) : null, U = T.length > 0 || H != null ? /* @__PURE__ */ J("div", {
934
- className: Ge,
935
- children: [T, H]
936
- }) : void 0, se = S.status != null || S.badges != null ? /* @__PURE__ */ J("div", {
937
- className: qe,
938
- children: [S.status, S.badges]
939
- }) : void 0, ce = S.items != null && S.items.length > 0 ? /* @__PURE__ */ q("div", {
940
- className: Je,
941
- children: /* @__PURE__ */ q(k, { items: S.items })
942
- }) : null, le = L.length > 0, W = null;
943
- return R.length > 1 && (W = /* @__PURE__ */ q(ne, {
944
- items: r,
945
- activeId: ie.id,
946
- onChange: () => {}
947
- })), /* @__PURE__ */ J(f, {
948
- breadcrumb: C,
949
- children: [/* @__PURE__ */ q(re, {
950
- headerNode: /* @__PURE__ */ J("div", {
951
- className: Ke,
952
- children: [/* @__PURE__ */ q(te, {
953
- title: S.title,
954
- subtitle: S.subtitle,
955
- actions: U,
956
- meta: se
957
- }), ce]
958
- }),
959
- tabsNode: W,
960
- sidePanel: le ? /* @__PURE__ */ q(K, { children: L }) : void 0,
961
- sidePanelVariant: "plain",
962
- children: /* @__PURE__ */ q(K, { children: P })
963
- }), E != null && rt(E) && /* @__PURE__ */ q(y, {
964
- isOpen: !0,
965
- action: E,
966
- node: t,
967
- onClose: () => {
968
- I(null);
969
- }
970
- })]
971
- });
972
- }
973
- });
974
- }, ft = ({ config: e, prepared: t }) => {
975
- let { layoutView: n } = g(), r = u({
976
- mainPage: e.pages.mainPage,
977
- subPages: e.pages.subPages,
978
- activePagePath: t.pagePath,
979
- node: n
980
- });
981
- if (!r.hasVisiblePages || r.activePage == null) throw new E(e.routes.list);
982
- if (r.activePage.id !== t.pageId) throw new E(e.routes.detailPage(t.id, r.activePage.id));
983
- return /* @__PURE__ */ q(dt, {
984
- config: t.pageConfig,
985
- prepared: t
986
- });
987
- };
988
- //#endregion
989
- export { ft as BackofficeEntityDetailPage, ft as default };
990
-
991
- //# sourceMappingURL=BackofficeEntityDetailPage-BljQmWsw.js.map