@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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +9 -0
- package/dist/{AdvancedChartImpl-BPJDgZhN.js → AdvancedChartImpl-D5NQFQLZ.js} +948 -920
- package/dist/{ChartImpl-C-IeuOgj.js → ChartImpl-WXTkPN08.js} +1 -1
- package/dist/{index-B49zCCfG.js → index-xUWSanB8.js} +249 -202
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +21 -21
- package/dist/src/AdvancedChartImpl.d.ts +3 -2
- package/dist/src/ChartRenderer.d.ts +1 -1
- package/dist/src/ObjectChart.d.ts +11 -0
- package/package.json +6 -6
- package/src/AdvancedChartImpl.tsx +44 -3
- package/src/ChartRenderer.tsx +2 -2
- package/src/ObjectChart.tsx +87 -21
- package/src/__tests__/ObjectChart.aggregation.test.ts +166 -0
- package/src/__tests__/ObjectChart.dataFetch.test.tsx +303 -0
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ComponentRegistry as
|
|
2
|
-
import
|
|
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 {
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
var a = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
11
|
-
function
|
|
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 (
|
|
14
|
-
|
|
15
|
-
for (var
|
|
16
|
-
|
|
17
|
-
} else
|
|
18
|
-
return
|
|
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:
|
|
20
|
+
type: s,
|
|
21
21
|
key: d,
|
|
22
|
-
ref:
|
|
23
|
-
props:
|
|
22
|
+
ref: n !== void 0 ? n : null,
|
|
23
|
+
props: l
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return A.Fragment = r, A.jsx = u, A.jsxs = u, A;
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
return
|
|
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
|
|
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
|
|
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
|
|
63
|
-
return e = e.displayName, e || (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
|
|
66
|
-
case
|
|
67
|
-
|
|
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(
|
|
69
|
+
return a(e(t));
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function r(e) {
|
|
76
76
|
return "" + e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function u(e) {
|
|
79
79
|
try {
|
|
80
|
-
|
|
81
|
-
var
|
|
80
|
+
r(e);
|
|
81
|
+
var t = !1;
|
|
82
82
|
} catch {
|
|
83
|
-
|
|
83
|
+
t = !0;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
var
|
|
88
|
-
return
|
|
89
|
-
|
|
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
|
-
|
|
92
|
-
),
|
|
91
|
+
c
|
|
92
|
+
), r(e);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
if (e ===
|
|
97
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
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
|
|
101
|
-
return
|
|
100
|
+
var t = a(e);
|
|
101
|
+
return t ? "<" + t + ">" : "<...>";
|
|
102
102
|
} catch {
|
|
103
103
|
return "<...>";
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
var e =
|
|
106
|
+
function n() {
|
|
107
|
+
var e = w.A;
|
|
108
108
|
return e === null ? null : e.getOwner();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function l() {
|
|
111
111
|
return Error("react-stack-top-frame");
|
|
112
112
|
}
|
|
113
113
|
function d(e) {
|
|
114
|
-
if (
|
|
115
|
-
var
|
|
116
|
-
if (
|
|
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
|
|
121
|
-
function
|
|
122
|
-
|
|
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
|
-
|
|
124
|
+
t
|
|
125
125
|
));
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
get:
|
|
127
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
128
|
+
get: o,
|
|
129
129
|
configurable: !0
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function m() {
|
|
133
133
|
var e = a(this.type);
|
|
134
|
-
return
|
|
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
|
|
139
|
-
var
|
|
138
|
+
function p(e, t, o, c, N, D) {
|
|
139
|
+
var i = o.ref;
|
|
140
140
|
return e = {
|
|
141
|
-
$$typeof:
|
|
141
|
+
$$typeof: b,
|
|
142
142
|
type: e,
|
|
143
|
-
key:
|
|
144
|
-
props:
|
|
145
|
-
_owner:
|
|
146
|
-
}, (
|
|
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:
|
|
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:
|
|
163
|
+
value: N
|
|
164
164
|
}), Object.defineProperty(e, "_debugTask", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
167
167
|
writable: !0,
|
|
168
|
-
value:
|
|
168
|
+
value: D
|
|
169
169
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
174
|
-
if (
|
|
175
|
-
if (oe(
|
|
176
|
-
for (
|
|
177
|
-
|
|
178
|
-
Object.freeze && Object.freeze(
|
|
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
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
var
|
|
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
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
), I[
|
|
196
|
+
c,
|
|
197
|
+
i,
|
|
198
|
+
T,
|
|
199
|
+
i
|
|
200
|
+
), I[i + c] = !0);
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
for (var
|
|
205
|
-
|
|
206
|
-
} else
|
|
207
|
-
return
|
|
208
|
-
|
|
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
|
-
),
|
|
210
|
+
), p(
|
|
211
211
|
e,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
i,
|
|
213
|
+
o,
|
|
214
|
+
n(),
|
|
215
|
+
N,
|
|
216
|
+
D
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
|
|
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
|
|
223
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
222
|
+
function _(e) {
|
|
223
|
+
return typeof e == "object" && e !== null && e.$$typeof === b;
|
|
224
224
|
}
|
|
225
|
-
var
|
|
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
|
-
|
|
228
|
+
E = {
|
|
229
229
|
react_stack_bottom_frame: function(e) {
|
|
230
230
|
return e();
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)(), $ = P(
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
return
|
|
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
|
-
|
|
242
|
-
|
|
241
|
+
t,
|
|
242
|
+
o,
|
|
243
243
|
!1,
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
c ? Error("react-stack-top-frame") : L,
|
|
245
|
+
c ? P(s(e)) : $
|
|
246
246
|
);
|
|
247
|
-
},
|
|
248
|
-
var
|
|
249
|
-
return
|
|
247
|
+
}, j.jsxs = function(e, t, o) {
|
|
248
|
+
var c = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
249
|
+
return g(
|
|
250
250
|
e,
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
t,
|
|
252
|
+
o,
|
|
253
253
|
!0,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
c ? Error("react-stack-top-frame") : L,
|
|
255
|
+
c ? P(s(e)) : $
|
|
256
256
|
);
|
|
257
257
|
};
|
|
258
|
-
})()),
|
|
258
|
+
})()), j;
|
|
259
259
|
}
|
|
260
|
-
var
|
|
260
|
+
var z;
|
|
261
261
|
function pe() {
|
|
262
|
-
return
|
|
262
|
+
return z || (z = 1, process.env.NODE_ENV === "production" ? S.exports = me() : S.exports = ge()), S.exports;
|
|
263
263
|
}
|
|
264
|
-
var
|
|
265
|
-
const
|
|
266
|
-
|
|
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
|
-
) }),
|
|
276
|
-
const
|
|
277
|
-
let
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
d[
|
|
282
|
-
}),
|
|
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:
|
|
288
|
-
xAxisKey:
|
|
289
|
-
series:
|
|
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__ */
|
|
294
|
-
|
|
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:
|
|
297
|
-
data:
|
|
298
|
-
config:
|
|
299
|
-
xAxisKey:
|
|
300
|
-
series:
|
|
301
|
-
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
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
-
|
|
362
|
+
_ && m(!1);
|
|
321
363
|
}
|
|
322
364
|
}
|
|
323
365
|
};
|
|
324
|
-
return
|
|
325
|
-
|
|
366
|
+
return r.objectName && !n && !r.data && E(), () => {
|
|
367
|
+
_ = !1;
|
|
326
368
|
};
|
|
327
|
-
}, [
|
|
328
|
-
const
|
|
329
|
-
...
|
|
330
|
-
data:
|
|
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
|
|
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
|
-
|
|
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
|
|
345
|
-
"bar-chart":
|
|
346
|
-
chart:
|
|
391
|
+
const Re = {
|
|
392
|
+
"bar-chart": B,
|
|
393
|
+
chart: x
|
|
347
394
|
};
|
|
348
|
-
|
|
395
|
+
h.register(
|
|
349
396
|
"bar-chart",
|
|
350
|
-
|
|
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
|
-
|
|
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
|
-
|
|
435
|
+
h.register(
|
|
389
436
|
"chart",
|
|
390
|
-
|
|
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
|
-
|
|
485
|
+
h.register(
|
|
439
486
|
"chart:bar",
|
|
440
|
-
|
|
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
|
-
|
|
495
|
+
h.register(
|
|
449
496
|
"pie-chart",
|
|
450
|
-
|
|
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
|
-
|
|
505
|
+
h.register(
|
|
459
506
|
"donut-chart",
|
|
460
|
-
|
|
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
|
-
|
|
515
|
+
h.register(
|
|
469
516
|
"radar-chart",
|
|
470
|
-
|
|
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
|
-
|
|
525
|
+
h.register(
|
|
479
526
|
"scatter-chart",
|
|
480
|
-
|
|
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
|
-
|
|
536
|
+
B as C,
|
|
490
537
|
X as O,
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
538
|
+
x as a,
|
|
539
|
+
Re as c,
|
|
540
|
+
y as j
|
|
494
541
|
};
|