@object-ui/plugin-charts 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,49 +1,49 @@
1
- import { ComponentRegistry as m } from "@object-ui/core";
2
- import O, { Suspense as z, useState as L, useEffect as ce } from "react";
1
+ import { ComponentRegistry as h, extractRecords as ce } from "@object-ui/core";
2
+ import k, { Suspense as U, useContext as ie, useState as V, useEffect as ue } from "react";
3
3
  import { Skeleton as W } from "@object-ui/components";
4
- import { useSchemaContext as ie, useDataScope as ue } from "@object-ui/react";
5
- var j = { exports: {} }, E = {};
6
- var V;
7
- function fe() {
8
- if (V) return E;
9
- V = 1;
10
- var a = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
11
- function i(u, l, c) {
4
+ import { SchemaRendererContext as fe, useDataScope as de } from "@object-ui/react";
5
+ var S = { exports: {} }, A = {};
6
+ var J;
7
+ function me() {
8
+ if (J) return A;
9
+ J = 1;
10
+ var a = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
11
+ function u(s, n, l) {
12
12
  var d = null;
13
- if (c !== void 0 && (d = "" + c), l.key !== void 0 && (d = "" + l.key), "key" in l) {
14
- c = {};
15
- for (var p in l)
16
- p !== "key" && (c[p] = l[p]);
17
- } else c = l;
18
- return l = c.ref, {
13
+ if (l !== void 0 && (d = "" + l), n.key !== void 0 && (d = "" + n.key), "key" in n) {
14
+ l = {};
15
+ for (var f in n)
16
+ f !== "key" && (l[f] = n[f]);
17
+ } else l = n;
18
+ return n = l.ref, {
19
19
  $$typeof: a,
20
- type: u,
20
+ type: s,
21
21
  key: d,
22
- ref: l !== void 0 ? l : null,
23
- props: c
22
+ ref: n !== void 0 ? n : null,
23
+ props: l
24
24
  };
25
25
  }
26
- return E.Fragment = t, E.jsx = i, E.jsxs = i, E;
26
+ return A.Fragment = r, A.jsx = u, A.jsxs = u, A;
27
27
  }
28
- var R = {};
29
- var J;
30
- function de() {
31
- return J || (J = 1, process.env.NODE_ENV !== "production" && (function() {
28
+ var j = {};
29
+ var q;
30
+ function ge() {
31
+ return q || (q = 1, process.env.NODE_ENV !== "production" && (function() {
32
32
  function a(e) {
33
33
  if (e == null) return null;
34
34
  if (typeof e == "function")
35
35
  return e.$$typeof === le ? null : e.displayName || e.name || null;
36
36
  if (typeof e == "string") return e;
37
37
  switch (e) {
38
- case C:
38
+ case O:
39
39
  return "Fragment";
40
40
  case H:
41
41
  return "Profiler";
42
42
  case G:
43
43
  return "StrictMode";
44
- case re:
45
- return "Suspense";
46
44
  case ae:
45
+ return "Suspense";
46
+ case re:
47
47
  return "SuspenseList";
48
48
  case ne:
49
49
  return "Activity";
@@ -52,100 +52,100 @@ function de() {
52
52
  switch (typeof e.tag == "number" && console.error(
53
53
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
54
54
  ), e.$$typeof) {
55
- case B:
55
+ case R:
56
56
  return "Portal";
57
57
  case Q:
58
58
  return e.displayName || "Context";
59
59
  case Z:
60
60
  return (e._context.displayName || "Context") + ".Consumer";
61
61
  case ee:
62
- var r = e.render;
63
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
+ var t = e.render;
63
+ return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
64
64
  case te:
65
- return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
66
- case k:
67
- r = e._payload, e = e._init;
65
+ return t = e.displayName || null, t !== null ? t : a(e.type) || "Memo";
66
+ case C:
67
+ t = e._payload, e = e._init;
68
68
  try {
69
- return a(e(r));
69
+ return a(e(t));
70
70
  } catch {
71
71
  }
72
72
  }
73
73
  return null;
74
74
  }
75
- function t(e) {
75
+ function r(e) {
76
76
  return "" + e;
77
77
  }
78
- function i(e) {
78
+ function u(e) {
79
79
  try {
80
- t(e);
81
- var r = !1;
80
+ r(e);
81
+ var t = !1;
82
82
  } catch {
83
- r = !0;
83
+ t = !0;
84
84
  }
85
- if (r) {
86
- r = console;
87
- var n = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
88
- return n.call(
89
- r,
85
+ if (t) {
86
+ t = console;
87
+ var o = t.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
88
+ return o.call(
89
+ t,
90
90
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
91
- o
92
- ), t(e);
91
+ c
92
+ ), r(e);
93
93
  }
94
94
  }
95
- function u(e) {
96
- if (e === C) return "<>";
97
- if (typeof e == "object" && e !== null && e.$$typeof === k)
95
+ function s(e) {
96
+ if (e === O) return "<>";
97
+ if (typeof e == "object" && e !== null && e.$$typeof === C)
98
98
  return "<...>";
99
99
  try {
100
- var r = a(e);
101
- return r ? "<" + r + ">" : "<...>";
100
+ var t = a(e);
101
+ return t ? "<" + t + ">" : "<...>";
102
102
  } catch {
103
103
  return "<...>";
104
104
  }
105
105
  }
106
- function l() {
107
- var e = N.A;
106
+ function n() {
107
+ var e = w.A;
108
108
  return e === null ? null : e.getOwner();
109
109
  }
110
- function c() {
110
+ function l() {
111
111
  return Error("react-stack-top-frame");
112
112
  }
113
113
  function d(e) {
114
- if (F.call(e, "key")) {
115
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
116
- if (r && r.isReactWarning) return !1;
114
+ if (K.call(e, "key")) {
115
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
116
+ if (t && t.isReactWarning) return !1;
117
117
  }
118
118
  return e.key !== void 0;
119
119
  }
120
- function p(e, r) {
121
- function n() {
122
- K || (K = !0, console.error(
120
+ function f(e, t) {
121
+ function o() {
122
+ Y || (Y = !0, console.error(
123
123
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
124
- r
124
+ t
125
125
  ));
126
126
  }
127
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
128
- get: n,
127
+ o.isReactWarning = !0, Object.defineProperty(e, "key", {
128
+ get: o,
129
129
  configurable: !0
130
130
  });
131
131
  }
132
- function h() {
132
+ function m() {
133
133
  var e = a(this.type);
134
- return Y[e] || (Y[e] = !0, console.error(
134
+ return M[e] || (M[e] = !0, console.error(
135
135
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
136
136
  )), e = this.props.ref, e !== void 0 ? e : null;
137
137
  }
138
- function T(e, r, n, o, S, w) {
139
- var s = n.ref;
138
+ function p(e, t, o, c, N, D) {
139
+ var i = o.ref;
140
140
  return e = {
141
- $$typeof: v,
141
+ $$typeof: b,
142
142
  type: e,
143
- key: r,
144
- props: n,
145
- _owner: o
146
- }, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
143
+ key: t,
144
+ props: o,
145
+ _owner: c
146
+ }, (i !== void 0 ? i : null) !== null ? Object.defineProperty(e, "ref", {
147
147
  enumerable: !1,
148
- get: h
148
+ get: m
149
149
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
150
150
  configurable: !1,
151
151
  enumerable: !1,
@@ -160,110 +160,110 @@ function de() {
160
160
  configurable: !1,
161
161
  enumerable: !1,
162
162
  writable: !0,
163
- value: S
163
+ value: N
164
164
  }), Object.defineProperty(e, "_debugTask", {
165
165
  configurable: !1,
166
166
  enumerable: !1,
167
167
  writable: !0,
168
- value: w
168
+ value: D
169
169
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
170
170
  }
171
- function x(e, r, n, o, S, w) {
172
- var s = r.children;
173
- if (s !== void 0)
174
- if (o)
175
- if (oe(s)) {
176
- for (o = 0; o < s.length; o++)
177
- y(s[o]);
178
- Object.freeze && Object.freeze(s);
171
+ function g(e, t, o, c, N, D) {
172
+ var i = t.children;
173
+ if (i !== void 0)
174
+ if (c)
175
+ if (oe(i)) {
176
+ for (c = 0; c < i.length; c++)
177
+ v(i[c]);
178
+ Object.freeze && Object.freeze(i);
179
179
  } else
180
180
  console.error(
181
181
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
182
182
  );
183
- else y(s);
184
- if (F.call(r, "key")) {
185
- s = a(e);
186
- var _ = Object.keys(r).filter(function(se) {
183
+ else v(i);
184
+ if (K.call(t, "key")) {
185
+ i = a(e);
186
+ var T = Object.keys(t).filter(function(se) {
187
187
  return se !== "key";
188
188
  });
189
- o = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", I[s + o] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
189
+ c = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", I[i + c] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
190
190
  `A props object containing a "key" prop is being spread into JSX:
191
191
  let props = %s;
192
192
  <%s {...props} />
193
193
  React keys must be passed directly to JSX without using spread:
194
194
  let props = %s;
195
195
  <%s key={someKey} {...props} />`,
196
- o,
197
- s,
198
- _,
199
- s
200
- ), I[s + o] = !0);
196
+ c,
197
+ i,
198
+ T,
199
+ i
200
+ ), I[i + c] = !0);
201
201
  }
202
- if (s = null, n !== void 0 && (i(n), s = "" + n), d(r) && (i(r.key), s = "" + r.key), "key" in r) {
203
- n = {};
204
- for (var D in r)
205
- D !== "key" && (n[D] = r[D]);
206
- } else n = r;
207
- return s && p(
208
- n,
202
+ if (i = null, o !== void 0 && (u(o), i = "" + o), d(t) && (u(t.key), i = "" + t.key), "key" in t) {
203
+ o = {};
204
+ for (var F in t)
205
+ F !== "key" && (o[F] = t[F]);
206
+ } else o = t;
207
+ return i && f(
208
+ o,
209
209
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
210
- ), T(
210
+ ), p(
211
211
  e,
212
- s,
213
- n,
214
- l(),
215
- S,
216
- w
212
+ i,
213
+ o,
214
+ n(),
215
+ N,
216
+ D
217
217
  );
218
218
  }
219
- function y(e) {
220
- A(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? A(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
219
+ function v(e) {
220
+ _(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === C && (e._payload.status === "fulfilled" ? _(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
221
221
  }
222
- function A(e) {
223
- return typeof e == "object" && e !== null && e.$$typeof === v;
222
+ function _(e) {
223
+ return typeof e == "object" && e !== null && e.$$typeof === b;
224
224
  }
225
- var f = O, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), B = /* @__PURE__ */ Symbol.for("react.portal"), C = /* @__PURE__ */ Symbol.for("react.fragment"), G = /* @__PURE__ */ Symbol.for("react.strict_mode"), H = /* @__PURE__ */ Symbol.for("react.profiler"), Z = /* @__PURE__ */ Symbol.for("react.consumer"), Q = /* @__PURE__ */ Symbol.for("react.context"), ee = /* @__PURE__ */ Symbol.for("react.forward_ref"), re = /* @__PURE__ */ Symbol.for("react.suspense"), ae = /* @__PURE__ */ Symbol.for("react.suspense_list"), te = /* @__PURE__ */ Symbol.for("react.memo"), k = /* @__PURE__ */ Symbol.for("react.lazy"), ne = /* @__PURE__ */ Symbol.for("react.activity"), le = /* @__PURE__ */ Symbol.for("react.client.reference"), N = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, oe = Array.isArray, P = console.createTask ? console.createTask : function() {
225
+ var E = k, b = /* @__PURE__ */ Symbol.for("react.transitional.element"), R = /* @__PURE__ */ Symbol.for("react.portal"), O = /* @__PURE__ */ Symbol.for("react.fragment"), G = /* @__PURE__ */ Symbol.for("react.strict_mode"), H = /* @__PURE__ */ Symbol.for("react.profiler"), Z = /* @__PURE__ */ Symbol.for("react.consumer"), Q = /* @__PURE__ */ Symbol.for("react.context"), ee = /* @__PURE__ */ Symbol.for("react.forward_ref"), ae = /* @__PURE__ */ Symbol.for("react.suspense"), re = /* @__PURE__ */ Symbol.for("react.suspense_list"), te = /* @__PURE__ */ Symbol.for("react.memo"), C = /* @__PURE__ */ Symbol.for("react.lazy"), ne = /* @__PURE__ */ Symbol.for("react.activity"), le = /* @__PURE__ */ Symbol.for("react.client.reference"), w = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, oe = Array.isArray, P = console.createTask ? console.createTask : function() {
226
226
  return null;
227
227
  };
228
- f = {
228
+ E = {
229
229
  react_stack_bottom_frame: function(e) {
230
230
  return e();
231
231
  }
232
232
  };
233
- var K, Y = {}, M = f.react_stack_bottom_frame.bind(
234
- f,
235
- c
236
- )(), $ = P(u(c)), I = {};
237
- R.Fragment = C, R.jsx = function(e, r, n) {
238
- var o = 1e4 > N.recentlyCreatedOwnerStacks++;
239
- return x(
233
+ var Y, M = {}, L = E.react_stack_bottom_frame.bind(
234
+ E,
235
+ l
236
+ )(), $ = P(s(l)), I = {};
237
+ j.Fragment = O, j.jsx = function(e, t, o) {
238
+ var c = 1e4 > w.recentlyCreatedOwnerStacks++;
239
+ return g(
240
240
  e,
241
- r,
242
- n,
241
+ t,
242
+ o,
243
243
  !1,
244
- o ? Error("react-stack-top-frame") : M,
245
- o ? P(u(e)) : $
244
+ c ? Error("react-stack-top-frame") : L,
245
+ c ? P(s(e)) : $
246
246
  );
247
- }, R.jsxs = function(e, r, n) {
248
- var o = 1e4 > N.recentlyCreatedOwnerStacks++;
249
- return x(
247
+ }, j.jsxs = function(e, t, o) {
248
+ var c = 1e4 > w.recentlyCreatedOwnerStacks++;
249
+ return g(
250
250
  e,
251
- r,
252
- n,
251
+ t,
252
+ o,
253
253
  !0,
254
- o ? Error("react-stack-top-frame") : M,
255
- o ? P(u(e)) : $
254
+ c ? Error("react-stack-top-frame") : L,
255
+ c ? P(s(e)) : $
256
256
  );
257
257
  };
258
- })()), R;
258
+ })()), j;
259
259
  }
260
- var q;
260
+ var z;
261
261
  function pe() {
262
- return q || (q = 1, process.env.NODE_ENV === "production" ? j.exports = fe() : j.exports = de()), j.exports;
262
+ return z || (z = 1, process.env.NODE_ENV === "production" ? S.exports = me() : S.exports = ge()), S.exports;
263
263
  }
264
- var g = pe();
265
- const me = O.lazy(() => import("./ChartImpl-C-IeuOgj.js")), be = O.lazy(() => import("./AdvancedChartImpl-BPJDgZhN.js")), U = ({ schema: a }) => /* @__PURE__ */ g.jsx(z, { fallback: /* @__PURE__ */ g.jsx(W, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }), children: /* @__PURE__ */ g.jsx(
266
- me,
264
+ var y = pe();
265
+ const be = k.lazy(() => import("./ChartImpl-WXTkPN08.js")), ye = k.lazy(() => import("./AdvancedChartImpl-D5NQFQLZ.js")), B = ({ schema: a }) => /* @__PURE__ */ y.jsx(U, { fallback: /* @__PURE__ */ y.jsx(W, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }), children: /* @__PURE__ */ y.jsx(
266
+ be,
267
267
  {
268
268
  data: a.data,
269
269
  dataKey: a.dataKey,
@@ -272,82 +272,129 @@ const me = O.lazy(() => import("./ChartImpl-C-IeuOgj.js")), be = O.lazy(() => im
272
272
  className: a.className,
273
273
  color: a.color
274
274
  }
275
- ) }), b = ({ schema: a }) => {
276
- const t = O.useMemo(() => {
277
- let i = a.series, u = a.xAxisKey, l = a.config;
278
- if (u || (a.index ? u = a.index : a.category && (u = a.category)), i || (a.categories ? i = a.categories.map((c) => ({ dataKey: c })) : a.value && (i = [{ dataKey: a.value }])), !l && i) {
279
- const c = a.colors || ["hsl(var(--chart-1))", "hsl(var(--chart-2))", "hsl(var(--chart-3))"], d = {};
280
- i.forEach((p, h) => {
281
- d[p.dataKey] = { label: p.dataKey, color: c[h % c.length] };
282
- }), l = d;
275
+ ) }), x = ({ schema: a }) => {
276
+ const r = k.useMemo(() => {
277
+ let u = a.series, s = a.xAxisKey, n = a.config;
278
+ if (s || (a.index ? s = a.index : a.category && (s = a.category)), u || (a.categories ? u = a.categories.map((l) => ({ dataKey: l })) : a.value && (u = [{ dataKey: a.value }])), !n && u) {
279
+ const l = a.colors || ["hsl(var(--chart-1))", "hsl(var(--chart-2))", "hsl(var(--chart-3))"], d = {};
280
+ u.forEach((f, m) => {
281
+ d[f.dataKey] = { label: f.dataKey, color: l[m % l.length] };
282
+ }), n = d;
283
283
  }
284
284
  return {
285
285
  chartType: a.chartType,
286
- data: a.data,
287
- config: l,
288
- xAxisKey: u,
289
- series: i,
286
+ data: Array.isArray(a.data) ? a.data : [],
287
+ config: n,
288
+ xAxisKey: s,
289
+ series: u,
290
290
  className: a.className
291
291
  };
292
292
  }, [a]);
293
- return /* @__PURE__ */ g.jsx(z, { fallback: /* @__PURE__ */ g.jsx(W, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }), children: /* @__PURE__ */ g.jsx(
294
- be,
293
+ return /* @__PURE__ */ y.jsx(U, { fallback: /* @__PURE__ */ y.jsx(W, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }), children: /* @__PURE__ */ y.jsx(
294
+ ye,
295
295
  {
296
- chartType: t.chartType,
297
- data: t.data,
298
- config: t.config,
299
- xAxisKey: t.xAxisKey,
300
- series: t.series,
301
- className: t.className
296
+ chartType: r.chartType,
297
+ data: r.data,
298
+ config: r.config,
299
+ xAxisKey: r.xAxisKey,
300
+ series: r.series,
301
+ className: r.className
302
302
  }
303
303
  ) });
304
- }, X = (a) => {
305
- const { schema: t } = a, i = ie(), u = a.dataSource || i.dataSource, l = ue(t.bind), [c, d] = L([]), [p, h] = L(!1);
306
- ce(() => {
307
- let y = !0;
308
- const A = async () => {
309
- if (!(!u || !t.objectName)) {
310
- y && h(!0);
304
+ };
305
+ function he(a, r) {
306
+ const { field: u, function: s, groupBy: n } = r, l = {};
307
+ for (const d of a) {
308
+ const f = String(d[n] ?? "Unknown");
309
+ l[f] || (l[f] = []), l[f].push(d);
310
+ }
311
+ return Object.entries(l).map(([d, f]) => {
312
+ const m = f.map((g) => Number(g[u]) || 0);
313
+ let p;
314
+ switch (s) {
315
+ case "count":
316
+ p = f.length;
317
+ break;
318
+ case "avg":
319
+ p = m.length > 0 ? m.reduce((g, v) => g + v, 0) / m.length : 0;
320
+ break;
321
+ case "min":
322
+ p = m.length > 0 ? Math.min(...m) : 0;
323
+ break;
324
+ case "max":
325
+ p = m.length > 0 ? Math.max(...m) : 0;
326
+ break;
327
+ default:
328
+ p = m.reduce((g, v) => g + v, 0);
329
+ break;
330
+ }
331
+ return { [n]: d, [u]: p };
332
+ });
333
+ }
334
+ const X = (a) => {
335
+ const { schema: r } = a, u = ie(fe), s = a.dataSource || u?.dataSource, n = de(r.bind), [l, d] = V([]), [f, m] = V(!1);
336
+ ue(() => {
337
+ let _ = !0;
338
+ const E = async () => {
339
+ if (!(!s || !r.objectName)) {
340
+ _ && m(!0);
311
341
  try {
312
- const f = await u.find(t.objectName, {
313
- $filter: t.filter
314
- });
315
- let v = [];
316
- Array.isArray(f) ? v = f : f && typeof f == "object" && Array.isArray(f.records) && (v = f.records), y && d(v);
317
- } catch (f) {
318
- console.error("[ObjectChart] Fetch error:", f);
342
+ let b;
343
+ if (r.aggregate && typeof s.aggregate == "function") {
344
+ const R = await s.aggregate(r.objectName, {
345
+ field: r.aggregate.field,
346
+ function: r.aggregate.function,
347
+ groupBy: r.aggregate.groupBy,
348
+ filter: r.filter
349
+ });
350
+ b = Array.isArray(R) ? R : [];
351
+ } else if (typeof s.find == "function") {
352
+ const R = await s.find(r.objectName, {
353
+ $filter: r.filter
354
+ });
355
+ b = ce(R), r.aggregate && b.length > 0 && (b = he(b, r.aggregate));
356
+ } else
357
+ return;
358
+ _ && d(b);
359
+ } catch (b) {
360
+ console.error("[ObjectChart] Fetch error:", b);
319
361
  } finally {
320
- y && h(!1);
362
+ _ && m(!1);
321
363
  }
322
364
  }
323
365
  };
324
- return t.objectName && !l && !t.data && A(), () => {
325
- y = !1;
366
+ return r.objectName && !n && !r.data && E(), () => {
367
+ _ = !1;
326
368
  };
327
- }, [t.objectName, u, l, t.data, t.filter]);
328
- const T = l || t.data || c || [], x = {
329
- ...t,
330
- data: T
369
+ }, [r.objectName, s, n, r.data, r.filter, r.aggregate]);
370
+ const p = n || r.data || l, g = Array.isArray(p) ? p : [], v = {
371
+ ...r,
372
+ data: g
331
373
  };
332
- return p && T.length, /* @__PURE__ */ g.jsx(b, { ...a, schema: x });
374
+ return f && g.length === 0 ? /* @__PURE__ */ y.jsx("div", { className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (r.className || ""), children: "Loading chart data…" }) : !s && r.objectName && g.length === 0 ? /* @__PURE__ */ y.jsxs("div", { className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (r.className || ""), children: [
375
+ 'No data source available for "',
376
+ r.objectName,
377
+ '"'
378
+ ] }) : /* @__PURE__ */ y.jsx(x, { ...a, schema: v });
333
379
  };
334
- m.register("object-chart", X, {
380
+ h.register("object-chart", X, {
335
381
  namespace: "plugin-charts",
336
382
  label: "Object Chart",
337
383
  category: "view",
338
384
  inputs: [
339
385
  { name: "objectName", type: "string", label: "Object Name", required: !0 },
340
386
  { name: "data", type: "array", label: "Data", description: "Optional static data" },
341
- { name: "filter", type: "array", label: "Filter" }
387
+ { name: "filter", type: "array", label: "Filter" },
388
+ { name: "aggregate", type: "object", label: "Aggregate", description: "Aggregation config: { field, function, groupBy }" }
342
389
  ]
343
390
  });
344
- const _e = {
345
- "bar-chart": U,
346
- chart: b
391
+ const Re = {
392
+ "bar-chart": B,
393
+ chart: x
347
394
  };
348
- m.register(
395
+ h.register(
349
396
  "bar-chart",
350
- U,
397
+ B,
351
398
  {
352
399
  namespace: "plugin-charts",
353
400
  label: "Bar Chart",
@@ -374,7 +421,7 @@ m.register(
374
421
  }
375
422
  }
376
423
  );
377
- m.register("chart", X, {
424
+ h.register("chart", X, {
378
425
  namespace: "view",
379
426
  category: "view",
380
427
  label: "Chart",
@@ -385,9 +432,9 @@ m.register("chart", X, {
385
432
  { name: "valueField", type: "string", label: "Value Field" }
386
433
  ]
387
434
  });
388
- m.register(
435
+ h.register(
389
436
  "chart",
390
- b,
437
+ x,
391
438
  {
392
439
  namespace: "plugin-charts",
393
440
  label: "Chart",
@@ -435,9 +482,9 @@ m.register(
435
482
  }
436
483
  }
437
484
  );
438
- m.register(
485
+ h.register(
439
486
  "chart:bar",
440
- b,
487
+ x,
441
488
  {
442
489
  namespace: "plugin-charts",
443
490
  label: "Bar Chart (Alias)",
@@ -445,9 +492,9 @@ m.register(
445
492
  defaultProps: { chartType: "bar" }
446
493
  }
447
494
  );
448
- m.register(
495
+ h.register(
449
496
  "pie-chart",
450
- b,
497
+ x,
451
498
  {
452
499
  namespace: "plugin-charts",
453
500
  label: "Pie Chart",
@@ -455,9 +502,9 @@ m.register(
455
502
  defaultProps: { chartType: "pie" }
456
503
  }
457
504
  );
458
- m.register(
505
+ h.register(
459
506
  "donut-chart",
460
- b,
507
+ x,
461
508
  {
462
509
  namespace: "plugin-charts",
463
510
  label: "Donut Chart",
@@ -465,9 +512,9 @@ m.register(
465
512
  defaultProps: { chartType: "donut" }
466
513
  }
467
514
  );
468
- m.register(
515
+ h.register(
469
516
  "radar-chart",
470
- b,
517
+ x,
471
518
  {
472
519
  namespace: "plugin-charts",
473
520
  label: "Radar Chart",
@@ -475,9 +522,9 @@ m.register(
475
522
  defaultProps: { chartType: "radar" }
476
523
  }
477
524
  );
478
- m.register(
525
+ h.register(
479
526
  "scatter-chart",
480
- b,
527
+ x,
481
528
  {
482
529
  namespace: "plugin-charts",
483
530
  label: "Scatter Chart",
@@ -486,9 +533,9 @@ m.register(
486
533
  }
487
534
  );
488
535
  export {
489
- U as C,
536
+ B as C,
490
537
  X as O,
491
- b as a,
492
- _e as c,
493
- g as j
538
+ x as a,
539
+ Re as c,
540
+ y as j
494
541
  };