@nivaro/react 0.3.46 → 0.3.48
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/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +248 -16
- package/dist/index.js +679 -659
- package/dist/shared/components/CollectionBrowserView.js +813 -826
- package/dist/shared/components/ErrorNotice.js +169 -0
- package/dist/shared/components/ErrorSurface.js +23 -17
- package/dist/shared/components/ListLoadError.js +8 -29
- package/dist/shared/components/LoadErrorNote.js +38 -21
- package/dist/shared/components/QueryErrorState.js +8 -11
- package/dist/shared/components/ReportView.js +1320 -1291
- package/dist/shared/components/chat/ChannelArchive.js +60 -60
- package/dist/shared/components/chat/ChannelExtras.js +74 -74
- package/dist/shared/components/chat/ChatPanel.js +368 -367
- package/dist/shared/components/command-center/PeekPanel.js +33 -32
- package/dist/shared/components/command-center/panels/BoardSettings.js +41 -40
- package/dist/shared/components/command-center/panels/PeoplePanel.js +32 -31
- package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
- package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
- package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
- package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
- package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
- package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
- package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
- package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
- package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
- package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
- package/dist/shared/components/import/ImportFromFileButton.js +61 -60
- package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
- package/dist/shared/components/imports/NewImportDialog.js +29 -28
- package/dist/shared/components/imports/RunDetailSheet.js +63 -63
- package/dist/shared/components/item-edit/FieldRow.js +329 -329
- package/dist/shared/components/item-edit/InlineTableField.js +898 -898
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
- package/dist/shared/components/item-edit/PlanGrid.js +220 -221
- package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
- package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
- package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
- package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
- package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
- package/dist/shared/components/panels/SlaClock.js +35 -36
- package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
- package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
- package/dist/shared/components/profile/AgentsPanel.js +73 -72
- package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
- package/dist/shared/components/support/SupportRequestDialog.js +85 -81
- package/dist/shared/components/support/SupportView.js +94 -87
- package/dist/shared/lib/autofill-poll.js +21 -18
- package/dist/shared/lib/error-actions.js +85 -0
- package/dist/shared/lib/error-message.js +223 -82
- package/dist/shared/lib/error-toast.js +71 -13
- package/dist/shared/lib/safe-error.js +136 -38
- package/package.json +1 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { saveReportFilterPreset as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { X as Ae, Check as
|
|
5
|
-
import { useState as C, useEffect as
|
|
6
|
-
import { toast as
|
|
7
|
-
import { useNivaroClient as Ke, useDrilldown as
|
|
8
|
-
import { get as
|
|
9
|
-
import { useLiveWidget as
|
|
10
|
-
import { serverErrorText as
|
|
11
|
-
import { buildReportTree as
|
|
12
|
-
import { uniqueByValue as
|
|
13
|
-
import { useMyScopes as
|
|
14
|
-
import { cn as
|
|
15
|
-
import { BackgroundRunOffer as
|
|
16
|
-
import { RechartsGate as
|
|
17
|
-
import { LoadErrorNote as
|
|
18
|
-
import { RecordDrilldownSheet as
|
|
19
|
-
import { TipLayer as
|
|
20
|
-
import { Command as
|
|
21
|
-
import { Popover as
|
|
22
|
-
import { SimpleSelect as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as He } from "react/jsx-runtime";
|
|
2
|
+
import { saveReportFilterPreset as Kt, listReportFilterPresets as ua, deleteReportFilterPreset as pa, readReport as ha, executeCustomQuery as fa, readItems as xa, readReportFilterOptions as ba, aiReportFilters as ga, readReportWidgetData as kt, listReportAlerts as va, createReportAlert as ya, toggleReportAlert as ka, deleteReportAlert as Na, readReportAlertLog as wa, resolveReportAlert as Sa } from "@nivaro/sdk";
|
|
3
|
+
import { useQuery as Ne, useQueryClient as Ct, useMutation as Me, isCancelledError as _a } from "@tanstack/react-query";
|
|
4
|
+
import { X as Ae, Check as Ut, Plus as Vt, Camera as wt, Bell as Yt, RefreshCw as Ft, ChevronsUpDown as Jt, Sparkles as Dt, Info as Ca, Table as $a, Sigma as qa, StickyNote as Ma, Download as Fa, TrendingUp as Gt, TrendingDown as Ht, Trash2 as Aa } from "lucide-react";
|
|
5
|
+
import { useState as C, useEffect as mt, useCallback as At, useRef as St, useMemo as ut, Suspense as qt, lazy as Rt, memo as Ta } from "react";
|
|
6
|
+
import { toast as Xt } from "sonner";
|
|
7
|
+
import { useNivaroClient as Ke, useDrilldown as Zt, useOverlayState as La } from "../context.js";
|
|
8
|
+
import { get as ct, post as pt, del as Ra, put as Oa } from "../lib/commands.js";
|
|
9
|
+
import { useLiveWidget as Ka, liveWidgetInterval as Da } from "../lib/live-widgets.js";
|
|
10
|
+
import { serverErrorText as It, loadErrorText as Tt } from "../lib/load-error.js";
|
|
11
|
+
import { buildReportTree as Pa } from "../lib/report-tree.js";
|
|
12
|
+
import { uniqueByValue as za } from "../lib/unique-options.js";
|
|
13
|
+
import { useMyScopes as ja, matchScopeDimension as Ea, translateScopeValues as Pt, effectiveScopeSeedIds as Wa } from "../lib/use-my-scopes.js";
|
|
14
|
+
import { cn as j } from "../lib/utils.js";
|
|
15
|
+
import { BackgroundRunOffer as ea } from "./BackgroundRunOffer.js";
|
|
16
|
+
import { RechartsGate as Re } from "./charts/RechartsGate.js";
|
|
17
|
+
import { LoadErrorNote as ta } from "./LoadErrorNote.js";
|
|
18
|
+
import { RecordDrilldownSheet as Ba } from "./RecordDrilldownSheet.js";
|
|
19
|
+
import { TipLayer as Qa } from "./TipLayer.js";
|
|
20
|
+
import { Command as Ua, CommandInput as Va, CommandList as Ya, CommandEmpty as Ja, CommandItem as Ga } from "./ui/command.js";
|
|
21
|
+
import { Popover as aa, PopoverTrigger as la, PopoverContent as ra } from "./ui/popover.js";
|
|
22
|
+
import { SimpleSelect as Nt } from "./ui/SimpleSelect.js";
|
|
23
23
|
import { Skeleton as Oe } from "./ui/skeleton.js";
|
|
24
|
-
async function
|
|
24
|
+
async function Ha(t, n) {
|
|
25
25
|
const a = t == null ? void 0 : t.querySelector("svg");
|
|
26
26
|
if (!(!a || typeof ClipboardItem > "u"))
|
|
27
27
|
try {
|
|
28
|
-
const o = a.getBoundingClientRect(),
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
await new Promise((
|
|
32
|
-
f.onload = () =>
|
|
28
|
+
const o = a.getBoundingClientRect(), c = a.cloneNode(!0);
|
|
29
|
+
c.setAttribute("width", String(o.width)), c.setAttribute("height", String(o.height));
|
|
30
|
+
const m = new XMLSerializer().serializeToString(c), h = URL.createObjectURL(new Blob([m], { type: "image/svg+xml;charset=utf-8" })), f = new Image();
|
|
31
|
+
await new Promise((E, u) => {
|
|
32
|
+
f.onload = () => E(), f.onerror = () => u(new Error("svg load failed")), f.src = h;
|
|
33
33
|
});
|
|
34
34
|
const p = 2, L = document.createElement("canvas");
|
|
35
35
|
L.width = Math.max(1, Math.round(o.width * p)), L.height = Math.max(1, Math.round(o.height * p) + 28 * p);
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
const w = await new Promise((
|
|
36
|
+
const q = L.getContext("2d");
|
|
37
|
+
if (!q) return;
|
|
38
|
+
q.fillStyle = "#ffffff", q.fillRect(0, 0, L.width, L.height), q.fillStyle = "#172940", q.font = `${12 * p}px system-ui, sans-serif`, q.fillText(n || "Chart", 8 * p, 18 * p), q.drawImage(f, 0, 28 * p, o.width * p, o.height * p), URL.revokeObjectURL(h);
|
|
39
|
+
const w = await new Promise((E) => L.toBlob(E, "image/png"));
|
|
40
40
|
w && await navigator.clipboard.write([new ClipboardItem({ "image/png": w })]);
|
|
41
41
|
} catch {
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t),
|
|
44
|
+
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t), Xa = [
|
|
45
45
|
"Jan",
|
|
46
46
|
"Feb",
|
|
47
47
|
"Mar",
|
|
@@ -54,18 +54,18 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
54
54
|
"Oct",
|
|
55
55
|
"Nov",
|
|
56
56
|
"Dec"
|
|
57
|
-
],
|
|
58
|
-
const
|
|
57
|
+
], Za = (t) => {
|
|
58
|
+
const n = String(t ?? ""), a = /^(\d{4})-(\d{2})(?:-(\d{2}))?/.exec(n);
|
|
59
59
|
if (a) {
|
|
60
|
-
const o =
|
|
60
|
+
const o = Xa[Number(a[2]) - 1] ?? a[2];
|
|
61
61
|
return a[3] ? `${o} ${Number(a[3])}` : `${o} '${a[1].slice(2)}`;
|
|
62
62
|
}
|
|
63
|
-
return
|
|
63
|
+
return n.length > 16 ? `${n.slice(0, 15)}…` : n;
|
|
64
64
|
}, _t = (t) => ({
|
|
65
65
|
interval: t > 12 ? Math.ceil(t / 12) - 1 : 0,
|
|
66
|
-
tickFormatter:
|
|
66
|
+
tickFormatter: Za,
|
|
67
67
|
minTickGap: 4
|
|
68
|
-
}),
|
|
68
|
+
}), Ot = () => import("./ReportEditMode.js"), Ia = Rt(() => Ot().then((t) => ({ default: t.AddWidgetBar }))), el = Rt(() => Ot().then((t) => ({ default: t.WidgetConfigSheet }))), tl = Rt(() => Ot().then((t) => ({ default: t.WidgetEditBar }))), Ge = "rgb(var(--nvr-cyan-rgb, 0 206 255))", oe = [Ge, "#172940", "#10b981", "#f59e0b", "#8b5cf6", "#ef4444", "#64748b"], al = [
|
|
69
69
|
{ id: "", label: "All time" },
|
|
70
70
|
{ id: "this_month", label: "This month" },
|
|
71
71
|
{ id: "last_30_days", label: "Last 30 days" },
|
|
@@ -74,233 +74,233 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
74
74
|
{ id: "last_12_months", label: "Last 12 months" },
|
|
75
75
|
{ id: "ytd", label: "Year to date" }
|
|
76
76
|
];
|
|
77
|
-
function qe(t,
|
|
77
|
+
function qe(t, n) {
|
|
78
78
|
if (t == null) return "—";
|
|
79
|
-
const a = (
|
|
80
|
-
minimumFractionDigits:
|
|
81
|
-
maximumFractionDigits:
|
|
79
|
+
const a = (n == null ? void 0 : n.decimals) != null ? t.toLocaleString(void 0, {
|
|
80
|
+
minimumFractionDigits: n.decimals,
|
|
81
|
+
maximumFractionDigits: n.decimals
|
|
82
82
|
}) : t.toLocaleString();
|
|
83
|
-
return `${(
|
|
83
|
+
return `${(n == null ? void 0 : n.prefix) ?? ""}${a}${(n == null ? void 0 : n.suffix) ?? ""}`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function zt({ pct: t }) {
|
|
86
86
|
if (t == null) return null;
|
|
87
|
-
const
|
|
87
|
+
const n = t >= 0;
|
|
88
88
|
return /* @__PURE__ */ i(
|
|
89
89
|
"span",
|
|
90
90
|
{
|
|
91
|
-
className:
|
|
91
|
+
className: j(
|
|
92
92
|
"inline-flex items-center gap-0.5 rounded px-1 py-px text-[10.5px] font-medium",
|
|
93
|
-
|
|
93
|
+
n ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400" : "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400"
|
|
94
94
|
),
|
|
95
95
|
children: [
|
|
96
|
-
|
|
96
|
+
n ? /* @__PURE__ */ e(Gt, { className: "h-2.5 w-2.5" }) : /* @__PURE__ */ e(Ht, { className: "h-2.5 w-2.5" }),
|
|
97
97
|
Math.abs(t),
|
|
98
98
|
"%"
|
|
99
99
|
]
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function na({
|
|
104
104
|
reportId: t,
|
|
105
|
-
field:
|
|
105
|
+
field: n,
|
|
106
106
|
label: a,
|
|
107
107
|
optionSource: o,
|
|
108
|
-
selected:
|
|
109
|
-
onChange:
|
|
108
|
+
selected: c,
|
|
109
|
+
onChange: m,
|
|
110
110
|
allowedValues: h
|
|
111
111
|
}) {
|
|
112
|
-
const f = Ke(), [p, L] = C(!1), { data:
|
|
113
|
-
queryKey: ["nivaro-report-filter-opts", t,
|
|
112
|
+
const f = Ke(), [p, L] = C(!1), { data: q = [] } = Ne({
|
|
113
|
+
queryKey: ["nivaro-report-filter-opts", t, n, o ?? null],
|
|
114
114
|
queryFn: async () => {
|
|
115
115
|
if (o) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
fields: [.../* @__PURE__ */ new Set(["id",
|
|
116
|
+
const u = o.value_field ?? "id", N = o.label_field ?? u, U = await f.request(
|
|
117
|
+
xa(o.collection, {
|
|
118
|
+
fields: [.../* @__PURE__ */ new Set(["id", u, N])],
|
|
119
119
|
sort: o.sort ? [o.sort] : void 0,
|
|
120
120
|
limit: 200
|
|
121
121
|
})
|
|
122
122
|
);
|
|
123
|
-
return
|
|
124
|
-
(
|
|
125
|
-
value: String(O[
|
|
126
|
-
label: String(O[
|
|
123
|
+
return za(
|
|
124
|
+
(U.data ?? []).map((O) => ({
|
|
125
|
+
value: String(O[u] ?? O.id),
|
|
126
|
+
label: String(O[N] ?? O[u] ?? O.id)
|
|
127
127
|
})),
|
|
128
128
|
(O) => O.value
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
|
-
return f.request(
|
|
131
|
+
return f.request(ba(t, n)).then((u) => u.data);
|
|
132
132
|
},
|
|
133
133
|
enabled: p,
|
|
134
134
|
staleTime: 12e4
|
|
135
|
-
}), w = h != null && h.length ?
|
|
136
|
-
return /* @__PURE__ */ i(
|
|
137
|
-
/* @__PURE__ */ e(
|
|
135
|
+
}), w = h != null && h.length ? q.filter((u) => h.some((N) => String(N) === u.value)) : q, E = c.length > 0;
|
|
136
|
+
return /* @__PURE__ */ i(aa, { open: p, onOpenChange: L, children: [
|
|
137
|
+
/* @__PURE__ */ e(la, { asChild: !0, children: /* @__PURE__ */ i(
|
|
138
138
|
"button",
|
|
139
139
|
{
|
|
140
140
|
type: "button",
|
|
141
|
-
className:
|
|
141
|
+
className: j(
|
|
142
142
|
"flex h-7 items-center gap-1.5 rounded-md border px-2 text-[12px]",
|
|
143
|
-
|
|
143
|
+
E ? "border-nvr-cyan bg-accent font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-300 dark:border-border"
|
|
144
144
|
),
|
|
145
145
|
children: [
|
|
146
146
|
a,
|
|
147
|
-
|
|
147
|
+
E && /* @__PURE__ */ e("span", { className: "rounded-full bg-white/60 px-1 text-[10px] dark:bg-black/20", children: c.length }),
|
|
148
148
|
/* @__PURE__ */ e(Jt, { className: "h-3 w-3 opacity-50" })
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
151
|
) }),
|
|
152
|
-
/* @__PURE__ */ e(
|
|
153
|
-
/* @__PURE__ */ e(
|
|
152
|
+
/* @__PURE__ */ e(ra, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ i(Ua, { children: [
|
|
153
|
+
/* @__PURE__ */ e(Va, { placeholder: `Filter ${a}…`, className: "h-8 text-[12.5px]" }),
|
|
154
154
|
/* @__PURE__ */ i(Ya, { className: "max-h-52", children: [
|
|
155
155
|
/* @__PURE__ */ e(Ja, { children: "No values." }),
|
|
156
|
-
w.map((
|
|
157
|
-
const
|
|
156
|
+
w.map((u) => {
|
|
157
|
+
const N = c.some((U) => String(U) === u.value);
|
|
158
158
|
return /* @__PURE__ */ i(
|
|
159
|
-
|
|
159
|
+
Ga,
|
|
160
160
|
{
|
|
161
|
-
value:
|
|
161
|
+
value: u.label,
|
|
162
162
|
onSelect: () => {
|
|
163
|
-
const
|
|
163
|
+
const U = N ? c.filter((ee) => String(ee) !== u.value) : [...c, u.value], O = (ee) => {
|
|
164
164
|
var H;
|
|
165
|
-
return ((H =
|
|
165
|
+
return ((H = q.find((ue) => ue.value === String(ee))) == null ? void 0 : H.label) ?? String(ee);
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
m(U, U.map(O));
|
|
168
168
|
},
|
|
169
169
|
className: "text-[12.5px]",
|
|
170
170
|
children: [
|
|
171
|
-
/* @__PURE__ */ e(
|
|
172
|
-
|
|
171
|
+
/* @__PURE__ */ e(Ut, { className: j("mr-1.5 h-3 w-3", N ? "opacity-100" : "opacity-0") }),
|
|
172
|
+
u.label
|
|
173
173
|
]
|
|
174
174
|
},
|
|
175
|
-
|
|
175
|
+
u.value
|
|
176
176
|
);
|
|
177
177
|
})
|
|
178
178
|
] })
|
|
179
179
|
] }) })
|
|
180
180
|
] });
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function sa(t) {
|
|
183
183
|
if (!t) return null;
|
|
184
|
-
const
|
|
184
|
+
const n = /* @__PURE__ */ new Date(), a = (m) => {
|
|
185
185
|
const h = (f) => String(f).padStart(2, "0");
|
|
186
|
-
return `${
|
|
187
|
-
}, o = (
|
|
186
|
+
return `${m.getFullYear()}-${h(m.getMonth() + 1)}-${h(m.getDate())}`;
|
|
187
|
+
}, o = (m, h) => new Date(m, h, 1), c = (m) => new Date(m.getFullYear(), m.getMonth() + 1, 0);
|
|
188
188
|
switch (t.preset) {
|
|
189
189
|
case "this_month":
|
|
190
|
-
return { start: a(o(
|
|
190
|
+
return { start: a(o(n.getFullYear(), n.getMonth())), end: a(c(n)) };
|
|
191
191
|
case "last_30_days":
|
|
192
|
-
return { start: a(new Date(
|
|
192
|
+
return { start: a(new Date(n.getTime() - 30 * 864e5)), end: a(n) };
|
|
193
193
|
case "last_3_months":
|
|
194
|
-
return { start: a(o(
|
|
194
|
+
return { start: a(o(n.getFullYear(), n.getMonth() - 3)), end: a(c(n)) };
|
|
195
195
|
case "last_6_months":
|
|
196
|
-
return { start: a(o(
|
|
196
|
+
return { start: a(o(n.getFullYear(), n.getMonth() - 6)), end: a(c(n)) };
|
|
197
197
|
case "last_12_months":
|
|
198
|
-
return { start: a(o(
|
|
198
|
+
return { start: a(o(n.getFullYear(), n.getMonth() - 12)), end: a(c(n)) };
|
|
199
199
|
case "ytd":
|
|
200
|
-
return { start: `${
|
|
200
|
+
return { start: `${n.getFullYear()}-01-01`, end: a(n) };
|
|
201
201
|
case "custom":
|
|
202
202
|
return t.start && t.end ? { start: t.start, end: t.end } : null;
|
|
203
203
|
default:
|
|
204
204
|
return null;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function je(t, n, a) {
|
|
208
208
|
if (t == null || t === "") return "—";
|
|
209
|
-
if (
|
|
210
|
-
const
|
|
211
|
-
if (Number.isNaN(
|
|
212
|
-
const h =
|
|
213
|
-
return
|
|
209
|
+
if (n === "date" || n === "datetime") {
|
|
210
|
+
const m = new Date(String(t));
|
|
211
|
+
if (Number.isNaN(m.getTime())) return String(t);
|
|
212
|
+
const h = m.toLocaleDateString();
|
|
213
|
+
return n === "date" ? h : `${h} ${m.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`;
|
|
214
214
|
}
|
|
215
215
|
const o = Number(t);
|
|
216
216
|
if (Number.isNaN(o)) return String(t);
|
|
217
|
-
const
|
|
218
|
-
minimumFractionDigits: a ??
|
|
217
|
+
const c = (m, h) => o.toLocaleString(void 0, {
|
|
218
|
+
minimumFractionDigits: a ?? m,
|
|
219
219
|
maximumFractionDigits: a ?? h
|
|
220
220
|
});
|
|
221
|
-
return
|
|
221
|
+
return n === "currency" ? `$${c(0, 0)}` : n === "percent" ? `${c(0, 1)}%` : n === "days" ? `${c(0, 1)}d` : n === "integer" ? Math.round(o).toLocaleString() : n === "number" ? c(0, 2) : String(t);
|
|
222
222
|
}
|
|
223
|
-
const
|
|
223
|
+
const ze = /* @__PURE__ */ new Set([
|
|
224
224
|
"currency",
|
|
225
225
|
"number",
|
|
226
226
|
"integer",
|
|
227
227
|
"percent",
|
|
228
228
|
"days"
|
|
229
229
|
]);
|
|
230
|
-
function
|
|
231
|
-
const o = {},
|
|
232
|
-
for (const [
|
|
230
|
+
function ia(t, n, a) {
|
|
231
|
+
const o = {}, c = sa(n);
|
|
232
|
+
for (const [m, h] of Object.entries(t.params ?? {})) {
|
|
233
233
|
if (h === "$date.start") {
|
|
234
|
-
|
|
234
|
+
c && (o[m] = c.start);
|
|
235
235
|
continue;
|
|
236
236
|
}
|
|
237
237
|
if (h === "$date.end") {
|
|
238
|
-
|
|
238
|
+
c && (o[m] = c.end);
|
|
239
239
|
continue;
|
|
240
240
|
}
|
|
241
241
|
const f = /^\$filters\.([\w.]+?)(:values)?$/.exec(h);
|
|
242
242
|
if (f) {
|
|
243
|
-
const p = a.find((
|
|
244
|
-
L && L.length > 0 && (o[
|
|
243
|
+
const p = a.find((q) => q.field === f[1]), L = f[2] ? p == null ? void 0 : p.values : p != null && p.labels && p.labels.length > 0 ? p.labels : p == null ? void 0 : p.values;
|
|
244
|
+
L && L.length > 0 && (o[m] = L.join(","));
|
|
245
245
|
continue;
|
|
246
246
|
}
|
|
247
|
-
o[
|
|
247
|
+
o[m] = h;
|
|
248
248
|
}
|
|
249
249
|
return o;
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const ll = (t) => `$${Ce(Math.round(t))}`, rl = [
|
|
252
252
|
{ gte: 90, color: "#ef4444" },
|
|
253
253
|
{ gte: 70, color: "#f59e0b" },
|
|
254
254
|
{ gte: -1 / 0, color: "#10b981" }
|
|
255
255
|
];
|
|
256
|
-
function
|
|
256
|
+
function nl({
|
|
257
257
|
rows: t,
|
|
258
|
-
cfg:
|
|
258
|
+
cfg: n,
|
|
259
259
|
onDrill: a
|
|
260
260
|
}) {
|
|
261
|
-
const o =
|
|
262
|
-
var
|
|
263
|
-
return typeof ((
|
|
264
|
-
}).slice(0, 3).map((
|
|
265
|
-
() => o ?
|
|
261
|
+
const o = n.tree, c = n.series && n.series.length > 0 ? n.series : Object.keys(t[0] ?? {}).filter((u) => {
|
|
262
|
+
var N;
|
|
263
|
+
return typeof ((N = t[0]) == null ? void 0 : N[u]) == "number";
|
|
264
|
+
}).slice(0, 3).map((u) => ({ field: u, label: u })), m = ut(
|
|
265
|
+
() => o ? Pa(
|
|
266
266
|
t,
|
|
267
267
|
o,
|
|
268
|
-
|
|
268
|
+
c.map((u) => u.field)
|
|
269
269
|
) : [],
|
|
270
270
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
271
271
|
[t, o]
|
|
272
272
|
), [h, f] = C(() => /* @__PURE__ */ new Set()), [p, L] = C(!1);
|
|
273
|
-
|
|
274
|
-
if (p ||
|
|
275
|
-
const
|
|
276
|
-
for (const O of
|
|
277
|
-
(O.depth > 0 ||
|
|
273
|
+
mt(() => {
|
|
274
|
+
if (p || m.length === 0) return;
|
|
275
|
+
const u = /* @__PURE__ */ new Set(), N = (U) => {
|
|
276
|
+
for (const O of U)
|
|
277
|
+
(O.depth > 0 || m.length === 1) && u.add(O.key), N(O.children);
|
|
278
278
|
};
|
|
279
|
-
|
|
280
|
-
}, [
|
|
281
|
-
const
|
|
282
|
-
var
|
|
283
|
-
return
|
|
284
|
-
},
|
|
285
|
-
const
|
|
286
|
-
return /* @__PURE__ */ i("div", { style: { paddingLeft:
|
|
279
|
+
N(m), f(u), L(!0);
|
|
280
|
+
}, [m, p]);
|
|
281
|
+
const q = (o == null ? void 0 : o.thresholds) ?? rl, w = (u) => {
|
|
282
|
+
var N;
|
|
283
|
+
return u == null ? void 0 : ((N = q.find((U) => u >= U.gte)) == null ? void 0 : N.color) ?? "#10b981";
|
|
284
|
+
}, E = (u) => {
|
|
285
|
+
const N = u.children.length === 0, U = h.has(u.key), O = w(u.pct), ee = N && (o == null ? void 0 : o.drill) && u.drillId != null;
|
|
286
|
+
return /* @__PURE__ */ i("div", { style: { paddingLeft: u.depth === 0 ? 0 : 14 }, children: [
|
|
287
287
|
/* @__PURE__ */ i(
|
|
288
288
|
"div",
|
|
289
289
|
{
|
|
290
|
-
role:
|
|
291
|
-
tabIndex:
|
|
292
|
-
className:
|
|
290
|
+
role: ee || !N ? "button" : void 0,
|
|
291
|
+
tabIndex: ee || !N ? 0 : void 0,
|
|
292
|
+
className: j(
|
|
293
293
|
"group/tn rounded-md px-1.5 py-1",
|
|
294
|
-
(
|
|
294
|
+
(ee || !N) && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40"
|
|
295
295
|
),
|
|
296
296
|
onClick: () => {
|
|
297
|
-
|
|
297
|
+
N ? ee && (o != null && o.drill) && a({
|
|
298
298
|
collection: o.drill.collection,
|
|
299
|
-
itemId: String(
|
|
300
|
-
title:
|
|
299
|
+
itemId: String(u.drillId),
|
|
300
|
+
title: u.label
|
|
301
301
|
}) : f((H) => {
|
|
302
|
-
const
|
|
303
|
-
return
|
|
302
|
+
const ue = new Set(H);
|
|
303
|
+
return ue.has(u.key) ? ue.delete(u.key) : ue.add(u.key), ue;
|
|
304
304
|
});
|
|
305
305
|
},
|
|
306
306
|
onKeyDown: (H) => {
|
|
@@ -308,78 +308,100 @@ function rl({
|
|
|
308
308
|
},
|
|
309
309
|
children: [
|
|
310
310
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
311
|
-
|
|
311
|
+
N ? /* @__PURE__ */ e("span", { className: "w-3 shrink-0" }) : /* @__PURE__ */ e(
|
|
312
312
|
Jt,
|
|
313
313
|
{
|
|
314
|
-
className:
|
|
314
|
+
className: j(
|
|
315
315
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
316
|
-
|
|
316
|
+
U && "rotate-180"
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
319
|
),
|
|
320
|
-
|
|
320
|
+
N && u.badge && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-slate-100 px-1 py-px text-[9.5px] tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: u.badge }),
|
|
321
321
|
/* @__PURE__ */ e(
|
|
322
322
|
"span",
|
|
323
323
|
{
|
|
324
|
-
className:
|
|
324
|
+
className: j(
|
|
325
325
|
"min-w-0 flex-1 truncate",
|
|
326
|
-
|
|
326
|
+
u.depth === 0 ? "text-[12px] font-semibold text-slate-800 dark:text-slate-100" : u.depth === 1 ? "text-[11.5px] font-medium text-slate-700 dark:text-slate-200" : j(
|
|
327
327
|
"text-[11px] text-slate-600 dark:text-slate-300",
|
|
328
|
-
|
|
328
|
+
ee && "group-hover/tn:underline"
|
|
329
329
|
)
|
|
330
330
|
),
|
|
331
|
-
children:
|
|
331
|
+
children: u.label
|
|
332
332
|
}
|
|
333
333
|
),
|
|
334
|
-
(o == null ? void 0 : o.pct) && (
|
|
334
|
+
(o == null ? void 0 : o.pct) && (u.pct == null ? /* @__PURE__ */ e("span", { className: "shrink-0 text-[10.5px] font-semibold tabular-nums text-slate-400", children: "—" }) : /* @__PURE__ */ i(
|
|
335
335
|
"span",
|
|
336
336
|
{
|
|
337
337
|
className: "shrink-0 text-[10.5px] font-semibold tabular-nums",
|
|
338
338
|
style: { color: O },
|
|
339
339
|
children: [
|
|
340
|
-
|
|
340
|
+
u.pct.toFixed(1),
|
|
341
341
|
"%"
|
|
342
342
|
]
|
|
343
343
|
}
|
|
344
344
|
))
|
|
345
345
|
] }),
|
|
346
|
-
(o == null ? void 0 : o.pct) &&
|
|
346
|
+
(o == null ? void 0 : o.pct) && u.pct != null && /* @__PURE__ */ e(
|
|
347
347
|
"div",
|
|
348
348
|
{
|
|
349
|
-
className:
|
|
349
|
+
className: j(
|
|
350
350
|
"ml-[18px] mt-0.5 overflow-hidden rounded-full bg-slate-100 dark:bg-muted",
|
|
351
|
-
|
|
351
|
+
u.depth === 0 ? "h-[5px]" : u.depth === 1 ? "h-[3px]" : "h-[2px]"
|
|
352
352
|
),
|
|
353
353
|
children: /* @__PURE__ */ e(
|
|
354
354
|
"div",
|
|
355
355
|
{
|
|
356
356
|
className: "h-full rounded-full transition-[width] duration-300",
|
|
357
|
-
style: { width: `${Math.min(Math.max(
|
|
357
|
+
style: { width: `${Math.min(Math.max(u.pct, 0), 100)}%`, background: O }
|
|
358
358
|
}
|
|
359
359
|
)
|
|
360
360
|
}
|
|
361
361
|
),
|
|
362
|
-
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children:
|
|
362
|
+
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((H) => /* @__PURE__ */ i("span", { children: [
|
|
363
363
|
H.label ?? H.field,
|
|
364
364
|
" ",
|
|
365
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children:
|
|
365
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: u.sums[H.field] == null ? H.empty_label ?? "—" : n.value_format === "currency" ? ll(u.sums[H.field]) : u.sums[H.field].toLocaleString() })
|
|
366
366
|
] }, H.field)) })
|
|
367
367
|
]
|
|
368
368
|
}
|
|
369
369
|
),
|
|
370
|
-
|
|
371
|
-
] },
|
|
370
|
+
U && u.children.map(E)
|
|
371
|
+
] }, u.key);
|
|
372
372
|
};
|
|
373
|
-
return !o ||
|
|
373
|
+
return !o || m.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto pr-1", children: m.map(E) });
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
const
|
|
375
|
+
function sl(t) {
|
|
376
|
+
const [n, a] = C(() => typeof IntersectionObserver > "u");
|
|
377
|
+
return mt(() => {
|
|
378
|
+
if (n) return;
|
|
379
|
+
const o = t.current;
|
|
380
|
+
if (!o) {
|
|
381
|
+
a(!0);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const c = new IntersectionObserver(
|
|
385
|
+
(h) => {
|
|
386
|
+
h.some((f) => f.isIntersecting) && a(!0);
|
|
387
|
+
},
|
|
388
|
+
{ rootMargin: "600px 0px" }
|
|
389
|
+
);
|
|
390
|
+
c.observe(o);
|
|
391
|
+
const m = () => a(!0);
|
|
392
|
+
return window.addEventListener("beforeprint", m), () => {
|
|
393
|
+
c.disconnect(), window.removeEventListener("beforeprint", m);
|
|
394
|
+
};
|
|
395
|
+
}, [n, t]), n;
|
|
396
|
+
}
|
|
397
|
+
function il(t) {
|
|
398
|
+
const n = Ke(), a = St(!1);
|
|
377
399
|
return async (o) => {
|
|
378
400
|
if (!(!t || a.current)) {
|
|
379
401
|
a.current = !0;
|
|
380
402
|
try {
|
|
381
|
-
const
|
|
382
|
-
|
|
403
|
+
const m = (await n.request(pt("/report-studio/drill-row", { values: o }))).data;
|
|
404
|
+
m != null && m.collection && m.item_id && t({ collection: m.collection, itemId: m.item_id });
|
|
383
405
|
} catch {
|
|
384
406
|
} finally {
|
|
385
407
|
a.current = !1;
|
|
@@ -387,162 +409,166 @@ function nl(t) {
|
|
|
387
409
|
}
|
|
388
410
|
};
|
|
389
411
|
}
|
|
390
|
-
function
|
|
391
|
-
let a =
|
|
412
|
+
function oa(t, n) {
|
|
413
|
+
let a = n;
|
|
392
414
|
if (t.group_rows && t.x_field) {
|
|
393
|
-
const o = /* @__PURE__ */ new Map(),
|
|
394
|
-
(t.series ?? []).map((
|
|
415
|
+
const o = /* @__PURE__ */ new Map(), c = new Set(
|
|
416
|
+
(t.series ?? []).map((m) => m.field).length > 0 ? (t.series ?? []).map((m) => m.field) : Object.keys(a[0] ?? {}).filter((m) => {
|
|
395
417
|
var h;
|
|
396
|
-
return typeof ((h = a[0]) == null ? void 0 : h[
|
|
418
|
+
return typeof ((h = a[0]) == null ? void 0 : h[m]) == "number";
|
|
397
419
|
})
|
|
398
420
|
);
|
|
399
|
-
for (const
|
|
400
|
-
const h = String(
|
|
401
|
-
for (const p of
|
|
421
|
+
for (const m of a) {
|
|
422
|
+
const h = String(m[t.x_field] ?? "Unknown"), f = o.get(h) ?? { [t.x_field]: h };
|
|
423
|
+
for (const p of c) f[p] = (Number(f[p]) || 0) + (Number(m[p]) || 0);
|
|
402
424
|
o.set(h, f);
|
|
403
425
|
}
|
|
404
426
|
a = [...o.values()];
|
|
405
427
|
}
|
|
406
428
|
if (t.sort) {
|
|
407
|
-
const o = t.sort.startsWith("-"),
|
|
408
|
-
a = [...a].sort((
|
|
409
|
-
const f =
|
|
429
|
+
const o = t.sort.startsWith("-"), c = o ? t.sort.slice(1) : t.sort;
|
|
430
|
+
a = [...a].sort((m, h) => {
|
|
431
|
+
const f = m[c], p = h[c], L = typeof f == "number" && typeof p == "number" ? f - p : String(f ?? "").localeCompare(String(p ?? ""));
|
|
410
432
|
return o ? -L : L;
|
|
411
433
|
});
|
|
412
434
|
}
|
|
413
435
|
return t.limit && t.limit > 0 && (a = a.slice(0, t.limit)), a;
|
|
414
436
|
}
|
|
415
|
-
function
|
|
416
|
-
const
|
|
417
|
-
return t.request(o ? { ...
|
|
437
|
+
function da(t, n, a, o) {
|
|
438
|
+
const c = fa(n, a);
|
|
439
|
+
return t.request(o ? { ...c, _signal: o } : c).then((m) => m.data ?? []);
|
|
418
440
|
}
|
|
419
|
-
function
|
|
441
|
+
function ol({
|
|
420
442
|
cfg: t,
|
|
421
|
-
dateRange:
|
|
443
|
+
dateRange: n,
|
|
422
444
|
entityFilters: a,
|
|
423
445
|
refetchInterval: o,
|
|
424
|
-
onStatus:
|
|
425
|
-
onDrill:
|
|
446
|
+
onStatus: c,
|
|
447
|
+
onDrill: m,
|
|
448
|
+
deferred: h = !1
|
|
426
449
|
}) {
|
|
427
|
-
var
|
|
428
|
-
const
|
|
429
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
430
|
-
queryFn: ({ signal:
|
|
450
|
+
var le, ae;
|
|
451
|
+
const f = Ke(), p = il(m), [L, q] = C(""), [w, E] = C(0), [u, N] = C(null), U = ia(t, n, a), { data: O, isLoading: ee, error: H, isFetching: ue, refetch: pe } = Ne({
|
|
452
|
+
queryKey: ["nivaro-report-query", t.slug, U],
|
|
453
|
+
queryFn: ({ signal: S }) => da(f, t.slug, U, S),
|
|
454
|
+
enabled: !h,
|
|
431
455
|
staleTime: 6e4,
|
|
432
456
|
refetchInterval: o,
|
|
433
457
|
retry: !1
|
|
434
458
|
});
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
}, [
|
|
459
|
+
if (mt(() => {
|
|
460
|
+
c == null || c({ isFetching: ue, refetch: () => void pe() });
|
|
461
|
+
}, [ue]), h && O === void 0)
|
|
462
|
+
return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
463
|
+
if (ee)
|
|
438
464
|
return /* @__PURE__ */ i("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
439
465
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
440
466
|
/* @__PURE__ */ e(
|
|
441
|
-
|
|
467
|
+
ea,
|
|
442
468
|
{
|
|
443
469
|
pending: !0,
|
|
444
470
|
request: {
|
|
445
471
|
method: "POST",
|
|
446
472
|
url: `/custom-queries/${t.slug}/execute`,
|
|
447
|
-
body: { params:
|
|
473
|
+
body: { params: U }
|
|
448
474
|
},
|
|
449
475
|
label: `Query ${t.slug}`,
|
|
450
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
451
|
-
select: (
|
|
476
|
+
queryKey: ["nivaro-report-query", t.slug, U],
|
|
477
|
+
select: (S) => (S == null ? void 0 : S.data) ?? []
|
|
452
478
|
}
|
|
453
479
|
)
|
|
454
480
|
] });
|
|
455
|
-
if (
|
|
481
|
+
if (H)
|
|
456
482
|
return /* @__PURE__ */ e(
|
|
457
|
-
|
|
483
|
+
ta,
|
|
458
484
|
{
|
|
459
485
|
className: "px-1",
|
|
460
|
-
message:
|
|
461
|
-
onRetry: () => void
|
|
486
|
+
message: It(H) ?? Tt(H, "this query"),
|
|
487
|
+
onRetry: () => void pe()
|
|
462
488
|
}
|
|
463
489
|
);
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
const
|
|
490
|
+
const X = oa(t, O ?? []);
|
|
491
|
+
if (X.length === 0) return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
492
|
+
const de = t.columns && t.columns.length > 0 ? t.columns : Object.keys(X[0] ?? {}).map((S) => ({ field: S }));
|
|
467
493
|
if (t.display === "kpis") {
|
|
468
|
-
const
|
|
469
|
-
var
|
|
494
|
+
const S = t.x_field ? X.map((T, P) => {
|
|
495
|
+
var Y, ne, ce, fe, _;
|
|
470
496
|
return {
|
|
471
|
-
label: String(
|
|
472
|
-
value:
|
|
473
|
-
color: ((
|
|
497
|
+
label: String(T[t.x_field] ?? ""),
|
|
498
|
+
value: T[((ne = (Y = t.series) == null ? void 0 : Y[0]) == null ? void 0 : ne.field) ?? ((ce = de.find((D) => D.field !== t.x_field)) == null ? void 0 : ce.field) ?? ""],
|
|
499
|
+
color: ((_ = (fe = t.series) == null ? void 0 : fe[0]) == null ? void 0 : _.color) ?? oe[P % oe.length],
|
|
474
500
|
format: t.value_format
|
|
475
501
|
};
|
|
476
|
-
}) :
|
|
477
|
-
var
|
|
502
|
+
}) : de.map((T, P) => {
|
|
503
|
+
var Y;
|
|
478
504
|
return {
|
|
479
|
-
label:
|
|
480
|
-
value: (
|
|
481
|
-
color:
|
|
482
|
-
format:
|
|
505
|
+
label: T.label ?? T.field,
|
|
506
|
+
value: (Y = X[0]) == null ? void 0 : Y[T.field],
|
|
507
|
+
color: oe[P % oe.length],
|
|
508
|
+
format: T.format ?? t.value_format
|
|
483
509
|
};
|
|
484
510
|
});
|
|
485
511
|
return /* @__PURE__ */ e(
|
|
486
512
|
"div",
|
|
487
513
|
{
|
|
488
514
|
className: "grid gap-2",
|
|
489
|
-
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1,
|
|
490
|
-
children:
|
|
515
|
+
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1, S.length))}, 1fr)` },
|
|
516
|
+
children: S.map((T) => /* @__PURE__ */ i(
|
|
491
517
|
"div",
|
|
492
518
|
{
|
|
493
519
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
494
|
-
style: { borderTopColor:
|
|
520
|
+
style: { borderTopColor: T.color, borderTopWidth: 2 },
|
|
495
521
|
children: [
|
|
496
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children:
|
|
497
|
-
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children:
|
|
522
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: T.label }),
|
|
523
|
+
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: je(T.value, T.format ?? "integer") })
|
|
498
524
|
]
|
|
499
525
|
},
|
|
500
|
-
|
|
526
|
+
T.label
|
|
501
527
|
))
|
|
502
528
|
}
|
|
503
529
|
);
|
|
504
530
|
}
|
|
505
531
|
if (t.display === "tree")
|
|
506
|
-
return /* @__PURE__ */ e(
|
|
532
|
+
return /* @__PURE__ */ e(nl, { rows: X, cfg: t, onDrill: (S) => m == null ? void 0 : m(S) });
|
|
507
533
|
if (t.display === "table") {
|
|
508
|
-
const
|
|
509
|
-
(
|
|
510
|
-
(
|
|
534
|
+
const S = de.filter((_) => ze.has(_.format ?? "")), T = L.trim().toLowerCase(), P = T ? X.filter(
|
|
535
|
+
(_) => Object.values(_).some(
|
|
536
|
+
(D) => String(D ?? "").toLowerCase().includes(T)
|
|
511
537
|
)
|
|
512
|
-
) :
|
|
538
|
+
) : X, Y = 12, ne = Math.max(1, Math.ceil(P.length / Y)), ce = Math.min(w, ne - 1), fe = P.length > Y ? P.slice(ce * Y, ce * Y + Y) : P;
|
|
513
539
|
return /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
514
|
-
|
|
540
|
+
X.length > Y && /* @__PURE__ */ i("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
515
541
|
/* @__PURE__ */ e(
|
|
516
542
|
"input",
|
|
517
543
|
{
|
|
518
|
-
value:
|
|
519
|
-
onChange: (
|
|
520
|
-
|
|
544
|
+
value: L,
|
|
545
|
+
onChange: (_) => {
|
|
546
|
+
q(_.target.value), E(0);
|
|
521
547
|
},
|
|
522
548
|
placeholder: "Search rows…",
|
|
523
549
|
className: "h-6 w-40 rounded border border-slate-200 bg-white px-1.5 text-[11px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
524
550
|
}
|
|
525
551
|
),
|
|
526
|
-
|
|
552
|
+
ne > 1 && /* @__PURE__ */ i("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
527
553
|
/* @__PURE__ */ e(
|
|
528
554
|
"button",
|
|
529
555
|
{
|
|
530
556
|
type: "button",
|
|
531
|
-
disabled:
|
|
532
|
-
onClick: () =>
|
|
557
|
+
disabled: ce <= 0,
|
|
558
|
+
onClick: () => E(ce - 1),
|
|
533
559
|
className: "rounded px-1 disabled:opacity-30",
|
|
534
560
|
children: "←"
|
|
535
561
|
}
|
|
536
562
|
),
|
|
537
|
-
|
|
563
|
+
ce + 1,
|
|
538
564
|
"/",
|
|
539
|
-
|
|
565
|
+
ne,
|
|
540
566
|
/* @__PURE__ */ e(
|
|
541
567
|
"button",
|
|
542
568
|
{
|
|
543
569
|
type: "button",
|
|
544
|
-
disabled:
|
|
545
|
-
onClick: () =>
|
|
570
|
+
disabled: ce >= ne - 1,
|
|
571
|
+
onClick: () => E(ce + 1),
|
|
546
572
|
className: "rounded px-1 disabled:opacity-30",
|
|
547
573
|
children: "→"
|
|
548
574
|
}
|
|
@@ -550,119 +576,119 @@ function sl({
|
|
|
550
576
|
] })
|
|
551
577
|
] }),
|
|
552
578
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full text-[11.5px]", children: [
|
|
553
|
-
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children:
|
|
579
|
+
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: de.map((_) => /* @__PURE__ */ e(
|
|
554
580
|
"th",
|
|
555
581
|
{
|
|
556
|
-
className:
|
|
582
|
+
className: j(
|
|
557
583
|
"whitespace-nowrap border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
558
|
-
|
|
584
|
+
ze.has(_.format ?? "") && "text-right"
|
|
559
585
|
),
|
|
560
|
-
children:
|
|
586
|
+
children: _.label ?? _.field
|
|
561
587
|
},
|
|
562
|
-
|
|
588
|
+
_.field
|
|
563
589
|
)) }) }),
|
|
564
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
590
|
+
/* @__PURE__ */ e("tbody", { children: fe.map((_, D) => /* @__PURE__ */ e(
|
|
565
591
|
"tr",
|
|
566
592
|
{
|
|
567
|
-
className:
|
|
568
|
-
onClick: () => void
|
|
569
|
-
title:
|
|
570
|
-
children:
|
|
593
|
+
className: m ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60" : void 0,
|
|
594
|
+
onClick: () => void p(_),
|
|
595
|
+
title: m ? "Open the record behind this row" : void 0,
|
|
596
|
+
children: de.map((me) => /* @__PURE__ */ e(
|
|
571
597
|
"td",
|
|
572
598
|
{
|
|
573
|
-
className:
|
|
599
|
+
className: j(
|
|
574
600
|
"max-w-[220px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
|
|
575
|
-
|
|
601
|
+
ze.has(me.format ?? "") && "text-right tabular-nums"
|
|
576
602
|
),
|
|
577
|
-
children:
|
|
603
|
+
children: je(_[me.field], me.format, me.decimals)
|
|
578
604
|
},
|
|
579
|
-
|
|
605
|
+
me.field
|
|
580
606
|
))
|
|
581
607
|
},
|
|
582
|
-
|
|
608
|
+
D
|
|
583
609
|
)) }),
|
|
584
|
-
t.totals &&
|
|
610
|
+
t.totals && S.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: de.map((_, D) => /* @__PURE__ */ e(
|
|
585
611
|
"td",
|
|
586
612
|
{
|
|
587
|
-
className:
|
|
613
|
+
className: j(
|
|
588
614
|
"border-t border-slate-200 px-1.5 py-1 font-semibold text-slate-800 dark:border-border dark:text-slate-200",
|
|
589
|
-
|
|
615
|
+
ze.has(_.format ?? "") && "text-right tabular-nums"
|
|
590
616
|
),
|
|
591
|
-
children:
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
617
|
+
children: D === 0 && !ze.has(_.format ?? "") ? "Total" : ze.has(_.format ?? "") ? je(
|
|
618
|
+
X.reduce((me, ve) => me + (Number(ve[_.field]) || 0), 0),
|
|
619
|
+
_.format,
|
|
620
|
+
_.decimals
|
|
595
621
|
) : ""
|
|
596
622
|
},
|
|
597
|
-
|
|
623
|
+
_.field
|
|
598
624
|
)) }) })
|
|
599
625
|
] }) })
|
|
600
626
|
] });
|
|
601
627
|
}
|
|
602
|
-
const
|
|
603
|
-
var
|
|
604
|
-
return
|
|
605
|
-
}).slice(0, 3).map((
|
|
606
|
-
const
|
|
607
|
-
for (const
|
|
608
|
-
return
|
|
609
|
-
}),
|
|
610
|
-
if (!
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
},
|
|
628
|
+
const xe = t.x_field ?? ((le = de[0]) == null ? void 0 : le.field) ?? "", be = t.series && t.series.length > 0 ? t.series : de.filter((S) => {
|
|
629
|
+
var T;
|
|
630
|
+
return S.field !== xe && typeof ((T = X[0]) == null ? void 0 : T[S.field]) == "number";
|
|
631
|
+
}).slice(0, 3).map((S) => ({ field: S.field, label: S.label ?? S.field })), ge = X.map((S) => {
|
|
632
|
+
const T = { [xe]: S[xe] };
|
|
633
|
+
for (const P of be) T[P.field] = Number(S[P.field]) || 0;
|
|
634
|
+
return T;
|
|
635
|
+
}), $e = (S) => t.value_format === "currency" ? `$${Ce(S)}` : Ce(S), x = (S) => je(S, t.value_format ?? "number"), Z = t.display === "hbar" || t.display === "stacked_bar" && t.horizontal, te = (S) => {
|
|
636
|
+
if (!m) return;
|
|
637
|
+
const T = (O ?? []).filter((P) => String(P[xe] ?? "") === S);
|
|
638
|
+
T.length > 0 && N({ label: S, rows: T });
|
|
639
|
+
}, V = u ? /* @__PURE__ */ e(
|
|
614
640
|
"div",
|
|
615
641
|
{
|
|
616
642
|
className: "fixed inset-0 z-[126] flex items-center justify-center bg-black/30 p-6",
|
|
617
|
-
onClick: () =>
|
|
643
|
+
onClick: () => N(null),
|
|
618
644
|
children: /* @__PURE__ */ i(
|
|
619
645
|
"div",
|
|
620
646
|
{
|
|
621
647
|
className: "flex max-h-[70vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-card",
|
|
622
|
-
onClick: (
|
|
648
|
+
onClick: (S) => S.stopPropagation(),
|
|
623
649
|
children: [
|
|
624
650
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border", children: [
|
|
625
|
-
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children:
|
|
651
|
+
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: u.label }),
|
|
626
652
|
/* @__PURE__ */ i("span", { className: "text-[11.5px] text-slate-400", children: [
|
|
627
|
-
|
|
653
|
+
u.rows.length,
|
|
628
654
|
" rows — click one to open its record"
|
|
629
655
|
] }),
|
|
630
656
|
/* @__PURE__ */ e(
|
|
631
657
|
"button",
|
|
632
658
|
{
|
|
633
659
|
type: "button",
|
|
634
|
-
onClick: () =>
|
|
660
|
+
onClick: () => N(null),
|
|
635
661
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
636
662
|
children: /* @__PURE__ */ e(Ae, { className: "h-4 w-4" })
|
|
637
663
|
}
|
|
638
664
|
)
|
|
639
665
|
] }),
|
|
640
666
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto p-2", children: /* @__PURE__ */ i("table", { className: "w-full text-[11px]", children: [
|
|
641
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: Object.keys(
|
|
667
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: Object.keys(u.rows[0] ?? {}).slice(0, 7).map((S) => /* @__PURE__ */ e(
|
|
642
668
|
"th",
|
|
643
669
|
{
|
|
644
670
|
className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
645
|
-
children:
|
|
671
|
+
children: S
|
|
646
672
|
},
|
|
647
|
-
|
|
673
|
+
S
|
|
648
674
|
)) }) }),
|
|
649
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
675
|
+
/* @__PURE__ */ e("tbody", { children: u.rows.slice(0, 100).map((S, T) => /* @__PURE__ */ e(
|
|
650
676
|
"tr",
|
|
651
677
|
{
|
|
652
678
|
className: "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60",
|
|
653
679
|
onClick: () => {
|
|
654
|
-
|
|
680
|
+
N(null), p(S);
|
|
655
681
|
},
|
|
656
|
-
children: Object.keys(
|
|
682
|
+
children: Object.keys(u.rows[0] ?? {}).slice(0, 7).map((P) => /* @__PURE__ */ e(
|
|
657
683
|
"td",
|
|
658
684
|
{
|
|
659
685
|
className: "max-w-[160px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-600 dark:border-border/40 dark:text-slate-300",
|
|
660
|
-
children: String(
|
|
686
|
+
children: String(S[P] ?? "")
|
|
661
687
|
},
|
|
662
|
-
|
|
688
|
+
P
|
|
663
689
|
))
|
|
664
690
|
},
|
|
665
|
-
|
|
691
|
+
T
|
|
666
692
|
)) })
|
|
667
693
|
] }) })
|
|
668
694
|
]
|
|
@@ -671,31 +697,31 @@ function sl({
|
|
|
671
697
|
}
|
|
672
698
|
) : null;
|
|
673
699
|
if (t.display === "donut") {
|
|
674
|
-
const
|
|
700
|
+
const S = ((ae = be[0]) == null ? void 0 : ae.field) ?? "", T = ge.map((Y) => ({ dim: String(Y[xe]), value: Number(Y[S]) || 0 })), P = T.reduce((Y, ne) => Y + ne.value, 0);
|
|
675
701
|
return /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
676
702
|
/* @__PURE__ */ i("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
677
|
-
/* @__PURE__ */ e(
|
|
703
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: Y, Pie: ne, PieChart: ce, ResponsiveContainer: fe, Tooltip: _ }) => /* @__PURE__ */ e(fe, { width: "100%", height: "100%", children: /* @__PURE__ */ i(ce, { children: [
|
|
678
704
|
/* @__PURE__ */ e(
|
|
679
|
-
|
|
705
|
+
ne,
|
|
680
706
|
{
|
|
681
|
-
data:
|
|
707
|
+
data: T,
|
|
682
708
|
dataKey: "value",
|
|
683
709
|
nameKey: "dim",
|
|
684
710
|
innerRadius: "58%",
|
|
685
711
|
outerRadius: "88%",
|
|
686
712
|
paddingAngle: 2,
|
|
687
713
|
strokeWidth: 0,
|
|
688
|
-
className:
|
|
689
|
-
onClick: (
|
|
690
|
-
var
|
|
691
|
-
const
|
|
692
|
-
|
|
714
|
+
className: m ? "cursor-pointer" : void 0,
|
|
715
|
+
onClick: (D) => {
|
|
716
|
+
var ve;
|
|
717
|
+
const me = (ve = D == null ? void 0 : D.payload) == null ? void 0 : ve.dim;
|
|
718
|
+
me && te(String(me));
|
|
693
719
|
},
|
|
694
|
-
children:
|
|
720
|
+
children: T.map((D, me) => /* @__PURE__ */ e(Y, { fill: oe[me % oe.length] }, D.dim))
|
|
695
721
|
}
|
|
696
722
|
),
|
|
697
723
|
/* @__PURE__ */ e(
|
|
698
|
-
|
|
724
|
+
_,
|
|
699
725
|
{
|
|
700
726
|
contentStyle: {
|
|
701
727
|
fontSize: 12,
|
|
@@ -706,44 +732,44 @@ function sl({
|
|
|
706
732
|
},
|
|
707
733
|
labelStyle: { color: "#f1f5f9" },
|
|
708
734
|
itemStyle: { color: "#e2e8f0" },
|
|
709
|
-
formatter: (
|
|
735
|
+
formatter: (D) => x(D)
|
|
710
736
|
}
|
|
711
737
|
)
|
|
712
738
|
] }) }) }),
|
|
713
739
|
/* @__PURE__ */ i("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
714
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children:
|
|
740
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: je(P, t.value_format ?? "integer") }),
|
|
715
741
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
716
742
|
] })
|
|
717
743
|
] }),
|
|
718
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children:
|
|
744
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: T.slice(0, 12).map((Y, ne) => /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
719
745
|
/* @__PURE__ */ e(
|
|
720
746
|
"span",
|
|
721
747
|
{
|
|
722
748
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
723
|
-
style: { background:
|
|
749
|
+
style: { background: oe[ne % oe.length] }
|
|
724
750
|
}
|
|
725
751
|
),
|
|
726
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
727
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children:
|
|
728
|
-
] },
|
|
729
|
-
|
|
752
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: Y.dim }),
|
|
753
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: x(Y.value) })
|
|
754
|
+
] }, Y.dim)) }),
|
|
755
|
+
V
|
|
730
756
|
] });
|
|
731
757
|
}
|
|
732
758
|
if (t.display === "line" || t.display === "area")
|
|
733
759
|
return /* @__PURE__ */ i("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
734
|
-
/* @__PURE__ */ e(
|
|
760
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Area: S, AreaChart: T, Legend: P, ResponsiveContainer: Y, Tooltip: ne, XAxis: ce, YAxis: fe }) => /* @__PURE__ */ e(Y, { width: "100%", height: "100%", children: /* @__PURE__ */ i(T, { data: ge, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
735
761
|
/* @__PURE__ */ e(
|
|
736
|
-
|
|
762
|
+
ce,
|
|
737
763
|
{
|
|
738
|
-
dataKey:
|
|
764
|
+
dataKey: xe,
|
|
739
765
|
tick: { fontSize: 10 },
|
|
740
766
|
stroke: "#94a3b8",
|
|
741
|
-
..._t(
|
|
767
|
+
..._t(ge.length)
|
|
742
768
|
}
|
|
743
769
|
),
|
|
744
|
-
/* @__PURE__ */ e(
|
|
770
|
+
/* @__PURE__ */ e(fe, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: $e, width: 48 }),
|
|
745
771
|
/* @__PURE__ */ e(
|
|
746
|
-
|
|
772
|
+
ne,
|
|
747
773
|
{
|
|
748
774
|
contentStyle: {
|
|
749
775
|
fontSize: 12,
|
|
@@ -754,70 +780,70 @@ function sl({
|
|
|
754
780
|
},
|
|
755
781
|
labelStyle: { color: "#f1f5f9" },
|
|
756
782
|
itemStyle: { color: "#e2e8f0" },
|
|
757
|
-
formatter: (
|
|
783
|
+
formatter: (_) => x(_)
|
|
758
784
|
}
|
|
759
785
|
),
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
786
|
+
be.length > 1 && /* @__PURE__ */ e(P, { wrapperStyle: { fontSize: 11 } }),
|
|
787
|
+
be.map((_, D) => /* @__PURE__ */ e(
|
|
788
|
+
S,
|
|
763
789
|
{
|
|
764
790
|
type: "monotone",
|
|
765
|
-
dataKey:
|
|
766
|
-
name:
|
|
767
|
-
stroke:
|
|
791
|
+
dataKey: _.field,
|
|
792
|
+
name: _.label ?? _.field,
|
|
793
|
+
stroke: _.color ?? oe[D % oe.length],
|
|
768
794
|
strokeWidth: 2,
|
|
769
|
-
strokeDasharray:
|
|
770
|
-
fill:
|
|
771
|
-
fillOpacity: t.display === "area" && !
|
|
795
|
+
strokeDasharray: _.dash ? "4 3" : void 0,
|
|
796
|
+
fill: _.color ?? oe[D % oe.length],
|
|
797
|
+
fillOpacity: t.display === "area" && !_.dash ? 0.12 : 0
|
|
772
798
|
},
|
|
773
|
-
|
|
799
|
+
_.field
|
|
774
800
|
))
|
|
775
801
|
] }) }) }),
|
|
776
|
-
|
|
802
|
+
V
|
|
777
803
|
] });
|
|
778
|
-
const
|
|
804
|
+
const he = t.display === "stacked_bar";
|
|
779
805
|
return /* @__PURE__ */ i("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
780
|
-
/* @__PURE__ */ e(
|
|
781
|
-
|
|
806
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: S, BarChart: T, Cell: P, Legend: Y, ResponsiveContainer: ne, Tooltip: ce, XAxis: fe, YAxis: _ }) => /* @__PURE__ */ e(ne, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
807
|
+
T,
|
|
782
808
|
{
|
|
783
|
-
data:
|
|
784
|
-
layout:
|
|
785
|
-
margin: { top: 6, right: 8, left:
|
|
809
|
+
data: ge,
|
|
810
|
+
layout: Z ? "vertical" : "horizontal",
|
|
811
|
+
margin: { top: 6, right: 8, left: Z ? 30 : -6, bottom: 0 },
|
|
786
812
|
children: [
|
|
787
|
-
|
|
813
|
+
Z ? /* @__PURE__ */ i(He, { children: [
|
|
788
814
|
/* @__PURE__ */ e(
|
|
789
|
-
|
|
815
|
+
fe,
|
|
790
816
|
{
|
|
791
817
|
type: "number",
|
|
792
818
|
tick: { fontSize: 10 },
|
|
793
819
|
stroke: "#94a3b8",
|
|
794
|
-
tickFormatter:
|
|
820
|
+
tickFormatter: $e
|
|
795
821
|
}
|
|
796
822
|
),
|
|
797
823
|
/* @__PURE__ */ e(
|
|
798
|
-
|
|
824
|
+
_,
|
|
799
825
|
{
|
|
800
826
|
type: "category",
|
|
801
|
-
dataKey:
|
|
827
|
+
dataKey: xe,
|
|
802
828
|
tick: { fontSize: 10 },
|
|
803
829
|
stroke: "#94a3b8",
|
|
804
830
|
width: 120
|
|
805
831
|
}
|
|
806
832
|
)
|
|
807
|
-
] }) : /* @__PURE__ */ i(
|
|
833
|
+
] }) : /* @__PURE__ */ i(He, { children: [
|
|
808
834
|
/* @__PURE__ */ e(
|
|
809
|
-
|
|
835
|
+
fe,
|
|
810
836
|
{
|
|
811
|
-
dataKey:
|
|
837
|
+
dataKey: xe,
|
|
812
838
|
tick: { fontSize: 10 },
|
|
813
839
|
stroke: "#94a3b8",
|
|
814
|
-
..._t(
|
|
840
|
+
..._t(ge.length)
|
|
815
841
|
}
|
|
816
842
|
),
|
|
817
|
-
/* @__PURE__ */ e(
|
|
843
|
+
/* @__PURE__ */ e(_, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: $e, width: 48 })
|
|
818
844
|
] }),
|
|
819
845
|
/* @__PURE__ */ e(
|
|
820
|
-
|
|
846
|
+
ce,
|
|
821
847
|
{
|
|
822
848
|
contentStyle: {
|
|
823
849
|
fontSize: 12,
|
|
@@ -828,38 +854,38 @@ function sl({
|
|
|
828
854
|
},
|
|
829
855
|
labelStyle: { color: "#f1f5f9" },
|
|
830
856
|
itemStyle: { color: "#e2e8f0" },
|
|
831
|
-
formatter: (
|
|
857
|
+
formatter: (D) => x(D)
|
|
832
858
|
}
|
|
833
859
|
),
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
860
|
+
be.length > 1 && /* @__PURE__ */ e(Y, { wrapperStyle: { fontSize: 11 } }),
|
|
861
|
+
be.map((D, me) => /* @__PURE__ */ e(
|
|
862
|
+
S,
|
|
837
863
|
{
|
|
838
|
-
className:
|
|
839
|
-
onClick: (
|
|
864
|
+
className: m ? "cursor-pointer" : void 0,
|
|
865
|
+
onClick: (ve) => {
|
|
840
866
|
var Te;
|
|
841
|
-
const
|
|
842
|
-
|
|
867
|
+
const we = (Te = ve == null ? void 0 : ve.payload) == null ? void 0 : Te[xe];
|
|
868
|
+
we != null && te(String(we));
|
|
843
869
|
},
|
|
844
|
-
dataKey:
|
|
845
|
-
name:
|
|
846
|
-
stackId:
|
|
847
|
-
fill:
|
|
848
|
-
radius:
|
|
849
|
-
children:
|
|
870
|
+
dataKey: D.field,
|
|
871
|
+
name: D.label ?? D.field,
|
|
872
|
+
stackId: he ? "stack" : void 0,
|
|
873
|
+
fill: D.color ?? oe[me % oe.length],
|
|
874
|
+
radius: he ? 0 : Z ? [0, 3, 3, 0] : [3, 3, 0, 0],
|
|
875
|
+
children: be.length === 1 && !D.color && ge.map((ve, we) => /* @__PURE__ */ e(P, { fill: oe[we % oe.length] }, we))
|
|
850
876
|
},
|
|
851
|
-
|
|
877
|
+
D.field
|
|
852
878
|
))
|
|
853
879
|
]
|
|
854
880
|
}
|
|
855
881
|
) }) }),
|
|
856
|
-
|
|
882
|
+
V
|
|
857
883
|
] });
|
|
858
884
|
}
|
|
859
|
-
const
|
|
860
|
-
function
|
|
861
|
-
var o,
|
|
862
|
-
const
|
|
885
|
+
const dl = ["gt", "gte", "lt", "lte", "eq"], ca = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }, cl = ["sum", "avg", "max", "min"];
|
|
886
|
+
function ml(t) {
|
|
887
|
+
var o, c, m;
|
|
888
|
+
const n = [
|
|
863
889
|
{ value: "value", label: "Value (widget metric)" },
|
|
864
890
|
{ value: "row_count", label: "Row count" }
|
|
865
891
|
], a = (o = t.config) == null ? void 0 : o.query;
|
|
@@ -869,49 +895,49 @@ function dl(t) {
|
|
|
869
895
|
label: f.label ?? f.field,
|
|
870
896
|
aggregatable: !0
|
|
871
897
|
}));
|
|
872
|
-
return [...
|
|
898
|
+
return [...n, ...h];
|
|
873
899
|
}
|
|
874
900
|
if (t.type === "kpi_group")
|
|
875
901
|
return [
|
|
876
|
-
...
|
|
877
|
-
...(((
|
|
902
|
+
...n,
|
|
903
|
+
...(((c = t.config) == null ? void 0 : c.metrics) ?? []).map((h) => ({
|
|
878
904
|
value: `tile:${h.label}`,
|
|
879
905
|
label: `Tile: ${h.label}`
|
|
880
906
|
}))
|
|
881
907
|
];
|
|
882
908
|
if (t.type === "table") {
|
|
883
|
-
const h = (((
|
|
884
|
-
return [...
|
|
909
|
+
const h = (((m = t.config) == null ? void 0 : m.columns) ?? []).map((f) => typeof f == "string" ? { field: f } : f).map((f) => ({ value: f.field, label: f.label ?? f.field, aggregatable: !0 }));
|
|
910
|
+
return [...n, ...h];
|
|
885
911
|
}
|
|
886
|
-
return
|
|
912
|
+
return n;
|
|
887
913
|
}
|
|
888
|
-
function
|
|
914
|
+
function jt(t, n) {
|
|
889
915
|
var h;
|
|
890
|
-
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), o = a ? a[2] : t.field,
|
|
891
|
-
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${
|
|
916
|
+
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), o = a ? a[2] : t.field, c = ((h = n.find((f) => f.value === t.field || f.value === o)) == null ? void 0 : h.label) ?? o;
|
|
917
|
+
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${ca[t.op] ?? t.op} ${t.value.toLocaleString()}`;
|
|
892
918
|
}
|
|
893
|
-
function
|
|
894
|
-
const a = Ke(), o = Ct(), { data:
|
|
895
|
-
queryKey: ["nivaro-report-alert-log", t,
|
|
896
|
-
queryFn: () => a.request(
|
|
919
|
+
function ul({ reportId: t, alert: n }) {
|
|
920
|
+
const a = Ke(), o = Ct(), { data: c = [] } = Ne({
|
|
921
|
+
queryKey: ["nivaro-report-alert-log", t, n.id],
|
|
922
|
+
queryFn: () => a.request(wa(t, n.id)).then((h) => h.data),
|
|
897
923
|
staleTime: 3e4
|
|
898
|
-
}),
|
|
899
|
-
mutationFn: () => a.request(
|
|
924
|
+
}), m = Me({
|
|
925
|
+
mutationFn: () => a.request(Sa(t, n.id)),
|
|
900
926
|
onSuccess: () => {
|
|
901
|
-
o.invalidateQueries({ queryKey: ["nivaro-report-alert-log", t,
|
|
927
|
+
o.invalidateQueries({ queryKey: ["nivaro-report-alert-log", t, n.id] }), o.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] });
|
|
902
928
|
}
|
|
903
929
|
});
|
|
904
|
-
return
|
|
930
|
+
return c.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 py-1 text-[10.5px] text-slate-400", children: "Never fired." }) : /* @__PURE__ */ e("div", { className: "max-h-36 space-y-1 overflow-y-auto py-1", children: c.slice(0, 20).map((h) => /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
905
931
|
/* @__PURE__ */ e(
|
|
906
932
|
"span",
|
|
907
933
|
{
|
|
908
|
-
className:
|
|
934
|
+
className: j(
|
|
909
935
|
"h-1.5 w-1.5 shrink-0 rounded-full",
|
|
910
936
|
h.status === "firing" ? "bg-amber-500" : "bg-emerald-500"
|
|
911
937
|
)
|
|
912
938
|
}
|
|
913
939
|
),
|
|
914
|
-
/* @__PURE__ */ e("span", { className:
|
|
940
|
+
/* @__PURE__ */ e("span", { className: j(h.status === "firing" ? "text-amber-600" : "text-slate-500"), children: h.status === "firing" ? "Firing" : "Resolved" }),
|
|
915
941
|
/* @__PURE__ */ i("span", { className: "min-w-0 flex-1 truncate text-slate-400", children: [
|
|
916
942
|
new Date(h.fired_at).toLocaleString(),
|
|
917
943
|
h.resolved_at ? ` → ${new Date(h.resolved_at).toLocaleString()}` : ""
|
|
@@ -921,70 +947,70 @@ function cl({ reportId: t, alert: s }) {
|
|
|
921
947
|
{
|
|
922
948
|
type: "button",
|
|
923
949
|
className: "shrink-0 text-[10px] text-slate-400 underline hover:text-emerald-600",
|
|
924
|
-
onClick: () =>
|
|
950
|
+
onClick: () => m.mutate(),
|
|
925
951
|
children: "Mark resolved"
|
|
926
952
|
}
|
|
927
953
|
)
|
|
928
954
|
] }, h.id)) });
|
|
929
955
|
}
|
|
930
|
-
function
|
|
956
|
+
function pl({
|
|
931
957
|
reportId: t,
|
|
932
|
-
widget:
|
|
958
|
+
widget: n,
|
|
933
959
|
filterBar: a
|
|
934
960
|
}) {
|
|
935
|
-
const o = Ke(),
|
|
961
|
+
const o = Ke(), c = Ct(), [m, h] = C(!1), [f, p] = C(""), [L, q] = C([
|
|
936
962
|
{ field: "value", agg: "sum", op: "gt", value: "" }
|
|
937
|
-
]), [w,
|
|
963
|
+
]), [w, E] = C([]), [u, N] = C(!1), [U, O] = C(null), ee = ml(n), { data: H = [] } = Ne({
|
|
938
964
|
queryKey: ["nivaro-report-alerts", t],
|
|
939
|
-
queryFn: () => o.request(
|
|
940
|
-
enabled:
|
|
965
|
+
queryFn: () => o.request(va(t)).then((x) => x.data),
|
|
966
|
+
enabled: m,
|
|
941
967
|
staleTime: 3e4
|
|
942
|
-
}),
|
|
943
|
-
const
|
|
944
|
-
return { field:
|
|
945
|
-
}),
|
|
968
|
+
}), ue = H.filter((x) => x.widget === n.id), pe = () => void c.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] }), X = () => L.filter((x) => x.value.trim() !== "" && !Number.isNaN(Number(x.value))).map((x) => {
|
|
969
|
+
const Z = ee.find((V) => V.value === x.field);
|
|
970
|
+
return { field: Z != null && Z.aggregatable && x.agg !== "sum" ? `${x.agg}:${x.field}` : x.field, op: x.op, value: Number(x.value) };
|
|
971
|
+
}), de = Me({
|
|
946
972
|
mutationFn: () => {
|
|
947
|
-
const x =
|
|
973
|
+
const x = X(), Z = x.map((te) => jt(te, ee)).join(" & ");
|
|
948
974
|
return o.request(
|
|
949
|
-
|
|
950
|
-
widget:
|
|
951
|
-
name: f.trim() ||
|
|
975
|
+
ya(t, {
|
|
976
|
+
widget: n.id,
|
|
977
|
+
name: f.trim() || Z.slice(0, 120),
|
|
952
978
|
conditions: x,
|
|
953
|
-
filters: w.filter((
|
|
954
|
-
delivery_email:
|
|
979
|
+
filters: w.filter((te) => te.values.length > 0),
|
|
980
|
+
delivery_email: u,
|
|
955
981
|
delivery_inapp: !0
|
|
956
982
|
})
|
|
957
983
|
);
|
|
958
984
|
},
|
|
959
985
|
onSuccess: () => {
|
|
960
|
-
p(""),
|
|
986
|
+
p(""), q([{ field: "value", agg: "sum", op: "gt", value: "" }]), E([]), pe();
|
|
961
987
|
}
|
|
962
|
-
}),
|
|
963
|
-
mutationFn: (x) => o.request(
|
|
964
|
-
onSuccess:
|
|
988
|
+
}), xe = Me({
|
|
989
|
+
mutationFn: (x) => o.request(ka(t, x.id, !x.is_active)),
|
|
990
|
+
onSuccess: pe
|
|
965
991
|
}), be = Me({
|
|
966
|
-
mutationFn: (x) => o.request(
|
|
967
|
-
onSuccess:
|
|
968
|
-
}),
|
|
969
|
-
return /* @__PURE__ */ i(
|
|
970
|
-
/* @__PURE__ */ e(
|
|
992
|
+
mutationFn: (x) => o.request(Na(t, x.id)),
|
|
993
|
+
onSuccess: pe
|
|
994
|
+
}), ge = X().length > 0, $e = ue.some((x) => x.firing);
|
|
995
|
+
return /* @__PURE__ */ i(aa, { open: m, onOpenChange: h, children: [
|
|
996
|
+
/* @__PURE__ */ e(la, { asChild: !0, children: /* @__PURE__ */ e(
|
|
971
997
|
"button",
|
|
972
998
|
{
|
|
973
999
|
type: "button",
|
|
974
1000
|
title: "Alerts on this widget",
|
|
975
|
-
className:
|
|
1001
|
+
className: j(
|
|
976
1002
|
"rounded p-0.5",
|
|
977
|
-
|
|
1003
|
+
$e ? "text-amber-500" : "text-slate-300 hover:text-amber-500 dark:text-slate-600"
|
|
978
1004
|
),
|
|
979
1005
|
children: /* @__PURE__ */ e(Yt, { className: "h-3 w-3" })
|
|
980
1006
|
}
|
|
981
1007
|
) }),
|
|
982
|
-
/* @__PURE__ */ i(
|
|
1008
|
+
/* @__PURE__ */ i(ra, { className: "w-[380px] p-3", align: "end", children: [
|
|
983
1009
|
/* @__PURE__ */ i("p", { className: "mb-2 text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
984
1010
|
"Alerts · ",
|
|
985
|
-
|
|
1011
|
+
n.title
|
|
986
1012
|
] }),
|
|
987
|
-
|
|
1013
|
+
ue.length > 0 && /* @__PURE__ */ e("div", { className: "mb-2 space-y-1.5", children: ue.map((x) => /* @__PURE__ */ i(
|
|
988
1014
|
"div",
|
|
989
1015
|
{
|
|
990
1016
|
className: "rounded-md border border-slate-100 px-2 py-1.5 dark:border-border/60",
|
|
@@ -993,7 +1019,7 @@ function ml({
|
|
|
993
1019
|
/* @__PURE__ */ e(
|
|
994
1020
|
"span",
|
|
995
1021
|
{
|
|
996
|
-
className:
|
|
1022
|
+
className: j(
|
|
997
1023
|
"h-1.5 w-1.5 shrink-0 rounded-full",
|
|
998
1024
|
x.firing ? "bg-amber-500" : x.is_active ? "bg-emerald-500" : "bg-slate-300"
|
|
999
1025
|
)
|
|
@@ -1005,7 +1031,7 @@ function ml({
|
|
|
1005
1031
|
{
|
|
1006
1032
|
type: "button",
|
|
1007
1033
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1008
|
-
onClick: () => O(
|
|
1034
|
+
onClick: () => O(U === x.id ? null : x.id),
|
|
1009
1035
|
children: "History"
|
|
1010
1036
|
}
|
|
1011
1037
|
),
|
|
@@ -1014,7 +1040,7 @@ function ml({
|
|
|
1014
1040
|
{
|
|
1015
1041
|
type: "button",
|
|
1016
1042
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1017
|
-
onClick: () =>
|
|
1043
|
+
onClick: () => xe.mutate(x),
|
|
1018
1044
|
children: x.is_active ? "Pause" : "Resume"
|
|
1019
1045
|
}
|
|
1020
1046
|
),
|
|
@@ -1024,19 +1050,19 @@ function ml({
|
|
|
1024
1050
|
type: "button",
|
|
1025
1051
|
className: "text-slate-300 hover:text-red-500",
|
|
1026
1052
|
onClick: () => be.mutate(x),
|
|
1027
|
-
children: /* @__PURE__ */ e(
|
|
1053
|
+
children: /* @__PURE__ */ e(Aa, { className: "h-3 w-3" })
|
|
1028
1054
|
}
|
|
1029
1055
|
)
|
|
1030
1056
|
] }),
|
|
1031
1057
|
/* @__PURE__ */ i("p", { className: "mt-0.5 truncate pl-3 text-[10.5px] text-slate-400", children: [
|
|
1032
|
-
(x.conditions ?? []).map((
|
|
1033
|
-
x.filters && x.filters.length > 0 && ` · scoped: ${x.filters.map((
|
|
1058
|
+
(x.conditions ?? []).map((Z) => jt(Z, ee)).join(" & "),
|
|
1059
|
+
x.filters && x.filters.length > 0 && ` · scoped: ${x.filters.map((Z) => (Z.labels ?? Z.values).join("/")).join(", ")}`,
|
|
1034
1060
|
" · ",
|
|
1035
1061
|
x.delivery_email ? "In-app + Email" : "In-app",
|
|
1036
1062
|
" · Last fired: ",
|
|
1037
1063
|
x.last_fired ? new Date(x.last_fired).toLocaleString() : "Never"
|
|
1038
1064
|
] }),
|
|
1039
|
-
|
|
1065
|
+
U === x.id && /* @__PURE__ */ e(ul, { reportId: t, alert: x })
|
|
1040
1066
|
]
|
|
1041
1067
|
},
|
|
1042
1068
|
x.id
|
|
@@ -1051,39 +1077,39 @@ function ml({
|
|
|
1051
1077
|
className: "h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[11.5px] dark:border-border dark:bg-card"
|
|
1052
1078
|
}
|
|
1053
1079
|
),
|
|
1054
|
-
L.map((x,
|
|
1055
|
-
const
|
|
1080
|
+
L.map((x, Z) => {
|
|
1081
|
+
const te = ee.find((V) => V.value === x.field);
|
|
1056
1082
|
return /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
1057
1083
|
/* @__PURE__ */ e(
|
|
1058
|
-
|
|
1084
|
+
Nt,
|
|
1059
1085
|
{
|
|
1060
1086
|
value: x.field,
|
|
1061
|
-
onChange: (
|
|
1062
|
-
options:
|
|
1087
|
+
onChange: (V) => q((he) => he.map((le, ae) => ae === Z ? { ...le, field: V } : le)),
|
|
1088
|
+
options: ee.map((V) => ({ value: V.value, label: V.label })),
|
|
1063
1089
|
ariaLabel: "Alert metric field",
|
|
1064
1090
|
className: "h-7 min-w-0 flex-1 rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1065
1091
|
}
|
|
1066
1092
|
),
|
|
1067
|
-
(
|
|
1068
|
-
|
|
1093
|
+
(te == null ? void 0 : te.aggregatable) && /* @__PURE__ */ e(
|
|
1094
|
+
Nt,
|
|
1069
1095
|
{
|
|
1070
1096
|
value: x.agg,
|
|
1071
|
-
onChange: (
|
|
1072
|
-
(
|
|
1097
|
+
onChange: (V) => q(
|
|
1098
|
+
(he) => he.map((le, ae) => ae === Z ? { ...le, agg: V } : le)
|
|
1073
1099
|
),
|
|
1074
|
-
options:
|
|
1100
|
+
options: cl.map((V) => ({ value: V, label: V })),
|
|
1075
1101
|
ariaLabel: "Aggregate",
|
|
1076
1102
|
className: "h-7 w-[62px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1077
1103
|
}
|
|
1078
1104
|
),
|
|
1079
1105
|
/* @__PURE__ */ e(
|
|
1080
|
-
|
|
1106
|
+
Nt,
|
|
1081
1107
|
{
|
|
1082
1108
|
value: x.op,
|
|
1083
|
-
onChange: (
|
|
1084
|
-
(
|
|
1109
|
+
onChange: (V) => q(
|
|
1110
|
+
(he) => he.map((le, ae) => ae === Z ? { ...le, op: V } : le)
|
|
1085
1111
|
),
|
|
1086
|
-
options:
|
|
1112
|
+
options: dl.map((V) => ({ value: V, label: ca[V] })),
|
|
1087
1113
|
ariaLabel: "Operator",
|
|
1088
1114
|
className: "h-7 w-[52px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1089
1115
|
}
|
|
@@ -1092,8 +1118,8 @@ function ml({
|
|
|
1092
1118
|
"input",
|
|
1093
1119
|
{
|
|
1094
1120
|
value: x.value,
|
|
1095
|
-
onChange: (
|
|
1096
|
-
(
|
|
1121
|
+
onChange: (V) => q(
|
|
1122
|
+
(he) => he.map((le, ae) => ae === Z ? { ...le, value: V.target.value } : le)
|
|
1097
1123
|
),
|
|
1098
1124
|
placeholder: "0",
|
|
1099
1125
|
inputMode: "decimal",
|
|
@@ -1105,36 +1131,36 @@ function ml({
|
|
|
1105
1131
|
{
|
|
1106
1132
|
type: "button",
|
|
1107
1133
|
className: "text-slate-300 hover:text-red-500",
|
|
1108
|
-
onClick: () =>
|
|
1134
|
+
onClick: () => q((V) => V.filter((he, le) => le !== Z)),
|
|
1109
1135
|
children: /* @__PURE__ */ e(Ae, { className: "h-3 w-3" })
|
|
1110
1136
|
}
|
|
1111
1137
|
)
|
|
1112
|
-
] },
|
|
1138
|
+
] }, Z);
|
|
1113
1139
|
}),
|
|
1114
1140
|
/* @__PURE__ */ e(
|
|
1115
1141
|
"button",
|
|
1116
1142
|
{
|
|
1117
1143
|
type: "button",
|
|
1118
1144
|
className: "text-[10.5px] text-slate-400 hover:text-nvr-navy dark:hover:text-nvr-cyan",
|
|
1119
|
-
onClick: () =>
|
|
1145
|
+
onClick: () => q((x) => [...x, { field: "value", agg: "sum", op: "gt", value: "" }]),
|
|
1120
1146
|
children: "+ condition (all must match)"
|
|
1121
1147
|
}
|
|
1122
1148
|
),
|
|
1123
1149
|
a.length > 0 && /* @__PURE__ */ i("div", { children: [
|
|
1124
1150
|
/* @__PURE__ */ e("p", { className: "mb-1 text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: "Alert scope (optional)" }),
|
|
1125
1151
|
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: a.map((x) => {
|
|
1126
|
-
var
|
|
1152
|
+
var Z;
|
|
1127
1153
|
return /* @__PURE__ */ e(
|
|
1128
|
-
|
|
1154
|
+
na,
|
|
1129
1155
|
{
|
|
1130
1156
|
reportId: t,
|
|
1131
1157
|
field: x.field,
|
|
1132
1158
|
label: x.label,
|
|
1133
1159
|
optionSource: x.options,
|
|
1134
|
-
selected: ((
|
|
1135
|
-
onChange: (
|
|
1136
|
-
...
|
|
1137
|
-
...
|
|
1160
|
+
selected: ((Z = w.find((te) => te.field === x.field)) == null ? void 0 : Z.values) ?? [],
|
|
1161
|
+
onChange: (te, V) => E((he) => [
|
|
1162
|
+
...he.filter((le) => le.field !== x.field),
|
|
1163
|
+
...te.length > 0 ? [{ field: x.field, values: te, labels: V }] : []
|
|
1138
1164
|
])
|
|
1139
1165
|
},
|
|
1140
1166
|
x.field
|
|
@@ -1147,8 +1173,8 @@ function ml({
|
|
|
1147
1173
|
"input",
|
|
1148
1174
|
{
|
|
1149
1175
|
type: "checkbox",
|
|
1150
|
-
checked:
|
|
1151
|
-
onChange: (x) =>
|
|
1176
|
+
checked: u,
|
|
1177
|
+
onChange: (x) => N(x.target.checked),
|
|
1152
1178
|
className: "h-3 w-3 accent-nvr-cyan"
|
|
1153
1179
|
}
|
|
1154
1180
|
),
|
|
@@ -1158,11 +1184,11 @@ function ml({
|
|
|
1158
1184
|
"button",
|
|
1159
1185
|
{
|
|
1160
1186
|
type: "button",
|
|
1161
|
-
disabled: !
|
|
1162
|
-
onClick: () =>
|
|
1187
|
+
disabled: !ge || de.isPending,
|
|
1188
|
+
onClick: () => de.mutate(),
|
|
1163
1189
|
className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2 text-[11.5px] font-semibold text-white disabled:opacity-50",
|
|
1164
1190
|
children: [
|
|
1165
|
-
/* @__PURE__ */ e(
|
|
1191
|
+
/* @__PURE__ */ e(Vt, { className: "h-3 w-3" }),
|
|
1166
1192
|
" Add alert"
|
|
1167
1193
|
]
|
|
1168
1194
|
}
|
|
@@ -1173,7 +1199,7 @@ function ml({
|
|
|
1173
1199
|
] })
|
|
1174
1200
|
] });
|
|
1175
1201
|
}
|
|
1176
|
-
const
|
|
1202
|
+
const hl = {
|
|
1177
1203
|
eq: "_eq",
|
|
1178
1204
|
neq: "_neq",
|
|
1179
1205
|
gt: "_gt",
|
|
@@ -1185,80 +1211,80 @@ const ul = {
|
|
|
1185
1211
|
null: "_null",
|
|
1186
1212
|
nnull: "_nnull"
|
|
1187
1213
|
};
|
|
1188
|
-
function
|
|
1189
|
-
var L,
|
|
1190
|
-
const
|
|
1191
|
-
for (const w of
|
|
1192
|
-
const
|
|
1193
|
-
if (!
|
|
1194
|
-
let
|
|
1195
|
-
w.op === "in" && typeof
|
|
1214
|
+
function Mt(t, n, a, o) {
|
|
1215
|
+
var L, q;
|
|
1216
|
+
const c = t.config ?? {}, m = [];
|
|
1217
|
+
for (const w of c.filters ?? []) {
|
|
1218
|
+
const E = hl[w.op];
|
|
1219
|
+
if (!E) continue;
|
|
1220
|
+
let u = w.value;
|
|
1221
|
+
w.op === "in" && typeof u == "string" && (u = u.split(",").map((N) => N.trim())), m.push({ path: [w.field], op: E, value: u });
|
|
1196
1222
|
}
|
|
1197
|
-
for (const w of
|
|
1198
|
-
(L = w.values) != null && L.length &&
|
|
1199
|
-
const h =
|
|
1200
|
-
f && h && (
|
|
1201
|
-
const p =
|
|
1223
|
+
for (const w of n)
|
|
1224
|
+
(L = w.values) != null && L.length && m.push({ path: [w.field], op: "_in", value: w.values });
|
|
1225
|
+
const h = c.date_field || ((q = c.dimension) != null && q.bucket ? c.dimension.field : null), f = sa(a);
|
|
1226
|
+
f && h && (m.push({ path: [h], op: "_gte", value: f.start }), m.push({ path: [h], op: "_lte", value: `${f.end}T23:59:59` }));
|
|
1227
|
+
const p = c.dimension;
|
|
1202
1228
|
if (o !== void 0 && (p != null && p.field))
|
|
1203
1229
|
if (p.bucket) {
|
|
1204
1230
|
const w = String(o);
|
|
1205
1231
|
if (/^\d{4}-\d{2}-\d{2}$/.test(w))
|
|
1206
|
-
|
|
1232
|
+
m.push({ path: [p.field], op: "_gte", value: w }), m.push({ path: [p.field], op: "_lte", value: `${w}T23:59:59` });
|
|
1207
1233
|
else if (/^\d{4}-\d{2}$/.test(w)) {
|
|
1208
|
-
const [
|
|
1209
|
-
|
|
1234
|
+
const [E, u] = w.split("-").map(Number), N = new Date(E, u, 0).getDate();
|
|
1235
|
+
m.push({ path: [p.field], op: "_gte", value: `${w}-01` }), m.push({
|
|
1210
1236
|
path: [p.field],
|
|
1211
1237
|
op: "_lte",
|
|
1212
|
-
value: `${w}-${String(
|
|
1238
|
+
value: `${w}-${String(N).padStart(2, "0")}T23:59:59`
|
|
1213
1239
|
});
|
|
1214
1240
|
}
|
|
1215
|
-
} else o === null ?
|
|
1216
|
-
return
|
|
1241
|
+
} else o === null ? m.push({ path: [p.field], op: "_null", value: !0 }) : m.push({ path: [p.field], op: "_eq", value: o });
|
|
1242
|
+
return m;
|
|
1217
1243
|
}
|
|
1218
|
-
function
|
|
1219
|
-
const
|
|
1244
|
+
function Et(t) {
|
|
1245
|
+
const n = t.config ?? {}, a = [], o = n.query;
|
|
1220
1246
|
if (t.type === "query" && (o != null && o.slug))
|
|
1221
1247
|
a.push(`Custom query: ${o.slug}`);
|
|
1222
1248
|
else if (t.collection) {
|
|
1223
|
-
const
|
|
1249
|
+
const c = n.metric, m = (c == null ? void 0 : c.aggregate) ?? "count";
|
|
1224
1250
|
a.push(
|
|
1225
|
-
`${
|
|
1251
|
+
`${m === "count" ? "Count of" : `${m.toUpperCase()} of ${(c == null ? void 0 : c.field) ?? "?"} on`} ${t.collection.replace(/_/g, " ")}`
|
|
1226
1252
|
);
|
|
1227
|
-
const h =
|
|
1253
|
+
const h = n.dimension;
|
|
1228
1254
|
h != null && h.field && a.push(`by ${h.field}${h.bucket ? ` (${h.bucket})` : ""}`);
|
|
1229
|
-
const f =
|
|
1255
|
+
const f = n.filters ?? [];
|
|
1230
1256
|
for (const p of f) a.push(`${p.field} ${p.op} ${String(p.value ?? "")}`);
|
|
1231
|
-
|
|
1257
|
+
n.date_field && a.push(`dated by ${n.date_field}`), n.compare && a.push(`compared to ${String(n.compare).replace(/_/g, " ")}`);
|
|
1232
1258
|
}
|
|
1233
1259
|
return a.length > 0 ? a.join(" · ") : "No configuration details";
|
|
1234
1260
|
}
|
|
1235
|
-
function
|
|
1236
|
-
var
|
|
1237
|
-
return t ? t.value != null ? Number(t.value) : t.series ? t.series.reduce((o,
|
|
1261
|
+
function fl(t) {
|
|
1262
|
+
var n, a;
|
|
1263
|
+
return t ? t.value != null ? Number(t.value) : t.series ? t.series.reduce((o, c) => o + (Number(c.value) || 0), 0) : (n = t.tiles) != null && n.length ? Number(((a = t.tiles[0]) == null ? void 0 : a.value) ?? 0) : t.row_count != null ? Number(t.row_count) : null : null;
|
|
1238
1264
|
}
|
|
1239
|
-
function
|
|
1240
|
-
var
|
|
1265
|
+
function Wt(t, n, a) {
|
|
1266
|
+
var q, w, E;
|
|
1241
1267
|
const o = a ? [...a] : [];
|
|
1242
|
-
if (o.length === 0 && ((
|
|
1243
|
-
for (const
|
|
1268
|
+
if (o.length === 0 && ((q = n == null ? void 0 : n.rows) != null && q.length) && o.push(...n.rows), o.length === 0 && ((w = n == null ? void 0 : n.series) != null && w.length))
|
|
1269
|
+
for (const u of n.series)
|
|
1244
1270
|
o.push({
|
|
1245
|
-
dim:
|
|
1246
|
-
value:
|
|
1247
|
-
...
|
|
1248
|
-
...
|
|
1271
|
+
dim: u.dim,
|
|
1272
|
+
value: u.value,
|
|
1273
|
+
...u.prev != null ? { previous: u.prev } : {},
|
|
1274
|
+
...u.value2 != null ? { value2: u.value2 } : {}
|
|
1249
1275
|
});
|
|
1250
|
-
if (o.length === 0 && ((
|
|
1251
|
-
for (const
|
|
1252
|
-
if (o.length === 0 && (
|
|
1253
|
-
|
|
1276
|
+
if (o.length === 0 && ((E = n == null ? void 0 : n.tiles) != null && E.length))
|
|
1277
|
+
for (const u of n.tiles) o.push({ label: u.label, value: u.value });
|
|
1278
|
+
if (o.length === 0 && (n == null ? void 0 : n.value) != null && o.push({ value: n.value }), o.length === 0) {
|
|
1279
|
+
Xt.info("Nothing to download yet", {
|
|
1254
1280
|
description: "This widget has no rows for these filters."
|
|
1255
1281
|
});
|
|
1256
1282
|
return;
|
|
1257
1283
|
}
|
|
1258
|
-
const
|
|
1259
|
-
const
|
|
1260
|
-
return /[",\n]/.test(
|
|
1261
|
-
}, h = [
|
|
1284
|
+
const c = [...new Set(o.flatMap((u) => Object.keys(u)))], m = (u) => {
|
|
1285
|
+
const N = String(u ?? "");
|
|
1286
|
+
return /[",\n]/.test(N) ? `"${N.replace(/"/g, '""')}"` : N;
|
|
1287
|
+
}, h = [c.join(","), ...o.map((u) => c.map((N) => m(u[N])).join(","))].join(
|
|
1262
1288
|
`
|
|
1263
1289
|
`
|
|
1264
1290
|
), f = new Blob([h], { type: "text/csv;charset=utf-8" }), p = document.createElement("a");
|
|
@@ -1266,23 +1292,23 @@ function Et(t, s, a) {
|
|
|
1266
1292
|
const L = p.href;
|
|
1267
1293
|
setTimeout(() => URL.revokeObjectURL(L), 1e4);
|
|
1268
1294
|
}
|
|
1269
|
-
function
|
|
1295
|
+
function xl({
|
|
1270
1296
|
collection: t,
|
|
1271
|
-
conditions:
|
|
1297
|
+
conditions: n,
|
|
1272
1298
|
title: a,
|
|
1273
1299
|
onClose: o,
|
|
1274
|
-
onOpen:
|
|
1275
|
-
crossFilter:
|
|
1300
|
+
onOpen: c,
|
|
1301
|
+
crossFilter: m
|
|
1276
1302
|
}) {
|
|
1277
|
-
const h = Ke(), { data: f, isLoading: p } =
|
|
1278
|
-
queryKey: ["nvr-report-drill", t, JSON.stringify(
|
|
1303
|
+
const h = Ke(), { data: f, isLoading: p } = Ne({
|
|
1304
|
+
queryKey: ["nvr-report-drill", t, JSON.stringify(n)],
|
|
1279
1305
|
queryFn: () => h.request(
|
|
1280
|
-
|
|
1306
|
+
ct(`/items/${t}`, { limit: 50, conditions: JSON.stringify(n) })
|
|
1281
1307
|
),
|
|
1282
1308
|
staleTime: 3e4,
|
|
1283
1309
|
retry: !1
|
|
1284
|
-
}), L = (f == null ? void 0 : f.data) ?? [],
|
|
1285
|
-
for (const
|
|
1310
|
+
}), L = (f == null ? void 0 : f.data) ?? [], q = (w) => {
|
|
1311
|
+
for (const u of [
|
|
1286
1312
|
"title",
|
|
1287
1313
|
"name",
|
|
1288
1314
|
"label",
|
|
@@ -1291,13 +1317,13 @@ function hl({
|
|
|
1291
1317
|
"project_id",
|
|
1292
1318
|
"description"
|
|
1293
1319
|
]) {
|
|
1294
|
-
const
|
|
1295
|
-
if (typeof
|
|
1320
|
+
const N = w[u];
|
|
1321
|
+
if (typeof N == "string" && N.trim()) return N.slice(0, 90);
|
|
1296
1322
|
}
|
|
1297
|
-
const
|
|
1298
|
-
([
|
|
1323
|
+
const E = Object.entries(w).find(
|
|
1324
|
+
([u, N]) => u !== "id" && typeof N == "string" && N.trim()
|
|
1299
1325
|
);
|
|
1300
|
-
return
|
|
1326
|
+
return E ? String(E[1]).slice(0, 90) : `#${w.id}`;
|
|
1301
1327
|
};
|
|
1302
1328
|
return /* @__PURE__ */ e(
|
|
1303
1329
|
"div",
|
|
@@ -1313,11 +1339,11 @@ function hl({
|
|
|
1313
1339
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 border-b border-slate-100 px-4 py-2.5 dark:border-border", children: [
|
|
1314
1340
|
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: a }),
|
|
1315
1341
|
/* @__PURE__ */ e("span", { className: "text-[11.5px] tabular-nums text-slate-400", children: f ? `${L.length}${(f.total ?? 0) > L.length ? ` of ${f.total.toLocaleString()}` : ""} records` : "" }),
|
|
1316
|
-
|
|
1342
|
+
m && /* @__PURE__ */ e(
|
|
1317
1343
|
"button",
|
|
1318
1344
|
{
|
|
1319
1345
|
type: "button",
|
|
1320
|
-
onClick:
|
|
1346
|
+
onClick: m,
|
|
1321
1347
|
title: "Apply this value as a filter across the whole report",
|
|
1322
1348
|
className: "shrink-0 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/[0.08] px-2 py-0.5 text-[11px] font-medium text-[#007a99] hover:brightness-105 dark:text-nvr-cyan",
|
|
1323
1349
|
children: "Filter report"
|
|
@@ -1340,9 +1366,9 @@ function hl({
|
|
|
1340
1366
|
"button",
|
|
1341
1367
|
{
|
|
1342
1368
|
type: "button",
|
|
1343
|
-
onClick: () =>
|
|
1369
|
+
onClick: () => c({ collection: t, itemId: String(w.id) }),
|
|
1344
1370
|
className: "block w-full truncate rounded-md px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-muted",
|
|
1345
|
-
children:
|
|
1371
|
+
children: q(w)
|
|
1346
1372
|
},
|
|
1347
1373
|
String(w.id)
|
|
1348
1374
|
))
|
|
@@ -1353,7 +1379,7 @@ function hl({
|
|
|
1353
1379
|
}
|
|
1354
1380
|
);
|
|
1355
1381
|
}
|
|
1356
|
-
const
|
|
1382
|
+
const Bt = {
|
|
1357
1383
|
red: {
|
|
1358
1384
|
cell: "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
|
|
1359
1385
|
row: "bg-red-50/70 dark:bg-red-500/10"
|
|
@@ -1371,212 +1397,215 @@ const Wt = {
|
|
|
1371
1397
|
row: "bg-sky-50/70 dark:bg-sky-500/10"
|
|
1372
1398
|
}
|
|
1373
1399
|
};
|
|
1374
|
-
function
|
|
1375
|
-
const a = Number(
|
|
1400
|
+
function Qt(t, n) {
|
|
1401
|
+
const a = Number(n);
|
|
1376
1402
|
return Number.isFinite(a) ? t.op === "gt" ? a > t.value : t.op === "gte" ? a >= t.value : t.op === "lt" ? a < t.value : t.op === "lte" ? a <= t.value : a === t.value : !1;
|
|
1377
1403
|
}
|
|
1378
|
-
const
|
|
1379
|
-
reportId:
|
|
1404
|
+
const Lt = Ta(function({
|
|
1405
|
+
reportId: n,
|
|
1380
1406
|
widget: a,
|
|
1381
1407
|
dateRange: o,
|
|
1382
|
-
entityFilters:
|
|
1383
|
-
refetchInterval:
|
|
1408
|
+
entityFilters: c,
|
|
1409
|
+
refetchInterval: m,
|
|
1384
1410
|
filterBar: h = [],
|
|
1385
1411
|
onDrill: f,
|
|
1386
1412
|
snapshot: p,
|
|
1387
1413
|
asOf: L,
|
|
1388
|
-
annotations:
|
|
1414
|
+
annotations: q,
|
|
1389
1415
|
onAddAnnotation: w,
|
|
1390
|
-
onDeleteAnnotation:
|
|
1391
|
-
onCrossFilter:
|
|
1392
|
-
reportUrl:
|
|
1393
|
-
currentFilters:
|
|
1416
|
+
onDeleteAnnotation: E,
|
|
1417
|
+
onCrossFilter: u,
|
|
1418
|
+
reportUrl: N,
|
|
1419
|
+
currentFilters: U
|
|
1394
1420
|
}) {
|
|
1395
|
-
var
|
|
1396
|
-
const O = Ke(), [
|
|
1397
|
-
|
|
1421
|
+
var ft, Ue, xt, Ve, bt, gt, tt, vt, Ye, at, Je, lt, rt, nt, re, yt, st, it, ot, Le;
|
|
1422
|
+
const O = Ke(), [ee, H] = C(""), [ue, pe] = C(0), [X, de] = C(null), [xe, be] = C(!1), [ge, $e] = C(""), [x, Z] = C(""), [te, V] = C(!1), [he, le] = C(!1), [ae, S] = C([]), T = St(null), P = sl(T), [Y, ne] = C(!1), [ce, fe] = C(null), [_, D] = C(!1), [me, ve] = C(null), we = ["bar", "line", "donut", "pareto", "area"].includes(a.type) || a.type === "kpi" && !!((ft = a.config) != null && ft.compare || (Ue = a.config) != null && Ue.sparkline), Te = Ct(), [Xe, ye] = C(!1), Ze = async () => {
|
|
1423
|
+
ye(!0);
|
|
1398
1424
|
try {
|
|
1399
1425
|
const l = await O.request(
|
|
1400
|
-
|
|
1426
|
+
kt(n, a.id, {
|
|
1401
1427
|
date_range: o,
|
|
1402
|
-
entity_filters:
|
|
1428
|
+
entity_filters: c,
|
|
1403
1429
|
fresh: 1
|
|
1404
1430
|
})
|
|
1405
1431
|
);
|
|
1406
1432
|
Te.setQueryData(
|
|
1407
|
-
["nivaro-report-widget",
|
|
1433
|
+
["nivaro-report-widget", n, a.id, o, c],
|
|
1408
1434
|
l.data
|
|
1409
1435
|
);
|
|
1410
1436
|
} catch {
|
|
1411
1437
|
}
|
|
1412
|
-
|
|
1413
|
-
},
|
|
1414
|
-
() => ({ date_range: o ?? null, entity_filters:
|
|
1415
|
-
[o,
|
|
1416
|
-
),
|
|
1438
|
+
ye(!1);
|
|
1439
|
+
}, ke = ut(
|
|
1440
|
+
() => ({ date_range: o ?? null, entity_filters: c }),
|
|
1441
|
+
[o, c]
|
|
1442
|
+
), Fe = Ka({
|
|
1417
1443
|
kind: "report",
|
|
1418
1444
|
widget: a.id,
|
|
1419
|
-
report:
|
|
1420
|
-
params:
|
|
1421
|
-
enabled: a.type !== "divider" && a.type !== "query",
|
|
1445
|
+
report: n,
|
|
1446
|
+
params: ke,
|
|
1447
|
+
enabled: P && a.type !== "divider" && a.type !== "query",
|
|
1422
1448
|
onData: (l) => Te.setQueryData(
|
|
1423
|
-
["nivaro-report-widget",
|
|
1449
|
+
["nivaro-report-widget", n, a.id, o, c],
|
|
1424
1450
|
l
|
|
1425
1451
|
),
|
|
1426
|
-
onStale: () => void
|
|
1452
|
+
onStale: () => void We()
|
|
1427
1453
|
}), {
|
|
1428
|
-
data:
|
|
1429
|
-
isLoading:
|
|
1430
|
-
error:
|
|
1431
|
-
refetch:
|
|
1432
|
-
isFetching:
|
|
1433
|
-
} =
|
|
1434
|
-
queryKey: ["nivaro-report-widget",
|
|
1454
|
+
data: Ie,
|
|
1455
|
+
isLoading: Ee,
|
|
1456
|
+
error: De,
|
|
1457
|
+
refetch: We,
|
|
1458
|
+
isFetching: $t
|
|
1459
|
+
} = Ne({
|
|
1460
|
+
queryKey: ["nivaro-report-widget", n, a.id, o, c],
|
|
1435
1461
|
queryFn: () => O.request(
|
|
1436
|
-
|
|
1462
|
+
kt(n, a.id, {
|
|
1437
1463
|
date_range: o,
|
|
1438
|
-
entity_filters:
|
|
1464
|
+
entity_filters: c
|
|
1439
1465
|
})
|
|
1440
1466
|
).then((l) => l.data),
|
|
1441
1467
|
// Query widgets resolve client-side in QueryWidgetBody — but when a
|
|
1442
1468
|
// snapshot comparison is active, the server-resolved value (the same
|
|
1443
1469
|
// number the snapshot stored) is fetched so the delta badge can render.
|
|
1444
|
-
enabled: a.type !== "divider" && (a.type !== "query" || !!p),
|
|
1470
|
+
enabled: P && a.type !== "divider" && (a.type !== "query" || !!p),
|
|
1445
1471
|
staleTime: 6e4,
|
|
1446
1472
|
// Per-widget auto-refresh (#168) overrides the report-level interval.
|
|
1447
|
-
refetchInterval:
|
|
1448
|
-
|
|
1449
|
-
Number((
|
|
1473
|
+
refetchInterval: Da(
|
|
1474
|
+
Fe,
|
|
1475
|
+
Number((xt = a.config) == null ? void 0 : xt.refresh_secs) >= 10 ? Number(a.config.refresh_secs) * 1e3 : m
|
|
1450
1476
|
),
|
|
1451
1477
|
retry: !1
|
|
1452
|
-
}),
|
|
1478
|
+
}), Be = (((Ve = a.config) == null ? void 0 : Ve.drill_levels) ?? []).filter(
|
|
1453
1479
|
(l) => typeof l == "string" && l
|
|
1454
|
-
), { data:
|
|
1455
|
-
queryKey: ["nvr-report-drill",
|
|
1480
|
+
), { data: ht } = Ne({
|
|
1481
|
+
queryKey: ["nvr-report-drill", n, a.id, ae, o, c],
|
|
1456
1482
|
queryFn: () => O.request(
|
|
1457
|
-
|
|
1483
|
+
kt(n, a.id, {
|
|
1458
1484
|
date_range: o,
|
|
1459
1485
|
entity_filters: [
|
|
1460
|
-
...
|
|
1461
|
-
...
|
|
1486
|
+
...c,
|
|
1487
|
+
...ae.map((l) => ({ field: l.field, values: [l.value] }))
|
|
1462
1488
|
],
|
|
1463
|
-
dimension_override:
|
|
1489
|
+
dimension_override: Be[ae.length - 1]
|
|
1464
1490
|
})
|
|
1465
1491
|
).then((l) => l.data),
|
|
1466
|
-
enabled:
|
|
1492
|
+
enabled: ae.length > 0 && Be.length > 0,
|
|
1467
1493
|
staleTime: 6e4,
|
|
1468
1494
|
retry: !1
|
|
1469
|
-
}),
|
|
1495
|
+
}), R = ae.length > 0 && ht ? ht : Ie, se = (bt = a.config) == null ? void 0 : bt.format, et = {
|
|
1470
1496
|
gridColumn: `${Math.max(1, (a.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, a.w || 4))}`,
|
|
1471
1497
|
gridRow: `span ${Math.max(1, a.h || 3)}`
|
|
1472
1498
|
};
|
|
1473
1499
|
if (a.type === "divider")
|
|
1474
|
-
return /* @__PURE__ */ e("div", { style:
|
|
1475
|
-
const
|
|
1476
|
-
...
|
|
1477
|
-
slug:
|
|
1500
|
+
return /* @__PURE__ */ e("div", { style: et, className: "self-end border-b border-slate-200 pb-1 dark:border-border", children: /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: a.title }) });
|
|
1501
|
+
const Qe = a.type === "query" ? (gt = a.config) == null ? void 0 : gt.query : null, _e = Qe ? {
|
|
1502
|
+
...Qe,
|
|
1503
|
+
slug: Qe.slug || Qe.query_slug || ""
|
|
1478
1504
|
} : null;
|
|
1479
|
-
let
|
|
1480
|
-
if (
|
|
1481
|
-
|
|
1482
|
-
|
|
1505
|
+
let J = null;
|
|
1506
|
+
if (_e != null && _e.slug)
|
|
1507
|
+
J = /* @__PURE__ */ e(
|
|
1508
|
+
ol,
|
|
1483
1509
|
{
|
|
1484
|
-
cfg:
|
|
1510
|
+
cfg: _e,
|
|
1485
1511
|
dateRange: o,
|
|
1486
|
-
entityFilters:
|
|
1487
|
-
refetchInterval:
|
|
1488
|
-
onDrill: f
|
|
1512
|
+
entityFilters: c,
|
|
1513
|
+
refetchInterval: m,
|
|
1514
|
+
onDrill: f,
|
|
1515
|
+
deferred: !P
|
|
1489
1516
|
}
|
|
1490
1517
|
);
|
|
1491
1518
|
else if (a.type === "query")
|
|
1492
|
-
|
|
1493
|
-
else if (
|
|
1494
|
-
|
|
1519
|
+
J = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No query configured." });
|
|
1520
|
+
else if (!P && R === void 0)
|
|
1521
|
+
J = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
1522
|
+
else if (Ee)
|
|
1523
|
+
J = /* @__PURE__ */ i("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
1495
1524
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
1496
1525
|
/* @__PURE__ */ e(
|
|
1497
|
-
|
|
1526
|
+
ea,
|
|
1498
1527
|
{
|
|
1499
1528
|
pending: !0,
|
|
1500
1529
|
request: {
|
|
1501
1530
|
method: "POST",
|
|
1502
|
-
url: `/report-studio/${
|
|
1503
|
-
body: { date_range: o, entity_filters:
|
|
1531
|
+
url: `/report-studio/${n}/widgets/${a.id}/data`,
|
|
1532
|
+
body: { date_range: o, entity_filters: c }
|
|
1504
1533
|
},
|
|
1505
1534
|
label: a.title || "Report widget",
|
|
1506
|
-
queryKey: ["nivaro-report-widget",
|
|
1535
|
+
queryKey: ["nivaro-report-widget", n, a.id, o, c],
|
|
1507
1536
|
select: (l) => l == null ? void 0 : l.data
|
|
1508
1537
|
}
|
|
1509
1538
|
)
|
|
1510
1539
|
] });
|
|
1511
|
-
else if (
|
|
1512
|
-
|
|
1513
|
-
|
|
1540
|
+
else if (De)
|
|
1541
|
+
J = /* @__PURE__ */ e(
|
|
1542
|
+
ta,
|
|
1514
1543
|
{
|
|
1515
1544
|
className: "px-1",
|
|
1516
|
-
message:
|
|
1517
|
-
onRetry: () => void
|
|
1545
|
+
message: It(De) ?? Tt(De, "this widget"),
|
|
1546
|
+
onRetry: () => void We()
|
|
1518
1547
|
}
|
|
1519
1548
|
);
|
|
1520
|
-
else if (
|
|
1549
|
+
else if (R)
|
|
1521
1550
|
if (a.type === "queue") {
|
|
1522
|
-
const l =
|
|
1523
|
-
(
|
|
1551
|
+
const l = R.series ?? [], s = Math.max(...l.map((K) => K.value), 1), b = Math.min(...l.map((K) => K.value), 0), M = Math.max(s - b, 1), $ = l.map(
|
|
1552
|
+
(K, ie) => `${ie / Math.max(1, l.length - 1) * 100},${28 - (K.value - b) / M * 26}`
|
|
1524
1553
|
).join(" ");
|
|
1525
|
-
|
|
1526
|
-
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children:
|
|
1554
|
+
J = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1555
|
+
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children: R.value == null ? "—" : Number(R.value).toLocaleString() }),
|
|
1527
1556
|
l.length >= 3 && /* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1528
1557
|
"polyline",
|
|
1529
1558
|
{
|
|
1530
|
-
points:
|
|
1559
|
+
points: $,
|
|
1531
1560
|
fill: "none",
|
|
1532
|
-
stroke:
|
|
1561
|
+
stroke: Ge,
|
|
1533
1562
|
strokeWidth: "2",
|
|
1534
1563
|
vectorEffect: "non-scaling-stroke"
|
|
1535
1564
|
}
|
|
1536
1565
|
) }),
|
|
1537
1566
|
/* @__PURE__ */ i("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
|
|
1538
|
-
((
|
|
1567
|
+
((tt = a.config) == null ? void 0 : tt.metric) ?? "total",
|
|
1539
1568
|
" · daily snapshots"
|
|
1540
1569
|
] })
|
|
1541
1570
|
] });
|
|
1542
1571
|
} else if (a.type === "kpi" || a.type === "calc") {
|
|
1543
|
-
if (
|
|
1572
|
+
if (J = /* @__PURE__ */ i("div", { className: "flex items-baseline gap-2", children: [
|
|
1544
1573
|
/* @__PURE__ */ e(
|
|
1545
1574
|
"p",
|
|
1546
1575
|
{
|
|
1547
|
-
className:
|
|
1576
|
+
className: j(
|
|
1548
1577
|
"text-[28px] font-semibold leading-none tracking-tight text-slate-900 dark:text-foreground",
|
|
1549
1578
|
a.collection && "cursor-pointer decoration-dotted underline-offset-4 hover:underline",
|
|
1550
1579
|
// KPI threshold colors (#211): first matching gte-descending rule wins.
|
|
1551
1580
|
(() => {
|
|
1552
|
-
var
|
|
1553
|
-
const l = (
|
|
1554
|
-
if (!(l != null && l.length) ||
|
|
1555
|
-
const
|
|
1556
|
-
return (
|
|
1581
|
+
var b;
|
|
1582
|
+
const l = (b = a.config) == null ? void 0 : b.thresholds;
|
|
1583
|
+
if (!(l != null && l.length) || R.value == null) return null;
|
|
1584
|
+
const s = [...l].filter((M) => Number.isFinite(M.gte)).sort((M, $) => $.gte - M.gte).find((M) => R.value >= M.gte);
|
|
1585
|
+
return (s == null ? void 0 : s.color) === "red" ? "!text-red-600 dark:!text-red-400" : (s == null ? void 0 : s.color) === "amber" ? "!text-amber-600 dark:!text-amber-400" : (s == null ? void 0 : s.color) === "green" ? "!text-emerald-600 dark:!text-emerald-400" : null;
|
|
1557
1586
|
})()
|
|
1558
1587
|
),
|
|
1559
1588
|
title: a.collection ? "See the records behind this number" : void 0,
|
|
1560
1589
|
onClick: () => {
|
|
1561
|
-
a.collection &&
|
|
1562
|
-
conditions:
|
|
1590
|
+
a.collection && de({
|
|
1591
|
+
conditions: Mt(a, c, o),
|
|
1563
1592
|
title: a.title || a.collection
|
|
1564
1593
|
});
|
|
1565
1594
|
},
|
|
1566
|
-
children: qe(
|
|
1595
|
+
children: qe(R.value, se)
|
|
1567
1596
|
}
|
|
1568
1597
|
),
|
|
1569
|
-
/* @__PURE__ */ e(
|
|
1570
|
-
] }),
|
|
1571
|
-
const l =
|
|
1572
|
-
|
|
1573
|
-
|
|
1598
|
+
/* @__PURE__ */ e(zt, { pct: R.change_pct })
|
|
1599
|
+
] }), R.spark && R.spark.length >= 3) {
|
|
1600
|
+
const l = R.spark, s = Math.max(...l.map((K) => K.value), 1), b = Math.min(...l.map((K) => K.value), 0), M = Math.max(s - b, 1), $ = l.map((K, ie) => `${ie / (l.length - 1) * 100},${28 - (K.value - b) / M * 26}`).join(" ");
|
|
1601
|
+
J = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1602
|
+
J,
|
|
1574
1603
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1575
1604
|
"polyline",
|
|
1576
1605
|
{
|
|
1577
|
-
points:
|
|
1606
|
+
points: $,
|
|
1578
1607
|
fill: "none",
|
|
1579
|
-
stroke:
|
|
1608
|
+
stroke: Ge,
|
|
1580
1609
|
strokeWidth: "2",
|
|
1581
1610
|
vectorEffect: "non-scaling-stroke"
|
|
1582
1611
|
}
|
|
@@ -1584,133 +1613,133 @@ const Tt = Aa(function({
|
|
|
1584
1613
|
] });
|
|
1585
1614
|
}
|
|
1586
1615
|
} else if (a.type === "kpi_group") {
|
|
1587
|
-
const l =
|
|
1588
|
-
|
|
1616
|
+
const l = R.tiles ?? [];
|
|
1617
|
+
J = /* @__PURE__ */ e(
|
|
1589
1618
|
"div",
|
|
1590
1619
|
{
|
|
1591
1620
|
className: "grid gap-2",
|
|
1592
1621
|
style: { gridTemplateColumns: `repeat(${Math.max(1, l.length)}, 1fr)` },
|
|
1593
|
-
children: l.map((
|
|
1622
|
+
children: l.map((s, b) => /* @__PURE__ */ i(
|
|
1594
1623
|
"div",
|
|
1595
1624
|
{
|
|
1596
1625
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
1597
1626
|
style: {
|
|
1598
|
-
borderTopColor:
|
|
1627
|
+
borderTopColor: s.color ?? oe[b % oe.length],
|
|
1599
1628
|
borderTopWidth: 2
|
|
1600
1629
|
},
|
|
1601
1630
|
children: [
|
|
1602
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children:
|
|
1631
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: s.label }),
|
|
1603
1632
|
/* @__PURE__ */ i("div", { className: "flex items-baseline gap-1.5", children: [
|
|
1604
|
-
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: qe(
|
|
1605
|
-
/* @__PURE__ */ e(
|
|
1633
|
+
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: qe(s.value, s.format) }),
|
|
1634
|
+
/* @__PURE__ */ e(zt, { pct: s.change_pct })
|
|
1606
1635
|
] })
|
|
1607
1636
|
]
|
|
1608
1637
|
},
|
|
1609
|
-
|
|
1638
|
+
s.label
|
|
1610
1639
|
))
|
|
1611
1640
|
}
|
|
1612
1641
|
);
|
|
1613
1642
|
} else if (a.type === "narrative")
|
|
1614
|
-
|
|
1615
|
-
(l,
|
|
1643
|
+
J = /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: (R.narrative ?? "").split(/(\*\*[^*]+\*\*)/g).map(
|
|
1644
|
+
(l, s) => l.startsWith("**") && l.endsWith("**") ? /* @__PURE__ */ e("strong", { className: "font-semibold text-slate-900 dark:text-foreground", children: l.slice(2, -2) }, s) : /* @__PURE__ */ e("span", { children: l }, s)
|
|
1616
1645
|
) });
|
|
1617
1646
|
else if (a.type === "heatmap") {
|
|
1618
|
-
const l =
|
|
1619
|
-
|
|
1647
|
+
const l = R.cells ?? [], s = [...new Set(l.map((K) => K.dim))], b = [...new Set(l.map((K) => K.dim2))], M = Math.max(1, ...l.map((K) => K.value)), $ = (K, ie) => l.find((I) => I.dim === K && I.dim2 === ie);
|
|
1648
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full text-[10.5px]", children: [
|
|
1620
1649
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
1621
1650
|
/* @__PURE__ */ e("th", {}),
|
|
1622
|
-
|
|
1651
|
+
b.map((K) => /* @__PURE__ */ e(
|
|
1623
1652
|
"th",
|
|
1624
1653
|
{
|
|
1625
1654
|
className: "max-w-[80px] truncate px-1 pb-1 text-left font-medium text-slate-400",
|
|
1626
|
-
children:
|
|
1655
|
+
children: K
|
|
1627
1656
|
},
|
|
1628
|
-
|
|
1657
|
+
K
|
|
1629
1658
|
))
|
|
1630
1659
|
] }) }),
|
|
1631
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
1632
|
-
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children:
|
|
1633
|
-
|
|
1634
|
-
const
|
|
1660
|
+
/* @__PURE__ */ e("tbody", { children: s.map((K) => /* @__PURE__ */ i("tr", { children: [
|
|
1661
|
+
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children: K }),
|
|
1662
|
+
b.map((ie) => {
|
|
1663
|
+
const I = $(K, ie), A = I ? I.value / M : 0;
|
|
1635
1664
|
return /* @__PURE__ */ e("td", { className: "p-0.5", children: /* @__PURE__ */ e(
|
|
1636
1665
|
"div",
|
|
1637
1666
|
{
|
|
1638
|
-
"data-tip":
|
|
1667
|
+
"data-tip": I ? `${K} × ${ie}: ${I.value.toLocaleString()}` : void 0,
|
|
1639
1668
|
className: "flex h-6 items-center justify-center rounded text-[9.5px] tabular-nums",
|
|
1640
1669
|
style: {
|
|
1641
|
-
backgroundColor:
|
|
1642
|
-
color:
|
|
1643
|
-
border:
|
|
1670
|
+
backgroundColor: I ? `rgba(0, 165, 204, ${0.08 + A * 0.85})` : "transparent",
|
|
1671
|
+
color: A > 0.55 ? "#fff" : void 0,
|
|
1672
|
+
border: I ? void 0 : "1px dashed rgba(148,163,184,0.25)"
|
|
1644
1673
|
},
|
|
1645
|
-
children:
|
|
1674
|
+
children: I ? Ce(Math.round(I.value)) : ""
|
|
1646
1675
|
}
|
|
1647
|
-
) },
|
|
1676
|
+
) }, ie);
|
|
1648
1677
|
})
|
|
1649
|
-
] },
|
|
1678
|
+
] }, K)) })
|
|
1650
1679
|
] }) });
|
|
1651
1680
|
} else if (a.type === "ai_insight") {
|
|
1652
|
-
const l =
|
|
1653
|
-
|
|
1681
|
+
const l = R.narrative ?? "";
|
|
1682
|
+
J = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1654
1683
|
/* @__PURE__ */ i("div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1655
|
-
/* @__PURE__ */ e(
|
|
1684
|
+
/* @__PURE__ */ e(Dt, { className: "h-3.5 w-3.5 text-[#00a5cc]" }),
|
|
1656
1685
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wide text-slate-400", children: "AI-generated" }),
|
|
1657
1686
|
/* @__PURE__ */ e(
|
|
1658
1687
|
"button",
|
|
1659
1688
|
{
|
|
1660
1689
|
type: "button",
|
|
1661
1690
|
title: "Regenerate this summary",
|
|
1662
|
-
disabled:
|
|
1663
|
-
onClick: () => void
|
|
1691
|
+
disabled: Xe,
|
|
1692
|
+
onClick: () => void Ze(),
|
|
1664
1693
|
className: "ml-auto rounded p-0.5 text-slate-300 hover:text-[#00a5cc] disabled:opacity-50",
|
|
1665
|
-
children: /* @__PURE__ */ e(
|
|
1694
|
+
children: /* @__PURE__ */ e(Ft, { className: j("h-3 w-3", Xe && "animate-spin") })
|
|
1666
1695
|
}
|
|
1667
1696
|
)
|
|
1668
1697
|
] }),
|
|
1669
|
-
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children:
|
|
1698
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: Xe ? "Regenerating…" : l })
|
|
1670
1699
|
] });
|
|
1671
1700
|
} else if (a.type === "pivot") {
|
|
1672
|
-
const l =
|
|
1673
|
-
|
|
1701
|
+
const l = R.pivot;
|
|
1702
|
+
J = !l || l.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1674
1703
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full border-collapse text-[10.5px]", children: [
|
|
1675
1704
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
1676
1705
|
/* @__PURE__ */ e("th", { className: "sticky left-0 top-0 z-[2] bg-white dark:bg-card" }),
|
|
1677
|
-
l.cols.map((
|
|
1706
|
+
l.cols.map((s) => /* @__PURE__ */ e(
|
|
1678
1707
|
"th",
|
|
1679
1708
|
{
|
|
1680
1709
|
className: "sticky top-0 z-[1] whitespace-nowrap bg-white px-1.5 pb-1 text-right font-medium text-slate-400 dark:bg-card",
|
|
1681
|
-
children:
|
|
1710
|
+
children: s
|
|
1682
1711
|
},
|
|
1683
|
-
|
|
1712
|
+
s
|
|
1684
1713
|
)),
|
|
1685
1714
|
/* @__PURE__ */ e("th", { className: "sticky top-0 z-[1] bg-white px-1.5 pb-1 text-right font-semibold text-slate-500 dark:bg-card dark:text-slate-300", children: "Total" })
|
|
1686
1715
|
] }) }),
|
|
1687
|
-
/* @__PURE__ */ e("tbody", { children: l.rows.map((
|
|
1688
|
-
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] max-w-[150px] truncate bg-white pr-1.5 text-slate-500 dark:bg-card dark:text-slate-400", children:
|
|
1689
|
-
l.cols.map((
|
|
1690
|
-
var
|
|
1691
|
-
const
|
|
1716
|
+
/* @__PURE__ */ e("tbody", { children: l.rows.map((s) => /* @__PURE__ */ i("tr", { className: "hover:bg-muted", children: [
|
|
1717
|
+
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] max-w-[150px] truncate bg-white pr-1.5 text-slate-500 dark:bg-card dark:text-slate-400", children: s }),
|
|
1718
|
+
l.cols.map((b) => {
|
|
1719
|
+
var $;
|
|
1720
|
+
const M = ($ = l.cells[s]) == null ? void 0 : $[b];
|
|
1692
1721
|
return /* @__PURE__ */ e(
|
|
1693
1722
|
"td",
|
|
1694
1723
|
{
|
|
1695
1724
|
className: "px-1.5 py-0.5 text-right tabular-nums text-slate-700 dark:text-slate-300",
|
|
1696
|
-
children:
|
|
1725
|
+
children: M == null ? "" : qe(M, se)
|
|
1697
1726
|
},
|
|
1698
|
-
|
|
1727
|
+
b
|
|
1699
1728
|
);
|
|
1700
1729
|
}),
|
|
1701
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children: qe(l.row_totals[
|
|
1702
|
-
] },
|
|
1730
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children: qe(l.row_totals[s] ?? 0, se) })
|
|
1731
|
+
] }, s)) }),
|
|
1703
1732
|
/* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ i("tr", { className: "border-t border-slate-200 dark:border-border", children: [
|
|
1704
1733
|
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] bg-white pr-1.5 font-semibold text-slate-600 dark:bg-card dark:text-slate-300", children: "Total" }),
|
|
1705
|
-
l.cols.map((
|
|
1734
|
+
l.cols.map((s) => /* @__PURE__ */ e(
|
|
1706
1735
|
"td",
|
|
1707
1736
|
{
|
|
1708
1737
|
className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200",
|
|
1709
|
-
children: qe(l.col_totals[
|
|
1738
|
+
children: qe(l.col_totals[s] ?? 0, se)
|
|
1710
1739
|
},
|
|
1711
|
-
|
|
1740
|
+
s
|
|
1712
1741
|
)),
|
|
1713
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-900 dark:text-foreground", children: qe(l.grand_total,
|
|
1742
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-900 dark:text-foreground", children: qe(l.grand_total, se) })
|
|
1714
1743
|
] }) })
|
|
1715
1744
|
] }) }),
|
|
1716
1745
|
(l.truncated_rows > 0 || l.truncated_cols > 0) && /* @__PURE__ */ i("p", { className: "mt-1 shrink-0 px-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
|
|
@@ -1729,98 +1758,98 @@ const Tt = Aa(function({
|
|
|
1729
1758
|
] })
|
|
1730
1759
|
] });
|
|
1731
1760
|
} else if (a.type === "waterfall") {
|
|
1732
|
-
const l =
|
|
1733
|
-
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1736
|
-
let
|
|
1737
|
-
for (const
|
|
1738
|
-
|
|
1739
|
-
label:
|
|
1740
|
-
from:
|
|
1741
|
-
to:
|
|
1742
|
-
kind:
|
|
1743
|
-
}),
|
|
1744
|
-
|
|
1745
|
-
const
|
|
1746
|
-
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children:
|
|
1747
|
-
const
|
|
1761
|
+
const l = R.waterfall;
|
|
1762
|
+
J = l ? (() => {
|
|
1763
|
+
const s = [];
|
|
1764
|
+
s.push({ label: "Previous", from: 0, to: l.start, kind: "total" });
|
|
1765
|
+
let b = l.start;
|
|
1766
|
+
for (const $ of l.steps)
|
|
1767
|
+
s.push({
|
|
1768
|
+
label: $.dim,
|
|
1769
|
+
from: b,
|
|
1770
|
+
to: b + $.delta,
|
|
1771
|
+
kind: $.delta >= 0 ? "up" : "down"
|
|
1772
|
+
}), b += $.delta;
|
|
1773
|
+
s.push({ label: "Current", from: 0, to: l.end, kind: "total" });
|
|
1774
|
+
const M = Math.max(1, ...s.map(($) => Math.max($.from, $.to)));
|
|
1775
|
+
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children: s.map(($, K) => {
|
|
1776
|
+
const ie = Math.max($.from, $.to) / M * 100, I = Math.abs($.to - $.from) / M * 100;
|
|
1748
1777
|
return /* @__PURE__ */ i(
|
|
1749
1778
|
"div",
|
|
1750
1779
|
{
|
|
1751
1780
|
className: "relative flex h-full min-w-[46px] flex-1 flex-col justify-end",
|
|
1752
1781
|
children: [
|
|
1753
|
-
/* @__PURE__ */ e("div", { style: { height: `${Math.max(
|
|
1782
|
+
/* @__PURE__ */ e("div", { style: { height: `${Math.max(ie, 0.5)}%` }, className: "relative w-full", children: /* @__PURE__ */ e(
|
|
1754
1783
|
"div",
|
|
1755
1784
|
{
|
|
1756
|
-
"data-tip": `${
|
|
1785
|
+
"data-tip": `${$.label}: ${($.to - $.from).toLocaleString()}`,
|
|
1757
1786
|
className: "absolute inset-x-0 top-0 rounded-sm",
|
|
1758
1787
|
style: {
|
|
1759
|
-
height: `${Math.max(
|
|
1760
|
-
backgroundColor:
|
|
1788
|
+
height: `${Math.max(I / Math.max(ie, 1e-3) * 100, 2)}%`,
|
|
1789
|
+
backgroundColor: $.kind === "total" ? "#172940" : $.kind === "up" ? "#10b981" : "#ef4444"
|
|
1761
1790
|
}
|
|
1762
1791
|
}
|
|
1763
1792
|
) }),
|
|
1764
|
-
/* @__PURE__ */ e("p", { className: "absolute -bottom-4 left-0 right-0 truncate text-center text-[9px] text-slate-400", children:
|
|
1793
|
+
/* @__PURE__ */ e("p", { className: "absolute -bottom-4 left-0 right-0 truncate text-center text-[9px] text-slate-400", children: $.label })
|
|
1765
1794
|
]
|
|
1766
1795
|
},
|
|
1767
|
-
|
|
1796
|
+
K
|
|
1768
1797
|
);
|
|
1769
1798
|
}) });
|
|
1770
1799
|
})() : /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
1771
1800
|
} else if (a.type === "stats") {
|
|
1772
|
-
const l =
|
|
1773
|
-
|
|
1801
|
+
const l = R.rows ?? [];
|
|
1802
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "grid min-h-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-1.5 overflow-auto px-1", children: l.map((s) => /* @__PURE__ */ i(
|
|
1774
1803
|
"div",
|
|
1775
1804
|
{
|
|
1776
1805
|
className: "flex items-baseline justify-between border-b border-slate-100 pb-1 dark:border-border/50",
|
|
1777
1806
|
children: [
|
|
1778
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-500", children:
|
|
1779
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children:
|
|
1807
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-500", children: s.stat }),
|
|
1808
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: s.value == null ? "—" : qe(s.value, se) })
|
|
1780
1809
|
]
|
|
1781
1810
|
},
|
|
1782
|
-
|
|
1811
|
+
s.stat
|
|
1783
1812
|
)) });
|
|
1784
1813
|
} else if (a.type === "hot_records") {
|
|
1785
|
-
const l =
|
|
1786
|
-
|
|
1814
|
+
const l = R.rows ?? [], s = Math.max(1, ...l.map((b) => b.views));
|
|
1815
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No views recorded in the window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-1 overflow-auto px-1", children: l.map((b) => /* @__PURE__ */ i(
|
|
1787
1816
|
"button",
|
|
1788
1817
|
{
|
|
1789
1818
|
type: "button",
|
|
1790
|
-
onClick: () => a.collection && (f == null ? void 0 : f({ collection: a.collection, itemId: String(
|
|
1819
|
+
onClick: () => a.collection && (f == null ? void 0 : f({ collection: a.collection, itemId: String(b.id), title: b.label })),
|
|
1791
1820
|
className: "group flex w-full items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-muted",
|
|
1792
1821
|
children: [
|
|
1793
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 group-hover:text-[#0284c7] dark:text-slate-200", children:
|
|
1822
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 group-hover:text-[#0284c7] dark:text-slate-200", children: b.label }),
|
|
1794
1823
|
/* @__PURE__ */ e("span", { className: "relative h-2 w-20 overflow-hidden rounded-full bg-slate-100 dark:bg-white/10", children: /* @__PURE__ */ e(
|
|
1795
1824
|
"span",
|
|
1796
1825
|
{
|
|
1797
1826
|
className: "absolute inset-y-0 left-0 rounded-full bg-[#00a5cc]",
|
|
1798
|
-
style: { width: `${
|
|
1827
|
+
style: { width: `${b.views / s * 100}%` }
|
|
1799
1828
|
}
|
|
1800
1829
|
) }),
|
|
1801
|
-
/* @__PURE__ */ e("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children:
|
|
1830
|
+
/* @__PURE__ */ e("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: b.views })
|
|
1802
1831
|
]
|
|
1803
1832
|
},
|
|
1804
|
-
|
|
1833
|
+
b.id
|
|
1805
1834
|
)) });
|
|
1806
1835
|
} else if (a.type === "scatter") {
|
|
1807
|
-
const l =
|
|
1808
|
-
|
|
1809
|
-
const
|
|
1810
|
-
{ x:
|
|
1811
|
-
{ x:
|
|
1836
|
+
const l = R.rows ?? [];
|
|
1837
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : (() => {
|
|
1838
|
+
const s = l.length, b = l.reduce((g, k) => g + k.x, 0), M = l.reduce((g, k) => g + k.y, 0), $ = l.reduce((g, k) => g + k.x * k.x, 0), K = l.reduce((g, k) => g + k.x * k.y, 0), ie = s * $ - b * b, I = ie !== 0 ? (s * K - b * M) / ie : 0, A = s > 0 ? (M - I * b) / s : 0, W = l.map((g) => g.x), z = Math.min(...W), r = Math.max(...W), v = [
|
|
1839
|
+
{ x: z, y: A + I * z },
|
|
1840
|
+
{ x: r, y: A + I * r }
|
|
1812
1841
|
];
|
|
1813
|
-
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
|
|
1814
|
-
ComposedChart:
|
|
1815
|
-
Line:
|
|
1842
|
+
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
1843
|
+
ComposedChart: g,
|
|
1844
|
+
Line: k,
|
|
1816
1845
|
ResponsiveContainer: d,
|
|
1817
|
-
Scatter:
|
|
1818
|
-
Tooltip:
|
|
1819
|
-
XAxis:
|
|
1820
|
-
YAxis:
|
|
1821
|
-
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
1846
|
+
Scatter: y,
|
|
1847
|
+
Tooltip: F,
|
|
1848
|
+
XAxis: B,
|
|
1849
|
+
YAxis: G
|
|
1850
|
+
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ i(g, { data: l, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
1822
1851
|
/* @__PURE__ */ e(
|
|
1823
|
-
|
|
1852
|
+
B,
|
|
1824
1853
|
{
|
|
1825
1854
|
dataKey: "x",
|
|
1826
1855
|
type: "number",
|
|
@@ -1829,9 +1858,9 @@ const Tt = Aa(function({
|
|
|
1829
1858
|
domain: ["dataMin", "dataMax"]
|
|
1830
1859
|
}
|
|
1831
1860
|
),
|
|
1832
|
-
/* @__PURE__ */ e(
|
|
1861
|
+
/* @__PURE__ */ e(G, { tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1833
1862
|
/* @__PURE__ */ e(
|
|
1834
|
-
|
|
1863
|
+
F,
|
|
1835
1864
|
{
|
|
1836
1865
|
contentStyle: {
|
|
1837
1866
|
fontSize: 12,
|
|
@@ -1842,11 +1871,11 @@ const Tt = Aa(function({
|
|
|
1842
1871
|
}
|
|
1843
1872
|
}
|
|
1844
1873
|
),
|
|
1845
|
-
/* @__PURE__ */ e(
|
|
1874
|
+
/* @__PURE__ */ e(y, { data: l, dataKey: "y", fill: "#00a5cc", opacity: 0.7 }),
|
|
1846
1875
|
/* @__PURE__ */ e(
|
|
1847
|
-
|
|
1876
|
+
k,
|
|
1848
1877
|
{
|
|
1849
|
-
data:
|
|
1878
|
+
data: v,
|
|
1850
1879
|
dataKey: "y",
|
|
1851
1880
|
stroke: "#f59e0b",
|
|
1852
1881
|
strokeWidth: 2,
|
|
@@ -1857,10 +1886,10 @@ const Tt = Aa(function({
|
|
|
1857
1886
|
] }) }) }) });
|
|
1858
1887
|
})();
|
|
1859
1888
|
} else if (a.type === "pareto") {
|
|
1860
|
-
const l =
|
|
1861
|
-
|
|
1889
|
+
const l = R.series ?? [];
|
|
1890
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: s, ComposedChart: b, Line: M, ResponsiveContainer: $, Tooltip: K, XAxis: ie, YAxis: I }) => /* @__PURE__ */ e($, { width: "100%", height: "100%", children: /* @__PURE__ */ i(b, { data: l, margin: { top: 6, right: 4, left: -10, bottom: 0 }, children: [
|
|
1862
1891
|
/* @__PURE__ */ e(
|
|
1863
|
-
|
|
1892
|
+
ie,
|
|
1864
1893
|
{
|
|
1865
1894
|
dataKey: "dim",
|
|
1866
1895
|
tick: { fontSize: 10 },
|
|
@@ -1870,19 +1899,19 @@ const Tt = Aa(function({
|
|
|
1870
1899
|
height: 42
|
|
1871
1900
|
}
|
|
1872
1901
|
),
|
|
1873
|
-
/* @__PURE__ */ e(
|
|
1902
|
+
/* @__PURE__ */ e(I, { yAxisId: "v", tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1874
1903
|
/* @__PURE__ */ e(
|
|
1875
|
-
|
|
1904
|
+
I,
|
|
1876
1905
|
{
|
|
1877
1906
|
yAxisId: "pct",
|
|
1878
1907
|
orientation: "right",
|
|
1879
1908
|
domain: [0, 100],
|
|
1880
1909
|
tick: { fontSize: 10 },
|
|
1881
|
-
tickFormatter: (
|
|
1910
|
+
tickFormatter: (A) => `${A}%`
|
|
1882
1911
|
}
|
|
1883
1912
|
),
|
|
1884
1913
|
/* @__PURE__ */ e(
|
|
1885
|
-
|
|
1914
|
+
K,
|
|
1886
1915
|
{
|
|
1887
1916
|
contentStyle: {
|
|
1888
1917
|
fontSize: 12,
|
|
@@ -1894,7 +1923,7 @@ const Tt = Aa(function({
|
|
|
1894
1923
|
}
|
|
1895
1924
|
),
|
|
1896
1925
|
/* @__PURE__ */ e(
|
|
1897
|
-
|
|
1926
|
+
s,
|
|
1898
1927
|
{
|
|
1899
1928
|
yAxisId: "v",
|
|
1900
1929
|
dataKey: "value",
|
|
@@ -1904,7 +1933,7 @@ const Tt = Aa(function({
|
|
|
1904
1933
|
}
|
|
1905
1934
|
),
|
|
1906
1935
|
/* @__PURE__ */ e(
|
|
1907
|
-
|
|
1936
|
+
M,
|
|
1908
1937
|
{
|
|
1909
1938
|
yAxisId: "pct",
|
|
1910
1939
|
dataKey: "cum_pct",
|
|
@@ -1916,94 +1945,94 @@ const Tt = Aa(function({
|
|
|
1916
1945
|
)
|
|
1917
1946
|
] }) }) }) });
|
|
1918
1947
|
} else if (a.type === "metric")
|
|
1919
|
-
|
|
1920
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children:
|
|
1921
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((
|
|
1948
|
+
J = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
1949
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children: R.value == null ? "—" : qe(R.value, se) }),
|
|
1950
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((vt = a.config) == null ? void 0 : vt.metric_key) ?? "") })
|
|
1922
1951
|
] });
|
|
1923
1952
|
else if (a.type === "movers") {
|
|
1924
|
-
const l =
|
|
1925
|
-
|
|
1926
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children:
|
|
1953
|
+
const l = R.rows ?? [];
|
|
1954
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No movement in this window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto", children: l.map((s) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-[11.5px]", children: [
|
|
1955
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: s.dim }),
|
|
1927
1956
|
/* @__PURE__ */ i("span", { className: "tabular-nums text-slate-400", children: [
|
|
1928
|
-
|
|
1957
|
+
s.previous.toLocaleString(),
|
|
1929
1958
|
" → ",
|
|
1930
|
-
|
|
1959
|
+
s.current.toLocaleString()
|
|
1931
1960
|
] }),
|
|
1932
1961
|
/* @__PURE__ */ i(
|
|
1933
1962
|
"span",
|
|
1934
1963
|
{
|
|
1935
|
-
className:
|
|
1964
|
+
className: j(
|
|
1936
1965
|
"w-[74px] shrink-0 text-right font-semibold tabular-nums",
|
|
1937
|
-
|
|
1966
|
+
s.delta > 0 ? "text-emerald-600 dark:text-emerald-400" : "text-red-500"
|
|
1938
1967
|
),
|
|
1939
1968
|
children: [
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1969
|
+
s.delta > 0 ? "+" : "",
|
|
1970
|
+
s.delta.toLocaleString(),
|
|
1971
|
+
s.delta_pct != null && /* @__PURE__ */ i("span", { className: "ml-1 text-[10px] font-normal text-slate-400", children: [
|
|
1972
|
+
s.delta_pct > 0 ? "+" : "",
|
|
1973
|
+
s.delta_pct.toFixed(0),
|
|
1945
1974
|
"%"
|
|
1946
1975
|
] })
|
|
1947
1976
|
]
|
|
1948
1977
|
}
|
|
1949
1978
|
)
|
|
1950
|
-
] },
|
|
1979
|
+
] }, s.dim)) });
|
|
1951
1980
|
} else if (a.type === "table") {
|
|
1952
|
-
const l =
|
|
1953
|
-
var
|
|
1954
|
-
for (const
|
|
1955
|
-
if ((
|
|
1956
|
-
return ((
|
|
1981
|
+
const l = R.rows ?? [], s = (Ye = a.config) != null && Ye.columns && a.config.columns.length > 0 ? a.config.columns.map((d) => typeof d == "string" ? { field: d } : d) : l[0] ? Object.keys(l[0]).filter((d) => d !== "id").map((d) => ({ field: d })) : [], b = s.map((d) => d.field), M = (d) => s.find((y) => y.field === d), $ = ((at = a.config) == null ? void 0 : at.format_rules) ?? [], K = (d) => {
|
|
1982
|
+
var y;
|
|
1983
|
+
for (const F of $)
|
|
1984
|
+
if ((F.scope ?? "cell") === "row" && Qt(F, d[F.field]))
|
|
1985
|
+
return ((y = Bt[F.color]) == null ? void 0 : y.row) ?? null;
|
|
1957
1986
|
return null;
|
|
1958
|
-
},
|
|
1959
|
-
var
|
|
1960
|
-
for (const
|
|
1961
|
-
if ((
|
|
1962
|
-
return ((
|
|
1987
|
+
}, ie = (d, y) => {
|
|
1988
|
+
var F;
|
|
1989
|
+
for (const B of $)
|
|
1990
|
+
if ((B.scope ?? "cell") === "cell" && B.field === y && Qt(B, d[y]))
|
|
1991
|
+
return ((F = Bt[B.color]) == null ? void 0 : F.cell) ?? null;
|
|
1963
1992
|
return null;
|
|
1964
|
-
},
|
|
1965
|
-
(d) =>
|
|
1966
|
-
const
|
|
1967
|
-
return Number.isFinite(
|
|
1993
|
+
}, I = ee.trim().toLowerCase(), A = a.config, W = A != null && A.suppress_zero ? l.filter(
|
|
1994
|
+
(d) => b.some((y) => {
|
|
1995
|
+
const F = Number(d[y]);
|
|
1996
|
+
return Number.isFinite(F) && F !== 0;
|
|
1968
1997
|
})
|
|
1969
|
-
) : l,
|
|
1998
|
+
) : l, z = I ? W.filter(
|
|
1970
1999
|
(d) => Object.values(d).some(
|
|
1971
|
-
(
|
|
2000
|
+
(y) => String(y ?? "").toLowerCase().includes(I)
|
|
1972
2001
|
)
|
|
1973
|
-
) :
|
|
1974
|
-
|
|
1975
|
-
l.length >
|
|
2002
|
+
) : W, r = 12, v = Math.max(1, Math.ceil(z.length / r)), g = Math.min(ue, v - 1), k = z.length > r ? z.slice(g * r, g * r + r) : z;
|
|
2003
|
+
J = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No rows." }) : /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
2004
|
+
l.length > r && /* @__PURE__ */ i("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
1976
2005
|
/* @__PURE__ */ e(
|
|
1977
2006
|
"input",
|
|
1978
2007
|
{
|
|
1979
|
-
value:
|
|
2008
|
+
value: ee,
|
|
1980
2009
|
onChange: (d) => {
|
|
1981
|
-
H(d.target.value),
|
|
2010
|
+
H(d.target.value), pe(0);
|
|
1982
2011
|
},
|
|
1983
2012
|
placeholder: "Search rows…",
|
|
1984
2013
|
className: "h-6 w-40 rounded border border-slate-200 bg-white px-1.5 text-[11px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
1985
2014
|
}
|
|
1986
2015
|
),
|
|
1987
|
-
|
|
2016
|
+
v > 1 && /* @__PURE__ */ i("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
1988
2017
|
/* @__PURE__ */ e(
|
|
1989
2018
|
"button",
|
|
1990
2019
|
{
|
|
1991
2020
|
type: "button",
|
|
1992
|
-
disabled:
|
|
1993
|
-
onClick: () =>
|
|
2021
|
+
disabled: g <= 0,
|
|
2022
|
+
onClick: () => pe(g - 1),
|
|
1994
2023
|
className: "rounded px-1 disabled:opacity-30",
|
|
1995
2024
|
children: "←"
|
|
1996
2025
|
}
|
|
1997
2026
|
),
|
|
1998
|
-
|
|
2027
|
+
g + 1,
|
|
1999
2028
|
"/",
|
|
2000
|
-
|
|
2029
|
+
v,
|
|
2001
2030
|
/* @__PURE__ */ e(
|
|
2002
2031
|
"button",
|
|
2003
2032
|
{
|
|
2004
2033
|
type: "button",
|
|
2005
|
-
disabled:
|
|
2006
|
-
onClick: () =>
|
|
2034
|
+
disabled: g >= v - 1,
|
|
2035
|
+
onClick: () => pe(g + 1),
|
|
2007
2036
|
className: "rounded px-1 disabled:opacity-30",
|
|
2008
2037
|
children: "→"
|
|
2009
2038
|
}
|
|
@@ -2011,56 +2040,56 @@ const Tt = Aa(function({
|
|
|
2011
2040
|
] })
|
|
2012
2041
|
] }),
|
|
2013
2042
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full text-[11.5px]", children: [
|
|
2014
|
-
/* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children:
|
|
2015
|
-
var
|
|
2043
|
+
/* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: b.map((d) => {
|
|
2044
|
+
var y;
|
|
2016
2045
|
return /* @__PURE__ */ e(
|
|
2017
2046
|
"th",
|
|
2018
2047
|
{
|
|
2019
2048
|
className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
2020
|
-
children: ((
|
|
2049
|
+
children: ((y = M(d)) == null ? void 0 : y.label) ?? d
|
|
2021
2050
|
},
|
|
2022
2051
|
d
|
|
2023
2052
|
);
|
|
2024
2053
|
}) }) }),
|
|
2025
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
2054
|
+
/* @__PURE__ */ e("tbody", { children: k.map((d) => /* @__PURE__ */ e(
|
|
2026
2055
|
"tr",
|
|
2027
2056
|
{
|
|
2028
|
-
className:
|
|
2029
|
-
|
|
2057
|
+
className: j(
|
|
2058
|
+
K(d),
|
|
2030
2059
|
a.collection && d.id != null && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60"
|
|
2031
2060
|
),
|
|
2032
2061
|
onClick: () => {
|
|
2033
2062
|
a.collection && d.id != null && (f == null || f({ collection: a.collection, itemId: String(d.id) }));
|
|
2034
2063
|
},
|
|
2035
|
-
children:
|
|
2036
|
-
var
|
|
2064
|
+
children: b.map((y) => {
|
|
2065
|
+
var F, B, G, Q;
|
|
2037
2066
|
return /* @__PURE__ */ e(
|
|
2038
2067
|
"td",
|
|
2039
2068
|
{
|
|
2040
|
-
className:
|
|
2069
|
+
className: j(
|
|
2041
2070
|
"max-w-[180px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
|
|
2042
|
-
(typeof d[
|
|
2043
|
-
|
|
2071
|
+
(typeof d[y] == "number" || ze.has(((F = M(y)) == null ? void 0 : F.format) ?? "")) && "text-right tabular-nums",
|
|
2072
|
+
ie(d, y)
|
|
2044
2073
|
),
|
|
2045
|
-
children: (
|
|
2074
|
+
children: (B = M(y)) != null && B.format ? je(d[y], (G = M(y)) == null ? void 0 : G.format, (Q = M(y)) == null ? void 0 : Q.decimals) : String(d[y] ?? "")
|
|
2046
2075
|
},
|
|
2047
|
-
|
|
2076
|
+
y
|
|
2048
2077
|
);
|
|
2049
2078
|
})
|
|
2050
2079
|
},
|
|
2051
2080
|
String(d.id)
|
|
2052
2081
|
)) }),
|
|
2053
|
-
(
|
|
2054
|
-
var
|
|
2055
|
-
const
|
|
2082
|
+
(A == null ? void 0 : A.grand_total) && z.length > 1 && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e("tr", { className: "border-t border-slate-200 font-semibold dark:border-border", children: b.map((d, y) => {
|
|
2083
|
+
var Q, Se, Pe;
|
|
2084
|
+
const F = z.map((dt) => Number(dt[d])).filter((dt) => Number.isFinite(dt)), B = F.length > z.length / 2, G = F.reduce((dt, ma) => dt + ma, 0);
|
|
2056
2085
|
return /* @__PURE__ */ e(
|
|
2057
2086
|
"td",
|
|
2058
2087
|
{
|
|
2059
|
-
className:
|
|
2088
|
+
className: j(
|
|
2060
2089
|
"px-1.5 py-1 text-slate-800 dark:text-slate-100",
|
|
2061
|
-
|
|
2090
|
+
B && "text-right tabular-nums"
|
|
2062
2091
|
),
|
|
2063
|
-
children:
|
|
2092
|
+
children: y === 0 && !B ? "Total" : B ? (Q = M(d)) != null && Q.format ? je(G, (Se = M(d)) == null ? void 0 : Se.format, (Pe = M(d)) == null ? void 0 : Pe.decimals) : G.toLocaleString() : ""
|
|
2064
2093
|
},
|
|
2065
2094
|
d
|
|
2066
2095
|
);
|
|
@@ -2068,38 +2097,38 @@ const Tt = Aa(function({
|
|
|
2068
2097
|
] }) })
|
|
2069
2098
|
] });
|
|
2070
2099
|
} else {
|
|
2071
|
-
let l =
|
|
2072
|
-
const
|
|
2073
|
-
if (
|
|
2074
|
-
if (
|
|
2075
|
-
const
|
|
2076
|
-
return { ...
|
|
2077
|
-
})),
|
|
2078
|
-
let
|
|
2079
|
-
l = l.map((
|
|
2080
|
-
...
|
|
2081
|
-
value:
|
|
2082
|
-
...
|
|
2083
|
-
...
|
|
2100
|
+
let l = R.series ?? [];
|
|
2101
|
+
const s = !!((lt = (Je = a.config) == null ? void 0 : Je.dimension) != null && lt.bucket), b = Number((rt = a.config) == null ? void 0 : rt.rolling_avg) || 0;
|
|
2102
|
+
if (b >= 2 && s && !te && l.length >= b && (l = l.map((A, W) => {
|
|
2103
|
+
if (W < b - 1) return A;
|
|
2104
|
+
const z = l.slice(W - b + 1, W + 1);
|
|
2105
|
+
return { ...A, ma: z.reduce((r, v) => r + v.value, 0) / b };
|
|
2106
|
+
})), te && s) {
|
|
2107
|
+
let A = 0, W = 0, z = 0;
|
|
2108
|
+
l = l.map((r) => (A += r.value, W += r.prev ?? 0, z += r.value2 ?? 0, {
|
|
2109
|
+
...r,
|
|
2110
|
+
value: A,
|
|
2111
|
+
...r.prev != null ? { prev: W } : {},
|
|
2112
|
+
...r.value2 != null ? { value2: z } : {}
|
|
2084
2113
|
}));
|
|
2085
2114
|
}
|
|
2086
|
-
const
|
|
2087
|
-
if (!
|
|
2088
|
-
const
|
|
2089
|
-
return
|
|
2090
|
-
l.filter((
|
|
2115
|
+
const M = l.some((A) => A.value2 != null), $ = ((re = (nt = a.config) == null ? void 0 : nt.metric2) == null ? void 0 : re.label) ?? "secondary", K = l.some((A) => A.band != null), ie = (() => {
|
|
2116
|
+
if (!s || te || l.length < 8) return /* @__PURE__ */ new Set();
|
|
2117
|
+
const A = l.map((r) => r.value), W = A.reduce((r, v) => r + v, 0) / A.length, z = Math.sqrt(A.reduce((r, v) => r + (v - W) ** 2, 0) / A.length);
|
|
2118
|
+
return z === 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
2119
|
+
l.filter((r) => Math.abs(r.value - W) > 2 * z).map((r) => r.dim)
|
|
2091
2120
|
);
|
|
2092
|
-
})(),
|
|
2093
|
-
(
|
|
2121
|
+
})(), I = (q ?? []).filter(
|
|
2122
|
+
(A) => A.anchor_date && l.some((W) => W.dim === A.anchor_date)
|
|
2094
2123
|
);
|
|
2095
|
-
if (l.length === 0)
|
|
2124
|
+
if (l.length === 0) J = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
2096
2125
|
else if (a.type === "donut") {
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2126
|
+
const A = l.reduce((W, z) => W + z.value, 0);
|
|
2127
|
+
J = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
2099
2128
|
/* @__PURE__ */ i("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
2100
|
-
/* @__PURE__ */ e(
|
|
2129
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: W, Pie: z, PieChart: r, ResponsiveContainer: v, Tooltip: g }) => /* @__PURE__ */ e(v, { width: "100%", height: "100%", children: /* @__PURE__ */ i(r, { children: [
|
|
2101
2130
|
/* @__PURE__ */ e(
|
|
2102
|
-
|
|
2131
|
+
z,
|
|
2103
2132
|
{
|
|
2104
2133
|
data: l,
|
|
2105
2134
|
dataKey: "value",
|
|
@@ -2109,46 +2138,46 @@ const Tt = Aa(function({
|
|
|
2109
2138
|
paddingAngle: 2,
|
|
2110
2139
|
strokeWidth: 0,
|
|
2111
2140
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2112
|
-
onClick: (
|
|
2113
|
-
var
|
|
2141
|
+
onClick: (k) => {
|
|
2142
|
+
var F, B, G, Q;
|
|
2114
2143
|
if (!a.collection) return;
|
|
2115
|
-
const d =
|
|
2144
|
+
const d = k == null ? void 0 : k.payload;
|
|
2116
2145
|
if (d != null && d.other) return;
|
|
2117
|
-
if (
|
|
2118
|
-
const
|
|
2119
|
-
if (
|
|
2120
|
-
|
|
2121
|
-
...
|
|
2122
|
-
{ field:
|
|
2146
|
+
if (Be.length > ae.length) {
|
|
2147
|
+
const Se = ae.length === 0 ? (B = (F = a.config) == null ? void 0 : F.dimension) == null ? void 0 : B.field : Be[ae.length - 1];
|
|
2148
|
+
if (Se) {
|
|
2149
|
+
S((Pe) => [
|
|
2150
|
+
...Pe,
|
|
2151
|
+
{ field: Se, value: String((d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim) ?? "") }
|
|
2123
2152
|
]);
|
|
2124
2153
|
return;
|
|
2125
2154
|
}
|
|
2126
2155
|
}
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
conditions:
|
|
2156
|
+
const y = (Q = (G = a.config) == null ? void 0 : G.dimension) == null ? void 0 : Q.field;
|
|
2157
|
+
de({
|
|
2158
|
+
conditions: Mt(
|
|
2130
2159
|
a,
|
|
2131
|
-
|
|
2160
|
+
c,
|
|
2132
2161
|
o,
|
|
2133
2162
|
(d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim)
|
|
2134
2163
|
),
|
|
2135
2164
|
title: `${a.title || a.collection} — ${(d == null ? void 0 : d.dim) ?? ""}`,
|
|
2136
|
-
dimField:
|
|
2165
|
+
dimField: y,
|
|
2137
2166
|
dimRaw: (d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim),
|
|
2138
2167
|
dimLabel: d == null ? void 0 : d.dim
|
|
2139
2168
|
});
|
|
2140
2169
|
},
|
|
2141
|
-
children: l.map((
|
|
2142
|
-
|
|
2170
|
+
children: l.map((k, d) => /* @__PURE__ */ e(
|
|
2171
|
+
W,
|
|
2143
2172
|
{
|
|
2144
|
-
fill:
|
|
2173
|
+
fill: k.other ? "#94a3b8" : oe[d % oe.length]
|
|
2145
2174
|
},
|
|
2146
|
-
|
|
2175
|
+
k.dim
|
|
2147
2176
|
))
|
|
2148
2177
|
}
|
|
2149
2178
|
),
|
|
2150
2179
|
/* @__PURE__ */ e(
|
|
2151
|
-
|
|
2180
|
+
g,
|
|
2152
2181
|
{
|
|
2153
2182
|
contentStyle: {
|
|
2154
2183
|
fontSize: 12,
|
|
@@ -2163,42 +2192,42 @@ const Tt = Aa(function({
|
|
|
2163
2192
|
)
|
|
2164
2193
|
] }) }) }),
|
|
2165
2194
|
/* @__PURE__ */ i("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
2166
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children:
|
|
2195
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: A.toLocaleString() }),
|
|
2167
2196
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
2168
2197
|
] })
|
|
2169
2198
|
] }),
|
|
2170
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: l.slice(0, 10).map((
|
|
2199
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: l.slice(0, 10).map((W, z) => /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
2171
2200
|
/* @__PURE__ */ e(
|
|
2172
2201
|
"span",
|
|
2173
2202
|
{
|
|
2174
2203
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
2175
|
-
style: { background:
|
|
2204
|
+
style: { background: oe[z % oe.length] }
|
|
2176
2205
|
}
|
|
2177
2206
|
),
|
|
2178
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
2179
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children:
|
|
2180
|
-
] },
|
|
2207
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: W.dim }),
|
|
2208
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: W.value.toLocaleString() })
|
|
2209
|
+
] }, W.dim)) })
|
|
2181
2210
|
] });
|
|
2182
2211
|
} else if (a.type === "line")
|
|
2183
|
-
|
|
2184
|
-
Area:
|
|
2185
|
-
ComposedChart:
|
|
2186
|
-
Line:
|
|
2187
|
-
ReferenceLine:
|
|
2188
|
-
ResponsiveContainer:
|
|
2189
|
-
Tooltip:
|
|
2190
|
-
XAxis:
|
|
2212
|
+
J = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2213
|
+
Area: A,
|
|
2214
|
+
ComposedChart: W,
|
|
2215
|
+
Line: z,
|
|
2216
|
+
ReferenceLine: r,
|
|
2217
|
+
ResponsiveContainer: v,
|
|
2218
|
+
Tooltip: g,
|
|
2219
|
+
XAxis: k,
|
|
2191
2220
|
YAxis: d
|
|
2192
2221
|
}) => {
|
|
2193
|
-
var
|
|
2194
|
-
return /* @__PURE__ */ e(
|
|
2195
|
-
|
|
2222
|
+
var y;
|
|
2223
|
+
return /* @__PURE__ */ e(v, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
2224
|
+
W,
|
|
2196
2225
|
{
|
|
2197
2226
|
data: l,
|
|
2198
|
-
margin: { top: 6, right:
|
|
2227
|
+
margin: { top: 6, right: M ? 4 : 8, left: -10, bottom: 0 },
|
|
2199
2228
|
children: [
|
|
2200
2229
|
/* @__PURE__ */ e(
|
|
2201
|
-
|
|
2230
|
+
k,
|
|
2202
2231
|
{
|
|
2203
2232
|
dataKey: "dim",
|
|
2204
2233
|
tick: { fontSize: 10 },
|
|
@@ -2215,7 +2244,7 @@ const Tt = Aa(function({
|
|
|
2215
2244
|
width: 44
|
|
2216
2245
|
}
|
|
2217
2246
|
),
|
|
2218
|
-
|
|
2247
|
+
M && /* @__PURE__ */ e(
|
|
2219
2248
|
d,
|
|
2220
2249
|
{
|
|
2221
2250
|
yAxisId: "right",
|
|
@@ -2226,18 +2255,18 @@ const Tt = Aa(function({
|
|
|
2226
2255
|
width: 44
|
|
2227
2256
|
}
|
|
2228
2257
|
),
|
|
2229
|
-
|
|
2230
|
-
|
|
2258
|
+
I.map((F) => /* @__PURE__ */ e(
|
|
2259
|
+
r,
|
|
2231
2260
|
{
|
|
2232
|
-
x:
|
|
2261
|
+
x: F.anchor_date,
|
|
2233
2262
|
stroke: "#f59e0b",
|
|
2234
2263
|
strokeDasharray: "4 3",
|
|
2235
2264
|
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2236
2265
|
},
|
|
2237
|
-
|
|
2266
|
+
F.id
|
|
2238
2267
|
)),
|
|
2239
2268
|
/* @__PURE__ */ e(
|
|
2240
|
-
|
|
2269
|
+
g,
|
|
2241
2270
|
{
|
|
2242
2271
|
contentStyle: {
|
|
2243
2272
|
fontSize: 12,
|
|
@@ -2250,8 +2279,8 @@ const Tt = Aa(function({
|
|
|
2250
2279
|
itemStyle: { color: "#e2e8f0" }
|
|
2251
2280
|
}
|
|
2252
2281
|
),
|
|
2253
|
-
|
|
2254
|
-
|
|
2282
|
+
K && /* @__PURE__ */ e(
|
|
2283
|
+
A,
|
|
2255
2284
|
{
|
|
2256
2285
|
type: "monotone",
|
|
2257
2286
|
dataKey: "band",
|
|
@@ -2262,8 +2291,8 @@ const Tt = Aa(function({
|
|
|
2262
2291
|
activeDot: !1
|
|
2263
2292
|
}
|
|
2264
2293
|
),
|
|
2265
|
-
((
|
|
2266
|
-
|
|
2294
|
+
((y = a.config) == null ? void 0 : y.compare) && /* @__PURE__ */ e(
|
|
2295
|
+
z,
|
|
2267
2296
|
{
|
|
2268
2297
|
type: "monotone",
|
|
2269
2298
|
dataKey: "prev",
|
|
@@ -2275,31 +2304,31 @@ const Tt = Aa(function({
|
|
|
2275
2304
|
}
|
|
2276
2305
|
),
|
|
2277
2306
|
/* @__PURE__ */ e(
|
|
2278
|
-
|
|
2307
|
+
z,
|
|
2279
2308
|
{
|
|
2280
2309
|
type: "monotone",
|
|
2281
2310
|
dataKey: "value",
|
|
2282
|
-
stroke:
|
|
2311
|
+
stroke: Ge,
|
|
2283
2312
|
strokeWidth: 2,
|
|
2284
|
-
dot: (
|
|
2285
|
-
var
|
|
2286
|
-
return
|
|
2313
|
+
dot: (F) => {
|
|
2314
|
+
var B, G, Q;
|
|
2315
|
+
return ie.has(((B = F.payload) == null ? void 0 : B.dim) ?? "") ? /* @__PURE__ */ e(
|
|
2287
2316
|
"circle",
|
|
2288
2317
|
{
|
|
2289
|
-
cx:
|
|
2290
|
-
cy:
|
|
2318
|
+
cx: F.cx,
|
|
2319
|
+
cy: F.cy,
|
|
2291
2320
|
r: 3.5,
|
|
2292
2321
|
fill: "#ef4444",
|
|
2293
2322
|
stroke: "#fff",
|
|
2294
2323
|
strokeWidth: 1
|
|
2295
2324
|
},
|
|
2296
|
-
(
|
|
2297
|
-
) : /* @__PURE__ */ e("g", {}, (
|
|
2325
|
+
(G = F.payload) == null ? void 0 : G.dim
|
|
2326
|
+
) : /* @__PURE__ */ e("g", {}, (Q = F.payload) == null ? void 0 : Q.dim);
|
|
2298
2327
|
}
|
|
2299
2328
|
}
|
|
2300
2329
|
),
|
|
2301
|
-
|
|
2302
|
-
|
|
2330
|
+
M && /* @__PURE__ */ e(
|
|
2331
|
+
z,
|
|
2303
2332
|
{
|
|
2304
2333
|
yAxisId: "right",
|
|
2305
2334
|
type: "monotone",
|
|
@@ -2307,11 +2336,11 @@ const Tt = Aa(function({
|
|
|
2307
2336
|
stroke: "#8b5cf6",
|
|
2308
2337
|
strokeWidth: 1.5,
|
|
2309
2338
|
dot: !1,
|
|
2310
|
-
name:
|
|
2339
|
+
name: $
|
|
2311
2340
|
}
|
|
2312
2341
|
),
|
|
2313
|
-
|
|
2314
|
-
|
|
2342
|
+
b >= 2 && /* @__PURE__ */ e(
|
|
2343
|
+
z,
|
|
2315
2344
|
{
|
|
2316
2345
|
type: "monotone",
|
|
2317
2346
|
dataKey: "ma",
|
|
@@ -2319,7 +2348,7 @@ const Tt = Aa(function({
|
|
|
2319
2348
|
strokeWidth: 1.5,
|
|
2320
2349
|
strokeDasharray: "5 3",
|
|
2321
2350
|
dot: !1,
|
|
2322
|
-
name: `${
|
|
2351
|
+
name: `${b}-bucket avg`,
|
|
2323
2352
|
isAnimationActive: !1
|
|
2324
2353
|
}
|
|
2325
2354
|
)
|
|
@@ -2328,30 +2357,30 @@ const Tt = Aa(function({
|
|
|
2328
2357
|
) });
|
|
2329
2358
|
} }) });
|
|
2330
2359
|
else {
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2333
|
-
Bar:
|
|
2334
|
-
Cell:
|
|
2335
|
-
ComposedChart:
|
|
2336
|
-
Line:
|
|
2337
|
-
ReferenceLine:
|
|
2338
|
-
ResponsiveContainer:
|
|
2360
|
+
const A = ((yt = a.config) == null ? void 0 : yt.orientation) === "horizontal";
|
|
2361
|
+
J = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2362
|
+
Bar: W,
|
|
2363
|
+
Cell: z,
|
|
2364
|
+
ComposedChart: r,
|
|
2365
|
+
Line: v,
|
|
2366
|
+
ReferenceLine: g,
|
|
2367
|
+
ResponsiveContainer: k,
|
|
2339
2368
|
Tooltip: d,
|
|
2340
|
-
XAxis:
|
|
2341
|
-
YAxis:
|
|
2369
|
+
XAxis: y,
|
|
2370
|
+
YAxis: F
|
|
2342
2371
|
}) => {
|
|
2343
|
-
var
|
|
2344
|
-
return /* @__PURE__ */ e(
|
|
2345
|
-
|
|
2372
|
+
var B;
|
|
2373
|
+
return /* @__PURE__ */ e(k, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
2374
|
+
r,
|
|
2346
2375
|
{
|
|
2347
2376
|
data: l,
|
|
2348
|
-
layout:
|
|
2349
|
-
margin: { top: 6, right: 8, left:
|
|
2377
|
+
layout: A ? "vertical" : "horizontal",
|
|
2378
|
+
margin: { top: 6, right: 8, left: A ? 30 : -10, bottom: 0 },
|
|
2350
2379
|
children: [
|
|
2351
|
-
|
|
2352
|
-
/* @__PURE__ */ e(
|
|
2380
|
+
A ? /* @__PURE__ */ i(He, { children: [
|
|
2381
|
+
/* @__PURE__ */ e(y, { type: "number", tick: { fontSize: 10 }, stroke: "#94a3b8" }),
|
|
2353
2382
|
/* @__PURE__ */ e(
|
|
2354
|
-
|
|
2383
|
+
F,
|
|
2355
2384
|
{
|
|
2356
2385
|
type: "category",
|
|
2357
2386
|
dataKey: "dim",
|
|
@@ -2360,9 +2389,9 @@ const Tt = Aa(function({
|
|
|
2360
2389
|
width: 90
|
|
2361
2390
|
}
|
|
2362
2391
|
)
|
|
2363
|
-
] }) : /* @__PURE__ */ i(
|
|
2392
|
+
] }) : /* @__PURE__ */ i(He, { children: [
|
|
2364
2393
|
/* @__PURE__ */ e(
|
|
2365
|
-
|
|
2394
|
+
y,
|
|
2366
2395
|
{
|
|
2367
2396
|
dataKey: "dim",
|
|
2368
2397
|
tick: { fontSize: 10 },
|
|
@@ -2371,7 +2400,7 @@ const Tt = Aa(function({
|
|
|
2371
2400
|
}
|
|
2372
2401
|
),
|
|
2373
2402
|
/* @__PURE__ */ e(
|
|
2374
|
-
|
|
2403
|
+
F,
|
|
2375
2404
|
{
|
|
2376
2405
|
tick: { fontSize: 10 },
|
|
2377
2406
|
stroke: "#94a3b8",
|
|
@@ -2379,8 +2408,8 @@ const Tt = Aa(function({
|
|
|
2379
2408
|
width: 44
|
|
2380
2409
|
}
|
|
2381
2410
|
),
|
|
2382
|
-
|
|
2383
|
-
|
|
2411
|
+
M && /* @__PURE__ */ e(
|
|
2412
|
+
F,
|
|
2384
2413
|
{
|
|
2385
2414
|
yAxisId: "right",
|
|
2386
2415
|
orientation: "right",
|
|
@@ -2391,15 +2420,15 @@ const Tt = Aa(function({
|
|
|
2391
2420
|
}
|
|
2392
2421
|
)
|
|
2393
2422
|
] }),
|
|
2394
|
-
!
|
|
2395
|
-
|
|
2423
|
+
!A && I.map((G) => /* @__PURE__ */ e(
|
|
2424
|
+
g,
|
|
2396
2425
|
{
|
|
2397
|
-
x:
|
|
2426
|
+
x: G.anchor_date,
|
|
2398
2427
|
stroke: "#f59e0b",
|
|
2399
2428
|
strokeDasharray: "4 3",
|
|
2400
2429
|
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2401
2430
|
},
|
|
2402
|
-
|
|
2431
|
+
G.id
|
|
2403
2432
|
)),
|
|
2404
2433
|
/* @__PURE__ */ e(
|
|
2405
2434
|
d,
|
|
@@ -2415,46 +2444,46 @@ const Tt = Aa(function({
|
|
|
2415
2444
|
itemStyle: { color: "#e2e8f0" }
|
|
2416
2445
|
}
|
|
2417
2446
|
),
|
|
2418
|
-
((
|
|
2447
|
+
((B = a.config) == null ? void 0 : B.compare) && /* @__PURE__ */ e(W, { dataKey: "prev", fill: "#cbd5e1", radius: [3, 3, 0, 0], name: "previous" }),
|
|
2419
2448
|
/* @__PURE__ */ e(
|
|
2420
|
-
|
|
2449
|
+
W,
|
|
2421
2450
|
{
|
|
2422
2451
|
dataKey: "value",
|
|
2423
|
-
fill:
|
|
2452
|
+
fill: Ge,
|
|
2424
2453
|
radius: [3, 3, 0, 0],
|
|
2425
2454
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2426
|
-
onClick: (
|
|
2427
|
-
var
|
|
2455
|
+
onClick: (G) => {
|
|
2456
|
+
var Pe;
|
|
2428
2457
|
if (!a.collection) return;
|
|
2429
|
-
const
|
|
2430
|
-
if (
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2433
|
-
conditions:
|
|
2458
|
+
const Q = G == null ? void 0 : G.payload;
|
|
2459
|
+
if (Q != null && Q.other) return;
|
|
2460
|
+
const Se = (Pe = a.config) == null ? void 0 : Pe.dimension;
|
|
2461
|
+
de({
|
|
2462
|
+
conditions: Mt(
|
|
2434
2463
|
a,
|
|
2435
|
-
|
|
2464
|
+
c,
|
|
2436
2465
|
o,
|
|
2437
|
-
(
|
|
2466
|
+
(Q == null ? void 0 : Q.raw) ?? (Q == null ? void 0 : Q.dim)
|
|
2438
2467
|
),
|
|
2439
|
-
title: `${a.title || a.collection} — ${(
|
|
2440
|
-
dimField:
|
|
2441
|
-
dimRaw: (
|
|
2442
|
-
dimLabel:
|
|
2468
|
+
title: `${a.title || a.collection} — ${(Q == null ? void 0 : Q.dim) ?? ""}`,
|
|
2469
|
+
dimField: Se != null && Se.bucket || Se == null ? void 0 : Se.field,
|
|
2470
|
+
dimRaw: (Q == null ? void 0 : Q.raw) ?? (Q == null ? void 0 : Q.dim),
|
|
2471
|
+
dimLabel: Q == null ? void 0 : Q.dim
|
|
2443
2472
|
});
|
|
2444
2473
|
},
|
|
2445
|
-
children: l.map((
|
|
2474
|
+
children: l.map((G) => /* @__PURE__ */ e(z, { fill: G.other ? "#94a3b8" : Ge }, G.dim))
|
|
2446
2475
|
}
|
|
2447
2476
|
),
|
|
2448
|
-
|
|
2449
|
-
|
|
2477
|
+
M && /* @__PURE__ */ e(
|
|
2478
|
+
v,
|
|
2450
2479
|
{
|
|
2451
|
-
yAxisId:
|
|
2480
|
+
yAxisId: A ? void 0 : "right",
|
|
2452
2481
|
type: "monotone",
|
|
2453
2482
|
dataKey: "value2",
|
|
2454
2483
|
stroke: "#8b5cf6",
|
|
2455
2484
|
strokeWidth: 1.5,
|
|
2456
2485
|
dot: !1,
|
|
2457
|
-
name:
|
|
2486
|
+
name: $
|
|
2458
2487
|
}
|
|
2459
2488
|
)
|
|
2460
2489
|
]
|
|
@@ -2463,8 +2492,8 @@ const Tt = Aa(function({
|
|
|
2463
2492
|
} }) });
|
|
2464
2493
|
}
|
|
2465
2494
|
}
|
|
2466
|
-
return L && p && (
|
|
2467
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" : qe(p.value,
|
|
2495
|
+
return L && p && (J = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2496
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" : qe(p.value, se) }),
|
|
2468
2497
|
/* @__PURE__ */ i("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
2469
2498
|
"As of ",
|
|
2470
2499
|
p.name,
|
|
@@ -2474,21 +2503,21 @@ const Tt = Aa(function({
|
|
|
2474
2503
|
"div",
|
|
2475
2504
|
{
|
|
2476
2505
|
className: "flex min-h-0 flex-col overflow-hidden rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
2477
|
-
style:
|
|
2506
|
+
style: et,
|
|
2478
2507
|
children: [
|
|
2479
2508
|
/* @__PURE__ */ i("div", { className: "mb-1.5 flex items-center gap-1.5", children: [
|
|
2480
2509
|
(() => {
|
|
2481
|
-
var
|
|
2482
|
-
const l = (
|
|
2483
|
-
return l != null && l.report_id &&
|
|
2510
|
+
var s;
|
|
2511
|
+
const l = (s = a.config) == null ? void 0 : s.link_report;
|
|
2512
|
+
return l != null && l.report_id && N ? /* @__PURE__ */ i(
|
|
2484
2513
|
"a",
|
|
2485
2514
|
{
|
|
2486
|
-
href:
|
|
2515
|
+
href: N(l.report_id),
|
|
2487
2516
|
onClick: () => {
|
|
2488
2517
|
try {
|
|
2489
2518
|
sessionStorage.setItem(
|
|
2490
2519
|
`nvr-report-xf:${l.report_id}`,
|
|
2491
|
-
JSON.stringify(
|
|
2520
|
+
JSON.stringify(U ?? [])
|
|
2492
2521
|
);
|
|
2493
2522
|
} catch {
|
|
2494
2523
|
}
|
|
@@ -2505,9 +2534,9 @@ const Tt = Aa(function({
|
|
|
2505
2534
|
/* @__PURE__ */ e(
|
|
2506
2535
|
"span",
|
|
2507
2536
|
{
|
|
2508
|
-
"data-tip":
|
|
2537
|
+
"data-tip": Et(a),
|
|
2509
2538
|
className: "shrink-0 cursor-help text-slate-300 hover:text-slate-500",
|
|
2510
|
-
children: /* @__PURE__ */ e(
|
|
2539
|
+
children: /* @__PURE__ */ e(Ca, { className: "h-3 w-3" })
|
|
2511
2540
|
}
|
|
2512
2541
|
),
|
|
2513
2542
|
/* @__PURE__ */ i("span", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
@@ -2515,13 +2544,13 @@ const Tt = Aa(function({
|
|
|
2515
2544
|
"button",
|
|
2516
2545
|
{
|
|
2517
2546
|
type: "button",
|
|
2518
|
-
title:
|
|
2519
|
-
className:
|
|
2547
|
+
title: he ? "Back to the chart" : "View as table (#383)",
|
|
2548
|
+
className: j(
|
|
2520
2549
|
"rounded p-0.5",
|
|
2521
|
-
|
|
2550
|
+
he ? "text-[#00a5cc]" : "text-slate-300 hover:text-[#00a5cc]"
|
|
2522
2551
|
),
|
|
2523
2552
|
onClick: () => le((l) => !l),
|
|
2524
|
-
children: /* @__PURE__ */ e(
|
|
2553
|
+
children: /* @__PURE__ */ e($a, { className: "h-3 w-3" })
|
|
2525
2554
|
}
|
|
2526
2555
|
),
|
|
2527
2556
|
["bar", "line", "donut", "pareto", "scatter", "heatmap", "waterfall"].includes(
|
|
@@ -2532,85 +2561,85 @@ const Tt = Aa(function({
|
|
|
2532
2561
|
type: "button",
|
|
2533
2562
|
title: "Copy chart as image",
|
|
2534
2563
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2535
|
-
onClick: () => void
|
|
2536
|
-
children: /* @__PURE__ */ e(
|
|
2564
|
+
onClick: () => void Ha(T.current, a.title),
|
|
2565
|
+
children: /* @__PURE__ */ e(wt, { className: "h-3 w-3" })
|
|
2537
2566
|
}
|
|
2538
2567
|
),
|
|
2539
2568
|
/* @__PURE__ */ e(
|
|
2540
2569
|
"button",
|
|
2541
2570
|
{
|
|
2542
2571
|
type: "button",
|
|
2543
|
-
title:
|
|
2544
|
-
"data-explain-trend":
|
|
2572
|
+
title: we ? "Explain the trend" : "Explain this number",
|
|
2573
|
+
"data-explain-trend": we ? "1" : void 0,
|
|
2545
2574
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2546
2575
|
onClick: () => {
|
|
2547
|
-
if (
|
|
2548
|
-
|
|
2576
|
+
if (Y) {
|
|
2577
|
+
ne(!1);
|
|
2549
2578
|
return;
|
|
2550
2579
|
}
|
|
2551
|
-
if (
|
|
2552
|
-
if (
|
|
2580
|
+
if (ne(!0), ce || _) return;
|
|
2581
|
+
if (D(!0), we) {
|
|
2553
2582
|
O.request(
|
|
2554
|
-
|
|
2583
|
+
pt(`/report-studio/${n}/widgets/${a.id}/explain-trend`, {
|
|
2555
2584
|
date_range: o,
|
|
2556
|
-
entity_filters:
|
|
2585
|
+
entity_filters: c
|
|
2557
2586
|
})
|
|
2558
|
-
).then((
|
|
2559
|
-
|
|
2587
|
+
).then((s) => {
|
|
2588
|
+
fe(s.data.explanation || "No explanation available."), ve(s.data.movers ?? null);
|
|
2560
2589
|
}).catch(
|
|
2561
|
-
(
|
|
2562
|
-
(
|
|
2590
|
+
(s) => fe(
|
|
2591
|
+
(s == null ? void 0 : s.status) === 503 ? "AI is not configured on this instance." : (s == null ? void 0 : s.status) === 400 ? s.message ?? "Not enough data to describe a trend." : "AI is not configured or unavailable."
|
|
2563
2592
|
)
|
|
2564
|
-
).finally(() =>
|
|
2593
|
+
).finally(() => D(!1));
|
|
2565
2594
|
return;
|
|
2566
2595
|
}
|
|
2567
|
-
(
|
|
2568
|
-
|
|
2596
|
+
(R ? Promise.resolve(R) : O.request(
|
|
2597
|
+
kt(n, a.id, {
|
|
2569
2598
|
date_range: o,
|
|
2570
|
-
entity_filters:
|
|
2599
|
+
entity_filters: c
|
|
2571
2600
|
})
|
|
2572
|
-
).then((
|
|
2573
|
-
})).then((
|
|
2574
|
-
const
|
|
2601
|
+
).then((s) => s.data).catch(() => {
|
|
2602
|
+
})).then((s) => {
|
|
2603
|
+
const b = {
|
|
2575
2604
|
widget: a.title,
|
|
2576
|
-
how_computed:
|
|
2577
|
-
value: (
|
|
2578
|
-
previous_value: (
|
|
2579
|
-
change_pct: (
|
|
2580
|
-
row_count: (
|
|
2581
|
-
series: ((
|
|
2582
|
-
rows: ((
|
|
2583
|
-
tiles: (
|
|
2584
|
-
},
|
|
2605
|
+
how_computed: Et(a),
|
|
2606
|
+
value: (s == null ? void 0 : s.value) ?? null,
|
|
2607
|
+
previous_value: (s == null ? void 0 : s.prev_value) ?? null,
|
|
2608
|
+
change_pct: (s == null ? void 0 : s.change_pct) ?? null,
|
|
2609
|
+
row_count: (s == null ? void 0 : s.row_count) ?? null,
|
|
2610
|
+
series: ((s == null ? void 0 : s.series) ?? []).slice(0, 15),
|
|
2611
|
+
rows: ((s == null ? void 0 : s.rows) ?? []).slice(0, 10),
|
|
2612
|
+
tiles: (s == null ? void 0 : s.tiles) ?? null
|
|
2613
|
+
}, M = (s == null ? void 0 : s.prev_value) != null || ((s == null ? void 0 : s.series) ?? []).some(($) => $.prev != null);
|
|
2585
2614
|
return O.request(
|
|
2586
|
-
|
|
2587
|
-
context: JSON.stringify(
|
|
2615
|
+
pt("/ai/brief", {
|
|
2616
|
+
context: JSON.stringify(b),
|
|
2588
2617
|
// `template` picks the server's prompt; `instructions` (the same
|
|
2589
2618
|
// text) keeps an older API answering the same way.
|
|
2590
|
-
template:
|
|
2591
|
-
instructions:
|
|
2619
|
+
template: M ? "report-compare" : "report-explain",
|
|
2620
|
+
instructions: M ? "Compare the current period against the previous one in 2-4 plain sentences: overall direction, the biggest movers up and down, and anything anomalous. No preamble." : "In 2-3 plain sentences, explain what this report metric shows and what stands out (biggest contributor, direction of change). No preamble."
|
|
2592
2621
|
})
|
|
2593
2622
|
);
|
|
2594
|
-
}).then((
|
|
2595
|
-
var
|
|
2596
|
-
const
|
|
2597
|
-
|
|
2598
|
-
}).catch(() =>
|
|
2623
|
+
}).then((s) => {
|
|
2624
|
+
var M, $;
|
|
2625
|
+
const b = ((M = s.data) == null ? void 0 : M.brief) ?? (($ = s.data) == null ? void 0 : $.text) ?? null;
|
|
2626
|
+
fe(b || "No explanation available.");
|
|
2627
|
+
}).catch(() => fe("AI is not configured or unavailable.")).finally(() => D(!1));
|
|
2599
2628
|
},
|
|
2600
|
-
children: /* @__PURE__ */ e(
|
|
2629
|
+
children: /* @__PURE__ */ e(Dt, { className: "h-3 w-3" })
|
|
2601
2630
|
}
|
|
2602
2631
|
),
|
|
2603
|
-
((
|
|
2632
|
+
((it = (st = a.config) == null ? void 0 : st.dimension) == null ? void 0 : it.bucket) && /* @__PURE__ */ e(
|
|
2604
2633
|
"button",
|
|
2605
2634
|
{
|
|
2606
2635
|
type: "button",
|
|
2607
|
-
title:
|
|
2608
|
-
className:
|
|
2636
|
+
title: te ? "Show per-period values" : "Show running total",
|
|
2637
|
+
className: j(
|
|
2609
2638
|
"rounded p-0.5",
|
|
2610
|
-
|
|
2639
|
+
te ? "text-[#00a5cc]" : "text-slate-300 hover:text-slate-500"
|
|
2611
2640
|
),
|
|
2612
|
-
onClick: () =>
|
|
2613
|
-
children: /* @__PURE__ */ e(
|
|
2641
|
+
onClick: () => V((l) => !l),
|
|
2642
|
+
children: /* @__PURE__ */ e(qa, { className: "h-3 w-3" })
|
|
2614
2643
|
}
|
|
2615
2644
|
),
|
|
2616
2645
|
w && /* @__PURE__ */ e(
|
|
@@ -2618,12 +2647,12 @@ const Tt = Aa(function({
|
|
|
2618
2647
|
{
|
|
2619
2648
|
type: "button",
|
|
2620
2649
|
title: "Notes on this widget",
|
|
2621
|
-
className:
|
|
2650
|
+
className: j(
|
|
2622
2651
|
"relative rounded p-0.5",
|
|
2623
|
-
((
|
|
2652
|
+
((q == null ? void 0 : q.length) ?? 0) > 0 ? "text-amber-500" : "text-slate-300 hover:text-slate-500"
|
|
2624
2653
|
),
|
|
2625
2654
|
onClick: () => be((l) => !l),
|
|
2626
|
-
children: /* @__PURE__ */ e(
|
|
2655
|
+
children: /* @__PURE__ */ e(Ma, { className: "h-3 w-3" })
|
|
2627
2656
|
}
|
|
2628
2657
|
),
|
|
2629
2658
|
/* @__PURE__ */ e(
|
|
@@ -2633,37 +2662,37 @@ const Tt = Aa(function({
|
|
|
2633
2662
|
title: "Download as CSV",
|
|
2634
2663
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2635
2664
|
onClick: () => {
|
|
2636
|
-
if (!(
|
|
2637
|
-
|
|
2665
|
+
if (!(_e != null && _e.slug)) {
|
|
2666
|
+
Wt(a, R);
|
|
2638
2667
|
return;
|
|
2639
2668
|
}
|
|
2640
|
-
const l =
|
|
2669
|
+
const l = _e, s = ia(l, o, c);
|
|
2641
2670
|
Te.fetchQuery({
|
|
2642
|
-
queryKey: ["nivaro-report-query", l.slug,
|
|
2643
|
-
queryFn: () =>
|
|
2671
|
+
queryKey: ["nivaro-report-query", l.slug, s],
|
|
2672
|
+
queryFn: () => da(O, l.slug, s),
|
|
2644
2673
|
staleTime: 6e4
|
|
2645
|
-
}).then((
|
|
2646
|
-
|
|
2674
|
+
}).then((b) => Wt(a, void 0, oa(l, b))).catch((b) => {
|
|
2675
|
+
_a(b) || Xt.error(Tt(b, "this widget"));
|
|
2647
2676
|
});
|
|
2648
2677
|
},
|
|
2649
|
-
children: /* @__PURE__ */ e(
|
|
2678
|
+
children: /* @__PURE__ */ e(Fa, { className: "h-3 w-3" })
|
|
2650
2679
|
}
|
|
2651
2680
|
),
|
|
2652
|
-
/* @__PURE__ */ e(
|
|
2681
|
+
/* @__PURE__ */ e(pl, { reportId: n, widget: a, filterBar: h }),
|
|
2653
2682
|
/* @__PURE__ */ e(
|
|
2654
2683
|
"button",
|
|
2655
2684
|
{
|
|
2656
2685
|
type: "button",
|
|
2657
2686
|
title: "Refresh",
|
|
2658
2687
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2659
|
-
onClick: () =>
|
|
2660
|
-
children: /* @__PURE__ */ e(
|
|
2688
|
+
onClick: () => We(),
|
|
2689
|
+
children: /* @__PURE__ */ e(Ft, { className: j("h-3 w-3", $t && "animate-spin") })
|
|
2661
2690
|
}
|
|
2662
2691
|
)
|
|
2663
2692
|
] })
|
|
2664
2693
|
] }),
|
|
2665
|
-
|
|
2666
|
-
(
|
|
2694
|
+
xe && /* @__PURE__ */ i("div", { className: "mb-1.5 space-y-1 rounded-md border border-amber-200 bg-amber-50/60 p-2 dark:border-amber-500/30 dark:bg-amber-500/10", children: [
|
|
2695
|
+
(q ?? []).map((l) => /* @__PURE__ */ i(
|
|
2667
2696
|
"div",
|
|
2668
2697
|
{
|
|
2669
2698
|
className: "group/note flex items-start gap-1.5 text-[11px] text-slate-600 dark:text-slate-300",
|
|
@@ -2677,11 +2706,11 @@ const Tt = Aa(function({
|
|
|
2677
2706
|
l.note,
|
|
2678
2707
|
/* @__PURE__ */ e("span", { className: "ml-1 text-[10px] text-slate-400", children: l.created_by_name ?? "" })
|
|
2679
2708
|
] }),
|
|
2680
|
-
|
|
2709
|
+
E && /* @__PURE__ */ e(
|
|
2681
2710
|
"button",
|
|
2682
2711
|
{
|
|
2683
2712
|
type: "button",
|
|
2684
|
-
onClick: () =>
|
|
2713
|
+
onClick: () => E(l.id),
|
|
2685
2714
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/note:opacity-100",
|
|
2686
2715
|
children: /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
2687
2716
|
}
|
|
@@ -2690,13 +2719,13 @@ const Tt = Aa(function({
|
|
|
2690
2719
|
},
|
|
2691
2720
|
l.id
|
|
2692
2721
|
)),
|
|
2693
|
-
(
|
|
2722
|
+
(q ?? []).length === 0 && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "No notes yet — record why a number moved." }),
|
|
2694
2723
|
w && /* @__PURE__ */ i("div", { className: "flex items-center gap-1 pt-0.5", children: [
|
|
2695
2724
|
/* @__PURE__ */ e(
|
|
2696
2725
|
"input",
|
|
2697
2726
|
{
|
|
2698
|
-
value:
|
|
2699
|
-
onChange: (l) =>
|
|
2727
|
+
value: ge,
|
|
2728
|
+
onChange: (l) => $e(l.target.value),
|
|
2700
2729
|
placeholder: "Add a note…",
|
|
2701
2730
|
className: "h-6 min-w-0 flex-1 rounded border border-amber-200 bg-white px-1.5 text-[11px] dark:border-amber-500/30 dark:bg-card dark:text-slate-200"
|
|
2702
2731
|
}
|
|
@@ -2705,7 +2734,7 @@ const Tt = Aa(function({
|
|
|
2705
2734
|
"input",
|
|
2706
2735
|
{
|
|
2707
2736
|
value: x,
|
|
2708
|
-
onChange: (l) =>
|
|
2737
|
+
onChange: (l) => Z(l.target.value),
|
|
2709
2738
|
placeholder: "2026-03",
|
|
2710
2739
|
title: "Optional chart anchor (YYYY-MM or YYYY-MM-DD bucket key)",
|
|
2711
2740
|
className: "h-6 w-[76px] rounded border border-amber-200 bg-white px-1.5 text-[10.5px] dark:border-amber-500/30 dark:bg-card dark:text-slate-200"
|
|
@@ -2715,9 +2744,9 @@ const Tt = Aa(function({
|
|
|
2715
2744
|
"button",
|
|
2716
2745
|
{
|
|
2717
2746
|
type: "button",
|
|
2718
|
-
disabled: !
|
|
2747
|
+
disabled: !ge.trim(),
|
|
2719
2748
|
onClick: () => {
|
|
2720
|
-
w(a.id,
|
|
2749
|
+
w(a.id, ge.trim(), x.trim() || null), $e(""), Z("");
|
|
2721
2750
|
},
|
|
2722
2751
|
className: "h-6 rounded bg-amber-500 px-2 text-[11px] font-medium text-white hover:brightness-105 disabled:opacity-40",
|
|
2723
2752
|
children: "Add"
|
|
@@ -2726,47 +2755,47 @@ const Tt = Aa(function({
|
|
|
2726
2755
|
] })
|
|
2727
2756
|
] }),
|
|
2728
2757
|
p && (() => {
|
|
2729
|
-
const l =
|
|
2730
|
-
if (l == null ||
|
|
2731
|
-
const
|
|
2758
|
+
const l = fl(R), s = p.value;
|
|
2759
|
+
if (l == null || s == null) return null;
|
|
2760
|
+
const b = s === 0 ? null : (l - s) / Math.abs(s) * 100;
|
|
2732
2761
|
return /* @__PURE__ */ i("p", { className: "mb-1 flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
2733
|
-
/* @__PURE__ */ e(
|
|
2762
|
+
/* @__PURE__ */ e(wt, { className: "h-2.5 w-2.5" }),
|
|
2734
2763
|
"vs ",
|
|
2735
2764
|
p.name,
|
|
2736
2765
|
": ",
|
|
2737
|
-
|
|
2766
|
+
s.toLocaleString(),
|
|
2738
2767
|
" →",
|
|
2739
2768
|
" ",
|
|
2740
2769
|
/* @__PURE__ */ e(
|
|
2741
2770
|
"span",
|
|
2742
2771
|
{
|
|
2743
|
-
className:
|
|
2772
|
+
className: j(
|
|
2744
2773
|
"font-semibold",
|
|
2745
|
-
|
|
2746
|
-
|
|
2774
|
+
b != null && b > 0 && "text-emerald-600 dark:text-emerald-400",
|
|
2775
|
+
b != null && b < 0 && "text-red-500"
|
|
2747
2776
|
),
|
|
2748
|
-
children:
|
|
2777
|
+
children: b == null ? "—" : `${b > 0 ? "+" : ""}${b.toFixed(1)}%`
|
|
2749
2778
|
}
|
|
2750
2779
|
)
|
|
2751
2780
|
] });
|
|
2752
2781
|
})(),
|
|
2753
|
-
|
|
2782
|
+
Y && /* @__PURE__ */ i(
|
|
2754
2783
|
"div",
|
|
2755
2784
|
{
|
|
2756
2785
|
className: "mb-1.5 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300",
|
|
2757
|
-
"data-explain-panel":
|
|
2786
|
+
"data-explain-panel": we ? "trend" : "number",
|
|
2758
2787
|
children: [
|
|
2759
|
-
|
|
2760
|
-
!
|
|
2788
|
+
_ ? "Thinking…" : ce,
|
|
2789
|
+
!_ && me && me.length > 0 && /* @__PURE__ */ e("div", { className: "mt-1.5 flex flex-wrap gap-1", "data-explain-movers": !0, children: me.slice(0, 4).map((l) => /* @__PURE__ */ i(
|
|
2761
2790
|
"span",
|
|
2762
2791
|
{
|
|
2763
|
-
className:
|
|
2792
|
+
className: j(
|
|
2764
2793
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] tabular-nums",
|
|
2765
2794
|
l.delta == null ? "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400" : l.delta >= 0 ? "border-emerald-200 text-emerald-700 dark:border-emerald-500/30 dark:text-emerald-300" : "border-red-200 text-red-700 dark:border-red-500/30 dark:text-red-300"
|
|
2766
2795
|
),
|
|
2767
2796
|
"data-explain-mover": l.label,
|
|
2768
2797
|
children: [
|
|
2769
|
-
l.delta != null && (l.delta >= 0 ? /* @__PURE__ */ e(
|
|
2798
|
+
l.delta != null && (l.delta >= 0 ? /* @__PURE__ */ e(Gt, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Ht, { className: "h-3 w-3" })),
|
|
2770
2799
|
/* @__PURE__ */ e("span", { className: "font-medium", children: l.label }),
|
|
2771
2800
|
l.delta != null ? /* @__PURE__ */ i("span", { children: [
|
|
2772
2801
|
l.delta >= 0 ? "+" : "",
|
|
@@ -2783,56 +2812,56 @@ const Tt = Aa(function({
|
|
|
2783
2812
|
]
|
|
2784
2813
|
}
|
|
2785
2814
|
),
|
|
2786
|
-
|
|
2815
|
+
ae.length > 0 && /* @__PURE__ */ i("div", { className: "mb-1 flex flex-wrap items-center gap-1 text-[10.5px] text-slate-500", children: [
|
|
2787
2816
|
/* @__PURE__ */ e(
|
|
2788
2817
|
"button",
|
|
2789
2818
|
{
|
|
2790
2819
|
type: "button",
|
|
2791
|
-
onClick: () =>
|
|
2820
|
+
onClick: () => S([]),
|
|
2792
2821
|
className: "rounded px-1 hover:bg-muted",
|
|
2793
2822
|
children: "⌂ All"
|
|
2794
2823
|
}
|
|
2795
2824
|
),
|
|
2796
|
-
|
|
2825
|
+
ae.map((l, s) => /* @__PURE__ */ i("span", { className: "flex items-center gap-1", children: [
|
|
2797
2826
|
/* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" }),
|
|
2798
2827
|
/* @__PURE__ */ e(
|
|
2799
2828
|
"button",
|
|
2800
2829
|
{
|
|
2801
2830
|
type: "button",
|
|
2802
|
-
onClick: () =>
|
|
2831
|
+
onClick: () => S(ae.slice(0, s + 1)),
|
|
2803
2832
|
className: "rounded bg-nvr-cyan/[0.08] px-1.5 py-0.5 font-medium text-[#007a99] dark:text-nvr-cyan",
|
|
2804
2833
|
children: l.value
|
|
2805
2834
|
}
|
|
2806
2835
|
)
|
|
2807
|
-
] }, `${l.field}-${
|
|
2836
|
+
] }, `${l.field}-${s}`))
|
|
2808
2837
|
] }),
|
|
2809
|
-
/* @__PURE__ */ e("div", { ref:
|
|
2838
|
+
/* @__PURE__ */ e("div", { ref: T, className: "flex min-h-0 flex-1 flex-col", children: he && ((ot = R == null ? void 0 : R.series) != null && ot.length) ? /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full text-[11.5px]", children: [
|
|
2810
2839
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { className: "text-left text-[10px] uppercase tracking-wide text-slate-400", children: [
|
|
2811
2840
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1", children: "Dimension" }),
|
|
2812
2841
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1 text-right", children: "Value" })
|
|
2813
2842
|
] }) }),
|
|
2814
|
-
/* @__PURE__ */ e("tbody", { children: (
|
|
2843
|
+
/* @__PURE__ */ e("tbody", { children: (R.series ?? []).map((l) => /* @__PURE__ */ i("tr", { className: "border-b border-slate-50 dark:border-border/40", children: [
|
|
2815
2844
|
/* @__PURE__ */ e("td", { className: "max-w-[220px] truncate px-1.5 py-1 text-slate-700 dark:text-slate-300", children: l.dim }),
|
|
2816
|
-
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: qe(l.value,
|
|
2845
|
+
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: qe(l.value, se) })
|
|
2817
2846
|
] }, l.dim)) })
|
|
2818
|
-
] }) }) :
|
|
2819
|
-
((
|
|
2820
|
-
|
|
2821
|
-
|
|
2847
|
+
] }) }) : J }),
|
|
2848
|
+
((Le = a.config) == null ? void 0 : Le.footnote) && /* @__PURE__ */ e("p", { className: "mt-1 border-t border-slate-100 pt-1 text-[10.5px] leading-snug text-slate-400 dark:border-border/50", children: a.config.footnote }),
|
|
2849
|
+
X && /* @__PURE__ */ e(
|
|
2850
|
+
xl,
|
|
2822
2851
|
{
|
|
2823
2852
|
collection: a.collection ?? "",
|
|
2824
|
-
conditions:
|
|
2825
|
-
title:
|
|
2826
|
-
onClose: () =>
|
|
2853
|
+
conditions: X.conditions,
|
|
2854
|
+
title: X.title,
|
|
2855
|
+
onClose: () => de(null),
|
|
2827
2856
|
onOpen: (l) => {
|
|
2828
|
-
|
|
2857
|
+
de(null), f == null || f(l);
|
|
2829
2858
|
},
|
|
2830
|
-
crossFilter:
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
),
|
|
2859
|
+
crossFilter: u && X.dimField && X.dimRaw != null ? () => {
|
|
2860
|
+
u(
|
|
2861
|
+
X.dimField,
|
|
2862
|
+
X.dimRaw,
|
|
2863
|
+
X.dimLabel ?? String(X.dimRaw)
|
|
2864
|
+
), de(null);
|
|
2836
2865
|
} : void 0
|
|
2837
2866
|
}
|
|
2838
2867
|
)
|
|
@@ -2840,53 +2869,53 @@ const Tt = Aa(function({
|
|
|
2840
2869
|
}
|
|
2841
2870
|
);
|
|
2842
2871
|
});
|
|
2843
|
-
function
|
|
2872
|
+
function jl({
|
|
2844
2873
|
reportId: t,
|
|
2845
|
-
widget:
|
|
2874
|
+
widget: n,
|
|
2846
2875
|
dateRange: a = null,
|
|
2847
2876
|
entityFilters: o = []
|
|
2848
2877
|
}) {
|
|
2849
|
-
const
|
|
2850
|
-
(f) =>
|
|
2851
|
-
[
|
|
2852
|
-
), h =
|
|
2878
|
+
const c = Zt(), m = At(
|
|
2879
|
+
(f) => c == null ? void 0 : c.open(f),
|
|
2880
|
+
[c]
|
|
2881
|
+
), h = ut(() => ({ ...n, x: 0 }), [n]);
|
|
2853
2882
|
return /* @__PURE__ */ e(
|
|
2854
|
-
|
|
2883
|
+
Lt,
|
|
2855
2884
|
{
|
|
2856
2885
|
reportId: t,
|
|
2857
2886
|
widget: h,
|
|
2858
2887
|
dateRange: a,
|
|
2859
2888
|
entityFilters: o,
|
|
2860
|
-
onDrill:
|
|
2889
|
+
onDrill: c ? m : void 0
|
|
2861
2890
|
}
|
|
2862
2891
|
);
|
|
2863
2892
|
}
|
|
2864
|
-
function
|
|
2893
|
+
function El({
|
|
2865
2894
|
reportId: t,
|
|
2866
|
-
showFilterBar:
|
|
2895
|
+
showFilterBar: n = !0,
|
|
2867
2896
|
dateRange: a,
|
|
2868
2897
|
initialEntityFilters: o = [],
|
|
2869
|
-
refetchInterval:
|
|
2870
|
-
className:
|
|
2898
|
+
refetchInterval: c,
|
|
2899
|
+
className: m,
|
|
2871
2900
|
emptyState: h,
|
|
2872
2901
|
reportUrl: f
|
|
2873
2902
|
}) {
|
|
2874
|
-
var W,
|
|
2875
|
-
const p = Ke(), L =
|
|
2876
|
-
(r) => L ? L.open(r) :
|
|
2877
|
-
[L,
|
|
2878
|
-
), [
|
|
2903
|
+
var W, z;
|
|
2904
|
+
const p = Ke(), L = Zt(), q = La("drill.report"), w = q.value, E = At(
|
|
2905
|
+
(r) => L ? L.open(r) : q.push([r]),
|
|
2906
|
+
[L, q.push]
|
|
2907
|
+
), [u, N] = C(void 0), [U, O] = C(o), [ee, H] = C(void 0), [ue, pe] = C(o), { scopes: X, ready: de } = ja(), [xe, be] = C(!1), [ge, $e] = C({}), x = Ct(), { data: Z = [] } = Ne({
|
|
2879
2908
|
queryKey: ["nivaro-report-presets", t],
|
|
2880
2909
|
queryFn: async () => {
|
|
2881
2910
|
try {
|
|
2882
2911
|
const r = JSON.parse(localStorage.getItem(`nvr-report-presets:${t}`) ?? "[]");
|
|
2883
2912
|
if (Array.isArray(r) && r.length > 0) {
|
|
2884
|
-
for (const
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
name: String(
|
|
2888
|
-
date_range:
|
|
2889
|
-
entity_filters:
|
|
2913
|
+
for (const v of r)
|
|
2914
|
+
v != null && v.name && await p.request(
|
|
2915
|
+
Kt(t, {
|
|
2916
|
+
name: String(v.name),
|
|
2917
|
+
date_range: v.date_range ?? null,
|
|
2918
|
+
entity_filters: v.entity_filters ?? []
|
|
2890
2919
|
})
|
|
2891
2920
|
).catch(() => {
|
|
2892
2921
|
});
|
|
@@ -2894,214 +2923,214 @@ function zl({
|
|
|
2894
2923
|
}
|
|
2895
2924
|
} catch {
|
|
2896
2925
|
}
|
|
2897
|
-
return p.request(
|
|
2926
|
+
return p.request(ua(t)).then((r) => r.data);
|
|
2898
2927
|
},
|
|
2899
2928
|
staleTime: 6e4
|
|
2900
|
-
}),
|
|
2929
|
+
}), te = () => void x.invalidateQueries({ queryKey: ["nivaro-report-presets", t] }), V = Me({
|
|
2901
2930
|
mutationFn: (r) => p.request(
|
|
2902
|
-
|
|
2931
|
+
Kt(t, {
|
|
2903
2932
|
name: r,
|
|
2904
|
-
date_range:
|
|
2905
|
-
entity_filters:
|
|
2933
|
+
date_range: st.current ?? null,
|
|
2934
|
+
entity_filters: it.current
|
|
2906
2935
|
})
|
|
2907
2936
|
),
|
|
2908
|
-
onSuccess:
|
|
2909
|
-
}),
|
|
2910
|
-
mutationFn: (r) => p.request(
|
|
2911
|
-
onSuccess:
|
|
2912
|
-
}), [le,
|
|
2937
|
+
onSuccess: te
|
|
2938
|
+
}), he = Me({
|
|
2939
|
+
mutationFn: (r) => p.request(pa(t, r)),
|
|
2940
|
+
onSuccess: te
|
|
2941
|
+
}), [le, ae] = C(""), [S, T] = C(!1), [P, Y] = C(null), [ne, ce] = C(!1), { data: fe = [] } = Ne({
|
|
2913
2942
|
queryKey: ["nvr-report-snaps", t],
|
|
2914
2943
|
queryFn: () => p.request(
|
|
2915
|
-
|
|
2944
|
+
ct(`/report-studio/${t}/snapshots`)
|
|
2916
2945
|
).then((r) => r.data ?? []),
|
|
2917
2946
|
staleTime: 6e4,
|
|
2918
2947
|
retry: !1
|
|
2919
|
-
}), { data:
|
|
2920
|
-
queryKey: ["nvr-report-snap", t,
|
|
2948
|
+
}), { data: _ } = Ne({
|
|
2949
|
+
queryKey: ["nvr-report-snap", t, P],
|
|
2921
2950
|
queryFn: () => p.request(
|
|
2922
|
-
|
|
2951
|
+
ct(`/report-studio/${t}/snapshots/${P}`)
|
|
2923
2952
|
).then((r) => r.data),
|
|
2924
|
-
enabled:
|
|
2953
|
+
enabled: P != null,
|
|
2925
2954
|
staleTime: 5 * 6e4,
|
|
2926
2955
|
retry: !1
|
|
2927
|
-
}),
|
|
2928
|
-
mutationFn: () => p.request(
|
|
2956
|
+
}), D = Me({
|
|
2957
|
+
mutationFn: () => p.request(pt(`/report-studio/${t}/snapshots`, {})),
|
|
2929
2958
|
onSuccess: () => void x.invalidateQueries({ queryKey: ["nvr-report-snaps", t] })
|
|
2930
|
-
}), { data:
|
|
2959
|
+
}), { data: me = [] } = Ne({
|
|
2931
2960
|
queryKey: ["nvr-report-notes", t],
|
|
2932
|
-
queryFn: () => p.request(
|
|
2961
|
+
queryFn: () => p.request(ct(`/report-studio/${t}/annotations`)).then((r) => r.data ?? []),
|
|
2933
2962
|
staleTime: 6e4,
|
|
2934
2963
|
retry: !1
|
|
2935
|
-
}), ve = () => void x.invalidateQueries({ queryKey: ["nvr-report-notes", t] }),
|
|
2936
|
-
mutationFn: (r) => p.request(
|
|
2964
|
+
}), ve = () => void x.invalidateQueries({ queryKey: ["nvr-report-notes", t] }), we = Me({
|
|
2965
|
+
mutationFn: (r) => p.request(pt(`/report-studio/${t}/annotations`, r)),
|
|
2937
2966
|
onSuccess: ve
|
|
2938
|
-
}),
|
|
2967
|
+
}), Te = Me({
|
|
2939
2968
|
mutationFn: (r) => p.request(Ra(`/report-studio/${t}/annotations/${r}`)),
|
|
2940
2969
|
onSuccess: ve
|
|
2941
|
-
}),
|
|
2942
|
-
const
|
|
2970
|
+
}), Xe = At((r, v, g) => {
|
|
2971
|
+
const k = {
|
|
2943
2972
|
field: r,
|
|
2944
|
-
values: [
|
|
2945
|
-
labels: [
|
|
2973
|
+
values: [v],
|
|
2974
|
+
labels: [g]
|
|
2946
2975
|
};
|
|
2947
|
-
O((
|
|
2948
|
-
}, []), [
|
|
2976
|
+
O((d) => [...d.filter((y) => y.field !== r), k]), pe((d) => [...d.filter((y) => y.field !== r), k]);
|
|
2977
|
+
}, []), [ye, Ze] = C(!1), [ke, Fe] = C(null), [Ie, Ee] = C(null), De = Me({
|
|
2949
2978
|
mutationFn: (r) => p.request(
|
|
2950
|
-
|
|
2951
|
-
widgets: r.map((
|
|
2979
|
+
Oa(`/report-studio/${t}/widgets`, {
|
|
2980
|
+
widgets: r.map((v, g) => ({ ...v, sort: g }))
|
|
2952
2981
|
})
|
|
2953
2982
|
),
|
|
2954
2983
|
onSuccess: () => {
|
|
2955
|
-
|
|
2984
|
+
Ze(!1), Fe(null), Ee(null), x.invalidateQueries({ queryKey: ["nivaro-report", t] }), x.invalidateQueries({ queryKey: ["nivaro-report-widget"] });
|
|
2956
2985
|
}
|
|
2957
|
-
}),
|
|
2958
|
-
x.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), x.invalidateQueries({ queryKey: ["nivaro-report-query"] }),
|
|
2959
|
-
}, { data:
|
|
2986
|
+
}), We = (r) => [...r].sort((v, g) => (v.y ?? 0) - (g.y ?? 0) || (v.x ?? 0) - (g.x ?? 0)), [$t, Be] = C(() => /* @__PURE__ */ new Date()), ht = () => {
|
|
2987
|
+
x.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), x.invalidateQueries({ queryKey: ["nivaro-report-query"] }), Be(/* @__PURE__ */ new Date());
|
|
2988
|
+
}, { data: R = [] } = Ne({
|
|
2960
2989
|
queryKey: ["nvr-report-firing", t],
|
|
2961
|
-
queryFn: () => p.request(
|
|
2990
|
+
queryFn: () => p.request(ct(`/report-studio/${t}/firing`)).then((r) => r.data ?? []).catch(() => []),
|
|
2962
2991
|
staleTime: 6e4,
|
|
2963
2992
|
refetchInterval: 5 * 6e4,
|
|
2964
2993
|
retry: !1
|
|
2965
|
-
}), [
|
|
2966
|
-
|
|
2994
|
+
}), [se, et] = C(null), [Qe, _e] = C(!1), [J, ft] = C(""), [Ue, xt] = C(""), [Ve, bt] = C("");
|
|
2995
|
+
mt(() => {
|
|
2967
2996
|
try {
|
|
2968
2997
|
const r = sessionStorage.getItem(`nvr-report-xf:${t}`);
|
|
2969
2998
|
if (r) {
|
|
2970
2999
|
sessionStorage.removeItem(`nvr-report-xf:${t}`);
|
|
2971
|
-
const
|
|
2972
|
-
Array.isArray(
|
|
3000
|
+
const v = JSON.parse(r);
|
|
3001
|
+
Array.isArray(v) && v.length > 0 && (O(v), pe(v));
|
|
2973
3002
|
}
|
|
2974
3003
|
} catch {
|
|
2975
3004
|
}
|
|
2976
3005
|
}, [t]);
|
|
2977
|
-
const
|
|
2978
|
-
Fe(
|
|
2979
|
-
},
|
|
2980
|
-
const
|
|
2981
|
-
if (
|
|
2982
|
-
const
|
|
2983
|
-
return d
|
|
2984
|
-
}), [Ye,
|
|
3006
|
+
const gt = () => {
|
|
3007
|
+
Fe(We((re == null ? void 0 : re.widgets) ?? [])), Ze(!0), window.__nvrReportId = t;
|
|
3008
|
+
}, tt = (r) => Fe((v) => (v ?? []).map((g) => g.id === r.id ? r : g)), vt = (r, v) => Fe((g) => {
|
|
3009
|
+
const k = [...g ?? []], d = k.findIndex((G) => G.id === r), y = d + v;
|
|
3010
|
+
if (d < 0 || y < 0 || y >= k.length) return k;
|
|
3011
|
+
const F = k[d], B = k[y];
|
|
3012
|
+
return k[d] = { ...B, x: F.x, y: F.y }, k[y] = { ...F, x: B.x, y: B.y }, k;
|
|
3013
|
+
}), [Ye, at] = C(""), [Je, lt] = C(!1), [rt, nt] = C(null), { data: re, isLoading: yt } = Ne({
|
|
2985
3014
|
queryKey: ["nivaro-report", t],
|
|
2986
|
-
queryFn: () => p.request(
|
|
3015
|
+
queryFn: () => p.request(ha(t)).then((r) => r.data),
|
|
2987
3016
|
staleTime: 3e4
|
|
2988
|
-
}),
|
|
2989
|
-
|
|
2990
|
-
const
|
|
3017
|
+
}), st = St(null), it = St([]), ot = ((W = re == null ? void 0 : re.global_filters) == null ? void 0 : W.date_range) ?? null, Le = ut(() => u !== void 0 ? u : a !== void 0 ? a : ot, [u, a, ot]);
|
|
3018
|
+
st.current = Le ?? null, it.current = U;
|
|
3019
|
+
const l = ut(
|
|
2991
3020
|
() => {
|
|
2992
3021
|
var r;
|
|
2993
3022
|
return ((r = re == null ? void 0 : re.global_filters) == null ? void 0 : r.filter_bar) ?? [];
|
|
2994
3023
|
},
|
|
2995
|
-
[(
|
|
3024
|
+
[(z = re == null ? void 0 : re.global_filters) == null ? void 0 : z.filter_bar]
|
|
2996
3025
|
);
|
|
2997
|
-
|
|
2998
|
-
if (!
|
|
2999
|
-
if (!
|
|
3026
|
+
mt(() => {
|
|
3027
|
+
if (!xe && !(!de || !re)) {
|
|
3028
|
+
if (!X || l.length === 0) {
|
|
3000
3029
|
be(!0);
|
|
3001
3030
|
return;
|
|
3002
3031
|
}
|
|
3003
3032
|
(async () => {
|
|
3004
|
-
var
|
|
3005
|
-
const r = [],
|
|
3006
|
-
for (const
|
|
3007
|
-
const
|
|
3008
|
-
key:
|
|
3009
|
-
collection: (
|
|
3033
|
+
var g;
|
|
3034
|
+
const r = [], v = {};
|
|
3035
|
+
for (const k of l) {
|
|
3036
|
+
const d = Ea(X, {
|
|
3037
|
+
key: k.field,
|
|
3038
|
+
collection: (g = k.options) == null ? void 0 : g.collection
|
|
3010
3039
|
});
|
|
3011
|
-
if (!
|
|
3012
|
-
const
|
|
3013
|
-
if (
|
|
3014
|
-
const
|
|
3040
|
+
if (!d) continue;
|
|
3041
|
+
const y = k.options ? k.options.value_field ?? "id" : "id", F = X.restricted[d.name] ?? [];
|
|
3042
|
+
if (F.length > 0) {
|
|
3043
|
+
const G = await Pt(p, d, F, y).catch(
|
|
3015
3044
|
() => []
|
|
3016
3045
|
);
|
|
3017
|
-
|
|
3046
|
+
G.length > 0 && (v[k.field] = G);
|
|
3018
3047
|
}
|
|
3019
|
-
const B =
|
|
3048
|
+
const B = Wa(X, d.name);
|
|
3020
3049
|
if (B.length > 0) {
|
|
3021
|
-
const
|
|
3050
|
+
const G = await Pt(p, d, B, y).catch(
|
|
3022
3051
|
() => []
|
|
3023
3052
|
);
|
|
3024
|
-
|
|
3053
|
+
G.length > 0 && r.push({ field: k.field, values: G, labels: G.map(String) });
|
|
3025
3054
|
}
|
|
3026
3055
|
}
|
|
3027
|
-
if (Object.keys(
|
|
3028
|
-
const
|
|
3029
|
-
const
|
|
3030
|
-
for (const
|
|
3031
|
-
return
|
|
3056
|
+
if (Object.keys(v).length > 0 && $e(v), r.length > 0) {
|
|
3057
|
+
const k = (d) => {
|
|
3058
|
+
const y = [...d];
|
|
3059
|
+
for (const F of r) y.some((B) => B.field === F.field) || y.push(F);
|
|
3060
|
+
return y;
|
|
3032
3061
|
};
|
|
3033
|
-
|
|
3062
|
+
pe(k), O(k);
|
|
3034
3063
|
}
|
|
3035
3064
|
be(!0);
|
|
3036
3065
|
})();
|
|
3037
3066
|
}
|
|
3038
|
-
}, [
|
|
3039
|
-
const
|
|
3040
|
-
O(
|
|
3041
|
-
},
|
|
3042
|
-
|
|
3043
|
-
},
|
|
3044
|
-
|
|
3045
|
-
},
|
|
3046
|
-
var
|
|
3067
|
+
}, [xe, de, re, X, l]);
|
|
3068
|
+
const s = (re == null ? void 0 : re.widgets) ?? [], b = ee !== void 0 ? ee : Le, M = U.filter((r) => r.values.length > 0).length + (Le ? 1 : 0), $ = JSON.stringify(ue) !== JSON.stringify(U) || ee !== void 0, K = () => {
|
|
3069
|
+
O(ue), ee !== void 0 && (N(ee), H(void 0));
|
|
3070
|
+
}, ie = () => {
|
|
3071
|
+
pe([]), O([]), N(null), H(void 0);
|
|
3072
|
+
}, I = (r) => {
|
|
3073
|
+
pe(r.entity_filters), O(r.entity_filters), N(r.date_range), H(void 0);
|
|
3074
|
+
}, A = async () => {
|
|
3075
|
+
var v, g;
|
|
3047
3076
|
const r = Ye.trim();
|
|
3048
3077
|
if (!(!r || Je)) {
|
|
3049
|
-
|
|
3078
|
+
lt(!0), nt(null);
|
|
3050
3079
|
try {
|
|
3051
|
-
const
|
|
3052
|
-
|
|
3080
|
+
const k = await p.request(
|
|
3081
|
+
ga(
|
|
3053
3082
|
t,
|
|
3054
3083
|
r,
|
|
3055
|
-
|
|
3084
|
+
l.map((y) => ({ field: y.field, label: y.label }))
|
|
3056
3085
|
)
|
|
3057
|
-
),
|
|
3058
|
-
var
|
|
3059
|
-
return
|
|
3060
|
-
}).map((
|
|
3061
|
-
|
|
3062
|
-
} catch (
|
|
3063
|
-
|
|
3064
|
-
((
|
|
3086
|
+
), d = (k.data.entity_filters ?? []).filter((y) => {
|
|
3087
|
+
var F;
|
|
3088
|
+
return l.some((B) => B.field === y.field) && ((F = y.values) == null ? void 0 : F.length) > 0;
|
|
3089
|
+
}).map((y) => ({ field: y.field, values: y.values, labels: y.values.map(String) }));
|
|
3090
|
+
pe(d), O(d), N(k.data.date_range ?? null), H(void 0), at("");
|
|
3091
|
+
} catch (k) {
|
|
3092
|
+
nt(
|
|
3093
|
+
((g = (v = k.response) == null ? void 0 : v.data) == null ? void 0 : g.error) ?? "Could not parse that"
|
|
3065
3094
|
);
|
|
3066
3095
|
} finally {
|
|
3067
|
-
|
|
3096
|
+
lt(!1);
|
|
3068
3097
|
}
|
|
3069
3098
|
}
|
|
3070
3099
|
};
|
|
3071
|
-
return
|
|
3072
|
-
|
|
3100
|
+
return yt || !xe ? /* @__PURE__ */ e("div", { className: j("p-6 text-[13px] text-slate-400", m), children: "Loading report…" }) : re ? /* @__PURE__ */ i("div", { className: j("flex flex-col gap-3", m), children: [
|
|
3101
|
+
n && (s.length > 0 || l.length > 0) && /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
3073
3102
|
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
3074
3103
|
/* @__PURE__ */ i("span", { className: "flex items-center gap-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-slate-300", children: [
|
|
3075
3104
|
"Filters",
|
|
3076
|
-
|
|
3105
|
+
M > 0 && /* @__PURE__ */ i("span", { className: "rounded-full bg-emerald-50 px-1.5 py-px text-[10px] font-semibold text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400", children: [
|
|
3077
3106
|
"Active · ",
|
|
3078
|
-
|
|
3107
|
+
M
|
|
3079
3108
|
] })
|
|
3080
3109
|
] }),
|
|
3081
3110
|
/* @__PURE__ */ e(
|
|
3082
|
-
|
|
3111
|
+
Nt,
|
|
3083
3112
|
{
|
|
3084
|
-
value: (
|
|
3113
|
+
value: (b == null ? void 0 : b.preset) ?? "",
|
|
3085
3114
|
onChange: (r) => H(r ? { preset: r } : null),
|
|
3086
|
-
options:
|
|
3115
|
+
options: al.map((r) => ({ value: r.id, label: r.label })),
|
|
3087
3116
|
ariaLabel: "Date range",
|
|
3088
3117
|
className: "h-7 w-auto rounded-md px-1.5 py-0 text-[12px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300"
|
|
3089
3118
|
}
|
|
3090
3119
|
),
|
|
3091
|
-
|
|
3092
|
-
var
|
|
3120
|
+
l.map((r) => {
|
|
3121
|
+
var v;
|
|
3093
3122
|
return /* @__PURE__ */ e(
|
|
3094
|
-
|
|
3123
|
+
na,
|
|
3095
3124
|
{
|
|
3096
3125
|
reportId: t,
|
|
3097
3126
|
field: r.field,
|
|
3098
3127
|
label: r.label,
|
|
3099
3128
|
optionSource: r.options,
|
|
3100
|
-
allowedValues:
|
|
3101
|
-
selected: ((
|
|
3102
|
-
onChange: (
|
|
3103
|
-
...
|
|
3104
|
-
...
|
|
3129
|
+
allowedValues: ge[r.field],
|
|
3130
|
+
selected: ((v = ue.find((g) => g.field === r.field)) == null ? void 0 : v.values) ?? [],
|
|
3131
|
+
onChange: (g, k) => pe((d) => [
|
|
3132
|
+
...d.filter((y) => y.field !== r.field),
|
|
3133
|
+
...g.length > 0 ? [{ field: r.field, values: g, labels: k }] : []
|
|
3105
3134
|
])
|
|
3106
3135
|
},
|
|
3107
3136
|
r.field
|
|
@@ -3111,24 +3140,24 @@ function zl({
|
|
|
3111
3140
|
"button",
|
|
3112
3141
|
{
|
|
3113
3142
|
type: "button",
|
|
3114
|
-
disabled:
|
|
3115
|
-
onClick:
|
|
3116
|
-
className:
|
|
3143
|
+
disabled: !$,
|
|
3144
|
+
onClick: K,
|
|
3145
|
+
className: j(
|
|
3117
3146
|
"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11.5px] font-semibold",
|
|
3118
|
-
|
|
3147
|
+
$ ? "bg-nvr-cyan text-white" : "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500"
|
|
3119
3148
|
),
|
|
3120
3149
|
children: [
|
|
3121
|
-
/* @__PURE__ */ e(
|
|
3150
|
+
/* @__PURE__ */ e(Ut, { className: "h-3 w-3" }),
|
|
3122
3151
|
" Apply"
|
|
3123
3152
|
]
|
|
3124
3153
|
}
|
|
3125
3154
|
),
|
|
3126
|
-
(
|
|
3155
|
+
(M > 0 || $) && /* @__PURE__ */ i(
|
|
3127
3156
|
"button",
|
|
3128
3157
|
{
|
|
3129
3158
|
type: "button",
|
|
3130
3159
|
className: "flex items-center gap-1 text-[11.5px] text-slate-400 hover:text-red-500",
|
|
3131
|
-
onClick:
|
|
3160
|
+
onClick: ie,
|
|
3132
3161
|
children: [
|
|
3133
3162
|
/* @__PURE__ */ e(Ae, { className: "h-3 w-3" }),
|
|
3134
3163
|
" Clear"
|
|
@@ -3137,19 +3166,19 @@ function zl({
|
|
|
3137
3166
|
)
|
|
3138
3167
|
] }),
|
|
3139
3168
|
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
3140
|
-
|
|
3169
|
+
Z.map((r) => /* @__PURE__ */ i(
|
|
3141
3170
|
"span",
|
|
3142
3171
|
{
|
|
3143
3172
|
className: "group/preset inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 pl-2 pr-1 text-[11px] text-slate-500 hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:hover:text-nvr-cyan",
|
|
3144
3173
|
children: [
|
|
3145
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () =>
|
|
3174
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => I(r), children: r.name }),
|
|
3146
3175
|
/* @__PURE__ */ e(
|
|
3147
3176
|
"button",
|
|
3148
3177
|
{
|
|
3149
3178
|
type: "button",
|
|
3150
3179
|
title: "Delete preset",
|
|
3151
3180
|
className: "rounded-full p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/preset:opacity-100",
|
|
3152
|
-
onClick: () =>
|
|
3181
|
+
onClick: () => he.mutate(r.id),
|
|
3153
3182
|
children: /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
3154
3183
|
}
|
|
3155
3184
|
)
|
|
@@ -3157,15 +3186,15 @@ function zl({
|
|
|
3157
3186
|
},
|
|
3158
3187
|
r.name
|
|
3159
3188
|
)),
|
|
3160
|
-
|
|
3189
|
+
S ? /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1", children: /* @__PURE__ */ e(
|
|
3161
3190
|
"input",
|
|
3162
3191
|
{
|
|
3163
3192
|
value: le,
|
|
3164
|
-
onChange: (r) =>
|
|
3193
|
+
onChange: (r) => ae(r.target.value),
|
|
3165
3194
|
placeholder: "Preset name",
|
|
3166
3195
|
autoFocus: !0,
|
|
3167
3196
|
onKeyDown: (r) => {
|
|
3168
|
-
r.key === "Enter" && le.trim() && (
|
|
3197
|
+
r.key === "Enter" && le.trim() && (V.mutate(le.trim()), ae(""), T(!1)), r.key === "Escape" && T(!1);
|
|
3169
3198
|
},
|
|
3170
3199
|
className: "h-6 w-[130px] rounded-md border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-card"
|
|
3171
3200
|
}
|
|
@@ -3174,9 +3203,9 @@ function zl({
|
|
|
3174
3203
|
{
|
|
3175
3204
|
type: "button",
|
|
3176
3205
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 dark:border-border",
|
|
3177
|
-
onClick: () =>
|
|
3206
|
+
onClick: () => T(!0),
|
|
3178
3207
|
children: [
|
|
3179
|
-
/* @__PURE__ */ e(
|
|
3208
|
+
/* @__PURE__ */ e(Vt, { className: "h-2.5 w-2.5" }),
|
|
3180
3209
|
" Save preset"
|
|
3181
3210
|
]
|
|
3182
3211
|
}
|
|
@@ -3187,44 +3216,44 @@ function zl({
|
|
|
3187
3216
|
{
|
|
3188
3217
|
type: "button",
|
|
3189
3218
|
title: "Save the current numbers as a snapshot to compare against later",
|
|
3190
|
-
disabled:
|
|
3191
|
-
onClick: () =>
|
|
3219
|
+
disabled: D.isPending,
|
|
3220
|
+
onClick: () => D.mutate(),
|
|
3192
3221
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 disabled:opacity-40 dark:border-border",
|
|
3193
3222
|
children: [
|
|
3194
|
-
/* @__PURE__ */ e(
|
|
3223
|
+
/* @__PURE__ */ e(wt, { className: "h-2.5 w-2.5" }),
|
|
3195
3224
|
" ",
|
|
3196
|
-
|
|
3225
|
+
D.isPending ? "Saving…" : "Snapshot"
|
|
3197
3226
|
]
|
|
3198
3227
|
}
|
|
3199
3228
|
),
|
|
3200
|
-
|
|
3229
|
+
fe.map((r) => /* @__PURE__ */ i(
|
|
3201
3230
|
"button",
|
|
3202
3231
|
{
|
|
3203
3232
|
type: "button",
|
|
3204
3233
|
title: `Compare against ${r.name} (${new Date(r.taken_at).toLocaleDateString()})`,
|
|
3205
|
-
onClick: () =>
|
|
3206
|
-
className:
|
|
3234
|
+
onClick: () => Y((v) => v === r.id ? null : r.id),
|
|
3235
|
+
className: j(
|
|
3207
3236
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3208
|
-
|
|
3237
|
+
P === r.id ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
3209
3238
|
),
|
|
3210
3239
|
children: [
|
|
3211
|
-
/* @__PURE__ */ e(
|
|
3240
|
+
/* @__PURE__ */ e(wt, { className: "h-2.5 w-2.5" }),
|
|
3212
3241
|
" ",
|
|
3213
3242
|
r.name,
|
|
3214
|
-
|
|
3243
|
+
P === r.id && /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
3215
3244
|
]
|
|
3216
3245
|
},
|
|
3217
3246
|
r.id
|
|
3218
3247
|
)),
|
|
3219
|
-
|
|
3248
|
+
P != null && /* @__PURE__ */ e(
|
|
3220
3249
|
"button",
|
|
3221
3250
|
{
|
|
3222
3251
|
type: "button",
|
|
3223
3252
|
title: "Time machine (#404): show the snapshot values AS the numbers, not as delta badges",
|
|
3224
|
-
onClick: () =>
|
|
3225
|
-
className:
|
|
3253
|
+
onClick: () => ce((r) => !r),
|
|
3254
|
+
className: j(
|
|
3226
3255
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3227
|
-
|
|
3256
|
+
ne ? "border-amber-400 bg-amber-50 font-medium text-amber-700 dark:bg-amber-400/10 dark:text-amber-400" : "border-dashed border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
3228
3257
|
),
|
|
3229
3258
|
children: "As of"
|
|
3230
3259
|
}
|
|
@@ -3236,9 +3265,9 @@ function zl({
|
|
|
3236
3265
|
"input",
|
|
3237
3266
|
{
|
|
3238
3267
|
value: Ye,
|
|
3239
|
-
onChange: (r) =>
|
|
3268
|
+
onChange: (r) => at(r.target.value),
|
|
3240
3269
|
onKeyDown: (r) => {
|
|
3241
|
-
r.key === "Enter" &&
|
|
3270
|
+
r.key === "Enter" && A();
|
|
3242
3271
|
},
|
|
3243
3272
|
placeholder: 'Describe filters… e.g. "Zone 1 CRAN this year"',
|
|
3244
3273
|
className: "h-full min-w-0 flex-1 bg-transparent text-[11.5px] outline-none placeholder:text-slate-300 dark:text-slate-200"
|
|
@@ -3249,32 +3278,32 @@ function zl({
|
|
|
3249
3278
|
{
|
|
3250
3279
|
type: "button",
|
|
3251
3280
|
disabled: Je || !Ye.trim(),
|
|
3252
|
-
onClick: () => void
|
|
3281
|
+
onClick: () => void A(),
|
|
3253
3282
|
className: "text-[11px] font-semibold text-nvr-navy disabled:opacity-40 dark:text-nvr-cyan",
|
|
3254
3283
|
children: Je ? "…" : "Set"
|
|
3255
3284
|
}
|
|
3256
3285
|
)
|
|
3257
3286
|
] }),
|
|
3258
|
-
|
|
3287
|
+
rt && /* @__PURE__ */ e("span", { className: "text-[10.5px] text-red-400", children: rt })
|
|
3259
3288
|
] })
|
|
3260
3289
|
] }),
|
|
3261
|
-
|
|
3290
|
+
R.length > 0 && /* @__PURE__ */ i("div", { className: "mb-2 flex items-center gap-2 rounded-lg border border-red-300 bg-red-50 px-3 py-2 dark:border-red-500/40 dark:bg-red-500/10", children: [
|
|
3262
3291
|
/* @__PURE__ */ e(Yt, { className: "h-3.5 w-3.5 shrink-0 text-red-500" }),
|
|
3263
|
-
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[12px] text-red-700 dark:text-red-300", children:
|
|
3292
|
+
/* @__PURE__ */ e("p", { className: "min-w-0 flex-1 truncate text-[12px] text-red-700 dark:text-red-300", children: R.length === 1 ? `Alert firing: ${R[0].name}` : `${R.length} alerts firing: ${R.map((r) => r.name).join(" · ")}` })
|
|
3264
3293
|
] }),
|
|
3265
3294
|
/* @__PURE__ */ i("div", { className: "mb-2 flex flex-wrap items-center gap-2", children: [
|
|
3266
3295
|
/* @__PURE__ */ i("span", { className: "text-[10.5px] text-slate-400", children: [
|
|
3267
3296
|
"Data as of ",
|
|
3268
|
-
|
|
3297
|
+
$t.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
|
|
3269
3298
|
] }),
|
|
3270
3299
|
/* @__PURE__ */ i(
|
|
3271
3300
|
"button",
|
|
3272
3301
|
{
|
|
3273
3302
|
type: "button",
|
|
3274
|
-
onClick:
|
|
3303
|
+
onClick: ht,
|
|
3275
3304
|
className: "inline-flex items-center gap-1 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400",
|
|
3276
3305
|
children: [
|
|
3277
|
-
/* @__PURE__ */ e(
|
|
3306
|
+
/* @__PURE__ */ e(Ft, { className: "h-2.5 w-2.5" }),
|
|
3278
3307
|
" Refresh all"
|
|
3279
3308
|
]
|
|
3280
3309
|
}
|
|
@@ -3284,31 +3313,31 @@ function zl({
|
|
|
3284
3313
|
"button",
|
|
3285
3314
|
{
|
|
3286
3315
|
type: "button",
|
|
3287
|
-
onClick: () =>
|
|
3288
|
-
className:
|
|
3316
|
+
onClick: () => _e((r) => !r),
|
|
3317
|
+
className: j(
|
|
3289
3318
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3290
|
-
|
|
3319
|
+
se ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
3291
3320
|
),
|
|
3292
3321
|
children: [
|
|
3293
|
-
|
|
3294
|
-
|
|
3322
|
+
se ? `Comparing ${se.a} vs ${se.b}` : "Compare A/B",
|
|
3323
|
+
se && /* @__PURE__ */ e(
|
|
3295
3324
|
Ae,
|
|
3296
3325
|
{
|
|
3297
3326
|
className: "h-2.5 w-2.5",
|
|
3298
3327
|
onClick: (r) => {
|
|
3299
|
-
r.stopPropagation(),
|
|
3328
|
+
r.stopPropagation(), et(null);
|
|
3300
3329
|
}
|
|
3301
3330
|
}
|
|
3302
3331
|
)
|
|
3303
3332
|
]
|
|
3304
3333
|
}
|
|
3305
3334
|
),
|
|
3306
|
-
|
|
3335
|
+
Qe && /* @__PURE__ */ i("span", { className: "absolute left-0 top-full z-50 mt-1 flex w-72 flex-col gap-1.5 rounded-xl border border-slate-200 bg-white p-2.5 shadow-lg dark:border-border dark:bg-card", children: [
|
|
3307
3336
|
/* @__PURE__ */ e(
|
|
3308
3337
|
"input",
|
|
3309
3338
|
{
|
|
3310
|
-
value:
|
|
3311
|
-
onChange: (r) =>
|
|
3339
|
+
value: J,
|
|
3340
|
+
onChange: (r) => ft(r.target.value),
|
|
3312
3341
|
placeholder: "Filter field (e.g. division)",
|
|
3313
3342
|
className: "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
3314
3343
|
}
|
|
@@ -3317,8 +3346,8 @@ function zl({
|
|
|
3317
3346
|
/* @__PURE__ */ e(
|
|
3318
3347
|
"input",
|
|
3319
3348
|
{
|
|
3320
|
-
value:
|
|
3321
|
-
onChange: (r) =>
|
|
3349
|
+
value: Ue,
|
|
3350
|
+
onChange: (r) => xt(r.target.value),
|
|
3322
3351
|
placeholder: "Value A",
|
|
3323
3352
|
className: "h-7 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
3324
3353
|
}
|
|
@@ -3326,8 +3355,8 @@ function zl({
|
|
|
3326
3355
|
/* @__PURE__ */ e(
|
|
3327
3356
|
"input",
|
|
3328
3357
|
{
|
|
3329
|
-
value:
|
|
3330
|
-
onChange: (r) =>
|
|
3358
|
+
value: Ve,
|
|
3359
|
+
onChange: (r) => bt(r.target.value),
|
|
3331
3360
|
placeholder: "Value B",
|
|
3332
3361
|
className: "h-7 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card dark:text-slate-200"
|
|
3333
3362
|
}
|
|
@@ -3337,9 +3366,9 @@ function zl({
|
|
|
3337
3366
|
"button",
|
|
3338
3367
|
{
|
|
3339
3368
|
type: "button",
|
|
3340
|
-
disabled: !
|
|
3369
|
+
disabled: !J.trim() || !Ue.trim() || !Ve.trim(),
|
|
3341
3370
|
onClick: () => {
|
|
3342
|
-
|
|
3371
|
+
et({ field: J.trim(), a: Ue.trim(), b: Ve.trim() }), _e(!1);
|
|
3343
3372
|
},
|
|
3344
3373
|
className: "h-7 rounded-md bg-nvr-cyan text-[11.5px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3345
3374
|
children: "Compare"
|
|
@@ -3348,7 +3377,7 @@ function zl({
|
|
|
3348
3377
|
] })
|
|
3349
3378
|
] })
|
|
3350
3379
|
] }),
|
|
3351
|
-
|
|
3380
|
+
U.filter((r) => !l.some((v) => v.field === r.field)).length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5 px-1 pb-2", children: U.filter((r) => !l.some((v) => v.field === r.field)).map((r) => /* @__PURE__ */ i(
|
|
3352
3381
|
"span",
|
|
3353
3382
|
{
|
|
3354
3383
|
className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/[0.08] py-0.5 pl-2.5 pr-1 text-[11.5px] text-[#007a99] dark:text-nvr-cyan",
|
|
@@ -3362,7 +3391,7 @@ function zl({
|
|
|
3362
3391
|
type: "button",
|
|
3363
3392
|
"aria-label": "Remove filter",
|
|
3364
3393
|
onClick: () => {
|
|
3365
|
-
O((
|
|
3394
|
+
O((v) => v.filter((g) => g.field !== r.field)), pe((v) => v.filter((g) => g.field !== r.field));
|
|
3366
3395
|
},
|
|
3367
3396
|
className: "rounded-full p-0.5 hover:bg-nvr-cyan/[0.16]",
|
|
3368
3397
|
children: /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
@@ -3372,13 +3401,13 @@ function zl({
|
|
|
3372
3401
|
},
|
|
3373
3402
|
r.field
|
|
3374
3403
|
)) }),
|
|
3375
|
-
(re == null ? void 0 : re.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children:
|
|
3404
|
+
(re == null ? void 0 : re.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children: ye ? /* @__PURE__ */ i(He, { children: [
|
|
3376
3405
|
/* @__PURE__ */ e(
|
|
3377
3406
|
"button",
|
|
3378
3407
|
{
|
|
3379
3408
|
type: "button",
|
|
3380
3409
|
disabled: De.isPending,
|
|
3381
|
-
onClick: () =>
|
|
3410
|
+
onClick: () => ke && De.mutate(ke),
|
|
3382
3411
|
className: "rounded-md bg-nvr-cyan px-3 py-1 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3383
3412
|
children: De.isPending ? "Saving…" : "Save layout"
|
|
3384
3413
|
}
|
|
@@ -3388,7 +3417,7 @@ function zl({
|
|
|
3388
3417
|
{
|
|
3389
3418
|
type: "button",
|
|
3390
3419
|
onClick: () => {
|
|
3391
|
-
|
|
3420
|
+
Ze(!1), Fe(null), Ee(null);
|
|
3392
3421
|
},
|
|
3393
3422
|
className: "rounded-md border border-slate-200 px-3 py-1 text-[12px] text-slate-500 dark:border-border",
|
|
3394
3423
|
children: "Cancel"
|
|
@@ -3399,90 +3428,90 @@ function zl({
|
|
|
3399
3428
|
"button",
|
|
3400
3429
|
{
|
|
3401
3430
|
type: "button",
|
|
3402
|
-
onClick:
|
|
3431
|
+
onClick: gt,
|
|
3403
3432
|
className: "rounded-md border border-slate-200 px-3 py-1 text-[12px] font-medium text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400",
|
|
3404
3433
|
children: "Edit report"
|
|
3405
3434
|
}
|
|
3406
3435
|
) }),
|
|
3407
|
-
|
|
3408
|
-
|
|
3436
|
+
ye && ke && /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3437
|
+
Ia,
|
|
3409
3438
|
{
|
|
3410
|
-
maxY: Math.max(0, ...
|
|
3411
|
-
onAdd: (r) => Fe((
|
|
3439
|
+
maxY: Math.max(0, ...ke.map((r) => (r.y ?? 0) + (r.h ?? 1))),
|
|
3440
|
+
onAdd: (r) => Fe((v) => [...v ?? [], r])
|
|
3412
3441
|
}
|
|
3413
3442
|
) }) }),
|
|
3414
|
-
|
|
3443
|
+
s.length === 0 && !ye ? /* @__PURE__ */ e("div", { className: "p-6 text-[13px] text-slate-400", children: h ?? "This report has no widgets yet." }) : /* @__PURE__ */ e(
|
|
3415
3444
|
"div",
|
|
3416
3445
|
{
|
|
3417
3446
|
className: "grid gap-3",
|
|
3418
3447
|
style: {
|
|
3419
3448
|
gridTemplateColumns: "repeat(12, minmax(0, 1fr))",
|
|
3420
|
-
gridAutoRows:
|
|
3449
|
+
gridAutoRows: ye ? void 0 : "72px"
|
|
3421
3450
|
},
|
|
3422
|
-
children:
|
|
3423
|
-
var
|
|
3451
|
+
children: We(ye && ke ? ke : s).map((r) => {
|
|
3452
|
+
var v;
|
|
3424
3453
|
return /* @__PURE__ */ e(
|
|
3425
3454
|
"div",
|
|
3426
3455
|
{
|
|
3427
3456
|
style: {
|
|
3428
|
-
gridColumn:
|
|
3457
|
+
gridColumn: se ? "1 / -1" : `${Math.max(1, (r.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, r.w || 4))}`,
|
|
3429
3458
|
gridRow: void 0
|
|
3430
3459
|
},
|
|
3431
|
-
className:
|
|
3432
|
-
children:
|
|
3460
|
+
className: ye || se ? "" : "contents",
|
|
3461
|
+
children: se && !ye && r.type !== "divider" ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [se.a, se.b].map((g, k) => /* @__PURE__ */ i("div", { className: "flex min-h-[160px] flex-col", children: [
|
|
3433
3462
|
/* @__PURE__ */ i("p", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-[#007a99] dark:text-nvr-cyan", children: [
|
|
3434
|
-
|
|
3463
|
+
se.field.replace(/_/g, " "),
|
|
3435
3464
|
": ",
|
|
3436
|
-
|
|
3465
|
+
g
|
|
3437
3466
|
] }),
|
|
3438
3467
|
/* @__PURE__ */ e(
|
|
3439
|
-
|
|
3468
|
+
Lt,
|
|
3440
3469
|
{
|
|
3441
3470
|
reportId: t,
|
|
3442
3471
|
widget: r,
|
|
3443
|
-
dateRange:
|
|
3472
|
+
dateRange: Le,
|
|
3444
3473
|
entityFilters: [
|
|
3445
|
-
...
|
|
3446
|
-
{ field:
|
|
3474
|
+
...U.filter((d) => d.field !== se.field),
|
|
3475
|
+
{ field: se.field, values: [g], labels: [g] }
|
|
3447
3476
|
],
|
|
3448
|
-
refetchInterval:
|
|
3449
|
-
filterBar:
|
|
3450
|
-
onDrill:
|
|
3477
|
+
refetchInterval: c,
|
|
3478
|
+
filterBar: l,
|
|
3479
|
+
onDrill: E
|
|
3451
3480
|
}
|
|
3452
3481
|
)
|
|
3453
|
-
] },
|
|
3454
|
-
|
|
3455
|
-
|
|
3482
|
+
] }, k)) }) : /* @__PURE__ */ i(He, { children: [
|
|
3483
|
+
ye && /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3484
|
+
tl,
|
|
3456
3485
|
{
|
|
3457
3486
|
widget: r,
|
|
3458
|
-
onConfigure: () =>
|
|
3459
|
-
onDelete: () => Fe((
|
|
3460
|
-
onResize: (
|
|
3487
|
+
onConfigure: () => Ee(r.id),
|
|
3488
|
+
onDelete: () => Fe((g) => (g ?? []).filter((k) => k.id !== r.id)),
|
|
3489
|
+
onResize: (g, k) => tt({
|
|
3461
3490
|
...r,
|
|
3462
|
-
w: Math.min(12, Math.max(2, (r.w || 4) +
|
|
3463
|
-
h: Math.min(8, Math.max(1, (r.h || 2) +
|
|
3491
|
+
w: Math.min(12, Math.max(2, (r.w || 4) + g)),
|
|
3492
|
+
h: Math.min(8, Math.max(1, (r.h || 2) + k))
|
|
3464
3493
|
}),
|
|
3465
|
-
onMove: (
|
|
3494
|
+
onMove: (g) => vt(r.id, g)
|
|
3466
3495
|
}
|
|
3467
3496
|
) }),
|
|
3468
3497
|
/* @__PURE__ */ e(
|
|
3469
|
-
|
|
3498
|
+
Lt,
|
|
3470
3499
|
{
|
|
3471
3500
|
reportId: t,
|
|
3472
3501
|
widget: r,
|
|
3473
|
-
dateRange:
|
|
3474
|
-
entityFilters:
|
|
3475
|
-
refetchInterval:
|
|
3476
|
-
filterBar:
|
|
3477
|
-
onDrill:
|
|
3478
|
-
snapshot:
|
|
3479
|
-
asOf:
|
|
3480
|
-
annotations:
|
|
3481
|
-
onAddAnnotation: (
|
|
3482
|
-
onDeleteAnnotation: (
|
|
3483
|
-
onCrossFilter:
|
|
3502
|
+
dateRange: Le,
|
|
3503
|
+
entityFilters: U,
|
|
3504
|
+
refetchInterval: c,
|
|
3505
|
+
filterBar: l,
|
|
3506
|
+
onDrill: E,
|
|
3507
|
+
snapshot: _ && _.data[r.id] !== void 0 ? { name: _.name, value: ((v = _.data[r.id]) == null ? void 0 : v.value) ?? null } : null,
|
|
3508
|
+
asOf: ne,
|
|
3509
|
+
annotations: me.filter((g) => g.widget === r.id),
|
|
3510
|
+
onAddAnnotation: (g, k, d) => we.mutate({ widget: g, note: k, anchor_date: d }),
|
|
3511
|
+
onDeleteAnnotation: (g) => Te.mutate(g),
|
|
3512
|
+
onCrossFilter: Xe,
|
|
3484
3513
|
reportUrl: f,
|
|
3485
|
-
currentFilters:
|
|
3514
|
+
currentFilters: U
|
|
3486
3515
|
}
|
|
3487
3516
|
)
|
|
3488
3517
|
] })
|
|
@@ -3492,35 +3521,35 @@ function zl({
|
|
|
3492
3521
|
})
|
|
3493
3522
|
}
|
|
3494
3523
|
),
|
|
3495
|
-
|
|
3496
|
-
|
|
3524
|
+
ye && Ie && (ke == null ? void 0 : ke.some((r) => r.id === Ie)) && /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3525
|
+
el,
|
|
3497
3526
|
{
|
|
3498
|
-
widget:
|
|
3499
|
-
allWidgets:
|
|
3500
|
-
onChange:
|
|
3501
|
-
onClose: () =>
|
|
3527
|
+
widget: ke.find((r) => r.id === Ie),
|
|
3528
|
+
allWidgets: ke,
|
|
3529
|
+
onChange: tt,
|
|
3530
|
+
onClose: () => Ee(null)
|
|
3502
3531
|
}
|
|
3503
3532
|
) }),
|
|
3504
|
-
/* @__PURE__ */ e(
|
|
3533
|
+
/* @__PURE__ */ e(Qa, {}),
|
|
3505
3534
|
!L && (w != null && w.length) ? /* @__PURE__ */ e(
|
|
3506
|
-
|
|
3535
|
+
Ba,
|
|
3507
3536
|
{
|
|
3508
3537
|
collection: w[0].collection,
|
|
3509
3538
|
itemId: w[0].itemId,
|
|
3510
3539
|
title: w[0].title,
|
|
3511
3540
|
width: "72%",
|
|
3512
3541
|
stack: w,
|
|
3513
|
-
onPush: (r) =>
|
|
3514
|
-
onPop: () =>
|
|
3515
|
-
onClose: () =>
|
|
3542
|
+
onPush: (r) => q.push([...w, r]),
|
|
3543
|
+
onPop: () => q.back(),
|
|
3544
|
+
onClose: () => q.back(w.length)
|
|
3516
3545
|
}
|
|
3517
3546
|
) : null
|
|
3518
|
-
] }) : /* @__PURE__ */ e("div", { className:
|
|
3547
|
+
] }) : /* @__PURE__ */ e("div", { className: j("p-6 text-[13px] text-slate-400", m), children: "Report not found." });
|
|
3519
3548
|
}
|
|
3520
3549
|
export {
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3550
|
+
pl as AlertBell,
|
|
3551
|
+
ol as QueryWidgetBody,
|
|
3552
|
+
El as ReportView,
|
|
3553
|
+
jl as ReportWidgetCard,
|
|
3554
|
+
oa as shapeQueryRows
|
|
3526
3555
|
};
|