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