@actionexec/dashboards 0.10.0 → 0.12.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/dist/{ColorPaletteSelector-CsByaRmM.js → ColorPaletteSelector-DJge9VhO.js} +101 -97
- package/dist/ColorPaletteSelector-DJge9VhO.js.map +1 -0
- package/dist/index.js +362 -339
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +2 -2
- package/dist/internals.js +42 -41
- package/dist/styles.css +1 -1
- package/dist/types/index.d.ts +40 -7
- package/package.json +1 -1
- package/dist/ColorPaletteSelector-CsByaRmM.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as v, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { f as me, a as fe, M as G, c as
|
|
4
|
-
import { A as
|
|
5
|
-
import { LineChart as
|
|
1
|
+
import { jsxs as v, jsx as a, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useRef as N, useEffect as P, useCallback as x, useMemo as ae } from "react";
|
|
3
|
+
import { f as me, a as fe, M as G, c as q, b as U, d as pe, e as le, i as Q, g as _e, p as be, h as V, j as ie, k as se, l as H, m as ve, D as J, S as we, n as ye, o as ke, C as Se, q as Ne, r as Ce, s as Re, t as $e, u as xe, G as Me, v as Z, w as Ae, x as Te } from "./ColorPaletteSelector-DJge9VhO.js";
|
|
4
|
+
import { A as Et } from "./ColorPaletteSelector-DJge9VhO.js";
|
|
5
|
+
import { LineChart as Ee, Line as Fe, AreaChart as Ie, Area as We, BarChart as ce, Bar as z, CartesianGrid as oe, XAxis as de, YAxis as ue, Tooltip as K, Legend as Le, Cell as B, PieChart as Oe, Pie as Pe } from "recharts";
|
|
6
6
|
const De = 300;
|
|
7
7
|
function He(e) {
|
|
8
|
-
const [t,
|
|
8
|
+
const [t, n] = E(null), [r, l] = E(null), [i, c] = E({}), [s, h] = E({}), [o, f] = E(null), [u, d] = E(!0), [g, b] = E(null), k = N(), C = N(!1);
|
|
9
9
|
P(() => {
|
|
10
10
|
let y = !1;
|
|
11
11
|
return me(e).then((w) => {
|
|
12
|
-
y ||
|
|
12
|
+
y || n(w);
|
|
13
13
|
}).catch((w) => {
|
|
14
14
|
y || b(w.message);
|
|
15
15
|
}), () => {
|
|
@@ -17,75 +17,75 @@ function He(e) {
|
|
|
17
17
|
};
|
|
18
18
|
}, [e]), P(() => {
|
|
19
19
|
if (t)
|
|
20
|
-
return
|
|
20
|
+
return k.current && clearTimeout(k.current), k.current = setTimeout(() => {
|
|
21
21
|
const y = Ye(i, s);
|
|
22
22
|
d(!0), fe(e, y).then((w) => {
|
|
23
|
-
l(w), !
|
|
23
|
+
l(w), !C.current && w.applied && (C.current = !0, c((m) => ({ ...Ge(w.applied), ...m }))), b(null);
|
|
24
24
|
}).catch((w) => b(w.message)).finally(() => d(!1));
|
|
25
25
|
}, De), () => {
|
|
26
|
-
|
|
26
|
+
k.current && clearTimeout(k.current);
|
|
27
27
|
};
|
|
28
28
|
}, [e, t, i, s]);
|
|
29
|
-
const
|
|
29
|
+
const M = x((y, w) => {
|
|
30
30
|
c((m) => ({ ...m, [y]: w }));
|
|
31
|
-
}, []),
|
|
31
|
+
}, []), S = x((y, w) => {
|
|
32
32
|
h((m) => ({ ...m, [y]: w }));
|
|
33
|
-
}, []),
|
|
34
|
-
|
|
33
|
+
}, []), T = x((y) => {
|
|
34
|
+
f(y);
|
|
35
35
|
}, []), $ = ae(
|
|
36
36
|
() => o ?? (t == null ? void 0 : t.palette) ?? [],
|
|
37
37
|
[o, t]
|
|
38
38
|
);
|
|
39
39
|
return {
|
|
40
40
|
layout: t,
|
|
41
|
-
renderData:
|
|
41
|
+
renderData: r,
|
|
42
42
|
loading: u,
|
|
43
|
-
error:
|
|
43
|
+
error: g,
|
|
44
44
|
filters: i,
|
|
45
45
|
variables: s,
|
|
46
46
|
palette: $,
|
|
47
|
-
setFilter:
|
|
48
|
-
setVariable:
|
|
49
|
-
setPalette:
|
|
47
|
+
setFilter: M,
|
|
48
|
+
setVariable: S,
|
|
49
|
+
setPalette: T
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function Ye(e, t) {
|
|
53
|
-
const
|
|
54
|
-
for (const [
|
|
53
|
+
const n = {};
|
|
54
|
+
for (const [r, l] of Object.entries(e))
|
|
55
55
|
if (l.includes("|")) {
|
|
56
56
|
const [i, c] = l.split("|");
|
|
57
|
-
i && (
|
|
57
|
+
i && (n.f_date_start = i), c && (n.f_date_end = c);
|
|
58
58
|
} else
|
|
59
|
-
|
|
60
|
-
for (const [
|
|
61
|
-
|
|
62
|
-
return
|
|
59
|
+
n[`f_${r}`] = l;
|
|
60
|
+
for (const [r, l] of Object.entries(t))
|
|
61
|
+
n[`v_${r}`] = String(l);
|
|
62
|
+
return n;
|
|
63
63
|
}
|
|
64
64
|
function Ge(e) {
|
|
65
65
|
const t = {};
|
|
66
|
-
for (const [
|
|
67
|
-
if (
|
|
68
|
-
const l =
|
|
69
|
-
t[
|
|
70
|
-
} else Array.isArray(
|
|
66
|
+
for (const [n, r] of Object.entries(e))
|
|
67
|
+
if (r && typeof r == "object" && "start" in r) {
|
|
68
|
+
const l = r;
|
|
69
|
+
t[n] = `${l.start || ""}|${l.end || ""}`;
|
|
70
|
+
} else Array.isArray(r) ? t[n] = r.join(G) : typeof r == "string" && (t[n] = r);
|
|
71
71
|
return t;
|
|
72
72
|
}
|
|
73
73
|
const ze = (e) => {
|
|
74
|
-
var t,
|
|
75
|
-
return ((
|
|
74
|
+
var t, n;
|
|
75
|
+
return ((n = (t = e.borderBoxSize) == null ? void 0 : t[0]) == null ? void 0 : n.inlineSize) ?? e.target.offsetWidth;
|
|
76
76
|
}, Ke = (e) => {
|
|
77
|
-
var t,
|
|
78
|
-
return ((
|
|
77
|
+
var t, n;
|
|
78
|
+
return ((n = (t = e.borderBoxSize) == null ? void 0 : t[0]) == null ? void 0 : n.blockSize) ?? e.target.offsetHeight;
|
|
79
79
|
};
|
|
80
|
-
function Ve(e, t,
|
|
81
|
-
return e === void 0 ? 0 : e === "auto" ? pe(t,
|
|
80
|
+
function Ve(e, t, n) {
|
|
81
|
+
return e === void 0 ? 0 : e === "auto" ? pe(t, n) : Math.max(0, e);
|
|
82
82
|
}
|
|
83
83
|
function je(e) {
|
|
84
84
|
let t = e.parentElement;
|
|
85
85
|
for (; t && t !== document.body && t !== document.documentElement; ) {
|
|
86
|
-
const { overflowY:
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
86
|
+
const { overflowY: n } = getComputedStyle(t);
|
|
87
|
+
if (n !== "visible")
|
|
88
|
+
return n === "hidden" || n === "clip" ? t : null;
|
|
89
89
|
t = t.parentElement;
|
|
90
90
|
}
|
|
91
91
|
return null;
|
|
@@ -93,64 +93,64 @@ function je(e) {
|
|
|
93
93
|
function Xe(e) {
|
|
94
94
|
const t = N(e);
|
|
95
95
|
t.current = e;
|
|
96
|
-
const
|
|
97
|
-
const _ =
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
!
|
|
101
|
-
`[@actionexec/dashboards] O dashboard esta sendo cortado: o container precisa de ${Math.ceil(m.gridHeight)}px de altura, mas o ancestral com overflow oculto tem ${
|
|
96
|
+
const n = N(null), r = N(null), l = N(null), i = N(null), c = N(null), s = N(0), h = N(0), o = N(!1), f = N(!1), u = N(-1), [d, g] = E(!1), b = x((m) => {
|
|
97
|
+
const _ = r.current;
|
|
98
|
+
if (f.current || t.current.silenceWarnings || !_) return;
|
|
99
|
+
const R = je(_);
|
|
100
|
+
!R || R.clientHeight >= m.gridHeight || (f.current = !0, console.warn(
|
|
101
|
+
`[@actionexec/dashboards] O dashboard esta sendo cortado: o container precisa de ${Math.ceil(m.gridHeight)}px de altura, mas o ancestral com overflow oculto tem ${R.clientHeight}px. A altura do dashboard varia com a largura — use a prop onGeometryChange para dimensionar o container, ou troque o overflow para auto. Passe silenceWarnings para desligar este aviso.`
|
|
102
102
|
));
|
|
103
|
-
}, []),
|
|
103
|
+
}, []), k = x(() => {
|
|
104
104
|
var O, I;
|
|
105
|
-
if (!
|
|
106
|
-
const { columns: m, cellAspect: _ } = t.current,
|
|
107
|
-
containerWidth:
|
|
105
|
+
if (!n.current) return;
|
|
106
|
+
const { columns: m, cellAspect: _ } = t.current, R = s.current, L = U(R, m), p = {
|
|
107
|
+
containerWidth: R,
|
|
108
108
|
cellWidth: L,
|
|
109
|
-
cellHeight:
|
|
109
|
+
cellHeight: q(L, _),
|
|
110
110
|
gridHeight: h.current,
|
|
111
111
|
stacked: o.current
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
}, [b]),
|
|
115
|
-
const _ =
|
|
112
|
+
}, A = c.current;
|
|
113
|
+
A && A.containerWidth === p.containerWidth && A.cellWidth === p.cellWidth && A.cellHeight === p.cellHeight && A.gridHeight === p.gridHeight && A.stacked === p.stacked || (c.current = p, (I = (O = t.current).onGeometryChange) == null || I.call(O, p), b(p));
|
|
114
|
+
}, [b]), C = x((m = !1) => {
|
|
115
|
+
const _ = n.current;
|
|
116
116
|
if (!_) return;
|
|
117
|
-
const
|
|
118
|
-
if (!m &&
|
|
119
|
-
u.current =
|
|
120
|
-
const { columns: L, cellAspect: p, stackBelow:
|
|
121
|
-
_.style.setProperty("--dash-cell-h", `${
|
|
122
|
-
const O = Ve(
|
|
123
|
-
I !== o.current && (o.current = I,
|
|
124
|
-
}, []),
|
|
117
|
+
const R = s.current;
|
|
118
|
+
if (!m && R === u.current) return;
|
|
119
|
+
u.current = R;
|
|
120
|
+
const { columns: L, cellAspect: p, stackBelow: A } = t.current, F = U(R, L);
|
|
121
|
+
_.style.setProperty("--dash-cell-h", `${q(F, p)}px`);
|
|
122
|
+
const O = Ve(A, L, p), I = O > 0 && R > 0 && R < O;
|
|
123
|
+
I !== o.current && (o.current = I, g(I));
|
|
124
|
+
}, []), M = x(() => {
|
|
125
125
|
i.current !== null && (cancelAnimationFrame(i.current), i.current = null);
|
|
126
|
-
}, []),
|
|
126
|
+
}, []), S = x(() => {
|
|
127
127
|
i.current === null && (i.current = requestAnimationFrame(() => {
|
|
128
|
-
i.current = null,
|
|
128
|
+
i.current = null, C(), k();
|
|
129
129
|
}));
|
|
130
|
-
}, [
|
|
130
|
+
}, [C, k]), T = x((m) => {
|
|
131
131
|
for (const _ of m)
|
|
132
|
-
_.target ===
|
|
133
|
-
|
|
134
|
-
}, [
|
|
132
|
+
_.target === n.current ? s.current = Math.round(ze(_)) : _.target === r.current && (h.current = Ke(_));
|
|
133
|
+
S();
|
|
134
|
+
}, [S]), $ = x(() => l.current ? l.current : typeof ResizeObserver > "u" ? null : (l.current = new ResizeObserver(T), l.current), [T]), y = x((m) => {
|
|
135
135
|
const _ = $();
|
|
136
|
-
|
|
137
|
-
}, [
|
|
136
|
+
n.current && (_ == null || _.unobserve(n.current)), n.current = m, m && (_ == null || _.observe(m), s.current = Math.round(m.getBoundingClientRect().width), C(!0), S());
|
|
137
|
+
}, [C, $, S]), w = x((m) => {
|
|
138
138
|
const _ = $();
|
|
139
|
-
if (
|
|
139
|
+
if (r.current && (_ == null || _.unobserve(r.current)), r.current = m, !m) {
|
|
140
140
|
h.current = 0;
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
_ == null || _.observe(m), h.current = m.getBoundingClientRect().height,
|
|
144
|
-
}, [$,
|
|
143
|
+
_ == null || _.observe(m), h.current = m.getBoundingClientRect().height, S();
|
|
144
|
+
}, [$, S]);
|
|
145
145
|
return P(() => {
|
|
146
146
|
const m = $();
|
|
147
|
-
return
|
|
147
|
+
return n.current && (m == null || m.observe(n.current)), r.current && (m == null || m.observe(r.current)), () => {
|
|
148
148
|
var _;
|
|
149
|
-
(_ = l.current) == null || _.disconnect(), l.current = null,
|
|
149
|
+
(_ = l.current) == null || _.disconnect(), l.current = null, M();
|
|
150
150
|
};
|
|
151
|
-
}, [$,
|
|
152
|
-
|
|
153
|
-
}, [e.columns, e.cellAspect, e.stackBelow,
|
|
151
|
+
}, [$, M]), P(() => {
|
|
152
|
+
n.current && (C(!0), S());
|
|
153
|
+
}, [e.columns, e.cellAspect, e.stackBelow, C, S]), { rootRef: y, gridRef: w, stacked: d };
|
|
154
154
|
}
|
|
155
155
|
const qe = {
|
|
156
156
|
empty: "Sem dados",
|
|
@@ -159,37 +159,37 @@ const qe = {
|
|
|
159
159
|
unconfigured: "Widget não configurado"
|
|
160
160
|
};
|
|
161
161
|
function j({ kind: e, message: t }) {
|
|
162
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ a("div", { className: `widget__state widget__state--${e}`, role: e === "error" ? "alert" : void 0, children: t || qe[e] });
|
|
163
163
|
}
|
|
164
|
-
function W({ name: e, title: t, state:
|
|
164
|
+
function W({ name: e, title: t, state: n, stateMessage: r, toolbar: l, children: i }) {
|
|
165
165
|
return /* @__PURE__ */ v("div", { className: `widget widget-${e}`, children: [
|
|
166
|
-
t && /* @__PURE__ */
|
|
166
|
+
t && /* @__PURE__ */ a("span", { className: "widget__title", children: t }),
|
|
167
167
|
l,
|
|
168
|
-
|
|
168
|
+
n ? /* @__PURE__ */ a(j, { kind: n, message: r }) : i
|
|
169
169
|
] });
|
|
170
170
|
}
|
|
171
171
|
const Ue = { up: "↑", down: "↓" };
|
|
172
|
-
function
|
|
172
|
+
function he(e) {
|
|
173
173
|
return Array.isArray(e) ? e.filter(
|
|
174
174
|
(t) => t && t.status === "ok" && t.formatted && t.formatted !== "-"
|
|
175
175
|
) : [];
|
|
176
176
|
}
|
|
177
177
|
function Qe({ comparison: e, primary: t }) {
|
|
178
|
-
const
|
|
179
|
-
return /* @__PURE__ */ v("div", { className: `widget-kpi__trend widget-kpi__trend--${
|
|
178
|
+
const n = e.sentiment ?? "neutral", r = Ue[e.trend ?? ""] ?? "";
|
|
179
|
+
return /* @__PURE__ */ v("div", { className: `widget-kpi__trend widget-kpi__trend--${n}${t ? "" : " widget-kpi__trend--muted"}`, children: [
|
|
180
180
|
/* @__PURE__ */ v("span", { className: "widget-kpi__variance", children: [
|
|
181
|
-
|
|
181
|
+
r,
|
|
182
182
|
" ",
|
|
183
183
|
e.formatted
|
|
184
184
|
] }),
|
|
185
|
-
e.label && /* @__PURE__ */
|
|
185
|
+
e.label && /* @__PURE__ */ a("span", { className: "widget-kpi__trend-label", children: e.label })
|
|
186
186
|
] });
|
|
187
187
|
}
|
|
188
188
|
function Je({ data: e, label: t }) {
|
|
189
|
-
const
|
|
190
|
-
return /* @__PURE__ */ v(W, { name: "kpi", title:
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
l.map((i, c) => /* @__PURE__ */
|
|
189
|
+
const n = t || String(e.label || ""), r = String(e.formatted || "-"), l = he(e.comparisons);
|
|
190
|
+
return /* @__PURE__ */ v(W, { name: "kpi", title: n, children: [
|
|
191
|
+
/* @__PURE__ */ a("span", { className: "widget-kpi__value", children: r }),
|
|
192
|
+
l.map((i, c) => /* @__PURE__ */ a(Qe, { comparison: i, primary: c === 0 }, i.id || c))
|
|
193
193
|
] });
|
|
194
194
|
}
|
|
195
195
|
const Ze = "var(--bg-elevated)", Be = [
|
|
@@ -199,30 +199,30 @@ const Ze = "var(--bg-elevated)", Be = [
|
|
|
199
199
|
[0.4, "var(--color-warning)"],
|
|
200
200
|
[0, "var(--color-error)"]
|
|
201
201
|
];
|
|
202
|
-
function
|
|
203
|
-
if (
|
|
204
|
-
if (
|
|
205
|
-
return `M ${e -
|
|
206
|
-
const l =
|
|
207
|
-
return `M ${e -
|
|
208
|
-
}
|
|
209
|
-
function et({ data: e, palette: t, label:
|
|
210
|
-
const
|
|
211
|
-
return /* @__PURE__ */
|
|
202
|
+
function ee(e, t, n, r) {
|
|
203
|
+
if (r <= 0) return "";
|
|
204
|
+
if (r >= 1)
|
|
205
|
+
return `M ${e - n} ${t} A ${n} ${n} 0 0 1 ${e} ${t - n} A ${n} ${n} 0 0 1 ${e + n} ${t}`;
|
|
206
|
+
const l = r * Math.PI;
|
|
207
|
+
return `M ${e - n} ${t} A ${n} ${n} 0 0 1 ${e - n * Math.cos(l)} ${t - n * Math.sin(l)}`;
|
|
208
|
+
}
|
|
209
|
+
function et({ data: e, palette: t, label: n }) {
|
|
210
|
+
const r = n || String(e.label || ""), l = typeof e.ratio == "number" ? e.ratio : 0, i = typeof e.format == "string" ? e.format : void 0, c = String(e.value_formatted || le(e.value, i)), s = String(e.formatted || "-"), h = he(e.comparisons), [o, ...f] = h, u = String((o == null ? void 0 : o.baseline_formatted) || "-"), d = (o == null ? void 0 : o.label) ?? null, g = l >= 1, b = Math.min(Math.max(l, 0), 1), k = Be.find(([y]) => l >= y), C = (k == null ? void 0 : k[1]) || t[0] || "var(--color-info)", M = 50, S = 50, T = 44, $ = 10;
|
|
211
|
+
return /* @__PURE__ */ a(W, { name: "gauge", title: r, children: /* @__PURE__ */ v("div", { className: "widget-gauge__chart", children: [
|
|
212
212
|
/* @__PURE__ */ v("svg", { viewBox: "0 0 100 56", preserveAspectRatio: "xMidYMax meet", role: "img", "aria-label": `${s} da meta`, children: [
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
b > 0 && /* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ a("path", { d: ee(M, S, T, 1), fill: "none", stroke: Ze, strokeWidth: $, strokeLinecap: "butt" }),
|
|
214
|
+
b > 0 && /* @__PURE__ */ a("path", { d: ee(M, S, T, b), fill: "none", stroke: C, strokeWidth: $, strokeLinecap: "butt" })
|
|
215
215
|
] }),
|
|
216
216
|
/* @__PURE__ */ v("div", { className: "widget-gauge__center", children: [
|
|
217
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ a("span", { className: "widget-gauge__percent", children: s }),
|
|
218
218
|
/* @__PURE__ */ v("span", { className: "widget-gauge__comparison", children: [
|
|
219
219
|
c,
|
|
220
220
|
" / ",
|
|
221
221
|
u
|
|
222
222
|
] }),
|
|
223
|
-
|
|
224
|
-
!
|
|
225
|
-
|
|
223
|
+
g && /* @__PURE__ */ a("span", { className: "widget-gauge__badge", children: d || "Meta batida" }),
|
|
224
|
+
!g && d && /* @__PURE__ */ a("span", { className: "widget-gauge__comparison", children: d }),
|
|
225
|
+
f.map((y, w) => /* @__PURE__ */ v("span", { className: "widget-gauge__comparison", children: [
|
|
226
226
|
y.formatted,
|
|
227
227
|
" ",
|
|
228
228
|
y.label
|
|
@@ -230,113 +230,113 @@ function et({ data: e, palette: t, label: a }) {
|
|
|
230
230
|
] })
|
|
231
231
|
] }) });
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
const [t,
|
|
233
|
+
function X(e) {
|
|
234
|
+
const [t, n] = E({ width: 0, height: 0 });
|
|
235
235
|
return P(() => {
|
|
236
|
-
const
|
|
237
|
-
if (!
|
|
236
|
+
const r = e.current;
|
|
237
|
+
if (!r) return;
|
|
238
238
|
const l = new ResizeObserver(([i]) => {
|
|
239
239
|
const { width: c, height: s } = i.contentRect;
|
|
240
|
-
|
|
240
|
+
n(
|
|
241
241
|
(h) => h.width !== Math.floor(c) || h.height !== Math.floor(s) ? { width: Math.floor(c), height: Math.floor(s) } : h
|
|
242
242
|
);
|
|
243
243
|
});
|
|
244
|
-
return l.observe(
|
|
244
|
+
return l.observe(r), () => l.disconnect();
|
|
245
245
|
}, [e]), t;
|
|
246
246
|
}
|
|
247
|
-
const
|
|
247
|
+
const te = { fontSize: 10, fill: "var(--text-muted)" }, tt = "var(--bg-elevated)", rt = {
|
|
248
248
|
backgroundColor: "var(--bg-elevated)",
|
|
249
249
|
border: "1px solid var(--bg-paper)",
|
|
250
250
|
borderRadius: "6px",
|
|
251
251
|
color: "var(--text-primary)"
|
|
252
|
-
},
|
|
252
|
+
}, nt = {
|
|
253
253
|
color: "var(--text-primary)",
|
|
254
254
|
fontWeight: 600
|
|
255
255
|
};
|
|
256
|
-
function
|
|
256
|
+
function at(e, t) {
|
|
257
257
|
var l;
|
|
258
|
-
const
|
|
259
|
-
return typeof
|
|
258
|
+
const n = Array.isArray(t) ? t[0] : void 0, r = (l = n == null ? void 0 : n.payload) == null ? void 0 : l.tooltipLabel;
|
|
259
|
+
return typeof r == "string" && r ? r : String(e ?? "");
|
|
260
260
|
}
|
|
261
|
-
function Y({ Chart: e, chartData: t, xKey:
|
|
261
|
+
function Y({ Chart: e, chartData: t, xKey: n, series: r, palette: l, renderSeries: i, width: c, height: s }) {
|
|
262
262
|
return /* @__PURE__ */ v(e, { data: t, width: c, height: s, children: [
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ a(oe, { strokeDasharray: "3 3", stroke: tt }),
|
|
264
|
+
/* @__PURE__ */ a(de, { dataKey: n, tick: te }),
|
|
265
|
+
/* @__PURE__ */ a(ue, { tick: te }),
|
|
266
|
+
/* @__PURE__ */ a(
|
|
267
267
|
K,
|
|
268
268
|
{
|
|
269
269
|
contentStyle: rt,
|
|
270
|
-
labelStyle:
|
|
271
|
-
labelFormatter:
|
|
270
|
+
labelStyle: nt,
|
|
271
|
+
labelFormatter: at,
|
|
272
272
|
cursor: { fill: "var(--bg-paper)", opacity: 0.3 }
|
|
273
273
|
}
|
|
274
274
|
),
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
r.length > 1 && /* @__PURE__ */ a(Le, {}),
|
|
276
|
+
r.map((h, o) => i(h, l[o % l.length], o))
|
|
277
277
|
] });
|
|
278
278
|
}
|
|
279
|
-
function lt({ data: e, palette: t, label:
|
|
280
|
-
const
|
|
281
|
-
if (o <= 0 ||
|
|
282
|
-
const d = { chartData: s, xKey: i, series: c, palette: t, width: o, height:
|
|
283
|
-
return
|
|
284
|
-
|
|
279
|
+
function lt({ data: e, palette: t, label: n }) {
|
|
280
|
+
const r = String(e.chartType || "bar"), l = n || String(e.label || ""), i = String(e.xKey || "label"), c = e.series || [], s = e.data || [], h = N(null), { width: o, height: f } = X(h), u = () => {
|
|
281
|
+
if (o <= 0 || f <= 0) return null;
|
|
282
|
+
const d = { chartData: s, xKey: i, series: c, palette: t, width: o, height: f };
|
|
283
|
+
return r === "line" ? /* @__PURE__ */ a(Y, { ...d, Chart: Ee, renderSeries: (g, b) => /* @__PURE__ */ a(
|
|
284
|
+
Fe,
|
|
285
285
|
{
|
|
286
286
|
type: "monotone",
|
|
287
|
-
dataKey:
|
|
288
|
-
name:
|
|
287
|
+
dataKey: g.key,
|
|
288
|
+
name: g.label,
|
|
289
289
|
stroke: b,
|
|
290
290
|
strokeWidth: 2,
|
|
291
291
|
dot: s.length <= 31
|
|
292
292
|
},
|
|
293
|
-
|
|
294
|
-
) }) :
|
|
293
|
+
g.key
|
|
294
|
+
) }) : r === "area" ? /* @__PURE__ */ a(Y, { ...d, Chart: Ie, renderSeries: (g, b) => /* @__PURE__ */ a(
|
|
295
295
|
We,
|
|
296
296
|
{
|
|
297
297
|
type: "monotone",
|
|
298
|
-
dataKey:
|
|
299
|
-
name:
|
|
298
|
+
dataKey: g.key,
|
|
299
|
+
name: g.label,
|
|
300
300
|
fill: b,
|
|
301
301
|
stroke: b,
|
|
302
302
|
fillOpacity: 0.3
|
|
303
303
|
},
|
|
304
|
-
|
|
305
|
-
) }) : /* @__PURE__ */
|
|
304
|
+
g.key
|
|
305
|
+
) }) : /* @__PURE__ */ a(Y, { ...d, Chart: ce, renderSeries: (g, b) => /* @__PURE__ */ a(
|
|
306
306
|
z,
|
|
307
307
|
{
|
|
308
|
-
dataKey:
|
|
309
|
-
name:
|
|
308
|
+
dataKey: g.key,
|
|
309
|
+
name: g.label,
|
|
310
310
|
fill: b,
|
|
311
311
|
radius: [3, 3, 0, 0]
|
|
312
312
|
},
|
|
313
|
-
|
|
313
|
+
g.key
|
|
314
314
|
) });
|
|
315
315
|
};
|
|
316
|
-
return /* @__PURE__ */
|
|
316
|
+
return /* @__PURE__ */ a(W, { name: "chart", title: l, children: /* @__PURE__ */ a("div", { ref: h, className: "widget-chart__container", children: s.length === 0 ? /* @__PURE__ */ a(j, { kind: "empty" }) : u() }) });
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const re = { fontSize: 10, fill: "var(--text-muted)" }, it = "var(--bg-elevated)", st = { fill: "var(--bg-paper)", opacity: 0.3 };
|
|
319
319
|
function ct(e) {
|
|
320
320
|
return e.kind === "anchor" ? "var(--color-accent)" : e.kind === "residual" ? "var(--color-warning)" : e.value < 0 ? "var(--color-error)" : "var(--color-success)";
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
var
|
|
324
|
-
const
|
|
325
|
-
return
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
322
|
+
function ne({ active: e, payload: t }) {
|
|
323
|
+
var r;
|
|
324
|
+
const n = e ? (r = t == null ? void 0 : t[0]) == null ? void 0 : r.payload : void 0;
|
|
325
|
+
return n ? /* @__PURE__ */ v("div", { className: "widget-composition__tooltip", children: [
|
|
326
|
+
/* @__PURE__ */ a("span", { className: "widget-composition__tooltip-label", children: n.label }),
|
|
327
|
+
/* @__PURE__ */ a("span", { className: "widget-composition__tooltip-value", children: n.formatted })
|
|
328
328
|
] }) : null;
|
|
329
329
|
}
|
|
330
|
-
function ot({ data: e, palette: t, label:
|
|
331
|
-
const
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
330
|
+
function ot({ data: e, palette: t, label: n }) {
|
|
331
|
+
const r = n || String(e.label || ""), l = String(e.display || "pie"), i = e.data || [], c = typeof e.format == "string" ? e.format : void 0, s = N(null), { width: h, height: o } = X(s), f = () => /* @__PURE__ */ v(ce, { data: i, width: h, height: o, children: [
|
|
332
|
+
/* @__PURE__ */ a(oe, { strokeDasharray: "3 3", stroke: it }),
|
|
333
|
+
/* @__PURE__ */ a(de, { dataKey: "label", tick: re, interval: 0 }),
|
|
334
|
+
/* @__PURE__ */ a(ue, { tick: re, tickFormatter: (d) => le(d, c) }),
|
|
335
|
+
/* @__PURE__ */ a(K, { content: /* @__PURE__ */ a(ne, {}), cursor: st }),
|
|
336
|
+
/* @__PURE__ */ a(z, { dataKey: "base", stackId: "bridge", fill: "none", fillOpacity: 0, isAnimationActive: !1 }),
|
|
337
|
+
/* @__PURE__ */ a(z, { dataKey: "span", stackId: "bridge", radius: [3, 3, 0, 0], children: i.map((d, g) => /* @__PURE__ */ a(B, { fill: ct(d) }, g)) })
|
|
338
338
|
] }), u = () => /* @__PURE__ */ v(Oe, { width: h, height: o, children: [
|
|
339
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ a(
|
|
340
340
|
Pe,
|
|
341
341
|
{
|
|
342
342
|
data: i,
|
|
@@ -345,69 +345,92 @@ function ot({ data: e, palette: t, label: a }) {
|
|
|
345
345
|
cx: "50%",
|
|
346
346
|
cy: "50%",
|
|
347
347
|
outerRadius: "75%",
|
|
348
|
-
label: ({ name: d, percent:
|
|
348
|
+
label: ({ name: d, percent: g }) => `${d}: ${(g * 100).toFixed(0)}%`,
|
|
349
349
|
labelLine: !1,
|
|
350
|
-
children: i.map((d,
|
|
350
|
+
children: i.map((d, g) => /* @__PURE__ */ a(B, { fill: t[g % t.length] }, g))
|
|
351
351
|
}
|
|
352
352
|
),
|
|
353
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ a(K, { content: /* @__PURE__ */ a(ne, {}) })
|
|
354
354
|
] });
|
|
355
|
-
return /* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ a(W, { name: "composition", title: r, children: /* @__PURE__ */ a("div", { ref: s, className: "widget-composition__container", children: i.length === 0 || h <= 0 || o <= 0 ? /* @__PURE__ */ a(j, { kind: "empty" }) : l === "bridge" ? f() : u() }) });
|
|
356
356
|
}
|
|
357
357
|
function dt(e, t) {
|
|
358
358
|
if (t !== "percentage") return "";
|
|
359
|
-
const
|
|
360
|
-
return Number.isNaN(
|
|
361
|
-
}
|
|
362
|
-
function ut(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
)
|
|
375
|
-
|
|
376
|
-
|
|
359
|
+
const n = Number(e);
|
|
360
|
+
return Number.isNaN(n) || n === 0 ? "" : n > 0 ? " widget-table__td--up" : " widget-table__td--down";
|
|
361
|
+
}
|
|
362
|
+
function ut(e, t, n, r) {
|
|
363
|
+
const l = (r == null ? void 0 : r.offsetHeight) ?? 0;
|
|
364
|
+
if (e === 0 || t <= 0 || l <= 0) return e;
|
|
365
|
+
const i = Math.floor((t - ((n == null ? void 0 : n.offsetHeight) ?? 0)) / l);
|
|
366
|
+
return Math.max(0, Math.min(e, i));
|
|
367
|
+
}
|
|
368
|
+
function ht({ data: e, label: t }) {
|
|
369
|
+
var d;
|
|
370
|
+
const n = e.columns || [], r = e.rows || [], l = e.overflow === "clip", i = e.indexColumn === !0, c = t || String(e.label || ""), s = N(null), h = N(null), o = N(null), { height: f } = X(s), u = l ? r.slice(0, ut(
|
|
371
|
+
r.length,
|
|
372
|
+
f,
|
|
373
|
+
h.current,
|
|
374
|
+
((d = o.current) == null ? void 0 : d.firstElementChild) ?? null
|
|
375
|
+
)) : r;
|
|
376
|
+
return n.length === 0 ? /* @__PURE__ */ a(
|
|
377
|
+
W,
|
|
377
378
|
{
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
"
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
379
|
+
name: "table",
|
|
380
|
+
title: c,
|
|
381
|
+
state: "unconfigured",
|
|
382
|
+
stateMessage: "Configure as colunas da tabela."
|
|
383
|
+
}
|
|
384
|
+
) : /* @__PURE__ */ a(W, { name: "table", title: c, children: /* @__PURE__ */ a(
|
|
385
|
+
"div",
|
|
386
|
+
{
|
|
387
|
+
ref: s,
|
|
388
|
+
className: `widget-table__scroll${l ? " widget-table__scroll--clip" : ""}`,
|
|
389
|
+
children: /* @__PURE__ */ v(
|
|
390
|
+
"table",
|
|
391
|
+
{
|
|
392
|
+
className: `widget-table__table${l && u.length < r.length ? "" : " widget-table__table--fill"}`,
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ a("thead", { ref: h, children: /* @__PURE__ */ v("tr", { children: [
|
|
395
|
+
i && /* @__PURE__ */ a("th", { className: "widget-table__th widget-table__th--index", children: "#" }),
|
|
396
|
+
n.map((g) => /* @__PURE__ */ a(
|
|
397
|
+
"th",
|
|
398
|
+
{
|
|
399
|
+
className: `widget-table__th${Q(g.format) ? " widget-table__th--num" : ""}`,
|
|
400
|
+
children: g.label || g.key
|
|
401
|
+
},
|
|
402
|
+
g.key
|
|
403
|
+
))
|
|
404
|
+
] }) }),
|
|
405
|
+
/* @__PURE__ */ a("tbody", { ref: o, children: u.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
|
|
406
|
+
"td",
|
|
407
|
+
{
|
|
408
|
+
className: "widget-table__td widget-table__td--placeholder",
|
|
409
|
+
colSpan: n.length + (i ? 1 : 0),
|
|
410
|
+
children: "Sem dados"
|
|
411
|
+
}
|
|
412
|
+
) }) : u.map((g, b) => /* @__PURE__ */ v("tr", { children: [
|
|
413
|
+
i && /* @__PURE__ */ a("td", { className: "widget-table__td widget-table__td--index", children: b + 1 }),
|
|
414
|
+
n.map((k) => {
|
|
415
|
+
const C = g[k.key], M = Q(k.format) ? " widget-table__td--num" : "";
|
|
416
|
+
return /* @__PURE__ */ a("td", { className: `widget-table__td${M}${dt(C, k.format)}`, children: _e(C, k.format) }, k.key);
|
|
417
|
+
})
|
|
418
|
+
] }, b)) })
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
)
|
|
422
|
+
}
|
|
423
|
+
) });
|
|
424
|
+
}
|
|
425
|
+
function gt({ config: e, value: t, options: n = [], dateBounds: r, onChange: l }) {
|
|
403
426
|
const i = e.filterType || "select", c = e.label || "Filtro", s = e.dateFilterMode || "range";
|
|
404
427
|
return /* @__PURE__ */ v("div", { className: "widget-filter", children: [
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
i === "date_range" ? s === "yearly" ? /* @__PURE__ */
|
|
407
|
-
|
|
428
|
+
/* @__PURE__ */ a("label", { className: "widget-filter__label", children: c }),
|
|
429
|
+
i === "date_range" ? s === "yearly" ? /* @__PURE__ */ a(ft, { value: t, dateBounds: r, onChange: l }) : s === "monthly" ? /* @__PURE__ */ a(pt, { value: t, dateBounds: r, onChange: l }) : s === "weekly" ? /* @__PURE__ */ a(_t, { value: t, dateBounds: r, onChange: l }) : /* @__PURE__ */ a(mt, { value: t, dateBounds: r, onChange: l }) : /* @__PURE__ */ a(
|
|
430
|
+
bt,
|
|
408
431
|
{
|
|
409
432
|
value: t,
|
|
410
|
-
options:
|
|
433
|
+
options: n,
|
|
411
434
|
multi: i === "multi_select",
|
|
412
435
|
searchable: e.searchable || !1,
|
|
413
436
|
onChange: l
|
|
@@ -415,137 +438,137 @@ function ht({ config: e, value: t, options: a = [], dateBounds: n, onChange: l }
|
|
|
415
438
|
)
|
|
416
439
|
] });
|
|
417
440
|
}
|
|
418
|
-
function
|
|
419
|
-
const [
|
|
441
|
+
function mt({ value: e, dateBounds: t, onChange: n }) {
|
|
442
|
+
const [r, l] = e ? e.split("|") : ["", ""];
|
|
420
443
|
return /* @__PURE__ */ v("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
|
|
444
|
+
/* @__PURE__ */ a(
|
|
445
|
+
J,
|
|
423
446
|
{
|
|
424
|
-
value:
|
|
447
|
+
value: r,
|
|
425
448
|
minIso: t == null ? void 0 : t.min,
|
|
426
449
|
maxIso: l || (t == null ? void 0 : t.max),
|
|
427
450
|
selectsStart: !0,
|
|
428
|
-
startIso:
|
|
451
|
+
startIso: r,
|
|
429
452
|
endIso: l,
|
|
430
453
|
placeholder: "Data inicial",
|
|
431
|
-
onChange: (i) =>
|
|
454
|
+
onChange: (i) => n(`${i}|${l}`)
|
|
432
455
|
}
|
|
433
456
|
),
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
|
|
457
|
+
/* @__PURE__ */ a(
|
|
458
|
+
J,
|
|
436
459
|
{
|
|
437
460
|
value: l,
|
|
438
|
-
minIso:
|
|
461
|
+
minIso: r || (t == null ? void 0 : t.min),
|
|
439
462
|
maxIso: t == null ? void 0 : t.max,
|
|
440
463
|
selectsEnd: !0,
|
|
441
|
-
startIso:
|
|
464
|
+
startIso: r,
|
|
442
465
|
endIso: l,
|
|
443
466
|
placeholder: "Data final",
|
|
444
|
-
onChange: (i) =>
|
|
467
|
+
onChange: (i) => n(`${r}|${i}`)
|
|
445
468
|
}
|
|
446
469
|
)
|
|
447
470
|
] });
|
|
448
471
|
}
|
|
449
|
-
function
|
|
450
|
-
const [
|
|
451
|
-
const
|
|
452
|
-
|
|
472
|
+
function ft({ value: e, dateBounds: t, onChange: n }) {
|
|
473
|
+
const [r] = e ? e.split("|") : [""], l = be(r), i = /* @__PURE__ */ new Date(), c = (l == null ? void 0 : l.year) ?? i.getFullYear(), s = V(t), h = (o) => {
|
|
474
|
+
const f = ke(o);
|
|
475
|
+
n(`${f.start}|${f.end}`);
|
|
453
476
|
};
|
|
454
|
-
return /* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ a("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ a(
|
|
455
478
|
"select",
|
|
456
479
|
{
|
|
457
480
|
className: "widget-filter__select",
|
|
458
481
|
value: c,
|
|
459
482
|
onChange: (o) => h(parseInt(o.target.value)),
|
|
460
|
-
children: s.map((o) => /* @__PURE__ */
|
|
483
|
+
children: s.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
|
|
461
484
|
}
|
|
462
485
|
) });
|
|
463
486
|
}
|
|
464
|
-
function
|
|
465
|
-
const [
|
|
466
|
-
const d = ye(
|
|
467
|
-
|
|
487
|
+
function pt({ value: e, dateBounds: t, onChange: n }) {
|
|
488
|
+
const [r] = e ? e.split("|") : [""], l = ie(r), i = /* @__PURE__ */ new Date(), c = (l == null ? void 0 : l.year) ?? i.getFullYear(), s = (l == null ? void 0 : l.month) ?? i.getMonth() + 1, h = V(t), o = (f, u) => {
|
|
489
|
+
const d = ye(f, u);
|
|
490
|
+
n(`${d.start}|${d.end}`);
|
|
468
491
|
};
|
|
469
492
|
return /* @__PURE__ */ v("div", { className: "widget-filter__date-range widget-filter__date-range--month", children: [
|
|
470
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ a(
|
|
471
494
|
"select",
|
|
472
495
|
{
|
|
473
496
|
className: "widget-filter__select",
|
|
474
497
|
value: s,
|
|
475
|
-
onChange: (
|
|
476
|
-
children:
|
|
498
|
+
onChange: (f) => o(c, parseInt(f.target.value)),
|
|
499
|
+
children: se.map((f, u) => /* @__PURE__ */ a("option", { value: u + 1, children: f }, u + 1))
|
|
477
500
|
}
|
|
478
501
|
),
|
|
479
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ a(
|
|
480
503
|
"select",
|
|
481
504
|
{
|
|
482
505
|
className: "widget-filter__select",
|
|
483
506
|
value: c,
|
|
484
|
-
onChange: (
|
|
485
|
-
children: h.map((
|
|
507
|
+
onChange: (f) => o(parseInt(f.target.value), s),
|
|
508
|
+
children: h.map((f) => /* @__PURE__ */ a("option", { value: f, children: f }, f))
|
|
486
509
|
}
|
|
487
510
|
)
|
|
488
511
|
] });
|
|
489
512
|
}
|
|
490
|
-
function
|
|
491
|
-
const [
|
|
513
|
+
function _t({ value: e, dateBounds: t, onChange: n }) {
|
|
514
|
+
const [r] = e ? e.split("|") : [""], l = ie(r), i = /* @__PURE__ */ new Date(), c = (l == null ? void 0 : l.year) ?? i.getFullYear(), s = (l == null ? void 0 : l.month) ?? i.getMonth() + 1, h = V(t), o = H(c, s), f = ve(r, c, s) || 1;
|
|
492
515
|
return /* @__PURE__ */ v("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
|
|
493
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ a(
|
|
494
517
|
"select",
|
|
495
518
|
{
|
|
496
519
|
className: "widget-filter__select",
|
|
497
520
|
value: c,
|
|
498
521
|
onChange: (u) => {
|
|
499
522
|
const d = parseInt(u.target.value), b = H(d, s)[0];
|
|
500
|
-
b &&
|
|
523
|
+
b && n(`${b.start}|${b.end}`);
|
|
501
524
|
},
|
|
502
|
-
children: h.map((u) => /* @__PURE__ */
|
|
525
|
+
children: h.map((u) => /* @__PURE__ */ a("option", { value: u, children: u }, u))
|
|
503
526
|
}
|
|
504
527
|
),
|
|
505
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ a(
|
|
506
529
|
"select",
|
|
507
530
|
{
|
|
508
531
|
className: "widget-filter__select",
|
|
509
532
|
value: s,
|
|
510
533
|
onChange: (u) => {
|
|
511
534
|
const d = parseInt(u.target.value), b = H(c, d)[0];
|
|
512
|
-
b &&
|
|
535
|
+
b && n(`${b.start}|${b.end}`);
|
|
513
536
|
},
|
|
514
|
-
children:
|
|
537
|
+
children: se.map((u, d) => /* @__PURE__ */ a("option", { value: d + 1, children: u }, d + 1))
|
|
515
538
|
}
|
|
516
539
|
),
|
|
517
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ a(
|
|
518
541
|
"select",
|
|
519
542
|
{
|
|
520
543
|
className: "widget-filter__select",
|
|
521
|
-
value:
|
|
544
|
+
value: f,
|
|
522
545
|
onChange: (u) => {
|
|
523
546
|
const d = o[parseInt(u.target.value) - 1];
|
|
524
|
-
d &&
|
|
547
|
+
d && n(`${d.start}|${d.end}`);
|
|
525
548
|
},
|
|
526
|
-
children: o.map((u) => /* @__PURE__ */
|
|
549
|
+
children: o.map((u) => /* @__PURE__ */ a("option", { value: u.index, children: u.label }, u.index))
|
|
527
550
|
}
|
|
528
551
|
)
|
|
529
552
|
] });
|
|
530
553
|
}
|
|
531
|
-
function
|
|
532
|
-
if (
|
|
533
|
-
return /* @__PURE__ */
|
|
554
|
+
function bt({ value: e, options: t, multi: n, searchable: r, onChange: l }) {
|
|
555
|
+
if (r)
|
|
556
|
+
return /* @__PURE__ */ a(
|
|
534
557
|
we,
|
|
535
558
|
{
|
|
536
559
|
value: e,
|
|
537
560
|
options: t,
|
|
538
|
-
multi:
|
|
561
|
+
multi: n,
|
|
539
562
|
onChange: l
|
|
540
563
|
}
|
|
541
564
|
);
|
|
542
|
-
if (
|
|
565
|
+
if (n) {
|
|
543
566
|
const i = e ? e.split(G) : [], c = (s) => {
|
|
544
567
|
const h = i.includes(s) ? i.filter((o) => o !== s) : [...i, s];
|
|
545
568
|
l(h.join(G));
|
|
546
569
|
};
|
|
547
570
|
return /* @__PURE__ */ v("div", { className: "widget-filter__multi", children: [
|
|
548
|
-
i.length > 0 && /* @__PURE__ */
|
|
571
|
+
i.length > 0 && /* @__PURE__ */ a(
|
|
549
572
|
"button",
|
|
550
573
|
{
|
|
551
574
|
type: "button",
|
|
@@ -555,7 +578,7 @@ function _t({ value: e, options: t, multi: a, searchable: n, onChange: l }) {
|
|
|
555
578
|
}
|
|
556
579
|
),
|
|
557
580
|
t.map((s) => /* @__PURE__ */ v("label", { className: "widget-filter__multi-option", children: [
|
|
558
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ a(
|
|
559
582
|
"input",
|
|
560
583
|
{
|
|
561
584
|
type: "checkbox",
|
|
@@ -574,88 +597,88 @@ function _t({ value: e, options: t, multi: a, searchable: n, onChange: l }) {
|
|
|
574
597
|
value: e,
|
|
575
598
|
onChange: (i) => l(i.target.value),
|
|
576
599
|
children: [
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
t.map((i) => /* @__PURE__ */
|
|
600
|
+
/* @__PURE__ */ a("option", { value: "", children: "Todos" }),
|
|
601
|
+
t.map((i) => /* @__PURE__ */ a("option", { value: i, children: i }, i))
|
|
579
602
|
]
|
|
580
603
|
}
|
|
581
604
|
);
|
|
582
605
|
}
|
|
583
|
-
const
|
|
606
|
+
const vt = {
|
|
584
607
|
currency: "R$",
|
|
585
608
|
percentage: "%"
|
|
586
609
|
};
|
|
587
|
-
function
|
|
588
|
-
const
|
|
610
|
+
function wt({ config: e, value: t, onChange: n }) {
|
|
611
|
+
const r = e.label || "Variavel", l = e.locked || !1, i = e.variableFormat || "number", c = vt[i] || "";
|
|
589
612
|
return /* @__PURE__ */ v("div", { className: `widget-variable ${l ? "widget-variable--locked" : ""}`, children: [
|
|
590
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ a("label", { className: "widget-variable__label", children: r }),
|
|
591
614
|
/* @__PURE__ */ v("div", { className: "widget-variable__input-wrapper", children: [
|
|
592
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ a(
|
|
593
616
|
"input",
|
|
594
617
|
{
|
|
595
618
|
className: "widget-variable__input",
|
|
596
619
|
type: "number",
|
|
597
620
|
value: t,
|
|
598
|
-
onChange: (s) =>
|
|
621
|
+
onChange: (s) => n(parseFloat(s.target.value) || 0),
|
|
599
622
|
disabled: l,
|
|
600
623
|
step: i === "integer" ? 1 : 0.01
|
|
601
624
|
}
|
|
602
625
|
),
|
|
603
|
-
c && /* @__PURE__ */
|
|
626
|
+
c && /* @__PURE__ */ a("span", { className: "widget-variable__suffix", children: c })
|
|
604
627
|
] }),
|
|
605
|
-
l && /* @__PURE__ */
|
|
628
|
+
l && /* @__PURE__ */ a("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
606
629
|
] });
|
|
607
630
|
}
|
|
608
|
-
function
|
|
609
|
-
const
|
|
631
|
+
function yt({ config: e, palette: t, onChange: n }) {
|
|
632
|
+
const r = e.label || "Cores", l = e.locked || !1;
|
|
610
633
|
return /* @__PURE__ */ v("div", { className: `widget-palette ${l ? "widget-palette--locked" : ""}`, children: [
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
l && /* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ a("label", { className: "widget-palette__label", children: r }),
|
|
635
|
+
/* @__PURE__ */ a(Se, { selected: t, onSelect: n, customMode: !0, disabled: l }),
|
|
636
|
+
l && /* @__PURE__ */ a("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
614
637
|
] });
|
|
615
638
|
}
|
|
616
|
-
const
|
|
639
|
+
const kt = {
|
|
617
640
|
failed_to_compute: "Não foi possível calcular este widget"
|
|
618
641
|
};
|
|
619
|
-
function
|
|
642
|
+
function St({
|
|
620
643
|
type: e,
|
|
621
644
|
computed: t,
|
|
622
|
-
palette:
|
|
623
|
-
config:
|
|
645
|
+
palette: n,
|
|
646
|
+
config: r,
|
|
624
647
|
filterValue: l,
|
|
625
648
|
filterOptions: i,
|
|
626
649
|
dateBounds: c,
|
|
627
650
|
onFilterChange: s,
|
|
628
651
|
variableValue: h,
|
|
629
652
|
onVariableChange: o,
|
|
630
|
-
onPaletteChange:
|
|
653
|
+
onPaletteChange: f
|
|
631
654
|
}) {
|
|
632
655
|
if (t.error)
|
|
633
|
-
return /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ a(
|
|
634
657
|
W,
|
|
635
658
|
{
|
|
636
659
|
name: e.replace("_", "-"),
|
|
637
|
-
title:
|
|
660
|
+
title: r == null ? void 0 : r.label,
|
|
638
661
|
state: "error",
|
|
639
|
-
stateMessage:
|
|
662
|
+
stateMessage: kt[String(t.error)]
|
|
640
663
|
}
|
|
641
664
|
);
|
|
642
|
-
const u = Ne(
|
|
665
|
+
const u = Ne(n);
|
|
643
666
|
switch (e) {
|
|
644
667
|
case "kpi_card":
|
|
645
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ a(Je, { data: t, label: r == null ? void 0 : r.label });
|
|
646
669
|
case "gauge":
|
|
647
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ a(et, { data: t, palette: u, label: r == null ? void 0 : r.label });
|
|
648
671
|
case "chart":
|
|
649
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ a(lt, { data: t, palette: u, label: r == null ? void 0 : r.label });
|
|
650
673
|
case "composition":
|
|
651
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ a(ot, { data: t, palette: u, label: r == null ? void 0 : r.label });
|
|
652
675
|
case "table":
|
|
653
|
-
return /* @__PURE__ */
|
|
676
|
+
return /* @__PURE__ */ a(ht, { data: t, label: r == null ? void 0 : r.label });
|
|
654
677
|
case "filter":
|
|
655
|
-
return
|
|
656
|
-
|
|
678
|
+
return r && s ? /* @__PURE__ */ a(
|
|
679
|
+
gt,
|
|
657
680
|
{
|
|
658
|
-
config:
|
|
681
|
+
config: r,
|
|
659
682
|
value: l || "",
|
|
660
683
|
options: i,
|
|
661
684
|
dateBounds: c,
|
|
@@ -663,9 +686,9 @@ function kt({
|
|
|
663
686
|
}
|
|
664
687
|
) : null;
|
|
665
688
|
case "variable": {
|
|
666
|
-
const d =
|
|
667
|
-
return d && o ? /* @__PURE__ */
|
|
668
|
-
|
|
689
|
+
const d = r;
|
|
690
|
+
return d && o ? /* @__PURE__ */ a(
|
|
691
|
+
wt,
|
|
669
692
|
{
|
|
670
693
|
config: d,
|
|
671
694
|
value: h ?? d.variableValue ?? 0,
|
|
@@ -674,24 +697,24 @@ function kt({
|
|
|
674
697
|
) : null;
|
|
675
698
|
}
|
|
676
699
|
case "color_palette":
|
|
677
|
-
return
|
|
678
|
-
|
|
700
|
+
return r && f ? /* @__PURE__ */ a(
|
|
701
|
+
yt,
|
|
679
702
|
{
|
|
680
|
-
config:
|
|
681
|
-
palette:
|
|
682
|
-
onChange:
|
|
703
|
+
config: r,
|
|
704
|
+
palette: n,
|
|
705
|
+
onChange: f
|
|
683
706
|
}
|
|
684
707
|
) : null;
|
|
685
708
|
default:
|
|
686
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ a(W, { name: "unknown", state: "unconfigured" });
|
|
687
710
|
}
|
|
688
711
|
}
|
|
689
|
-
const
|
|
690
|
-
function
|
|
712
|
+
const Nt = (e, t) => e.grid.y - t.grid.y || e.grid.x - t.grid.x;
|
|
713
|
+
function Mt({
|
|
691
714
|
token: e,
|
|
692
|
-
cellAspect: t =
|
|
693
|
-
stackBelow:
|
|
694
|
-
onGeometryChange:
|
|
715
|
+
cellAspect: t = Ae,
|
|
716
|
+
stackBelow: n,
|
|
717
|
+
onGeometryChange: r,
|
|
695
718
|
silenceWarnings: l,
|
|
696
719
|
className: i
|
|
697
720
|
}) {
|
|
@@ -700,85 +723,85 @@ function xt({
|
|
|
700
723
|
renderData: s,
|
|
701
724
|
loading: h,
|
|
702
725
|
error: o,
|
|
703
|
-
filters:
|
|
726
|
+
filters: f,
|
|
704
727
|
variables: u,
|
|
705
728
|
palette: d,
|
|
706
|
-
setFilter:
|
|
729
|
+
setFilter: g,
|
|
707
730
|
setVariable: b,
|
|
708
|
-
setPalette:
|
|
709
|
-
} = He(e), { rootRef:
|
|
731
|
+
setPalette: k
|
|
732
|
+
} = He(e), { rootRef: C, gridRef: M, stacked: S } = Xe({
|
|
710
733
|
columns: (c == null ? void 0 : c.gridColumns) ?? 0,
|
|
711
734
|
cellAspect: t,
|
|
712
|
-
stackBelow:
|
|
713
|
-
onGeometryChange:
|
|
735
|
+
stackBelow: n,
|
|
736
|
+
onGeometryChange: r,
|
|
714
737
|
silenceWarnings: l
|
|
715
|
-
}),
|
|
738
|
+
}), T = ae(() => {
|
|
716
739
|
const m = (c == null ? void 0 : c.widgets) ?? [];
|
|
717
|
-
return
|
|
718
|
-
}, [c == null ? void 0 : c.widgets,
|
|
719
|
-
"--dash-gap": `${
|
|
740
|
+
return S ? [...m].sort(Nt) : m;
|
|
741
|
+
}, [c == null ? void 0 : c.widgets, S]), $ = {
|
|
742
|
+
"--dash-gap": `${Z}px`,
|
|
720
743
|
"--dash-pad": `${Me}px`
|
|
721
744
|
}, y = ["preview-tab", i].filter(Boolean).join(" ");
|
|
722
745
|
let w;
|
|
723
746
|
if (o && !c)
|
|
724
|
-
w = /* @__PURE__ */
|
|
747
|
+
w = /* @__PURE__ */ a("div", { className: "preview-tab__error", children: o });
|
|
725
748
|
else if (!c)
|
|
726
|
-
w = /* @__PURE__ */
|
|
749
|
+
w = /* @__PURE__ */ a("div", { className: "preview-tab__loading", children: "Carregando dashboard..." });
|
|
727
750
|
else if (c.widgets.length === 0)
|
|
728
|
-
w = /* @__PURE__ */
|
|
751
|
+
w = /* @__PURE__ */ a("div", { className: "preview-tab__empty", children: "Este dashboard nao possui widgets." });
|
|
729
752
|
else {
|
|
730
|
-
const m = (s == null ? void 0 : s.widgets) ?? {}, _ = (s == null ? void 0 : s.date_bounds) ?? null,
|
|
753
|
+
const m = (s == null ? void 0 : s.widgets) ?? {}, _ = (s == null ? void 0 : s.date_bounds) ?? null, R = {
|
|
731
754
|
"--dash-cols": c.gridColumns,
|
|
732
755
|
"--dash-rows": c.gridRows,
|
|
733
756
|
...Ce(d)
|
|
734
|
-
}, L = ["preview-tab__grid",
|
|
757
|
+
}, L = ["preview-tab__grid", S && "preview-tab__grid--stacked"].filter(Boolean).join(" ");
|
|
735
758
|
w = /* @__PURE__ */ v(ge, { children: [
|
|
736
|
-
o && !s && /* @__PURE__ */
|
|
737
|
-
s && /* @__PURE__ */
|
|
738
|
-
const
|
|
759
|
+
o && !s && /* @__PURE__ */ a("div", { className: "preview-tab__error", children: o }),
|
|
760
|
+
s && /* @__PURE__ */ a("div", { className: L, style: R, ref: M, children: T.map((p) => {
|
|
761
|
+
const A = Re.has(p.type), F = m[p.id], O = S ? {
|
|
739
762
|
gridColumn: 1,
|
|
740
763
|
aspectRatio: `${xe(p.grid.w, p.grid.h, t)}`,
|
|
741
|
-
minHeight: `${$e(p.grid.h,
|
|
764
|
+
minHeight: `${$e(p.grid.h, Te, Z, 0)}px`
|
|
742
765
|
} : {
|
|
743
766
|
gridColumn: `${p.grid.x + 1} / span ${p.grid.w}`,
|
|
744
767
|
gridRow: `${p.grid.y + 1} / span ${p.grid.h}`
|
|
745
|
-
}, I = p.type === "variable" ? u[p.id] ?? (
|
|
746
|
-
return /* @__PURE__ */
|
|
768
|
+
}, I = p.type === "variable" ? u[p.id] ?? (F == null ? void 0 : F.value) ?? p.config.variableValue ?? 0 : void 0;
|
|
769
|
+
return /* @__PURE__ */ a(
|
|
747
770
|
"div",
|
|
748
771
|
{
|
|
749
|
-
className: `preview-tab__widget ${
|
|
772
|
+
className: `preview-tab__widget ${A ? "preview-tab__widget--control" : ""}`,
|
|
750
773
|
style: O,
|
|
751
|
-
children:
|
|
752
|
-
|
|
774
|
+
children: A || F ? /* @__PURE__ */ a(
|
|
775
|
+
St,
|
|
753
776
|
{
|
|
754
777
|
type: p.type,
|
|
755
|
-
computed:
|
|
778
|
+
computed: F || {},
|
|
756
779
|
palette: d,
|
|
757
780
|
config: p.config,
|
|
758
|
-
filterValue:
|
|
781
|
+
filterValue: f[p.id] || "",
|
|
759
782
|
filterOptions: (
|
|
760
783
|
// Estruturais: vem do /layout (cacheavel), nao do /render —
|
|
761
784
|
// recalcula-los a cada render custaria um DISTINCT por filtro.
|
|
762
785
|
p.type === "filter" ? p.config.availableValues ?? [] : []
|
|
763
786
|
),
|
|
764
787
|
dateBounds: _,
|
|
765
|
-
onFilterChange: (D) =>
|
|
788
|
+
onFilterChange: (D) => g(p.id, D),
|
|
766
789
|
variableValue: I,
|
|
767
790
|
onVariableChange: (D) => b(p.id, D),
|
|
768
|
-
onPaletteChange:
|
|
791
|
+
onPaletteChange: k
|
|
769
792
|
}
|
|
770
|
-
) : /* @__PURE__ */
|
|
793
|
+
) : /* @__PURE__ */ a("div", { className: "preview-tab__widget-loading", children: h ? "Carregando..." : "Sem dados" })
|
|
771
794
|
},
|
|
772
795
|
p.id
|
|
773
796
|
);
|
|
774
797
|
}) }),
|
|
775
|
-
h && s && /* @__PURE__ */
|
|
798
|
+
h && s && /* @__PURE__ */ a("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
|
|
776
799
|
] });
|
|
777
800
|
}
|
|
778
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ a("div", { className: y, style: $, ref: C, children: w });
|
|
779
802
|
}
|
|
780
803
|
export {
|
|
781
|
-
|
|
782
|
-
|
|
804
|
+
Et as ApiError,
|
|
805
|
+
Mt as Dashboard
|
|
783
806
|
};
|
|
784
807
|
//# sourceMappingURL=index.js.map
|