@object-ui/plugin-charts 3.1.2 → 3.1.4
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 +18 -12
- package/CHANGELOG.md +18 -0
- package/dist/AdvancedChartImpl-DmHTUUVD.js +3973 -0
- package/dist/BarChart-XZkfLmcU.js +16499 -0
- package/dist/ChartImpl-0VlpsMWG.js +134 -0
- package/dist/index.js +408 -7
- package/dist/index.umd.cjs +46 -46
- package/dist/jsx-runtime-C8d0IhUE.js +198 -0
- package/dist/src/ChartContainerImpl.d.ts +2 -2
- package/package.json +8 -8
- package/dist/AdvancedChartImpl-D5NQFQLZ.js +0 -4588
- package/dist/BarChart-C_I0OFbj.js +0 -18488
- package/dist/ChartImpl-WXTkPN08.js +0 -79
- package/dist/index-xUWSanB8.js +0 -541
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { j as r } from "./index-xUWSanB8.js";
|
|
2
|
-
import { R as l, B as n, C as d, X as f, Y as p, T as x, L as u, a as c } from "./BarChart-C_I0OFbj.js";
|
|
3
|
-
function j({
|
|
4
|
-
data: e = [],
|
|
5
|
-
dataKey: s = "value",
|
|
6
|
-
xAxisKey: a = "name",
|
|
7
|
-
height: t = 400,
|
|
8
|
-
className: i = "",
|
|
9
|
-
// Default to standard primary color
|
|
10
|
-
color: o = "hsl(var(--primary))"
|
|
11
|
-
}) {
|
|
12
|
-
return /* @__PURE__ */ r.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 ${i}`, children: /* @__PURE__ */ r.jsx(l, { width: "100%", height: t, children: /* @__PURE__ */ r.jsxs(n, { data: e, margin: { top: 10, right: 10, left: 10, bottom: 5 }, children: [
|
|
13
|
-
/* @__PURE__ */ r.jsxs("defs", { children: [
|
|
14
|
-
/* @__PURE__ */ r.jsxs("linearGradient", { id: "barGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
15
|
-
/* @__PURE__ */ r.jsx("stop", { offset: "0%", stopColor: o, stopOpacity: 1 }),
|
|
16
|
-
/* @__PURE__ */ r.jsx("stop", { offset: "90%", stopColor: o, stopOpacity: 0.6 }),
|
|
17
|
-
/* @__PURE__ */ r.jsx("stop", { offset: "100%", stopColor: o, stopOpacity: 0.3 })
|
|
18
|
-
] }),
|
|
19
|
-
/* @__PURE__ */ r.jsxs("filter", { id: "glow", height: "130%", children: [
|
|
20
|
-
/* @__PURE__ */ r.jsx("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3", result: "blur" }),
|
|
21
|
-
/* @__PURE__ */ r.jsx("feOffset", { in: "blur", dx: "0", dy: "0", result: "offsetBlur" }),
|
|
22
|
-
/* @__PURE__ */ r.jsx("feFlood", { floodColor: o, floodOpacity: "0.5", result: "offsetColor" }),
|
|
23
|
-
/* @__PURE__ */ r.jsx("feComposite", { in: "offsetColor", in2: "offsetBlur", operator: "in", result: "offsetBlur" }),
|
|
24
|
-
/* @__PURE__ */ r.jsxs("feMerge", { children: [
|
|
25
|
-
/* @__PURE__ */ r.jsx("feMergeNode", { in: "offsetBlur" }),
|
|
26
|
-
/* @__PURE__ */ r.jsx("feMergeNode", { in: "SourceGraphic" })
|
|
27
|
-
] })
|
|
28
|
-
] })
|
|
29
|
-
] }),
|
|
30
|
-
/* @__PURE__ */ r.jsx(d, { strokeDasharray: "3 3", stroke: "hsl(var(--border))", vertical: !1 }),
|
|
31
|
-
/* @__PURE__ */ r.jsx(
|
|
32
|
-
f,
|
|
33
|
-
{
|
|
34
|
-
dataKey: a,
|
|
35
|
-
tick: { fill: "hsl(var(--muted-foreground))", fontSize: 12, fontFamily: "monospace" },
|
|
36
|
-
tickLine: !1,
|
|
37
|
-
axisLine: { stroke: "hsl(var(--border))" },
|
|
38
|
-
dy: 10
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
/* @__PURE__ */ r.jsx(
|
|
42
|
-
p,
|
|
43
|
-
{
|
|
44
|
-
tick: { fill: "hsl(var(--muted-foreground))", fontSize: 12, fontFamily: "monospace" },
|
|
45
|
-
tickLine: !1,
|
|
46
|
-
axisLine: !1
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
/* @__PURE__ */ r.jsx(
|
|
50
|
-
x,
|
|
51
|
-
{
|
|
52
|
-
cursor: { fill: "hsl(var(--muted))", opacity: 0.2 },
|
|
53
|
-
contentStyle: {
|
|
54
|
-
backgroundColor: "hsl(var(--popover))",
|
|
55
|
-
borderColor: "hsl(var(--border))",
|
|
56
|
-
color: "hsl(var(--popover-foreground))",
|
|
57
|
-
borderRadius: "8px",
|
|
58
|
-
fontFamily: "monospace",
|
|
59
|
-
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
60
|
-
},
|
|
61
|
-
itemStyle: { color: "hsl(var(--primary))" }
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
/* @__PURE__ */ r.jsx(u, { wrapperStyle: { paddingTop: "20px", fontFamily: "monospace" } }),
|
|
65
|
-
/* @__PURE__ */ r.jsx(
|
|
66
|
-
c,
|
|
67
|
-
{
|
|
68
|
-
dataKey: s,
|
|
69
|
-
fill: "url(#barGradient)",
|
|
70
|
-
radius: [4, 4, 0, 0],
|
|
71
|
-
filter: "url(#glow)",
|
|
72
|
-
animationDuration: 1500
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
] }) }) });
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
j as default
|
|
79
|
-
};
|
package/dist/index-xUWSanB8.js
DELETED
|
@@ -1,541 +0,0 @@
|
|
|
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
|
-
import { Skeleton as W } from "@object-ui/components";
|
|
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
|
-
var d = null;
|
|
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
|
-
$$typeof: a,
|
|
20
|
-
type: s,
|
|
21
|
-
key: d,
|
|
22
|
-
ref: n !== void 0 ? n : null,
|
|
23
|
-
props: l
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return A.Fragment = r, A.jsx = u, A.jsxs = u, A;
|
|
27
|
-
}
|
|
28
|
-
var j = {};
|
|
29
|
-
var q;
|
|
30
|
-
function ge() {
|
|
31
|
-
return q || (q = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
|
-
function a(e) {
|
|
33
|
-
if (e == null) return null;
|
|
34
|
-
if (typeof e == "function")
|
|
35
|
-
return e.$$typeof === le ? null : e.displayName || e.name || null;
|
|
36
|
-
if (typeof e == "string") return e;
|
|
37
|
-
switch (e) {
|
|
38
|
-
case O:
|
|
39
|
-
return "Fragment";
|
|
40
|
-
case H:
|
|
41
|
-
return "Profiler";
|
|
42
|
-
case G:
|
|
43
|
-
return "StrictMode";
|
|
44
|
-
case ae:
|
|
45
|
-
return "Suspense";
|
|
46
|
-
case re:
|
|
47
|
-
return "SuspenseList";
|
|
48
|
-
case ne:
|
|
49
|
-
return "Activity";
|
|
50
|
-
}
|
|
51
|
-
if (typeof e == "object")
|
|
52
|
-
switch (typeof e.tag == "number" && console.error(
|
|
53
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
|
-
), e.$$typeof) {
|
|
55
|
-
case R:
|
|
56
|
-
return "Portal";
|
|
57
|
-
case Q:
|
|
58
|
-
return e.displayName || "Context";
|
|
59
|
-
case Z:
|
|
60
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
61
|
-
case ee:
|
|
62
|
-
var t = e.render;
|
|
63
|
-
return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
64
|
-
case te:
|
|
65
|
-
return t = e.displayName || null, t !== null ? t : a(e.type) || "Memo";
|
|
66
|
-
case C:
|
|
67
|
-
t = e._payload, e = e._init;
|
|
68
|
-
try {
|
|
69
|
-
return a(e(t));
|
|
70
|
-
} catch {
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
function r(e) {
|
|
76
|
-
return "" + e;
|
|
77
|
-
}
|
|
78
|
-
function u(e) {
|
|
79
|
-
try {
|
|
80
|
-
r(e);
|
|
81
|
-
var t = !1;
|
|
82
|
-
} catch {
|
|
83
|
-
t = !0;
|
|
84
|
-
}
|
|
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
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
-
c
|
|
92
|
-
), r(e);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function s(e) {
|
|
96
|
-
if (e === O) return "<>";
|
|
97
|
-
if (typeof e == "object" && e !== null && e.$$typeof === C)
|
|
98
|
-
return "<...>";
|
|
99
|
-
try {
|
|
100
|
-
var t = a(e);
|
|
101
|
-
return t ? "<" + t + ">" : "<...>";
|
|
102
|
-
} catch {
|
|
103
|
-
return "<...>";
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function n() {
|
|
107
|
-
var e = w.A;
|
|
108
|
-
return e === null ? null : e.getOwner();
|
|
109
|
-
}
|
|
110
|
-
function l() {
|
|
111
|
-
return Error("react-stack-top-frame");
|
|
112
|
-
}
|
|
113
|
-
function d(e) {
|
|
114
|
-
if (K.call(e, "key")) {
|
|
115
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
116
|
-
if (t && t.isReactWarning) return !1;
|
|
117
|
-
}
|
|
118
|
-
return e.key !== void 0;
|
|
119
|
-
}
|
|
120
|
-
function f(e, t) {
|
|
121
|
-
function o() {
|
|
122
|
-
Y || (Y = !0, console.error(
|
|
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
|
-
t
|
|
125
|
-
));
|
|
126
|
-
}
|
|
127
|
-
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
128
|
-
get: o,
|
|
129
|
-
configurable: !0
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function m() {
|
|
133
|
-
var e = a(this.type);
|
|
134
|
-
return M[e] || (M[e] = !0, console.error(
|
|
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
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
137
|
-
}
|
|
138
|
-
function p(e, t, o, c, N, D) {
|
|
139
|
-
var i = o.ref;
|
|
140
|
-
return e = {
|
|
141
|
-
$$typeof: b,
|
|
142
|
-
type: e,
|
|
143
|
-
key: t,
|
|
144
|
-
props: o,
|
|
145
|
-
_owner: c
|
|
146
|
-
}, (i !== void 0 ? i : null) !== null ? Object.defineProperty(e, "ref", {
|
|
147
|
-
enumerable: !1,
|
|
148
|
-
get: m
|
|
149
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
150
|
-
configurable: !1,
|
|
151
|
-
enumerable: !1,
|
|
152
|
-
writable: !0,
|
|
153
|
-
value: 0
|
|
154
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
155
|
-
configurable: !1,
|
|
156
|
-
enumerable: !1,
|
|
157
|
-
writable: !0,
|
|
158
|
-
value: null
|
|
159
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
160
|
-
configurable: !1,
|
|
161
|
-
enumerable: !1,
|
|
162
|
-
writable: !0,
|
|
163
|
-
value: N
|
|
164
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
165
|
-
configurable: !1,
|
|
166
|
-
enumerable: !1,
|
|
167
|
-
writable: !0,
|
|
168
|
-
value: D
|
|
169
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
170
|
-
}
|
|
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
|
-
} else
|
|
180
|
-
console.error(
|
|
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
|
-
);
|
|
183
|
-
else v(i);
|
|
184
|
-
if (K.call(t, "key")) {
|
|
185
|
-
i = a(e);
|
|
186
|
-
var T = Object.keys(t).filter(function(se) {
|
|
187
|
-
return se !== "key";
|
|
188
|
-
});
|
|
189
|
-
c = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", I[i + c] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
191
|
-
let props = %s;
|
|
192
|
-
<%s {...props} />
|
|
193
|
-
React keys must be passed directly to JSX without using spread:
|
|
194
|
-
let props = %s;
|
|
195
|
-
<%s key={someKey} {...props} />`,
|
|
196
|
-
c,
|
|
197
|
-
i,
|
|
198
|
-
T,
|
|
199
|
-
i
|
|
200
|
-
), I[i + c] = !0);
|
|
201
|
-
}
|
|
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
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
210
|
-
), p(
|
|
211
|
-
e,
|
|
212
|
-
i,
|
|
213
|
-
o,
|
|
214
|
-
n(),
|
|
215
|
-
N,
|
|
216
|
-
D
|
|
217
|
-
);
|
|
218
|
-
}
|
|
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
|
-
}
|
|
222
|
-
function _(e) {
|
|
223
|
-
return typeof e == "object" && e !== null && e.$$typeof === b;
|
|
224
|
-
}
|
|
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
|
-
return null;
|
|
227
|
-
};
|
|
228
|
-
E = {
|
|
229
|
-
react_stack_bottom_frame: function(e) {
|
|
230
|
-
return e();
|
|
231
|
-
}
|
|
232
|
-
};
|
|
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
|
-
e,
|
|
241
|
-
t,
|
|
242
|
-
o,
|
|
243
|
-
!1,
|
|
244
|
-
c ? Error("react-stack-top-frame") : L,
|
|
245
|
-
c ? P(s(e)) : $
|
|
246
|
-
);
|
|
247
|
-
}, j.jsxs = function(e, t, o) {
|
|
248
|
-
var c = 1e4 > w.recentlyCreatedOwnerStacks++;
|
|
249
|
-
return g(
|
|
250
|
-
e,
|
|
251
|
-
t,
|
|
252
|
-
o,
|
|
253
|
-
!0,
|
|
254
|
-
c ? Error("react-stack-top-frame") : L,
|
|
255
|
-
c ? P(s(e)) : $
|
|
256
|
-
);
|
|
257
|
-
};
|
|
258
|
-
})()), j;
|
|
259
|
-
}
|
|
260
|
-
var z;
|
|
261
|
-
function pe() {
|
|
262
|
-
return z || (z = 1, process.env.NODE_ENV === "production" ? S.exports = me() : S.exports = ge()), S.exports;
|
|
263
|
-
}
|
|
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
|
-
{
|
|
268
|
-
data: a.data,
|
|
269
|
-
dataKey: a.dataKey,
|
|
270
|
-
xAxisKey: a.xAxisKey,
|
|
271
|
-
height: a.height,
|
|
272
|
-
className: a.className,
|
|
273
|
-
color: a.color
|
|
274
|
-
}
|
|
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
|
-
}
|
|
284
|
-
return {
|
|
285
|
-
chartType: a.chartType,
|
|
286
|
-
data: Array.isArray(a.data) ? a.data : [],
|
|
287
|
-
config: n,
|
|
288
|
-
xAxisKey: s,
|
|
289
|
-
series: u,
|
|
290
|
-
className: a.className
|
|
291
|
-
};
|
|
292
|
-
}, [a]);
|
|
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
|
-
{
|
|
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
|
-
}
|
|
303
|
-
) });
|
|
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);
|
|
341
|
-
try {
|
|
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);
|
|
361
|
-
} finally {
|
|
362
|
-
_ && m(!1);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
return r.objectName && !n && !r.data && E(), () => {
|
|
367
|
-
_ = !1;
|
|
368
|
-
};
|
|
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
|
|
373
|
-
};
|
|
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 });
|
|
379
|
-
};
|
|
380
|
-
h.register("object-chart", X, {
|
|
381
|
-
namespace: "plugin-charts",
|
|
382
|
-
label: "Object Chart",
|
|
383
|
-
category: "view",
|
|
384
|
-
inputs: [
|
|
385
|
-
{ name: "objectName", type: "string", label: "Object Name", required: !0 },
|
|
386
|
-
{ name: "data", type: "array", label: "Data", description: "Optional static data" },
|
|
387
|
-
{ name: "filter", type: "array", label: "Filter" },
|
|
388
|
-
{ name: "aggregate", type: "object", label: "Aggregate", description: "Aggregation config: { field, function, groupBy }" }
|
|
389
|
-
]
|
|
390
|
-
});
|
|
391
|
-
const Re = {
|
|
392
|
-
"bar-chart": B,
|
|
393
|
-
chart: x
|
|
394
|
-
};
|
|
395
|
-
h.register(
|
|
396
|
-
"bar-chart",
|
|
397
|
-
B,
|
|
398
|
-
{
|
|
399
|
-
namespace: "plugin-charts",
|
|
400
|
-
label: "Bar Chart",
|
|
401
|
-
category: "plugin",
|
|
402
|
-
inputs: [
|
|
403
|
-
{ name: "data", type: "array", label: "Data", required: !0 },
|
|
404
|
-
{ name: "dataKey", type: "string", label: "Data Key", defaultValue: "value" },
|
|
405
|
-
{ name: "xAxisKey", type: "string", label: "X-Axis Key", defaultValue: "name" },
|
|
406
|
-
{ name: "height", type: "number", label: "Height", defaultValue: 400 },
|
|
407
|
-
{ name: "color", type: "color", label: "Color", defaultValue: "#8884d8" }
|
|
408
|
-
],
|
|
409
|
-
defaultProps: {
|
|
410
|
-
data: [
|
|
411
|
-
{ name: "Jan", value: 400 },
|
|
412
|
-
{ name: "Feb", value: 300 },
|
|
413
|
-
{ name: "Mar", value: 600 },
|
|
414
|
-
{ name: "Apr", value: 800 },
|
|
415
|
-
{ name: "May", value: 500 }
|
|
416
|
-
],
|
|
417
|
-
dataKey: "value",
|
|
418
|
-
xAxisKey: "name",
|
|
419
|
-
height: 400,
|
|
420
|
-
color: "#8884d8"
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
);
|
|
424
|
-
h.register("chart", X, {
|
|
425
|
-
namespace: "view",
|
|
426
|
-
category: "view",
|
|
427
|
-
label: "Chart",
|
|
428
|
-
inputs: [
|
|
429
|
-
{ name: "objectName", type: "string", label: "Object Name", required: !0 },
|
|
430
|
-
{ name: "type", type: "string", label: "Chart Type" },
|
|
431
|
-
{ name: "categoryField", type: "string", label: "Category Field" },
|
|
432
|
-
{ name: "valueField", type: "string", label: "Value Field" }
|
|
433
|
-
]
|
|
434
|
-
});
|
|
435
|
-
h.register(
|
|
436
|
-
"chart",
|
|
437
|
-
x,
|
|
438
|
-
{
|
|
439
|
-
namespace: "plugin-charts",
|
|
440
|
-
label: "Chart",
|
|
441
|
-
category: "plugin",
|
|
442
|
-
inputs: [
|
|
443
|
-
{
|
|
444
|
-
name: "chartType",
|
|
445
|
-
type: "enum",
|
|
446
|
-
label: "Chart Type",
|
|
447
|
-
enum: [
|
|
448
|
-
{ label: "Bar", value: "bar" },
|
|
449
|
-
{ label: "Line", value: "line" },
|
|
450
|
-
{ label: "Area", value: "area" },
|
|
451
|
-
{ label: "Pie", value: "pie" },
|
|
452
|
-
{ label: "Donut", value: "donut" },
|
|
453
|
-
{ label: "Radar", value: "radar" },
|
|
454
|
-
{ label: "Scatter", value: "scatter" }
|
|
455
|
-
],
|
|
456
|
-
defaultValue: "bar"
|
|
457
|
-
},
|
|
458
|
-
{ name: "data", type: "code", label: "Data (JSON)", required: !0 },
|
|
459
|
-
{ name: "config", type: "code", label: "Config (JSON)" },
|
|
460
|
-
{ name: "xAxisKey", type: "string", label: "X Axis Key", defaultValue: "name" },
|
|
461
|
-
{ name: "series", type: "code", label: "Series (JSON Array)", required: !0 },
|
|
462
|
-
{ name: "className", type: "string", label: "CSS Class" }
|
|
463
|
-
],
|
|
464
|
-
defaultProps: {
|
|
465
|
-
chartType: "bar",
|
|
466
|
-
data: [
|
|
467
|
-
{ name: "Jan", sales: 400, revenue: 240 },
|
|
468
|
-
{ name: "Feb", sales: 300, revenue: 139 },
|
|
469
|
-
{ name: "Mar", sales: 600, revenue: 380 },
|
|
470
|
-
{ name: "Apr", sales: 800, revenue: 430 },
|
|
471
|
-
{ name: "May", sales: 500, revenue: 220 }
|
|
472
|
-
],
|
|
473
|
-
config: {
|
|
474
|
-
sales: { label: "Sales", color: "#8884d8" },
|
|
475
|
-
revenue: { label: "Revenue", color: "#82ca9d" }
|
|
476
|
-
},
|
|
477
|
-
xAxisKey: "name",
|
|
478
|
-
series: [
|
|
479
|
-
{ dataKey: "sales" },
|
|
480
|
-
{ dataKey: "revenue" }
|
|
481
|
-
]
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
);
|
|
485
|
-
h.register(
|
|
486
|
-
"chart:bar",
|
|
487
|
-
x,
|
|
488
|
-
{
|
|
489
|
-
namespace: "plugin-charts",
|
|
490
|
-
label: "Bar Chart (Alias)",
|
|
491
|
-
category: "plugin",
|
|
492
|
-
defaultProps: { chartType: "bar" }
|
|
493
|
-
}
|
|
494
|
-
);
|
|
495
|
-
h.register(
|
|
496
|
-
"pie-chart",
|
|
497
|
-
x,
|
|
498
|
-
{
|
|
499
|
-
namespace: "plugin-charts",
|
|
500
|
-
label: "Pie Chart",
|
|
501
|
-
category: "plugin",
|
|
502
|
-
defaultProps: { chartType: "pie" }
|
|
503
|
-
}
|
|
504
|
-
);
|
|
505
|
-
h.register(
|
|
506
|
-
"donut-chart",
|
|
507
|
-
x,
|
|
508
|
-
{
|
|
509
|
-
namespace: "plugin-charts",
|
|
510
|
-
label: "Donut Chart",
|
|
511
|
-
category: "plugin",
|
|
512
|
-
defaultProps: { chartType: "donut" }
|
|
513
|
-
}
|
|
514
|
-
);
|
|
515
|
-
h.register(
|
|
516
|
-
"radar-chart",
|
|
517
|
-
x,
|
|
518
|
-
{
|
|
519
|
-
namespace: "plugin-charts",
|
|
520
|
-
label: "Radar Chart",
|
|
521
|
-
category: "plugin",
|
|
522
|
-
defaultProps: { chartType: "radar" }
|
|
523
|
-
}
|
|
524
|
-
);
|
|
525
|
-
h.register(
|
|
526
|
-
"scatter-chart",
|
|
527
|
-
x,
|
|
528
|
-
{
|
|
529
|
-
namespace: "plugin-charts",
|
|
530
|
-
label: "Scatter Chart",
|
|
531
|
-
category: "plugin",
|
|
532
|
-
defaultProps: { chartType: "scatter" }
|
|
533
|
-
}
|
|
534
|
-
);
|
|
535
|
-
export {
|
|
536
|
-
B as C,
|
|
537
|
-
X as O,
|
|
538
|
-
x as a,
|
|
539
|
-
Re as c,
|
|
540
|
-
y as j
|
|
541
|
-
};
|