@object-ui/plugin-report 14.0.0 → 15.0.0

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/index.js CHANGED
@@ -1,56 +1,56 @@
1
- import { ComponentRegistry as e, buildDatasetDrillFilter as t, buildDatasetFieldHelpers as n, formatDimensionValue as r, formatMeasure as i } from "@object-ui/core";
2
- import * as a from "react";
3
- import o from "react";
4
- import { isSpecReport as s, specReportToPresentation as c } from "@object-ui/types";
5
- import { SchemaRenderer as l, SchemaRendererContext as u } from "@object-ui/react";
6
- import { Badge as d, Button as f, Card as p, CardContent as m, CardDescription as h, CardHeader as g, CardTitle as _, Skeleton as v } from "@object-ui/components";
7
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
8
- import { AlertTriangle as x, Download as S, Loader2 as C, Printer as w, RefreshCw as T, Table2 as E } from "lucide-react";
9
- import { getCellRenderer as D, resolveCellRendererType as O } from "@object-ui/fields";
10
- import { useSafeFieldLabel as k, useSafeTranslate as A } from "@object-ui/i18n";
1
+ import { ComponentRegistry as e, buildDatasetDrillFilter as t, buildDatasetFieldHelpers as n, formatDimensionValue as r, formatMeasure as i, mergeFilters as a } from "@object-ui/core";
2
+ import * as o from "react";
3
+ import s from "react";
4
+ import { isSpecReport as c, specReportToPresentation as l } from "@object-ui/types";
5
+ import { SchemaRenderer as u, SchemaRendererContext as d } from "@object-ui/react";
6
+ import { Badge as f, Button as p, Card as m, CardContent as h, CardDescription as g, CardHeader as _, CardTitle as v, Skeleton as y } from "@object-ui/components";
7
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
8
+ import { AlertTriangle as S, Download as C, Loader2 as w, Printer as T, RefreshCw as E, Table2 as D } from "lucide-react";
9
+ import { getCellRenderer as O, resolveCellRendererType as k } from "@object-ui/fields";
10
+ import { useSafeFieldLabel as A, useSafeTranslate as j } from "@object-ui/i18n";
11
11
  //#region src/LegacyReportRenderer.tsx
12
- var j = ({ schema: t }) => {
12
+ var M = ({ schema: t }) => {
13
13
  let { title: n, description: r, data: i, columns: a } = t;
14
14
  t.chart?.type;
15
15
  let o = !!t.chart;
16
- return /* @__PURE__ */ b(p, {
16
+ return /* @__PURE__ */ x(m, {
17
17
  className: `h-full flex flex-col ${t.className || ""}`,
18
- children: [/* @__PURE__ */ b(g, { children: [n && /* @__PURE__ */ y(_, { children: n }), r && /* @__PURE__ */ y(h, { children: r })] }), /* @__PURE__ */ b(m, {
18
+ children: [/* @__PURE__ */ x(_, { children: [n && /* @__PURE__ */ b(v, { children: n }), r && /* @__PURE__ */ b(g, { children: r })] }), /* @__PURE__ */ x(h, {
19
19
  className: "flex-1 overflow-auto space-y-4",
20
20
  children: [o && (() => {
21
21
  let n = t.chart?.type, r = n ? e.get(n) : null;
22
- return r ||= e.get("chart"), r ? /* @__PURE__ */ y("div", {
22
+ return r ||= e.get("chart"), r ? /* @__PURE__ */ b("div", {
23
23
  className: "min-h-[300px] border rounded-lg p-4 bg-background/50",
24
- children: /* @__PURE__ */ y(r, { schema: {
24
+ children: /* @__PURE__ */ b(r, { schema: {
25
25
  ...t.chart,
26
26
  data: t.chart.data || i
27
27
  } })
28
- }) : /* @__PURE__ */ b("div", {
28
+ }) : /* @__PURE__ */ x("div", {
29
29
  className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center",
30
30
  children: ["Unknown component type: ", n || "chart"]
31
31
  });
32
- })(), i && i.length > 0 && /* @__PURE__ */ y("div", {
32
+ })(), i && i.length > 0 && /* @__PURE__ */ b("div", {
33
33
  className: "border rounded-lg",
34
34
  children: (() => {
35
35
  let t = e.get("grid") || e.get("table");
36
- return t ? /* @__PURE__ */ y(t, { schema: {
36
+ return t ? /* @__PURE__ */ b(t, { schema: {
37
37
  type: "grid",
38
38
  rowData: i,
39
39
  columnDefs: a,
40
40
  domLayout: "autoHeight"
41
- } }) : /* @__PURE__ */ y("div", {
41
+ } }) : /* @__PURE__ */ b("div", {
42
42
  className: "overflow-x-auto",
43
- children: /* @__PURE__ */ b("table", {
43
+ children: /* @__PURE__ */ x("table", {
44
44
  className: "w-full text-sm text-left",
45
- children: [/* @__PURE__ */ y("thead", {
45
+ children: [/* @__PURE__ */ b("thead", {
46
46
  className: "text-xs uppercase bg-muted",
47
- children: /* @__PURE__ */ y("tr", { children: a?.map((e) => /* @__PURE__ */ y("th", {
47
+ children: /* @__PURE__ */ b("tr", { children: a?.map((e) => /* @__PURE__ */ b("th", {
48
48
  className: "px-6 py-3",
49
49
  children: e.headerName || e.label || e.field
50
50
  }, e.field)) })
51
- }), /* @__PURE__ */ y("tbody", { children: i.map((e, t) => /* @__PURE__ */ y("tr", {
51
+ }), /* @__PURE__ */ b("tbody", { children: i.map((e, t) => /* @__PURE__ */ b("tr", {
52
52
  className: "bg-background border-b",
53
- children: a?.map((t) => /* @__PURE__ */ y("td", {
53
+ children: a?.map((t) => /* @__PURE__ */ b("td", {
54
54
  className: "px-6 py-4",
55
55
  children: e[t.field]
56
56
  }, t.field))
@@ -64,14 +64,14 @@ var j = ({ schema: t }) => {
64
64
  };
65
65
  //#endregion
66
66
  //#region src/ReportExportEngine.ts
67
- function M(e, t, n) {
67
+ function N(e, t, n) {
68
68
  let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
69
69
  let n = e[t.name];
70
- return n = R(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
70
+ return n = z(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
71
71
  }));
72
72
  V([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
73
73
  }
74
- function ee(e, t, n) {
74
+ function P(e, t, n) {
75
75
  let r = {
76
76
  title: e.title,
77
77
  description: e.description,
@@ -80,13 +80,13 @@ function ee(e, t, n) {
80
80
  };
81
81
  V(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
82
82
  }
83
- function N(e, t, n) {
84
- let r = e.fields || [], i = B(n?.orientation), a = z(n?.pageSize);
83
+ function F(e, t, n) {
84
+ let r = e.fields || [], i = te(n?.orientation), a = B(n?.pageSize);
85
85
  V(`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
89
- <title>${L(e.title || "Report")}</title>
89
+ <title>${R(e.title || "Report")}</title>
90
90
  <style>
91
91
  @page { size: ${a} ${i}; margin: 20mm; }
92
92
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
@@ -100,20 +100,20 @@ function N(e, t, n) {
100
100
  </style>
101
101
  </head>
102
102
  <body>
103
- <h1>${L(e.title || "Report")}</h1>
104
- ${e.description ? `<p class="description">${L(e.description)}</p>` : ""}
103
+ <h1>${R(e.title || "Report")}</h1>
104
+ ${e.description ? `<p class="description">${R(e.description)}</p>` : ""}
105
105
  <p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
106
106
  <table>
107
- <thead><tr>${r.map((e) => `<th>${L(e.label || e.name)}</th>`).join("")}</tr></thead>
108
- <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${L(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
107
+ <thead><tr>${r.map((e) => `<th>${R(e.label || e.name)}</th>`).join("")}</tr></thead>
108
+ <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${R(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
109
109
  </table>
110
110
  </body>
111
111
  </html>`, n?.filename || `${e.title || "report"}.html`, "text/html");
112
112
  }
113
- function P(e, t, n) {
114
- let r = e.fields || [], i = B(n?.orientation), a = z(n?.pageSize), o = window.open("", "_blank");
113
+ function ee(e, t, n) {
114
+ let r = e.fields || [], i = te(n?.orientation), a = B(n?.pageSize), o = window.open("", "_blank");
115
115
  if (!o) {
116
- N(e, t, {
116
+ F(e, t, {
117
117
  ...n,
118
118
  format: "html",
119
119
  filename: n?.filename?.replace(/\.pdf$/, ".html") || `${e.title || "report"}.html`
@@ -124,7 +124,7 @@ function P(e, t, n) {
124
124
  <html>
125
125
  <head>
126
126
  <meta charset="utf-8">
127
- <title>${L(e.title || "Report")}</title>
127
+ <title>${R(e.title || "Report")}</title>
128
128
  <style>
129
129
  @page { size: ${a} ${i}; margin: 20mm; }
130
130
  @media print { .no-print { display: none; } }
@@ -139,56 +139,56 @@ function P(e, t, n) {
139
139
  </style>
140
140
  </head>
141
141
  <body>
142
- <h1>${L(e.title || "Report")}</h1>
143
- ${e.description ? `<p class="description">${L(e.description)}</p>` : ""}
142
+ <h1>${R(e.title || "Report")}</h1>
143
+ ${e.description ? `<p class="description">${R(e.description)}</p>` : ""}
144
144
  <p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
145
145
  <table>
146
- <thead><tr>${r.map((e) => `<th>${L(e.label || e.name)}</th>`).join("")}</tr></thead>
147
- <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${L(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
146
+ <thead><tr>${r.map((e) => `<th>${R(e.label || e.name)}</th>`).join("")}</tr></thead>
147
+ <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${R(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
148
148
  </table>
149
149
  </body>
150
150
  </html>`), o.document.close(), o.onload = () => {
151
151
  o.print();
152
152
  };
153
153
  }
154
- function F(e, t, n) {
154
+ function I(e, t, n) {
155
155
  let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
156
156
  let n = e[t.name];
157
- return n = R(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
157
+ return n = z(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
158
158
  }));
159
159
  V("" + [...n?.includeHeaders === !1 ? [] : [i.join(" ")], ...a.map((e) => e.join(" "))].join("\n"), n?.filename || `${e.title || "report"}.tsv`, "text/tab-separated-values");
160
160
  }
161
- function I(e, t, n, r) {
161
+ function L(e, t, n, r) {
162
162
  switch (e) {
163
163
  case "csv":
164
- M(t, n, r);
164
+ N(t, n, r);
165
165
  break;
166
166
  case "json":
167
- ee(t, n, r);
167
+ P(t, n, r);
168
168
  break;
169
169
  case "html":
170
- N(t, n, r);
170
+ F(t, n, r);
171
171
  break;
172
172
  case "pdf":
173
- P(t, n, r);
173
+ ee(t, n, r);
174
174
  break;
175
175
  case "excel":
176
- F(t, n, r);
176
+ I(t, n, r);
177
177
  break;
178
178
  default: console.warn(`Unsupported export format: ${e}`);
179
179
  }
180
180
  }
181
- function L(e) {
181
+ function R(e) {
182
182
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
183
183
  }
184
- function R(e) {
184
+ function z(e) {
185
185
  if (typeof e == "string" && e.length > 0) {
186
186
  let t = e.charAt(0);
187
187
  if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `\t${e}`;
188
188
  }
189
189
  return e;
190
190
  }
191
- function z(e) {
191
+ function B(e) {
192
192
  return [
193
193
  "A4",
194
194
  "A3",
@@ -196,7 +196,7 @@ function z(e) {
196
196
  "Legal"
197
197
  ].includes(e || "") ? e : "A4";
198
198
  }
199
- function B(e) {
199
+ function te(e) {
200
200
  return e === "landscape" ? "landscape" : "portrait";
201
201
  }
202
202
  function V(e, t, n) {
@@ -208,7 +208,7 @@ function V(e, t, n) {
208
208
  function H(e, t) {
209
209
  if (e == null || e === "") return "";
210
210
  let n = t?.type, r = t?.format;
211
- if (n === "date" || r === "date" || te(e)) return ne(e);
211
+ if (n === "date" || r === "date" || ne(e)) return re(e);
212
212
  if (n === "number" || typeof e == "number") {
213
213
  let t = typeof e == "number" ? e : Number(e);
214
214
  return isNaN(t) ? String(e) : r === "currency" || r === "currency_cny" ? `¥${t.toLocaleString("en-US", {
@@ -224,10 +224,10 @@ function H(e, t) {
224
224
  }
225
225
  return String(e);
226
226
  }
227
- function te(e) {
227
+ function ne(e) {
228
228
  return typeof e == "string" && /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e);
229
229
  }
230
- function ne(e) {
230
+ function re(e) {
231
231
  try {
232
232
  let t = new Date(e);
233
233
  return isNaN(t.getTime()) ? String(e) : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
@@ -237,7 +237,7 @@ function ne(e) {
237
237
  }
238
238
  //#endregion
239
239
  //#region src/ReportViewer.tsx
240
- function re(e, t) {
240
+ function ie(e, t) {
241
241
  if (!t || t.length === 0 || !e || e.length === 0) return null;
242
242
  let n = t[0], r = n.field, i = /* @__PURE__ */ new Map();
243
243
  for (let t of e) {
@@ -254,17 +254,17 @@ function re(e, t) {
254
254
  return a.sort((e, t) => e.key.localeCompare(t.key) * o), a;
255
255
  }
256
256
  var U = ({ schema: t, onRefresh: n }) => {
257
- let { report: r, data: i, showToolbar: a = !0, allowExport: s = !0, allowPrint: c = !0, loading: u = !1 } = t, x = (e) => {
257
+ let { report: r, data: i, showToolbar: a = !0, allowExport: o = !0, allowPrint: c = !0, loading: l = !1 } = t, d = (e) => {
258
258
  if (!r) {
259
259
  console.warn("ReportViewer: Cannot export, no report defined");
260
260
  return;
261
261
  }
262
- I(e, r, i || [], r.exportConfigs?.[e]);
263
- }, C = () => {
262
+ L(e, r, i || [], r.exportConfigs?.[e]);
263
+ }, S = () => {
264
264
  window.print();
265
- }, E = () => {
265
+ }, w = () => {
266
266
  n?.();
267
- }, k = (e, t) => {
267
+ }, D = (e, t) => {
268
268
  if (!i) return 0;
269
269
  let n = i.map((t) => Number(t[e]) || 0);
270
270
  switch (t) {
@@ -304,7 +304,7 @@ var U = ({ schema: t, onRefresh: n }) => {
304
304
  }
305
305
  }, j = (e, t) => {
306
306
  if (e == null || e === "") return "";
307
- if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) return /* @__PURE__ */ y(d, {
307
+ if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) return /* @__PURE__ */ b(f, {
308
308
  className: t.colorMap?.[String(e)] || "",
309
309
  children: String(e)
310
310
  });
@@ -315,114 +315,114 @@ var U = ({ schema: t, onRefresh: n }) => {
315
315
  value: e,
316
316
  label: e,
317
317
  color: t
318
- }))), /* @__PURE__ */ y(D(O(n)), {
318
+ }))), /* @__PURE__ */ b(O(k(n)), {
319
319
  value: e,
320
320
  field: n
321
321
  });
322
322
  }
323
323
  return H(e, t);
324
324
  };
325
- return r ? /* @__PURE__ */ b("div", {
325
+ return r ? /* @__PURE__ */ x("div", {
326
326
  className: "space-y-4",
327
- children: [a && /* @__PURE__ */ b("div", {
327
+ children: [a && /* @__PURE__ */ x("div", {
328
328
  className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",
329
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h2", {
329
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h2", {
330
330
  className: "text-lg font-semibold",
331
331
  children: r.title
332
- }), r.description && /* @__PURE__ */ y("p", {
332
+ }), r.description && /* @__PURE__ */ b("p", {
333
333
  className: "text-sm text-muted-foreground",
334
334
  children: r.description
335
- })] }), /* @__PURE__ */ b("div", {
335
+ })] }), /* @__PURE__ */ x("div", {
336
336
  className: "flex items-center gap-2",
337
337
  children: [
338
- r.refreshInterval && /* @__PURE__ */ b(f, {
338
+ r.refreshInterval && /* @__PURE__ */ x(p, {
339
339
  variant: "outline",
340
340
  size: "sm",
341
- onClick: E,
342
- children: [/* @__PURE__ */ y(T, { className: "h-4 w-4 mr-2" }), "Refresh"]
341
+ onClick: w,
342
+ children: [/* @__PURE__ */ b(E, { className: "h-4 w-4 mr-2" }), "Refresh"]
343
343
  }),
344
- c && /* @__PURE__ */ b(f, {
344
+ c && /* @__PURE__ */ x(p, {
345
345
  variant: "outline",
346
346
  size: "sm",
347
- onClick: C,
348
- children: [/* @__PURE__ */ y(w, { className: "h-4 w-4 mr-2" }), "Print"]
347
+ onClick: S,
348
+ children: [/* @__PURE__ */ b(T, { className: "h-4 w-4 mr-2" }), "Print"]
349
349
  }),
350
- s && r.showExportButtons && /* @__PURE__ */ b("div", {
350
+ o && r.showExportButtons && /* @__PURE__ */ x("div", {
351
351
  className: "flex items-center gap-1",
352
352
  children: [
353
- /* @__PURE__ */ b(f, {
353
+ /* @__PURE__ */ x(p, {
354
354
  variant: "outline",
355
355
  size: "sm",
356
- onClick: () => x("pdf"),
357
- children: [/* @__PURE__ */ y(S, { className: "h-4 w-4 mr-2" }), "PDF"]
356
+ onClick: () => d("pdf"),
357
+ children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "PDF"]
358
358
  }),
359
- /* @__PURE__ */ b(f, {
359
+ /* @__PURE__ */ x(p, {
360
360
  variant: "outline",
361
361
  size: "sm",
362
- onClick: () => x("excel"),
363
- children: [/* @__PURE__ */ y(S, { className: "h-4 w-4 mr-2" }), "Excel"]
362
+ onClick: () => d("excel"),
363
+ children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "Excel"]
364
364
  }),
365
- /* @__PURE__ */ b(f, {
365
+ /* @__PURE__ */ x(p, {
366
366
  variant: "outline",
367
367
  size: "sm",
368
- onClick: () => x("csv"),
369
- children: [/* @__PURE__ */ y(S, { className: "h-4 w-4 mr-2" }), "CSV"]
368
+ onClick: () => d("csv"),
369
+ children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "CSV"]
370
370
  })
371
371
  ]
372
372
  })
373
373
  ]
374
374
  })]
375
- }), /* @__PURE__ */ b(p, { children: [/* @__PURE__ */ b(g, { children: [!a && r.title && /* @__PURE__ */ y(_, { children: r.title }), !a && r.description && /* @__PURE__ */ y(h, { children: r.description })] }), /* @__PURE__ */ b(m, {
375
+ }), /* @__PURE__ */ x(m, { children: [/* @__PURE__ */ x(_, { children: [!a && r.title && /* @__PURE__ */ b(v, { children: r.title }), !a && r.description && /* @__PURE__ */ b(g, { children: r.description })] }), /* @__PURE__ */ x(h, {
376
376
  className: "space-y-6",
377
377
  children: [
378
- u && /* @__PURE__ */ b("div", {
378
+ l && /* @__PURE__ */ x("div", {
379
379
  className: "space-y-6",
380
- children: [/* @__PURE__ */ y("div", {
380
+ children: [/* @__PURE__ */ b("div", {
381
381
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
382
382
  children: [
383
383
  1,
384
384
  2,
385
385
  3
386
- ].map((e) => /* @__PURE__ */ y(p, { children: /* @__PURE__ */ b(m, {
386
+ ].map((e) => /* @__PURE__ */ b(m, { children: /* @__PURE__ */ x(h, {
387
387
  className: "p-4 space-y-2",
388
- children: [/* @__PURE__ */ y(v, { className: "h-4 w-20" }), /* @__PURE__ */ y(v, { className: "h-8 w-28" })]
388
+ children: [/* @__PURE__ */ b(y, { className: "h-4 w-20" }), /* @__PURE__ */ b(y, { className: "h-8 w-28" })]
389
389
  }) }, e))
390
- }), /* @__PURE__ */ b("div", {
390
+ }), /* @__PURE__ */ x("div", {
391
391
  className: "space-y-2",
392
- children: [/* @__PURE__ */ y(v, { className: "h-10 w-full" }), [
392
+ children: [/* @__PURE__ */ b(y, { className: "h-10 w-full" }), [
393
393
  1,
394
394
  2,
395
395
  3,
396
396
  4,
397
397
  5
398
- ].map((e) => /* @__PURE__ */ y(v, { className: "h-8 w-full" }, e))]
398
+ ].map((e) => /* @__PURE__ */ b(y, { className: "h-8 w-full" }, e))]
399
399
  })]
400
400
  }),
401
- !u && r.sections?.map((t, n) => t.visible === !1 ? null : /* @__PURE__ */ b("div", {
401
+ !l && r.sections?.map((t, n) => t.visible === !1 ? null : /* @__PURE__ */ x("div", {
402
402
  className: "space-y-2",
403
403
  children: [
404
- t.title && t.type !== "header" && /* @__PURE__ */ y("h3", {
404
+ t.title && t.type !== "header" && /* @__PURE__ */ b("h3", {
405
405
  className: "text-lg font-semibold border-b pb-2",
406
406
  children: t.title
407
407
  }),
408
- t.type === "header" && t.title && /* @__PURE__ */ y("div", {
408
+ t.type === "header" && t.title && /* @__PURE__ */ b("div", {
409
409
  className: "text-2xl font-bold py-4",
410
410
  children: t.title
411
411
  }),
412
- t.type === "summary" && /* @__PURE__ */ y("div", {
412
+ t.type === "summary" && /* @__PURE__ */ b("div", {
413
413
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
414
- children: r.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ y(p, { children: /* @__PURE__ */ b(m, {
414
+ children: r.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ b(m, { children: /* @__PURE__ */ x(h, {
415
415
  className: "p-4",
416
- children: [/* @__PURE__ */ y("div", {
416
+ children: [/* @__PURE__ */ b("div", {
417
417
  className: "text-sm text-muted-foreground",
418
418
  children: e.label || e.name
419
- }), /* @__PURE__ */ y("div", {
419
+ }), /* @__PURE__ */ b("div", {
420
420
  className: "text-2xl font-bold",
421
- children: H(k(e.name, e.aggregation), e)
421
+ children: H(D(e.name, e.aggregation), e)
422
422
  })]
423
423
  }) }, t))
424
424
  }),
425
- t.type === "chart" && t.chart && /* @__PURE__ */ y("div", {
425
+ t.type === "chart" && t.chart && /* @__PURE__ */ b("div", {
426
426
  className: "min-h-[300px]",
427
427
  children: (() => {
428
428
  let n = t.chart.type, r = !!t.chart.chartType;
@@ -432,7 +432,7 @@ var U = ({ schema: t, onRefresh: n }) => {
432
432
  series: t.chart.series || (t.chart.yAxisFields ? t.chart.yAxisFields.map((e) => ({ dataKey: e })) : []),
433
433
  chartType: t.chart.chartType || "bar"
434
434
  } : {};
435
- return /* @__PURE__ */ y(l, { schema: {
435
+ return /* @__PURE__ */ b(u, { schema: {
436
436
  ...t.chart,
437
437
  type: n,
438
438
  ...a,
@@ -441,21 +441,21 @@ var U = ({ schema: t, onRefresh: n }) => {
441
441
  } });
442
442
  })()
443
443
  }),
444
- t.type === "table" && /* @__PURE__ */ y("div", {
444
+ t.type === "table" && /* @__PURE__ */ b("div", {
445
445
  className: "border rounded-lg overflow-x-auto",
446
- children: /* @__PURE__ */ b("table", {
446
+ children: /* @__PURE__ */ x("table", {
447
447
  className: "w-full text-sm min-w-[600px]",
448
- children: [/* @__PURE__ */ y("thead", {
448
+ children: [/* @__PURE__ */ b("thead", {
449
449
  className: "bg-muted",
450
- children: /* @__PURE__ */ y("tr", { children: t.columns?.map((e, t) => /* @__PURE__ */ y("th", {
450
+ children: /* @__PURE__ */ b("tr", { children: t.columns?.map((e, t) => /* @__PURE__ */ b("th", {
451
451
  className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
452
452
  children: e.label || e.name
453
453
  }, t)) })
454
- }), /* @__PURE__ */ y("tbody", { children: (() => {
455
- let e = re(i || [], r.groupBy || []);
456
- return e ? e.map((e) => /* @__PURE__ */ b(o.Fragment, { children: [/* @__PURE__ */ y("tr", {
454
+ }), /* @__PURE__ */ b("tbody", { children: (() => {
455
+ let e = ie(i || [], r.groupBy || []);
456
+ return e ? e.map((e) => /* @__PURE__ */ x(s.Fragment, { children: [/* @__PURE__ */ b("tr", {
457
457
  className: "bg-muted/60",
458
- children: /* @__PURE__ */ b("td", {
458
+ children: /* @__PURE__ */ x("td", {
459
459
  colSpan: t.columns?.length || 1,
460
460
  className: "px-4 py-2 font-semibold text-sm",
461
461
  children: [
@@ -465,16 +465,16 @@ var U = ({ schema: t, onRefresh: n }) => {
465
465
  ")"
466
466
  ]
467
467
  })
468
- }), e.rows.map((e, n) => /* @__PURE__ */ y("tr", {
468
+ }), e.rows.map((e, n) => /* @__PURE__ */ b("tr", {
469
469
  className: "border-t hover:bg-muted/50 even:bg-muted/20",
470
- children: t.columns?.map((t, n) => /* @__PURE__ */ y("td", {
470
+ children: t.columns?.map((t, n) => /* @__PURE__ */ b("td", {
471
471
  className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
472
472
  style: A(t.name, e[t.name]),
473
473
  children: j(e[t.name], t)
474
474
  }, n))
475
- }, n))] }, e.key)) : i?.map((e, n) => /* @__PURE__ */ y("tr", {
475
+ }, n))] }, e.key)) : i?.map((e, n) => /* @__PURE__ */ b("tr", {
476
476
  className: "border-t hover:bg-muted/50 even:bg-muted/20",
477
- children: t.columns?.map((t, n) => /* @__PURE__ */ y("td", {
477
+ children: t.columns?.map((t, n) => /* @__PURE__ */ b("td", {
478
478
  className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
479
479
  style: A(t.name, e[t.name]),
480
480
  children: j(e[t.name], t)
@@ -483,27 +483,27 @@ var U = ({ schema: t, onRefresh: n }) => {
483
483
  })() })]
484
484
  })
485
485
  }),
486
- t.type === "text" && t.text && /* @__PURE__ */ y("div", {
486
+ t.type === "text" && t.text && /* @__PURE__ */ b("div", {
487
487
  className: "prose max-w-none",
488
- children: /* @__PURE__ */ y("p", { children: t.text })
488
+ children: /* @__PURE__ */ b("p", { children: t.text })
489
489
  }),
490
- t.type === "page-break" && /* @__PURE__ */ y("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
491
- t.content && /* @__PURE__ */ y(l, { schema: t.content })
490
+ t.type === "page-break" && /* @__PURE__ */ b("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
491
+ t.content && /* @__PURE__ */ b(u, { schema: t.content })
492
492
  ]
493
493
  }, n)),
494
- !r.sections && i && i.length > 0 && /* @__PURE__ */ y("div", {
494
+ !r.sections && i && i.length > 0 && /* @__PURE__ */ b("div", {
495
495
  className: "border rounded-lg overflow-x-auto",
496
- children: /* @__PURE__ */ b("table", {
496
+ children: /* @__PURE__ */ x("table", {
497
497
  className: "w-full text-sm min-w-[600px]",
498
- children: [/* @__PURE__ */ y("thead", {
498
+ children: [/* @__PURE__ */ b("thead", {
499
499
  className: "bg-muted",
500
- children: /* @__PURE__ */ y("tr", { children: r.fields?.map((e, t) => /* @__PURE__ */ y("th", {
500
+ children: /* @__PURE__ */ b("tr", { children: r.fields?.map((e, t) => /* @__PURE__ */ b("th", {
501
501
  className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
502
502
  children: e.label || e.name
503
503
  }, t)) })
504
- }), /* @__PURE__ */ y("tbody", { children: i.map((e, t) => /* @__PURE__ */ y("tr", {
504
+ }), /* @__PURE__ */ b("tbody", { children: i.map((e, t) => /* @__PURE__ */ b("tr", {
505
505
  className: "border-t hover:bg-muted/50 even:bg-muted/20",
506
- children: r.fields?.map((t, n) => /* @__PURE__ */ y("td", {
506
+ children: r.fields?.map((t, n) => /* @__PURE__ */ b("td", {
507
507
  className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
508
508
  style: A(t.name, e[t.name]),
509
509
  children: j(e[t.name], t)
@@ -513,40 +513,32 @@ var U = ({ schema: t, onRefresh: n }) => {
513
513
  })
514
514
  ]
515
515
  })] })]
516
- }) : /* @__PURE__ */ y(p, { children: /* @__PURE__ */ y(m, {
516
+ }) : /* @__PURE__ */ b(m, { children: /* @__PURE__ */ b(h, {
517
517
  className: "p-8 text-center text-muted-foreground",
518
518
  children: "No report to display"
519
519
  }) });
520
520
  };
521
521
  //#endregion
522
- //#region src/mergeFilters.ts
523
- function W(e, t) {
524
- let n = e && Object.keys(e).length > 0, r = t && Object.keys(t).length > 0;
525
- if (n && r) return { $and: [e, t] };
526
- if (n) return e;
527
- if (r) return t;
528
- }
529
- //#endregion
530
522
  //#region src/DatasetReportRenderer.tsx
531
- function G(e) {
523
+ function W(e) {
532
524
  if (!e || typeof e != "object") return !1;
533
525
  let t = e;
534
526
  return typeof t.dataset == "string" && t.dataset.length > 0 || t.type === "joined" && Array.isArray(t.blocks) && t.blocks.some((e) => typeof e?.dataset == "string");
535
527
  }
536
- function K(e, t) {
528
+ function G(e, t) {
537
529
  return e ? typeof e == "string" ? e : typeof e == "object" && typeof e.default == "string" ? e.default : t : t;
538
530
  }
539
- function q(e) {
531
+ function K(e) {
540
532
  return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!e) : [];
541
533
  }
542
- function J(e, t, n, r, i, o) {
543
- let [s, c] = a.useState({
534
+ function q(e, t, n, r, i, a) {
535
+ let [s, c] = o.useState({
544
536
  status: "idle",
545
537
  rows: []
546
- }), l = JSON.stringify(r ?? null), u = JSON.stringify(o ?? null), d = `${e}|${t.join(",")}|${n.join(",")}|${l}|${u}`;
547
- return a.useEffect(() => {
548
- let a = i;
549
- if (!a || typeof a.queryDataset != "function") {
538
+ }), l = JSON.stringify(r ?? null), u = JSON.stringify(a ?? null), d = `${e}|${t.join(",")}|${n.join(",")}|${l}|${u}`;
539
+ return o.useEffect(() => {
540
+ let o = i;
541
+ if (!o || typeof o.queryDataset != "function") {
550
542
  c({
551
543
  status: "error",
552
544
  rows: [],
@@ -565,11 +557,11 @@ function J(e, t, n, r, i, o) {
565
557
  return c({
566
558
  status: "loading",
567
559
  rows: []
568
- }), a.queryDataset(e, {
560
+ }), o.queryDataset(e, {
569
561
  dimensions: t,
570
562
  measures: n,
571
563
  ...r && Object.keys(r).length > 0 ? { runtimeFilter: r } : {},
572
- ...o ? { totals: { groupings: o } } : {}
564
+ ...a ? { totals: { groupings: a } } : {}
573
565
  }).then((e) => {
574
566
  s || c({
575
567
  status: "ok",
@@ -591,8 +583,8 @@ function J(e, t, n, r, i, o) {
591
583
  };
592
584
  }, [d]), s;
593
585
  }
594
- function Y({ dataset: e }) {
595
- return /* @__PURE__ */ b("div", {
586
+ function J({ dataset: e }) {
587
+ return /* @__PURE__ */ x("div", {
596
588
  className: "flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
597
589
  children: [
598
590
  "This report binds the “",
@@ -601,35 +593,35 @@ function Y({ dataset: e }) {
601
593
  ]
602
594
  });
603
595
  }
604
- function X({ status: e, error: t }) {
605
- return e === "error" ? /* @__PURE__ */ b("div", {
596
+ function Y({ status: e, error: t }) {
597
+ return e === "error" ? /* @__PURE__ */ x("div", {
606
598
  role: "alert",
607
599
  className: "flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",
608
- children: [/* @__PURE__ */ y(x, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ y("span", {
600
+ children: [/* @__PURE__ */ b(S, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ b("span", {
609
601
  className: "break-words",
610
602
  children: t
611
603
  })]
612
- }) : /* @__PURE__ */ b("div", {
604
+ }) : /* @__PURE__ */ x("div", {
613
605
  className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
614
- children: [/* @__PURE__ */ y(C, { className: "h-4 w-4 animate-spin" }), " Running report…"]
606
+ children: [/* @__PURE__ */ b(w, { className: "h-4 w-4 animate-spin" }), " Running report…"]
615
607
  });
616
608
  }
617
- function Z() {
618
- return /* @__PURE__ */ b("div", {
609
+ function X() {
610
+ return /* @__PURE__ */ x("div", {
619
611
  className: "flex flex-col items-center justify-center gap-2 rounded-md border border-dashed bg-muted/20 p-6 text-xs text-muted-foreground",
620
- children: [/* @__PURE__ */ y(E, { className: "h-6 w-6" }), " The dataset returned no rows for this report’s scope."]
612
+ children: [/* @__PURE__ */ b(D, { className: "h-6 w-6" }), " The dataset returned no rows for this report’s scope."]
621
613
  });
622
614
  }
623
- var ie = "cursor-pointer hover:bg-accent/40";
615
+ var Z = "cursor-pointer hover:bg-accent/40";
624
616
  function ae({ dataset: e, rows: a, values: o, runtimeFilter: s, dataSource: c, onDrill: l }) {
625
- let u = J(e, a, o, s, c), { fieldLabel: d } = k();
626
- if (o.length === 0) return /* @__PURE__ */ y(Y, { dataset: e });
627
- if (u.status === "loading" || u.status === "idle") return /* @__PURE__ */ y(X, { status: u.status });
628
- if (u.status === "error") return /* @__PURE__ */ y(X, {
617
+ let u = q(e, a, o, s, c), { fieldLabel: d } = A();
618
+ if (o.length === 0) return /* @__PURE__ */ b(J, { dataset: e });
619
+ if (u.status === "loading" || u.status === "idle") return /* @__PURE__ */ b(Y, { status: u.status });
620
+ if (u.status === "error") return /* @__PURE__ */ b(Y, {
629
621
  status: "error",
630
622
  error: u.error
631
623
  });
632
- if (u.rows.length === 0) return /* @__PURE__ */ y(Z, {});
624
+ if (u.rows.length === 0) return /* @__PURE__ */ b(X, {});
633
625
  let f = !!l && a.length > 0, p = u.dimensionFields ? a.filter((e) => e in u.dimensionFields) : [], m = (n, r) => {
634
626
  let i = {};
635
627
  for (let e of a) i[e] = n[e];
@@ -642,21 +634,21 @@ function ae({ dataset: e, rows: a, values: o, runtimeFilter: s, dataSource: c, o
642
634
  objectFilter: o
643
635
  });
644
636
  }, { measureField: h, headerLabel: g } = n(u.fields, u.object, d), _ = [...a, ...o];
645
- return /* @__PURE__ */ y("div", {
637
+ return /* @__PURE__ */ b("div", {
646
638
  className: "overflow-auto max-h-[70vh] rounded-md border",
647
- children: /* @__PURE__ */ b("table", {
639
+ children: /* @__PURE__ */ x("table", {
648
640
  className: "w-full text-xs",
649
- children: [/* @__PURE__ */ y("thead", {
641
+ children: [/* @__PURE__ */ b("thead", {
650
642
  className: "bg-muted/40",
651
- children: /* @__PURE__ */ y("tr", { children: _.map((e) => /* @__PURE__ */ y("th", {
643
+ children: /* @__PURE__ */ b("tr", { children: _.map((e) => /* @__PURE__ */ b("th", {
652
644
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
653
645
  children: g(e)
654
646
  }, e)) })
655
- }), /* @__PURE__ */ y("tbody", { children: u.rows.map((e, t) => /* @__PURE__ */ y("tr", {
656
- className: `border-t${f ? ` ${ie}` : ""}`,
647
+ }), /* @__PURE__ */ b("tbody", { children: u.rows.map((e, t) => /* @__PURE__ */ b("tr", {
648
+ className: `border-t${f ? ` ${Z}` : ""}`,
657
649
  "data-testid": f ? "dataset-drill-row" : void 0,
658
650
  onClick: f ? () => m(e, t) : void 0,
659
- children: _.map((t) => /* @__PURE__ */ y("td", {
651
+ children: _.map((t) => /* @__PURE__ */ b("td", {
660
652
  className: "px-2 py-1 tabular-nums whitespace-nowrap",
661
653
  children: o.includes(t) ? i(e[t], h(t)?.format, h(t)?.currency) : r(e[t])
662
654
  }, t))
@@ -676,8 +668,8 @@ function oe(e) {
676
668
  }
677
669
  }
678
670
  function se(t) {
679
- let [, n] = a.useReducer((e) => e + 1, 0);
680
- return a.useEffect(() => {
671
+ let [, n] = o.useReducer((e) => e + 1, 0);
672
+ return o.useEffect(() => {
681
673
  if (e.get(t)) return;
682
674
  let r = typeof e.subscribe == "function" ? e.subscribe(() => {
683
675
  e.get(t) && n();
@@ -686,21 +678,21 @@ function se(t) {
686
678
  }, [t]), e.get(t);
687
679
  }
688
680
  function ce({ dataset: e, chart: t, runtimeFilter: n, dataSource: r }) {
689
- let i = typeof t.xAxis == "string" ? t.xAxis : "", a = typeof t.yAxis == "string" ? t.yAxis : "", o = J(e, i ? [i] : [], a ? [a] : [], n, r), s = se("chart");
681
+ let i = typeof t.xAxis == "string" ? t.xAxis : "", a = typeof t.yAxis == "string" ? t.yAxis : "", o = q(e, i ? [i] : [], a ? [a] : [], n, r), s = se("chart");
690
682
  if (!i || !a) return null;
691
- if (o.status === "loading" || o.status === "idle") return /* @__PURE__ */ b("div", {
683
+ if (o.status === "loading" || o.status === "idle") return /* @__PURE__ */ x("div", {
692
684
  className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
693
- children: [/* @__PURE__ */ y(C, { className: "h-4 w-4 animate-spin" }), " Loading chart…"]
685
+ children: [/* @__PURE__ */ b(w, { className: "h-4 w-4 animate-spin" }), " Loading chart…"]
694
686
  });
695
687
  if (o.status === "error" || o.rows.length === 0 || !s) return null;
696
688
  let c = typeof t.title == "string" ? t.title : void 0;
697
- return /* @__PURE__ */ b("div", {
689
+ return /* @__PURE__ */ x("div", {
698
690
  className: "rounded-md border bg-card p-3",
699
691
  "data-testid": "dataset-report-chart",
700
- children: [c ? /* @__PURE__ */ y("h3", {
692
+ children: [c ? /* @__PURE__ */ b("h3", {
701
693
  className: "mb-2 text-sm font-semibold",
702
694
  children: c
703
- }) : null, /* @__PURE__ */ y(s, { schema: {
695
+ }) : null, /* @__PURE__ */ b(s, { schema: {
704
696
  chartType: oe(t.type),
705
697
  data: o.rows,
706
698
  xAxisKey: i,
@@ -716,38 +708,38 @@ function Q(e, t) {
716
708
  function le(e, t) {
717
709
  return e.map((e) => r(t[e])).join(" / ");
718
710
  }
719
- function ue({ dataset: e, rows: o, columnsAcross: s, values: c, runtimeFilter: l, dataSource: u, onDrill: d }) {
720
- let f = J(e, [...o, ...s], c, l, u, [
721
- o,
711
+ function ue({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l, dataSource: u, onDrill: d }) {
712
+ let f = q(e, [...a, ...s], c, l, u, [
713
+ a,
722
714
  s,
723
715
  []
724
- ]), p = A(), { fieldLabel: m } = k(), h = a.useMemo(() => {
716
+ ]), p = j(), { fieldLabel: m } = A(), h = o.useMemo(() => {
725
717
  if (f.status !== "ok") return null;
726
718
  let e = [], t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
727
- return f.rows.forEach((a, c) => {
728
- let l = Q(o, a), u = Q(s, a);
719
+ return f.rows.forEach((o, c) => {
720
+ let l = Q(a, o), u = Q(s, o);
729
721
  if (!n.has(l)) {
730
722
  n.add(l);
731
723
  let t = {};
732
- for (let e of o) t[e] = a[e];
724
+ for (let e of a) t[e] = o[e];
733
725
  e.push({
734
726
  id: l,
735
- label: le(o, a),
727
+ label: le(a, o),
736
728
  key: t
737
729
  });
738
730
  }
739
731
  if (!r.has(u)) {
740
732
  r.add(u);
741
733
  let e = {};
742
- for (let t of s) e[t] = a[t];
734
+ for (let t of s) e[t] = o[t];
743
735
  t.push({
744
736
  id: u,
745
- label: le(s, a),
737
+ label: le(s, o),
746
738
  key: e
747
739
  });
748
740
  }
749
741
  i.set(`${l} ${u}`, {
750
- row: a,
742
+ row: o,
751
743
  index: c
752
744
  });
753
745
  }), {
@@ -757,17 +749,17 @@ function ue({ dataset: e, rows: o, columnsAcross: s, values: c, runtimeFilter: l
757
749
  };
758
750
  }, [
759
751
  f,
760
- o,
752
+ a,
761
753
  s
762
754
  ]);
763
- if (c.length === 0) return /* @__PURE__ */ y(Y, { dataset: e });
764
- if (f.status === "loading" || f.status === "idle") return /* @__PURE__ */ y(X, { status: f.status });
765
- if (f.status === "error") return /* @__PURE__ */ y(X, {
755
+ if (c.length === 0) return /* @__PURE__ */ b(J, { dataset: e });
756
+ if (f.status === "loading" || f.status === "idle") return /* @__PURE__ */ b(Y, { status: f.status });
757
+ if (f.status === "error") return /* @__PURE__ */ b(Y, {
766
758
  status: "error",
767
759
  error: f.error
768
760
  });
769
- if (!h || h.rowHeaders.length === 0) return /* @__PURE__ */ y(Z, {});
770
- let { measureField: g, headerLabel: _ } = n(f.fields, f.object, m), v = p("report.total", "Total"), x = !!d, S = f.dimensionFields ? [...o, ...s].filter((e) => e in f.dimensionFields) : [], C = (n, r, i) => {
761
+ if (!h || h.rowHeaders.length === 0) return /* @__PURE__ */ b(X, {});
762
+ let { measureField: g, headerLabel: _ } = n(f.fields, f.object, m), v = p("report.total", "Total"), y = !!d, S = f.dimensionFields ? [...a, ...s].filter((e) => e in f.dimensionFields) : [], C = (n, r, i) => {
771
763
  let a = f.object && f.dimensionFields && S.length > 0 ? t(f.drillRawRows?.[i], S, f.dimensionFields, l) : void 0;
772
764
  d({
773
765
  dataset: e,
@@ -784,68 +776,68 @@ function ue({ dataset: e, rows: o, columnsAcross: s, values: c, runtimeFilter: l
784
776
  measure: t,
785
777
  header: c.length === 1 ? e.label : `${e.label} · ${_(t)}`
786
778
  }))), T = (e) => f.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, E = /* @__PURE__ */ new Map();
787
- for (let e of T(o) ?? []) E.set(Q(o, e), e);
779
+ for (let e of T(a) ?? []) E.set(Q(a, e), e);
788
780
  let D = /* @__PURE__ */ new Map();
789
781
  for (let e of T(s) ?? []) D.set(Q(s, e), e);
790
- let O = T([])?.[0], j = E.size > 0, M = D.size > 0;
791
- return /* @__PURE__ */ y("div", {
782
+ let O = T([])?.[0], k = E.size > 0, M = D.size > 0;
783
+ return /* @__PURE__ */ b("div", {
792
784
  className: "overflow-auto max-h-[70vh] rounded-md border",
793
785
  "data-testid": "dataset-matrix",
794
- children: /* @__PURE__ */ b("table", {
786
+ children: /* @__PURE__ */ x("table", {
795
787
  className: "w-full text-xs",
796
- children: [/* @__PURE__ */ y("thead", {
788
+ children: [/* @__PURE__ */ b("thead", {
797
789
  className: "bg-muted/40",
798
- children: /* @__PURE__ */ b("tr", { children: [
799
- o.map((e) => /* @__PURE__ */ y("th", {
790
+ children: /* @__PURE__ */ x("tr", { children: [
791
+ a.map((e) => /* @__PURE__ */ b("th", {
800
792
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
801
793
  children: _(e)
802
794
  }, e)),
803
- w.map((e) => /* @__PURE__ */ y("th", {
795
+ w.map((e) => /* @__PURE__ */ b("th", {
804
796
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
805
797
  children: e.header
806
798
  }, `${e.col.id}-${e.measure}`)),
807
- j && c.map((e) => /* @__PURE__ */ y("th", {
799
+ k && c.map((e) => /* @__PURE__ */ b("th", {
808
800
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
809
801
  "data-testid": "matrix-total-col-header",
810
802
  children: c.length === 1 ? v : `${v} · ${_(e)}`
811
803
  }, `total-${e}`))
812
804
  ] })
813
- }), /* @__PURE__ */ b("tbody", { children: [h.rowHeaders.map((e) => /* @__PURE__ */ b("tr", {
805
+ }), /* @__PURE__ */ x("tbody", { children: [h.rowHeaders.map((e) => /* @__PURE__ */ x("tr", {
814
806
  className: "border-t",
815
807
  children: [
816
- o.map((t) => /* @__PURE__ */ y("td", {
808
+ a.map((t) => /* @__PURE__ */ b("td", {
817
809
  className: "px-2 py-1 whitespace-nowrap font-medium",
818
810
  children: r(e.key[t])
819
811
  }, t)),
820
812
  w.map((t) => {
821
- let n = h.cells.get(`${e.id} ${t.col.id}`), r = n?.row[t.measure], a = x && n != null;
822
- return /* @__PURE__ */ y("td", {
823
- className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${a ? ` ${ie}` : ""}`,
813
+ let n = h.cells.get(`${e.id} ${t.col.id}`), r = n?.row[t.measure], a = y && n != null;
814
+ return /* @__PURE__ */ b("td", {
815
+ className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${a ? ` ${Z}` : ""}`,
824
816
  "data-testid": a ? "dataset-drill-cell" : void 0,
825
817
  onClick: a ? () => C(e.key, t.col.key, n.index) : void 0,
826
818
  children: i(r, g(t.measure)?.format, g(t.measure)?.currency)
827
819
  }, `${t.col.id}-${t.measure}`);
828
820
  }),
829
- j && c.map((t) => /* @__PURE__ */ y("td", {
821
+ k && c.map((t) => /* @__PURE__ */ b("td", {
830
822
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
831
823
  "data-testid": "matrix-row-total",
832
824
  children: i(E.get(e.id)?.[t], g(t)?.format, g(t)?.currency)
833
825
  }, `total-${t}`))
834
826
  ]
835
- }, e.id)), M && /* @__PURE__ */ b("tr", {
827
+ }, e.id)), M && /* @__PURE__ */ x("tr", {
836
828
  className: "border-t bg-muted/30 font-medium",
837
829
  "data-testid": "matrix-total-row",
838
830
  children: [
839
- o.length > 0 && /* @__PURE__ */ y("td", {
840
- colSpan: o.length,
831
+ a.length > 0 && /* @__PURE__ */ b("td", {
832
+ colSpan: a.length,
841
833
  className: "px-2 py-1 whitespace-nowrap",
842
834
  children: v
843
835
  }),
844
- w.map((e) => /* @__PURE__ */ y("td", {
836
+ w.map((e) => /* @__PURE__ */ b("td", {
845
837
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
846
838
  children: i(D.get(e.col.id)?.[e.measure], g(e.measure)?.format, g(e.measure)?.currency)
847
839
  }, `${e.col.id}-${e.measure}`)),
848
- j && c.map((e) => /* @__PURE__ */ y("td", {
840
+ k && c.map((e) => /* @__PURE__ */ b("td", {
849
841
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
850
842
  "data-testid": "matrix-grand-total",
851
843
  children: i(O?.[e], g(e)?.format, g(e)?.currency)
@@ -856,8 +848,8 @@ function ue({ dataset: e, rows: o, columnsAcross: s, values: c, runtimeFilter: l
856
848
  });
857
849
  }
858
850
  var de = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i }) => {
859
- let a = W(e.runtimeFilter ?? e.filter, n), o = e.drilldown === !1 ? void 0 : r;
860
- if (e.type === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */ y("div", {
851
+ let o = a(e.runtimeFilter ?? e.filter, n), s = e.drilldown === !1 ? void 0 : r;
852
+ if (e.type === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */ b("div", {
861
853
  className: i,
862
854
  "data-testid": "dataset-joined-report",
863
855
  "data-report-name": e.name,
@@ -867,91 +859,91 @@ var de = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
867
859
  gap: 24
868
860
  },
869
861
  children: e.blocks.map((e, n) => {
870
- let r = W(a, e.runtimeFilter ?? e.filter), i = q(e.columns), s = e.type === "matrix" && i.length > 0 ? /* @__PURE__ */ y(ue, {
862
+ let r = a(o, e.runtimeFilter ?? e.filter), i = K(e.columns), c = e.type === "matrix" && i.length > 0 ? /* @__PURE__ */ b(ue, {
871
863
  dataset: String(e.dataset ?? ""),
872
- rows: q(e.rows),
864
+ rows: K(e.rows),
873
865
  columnsAcross: i,
874
- values: q(e.values),
866
+ values: K(e.values),
875
867
  runtimeFilter: r,
876
868
  dataSource: t,
877
- onDrill: o
878
- }) : /* @__PURE__ */ y(ae, {
869
+ onDrill: s
870
+ }) : /* @__PURE__ */ b(ae, {
879
871
  dataset: String(e.dataset ?? ""),
880
- rows: q(e.rows),
881
- values: q(e.values),
872
+ rows: K(e.rows),
873
+ values: K(e.values),
882
874
  runtimeFilter: r,
883
875
  dataSource: t,
884
- onDrill: o
876
+ onDrill: s
885
877
  });
886
- return /* @__PURE__ */ b("section", {
878
+ return /* @__PURE__ */ x("section", {
887
879
  "data-testid": "dataset-report-block",
888
880
  "data-block-id": e.name ?? `block-${n}`,
889
881
  className: "flex flex-col gap-2 rounded-lg border bg-card p-4",
890
- children: [/* @__PURE__ */ b("header", {
882
+ children: [/* @__PURE__ */ x("header", {
891
883
  className: "flex flex-col gap-0.5",
892
- children: [/* @__PURE__ */ y("h3", {
884
+ children: [/* @__PURE__ */ b("h3", {
893
885
  className: "text-sm font-semibold",
894
- children: K(e.label, e.name ?? `Block ${n + 1}`)
895
- }), e.description ? /* @__PURE__ */ y("p", {
886
+ children: G(e.label, e.name ?? `Block ${n + 1}`)
887
+ }), e.description ? /* @__PURE__ */ b("p", {
896
888
  className: "text-xs text-muted-foreground",
897
- children: K(e.description, "")
889
+ children: G(e.description, "")
898
890
  }) : null]
899
- }), s]
891
+ }), c]
900
892
  }, e.name ?? `block-${n}`);
901
893
  })
902
894
  });
903
- let s = q(e.columns);
904
- if (e.type === "matrix" && s.length > 0) return /* @__PURE__ */ y("div", {
895
+ let c = K(e.columns);
896
+ if (e.type === "matrix" && c.length > 0) return /* @__PURE__ */ b("div", {
905
897
  className: i,
906
898
  "data-testid": "dataset-report",
907
899
  "data-report-name": e.name,
908
- children: /* @__PURE__ */ y(ue, {
900
+ children: /* @__PURE__ */ b(ue, {
909
901
  dataset: String(e.dataset ?? ""),
910
- rows: q(e.rows),
911
- columnsAcross: s,
912
- values: q(e.values),
913
- runtimeFilter: a,
902
+ rows: K(e.rows),
903
+ columnsAcross: c,
904
+ values: K(e.values),
905
+ runtimeFilter: o,
914
906
  dataSource: t,
915
- onDrill: o
907
+ onDrill: s
916
908
  })
917
909
  });
918
- let c = e.chart && typeof e.chart == "object" && e.chart.type ? e.chart : null;
919
- return /* @__PURE__ */ b("div", {
910
+ let l = e.chart && typeof e.chart == "object" && e.chart.type ? e.chart : null;
911
+ return /* @__PURE__ */ x("div", {
920
912
  className: `${i ?? ""} flex flex-col gap-3`,
921
913
  "data-testid": "dataset-report",
922
914
  "data-report-name": e.name,
923
- children: [c ? /* @__PURE__ */ y(ce, {
915
+ children: [l ? /* @__PURE__ */ b(ce, {
924
916
  dataset: String(e.dataset ?? ""),
925
- chart: c,
926
- runtimeFilter: a,
917
+ chart: l,
918
+ runtimeFilter: o,
927
919
  dataSource: t
928
- }) : null, /* @__PURE__ */ y(ae, {
920
+ }) : null, /* @__PURE__ */ b(ae, {
929
921
  dataset: String(e.dataset ?? ""),
930
- rows: q(e.rows),
931
- values: q(e.values),
932
- runtimeFilter: a,
922
+ rows: K(e.rows),
923
+ values: K(e.values),
924
+ runtimeFilter: o,
933
925
  dataSource: t,
934
- onDrill: o
926
+ onDrill: s
935
927
  })]
936
928
  });
937
929
  }, $ = (e) => {
938
- let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: o } = e, l = a.useContext(u), d = t ?? l?.dataSource, f = e.schema;
939
- return f && typeof f == "object" && f.type === "spec-report" && f.report && typeof f.report == "object" && (f = f.report), G(f) ? /* @__PURE__ */ y(de, {
930
+ let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: a } = e, s = o.useContext(d), u = t ?? s?.dataSource, f = e.schema;
931
+ return f && typeof f == "object" && f.type === "spec-report" && f.report && typeof f.report == "object" && (f = f.report), W(f) ? /* @__PURE__ */ b(de, {
940
932
  report: f,
941
- dataSource: d,
933
+ dataSource: u,
942
934
  runtimeFilter: r,
943
935
  onDrill: i,
944
- className: o
945
- }) : s(f) ? /* @__PURE__ */ y("div", {
946
- className: o,
936
+ className: a
937
+ }) : c(f) ? /* @__PURE__ */ b("div", {
938
+ className: a,
947
939
  "data-testid": "report-presentation-bridge",
948
- children: /* @__PURE__ */ y(U, { schema: {
940
+ children: /* @__PURE__ */ b(U, { schema: {
949
941
  type: "report-viewer",
950
- report: c(f),
942
+ report: l(f),
951
943
  data: n ?? [],
952
944
  showToolbar: !1
953
945
  } })
954
- }) : /* @__PURE__ */ y(j, { schema: f });
946
+ }) : /* @__PURE__ */ b(M, { schema: f });
955
947
  };
956
948
  //#endregion
957
949
  //#region src/LiveReportExporter.ts
@@ -959,7 +951,7 @@ async function fe(e, t) {
959
951
  let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o } = t, s = a || e.defaultExportFormat || "pdf";
960
952
  try {
961
953
  let t = (await n.find(r, i)).data || [];
962
- return I(s, e, t, {
954
+ return L(s, e, t, {
963
955
  format: s,
964
956
  ...e.exportConfigs?.[s],
965
957
  ...o
@@ -1104,4 +1096,4 @@ e.register("report", $, {
1104
1096
  }]
1105
1097
  });
1106
1098
  //#endregion
1107
- export { de as DatasetReportRenderer, j as LegacyReportRenderer, $ as ReportRenderer, U as ReportViewer, me as createScheduleTrigger, M as exportAsCSV, F as exportAsExcel, N as exportAsHTML, ee as exportAsJSON, P as exportAsPDF, pe as exportExcelWithFormulas, I as exportReport, fe as exportWithLiveData, H as formatValue, G as isDatasetReport, W as mergeFilters };
1099
+ export { de as DatasetReportRenderer, M as LegacyReportRenderer, $ as ReportRenderer, U as ReportViewer, me as createScheduleTrigger, N as exportAsCSV, I as exportAsExcel, F as exportAsHTML, P as exportAsJSON, ee as exportAsPDF, pe as exportExcelWithFormulas, L as exportReport, fe as exportWithLiveData, H as formatValue, W as isDatasetReport, a as mergeFilters };