@object-ui/plugin-report 4.0.7 → 4.0.9

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