@object-ui/plugin-report 16.1.0 → 17.2.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/CHANGELOG.md +401 -1
- package/dist/DatasetReportRenderer.d.ts +86 -1
- package/dist/LiveReportExporter.d.ts +5 -5
- package/dist/ReportExportEngine.d.ts +7 -7
- package/dist/ReportViewer.d.ts +9 -0
- package/dist/index.js +380 -305
- package/dist/index.umd.cjs +2 -2
- package/package.json +12 -10
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { SchemaRenderer as u, SchemaRendererContext as d } from "@object-ui/reac
|
|
|
6
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
7
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
8
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
|
|
10
|
-
import { useSafeFieldLabel as
|
|
9
|
+
import { getCellRenderer as O, resolveCellRendererType as ee } from "@object-ui/fields";
|
|
10
|
+
import { useSafeFieldLabel as k, useSafeTranslate as A } from "@object-ui/i18n";
|
|
11
11
|
//#region src/LegacyReportRenderer.tsx
|
|
12
|
-
var
|
|
12
|
+
var j = ({ 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;
|
|
@@ -64,29 +64,29 @@ var M = ({ schema: t }) => {
|
|
|
64
64
|
};
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/ReportExportEngine.ts
|
|
67
|
-
function
|
|
67
|
+
function M(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 =
|
|
70
|
+
return n = R(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
71
71
|
}));
|
|
72
|
-
|
|
72
|
+
z([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function N(e, t, n) {
|
|
75
75
|
let r = {
|
|
76
76
|
title: e.title,
|
|
77
77
|
description: e.description,
|
|
78
78
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
79
79
|
data: t
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
z(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
let r = e.fields || [], i =
|
|
85
|
-
|
|
83
|
+
function P(e, t, n) {
|
|
84
|
+
let r = e.fields || [], i = re(n?.orientation), a = ne(n?.pageSize);
|
|
85
|
+
z(`<!DOCTYPE html>
|
|
86
86
|
<html>
|
|
87
87
|
<head>
|
|
88
88
|
<meta charset="utf-8">
|
|
89
|
-
<title>${
|
|
89
|
+
<title>${L(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 F(e, t, n) {
|
|
|
100
100
|
</style>
|
|
101
101
|
</head>
|
|
102
102
|
<body>
|
|
103
|
-
<h1>${
|
|
104
|
-
${e.description ? `<p class="description">${
|
|
103
|
+
<h1>${L(e.title || "Report")}</h1>
|
|
104
|
+
${e.description ? `<p class="description">${L(e.description)}</p>` : ""}
|
|
105
105
|
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
106
106
|
<table>
|
|
107
|
-
<thead><tr>${r.map((e) => `<th>${
|
|
108
|
-
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${
|
|
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>
|
|
109
109
|
</table>
|
|
110
110
|
</body>
|
|
111
111
|
</html>`, n?.filename || `${e.title || "report"}.html`, "text/html");
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
let r = e.fields || [], i =
|
|
113
|
+
function te(e, t, n) {
|
|
114
|
+
let r = e.fields || [], i = re(n?.orientation), a = ne(n?.pageSize), o = window.open("", "_blank");
|
|
115
115
|
if (!o) {
|
|
116
|
-
|
|
116
|
+
P(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 ee(e, t, n) {
|
|
|
124
124
|
<html>
|
|
125
125
|
<head>
|
|
126
126
|
<meta charset="utf-8">
|
|
127
|
-
<title>${
|
|
127
|
+
<title>${L(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 ee(e, t, n) {
|
|
|
139
139
|
</style>
|
|
140
140
|
</head>
|
|
141
141
|
<body>
|
|
142
|
-
<h1>${
|
|
143
|
-
${e.description ? `<p class="description">${
|
|
142
|
+
<h1>${L(e.title || "Report")}</h1>
|
|
143
|
+
${e.description ? `<p class="description">${L(e.description)}</p>` : ""}
|
|
144
144
|
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
145
145
|
<table>
|
|
146
|
-
<thead><tr>${r.map((e) => `<th>${
|
|
147
|
-
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${
|
|
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>
|
|
148
148
|
</table>
|
|
149
149
|
</body>
|
|
150
150
|
</html>`), o.document.close(), o.onload = () => {
|
|
151
151
|
o.print();
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function F(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 =
|
|
157
|
+
return n = R(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
158
158
|
}));
|
|
159
|
-
|
|
159
|
+
z("" + [...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
|
|
161
|
+
function I(e, t, n, r) {
|
|
162
162
|
switch (e) {
|
|
163
163
|
case "csv":
|
|
164
|
-
|
|
164
|
+
M(t, n, r);
|
|
165
165
|
break;
|
|
166
166
|
case "json":
|
|
167
|
-
|
|
167
|
+
N(t, n, r);
|
|
168
168
|
break;
|
|
169
169
|
case "html":
|
|
170
|
-
|
|
170
|
+
P(t, n, r);
|
|
171
171
|
break;
|
|
172
172
|
case "pdf":
|
|
173
|
-
|
|
173
|
+
te(t, n, r);
|
|
174
174
|
break;
|
|
175
175
|
case "excel":
|
|
176
|
-
|
|
176
|
+
F(t, n, r);
|
|
177
177
|
break;
|
|
178
178
|
default: console.warn(`Unsupported export format: ${e}`);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function L(e) {
|
|
182
182
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function R(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
|
|
191
|
+
function ne(e) {
|
|
192
192
|
return [
|
|
193
193
|
"A4",
|
|
194
194
|
"A3",
|
|
@@ -196,19 +196,19 @@ function B(e) {
|
|
|
196
196
|
"Legal"
|
|
197
197
|
].includes(e || "") ? e : "A4";
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function re(e) {
|
|
200
200
|
return e === "landscape" ? "landscape" : "portrait";
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function z(e, t, n) {
|
|
203
203
|
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
204
204
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/formatValue.ts
|
|
208
|
-
function
|
|
208
|
+
function B(e, t) {
|
|
209
209
|
if (e == null || e === "") return "";
|
|
210
210
|
let n = t?.type, r = t?.format;
|
|
211
|
-
if (n === "date" || r === "date" ||
|
|
211
|
+
if (n === "date" || r === "date" || ie(e)) return ae(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
|
|
227
|
+
function ie(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
|
|
230
|
+
function ae(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 re(e) {
|
|
|
237
237
|
}
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region src/ReportViewer.tsx
|
|
240
|
-
function
|
|
240
|
+
function oe(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) {
|
|
@@ -253,129 +253,131 @@ function ie(e, t) {
|
|
|
253
253
|
let o = n.sort === "desc" ? -1 : 1;
|
|
254
254
|
return a.sort((e, t) => e.key.localeCompare(t.key) * o), a;
|
|
255
255
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
function se(e, t, n) {
|
|
257
|
+
if (!e) return 0;
|
|
258
|
+
let r = e.map((e) => Number(e[t]) || 0);
|
|
259
|
+
switch (n) {
|
|
260
|
+
case "count": return e.length;
|
|
261
|
+
case "sum": return r.reduce((e, t) => e + t, 0);
|
|
262
|
+
case "avg": return r.length > 0 ? (r.reduce((e, t) => e + t, 0) / r.length).toFixed(2) : 0;
|
|
263
|
+
case "min": return r.length > 0 ? Math.min(...r) : 0;
|
|
264
|
+
case "max": return r.length > 0 ? Math.max(...r) : 0;
|
|
265
|
+
case "distinct": return new Set(e.map((e) => e[t])).size;
|
|
266
|
+
default: return "";
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
var V = ({ schema: e, onRefresh: t }) => {
|
|
270
|
+
let { report: n, data: r, showToolbar: i = !0, allowExport: a = !0, allowPrint: o = !0, loading: c = !1 } = e, l = (e) => {
|
|
271
|
+
if (!n) {
|
|
259
272
|
console.warn("ReportViewer: Cannot export, no report defined");
|
|
260
273
|
return;
|
|
261
274
|
}
|
|
262
|
-
|
|
263
|
-
},
|
|
275
|
+
I(e, n, r || [], n.exportConfigs?.[e]);
|
|
276
|
+
}, d = () => {
|
|
264
277
|
window.print();
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
}, D = (e, t) => {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
case "avg": return n.length > 0 ? (n.reduce((e, t) => e + t, 0) / n.length).toFixed(2) : 0;
|
|
274
|
-
case "min": return n.length > 0 ? Math.min(...n) : 0;
|
|
275
|
-
case "max": return n.length > 0 ? Math.max(...n) : 0;
|
|
276
|
-
default: return "";
|
|
277
|
-
}
|
|
278
|
-
}, A = (e, t) => {
|
|
279
|
-
let n = r?.conditionalFormatting;
|
|
280
|
-
if (!(!n || !Array.isArray(n))) for (let r of n) {
|
|
281
|
-
if (r.field !== e) continue;
|
|
282
|
-
let n = String(t ?? ""), i = String(r.value ?? ""), a = !1;
|
|
283
|
-
switch (r.operator) {
|
|
278
|
+
}, S = () => {
|
|
279
|
+
t?.();
|
|
280
|
+
}, w = (e, t) => se(r, e, t), D = (e, t) => {
|
|
281
|
+
let r = n?.conditionalFormatting;
|
|
282
|
+
if (!(!r || !Array.isArray(r))) for (let n of r) {
|
|
283
|
+
if (n.field !== e) continue;
|
|
284
|
+
let r = String(t ?? ""), i = String(n.value ?? ""), a = !1;
|
|
285
|
+
switch (n.operator) {
|
|
284
286
|
case "equals":
|
|
285
|
-
a =
|
|
287
|
+
a = r === i;
|
|
286
288
|
break;
|
|
287
289
|
case "not_equals":
|
|
288
|
-
a =
|
|
290
|
+
a = r !== i;
|
|
289
291
|
break;
|
|
290
292
|
case "contains":
|
|
291
|
-
a =
|
|
293
|
+
a = r.includes(i);
|
|
292
294
|
break;
|
|
293
295
|
case "greater_than":
|
|
294
|
-
a = Number(t) > Number(
|
|
296
|
+
a = Number(t) > Number(n.value);
|
|
295
297
|
break;
|
|
296
298
|
case "less_than":
|
|
297
|
-
a = Number(t) < Number(
|
|
299
|
+
a = Number(t) < Number(n.value);
|
|
298
300
|
break;
|
|
299
301
|
}
|
|
300
302
|
if (a) {
|
|
301
303
|
let e = {};
|
|
302
|
-
return
|
|
304
|
+
return n.backgroundColor && (e.backgroundColor = n.backgroundColor), n.textColor && (e.color = n.textColor), e;
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
|
-
},
|
|
307
|
+
}, k = (e, t) => {
|
|
306
308
|
if (e == null || e === "") return "";
|
|
307
309
|
if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) return /* @__PURE__ */ b(f, {
|
|
308
310
|
className: t.colorMap?.[String(e)] || "",
|
|
309
311
|
children: String(e)
|
|
310
312
|
});
|
|
311
|
-
if (t.aggregation) return
|
|
313
|
+
if (t.aggregation) return B(e, t);
|
|
312
314
|
if (t.type) {
|
|
313
315
|
let n = { ...t };
|
|
314
316
|
return t.colorMap && !n.options && (n.options = Object.entries(t.colorMap).map(([e, t]) => ({
|
|
315
317
|
value: e,
|
|
316
318
|
label: e,
|
|
317
319
|
color: t
|
|
318
|
-
}))), /* @__PURE__ */ b(O(
|
|
320
|
+
}))), /* @__PURE__ */ b(O(ee(n)), {
|
|
319
321
|
value: e,
|
|
320
322
|
field: n
|
|
321
323
|
});
|
|
322
324
|
}
|
|
323
|
-
return
|
|
325
|
+
return B(e, t);
|
|
324
326
|
};
|
|
325
|
-
return
|
|
327
|
+
return n ? /* @__PURE__ */ x("div", {
|
|
326
328
|
className: "space-y-4",
|
|
327
|
-
children: [
|
|
329
|
+
children: [i && /* @__PURE__ */ x("div", {
|
|
328
330
|
className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",
|
|
329
331
|
children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h2", {
|
|
330
332
|
className: "text-lg font-semibold",
|
|
331
|
-
children:
|
|
332
|
-
}),
|
|
333
|
+
children: n.title
|
|
334
|
+
}), n.description && /* @__PURE__ */ b("p", {
|
|
333
335
|
className: "text-sm text-muted-foreground",
|
|
334
|
-
children:
|
|
336
|
+
children: n.description
|
|
335
337
|
})] }), /* @__PURE__ */ x("div", {
|
|
336
338
|
className: "flex items-center gap-2",
|
|
337
339
|
children: [
|
|
338
|
-
|
|
340
|
+
n.refreshInterval && /* @__PURE__ */ x(p, {
|
|
339
341
|
variant: "outline",
|
|
340
342
|
size: "sm",
|
|
341
|
-
onClick:
|
|
343
|
+
onClick: S,
|
|
342
344
|
children: [/* @__PURE__ */ b(E, { className: "h-4 w-4 mr-2" }), "Refresh"]
|
|
343
345
|
}),
|
|
344
|
-
|
|
346
|
+
o && /* @__PURE__ */ x(p, {
|
|
345
347
|
variant: "outline",
|
|
346
348
|
size: "sm",
|
|
347
|
-
onClick:
|
|
349
|
+
onClick: d,
|
|
348
350
|
children: [/* @__PURE__ */ b(T, { className: "h-4 w-4 mr-2" }), "Print"]
|
|
349
351
|
}),
|
|
350
|
-
|
|
352
|
+
a && n.showExportButtons && /* @__PURE__ */ x("div", {
|
|
351
353
|
className: "flex items-center gap-1",
|
|
352
354
|
children: [
|
|
353
355
|
/* @__PURE__ */ x(p, {
|
|
354
356
|
variant: "outline",
|
|
355
357
|
size: "sm",
|
|
356
|
-
onClick: () =>
|
|
358
|
+
onClick: () => l("pdf"),
|
|
357
359
|
children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "PDF"]
|
|
358
360
|
}),
|
|
359
361
|
/* @__PURE__ */ x(p, {
|
|
360
362
|
variant: "outline",
|
|
361
363
|
size: "sm",
|
|
362
|
-
onClick: () =>
|
|
364
|
+
onClick: () => l("excel"),
|
|
363
365
|
children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "Excel"]
|
|
364
366
|
}),
|
|
365
367
|
/* @__PURE__ */ x(p, {
|
|
366
368
|
variant: "outline",
|
|
367
369
|
size: "sm",
|
|
368
|
-
onClick: () =>
|
|
370
|
+
onClick: () => l("csv"),
|
|
369
371
|
children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "CSV"]
|
|
370
372
|
})
|
|
371
373
|
]
|
|
372
374
|
})
|
|
373
375
|
]
|
|
374
376
|
})]
|
|
375
|
-
}), /* @__PURE__ */ x(m, { children: [/* @__PURE__ */ x(_, { children: [!
|
|
377
|
+
}), /* @__PURE__ */ x(m, { children: [/* @__PURE__ */ x(_, { children: [!i && n.title && /* @__PURE__ */ b(v, { children: n.title }), !i && n.description && /* @__PURE__ */ b(g, { children: n.description })] }), /* @__PURE__ */ x(h, {
|
|
376
378
|
className: "space-y-6",
|
|
377
379
|
children: [
|
|
378
|
-
|
|
380
|
+
c && /* @__PURE__ */ x("div", {
|
|
379
381
|
className: "space-y-6",
|
|
380
382
|
children: [/* @__PURE__ */ b("div", {
|
|
381
383
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
@@ -398,115 +400,96 @@ var U = ({ schema: t, onRefresh: n }) => {
|
|
|
398
400
|
].map((e) => /* @__PURE__ */ b(y, { className: "h-8 w-full" }, e))]
|
|
399
401
|
})]
|
|
400
402
|
}),
|
|
401
|
-
!
|
|
403
|
+
!c && n.sections?.map((e, t) => e.visible === !1 ? null : /* @__PURE__ */ x("div", {
|
|
402
404
|
className: "space-y-2",
|
|
403
405
|
children: [
|
|
404
|
-
|
|
406
|
+
e.title && e.type !== "header" && /* @__PURE__ */ b("h3", {
|
|
405
407
|
className: "text-lg font-semibold border-b pb-2",
|
|
406
|
-
children:
|
|
408
|
+
children: e.title
|
|
407
409
|
}),
|
|
408
|
-
|
|
410
|
+
e.type === "header" && e.title && /* @__PURE__ */ b("div", {
|
|
409
411
|
className: "text-2xl font-bold py-4",
|
|
410
|
-
children:
|
|
412
|
+
children: e.title
|
|
411
413
|
}),
|
|
412
|
-
|
|
414
|
+
e.type === "summary" && /* @__PURE__ */ b("div", {
|
|
413
415
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
414
|
-
children:
|
|
416
|
+
children: n.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ b(m, { children: /* @__PURE__ */ x(h, {
|
|
415
417
|
className: "p-4",
|
|
416
418
|
children: [/* @__PURE__ */ b("div", {
|
|
417
419
|
className: "text-sm text-muted-foreground",
|
|
418
420
|
children: e.label || e.name
|
|
419
421
|
}), /* @__PURE__ */ b("div", {
|
|
420
422
|
className: "text-2xl font-bold",
|
|
421
|
-
children:
|
|
423
|
+
children: B(w(e.name, e.aggregation), e)
|
|
422
424
|
})]
|
|
423
425
|
}) }, t))
|
|
424
426
|
}),
|
|
425
|
-
|
|
426
|
-
className: "min-h-[300px]",
|
|
427
|
-
children: (() => {
|
|
428
|
-
let n = t.chart.type, r = !!t.chart.chartType;
|
|
429
|
-
!n && r && (n = "chart"), n && e.get(n) || (n = "chart");
|
|
430
|
-
let a = n === "chart" ? {
|
|
431
|
-
xAxisKey: t.chart.xAxisKey || t.chart.xAxisField || "name",
|
|
432
|
-
series: t.chart.series || (t.chart.yAxisFields ? t.chart.yAxisFields.map((e) => ({ dataKey: e })) : []),
|
|
433
|
-
chartType: t.chart.chartType || "bar"
|
|
434
|
-
} : {};
|
|
435
|
-
return /* @__PURE__ */ b(u, { schema: {
|
|
436
|
-
...t.chart,
|
|
437
|
-
type: n,
|
|
438
|
-
...a,
|
|
439
|
-
data: i || t.chart.data,
|
|
440
|
-
className: t.chart.className || "w-full h-[350px]"
|
|
441
|
-
} });
|
|
442
|
-
})()
|
|
443
|
-
}),
|
|
444
|
-
t.type === "table" && /* @__PURE__ */ b("div", {
|
|
427
|
+
e.type === "table" && /* @__PURE__ */ b("div", {
|
|
445
428
|
className: "border rounded-lg overflow-x-auto",
|
|
446
429
|
children: /* @__PURE__ */ x("table", {
|
|
447
430
|
className: "w-full text-sm min-w-[600px]",
|
|
448
431
|
children: [/* @__PURE__ */ b("thead", {
|
|
449
432
|
className: "bg-muted",
|
|
450
|
-
children: /* @__PURE__ */ b("tr", { children:
|
|
433
|
+
children: /* @__PURE__ */ b("tr", { children: e.columns?.map((e, t) => /* @__PURE__ */ b("th", {
|
|
451
434
|
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
452
435
|
children: e.label || e.name
|
|
453
436
|
}, t)) })
|
|
454
437
|
}), /* @__PURE__ */ b("tbody", { children: (() => {
|
|
455
|
-
let
|
|
456
|
-
return
|
|
438
|
+
let t = oe(r || [], n.groupBy || []);
|
|
439
|
+
return t ? t.map((t) => /* @__PURE__ */ x(s.Fragment, { children: [/* @__PURE__ */ b("tr", {
|
|
457
440
|
className: "bg-muted/60",
|
|
458
441
|
children: /* @__PURE__ */ x("td", {
|
|
459
|
-
colSpan:
|
|
442
|
+
colSpan: e.columns?.length || 1,
|
|
460
443
|
className: "px-4 py-2 font-semibold text-sm",
|
|
461
444
|
children: [
|
|
462
|
-
|
|
445
|
+
t.label,
|
|
463
446
|
" (",
|
|
464
|
-
|
|
447
|
+
t.rows.length,
|
|
465
448
|
")"
|
|
466
449
|
]
|
|
467
450
|
})
|
|
468
|
-
}),
|
|
451
|
+
}), t.rows.map((t, n) => /* @__PURE__ */ b("tr", {
|
|
469
452
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
470
|
-
children:
|
|
471
|
-
className: `px-4 py-2 ${
|
|
472
|
-
style:
|
|
473
|
-
children:
|
|
453
|
+
children: e.columns?.map((e, n) => /* @__PURE__ */ b("td", {
|
|
454
|
+
className: `px-4 py-2 ${e.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
455
|
+
style: D(e.name, t[e.name]),
|
|
456
|
+
children: k(t[e.name], e)
|
|
474
457
|
}, n))
|
|
475
|
-
}, n))] },
|
|
458
|
+
}, n))] }, t.key)) : r?.map((t, n) => /* @__PURE__ */ b("tr", {
|
|
476
459
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
477
|
-
children:
|
|
478
|
-
className: `px-4 py-2 ${
|
|
479
|
-
style:
|
|
480
|
-
children:
|
|
460
|
+
children: e.columns?.map((e, n) => /* @__PURE__ */ b("td", {
|
|
461
|
+
className: `px-4 py-2 ${e.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
462
|
+
style: D(e.name, t[e.name]),
|
|
463
|
+
children: k(t[e.name], e)
|
|
481
464
|
}, n))
|
|
482
465
|
}, n));
|
|
483
466
|
})() })]
|
|
484
467
|
})
|
|
485
468
|
}),
|
|
486
|
-
|
|
469
|
+
e.type === "text" && e.text && /* @__PURE__ */ b("div", {
|
|
487
470
|
className: "prose max-w-none",
|
|
488
|
-
children: /* @__PURE__ */ b("p", { children:
|
|
471
|
+
children: /* @__PURE__ */ b("p", { children: e.text })
|
|
489
472
|
}),
|
|
490
|
-
|
|
491
|
-
|
|
473
|
+
e.type === "page-break" && /* @__PURE__ */ b("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
|
|
474
|
+
e.content && /* @__PURE__ */ b(u, { schema: e.content })
|
|
492
475
|
]
|
|
493
|
-
},
|
|
494
|
-
!
|
|
476
|
+
}, t)),
|
|
477
|
+
!n.sections && r && r.length > 0 && /* @__PURE__ */ b("div", {
|
|
495
478
|
className: "border rounded-lg overflow-x-auto",
|
|
496
479
|
children: /* @__PURE__ */ x("table", {
|
|
497
480
|
className: "w-full text-sm min-w-[600px]",
|
|
498
481
|
children: [/* @__PURE__ */ b("thead", {
|
|
499
482
|
className: "bg-muted",
|
|
500
|
-
children: /* @__PURE__ */ b("tr", { children:
|
|
483
|
+
children: /* @__PURE__ */ b("tr", { children: n.fields?.map((e, t) => /* @__PURE__ */ b("th", {
|
|
501
484
|
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
502
485
|
children: e.label || e.name
|
|
503
486
|
}, t)) })
|
|
504
|
-
}), /* @__PURE__ */ b("tbody", { children:
|
|
487
|
+
}), /* @__PURE__ */ b("tbody", { children: r.map((e, t) => /* @__PURE__ */ b("tr", {
|
|
505
488
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
506
|
-
children:
|
|
489
|
+
children: n.fields?.map((t, n) => /* @__PURE__ */ b("td", {
|
|
507
490
|
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
508
|
-
style:
|
|
509
|
-
children:
|
|
491
|
+
style: D(t.name, e[t.name]),
|
|
492
|
+
children: k(e[t.name], t)
|
|
510
493
|
}, n))
|
|
511
494
|
}, t)) })]
|
|
512
495
|
})
|
|
@@ -520,26 +503,41 @@ var U = ({ schema: t, onRefresh: n }) => {
|
|
|
520
503
|
};
|
|
521
504
|
//#endregion
|
|
522
505
|
//#region src/DatasetReportRenderer.tsx
|
|
523
|
-
function
|
|
506
|
+
function H(e) {
|
|
524
507
|
if (!e || typeof e != "object") return !1;
|
|
525
508
|
let t = e;
|
|
526
509
|
return typeof t.dataset == "string" && t.dataset.length > 0 || t.type === "joined" && Array.isArray(t.blocks) && t.blocks.some((e) => typeof e?.dataset == "string");
|
|
527
510
|
}
|
|
528
|
-
function
|
|
511
|
+
function U(e, t) {
|
|
529
512
|
return e ? typeof e == "string" ? e : typeof e == "object" && typeof e.default == "string" ? e.default : t : t;
|
|
530
513
|
}
|
|
531
|
-
function
|
|
514
|
+
function W(e) {
|
|
532
515
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!e) : [];
|
|
533
516
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
517
|
+
function G(e) {
|
|
518
|
+
if (!Array.isArray(e)) return;
|
|
519
|
+
let t = {};
|
|
520
|
+
for (let n of e) {
|
|
521
|
+
let e = n && typeof n == "object" ? n.by : void 0;
|
|
522
|
+
typeof e != "string" || !e || (t[e] = n.direction === "desc" ? "desc" : "asc");
|
|
523
|
+
}
|
|
524
|
+
return Object.keys(t).length > 0 ? t : void 0;
|
|
525
|
+
}
|
|
526
|
+
function ce(e, t, n) {
|
|
527
|
+
if (!e) return;
|
|
528
|
+
let r = /* @__PURE__ */ new Set([...t, ...n]), i = {};
|
|
529
|
+
for (let [t, n] of Object.entries(e)) r.has(t) && (i[t] = n);
|
|
530
|
+
return Object.keys(i).length > 0 ? i : void 0;
|
|
531
|
+
}
|
|
532
|
+
function K(e, t, n, r, i, a, s) {
|
|
533
|
+
let [c, l] = o.useState({
|
|
536
534
|
status: "idle",
|
|
537
535
|
rows: []
|
|
538
|
-
}),
|
|
536
|
+
}), u = ce(s, t, n), d = JSON.stringify(r ?? null), f = JSON.stringify(a ?? null), p = JSON.stringify(u ?? null), m = `${e}|${t.join(",")}|${n.join(",")}|${d}|${f}|${p}`;
|
|
539
537
|
return o.useEffect(() => {
|
|
540
538
|
let o = i;
|
|
541
539
|
if (!o || typeof o.queryDataset != "function") {
|
|
542
|
-
|
|
540
|
+
l({
|
|
543
541
|
status: "error",
|
|
544
542
|
rows: [],
|
|
545
543
|
error: "This data source does not support dataset queries."
|
|
@@ -547,23 +545,24 @@ function q(e, t, n, r, i, a) {
|
|
|
547
545
|
return;
|
|
548
546
|
}
|
|
549
547
|
if (!e || n.length === 0) {
|
|
550
|
-
|
|
548
|
+
l({
|
|
551
549
|
status: "idle",
|
|
552
550
|
rows: []
|
|
553
551
|
});
|
|
554
552
|
return;
|
|
555
553
|
}
|
|
556
554
|
let s = !1;
|
|
557
|
-
return
|
|
555
|
+
return l({
|
|
558
556
|
status: "loading",
|
|
559
557
|
rows: []
|
|
560
558
|
}), o.queryDataset(e, {
|
|
561
559
|
dimensions: t,
|
|
562
560
|
measures: n,
|
|
563
561
|
...r && Object.keys(r).length > 0 ? { runtimeFilter: r } : {},
|
|
564
|
-
...a ? { totals: { groupings: a } } : {}
|
|
562
|
+
...a ? { totals: { groupings: a } } : {},
|
|
563
|
+
...u ? { order: u } : {}
|
|
565
564
|
}).then((e) => {
|
|
566
|
-
s ||
|
|
565
|
+
s || l({
|
|
567
566
|
status: "ok",
|
|
568
567
|
rows: Array.isArray(e?.rows) ? e.rows : [],
|
|
569
568
|
fields: Array.isArray(e?.fields) ? e.fields : [],
|
|
@@ -574,7 +573,7 @@ function q(e, t, n, r, i, a) {
|
|
|
574
573
|
totals: Array.isArray(e?.totals) ? e.totals : void 0
|
|
575
574
|
});
|
|
576
575
|
}).catch((e) => {
|
|
577
|
-
s ||
|
|
576
|
+
s || l({
|
|
578
577
|
status: "error",
|
|
579
578
|
rows: [],
|
|
580
579
|
error: String(e?.message ?? e)
|
|
@@ -582,9 +581,9 @@ function q(e, t, n, r, i, a) {
|
|
|
582
581
|
}), () => {
|
|
583
582
|
s = !0;
|
|
584
583
|
};
|
|
585
|
-
}, [
|
|
584
|
+
}, [m]), c;
|
|
586
585
|
}
|
|
587
|
-
function
|
|
586
|
+
function q({ dataset: e }) {
|
|
588
587
|
return /* @__PURE__ */ x("div", {
|
|
589
588
|
className: "flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
590
589
|
children: [
|
|
@@ -594,7 +593,7 @@ function J({ dataset: e }) {
|
|
|
594
593
|
]
|
|
595
594
|
});
|
|
596
595
|
}
|
|
597
|
-
function
|
|
596
|
+
function J({ status: e, error: t }) {
|
|
598
597
|
return e === "error" ? /* @__PURE__ */ x("div", {
|
|
599
598
|
role: "alert",
|
|
600
599
|
className: "flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",
|
|
@@ -607,68 +606,107 @@ function Y({ status: e, error: t }) {
|
|
|
607
606
|
children: [/* @__PURE__ */ b(w, { className: "h-4 w-4 animate-spin" }), " Running report…"]
|
|
608
607
|
});
|
|
609
608
|
}
|
|
610
|
-
function
|
|
609
|
+
function Y() {
|
|
611
610
|
return /* @__PURE__ */ x("div", {
|
|
612
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",
|
|
613
612
|
children: [/* @__PURE__ */ b(D, { className: "h-6 w-6" }), " The dataset returned no rows for this report’s scope."]
|
|
614
613
|
});
|
|
615
614
|
}
|
|
616
|
-
var
|
|
617
|
-
function
|
|
618
|
-
let
|
|
619
|
-
if (o.length === 0) return /* @__PURE__ */ b(
|
|
620
|
-
if (
|
|
621
|
-
if (
|
|
615
|
+
var le = "cursor-pointer hover:bg-accent/40";
|
|
616
|
+
function ue({ dataset: e, rows: a, values: o, runtimeFilter: s, dataSource: c, onDrill: l, order: u, withTotals: d }) {
|
|
617
|
+
let f = K(e, a, o, s, c, d && a.length > 0 ? [[]] : void 0, u), { fieldLabel: p } = k(), m = A();
|
|
618
|
+
if (o.length === 0) return /* @__PURE__ */ b(q, { dataset: e });
|
|
619
|
+
if (f.status === "loading" || f.status === "idle") return /* @__PURE__ */ b(J, { status: f.status });
|
|
620
|
+
if (f.status === "error") return /* @__PURE__ */ b(J, {
|
|
622
621
|
status: "error",
|
|
623
|
-
error:
|
|
622
|
+
error: f.error
|
|
624
623
|
});
|
|
625
|
-
if (
|
|
626
|
-
let
|
|
624
|
+
if (f.rows.length === 0) return /* @__PURE__ */ b(Y, {});
|
|
625
|
+
let h = !!l && a.length > 0, g = f.dimensionFields ? a.filter((e) => e in f.dimensionFields) : [], _ = (n, r) => {
|
|
627
626
|
let i = {};
|
|
628
627
|
for (let e of a) i[e] = n[e];
|
|
629
|
-
let o =
|
|
628
|
+
let o = f.drillRanges?.[r], c = !!o && Object.keys(o).length > 0, u = f.object && (g.length > 0 || c) ? t(f.drillRawRows?.[r], g, f.dimensionFields ?? {}, s, o) : void 0;
|
|
630
629
|
l({
|
|
631
630
|
dataset: e,
|
|
632
631
|
groupKey: i,
|
|
633
632
|
runtimeFilter: s,
|
|
634
|
-
object:
|
|
635
|
-
objectFilter:
|
|
633
|
+
object: f.object,
|
|
634
|
+
objectFilter: u
|
|
636
635
|
});
|
|
637
|
-
}, { measureField:
|
|
636
|
+
}, { measureField: v, headerLabel: y } = n(f.fields, f.object, p), S = [...a, ...o], C = d ? f.totals?.find((e) => Array.isArray(e.dimensions) && e.dimensions.length === 0)?.rows?.[0] : void 0, w = m("report.total", "Total");
|
|
638
637
|
return /* @__PURE__ */ b("div", {
|
|
639
638
|
className: "overflow-auto max-h-[70vh] rounded-md border",
|
|
640
639
|
children: /* @__PURE__ */ x("table", {
|
|
641
640
|
className: "w-full text-xs",
|
|
642
641
|
children: [/* @__PURE__ */ b("thead", {
|
|
643
642
|
className: "bg-muted/40",
|
|
644
|
-
children: /* @__PURE__ */ b("tr", { children:
|
|
643
|
+
children: /* @__PURE__ */ b("tr", { children: S.map((e) => /* @__PURE__ */ b("th", {
|
|
645
644
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
646
|
-
children:
|
|
645
|
+
children: y(e)
|
|
647
646
|
}, e)) })
|
|
648
|
-
}), /* @__PURE__ */
|
|
649
|
-
className: `border-t${
|
|
650
|
-
"data-testid":
|
|
651
|
-
onClick:
|
|
652
|
-
children:
|
|
647
|
+
}), /* @__PURE__ */ x("tbody", { children: [f.rows.map((e, t) => /* @__PURE__ */ b("tr", {
|
|
648
|
+
className: `border-t${h ? ` ${le}` : ""}`,
|
|
649
|
+
"data-testid": h ? "dataset-drill-row" : void 0,
|
|
650
|
+
onClick: h ? () => _(e, t) : void 0,
|
|
651
|
+
children: S.map((t) => /* @__PURE__ */ b("td", {
|
|
653
652
|
className: "px-2 py-1 tabular-nums whitespace-nowrap",
|
|
654
|
-
children: o.includes(t) ? i(e[t],
|
|
653
|
+
children: o.includes(t) ? i(e[t], v(t)?.format, v(t)?.currency, v(t)?.percentScale) : r(e[t])
|
|
655
654
|
}, t))
|
|
656
|
-
}, t))
|
|
655
|
+
}, t)), C && /* @__PURE__ */ x("tr", {
|
|
656
|
+
className: "border-t bg-muted/30 font-medium",
|
|
657
|
+
"data-testid": "dataset-report-total-row",
|
|
658
|
+
children: [a.length > 0 && /* @__PURE__ */ b("td", {
|
|
659
|
+
colSpan: a.length,
|
|
660
|
+
className: "px-2 py-1 whitespace-nowrap",
|
|
661
|
+
children: w
|
|
662
|
+
}), o.map((e) => /* @__PURE__ */ b("td", {
|
|
663
|
+
className: "px-2 py-1 tabular-nums whitespace-nowrap",
|
|
664
|
+
children: i(C[e], v(e)?.format, v(e)?.currency, v(e)?.percentScale)
|
|
665
|
+
}, e))]
|
|
666
|
+
})] })]
|
|
657
667
|
})
|
|
658
668
|
});
|
|
659
669
|
}
|
|
660
|
-
function
|
|
670
|
+
function de(e) {
|
|
661
671
|
switch (e) {
|
|
662
|
-
case "
|
|
663
|
-
case "
|
|
664
|
-
case "
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
672
|
+
case "summary": return "summary";
|
|
673
|
+
case "matrix": return "matrix";
|
|
674
|
+
case "joined": return "joined";
|
|
675
|
+
default: return "tabular";
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
function fe(e) {
|
|
679
|
+
switch (e) {
|
|
680
|
+
case "bar":
|
|
681
|
+
case "column":
|
|
682
|
+
case "horizontal-bar":
|
|
683
|
+
case "line":
|
|
684
|
+
case "area":
|
|
685
|
+
case "pie":
|
|
686
|
+
case "donut":
|
|
687
|
+
case "funnel":
|
|
688
|
+
case "scatter":
|
|
689
|
+
case "treemap":
|
|
690
|
+
case "sankey":
|
|
691
|
+
case "radar":
|
|
692
|
+
case "combo": return {
|
|
693
|
+
kind: "series",
|
|
694
|
+
chartType: e
|
|
695
|
+
};
|
|
696
|
+
case "gauge":
|
|
697
|
+
case "solid-gauge":
|
|
698
|
+
case "metric":
|
|
699
|
+
case "kpi":
|
|
700
|
+
case "bullet": return { kind: "single_value" };
|
|
701
|
+
case "table":
|
|
702
|
+
case "pivot": return { kind: "tabular" };
|
|
703
|
+
default: return {
|
|
704
|
+
kind: "unsupported",
|
|
705
|
+
type: String(e)
|
|
706
|
+
};
|
|
669
707
|
}
|
|
670
708
|
}
|
|
671
|
-
function
|
|
709
|
+
function pe(t) {
|
|
672
710
|
let [, n] = o.useReducer((e) => e + 1, 0);
|
|
673
711
|
return o.useEffect(() => {
|
|
674
712
|
if (e.get(t)) return;
|
|
@@ -678,54 +716,83 @@ function se(t) {
|
|
|
678
716
|
return i && typeof i.then == "function" && i.then(() => n()).catch(() => {}), r;
|
|
679
717
|
}, [t]), e.get(t);
|
|
680
718
|
}
|
|
681
|
-
function
|
|
682
|
-
let
|
|
683
|
-
if (
|
|
684
|
-
if (
|
|
719
|
+
function me({ dataset: e, chart: t, runtimeFilter: r, dataSource: a, order: o }) {
|
|
720
|
+
let s = typeof t.xAxis == "string" ? t.xAxis : "", c = typeof t.yAxis == "string" ? t.yAxis : "", l = fe(t.type), u = l.kind === "series" || l.kind === "single_value", d = K(e, l.kind === "series" && s ? [s] : [], u && c ? [c] : [], r, a, void 0, o), f = pe("chart"), { fieldLabel: p } = k(), m = typeof t.title == "string" ? t.title : void 0;
|
|
721
|
+
if (l.kind === "tabular") return null;
|
|
722
|
+
if (l.kind === "unsupported") return /* @__PURE__ */ x("div", {
|
|
723
|
+
className: "rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground",
|
|
724
|
+
"data-testid": "dataset-report-chart-unsupported",
|
|
725
|
+
children: [
|
|
726
|
+
"Chart type “",
|
|
727
|
+
l.type,
|
|
728
|
+
"” is not a spec chart type — the grouped table below carries this report’s numbers."
|
|
729
|
+
]
|
|
730
|
+
});
|
|
731
|
+
if (l.kind === "series" && !s || !c) return null;
|
|
732
|
+
if (d.status === "loading" || d.status === "idle") return /* @__PURE__ */ x("div", {
|
|
685
733
|
className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
|
|
686
734
|
children: [/* @__PURE__ */ b(w, { className: "h-4 w-4 animate-spin" }), " Loading chart…"]
|
|
687
735
|
});
|
|
688
|
-
if (
|
|
689
|
-
|
|
690
|
-
|
|
736
|
+
if (d.status === "error" || d.rows.length === 0) return null;
|
|
737
|
+
if (l.kind === "single_value") {
|
|
738
|
+
let { measureField: e, headerLabel: t } = n(d.fields, d.object, p), r = e(c);
|
|
739
|
+
return /* @__PURE__ */ x("div", {
|
|
740
|
+
className: "rounded-md border bg-card p-3",
|
|
741
|
+
"data-testid": "dataset-report-metric",
|
|
742
|
+
children: [m ? /* @__PURE__ */ b("h3", {
|
|
743
|
+
className: "mb-2 text-sm font-semibold",
|
|
744
|
+
children: m
|
|
745
|
+
}) : null, /* @__PURE__ */ x("div", {
|
|
746
|
+
className: "flex flex-col gap-0.5 py-2",
|
|
747
|
+
children: [/* @__PURE__ */ b("span", {
|
|
748
|
+
className: "text-2xl font-semibold tabular-nums",
|
|
749
|
+
children: i(d.rows[0]?.[c], r?.format, r?.currency, r?.percentScale)
|
|
750
|
+
}), /* @__PURE__ */ b("span", {
|
|
751
|
+
className: "text-xs text-muted-foreground",
|
|
752
|
+
children: t(c)
|
|
753
|
+
})]
|
|
754
|
+
})]
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
return f ? /* @__PURE__ */ x("div", {
|
|
691
758
|
className: "rounded-md border bg-card p-3",
|
|
692
759
|
"data-testid": "dataset-report-chart",
|
|
693
|
-
children: [
|
|
760
|
+
children: [m ? /* @__PURE__ */ b("h3", {
|
|
694
761
|
className: "mb-2 text-sm font-semibold",
|
|
695
|
-
children:
|
|
696
|
-
}) : null, /* @__PURE__ */ b(
|
|
697
|
-
chartType:
|
|
698
|
-
data:
|
|
699
|
-
xAxisKey:
|
|
700
|
-
series: [{ dataKey:
|
|
762
|
+
children: m
|
|
763
|
+
}) : null, /* @__PURE__ */ b(f, { schema: {
|
|
764
|
+
chartType: l.chartType,
|
|
765
|
+
data: d.rows,
|
|
766
|
+
xAxisKey: s,
|
|
767
|
+
series: [{ dataKey: c }],
|
|
701
768
|
height: typeof t.height == "number" ? t.height : 280,
|
|
702
769
|
isAnimationActive: !1
|
|
703
770
|
} })]
|
|
704
|
-
});
|
|
771
|
+
}) : null;
|
|
705
772
|
}
|
|
706
|
-
function
|
|
773
|
+
function X(e, t) {
|
|
707
774
|
return e.map((e) => String(t[e] ?? "∅")).join("");
|
|
708
775
|
}
|
|
709
|
-
function
|
|
776
|
+
function he(e, t) {
|
|
710
777
|
return e.map((e) => r(t[e])).join(" / ");
|
|
711
778
|
}
|
|
712
|
-
function
|
|
713
|
-
let
|
|
779
|
+
function Z({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l, dataSource: u, onDrill: d, order: f }) {
|
|
780
|
+
let p = K(e, [...a, ...s], c, l, u, [
|
|
714
781
|
a,
|
|
715
782
|
s,
|
|
716
783
|
[]
|
|
717
|
-
]),
|
|
718
|
-
if (
|
|
784
|
+
], f), m = A(), { fieldLabel: h } = k(), g = o.useMemo(() => {
|
|
785
|
+
if (p.status !== "ok") return null;
|
|
719
786
|
let e = [], t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
|
|
720
|
-
return
|
|
721
|
-
let l =
|
|
787
|
+
return p.rows.forEach((o, c) => {
|
|
788
|
+
let l = X(a, o), u = X(s, o);
|
|
722
789
|
if (!n.has(l)) {
|
|
723
790
|
n.add(l);
|
|
724
791
|
let t = {};
|
|
725
792
|
for (let e of a) t[e] = o[e];
|
|
726
793
|
e.push({
|
|
727
794
|
id: l,
|
|
728
|
-
label:
|
|
795
|
+
label: he(a, o),
|
|
729
796
|
key: t
|
|
730
797
|
});
|
|
731
798
|
}
|
|
@@ -735,7 +802,7 @@ function ue({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l
|
|
|
735
802
|
for (let t of s) e[t] = o[t];
|
|
736
803
|
t.push({
|
|
737
804
|
id: u,
|
|
738
|
-
label:
|
|
805
|
+
label: he(s, o),
|
|
739
806
|
key: e
|
|
740
807
|
});
|
|
741
808
|
}
|
|
@@ -749,19 +816,19 @@ function ue({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l
|
|
|
749
816
|
cells: i
|
|
750
817
|
};
|
|
751
818
|
}, [
|
|
752
|
-
|
|
819
|
+
p,
|
|
753
820
|
a,
|
|
754
821
|
s
|
|
755
822
|
]);
|
|
756
|
-
if (c.length === 0) return /* @__PURE__ */ b(
|
|
757
|
-
if (
|
|
758
|
-
if (
|
|
823
|
+
if (c.length === 0) return /* @__PURE__ */ b(q, { dataset: e });
|
|
824
|
+
if (p.status === "loading" || p.status === "idle") return /* @__PURE__ */ b(J, { status: p.status });
|
|
825
|
+
if (p.status === "error") return /* @__PURE__ */ b(J, {
|
|
759
826
|
status: "error",
|
|
760
|
-
error:
|
|
827
|
+
error: p.error
|
|
761
828
|
});
|
|
762
|
-
if (!
|
|
763
|
-
let { measureField:
|
|
764
|
-
let a =
|
|
829
|
+
if (!g || g.rowHeaders.length === 0) return /* @__PURE__ */ b(Y, {});
|
|
830
|
+
let { measureField: _, headerLabel: v } = n(p.fields, p.object, h), y = m("report.total", "Total"), S = !!d, C = p.dimensionFields ? [...a, ...s].filter((e) => e in p.dimensionFields) : [], w = (n, r, i) => {
|
|
831
|
+
let a = p.drillRanges?.[i], o = !!a && Object.keys(a).length > 0, s = p.object && (C.length > 0 || o) ? t(p.drillRawRows?.[i], C, p.dimensionFields ?? {}, l, a) : void 0;
|
|
765
832
|
d({
|
|
766
833
|
dataset: e,
|
|
767
834
|
groupKey: {
|
|
@@ -769,18 +836,18 @@ function ue({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l
|
|
|
769
836
|
...r
|
|
770
837
|
},
|
|
771
838
|
runtimeFilter: l,
|
|
772
|
-
object:
|
|
839
|
+
object: p.object,
|
|
773
840
|
objectFilter: s
|
|
774
841
|
});
|
|
775
|
-
},
|
|
842
|
+
}, T = g.colHeaders.flatMap((e) => c.map((t) => ({
|
|
776
843
|
col: e,
|
|
777
844
|
measure: t,
|
|
778
|
-
header: c.length === 1 ? e.label : `${e.label} · ${
|
|
779
|
-
}))),
|
|
780
|
-
for (let e of
|
|
781
|
-
let
|
|
782
|
-
for (let e of
|
|
783
|
-
let
|
|
845
|
+
header: c.length === 1 ? e.label : `${e.label} · ${v(t)}`
|
|
846
|
+
}))), E = (e) => p.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, D = /* @__PURE__ */ new Map();
|
|
847
|
+
for (let e of E(a) ?? []) D.set(X(a, e), e);
|
|
848
|
+
let O = /* @__PURE__ */ new Map();
|
|
849
|
+
for (let e of E(s) ?? []) O.set(X(s, e), e);
|
|
850
|
+
let ee = E([])?.[0], j = D.size > 0, M = O.size > 0;
|
|
784
851
|
return /* @__PURE__ */ b("div", {
|
|
785
852
|
className: "overflow-auto max-h-[70vh] rounded-md border",
|
|
786
853
|
"data-testid": "dataset-matrix",
|
|
@@ -791,38 +858,38 @@ function ue({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l
|
|
|
791
858
|
children: /* @__PURE__ */ x("tr", { children: [
|
|
792
859
|
a.map((e) => /* @__PURE__ */ b("th", {
|
|
793
860
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
794
|
-
children:
|
|
861
|
+
children: v(e)
|
|
795
862
|
}, e)),
|
|
796
|
-
|
|
863
|
+
T.map((e) => /* @__PURE__ */ b("th", {
|
|
797
864
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
798
865
|
children: e.header
|
|
799
866
|
}, `${e.col.id}-${e.measure}`)),
|
|
800
|
-
|
|
867
|
+
j && c.map((e) => /* @__PURE__ */ b("th", {
|
|
801
868
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
802
869
|
"data-testid": "matrix-total-col-header",
|
|
803
|
-
children: c.length === 1 ?
|
|
870
|
+
children: c.length === 1 ? y : `${y} · ${v(e)}`
|
|
804
871
|
}, `total-${e}`))
|
|
805
872
|
] })
|
|
806
|
-
}), /* @__PURE__ */ x("tbody", { children: [
|
|
873
|
+
}), /* @__PURE__ */ x("tbody", { children: [g.rowHeaders.map((e) => /* @__PURE__ */ x("tr", {
|
|
807
874
|
className: "border-t",
|
|
808
875
|
children: [
|
|
809
876
|
a.map((t) => /* @__PURE__ */ b("td", {
|
|
810
877
|
className: "px-2 py-1 whitespace-nowrap font-medium",
|
|
811
878
|
children: r(e.key[t])
|
|
812
879
|
}, t)),
|
|
813
|
-
|
|
814
|
-
let n =
|
|
880
|
+
T.map((t) => {
|
|
881
|
+
let n = g.cells.get(`${e.id} ${t.col.id}`), r = n?.row[t.measure], a = S && n != null;
|
|
815
882
|
return /* @__PURE__ */ b("td", {
|
|
816
|
-
className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${a ? ` ${
|
|
883
|
+
className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${a ? ` ${le}` : ""}`,
|
|
817
884
|
"data-testid": a ? "dataset-drill-cell" : void 0,
|
|
818
|
-
onClick: a ? () =>
|
|
819
|
-
children: i(r,
|
|
885
|
+
onClick: a ? () => w(e.key, t.col.key, n.index) : void 0,
|
|
886
|
+
children: i(r, _(t.measure)?.format, _(t.measure)?.currency, _(t.measure)?.percentScale)
|
|
820
887
|
}, `${t.col.id}-${t.measure}`);
|
|
821
888
|
}),
|
|
822
|
-
|
|
889
|
+
j && c.map((t) => /* @__PURE__ */ b("td", {
|
|
823
890
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
|
|
824
891
|
"data-testid": "matrix-row-total",
|
|
825
|
-
children: i(
|
|
892
|
+
children: i(D.get(e.id)?.[t], _(t)?.format, _(t)?.currency, _(t)?.percentScale)
|
|
826
893
|
}, `total-${t}`))
|
|
827
894
|
]
|
|
828
895
|
}, e.id)), M && /* @__PURE__ */ x("tr", {
|
|
@@ -832,25 +899,25 @@ function ue({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l
|
|
|
832
899
|
a.length > 0 && /* @__PURE__ */ b("td", {
|
|
833
900
|
colSpan: a.length,
|
|
834
901
|
className: "px-2 py-1 whitespace-nowrap",
|
|
835
|
-
children:
|
|
902
|
+
children: y
|
|
836
903
|
}),
|
|
837
|
-
|
|
904
|
+
T.map((e) => /* @__PURE__ */ b("td", {
|
|
838
905
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
839
|
-
children: i(
|
|
906
|
+
children: i(O.get(e.col.id)?.[e.measure], _(e.measure)?.format, _(e.measure)?.currency, _(e.measure)?.percentScale)
|
|
840
907
|
}, `${e.col.id}-${e.measure}`)),
|
|
841
|
-
|
|
908
|
+
j && c.map((e) => /* @__PURE__ */ b("td", {
|
|
842
909
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
843
910
|
"data-testid": "matrix-grand-total",
|
|
844
|
-
children: i(
|
|
911
|
+
children: i(ee?.[e], _(e)?.format, _(e)?.currency, _(e)?.percentScale)
|
|
845
912
|
}, `grand-${e}`))
|
|
846
913
|
]
|
|
847
914
|
})] })]
|
|
848
915
|
})
|
|
849
916
|
});
|
|
850
917
|
}
|
|
851
|
-
var
|
|
852
|
-
let o = a(e.runtimeFilter ?? e.filter, n), s = e.drilldown === !1 ? void 0 : r;
|
|
853
|
-
if (
|
|
918
|
+
var ge = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i }) => {
|
|
919
|
+
let o = a(e.runtimeFilter ?? e.filter, n), s = e.drilldown === !1 ? void 0 : r, c = de(e.type);
|
|
920
|
+
if (c === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */ b("div", {
|
|
854
921
|
className: i,
|
|
855
922
|
"data-testid": "dataset-joined-report",
|
|
856
923
|
"data-report-name": e.name,
|
|
@@ -860,21 +927,24 @@ var de = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
|
|
|
860
927
|
gap: 24
|
|
861
928
|
},
|
|
862
929
|
children: e.blocks.map((e, n) => {
|
|
863
|
-
let r = a(o, e.runtimeFilter ?? e.filter), i =
|
|
930
|
+
let r = a(o, e.runtimeFilter ?? e.filter), i = W(e.columns), c = G(e.order), l = de(e.type), u = l === "matrix" && i.length > 0 ? /* @__PURE__ */ b(Z, {
|
|
864
931
|
dataset: String(e.dataset ?? ""),
|
|
865
|
-
rows:
|
|
932
|
+
rows: W(e.rows),
|
|
866
933
|
columnsAcross: i,
|
|
867
|
-
values:
|
|
934
|
+
values: W(e.values),
|
|
868
935
|
runtimeFilter: r,
|
|
869
936
|
dataSource: t,
|
|
870
|
-
onDrill: s
|
|
871
|
-
|
|
937
|
+
onDrill: s,
|
|
938
|
+
order: c
|
|
939
|
+
}) : /* @__PURE__ */ b(ue, {
|
|
872
940
|
dataset: String(e.dataset ?? ""),
|
|
873
|
-
rows:
|
|
874
|
-
values:
|
|
941
|
+
rows: W(e.rows),
|
|
942
|
+
values: W(e.values),
|
|
875
943
|
runtimeFilter: r,
|
|
876
944
|
dataSource: t,
|
|
877
|
-
onDrill: s
|
|
945
|
+
onDrill: s,
|
|
946
|
+
order: c,
|
|
947
|
+
withTotals: l === "summary" || l === "matrix"
|
|
878
948
|
});
|
|
879
949
|
return /* @__PURE__ */ x("section", {
|
|
880
950
|
"data-testid": "dataset-report-block",
|
|
@@ -884,52 +954,57 @@ var de = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
|
|
|
884
954
|
className: "flex flex-col gap-0.5",
|
|
885
955
|
children: [/* @__PURE__ */ b("h3", {
|
|
886
956
|
className: "text-sm font-semibold",
|
|
887
|
-
children:
|
|
957
|
+
children: U(e.label, e.name ?? `Block ${n + 1}`)
|
|
888
958
|
}), e.description ? /* @__PURE__ */ b("p", {
|
|
889
959
|
className: "text-xs text-muted-foreground",
|
|
890
|
-
children:
|
|
960
|
+
children: U(e.description, "")
|
|
891
961
|
}) : null]
|
|
892
|
-
}),
|
|
962
|
+
}), u]
|
|
893
963
|
}, e.name ?? `block-${n}`);
|
|
894
964
|
})
|
|
895
965
|
});
|
|
896
|
-
let
|
|
897
|
-
if (
|
|
966
|
+
let l = W(e.columns), u = G(e.order);
|
|
967
|
+
if (c === "matrix" && l.length > 0) return /* @__PURE__ */ b("div", {
|
|
898
968
|
className: i,
|
|
899
969
|
"data-testid": "dataset-report",
|
|
900
970
|
"data-report-name": e.name,
|
|
901
|
-
children: /* @__PURE__ */ b(
|
|
971
|
+
children: /* @__PURE__ */ b(Z, {
|
|
902
972
|
dataset: String(e.dataset ?? ""),
|
|
903
|
-
rows:
|
|
904
|
-
columnsAcross:
|
|
905
|
-
values:
|
|
973
|
+
rows: W(e.rows),
|
|
974
|
+
columnsAcross: l,
|
|
975
|
+
values: W(e.values),
|
|
906
976
|
runtimeFilter: o,
|
|
907
977
|
dataSource: t,
|
|
908
|
-
onDrill: s
|
|
978
|
+
onDrill: s,
|
|
979
|
+
order: u
|
|
909
980
|
})
|
|
910
981
|
});
|
|
911
|
-
let
|
|
982
|
+
let d = e.chart && typeof e.chart == "object" && e.chart.type ? e.chart : null;
|
|
912
983
|
return /* @__PURE__ */ x("div", {
|
|
913
984
|
className: `${i ?? ""} flex flex-col gap-3`,
|
|
914
985
|
"data-testid": "dataset-report",
|
|
915
986
|
"data-report-name": e.name,
|
|
916
|
-
|
|
987
|
+
"data-report-presentation": c,
|
|
988
|
+
children: [d ? /* @__PURE__ */ b(me, {
|
|
917
989
|
dataset: String(e.dataset ?? ""),
|
|
918
|
-
chart:
|
|
990
|
+
chart: d,
|
|
919
991
|
runtimeFilter: o,
|
|
920
|
-
dataSource: t
|
|
921
|
-
|
|
992
|
+
dataSource: t,
|
|
993
|
+
order: u
|
|
994
|
+
}) : null, /* @__PURE__ */ b(ue, {
|
|
922
995
|
dataset: String(e.dataset ?? ""),
|
|
923
|
-
rows:
|
|
924
|
-
values:
|
|
996
|
+
rows: W(e.rows),
|
|
997
|
+
values: W(e.values),
|
|
925
998
|
runtimeFilter: o,
|
|
926
999
|
dataSource: t,
|
|
927
|
-
onDrill: s
|
|
1000
|
+
onDrill: s,
|
|
1001
|
+
order: u,
|
|
1002
|
+
withTotals: c === "summary" || c === "matrix"
|
|
928
1003
|
})]
|
|
929
1004
|
});
|
|
930
|
-
},
|
|
1005
|
+
}, Q = (e) => {
|
|
931
1006
|
let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: a } = e, s = o.useContext(d), u = t ?? s?.dataSource, f = e.schema;
|
|
932
|
-
return f && typeof f == "object" && f.type === "spec-report" && f.report && typeof f.report == "object" && (f = f.report),
|
|
1007
|
+
return f && typeof f == "object" && f.type === "spec-report" && f.report && typeof f.report == "object" && (f = f.report), H(f) ? /* @__PURE__ */ b(ge, {
|
|
933
1008
|
report: f,
|
|
934
1009
|
dataSource: u,
|
|
935
1010
|
runtimeFilter: r,
|
|
@@ -938,21 +1013,21 @@ var de = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
|
|
|
938
1013
|
}) : c(f) ? /* @__PURE__ */ b("div", {
|
|
939
1014
|
className: a,
|
|
940
1015
|
"data-testid": "report-presentation-bridge",
|
|
941
|
-
children: /* @__PURE__ */ b(
|
|
1016
|
+
children: /* @__PURE__ */ b(V, { schema: {
|
|
942
1017
|
type: "report-viewer",
|
|
943
1018
|
report: l(f),
|
|
944
1019
|
data: n ?? [],
|
|
945
1020
|
showToolbar: !1
|
|
946
1021
|
} })
|
|
947
|
-
}) : /* @__PURE__ */ b(
|
|
1022
|
+
}) : /* @__PURE__ */ b(j, { schema: f });
|
|
948
1023
|
};
|
|
949
1024
|
//#endregion
|
|
950
1025
|
//#region src/LiveReportExporter.ts
|
|
951
|
-
async function
|
|
1026
|
+
async function $(e, t) {
|
|
952
1027
|
let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o } = t, s = a || e.defaultExportFormat || "pdf";
|
|
953
1028
|
try {
|
|
954
1029
|
let t = (await n.find(r, i)).data || [];
|
|
955
|
-
return
|
|
1030
|
+
return I(s, e, t, {
|
|
956
1031
|
format: s,
|
|
957
1032
|
...e.exportConfigs?.[s],
|
|
958
1033
|
...o
|
|
@@ -970,17 +1045,17 @@ async function fe(e, t) {
|
|
|
970
1045
|
};
|
|
971
1046
|
}
|
|
972
1047
|
}
|
|
973
|
-
function
|
|
974
|
-
let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(
|
|
1048
|
+
function _e(e, t, n = {}) {
|
|
1049
|
+
let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(ye), s = o.map((e) => e.header), c = t.map((e, t) => o.map((n) => {
|
|
975
1050
|
if (n.formula) return n.formula.replace(/\{ROW\}/g, String(t + 2));
|
|
976
1051
|
let r = e[n.name];
|
|
977
|
-
return
|
|
1052
|
+
return be(r, n.numberFormat);
|
|
978
1053
|
}));
|
|
979
1054
|
if (a && t.length > 0) {
|
|
980
1055
|
let n = o.map((n, r) => {
|
|
981
1056
|
let i = (e.fields || []).find((e) => e.name === n.name);
|
|
982
1057
|
if (i?.aggregation) {
|
|
983
|
-
let e =
|
|
1058
|
+
let e = Se(r), n = t.length + 1;
|
|
984
1059
|
switch (i.aggregation) {
|
|
985
1060
|
case "sum": return `=SUM(${e}2:${e}${n})`;
|
|
986
1061
|
case "avg": return `=AVERAGE(${e}2:${e}${n})`;
|
|
@@ -994,15 +1069,15 @@ function pe(e, t, n = {}) {
|
|
|
994
1069
|
});
|
|
995
1070
|
c.push(n);
|
|
996
1071
|
}
|
|
997
|
-
|
|
1072
|
+
we("" + [s.join(" "), ...c.map((e) => e.join(" "))].join("\n"), i || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
998
1073
|
}
|
|
999
|
-
function
|
|
1074
|
+
function ve(e, t, n, r) {
|
|
1000
1075
|
return async () => {
|
|
1001
1076
|
let i = e.schedule;
|
|
1002
1077
|
if (!i?.enabled) return [];
|
|
1003
1078
|
let a = i.formats || [e.defaultExportFormat || "pdf"], o = [];
|
|
1004
1079
|
for (let r of a) {
|
|
1005
|
-
let i = await
|
|
1080
|
+
let i = await $(e, {
|
|
1006
1081
|
dataSource: t,
|
|
1007
1082
|
resource: n,
|
|
1008
1083
|
format: r
|
|
@@ -1012,16 +1087,16 @@ function me(e, t, n, r) {
|
|
|
1012
1087
|
return r(e, i), o;
|
|
1013
1088
|
};
|
|
1014
1089
|
}
|
|
1015
|
-
function
|
|
1090
|
+
function ye(e) {
|
|
1016
1091
|
return {
|
|
1017
1092
|
name: e.name,
|
|
1018
1093
|
header: e.label || e.name
|
|
1019
1094
|
};
|
|
1020
1095
|
}
|
|
1021
|
-
function
|
|
1022
|
-
return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US",
|
|
1096
|
+
function be(e, t) {
|
|
1097
|
+
return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US", xe(t)) : Ce(String(e));
|
|
1023
1098
|
}
|
|
1024
|
-
function
|
|
1099
|
+
function xe(e) {
|
|
1025
1100
|
if (e.includes("%")) return {
|
|
1026
1101
|
style: "percent",
|
|
1027
1102
|
minimumFractionDigits: 0
|
|
@@ -1032,23 +1107,23 @@ function _e(e) {
|
|
|
1032
1107
|
maximumFractionDigits: Math.max(0, t - 1)
|
|
1033
1108
|
};
|
|
1034
1109
|
}
|
|
1035
|
-
function
|
|
1110
|
+
function Se(e) {
|
|
1036
1111
|
let t = "", n = e;
|
|
1037
1112
|
for (; n >= 0;) t = String.fromCharCode(n % 26 + 65) + t, n = Math.floor(n / 26) - 1;
|
|
1038
1113
|
return t;
|
|
1039
1114
|
}
|
|
1040
|
-
function
|
|
1115
|
+
function Ce(e) {
|
|
1041
1116
|
if (e.length > 0) {
|
|
1042
1117
|
let t = e.charAt(0);
|
|
1043
1118
|
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `'${e}`;
|
|
1044
1119
|
}
|
|
1045
1120
|
return e;
|
|
1046
1121
|
}
|
|
1047
|
-
function
|
|
1122
|
+
function we(e, t, n) {
|
|
1048
1123
|
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
1049
1124
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
1050
1125
|
}
|
|
1051
|
-
e.register("report",
|
|
1126
|
+
e.register("report", Q, {
|
|
1052
1127
|
namespace: "report",
|
|
1053
1128
|
label: "Report",
|
|
1054
1129
|
category: "Report",
|
|
@@ -1069,7 +1144,7 @@ e.register("report", $, {
|
|
|
1069
1144
|
label: "Chart Configuration"
|
|
1070
1145
|
}
|
|
1071
1146
|
]
|
|
1072
|
-
}), e.register("spec-report",
|
|
1147
|
+
}), e.register("spec-report", Q, {
|
|
1073
1148
|
namespace: "report",
|
|
1074
1149
|
label: "Spec Report",
|
|
1075
1150
|
category: "Report",
|
|
@@ -1082,7 +1157,7 @@ e.register("report", $, {
|
|
|
1082
1157
|
type: "string",
|
|
1083
1158
|
label: "Report Type"
|
|
1084
1159
|
}]
|
|
1085
|
-
}), e.register("report-viewer",
|
|
1160
|
+
}), e.register("report-viewer", V, {
|
|
1086
1161
|
namespace: "report",
|
|
1087
1162
|
label: "Report Viewer",
|
|
1088
1163
|
category: "Report",
|
|
@@ -1097,4 +1172,4 @@ e.register("report", $, {
|
|
|
1097
1172
|
}]
|
|
1098
1173
|
});
|
|
1099
1174
|
//#endregion
|
|
1100
|
-
export {
|
|
1175
|
+
export { ge as DatasetReportRenderer, j as LegacyReportRenderer, Q as ReportRenderer, V as ReportViewer, ve as createScheduleTrigger, M as exportAsCSV, F as exportAsExcel, P as exportAsHTML, N as exportAsJSON, te as exportAsPDF, _e as exportExcelWithFormulas, I as exportReport, $ as exportWithLiveData, B as formatValue, H as isDatasetReport, a as mergeFilters };
|