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