@object-ui/plugin-report 17.6.0 → 18.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/CHANGELOG.md +2136 -0
- package/README.md +98 -14
- package/dist/DatasetReportRenderer.d.ts +17 -3
- package/dist/LiveReportExporter.d.ts +19 -0
- package/dist/ReportExportEngine.d.ts +18 -3
- package/dist/ReportRenderer.d.ts +2 -2
- package/dist/displayLocale.d.ts +70 -0
- package/dist/formatValue.d.ts +19 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +537 -461
- package/dist/index.umd.cjs +22 -22
- package/dist/useDatasetDimensionLabels.d.ts +5 -3
- package/package.json +12 -15
package/dist/index.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { ComponentRegistry as e,
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { isSpecReport as
|
|
5
|
-
import { SchemaRenderer as
|
|
6
|
-
import { Badge as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { AlertTriangle as
|
|
9
|
-
import { getCellRenderer as
|
|
10
|
-
import { pickLocalized as
|
|
1
|
+
import { ComponentRegistry as e, FilterOperatorError as t, buildCategoryOrder as n, buildCategoryRank as r, buildChartSeries as i, buildDatasetDrillFilter as a, buildDatasetFieldHelpers as o, buildOptionColorMap as s, chartConfigPresentation as c, deriveDimensionLabelMaps as l, dimensionOptionTranslator as u, formatDimensionValue as d, formatMeasure as f, localizeFieldOptions as p, mergeAuthoredSeries as m, mergeFilters as h, pivotBucketId as g, pivotCellKey as _, pivotDimensionValue as v, relabelDimensions as y, toDisplayDate as b } from "@object-ui/core";
|
|
2
|
+
import * as x from "react";
|
|
3
|
+
import S from "react";
|
|
4
|
+
import { isSpecReport as C, specReportToPresentation as w } from "@object-ui/types";
|
|
5
|
+
import { SchemaRenderer as T, SchemaRendererContext as E, classifyLoadError as D, toRenderableSchema as O, useDataInvalidation as k, useDatasetDimensionMeta as ee } from "@object-ui/react";
|
|
6
|
+
import { Badge as A, Button as j, Card as M, CardContent as N, CardDescription as P, CardHeader as F, CardTitle as I, Skeleton as L, renderNodeSlot as te } from "@object-ui/components";
|
|
7
|
+
import { jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
8
|
+
import { AlertTriangle as ne, Download as B, Loader2 as re, Printer as ie, RefreshCw as ae, ShieldAlert as oe, Table2 as se } from "lucide-react";
|
|
9
|
+
import { getCellRenderer as ce, resolveCellRendererType as le } from "@object-ui/fields";
|
|
10
|
+
import { builtinAggregateLabels as V, pickLocalized as ue, useDisplayLocale as H, useObjectTranslation as de, useSafeFieldLabel as U, useSafeTranslate as W } from "@object-ui/i18n";
|
|
11
11
|
//#region src/LegacyReportRenderer.tsx
|
|
12
|
-
var
|
|
12
|
+
var fe = ({ 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__ */
|
|
16
|
+
return /* @__PURE__ */ z(M, {
|
|
17
17
|
className: `h-full flex flex-col ${t.className || ""}`,
|
|
18
|
-
children: [/* @__PURE__ */
|
|
18
|
+
children: [/* @__PURE__ */ z(F, { children: [n && /* @__PURE__ */ R(I, { children: n }), r && /* @__PURE__ */ R(P, { children: r })] }), /* @__PURE__ */ z(N, {
|
|
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__ */
|
|
22
|
+
return r ||= e.get("chart"), r ? /* @__PURE__ */ R("div", {
|
|
23
23
|
className: "min-h-[300px] border rounded-lg p-4 bg-background/50",
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ R(r, { schema: {
|
|
25
25
|
...t.chart,
|
|
26
26
|
data: t.chart.data || i
|
|
27
27
|
} })
|
|
28
|
-
}) : /* @__PURE__ */
|
|
28
|
+
}) : /* @__PURE__ */ z("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__ */
|
|
32
|
+
})(), i && i.length > 0 && /* @__PURE__ */ R("div", {
|
|
33
33
|
className: "border rounded-lg",
|
|
34
34
|
children: (() => {
|
|
35
35
|
let t = e.get("grid") || e.get("table");
|
|
36
|
-
return t ? /* @__PURE__ */
|
|
36
|
+
return t ? /* @__PURE__ */ R(t, { schema: {
|
|
37
37
|
type: "grid",
|
|
38
38
|
rowData: i,
|
|
39
39
|
columnDefs: a,
|
|
40
40
|
domLayout: "autoHeight"
|
|
41
|
-
} }) : /* @__PURE__ */
|
|
41
|
+
} }) : /* @__PURE__ */ R("div", {
|
|
42
42
|
className: "overflow-x-auto",
|
|
43
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ z("table", {
|
|
44
44
|
className: "w-full text-sm text-left",
|
|
45
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ R("thead", {
|
|
46
46
|
className: "text-xs uppercase bg-muted",
|
|
47
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ R("tr", { children: a?.map((e) => /* @__PURE__ */ R("th", {
|
|
48
48
|
className: "px-6 py-3",
|
|
49
49
|
children: e.headerName || e.label || e.field
|
|
50
50
|
}, e.field)) })
|
|
51
|
-
}), /* @__PURE__ */
|
|
51
|
+
}), /* @__PURE__ */ R("tbody", { children: i.map((e, t) => /* @__PURE__ */ R("tr", {
|
|
52
52
|
className: "bg-background border-b",
|
|
53
|
-
children: a?.map((t) => /* @__PURE__ */
|
|
53
|
+
children: a?.map((t) => /* @__PURE__ */ R("td", {
|
|
54
54
|
className: "px-6 py-4",
|
|
55
55
|
children: e[t.field]
|
|
56
56
|
}, t.field))
|
|
@@ -62,33 +62,40 @@ var H = ({ schema: t }) => {
|
|
|
62
62
|
})]
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
|
+
function G(e, t, n) {
|
|
66
|
+
try {
|
|
67
|
+
return e.toLocaleString(t, n);
|
|
68
|
+
} catch {
|
|
69
|
+
return e.toLocaleString("en", n);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
65
72
|
//#endregion
|
|
66
73
|
//#region src/ReportExportEngine.ts
|
|
67
|
-
function
|
|
74
|
+
function pe(e, t, n) {
|
|
68
75
|
let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
|
|
69
76
|
let n = e[t.name];
|
|
70
|
-
return n =
|
|
77
|
+
return n = ye(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
71
78
|
}));
|
|
72
|
-
|
|
79
|
+
q([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
|
|
73
80
|
}
|
|
74
|
-
function
|
|
81
|
+
function me(e, t, n) {
|
|
75
82
|
let r = {
|
|
76
83
|
title: e.title,
|
|
77
84
|
description: e.description,
|
|
78
85
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
79
86
|
data: t
|
|
80
87
|
};
|
|
81
|
-
|
|
88
|
+
q(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
|
|
82
89
|
}
|
|
83
|
-
function
|
|
84
|
-
let
|
|
85
|
-
|
|
90
|
+
function he(e, t, n, r = "en") {
|
|
91
|
+
let i = e.fields || [], a = xe(n?.orientation), o = be(n?.pageSize);
|
|
92
|
+
q(`<!DOCTYPE html>
|
|
86
93
|
<html>
|
|
87
94
|
<head>
|
|
88
95
|
<meta charset="utf-8">
|
|
89
|
-
<title>${
|
|
96
|
+
<title>${K(e.title || "Report")}</title>
|
|
90
97
|
<style>
|
|
91
|
-
@page { size: ${
|
|
98
|
+
@page { size: ${o} ${a}; margin: 20mm; }
|
|
92
99
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
93
100
|
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
94
101
|
.description { color: #666; margin-bottom: 24px; }
|
|
@@ -100,33 +107,33 @@ function U(e, t, n) {
|
|
|
100
107
|
</style>
|
|
101
108
|
</head>
|
|
102
109
|
<body>
|
|
103
|
-
<h1>${
|
|
104
|
-
${e.description ? `<p class="description">${
|
|
105
|
-
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
110
|
+
<h1>${K(e.title || "Report")}</h1>
|
|
111
|
+
${e.description ? `<p class="description">${K(e.description)}</p>` : ""}
|
|
112
|
+
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString(r)}</p>
|
|
106
113
|
<table>
|
|
107
|
-
<thead><tr>${
|
|
108
|
-
<tbody>${t.map((e) => `<tr>${
|
|
114
|
+
<thead><tr>${i.map((e) => `<th>${K(e.label || e.name)}</th>`).join("")}</tr></thead>
|
|
115
|
+
<tbody>${t.map((e) => `<tr>${i.map((t) => `<td>${K(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
109
116
|
</table>
|
|
110
117
|
</body>
|
|
111
118
|
</html>`, n?.filename || `${e.title || "report"}.html`, "text/html");
|
|
112
119
|
}
|
|
113
|
-
function
|
|
114
|
-
let
|
|
115
|
-
if (!
|
|
116
|
-
|
|
120
|
+
function ge(e, t, n, r = "en") {
|
|
121
|
+
let i = e.fields || [], a = xe(n?.orientation), o = be(n?.pageSize), s = window.open("", "_blank");
|
|
122
|
+
if (!s) {
|
|
123
|
+
he(e, t, {
|
|
117
124
|
...n,
|
|
118
125
|
format: "html",
|
|
119
126
|
filename: n?.filename?.replace(/\.pdf$/, ".html") || `${e.title || "report"}.html`
|
|
120
|
-
});
|
|
127
|
+
}, r);
|
|
121
128
|
return;
|
|
122
129
|
}
|
|
123
|
-
|
|
130
|
+
s.document.write(`<!DOCTYPE html>
|
|
124
131
|
<html>
|
|
125
132
|
<head>
|
|
126
133
|
<meta charset="utf-8">
|
|
127
|
-
<title>${
|
|
134
|
+
<title>${K(e.title || "Report")}</title>
|
|
128
135
|
<style>
|
|
129
|
-
@page { size: ${
|
|
136
|
+
@page { size: ${o} ${a}; margin: 20mm; }
|
|
130
137
|
@media print { .no-print { display: none; } }
|
|
131
138
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
132
139
|
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
@@ -139,56 +146,56 @@ function ue(e, t, n) {
|
|
|
139
146
|
</style>
|
|
140
147
|
</head>
|
|
141
148
|
<body>
|
|
142
|
-
<h1>${
|
|
143
|
-
${e.description ? `<p class="description">${
|
|
144
|
-
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
149
|
+
<h1>${K(e.title || "Report")}</h1>
|
|
150
|
+
${e.description ? `<p class="description">${K(e.description)}</p>` : ""}
|
|
151
|
+
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString(r)}</p>
|
|
145
152
|
<table>
|
|
146
|
-
<thead><tr>${
|
|
147
|
-
<tbody>${t.map((e) => `<tr>${
|
|
153
|
+
<thead><tr>${i.map((e) => `<th>${K(e.label || e.name)}</th>`).join("")}</tr></thead>
|
|
154
|
+
<tbody>${t.map((e) => `<tr>${i.map((t) => `<td>${K(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
148
155
|
</table>
|
|
149
156
|
</body>
|
|
150
|
-
</html>`),
|
|
151
|
-
|
|
157
|
+
</html>`), s.document.close(), s.onload = () => {
|
|
158
|
+
s.print();
|
|
152
159
|
};
|
|
153
160
|
}
|
|
154
|
-
function
|
|
161
|
+
function _e(e, t, n) {
|
|
155
162
|
let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
|
|
156
163
|
let n = e[t.name];
|
|
157
|
-
return n =
|
|
164
|
+
return n = ye(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
158
165
|
}));
|
|
159
|
-
|
|
166
|
+
q("" + [...n?.includeHeaders === !1 ? [] : [i.join(" ")], ...a.map((e) => e.join(" "))].join("\n"), n?.filename || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
160
167
|
}
|
|
161
|
-
function
|
|
168
|
+
function ve(e, t, n, r, i = "en") {
|
|
162
169
|
switch (e) {
|
|
163
170
|
case "csv":
|
|
164
|
-
|
|
171
|
+
pe(t, n, r);
|
|
165
172
|
break;
|
|
166
173
|
case "json":
|
|
167
|
-
|
|
174
|
+
me(t, n, r);
|
|
168
175
|
break;
|
|
169
176
|
case "html":
|
|
170
|
-
|
|
177
|
+
he(t, n, r, i);
|
|
171
178
|
break;
|
|
172
179
|
case "pdf":
|
|
173
|
-
|
|
180
|
+
ge(t, n, r, i);
|
|
174
181
|
break;
|
|
175
182
|
case "excel":
|
|
176
|
-
|
|
183
|
+
_e(t, n, r);
|
|
177
184
|
break;
|
|
178
185
|
default: console.warn(`Unsupported export format: ${e}`);
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
|
-
function
|
|
188
|
+
function K(e) {
|
|
182
189
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
183
190
|
}
|
|
184
|
-
function
|
|
191
|
+
function ye(e) {
|
|
185
192
|
if (typeof e == "string" && e.length > 0) {
|
|
186
193
|
let t = e.charAt(0);
|
|
187
194
|
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `\t${e}`;
|
|
188
195
|
}
|
|
189
196
|
return e;
|
|
190
197
|
}
|
|
191
|
-
function
|
|
198
|
+
function be(e) {
|
|
192
199
|
return [
|
|
193
200
|
"A4",
|
|
194
201
|
"A3",
|
|
@@ -196,40 +203,40 @@ function pe(e) {
|
|
|
196
203
|
"Legal"
|
|
197
204
|
].includes(e || "") ? e : "A4";
|
|
198
205
|
}
|
|
199
|
-
function
|
|
206
|
+
function xe(e) {
|
|
200
207
|
return e === "landscape" ? "landscape" : "portrait";
|
|
201
208
|
}
|
|
202
|
-
function
|
|
209
|
+
function q(e, t, n) {
|
|
203
210
|
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
204
211
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
205
212
|
}
|
|
206
213
|
//#endregion
|
|
207
214
|
//#region src/formatValue.ts
|
|
208
|
-
function
|
|
215
|
+
function J(e, t, n = "en") {
|
|
209
216
|
if (e == null || e === "") return "";
|
|
210
|
-
let
|
|
211
|
-
if (
|
|
212
|
-
if (
|
|
217
|
+
let r = t?.type, i = t?.format;
|
|
218
|
+
if (r === "date" || i === "date" || Se(e)) return Ce(e);
|
|
219
|
+
if (r === "number" || typeof e == "number") {
|
|
213
220
|
let t = typeof e == "number" ? e : Number(e);
|
|
214
|
-
return isNaN(t) ? String(e) :
|
|
221
|
+
return isNaN(t) ? String(e) : i === "currency" || i === "currency_cny" ? `¥${G(t, n, {
|
|
215
222
|
minimumFractionDigits: 0,
|
|
216
223
|
maximumFractionDigits: 0
|
|
217
|
-
})}` :
|
|
224
|
+
})}` : i === "currency_usd" ? `$${G(t, n, {
|
|
218
225
|
minimumFractionDigits: 0,
|
|
219
226
|
maximumFractionDigits: 0
|
|
220
|
-
})}` :
|
|
227
|
+
})}` : i === "percent" ? `${G(t, n, {
|
|
221
228
|
minimumFractionDigits: 1,
|
|
222
229
|
maximumFractionDigits: 1
|
|
223
|
-
})}%` : t
|
|
230
|
+
})}%` : G(t, n);
|
|
224
231
|
}
|
|
225
232
|
return String(e);
|
|
226
233
|
}
|
|
227
|
-
function
|
|
234
|
+
function Se(e) {
|
|
228
235
|
return typeof e == "string" && /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e);
|
|
229
236
|
}
|
|
230
|
-
function
|
|
237
|
+
function Ce(e) {
|
|
231
238
|
try {
|
|
232
|
-
let t =
|
|
239
|
+
let t = b(e);
|
|
233
240
|
return isNaN(t.getTime()) ? String(e) : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
|
|
234
241
|
} catch {
|
|
235
242
|
return String(e);
|
|
@@ -237,7 +244,7 @@ function ge(e) {
|
|
|
237
244
|
}
|
|
238
245
|
//#endregion
|
|
239
246
|
//#region src/ReportViewer.tsx
|
|
240
|
-
function
|
|
247
|
+
function we(e, t) {
|
|
241
248
|
if (!t || t.length === 0 || !e || e.length === 0) return null;
|
|
242
249
|
let n = t[0], r = n.field, i = /* @__PURE__ */ new Map();
|
|
243
250
|
for (let t of e) {
|
|
@@ -253,7 +260,7 @@ function _e(e, t) {
|
|
|
253
260
|
let o = n.sort === "desc" ? -1 : 1;
|
|
254
261
|
return a.sort((e, t) => e.key.localeCompare(t.key) * o), a;
|
|
255
262
|
}
|
|
256
|
-
function
|
|
263
|
+
function Te(e, t, n) {
|
|
257
264
|
if (!e) return 0;
|
|
258
265
|
let r = e.map((e) => Number(e[t]) || 0);
|
|
259
266
|
switch (n) {
|
|
@@ -266,20 +273,20 @@ function ve(e, t, n) {
|
|
|
266
273
|
default: return "";
|
|
267
274
|
}
|
|
268
275
|
}
|
|
269
|
-
var
|
|
270
|
-
let { report: n, data: r, showToolbar: i = !0, allowExport: a = !0, allowPrint: o = !0, loading: s = !1 } = e, c =
|
|
276
|
+
var Ee = ({ schema: e, onRefresh: t }) => {
|
|
277
|
+
let { report: n, data: r, showToolbar: i = !0, allowExport: a = !0, allowPrint: o = !0, loading: s = !1 } = e, c = W(), l = H(), u = (e) => {
|
|
271
278
|
if (!n) {
|
|
272
279
|
console.warn("ReportViewer: Cannot export, no report defined");
|
|
273
280
|
return;
|
|
274
281
|
}
|
|
275
|
-
|
|
276
|
-
},
|
|
282
|
+
ve(e, n, r || [], n.exportConfigs?.[e], l);
|
|
283
|
+
}, d = c("common.printDialogHint", "Opens your browser’s print dialog (not a PDF export)"), f = () => {
|
|
277
284
|
window.print();
|
|
278
|
-
},
|
|
285
|
+
}, p = () => {
|
|
279
286
|
t?.();
|
|
280
|
-
},
|
|
287
|
+
}, m = (e, t) => Te(r, e, t), h = (e, t) => {
|
|
281
288
|
let r = n?.conditionalFormatting;
|
|
282
|
-
if (
|
|
289
|
+
if (r && Array.isArray(r)) for (let n of r) {
|
|
283
290
|
if (n.field !== e) continue;
|
|
284
291
|
let r = String(t ?? ""), i = String(n.value ?? ""), a = !1;
|
|
285
292
|
switch (n.operator) {
|
|
@@ -302,16 +309,16 @@ var J = ({ schema: e, onRefresh: t }) => {
|
|
|
302
309
|
return n.backgroundColor && (e.backgroundColor = n.backgroundColor), n.textColor && (e.color = n.textColor), e;
|
|
303
310
|
}
|
|
304
311
|
}
|
|
305
|
-
},
|
|
312
|
+
}, g = (e, t) => {
|
|
306
313
|
if (e == null || e === "") return "";
|
|
307
314
|
if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) {
|
|
308
315
|
let n = t.colorMap?.[String(e)] || "";
|
|
309
|
-
return /* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ R(A, {
|
|
310
317
|
className: n,
|
|
311
318
|
children: String(e)
|
|
312
319
|
});
|
|
313
320
|
}
|
|
314
|
-
if (t.aggregation) return
|
|
321
|
+
if (t.aggregation) return J(e, t, l);
|
|
315
322
|
if (t.type) {
|
|
316
323
|
let n = { ...t };
|
|
317
324
|
t.colorMap && !n.options && (n.options = Object.entries(t.colorMap).map(([e, t]) => ({
|
|
@@ -319,132 +326,132 @@ var J = ({ schema: e, onRefresh: t }) => {
|
|
|
319
326
|
label: e,
|
|
320
327
|
color: t
|
|
321
328
|
})));
|
|
322
|
-
let r =
|
|
323
|
-
return /* @__PURE__ */
|
|
329
|
+
let r = ce(le(n));
|
|
330
|
+
return /* @__PURE__ */ R(r, {
|
|
324
331
|
value: e,
|
|
325
332
|
field: n
|
|
326
333
|
});
|
|
327
334
|
}
|
|
328
|
-
return
|
|
335
|
+
return J(e, t, l);
|
|
329
336
|
};
|
|
330
|
-
return n ? /* @__PURE__ */
|
|
337
|
+
return n ? /* @__PURE__ */ z("div", {
|
|
331
338
|
className: "space-y-4",
|
|
332
|
-
children: [i && /* @__PURE__ */
|
|
339
|
+
children: [i && /* @__PURE__ */ z("div", {
|
|
333
340
|
className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
341
|
+
children: [/* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("h2", {
|
|
335
342
|
className: "text-lg font-semibold",
|
|
336
343
|
children: n.title
|
|
337
|
-
}), n.description && /* @__PURE__ */
|
|
344
|
+
}), n.description && /* @__PURE__ */ R("p", {
|
|
338
345
|
className: "text-sm text-muted-foreground",
|
|
339
346
|
children: n.description
|
|
340
|
-
})] }), /* @__PURE__ */
|
|
347
|
+
})] }), /* @__PURE__ */ z("div", {
|
|
341
348
|
className: "flex items-center gap-2",
|
|
342
349
|
"data-print-hide": !0,
|
|
343
350
|
children: [
|
|
344
|
-
n.refreshInterval && /* @__PURE__ */
|
|
351
|
+
n.refreshInterval && /* @__PURE__ */ z(j, {
|
|
345
352
|
variant: "outline",
|
|
346
353
|
size: "sm",
|
|
347
|
-
onClick:
|
|
348
|
-
children: [/* @__PURE__ */
|
|
354
|
+
onClick: p,
|
|
355
|
+
children: [/* @__PURE__ */ R(ae, { className: "h-4 w-4 mr-2" }), "Refresh"]
|
|
349
356
|
}),
|
|
350
|
-
o && /* @__PURE__ */
|
|
357
|
+
o && /* @__PURE__ */ z(j, {
|
|
351
358
|
variant: "outline",
|
|
352
359
|
size: "sm",
|
|
353
|
-
onClick:
|
|
354
|
-
"aria-label": `Print: ${
|
|
355
|
-
title:
|
|
356
|
-
children: [/* @__PURE__ */
|
|
360
|
+
onClick: f,
|
|
361
|
+
"aria-label": `Print: ${d}`,
|
|
362
|
+
title: d,
|
|
363
|
+
children: [/* @__PURE__ */ R(ie, { className: "h-4 w-4 mr-2" }), "Print"]
|
|
357
364
|
}),
|
|
358
|
-
a && n.showExportButtons && /* @__PURE__ */
|
|
365
|
+
a && n.showExportButtons && /* @__PURE__ */ z("div", {
|
|
359
366
|
className: "flex items-center gap-1",
|
|
360
367
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ z(j, {
|
|
362
369
|
variant: "outline",
|
|
363
370
|
size: "sm",
|
|
364
|
-
onClick: () =>
|
|
365
|
-
children: [/* @__PURE__ */
|
|
371
|
+
onClick: () => u("pdf"),
|
|
372
|
+
children: [/* @__PURE__ */ R(B, { className: "h-4 w-4 mr-2" }), "PDF"]
|
|
366
373
|
}),
|
|
367
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ z(j, {
|
|
368
375
|
variant: "outline",
|
|
369
376
|
size: "sm",
|
|
370
|
-
onClick: () =>
|
|
371
|
-
children: [/* @__PURE__ */
|
|
377
|
+
onClick: () => u("excel"),
|
|
378
|
+
children: [/* @__PURE__ */ R(B, { className: "h-4 w-4 mr-2" }), "Excel"]
|
|
372
379
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ z(j, {
|
|
374
381
|
variant: "outline",
|
|
375
382
|
size: "sm",
|
|
376
|
-
onClick: () =>
|
|
377
|
-
children: [/* @__PURE__ */
|
|
383
|
+
onClick: () => u("csv"),
|
|
384
|
+
children: [/* @__PURE__ */ R(B, { className: "h-4 w-4 mr-2" }), "CSV"]
|
|
378
385
|
})
|
|
379
386
|
]
|
|
380
387
|
})
|
|
381
388
|
]
|
|
382
389
|
})]
|
|
383
|
-
}), /* @__PURE__ */
|
|
390
|
+
}), /* @__PURE__ */ z(M, { children: [/* @__PURE__ */ z(F, { children: [!i && n.title && /* @__PURE__ */ R(I, { children: n.title }), !i && n.description && /* @__PURE__ */ R(P, { children: n.description })] }), /* @__PURE__ */ z(N, {
|
|
384
391
|
className: "space-y-6",
|
|
385
392
|
children: [
|
|
386
|
-
s && /* @__PURE__ */
|
|
393
|
+
s && /* @__PURE__ */ z("div", {
|
|
387
394
|
className: "space-y-6",
|
|
388
|
-
children: [/* @__PURE__ */
|
|
395
|
+
children: [/* @__PURE__ */ R("div", {
|
|
389
396
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
390
397
|
children: [
|
|
391
398
|
1,
|
|
392
399
|
2,
|
|
393
400
|
3
|
|
394
|
-
].map((e) => /* @__PURE__ */
|
|
401
|
+
].map((e) => /* @__PURE__ */ R(M, { children: /* @__PURE__ */ z(N, {
|
|
395
402
|
className: "p-4 space-y-2",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
403
|
+
children: [/* @__PURE__ */ R(L, { className: "h-4 w-20" }), /* @__PURE__ */ R(L, { className: "h-8 w-28" })]
|
|
397
404
|
}) }, e))
|
|
398
|
-
}), /* @__PURE__ */
|
|
405
|
+
}), /* @__PURE__ */ z("div", {
|
|
399
406
|
className: "space-y-2",
|
|
400
|
-
children: [/* @__PURE__ */
|
|
407
|
+
children: [/* @__PURE__ */ R(L, { className: "h-10 w-full" }), [
|
|
401
408
|
1,
|
|
402
409
|
2,
|
|
403
410
|
3,
|
|
404
411
|
4,
|
|
405
412
|
5
|
|
406
|
-
].map((e) => /* @__PURE__ */
|
|
413
|
+
].map((e) => /* @__PURE__ */ R(L, { className: "h-8 w-full" }, e))]
|
|
407
414
|
})]
|
|
408
415
|
}),
|
|
409
|
-
!s && n.sections?.map((e, t) => e.visible === !1 ? null : /* @__PURE__ */
|
|
416
|
+
!s && n.sections?.map((e, t) => e.visible === !1 ? null : /* @__PURE__ */ z("div", {
|
|
410
417
|
className: "space-y-2",
|
|
411
418
|
children: [
|
|
412
|
-
e.title && e.type !== "header" && /* @__PURE__ */
|
|
419
|
+
e.title && e.type !== "header" && /* @__PURE__ */ R("h3", {
|
|
413
420
|
className: "text-lg font-semibold border-b pb-2",
|
|
414
421
|
children: e.title
|
|
415
422
|
}),
|
|
416
|
-
e.type === "header" && e.title && /* @__PURE__ */
|
|
423
|
+
e.type === "header" && e.title && /* @__PURE__ */ R("div", {
|
|
417
424
|
className: "text-2xl font-bold py-4",
|
|
418
425
|
children: e.title
|
|
419
426
|
}),
|
|
420
|
-
e.type === "summary" && /* @__PURE__ */
|
|
427
|
+
e.type === "summary" && /* @__PURE__ */ R("div", {
|
|
421
428
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
422
|
-
children: n.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */
|
|
429
|
+
children: n.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ R(M, { children: /* @__PURE__ */ z(N, {
|
|
423
430
|
className: "p-4",
|
|
424
|
-
children: [/* @__PURE__ */
|
|
431
|
+
children: [/* @__PURE__ */ R("div", {
|
|
425
432
|
className: "text-sm text-muted-foreground",
|
|
426
433
|
children: e.label || e.name
|
|
427
|
-
}), /* @__PURE__ */
|
|
434
|
+
}), /* @__PURE__ */ R("div", {
|
|
428
435
|
className: "text-2xl font-bold",
|
|
429
|
-
children:
|
|
436
|
+
children: J(m(e.name, e.aggregation), e, l)
|
|
430
437
|
})]
|
|
431
438
|
}) }, t))
|
|
432
439
|
}),
|
|
433
|
-
e.type === "table" && /* @__PURE__ */
|
|
440
|
+
e.type === "table" && /* @__PURE__ */ R("div", {
|
|
434
441
|
className: "border rounded-lg overflow-x-auto",
|
|
435
|
-
children: /* @__PURE__ */
|
|
442
|
+
children: /* @__PURE__ */ z("table", {
|
|
436
443
|
className: "w-full text-sm min-w-[600px]",
|
|
437
|
-
children: [/* @__PURE__ */
|
|
444
|
+
children: [/* @__PURE__ */ R("thead", {
|
|
438
445
|
className: "bg-muted",
|
|
439
|
-
children: /* @__PURE__ */
|
|
446
|
+
children: /* @__PURE__ */ R("tr", { children: e.columns?.map((e, t) => /* @__PURE__ */ R("th", {
|
|
440
447
|
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
441
448
|
children: e.label || e.name
|
|
442
449
|
}, t)) })
|
|
443
|
-
}), /* @__PURE__ */
|
|
444
|
-
let t =
|
|
445
|
-
return t ? t.map((t) => /* @__PURE__ */
|
|
450
|
+
}), /* @__PURE__ */ R("tbody", { children: (() => {
|
|
451
|
+
let t = we(r || [], n.groupBy || []);
|
|
452
|
+
return t ? t.map((t) => /* @__PURE__ */ z(S.Fragment, { children: [/* @__PURE__ */ R("tr", {
|
|
446
453
|
className: "bg-muted/60",
|
|
447
|
-
children: /* @__PURE__ */
|
|
454
|
+
children: /* @__PURE__ */ z("td", {
|
|
448
455
|
colSpan: e.columns?.length || 1,
|
|
449
456
|
className: "px-4 py-2 font-semibold text-sm",
|
|
450
457
|
children: [
|
|
@@ -454,107 +461,140 @@ var J = ({ schema: e, onRefresh: t }) => {
|
|
|
454
461
|
")"
|
|
455
462
|
]
|
|
456
463
|
})
|
|
457
|
-
}), t.rows.map((t, n) => /* @__PURE__ */
|
|
464
|
+
}), t.rows.map((t, n) => /* @__PURE__ */ R("tr", {
|
|
458
465
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
459
|
-
children: e.columns?.map((e, n) => /* @__PURE__ */
|
|
466
|
+
children: e.columns?.map((e, n) => /* @__PURE__ */ R("td", {
|
|
460
467
|
className: `px-4 py-2 ${e.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
461
|
-
style:
|
|
462
|
-
children:
|
|
468
|
+
style: h(e.name, t[e.name]),
|
|
469
|
+
children: g(t[e.name], e)
|
|
463
470
|
}, n))
|
|
464
|
-
}, n))] }, t.key)) : r?.map((t, n) => /* @__PURE__ */
|
|
471
|
+
}, n))] }, t.key)) : r?.map((t, n) => /* @__PURE__ */ R("tr", {
|
|
465
472
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
466
|
-
children: e.columns?.map((e, n) => /* @__PURE__ */
|
|
473
|
+
children: e.columns?.map((e, n) => /* @__PURE__ */ R("td", {
|
|
467
474
|
className: `px-4 py-2 ${e.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
468
|
-
style:
|
|
469
|
-
children:
|
|
475
|
+
style: h(e.name, t[e.name]),
|
|
476
|
+
children: g(t[e.name], e)
|
|
470
477
|
}, n))
|
|
471
478
|
}, n));
|
|
472
479
|
})() })]
|
|
473
480
|
})
|
|
474
481
|
}),
|
|
475
|
-
e.type === "text" && e.text && /* @__PURE__ */
|
|
482
|
+
e.type === "text" && e.text && /* @__PURE__ */ R("div", {
|
|
476
483
|
className: "prose max-w-none",
|
|
477
|
-
children: /* @__PURE__ */
|
|
484
|
+
children: /* @__PURE__ */ R("p", { children: e.text })
|
|
478
485
|
}),
|
|
479
|
-
e.type === "page-break" && /* @__PURE__ */
|
|
480
|
-
Array.isArray(e.content) ? e.content.map((e, t) => /* @__PURE__ */
|
|
486
|
+
e.type === "page-break" && /* @__PURE__ */ R("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
|
|
487
|
+
Array.isArray(e.content) ? e.content.map((e, t) => /* @__PURE__ */ R(T, { schema: O(e) }, t)) : te(e.content, (e) => /* @__PURE__ */ R(T, { schema: O(e) }))
|
|
481
488
|
]
|
|
482
489
|
}, t)),
|
|
483
|
-
!n.sections && r && r.length > 0 && /* @__PURE__ */
|
|
490
|
+
!n.sections && r && r.length > 0 && /* @__PURE__ */ R("div", {
|
|
484
491
|
className: "border rounded-lg overflow-x-auto",
|
|
485
|
-
children: /* @__PURE__ */
|
|
492
|
+
children: /* @__PURE__ */ z("table", {
|
|
486
493
|
className: "w-full text-sm min-w-[600px]",
|
|
487
|
-
children: [/* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ R("thead", {
|
|
488
495
|
className: "bg-muted",
|
|
489
|
-
children: /* @__PURE__ */
|
|
496
|
+
children: /* @__PURE__ */ R("tr", { children: n.fields?.map((e, t) => /* @__PURE__ */ R("th", {
|
|
490
497
|
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
491
498
|
children: e.label || e.name
|
|
492
499
|
}, t)) })
|
|
493
|
-
}), /* @__PURE__ */
|
|
500
|
+
}), /* @__PURE__ */ R("tbody", { children: r.map((e, t) => /* @__PURE__ */ R("tr", {
|
|
494
501
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
495
|
-
children: n.fields?.map((t, n) => /* @__PURE__ */
|
|
502
|
+
children: n.fields?.map((t, n) => /* @__PURE__ */ R("td", {
|
|
496
503
|
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
497
|
-
style:
|
|
498
|
-
children:
|
|
504
|
+
style: h(t.name, e[t.name]),
|
|
505
|
+
children: g(e[t.name], t)
|
|
499
506
|
}, n))
|
|
500
507
|
}, t)) })]
|
|
501
508
|
})
|
|
502
509
|
})
|
|
503
510
|
]
|
|
504
511
|
})] })]
|
|
505
|
-
}) : /* @__PURE__ */
|
|
512
|
+
}) : /* @__PURE__ */ R(M, { children: /* @__PURE__ */ R(N, {
|
|
506
513
|
className: "p-8 text-center text-muted-foreground",
|
|
507
514
|
children: "No report to display"
|
|
508
515
|
}) });
|
|
509
516
|
};
|
|
510
517
|
//#endregion
|
|
511
518
|
//#region src/DatasetReportRenderer.tsx
|
|
512
|
-
function
|
|
519
|
+
function De(e) {
|
|
513
520
|
if (!e || typeof e != "object") return !1;
|
|
514
521
|
let t = e;
|
|
515
522
|
return typeof t.dataset == "string" && t.dataset.length > 0 || t.type === "joined" && Array.isArray(t.blocks) && t.blocks.some((e) => typeof e?.dataset == "string");
|
|
516
523
|
}
|
|
517
|
-
var
|
|
518
|
-
function
|
|
519
|
-
if (!
|
|
524
|
+
var Oe = /* @__PURE__ */ new Set(), ke = () => globalThis.process?.env?.NODE_ENV !== "production";
|
|
525
|
+
function Ae(e, t) {
|
|
526
|
+
if (!ke()) return;
|
|
520
527
|
let n = e.filter;
|
|
521
528
|
if (n === void 0) return;
|
|
522
529
|
let r = `${t}:${n && typeof n == "object" ? Object.keys(n).sort().join(",") : String(n)}`;
|
|
523
|
-
|
|
530
|
+
Oe.has(r) || (Oe.add(r), console.warn(`[ObjectUI] ${t} carries \`filter\`, which is not an authorable key. Did you mean \`filter\` → \`runtimeFilter\`? NO filter was applied — it renders UNFILTERED, showing rows the report was scoped to exclude. \`ReportSchema\` (\`@objectstack/spec\`) is strict and rejects \`filter\`, so this document did not come through the validated path; the renderer no longer reads it either. Fix the producer: rename \`filter\` to \`runtimeFilter\`. (objectui#5137)`));
|
|
524
531
|
}
|
|
525
|
-
function
|
|
532
|
+
function je(e) {
|
|
526
533
|
return `Report \`${e.name ?? "(unnamed)"}\``;
|
|
527
534
|
}
|
|
528
|
-
function
|
|
535
|
+
function Me(e, t) {
|
|
529
536
|
return e ? typeof e == "string" ? e : typeof e == "object" && typeof e.default == "string" ? e.default : t : t;
|
|
530
537
|
}
|
|
531
538
|
function Y(e) {
|
|
532
539
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!e) : [];
|
|
533
540
|
}
|
|
534
|
-
function
|
|
541
|
+
function Ne(e) {
|
|
535
542
|
if (!Array.isArray(e)) return;
|
|
536
543
|
let t = {};
|
|
537
544
|
for (let n of e) {
|
|
538
545
|
let e = n && typeof n == "object" ? n.by : void 0;
|
|
539
|
-
typeof e
|
|
546
|
+
typeof e == "string" && e && (t[e] = n.direction === "desc" ? "desc" : "asc");
|
|
540
547
|
}
|
|
541
548
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
542
549
|
}
|
|
543
|
-
function
|
|
550
|
+
function X(e, t, n) {
|
|
544
551
|
if (!e) return;
|
|
545
552
|
let r = /* @__PURE__ */ new Set([...t, ...n]), i = {};
|
|
546
553
|
for (let [t, n] of Object.entries(e)) r.has(t) && (i[t] = n);
|
|
547
554
|
return Object.keys(i).length > 0 ? i : void 0;
|
|
548
555
|
}
|
|
549
|
-
function
|
|
550
|
-
let
|
|
556
|
+
function Pe(e, t) {
|
|
557
|
+
let i = l(e?.metaByPath, e?.relabel, t);
|
|
558
|
+
if (!e) return {
|
|
559
|
+
dimensionLabels: i,
|
|
560
|
+
dimensionRanks: null
|
|
561
|
+
};
|
|
562
|
+
let a = {}, o = !1;
|
|
563
|
+
for (let { dim: i, path: s } of e.relabel) {
|
|
564
|
+
let c = e.metaByPath[s], l = p(c?.options, u(c, t)), d = r(n(l));
|
|
565
|
+
a[i] = d, d && (o = !0);
|
|
566
|
+
}
|
|
567
|
+
return {
|
|
568
|
+
dimensionLabels: i,
|
|
569
|
+
dimensionRanks: o ? a : null
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
function Fe(e, t) {
|
|
573
|
+
return e == null || e === "" ? 2 ** 53 - 1 : t.get(String(e)) ?? 2 ** 53 - 1 - 1;
|
|
574
|
+
}
|
|
575
|
+
function Z(e, t, n, r) {
|
|
576
|
+
if (!r || !t.some((e) => r[e])) return null;
|
|
577
|
+
let i = (a, o) => {
|
|
578
|
+
if (o >= t.length || a.length < 2) return a;
|
|
579
|
+
let s = t[o], c = /* @__PURE__ */ new Map();
|
|
580
|
+
for (let t of a) {
|
|
581
|
+
let r = g([v(n(e[t], s))]), i = c.get(r);
|
|
582
|
+
i ? i.push(t) : c.set(r, [t]);
|
|
583
|
+
}
|
|
584
|
+
let l = [...c.values()], u = r[s];
|
|
585
|
+
return u && l.sort((t, r) => Fe(n(e[t[0]], s), u) - Fe(n(e[r[0]], s), u)), l.flatMap((e) => i(e, o + 1));
|
|
586
|
+
};
|
|
587
|
+
return i(e.map((e, t) => t), 0);
|
|
588
|
+
}
|
|
589
|
+
function Ie(e, t, n, r, i, a, o) {
|
|
590
|
+
let [s, c] = x.useState({
|
|
551
591
|
status: "idle",
|
|
552
592
|
rows: []
|
|
553
|
-
}), l =
|
|
554
|
-
return
|
|
593
|
+
}), l = X(o, t, n), u = JSON.stringify(r ?? null), d = JSON.stringify(a ?? null), f = JSON.stringify(l ?? null), p = `${e}|${t.join(",")}|${n.join(",")}|${u}|${d}|${f}`, [m, h] = x.useState(void 0), g = k(m), _ = x.useRef(null);
|
|
594
|
+
return x.useEffect(() => {
|
|
555
595
|
let o = i;
|
|
556
596
|
if (!o || typeof o.queryDataset != "function") {
|
|
557
|
-
c({
|
|
597
|
+
_.current = null, h(void 0), c({
|
|
558
598
|
status: "error",
|
|
559
599
|
rows: [],
|
|
560
600
|
error: "This data source does not support dataset queries."
|
|
@@ -562,24 +602,24 @@ function X(e, t, n, r, i, a, o) {
|
|
|
562
602
|
return;
|
|
563
603
|
}
|
|
564
604
|
if (!e || n.length === 0) {
|
|
565
|
-
c({
|
|
605
|
+
_.current = null, h(void 0), c({
|
|
566
606
|
status: "idle",
|
|
567
607
|
rows: []
|
|
568
608
|
});
|
|
569
609
|
return;
|
|
570
610
|
}
|
|
571
|
-
let s = !1;
|
|
572
|
-
return c({
|
|
611
|
+
let s = !1, u = _.current === p;
|
|
612
|
+
return _.current = p, u || (h(void 0), c({
|
|
573
613
|
status: "loading",
|
|
574
614
|
rows: []
|
|
575
|
-
}), o.queryDataset(e, {
|
|
615
|
+
})), o.queryDataset(e, {
|
|
576
616
|
dimensions: t,
|
|
577
617
|
measures: n,
|
|
578
618
|
...r && Object.keys(r).length > 0 ? { runtimeFilter: r } : {},
|
|
579
619
|
...a ? { totals: { groupings: a } } : {},
|
|
580
620
|
...l ? { order: l } : {}
|
|
581
621
|
}).then((e) => {
|
|
582
|
-
s || c({
|
|
622
|
+
s || (h(typeof e?.object == "string" && e.object ? e.object : void 0), c({
|
|
583
623
|
status: "ok",
|
|
584
624
|
rows: Array.isArray(e?.rows) ? e.rows : [],
|
|
585
625
|
fields: Array.isArray(e?.fields) ? e.fields : [],
|
|
@@ -588,20 +628,38 @@ function X(e, t, n, r, i, a, o) {
|
|
|
588
628
|
drillRawRows: Array.isArray(e?.drillRawRows) ? e.drillRawRows : void 0,
|
|
589
629
|
drillRanges: Array.isArray(e?.drillRanges) ? e.drillRanges : void 0,
|
|
590
630
|
totals: Array.isArray(e?.totals) ? e.totals : void 0
|
|
591
|
-
});
|
|
631
|
+
}));
|
|
592
632
|
}).catch((e) => {
|
|
593
|
-
s
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
633
|
+
if (!s) {
|
|
634
|
+
if (D(e) === "forbidden") {
|
|
635
|
+
c({
|
|
636
|
+
status: "error",
|
|
637
|
+
rows: [],
|
|
638
|
+
forbidden: !0
|
|
639
|
+
});
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
c({
|
|
643
|
+
status: "error",
|
|
644
|
+
rows: [],
|
|
645
|
+
error: String(e?.message ?? e)
|
|
646
|
+
});
|
|
647
|
+
}
|
|
598
648
|
}), () => {
|
|
599
649
|
s = !0;
|
|
600
650
|
};
|
|
601
|
-
}, [p]), s;
|
|
651
|
+
}, [p, g]), s;
|
|
602
652
|
}
|
|
603
|
-
function
|
|
604
|
-
|
|
653
|
+
function Le(...e) {
|
|
654
|
+
try {
|
|
655
|
+
return a(...e);
|
|
656
|
+
} catch (e) {
|
|
657
|
+
if (!(e instanceof t)) throw e;
|
|
658
|
+
return console.warn(`[DatasetReportRenderer] drill-down refused — the drilled list cannot be scoped: ${e.message}`), null;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
function Re({ dataset: e }) {
|
|
662
|
+
return /* @__PURE__ */ z("div", {
|
|
605
663
|
className: "flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
|
|
606
664
|
children: [
|
|
607
665
|
"This report binds the “",
|
|
@@ -610,81 +668,106 @@ function De({ dataset: e }) {
|
|
|
610
668
|
]
|
|
611
669
|
});
|
|
612
670
|
}
|
|
613
|
-
function
|
|
614
|
-
|
|
671
|
+
function ze() {
|
|
672
|
+
let e = W();
|
|
673
|
+
return /* @__PURE__ */ z("div", {
|
|
674
|
+
role: "alert",
|
|
675
|
+
"data-testid": "dataset-report-forbidden",
|
|
676
|
+
className: "flex flex-col items-center justify-center gap-1 rounded-md border border-dashed bg-muted/20 p-6 text-center text-xs text-muted-foreground",
|
|
677
|
+
children: [
|
|
678
|
+
/* @__PURE__ */ R(oe, {
|
|
679
|
+
className: "h-5 w-5 text-muted-foreground/70",
|
|
680
|
+
"aria-hidden": "true"
|
|
681
|
+
}),
|
|
682
|
+
/* @__PURE__ */ R("span", {
|
|
683
|
+
className: "font-medium text-foreground/80",
|
|
684
|
+
children: e("dashboard.widgetForbiddenTitle", "You don’t have access")
|
|
685
|
+
}),
|
|
686
|
+
/* @__PURE__ */ R("span", { children: e("report.forbiddenMessage", "You don’t have permission to view the data behind this report.") })
|
|
687
|
+
]
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function Q({ status: e, error: t, forbidden: n }) {
|
|
691
|
+
return e === "error" && n ? /* @__PURE__ */ R(ze, {}) : e === "error" ? /* @__PURE__ */ z("div", {
|
|
615
692
|
role: "alert",
|
|
616
693
|
className: "flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",
|
|
617
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ R("span", {
|
|
618
695
|
className: "break-words",
|
|
619
696
|
children: t
|
|
620
697
|
})]
|
|
621
|
-
}) : /* @__PURE__ */
|
|
698
|
+
}) : /* @__PURE__ */ z("div", {
|
|
622
699
|
className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
|
|
623
|
-
children: [/* @__PURE__ */
|
|
700
|
+
children: [/* @__PURE__ */ R(re, { className: "h-4 w-4 animate-spin" }), " Running report…"]
|
|
624
701
|
});
|
|
625
702
|
}
|
|
626
|
-
function
|
|
627
|
-
return /* @__PURE__ */
|
|
703
|
+
function Be() {
|
|
704
|
+
return /* @__PURE__ */ z("div", {
|
|
628
705
|
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",
|
|
629
|
-
children: [/* @__PURE__ */
|
|
706
|
+
children: [/* @__PURE__ */ R(se, { className: "h-6 w-6" }), " The dataset returned no rows for this report’s scope."]
|
|
630
707
|
});
|
|
631
708
|
}
|
|
632
|
-
var
|
|
633
|
-
function
|
|
634
|
-
let
|
|
635
|
-
if (n.length === 0) return /* @__PURE__ */
|
|
636
|
-
if (
|
|
637
|
-
if (
|
|
709
|
+
var Ve = "cursor-pointer hover:bg-accent/40";
|
|
710
|
+
function He({ dataset: e, rows: t, values: n, runtimeFilter: r, dataSource: i, onDrill: a, order: s, withTotals: c }) {
|
|
711
|
+
let l = Ie(e, t, n, r, i, c && t.length > 0 ? [[]] : void 0, s), { fieldLabel: u, fieldOptionLabel: p } = U(), m = W(), h = H(), g = ee(l.object, l.dimensionFields, t), { dimensionLabels: _, dimensionRanks: v } = x.useMemo(() => Pe(g, p), [g, p]);
|
|
712
|
+
if (n.length === 0) return /* @__PURE__ */ R(Re, { dataset: e });
|
|
713
|
+
if (l.status === "loading" || l.status === "idle") return /* @__PURE__ */ R(Q, { status: l.status });
|
|
714
|
+
if (l.status === "error") return /* @__PURE__ */ R(Q, {
|
|
638
715
|
status: "error",
|
|
639
|
-
error:
|
|
716
|
+
error: l.error,
|
|
717
|
+
forbidden: l.forbidden
|
|
640
718
|
});
|
|
641
|
-
if (
|
|
642
|
-
let
|
|
719
|
+
if (l.rows.length === 0) return /* @__PURE__ */ R(Be, {});
|
|
720
|
+
let b = !!a && t.length > 0, S = l.dimensionFields ? t.filter((e) => e in l.dimensionFields) : [], C = (n, i) => {
|
|
643
721
|
let o = {};
|
|
644
722
|
for (let e of t) o[e] = n[e];
|
|
645
|
-
let
|
|
646
|
-
|
|
723
|
+
let s = l.drillRanges?.[i], c = !!s && Object.keys(s).length > 0, u;
|
|
724
|
+
if (l.object && (S.length > 0 || c)) {
|
|
725
|
+
let e = Le(l.drillRawRows?.[i], S, l.dimensionFields ?? {}, r, s);
|
|
726
|
+
if (e === null) return;
|
|
727
|
+
u = e;
|
|
728
|
+
}
|
|
729
|
+
a({
|
|
647
730
|
dataset: e,
|
|
648
731
|
groupKey: o,
|
|
649
|
-
runtimeFilter:
|
|
650
|
-
object:
|
|
732
|
+
runtimeFilter: r,
|
|
733
|
+
object: l.object,
|
|
651
734
|
objectFilter: u
|
|
652
735
|
});
|
|
653
|
-
}, { measureField:
|
|
654
|
-
return /* @__PURE__ */
|
|
736
|
+
}, { measureField: w, headerLabel: T } = o(l.fields, l.object, u, V(m)), E = [...t, ...n], D = y(l.rows, _), O = Z(D, t, (e, t) => e[t], X(s, t, n) ? null : v) ?? D.map((e, t) => t), k = c ? l.totals?.find((e) => Array.isArray(e.dimensions) && e.dimensions.length === 0)?.rows?.[0] : void 0, A = m("report.total", "Total");
|
|
737
|
+
return /* @__PURE__ */ R("div", {
|
|
655
738
|
className: "overflow-auto max-h-[70vh] rounded-md border",
|
|
656
|
-
children: /* @__PURE__ */
|
|
739
|
+
children: /* @__PURE__ */ z("table", {
|
|
657
740
|
className: "w-full text-xs",
|
|
658
|
-
children: [/* @__PURE__ */
|
|
741
|
+
children: [/* @__PURE__ */ R("thead", {
|
|
659
742
|
className: "bg-muted/40",
|
|
660
|
-
children: /* @__PURE__ */
|
|
743
|
+
children: /* @__PURE__ */ R("tr", { children: E.map((e) => /* @__PURE__ */ R("th", {
|
|
661
744
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
662
|
-
children:
|
|
745
|
+
children: T(e)
|
|
663
746
|
}, e)) })
|
|
664
|
-
}), /* @__PURE__ */
|
|
665
|
-
className: `border-t${
|
|
666
|
-
"data-testid":
|
|
667
|
-
onClick:
|
|
668
|
-
children:
|
|
747
|
+
}), /* @__PURE__ */ z("tbody", { children: [O.map((e) => /* @__PURE__ */ R("tr", {
|
|
748
|
+
className: `border-t${b ? ` ${Ve}` : ""}`,
|
|
749
|
+
"data-testid": b ? "dataset-drill-row" : void 0,
|
|
750
|
+
onClick: b ? () => C(l.rows[e], e) : void 0,
|
|
751
|
+
children: E.map((t) => /* @__PURE__ */ R("td", {
|
|
669
752
|
className: "px-2 py-1 tabular-nums whitespace-nowrap",
|
|
670
|
-
children: n.includes(t) ?
|
|
753
|
+
children: n.includes(t) ? f(D[e][t], w(t)?.format, w(t)?.currency, w(t)?.percentScale, h) : d(D[e][t], h)
|
|
671
754
|
}, t))
|
|
672
|
-
},
|
|
755
|
+
}, e)), k && /* @__PURE__ */ z("tr", {
|
|
673
756
|
className: "border-t bg-muted/30 font-medium",
|
|
674
757
|
"data-testid": "dataset-report-total-row",
|
|
675
|
-
children: [t.length > 0 && /* @__PURE__ */
|
|
758
|
+
children: [t.length > 0 && /* @__PURE__ */ R("td", {
|
|
676
759
|
colSpan: t.length,
|
|
677
760
|
className: "px-2 py-1 whitespace-nowrap",
|
|
678
|
-
children:
|
|
679
|
-
}), n.map((e) => /* @__PURE__ */
|
|
761
|
+
children: A
|
|
762
|
+
}), n.map((e) => /* @__PURE__ */ R("td", {
|
|
680
763
|
className: "px-2 py-1 tabular-nums whitespace-nowrap",
|
|
681
|
-
children:
|
|
764
|
+
children: f(k[e], w(e)?.format, w(e)?.currency, w(e)?.percentScale, h)
|
|
682
765
|
}, e))]
|
|
683
766
|
})] })]
|
|
684
767
|
})
|
|
685
768
|
});
|
|
686
769
|
}
|
|
687
|
-
function
|
|
770
|
+
function Ue(e) {
|
|
688
771
|
switch (e) {
|
|
689
772
|
case "summary": return "summary";
|
|
690
773
|
case "matrix": return "matrix";
|
|
@@ -692,7 +775,7 @@ function je(e) {
|
|
|
692
775
|
default: return "tabular";
|
|
693
776
|
}
|
|
694
777
|
}
|
|
695
|
-
function
|
|
778
|
+
function We(e) {
|
|
696
779
|
switch (e) {
|
|
697
780
|
case "bar":
|
|
698
781
|
case "column":
|
|
@@ -723,9 +806,9 @@ function Me(e) {
|
|
|
723
806
|
};
|
|
724
807
|
}
|
|
725
808
|
}
|
|
726
|
-
function
|
|
727
|
-
let [, n] =
|
|
728
|
-
return
|
|
809
|
+
function Ge(t) {
|
|
810
|
+
let [, n] = x.useReducer((e) => e + 1, 0);
|
|
811
|
+
return x.useEffect(() => {
|
|
729
812
|
if (e.get(t)) return;
|
|
730
813
|
let r = typeof e.subscribe == "function" ? e.subscribe(() => {
|
|
731
814
|
e.get(t) && n();
|
|
@@ -733,244 +816,257 @@ function Ne(t) {
|
|
|
733
816
|
return i && typeof i.then == "function" && i.then(() => n()).catch(() => {}), r;
|
|
734
817
|
}, [t]), e.get(t);
|
|
735
818
|
}
|
|
736
|
-
function
|
|
737
|
-
if (
|
|
819
|
+
function Ke(e, t, n) {
|
|
820
|
+
if (Array.isArray(e) && t) for (let r of e) {
|
|
738
821
|
if (!r || typeof r != "object") continue;
|
|
739
822
|
let { name: e, label: i } = r;
|
|
740
|
-
if (e === t) return
|
|
823
|
+
if (e === t) return ue(i, n) || void 0;
|
|
741
824
|
}
|
|
742
825
|
}
|
|
743
|
-
function
|
|
744
|
-
let
|
|
745
|
-
if (!
|
|
826
|
+
function qe({ dataset: e, chart: t, runtimeFilter: a, dataSource: d, order: h }) {
|
|
827
|
+
let g = typeof t.xAxis == "string" ? t.xAxis : "", _ = typeof t.yAxis == "string" ? t.yAxis : "", v = We(t.type), b = v.kind === "series" || v.kind === "single_value", S = v.kind === "series" && g ? [g] : [], C = b && _ ? [_] : [], w = Ie(e, S, C, a, d, void 0, h), T = Ge("chart"), { fieldLabel: E, fieldOptionLabel: D } = U(), O = W(), k = H(), { language: A } = de(), j = x.useMemo(() => g ? [g] : [], [g]), M = ee(w.object, w.dimensionFields, j), { categoryColors: N, dimensionLabels: P, categoryOrder: F } = x.useMemo(() => {
|
|
828
|
+
if (!M) return {
|
|
746
829
|
categoryColors: null,
|
|
747
830
|
dimensionLabels: null,
|
|
748
831
|
categoryOrder: null
|
|
749
832
|
};
|
|
750
|
-
let { metaByPath: e, relabel:
|
|
833
|
+
let { metaByPath: e, relabel: t } = M, r = t[0]?.path, i = r ? e[r] : void 0, a = r ? p(i?.options, u(i, D)) : void 0;
|
|
751
834
|
return {
|
|
752
|
-
categoryColors: a
|
|
753
|
-
dimensionLabels:
|
|
754
|
-
categoryOrder:
|
|
835
|
+
categoryColors: s(a),
|
|
836
|
+
dimensionLabels: l(e, t, D),
|
|
837
|
+
categoryOrder: n(a)
|
|
755
838
|
};
|
|
756
|
-
}, [
|
|
757
|
-
if (
|
|
758
|
-
if (
|
|
839
|
+
}, [M, D]), I = ue(t.title, A) || void 0;
|
|
840
|
+
if (v.kind === "tabular") return null;
|
|
841
|
+
if (v.kind === "unsupported") return /* @__PURE__ */ z("div", {
|
|
759
842
|
className: "rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground",
|
|
760
843
|
"data-testid": "dataset-report-chart-unsupported",
|
|
761
844
|
children: [
|
|
762
845
|
"Chart type “",
|
|
763
|
-
|
|
764
|
-
"” is not a spec chart type — the
|
|
846
|
+
v.type,
|
|
847
|
+
"” is not a spec chart type — the report’s table carries its numbers."
|
|
765
848
|
]
|
|
766
849
|
});
|
|
767
|
-
if (
|
|
768
|
-
if (
|
|
850
|
+
if (v.kind === "series" && !g || !_) return null;
|
|
851
|
+
if (w.status === "loading" || w.status === "idle") return /* @__PURE__ */ z("div", {
|
|
769
852
|
className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
|
|
770
|
-
children: [/* @__PURE__ */
|
|
853
|
+
children: [/* @__PURE__ */ R(re, { className: "h-4 w-4 animate-spin" }), " Loading chart…"]
|
|
771
854
|
});
|
|
772
|
-
if (
|
|
773
|
-
let { measureField:
|
|
774
|
-
if (
|
|
775
|
-
let e =
|
|
776
|
-
return /* @__PURE__ */
|
|
855
|
+
if (w.status === "error" || w.rows.length === 0) return null;
|
|
856
|
+
let { measureField: L, headerLabel: te } = o(w.fields, w.object, E, V(O)), ne = Ke(t.series, _, A) ?? te(_);
|
|
857
|
+
if (v.kind === "single_value") {
|
|
858
|
+
let e = L(_);
|
|
859
|
+
return /* @__PURE__ */ z("div", {
|
|
777
860
|
className: "rounded-md border bg-card p-3",
|
|
778
861
|
"data-testid": "dataset-report-metric",
|
|
779
|
-
children: [
|
|
862
|
+
children: [I ? /* @__PURE__ */ R("h3", {
|
|
780
863
|
className: "mb-2 text-sm font-semibold",
|
|
781
|
-
children:
|
|
782
|
-
}) : null, /* @__PURE__ */
|
|
864
|
+
children: I
|
|
865
|
+
}) : null, /* @__PURE__ */ z("div", {
|
|
783
866
|
className: "flex flex-col gap-0.5 py-2",
|
|
784
|
-
children: [/* @__PURE__ */
|
|
867
|
+
children: [/* @__PURE__ */ R("span", {
|
|
785
868
|
className: "text-2xl font-semibold tabular-nums",
|
|
786
|
-
children:
|
|
787
|
-
}), /* @__PURE__ */
|
|
869
|
+
children: f(w.rows[0]?.[_], e?.format, e?.currency, e?.percentScale, k)
|
|
870
|
+
}), /* @__PURE__ */ R("span", {
|
|
788
871
|
className: "text-xs text-muted-foreground",
|
|
789
|
-
children:
|
|
872
|
+
children: ne
|
|
790
873
|
})]
|
|
791
874
|
})]
|
|
792
875
|
});
|
|
793
876
|
}
|
|
794
|
-
if (!
|
|
795
|
-
let
|
|
877
|
+
if (!T) return null;
|
|
878
|
+
let B = y(w.rows, P), ie = X(h, S, C) ? null : r(F), ae = Z(B, [g], (e, t) => e[t], ie ? { [g]: ie } : null), oe = ae ? ae.map((e) => B[e]) : B, { data: se, xAxisKey: ce, series: le } = i(oe, [g], [_], w.fields, {
|
|
879
|
+
nullCategoryLabel: O("chart.nullCategory", "(None)"),
|
|
880
|
+
builtinAggregateLabels: V(O)
|
|
881
|
+
}), fe = m(le, t.series).map((e) => e.dataKey === _ ? {
|
|
796
882
|
...e,
|
|
797
|
-
label:
|
|
798
|
-
} : e), { title:
|
|
799
|
-
return /* @__PURE__ */
|
|
883
|
+
label: ne
|
|
884
|
+
} : e), { title: G, ...pe } = c(t, N);
|
|
885
|
+
return /* @__PURE__ */ z("div", {
|
|
800
886
|
className: "rounded-md border bg-card p-3",
|
|
801
887
|
"data-testid": "dataset-report-chart",
|
|
802
|
-
children: [
|
|
888
|
+
children: [I ? /* @__PURE__ */ R("h3", {
|
|
803
889
|
className: "mb-2 text-sm font-semibold",
|
|
804
|
-
children:
|
|
805
|
-
}) : null, /* @__PURE__ */
|
|
806
|
-
chartType:
|
|
807
|
-
data:
|
|
808
|
-
xAxisKey:
|
|
809
|
-
series:
|
|
890
|
+
children: I
|
|
891
|
+
}) : null, /* @__PURE__ */ R(T, { schema: {
|
|
892
|
+
chartType: v.chartType,
|
|
893
|
+
data: se,
|
|
894
|
+
xAxisKey: ce,
|
|
895
|
+
series: fe,
|
|
810
896
|
height: 280,
|
|
811
897
|
isAnimationActive: !1,
|
|
812
|
-
...
|
|
813
|
-
...
|
|
898
|
+
...pe,
|
|
899
|
+
...F ? { categoryOrder: F } : {}
|
|
814
900
|
} })]
|
|
815
901
|
});
|
|
816
902
|
}
|
|
817
|
-
function
|
|
818
|
-
return
|
|
903
|
+
function $(e, t) {
|
|
904
|
+
return g(e.map((e) => v(t[e])));
|
|
819
905
|
}
|
|
820
|
-
function
|
|
821
|
-
return e.map((e) =>
|
|
906
|
+
function Je(e, t, n) {
|
|
907
|
+
return e.map((e) => d(t[e], n)).join(" / ");
|
|
822
908
|
}
|
|
823
|
-
function
|
|
824
|
-
let
|
|
909
|
+
function Ye({ dataset: e, rows: t, columnsAcross: n, values: r, runtimeFilter: i, dataSource: a, onDrill: s, order: c }) {
|
|
910
|
+
let l = Ie(e, [...t, ...n], r, i, a, [
|
|
825
911
|
t,
|
|
826
912
|
n,
|
|
827
913
|
[]
|
|
828
|
-
],
|
|
829
|
-
if (
|
|
914
|
+
], c), u = W(), { fieldLabel: p, fieldOptionLabel: m } = U(), h = H(), g = ee(l.object, l.dimensionFields, [...t, ...n]), { dimensionLabels: v, dimensionRanks: b } = x.useMemo(() => Pe(g, m), [g, m]), S = X(c, [...t, ...n], r) !== void 0, C = x.useMemo(() => {
|
|
915
|
+
if (l.status !== "ok") return null;
|
|
830
916
|
let e = [], r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
831
|
-
|
|
832
|
-
let
|
|
833
|
-
if (!i.has(
|
|
834
|
-
i.add(
|
|
917
|
+
y(l.rows, v).forEach((s, c) => {
|
|
918
|
+
let u = l.rows[c], d = $(t, s), f = $(n, s);
|
|
919
|
+
if (!i.has(d)) {
|
|
920
|
+
i.add(d);
|
|
835
921
|
let n = {}, r = {};
|
|
836
|
-
for (let e of t) n[e] =
|
|
922
|
+
for (let e of t) n[e] = u[e], r[e] = s[e];
|
|
837
923
|
e.push({
|
|
838
|
-
id:
|
|
839
|
-
label:
|
|
924
|
+
id: d,
|
|
925
|
+
label: Je(t, s, h),
|
|
840
926
|
key: n,
|
|
841
927
|
display: r
|
|
842
928
|
});
|
|
843
929
|
}
|
|
844
|
-
if (!a.has(
|
|
845
|
-
a.add(
|
|
930
|
+
if (!a.has(f)) {
|
|
931
|
+
a.add(f);
|
|
846
932
|
let e = {}, t = {};
|
|
847
|
-
for (let r of n) e[r] =
|
|
933
|
+
for (let r of n) e[r] = u[r], t[r] = s[r];
|
|
848
934
|
r.push({
|
|
849
|
-
id:
|
|
850
|
-
label:
|
|
935
|
+
id: f,
|
|
936
|
+
label: Je(n, s, h),
|
|
851
937
|
key: e,
|
|
852
938
|
display: t
|
|
853
939
|
});
|
|
854
940
|
}
|
|
855
|
-
o.set(
|
|
856
|
-
row:
|
|
941
|
+
o.set(_(d, f), {
|
|
942
|
+
row: u,
|
|
857
943
|
index: c
|
|
858
944
|
});
|
|
859
|
-
})
|
|
860
|
-
|
|
861
|
-
|
|
945
|
+
});
|
|
946
|
+
let s = S ? null : b, c = Z(e, t, (e, t) => e.display[t], s), u = Z(r, n, (e, t) => e.display[t], s);
|
|
947
|
+
return {
|
|
948
|
+
rowHeaders: c ? c.map((t) => e[t]) : e,
|
|
949
|
+
colHeaders: u ? u.map((e) => r[e]) : r,
|
|
862
950
|
cells: o
|
|
863
951
|
};
|
|
864
952
|
}, [
|
|
865
|
-
|
|
953
|
+
l,
|
|
866
954
|
t,
|
|
867
955
|
n,
|
|
868
|
-
|
|
869
|
-
|
|
956
|
+
v,
|
|
957
|
+
b,
|
|
958
|
+
S,
|
|
959
|
+
h
|
|
870
960
|
]);
|
|
871
|
-
if (
|
|
872
|
-
if (
|
|
873
|
-
if (
|
|
961
|
+
if (r.length === 0) return /* @__PURE__ */ R(Re, { dataset: e });
|
|
962
|
+
if (l.status === "loading" || l.status === "idle") return /* @__PURE__ */ R(Q, { status: l.status });
|
|
963
|
+
if (l.status === "error") return /* @__PURE__ */ R(Q, {
|
|
874
964
|
status: "error",
|
|
875
|
-
error:
|
|
965
|
+
error: l.error,
|
|
966
|
+
forbidden: l.forbidden
|
|
876
967
|
});
|
|
877
|
-
if (!
|
|
878
|
-
let { measureField:
|
|
879
|
-
let a =
|
|
880
|
-
|
|
968
|
+
if (!C || C.rowHeaders.length === 0) return /* @__PURE__ */ R(Be, {});
|
|
969
|
+
let { measureField: w, headerLabel: T } = o(l.fields, l.object, p, V(u)), E = u("report.total", "Total"), D = !!s, O = l.dimensionFields ? [...t, ...n].filter((e) => e in l.dimensionFields) : [], k = (t, n, r) => {
|
|
970
|
+
let a = l.drillRanges?.[r], o = !!a && Object.keys(a).length > 0, c;
|
|
971
|
+
if (l.object && (O.length > 0 || o)) {
|
|
972
|
+
let e = Le(l.drillRawRows?.[r], O, l.dimensionFields ?? {}, i, a);
|
|
973
|
+
if (e === null) return;
|
|
974
|
+
c = e;
|
|
975
|
+
}
|
|
976
|
+
s({
|
|
881
977
|
dataset: e,
|
|
882
978
|
groupKey: {
|
|
883
979
|
...t,
|
|
884
980
|
...n
|
|
885
981
|
},
|
|
886
|
-
runtimeFilter:
|
|
887
|
-
object:
|
|
888
|
-
objectFilter:
|
|
982
|
+
runtimeFilter: i,
|
|
983
|
+
object: l.object,
|
|
984
|
+
objectFilter: c
|
|
889
985
|
});
|
|
890
|
-
},
|
|
986
|
+
}, A = C.colHeaders.flatMap((e) => r.map((t) => ({
|
|
891
987
|
col: e,
|
|
892
988
|
measure: t,
|
|
893
|
-
header:
|
|
894
|
-
}))),
|
|
895
|
-
let t =
|
|
896
|
-
return t &&
|
|
897
|
-
},
|
|
898
|
-
for (let e of
|
|
899
|
-
let
|
|
900
|
-
for (let e of
|
|
901
|
-
let
|
|
902
|
-
return /* @__PURE__ */
|
|
989
|
+
header: r.length === 1 ? e.label : `${e.label} · ${T(t)}`
|
|
990
|
+
}))), j = (e) => {
|
|
991
|
+
let t = l.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows;
|
|
992
|
+
return t && y(t, v);
|
|
993
|
+
}, M = /* @__PURE__ */ new Map();
|
|
994
|
+
for (let e of j(t) ?? []) M.set($(t, e), e);
|
|
995
|
+
let N = /* @__PURE__ */ new Map();
|
|
996
|
+
for (let e of j(n) ?? []) N.set($(n, e), e);
|
|
997
|
+
let P = j([])?.[0], F = M.size > 0, I = N.size > 0;
|
|
998
|
+
return /* @__PURE__ */ R("div", {
|
|
903
999
|
className: "overflow-auto max-h-[70vh] rounded-md border",
|
|
904
1000
|
"data-testid": "dataset-matrix",
|
|
905
|
-
children: /* @__PURE__ */
|
|
1001
|
+
children: /* @__PURE__ */ z("table", {
|
|
906
1002
|
className: "w-full text-xs",
|
|
907
|
-
children: [/* @__PURE__ */
|
|
1003
|
+
children: [/* @__PURE__ */ R("thead", {
|
|
908
1004
|
className: "bg-muted/40",
|
|
909
|
-
children: /* @__PURE__ */
|
|
910
|
-
t.map((e) => /* @__PURE__ */
|
|
1005
|
+
children: /* @__PURE__ */ z("tr", { children: [
|
|
1006
|
+
t.map((e) => /* @__PURE__ */ R("th", {
|
|
911
1007
|
className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
|
|
912
|
-
children:
|
|
1008
|
+
children: T(e)
|
|
913
1009
|
}, e)),
|
|
914
|
-
|
|
1010
|
+
A.map((e) => /* @__PURE__ */ R("th", {
|
|
915
1011
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
916
1012
|
children: e.header
|
|
917
1013
|
}, `${e.col.id}-${e.measure}`)),
|
|
918
|
-
|
|
1014
|
+
F && r.map((e) => /* @__PURE__ */ R("th", {
|
|
919
1015
|
className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
|
|
920
1016
|
"data-testid": "matrix-total-col-header",
|
|
921
|
-
children:
|
|
1017
|
+
children: r.length === 1 ? E : `${E} · ${T(e)}`
|
|
922
1018
|
}, `total-${e}`))
|
|
923
1019
|
] })
|
|
924
|
-
}), /* @__PURE__ */
|
|
1020
|
+
}), /* @__PURE__ */ z("tbody", { children: [C.rowHeaders.map((e) => /* @__PURE__ */ z("tr", {
|
|
925
1021
|
className: "border-t",
|
|
926
1022
|
children: [
|
|
927
|
-
t.map((t) => /* @__PURE__ */
|
|
1023
|
+
t.map((t) => /* @__PURE__ */ R("td", {
|
|
928
1024
|
className: "px-2 py-1 whitespace-nowrap font-medium",
|
|
929
|
-
children:
|
|
1025
|
+
children: d(e.display[t], h)
|
|
930
1026
|
}, t)),
|
|
931
|
-
|
|
932
|
-
let n =
|
|
933
|
-
return /* @__PURE__ */
|
|
934
|
-
className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${i ? ` ${
|
|
1027
|
+
A.map((t) => {
|
|
1028
|
+
let n = C.cells.get(_(e.id, t.col.id)), r = n?.row[t.measure], i = D && n != null;
|
|
1029
|
+
return /* @__PURE__ */ R("td", {
|
|
1030
|
+
className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${i ? ` ${Ve}` : ""}`,
|
|
935
1031
|
"data-testid": i ? "dataset-drill-cell" : void 0,
|
|
936
|
-
onClick: i ? () =>
|
|
937
|
-
children:
|
|
1032
|
+
onClick: i ? () => k(e.key, t.col.key, n.index) : void 0,
|
|
1033
|
+
children: f(r, w(t.measure)?.format, w(t.measure)?.currency, w(t.measure)?.percentScale, h)
|
|
938
1034
|
}, `${t.col.id}-${t.measure}`);
|
|
939
1035
|
}),
|
|
940
|
-
|
|
1036
|
+
F && r.map((t) => /* @__PURE__ */ R("td", {
|
|
941
1037
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
|
|
942
1038
|
"data-testid": "matrix-row-total",
|
|
943
|
-
children:
|
|
1039
|
+
children: f(M.get(e.id)?.[t], w(t)?.format, w(t)?.currency, w(t)?.percentScale, h)
|
|
944
1040
|
}, `total-${t}`))
|
|
945
1041
|
]
|
|
946
|
-
}, e.id)),
|
|
1042
|
+
}, e.id)), I && /* @__PURE__ */ z("tr", {
|
|
947
1043
|
className: "border-t bg-muted/30 font-medium",
|
|
948
1044
|
"data-testid": "matrix-total-row",
|
|
949
1045
|
children: [
|
|
950
|
-
t.length > 0 && /* @__PURE__ */
|
|
1046
|
+
t.length > 0 && /* @__PURE__ */ R("td", {
|
|
951
1047
|
colSpan: t.length,
|
|
952
1048
|
className: "px-2 py-1 whitespace-nowrap",
|
|
953
|
-
children:
|
|
1049
|
+
children: E
|
|
954
1050
|
}),
|
|
955
|
-
|
|
1051
|
+
A.map((e) => /* @__PURE__ */ R("td", {
|
|
956
1052
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
957
|
-
children:
|
|
1053
|
+
children: f(N.get(e.col.id)?.[e.measure], w(e.measure)?.format, w(e.measure)?.currency, w(e.measure)?.percentScale, h)
|
|
958
1054
|
}, `${e.col.id}-${e.measure}`)),
|
|
959
|
-
|
|
1055
|
+
F && r.map((e) => /* @__PURE__ */ R("td", {
|
|
960
1056
|
className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
|
|
961
1057
|
"data-testid": "matrix-grand-total",
|
|
962
|
-
children:
|
|
1058
|
+
children: f(P?.[e], w(e)?.format, w(e)?.currency, w(e)?.percentScale, h)
|
|
963
1059
|
}, `grand-${e}`))
|
|
964
1060
|
]
|
|
965
1061
|
})] })]
|
|
966
1062
|
})
|
|
967
1063
|
});
|
|
968
1064
|
}
|
|
969
|
-
var
|
|
970
|
-
let a =
|
|
971
|
-
|
|
972
|
-
let o =
|
|
973
|
-
if (c === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */
|
|
1065
|
+
var Xe = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i }) => {
|
|
1066
|
+
let a = je(e);
|
|
1067
|
+
Ae(e, a);
|
|
1068
|
+
let o = h(e.runtimeFilter, n), s = e.drilldown === !1 ? void 0 : r, c = Ue(e.type);
|
|
1069
|
+
if (c === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */ R("div", {
|
|
974
1070
|
className: i,
|
|
975
1071
|
"data-testid": "dataset-joined-report",
|
|
976
1072
|
"data-report-name": e.name,
|
|
@@ -980,8 +1076,8 @@ var Re = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
|
|
|
980
1076
|
gap: 24
|
|
981
1077
|
},
|
|
982
1078
|
children: e.blocks.map((e, n) => {
|
|
983
|
-
|
|
984
|
-
let r =
|
|
1079
|
+
Ae(e, `${a} block \`${e.name ?? n}\``);
|
|
1080
|
+
let r = h(o, e.runtimeFilter), i = Y(e.columns), c = Ne(e.order), l = Ue(e.type), u = l === "matrix" && i.length > 0 ? /* @__PURE__ */ R(Ye, {
|
|
985
1081
|
dataset: String(e.dataset ?? ""),
|
|
986
1082
|
rows: Y(e.rows),
|
|
987
1083
|
columnsAcross: i,
|
|
@@ -990,7 +1086,7 @@ var Re = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
|
|
|
990
1086
|
dataSource: t,
|
|
991
1087
|
onDrill: s,
|
|
992
1088
|
order: c
|
|
993
|
-
}) : /* @__PURE__ */
|
|
1089
|
+
}) : /* @__PURE__ */ R(He, {
|
|
994
1090
|
dataset: String(e.dataset ?? ""),
|
|
995
1091
|
rows: Y(e.rows),
|
|
996
1092
|
values: Y(e.values),
|
|
@@ -1000,121 +1096,114 @@ var Re = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
|
|
|
1000
1096
|
order: c,
|
|
1001
1097
|
withTotals: l === "summary" || l === "matrix"
|
|
1002
1098
|
});
|
|
1003
|
-
return /* @__PURE__ */
|
|
1099
|
+
return /* @__PURE__ */ z("section", {
|
|
1004
1100
|
"data-testid": "dataset-report-block",
|
|
1005
1101
|
"data-block-id": e.name ?? `block-${n}`,
|
|
1006
1102
|
className: "flex flex-col gap-2 rounded-lg border bg-card p-4",
|
|
1007
|
-
children: [/* @__PURE__ */
|
|
1103
|
+
children: [/* @__PURE__ */ z("header", {
|
|
1008
1104
|
className: "flex flex-col gap-0.5",
|
|
1009
|
-
children: [/* @__PURE__ */
|
|
1105
|
+
children: [/* @__PURE__ */ R("h3", {
|
|
1010
1106
|
className: "text-sm font-semibold",
|
|
1011
|
-
children:
|
|
1012
|
-
}), e.description ? /* @__PURE__ */
|
|
1107
|
+
children: Me(e.label, e.name ?? `Block ${n + 1}`)
|
|
1108
|
+
}), e.description ? /* @__PURE__ */ R("p", {
|
|
1013
1109
|
className: "text-xs text-muted-foreground",
|
|
1014
|
-
children:
|
|
1110
|
+
children: Me(e.description, "")
|
|
1015
1111
|
}) : null]
|
|
1016
1112
|
}), u]
|
|
1017
1113
|
}, e.name ?? `block-${n}`);
|
|
1018
1114
|
})
|
|
1019
1115
|
});
|
|
1020
|
-
let l = Y(e.columns), u =
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1116
|
+
let l = Y(e.columns), u = Ne(e.order), d = c === "matrix" && l.length > 0, f = e.chart && typeof e.chart == "object" && e.chart.type ? e.chart : null, p = f ? /* @__PURE__ */ R(qe, {
|
|
1117
|
+
dataset: String(e.dataset ?? ""),
|
|
1118
|
+
chart: f,
|
|
1119
|
+
runtimeFilter: o,
|
|
1120
|
+
dataSource: t,
|
|
1121
|
+
order: u
|
|
1122
|
+
}) : null, m = d ? /* @__PURE__ */ R(Ye, {
|
|
1123
|
+
dataset: String(e.dataset ?? ""),
|
|
1124
|
+
rows: Y(e.rows),
|
|
1125
|
+
columnsAcross: l,
|
|
1126
|
+
values: Y(e.values),
|
|
1127
|
+
runtimeFilter: o,
|
|
1128
|
+
dataSource: t,
|
|
1129
|
+
onDrill: s,
|
|
1130
|
+
order: u
|
|
1131
|
+
}) : /* @__PURE__ */ R(He, {
|
|
1132
|
+
dataset: String(e.dataset ?? ""),
|
|
1133
|
+
rows: Y(e.rows),
|
|
1134
|
+
values: Y(e.values),
|
|
1135
|
+
runtimeFilter: o,
|
|
1136
|
+
dataSource: t,
|
|
1137
|
+
onDrill: s,
|
|
1138
|
+
order: u,
|
|
1139
|
+
withTotals: c === "summary" || c === "matrix"
|
|
1035
1140
|
});
|
|
1036
|
-
|
|
1037
|
-
return /* @__PURE__ */ I("div", {
|
|
1141
|
+
return /* @__PURE__ */ z("div", {
|
|
1038
1142
|
className: `${i ?? ""} flex flex-col gap-3`,
|
|
1039
1143
|
"data-testid": "dataset-report",
|
|
1040
1144
|
"data-report-name": e.name,
|
|
1041
1145
|
"data-report-presentation": c,
|
|
1042
|
-
children: [d ?
|
|
1043
|
-
dataset: String(e.dataset ?? ""),
|
|
1044
|
-
chart: d,
|
|
1045
|
-
runtimeFilter: o,
|
|
1046
|
-
dataSource: t,
|
|
1047
|
-
order: u
|
|
1048
|
-
}) : null, /* @__PURE__ */ F(Ae, {
|
|
1049
|
-
dataset: String(e.dataset ?? ""),
|
|
1050
|
-
rows: Y(e.rows),
|
|
1051
|
-
values: Y(e.values),
|
|
1052
|
-
runtimeFilter: o,
|
|
1053
|
-
dataSource: t,
|
|
1054
|
-
onDrill: s,
|
|
1055
|
-
order: u,
|
|
1056
|
-
withTotals: c === "summary" || c === "matrix"
|
|
1057
|
-
})]
|
|
1146
|
+
children: [d ? m : p, d ? p : m]
|
|
1058
1147
|
});
|
|
1059
|
-
},
|
|
1060
|
-
let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: a } = e, o =
|
|
1061
|
-
if (c && typeof c == "object" && c.type === "
|
|
1148
|
+
}, Ze = (e) => {
|
|
1149
|
+
let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: a } = e, o = x.useContext(E), s = t ?? o?.dataSource, c = e.schema;
|
|
1150
|
+
if (c && typeof c == "object" && c.type === "report" && c.report && typeof c.report == "object" && (c = c.report), De(c)) return /* @__PURE__ */ R(Xe, {
|
|
1062
1151
|
report: c,
|
|
1063
1152
|
dataSource: s,
|
|
1064
1153
|
runtimeFilter: r,
|
|
1065
1154
|
onDrill: i,
|
|
1066
1155
|
className: a
|
|
1067
1156
|
});
|
|
1068
|
-
if (
|
|
1157
|
+
if (C(c)) {
|
|
1069
1158
|
let e = {
|
|
1070
1159
|
type: "report-viewer",
|
|
1071
|
-
report:
|
|
1160
|
+
report: w(c),
|
|
1072
1161
|
data: n ?? [],
|
|
1073
1162
|
showToolbar: !1
|
|
1074
1163
|
};
|
|
1075
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ R("div", {
|
|
1076
1165
|
className: a,
|
|
1077
1166
|
"data-testid": "report-presentation-bridge",
|
|
1078
|
-
children: /* @__PURE__ */
|
|
1167
|
+
children: /* @__PURE__ */ R(Ee, { schema: e })
|
|
1079
1168
|
});
|
|
1080
1169
|
}
|
|
1081
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ R(fe, { schema: c });
|
|
1082
1171
|
};
|
|
1083
1172
|
//#endregion
|
|
1084
1173
|
//#region src/LiveReportExporter.ts
|
|
1085
|
-
async function
|
|
1086
|
-
let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o } = t,
|
|
1174
|
+
async function Qe(e, t) {
|
|
1175
|
+
let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o, locale: s } = t, c = a || e.defaultExportFormat || "pdf";
|
|
1087
1176
|
try {
|
|
1088
1177
|
let t = (await n.find(r, i)).data || [];
|
|
1089
|
-
return
|
|
1090
|
-
format:
|
|
1091
|
-
...e.exportConfigs?.[
|
|
1178
|
+
return ve(c, e, t, {
|
|
1179
|
+
format: c,
|
|
1180
|
+
...e.exportConfigs?.[c],
|
|
1092
1181
|
...o
|
|
1093
|
-
}), {
|
|
1182
|
+
}, s), {
|
|
1094
1183
|
success: !0,
|
|
1095
1184
|
recordCount: t.length,
|
|
1096
|
-
format:
|
|
1185
|
+
format: c
|
|
1097
1186
|
};
|
|
1098
1187
|
} catch (e) {
|
|
1099
1188
|
return {
|
|
1100
1189
|
success: !1,
|
|
1101
1190
|
recordCount: 0,
|
|
1102
|
-
format:
|
|
1191
|
+
format: c,
|
|
1103
1192
|
error: e.message
|
|
1104
1193
|
};
|
|
1105
1194
|
}
|
|
1106
1195
|
}
|
|
1107
|
-
function
|
|
1108
|
-
let { columns: r, filename: i, includeAggregationRow: a = !1 } = n,
|
|
1196
|
+
function $e(e, t, n = {}) {
|
|
1197
|
+
let { columns: r, filename: i, includeAggregationRow: a = !1, locale: o = "en" } = n, s = r || (e.fields || []).map(tt), c = s.map((e) => e.header), l = t.map((e, t) => s.map((n) => {
|
|
1109
1198
|
if (n.formula) return n.formula.replace(/\{ROW\}/g, String(t + 2));
|
|
1110
1199
|
let r = e[n.name];
|
|
1111
|
-
return
|
|
1200
|
+
return nt(r, n.numberFormat, o);
|
|
1112
1201
|
}));
|
|
1113
1202
|
if (a && t.length > 0) {
|
|
1114
|
-
let n =
|
|
1203
|
+
let n = s.map((n, r) => {
|
|
1115
1204
|
let i = (e.fields || []).find((e) => e.name === n.name);
|
|
1116
1205
|
if (i?.aggregation) {
|
|
1117
|
-
let e =
|
|
1206
|
+
let e = it(r), n = t.length + 1;
|
|
1118
1207
|
switch (i.aggregation) {
|
|
1119
1208
|
case "sum": return `=SUM(${e}2:${e}${n})`;
|
|
1120
1209
|
case "avg": return `=AVERAGE(${e}2:${e}${n})`;
|
|
@@ -1126,17 +1215,17 @@ function Be(e, t, n = {}) {
|
|
|
1126
1215
|
}
|
|
1127
1216
|
return "";
|
|
1128
1217
|
});
|
|
1129
|
-
|
|
1218
|
+
l.push(n);
|
|
1130
1219
|
}
|
|
1131
|
-
|
|
1220
|
+
ot("" + [c.join(" "), ...l.map((e) => e.join(" "))].join("\n"), i || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
1132
1221
|
}
|
|
1133
|
-
function
|
|
1222
|
+
function et(e, t, n, r) {
|
|
1134
1223
|
return async () => {
|
|
1135
1224
|
let i = e.schedule;
|
|
1136
1225
|
if (!i?.enabled) return [];
|
|
1137
1226
|
let a = i.formats || [e.defaultExportFormat || "pdf"], o = [];
|
|
1138
1227
|
for (let r of a) {
|
|
1139
|
-
let i = await
|
|
1228
|
+
let i = await Qe(e, {
|
|
1140
1229
|
dataSource: t,
|
|
1141
1230
|
resource: n,
|
|
1142
1231
|
format: r
|
|
@@ -1146,16 +1235,16 @@ function Ve(e, t, n, r) {
|
|
|
1146
1235
|
return r(e, i), o;
|
|
1147
1236
|
};
|
|
1148
1237
|
}
|
|
1149
|
-
function
|
|
1238
|
+
function tt(e) {
|
|
1150
1239
|
return {
|
|
1151
1240
|
name: e.name,
|
|
1152
1241
|
header: e.label || e.name
|
|
1153
1242
|
};
|
|
1154
1243
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return e == null ? "" : typeof e == "number" && t ? e
|
|
1244
|
+
function nt(e, t, n = "en") {
|
|
1245
|
+
return e == null ? "" : typeof e == "number" && t ? G(e, n, rt(t)) : at(String(e));
|
|
1157
1246
|
}
|
|
1158
|
-
function
|
|
1247
|
+
function rt(e) {
|
|
1159
1248
|
if (e.includes("%")) return {
|
|
1160
1249
|
style: "percent",
|
|
1161
1250
|
minimumFractionDigits: 0
|
|
@@ -1166,69 +1255,56 @@ function We(e) {
|
|
|
1166
1255
|
maximumFractionDigits: Math.max(0, t - 1)
|
|
1167
1256
|
};
|
|
1168
1257
|
}
|
|
1169
|
-
function
|
|
1258
|
+
function it(e) {
|
|
1170
1259
|
let t = "", n = e;
|
|
1171
1260
|
for (; n >= 0;) t = String.fromCharCode(n % 26 + 65) + t, n = Math.floor(n / 26) - 1;
|
|
1172
1261
|
return t;
|
|
1173
1262
|
}
|
|
1174
|
-
function
|
|
1263
|
+
function at(e) {
|
|
1175
1264
|
if (e.length > 0) {
|
|
1176
1265
|
let t = e.charAt(0);
|
|
1177
1266
|
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `'${e}`;
|
|
1178
1267
|
}
|
|
1179
1268
|
return e;
|
|
1180
1269
|
}
|
|
1181
|
-
function
|
|
1270
|
+
function ot(e, t, n) {
|
|
1182
1271
|
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
1183
1272
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
1184
1273
|
}
|
|
1185
|
-
e.register("report",
|
|
1186
|
-
namespace: "report",
|
|
1274
|
+
e.register("report", Ze, {
|
|
1275
|
+
namespace: "plugin-report",
|
|
1187
1276
|
label: "Report",
|
|
1188
1277
|
category: "Report",
|
|
1189
1278
|
inputs: [
|
|
1190
1279
|
{
|
|
1191
1280
|
name: "title",
|
|
1192
|
-
type: "string"
|
|
1193
|
-
label: "Title"
|
|
1281
|
+
type: "string"
|
|
1194
1282
|
},
|
|
1195
1283
|
{
|
|
1196
1284
|
name: "description",
|
|
1197
|
-
type: "string"
|
|
1198
|
-
label: "Description"
|
|
1285
|
+
type: "string"
|
|
1199
1286
|
},
|
|
1200
1287
|
{
|
|
1201
1288
|
name: "chart",
|
|
1202
|
-
type: "code"
|
|
1203
|
-
|
|
1289
|
+
type: "code"
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
name: "report",
|
|
1293
|
+
type: "object",
|
|
1294
|
+
description: "The report to render, as `@objectstack/spec` declares it (`ReportSchema`: `name`, `label`, `type`, `dataset`, `rows`, `values`, …). When present, the block renders this report and reads none of its own presentation inputs."
|
|
1204
1295
|
}
|
|
1205
1296
|
]
|
|
1206
|
-
}), e.register("
|
|
1207
|
-
namespace: "report",
|
|
1208
|
-
label: "Spec Report",
|
|
1209
|
-
category: "Report",
|
|
1210
|
-
inputs: [{
|
|
1211
|
-
name: "dataset",
|
|
1212
|
-
type: "string",
|
|
1213
|
-
label: "Dataset"
|
|
1214
|
-
}, {
|
|
1215
|
-
name: "type",
|
|
1216
|
-
type: "string",
|
|
1217
|
-
label: "Report Type"
|
|
1218
|
-
}]
|
|
1219
|
-
}), e.register("report-viewer", J, {
|
|
1220
|
-
namespace: "report",
|
|
1297
|
+
}), e.register("report-viewer", Ee, {
|
|
1298
|
+
namespace: "plugin-report",
|
|
1221
1299
|
label: "Report Viewer",
|
|
1222
1300
|
category: "Report",
|
|
1223
1301
|
inputs: [{
|
|
1224
1302
|
name: "report",
|
|
1225
|
-
type: "code"
|
|
1226
|
-
label: "Report Definition"
|
|
1303
|
+
type: "code"
|
|
1227
1304
|
}, {
|
|
1228
1305
|
name: "showToolbar",
|
|
1229
|
-
type: "boolean"
|
|
1230
|
-
label: "Show Toolbar"
|
|
1306
|
+
type: "boolean"
|
|
1231
1307
|
}]
|
|
1232
1308
|
});
|
|
1233
1309
|
//#endregion
|
|
1234
|
-
export {
|
|
1310
|
+
export { Xe as DatasetReportRenderer, fe as LegacyReportRenderer, Ze as ReportRenderer, Ee as ReportViewer, et as createScheduleTrigger, pe as exportAsCSV, _e as exportAsExcel, he as exportAsHTML, me as exportAsJSON, ge as exportAsPDF, $e as exportExcelWithFormulas, ve as exportReport, Qe as exportWithLiveData, J as formatValue, De as isDatasetReport, h as mergeFilters };
|