@object-ui/plugin-report 4.0.12 → 4.2.1
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 +73 -0
- package/README.md +104 -22
- package/dist/index.js +1695 -551
- package/dist/index.umd.cjs +18 -18
- package/dist/packages/plugin-report/src/JoinedReportRenderer.d.ts +47 -0
- package/dist/packages/plugin-report/src/LegacyReportRenderer.d.ts +14 -0
- package/dist/packages/plugin-report/src/MatrixRenderer.d.ts +51 -0
- package/dist/packages/plugin-report/src/MatrixRenderer.stories.d.ts +24 -0
- package/dist/packages/plugin-report/src/ReportRenderer.d.ts +41 -11
- package/dist/packages/plugin-report/src/SpecReportGrid.d.ts +49 -0
- package/dist/packages/plugin-report/src/SpecReportGrid.stories.d.ts +31 -0
- package/dist/packages/plugin-report/src/buildChartData.d.ts +38 -0
- package/dist/packages/plugin-report/src/drill.d.ts +63 -0
- package/dist/packages/plugin-report/src/hooks/useReportData.d.ts +131 -0
- package/dist/packages/plugin-report/src/index.d.ts +14 -1
- package/package.json +9 -6
package/dist/index.js
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
import { ComponentRegistry as e } from "@object-ui/core";
|
|
2
2
|
import * as t from "react";
|
|
3
|
-
import n, {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import n, { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
4
|
+
import { isJoinedSpecReport as c, isSpecReport as l } from "@object-ui/types";
|
|
5
|
+
import { Badge as u, Button as d, Card as f, CardContent as p, CardDescription as m, CardHeader as h, CardTitle as g, Checkbox as _, ConfigPanelRenderer as v, Input as y, Label as b, Skeleton as x, SortBuilder as S, Tabs as C, TabsContent as w, TabsList as T, TabsTrigger as E, useConfigDraft as D } from "@object-ui/components";
|
|
6
|
+
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
7
|
+
import { useTranslation as j } from "react-i18next";
|
|
8
|
+
import { ObjectGrid as M } from "@object-ui/plugin-grid";
|
|
9
|
+
import { useSafeFieldLabel as ee } from "@object-ui/i18n";
|
|
10
|
+
import { SchemaRenderer as N } from "@object-ui/react";
|
|
11
|
+
import { Calendar as P, Clock as F, Download as I, Filter as te, Layers as ne, Mail as re, Plus as L, Printer as R, RefreshCw as ie, Save as ae, Settings as oe, Trash2 as z } from "lucide-react";
|
|
12
|
+
import { getCellRenderer as se, resolveCellRendererType as ce } from "@object-ui/fields";
|
|
13
|
+
//#region src/LegacyReportRenderer.tsx
|
|
14
|
+
var B = ({ schema: t }) => {
|
|
11
15
|
let { title: n, description: r, data: i, columns: a } = t;
|
|
12
16
|
t.chart?.type;
|
|
13
|
-
let
|
|
14
|
-
return /* @__PURE__ */
|
|
17
|
+
let o = !!t.chart;
|
|
18
|
+
return /* @__PURE__ */ A(f, {
|
|
15
19
|
className: `h-full flex flex-col ${t.className || ""}`,
|
|
16
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ A(h, { children: [n && /* @__PURE__ */ k(g, { children: n }), r && /* @__PURE__ */ k(m, { children: r })] }), /* @__PURE__ */ A(p, {
|
|
17
21
|
className: "flex-1 overflow-auto space-y-4",
|
|
18
|
-
children: [
|
|
22
|
+
children: [o && (() => {
|
|
19
23
|
let n = t.chart?.type, r = n ? e.get(n) : null;
|
|
20
|
-
return r ||= e.get("chart"), r ? /* @__PURE__ */
|
|
24
|
+
return r ||= e.get("chart"), r ? /* @__PURE__ */ k("div", {
|
|
21
25
|
className: "min-h-[300px] border rounded-lg p-4 bg-background/50",
|
|
22
|
-
children: /* @__PURE__ */
|
|
26
|
+
children: /* @__PURE__ */ k(r, { schema: {
|
|
23
27
|
...t.chart,
|
|
24
28
|
data: t.chart.data || i
|
|
25
29
|
} })
|
|
26
|
-
}) : /* @__PURE__ */
|
|
30
|
+
}) : /* @__PURE__ */ A("div", {
|
|
27
31
|
className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center",
|
|
28
32
|
children: ["Unknown component type: ", n || "chart"]
|
|
29
33
|
});
|
|
30
|
-
})(), i && i.length > 0 && /* @__PURE__ */
|
|
34
|
+
})(), i && i.length > 0 && /* @__PURE__ */ k("div", {
|
|
31
35
|
className: "border rounded-lg",
|
|
32
36
|
children: (() => {
|
|
33
37
|
let t = e.get("aggrid") || e.get("table");
|
|
34
|
-
return t ? /* @__PURE__ */
|
|
38
|
+
return t ? /* @__PURE__ */ k(t, { schema: {
|
|
35
39
|
type: "aggrid",
|
|
36
40
|
rowData: i,
|
|
37
41
|
columnDefs: a,
|
|
38
42
|
domLayout: "autoHeight"
|
|
39
|
-
} }) : /* @__PURE__ */
|
|
43
|
+
} }) : /* @__PURE__ */ k("div", {
|
|
40
44
|
className: "overflow-x-auto",
|
|
41
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ A("table", {
|
|
42
46
|
className: "w-full text-sm text-left",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ k("thead", {
|
|
44
48
|
className: "text-xs uppercase bg-muted",
|
|
45
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ k("tr", { children: a?.map((e) => /* @__PURE__ */ k("th", {
|
|
46
50
|
className: "px-6 py-3",
|
|
47
51
|
children: e.headerName || e.label || e.field
|
|
48
52
|
}, e.field)) })
|
|
49
|
-
}), /* @__PURE__ */
|
|
53
|
+
}), /* @__PURE__ */ k("tbody", { children: i.map((e, t) => /* @__PURE__ */ k("tr", {
|
|
50
54
|
className: "bg-background border-b",
|
|
51
|
-
children: a?.map((t) => /* @__PURE__ */
|
|
55
|
+
children: a?.map((t) => /* @__PURE__ */ k("td", {
|
|
52
56
|
className: "px-6 py-4",
|
|
53
57
|
children: e[t.field]
|
|
54
58
|
}, t.field))
|
|
@@ -61,30 +65,1157 @@ var L = ({ schema: t }) => {
|
|
|
61
65
|
});
|
|
62
66
|
};
|
|
63
67
|
//#endregion
|
|
68
|
+
//#region src/hooks/useReportData.ts
|
|
69
|
+
function V(e) {
|
|
70
|
+
return e.aggregate ? `${e.field}__${e.aggregate}` : e.field;
|
|
71
|
+
}
|
|
72
|
+
function H(e, t) {
|
|
73
|
+
if (e == null) return null;
|
|
74
|
+
let n = e instanceof Date ? e : new Date(String(e));
|
|
75
|
+
if (Number.isNaN(n.getTime())) return null;
|
|
76
|
+
let r = n.getUTCFullYear(), i = n.getUTCMonth(), a = n.getUTCDate();
|
|
77
|
+
switch (t) {
|
|
78
|
+
case "year": return String(r);
|
|
79
|
+
case "quarter": return `${r}-Q${Math.floor(i / 3) + 1}`;
|
|
80
|
+
case "month": return `${r}-${String(i + 1).padStart(2, "0")}`;
|
|
81
|
+
case "week": {
|
|
82
|
+
let e = new Date(Date.UTC(r, i, a)), t = e.getUTCDay() || 7;
|
|
83
|
+
e.setUTCDate(e.getUTCDate() + 4 - t);
|
|
84
|
+
let n = new Date(Date.UTC(e.getUTCFullYear(), 0, 1)), o = Math.ceil(((e.getTime() - n.getTime()) / 864e5 + 1) / 7);
|
|
85
|
+
return `${e.getUTCFullYear()}-W${String(o).padStart(2, "0")}`;
|
|
86
|
+
}
|
|
87
|
+
case "day": return `${r}-${String(i + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`;
|
|
88
|
+
default: return String(e);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function U(e, t) {
|
|
92
|
+
let n = e[t.field];
|
|
93
|
+
return t.dateGranularity ? H(n, t.dateGranularity) ?? "(empty)" : n == null || n === "" ? "(empty)" : String(n);
|
|
94
|
+
}
|
|
95
|
+
function W(e, t) {
|
|
96
|
+
let n = {};
|
|
97
|
+
for (let r of t) {
|
|
98
|
+
if (!r.aggregate) {
|
|
99
|
+
let t = e.find((e) => e[r.field] != null);
|
|
100
|
+
n[V(r)] = t ? t[r.field] : null;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
let t = e.map((e) => e[r.field]);
|
|
104
|
+
switch (r.aggregate) {
|
|
105
|
+
case "count":
|
|
106
|
+
n[V(r)] = t.length;
|
|
107
|
+
break;
|
|
108
|
+
case "unique": {
|
|
109
|
+
let e = /* @__PURE__ */ new Set();
|
|
110
|
+
for (let n of t) n != null && e.add(n);
|
|
111
|
+
n[V(r)] = e.size;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case "sum": {
|
|
115
|
+
let e = 0;
|
|
116
|
+
for (let n of t) e += Number(n) || 0;
|
|
117
|
+
n[V(r)] = e;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "avg": {
|
|
121
|
+
let e = 0, i = 0;
|
|
122
|
+
for (let n of t) {
|
|
123
|
+
if (n == null || n === "") continue;
|
|
124
|
+
let t = Number(n);
|
|
125
|
+
Number.isNaN(t) || (e += t, i += 1);
|
|
126
|
+
}
|
|
127
|
+
n[V(r)] = i === 0 ? null : e / i;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "min": {
|
|
131
|
+
let e = null;
|
|
132
|
+
for (let n of t) {
|
|
133
|
+
if (n == null) continue;
|
|
134
|
+
let t = Number(n);
|
|
135
|
+
Number.isNaN(t) || (e === null || t < e) && (e = t);
|
|
136
|
+
}
|
|
137
|
+
n[V(r)] = e;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case "max": {
|
|
141
|
+
let e = null;
|
|
142
|
+
for (let n of t) {
|
|
143
|
+
if (n == null) continue;
|
|
144
|
+
let t = Number(n);
|
|
145
|
+
Number.isNaN(t) || (e === null || t > e) && (e = t);
|
|
146
|
+
}
|
|
147
|
+
n[V(r)] = e;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
default: n[V(r)] = null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return n;
|
|
154
|
+
}
|
|
155
|
+
function le(e, t, n, r = {}, i = []) {
|
|
156
|
+
if (t.length === 0) return [];
|
|
157
|
+
let [a, ...o] = t, s = /* @__PURE__ */ new Map();
|
|
158
|
+
for (let t of e) {
|
|
159
|
+
let e = U(t, a), n = s.get(e);
|
|
160
|
+
n || (n = [], s.set(e, n)), n.push(t);
|
|
161
|
+
}
|
|
162
|
+
let c = [];
|
|
163
|
+
for (let [e, t] of s) {
|
|
164
|
+
let s = {
|
|
165
|
+
...r,
|
|
166
|
+
[a.field]: e
|
|
167
|
+
}, l = [...i, e], u = W(t, n), d = o.length > 0 ? le(t, o, n, s, l) : void 0;
|
|
168
|
+
c.push({
|
|
169
|
+
groupKey: s,
|
|
170
|
+
groupPath: l,
|
|
171
|
+
values: u,
|
|
172
|
+
count: t.length,
|
|
173
|
+
children: d
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
let l = a.sort === "desc" ? -1 : 1;
|
|
177
|
+
return c.sort((e, t) => {
|
|
178
|
+
let n = String(e.groupPath[e.groupPath.length - 1]), r = String(t.groupPath[t.groupPath.length - 1]);
|
|
179
|
+
return n.localeCompare(r) * l;
|
|
180
|
+
}), typeof a.limit == "number" && a.limit > 0 ? c.slice(0, a.limit) : c;
|
|
181
|
+
}
|
|
182
|
+
function ue(e, t, n, r) {
|
|
183
|
+
let i = de(e, n), a = de(e, r), o = {}, s = {}, c = {};
|
|
184
|
+
for (let c of i) {
|
|
185
|
+
o[c.id] = {};
|
|
186
|
+
let i = fe(e, c.key, n);
|
|
187
|
+
s[c.id] = W(i, t);
|
|
188
|
+
for (let e of a) {
|
|
189
|
+
let n = fe(i, e.key, r);
|
|
190
|
+
n.length !== 0 && (o[c.id][e.id] = W(n, t));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
for (let n of a) {
|
|
194
|
+
let i = fe(e, n.key, r);
|
|
195
|
+
c[n.id] = W(i, t);
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
rowHeaders: i,
|
|
199
|
+
colHeaders: a,
|
|
200
|
+
cells: o,
|
|
201
|
+
rowTotals: s,
|
|
202
|
+
colTotals: c,
|
|
203
|
+
grandTotal: W(e, t),
|
|
204
|
+
columns: t,
|
|
205
|
+
downGroupings: n,
|
|
206
|
+
acrossGroupings: r
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function de(e, t) {
|
|
210
|
+
if (t.length === 0) return [{
|
|
211
|
+
key: {},
|
|
212
|
+
path: [],
|
|
213
|
+
id: ""
|
|
214
|
+
}];
|
|
215
|
+
let n = /* @__PURE__ */ new Map();
|
|
216
|
+
for (let r of e) {
|
|
217
|
+
let e = [], i = {};
|
|
218
|
+
for (let n of t) {
|
|
219
|
+
let t = U(r, n);
|
|
220
|
+
e.push(t), i[n.field] = t;
|
|
221
|
+
}
|
|
222
|
+
let a = e.join("");
|
|
223
|
+
n.has(a) || n.set(a, {
|
|
224
|
+
key: i,
|
|
225
|
+
path: e,
|
|
226
|
+
id: a
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
let r = Array.from(n.values());
|
|
230
|
+
r.sort((e, n) => {
|
|
231
|
+
for (let r = 0; r < t.length; r++) {
|
|
232
|
+
let i = t[r].sort === "desc" ? -1 : 1, a = e.path[r].localeCompare(n.path[r]) * i;
|
|
233
|
+
if (a !== 0) return a;
|
|
234
|
+
}
|
|
235
|
+
return 0;
|
|
236
|
+
});
|
|
237
|
+
let i = t[0].limit;
|
|
238
|
+
if (typeof i == "number" && i > 0) {
|
|
239
|
+
let e = /* @__PURE__ */ new Set();
|
|
240
|
+
for (let t of r) e.size >= i && !e.has(t.path[0]) || e.add(t.path[0]);
|
|
241
|
+
return r.filter((t) => e.has(t.path[0]));
|
|
242
|
+
}
|
|
243
|
+
return r;
|
|
244
|
+
}
|
|
245
|
+
function fe(e, t, n) {
|
|
246
|
+
let r = Object.entries(t);
|
|
247
|
+
if (r.length === 0) return e;
|
|
248
|
+
let i = /* @__PURE__ */ new Map();
|
|
249
|
+
for (let e of n) i.set(e.field, e);
|
|
250
|
+
return e.filter((e) => {
|
|
251
|
+
for (let [t, n] of r) {
|
|
252
|
+
let r = i.get(t);
|
|
253
|
+
if ((r ? U(e, r) : e[t] == null ? "(null)" : String(e[t])) !== String(n)) return !1;
|
|
254
|
+
}
|
|
255
|
+
return !0;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function G(e, t) {
|
|
259
|
+
let n = {};
|
|
260
|
+
for (let r of t) {
|
|
261
|
+
if (!r.aggregate) continue;
|
|
262
|
+
let t = V(r), i = 0, a = 0, o = null, s = null;
|
|
263
|
+
for (let n of e) {
|
|
264
|
+
let e = n[t];
|
|
265
|
+
typeof e == "number" && (i += e, a += 1, (o == null || e < o) && (o = e), (s == null || e > s) && (s = e));
|
|
266
|
+
}
|
|
267
|
+
r.aggregate === "min" ? n[t] = o : r.aggregate === "max" ? n[t] = s : r.aggregate === "avg" ? n[t] = a === 0 ? null : i / a : n[t] = i;
|
|
268
|
+
}
|
|
269
|
+
return n;
|
|
270
|
+
}
|
|
271
|
+
function pe(e, t, n, r) {
|
|
272
|
+
let i = me(e, n), a = me(e, r), o = {}, s = {}, c = {};
|
|
273
|
+
for (let n of i) {
|
|
274
|
+
o[n.id] = {};
|
|
275
|
+
let r = e.filter((e) => he(e, n.key));
|
|
276
|
+
s[n.id] = G(r, t);
|
|
277
|
+
for (let e of a) {
|
|
278
|
+
let i = r.filter((t) => he(t, e.key));
|
|
279
|
+
if (i.length === 0) continue;
|
|
280
|
+
let a = {};
|
|
281
|
+
for (let e of t) {
|
|
282
|
+
if (!e.aggregate) continue;
|
|
283
|
+
let t = V(e);
|
|
284
|
+
a[t] = i[0][t];
|
|
285
|
+
}
|
|
286
|
+
o[n.id][e.id] = a;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
for (let n of a) {
|
|
290
|
+
let r = e.filter((e) => he(e, n.key));
|
|
291
|
+
c[n.id] = G(r, t);
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
rowHeaders: i,
|
|
295
|
+
colHeaders: a,
|
|
296
|
+
cells: o,
|
|
297
|
+
rowTotals: s,
|
|
298
|
+
colTotals: c,
|
|
299
|
+
grandTotal: G(e, t),
|
|
300
|
+
columns: t,
|
|
301
|
+
downGroupings: n,
|
|
302
|
+
acrossGroupings: r
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function me(e, t) {
|
|
306
|
+
if (t.length === 0) return [{
|
|
307
|
+
key: {},
|
|
308
|
+
path: [],
|
|
309
|
+
id: ""
|
|
310
|
+
}];
|
|
311
|
+
let n = /* @__PURE__ */ new Map();
|
|
312
|
+
for (let r of e) {
|
|
313
|
+
let e = [], i = {};
|
|
314
|
+
for (let n of t) {
|
|
315
|
+
let t = r[n.field], a = t == null ? "(null)" : String(t);
|
|
316
|
+
e.push(a), i[n.field] = a;
|
|
317
|
+
}
|
|
318
|
+
let a = e.join("");
|
|
319
|
+
n.has(a) || n.set(a, {
|
|
320
|
+
key: i,
|
|
321
|
+
path: e,
|
|
322
|
+
id: a
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
let r = Array.from(n.values());
|
|
326
|
+
return r.sort((e, n) => {
|
|
327
|
+
for (let r = 0; r < t.length; r++) {
|
|
328
|
+
let i = t[r].sort === "desc" ? -1 : 1, a = e.path[r].localeCompare(n.path[r]) * i;
|
|
329
|
+
if (a !== 0) return a;
|
|
330
|
+
}
|
|
331
|
+
return 0;
|
|
332
|
+
}), r;
|
|
333
|
+
}
|
|
334
|
+
function he(e, t) {
|
|
335
|
+
for (let [n, r] of Object.entries(t)) if ((e[n] == null ? "(null)" : String(e[n])) !== String(r)) return !1;
|
|
336
|
+
return !0;
|
|
337
|
+
}
|
|
338
|
+
function K(e, t) {
|
|
339
|
+
let n = e && Object.keys(e).length > 0, r = t && Object.keys(t).length > 0;
|
|
340
|
+
if (n && r) return { $and: [e, t] };
|
|
341
|
+
if (n) return e;
|
|
342
|
+
if (r) return t;
|
|
343
|
+
}
|
|
344
|
+
function ge(e) {
|
|
345
|
+
let t = /* @__PURE__ */ new Set();
|
|
346
|
+
for (let n of e.groupingsDown ?? []) t.add(n.field);
|
|
347
|
+
for (let n of e.groupingsAcross ?? []) t.add(n.field);
|
|
348
|
+
for (let n of e.columns ?? []) t.add(n.field);
|
|
349
|
+
for (let n of e.sort ?? []) t.add(n.field);
|
|
350
|
+
return Array.from(t);
|
|
351
|
+
}
|
|
352
|
+
function _e(e, t, n) {
|
|
353
|
+
let r = [...e.groupingsDown ?? [], ...e.groupingsAcross ?? []], i = (e.columns ?? []).filter((e) => !!e.aggregate);
|
|
354
|
+
if (r.length === 0 && i.length === 0) return null;
|
|
355
|
+
let a = r.map((e) => e.dateGranularity ? {
|
|
356
|
+
field: e.field,
|
|
357
|
+
dateGranularity: e.dateGranularity
|
|
358
|
+
} : e.field), o = i.map((e) => ({
|
|
359
|
+
function: e.aggregate === "unique" ? "count_distinct" : e.aggregate,
|
|
360
|
+
field: e.field,
|
|
361
|
+
alias: V(e)
|
|
362
|
+
})), s = K(e.filter, t), c = {
|
|
363
|
+
object: e.objectName,
|
|
364
|
+
limit: n
|
|
365
|
+
};
|
|
366
|
+
return a.length > 0 && (c.groupBy = a), o.length > 0 && (c.aggregations = o), s && (c.where = s), c;
|
|
367
|
+
}
|
|
368
|
+
function ve(e, t, n) {
|
|
369
|
+
for (let [r, i] of Object.entries(t)) {
|
|
370
|
+
let t = n.find((e) => e.field === r);
|
|
371
|
+
if ((t ? U(e, t) : String(e[r] ?? "(empty)")) !== String(i)) return !1;
|
|
372
|
+
}
|
|
373
|
+
return !0;
|
|
374
|
+
}
|
|
375
|
+
var q = [];
|
|
376
|
+
function ye(e, t = {}) {
|
|
377
|
+
let { dataSource: n, runtimeFilter: c, maxRows: l = 5e3, enabled: u = !0, rows: d, preferServerAggregation: f = !0 } = t, [p, m] = s(d ?? q), [h, g] = s(!1), [_, v] = s(!1), [y, b] = s(null), x = o(0), S = r(async () => {
|
|
378
|
+
if (!e || !u) return;
|
|
379
|
+
if (d) {
|
|
380
|
+
m(d), g(!1);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (!n) {
|
|
384
|
+
m(q);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
let t = ++x.current;
|
|
388
|
+
v(!0), b(null);
|
|
389
|
+
try {
|
|
390
|
+
let r = f ? _e(e, c, l) : null;
|
|
391
|
+
if (r && typeof n.aggregate == "function") try {
|
|
392
|
+
let i = be(await n.aggregate(e.objectName, r));
|
|
393
|
+
if (t !== x.current) return;
|
|
394
|
+
m(i), g(!0);
|
|
395
|
+
return;
|
|
396
|
+
} catch (e) {
|
|
397
|
+
typeof console < "u" && console.warn && console.warn("[useReportData] dataSource.aggregate() failed, falling back to find():", e);
|
|
398
|
+
}
|
|
399
|
+
if (typeof n.find != "function") {
|
|
400
|
+
m(q), g(!1);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
let i = K(e.filter, c), a = ge(e), o = { $top: l };
|
|
404
|
+
i && (o.$filter = i), a.length > 0 && (o.$select = a), e.sort && e.sort.length > 0 && (o.$orderBy = e.sort.map((e) => `${e.field} ${e.direction ?? "asc"}`).join(","));
|
|
405
|
+
let s = be(await n.find(e.objectName, o));
|
|
406
|
+
if (t !== x.current) return;
|
|
407
|
+
m(s), g(!1);
|
|
408
|
+
} catch (e) {
|
|
409
|
+
if (t !== x.current) return;
|
|
410
|
+
b(e instanceof Error ? e : Error(String(e))), m(q), g(!1);
|
|
411
|
+
} finally {
|
|
412
|
+
t === x.current && v(!1);
|
|
413
|
+
}
|
|
414
|
+
}, [
|
|
415
|
+
e,
|
|
416
|
+
u,
|
|
417
|
+
d,
|
|
418
|
+
n,
|
|
419
|
+
c,
|
|
420
|
+
l,
|
|
421
|
+
f
|
|
422
|
+
]);
|
|
423
|
+
i(() => {
|
|
424
|
+
S();
|
|
425
|
+
}, [S]);
|
|
426
|
+
let { rows: C, totals: w, pivot: T } = a(() => {
|
|
427
|
+
if (!e) return {
|
|
428
|
+
rows: [],
|
|
429
|
+
totals: {},
|
|
430
|
+
pivot: null
|
|
431
|
+
};
|
|
432
|
+
let t = e.groupingsDown ?? [], n = e.groupingsAcross ?? [], r = e.columns ?? [], i = n.length > 0;
|
|
433
|
+
if (h) {
|
|
434
|
+
let e = [...t, ...n], a = p.map((t) => {
|
|
435
|
+
let n = {}, r = [];
|
|
436
|
+
for (let i of e) {
|
|
437
|
+
let e = t[i.field];
|
|
438
|
+
n[i.field] = e, r.push(e == null ? "(null)" : String(e));
|
|
439
|
+
}
|
|
440
|
+
let i = { ...t };
|
|
441
|
+
for (let t of e) delete i[t.field];
|
|
442
|
+
return {
|
|
443
|
+
groupKey: n,
|
|
444
|
+
groupPath: r,
|
|
445
|
+
values: i,
|
|
446
|
+
count: 1
|
|
447
|
+
};
|
|
448
|
+
}), o = G(p, r), s = i ? pe(p, r, t, n) : null;
|
|
449
|
+
return {
|
|
450
|
+
rows: i && s ? s.rowHeaders.map((e) => ({
|
|
451
|
+
groupKey: e.key,
|
|
452
|
+
groupPath: e.path,
|
|
453
|
+
values: s.rowTotals[e.id] ?? {},
|
|
454
|
+
count: 1
|
|
455
|
+
})) : a,
|
|
456
|
+
totals: o,
|
|
457
|
+
pivot: s
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
let a = i ? t : [...t, ...n];
|
|
461
|
+
return {
|
|
462
|
+
rows: a.length > 0 ? le(p, a, r) : p.map((e) => ({
|
|
463
|
+
groupKey: {},
|
|
464
|
+
groupPath: [],
|
|
465
|
+
values: r.length > 0 ? W([e], r) : { ...e },
|
|
466
|
+
count: 1
|
|
467
|
+
})),
|
|
468
|
+
totals: W(p, r),
|
|
469
|
+
pivot: i ? ue(p, r, t, n) : null
|
|
470
|
+
};
|
|
471
|
+
}, [
|
|
472
|
+
e,
|
|
473
|
+
p,
|
|
474
|
+
h
|
|
475
|
+
]);
|
|
476
|
+
return {
|
|
477
|
+
rows: C,
|
|
478
|
+
rawRows: p,
|
|
479
|
+
totals: w,
|
|
480
|
+
pivot: T,
|
|
481
|
+
serverAggregated: h,
|
|
482
|
+
loading: _,
|
|
483
|
+
error: y,
|
|
484
|
+
refetch: S,
|
|
485
|
+
drillDown: r((t) => {
|
|
486
|
+
if (!e) return [];
|
|
487
|
+
let n = [...e.groupingsDown ?? [], ...e.groupingsAcross ?? []];
|
|
488
|
+
return p.filter((e) => ve(e, t, n));
|
|
489
|
+
}, [e, p])
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function be(e) {
|
|
493
|
+
if (Array.isArray(e)) return e;
|
|
494
|
+
if (e && typeof e == "object") {
|
|
495
|
+
let t = e;
|
|
496
|
+
if (Array.isArray(t.data)) return t.data;
|
|
497
|
+
if (Array.isArray(t.records)) return t.records;
|
|
498
|
+
if (Array.isArray(t.results)) return t.results;
|
|
499
|
+
if (Array.isArray(t.value)) return t.value;
|
|
500
|
+
}
|
|
501
|
+
return q;
|
|
502
|
+
}
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/buildChartData.ts
|
|
505
|
+
function xe(e) {
|
|
506
|
+
return e.aggregate ? `${e.field}__${e.aggregate}` : e.field;
|
|
507
|
+
}
|
|
508
|
+
function Se(e) {
|
|
509
|
+
let t = [], n = (e) => {
|
|
510
|
+
e.children && e.children.length > 0 ? e.children.forEach(n) : t.push(e);
|
|
511
|
+
};
|
|
512
|
+
return e.forEach(n), t;
|
|
513
|
+
}
|
|
514
|
+
function Ce({ report: e, rows: t, labels: n }) {
|
|
515
|
+
let r = e.chart;
|
|
516
|
+
if (!r || !r.type) return { schema: null };
|
|
517
|
+
let i = e.groupingsDown ?? [], a = r.xAxis || (i.length > 0 ? i[0]?.field : void 0);
|
|
518
|
+
if (!a) return {
|
|
519
|
+
schema: null,
|
|
520
|
+
diagnostic: "chart.xAxis missing and no groupingsDown[0] to default to."
|
|
521
|
+
};
|
|
522
|
+
let o = e.columns ?? [], s = r.yAxis, c = "count", l = "Count", u = !0;
|
|
523
|
+
if (s) {
|
|
524
|
+
let e = o.find((e) => e.field === s && e.aggregate);
|
|
525
|
+
e ? (c = xe(e), l = n?.resolveColumnLabel?.(e) ?? (typeof e.label == "string" ? e.label : `${e.aggregate}(${e.field})`), u = !1) : (c = "count", l = n?.resolveCountLabel?.(s) ?? `Count of ${s}`);
|
|
526
|
+
}
|
|
527
|
+
let d = Se(t), f = /* @__PURE__ */ new Map();
|
|
528
|
+
for (let e of d) {
|
|
529
|
+
let t = e.groupKey[a];
|
|
530
|
+
if (t === void 0) continue;
|
|
531
|
+
let n = String(t ?? ""), r = u ? e.count : Number(e.values[c] ?? 0), i = f.get(n);
|
|
532
|
+
i ? i.measure += Number.isFinite(r) ? r : 0 : f.set(n, {
|
|
533
|
+
x: t,
|
|
534
|
+
measure: Number.isFinite(r) ? r : 0
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
let p = Array.from(f.values()).map((e) => {
|
|
538
|
+
let t = n?.resolveAxisValue?.(a, e.x) ?? e.x ?? "(null)";
|
|
539
|
+
return {
|
|
540
|
+
[a]: t,
|
|
541
|
+
[c]: e.measure
|
|
542
|
+
};
|
|
543
|
+
});
|
|
544
|
+
return (r.type === "pie" || r.type === "donut" || r.type === "funnel") && (p = [...p].sort((e, t) => Number(t[c] ?? 0) - Number(e[c] ?? 0))), { schema: {
|
|
545
|
+
type: "chart",
|
|
546
|
+
chartType: r.type,
|
|
547
|
+
data: p,
|
|
548
|
+
xAxisKey: a,
|
|
549
|
+
series: [{
|
|
550
|
+
dataKey: c,
|
|
551
|
+
label: l
|
|
552
|
+
}],
|
|
553
|
+
title: r.title,
|
|
554
|
+
showLegend: r.showLegend ?? !0,
|
|
555
|
+
showDataLabels: r.showDataLabels ?? !1,
|
|
556
|
+
className: "w-full h-[320px]"
|
|
557
|
+
} };
|
|
558
|
+
}
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/drill.ts
|
|
561
|
+
function we(e, t, n = {}) {
|
|
562
|
+
let r = K(K(e.filter, n.runtimeFilter), Object.keys(t).length > 0 ? t : void 0);
|
|
563
|
+
return {
|
|
564
|
+
type: "drill",
|
|
565
|
+
name: `drill-${e.name}`,
|
|
566
|
+
objectName: e.objectName,
|
|
567
|
+
...r ? { filter: r } : {},
|
|
568
|
+
view: n.view ?? "list",
|
|
569
|
+
...n.recordId === void 0 ? {} : { recordId: n.recordId },
|
|
570
|
+
openIn: n.openIn ?? "current"
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function Te(e) {
|
|
574
|
+
return !!e && e.type === "drill";
|
|
575
|
+
}
|
|
576
|
+
function Ee(e) {
|
|
577
|
+
return async (t) => {
|
|
578
|
+
if (!Te(t)) return {
|
|
579
|
+
success: !1,
|
|
580
|
+
error: "drill handler invoked with non-drill action"
|
|
581
|
+
};
|
|
582
|
+
try {
|
|
583
|
+
return await e.navigate({
|
|
584
|
+
objectName: t.objectName,
|
|
585
|
+
filter: t.filter,
|
|
586
|
+
view: t.view,
|
|
587
|
+
recordId: t.recordId,
|
|
588
|
+
openIn: t.openIn
|
|
589
|
+
}), { success: !0 };
|
|
590
|
+
} catch (e) {
|
|
591
|
+
return {
|
|
592
|
+
success: !1,
|
|
593
|
+
error: e instanceof Error ? e.message : String(e)
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function De(e, t) {
|
|
599
|
+
return e.registerHandler("drill", Ee(t)), () => e.unregisterHandler("drill");
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/SpecReportGrid.tsx
|
|
603
|
+
function Oe(e) {
|
|
604
|
+
return e ? e === "unique" ? "count_distinct" : e : null;
|
|
605
|
+
}
|
|
606
|
+
function ke(e) {
|
|
607
|
+
if (!(!e || e.length === 0)) return { fields: e.map((e) => ({
|
|
608
|
+
field: e.field,
|
|
609
|
+
order: e.sort ?? "asc",
|
|
610
|
+
collapsed: !1
|
|
611
|
+
})) };
|
|
612
|
+
}
|
|
613
|
+
function Ae(e) {
|
|
614
|
+
return (e.columns ?? []).map((e) => {
|
|
615
|
+
let t = { field: e.field };
|
|
616
|
+
return e.label && (t.label = typeof e.label == "string" ? e.label : String(e.label)), e.format && (t.format = e.format), e.width && (t.width = e.width), t;
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
var je = {
|
|
620
|
+
padding: "12px 16px",
|
|
621
|
+
border: "1px dashed rgb(203 213 225)",
|
|
622
|
+
borderRadius: 8,
|
|
623
|
+
color: "rgb(100 116 139)",
|
|
624
|
+
fontSize: 14
|
|
625
|
+
}, Me = ({ report: e, dataSource: n, rows: r, runtimeFilter: i, onDrillDown: a, actionRunner: o, drillView: s, drillOpenIn: c, className: l }) => {
|
|
626
|
+
let u = e.type ?? "tabular", { t: d } = j(), { fieldLabel: f, translateOptions: p } = ee(), [m, h] = t.useState(null);
|
|
627
|
+
t.useEffect(() => {
|
|
628
|
+
let t = n;
|
|
629
|
+
if (!t || typeof t.getObjectSchema != "function" || !e.objectName) return;
|
|
630
|
+
let r = !1;
|
|
631
|
+
return t.getObjectSchema(e.objectName).then((e) => {
|
|
632
|
+
r || h(e ?? null);
|
|
633
|
+
}).catch(() => {}), () => {
|
|
634
|
+
r = !0;
|
|
635
|
+
};
|
|
636
|
+
}, [n, e.objectName]);
|
|
637
|
+
let g = t.useCallback((t) => {
|
|
638
|
+
if (t.label) return String(t.label);
|
|
639
|
+
let n = m?.fields?.[t.field]?.label ?? t.field, r = f(e.objectName, t.field, n);
|
|
640
|
+
return t.aggregate ? `${r} · ${d(`report.aggregate.${t.aggregate}`, t.aggregate)}` : r;
|
|
641
|
+
}, [
|
|
642
|
+
m,
|
|
643
|
+
e.objectName,
|
|
644
|
+
f,
|
|
645
|
+
d
|
|
646
|
+
]), _ = t.useCallback((t, n) => {
|
|
647
|
+
if (n == null) return;
|
|
648
|
+
let r = m?.fields?.[t];
|
|
649
|
+
if (!r || !(r.type === "select" || r.type === "status") || !Array.isArray(r.options) || r.options.length === 0) return;
|
|
650
|
+
let i = p(e.objectName, t, r.options), a = String(n);
|
|
651
|
+
for (let e of i) if (e && e.value !== void 0 && e.value !== null && String(e.value) === a) return e.label == null ? a : String(e.label);
|
|
652
|
+
}, [
|
|
653
|
+
m,
|
|
654
|
+
e.objectName,
|
|
655
|
+
p
|
|
656
|
+
]), { rawRows: v, rows: y, totals: b, serverAggregated: x, loading: S, error: C, drillDown: w } = ye(e, {
|
|
657
|
+
dataSource: n,
|
|
658
|
+
rows: r,
|
|
659
|
+
runtimeFilter: i
|
|
660
|
+
});
|
|
661
|
+
if (u === "matrix" || u === "joined") return /* @__PURE__ */ A("div", {
|
|
662
|
+
className: l,
|
|
663
|
+
style: je,
|
|
664
|
+
children: [
|
|
665
|
+
"Report type ",
|
|
666
|
+
/* @__PURE__ */ k("code", { children: u }),
|
|
667
|
+
" is not yet supported by SpecReportGrid. It will be rendered by a dedicated component in M2 (matrix) / M3 (joined)."
|
|
668
|
+
]
|
|
669
|
+
});
|
|
670
|
+
let T = t.useMemo(() => {
|
|
671
|
+
if (x) {
|
|
672
|
+
let t = (e.groupingsDown ?? []).map((e) => ({
|
|
673
|
+
field: e.field,
|
|
674
|
+
label: e.field.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase())
|
|
675
|
+
})), n = (e.columns ?? []).filter((e) => e.aggregate).map((e) => ({
|
|
676
|
+
field: V(e),
|
|
677
|
+
label: `${(typeof e.label == "string" ? e.label : null) ?? e.field} (${e.aggregate})`,
|
|
678
|
+
...e.format ? { format: e.format } : {}
|
|
679
|
+
}));
|
|
680
|
+
return {
|
|
681
|
+
type: "object-grid",
|
|
682
|
+
objectName: e.objectName,
|
|
683
|
+
columns: [...t, ...n]
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
let t = u === "summary" ? ke(e.groupingsDown) : void 0, n = (e.columns ?? []).map((e) => {
|
|
687
|
+
let t = Oe(e.aggregate);
|
|
688
|
+
return t ? {
|
|
689
|
+
field: e.field,
|
|
690
|
+
type: t
|
|
691
|
+
} : null;
|
|
692
|
+
}).filter((e) => e !== null);
|
|
693
|
+
return {
|
|
694
|
+
type: "object-grid",
|
|
695
|
+
objectName: e.objectName,
|
|
696
|
+
columns: Ae(e),
|
|
697
|
+
grouping: t,
|
|
698
|
+
aggregations: n.length > 0 ? n : void 0
|
|
699
|
+
};
|
|
700
|
+
}, [
|
|
701
|
+
e,
|
|
702
|
+
u,
|
|
703
|
+
x
|
|
704
|
+
]), E = v, D = t.useCallback((t) => {
|
|
705
|
+
let n = e.groupingsDown ?? [], r = {};
|
|
706
|
+
for (let e of n) r[e.field] = t[e.field];
|
|
707
|
+
if (o) {
|
|
708
|
+
let t = we(e, r, {
|
|
709
|
+
runtimeFilter: i,
|
|
710
|
+
view: s,
|
|
711
|
+
openIn: c
|
|
712
|
+
});
|
|
713
|
+
o.execute(t);
|
|
714
|
+
}
|
|
715
|
+
a && a(r, w(r));
|
|
716
|
+
}, [
|
|
717
|
+
o,
|
|
718
|
+
w,
|
|
719
|
+
c,
|
|
720
|
+
s,
|
|
721
|
+
a,
|
|
722
|
+
e,
|
|
723
|
+
i
|
|
724
|
+
]), O = !!a || !!o, P = (e.columns ?? []).filter((e) => e.aggregate), F = P.length > 0 && b && Object.keys(b).length > 0, I = t.useMemo(() => u !== "summary" || !e.chart || !e.chart.type ? null : Ce({
|
|
725
|
+
report: e,
|
|
726
|
+
rows: y,
|
|
727
|
+
labels: {
|
|
728
|
+
resolveColumnLabel: g,
|
|
729
|
+
resolveCountLabel: (t) => {
|
|
730
|
+
let n = m?.fields?.[t]?.label ?? t;
|
|
731
|
+
return `${f(e.objectName, t, n)} · ${d("report.aggregate.count", "Count")}`;
|
|
732
|
+
},
|
|
733
|
+
resolveAxisValue: _
|
|
734
|
+
}
|
|
735
|
+
}).schema, [
|
|
736
|
+
e,
|
|
737
|
+
y,
|
|
738
|
+
u,
|
|
739
|
+
g,
|
|
740
|
+
_,
|
|
741
|
+
m,
|
|
742
|
+
f,
|
|
743
|
+
d
|
|
744
|
+
]);
|
|
745
|
+
return /* @__PURE__ */ A("div", {
|
|
746
|
+
className: l,
|
|
747
|
+
"data-testid": "spec-report-grid",
|
|
748
|
+
"aria-busy": S || void 0,
|
|
749
|
+
children: [
|
|
750
|
+
C ? /* @__PURE__ */ k("div", {
|
|
751
|
+
role: "alert",
|
|
752
|
+
style: {
|
|
753
|
+
...je,
|
|
754
|
+
color: "rgb(190 18 60)"
|
|
755
|
+
},
|
|
756
|
+
children: C.message
|
|
757
|
+
}) : null,
|
|
758
|
+
F ? /* @__PURE__ */ A("div", {
|
|
759
|
+
"data-testid": "spec-report-totals",
|
|
760
|
+
className: "mb-3 flex flex-wrap items-baseline gap-x-6 gap-y-1 rounded-md border bg-muted/40 px-3 py-2 text-sm",
|
|
761
|
+
children: [/* @__PURE__ */ k("span", {
|
|
762
|
+
className: "text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
763
|
+
children: d("report.totals", "Totals")
|
|
764
|
+
}), P.map((e) => {
|
|
765
|
+
let t = V(e), n = b[t], r = g(e), i = typeof n == "number" ? n.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(n ?? "—");
|
|
766
|
+
return /* @__PURE__ */ A("span", {
|
|
767
|
+
"data-testid": `spec-report-total-${t}`,
|
|
768
|
+
className: "inline-flex items-baseline gap-1.5",
|
|
769
|
+
children: [/* @__PURE__ */ A("span", {
|
|
770
|
+
className: "text-muted-foreground",
|
|
771
|
+
children: [r, ":"]
|
|
772
|
+
}), /* @__PURE__ */ k("span", {
|
|
773
|
+
className: "font-mono font-medium tabular-nums",
|
|
774
|
+
children: i
|
|
775
|
+
})]
|
|
776
|
+
}, t);
|
|
777
|
+
})]
|
|
778
|
+
}) : null,
|
|
779
|
+
I ? /* @__PURE__ */ k("div", {
|
|
780
|
+
className: "mb-4",
|
|
781
|
+
"data-testid": "spec-report-chart",
|
|
782
|
+
children: /* @__PURE__ */ k(N, { schema: I })
|
|
783
|
+
}) : null,
|
|
784
|
+
/* @__PURE__ */ k(M, {
|
|
785
|
+
schema: T,
|
|
786
|
+
data: E,
|
|
787
|
+
dataSource: n,
|
|
788
|
+
onRowClick: O ? D : void 0
|
|
789
|
+
})
|
|
790
|
+
]
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
Me.displayName = "SpecReportGrid";
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/MatrixRenderer.tsx
|
|
796
|
+
var Ne = "—";
|
|
797
|
+
function Pe(e) {
|
|
798
|
+
return e == null ? Ne : typeof e == "number" ? e.toLocaleString() : String(e);
|
|
799
|
+
}
|
|
800
|
+
function Fe(e, t, n) {
|
|
801
|
+
if (e == null || e === "" || e === "(null)") return n;
|
|
802
|
+
let r = t?.options;
|
|
803
|
+
if (r) {
|
|
804
|
+
let t = r.get(e);
|
|
805
|
+
if (t !== void 0 && t !== "") return t;
|
|
806
|
+
}
|
|
807
|
+
return e;
|
|
808
|
+
}
|
|
809
|
+
function Ie({ header: e, groupings: t, metaByField: n, fallback: r, emptyLabel: i }) {
|
|
810
|
+
return e.path.length === 0 ? /* @__PURE__ */ k(O, { children: r }) : /* @__PURE__ */ k(O, { children: e.path.map((e, r) => {
|
|
811
|
+
let a = t[r]?.field;
|
|
812
|
+
return Fe(e, a ? n.get(a) : void 0, i);
|
|
813
|
+
}).join(" / ") });
|
|
814
|
+
}
|
|
815
|
+
var Le = ({ report: e, dataSource: n, rows: r, runtimeFilter: i, onCellClick: a, actionRunner: o, drillView: s, drillOpenIn: c, className: l, emptyCellText: u = Ne }) => {
|
|
816
|
+
let { pivot: d, loading: f, error: p } = ye(e, {
|
|
817
|
+
dataSource: n,
|
|
818
|
+
rows: r,
|
|
819
|
+
runtimeFilter: i
|
|
820
|
+
}), m = e.columns ?? [], h = m.length > 1, { fieldLabel: g, translateOptions: _ } = ee(), { t: v } = j(), y = v("report.emptyLabel", "(Empty)"), b = v("report.allLabel", "(All)"), [x, S] = t.useState(null);
|
|
821
|
+
t.useEffect(() => {
|
|
822
|
+
let t = n;
|
|
823
|
+
if (!t || typeof t.getObjectSchema != "function" || !e.objectName) return;
|
|
824
|
+
let r = !1;
|
|
825
|
+
return t.getObjectSchema(e.objectName).then((e) => {
|
|
826
|
+
r || S(e ?? null);
|
|
827
|
+
}).catch(() => {}), () => {
|
|
828
|
+
r = !0;
|
|
829
|
+
};
|
|
830
|
+
}, [n, e.objectName]);
|
|
831
|
+
let C = e.groupingsDown ?? [], w = e.groupingsAcross ?? [], T = t.useMemo(() => {
|
|
832
|
+
let t = /* @__PURE__ */ new Map(), n = x?.fields ?? {}, r = [...C, ...w];
|
|
833
|
+
for (let i of r) {
|
|
834
|
+
let r = n[i.field], a = r?.label ?? i.field, o = g(e.objectName, i.field, a), s = r?.type === "select" || r?.type === "status", c;
|
|
835
|
+
if (s && Array.isArray(r?.options) && r.options.length > 0) {
|
|
836
|
+
let t = _(e.objectName, i.field, r.options);
|
|
837
|
+
c = /* @__PURE__ */ new Map();
|
|
838
|
+
for (let e of t) e && e.value !== void 0 && e.value !== null && c.set(String(e.value), e.label == null ? String(e.value) : String(e.label));
|
|
839
|
+
}
|
|
840
|
+
t.set(i.field, {
|
|
841
|
+
fieldLabel: o,
|
|
842
|
+
options: c
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
return t;
|
|
846
|
+
}, [
|
|
847
|
+
x,
|
|
848
|
+
C,
|
|
849
|
+
w,
|
|
850
|
+
e.objectName,
|
|
851
|
+
g,
|
|
852
|
+
_
|
|
853
|
+
]), E = t.useMemo(() => {
|
|
854
|
+
let t = /* @__PURE__ */ new Map(), n = x?.fields ?? {};
|
|
855
|
+
for (let r of m) {
|
|
856
|
+
let i = V(r);
|
|
857
|
+
if (r.label) {
|
|
858
|
+
t.set(i, String(r.label));
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
let a = n[r.field]?.label ?? r.field, o = g(e.objectName, r.field, a);
|
|
862
|
+
if (r.aggregate) {
|
|
863
|
+
let e = v(`report.aggregate.${r.aggregate}`, r.aggregate);
|
|
864
|
+
t.set(i, `${o} · ${e}`);
|
|
865
|
+
} else t.set(i, o);
|
|
866
|
+
}
|
|
867
|
+
return t;
|
|
868
|
+
}, [
|
|
869
|
+
m,
|
|
870
|
+
x,
|
|
871
|
+
e.objectName,
|
|
872
|
+
g,
|
|
873
|
+
v
|
|
874
|
+
]), D = t.useCallback((t, n, r) => {
|
|
875
|
+
let l = {
|
|
876
|
+
...t.key,
|
|
877
|
+
...n.key
|
|
878
|
+
};
|
|
879
|
+
if (o) {
|
|
880
|
+
let t = we(e, l, {
|
|
881
|
+
runtimeFilter: i,
|
|
882
|
+
view: s,
|
|
883
|
+
openIn: c
|
|
884
|
+
});
|
|
885
|
+
o.execute(t);
|
|
886
|
+
}
|
|
887
|
+
a && a({
|
|
888
|
+
rowKey: t.key,
|
|
889
|
+
colKey: n.key,
|
|
890
|
+
combinedKey: l,
|
|
891
|
+
values: r
|
|
892
|
+
});
|
|
893
|
+
}, [
|
|
894
|
+
o,
|
|
895
|
+
c,
|
|
896
|
+
s,
|
|
897
|
+
a,
|
|
898
|
+
e,
|
|
899
|
+
i
|
|
900
|
+
]);
|
|
901
|
+
if (p) return /* @__PURE__ */ k("div", {
|
|
902
|
+
className: l,
|
|
903
|
+
role: "alert",
|
|
904
|
+
"data-testid": "matrix-error",
|
|
905
|
+
children: v("report.failedToLoad", "Failed to load matrix: {{message}}", { message: p.message })
|
|
906
|
+
});
|
|
907
|
+
if (!d) return /* @__PURE__ */ k("div", {
|
|
908
|
+
className: l,
|
|
909
|
+
"aria-busy": f || void 0,
|
|
910
|
+
"data-testid": "matrix-empty",
|
|
911
|
+
children: f ? v("report.loading", "Loading…") : v("report.needsAcross", "Matrix report requires at least one `groupingsAcross` field.")
|
|
912
|
+
});
|
|
913
|
+
let O = !!a || !!o, M = C.map((e) => T.get(e.field)?.fieldLabel ?? e.field).join(" / ") || v("report.rowsLabel", "Row"), N = w.map((e) => T.get(e.field)?.fieldLabel ?? e.field).join(" / ") || v("report.columnsLabel", "Column");
|
|
914
|
+
return /* @__PURE__ */ k("div", {
|
|
915
|
+
className: l,
|
|
916
|
+
"data-testid": "matrix-renderer",
|
|
917
|
+
"aria-busy": f || void 0,
|
|
918
|
+
style: { overflow: "auto" },
|
|
919
|
+
children: /* @__PURE__ */ A("table", {
|
|
920
|
+
role: "table",
|
|
921
|
+
style: {
|
|
922
|
+
borderCollapse: "collapse",
|
|
923
|
+
minWidth: "100%",
|
|
924
|
+
fontSize: 13
|
|
925
|
+
},
|
|
926
|
+
children: [
|
|
927
|
+
/* @__PURE__ */ k("thead", { children: /* @__PURE__ */ A("tr", { children: [
|
|
928
|
+
/* @__PURE__ */ A("th", {
|
|
929
|
+
scope: "col",
|
|
930
|
+
style: Y({
|
|
931
|
+
header: !0,
|
|
932
|
+
bold: !0
|
|
933
|
+
}),
|
|
934
|
+
"aria-label": `${M} \u2192 ${N}`,
|
|
935
|
+
children: [
|
|
936
|
+
M,
|
|
937
|
+
" \\ ",
|
|
938
|
+
N
|
|
939
|
+
]
|
|
940
|
+
}),
|
|
941
|
+
d.colHeaders.map((e) => /* @__PURE__ */ k("th", {
|
|
942
|
+
scope: "col",
|
|
943
|
+
style: Y({ header: !0 }),
|
|
944
|
+
children: /* @__PURE__ */ k(Ie, {
|
|
945
|
+
header: e,
|
|
946
|
+
groupings: w,
|
|
947
|
+
metaByField: T,
|
|
948
|
+
fallback: b,
|
|
949
|
+
emptyLabel: y
|
|
950
|
+
})
|
|
951
|
+
}, `col-${e.id}`)),
|
|
952
|
+
/* @__PURE__ */ k("th", {
|
|
953
|
+
scope: "col",
|
|
954
|
+
style: Y({
|
|
955
|
+
header: !0,
|
|
956
|
+
total: !0
|
|
957
|
+
}),
|
|
958
|
+
children: v("report.rowTotal", "Row Total")
|
|
959
|
+
})
|
|
960
|
+
] }) }),
|
|
961
|
+
/* @__PURE__ */ k("tbody", { children: d.rowHeaders.map((e) => /* @__PURE__ */ A("tr", { children: [
|
|
962
|
+
/* @__PURE__ */ k("th", {
|
|
963
|
+
scope: "row",
|
|
964
|
+
style: Y({ header: !0 }),
|
|
965
|
+
children: /* @__PURE__ */ k(Ie, {
|
|
966
|
+
header: e,
|
|
967
|
+
groupings: C,
|
|
968
|
+
metaByField: T,
|
|
969
|
+
fallback: b,
|
|
970
|
+
emptyLabel: y
|
|
971
|
+
})
|
|
972
|
+
}),
|
|
973
|
+
d.colHeaders.map((t) => {
|
|
974
|
+
let n = d.cells[e.id]?.[t.id], r = !n;
|
|
975
|
+
return /* @__PURE__ */ k("td", {
|
|
976
|
+
style: Y({
|
|
977
|
+
interactive: O && !r,
|
|
978
|
+
empty: r
|
|
979
|
+
}),
|
|
980
|
+
onClick: O && !r ? () => D(e, t, n) : void 0,
|
|
981
|
+
"data-row": e.id,
|
|
982
|
+
"data-col": t.id,
|
|
983
|
+
children: r ? u : J(m, n, h, E)
|
|
984
|
+
}, `cell-${e.id}-${t.id}`);
|
|
985
|
+
}),
|
|
986
|
+
/* @__PURE__ */ k("td", {
|
|
987
|
+
style: Y({ total: !0 }),
|
|
988
|
+
children: J(m, d.rowTotals[e.id] ?? {}, h, E)
|
|
989
|
+
})
|
|
990
|
+
] }, `row-${e.id}`)) }),
|
|
991
|
+
/* @__PURE__ */ k("tfoot", { children: /* @__PURE__ */ A("tr", { children: [
|
|
992
|
+
/* @__PURE__ */ k("th", {
|
|
993
|
+
scope: "row",
|
|
994
|
+
style: Y({
|
|
995
|
+
header: !0,
|
|
996
|
+
total: !0
|
|
997
|
+
}),
|
|
998
|
+
children: v("report.columnTotal", "Column Total")
|
|
999
|
+
}),
|
|
1000
|
+
d.colHeaders.map((e) => /* @__PURE__ */ k("td", {
|
|
1001
|
+
style: Y({ total: !0 }),
|
|
1002
|
+
children: J(m, d.colTotals[e.id] ?? {}, h, E)
|
|
1003
|
+
}, `coltotal-${e.id}`)),
|
|
1004
|
+
/* @__PURE__ */ k("td", {
|
|
1005
|
+
style: Y({
|
|
1006
|
+
total: !0,
|
|
1007
|
+
grand: !0
|
|
1008
|
+
}),
|
|
1009
|
+
children: J(m, d.grandTotal, h, E)
|
|
1010
|
+
})
|
|
1011
|
+
] }) })
|
|
1012
|
+
]
|
|
1013
|
+
})
|
|
1014
|
+
});
|
|
1015
|
+
};
|
|
1016
|
+
function J(e, t, n, r) {
|
|
1017
|
+
return e.length ? n ? /* @__PURE__ */ k("div", {
|
|
1018
|
+
style: {
|
|
1019
|
+
display: "flex",
|
|
1020
|
+
flexDirection: "column",
|
|
1021
|
+
gap: 2
|
|
1022
|
+
},
|
|
1023
|
+
children: e.map((e) => {
|
|
1024
|
+
let n = V(e);
|
|
1025
|
+
return /* @__PURE__ */ A("div", {
|
|
1026
|
+
style: {
|
|
1027
|
+
display: "flex",
|
|
1028
|
+
justifyContent: "space-between",
|
|
1029
|
+
gap: 8
|
|
1030
|
+
},
|
|
1031
|
+
children: [/* @__PURE__ */ k("span", {
|
|
1032
|
+
style: { color: "var(--color-muted-foreground, #71717a)" },
|
|
1033
|
+
children: r?.get(n) ?? e.label ?? n
|
|
1034
|
+
}), /* @__PURE__ */ k("span", { children: Pe(t[n]) })]
|
|
1035
|
+
}, n);
|
|
1036
|
+
})
|
|
1037
|
+
}) : Pe(t[V(e[0])]) : Ne;
|
|
1038
|
+
}
|
|
1039
|
+
function Y(e) {
|
|
1040
|
+
return {
|
|
1041
|
+
border: "1px solid var(--color-border, #e4e4e7)",
|
|
1042
|
+
padding: "6px 10px",
|
|
1043
|
+
textAlign: e.header ? "left" : "right",
|
|
1044
|
+
fontWeight: e.bold || e.grand ? 700 : e.header || e.total ? 600 : 400,
|
|
1045
|
+
background: e.grand ? "var(--color-muted, #f4f4f5)" : e.total ? "var(--color-muted, #fafafa)" : e.header ? "var(--color-muted, #f9fafb)" : e.empty ? "transparent" : "var(--color-background, #ffffff)",
|
|
1046
|
+
color: e.empty ? "var(--color-muted-foreground, #a1a1aa)" : void 0,
|
|
1047
|
+
cursor: e.interactive ? "pointer" : void 0,
|
|
1048
|
+
whiteSpace: "nowrap"
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region src/JoinedReportRenderer.tsx
|
|
1053
|
+
function Re(e, t) {
|
|
1054
|
+
return e ? typeof e == "string" ? e : typeof e == "object" && typeof e.default == "string" ? e.default : t : t;
|
|
1055
|
+
}
|
|
1056
|
+
function ze(e, t) {
|
|
1057
|
+
if (!t || Object.keys(t).length === 0) return e;
|
|
1058
|
+
let n = K(t, e.filter);
|
|
1059
|
+
return {
|
|
1060
|
+
...e,
|
|
1061
|
+
filter: n
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
var Be = ({ report: e, dataSource: t, runtimeFilter: n, actionRunner: r, drillView: i, drillOpenIn: a, className: o, renderBlock: s }) => {
|
|
1065
|
+
if (!c(e)) return /* @__PURE__ */ A("div", {
|
|
1066
|
+
className: o,
|
|
1067
|
+
"data-testid": "joined-report-invalid",
|
|
1068
|
+
style: {
|
|
1069
|
+
color: "var(--color-destructive, #b91c1c)",
|
|
1070
|
+
fontSize: 13,
|
|
1071
|
+
padding: 12
|
|
1072
|
+
},
|
|
1073
|
+
children: [
|
|
1074
|
+
"JoinedReportRenderer requires a report with ",
|
|
1075
|
+
/* @__PURE__ */ k("code", { children: "type: 'joined'" }),
|
|
1076
|
+
" and a ",
|
|
1077
|
+
/* @__PURE__ */ k("code", { children: "blocks" }),
|
|
1078
|
+
" array."
|
|
1079
|
+
]
|
|
1080
|
+
});
|
|
1081
|
+
let l = e.blocks ?? [], u = e.filter, d = e.objectName;
|
|
1082
|
+
return /* @__PURE__ */ k("div", {
|
|
1083
|
+
className: o,
|
|
1084
|
+
"data-testid": "joined-report",
|
|
1085
|
+
"data-report-name": e.name,
|
|
1086
|
+
style: {
|
|
1087
|
+
display: "flex",
|
|
1088
|
+
flexDirection: "column",
|
|
1089
|
+
gap: 24
|
|
1090
|
+
},
|
|
1091
|
+
children: l.map((e, o) => {
|
|
1092
|
+
let c = e.objectName ?? d ?? "", l = ze({
|
|
1093
|
+
...e,
|
|
1094
|
+
objectName: c,
|
|
1095
|
+
type: e.type ?? "tabular",
|
|
1096
|
+
columns: e.columns ?? []
|
|
1097
|
+
}, u), f = Re(e.label, e.name), p = e.description ? Re(e.description, "") : "", m = e.name ?? `block-${o}`, h = /* @__PURE__ */ A("section", {
|
|
1098
|
+
"data-testid": "joined-report-block",
|
|
1099
|
+
"data-block-id": m,
|
|
1100
|
+
style: {
|
|
1101
|
+
display: "flex",
|
|
1102
|
+
flexDirection: "column",
|
|
1103
|
+
gap: 8,
|
|
1104
|
+
border: "1px solid var(--color-border, #e4e4e7)",
|
|
1105
|
+
borderRadius: 8,
|
|
1106
|
+
padding: 16,
|
|
1107
|
+
background: "var(--color-card, #ffffff)"
|
|
1108
|
+
},
|
|
1109
|
+
children: [/* @__PURE__ */ A("header", {
|
|
1110
|
+
style: {
|
|
1111
|
+
display: "flex",
|
|
1112
|
+
flexDirection: "column",
|
|
1113
|
+
gap: 2
|
|
1114
|
+
},
|
|
1115
|
+
children: [/* @__PURE__ */ k("h3", {
|
|
1116
|
+
style: {
|
|
1117
|
+
margin: 0,
|
|
1118
|
+
fontSize: 16,
|
|
1119
|
+
fontWeight: 600
|
|
1120
|
+
},
|
|
1121
|
+
children: f
|
|
1122
|
+
}), p ? /* @__PURE__ */ k("p", {
|
|
1123
|
+
style: {
|
|
1124
|
+
margin: 0,
|
|
1125
|
+
fontSize: 13,
|
|
1126
|
+
color: "var(--color-muted-foreground, #71717a)"
|
|
1127
|
+
},
|
|
1128
|
+
children: p
|
|
1129
|
+
}) : null]
|
|
1130
|
+
}), /* @__PURE__ */ k(X, {
|
|
1131
|
+
schema: l,
|
|
1132
|
+
dataSource: t,
|
|
1133
|
+
runtimeFilter: n,
|
|
1134
|
+
actionRunner: r,
|
|
1135
|
+
drillView: i,
|
|
1136
|
+
drillOpenIn: a
|
|
1137
|
+
})]
|
|
1138
|
+
}, m);
|
|
1139
|
+
return s ? s(e, o, h) : h;
|
|
1140
|
+
})
|
|
1141
|
+
});
|
|
1142
|
+
}, Ve = {
|
|
1143
|
+
border: "1px dashed var(--color-border, #d4d4d8)",
|
|
1144
|
+
borderRadius: 8,
|
|
1145
|
+
padding: 16,
|
|
1146
|
+
color: "var(--color-muted-foreground, #71717a)",
|
|
1147
|
+
background: "var(--color-muted, #f4f4f5)",
|
|
1148
|
+
fontSize: 13
|
|
1149
|
+
}, X = (e) => {
|
|
1150
|
+
let { dataSource: t, rows: n, runtimeFilter: r, actionRunner: i, drillView: a, drillOpenIn: o, className: s } = e, u = e.schema;
|
|
1151
|
+
if (u && typeof u == "object" && u.type === "spec-report" && u.report && typeof u.report == "object" && (u = u.report), l(u)) {
|
|
1152
|
+
let e = u.type ?? "tabular";
|
|
1153
|
+
return e === "matrix" ? /* @__PURE__ */ k(Le, {
|
|
1154
|
+
report: u,
|
|
1155
|
+
dataSource: t,
|
|
1156
|
+
rows: n,
|
|
1157
|
+
runtimeFilter: r,
|
|
1158
|
+
actionRunner: i,
|
|
1159
|
+
drillView: a,
|
|
1160
|
+
drillOpenIn: o,
|
|
1161
|
+
className: s
|
|
1162
|
+
}) : e === "joined" ? c(u) ? /* @__PURE__ */ k(Be, {
|
|
1163
|
+
report: u,
|
|
1164
|
+
dataSource: t,
|
|
1165
|
+
runtimeFilter: r,
|
|
1166
|
+
actionRunner: i,
|
|
1167
|
+
drillView: a,
|
|
1168
|
+
drillOpenIn: o,
|
|
1169
|
+
className: s
|
|
1170
|
+
}) : /* @__PURE__ */ A("div", {
|
|
1171
|
+
className: s,
|
|
1172
|
+
style: Ve,
|
|
1173
|
+
"data-testid": "report-joined-placeholder",
|
|
1174
|
+
children: [
|
|
1175
|
+
"Joined report (",
|
|
1176
|
+
/* @__PURE__ */ k("code", { children: u.name }),
|
|
1177
|
+
") is missing a ",
|
|
1178
|
+
/* @__PURE__ */ k("code", { children: "blocks" }),
|
|
1179
|
+
" array."
|
|
1180
|
+
]
|
|
1181
|
+
}) : /* @__PURE__ */ k(Me, {
|
|
1182
|
+
report: u,
|
|
1183
|
+
dataSource: t,
|
|
1184
|
+
rows: n,
|
|
1185
|
+
runtimeFilter: r,
|
|
1186
|
+
actionRunner: i,
|
|
1187
|
+
drillView: a,
|
|
1188
|
+
drillOpenIn: o,
|
|
1189
|
+
className: s
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
return /* @__PURE__ */ k(B, { schema: u });
|
|
1193
|
+
};
|
|
1194
|
+
//#endregion
|
|
64
1195
|
//#region src/ReportExportEngine.ts
|
|
65
|
-
function
|
|
1196
|
+
function He(e, t, n) {
|
|
66
1197
|
let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
|
|
67
1198
|
let n = e[t.name];
|
|
68
|
-
return n =
|
|
1199
|
+
return n = Je(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
69
1200
|
}));
|
|
70
|
-
|
|
1201
|
+
Q([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
|
|
71
1202
|
}
|
|
72
|
-
function
|
|
1203
|
+
function Ue(e, t, n) {
|
|
73
1204
|
let r = {
|
|
74
1205
|
title: e.title,
|
|
75
1206
|
description: e.description,
|
|
76
1207
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
77
1208
|
data: t
|
|
78
1209
|
};
|
|
79
|
-
|
|
1210
|
+
Q(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
|
|
80
1211
|
}
|
|
81
|
-
function
|
|
82
|
-
let r = e.fields || [], i =
|
|
83
|
-
|
|
1212
|
+
function We(e, t, n) {
|
|
1213
|
+
let r = e.fields || [], i = Xe(n?.orientation), a = Ye(n?.pageSize);
|
|
1214
|
+
Q(`<!DOCTYPE html>
|
|
84
1215
|
<html>
|
|
85
1216
|
<head>
|
|
86
1217
|
<meta charset="utf-8">
|
|
87
|
-
<title>${
|
|
1218
|
+
<title>${Z(e.title || "Report")}</title>
|
|
88
1219
|
<style>
|
|
89
1220
|
@page { size: ${a} ${i}; margin: 20mm; }
|
|
90
1221
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
@@ -98,20 +1229,20 @@ function B(e, t, n) {
|
|
|
98
1229
|
</style>
|
|
99
1230
|
</head>
|
|
100
1231
|
<body>
|
|
101
|
-
<h1>${
|
|
102
|
-
${e.description ? `<p class="description">${
|
|
1232
|
+
<h1>${Z(e.title || "Report")}</h1>
|
|
1233
|
+
${e.description ? `<p class="description">${Z(e.description)}</p>` : ""}
|
|
103
1234
|
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
104
1235
|
<table>
|
|
105
|
-
<thead><tr>${r.map((e) => `<th>${
|
|
106
|
-
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${
|
|
1236
|
+
<thead><tr>${r.map((e) => `<th>${Z(e.label || e.name)}</th>`).join("")}</tr></thead>
|
|
1237
|
+
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${Z(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
107
1238
|
</table>
|
|
108
1239
|
</body>
|
|
109
1240
|
</html>`, n?.filename || `${e.title || "report"}.html`, "text/html");
|
|
110
1241
|
}
|
|
111
|
-
function
|
|
112
|
-
let r = e.fields || [], i =
|
|
1242
|
+
function Ge(e, t, n) {
|
|
1243
|
+
let r = e.fields || [], i = Xe(n?.orientation), a = Ye(n?.pageSize), o = window.open("", "_blank");
|
|
113
1244
|
if (!o) {
|
|
114
|
-
|
|
1245
|
+
We(e, t, {
|
|
115
1246
|
...n,
|
|
116
1247
|
format: "html",
|
|
117
1248
|
filename: n?.filename?.replace(/\.pdf$/, ".html") || `${e.title || "report"}.html`
|
|
@@ -122,7 +1253,7 @@ function V(e, t, n) {
|
|
|
122
1253
|
<html>
|
|
123
1254
|
<head>
|
|
124
1255
|
<meta charset="utf-8">
|
|
125
|
-
<title>${
|
|
1256
|
+
<title>${Z(e.title || "Report")}</title>
|
|
126
1257
|
<style>
|
|
127
1258
|
@page { size: ${a} ${i}; margin: 20mm; }
|
|
128
1259
|
@media print { .no-print { display: none; } }
|
|
@@ -137,56 +1268,56 @@ function V(e, t, n) {
|
|
|
137
1268
|
</style>
|
|
138
1269
|
</head>
|
|
139
1270
|
<body>
|
|
140
|
-
<h1>${
|
|
141
|
-
${e.description ? `<p class="description">${
|
|
1271
|
+
<h1>${Z(e.title || "Report")}</h1>
|
|
1272
|
+
${e.description ? `<p class="description">${Z(e.description)}</p>` : ""}
|
|
142
1273
|
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
143
1274
|
<table>
|
|
144
|
-
<thead><tr>${r.map((e) => `<th>${
|
|
145
|
-
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${
|
|
1275
|
+
<thead><tr>${r.map((e) => `<th>${Z(e.label || e.name)}</th>`).join("")}</tr></thead>
|
|
1276
|
+
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${Z(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
146
1277
|
</table>
|
|
147
1278
|
</body>
|
|
148
1279
|
</html>`), o.document.close(), o.onload = () => {
|
|
149
1280
|
o.print();
|
|
150
1281
|
};
|
|
151
1282
|
}
|
|
152
|
-
function
|
|
1283
|
+
function Ke(e, t, n) {
|
|
153
1284
|
let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
|
|
154
1285
|
let n = e[t.name];
|
|
155
|
-
return n =
|
|
1286
|
+
return n = Je(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
156
1287
|
}));
|
|
157
|
-
|
|
1288
|
+
Q("" + [...n?.includeHeaders === !1 ? [] : [i.join(" ")], ...a.map((e) => e.join(" "))].join("\n"), n?.filename || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
158
1289
|
}
|
|
159
|
-
function
|
|
1290
|
+
function qe(e, t, n, r) {
|
|
160
1291
|
switch (e) {
|
|
161
1292
|
case "csv":
|
|
162
|
-
|
|
1293
|
+
He(t, n, r);
|
|
163
1294
|
break;
|
|
164
1295
|
case "json":
|
|
165
|
-
|
|
1296
|
+
Ue(t, n, r);
|
|
166
1297
|
break;
|
|
167
1298
|
case "html":
|
|
168
|
-
|
|
1299
|
+
We(t, n, r);
|
|
169
1300
|
break;
|
|
170
1301
|
case "pdf":
|
|
171
|
-
|
|
1302
|
+
Ge(t, n, r);
|
|
172
1303
|
break;
|
|
173
1304
|
case "excel":
|
|
174
|
-
|
|
1305
|
+
Ke(t, n, r);
|
|
175
1306
|
break;
|
|
176
1307
|
default: console.warn(`Unsupported export format: ${e}`);
|
|
177
1308
|
}
|
|
178
1309
|
}
|
|
179
|
-
function
|
|
1310
|
+
function Z(e) {
|
|
180
1311
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
181
1312
|
}
|
|
182
|
-
function
|
|
1313
|
+
function Je(e) {
|
|
183
1314
|
if (typeof e == "string" && e.length > 0) {
|
|
184
1315
|
let t = e.charAt(0);
|
|
185
1316
|
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `\t${e}`;
|
|
186
1317
|
}
|
|
187
1318
|
return e;
|
|
188
1319
|
}
|
|
189
|
-
function
|
|
1320
|
+
function Ye(e) {
|
|
190
1321
|
return [
|
|
191
1322
|
"A4",
|
|
192
1323
|
"A3",
|
|
@@ -194,19 +1325,19 @@ function K(e) {
|
|
|
194
1325
|
"Legal"
|
|
195
1326
|
].includes(e || "") ? e : "A4";
|
|
196
1327
|
}
|
|
197
|
-
function
|
|
1328
|
+
function Xe(e) {
|
|
198
1329
|
return e === "landscape" ? "landscape" : "portrait";
|
|
199
1330
|
}
|
|
200
|
-
function
|
|
1331
|
+
function Q(e, t, n) {
|
|
201
1332
|
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
202
1333
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
203
1334
|
}
|
|
204
1335
|
//#endregion
|
|
205
1336
|
//#region src/formatValue.ts
|
|
206
|
-
function
|
|
1337
|
+
function $(e, t) {
|
|
207
1338
|
if (e == null || e === "") return "";
|
|
208
1339
|
let n = t?.type, r = t?.format;
|
|
209
|
-
if (n === "date" || r === "date" ||
|
|
1340
|
+
if (n === "date" || r === "date" || Ze(e)) return Qe(e);
|
|
210
1341
|
if (n === "number" || typeof e == "number") {
|
|
211
1342
|
let t = typeof e == "number" ? e : Number(e);
|
|
212
1343
|
return isNaN(t) ? String(e) : r === "currency" || r === "currency_cny" ? `¥${t.toLocaleString("en-US", {
|
|
@@ -222,10 +1353,10 @@ function Y(e, t) {
|
|
|
222
1353
|
}
|
|
223
1354
|
return String(e);
|
|
224
1355
|
}
|
|
225
|
-
function
|
|
1356
|
+
function Ze(e) {
|
|
226
1357
|
return typeof e == "string" ? /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e) : !1;
|
|
227
1358
|
}
|
|
228
|
-
function
|
|
1359
|
+
function Qe(e) {
|
|
229
1360
|
try {
|
|
230
1361
|
let t = new Date(e);
|
|
231
1362
|
return isNaN(t.getTime()) ? String(e) : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
|
|
@@ -235,7 +1366,7 @@ function ie(e) {
|
|
|
235
1366
|
}
|
|
236
1367
|
//#endregion
|
|
237
1368
|
//#region src/ReportViewer.tsx
|
|
238
|
-
function
|
|
1369
|
+
function $e(e, t) {
|
|
239
1370
|
if (!t || t.length === 0 || !e || e.length === 0) return null;
|
|
240
1371
|
let n = t[0], r = n.field, i = /* @__PURE__ */ new Map();
|
|
241
1372
|
for (let t of e) {
|
|
@@ -251,22 +1382,22 @@ function ae(e, t) {
|
|
|
251
1382
|
let o = n.sort === "desc" ? -1 : 1;
|
|
252
1383
|
return a.sort((e, t) => e.key.localeCompare(t.key) * o), a;
|
|
253
1384
|
}
|
|
254
|
-
var
|
|
255
|
-
let { report:
|
|
256
|
-
if (!
|
|
1385
|
+
var et = ({ schema: t, onRefresh: r }) => {
|
|
1386
|
+
let { report: i, data: a, showToolbar: o = !0, allowExport: s = !0, allowPrint: c = !0, loading: l = !1 } = t, _ = (e) => {
|
|
1387
|
+
if (!i) {
|
|
257
1388
|
console.warn("ReportViewer: Cannot export, no report defined");
|
|
258
1389
|
return;
|
|
259
1390
|
}
|
|
260
|
-
|
|
261
|
-
},
|
|
1391
|
+
qe(e, i, a || [], i.exportConfigs?.[e]);
|
|
1392
|
+
}, v = () => {
|
|
262
1393
|
window.print();
|
|
263
|
-
},
|
|
1394
|
+
}, y = () => {
|
|
264
1395
|
r?.();
|
|
265
|
-
},
|
|
266
|
-
if (!
|
|
267
|
-
let n =
|
|
1396
|
+
}, b = (e, t) => {
|
|
1397
|
+
if (!a) return 0;
|
|
1398
|
+
let n = a.map((t) => Number(t[e]) || 0);
|
|
268
1399
|
switch (t) {
|
|
269
|
-
case "count": return
|
|
1400
|
+
case "count": return a.length;
|
|
270
1401
|
case "sum": return n.reduce((e, t) => e + t, 0);
|
|
271
1402
|
case "avg": return n.length > 0 ? (n.reduce((e, t) => e + t, 0) / n.length).toFixed(2) : 0;
|
|
272
1403
|
case "min": return n.length > 0 ? Math.min(...n) : 0;
|
|
@@ -274,7 +1405,7 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
274
1405
|
default: return "";
|
|
275
1406
|
}
|
|
276
1407
|
}, S = (e, t) => {
|
|
277
|
-
let n =
|
|
1408
|
+
let n = i?.conditionalFormatting;
|
|
278
1409
|
if (!(!n || !Array.isArray(n))) for (let r of n) {
|
|
279
1410
|
if (r.field !== e) continue;
|
|
280
1411
|
let n = String(t ?? ""), i = String(r.value ?? ""), a = !1;
|
|
@@ -300,127 +1431,127 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
300
1431
|
return r.backgroundColor && (e.backgroundColor = r.backgroundColor), r.textColor && (e.color = r.textColor), e;
|
|
301
1432
|
}
|
|
302
1433
|
}
|
|
303
|
-
},
|
|
1434
|
+
}, C = (e, t) => {
|
|
304
1435
|
if (e == null || e === "") return "";
|
|
305
|
-
if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) return /* @__PURE__ */
|
|
1436
|
+
if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) return /* @__PURE__ */ k(u, {
|
|
306
1437
|
className: t.colorMap?.[String(e)] || "",
|
|
307
1438
|
children: String(e)
|
|
308
1439
|
});
|
|
309
|
-
if (t.aggregation) return
|
|
1440
|
+
if (t.aggregation) return $(e, t);
|
|
310
1441
|
if (t.type) {
|
|
311
1442
|
let n = { ...t };
|
|
312
1443
|
return t.colorMap && !n.options && (n.options = Object.entries(t.colorMap).map(([e, t]) => ({
|
|
313
1444
|
value: e,
|
|
314
1445
|
label: e,
|
|
315
1446
|
color: t
|
|
316
|
-
}))), /* @__PURE__ */
|
|
1447
|
+
}))), /* @__PURE__ */ k(se(ce(n)), {
|
|
317
1448
|
value: e,
|
|
318
1449
|
field: n
|
|
319
1450
|
});
|
|
320
1451
|
}
|
|
321
|
-
return
|
|
1452
|
+
return $(e, t);
|
|
322
1453
|
};
|
|
323
|
-
return
|
|
1454
|
+
return i ? /* @__PURE__ */ A("div", {
|
|
324
1455
|
className: "space-y-4",
|
|
325
|
-
children: [
|
|
1456
|
+
children: [o && /* @__PURE__ */ A("div", {
|
|
326
1457
|
className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",
|
|
327
|
-
children: [/* @__PURE__ */
|
|
1458
|
+
children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h2", {
|
|
328
1459
|
className: "text-lg font-semibold",
|
|
329
|
-
children:
|
|
330
|
-
}),
|
|
1460
|
+
children: i.title
|
|
1461
|
+
}), i.description && /* @__PURE__ */ k("p", {
|
|
331
1462
|
className: "text-sm text-muted-foreground",
|
|
332
|
-
children:
|
|
333
|
-
})] }), /* @__PURE__ */
|
|
1463
|
+
children: i.description
|
|
1464
|
+
})] }), /* @__PURE__ */ A("div", {
|
|
334
1465
|
className: "flex items-center gap-2",
|
|
335
1466
|
children: [
|
|
336
|
-
|
|
1467
|
+
i.refreshInterval && /* @__PURE__ */ A(d, {
|
|
337
1468
|
variant: "outline",
|
|
338
1469
|
size: "sm",
|
|
339
|
-
onClick:
|
|
340
|
-
children: [/* @__PURE__ */
|
|
1470
|
+
onClick: y,
|
|
1471
|
+
children: [/* @__PURE__ */ k(ie, { className: "h-4 w-4 mr-2" }), "Refresh"]
|
|
341
1472
|
}),
|
|
342
|
-
|
|
1473
|
+
c && /* @__PURE__ */ A(d, {
|
|
343
1474
|
variant: "outline",
|
|
344
1475
|
size: "sm",
|
|
345
|
-
onClick:
|
|
346
|
-
children: [/* @__PURE__ */
|
|
1476
|
+
onClick: v,
|
|
1477
|
+
children: [/* @__PURE__ */ k(R, { className: "h-4 w-4 mr-2" }), "Print"]
|
|
347
1478
|
}),
|
|
348
|
-
|
|
1479
|
+
s && i.showExportButtons && /* @__PURE__ */ A("div", {
|
|
349
1480
|
className: "flex items-center gap-1",
|
|
350
1481
|
children: [
|
|
351
|
-
/* @__PURE__ */
|
|
1482
|
+
/* @__PURE__ */ A(d, {
|
|
352
1483
|
variant: "outline",
|
|
353
1484
|
size: "sm",
|
|
354
|
-
onClick: () =>
|
|
355
|
-
children: [/* @__PURE__ */
|
|
1485
|
+
onClick: () => _("pdf"),
|
|
1486
|
+
children: [/* @__PURE__ */ k(I, { className: "h-4 w-4 mr-2" }), "PDF"]
|
|
356
1487
|
}),
|
|
357
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ A(d, {
|
|
358
1489
|
variant: "outline",
|
|
359
1490
|
size: "sm",
|
|
360
|
-
onClick: () =>
|
|
361
|
-
children: [/* @__PURE__ */
|
|
1491
|
+
onClick: () => _("excel"),
|
|
1492
|
+
children: [/* @__PURE__ */ k(I, { className: "h-4 w-4 mr-2" }), "Excel"]
|
|
362
1493
|
}),
|
|
363
|
-
/* @__PURE__ */
|
|
1494
|
+
/* @__PURE__ */ A(d, {
|
|
364
1495
|
variant: "outline",
|
|
365
1496
|
size: "sm",
|
|
366
|
-
onClick: () =>
|
|
367
|
-
children: [/* @__PURE__ */
|
|
1497
|
+
onClick: () => _("csv"),
|
|
1498
|
+
children: [/* @__PURE__ */ k(I, { className: "h-4 w-4 mr-2" }), "CSV"]
|
|
368
1499
|
})
|
|
369
1500
|
]
|
|
370
1501
|
})
|
|
371
1502
|
]
|
|
372
1503
|
})]
|
|
373
|
-
}), /* @__PURE__ */
|
|
1504
|
+
}), /* @__PURE__ */ A(f, { children: [/* @__PURE__ */ A(h, { children: [!o && i.title && /* @__PURE__ */ k(g, { children: i.title }), !o && i.description && /* @__PURE__ */ k(m, { children: i.description })] }), /* @__PURE__ */ A(p, {
|
|
374
1505
|
className: "space-y-6",
|
|
375
1506
|
children: [
|
|
376
|
-
|
|
1507
|
+
l && /* @__PURE__ */ A("div", {
|
|
377
1508
|
className: "space-y-6",
|
|
378
|
-
children: [/* @__PURE__ */
|
|
1509
|
+
children: [/* @__PURE__ */ k("div", {
|
|
379
1510
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
380
1511
|
children: [
|
|
381
1512
|
1,
|
|
382
1513
|
2,
|
|
383
1514
|
3
|
|
384
|
-
].map((e) => /* @__PURE__ */
|
|
1515
|
+
].map((e) => /* @__PURE__ */ k(f, { children: /* @__PURE__ */ A(p, {
|
|
385
1516
|
className: "p-4 space-y-2",
|
|
386
|
-
children: [/* @__PURE__ */
|
|
1517
|
+
children: [/* @__PURE__ */ k(x, { className: "h-4 w-20" }), /* @__PURE__ */ k(x, { className: "h-8 w-28" })]
|
|
387
1518
|
}) }, e))
|
|
388
|
-
}), /* @__PURE__ */
|
|
1519
|
+
}), /* @__PURE__ */ A("div", {
|
|
389
1520
|
className: "space-y-2",
|
|
390
|
-
children: [/* @__PURE__ */
|
|
1521
|
+
children: [/* @__PURE__ */ k(x, { className: "h-10 w-full" }), [
|
|
391
1522
|
1,
|
|
392
1523
|
2,
|
|
393
1524
|
3,
|
|
394
1525
|
4,
|
|
395
1526
|
5
|
|
396
|
-
].map((e) => /* @__PURE__ */
|
|
1527
|
+
].map((e) => /* @__PURE__ */ k(x, { className: "h-8 w-full" }, e))]
|
|
397
1528
|
})]
|
|
398
1529
|
}),
|
|
399
|
-
!
|
|
1530
|
+
!l && i.sections?.map((t, r) => t.visible === !1 ? null : /* @__PURE__ */ A("div", {
|
|
400
1531
|
className: "space-y-2",
|
|
401
1532
|
children: [
|
|
402
|
-
t.title && t.type !== "header" && /* @__PURE__ */
|
|
1533
|
+
t.title && t.type !== "header" && /* @__PURE__ */ k("h3", {
|
|
403
1534
|
className: "text-lg font-semibold border-b pb-2",
|
|
404
1535
|
children: t.title
|
|
405
1536
|
}),
|
|
406
|
-
t.type === "header" && t.title && /* @__PURE__ */
|
|
1537
|
+
t.type === "header" && t.title && /* @__PURE__ */ k("div", {
|
|
407
1538
|
className: "text-2xl font-bold py-4",
|
|
408
1539
|
children: t.title
|
|
409
1540
|
}),
|
|
410
|
-
t.type === "summary" && /* @__PURE__ */
|
|
1541
|
+
t.type === "summary" && /* @__PURE__ */ k("div", {
|
|
411
1542
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
412
|
-
children:
|
|
1543
|
+
children: i.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ k(f, { children: /* @__PURE__ */ A(p, {
|
|
413
1544
|
className: "p-4",
|
|
414
|
-
children: [/* @__PURE__ */
|
|
1545
|
+
children: [/* @__PURE__ */ k("div", {
|
|
415
1546
|
className: "text-sm text-muted-foreground",
|
|
416
1547
|
children: e.label || e.name
|
|
417
|
-
}), /* @__PURE__ */
|
|
1548
|
+
}), /* @__PURE__ */ k("div", {
|
|
418
1549
|
className: "text-2xl font-bold",
|
|
419
|
-
children:
|
|
1550
|
+
children: $(b(e.name, e.aggregation), e)
|
|
420
1551
|
})]
|
|
421
1552
|
}) }, t))
|
|
422
1553
|
}),
|
|
423
|
-
t.type === "chart" && t.chart && /* @__PURE__ */
|
|
1554
|
+
t.type === "chart" && t.chart && /* @__PURE__ */ k("div", {
|
|
424
1555
|
className: "min-h-[300px]",
|
|
425
1556
|
children: (() => {
|
|
426
1557
|
let n = t.chart.type, r = !!t.chart.chartType;
|
|
@@ -430,30 +1561,30 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
430
1561
|
series: t.chart.series || (t.chart.yAxisFields ? t.chart.yAxisFields.map((e) => ({ dataKey: e })) : []),
|
|
431
1562
|
chartType: t.chart.chartType || "bar"
|
|
432
1563
|
} : {};
|
|
433
|
-
return /* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ k(N, { schema: {
|
|
434
1565
|
...t.chart,
|
|
435
1566
|
type: n,
|
|
436
1567
|
...i,
|
|
437
|
-
data:
|
|
1568
|
+
data: a || t.chart.data,
|
|
438
1569
|
className: t.chart.className || "w-full h-[350px]"
|
|
439
1570
|
} });
|
|
440
1571
|
})()
|
|
441
1572
|
}),
|
|
442
|
-
t.type === "table" && /* @__PURE__ */
|
|
1573
|
+
t.type === "table" && /* @__PURE__ */ k("div", {
|
|
443
1574
|
className: "border rounded-lg overflow-x-auto",
|
|
444
|
-
children: /* @__PURE__ */
|
|
1575
|
+
children: /* @__PURE__ */ A("table", {
|
|
445
1576
|
className: "w-full text-sm min-w-[600px]",
|
|
446
|
-
children: [/* @__PURE__ */
|
|
1577
|
+
children: [/* @__PURE__ */ k("thead", {
|
|
447
1578
|
className: "bg-muted",
|
|
448
|
-
children: /* @__PURE__ */
|
|
1579
|
+
children: /* @__PURE__ */ k("tr", { children: t.columns?.map((e, t) => /* @__PURE__ */ k("th", {
|
|
449
1580
|
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
450
1581
|
children: e.label || e.name
|
|
451
1582
|
}, t)) })
|
|
452
|
-
}), /* @__PURE__ */
|
|
453
|
-
let e =
|
|
454
|
-
return e ? e.map((e) => /* @__PURE__ */
|
|
1583
|
+
}), /* @__PURE__ */ k("tbody", { children: (() => {
|
|
1584
|
+
let e = $e(a || [], i.groupBy || []);
|
|
1585
|
+
return e ? e.map((e) => /* @__PURE__ */ A(n.Fragment, { children: [/* @__PURE__ */ k("tr", {
|
|
455
1586
|
className: "bg-muted/60",
|
|
456
|
-
children: /* @__PURE__ */
|
|
1587
|
+
children: /* @__PURE__ */ A("td", {
|
|
457
1588
|
colSpan: t.columns?.length || 1,
|
|
458
1589
|
className: "px-4 py-2 font-semibold text-sm",
|
|
459
1590
|
children: [
|
|
@@ -463,97 +1594,97 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
463
1594
|
")"
|
|
464
1595
|
]
|
|
465
1596
|
})
|
|
466
|
-
}), e.rows.map((e, n) => /* @__PURE__ */
|
|
1597
|
+
}), e.rows.map((e, n) => /* @__PURE__ */ k("tr", {
|
|
467
1598
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
468
|
-
children: t.columns?.map((t, n) => /* @__PURE__ */
|
|
1599
|
+
children: t.columns?.map((t, n) => /* @__PURE__ */ k("td", {
|
|
469
1600
|
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
470
1601
|
style: S(t.name, e[t.name]),
|
|
471
|
-
children:
|
|
1602
|
+
children: C(e[t.name], t)
|
|
472
1603
|
}, n))
|
|
473
|
-
}, n))] }, e.key)) :
|
|
1604
|
+
}, n))] }, e.key)) : a?.map((e, n) => /* @__PURE__ */ k("tr", {
|
|
474
1605
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
475
|
-
children: t.columns?.map((t, n) => /* @__PURE__ */
|
|
1606
|
+
children: t.columns?.map((t, n) => /* @__PURE__ */ k("td", {
|
|
476
1607
|
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
477
1608
|
style: S(t.name, e[t.name]),
|
|
478
|
-
children:
|
|
1609
|
+
children: C(e[t.name], t)
|
|
479
1610
|
}, n))
|
|
480
1611
|
}, n));
|
|
481
1612
|
})() })]
|
|
482
1613
|
})
|
|
483
1614
|
}),
|
|
484
|
-
t.type === "text" && t.text && /* @__PURE__ */
|
|
1615
|
+
t.type === "text" && t.text && /* @__PURE__ */ k("div", {
|
|
485
1616
|
className: "prose max-w-none",
|
|
486
|
-
children: /* @__PURE__ */
|
|
1617
|
+
children: /* @__PURE__ */ k("p", { children: t.text })
|
|
487
1618
|
}),
|
|
488
|
-
t.type === "page-break" && /* @__PURE__ */
|
|
489
|
-
t.content && /* @__PURE__ */
|
|
1619
|
+
t.type === "page-break" && /* @__PURE__ */ k("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
|
|
1620
|
+
t.content && /* @__PURE__ */ k(N, { schema: t.content })
|
|
490
1621
|
]
|
|
491
1622
|
}, r)),
|
|
492
|
-
!
|
|
1623
|
+
!i.sections && a && a.length > 0 && /* @__PURE__ */ k("div", {
|
|
493
1624
|
className: "border rounded-lg overflow-x-auto",
|
|
494
|
-
children: /* @__PURE__ */
|
|
1625
|
+
children: /* @__PURE__ */ A("table", {
|
|
495
1626
|
className: "w-full text-sm min-w-[600px]",
|
|
496
|
-
children: [/* @__PURE__ */
|
|
1627
|
+
children: [/* @__PURE__ */ k("thead", {
|
|
497
1628
|
className: "bg-muted",
|
|
498
|
-
children: /* @__PURE__ */
|
|
1629
|
+
children: /* @__PURE__ */ k("tr", { children: i.fields?.map((e, t) => /* @__PURE__ */ k("th", {
|
|
499
1630
|
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
500
1631
|
children: e.label || e.name
|
|
501
1632
|
}, t)) })
|
|
502
|
-
}), /* @__PURE__ */
|
|
1633
|
+
}), /* @__PURE__ */ k("tbody", { children: a.map((e, t) => /* @__PURE__ */ k("tr", {
|
|
503
1634
|
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
504
|
-
children:
|
|
1635
|
+
children: i.fields?.map((t, n) => /* @__PURE__ */ k("td", {
|
|
505
1636
|
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
506
1637
|
style: S(t.name, e[t.name]),
|
|
507
|
-
children:
|
|
1638
|
+
children: C(e[t.name], t)
|
|
508
1639
|
}, n))
|
|
509
1640
|
}, t)) })]
|
|
510
1641
|
})
|
|
511
1642
|
})
|
|
512
1643
|
]
|
|
513
1644
|
})] })]
|
|
514
|
-
}) : /* @__PURE__ */
|
|
1645
|
+
}) : /* @__PURE__ */ k(f, { children: /* @__PURE__ */ k(p, {
|
|
515
1646
|
className: "p-8 text-center text-muted-foreground",
|
|
516
1647
|
children: "No report to display"
|
|
517
1648
|
}) });
|
|
518
|
-
},
|
|
519
|
-
let [n,
|
|
1649
|
+
}, tt = ({ schedule: e, onChange: t }) => {
|
|
1650
|
+
let [n, r] = s(e || {
|
|
520
1651
|
enabled: !1,
|
|
521
1652
|
frequency: "weekly",
|
|
522
1653
|
time: "09:00",
|
|
523
1654
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
524
1655
|
recipients: [],
|
|
525
1656
|
formats: ["pdf"]
|
|
526
|
-
}),
|
|
527
|
-
let
|
|
1657
|
+
}), i = (e) => {
|
|
1658
|
+
let i = {
|
|
528
1659
|
...n,
|
|
529
1660
|
...e
|
|
530
1661
|
};
|
|
531
|
-
i
|
|
1662
|
+
r(i), t?.(i);
|
|
532
1663
|
};
|
|
533
|
-
return /* @__PURE__ */
|
|
1664
|
+
return /* @__PURE__ */ A(f, { children: [/* @__PURE__ */ k(h, { children: /* @__PURE__ */ A(g, {
|
|
534
1665
|
className: "flex items-center gap-2",
|
|
535
|
-
children: [/* @__PURE__ */
|
|
536
|
-
}) }), /* @__PURE__ */
|
|
1666
|
+
children: [/* @__PURE__ */ k(P, { className: "h-5 w-5" }), "Schedule Configuration"]
|
|
1667
|
+
}) }), /* @__PURE__ */ A(p, {
|
|
537
1668
|
className: "space-y-4",
|
|
538
|
-
children: [/* @__PURE__ */
|
|
1669
|
+
children: [/* @__PURE__ */ A("div", {
|
|
539
1670
|
className: "flex items-center gap-2",
|
|
540
|
-
children: [/* @__PURE__ */
|
|
1671
|
+
children: [/* @__PURE__ */ k("input", {
|
|
541
1672
|
type: "checkbox",
|
|
542
1673
|
id: "schedule-enabled",
|
|
543
1674
|
checked: n.enabled || !1,
|
|
544
|
-
onChange: (e) =>
|
|
1675
|
+
onChange: (e) => i({ enabled: e.target.checked }),
|
|
545
1676
|
className: "rounded"
|
|
546
|
-
}), /* @__PURE__ */
|
|
1677
|
+
}), /* @__PURE__ */ k(b, {
|
|
547
1678
|
htmlFor: "schedule-enabled",
|
|
548
1679
|
children: "Enable Scheduled Report"
|
|
549
1680
|
})]
|
|
550
|
-
}), n.enabled && /* @__PURE__ */
|
|
551
|
-
/* @__PURE__ */
|
|
1681
|
+
}), n.enabled && /* @__PURE__ */ A(O, { children: [
|
|
1682
|
+
/* @__PURE__ */ A("div", {
|
|
552
1683
|
className: "space-y-2",
|
|
553
|
-
children: [/* @__PURE__ */
|
|
1684
|
+
children: [/* @__PURE__ */ k(b, { children: "Frequency" }), /* @__PURE__ */ k("select", {
|
|
554
1685
|
className: "w-full border rounded-md p-2 bg-background",
|
|
555
1686
|
value: n.frequency || "weekly",
|
|
556
|
-
onChange: (e) =>
|
|
1687
|
+
onChange: (e) => i({ frequency: e.target.value }),
|
|
557
1688
|
children: [
|
|
558
1689
|
{
|
|
559
1690
|
value: "once",
|
|
@@ -579,18 +1710,18 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
579
1710
|
value: "yearly",
|
|
580
1711
|
label: "Yearly"
|
|
581
1712
|
}
|
|
582
|
-
].map((e) => /* @__PURE__ */
|
|
1713
|
+
].map((e) => /* @__PURE__ */ k("option", {
|
|
583
1714
|
value: e.value,
|
|
584
1715
|
children: e.label
|
|
585
1716
|
}, e.value))
|
|
586
1717
|
})]
|
|
587
1718
|
}),
|
|
588
|
-
n.frequency === "weekly" && /* @__PURE__ */
|
|
1719
|
+
n.frequency === "weekly" && /* @__PURE__ */ A("div", {
|
|
589
1720
|
className: "space-y-2",
|
|
590
|
-
children: [/* @__PURE__ */
|
|
1721
|
+
children: [/* @__PURE__ */ k(b, { children: "Day of Week" }), /* @__PURE__ */ k("select", {
|
|
591
1722
|
className: "w-full border rounded-md p-2 bg-background",
|
|
592
1723
|
value: n.dayOfWeek ?? 1,
|
|
593
|
-
onChange: (e) =>
|
|
1724
|
+
onChange: (e) => i({ dayOfWeek: Number(e.target.value) }),
|
|
594
1725
|
children: [
|
|
595
1726
|
{
|
|
596
1727
|
value: 0,
|
|
@@ -620,44 +1751,44 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
620
1751
|
value: 6,
|
|
621
1752
|
label: "Saturday"
|
|
622
1753
|
}
|
|
623
|
-
].map((e) => /* @__PURE__ */
|
|
1754
|
+
].map((e) => /* @__PURE__ */ k("option", {
|
|
624
1755
|
value: e.value,
|
|
625
1756
|
children: e.label
|
|
626
1757
|
}, e.value))
|
|
627
1758
|
})]
|
|
628
1759
|
}),
|
|
629
|
-
n.frequency === "monthly" && /* @__PURE__ */
|
|
1760
|
+
n.frequency === "monthly" && /* @__PURE__ */ A("div", {
|
|
630
1761
|
className: "space-y-2",
|
|
631
|
-
children: [/* @__PURE__ */
|
|
1762
|
+
children: [/* @__PURE__ */ k(b, { children: "Day of Month" }), /* @__PURE__ */ k(y, {
|
|
632
1763
|
type: "number",
|
|
633
1764
|
min: 1,
|
|
634
1765
|
max: 31,
|
|
635
1766
|
value: n.dayOfMonth ?? 1,
|
|
636
|
-
onChange: (e) =>
|
|
1767
|
+
onChange: (e) => i({ dayOfMonth: Number(e.target.value) })
|
|
637
1768
|
})]
|
|
638
1769
|
}),
|
|
639
|
-
/* @__PURE__ */
|
|
1770
|
+
/* @__PURE__ */ A("div", {
|
|
640
1771
|
className: "space-y-2",
|
|
641
|
-
children: [/* @__PURE__ */
|
|
1772
|
+
children: [/* @__PURE__ */ A(b, {
|
|
642
1773
|
className: "flex items-center gap-2",
|
|
643
|
-
children: [/* @__PURE__ */
|
|
644
|
-
}), /* @__PURE__ */
|
|
1774
|
+
children: [/* @__PURE__ */ k(F, { className: "h-4 w-4" }), "Time"]
|
|
1775
|
+
}), /* @__PURE__ */ k(y, {
|
|
645
1776
|
type: "time",
|
|
646
1777
|
value: n.time || "09:00",
|
|
647
|
-
onChange: (e) =>
|
|
1778
|
+
onChange: (e) => i({ time: e.target.value })
|
|
648
1779
|
})]
|
|
649
1780
|
}),
|
|
650
|
-
/* @__PURE__ */
|
|
1781
|
+
/* @__PURE__ */ A("div", {
|
|
651
1782
|
className: "space-y-2",
|
|
652
|
-
children: [/* @__PURE__ */
|
|
1783
|
+
children: [/* @__PURE__ */ k(b, { children: "Timezone" }), /* @__PURE__ */ k(y, {
|
|
653
1784
|
value: n.timezone || "",
|
|
654
|
-
onChange: (e) =>
|
|
1785
|
+
onChange: (e) => i({ timezone: e.target.value }),
|
|
655
1786
|
placeholder: "e.g. America/New_York"
|
|
656
1787
|
})]
|
|
657
1788
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ A("div", {
|
|
659
1790
|
className: "space-y-2",
|
|
660
|
-
children: [/* @__PURE__ */
|
|
1791
|
+
children: [/* @__PURE__ */ k(b, { children: "Export Formats" }), /* @__PURE__ */ k("div", {
|
|
661
1792
|
className: "flex flex-wrap gap-2",
|
|
662
1793
|
children: [
|
|
663
1794
|
{
|
|
@@ -676,46 +1807,46 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
676
1807
|
value: "html",
|
|
677
1808
|
label: "HTML"
|
|
678
1809
|
}
|
|
679
|
-
].map((e) => /* @__PURE__ */
|
|
1810
|
+
].map((e) => /* @__PURE__ */ A("label", {
|
|
680
1811
|
className: "flex items-center gap-1.5 px-3 py-1.5 border rounded-md cursor-pointer hover:bg-muted/50",
|
|
681
|
-
children: [/* @__PURE__ */
|
|
1812
|
+
children: [/* @__PURE__ */ k("input", {
|
|
682
1813
|
type: "checkbox",
|
|
683
1814
|
checked: n.formats?.includes(e.value) || !1,
|
|
684
1815
|
onChange: (t) => {
|
|
685
1816
|
let r = n.formats || [];
|
|
686
|
-
|
|
1817
|
+
i({ formats: t.target.checked ? [...r, e.value] : r.filter((t) => t !== e.value) });
|
|
687
1818
|
},
|
|
688
1819
|
className: "rounded"
|
|
689
|
-
}), /* @__PURE__ */
|
|
1820
|
+
}), /* @__PURE__ */ k("span", {
|
|
690
1821
|
className: "text-sm",
|
|
691
1822
|
children: e.label
|
|
692
1823
|
})]
|
|
693
1824
|
}, e.value))
|
|
694
1825
|
})]
|
|
695
1826
|
}),
|
|
696
|
-
/* @__PURE__ */
|
|
1827
|
+
/* @__PURE__ */ A("div", {
|
|
697
1828
|
className: "space-y-2",
|
|
698
|
-
children: [/* @__PURE__ */
|
|
1829
|
+
children: [/* @__PURE__ */ A(b, {
|
|
699
1830
|
className: "flex items-center gap-2",
|
|
700
|
-
children: [/* @__PURE__ */
|
|
701
|
-
}), /* @__PURE__ */
|
|
1831
|
+
children: [/* @__PURE__ */ k(re, { className: "h-4 w-4" }), "Email Recipients"]
|
|
1832
|
+
}), /* @__PURE__ */ k(y, {
|
|
702
1833
|
placeholder: "email1@example.com, email2@example.com",
|
|
703
1834
|
value: n.recipients?.join(", ") || "",
|
|
704
|
-
onChange: (e) =>
|
|
1835
|
+
onChange: (e) => i({ recipients: e.target.value.split(",").map((e) => e.trim()).filter(Boolean) })
|
|
705
1836
|
})]
|
|
706
1837
|
}),
|
|
707
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ A("div", {
|
|
708
1839
|
className: "space-y-2",
|
|
709
|
-
children: [/* @__PURE__ */
|
|
1840
|
+
children: [/* @__PURE__ */ k(b, { children: "Email Subject" }), /* @__PURE__ */ k(y, {
|
|
710
1841
|
value: n.subject || "",
|
|
711
|
-
onChange: (e) =>
|
|
1842
|
+
onChange: (e) => i({ subject: e.target.value }),
|
|
712
1843
|
placeholder: "Scheduled Report: {report_title}"
|
|
713
1844
|
})]
|
|
714
1845
|
})
|
|
715
1846
|
] })]
|
|
716
1847
|
})] });
|
|
717
|
-
},
|
|
718
|
-
let { report: t, dataSources: n = [], availableFields:
|
|
1848
|
+
}, nt = ({ schema: e }) => {
|
|
1849
|
+
let { report: t, dataSources: n = [], availableFields: r = [], showPreview: i = !0, onSave: a, onCancel: o } = e, [c, l] = s(t || {
|
|
719
1850
|
type: "report",
|
|
720
1851
|
title: "New Report",
|
|
721
1852
|
fields: [],
|
|
@@ -724,242 +1855,242 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
724
1855
|
sections: [],
|
|
725
1856
|
showExportButtons: !0,
|
|
726
1857
|
showPrintButton: !0
|
|
727
|
-
}), [
|
|
728
|
-
if (
|
|
729
|
-
let e =
|
|
1858
|
+
}), [u, _] = s(c.fields || []), [v, x] = s(c.filters || []), [S, D] = s(c.groupBy || []), [j, M] = s(c.sections || []), ee = () => {
|
|
1859
|
+
if (r.length > 0 && u.length < r.length) {
|
|
1860
|
+
let e = r.find((e) => !u.some((t) => t.name === e.name));
|
|
730
1861
|
if (e) {
|
|
731
|
-
let t = [...
|
|
732
|
-
|
|
733
|
-
...
|
|
1862
|
+
let t = [...u, e];
|
|
1863
|
+
_(t), l({
|
|
1864
|
+
...c,
|
|
734
1865
|
fields: t
|
|
735
1866
|
});
|
|
736
1867
|
}
|
|
737
1868
|
}
|
|
738
|
-
},
|
|
739
|
-
let t =
|
|
740
|
-
|
|
741
|
-
...
|
|
1869
|
+
}, N = (e) => {
|
|
1870
|
+
let t = u.filter((t, n) => n !== e);
|
|
1871
|
+
_(t), l({
|
|
1872
|
+
...c,
|
|
742
1873
|
fields: t
|
|
743
1874
|
});
|
|
744
|
-
},
|
|
745
|
-
let n = [...
|
|
746
|
-
n[e] = t,
|
|
747
|
-
...
|
|
1875
|
+
}, F = (e, t) => {
|
|
1876
|
+
let n = [...u];
|
|
1877
|
+
n[e] = t, _(n), l({
|
|
1878
|
+
...c,
|
|
748
1879
|
fields: n
|
|
749
1880
|
});
|
|
750
|
-
},
|
|
1881
|
+
}, I = () => {
|
|
751
1882
|
let e = {
|
|
752
|
-
field:
|
|
1883
|
+
field: r[0]?.name || "",
|
|
753
1884
|
operator: "equals",
|
|
754
1885
|
value: ""
|
|
755
|
-
}, t = [...
|
|
756
|
-
|
|
757
|
-
...
|
|
1886
|
+
}, t = [...v, e];
|
|
1887
|
+
x(t), l({
|
|
1888
|
+
...c,
|
|
758
1889
|
filters: t
|
|
759
1890
|
});
|
|
760
|
-
},
|
|
761
|
-
let t =
|
|
762
|
-
|
|
763
|
-
...
|
|
1891
|
+
}, re = (e) => {
|
|
1892
|
+
let t = v.filter((t, n) => n !== e);
|
|
1893
|
+
x(t), l({
|
|
1894
|
+
...c,
|
|
764
1895
|
filters: t
|
|
765
1896
|
});
|
|
766
|
-
},
|
|
767
|
-
let n = [...
|
|
768
|
-
n[e] = t,
|
|
769
|
-
...
|
|
1897
|
+
}, R = (e, t) => {
|
|
1898
|
+
let n = [...v];
|
|
1899
|
+
n[e] = t, x(n), l({
|
|
1900
|
+
...c,
|
|
770
1901
|
filters: n
|
|
771
1902
|
});
|
|
772
|
-
},
|
|
1903
|
+
}, ie = () => {
|
|
773
1904
|
let e = {
|
|
774
|
-
field:
|
|
1905
|
+
field: r[0]?.name || "",
|
|
775
1906
|
sort: "asc"
|
|
776
|
-
}, t = [...
|
|
777
|
-
|
|
778
|
-
...
|
|
1907
|
+
}, t = [...S, e];
|
|
1908
|
+
D(t), l({
|
|
1909
|
+
...c,
|
|
779
1910
|
groupBy: t
|
|
780
1911
|
});
|
|
781
|
-
},
|
|
782
|
-
let t =
|
|
783
|
-
|
|
784
|
-
...
|
|
1912
|
+
}, se = (e) => {
|
|
1913
|
+
let t = S.filter((t, n) => n !== e);
|
|
1914
|
+
D(t), l({
|
|
1915
|
+
...c,
|
|
785
1916
|
groupBy: t
|
|
786
1917
|
});
|
|
787
|
-
},
|
|
788
|
-
let n = [...
|
|
789
|
-
n[e] = t,
|
|
790
|
-
...
|
|
1918
|
+
}, ce = (e, t) => {
|
|
1919
|
+
let n = [...S];
|
|
1920
|
+
n[e] = t, D(n), l({
|
|
1921
|
+
...c,
|
|
791
1922
|
groupBy: n
|
|
792
1923
|
});
|
|
793
|
-
},
|
|
1924
|
+
}, B = (e) => {
|
|
794
1925
|
let t = {
|
|
795
1926
|
type: e,
|
|
796
1927
|
title: `New ${e} Section`
|
|
797
|
-
}, n = [...
|
|
798
|
-
|
|
799
|
-
...
|
|
1928
|
+
}, n = [...j, t];
|
|
1929
|
+
M(n), l({
|
|
1930
|
+
...c,
|
|
800
1931
|
sections: n
|
|
801
1932
|
});
|
|
802
|
-
},
|
|
803
|
-
let t =
|
|
804
|
-
|
|
805
|
-
...
|
|
1933
|
+
}, V = (e) => {
|
|
1934
|
+
let t = j.filter((t, n) => n !== e);
|
|
1935
|
+
M(t), l({
|
|
1936
|
+
...c,
|
|
806
1937
|
sections: t
|
|
807
1938
|
});
|
|
808
|
-
},
|
|
809
|
-
let n = [...
|
|
810
|
-
n[e] = t,
|
|
811
|
-
...
|
|
1939
|
+
}, H = (e, t) => {
|
|
1940
|
+
let n = [...j];
|
|
1941
|
+
n[e] = t, M(n), l({
|
|
1942
|
+
...c,
|
|
812
1943
|
sections: n
|
|
813
1944
|
});
|
|
814
1945
|
};
|
|
815
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ A("div", {
|
|
816
1947
|
className: "space-y-4",
|
|
817
|
-
children: [/* @__PURE__ */
|
|
1948
|
+
children: [/* @__PURE__ */ A(f, { children: [/* @__PURE__ */ A(h, { children: [/* @__PURE__ */ k(g, { children: "Report Builder" }), /* @__PURE__ */ k(m, { children: "Configure your report settings, fields, filters, and sections" })] }), /* @__PURE__ */ A(p, { children: [/* @__PURE__ */ A(C, {
|
|
818
1949
|
defaultValue: "basic",
|
|
819
1950
|
className: "w-full",
|
|
820
1951
|
children: [
|
|
821
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ A(T, {
|
|
822
1953
|
className: "grid w-full grid-cols-6",
|
|
823
1954
|
children: [
|
|
824
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ A(E, {
|
|
825
1956
|
value: "basic",
|
|
826
|
-
children: [/* @__PURE__ */
|
|
1957
|
+
children: [/* @__PURE__ */ k(oe, { className: "h-4 w-4 mr-2" }), "Basic"]
|
|
827
1958
|
}),
|
|
828
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ A(E, {
|
|
829
1960
|
value: "fields",
|
|
830
|
-
children: [/* @__PURE__ */
|
|
1961
|
+
children: [/* @__PURE__ */ k(ne, { className: "h-4 w-4 mr-2" }), "Fields"]
|
|
831
1962
|
}),
|
|
832
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ A(E, {
|
|
833
1964
|
value: "filters",
|
|
834
|
-
children: [/* @__PURE__ */
|
|
1965
|
+
children: [/* @__PURE__ */ k(te, { className: "h-4 w-4 mr-2" }), "Filters"]
|
|
835
1966
|
}),
|
|
836
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ A(E, {
|
|
837
1968
|
value: "grouping",
|
|
838
|
-
children: [/* @__PURE__ */
|
|
1969
|
+
children: [/* @__PURE__ */ k(ne, { className: "h-4 w-4 mr-2" }), "Group By"]
|
|
839
1970
|
}),
|
|
840
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ A(E, {
|
|
841
1972
|
value: "sections",
|
|
842
|
-
children: [/* @__PURE__ */
|
|
1973
|
+
children: [/* @__PURE__ */ k(ne, { className: "h-4 w-4 mr-2" }), "Sections"]
|
|
843
1974
|
}),
|
|
844
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ A(E, {
|
|
845
1976
|
value: "schedule",
|
|
846
|
-
children: [/* @__PURE__ */
|
|
1977
|
+
children: [/* @__PURE__ */ k(P, { className: "h-4 w-4 mr-2" }), "Schedule"]
|
|
847
1978
|
})
|
|
848
1979
|
]
|
|
849
1980
|
}),
|
|
850
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ k(w, {
|
|
851
1982
|
value: "basic",
|
|
852
1983
|
className: "space-y-4 mt-4",
|
|
853
|
-
children: /* @__PURE__ */
|
|
1984
|
+
children: /* @__PURE__ */ A("div", {
|
|
854
1985
|
className: "space-y-4",
|
|
855
1986
|
children: [
|
|
856
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ A("div", {
|
|
857
1988
|
className: "space-y-2",
|
|
858
|
-
children: [/* @__PURE__ */
|
|
1989
|
+
children: [/* @__PURE__ */ k(b, {
|
|
859
1990
|
htmlFor: "report-title",
|
|
860
1991
|
children: "Report Title"
|
|
861
|
-
}), /* @__PURE__ */
|
|
1992
|
+
}), /* @__PURE__ */ k(y, {
|
|
862
1993
|
id: "report-title",
|
|
863
|
-
value:
|
|
864
|
-
onChange: (e) =>
|
|
865
|
-
...
|
|
1994
|
+
value: c.title || "",
|
|
1995
|
+
onChange: (e) => l({
|
|
1996
|
+
...c,
|
|
866
1997
|
title: e.target.value
|
|
867
1998
|
}),
|
|
868
1999
|
placeholder: "Enter report title"
|
|
869
2000
|
})]
|
|
870
2001
|
}),
|
|
871
|
-
/* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ A("div", {
|
|
872
2003
|
className: "space-y-2",
|
|
873
|
-
children: [/* @__PURE__ */
|
|
2004
|
+
children: [/* @__PURE__ */ k(b, {
|
|
874
2005
|
htmlFor: "report-description",
|
|
875
2006
|
children: "Description"
|
|
876
|
-
}), /* @__PURE__ */
|
|
2007
|
+
}), /* @__PURE__ */ k(y, {
|
|
877
2008
|
id: "report-description",
|
|
878
|
-
value:
|
|
879
|
-
onChange: (e) =>
|
|
880
|
-
...
|
|
2009
|
+
value: c.description || "",
|
|
2010
|
+
onChange: (e) => l({
|
|
2011
|
+
...c,
|
|
881
2012
|
description: e.target.value
|
|
882
2013
|
}),
|
|
883
2014
|
placeholder: "Enter report description"
|
|
884
2015
|
})]
|
|
885
2016
|
}),
|
|
886
|
-
n.length > 0 && /* @__PURE__ */
|
|
2017
|
+
n.length > 0 && /* @__PURE__ */ A("div", {
|
|
887
2018
|
className: "space-y-2",
|
|
888
|
-
children: [/* @__PURE__ */
|
|
2019
|
+
children: [/* @__PURE__ */ k(b, { children: "Data Source" }), /* @__PURE__ */ A("select", {
|
|
889
2020
|
className: "w-full border rounded-md p-2",
|
|
890
|
-
children: [/* @__PURE__ */
|
|
2021
|
+
children: [/* @__PURE__ */ k("option", {
|
|
891
2022
|
value: "",
|
|
892
2023
|
children: "Select a data source"
|
|
893
|
-
}), n.map((e, t) => /* @__PURE__ */
|
|
2024
|
+
}), n.map((e, t) => /* @__PURE__ */ A("option", {
|
|
894
2025
|
value: t,
|
|
895
2026
|
children: ["Data Source ", t + 1]
|
|
896
2027
|
}, t))]
|
|
897
2028
|
})]
|
|
898
2029
|
}),
|
|
899
|
-
/* @__PURE__ */
|
|
2030
|
+
/* @__PURE__ */ A("div", {
|
|
900
2031
|
className: "space-y-2",
|
|
901
|
-
children: [/* @__PURE__ */
|
|
2032
|
+
children: [/* @__PURE__ */ k(b, { children: "Export Options" }), /* @__PURE__ */ A("div", {
|
|
902
2033
|
className: "flex items-center gap-4",
|
|
903
|
-
children: [/* @__PURE__ */
|
|
2034
|
+
children: [/* @__PURE__ */ A("label", {
|
|
904
2035
|
className: "flex items-center gap-2",
|
|
905
|
-
children: [/* @__PURE__ */
|
|
2036
|
+
children: [/* @__PURE__ */ k("input", {
|
|
906
2037
|
type: "checkbox",
|
|
907
|
-
checked:
|
|
908
|
-
onChange: (e) =>
|
|
909
|
-
...
|
|
2038
|
+
checked: c.showExportButtons || !1,
|
|
2039
|
+
onChange: (e) => l({
|
|
2040
|
+
...c,
|
|
910
2041
|
showExportButtons: e.target.checked
|
|
911
2042
|
})
|
|
912
|
-
}), /* @__PURE__ */
|
|
2043
|
+
}), /* @__PURE__ */ k("span", {
|
|
913
2044
|
className: "text-sm",
|
|
914
2045
|
children: "Show Export Buttons"
|
|
915
2046
|
})]
|
|
916
|
-
}), /* @__PURE__ */
|
|
2047
|
+
}), /* @__PURE__ */ A("label", {
|
|
917
2048
|
className: "flex items-center gap-2",
|
|
918
|
-
children: [/* @__PURE__ */
|
|
2049
|
+
children: [/* @__PURE__ */ k("input", {
|
|
919
2050
|
type: "checkbox",
|
|
920
|
-
checked:
|
|
921
|
-
onChange: (e) =>
|
|
922
|
-
...
|
|
2051
|
+
checked: c.showPrintButton || !1,
|
|
2052
|
+
onChange: (e) => l({
|
|
2053
|
+
...c,
|
|
923
2054
|
showPrintButton: e.target.checked
|
|
924
2055
|
})
|
|
925
|
-
}), /* @__PURE__ */
|
|
2056
|
+
}), /* @__PURE__ */ k("span", {
|
|
926
2057
|
className: "text-sm",
|
|
927
2058
|
children: "Show Print Button"
|
|
928
2059
|
})]
|
|
929
2060
|
})]
|
|
930
2061
|
})]
|
|
931
2062
|
}),
|
|
932
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ A("div", {
|
|
933
2064
|
className: "space-y-2",
|
|
934
|
-
children: [/* @__PURE__ */
|
|
2065
|
+
children: [/* @__PURE__ */ k(b, {
|
|
935
2066
|
htmlFor: "export-format",
|
|
936
2067
|
children: "Default Export Format"
|
|
937
|
-
}), /* @__PURE__ */
|
|
2068
|
+
}), /* @__PURE__ */ A("select", {
|
|
938
2069
|
id: "export-format",
|
|
939
2070
|
className: "w-full border rounded-md p-2",
|
|
940
|
-
value:
|
|
941
|
-
onChange: (e) =>
|
|
942
|
-
...
|
|
2071
|
+
value: c.defaultExportFormat || "pdf",
|
|
2072
|
+
onChange: (e) => l({
|
|
2073
|
+
...c,
|
|
943
2074
|
defaultExportFormat: e.target.value
|
|
944
2075
|
}),
|
|
945
2076
|
children: [
|
|
946
|
-
/* @__PURE__ */
|
|
2077
|
+
/* @__PURE__ */ k("option", {
|
|
947
2078
|
value: "pdf",
|
|
948
2079
|
children: "PDF"
|
|
949
2080
|
}),
|
|
950
|
-
/* @__PURE__ */
|
|
2081
|
+
/* @__PURE__ */ k("option", {
|
|
951
2082
|
value: "excel",
|
|
952
2083
|
children: "Excel"
|
|
953
2084
|
}),
|
|
954
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ k("option", {
|
|
955
2086
|
value: "csv",
|
|
956
2087
|
children: "CSV"
|
|
957
2088
|
}),
|
|
958
|
-
/* @__PURE__ */
|
|
2089
|
+
/* @__PURE__ */ k("option", {
|
|
959
2090
|
value: "json",
|
|
960
2091
|
children: "JSON"
|
|
961
2092
|
}),
|
|
962
|
-
/* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ k("option", {
|
|
963
2094
|
value: "html",
|
|
964
2095
|
children: "HTML"
|
|
965
2096
|
})
|
|
@@ -969,343 +2100,343 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
969
2100
|
]
|
|
970
2101
|
})
|
|
971
2102
|
}),
|
|
972
|
-
/* @__PURE__ */ w
|
|
2103
|
+
/* @__PURE__ */ A(w, {
|
|
973
2104
|
value: "fields",
|
|
974
2105
|
className: "space-y-4 mt-4",
|
|
975
|
-
children: [/* @__PURE__ */
|
|
2106
|
+
children: [/* @__PURE__ */ A("div", {
|
|
976
2107
|
className: "flex items-center justify-between",
|
|
977
|
-
children: [/* @__PURE__ */
|
|
2108
|
+
children: [/* @__PURE__ */ k(b, { children: "Report Fields" }), /* @__PURE__ */ A(d, {
|
|
978
2109
|
size: "sm",
|
|
979
2110
|
variant: "outline",
|
|
980
|
-
onClick:
|
|
981
|
-
disabled:
|
|
982
|
-
children: [/* @__PURE__ */
|
|
2111
|
+
onClick: ee,
|
|
2112
|
+
disabled: u.length >= r.length,
|
|
2113
|
+
children: [/* @__PURE__ */ k(L, { className: "h-4 w-4 mr-2" }), "Add Field"]
|
|
983
2114
|
})]
|
|
984
|
-
}), /* @__PURE__ */
|
|
2115
|
+
}), /* @__PURE__ */ A("div", {
|
|
985
2116
|
className: "space-y-2",
|
|
986
|
-
children: [
|
|
2117
|
+
children: [u.map((e, t) => /* @__PURE__ */ k("div", {
|
|
987
2118
|
className: "flex items-center gap-2 p-3 border rounded-lg",
|
|
988
|
-
children: /* @__PURE__ */
|
|
2119
|
+
children: /* @__PURE__ */ A("div", {
|
|
989
2120
|
className: "flex-1 grid grid-cols-4 gap-2",
|
|
990
2121
|
children: [
|
|
991
|
-
/* @__PURE__ */
|
|
2122
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
992
2123
|
className: "text-xs",
|
|
993
2124
|
children: "Field Name"
|
|
994
|
-
}), /* @__PURE__ */
|
|
2125
|
+
}), /* @__PURE__ */ k("div", {
|
|
995
2126
|
className: "text-sm font-medium",
|
|
996
2127
|
children: e.name
|
|
997
2128
|
})] }),
|
|
998
|
-
/* @__PURE__ */
|
|
2129
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
999
2130
|
className: "text-xs",
|
|
1000
2131
|
children: "Label"
|
|
1001
|
-
}), /* @__PURE__ */
|
|
2132
|
+
}), /* @__PURE__ */ k(y, {
|
|
1002
2133
|
className: "h-8 text-sm",
|
|
1003
2134
|
value: e.label || e.name,
|
|
1004
|
-
onChange: (n) =>
|
|
2135
|
+
onChange: (n) => F(t, {
|
|
1005
2136
|
...e,
|
|
1006
2137
|
label: n.target.value
|
|
1007
2138
|
})
|
|
1008
2139
|
})] }),
|
|
1009
|
-
/* @__PURE__ */
|
|
2140
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1010
2141
|
className: "text-xs",
|
|
1011
2142
|
children: "Aggregation"
|
|
1012
|
-
}), /* @__PURE__ */
|
|
2143
|
+
}), /* @__PURE__ */ A("select", {
|
|
1013
2144
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1014
2145
|
value: e.aggregation || "",
|
|
1015
|
-
onChange: (n) =>
|
|
2146
|
+
onChange: (n) => F(t, {
|
|
1016
2147
|
...e,
|
|
1017
2148
|
aggregation: n.target.value
|
|
1018
2149
|
}),
|
|
1019
2150
|
children: [
|
|
1020
|
-
/* @__PURE__ */
|
|
2151
|
+
/* @__PURE__ */ k("option", {
|
|
1021
2152
|
value: "",
|
|
1022
2153
|
children: "None"
|
|
1023
2154
|
}),
|
|
1024
|
-
/* @__PURE__ */
|
|
2155
|
+
/* @__PURE__ */ k("option", {
|
|
1025
2156
|
value: "sum",
|
|
1026
2157
|
children: "Sum"
|
|
1027
2158
|
}),
|
|
1028
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ k("option", {
|
|
1029
2160
|
value: "count",
|
|
1030
2161
|
children: "Count"
|
|
1031
2162
|
}),
|
|
1032
|
-
/* @__PURE__ */
|
|
2163
|
+
/* @__PURE__ */ k("option", {
|
|
1033
2164
|
value: "avg",
|
|
1034
2165
|
children: "Average"
|
|
1035
2166
|
}),
|
|
1036
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ k("option", {
|
|
1037
2168
|
value: "min",
|
|
1038
2169
|
children: "Min"
|
|
1039
2170
|
}),
|
|
1040
|
-
/* @__PURE__ */
|
|
2171
|
+
/* @__PURE__ */ k("option", {
|
|
1041
2172
|
value: "max",
|
|
1042
2173
|
children: "Max"
|
|
1043
2174
|
})
|
|
1044
2175
|
]
|
|
1045
2176
|
})] }),
|
|
1046
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ k("div", {
|
|
1047
2178
|
className: "flex items-end justify-end",
|
|
1048
|
-
children: /* @__PURE__ */
|
|
2179
|
+
children: /* @__PURE__ */ k(d, {
|
|
1049
2180
|
size: "sm",
|
|
1050
2181
|
variant: "ghost",
|
|
1051
2182
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
1052
|
-
onClick: () =>
|
|
1053
|
-
children: /* @__PURE__ */
|
|
2183
|
+
onClick: () => N(t),
|
|
2184
|
+
children: /* @__PURE__ */ k(z, { className: "h-4 w-4" })
|
|
1054
2185
|
})
|
|
1055
2186
|
})
|
|
1056
2187
|
]
|
|
1057
2188
|
})
|
|
1058
|
-
}, t)),
|
|
2189
|
+
}, t)), u.length === 0 && /* @__PURE__ */ k("div", {
|
|
1059
2190
|
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1060
2191
|
children: "No fields selected. Click \"Add Field\" to begin."
|
|
1061
2192
|
})]
|
|
1062
2193
|
})]
|
|
1063
2194
|
}),
|
|
1064
|
-
/* @__PURE__ */ w
|
|
2195
|
+
/* @__PURE__ */ A(w, {
|
|
1065
2196
|
value: "filters",
|
|
1066
2197
|
className: "space-y-4 mt-4",
|
|
1067
|
-
children: [/* @__PURE__ */
|
|
2198
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1068
2199
|
className: "flex items-center justify-between",
|
|
1069
|
-
children: [/* @__PURE__ */
|
|
2200
|
+
children: [/* @__PURE__ */ k(b, { children: "Report Filters" }), /* @__PURE__ */ A(d, {
|
|
1070
2201
|
size: "sm",
|
|
1071
2202
|
variant: "outline",
|
|
1072
|
-
onClick:
|
|
1073
|
-
children: [/* @__PURE__ */
|
|
2203
|
+
onClick: I,
|
|
2204
|
+
children: [/* @__PURE__ */ k(L, { className: "h-4 w-4 mr-2" }), "Add Filter"]
|
|
1074
2205
|
})]
|
|
1075
|
-
}), /* @__PURE__ */
|
|
2206
|
+
}), /* @__PURE__ */ A("div", {
|
|
1076
2207
|
className: "space-y-2",
|
|
1077
|
-
children: [
|
|
2208
|
+
children: [v.map((e, t) => /* @__PURE__ */ A("div", {
|
|
1078
2209
|
className: "flex items-center gap-2 p-3 border rounded-lg",
|
|
1079
|
-
children: [/* @__PURE__ */
|
|
2210
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1080
2211
|
className: "flex-1 grid grid-cols-3 gap-2",
|
|
1081
2212
|
children: [
|
|
1082
|
-
/* @__PURE__ */
|
|
2213
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1083
2214
|
className: "text-xs",
|
|
1084
2215
|
children: "Field"
|
|
1085
|
-
}), /* @__PURE__ */
|
|
2216
|
+
}), /* @__PURE__ */ k("select", {
|
|
1086
2217
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1087
2218
|
value: e.field,
|
|
1088
|
-
onChange: (n) =>
|
|
2219
|
+
onChange: (n) => R(t, {
|
|
1089
2220
|
...e,
|
|
1090
2221
|
field: n.target.value
|
|
1091
2222
|
}),
|
|
1092
|
-
children:
|
|
2223
|
+
children: r.map((e, t) => /* @__PURE__ */ k("option", {
|
|
1093
2224
|
value: e.name,
|
|
1094
2225
|
children: e.label || e.name
|
|
1095
2226
|
}, t))
|
|
1096
2227
|
})] }),
|
|
1097
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1098
2229
|
className: "text-xs",
|
|
1099
2230
|
children: "Operator"
|
|
1100
|
-
}), /* @__PURE__ */
|
|
2231
|
+
}), /* @__PURE__ */ A("select", {
|
|
1101
2232
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1102
2233
|
value: e.operator,
|
|
1103
|
-
onChange: (n) =>
|
|
2234
|
+
onChange: (n) => R(t, {
|
|
1104
2235
|
...e,
|
|
1105
2236
|
operator: n.target.value
|
|
1106
2237
|
}),
|
|
1107
2238
|
children: [
|
|
1108
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ k("option", {
|
|
1109
2240
|
value: "equals",
|
|
1110
2241
|
children: "Equals"
|
|
1111
2242
|
}),
|
|
1112
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ k("option", {
|
|
1113
2244
|
value: "contains",
|
|
1114
2245
|
children: "Contains"
|
|
1115
2246
|
}),
|
|
1116
|
-
/* @__PURE__ */
|
|
2247
|
+
/* @__PURE__ */ k("option", {
|
|
1117
2248
|
value: "gt",
|
|
1118
2249
|
children: "Greater Than"
|
|
1119
2250
|
}),
|
|
1120
|
-
/* @__PURE__ */
|
|
2251
|
+
/* @__PURE__ */ k("option", {
|
|
1121
2252
|
value: "lt",
|
|
1122
2253
|
children: "Less Than"
|
|
1123
2254
|
}),
|
|
1124
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ k("option", {
|
|
1125
2256
|
value: "between",
|
|
1126
2257
|
children: "Between"
|
|
1127
2258
|
})
|
|
1128
2259
|
]
|
|
1129
2260
|
})] }),
|
|
1130
|
-
/* @__PURE__ */
|
|
2261
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1131
2262
|
className: "text-xs",
|
|
1132
2263
|
children: "Value"
|
|
1133
|
-
}), /* @__PURE__ */
|
|
2264
|
+
}), /* @__PURE__ */ k(y, {
|
|
1134
2265
|
className: "h-8 text-sm",
|
|
1135
2266
|
value: String(e.value),
|
|
1136
|
-
onChange: (n) =>
|
|
2267
|
+
onChange: (n) => R(t, {
|
|
1137
2268
|
...e,
|
|
1138
2269
|
value: n.target.value
|
|
1139
2270
|
})
|
|
1140
2271
|
})] })
|
|
1141
2272
|
]
|
|
1142
|
-
}), /* @__PURE__ */
|
|
2273
|
+
}), /* @__PURE__ */ k(d, {
|
|
1143
2274
|
size: "sm",
|
|
1144
2275
|
variant: "ghost",
|
|
1145
2276
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
|
|
1146
|
-
onClick: () =>
|
|
1147
|
-
children: /* @__PURE__ */
|
|
2277
|
+
onClick: () => re(t),
|
|
2278
|
+
children: /* @__PURE__ */ k(z, { className: "h-4 w-4" })
|
|
1148
2279
|
})]
|
|
1149
|
-
}, t)),
|
|
2280
|
+
}, t)), v.length === 0 && /* @__PURE__ */ k("div", {
|
|
1150
2281
|
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1151
2282
|
children: "No filters defined."
|
|
1152
2283
|
})]
|
|
1153
2284
|
})]
|
|
1154
2285
|
}),
|
|
1155
|
-
/* @__PURE__ */ w
|
|
2286
|
+
/* @__PURE__ */ A(w, {
|
|
1156
2287
|
value: "grouping",
|
|
1157
2288
|
className: "space-y-4 mt-4",
|
|
1158
|
-
children: [/* @__PURE__ */
|
|
2289
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1159
2290
|
className: "flex items-center justify-between",
|
|
1160
|
-
children: [/* @__PURE__ */
|
|
2291
|
+
children: [/* @__PURE__ */ k(b, { children: "Grouping Rules" }), /* @__PURE__ */ A(d, {
|
|
1161
2292
|
size: "sm",
|
|
1162
2293
|
variant: "outline",
|
|
1163
|
-
onClick:
|
|
1164
|
-
children: [/* @__PURE__ */
|
|
2294
|
+
onClick: ie,
|
|
2295
|
+
children: [/* @__PURE__ */ k(L, { className: "h-4 w-4 mr-2" }), "Add Group"]
|
|
1165
2296
|
})]
|
|
1166
|
-
}), /* @__PURE__ */
|
|
2297
|
+
}), /* @__PURE__ */ A("div", {
|
|
1167
2298
|
className: "space-y-2",
|
|
1168
|
-
children: [
|
|
2299
|
+
children: [S.map((e, t) => /* @__PURE__ */ A("div", {
|
|
1169
2300
|
className: "flex items-center gap-2 p-3 border rounded-lg",
|
|
1170
|
-
children: [/* @__PURE__ */
|
|
2301
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1171
2302
|
className: "flex-1 grid grid-cols-2 gap-2",
|
|
1172
|
-
children: [/* @__PURE__ */
|
|
2303
|
+
children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1173
2304
|
className: "text-xs",
|
|
1174
2305
|
children: "Field"
|
|
1175
|
-
}), /* @__PURE__ */
|
|
2306
|
+
}), /* @__PURE__ */ k("select", {
|
|
1176
2307
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1177
2308
|
value: e.field,
|
|
1178
|
-
onChange: (n) =>
|
|
2309
|
+
onChange: (n) => ce(t, {
|
|
1179
2310
|
...e,
|
|
1180
2311
|
field: n.target.value
|
|
1181
2312
|
}),
|
|
1182
|
-
children:
|
|
2313
|
+
children: r.map((e, t) => /* @__PURE__ */ k("option", {
|
|
1183
2314
|
value: e.name,
|
|
1184
2315
|
children: e.label || e.name
|
|
1185
2316
|
}, t))
|
|
1186
|
-
})] }), /* @__PURE__ */
|
|
2317
|
+
})] }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1187
2318
|
className: "text-xs",
|
|
1188
2319
|
children: "Sort Order"
|
|
1189
|
-
}), /* @__PURE__ */
|
|
2320
|
+
}), /* @__PURE__ */ A("select", {
|
|
1190
2321
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1191
2322
|
value: e.sort || "asc",
|
|
1192
|
-
onChange: (n) =>
|
|
2323
|
+
onChange: (n) => ce(t, {
|
|
1193
2324
|
...e,
|
|
1194
2325
|
sort: n.target.value
|
|
1195
2326
|
}),
|
|
1196
|
-
children: [/* @__PURE__ */
|
|
2327
|
+
children: [/* @__PURE__ */ k("option", {
|
|
1197
2328
|
value: "asc",
|
|
1198
2329
|
children: "Ascending"
|
|
1199
|
-
}), /* @__PURE__ */
|
|
2330
|
+
}), /* @__PURE__ */ k("option", {
|
|
1200
2331
|
value: "desc",
|
|
1201
2332
|
children: "Descending"
|
|
1202
2333
|
})]
|
|
1203
2334
|
})] })]
|
|
1204
|
-
}), /* @__PURE__ */
|
|
2335
|
+
}), /* @__PURE__ */ k(d, {
|
|
1205
2336
|
size: "sm",
|
|
1206
2337
|
variant: "ghost",
|
|
1207
2338
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
|
|
1208
|
-
onClick: () =>
|
|
1209
|
-
children: /* @__PURE__ */
|
|
2339
|
+
onClick: () => se(t),
|
|
2340
|
+
children: /* @__PURE__ */ k(z, { className: "h-4 w-4" })
|
|
1210
2341
|
})]
|
|
1211
|
-
}, t)),
|
|
2342
|
+
}, t)), S.length === 0 && /* @__PURE__ */ k("div", {
|
|
1212
2343
|
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1213
2344
|
children: "No grouping rules applied."
|
|
1214
2345
|
})]
|
|
1215
2346
|
})]
|
|
1216
2347
|
}),
|
|
1217
|
-
/* @__PURE__ */ w
|
|
2348
|
+
/* @__PURE__ */ A(w, {
|
|
1218
2349
|
value: "sections",
|
|
1219
2350
|
className: "space-y-4 mt-4",
|
|
1220
|
-
children: [/* @__PURE__ */
|
|
2351
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1221
2352
|
className: "flex items-center justify-between",
|
|
1222
|
-
children: [/* @__PURE__ */
|
|
2353
|
+
children: [/* @__PURE__ */ k(b, { children: "Report Sections" }), /* @__PURE__ */ A("div", {
|
|
1223
2354
|
className: "flex gap-2",
|
|
1224
2355
|
children: [
|
|
1225
|
-
/* @__PURE__ */
|
|
2356
|
+
/* @__PURE__ */ A(d, {
|
|
1226
2357
|
size: "sm",
|
|
1227
2358
|
variant: "outline",
|
|
1228
|
-
onClick: () =>
|
|
1229
|
-
children: [/* @__PURE__ */
|
|
2359
|
+
onClick: () => B("header"),
|
|
2360
|
+
children: [/* @__PURE__ */ k(L, { className: "h-4 w-4 mr-2" }), "Header"]
|
|
1230
2361
|
}),
|
|
1231
|
-
/* @__PURE__ */
|
|
2362
|
+
/* @__PURE__ */ A(d, {
|
|
1232
2363
|
size: "sm",
|
|
1233
2364
|
variant: "outline",
|
|
1234
|
-
onClick: () =>
|
|
1235
|
-
children: [/* @__PURE__ */
|
|
2365
|
+
onClick: () => B("chart"),
|
|
2366
|
+
children: [/* @__PURE__ */ k(L, { className: "h-4 w-4 mr-2" }), "Chart"]
|
|
1236
2367
|
}),
|
|
1237
|
-
/* @__PURE__ */
|
|
2368
|
+
/* @__PURE__ */ A(d, {
|
|
1238
2369
|
size: "sm",
|
|
1239
2370
|
variant: "outline",
|
|
1240
|
-
onClick: () =>
|
|
1241
|
-
children: [/* @__PURE__ */
|
|
2371
|
+
onClick: () => B("table"),
|
|
2372
|
+
children: [/* @__PURE__ */ k(L, { className: "h-4 w-4 mr-2" }), "Table"]
|
|
1242
2373
|
})
|
|
1243
2374
|
]
|
|
1244
2375
|
})]
|
|
1245
|
-
}), /* @__PURE__ */
|
|
2376
|
+
}), /* @__PURE__ */ A("div", {
|
|
1246
2377
|
className: "space-y-2",
|
|
1247
|
-
children: [
|
|
2378
|
+
children: [j.map((e, t) => /* @__PURE__ */ A("div", {
|
|
1248
2379
|
className: "p-3 border rounded-lg space-y-2",
|
|
1249
|
-
children: [/* @__PURE__ */
|
|
2380
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1250
2381
|
className: "flex items-center justify-between",
|
|
1251
|
-
children: [/* @__PURE__ */
|
|
2382
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1252
2383
|
className: "font-medium flex items-center gap-2",
|
|
1253
|
-
children: [/* @__PURE__ */
|
|
2384
|
+
children: [/* @__PURE__ */ k("div", {
|
|
1254
2385
|
className: "text-xs bg-muted px-2 py-0.5 rounded uppercase",
|
|
1255
2386
|
children: e.type
|
|
1256
2387
|
}), e.title]
|
|
1257
|
-
}), /* @__PURE__ */
|
|
2388
|
+
}), /* @__PURE__ */ k(d, {
|
|
1258
2389
|
size: "sm",
|
|
1259
2390
|
variant: "ghost",
|
|
1260
2391
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
1261
|
-
onClick: () =>
|
|
1262
|
-
children: /* @__PURE__ */
|
|
2392
|
+
onClick: () => V(t),
|
|
2393
|
+
children: /* @__PURE__ */ k(z, { className: "h-4 w-4" })
|
|
1263
2394
|
})]
|
|
1264
|
-
}), /* @__PURE__ */
|
|
2395
|
+
}), /* @__PURE__ */ A("div", {
|
|
1265
2396
|
className: "grid grid-cols-2 gap-2",
|
|
1266
2397
|
children: [
|
|
1267
|
-
/* @__PURE__ */
|
|
2398
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1268
2399
|
className: "text-xs",
|
|
1269
2400
|
children: "Title"
|
|
1270
|
-
}), /* @__PURE__ */
|
|
2401
|
+
}), /* @__PURE__ */ k(y, {
|
|
1271
2402
|
className: "h-8 text-sm",
|
|
1272
2403
|
value: e.title || "",
|
|
1273
|
-
onChange: (n) =>
|
|
2404
|
+
onChange: (n) => H(t, {
|
|
1274
2405
|
...e,
|
|
1275
2406
|
title: n.target.value
|
|
1276
2407
|
})
|
|
1277
2408
|
})] }),
|
|
1278
|
-
e.type === "text" && /* @__PURE__ */
|
|
2409
|
+
e.type === "text" && /* @__PURE__ */ A("div", {
|
|
1279
2410
|
className: "col-span-2",
|
|
1280
|
-
children: [/* @__PURE__ */
|
|
2411
|
+
children: [/* @__PURE__ */ k(b, {
|
|
1281
2412
|
className: "text-xs",
|
|
1282
2413
|
children: "Content"
|
|
1283
|
-
}), /* @__PURE__ */
|
|
2414
|
+
}), /* @__PURE__ */ k(y, {
|
|
1284
2415
|
className: "h-8 text-sm",
|
|
1285
2416
|
value: e.text || "",
|
|
1286
|
-
onChange: (n) =>
|
|
2417
|
+
onChange: (n) => H(t, {
|
|
1287
2418
|
...e,
|
|
1288
2419
|
text: n.target.value
|
|
1289
2420
|
})
|
|
1290
2421
|
})]
|
|
1291
2422
|
}),
|
|
1292
|
-
e.type === "chart" && /* @__PURE__ */
|
|
2423
|
+
e.type === "chart" && /* @__PURE__ */ A("div", {
|
|
1293
2424
|
className: "col-span-2 grid grid-cols-2 gap-2 mt-2 p-2 bg-muted/20 rounded",
|
|
1294
2425
|
children: [
|
|
1295
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ k("div", {
|
|
1296
2427
|
className: "col-span-2",
|
|
1297
|
-
children: /* @__PURE__ */
|
|
2428
|
+
children: /* @__PURE__ */ k(b, {
|
|
1298
2429
|
className: "text-xs font-semibold",
|
|
1299
2430
|
children: "Chart Configuration"
|
|
1300
2431
|
})
|
|
1301
2432
|
}),
|
|
1302
|
-
/* @__PURE__ */
|
|
2433
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1303
2434
|
className: "text-xs",
|
|
1304
2435
|
children: "Chart Type"
|
|
1305
|
-
}), /* @__PURE__ */
|
|
2436
|
+
}), /* @__PURE__ */ A("select", {
|
|
1306
2437
|
className: "flex h-8 w-full rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1307
2438
|
value: e.chart?.chartType || "bar",
|
|
1308
|
-
onChange: (n) =>
|
|
2439
|
+
onChange: (n) => H(t, {
|
|
1309
2440
|
...e,
|
|
1310
2441
|
chart: {
|
|
1311
2442
|
...e.chart,
|
|
@@ -1314,31 +2445,31 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
1314
2445
|
}
|
|
1315
2446
|
}),
|
|
1316
2447
|
children: [
|
|
1317
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ k("option", {
|
|
1318
2449
|
value: "bar",
|
|
1319
2450
|
children: "Bar"
|
|
1320
2451
|
}),
|
|
1321
|
-
/* @__PURE__ */
|
|
2452
|
+
/* @__PURE__ */ k("option", {
|
|
1322
2453
|
value: "line",
|
|
1323
2454
|
children: "Line"
|
|
1324
2455
|
}),
|
|
1325
|
-
/* @__PURE__ */
|
|
2456
|
+
/* @__PURE__ */ k("option", {
|
|
1326
2457
|
value: "area",
|
|
1327
2458
|
children: "Area"
|
|
1328
2459
|
}),
|
|
1329
|
-
/* @__PURE__ */
|
|
2460
|
+
/* @__PURE__ */ k("option", {
|
|
1330
2461
|
value: "pie",
|
|
1331
2462
|
children: "Pie"
|
|
1332
2463
|
})
|
|
1333
2464
|
]
|
|
1334
2465
|
})] }),
|
|
1335
|
-
/* @__PURE__ */
|
|
2466
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(b, {
|
|
1336
2467
|
className: "text-xs",
|
|
1337
2468
|
children: "X-Axis Field"
|
|
1338
|
-
}), /* @__PURE__ */
|
|
2469
|
+
}), /* @__PURE__ */ A("select", {
|
|
1339
2470
|
className: "flex h-8 w-full rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1340
2471
|
value: e.chart?.xAxisField || "",
|
|
1341
|
-
onChange: (n) =>
|
|
2472
|
+
onChange: (n) => H(t, {
|
|
1342
2473
|
...e,
|
|
1343
2474
|
chart: {
|
|
1344
2475
|
...e.chart,
|
|
@@ -1347,33 +2478,33 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
1347
2478
|
}
|
|
1348
2479
|
}),
|
|
1349
2480
|
children: [
|
|
1350
|
-
/* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ k("option", {
|
|
1351
2482
|
value: "",
|
|
1352
2483
|
children: "Select Field..."
|
|
1353
2484
|
}),
|
|
1354
|
-
|
|
2485
|
+
r.map((e) => /* @__PURE__ */ k("option", {
|
|
1355
2486
|
value: e.name,
|
|
1356
2487
|
children: e.label || e.name
|
|
1357
2488
|
}, e.name)),
|
|
1358
|
-
|
|
2489
|
+
r.length === 0 && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("option", {
|
|
1359
2490
|
value: "name",
|
|
1360
2491
|
children: "Name"
|
|
1361
|
-
}), /* @__PURE__ */
|
|
2492
|
+
}), /* @__PURE__ */ k("option", {
|
|
1362
2493
|
value: "month",
|
|
1363
2494
|
children: "Month"
|
|
1364
2495
|
})] })
|
|
1365
2496
|
]
|
|
1366
2497
|
})] }),
|
|
1367
|
-
/* @__PURE__ */
|
|
2498
|
+
/* @__PURE__ */ A("div", {
|
|
1368
2499
|
className: "col-span-2",
|
|
1369
|
-
children: [/* @__PURE__ */
|
|
2500
|
+
children: [/* @__PURE__ */ k(b, {
|
|
1370
2501
|
className: "text-xs",
|
|
1371
2502
|
children: "Y-Axis Fields (comma separated)"
|
|
1372
|
-
}), /* @__PURE__ */
|
|
2503
|
+
}), /* @__PURE__ */ k(y, {
|
|
1373
2504
|
className: "h-8 text-sm",
|
|
1374
2505
|
placeholder: "e.g. value, count",
|
|
1375
2506
|
value: e.chart?.yAxisFields?.join(", ") || "",
|
|
1376
|
-
onChange: (n) =>
|
|
2507
|
+
onChange: (n) => H(t, {
|
|
1377
2508
|
...e,
|
|
1378
2509
|
chart: {
|
|
1379
2510
|
...e.chart,
|
|
@@ -1387,56 +2518,56 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
1387
2518
|
})
|
|
1388
2519
|
]
|
|
1389
2520
|
})]
|
|
1390
|
-
}, t)),
|
|
2521
|
+
}, t)), j.length === 0 && /* @__PURE__ */ k("div", {
|
|
1391
2522
|
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1392
2523
|
children: "No customized sections. The default report layout will be used."
|
|
1393
2524
|
})]
|
|
1394
2525
|
})]
|
|
1395
2526
|
}),
|
|
1396
|
-
/* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ k(w, {
|
|
1397
2528
|
value: "schedule",
|
|
1398
2529
|
className: "space-y-4 mt-4",
|
|
1399
|
-
children: /* @__PURE__ */
|
|
1400
|
-
schedule:
|
|
1401
|
-
onChange: (e) =>
|
|
1402
|
-
...
|
|
2530
|
+
children: /* @__PURE__ */ k(tt, {
|
|
2531
|
+
schedule: c.schedule,
|
|
2532
|
+
onChange: (e) => l({
|
|
2533
|
+
...c,
|
|
1403
2534
|
schedule: e
|
|
1404
2535
|
})
|
|
1405
2536
|
})
|
|
1406
2537
|
})
|
|
1407
2538
|
]
|
|
1408
|
-
}), /* @__PURE__ */
|
|
2539
|
+
}), /* @__PURE__ */ A("div", {
|
|
1409
2540
|
className: "flex items-center justify-end gap-2 mt-6 pt-4 border-t",
|
|
1410
|
-
children: [/* @__PURE__ */
|
|
2541
|
+
children: [/* @__PURE__ */ k(d, {
|
|
1411
2542
|
variant: "outline",
|
|
1412
2543
|
onClick: () => {
|
|
1413
|
-
|
|
2544
|
+
o && console.log("Report cancelled:", o);
|
|
1414
2545
|
},
|
|
1415
2546
|
children: "Cancel"
|
|
1416
|
-
}), /* @__PURE__ */
|
|
2547
|
+
}), /* @__PURE__ */ A(d, {
|
|
1417
2548
|
onClick: () => {
|
|
1418
|
-
console.log("Saving report:",
|
|
2549
|
+
console.log("Saving report:", c), a && alert("Report saved! (Handler: " + a + ")");
|
|
1419
2550
|
},
|
|
1420
|
-
children: [/* @__PURE__ */
|
|
2551
|
+
children: [/* @__PURE__ */ k(ae, { className: "h-4 w-4 mr-2" }), "Save Report"]
|
|
1421
2552
|
})]
|
|
1422
|
-
})] })] }),
|
|
2553
|
+
})] })] }), i && /* @__PURE__ */ A(f, {
|
|
1423
2554
|
className: "mt-8 border-2 border-blue-100",
|
|
1424
|
-
children: [/* @__PURE__ */
|
|
2555
|
+
children: [/* @__PURE__ */ k(h, {
|
|
1425
2556
|
className: "bg-blue-50/50",
|
|
1426
|
-
children: /* @__PURE__ */
|
|
2557
|
+
children: /* @__PURE__ */ k(g, {
|
|
1427
2558
|
className: "text-blue-900 text-sm uppercase tracking-wide",
|
|
1428
2559
|
children: "Live Preview"
|
|
1429
2560
|
})
|
|
1430
|
-
}), /* @__PURE__ */
|
|
2561
|
+
}), /* @__PURE__ */ k(p, {
|
|
1431
2562
|
className: "pt-6",
|
|
1432
|
-
children: /* @__PURE__ */
|
|
2563
|
+
children: /* @__PURE__ */ k(et, { schema: {
|
|
1433
2564
|
type: "report-viewer",
|
|
1434
2565
|
report: {
|
|
1435
|
-
...
|
|
1436
|
-
fields:
|
|
1437
|
-
filters:
|
|
1438
|
-
groupBy:
|
|
1439
|
-
sections:
|
|
2566
|
+
...c,
|
|
2567
|
+
fields: u,
|
|
2568
|
+
filters: v,
|
|
2569
|
+
groupBy: S,
|
|
2570
|
+
sections: j
|
|
1440
2571
|
},
|
|
1441
2572
|
data: [
|
|
1442
2573
|
{
|
|
@@ -1462,7 +2593,7 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
1462
2593
|
})]
|
|
1463
2594
|
})]
|
|
1464
2595
|
});
|
|
1465
|
-
},
|
|
2596
|
+
}, rt = [
|
|
1466
2597
|
{
|
|
1467
2598
|
value: "",
|
|
1468
2599
|
label: "None"
|
|
@@ -1488,7 +2619,7 @@ var X = ({ schema: t, onRefresh: r }) => {
|
|
|
1488
2619
|
label: "Max"
|
|
1489
2620
|
}
|
|
1490
2621
|
];
|
|
1491
|
-
function
|
|
2622
|
+
function it({ availableFields: e, value: t, onChange: n }) {
|
|
1492
2623
|
let r = Array.isArray(t) ? t.map((e) => typeof e == "string" ? {
|
|
1493
2624
|
field: e,
|
|
1494
2625
|
label: e,
|
|
@@ -1516,40 +2647,40 @@ function se({ availableFields: e, value: t, onChange: n }) {
|
|
|
1516
2647
|
aggregate: t || void 0
|
|
1517
2648
|
} : n));
|
|
1518
2649
|
};
|
|
1519
|
-
return e.length === 0 ? /* @__PURE__ */
|
|
2650
|
+
return e.length === 0 ? /* @__PURE__ */ k("div", {
|
|
1520
2651
|
className: "text-xs text-muted-foreground py-2",
|
|
1521
2652
|
"data-testid": "field-picker-empty",
|
|
1522
2653
|
children: "No fields available"
|
|
1523
|
-
}) : /* @__PURE__ */
|
|
2654
|
+
}) : /* @__PURE__ */ k("div", {
|
|
1524
2655
|
className: "space-y-1 py-1",
|
|
1525
2656
|
"data-testid": "field-picker",
|
|
1526
2657
|
children: e.map((e) => {
|
|
1527
2658
|
let t = i.includes(e.value), n = r.find((t) => t.field === e.value);
|
|
1528
|
-
return /* @__PURE__ */
|
|
2659
|
+
return /* @__PURE__ */ A("div", {
|
|
1529
2660
|
className: "flex items-center gap-2 px-1 py-0.5 rounded hover:bg-muted/50 text-xs",
|
|
1530
|
-
children: [/* @__PURE__ */
|
|
2661
|
+
children: [/* @__PURE__ */ A("label", {
|
|
1531
2662
|
className: "flex items-center gap-2 flex-1 cursor-pointer",
|
|
1532
2663
|
children: [
|
|
1533
|
-
/* @__PURE__ */
|
|
2664
|
+
/* @__PURE__ */ k(_, {
|
|
1534
2665
|
checked: t,
|
|
1535
2666
|
onCheckedChange: () => a(e.value),
|
|
1536
2667
|
"data-testid": `field-picker-${e.value}`
|
|
1537
2668
|
}),
|
|
1538
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ k("span", {
|
|
1539
2670
|
className: "flex-1",
|
|
1540
2671
|
children: e.label
|
|
1541
2672
|
}),
|
|
1542
|
-
e.type && /* @__PURE__ */
|
|
2673
|
+
e.type && /* @__PURE__ */ k("span", {
|
|
1543
2674
|
className: "text-[10px] text-muted-foreground",
|
|
1544
2675
|
children: e.type
|
|
1545
2676
|
})
|
|
1546
2677
|
]
|
|
1547
|
-
}), t && /* @__PURE__ */
|
|
2678
|
+
}), t && /* @__PURE__ */ k("select", {
|
|
1548
2679
|
className: "h-5 text-[10px] border rounded px-1 bg-background",
|
|
1549
2680
|
value: n?.aggregate || "",
|
|
1550
2681
|
onChange: (t) => o(e.value, t.target.value),
|
|
1551
2682
|
"data-testid": `field-agg-${e.value}`,
|
|
1552
|
-
children:
|
|
2683
|
+
children: rt.map((e) => /* @__PURE__ */ k("option", {
|
|
1553
2684
|
value: e.value,
|
|
1554
2685
|
children: e.label
|
|
1555
2686
|
}, e.value))
|
|
@@ -1558,7 +2689,7 @@ function se({ availableFields: e, value: t, onChange: n }) {
|
|
|
1558
2689
|
})
|
|
1559
2690
|
});
|
|
1560
2691
|
}
|
|
1561
|
-
var
|
|
2692
|
+
var at = [
|
|
1562
2693
|
{
|
|
1563
2694
|
value: "",
|
|
1564
2695
|
label: "None"
|
|
@@ -1588,7 +2719,7 @@ var ce = [
|
|
|
1588
2719
|
label: "Scatter Plot"
|
|
1589
2720
|
}
|
|
1590
2721
|
];
|
|
1591
|
-
function
|
|
2722
|
+
function ot({ availableFields: e, value: t, onChange: n }) {
|
|
1592
2723
|
let r = t || {}, i = r.type ?? r.chartType ?? "", a = r.xAxis ?? r.xAxisField ?? "", o = r.yAxis ?? r.yAxisFields?.[0] ?? "", s = (e) => {
|
|
1593
2724
|
let t = {
|
|
1594
2725
|
...r,
|
|
@@ -1596,55 +2727,55 @@ function le({ availableFields: e, value: t, onChange: n }) {
|
|
|
1596
2727
|
};
|
|
1597
2728
|
"type" in e && delete t.chartType, "xAxis" in e && delete t.xAxisField, "yAxis" in e && delete t.yAxisFields, n(t);
|
|
1598
2729
|
};
|
|
1599
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ A("div", {
|
|
1600
2731
|
className: "space-y-2 py-1",
|
|
1601
2732
|
"data-testid": "chart-config",
|
|
1602
|
-
children: [/* @__PURE__ */
|
|
2733
|
+
children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("label", {
|
|
1603
2734
|
className: "text-[10px] text-muted-foreground",
|
|
1604
2735
|
children: "Chart type"
|
|
1605
|
-
}), /* @__PURE__ */
|
|
2736
|
+
}), /* @__PURE__ */ k("select", {
|
|
1606
2737
|
className: "w-full h-7 text-xs border rounded px-2 bg-background",
|
|
1607
2738
|
value: i,
|
|
1608
2739
|
onChange: (e) => s({ type: e.target.value || void 0 }),
|
|
1609
2740
|
"data-testid": "chart-type-select",
|
|
1610
|
-
children:
|
|
2741
|
+
children: at.map((e) => /* @__PURE__ */ k("option", {
|
|
1611
2742
|
value: e.value,
|
|
1612
2743
|
children: e.label
|
|
1613
2744
|
}, e.value))
|
|
1614
|
-
})] }), i && /* @__PURE__ */
|
|
2745
|
+
})] }), i && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("label", {
|
|
1615
2746
|
className: "text-[10px] text-muted-foreground",
|
|
1616
2747
|
children: "X-axis field"
|
|
1617
|
-
}), /* @__PURE__ */
|
|
2748
|
+
}), /* @__PURE__ */ A("select", {
|
|
1618
2749
|
className: "w-full h-7 text-xs border rounded px-2 bg-background",
|
|
1619
2750
|
value: a,
|
|
1620
2751
|
onChange: (e) => s({ xAxis: e.target.value || void 0 }),
|
|
1621
2752
|
"data-testid": "chart-x-field",
|
|
1622
|
-
children: [/* @__PURE__ */
|
|
2753
|
+
children: [/* @__PURE__ */ k("option", {
|
|
1623
2754
|
value: "",
|
|
1624
2755
|
children: "Select field…"
|
|
1625
|
-
}), e.map((e) => /* @__PURE__ */
|
|
2756
|
+
}), e.map((e) => /* @__PURE__ */ k("option", {
|
|
1626
2757
|
value: e.value,
|
|
1627
2758
|
children: e.label
|
|
1628
2759
|
}, e.value))]
|
|
1629
|
-
})] }), /* @__PURE__ */
|
|
2760
|
+
})] }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("label", {
|
|
1630
2761
|
className: "text-[10px] text-muted-foreground",
|
|
1631
2762
|
children: "Y-axis field"
|
|
1632
|
-
}), /* @__PURE__ */
|
|
2763
|
+
}), /* @__PURE__ */ A("select", {
|
|
1633
2764
|
className: "w-full h-7 text-xs border rounded px-2 bg-background",
|
|
1634
2765
|
value: o,
|
|
1635
2766
|
onChange: (e) => s({ yAxis: e.target.value || void 0 }),
|
|
1636
2767
|
"data-testid": "chart-y-field",
|
|
1637
|
-
children: [/* @__PURE__ */
|
|
2768
|
+
children: [/* @__PURE__ */ k("option", {
|
|
1638
2769
|
value: "",
|
|
1639
2770
|
children: "Select field…"
|
|
1640
|
-
}), e.filter((e) => e.type === "number").map((e) => /* @__PURE__ */
|
|
2771
|
+
}), e.filter((e) => e.type === "number").map((e) => /* @__PURE__ */ k("option", {
|
|
1641
2772
|
value: e.value,
|
|
1642
2773
|
children: e.label
|
|
1643
2774
|
}, e.value))]
|
|
1644
2775
|
})] })] })]
|
|
1645
2776
|
});
|
|
1646
2777
|
}
|
|
1647
|
-
var
|
|
2778
|
+
var st = [
|
|
1648
2779
|
{
|
|
1649
2780
|
value: "equals",
|
|
1650
2781
|
label: "="
|
|
@@ -1666,7 +2797,7 @@ var ue = [
|
|
|
1666
2797
|
label: "Contains"
|
|
1667
2798
|
}
|
|
1668
2799
|
];
|
|
1669
|
-
function
|
|
2800
|
+
function ct({ availableFields: e, value: t, onChange: n }) {
|
|
1670
2801
|
let r = Array.isArray(t) ? t : [], i = () => {
|
|
1671
2802
|
n([...r, {
|
|
1672
2803
|
field: e[0]?.value || "",
|
|
@@ -1675,75 +2806,75 @@ function de({ availableFields: e, value: t, onChange: n }) {
|
|
|
1675
2806
|
backgroundColor: "#fef9c3",
|
|
1676
2807
|
textColor: ""
|
|
1677
2808
|
}]);
|
|
1678
|
-
},
|
|
2809
|
+
}, a = (e) => {
|
|
1679
2810
|
n(r.filter((t, n) => n !== e));
|
|
1680
|
-
},
|
|
2811
|
+
}, o = (e, t) => {
|
|
1681
2812
|
n(r.map((n, r) => r === e ? {
|
|
1682
2813
|
...n,
|
|
1683
2814
|
...t
|
|
1684
2815
|
} : n));
|
|
1685
2816
|
};
|
|
1686
|
-
return /* @__PURE__ */
|
|
2817
|
+
return /* @__PURE__ */ A("div", {
|
|
1687
2818
|
className: "space-y-2 py-1",
|
|
1688
2819
|
"data-testid": "conditional-format-rules",
|
|
1689
|
-
children: [r.map((t, n) => /* @__PURE__ */
|
|
2820
|
+
children: [r.map((t, n) => /* @__PURE__ */ A("div", {
|
|
1690
2821
|
className: "flex items-center gap-1 text-[10px] p-1 border rounded bg-muted/20",
|
|
1691
2822
|
children: [
|
|
1692
|
-
/* @__PURE__ */
|
|
2823
|
+
/* @__PURE__ */ k("select", {
|
|
1693
2824
|
className: "h-5 text-[10px] border rounded px-1 bg-background flex-1",
|
|
1694
2825
|
value: t.field,
|
|
1695
|
-
onChange: (e) =>
|
|
2826
|
+
onChange: (e) => o(n, { field: e.target.value }),
|
|
1696
2827
|
"data-testid": `cf-rule-field-${n}`,
|
|
1697
|
-
children: e.map((e) => /* @__PURE__ */
|
|
2828
|
+
children: e.map((e) => /* @__PURE__ */ k("option", {
|
|
1698
2829
|
value: e.value,
|
|
1699
2830
|
children: e.label
|
|
1700
2831
|
}, e.value))
|
|
1701
2832
|
}),
|
|
1702
|
-
/* @__PURE__ */
|
|
2833
|
+
/* @__PURE__ */ k("select", {
|
|
1703
2834
|
className: "h-5 text-[10px] border rounded px-1 bg-background w-12",
|
|
1704
2835
|
value: t.operator,
|
|
1705
|
-
onChange: (e) =>
|
|
1706
|
-
children:
|
|
2836
|
+
onChange: (e) => o(n, { operator: e.target.value }),
|
|
2837
|
+
children: st.map((e) => /* @__PURE__ */ k("option", {
|
|
1707
2838
|
value: e.value,
|
|
1708
2839
|
children: e.label
|
|
1709
2840
|
}, e.value))
|
|
1710
2841
|
}),
|
|
1711
|
-
/* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ k("input", {
|
|
1712
2843
|
className: "h-5 text-[10px] border rounded px-1 bg-background w-16",
|
|
1713
2844
|
value: t.value,
|
|
1714
2845
|
placeholder: "value",
|
|
1715
|
-
onChange: (e) =>
|
|
2846
|
+
onChange: (e) => o(n, { value: e.target.value }),
|
|
1716
2847
|
"data-testid": `cf-rule-value-${n}`
|
|
1717
2848
|
}),
|
|
1718
|
-
/* @__PURE__ */
|
|
2849
|
+
/* @__PURE__ */ k("input", {
|
|
1719
2850
|
type: "color",
|
|
1720
2851
|
className: "h-5 w-5 rounded border cursor-pointer",
|
|
1721
2852
|
value: t.backgroundColor || "#fef9c3",
|
|
1722
|
-
onChange: (e) =>
|
|
2853
|
+
onChange: (e) => o(n, { backgroundColor: e.target.value }),
|
|
1723
2854
|
title: "Background color"
|
|
1724
2855
|
}),
|
|
1725
|
-
/* @__PURE__ */
|
|
2856
|
+
/* @__PURE__ */ k(d, {
|
|
1726
2857
|
type: "button",
|
|
1727
2858
|
size: "sm",
|
|
1728
2859
|
variant: "ghost",
|
|
1729
2860
|
className: "h-5 w-5 p-0",
|
|
1730
|
-
onClick: () =>
|
|
2861
|
+
onClick: () => a(n),
|
|
1731
2862
|
"data-testid": `cf-rule-remove-${n}`,
|
|
1732
|
-
children: /* @__PURE__ */
|
|
2863
|
+
children: /* @__PURE__ */ k(z, { className: "h-3 w-3" })
|
|
1733
2864
|
})
|
|
1734
2865
|
]
|
|
1735
|
-
}, n)), /* @__PURE__ */
|
|
2866
|
+
}, n)), /* @__PURE__ */ A(d, {
|
|
1736
2867
|
type: "button",
|
|
1737
2868
|
size: "sm",
|
|
1738
2869
|
variant: "outline",
|
|
1739
2870
|
className: "h-6 text-[10px] w-full",
|
|
1740
2871
|
onClick: i,
|
|
1741
2872
|
"data-testid": "cf-add-rule",
|
|
1742
|
-
children: [/* @__PURE__ */
|
|
2873
|
+
children: [/* @__PURE__ */ k(L, { className: "h-3 w-3 mr-1" }), "Add Rule"]
|
|
1743
2874
|
})]
|
|
1744
2875
|
});
|
|
1745
2876
|
}
|
|
1746
|
-
var
|
|
2877
|
+
var lt = [
|
|
1747
2878
|
{
|
|
1748
2879
|
value: "header",
|
|
1749
2880
|
label: "Header"
|
|
@@ -1765,7 +2896,7 @@ var fe = [
|
|
|
1765
2896
|
label: "Text"
|
|
1766
2897
|
}
|
|
1767
2898
|
];
|
|
1768
|
-
function
|
|
2899
|
+
function ut({ value: e, onChange: t }) {
|
|
1769
2900
|
let n = Array.isArray(e) ? e : [], r = (e) => {
|
|
1770
2901
|
t([...n, {
|
|
1771
2902
|
type: e,
|
|
@@ -1774,77 +2905,77 @@ function pe({ value: e, onChange: t }) {
|
|
|
1774
2905
|
}]);
|
|
1775
2906
|
}, i = (e) => {
|
|
1776
2907
|
t(n.filter((t, n) => n !== e));
|
|
1777
|
-
},
|
|
2908
|
+
}, a = (e, r) => {
|
|
1778
2909
|
t(n.map((t, n) => n === e ? {
|
|
1779
2910
|
...t,
|
|
1780
2911
|
...r
|
|
1781
2912
|
} : t));
|
|
1782
|
-
},
|
|
2913
|
+
}, o = (e, r) => {
|
|
1783
2914
|
let i = e + r;
|
|
1784
2915
|
if (i < 0 || i >= n.length) return;
|
|
1785
2916
|
let a = [...n];
|
|
1786
2917
|
[a[e], a[i]] = [a[i], a[e]], t(a);
|
|
1787
2918
|
};
|
|
1788
|
-
return /* @__PURE__ */
|
|
2919
|
+
return /* @__PURE__ */ A("div", {
|
|
1789
2920
|
className: "space-y-2 py-1",
|
|
1790
2921
|
"data-testid": "section-manager",
|
|
1791
|
-
children: [n.map((e, t) => /* @__PURE__ */
|
|
2922
|
+
children: [n.map((e, t) => /* @__PURE__ */ A("div", {
|
|
1792
2923
|
className: "flex items-center gap-1 text-[10px] p-1.5 border rounded bg-muted/20",
|
|
1793
2924
|
children: [
|
|
1794
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ A("div", {
|
|
1795
2926
|
className: "flex flex-col gap-0.5 mr-1",
|
|
1796
|
-
children: [/* @__PURE__ */
|
|
2927
|
+
children: [/* @__PURE__ */ k("button", {
|
|
1797
2928
|
type: "button",
|
|
1798
2929
|
className: "text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1799
2930
|
disabled: t === 0,
|
|
1800
|
-
onClick: () =>
|
|
2931
|
+
onClick: () => o(t, -1),
|
|
1801
2932
|
"data-testid": `section-up-${t}`,
|
|
1802
2933
|
children: "▲"
|
|
1803
|
-
}), /* @__PURE__ */
|
|
2934
|
+
}), /* @__PURE__ */ k("button", {
|
|
1804
2935
|
type: "button",
|
|
1805
2936
|
className: "text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1806
2937
|
disabled: t === n.length - 1,
|
|
1807
|
-
onClick: () =>
|
|
2938
|
+
onClick: () => o(t, 1),
|
|
1808
2939
|
"data-testid": `section-down-${t}`,
|
|
1809
2940
|
children: "▼"
|
|
1810
2941
|
})]
|
|
1811
2942
|
}),
|
|
1812
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ k("span", {
|
|
1813
2944
|
className: "text-[9px] bg-muted px-1.5 py-0.5 rounded uppercase font-medium shrink-0",
|
|
1814
2945
|
children: e.type
|
|
1815
2946
|
}),
|
|
1816
|
-
/* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ k("input", {
|
|
1817
2948
|
className: "h-5 text-[10px] border rounded px-1 bg-background flex-1 min-w-0",
|
|
1818
2949
|
value: e.title || "",
|
|
1819
2950
|
placeholder: "Section title",
|
|
1820
|
-
onChange: (e) =>
|
|
2951
|
+
onChange: (e) => a(t, { title: e.target.value }),
|
|
1821
2952
|
"data-testid": `section-title-${t}`
|
|
1822
2953
|
}),
|
|
1823
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ k(d, {
|
|
1824
2955
|
type: "button",
|
|
1825
2956
|
size: "sm",
|
|
1826
2957
|
variant: "ghost",
|
|
1827
2958
|
className: "h-5 w-5 p-0 shrink-0",
|
|
1828
2959
|
onClick: () => i(t),
|
|
1829
2960
|
"data-testid": `section-remove-${t}`,
|
|
1830
|
-
children: /* @__PURE__ */
|
|
2961
|
+
children: /* @__PURE__ */ k(z, { className: "h-3 w-3" })
|
|
1831
2962
|
})
|
|
1832
2963
|
]
|
|
1833
|
-
}, t)), /* @__PURE__ */
|
|
2964
|
+
}, t)), /* @__PURE__ */ k("div", {
|
|
1834
2965
|
className: "flex gap-1 flex-wrap",
|
|
1835
|
-
children:
|
|
2966
|
+
children: lt.map((e) => /* @__PURE__ */ A(d, {
|
|
1836
2967
|
type: "button",
|
|
1837
2968
|
size: "sm",
|
|
1838
2969
|
variant: "outline",
|
|
1839
2970
|
className: "h-6 text-[10px]",
|
|
1840
2971
|
onClick: () => r(e.value),
|
|
1841
2972
|
"data-testid": `section-add-${e.value}`,
|
|
1842
|
-
children: [/* @__PURE__ */
|
|
2973
|
+
children: [/* @__PURE__ */ k(L, { className: "h-3 w-3 mr-0.5" }), e.label]
|
|
1843
2974
|
}, e.value))
|
|
1844
2975
|
})]
|
|
1845
2976
|
});
|
|
1846
2977
|
}
|
|
1847
|
-
function
|
|
2978
|
+
function dt(e = []) {
|
|
1848
2979
|
return {
|
|
1849
2980
|
breadcrumb: ["Report", "Configuration"],
|
|
1850
2981
|
sections: [
|
|
@@ -1914,7 +3045,7 @@ function me(e = []) {
|
|
|
1914
3045
|
key: "columns",
|
|
1915
3046
|
label: "Report columns",
|
|
1916
3047
|
type: "custom",
|
|
1917
|
-
render: (t, n) => /* @__PURE__ */
|
|
3048
|
+
render: (t, n) => /* @__PURE__ */ k(it, {
|
|
1918
3049
|
availableFields: e,
|
|
1919
3050
|
value: t,
|
|
1920
3051
|
onChange: n
|
|
@@ -1942,7 +3073,7 @@ function me(e = []) {
|
|
|
1942
3073
|
key: "groupingsDown",
|
|
1943
3074
|
label: "Grouping",
|
|
1944
3075
|
type: "custom",
|
|
1945
|
-
render: (t, n) => /* @__PURE__ */
|
|
3076
|
+
render: (t, n) => /* @__PURE__ */ k(S, {
|
|
1946
3077
|
fields: e,
|
|
1947
3078
|
value: Array.isArray(t) ? t.map((e) => ({
|
|
1948
3079
|
...e,
|
|
@@ -1967,7 +3098,7 @@ function me(e = []) {
|
|
|
1967
3098
|
key: "chart",
|
|
1968
3099
|
label: "Chart",
|
|
1969
3100
|
type: "custom",
|
|
1970
|
-
render: (t, n) => /* @__PURE__ */
|
|
3101
|
+
render: (t, n) => /* @__PURE__ */ k(ot, {
|
|
1971
3102
|
availableFields: e,
|
|
1972
3103
|
value: t,
|
|
1973
3104
|
onChange: n
|
|
@@ -1984,7 +3115,7 @@ function me(e = []) {
|
|
|
1984
3115
|
key: "conditionalFormatting",
|
|
1985
3116
|
label: "Rules",
|
|
1986
3117
|
type: "custom",
|
|
1987
|
-
render: (t, n) => /* @__PURE__ */
|
|
3118
|
+
render: (t, n) => /* @__PURE__ */ k(ct, {
|
|
1988
3119
|
availableFields: e,
|
|
1989
3120
|
value: t,
|
|
1990
3121
|
onChange: n
|
|
@@ -2001,7 +3132,7 @@ function me(e = []) {
|
|
|
2001
3132
|
key: "sections",
|
|
2002
3133
|
label: "Report sections",
|
|
2003
3134
|
type: "custom",
|
|
2004
|
-
render: (e, t) => /* @__PURE__ */
|
|
3135
|
+
render: (e, t) => /* @__PURE__ */ k(ut, {
|
|
2005
3136
|
value: e,
|
|
2006
3137
|
onChange: t
|
|
2007
3138
|
})
|
|
@@ -2064,7 +3195,7 @@ function me(e = []) {
|
|
|
2064
3195
|
key: "schedule",
|
|
2065
3196
|
label: "Schedule",
|
|
2066
3197
|
type: "custom",
|
|
2067
|
-
render: (e, t) => /* @__PURE__ */
|
|
3198
|
+
render: (e, t) => /* @__PURE__ */ k(tt, {
|
|
2068
3199
|
schedule: e,
|
|
2069
3200
|
onChange: t
|
|
2070
3201
|
})
|
|
@@ -2108,30 +3239,30 @@ function me(e = []) {
|
|
|
2108
3239
|
]
|
|
2109
3240
|
};
|
|
2110
3241
|
}
|
|
2111
|
-
function
|
|
2112
|
-
let { draft: s, isDirty: c, updateField: l, discard: u, undo: d, redo:
|
|
2113
|
-
return /* @__PURE__ */
|
|
3242
|
+
function ft({ open: e, onClose: n, config: r, onSave: i, onFieldChange: a, availableFields: o }) {
|
|
3243
|
+
let { draft: s, isDirty: c, updateField: l, discard: u, undo: d, redo: f, canUndo: p, canRedo: m } = D(r, { onUpdate: a });
|
|
3244
|
+
return /* @__PURE__ */ k(v, {
|
|
2114
3245
|
open: e,
|
|
2115
3246
|
onClose: n,
|
|
2116
|
-
schema: t.useMemo(() =>
|
|
3247
|
+
schema: t.useMemo(() => dt(o), [o]),
|
|
2117
3248
|
draft: s,
|
|
2118
3249
|
isDirty: c,
|
|
2119
3250
|
onFieldChange: l,
|
|
2120
3251
|
onSave: () => i(s),
|
|
2121
3252
|
onDiscard: u,
|
|
2122
3253
|
onUndo: d,
|
|
2123
|
-
onRedo:
|
|
2124
|
-
canUndo:
|
|
2125
|
-
canRedo:
|
|
3254
|
+
onRedo: f,
|
|
3255
|
+
canUndo: p,
|
|
3256
|
+
canRedo: m
|
|
2126
3257
|
});
|
|
2127
3258
|
}
|
|
2128
3259
|
//#endregion
|
|
2129
3260
|
//#region src/LiveReportExporter.ts
|
|
2130
|
-
async function
|
|
3261
|
+
async function pt(e, t) {
|
|
2131
3262
|
let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o } = t, s = a || e.defaultExportFormat || "pdf";
|
|
2132
3263
|
try {
|
|
2133
3264
|
let t = (await n.find(r, i)).data || [];
|
|
2134
|
-
return
|
|
3265
|
+
return qe(s, e, t, {
|
|
2135
3266
|
format: s,
|
|
2136
3267
|
...e.exportConfigs?.[s],
|
|
2137
3268
|
...o
|
|
@@ -2149,17 +3280,17 @@ async function $(e, t) {
|
|
|
2149
3280
|
};
|
|
2150
3281
|
}
|
|
2151
3282
|
}
|
|
2152
|
-
function
|
|
2153
|
-
let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(
|
|
3283
|
+
function mt(e, t, n = {}) {
|
|
3284
|
+
let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(gt), s = o.map((e) => e.header), c = t.map((e, t) => o.map((n) => {
|
|
2154
3285
|
if (n.formula) return n.formula.replace(/\{ROW\}/g, String(t + 2));
|
|
2155
3286
|
let r = e[n.name];
|
|
2156
|
-
return
|
|
3287
|
+
return _t(r, n.numberFormat);
|
|
2157
3288
|
}));
|
|
2158
3289
|
if (a && t.length > 0) {
|
|
2159
3290
|
let n = o.map((n, r) => {
|
|
2160
3291
|
let i = (e.fields || []).find((e) => e.name === n.name);
|
|
2161
3292
|
if (i?.aggregation) {
|
|
2162
|
-
let e =
|
|
3293
|
+
let e = yt(r), n = t.length + 1;
|
|
2163
3294
|
switch (i.aggregation) {
|
|
2164
3295
|
case "sum": return `=SUM(${e}2:${e}${n})`;
|
|
2165
3296
|
case "avg": return `=AVERAGE(${e}2:${e}${n})`;
|
|
@@ -2173,15 +3304,15 @@ function ge(e, t, n = {}) {
|
|
|
2173
3304
|
});
|
|
2174
3305
|
c.push(n);
|
|
2175
3306
|
}
|
|
2176
|
-
|
|
3307
|
+
xt("" + [s.join(" "), ...c.map((e) => e.join(" "))].join("\n"), i || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
2177
3308
|
}
|
|
2178
|
-
function
|
|
3309
|
+
function ht(e, t, n, r) {
|
|
2179
3310
|
return async () => {
|
|
2180
3311
|
let i = e.schedule;
|
|
2181
3312
|
if (!i?.enabled) return [];
|
|
2182
3313
|
let a = i.formats || [e.defaultExportFormat || "pdf"], o = [];
|
|
2183
3314
|
for (let r of a) {
|
|
2184
|
-
let i = await
|
|
3315
|
+
let i = await pt(e, {
|
|
2185
3316
|
dataSource: t,
|
|
2186
3317
|
resource: n,
|
|
2187
3318
|
format: r
|
|
@@ -2191,16 +3322,16 @@ function _e(e, t, n, r) {
|
|
|
2191
3322
|
return r(e, i), o;
|
|
2192
3323
|
};
|
|
2193
3324
|
}
|
|
2194
|
-
function
|
|
3325
|
+
function gt(e) {
|
|
2195
3326
|
return {
|
|
2196
3327
|
name: e.name,
|
|
2197
3328
|
header: e.label || e.name
|
|
2198
3329
|
};
|
|
2199
3330
|
}
|
|
2200
|
-
function
|
|
2201
|
-
return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US",
|
|
3331
|
+
function _t(e, t) {
|
|
3332
|
+
return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US", vt(t)) : bt(String(e));
|
|
2202
3333
|
}
|
|
2203
|
-
function
|
|
3334
|
+
function vt(e) {
|
|
2204
3335
|
if (e.includes("%")) return {
|
|
2205
3336
|
style: "percent",
|
|
2206
3337
|
minimumFractionDigits: 0
|
|
@@ -2211,23 +3342,23 @@ function be(e) {
|
|
|
2211
3342
|
maximumFractionDigits: Math.max(0, t - 1)
|
|
2212
3343
|
};
|
|
2213
3344
|
}
|
|
2214
|
-
function
|
|
3345
|
+
function yt(e) {
|
|
2215
3346
|
let t = "", n = e;
|
|
2216
3347
|
for (; n >= 0;) t = String.fromCharCode(n % 26 + 65) + t, n = Math.floor(n / 26) - 1;
|
|
2217
3348
|
return t;
|
|
2218
3349
|
}
|
|
2219
|
-
function
|
|
3350
|
+
function bt(e) {
|
|
2220
3351
|
if (e.length > 0) {
|
|
2221
3352
|
let t = e.charAt(0);
|
|
2222
3353
|
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `'${e}`;
|
|
2223
3354
|
}
|
|
2224
3355
|
return e;
|
|
2225
3356
|
}
|
|
2226
|
-
function
|
|
3357
|
+
function xt(e, t, n) {
|
|
2227
3358
|
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2228
3359
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
2229
3360
|
}
|
|
2230
|
-
e.register("report",
|
|
3361
|
+
e.register("report", X, {
|
|
2231
3362
|
namespace: "report",
|
|
2232
3363
|
label: "Report",
|
|
2233
3364
|
category: "Report",
|
|
@@ -2248,7 +3379,20 @@ e.register("report", L, {
|
|
|
2248
3379
|
label: "Chart Configuration"
|
|
2249
3380
|
}
|
|
2250
3381
|
]
|
|
2251
|
-
}), e.register("report
|
|
3382
|
+
}), e.register("spec-report", X, {
|
|
3383
|
+
namespace: "report",
|
|
3384
|
+
label: "Spec Report",
|
|
3385
|
+
category: "Report",
|
|
3386
|
+
inputs: [{
|
|
3387
|
+
name: "objectName",
|
|
3388
|
+
type: "string",
|
|
3389
|
+
label: "Object Name"
|
|
3390
|
+
}, {
|
|
3391
|
+
name: "type",
|
|
3392
|
+
type: "string",
|
|
3393
|
+
label: "Report Type"
|
|
3394
|
+
}]
|
|
3395
|
+
}), e.register("report-viewer", et, {
|
|
2252
3396
|
namespace: "report",
|
|
2253
3397
|
label: "Report Viewer",
|
|
2254
3398
|
category: "Report",
|
|
@@ -2261,7 +3405,7 @@ e.register("report", L, {
|
|
|
2261
3405
|
type: "boolean",
|
|
2262
3406
|
label: "Show Toolbar"
|
|
2263
3407
|
}]
|
|
2264
|
-
}), e.register("report-builder",
|
|
3408
|
+
}), e.register("report-builder", nt, {
|
|
2265
3409
|
namespace: "report",
|
|
2266
3410
|
label: "Report Builder",
|
|
2267
3411
|
category: "Report",
|
|
@@ -2272,4 +3416,4 @@ e.register("report", L, {
|
|
|
2272
3416
|
}]
|
|
2273
3417
|
});
|
|
2274
3418
|
//#endregion
|
|
2275
|
-
export {
|
|
3419
|
+
export { Be as JoinedReportRenderer, B as LegacyReportRenderer, Le as MatrixRenderer, nt as ReportBuilder, ft as ReportConfigPanel, X as ReportRenderer, et as ReportViewer, tt as ScheduleConfig, Me as SpecReportGrid, W as aggregateRows, H as bucketDate, _e as buildAggregateQuery, we as buildDrillAction, ge as collectFields, V as columnKey, Ee as createDrillHandler, ht as createScheduleTrigger, He as exportAsCSV, Ke as exportAsExcel, We as exportAsHTML, Ue as exportAsJSON, Ge as exportAsPDF, mt as exportExcelWithFormulas, qe as exportReport, pt as exportWithLiveData, $ as formatValue, le as groupAndAggregate, U as groupingValue, Te as isDrillAction, K as mergeFilters, ue as pivotRows, De as registerDrillHandler, ye as useReportData };
|