@nivaro/react 0.3.51 → 0.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/shared/components/ItemEditForm.js +3885 -3847
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { serverErrorText as It, loadErrorText as Tt } from "../lib/load-error.js
|
|
|
11
11
|
import { buildReportTree as Pa } from "../lib/report-tree.js";
|
|
12
12
|
import { uniqueByValue as za } from "../lib/unique-options.js";
|
|
13
13
|
import { useMyScopes as ja, matchScopeDimension as Ea, translateScopeValues as Pt, effectiveScopeSeedIds as Wa } from "../lib/use-my-scopes.js";
|
|
14
|
-
import { cn as
|
|
14
|
+
import { cn as Q } from "../lib/utils.js";
|
|
15
15
|
import { BackgroundRunOffer as ea } from "./BackgroundRunOffer.js";
|
|
16
16
|
import { RechartsGate as Re } from "./charts/RechartsGate.js";
|
|
17
17
|
import { LoadErrorNote as ta } from "./LoadErrorNote.js";
|
|
@@ -28,15 +28,15 @@ async function Ha(t, n) {
|
|
|
28
28
|
const o = a.getBoundingClientRect(), c = a.cloneNode(!0);
|
|
29
29
|
c.setAttribute("width", String(o.width)), c.setAttribute("height", String(o.height));
|
|
30
30
|
const m = new XMLSerializer().serializeToString(c), h = URL.createObjectURL(new Blob([m], { type: "image/svg+xml;charset=utf-8" })), f = new Image();
|
|
31
|
-
await new Promise((
|
|
32
|
-
f.onload = () =>
|
|
31
|
+
await new Promise((U, u) => {
|
|
32
|
+
f.onload = () => U(), f.onerror = () => u(new Error("svg load failed")), f.src = h;
|
|
33
33
|
});
|
|
34
34
|
const p = 2, L = document.createElement("canvas");
|
|
35
35
|
L.width = Math.max(1, Math.round(o.width * p)), L.height = Math.max(1, Math.round(o.height * p) + 28 * p);
|
|
36
36
|
const q = L.getContext("2d");
|
|
37
37
|
if (!q) return;
|
|
38
38
|
q.fillStyle = "#ffffff", q.fillRect(0, 0, L.width, L.height), q.fillStyle = "#172940", q.font = `${12 * p}px system-ui, sans-serif`, q.fillText(n || "Chart", 8 * p, 18 * p), q.drawImage(f, 0, 28 * p, o.width * p, o.height * p), URL.revokeObjectURL(h);
|
|
39
|
-
const w = await new Promise((
|
|
39
|
+
const w = await new Promise((U) => L.toBlob(U, "image/png"));
|
|
40
40
|
w && await navigator.clipboard.write([new ClipboardItem({ "image/png": w })]);
|
|
41
41
|
} catch {
|
|
42
42
|
}
|
|
@@ -92,7 +92,7 @@ function zt({ pct: t }) {
|
|
|
92
92
|
return /* @__PURE__ */ i(
|
|
93
93
|
"span",
|
|
94
94
|
{
|
|
95
|
-
className:
|
|
95
|
+
className: Q(
|
|
96
96
|
"inline-flex items-center gap-0.5 rounded px-1 py-px text-[10.5px] font-medium",
|
|
97
97
|
n ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400" : "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400"
|
|
98
98
|
),
|
|
@@ -117,7 +117,7 @@ function na({
|
|
|
117
117
|
queryKey: ["nivaro-report-filter-opts", t, n, o ?? null],
|
|
118
118
|
queryFn: async () => {
|
|
119
119
|
if (o) {
|
|
120
|
-
const u = o.value_field ?? "id", N = o.label_field ?? u,
|
|
120
|
+
const u = o.value_field ?? "id", N = o.label_field ?? u, Y = await f.request(
|
|
121
121
|
xa(o.collection, {
|
|
122
122
|
fields: [.../* @__PURE__ */ new Set(["id", u, N])],
|
|
123
123
|
sort: o.sort ? [o.sort] : void 0,
|
|
@@ -125,7 +125,7 @@ function na({
|
|
|
125
125
|
})
|
|
126
126
|
);
|
|
127
127
|
return za(
|
|
128
|
-
(
|
|
128
|
+
(Y.data ?? []).map((O) => ({
|
|
129
129
|
value: String(O[u] ?? O.id),
|
|
130
130
|
label: String(O[N] ?? O[u] ?? O.id)
|
|
131
131
|
})),
|
|
@@ -136,19 +136,19 @@ function na({
|
|
|
136
136
|
},
|
|
137
137
|
enabled: p,
|
|
138
138
|
staleTime: 12e4
|
|
139
|
-
}), w = h != null && h.length ? q.filter((u) => h.some((N) => String(N) === u.value)) : q,
|
|
139
|
+
}), w = h != null && h.length ? q.filter((u) => h.some((N) => String(N) === u.value)) : q, U = c.length > 0;
|
|
140
140
|
return /* @__PURE__ */ i(aa, { open: p, onOpenChange: L, children: [
|
|
141
141
|
/* @__PURE__ */ e(la, { asChild: !0, children: /* @__PURE__ */ i(
|
|
142
142
|
"button",
|
|
143
143
|
{
|
|
144
144
|
type: "button",
|
|
145
|
-
className:
|
|
145
|
+
className: Q(
|
|
146
146
|
"flex h-7 items-center gap-1.5 rounded-md border px-2 text-[12px]",
|
|
147
|
-
|
|
147
|
+
U ? "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"
|
|
148
148
|
),
|
|
149
149
|
children: [
|
|
150
150
|
a,
|
|
151
|
-
|
|
151
|
+
U && /* @__PURE__ */ e("span", { className: "rounded-full bg-white/60 px-1 text-[10px] dark:bg-black/20", children: c.length }),
|
|
152
152
|
/* @__PURE__ */ e(Jt, { className: "h-3 w-3 opacity-50" })
|
|
153
153
|
]
|
|
154
154
|
}
|
|
@@ -158,21 +158,21 @@ function na({
|
|
|
158
158
|
/* @__PURE__ */ i(Va, { className: "max-h-52", children: [
|
|
159
159
|
/* @__PURE__ */ e(Ja, { children: "No values." }),
|
|
160
160
|
w.map((u) => {
|
|
161
|
-
const N = c.some((
|
|
161
|
+
const N = c.some((Y) => String(Y) === u.value);
|
|
162
162
|
return /* @__PURE__ */ i(
|
|
163
163
|
Ga,
|
|
164
164
|
{
|
|
165
165
|
value: u.label,
|
|
166
166
|
onSelect: () => {
|
|
167
|
-
const
|
|
168
|
-
var
|
|
169
|
-
return ((
|
|
167
|
+
const Y = N ? c.filter((ee) => String(ee) !== u.value) : [...c, u.value], O = (ee) => {
|
|
168
|
+
var X;
|
|
169
|
+
return ((X = q.find((ue) => ue.value === String(ee))) == null ? void 0 : X.label) ?? String(ee);
|
|
170
170
|
};
|
|
171
|
-
m(
|
|
171
|
+
m(Y, Y.map(O));
|
|
172
172
|
},
|
|
173
173
|
className: "text-[12.5px]",
|
|
174
174
|
children: [
|
|
175
|
-
/* @__PURE__ */ e(Ut, { className:
|
|
175
|
+
/* @__PURE__ */ e(Ut, { className: Q("mr-1.5 h-3 w-3", N ? "opacity-100" : "opacity-0") }),
|
|
176
176
|
u.label
|
|
177
177
|
]
|
|
178
178
|
},
|
|
@@ -276,24 +276,24 @@ function sl({
|
|
|
276
276
|
), [h, f] = C(() => /* @__PURE__ */ new Set()), [p, L] = C(!1);
|
|
277
277
|
mt(() => {
|
|
278
278
|
if (p || m.length === 0) return;
|
|
279
|
-
const u = /* @__PURE__ */ new Set(), N = (
|
|
280
|
-
for (const O of
|
|
279
|
+
const u = /* @__PURE__ */ new Set(), N = (Y) => {
|
|
280
|
+
for (const O of Y)
|
|
281
281
|
(O.depth > 0 || m.length === 1) && u.add(O.key), N(O.children);
|
|
282
282
|
};
|
|
283
283
|
N(m), f(u), L(!0);
|
|
284
284
|
}, [m, p]);
|
|
285
285
|
const q = (o == null ? void 0 : o.thresholds) ?? nl, w = (u) => {
|
|
286
286
|
var N;
|
|
287
|
-
return u == null ? void 0 : ((N = q.find((
|
|
288
|
-
},
|
|
289
|
-
const N = u.children.length === 0,
|
|
287
|
+
return u == null ? void 0 : ((N = q.find((Y) => u >= Y.gte)) == null ? void 0 : N.color) ?? "#10b981";
|
|
288
|
+
}, U = (u) => {
|
|
289
|
+
const N = u.children.length === 0, Y = h.has(u.key), O = w(u.pct), ee = N && (o == null ? void 0 : o.drill) && u.drillId != null;
|
|
290
290
|
return /* @__PURE__ */ i("div", { style: { paddingLeft: u.depth === 0 ? 0 : 14 }, children: [
|
|
291
291
|
/* @__PURE__ */ i(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
294
|
role: ee || !N ? "button" : void 0,
|
|
295
295
|
tabIndex: ee || !N ? 0 : void 0,
|
|
296
|
-
className:
|
|
296
|
+
className: Q(
|
|
297
297
|
"group/tn rounded-md px-1.5 py-1",
|
|
298
298
|
(ee || !N) && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40"
|
|
299
299
|
),
|
|
@@ -302,22 +302,22 @@ function sl({
|
|
|
302
302
|
collection: o.drill.collection,
|
|
303
303
|
itemId: String(u.drillId),
|
|
304
304
|
title: u.label
|
|
305
|
-
}) : f((
|
|
306
|
-
const ue = new Set(
|
|
305
|
+
}) : f((X) => {
|
|
306
|
+
const ue = new Set(X);
|
|
307
307
|
return ue.has(u.key) ? ue.delete(u.key) : ue.add(u.key), ue;
|
|
308
308
|
});
|
|
309
309
|
},
|
|
310
|
-
onKeyDown: (
|
|
311
|
-
(
|
|
310
|
+
onKeyDown: (X) => {
|
|
311
|
+
(X.key === "Enter" || X.key === " ") && X.currentTarget.click();
|
|
312
312
|
},
|
|
313
313
|
children: [
|
|
314
314
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
315
315
|
N ? /* @__PURE__ */ e("span", { className: "w-3 shrink-0" }) : /* @__PURE__ */ e(
|
|
316
316
|
Jt,
|
|
317
317
|
{
|
|
318
|
-
className:
|
|
318
|
+
className: Q(
|
|
319
319
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
320
|
-
|
|
320
|
+
Y && "rotate-180"
|
|
321
321
|
)
|
|
322
322
|
}
|
|
323
323
|
),
|
|
@@ -325,9 +325,9 @@ function sl({
|
|
|
325
325
|
/* @__PURE__ */ e(
|
|
326
326
|
"span",
|
|
327
327
|
{
|
|
328
|
-
className:
|
|
328
|
+
className: Q(
|
|
329
329
|
"min-w-0 flex-1 truncate",
|
|
330
|
-
u.depth === 0 ? "text-[12px] font-semibold text-slate-800 dark:text-slate-100" : u.depth === 1 ? "text-[11.5px] font-medium text-slate-700 dark:text-slate-200" :
|
|
330
|
+
u.depth === 0 ? "text-[12px] font-semibold text-slate-800 dark:text-slate-100" : u.depth === 1 ? "text-[11.5px] font-medium text-slate-700 dark:text-slate-200" : Q(
|
|
331
331
|
"text-[11px] text-slate-600 dark:text-slate-300",
|
|
332
332
|
ee && "group-hover/tn:underline"
|
|
333
333
|
)
|
|
@@ -350,7 +350,7 @@ function sl({
|
|
|
350
350
|
(o == null ? void 0 : o.pct) && u.pct != null && /* @__PURE__ */ e(
|
|
351
351
|
"div",
|
|
352
352
|
{
|
|
353
|
-
className:
|
|
353
|
+
className: Q(
|
|
354
354
|
"ml-[18px] mt-0.5 overflow-hidden rounded-full bg-slate-100 dark:bg-muted",
|
|
355
355
|
u.depth === 0 ? "h-[5px]" : u.depth === 1 ? "h-[3px]" : "h-[2px]"
|
|
356
356
|
),
|
|
@@ -363,18 +363,18 @@ function sl({
|
|
|
363
363
|
)
|
|
364
364
|
}
|
|
365
365
|
),
|
|
366
|
-
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((
|
|
367
|
-
|
|
366
|
+
/* @__PURE__ */ e("div", { className: "ml-[18px] mt-0.5 flex flex-wrap gap-x-3 text-[10px] tabular-nums text-slate-400", children: c.map((X) => /* @__PURE__ */ i("span", { children: [
|
|
367
|
+
X.label ?? X.field,
|
|
368
368
|
" ",
|
|
369
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: u.sums[
|
|
370
|
-
] },
|
|
369
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: u.sums[X.field] == null ? X.empty_label ?? "—" : n.value_format === "currency" ? rl(u.sums[X.field]) : u.sums[X.field].toLocaleString() })
|
|
370
|
+
] }, X.field)) })
|
|
371
371
|
]
|
|
372
372
|
}
|
|
373
373
|
),
|
|
374
|
-
|
|
374
|
+
Y && u.children.map(U)
|
|
375
375
|
] }, u.key);
|
|
376
376
|
};
|
|
377
|
-
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(
|
|
377
|
+
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(U) });
|
|
378
378
|
}
|
|
379
379
|
function il(t) {
|
|
380
380
|
const [n, a] = C(() => typeof IntersectionObserver > "u");
|
|
@@ -452,9 +452,9 @@ function dl({
|
|
|
452
452
|
deferred: h = !1
|
|
453
453
|
}) {
|
|
454
454
|
var le, ae;
|
|
455
|
-
const f = Ke(), p = ol(m), [L, q] = C(""), [w,
|
|
456
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
457
|
-
queryFn: ({ signal: S }) => da(f, t.slug,
|
|
455
|
+
const f = Ke(), p = ol(m), [L, q] = C(""), [w, U] = C(0), [u, N] = C(null), Y = ia(t, n, a), { data: O, isLoading: ee, error: X, isFetching: ue, refetch: pe } = Ne({
|
|
456
|
+
queryKey: ["nivaro-report-query", t.slug, Y],
|
|
457
|
+
queryFn: ({ signal: S }) => da(f, t.slug, Y, S),
|
|
458
458
|
enabled: !h,
|
|
459
459
|
staleTime: 6e4,
|
|
460
460
|
refetchInterval: o,
|
|
@@ -474,42 +474,42 @@ function dl({
|
|
|
474
474
|
request: {
|
|
475
475
|
method: "POST",
|
|
476
476
|
url: `/custom-queries/${t.slug}/execute`,
|
|
477
|
-
body: { params:
|
|
477
|
+
body: { params: Y }
|
|
478
478
|
},
|
|
479
479
|
label: `Query ${t.slug}`,
|
|
480
|
-
queryKey: ["nivaro-report-query", t.slug,
|
|
480
|
+
queryKey: ["nivaro-report-query", t.slug, Y],
|
|
481
481
|
select: (S) => (S == null ? void 0 : S.data) ?? []
|
|
482
482
|
}
|
|
483
483
|
)
|
|
484
484
|
] });
|
|
485
|
-
if (
|
|
485
|
+
if (X)
|
|
486
486
|
return /* @__PURE__ */ e(
|
|
487
487
|
ta,
|
|
488
488
|
{
|
|
489
489
|
className: "px-1",
|
|
490
|
-
message: It(
|
|
490
|
+
message: It(X) ?? Tt(X, "this query"),
|
|
491
491
|
onRetry: () => void pe()
|
|
492
492
|
}
|
|
493
493
|
);
|
|
494
|
-
const
|
|
495
|
-
if (
|
|
496
|
-
const de = t.columns && t.columns.length > 0 ? t.columns : Object.keys(
|
|
494
|
+
const H = oa(t, O ?? []);
|
|
495
|
+
if (H.length === 0) return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
496
|
+
const de = t.columns && t.columns.length > 0 ? t.columns : Object.keys(H[0] ?? {}).map((S) => ({ field: S }));
|
|
497
497
|
if (t.display === "kpis") {
|
|
498
|
-
const S = t.x_field ?
|
|
499
|
-
var
|
|
498
|
+
const S = t.x_field ? H.map((A, E) => {
|
|
499
|
+
var J, ne, ce, fe, _;
|
|
500
500
|
return {
|
|
501
|
-
label: String(
|
|
502
|
-
value:
|
|
503
|
-
color: ((_ = (fe = t.series) == null ? void 0 : fe[0]) == null ? void 0 : _.color) ?? oe[
|
|
501
|
+
label: String(A[t.x_field] ?? ""),
|
|
502
|
+
value: A[((ne = (J = t.series) == null ? void 0 : J[0]) == null ? void 0 : ne.field) ?? ((ce = de.find((P) => P.field !== t.x_field)) == null ? void 0 : ce.field) ?? ""],
|
|
503
|
+
color: ((_ = (fe = t.series) == null ? void 0 : fe[0]) == null ? void 0 : _.color) ?? oe[E % oe.length],
|
|
504
504
|
format: t.value_format
|
|
505
505
|
};
|
|
506
|
-
}) : de.map((
|
|
507
|
-
var
|
|
506
|
+
}) : de.map((A, E) => {
|
|
507
|
+
var J;
|
|
508
508
|
return {
|
|
509
|
-
label:
|
|
510
|
-
value: (
|
|
511
|
-
color: oe[
|
|
512
|
-
format:
|
|
509
|
+
label: A.label ?? A.field,
|
|
510
|
+
value: (J = H[0]) == null ? void 0 : J[A.field],
|
|
511
|
+
color: oe[E % oe.length],
|
|
512
|
+
format: A.format ?? t.value_format
|
|
513
513
|
};
|
|
514
514
|
});
|
|
515
515
|
return /* @__PURE__ */ e(
|
|
@@ -517,37 +517,37 @@ function dl({
|
|
|
517
517
|
{
|
|
518
518
|
className: "grid gap-2",
|
|
519
519
|
style: { gridTemplateColumns: `repeat(${Math.min(6, Math.max(1, S.length))}, 1fr)` },
|
|
520
|
-
children: S.map((
|
|
520
|
+
children: S.map((A) => /* @__PURE__ */ i(
|
|
521
521
|
"div",
|
|
522
522
|
{
|
|
523
523
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
524
|
-
style: { borderTopColor:
|
|
524
|
+
style: { borderTopColor: A.color, borderTopWidth: 2 },
|
|
525
525
|
children: [
|
|
526
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children:
|
|
527
|
-
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: je(
|
|
526
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[10.5px] uppercase tracking-wide text-slate-400", children: A.label }),
|
|
527
|
+
/* @__PURE__ */ e("p", { className: "text-[19px] font-semibold leading-tight text-slate-900 dark:text-foreground", children: je(A.value, A.format ?? "integer") })
|
|
528
528
|
]
|
|
529
529
|
},
|
|
530
|
-
|
|
530
|
+
A.label
|
|
531
531
|
))
|
|
532
532
|
}
|
|
533
533
|
);
|
|
534
534
|
}
|
|
535
535
|
if (t.display === "tree")
|
|
536
|
-
return /* @__PURE__ */ e(sl, { rows:
|
|
536
|
+
return /* @__PURE__ */ e(sl, { rows: H, cfg: t, onDrill: (S) => m == null ? void 0 : m(S) });
|
|
537
537
|
if (t.display === "table") {
|
|
538
|
-
const S = de.filter((_) => ze.has(_.format ?? "")),
|
|
538
|
+
const S = de.filter((_) => ze.has(_.format ?? "")), A = L.trim().toLowerCase(), E = A ? H.filter(
|
|
539
539
|
(_) => Object.values(_).some(
|
|
540
|
-
(
|
|
540
|
+
(P) => String(P ?? "").toLowerCase().includes(A)
|
|
541
541
|
)
|
|
542
|
-
) :
|
|
542
|
+
) : H, J = 12, ne = Math.max(1, Math.ceil(E.length / J)), ce = Math.min(w, ne - 1), fe = E.length > J ? E.slice(ce * J, ce * J + J) : E;
|
|
543
543
|
return /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
544
|
-
|
|
544
|
+
H.length > J && /* @__PURE__ */ i("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
545
545
|
/* @__PURE__ */ e(
|
|
546
546
|
"input",
|
|
547
547
|
{
|
|
548
548
|
value: L,
|
|
549
549
|
onChange: (_) => {
|
|
550
|
-
q(_.target.value),
|
|
550
|
+
q(_.target.value), U(0);
|
|
551
551
|
},
|
|
552
552
|
placeholder: "Search rows…",
|
|
553
553
|
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"
|
|
@@ -559,7 +559,7 @@ function dl({
|
|
|
559
559
|
{
|
|
560
560
|
type: "button",
|
|
561
561
|
disabled: ce <= 0,
|
|
562
|
-
onClick: () =>
|
|
562
|
+
onClick: () => U(ce - 1),
|
|
563
563
|
className: "rounded px-1 disabled:opacity-30",
|
|
564
564
|
children: "←"
|
|
565
565
|
}
|
|
@@ -572,7 +572,7 @@ function dl({
|
|
|
572
572
|
{
|
|
573
573
|
type: "button",
|
|
574
574
|
disabled: ce >= ne - 1,
|
|
575
|
-
onClick: () =>
|
|
575
|
+
onClick: () => U(ce + 1),
|
|
576
576
|
className: "rounded px-1 disabled:opacity-30",
|
|
577
577
|
children: "→"
|
|
578
578
|
}
|
|
@@ -583,7 +583,7 @@ function dl({
|
|
|
583
583
|
/* @__PURE__ */ e("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: de.map((_) => /* @__PURE__ */ e(
|
|
584
584
|
"th",
|
|
585
585
|
{
|
|
586
|
-
className:
|
|
586
|
+
className: Q(
|
|
587
587
|
"whitespace-nowrap border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
|
|
588
588
|
ze.has(_.format ?? "") && "text-right"
|
|
589
589
|
),
|
|
@@ -591,7 +591,7 @@ function dl({
|
|
|
591
591
|
},
|
|
592
592
|
_.field
|
|
593
593
|
)) }) }),
|
|
594
|
-
/* @__PURE__ */ e("tbody", { children: fe.map((_,
|
|
594
|
+
/* @__PURE__ */ e("tbody", { children: fe.map((_, P) => /* @__PURE__ */ e(
|
|
595
595
|
"tr",
|
|
596
596
|
{
|
|
597
597
|
className: m ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60" : void 0,
|
|
@@ -600,7 +600,7 @@ function dl({
|
|
|
600
600
|
children: de.map((me) => /* @__PURE__ */ e(
|
|
601
601
|
"td",
|
|
602
602
|
{
|
|
603
|
-
className:
|
|
603
|
+
className: Q(
|
|
604
604
|
"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",
|
|
605
605
|
ze.has(me.format ?? "") && "text-right tabular-nums"
|
|
606
606
|
),
|
|
@@ -609,17 +609,17 @@ function dl({
|
|
|
609
609
|
me.field
|
|
610
610
|
))
|
|
611
611
|
},
|
|
612
|
-
|
|
612
|
+
P
|
|
613
613
|
)) }),
|
|
614
|
-
t.totals && S.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: de.map((_,
|
|
614
|
+
t.totals && S.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: de.map((_, P) => /* @__PURE__ */ e(
|
|
615
615
|
"td",
|
|
616
616
|
{
|
|
617
|
-
className:
|
|
617
|
+
className: Q(
|
|
618
618
|
"border-t border-slate-200 px-1.5 py-1 font-semibold text-slate-800 dark:border-border dark:text-slate-200",
|
|
619
619
|
ze.has(_.format ?? "") && "text-right tabular-nums"
|
|
620
620
|
),
|
|
621
|
-
children:
|
|
622
|
-
|
|
621
|
+
children: P === 0 && !ze.has(_.format ?? "") ? "Total" : ze.has(_.format ?? "") ? je(
|
|
622
|
+
H.reduce((me, ve) => me + (Number(ve[_.field]) || 0), 0),
|
|
623
623
|
_.format,
|
|
624
624
|
_.decimals
|
|
625
625
|
) : ""
|
|
@@ -630,17 +630,17 @@ function dl({
|
|
|
630
630
|
] });
|
|
631
631
|
}
|
|
632
632
|
const xe = t.x_field ?? ((le = de[0]) == null ? void 0 : le.field) ?? "", be = t.series && t.series.length > 0 ? t.series : de.filter((S) => {
|
|
633
|
-
var
|
|
634
|
-
return S.field !== xe && typeof ((
|
|
635
|
-
}).slice(0, 3).map((S) => ({ field: S.field, label: S.label ?? S.field })), ge =
|
|
636
|
-
const
|
|
637
|
-
for (const
|
|
638
|
-
return
|
|
633
|
+
var A;
|
|
634
|
+
return S.field !== xe && typeof ((A = H[0]) == null ? void 0 : A[S.field]) == "number";
|
|
635
|
+
}).slice(0, 3).map((S) => ({ field: S.field, label: S.label ?? S.field })), ge = H.map((S) => {
|
|
636
|
+
const A = { [xe]: S[xe] };
|
|
637
|
+
for (const E of be) A[E.field] = Number(S[E.field]) || 0;
|
|
638
|
+
return A;
|
|
639
639
|
}), $e = (S) => t.value_format === "currency" ? `$${Ce(S)}` : Ce(S), x = (S) => je(S, t.value_format ?? "number"), Z = t.display === "hbar" || t.display === "stacked_bar" && t.horizontal, te = (S) => {
|
|
640
640
|
if (!m) return;
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
},
|
|
641
|
+
const A = (O ?? []).filter((E) => String(E[xe] ?? "") === S);
|
|
642
|
+
A.length > 0 && N({ label: S, rows: A });
|
|
643
|
+
}, V = u ? /* @__PURE__ */ e(
|
|
644
644
|
"div",
|
|
645
645
|
{
|
|
646
646
|
className: "fixed inset-0 z-[126] flex items-center justify-center bg-black/30 p-6",
|
|
@@ -676,23 +676,23 @@ function dl({
|
|
|
676
676
|
},
|
|
677
677
|
S
|
|
678
678
|
)) }) }),
|
|
679
|
-
/* @__PURE__ */ e("tbody", { children: u.rows.slice(0, 100).map((S,
|
|
679
|
+
/* @__PURE__ */ e("tbody", { children: u.rows.slice(0, 100).map((S, A) => /* @__PURE__ */ e(
|
|
680
680
|
"tr",
|
|
681
681
|
{
|
|
682
682
|
className: "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60",
|
|
683
683
|
onClick: () => {
|
|
684
684
|
N(null), p(S);
|
|
685
685
|
},
|
|
686
|
-
children: Object.keys(u.rows[0] ?? {}).slice(0, 7).map((
|
|
686
|
+
children: Object.keys(u.rows[0] ?? {}).slice(0, 7).map((E) => /* @__PURE__ */ e(
|
|
687
687
|
"td",
|
|
688
688
|
{
|
|
689
689
|
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",
|
|
690
|
-
children: String(S[
|
|
690
|
+
children: String(S[E] ?? "")
|
|
691
691
|
},
|
|
692
|
-
|
|
692
|
+
E
|
|
693
693
|
))
|
|
694
694
|
},
|
|
695
|
-
|
|
695
|
+
A
|
|
696
696
|
)) })
|
|
697
697
|
] }) })
|
|
698
698
|
]
|
|
@@ -701,14 +701,14 @@ function dl({
|
|
|
701
701
|
}
|
|
702
702
|
) : null;
|
|
703
703
|
if (t.display === "donut") {
|
|
704
|
-
const S = ((ae = be[0]) == null ? void 0 : ae.field) ?? "",
|
|
704
|
+
const S = ((ae = be[0]) == null ? void 0 : ae.field) ?? "", A = ge.map((J) => ({ dim: String(J[xe]), value: Number(J[S]) || 0 })), E = A.reduce((J, ne) => J + ne.value, 0);
|
|
705
705
|
return /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
706
706
|
/* @__PURE__ */ i("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
707
|
-
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell:
|
|
707
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: J, Pie: ne, PieChart: ce, ResponsiveContainer: fe, Tooltip: _ }) => /* @__PURE__ */ e(fe, { width: "100%", height: "100%", children: /* @__PURE__ */ i(ce, { children: [
|
|
708
708
|
/* @__PURE__ */ e(
|
|
709
709
|
ne,
|
|
710
710
|
{
|
|
711
|
-
data:
|
|
711
|
+
data: A,
|
|
712
712
|
dataKey: "value",
|
|
713
713
|
nameKey: "dim",
|
|
714
714
|
innerRadius: "58%",
|
|
@@ -716,12 +716,12 @@ function dl({
|
|
|
716
716
|
paddingAngle: 2,
|
|
717
717
|
strokeWidth: 0,
|
|
718
718
|
className: m ? "cursor-pointer" : void 0,
|
|
719
|
-
onClick: (
|
|
719
|
+
onClick: (P) => {
|
|
720
720
|
var ve;
|
|
721
|
-
const me = (ve =
|
|
721
|
+
const me = (ve = P == null ? void 0 : P.payload) == null ? void 0 : ve.dim;
|
|
722
722
|
me && te(String(me));
|
|
723
723
|
},
|
|
724
|
-
children:
|
|
724
|
+
children: A.map((P, me) => /* @__PURE__ */ e(J, { fill: oe[me % oe.length] }, P.dim))
|
|
725
725
|
}
|
|
726
726
|
),
|
|
727
727
|
/* @__PURE__ */ e(
|
|
@@ -736,16 +736,16 @@ function dl({
|
|
|
736
736
|
},
|
|
737
737
|
labelStyle: { color: "#f1f5f9" },
|
|
738
738
|
itemStyle: { color: "#e2e8f0" },
|
|
739
|
-
formatter: (
|
|
739
|
+
formatter: (P) => x(P)
|
|
740
740
|
}
|
|
741
741
|
)
|
|
742
742
|
] }) }) }),
|
|
743
743
|
/* @__PURE__ */ i("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
744
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: je(
|
|
744
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: je(E, t.value_format ?? "integer") }),
|
|
745
745
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
746
746
|
] })
|
|
747
747
|
] }),
|
|
748
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children:
|
|
748
|
+
/* @__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((J, ne) => /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
749
749
|
/* @__PURE__ */ e(
|
|
750
750
|
"span",
|
|
751
751
|
{
|
|
@@ -753,15 +753,15 @@ function dl({
|
|
|
753
753
|
style: { background: oe[ne % oe.length] }
|
|
754
754
|
}
|
|
755
755
|
),
|
|
756
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
757
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: x(
|
|
758
|
-
] },
|
|
759
|
-
|
|
756
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: J.dim }),
|
|
757
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: x(J.value) })
|
|
758
|
+
] }, J.dim)) }),
|
|
759
|
+
V
|
|
760
760
|
] });
|
|
761
761
|
}
|
|
762
762
|
if (t.display === "line" || t.display === "area")
|
|
763
763
|
return /* @__PURE__ */ i("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
764
|
-
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Area: S, AreaChart:
|
|
764
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Area: S, AreaChart: A, Legend: E, ResponsiveContainer: J, Tooltip: ne, XAxis: ce, YAxis: fe }) => /* @__PURE__ */ e(J, { width: "100%", height: "100%", children: /* @__PURE__ */ i(A, { data: ge, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
765
765
|
/* @__PURE__ */ e(
|
|
766
766
|
ce,
|
|
767
767
|
{
|
|
@@ -787,28 +787,28 @@ function dl({
|
|
|
787
787
|
formatter: (_) => x(_)
|
|
788
788
|
}
|
|
789
789
|
),
|
|
790
|
-
be.length > 1 && /* @__PURE__ */ e(
|
|
791
|
-
be.map((_,
|
|
790
|
+
be.length > 1 && /* @__PURE__ */ e(E, { wrapperStyle: { fontSize: 11 } }),
|
|
791
|
+
be.map((_, P) => /* @__PURE__ */ e(
|
|
792
792
|
S,
|
|
793
793
|
{
|
|
794
794
|
type: "monotone",
|
|
795
795
|
dataKey: _.field,
|
|
796
796
|
name: _.label ?? _.field,
|
|
797
|
-
stroke: _.color ?? oe[
|
|
797
|
+
stroke: _.color ?? oe[P % oe.length],
|
|
798
798
|
strokeWidth: 2,
|
|
799
799
|
strokeDasharray: _.dash ? "4 3" : void 0,
|
|
800
|
-
fill: _.color ?? oe[
|
|
800
|
+
fill: _.color ?? oe[P % oe.length],
|
|
801
801
|
fillOpacity: t.display === "area" && !_.dash ? 0.12 : 0
|
|
802
802
|
},
|
|
803
803
|
_.field
|
|
804
804
|
))
|
|
805
805
|
] }) }) }),
|
|
806
|
-
|
|
806
|
+
V
|
|
807
807
|
] });
|
|
808
808
|
const he = t.display === "stacked_bar";
|
|
809
809
|
return /* @__PURE__ */ i("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
810
|
-
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: S, BarChart:
|
|
811
|
-
|
|
810
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: S, BarChart: A, Cell: E, Legend: J, ResponsiveContainer: ne, Tooltip: ce, XAxis: fe, YAxis: _ }) => /* @__PURE__ */ e(ne, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
811
|
+
A,
|
|
812
812
|
{
|
|
813
813
|
data: ge,
|
|
814
814
|
layout: Z ? "vertical" : "horizontal",
|
|
@@ -831,7 +831,9 @@ function dl({
|
|
|
831
831
|
dataKey: xe,
|
|
832
832
|
tick: { fontSize: 10 },
|
|
833
833
|
stroke: "#94a3b8",
|
|
834
|
-
width:
|
|
834
|
+
width: 140,
|
|
835
|
+
interval: 0,
|
|
836
|
+
tickFormatter: gl
|
|
835
837
|
}
|
|
836
838
|
)
|
|
837
839
|
] }) : /* @__PURE__ */ i(He, { children: [
|
|
@@ -858,11 +860,11 @@ function dl({
|
|
|
858
860
|
},
|
|
859
861
|
labelStyle: { color: "#f1f5f9" },
|
|
860
862
|
itemStyle: { color: "#e2e8f0" },
|
|
861
|
-
formatter: (
|
|
863
|
+
formatter: (P) => x(P)
|
|
862
864
|
}
|
|
863
865
|
),
|
|
864
|
-
be.length > 1 && /* @__PURE__ */ e(
|
|
865
|
-
be.map((
|
|
866
|
+
be.length > 1 && /* @__PURE__ */ e(J, { wrapperStyle: { fontSize: 11 } }),
|
|
867
|
+
be.map((P, me) => /* @__PURE__ */ e(
|
|
866
868
|
S,
|
|
867
869
|
{
|
|
868
870
|
className: m ? "cursor-pointer" : void 0,
|
|
@@ -871,19 +873,19 @@ function dl({
|
|
|
871
873
|
const we = (Te = ve == null ? void 0 : ve.payload) == null ? void 0 : Te[xe];
|
|
872
874
|
we != null && te(String(we));
|
|
873
875
|
},
|
|
874
|
-
dataKey:
|
|
875
|
-
name:
|
|
876
|
+
dataKey: P.field,
|
|
877
|
+
name: P.label ?? P.field,
|
|
876
878
|
stackId: he ? "stack" : void 0,
|
|
877
|
-
fill:
|
|
879
|
+
fill: P.color ?? oe[me % oe.length],
|
|
878
880
|
radius: he ? 0 : Z ? [0, 3, 3, 0] : [3, 3, 0, 0],
|
|
879
|
-
children: be.length === 1 && !
|
|
881
|
+
children: be.length === 1 && !P.color && ge.map((ve, we) => /* @__PURE__ */ e(E, { fill: oe[we % oe.length] }, we))
|
|
880
882
|
},
|
|
881
|
-
|
|
883
|
+
P.field
|
|
882
884
|
))
|
|
883
885
|
]
|
|
884
886
|
}
|
|
885
887
|
) }) }),
|
|
886
|
-
|
|
888
|
+
V
|
|
887
889
|
] });
|
|
888
890
|
}
|
|
889
891
|
const cl = ["gt", "gte", "lt", "lte", "eq"], ca = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }, ml = ["sum", "avg", "max", "min"];
|
|
@@ -935,13 +937,13 @@ function pl({ reportId: t, alert: n }) {
|
|
|
935
937
|
/* @__PURE__ */ e(
|
|
936
938
|
"span",
|
|
937
939
|
{
|
|
938
|
-
className:
|
|
940
|
+
className: Q(
|
|
939
941
|
"h-1.5 w-1.5 shrink-0 rounded-full",
|
|
940
942
|
h.status === "firing" ? "bg-amber-500" : "bg-emerald-500"
|
|
941
943
|
)
|
|
942
944
|
}
|
|
943
945
|
),
|
|
944
|
-
/* @__PURE__ */ e("span", { className:
|
|
946
|
+
/* @__PURE__ */ e("span", { className: Q(h.status === "firing" ? "text-amber-600" : "text-slate-500"), children: h.status === "firing" ? "Firing" : "Resolved" }),
|
|
945
947
|
/* @__PURE__ */ i("span", { className: "min-w-0 flex-1 truncate text-slate-400", children: [
|
|
946
948
|
new Date(h.fired_at).toLocaleString(),
|
|
947
949
|
h.resolved_at ? ` → ${new Date(h.resolved_at).toLocaleString()}` : ""
|
|
@@ -964,17 +966,17 @@ function hl({
|
|
|
964
966
|
}) {
|
|
965
967
|
const o = Ke(), c = Ct(), [m, h] = C(!1), [f, p] = C(""), [L, q] = C([
|
|
966
968
|
{ field: "value", agg: "sum", op: "gt", value: "" }
|
|
967
|
-
]), [w,
|
|
969
|
+
]), [w, U] = C([]), [u, N] = C(!1), [Y, O] = C(null), ee = ul(n), { data: X = [] } = Ne({
|
|
968
970
|
queryKey: ["nivaro-report-alerts", t],
|
|
969
971
|
queryFn: () => o.request(va(t)).then((x) => x.data),
|
|
970
972
|
enabled: m,
|
|
971
973
|
staleTime: 3e4
|
|
972
|
-
}), ue =
|
|
973
|
-
const Z = ee.find((
|
|
974
|
+
}), ue = X.filter((x) => x.widget === n.id), pe = () => void c.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] }), H = () => L.filter((x) => x.value.trim() !== "" && !Number.isNaN(Number(x.value))).map((x) => {
|
|
975
|
+
const Z = ee.find((V) => V.value === x.field);
|
|
974
976
|
return { field: Z != null && Z.aggregatable && x.agg !== "sum" ? `${x.agg}:${x.field}` : x.field, op: x.op, value: Number(x.value) };
|
|
975
977
|
}), de = Me({
|
|
976
978
|
mutationFn: () => {
|
|
977
|
-
const x =
|
|
979
|
+
const x = H(), Z = x.map((te) => jt(te, ee)).join(" & ");
|
|
978
980
|
return o.request(
|
|
979
981
|
ya(t, {
|
|
980
982
|
widget: n.id,
|
|
@@ -987,7 +989,7 @@ function hl({
|
|
|
987
989
|
);
|
|
988
990
|
},
|
|
989
991
|
onSuccess: () => {
|
|
990
|
-
p(""), q([{ field: "value", agg: "sum", op: "gt", value: "" }]),
|
|
992
|
+
p(""), q([{ field: "value", agg: "sum", op: "gt", value: "" }]), U([]), pe();
|
|
991
993
|
}
|
|
992
994
|
}), xe = Me({
|
|
993
995
|
mutationFn: (x) => o.request(ka(t, x.id, !x.is_active)),
|
|
@@ -995,14 +997,14 @@ function hl({
|
|
|
995
997
|
}), be = Me({
|
|
996
998
|
mutationFn: (x) => o.request(Na(t, x.id)),
|
|
997
999
|
onSuccess: pe
|
|
998
|
-
}), ge =
|
|
1000
|
+
}), ge = H().length > 0, $e = ue.some((x) => x.firing);
|
|
999
1001
|
return /* @__PURE__ */ i(aa, { open: m, onOpenChange: h, children: [
|
|
1000
1002
|
/* @__PURE__ */ e(la, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1001
1003
|
"button",
|
|
1002
1004
|
{
|
|
1003
1005
|
type: "button",
|
|
1004
1006
|
title: "Alerts on this widget",
|
|
1005
|
-
className:
|
|
1007
|
+
className: Q(
|
|
1006
1008
|
"rounded p-0.5",
|
|
1007
1009
|
$e ? "text-amber-500" : "text-slate-300 hover:text-amber-500 dark:text-slate-600"
|
|
1008
1010
|
),
|
|
@@ -1023,7 +1025,7 @@ function hl({
|
|
|
1023
1025
|
/* @__PURE__ */ e(
|
|
1024
1026
|
"span",
|
|
1025
1027
|
{
|
|
1026
|
-
className:
|
|
1028
|
+
className: Q(
|
|
1027
1029
|
"h-1.5 w-1.5 shrink-0 rounded-full",
|
|
1028
1030
|
x.firing ? "bg-amber-500" : x.is_active ? "bg-emerald-500" : "bg-slate-300"
|
|
1029
1031
|
)
|
|
@@ -1035,7 +1037,7 @@ function hl({
|
|
|
1035
1037
|
{
|
|
1036
1038
|
type: "button",
|
|
1037
1039
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1038
|
-
onClick: () => O(
|
|
1040
|
+
onClick: () => O(Y === x.id ? null : x.id),
|
|
1039
1041
|
children: "History"
|
|
1040
1042
|
}
|
|
1041
1043
|
),
|
|
@@ -1066,7 +1068,7 @@ function hl({
|
|
|
1066
1068
|
" · Last fired: ",
|
|
1067
1069
|
x.last_fired ? new Date(x.last_fired).toLocaleString() : "Never"
|
|
1068
1070
|
] }),
|
|
1069
|
-
|
|
1071
|
+
Y === x.id && /* @__PURE__ */ e(pl, { reportId: t, alert: x })
|
|
1070
1072
|
]
|
|
1071
1073
|
},
|
|
1072
1074
|
x.id
|
|
@@ -1082,14 +1084,14 @@ function hl({
|
|
|
1082
1084
|
}
|
|
1083
1085
|
),
|
|
1084
1086
|
L.map((x, Z) => {
|
|
1085
|
-
const te = ee.find((
|
|
1087
|
+
const te = ee.find((V) => V.value === x.field);
|
|
1086
1088
|
return /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
1087
1089
|
/* @__PURE__ */ e(
|
|
1088
1090
|
Nt,
|
|
1089
1091
|
{
|
|
1090
1092
|
value: x.field,
|
|
1091
|
-
onChange: (
|
|
1092
|
-
options: ee.map((
|
|
1093
|
+
onChange: (V) => q((he) => he.map((le, ae) => ae === Z ? { ...le, field: V } : le)),
|
|
1094
|
+
options: ee.map((V) => ({ value: V.value, label: V.label })),
|
|
1093
1095
|
ariaLabel: "Alert metric field",
|
|
1094
1096
|
className: "h-7 min-w-0 flex-1 rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1095
1097
|
}
|
|
@@ -1098,10 +1100,10 @@ function hl({
|
|
|
1098
1100
|
Nt,
|
|
1099
1101
|
{
|
|
1100
1102
|
value: x.agg,
|
|
1101
|
-
onChange: (
|
|
1102
|
-
(he) => he.map((le, ae) => ae === Z ? { ...le, agg:
|
|
1103
|
+
onChange: (V) => q(
|
|
1104
|
+
(he) => he.map((le, ae) => ae === Z ? { ...le, agg: V } : le)
|
|
1103
1105
|
),
|
|
1104
|
-
options: ml.map((
|
|
1106
|
+
options: ml.map((V) => ({ value: V, label: V })),
|
|
1105
1107
|
ariaLabel: "Aggregate",
|
|
1106
1108
|
className: "h-7 w-[62px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1107
1109
|
}
|
|
@@ -1110,10 +1112,10 @@ function hl({
|
|
|
1110
1112
|
Nt,
|
|
1111
1113
|
{
|
|
1112
1114
|
value: x.op,
|
|
1113
|
-
onChange: (
|
|
1114
|
-
(he) => he.map((le, ae) => ae === Z ? { ...le, op:
|
|
1115
|
+
onChange: (V) => q(
|
|
1116
|
+
(he) => he.map((le, ae) => ae === Z ? { ...le, op: V } : le)
|
|
1115
1117
|
),
|
|
1116
|
-
options: cl.map((
|
|
1118
|
+
options: cl.map((V) => ({ value: V, label: ca[V] })),
|
|
1117
1119
|
ariaLabel: "Operator",
|
|
1118
1120
|
className: "h-7 w-[52px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1119
1121
|
}
|
|
@@ -1122,8 +1124,8 @@ function hl({
|
|
|
1122
1124
|
"input",
|
|
1123
1125
|
{
|
|
1124
1126
|
value: x.value,
|
|
1125
|
-
onChange: (
|
|
1126
|
-
(he) => he.map((le, ae) => ae === Z ? { ...le, value:
|
|
1127
|
+
onChange: (V) => q(
|
|
1128
|
+
(he) => he.map((le, ae) => ae === Z ? { ...le, value: V.target.value } : le)
|
|
1127
1129
|
),
|
|
1128
1130
|
placeholder: "0",
|
|
1129
1131
|
inputMode: "decimal",
|
|
@@ -1135,7 +1137,7 @@ function hl({
|
|
|
1135
1137
|
{
|
|
1136
1138
|
type: "button",
|
|
1137
1139
|
className: "text-slate-300 hover:text-red-500",
|
|
1138
|
-
onClick: () => q((
|
|
1140
|
+
onClick: () => q((V) => V.filter((he, le) => le !== Z)),
|
|
1139
1141
|
children: /* @__PURE__ */ e(Ae, { className: "h-3 w-3" })
|
|
1140
1142
|
}
|
|
1141
1143
|
)
|
|
@@ -1162,9 +1164,9 @@ function hl({
|
|
|
1162
1164
|
label: x.label,
|
|
1163
1165
|
optionSource: x.options,
|
|
1164
1166
|
selected: ((Z = w.find((te) => te.field === x.field)) == null ? void 0 : Z.values) ?? [],
|
|
1165
|
-
onChange: (te,
|
|
1167
|
+
onChange: (te, V) => U((he) => [
|
|
1166
1168
|
...he.filter((le) => le.field !== x.field),
|
|
1167
|
-
...te.length > 0 ? [{ field: x.field, values: te, labels:
|
|
1169
|
+
...te.length > 0 ? [{ field: x.field, values: te, labels: V }] : []
|
|
1168
1170
|
])
|
|
1169
1171
|
},
|
|
1170
1172
|
x.field
|
|
@@ -1219,10 +1221,10 @@ function Mt(t, n, a, o) {
|
|
|
1219
1221
|
var L, q;
|
|
1220
1222
|
const c = t.config ?? {}, m = [];
|
|
1221
1223
|
for (const w of c.filters ?? []) {
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1224
|
+
const U = fl[w.op];
|
|
1225
|
+
if (!U) continue;
|
|
1224
1226
|
let u = w.value;
|
|
1225
|
-
w.op === "in" && typeof u == "string" && (u = u.split(",").map((N) => N.trim())), m.push({ path: [w.field], op:
|
|
1227
|
+
w.op === "in" && typeof u == "string" && (u = u.split(",").map((N) => N.trim())), m.push({ path: [w.field], op: U, value: u });
|
|
1226
1228
|
}
|
|
1227
1229
|
for (const w of n)
|
|
1228
1230
|
(L = w.values) != null && L.length && m.push({ path: [w.field], op: "_in", value: w.values });
|
|
@@ -1235,7 +1237,7 @@ function Mt(t, n, a, o) {
|
|
|
1235
1237
|
if (/^\d{4}-\d{2}-\d{2}$/.test(w))
|
|
1236
1238
|
m.push({ path: [p.field], op: "_gte", value: w }), m.push({ path: [p.field], op: "_lte", value: `${w}T23:59:59` });
|
|
1237
1239
|
else if (/^\d{4}-\d{2}$/.test(w)) {
|
|
1238
|
-
const [
|
|
1240
|
+
const [U, u] = w.split("-").map(Number), N = new Date(U, u, 0).getDate();
|
|
1239
1241
|
m.push({ path: [p.field], op: "_gte", value: `${w}-01` }), m.push({
|
|
1240
1242
|
path: [p.field],
|
|
1241
1243
|
op: "_lte",
|
|
@@ -1267,7 +1269,7 @@ function xl(t) {
|
|
|
1267
1269
|
return t ? t.value != null ? Number(t.value) : t.series ? t.series.reduce((o, c) => o + (Number(c.value) || 0), 0) : (n = t.tiles) != null && n.length ? Number(((a = t.tiles[0]) == null ? void 0 : a.value) ?? 0) : t.row_count != null ? Number(t.row_count) : null : null;
|
|
1268
1270
|
}
|
|
1269
1271
|
function Wt(t, n, a) {
|
|
1270
|
-
var q, w,
|
|
1272
|
+
var q, w, U;
|
|
1271
1273
|
const o = a ? [...a] : [];
|
|
1272
1274
|
if (o.length === 0 && ((q = n == null ? void 0 : n.rows) != null && q.length) && o.push(...n.rows), o.length === 0 && ((w = n == null ? void 0 : n.series) != null && w.length))
|
|
1273
1275
|
for (const u of n.series)
|
|
@@ -1277,7 +1279,7 @@ function Wt(t, n, a) {
|
|
|
1277
1279
|
...u.prev != null ? { previous: u.prev } : {},
|
|
1278
1280
|
...u.value2 != null ? { value2: u.value2 } : {}
|
|
1279
1281
|
});
|
|
1280
|
-
if (o.length === 0 && ((
|
|
1282
|
+
if (o.length === 0 && ((U = n == null ? void 0 : n.tiles) != null && U.length))
|
|
1281
1283
|
for (const u of n.tiles) o.push({ label: u.label, value: u.value });
|
|
1282
1284
|
if (o.length === 0 && (n == null ? void 0 : n.value) != null && o.push({ value: n.value }), o.length === 0) {
|
|
1283
1285
|
Xt.info("Nothing to download yet", {
|
|
@@ -1324,10 +1326,10 @@ function bl({
|
|
|
1324
1326
|
const N = w[u];
|
|
1325
1327
|
if (typeof N == "string" && N.trim()) return N.slice(0, 90);
|
|
1326
1328
|
}
|
|
1327
|
-
const
|
|
1329
|
+
const U = Object.entries(w).find(
|
|
1328
1330
|
([u, N]) => u !== "id" && typeof N == "string" && N.trim()
|
|
1329
1331
|
);
|
|
1330
|
-
return
|
|
1332
|
+
return U ? String(U[1]).slice(0, 90) : `#${w.id}`;
|
|
1331
1333
|
};
|
|
1332
1334
|
return /* @__PURE__ */ e(
|
|
1333
1335
|
"div",
|
|
@@ -1417,13 +1419,13 @@ const Lt = Ta(function({
|
|
|
1417
1419
|
asOf: L,
|
|
1418
1420
|
annotations: q,
|
|
1419
1421
|
onAddAnnotation: w,
|
|
1420
|
-
onDeleteAnnotation:
|
|
1422
|
+
onDeleteAnnotation: U,
|
|
1421
1423
|
onCrossFilter: u,
|
|
1422
1424
|
reportUrl: N,
|
|
1423
|
-
currentFilters:
|
|
1425
|
+
currentFilters: Y
|
|
1424
1426
|
}) {
|
|
1425
1427
|
var ft, Ue, xt, Ye, bt, gt, tt, vt, Ve, at, Je, lt, rt, nt, re, yt, st, it, ot, Le;
|
|
1426
|
-
const O = Ke(), [ee,
|
|
1428
|
+
const O = Ke(), [ee, X] = C(""), [ue, pe] = C(0), [H, de] = C(null), [xe, be] = C(!1), [ge, $e] = C(""), [x, Z] = C(""), [te, V] = C(!1), [he, le] = C(!1), [ae, S] = C([]), A = St(null), E = il(A), [J, ne] = C(!1), [ce, fe] = C(null), [_, P] = C(!1), [me, ve] = C(null), we = ["bar", "line", "donut", "pareto", "area"].includes(a.type) || a.type === "kpi" && !!((ft = a.config) != null && ft.compare || (Ue = a.config) != null && Ue.sparkline), Te = Ct(), [Xe, ye] = C(!1), Ze = async () => {
|
|
1427
1429
|
ye(!0);
|
|
1428
1430
|
try {
|
|
1429
1431
|
const l = await O.request(
|
|
@@ -1448,7 +1450,7 @@ const Lt = Ta(function({
|
|
|
1448
1450
|
widget: a.id,
|
|
1449
1451
|
report: n,
|
|
1450
1452
|
params: ke,
|
|
1451
|
-
enabled:
|
|
1453
|
+
enabled: E && a.type !== "divider" && a.type !== "query",
|
|
1452
1454
|
onData: (l) => Te.setQueryData(
|
|
1453
1455
|
["nivaro-report-widget", n, a.id, o, c],
|
|
1454
1456
|
l
|
|
@@ -1471,7 +1473,7 @@ const Lt = Ta(function({
|
|
|
1471
1473
|
// Query widgets resolve client-side in QueryWidgetBody — but when a
|
|
1472
1474
|
// snapshot comparison is active, the server-resolved value (the same
|
|
1473
1475
|
// number the snapshot stored) is fetched so the delta badge can render.
|
|
1474
|
-
enabled:
|
|
1476
|
+
enabled: E && a.type !== "divider" && (a.type !== "query" || !!p),
|
|
1475
1477
|
staleTime: 6e4,
|
|
1476
1478
|
// Per-widget auto-refresh (#168) overrides the report-level interval.
|
|
1477
1479
|
refetchInterval: Da(
|
|
@@ -1506,9 +1508,9 @@ const Lt = Ta(function({
|
|
|
1506
1508
|
...Qe,
|
|
1507
1509
|
slug: Qe.slug || Qe.query_slug || ""
|
|
1508
1510
|
} : null;
|
|
1509
|
-
let
|
|
1511
|
+
let G = null;
|
|
1510
1512
|
if (_e != null && _e.slug)
|
|
1511
|
-
|
|
1513
|
+
G = /* @__PURE__ */ e(
|
|
1512
1514
|
dl,
|
|
1513
1515
|
{
|
|
1514
1516
|
cfg: _e,
|
|
@@ -1516,15 +1518,15 @@ const Lt = Ta(function({
|
|
|
1516
1518
|
entityFilters: c,
|
|
1517
1519
|
refetchInterval: m,
|
|
1518
1520
|
onDrill: f,
|
|
1519
|
-
deferred: !
|
|
1521
|
+
deferred: !E
|
|
1520
1522
|
}
|
|
1521
1523
|
);
|
|
1522
1524
|
else if (a.type === "query")
|
|
1523
|
-
|
|
1524
|
-
else if (!
|
|
1525
|
-
|
|
1525
|
+
G = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No query configured." });
|
|
1526
|
+
else if (!E && R === void 0)
|
|
1527
|
+
G = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-300", children: "Loading…" });
|
|
1526
1528
|
else if (Ee)
|
|
1527
|
-
|
|
1529
|
+
G = /* @__PURE__ */ i("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
1528
1530
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
1529
1531
|
/* @__PURE__ */ e(
|
|
1530
1532
|
ea,
|
|
@@ -1542,7 +1544,7 @@ const Lt = Ta(function({
|
|
|
1542
1544
|
)
|
|
1543
1545
|
] });
|
|
1544
1546
|
else if (De)
|
|
1545
|
-
|
|
1547
|
+
G = /* @__PURE__ */ e(
|
|
1546
1548
|
ta,
|
|
1547
1549
|
{
|
|
1548
1550
|
className: "px-1",
|
|
@@ -1552,10 +1554,10 @@ const Lt = Ta(function({
|
|
|
1552
1554
|
);
|
|
1553
1555
|
else if (R)
|
|
1554
1556
|
if (a.type === "queue") {
|
|
1555
|
-
const l = R.series ?? [], s = Math.max(...l.map((K) => K.value), 1),
|
|
1556
|
-
(K, ie) => `${ie / Math.max(1, l.length - 1) * 100},${28 - (K.value -
|
|
1557
|
+
const l = R.series ?? [], s = Math.max(...l.map((K) => K.value), 1), g = Math.min(...l.map((K) => K.value), 0), M = Math.max(s - g, 1), $ = l.map(
|
|
1558
|
+
(K, ie) => `${ie / Math.max(1, l.length - 1) * 100},${28 - (K.value - g) / M * 26}`
|
|
1557
1559
|
).join(" ");
|
|
1558
|
-
|
|
1560
|
+
G = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1559
1561
|
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children: R.value == null ? "—" : Number(R.value).toLocaleString() }),
|
|
1560
1562
|
l.length >= 3 && /* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1561
1563
|
"polyline",
|
|
@@ -1573,17 +1575,17 @@ const Lt = Ta(function({
|
|
|
1573
1575
|
] })
|
|
1574
1576
|
] });
|
|
1575
1577
|
} else if (a.type === "kpi" || a.type === "calc") {
|
|
1576
|
-
if (
|
|
1578
|
+
if (G = /* @__PURE__ */ i("div", { className: "flex items-baseline gap-2", children: [
|
|
1577
1579
|
/* @__PURE__ */ e(
|
|
1578
1580
|
"p",
|
|
1579
1581
|
{
|
|
1580
|
-
className:
|
|
1582
|
+
className: Q(
|
|
1581
1583
|
"text-[28px] font-semibold leading-none tracking-tight text-slate-900 dark:text-foreground",
|
|
1582
1584
|
a.collection && "cursor-pointer decoration-dotted underline-offset-4 hover:underline",
|
|
1583
1585
|
// KPI threshold colors (#211): first matching gte-descending rule wins.
|
|
1584
1586
|
(() => {
|
|
1585
|
-
var
|
|
1586
|
-
const l = (
|
|
1587
|
+
var g;
|
|
1588
|
+
const l = (g = a.config) == null ? void 0 : g.thresholds;
|
|
1587
1589
|
if (!(l != null && l.length) || R.value == null) return null;
|
|
1588
1590
|
const s = [...l].filter((M) => Number.isFinite(M.gte)).sort((M, $) => $.gte - M.gte).find((M) => R.value >= M.gte);
|
|
1589
1591
|
return (s == null ? void 0 : s.color) === "red" ? "!text-red-600 dark:!text-red-400" : (s == null ? void 0 : s.color) === "amber" ? "!text-amber-600 dark:!text-amber-400" : (s == null ? void 0 : s.color) === "green" ? "!text-emerald-600 dark:!text-emerald-400" : null;
|
|
@@ -1601,9 +1603,9 @@ const Lt = Ta(function({
|
|
|
1601
1603
|
),
|
|
1602
1604
|
/* @__PURE__ */ e(zt, { pct: R.change_pct })
|
|
1603
1605
|
] }), R.spark && R.spark.length >= 3) {
|
|
1604
|
-
const l = R.spark, s = Math.max(...l.map((K) => K.value), 1),
|
|
1605
|
-
|
|
1606
|
-
|
|
1606
|
+
const l = R.spark, s = Math.max(...l.map((K) => K.value), 1), g = Math.min(...l.map((K) => K.value), 0), M = Math.max(s - g, 1), $ = l.map((K, ie) => `${ie / (l.length - 1) * 100},${28 - (K.value - g) / M * 26}`).join(" ");
|
|
1607
|
+
G = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1608
|
+
G,
|
|
1607
1609
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1608
1610
|
"polyline",
|
|
1609
1611
|
{
|
|
@@ -1618,17 +1620,17 @@ const Lt = Ta(function({
|
|
|
1618
1620
|
}
|
|
1619
1621
|
} else if (a.type === "kpi_group") {
|
|
1620
1622
|
const l = R.tiles ?? [];
|
|
1621
|
-
|
|
1623
|
+
G = /* @__PURE__ */ e(
|
|
1622
1624
|
"div",
|
|
1623
1625
|
{
|
|
1624
1626
|
className: "grid gap-2",
|
|
1625
1627
|
style: { gridTemplateColumns: `repeat(${Math.max(1, l.length)}, 1fr)` },
|
|
1626
|
-
children: l.map((s,
|
|
1628
|
+
children: l.map((s, g) => /* @__PURE__ */ i(
|
|
1627
1629
|
"div",
|
|
1628
1630
|
{
|
|
1629
1631
|
className: "flex flex-col justify-center rounded-md border border-slate-100 px-3 py-2 dark:border-border/60",
|
|
1630
1632
|
style: {
|
|
1631
|
-
borderTopColor: s.color ?? oe[
|
|
1633
|
+
borderTopColor: s.color ?? oe[g % oe.length],
|
|
1632
1634
|
borderTopWidth: 2
|
|
1633
1635
|
},
|
|
1634
1636
|
children: [
|
|
@@ -1644,15 +1646,15 @@ const Lt = Ta(function({
|
|
|
1644
1646
|
}
|
|
1645
1647
|
);
|
|
1646
1648
|
} else if (a.type === "narrative")
|
|
1647
|
-
|
|
1649
|
+
G = /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: (R.narrative ?? "").split(/(\*\*[^*]+\*\*)/g).map(
|
|
1648
1650
|
(l, s) => l.startsWith("**") && l.endsWith("**") ? /* @__PURE__ */ e("strong", { className: "font-semibold text-slate-900 dark:text-foreground", children: l.slice(2, -2) }, s) : /* @__PURE__ */ e("span", { children: l }, s)
|
|
1649
1651
|
) });
|
|
1650
1652
|
else if (a.type === "heatmap") {
|
|
1651
|
-
const l = R.cells ?? [], s = [...new Set(l.map((K) => K.dim))],
|
|
1652
|
-
|
|
1653
|
+
const l = R.cells ?? [], s = [...new Set(l.map((K) => K.dim))], g = [...new Set(l.map((K) => K.dim2))], M = Math.max(1, ...l.map((K) => K.value)), $ = (K, ie) => l.find((I) => I.dim === K && I.dim2 === ie);
|
|
1654
|
+
G = 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: [
|
|
1653
1655
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
1654
1656
|
/* @__PURE__ */ e("th", {}),
|
|
1655
|
-
|
|
1657
|
+
g.map((K) => /* @__PURE__ */ e(
|
|
1656
1658
|
"th",
|
|
1657
1659
|
{
|
|
1658
1660
|
className: "max-w-[80px] truncate px-1 pb-1 text-left font-medium text-slate-400",
|
|
@@ -1663,16 +1665,16 @@ const Lt = Ta(function({
|
|
|
1663
1665
|
] }) }),
|
|
1664
1666
|
/* @__PURE__ */ e("tbody", { children: s.map((K) => /* @__PURE__ */ i("tr", { children: [
|
|
1665
1667
|
/* @__PURE__ */ e("td", { className: "max-w-[110px] truncate pr-1.5 text-slate-500 dark:text-slate-400", children: K }),
|
|
1666
|
-
|
|
1667
|
-
const I = $(K, ie),
|
|
1668
|
+
g.map((ie) => {
|
|
1669
|
+
const I = $(K, ie), F = I ? I.value / M : 0;
|
|
1668
1670
|
return /* @__PURE__ */ e("td", { className: "p-0.5", children: /* @__PURE__ */ e(
|
|
1669
1671
|
"div",
|
|
1670
1672
|
{
|
|
1671
1673
|
"data-tip": I ? `${K} × ${ie}: ${I.value.toLocaleString()}` : void 0,
|
|
1672
1674
|
className: "flex h-6 items-center justify-center rounded text-[9.5px] tabular-nums",
|
|
1673
1675
|
style: {
|
|
1674
|
-
backgroundColor: I ? `rgba(0, 165, 204, ${0.08 +
|
|
1675
|
-
color:
|
|
1676
|
+
backgroundColor: I ? `rgba(0, 165, 204, ${0.08 + F * 0.85})` : "transparent",
|
|
1677
|
+
color: F > 0.55 ? "#fff" : void 0,
|
|
1676
1678
|
border: I ? void 0 : "1px dashed rgba(148,163,184,0.25)"
|
|
1677
1679
|
},
|
|
1678
1680
|
children: I ? Ce(Math.round(I.value)) : ""
|
|
@@ -1683,7 +1685,7 @@ const Lt = Ta(function({
|
|
|
1683
1685
|
] }) });
|
|
1684
1686
|
} else if (a.type === "ai_insight") {
|
|
1685
1687
|
const l = R.narrative ?? "";
|
|
1686
|
-
|
|
1688
|
+
G = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1687
1689
|
/* @__PURE__ */ i("div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1688
1690
|
/* @__PURE__ */ e(Dt, { className: "h-3.5 w-3.5 text-[#00a5cc]" }),
|
|
1689
1691
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wide text-slate-400", children: "AI-generated" }),
|
|
@@ -1695,7 +1697,7 @@ const Lt = Ta(function({
|
|
|
1695
1697
|
disabled: Xe,
|
|
1696
1698
|
onClick: () => void Ze(),
|
|
1697
1699
|
className: "ml-auto rounded p-0.5 text-slate-300 hover:text-[#00a5cc] disabled:opacity-50",
|
|
1698
|
-
children: /* @__PURE__ */ e(Ft, { className:
|
|
1700
|
+
children: /* @__PURE__ */ e(Ft, { className: Q("h-3 w-3", Xe && "animate-spin") })
|
|
1699
1701
|
}
|
|
1700
1702
|
)
|
|
1701
1703
|
] }),
|
|
@@ -1703,7 +1705,7 @@ const Lt = Ta(function({
|
|
|
1703
1705
|
] });
|
|
1704
1706
|
} else if (a.type === "pivot") {
|
|
1705
1707
|
const l = R.pivot;
|
|
1706
|
-
|
|
1708
|
+
G = !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: [
|
|
1707
1709
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full border-collapse text-[10.5px]", children: [
|
|
1708
1710
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
1709
1711
|
/* @__PURE__ */ e("th", { className: "sticky left-0 top-0 z-[2] bg-white dark:bg-card" }),
|
|
@@ -1719,16 +1721,16 @@ const Lt = Ta(function({
|
|
|
1719
1721
|
] }) }),
|
|
1720
1722
|
/* @__PURE__ */ e("tbody", { children: l.rows.map((s) => /* @__PURE__ */ i("tr", { className: "hover:bg-muted", children: [
|
|
1721
1723
|
/* @__PURE__ */ e("td", { className: "sticky left-0 z-[1] max-w-[150px] truncate bg-white pr-1.5 text-slate-500 dark:bg-card dark:text-slate-400", children: s }),
|
|
1722
|
-
l.cols.map((
|
|
1724
|
+
l.cols.map((g) => {
|
|
1723
1725
|
var $;
|
|
1724
|
-
const M = ($ = l.cells[s]) == null ? void 0 : $[
|
|
1726
|
+
const M = ($ = l.cells[s]) == null ? void 0 : $[g];
|
|
1725
1727
|
return /* @__PURE__ */ e(
|
|
1726
1728
|
"td",
|
|
1727
1729
|
{
|
|
1728
1730
|
className: "px-1.5 py-0.5 text-right tabular-nums text-slate-700 dark:text-slate-300",
|
|
1729
1731
|
children: M == null ? "" : qe(M, se)
|
|
1730
1732
|
},
|
|
1731
|
-
|
|
1733
|
+
g
|
|
1732
1734
|
);
|
|
1733
1735
|
}),
|
|
1734
1736
|
/* @__PURE__ */ e("td", { className: "px-1.5 py-0.5 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-200", children: qe(l.row_totals[s] ?? 0, se) })
|
|
@@ -1763,17 +1765,17 @@ const Lt = Ta(function({
|
|
|
1763
1765
|
] });
|
|
1764
1766
|
} else if (a.type === "waterfall") {
|
|
1765
1767
|
const l = R.waterfall;
|
|
1766
|
-
|
|
1768
|
+
G = l ? (() => {
|
|
1767
1769
|
const s = [];
|
|
1768
1770
|
s.push({ label: "Previous", from: 0, to: l.start, kind: "total" });
|
|
1769
|
-
let
|
|
1771
|
+
let g = l.start;
|
|
1770
1772
|
for (const $ of l.steps)
|
|
1771
1773
|
s.push({
|
|
1772
1774
|
label: $.dim,
|
|
1773
|
-
from:
|
|
1774
|
-
to:
|
|
1775
|
+
from: g,
|
|
1776
|
+
to: g + $.delta,
|
|
1775
1777
|
kind: $.delta >= 0 ? "up" : "down"
|
|
1776
|
-
}),
|
|
1778
|
+
}), g += $.delta;
|
|
1777
1779
|
s.push({ label: "Current", from: 0, to: l.end, kind: "total" });
|
|
1778
1780
|
const M = Math.max(1, ...s.map(($) => Math.max($.from, $.to)));
|
|
1779
1781
|
return /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 items-end gap-1 overflow-x-auto px-1 pb-4", children: s.map(($, K) => {
|
|
@@ -1803,7 +1805,7 @@ const Lt = Ta(function({
|
|
|
1803
1805
|
})() : /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
1804
1806
|
} else if (a.type === "stats") {
|
|
1805
1807
|
const l = R.rows ?? [];
|
|
1806
|
-
|
|
1808
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "grid min-h-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-1.5 overflow-auto px-1", children: l.map((s) => /* @__PURE__ */ i(
|
|
1807
1809
|
"div",
|
|
1808
1810
|
{
|
|
1809
1811
|
className: "flex items-baseline justify-between border-b border-slate-100 pb-1 dark:border-border/50",
|
|
@@ -1815,45 +1817,45 @@ const Lt = Ta(function({
|
|
|
1815
1817
|
s.stat
|
|
1816
1818
|
)) });
|
|
1817
1819
|
} else if (a.type === "hot_records") {
|
|
1818
|
-
const l = R.rows ?? [], s = Math.max(1, ...l.map((
|
|
1819
|
-
|
|
1820
|
+
const l = R.rows ?? [], s = Math.max(1, ...l.map((g) => g.views));
|
|
1821
|
+
G = 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(
|
|
1820
1822
|
"button",
|
|
1821
1823
|
{
|
|
1822
1824
|
type: "button",
|
|
1823
|
-
onClick: () => a.collection && (f == null ? void 0 : f({ collection: a.collection, itemId: String(
|
|
1825
|
+
onClick: () => a.collection && (f == null ? void 0 : f({ collection: a.collection, itemId: String(g.id), title: g.label })),
|
|
1824
1826
|
className: "group flex w-full items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-muted",
|
|
1825
1827
|
children: [
|
|
1826
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 group-hover:text-[#0284c7] dark:text-slate-200", children:
|
|
1828
|
+
/* @__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 }),
|
|
1827
1829
|
/* @__PURE__ */ e("span", { className: "relative h-2 w-20 overflow-hidden rounded-full bg-slate-100 dark:bg-white/10", children: /* @__PURE__ */ e(
|
|
1828
1830
|
"span",
|
|
1829
1831
|
{
|
|
1830
1832
|
className: "absolute inset-y-0 left-0 rounded-full bg-[#00a5cc]",
|
|
1831
|
-
style: { width: `${
|
|
1833
|
+
style: { width: `${g.views / s * 100}%` }
|
|
1832
1834
|
}
|
|
1833
1835
|
) }),
|
|
1834
|
-
/* @__PURE__ */ e("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children:
|
|
1836
|
+
/* @__PURE__ */ e("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: g.views })
|
|
1835
1837
|
]
|
|
1836
1838
|
},
|
|
1837
|
-
|
|
1839
|
+
g.id
|
|
1838
1840
|
)) });
|
|
1839
1841
|
} else if (a.type === "scatter") {
|
|
1840
1842
|
const l = R.rows ?? [];
|
|
1841
|
-
|
|
1842
|
-
const s = l.length,
|
|
1843
|
-
{ x:
|
|
1844
|
-
{ x:
|
|
1843
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : (() => {
|
|
1844
|
+
const s = l.length, g = l.reduce((b, v) => b + v.x, 0), M = l.reduce((b, v) => b + v.y, 0), $ = l.reduce((b, v) => b + v.x * v.x, 0), K = l.reduce((b, v) => b + v.x * v.y, 0), ie = s * $ - g * g, I = ie !== 0 ? (s * K - g * M) / ie : 0, F = s > 0 ? (M - I * g) / s : 0, z = l.map((b) => b.x), W = Math.min(...z), D = Math.max(...z), r = [
|
|
1845
|
+
{ x: W, y: F + I * W },
|
|
1846
|
+
{ x: D, y: F + I * D }
|
|
1845
1847
|
];
|
|
1846
1848
|
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
1847
|
-
ComposedChart:
|
|
1848
|
-
Line:
|
|
1849
|
+
ComposedChart: b,
|
|
1850
|
+
Line: v,
|
|
1849
1851
|
ResponsiveContainer: d,
|
|
1850
1852
|
Scatter: y,
|
|
1851
|
-
Tooltip:
|
|
1852
|
-
XAxis:
|
|
1853
|
-
YAxis:
|
|
1854
|
-
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
1853
|
+
Tooltip: k,
|
|
1854
|
+
XAxis: j,
|
|
1855
|
+
YAxis: B
|
|
1856
|
+
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ i(b, { data: l, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
1855
1857
|
/* @__PURE__ */ e(
|
|
1856
|
-
|
|
1858
|
+
j,
|
|
1857
1859
|
{
|
|
1858
1860
|
dataKey: "x",
|
|
1859
1861
|
type: "number",
|
|
@@ -1862,9 +1864,9 @@ const Lt = Ta(function({
|
|
|
1862
1864
|
domain: ["dataMin", "dataMax"]
|
|
1863
1865
|
}
|
|
1864
1866
|
),
|
|
1865
|
-
/* @__PURE__ */ e(
|
|
1867
|
+
/* @__PURE__ */ e(B, { tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1866
1868
|
/* @__PURE__ */ e(
|
|
1867
|
-
|
|
1869
|
+
k,
|
|
1868
1870
|
{
|
|
1869
1871
|
contentStyle: {
|
|
1870
1872
|
fontSize: 12,
|
|
@@ -1877,9 +1879,9 @@ const Lt = Ta(function({
|
|
|
1877
1879
|
),
|
|
1878
1880
|
/* @__PURE__ */ e(y, { data: l, dataKey: "y", fill: "#00a5cc", opacity: 0.7 }),
|
|
1879
1881
|
/* @__PURE__ */ e(
|
|
1880
|
-
|
|
1882
|
+
v,
|
|
1881
1883
|
{
|
|
1882
|
-
data:
|
|
1884
|
+
data: r,
|
|
1883
1885
|
dataKey: "y",
|
|
1884
1886
|
stroke: "#f59e0b",
|
|
1885
1887
|
strokeWidth: 2,
|
|
@@ -1891,7 +1893,7 @@ const Lt = Ta(function({
|
|
|
1891
1893
|
})();
|
|
1892
1894
|
} else if (a.type === "pareto") {
|
|
1893
1895
|
const l = R.series ?? [];
|
|
1894
|
-
|
|
1896
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: s, ComposedChart: g, Line: M, ResponsiveContainer: $, Tooltip: K, XAxis: ie, YAxis: I }) => /* @__PURE__ */ e($, { width: "100%", height: "100%", children: /* @__PURE__ */ i(g, { data: l, margin: { top: 6, right: 4, left: -10, bottom: 0 }, children: [
|
|
1895
1897
|
/* @__PURE__ */ e(
|
|
1896
1898
|
ie,
|
|
1897
1899
|
{
|
|
@@ -1911,7 +1913,7 @@ const Lt = Ta(function({
|
|
|
1911
1913
|
orientation: "right",
|
|
1912
1914
|
domain: [0, 100],
|
|
1913
1915
|
tick: { fontSize: 10 },
|
|
1914
|
-
tickFormatter: (
|
|
1916
|
+
tickFormatter: (F) => `${F}%`
|
|
1915
1917
|
}
|
|
1916
1918
|
),
|
|
1917
1919
|
/* @__PURE__ */ e(
|
|
@@ -1949,13 +1951,13 @@ const Lt = Ta(function({
|
|
|
1949
1951
|
)
|
|
1950
1952
|
] }) }) }) });
|
|
1951
1953
|
} else if (a.type === "metric")
|
|
1952
|
-
|
|
1954
|
+
G = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
1953
1955
|
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children: R.value == null ? "—" : qe(R.value, se) }),
|
|
1954
1956
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((vt = a.config) == null ? void 0 : vt.metric_key) ?? "") })
|
|
1955
1957
|
] });
|
|
1956
1958
|
else if (a.type === "movers") {
|
|
1957
1959
|
const l = R.rows ?? [];
|
|
1958
|
-
|
|
1960
|
+
G = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No movement in this window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto", children: l.map((s) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-[11.5px]", children: [
|
|
1959
1961
|
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: s.dim }),
|
|
1960
1962
|
/* @__PURE__ */ i("span", { className: "tabular-nums text-slate-400", children: [
|
|
1961
1963
|
s.previous.toLocaleString(),
|
|
@@ -1965,7 +1967,7 @@ const Lt = Ta(function({
|
|
|
1965
1967
|
/* @__PURE__ */ i(
|
|
1966
1968
|
"span",
|
|
1967
1969
|
{
|
|
1968
|
-
className:
|
|
1970
|
+
className: Q(
|
|
1969
1971
|
"w-[74px] shrink-0 text-right font-semibold tabular-nums",
|
|
1970
1972
|
s.delta > 0 ? "text-emerald-600 dark:text-emerald-400" : "text-red-500"
|
|
1971
1973
|
),
|
|
@@ -1982,61 +1984,61 @@ const Lt = Ta(function({
|
|
|
1982
1984
|
)
|
|
1983
1985
|
] }, s.dim)) });
|
|
1984
1986
|
} else if (a.type === "table") {
|
|
1985
|
-
const l = R.rows ?? [], s = (Ve = a.config) != null && Ve.columns && a.config.columns.length > 0 ? a.config.columns.map((d) => typeof d == "string" ? { field: d } : d) : l[0] ? Object.keys(l[0]).filter((d) => d !== "id").map((d) => ({ field: d })) : [],
|
|
1987
|
+
const l = R.rows ?? [], s = (Ve = a.config) != null && Ve.columns && a.config.columns.length > 0 ? a.config.columns.map((d) => typeof d == "string" ? { field: d } : d) : l[0] ? Object.keys(l[0]).filter((d) => d !== "id").map((d) => ({ field: d })) : [], g = s.map((d) => d.field), M = (d) => s.find((y) => y.field === d), $ = ((at = a.config) == null ? void 0 : at.format_rules) ?? [], K = (d) => {
|
|
1986
1988
|
var y;
|
|
1987
|
-
for (const
|
|
1988
|
-
if ((
|
|
1989
|
-
return ((y = Bt[
|
|
1989
|
+
for (const k of $)
|
|
1990
|
+
if ((k.scope ?? "cell") === "row" && Qt(k, d[k.field]))
|
|
1991
|
+
return ((y = Bt[k.color]) == null ? void 0 : y.row) ?? null;
|
|
1990
1992
|
return null;
|
|
1991
1993
|
}, ie = (d, y) => {
|
|
1992
|
-
var
|
|
1993
|
-
for (const
|
|
1994
|
-
if ((
|
|
1995
|
-
return ((
|
|
1994
|
+
var k;
|
|
1995
|
+
for (const j of $)
|
|
1996
|
+
if ((j.scope ?? "cell") === "cell" && j.field === y && Qt(j, d[y]))
|
|
1997
|
+
return ((k = Bt[j.color]) == null ? void 0 : k.cell) ?? null;
|
|
1996
1998
|
return null;
|
|
1997
|
-
}, I = ee.trim().toLowerCase(),
|
|
1998
|
-
(d) =>
|
|
1999
|
-
const
|
|
2000
|
-
return Number.isFinite(
|
|
1999
|
+
}, I = ee.trim().toLowerCase(), F = a.config, z = F != null && F.suppress_zero ? l.filter(
|
|
2000
|
+
(d) => g.some((y) => {
|
|
2001
|
+
const k = Number(d[y]);
|
|
2002
|
+
return Number.isFinite(k) && k !== 0;
|
|
2001
2003
|
})
|
|
2002
|
-
) : l,
|
|
2004
|
+
) : l, W = I ? z.filter(
|
|
2003
2005
|
(d) => Object.values(d).some(
|
|
2004
2006
|
(y) => String(y ?? "").toLowerCase().includes(I)
|
|
2005
2007
|
)
|
|
2006
|
-
) :
|
|
2007
|
-
|
|
2008
|
-
l.length >
|
|
2008
|
+
) : z, D = 12, r = Math.max(1, Math.ceil(W.length / D)), b = Math.min(ue, r - 1), v = W.length > D ? W.slice(b * D, b * D + D) : W;
|
|
2009
|
+
G = 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: [
|
|
2010
|
+
l.length > D && /* @__PURE__ */ i("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
2009
2011
|
/* @__PURE__ */ e(
|
|
2010
2012
|
"input",
|
|
2011
2013
|
{
|
|
2012
2014
|
value: ee,
|
|
2013
2015
|
onChange: (d) => {
|
|
2014
|
-
|
|
2016
|
+
X(d.target.value), pe(0);
|
|
2015
2017
|
},
|
|
2016
2018
|
placeholder: "Search rows…",
|
|
2017
2019
|
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"
|
|
2018
2020
|
}
|
|
2019
2021
|
),
|
|
2020
|
-
|
|
2022
|
+
r > 1 && /* @__PURE__ */ i("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
2021
2023
|
/* @__PURE__ */ e(
|
|
2022
2024
|
"button",
|
|
2023
2025
|
{
|
|
2024
2026
|
type: "button",
|
|
2025
|
-
disabled:
|
|
2026
|
-
onClick: () => pe(
|
|
2027
|
+
disabled: b <= 0,
|
|
2028
|
+
onClick: () => pe(b - 1),
|
|
2027
2029
|
className: "rounded px-1 disabled:opacity-30",
|
|
2028
2030
|
children: "←"
|
|
2029
2031
|
}
|
|
2030
2032
|
),
|
|
2031
|
-
|
|
2033
|
+
b + 1,
|
|
2032
2034
|
"/",
|
|
2033
|
-
|
|
2035
|
+
r,
|
|
2034
2036
|
/* @__PURE__ */ e(
|
|
2035
2037
|
"button",
|
|
2036
2038
|
{
|
|
2037
2039
|
type: "button",
|
|
2038
|
-
disabled:
|
|
2039
|
-
onClick: () => pe(
|
|
2040
|
+
disabled: b >= r - 1,
|
|
2041
|
+
onClick: () => pe(b + 1),
|
|
2040
2042
|
className: "rounded px-1 disabled:opacity-30",
|
|
2041
2043
|
children: "→"
|
|
2042
2044
|
}
|
|
@@ -2044,7 +2046,7 @@ const Lt = Ta(function({
|
|
|
2044
2046
|
] })
|
|
2045
2047
|
] }),
|
|
2046
2048
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full text-[11.5px]", children: [
|
|
2047
|
-
/* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children:
|
|
2049
|
+
/* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: g.map((d) => {
|
|
2048
2050
|
var y;
|
|
2049
2051
|
return /* @__PURE__ */ e(
|
|
2050
2052
|
"th",
|
|
@@ -2055,27 +2057,27 @@ const Lt = Ta(function({
|
|
|
2055
2057
|
d
|
|
2056
2058
|
);
|
|
2057
2059
|
}) }) }),
|
|
2058
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
2060
|
+
/* @__PURE__ */ e("tbody", { children: v.map((d) => /* @__PURE__ */ e(
|
|
2059
2061
|
"tr",
|
|
2060
2062
|
{
|
|
2061
|
-
className:
|
|
2063
|
+
className: Q(
|
|
2062
2064
|
K(d),
|
|
2063
2065
|
a.collection && d.id != null && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60"
|
|
2064
2066
|
),
|
|
2065
2067
|
onClick: () => {
|
|
2066
2068
|
a.collection && d.id != null && (f == null || f({ collection: a.collection, itemId: String(d.id) }));
|
|
2067
2069
|
},
|
|
2068
|
-
children:
|
|
2069
|
-
var
|
|
2070
|
+
children: g.map((y) => {
|
|
2071
|
+
var k, j, B, T;
|
|
2070
2072
|
return /* @__PURE__ */ e(
|
|
2071
2073
|
"td",
|
|
2072
2074
|
{
|
|
2073
|
-
className:
|
|
2075
|
+
className: Q(
|
|
2074
2076
|
"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",
|
|
2075
|
-
(typeof d[y] == "number" || ze.has(((
|
|
2077
|
+
(typeof d[y] == "number" || ze.has(((k = M(y)) == null ? void 0 : k.format) ?? "")) && "text-right tabular-nums",
|
|
2076
2078
|
ie(d, y)
|
|
2077
2079
|
),
|
|
2078
|
-
children: (
|
|
2080
|
+
children: (j = M(y)) != null && j.format ? je(d[y], (B = M(y)) == null ? void 0 : B.format, (T = M(y)) == null ? void 0 : T.decimals) : String(d[y] ?? "")
|
|
2079
2081
|
},
|
|
2080
2082
|
y
|
|
2081
2083
|
);
|
|
@@ -2083,17 +2085,17 @@ const Lt = Ta(function({
|
|
|
2083
2085
|
},
|
|
2084
2086
|
String(d.id)
|
|
2085
2087
|
)) }),
|
|
2086
|
-
(
|
|
2087
|
-
var
|
|
2088
|
-
const
|
|
2088
|
+
(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, y) => {
|
|
2089
|
+
var T, Se, Pe;
|
|
2090
|
+
const k = W.map((dt) => Number(dt[d])).filter((dt) => Number.isFinite(dt)), j = k.length > W.length / 2, B = k.reduce((dt, ma) => dt + ma, 0);
|
|
2089
2091
|
return /* @__PURE__ */ e(
|
|
2090
2092
|
"td",
|
|
2091
2093
|
{
|
|
2092
|
-
className:
|
|
2094
|
+
className: Q(
|
|
2093
2095
|
"px-1.5 py-1 text-slate-800 dark:text-slate-100",
|
|
2094
|
-
|
|
2096
|
+
j && "text-right tabular-nums"
|
|
2095
2097
|
),
|
|
2096
|
-
children: y === 0 && !
|
|
2098
|
+
children: y === 0 && !j ? "Total" : j ? (T = M(d)) != null && T.format ? je(B, (Se = M(d)) == null ? void 0 : Se.format, (Pe = M(d)) == null ? void 0 : Pe.decimals) : B.toLocaleString() : ""
|
|
2097
2099
|
},
|
|
2098
2100
|
d
|
|
2099
2101
|
);
|
|
@@ -2102,37 +2104,37 @@ const Lt = Ta(function({
|
|
|
2102
2104
|
] });
|
|
2103
2105
|
} else {
|
|
2104
2106
|
let l = R.series ?? [];
|
|
2105
|
-
const s = !!((lt = (Je = a.config) == null ? void 0 : Je.dimension) != null && lt.bucket),
|
|
2106
|
-
if (
|
|
2107
|
-
if (
|
|
2108
|
-
const
|
|
2109
|
-
return { ...
|
|
2107
|
+
const s = !!((lt = (Je = a.config) == null ? void 0 : Je.dimension) != null && lt.bucket), g = Number((rt = a.config) == null ? void 0 : rt.rolling_avg) || 0;
|
|
2108
|
+
if (g >= 2 && s && !te && l.length >= g && (l = l.map((F, z) => {
|
|
2109
|
+
if (z < g - 1) return F;
|
|
2110
|
+
const W = l.slice(z - g + 1, z + 1);
|
|
2111
|
+
return { ...F, ma: W.reduce((D, r) => D + r.value, 0) / g };
|
|
2110
2112
|
})), te && s) {
|
|
2111
|
-
let
|
|
2112
|
-
l = l.map((
|
|
2113
|
-
...
|
|
2114
|
-
value:
|
|
2115
|
-
...
|
|
2116
|
-
...
|
|
2113
|
+
let F = 0, z = 0, W = 0;
|
|
2114
|
+
l = l.map((D) => (F += D.value, z += D.prev ?? 0, W += D.value2 ?? 0, {
|
|
2115
|
+
...D,
|
|
2116
|
+
value: F,
|
|
2117
|
+
...D.prev != null ? { prev: z } : {},
|
|
2118
|
+
...D.value2 != null ? { value2: W } : {}
|
|
2117
2119
|
}));
|
|
2118
2120
|
}
|
|
2119
|
-
const M = l.some((
|
|
2121
|
+
const M = l.some((F) => F.value2 != null), $ = ((re = (nt = a.config) == null ? void 0 : nt.metric2) == null ? void 0 : re.label) ?? "secondary", K = l.some((F) => F.band != null), ie = (() => {
|
|
2120
2122
|
if (!s || te || l.length < 8) return /* @__PURE__ */ new Set();
|
|
2121
|
-
const
|
|
2122
|
-
return
|
|
2123
|
-
l.filter((
|
|
2123
|
+
const F = l.map((D) => D.value), z = F.reduce((D, r) => D + r, 0) / F.length, W = Math.sqrt(F.reduce((D, r) => D + (r - z) ** 2, 0) / F.length);
|
|
2124
|
+
return W === 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
2125
|
+
l.filter((D) => Math.abs(D.value - z) > 2 * W).map((D) => D.dim)
|
|
2124
2126
|
);
|
|
2125
2127
|
})(), I = (q ?? []).filter(
|
|
2126
|
-
(
|
|
2128
|
+
(F) => F.anchor_date && l.some((z) => z.dim === F.anchor_date)
|
|
2127
2129
|
);
|
|
2128
|
-
if (l.length === 0)
|
|
2130
|
+
if (l.length === 0) G = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
2129
2131
|
else if (a.type === "donut") {
|
|
2130
|
-
const
|
|
2131
|
-
|
|
2132
|
+
const F = l.reduce((z, W) => z + W.value, 0);
|
|
2133
|
+
G = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
2132
2134
|
/* @__PURE__ */ i("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
2133
|
-
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell:
|
|
2135
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: z, Pie: W, PieChart: D, ResponsiveContainer: r, Tooltip: b }) => /* @__PURE__ */ e(r, { width: "100%", height: "100%", children: /* @__PURE__ */ i(D, { children: [
|
|
2134
2136
|
/* @__PURE__ */ e(
|
|
2135
|
-
|
|
2137
|
+
W,
|
|
2136
2138
|
{
|
|
2137
2139
|
data: l,
|
|
2138
2140
|
dataKey: "value",
|
|
@@ -2142,13 +2144,13 @@ const Lt = Ta(function({
|
|
|
2142
2144
|
paddingAngle: 2,
|
|
2143
2145
|
strokeWidth: 0,
|
|
2144
2146
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2145
|
-
onClick: (
|
|
2146
|
-
var
|
|
2147
|
+
onClick: (v) => {
|
|
2148
|
+
var k, j, B, T;
|
|
2147
2149
|
if (!a.collection) return;
|
|
2148
|
-
const d =
|
|
2150
|
+
const d = v == null ? void 0 : v.payload;
|
|
2149
2151
|
if (d != null && d.other) return;
|
|
2150
2152
|
if (Be.length > ae.length) {
|
|
2151
|
-
const Se = ae.length === 0 ? (
|
|
2153
|
+
const Se = ae.length === 0 ? (j = (k = a.config) == null ? void 0 : k.dimension) == null ? void 0 : j.field : Be[ae.length - 1];
|
|
2152
2154
|
if (Se) {
|
|
2153
2155
|
S((Pe) => [
|
|
2154
2156
|
...Pe,
|
|
@@ -2157,7 +2159,7 @@ const Lt = Ta(function({
|
|
|
2157
2159
|
return;
|
|
2158
2160
|
}
|
|
2159
2161
|
}
|
|
2160
|
-
const y = (
|
|
2162
|
+
const y = (T = (B = a.config) == null ? void 0 : B.dimension) == null ? void 0 : T.field;
|
|
2161
2163
|
de({
|
|
2162
2164
|
conditions: Mt(
|
|
2163
2165
|
a,
|
|
@@ -2171,17 +2173,17 @@ const Lt = Ta(function({
|
|
|
2171
2173
|
dimLabel: d == null ? void 0 : d.dim
|
|
2172
2174
|
});
|
|
2173
2175
|
},
|
|
2174
|
-
children: l.map((
|
|
2175
|
-
|
|
2176
|
+
children: l.map((v, d) => /* @__PURE__ */ e(
|
|
2177
|
+
z,
|
|
2176
2178
|
{
|
|
2177
|
-
fill:
|
|
2179
|
+
fill: v.other ? "#94a3b8" : oe[d % oe.length]
|
|
2178
2180
|
},
|
|
2179
|
-
|
|
2181
|
+
v.dim
|
|
2180
2182
|
))
|
|
2181
2183
|
}
|
|
2182
2184
|
),
|
|
2183
2185
|
/* @__PURE__ */ e(
|
|
2184
|
-
|
|
2186
|
+
b,
|
|
2185
2187
|
{
|
|
2186
2188
|
contentStyle: {
|
|
2187
2189
|
fontSize: 12,
|
|
@@ -2196,42 +2198,42 @@ const Lt = Ta(function({
|
|
|
2196
2198
|
)
|
|
2197
2199
|
] }) }) }),
|
|
2198
2200
|
/* @__PURE__ */ i("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
2199
|
-
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children:
|
|
2201
|
+
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: F.toLocaleString() }),
|
|
2200
2202
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
2201
2203
|
] })
|
|
2202
2204
|
] }),
|
|
2203
|
-
/* @__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((
|
|
2205
|
+
/* @__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((z, W) => /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
2204
2206
|
/* @__PURE__ */ e(
|
|
2205
2207
|
"span",
|
|
2206
2208
|
{
|
|
2207
2209
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
2208
|
-
style: { background: oe[
|
|
2210
|
+
style: { background: oe[W % oe.length] }
|
|
2209
2211
|
}
|
|
2210
2212
|
),
|
|
2211
|
-
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children:
|
|
2212
|
-
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children:
|
|
2213
|
-
] },
|
|
2213
|
+
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: z.dim }),
|
|
2214
|
+
/* @__PURE__ */ e("span", { className: "ml-auto tabular-nums text-slate-400", children: z.value.toLocaleString() })
|
|
2215
|
+
] }, z.dim)) })
|
|
2214
2216
|
] });
|
|
2215
2217
|
} else if (a.type === "line")
|
|
2216
|
-
|
|
2217
|
-
Area:
|
|
2218
|
-
ComposedChart:
|
|
2219
|
-
Line:
|
|
2220
|
-
ReferenceLine:
|
|
2221
|
-
ResponsiveContainer:
|
|
2222
|
-
Tooltip:
|
|
2223
|
-
XAxis:
|
|
2218
|
+
G = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2219
|
+
Area: F,
|
|
2220
|
+
ComposedChart: z,
|
|
2221
|
+
Line: W,
|
|
2222
|
+
ReferenceLine: D,
|
|
2223
|
+
ResponsiveContainer: r,
|
|
2224
|
+
Tooltip: b,
|
|
2225
|
+
XAxis: v,
|
|
2224
2226
|
YAxis: d
|
|
2225
2227
|
}) => {
|
|
2226
2228
|
var y;
|
|
2227
|
-
return /* @__PURE__ */ e(
|
|
2228
|
-
|
|
2229
|
+
return /* @__PURE__ */ e(r, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
2230
|
+
z,
|
|
2229
2231
|
{
|
|
2230
2232
|
data: l,
|
|
2231
2233
|
margin: { top: 6, right: M ? 4 : 8, left: -10, bottom: 0 },
|
|
2232
2234
|
children: [
|
|
2233
2235
|
/* @__PURE__ */ e(
|
|
2234
|
-
|
|
2236
|
+
v,
|
|
2235
2237
|
{
|
|
2236
2238
|
dataKey: "dim",
|
|
2237
2239
|
tick: { fontSize: 10 },
|
|
@@ -2259,18 +2261,18 @@ const Lt = Ta(function({
|
|
|
2259
2261
|
width: 44
|
|
2260
2262
|
}
|
|
2261
2263
|
),
|
|
2262
|
-
I.map((
|
|
2263
|
-
|
|
2264
|
+
I.map((k) => /* @__PURE__ */ e(
|
|
2265
|
+
D,
|
|
2264
2266
|
{
|
|
2265
|
-
x:
|
|
2267
|
+
x: k.anchor_date,
|
|
2266
2268
|
stroke: "#f59e0b",
|
|
2267
2269
|
strokeDasharray: "4 3",
|
|
2268
2270
|
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2269
2271
|
},
|
|
2270
|
-
|
|
2272
|
+
k.id
|
|
2271
2273
|
)),
|
|
2272
2274
|
/* @__PURE__ */ e(
|
|
2273
|
-
|
|
2275
|
+
b,
|
|
2274
2276
|
{
|
|
2275
2277
|
contentStyle: {
|
|
2276
2278
|
fontSize: 12,
|
|
@@ -2284,7 +2286,7 @@ const Lt = Ta(function({
|
|
|
2284
2286
|
}
|
|
2285
2287
|
),
|
|
2286
2288
|
K && /* @__PURE__ */ e(
|
|
2287
|
-
|
|
2289
|
+
F,
|
|
2288
2290
|
{
|
|
2289
2291
|
type: "monotone",
|
|
2290
2292
|
dataKey: "band",
|
|
@@ -2296,7 +2298,7 @@ const Lt = Ta(function({
|
|
|
2296
2298
|
}
|
|
2297
2299
|
),
|
|
2298
2300
|
((y = a.config) == null ? void 0 : y.compare) && /* @__PURE__ */ e(
|
|
2299
|
-
|
|
2301
|
+
W,
|
|
2300
2302
|
{
|
|
2301
2303
|
type: "monotone",
|
|
2302
2304
|
dataKey: "prev",
|
|
@@ -2308,31 +2310,31 @@ const Lt = Ta(function({
|
|
|
2308
2310
|
}
|
|
2309
2311
|
),
|
|
2310
2312
|
/* @__PURE__ */ e(
|
|
2311
|
-
|
|
2313
|
+
W,
|
|
2312
2314
|
{
|
|
2313
2315
|
type: "monotone",
|
|
2314
2316
|
dataKey: "value",
|
|
2315
2317
|
stroke: Ge,
|
|
2316
2318
|
strokeWidth: 2,
|
|
2317
|
-
dot: (
|
|
2318
|
-
var
|
|
2319
|
-
return ie.has(((
|
|
2319
|
+
dot: (k) => {
|
|
2320
|
+
var j, B, T;
|
|
2321
|
+
return ie.has(((j = k.payload) == null ? void 0 : j.dim) ?? "") ? /* @__PURE__ */ e(
|
|
2320
2322
|
"circle",
|
|
2321
2323
|
{
|
|
2322
|
-
cx:
|
|
2323
|
-
cy:
|
|
2324
|
+
cx: k.cx,
|
|
2325
|
+
cy: k.cy,
|
|
2324
2326
|
r: 3.5,
|
|
2325
2327
|
fill: "#ef4444",
|
|
2326
2328
|
stroke: "#fff",
|
|
2327
2329
|
strokeWidth: 1
|
|
2328
2330
|
},
|
|
2329
|
-
(
|
|
2330
|
-
) : /* @__PURE__ */ e("g", {}, (
|
|
2331
|
+
(B = k.payload) == null ? void 0 : B.dim
|
|
2332
|
+
) : /* @__PURE__ */ e("g", {}, (T = k.payload) == null ? void 0 : T.dim);
|
|
2331
2333
|
}
|
|
2332
2334
|
}
|
|
2333
2335
|
),
|
|
2334
2336
|
M && /* @__PURE__ */ e(
|
|
2335
|
-
|
|
2337
|
+
W,
|
|
2336
2338
|
{
|
|
2337
2339
|
yAxisId: "right",
|
|
2338
2340
|
type: "monotone",
|
|
@@ -2343,8 +2345,8 @@ const Lt = Ta(function({
|
|
|
2343
2345
|
name: $
|
|
2344
2346
|
}
|
|
2345
2347
|
),
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
+
g >= 2 && /* @__PURE__ */ e(
|
|
2349
|
+
W,
|
|
2348
2350
|
{
|
|
2349
2351
|
type: "monotone",
|
|
2350
2352
|
dataKey: "ma",
|
|
@@ -2352,7 +2354,7 @@ const Lt = Ta(function({
|
|
|
2352
2354
|
strokeWidth: 1.5,
|
|
2353
2355
|
strokeDasharray: "5 3",
|
|
2354
2356
|
dot: !1,
|
|
2355
|
-
name: `${
|
|
2357
|
+
name: `${g}-bucket avg`,
|
|
2356
2358
|
isAnimationActive: !1
|
|
2357
2359
|
}
|
|
2358
2360
|
)
|
|
@@ -2361,30 +2363,30 @@ const Lt = Ta(function({
|
|
|
2361
2363
|
) });
|
|
2362
2364
|
} }) });
|
|
2363
2365
|
else {
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
Bar:
|
|
2367
|
-
Cell:
|
|
2368
|
-
ComposedChart:
|
|
2369
|
-
Line:
|
|
2370
|
-
ReferenceLine:
|
|
2371
|
-
ResponsiveContainer:
|
|
2366
|
+
const F = ((yt = a.config) == null ? void 0 : yt.orientation) === "horizontal";
|
|
2367
|
+
G = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Oe, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2368
|
+
Bar: z,
|
|
2369
|
+
Cell: W,
|
|
2370
|
+
ComposedChart: D,
|
|
2371
|
+
Line: r,
|
|
2372
|
+
ReferenceLine: b,
|
|
2373
|
+
ResponsiveContainer: v,
|
|
2372
2374
|
Tooltip: d,
|
|
2373
2375
|
XAxis: y,
|
|
2374
|
-
YAxis:
|
|
2376
|
+
YAxis: k
|
|
2375
2377
|
}) => {
|
|
2376
|
-
var
|
|
2377
|
-
return /* @__PURE__ */ e(
|
|
2378
|
-
|
|
2378
|
+
var j;
|
|
2379
|
+
return /* @__PURE__ */ e(v, { width: "100%", height: "100%", children: /* @__PURE__ */ i(
|
|
2380
|
+
D,
|
|
2379
2381
|
{
|
|
2380
2382
|
data: l,
|
|
2381
|
-
layout:
|
|
2382
|
-
margin: { top: 6, right: 8, left:
|
|
2383
|
+
layout: F ? "vertical" : "horizontal",
|
|
2384
|
+
margin: { top: 6, right: 8, left: F ? 10 : -10, bottom: 0 },
|
|
2383
2385
|
children: [
|
|
2384
|
-
|
|
2386
|
+
F ? /* @__PURE__ */ i(He, { children: [
|
|
2385
2387
|
/* @__PURE__ */ e(y, { type: "number", tick: { fontSize: 10 }, stroke: "#94a3b8" }),
|
|
2386
2388
|
/* @__PURE__ */ e(
|
|
2387
|
-
|
|
2389
|
+
k,
|
|
2388
2390
|
{
|
|
2389
2391
|
type: "category",
|
|
2390
2392
|
dataKey: "dim",
|
|
@@ -2406,7 +2408,7 @@ const Lt = Ta(function({
|
|
|
2406
2408
|
}
|
|
2407
2409
|
),
|
|
2408
2410
|
/* @__PURE__ */ e(
|
|
2409
|
-
|
|
2411
|
+
k,
|
|
2410
2412
|
{
|
|
2411
2413
|
tick: { fontSize: 10 },
|
|
2412
2414
|
stroke: "#94a3b8",
|
|
@@ -2415,7 +2417,7 @@ const Lt = Ta(function({
|
|
|
2415
2417
|
}
|
|
2416
2418
|
),
|
|
2417
2419
|
M && /* @__PURE__ */ e(
|
|
2418
|
-
|
|
2420
|
+
k,
|
|
2419
2421
|
{
|
|
2420
2422
|
yAxisId: "right",
|
|
2421
2423
|
orientation: "right",
|
|
@@ -2426,15 +2428,15 @@ const Lt = Ta(function({
|
|
|
2426
2428
|
}
|
|
2427
2429
|
)
|
|
2428
2430
|
] }),
|
|
2429
|
-
!
|
|
2430
|
-
|
|
2431
|
+
!F && I.map((B) => /* @__PURE__ */ e(
|
|
2432
|
+
b,
|
|
2431
2433
|
{
|
|
2432
|
-
x:
|
|
2434
|
+
x: B.anchor_date,
|
|
2433
2435
|
stroke: "#f59e0b",
|
|
2434
2436
|
strokeDasharray: "4 3",
|
|
2435
2437
|
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2436
2438
|
},
|
|
2437
|
-
|
|
2439
|
+
B.id
|
|
2438
2440
|
)),
|
|
2439
2441
|
/* @__PURE__ */ e(
|
|
2440
2442
|
d,
|
|
@@ -2450,40 +2452,40 @@ const Lt = Ta(function({
|
|
|
2450
2452
|
itemStyle: { color: "#e2e8f0" }
|
|
2451
2453
|
}
|
|
2452
2454
|
),
|
|
2453
|
-
((
|
|
2455
|
+
((j = a.config) == null ? void 0 : j.compare) && /* @__PURE__ */ e(z, { dataKey: "prev", fill: "#cbd5e1", radius: [3, 3, 0, 0], name: "previous" }),
|
|
2454
2456
|
/* @__PURE__ */ e(
|
|
2455
|
-
|
|
2457
|
+
z,
|
|
2456
2458
|
{
|
|
2457
2459
|
dataKey: "value",
|
|
2458
2460
|
fill: Ge,
|
|
2459
2461
|
radius: [3, 3, 0, 0],
|
|
2460
2462
|
className: a.collection ? "cursor-pointer" : void 0,
|
|
2461
|
-
onClick: (
|
|
2463
|
+
onClick: (B) => {
|
|
2462
2464
|
var Pe;
|
|
2463
2465
|
if (!a.collection) return;
|
|
2464
|
-
const
|
|
2465
|
-
if (
|
|
2466
|
+
const T = B == null ? void 0 : B.payload;
|
|
2467
|
+
if (T != null && T.other) return;
|
|
2466
2468
|
const Se = (Pe = a.config) == null ? void 0 : Pe.dimension;
|
|
2467
2469
|
de({
|
|
2468
2470
|
conditions: Mt(
|
|
2469
2471
|
a,
|
|
2470
2472
|
c,
|
|
2471
2473
|
o,
|
|
2472
|
-
(
|
|
2474
|
+
(T == null ? void 0 : T.raw) ?? (T == null ? void 0 : T.dim)
|
|
2473
2475
|
),
|
|
2474
|
-
title: `${a.title || a.collection} — ${(
|
|
2476
|
+
title: `${a.title || a.collection} — ${(T == null ? void 0 : T.dim) ?? ""}`,
|
|
2475
2477
|
dimField: Se != null && Se.bucket || Se == null ? void 0 : Se.field,
|
|
2476
|
-
dimRaw: (
|
|
2477
|
-
dimLabel:
|
|
2478
|
+
dimRaw: (T == null ? void 0 : T.raw) ?? (T == null ? void 0 : T.dim),
|
|
2479
|
+
dimLabel: T == null ? void 0 : T.dim
|
|
2478
2480
|
});
|
|
2479
2481
|
},
|
|
2480
|
-
children: l.map((
|
|
2482
|
+
children: l.map((B) => /* @__PURE__ */ e(W, { fill: B.other ? "#94a3b8" : Ge }, B.dim))
|
|
2481
2483
|
}
|
|
2482
2484
|
),
|
|
2483
2485
|
M && /* @__PURE__ */ e(
|
|
2484
|
-
|
|
2486
|
+
r,
|
|
2485
2487
|
{
|
|
2486
|
-
yAxisId:
|
|
2488
|
+
yAxisId: F ? void 0 : "right",
|
|
2487
2489
|
type: "monotone",
|
|
2488
2490
|
dataKey: "value2",
|
|
2489
2491
|
stroke: "#8b5cf6",
|
|
@@ -2498,7 +2500,7 @@ const Lt = Ta(function({
|
|
|
2498
2500
|
} }) });
|
|
2499
2501
|
}
|
|
2500
2502
|
}
|
|
2501
|
-
return L && p && (
|
|
2503
|
+
return L && p && (G = /* @__PURE__ */ i("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2502
2504
|
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" : qe(p.value, se) }),
|
|
2503
2505
|
/* @__PURE__ */ i("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
2504
2506
|
"As of ",
|
|
@@ -2523,7 +2525,7 @@ const Lt = Ta(function({
|
|
|
2523
2525
|
try {
|
|
2524
2526
|
sessionStorage.setItem(
|
|
2525
2527
|
`nvr-report-xf:${l.report_id}`,
|
|
2526
|
-
JSON.stringify(
|
|
2528
|
+
JSON.stringify(Y ?? [])
|
|
2527
2529
|
);
|
|
2528
2530
|
} catch {
|
|
2529
2531
|
}
|
|
@@ -2551,7 +2553,7 @@ const Lt = Ta(function({
|
|
|
2551
2553
|
{
|
|
2552
2554
|
type: "button",
|
|
2553
2555
|
title: he ? "Back to the chart" : "View as table (#383)",
|
|
2554
|
-
className:
|
|
2556
|
+
className: Q(
|
|
2555
2557
|
"rounded p-0.5",
|
|
2556
2558
|
he ? "text-[#00a5cc]" : "text-slate-300 hover:text-[#00a5cc]"
|
|
2557
2559
|
),
|
|
@@ -2567,7 +2569,7 @@ const Lt = Ta(function({
|
|
|
2567
2569
|
type: "button",
|
|
2568
2570
|
title: "Copy chart as image",
|
|
2569
2571
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2570
|
-
onClick: () => void Ha(
|
|
2572
|
+
onClick: () => void Ha(A.current, a.title),
|
|
2571
2573
|
children: /* @__PURE__ */ e(wt, { className: "h-3 w-3" })
|
|
2572
2574
|
}
|
|
2573
2575
|
),
|
|
@@ -2579,12 +2581,12 @@ const Lt = Ta(function({
|
|
|
2579
2581
|
"data-explain-trend": we ? "1" : void 0,
|
|
2580
2582
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2581
2583
|
onClick: () => {
|
|
2582
|
-
if (
|
|
2584
|
+
if (J) {
|
|
2583
2585
|
ne(!1);
|
|
2584
2586
|
return;
|
|
2585
2587
|
}
|
|
2586
2588
|
if (ne(!0), ce || _) return;
|
|
2587
|
-
if (
|
|
2589
|
+
if (P(!0), we) {
|
|
2588
2590
|
O.request(
|
|
2589
2591
|
pt(`/report-studio/${n}/widgets/${a.id}/explain-trend`, {
|
|
2590
2592
|
date_range: o,
|
|
@@ -2596,7 +2598,7 @@ const Lt = Ta(function({
|
|
|
2596
2598
|
(s) => fe(
|
|
2597
2599
|
(s == null ? void 0 : s.status) === 503 ? "AI is not configured on this instance." : (s == null ? void 0 : s.status) === 400 ? s.message ?? "Not enough data to describe a trend." : "AI is not configured or unavailable."
|
|
2598
2600
|
)
|
|
2599
|
-
).finally(() =>
|
|
2601
|
+
).finally(() => P(!1));
|
|
2600
2602
|
return;
|
|
2601
2603
|
}
|
|
2602
2604
|
(R ? Promise.resolve(R) : O.request(
|
|
@@ -2606,7 +2608,7 @@ const Lt = Ta(function({
|
|
|
2606
2608
|
})
|
|
2607
2609
|
).then((s) => s.data).catch(() => {
|
|
2608
2610
|
})).then((s) => {
|
|
2609
|
-
const
|
|
2611
|
+
const g = {
|
|
2610
2612
|
widget: a.title,
|
|
2611
2613
|
how_computed: Et(a),
|
|
2612
2614
|
value: (s == null ? void 0 : s.value) ?? null,
|
|
@@ -2619,7 +2621,7 @@ const Lt = Ta(function({
|
|
|
2619
2621
|
}, M = (s == null ? void 0 : s.prev_value) != null || ((s == null ? void 0 : s.series) ?? []).some(($) => $.prev != null);
|
|
2620
2622
|
return O.request(
|
|
2621
2623
|
pt("/ai/brief", {
|
|
2622
|
-
context: JSON.stringify(
|
|
2624
|
+
context: JSON.stringify(g),
|
|
2623
2625
|
// `template` picks the server's prompt; `instructions` (the same
|
|
2624
2626
|
// text) keeps an older API answering the same way.
|
|
2625
2627
|
template: M ? "report-compare" : "report-explain",
|
|
@@ -2628,9 +2630,9 @@ const Lt = Ta(function({
|
|
|
2628
2630
|
);
|
|
2629
2631
|
}).then((s) => {
|
|
2630
2632
|
var M, $;
|
|
2631
|
-
const
|
|
2632
|
-
fe(
|
|
2633
|
-
}).catch(() => fe("AI is not configured or unavailable.")).finally(() =>
|
|
2633
|
+
const g = ((M = s.data) == null ? void 0 : M.brief) ?? (($ = s.data) == null ? void 0 : $.text) ?? null;
|
|
2634
|
+
fe(g || "No explanation available.");
|
|
2635
|
+
}).catch(() => fe("AI is not configured or unavailable.")).finally(() => P(!1));
|
|
2634
2636
|
},
|
|
2635
2637
|
children: /* @__PURE__ */ e(Dt, { className: "h-3 w-3" })
|
|
2636
2638
|
}
|
|
@@ -2640,11 +2642,11 @@ const Lt = Ta(function({
|
|
|
2640
2642
|
{
|
|
2641
2643
|
type: "button",
|
|
2642
2644
|
title: te ? "Show per-period values" : "Show running total",
|
|
2643
|
-
className:
|
|
2645
|
+
className: Q(
|
|
2644
2646
|
"rounded p-0.5",
|
|
2645
2647
|
te ? "text-[#00a5cc]" : "text-slate-300 hover:text-slate-500"
|
|
2646
2648
|
),
|
|
2647
|
-
onClick: () =>
|
|
2649
|
+
onClick: () => V((l) => !l),
|
|
2648
2650
|
children: /* @__PURE__ */ e(qa, { className: "h-3 w-3" })
|
|
2649
2651
|
}
|
|
2650
2652
|
),
|
|
@@ -2653,7 +2655,7 @@ const Lt = Ta(function({
|
|
|
2653
2655
|
{
|
|
2654
2656
|
type: "button",
|
|
2655
2657
|
title: "Notes on this widget",
|
|
2656
|
-
className:
|
|
2658
|
+
className: Q(
|
|
2657
2659
|
"relative rounded p-0.5",
|
|
2658
2660
|
((q == null ? void 0 : q.length) ?? 0) > 0 ? "text-amber-500" : "text-slate-300 hover:text-slate-500"
|
|
2659
2661
|
),
|
|
@@ -2677,8 +2679,8 @@ const Lt = Ta(function({
|
|
|
2677
2679
|
queryKey: ["nivaro-report-query", l.slug, s],
|
|
2678
2680
|
queryFn: () => da(O, l.slug, s),
|
|
2679
2681
|
staleTime: 6e4
|
|
2680
|
-
}).then((
|
|
2681
|
-
_a(
|
|
2682
|
+
}).then((g) => Wt(a, void 0, oa(l, g))).catch((g) => {
|
|
2683
|
+
_a(g) || Xt.error(Tt(g, "this widget"));
|
|
2682
2684
|
});
|
|
2683
2685
|
},
|
|
2684
2686
|
children: /* @__PURE__ */ e(Fa, { className: "h-3 w-3" })
|
|
@@ -2692,7 +2694,7 @@ const Lt = Ta(function({
|
|
|
2692
2694
|
title: "Refresh",
|
|
2693
2695
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2694
2696
|
onClick: () => We(),
|
|
2695
|
-
children: /* @__PURE__ */ e(Ft, { className:
|
|
2697
|
+
children: /* @__PURE__ */ e(Ft, { className: Q("h-3 w-3", $t && "animate-spin") })
|
|
2696
2698
|
}
|
|
2697
2699
|
)
|
|
2698
2700
|
] })
|
|
@@ -2712,11 +2714,11 @@ const Lt = Ta(function({
|
|
|
2712
2714
|
l.note,
|
|
2713
2715
|
/* @__PURE__ */ e("span", { className: "ml-1 text-[10px] text-slate-400", children: l.created_by_name ?? "" })
|
|
2714
2716
|
] }),
|
|
2715
|
-
|
|
2717
|
+
U && /* @__PURE__ */ e(
|
|
2716
2718
|
"button",
|
|
2717
2719
|
{
|
|
2718
2720
|
type: "button",
|
|
2719
|
-
onClick: () =>
|
|
2721
|
+
onClick: () => U(l.id),
|
|
2720
2722
|
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 hover:text-red-500 group-hover/note:opacity-100",
|
|
2721
2723
|
children: /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
2722
2724
|
}
|
|
@@ -2763,7 +2765,7 @@ const Lt = Ta(function({
|
|
|
2763
2765
|
p && (() => {
|
|
2764
2766
|
const l = xl(R), s = p.value;
|
|
2765
2767
|
if (l == null || s == null) return null;
|
|
2766
|
-
const
|
|
2768
|
+
const g = s === 0 ? null : (l - s) / Math.abs(s) * 100;
|
|
2767
2769
|
return /* @__PURE__ */ i("p", { className: "mb-1 flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
2768
2770
|
/* @__PURE__ */ e(wt, { className: "h-2.5 w-2.5" }),
|
|
2769
2771
|
"vs ",
|
|
@@ -2775,17 +2777,17 @@ const Lt = Ta(function({
|
|
|
2775
2777
|
/* @__PURE__ */ e(
|
|
2776
2778
|
"span",
|
|
2777
2779
|
{
|
|
2778
|
-
className:
|
|
2780
|
+
className: Q(
|
|
2779
2781
|
"font-semibold",
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
+
g != null && g > 0 && "text-emerald-600 dark:text-emerald-400",
|
|
2783
|
+
g != null && g < 0 && "text-red-500"
|
|
2782
2784
|
),
|
|
2783
|
-
children:
|
|
2785
|
+
children: g == null ? "—" : `${g > 0 ? "+" : ""}${g.toFixed(1)}%`
|
|
2784
2786
|
}
|
|
2785
2787
|
)
|
|
2786
2788
|
] });
|
|
2787
2789
|
})(),
|
|
2788
|
-
|
|
2790
|
+
J && /* @__PURE__ */ i(
|
|
2789
2791
|
"div",
|
|
2790
2792
|
{
|
|
2791
2793
|
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",
|
|
@@ -2795,7 +2797,7 @@ const Lt = Ta(function({
|
|
|
2795
2797
|
!_ && me && me.length > 0 && /* @__PURE__ */ e("div", { className: "mt-1.5 flex flex-wrap gap-1", "data-explain-movers": !0, children: me.slice(0, 4).map((l) => /* @__PURE__ */ i(
|
|
2796
2798
|
"span",
|
|
2797
2799
|
{
|
|
2798
|
-
className:
|
|
2800
|
+
className: Q(
|
|
2799
2801
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] tabular-nums",
|
|
2800
2802
|
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"
|
|
2801
2803
|
),
|
|
@@ -2841,7 +2843,7 @@ const Lt = Ta(function({
|
|
|
2841
2843
|
)
|
|
2842
2844
|
] }, `${l.field}-${s}`))
|
|
2843
2845
|
] }),
|
|
2844
|
-
/* @__PURE__ */ e("div", { ref:
|
|
2846
|
+
/* @__PURE__ */ e("div", { ref: A, className: "flex min-h-0 flex-1 flex-col", children: he && ((ot = R == null ? void 0 : R.series) != null && ot.length) ? /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ i("table", { className: "w-full text-[11.5px]", children: [
|
|
2845
2847
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { className: "text-left text-[10px] uppercase tracking-wide text-slate-400", children: [
|
|
2846
2848
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1", children: "Dimension" }),
|
|
2847
2849
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1 text-right", children: "Value" })
|
|
@@ -2850,23 +2852,23 @@ const Lt = Ta(function({
|
|
|
2850
2852
|
/* @__PURE__ */ e("td", { className: "max-w-[220px] truncate px-1.5 py-1 text-slate-700 dark:text-slate-300", children: l.dim }),
|
|
2851
2853
|
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: qe(l.value, se) })
|
|
2852
2854
|
] }, l.dim)) })
|
|
2853
|
-
] }) }) :
|
|
2855
|
+
] }) }) : G }),
|
|
2854
2856
|
((Le = a.config) == null ? void 0 : Le.footnote) && /* @__PURE__ */ e("p", { className: "mt-1 border-t border-slate-100 pt-1 text-[10.5px] leading-snug text-slate-400 dark:border-border/50", children: a.config.footnote }),
|
|
2855
|
-
|
|
2857
|
+
H && /* @__PURE__ */ e(
|
|
2856
2858
|
bl,
|
|
2857
2859
|
{
|
|
2858
2860
|
collection: a.collection ?? "",
|
|
2859
|
-
conditions:
|
|
2860
|
-
title:
|
|
2861
|
+
conditions: H.conditions,
|
|
2862
|
+
title: H.title,
|
|
2861
2863
|
onClose: () => de(null),
|
|
2862
2864
|
onOpen: (l) => {
|
|
2863
2865
|
de(null), f == null || f(l);
|
|
2864
2866
|
},
|
|
2865
|
-
crossFilter: u &&
|
|
2867
|
+
crossFilter: u && H.dimField && H.dimRaw != null ? () => {
|
|
2866
2868
|
u(
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2869
|
+
H.dimField,
|
|
2870
|
+
H.dimRaw,
|
|
2871
|
+
H.dimLabel ?? String(H.dimRaw)
|
|
2870
2872
|
), de(null);
|
|
2871
2873
|
} : void 0
|
|
2872
2874
|
}
|
|
@@ -2875,7 +2877,7 @@ const Lt = Ta(function({
|
|
|
2875
2877
|
}
|
|
2876
2878
|
);
|
|
2877
2879
|
});
|
|
2878
|
-
function
|
|
2880
|
+
function Bl({
|
|
2879
2881
|
reportId: t,
|
|
2880
2882
|
widget: n,
|
|
2881
2883
|
dateRange: a = null,
|
|
@@ -2896,7 +2898,15 @@ function El({
|
|
|
2896
2898
|
}
|
|
2897
2899
|
);
|
|
2898
2900
|
}
|
|
2899
|
-
function
|
|
2901
|
+
function gl(t) {
|
|
2902
|
+
const n = t == null ? "" : String(t);
|
|
2903
|
+
return n.length > 24 ? `${n.slice(0, 23)}…` : n;
|
|
2904
|
+
}
|
|
2905
|
+
function vl(t) {
|
|
2906
|
+
const n = t;
|
|
2907
|
+
return !(n != null && n.admin) || !n.access_scope_label ? null : `(your access scope: ${n.access_scope_label})`;
|
|
2908
|
+
}
|
|
2909
|
+
function Ql({
|
|
2900
2910
|
reportId: t,
|
|
2901
2911
|
showFilterBar: n = !0,
|
|
2902
2912
|
dateRange: a,
|
|
@@ -2906,22 +2916,22 @@ function Wl({
|
|
|
2906
2916
|
emptyState: h,
|
|
2907
2917
|
reportUrl: f
|
|
2908
2918
|
}) {
|
|
2909
|
-
var W,
|
|
2910
|
-
const p = Ke(), L = Zt(), q = La("drill.report"), w = q.value,
|
|
2919
|
+
var W, D;
|
|
2920
|
+
const p = Ke(), L = Zt(), q = La("drill.report"), w = q.value, U = At(
|
|
2911
2921
|
(r) => L ? L.open(r) : q.push([r]),
|
|
2912
2922
|
[L, q.push]
|
|
2913
|
-
), [u, N] = C(void 0), [
|
|
2923
|
+
), [u, N] = C(void 0), [Y, O] = C(o), [ee, X] = C(void 0), [ue, pe] = C(o), { scopes: H, ready: de } = ja(), [xe, be] = C(!1), [ge, $e] = C({}), x = Ct(), { data: Z = [] } = Ne({
|
|
2914
2924
|
queryKey: ["nivaro-report-presets", t],
|
|
2915
2925
|
queryFn: async () => {
|
|
2916
2926
|
try {
|
|
2917
2927
|
const r = JSON.parse(localStorage.getItem(`nvr-report-presets:${t}`) ?? "[]");
|
|
2918
2928
|
if (Array.isArray(r) && r.length > 0) {
|
|
2919
|
-
for (const
|
|
2920
|
-
|
|
2929
|
+
for (const b of r)
|
|
2930
|
+
b != null && b.name && await p.request(
|
|
2921
2931
|
Kt(t, {
|
|
2922
|
-
name: String(
|
|
2923
|
-
date_range:
|
|
2924
|
-
entity_filters:
|
|
2932
|
+
name: String(b.name),
|
|
2933
|
+
date_range: b.date_range ?? null,
|
|
2934
|
+
entity_filters: b.entity_filters ?? []
|
|
2925
2935
|
})
|
|
2926
2936
|
).catch(() => {
|
|
2927
2937
|
});
|
|
@@ -2932,7 +2942,7 @@ function Wl({
|
|
|
2932
2942
|
return p.request(ua(t)).then((r) => r.data);
|
|
2933
2943
|
},
|
|
2934
2944
|
staleTime: 6e4
|
|
2935
|
-
}), te = () => void x.invalidateQueries({ queryKey: ["nivaro-report-presets", t] }),
|
|
2945
|
+
}), te = () => void x.invalidateQueries({ queryKey: ["nivaro-report-presets", t] }), V = Me({
|
|
2936
2946
|
mutationFn: (r) => p.request(
|
|
2937
2947
|
Kt(t, {
|
|
2938
2948
|
name: r,
|
|
@@ -2944,7 +2954,7 @@ function Wl({
|
|
|
2944
2954
|
}), he = Me({
|
|
2945
2955
|
mutationFn: (r) => p.request(pa(t, r)),
|
|
2946
2956
|
onSuccess: te
|
|
2947
|
-
}), [le, ae] = C(""), [S,
|
|
2957
|
+
}), [le, ae] = C(""), [S, A] = C(!1), [E, J] = C(null), [ne, ce] = C(!1), { data: fe = [] } = Ne({
|
|
2948
2958
|
queryKey: ["nvr-report-snaps", t],
|
|
2949
2959
|
queryFn: () => p.request(
|
|
2950
2960
|
ct(`/report-studio/${t}/snapshots`)
|
|
@@ -2952,14 +2962,14 @@ function Wl({
|
|
|
2952
2962
|
staleTime: 6e4,
|
|
2953
2963
|
retry: !1
|
|
2954
2964
|
}), { data: _ } = Ne({
|
|
2955
|
-
queryKey: ["nvr-report-snap", t,
|
|
2965
|
+
queryKey: ["nvr-report-snap", t, E],
|
|
2956
2966
|
queryFn: () => p.request(
|
|
2957
|
-
ct(`/report-studio/${t}/snapshots/${
|
|
2967
|
+
ct(`/report-studio/${t}/snapshots/${E}`)
|
|
2958
2968
|
).then((r) => r.data),
|
|
2959
|
-
enabled:
|
|
2969
|
+
enabled: E != null,
|
|
2960
2970
|
staleTime: 5 * 6e4,
|
|
2961
2971
|
retry: !1
|
|
2962
|
-
}),
|
|
2972
|
+
}), P = Me({
|
|
2963
2973
|
mutationFn: () => p.request(pt(`/report-studio/${t}/snapshots`, {})),
|
|
2964
2974
|
onSuccess: () => void x.invalidateQueries({ queryKey: ["nvr-report-snaps", t] })
|
|
2965
2975
|
}), { data: me = [] } = Ne({
|
|
@@ -2973,23 +2983,23 @@ function Wl({
|
|
|
2973
2983
|
}), Te = Me({
|
|
2974
2984
|
mutationFn: (r) => p.request(Ra(`/report-studio/${t}/annotations/${r}`)),
|
|
2975
2985
|
onSuccess: ve
|
|
2976
|
-
}), Xe = At((r,
|
|
2977
|
-
const
|
|
2986
|
+
}), Xe = At((r, b, v) => {
|
|
2987
|
+
const d = {
|
|
2978
2988
|
field: r,
|
|
2979
|
-
values: [
|
|
2980
|
-
labels: [
|
|
2989
|
+
values: [b],
|
|
2990
|
+
labels: [v]
|
|
2981
2991
|
};
|
|
2982
|
-
O((
|
|
2992
|
+
O((y) => [...y.filter((k) => k.field !== r), d]), pe((y) => [...y.filter((k) => k.field !== r), d]);
|
|
2983
2993
|
}, []), [ye, Ze] = C(!1), [ke, Fe] = C(null), [Ie, Ee] = C(null), De = Me({
|
|
2984
2994
|
mutationFn: (r) => p.request(
|
|
2985
2995
|
Oa(`/report-studio/${t}/widgets`, {
|
|
2986
|
-
widgets: r.map((
|
|
2996
|
+
widgets: r.map((b, v) => ({ ...b, sort: v }))
|
|
2987
2997
|
})
|
|
2988
2998
|
),
|
|
2989
2999
|
onSuccess: () => {
|
|
2990
3000
|
Ze(!1), Fe(null), Ee(null), x.invalidateQueries({ queryKey: ["nivaro-report", t] }), x.invalidateQueries({ queryKey: ["nivaro-report-widget"] });
|
|
2991
3001
|
}
|
|
2992
|
-
}), We = (r) => [...r].sort((
|
|
3002
|
+
}), We = (r) => [...r].sort((b, v) => (b.y ?? 0) - (v.y ?? 0) || (b.x ?? 0) - (v.x ?? 0)), [$t, Be] = C(() => /* @__PURE__ */ new Date()), ht = () => {
|
|
2993
3003
|
x.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), x.invalidateQueries({ queryKey: ["nivaro-report-query"] }), Be(/* @__PURE__ */ new Date());
|
|
2994
3004
|
}, { data: R = [] } = Ne({
|
|
2995
3005
|
queryKey: ["nvr-report-firing", t],
|
|
@@ -2997,117 +3007,124 @@ function Wl({
|
|
|
2997
3007
|
staleTime: 6e4,
|
|
2998
3008
|
refetchInterval: 5 * 6e4,
|
|
2999
3009
|
retry: !1
|
|
3000
|
-
}), [se, et] = C(null), [Qe, _e] = C(!1), [
|
|
3010
|
+
}), [se, et] = C(null), [Qe, _e] = C(!1), [G, ft] = C(""), [Ue, xt] = C(""), [Ye, bt] = C("");
|
|
3001
3011
|
mt(() => {
|
|
3002
3012
|
try {
|
|
3003
3013
|
const r = sessionStorage.getItem(`nvr-report-xf:${t}`);
|
|
3004
3014
|
if (r) {
|
|
3005
3015
|
sessionStorage.removeItem(`nvr-report-xf:${t}`);
|
|
3006
|
-
const
|
|
3007
|
-
Array.isArray(
|
|
3016
|
+
const b = JSON.parse(r);
|
|
3017
|
+
Array.isArray(b) && b.length > 0 && (O(b), pe(b));
|
|
3008
3018
|
}
|
|
3009
3019
|
} catch {
|
|
3010
3020
|
}
|
|
3011
3021
|
}, [t]);
|
|
3012
3022
|
const gt = () => {
|
|
3013
3023
|
Fe(We((re == null ? void 0 : re.widgets) ?? [])), Ze(!0), window.__nvrReportId = t;
|
|
3014
|
-
}, tt = (r) => Fe((
|
|
3015
|
-
const
|
|
3016
|
-
if (
|
|
3017
|
-
const
|
|
3018
|
-
return
|
|
3024
|
+
}, tt = (r) => Fe((b) => (b ?? []).map((v) => v.id === r.id ? r : v)), vt = (r, b) => Fe((v) => {
|
|
3025
|
+
const d = [...v ?? []], y = d.findIndex((T) => T.id === r), k = y + b;
|
|
3026
|
+
if (y < 0 || k < 0 || k >= d.length) return d;
|
|
3027
|
+
const j = d[y], B = d[k];
|
|
3028
|
+
return d[y] = { ...B, x: j.x, y: j.y }, d[k] = { ...j, x: B.x, y: B.y }, d;
|
|
3019
3029
|
}), [Ve, at] = C(""), [Je, lt] = C(!1), [rt, nt] = C(null), { data: re, isLoading: yt } = Ne({
|
|
3020
3030
|
queryKey: ["nivaro-report", t],
|
|
3021
3031
|
queryFn: () => p.request(ha(t)).then((r) => r.data),
|
|
3022
3032
|
staleTime: 3e4
|
|
3023
3033
|
}), st = St(null), it = St([]), ot = ((W = re == null ? void 0 : re.global_filters) == null ? void 0 : W.date_range) ?? null, Le = ut(() => u !== void 0 ? u : a !== void 0 ? a : ot, [u, a, ot]);
|
|
3024
|
-
st.current = Le ?? null, it.current =
|
|
3034
|
+
st.current = Le ?? null, it.current = Y;
|
|
3025
3035
|
const l = ut(
|
|
3026
3036
|
() => {
|
|
3027
3037
|
var r;
|
|
3028
3038
|
return ((r = re == null ? void 0 : re.global_filters) == null ? void 0 : r.filter_bar) ?? [];
|
|
3029
3039
|
},
|
|
3030
|
-
[(
|
|
3040
|
+
[(D = re == null ? void 0 : re.global_filters) == null ? void 0 : D.filter_bar]
|
|
3031
3041
|
);
|
|
3032
3042
|
mt(() => {
|
|
3033
3043
|
if (!xe && !(!de || !re)) {
|
|
3034
|
-
if (!
|
|
3044
|
+
if (!H || l.length === 0) {
|
|
3035
3045
|
be(!0);
|
|
3036
3046
|
return;
|
|
3037
3047
|
}
|
|
3038
3048
|
(async () => {
|
|
3039
|
-
var
|
|
3040
|
-
const r = [],
|
|
3041
|
-
for (const
|
|
3042
|
-
const
|
|
3043
|
-
key:
|
|
3044
|
-
collection: (
|
|
3049
|
+
var v;
|
|
3050
|
+
const r = [], b = {};
|
|
3051
|
+
for (const d of l) {
|
|
3052
|
+
const y = Ea(H, {
|
|
3053
|
+
key: d.field,
|
|
3054
|
+
collection: (v = d.options) == null ? void 0 : v.collection
|
|
3045
3055
|
});
|
|
3046
|
-
if (!
|
|
3047
|
-
const
|
|
3048
|
-
if (
|
|
3049
|
-
const
|
|
3056
|
+
if (!y) continue;
|
|
3057
|
+
const k = d.options ? d.options.value_field ?? "id" : "id", j = H.restricted[y.name] ?? [];
|
|
3058
|
+
if (j.length > 0) {
|
|
3059
|
+
const T = await Pt(p, y, j, k).catch(
|
|
3050
3060
|
() => []
|
|
3051
3061
|
);
|
|
3052
|
-
|
|
3062
|
+
T.length > 0 && (b[d.field] = T);
|
|
3053
3063
|
}
|
|
3054
|
-
const B = Wa(
|
|
3064
|
+
const B = Wa(H, y.name);
|
|
3055
3065
|
if (B.length > 0) {
|
|
3056
|
-
const
|
|
3066
|
+
const T = await Pt(p, y, B, k).catch(
|
|
3057
3067
|
() => []
|
|
3058
3068
|
);
|
|
3059
|
-
|
|
3069
|
+
T.length > 0 && r.push({ field: d.field, values: T, labels: T.map(String) });
|
|
3060
3070
|
}
|
|
3061
3071
|
}
|
|
3062
|
-
if (Object.keys(
|
|
3063
|
-
const
|
|
3064
|
-
const
|
|
3065
|
-
for (const
|
|
3066
|
-
return
|
|
3072
|
+
if (Object.keys(b).length > 0 && $e(b), r.length > 0) {
|
|
3073
|
+
const d = (y) => {
|
|
3074
|
+
const k = [...y];
|
|
3075
|
+
for (const j of r) k.some((B) => B.field === j.field) || k.push(j);
|
|
3076
|
+
return k;
|
|
3067
3077
|
};
|
|
3068
|
-
pe(
|
|
3078
|
+
pe(d), O(d);
|
|
3069
3079
|
}
|
|
3070
3080
|
be(!0);
|
|
3071
3081
|
})();
|
|
3072
3082
|
}
|
|
3073
|
-
}, [xe, de, re,
|
|
3074
|
-
const s = (re == null ? void 0 : re.widgets) ?? [],
|
|
3075
|
-
O(ue), ee !== void 0 && (N(ee),
|
|
3083
|
+
}, [xe, de, re, H, l]);
|
|
3084
|
+
const s = (re == null ? void 0 : re.widgets) ?? [], g = ee !== void 0 ? ee : Le, M = Y.filter((r) => r.values.length > 0).length + (Le ? 1 : 0), $ = JSON.stringify(ue) !== JSON.stringify(Y) || ee !== void 0, K = () => {
|
|
3085
|
+
O(ue), ee !== void 0 && (N(ee), X(void 0));
|
|
3076
3086
|
}, ie = () => {
|
|
3077
|
-
pe([]), O([]), N(null),
|
|
3087
|
+
pe([]), O([]), N(null), X(void 0);
|
|
3078
3088
|
}, I = (r) => {
|
|
3079
|
-
pe(r.entity_filters), O(r.entity_filters), N(r.date_range),
|
|
3080
|
-
},
|
|
3081
|
-
var
|
|
3089
|
+
pe(r.entity_filters), O(r.entity_filters), N(r.date_range), X(void 0);
|
|
3090
|
+
}, F = async () => {
|
|
3091
|
+
var b, v;
|
|
3082
3092
|
const r = Ve.trim();
|
|
3083
3093
|
if (!(!r || Je)) {
|
|
3084
3094
|
lt(!0), nt(null);
|
|
3085
3095
|
try {
|
|
3086
|
-
const
|
|
3096
|
+
const d = await p.request(
|
|
3087
3097
|
ga(
|
|
3088
3098
|
t,
|
|
3089
3099
|
r,
|
|
3090
|
-
l.map((
|
|
3100
|
+
l.map((k) => ({ field: k.field, label: k.label }))
|
|
3091
3101
|
)
|
|
3092
|
-
),
|
|
3093
|
-
var
|
|
3094
|
-
return l.some((B) => B.field ===
|
|
3095
|
-
}).map((
|
|
3096
|
-
pe(
|
|
3097
|
-
} catch (
|
|
3102
|
+
), y = (d.data.entity_filters ?? []).filter((k) => {
|
|
3103
|
+
var j;
|
|
3104
|
+
return l.some((B) => B.field === k.field) && ((j = k.values) == null ? void 0 : j.length) > 0;
|
|
3105
|
+
}).map((k) => ({ field: k.field, values: k.values, labels: k.values.map(String) }));
|
|
3106
|
+
pe(y), O(y), N(d.data.date_range ?? null), X(void 0), at("");
|
|
3107
|
+
} catch (d) {
|
|
3098
3108
|
nt(
|
|
3099
|
-
((
|
|
3109
|
+
((v = (b = d.response) == null ? void 0 : b.data) == null ? void 0 : v.error) ?? "Could not parse that"
|
|
3100
3110
|
);
|
|
3101
3111
|
} finally {
|
|
3102
3112
|
lt(!1);
|
|
3103
3113
|
}
|
|
3104
3114
|
}
|
|
3105
3115
|
};
|
|
3106
|
-
|
|
3116
|
+
if (yt || !xe)
|
|
3117
|
+
return /* @__PURE__ */ e("div", { className: Q("p-6 text-[13px] text-slate-400", m), children: "Loading report…" });
|
|
3118
|
+
if (!re)
|
|
3119
|
+
return /* @__PURE__ */ e("div", { className: Q("p-6 text-[13px] text-slate-400", m), children: "Report not found." });
|
|
3120
|
+
const z = vl(H);
|
|
3121
|
+
return /* @__PURE__ */ i("div", { className: Q("flex flex-col gap-3", m), children: [
|
|
3122
|
+
z && (!n || s.length === 0 && l.length === 0) && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-amber-700 dark:text-amber-300", children: z }),
|
|
3107
3123
|
n && (s.length > 0 || l.length > 0) && /* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
3108
3124
|
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
3109
3125
|
/* @__PURE__ */ i("span", { className: "flex items-center gap-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-slate-300", children: [
|
|
3110
3126
|
"Filters",
|
|
3127
|
+
z && /* @__PURE__ */ e("span", { className: "font-normal text-amber-700 dark:text-amber-300", children: z }),
|
|
3111
3128
|
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: [
|
|
3112
3129
|
"Active · ",
|
|
3113
3130
|
M
|
|
@@ -3116,15 +3133,15 @@ function Wl({
|
|
|
3116
3133
|
/* @__PURE__ */ e(
|
|
3117
3134
|
Nt,
|
|
3118
3135
|
{
|
|
3119
|
-
value: (
|
|
3120
|
-
onChange: (r) =>
|
|
3136
|
+
value: (g == null ? void 0 : g.preset) ?? "",
|
|
3137
|
+
onChange: (r) => X(r ? { preset: r } : null),
|
|
3121
3138
|
options: ll.map((r) => ({ value: r.id, label: r.label })),
|
|
3122
3139
|
ariaLabel: "Date range",
|
|
3123
3140
|
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"
|
|
3124
3141
|
}
|
|
3125
3142
|
),
|
|
3126
3143
|
l.map((r) => {
|
|
3127
|
-
var
|
|
3144
|
+
var b;
|
|
3128
3145
|
return /* @__PURE__ */ e(
|
|
3129
3146
|
na,
|
|
3130
3147
|
{
|
|
@@ -3133,10 +3150,10 @@ function Wl({
|
|
|
3133
3150
|
label: r.label,
|
|
3134
3151
|
optionSource: r.options,
|
|
3135
3152
|
allowedValues: ge[r.field],
|
|
3136
|
-
selected: ((
|
|
3137
|
-
onChange: (
|
|
3138
|
-
...
|
|
3139
|
-
...
|
|
3153
|
+
selected: ((b = ue.find((v) => v.field === r.field)) == null ? void 0 : b.values) ?? [],
|
|
3154
|
+
onChange: (v, d) => pe((y) => [
|
|
3155
|
+
...y.filter((k) => k.field !== r.field),
|
|
3156
|
+
...v.length > 0 ? [{ field: r.field, values: v, labels: d }] : []
|
|
3140
3157
|
])
|
|
3141
3158
|
},
|
|
3142
3159
|
r.field
|
|
@@ -3148,7 +3165,7 @@ function Wl({
|
|
|
3148
3165
|
type: "button",
|
|
3149
3166
|
disabled: !$,
|
|
3150
3167
|
onClick: K,
|
|
3151
|
-
className:
|
|
3168
|
+
className: Q(
|
|
3152
3169
|
"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11.5px] font-semibold",
|
|
3153
3170
|
$ ? "bg-nvr-cyan text-white" : "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500"
|
|
3154
3171
|
),
|
|
@@ -3200,7 +3217,7 @@ function Wl({
|
|
|
3200
3217
|
placeholder: "Preset name",
|
|
3201
3218
|
autoFocus: !0,
|
|
3202
3219
|
onKeyDown: (r) => {
|
|
3203
|
-
r.key === "Enter" && le.trim() && (
|
|
3220
|
+
r.key === "Enter" && le.trim() && (V.mutate(le.trim()), ae(""), A(!1)), r.key === "Escape" && A(!1);
|
|
3204
3221
|
},
|
|
3205
3222
|
className: "h-6 w-[130px] rounded-md border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-card"
|
|
3206
3223
|
}
|
|
@@ -3209,7 +3226,7 @@ function Wl({
|
|
|
3209
3226
|
{
|
|
3210
3227
|
type: "button",
|
|
3211
3228
|
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",
|
|
3212
|
-
onClick: () =>
|
|
3229
|
+
onClick: () => A(!0),
|
|
3213
3230
|
children: [
|
|
3214
3231
|
/* @__PURE__ */ e(Yt, { className: "h-2.5 w-2.5" }),
|
|
3215
3232
|
" Save preset"
|
|
@@ -3222,13 +3239,13 @@ function Wl({
|
|
|
3222
3239
|
{
|
|
3223
3240
|
type: "button",
|
|
3224
3241
|
title: "Save the current numbers as a snapshot to compare against later",
|
|
3225
|
-
disabled:
|
|
3226
|
-
onClick: () =>
|
|
3242
|
+
disabled: P.isPending,
|
|
3243
|
+
onClick: () => P.mutate(),
|
|
3227
3244
|
className: "inline-flex h-6 items-center gap-1 rounded-full border border-dashed border-slate-200 px-2 text-[11px] text-slate-400 hover:border-slate-300 hover:text-slate-600 disabled:opacity-40 dark:border-border",
|
|
3228
3245
|
children: [
|
|
3229
3246
|
/* @__PURE__ */ e(wt, { className: "h-2.5 w-2.5" }),
|
|
3230
3247
|
" ",
|
|
3231
|
-
|
|
3248
|
+
P.isPending ? "Saving…" : "Snapshot"
|
|
3232
3249
|
]
|
|
3233
3250
|
}
|
|
3234
3251
|
),
|
|
@@ -3237,27 +3254,27 @@ function Wl({
|
|
|
3237
3254
|
{
|
|
3238
3255
|
type: "button",
|
|
3239
3256
|
title: `Compare against ${r.name} (${new Date(r.taken_at).toLocaleDateString()})`,
|
|
3240
|
-
onClick: () =>
|
|
3241
|
-
className:
|
|
3257
|
+
onClick: () => J((b) => b === r.id ? null : r.id),
|
|
3258
|
+
className: Q(
|
|
3242
3259
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3243
|
-
|
|
3260
|
+
E === 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"
|
|
3244
3261
|
),
|
|
3245
3262
|
children: [
|
|
3246
3263
|
/* @__PURE__ */ e(wt, { className: "h-2.5 w-2.5" }),
|
|
3247
3264
|
" ",
|
|
3248
3265
|
r.name,
|
|
3249
|
-
|
|
3266
|
+
E === r.id && /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
3250
3267
|
]
|
|
3251
3268
|
},
|
|
3252
3269
|
r.id
|
|
3253
3270
|
)),
|
|
3254
|
-
|
|
3271
|
+
E != null && /* @__PURE__ */ e(
|
|
3255
3272
|
"button",
|
|
3256
3273
|
{
|
|
3257
3274
|
type: "button",
|
|
3258
3275
|
title: "Time machine (#404): show the snapshot values AS the numbers, not as delta badges",
|
|
3259
3276
|
onClick: () => ce((r) => !r),
|
|
3260
|
-
className:
|
|
3277
|
+
className: Q(
|
|
3261
3278
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3262
3279
|
ne ? "border-amber-400 bg-amber-50 font-medium text-amber-700 dark:bg-amber-400/10 dark:text-amber-400" : "border-dashed border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border"
|
|
3263
3280
|
),
|
|
@@ -3273,7 +3290,7 @@ function Wl({
|
|
|
3273
3290
|
value: Ve,
|
|
3274
3291
|
onChange: (r) => at(r.target.value),
|
|
3275
3292
|
onKeyDown: (r) => {
|
|
3276
|
-
r.key === "Enter" &&
|
|
3293
|
+
r.key === "Enter" && F();
|
|
3277
3294
|
},
|
|
3278
3295
|
placeholder: 'Describe filters… e.g. "Zone 1 CRAN this year"',
|
|
3279
3296
|
className: "h-full min-w-0 flex-1 bg-transparent text-[11.5px] outline-none placeholder:text-slate-300 dark:text-slate-200"
|
|
@@ -3284,7 +3301,7 @@ function Wl({
|
|
|
3284
3301
|
{
|
|
3285
3302
|
type: "button",
|
|
3286
3303
|
disabled: Je || !Ve.trim(),
|
|
3287
|
-
onClick: () => void
|
|
3304
|
+
onClick: () => void F(),
|
|
3288
3305
|
className: "text-[11px] font-semibold text-nvr-navy disabled:opacity-40 dark:text-nvr-cyan",
|
|
3289
3306
|
children: Je ? "…" : "Set"
|
|
3290
3307
|
}
|
|
@@ -3320,7 +3337,7 @@ function Wl({
|
|
|
3320
3337
|
{
|
|
3321
3338
|
type: "button",
|
|
3322
3339
|
onClick: () => _e((r) => !r),
|
|
3323
|
-
className:
|
|
3340
|
+
className: Q(
|
|
3324
3341
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3325
3342
|
se ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
3326
3343
|
),
|
|
@@ -3342,7 +3359,7 @@ function Wl({
|
|
|
3342
3359
|
/* @__PURE__ */ e(
|
|
3343
3360
|
"input",
|
|
3344
3361
|
{
|
|
3345
|
-
value:
|
|
3362
|
+
value: G,
|
|
3346
3363
|
onChange: (r) => ft(r.target.value),
|
|
3347
3364
|
placeholder: "Filter field (e.g. division)",
|
|
3348
3365
|
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"
|
|
@@ -3372,9 +3389,9 @@ function Wl({
|
|
|
3372
3389
|
"button",
|
|
3373
3390
|
{
|
|
3374
3391
|
type: "button",
|
|
3375
|
-
disabled: !
|
|
3392
|
+
disabled: !G.trim() || !Ue.trim() || !Ye.trim(),
|
|
3376
3393
|
onClick: () => {
|
|
3377
|
-
et({ field:
|
|
3394
|
+
et({ field: G.trim(), a: Ue.trim(), b: Ye.trim() }), _e(!1);
|
|
3378
3395
|
},
|
|
3379
3396
|
className: "h-7 rounded-md bg-nvr-cyan text-[11.5px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3380
3397
|
children: "Compare"
|
|
@@ -3383,7 +3400,7 @@ function Wl({
|
|
|
3383
3400
|
] })
|
|
3384
3401
|
] })
|
|
3385
3402
|
] }),
|
|
3386
|
-
|
|
3403
|
+
Y.filter((r) => !l.some((b) => b.field === r.field)).length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5 px-1 pb-2", children: Y.filter((r) => !l.some((b) => b.field === r.field)).map((r) => /* @__PURE__ */ i(
|
|
3387
3404
|
"span",
|
|
3388
3405
|
{
|
|
3389
3406
|
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",
|
|
@@ -3397,7 +3414,7 @@ function Wl({
|
|
|
3397
3414
|
type: "button",
|
|
3398
3415
|
"aria-label": "Remove filter",
|
|
3399
3416
|
onClick: () => {
|
|
3400
|
-
O((
|
|
3417
|
+
O((b) => b.filter((v) => v.field !== r.field)), pe((b) => b.filter((v) => v.field !== r.field));
|
|
3401
3418
|
},
|
|
3402
3419
|
className: "rounded-full p-0.5 hover:bg-nvr-cyan/[0.16]",
|
|
3403
3420
|
children: /* @__PURE__ */ e(Ae, { className: "h-2.5 w-2.5" })
|
|
@@ -3443,7 +3460,7 @@ function Wl({
|
|
|
3443
3460
|
el,
|
|
3444
3461
|
{
|
|
3445
3462
|
maxY: Math.max(0, ...ke.map((r) => (r.y ?? 0) + (r.h ?? 1))),
|
|
3446
|
-
onAdd: (r) => Fe((
|
|
3463
|
+
onAdd: (r) => Fe((b) => [...b ?? [], r])
|
|
3447
3464
|
}
|
|
3448
3465
|
) }) }),
|
|
3449
3466
|
s.length === 0 && !ye ? /* @__PURE__ */ e("div", { className: "p-6 text-[13px] text-slate-400", children: h ?? "This report has no widgets yet." }) : /* @__PURE__ */ e(
|
|
@@ -3455,7 +3472,7 @@ function Wl({
|
|
|
3455
3472
|
gridAutoRows: ye ? void 0 : "72px"
|
|
3456
3473
|
},
|
|
3457
3474
|
children: We(ye && ke ? ke : s).map((r) => {
|
|
3458
|
-
var
|
|
3475
|
+
var b;
|
|
3459
3476
|
return /* @__PURE__ */ e(
|
|
3460
3477
|
"div",
|
|
3461
3478
|
{
|
|
@@ -3464,11 +3481,11 @@ function Wl({
|
|
|
3464
3481
|
gridRow: void 0
|
|
3465
3482
|
},
|
|
3466
3483
|
className: ye || se ? "" : "contents",
|
|
3467
|
-
children: se && !ye && r.type !== "divider" ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [se.a, se.b].map((
|
|
3484
|
+
children: se && !ye && r.type !== "divider" ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [se.a, se.b].map((v, d) => /* @__PURE__ */ i("div", { className: "flex min-h-[160px] flex-col", children: [
|
|
3468
3485
|
/* @__PURE__ */ i("p", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-[#007a99] dark:text-nvr-cyan", children: [
|
|
3469
3486
|
se.field.replace(/_/g, " "),
|
|
3470
3487
|
": ",
|
|
3471
|
-
|
|
3488
|
+
v
|
|
3472
3489
|
] }),
|
|
3473
3490
|
/* @__PURE__ */ e(
|
|
3474
3491
|
Lt,
|
|
@@ -3477,27 +3494,27 @@ function Wl({
|
|
|
3477
3494
|
widget: r,
|
|
3478
3495
|
dateRange: Le,
|
|
3479
3496
|
entityFilters: [
|
|
3480
|
-
...
|
|
3481
|
-
{ field: se.field, values: [
|
|
3497
|
+
...Y.filter((y) => y.field !== se.field),
|
|
3498
|
+
{ field: se.field, values: [v], labels: [v] }
|
|
3482
3499
|
],
|
|
3483
3500
|
refetchInterval: c,
|
|
3484
3501
|
filterBar: l,
|
|
3485
|
-
onDrill:
|
|
3502
|
+
onDrill: U
|
|
3486
3503
|
}
|
|
3487
3504
|
)
|
|
3488
|
-
] },
|
|
3505
|
+
] }, d)) }) : /* @__PURE__ */ i(He, { children: [
|
|
3489
3506
|
ye && /* @__PURE__ */ e(qt, { fallback: null, children: /* @__PURE__ */ e(
|
|
3490
3507
|
al,
|
|
3491
3508
|
{
|
|
3492
3509
|
widget: r,
|
|
3493
3510
|
onConfigure: () => Ee(r.id),
|
|
3494
|
-
onDelete: () => Fe((
|
|
3495
|
-
onResize: (
|
|
3511
|
+
onDelete: () => Fe((v) => (v ?? []).filter((d) => d.id !== r.id)),
|
|
3512
|
+
onResize: (v, d) => tt({
|
|
3496
3513
|
...r,
|
|
3497
|
-
w: Math.min(12, Math.max(2, (r.w || 4) +
|
|
3498
|
-
h: Math.min(8, Math.max(1, (r.h || 2) +
|
|
3514
|
+
w: Math.min(12, Math.max(2, (r.w || 4) + v)),
|
|
3515
|
+
h: Math.min(8, Math.max(1, (r.h || 2) + d))
|
|
3499
3516
|
}),
|
|
3500
|
-
onMove: (
|
|
3517
|
+
onMove: (v) => vt(r.id, v)
|
|
3501
3518
|
}
|
|
3502
3519
|
) }),
|
|
3503
3520
|
/* @__PURE__ */ e(
|
|
@@ -3506,18 +3523,18 @@ function Wl({
|
|
|
3506
3523
|
reportId: t,
|
|
3507
3524
|
widget: r,
|
|
3508
3525
|
dateRange: Le,
|
|
3509
|
-
entityFilters:
|
|
3526
|
+
entityFilters: Y,
|
|
3510
3527
|
refetchInterval: c,
|
|
3511
3528
|
filterBar: l,
|
|
3512
|
-
onDrill:
|
|
3513
|
-
snapshot: _ && _.data[r.id] !== void 0 ? { name: _.name, value: ((
|
|
3529
|
+
onDrill: U,
|
|
3530
|
+
snapshot: _ && _.data[r.id] !== void 0 ? { name: _.name, value: ((b = _.data[r.id]) == null ? void 0 : b.value) ?? null } : null,
|
|
3514
3531
|
asOf: ne,
|
|
3515
|
-
annotations: me.filter((
|
|
3516
|
-
onAddAnnotation: (
|
|
3517
|
-
onDeleteAnnotation: (
|
|
3532
|
+
annotations: me.filter((v) => v.widget === r.id),
|
|
3533
|
+
onAddAnnotation: (v, d, y) => we.mutate({ widget: v, note: d, anchor_date: y }),
|
|
3534
|
+
onDeleteAnnotation: (v) => Te.mutate(v),
|
|
3518
3535
|
onCrossFilter: Xe,
|
|
3519
3536
|
reportUrl: f,
|
|
3520
|
-
currentFilters:
|
|
3537
|
+
currentFilters: Y
|
|
3521
3538
|
}
|
|
3522
3539
|
)
|
|
3523
3540
|
] })
|
|
@@ -3550,12 +3567,14 @@ function Wl({
|
|
|
3550
3567
|
onClose: () => q.back(w.length)
|
|
3551
3568
|
}
|
|
3552
3569
|
) : null
|
|
3553
|
-
] })
|
|
3570
|
+
] });
|
|
3554
3571
|
}
|
|
3555
3572
|
export {
|
|
3556
3573
|
hl as AlertBell,
|
|
3557
3574
|
dl as QueryWidgetBody,
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3575
|
+
Ql as ReportView,
|
|
3576
|
+
Bl as ReportWidgetCard,
|
|
3577
|
+
vl as adminAccessScopeNote,
|
|
3578
|
+
oa as shapeQueryRows,
|
|
3579
|
+
gl as shortCategoryLabel
|
|
3561
3580
|
};
|