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