@object-ui/plugin-charts 4.0.11 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @object-ui/plugin-charts
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@4.2.1
8
+ - @object-ui/core@4.2.1
9
+ - @object-ui/i18n@4.2.1
10
+ - @object-ui/react@4.2.1
11
+ - @object-ui/components@4.2.1
12
+
13
+ ## 4.2.0
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [eb738bd]
18
+ - Updated dependencies [650392e]
19
+ - Updated dependencies [84b4bf1]
20
+ - @object-ui/i18n@4.2.0
21
+ - @object-ui/components@4.2.0
22
+ - @object-ui/react@4.2.0
23
+ - @object-ui/types@4.2.0
24
+ - @object-ui/core@4.2.0
25
+
26
+ ## 4.1.0
27
+
28
+ ### Patch Changes
29
+
30
+ - b4ce9e2: Fix summary reports: render chart + KPIs, correct empty-table on server-aggregated data.
31
+ - `plugin-report`: `SpecReportGrid` now renders a KPI strip (per aggregating column) and a chart section above the grid for `summary` reports. KPI section auto-hides when no aggregating columns. New `buildChartData()` adapter buckets aggregated `ReportRow[]` to chart-ready data, auto-sorts pie/funnel descending, and falls back to row count when the chart `yAxis` points at a non-numeric column. When the data is server-aggregated, the grid switches columns to `[groupings, ${field}__${agg}]` so cells aren't empty against a raw-row column schema.
32
+ - `plugin-charts`: register `'column'` as an alias of `'bar'` in `ChartRenderer` / `AdvancedChartImpl` (Recharts only has `BarChart`).
33
+ - `app-shell`: `ReportView` now routes any object-backed report (matrix/joined/summary/tabular/columns/groupingsAcross) through the spec `ReportRenderer`; fully-legacy `fields`+`data` schemas still use `ReportViewer`.
34
+ - @object-ui/types@4.1.0
35
+ - @object-ui/core@4.1.0
36
+ - @object-ui/i18n@4.1.0
37
+ - @object-ui/react@4.1.0
38
+ - @object-ui/components@4.1.0
39
+
40
+ ## 4.0.12
41
+
42
+ ### Patch Changes
43
+
44
+ - @object-ui/types@4.0.12
45
+ - @object-ui/core@4.0.12
46
+ - @object-ui/i18n@4.0.12
47
+ - @object-ui/react@4.0.12
48
+ - @object-ui/components@4.0.12
49
+
3
50
  ## 4.0.11
4
51
 
5
52
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import { ComponentRegistry as e, computeDrillFilter as t, extractRecords as n, isDrillEnabled as r, resolveDateMacros as i, resolveDrillTitle as a } from "@object-ui/core";
2
2
  import * as o from "react";
3
3
  import s, { Suspense as c, useCallback as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
4
- import { Dialog as h, DialogContent as g, DialogHeader as _, DialogTitle as v, Sheet as ee, SheetContent as te, SheetHeader as ne, SheetTitle as re, Skeleton as y } from "@object-ui/components";
5
- import { Fragment as ie, jsx as b, jsxs as x } from "react/jsx-runtime";
6
- import { Area as S, AreaChart as C, Bar as w, BarChart as T, CartesianGrid as E, Cell as D, Funnel as ae, FunnelChart as O, LabelList as k, Legend as A, Line as j, LineChart as M, Pie as N, PieChart as P, PolarAngleAxis as F, PolarGrid as I, PolarRadiusAxis as L, Radar as R, RadarChart as oe, ResponsiveContainer as se, Scatter as ce, ScatterChart as le, Tooltip as ue, XAxis as z, YAxis as B, ZAxis as de } from "recharts";
7
- import { SchemaRenderer as fe, SchemaRendererContext as pe, useDataScope as me } from "@object-ui/react";
8
- import { AlertCircle as he } from "lucide-react";
9
- import { useSafeFieldLabel as ge } from "@object-ui/i18n";
4
+ import { Dialog as h, DialogContent as g, DialogHeader as _, DialogTitle as v, Sheet as y, SheetContent as ee, SheetHeader as te, SheetTitle as ne, Skeleton as b } from "@object-ui/components";
5
+ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
6
+ import { Area as w, AreaChart as re, Bar as T, BarChart as E, CartesianGrid as D, Cell as O, Funnel as ie, FunnelChart as k, LabelList as A, Legend as j, Line as M, LineChart as N, Pie as P, PieChart as F, PolarAngleAxis as I, PolarGrid as L, PolarRadiusAxis as R, Radar as z, RadarChart as ae, ResponsiveContainer as oe, Scatter as se, ScatterChart as ce, Tooltip as le, XAxis as B, YAxis as V, ZAxis as ue } from "recharts";
7
+ import { SchemaRenderer as de, SchemaRendererContext as fe, useDataScope as pe } from "@object-ui/react";
8
+ import { AlertCircle as me } from "lucide-react";
9
+ import { useSafeFieldLabel as he } from "@object-ui/i18n";
10
10
  //#region \0rolldown/runtime.js
11
- var _e = Object.defineProperty, V = (e, t) => () => (e && (t = e(e = 0)), t), ve = (e, t) => {
11
+ var ge = Object.defineProperty, H = (e, t) => () => (e && (t = e(e = 0)), t), _e = (e, t) => {
12
12
  let n = {};
13
- for (var r in e) _e(n, r, {
13
+ for (var r in e) ge(n, r, {
14
14
  get: e[r],
15
15
  enumerable: !0
16
16
  });
17
- return t || _e(n, Symbol.toStringTag, { value: "Module" }), n;
18
- }, ye = /* @__PURE__ */ ve({ default: () => be });
19
- function be({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
20
- return /* @__PURE__ */ b("div", {
17
+ return t || ge(n, Symbol.toStringTag, { value: "Module" }), n;
18
+ }, ve = /* @__PURE__ */ _e({ default: () => ye });
19
+ function ye({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
20
+ return /* @__PURE__ */ S("div", {
21
21
  className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,
22
- children: /* @__PURE__ */ b(se, {
22
+ children: /* @__PURE__ */ S(oe, {
23
23
  width: "100%",
24
24
  height: r,
25
- children: /* @__PURE__ */ x(T, {
25
+ children: /* @__PURE__ */ C(E, {
26
26
  data: e,
27
27
  margin: {
28
28
  top: 10,
@@ -31,64 +31,64 @@ function be({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
31
31
  bottom: 5
32
32
  },
33
33
  children: [
34
- /* @__PURE__ */ x("defs", { children: [/* @__PURE__ */ x("linearGradient", {
34
+ /* @__PURE__ */ C("defs", { children: [/* @__PURE__ */ C("linearGradient", {
35
35
  id: "barGradient",
36
36
  x1: "0",
37
37
  y1: "0",
38
38
  x2: "0",
39
39
  y2: "1",
40
40
  children: [
41
- /* @__PURE__ */ b("stop", {
41
+ /* @__PURE__ */ S("stop", {
42
42
  offset: "0%",
43
43
  stopColor: a,
44
44
  stopOpacity: 1
45
45
  }),
46
- /* @__PURE__ */ b("stop", {
46
+ /* @__PURE__ */ S("stop", {
47
47
  offset: "90%",
48
48
  stopColor: a,
49
49
  stopOpacity: .6
50
50
  }),
51
- /* @__PURE__ */ b("stop", {
51
+ /* @__PURE__ */ S("stop", {
52
52
  offset: "100%",
53
53
  stopColor: a,
54
54
  stopOpacity: .3
55
55
  })
56
56
  ]
57
- }), /* @__PURE__ */ x("filter", {
57
+ }), /* @__PURE__ */ C("filter", {
58
58
  id: "glow",
59
59
  height: "130%",
60
60
  children: [
61
- /* @__PURE__ */ b("feGaussianBlur", {
61
+ /* @__PURE__ */ S("feGaussianBlur", {
62
62
  in: "SourceAlpha",
63
63
  stdDeviation: "3",
64
64
  result: "blur"
65
65
  }),
66
- /* @__PURE__ */ b("feOffset", {
66
+ /* @__PURE__ */ S("feOffset", {
67
67
  in: "blur",
68
68
  dx: "0",
69
69
  dy: "0",
70
70
  result: "offsetBlur"
71
71
  }),
72
- /* @__PURE__ */ b("feFlood", {
72
+ /* @__PURE__ */ S("feFlood", {
73
73
  floodColor: a,
74
74
  floodOpacity: "0.5",
75
75
  result: "offsetColor"
76
76
  }),
77
- /* @__PURE__ */ b("feComposite", {
77
+ /* @__PURE__ */ S("feComposite", {
78
78
  in: "offsetColor",
79
79
  in2: "offsetBlur",
80
80
  operator: "in",
81
81
  result: "offsetBlur"
82
82
  }),
83
- /* @__PURE__ */ x("feMerge", { children: [/* @__PURE__ */ b("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ b("feMergeNode", { in: "SourceGraphic" })] })
83
+ /* @__PURE__ */ C("feMerge", { children: [/* @__PURE__ */ S("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ S("feMergeNode", { in: "SourceGraphic" })] })
84
84
  ]
85
85
  })] }),
86
- /* @__PURE__ */ b(E, {
86
+ /* @__PURE__ */ S(D, {
87
87
  strokeDasharray: "3 3",
88
88
  stroke: "hsl(var(--border))",
89
89
  vertical: !1
90
90
  }),
91
- /* @__PURE__ */ b(z, {
91
+ /* @__PURE__ */ S(B, {
92
92
  dataKey: n,
93
93
  tick: {
94
94
  fill: "hsl(var(--muted-foreground))",
@@ -99,7 +99,7 @@ function be({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
99
99
  axisLine: { stroke: "hsl(var(--border))" },
100
100
  dy: 10
101
101
  }),
102
- /* @__PURE__ */ b(B, {
102
+ /* @__PURE__ */ S(V, {
103
103
  tick: {
104
104
  fill: "hsl(var(--muted-foreground))",
105
105
  fontSize: 12,
@@ -108,7 +108,7 @@ function be({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
108
108
  tickLine: !1,
109
109
  axisLine: !1
110
110
  }),
111
- /* @__PURE__ */ b(ue, {
111
+ /* @__PURE__ */ S(le, {
112
112
  cursor: {
113
113
  fill: "hsl(var(--muted))",
114
114
  opacity: .2
@@ -123,11 +123,11 @@ function be({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
123
123
  },
124
124
  itemStyle: { color: "hsl(var(--primary))" }
125
125
  }),
126
- /* @__PURE__ */ b(A, { wrapperStyle: {
126
+ /* @__PURE__ */ S(j, { wrapperStyle: {
127
127
  paddingTop: "20px",
128
128
  fontFamily: "monospace"
129
129
  } }),
130
- /* @__PURE__ */ b(w, {
130
+ /* @__PURE__ */ S(T, {
131
131
  dataKey: t,
132
132
  fill: "url(#barGradient)",
133
133
  radius: [
@@ -144,27 +144,32 @@ function be({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
144
144
  })
145
145
  });
146
146
  }
147
- var xe = V((() => {}));
147
+ var be = H((() => {}));
148
148
  //#endregion
149
149
  //#region src/ChartContainerImpl.tsx
150
- function Se() {
150
+ function xe() {
151
151
  let e = o.useContext(we);
152
152
  if (!e) throw Error("useChart must be used within a <ChartContainer />");
153
153
  return e;
154
154
  }
155
- function H({ id: e, className: t, children: n, config: r, ...i }) {
155
+ function U({ id: e, className: t, children: n, config: r, ...i }) {
156
156
  let a = o.useId(), s = `chart-${e || a.replace(/:/g, "")}`;
157
- return /* @__PURE__ */ b(we.Provider, {
157
+ return /* @__PURE__ */ S(we.Provider, {
158
158
  value: { config: r },
159
- children: /* @__PURE__ */ x("div", {
159
+ children: /* @__PURE__ */ C("div", {
160
160
  "data-slot": "chart",
161
161
  "data-chart": s,
162
162
  className: K("flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
163
+ style: {
164
+ minHeight: 280,
165
+ minWidth: 0,
166
+ ...i.style
167
+ },
163
168
  ...i,
164
- children: [/* @__PURE__ */ b(Te, {
169
+ children: [/* @__PURE__ */ S(Te, {
165
170
  id: s,
166
171
  config: r
167
- }), /* @__PURE__ */ b(se, {
172
+ }), /* @__PURE__ */ S(oe, {
168
173
  width: "100%",
169
174
  height: "100%",
170
175
  children: n
@@ -172,14 +177,14 @@ function H({ id: e, className: t, children: n, config: r, ...i }) {
172
177
  })
173
178
  });
174
179
  }
175
- function U({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: s, labelFormatter: c, labelClassName: l, formatter: u, color: d, nameKey: f, labelKey: p }) {
176
- let { config: m } = Se(), h = o.useMemo(() => {
180
+ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: s, labelFormatter: c, labelClassName: l, formatter: u, color: d, nameKey: f, labelKey: p }) {
181
+ let { config: m } = xe(), h = o.useMemo(() => {
177
182
  if (i || !t?.length) return null;
178
- let [e] = t, n = G(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof s == "string" ? m[s]?.label || s : n?.label;
179
- return c ? /* @__PURE__ */ b("div", {
183
+ let [e] = t, n = Se(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof s == "string" ? m[s]?.label || s : n?.label;
184
+ return c ? /* @__PURE__ */ S("div", {
180
185
  className: K("font-medium", l),
181
186
  children: c(r, t)
182
- }) : r ? /* @__PURE__ */ b("div", {
187
+ }) : r ? /* @__PURE__ */ S("div", {
183
188
  className: K("font-medium", l),
184
189
  children: r
185
190
  }) : null;
@@ -194,29 +199,29 @@ function U({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
194
199
  ]);
195
200
  if (!e || !t?.length) return null;
196
201
  let g = t.length === 1 && r !== "dot";
197
- return /* @__PURE__ */ x("div", {
202
+ return /* @__PURE__ */ C("div", {
198
203
  className: K("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
199
- children: [g ? null : h, /* @__PURE__ */ b("div", {
204
+ children: [g ? null : h, /* @__PURE__ */ S("div", {
200
205
  className: "grid gap-1.5",
201
206
  children: t.filter((e) => e.type !== "none").map((e, t) => {
202
- let n = G(m, e, `${f || e.name || e.dataKey || "value"}`), i = d || e.payload.fill || e.color;
203
- return /* @__PURE__ */ b("div", {
207
+ let n = Se(m, e, `${f || e.name || e.dataKey || "value"}`), i = d || e.payload.fill || e.color;
208
+ return /* @__PURE__ */ S("div", {
204
209
  className: K("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
205
- children: u && e?.value !== void 0 && e.name ? u(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ x(ie, { children: [n?.icon ? /* @__PURE__ */ b(n.icon, {}) : !a && /* @__PURE__ */ b("div", {
210
+ children: u && e?.value !== void 0 && e.name ? u(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ C(x, { children: [n?.icon ? /* @__PURE__ */ S(n.icon, {}) : !a && /* @__PURE__ */ S("div", {
206
211
  className: K("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", g && r === "dashed" ? "my-0.5" : ""),
207
212
  style: {
208
213
  "--color-bg": i,
209
214
  "--color-border": i
210
215
  }
211
- }), /* @__PURE__ */ x("div", {
216
+ }), /* @__PURE__ */ C("div", {
212
217
  className: K("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
213
- children: [/* @__PURE__ */ x("div", {
218
+ children: [/* @__PURE__ */ C("div", {
214
219
  className: "grid gap-1.5",
215
- children: [g ? h : null, /* @__PURE__ */ b("span", {
220
+ children: [g ? h : null, /* @__PURE__ */ S("span", {
216
221
  className: "text-muted-foreground",
217
222
  children: n?.label || e.name
218
223
  })]
219
- }), e.value && /* @__PURE__ */ b("span", {
224
+ }), e.value && /* @__PURE__ */ S("span", {
220
225
  className: "text-foreground font-mono font-medium tabular-nums",
221
226
  children: e.value.toLocaleString()
222
227
  })]
@@ -226,15 +231,15 @@ function U({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
226
231
  })]
227
232
  });
228
233
  }
229
- function W({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
230
- let { config: a } = Se();
231
- return n?.length ? /* @__PURE__ */ b("div", {
234
+ function G({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
235
+ let { config: a } = xe();
236
+ return n?.length ? /* @__PURE__ */ S("div", {
232
237
  className: K("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
233
238
  children: n.filter((e) => e.type !== "none").map((e) => {
234
- let n = G(a, e, `${i || e.dataKey || "value"}`);
235
- return /* @__PURE__ */ x("div", {
239
+ let n = Se(a, e, `${i || e.dataKey || "value"}`);
240
+ return /* @__PURE__ */ C("div", {
236
241
  className: K("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
237
- children: [n?.icon && !t ? /* @__PURE__ */ b(n.icon, {}) : /* @__PURE__ */ b("div", {
242
+ children: [n?.icon && !t ? /* @__PURE__ */ S(n.icon, {}) : /* @__PURE__ */ S("div", {
238
243
  className: "h-2 w-2 shrink-0 rounded-[2px]",
239
244
  style: { backgroundColor: e.color }
240
245
  }), n?.label]
@@ -242,18 +247,18 @@ function W({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bot
242
247
  })
243
248
  }) : null;
244
249
  }
245
- function G(e, t, n) {
250
+ function Se(e, t, n) {
246
251
  if (typeof t != "object" || !t) return;
247
252
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
248
253
  return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
249
254
  }
250
- var K, Ce, we, Te, q, J, Ee = V((() => {
255
+ var K, Ce, we, Te, q, J, Ee = H((() => {
251
256
  K = (...e) => e.filter(Boolean).join(" "), Ce = {
252
257
  light: "",
253
258
  dark: ".dark"
254
259
  }, we = o.createContext(null), Te = ({ id: e, config: t }) => {
255
260
  let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
256
- return n.length ? /* @__PURE__ */ b("style", { dangerouslySetInnerHTML: { __html: Object.entries(Ce).map(([t, r]) => `
261
+ return n.length ? /* @__PURE__ */ S("style", { dangerouslySetInnerHTML: { __html: Object.entries(Ce).map(([t, r]) => `
257
262
  ${r} [data-chart=${e}] {
258
263
  ${n.map(([e, n]) => {
259
264
  let r = n.theme?.[t] || n.color;
@@ -261,10 +266,10 @@ ${n.map(([e, n]) => {
261
266
  }).join("\n")}
262
267
  }
263
268
  `).join("\n") } }) : null;
264
- }, q = ue, J = A;
265
- })), De = /* @__PURE__ */ ve({ default: () => Oe });
269
+ }, q = le, J = j;
270
+ })), De = /* @__PURE__ */ _e({ default: () => Oe });
266
271
  function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", onChartClick: s }) {
267
- let c = Array.isArray(t) ? t : [], [l, u] = o.useState(!1), d = o.useCallback((e) => {
272
+ let c = e === "column" ? "bar" : e, l = Array.isArray(t) ? t : [], [u, d] = o.useState(!1), f = o.useCallback((e) => {
268
273
  if (!s || !e) return;
269
274
  let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
270
275
  s({
@@ -272,7 +277,7 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
272
277
  series: t?.dataKey ? String(t.dataKey) : void 0,
273
278
  value: typeof t?.value == "number" ? t.value : void 0
274
279
  });
275
- }, [s]), f = o.useCallback((e) => {
280
+ }, [s]), p = o.useCallback((e) => {
276
281
  if (!s || !e) return;
277
282
  let t = e.payload?.[r], n = i[0]?.dataKey || "value";
278
283
  s({
@@ -284,35 +289,35 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
284
289
  s,
285
290
  r,
286
291
  i
287
- ]), p = s ? {
288
- onClick: d,
289
- style: { cursor: "pointer" }
290
- } : {}, m = s ? {
292
+ ]), m = s ? {
291
293
  onClick: f,
292
294
  style: { cursor: "pointer" }
295
+ } : {}, h = s ? {
296
+ onClick: p,
297
+ style: { cursor: "pointer" }
293
298
  } : {};
294
299
  o.useEffect(() => {
295
- let e = () => u(window.innerWidth < 640);
300
+ let e = () => d(window.innerWidth < 640);
296
301
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
297
302
  }, []);
298
- let h = {
299
- bar: T,
300
- "horizontal-bar": T,
301
- line: M,
302
- area: C,
303
- pie: P,
304
- donut: P,
305
- radar: oe,
306
- scatter: le,
307
- funnel: O,
308
- combo: T
309
- }[e] || T, g = o.useCallback((e) => {
303
+ let g = {
304
+ bar: E,
305
+ "horizontal-bar": E,
306
+ line: N,
307
+ area: re,
308
+ pie: F,
309
+ donut: F,
310
+ radar: ae,
311
+ scatter: ce,
312
+ funnel: k,
313
+ combo: E
314
+ }[c] || E, _ = o.useCallback((e) => {
310
315
  if (e == null || e === "") return "";
311
316
  let t = typeof e == "string" ? e : String(e);
312
317
  if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
313
318
  let e = new Date(t);
314
319
  if (!Number.isNaN(e.getTime())) {
315
- let t = (c.length > 1 ? Math.abs(new Date(String(c[c.length - 1][r] ?? "")).getTime() - new Date(String(c[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
320
+ let t = (l.length > 1 ? Math.abs(new Date(String(l[l.length - 1][r] ?? "")).getTime() - new Date(String(l[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
316
321
  try {
317
322
  return t <= 62 ? e.toLocaleDateString(void 0, {
318
323
  month: "short",
@@ -326,49 +331,49 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
326
331
  }
327
332
  }
328
333
  }
329
- return l && t.length > 8 ? t.slice(0, 8) + "…" : t;
334
+ return u && t.length > 8 ? t.slice(0, 8) + "…" : t;
330
335
  }, [
331
- c,
336
+ l,
332
337
  r,
333
- l
334
- ]), _ = o.useMemo(() => c.some((e) => String(e[r] || "").length > 5), [c, r]), v = () => [
338
+ u
339
+ ]), v = o.useMemo(() => l.some((e) => String(e[r] || "").length > 5), [l, r]), y = () => [
335
340
  "hsl(var(--chart-1))",
336
341
  "hsl(var(--chart-2))",
337
342
  "hsl(var(--chart-3))",
338
343
  "hsl(var(--chart-4))",
339
344
  "hsl(var(--chart-5))"
340
345
  ];
341
- if (e === "pie" || e === "donut") {
342
- let t = e === "donut" ? 60 : 0;
343
- return /* @__PURE__ */ b(H, {
346
+ if (c === "pie" || c === "donut") {
347
+ let e = c === "donut" ? 60 : 0;
348
+ return /* @__PURE__ */ S(U, {
344
349
  config: n,
345
350
  className: a,
346
- children: /* @__PURE__ */ x(P, { children: [
347
- /* @__PURE__ */ b(q, {
351
+ children: /* @__PURE__ */ C(F, { children: [
352
+ /* @__PURE__ */ S(q, {
348
353
  cursor: !1,
349
- content: /* @__PURE__ */ b(U, { hideLabel: !0 })
354
+ content: /* @__PURE__ */ S(W, { hideLabel: !0 })
350
355
  }),
351
- /* @__PURE__ */ b(N, {
352
- data: c,
356
+ /* @__PURE__ */ S(P, {
357
+ data: l,
353
358
  dataKey: i[0]?.dataKey || "value",
354
359
  nameKey: r || "name",
355
- innerRadius: t,
360
+ innerRadius: e,
356
361
  strokeWidth: 5,
357
362
  paddingAngle: 2,
358
363
  outerRadius: 80,
359
- ...m,
360
- children: c.map((e, t) => {
364
+ ...h,
365
+ children: l.map((e, t) => {
361
366
  let i = n[e[r]]?.color;
362
367
  if (!i) {
363
- let e = v();
368
+ let e = y();
364
369
  i = e[t % e.length];
365
370
  }
366
- return /* @__PURE__ */ b(D, { fill: X(i) }, `cell-${t}`);
371
+ return /* @__PURE__ */ S(O, { fill: X(i) }, `cell-${t}`);
367
372
  })
368
373
  }),
369
- /* @__PURE__ */ b(J, {
370
- content: /* @__PURE__ */ b(W, { nameKey: r }),
371
- ...l && {
374
+ /* @__PURE__ */ S(J, {
375
+ content: /* @__PURE__ */ S(G, { nameKey: r }),
376
+ ...u && {
372
377
  verticalAlign: "bottom",
373
378
  wrapperStyle: {
374
379
  fontSize: "11px",
@@ -379,47 +384,47 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
379
384
  ] })
380
385
  });
381
386
  }
382
- if (e === "funnel") {
383
- let e = i[0]?.dataKey || "value", t = v(), o = s ? (t) => {
387
+ if (c === "funnel") {
388
+ let e = i[0]?.dataKey || "value", t = y(), o = s ? (t) => {
384
389
  t && s({
385
390
  category: t?.payload?.[r] ?? t?.[r],
386
391
  value: t?.payload?.[e] ?? t?.[e]
387
392
  });
388
393
  } : void 0;
389
- return /* @__PURE__ */ b(H, {
394
+ return /* @__PURE__ */ S(U, {
390
395
  config: n,
391
396
  className: a,
392
- children: /* @__PURE__ */ x(O, { children: [/* @__PURE__ */ b(q, { content: /* @__PURE__ */ b(U, {}) }), /* @__PURE__ */ x(ae, {
397
+ children: /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(q, { content: /* @__PURE__ */ S(W, {}) }), /* @__PURE__ */ C(ie, {
393
398
  dataKey: e,
394
- data: c,
399
+ data: l,
395
400
  nameKey: r,
396
401
  isAnimationActive: !0,
397
402
  ...o ? {
398
403
  onClick: o,
399
404
  style: { cursor: "pointer" }
400
405
  } : {},
401
- children: [/* @__PURE__ */ b(k, {
406
+ children: [/* @__PURE__ */ S(A, {
402
407
  position: "right",
403
408
  fill: "hsl(var(--foreground))",
404
409
  stroke: "none",
405
410
  dataKey: r
406
- }), c.map((e, n) => /* @__PURE__ */ b(D, { fill: X(t[n % t.length]) }, `funnel-cell-${n}`))]
411
+ }), l.map((e, n) => /* @__PURE__ */ S(O, { fill: X(t[n % t.length]) }, `funnel-cell-${n}`))]
407
412
  })] })
408
413
  });
409
414
  }
410
- if (e === "radar") return /* @__PURE__ */ b(H, {
415
+ if (c === "radar") return /* @__PURE__ */ S(U, {
411
416
  config: n,
412
417
  className: a,
413
- children: /* @__PURE__ */ x(oe, {
414
- data: c,
418
+ children: /* @__PURE__ */ C(ae, {
419
+ data: l,
415
420
  children: [
416
- /* @__PURE__ */ b(I, {}),
417
- /* @__PURE__ */ b(F, { dataKey: r }),
418
- /* @__PURE__ */ b(L, {}),
419
- /* @__PURE__ */ b(q, { content: /* @__PURE__ */ b(U, {}) }),
420
- /* @__PURE__ */ b(J, {
421
- content: /* @__PURE__ */ b(W, {}),
422
- ...l && {
421
+ /* @__PURE__ */ S(L, {}),
422
+ /* @__PURE__ */ S(I, { dataKey: r }),
423
+ /* @__PURE__ */ S(R, {}),
424
+ /* @__PURE__ */ S(q, { content: /* @__PURE__ */ S(W, {}) }),
425
+ /* @__PURE__ */ S(J, {
426
+ content: /* @__PURE__ */ S(G, {}),
427
+ ...u && {
423
428
  verticalAlign: "bottom",
424
429
  wrapperStyle: {
425
430
  fontSize: "11px",
@@ -429,7 +434,7 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
429
434
  }),
430
435
  i.map((e) => {
431
436
  let t = X(n[e.dataKey]?.color || Y);
432
- return /* @__PURE__ */ b(R, {
437
+ return /* @__PURE__ */ S(z, {
433
438
  dataKey: e.dataKey,
434
439
  stroke: t,
435
440
  fill: t,
@@ -439,34 +444,34 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
439
444
  ]
440
445
  })
441
446
  });
442
- if (e === "scatter") return /* @__PURE__ */ b(H, {
447
+ if (c === "scatter") return /* @__PURE__ */ S(U, {
443
448
  config: n,
444
449
  className: a,
445
- children: /* @__PURE__ */ x(le, { children: [
446
- /* @__PURE__ */ b(E, { vertical: !1 }),
447
- /* @__PURE__ */ b(z, {
450
+ children: /* @__PURE__ */ C(ce, { children: [
451
+ /* @__PURE__ */ S(D, { vertical: !1 }),
452
+ /* @__PURE__ */ S(B, {
448
453
  type: "number",
449
454
  dataKey: r,
450
455
  name: String(n[r]?.label || r),
451
456
  tickLine: !1,
452
457
  axisLine: !1,
453
- interval: l ? Math.ceil(c.length / 5) : 0
458
+ interval: u ? Math.ceil(l.length / 5) : 0
454
459
  }),
455
- /* @__PURE__ */ b(B, {
460
+ /* @__PURE__ */ S(V, {
456
461
  type: "number",
457
462
  dataKey: i[0]?.dataKey || "value",
458
463
  name: String(n[i[0]?.dataKey]?.label || i[0]?.dataKey),
459
464
  tickLine: !1,
460
465
  axisLine: !1
461
466
  }),
462
- /* @__PURE__ */ b(de, {
467
+ /* @__PURE__ */ S(ue, {
463
468
  type: "number",
464
469
  range: [60, 400]
465
470
  }),
466
- /* @__PURE__ */ b(q, { content: /* @__PURE__ */ b(U, {}) }),
467
- /* @__PURE__ */ b(J, {
468
- content: /* @__PURE__ */ b(W, {}),
469
- ...l && {
471
+ /* @__PURE__ */ S(q, { content: /* @__PURE__ */ S(W, {}) }),
472
+ /* @__PURE__ */ S(J, {
473
+ content: /* @__PURE__ */ S(G, {}),
474
+ ...u && {
470
475
  verticalAlign: "bottom",
471
476
  wrapperStyle: {
472
477
  fontSize: "11px",
@@ -475,50 +480,50 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
475
480
  }
476
481
  }),
477
482
  i.map((e, t) => {
478
- let r = v(), i = X(n[e.dataKey]?.color || r[t % r.length]);
479
- return /* @__PURE__ */ b(ce, {
483
+ let r = y(), i = X(n[e.dataKey]?.color || r[t % r.length]);
484
+ return /* @__PURE__ */ S(se, {
480
485
  name: n[e.dataKey]?.label || e.dataKey,
481
- data: c,
486
+ data: l,
482
487
  fill: i
483
488
  }, e.dataKey);
484
489
  })
485
490
  ] })
486
491
  });
487
- if (e === "combo") return /* @__PURE__ */ b(H, {
492
+ if (c === "combo") return /* @__PURE__ */ S(U, {
488
493
  config: n,
489
494
  className: a,
490
- children: /* @__PURE__ */ x(T, {
491
- data: c,
495
+ children: /* @__PURE__ */ C(E, {
496
+ data: l,
492
497
  children: [
493
- /* @__PURE__ */ b(E, { vertical: !1 }),
494
- /* @__PURE__ */ b(z, {
498
+ /* @__PURE__ */ S(D, { vertical: !1 }),
499
+ /* @__PURE__ */ S(B, {
495
500
  dataKey: r,
496
501
  tickLine: !1,
497
502
  tickMargin: 10,
498
503
  axisLine: !1,
499
- interval: l ? Math.ceil(c.length / 5) : 0,
500
- tickFormatter: g,
501
- ...!l && _ && {
504
+ interval: u ? Math.ceil(l.length / 5) : 0,
505
+ tickFormatter: _,
506
+ ...!u && v && {
502
507
  angle: -35,
503
508
  textAnchor: "end",
504
509
  height: 60
505
510
  }
506
511
  }),
507
- /* @__PURE__ */ b(B, {
512
+ /* @__PURE__ */ S(V, {
508
513
  yAxisId: "left",
509
514
  tickLine: !1,
510
515
  axisLine: !1
511
516
  }),
512
- /* @__PURE__ */ b(B, {
517
+ /* @__PURE__ */ S(V, {
513
518
  yAxisId: "right",
514
519
  orientation: "right",
515
520
  tickLine: !1,
516
521
  axisLine: !1
517
522
  }),
518
- /* @__PURE__ */ b(q, { content: /* @__PURE__ */ b(U, {}) }),
519
- /* @__PURE__ */ b(J, {
520
- content: /* @__PURE__ */ b(W, {}),
521
- ...l && {
523
+ /* @__PURE__ */ S(q, { content: /* @__PURE__ */ S(W, {}) }),
524
+ /* @__PURE__ */ S(J, {
525
+ content: /* @__PURE__ */ S(G, {}),
526
+ ...u && {
522
527
  verticalAlign: "bottom",
523
528
  wrapperStyle: {
524
529
  fontSize: "11px",
@@ -528,21 +533,21 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
528
533
  }),
529
534
  i.map((e, t) => {
530
535
  let r = X(n[e.dataKey]?.color || Y), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right";
531
- return i === "line" ? /* @__PURE__ */ b(j, {
536
+ return i === "line" ? /* @__PURE__ */ S(M, {
532
537
  yAxisId: a,
533
538
  type: "monotone",
534
539
  dataKey: e.dataKey,
535
540
  stroke: r,
536
541
  strokeWidth: 2,
537
542
  dot: !1
538
- }, e.dataKey) : i === "area" ? /* @__PURE__ */ b(S, {
543
+ }, e.dataKey) : i === "area" ? /* @__PURE__ */ S(w, {
539
544
  yAxisId: a,
540
545
  type: "monotone",
541
546
  dataKey: e.dataKey,
542
547
  fill: r,
543
548
  stroke: r,
544
549
  fillOpacity: .4
545
- }, e.dataKey) : /* @__PURE__ */ b(w, {
550
+ }, e.dataKey) : /* @__PURE__ */ S(T, {
546
551
  yAxisId: a,
547
552
  dataKey: e.dataKey,
548
553
  fill: r,
@@ -552,44 +557,44 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
552
557
  ]
553
558
  })
554
559
  });
555
- let ee = e === "horizontal-bar";
556
- return /* @__PURE__ */ b(H, {
560
+ let ee = c === "horizontal-bar";
561
+ return /* @__PURE__ */ S(U, {
557
562
  config: n,
558
563
  className: a,
559
- children: /* @__PURE__ */ x(h, {
560
- data: c,
564
+ children: /* @__PURE__ */ C(g, {
565
+ data: l,
561
566
  layout: ee ? "vertical" : "horizontal",
562
- ...p,
567
+ ...m,
563
568
  children: [
564
- /* @__PURE__ */ b(E, { vertical: !1 }),
565
- ee ? /* @__PURE__ */ x(ie, { children: [/* @__PURE__ */ b(z, {
569
+ /* @__PURE__ */ S(D, { vertical: !1 }),
570
+ ee ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(B, {
566
571
  type: "number",
567
572
  tickLine: !1,
568
573
  axisLine: !1
569
- }), /* @__PURE__ */ b(B, {
574
+ }), /* @__PURE__ */ S(V, {
570
575
  type: "category",
571
576
  dataKey: r,
572
577
  tickLine: !1,
573
578
  axisLine: !1,
574
- width: Math.min(140, Math.max(60, Math.max(...c.map((e) => String(e[r] ?? "").length)) * 7)),
575
- tickFormatter: g
576
- })] }) : /* @__PURE__ */ b(z, {
579
+ width: Math.min(140, Math.max(60, Math.max(...l.map((e) => String(e[r] ?? "").length)) * 7)),
580
+ tickFormatter: _
581
+ })] }) : /* @__PURE__ */ S(B, {
577
582
  dataKey: r,
578
583
  tickLine: !1,
579
584
  tickMargin: 10,
580
585
  axisLine: !1,
581
- interval: l ? Math.ceil(c.length / 5) : 0,
582
- tickFormatter: g,
583
- ...!l && _ && {
586
+ interval: u ? Math.ceil(l.length / 5) : 0,
587
+ tickFormatter: _,
588
+ ...!u && v && {
584
589
  angle: -35,
585
590
  textAnchor: "end",
586
591
  height: 60
587
592
  }
588
593
  }),
589
- /* @__PURE__ */ b(q, { content: /* @__PURE__ */ b(U, {}) }),
590
- /* @__PURE__ */ b(J, {
591
- content: /* @__PURE__ */ b(W, {}),
592
- ...l && {
594
+ /* @__PURE__ */ S(q, { content: /* @__PURE__ */ S(W, {}) }),
595
+ /* @__PURE__ */ S(J, {
596
+ content: /* @__PURE__ */ S(G, {}),
597
+ ...u && {
593
598
  verticalAlign: "bottom",
594
599
  wrapperStyle: {
595
600
  fontSize: "11px",
@@ -597,36 +602,36 @@ function Oe({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
597
602
  }
598
603
  }
599
604
  }),
600
- i.map((t, r) => {
601
- let a = v(), o = X(n[t.dataKey]?.color || a[r % a.length] || Y);
602
- if (e === "bar" || e === "horizontal-bar") {
603
- let e = i.length === 1 && c.length > 1;
604
- return /* @__PURE__ */ b(w, {
605
- dataKey: t.dataKey,
606
- fill: o,
605
+ i.map((e, t) => {
606
+ let r = y(), a = X(n[e.dataKey]?.color || r[t % r.length] || Y);
607
+ if (c === "bar" || c === "horizontal-bar") {
608
+ let t = i.length === 1 && l.length > 1;
609
+ return /* @__PURE__ */ S(T, {
610
+ dataKey: e.dataKey,
611
+ fill: a,
607
612
  radius: 4,
608
- children: e && c.map((e, t) => /* @__PURE__ */ b(D, { fill: X(a[t % a.length]) }, `cell-${t}`))
609
- }, t.dataKey);
613
+ children: t && l.map((e, t) => /* @__PURE__ */ S(O, { fill: X(r[t % r.length]) }, `cell-${t}`))
614
+ }, e.dataKey);
610
615
  }
611
- return e === "line" ? /* @__PURE__ */ b(j, {
616
+ return c === "line" ? /* @__PURE__ */ S(M, {
612
617
  type: "monotone",
613
- dataKey: t.dataKey,
614
- stroke: o,
618
+ dataKey: e.dataKey,
619
+ stroke: a,
615
620
  strokeWidth: 2,
616
621
  dot: !1
617
- }, t.dataKey) : e === "area" ? /* @__PURE__ */ b(S, {
622
+ }, e.dataKey) : c === "area" ? /* @__PURE__ */ S(w, {
618
623
  type: "monotone",
619
- dataKey: t.dataKey,
620
- fill: o,
621
- stroke: o,
624
+ dataKey: e.dataKey,
625
+ fill: a,
626
+ stroke: a,
622
627
  fillOpacity: .4
623
- }, t.dataKey) : null;
628
+ }, e.dataKey) : null;
624
629
  })
625
630
  ]
626
631
  })
627
632
  });
628
633
  }
629
- var Y, ke, X, Ae = V((() => {
634
+ var Y, ke, X, Ae = H((() => {
630
635
  Ee(), Y = "hsl(var(--primary))", ke = {
631
636
  slate: "#64748b",
632
637
  gray: "#6b7280",
@@ -651,9 +656,9 @@ var Y, ke, X, Ae = V((() => {
651
656
  pink: "#ec4899",
652
657
  rose: "#f43f5e"
653
658
  }, X = (e) => ke[e] || e;
654
- })), je = s.lazy(() => Promise.resolve().then(() => (xe(), ye))), Me = s.lazy(() => Promise.resolve().then(() => (Ae(), De))), Ne = ({ schema: e }) => /* @__PURE__ */ b(c, {
655
- fallback: /* @__PURE__ */ b(y, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
656
- children: /* @__PURE__ */ b(je, {
659
+ })), je = s.lazy(() => Promise.resolve().then(() => (be(), ve))), Me = s.lazy(() => Promise.resolve().then(() => (Ae(), De))), Ne = ({ schema: e }) => /* @__PURE__ */ S(c, {
660
+ fallback: /* @__PURE__ */ S(b, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
661
+ children: /* @__PURE__ */ S(je, {
657
662
  data: e.data,
658
663
  dataKey: e.dataKey,
659
664
  xAxisKey: e.xAxisKey,
@@ -686,9 +691,9 @@ var Y, ke, X, Ae = V((() => {
686
691
  className: e.className
687
692
  };
688
693
  }, [e]);
689
- return /* @__PURE__ */ b(c, {
690
- fallback: /* @__PURE__ */ b(y, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
691
- children: /* @__PURE__ */ b(Me, {
694
+ return /* @__PURE__ */ S(c, {
695
+ fallback: /* @__PURE__ */ S(b, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
696
+ children: /* @__PURE__ */ S(Me, {
692
697
  chartType: n.chartType,
693
698
  data: n.data,
694
699
  config: n.config,
@@ -822,13 +827,13 @@ async function Fe(e, t, r, i, a) {
822
827
  });
823
828
  }
824
829
  var $ = (e) => {
825
- let { schema: o } = e, s = u(pe), c = e.dataSource || s?.dataSource, y = me(o.bind), { fieldOptionLabel: S } = ge(), C = p(S);
830
+ let { schema: o } = e, s = u(fe), c = e.dataSource || s?.dataSource, b = pe(o.bind), { fieldOptionLabel: w } = he(), re = p(w);
826
831
  d(() => {
827
- C.current = S;
828
- }, [S]);
829
- let [w, T] = m([]), [E, D] = m(!1), [ae, O] = m(null), [k, A] = m(null), j = f(() => o.aggregate ? JSON.stringify(o.aggregate) : "", [o.aggregate]), M = f(() => o.filter ? JSON.stringify(o.filter) : "", [o.filter]), N = l(async (e, t) => {
832
+ re.current = w;
833
+ }, [w]);
834
+ let [T, E] = m([]), [D, O] = m(!1), [ie, k] = m(null), [A, j] = m(null), M = f(() => o.aggregate ? JSON.stringify(o.aggregate) : "", [o.aggregate]), N = f(() => o.filter ? JSON.stringify(o.filter) : "", [o.filter]), P = l(async (e, t) => {
830
835
  if (!(!e || !o.objectName)) {
831
- t.current && (D(!0), O(null));
836
+ t.current && (O(!0), k(null));
832
837
  try {
833
838
  let r, a = i(o.filter);
834
839
  if (o.aggregate && typeof e.aggregate == "function") {
@@ -844,71 +849,71 @@ var $ = (e) => {
844
849
  let s = o.aggregate?.groupBy || o.xAxisKey;
845
850
  if (s && typeof e.getObjectSchema == "function") try {
846
851
  let t = await e.getObjectSchema(o.objectName);
847
- r = await Fe(r, s, t, e, (e, t) => C.current(o.objectName, s, e, t));
852
+ r = await Fe(r, s, t, e, (e, t) => re.current(o.objectName, s, e, t));
848
853
  } catch {}
849
- t.current && T(r);
854
+ t.current && E(r);
850
855
  } catch (e) {
851
- console.error("[ObjectChart] Fetch error:", e), t.current && O(e instanceof Error ? e.message : "Failed to load chart data");
856
+ console.error("[ObjectChart] Fetch error:", e), t.current && k(e instanceof Error ? e.message : "Failed to load chart data");
852
857
  } finally {
853
- t.current && D(!1);
858
+ t.current && O(!1);
854
859
  }
855
860
  }
856
861
  }, [
857
862
  o.objectName,
858
- j,
859
863
  M,
864
+ N,
860
865
  o.xAxisKey
861
866
  ]);
862
867
  d(() => {
863
868
  let e = { current: !0 };
864
- return o.objectName && !y && !o.data && N(c, e), () => {
869
+ return o.objectName && !b && !o.data && P(c, e), () => {
865
870
  e.current = !1;
866
871
  };
867
872
  }, [
868
873
  o.objectName,
869
874
  c,
870
- y,
875
+ b,
871
876
  o.data,
877
+ N,
872
878
  M,
873
- j,
874
- N
879
+ P
875
880
  ]);
876
- let P = y || o.data || w, F = Array.isArray(P) ? P : [], I = o.drillDown, L = o.aggregate?.groupBy || o.xAxisKey, R = f(() => {
877
- if (!L) return /* @__PURE__ */ new Map();
878
- let e = /* @__PURE__ */ new Map(), t = `__raw_${L}`;
879
- for (let n of F) {
880
- let r = n?.[L];
881
+ let F = b || o.data || T, I = Array.isArray(F) ? F : [], L = o.drillDown, R = o.aggregate?.groupBy || o.xAxisKey, z = f(() => {
882
+ if (!R) return /* @__PURE__ */ new Map();
883
+ let e = /* @__PURE__ */ new Map(), t = `__raw_${R}`;
884
+ for (let n of I) {
885
+ let r = n?.[R];
881
886
  if (r == null) continue;
882
887
  let i = t in (n || {}) ? n[t] : r;
883
888
  e.set(String(r), i);
884
889
  }
885
890
  return e;
886
- }, [F, L]), oe = {
891
+ }, [I, R]), ae = {
887
892
  ...o,
888
- data: F
893
+ data: I
889
894
  };
890
- if (E && F.length === 0) return /* @__PURE__ */ b("div", {
895
+ if (D && I.length === 0) return /* @__PURE__ */ S("div", {
891
896
  className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (o.className || ""),
892
897
  "data-testid": "chart-loading",
893
898
  children: "Loading chart data…"
894
899
  });
895
- if (ae) return /* @__PURE__ */ x("div", {
900
+ if (ie) return /* @__PURE__ */ C("div", {
896
901
  className: "flex flex-col items-center justify-center gap-2 p-4 " + (o.className || ""),
897
902
  "data-testid": "chart-error",
898
903
  role: "alert",
899
904
  children: [
900
- /* @__PURE__ */ b(he, { className: "h-6 w-6 text-destructive opacity-60" }),
901
- /* @__PURE__ */ b("p", {
905
+ /* @__PURE__ */ S(me, { className: "h-6 w-6 text-destructive opacity-60" }),
906
+ /* @__PURE__ */ S("p", {
902
907
  className: "text-xs text-destructive font-medium",
903
908
  children: "Failed to load chart data"
904
909
  }),
905
- /* @__PURE__ */ b("p", {
910
+ /* @__PURE__ */ S("p", {
906
911
  className: "text-xs text-muted-foreground max-w-xs text-center",
907
- children: ae
912
+ children: ie
908
913
  })
909
914
  ]
910
915
  });
911
- if (!c && o.objectName && F.length === 0) return /* @__PURE__ */ x("div", {
916
+ if (!c && o.objectName && I.length === 0) return /* @__PURE__ */ C("div", {
912
917
  className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (o.className || ""),
913
918
  "data-testid": "chart-no-datasource",
914
919
  children: [
@@ -917,29 +922,29 @@ var $ = (e) => {
917
922
  "”"
918
923
  ]
919
924
  });
920
- let se = r(I) ? (e) => {
921
- let t = e.category, n = t != null && R.has(String(t)) ? R.get(String(t)) : t;
922
- A({
925
+ let oe = r(L) ? (e) => {
926
+ let t = e.category, n = t != null && z.has(String(t)) ? z.get(String(t)) : t;
927
+ j({
923
928
  ...e,
924
929
  category: n,
925
930
  categoryLabel: t,
926
931
  scope: "cell"
927
932
  });
928
- } : void 0, ce = k && o.objectName ? (() => {
929
- let e = t(I, k, { groupByField: L }), n = {
933
+ } : void 0, se = A && o.objectName ? (() => {
934
+ let e = t(L, A, { groupByField: R }), n = {
930
935
  ...o.filter || {},
931
936
  ...e
932
- }, r = a(I, k, o.title || "Details"), i = I?.target ?? "drawer", s = /* @__PURE__ */ b("div", {
937
+ }, r = a(L, A, o.title || "Details"), i = L?.target ?? "drawer", s = /* @__PURE__ */ S("div", {
933
938
  className: "overflow-auto",
934
939
  "data-testid": "chart-drill-body",
935
- children: /* @__PURE__ */ b(fe, {
940
+ children: /* @__PURE__ */ S(de, {
936
941
  schema: {
937
942
  type: "object-data-table",
938
943
  objectName: o.objectName,
939
944
  filter: n,
940
945
  pagination: !0,
941
- pageSize: I?.maxRows,
942
- columns: I?.columns?.map((e) => ({
946
+ pageSize: L?.maxRows,
947
+ columns: L?.columns?.map((e) => ({
943
948
  accessorKey: e,
944
949
  header: e
945
950
  }))
@@ -947,31 +952,31 @@ var $ = (e) => {
947
952
  dataSource: c
948
953
  })
949
954
  });
950
- return i === "dialog" ? /* @__PURE__ */ b(h, {
955
+ return i === "dialog" ? /* @__PURE__ */ S(h, {
951
956
  open: !0,
952
- onOpenChange: (e) => !e && A(null),
953
- children: /* @__PURE__ */ x(g, {
957
+ onOpenChange: (e) => !e && j(null),
958
+ children: /* @__PURE__ */ C(g, {
954
959
  className: "max-w-4xl",
955
- children: [/* @__PURE__ */ b(_, { children: /* @__PURE__ */ b(v, { children: r }) }), s]
960
+ children: [/* @__PURE__ */ S(_, { children: /* @__PURE__ */ S(v, { children: r }) }), s]
956
961
  })
957
- }) : /* @__PURE__ */ b(ee, {
962
+ }) : /* @__PURE__ */ S(y, {
958
963
  open: !0,
959
- onOpenChange: (e) => !e && A(null),
960
- children: /* @__PURE__ */ x(te, {
964
+ onOpenChange: (e) => !e && j(null),
965
+ children: /* @__PURE__ */ C(ee, {
961
966
  side: "right",
962
967
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
963
- children: [/* @__PURE__ */ b(ne, { children: /* @__PURE__ */ b(re, { children: r }) }), /* @__PURE__ */ b("div", {
968
+ children: [/* @__PURE__ */ S(te, { children: /* @__PURE__ */ S(ne, { children: r }) }), /* @__PURE__ */ S("div", {
964
969
  className: "flex-1 overflow-hidden mt-2",
965
970
  children: s
966
971
  })]
967
972
  })
968
973
  });
969
974
  })() : null;
970
- return /* @__PURE__ */ x(ie, { children: [/* @__PURE__ */ b(Z, {
975
+ return /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(Z, {
971
976
  ...e,
972
- schema: oe,
973
- onChartClick: se
974
- }), ce] });
977
+ schema: ae,
978
+ onChartClick: oe
979
+ }), se] });
975
980
  };
976
981
  e.register("object-chart", $, {
977
982
  namespace: "plugin-charts",
@@ -1,7 +1,7 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`recharts`),require(`@object-ui/react`),require(`lucide-react`),require(`@object-ui/i18n`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`recharts`,`@object-ui/react`,`lucide-react`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginCharts={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.recharts,e.ObjectUIReact,e.lucide_react,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t)=>()=>(e&&(t=e(e=0)),t),g=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),_(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v=g({default:()=>y});function y({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:o=``,color:s=`hsl(var(--primary))`}){return(0,i.jsx)(`div`,{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${o}`,children:(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:r,children:(0,i.jsxs)(a.BarChart,{data:e,margin:{top:10,right:10,left:10,bottom:5},children:[(0,i.jsxs)(`defs`,{children:[(0,i.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:1}),(0,i.jsx)(`stop`,{offset:`90%`,stopColor:s,stopOpacity:.6}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:.3})]}),(0,i.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,i.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,i.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,i.jsx)(`feFlood`,{floodColor:s,floodOpacity:`0.5`,result:`offsetColor`}),(0,i.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,i.jsxs)(`feMerge`,{children:[(0,i.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,i.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,i.jsx)(a.CartesianGrid,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:n,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},dy:10}),(0,i.jsx)(a.YAxis,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,i.jsx)(a.Tooltip,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,i.jsx)(a.Legend,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,i.jsx)(a.Bar,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var b=h((()=>{}));function x(){let e=n.useContext(O);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function S({id:e,className:t,children:r,config:o,...s}){let c=n.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,i.jsx)(O.Provider,{value:{config:o},children:(0,i.jsxs)(`div`,{"data-slot":`chart`,"data-chart":l,className:E(`flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),...s,children:[(0,i.jsx)(k,{id:l,config:o}),(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:r})]})})}function C({active:e,payload:t,className:r,indicator:a=`dot`,hideLabel:o=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m}){let{config:h}=x(),g=n.useMemo(()=>{if(o||!t?.length)return null;let[e]=t,n=T(h,e,`${m||e?.dataKey||e?.name||`value`}`),r=!m&&typeof c==`string`?h[c]?.label||c:n?.label;return l?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:l(r,t)}):r?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:r}):null},[c,l,t,o,u,h,m]);if(!e||!t?.length)return null;let _=t.length===1&&a!==`dot`;return(0,i.jsxs)(`div`,{className:E(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,r),children:[_?null:g,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=T(h,e,`${p||e.name||e.dataKey||`value`}`),r=f||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:E(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,a===`dot`?`items-center`:``),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[n?.icon?(0,i.jsx)(n.icon,{}):!s&&(0,i.jsx)(`div`,{className:E(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,a===`dot`?`h-2.5 w-2.5`:``,a===`line`?`w-1`:``,a===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,_&&a===`dashed`?`my-0.5`:``),style:{"--color-bg":r,"--color-border":r}}),(0,i.jsxs)(`div`,{className:E(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}function w({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:a}){let{config:o}=x();return n?.length?(0,i.jsx)(`div`,{className:E(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=T(o,e,`${a||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:E(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,i.jsx)(n.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function T(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var E,D,O,k,A,j,M=h((()=>{E=(...e)=>e.filter(Boolean).join(` `),D={light:``,dark:`.dark`},O=n.createContext(null),k=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(D).map(([t,r])=>`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`recharts`),require(`@object-ui/react`),require(`lucide-react`),require(`@object-ui/i18n`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`recharts`,`@object-ui/react`,`lucide-react`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginCharts={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.recharts,e.ObjectUIReact,e.lucide_react,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t)=>()=>(e&&(t=e(e=0)),t),g=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),_(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v=g({default:()=>y});function y({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:o=``,color:s=`hsl(var(--primary))`}){return(0,i.jsx)(`div`,{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${o}`,children:(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:r,children:(0,i.jsxs)(a.BarChart,{data:e,margin:{top:10,right:10,left:10,bottom:5},children:[(0,i.jsxs)(`defs`,{children:[(0,i.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:1}),(0,i.jsx)(`stop`,{offset:`90%`,stopColor:s,stopOpacity:.6}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:.3})]}),(0,i.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,i.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,i.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,i.jsx)(`feFlood`,{floodColor:s,floodOpacity:`0.5`,result:`offsetColor`}),(0,i.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,i.jsxs)(`feMerge`,{children:[(0,i.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,i.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,i.jsx)(a.CartesianGrid,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:n,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},dy:10}),(0,i.jsx)(a.YAxis,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,i.jsx)(a.Tooltip,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,i.jsx)(a.Legend,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,i.jsx)(a.Bar,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var b=h((()=>{}));function x(){let e=n.useContext(O);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function S({id:e,className:t,children:r,config:o,...s}){let c=n.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,i.jsx)(O.Provider,{value:{config:o},children:(0,i.jsxs)(`div`,{"data-slot":`chart`,"data-chart":l,className:E(`flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),style:{minHeight:280,minWidth:0,...s.style},...s,children:[(0,i.jsx)(k,{id:l,config:o}),(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:r})]})})}function C({active:e,payload:t,className:r,indicator:a=`dot`,hideLabel:o=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m}){let{config:h}=x(),g=n.useMemo(()=>{if(o||!t?.length)return null;let[e]=t,n=T(h,e,`${m||e?.dataKey||e?.name||`value`}`),r=!m&&typeof c==`string`?h[c]?.label||c:n?.label;return l?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:l(r,t)}):r?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:r}):null},[c,l,t,o,u,h,m]);if(!e||!t?.length)return null;let _=t.length===1&&a!==`dot`;return(0,i.jsxs)(`div`,{className:E(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,r),children:[_?null:g,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=T(h,e,`${p||e.name||e.dataKey||`value`}`),r=f||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:E(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,a===`dot`?`items-center`:``),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[n?.icon?(0,i.jsx)(n.icon,{}):!s&&(0,i.jsx)(`div`,{className:E(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,a===`dot`?`h-2.5 w-2.5`:``,a===`line`?`w-1`:``,a===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,_&&a===`dashed`?`my-0.5`:``),style:{"--color-bg":r,"--color-border":r}}),(0,i.jsxs)(`div`,{className:E(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}function w({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:a}){let{config:o}=x();return n?.length?(0,i.jsx)(`div`,{className:E(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=T(o,e,`${a||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:E(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,i.jsx)(n.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function T(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var E,D,O,k,A,j,M=h((()=>{E=(...e)=>e.filter(Boolean).join(` `),D={light:``,dark:`.dark`},O=n.createContext(null),k=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(D).map(([t,r])=>`
2
2
  ${r} [data-chart=${e}] {
3
3
  ${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
4
4
  `)}
5
5
  }
6
6
  `).join(`
7
- `)}}):null},A=a.Tooltip,j=a.Legend})),N=g({default:()=>P});function P({chartType:e=`bar`,data:t=[],config:r={},xAxisKey:o=`name`,series:s=[],className:c=``,onChartClick:l}){let u=Array.isArray(t)?t:[],[d,f]=n.useState(!1),p=n.useCallback(e=>{if(!l||!e)return;let t=Array.isArray(e.activePayload)?e.activePayload[0]:void 0;l({category:e.activeLabel==null?void 0:String(e.activeLabel),series:t?.dataKey?String(t.dataKey):void 0,value:typeof t?.value==`number`?t.value:void 0})},[l]),m=n.useCallback(e=>{if(!l||!e)return;let t=e.payload?.[o],n=s[0]?.dataKey||`value`;l({category:t==null?void 0:String(t),series:n,value:typeof e.payload?.[n]==`number`?e.payload[n]:void 0})},[l,o,s]),h=l?{onClick:p,style:{cursor:`pointer`}}:{},g=l?{onClick:m,style:{cursor:`pointer`}}:{};n.useEffect(()=>{let e=()=>f(window.innerWidth<640);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let _={bar:a.BarChart,"horizontal-bar":a.BarChart,line:a.LineChart,area:a.AreaChart,pie:a.PieChart,donut:a.PieChart,radar:a.RadarChart,scatter:a.ScatterChart,funnel:a.FunnelChart,combo:a.BarChart}[e]||a.BarChart,v=n.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`string`?e:String(e);if(/^\d{4}-\d{2}-\d{2}/.test(t)){let e=new Date(t);if(!Number.isNaN(e.getTime())){let t=(u.length>1?Math.abs(new Date(String(u[u.length-1][o]??``)).getTime()-new Date(String(u[0][o]??``)).getTime()):0)/(1e3*60*60*24);try{return t<=62?e.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e.toLocaleDateString(void 0,{month:`short`,year:`numeric`})}catch{return e.toISOString().slice(0,10)}}}return d&&t.length>8?t.slice(0,8)+`…`:t},[u,o,d]),y=n.useMemo(()=>u.some(e=>String(e[o]||``).length>5),[u,o]),b=()=>[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`];if(e===`pie`||e===`donut`){let t=e===`donut`?60:0;return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.PieChart,{children:[(0,i.jsx)(A,{cursor:!1,content:(0,i.jsx)(C,{hideLabel:!0})}),(0,i.jsx)(a.Pie,{data:u,dataKey:s[0]?.dataKey||`value`,nameKey:o||`name`,innerRadius:t,strokeWidth:5,paddingAngle:2,outerRadius:80,...g,children:u.map((e,t)=>{let n=r[e[o]]?.color;if(!n){let e=b();n=e[t%e.length]}return(0,i.jsx)(a.Cell,{fill:L(n)},`cell-${t}`)})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{nameKey:o}),...d&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}})]})})}if(e===`funnel`){let e=s[0]?.dataKey||`value`,t=b(),n=l?t=>{t&&l({category:t?.payload?.[o]??t?.[o],value:t?.payload?.[e]??t?.[e]})}:void 0;return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.FunnelChart,{children:[(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsxs)(a.Funnel,{dataKey:e,data:u,nameKey:o,isAnimationActive:!0,...n?{onClick:n,style:{cursor:`pointer`}}:{},children:[(0,i.jsx)(a.LabelList,{position:`right`,fill:`hsl(var(--foreground))`,stroke:`none`,dataKey:o}),u.map((e,n)=>(0,i.jsx)(a.Cell,{fill:L(t[n%t.length])},`funnel-cell-${n}`))]})]})})}if(e===`radar`)return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.RadarChart,{data:u,children:[(0,i.jsx)(a.PolarGrid,{}),(0,i.jsx)(a.PolarAngleAxis,{dataKey:o}),(0,i.jsx)(a.PolarRadiusAxis,{}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...d&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map(e=>{let t=L(r[e.dataKey]?.color||F);return(0,i.jsx)(a.Radar,{dataKey:e.dataKey,stroke:t,fill:t,fillOpacity:.6},e.dataKey)})]})});if(e===`scatter`)return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.ScatterChart,{children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{type:`number`,dataKey:o,name:String(r[o]?.label||o),tickLine:!1,axisLine:!1,interval:d?Math.ceil(u.length/5):0}),(0,i.jsx)(a.YAxis,{type:`number`,dataKey:s[0]?.dataKey||`value`,name:String(r[s[0]?.dataKey]?.label||s[0]?.dataKey),tickLine:!1,axisLine:!1}),(0,i.jsx)(a.ZAxis,{type:`number`,range:[60,400]}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...d&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=b(),o=L(r[e.dataKey]?.color||n[t%n.length]);return(0,i.jsx)(a.Scatter,{name:r[e.dataKey]?.label||e.dataKey,data:u,fill:o},e.dataKey)})]})});if(e===`combo`)return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.BarChart,{data:u,children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:o,tickLine:!1,tickMargin:10,axisLine:!1,interval:d?Math.ceil(u.length/5):0,tickFormatter:v,...!d&&y&&{angle:-35,textAnchor:`end`,height:60}}),(0,i.jsx)(a.YAxis,{yAxisId:`left`,tickLine:!1,axisLine:!1}),(0,i.jsx)(a.YAxis,{yAxisId:`right`,orientation:`right`,tickLine:!1,axisLine:!1}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...d&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=L(r[e.dataKey]?.color||F),o=e.chartType||(t===0?`bar`:`line`),s=o===`bar`?`left`:`right`;return o===`line`?(0,i.jsx)(a.Line,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,stroke:n,strokeWidth:2,dot:!1},e.dataKey):o===`area`?(0,i.jsx)(a.Area,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,fill:n,stroke:n,fillOpacity:.4},e.dataKey):(0,i.jsx)(a.Bar,{yAxisId:s,dataKey:e.dataKey,fill:n,radius:4},e.dataKey)})]})});let x=e===`horizontal-bar`;return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(_,{data:u,layout:x?`vertical`:`horizontal`,...h,children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),x?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.XAxis,{type:`number`,tickLine:!1,axisLine:!1}),(0,i.jsx)(a.YAxis,{type:`category`,dataKey:o,tickLine:!1,axisLine:!1,width:Math.min(140,Math.max(60,Math.max(...u.map(e=>String(e[o]??``).length))*7)),tickFormatter:v})]}):(0,i.jsx)(a.XAxis,{dataKey:o,tickLine:!1,tickMargin:10,axisLine:!1,interval:d?Math.ceil(u.length/5):0,tickFormatter:v,...!d&&y&&{angle:-35,textAnchor:`end`,height:60}}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...d&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((t,n)=>{let o=b(),c=L(r[t.dataKey]?.color||o[n%o.length]||F);if(e===`bar`||e===`horizontal-bar`){let e=s.length===1&&u.length>1;return(0,i.jsx)(a.Bar,{dataKey:t.dataKey,fill:c,radius:4,children:e&&u.map((e,t)=>(0,i.jsx)(a.Cell,{fill:L(o[t%o.length])},`cell-${t}`))},t.dataKey)}return e===`line`?(0,i.jsx)(a.Line,{type:`monotone`,dataKey:t.dataKey,stroke:c,strokeWidth:2,dot:!1},t.dataKey):e===`area`?(0,i.jsx)(a.Area,{type:`monotone`,dataKey:t.dataKey,fill:c,stroke:c,fillOpacity:.4},t.dataKey):null})]})})}var F,I,L,R=h((()=>{M(),F=`hsl(var(--primary))`,I={slate:`#64748b`,gray:`#6b7280`,zinc:`#71717a`,neutral:`#737373`,stone:`#78716c`,red:`#ef4444`,orange:`#f97316`,amber:`#f59e0b`,yellow:`#eab308`,lime:`#84cc16`,green:`#22c55e`,emerald:`#10b981`,teal:`#14b8a6`,cyan:`#06b6d4`,sky:`#0ea5e9`,blue:`#3b82f6`,indigo:`#6366f1`,violet:`#8b5cf6`,purple:`#a855f7`,fuchsia:`#d946ef`,pink:`#ec4899`,rose:`#f43f5e`},L=e=>I[e]||e})),z=n.default.lazy(()=>Promise.resolve().then(()=>(b(),v))),B=n.default.lazy(()=>Promise.resolve().then(()=>(R(),N))),V=({schema:e})=>(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(z,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),H=({schema:e,onChartClick:t})=>{let a=n.default.useMemo(()=>{let t=e.series,n=e.xAxisKey,r=e.config;if(n||(e.index?n=e.index:e.category&&(n=e.category)),t||(e.categories?t=e.categories.map(e=>({dataKey:e})):e.value&&(t=[{dataKey:e.value}])),!r&&t){let n=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],i={};t.forEach((e,t)=>{i[e.dataKey]={label:e.label||e.dataKey,color:n[t%n.length]}}),r=i}return{chartType:e.chartType,data:Array.isArray(e.data)?e.data:[],config:r,xAxisKey:n,series:t,className:e.className}},[e]);return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(B,{chartType:a.chartType,data:a.data,config:a.config,xAxisKey:a.xAxisKey,series:a.series,className:a.className,onChartClick:t})})};function U(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function W(e,t){let{field:n,function:r,groupBy:i}=t,a={};for(let t of e){let e=String(t[i]??`Unknown`);a[e]||(a[e]=[]),a[e].push(t)}return Object.entries(a).map(([e,t])=>{let a=t.map(e=>Number(e[n])||0),o;switch(r){case`count`:o=t.length;break;case`avg`:o=a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0;break;case`min`:o=a.length>0?Math.min(...a):0;break;case`max`:o=a.length>0?Math.max(...a):0;break;default:o=a.reduce((e,t)=>e+t,0);break}return{[i]:e,[n]:o}})}async function G(e,n,r,i,a){if(!e.length||!n)return e;let o=a||((e,t)=>t),s=`__raw_${n}`,c=r?.fields?.[n];if(!c){let t=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[n],i=String(r??``),a=t.test(i)?i:U(i);return{...e,[n]:o(i,a),[s]:r}})}let l=c.type;if(l===`select`||l===`picklist`||l===`dropdown`){let t=c.options||[];if(t.length===0)return e.map(e=>{let t=e[n],r=String(t??``),i=U(r);return{...e,[n]:o(r,i),[s]:t}});let r={};for(let e of t)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let t=e[n],i=String(t??``),a=r[i]||U(i);return{...e,[n]:o(i,a),[s]:t}})}if(l===`lookup`||l===`master_detail`){let r=c.reference_to||c.reference;if(!r||!i||typeof i.find!=`function`)return e.map(e=>({...e,[s]:e[n]}));let a=[...new Set(e.map(e=>e[n]).filter(e=>e!=null))];if(a.length===0)return e.map(e=>({...e,[s]:e[n]}));let o=c.id_field||`id`;try{let l=(0,t.extractRecords)(await i.find(r,{$filter:{[o]:{$in:a}},$top:a.length})),u=c.reference_field||c.display_field||`name`,d={};for(let e of l){let t=String(e[o]??e.id??e._id??``),n=e[u]||e.name||e.label||e.title||t;t&&(d[t]=String(n))}return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:d[r]||r,[s]:t}})}catch(t){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,t),e.map(e=>({...e,[s]:e[n]}))}}if(l===`date`||l===`datetime`||l===`date_time`||l===`timestamp`||l===`time`)return e.map(e=>({...e,[s]:e[n]}));let u=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:u.test(r)?r:U(r),[s]:t}})}var K=e=>{let{schema:a}=e,l=(0,n.useContext)(o.SchemaRendererContext),u=e.dataSource||l?.dataSource,d=(0,o.useDataScope)(a.bind),{fieldOptionLabel:f}=(0,c.useSafeFieldLabel)(),p=(0,n.useRef)(f);(0,n.useEffect)(()=>{p.current=f},[f]);let[m,h]=(0,n.useState)([]),[g,_]=(0,n.useState)(!1),[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(null),S=(0,n.useMemo)(()=>a.aggregate?JSON.stringify(a.aggregate):``,[a.aggregate]),C=(0,n.useMemo)(()=>a.filter?JSON.stringify(a.filter):``,[a.filter]),w=(0,n.useCallback)(async(e,n)=>{if(!(!e||!a.objectName)){n.current&&(_(!0),y(null));try{let r,i=(0,t.resolveDateMacros)(a.filter);if(a.aggregate&&typeof e.aggregate==`function`){let t=await e.aggregate(a.objectName,{field:a.aggregate.field,function:a.aggregate.function,groupBy:a.aggregate.groupBy,filter:i});r=Array.isArray(t)?t:[]}else if(typeof e.find==`function`)r=(0,t.extractRecords)(await e.find(a.objectName,{$filter:i})),a.aggregate&&r.length>0&&(r=W(r,a.aggregate));else return;let o=a.aggregate?.groupBy||a.xAxisKey;if(o&&typeof e.getObjectSchema==`function`)try{let t=await e.getObjectSchema(a.objectName);r=await G(r,o,t,e,(e,t)=>p.current(a.objectName,o,e,t))}catch{}n.current&&h(r)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&y(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&_(!1)}}},[a.objectName,S,C,a.xAxisKey]);(0,n.useEffect)(()=>{let e={current:!0};return a.objectName&&!d&&!a.data&&w(u,e),()=>{e.current=!1}},[a.objectName,u,d,a.data,C,S,w]);let T=d||a.data||m,E=Array.isArray(T)?T:[],D=a.drillDown,O=a.aggregate?.groupBy||a.xAxisKey,k=(0,n.useMemo)(()=>{if(!O)return new Map;let e=new Map,t=`__raw_${O}`;for(let n of E){let r=n?.[O];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[E,O]),A={...a,data:E};if(g&&E.length===0)return(0,i.jsx)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(a.className||``),"data-testid":`chart-loading`,children:`Loading chart data…`});if(v)return(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(a.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,i.jsx)(s.AlertCircle,{className:`h-6 w-6 text-destructive opacity-60`}),(0,i.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:v})]});if(!u&&a.objectName&&E.length===0)return(0,i.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(a.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,a.objectName,`”`]});let j=(0,t.isDrillEnabled)(D)?e=>{let t=e.category,n=t!=null&&k.has(String(t))?k.get(String(t)):t;x({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,M=b&&a.objectName?(()=>{let e=(0,t.computeDrillFilter)(D,b,{groupByField:O}),n={...a.filter||{},...e},s=(0,t.resolveDrillTitle)(D,b,a.title||`Details`),c=D?.target??`drawer`,l=(0,i.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,i.jsx)(o.SchemaRenderer,{schema:{type:`object-data-table`,objectName:a.objectName,filter:n,pagination:!0,pageSize:D?.maxRows,columns:D?.columns?.map(e=>({accessorKey:e,header:e}))},dataSource:u})});return c===`dialog`?(0,i.jsx)(r.Dialog,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,i.jsxs)(r.DialogContent,{className:`max-w-4xl`,children:[(0,i.jsx)(r.DialogHeader,{children:(0,i.jsx)(r.DialogTitle,{children:s})}),l]})}):(0,i.jsx)(r.Sheet,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,i.jsxs)(r.SheetContent,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,i.jsx)(r.SheetHeader,{children:(0,i.jsx)(r.SheetTitle,{children:s})}),(0,i.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:l})]})})})():null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(H,{...e,schema:A,onChartClick:j}),M]})};t.ComponentRegistry.register(`object-chart`,K,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Optional static data`},{name:`filter`,type:`array`,label:`Filter`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`}]});var q={"bar-chart":V,chart:H};t.ComponentRegistry.register(`bar-chart`,V,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,label:`Data`,required:!0},{name:`dataKey`,type:`string`,label:`Data Key`,defaultValue:`value`},{name:`xAxisKey`,type:`string`,label:`X-Axis Key`,defaultValue:`name`},{name:`height`,type:`number`,label:`Height`,defaultValue:400},{name:`color`,type:`color`,label:`Color`,defaultValue:`#8884d8`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),t.ComponentRegistry.register(`chart`,K,{namespace:`view`,category:`view`,label:`Chart`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`type`,type:`string`,label:`Chart Type`},{name:`categoryField`,type:`string`,label:`Category Field`},{name:`valueField`,type:`string`,label:`Value Field`}]}),t.ComponentRegistry.register(`chart`,H,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,label:`Chart Type`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}],defaultValue:`bar`},{name:`data`,type:`code`,label:`Data (JSON)`,required:!0},{name:`config`,type:`code`,label:`Config (JSON)`},{name:`xAxisKey`,type:`string`,label:`X Axis Key`,defaultValue:`name`},{name:`series`,type:`code`,label:`Series (JSON Array)`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),t.ComponentRegistry.register(`chart:bar`,H,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`,defaultProps:{chartType:`bar`}}),t.ComponentRegistry.register(`pie-chart`,H,{namespace:`plugin-charts`,label:`Pie Chart`,category:`plugin`,defaultProps:{chartType:`pie`}}),t.ComponentRegistry.register(`donut-chart`,H,{namespace:`plugin-charts`,label:`Donut Chart`,category:`plugin`,defaultProps:{chartType:`donut`}}),t.ComponentRegistry.register(`radar-chart`,H,{namespace:`plugin-charts`,label:`Radar Chart`,category:`plugin`,defaultProps:{chartType:`radar`}}),t.ComponentRegistry.register(`scatter-chart`,H,{namespace:`plugin-charts`,label:`Scatter Chart`,category:`plugin`,defaultProps:{chartType:`scatter`}}),e.ChartBarRenderer=V,e.ChartRenderer=H,e.ObjectChart=K,e.chartComponents=q});
7
+ `)}}):null},A=a.Tooltip,j=a.Legend})),N=g({default:()=>P});function P({chartType:e=`bar`,data:t=[],config:r={},xAxisKey:o=`name`,series:s=[],className:c=``,onChartClick:l}){let u=e===`column`?`bar`:e,d=Array.isArray(t)?t:[],[f,p]=n.useState(!1),m=n.useCallback(e=>{if(!l||!e)return;let t=Array.isArray(e.activePayload)?e.activePayload[0]:void 0;l({category:e.activeLabel==null?void 0:String(e.activeLabel),series:t?.dataKey?String(t.dataKey):void 0,value:typeof t?.value==`number`?t.value:void 0})},[l]),h=n.useCallback(e=>{if(!l||!e)return;let t=e.payload?.[o],n=s[0]?.dataKey||`value`;l({category:t==null?void 0:String(t),series:n,value:typeof e.payload?.[n]==`number`?e.payload[n]:void 0})},[l,o,s]),g=l?{onClick:m,style:{cursor:`pointer`}}:{},_=l?{onClick:h,style:{cursor:`pointer`}}:{};n.useEffect(()=>{let e=()=>p(window.innerWidth<640);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let v={bar:a.BarChart,"horizontal-bar":a.BarChart,line:a.LineChart,area:a.AreaChart,pie:a.PieChart,donut:a.PieChart,radar:a.RadarChart,scatter:a.ScatterChart,funnel:a.FunnelChart,combo:a.BarChart}[u]||a.BarChart,y=n.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`string`?e:String(e);if(/^\d{4}-\d{2}-\d{2}/.test(t)){let e=new Date(t);if(!Number.isNaN(e.getTime())){let t=(d.length>1?Math.abs(new Date(String(d[d.length-1][o]??``)).getTime()-new Date(String(d[0][o]??``)).getTime()):0)/(1e3*60*60*24);try{return t<=62?e.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e.toLocaleDateString(void 0,{month:`short`,year:`numeric`})}catch{return e.toISOString().slice(0,10)}}}return f&&t.length>8?t.slice(0,8)+`…`:t},[d,o,f]),b=n.useMemo(()=>d.some(e=>String(e[o]||``).length>5),[d,o]),x=()=>[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`];if(u===`pie`||u===`donut`){let e=u===`donut`?60:0;return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.PieChart,{children:[(0,i.jsx)(A,{cursor:!1,content:(0,i.jsx)(C,{hideLabel:!0})}),(0,i.jsx)(a.Pie,{data:d,dataKey:s[0]?.dataKey||`value`,nameKey:o||`name`,innerRadius:e,strokeWidth:5,paddingAngle:2,outerRadius:80,..._,children:d.map((e,t)=>{let n=r[e[o]]?.color;if(!n){let e=x();n=e[t%e.length]}return(0,i.jsx)(a.Cell,{fill:L(n)},`cell-${t}`)})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{nameKey:o}),...f&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}})]})})}if(u===`funnel`){let e=s[0]?.dataKey||`value`,t=x(),n=l?t=>{t&&l({category:t?.payload?.[o]??t?.[o],value:t?.payload?.[e]??t?.[e]})}:void 0;return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.FunnelChart,{children:[(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsxs)(a.Funnel,{dataKey:e,data:d,nameKey:o,isAnimationActive:!0,...n?{onClick:n,style:{cursor:`pointer`}}:{},children:[(0,i.jsx)(a.LabelList,{position:`right`,fill:`hsl(var(--foreground))`,stroke:`none`,dataKey:o}),d.map((e,n)=>(0,i.jsx)(a.Cell,{fill:L(t[n%t.length])},`funnel-cell-${n}`))]})]})})}if(u===`radar`)return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.RadarChart,{data:d,children:[(0,i.jsx)(a.PolarGrid,{}),(0,i.jsx)(a.PolarAngleAxis,{dataKey:o}),(0,i.jsx)(a.PolarRadiusAxis,{}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...f&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map(e=>{let t=L(r[e.dataKey]?.color||F);return(0,i.jsx)(a.Radar,{dataKey:e.dataKey,stroke:t,fill:t,fillOpacity:.6},e.dataKey)})]})});if(u===`scatter`)return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.ScatterChart,{children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{type:`number`,dataKey:o,name:String(r[o]?.label||o),tickLine:!1,axisLine:!1,interval:f?Math.ceil(d.length/5):0}),(0,i.jsx)(a.YAxis,{type:`number`,dataKey:s[0]?.dataKey||`value`,name:String(r[s[0]?.dataKey]?.label||s[0]?.dataKey),tickLine:!1,axisLine:!1}),(0,i.jsx)(a.ZAxis,{type:`number`,range:[60,400]}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...f&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=x(),o=L(r[e.dataKey]?.color||n[t%n.length]);return(0,i.jsx)(a.Scatter,{name:r[e.dataKey]?.label||e.dataKey,data:d,fill:o},e.dataKey)})]})});if(u===`combo`)return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(a.BarChart,{data:d,children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:o,tickLine:!1,tickMargin:10,axisLine:!1,interval:f?Math.ceil(d.length/5):0,tickFormatter:y,...!f&&b&&{angle:-35,textAnchor:`end`,height:60}}),(0,i.jsx)(a.YAxis,{yAxisId:`left`,tickLine:!1,axisLine:!1}),(0,i.jsx)(a.YAxis,{yAxisId:`right`,orientation:`right`,tickLine:!1,axisLine:!1}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...f&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=L(r[e.dataKey]?.color||F),o=e.chartType||(t===0?`bar`:`line`),s=o===`bar`?`left`:`right`;return o===`line`?(0,i.jsx)(a.Line,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,stroke:n,strokeWidth:2,dot:!1},e.dataKey):o===`area`?(0,i.jsx)(a.Area,{yAxisId:s,type:`monotone`,dataKey:e.dataKey,fill:n,stroke:n,fillOpacity:.4},e.dataKey):(0,i.jsx)(a.Bar,{yAxisId:s,dataKey:e.dataKey,fill:n,radius:4},e.dataKey)})]})});let T=u===`horizontal-bar`;return(0,i.jsx)(S,{config:r,className:c,children:(0,i.jsxs)(v,{data:d,layout:T?`vertical`:`horizontal`,...g,children:[(0,i.jsx)(a.CartesianGrid,{vertical:!1}),T?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.XAxis,{type:`number`,tickLine:!1,axisLine:!1}),(0,i.jsx)(a.YAxis,{type:`category`,dataKey:o,tickLine:!1,axisLine:!1,width:Math.min(140,Math.max(60,Math.max(...d.map(e=>String(e[o]??``).length))*7)),tickFormatter:y})]}):(0,i.jsx)(a.XAxis,{dataKey:o,tickLine:!1,tickMargin:10,axisLine:!1,interval:f?Math.ceil(d.length/5):0,tickFormatter:y,...!f&&b&&{angle:-35,textAnchor:`end`,height:60}}),(0,i.jsx)(A,{content:(0,i.jsx)(C,{})}),(0,i.jsx)(j,{content:(0,i.jsx)(w,{}),...f&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),s.map((e,t)=>{let n=x(),o=L(r[e.dataKey]?.color||n[t%n.length]||F);if(u===`bar`||u===`horizontal-bar`){let t=s.length===1&&d.length>1;return(0,i.jsx)(a.Bar,{dataKey:e.dataKey,fill:o,radius:4,children:t&&d.map((e,t)=>(0,i.jsx)(a.Cell,{fill:L(n[t%n.length])},`cell-${t}`))},e.dataKey)}return u===`line`?(0,i.jsx)(a.Line,{type:`monotone`,dataKey:e.dataKey,stroke:o,strokeWidth:2,dot:!1},e.dataKey):u===`area`?(0,i.jsx)(a.Area,{type:`monotone`,dataKey:e.dataKey,fill:o,stroke:o,fillOpacity:.4},e.dataKey):null})]})})}var F,I,L,R=h((()=>{M(),F=`hsl(var(--primary))`,I={slate:`#64748b`,gray:`#6b7280`,zinc:`#71717a`,neutral:`#737373`,stone:`#78716c`,red:`#ef4444`,orange:`#f97316`,amber:`#f59e0b`,yellow:`#eab308`,lime:`#84cc16`,green:`#22c55e`,emerald:`#10b981`,teal:`#14b8a6`,cyan:`#06b6d4`,sky:`#0ea5e9`,blue:`#3b82f6`,indigo:`#6366f1`,violet:`#8b5cf6`,purple:`#a855f7`,fuchsia:`#d946ef`,pink:`#ec4899`,rose:`#f43f5e`},L=e=>I[e]||e})),z=n.default.lazy(()=>Promise.resolve().then(()=>(b(),v))),B=n.default.lazy(()=>Promise.resolve().then(()=>(R(),N))),V=({schema:e})=>(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(z,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),H=({schema:e,onChartClick:t})=>{let a=n.default.useMemo(()=>{let t=e.series,n=e.xAxisKey,r=e.config;if(n||(e.index?n=e.index:e.category&&(n=e.category)),t||(e.categories?t=e.categories.map(e=>({dataKey:e})):e.value&&(t=[{dataKey:e.value}])),!r&&t){let n=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],i={};t.forEach((e,t)=>{i[e.dataKey]={label:e.label||e.dataKey,color:n[t%n.length]}}),r=i}return{chartType:e.chartType,data:Array.isArray(e.data)?e.data:[],config:r,xAxisKey:n,series:t,className:e.className}},[e]);return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(r.Skeleton,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,i.jsx)(B,{chartType:a.chartType,data:a.data,config:a.config,xAxisKey:a.xAxisKey,series:a.series,className:a.className,onChartClick:t})})};function U(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function W(e,t){let{field:n,function:r,groupBy:i}=t,a={};for(let t of e){let e=String(t[i]??`Unknown`);a[e]||(a[e]=[]),a[e].push(t)}return Object.entries(a).map(([e,t])=>{let a=t.map(e=>Number(e[n])||0),o;switch(r){case`count`:o=t.length;break;case`avg`:o=a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0;break;case`min`:o=a.length>0?Math.min(...a):0;break;case`max`:o=a.length>0?Math.max(...a):0;break;default:o=a.reduce((e,t)=>e+t,0);break}return{[i]:e,[n]:o}})}async function G(e,n,r,i,a){if(!e.length||!n)return e;let o=a||((e,t)=>t),s=`__raw_${n}`,c=r?.fields?.[n];if(!c){let t=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[n],i=String(r??``),a=t.test(i)?i:U(i);return{...e,[n]:o(i,a),[s]:r}})}let l=c.type;if(l===`select`||l===`picklist`||l===`dropdown`){let t=c.options||[];if(t.length===0)return e.map(e=>{let t=e[n],r=String(t??``),i=U(r);return{...e,[n]:o(r,i),[s]:t}});let r={};for(let e of t)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let t=e[n],i=String(t??``),a=r[i]||U(i);return{...e,[n]:o(i,a),[s]:t}})}if(l===`lookup`||l===`master_detail`){let r=c.reference_to||c.reference;if(!r||!i||typeof i.find!=`function`)return e.map(e=>({...e,[s]:e[n]}));let a=[...new Set(e.map(e=>e[n]).filter(e=>e!=null))];if(a.length===0)return e.map(e=>({...e,[s]:e[n]}));let o=c.id_field||`id`;try{let l=(0,t.extractRecords)(await i.find(r,{$filter:{[o]:{$in:a}},$top:a.length})),u=c.reference_field||c.display_field||`name`,d={};for(let e of l){let t=String(e[o]??e.id??e._id??``),n=e[u]||e.name||e.label||e.title||t;t&&(d[t]=String(n))}return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:d[r]||r,[s]:t}})}catch(t){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,t),e.map(e=>({...e,[s]:e[n]}))}}if(l===`date`||l===`datetime`||l===`date_time`||l===`timestamp`||l===`time`)return e.map(e=>({...e,[s]:e[n]}));let u=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let t=e[n],r=String(t??``);return{...e,[n]:u.test(r)?r:U(r),[s]:t}})}var K=e=>{let{schema:a}=e,l=(0,n.useContext)(o.SchemaRendererContext),u=e.dataSource||l?.dataSource,d=(0,o.useDataScope)(a.bind),{fieldOptionLabel:f}=(0,c.useSafeFieldLabel)(),p=(0,n.useRef)(f);(0,n.useEffect)(()=>{p.current=f},[f]);let[m,h]=(0,n.useState)([]),[g,_]=(0,n.useState)(!1),[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(null),S=(0,n.useMemo)(()=>a.aggregate?JSON.stringify(a.aggregate):``,[a.aggregate]),C=(0,n.useMemo)(()=>a.filter?JSON.stringify(a.filter):``,[a.filter]),w=(0,n.useCallback)(async(e,n)=>{if(!(!e||!a.objectName)){n.current&&(_(!0),y(null));try{let r,i=(0,t.resolveDateMacros)(a.filter);if(a.aggregate&&typeof e.aggregate==`function`){let t=await e.aggregate(a.objectName,{field:a.aggregate.field,function:a.aggregate.function,groupBy:a.aggregate.groupBy,filter:i});r=Array.isArray(t)?t:[]}else if(typeof e.find==`function`)r=(0,t.extractRecords)(await e.find(a.objectName,{$filter:i})),a.aggregate&&r.length>0&&(r=W(r,a.aggregate));else return;let o=a.aggregate?.groupBy||a.xAxisKey;if(o&&typeof e.getObjectSchema==`function`)try{let t=await e.getObjectSchema(a.objectName);r=await G(r,o,t,e,(e,t)=>p.current(a.objectName,o,e,t))}catch{}n.current&&h(r)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&y(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&_(!1)}}},[a.objectName,S,C,a.xAxisKey]);(0,n.useEffect)(()=>{let e={current:!0};return a.objectName&&!d&&!a.data&&w(u,e),()=>{e.current=!1}},[a.objectName,u,d,a.data,C,S,w]);let T=d||a.data||m,E=Array.isArray(T)?T:[],D=a.drillDown,O=a.aggregate?.groupBy||a.xAxisKey,k=(0,n.useMemo)(()=>{if(!O)return new Map;let e=new Map,t=`__raw_${O}`;for(let n of E){let r=n?.[O];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[E,O]),A={...a,data:E};if(g&&E.length===0)return(0,i.jsx)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(a.className||``),"data-testid":`chart-loading`,children:`Loading chart data…`});if(v)return(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(a.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,i.jsx)(s.AlertCircle,{className:`h-6 w-6 text-destructive opacity-60`}),(0,i.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:v})]});if(!u&&a.objectName&&E.length===0)return(0,i.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(a.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,a.objectName,`”`]});let j=(0,t.isDrillEnabled)(D)?e=>{let t=e.category,n=t!=null&&k.has(String(t))?k.get(String(t)):t;x({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,M=b&&a.objectName?(()=>{let e=(0,t.computeDrillFilter)(D,b,{groupByField:O}),n={...a.filter||{},...e},s=(0,t.resolveDrillTitle)(D,b,a.title||`Details`),c=D?.target??`drawer`,l=(0,i.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,i.jsx)(o.SchemaRenderer,{schema:{type:`object-data-table`,objectName:a.objectName,filter:n,pagination:!0,pageSize:D?.maxRows,columns:D?.columns?.map(e=>({accessorKey:e,header:e}))},dataSource:u})});return c===`dialog`?(0,i.jsx)(r.Dialog,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,i.jsxs)(r.DialogContent,{className:`max-w-4xl`,children:[(0,i.jsx)(r.DialogHeader,{children:(0,i.jsx)(r.DialogTitle,{children:s})}),l]})}):(0,i.jsx)(r.Sheet,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,i.jsxs)(r.SheetContent,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,i.jsx)(r.SheetHeader,{children:(0,i.jsx)(r.SheetTitle,{children:s})}),(0,i.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:l})]})})})():null;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(H,{...e,schema:A,onChartClick:j}),M]})};t.ComponentRegistry.register(`object-chart`,K,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Optional static data`},{name:`filter`,type:`array`,label:`Filter`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`}]});var q={"bar-chart":V,chart:H};t.ComponentRegistry.register(`bar-chart`,V,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,label:`Data`,required:!0},{name:`dataKey`,type:`string`,label:`Data Key`,defaultValue:`value`},{name:`xAxisKey`,type:`string`,label:`X-Axis Key`,defaultValue:`name`},{name:`height`,type:`number`,label:`Height`,defaultValue:400},{name:`color`,type:`color`,label:`Color`,defaultValue:`#8884d8`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),t.ComponentRegistry.register(`chart`,K,{namespace:`view`,category:`view`,label:`Chart`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`type`,type:`string`,label:`Chart Type`},{name:`categoryField`,type:`string`,label:`Category Field`},{name:`valueField`,type:`string`,label:`Value Field`}]}),t.ComponentRegistry.register(`chart`,H,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,label:`Chart Type`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}],defaultValue:`bar`},{name:`data`,type:`code`,label:`Data (JSON)`,required:!0},{name:`config`,type:`code`,label:`Config (JSON)`},{name:`xAxisKey`,type:`string`,label:`X Axis Key`,defaultValue:`name`},{name:`series`,type:`code`,label:`Series (JSON Array)`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),t.ComponentRegistry.register(`chart:bar`,H,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`,defaultProps:{chartType:`bar`}}),t.ComponentRegistry.register(`pie-chart`,H,{namespace:`plugin-charts`,label:`Pie Chart`,category:`plugin`,defaultProps:{chartType:`pie`}}),t.ComponentRegistry.register(`donut-chart`,H,{namespace:`plugin-charts`,label:`Donut Chart`,category:`plugin`,defaultProps:{chartType:`donut`}}),t.ComponentRegistry.register(`radar-chart`,H,{namespace:`plugin-charts`,label:`Radar Chart`,category:`plugin`,defaultProps:{chartType:`radar`}}),t.ComponentRegistry.register(`scatter-chart`,H,{namespace:`plugin-charts`,label:`Scatter Chart`,category:`plugin`,defaultProps:{chartType:`scatter`}}),e.ChartBarRenderer=V,e.ChartRenderer=H,e.ObjectChart=K,e.chartComponents=q});
@@ -1,6 +1,6 @@
1
1
  import { ChartConfig } from './ChartContainerImpl';
2
2
  export interface AdvancedChartImplProps {
3
- chartType?: 'bar' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo';
3
+ chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo';
4
4
  data?: Array<Record<string, any>>;
5
5
  config?: ChartConfig;
6
6
  xAxisKey?: string;
@@ -24,4 +24,4 @@ export interface AdvancedChartImplProps {
24
24
  * AdvancedChartImpl - The heavy implementation that imports Recharts with full features
25
25
  * This component is lazy-loaded to avoid including Recharts in the initial bundle
26
26
  */
27
- export default function AdvancedChartImpl({ chartType, data: rawData, config, xAxisKey, series, className, onChartClick, }: AdvancedChartImplProps): import("react/jsx-runtime").JSX.Element;
27
+ export default function AdvancedChartImpl({ chartType: rawChartType, data: rawData, config, xAxisKey, series, className, onChartClick, }: AdvancedChartImplProps): import("react/jsx-runtime").JSX.Element;
@@ -20,7 +20,7 @@ export interface ChartRendererProps {
20
20
  type: string;
21
21
  id?: string;
22
22
  className?: string;
23
- chartType?: 'bar' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo';
23
+ chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo';
24
24
  data?: Array<Record<string, any>>;
25
25
  config?: Record<string, any>;
26
26
  xAxisKey?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-charts",
3
- "version": "4.0.11",
3
+ "version": "4.2.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Chart components plugin for Object UI, powered by Recharts",
@@ -24,13 +24,13 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "lucide-react": "^1.14.0",
27
+ "lucide-react": "^1.16.0",
28
28
  "recharts": "^3.8.1",
29
- "@object-ui/components": "4.0.11",
30
- "@object-ui/core": "4.0.11",
31
- "@object-ui/i18n": "4.0.11",
32
- "@object-ui/react": "4.0.11",
33
- "@object-ui/types": "4.0.11"
29
+ "@object-ui/components": "4.2.1",
30
+ "@object-ui/core": "4.2.1",
31
+ "@object-ui/i18n": "4.2.1",
32
+ "@object-ui/react": "4.2.1",
33
+ "@object-ui/types": "4.2.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^18.0.0 || ^19.0.0",
@@ -39,9 +39,9 @@
39
39
  "devDependencies": {
40
40
  "@types/react": "19.2.14",
41
41
  "@types/react-dom": "19.2.3",
42
- "@vitejs/plugin-react": "^6.0.1",
42
+ "@vitejs/plugin-react": "^6.0.2",
43
43
  "typescript": "^6.0.3",
44
- "vite": "^8.0.12",
44
+ "vite": "^8.0.13",
45
45
  "vite-plugin-dts": "^5.0.0"
46
46
  },
47
47
  "keywords": [