@object-ui/plugin-report 0.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +998 -491
- package/dist/index.umd.cjs +62 -4
- package/dist/plugin-report/src/LiveReportExporter.d.ts +105 -0
- package/dist/{src → plugin-report/src}/ReportBuilder.d.ts +0 -1
- package/dist/plugin-report/src/ReportExportEngine.d.ts +30 -0
- package/dist/{src → plugin-report/src}/ReportRenderer.d.ts +0 -1
- package/dist/{src → plugin-report/src}/ReportViewer.d.ts +2 -1
- package/dist/plugin-report/src/ScheduleConfig.d.ts +8 -0
- package/dist/plugin-report/src/index.d.ts +9 -0
- package/package.json +9 -9
- package/dist/src/ReportBuilder.d.ts.map +0 -1
- package/dist/src/ReportRenderer.d.ts.map +0 -1
- package/dist/src/ReportViewer.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ComponentRegistry as
|
|
2
|
-
import
|
|
3
|
-
import { Card as
|
|
4
|
-
import { SchemaRenderer as
|
|
5
|
-
import { RefreshCw as
|
|
6
|
-
var
|
|
1
|
+
import { ComponentRegistry as L } from "@object-ui/core";
|
|
2
|
+
import ke, { useState as W } from "react";
|
|
3
|
+
import { Card as B, CardHeader as ee, CardTitle as te, CardDescription as he, CardContent as z, Button as F, Label as b, Input as A, Tabs as Re, TabsList as Se, TabsTrigger as U, TabsContent as Y } from "@object-ui/components";
|
|
4
|
+
import { SchemaRenderer as pe } from "@object-ui/react";
|
|
5
|
+
import { RefreshCw as Ee, Printer as Te, Download as de, Calendar as je, Clock as Fe, Mail as _e, Settings as Ae, Layers as ue, Filter as $e, Plus as V, Trash2 as ae, Save as Oe } from "lucide-react";
|
|
6
|
+
var me = { exports: {} }, Q = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.production.js
|
|
@@ -13,29 +13,29 @@ var ce = { exports: {} }, J = {};
|
|
|
13
13
|
* This source code is licensed under the MIT license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*/
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
for (var
|
|
26
|
-
|
|
27
|
-
} else
|
|
28
|
-
return
|
|
29
|
-
$$typeof:
|
|
30
|
-
type:
|
|
31
|
-
key:
|
|
32
|
-
ref:
|
|
33
|
-
props:
|
|
16
|
+
var xe;
|
|
17
|
+
function Pe() {
|
|
18
|
+
if (xe) return Q;
|
|
19
|
+
xe = 1;
|
|
20
|
+
var r = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
|
|
21
|
+
function s(c, d, p) {
|
|
22
|
+
var f = null;
|
|
23
|
+
if (p !== void 0 && (f = "" + p), d.key !== void 0 && (f = "" + d.key), "key" in d) {
|
|
24
|
+
p = {};
|
|
25
|
+
for (var n in d)
|
|
26
|
+
n !== "key" && (p[n] = d[n]);
|
|
27
|
+
} else p = d;
|
|
28
|
+
return d = p.ref, {
|
|
29
|
+
$$typeof: r,
|
|
30
|
+
type: c,
|
|
31
|
+
key: f,
|
|
32
|
+
ref: d !== void 0 ? d : null,
|
|
33
|
+
props: p
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return Q.Fragment = i, Q.jsx = s, Q.jsxs = s, Q;
|
|
37
37
|
}
|
|
38
|
-
var
|
|
38
|
+
var K = {};
|
|
39
39
|
/**
|
|
40
40
|
* @license React
|
|
41
41
|
* react-jsx-runtime.development.js
|
|
@@ -45,395 +45,761 @@ var X = {};
|
|
|
45
45
|
* This source code is licensed under the MIT license found in the
|
|
46
46
|
* LICENSE file in the root directory of this source tree.
|
|
47
47
|
*/
|
|
48
|
-
var
|
|
49
|
-
function
|
|
50
|
-
return
|
|
51
|
-
function
|
|
52
|
-
if (
|
|
53
|
-
if (typeof
|
|
54
|
-
return
|
|
55
|
-
if (typeof
|
|
56
|
-
switch (
|
|
57
|
-
case
|
|
48
|
+
var fe;
|
|
49
|
+
function Le() {
|
|
50
|
+
return fe || (fe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
51
|
+
function r(t) {
|
|
52
|
+
if (t == null) return null;
|
|
53
|
+
if (typeof t == "function")
|
|
54
|
+
return t.$$typeof === ne ? null : t.displayName || t.name || null;
|
|
55
|
+
if (typeof t == "string") return t;
|
|
56
|
+
switch (t) {
|
|
57
|
+
case N:
|
|
58
58
|
return "Fragment";
|
|
59
|
-
case
|
|
59
|
+
case g:
|
|
60
60
|
return "Profiler";
|
|
61
|
-
case
|
|
61
|
+
case k:
|
|
62
62
|
return "StrictMode";
|
|
63
|
-
case
|
|
63
|
+
case O:
|
|
64
64
|
return "Suspense";
|
|
65
|
-
case
|
|
65
|
+
case q:
|
|
66
66
|
return "SuspenseList";
|
|
67
|
-
case
|
|
67
|
+
case J:
|
|
68
68
|
return "Activity";
|
|
69
69
|
}
|
|
70
|
-
if (typeof
|
|
71
|
-
switch (typeof
|
|
70
|
+
if (typeof t == "object")
|
|
71
|
+
switch (typeof t.tag == "number" && console.error(
|
|
72
72
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
73
|
-
),
|
|
74
|
-
case
|
|
73
|
+
), t.$$typeof) {
|
|
74
|
+
case v:
|
|
75
75
|
return "Portal";
|
|
76
|
-
case
|
|
77
|
-
return
|
|
78
|
-
case
|
|
79
|
-
return (
|
|
80
|
-
case
|
|
81
|
-
var
|
|
82
|
-
return
|
|
83
|
-
case
|
|
84
|
-
return
|
|
85
|
-
case
|
|
86
|
-
|
|
76
|
+
case D:
|
|
77
|
+
return t.displayName || "Context";
|
|
78
|
+
case _:
|
|
79
|
+
return (t._context.displayName || "Context") + ".Consumer";
|
|
80
|
+
case M:
|
|
81
|
+
var x = t.render;
|
|
82
|
+
return t = t.displayName, t || (t = x.displayName || x.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
83
|
+
case H:
|
|
84
|
+
return x = t.displayName || null, x !== null ? x : r(t.type) || "Memo";
|
|
85
|
+
case I:
|
|
86
|
+
x = t._payload, t = t._init;
|
|
87
87
|
try {
|
|
88
|
-
return
|
|
88
|
+
return r(t(x));
|
|
89
89
|
} catch {
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return "" +
|
|
94
|
+
function i(t) {
|
|
95
|
+
return "" + t;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function s(t) {
|
|
98
98
|
try {
|
|
99
|
-
|
|
100
|
-
var
|
|
99
|
+
i(t);
|
|
100
|
+
var x = !1;
|
|
101
101
|
} catch {
|
|
102
|
-
|
|
102
|
+
x = !0;
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
return
|
|
108
|
-
|
|
104
|
+
if (x) {
|
|
105
|
+
x = console;
|
|
106
|
+
var C = x.error, S = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
107
|
+
return C.call(
|
|
108
|
+
x,
|
|
109
109
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
110
|
-
|
|
111
|
-
),
|
|
110
|
+
S
|
|
111
|
+
), i(t);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
if (
|
|
116
|
-
if (typeof
|
|
114
|
+
function c(t) {
|
|
115
|
+
if (t === N) return "<>";
|
|
116
|
+
if (typeof t == "object" && t !== null && t.$$typeof === I)
|
|
117
117
|
return "<...>";
|
|
118
118
|
try {
|
|
119
|
-
var
|
|
120
|
-
return
|
|
119
|
+
var x = r(t);
|
|
120
|
+
return x ? "<" + x + ">" : "<...>";
|
|
121
121
|
} catch {
|
|
122
122
|
return "<...>";
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
var
|
|
127
|
-
return
|
|
125
|
+
function d() {
|
|
126
|
+
var t = P.A;
|
|
127
|
+
return t === null ? null : t.getOwner();
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function p() {
|
|
130
130
|
return Error("react-stack-top-frame");
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
if (
|
|
134
|
-
var
|
|
135
|
-
if (
|
|
132
|
+
function f(t) {
|
|
133
|
+
if (se.call(t, "key")) {
|
|
134
|
+
var x = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
135
|
+
if (x && x.isReactWarning) return !1;
|
|
136
136
|
}
|
|
137
|
-
return
|
|
137
|
+
return t.key !== void 0;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
function
|
|
141
|
-
|
|
139
|
+
function n(t, x) {
|
|
140
|
+
function C() {
|
|
141
|
+
o || (o = !0, console.error(
|
|
142
142
|
"%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)",
|
|
143
|
-
|
|
143
|
+
x
|
|
144
144
|
));
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
get:
|
|
146
|
+
C.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
147
|
+
get: C,
|
|
148
148
|
configurable: !0
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
function h() {
|
|
152
|
-
var
|
|
153
|
-
return
|
|
152
|
+
var t = r(this.type);
|
|
153
|
+
return u[t] || (u[t] = !0, console.error(
|
|
154
154
|
"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."
|
|
155
|
-
)),
|
|
155
|
+
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
var
|
|
159
|
-
return
|
|
160
|
-
$$typeof:
|
|
161
|
-
type:
|
|
162
|
-
key:
|
|
163
|
-
props:
|
|
164
|
-
_owner:
|
|
165
|
-
}, (
|
|
157
|
+
function l(t, x, C, S, re, ce) {
|
|
158
|
+
var E = C.ref;
|
|
159
|
+
return t = {
|
|
160
|
+
$$typeof: m,
|
|
161
|
+
type: t,
|
|
162
|
+
key: x,
|
|
163
|
+
props: C,
|
|
164
|
+
_owner: S
|
|
165
|
+
}, (E !== void 0 ? E : null) !== null ? Object.defineProperty(t, "ref", {
|
|
166
166
|
enumerable: !1,
|
|
167
167
|
get: h
|
|
168
|
-
}) : Object.defineProperty(
|
|
168
|
+
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
169
169
|
configurable: !1,
|
|
170
170
|
enumerable: !1,
|
|
171
171
|
writable: !0,
|
|
172
172
|
value: 0
|
|
173
|
-
}), Object.defineProperty(
|
|
173
|
+
}), Object.defineProperty(t, "_debugInfo", {
|
|
174
174
|
configurable: !1,
|
|
175
175
|
enumerable: !1,
|
|
176
176
|
writable: !0,
|
|
177
177
|
value: null
|
|
178
|
-
}), Object.defineProperty(
|
|
178
|
+
}), Object.defineProperty(t, "_debugStack", {
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
|
-
value:
|
|
183
|
-
}), Object.defineProperty(
|
|
182
|
+
value: re
|
|
183
|
+
}), Object.defineProperty(t, "_debugTask", {
|
|
184
184
|
configurable: !1,
|
|
185
185
|
enumerable: !1,
|
|
186
186
|
writable: !0,
|
|
187
|
-
value:
|
|
188
|
-
}), Object.freeze && (Object.freeze(
|
|
187
|
+
value: ce
|
|
188
|
+
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
var
|
|
192
|
-
if (
|
|
193
|
-
if (
|
|
194
|
-
if (
|
|
195
|
-
for (
|
|
196
|
-
y(
|
|
197
|
-
Object.freeze && Object.freeze(
|
|
190
|
+
function j(t, x, C, S, re, ce) {
|
|
191
|
+
var E = x.children;
|
|
192
|
+
if (E !== void 0)
|
|
193
|
+
if (S)
|
|
194
|
+
if (ie(E)) {
|
|
195
|
+
for (S = 0; S < E.length; S++)
|
|
196
|
+
y(E[S]);
|
|
197
|
+
Object.freeze && Object.freeze(E);
|
|
198
198
|
} else
|
|
199
199
|
console.error(
|
|
200
200
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
201
201
|
);
|
|
202
|
-
else y(
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
var G = Object.keys(
|
|
206
|
-
return
|
|
202
|
+
else y(E);
|
|
203
|
+
if (se.call(x, "key")) {
|
|
204
|
+
E = r(t);
|
|
205
|
+
var G = Object.keys(x).filter(function(Ce) {
|
|
206
|
+
return Ce !== "key";
|
|
207
207
|
});
|
|
208
|
-
|
|
208
|
+
S = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", Z[E + S] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
209
209
|
`A props object containing a "key" prop is being spread into JSX:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s {...props} />
|
|
212
212
|
React keys must be passed directly to JSX without using spread:
|
|
213
213
|
let props = %s;
|
|
214
214
|
<%s key={someKey} {...props} />`,
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
S,
|
|
216
|
+
E,
|
|
217
217
|
G,
|
|
218
|
-
|
|
219
|
-
),
|
|
218
|
+
E
|
|
219
|
+
), Z[E + S] = !0);
|
|
220
220
|
}
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
for (var
|
|
224
|
-
|
|
225
|
-
} else
|
|
226
|
-
return
|
|
227
|
-
|
|
228
|
-
typeof
|
|
229
|
-
),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
221
|
+
if (E = null, C !== void 0 && (s(C), E = "" + C), f(x) && (s(x.key), E = "" + x.key), "key" in x) {
|
|
222
|
+
C = {};
|
|
223
|
+
for (var oe in x)
|
|
224
|
+
oe !== "key" && (C[oe] = x[oe]);
|
|
225
|
+
} else C = x;
|
|
226
|
+
return E && n(
|
|
227
|
+
C,
|
|
228
|
+
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
229
|
+
), l(
|
|
230
|
+
t,
|
|
231
|
+
E,
|
|
232
|
+
C,
|
|
233
|
+
d(),
|
|
234
|
+
re,
|
|
235
|
+
ce
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
|
-
function y(
|
|
239
|
-
|
|
238
|
+
function y(t) {
|
|
239
|
+
R(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === I && (t._payload.status === "fulfilled" ? R(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
return typeof
|
|
241
|
+
function R(t) {
|
|
242
|
+
return typeof t == "object" && t !== null && t.$$typeof === m;
|
|
243
243
|
}
|
|
244
|
-
var w =
|
|
244
|
+
var w = ke, m = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), D = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), q = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), P = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, se = Object.prototype.hasOwnProperty, ie = Array.isArray, a = console.createTask ? console.createTask : function() {
|
|
245
245
|
return null;
|
|
246
246
|
};
|
|
247
247
|
w = {
|
|
248
|
-
react_stack_bottom_frame: function(
|
|
249
|
-
return
|
|
248
|
+
react_stack_bottom_frame: function(t) {
|
|
249
|
+
return t();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
var
|
|
252
|
+
var o, u = {}, T = w.react_stack_bottom_frame.bind(
|
|
253
253
|
w,
|
|
254
|
-
|
|
255
|
-
)(),
|
|
256
|
-
|
|
257
|
-
var
|
|
258
|
-
return
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
p
|
|
255
|
+
)(), X = a(c(p)), Z = {};
|
|
256
|
+
K.Fragment = N, K.jsx = function(t, x, C) {
|
|
257
|
+
var S = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
258
|
+
return j(
|
|
259
|
+
t,
|
|
260
|
+
x,
|
|
261
|
+
C,
|
|
262
262
|
!1,
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
S ? Error("react-stack-top-frame") : T,
|
|
264
|
+
S ? a(c(t)) : X
|
|
265
265
|
);
|
|
266
|
-
},
|
|
267
|
-
var
|
|
268
|
-
return
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
}, K.jsxs = function(t, x, C) {
|
|
267
|
+
var S = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
268
|
+
return j(
|
|
269
|
+
t,
|
|
270
|
+
x,
|
|
271
|
+
C,
|
|
272
272
|
!0,
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
S ? Error("react-stack-top-frame") : T,
|
|
274
|
+
S ? a(c(t)) : X
|
|
275
275
|
);
|
|
276
276
|
};
|
|
277
|
-
}()),
|
|
277
|
+
}()), K;
|
|
278
278
|
}
|
|
279
|
-
process.env.NODE_ENV === "production" ?
|
|
280
|
-
var e =
|
|
281
|
-
const
|
|
279
|
+
process.env.NODE_ENV === "production" ? me.exports = Pe() : me.exports = Le();
|
|
280
|
+
var e = me.exports;
|
|
281
|
+
const De = ({ schema: r }) => {
|
|
282
282
|
var h;
|
|
283
|
-
const { title:
|
|
284
|
-
(h =
|
|
285
|
-
const
|
|
286
|
-
return /* @__PURE__ */ e.jsxs(
|
|
283
|
+
const { title: i, description: s, data: c, columns: d } = r;
|
|
284
|
+
(h = r.chart) != null && h.type;
|
|
285
|
+
const p = !!r.chart, n = !(process.env.NODE_ENV === "test");
|
|
286
|
+
return /* @__PURE__ */ e.jsxs(B, { className: `h-full flex flex-col ${r.className || ""}`, children: [
|
|
287
287
|
/* @__PURE__ */ e.jsxs(ee, { children: [
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
i && /* @__PURE__ */ e.jsx(te, { children: i }),
|
|
289
|
+
s && /* @__PURE__ */ e.jsx(he, { children: s })
|
|
290
290
|
] }),
|
|
291
|
-
/* @__PURE__ */ e.jsxs(
|
|
292
|
-
|
|
291
|
+
/* @__PURE__ */ e.jsxs(z, { className: "flex-1 overflow-auto space-y-4", children: [
|
|
292
|
+
p && (() => {
|
|
293
293
|
var y;
|
|
294
|
-
const
|
|
295
|
-
let
|
|
296
|
-
return
|
|
294
|
+
const l = (y = r.chart) == null ? void 0 : y.type;
|
|
295
|
+
let j = l ? L.get(l) : null;
|
|
296
|
+
return j || (j = L.get("chart")), j ? /* @__PURE__ */ e.jsx("div", { className: "min-h-[300px] border rounded-md p-4 bg-white/50", children: /* @__PURE__ */ e.jsx(j, { schema: { ...r.chart, data: r.chart.data || c } }) }) : /* @__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: [
|
|
297
297
|
"Unknown component type: ",
|
|
298
|
-
|
|
298
|
+
l || "chart"
|
|
299
299
|
] });
|
|
300
300
|
})(),
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
return
|
|
304
|
-
|
|
301
|
+
c && c.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-md", children: (() => {
|
|
302
|
+
const l = n ? L.get("aggrid") || L.get("table") : null;
|
|
303
|
+
return l ? /* @__PURE__ */ e.jsx(
|
|
304
|
+
l,
|
|
305
305
|
{
|
|
306
306
|
schema: {
|
|
307
307
|
type: "aggrid",
|
|
308
|
-
rowData:
|
|
309
|
-
columnDefs:
|
|
308
|
+
rowData: c,
|
|
309
|
+
columnDefs: d,
|
|
310
310
|
domLayout: "autoHeight"
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
) : (
|
|
314
314
|
// Simple Fallback Table if Grid plugin missing
|
|
315
315
|
/* @__PURE__ */ e.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm text-left", children: [
|
|
316
|
-
/* @__PURE__ */ e.jsx("thead", { className: "text-xs uppercase bg-gray-50", children: /* @__PURE__ */ e.jsx("tr", { children:
|
|
317
|
-
/* @__PURE__ */ e.jsx("tbody", { children:
|
|
316
|
+
/* @__PURE__ */ e.jsx("thead", { className: "text-xs uppercase bg-gray-50", children: /* @__PURE__ */ e.jsx("tr", { children: d == null ? void 0 : d.map((j) => /* @__PURE__ */ e.jsx("th", { className: "px-6 py-3", children: j.headerName || j.label || j.field }, j.field)) }) }),
|
|
317
|
+
/* @__PURE__ */ e.jsx("tbody", { children: c.map((j, y) => /* @__PURE__ */ e.jsx("tr", { className: "bg-white border-b", children: d == null ? void 0 : d.map((R) => /* @__PURE__ */ e.jsx("td", { className: "px-6 py-4", children: j[R.field] }, R.field)) }, y)) })
|
|
318
318
|
] }) })
|
|
319
319
|
);
|
|
320
320
|
})() })
|
|
321
321
|
] })
|
|
322
322
|
] });
|
|
323
|
-
}
|
|
324
|
-
|
|
323
|
+
};
|
|
324
|
+
function Be(r, i, s) {
|
|
325
|
+
const c = r.fields || [], d = c.map((n) => n.label || n.name), p = i.map((n) => c.map((h) => {
|
|
326
|
+
let l = n[h.name];
|
|
327
|
+
return l = ge(l), typeof l == "string" && (l.includes(",") || l.includes('"') || l.includes(`
|
|
328
|
+
`)) ? `"${l.replace(/"/g, '""')}"` : l ?? "";
|
|
329
|
+
})), f = [
|
|
330
|
+
...(s == null ? void 0 : s.includeHeaders) !== !1 ? [d.join(",")] : [],
|
|
331
|
+
...p.map((n) => n.join(","))
|
|
332
|
+
].join(`
|
|
333
|
+
`);
|
|
334
|
+
le(f, (s == null ? void 0 : s.filename) || `${r.title || "report"}.csv`, "text/csv");
|
|
335
|
+
}
|
|
336
|
+
function ze(r, i, s) {
|
|
337
|
+
const c = {
|
|
338
|
+
title: r.title,
|
|
339
|
+
description: r.description,
|
|
340
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
341
|
+
data: i
|
|
342
|
+
}, d = JSON.stringify(c, null, 2);
|
|
343
|
+
le(d, (s == null ? void 0 : s.filename) || `${r.title || "report"}.json`, "application/json");
|
|
344
|
+
}
|
|
345
|
+
function ve(r, i, s) {
|
|
346
|
+
const c = r.fields || [], d = Ne(s == null ? void 0 : s.orientation), p = ye(s == null ? void 0 : s.pageSize), f = `<!DOCTYPE html>
|
|
347
|
+
<html>
|
|
348
|
+
<head>
|
|
349
|
+
<meta charset="utf-8">
|
|
350
|
+
<title>${$(r.title || "Report")}</title>
|
|
351
|
+
<style>
|
|
352
|
+
@page { size: ${p} ${d}; margin: 20mm; }
|
|
353
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
354
|
+
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
355
|
+
.description { color: #666; margin-bottom: 24px; }
|
|
356
|
+
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
357
|
+
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
358
|
+
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
359
|
+
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
360
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
361
|
+
</style>
|
|
362
|
+
</head>
|
|
363
|
+
<body>
|
|
364
|
+
<h1>${$(r.title || "Report")}</h1>
|
|
365
|
+
${r.description ? `<p class="description">${$(r.description)}</p>` : ""}
|
|
366
|
+
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
367
|
+
<table>
|
|
368
|
+
<thead><tr>${c.map((n) => `<th>${$(n.label || n.name)}</th>`).join("")}</tr></thead>
|
|
369
|
+
<tbody>${i.map((n) => `<tr>${c.map((h) => `<td>${$(String(n[h.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
370
|
+
</table>
|
|
371
|
+
</body>
|
|
372
|
+
</html>`;
|
|
373
|
+
le(f, (s == null ? void 0 : s.filename) || `${r.title || "report"}.html`, "text/html");
|
|
374
|
+
}
|
|
375
|
+
function Me(r, i, s) {
|
|
376
|
+
var n;
|
|
377
|
+
const c = r.fields || [], d = Ne(s == null ? void 0 : s.orientation), p = ye(s == null ? void 0 : s.pageSize), f = window.open("", "_blank");
|
|
378
|
+
if (!f) {
|
|
379
|
+
const h = {
|
|
380
|
+
...s,
|
|
381
|
+
filename: ((n = s == null ? void 0 : s.filename) == null ? void 0 : n.replace(/\.pdf$/, ".html")) || `${r.title || "report"}.html`
|
|
382
|
+
};
|
|
383
|
+
ve(r, i, h);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
f.document.write(`<!DOCTYPE html>
|
|
387
|
+
<html>
|
|
388
|
+
<head>
|
|
389
|
+
<meta charset="utf-8">
|
|
390
|
+
<title>${$(r.title || "Report")}</title>
|
|
391
|
+
<style>
|
|
392
|
+
@page { size: ${p} ${d}; margin: 20mm; }
|
|
393
|
+
@media print { .no-print { display: none; } }
|
|
394
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
395
|
+
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
396
|
+
.description { color: #666; margin-bottom: 24px; }
|
|
397
|
+
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
398
|
+
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
399
|
+
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
400
|
+
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
401
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
402
|
+
</style>
|
|
403
|
+
</head>
|
|
404
|
+
<body>
|
|
405
|
+
<h1>${$(r.title || "Report")}</h1>
|
|
406
|
+
${r.description ? `<p class="description">${$(r.description)}</p>` : ""}
|
|
407
|
+
<p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
|
|
408
|
+
<table>
|
|
409
|
+
<thead><tr>${c.map((h) => `<th>${$(h.label || h.name)}</th>`).join("")}</tr></thead>
|
|
410
|
+
<tbody>${i.map((h) => `<tr>${c.map((l) => `<td>${$(String(h[l.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
|
|
411
|
+
</table>
|
|
412
|
+
</body>
|
|
413
|
+
</html>`), f.document.close(), f.onload = () => {
|
|
414
|
+
f.print();
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function Ie(r, i, s) {
|
|
418
|
+
const c = r.fields || [], d = c.map((n) => n.label || n.name), p = i.map((n) => c.map((h) => {
|
|
419
|
+
let l = n[h.name];
|
|
420
|
+
return l = ge(l), typeof l == "string" && (l.includes(",") || l.includes('"') || l.includes(`
|
|
421
|
+
`) || l.includes(" ")) ? `"${l.replace(/"/g, '""')}"` : l ?? "";
|
|
422
|
+
})), f = "\uFEFF" + [
|
|
423
|
+
...(s == null ? void 0 : s.includeHeaders) !== !1 ? [d.join(" ")] : [],
|
|
424
|
+
...p.map((n) => n.join(" "))
|
|
425
|
+
].join(`
|
|
426
|
+
`);
|
|
427
|
+
le(f, (s == null ? void 0 : s.filename) || `${r.title || "report"}.tsv`, "text/tab-separated-values");
|
|
428
|
+
}
|
|
429
|
+
function be(r, i, s, c) {
|
|
430
|
+
switch (r) {
|
|
431
|
+
case "csv":
|
|
432
|
+
Be(i, s, c);
|
|
433
|
+
break;
|
|
434
|
+
case "json":
|
|
435
|
+
ze(i, s, c);
|
|
436
|
+
break;
|
|
437
|
+
case "html":
|
|
438
|
+
ve(i, s, c);
|
|
439
|
+
break;
|
|
440
|
+
case "pdf":
|
|
441
|
+
Me(i, s, c);
|
|
442
|
+
break;
|
|
443
|
+
case "excel":
|
|
444
|
+
Ie(i, s, c);
|
|
445
|
+
break;
|
|
446
|
+
default:
|
|
447
|
+
console.warn(`Unsupported export format: ${r}`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function $(r) {
|
|
451
|
+
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
452
|
+
}
|
|
453
|
+
function ge(r) {
|
|
454
|
+
if (typeof r == "string" && r.length > 0) {
|
|
455
|
+
const i = r.charAt(0);
|
|
456
|
+
if (i === "=" || i === "+" || i === "-" || i === "@" || i === "|")
|
|
457
|
+
return ` ${r}`;
|
|
458
|
+
}
|
|
459
|
+
return r;
|
|
460
|
+
}
|
|
461
|
+
function ye(r) {
|
|
462
|
+
return ["A4", "A3", "Letter", "Legal"].includes(r || "") ? r : "A4";
|
|
463
|
+
}
|
|
464
|
+
function Ne(r) {
|
|
465
|
+
return r === "landscape" ? "landscape" : "portrait";
|
|
466
|
+
}
|
|
467
|
+
function le(r, i, s) {
|
|
468
|
+
const c = new Blob([r], { type: `${s};charset=utf-8` }), d = URL.createObjectURL(c), p = document.createElement("a");
|
|
469
|
+
p.href = d, p.download = i, document.body.appendChild(p), p.click(), document.body.removeChild(p), URL.revokeObjectURL(d);
|
|
470
|
+
}
|
|
471
|
+
const we = ({ schema: r, onRefresh: i }) => {
|
|
472
|
+
var R, w;
|
|
325
473
|
const {
|
|
326
|
-
report:
|
|
327
|
-
data:
|
|
474
|
+
report: s,
|
|
475
|
+
data: c,
|
|
328
476
|
showToolbar: d = !0,
|
|
329
|
-
allowExport:
|
|
330
|
-
allowPrint:
|
|
331
|
-
loading:
|
|
332
|
-
} =
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
477
|
+
allowExport: p = !0,
|
|
478
|
+
allowPrint: f = !0,
|
|
479
|
+
loading: n = !1
|
|
480
|
+
} = r, h = (m) => {
|
|
481
|
+
var v;
|
|
482
|
+
if (!s) {
|
|
483
|
+
console.warn("ReportViewer: Cannot export, no report defined");
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
be(
|
|
487
|
+
m,
|
|
488
|
+
s,
|
|
489
|
+
c || [],
|
|
490
|
+
(v = s.exportConfigs) == null ? void 0 : v[m]
|
|
491
|
+
);
|
|
492
|
+
}, l = () => {
|
|
493
|
+
window.print();
|
|
336
494
|
}, j = () => {
|
|
337
|
-
|
|
495
|
+
i == null || i();
|
|
496
|
+
}, y = (m, v) => {
|
|
497
|
+
if (!c) return 0;
|
|
498
|
+
const N = c.map((k) => Number(k[m]) || 0);
|
|
499
|
+
switch (v) {
|
|
500
|
+
case "count":
|
|
501
|
+
return c.length;
|
|
502
|
+
case "sum":
|
|
503
|
+
return N.reduce((k, g) => k + g, 0);
|
|
504
|
+
case "avg":
|
|
505
|
+
return N.length > 0 ? (N.reduce((k, g) => k + g, 0) / N.length).toFixed(2) : 0;
|
|
506
|
+
case "min":
|
|
507
|
+
return N.length > 0 ? Math.min(...N) : 0;
|
|
508
|
+
case "max":
|
|
509
|
+
return N.length > 0 ? Math.max(...N) : 0;
|
|
510
|
+
default:
|
|
511
|
+
return "";
|
|
512
|
+
}
|
|
338
513
|
};
|
|
339
|
-
return
|
|
514
|
+
return s ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
340
515
|
d && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border", children: [
|
|
341
516
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
342
|
-
/* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold", children:
|
|
343
|
-
|
|
517
|
+
/* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold", children: s.title }),
|
|
518
|
+
s.description && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: s.description })
|
|
344
519
|
] }),
|
|
345
520
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
346
|
-
|
|
347
|
-
/* @__PURE__ */ e.jsx(
|
|
521
|
+
s.refreshInterval && /* @__PURE__ */ e.jsxs(F, { variant: "outline", size: "sm", onClick: j, children: [
|
|
522
|
+
/* @__PURE__ */ e.jsx(Ee, { className: "h-4 w-4 mr-2" }),
|
|
348
523
|
"Refresh"
|
|
349
524
|
] }),
|
|
350
|
-
|
|
351
|
-
/* @__PURE__ */ e.jsx(
|
|
525
|
+
f && /* @__PURE__ */ e.jsxs(F, { variant: "outline", size: "sm", onClick: l, children: [
|
|
526
|
+
/* @__PURE__ */ e.jsx(Te, { className: "h-4 w-4 mr-2" }),
|
|
352
527
|
"Print"
|
|
353
528
|
] }),
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
529
|
+
p && s.showExportButtons && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
530
|
+
/* @__PURE__ */ e.jsxs(
|
|
531
|
+
F,
|
|
532
|
+
{
|
|
533
|
+
variant: "outline",
|
|
534
|
+
size: "sm",
|
|
535
|
+
onClick: () => h("pdf"),
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 mr-2" }),
|
|
538
|
+
"PDF"
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
/* @__PURE__ */ e.jsxs(
|
|
543
|
+
F,
|
|
544
|
+
{
|
|
545
|
+
variant: "outline",
|
|
546
|
+
size: "sm",
|
|
547
|
+
onClick: () => h("excel"),
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 mr-2" }),
|
|
550
|
+
"Excel"
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ e.jsxs(
|
|
555
|
+
F,
|
|
556
|
+
{
|
|
557
|
+
variant: "outline",
|
|
558
|
+
size: "sm",
|
|
559
|
+
onClick: () => h("csv"),
|
|
560
|
+
children: [
|
|
561
|
+
/* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 mr-2" }),
|
|
562
|
+
"CSV"
|
|
563
|
+
]
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
] })
|
|
366
567
|
] })
|
|
367
568
|
] }),
|
|
368
|
-
/* @__PURE__ */ e.jsxs(
|
|
569
|
+
/* @__PURE__ */ e.jsxs(B, { children: [
|
|
369
570
|
/* @__PURE__ */ e.jsxs(ee, { children: [
|
|
370
|
-
!d &&
|
|
371
|
-
!d &&
|
|
571
|
+
!d && s.title && /* @__PURE__ */ e.jsx(te, { children: s.title }),
|
|
572
|
+
!d && s.description && /* @__PURE__ */ e.jsx(he, { children: s.description })
|
|
372
573
|
] }),
|
|
373
|
-
/* @__PURE__ */ e.jsxs(
|
|
374
|
-
|
|
375
|
-
!
|
|
376
|
-
var
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children:
|
|
382
|
-
/* @__PURE__ */ e.
|
|
383
|
-
o.aggregation === "count" && (u == null ? void 0 : u.length),
|
|
384
|
-
o.aggregation === "sum" && (u == null ? void 0 : u.reduce((k, A) => k + (A[o.name] || 0), 0))
|
|
385
|
-
] })
|
|
574
|
+
/* @__PURE__ */ e.jsxs(z, { className: "space-y-6", children: [
|
|
575
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground", children: "Loading report data..." }),
|
|
576
|
+
!n && ((R = s.sections) == null ? void 0 : R.map((m, v) => {
|
|
577
|
+
var N, k;
|
|
578
|
+
return m.visible === !1 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
579
|
+
m.title && /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-semibold border-b pb-2", children: m.title }),
|
|
580
|
+
m.type === "header" && m.title && /* @__PURE__ */ e.jsx("div", { className: "text-2xl font-bold py-4", children: m.title }),
|
|
581
|
+
m.type === "summary" && /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: (N = s.fields) == null ? void 0 : N.filter((g) => g.showInSummary).map((g, _) => /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsxs(z, { className: "p-4", children: [
|
|
582
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: g.label || g.name }),
|
|
583
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-2xl font-bold", children: y(g.name, g.aggregation) })
|
|
386
584
|
] }) }, _)) }),
|
|
387
|
-
|
|
388
|
-
let
|
|
389
|
-
const _ = !!
|
|
390
|
-
!
|
|
391
|
-
const O =
|
|
392
|
-
xAxisKey:
|
|
393
|
-
series:
|
|
585
|
+
m.type === "chart" && m.chart && /* @__PURE__ */ e.jsx("div", { className: "min-h-[300px]", children: (() => {
|
|
586
|
+
let g = m.chart.type;
|
|
587
|
+
const _ = !!m.chart.chartType;
|
|
588
|
+
!g && _ && (g = "chart"), g && !!L.get(g) || (g = "chart");
|
|
589
|
+
const O = g === "chart" ? {
|
|
590
|
+
xAxisKey: m.chart.xAxisKey || m.chart.xAxisField || "name",
|
|
591
|
+
series: m.chart.series || (m.chart.yAxisFields ? m.chart.yAxisFields.map((H) => ({ dataKey: H })) : []),
|
|
394
592
|
// Ensure chartType is passed if we are using the generic renderer
|
|
395
|
-
chartType:
|
|
396
|
-
} : {},
|
|
397
|
-
...
|
|
398
|
-
type:
|
|
593
|
+
chartType: m.chart.chartType || "bar"
|
|
594
|
+
} : {}, q = {
|
|
595
|
+
...m.chart,
|
|
596
|
+
type: g,
|
|
399
597
|
...O,
|
|
400
|
-
data:
|
|
598
|
+
data: c || m.chart.data,
|
|
401
599
|
// Force explicit height to preventing Recharts "height(-1)" error
|
|
402
|
-
className:
|
|
600
|
+
className: m.chart.className || "w-full h-[350px]"
|
|
403
601
|
};
|
|
404
|
-
return /* @__PURE__ */ e.jsx(
|
|
602
|
+
return /* @__PURE__ */ e.jsx(pe, { schema: q });
|
|
405
603
|
})() }),
|
|
406
|
-
|
|
407
|
-
/* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (
|
|
408
|
-
/* @__PURE__ */ e.jsx("tbody", { children:
|
|
409
|
-
var
|
|
410
|
-
return /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: (
|
|
604
|
+
m.type === "table" && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
|
|
605
|
+
/* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (k = m.columns) == null ? void 0 : k.map((g, _) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: g.label || g.name }, _)) }) }),
|
|
606
|
+
/* @__PURE__ */ e.jsx("tbody", { children: c == null ? void 0 : c.map((g, _) => {
|
|
607
|
+
var D;
|
|
608
|
+
return /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: (D = m.columns) == null ? void 0 : D.map((M, O) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: g[M.name] }, O)) }, _);
|
|
411
609
|
}) })
|
|
412
610
|
] }) }),
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
] },
|
|
611
|
+
m.type === "text" && m.text && /* @__PURE__ */ e.jsx("div", { className: "prose max-w-none", children: /* @__PURE__ */ e.jsx("p", { children: m.text }) }),
|
|
612
|
+
m.type === "page-break" && /* @__PURE__ */ e.jsx("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
|
|
613
|
+
m.content && /* @__PURE__ */ e.jsx(pe, { schema: m.content })
|
|
614
|
+
] }, v);
|
|
417
615
|
})),
|
|
418
|
-
!
|
|
419
|
-
/* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (
|
|
420
|
-
/* @__PURE__ */ e.jsx("tbody", { children:
|
|
421
|
-
var
|
|
422
|
-
return /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: (
|
|
616
|
+
!s.sections && c && c.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full text-sm", children: [
|
|
617
|
+
/* @__PURE__ */ e.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ e.jsx("tr", { children: (w = s.fields) == null ? void 0 : w.map((m, v) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-2 text-left font-medium", children: m.label || m.name }, v)) }) }),
|
|
618
|
+
/* @__PURE__ */ e.jsx("tbody", { children: c.map((m, v) => {
|
|
619
|
+
var N;
|
|
620
|
+
return /* @__PURE__ */ e.jsx("tr", { className: "border-t", children: (N = s.fields) == null ? void 0 : N.map((k, g) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-2", children: m[k.name] }, g)) }, v);
|
|
423
621
|
}) })
|
|
424
622
|
] }) })
|
|
425
623
|
] })
|
|
426
624
|
] })
|
|
427
|
-
] }) : /* @__PURE__ */ e.jsx(
|
|
428
|
-
},
|
|
625
|
+
] }) : /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(z, { className: "p-8 text-center text-muted-foreground", children: "No report to display" }) });
|
|
626
|
+
}, Ge = ({ schedule: r, onChange: i }) => {
|
|
627
|
+
var h;
|
|
628
|
+
const [s, c] = W(r || {
|
|
629
|
+
enabled: !1,
|
|
630
|
+
frequency: "weekly",
|
|
631
|
+
time: "09:00",
|
|
632
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
633
|
+
recipients: [],
|
|
634
|
+
formats: ["pdf"]
|
|
635
|
+
}), d = (l) => {
|
|
636
|
+
const j = { ...s, ...l };
|
|
637
|
+
c(j), i == null || i(j);
|
|
638
|
+
}, p = [
|
|
639
|
+
{ value: "once", label: "Once" },
|
|
640
|
+
{ value: "daily", label: "Daily" },
|
|
641
|
+
{ value: "weekly", label: "Weekly" },
|
|
642
|
+
{ value: "monthly", label: "Monthly" },
|
|
643
|
+
{ value: "quarterly", label: "Quarterly" },
|
|
644
|
+
{ value: "yearly", label: "Yearly" }
|
|
645
|
+
], f = [
|
|
646
|
+
{ value: "pdf", label: "PDF" },
|
|
647
|
+
{ value: "excel", label: "Excel" },
|
|
648
|
+
{ value: "csv", label: "CSV" },
|
|
649
|
+
{ value: "html", label: "HTML" }
|
|
650
|
+
], n = [
|
|
651
|
+
{ value: 0, label: "Sunday" },
|
|
652
|
+
{ value: 1, label: "Monday" },
|
|
653
|
+
{ value: 2, label: "Tuesday" },
|
|
654
|
+
{ value: 3, label: "Wednesday" },
|
|
655
|
+
{ value: 4, label: "Thursday" },
|
|
656
|
+
{ value: 5, label: "Friday" },
|
|
657
|
+
{ value: 6, label: "Saturday" }
|
|
658
|
+
];
|
|
659
|
+
return /* @__PURE__ */ e.jsxs(B, { children: [
|
|
660
|
+
/* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsxs(te, { className: "flex items-center gap-2", children: [
|
|
661
|
+
/* @__PURE__ */ e.jsx(je, { className: "h-5 w-5" }),
|
|
662
|
+
"Schedule Configuration"
|
|
663
|
+
] }) }),
|
|
664
|
+
/* @__PURE__ */ e.jsxs(z, { className: "space-y-4", children: [
|
|
665
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
666
|
+
/* @__PURE__ */ e.jsx(
|
|
667
|
+
"input",
|
|
668
|
+
{
|
|
669
|
+
type: "checkbox",
|
|
670
|
+
id: "schedule-enabled",
|
|
671
|
+
checked: s.enabled || !1,
|
|
672
|
+
onChange: (l) => d({ enabled: l.target.checked }),
|
|
673
|
+
className: "rounded"
|
|
674
|
+
}
|
|
675
|
+
),
|
|
676
|
+
/* @__PURE__ */ e.jsx(b, { htmlFor: "schedule-enabled", children: "Enable Scheduled Report" })
|
|
677
|
+
] }),
|
|
678
|
+
s.enabled && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
679
|
+
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
680
|
+
/* @__PURE__ */ e.jsx(b, { children: "Frequency" }),
|
|
681
|
+
/* @__PURE__ */ e.jsx(
|
|
682
|
+
"select",
|
|
683
|
+
{
|
|
684
|
+
className: "w-full border rounded-md p-2 bg-background",
|
|
685
|
+
value: s.frequency || "weekly",
|
|
686
|
+
onChange: (l) => d({ frequency: l.target.value }),
|
|
687
|
+
children: p.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.value, children: l.label }, l.value))
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
] }),
|
|
691
|
+
s.frequency === "weekly" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
692
|
+
/* @__PURE__ */ e.jsx(b, { children: "Day of Week" }),
|
|
693
|
+
/* @__PURE__ */ e.jsx(
|
|
694
|
+
"select",
|
|
695
|
+
{
|
|
696
|
+
className: "w-full border rounded-md p-2 bg-background",
|
|
697
|
+
value: s.dayOfWeek ?? 1,
|
|
698
|
+
onChange: (l) => d({ dayOfWeek: Number(l.target.value) }),
|
|
699
|
+
children: n.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.value, children: l.label }, l.value))
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
] }),
|
|
703
|
+
s.frequency === "monthly" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
704
|
+
/* @__PURE__ */ e.jsx(b, { children: "Day of Month" }),
|
|
705
|
+
/* @__PURE__ */ e.jsx(
|
|
706
|
+
A,
|
|
707
|
+
{
|
|
708
|
+
type: "number",
|
|
709
|
+
min: 1,
|
|
710
|
+
max: 31,
|
|
711
|
+
value: s.dayOfMonth ?? 1,
|
|
712
|
+
onChange: (l) => d({ dayOfMonth: Number(l.target.value) })
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
] }),
|
|
716
|
+
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
717
|
+
/* @__PURE__ */ e.jsxs(b, { className: "flex items-center gap-2", children: [
|
|
718
|
+
/* @__PURE__ */ e.jsx(Fe, { className: "h-4 w-4" }),
|
|
719
|
+
"Time"
|
|
720
|
+
] }),
|
|
721
|
+
/* @__PURE__ */ e.jsx(
|
|
722
|
+
A,
|
|
723
|
+
{
|
|
724
|
+
type: "time",
|
|
725
|
+
value: s.time || "09:00",
|
|
726
|
+
onChange: (l) => d({ time: l.target.value })
|
|
727
|
+
}
|
|
728
|
+
)
|
|
729
|
+
] }),
|
|
730
|
+
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
731
|
+
/* @__PURE__ */ e.jsx(b, { children: "Timezone" }),
|
|
732
|
+
/* @__PURE__ */ e.jsx(
|
|
733
|
+
A,
|
|
734
|
+
{
|
|
735
|
+
value: s.timezone || "",
|
|
736
|
+
onChange: (l) => d({ timezone: l.target.value }),
|
|
737
|
+
placeholder: "e.g. America/New_York"
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
] }),
|
|
741
|
+
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
742
|
+
/* @__PURE__ */ e.jsx(b, { children: "Export Formats" }),
|
|
743
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: f.map((l) => {
|
|
744
|
+
var j;
|
|
745
|
+
return /* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-1.5 px-3 py-1.5 border rounded-md cursor-pointer hover:bg-muted/50", children: [
|
|
746
|
+
/* @__PURE__ */ e.jsx(
|
|
747
|
+
"input",
|
|
748
|
+
{
|
|
749
|
+
type: "checkbox",
|
|
750
|
+
checked: ((j = s.formats) == null ? void 0 : j.includes(l.value)) || !1,
|
|
751
|
+
onChange: (y) => {
|
|
752
|
+
const R = s.formats || [];
|
|
753
|
+
d({
|
|
754
|
+
formats: y.target.checked ? [...R, l.value] : R.filter((w) => w !== l.value)
|
|
755
|
+
});
|
|
756
|
+
},
|
|
757
|
+
className: "rounded"
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: l.label })
|
|
761
|
+
] }, l.value);
|
|
762
|
+
}) })
|
|
763
|
+
] }),
|
|
764
|
+
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
765
|
+
/* @__PURE__ */ e.jsxs(b, { className: "flex items-center gap-2", children: [
|
|
766
|
+
/* @__PURE__ */ e.jsx(_e, { className: "h-4 w-4" }),
|
|
767
|
+
"Email Recipients"
|
|
768
|
+
] }),
|
|
769
|
+
/* @__PURE__ */ e.jsx(
|
|
770
|
+
A,
|
|
771
|
+
{
|
|
772
|
+
placeholder: "email1@example.com, email2@example.com",
|
|
773
|
+
value: ((h = s.recipients) == null ? void 0 : h.join(", ")) || "",
|
|
774
|
+
onChange: (l) => d({
|
|
775
|
+
recipients: l.target.value.split(",").map((j) => j.trim()).filter(Boolean)
|
|
776
|
+
})
|
|
777
|
+
}
|
|
778
|
+
)
|
|
779
|
+
] }),
|
|
780
|
+
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
781
|
+
/* @__PURE__ */ e.jsx(b, { children: "Email Subject" }),
|
|
782
|
+
/* @__PURE__ */ e.jsx(
|
|
783
|
+
A,
|
|
784
|
+
{
|
|
785
|
+
value: s.subject || "",
|
|
786
|
+
onChange: (l) => d({ subject: l.target.value }),
|
|
787
|
+
placeholder: "Scheduled Report: {report_title}"
|
|
788
|
+
}
|
|
789
|
+
)
|
|
790
|
+
] })
|
|
791
|
+
] })
|
|
792
|
+
] })
|
|
793
|
+
] });
|
|
794
|
+
}, Ue = ({ schema: r }) => {
|
|
429
795
|
const {
|
|
430
|
-
report:
|
|
431
|
-
dataSources:
|
|
432
|
-
availableFields:
|
|
433
|
-
showPreview:
|
|
434
|
-
onSave:
|
|
435
|
-
onCancel:
|
|
436
|
-
} =
|
|
796
|
+
report: i,
|
|
797
|
+
dataSources: s = [],
|
|
798
|
+
availableFields: c = [],
|
|
799
|
+
showPreview: d = !0,
|
|
800
|
+
onSave: p,
|
|
801
|
+
onCancel: f
|
|
802
|
+
} = r, [n, h] = W(i || {
|
|
437
803
|
type: "report",
|
|
438
804
|
title: "New Report",
|
|
439
805
|
fields: [],
|
|
@@ -442,141 +808,145 @@ const Te = ({ schema: v }) => {
|
|
|
442
808
|
sections: [],
|
|
443
809
|
showExportButtons: !0,
|
|
444
810
|
showPrintButton: !0
|
|
445
|
-
}), [
|
|
446
|
-
if (
|
|
447
|
-
const
|
|
448
|
-
(
|
|
811
|
+
}), [l, j] = W(n.fields || []), [y, R] = W(n.filters || []), [w, m] = W(n.groupBy || []), [v, N] = W(n.sections || []), k = () => {
|
|
812
|
+
if (c.length > 0 && l.length < c.length) {
|
|
813
|
+
const a = c.find(
|
|
814
|
+
(o) => !l.some((u) => u.name === o.name)
|
|
449
815
|
);
|
|
450
|
-
if (
|
|
451
|
-
const
|
|
452
|
-
|
|
816
|
+
if (a) {
|
|
817
|
+
const o = [...l, a];
|
|
818
|
+
j(o), h({ ...n, fields: o });
|
|
453
819
|
}
|
|
454
820
|
}
|
|
455
|
-
},
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
},
|
|
459
|
-
const
|
|
460
|
-
a
|
|
461
|
-
},
|
|
462
|
-
var
|
|
463
|
-
const
|
|
464
|
-
field: ((
|
|
821
|
+
}, g = (a) => {
|
|
822
|
+
const o = l.filter((u, T) => T !== a);
|
|
823
|
+
j(o), h({ ...n, fields: o });
|
|
824
|
+
}, _ = (a, o) => {
|
|
825
|
+
const u = [...l];
|
|
826
|
+
u[a] = o, j(u), h({ ...n, fields: u });
|
|
827
|
+
}, D = () => {
|
|
828
|
+
var u;
|
|
829
|
+
const a = {
|
|
830
|
+
field: ((u = c[0]) == null ? void 0 : u.name) || "",
|
|
465
831
|
operator: "equals",
|
|
466
832
|
value: ""
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
},
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
},
|
|
473
|
-
const
|
|
474
|
-
a
|
|
475
|
-
},
|
|
476
|
-
var
|
|
477
|
-
const
|
|
478
|
-
field: ((
|
|
833
|
+
}, o = [...y, a];
|
|
834
|
+
R(o), h({ ...n, filters: o });
|
|
835
|
+
}, M = (a) => {
|
|
836
|
+
const o = y.filter((u, T) => T !== a);
|
|
837
|
+
R(o), h({ ...n, filters: o });
|
|
838
|
+
}, O = (a, o) => {
|
|
839
|
+
const u = [...y];
|
|
840
|
+
u[a] = o, R(u), h({ ...n, filters: u });
|
|
841
|
+
}, q = () => {
|
|
842
|
+
var u;
|
|
843
|
+
const a = {
|
|
844
|
+
field: ((u = c[0]) == null ? void 0 : u.name) || "",
|
|
479
845
|
sort: "asc"
|
|
480
|
-
},
|
|
481
|
-
|
|
482
|
-
},
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
},
|
|
486
|
-
const
|
|
487
|
-
a
|
|
488
|
-
},
|
|
489
|
-
const
|
|
490
|
-
type:
|
|
491
|
-
title: `New ${
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
const
|
|
496
|
-
o
|
|
497
|
-
},
|
|
498
|
-
const
|
|
499
|
-
a
|
|
500
|
-
},
|
|
501
|
-
console.log("Saving report:",
|
|
502
|
-
},
|
|
503
|
-
console.log("
|
|
846
|
+
}, o = [...w, a];
|
|
847
|
+
m(o), h({ ...n, groupBy: o });
|
|
848
|
+
}, H = (a) => {
|
|
849
|
+
const o = w.filter((u, T) => T !== a);
|
|
850
|
+
m(o), h({ ...n, groupBy: o });
|
|
851
|
+
}, I = (a, o) => {
|
|
852
|
+
const u = [...w];
|
|
853
|
+
u[a] = o, m(u), h({ ...n, groupBy: u });
|
|
854
|
+
}, J = (a) => {
|
|
855
|
+
const o = {
|
|
856
|
+
type: a,
|
|
857
|
+
title: `New ${a} Section`
|
|
858
|
+
}, u = [...v, o];
|
|
859
|
+
N(u), h({ ...n, sections: u });
|
|
860
|
+
}, ne = (a) => {
|
|
861
|
+
const o = v.filter((u, T) => T !== a);
|
|
862
|
+
N(o), h({ ...n, sections: o });
|
|
863
|
+
}, P = (a, o) => {
|
|
864
|
+
const u = [...v];
|
|
865
|
+
u[a] = o, N(u), h({ ...n, sections: u });
|
|
866
|
+
}, se = () => {
|
|
867
|
+
console.log("Saving report:", n), p && alert("Report saved! (Handler: " + p + ")");
|
|
868
|
+
}, ie = () => {
|
|
869
|
+
f && console.log("Report cancelled:", f);
|
|
504
870
|
};
|
|
505
871
|
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
506
|
-
/* @__PURE__ */ e.jsxs(
|
|
872
|
+
/* @__PURE__ */ e.jsxs(B, { children: [
|
|
507
873
|
/* @__PURE__ */ e.jsxs(ee, { children: [
|
|
508
|
-
/* @__PURE__ */ e.jsx(
|
|
509
|
-
/* @__PURE__ */ e.jsx(
|
|
874
|
+
/* @__PURE__ */ e.jsx(te, { children: "Report Builder" }),
|
|
875
|
+
/* @__PURE__ */ e.jsx(he, { children: "Configure your report settings, fields, filters, and sections" })
|
|
510
876
|
] }),
|
|
511
|
-
/* @__PURE__ */ e.jsxs(
|
|
512
|
-
/* @__PURE__ */ e.jsxs(
|
|
513
|
-
/* @__PURE__ */ e.jsxs(
|
|
514
|
-
/* @__PURE__ */ e.jsxs(
|
|
515
|
-
/* @__PURE__ */ e.jsx(
|
|
877
|
+
/* @__PURE__ */ e.jsxs(z, { children: [
|
|
878
|
+
/* @__PURE__ */ e.jsxs(Re, { defaultValue: "basic", className: "w-full", children: [
|
|
879
|
+
/* @__PURE__ */ e.jsxs(Se, { className: "grid w-full grid-cols-6", children: [
|
|
880
|
+
/* @__PURE__ */ e.jsxs(U, { value: "basic", children: [
|
|
881
|
+
/* @__PURE__ */ e.jsx(Ae, { className: "h-4 w-4 mr-2" }),
|
|
516
882
|
"Basic"
|
|
517
883
|
] }),
|
|
518
|
-
/* @__PURE__ */ e.jsxs(
|
|
519
|
-
/* @__PURE__ */ e.jsx(
|
|
884
|
+
/* @__PURE__ */ e.jsxs(U, { value: "fields", children: [
|
|
885
|
+
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
|
|
520
886
|
"Fields"
|
|
521
887
|
] }),
|
|
522
|
-
/* @__PURE__ */ e.jsxs(
|
|
523
|
-
/* @__PURE__ */ e.jsx(
|
|
888
|
+
/* @__PURE__ */ e.jsxs(U, { value: "filters", children: [
|
|
889
|
+
/* @__PURE__ */ e.jsx($e, { className: "h-4 w-4 mr-2" }),
|
|
524
890
|
"Filters"
|
|
525
891
|
] }),
|
|
526
|
-
/* @__PURE__ */ e.jsxs(
|
|
527
|
-
/* @__PURE__ */ e.jsx(
|
|
892
|
+
/* @__PURE__ */ e.jsxs(U, { value: "grouping", children: [
|
|
893
|
+
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
|
|
528
894
|
"Group By"
|
|
529
895
|
] }),
|
|
530
|
-
/* @__PURE__ */ e.jsxs(
|
|
531
|
-
/* @__PURE__ */ e.jsx(
|
|
896
|
+
/* @__PURE__ */ e.jsxs(U, { value: "sections", children: [
|
|
897
|
+
/* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 mr-2" }),
|
|
532
898
|
"Sections"
|
|
899
|
+
] }),
|
|
900
|
+
/* @__PURE__ */ e.jsxs(U, { value: "schedule", children: [
|
|
901
|
+
/* @__PURE__ */ e.jsx(je, { className: "h-4 w-4 mr-2" }),
|
|
902
|
+
"Schedule"
|
|
533
903
|
] })
|
|
534
904
|
] }),
|
|
535
|
-
/* @__PURE__ */ e.jsx(
|
|
905
|
+
/* @__PURE__ */ e.jsx(Y, { value: "basic", className: "space-y-4 mt-4", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
536
906
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
537
|
-
/* @__PURE__ */ e.jsx(
|
|
907
|
+
/* @__PURE__ */ e.jsx(b, { htmlFor: "report-title", children: "Report Title" }),
|
|
538
908
|
/* @__PURE__ */ e.jsx(
|
|
539
|
-
|
|
909
|
+
A,
|
|
540
910
|
{
|
|
541
911
|
id: "report-title",
|
|
542
|
-
value:
|
|
543
|
-
onChange: (
|
|
912
|
+
value: n.title || "",
|
|
913
|
+
onChange: (a) => h({ ...n, title: a.target.value }),
|
|
544
914
|
placeholder: "Enter report title"
|
|
545
915
|
}
|
|
546
916
|
)
|
|
547
917
|
] }),
|
|
548
918
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
549
|
-
/* @__PURE__ */ e.jsx(
|
|
919
|
+
/* @__PURE__ */ e.jsx(b, { htmlFor: "report-description", children: "Description" }),
|
|
550
920
|
/* @__PURE__ */ e.jsx(
|
|
551
|
-
|
|
921
|
+
A,
|
|
552
922
|
{
|
|
553
923
|
id: "report-description",
|
|
554
|
-
value:
|
|
555
|
-
onChange: (
|
|
924
|
+
value: n.description || "",
|
|
925
|
+
onChange: (a) => h({ ...n, description: a.target.value }),
|
|
556
926
|
placeholder: "Enter report description"
|
|
557
927
|
}
|
|
558
928
|
)
|
|
559
929
|
] }),
|
|
560
|
-
|
|
561
|
-
/* @__PURE__ */ e.jsx(
|
|
930
|
+
s.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
931
|
+
/* @__PURE__ */ e.jsx(b, { children: "Data Source" }),
|
|
562
932
|
/* @__PURE__ */ e.jsxs("select", { className: "w-full border rounded-md p-2", children: [
|
|
563
933
|
/* @__PURE__ */ e.jsx("option", { value: "", children: "Select a data source" }),
|
|
564
|
-
|
|
934
|
+
s.map((a, o) => /* @__PURE__ */ e.jsxs("option", { value: o, children: [
|
|
565
935
|
"Data Source ",
|
|
566
|
-
|
|
567
|
-
] },
|
|
936
|
+
o + 1
|
|
937
|
+
] }, o))
|
|
568
938
|
] })
|
|
569
939
|
] }),
|
|
570
940
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
571
|
-
/* @__PURE__ */ e.jsx(
|
|
941
|
+
/* @__PURE__ */ e.jsx(b, { children: "Export Options" }),
|
|
572
942
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
573
943
|
/* @__PURE__ */ e.jsxs("label", { className: "flex items-center gap-2", children: [
|
|
574
944
|
/* @__PURE__ */ e.jsx(
|
|
575
945
|
"input",
|
|
576
946
|
{
|
|
577
947
|
type: "checkbox",
|
|
578
|
-
checked:
|
|
579
|
-
onChange: (
|
|
948
|
+
checked: n.showExportButtons || !1,
|
|
949
|
+
onChange: (a) => h({ ...n, showExportButtons: a.target.checked })
|
|
580
950
|
}
|
|
581
951
|
),
|
|
582
952
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: "Show Export Buttons" })
|
|
@@ -586,8 +956,8 @@ const Te = ({ schema: v }) => {
|
|
|
586
956
|
"input",
|
|
587
957
|
{
|
|
588
958
|
type: "checkbox",
|
|
589
|
-
checked:
|
|
590
|
-
onChange: (
|
|
959
|
+
checked: n.showPrintButton || !1,
|
|
960
|
+
onChange: (a) => h({ ...n, showPrintButton: a.target.checked })
|
|
591
961
|
}
|
|
592
962
|
),
|
|
593
963
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: "Show Print Button" })
|
|
@@ -595,14 +965,14 @@ const Te = ({ schema: v }) => {
|
|
|
595
965
|
] })
|
|
596
966
|
] }),
|
|
597
967
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
598
|
-
/* @__PURE__ */ e.jsx(
|
|
968
|
+
/* @__PURE__ */ e.jsx(b, { htmlFor: "export-format", children: "Default Export Format" }),
|
|
599
969
|
/* @__PURE__ */ e.jsxs(
|
|
600
970
|
"select",
|
|
601
971
|
{
|
|
602
972
|
id: "export-format",
|
|
603
973
|
className: "w-full border rounded-md p-2",
|
|
604
|
-
value:
|
|
605
|
-
onChange: (
|
|
974
|
+
value: n.defaultExportFormat || "pdf",
|
|
975
|
+
onChange: (a) => h({ ...n, defaultExportFormat: a.target.value }),
|
|
606
976
|
children: [
|
|
607
977
|
/* @__PURE__ */ e.jsx("option", { value: "pdf", children: "PDF" }),
|
|
608
978
|
/* @__PURE__ */ e.jsx("option", { value: "excel", children: "Excel" }),
|
|
@@ -614,48 +984,48 @@ const Te = ({ schema: v }) => {
|
|
|
614
984
|
)
|
|
615
985
|
] })
|
|
616
986
|
] }) }),
|
|
617
|
-
/* @__PURE__ */ e.jsxs(
|
|
987
|
+
/* @__PURE__ */ e.jsxs(Y, { value: "fields", className: "space-y-4 mt-4", children: [
|
|
618
988
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
619
|
-
/* @__PURE__ */ e.jsx(
|
|
989
|
+
/* @__PURE__ */ e.jsx(b, { children: "Report Fields" }),
|
|
620
990
|
/* @__PURE__ */ e.jsxs(
|
|
621
|
-
|
|
991
|
+
F,
|
|
622
992
|
{
|
|
623
993
|
size: "sm",
|
|
624
994
|
variant: "outline",
|
|
625
|
-
onClick:
|
|
626
|
-
disabled:
|
|
995
|
+
onClick: k,
|
|
996
|
+
disabled: l.length >= c.length,
|
|
627
997
|
children: [
|
|
628
|
-
/* @__PURE__ */ e.jsx(
|
|
998
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
|
|
629
999
|
"Add Field"
|
|
630
1000
|
]
|
|
631
1001
|
}
|
|
632
1002
|
)
|
|
633
1003
|
] }),
|
|
634
1004
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
635
|
-
|
|
1005
|
+
l.map((a, o) => /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: /* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-4 gap-2", children: [
|
|
636
1006
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
637
|
-
/* @__PURE__ */ e.jsx(
|
|
638
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children:
|
|
1007
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Field Name" }),
|
|
1008
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children: a.name })
|
|
639
1009
|
] }),
|
|
640
1010
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
641
|
-
/* @__PURE__ */ e.jsx(
|
|
1011
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Label" }),
|
|
642
1012
|
/* @__PURE__ */ e.jsx(
|
|
643
|
-
|
|
1013
|
+
A,
|
|
644
1014
|
{
|
|
645
1015
|
className: "h-8 text-sm",
|
|
646
|
-
value:
|
|
647
|
-
onChange: (
|
|
1016
|
+
value: a.label || a.name,
|
|
1017
|
+
onChange: (u) => _(o, { ...a, label: u.target.value })
|
|
648
1018
|
}
|
|
649
1019
|
)
|
|
650
1020
|
] }),
|
|
651
1021
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
652
|
-
/* @__PURE__ */ e.jsx(
|
|
1022
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Aggregation" }),
|
|
653
1023
|
/* @__PURE__ */ e.jsxs(
|
|
654
1024
|
"select",
|
|
655
1025
|
{
|
|
656
1026
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
657
|
-
value:
|
|
658
|
-
onChange: (
|
|
1027
|
+
value: a.aggregation || "",
|
|
1028
|
+
onChange: (u) => _(o, { ...a, aggregation: u.target.value }),
|
|
659
1029
|
children: [
|
|
660
1030
|
/* @__PURE__ */ e.jsx("option", { value: "", children: "None" }),
|
|
661
1031
|
/* @__PURE__ */ e.jsx("option", { value: "sum", children: "Sum" }),
|
|
@@ -668,50 +1038,50 @@ const Te = ({ schema: v }) => {
|
|
|
668
1038
|
)
|
|
669
1039
|
] }),
|
|
670
1040
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-end", children: /* @__PURE__ */ e.jsx(
|
|
671
|
-
|
|
1041
|
+
F,
|
|
672
1042
|
{
|
|
673
1043
|
size: "sm",
|
|
674
1044
|
variant: "ghost",
|
|
675
1045
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
676
|
-
onClick: () =>
|
|
677
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1046
|
+
onClick: () => g(o),
|
|
1047
|
+
children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
|
|
678
1048
|
}
|
|
679
1049
|
) })
|
|
680
|
-
] }) },
|
|
681
|
-
|
|
1050
|
+
] }) }, o)),
|
|
1051
|
+
l.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: 'No fields selected. Click "Add Field" to begin.' })
|
|
682
1052
|
] })
|
|
683
1053
|
] }),
|
|
684
|
-
/* @__PURE__ */ e.jsxs(
|
|
1054
|
+
/* @__PURE__ */ e.jsxs(Y, { value: "filters", className: "space-y-4 mt-4", children: [
|
|
685
1055
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
686
|
-
/* @__PURE__ */ e.jsx(
|
|
687
|
-
/* @__PURE__ */ e.jsxs(
|
|
688
|
-
/* @__PURE__ */ e.jsx(
|
|
1056
|
+
/* @__PURE__ */ e.jsx(b, { children: "Report Filters" }),
|
|
1057
|
+
/* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: D, children: [
|
|
1058
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
|
|
689
1059
|
"Add Filter"
|
|
690
1060
|
] })
|
|
691
1061
|
] }),
|
|
692
1062
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
693
|
-
y.map((
|
|
1063
|
+
y.map((a, o) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: [
|
|
694
1064
|
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-3 gap-2", children: [
|
|
695
1065
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
696
|
-
/* @__PURE__ */ e.jsx(
|
|
1066
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Field" }),
|
|
697
1067
|
/* @__PURE__ */ e.jsx(
|
|
698
1068
|
"select",
|
|
699
1069
|
{
|
|
700
1070
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
701
|
-
value:
|
|
702
|
-
onChange: (
|
|
703
|
-
children:
|
|
1071
|
+
value: a.field,
|
|
1072
|
+
onChange: (u) => O(o, { ...a, field: u.target.value }),
|
|
1073
|
+
children: c.map((u, T) => /* @__PURE__ */ e.jsx("option", { value: u.name, children: u.label || u.name }, T))
|
|
704
1074
|
}
|
|
705
1075
|
)
|
|
706
1076
|
] }),
|
|
707
1077
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
708
|
-
/* @__PURE__ */ e.jsx(
|
|
1078
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Operator" }),
|
|
709
1079
|
/* @__PURE__ */ e.jsxs(
|
|
710
1080
|
"select",
|
|
711
1081
|
{
|
|
712
1082
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
713
|
-
value:
|
|
714
|
-
onChange: (
|
|
1083
|
+
value: a.operator,
|
|
1084
|
+
onChange: (u) => O(o, { ...a, operator: u.target.value }),
|
|
715
1085
|
children: [
|
|
716
1086
|
/* @__PURE__ */ e.jsx("option", { value: "equals", children: "Equals" }),
|
|
717
1087
|
/* @__PURE__ */ e.jsx("option", { value: "contains", children: "Contains" }),
|
|
@@ -723,62 +1093,62 @@ const Te = ({ schema: v }) => {
|
|
|
723
1093
|
)
|
|
724
1094
|
] }),
|
|
725
1095
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
726
|
-
/* @__PURE__ */ e.jsx(
|
|
1096
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Value" }),
|
|
727
1097
|
/* @__PURE__ */ e.jsx(
|
|
728
|
-
|
|
1098
|
+
A,
|
|
729
1099
|
{
|
|
730
1100
|
className: "h-8 text-sm",
|
|
731
|
-
value: String(
|
|
732
|
-
onChange: (
|
|
1101
|
+
value: String(a.value),
|
|
1102
|
+
onChange: (u) => O(o, { ...a, value: u.target.value })
|
|
733
1103
|
}
|
|
734
1104
|
)
|
|
735
1105
|
] })
|
|
736
1106
|
] }),
|
|
737
1107
|
/* @__PURE__ */ e.jsx(
|
|
738
|
-
|
|
1108
|
+
F,
|
|
739
1109
|
{
|
|
740
1110
|
size: "sm",
|
|
741
1111
|
variant: "ghost",
|
|
742
1112
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
|
|
743
|
-
onClick: () =>
|
|
744
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1113
|
+
onClick: () => M(o),
|
|
1114
|
+
children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
|
|
745
1115
|
}
|
|
746
1116
|
)
|
|
747
|
-
] },
|
|
1117
|
+
] }, o)),
|
|
748
1118
|
y.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No filters defined." })
|
|
749
1119
|
] })
|
|
750
1120
|
] }),
|
|
751
|
-
/* @__PURE__ */ e.jsxs(
|
|
1121
|
+
/* @__PURE__ */ e.jsxs(Y, { value: "grouping", className: "space-y-4 mt-4", children: [
|
|
752
1122
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
753
|
-
/* @__PURE__ */ e.jsx(
|
|
754
|
-
/* @__PURE__ */ e.jsxs(
|
|
755
|
-
/* @__PURE__ */ e.jsx(
|
|
1123
|
+
/* @__PURE__ */ e.jsx(b, { children: "Grouping Rules" }),
|
|
1124
|
+
/* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: q, children: [
|
|
1125
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
|
|
756
1126
|
"Add Group"
|
|
757
1127
|
] })
|
|
758
1128
|
] }),
|
|
759
1129
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
760
|
-
w.map((
|
|
1130
|
+
w.map((a, o) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-3 border rounded-lg", children: [
|
|
761
1131
|
/* @__PURE__ */ e.jsxs("div", { className: "flex-1 grid grid-cols-2 gap-2", children: [
|
|
762
1132
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
763
|
-
/* @__PURE__ */ e.jsx(
|
|
1133
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Field" }),
|
|
764
1134
|
/* @__PURE__ */ e.jsx(
|
|
765
1135
|
"select",
|
|
766
1136
|
{
|
|
767
1137
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
768
|
-
value:
|
|
769
|
-
onChange: (
|
|
770
|
-
children:
|
|
1138
|
+
value: a.field,
|
|
1139
|
+
onChange: (u) => I(o, { ...a, field: u.target.value }),
|
|
1140
|
+
children: c.map((u, T) => /* @__PURE__ */ e.jsx("option", { value: u.name, children: u.label || u.name }, T))
|
|
771
1141
|
}
|
|
772
1142
|
)
|
|
773
1143
|
] }),
|
|
774
1144
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
775
|
-
/* @__PURE__ */ e.jsx(
|
|
1145
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Sort Order" }),
|
|
776
1146
|
/* @__PURE__ */ e.jsxs(
|
|
777
1147
|
"select",
|
|
778
1148
|
{
|
|
779
1149
|
className: "w-full border rounded-md h-8 text-sm px-2",
|
|
780
|
-
value:
|
|
781
|
-
onChange: (
|
|
1150
|
+
value: a.sort || "asc",
|
|
1151
|
+
onChange: (u) => I(o, { ...a, sort: u.target.value }),
|
|
782
1152
|
children: [
|
|
783
1153
|
/* @__PURE__ */ e.jsx("option", { value: "asc", children: "Ascending" }),
|
|
784
1154
|
/* @__PURE__ */ e.jsx("option", { value: "desc", children: "Descending" })
|
|
@@ -788,92 +1158,92 @@ const Te = ({ schema: v }) => {
|
|
|
788
1158
|
] })
|
|
789
1159
|
] }),
|
|
790
1160
|
/* @__PURE__ */ e.jsx(
|
|
791
|
-
|
|
1161
|
+
F,
|
|
792
1162
|
{
|
|
793
1163
|
size: "sm",
|
|
794
1164
|
variant: "ghost",
|
|
795
1165
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50 self-end",
|
|
796
|
-
onClick: () =>
|
|
797
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1166
|
+
onClick: () => H(o),
|
|
1167
|
+
children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
|
|
798
1168
|
}
|
|
799
1169
|
)
|
|
800
|
-
] },
|
|
1170
|
+
] }, o)),
|
|
801
1171
|
w.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No grouping rules applied." })
|
|
802
1172
|
] })
|
|
803
1173
|
] }),
|
|
804
|
-
/* @__PURE__ */ e.jsxs(
|
|
1174
|
+
/* @__PURE__ */ e.jsxs(Y, { value: "sections", className: "space-y-4 mt-4", children: [
|
|
805
1175
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
806
|
-
/* @__PURE__ */ e.jsx(
|
|
1176
|
+
/* @__PURE__ */ e.jsx(b, { children: "Report Sections" }),
|
|
807
1177
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
808
|
-
/* @__PURE__ */ e.jsxs(
|
|
809
|
-
/* @__PURE__ */ e.jsx(
|
|
1178
|
+
/* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: () => J("header"), children: [
|
|
1179
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
|
|
810
1180
|
"Header"
|
|
811
1181
|
] }),
|
|
812
|
-
/* @__PURE__ */ e.jsxs(
|
|
813
|
-
/* @__PURE__ */ e.jsx(
|
|
1182
|
+
/* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: () => J("chart"), children: [
|
|
1183
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
|
|
814
1184
|
"Chart"
|
|
815
1185
|
] }),
|
|
816
|
-
/* @__PURE__ */ e.jsxs(
|
|
817
|
-
/* @__PURE__ */ e.jsx(
|
|
1186
|
+
/* @__PURE__ */ e.jsxs(F, { size: "sm", variant: "outline", onClick: () => J("table"), children: [
|
|
1187
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-4 w-4 mr-2" }),
|
|
818
1188
|
"Table"
|
|
819
1189
|
] })
|
|
820
1190
|
] })
|
|
821
1191
|
] }),
|
|
822
1192
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
823
|
-
|
|
824
|
-
var
|
|
1193
|
+
v.map((a, o) => {
|
|
1194
|
+
var u, T, X, Z;
|
|
825
1195
|
return /* @__PURE__ */ e.jsxs("div", { className: "p-3 border rounded-lg space-y-2", children: [
|
|
826
1196
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
827
1197
|
/* @__PURE__ */ e.jsxs("div", { className: "font-medium flex items-center gap-2", children: [
|
|
828
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-xs bg-muted px-2 py-0.5 rounded uppercase", children:
|
|
829
|
-
|
|
1198
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-xs bg-muted px-2 py-0.5 rounded uppercase", children: a.type }),
|
|
1199
|
+
a.title
|
|
830
1200
|
] }),
|
|
831
1201
|
/* @__PURE__ */ e.jsx(
|
|
832
|
-
|
|
1202
|
+
F,
|
|
833
1203
|
{
|
|
834
1204
|
size: "sm",
|
|
835
1205
|
variant: "ghost",
|
|
836
1206
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50",
|
|
837
|
-
onClick: () =>
|
|
838
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1207
|
+
onClick: () => ne(o),
|
|
1208
|
+
children: /* @__PURE__ */ e.jsx(ae, { className: "h-4 w-4" })
|
|
839
1209
|
}
|
|
840
1210
|
)
|
|
841
1211
|
] }),
|
|
842
1212
|
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
843
1213
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
844
|
-
/* @__PURE__ */ e.jsx(
|
|
1214
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Title" }),
|
|
845
1215
|
/* @__PURE__ */ e.jsx(
|
|
846
|
-
|
|
1216
|
+
A,
|
|
847
1217
|
{
|
|
848
1218
|
className: "h-8 text-sm",
|
|
849
|
-
value:
|
|
850
|
-
onChange: (
|
|
1219
|
+
value: a.title || "",
|
|
1220
|
+
onChange: (t) => P(o, { ...a, title: t.target.value })
|
|
851
1221
|
}
|
|
852
1222
|
)
|
|
853
1223
|
] }),
|
|
854
|
-
|
|
855
|
-
/* @__PURE__ */ e.jsx(
|
|
1224
|
+
a.type === "text" && /* @__PURE__ */ e.jsxs("div", { className: "col-span-2", children: [
|
|
1225
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Content" }),
|
|
856
1226
|
/* @__PURE__ */ e.jsx(
|
|
857
|
-
|
|
1227
|
+
A,
|
|
858
1228
|
{
|
|
859
1229
|
className: "h-8 text-sm",
|
|
860
|
-
value:
|
|
861
|
-
onChange: (
|
|
1230
|
+
value: a.text || "",
|
|
1231
|
+
onChange: (t) => P(o, { ...a, text: t.target.value })
|
|
862
1232
|
}
|
|
863
1233
|
)
|
|
864
1234
|
] }),
|
|
865
|
-
|
|
866
|
-
/* @__PURE__ */ e.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ e.jsx(
|
|
1235
|
+
a.type === "chart" && /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 grid grid-cols-2 gap-2 mt-2 p-2 bg-muted/20 rounded", children: [
|
|
1236
|
+
/* @__PURE__ */ e.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ e.jsx(b, { className: "text-xs font-semibold", children: "Chart Configuration" }) }),
|
|
867
1237
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
868
|
-
/* @__PURE__ */ e.jsx(
|
|
1238
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Chart Type" }),
|
|
869
1239
|
/* @__PURE__ */ e.jsxs(
|
|
870
1240
|
"select",
|
|
871
1241
|
{
|
|
872
1242
|
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",
|
|
873
|
-
value: ((
|
|
874
|
-
onChange: (
|
|
875
|
-
...
|
|
876
|
-
chart: { ...
|
|
1243
|
+
value: ((u = a.chart) == null ? void 0 : u.chartType) || "bar",
|
|
1244
|
+
onChange: (t) => P(o, {
|
|
1245
|
+
...a,
|
|
1246
|
+
chart: { ...a.chart, type: "chart", chartType: t.target.value }
|
|
877
1247
|
}),
|
|
878
1248
|
children: [
|
|
879
1249
|
/* @__PURE__ */ e.jsx("option", { value: "bar", children: "Bar" }),
|
|
@@ -885,20 +1255,20 @@ const Te = ({ schema: v }) => {
|
|
|
885
1255
|
)
|
|
886
1256
|
] }),
|
|
887
1257
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
888
|
-
/* @__PURE__ */ e.jsx(
|
|
1258
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "X-Axis Field" }),
|
|
889
1259
|
/* @__PURE__ */ e.jsxs(
|
|
890
1260
|
"select",
|
|
891
1261
|
{
|
|
892
1262
|
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",
|
|
893
|
-
value: ((
|
|
894
|
-
onChange: (
|
|
895
|
-
...
|
|
896
|
-
chart: { ...
|
|
1263
|
+
value: ((T = a.chart) == null ? void 0 : T.xAxisField) || "",
|
|
1264
|
+
onChange: (t) => P(o, {
|
|
1265
|
+
...a,
|
|
1266
|
+
chart: { ...a.chart, type: "chart", xAxisField: t.target.value }
|
|
897
1267
|
}),
|
|
898
1268
|
children: [
|
|
899
1269
|
/* @__PURE__ */ e.jsx("option", { value: "", children: "Select Field..." }),
|
|
900
|
-
|
|
901
|
-
|
|
1270
|
+
c.map((t) => /* @__PURE__ */ e.jsx("option", { value: t.name, children: t.label || t.name }, t.name)),
|
|
1271
|
+
c.length === 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
902
1272
|
/* @__PURE__ */ e.jsx("option", { value: "name", children: "Name" }),
|
|
903
1273
|
/* @__PURE__ */ e.jsx("option", { value: "month", children: "Month" })
|
|
904
1274
|
] })
|
|
@@ -907,19 +1277,19 @@ const Te = ({ schema: v }) => {
|
|
|
907
1277
|
)
|
|
908
1278
|
] }),
|
|
909
1279
|
/* @__PURE__ */ e.jsxs("div", { className: "col-span-2", children: [
|
|
910
|
-
/* @__PURE__ */ e.jsx(
|
|
1280
|
+
/* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Y-Axis Fields (comma separated)" }),
|
|
911
1281
|
/* @__PURE__ */ e.jsx(
|
|
912
|
-
|
|
1282
|
+
A,
|
|
913
1283
|
{
|
|
914
1284
|
className: "h-8 text-sm",
|
|
915
1285
|
placeholder: "e.g. value, count",
|
|
916
|
-
value: ((
|
|
917
|
-
onChange: (
|
|
918
|
-
...
|
|
1286
|
+
value: ((Z = (X = a.chart) == null ? void 0 : X.yAxisFields) == null ? void 0 : Z.join(", ")) || "",
|
|
1287
|
+
onChange: (t) => P(o, {
|
|
1288
|
+
...a,
|
|
919
1289
|
chart: {
|
|
920
|
-
...
|
|
1290
|
+
...a.chart,
|
|
921
1291
|
type: "chart",
|
|
922
|
-
yAxisFields:
|
|
1292
|
+
yAxisFields: t.target.value.split(",").map((x) => x.trim()).filter(Boolean)
|
|
923
1293
|
}
|
|
924
1294
|
})
|
|
925
1295
|
}
|
|
@@ -927,34 +1297,41 @@ const Te = ({ schema: v }) => {
|
|
|
927
1297
|
] })
|
|
928
1298
|
] })
|
|
929
1299
|
] })
|
|
930
|
-
] },
|
|
1300
|
+
] }, o);
|
|
931
1301
|
}),
|
|
932
|
-
|
|
1302
|
+
v.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg", children: "No customized sections. The default report layout will be used." })
|
|
933
1303
|
] })
|
|
934
|
-
] })
|
|
1304
|
+
] }),
|
|
1305
|
+
/* @__PURE__ */ e.jsx(Y, { value: "schedule", className: "space-y-4 mt-4", children: /* @__PURE__ */ e.jsx(
|
|
1306
|
+
Ge,
|
|
1307
|
+
{
|
|
1308
|
+
schedule: n.schedule,
|
|
1309
|
+
onChange: (a) => h({ ...n, schedule: a })
|
|
1310
|
+
}
|
|
1311
|
+
) })
|
|
935
1312
|
] }),
|
|
936
1313
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-2 mt-6 pt-4 border-t", children: [
|
|
937
|
-
/* @__PURE__ */ e.jsx(
|
|
938
|
-
/* @__PURE__ */ e.jsxs(
|
|
939
|
-
/* @__PURE__ */ e.jsx(
|
|
1314
|
+
/* @__PURE__ */ e.jsx(F, { variant: "outline", onClick: ie, children: "Cancel" }),
|
|
1315
|
+
/* @__PURE__ */ e.jsxs(F, { onClick: se, children: [
|
|
1316
|
+
/* @__PURE__ */ e.jsx(Oe, { className: "h-4 w-4 mr-2" }),
|
|
940
1317
|
"Save Report"
|
|
941
1318
|
] })
|
|
942
1319
|
] })
|
|
943
1320
|
] })
|
|
944
1321
|
] }),
|
|
945
|
-
|
|
946
|
-
/* @__PURE__ */ e.jsx(ee, { className: "bg-blue-50/50", children: /* @__PURE__ */ e.jsx(
|
|
947
|
-
/* @__PURE__ */ e.jsx(
|
|
948
|
-
|
|
1322
|
+
d && /* @__PURE__ */ e.jsxs(B, { className: "mt-8 border-2 border-blue-100", children: [
|
|
1323
|
+
/* @__PURE__ */ e.jsx(ee, { className: "bg-blue-50/50", children: /* @__PURE__ */ e.jsx(te, { className: "text-blue-900 text-sm uppercase tracking-wide", children: "Live Preview" }) }),
|
|
1324
|
+
/* @__PURE__ */ e.jsx(z, { className: "pt-6", children: /* @__PURE__ */ e.jsx(
|
|
1325
|
+
we,
|
|
949
1326
|
{
|
|
950
1327
|
schema: {
|
|
951
1328
|
type: "report-viewer",
|
|
952
1329
|
report: {
|
|
953
|
-
...
|
|
954
|
-
fields:
|
|
1330
|
+
...n,
|
|
1331
|
+
fields: l,
|
|
955
1332
|
filters: y,
|
|
956
1333
|
groupBy: w,
|
|
957
|
-
sections:
|
|
1334
|
+
sections: v
|
|
958
1335
|
},
|
|
959
1336
|
// Mock data for preview
|
|
960
1337
|
data: [
|
|
@@ -968,9 +1345,129 @@ const Te = ({ schema: v }) => {
|
|
|
968
1345
|
] })
|
|
969
1346
|
] });
|
|
970
1347
|
};
|
|
971
|
-
|
|
1348
|
+
async function Ye(r, i) {
|
|
1349
|
+
var h;
|
|
1350
|
+
const {
|
|
1351
|
+
dataSource: s,
|
|
1352
|
+
resource: c,
|
|
1353
|
+
queryParams: d,
|
|
1354
|
+
format: p,
|
|
1355
|
+
exportConfig: f
|
|
1356
|
+
} = i, n = p || r.defaultExportFormat || "pdf";
|
|
1357
|
+
try {
|
|
1358
|
+
const j = (await s.find(c, d)).data || [], y = {
|
|
1359
|
+
format: n,
|
|
1360
|
+
...(h = r.exportConfigs) == null ? void 0 : h[n],
|
|
1361
|
+
...f
|
|
1362
|
+
};
|
|
1363
|
+
return be(n, r, j, y), {
|
|
1364
|
+
success: !0,
|
|
1365
|
+
recordCount: j.length,
|
|
1366
|
+
format: n
|
|
1367
|
+
};
|
|
1368
|
+
} catch (l) {
|
|
1369
|
+
return {
|
|
1370
|
+
success: !1,
|
|
1371
|
+
recordCount: 0,
|
|
1372
|
+
format: n,
|
|
1373
|
+
error: l.message
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
function st(r, i, s = {}) {
|
|
1378
|
+
const { columns: c, filename: d, includeAggregationRow: p = !1 } = s, f = c || (r.fields || []).map(Ve), n = f.map((y) => y.header), h = i.map((y, R) => f.map((w) => {
|
|
1379
|
+
if (w.formula)
|
|
1380
|
+
return w.formula.replace(/\{ROW\}/g, String(R + 2));
|
|
1381
|
+
const m = y[w.name];
|
|
1382
|
+
return We(m, w.numberFormat);
|
|
1383
|
+
}));
|
|
1384
|
+
if (p && i.length > 0) {
|
|
1385
|
+
const y = f.map((R, w) => {
|
|
1386
|
+
const m = (r.fields || []).find((v) => v.name === R.name);
|
|
1387
|
+
if (m != null && m.aggregation) {
|
|
1388
|
+
const v = He(w), N = 2, k = i.length + 1;
|
|
1389
|
+
switch (m.aggregation) {
|
|
1390
|
+
case "sum":
|
|
1391
|
+
return `=SUM(${v}${N}:${v}${k})`;
|
|
1392
|
+
case "avg":
|
|
1393
|
+
return `=AVERAGE(${v}${N}:${v}${k})`;
|
|
1394
|
+
case "count":
|
|
1395
|
+
return `=COUNTA(${v}${N}:${v}${k})`;
|
|
1396
|
+
case "min":
|
|
1397
|
+
return `=MIN(${v}${N}:${v}${k})`;
|
|
1398
|
+
case "max":
|
|
1399
|
+
return `=MAX(${v}${N}:${v}${k})`;
|
|
1400
|
+
default:
|
|
1401
|
+
return "";
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
return "";
|
|
1405
|
+
});
|
|
1406
|
+
h.push(y);
|
|
1407
|
+
}
|
|
1408
|
+
const l = "\uFEFF" + [
|
|
1409
|
+
n.join(" "),
|
|
1410
|
+
...h.map((y) => y.join(" "))
|
|
1411
|
+
].join(`
|
|
1412
|
+
`), j = d || `${r.title || "report"}.tsv`;
|
|
1413
|
+
Xe(l, j, "text/tab-separated-values");
|
|
1414
|
+
}
|
|
1415
|
+
function rt(r, i, s, c) {
|
|
1416
|
+
return async () => {
|
|
1417
|
+
const d = r.schedule;
|
|
1418
|
+
if (!(d != null && d.enabled))
|
|
1419
|
+
return [];
|
|
1420
|
+
const p = d.formats || [r.defaultExportFormat || "pdf"], f = [];
|
|
1421
|
+
for (const n of p) {
|
|
1422
|
+
const h = await Ye(r, {
|
|
1423
|
+
dataSource: i,
|
|
1424
|
+
resource: s,
|
|
1425
|
+
format: n
|
|
1426
|
+
});
|
|
1427
|
+
f.push(h);
|
|
1428
|
+
}
|
|
1429
|
+
return c(r, d), f;
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
function Ve(r) {
|
|
1433
|
+
return {
|
|
1434
|
+
name: r.name,
|
|
1435
|
+
header: r.label || r.name
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
function We(r, i) {
|
|
1439
|
+
return r == null ? "" : typeof r == "number" && i ? r.toLocaleString("en-US", qe(i)) : Je(String(r));
|
|
1440
|
+
}
|
|
1441
|
+
function qe(r) {
|
|
1442
|
+
if (r.includes("%"))
|
|
1443
|
+
return { style: "percent", minimumFractionDigits: 0 };
|
|
1444
|
+
const i = (r.match(/0/g) || []).length;
|
|
1445
|
+
return {
|
|
1446
|
+
minimumFractionDigits: Math.max(0, i - 1),
|
|
1447
|
+
maximumFractionDigits: Math.max(0, i - 1)
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
function He(r) {
|
|
1451
|
+
let i = "", s = r;
|
|
1452
|
+
for (; s >= 0; )
|
|
1453
|
+
i = String.fromCharCode(s % 26 + 65) + i, s = Math.floor(s / 26) - 1;
|
|
1454
|
+
return i;
|
|
1455
|
+
}
|
|
1456
|
+
function Je(r) {
|
|
1457
|
+
if (r.length > 0) {
|
|
1458
|
+
const i = r.charAt(0);
|
|
1459
|
+
if (i === "=" || i === "+" || i === "-" || i === "@" || i === "|")
|
|
1460
|
+
return `'${r}`;
|
|
1461
|
+
}
|
|
1462
|
+
return r;
|
|
1463
|
+
}
|
|
1464
|
+
function Xe(r, i, s) {
|
|
1465
|
+
const c = new Blob([r], { type: `${s};charset=utf-8` }), d = URL.createObjectURL(c), p = document.createElement("a");
|
|
1466
|
+
p.href = d, p.download = i, document.body.appendChild(p), p.click(), document.body.removeChild(p), URL.revokeObjectURL(d);
|
|
1467
|
+
}
|
|
1468
|
+
L.register(
|
|
972
1469
|
"report",
|
|
973
|
-
|
|
1470
|
+
De,
|
|
974
1471
|
{
|
|
975
1472
|
label: "Report",
|
|
976
1473
|
category: "Report",
|
|
@@ -981,9 +1478,9 @@ P.register(
|
|
|
981
1478
|
]
|
|
982
1479
|
}
|
|
983
1480
|
);
|
|
984
|
-
|
|
1481
|
+
L.register(
|
|
985
1482
|
"report-viewer",
|
|
986
|
-
|
|
1483
|
+
we,
|
|
987
1484
|
{
|
|
988
1485
|
label: "Report Viewer",
|
|
989
1486
|
category: "Report",
|
|
@@ -993,9 +1490,9 @@ P.register(
|
|
|
993
1490
|
]
|
|
994
1491
|
}
|
|
995
1492
|
);
|
|
996
|
-
|
|
1493
|
+
L.register(
|
|
997
1494
|
"report-builder",
|
|
998
|
-
|
|
1495
|
+
Ue,
|
|
999
1496
|
{
|
|
1000
1497
|
label: "Report Builder",
|
|
1001
1498
|
category: "Report",
|
|
@@ -1005,7 +1502,17 @@ P.register(
|
|
|
1005
1502
|
}
|
|
1006
1503
|
);
|
|
1007
1504
|
export {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1505
|
+
Ue as ReportBuilder,
|
|
1506
|
+
De as ReportRenderer,
|
|
1507
|
+
we as ReportViewer,
|
|
1508
|
+
Ge as ScheduleConfig,
|
|
1509
|
+
rt as createScheduleTrigger,
|
|
1510
|
+
Be as exportAsCSV,
|
|
1511
|
+
Ie as exportAsExcel,
|
|
1512
|
+
ve as exportAsHTML,
|
|
1513
|
+
ze as exportAsJSON,
|
|
1514
|
+
Me as exportAsPDF,
|
|
1515
|
+
st as exportExcelWithFormulas,
|
|
1516
|
+
be as exportReport,
|
|
1517
|
+
Ye as exportWithLiveData
|
|
1011
1518
|
};
|