@antscorp/antsomi-genai 1.0.4 → 1.0.6
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/dist/{Component-B5BdubLB.mjs → Component-BKr0w4Us.mjs} +22 -22
- package/dist/{Component-DFkXgjdO.mjs → Component-BgBLJsOt.mjs} +26 -26
- package/dist/{Component-jz5SxZrw.mjs → Component-CTfDbD_d.mjs} +3 -3
- package/dist/{Component-D3IQ3b1e.mjs → Component-DCaEyotc.mjs} +11 -11
- package/dist/{Component-BMh2NjoG.mjs → Component-DKrH_QkH.mjs} +1 -1
- package/dist/{Component-Cs1Q5_4Z.mjs → Component-DOVG-vCq.mjs} +6 -6
- package/dist/{Component-cIhr0XF8.mjs → Component-DXg6OcXi.mjs} +3 -3
- package/dist/{Component-BtOlYW3V.mjs → Component-Deoa-f1C.mjs} +7 -7
- package/dist/{Component-ydRxUGBj.mjs → Component-JWAUzkP5.mjs} +10 -10
- package/dist/{Component-BfYdR2OG.mjs → Component-UboAHscO.mjs} +55 -58
- package/dist/{index-D4vz-jRA.mjs → index-B5HGiE1g.mjs} +5618 -5603
- package/dist/{index-DRw3mwoe.mjs → index-BunB7Zfa.mjs} +2 -2
- package/dist/{index-Kxt8Aex_.mjs → index-CQEJnKKK.mjs} +1 -1
- package/dist/{index-BEEl4Oav.mjs → index-Cmy0W3pf.mjs} +3 -3
- package/dist/{index-BKRp_b-R.mjs → index-DHqQn4M-.mjs} +1 -1
- package/dist/index-DUG__POS.mjs +5 -0
- package/dist/{index-Dl-606ht.mjs → index-Dh9EYLoH.mjs} +3 -3
- package/dist/{index-xRiS8mAv.mjs → index-DiwQ5kuX.mjs} +1 -1
- package/dist/{index-uuxjgmdq.mjs → index-JaNOziH3.mjs} +2 -2
- package/dist/index-RnRjfUZ7.mjs +5 -0
- package/dist/{index-BMMEF6Aa.mjs → index-j8mMwpTN.mjs} +16 -16
- package/dist/{index-B8aoEnXh.mjs → index-sCbsA1DR.mjs} +2 -2
- package/dist/{index-DznvLL2L.mjs → index-uqO3Q0gN.mjs} +3 -3
- package/dist/index.d.ts +86 -86
- package/dist/index.es.js +1 -1
- package/dist/main.css +1 -1
- package/dist/{useGetSchema-eOp9PT4q.mjs → useGetSchema-B4FeKOfN.mjs} +1 -1
- package/package.json +1 -1
- package/dist/index-Diw3uKxZ.mjs +0 -5
- package/dist/index-UbCk3cXH.mjs +0 -5
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Report as I } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as T } from "@antscorp/antsomi-ui";
|
|
3
|
-
import { useState as u, useEffect as
|
|
4
|
-
import { u as
|
|
5
|
-
import { k as R } from "./index-
|
|
6
|
-
import { v as y,
|
|
3
|
+
import { useState as u, useEffect as V, useMemo as v } from "react";
|
|
4
|
+
import { u as E } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { k as R } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { v as y, a7 as A, a8 as D, U as M } from "./index-B5HGiE1g.mjs";
|
|
7
7
|
function b(o = []) {
|
|
8
|
-
let
|
|
8
|
+
let n = o[0], r;
|
|
9
9
|
for (let e = 0; e < o.length; e++) {
|
|
10
10
|
const t = o[e];
|
|
11
|
-
(r == null || t < r) && (r = t,
|
|
11
|
+
(r == null || t < r) && (r = t, n = t);
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return n;
|
|
14
14
|
}
|
|
15
|
-
const l = (o,
|
|
15
|
+
const l = (o, n) => {
|
|
16
16
|
const r = [];
|
|
17
17
|
for (const e of o) {
|
|
18
18
|
const t = {
|
|
@@ -20,35 +20,35 @@ const l = (o, a) => {
|
|
|
20
20
|
nodes: []
|
|
21
21
|
};
|
|
22
22
|
if (Array.isArray(e.item))
|
|
23
|
-
for (const
|
|
24
|
-
|
|
23
|
+
for (const a of e.item)
|
|
24
|
+
a.aggregationType === "none" ? t[a.name] = a.value : t.aggregations = [
|
|
25
25
|
{
|
|
26
|
-
name:
|
|
27
|
-
type:
|
|
28
|
-
value:
|
|
26
|
+
name: a.name,
|
|
27
|
+
type: a.aggregationType,
|
|
28
|
+
value: a.value
|
|
29
29
|
}
|
|
30
30
|
];
|
|
31
31
|
e.nodes && (t.nodes = l(e.nodes)), r.push(t);
|
|
32
32
|
}
|
|
33
33
|
return r;
|
|
34
34
|
}, z = (o) => {
|
|
35
|
-
const { nodeViewProps:
|
|
35
|
+
const { nodeViewProps: n } = o, {
|
|
36
36
|
extension: { options: r },
|
|
37
37
|
node: e
|
|
38
|
-
} =
|
|
38
|
+
} = n, [t, a] = u(""), [d, p] = u(0), [s, f] = u(), { data: c, dataSourceSchema: m, isLoading: S, error: h } = E({
|
|
39
39
|
id: t,
|
|
40
40
|
attrs: s,
|
|
41
41
|
dataSourceId: d,
|
|
42
42
|
enabled: !!s
|
|
43
43
|
});
|
|
44
|
-
|
|
44
|
+
V(() => {
|
|
45
45
|
const { messageId: i, dataSourceId: w } = y({
|
|
46
46
|
messageId: D(),
|
|
47
47
|
dataSourceId: A()
|
|
48
48
|
}).parse(r);
|
|
49
|
-
f(R.parse(e.attrs)),
|
|
49
|
+
f(R.parse(e.attrs)), a(i), p(w);
|
|
50
50
|
}, [e.attrs, r]);
|
|
51
|
-
const g =
|
|
51
|
+
const g = v(() => {
|
|
52
52
|
if (!(c && s && m))
|
|
53
53
|
return null;
|
|
54
54
|
const i = M.nodeView.report.attrsToCompSetting({
|
|
@@ -62,17 +62,17 @@ const l = (o, a) => {
|
|
|
62
62
|
}, [c, s, m]);
|
|
63
63
|
return { data: g?.data, settings: g?.settings, isLoading: S, error: h };
|
|
64
64
|
}, { Treemap: N } = I, j = (o) => {
|
|
65
|
-
const { chartWrapperSize:
|
|
65
|
+
const { chartWrapperSize: n, renderDropdownAction: r } = o, { data: e, settings: t, isLoading: a } = z({
|
|
66
66
|
nodeViewProps: o
|
|
67
67
|
});
|
|
68
|
-
if (
|
|
68
|
+
if (a || !e || !t)
|
|
69
69
|
return /* @__PURE__ */ React.createElement(T, { indicatorSize: 20 });
|
|
70
|
-
const d = b([
|
|
70
|
+
const d = b([n?.width, 500]);
|
|
71
71
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
72
72
|
N,
|
|
73
73
|
{
|
|
74
74
|
levelToShow: t.levelToShow,
|
|
75
|
-
height:
|
|
75
|
+
height: n?.height,
|
|
76
76
|
width: d,
|
|
77
77
|
renderMetric: t.renderMetric,
|
|
78
78
|
dimension: t.dimension,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Report as ee } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as te } from "@antscorp/antsomi-ui";
|
|
3
|
-
import { U as x, x as ae, b as ie, v as ne,
|
|
4
|
-
import { useState as
|
|
5
|
-
import { G as le, u as me } from "./useGetSchema-
|
|
3
|
+
import { U as x, x as ae, b as ie, v as ne, a7 as se, a8 as re, a9 as oe } from "./index-B5HGiE1g.mjs";
|
|
4
|
+
import { useState as _, useEffect as q } from "react";
|
|
5
|
+
import { G as le, u as me } from "./useGetSchema-B4FeKOfN.mjs";
|
|
6
6
|
import "@tanstack/react-query";
|
|
7
7
|
import "@antscorp/antsomi-constants";
|
|
8
|
-
import { d as fe } from "./index-
|
|
8
|
+
import { d as fe } from "./index-j8mMwpTN.mjs";
|
|
9
9
|
function ce(T) {
|
|
10
10
|
const A = /D[0-9]+_/, O = (e) => e.aliasAggregation || e.aggregation || "", n = {
|
|
11
11
|
summary: 0,
|
|
@@ -16,11 +16,11 @@ function ce(T) {
|
|
|
16
16
|
}, { data: y, settings: C } = T, { style: B, dimension: k, breakdownDimension: P } = C, c = C.metric.map((e, i) => ({
|
|
17
17
|
...e,
|
|
18
18
|
key: `${e.name}_${i}`
|
|
19
|
-
})), { axes: H, showOtherBars: $ = !1, showOtherSeries: j = !1 } = B, K = H.mode || "double", M = P.length,
|
|
19
|
+
})), { axes: H, showOtherBars: $ = !1, showOtherSeries: j = !1 } = B, K = H.mode || "double", M = P.length, E = 6, N = 512;
|
|
20
20
|
let o = [], u = [];
|
|
21
|
-
const r = {},
|
|
21
|
+
const r = {}, L = [], w = [];
|
|
22
22
|
let U = 0, W = 0, X = [], h = B.maxBars;
|
|
23
|
-
const g = B.maxSeries ||
|
|
23
|
+
const g = B.maxSeries || E, { rows: Y } = y;
|
|
24
24
|
if (Y.length <= 0)
|
|
25
25
|
return { arrYAxis: [], data: [] };
|
|
26
26
|
const z = [];
|
|
@@ -31,13 +31,13 @@ function ce(T) {
|
|
|
31
31
|
for (let e = 0, i = y.rows.length; e < i; e++)
|
|
32
32
|
if (M && c[0].name) {
|
|
33
33
|
let t = y.rows[e].dimension.length;
|
|
34
|
-
if (t = t <
|
|
34
|
+
if (t = t < E ? t : E, typeof g == "number" && g > 0 && (t = +g < t ? g : t), F += t || 0, G = +t, F > N) {
|
|
35
35
|
R = e;
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
} else if (typeof y.rows[e].aggregations < "u") {
|
|
39
39
|
let t = y.rows[e].aggregations.length;
|
|
40
|
-
if (t = t <
|
|
40
|
+
if (t = t < E ? t : E, typeof g == "number" && g > 0 && (t = +g < t ? g : t), F += t || 0, G = +t, F > N) {
|
|
41
41
|
R = e;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
@@ -101,17 +101,17 @@ function ce(T) {
|
|
|
101
101
|
value: V,
|
|
102
102
|
field: P[0]
|
|
103
103
|
}).toString();
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
|
|
104
|
+
const v = s.id.toString() || s.name.toString() && x.helpers.changeSpecialCharacterToSnake(s.name.toString()) || "";
|
|
105
|
+
if (v) {
|
|
106
|
+
L.indexOf(v) < 0 && L.length < N && (w.push(s), S && (L.push(v), o.push({
|
|
107
107
|
yAxisId: "",
|
|
108
|
-
name: `D${
|
|
108
|
+
name: `D${v}`,
|
|
109
109
|
label: V,
|
|
110
110
|
key: c[0].key,
|
|
111
111
|
isActive: !0
|
|
112
|
-
}), X = [...X, `D${
|
|
112
|
+
}), X = [...X, `D${v}`])), ++t;
|
|
113
113
|
const p = a[d] ? +a[d] : 0;
|
|
114
|
-
S && (l[`D${
|
|
114
|
+
S && (l[`D${v}`] = p), S || (D += p), (S || !S && j) && (p < 0 ? I += p : m += p);
|
|
115
115
|
}
|
|
116
116
|
}), j)
|
|
117
117
|
D && (l["D-1"] = D);
|
|
@@ -127,8 +127,8 @@ function ce(T) {
|
|
|
127
127
|
if (z.indexOf(a.name) >= 0) {
|
|
128
128
|
const S = a.name, V = O(a);
|
|
129
129
|
if (S && e.aggregations.length > 0) {
|
|
130
|
-
const
|
|
131
|
-
|
|
130
|
+
const v = e.aggregations.find((p) => p.name === S && V === p.aggregationType);
|
|
131
|
+
v?.value && (s = v.value[0] ? v.value[0] : 0);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
s = +x.helpers.convertValueFromDataType({
|
|
@@ -165,8 +165,8 @@ function ce(T) {
|
|
|
165
165
|
let D = I;
|
|
166
166
|
if (l + 1 < +h)
|
|
167
167
|
D = [...D, b];
|
|
168
|
-
else if (
|
|
169
|
-
for (const a of
|
|
168
|
+
else if (w.length > 0)
|
|
169
|
+
for (const a of w) {
|
|
170
170
|
const d = `D${a.id || a.name && x.helpers.changeSpecialCharacterToSnake(a.name.toString()) || ""}`;
|
|
171
171
|
i[d] = i[d] ? (+i[d] || 0) + (+b[d] || 0) : b[d] || 0;
|
|
172
172
|
}
|
|
@@ -251,7 +251,7 @@ function ce(T) {
|
|
|
251
251
|
return {
|
|
252
252
|
data: u,
|
|
253
253
|
arrYAxis: o,
|
|
254
|
-
arrDimensions:
|
|
254
|
+
arrDimensions: w,
|
|
255
255
|
isAllBarOnLeft: J,
|
|
256
256
|
isAllBarOnRight: Z,
|
|
257
257
|
coordinateAxis: f,
|
|
@@ -262,16 +262,16 @@ const ge = (T) => {
|
|
|
262
262
|
const { nodeViewProps: A } = T, {
|
|
263
263
|
extension: { options: O },
|
|
264
264
|
node: n
|
|
265
|
-
} = A, y = ie(), [C, B] =
|
|
265
|
+
} = A, y = ie(), [C, B] = _(""), [k, P] = _(0), [c, H] = _(), [$, j] = _(), [K, M] = _(), { data: E } = le.query({
|
|
266
266
|
dataSourceId: k,
|
|
267
267
|
auth: y
|
|
268
268
|
});
|
|
269
269
|
q(() => {
|
|
270
|
-
const { messageId: r, dataSourceId:
|
|
270
|
+
const { messageId: r, dataSourceId: L } = ne({
|
|
271
271
|
messageId: re(),
|
|
272
272
|
dataSourceId: se()
|
|
273
273
|
}).parse(O);
|
|
274
|
-
H(fe.parse(n.attrs)), B(r), P(
|
|
274
|
+
H(fe.parse(n.attrs)), B(r), P(L);
|
|
275
275
|
}, [n.attrs, O]);
|
|
276
276
|
const {
|
|
277
277
|
data: N,
|
|
@@ -284,14 +284,14 @@ const ge = (T) => {
|
|
|
284
284
|
enabled: !!c
|
|
285
285
|
});
|
|
286
286
|
return q(() => {
|
|
287
|
-
if (!(N && c &&
|
|
287
|
+
if (!(N && c && E))
|
|
288
288
|
return;
|
|
289
289
|
const r = x.nodeView.report.attrsToCompSetting({
|
|
290
|
-
dataSourceSchema:
|
|
290
|
+
dataSourceSchema: E,
|
|
291
291
|
attrs: c
|
|
292
292
|
});
|
|
293
293
|
M(r), j(ce({ data: N, settings: r }));
|
|
294
|
-
}, [N, c,
|
|
294
|
+
}, [N, c, E]), { data: $, settings: K, isLoading: o, error: u };
|
|
295
295
|
};
|
|
296
296
|
function xe(T) {
|
|
297
297
|
const { chartWrapperSize: A, renderDropdownAction: O } = T, { data: n, settings: y, isLoading: C } = ge({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Spin as ow } from "@antscorp/antsomi-ui";
|
|
2
|
-
import {
|
|
2
|
+
import { ab as hi, K as ye, c as oe, U as gt, ac as gl, x as uw, ad as bl, a6 as sw, v as cw, a7 as lw, a8 as fw } from "./index-B5HGiE1g.mjs";
|
|
3
3
|
import { t as He } from "./toNumber-CHl49cGq.mjs";
|
|
4
4
|
import * as qt from "react";
|
|
5
5
|
import M, { isValidElement as ft, Children as Qt, PureComponent as Lt, forwardRef as Hb, useRef as Mi, useImperativeHandle as hw, useState as br, useCallback as dw, useEffect as ja, useMemo as Lf, cloneElement as Pe, createElement as Kb, useContext as jt, createContext as or, Component as Vb } from "react";
|
|
6
|
-
import { u as pw } from "./useGetSchema-
|
|
7
|
-
import { f as vw } from "./index-
|
|
6
|
+
import { u as pw } from "./useGetSchema-B4FeKOfN.mjs";
|
|
7
|
+
import { f as vw } from "./index-j8mMwpTN.mjs";
|
|
8
8
|
var fo, Kh;
|
|
9
9
|
function Be() {
|
|
10
10
|
if (Kh) return fo;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Report as B } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as K } from "@antscorp/antsomi-ui";
|
|
3
3
|
import { useState as z, useEffect as q, useMemo as G } from "react";
|
|
4
|
-
import { u as J } from "./useGetSchema-
|
|
5
|
-
import { e as Z } from "./index-
|
|
6
|
-
import { U as f,
|
|
4
|
+
import { u as J } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { e as Z } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { U as f, aa as Q, r as ee, v as te, a7 as ae, a8 as ne } from "./index-B5HGiE1g.mjs";
|
|
7
7
|
function oe(l, a) {
|
|
8
8
|
const n = /* @__PURE__ */ Object.create(null);
|
|
9
9
|
for (let t = 0; t < l.length; t++) {
|
|
@@ -170,18 +170,18 @@ const re = (l) => {
|
|
|
170
170
|
let O = !1, k = 0;
|
|
171
171
|
const Y = A.aliasAggregation || A.aggregation || "", j = typeof b.cellId == "string" ? b.cellId.split(";") : "", _ = typeof j[1] == "string" ? j[1].split(">") : [];
|
|
172
172
|
t.some((M) => {
|
|
173
|
-
const U = s.every((V,
|
|
174
|
-
const
|
|
175
|
-
return `${M[x]}` === L[
|
|
176
|
-
}), X = g.every((V,
|
|
177
|
-
const
|
|
178
|
-
return `${M[x]}` === _[
|
|
173
|
+
const U = s.every((V, N) => {
|
|
174
|
+
const E = f.helpers.getInfoFieldToQuery({ field: V }), x = `${E.name}-${E.semantics.semanticType}-${E.aggregationType}`.toLowerCase();
|
|
175
|
+
return `${M[x]}` === L[N];
|
|
176
|
+
}), X = g.every((V, N) => {
|
|
177
|
+
const E = f.helpers.getInfoFieldToQuery({ field: V }), x = `${E.name}-${E.semantics.semanticType}-${E.aggregationType}`.toLowerCase();
|
|
178
|
+
return `${M[x]}` === _[N];
|
|
179
179
|
});
|
|
180
180
|
if (U && X) {
|
|
181
181
|
if (Array.isArray(M.aggregations) && M.aggregations.length > 0) {
|
|
182
182
|
let V = 0;
|
|
183
|
-
for (const
|
|
184
|
-
|
|
183
|
+
for (const N of M.aggregations)
|
|
184
|
+
N.name === A.name && N.type === Y && (V += +N.value);
|
|
185
185
|
return O = !0, k += V, k;
|
|
186
186
|
}
|
|
187
187
|
return O = !0, k += +M[A.name], k;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Report as V } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as z } from "@antscorp/antsomi-ui";
|
|
3
|
-
import { useState as T, useEffect as
|
|
4
|
-
import { u as D } from "./useGetSchema-
|
|
5
|
-
import { h as Y } from "./index-
|
|
6
|
-
import {
|
|
3
|
+
import { useState as T, useEffect as C, useMemo as E } from "react";
|
|
4
|
+
import { u as D } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { h as Y } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { a9 as M, U as A, ae as v, ah as R, v as L, a7 as X, a8 as G } from "./index-B5HGiE1g.mjs";
|
|
7
7
|
function N(p, y, l) {
|
|
8
8
|
const { rows: n = [] } = p, i = [];
|
|
9
9
|
for (const o of n) {
|
|
@@ -100,13 +100,13 @@ const P = (p) => {
|
|
|
100
100
|
dataSourceId: f,
|
|
101
101
|
enabled: !!t
|
|
102
102
|
});
|
|
103
|
-
return
|
|
103
|
+
return C(() => {
|
|
104
104
|
const { messageId: k, dataSourceId: m } = L({
|
|
105
105
|
messageId: G(),
|
|
106
106
|
dataSourceId: X()
|
|
107
107
|
}).parse(l);
|
|
108
108
|
g(Y.parse(n.attrs)), o(k), S(m);
|
|
109
|
-
}, [n.attrs, l]), { ...
|
|
109
|
+
}, [n.attrs, l]), { ...E(() => {
|
|
110
110
|
if (!(h && t && r))
|
|
111
111
|
return null;
|
|
112
112
|
const k = A.nodeView.report.attrsToCompSetting({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getSizeOfText as ce, Report as ue } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as me } from "@antscorp/antsomi-ui";
|
|
3
3
|
import { useState as Z, useEffect as fe, useMemo as ee } from "react";
|
|
4
|
-
import { u as ge } from "./useGetSchema-
|
|
5
|
-
import { c as he } from "./index-
|
|
6
|
-
import { a1 as pe, U as h, x as de, a6 as te, v as ve,
|
|
4
|
+
import { u as ge } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { c as he } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { a1 as pe, U as h, x as de, a6 as te, v as ve, a7 as ye, a8 as De } from "./index-B5HGiE1g.mjs";
|
|
7
7
|
import { t as E } from "./toNumber-CHl49cGq.mjs";
|
|
8
8
|
function W(...y) {
|
|
9
9
|
return pe(y);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Report as I } from "@antscorp/antsomi-charts";
|
|
2
|
-
import { Spin as
|
|
3
|
-
import { useState as f, useEffect as
|
|
4
|
-
import { u as C } from "./useGetSchema-
|
|
5
|
-
import { j as D } from "./index-
|
|
6
|
-
import { U as h, v as N,
|
|
2
|
+
import { Spin as M } from "@antscorp/antsomi-ui";
|
|
3
|
+
import { useState as f, useEffect as E, useMemo as V } from "react";
|
|
4
|
+
import { u as C } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { j as D } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { U as h, v as N, a7 as R, a8 as b } from "./index-B5HGiE1g.mjs";
|
|
7
7
|
const y = (o) => {
|
|
8
8
|
const { data: i, settings: a } = o, s = h.helpers.safeParseListField(a.metric), n = (a.renderMetric ? h.helpers.safeParseListField(a.renderMetric) : s).at(0), u = [];
|
|
9
9
|
for (const d of i.rows) {
|
|
@@ -46,7 +46,7 @@ const y = (o) => {
|
|
|
46
46
|
dataSourceId: u,
|
|
47
47
|
enabled: !!t
|
|
48
48
|
});
|
|
49
|
-
|
|
49
|
+
E(() => {
|
|
50
50
|
const { messageId: g, dataSourceId: w } = N({
|
|
51
51
|
messageId: b(),
|
|
52
52
|
dataSourceId: R()
|
|
@@ -73,7 +73,7 @@ const y = (o) => {
|
|
|
73
73
|
const { chartWrapperSize: i, renderDropdownAction: a } = o, { data: s, settings: c, isLoading: n } = P({
|
|
74
74
|
nodeViewProps: o
|
|
75
75
|
});
|
|
76
|
-
return n || !s || !c ? /* @__PURE__ */ React.createElement(
|
|
76
|
+
return n || !s || !c ? /* @__PURE__ */ React.createElement(M, { indicatorSize: 20 }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
77
77
|
I.SunburstChart,
|
|
78
78
|
{
|
|
79
79
|
data: s,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Report as N } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as z } from "@antscorp/antsomi-ui";
|
|
3
|
-
import g, { forwardRef as C, useState as
|
|
4
|
-
import { u as
|
|
5
|
-
import { i as
|
|
6
|
-
import { a as I, j as f, v as j,
|
|
3
|
+
import g, { forwardRef as C, useState as v, useEffect as b, useMemo as w } from "react";
|
|
4
|
+
import { u as y } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { i as E } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { a as I, j as f, v as j, a7 as L, a8 as F, U as V } from "./index-B5HGiE1g.mjs";
|
|
7
7
|
const S = C((a, o) => {
|
|
8
8
|
const { width: s, height: e } = I(a);
|
|
9
9
|
return f.jsx("svg", { viewBox: "0 0 32 32", fill: "currentColor", ...a, ref: o, width: s, height: e, children: f.jsx("g", { transform: "scale(0.03125 0.03125)", children: f.jsx("path", { d: "M389.74 204.8v80.64h270.72l-476.16 476.16 57.6 57.6 476.16-476.16v270.72h80.64v-408.96z" }) }) });
|
|
@@ -59,24 +59,24 @@ const S = C((a, o) => {
|
|
|
59
59
|
const { nodeViewProps: o } = a, {
|
|
60
60
|
extension: { options: s },
|
|
61
61
|
node: e
|
|
62
|
-
} = o, [r, i] =
|
|
63
|
-
|
|
62
|
+
} = o, [r, i] = v(""), [h, m] = v(0), [d, p] = v();
|
|
63
|
+
b(() => {
|
|
64
64
|
const { messageId: x, dataSourceId: D } = j({
|
|
65
65
|
messageId: F(),
|
|
66
66
|
dataSourceId: L()
|
|
67
67
|
}).parse(s);
|
|
68
|
-
p(
|
|
68
|
+
p(E.parse(e.attrs)), i(x), m(D);
|
|
69
69
|
}, [e.attrs, s]);
|
|
70
|
-
const { data: u, dataSourceSchema: t, isLoading: l, error: c } =
|
|
70
|
+
const { data: u, dataSourceSchema: t, isLoading: l, error: c } = y({
|
|
71
71
|
id: r,
|
|
72
72
|
attrs: d,
|
|
73
73
|
dataSourceId: h,
|
|
74
74
|
enabled: !!d
|
|
75
|
-
}), n =
|
|
75
|
+
}), n = w(() => d && t ? V.nodeView.report.attrsToCompSetting({
|
|
76
76
|
dataSourceSchema: t,
|
|
77
77
|
attrs: d
|
|
78
78
|
}) : null, [d, t]);
|
|
79
|
-
return { data:
|
|
79
|
+
return { data: w(() => u && n ? M({
|
|
80
80
|
data: u,
|
|
81
81
|
settings: n
|
|
82
82
|
}) : null, [u, n])?.data, settings: n, isLoading: l, error: c };
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { Report as L } from "@antscorp/antsomi-charts";
|
|
2
2
|
import { Spin as M } from "@antscorp/antsomi-ui";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { u as _ } from "./useGetSchema-
|
|
5
|
-
import { g as z } from "./index-
|
|
6
|
-
import {
|
|
7
|
-
function W(c) {
|
|
8
|
-
return c === null;
|
|
9
|
-
}
|
|
3
|
+
import { useState as P, useEffect as T, useMemo as O } from "react";
|
|
4
|
+
import { u as _ } from "./useGetSchema-B4FeKOfN.mjs";
|
|
5
|
+
import { g as z } from "./index-j8mMwpTN.mjs";
|
|
6
|
+
import { ae as E, U as R, ac as H, af as F, ag as G, v as K, a7 as U, a8 as W } from "./index-B5HGiE1g.mjs";
|
|
10
7
|
const N = 10;
|
|
11
|
-
function Y(
|
|
12
|
-
const { apiData:
|
|
8
|
+
function Y(g) {
|
|
9
|
+
const { apiData: c, metrics: l, dimensions: s, numberOfSlice: m = N } = g;
|
|
13
10
|
function I() {
|
|
14
|
-
const { rows: t = [] } =
|
|
11
|
+
const { rows: t = [] } = c, r = [];
|
|
15
12
|
for (const a of t) {
|
|
16
13
|
const [i, S] = a;
|
|
17
|
-
|
|
14
|
+
r.push({
|
|
18
15
|
aggregations: [
|
|
19
16
|
{
|
|
20
17
|
name: S.name,
|
|
@@ -29,36 +26,36 @@ function Y(c) {
|
|
|
29
26
|
});
|
|
30
27
|
}
|
|
31
28
|
return {
|
|
32
|
-
...
|
|
33
|
-
rows:
|
|
29
|
+
...G(c, ["rows"]),
|
|
30
|
+
rows: r
|
|
34
31
|
};
|
|
35
32
|
}
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
const o =
|
|
40
|
-
if (!(e &&
|
|
33
|
+
const f = [], { rows: p } = I(), n = {};
|
|
34
|
+
let u, e = "", h = 0, v = 0, w = 0, y = 0;
|
|
35
|
+
l.length > 0 && (u = l[0], e = u.name || "");
|
|
36
|
+
const o = s.at(0);
|
|
37
|
+
if (!(e && u && o))
|
|
41
38
|
return { data: [], totalValue: 0 };
|
|
42
39
|
for (const t of p) {
|
|
43
|
-
let
|
|
40
|
+
let r = 0;
|
|
44
41
|
if (e && t.aggregations && t.aggregations.length > 0) {
|
|
45
42
|
const a = t.aggregations.find((i) => i.name === e);
|
|
46
|
-
a?.value && (
|
|
43
|
+
a?.value && (r = +a.value);
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
field:
|
|
50
|
-
value:
|
|
51
|
-
}), typeof n[e] != "number" && (n[e] = 0), n[e] +=
|
|
45
|
+
r = +E({
|
|
46
|
+
field: u,
|
|
47
|
+
value: r
|
|
48
|
+
}), typeof n[e] != "number" && (n[e] = 0), n[e] += r;
|
|
52
49
|
}
|
|
53
|
-
return p.forEach((t,
|
|
50
|
+
return p.forEach((t, r) => {
|
|
54
51
|
let a = t.dimension.name, i = 0, S = 0;
|
|
55
|
-
if (a &&
|
|
52
|
+
if (a && s.length > 0 && ["IMAGE", "HYPERLINK"].includes(s[0].dataType)) {
|
|
56
53
|
const d = R.helpers.formattedHyperlink(a, "—");
|
|
57
54
|
if (d.length <= 0)
|
|
58
55
|
return;
|
|
59
56
|
o.dataType === "IMAGE" ? a = d[0] : o.dataType === "HYPERLINK" && (a = d[1]);
|
|
60
57
|
}
|
|
61
|
-
if (a =
|
|
58
|
+
if (a = E({
|
|
62
59
|
value: a,
|
|
63
60
|
field: o
|
|
64
61
|
}).toString(), a = H({
|
|
@@ -68,48 +65,48 @@ function Y(c) {
|
|
|
68
65
|
const d = t.aggregations.find((C) => C.name === e);
|
|
69
66
|
d?.value && (i = +d.value);
|
|
70
67
|
}
|
|
71
|
-
i = +
|
|
68
|
+
i = +E({
|
|
72
69
|
value: i,
|
|
73
|
-
field:
|
|
70
|
+
field: u
|
|
74
71
|
}), h += i, typeof n[e] == "number" && (S = i / n[e] * 100);
|
|
75
|
-
const A = +t.dimension.id == -1, V = p.length, D = Math.min(V,
|
|
72
|
+
const A = +t.dimension.id == -1, V = p.length, D = Math.min(V, m) - 1, b = v === N - 1 && !A || V < N && m >= V;
|
|
76
73
|
if (v < D || b) {
|
|
77
74
|
const d = typeof t.dimension.id > "u" ? "" : t.dimension.id;
|
|
78
|
-
|
|
79
|
-
id:
|
|
75
|
+
f.push({
|
|
76
|
+
id: F(d) ? `null_${r}` : d,
|
|
80
77
|
name: a,
|
|
81
78
|
value: i,
|
|
82
79
|
percent: S
|
|
83
80
|
}), v++;
|
|
84
81
|
} else
|
|
85
|
-
w += i,
|
|
86
|
-
}),
|
|
82
|
+
w += i, r === p.length - 1 && typeof n[e] == "number" && (y = w / n[e] * 100);
|
|
83
|
+
}), f.push({
|
|
87
84
|
id: -1,
|
|
88
85
|
name: "Other",
|
|
89
86
|
value: w,
|
|
90
87
|
percent: y
|
|
91
88
|
}), {
|
|
92
|
-
data:
|
|
89
|
+
data: f.length > 0 ? f : [],
|
|
93
90
|
totalValue: h
|
|
94
91
|
};
|
|
95
92
|
}
|
|
96
|
-
const j = (
|
|
97
|
-
const { nodeViewProps:
|
|
98
|
-
extension: { options:
|
|
99
|
-
node:
|
|
100
|
-
} =
|
|
101
|
-
id:
|
|
93
|
+
const j = (g) => {
|
|
94
|
+
const { nodeViewProps: c } = g, {
|
|
95
|
+
extension: { options: l },
|
|
96
|
+
node: s
|
|
97
|
+
} = c, [m, I] = P(""), [f, p] = P(0), [n, u] = P(), { data: e, dataSourceSchema: h, isLoading: v, error: w } = _({
|
|
98
|
+
id: m,
|
|
102
99
|
attrs: n,
|
|
103
|
-
dataSourceId:
|
|
100
|
+
dataSourceId: f,
|
|
104
101
|
enabled: !!n
|
|
105
102
|
});
|
|
106
103
|
T(() => {
|
|
107
|
-
const { messageId: o, dataSourceId: t } =
|
|
108
|
-
messageId:
|
|
109
|
-
dataSourceId:
|
|
110
|
-
}).parse(
|
|
111
|
-
|
|
112
|
-
}, [
|
|
104
|
+
const { messageId: o, dataSourceId: t } = K({
|
|
105
|
+
messageId: W(),
|
|
106
|
+
dataSourceId: U()
|
|
107
|
+
}).parse(l);
|
|
108
|
+
u(z.parse(s.attrs)), I(o), p(t);
|
|
109
|
+
}, [s.attrs, l]);
|
|
113
110
|
const y = O(() => {
|
|
114
111
|
if (!(e && n && h))
|
|
115
112
|
return null;
|
|
@@ -127,21 +124,21 @@ const j = (c) => {
|
|
|
127
124
|
};
|
|
128
125
|
}, [e, n, h]);
|
|
129
126
|
return { data: y?.data, settings: y?.settings, isLoading: v, error: w };
|
|
130
|
-
}, J = (
|
|
131
|
-
const { chartWrapperSize:
|
|
132
|
-
nodeViewProps:
|
|
127
|
+
}, J = (g) => {
|
|
128
|
+
const { chartWrapperSize: c, renderDropdownAction: l } = g, { data: s, settings: m, isLoading: I } = j({
|
|
129
|
+
nodeViewProps: g
|
|
133
130
|
});
|
|
134
|
-
return I || !
|
|
131
|
+
return I || !s || !m || !c ? /* @__PURE__ */ React.createElement(M, { indicatorSize: 20 }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
135
132
|
L.PieChart,
|
|
136
133
|
{
|
|
137
|
-
data:
|
|
138
|
-
metric:
|
|
139
|
-
dimension:
|
|
134
|
+
data: s.data,
|
|
135
|
+
metric: m.metric,
|
|
136
|
+
dimension: m.dimension,
|
|
140
137
|
minWidthOfLegend: 200,
|
|
141
|
-
width:
|
|
142
|
-
height:
|
|
138
|
+
width: c.width,
|
|
139
|
+
height: c.height
|
|
143
140
|
}
|
|
144
|
-
),
|
|
141
|
+
), l(s.data));
|
|
145
142
|
};
|
|
146
143
|
export {
|
|
147
144
|
J as PieChartNodeView
|