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