@plumile/backoffice-react 0.1.116 → 0.1.120
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/components/backoffice/billing/BackofficeBillingUsageChart.js +60 -0
- package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js.map +1 -0
- package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js +7 -0
- package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js.map +1 -0
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js +6 -6
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js +167 -151
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js.map +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js +24 -21
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js +62 -54
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js.map +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js.map +1 -1
- package/lib/esm/hooks/useBackofficeSidebarPins.js +44 -42
- package/lib/esm/hooks/useBackofficeSidebarPins.js.map +1 -1
- package/lib/esm/index.js +75 -74
- package/lib/esm/pages/BackofficeDashboardPage.helpers.js +1 -0
- package/lib/esm/pages/BackofficeDashboardPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardPage.js +181 -154
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +12 -12
- package/lib/esm/pages/BackofficeLayoutPage.js +133 -129
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/provider/BackofficeConfigContext.js.map +1 -1
- package/lib/esm/provider/BackofficeProvider.js +126 -121
- package/lib/esm/provider/BackofficeProvider.js.map +1 -1
- package/lib/esm/provider/dashboardRegistrations.js +17 -0
- package/lib/esm/provider/dashboardRegistrations.js.map +1 -0
- package/lib/esm/router/createBackofficeRoutes.js +148 -131
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.d.ts +25 -0
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.d.ts.map +1 -0
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts +41 -0
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts.map +1 -0
- package/lib/types/components/backoffice/billing/backofficeBillingUsageChart.css.d.ts +4 -0
- package/lib/types/components/backoffice/billing/backofficeBillingUsageChart.css.d.ts.map +1 -0
- package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts +2 -1
- package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +1 -0
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/types.d.ts +1 -0
- package/lib/types/components/backoffice/links/types.d.ts.map +1 -1
- package/lib/types/hooks/useBackofficeSidebarPins.d.ts +1 -0
- package/lib/types/hooks/useBackofficeSidebarPins.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts +5 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.stories.d.ts +9 -0
- package/lib/types/pages/BackofficeDashboardPage.stories.d.ts.map +1 -0
- package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
- package/lib/types/provider/BackofficeConfigContext.d.ts +2 -1
- package/lib/types/provider/BackofficeConfigContext.d.ts.map +1 -1
- package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
- package/lib/types/provider/dashboardRegistrations.d.ts +4 -0
- package/lib/types/provider/dashboardRegistrations.d.ts.map +1 -0
- package/lib/types/provider/types.d.ts +8 -1
- package/lib/types/provider/types.d.ts.map +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts +8 -2
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { rangeText as e, root as t, totalValue as n } from "./backofficeBillingUsageChart.css.js";
|
|
2
|
+
import { useMemo as r } from "react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import { FormattedDate as o } from "@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js";
|
|
5
|
+
import { TimeSeriesLineChart as s } from "@plumile/ui/components/charts/TimeSeriesLineChart.js";
|
|
6
|
+
import { formatCurrencyAmount as c } from "@plumile/ui/shared/currencyAmount.js";
|
|
7
|
+
import { toUtcDailyCategorySeries as l } from "@plumile/ui/shared/timeSeries.js";
|
|
8
|
+
//#region src/components/backoffice/billing/BackofficeBillingUsageChart.tsx
|
|
9
|
+
var u = "->", d = ({ ariaLabel: d, buckets: f, categories: p, currency: m, emptyLabel: h, from: g, rangePrefix: _, to: v, totalAmount: y }) => {
|
|
10
|
+
let b = r(() => p.map((e) => e.id), [p]), x = r(() => Object.fromEntries(p.map((e) => [e.id, e.color])), [p]), S = r(() => Object.fromEntries(p.map((e) => [e.id, e.label])), [p]), C = r(() => g == null || v == null ? [] : l({
|
|
11
|
+
fromIsoDateTime: g,
|
|
12
|
+
toIsoDateTime: v,
|
|
13
|
+
buckets: f,
|
|
14
|
+
categories: b
|
|
15
|
+
}), [
|
|
16
|
+
f,
|
|
17
|
+
b,
|
|
18
|
+
g,
|
|
19
|
+
v
|
|
20
|
+
]), w = (e) => c({
|
|
21
|
+
amount: e,
|
|
22
|
+
currency: m
|
|
23
|
+
});
|
|
24
|
+
return f.length === 0 ? /* @__PURE__ */ i("p", {
|
|
25
|
+
className: e,
|
|
26
|
+
children: h
|
|
27
|
+
}) : /* @__PURE__ */ a("div", {
|
|
28
|
+
className: t,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ i("p", {
|
|
31
|
+
className: n,
|
|
32
|
+
children: w(y)
|
|
33
|
+
}),
|
|
34
|
+
g != null && v != null && /* @__PURE__ */ a("p", {
|
|
35
|
+
className: "txvbqb8p txvbqbva3 txvbqbfcp",
|
|
36
|
+
children: [
|
|
37
|
+
_,
|
|
38
|
+
" ",
|
|
39
|
+
/* @__PURE__ */ i(o, { value: g }),
|
|
40
|
+
" ",
|
|
41
|
+
u,
|
|
42
|
+
" ",
|
|
43
|
+
/* @__PURE__ */ i(o, { value: v })
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ i(s, {
|
|
47
|
+
ariaLabel: d,
|
|
48
|
+
categoryColorById: x,
|
|
49
|
+
categoryLabel: (e) => S[e] ?? e,
|
|
50
|
+
categoryOrder: b,
|
|
51
|
+
formatValue: w,
|
|
52
|
+
series: C
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { d as BackofficeBillingUsageChart, d as default };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=BackofficeBillingUsageChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackofficeBillingUsageChart.js","names":[],"sources":["../../../../../src/components/backoffice/billing/BackofficeBillingUsageChart.tsx"],"sourcesContent":["import { useMemo, type JSX } from 'react';\nimport { FormattedDate } from '@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js';\nimport { TimeSeriesLineChart } from '@plumile/ui/components/charts/TimeSeriesLineChart.js';\nimport { formatCurrencyAmount } from '@plumile/ui/shared/currencyAmount.js';\nimport { toUtcDailyCategorySeries } from '@plumile/ui/shared/timeSeries.js';\n\nimport * as styles from './backofficeBillingUsageChart.css.js';\n\nexport type BackofficeBillingUsageChartBucket = {\n readonly day: string;\n readonly category: string;\n readonly value: number;\n};\n\nexport type BackofficeBillingUsageChartCategory = {\n readonly id: string;\n readonly label: string;\n readonly color: string;\n};\n\nexport type BackofficeBillingUsageChartProps = {\n readonly currency: string;\n readonly totalAmount: number;\n readonly from: string | null;\n readonly to: string | null;\n readonly buckets: readonly BackofficeBillingUsageChartBucket[];\n readonly categories: readonly BackofficeBillingUsageChartCategory[];\n readonly emptyLabel: string;\n readonly rangePrefix: string;\n readonly ariaLabel: string;\n};\n\nconst dateSeparator = '->';\n\nexport const BackofficeBillingUsageChart = ({\n ariaLabel,\n buckets,\n categories,\n currency,\n emptyLabel,\n from,\n rangePrefix,\n to,\n totalAmount,\n}: BackofficeBillingUsageChartProps): JSX.Element => {\n const categoryOrder = useMemo(() => {\n return categories.map((category) => {\n return category.id;\n });\n }, [categories]);\n\n const categoryColorById = useMemo(() => {\n return Object.fromEntries(\n categories.map((category) => {\n return [category.id, category.color];\n }),\n );\n }, [categories]);\n\n const categoryLabelById = useMemo(() => {\n return Object.fromEntries(\n categories.map((category) => {\n return [category.id, category.label];\n }),\n );\n }, [categories]);\n\n const series = useMemo(() => {\n if (from == null || to == null) {\n return [];\n }\n\n return toUtcDailyCategorySeries({\n fromIsoDateTime: from,\n toIsoDateTime: to,\n buckets,\n categories: categoryOrder,\n });\n }, [buckets, categoryOrder, from, to]);\n\n const formatChartValue = (value: number): string => {\n return formatCurrencyAmount({\n amount: value,\n currency,\n });\n };\n\n if (buckets.length === 0) {\n return <p className={styles.rangeText}>{emptyLabel}</p>;\n }\n\n return (\n <div className={styles.root}>\n <p className={styles.totalValue}>{formatChartValue(totalAmount)}</p>\n {from != null && to != null && (\n <p className={styles.rangeText}>\n {rangePrefix} <FormattedDate value={from} /> {dateSeparator}{' '}\n <FormattedDate value={to} />\n </p>\n )}\n <TimeSeriesLineChart\n ariaLabel={ariaLabel}\n categoryColorById={categoryColorById}\n categoryLabel={(category) => {\n return categoryLabelById[category] ?? category;\n }}\n categoryOrder={categoryOrder}\n formatValue={formatChartValue}\n series={series}\n />\n </div>\n );\n};\n\nexport default BackofficeBillingUsageChart;\n"],"mappings":";;;;;;;;AAgCA,IAAM,IAAgB,MAET,KAA+B,EAC1C,cACA,YACA,eACA,aACA,eACA,SACA,gBACA,OACA,qBACmD;CACnD,IAAM,IAAgB,QACb,EAAW,KAAK,MACd,EAAS,GAChB,EACD,CAAC,EAAW,CAAC,EAEV,IAAoB,QACjB,OAAO,YACZ,EAAW,KAAK,MACP,CAAC,EAAS,IAAI,EAAS,MAAM,CACpC,CACH,EACA,CAAC,EAAW,CAAC,EAEV,IAAoB,QACjB,OAAO,YACZ,EAAW,KAAK,MACP,CAAC,EAAS,IAAI,EAAS,MAAM,CACpC,CACH,EACA,CAAC,EAAW,CAAC,EAEV,IAAS,QACT,KAAQ,QAAQ,KAAM,OACjB,EAAE,GAGJ,EAAyB;EAC9B,iBAAiB;EACjB,eAAe;EACf;EACA,YAAY;EACb,CAAC,EACD;EAAC;EAAS;EAAe;EAAM;EAAG,CAAC,EAEhC,KAAoB,MACjB,EAAqB;EAC1B,QAAQ;EACR;EACD,CAAC;CAOJ,OAJI,EAAQ,WAAW,IACd,kBAAC,KAAD;EAAG,WAAW;YAAmB;EAAe,CAAA,GAIvD,kBAAC,OAAD;EAAK,WAAW;YAAhB;GACE,kBAAC,KAAD;IAAG,WAAW;cAAoB,EAAiB,EAAY;IAAK,CAAA;GACnE,KAAQ,QAAQ,KAAM,QACrB,kBAAC,KAAD;IAAG,WAAW;cAAd;KACG;KAAY;KAAC,kBAAC,GAAD,EAAe,OAAO,GAAQ,CAAA;;KAAE;KAAe;KAC7D,kBAAC,GAAD,EAAe,OAAO,GAAM,CAAA;KAC1B;;GAEN,kBAAC,GAAD;IACa;IACQ;IACnB,gBAAgB,MACP,EAAkB,MAAa;IAEzB;IACf,aAAa;IACL;IACR,CAAA;GACE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
//#region src/components/backoffice/billing/backofficeBillingUsageChart.css.ts
|
|
3
|
+
var e = "txvbqb9ip txvbqbai7 txvbqbaog", t = "txvbqb9y txvbqba9 txvbqbamp txvbqbv9z txvbqbfcp", n = "txvbqb8p txvbqbva3 txvbqbfcp";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { n as rangeText, e as root, t as totalValue };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=backofficeBillingUsageChart.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backofficeBillingUsageChart.css.js","names":[],"sources":["../../../../../src/components/backoffice/billing/backofficeBillingUsageChart.css.ts"],"sourcesContent":["import { sprinkles } from '@plumile/ui/theme/sprinkles.css.js';\n\nexport const root = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 3,\n});\n\nexport const totalValue = sprinkles({\n fontSize: {\n base: '2xl',\n md: '3xl',\n },\n fontWeight: 'semibold',\n color: 'text',\n margin: 0,\n});\n\nexport const rangeText = sprinkles({\n fontSize: 'xs',\n color: 'textMuted',\n margin: 0,\n});\n"],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BackofficeInlineLink as e } from "../links/BackofficeInlineLink.js";
|
|
2
2
|
import { Fragment as t, jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import i from "@plumile/
|
|
5
|
-
import
|
|
3
|
+
import { FormattedDate as r } from "@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js";
|
|
4
|
+
import { BACKOFFICE_DATE_TIME_OPTIONS as i } from "@plumile/backoffice-core/constants.js";
|
|
5
|
+
import a from "@plumile/router/routing/Link.js";
|
|
6
6
|
import { Tag as o } from "@plumile/ui/backoffice/atoms/tag/Tag.js";
|
|
7
7
|
//#region src/components/backoffice/columns/buildDataTableColumns.tsx
|
|
8
8
|
var s = (e, t) => e(t), c = (e, t) => e == null || typeof e == "string" && e.trim() === "" ? t : String(e), l = (e) => {
|
|
@@ -25,7 +25,7 @@ function u(u, d) {
|
|
|
25
25
|
case "text": return c(l.value(s), m);
|
|
26
26
|
case "link": {
|
|
27
27
|
let e = l.value(s);
|
|
28
|
-
return e == null || typeof e == "string" && e.trim() === "" ? m : /* @__PURE__ */ n(
|
|
28
|
+
return e == null || typeof e == "string" && e.trim() === "" ? m : /* @__PURE__ */ n(a, {
|
|
29
29
|
to: l.to(s),
|
|
30
30
|
children: e
|
|
31
31
|
});
|
|
@@ -39,10 +39,10 @@ function u(u, d) {
|
|
|
39
39
|
children: e
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
case "dateTime": return /* @__PURE__ */ n(
|
|
42
|
+
case "dateTime": return /* @__PURE__ */ n(r, {
|
|
43
43
|
value: l.value(s),
|
|
44
44
|
fallback: m,
|
|
45
|
-
options:
|
|
45
|
+
options: i
|
|
46
46
|
});
|
|
47
47
|
case "entityRef": {
|
|
48
48
|
let t = l.value(s);
|
|
@@ -1,74 +1,80 @@
|
|
|
1
|
-
import { buildEntityGroupLookup as e, isActivePath as t,
|
|
2
|
-
import { actionButton as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { buildEntityGroupLookup as e, isActivePath as t, joinBackofficePath as n, resolveGroupItems as r, resolveHubEntityIds as i, resolveLabel as a, resolveSidebarGroups as o, resolveSidebarHub as s } from "./sidebarUtils.js";
|
|
2
|
+
import { actionButton as c } from "./backofficeSidebarActions.css.js";
|
|
3
|
+
import { findBackofficeDashboardRegistration as l } from "../../../provider/dashboardRegistrations.js";
|
|
4
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
5
|
+
import { SidebarTasksSvg as d } from "@plumile/ui/icons/SidebarTasksSvg.js";
|
|
6
|
+
import { SidebarHomeSvg as f } from "@plumile/ui/icons/SidebarHomeSvg.js";
|
|
7
|
+
import { BackofficeSidebarHistorySvg as p } from "@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js";
|
|
8
|
+
import { GripDotsSvg as m } from "@plumile/ui/icons/GripDotsSvg.js";
|
|
9
|
+
import { PinFilledSvg as h } from "@plumile/ui/icons/PinFilledSvg.js";
|
|
10
|
+
import { PinSvg as g } from "@plumile/ui/icons/PinSvg.js";
|
|
10
11
|
//#region src/components/backoffice/layout/buildSidebarSections.tsx
|
|
11
|
-
var
|
|
12
|
+
var _ = (e, t, n = 18) => e == null ? t ?? null : /* @__PURE__ */ u(e, {
|
|
12
13
|
width: n,
|
|
13
14
|
height: n,
|
|
14
15
|
"aria-hidden": "true"
|
|
15
16
|
});
|
|
16
|
-
function
|
|
17
|
-
let { basePath:
|
|
18
|
-
if (
|
|
19
|
-
let t =
|
|
20
|
-
return t && (n =
|
|
17
|
+
function v(v) {
|
|
18
|
+
let { basePath: y, pathname: b, entities: x, dashboards: S = [], sidebar: C, permissions: w, searchQuery: T, tApp: E, t: D, pinnedEntityIds: O = [], recentItems: k = [], onTogglePin: A, onReorderPin: j, collapsedByGroupId: M, onGroupCollapsedChange: N, sidebarCollapsed: P = !1 } = v, F = o(x, C), I = Object.entries(F), L = new Set(O), R = D("sidebar.actions.pin"), z = D("sidebar.actions.unpin"), B = D("sidebar.actions.reorder"), V = e(F, C), H = T?.trim().toLowerCase() ?? "", U = (e) => H === "" || e.toLowerCase().includes(H), W = (e) => {
|
|
19
|
+
if (A == null) return null;
|
|
20
|
+
let t = L.has(e), n = R, r = g;
|
|
21
|
+
return t && (n = z, r = h), /* @__PURE__ */ u("button", {
|
|
21
22
|
type: "button",
|
|
22
|
-
className:
|
|
23
|
+
className: c,
|
|
23
24
|
"aria-pressed": t,
|
|
24
25
|
"aria-label": n,
|
|
25
26
|
title: n,
|
|
26
27
|
onClick: (t) => {
|
|
27
|
-
t.preventDefault(), t.stopPropagation(),
|
|
28
|
+
t.preventDefault(), t.stopPropagation(), A(e);
|
|
28
29
|
},
|
|
29
|
-
children: /* @__PURE__ */
|
|
30
|
+
children: /* @__PURE__ */ u(r, {
|
|
30
31
|
width: 14,
|
|
31
32
|
height: 14,
|
|
32
33
|
"aria-hidden": "true"
|
|
33
34
|
})
|
|
34
35
|
});
|
|
35
|
-
},
|
|
36
|
-
|
|
36
|
+
}, G = (e, r) => {
|
|
37
|
+
let i = e?.id ?? "dashboard", o = {
|
|
37
38
|
kind: "dashboard",
|
|
38
|
-
id:
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
id: i
|
|
40
|
+
};
|
|
41
|
+
if (C?.isItemVisible?.(o, w) === !1) return null;
|
|
42
|
+
let s = l(S, i), c = e?.label;
|
|
43
|
+
if (c == null && s != null && (c = a(s.label, E)), c ??= D("sidebar.items.dashboard"), !U(c)) return null;
|
|
44
|
+
let d = y, p = "dashboard";
|
|
45
|
+
i !== "dashboard" && (d = n(y, `dashboard/${i}`), p = `dashboard-${i}`);
|
|
46
|
+
let m = t(b, d);
|
|
47
|
+
return i === "dashboard" && (m = b === y || b === `${y}/dashboard`), {
|
|
48
|
+
id: p,
|
|
43
49
|
data: {
|
|
44
50
|
kind: "dashboard",
|
|
45
|
-
id:
|
|
46
|
-
groupId:
|
|
51
|
+
id: i,
|
|
52
|
+
groupId: r
|
|
47
53
|
},
|
|
48
|
-
label:
|
|
49
|
-
href:
|
|
50
|
-
icon:
|
|
54
|
+
label: c,
|
|
55
|
+
href: d,
|
|
56
|
+
icon: _(e?.icon ?? s?.icon, /* @__PURE__ */ u(f, {
|
|
51
57
|
width: 18,
|
|
52
58
|
height: 18,
|
|
53
59
|
"aria-hidden": "true"
|
|
54
60
|
})),
|
|
55
|
-
isActive:
|
|
56
|
-
ariaLabel:
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
let { entityId: n, groupId: r, groupIcon:
|
|
60
|
-
if (
|
|
61
|
-
let
|
|
61
|
+
isActive: m,
|
|
62
|
+
ariaLabel: c
|
|
63
|
+
};
|
|
64
|
+
}, K = (e) => {
|
|
65
|
+
let { entityId: n, groupId: r, groupIcon: i, itemIcon: o, itemLabel: s, enableReorder: c } = e, l = x[n];
|
|
66
|
+
if (l == null) return null;
|
|
67
|
+
let f = {
|
|
62
68
|
kind: "entity",
|
|
63
69
|
id: n
|
|
64
70
|
};
|
|
65
|
-
if (
|
|
71
|
+
if (l.kind === "tool" && (f = {
|
|
66
72
|
kind: "tool",
|
|
67
73
|
id: n
|
|
68
|
-
}),
|
|
69
|
-
if (
|
|
70
|
-
let e = s ??
|
|
71
|
-
return
|
|
74
|
+
}), C?.isItemVisible?.(f, w) === !1) return null;
|
|
75
|
+
if (l.kind === "tool") {
|
|
76
|
+
let e = s ?? a(l.label, E);
|
|
77
|
+
return H !== "" && !e.toLowerCase().includes(H) ? null : {
|
|
72
78
|
id: `tool-${n}`,
|
|
73
79
|
data: {
|
|
74
80
|
kind: "tool",
|
|
@@ -76,69 +82,54 @@ function g(g) {
|
|
|
76
82
|
groupId: r
|
|
77
83
|
},
|
|
78
84
|
label: e,
|
|
79
|
-
href:
|
|
80
|
-
icon:
|
|
85
|
+
href: l.routes.list,
|
|
86
|
+
icon: _(o ?? i, /* @__PURE__ */ u(d, {
|
|
81
87
|
width: 18,
|
|
82
88
|
height: 18,
|
|
83
89
|
"aria-hidden": "true"
|
|
84
90
|
})),
|
|
85
|
-
isActive: t(
|
|
91
|
+
isActive: t(b, l.routes.list),
|
|
86
92
|
ariaLabel: e,
|
|
87
|
-
actionSlot:
|
|
93
|
+
actionSlot: W(n)
|
|
88
94
|
};
|
|
89
95
|
}
|
|
90
|
-
if (!
|
|
91
|
-
let
|
|
92
|
-
if (
|
|
93
|
-
let
|
|
94
|
-
|
|
96
|
+
if (!l.hasList) return null;
|
|
97
|
+
let p = s ?? a(l.label, E);
|
|
98
|
+
if (H !== "" && !p.toLowerCase().includes(H)) return null;
|
|
99
|
+
let h;
|
|
100
|
+
c === !0 && j != null && (h = /* @__PURE__ */ u(m, {
|
|
95
101
|
width: 14,
|
|
96
102
|
height: 14,
|
|
97
103
|
"aria-hidden": "true"
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, S = (e) => {
|
|
102
|
-
e.preventDefault();
|
|
103
|
-
let { dataTransfer: t } = e;
|
|
104
|
-
t.dropEffect = "move";
|
|
105
|
-
}, w = (e) => {
|
|
106
|
-
e.preventDefault();
|
|
107
|
-
let t = e.dataTransfer.getData("text/plain");
|
|
108
|
-
t === "" || t === n || O(t, n);
|
|
109
|
-
});
|
|
110
|
-
let E;
|
|
111
|
-
return g != null && (E = L), {
|
|
104
|
+
}));
|
|
105
|
+
let g;
|
|
106
|
+
return h != null && (g = B), {
|
|
112
107
|
id: n,
|
|
113
108
|
data: {
|
|
114
109
|
kind: "entity",
|
|
115
110
|
id: n,
|
|
116
111
|
groupId: r
|
|
117
112
|
},
|
|
118
|
-
label:
|
|
119
|
-
href:
|
|
120
|
-
icon:
|
|
113
|
+
label: p,
|
|
114
|
+
href: l.routes.list,
|
|
115
|
+
icon: _(o ?? i, /* @__PURE__ */ u(d, {
|
|
121
116
|
width: 18,
|
|
122
117
|
height: 18,
|
|
123
118
|
"aria-hidden": "true"
|
|
124
119
|
})),
|
|
125
|
-
isActive: t(
|
|
126
|
-
ariaLabel:
|
|
127
|
-
actionSlot:
|
|
128
|
-
dragHandleSlot:
|
|
129
|
-
dragHandleLabel:
|
|
130
|
-
draggable: T,
|
|
131
|
-
onDragStart: _,
|
|
132
|
-
onDragOver: S,
|
|
133
|
-
onDrop: w
|
|
120
|
+
isActive: t(b, l.routes.list),
|
|
121
|
+
ariaLabel: p,
|
|
122
|
+
actionSlot: W(n),
|
|
123
|
+
dragHandleSlot: h,
|
|
124
|
+
dragHandleLabel: g
|
|
134
125
|
};
|
|
135
|
-
},
|
|
136
|
-
let { hub: n, groupId:
|
|
126
|
+
}, q = (e) => {
|
|
127
|
+
let { hub: n, groupId: r, icon: o } = e, s = {
|
|
137
128
|
kind: "hub",
|
|
138
129
|
id: n.id
|
|
139
130
|
};
|
|
140
|
-
if (
|
|
141
|
-
let
|
|
131
|
+
if (C?.isItemVisible?.(s, w) === !1) return null;
|
|
132
|
+
let c = i(n), l = c.map((e) => x[e] ?? null).filter((e) => {
|
|
142
133
|
if (e == null) return !1;
|
|
143
134
|
let t = "entity";
|
|
144
135
|
e.kind === "tool" && (t = "tool");
|
|
@@ -146,54 +137,61 @@ function g(g) {
|
|
|
146
137
|
kind: t,
|
|
147
138
|
id: e.id
|
|
148
139
|
};
|
|
149
|
-
return !(
|
|
140
|
+
return !(C?.isItemVisible?.(n, w) === !1 || e.kind !== "tool" && !e.hasList);
|
|
150
141
|
});
|
|
151
|
-
if (
|
|
152
|
-
let f =
|
|
142
|
+
if (c.length > 0 && l.length === 0) return null;
|
|
143
|
+
let f = a(n.title, E), p = U(f), m = l.some((e) => U(a(e.label, E)));
|
|
153
144
|
if (!p && !m) return null;
|
|
154
|
-
let
|
|
145
|
+
let h = t(b, n.href) || l.some((e) => t(b, e.routes.list));
|
|
155
146
|
return {
|
|
156
147
|
id: `hub-${n.id}`,
|
|
157
148
|
data: {
|
|
158
149
|
kind: "hub",
|
|
159
150
|
id: n.id,
|
|
160
|
-
groupId:
|
|
151
|
+
groupId: r
|
|
161
152
|
},
|
|
162
153
|
label: f,
|
|
163
154
|
href: n.href,
|
|
164
|
-
icon:
|
|
155
|
+
icon: _(o, /* @__PURE__ */ u(d, {
|
|
165
156
|
width: 18,
|
|
166
157
|
height: 18,
|
|
167
158
|
"aria-hidden": "true"
|
|
168
159
|
})),
|
|
169
|
-
isActive:
|
|
160
|
+
isActive: h,
|
|
170
161
|
ariaLabel: f
|
|
171
162
|
};
|
|
172
|
-
},
|
|
173
|
-
if (
|
|
174
|
-
let e =
|
|
175
|
-
if (e.kind === "dashboard")
|
|
176
|
-
|
|
177
|
-
|
|
163
|
+
}, J = [], Y = C?.primaryItems ?? [];
|
|
164
|
+
if (Y.length > 0) {
|
|
165
|
+
let e = Y.map((e) => {
|
|
166
|
+
if (e.kind === "dashboard") {
|
|
167
|
+
let t;
|
|
168
|
+
return e.label != null && (t = a(e.label, E)), G({
|
|
169
|
+
id: e.id,
|
|
170
|
+
icon: e.icon,
|
|
171
|
+
label: t
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (e.kind === "hub") return q({
|
|
175
|
+
hub: s(e, C),
|
|
178
176
|
icon: e.icon
|
|
179
177
|
});
|
|
180
178
|
let t;
|
|
181
|
-
return e.label != null && (t =
|
|
179
|
+
return e.label != null && (t = a(e.label, E)), K({
|
|
182
180
|
entityId: e.id,
|
|
183
181
|
itemIcon: e.icon,
|
|
184
182
|
itemLabel: t
|
|
185
183
|
});
|
|
186
184
|
}).filter((e) => e != null);
|
|
187
|
-
e.length > 0 &&
|
|
185
|
+
e.length > 0 && J.push({
|
|
188
186
|
id: "primary",
|
|
189
187
|
items: e,
|
|
190
188
|
collapsible: !1
|
|
191
189
|
});
|
|
192
190
|
}
|
|
193
|
-
if (
|
|
194
|
-
let e =
|
|
195
|
-
let t =
|
|
196
|
-
return
|
|
191
|
+
if (O.length > 0) {
|
|
192
|
+
let e = O.map((e) => {
|
|
193
|
+
let t = V.get(e);
|
|
194
|
+
return K({
|
|
197
195
|
entityId: e,
|
|
198
196
|
groupId: t?.groupId,
|
|
199
197
|
groupIcon: t?.groupIcon,
|
|
@@ -201,27 +199,39 @@ function g(g) {
|
|
|
201
199
|
enableReorder: !0
|
|
202
200
|
});
|
|
203
201
|
}).filter((e) => e != null);
|
|
204
|
-
e.length > 0
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
202
|
+
if (e.length > 0) {
|
|
203
|
+
let t;
|
|
204
|
+
j != null && e.length > 1 && (t = {
|
|
205
|
+
enabled: !0,
|
|
206
|
+
onReorder: j
|
|
207
|
+
});
|
|
208
|
+
let n = e;
|
|
209
|
+
t ?? (n = e.map((e) => {
|
|
210
|
+
let { dragHandleSlot: t, dragHandleLabel: n, ...r } = e;
|
|
211
|
+
return r;
|
|
212
|
+
})), J.push({
|
|
213
|
+
id: "pinned",
|
|
214
|
+
title: D("sidebar.sections.pinned"),
|
|
215
|
+
icon: _(void 0, /* @__PURE__ */ u(g, {
|
|
216
|
+
width: 16,
|
|
217
|
+
height: 16,
|
|
218
|
+
"aria-hidden": "true"
|
|
219
|
+
})),
|
|
220
|
+
items: n,
|
|
221
|
+
collapsible: !1,
|
|
222
|
+
reorder: t
|
|
223
|
+
});
|
|
224
|
+
}
|
|
215
225
|
}
|
|
216
|
-
if (
|
|
217
|
-
let e =
|
|
218
|
-
if (
|
|
226
|
+
if (k.length > 0) {
|
|
227
|
+
let e = k.map((e) => {
|
|
228
|
+
if (x[e.id] == null) return null;
|
|
219
229
|
let n = {
|
|
220
230
|
kind: e.kind,
|
|
221
231
|
id: e.id
|
|
222
232
|
};
|
|
223
|
-
if (
|
|
224
|
-
let r =
|
|
233
|
+
if (C?.isItemVisible?.(n, w) === !1 || H !== "" && !e.label.toLowerCase().includes(H)) return null;
|
|
234
|
+
let r = V.get(e.id);
|
|
225
235
|
return {
|
|
226
236
|
id: `recent-${e.kind}-${e.id}`,
|
|
227
237
|
data: {
|
|
@@ -231,19 +241,19 @@ function g(g) {
|
|
|
231
241
|
},
|
|
232
242
|
label: e.label,
|
|
233
243
|
href: e.href,
|
|
234
|
-
icon:
|
|
244
|
+
icon: _(r?.itemIcon ?? r?.groupIcon, /* @__PURE__ */ u(d, {
|
|
235
245
|
width: 18,
|
|
236
246
|
height: 18,
|
|
237
247
|
"aria-hidden": "true"
|
|
238
248
|
})),
|
|
239
|
-
isActive: t(
|
|
249
|
+
isActive: t(b, e.href),
|
|
240
250
|
ariaLabel: e.label
|
|
241
251
|
};
|
|
242
252
|
}).filter((e) => e != null);
|
|
243
|
-
e.length > 0 &&
|
|
253
|
+
e.length > 0 && J.push({
|
|
244
254
|
id: "recent",
|
|
245
|
-
title:
|
|
246
|
-
icon:
|
|
255
|
+
title: D("sidebar.sections.recent"),
|
|
256
|
+
icon: _(void 0, /* @__PURE__ */ u(p, {
|
|
247
257
|
width: 16,
|
|
248
258
|
height: 16,
|
|
249
259
|
"aria-hidden": "true"
|
|
@@ -252,55 +262,61 @@ function g(g) {
|
|
|
252
262
|
collapsible: !1
|
|
253
263
|
});
|
|
254
264
|
}
|
|
255
|
-
return
|
|
256
|
-
if (t.isVisible != null && !t.isVisible(
|
|
257
|
-
let
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
-
let
|
|
261
|
-
|
|
265
|
+
return I.forEach(([e, t]) => {
|
|
266
|
+
if (t.isVisible != null && !t.isVisible(w)) return;
|
|
267
|
+
let n = [], i = r(t);
|
|
268
|
+
i.length > 0 && i.forEach((r) => {
|
|
269
|
+
if (r.kind === "dashboard") {
|
|
270
|
+
let i;
|
|
271
|
+
r.label != null && (i = a(r.label, E));
|
|
272
|
+
let o = G({
|
|
273
|
+
id: r.id,
|
|
274
|
+
icon: r.icon ?? t.icon,
|
|
275
|
+
label: i
|
|
276
|
+
}, e);
|
|
277
|
+
o != null && n.push(o);
|
|
262
278
|
return;
|
|
263
279
|
}
|
|
264
|
-
if (
|
|
265
|
-
let i =
|
|
266
|
-
hub:
|
|
280
|
+
if (r.kind === "hub") {
|
|
281
|
+
let i = q({
|
|
282
|
+
hub: s(r, C),
|
|
267
283
|
groupId: e,
|
|
268
|
-
icon:
|
|
284
|
+
icon: r.icon ?? t.icon
|
|
269
285
|
});
|
|
270
|
-
i != null &&
|
|
286
|
+
i != null && n.push(i);
|
|
271
287
|
return;
|
|
272
288
|
}
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
let
|
|
276
|
-
entityId:
|
|
289
|
+
let i;
|
|
290
|
+
r.label != null && (i = a(r.label, E));
|
|
291
|
+
let o = K({
|
|
292
|
+
entityId: r.id,
|
|
277
293
|
groupId: e,
|
|
278
294
|
groupIcon: t.icon,
|
|
279
|
-
itemIcon:
|
|
280
|
-
itemLabel:
|
|
295
|
+
itemIcon: r.icon,
|
|
296
|
+
itemLabel: i
|
|
281
297
|
});
|
|
282
|
-
|
|
298
|
+
o != null && n.push(o);
|
|
283
299
|
});
|
|
284
|
-
let
|
|
285
|
-
if (
|
|
300
|
+
let o = n;
|
|
301
|
+
if (P && t.behavior?.showInCollapsedRail !== !0 && (o = n.filter((e) => e.data?.kind === "dashboard" || e.isActive === !0)), o.length === 0) return;
|
|
286
302
|
let c;
|
|
287
|
-
t.title != null && (c =
|
|
288
|
-
let l =
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}),
|
|
303
|
+
t.title != null && (c = a(t.title, E));
|
|
304
|
+
let l = M?.[e], u;
|
|
305
|
+
N != null && (u = (t) => {
|
|
306
|
+
N(e, t);
|
|
307
|
+
}), J.push({
|
|
292
308
|
id: e,
|
|
293
309
|
title: c,
|
|
294
|
-
icon:
|
|
295
|
-
items:
|
|
310
|
+
icon: _(t.icon, void 0, 16),
|
|
311
|
+
items: o,
|
|
296
312
|
collapsible: t.behavior?.collapsible ?? !0,
|
|
297
313
|
defaultCollapsed: t.behavior?.defaultCollapsed ?? !0,
|
|
298
314
|
isCollapsed: l,
|
|
299
315
|
onCollapsedChange: u
|
|
300
316
|
});
|
|
301
|
-
}),
|
|
317
|
+
}), J;
|
|
302
318
|
}
|
|
303
319
|
//#endregion
|
|
304
|
-
export {
|
|
320
|
+
export { v as buildSidebarSections };
|
|
305
321
|
|
|
306
322
|
//# sourceMappingURL=buildSidebarSections.js.map
|