@nivaro/react 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fields/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +103 -4
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1632 -1564
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +4386 -4142
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +527 -479
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1026 -957
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -9,17 +9,18 @@ import { useLiveWidget as Ma, liveWidgetInterval as Fa } from "../lib/live-widge
|
|
|
9
9
|
import { serverErrorText as Gt, loadErrorText as Ht } from "../lib/load-error.js";
|
|
10
10
|
import { buildReportTree as Aa } from "../lib/report-tree.js";
|
|
11
11
|
import { useMyScopes as Ra, matchScopeDimension as Ta, translateScopeValues as Dt, effectiveScopeSeedIds as La } from "../lib/use-my-scopes.js";
|
|
12
|
+
import { uniqueByValue as Oa } from "../lib/unique-options.js";
|
|
12
13
|
import { cn as Y } from "../lib/utils.js";
|
|
13
14
|
import { BackgroundRunOffer as Xt } from "./BackgroundRunOffer.js";
|
|
14
15
|
import { RechartsGate as Re } from "./charts/RechartsGate.js";
|
|
15
16
|
import { LoadErrorNote as Zt } from "./LoadErrorNote.js";
|
|
16
|
-
import { RecordDrilldownSheet as
|
|
17
|
-
import { TipLayer as
|
|
18
|
-
import { Command as
|
|
17
|
+
import { RecordDrilldownSheet as Da } from "./RecordDrilldownSheet.js";
|
|
18
|
+
import { TipLayer as Ka } from "./TipLayer.js";
|
|
19
|
+
import { Command as Pa, CommandInput as za, CommandList as ja, CommandEmpty as Ea, CommandItem as Wa } from "./ui/command.js";
|
|
19
20
|
import { Popover as It, PopoverTrigger as ea, PopoverContent as ta } from "./ui/popover.js";
|
|
20
21
|
import { Skeleton as Te } from "./ui/skeleton.js";
|
|
21
22
|
import { SimpleSelect as kt } from "./ui/SimpleSelect.js";
|
|
22
|
-
async function
|
|
23
|
+
async function Ba(t, i) {
|
|
23
24
|
const a = t == null ? void 0 : t.querySelector("svg");
|
|
24
25
|
if (!(!a || typeof ClipboardItem > "u"))
|
|
25
26
|
try {
|
|
@@ -39,7 +40,7 @@ async function Wa(t, i) {
|
|
|
39
40
|
} catch {
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t),
|
|
43
|
+
const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "")}B` : Math.abs(t) >= 1e6 ? `${(t / 1e6).toFixed(1).replace(/\.0$/, "")}M` : Math.abs(t) >= 1e3 ? `${(t / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(t), Qa = [
|
|
43
44
|
"Jan",
|
|
44
45
|
"Feb",
|
|
45
46
|
"Mar",
|
|
@@ -52,18 +53,18 @@ const Ce = (t) => Math.abs(t) >= 1e9 ? `${(t / 1e9).toFixed(1).replace(/\.0$/, "
|
|
|
52
53
|
"Oct",
|
|
53
54
|
"Nov",
|
|
54
55
|
"Dec"
|
|
55
|
-
],
|
|
56
|
+
], Ua = (t) => {
|
|
56
57
|
const i = String(t ?? ""), a = /^(\d{4})-(\d{2})(?:-(\d{2}))?/.exec(i);
|
|
57
58
|
if (a) {
|
|
58
|
-
const o =
|
|
59
|
+
const o = Qa[Number(a[2]) - 1] ?? a[2];
|
|
59
60
|
return a[3] ? `${o} ${Number(a[3])}` : `${o} '${a[1].slice(2)}`;
|
|
60
61
|
}
|
|
61
62
|
return i.length > 16 ? `${i.slice(0, 15)}…` : i;
|
|
62
63
|
}, _t = (t) => ({
|
|
63
64
|
interval: t > 12 ? Math.ceil(t / 12) - 1 : 0,
|
|
64
|
-
tickFormatter:
|
|
65
|
+
tickFormatter: Ua,
|
|
65
66
|
minTickGap: 4
|
|
66
|
-
}), Tt = () => import("./ReportEditMode.js"),
|
|
67
|
+
}), Tt = () => import("./ReportEditMode.js"), Ya = Rt(() => Tt().then((t) => ({ default: t.AddWidgetBar }))), Ja = Rt(() => Tt().then((t) => ({ default: t.WidgetConfigSheet }))), Va = Rt(() => Tt().then((t) => ({ default: t.WidgetEditBar }))), Ve = "rgb(var(--nvr-cyan-rgb, 0 206 255))", ce = [Ve, "#172940", "#10b981", "#f59e0b", "#8b5cf6", "#ef4444", "#64748b"], Ga = [
|
|
67
68
|
{ id: "", label: "All time" },
|
|
68
69
|
{ id: "this_month", label: "This month" },
|
|
69
70
|
{ id: "last_30_days", label: "Last 30 days" },
|
|
@@ -111,17 +112,20 @@ function aa({
|
|
|
111
112
|
queryKey: ["nivaro-report-filter-opts", t, i, o ?? null],
|
|
112
113
|
queryFn: async () => {
|
|
113
114
|
if (o) {
|
|
114
|
-
const m = o.value_field ?? "id", S = o.label_field ?? m
|
|
115
|
-
return ((await b.request(
|
|
115
|
+
const m = o.value_field ?? "id", S = o.label_field ?? m, G = await b.request(
|
|
116
116
|
ca(o.collection, {
|
|
117
117
|
fields: [.../* @__PURE__ */ new Set(["id", m, S])],
|
|
118
118
|
sort: o.sort ? [o.sort] : void 0,
|
|
119
119
|
limit: 200
|
|
120
120
|
})
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
);
|
|
122
|
+
return Oa(
|
|
123
|
+
(G.data ?? []).map((z) => ({
|
|
124
|
+
value: String(z[m] ?? z.id),
|
|
125
|
+
label: String(z[S] ?? z[m] ?? z.id)
|
|
126
|
+
})),
|
|
127
|
+
(z) => z.value
|
|
128
|
+
);
|
|
125
129
|
}
|
|
126
130
|
return b.request(ma(t, i)).then((m) => m.data);
|
|
127
131
|
},
|
|
@@ -144,22 +148,22 @@ function aa({
|
|
|
144
148
|
]
|
|
145
149
|
}
|
|
146
150
|
) }),
|
|
147
|
-
/* @__PURE__ */ e(ta, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ s(
|
|
148
|
-
/* @__PURE__ */ e(
|
|
149
|
-
/* @__PURE__ */ s(
|
|
150
|
-
/* @__PURE__ */ e(
|
|
151
|
+
/* @__PURE__ */ e(ta, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ s(Pa, { children: [
|
|
152
|
+
/* @__PURE__ */ e(za, { placeholder: `Filter ${a}…`, className: "h-8 text-[12.5px]" }),
|
|
153
|
+
/* @__PURE__ */ s(ja, { className: "max-h-52", children: [
|
|
154
|
+
/* @__PURE__ */ e(Ea, { children: "No values." }),
|
|
151
155
|
w.map((m) => {
|
|
152
|
-
const S = c.some((
|
|
156
|
+
const S = c.some((G) => String(G) === m.value);
|
|
153
157
|
return /* @__PURE__ */ s(
|
|
154
|
-
|
|
158
|
+
Wa,
|
|
155
159
|
{
|
|
156
160
|
value: m.label,
|
|
157
161
|
onSelect: () => {
|
|
158
|
-
const
|
|
162
|
+
const G = S ? c.filter((I) => String(I) !== m.value) : [...c, m.value], z = (I) => {
|
|
159
163
|
var ee;
|
|
160
164
|
return ((ee = $.find((ue) => ue.value === String(I))) == null ? void 0 : ee.label) ?? String(I);
|
|
161
165
|
};
|
|
162
|
-
u(
|
|
166
|
+
u(G, G.map(z));
|
|
163
167
|
},
|
|
164
168
|
className: "text-[12.5px]",
|
|
165
169
|
children: [
|
|
@@ -222,7 +226,7 @@ const ze = /* @__PURE__ */ new Set([
|
|
|
222
226
|
"percent",
|
|
223
227
|
"days"
|
|
224
228
|
]);
|
|
225
|
-
function
|
|
229
|
+
function Ha(t, i, a) {
|
|
226
230
|
const o = {}, c = la(i);
|
|
227
231
|
for (const [u, g] of Object.entries(t.params ?? {})) {
|
|
228
232
|
if (g === "$date.start") {
|
|
@@ -243,12 +247,12 @@ function Ga(t, i, a) {
|
|
|
243
247
|
}
|
|
244
248
|
return o;
|
|
245
249
|
}
|
|
246
|
-
const
|
|
250
|
+
const Xa = (t) => `$${Ce(Math.round(t))}`, Za = [
|
|
247
251
|
{ gte: 90, color: "#ef4444" },
|
|
248
252
|
{ gte: 70, color: "#f59e0b" },
|
|
249
253
|
{ gte: -1 / 0, color: "#10b981" }
|
|
250
254
|
];
|
|
251
|
-
function
|
|
255
|
+
function Ia({
|
|
252
256
|
rows: t,
|
|
253
257
|
cfg: i,
|
|
254
258
|
onDrill: a
|
|
@@ -267,17 +271,17 @@ function Za({
|
|
|
267
271
|
), [g, b] = C(() => /* @__PURE__ */ new Set()), [p, K] = C(!1);
|
|
268
272
|
wt(() => {
|
|
269
273
|
if (p || u.length === 0) return;
|
|
270
|
-
const m = /* @__PURE__ */ new Set(), S = (
|
|
271
|
-
for (const
|
|
272
|
-
(
|
|
274
|
+
const m = /* @__PURE__ */ new Set(), S = (G) => {
|
|
275
|
+
for (const z of G)
|
|
276
|
+
(z.depth > 0 || u.length === 1) && m.add(z.key), S(z.children);
|
|
273
277
|
};
|
|
274
278
|
S(u), b(m), K(!0);
|
|
275
279
|
}, [u, p]);
|
|
276
|
-
const $ = (o == null ? void 0 : o.thresholds) ??
|
|
280
|
+
const $ = (o == null ? void 0 : o.thresholds) ?? Za, w = (m) => {
|
|
277
281
|
var S;
|
|
278
|
-
return m == null ? void 0 : ((S = $.find((
|
|
282
|
+
return m == null ? void 0 : ((S = $.find((G) => m >= G.gte)) == null ? void 0 : S.color) ?? "#10b981";
|
|
279
283
|
}, _ = (m) => {
|
|
280
|
-
const S = m.children.length === 0,
|
|
284
|
+
const S = m.children.length === 0, G = g.has(m.key), z = w(m.pct), I = S && (o == null ? void 0 : o.drill) && m.drillId != null;
|
|
281
285
|
return /* @__PURE__ */ s("div", { style: { paddingLeft: m.depth === 0 ? 0 : 14 }, children: [
|
|
282
286
|
/* @__PURE__ */ s(
|
|
283
287
|
"div",
|
|
@@ -308,7 +312,7 @@ function Za({
|
|
|
308
312
|
{
|
|
309
313
|
className: Y(
|
|
310
314
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
311
|
-
|
|
315
|
+
G && "rotate-180"
|
|
312
316
|
)
|
|
313
317
|
}
|
|
314
318
|
),
|
|
@@ -330,7 +334,7 @@ function Za({
|
|
|
330
334
|
"span",
|
|
331
335
|
{
|
|
332
336
|
className: "shrink-0 text-[10.5px] font-semibold tabular-nums",
|
|
333
|
-
style: { color:
|
|
337
|
+
style: { color: z },
|
|
334
338
|
children: [
|
|
335
339
|
m.pct.toFixed(1),
|
|
336
340
|
"%"
|
|
@@ -349,7 +353,7 @@ function Za({
|
|
|
349
353
|
"div",
|
|
350
354
|
{
|
|
351
355
|
className: "h-full rounded-full transition-[width] duration-300",
|
|
352
|
-
style: { width: `${Math.min(Math.max(m.pct, 0), 100)}%`, background:
|
|
356
|
+
style: { width: `${Math.min(Math.max(m.pct, 0), 100)}%`, background: z }
|
|
353
357
|
}
|
|
354
358
|
)
|
|
355
359
|
}
|
|
@@ -357,17 +361,17 @@ function Za({
|
|
|
357
361
|
/* @__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((ee) => /* @__PURE__ */ s("span", { children: [
|
|
358
362
|
(ee.label ?? ee.field).slice(0, 14),
|
|
359
363
|
" ",
|
|
360
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: m.sums[ee.field] == null ? "—" : i.value_format === "currency" ?
|
|
364
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-500 dark:text-slate-300", children: m.sums[ee.field] == null ? "—" : i.value_format === "currency" ? Xa(m.sums[ee.field]) : m.sums[ee.field].toLocaleString() })
|
|
361
365
|
] }, ee.field)) })
|
|
362
366
|
]
|
|
363
367
|
}
|
|
364
368
|
),
|
|
365
|
-
|
|
369
|
+
G && m.children.map(_)
|
|
366
370
|
] }, m.key);
|
|
367
371
|
};
|
|
368
372
|
return !o || u.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: u.map(_) });
|
|
369
373
|
}
|
|
370
|
-
function
|
|
374
|
+
function el(t) {
|
|
371
375
|
const i = Le(), a = St(!1);
|
|
372
376
|
return async (o) => {
|
|
373
377
|
if (!(!t || a.current)) {
|
|
@@ -382,7 +386,7 @@ function Ia(t) {
|
|
|
382
386
|
}
|
|
383
387
|
};
|
|
384
388
|
}
|
|
385
|
-
function
|
|
389
|
+
function tl({
|
|
386
390
|
cfg: t,
|
|
387
391
|
dateRange: i,
|
|
388
392
|
entityFilters: a,
|
|
@@ -391,7 +395,7 @@ function el({
|
|
|
391
395
|
onDrill: u
|
|
392
396
|
}) {
|
|
393
397
|
var pe, ne;
|
|
394
|
-
const g = Le(), b =
|
|
398
|
+
const g = Le(), b = el(u), [p, K] = C(""), [$, w] = C(0), [_, m] = C(null), S = Ha(t, i, a), { data: G, isLoading: z, error: I, isFetching: ee, refetch: ue } = ke({
|
|
395
399
|
queryKey: ["nivaro-report-query", t.slug, S],
|
|
396
400
|
queryFn: () => g.request(sa(t.slug, S)).then((f) => f.data ?? []),
|
|
397
401
|
staleTime: 6e4,
|
|
@@ -400,7 +404,7 @@ function el({
|
|
|
400
404
|
});
|
|
401
405
|
if (wt(() => {
|
|
402
406
|
c == null || c({ isFetching: ee, refetch: () => void ue() });
|
|
403
|
-
}, [ee]),
|
|
407
|
+
}, [ee]), z)
|
|
404
408
|
return /* @__PURE__ */ s("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
405
409
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
406
410
|
/* @__PURE__ */ e(
|
|
@@ -427,36 +431,36 @@ function el({
|
|
|
427
431
|
onRetry: () => void ue()
|
|
428
432
|
}
|
|
429
433
|
);
|
|
430
|
-
let
|
|
434
|
+
let j = G ?? [];
|
|
431
435
|
if (t.group_rows && t.x_field) {
|
|
432
436
|
const f = /* @__PURE__ */ new Map(), q = new Set(
|
|
433
|
-
(t.series ?? []).map((D) => D.field).length > 0 ? (t.series ?? []).map((D) => D.field) : Object.keys(
|
|
437
|
+
(t.series ?? []).map((D) => D.field).length > 0 ? (t.series ?? []).map((D) => D.field) : Object.keys(j[0] ?? {}).filter((D) => {
|
|
434
438
|
var M;
|
|
435
|
-
return typeof ((M =
|
|
439
|
+
return typeof ((M = j[0]) == null ? void 0 : M[D]) == "number";
|
|
436
440
|
})
|
|
437
441
|
);
|
|
438
|
-
for (const D of
|
|
439
|
-
const M = String(D[t.x_field] ?? "Unknown"),
|
|
440
|
-
for (const
|
|
441
|
-
f.set(M,
|
|
442
|
+
for (const D of j) {
|
|
443
|
+
const M = String(D[t.x_field] ?? "Unknown"), H = f.get(M) ?? { [t.x_field]: M };
|
|
444
|
+
for (const X of q) H[X] = (Number(H[X]) || 0) + (Number(D[X]) || 0);
|
|
445
|
+
f.set(M, H);
|
|
442
446
|
}
|
|
443
|
-
|
|
447
|
+
j = [...f.values()];
|
|
444
448
|
}
|
|
445
449
|
if (t.sort) {
|
|
446
450
|
const f = t.sort.startsWith("-"), q = f ? t.sort.slice(1) : t.sort;
|
|
447
|
-
|
|
448
|
-
const
|
|
451
|
+
j = [...j].sort((D, M) => {
|
|
452
|
+
const H = D[q], X = M[q], me = typeof H == "number" && typeof X == "number" ? H - X : String(H ?? "").localeCompare(String(X ?? ""));
|
|
449
453
|
return f ? -me : me;
|
|
450
454
|
});
|
|
451
455
|
}
|
|
452
|
-
if (t.limit && t.limit > 0 && (
|
|
453
|
-
const le = t.columns && t.columns.length > 0 ? t.columns : Object.keys(
|
|
456
|
+
if (t.limit && t.limit > 0 && (j = j.slice(0, t.limit)), j.length === 0) return /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
457
|
+
const le = t.columns && t.columns.length > 0 ? t.columns : Object.keys(j[0] ?? {}).map((f) => ({ field: f }));
|
|
454
458
|
if (t.display === "kpis") {
|
|
455
|
-
const f = t.x_field ?
|
|
456
|
-
var M,
|
|
459
|
+
const f = t.x_field ? j.map((q, D) => {
|
|
460
|
+
var M, H, X, me, F;
|
|
457
461
|
return {
|
|
458
462
|
label: String(q[t.x_field] ?? ""),
|
|
459
|
-
value: q[((
|
|
463
|
+
value: q[((H = (M = t.series) == null ? void 0 : M[0]) == null ? void 0 : H.field) ?? ((X = le.find((E) => E.field !== t.x_field)) == null ? void 0 : X.field) ?? ""],
|
|
460
464
|
color: ((F = (me = t.series) == null ? void 0 : me[0]) == null ? void 0 : F.color) ?? ce[D % ce.length],
|
|
461
465
|
format: t.value_format
|
|
462
466
|
};
|
|
@@ -464,7 +468,7 @@ function el({
|
|
|
464
468
|
var M;
|
|
465
469
|
return {
|
|
466
470
|
label: q.label ?? q.field,
|
|
467
|
-
value: (M =
|
|
471
|
+
value: (M = j[0]) == null ? void 0 : M[q.field],
|
|
468
472
|
color: ce[D % ce.length],
|
|
469
473
|
format: q.format ?? t.value_format
|
|
470
474
|
};
|
|
@@ -490,15 +494,15 @@ function el({
|
|
|
490
494
|
);
|
|
491
495
|
}
|
|
492
496
|
if (t.display === "tree")
|
|
493
|
-
return /* @__PURE__ */ e(
|
|
497
|
+
return /* @__PURE__ */ e(Ia, { rows: j, cfg: t, onDrill: (f) => u == null ? void 0 : u(f) });
|
|
494
498
|
if (t.display === "table") {
|
|
495
|
-
const f = le.filter((F) => ze.has(F.format ?? "")), q = p.trim().toLowerCase(), D = q ?
|
|
499
|
+
const f = le.filter((F) => ze.has(F.format ?? "")), q = p.trim().toLowerCase(), D = q ? j.filter(
|
|
496
500
|
(F) => Object.values(F).some(
|
|
497
|
-
(
|
|
501
|
+
(E) => String(E ?? "").toLowerCase().includes(q)
|
|
498
502
|
)
|
|
499
|
-
) :
|
|
503
|
+
) : j, M = 12, H = Math.max(1, Math.ceil(D.length / M)), X = Math.min($, H - 1), me = D.length > M ? D.slice(X * M, X * M + M) : D;
|
|
500
504
|
return /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
501
|
-
|
|
505
|
+
j.length > M && /* @__PURE__ */ s("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
502
506
|
/* @__PURE__ */ e(
|
|
503
507
|
"input",
|
|
504
508
|
{
|
|
@@ -510,26 +514,26 @@ function el({
|
|
|
510
514
|
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"
|
|
511
515
|
}
|
|
512
516
|
),
|
|
513
|
-
|
|
517
|
+
H > 1 && /* @__PURE__ */ s("span", { className: "ml-auto flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
514
518
|
/* @__PURE__ */ e(
|
|
515
519
|
"button",
|
|
516
520
|
{
|
|
517
521
|
type: "button",
|
|
518
|
-
disabled:
|
|
519
|
-
onClick: () => w(
|
|
522
|
+
disabled: X <= 0,
|
|
523
|
+
onClick: () => w(X - 1),
|
|
520
524
|
className: "rounded px-1 disabled:opacity-30",
|
|
521
525
|
children: "←"
|
|
522
526
|
}
|
|
523
527
|
),
|
|
524
|
-
|
|
528
|
+
X + 1,
|
|
525
529
|
"/",
|
|
526
|
-
|
|
530
|
+
H,
|
|
527
531
|
/* @__PURE__ */ e(
|
|
528
532
|
"button",
|
|
529
533
|
{
|
|
530
534
|
type: "button",
|
|
531
|
-
disabled:
|
|
532
|
-
onClick: () => w(
|
|
535
|
+
disabled: X >= H - 1,
|
|
536
|
+
onClick: () => w(X + 1),
|
|
533
537
|
className: "rounded px-1 disabled:opacity-30",
|
|
534
538
|
children: "→"
|
|
535
539
|
}
|
|
@@ -548,7 +552,7 @@ function el({
|
|
|
548
552
|
},
|
|
549
553
|
F.field
|
|
550
554
|
)) }) }),
|
|
551
|
-
/* @__PURE__ */ e("tbody", { children: me.map((F,
|
|
555
|
+
/* @__PURE__ */ e("tbody", { children: me.map((F, E) => /* @__PURE__ */ e(
|
|
552
556
|
"tr",
|
|
553
557
|
{
|
|
554
558
|
className: u ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60" : void 0,
|
|
@@ -566,17 +570,17 @@ function el({
|
|
|
566
570
|
de.field
|
|
567
571
|
))
|
|
568
572
|
},
|
|
569
|
-
|
|
573
|
+
E
|
|
570
574
|
)) }),
|
|
571
|
-
t.totals && f.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: le.map((F,
|
|
575
|
+
t.totals && f.length > 0 && /* @__PURE__ */ e("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: le.map((F, E) => /* @__PURE__ */ e(
|
|
572
576
|
"td",
|
|
573
577
|
{
|
|
574
578
|
className: Y(
|
|
575
579
|
"border-t border-slate-200 px-1.5 py-1 font-semibold text-slate-800 dark:border-border dark:text-slate-200",
|
|
576
580
|
ze.has(F.format ?? "") && "text-right tabular-nums"
|
|
577
581
|
),
|
|
578
|
-
children:
|
|
579
|
-
|
|
582
|
+
children: E === 0 && !ze.has(F.format ?? "") ? "Total" : ze.has(F.format ?? "") ? je(
|
|
583
|
+
j.reduce((de, ge) => de + (Number(ge[F.field]) || 0), 0),
|
|
580
584
|
F.format,
|
|
581
585
|
F.decimals
|
|
582
586
|
) : ""
|
|
@@ -588,14 +592,14 @@ function el({
|
|
|
588
592
|
}
|
|
589
593
|
const oe = t.x_field ?? ((pe = le[0]) == null ? void 0 : pe.field) ?? "", fe = t.series && t.series.length > 0 ? t.series : le.filter((f) => {
|
|
590
594
|
var q;
|
|
591
|
-
return f.field !== oe && typeof ((q =
|
|
592
|
-
}).slice(0, 3).map((f) => ({ field: f.field, label: f.label ?? f.field })), be =
|
|
595
|
+
return f.field !== oe && typeof ((q = j[0]) == null ? void 0 : q[f.field]) == "number";
|
|
596
|
+
}).slice(0, 3).map((f) => ({ field: f.field, label: f.label ?? f.field })), be = j.map((f) => {
|
|
593
597
|
const q = { [oe]: f[oe] };
|
|
594
598
|
for (const D of fe) q[D.field] = Number(f[D.field]) || 0;
|
|
595
599
|
return q;
|
|
596
600
|
}), Se = (f) => t.value_format === "currency" ? `$${Ce(f)}` : Ce(f), _e = (f) => je(f, t.value_format ?? "number"), h = t.display === "hbar" || t.display === "stacked_bar" && t.horizontal, te = (f) => {
|
|
597
601
|
if (!u) return;
|
|
598
|
-
const q = (
|
|
602
|
+
const q = (G ?? []).filter((D) => String(D[oe] ?? "") === f);
|
|
599
603
|
q.length > 0 && m({ label: f, rows: q });
|
|
600
604
|
}, re = _ ? /* @__PURE__ */ e(
|
|
601
605
|
"div",
|
|
@@ -658,62 +662,56 @@ function el({
|
|
|
658
662
|
}
|
|
659
663
|
) : null;
|
|
660
664
|
if (t.display === "donut") {
|
|
661
|
-
const f = ((ne = fe[0]) == null ? void 0 : ne.field) ?? "", q = be.map((M) => ({ dim: String(M[oe]), value: Number(M[f]) || 0 })), D = q.reduce((M,
|
|
665
|
+
const f = ((ne = fe[0]) == null ? void 0 : ne.field) ?? "", q = be.map((M) => ({ dim: String(M[oe]), value: Number(M[f]) || 0 })), D = q.reduce((M, H) => M + H.value, 0);
|
|
662
666
|
return /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
663
667
|
/* @__PURE__ */ s("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
664
|
-
/* @__PURE__ */ e(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
formatter: (j) => _e(j)
|
|
701
|
-
}
|
|
702
|
-
)
|
|
703
|
-
] }) })
|
|
704
|
-
}
|
|
705
|
-
),
|
|
668
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: M, Pie: H, PieChart: X, ResponsiveContainer: me, Tooltip: F }) => /* @__PURE__ */ e(me, { width: "100%", height: "100%", children: /* @__PURE__ */ s(X, { children: [
|
|
669
|
+
/* @__PURE__ */ e(
|
|
670
|
+
H,
|
|
671
|
+
{
|
|
672
|
+
data: q,
|
|
673
|
+
dataKey: "value",
|
|
674
|
+
nameKey: "dim",
|
|
675
|
+
innerRadius: "58%",
|
|
676
|
+
outerRadius: "88%",
|
|
677
|
+
paddingAngle: 2,
|
|
678
|
+
strokeWidth: 0,
|
|
679
|
+
className: u ? "cursor-pointer" : void 0,
|
|
680
|
+
onClick: (E) => {
|
|
681
|
+
var ge;
|
|
682
|
+
const de = (ge = E == null ? void 0 : E.payload) == null ? void 0 : ge.dim;
|
|
683
|
+
de && te(String(de));
|
|
684
|
+
},
|
|
685
|
+
children: q.map((E, de) => /* @__PURE__ */ e(M, { fill: ce[de % ce.length] }, E.dim))
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
/* @__PURE__ */ e(
|
|
689
|
+
F,
|
|
690
|
+
{
|
|
691
|
+
contentStyle: {
|
|
692
|
+
fontSize: 12,
|
|
693
|
+
backgroundColor: "#0f172a",
|
|
694
|
+
border: "1px solid #334155",
|
|
695
|
+
borderRadius: 8,
|
|
696
|
+
color: "#f1f5f9"
|
|
697
|
+
},
|
|
698
|
+
labelStyle: { color: "#f1f5f9" },
|
|
699
|
+
itemStyle: { color: "#e2e8f0" },
|
|
700
|
+
formatter: (E) => _e(E)
|
|
701
|
+
}
|
|
702
|
+
)
|
|
703
|
+
] }) }) }),
|
|
706
704
|
/* @__PURE__ */ s("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
707
705
|
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: je(D, t.value_format ?? "integer") }),
|
|
708
706
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
709
707
|
] })
|
|
710
708
|
] }),
|
|
711
|
-
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: q.slice(0, 12).map((M,
|
|
709
|
+
/* @__PURE__ */ e("div", { className: "max-h-full w-[40%] shrink-0 space-y-0.5 self-center overflow-y-auto pr-1", children: q.slice(0, 12).map((M, H) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 text-[10.5px]", children: [
|
|
712
710
|
/* @__PURE__ */ e(
|
|
713
711
|
"span",
|
|
714
712
|
{
|
|
715
713
|
className: "h-2 w-2 shrink-0 rounded-sm",
|
|
716
|
-
style: { background: ce[
|
|
714
|
+
style: { background: ce[H % ce.length] }
|
|
717
715
|
}
|
|
718
716
|
),
|
|
719
717
|
/* @__PURE__ */ e("span", { className: "truncate text-slate-600 dark:text-slate-300", children: M.dim }),
|
|
@@ -724,137 +722,133 @@ function el({
|
|
|
724
722
|
}
|
|
725
723
|
if (t.display === "line" || t.display === "area")
|
|
726
724
|
return /* @__PURE__ */ s("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
727
|
-
/* @__PURE__ */ e(
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
725
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Area: f, AreaChart: q, Legend: D, ResponsiveContainer: M, Tooltip: H, XAxis: X, YAxis: me }) => /* @__PURE__ */ e(M, { width: "100%", height: "100%", children: /* @__PURE__ */ s(q, { data: be, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
726
|
+
/* @__PURE__ */ e(
|
|
727
|
+
X,
|
|
728
|
+
{
|
|
729
|
+
dataKey: oe,
|
|
730
|
+
tick: { fontSize: 10 },
|
|
731
|
+
stroke: "#94a3b8",
|
|
732
|
+
..._t(be.length)
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
/* @__PURE__ */ e(me, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: Se, width: 48 }),
|
|
736
|
+
/* @__PURE__ */ e(
|
|
737
|
+
H,
|
|
738
|
+
{
|
|
739
|
+
contentStyle: {
|
|
740
|
+
fontSize: 12,
|
|
741
|
+
backgroundColor: "#0f172a",
|
|
742
|
+
border: "1px solid #334155",
|
|
743
|
+
borderRadius: 8,
|
|
744
|
+
color: "#f1f5f9"
|
|
745
|
+
},
|
|
746
|
+
labelStyle: { color: "#f1f5f9" },
|
|
747
|
+
itemStyle: { color: "#e2e8f0" },
|
|
748
|
+
formatter: (F) => _e(F)
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
fe.length > 1 && /* @__PURE__ */ e(D, { wrapperStyle: { fontSize: 11 } }),
|
|
752
|
+
fe.map((F, E) => /* @__PURE__ */ e(
|
|
753
|
+
f,
|
|
754
|
+
{
|
|
755
|
+
type: "monotone",
|
|
756
|
+
dataKey: F.field,
|
|
757
|
+
name: F.label ?? F.field,
|
|
758
|
+
stroke: F.color ?? ce[E % ce.length],
|
|
759
|
+
strokeWidth: 2,
|
|
760
|
+
strokeDasharray: F.dash ? "4 3" : void 0,
|
|
761
|
+
fill: F.color ?? ce[E % ce.length],
|
|
762
|
+
fillOpacity: t.display === "area" && !F.dash ? 0.12 : 0
|
|
763
|
+
},
|
|
764
|
+
F.field
|
|
765
|
+
))
|
|
766
|
+
] }) }) }),
|
|
767
|
+
re
|
|
768
|
+
] });
|
|
769
|
+
const V = t.display === "stacked_bar";
|
|
770
|
+
return /* @__PURE__ */ s("div", { className: "min-h-[110px] min-w-0 flex-1", children: [
|
|
771
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: f, BarChart: q, Cell: D, Legend: M, ResponsiveContainer: H, Tooltip: X, XAxis: me, YAxis: F }) => /* @__PURE__ */ e(H, { width: "100%", height: "100%", children: /* @__PURE__ */ s(
|
|
772
|
+
q,
|
|
773
|
+
{
|
|
774
|
+
data: be,
|
|
775
|
+
layout: h ? "vertical" : "horizontal",
|
|
776
|
+
margin: { top: 6, right: 8, left: h ? 30 : -6, bottom: 0 },
|
|
777
|
+
children: [
|
|
778
|
+
h ? /* @__PURE__ */ s(Ge, { children: [
|
|
732
779
|
/* @__PURE__ */ e(
|
|
733
|
-
|
|
780
|
+
me,
|
|
734
781
|
{
|
|
735
|
-
|
|
782
|
+
type: "number",
|
|
736
783
|
tick: { fontSize: 10 },
|
|
737
784
|
stroke: "#94a3b8",
|
|
738
|
-
|
|
785
|
+
tickFormatter: Se
|
|
739
786
|
}
|
|
740
787
|
),
|
|
741
|
-
/* @__PURE__ */ e(me, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: Se, width: 48 }),
|
|
742
788
|
/* @__PURE__ */ e(
|
|
743
|
-
|
|
789
|
+
F,
|
|
744
790
|
{
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
color: "#f1f5f9"
|
|
751
|
-
},
|
|
752
|
-
labelStyle: { color: "#f1f5f9" },
|
|
753
|
-
itemStyle: { color: "#e2e8f0" },
|
|
754
|
-
formatter: (F) => _e(F)
|
|
791
|
+
type: "category",
|
|
792
|
+
dataKey: oe,
|
|
793
|
+
tick: { fontSize: 10 },
|
|
794
|
+
stroke: "#94a3b8",
|
|
795
|
+
width: 120
|
|
755
796
|
}
|
|
756
|
-
)
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
797
|
+
)
|
|
798
|
+
] }) : /* @__PURE__ */ s(Ge, { children: [
|
|
799
|
+
/* @__PURE__ */ e(
|
|
800
|
+
me,
|
|
760
801
|
{
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
802
|
+
dataKey: oe,
|
|
803
|
+
tick: { fontSize: 10 },
|
|
804
|
+
stroke: "#94a3b8",
|
|
805
|
+
..._t(be.length)
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
/* @__PURE__ */ e(F, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: Se, width: 48 })
|
|
809
|
+
] }),
|
|
810
|
+
/* @__PURE__ */ e(
|
|
811
|
+
X,
|
|
812
|
+
{
|
|
813
|
+
contentStyle: {
|
|
814
|
+
fontSize: 12,
|
|
815
|
+
backgroundColor: "#0f172a",
|
|
816
|
+
border: "1px solid #334155",
|
|
817
|
+
borderRadius: 8,
|
|
818
|
+
color: "#f1f5f9"
|
|
769
819
|
},
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
type: "category",
|
|
796
|
-
dataKey: oe,
|
|
797
|
-
tick: { fontSize: 10 },
|
|
798
|
-
stroke: "#94a3b8",
|
|
799
|
-
width: 120
|
|
800
|
-
}
|
|
801
|
-
)
|
|
802
|
-
] }) : /* @__PURE__ */ s(Ge, { children: [
|
|
803
|
-
/* @__PURE__ */ e(
|
|
804
|
-
me,
|
|
805
|
-
{
|
|
806
|
-
dataKey: oe,
|
|
807
|
-
tick: { fontSize: 10 },
|
|
808
|
-
stroke: "#94a3b8",
|
|
809
|
-
..._t(be.length)
|
|
810
|
-
}
|
|
811
|
-
),
|
|
812
|
-
/* @__PURE__ */ e(F, { tick: { fontSize: 10 }, stroke: "#94a3b8", tickFormatter: Se, width: 48 })
|
|
813
|
-
] }),
|
|
814
|
-
/* @__PURE__ */ e(
|
|
815
|
-
H,
|
|
816
|
-
{
|
|
817
|
-
contentStyle: {
|
|
818
|
-
fontSize: 12,
|
|
819
|
-
backgroundColor: "#0f172a",
|
|
820
|
-
border: "1px solid #334155",
|
|
821
|
-
borderRadius: 8,
|
|
822
|
-
color: "#f1f5f9"
|
|
823
|
-
},
|
|
824
|
-
labelStyle: { color: "#f1f5f9" },
|
|
825
|
-
itemStyle: { color: "#e2e8f0" },
|
|
826
|
-
formatter: (j) => _e(j)
|
|
827
|
-
}
|
|
828
|
-
),
|
|
829
|
-
fe.length > 1 && /* @__PURE__ */ e(M, { wrapperStyle: { fontSize: 11 } }),
|
|
830
|
-
fe.map((j, de) => /* @__PURE__ */ e(
|
|
831
|
-
f,
|
|
832
|
-
{
|
|
833
|
-
className: u ? "cursor-pointer" : void 0,
|
|
834
|
-
onClick: (ge) => {
|
|
835
|
-
var Oe;
|
|
836
|
-
const ve = (Oe = ge == null ? void 0 : ge.payload) == null ? void 0 : Oe[oe];
|
|
837
|
-
ve != null && te(String(ve));
|
|
838
|
-
},
|
|
839
|
-
dataKey: j.field,
|
|
840
|
-
name: j.label ?? j.field,
|
|
841
|
-
stackId: V ? "stack" : void 0,
|
|
842
|
-
fill: j.color ?? ce[de % ce.length],
|
|
843
|
-
radius: V ? 0 : h ? [0, 3, 3, 0] : [3, 3, 0, 0],
|
|
844
|
-
children: fe.length === 1 && !j.color && be.map((ge, ve) => /* @__PURE__ */ e(D, { fill: ce[ve % ce.length] }, ve))
|
|
845
|
-
},
|
|
846
|
-
j.field
|
|
847
|
-
))
|
|
848
|
-
]
|
|
849
|
-
}
|
|
850
|
-
) })
|
|
820
|
+
labelStyle: { color: "#f1f5f9" },
|
|
821
|
+
itemStyle: { color: "#e2e8f0" },
|
|
822
|
+
formatter: (E) => _e(E)
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
fe.length > 1 && /* @__PURE__ */ e(M, { wrapperStyle: { fontSize: 11 } }),
|
|
826
|
+
fe.map((E, de) => /* @__PURE__ */ e(
|
|
827
|
+
f,
|
|
828
|
+
{
|
|
829
|
+
className: u ? "cursor-pointer" : void 0,
|
|
830
|
+
onClick: (ge) => {
|
|
831
|
+
var Oe;
|
|
832
|
+
const ve = (Oe = ge == null ? void 0 : ge.payload) == null ? void 0 : Oe[oe];
|
|
833
|
+
ve != null && te(String(ve));
|
|
834
|
+
},
|
|
835
|
+
dataKey: E.field,
|
|
836
|
+
name: E.label ?? E.field,
|
|
837
|
+
stackId: V ? "stack" : void 0,
|
|
838
|
+
fill: E.color ?? ce[de % ce.length],
|
|
839
|
+
radius: V ? 0 : h ? [0, 3, 3, 0] : [3, 3, 0, 0],
|
|
840
|
+
children: fe.length === 1 && !E.color && be.map((ge, ve) => /* @__PURE__ */ e(D, { fill: ce[ve % ce.length] }, ve))
|
|
841
|
+
},
|
|
842
|
+
E.field
|
|
843
|
+
))
|
|
844
|
+
]
|
|
851
845
|
}
|
|
852
|
-
),
|
|
846
|
+
) }) }),
|
|
853
847
|
re
|
|
854
848
|
] });
|
|
855
849
|
}
|
|
856
|
-
const
|
|
857
|
-
function
|
|
850
|
+
const al = ["gt", "gte", "lt", "lte", "eq"], ra = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }, ll = ["sum", "avg", "max", "min"];
|
|
851
|
+
function rl(t) {
|
|
858
852
|
var o, c, u;
|
|
859
853
|
const i = [
|
|
860
854
|
{ value: "value", label: "Value (widget metric)" },
|
|
@@ -887,7 +881,7 @@ function Pt(t, i) {
|
|
|
887
881
|
const a = /^(sum|avg|max|min|tile):(.+)$/.exec(t.field), o = a ? a[2] : t.field, c = ((g = i.find((b) => b.value === t.field || b.value === o)) == null ? void 0 : g.label) ?? o;
|
|
888
882
|
return `${a && a[1] !== "sum" && a[1] !== "tile" ? `${a[1]} ` : ""}${c} ${ra[t.op] ?? t.op} ${t.value.toLocaleString()}`;
|
|
889
883
|
}
|
|
890
|
-
function
|
|
884
|
+
function nl({ reportId: t, alert: i }) {
|
|
891
885
|
const a = Le(), o = Ct(), { data: c = [] } = ke({
|
|
892
886
|
queryKey: ["nivaro-report-alert-log", t, i.id],
|
|
893
887
|
queryFn: () => a.request(ba(t, i.id)).then((g) => g.data),
|
|
@@ -924,19 +918,19 @@ function rl({ reportId: t, alert: i }) {
|
|
|
924
918
|
)
|
|
925
919
|
] }, g.id)) });
|
|
926
920
|
}
|
|
927
|
-
function
|
|
921
|
+
function sl({
|
|
928
922
|
reportId: t,
|
|
929
923
|
widget: i,
|
|
930
924
|
filterBar: a
|
|
931
925
|
}) {
|
|
932
926
|
const o = Le(), c = Ct(), [u, g] = C(!1), [b, p] = C(""), [K, $] = C([
|
|
933
927
|
{ field: "value", agg: "sum", op: "gt", value: "" }
|
|
934
|
-
]), [w, _] = C([]), [m, S] = C(!1), [
|
|
928
|
+
]), [w, _] = C([]), [m, S] = C(!1), [G, z] = C(null), I = rl(i), { data: ee = [] } = ke({
|
|
935
929
|
queryKey: ["nivaro-report-alerts", t],
|
|
936
930
|
queryFn: () => o.request(pa(t)).then((h) => h.data),
|
|
937
931
|
enabled: u,
|
|
938
932
|
staleTime: 3e4
|
|
939
|
-
}), ue = ee.filter((h) => h.widget === i.id),
|
|
933
|
+
}), ue = ee.filter((h) => h.widget === i.id), j = () => void c.invalidateQueries({ queryKey: ["nivaro-report-alerts", t] }), le = () => K.filter((h) => h.value.trim() !== "" && !Number.isNaN(Number(h.value))).map((h) => {
|
|
940
934
|
const te = I.find((V) => V.value === h.field);
|
|
941
935
|
return { field: te != null && te.aggregatable && h.agg !== "sum" ? `${h.agg}:${h.field}` : h.field, op: h.op, value: Number(h.value) };
|
|
942
936
|
}), oe = qe({
|
|
@@ -954,14 +948,14 @@ function nl({
|
|
|
954
948
|
);
|
|
955
949
|
},
|
|
956
950
|
onSuccess: () => {
|
|
957
|
-
p(""), $([{ field: "value", agg: "sum", op: "gt", value: "" }]), _([]),
|
|
951
|
+
p(""), $([{ field: "value", agg: "sum", op: "gt", value: "" }]), _([]), j();
|
|
958
952
|
}
|
|
959
953
|
}), fe = qe({
|
|
960
954
|
mutationFn: (h) => o.request(fa(t, h.id, !h.is_active)),
|
|
961
|
-
onSuccess:
|
|
955
|
+
onSuccess: j
|
|
962
956
|
}), be = qe({
|
|
963
957
|
mutationFn: (h) => o.request(xa(t, h.id)),
|
|
964
|
-
onSuccess:
|
|
958
|
+
onSuccess: j
|
|
965
959
|
}), Se = le().length > 0, _e = ue.some((h) => h.firing);
|
|
966
960
|
return /* @__PURE__ */ s(It, { open: u, onOpenChange: g, children: [
|
|
967
961
|
/* @__PURE__ */ e(ea, { asChild: !0, children: /* @__PURE__ */ e(
|
|
@@ -1002,7 +996,7 @@ function nl({
|
|
|
1002
996
|
{
|
|
1003
997
|
type: "button",
|
|
1004
998
|
className: "text-[10.5px] text-slate-400 hover:text-slate-600",
|
|
1005
|
-
onClick: () =>
|
|
999
|
+
onClick: () => z(G === h.id ? null : h.id),
|
|
1006
1000
|
children: "History"
|
|
1007
1001
|
}
|
|
1008
1002
|
),
|
|
@@ -1033,7 +1027,7 @@ function nl({
|
|
|
1033
1027
|
" · Last fired: ",
|
|
1034
1028
|
h.last_fired ? new Date(h.last_fired).toLocaleString() : "Never"
|
|
1035
1029
|
] }),
|
|
1036
|
-
|
|
1030
|
+
G === h.id && /* @__PURE__ */ e(nl, { reportId: t, alert: h })
|
|
1037
1031
|
]
|
|
1038
1032
|
},
|
|
1039
1033
|
h.id
|
|
@@ -1068,7 +1062,7 @@ function nl({
|
|
|
1068
1062
|
onChange: (V) => $(
|
|
1069
1063
|
(pe) => pe.map((ne, f) => f === te ? { ...ne, agg: V } : ne)
|
|
1070
1064
|
),
|
|
1071
|
-
options:
|
|
1065
|
+
options: ll.map((V) => ({ value: V, label: V })),
|
|
1072
1066
|
ariaLabel: "Aggregate",
|
|
1073
1067
|
className: "h-7 w-[62px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1074
1068
|
}
|
|
@@ -1080,7 +1074,7 @@ function nl({
|
|
|
1080
1074
|
onChange: (V) => $(
|
|
1081
1075
|
(pe) => pe.map((ne, f) => f === te ? { ...ne, op: V } : ne)
|
|
1082
1076
|
),
|
|
1083
|
-
options:
|
|
1077
|
+
options: al.map((V) => ({ value: V, label: ra[V] })),
|
|
1084
1078
|
ariaLabel: "Operator",
|
|
1085
1079
|
className: "h-7 w-[52px] rounded-md px-1.5 py-0 text-[11.5px] dark:border-border dark:bg-card"
|
|
1086
1080
|
}
|
|
@@ -1170,7 +1164,7 @@ function nl({
|
|
|
1170
1164
|
] })
|
|
1171
1165
|
] });
|
|
1172
1166
|
}
|
|
1173
|
-
const
|
|
1167
|
+
const il = {
|
|
1174
1168
|
eq: "_eq",
|
|
1175
1169
|
neq: "_neq",
|
|
1176
1170
|
gt: "_gt",
|
|
@@ -1186,7 +1180,7 @@ function qt(t, i, a, o) {
|
|
|
1186
1180
|
var K, $;
|
|
1187
1181
|
const c = t.config ?? {}, u = [];
|
|
1188
1182
|
for (const w of c.filters ?? []) {
|
|
1189
|
-
const _ =
|
|
1183
|
+
const _ = il[w.op];
|
|
1190
1184
|
if (!_) continue;
|
|
1191
1185
|
let m = w.value;
|
|
1192
1186
|
w.op === "in" && typeof m == "string" && (m = m.split(",").map((S) => S.trim())), u.push({ path: [w.field], op: _, value: m });
|
|
@@ -1229,11 +1223,11 @@ function zt(t) {
|
|
|
1229
1223
|
}
|
|
1230
1224
|
return a.length > 0 ? a.join(" · ") : "No configuration details";
|
|
1231
1225
|
}
|
|
1232
|
-
function
|
|
1226
|
+
function ol(t) {
|
|
1233
1227
|
var i, a;
|
|
1234
1228
|
return t ? t.value != null ? Number(t.value) : t.series ? t.series.reduce((o, c) => o + (Number(c.value) || 0), 0) : (i = t.tiles) != null && i.length ? Number(((a = t.tiles[0]) == null ? void 0 : a.value) ?? 0) : t.row_count != null ? Number(t.row_count) : null : null;
|
|
1235
1229
|
}
|
|
1236
|
-
function
|
|
1230
|
+
function dl(t, i, a) {
|
|
1237
1231
|
var K, $, w;
|
|
1238
1232
|
const o = [];
|
|
1239
1233
|
if (o.length === 0 && ((K = i == null ? void 0 : i.rows) != null && K.length) && o.push(...i.rows), o.length === 0 && (($ = i == null ? void 0 : i.series) != null && $.length))
|
|
@@ -1256,7 +1250,7 @@ function ol(t, i, a) {
|
|
|
1256
1250
|
), b = new Blob([g], { type: "text/csv;charset=utf-8" }), p = document.createElement("a");
|
|
1257
1251
|
p.href = URL.createObjectURL(b), p.download = `${(t.title || "widget").replace(/[^\w-]+/g, "_")}.csv`, p.click(), URL.revokeObjectURL(p.href);
|
|
1258
1252
|
}
|
|
1259
|
-
function
|
|
1253
|
+
function cl({
|
|
1260
1254
|
collection: t,
|
|
1261
1255
|
conditions: i,
|
|
1262
1256
|
title: a,
|
|
@@ -1380,13 +1374,13 @@ const At = _a(function({
|
|
|
1380
1374
|
onDeleteAnnotation: _,
|
|
1381
1375
|
onCrossFilter: m,
|
|
1382
1376
|
reportUrl: S,
|
|
1383
|
-
currentFilters:
|
|
1377
|
+
currentFilters: G
|
|
1384
1378
|
}) {
|
|
1385
1379
|
var Be, ht, Qe, ft, Ue, xt, bt, Ie, gt, Ye, et, Je, tt, at, lt, se, vt, rt, nt, st;
|
|
1386
|
-
const
|
|
1380
|
+
const z = Le(), [I, ee] = C(""), [ue, j] = C(0), [le, oe] = C(null), [fe, be] = C(!1), [Se, _e] = C(""), [h, te] = C(""), [re, V] = C(!1), [pe, ne] = C(!1), [f, q] = C([]), D = St(null), [M, H] = C(!1), [X, me] = C(null), [F, E] = C(!1), [de, ge] = C(null), ve = ["bar", "line", "donut", "pareto", "area"].includes(a.type) || a.type === "kpi" && !!((Be = a.config) != null && Be.compare || (ht = a.config) != null && ht.sparkline), Oe = Ct(), [He, mt] = C(!1), Ne = async () => {
|
|
1387
1381
|
mt(!0);
|
|
1388
1382
|
try {
|
|
1389
|
-
const l = await
|
|
1383
|
+
const l = await z.request(
|
|
1390
1384
|
yt(i, a.id, {
|
|
1391
1385
|
date_range: o,
|
|
1392
1386
|
entity_filters: c,
|
|
@@ -1422,7 +1416,7 @@ const At = _a(function({
|
|
|
1422
1416
|
isFetching: ut
|
|
1423
1417
|
} = ke({
|
|
1424
1418
|
queryKey: ["nivaro-report-widget", i, a.id, o, c],
|
|
1425
|
-
queryFn: () =>
|
|
1419
|
+
queryFn: () => z.request(
|
|
1426
1420
|
yt(i, a.id, {
|
|
1427
1421
|
date_range: o,
|
|
1428
1422
|
entity_filters: c
|
|
@@ -1443,7 +1437,7 @@ const At = _a(function({
|
|
|
1443
1437
|
(l) => typeof l == "string" && l
|
|
1444
1438
|
), { data: pt } = ke({
|
|
1445
1439
|
queryKey: ["nvr-report-drill", i, a.id, f, o, c],
|
|
1446
|
-
queryFn: () =>
|
|
1440
|
+
queryFn: () => z.request(
|
|
1447
1441
|
yt(i, a.id, {
|
|
1448
1442
|
date_range: o,
|
|
1449
1443
|
entity_filters: [
|
|
@@ -1456,7 +1450,7 @@ const At = _a(function({
|
|
|
1456
1450
|
enabled: f.length > 0 && Ee.length > 0,
|
|
1457
1451
|
staleTime: 6e4,
|
|
1458
1452
|
retry: !1
|
|
1459
|
-
}),
|
|
1453
|
+
}), W = f.length > 0 && pt ? pt : Me, xe = (Ue = a.config) == null ? void 0 : Ue.format, he = {
|
|
1460
1454
|
gridColumn: `${Math.max(1, (a.x ?? 0) + 1)} / span ${Math.min(12, Math.max(2, a.w || 4))}`,
|
|
1461
1455
|
gridRow: `span ${Math.max(1, a.h || 3)}`
|
|
1462
1456
|
};
|
|
@@ -1466,10 +1460,10 @@ const At = _a(function({
|
|
|
1466
1460
|
...Ke,
|
|
1467
1461
|
slug: Ke.slug || Ke.query_slug || ""
|
|
1468
1462
|
} : null;
|
|
1469
|
-
let
|
|
1463
|
+
let Z = null;
|
|
1470
1464
|
if (We != null && We.slug)
|
|
1471
|
-
|
|
1472
|
-
|
|
1465
|
+
Z = /* @__PURE__ */ e(
|
|
1466
|
+
tl,
|
|
1473
1467
|
{
|
|
1474
1468
|
cfg: We,
|
|
1475
1469
|
dateRange: o,
|
|
@@ -1479,9 +1473,9 @@ const At = _a(function({
|
|
|
1479
1473
|
}
|
|
1480
1474
|
);
|
|
1481
1475
|
else if (a.type === "query")
|
|
1482
|
-
|
|
1476
|
+
Z = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No query configured." });
|
|
1483
1477
|
else if (Ze)
|
|
1484
|
-
|
|
1478
|
+
Z = /* @__PURE__ */ s("div", { className: "flex flex-col gap-2 px-1", children: [
|
|
1485
1479
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-300", children: "Loading…" }),
|
|
1486
1480
|
/* @__PURE__ */ e(
|
|
1487
1481
|
Xt,
|
|
@@ -1499,7 +1493,7 @@ const At = _a(function({
|
|
|
1499
1493
|
)
|
|
1500
1494
|
] });
|
|
1501
1495
|
else if (Ae)
|
|
1502
|
-
|
|
1496
|
+
Z = /* @__PURE__ */ e(
|
|
1503
1497
|
Zt,
|
|
1504
1498
|
{
|
|
1505
1499
|
className: "px-1",
|
|
@@ -1507,13 +1501,13 @@ const At = _a(function({
|
|
|
1507
1501
|
onRetry: () => void De()
|
|
1508
1502
|
}
|
|
1509
1503
|
);
|
|
1510
|
-
else if (
|
|
1504
|
+
else if (W)
|
|
1511
1505
|
if (a.type === "queue") {
|
|
1512
|
-
const l =
|
|
1506
|
+
const l = W.series ?? [], n = Math.max(...l.map((O) => O.value), 1), y = Math.min(...l.map((O) => O.value), 0), A = Math.max(n - y, 1), R = l.map(
|
|
1513
1507
|
(O, ie) => `${ie / Math.max(1, l.length - 1) * 100},${28 - (O.value - y) / A * 26}`
|
|
1514
1508
|
).join(" ");
|
|
1515
|
-
|
|
1516
|
-
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children:
|
|
1509
|
+
Z = /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1510
|
+
/* @__PURE__ */ e("p", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-slate-900 dark:text-foreground", children: W.value == null ? "—" : Number(W.value).toLocaleString() }),
|
|
1517
1511
|
l.length >= 3 && /* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1518
1512
|
"polyline",
|
|
1519
1513
|
{
|
|
@@ -1530,7 +1524,7 @@ const At = _a(function({
|
|
|
1530
1524
|
] })
|
|
1531
1525
|
] });
|
|
1532
1526
|
} else if (a.type === "kpi" || a.type === "calc") {
|
|
1533
|
-
if (
|
|
1527
|
+
if (Z = /* @__PURE__ */ s("div", { className: "flex items-baseline gap-2", children: [
|
|
1534
1528
|
/* @__PURE__ */ e(
|
|
1535
1529
|
"p",
|
|
1536
1530
|
{
|
|
@@ -1541,8 +1535,8 @@ const At = _a(function({
|
|
|
1541
1535
|
(() => {
|
|
1542
1536
|
var y;
|
|
1543
1537
|
const l = (y = a.config) == null ? void 0 : y.thresholds;
|
|
1544
|
-
if (!(l != null && l.length) ||
|
|
1545
|
-
const n = [...l].filter((A) => Number.isFinite(A.gte)).sort((A, R) => R.gte - A.gte).find((A) =>
|
|
1538
|
+
if (!(l != null && l.length) || W.value == null) return null;
|
|
1539
|
+
const n = [...l].filter((A) => Number.isFinite(A.gte)).sort((A, R) => R.gte - A.gte).find((A) => W.value >= A.gte);
|
|
1546
1540
|
return (n == null ? void 0 : n.color) === "red" ? "!text-red-600 dark:!text-red-400" : (n == null ? void 0 : n.color) === "amber" ? "!text-amber-600 dark:!text-amber-400" : (n == null ? void 0 : n.color) === "green" ? "!text-emerald-600 dark:!text-emerald-400" : null;
|
|
1547
1541
|
})()
|
|
1548
1542
|
),
|
|
@@ -1553,14 +1547,14 @@ const At = _a(function({
|
|
|
1553
1547
|
title: a.title || a.collection
|
|
1554
1548
|
});
|
|
1555
1549
|
},
|
|
1556
|
-
children: $e(
|
|
1550
|
+
children: $e(W.value, xe)
|
|
1557
1551
|
}
|
|
1558
1552
|
),
|
|
1559
|
-
/* @__PURE__ */ e(Kt, { pct:
|
|
1560
|
-
] }),
|
|
1561
|
-
const l =
|
|
1562
|
-
|
|
1563
|
-
|
|
1553
|
+
/* @__PURE__ */ e(Kt, { pct: W.change_pct })
|
|
1554
|
+
] }), W.spark && W.spark.length >= 3) {
|
|
1555
|
+
const l = W.spark, n = Math.max(...l.map((O) => O.value), 1), y = Math.min(...l.map((O) => O.value), 0), A = Math.max(n - y, 1), R = l.map((O, ie) => `${ie / (l.length - 1) * 100},${28 - (O.value - y) / A * 26}`).join(" ");
|
|
1556
|
+
Z = /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col justify-center", children: [
|
|
1557
|
+
Z,
|
|
1564
1558
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 30", preserveAspectRatio: "none", className: "mt-1.5 h-7 w-full", children: /* @__PURE__ */ e(
|
|
1565
1559
|
"polyline",
|
|
1566
1560
|
{
|
|
@@ -1574,8 +1568,8 @@ const At = _a(function({
|
|
|
1574
1568
|
] });
|
|
1575
1569
|
}
|
|
1576
1570
|
} else if (a.type === "kpi_group") {
|
|
1577
|
-
const l =
|
|
1578
|
-
|
|
1571
|
+
const l = W.tiles ?? [];
|
|
1572
|
+
Z = /* @__PURE__ */ e(
|
|
1579
1573
|
"div",
|
|
1580
1574
|
{
|
|
1581
1575
|
className: "grid gap-2",
|
|
@@ -1601,12 +1595,12 @@ const At = _a(function({
|
|
|
1601
1595
|
}
|
|
1602
1596
|
);
|
|
1603
1597
|
} else if (a.type === "narrative")
|
|
1604
|
-
|
|
1598
|
+
Z = /* @__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: (W.narrative ?? "").split(/(\*\*[^*]+\*\*)/g).map(
|
|
1605
1599
|
(l, n) => l.startsWith("**") && l.endsWith("**") ? /* @__PURE__ */ e("strong", { className: "font-semibold text-slate-900 dark:text-foreground", children: l.slice(2, -2) }, n) : /* @__PURE__ */ e("span", { children: l }, n)
|
|
1606
1600
|
) });
|
|
1607
1601
|
else if (a.type === "heatmap") {
|
|
1608
|
-
const l =
|
|
1609
|
-
|
|
1602
|
+
const l = W.cells ?? [], n = [...new Set(l.map((O) => O.dim))], y = [...new Set(l.map((O) => O.dim2))], A = Math.max(1, ...l.map((O) => O.value)), R = (O, ie) => l.find((ae) => ae.dim === O && ae.dim2 === ie);
|
|
1603
|
+
Z = 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__ */ s("table", { className: "w-full text-[10.5px]", children: [
|
|
1610
1604
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ s("tr", { children: [
|
|
1611
1605
|
/* @__PURE__ */ e("th", {}),
|
|
1612
1606
|
y.map((O) => /* @__PURE__ */ e(
|
|
@@ -1639,8 +1633,8 @@ const At = _a(function({
|
|
|
1639
1633
|
] }, O)) })
|
|
1640
1634
|
] }) });
|
|
1641
1635
|
} else if (a.type === "ai_insight") {
|
|
1642
|
-
const l =
|
|
1643
|
-
|
|
1636
|
+
const l = W.narrative ?? "";
|
|
1637
|
+
Z = /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1644
1638
|
/* @__PURE__ */ s("div", { className: "mb-1 flex items-center gap-1.5", children: [
|
|
1645
1639
|
/* @__PURE__ */ e(Ot, { className: "h-3.5 w-3.5 text-[#00a5cc]" }),
|
|
1646
1640
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wide text-slate-400", children: "AI-generated" }),
|
|
@@ -1659,8 +1653,8 @@ const At = _a(function({
|
|
|
1659
1653
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: He ? "Regenerating…" : l })
|
|
1660
1654
|
] });
|
|
1661
1655
|
} else if (a.type === "pivot") {
|
|
1662
|
-
const l =
|
|
1663
|
-
|
|
1656
|
+
const l = W.pivot;
|
|
1657
|
+
Z = !l || l.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1664
1658
|
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ s("table", { className: "w-full border-collapse text-[10.5px]", children: [
|
|
1665
1659
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ s("tr", { children: [
|
|
1666
1660
|
/* @__PURE__ */ e("th", { className: "sticky left-0 top-0 z-[2] bg-white dark:bg-card" }),
|
|
@@ -1719,8 +1713,8 @@ const At = _a(function({
|
|
|
1719
1713
|
] })
|
|
1720
1714
|
] });
|
|
1721
1715
|
} else if (a.type === "waterfall") {
|
|
1722
|
-
const l =
|
|
1723
|
-
|
|
1716
|
+
const l = W.waterfall;
|
|
1717
|
+
Z = l ? (() => {
|
|
1724
1718
|
const n = [];
|
|
1725
1719
|
n.push({ label: "Previous", from: 0, to: l.start, kind: "total" });
|
|
1726
1720
|
let y = l.start;
|
|
@@ -1759,8 +1753,8 @@ const At = _a(function({
|
|
|
1759
1753
|
}) });
|
|
1760
1754
|
})() : /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
1761
1755
|
} else if (a.type === "stats") {
|
|
1762
|
-
const l =
|
|
1763
|
-
|
|
1756
|
+
const l = W.rows ?? [];
|
|
1757
|
+
Z = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : /* @__PURE__ */ e("div", { className: "grid min-h-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-1.5 overflow-auto px-1", children: l.map((n) => /* @__PURE__ */ s(
|
|
1764
1758
|
"div",
|
|
1765
1759
|
{
|
|
1766
1760
|
className: "flex items-baseline justify-between border-b border-slate-100 pb-1 dark:border-border/50",
|
|
@@ -1772,8 +1766,8 @@ const At = _a(function({
|
|
|
1772
1766
|
n.stat
|
|
1773
1767
|
)) });
|
|
1774
1768
|
} else if (a.type === "hot_records") {
|
|
1775
|
-
const l =
|
|
1776
|
-
|
|
1769
|
+
const l = W.rows ?? [], n = Math.max(1, ...l.map((y) => y.views));
|
|
1770
|
+
Z = 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((y) => /* @__PURE__ */ s(
|
|
1777
1771
|
"button",
|
|
1778
1772
|
{
|
|
1779
1773
|
type: "button",
|
|
@@ -1794,129 +1788,125 @@ const At = _a(function({
|
|
|
1794
1788
|
y.id
|
|
1795
1789
|
)) });
|
|
1796
1790
|
} else if (a.type === "scatter") {
|
|
1797
|
-
const l =
|
|
1798
|
-
|
|
1791
|
+
const l = W.rows ?? [];
|
|
1792
|
+
Z = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." }) : (() => {
|
|
1799
1793
|
const n = l.length, y = l.reduce((x, v) => x + v.x, 0), A = l.reduce((x, v) => x + v.y, 0), R = l.reduce((x, v) => x + v.x * v.x, 0), O = l.reduce((x, v) => x + v.x * v.y, 0), ie = n * R - y * y, ae = ie !== 0 ? (n * O - y * A) / ie : 0, T = n > 0 ? (A - ae * y) / n : 0, J = l.map((x) => x.x), Q = Math.min(...J), P = Math.max(...J), r = [
|
|
1800
1794
|
{ x: Q, y: T + ae * Q },
|
|
1801
1795
|
{ x: P, y: T + ae * P }
|
|
1802
1796
|
];
|
|
1803
|
-
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1797
|
+
return /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
1798
|
+
ComposedChart: x,
|
|
1799
|
+
Line: v,
|
|
1800
|
+
ResponsiveContainer: d,
|
|
1801
|
+
Scatter: k,
|
|
1802
|
+
Tooltip: N,
|
|
1803
|
+
XAxis: B,
|
|
1804
|
+
YAxis: U
|
|
1805
|
+
}) => /* @__PURE__ */ e(d, { width: "100%", height: "100%", children: /* @__PURE__ */ s(x, { data: l, margin: { top: 6, right: 8, left: -6, bottom: 0 }, children: [
|
|
1806
|
+
/* @__PURE__ */ e(
|
|
1807
|
+
B,
|
|
1808
|
+
{
|
|
1809
|
+
dataKey: "x",
|
|
1810
|
+
type: "number",
|
|
1811
|
+
tick: { fontSize: 10 },
|
|
1812
|
+
tickFormatter: Ce,
|
|
1813
|
+
domain: ["dataMin", "dataMax"]
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
/* @__PURE__ */ e(U, { tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1817
|
+
/* @__PURE__ */ e(
|
|
1818
|
+
N,
|
|
1819
|
+
{
|
|
1820
|
+
contentStyle: {
|
|
1821
|
+
fontSize: 12,
|
|
1822
|
+
backgroundColor: "#0f172a",
|
|
1823
|
+
border: "1px solid #334155",
|
|
1824
|
+
borderRadius: 8,
|
|
1825
|
+
color: "#f1f5f9"
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
),
|
|
1829
|
+
/* @__PURE__ */ e(k, { data: l, dataKey: "y", fill: "#00a5cc", opacity: 0.7 }),
|
|
1830
|
+
/* @__PURE__ */ e(
|
|
1831
|
+
v,
|
|
1832
|
+
{
|
|
1833
|
+
data: r,
|
|
1834
|
+
dataKey: "y",
|
|
1835
|
+
stroke: "#f59e0b",
|
|
1836
|
+
strokeWidth: 2,
|
|
1837
|
+
dot: !1,
|
|
1838
|
+
isAnimationActive: !1
|
|
1839
|
+
}
|
|
1840
|
+
)
|
|
1841
|
+
] }) }) }) });
|
|
1846
1842
|
})();
|
|
1847
1843
|
} else if (a.type === "pareto") {
|
|
1848
|
-
const l =
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
isAnimationActive: !1
|
|
1907
|
-
}
|
|
1908
|
-
)
|
|
1909
|
-
] }) })
|
|
1910
|
-
}
|
|
1911
|
-
) });
|
|
1844
|
+
const l = W.series ?? [];
|
|
1845
|
+
Z = 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(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Bar: n, ComposedChart: y, Line: A, ResponsiveContainer: R, Tooltip: O, XAxis: ie, YAxis: ae }) => /* @__PURE__ */ e(R, { width: "100%", height: "100%", children: /* @__PURE__ */ s(y, { data: l, margin: { top: 6, right: 4, left: -10, bottom: 0 }, children: [
|
|
1846
|
+
/* @__PURE__ */ e(
|
|
1847
|
+
ie,
|
|
1848
|
+
{
|
|
1849
|
+
dataKey: "dim",
|
|
1850
|
+
tick: { fontSize: 10 },
|
|
1851
|
+
interval: 0,
|
|
1852
|
+
angle: -20,
|
|
1853
|
+
textAnchor: "end",
|
|
1854
|
+
height: 42
|
|
1855
|
+
}
|
|
1856
|
+
),
|
|
1857
|
+
/* @__PURE__ */ e(ae, { yAxisId: "v", tick: { fontSize: 10 }, tickFormatter: Ce }),
|
|
1858
|
+
/* @__PURE__ */ e(
|
|
1859
|
+
ae,
|
|
1860
|
+
{
|
|
1861
|
+
yAxisId: "pct",
|
|
1862
|
+
orientation: "right",
|
|
1863
|
+
domain: [0, 100],
|
|
1864
|
+
tick: { fontSize: 10 },
|
|
1865
|
+
tickFormatter: (T) => `${T}%`
|
|
1866
|
+
}
|
|
1867
|
+
),
|
|
1868
|
+
/* @__PURE__ */ e(
|
|
1869
|
+
O,
|
|
1870
|
+
{
|
|
1871
|
+
contentStyle: {
|
|
1872
|
+
fontSize: 12,
|
|
1873
|
+
backgroundColor: "#0f172a",
|
|
1874
|
+
border: "1px solid #334155",
|
|
1875
|
+
borderRadius: 8,
|
|
1876
|
+
color: "#f1f5f9"
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
),
|
|
1880
|
+
/* @__PURE__ */ e(
|
|
1881
|
+
n,
|
|
1882
|
+
{
|
|
1883
|
+
yAxisId: "v",
|
|
1884
|
+
dataKey: "value",
|
|
1885
|
+
fill: "#00a5cc",
|
|
1886
|
+
radius: [3, 3, 0, 0],
|
|
1887
|
+
isAnimationActive: !1
|
|
1888
|
+
}
|
|
1889
|
+
),
|
|
1890
|
+
/* @__PURE__ */ e(
|
|
1891
|
+
A,
|
|
1892
|
+
{
|
|
1893
|
+
yAxisId: "pct",
|
|
1894
|
+
dataKey: "cum_pct",
|
|
1895
|
+
stroke: "#f59e0b",
|
|
1896
|
+
strokeWidth: 2,
|
|
1897
|
+
dot: { r: 2 },
|
|
1898
|
+
isAnimationActive: !1
|
|
1899
|
+
}
|
|
1900
|
+
)
|
|
1901
|
+
] }) }) }) });
|
|
1912
1902
|
} else if (a.type === "metric")
|
|
1913
|
-
|
|
1914
|
-
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children:
|
|
1903
|
+
Z = /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
1904
|
+
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-slate-900 dark:text-slate-50", children: W.value == null ? "—" : $e(W.value, xe) }),
|
|
1915
1905
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: String(((Ie = a.config) == null ? void 0 : Ie.metric_key) ?? "") })
|
|
1916
1906
|
] });
|
|
1917
1907
|
else if (a.type === "movers") {
|
|
1918
|
-
const l =
|
|
1919
|
-
|
|
1908
|
+
const l = W.rows ?? [];
|
|
1909
|
+
Z = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No movement in this window." }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 space-y-0.5 overflow-y-auto", children: l.map((n) => /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-[11.5px]", children: [
|
|
1920
1910
|
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: n.dim }),
|
|
1921
1911
|
/* @__PURE__ */ s("span", { className: "tabular-nums text-slate-400", children: [
|
|
1922
1912
|
n.previous.toLocaleString(),
|
|
@@ -1943,7 +1933,7 @@ const At = _a(function({
|
|
|
1943
1933
|
)
|
|
1944
1934
|
] }, n.dim)) });
|
|
1945
1935
|
} else if (a.type === "table") {
|
|
1946
|
-
const l =
|
|
1936
|
+
const l = W.rows ?? [], n = (gt = a.config) != null && gt.columns && a.config.columns.length > 0 ? a.config.columns.map((d) => typeof d == "string" ? { field: d } : d) : l[0] ? Object.keys(l[0]).filter((d) => d !== "id").map((d) => ({ field: d })) : [], y = n.map((d) => d.field), A = (d) => n.find((k) => k.field === d), R = ((Ye = a.config) == null ? void 0 : Ye.format_rules) ?? [], O = (d) => {
|
|
1947
1937
|
var k;
|
|
1948
1938
|
for (const N of R)
|
|
1949
1939
|
if ((N.scope ?? "cell") === "row" && Et(N, d[N.field]))
|
|
@@ -1951,9 +1941,9 @@ const At = _a(function({
|
|
|
1951
1941
|
return null;
|
|
1952
1942
|
}, ie = (d, k) => {
|
|
1953
1943
|
var N;
|
|
1954
|
-
for (const
|
|
1955
|
-
if ((
|
|
1956
|
-
return ((N = jt[
|
|
1944
|
+
for (const B of R)
|
|
1945
|
+
if ((B.scope ?? "cell") === "cell" && B.field === k && Et(B, d[k]))
|
|
1946
|
+
return ((N = jt[B.color]) == null ? void 0 : N.cell) ?? null;
|
|
1957
1947
|
return null;
|
|
1958
1948
|
}, ae = I.trim().toLowerCase(), T = a.config, J = T != null && T.suppress_zero ? l.filter(
|
|
1959
1949
|
(d) => y.some((k) => {
|
|
@@ -1965,14 +1955,14 @@ const At = _a(function({
|
|
|
1965
1955
|
(k) => String(k ?? "").toLowerCase().includes(ae)
|
|
1966
1956
|
)
|
|
1967
1957
|
) : J, P = 12, r = Math.max(1, Math.ceil(Q.length / P)), x = Math.min(ue, r - 1), v = Q.length > P ? Q.slice(x * P, x * P + P) : Q;
|
|
1968
|
-
|
|
1958
|
+
Z = l.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No rows." }) : /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
1969
1959
|
l.length > P && /* @__PURE__ */ s("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
1970
1960
|
/* @__PURE__ */ e(
|
|
1971
1961
|
"input",
|
|
1972
1962
|
{
|
|
1973
1963
|
value: I,
|
|
1974
1964
|
onChange: (d) => {
|
|
1975
|
-
ee(d.target.value),
|
|
1965
|
+
ee(d.target.value), j(0);
|
|
1976
1966
|
},
|
|
1977
1967
|
placeholder: "Search rows…",
|
|
1978
1968
|
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"
|
|
@@ -1984,7 +1974,7 @@ const At = _a(function({
|
|
|
1984
1974
|
{
|
|
1985
1975
|
type: "button",
|
|
1986
1976
|
disabled: x <= 0,
|
|
1987
|
-
onClick: () =>
|
|
1977
|
+
onClick: () => j(x - 1),
|
|
1988
1978
|
className: "rounded px-1 disabled:opacity-30",
|
|
1989
1979
|
children: "←"
|
|
1990
1980
|
}
|
|
@@ -1997,7 +1987,7 @@ const At = _a(function({
|
|
|
1997
1987
|
{
|
|
1998
1988
|
type: "button",
|
|
1999
1989
|
disabled: x >= r - 1,
|
|
2000
|
-
onClick: () =>
|
|
1990
|
+
onClick: () => j(x + 1),
|
|
2001
1991
|
className: "rounded px-1 disabled:opacity-30",
|
|
2002
1992
|
children: "→"
|
|
2003
1993
|
}
|
|
@@ -2027,7 +2017,7 @@ const At = _a(function({
|
|
|
2027
2017
|
a.collection && d.id != null && (b == null || b({ collection: a.collection, itemId: String(d.id) }));
|
|
2028
2018
|
},
|
|
2029
2019
|
children: y.map((k) => {
|
|
2030
|
-
var N,
|
|
2020
|
+
var N, B, U, L;
|
|
2031
2021
|
return /* @__PURE__ */ e(
|
|
2032
2022
|
"td",
|
|
2033
2023
|
{
|
|
@@ -2036,7 +2026,7 @@ const At = _a(function({
|
|
|
2036
2026
|
(typeof d[k] == "number" || ze.has(((N = A(k)) == null ? void 0 : N.format) ?? "")) && "text-right tabular-nums",
|
|
2037
2027
|
ie(d, k)
|
|
2038
2028
|
),
|
|
2039
|
-
children: (
|
|
2029
|
+
children: (B = A(k)) != null && B.format ? je(d[k], (U = A(k)) == null ? void 0 : U.format, (L = A(k)) == null ? void 0 : L.decimals) : String(d[k] ?? "")
|
|
2040
2030
|
},
|
|
2041
2031
|
k
|
|
2042
2032
|
);
|
|
@@ -2046,15 +2036,15 @@ const At = _a(function({
|
|
|
2046
2036
|
)) }),
|
|
2047
2037
|
(T == null ? void 0 : T.grand_total) && Q.length > 1 && /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ e("tr", { className: "border-t border-slate-200 font-semibold dark:border-border", children: y.map((d, k) => {
|
|
2048
2038
|
var L, we, Pe;
|
|
2049
|
-
const N = Q.map((it) => Number(it[d])).filter((it) => Number.isFinite(it)),
|
|
2039
|
+
const N = Q.map((it) => Number(it[d])).filter((it) => Number.isFinite(it)), B = N.length > Q.length / 2, U = N.reduce((it, na) => it + na, 0);
|
|
2050
2040
|
return /* @__PURE__ */ e(
|
|
2051
2041
|
"td",
|
|
2052
2042
|
{
|
|
2053
2043
|
className: Y(
|
|
2054
2044
|
"px-1.5 py-1 text-slate-800 dark:text-slate-100",
|
|
2055
|
-
|
|
2045
|
+
B && "text-right tabular-nums"
|
|
2056
2046
|
),
|
|
2057
|
-
children: k === 0 && !
|
|
2047
|
+
children: k === 0 && !B ? "Total" : B ? (L = A(d)) != null && L.format ? je(U, (we = A(d)) == null ? void 0 : we.format, (Pe = A(d)) == null ? void 0 : Pe.decimals) : U.toLocaleString() : ""
|
|
2058
2048
|
},
|
|
2059
2049
|
d
|
|
2060
2050
|
);
|
|
@@ -2062,7 +2052,7 @@ const At = _a(function({
|
|
|
2062
2052
|
] }) })
|
|
2063
2053
|
] });
|
|
2064
2054
|
} else {
|
|
2065
|
-
let l =
|
|
2055
|
+
let l = W.series ?? [];
|
|
2066
2056
|
const n = !!((Je = (et = a.config) == null ? void 0 : et.dimension) != null && Je.bucket), y = Number((tt = a.config) == null ? void 0 : tt.rolling_avg) || 0;
|
|
2067
2057
|
if (y >= 2 && n && !re && l.length >= y && (l = l.map((T, J) => {
|
|
2068
2058
|
if (J < y - 1) return T;
|
|
@@ -2086,82 +2076,76 @@ const At = _a(function({
|
|
|
2086
2076
|
})(), ae = ($ ?? []).filter(
|
|
2087
2077
|
(T) => T.anchor_date && l.some((J) => J.dim === T.anchor_date)
|
|
2088
2078
|
);
|
|
2089
|
-
if (l.length === 0)
|
|
2079
|
+
if (l.length === 0) Z = /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No data." });
|
|
2090
2080
|
else if (a.type === "donut") {
|
|
2091
2081
|
const T = l.reduce((J, Q) => J + Q.value, 0);
|
|
2092
|
-
|
|
2082
|
+
Z = /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 items-stretch gap-3", children: [
|
|
2093
2083
|
/* @__PURE__ */ s("div", { className: "relative min-h-[110px] min-w-0 flex-1", children: [
|
|
2094
|
-
/* @__PURE__ */ e(
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
{ field: we, value: String((d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim) ?? "") }
|
|
2121
|
-
]);
|
|
2122
|
-
return;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
const k = (L = (U = a.config) == null ? void 0 : U.dimension) == null ? void 0 : L.field;
|
|
2126
|
-
oe({
|
|
2127
|
-
conditions: qt(
|
|
2128
|
-
a,
|
|
2129
|
-
c,
|
|
2130
|
-
o,
|
|
2131
|
-
(d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim)
|
|
2132
|
-
),
|
|
2133
|
-
title: `${a.title || a.collection} — ${(d == null ? void 0 : d.dim) ?? ""}`,
|
|
2134
|
-
dimField: k,
|
|
2135
|
-
dimRaw: (d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim),
|
|
2136
|
-
dimLabel: d == null ? void 0 : d.dim
|
|
2137
|
-
});
|
|
2138
|
-
},
|
|
2139
|
-
children: l.map((v, d) => /* @__PURE__ */ e(
|
|
2140
|
-
J,
|
|
2141
|
-
{
|
|
2142
|
-
fill: v.other ? "#94a3b8" : ce[d % ce.length]
|
|
2143
|
-
},
|
|
2144
|
-
v.dim
|
|
2145
|
-
))
|
|
2084
|
+
/* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({ Cell: J, Pie: Q, PieChart: P, ResponsiveContainer: r, Tooltip: x }) => /* @__PURE__ */ e(r, { width: "100%", height: "100%", children: /* @__PURE__ */ s(P, { children: [
|
|
2085
|
+
/* @__PURE__ */ e(
|
|
2086
|
+
Q,
|
|
2087
|
+
{
|
|
2088
|
+
data: l,
|
|
2089
|
+
dataKey: "value",
|
|
2090
|
+
nameKey: "dim",
|
|
2091
|
+
innerRadius: "58%",
|
|
2092
|
+
outerRadius: "88%",
|
|
2093
|
+
paddingAngle: 2,
|
|
2094
|
+
strokeWidth: 0,
|
|
2095
|
+
className: a.collection ? "cursor-pointer" : void 0,
|
|
2096
|
+
onClick: (v) => {
|
|
2097
|
+
var N, B, U, L;
|
|
2098
|
+
if (!a.collection) return;
|
|
2099
|
+
const d = v == null ? void 0 : v.payload;
|
|
2100
|
+
if (d != null && d.other) return;
|
|
2101
|
+
if (Ee.length > f.length) {
|
|
2102
|
+
const we = f.length === 0 ? (B = (N = a.config) == null ? void 0 : N.dimension) == null ? void 0 : B.field : Ee[f.length - 1];
|
|
2103
|
+
if (we) {
|
|
2104
|
+
q((Pe) => [
|
|
2105
|
+
...Pe,
|
|
2106
|
+
{ field: we, value: String((d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim) ?? "") }
|
|
2107
|
+
]);
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2146
2110
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2111
|
+
const k = (L = (U = a.config) == null ? void 0 : U.dimension) == null ? void 0 : L.field;
|
|
2112
|
+
oe({
|
|
2113
|
+
conditions: qt(
|
|
2114
|
+
a,
|
|
2115
|
+
c,
|
|
2116
|
+
o,
|
|
2117
|
+
(d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim)
|
|
2118
|
+
),
|
|
2119
|
+
title: `${a.title || a.collection} — ${(d == null ? void 0 : d.dim) ?? ""}`,
|
|
2120
|
+
dimField: k,
|
|
2121
|
+
dimRaw: (d == null ? void 0 : d.raw) ?? (d == null ? void 0 : d.dim),
|
|
2122
|
+
dimLabel: d == null ? void 0 : d.dim
|
|
2123
|
+
});
|
|
2124
|
+
},
|
|
2125
|
+
children: l.map((v, d) => /* @__PURE__ */ e(
|
|
2126
|
+
J,
|
|
2150
2127
|
{
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2128
|
+
fill: v.other ? "#94a3b8" : ce[d % ce.length]
|
|
2129
|
+
},
|
|
2130
|
+
v.dim
|
|
2131
|
+
))
|
|
2132
|
+
}
|
|
2133
|
+
),
|
|
2134
|
+
/* @__PURE__ */ e(
|
|
2135
|
+
x,
|
|
2136
|
+
{
|
|
2137
|
+
contentStyle: {
|
|
2138
|
+
fontSize: 12,
|
|
2139
|
+
backgroundColor: "#0f172a",
|
|
2140
|
+
border: "1px solid #334155",
|
|
2141
|
+
borderRadius: 8,
|
|
2142
|
+
color: "#f1f5f9"
|
|
2143
|
+
},
|
|
2144
|
+
labelStyle: { color: "#f1f5f9" },
|
|
2145
|
+
itemStyle: { color: "#e2e8f0" }
|
|
2146
|
+
}
|
|
2147
|
+
)
|
|
2148
|
+
] }) }) }),
|
|
2165
2149
|
/* @__PURE__ */ s("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
2166
2150
|
/* @__PURE__ */ e("span", { className: "text-[17px] font-semibold leading-none text-slate-900 dark:text-foreground", children: T.toLocaleString() }),
|
|
2167
2151
|
/* @__PURE__ */ e("span", { className: "text-[9.5px] text-slate-400", children: "total" })
|
|
@@ -2180,283 +2164,290 @@ const At = _a(function({
|
|
|
2180
2164
|
] }, J.dim)) })
|
|
2181
2165
|
] });
|
|
2182
2166
|
} else if (a.type === "line")
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2167
|
+
Z = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2168
|
+
Area: T,
|
|
2169
|
+
ComposedChart: J,
|
|
2170
|
+
Line: Q,
|
|
2171
|
+
ReferenceLine: P,
|
|
2172
|
+
ResponsiveContainer: r,
|
|
2173
|
+
Tooltip: x,
|
|
2174
|
+
XAxis: v,
|
|
2175
|
+
YAxis: d
|
|
2176
|
+
}) => {
|
|
2177
|
+
var k;
|
|
2178
|
+
return /* @__PURE__ */ e(r, { width: "100%", height: "100%", children: /* @__PURE__ */ s(
|
|
2179
|
+
J,
|
|
2180
|
+
{
|
|
2181
|
+
data: l,
|
|
2182
|
+
margin: { top: 6, right: A ? 4 : 8, left: -10, bottom: 0 },
|
|
2183
|
+
children: [
|
|
2184
|
+
/* @__PURE__ */ e(
|
|
2185
|
+
v,
|
|
2186
|
+
{
|
|
2187
|
+
dataKey: "dim",
|
|
2188
|
+
tick: { fontSize: 10 },
|
|
2189
|
+
stroke: "#94a3b8",
|
|
2190
|
+
..._t(l.length)
|
|
2191
|
+
}
|
|
2192
|
+
),
|
|
2193
|
+
/* @__PURE__ */ e(
|
|
2194
|
+
d,
|
|
2195
|
+
{
|
|
2196
|
+
tick: { fontSize: 10 },
|
|
2197
|
+
stroke: "#94a3b8",
|
|
2198
|
+
tickFormatter: Ce,
|
|
2199
|
+
width: 44
|
|
2200
|
+
}
|
|
2201
|
+
),
|
|
2202
|
+
A && /* @__PURE__ */ e(
|
|
2203
|
+
d,
|
|
2204
|
+
{
|
|
2205
|
+
yAxisId: "right",
|
|
2206
|
+
orientation: "right",
|
|
2207
|
+
tick: { fontSize: 10 },
|
|
2208
|
+
stroke: "#94a3b8",
|
|
2209
|
+
tickFormatter: Ce,
|
|
2210
|
+
width: 44
|
|
2211
|
+
}
|
|
2212
|
+
),
|
|
2213
|
+
ae.map((N) => /* @__PURE__ */ e(
|
|
2214
|
+
P,
|
|
2215
|
+
{
|
|
2216
|
+
x: N.anchor_date,
|
|
2217
|
+
stroke: "#f59e0b",
|
|
2218
|
+
strokeDasharray: "4 3",
|
|
2219
|
+
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2220
|
+
},
|
|
2221
|
+
N.id
|
|
2222
|
+
)),
|
|
2223
|
+
/* @__PURE__ */ e(
|
|
2224
|
+
x,
|
|
2225
|
+
{
|
|
2226
|
+
contentStyle: {
|
|
2227
|
+
fontSize: 12,
|
|
2228
|
+
backgroundColor: "#0f172a",
|
|
2229
|
+
border: "1px solid #334155",
|
|
2230
|
+
borderRadius: 8,
|
|
2231
|
+
color: "#f1f5f9"
|
|
2232
|
+
},
|
|
2233
|
+
labelStyle: { color: "#f1f5f9" },
|
|
2234
|
+
itemStyle: { color: "#e2e8f0" }
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
O && /* @__PURE__ */ e(
|
|
2238
|
+
T,
|
|
2239
|
+
{
|
|
2240
|
+
type: "monotone",
|
|
2241
|
+
dataKey: "band",
|
|
2242
|
+
stroke: "none",
|
|
2243
|
+
fill: "#94a3b8",
|
|
2244
|
+
fillOpacity: 0.15,
|
|
2245
|
+
name: "typical range",
|
|
2246
|
+
activeDot: !1
|
|
2247
|
+
}
|
|
2248
|
+
),
|
|
2249
|
+
((k = a.config) == null ? void 0 : k.compare) && /* @__PURE__ */ e(
|
|
2250
|
+
Q,
|
|
2251
|
+
{
|
|
2252
|
+
type: "monotone",
|
|
2253
|
+
dataKey: "prev",
|
|
2254
|
+
stroke: "#94a3b8",
|
|
2255
|
+
strokeWidth: 1.5,
|
|
2256
|
+
strokeDasharray: "4 3",
|
|
2257
|
+
dot: !1,
|
|
2258
|
+
name: "previous"
|
|
2259
|
+
}
|
|
2260
|
+
),
|
|
2261
|
+
/* @__PURE__ */ e(
|
|
2262
|
+
Q,
|
|
2263
|
+
{
|
|
2264
|
+
type: "monotone",
|
|
2265
|
+
dataKey: "value",
|
|
2266
|
+
stroke: Ve,
|
|
2267
|
+
strokeWidth: 2,
|
|
2268
|
+
dot: (N) => {
|
|
2269
|
+
var B, U, L;
|
|
2270
|
+
return ie.has(((B = N.payload) == null ? void 0 : B.dim) ?? "") ? /* @__PURE__ */ e(
|
|
2271
|
+
"circle",
|
|
2272
|
+
{
|
|
2273
|
+
cx: N.cx,
|
|
2274
|
+
cy: N.cy,
|
|
2275
|
+
r: 3.5,
|
|
2276
|
+
fill: "#ef4444",
|
|
2277
|
+
stroke: "#fff",
|
|
2278
|
+
strokeWidth: 1
|
|
2243
2279
|
},
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
type: "monotone",
|
|
2276
|
-
dataKey: "value",
|
|
2277
|
-
stroke: Ve,
|
|
2278
|
-
strokeWidth: 2,
|
|
2279
|
-
dot: (N) => {
|
|
2280
|
-
var W, U, L;
|
|
2281
|
-
return ie.has(((W = N.payload) == null ? void 0 : W.dim) ?? "") ? /* @__PURE__ */ e(
|
|
2282
|
-
"circle",
|
|
2283
|
-
{
|
|
2284
|
-
cx: N.cx,
|
|
2285
|
-
cy: N.cy,
|
|
2286
|
-
r: 3.5,
|
|
2287
|
-
fill: "#ef4444",
|
|
2288
|
-
stroke: "#fff",
|
|
2289
|
-
strokeWidth: 1
|
|
2290
|
-
},
|
|
2291
|
-
(U = N.payload) == null ? void 0 : U.dim
|
|
2292
|
-
) : /* @__PURE__ */ e("g", {}, (L = N.payload) == null ? void 0 : L.dim);
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
),
|
|
2296
|
-
A && /* @__PURE__ */ e(
|
|
2297
|
-
Q,
|
|
2298
|
-
{
|
|
2299
|
-
yAxisId: "right",
|
|
2300
|
-
type: "monotone",
|
|
2301
|
-
dataKey: "value2",
|
|
2302
|
-
stroke: "#8b5cf6",
|
|
2303
|
-
strokeWidth: 1.5,
|
|
2304
|
-
dot: !1,
|
|
2305
|
-
name: R
|
|
2306
|
-
}
|
|
2307
|
-
),
|
|
2308
|
-
y >= 2 && /* @__PURE__ */ e(
|
|
2309
|
-
Q,
|
|
2310
|
-
{
|
|
2311
|
-
type: "monotone",
|
|
2312
|
-
dataKey: "ma",
|
|
2313
|
-
stroke: "#f59e0b",
|
|
2314
|
-
strokeWidth: 1.5,
|
|
2315
|
-
strokeDasharray: "5 3",
|
|
2316
|
-
dot: !1,
|
|
2317
|
-
name: `${y}-bucket avg`,
|
|
2318
|
-
isAnimationActive: !1
|
|
2319
|
-
}
|
|
2320
|
-
)
|
|
2321
|
-
]
|
|
2322
|
-
}
|
|
2323
|
-
) });
|
|
2280
|
+
(U = N.payload) == null ? void 0 : U.dim
|
|
2281
|
+
) : /* @__PURE__ */ e("g", {}, (L = N.payload) == null ? void 0 : L.dim);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
),
|
|
2285
|
+
A && /* @__PURE__ */ e(
|
|
2286
|
+
Q,
|
|
2287
|
+
{
|
|
2288
|
+
yAxisId: "right",
|
|
2289
|
+
type: "monotone",
|
|
2290
|
+
dataKey: "value2",
|
|
2291
|
+
stroke: "#8b5cf6",
|
|
2292
|
+
strokeWidth: 1.5,
|
|
2293
|
+
dot: !1,
|
|
2294
|
+
name: R
|
|
2295
|
+
}
|
|
2296
|
+
),
|
|
2297
|
+
y >= 2 && /* @__PURE__ */ e(
|
|
2298
|
+
Q,
|
|
2299
|
+
{
|
|
2300
|
+
type: "monotone",
|
|
2301
|
+
dataKey: "ma",
|
|
2302
|
+
stroke: "#f59e0b",
|
|
2303
|
+
strokeWidth: 1.5,
|
|
2304
|
+
strokeDasharray: "5 3",
|
|
2305
|
+
dot: !1,
|
|
2306
|
+
name: `${y}-bucket avg`,
|
|
2307
|
+
isAnimationActive: !1
|
|
2308
|
+
}
|
|
2309
|
+
)
|
|
2310
|
+
]
|
|
2324
2311
|
}
|
|
2325
|
-
}
|
|
2326
|
-
) });
|
|
2312
|
+
) });
|
|
2313
|
+
} }) });
|
|
2327
2314
|
else {
|
|
2328
2315
|
const T = ((se = a.config) == null ? void 0 : se.orientation) === "horizontal";
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2316
|
+
Z = /* @__PURE__ */ e("div", { className: "min-h-[110px] flex-1", children: /* @__PURE__ */ e(Re, { fallback: /* @__PURE__ */ e(Te, { className: "h-full w-full", "aria-busy": "true" }), children: ({
|
|
2317
|
+
Bar: J,
|
|
2318
|
+
Cell: Q,
|
|
2319
|
+
ComposedChart: P,
|
|
2320
|
+
Line: r,
|
|
2321
|
+
ReferenceLine: x,
|
|
2322
|
+
ResponsiveContainer: v,
|
|
2323
|
+
Tooltip: d,
|
|
2324
|
+
XAxis: k,
|
|
2325
|
+
YAxis: N
|
|
2326
|
+
}) => {
|
|
2327
|
+
var B;
|
|
2328
|
+
return /* @__PURE__ */ e(v, { width: "100%", height: "100%", children: /* @__PURE__ */ s(
|
|
2329
|
+
P,
|
|
2330
|
+
{
|
|
2331
|
+
data: l,
|
|
2332
|
+
layout: T ? "vertical" : "horizontal",
|
|
2333
|
+
margin: { top: 6, right: 8, left: T ? 30 : -10, bottom: 0 },
|
|
2334
|
+
children: [
|
|
2335
|
+
T ? /* @__PURE__ */ s(Ge, { children: [
|
|
2336
|
+
/* @__PURE__ */ e(k, { type: "number", tick: { fontSize: 10 }, stroke: "#94a3b8" }),
|
|
2337
|
+
/* @__PURE__ */ e(
|
|
2338
|
+
N,
|
|
2339
|
+
{
|
|
2340
|
+
type: "category",
|
|
2341
|
+
dataKey: "dim",
|
|
2342
|
+
tick: { fontSize: 10 },
|
|
2343
|
+
stroke: "#94a3b8",
|
|
2344
|
+
width: 90
|
|
2345
|
+
}
|
|
2346
|
+
)
|
|
2347
|
+
] }) : /* @__PURE__ */ s(Ge, { children: [
|
|
2348
|
+
/* @__PURE__ */ e(
|
|
2349
|
+
k,
|
|
2350
|
+
{
|
|
2351
|
+
dataKey: "dim",
|
|
2352
|
+
tick: { fontSize: 10 },
|
|
2353
|
+
stroke: "#94a3b8",
|
|
2354
|
+
..._t(l.length)
|
|
2355
|
+
}
|
|
2356
|
+
),
|
|
2357
|
+
/* @__PURE__ */ e(
|
|
2358
|
+
N,
|
|
2359
|
+
{
|
|
2360
|
+
tick: { fontSize: 10 },
|
|
2361
|
+
stroke: "#94a3b8",
|
|
2362
|
+
tickFormatter: Ce,
|
|
2363
|
+
width: 44
|
|
2364
|
+
}
|
|
2365
|
+
),
|
|
2366
|
+
A && /* @__PURE__ */ e(
|
|
2367
|
+
N,
|
|
2368
|
+
{
|
|
2369
|
+
yAxisId: "right",
|
|
2370
|
+
orientation: "right",
|
|
2371
|
+
tick: { fontSize: 10 },
|
|
2372
|
+
stroke: "#94a3b8",
|
|
2373
|
+
tickFormatter: Ce,
|
|
2374
|
+
width: 44
|
|
2375
|
+
}
|
|
2376
|
+
)
|
|
2377
|
+
] }),
|
|
2378
|
+
!T && ae.map((U) => /* @__PURE__ */ e(
|
|
2379
|
+
x,
|
|
2380
|
+
{
|
|
2381
|
+
x: U.anchor_date,
|
|
2382
|
+
stroke: "#f59e0b",
|
|
2383
|
+
strokeDasharray: "4 3",
|
|
2384
|
+
label: { value: "✎", position: "top", fontSize: 11, fill: "#f59e0b" }
|
|
2385
|
+
},
|
|
2386
|
+
U.id
|
|
2387
|
+
)),
|
|
2388
|
+
/* @__PURE__ */ e(
|
|
2389
|
+
d,
|
|
2390
|
+
{
|
|
2391
|
+
contentStyle: {
|
|
2392
|
+
fontSize: 12,
|
|
2393
|
+
backgroundColor: "#0f172a",
|
|
2394
|
+
border: "1px solid #334155",
|
|
2395
|
+
borderRadius: 8,
|
|
2396
|
+
color: "#f1f5f9"
|
|
2397
|
+
},
|
|
2398
|
+
labelStyle: { color: "#f1f5f9" },
|
|
2399
|
+
itemStyle: { color: "#e2e8f0" }
|
|
2400
|
+
}
|
|
2401
|
+
),
|
|
2402
|
+
((B = a.config) == null ? void 0 : B.compare) && /* @__PURE__ */ e(J, { dataKey: "prev", fill: "#cbd5e1", radius: [3, 3, 0, 0], name: "previous" }),
|
|
2403
|
+
/* @__PURE__ */ e(
|
|
2404
|
+
J,
|
|
2405
|
+
{
|
|
2406
|
+
dataKey: "value",
|
|
2407
|
+
fill: Ve,
|
|
2408
|
+
radius: [3, 3, 0, 0],
|
|
2409
|
+
className: a.collection ? "cursor-pointer" : void 0,
|
|
2410
|
+
onClick: (U) => {
|
|
2411
|
+
var Pe;
|
|
2412
|
+
if (!a.collection) return;
|
|
2413
|
+
const L = U == null ? void 0 : U.payload;
|
|
2414
|
+
if (L != null && L.other) return;
|
|
2415
|
+
const we = (Pe = a.config) == null ? void 0 : Pe.dimension;
|
|
2416
|
+
oe({
|
|
2417
|
+
conditions: qt(
|
|
2418
|
+
a,
|
|
2419
|
+
c,
|
|
2420
|
+
o,
|
|
2421
|
+
(L == null ? void 0 : L.raw) ?? (L == null ? void 0 : L.dim)
|
|
2422
|
+
),
|
|
2423
|
+
title: `${a.title || a.collection} — ${(L == null ? void 0 : L.dim) ?? ""}`,
|
|
2424
|
+
dimField: we != null && we.bucket || we == null ? void 0 : we.field,
|
|
2425
|
+
dimRaw: (L == null ? void 0 : L.raw) ?? (L == null ? void 0 : L.dim),
|
|
2426
|
+
dimLabel: L == null ? void 0 : L.dim
|
|
2427
|
+
});
|
|
2428
|
+
},
|
|
2429
|
+
children: l.map((U) => /* @__PURE__ */ e(Q, { fill: U.other ? "#94a3b8" : Ve }, U.dim))
|
|
2430
|
+
}
|
|
2431
|
+
),
|
|
2432
|
+
A && /* @__PURE__ */ e(
|
|
2433
|
+
r,
|
|
2434
|
+
{
|
|
2435
|
+
yAxisId: T ? void 0 : "right",
|
|
2436
|
+
type: "monotone",
|
|
2437
|
+
dataKey: "value2",
|
|
2438
|
+
stroke: "#8b5cf6",
|
|
2439
|
+
strokeWidth: 1.5,
|
|
2440
|
+
dot: !1,
|
|
2441
|
+
name: R
|
|
2442
|
+
}
|
|
2443
|
+
)
|
|
2444
|
+
]
|
|
2454
2445
|
}
|
|
2455
|
-
}
|
|
2456
|
-
) });
|
|
2446
|
+
) });
|
|
2447
|
+
} }) });
|
|
2457
2448
|
}
|
|
2458
2449
|
}
|
|
2459
|
-
return K && p && (
|
|
2450
|
+
return K && p && (Z = /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col justify-center px-1", children: [
|
|
2460
2451
|
/* @__PURE__ */ e("p", { className: "text-[26px] font-bold tabular-nums text-amber-700 dark:text-amber-400", children: p.value == null ? "—" : $e(p.value, xe) }),
|
|
2461
2452
|
/* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
2462
2453
|
"As of ",
|
|
@@ -2481,7 +2472,7 @@ const At = _a(function({
|
|
|
2481
2472
|
try {
|
|
2482
2473
|
sessionStorage.setItem(
|
|
2483
2474
|
`nvr-report-xf:${l.report_id}`,
|
|
2484
|
-
JSON.stringify(
|
|
2475
|
+
JSON.stringify(G ?? [])
|
|
2485
2476
|
);
|
|
2486
2477
|
} catch {
|
|
2487
2478
|
}
|
|
@@ -2525,7 +2516,7 @@ const At = _a(function({
|
|
|
2525
2516
|
type: "button",
|
|
2526
2517
|
title: "Copy chart as image",
|
|
2527
2518
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2528
|
-
onClick: () => void
|
|
2519
|
+
onClick: () => void Ba(D.current, a.title),
|
|
2529
2520
|
children: /* @__PURE__ */ e(Nt, { className: "h-3 w-3" })
|
|
2530
2521
|
}
|
|
2531
2522
|
),
|
|
@@ -2538,12 +2529,12 @@ const At = _a(function({
|
|
|
2538
2529
|
className: "rounded p-0.5 text-slate-300 hover:text-[#00a5cc]",
|
|
2539
2530
|
onClick: () => {
|
|
2540
2531
|
if (M) {
|
|
2541
|
-
|
|
2532
|
+
H(!1);
|
|
2542
2533
|
return;
|
|
2543
2534
|
}
|
|
2544
|
-
if (
|
|
2545
|
-
if (
|
|
2546
|
-
|
|
2535
|
+
if (H(!0), X || F) return;
|
|
2536
|
+
if (E(!0), ve) {
|
|
2537
|
+
z.request(
|
|
2547
2538
|
ct(`/report-studio/${i}/widgets/${a.id}/explain-trend`, {
|
|
2548
2539
|
date_range: o,
|
|
2549
2540
|
entity_filters: c
|
|
@@ -2554,10 +2545,10 @@ const At = _a(function({
|
|
|
2554
2545
|
(n) => me(
|
|
2555
2546
|
(n == null ? void 0 : n.status) === 503 ? "AI is not configured on this instance." : (n == null ? void 0 : n.status) === 400 ? n.message ?? "Not enough data to describe a trend." : "AI is not configured or unavailable."
|
|
2556
2547
|
)
|
|
2557
|
-
).finally(() =>
|
|
2548
|
+
).finally(() => E(!1));
|
|
2558
2549
|
return;
|
|
2559
2550
|
}
|
|
2560
|
-
(
|
|
2551
|
+
(W ? Promise.resolve(W) : z.request(
|
|
2561
2552
|
yt(i, a.id, {
|
|
2562
2553
|
date_range: o,
|
|
2563
2554
|
entity_filters: c
|
|
@@ -2575,7 +2566,7 @@ const At = _a(function({
|
|
|
2575
2566
|
rows: ((n == null ? void 0 : n.rows) ?? []).slice(0, 10),
|
|
2576
2567
|
tiles: (n == null ? void 0 : n.tiles) ?? null
|
|
2577
2568
|
};
|
|
2578
|
-
return
|
|
2569
|
+
return z.request(
|
|
2579
2570
|
ct("/ai/brief", {
|
|
2580
2571
|
context: JSON.stringify(y),
|
|
2581
2572
|
instructions: (n == null ? void 0 : n.prev_value) != null || ((n == null ? void 0 : n.series) ?? []).some((A) => A.prev != null) ? "Compare the current period against the previous one in 2-4 plain sentences: overall direction, the biggest movers up and down, and anything anomalous. No preamble." : "In 2-3 plain sentences, explain what this report metric shows and what stands out (biggest contributor, direction of change). No preamble."
|
|
@@ -2585,7 +2576,7 @@ const At = _a(function({
|
|
|
2585
2576
|
var A, R;
|
|
2586
2577
|
const y = ((A = n.data) == null ? void 0 : A.brief) ?? ((R = n.data) == null ? void 0 : R.text) ?? null;
|
|
2587
2578
|
me(y || "No explanation available.");
|
|
2588
|
-
}).catch(() => me("AI is not configured or unavailable.")).finally(() =>
|
|
2579
|
+
}).catch(() => me("AI is not configured or unavailable.")).finally(() => E(!1));
|
|
2589
2580
|
},
|
|
2590
2581
|
children: /* @__PURE__ */ e(Ot, { className: "h-3 w-3" })
|
|
2591
2582
|
}
|
|
@@ -2622,11 +2613,11 @@ const At = _a(function({
|
|
|
2622
2613
|
type: "button",
|
|
2623
2614
|
title: "Download as CSV",
|
|
2624
2615
|
className: "rounded p-0.5 text-slate-300 hover:text-slate-500",
|
|
2625
|
-
onClick: () =>
|
|
2616
|
+
onClick: () => dl(a, W),
|
|
2626
2617
|
children: /* @__PURE__ */ e(wa, { className: "h-3 w-3" })
|
|
2627
2618
|
}
|
|
2628
2619
|
),
|
|
2629
|
-
/* @__PURE__ */ e(
|
|
2620
|
+
/* @__PURE__ */ e(sl, { reportId: i, widget: a, filterBar: g }),
|
|
2630
2621
|
/* @__PURE__ */ e(
|
|
2631
2622
|
"button",
|
|
2632
2623
|
{
|
|
@@ -2703,7 +2694,7 @@ const At = _a(function({
|
|
|
2703
2694
|
] })
|
|
2704
2695
|
] }),
|
|
2705
2696
|
p && (() => {
|
|
2706
|
-
const l =
|
|
2697
|
+
const l = ol(W), n = p.value;
|
|
2707
2698
|
if (l == null || n == null) return null;
|
|
2708
2699
|
const y = n === 0 ? null : (l - n) / Math.abs(n) * 100;
|
|
2709
2700
|
return /* @__PURE__ */ s("p", { className: "mb-1 flex items-center gap-1 text-[10.5px] text-slate-400", children: [
|
|
@@ -2733,7 +2724,7 @@ const At = _a(function({
|
|
|
2733
2724
|
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",
|
|
2734
2725
|
"data-explain-panel": ve ? "trend" : "number",
|
|
2735
2726
|
children: [
|
|
2736
|
-
F ? "Thinking…" :
|
|
2727
|
+
F ? "Thinking…" : X,
|
|
2737
2728
|
!F && de && de.length > 0 && /* @__PURE__ */ e("div", { className: "mt-1.5 flex flex-wrap gap-1", "data-explain-movers": !0, children: de.slice(0, 4).map((l) => /* @__PURE__ */ s(
|
|
2738
2729
|
"span",
|
|
2739
2730
|
{
|
|
@@ -2783,19 +2774,19 @@ const At = _a(function({
|
|
|
2783
2774
|
)
|
|
2784
2775
|
] }, `${l.field}-${n}`))
|
|
2785
2776
|
] }),
|
|
2786
|
-
/* @__PURE__ */ e("div", { ref: D, className: "flex min-h-0 flex-1 flex-col", children: pe && ((nt =
|
|
2777
|
+
/* @__PURE__ */ e("div", { ref: D, className: "flex min-h-0 flex-1 flex-col", children: pe && ((nt = W == null ? void 0 : W.series) != null && nt.length) ? /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ s("table", { className: "w-full text-[11.5px]", children: [
|
|
2787
2778
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ s("tr", { className: "text-left text-[10px] uppercase tracking-wide text-slate-400", children: [
|
|
2788
2779
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1", children: "Dimension" }),
|
|
2789
2780
|
/* @__PURE__ */ e("th", { className: "px-1.5 pb-1 text-right", children: "Value" })
|
|
2790
2781
|
] }) }),
|
|
2791
|
-
/* @__PURE__ */ e("tbody", { children: (
|
|
2782
|
+
/* @__PURE__ */ e("tbody", { children: (W.series ?? []).map((l) => /* @__PURE__ */ s("tr", { className: "border-b border-slate-50 dark:border-border/40", children: [
|
|
2792
2783
|
/* @__PURE__ */ e("td", { className: "max-w-[220px] truncate px-1.5 py-1 text-slate-700 dark:text-slate-300", children: l.dim }),
|
|
2793
2784
|
/* @__PURE__ */ e("td", { className: "px-1.5 py-1 text-right tabular-nums text-slate-800 dark:text-slate-100", children: $e(l.value, xe) })
|
|
2794
2785
|
] }, l.dim)) })
|
|
2795
|
-
] }) }) :
|
|
2786
|
+
] }) }) : Z }),
|
|
2796
2787
|
((st = a.config) == null ? void 0 : st.footnote) && /* @__PURE__ */ e("p", { className: "mt-1 border-t border-slate-100 pt-1 text-[10.5px] leading-snug text-slate-400 dark:border-border/50", children: a.config.footnote }),
|
|
2797
2788
|
le && /* @__PURE__ */ e(
|
|
2798
|
-
|
|
2789
|
+
cl,
|
|
2799
2790
|
{
|
|
2800
2791
|
collection: a.collection ?? "",
|
|
2801
2792
|
conditions: le.conditions,
|
|
@@ -2817,7 +2808,7 @@ const At = _a(function({
|
|
|
2817
2808
|
}
|
|
2818
2809
|
);
|
|
2819
2810
|
});
|
|
2820
|
-
function
|
|
2811
|
+
function Tl({
|
|
2821
2812
|
reportId: t,
|
|
2822
2813
|
widget: i,
|
|
2823
2814
|
dateRange: a = null,
|
|
@@ -2838,7 +2829,7 @@ function Al({
|
|
|
2838
2829
|
}
|
|
2839
2830
|
);
|
|
2840
2831
|
}
|
|
2841
|
-
function
|
|
2832
|
+
function Ll({
|
|
2842
2833
|
reportId: t,
|
|
2843
2834
|
showFilterBar: i = !0,
|
|
2844
2835
|
dateRange: a,
|
|
@@ -2852,7 +2843,7 @@ function Rl({
|
|
|
2852
2843
|
const p = Le(), K = Vt(), $ = Ca("drill.report"), w = $.value, _ = Ft(
|
|
2853
2844
|
(r) => K ? K.open(r) : $.push([r]),
|
|
2854
2845
|
[K, $.push]
|
|
2855
|
-
), [m, S] = C(void 0), [
|
|
2846
|
+
), [m, S] = C(void 0), [G, z] = C(o), [I, ee] = C(void 0), [ue, j] = C(o), { scopes: le, ready: oe } = Ra(), [fe, be] = C(!1), [Se, _e] = C({}), h = Ct(), { data: te = [] } = ke({
|
|
2856
2847
|
queryKey: ["nivaro-report-presets", t],
|
|
2857
2848
|
queryFn: async () => {
|
|
2858
2849
|
try {
|
|
@@ -2886,14 +2877,14 @@ function Rl({
|
|
|
2886
2877
|
}), pe = qe({
|
|
2887
2878
|
mutationFn: (r) => p.request(oa(t, r)),
|
|
2888
2879
|
onSuccess: re
|
|
2889
|
-
}), [ne, f] = C(""), [q, D] = C(!1), [M,
|
|
2880
|
+
}), [ne, f] = C(""), [q, D] = C(!1), [M, H] = C(null), [X, me] = C(!1), { data: F = [] } = ke({
|
|
2890
2881
|
queryKey: ["nvr-report-snaps", t],
|
|
2891
2882
|
queryFn: () => p.request(
|
|
2892
2883
|
ot(`/report-studio/${t}/snapshots`)
|
|
2893
2884
|
).then((r) => r.data ?? []),
|
|
2894
2885
|
staleTime: 6e4,
|
|
2895
2886
|
retry: !1
|
|
2896
|
-
}), { data:
|
|
2887
|
+
}), { data: E } = ke({
|
|
2897
2888
|
queryKey: ["nvr-report-snap", t, M],
|
|
2898
2889
|
queryFn: () => p.request(
|
|
2899
2890
|
ot(`/report-studio/${t}/snapshots/${M}`)
|
|
@@ -2921,7 +2912,7 @@ function Rl({
|
|
|
2921
2912
|
values: [x],
|
|
2922
2913
|
labels: [v]
|
|
2923
2914
|
};
|
|
2924
|
-
|
|
2915
|
+
z((k) => [...k.filter((N) => N.field !== r), d]), j((k) => [...k.filter((N) => N.field !== r), d]);
|
|
2925
2916
|
}, []), [Ne, Xe] = C(!1), [ye, Me] = C(null), [Ze, Ae] = C(null), De = qe({
|
|
2926
2917
|
mutationFn: (r) => p.request(
|
|
2927
2918
|
qa(`/report-studio/${t}/widgets`, {
|
|
@@ -2931,7 +2922,7 @@ function Rl({
|
|
|
2931
2922
|
onSuccess: () => {
|
|
2932
2923
|
Xe(!1), Me(null), Ae(null), h.invalidateQueries({ queryKey: ["nivaro-report", t] }), h.invalidateQueries({ queryKey: ["nivaro-report-widget"] });
|
|
2933
2924
|
}
|
|
2934
|
-
}), ut = (r) => [...r].sort((x, v) => (x.y ?? 0) - (v.y ?? 0) || (x.x ?? 0) - (v.x ?? 0)), [Ee, pt] = C(() => /* @__PURE__ */ new Date()),
|
|
2925
|
+
}), ut = (r) => [...r].sort((x, v) => (x.y ?? 0) - (v.y ?? 0) || (x.x ?? 0) - (v.x ?? 0)), [Ee, pt] = C(() => /* @__PURE__ */ new Date()), W = () => {
|
|
2935
2926
|
h.invalidateQueries({ queryKey: ["nivaro-report-widget", t] }), h.invalidateQueries({ queryKey: ["nivaro-report-query"] }), pt(/* @__PURE__ */ new Date());
|
|
2936
2927
|
}, { data: xe = [] } = ke({
|
|
2937
2928
|
queryKey: ["nvr-report-firing", t],
|
|
@@ -2939,14 +2930,14 @@ function Rl({
|
|
|
2939
2930
|
staleTime: 6e4,
|
|
2940
2931
|
refetchInterval: 5 * 6e4,
|
|
2941
2932
|
retry: !1
|
|
2942
|
-
}), [he, Ke] = C(null), [We,
|
|
2933
|
+
}), [he, Ke] = C(null), [We, Z] = C(!1), [Be, ht] = C(""), [Qe, ft] = C(""), [Ue, xt] = C("");
|
|
2943
2934
|
wt(() => {
|
|
2944
2935
|
try {
|
|
2945
2936
|
const r = sessionStorage.getItem(`nvr-report-xf:${t}`);
|
|
2946
2937
|
if (r) {
|
|
2947
2938
|
sessionStorage.removeItem(`nvr-report-xf:${t}`);
|
|
2948
2939
|
const x = JSON.parse(r);
|
|
2949
|
-
Array.isArray(x) && x.length > 0 && (
|
|
2940
|
+
Array.isArray(x) && x.length > 0 && (z(x), j(x));
|
|
2950
2941
|
}
|
|
2951
2942
|
} catch {
|
|
2952
2943
|
}
|
|
@@ -2956,14 +2947,14 @@ function Rl({
|
|
|
2956
2947
|
}, Ie = (r) => Me((x) => (x ?? []).map((v) => v.id === r.id ? r : v)), gt = (r, x) => Me((v) => {
|
|
2957
2948
|
const d = [...v ?? []], k = d.findIndex((L) => L.id === r), N = k + x;
|
|
2958
2949
|
if (k < 0 || N < 0 || N >= d.length) return d;
|
|
2959
|
-
const
|
|
2960
|
-
return d[k] = { ...U, x:
|
|
2950
|
+
const B = d[k], U = d[N];
|
|
2951
|
+
return d[k] = { ...U, x: B.x, y: B.y }, d[N] = { ...B, x: U.x, y: U.y }, d;
|
|
2961
2952
|
}), [Ye, et] = C(""), [Je, tt] = C(!1), [at, lt] = C(null), { data: se, isLoading: vt } = ke({
|
|
2962
2953
|
queryKey: ["nivaro-report", t],
|
|
2963
2954
|
queryFn: () => p.request(da(t)).then((r) => r.data),
|
|
2964
2955
|
staleTime: 3e4
|
|
2965
2956
|
}), rt = St(null), nt = St([]), st = ((Q = se == null ? void 0 : se.global_filters) == null ? void 0 : Q.date_range) ?? null, l = dt(() => m !== void 0 ? m : a !== void 0 ? a : st, [m, a, st]);
|
|
2966
|
-
rt.current = l ?? null, nt.current =
|
|
2957
|
+
rt.current = l ?? null, nt.current = G;
|
|
2967
2958
|
const n = dt(
|
|
2968
2959
|
() => {
|
|
2969
2960
|
var r;
|
|
@@ -2986,9 +2977,9 @@ function Rl({
|
|
|
2986
2977
|
collection: (v = d.options) == null ? void 0 : v.collection
|
|
2987
2978
|
});
|
|
2988
2979
|
if (!k) continue;
|
|
2989
|
-
const N = d.options ? d.options.value_field ?? "id" : "id",
|
|
2990
|
-
if (
|
|
2991
|
-
const L = await Dt(p, k,
|
|
2980
|
+
const N = d.options ? d.options.value_field ?? "id" : "id", B = le.restricted[k.name] ?? [];
|
|
2981
|
+
if (B.length > 0) {
|
|
2982
|
+
const L = await Dt(p, k, B, N).catch(
|
|
2992
2983
|
() => []
|
|
2993
2984
|
);
|
|
2994
2985
|
L.length > 0 && (x[d.field] = L);
|
|
@@ -3004,21 +2995,21 @@ function Rl({
|
|
|
3004
2995
|
if (Object.keys(x).length > 0 && _e(x), r.length > 0) {
|
|
3005
2996
|
const d = (k) => {
|
|
3006
2997
|
const N = [...k];
|
|
3007
|
-
for (const
|
|
2998
|
+
for (const B of r) N.some((U) => U.field === B.field) || N.push(B);
|
|
3008
2999
|
return N;
|
|
3009
3000
|
};
|
|
3010
|
-
|
|
3001
|
+
j(d), z(d);
|
|
3011
3002
|
}
|
|
3012
3003
|
be(!0);
|
|
3013
3004
|
})();
|
|
3014
3005
|
}
|
|
3015
3006
|
}, [fe, oe, se, le, n]);
|
|
3016
|
-
const y = (se == null ? void 0 : se.widgets) ?? [], A = I !== void 0 ? I : l, R =
|
|
3017
|
-
|
|
3007
|
+
const y = (se == null ? void 0 : se.widgets) ?? [], A = I !== void 0 ? I : l, R = G.filter((r) => r.values.length > 0).length + (l ? 1 : 0), O = JSON.stringify(ue) !== JSON.stringify(G) || I !== void 0, ie = () => {
|
|
3008
|
+
z(ue), I !== void 0 && (S(I), ee(void 0));
|
|
3018
3009
|
}, ae = () => {
|
|
3019
|
-
|
|
3010
|
+
j([]), z([]), S(null), ee(void 0);
|
|
3020
3011
|
}, T = (r) => {
|
|
3021
|
-
|
|
3012
|
+
j(r.entity_filters), z(r.entity_filters), S(r.date_range), ee(void 0);
|
|
3022
3013
|
}, J = async () => {
|
|
3023
3014
|
var x, v;
|
|
3024
3015
|
const r = Ye.trim();
|
|
@@ -3032,10 +3023,10 @@ function Rl({
|
|
|
3032
3023
|
n.map((N) => ({ field: N.field, label: N.label }))
|
|
3033
3024
|
)
|
|
3034
3025
|
), k = (d.data.entity_filters ?? []).filter((N) => {
|
|
3035
|
-
var
|
|
3036
|
-
return n.some((U) => U.field === N.field) && ((
|
|
3026
|
+
var B;
|
|
3027
|
+
return n.some((U) => U.field === N.field) && ((B = N.values) == null ? void 0 : B.length) > 0;
|
|
3037
3028
|
}).map((N) => ({ field: N.field, values: N.values, labels: N.values.map(String) }));
|
|
3038
|
-
|
|
3029
|
+
j(k), z(k), S(d.data.date_range ?? null), ee(void 0), et("");
|
|
3039
3030
|
} catch (d) {
|
|
3040
3031
|
lt(
|
|
3041
3032
|
((v = (x = d.response) == null ? void 0 : x.data) == null ? void 0 : v.error) ?? "Could not parse that"
|
|
@@ -3060,7 +3051,7 @@ function Rl({
|
|
|
3060
3051
|
{
|
|
3061
3052
|
value: (A == null ? void 0 : A.preset) ?? "",
|
|
3062
3053
|
onChange: (r) => ee(r ? { preset: r } : null),
|
|
3063
|
-
options:
|
|
3054
|
+
options: Ga.map((r) => ({ value: r.id, label: r.label })),
|
|
3064
3055
|
ariaLabel: "Date range",
|
|
3065
3056
|
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"
|
|
3066
3057
|
}
|
|
@@ -3076,7 +3067,7 @@ function Rl({
|
|
|
3076
3067
|
optionSource: r.options,
|
|
3077
3068
|
allowedValues: Se[r.field],
|
|
3078
3069
|
selected: ((x = ue.find((v) => v.field === r.field)) == null ? void 0 : x.values) ?? [],
|
|
3079
|
-
onChange: (v, d) =>
|
|
3070
|
+
onChange: (v, d) => j((k) => [
|
|
3080
3071
|
...k.filter((N) => N.field !== r.field),
|
|
3081
3072
|
...v.length > 0 ? [{ field: r.field, values: v, labels: d }] : []
|
|
3082
3073
|
])
|
|
@@ -3179,7 +3170,7 @@ function Rl({
|
|
|
3179
3170
|
{
|
|
3180
3171
|
type: "button",
|
|
3181
3172
|
title: `Compare against ${r.name} (${new Date(r.taken_at).toLocaleDateString()})`,
|
|
3182
|
-
onClick: () =>
|
|
3173
|
+
onClick: () => H((x) => x === r.id ? null : r.id),
|
|
3183
3174
|
className: Y(
|
|
3184
3175
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3185
3176
|
M === 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"
|
|
@@ -3201,7 +3192,7 @@ function Rl({
|
|
|
3201
3192
|
onClick: () => me((r) => !r),
|
|
3202
3193
|
className: Y(
|
|
3203
3194
|
"inline-flex h-6 items-center gap-1 rounded-full border px-2 text-[11px]",
|
|
3204
|
-
|
|
3195
|
+
X ? "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"
|
|
3205
3196
|
),
|
|
3206
3197
|
children: "As of"
|
|
3207
3198
|
}
|
|
@@ -3248,7 +3239,7 @@ function Rl({
|
|
|
3248
3239
|
"button",
|
|
3249
3240
|
{
|
|
3250
3241
|
type: "button",
|
|
3251
|
-
onClick:
|
|
3242
|
+
onClick: W,
|
|
3252
3243
|
className: "inline-flex items-center gap-1 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400",
|
|
3253
3244
|
children: [
|
|
3254
3245
|
/* @__PURE__ */ e(Mt, { className: "h-2.5 w-2.5" }),
|
|
@@ -3261,7 +3252,7 @@ function Rl({
|
|
|
3261
3252
|
"button",
|
|
3262
3253
|
{
|
|
3263
3254
|
type: "button",
|
|
3264
|
-
onClick: () =>
|
|
3255
|
+
onClick: () => Z((r) => !r),
|
|
3265
3256
|
className: Y(
|
|
3266
3257
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
3267
3258
|
he ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] font-medium text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400"
|
|
@@ -3316,7 +3307,7 @@ function Rl({
|
|
|
3316
3307
|
type: "button",
|
|
3317
3308
|
disabled: !Be.trim() || !Qe.trim() || !Ue.trim(),
|
|
3318
3309
|
onClick: () => {
|
|
3319
|
-
Ke({ field: Be.trim(), a: Qe.trim(), b: Ue.trim() }),
|
|
3310
|
+
Ke({ field: Be.trim(), a: Qe.trim(), b: Ue.trim() }), Z(!1);
|
|
3320
3311
|
},
|
|
3321
3312
|
className: "h-7 rounded-md bg-nvr-cyan text-[11.5px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
|
|
3322
3313
|
children: "Compare"
|
|
@@ -3325,7 +3316,7 @@ function Rl({
|
|
|
3325
3316
|
] })
|
|
3326
3317
|
] })
|
|
3327
3318
|
] }),
|
|
3328
|
-
|
|
3319
|
+
G.filter((r) => !n.some((x) => x.field === r.field)).length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5 px-1 pb-2", children: G.filter((r) => !n.some((x) => x.field === r.field)).map((r) => /* @__PURE__ */ s(
|
|
3329
3320
|
"span",
|
|
3330
3321
|
{
|
|
3331
3322
|
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",
|
|
@@ -3339,7 +3330,7 @@ function Rl({
|
|
|
3339
3330
|
type: "button",
|
|
3340
3331
|
"aria-label": "Remove filter",
|
|
3341
3332
|
onClick: () => {
|
|
3342
|
-
|
|
3333
|
+
z((x) => x.filter((v) => v.field !== r.field)), j((x) => x.filter((v) => v.field !== r.field));
|
|
3343
3334
|
},
|
|
3344
3335
|
className: "rounded-full p-0.5 hover:bg-nvr-cyan/[0.16]",
|
|
3345
3336
|
children: /* @__PURE__ */ e(Fe, { className: "h-2.5 w-2.5" })
|
|
@@ -3382,7 +3373,7 @@ function Rl({
|
|
|
3382
3373
|
}
|
|
3383
3374
|
) }),
|
|
3384
3375
|
Ne && ye && /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e($t, { fallback: null, children: /* @__PURE__ */ e(
|
|
3385
|
-
|
|
3376
|
+
Ya,
|
|
3386
3377
|
{
|
|
3387
3378
|
maxY: Math.max(0, ...ye.map((r) => (r.y ?? 0) + (r.h ?? 1))),
|
|
3388
3379
|
onAdd: (r) => Me((x) => [...x ?? [], r])
|
|
@@ -3419,7 +3410,7 @@ function Rl({
|
|
|
3419
3410
|
widget: r,
|
|
3420
3411
|
dateRange: l,
|
|
3421
3412
|
entityFilters: [
|
|
3422
|
-
...
|
|
3413
|
+
...G.filter((k) => k.field !== he.field),
|
|
3423
3414
|
{ field: he.field, values: [v], labels: [v] }
|
|
3424
3415
|
],
|
|
3425
3416
|
refetchInterval: c,
|
|
@@ -3429,7 +3420,7 @@ function Rl({
|
|
|
3429
3420
|
)
|
|
3430
3421
|
] }, d)) }) : /* @__PURE__ */ s(Ge, { children: [
|
|
3431
3422
|
Ne && /* @__PURE__ */ e($t, { fallback: null, children: /* @__PURE__ */ e(
|
|
3432
|
-
|
|
3423
|
+
Va,
|
|
3433
3424
|
{
|
|
3434
3425
|
widget: r,
|
|
3435
3426
|
onConfigure: () => Ae(r.id),
|
|
@@ -3448,18 +3439,18 @@ function Rl({
|
|
|
3448
3439
|
reportId: t,
|
|
3449
3440
|
widget: r,
|
|
3450
3441
|
dateRange: l,
|
|
3451
|
-
entityFilters:
|
|
3442
|
+
entityFilters: G,
|
|
3452
3443
|
refetchInterval: c,
|
|
3453
3444
|
filterBar: n,
|
|
3454
3445
|
onDrill: _,
|
|
3455
|
-
snapshot:
|
|
3456
|
-
asOf:
|
|
3446
|
+
snapshot: E && E.data[r.id] !== void 0 ? { name: E.name, value: ((x = E.data[r.id]) == null ? void 0 : x.value) ?? null } : null,
|
|
3447
|
+
asOf: X,
|
|
3457
3448
|
annotations: ge.filter((v) => v.widget === r.id),
|
|
3458
3449
|
onAddAnnotation: (v, d, k) => Oe.mutate({ widget: v, note: d, anchor_date: k }),
|
|
3459
3450
|
onDeleteAnnotation: (v) => He.mutate(v),
|
|
3460
3451
|
onCrossFilter: mt,
|
|
3461
3452
|
reportUrl: b,
|
|
3462
|
-
currentFilters:
|
|
3453
|
+
currentFilters: G
|
|
3463
3454
|
}
|
|
3464
3455
|
)
|
|
3465
3456
|
] })
|
|
@@ -3470,7 +3461,7 @@ function Rl({
|
|
|
3470
3461
|
}
|
|
3471
3462
|
),
|
|
3472
3463
|
Ne && Ze && (ye == null ? void 0 : ye.some((r) => r.id === Ze)) && /* @__PURE__ */ e($t, { fallback: null, children: /* @__PURE__ */ e(
|
|
3473
|
-
|
|
3464
|
+
Ja,
|
|
3474
3465
|
{
|
|
3475
3466
|
widget: ye.find((r) => r.id === Ze),
|
|
3476
3467
|
allWidgets: ye,
|
|
@@ -3478,9 +3469,9 @@ function Rl({
|
|
|
3478
3469
|
onClose: () => Ae(null)
|
|
3479
3470
|
}
|
|
3480
3471
|
) }),
|
|
3481
|
-
/* @__PURE__ */ e(
|
|
3472
|
+
/* @__PURE__ */ e(Ka, {}),
|
|
3482
3473
|
!K && (w != null && w.length) ? /* @__PURE__ */ e(
|
|
3483
|
-
|
|
3474
|
+
Da,
|
|
3484
3475
|
{
|
|
3485
3476
|
collection: w[0].collection,
|
|
3486
3477
|
itemId: w[0].itemId,
|
|
@@ -3495,8 +3486,8 @@ function Rl({
|
|
|
3495
3486
|
] }) : /* @__PURE__ */ e("div", { className: Y("p-6 text-[13px] text-slate-400", u), children: "Report not found." });
|
|
3496
3487
|
}
|
|
3497
3488
|
export {
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3489
|
+
sl as AlertBell,
|
|
3490
|
+
tl as QueryWidgetBody,
|
|
3491
|
+
Ll as ReportView,
|
|
3492
|
+
Tl as ReportWidgetCard
|
|
3502
3493
|
};
|