@object-ui/plugin-report 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2346 -2140
- package/dist/index.umd.cjs +21 -37
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1,356 +1,268 @@
|
|
|
1
|
-
import { ComponentRegistry as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { SchemaRenderer as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
function v(l) {
|
|
240
|
-
S(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === L && (l._payload.status === "fulfilled" ? S(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1));
|
|
241
|
-
}
|
|
242
|
-
function S(l) {
|
|
243
|
-
return typeof l == "object" && l !== null && l.$$typeof === _;
|
|
244
|
-
}
|
|
245
|
-
var w = ve, _ = Symbol.for("react.transitional.element"), k = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), y = Symbol.for("react.consumer"), g = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), L = Symbol.for("react.lazy"), B = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), I = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, re = Object.prototype.hasOwnProperty, ie = Array.isArray, d = console.createTask ? console.createTask : function() {
|
|
246
|
-
return null;
|
|
247
|
-
};
|
|
248
|
-
w = {
|
|
249
|
-
react_stack_bottom_frame: function(l) {
|
|
250
|
-
return l();
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
var h, f = {}, O = w.react_stack_bottom_frame.bind(
|
|
254
|
-
w,
|
|
255
|
-
x
|
|
256
|
-
)(), Q = d(o(x)), K = {};
|
|
257
|
-
te.Fragment = m, te.jsx = function(l, b, R) {
|
|
258
|
-
var A = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
259
|
-
return p(
|
|
260
|
-
l,
|
|
261
|
-
b,
|
|
262
|
-
R,
|
|
263
|
-
!1,
|
|
264
|
-
A ? Error("react-stack-top-frame") : O,
|
|
265
|
-
A ? d(o(l)) : Q
|
|
266
|
-
);
|
|
267
|
-
}, te.jsxs = function(l, b, R) {
|
|
268
|
-
var A = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
269
|
-
return p(
|
|
270
|
-
l,
|
|
271
|
-
b,
|
|
272
|
-
R,
|
|
273
|
-
!0,
|
|
274
|
-
A ? Error("react-stack-top-frame") : O,
|
|
275
|
-
A ? d(o(l)) : Q
|
|
276
|
-
);
|
|
277
|
-
};
|
|
278
|
-
}()), te;
|
|
279
|
-
}
|
|
280
|
-
process.env.NODE_ENV === "production" ? pe.exports = Ue() : pe.exports = Ve();
|
|
281
|
-
var e = pe.exports;
|
|
282
|
-
const Ye = ({ schema: s }) => {
|
|
283
|
-
var i;
|
|
284
|
-
const { title: n, description: a, data: o, columns: c } = s;
|
|
285
|
-
(i = s.chart) != null && i.type;
|
|
286
|
-
const x = !!s.chart, t = !(process.env.NODE_ENV === "test");
|
|
287
|
-
return /* @__PURE__ */ e.jsxs(V, { className: `h-full flex flex-col ${s.className || ""}`, children: [
|
|
288
|
-
/* @__PURE__ */ e.jsxs(ae, { children: [
|
|
289
|
-
n && /* @__PURE__ */ e.jsx(se, { children: n }),
|
|
290
|
-
a && /* @__PURE__ */ e.jsx(he, { children: a })
|
|
291
|
-
] }),
|
|
292
|
-
/* @__PURE__ */ e.jsxs(Y, { className: "flex-1 overflow-auto space-y-4", children: [
|
|
293
|
-
x && (() => {
|
|
294
|
-
var v;
|
|
295
|
-
const r = (v = s.chart) == null ? void 0 : v.type;
|
|
296
|
-
let p = r ? U.get(r) : null;
|
|
297
|
-
return p || (p = U.get("chart")), p ? /* @__PURE__ */ e.jsx("div", { className: "min-h-[300px] border rounded-lg p-4 bg-background/50", children: /* @__PURE__ */ e.jsx(p, { schema: { ...s.chart, data: s.chart.data || o } }) }) : /* @__PURE__ */ e.jsxs("div", { className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center", children: [
|
|
298
|
-
"Unknown component type: ",
|
|
299
|
-
r || "chart"
|
|
300
|
-
] });
|
|
301
|
-
})(),
|
|
302
|
-
o && o.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg", children: (() => {
|
|
303
|
-
const r = t ? U.get("aggrid") || U.get("table") : null;
|
|
304
|
-
return r ? /* @__PURE__ */ e.jsx(
|
|
305
|
-
r,
|
|
306
|
-
{
|
|
307
|
-
schema: {
|
|
308
|
-
type: "aggrid",
|
|
309
|
-
rowData: o,
|
|
310
|
-
columnDefs: c,
|
|
311
|
-
domLayout: "autoHeight"
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
) : (
|
|
315
|
-
// Simple Fallback Table if Grid plugin missing
|
|
316
|
-
/* @__PURE__ */ e.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm text-left", children: [
|
|
317
|
-
/* @__PURE__ */ e.jsx("thead", { className: "text-xs uppercase bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: c == null ? void 0 : c.map((p) => /* @__PURE__ */ e.jsx("th", { className: "px-6 py-3", children: p.headerName || p.label || p.field }, p.field)) }) }),
|
|
318
|
-
/* @__PURE__ */ e.jsx("tbody", { children: o.map((p, v) => /* @__PURE__ */ e.jsx("tr", { className: "bg-background border-b", children: c == null ? void 0 : c.map((S) => /* @__PURE__ */ e.jsx("td", { className: "px-6 py-4", children: p[S.field] }, S.field)) }, v)) })
|
|
319
|
-
] }) })
|
|
320
|
-
);
|
|
321
|
-
})() })
|
|
322
|
-
] })
|
|
323
|
-
] });
|
|
1
|
+
import { ComponentRegistry as e } from "@object-ui/core";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import n, { useState as r } from "react";
|
|
4
|
+
import { Badge as i, Button as a, Card as o, CardContent as s, CardDescription as c, CardHeader as l, CardTitle as u, Checkbox as d, ConfigPanelRenderer as f, Input as p, Label as m, Skeleton as h, Tabs as g, TabsContent as _, TabsList as v, TabsTrigger as y, useConfigDraft as b } from "@object-ui/components";
|
|
5
|
+
import { SchemaRenderer as x } from "@object-ui/react";
|
|
6
|
+
import { Calendar as S, Clock as C, Download as w, Filter as T, Layers as E, Mail as D, Plus as O, Printer as k, RefreshCw as A, Save as j, Settings as M, Trash2 as N } from "lucide-react";
|
|
7
|
+
//#region \0rolldown/runtime.js
|
|
8
|
+
var P = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), F = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
9
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
10
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
11
|
+
}), I = /* @__PURE__ */ P(((e) => {
|
|
12
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
13
|
+
function r(e, n, r) {
|
|
14
|
+
var i = null;
|
|
15
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
16
|
+
else r = n;
|
|
17
|
+
return n = r.ref, {
|
|
18
|
+
$$typeof: t,
|
|
19
|
+
type: e,
|
|
20
|
+
key: i,
|
|
21
|
+
ref: n === void 0 ? null : n,
|
|
22
|
+
props: r
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
26
|
+
})), L = /* @__PURE__ */ P(((e) => {
|
|
27
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
28
|
+
function t(e) {
|
|
29
|
+
if (e == null) return null;
|
|
30
|
+
if (typeof e == "function") return e.$$typeof === O ? null : e.displayName || e.name || null;
|
|
31
|
+
if (typeof e == "string") return e;
|
|
32
|
+
switch (e) {
|
|
33
|
+
case _: return "Fragment";
|
|
34
|
+
case y: return "Profiler";
|
|
35
|
+
case v: return "StrictMode";
|
|
36
|
+
case C: return "Suspense";
|
|
37
|
+
case w: return "SuspenseList";
|
|
38
|
+
case D: return "Activity";
|
|
39
|
+
}
|
|
40
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
41
|
+
case g: return "Portal";
|
|
42
|
+
case x: return e.displayName || "Context";
|
|
43
|
+
case b: return (e._context.displayName || "Context") + ".Consumer";
|
|
44
|
+
case S:
|
|
45
|
+
var n = e.render;
|
|
46
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
47
|
+
case T: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
48
|
+
case E:
|
|
49
|
+
n = e._payload, e = e._init;
|
|
50
|
+
try {
|
|
51
|
+
return t(e(n));
|
|
52
|
+
} catch {}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function n(e) {
|
|
57
|
+
return "" + e;
|
|
58
|
+
}
|
|
59
|
+
function r(e) {
|
|
60
|
+
try {
|
|
61
|
+
n(e);
|
|
62
|
+
var t = !1;
|
|
63
|
+
} catch {
|
|
64
|
+
t = !0;
|
|
65
|
+
}
|
|
66
|
+
if (t) {
|
|
67
|
+
t = console;
|
|
68
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
69
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function i(e) {
|
|
73
|
+
if (e === _) return "<>";
|
|
74
|
+
if (typeof e == "object" && e && e.$$typeof === E) return "<...>";
|
|
75
|
+
try {
|
|
76
|
+
var n = t(e);
|
|
77
|
+
return n ? "<" + n + ">" : "<...>";
|
|
78
|
+
} catch {
|
|
79
|
+
return "<...>";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function a() {
|
|
83
|
+
var e = k.A;
|
|
84
|
+
return e === null ? null : e.getOwner();
|
|
85
|
+
}
|
|
86
|
+
function o() {
|
|
87
|
+
return Error("react-stack-top-frame");
|
|
88
|
+
}
|
|
89
|
+
function s(e) {
|
|
90
|
+
if (A.call(e, "key")) {
|
|
91
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
92
|
+
if (t && t.isReactWarning) return !1;
|
|
93
|
+
}
|
|
94
|
+
return e.key !== void 0;
|
|
95
|
+
}
|
|
96
|
+
function c(e, t) {
|
|
97
|
+
function n() {
|
|
98
|
+
N || (N = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
99
|
+
}
|
|
100
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
101
|
+
get: n,
|
|
102
|
+
configurable: !0
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function l() {
|
|
106
|
+
var e = t(this.type);
|
|
107
|
+
return P[e] || (P[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
108
|
+
}
|
|
109
|
+
function u(e, t, n, r, i, a) {
|
|
110
|
+
var o = n.ref;
|
|
111
|
+
return e = {
|
|
112
|
+
$$typeof: h,
|
|
113
|
+
type: e,
|
|
114
|
+
key: t,
|
|
115
|
+
props: n,
|
|
116
|
+
_owner: r
|
|
117
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
118
|
+
enumerable: !1,
|
|
119
|
+
value: null
|
|
120
|
+
}) : Object.defineProperty(e, "ref", {
|
|
121
|
+
enumerable: !1,
|
|
122
|
+
get: l
|
|
123
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
124
|
+
configurable: !1,
|
|
125
|
+
enumerable: !1,
|
|
126
|
+
writable: !0,
|
|
127
|
+
value: 0
|
|
128
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
129
|
+
configurable: !1,
|
|
130
|
+
enumerable: !1,
|
|
131
|
+
writable: !0,
|
|
132
|
+
value: null
|
|
133
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
134
|
+
configurable: !1,
|
|
135
|
+
enumerable: !1,
|
|
136
|
+
writable: !0,
|
|
137
|
+
value: i
|
|
138
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
139
|
+
configurable: !1,
|
|
140
|
+
enumerable: !1,
|
|
141
|
+
writable: !0,
|
|
142
|
+
value: a
|
|
143
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
144
|
+
}
|
|
145
|
+
function d(e, n, i, o, l, d) {
|
|
146
|
+
var p = n.children;
|
|
147
|
+
if (p !== void 0) if (o) if (j(p)) {
|
|
148
|
+
for (o = 0; o < p.length; o++) f(p[o]);
|
|
149
|
+
Object.freeze && Object.freeze(p);
|
|
150
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
151
|
+
else f(p);
|
|
152
|
+
if (A.call(n, "key")) {
|
|
153
|
+
p = t(e);
|
|
154
|
+
var m = Object.keys(n).filter(function(e) {
|
|
155
|
+
return e !== "key";
|
|
156
|
+
});
|
|
157
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), R[p + o] = !0);
|
|
158
|
+
}
|
|
159
|
+
if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
160
|
+
else i = n;
|
|
161
|
+
return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
|
|
162
|
+
}
|
|
163
|
+
function f(e) {
|
|
164
|
+
p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === E && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
165
|
+
}
|
|
166
|
+
function p(e) {
|
|
167
|
+
return typeof e == "object" && !!e && e.$$typeof === h;
|
|
168
|
+
}
|
|
169
|
+
var m = F("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), k = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, j = Array.isArray, M = console.createTask ? console.createTask : function() {
|
|
170
|
+
return null;
|
|
171
|
+
};
|
|
172
|
+
m = { react_stack_bottom_frame: function(e) {
|
|
173
|
+
return e();
|
|
174
|
+
} };
|
|
175
|
+
var N, P = {}, I = m.react_stack_bottom_frame.bind(m, o)(), L = M(i(o)), R = {};
|
|
176
|
+
e.Fragment = _, e.jsx = function(e, t, n) {
|
|
177
|
+
var r = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
178
|
+
return d(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? M(i(e)) : L);
|
|
179
|
+
}, e.jsxs = function(e, t, n) {
|
|
180
|
+
var r = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
181
|
+
return d(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? M(i(e)) : L);
|
|
182
|
+
};
|
|
183
|
+
})();
|
|
184
|
+
})), R = (/* @__PURE__ */ P(((e, t) => {
|
|
185
|
+
process.env.NODE_ENV === "production" ? t.exports = I() : t.exports = L();
|
|
186
|
+
})))(), z = ({ schema: t }) => {
|
|
187
|
+
let { title: n, description: r, data: i, columns: a } = t;
|
|
188
|
+
t.chart?.type;
|
|
189
|
+
let d = !!t.chart, f = process.env.NODE_ENV !== "test";
|
|
190
|
+
return /* @__PURE__ */ (0, R.jsxs)(o, {
|
|
191
|
+
className: `h-full flex flex-col ${t.className || ""}`,
|
|
192
|
+
children: [/* @__PURE__ */ (0, R.jsxs)(l, { children: [n && /* @__PURE__ */ (0, R.jsx)(u, { children: n }), r && /* @__PURE__ */ (0, R.jsx)(c, { children: r })] }), /* @__PURE__ */ (0, R.jsxs)(s, {
|
|
193
|
+
className: "flex-1 overflow-auto space-y-4",
|
|
194
|
+
children: [d && (() => {
|
|
195
|
+
let n = t.chart?.type, r = n ? e.get(n) : null;
|
|
196
|
+
return r ||= e.get("chart"), r ? /* @__PURE__ */ (0, R.jsx)("div", {
|
|
197
|
+
className: "min-h-[300px] border rounded-lg p-4 bg-background/50",
|
|
198
|
+
children: /* @__PURE__ */ (0, R.jsx)(r, { schema: {
|
|
199
|
+
...t.chart,
|
|
200
|
+
data: t.chart.data || i
|
|
201
|
+
} })
|
|
202
|
+
}) : /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
203
|
+
className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center",
|
|
204
|
+
children: ["Unknown component type: ", n || "chart"]
|
|
205
|
+
});
|
|
206
|
+
})(), i && i.length > 0 && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
207
|
+
className: "border rounded-lg",
|
|
208
|
+
children: (() => {
|
|
209
|
+
let t = f ? e.get("aggrid") || e.get("table") : null;
|
|
210
|
+
return t ? /* @__PURE__ */ (0, R.jsx)(t, { schema: {
|
|
211
|
+
type: "aggrid",
|
|
212
|
+
rowData: i,
|
|
213
|
+
columnDefs: a,
|
|
214
|
+
domLayout: "autoHeight"
|
|
215
|
+
} }) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
216
|
+
className: "overflow-x-auto",
|
|
217
|
+
children: /* @__PURE__ */ (0, R.jsxs)("table", {
|
|
218
|
+
className: "w-full text-sm text-left",
|
|
219
|
+
children: [/* @__PURE__ */ (0, R.jsx)("thead", {
|
|
220
|
+
className: "text-xs uppercase bg-muted",
|
|
221
|
+
children: /* @__PURE__ */ (0, R.jsx)("tr", { children: a?.map((e) => /* @__PURE__ */ (0, R.jsx)("th", {
|
|
222
|
+
className: "px-6 py-3",
|
|
223
|
+
children: e.headerName || e.label || e.field
|
|
224
|
+
}, e.field)) })
|
|
225
|
+
}), /* @__PURE__ */ (0, R.jsx)("tbody", { children: i.map((e, t) => /* @__PURE__ */ (0, R.jsx)("tr", {
|
|
226
|
+
className: "bg-background border-b",
|
|
227
|
+
children: a?.map((t) => /* @__PURE__ */ (0, R.jsx)("td", {
|
|
228
|
+
className: "px-6 py-4",
|
|
229
|
+
children: e[t.field]
|
|
230
|
+
}, t.field))
|
|
231
|
+
}, t)) })]
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
})()
|
|
235
|
+
})]
|
|
236
|
+
})]
|
|
237
|
+
});
|
|
324
238
|
};
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
].join(`
|
|
334
|
-
`);
|
|
335
|
-
oe(u, (a == null ? void 0 : a.filename) || `${s.title || "report"}.csv`, "text/csv");
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/ReportExportEngine.ts
|
|
241
|
+
function B(e, t, n) {
|
|
242
|
+
let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
|
|
243
|
+
let n = e[t.name];
|
|
244
|
+
return n = q(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
245
|
+
}));
|
|
246
|
+
X([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
|
|
336
247
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
248
|
+
function V(e, t, n) {
|
|
249
|
+
let r = {
|
|
250
|
+
title: e.title,
|
|
251
|
+
description: e.description,
|
|
252
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
253
|
+
data: t
|
|
254
|
+
};
|
|
255
|
+
X(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
|
|
345
256
|
}
|
|
346
|
-
function
|
|
347
|
-
|
|
257
|
+
function H(e, t, n) {
|
|
258
|
+
let r = e.fields || [], i = Y(n?.orientation), a = J(n?.pageSize);
|
|
259
|
+
X(`<!DOCTYPE html>
|
|
348
260
|
<html>
|
|
349
261
|
<head>
|
|
350
262
|
<meta charset="utf-8">
|
|
351
|
-
<title>${
|
|
263
|
+
<title>${K(e.title || "Report")}</title>
|
|
352
264
|
<style>
|
|
353
|
-
@page { size: ${
|
|
265
|
+
@page { size: ${a} ${i}; margin: 20mm; }
|
|
354
266
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
355
267
|
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
356
268
|
.description { color: #666; margin-bottom: 24px; }
|
|
@@ -362,35 +274,33 @@ function ye(s, n, a) {
|
|
|
362
274
|
</style>
|
|
363
275
|
</head>
|
|
364
276
|
<body>
|
|
365
|
-
<h1>${
|
|
366
|
-
${
|
|
277
|
+
<h1>${K(e.title || "Report")}</h1>
|
|
278
|
+
${e.description ? `<p class="description">${K(e.description)}</p>` : ""}
|
|
367
279
|
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
368
280
|
<table>
|
|
369
|
-
<thead><tr>${
|
|
370
|
-
<tbody>${
|
|
281
|
+
<thead><tr>${r.map((e) => `<th>${K(e.label || e.name)}</th>`).join("")}</tr></thead>
|
|
282
|
+
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${K(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
371
283
|
</table>
|
|
372
284
|
</body>
|
|
373
|
-
</html
|
|
374
|
-
oe(u, (a == null ? void 0 : a.filename) || `${s.title || "report"}.html`, "text/html");
|
|
285
|
+
</html>`, n?.filename || `${e.title || "report"}.html`, "text/html");
|
|
375
286
|
}
|
|
376
|
-
function
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
u.document.write(`<!DOCTYPE html>
|
|
287
|
+
function U(e, t, n) {
|
|
288
|
+
let r = e.fields || [], i = Y(n?.orientation), a = J(n?.pageSize), o = window.open("", "_blank");
|
|
289
|
+
if (!o) {
|
|
290
|
+
H(e, t, {
|
|
291
|
+
...n,
|
|
292
|
+
format: "html",
|
|
293
|
+
filename: n?.filename?.replace(/\.pdf$/, ".html") || `${e.title || "report"}.html`
|
|
294
|
+
});
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
o.document.write(`<!DOCTYPE html>
|
|
388
298
|
<html>
|
|
389
299
|
<head>
|
|
390
300
|
<meta charset="utf-8">
|
|
391
|
-
<title>${
|
|
301
|
+
<title>${K(e.title || "Report")}</title>
|
|
392
302
|
<style>
|
|
393
|
-
@page { size: ${
|
|
303
|
+
@page { size: ${a} ${i}; margin: 20mm; }
|
|
394
304
|
@media print { .no-print { display: none; } }
|
|
395
305
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
396
306
|
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
@@ -403,1812 +313,2108 @@ function He(s, n, a) {
|
|
|
403
313
|
</style>
|
|
404
314
|
</head>
|
|
405
315
|
<body>
|
|
406
|
-
<h1>${
|
|
407
|
-
${
|
|
316
|
+
<h1>${K(e.title || "Report")}</h1>
|
|
317
|
+
${e.description ? `<p class="description">${K(e.description)}</p>` : ""}
|
|
408
318
|
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
409
319
|
<table>
|
|
410
|
-
<thead><tr>${
|
|
411
|
-
<tbody>${
|
|
320
|
+
<thead><tr>${r.map((e) => `<th>${K(e.label || e.name)}</th>`).join("")}</tr></thead>
|
|
321
|
+
<tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${K(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
412
322
|
</table>
|
|
413
323
|
</body>
|
|
414
|
-
</html>`),
|
|
415
|
-
|
|
416
|
-
|
|
324
|
+
</html>`), o.document.close(), o.onload = () => {
|
|
325
|
+
o.print();
|
|
326
|
+
};
|
|
417
327
|
}
|
|
418
|
-
function
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
...(a == null ? void 0 : a.includeHeaders) !== !1 ? [c.join(" ")] : [],
|
|
425
|
-
...x.map((t) => t.join(" "))
|
|
426
|
-
].join(`
|
|
427
|
-
`);
|
|
428
|
-
oe(u, (a == null ? void 0 : a.filename) || `${s.title || "report"}.tsv`, "text/tab-separated-values");
|
|
328
|
+
function W(e, t, n) {
|
|
329
|
+
let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
|
|
330
|
+
let n = e[t.name];
|
|
331
|
+
return n = q(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
|
|
332
|
+
}));
|
|
333
|
+
X("" + [...n?.includeHeaders === !1 ? [] : [i.join(" ")], ...a.map((e) => e.join(" "))].join("\n"), n?.filename || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
429
334
|
}
|
|
430
|
-
function
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
335
|
+
function G(e, t, n, r) {
|
|
336
|
+
switch (e) {
|
|
337
|
+
case "csv":
|
|
338
|
+
B(t, n, r);
|
|
339
|
+
break;
|
|
340
|
+
case "json":
|
|
341
|
+
V(t, n, r);
|
|
342
|
+
break;
|
|
343
|
+
case "html":
|
|
344
|
+
H(t, n, r);
|
|
345
|
+
break;
|
|
346
|
+
case "pdf":
|
|
347
|
+
U(t, n, r);
|
|
348
|
+
break;
|
|
349
|
+
case "excel":
|
|
350
|
+
W(t, n, r);
|
|
351
|
+
break;
|
|
352
|
+
default: console.warn(`Unsupported export format: ${e}`);
|
|
353
|
+
}
|
|
450
354
|
}
|
|
451
|
-
function
|
|
452
|
-
|
|
355
|
+
function K(e) {
|
|
356
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
453
357
|
}
|
|
454
|
-
function
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
return s;
|
|
358
|
+
function q(e) {
|
|
359
|
+
if (typeof e == "string" && e.length > 0) {
|
|
360
|
+
let t = e.charAt(0);
|
|
361
|
+
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `\t${e}`;
|
|
362
|
+
}
|
|
363
|
+
return e;
|
|
461
364
|
}
|
|
462
|
-
function
|
|
463
|
-
|
|
365
|
+
function J(e) {
|
|
366
|
+
return [
|
|
367
|
+
"A4",
|
|
368
|
+
"A3",
|
|
369
|
+
"Letter",
|
|
370
|
+
"Legal"
|
|
371
|
+
].includes(e || "") ? e : "A4";
|
|
464
372
|
}
|
|
465
|
-
function
|
|
466
|
-
|
|
373
|
+
function Y(e) {
|
|
374
|
+
return e === "landscape" ? "landscape" : "portrait";
|
|
467
375
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
470
|
-
|
|
376
|
+
function X(e, t, n) {
|
|
377
|
+
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
378
|
+
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
471
379
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/formatValue.ts
|
|
382
|
+
function Z(e, t) {
|
|
383
|
+
if (e == null || e === "") return "";
|
|
384
|
+
let n = t?.type, r = t?.format;
|
|
385
|
+
if (n === "date" || r === "date" || ee(e)) return te(e);
|
|
386
|
+
if (n === "number" || typeof e == "number") {
|
|
387
|
+
let t = typeof e == "number" ? e : Number(e);
|
|
388
|
+
return isNaN(t) ? String(e) : r === "currency" || r === "currency_cny" ? `¥${t.toLocaleString("en-US", {
|
|
389
|
+
minimumFractionDigits: 0,
|
|
390
|
+
maximumFractionDigits: 0
|
|
391
|
+
})}` : r === "currency_usd" ? `$${t.toLocaleString("en-US", {
|
|
392
|
+
minimumFractionDigits: 0,
|
|
393
|
+
maximumFractionDigits: 0
|
|
394
|
+
})}` : r === "percent" ? `${t.toLocaleString("en-US", {
|
|
395
|
+
minimumFractionDigits: 1,
|
|
396
|
+
maximumFractionDigits: 1
|
|
397
|
+
})}%` : t.toLocaleString("en-US");
|
|
398
|
+
}
|
|
399
|
+
return String(e);
|
|
482
400
|
}
|
|
483
|
-
function
|
|
484
|
-
|
|
401
|
+
function ee(e) {
|
|
402
|
+
return typeof e == "string" ? /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e) : !1;
|
|
485
403
|
}
|
|
486
|
-
function
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
return String(s);
|
|
494
|
-
}
|
|
404
|
+
function te(e) {
|
|
405
|
+
try {
|
|
406
|
+
let t = new Date(e);
|
|
407
|
+
return isNaN(t.getTime()) ? String(e) : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
|
|
408
|
+
} catch {
|
|
409
|
+
return String(e);
|
|
410
|
+
}
|
|
495
411
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/ReportViewer.tsx
|
|
414
|
+
function ne(e, t) {
|
|
415
|
+
if (!t || t.length === 0 || !e || e.length === 0) return null;
|
|
416
|
+
let n = t[0], r = n.field, i = /* @__PURE__ */ new Map();
|
|
417
|
+
for (let t of e) {
|
|
418
|
+
let e = String(t[r] ?? "(empty)");
|
|
419
|
+
i.has(e) || i.set(e, []), i.get(e).push(t);
|
|
420
|
+
}
|
|
421
|
+
let a = [];
|
|
422
|
+
for (let [e, t] of i) a.push({
|
|
423
|
+
key: e,
|
|
424
|
+
label: `${n.label || r}: ${e}`,
|
|
425
|
+
rows: t
|
|
426
|
+
});
|
|
427
|
+
let o = n.sort === "desc" ? -1 : 1;
|
|
428
|
+
return a.sort((e, t) => e.key.localeCompare(t.key) * o), a;
|
|
508
429
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
},
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
430
|
+
var Q = ({ schema: t, onRefresh: r }) => {
|
|
431
|
+
let { report: d, data: f, showToolbar: p = !0, allowExport: m = !0, allowPrint: g = !0, loading: _ = !1 } = t, v = (e) => {
|
|
432
|
+
if (!d) {
|
|
433
|
+
console.warn("ReportViewer: Cannot export, no report defined");
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
G(e, d, f || [], d.exportConfigs?.[e]);
|
|
437
|
+
}, y = () => {
|
|
438
|
+
window.print();
|
|
439
|
+
}, b = () => {
|
|
440
|
+
r?.();
|
|
441
|
+
}, S = (e, t) => {
|
|
442
|
+
if (!f) return 0;
|
|
443
|
+
let n = f.map((t) => Number(t[e]) || 0);
|
|
444
|
+
switch (t) {
|
|
445
|
+
case "count": return f.length;
|
|
446
|
+
case "sum": return n.reduce((e, t) => e + t, 0);
|
|
447
|
+
case "avg": return n.length > 0 ? (n.reduce((e, t) => e + t, 0) / n.length).toFixed(2) : 0;
|
|
448
|
+
case "min": return n.length > 0 ? Math.min(...n) : 0;
|
|
449
|
+
case "max": return n.length > 0 ? Math.max(...n) : 0;
|
|
450
|
+
default: return "";
|
|
451
|
+
}
|
|
452
|
+
}, C = (e, t) => {
|
|
453
|
+
let n = d?.conditionalFormatting;
|
|
454
|
+
if (!(!n || !Array.isArray(n))) for (let r of n) {
|
|
455
|
+
if (r.field !== e) continue;
|
|
456
|
+
let n = String(t ?? ""), i = String(r.value ?? ""), a = !1;
|
|
457
|
+
switch (r.operator) {
|
|
458
|
+
case "equals":
|
|
459
|
+
a = n === i;
|
|
460
|
+
break;
|
|
461
|
+
case "not_equals":
|
|
462
|
+
a = n !== i;
|
|
463
|
+
break;
|
|
464
|
+
case "contains":
|
|
465
|
+
a = n.includes(i);
|
|
466
|
+
break;
|
|
467
|
+
case "greater_than":
|
|
468
|
+
a = Number(t) > Number(r.value);
|
|
469
|
+
break;
|
|
470
|
+
case "less_than":
|
|
471
|
+
a = Number(t) < Number(r.value);
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
if (a) {
|
|
475
|
+
let e = {};
|
|
476
|
+
return r.backgroundColor && (e.backgroundColor = r.backgroundColor), r.textColor && (e.color = r.textColor), e;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}, T = (e, t) => e == null || e === "" ? "" : t.renderAs === "badge" ? /* @__PURE__ */ (0, R.jsx)(i, {
|
|
480
|
+
className: t.colorMap?.[String(e)] || "",
|
|
481
|
+
children: String(e)
|
|
482
|
+
}) : Z(e, t);
|
|
483
|
+
return d ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
484
|
+
className: "space-y-4",
|
|
485
|
+
children: [p && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
486
|
+
className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",
|
|
487
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)("h2", {
|
|
488
|
+
className: "text-lg font-semibold",
|
|
489
|
+
children: d.title
|
|
490
|
+
}), d.description && /* @__PURE__ */ (0, R.jsx)("p", {
|
|
491
|
+
className: "text-sm text-muted-foreground",
|
|
492
|
+
children: d.description
|
|
493
|
+
})] }), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
494
|
+
className: "flex items-center gap-2",
|
|
495
|
+
children: [
|
|
496
|
+
d.refreshInterval && /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
497
|
+
variant: "outline",
|
|
498
|
+
size: "sm",
|
|
499
|
+
onClick: b,
|
|
500
|
+
children: [/* @__PURE__ */ (0, R.jsx)(A, { className: "h-4 w-4 mr-2" }), "Refresh"]
|
|
501
|
+
}),
|
|
502
|
+
g && /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
503
|
+
variant: "outline",
|
|
504
|
+
size: "sm",
|
|
505
|
+
onClick: y,
|
|
506
|
+
children: [/* @__PURE__ */ (0, R.jsx)(k, { className: "h-4 w-4 mr-2" }), "Print"]
|
|
507
|
+
}),
|
|
508
|
+
m && d.showExportButtons && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
509
|
+
className: "flex items-center gap-1",
|
|
510
|
+
children: [
|
|
511
|
+
/* @__PURE__ */ (0, R.jsxs)(a, {
|
|
512
|
+
variant: "outline",
|
|
513
|
+
size: "sm",
|
|
514
|
+
onClick: () => v("pdf"),
|
|
515
|
+
children: [/* @__PURE__ */ (0, R.jsx)(w, { className: "h-4 w-4 mr-2" }), "PDF"]
|
|
516
|
+
}),
|
|
517
|
+
/* @__PURE__ */ (0, R.jsxs)(a, {
|
|
518
|
+
variant: "outline",
|
|
519
|
+
size: "sm",
|
|
520
|
+
onClick: () => v("excel"),
|
|
521
|
+
children: [/* @__PURE__ */ (0, R.jsx)(w, { className: "h-4 w-4 mr-2" }), "Excel"]
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ (0, R.jsxs)(a, {
|
|
524
|
+
variant: "outline",
|
|
525
|
+
size: "sm",
|
|
526
|
+
onClick: () => v("csv"),
|
|
527
|
+
children: [/* @__PURE__ */ (0, R.jsx)(w, { className: "h-4 w-4 mr-2" }), "CSV"]
|
|
528
|
+
})
|
|
529
|
+
]
|
|
530
|
+
})
|
|
531
|
+
]
|
|
532
|
+
})]
|
|
533
|
+
}), /* @__PURE__ */ (0, R.jsxs)(o, { children: [/* @__PURE__ */ (0, R.jsxs)(l, { children: [!p && d.title && /* @__PURE__ */ (0, R.jsx)(u, { children: d.title }), !p && d.description && /* @__PURE__ */ (0, R.jsx)(c, { children: d.description })] }), /* @__PURE__ */ (0, R.jsxs)(s, {
|
|
534
|
+
className: "space-y-6",
|
|
535
|
+
children: [
|
|
536
|
+
_ && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
537
|
+
className: "space-y-6",
|
|
538
|
+
children: [/* @__PURE__ */ (0, R.jsx)("div", {
|
|
539
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
540
|
+
children: [
|
|
541
|
+
1,
|
|
542
|
+
2,
|
|
543
|
+
3
|
|
544
|
+
].map((e) => /* @__PURE__ */ (0, R.jsx)(o, { children: /* @__PURE__ */ (0, R.jsxs)(s, {
|
|
545
|
+
className: "p-4 space-y-2",
|
|
546
|
+
children: [/* @__PURE__ */ (0, R.jsx)(h, { className: "h-4 w-20" }), /* @__PURE__ */ (0, R.jsx)(h, { className: "h-8 w-28" })]
|
|
547
|
+
}) }, e))
|
|
548
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
549
|
+
className: "space-y-2",
|
|
550
|
+
children: [/* @__PURE__ */ (0, R.jsx)(h, { className: "h-10 w-full" }), [
|
|
551
|
+
1,
|
|
552
|
+
2,
|
|
553
|
+
3,
|
|
554
|
+
4,
|
|
555
|
+
5
|
|
556
|
+
].map((e) => /* @__PURE__ */ (0, R.jsx)(h, { className: "h-8 w-full" }, e))]
|
|
557
|
+
})]
|
|
558
|
+
}),
|
|
559
|
+
!_ && d.sections?.map((t, r) => t.visible === !1 ? null : /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
560
|
+
className: "space-y-2",
|
|
561
|
+
children: [
|
|
562
|
+
t.title && t.type !== "header" && /* @__PURE__ */ (0, R.jsx)("h3", {
|
|
563
|
+
className: "text-lg font-semibold border-b pb-2",
|
|
564
|
+
children: t.title
|
|
565
|
+
}),
|
|
566
|
+
t.type === "header" && t.title && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
567
|
+
className: "text-2xl font-bold py-4",
|
|
568
|
+
children: t.title
|
|
569
|
+
}),
|
|
570
|
+
t.type === "summary" && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
571
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
572
|
+
children: d.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ (0, R.jsx)(o, { children: /* @__PURE__ */ (0, R.jsxs)(s, {
|
|
573
|
+
className: "p-4",
|
|
574
|
+
children: [/* @__PURE__ */ (0, R.jsx)("div", {
|
|
575
|
+
className: "text-sm text-muted-foreground",
|
|
576
|
+
children: e.label || e.name
|
|
577
|
+
}), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
578
|
+
className: "text-2xl font-bold",
|
|
579
|
+
children: Z(S(e.name, e.aggregation), e)
|
|
580
|
+
})]
|
|
581
|
+
}) }, t))
|
|
582
|
+
}),
|
|
583
|
+
t.type === "chart" && t.chart && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
584
|
+
className: "min-h-[300px]",
|
|
585
|
+
children: (() => {
|
|
586
|
+
let n = t.chart.type, r = !!t.chart.chartType;
|
|
587
|
+
!n && r && (n = "chart"), n && e.get(n) || (n = "chart");
|
|
588
|
+
let i = n === "chart" ? {
|
|
589
|
+
xAxisKey: t.chart.xAxisKey || t.chart.xAxisField || "name",
|
|
590
|
+
series: t.chart.series || (t.chart.yAxisFields ? t.chart.yAxisFields.map((e) => ({ dataKey: e })) : []),
|
|
591
|
+
chartType: t.chart.chartType || "bar"
|
|
592
|
+
} : {};
|
|
593
|
+
return /* @__PURE__ */ (0, R.jsx)(x, { schema: {
|
|
594
|
+
...t.chart,
|
|
595
|
+
type: n,
|
|
596
|
+
...i,
|
|
597
|
+
data: f || t.chart.data,
|
|
598
|
+
className: t.chart.className || "w-full h-[350px]"
|
|
599
|
+
} });
|
|
600
|
+
})()
|
|
601
|
+
}),
|
|
602
|
+
t.type === "table" && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
603
|
+
className: "border rounded-lg overflow-x-auto",
|
|
604
|
+
children: /* @__PURE__ */ (0, R.jsxs)("table", {
|
|
605
|
+
className: "w-full text-sm min-w-[600px]",
|
|
606
|
+
children: [/* @__PURE__ */ (0, R.jsx)("thead", {
|
|
607
|
+
className: "bg-muted",
|
|
608
|
+
children: /* @__PURE__ */ (0, R.jsx)("tr", { children: t.columns?.map((e, t) => /* @__PURE__ */ (0, R.jsx)("th", {
|
|
609
|
+
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
610
|
+
children: e.label || e.name
|
|
611
|
+
}, t)) })
|
|
612
|
+
}), /* @__PURE__ */ (0, R.jsx)("tbody", { children: (() => {
|
|
613
|
+
let e = ne(f || [], d.groupBy || []);
|
|
614
|
+
return e ? e.map((e) => /* @__PURE__ */ (0, R.jsxs)(n.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)("tr", {
|
|
615
|
+
className: "bg-muted/60",
|
|
616
|
+
children: /* @__PURE__ */ (0, R.jsxs)("td", {
|
|
617
|
+
colSpan: t.columns?.length || 1,
|
|
618
|
+
className: "px-4 py-2 font-semibold text-sm",
|
|
619
|
+
children: [
|
|
620
|
+
e.label,
|
|
621
|
+
" (",
|
|
622
|
+
e.rows.length,
|
|
623
|
+
")"
|
|
624
|
+
]
|
|
625
|
+
})
|
|
626
|
+
}), e.rows.map((e, n) => /* @__PURE__ */ (0, R.jsx)("tr", {
|
|
627
|
+
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
628
|
+
children: t.columns?.map((t, n) => /* @__PURE__ */ (0, R.jsx)("td", {
|
|
629
|
+
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
630
|
+
style: C(t.name, e[t.name]),
|
|
631
|
+
children: T(e[t.name], t)
|
|
632
|
+
}, n))
|
|
633
|
+
}, n))] }, e.key)) : f?.map((e, n) => /* @__PURE__ */ (0, R.jsx)("tr", {
|
|
634
|
+
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
635
|
+
children: t.columns?.map((t, n) => /* @__PURE__ */ (0, R.jsx)("td", {
|
|
636
|
+
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
637
|
+
style: C(t.name, e[t.name]),
|
|
638
|
+
children: T(e[t.name], t)
|
|
639
|
+
}, n))
|
|
640
|
+
}, n));
|
|
641
|
+
})() })]
|
|
642
|
+
})
|
|
643
|
+
}),
|
|
644
|
+
t.type === "text" && t.text && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
645
|
+
className: "prose max-w-none",
|
|
646
|
+
children: /* @__PURE__ */ (0, R.jsx)("p", { children: t.text })
|
|
647
|
+
}),
|
|
648
|
+
t.type === "page-break" && /* @__PURE__ */ (0, R.jsx)("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
|
|
649
|
+
t.content && /* @__PURE__ */ (0, R.jsx)(x, { schema: t.content })
|
|
650
|
+
]
|
|
651
|
+
}, r)),
|
|
652
|
+
!d.sections && f && f.length > 0 && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
653
|
+
className: "border rounded-lg overflow-x-auto",
|
|
654
|
+
children: /* @__PURE__ */ (0, R.jsxs)("table", {
|
|
655
|
+
className: "w-full text-sm min-w-[600px]",
|
|
656
|
+
children: [/* @__PURE__ */ (0, R.jsx)("thead", {
|
|
657
|
+
className: "bg-muted",
|
|
658
|
+
children: /* @__PURE__ */ (0, R.jsx)("tr", { children: d.fields?.map((e, t) => /* @__PURE__ */ (0, R.jsx)("th", {
|
|
659
|
+
className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
|
|
660
|
+
children: e.label || e.name
|
|
661
|
+
}, t)) })
|
|
662
|
+
}), /* @__PURE__ */ (0, R.jsx)("tbody", { children: f.map((e, t) => /* @__PURE__ */ (0, R.jsx)("tr", {
|
|
663
|
+
className: "border-t hover:bg-muted/50 even:bg-muted/20",
|
|
664
|
+
children: d.fields?.map((t, n) => /* @__PURE__ */ (0, R.jsx)("td", {
|
|
665
|
+
className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
|
|
666
|
+
style: C(t.name, e[t.name]),
|
|
667
|
+
children: T(e[t.name], t)
|
|
668
|
+
}, n))
|
|
669
|
+
}, t)) })]
|
|
670
|
+
})
|
|
671
|
+
})
|
|
672
|
+
]
|
|
673
|
+
})] })]
|
|
674
|
+
}) : /* @__PURE__ */ (0, R.jsx)(o, { children: /* @__PURE__ */ (0, R.jsx)(s, {
|
|
675
|
+
className: "p-8 text-center text-muted-foreground",
|
|
676
|
+
children: "No report to display"
|
|
677
|
+
}) });
|
|
678
|
+
}, $ = ({ schedule: e, onChange: t }) => {
|
|
679
|
+
let [n, i] = r(e || {
|
|
680
|
+
enabled: !1,
|
|
681
|
+
frequency: "weekly",
|
|
682
|
+
time: "09:00",
|
|
683
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
684
|
+
recipients: [],
|
|
685
|
+
formats: ["pdf"]
|
|
686
|
+
}), a = (e) => {
|
|
687
|
+
let r = {
|
|
688
|
+
...n,
|
|
689
|
+
...e
|
|
690
|
+
};
|
|
691
|
+
i(r), t?.(r);
|
|
692
|
+
};
|
|
693
|
+
return /* @__PURE__ */ (0, R.jsxs)(o, { children: [/* @__PURE__ */ (0, R.jsx)(l, { children: /* @__PURE__ */ (0, R.jsxs)(u, {
|
|
694
|
+
className: "flex items-center gap-2",
|
|
695
|
+
children: [/* @__PURE__ */ (0, R.jsx)(S, { className: "h-5 w-5" }), "Schedule Configuration"]
|
|
696
|
+
}) }), /* @__PURE__ */ (0, R.jsxs)(s, {
|
|
697
|
+
className: "space-y-4",
|
|
698
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
699
|
+
className: "flex items-center gap-2",
|
|
700
|
+
children: [/* @__PURE__ */ (0, R.jsx)("input", {
|
|
701
|
+
type: "checkbox",
|
|
702
|
+
id: "schedule-enabled",
|
|
703
|
+
checked: n.enabled || !1,
|
|
704
|
+
onChange: (e) => a({ enabled: e.target.checked }),
|
|
705
|
+
className: "rounded"
|
|
706
|
+
}), /* @__PURE__ */ (0, R.jsx)(m, {
|
|
707
|
+
htmlFor: "schedule-enabled",
|
|
708
|
+
children: "Enable Scheduled Report"
|
|
709
|
+
})]
|
|
710
|
+
}), n.enabled && /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [
|
|
711
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
712
|
+
className: "space-y-2",
|
|
713
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Frequency" }), /* @__PURE__ */ (0, R.jsx)("select", {
|
|
714
|
+
className: "w-full border rounded-md p-2 bg-background",
|
|
715
|
+
value: n.frequency || "weekly",
|
|
716
|
+
onChange: (e) => a({ frequency: e.target.value }),
|
|
717
|
+
children: [
|
|
718
|
+
{
|
|
719
|
+
value: "once",
|
|
720
|
+
label: "Once"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
value: "daily",
|
|
724
|
+
label: "Daily"
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
value: "weekly",
|
|
728
|
+
label: "Weekly"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
value: "monthly",
|
|
732
|
+
label: "Monthly"
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
value: "quarterly",
|
|
736
|
+
label: "Quarterly"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
value: "yearly",
|
|
740
|
+
label: "Yearly"
|
|
741
|
+
}
|
|
742
|
+
].map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
743
|
+
value: e.value,
|
|
744
|
+
children: e.label
|
|
745
|
+
}, e.value))
|
|
746
|
+
})]
|
|
747
|
+
}),
|
|
748
|
+
n.frequency === "weekly" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
749
|
+
className: "space-y-2",
|
|
750
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Day of Week" }), /* @__PURE__ */ (0, R.jsx)("select", {
|
|
751
|
+
className: "w-full border rounded-md p-2 bg-background",
|
|
752
|
+
value: n.dayOfWeek ?? 1,
|
|
753
|
+
onChange: (e) => a({ dayOfWeek: Number(e.target.value) }),
|
|
754
|
+
children: [
|
|
755
|
+
{
|
|
756
|
+
value: 0,
|
|
757
|
+
label: "Sunday"
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
value: 1,
|
|
761
|
+
label: "Monday"
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
value: 2,
|
|
765
|
+
label: "Tuesday"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
value: 3,
|
|
769
|
+
label: "Wednesday"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
value: 4,
|
|
773
|
+
label: "Thursday"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
value: 5,
|
|
777
|
+
label: "Friday"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
value: 6,
|
|
781
|
+
label: "Saturday"
|
|
782
|
+
}
|
|
783
|
+
].map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
784
|
+
value: e.value,
|
|
785
|
+
children: e.label
|
|
786
|
+
}, e.value))
|
|
787
|
+
})]
|
|
788
|
+
}),
|
|
789
|
+
n.frequency === "monthly" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
790
|
+
className: "space-y-2",
|
|
791
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Day of Month" }), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
792
|
+
type: "number",
|
|
793
|
+
min: 1,
|
|
794
|
+
max: 31,
|
|
795
|
+
value: n.dayOfMonth ?? 1,
|
|
796
|
+
onChange: (e) => a({ dayOfMonth: Number(e.target.value) })
|
|
797
|
+
})]
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
800
|
+
className: "space-y-2",
|
|
801
|
+
children: [/* @__PURE__ */ (0, R.jsxs)(m, {
|
|
802
|
+
className: "flex items-center gap-2",
|
|
803
|
+
children: [/* @__PURE__ */ (0, R.jsx)(C, { className: "h-4 w-4" }), "Time"]
|
|
804
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
805
|
+
type: "time",
|
|
806
|
+
value: n.time || "09:00",
|
|
807
|
+
onChange: (e) => a({ time: e.target.value })
|
|
808
|
+
})]
|
|
809
|
+
}),
|
|
810
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
811
|
+
className: "space-y-2",
|
|
812
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Timezone" }), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
813
|
+
value: n.timezone || "",
|
|
814
|
+
onChange: (e) => a({ timezone: e.target.value }),
|
|
815
|
+
placeholder: "e.g. America/New_York"
|
|
816
|
+
})]
|
|
817
|
+
}),
|
|
818
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
819
|
+
className: "space-y-2",
|
|
820
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Export Formats" }), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
821
|
+
className: "flex flex-wrap gap-2",
|
|
822
|
+
children: [
|
|
823
|
+
{
|
|
824
|
+
value: "pdf",
|
|
825
|
+
label: "PDF"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
value: "excel",
|
|
829
|
+
label: "Excel"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
value: "csv",
|
|
833
|
+
label: "CSV"
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
value: "html",
|
|
837
|
+
label: "HTML"
|
|
838
|
+
}
|
|
839
|
+
].map((e) => /* @__PURE__ */ (0, R.jsxs)("label", {
|
|
840
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 border rounded-md cursor-pointer hover:bg-muted/50",
|
|
841
|
+
children: [/* @__PURE__ */ (0, R.jsx)("input", {
|
|
842
|
+
type: "checkbox",
|
|
843
|
+
checked: n.formats?.includes(e.value) || !1,
|
|
844
|
+
onChange: (t) => {
|
|
845
|
+
let r = n.formats || [];
|
|
846
|
+
a({ formats: t.target.checked ? [...r, e.value] : r.filter((t) => t !== e.value) });
|
|
847
|
+
},
|
|
848
|
+
className: "rounded"
|
|
849
|
+
}), /* @__PURE__ */ (0, R.jsx)("span", {
|
|
850
|
+
className: "text-sm",
|
|
851
|
+
children: e.label
|
|
852
|
+
})]
|
|
853
|
+
}, e.value))
|
|
854
|
+
})]
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
857
|
+
className: "space-y-2",
|
|
858
|
+
children: [/* @__PURE__ */ (0, R.jsxs)(m, {
|
|
859
|
+
className: "flex items-center gap-2",
|
|
860
|
+
children: [/* @__PURE__ */ (0, R.jsx)(D, { className: "h-4 w-4" }), "Email Recipients"]
|
|
861
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
862
|
+
placeholder: "email1@example.com, email2@example.com",
|
|
863
|
+
value: n.recipients?.join(", ") || "",
|
|
864
|
+
onChange: (e) => a({ recipients: e.target.value.split(",").map((e) => e.trim()).filter(Boolean) })
|
|
865
|
+
})]
|
|
866
|
+
}),
|
|
867
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
868
|
+
className: "space-y-2",
|
|
869
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Email Subject" }), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
870
|
+
value: n.subject || "",
|
|
871
|
+
onChange: (e) => a({ subject: e.target.value }),
|
|
872
|
+
placeholder: "Scheduled Report: {report_title}"
|
|
873
|
+
})]
|
|
874
|
+
})
|
|
875
|
+
] })]
|
|
876
|
+
})] });
|
|
877
|
+
}, re = ({ schema: e }) => {
|
|
878
|
+
let { report: t, dataSources: n = [], availableFields: i = [], showPreview: d = !0, onSave: f, onCancel: h } = e, [b, x] = r(t || {
|
|
879
|
+
type: "report",
|
|
880
|
+
title: "New Report",
|
|
881
|
+
fields: [],
|
|
882
|
+
filters: [],
|
|
883
|
+
groupBy: [],
|
|
884
|
+
sections: [],
|
|
885
|
+
showExportButtons: !0,
|
|
886
|
+
showPrintButton: !0
|
|
887
|
+
}), [C, w] = r(b.fields || []), [D, k] = r(b.filters || []), [A, P] = r(b.groupBy || []), [F, I] = r(b.sections || []), L = () => {
|
|
888
|
+
if (i.length > 0 && C.length < i.length) {
|
|
889
|
+
let e = i.find((e) => !C.some((t) => t.name === e.name));
|
|
890
|
+
if (e) {
|
|
891
|
+
let t = [...C, e];
|
|
892
|
+
w(t), x({
|
|
893
|
+
...b,
|
|
894
|
+
fields: t
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}, z = (e) => {
|
|
899
|
+
let t = C.filter((t, n) => n !== e);
|
|
900
|
+
w(t), x({
|
|
901
|
+
...b,
|
|
902
|
+
fields: t
|
|
903
|
+
});
|
|
904
|
+
}, B = (e, t) => {
|
|
905
|
+
let n = [...C];
|
|
906
|
+
n[e] = t, w(n), x({
|
|
907
|
+
...b,
|
|
908
|
+
fields: n
|
|
909
|
+
});
|
|
910
|
+
}, V = () => {
|
|
911
|
+
let e = {
|
|
912
|
+
field: i[0]?.name || "",
|
|
913
|
+
operator: "equals",
|
|
914
|
+
value: ""
|
|
915
|
+
}, t = [...D, e];
|
|
916
|
+
k(t), x({
|
|
917
|
+
...b,
|
|
918
|
+
filters: t
|
|
919
|
+
});
|
|
920
|
+
}, H = (e) => {
|
|
921
|
+
let t = D.filter((t, n) => n !== e);
|
|
922
|
+
k(t), x({
|
|
923
|
+
...b,
|
|
924
|
+
filters: t
|
|
925
|
+
});
|
|
926
|
+
}, U = (e, t) => {
|
|
927
|
+
let n = [...D];
|
|
928
|
+
n[e] = t, k(n), x({
|
|
929
|
+
...b,
|
|
930
|
+
filters: n
|
|
931
|
+
});
|
|
932
|
+
}, W = () => {
|
|
933
|
+
let e = {
|
|
934
|
+
field: i[0]?.name || "",
|
|
935
|
+
sort: "asc"
|
|
936
|
+
}, t = [...A, e];
|
|
937
|
+
P(t), x({
|
|
938
|
+
...b,
|
|
939
|
+
groupBy: t
|
|
940
|
+
});
|
|
941
|
+
}, G = (e) => {
|
|
942
|
+
let t = A.filter((t, n) => n !== e);
|
|
943
|
+
P(t), x({
|
|
944
|
+
...b,
|
|
945
|
+
groupBy: t
|
|
946
|
+
});
|
|
947
|
+
}, K = (e, t) => {
|
|
948
|
+
let n = [...A];
|
|
949
|
+
n[e] = t, P(n), x({
|
|
950
|
+
...b,
|
|
951
|
+
groupBy: n
|
|
952
|
+
});
|
|
953
|
+
}, q = (e) => {
|
|
954
|
+
let t = {
|
|
955
|
+
type: e,
|
|
956
|
+
title: `New ${e} Section`
|
|
957
|
+
}, n = [...F, t];
|
|
958
|
+
I(n), x({
|
|
959
|
+
...b,
|
|
960
|
+
sections: n
|
|
961
|
+
});
|
|
962
|
+
}, J = (e) => {
|
|
963
|
+
let t = F.filter((t, n) => n !== e);
|
|
964
|
+
I(t), x({
|
|
965
|
+
...b,
|
|
966
|
+
sections: t
|
|
967
|
+
});
|
|
968
|
+
}, Y = (e, t) => {
|
|
969
|
+
let n = [...F];
|
|
970
|
+
n[e] = t, I(n), x({
|
|
971
|
+
...b,
|
|
972
|
+
sections: n
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
return /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
976
|
+
className: "space-y-4",
|
|
977
|
+
children: [/* @__PURE__ */ (0, R.jsxs)(o, { children: [/* @__PURE__ */ (0, R.jsxs)(l, { children: [/* @__PURE__ */ (0, R.jsx)(u, { children: "Report Builder" }), /* @__PURE__ */ (0, R.jsx)(c, { children: "Configure your report settings, fields, filters, and sections" })] }), /* @__PURE__ */ (0, R.jsxs)(s, { children: [/* @__PURE__ */ (0, R.jsxs)(g, {
|
|
978
|
+
defaultValue: "basic",
|
|
979
|
+
className: "w-full",
|
|
980
|
+
children: [
|
|
981
|
+
/* @__PURE__ */ (0, R.jsxs)(v, {
|
|
982
|
+
className: "grid w-full grid-cols-6",
|
|
983
|
+
children: [
|
|
984
|
+
/* @__PURE__ */ (0, R.jsxs)(y, {
|
|
985
|
+
value: "basic",
|
|
986
|
+
children: [/* @__PURE__ */ (0, R.jsx)(M, { className: "h-4 w-4 mr-2" }), "Basic"]
|
|
987
|
+
}),
|
|
988
|
+
/* @__PURE__ */ (0, R.jsxs)(y, {
|
|
989
|
+
value: "fields",
|
|
990
|
+
children: [/* @__PURE__ */ (0, R.jsx)(E, { className: "h-4 w-4 mr-2" }), "Fields"]
|
|
991
|
+
}),
|
|
992
|
+
/* @__PURE__ */ (0, R.jsxs)(y, {
|
|
993
|
+
value: "filters",
|
|
994
|
+
children: [/* @__PURE__ */ (0, R.jsx)(T, { className: "h-4 w-4 mr-2" }), "Filters"]
|
|
995
|
+
}),
|
|
996
|
+
/* @__PURE__ */ (0, R.jsxs)(y, {
|
|
997
|
+
value: "grouping",
|
|
998
|
+
children: [/* @__PURE__ */ (0, R.jsx)(E, { className: "h-4 w-4 mr-2" }), "Group By"]
|
|
999
|
+
}),
|
|
1000
|
+
/* @__PURE__ */ (0, R.jsxs)(y, {
|
|
1001
|
+
value: "sections",
|
|
1002
|
+
children: [/* @__PURE__ */ (0, R.jsx)(E, { className: "h-4 w-4 mr-2" }), "Sections"]
|
|
1003
|
+
}),
|
|
1004
|
+
/* @__PURE__ */ (0, R.jsxs)(y, {
|
|
1005
|
+
value: "schedule",
|
|
1006
|
+
children: [/* @__PURE__ */ (0, R.jsx)(S, { className: "h-4 w-4 mr-2" }), "Schedule"]
|
|
1007
|
+
})
|
|
1008
|
+
]
|
|
1009
|
+
}),
|
|
1010
|
+
/* @__PURE__ */ (0, R.jsx)(_, {
|
|
1011
|
+
value: "basic",
|
|
1012
|
+
className: "space-y-4 mt-4",
|
|
1013
|
+
children: /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1014
|
+
className: "space-y-4",
|
|
1015
|
+
children: [
|
|
1016
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1017
|
+
className: "space-y-2",
|
|
1018
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1019
|
+
htmlFor: "report-title",
|
|
1020
|
+
children: "Report Title"
|
|
1021
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1022
|
+
id: "report-title",
|
|
1023
|
+
value: b.title || "",
|
|
1024
|
+
onChange: (e) => x({
|
|
1025
|
+
...b,
|
|
1026
|
+
title: e.target.value
|
|
1027
|
+
}),
|
|
1028
|
+
placeholder: "Enter report title"
|
|
1029
|
+
})]
|
|
1030
|
+
}),
|
|
1031
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1032
|
+
className: "space-y-2",
|
|
1033
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1034
|
+
htmlFor: "report-description",
|
|
1035
|
+
children: "Description"
|
|
1036
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1037
|
+
id: "report-description",
|
|
1038
|
+
value: b.description || "",
|
|
1039
|
+
onChange: (e) => x({
|
|
1040
|
+
...b,
|
|
1041
|
+
description: e.target.value
|
|
1042
|
+
}),
|
|
1043
|
+
placeholder: "Enter report description"
|
|
1044
|
+
})]
|
|
1045
|
+
}),
|
|
1046
|
+
n.length > 0 && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1047
|
+
className: "space-y-2",
|
|
1048
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Data Source" }), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1049
|
+
className: "w-full border rounded-md p-2",
|
|
1050
|
+
children: [/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1051
|
+
value: "",
|
|
1052
|
+
children: "Select a data source"
|
|
1053
|
+
}), n.map((e, t) => /* @__PURE__ */ (0, R.jsxs)("option", {
|
|
1054
|
+
value: t,
|
|
1055
|
+
children: ["Data Source ", t + 1]
|
|
1056
|
+
}, t))]
|
|
1057
|
+
})]
|
|
1058
|
+
}),
|
|
1059
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1060
|
+
className: "space-y-2",
|
|
1061
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Export Options" }), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1062
|
+
className: "flex items-center gap-4",
|
|
1063
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("label", {
|
|
1064
|
+
className: "flex items-center gap-2",
|
|
1065
|
+
children: [/* @__PURE__ */ (0, R.jsx)("input", {
|
|
1066
|
+
type: "checkbox",
|
|
1067
|
+
checked: b.showExportButtons || !1,
|
|
1068
|
+
onChange: (e) => x({
|
|
1069
|
+
...b,
|
|
1070
|
+
showExportButtons: e.target.checked
|
|
1071
|
+
})
|
|
1072
|
+
}), /* @__PURE__ */ (0, R.jsx)("span", {
|
|
1073
|
+
className: "text-sm",
|
|
1074
|
+
children: "Show Export Buttons"
|
|
1075
|
+
})]
|
|
1076
|
+
}), /* @__PURE__ */ (0, R.jsxs)("label", {
|
|
1077
|
+
className: "flex items-center gap-2",
|
|
1078
|
+
children: [/* @__PURE__ */ (0, R.jsx)("input", {
|
|
1079
|
+
type: "checkbox",
|
|
1080
|
+
checked: b.showPrintButton || !1,
|
|
1081
|
+
onChange: (e) => x({
|
|
1082
|
+
...b,
|
|
1083
|
+
showPrintButton: e.target.checked
|
|
1084
|
+
})
|
|
1085
|
+
}), /* @__PURE__ */ (0, R.jsx)("span", {
|
|
1086
|
+
className: "text-sm",
|
|
1087
|
+
children: "Show Print Button"
|
|
1088
|
+
})]
|
|
1089
|
+
})]
|
|
1090
|
+
})]
|
|
1091
|
+
}),
|
|
1092
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1093
|
+
className: "space-y-2",
|
|
1094
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1095
|
+
htmlFor: "export-format",
|
|
1096
|
+
children: "Default Export Format"
|
|
1097
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1098
|
+
id: "export-format",
|
|
1099
|
+
className: "w-full border rounded-md p-2",
|
|
1100
|
+
value: b.defaultExportFormat || "pdf",
|
|
1101
|
+
onChange: (e) => x({
|
|
1102
|
+
...b,
|
|
1103
|
+
defaultExportFormat: e.target.value
|
|
1104
|
+
}),
|
|
1105
|
+
children: [
|
|
1106
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1107
|
+
value: "pdf",
|
|
1108
|
+
children: "PDF"
|
|
1109
|
+
}),
|
|
1110
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1111
|
+
value: "excel",
|
|
1112
|
+
children: "Excel"
|
|
1113
|
+
}),
|
|
1114
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1115
|
+
value: "csv",
|
|
1116
|
+
children: "CSV"
|
|
1117
|
+
}),
|
|
1118
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1119
|
+
value: "json",
|
|
1120
|
+
children: "JSON"
|
|
1121
|
+
}),
|
|
1122
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1123
|
+
value: "html",
|
|
1124
|
+
children: "HTML"
|
|
1125
|
+
})
|
|
1126
|
+
]
|
|
1127
|
+
})]
|
|
1128
|
+
})
|
|
1129
|
+
]
|
|
1130
|
+
})
|
|
1131
|
+
}),
|
|
1132
|
+
/* @__PURE__ */ (0, R.jsxs)(_, {
|
|
1133
|
+
value: "fields",
|
|
1134
|
+
className: "space-y-4 mt-4",
|
|
1135
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1136
|
+
className: "flex items-center justify-between",
|
|
1137
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Report Fields" }), /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1138
|
+
size: "sm",
|
|
1139
|
+
variant: "outline",
|
|
1140
|
+
onClick: L,
|
|
1141
|
+
disabled: C.length >= i.length,
|
|
1142
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-4 w-4 mr-2" }), "Add Field"]
|
|
1143
|
+
})]
|
|
1144
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1145
|
+
className: "space-y-2",
|
|
1146
|
+
children: [C.map((e, t) => /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1147
|
+
className: "flex items-center gap-2 p-3 border rounded-lg",
|
|
1148
|
+
children: /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1149
|
+
className: "flex-1 grid grid-cols-4 gap-2",
|
|
1150
|
+
children: [
|
|
1151
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1152
|
+
className: "text-xs",
|
|
1153
|
+
children: "Field Name"
|
|
1154
|
+
}), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1155
|
+
className: "text-sm font-medium",
|
|
1156
|
+
children: e.name
|
|
1157
|
+
})] }),
|
|
1158
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1159
|
+
className: "text-xs",
|
|
1160
|
+
children: "Label"
|
|
1161
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1162
|
+
className: "h-8 text-sm",
|
|
1163
|
+
value: e.label || e.name,
|
|
1164
|
+
onChange: (n) => B(t, {
|
|
1165
|
+
...e,
|
|
1166
|
+
label: n.target.value
|
|
1167
|
+
})
|
|
1168
|
+
})] }),
|
|
1169
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1170
|
+
className: "text-xs",
|
|
1171
|
+
children: "Aggregation"
|
|
1172
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1173
|
+
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1174
|
+
value: e.aggregation || "",
|
|
1175
|
+
onChange: (n) => B(t, {
|
|
1176
|
+
...e,
|
|
1177
|
+
aggregation: n.target.value
|
|
1178
|
+
}),
|
|
1179
|
+
children: [
|
|
1180
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1181
|
+
value: "",
|
|
1182
|
+
children: "None"
|
|
1183
|
+
}),
|
|
1184
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1185
|
+
value: "sum",
|
|
1186
|
+
children: "Sum"
|
|
1187
|
+
}),
|
|
1188
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1189
|
+
value: "count",
|
|
1190
|
+
children: "Count"
|
|
1191
|
+
}),
|
|
1192
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1193
|
+
value: "avg",
|
|
1194
|
+
children: "Average"
|
|
1195
|
+
}),
|
|
1196
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1197
|
+
value: "min",
|
|
1198
|
+
children: "Min"
|
|
1199
|
+
}),
|
|
1200
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1201
|
+
value: "max",
|
|
1202
|
+
children: "Max"
|
|
1203
|
+
})
|
|
1204
|
+
]
|
|
1205
|
+
})] }),
|
|
1206
|
+
/* @__PURE__ */ (0, R.jsx)("div", {
|
|
1207
|
+
className: "flex items-end justify-end",
|
|
1208
|
+
children: /* @__PURE__ */ (0, R.jsx)(a, {
|
|
1209
|
+
size: "sm",
|
|
1210
|
+
variant: "ghost",
|
|
1211
|
+
className: "text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
1212
|
+
onClick: () => z(t),
|
|
1213
|
+
children: /* @__PURE__ */ (0, R.jsx)(N, { className: "h-4 w-4" })
|
|
1214
|
+
})
|
|
1215
|
+
})
|
|
1216
|
+
]
|
|
1217
|
+
})
|
|
1218
|
+
}, t)), C.length === 0 && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1219
|
+
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1220
|
+
children: "No fields selected. Click \"Add Field\" to begin."
|
|
1221
|
+
})]
|
|
1222
|
+
})]
|
|
1223
|
+
}),
|
|
1224
|
+
/* @__PURE__ */ (0, R.jsxs)(_, {
|
|
1225
|
+
value: "filters",
|
|
1226
|
+
className: "space-y-4 mt-4",
|
|
1227
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1228
|
+
className: "flex items-center justify-between",
|
|
1229
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Report Filters" }), /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1230
|
+
size: "sm",
|
|
1231
|
+
variant: "outline",
|
|
1232
|
+
onClick: V,
|
|
1233
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-4 w-4 mr-2" }), "Add Filter"]
|
|
1234
|
+
})]
|
|
1235
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1236
|
+
className: "space-y-2",
|
|
1237
|
+
children: [D.map((e, t) => /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1238
|
+
className: "flex items-center gap-2 p-3 border rounded-lg",
|
|
1239
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1240
|
+
className: "flex-1 grid grid-cols-3 gap-2",
|
|
1241
|
+
children: [
|
|
1242
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1243
|
+
className: "text-xs",
|
|
1244
|
+
children: "Field"
|
|
1245
|
+
}), /* @__PURE__ */ (0, R.jsx)("select", {
|
|
1246
|
+
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1247
|
+
value: e.field,
|
|
1248
|
+
onChange: (n) => U(t, {
|
|
1249
|
+
...e,
|
|
1250
|
+
field: n.target.value
|
|
1251
|
+
}),
|
|
1252
|
+
children: i.map((e, t) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1253
|
+
value: e.name,
|
|
1254
|
+
children: e.label || e.name
|
|
1255
|
+
}, t))
|
|
1256
|
+
})] }),
|
|
1257
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1258
|
+
className: "text-xs",
|
|
1259
|
+
children: "Operator"
|
|
1260
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1261
|
+
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1262
|
+
value: e.operator,
|
|
1263
|
+
onChange: (n) => U(t, {
|
|
1264
|
+
...e,
|
|
1265
|
+
operator: n.target.value
|
|
1266
|
+
}),
|
|
1267
|
+
children: [
|
|
1268
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1269
|
+
value: "equals",
|
|
1270
|
+
children: "Equals"
|
|
1271
|
+
}),
|
|
1272
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1273
|
+
value: "contains",
|
|
1274
|
+
children: "Contains"
|
|
1275
|
+
}),
|
|
1276
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1277
|
+
value: "gt",
|
|
1278
|
+
children: "Greater Than"
|
|
1279
|
+
}),
|
|
1280
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1281
|
+
value: "lt",
|
|
1282
|
+
children: "Less Than"
|
|
1283
|
+
}),
|
|
1284
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1285
|
+
value: "between",
|
|
1286
|
+
children: "Between"
|
|
1287
|
+
})
|
|
1288
|
+
]
|
|
1289
|
+
})] }),
|
|
1290
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1291
|
+
className: "text-xs",
|
|
1292
|
+
children: "Value"
|
|
1293
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1294
|
+
className: "h-8 text-sm",
|
|
1295
|
+
value: String(e.value),
|
|
1296
|
+
onChange: (n) => U(t, {
|
|
1297
|
+
...e,
|
|
1298
|
+
value: n.target.value
|
|
1299
|
+
})
|
|
1300
|
+
})] })
|
|
1301
|
+
]
|
|
1302
|
+
}), /* @__PURE__ */ (0, R.jsx)(a, {
|
|
1303
|
+
size: "sm",
|
|
1304
|
+
variant: "ghost",
|
|
1305
|
+
className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
|
|
1306
|
+
onClick: () => H(t),
|
|
1307
|
+
children: /* @__PURE__ */ (0, R.jsx)(N, { className: "h-4 w-4" })
|
|
1308
|
+
})]
|
|
1309
|
+
}, t)), D.length === 0 && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1310
|
+
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1311
|
+
children: "No filters defined."
|
|
1312
|
+
})]
|
|
1313
|
+
})]
|
|
1314
|
+
}),
|
|
1315
|
+
/* @__PURE__ */ (0, R.jsxs)(_, {
|
|
1316
|
+
value: "grouping",
|
|
1317
|
+
className: "space-y-4 mt-4",
|
|
1318
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1319
|
+
className: "flex items-center justify-between",
|
|
1320
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Grouping Rules" }), /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1321
|
+
size: "sm",
|
|
1322
|
+
variant: "outline",
|
|
1323
|
+
onClick: W,
|
|
1324
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-4 w-4 mr-2" }), "Add Group"]
|
|
1325
|
+
})]
|
|
1326
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1327
|
+
className: "space-y-2",
|
|
1328
|
+
children: [A.map((e, t) => /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1329
|
+
className: "flex items-center gap-2 p-3 border rounded-lg",
|
|
1330
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1331
|
+
className: "flex-1 grid grid-cols-2 gap-2",
|
|
1332
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1333
|
+
className: "text-xs",
|
|
1334
|
+
children: "Field"
|
|
1335
|
+
}), /* @__PURE__ */ (0, R.jsx)("select", {
|
|
1336
|
+
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1337
|
+
value: e.field,
|
|
1338
|
+
onChange: (n) => K(t, {
|
|
1339
|
+
...e,
|
|
1340
|
+
field: n.target.value
|
|
1341
|
+
}),
|
|
1342
|
+
children: i.map((e, t) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1343
|
+
value: e.name,
|
|
1344
|
+
children: e.label || e.name
|
|
1345
|
+
}, t))
|
|
1346
|
+
})] }), /* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1347
|
+
className: "text-xs",
|
|
1348
|
+
children: "Sort Order"
|
|
1349
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1350
|
+
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
1351
|
+
value: e.sort || "asc",
|
|
1352
|
+
onChange: (n) => K(t, {
|
|
1353
|
+
...e,
|
|
1354
|
+
sort: n.target.value
|
|
1355
|
+
}),
|
|
1356
|
+
children: [/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1357
|
+
value: "asc",
|
|
1358
|
+
children: "Ascending"
|
|
1359
|
+
}), /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1360
|
+
value: "desc",
|
|
1361
|
+
children: "Descending"
|
|
1362
|
+
})]
|
|
1363
|
+
})] })]
|
|
1364
|
+
}), /* @__PURE__ */ (0, R.jsx)(a, {
|
|
1365
|
+
size: "sm",
|
|
1366
|
+
variant: "ghost",
|
|
1367
|
+
className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
|
|
1368
|
+
onClick: () => G(t),
|
|
1369
|
+
children: /* @__PURE__ */ (0, R.jsx)(N, { className: "h-4 w-4" })
|
|
1370
|
+
})]
|
|
1371
|
+
}, t)), A.length === 0 && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1372
|
+
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1373
|
+
children: "No grouping rules applied."
|
|
1374
|
+
})]
|
|
1375
|
+
})]
|
|
1376
|
+
}),
|
|
1377
|
+
/* @__PURE__ */ (0, R.jsxs)(_, {
|
|
1378
|
+
value: "sections",
|
|
1379
|
+
className: "space-y-4 mt-4",
|
|
1380
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1381
|
+
className: "flex items-center justify-between",
|
|
1382
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, { children: "Report Sections" }), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1383
|
+
className: "flex gap-2",
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1386
|
+
size: "sm",
|
|
1387
|
+
variant: "outline",
|
|
1388
|
+
onClick: () => q("header"),
|
|
1389
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-4 w-4 mr-2" }), "Header"]
|
|
1390
|
+
}),
|
|
1391
|
+
/* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1392
|
+
size: "sm",
|
|
1393
|
+
variant: "outline",
|
|
1394
|
+
onClick: () => q("chart"),
|
|
1395
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-4 w-4 mr-2" }), "Chart"]
|
|
1396
|
+
}),
|
|
1397
|
+
/* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1398
|
+
size: "sm",
|
|
1399
|
+
variant: "outline",
|
|
1400
|
+
onClick: () => q("table"),
|
|
1401
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-4 w-4 mr-2" }), "Table"]
|
|
1402
|
+
})
|
|
1403
|
+
]
|
|
1404
|
+
})]
|
|
1405
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1406
|
+
className: "space-y-2",
|
|
1407
|
+
children: [F.map((e, t) => /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1408
|
+
className: "p-3 border rounded-lg space-y-2",
|
|
1409
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1410
|
+
className: "flex items-center justify-between",
|
|
1411
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1412
|
+
className: "font-medium flex items-center gap-2",
|
|
1413
|
+
children: [/* @__PURE__ */ (0, R.jsx)("div", {
|
|
1414
|
+
className: "text-xs bg-muted px-2 py-0.5 rounded uppercase",
|
|
1415
|
+
children: e.type
|
|
1416
|
+
}), e.title]
|
|
1417
|
+
}), /* @__PURE__ */ (0, R.jsx)(a, {
|
|
1418
|
+
size: "sm",
|
|
1419
|
+
variant: "ghost",
|
|
1420
|
+
className: "text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
1421
|
+
onClick: () => J(t),
|
|
1422
|
+
children: /* @__PURE__ */ (0, R.jsx)(N, { className: "h-4 w-4" })
|
|
1423
|
+
})]
|
|
1424
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1425
|
+
className: "grid grid-cols-2 gap-2",
|
|
1426
|
+
children: [
|
|
1427
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1428
|
+
className: "text-xs",
|
|
1429
|
+
children: "Title"
|
|
1430
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1431
|
+
className: "h-8 text-sm",
|
|
1432
|
+
value: e.title || "",
|
|
1433
|
+
onChange: (n) => Y(t, {
|
|
1434
|
+
...e,
|
|
1435
|
+
title: n.target.value
|
|
1436
|
+
})
|
|
1437
|
+
})] }),
|
|
1438
|
+
e.type === "text" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1439
|
+
className: "col-span-2",
|
|
1440
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1441
|
+
className: "text-xs",
|
|
1442
|
+
children: "Content"
|
|
1443
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1444
|
+
className: "h-8 text-sm",
|
|
1445
|
+
value: e.text || "",
|
|
1446
|
+
onChange: (n) => Y(t, {
|
|
1447
|
+
...e,
|
|
1448
|
+
text: n.target.value
|
|
1449
|
+
})
|
|
1450
|
+
})]
|
|
1451
|
+
}),
|
|
1452
|
+
e.type === "chart" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1453
|
+
className: "col-span-2 grid grid-cols-2 gap-2 mt-2 p-2 bg-muted/20 rounded",
|
|
1454
|
+
children: [
|
|
1455
|
+
/* @__PURE__ */ (0, R.jsx)("div", {
|
|
1456
|
+
className: "col-span-2",
|
|
1457
|
+
children: /* @__PURE__ */ (0, R.jsx)(m, {
|
|
1458
|
+
className: "text-xs font-semibold",
|
|
1459
|
+
children: "Chart Configuration"
|
|
1460
|
+
})
|
|
1461
|
+
}),
|
|
1462
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1463
|
+
className: "text-xs",
|
|
1464
|
+
children: "Chart Type"
|
|
1465
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1466
|
+
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",
|
|
1467
|
+
value: e.chart?.chartType || "bar",
|
|
1468
|
+
onChange: (n) => Y(t, {
|
|
1469
|
+
...e,
|
|
1470
|
+
chart: {
|
|
1471
|
+
...e.chart,
|
|
1472
|
+
type: "chart",
|
|
1473
|
+
chartType: n.target.value
|
|
1474
|
+
}
|
|
1475
|
+
}),
|
|
1476
|
+
children: [
|
|
1477
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1478
|
+
value: "bar",
|
|
1479
|
+
children: "Bar"
|
|
1480
|
+
}),
|
|
1481
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1482
|
+
value: "line",
|
|
1483
|
+
children: "Line"
|
|
1484
|
+
}),
|
|
1485
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1486
|
+
value: "area",
|
|
1487
|
+
children: "Area"
|
|
1488
|
+
}),
|
|
1489
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1490
|
+
value: "pie",
|
|
1491
|
+
children: "Pie"
|
|
1492
|
+
})
|
|
1493
|
+
]
|
|
1494
|
+
})] }),
|
|
1495
|
+
/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1496
|
+
className: "text-xs",
|
|
1497
|
+
children: "X-Axis Field"
|
|
1498
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1499
|
+
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",
|
|
1500
|
+
value: e.chart?.xAxisField || "",
|
|
1501
|
+
onChange: (n) => Y(t, {
|
|
1502
|
+
...e,
|
|
1503
|
+
chart: {
|
|
1504
|
+
...e.chart,
|
|
1505
|
+
type: "chart",
|
|
1506
|
+
xAxisField: n.target.value
|
|
1507
|
+
}
|
|
1508
|
+
}),
|
|
1509
|
+
children: [
|
|
1510
|
+
/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1511
|
+
value: "",
|
|
1512
|
+
children: "Select Field..."
|
|
1513
|
+
}),
|
|
1514
|
+
i.map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1515
|
+
value: e.name,
|
|
1516
|
+
children: e.label || e.name
|
|
1517
|
+
}, e.name)),
|
|
1518
|
+
i.length === 0 && /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1519
|
+
value: "name",
|
|
1520
|
+
children: "Name"
|
|
1521
|
+
}), /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1522
|
+
value: "month",
|
|
1523
|
+
children: "Month"
|
|
1524
|
+
})] })
|
|
1525
|
+
]
|
|
1526
|
+
})] }),
|
|
1527
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1528
|
+
className: "col-span-2",
|
|
1529
|
+
children: [/* @__PURE__ */ (0, R.jsx)(m, {
|
|
1530
|
+
className: "text-xs",
|
|
1531
|
+
children: "Y-Axis Fields (comma separated)"
|
|
1532
|
+
}), /* @__PURE__ */ (0, R.jsx)(p, {
|
|
1533
|
+
className: "h-8 text-sm",
|
|
1534
|
+
placeholder: "e.g. value, count",
|
|
1535
|
+
value: e.chart?.yAxisFields?.join(", ") || "",
|
|
1536
|
+
onChange: (n) => Y(t, {
|
|
1537
|
+
...e,
|
|
1538
|
+
chart: {
|
|
1539
|
+
...e.chart,
|
|
1540
|
+
type: "chart",
|
|
1541
|
+
yAxisFields: n.target.value.split(",").map((e) => e.trim()).filter(Boolean)
|
|
1542
|
+
}
|
|
1543
|
+
})
|
|
1544
|
+
})]
|
|
1545
|
+
})
|
|
1546
|
+
]
|
|
1547
|
+
})
|
|
1548
|
+
]
|
|
1549
|
+
})]
|
|
1550
|
+
}, t)), F.length === 0 && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1551
|
+
className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",
|
|
1552
|
+
children: "No customized sections. The default report layout will be used."
|
|
1553
|
+
})]
|
|
1554
|
+
})]
|
|
1555
|
+
}),
|
|
1556
|
+
/* @__PURE__ */ (0, R.jsx)(_, {
|
|
1557
|
+
value: "schedule",
|
|
1558
|
+
className: "space-y-4 mt-4",
|
|
1559
|
+
children: /* @__PURE__ */ (0, R.jsx)($, {
|
|
1560
|
+
schedule: b.schedule,
|
|
1561
|
+
onChange: (e) => x({
|
|
1562
|
+
...b,
|
|
1563
|
+
schedule: e
|
|
1564
|
+
})
|
|
1565
|
+
})
|
|
1566
|
+
})
|
|
1567
|
+
]
|
|
1568
|
+
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1569
|
+
className: "flex items-center justify-end gap-2 mt-6 pt-4 border-t",
|
|
1570
|
+
children: [/* @__PURE__ */ (0, R.jsx)(a, {
|
|
1571
|
+
variant: "outline",
|
|
1572
|
+
onClick: () => {
|
|
1573
|
+
h && console.log("Report cancelled:", h);
|
|
1574
|
+
},
|
|
1575
|
+
children: "Cancel"
|
|
1576
|
+
}), /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1577
|
+
onClick: () => {
|
|
1578
|
+
console.log("Saving report:", b), f && alert("Report saved! (Handler: " + f + ")");
|
|
1579
|
+
},
|
|
1580
|
+
children: [/* @__PURE__ */ (0, R.jsx)(j, { className: "h-4 w-4 mr-2" }), "Save Report"]
|
|
1581
|
+
})]
|
|
1582
|
+
})] })] }), d && /* @__PURE__ */ (0, R.jsxs)(o, {
|
|
1583
|
+
className: "mt-8 border-2 border-blue-100",
|
|
1584
|
+
children: [/* @__PURE__ */ (0, R.jsx)(l, {
|
|
1585
|
+
className: "bg-blue-50/50",
|
|
1586
|
+
children: /* @__PURE__ */ (0, R.jsx)(u, {
|
|
1587
|
+
className: "text-blue-900 text-sm uppercase tracking-wide",
|
|
1588
|
+
children: "Live Preview"
|
|
1589
|
+
})
|
|
1590
|
+
}), /* @__PURE__ */ (0, R.jsx)(s, {
|
|
1591
|
+
className: "pt-6",
|
|
1592
|
+
children: /* @__PURE__ */ (0, R.jsx)(Q, { schema: {
|
|
1593
|
+
type: "report-viewer",
|
|
1594
|
+
report: {
|
|
1595
|
+
...b,
|
|
1596
|
+
fields: C,
|
|
1597
|
+
filters: D,
|
|
1598
|
+
groupBy: A,
|
|
1599
|
+
sections: F
|
|
1600
|
+
},
|
|
1601
|
+
data: [
|
|
1602
|
+
{
|
|
1603
|
+
id: 1,
|
|
1604
|
+
name: "Sample Item A",
|
|
1605
|
+
value: 100,
|
|
1606
|
+
status: "New"
|
|
1607
|
+
},
|
|
1608
|
+
{
|
|
1609
|
+
id: 2,
|
|
1610
|
+
name: "Sample Item B",
|
|
1611
|
+
value: 250,
|
|
1612
|
+
status: "Active"
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
id: 3,
|
|
1616
|
+
name: "Sample Item C",
|
|
1617
|
+
value: 75,
|
|
1618
|
+
status: "Closed"
|
|
1619
|
+
}
|
|
1620
|
+
]
|
|
1621
|
+
} })
|
|
1622
|
+
})]
|
|
1623
|
+
})]
|
|
1624
|
+
});
|
|
1625
|
+
}, ie = [
|
|
1626
|
+
{
|
|
1627
|
+
value: "",
|
|
1628
|
+
label: "None"
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
value: "sum",
|
|
1632
|
+
label: "Sum"
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
value: "count",
|
|
1636
|
+
label: "Count"
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
value: "avg",
|
|
1640
|
+
label: "Average"
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
value: "min",
|
|
1644
|
+
label: "Min"
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
value: "max",
|
|
1648
|
+
label: "Max"
|
|
1649
|
+
}
|
|
1462
1650
|
];
|
|
1463
|
-
function
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1651
|
+
function ae({ availableFields: e, value: t, onChange: n }) {
|
|
1652
|
+
let r = Array.isArray(t) ? t.map((e) => typeof e == "string" ? {
|
|
1653
|
+
name: e,
|
|
1654
|
+
label: e,
|
|
1655
|
+
type: "string"
|
|
1656
|
+
} : {
|
|
1657
|
+
name: e.name || e.field || e.value,
|
|
1658
|
+
label: e.label || e.name || "",
|
|
1659
|
+
type: e.type || "string",
|
|
1660
|
+
aggregation: e.aggregation
|
|
1661
|
+
}) : [], i = r.map((e) => e.name), a = (t) => {
|
|
1662
|
+
let a = i.includes(t), o;
|
|
1663
|
+
if (a) o = r.filter((e) => e.name !== t);
|
|
1664
|
+
else {
|
|
1665
|
+
let n = e.find((e) => e.value === t);
|
|
1666
|
+
o = [...r, {
|
|
1667
|
+
name: t,
|
|
1668
|
+
label: n?.label || t,
|
|
1669
|
+
type: n?.type || "string"
|
|
1670
|
+
}];
|
|
1671
|
+
}
|
|
1672
|
+
n(o);
|
|
1673
|
+
}, o = (e, t) => {
|
|
1674
|
+
n(r.map((n) => n.name === e ? {
|
|
1675
|
+
...n,
|
|
1676
|
+
aggregation: t || void 0,
|
|
1677
|
+
showInSummary: !!t
|
|
1678
|
+
} : n));
|
|
1679
|
+
};
|
|
1680
|
+
return e.length === 0 ? /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1681
|
+
className: "text-xs text-muted-foreground py-2",
|
|
1682
|
+
"data-testid": "field-picker-empty",
|
|
1683
|
+
children: "No fields available"
|
|
1684
|
+
}) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1685
|
+
className: "space-y-1 py-1",
|
|
1686
|
+
"data-testid": "field-picker",
|
|
1687
|
+
children: e.map((e) => {
|
|
1688
|
+
let t = i.includes(e.value), n = r.find((t) => t.name === e.value);
|
|
1689
|
+
return /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1690
|
+
className: "flex items-center gap-2 px-1 py-0.5 rounded hover:bg-muted/50 text-xs",
|
|
1691
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("label", {
|
|
1692
|
+
className: "flex items-center gap-2 flex-1 cursor-pointer",
|
|
1693
|
+
children: [
|
|
1694
|
+
/* @__PURE__ */ (0, R.jsx)(d, {
|
|
1695
|
+
checked: t,
|
|
1696
|
+
onCheckedChange: () => a(e.value),
|
|
1697
|
+
"data-testid": `field-picker-${e.value}`
|
|
1698
|
+
}),
|
|
1699
|
+
/* @__PURE__ */ (0, R.jsx)("span", {
|
|
1700
|
+
className: "flex-1",
|
|
1701
|
+
children: e.label
|
|
1702
|
+
}),
|
|
1703
|
+
e.type && /* @__PURE__ */ (0, R.jsx)("span", {
|
|
1704
|
+
className: "text-[10px] text-muted-foreground",
|
|
1705
|
+
children: e.type
|
|
1706
|
+
})
|
|
1707
|
+
]
|
|
1708
|
+
}), t && /* @__PURE__ */ (0, R.jsx)("select", {
|
|
1709
|
+
className: "h-5 text-[10px] border rounded px-1 bg-background",
|
|
1710
|
+
value: n?.aggregation || "",
|
|
1711
|
+
onChange: (t) => o(e.value, t.target.value),
|
|
1712
|
+
"data-testid": `field-agg-${e.value}`,
|
|
1713
|
+
children: ie.map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1714
|
+
value: e.value,
|
|
1715
|
+
children: e.label
|
|
1716
|
+
}, e.value))
|
|
1717
|
+
})]
|
|
1718
|
+
}, e.value);
|
|
1719
|
+
})
|
|
1720
|
+
});
|
|
1511
1721
|
}
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1722
|
+
var oe = [
|
|
1723
|
+
{
|
|
1724
|
+
value: "",
|
|
1725
|
+
label: "None"
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
value: "bar",
|
|
1729
|
+
label: "Bar Chart"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
value: "line",
|
|
1733
|
+
label: "Line Chart"
|
|
1734
|
+
},
|
|
1735
|
+
{
|
|
1736
|
+
value: "pie",
|
|
1737
|
+
label: "Pie Chart"
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
value: "area",
|
|
1741
|
+
label: "Area Chart"
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
value: "donut",
|
|
1745
|
+
label: "Donut Chart"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
value: "scatter",
|
|
1749
|
+
label: "Scatter Plot"
|
|
1750
|
+
}
|
|
1520
1751
|
];
|
|
1521
|
-
function
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
})
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
)
|
|
1574
|
-
] })
|
|
1575
|
-
] })
|
|
1576
|
-
] });
|
|
1752
|
+
function se({ availableFields: e, value: t, onChange: n }) {
|
|
1753
|
+
let r = t || {}, i = (e) => n({
|
|
1754
|
+
...r,
|
|
1755
|
+
...e
|
|
1756
|
+
});
|
|
1757
|
+
return /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1758
|
+
className: "space-y-2 py-1",
|
|
1759
|
+
"data-testid": "chart-config",
|
|
1760
|
+
children: [/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)("label", {
|
|
1761
|
+
className: "text-[10px] text-muted-foreground",
|
|
1762
|
+
children: "Chart type"
|
|
1763
|
+
}), /* @__PURE__ */ (0, R.jsx)("select", {
|
|
1764
|
+
className: "w-full h-7 text-xs border rounded px-2 bg-background",
|
|
1765
|
+
value: r.chartType || "",
|
|
1766
|
+
onChange: (e) => i({ chartType: e.target.value || void 0 }),
|
|
1767
|
+
"data-testid": "chart-type-select",
|
|
1768
|
+
children: oe.map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1769
|
+
value: e.value,
|
|
1770
|
+
children: e.label
|
|
1771
|
+
}, e.value))
|
|
1772
|
+
})] }), r.chartType && /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)("label", {
|
|
1773
|
+
className: "text-[10px] text-muted-foreground",
|
|
1774
|
+
children: "X-axis field"
|
|
1775
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1776
|
+
className: "w-full h-7 text-xs border rounded px-2 bg-background",
|
|
1777
|
+
value: r.xAxisField || "",
|
|
1778
|
+
onChange: (e) => i({ xAxisField: e.target.value || void 0 }),
|
|
1779
|
+
"data-testid": "chart-x-field",
|
|
1780
|
+
children: [/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1781
|
+
value: "",
|
|
1782
|
+
children: "Select field…"
|
|
1783
|
+
}), e.map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1784
|
+
value: e.value,
|
|
1785
|
+
children: e.label
|
|
1786
|
+
}, e.value))]
|
|
1787
|
+
})] }), /* @__PURE__ */ (0, R.jsxs)("div", { children: [/* @__PURE__ */ (0, R.jsx)("label", {
|
|
1788
|
+
className: "text-[10px] text-muted-foreground",
|
|
1789
|
+
children: "Y-axis field"
|
|
1790
|
+
}), /* @__PURE__ */ (0, R.jsxs)("select", {
|
|
1791
|
+
className: "w-full h-7 text-xs border rounded px-2 bg-background",
|
|
1792
|
+
value: r.yAxisFields?.[0] || "",
|
|
1793
|
+
onChange: (e) => i({ yAxisFields: e.target.value ? [e.target.value] : [] }),
|
|
1794
|
+
"data-testid": "chart-y-field",
|
|
1795
|
+
children: [/* @__PURE__ */ (0, R.jsx)("option", {
|
|
1796
|
+
value: "",
|
|
1797
|
+
children: "Select field…"
|
|
1798
|
+
}), e.filter((e) => e.type === "number").map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1799
|
+
value: e.value,
|
|
1800
|
+
children: e.label
|
|
1801
|
+
}, e.value))]
|
|
1802
|
+
})] })] })]
|
|
1803
|
+
});
|
|
1577
1804
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1805
|
+
var ce = [
|
|
1806
|
+
{
|
|
1807
|
+
value: "equals",
|
|
1808
|
+
label: "="
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
value: "not_equals",
|
|
1812
|
+
label: "≠"
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
value: "greater_than",
|
|
1816
|
+
label: ">"
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
value: "less_than",
|
|
1820
|
+
label: "<"
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
value: "contains",
|
|
1824
|
+
label: "Contains"
|
|
1825
|
+
}
|
|
1584
1826
|
];
|
|
1585
|
-
function
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
/* @__PURE__ */ e.jsxs(
|
|
1662
|
-
E,
|
|
1663
|
-
{
|
|
1664
|
-
type: "button",
|
|
1665
|
-
size: "sm",
|
|
1666
|
-
variant: "outline",
|
|
1667
|
-
className: "h-6 text-[10px] w-full",
|
|
1668
|
-
onClick: c,
|
|
1669
|
-
"data-testid": "cf-add-rule",
|
|
1670
|
-
children: [
|
|
1671
|
-
/* @__PURE__ */ e.jsx(G, { className: "h-3 w-3 mr-1" }),
|
|
1672
|
-
"Add Rule"
|
|
1673
|
-
]
|
|
1674
|
-
}
|
|
1675
|
-
)
|
|
1676
|
-
] });
|
|
1827
|
+
function le({ availableFields: e, value: t, onChange: n }) {
|
|
1828
|
+
let r = Array.isArray(t) ? t : [], i = () => {
|
|
1829
|
+
n([...r, {
|
|
1830
|
+
field: e[0]?.value || "",
|
|
1831
|
+
operator: "equals",
|
|
1832
|
+
value: "",
|
|
1833
|
+
backgroundColor: "#fef9c3",
|
|
1834
|
+
textColor: ""
|
|
1835
|
+
}]);
|
|
1836
|
+
}, o = (e) => {
|
|
1837
|
+
n(r.filter((t, n) => n !== e));
|
|
1838
|
+
}, s = (e, t) => {
|
|
1839
|
+
n(r.map((n, r) => r === e ? {
|
|
1840
|
+
...n,
|
|
1841
|
+
...t
|
|
1842
|
+
} : n));
|
|
1843
|
+
};
|
|
1844
|
+
return /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1845
|
+
className: "space-y-2 py-1",
|
|
1846
|
+
"data-testid": "conditional-format-rules",
|
|
1847
|
+
children: [r.map((t, n) => /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1848
|
+
className: "flex items-center gap-1 text-[10px] p-1 border rounded bg-muted/20",
|
|
1849
|
+
children: [
|
|
1850
|
+
/* @__PURE__ */ (0, R.jsx)("select", {
|
|
1851
|
+
className: "h-5 text-[10px] border rounded px-1 bg-background flex-1",
|
|
1852
|
+
value: t.field,
|
|
1853
|
+
onChange: (e) => s(n, { field: e.target.value }),
|
|
1854
|
+
"data-testid": `cf-rule-field-${n}`,
|
|
1855
|
+
children: e.map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1856
|
+
value: e.value,
|
|
1857
|
+
children: e.label
|
|
1858
|
+
}, e.value))
|
|
1859
|
+
}),
|
|
1860
|
+
/* @__PURE__ */ (0, R.jsx)("select", {
|
|
1861
|
+
className: "h-5 text-[10px] border rounded px-1 bg-background w-12",
|
|
1862
|
+
value: t.operator,
|
|
1863
|
+
onChange: (e) => s(n, { operator: e.target.value }),
|
|
1864
|
+
children: ce.map((e) => /* @__PURE__ */ (0, R.jsx)("option", {
|
|
1865
|
+
value: e.value,
|
|
1866
|
+
children: e.label
|
|
1867
|
+
}, e.value))
|
|
1868
|
+
}),
|
|
1869
|
+
/* @__PURE__ */ (0, R.jsx)("input", {
|
|
1870
|
+
className: "h-5 text-[10px] border rounded px-1 bg-background w-16",
|
|
1871
|
+
value: t.value,
|
|
1872
|
+
placeholder: "value",
|
|
1873
|
+
onChange: (e) => s(n, { value: e.target.value }),
|
|
1874
|
+
"data-testid": `cf-rule-value-${n}`
|
|
1875
|
+
}),
|
|
1876
|
+
/* @__PURE__ */ (0, R.jsx)("input", {
|
|
1877
|
+
type: "color",
|
|
1878
|
+
className: "h-5 w-5 rounded border cursor-pointer",
|
|
1879
|
+
value: t.backgroundColor || "#fef9c3",
|
|
1880
|
+
onChange: (e) => s(n, { backgroundColor: e.target.value }),
|
|
1881
|
+
title: "Background color"
|
|
1882
|
+
}),
|
|
1883
|
+
/* @__PURE__ */ (0, R.jsx)(a, {
|
|
1884
|
+
type: "button",
|
|
1885
|
+
size: "sm",
|
|
1886
|
+
variant: "ghost",
|
|
1887
|
+
className: "h-5 w-5 p-0",
|
|
1888
|
+
onClick: () => o(n),
|
|
1889
|
+
"data-testid": `cf-rule-remove-${n}`,
|
|
1890
|
+
children: /* @__PURE__ */ (0, R.jsx)(N, { className: "h-3 w-3" })
|
|
1891
|
+
})
|
|
1892
|
+
]
|
|
1893
|
+
}, n)), /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1894
|
+
type: "button",
|
|
1895
|
+
size: "sm",
|
|
1896
|
+
variant: "outline",
|
|
1897
|
+
className: "h-6 text-[10px] w-full",
|
|
1898
|
+
onClick: i,
|
|
1899
|
+
"data-testid": "cf-add-rule",
|
|
1900
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-3 w-3 mr-1" }), "Add Rule"]
|
|
1901
|
+
})]
|
|
1902
|
+
});
|
|
1677
1903
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1904
|
+
var ue = [
|
|
1905
|
+
{
|
|
1906
|
+
value: "header",
|
|
1907
|
+
label: "Header"
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
value: "summary",
|
|
1911
|
+
label: "Summary"
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
value: "table",
|
|
1915
|
+
label: "Table"
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
value: "chart",
|
|
1919
|
+
label: "Chart"
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
value: "text",
|
|
1923
|
+
label: "Text"
|
|
1924
|
+
}
|
|
1684
1925
|
];
|
|
1685
|
-
function
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
]
|
|
1764
|
-
},
|
|
1765
|
-
t.value
|
|
1766
|
-
)) })
|
|
1767
|
-
] });
|
|
1926
|
+
function de({ value: e, onChange: t }) {
|
|
1927
|
+
let n = Array.isArray(e) ? e : [], r = (e) => {
|
|
1928
|
+
t([...n, {
|
|
1929
|
+
type: e,
|
|
1930
|
+
title: `New ${e}`,
|
|
1931
|
+
visible: !0
|
|
1932
|
+
}]);
|
|
1933
|
+
}, i = (e) => {
|
|
1934
|
+
t(n.filter((t, n) => n !== e));
|
|
1935
|
+
}, o = (e, r) => {
|
|
1936
|
+
t(n.map((t, n) => n === e ? {
|
|
1937
|
+
...t,
|
|
1938
|
+
...r
|
|
1939
|
+
} : t));
|
|
1940
|
+
}, s = (e, r) => {
|
|
1941
|
+
let i = e + r;
|
|
1942
|
+
if (i < 0 || i >= n.length) return;
|
|
1943
|
+
let a = [...n];
|
|
1944
|
+
[a[e], a[i]] = [a[i], a[e]], t(a);
|
|
1945
|
+
};
|
|
1946
|
+
return /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1947
|
+
className: "space-y-2 py-1",
|
|
1948
|
+
"data-testid": "section-manager",
|
|
1949
|
+
children: [n.map((e, t) => /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1950
|
+
className: "flex items-center gap-1 text-[10px] p-1.5 border rounded bg-muted/20",
|
|
1951
|
+
children: [
|
|
1952
|
+
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
1953
|
+
className: "flex flex-col gap-0.5 mr-1",
|
|
1954
|
+
children: [/* @__PURE__ */ (0, R.jsx)("button", {
|
|
1955
|
+
type: "button",
|
|
1956
|
+
className: "text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1957
|
+
disabled: t === 0,
|
|
1958
|
+
onClick: () => s(t, -1),
|
|
1959
|
+
"data-testid": `section-up-${t}`,
|
|
1960
|
+
children: "▲"
|
|
1961
|
+
}), /* @__PURE__ */ (0, R.jsx)("button", {
|
|
1962
|
+
type: "button",
|
|
1963
|
+
className: "text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
1964
|
+
disabled: t === n.length - 1,
|
|
1965
|
+
onClick: () => s(t, 1),
|
|
1966
|
+
"data-testid": `section-down-${t}`,
|
|
1967
|
+
children: "▼"
|
|
1968
|
+
})]
|
|
1969
|
+
}),
|
|
1970
|
+
/* @__PURE__ */ (0, R.jsx)("span", {
|
|
1971
|
+
className: "text-[9px] bg-muted px-1.5 py-0.5 rounded uppercase font-medium shrink-0",
|
|
1972
|
+
children: e.type
|
|
1973
|
+
}),
|
|
1974
|
+
/* @__PURE__ */ (0, R.jsx)("input", {
|
|
1975
|
+
className: "h-5 text-[10px] border rounded px-1 bg-background flex-1 min-w-0",
|
|
1976
|
+
value: e.title || "",
|
|
1977
|
+
placeholder: "Section title",
|
|
1978
|
+
onChange: (e) => o(t, { title: e.target.value }),
|
|
1979
|
+
"data-testid": `section-title-${t}`
|
|
1980
|
+
}),
|
|
1981
|
+
/* @__PURE__ */ (0, R.jsx)(a, {
|
|
1982
|
+
type: "button",
|
|
1983
|
+
size: "sm",
|
|
1984
|
+
variant: "ghost",
|
|
1985
|
+
className: "h-5 w-5 p-0 shrink-0",
|
|
1986
|
+
onClick: () => i(t),
|
|
1987
|
+
"data-testid": `section-remove-${t}`,
|
|
1988
|
+
children: /* @__PURE__ */ (0, R.jsx)(N, { className: "h-3 w-3" })
|
|
1989
|
+
})
|
|
1990
|
+
]
|
|
1991
|
+
}, t)), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
1992
|
+
className: "flex gap-1 flex-wrap",
|
|
1993
|
+
children: ue.map((e) => /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
1994
|
+
type: "button",
|
|
1995
|
+
size: "sm",
|
|
1996
|
+
variant: "outline",
|
|
1997
|
+
className: "h-6 text-[10px]",
|
|
1998
|
+
onClick: () => r(e.value),
|
|
1999
|
+
"data-testid": `section-add-${e.value}`,
|
|
2000
|
+
children: [/* @__PURE__ */ (0, R.jsx)(O, { className: "h-3 w-3 mr-0.5" }), e.label]
|
|
2001
|
+
}, e.value))
|
|
2002
|
+
})]
|
|
2003
|
+
});
|
|
1768
2004
|
}
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2005
|
+
function fe(e = []) {
|
|
2006
|
+
return {
|
|
2007
|
+
breadcrumb: ["Report", "Configuration"],
|
|
2008
|
+
sections: [
|
|
2009
|
+
{
|
|
2010
|
+
key: "basic",
|
|
2011
|
+
title: "Basic",
|
|
2012
|
+
fields: [
|
|
2013
|
+
{
|
|
2014
|
+
key: "title",
|
|
2015
|
+
label: "Title",
|
|
2016
|
+
type: "input",
|
|
2017
|
+
placeholder: "Report title"
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
key: "description",
|
|
2021
|
+
label: "Description",
|
|
2022
|
+
type: "input",
|
|
2023
|
+
placeholder: "Report description"
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
key: "reportType",
|
|
2027
|
+
label: "Report type",
|
|
2028
|
+
type: "select",
|
|
2029
|
+
defaultValue: "tabular",
|
|
2030
|
+
options: [
|
|
2031
|
+
{
|
|
2032
|
+
value: "tabular",
|
|
2033
|
+
label: "Tabular"
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
value: "summary",
|
|
2037
|
+
label: "Summary"
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
value: "matrix",
|
|
2041
|
+
label: "Matrix"
|
|
2042
|
+
}
|
|
2043
|
+
],
|
|
2044
|
+
helpText: "Tabular: flat table. Summary: grouped with subtotals. Matrix: pivot table (planned)."
|
|
2045
|
+
}
|
|
2046
|
+
]
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
key: "data",
|
|
2050
|
+
title: "Data",
|
|
2051
|
+
collapsible: !0,
|
|
2052
|
+
fields: [{
|
|
2053
|
+
key: "objectName",
|
|
2054
|
+
label: "Data source",
|
|
2055
|
+
type: "input",
|
|
2056
|
+
placeholder: "e.g. opportunity",
|
|
2057
|
+
helpText: "Object name to query data from"
|
|
2058
|
+
}, {
|
|
2059
|
+
key: "limit",
|
|
2060
|
+
label: "Row limit",
|
|
2061
|
+
type: "input",
|
|
2062
|
+
defaultValue: "100",
|
|
2063
|
+
placeholder: "e.g. 100"
|
|
2064
|
+
}]
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
key: "columns",
|
|
2068
|
+
title: "Columns",
|
|
2069
|
+
collapsible: !0,
|
|
2070
|
+
hint: "Select fields to display as report columns. Set aggregation per column for summary reports.",
|
|
2071
|
+
fields: [{
|
|
2072
|
+
key: "fields",
|
|
2073
|
+
label: "Report columns",
|
|
2074
|
+
type: "custom",
|
|
2075
|
+
render: (t, n) => /* @__PURE__ */ (0, R.jsx)(ae, {
|
|
2076
|
+
availableFields: e,
|
|
2077
|
+
value: t,
|
|
2078
|
+
onChange: n
|
|
2079
|
+
})
|
|
2080
|
+
}]
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
key: "filters",
|
|
2084
|
+
title: "Filters",
|
|
2085
|
+
collapsible: !0,
|
|
2086
|
+
hint: "Define filter conditions for the report data",
|
|
2087
|
+
fields: [{
|
|
2088
|
+
key: "filters",
|
|
2089
|
+
label: "Conditions",
|
|
2090
|
+
type: "filter",
|
|
2091
|
+
fields: e
|
|
2092
|
+
}]
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
key: "groupBy",
|
|
2096
|
+
title: "Group By",
|
|
2097
|
+
collapsible: !0,
|
|
2098
|
+
hint: "Group report data and compute aggregations",
|
|
2099
|
+
fields: [{
|
|
2100
|
+
key: "groupBy",
|
|
2101
|
+
label: "Grouping",
|
|
2102
|
+
type: "sort",
|
|
2103
|
+
fields: e
|
|
2104
|
+
}]
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
key: "chart",
|
|
2108
|
+
title: "Chart",
|
|
2109
|
+
collapsible: !0,
|
|
2110
|
+
hint: "Add a chart visualization to the report",
|
|
2111
|
+
fields: [{
|
|
2112
|
+
key: "chartConfig",
|
|
2113
|
+
label: "Chart",
|
|
2114
|
+
type: "custom",
|
|
2115
|
+
render: (t, n) => /* @__PURE__ */ (0, R.jsx)(se, {
|
|
2116
|
+
availableFields: e,
|
|
2117
|
+
value: t,
|
|
2118
|
+
onChange: n
|
|
2119
|
+
})
|
|
2120
|
+
}]
|
|
2121
|
+
},
|
|
2122
|
+
{
|
|
2123
|
+
key: "conditionalFormatting",
|
|
2124
|
+
title: "Conditional Format",
|
|
2125
|
+
collapsible: !0,
|
|
2126
|
+
defaultCollapsed: !0,
|
|
2127
|
+
hint: "Highlight cells based on field value conditions",
|
|
2128
|
+
fields: [{
|
|
2129
|
+
key: "conditionalFormatting",
|
|
2130
|
+
label: "Rules",
|
|
2131
|
+
type: "custom",
|
|
2132
|
+
render: (t, n) => /* @__PURE__ */ (0, R.jsx)(le, {
|
|
2133
|
+
availableFields: e,
|
|
2134
|
+
value: t,
|
|
2135
|
+
onChange: n
|
|
2136
|
+
})
|
|
2137
|
+
}]
|
|
2138
|
+
},
|
|
2139
|
+
{
|
|
2140
|
+
key: "sections",
|
|
2141
|
+
title: "Sections",
|
|
2142
|
+
collapsible: !0,
|
|
2143
|
+
defaultCollapsed: !0,
|
|
2144
|
+
hint: "Manage report layout blocks (header, table, chart, summary)",
|
|
2145
|
+
fields: [{
|
|
2146
|
+
key: "sections",
|
|
2147
|
+
label: "Report sections",
|
|
2148
|
+
type: "custom",
|
|
2149
|
+
render: (e, t) => /* @__PURE__ */ (0, R.jsx)(de, {
|
|
2150
|
+
value: e,
|
|
2151
|
+
onChange: t
|
|
2152
|
+
})
|
|
2153
|
+
}]
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
key: "export",
|
|
2157
|
+
title: "Export",
|
|
2158
|
+
collapsible: !0,
|
|
2159
|
+
defaultCollapsed: !0,
|
|
2160
|
+
fields: [
|
|
2161
|
+
{
|
|
2162
|
+
key: "showExportButtons",
|
|
2163
|
+
label: "Show export buttons",
|
|
2164
|
+
type: "switch",
|
|
2165
|
+
defaultValue: !0
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
key: "showPrintButton",
|
|
2169
|
+
label: "Show print button",
|
|
2170
|
+
type: "switch",
|
|
2171
|
+
defaultValue: !0
|
|
2172
|
+
},
|
|
2173
|
+
{
|
|
2174
|
+
key: "defaultExportFormat",
|
|
2175
|
+
label: "Default export format",
|
|
2176
|
+
type: "select",
|
|
2177
|
+
defaultValue: "pdf",
|
|
2178
|
+
options: [
|
|
2179
|
+
{
|
|
2180
|
+
value: "pdf",
|
|
2181
|
+
label: "PDF"
|
|
2182
|
+
},
|
|
2183
|
+
{
|
|
2184
|
+
value: "excel",
|
|
2185
|
+
label: "Excel"
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
value: "csv",
|
|
2189
|
+
label: "CSV"
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
value: "json",
|
|
2193
|
+
label: "JSON"
|
|
2194
|
+
},
|
|
2195
|
+
{
|
|
2196
|
+
value: "html",
|
|
2197
|
+
label: "HTML"
|
|
2198
|
+
}
|
|
2199
|
+
]
|
|
2200
|
+
}
|
|
2201
|
+
]
|
|
2202
|
+
},
|
|
2203
|
+
{
|
|
2204
|
+
key: "schedule",
|
|
2205
|
+
title: "Schedule",
|
|
2206
|
+
collapsible: !0,
|
|
2207
|
+
defaultCollapsed: !0,
|
|
2208
|
+
fields: [{
|
|
2209
|
+
key: "schedule",
|
|
2210
|
+
label: "Schedule",
|
|
2211
|
+
type: "custom",
|
|
2212
|
+
render: (e, t) => /* @__PURE__ */ (0, R.jsx)($, {
|
|
2213
|
+
schedule: e,
|
|
2214
|
+
onChange: t
|
|
2215
|
+
})
|
|
2216
|
+
}]
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
key: "appearance",
|
|
2220
|
+
title: "Appearance",
|
|
2221
|
+
collapsible: !0,
|
|
2222
|
+
defaultCollapsed: !0,
|
|
2223
|
+
fields: [{
|
|
2224
|
+
key: "showToolbar",
|
|
2225
|
+
label: "Show toolbar",
|
|
2226
|
+
type: "switch",
|
|
2227
|
+
defaultValue: !0
|
|
2228
|
+
}, {
|
|
2229
|
+
key: "refreshInterval",
|
|
2230
|
+
label: "Refresh interval",
|
|
2231
|
+
type: "select",
|
|
2232
|
+
defaultValue: "0",
|
|
2233
|
+
options: [
|
|
2234
|
+
{
|
|
2235
|
+
value: "0",
|
|
2236
|
+
label: "Manual"
|
|
2237
|
+
},
|
|
2238
|
+
{
|
|
2239
|
+
value: "30",
|
|
2240
|
+
label: "30s"
|
|
2241
|
+
},
|
|
2242
|
+
{
|
|
2243
|
+
value: "60",
|
|
2244
|
+
label: "1 min"
|
|
2245
|
+
},
|
|
2246
|
+
{
|
|
2247
|
+
value: "300",
|
|
2248
|
+
label: "5 min"
|
|
2249
|
+
}
|
|
2250
|
+
]
|
|
2251
|
+
}]
|
|
2252
|
+
}
|
|
2253
|
+
]
|
|
2254
|
+
};
|
|
2006
2255
|
}
|
|
2007
|
-
function
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
{
|
|
2024
|
-
open: s,
|
|
2025
|
-
onClose: n,
|
|
2026
|
-
schema: _,
|
|
2027
|
-
draft: u,
|
|
2028
|
-
isDirty: t,
|
|
2029
|
-
onFieldChange: i,
|
|
2030
|
-
onSave: () => o(u),
|
|
2031
|
-
onDiscard: r,
|
|
2032
|
-
onUndo: p,
|
|
2033
|
-
onRedo: v,
|
|
2034
|
-
canUndo: S,
|
|
2035
|
-
canRedo: w
|
|
2036
|
-
}
|
|
2037
|
-
);
|
|
2256
|
+
function pe({ open: e, onClose: n, config: r, onSave: i, onFieldChange: a, availableFields: o }) {
|
|
2257
|
+
let { draft: s, isDirty: c, updateField: l, discard: u, undo: d, redo: p, canUndo: m, canRedo: h } = b(r, { onUpdate: a });
|
|
2258
|
+
return /* @__PURE__ */ (0, R.jsx)(f, {
|
|
2259
|
+
open: e,
|
|
2260
|
+
onClose: n,
|
|
2261
|
+
schema: t.useMemo(() => fe(o), [o]),
|
|
2262
|
+
draft: s,
|
|
2263
|
+
isDirty: c,
|
|
2264
|
+
onFieldChange: l,
|
|
2265
|
+
onSave: () => i(s),
|
|
2266
|
+
onDiscard: u,
|
|
2267
|
+
onUndo: d,
|
|
2268
|
+
onRedo: p,
|
|
2269
|
+
canUndo: m,
|
|
2270
|
+
canRedo: h
|
|
2271
|
+
});
|
|
2038
2272
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
recordCount: 0,
|
|
2063
|
-
format: t,
|
|
2064
|
-
error: r.message
|
|
2065
|
-
};
|
|
2066
|
-
}
|
|
2273
|
+
//#endregion
|
|
2274
|
+
//#region src/LiveReportExporter.ts
|
|
2275
|
+
async function me(e, t) {
|
|
2276
|
+
let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o } = t, s = a || e.defaultExportFormat || "pdf";
|
|
2277
|
+
try {
|
|
2278
|
+
let t = (await n.find(r, i)).data || [];
|
|
2279
|
+
return G(s, e, t, {
|
|
2280
|
+
format: s,
|
|
2281
|
+
...e.exportConfigs?.[s],
|
|
2282
|
+
...o
|
|
2283
|
+
}), {
|
|
2284
|
+
success: !0,
|
|
2285
|
+
recordCount: t.length,
|
|
2286
|
+
format: s
|
|
2287
|
+
};
|
|
2288
|
+
} catch (e) {
|
|
2289
|
+
return {
|
|
2290
|
+
success: !1,
|
|
2291
|
+
recordCount: 0,
|
|
2292
|
+
format: s,
|
|
2293
|
+
error: e.message
|
|
2294
|
+
};
|
|
2295
|
+
}
|
|
2067
2296
|
}
|
|
2068
|
-
function
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
return "";
|
|
2096
|
-
});
|
|
2097
|
-
i.push(v);
|
|
2098
|
-
}
|
|
2099
|
-
const r = "\uFEFF" + [
|
|
2100
|
-
t.join(" "),
|
|
2101
|
-
...i.map((v) => v.join(" "))
|
|
2102
|
-
].join(`
|
|
2103
|
-
`), p = c || `${s.title || "report"}.tsv`;
|
|
2104
|
-
xt(r, p, "text/tab-separated-values");
|
|
2297
|
+
function he(e, t, n = {}) {
|
|
2298
|
+
let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(_e), s = o.map((e) => e.header), c = t.map((e, t) => o.map((n) => {
|
|
2299
|
+
if (n.formula) return n.formula.replace(/\{ROW\}/g, String(t + 2));
|
|
2300
|
+
let r = e[n.name];
|
|
2301
|
+
return ve(r, n.numberFormat);
|
|
2302
|
+
}));
|
|
2303
|
+
if (a && t.length > 0) {
|
|
2304
|
+
let n = o.map((n, r) => {
|
|
2305
|
+
let i = (e.fields || []).find((e) => e.name === n.name);
|
|
2306
|
+
if (i?.aggregation) {
|
|
2307
|
+
let e = be(r), n = t.length + 1;
|
|
2308
|
+
switch (i.aggregation) {
|
|
2309
|
+
case "sum": return `=SUM(${e}2:${e}${n})`;
|
|
2310
|
+
case "avg": return `=AVERAGE(${e}2:${e}${n})`;
|
|
2311
|
+
case "count": return `=COUNTA(${e}2:${e}${n})`;
|
|
2312
|
+
case "min": return `=MIN(${e}2:${e}${n})`;
|
|
2313
|
+
case "max": return `=MAX(${e}2:${e}${n})`;
|
|
2314
|
+
default: return "";
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
return "";
|
|
2318
|
+
});
|
|
2319
|
+
c.push(n);
|
|
2320
|
+
}
|
|
2321
|
+
Se("" + [s.join(" "), ...c.map((e) => e.join(" "))].join("\n"), i || `${e.title || "report"}.tsv`, "text/tab-separated-values");
|
|
2105
2322
|
}
|
|
2106
|
-
function
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
};
|
|
2323
|
+
function ge(e, t, n, r) {
|
|
2324
|
+
return async () => {
|
|
2325
|
+
let i = e.schedule;
|
|
2326
|
+
if (!i?.enabled) return [];
|
|
2327
|
+
let a = i.formats || [e.defaultExportFormat || "pdf"], o = [];
|
|
2328
|
+
for (let r of a) {
|
|
2329
|
+
let i = await me(e, {
|
|
2330
|
+
dataSource: t,
|
|
2331
|
+
resource: n,
|
|
2332
|
+
format: r
|
|
2333
|
+
});
|
|
2334
|
+
o.push(i);
|
|
2335
|
+
}
|
|
2336
|
+
return r(e, i), o;
|
|
2337
|
+
};
|
|
2122
2338
|
}
|
|
2123
|
-
function
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2339
|
+
function _e(e) {
|
|
2340
|
+
return {
|
|
2341
|
+
name: e.name,
|
|
2342
|
+
header: e.label || e.name
|
|
2343
|
+
};
|
|
2128
2344
|
}
|
|
2129
|
-
function
|
|
2130
|
-
|
|
2345
|
+
function ve(e, t) {
|
|
2346
|
+
return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US", ye(t)) : xe(String(e));
|
|
2131
2347
|
}
|
|
2132
|
-
function
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2348
|
+
function ye(e) {
|
|
2349
|
+
if (e.includes("%")) return {
|
|
2350
|
+
style: "percent",
|
|
2351
|
+
minimumFractionDigits: 0
|
|
2352
|
+
};
|
|
2353
|
+
let t = (e.match(/0/g) || []).length;
|
|
2354
|
+
return {
|
|
2355
|
+
minimumFractionDigits: Math.max(0, t - 1),
|
|
2356
|
+
maximumFractionDigits: Math.max(0, t - 1)
|
|
2357
|
+
};
|
|
2140
2358
|
}
|
|
2141
|
-
function
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
return n;
|
|
2359
|
+
function be(e) {
|
|
2360
|
+
let t = "", n = e;
|
|
2361
|
+
for (; n >= 0;) t = String.fromCharCode(n % 26 + 65) + t, n = Math.floor(n / 26) - 1;
|
|
2362
|
+
return t;
|
|
2146
2363
|
}
|
|
2147
|
-
function
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
return s;
|
|
2364
|
+
function xe(e) {
|
|
2365
|
+
if (e.length > 0) {
|
|
2366
|
+
let t = e.charAt(0);
|
|
2367
|
+
if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `'${e}`;
|
|
2368
|
+
}
|
|
2369
|
+
return e;
|
|
2154
2370
|
}
|
|
2155
|
-
function
|
|
2156
|
-
|
|
2157
|
-
|
|
2371
|
+
function Se(e, t, n) {
|
|
2372
|
+
let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
2373
|
+
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
2158
2374
|
}
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
qe as exportAsCSV,
|
|
2206
|
-
Je as exportAsExcel,
|
|
2207
|
-
ye as exportAsHTML,
|
|
2208
|
-
We as exportAsJSON,
|
|
2209
|
-
He as exportAsPDF,
|
|
2210
|
-
Nt as exportExcelWithFormulas,
|
|
2211
|
-
Ne as exportReport,
|
|
2212
|
-
ct as exportWithLiveData,
|
|
2213
|
-
ge as formatValue
|
|
2214
|
-
};
|
|
2375
|
+
e.register("report", z, {
|
|
2376
|
+
namespace: "report",
|
|
2377
|
+
label: "Report",
|
|
2378
|
+
category: "Report",
|
|
2379
|
+
inputs: [
|
|
2380
|
+
{
|
|
2381
|
+
name: "title",
|
|
2382
|
+
type: "string",
|
|
2383
|
+
label: "Title"
|
|
2384
|
+
},
|
|
2385
|
+
{
|
|
2386
|
+
name: "description",
|
|
2387
|
+
type: "string",
|
|
2388
|
+
label: "Description"
|
|
2389
|
+
},
|
|
2390
|
+
{
|
|
2391
|
+
name: "chart",
|
|
2392
|
+
type: "code",
|
|
2393
|
+
label: "Chart Configuration"
|
|
2394
|
+
}
|
|
2395
|
+
]
|
|
2396
|
+
}), e.register("report-viewer", Q, {
|
|
2397
|
+
namespace: "report",
|
|
2398
|
+
label: "Report Viewer",
|
|
2399
|
+
category: "Report",
|
|
2400
|
+
inputs: [{
|
|
2401
|
+
name: "report",
|
|
2402
|
+
type: "code",
|
|
2403
|
+
label: "Report Definition"
|
|
2404
|
+
}, {
|
|
2405
|
+
name: "showToolbar",
|
|
2406
|
+
type: "boolean",
|
|
2407
|
+
label: "Show Toolbar"
|
|
2408
|
+
}]
|
|
2409
|
+
}), e.register("report-builder", re, {
|
|
2410
|
+
namespace: "report",
|
|
2411
|
+
label: "Report Builder",
|
|
2412
|
+
category: "Report",
|
|
2413
|
+
inputs: [{
|
|
2414
|
+
name: "report",
|
|
2415
|
+
type: "code",
|
|
2416
|
+
label: "Initial Report"
|
|
2417
|
+
}]
|
|
2418
|
+
});
|
|
2419
|
+
//#endregion
|
|
2420
|
+
export { re as ReportBuilder, pe as ReportConfigPanel, z as ReportRenderer, Q as ReportViewer, $ as ScheduleConfig, ge as createScheduleTrigger, B as exportAsCSV, W as exportAsExcel, H as exportAsHTML, V as exportAsJSON, U as exportAsPDF, he as exportExcelWithFormulas, G as exportReport, me as exportWithLiveData, Z as formatValue };
|