@object-ui/plugin-charts 3.3.2 → 4.0.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 +34 -0
- package/dist/{AdvancedChartImpl-DxaZtNlE.js → AdvancedChartImpl-BLyJ4LaI.js} +16 -16
- package/dist/{BarChart-BQS4sYHd.js → BarChart-C9W1kOQ6.js} +3755 -3841
- package/dist/{ChartImpl-BaXisyXJ.js → ChartImpl-AHzX3Kht.js} +2 -2
- package/dist/index.js +399 -98
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/plugin-charts/src/ChartRenderer.d.ts +1 -0
- package/dist/packages/plugin-charts/src/ObjectChart.d.ts +1 -1
- package/dist/{jsx-runtime-Caia9pQX.js → shim-oa8knWTF.js} +87 -1
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComponentRegistry as
|
|
3
|
-
import
|
|
4
|
-
import { Skeleton as
|
|
5
|
-
import { SchemaRendererContext as
|
|
1
|
+
import { n as e, t } from "./shim-oa8knWTF.js";
|
|
2
|
+
import { ComponentRegistry as n, extractRecords as r } from "@object-ui/core";
|
|
3
|
+
import i, { Suspense as a, createContext as o, createElement as s, forwardRef as c, useCallback as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
4
|
+
import { Skeleton as h } from "@object-ui/components";
|
|
5
|
+
import { SchemaRendererContext as g, useDataScope as _ } from "@object-ui/react";
|
|
6
6
|
//#region src/ChartRenderer.tsx
|
|
7
|
-
var
|
|
8
|
-
fallback: /* @__PURE__ */ (0,
|
|
9
|
-
children: /* @__PURE__ */ (0,
|
|
7
|
+
var v = e(), y = i.lazy(() => import("./ChartImpl-AHzX3Kht.js")), b = i.lazy(() => import("./AdvancedChartImpl-BLyJ4LaI.js")), x = ({ schema: e }) => /* @__PURE__ */ (0, v.jsx)(a, {
|
|
8
|
+
fallback: /* @__PURE__ */ (0, v.jsx)(h, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
9
|
+
children: /* @__PURE__ */ (0, v.jsx)(y, {
|
|
10
10
|
data: e.data,
|
|
11
11
|
dataKey: e.dataKey,
|
|
12
12
|
xAxisKey: e.xAxisKey,
|
|
@@ -14,8 +14,8 @@ var h = e(), g = r.lazy(() => import("./ChartImpl-BaXisyXJ.js")), _ = r.lazy(()
|
|
|
14
14
|
className: e.className,
|
|
15
15
|
color: e.color
|
|
16
16
|
})
|
|
17
|
-
}),
|
|
18
|
-
let t =
|
|
17
|
+
}), S = ({ schema: e }) => {
|
|
18
|
+
let t = i.useMemo(() => {
|
|
19
19
|
let t = e.series, n = e.xAxisKey, r = e.config;
|
|
20
20
|
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) {
|
|
21
21
|
let n = e.colors || [
|
|
@@ -25,7 +25,7 @@ var h = e(), g = r.lazy(() => import("./ChartImpl-BaXisyXJ.js")), _ = r.lazy(()
|
|
|
25
25
|
], i = {};
|
|
26
26
|
t.forEach((e, t) => {
|
|
27
27
|
i[e.dataKey] = {
|
|
28
|
-
label: e.dataKey,
|
|
28
|
+
label: e.label || e.dataKey,
|
|
29
29
|
color: n[t % n.length]
|
|
30
30
|
};
|
|
31
31
|
}), r = i;
|
|
@@ -39,9 +39,9 @@ var h = e(), g = r.lazy(() => import("./ChartImpl-BaXisyXJ.js")), _ = r.lazy(()
|
|
|
39
39
|
className: e.className
|
|
40
40
|
};
|
|
41
41
|
}, [e]);
|
|
42
|
-
return /* @__PURE__ */ (0,
|
|
43
|
-
fallback: /* @__PURE__ */ (0,
|
|
44
|
-
children: /* @__PURE__ */ (0,
|
|
42
|
+
return /* @__PURE__ */ (0, v.jsx)(a, {
|
|
43
|
+
fallback: /* @__PURE__ */ (0, v.jsx)(h, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
|
|
44
|
+
children: /* @__PURE__ */ (0, v.jsx)(b, {
|
|
45
45
|
chartType: t.chartType,
|
|
46
46
|
data: t.data,
|
|
47
47
|
config: t.config,
|
|
@@ -50,10 +50,10 @@ var h = e(), g = r.lazy(() => import("./ChartImpl-BaXisyXJ.js")), _ = r.lazy(()
|
|
|
50
50
|
className: t.className
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
|
-
},
|
|
54
|
-
let t =
|
|
53
|
+
}, C = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), w = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), T = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), E = (e) => {
|
|
54
|
+
let t = T(e);
|
|
55
55
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
56
|
-
},
|
|
56
|
+
}, D = {
|
|
57
57
|
xmlns: "http://www.w3.org/2000/svg",
|
|
58
58
|
width: 24,
|
|
59
59
|
height: 24,
|
|
@@ -63,30 +63,30 @@ var h = e(), g = r.lazy(() => import("./ChartImpl-BaXisyXJ.js")), _ = r.lazy(()
|
|
|
63
63
|
strokeWidth: 2,
|
|
64
64
|
strokeLinecap: "round",
|
|
65
65
|
strokeLinejoin: "round"
|
|
66
|
-
},
|
|
66
|
+
}, O = (e) => {
|
|
67
67
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
68
68
|
return !1;
|
|
69
|
-
},
|
|
70
|
-
let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } =
|
|
71
|
-
return
|
|
69
|
+
}, k = o({}), A = () => u(k), j = c(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...c }, l) => {
|
|
70
|
+
let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = A() ?? {}, h = r ?? f ? Number(n ?? d) * 24 / Number(t ?? u) : n ?? d;
|
|
71
|
+
return s("svg", {
|
|
72
72
|
ref: l,
|
|
73
|
-
...
|
|
74
|
-
width: t ?? u ??
|
|
75
|
-
height: t ?? u ??
|
|
73
|
+
...D,
|
|
74
|
+
width: t ?? u ?? D.width,
|
|
75
|
+
height: t ?? u ?? D.height,
|
|
76
76
|
stroke: e ?? p,
|
|
77
77
|
strokeWidth: h,
|
|
78
|
-
className:
|
|
79
|
-
...!a && !
|
|
78
|
+
className: C("lucide", m, i),
|
|
79
|
+
...!a && !O(c) && { "aria-hidden": "true" },
|
|
80
80
|
...c
|
|
81
|
-
}, [...
|
|
82
|
-
}),
|
|
83
|
-
let n =
|
|
81
|
+
}, [...o.map(([e, t]) => s(e, t)), ...Array.isArray(a) ? a : [a]]);
|
|
82
|
+
}), ee = ((e, t) => {
|
|
83
|
+
let n = c(({ className: n, ...r }, i) => s(j, {
|
|
84
84
|
ref: i,
|
|
85
85
|
iconNode: t,
|
|
86
|
-
className:
|
|
86
|
+
className: C(`lucide-${w(E(e))}`, `lucide-${e}`, n),
|
|
87
87
|
...r
|
|
88
88
|
}));
|
|
89
|
-
return n.displayName =
|
|
89
|
+
return n.displayName = E(e), n;
|
|
90
90
|
})("circle-alert", [
|
|
91
91
|
["circle", {
|
|
92
92
|
cx: "12",
|
|
@@ -108,13 +108,304 @@ var h = e(), g = r.lazy(() => import("./ChartImpl-BaXisyXJ.js")), _ = r.lazy(()
|
|
|
108
108
|
y2: "16",
|
|
109
109
|
key: "4dfq90"
|
|
110
110
|
}]
|
|
111
|
+
]), te = (e, t, n, r) => {
|
|
112
|
+
let i = [n, {
|
|
113
|
+
code: t,
|
|
114
|
+
...r || {}
|
|
115
|
+
}];
|
|
116
|
+
if (e?.services?.logger?.forward) return e.services.logger.forward(i, "warn", "react-i18next::", !0);
|
|
117
|
+
L(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), e?.services?.logger?.warn ? e.services.logger.warn(...i) : console?.warn && console.warn(...i);
|
|
118
|
+
}, M = {}, N = (e, t, n, r) => {
|
|
119
|
+
L(n) && M[n] || (L(n) && (M[n] = /* @__PURE__ */ new Date()), te(e, t, n, r));
|
|
120
|
+
}, P = (e, t) => () => {
|
|
121
|
+
if (e.isInitialized) t();
|
|
122
|
+
else {
|
|
123
|
+
let n = () => {
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
e.off("initialized", n);
|
|
126
|
+
}, 0), t();
|
|
127
|
+
};
|
|
128
|
+
e.on("initialized", n);
|
|
129
|
+
}
|
|
130
|
+
}, F = (e, t, n) => {
|
|
131
|
+
e.loadNamespaces(t, P(e, n));
|
|
132
|
+
}, I = (e, t, n, r) => {
|
|
133
|
+
if (L(n) && (n = [n]), e.options.preload && e.options.preload.indexOf(t) > -1) return F(e, n, r);
|
|
134
|
+
n.forEach((t) => {
|
|
135
|
+
e.options.ns.indexOf(t) < 0 && e.options.ns.push(t);
|
|
136
|
+
}), e.loadLanguages(t, P(e, r));
|
|
137
|
+
}, ne = (e, t, n = {}) => !t.languages || !t.languages.length ? (N(t, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: t.languages }), !0) : t.hasLoadedNamespace(e, {
|
|
138
|
+
lng: n.lng,
|
|
139
|
+
precheck: (t, r) => {
|
|
140
|
+
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && t.services.backendConnector.backend && t.isLanguageChangingTo && !r(t.isLanguageChangingTo, e)) return !1;
|
|
141
|
+
}
|
|
142
|
+
}), L = (e) => typeof e == "string", R = (e) => typeof e == "object" && !!e, z = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, B = {
|
|
143
|
+
"&": "&",
|
|
144
|
+
"&": "&",
|
|
145
|
+
"<": "<",
|
|
146
|
+
"<": "<",
|
|
147
|
+
">": ">",
|
|
148
|
+
">": ">",
|
|
149
|
+
"'": "'",
|
|
150
|
+
"'": "'",
|
|
151
|
+
""": "\"",
|
|
152
|
+
""": "\"",
|
|
153
|
+
" ": " ",
|
|
154
|
+
" ": " ",
|
|
155
|
+
"©": "©",
|
|
156
|
+
"©": "©",
|
|
157
|
+
"®": "®",
|
|
158
|
+
"®": "®",
|
|
159
|
+
"…": "…",
|
|
160
|
+
"…": "…",
|
|
161
|
+
"/": "/",
|
|
162
|
+
"/": "/"
|
|
163
|
+
}, V = (e) => B[e], H = {
|
|
164
|
+
bindI18n: "languageChanged",
|
|
165
|
+
bindI18nStore: "",
|
|
166
|
+
transEmptyNodeValue: "",
|
|
167
|
+
transSupportBasicHtmlNodes: !0,
|
|
168
|
+
transWrapTextNodes: "",
|
|
169
|
+
transKeepBasicHtmlNodesFor: [
|
|
170
|
+
"br",
|
|
171
|
+
"strong",
|
|
172
|
+
"i",
|
|
173
|
+
"p"
|
|
174
|
+
],
|
|
175
|
+
useSuspense: !0,
|
|
176
|
+
unescape: (e) => e.replace(z, V),
|
|
177
|
+
transDefaultProps: void 0
|
|
178
|
+
}, U = () => H, W, G = () => W, K = o(), q = class {
|
|
179
|
+
constructor() {
|
|
180
|
+
this.usedNamespaces = {};
|
|
181
|
+
}
|
|
182
|
+
addUsedNamespaces(e) {
|
|
183
|
+
e.forEach((e) => {
|
|
184
|
+
this.usedNamespaces[e] || (this.usedNamespaces[e] = !0);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
getUsedNamespaces() {
|
|
188
|
+
return Object.keys(this.usedNamespaces);
|
|
189
|
+
}
|
|
190
|
+
}, J = t(), Y = {
|
|
191
|
+
t: (e, t) => {
|
|
192
|
+
if (L(t)) return t;
|
|
193
|
+
if (R(t) && L(t.defaultValue)) return t.defaultValue;
|
|
194
|
+
if (typeof e == "function") return "";
|
|
195
|
+
if (Array.isArray(e)) {
|
|
196
|
+
let t = e[e.length - 1];
|
|
197
|
+
return typeof t == "function" ? "" : t;
|
|
198
|
+
}
|
|
199
|
+
return e;
|
|
200
|
+
},
|
|
201
|
+
ready: !1
|
|
202
|
+
}, X = () => () => {}, re = (e, t = {}) => {
|
|
203
|
+
let { i18n: n } = t, { i18n: r, defaultNS: i } = u(K) || {}, a = n || r || G();
|
|
204
|
+
a && !a.reportNamespaces && (a.reportNamespaces = new q()), a || N(a, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
205
|
+
let o = f(() => ({
|
|
206
|
+
...U(),
|
|
207
|
+
...a?.options?.react,
|
|
208
|
+
...t
|
|
209
|
+
}), [a, t]), { useSuspense: s, keyPrefix: c } = o, h = e || i || a?.options?.defaultNS, g = L(h) ? [h] : h || ["translation"], _ = f(() => g, g);
|
|
210
|
+
a?.reportNamespaces?.addUsedNamespaces?.(_);
|
|
211
|
+
let v = p(0), y = l((e) => {
|
|
212
|
+
if (!a) return X;
|
|
213
|
+
let { bindI18n: t, bindI18nStore: n } = o, r = () => {
|
|
214
|
+
v.current += 1, e();
|
|
215
|
+
};
|
|
216
|
+
return t && a.on(t, r), n && a.store.on(n, r), () => {
|
|
217
|
+
t && t.split(" ").forEach((e) => a.off(e, r)), n && n.split(" ").forEach((e) => a.store.off(e, r));
|
|
218
|
+
};
|
|
219
|
+
}, [a, o]), b = p(), x = l(() => {
|
|
220
|
+
if (!a) return Y;
|
|
221
|
+
let e = !!(a.isInitialized || a.initializedStoreOnce) && _.every((e) => ne(e, a, o)), n = t.lng || a.language, r = v.current, i = b.current;
|
|
222
|
+
if (i && i.ready === e && i.lng === n && i.keyPrefix === c && i.revision === r) return i;
|
|
223
|
+
let s = {
|
|
224
|
+
t: a.getFixedT(n, o.nsMode === "fallback" ? _ : _[0], c),
|
|
225
|
+
ready: e,
|
|
226
|
+
lng: n,
|
|
227
|
+
keyPrefix: c,
|
|
228
|
+
revision: r
|
|
229
|
+
};
|
|
230
|
+
return b.current = s, s;
|
|
231
|
+
}, [
|
|
232
|
+
a,
|
|
233
|
+
_,
|
|
234
|
+
c,
|
|
235
|
+
o,
|
|
236
|
+
t.lng
|
|
237
|
+
]), [S, C] = m(0), { t: w, ready: T } = (0, J.useSyncExternalStore)(y, x, x);
|
|
238
|
+
d(() => {
|
|
239
|
+
if (a && !T && !s) {
|
|
240
|
+
let e = () => C((e) => e + 1);
|
|
241
|
+
t.lng ? I(a, t.lng, _, e) : F(a, _, e);
|
|
242
|
+
}
|
|
243
|
+
}, [
|
|
244
|
+
a,
|
|
245
|
+
t.lng,
|
|
246
|
+
_,
|
|
247
|
+
T,
|
|
248
|
+
s,
|
|
249
|
+
S
|
|
250
|
+
]);
|
|
251
|
+
let E = a || {}, D = p(null), O = p(), k = (e) => {
|
|
252
|
+
let t = Object.getOwnPropertyDescriptors(e);
|
|
253
|
+
t.__original && delete t.__original;
|
|
254
|
+
let n = Object.create(Object.getPrototypeOf(e), t);
|
|
255
|
+
if (!Object.prototype.hasOwnProperty.call(n, "__original")) try {
|
|
256
|
+
Object.defineProperty(n, "__original", {
|
|
257
|
+
value: e,
|
|
258
|
+
writable: !1,
|
|
259
|
+
enumerable: !1,
|
|
260
|
+
configurable: !1
|
|
261
|
+
});
|
|
262
|
+
} catch {}
|
|
263
|
+
return n;
|
|
264
|
+
}, A = f(() => {
|
|
265
|
+
let e = E, t = e?.language, n = e;
|
|
266
|
+
e && (D.current && D.current.__original === e && O.current === t ? n = D.current : (n = k(e), D.current = n, O.current = t));
|
|
267
|
+
let r = !T && !s ? (...e) => (N(a, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."), w(...e)) : w, i = [
|
|
268
|
+
r,
|
|
269
|
+
n,
|
|
270
|
+
T
|
|
271
|
+
];
|
|
272
|
+
return i.t = r, i.i18n = n, i.ready = T, i;
|
|
273
|
+
}, [
|
|
274
|
+
w,
|
|
275
|
+
E,
|
|
276
|
+
T,
|
|
277
|
+
E.resolvedLanguage,
|
|
278
|
+
E.language,
|
|
279
|
+
E.languages
|
|
280
|
+
]);
|
|
281
|
+
if (a && s && !T) throw new Promise((e) => {
|
|
282
|
+
let n = () => e();
|
|
283
|
+
t.lng ? I(a, t.lng, _, n) : F(a, _, n);
|
|
284
|
+
});
|
|
285
|
+
return A;
|
|
286
|
+
}, ie = o(null);
|
|
287
|
+
function ae(e) {
|
|
288
|
+
let t = u(ie), { t: n, i18n: r } = re(e);
|
|
289
|
+
return {
|
|
290
|
+
t: n,
|
|
291
|
+
language: t?.language || r.language || "en",
|
|
292
|
+
changeLanguage: t?.changeLanguage || (async (e) => {
|
|
293
|
+
await r.changeLanguage(e);
|
|
294
|
+
}),
|
|
295
|
+
direction: t?.direction || "ltr",
|
|
296
|
+
i18n: r
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region ../i18n/dist/useObjectLabel.js
|
|
301
|
+
var oe = new Set([
|
|
302
|
+
"common",
|
|
303
|
+
"validation",
|
|
304
|
+
"form",
|
|
305
|
+
"table",
|
|
306
|
+
"grid",
|
|
307
|
+
"calendar",
|
|
308
|
+
"list",
|
|
309
|
+
"kanban",
|
|
310
|
+
"chart",
|
|
311
|
+
"dashboard",
|
|
312
|
+
"configPanel",
|
|
313
|
+
"appDesigner",
|
|
314
|
+
"console",
|
|
315
|
+
"errors",
|
|
316
|
+
"detail"
|
|
111
317
|
]);
|
|
318
|
+
function Z() {
|
|
319
|
+
let { t: e, i18n: t } = ae(), n = () => {
|
|
320
|
+
if (!t || typeof t.getResourceBundle != "function") return [];
|
|
321
|
+
let e = t.language || "en", n = t.getResourceBundle(e, "translation");
|
|
322
|
+
return n ? Object.keys(n).filter((e) => !oe.has(e) && n[e] && typeof n[e] == "object" && (n[e].objects || n[e].fields || n[e].apps || n[e].dashboards || n[e].pages || n[e].reports)) : [];
|
|
323
|
+
}, r = (e) => {
|
|
324
|
+
let t = e.indexOf("__");
|
|
325
|
+
return t > 0 ? e.slice(t + 2) : e;
|
|
326
|
+
}, i = (t, r) => {
|
|
327
|
+
let i = Array.isArray(t) ? t : [t];
|
|
328
|
+
try {
|
|
329
|
+
let t = n();
|
|
330
|
+
for (let n of t) for (let t of i) {
|
|
331
|
+
let r = `${n}.${t}`, i = e(r, { defaultValue: "" });
|
|
332
|
+
if (i && i !== r && i !== "") return i;
|
|
333
|
+
}
|
|
334
|
+
} catch {}
|
|
335
|
+
return r;
|
|
336
|
+
}, a = (e, t) => {
|
|
337
|
+
let n = r(e);
|
|
338
|
+
return n === e ? [`objects.${e}.${t}`] : [`objects.${e}.${t}`, `objects.${n}.${t}`];
|
|
339
|
+
}, o = (e, t) => {
|
|
340
|
+
let n = r(e);
|
|
341
|
+
return n === e ? [`fields.${e}.${t}`] : [`fields.${e}.${t}`, `fields.${n}.${t}`];
|
|
342
|
+
}, s = (e, t, n) => {
|
|
343
|
+
let i = r(e);
|
|
344
|
+
return i === e ? [`fieldOptions.${e}.${t}.${n}`] : [`fieldOptions.${e}.${t}.${n}`, `fieldOptions.${i}.${t}.${n}`];
|
|
345
|
+
}, c = (e, t) => {
|
|
346
|
+
let n = r(e);
|
|
347
|
+
return n === e ? [`dashboards.${e}.${t}`] : [`dashboards.${e}.${t}`, `dashboards.${n}.${t}`];
|
|
348
|
+
}, l = (e, t) => {
|
|
349
|
+
let n = r(e);
|
|
350
|
+
return n === e ? [`pages.${e}.${t}`] : [`pages.${e}.${t}`, `pages.${n}.${t}`];
|
|
351
|
+
}, u = (e, t) => {
|
|
352
|
+
let n = r(e);
|
|
353
|
+
return n === e ? [`reports.${e}.${t}`] : [`reports.${e}.${t}`, `reports.${n}.${t}`];
|
|
354
|
+
};
|
|
355
|
+
return {
|
|
356
|
+
objectLabel: (e) => i(a(e.name, "label"), e.label),
|
|
357
|
+
objectDescription: (e) => {
|
|
358
|
+
if (e.description) return i(a(e.name, "description"), e.description);
|
|
359
|
+
},
|
|
360
|
+
fieldLabel: (e, t, n) => i(o(e, t), n),
|
|
361
|
+
fieldOptionLabel: (e, t, n, r) => i(s(e, t, n), r),
|
|
362
|
+
translateOptions: (e, t, n) => n.map((n) => ({
|
|
363
|
+
...n,
|
|
364
|
+
label: i(s(e, t, n.value), n.label)
|
|
365
|
+
})),
|
|
366
|
+
appLabel: (e) => i(`apps.${e.name}.label`, e.label ?? e.name),
|
|
367
|
+
appDescription: (e) => {
|
|
368
|
+
let t = e.description ?? "";
|
|
369
|
+
return i(`apps.${e.name}.description`, t) || void 0;
|
|
370
|
+
},
|
|
371
|
+
navGroupLabel: (e, t, n) => i(`apps.${e}.navigation.${t}.label`, n),
|
|
372
|
+
dashboardLabel: (e) => i(c(e.name, "label"), e.label ?? e.name),
|
|
373
|
+
dashboardDescription: (e) => {
|
|
374
|
+
let t = e.description ?? "";
|
|
375
|
+
return i(c(e.name, "description"), t) || void 0;
|
|
376
|
+
},
|
|
377
|
+
dashboardActionLabel: (e, t, n) => i(c(e, `actions.${t}.label`), n),
|
|
378
|
+
widgetTitle: (e, t, n) => i(c(e, `widgets.${t}.title`), n),
|
|
379
|
+
widgetDescription: (e, t, n) => {
|
|
380
|
+
let r = n ?? "";
|
|
381
|
+
return i(c(e, `widgets.${t}.description`), r) || void 0;
|
|
382
|
+
},
|
|
383
|
+
pageLabel: (e) => i(l(e.name, "label"), e.label ?? e.name),
|
|
384
|
+
reportLabel: (e) => i(u(e.name, "label"), e.label ?? e.name)
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function se() {
|
|
388
|
+
try {
|
|
389
|
+
let { fieldLabel: e, translateOptions: t, fieldOptionLabel: n } = Z();
|
|
390
|
+
return {
|
|
391
|
+
fieldLabel: e,
|
|
392
|
+
translateOptions: t,
|
|
393
|
+
fieldOptionLabel: n
|
|
394
|
+
};
|
|
395
|
+
} catch {
|
|
396
|
+
return {
|
|
397
|
+
fieldLabel: (e, t, n) => n,
|
|
398
|
+
translateOptions: (e, t, n) => n,
|
|
399
|
+
fieldOptionLabel: (e, t, n, r) => r
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
}
|
|
112
403
|
//#endregion
|
|
113
404
|
//#region src/ObjectChart.tsx
|
|
114
|
-
function
|
|
405
|
+
function Q(e) {
|
|
115
406
|
return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
116
407
|
}
|
|
117
|
-
function
|
|
408
|
+
function ce(e, t) {
|
|
118
409
|
let { field: n, function: r, groupBy: i } = t, a = {};
|
|
119
410
|
for (let t of e) {
|
|
120
411
|
let e = String(t[i] ?? "Unknown");
|
|
@@ -145,43 +436,49 @@ function j(e, t) {
|
|
|
145
436
|
};
|
|
146
437
|
});
|
|
147
438
|
}
|
|
148
|
-
async function
|
|
439
|
+
async function le(e, t, n, i, a) {
|
|
149
440
|
if (!e.length || !t) return e;
|
|
150
|
-
let a =
|
|
151
|
-
if (!
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}));
|
|
155
|
-
let o = a.type;
|
|
156
|
-
if (o === "select" || o === "picklist" || o === "dropdown") {
|
|
157
|
-
let n = a.options || [];
|
|
158
|
-
if (n.length === 0) return e.map((e) => ({
|
|
441
|
+
let o = a || ((e, t) => t), s = n?.fields?.[t];
|
|
442
|
+
if (!s) return e.map((e) => {
|
|
443
|
+
let n = String(e[t] ?? ""), r = Q(n);
|
|
444
|
+
return {
|
|
159
445
|
...e,
|
|
160
|
-
[t]:
|
|
161
|
-
}
|
|
446
|
+
[t]: o(n, r)
|
|
447
|
+
};
|
|
448
|
+
});
|
|
449
|
+
let c = s.type;
|
|
450
|
+
if (c === "select" || c === "picklist" || c === "dropdown") {
|
|
451
|
+
let n = s.options || [];
|
|
452
|
+
if (n.length === 0) return e.map((e) => {
|
|
453
|
+
let n = String(e[t] ?? ""), r = Q(n);
|
|
454
|
+
return {
|
|
455
|
+
...e,
|
|
456
|
+
[t]: o(n, r)
|
|
457
|
+
};
|
|
458
|
+
});
|
|
162
459
|
let r = {};
|
|
163
460
|
for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
|
|
164
461
|
return e.map((e) => {
|
|
165
|
-
let n = String(e[t] ?? "");
|
|
462
|
+
let n = String(e[t] ?? ""), i = r[n] || Q(n);
|
|
166
463
|
return {
|
|
167
464
|
...e,
|
|
168
|
-
[t]:
|
|
465
|
+
[t]: o(n, i)
|
|
169
466
|
};
|
|
170
467
|
});
|
|
171
468
|
}
|
|
172
|
-
if (
|
|
173
|
-
let
|
|
174
|
-
if (!
|
|
175
|
-
let
|
|
176
|
-
if (
|
|
177
|
-
let
|
|
469
|
+
if (c === "lookup" || c === "master_detail") {
|
|
470
|
+
let n = s.reference_to || s.reference;
|
|
471
|
+
if (!n || !i || typeof i.find != "function") return e;
|
|
472
|
+
let a = [...new Set(e.map((e) => e[t]).filter((e) => e != null))];
|
|
473
|
+
if (a.length === 0) return e;
|
|
474
|
+
let o = s.id_field || "id";
|
|
178
475
|
try {
|
|
179
|
-
let c =
|
|
180
|
-
$filter: { [
|
|
181
|
-
$top:
|
|
182
|
-
})), l =
|
|
476
|
+
let c = r(await i.find(n, {
|
|
477
|
+
$filter: { [o]: { $in: a } },
|
|
478
|
+
$top: a.length
|
|
479
|
+
})), l = s.reference_field || s.display_field || "name", u = {};
|
|
183
480
|
for (let e of c) {
|
|
184
|
-
let t = String(e[
|
|
481
|
+
let t = String(e[o] ?? e.id ?? e._id ?? ""), n = e[l] || e.name || e.label || e.title || t;
|
|
185
482
|
t && (u[t] = String(n));
|
|
186
483
|
}
|
|
187
484
|
return e.map((e) => {
|
|
@@ -197,13 +494,17 @@ async function M(e, t, r, i) {
|
|
|
197
494
|
}
|
|
198
495
|
return e.map((e) => ({
|
|
199
496
|
...e,
|
|
200
|
-
[t]:
|
|
497
|
+
[t]: Q(String(e[t] ?? ""))
|
|
201
498
|
}));
|
|
202
499
|
}
|
|
203
|
-
var
|
|
204
|
-
let { schema: t } = e,
|
|
500
|
+
var $ = (e) => {
|
|
501
|
+
let { schema: t } = e, n = u(g), i = e.dataSource || n?.dataSource, a = _(t.bind), { fieldOptionLabel: o } = se(), s = p(o);
|
|
502
|
+
d(() => {
|
|
503
|
+
s.current = o;
|
|
504
|
+
}, [o]);
|
|
505
|
+
let [c, h] = m([]), [y, b] = m(!1), [x, C] = m(null), w = f(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), T = f(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), E = l(async (e, n) => {
|
|
205
506
|
if (!(!e || !t.objectName)) {
|
|
206
|
-
|
|
507
|
+
n.current && (b(!0), C(null));
|
|
207
508
|
try {
|
|
208
509
|
let i;
|
|
209
510
|
if (t.aggregate && typeof e.aggregate == "function") {
|
|
@@ -214,29 +515,29 @@ var N = (e) => {
|
|
|
214
515
|
filter: t.filter
|
|
215
516
|
});
|
|
216
517
|
i = Array.isArray(n) ? n : [];
|
|
217
|
-
} else if (typeof e.find == "function") i =
|
|
518
|
+
} else if (typeof e.find == "function") i = r(await e.find(t.objectName, { $filter: t.filter })), t.aggregate && i.length > 0 && (i = ce(i, t.aggregate));
|
|
218
519
|
else return;
|
|
219
520
|
let a = t.aggregate?.groupBy || t.xAxisKey;
|
|
220
521
|
if (a && typeof e.getObjectSchema == "function") try {
|
|
221
522
|
let n = await e.getObjectSchema(t.objectName);
|
|
222
|
-
i = await
|
|
523
|
+
i = await le(i, a, n, e, (e, n) => s.current(t.objectName, a, e, n));
|
|
223
524
|
} catch {}
|
|
224
|
-
|
|
525
|
+
n.current && h(i);
|
|
225
526
|
} catch (e) {
|
|
226
|
-
console.error("[ObjectChart] Fetch error:", e),
|
|
527
|
+
console.error("[ObjectChart] Fetch error:", e), n.current && C(e instanceof Error ? e.message : "Failed to load chart data");
|
|
227
528
|
} finally {
|
|
228
|
-
|
|
529
|
+
n.current && b(!1);
|
|
229
530
|
}
|
|
230
531
|
}
|
|
231
532
|
}, [
|
|
232
533
|
t.objectName,
|
|
233
|
-
|
|
234
|
-
|
|
534
|
+
w,
|
|
535
|
+
T,
|
|
235
536
|
t.xAxisKey
|
|
236
537
|
]);
|
|
237
|
-
|
|
538
|
+
d(() => {
|
|
238
539
|
let e = { current: !0 };
|
|
239
|
-
return t.objectName && !a && !t.data &&
|
|
540
|
+
return t.objectName && !a && !t.data && E(i, e), () => {
|
|
240
541
|
e.current = !1;
|
|
241
542
|
};
|
|
242
543
|
}, [
|
|
@@ -244,34 +545,34 @@ var N = (e) => {
|
|
|
244
545
|
i,
|
|
245
546
|
a,
|
|
246
547
|
t.data,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
548
|
+
T,
|
|
549
|
+
w,
|
|
550
|
+
E
|
|
250
551
|
]);
|
|
251
|
-
let
|
|
552
|
+
let D = a || t.data || c, O = Array.isArray(D) ? D : [], k = {
|
|
252
553
|
...t,
|
|
253
|
-
data:
|
|
554
|
+
data: O
|
|
254
555
|
};
|
|
255
|
-
return
|
|
556
|
+
return y && O.length === 0 ? /* @__PURE__ */ (0, v.jsx)("div", {
|
|
256
557
|
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
|
|
257
558
|
"data-testid": "chart-loading",
|
|
258
559
|
children: "Loading chart data…"
|
|
259
|
-
}) :
|
|
560
|
+
}) : x ? /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
260
561
|
className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
|
|
261
562
|
"data-testid": "chart-error",
|
|
262
563
|
role: "alert",
|
|
263
564
|
children: [
|
|
264
|
-
/* @__PURE__ */ (0,
|
|
265
|
-
/* @__PURE__ */ (0,
|
|
565
|
+
/* @__PURE__ */ (0, v.jsx)(ee, { className: "h-6 w-6 text-destructive opacity-60" }),
|
|
566
|
+
/* @__PURE__ */ (0, v.jsx)("p", {
|
|
266
567
|
className: "text-xs text-destructive font-medium",
|
|
267
568
|
children: "Failed to load chart data"
|
|
268
569
|
}),
|
|
269
|
-
/* @__PURE__ */ (0,
|
|
570
|
+
/* @__PURE__ */ (0, v.jsx)("p", {
|
|
270
571
|
className: "text-xs text-muted-foreground max-w-xs text-center",
|
|
271
|
-
children:
|
|
572
|
+
children: x
|
|
272
573
|
})
|
|
273
574
|
]
|
|
274
|
-
}) : !i && t.objectName &&
|
|
575
|
+
}) : !i && t.objectName && O.length === 0 ? /* @__PURE__ */ (0, v.jsxs)("div", {
|
|
275
576
|
className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
|
|
276
577
|
"data-testid": "chart-no-datasource",
|
|
277
578
|
children: [
|
|
@@ -279,12 +580,12 @@ var N = (e) => {
|
|
|
279
580
|
t.objectName,
|
|
280
581
|
"”"
|
|
281
582
|
]
|
|
282
|
-
}) : /* @__PURE__ */ (0,
|
|
583
|
+
}) : /* @__PURE__ */ (0, v.jsx)(S, {
|
|
283
584
|
...e,
|
|
284
|
-
schema:
|
|
585
|
+
schema: k
|
|
285
586
|
});
|
|
286
587
|
};
|
|
287
|
-
|
|
588
|
+
n.register("object-chart", $, {
|
|
288
589
|
namespace: "plugin-charts",
|
|
289
590
|
label: "Object Chart",
|
|
290
591
|
category: "view",
|
|
@@ -316,11 +617,11 @@ t.register("object-chart", N, {
|
|
|
316
617
|
});
|
|
317
618
|
//#endregion
|
|
318
619
|
//#region src/index.tsx
|
|
319
|
-
var
|
|
320
|
-
"bar-chart":
|
|
321
|
-
chart:
|
|
620
|
+
var ue = {
|
|
621
|
+
"bar-chart": x,
|
|
622
|
+
chart: S
|
|
322
623
|
};
|
|
323
|
-
|
|
624
|
+
n.register("bar-chart", x, {
|
|
324
625
|
namespace: "plugin-charts",
|
|
325
626
|
label: "Bar Chart",
|
|
326
627
|
category: "plugin",
|
|
@@ -384,7 +685,7 @@ t.register("bar-chart", v, {
|
|
|
384
685
|
height: 400,
|
|
385
686
|
color: "#8884d8"
|
|
386
687
|
}
|
|
387
|
-
}),
|
|
688
|
+
}), n.register("chart", $, {
|
|
388
689
|
namespace: "view",
|
|
389
690
|
category: "view",
|
|
390
691
|
label: "Chart",
|
|
@@ -411,7 +712,7 @@ t.register("bar-chart", v, {
|
|
|
411
712
|
label: "Value Field"
|
|
412
713
|
}
|
|
413
714
|
]
|
|
414
|
-
}),
|
|
715
|
+
}), n.register("chart", S, {
|
|
415
716
|
namespace: "plugin-charts",
|
|
416
717
|
label: "Chart",
|
|
417
718
|
category: "plugin",
|
|
@@ -523,31 +824,31 @@ t.register("bar-chart", v, {
|
|
|
523
824
|
xAxisKey: "name",
|
|
524
825
|
series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
|
|
525
826
|
}
|
|
526
|
-
}),
|
|
827
|
+
}), n.register("chart:bar", S, {
|
|
527
828
|
namespace: "plugin-charts",
|
|
528
829
|
label: "Bar Chart (Alias)",
|
|
529
830
|
category: "plugin",
|
|
530
831
|
defaultProps: { chartType: "bar" }
|
|
531
|
-
}),
|
|
832
|
+
}), n.register("pie-chart", S, {
|
|
532
833
|
namespace: "plugin-charts",
|
|
533
834
|
label: "Pie Chart",
|
|
534
835
|
category: "plugin",
|
|
535
836
|
defaultProps: { chartType: "pie" }
|
|
536
|
-
}),
|
|
837
|
+
}), n.register("donut-chart", S, {
|
|
537
838
|
namespace: "plugin-charts",
|
|
538
839
|
label: "Donut Chart",
|
|
539
840
|
category: "plugin",
|
|
540
841
|
defaultProps: { chartType: "donut" }
|
|
541
|
-
}),
|
|
842
|
+
}), n.register("radar-chart", S, {
|
|
542
843
|
namespace: "plugin-charts",
|
|
543
844
|
label: "Radar Chart",
|
|
544
845
|
category: "plugin",
|
|
545
846
|
defaultProps: { chartType: "radar" }
|
|
546
|
-
}),
|
|
847
|
+
}), n.register("scatter-chart", S, {
|
|
547
848
|
namespace: "plugin-charts",
|
|
548
849
|
label: "Scatter Chart",
|
|
549
850
|
category: "plugin",
|
|
550
851
|
defaultProps: { chartType: "scatter" }
|
|
551
852
|
});
|
|
552
853
|
//#endregion
|
|
553
|
-
export {
|
|
854
|
+
export { x as ChartBarRenderer, S as ChartRenderer, $ as ObjectChart, ue as chartComponents };
|