@actionexec/dashboards 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ColorPaletteSelector-CxUQv9E9.js → ColorPaletteSelector-nBO_fbbj.js} +214 -214
- package/dist/ColorPaletteSelector-nBO_fbbj.js.map +1 -0
- package/dist/api/params.d.ts +11 -0
- package/dist/index.js +524 -500
- package/dist/index.js.map +1 -1
- package/dist/internals.js +2 -2
- package/package.json +1 -1
- package/dist/ColorPaletteSelector-CxUQv9E9.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,343 +1,360 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { M as
|
|
4
|
-
import { E as
|
|
5
|
-
import { LineChart as
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
for (const [
|
|
1
|
+
import { jsxs as p, jsx as r, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import { useState as T, useRef as $, useEffect as D, useCallback as E, useMemo as ue } from "react";
|
|
3
|
+
import { M as V, f as Re, a as $e, c as Q, b as Z, d as Ce, e as me, i as J, g as z, p as Ae, h as q, j as he, k as fe, l as G, m as xe, r as Fe, D as ee, n as Me, o as Te, S as ge, C as Ee, q as Le, s as _e, t as Oe, u as Ie, v as Pe, G as De, w as te, x as We, y as ze, z as He, A as je, B as Ge } from "./ColorPaletteSelector-nBO_fbbj.js";
|
|
4
|
+
import { E as lr } from "./ColorPaletteSelector-nBO_fbbj.js";
|
|
5
|
+
import { LineChart as Ye, Line as Ve, AreaChart as Ke, Area as Ue, BarChart as pe, Bar as K, CartesianGrid as be, XAxis as ve, YAxis as we, Tooltip as U, Legend as qe, Cell as re, PieChart as Xe, Pie as Be } from "recharts";
|
|
6
|
+
function W(e, t = {}) {
|
|
7
|
+
const n = {};
|
|
8
|
+
for (const [a, l] of Object.entries(e))
|
|
9
9
|
if (l.includes("|")) {
|
|
10
10
|
const [s, c] = l.split("|");
|
|
11
|
-
s && (
|
|
11
|
+
s && (n.f_date_start = s), c && (n.f_date_end = c);
|
|
12
12
|
} else
|
|
13
|
-
|
|
14
|
-
for (const [
|
|
15
|
-
|
|
16
|
-
return
|
|
13
|
+
n[`f_${a}`] = l;
|
|
14
|
+
for (const [a, l] of Object.entries(t))
|
|
15
|
+
n[`v_${a}`] = String(l);
|
|
16
|
+
return n;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function H(e) {
|
|
19
|
+
return Object.keys(e).sort().map((t) => `${t}=${e[t]}`).join("&");
|
|
20
|
+
}
|
|
21
|
+
function ye(e, t) {
|
|
22
|
+
const n = Object.keys(e);
|
|
23
|
+
return n.length !== Object.keys(t).length ? !1 : n.every((a) => e[a] === t[a]);
|
|
24
|
+
}
|
|
25
|
+
function Ne(e) {
|
|
19
26
|
const t = {};
|
|
20
|
-
for (const [
|
|
21
|
-
if (
|
|
22
|
-
const l =
|
|
23
|
-
t[
|
|
24
|
-
} else Array.isArray(
|
|
27
|
+
for (const [n, a] of Object.entries(e))
|
|
28
|
+
if (a && typeof a == "object" && "start" in a) {
|
|
29
|
+
const l = a;
|
|
30
|
+
t[n] = `${l.start || ""}|${l.end || ""}`;
|
|
31
|
+
} else Array.isArray(a) ? t[n] = a.join(V) : typeof a == "string" && (t[n] = a);
|
|
25
32
|
return t;
|
|
26
33
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
29
|
-
const [t,
|
|
30
|
-
|
|
31
|
-
let
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
}).catch((
|
|
35
|
-
|
|
34
|
+
const Qe = 300;
|
|
35
|
+
function Ze(e) {
|
|
36
|
+
const [t, n] = T(null), [a, l] = T(null), [s, c] = T({}), [i, u] = T({}), [o, m] = T(null), [d, h] = T(!0), [_, v] = T(null), S = $(), R = $(!1), A = $(null), N = $(!1);
|
|
37
|
+
D(() => {
|
|
38
|
+
let f = !1;
|
|
39
|
+
return R.current = !1, A.current = null, N.current = !1, Re(e).then((g) => {
|
|
40
|
+
f || n(g);
|
|
41
|
+
}).catch((g) => {
|
|
42
|
+
f || v(g.message);
|
|
36
43
|
}), () => {
|
|
37
|
-
|
|
44
|
+
f = !0;
|
|
45
|
+
};
|
|
46
|
+
}, [e]), D(() => {
|
|
47
|
+
if (!t) return;
|
|
48
|
+
if (t.widgets.length === 0) {
|
|
49
|
+
h(!1);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const f = W(s, i), g = H(f);
|
|
53
|
+
if (g === A.current) return;
|
|
54
|
+
S.current && clearTimeout(S.current);
|
|
55
|
+
const C = N.current ? Qe : 0;
|
|
56
|
+
return S.current = setTimeout(() => {
|
|
57
|
+
h(!0), $e(e, f).then((M) => {
|
|
58
|
+
A.current = g, N.current = !0, l(M), !R.current && M.applied && (R.current = !0, c((b) => {
|
|
59
|
+
const w = { ...Ne(M.applied), ...b };
|
|
60
|
+
return ye(w, b) ? b : (A.current = H(W(w, i)), w);
|
|
61
|
+
})), v(null);
|
|
62
|
+
}).catch((M) => v(M.message)).finally(() => h(!1));
|
|
63
|
+
}, C), () => {
|
|
64
|
+
S.current && clearTimeout(S.current);
|
|
38
65
|
};
|
|
39
|
-
}, [e]), W(() => {
|
|
40
|
-
if (t)
|
|
41
|
-
return k.current && clearTimeout(k.current), k.current = setTimeout(() => {
|
|
42
|
-
const $ = K(s, i);
|
|
43
|
-
h(!0), ke(e, $).then((S) => {
|
|
44
|
-
l(S), !C.current && S.applied && (C.current = !0, c((_) => ({ ...we(S.applied), ..._ }))), b(null);
|
|
45
|
-
}).catch((S) => b(S.message)).finally(() => h(!1));
|
|
46
|
-
}, Xe), () => {
|
|
47
|
-
k.current && clearTimeout(k.current);
|
|
48
|
-
};
|
|
49
66
|
}, [e, t, s, i]);
|
|
50
|
-
const y =
|
|
51
|
-
c((
|
|
52
|
-
}, []),
|
|
53
|
-
u((
|
|
54
|
-
}, []),
|
|
55
|
-
m(
|
|
56
|
-
}, []), x =
|
|
67
|
+
const y = E((f, g) => {
|
|
68
|
+
c((C) => ({ ...C, [f]: g }));
|
|
69
|
+
}, []), k = E((f, g) => {
|
|
70
|
+
u((C) => ({ ...C, [f]: g }));
|
|
71
|
+
}, []), F = E((f) => {
|
|
72
|
+
m(f);
|
|
73
|
+
}, []), x = ue(
|
|
57
74
|
() => o ?? (t == null ? void 0 : t.palette) ?? [],
|
|
58
75
|
[o, t]
|
|
59
76
|
);
|
|
60
77
|
return {
|
|
61
78
|
layout: t,
|
|
62
|
-
renderData:
|
|
79
|
+
renderData: a,
|
|
63
80
|
loading: d,
|
|
64
|
-
error:
|
|
81
|
+
error: _,
|
|
65
82
|
filters: s,
|
|
66
83
|
variables: i,
|
|
67
84
|
palette: x,
|
|
68
85
|
setFilter: y,
|
|
69
|
-
setVariable:
|
|
70
|
-
setPalette:
|
|
86
|
+
setVariable: k,
|
|
87
|
+
setPalette: F
|
|
71
88
|
};
|
|
72
89
|
}
|
|
73
|
-
const
|
|
74
|
-
var t,
|
|
75
|
-
return ((
|
|
76
|
-
},
|
|
77
|
-
var t,
|
|
78
|
-
return ((
|
|
90
|
+
const Je = (e) => {
|
|
91
|
+
var t, n;
|
|
92
|
+
return ((n = (t = e.borderBoxSize) == null ? void 0 : t[0]) == null ? void 0 : n.inlineSize) ?? e.target.offsetWidth;
|
|
93
|
+
}, et = (e) => {
|
|
94
|
+
var t, n;
|
|
95
|
+
return ((n = (t = e.borderBoxSize) == null ? void 0 : t[0]) == null ? void 0 : n.blockSize) ?? e.target.offsetHeight;
|
|
79
96
|
};
|
|
80
|
-
function
|
|
81
|
-
return e === void 0 ? 0 : e === "auto" ? Ce(t,
|
|
97
|
+
function tt(e, t, n) {
|
|
98
|
+
return e === void 0 ? 0 : e === "auto" ? Ce(t, n) : Math.max(0, e);
|
|
82
99
|
}
|
|
83
|
-
function
|
|
100
|
+
function rt(e) {
|
|
84
101
|
let t = e.parentElement;
|
|
85
102
|
for (; t && t !== document.body && t !== document.documentElement; ) {
|
|
86
|
-
const { overflowY:
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
103
|
+
const { overflowY: n } = getComputedStyle(t);
|
|
104
|
+
if (n !== "visible")
|
|
105
|
+
return n === "hidden" || n === "clip" ? t : null;
|
|
89
106
|
t = t.parentElement;
|
|
90
107
|
}
|
|
91
108
|
return null;
|
|
92
109
|
}
|
|
93
|
-
function
|
|
94
|
-
const t =
|
|
110
|
+
function nt(e) {
|
|
111
|
+
const t = $(e);
|
|
95
112
|
t.current = e;
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
if (m.current || t.current.silenceWarnings || !
|
|
99
|
-
const
|
|
100
|
-
!
|
|
101
|
-
`[@actionexec/dashboards] O dashboard esta sendo cortado: o container precisa de ${Math.ceil(
|
|
113
|
+
const n = $(null), a = $(null), l = $(null), s = $(null), c = $(null), i = $(0), u = $(0), o = $(!1), m = $(!1), d = $(-1), [h, _] = T(!1), v = E((f) => {
|
|
114
|
+
const g = a.current;
|
|
115
|
+
if (m.current || t.current.silenceWarnings || !g) return;
|
|
116
|
+
const C = rt(g);
|
|
117
|
+
!C || C.clientHeight >= f.gridHeight || (m.current = !0, console.warn(
|
|
118
|
+
`[@actionexec/dashboards] O dashboard esta sendo cortado: o container precisa de ${Math.ceil(f.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
119
|
));
|
|
103
|
-
}, []),
|
|
104
|
-
var
|
|
105
|
-
if (!
|
|
106
|
-
const { columns:
|
|
107
|
-
containerWidth:
|
|
108
|
-
cellWidth:
|
|
109
|
-
cellHeight:
|
|
120
|
+
}, []), S = E(() => {
|
|
121
|
+
var P, O;
|
|
122
|
+
if (!n.current) return;
|
|
123
|
+
const { columns: f, cellAspect: g } = t.current, C = i.current, M = Z(C, f), b = {
|
|
124
|
+
containerWidth: C,
|
|
125
|
+
cellWidth: M,
|
|
126
|
+
cellHeight: Q(M, g),
|
|
110
127
|
gridHeight: u.current,
|
|
111
128
|
stacked: o.current
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
}, [
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
119
|
-
d.current =
|
|
120
|
-
const { columns:
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
}, []),
|
|
129
|
+
}, w = c.current;
|
|
130
|
+
w && w.containerWidth === b.containerWidth && w.cellWidth === b.cellWidth && w.cellHeight === b.cellHeight && w.gridHeight === b.gridHeight && w.stacked === b.stacked || (c.current = b, (O = (P = t.current).onGeometryChange) == null || O.call(P, b), v(b));
|
|
131
|
+
}, [v]), R = E((f = !1) => {
|
|
132
|
+
const g = n.current;
|
|
133
|
+
if (!g) return;
|
|
134
|
+
const C = i.current;
|
|
135
|
+
if (!f && C === d.current) return;
|
|
136
|
+
d.current = C;
|
|
137
|
+
const { columns: M, cellAspect: b, stackBelow: w } = t.current, L = Z(C, M);
|
|
138
|
+
g.style.setProperty("--dash-cell-h", `${Q(L, b)}px`);
|
|
139
|
+
const P = tt(w, M, b), O = P > 0 && C > 0 && C < P;
|
|
140
|
+
O !== o.current && (o.current = O, _(O));
|
|
141
|
+
}, []), A = E(() => {
|
|
125
142
|
s.current !== null && (cancelAnimationFrame(s.current), s.current = null);
|
|
126
|
-
}, []),
|
|
143
|
+
}, []), N = E(() => {
|
|
127
144
|
s.current === null && (s.current = requestAnimationFrame(() => {
|
|
128
|
-
s.current = null,
|
|
145
|
+
s.current = null, R(), S();
|
|
129
146
|
}));
|
|
130
|
-
}, [
|
|
131
|
-
for (const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, [
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
}, [
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
147
|
+
}, [R, S]), y = E((f) => {
|
|
148
|
+
for (const g of f)
|
|
149
|
+
g.target === n.current ? i.current = Math.round(Je(g)) : g.target === a.current && (u.current = et(g));
|
|
150
|
+
N();
|
|
151
|
+
}, [N]), k = E(() => l.current ? l.current : typeof ResizeObserver > "u" ? null : (l.current = new ResizeObserver(y), l.current), [y]), F = E((f) => {
|
|
152
|
+
const g = k();
|
|
153
|
+
n.current && (g == null || g.unobserve(n.current)), n.current = f, f && (g == null || g.observe(f), i.current = Math.round(f.getBoundingClientRect().width), R(!0), N());
|
|
154
|
+
}, [R, k, N]), x = E((f) => {
|
|
155
|
+
const g = k();
|
|
156
|
+
if (a.current && (g == null || g.unobserve(a.current)), a.current = f, !f) {
|
|
140
157
|
u.current = 0;
|
|
141
158
|
return;
|
|
142
159
|
}
|
|
143
|
-
|
|
144
|
-
}, [
|
|
145
|
-
return
|
|
146
|
-
const
|
|
147
|
-
return
|
|
148
|
-
var
|
|
149
|
-
(
|
|
160
|
+
g == null || g.observe(f), u.current = f.getBoundingClientRect().height, N();
|
|
161
|
+
}, [k, N]);
|
|
162
|
+
return D(() => {
|
|
163
|
+
const f = k();
|
|
164
|
+
return n.current && (f == null || f.observe(n.current)), a.current && (f == null || f.observe(a.current)), () => {
|
|
165
|
+
var g;
|
|
166
|
+
(g = l.current) == null || g.disconnect(), l.current = null, A();
|
|
150
167
|
};
|
|
151
|
-
}, [
|
|
152
|
-
|
|
153
|
-
}, [e.columns, e.cellAspect, e.stackBelow,
|
|
168
|
+
}, [k, A]), D(() => {
|
|
169
|
+
n.current && (R(!0), N());
|
|
170
|
+
}, [e.columns, e.cellAspect, e.stackBelow, R, N]), { rootRef: F, gridRef: x, stacked: h };
|
|
154
171
|
}
|
|
155
|
-
const
|
|
172
|
+
const at = {
|
|
156
173
|
empty: "Sem dados",
|
|
157
174
|
error: "Não foi possível carregar",
|
|
158
175
|
loading: "Carregando...",
|
|
159
176
|
unconfigured: "Widget não configurado"
|
|
160
177
|
};
|
|
161
|
-
function
|
|
162
|
-
return /* @__PURE__ */ r("div", { className: `widget__state widget__state--${e}`, role: e === "error" ? "alert" : void 0, children: t ||
|
|
178
|
+
function X({ kind: e, message: t }) {
|
|
179
|
+
return /* @__PURE__ */ r("div", { className: `widget__state widget__state--${e}`, role: e === "error" ? "alert" : void 0, children: t || at[e] });
|
|
163
180
|
}
|
|
164
|
-
function
|
|
165
|
-
return /* @__PURE__ */
|
|
181
|
+
function I({ name: e, title: t, state: n, stateMessage: a, toolbar: l, children: s }) {
|
|
182
|
+
return /* @__PURE__ */ p("div", { className: `widget widget-${e}`, children: [
|
|
166
183
|
t && /* @__PURE__ */ r("span", { className: "widget__title", children: t }),
|
|
167
184
|
l,
|
|
168
|
-
|
|
185
|
+
n ? /* @__PURE__ */ r(X, { kind: n, message: a }) : s
|
|
169
186
|
] });
|
|
170
187
|
}
|
|
171
|
-
const
|
|
172
|
-
function
|
|
188
|
+
const lt = { up: "↑", down: "↓" };
|
|
189
|
+
function Se(e) {
|
|
173
190
|
return Array.isArray(e) ? e.filter(
|
|
174
191
|
(t) => t && t.status === "ok" && t.formatted && t.formatted !== "-"
|
|
175
192
|
) : [];
|
|
176
193
|
}
|
|
177
|
-
function
|
|
178
|
-
const
|
|
179
|
-
return /* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
|
|
194
|
+
function st({ comparison: e, primary: t }) {
|
|
195
|
+
const n = e.sentiment ?? "neutral", a = lt[e.trend ?? ""] ?? "";
|
|
196
|
+
return /* @__PURE__ */ p("div", { className: `widget-kpi__trend widget-kpi__trend--${n}${t ? "" : " widget-kpi__trend--muted"}`, children: [
|
|
197
|
+
/* @__PURE__ */ p("span", { className: "widget-kpi__variance", children: [
|
|
198
|
+
a,
|
|
182
199
|
" ",
|
|
183
200
|
e.formatted
|
|
184
201
|
] }),
|
|
185
202
|
e.label && /* @__PURE__ */ r("span", { className: "widget-kpi__trend-label", children: e.label })
|
|
186
203
|
] });
|
|
187
204
|
}
|
|
188
|
-
function
|
|
189
|
-
const
|
|
190
|
-
return /* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */ r("span", { className: "widget-kpi__value", children:
|
|
192
|
-
l.map((s, c) => /* @__PURE__ */ r(
|
|
205
|
+
function it({ data: e, label: t }) {
|
|
206
|
+
const n = t || String(e.label || ""), a = String(e.formatted || "-"), l = Se(e.comparisons);
|
|
207
|
+
return /* @__PURE__ */ p(I, { name: "kpi", title: n, children: [
|
|
208
|
+
/* @__PURE__ */ r("span", { className: "widget-kpi__value", children: a }),
|
|
209
|
+
l.map((s, c) => /* @__PURE__ */ r(st, { comparison: s, primary: c === 0 }, s.id || c))
|
|
193
210
|
] });
|
|
194
211
|
}
|
|
195
|
-
const
|
|
212
|
+
const ot = "var(--bg-elevated)", ct = [
|
|
196
213
|
[1, "var(--color-success)"],
|
|
197
214
|
[0.7, ""],
|
|
198
215
|
// vazio = cor da serie 1 (destaque do dashboard)
|
|
199
216
|
[0.4, "var(--color-warning)"],
|
|
200
217
|
[0, "var(--color-error)"]
|
|
201
218
|
];
|
|
202
|
-
function
|
|
203
|
-
if (
|
|
204
|
-
if (
|
|
205
|
-
return `M ${e -
|
|
206
|
-
const l =
|
|
207
|
-
return `M ${e -
|
|
219
|
+
function ne(e, t, n, a) {
|
|
220
|
+
if (a <= 0) return "";
|
|
221
|
+
if (a >= 1)
|
|
222
|
+
return `M ${e - n} ${t} A ${n} ${n} 0 0 1 ${e} ${t - n} A ${n} ${n} 0 0 1 ${e + n} ${t}`;
|
|
223
|
+
const l = a * Math.PI;
|
|
224
|
+
return `M ${e - n} ${t} A ${n} ${n} 0 0 1 ${e - n * Math.cos(l)} ${t - n * Math.sin(l)}`;
|
|
208
225
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
return /* @__PURE__ */ r(
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */ r("path", { d:
|
|
214
|
-
|
|
226
|
+
function dt({ data: e, palette: t, label: n }) {
|
|
227
|
+
const a = n || String(e.label || ""), l = typeof e.ratio == "number" ? e.ratio : 0, s = typeof e.format == "string" ? e.format : void 0, c = String(e.value_formatted || me(e.value, s)), i = String(e.formatted || "-"), u = Se(e.comparisons), [o, ...m] = u, d = String((o == null ? void 0 : o.baseline_formatted) || "-"), h = (o == null ? void 0 : o.label) ?? null, _ = l >= 1, v = Math.min(Math.max(l, 0), 1), S = ct.find(([F]) => l >= F), R = (S == null ? void 0 : S[1]) || t[0] || "var(--color-info)", A = 50, N = 50, y = 44, k = 10;
|
|
228
|
+
return /* @__PURE__ */ r(I, { name: "gauge", title: a, children: /* @__PURE__ */ p("div", { className: "widget-gauge__chart", children: [
|
|
229
|
+
/* @__PURE__ */ p("svg", { viewBox: "0 0 100 56", preserveAspectRatio: "xMidYMax meet", role: "img", "aria-label": `${i} da meta`, children: [
|
|
230
|
+
/* @__PURE__ */ r("path", { d: ne(A, N, y, 1), fill: "none", stroke: ot, strokeWidth: k, strokeLinecap: "butt" }),
|
|
231
|
+
v > 0 && /* @__PURE__ */ r("path", { d: ne(A, N, y, v), fill: "none", stroke: R, strokeWidth: k, strokeLinecap: "butt" })
|
|
215
232
|
] }),
|
|
216
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ p("div", { className: "widget-gauge__center", children: [
|
|
217
234
|
/* @__PURE__ */ r("span", { className: "widget-gauge__percent", children: i }),
|
|
218
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ p("span", { className: "widget-gauge__comparison", children: [
|
|
219
236
|
c,
|
|
220
237
|
" / ",
|
|
221
238
|
d
|
|
222
239
|
] }),
|
|
223
|
-
|
|
224
|
-
!
|
|
225
|
-
m.map((
|
|
226
|
-
|
|
240
|
+
_ && /* @__PURE__ */ r("span", { className: "widget-gauge__badge", children: h || "Meta batida" }),
|
|
241
|
+
!_ && h && /* @__PURE__ */ r("span", { className: "widget-gauge__comparison", children: h }),
|
|
242
|
+
m.map((F, x) => /* @__PURE__ */ p("span", { className: "widget-gauge__comparison", children: [
|
|
243
|
+
F.formatted,
|
|
227
244
|
" ",
|
|
228
|
-
|
|
229
|
-
] },
|
|
245
|
+
F.label
|
|
246
|
+
] }, F.id || x))
|
|
230
247
|
] })
|
|
231
248
|
] }) });
|
|
232
249
|
}
|
|
233
|
-
function
|
|
234
|
-
const [t,
|
|
235
|
-
return
|
|
236
|
-
const
|
|
237
|
-
if (!
|
|
250
|
+
function B(e) {
|
|
251
|
+
const [t, n] = T({ width: 0, height: 0 });
|
|
252
|
+
return D(() => {
|
|
253
|
+
const a = e.current;
|
|
254
|
+
if (!a) return;
|
|
238
255
|
const l = new ResizeObserver(([s]) => {
|
|
239
256
|
const { width: c, height: i } = s.contentRect;
|
|
240
|
-
|
|
257
|
+
n(
|
|
241
258
|
(u) => u.width !== Math.floor(c) || u.height !== Math.floor(i) ? { width: Math.floor(c), height: Math.floor(i) } : u
|
|
242
259
|
);
|
|
243
260
|
});
|
|
244
|
-
return l.observe(
|
|
261
|
+
return l.observe(a), () => l.disconnect();
|
|
245
262
|
}, [e]), t;
|
|
246
263
|
}
|
|
247
|
-
const ae = { fontSize: 10, fill: "var(--text-muted)" },
|
|
264
|
+
const ae = { fontSize: 10, fill: "var(--text-muted)" }, ut = "var(--bg-elevated)", mt = {
|
|
248
265
|
backgroundColor: "var(--bg-elevated)",
|
|
249
266
|
border: "1px solid var(--bg-paper)",
|
|
250
267
|
borderRadius: "6px",
|
|
251
268
|
color: "var(--text-primary)"
|
|
252
|
-
},
|
|
269
|
+
}, ht = {
|
|
253
270
|
color: "var(--text-primary)",
|
|
254
271
|
fontWeight: 600
|
|
255
272
|
};
|
|
256
|
-
function
|
|
273
|
+
function ft(e, t) {
|
|
257
274
|
var l;
|
|
258
|
-
const
|
|
259
|
-
return typeof
|
|
275
|
+
const n = Array.isArray(t) ? t[0] : void 0, a = (l = n == null ? void 0 : n.payload) == null ? void 0 : l.tooltipLabel;
|
|
276
|
+
return typeof a == "string" && a ? a : String(e ?? "");
|
|
260
277
|
}
|
|
261
|
-
function
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */ r(
|
|
264
|
-
/* @__PURE__ */ r(
|
|
265
|
-
/* @__PURE__ */ r(
|
|
278
|
+
function Y({ Chart: e, chartData: t, xKey: n, series: a, palette: l, renderSeries: s, width: c, height: i }) {
|
|
279
|
+
return /* @__PURE__ */ p(e, { data: t, width: c, height: i, children: [
|
|
280
|
+
/* @__PURE__ */ r(be, { strokeDasharray: "3 3", stroke: ut }),
|
|
281
|
+
/* @__PURE__ */ r(ve, { dataKey: n, tick: ae }),
|
|
282
|
+
/* @__PURE__ */ r(we, { tick: ae }),
|
|
266
283
|
/* @__PURE__ */ r(
|
|
267
|
-
|
|
284
|
+
U,
|
|
268
285
|
{
|
|
269
|
-
contentStyle:
|
|
270
|
-
labelStyle:
|
|
271
|
-
labelFormatter:
|
|
286
|
+
contentStyle: mt,
|
|
287
|
+
labelStyle: ht,
|
|
288
|
+
labelFormatter: ft,
|
|
272
289
|
cursor: { fill: "var(--bg-paper)", opacity: 0.3 }
|
|
273
290
|
}
|
|
274
291
|
),
|
|
275
|
-
|
|
276
|
-
|
|
292
|
+
a.length > 1 && /* @__PURE__ */ r(qe, {}),
|
|
293
|
+
a.map((u, o) => s(u, l[o % l.length], o))
|
|
277
294
|
] });
|
|
278
295
|
}
|
|
279
|
-
function
|
|
280
|
-
const
|
|
296
|
+
function gt({ data: e, palette: t, label: n }) {
|
|
297
|
+
const a = String(e.chartType || "bar"), l = n || String(e.label || ""), s = String(e.xKey || "label"), c = e.series || [], i = e.data || [], u = $(null), { width: o, height: m } = B(u), d = () => {
|
|
281
298
|
if (o <= 0 || m <= 0) return null;
|
|
282
299
|
const h = { chartData: i, xKey: s, series: c, palette: t, width: o, height: m };
|
|
283
|
-
return
|
|
284
|
-
|
|
300
|
+
return a === "line" ? /* @__PURE__ */ r(Y, { ...h, Chart: Ye, renderSeries: (_, v) => /* @__PURE__ */ r(
|
|
301
|
+
Ve,
|
|
285
302
|
{
|
|
286
303
|
type: "monotone",
|
|
287
|
-
dataKey:
|
|
288
|
-
name:
|
|
289
|
-
stroke:
|
|
304
|
+
dataKey: _.key,
|
|
305
|
+
name: _.label,
|
|
306
|
+
stroke: v,
|
|
290
307
|
strokeWidth: 2,
|
|
291
308
|
dot: i.length <= 31
|
|
292
309
|
},
|
|
293
|
-
|
|
294
|
-
) }) :
|
|
295
|
-
|
|
310
|
+
_.key
|
|
311
|
+
) }) : a === "area" ? /* @__PURE__ */ r(Y, { ...h, Chart: Ke, renderSeries: (_, v) => /* @__PURE__ */ r(
|
|
312
|
+
Ue,
|
|
296
313
|
{
|
|
297
314
|
type: "monotone",
|
|
298
|
-
dataKey:
|
|
299
|
-
name:
|
|
300
|
-
fill:
|
|
301
|
-
stroke:
|
|
315
|
+
dataKey: _.key,
|
|
316
|
+
name: _.label,
|
|
317
|
+
fill: v,
|
|
318
|
+
stroke: v,
|
|
302
319
|
fillOpacity: 0.3
|
|
303
320
|
},
|
|
304
|
-
|
|
305
|
-
) }) : /* @__PURE__ */ r(
|
|
306
|
-
|
|
321
|
+
_.key
|
|
322
|
+
) }) : /* @__PURE__ */ r(Y, { ...h, Chart: pe, renderSeries: (_, v) => /* @__PURE__ */ r(
|
|
323
|
+
K,
|
|
307
324
|
{
|
|
308
|
-
dataKey:
|
|
309
|
-
name:
|
|
310
|
-
fill:
|
|
325
|
+
dataKey: _.key,
|
|
326
|
+
name: _.label,
|
|
327
|
+
fill: v,
|
|
311
328
|
radius: [3, 3, 0, 0]
|
|
312
329
|
},
|
|
313
|
-
|
|
330
|
+
_.key
|
|
314
331
|
) });
|
|
315
332
|
};
|
|
316
|
-
return /* @__PURE__ */ r(
|
|
333
|
+
return /* @__PURE__ */ r(I, { name: "chart", title: l, children: /* @__PURE__ */ r("div", { ref: u, className: "widget-chart__container", children: i.length === 0 ? /* @__PURE__ */ r(X, { kind: "empty" }) : d() }) });
|
|
317
334
|
}
|
|
318
|
-
const
|
|
319
|
-
function
|
|
335
|
+
const le = { fontSize: 10, fill: "var(--text-muted)" }, _t = "var(--bg-elevated)", pt = { fill: "var(--bg-paper)", opacity: 0.3 };
|
|
336
|
+
function bt(e) {
|
|
320
337
|
return e.kind === "anchor" ? "var(--color-accent)" : e.kind === "residual" ? "var(--color-warning)" : e.value < 0 ? "var(--color-error)" : "var(--color-success)";
|
|
321
338
|
}
|
|
322
|
-
function
|
|
323
|
-
var
|
|
324
|
-
const
|
|
325
|
-
return
|
|
326
|
-
/* @__PURE__ */ r("span", { className: "widget-composition__tooltip-label", children:
|
|
327
|
-
/* @__PURE__ */ r("span", { className: "widget-composition__tooltip-value", children:
|
|
339
|
+
function se({ active: e, payload: t }) {
|
|
340
|
+
var a;
|
|
341
|
+
const n = e ? (a = t == null ? void 0 : t[0]) == null ? void 0 : a.payload : void 0;
|
|
342
|
+
return n ? /* @__PURE__ */ p("div", { className: "widget-composition__tooltip", children: [
|
|
343
|
+
/* @__PURE__ */ r("span", { className: "widget-composition__tooltip-label", children: n.label }),
|
|
344
|
+
/* @__PURE__ */ r("span", { className: "widget-composition__tooltip-value", children: n.formatted })
|
|
328
345
|
] }) : null;
|
|
329
346
|
}
|
|
330
|
-
function
|
|
331
|
-
const
|
|
332
|
-
/* @__PURE__ */ r(
|
|
333
|
-
/* @__PURE__ */ r(
|
|
334
|
-
/* @__PURE__ */ r(
|
|
335
|
-
/* @__PURE__ */ r(
|
|
336
|
-
/* @__PURE__ */ r(
|
|
337
|
-
/* @__PURE__ */ r(
|
|
338
|
-
] }), d = () => /* @__PURE__ */
|
|
347
|
+
function vt({ data: e, palette: t, label: n }) {
|
|
348
|
+
const a = n || String(e.label || ""), l = String(e.display || "pie"), s = e.data || [], c = typeof e.format == "string" ? e.format : void 0, i = $(null), { width: u, height: o } = B(i), m = () => /* @__PURE__ */ p(pe, { data: s, width: u, height: o, children: [
|
|
349
|
+
/* @__PURE__ */ r(be, { strokeDasharray: "3 3", stroke: _t }),
|
|
350
|
+
/* @__PURE__ */ r(ve, { dataKey: "label", tick: le, interval: 0 }),
|
|
351
|
+
/* @__PURE__ */ r(we, { tick: le, tickFormatter: (h) => me(h, c) }),
|
|
352
|
+
/* @__PURE__ */ r(U, { content: /* @__PURE__ */ r(se, {}), cursor: pt }),
|
|
353
|
+
/* @__PURE__ */ r(K, { dataKey: "base", stackId: "bridge", fill: "none", fillOpacity: 0, isAnimationActive: !1 }),
|
|
354
|
+
/* @__PURE__ */ r(K, { dataKey: "span", stackId: "bridge", radius: [3, 3, 0, 0], children: s.map((h, _) => /* @__PURE__ */ r(re, { fill: bt(h) }, _)) })
|
|
355
|
+
] }), d = () => /* @__PURE__ */ p(Xe, { width: u, height: o, children: [
|
|
339
356
|
/* @__PURE__ */ r(
|
|
340
|
-
|
|
357
|
+
Be,
|
|
341
358
|
{
|
|
342
359
|
data: s,
|
|
343
360
|
dataKey: "value",
|
|
@@ -345,104 +362,104 @@ function pt({ data: e, palette: t, label: a }) {
|
|
|
345
362
|
cx: "50%",
|
|
346
363
|
cy: "50%",
|
|
347
364
|
outerRadius: "75%",
|
|
348
|
-
label: ({ name: h, percent:
|
|
365
|
+
label: ({ name: h, percent: _ }) => `${h}: ${(_ * 100).toFixed(0)}%`,
|
|
349
366
|
labelLine: !1,
|
|
350
|
-
children: s.map((h,
|
|
367
|
+
children: s.map((h, _) => /* @__PURE__ */ r(re, { fill: t[_ % t.length] }, _))
|
|
351
368
|
}
|
|
352
369
|
),
|
|
353
|
-
/* @__PURE__ */ r(
|
|
370
|
+
/* @__PURE__ */ r(U, { content: /* @__PURE__ */ r(se, {}) })
|
|
354
371
|
] });
|
|
355
|
-
return /* @__PURE__ */ r(
|
|
372
|
+
return /* @__PURE__ */ r(I, { name: "composition", title: a, children: /* @__PURE__ */ r("div", { ref: i, className: "widget-composition__container", children: s.length === 0 || u <= 0 || o <= 0 ? /* @__PURE__ */ r(X, { kind: "empty" }) : l === "bridge" ? m() : d() }) });
|
|
356
373
|
}
|
|
357
|
-
function
|
|
374
|
+
function wt(e, t) {
|
|
358
375
|
if (t !== "percentage") return "";
|
|
359
|
-
const
|
|
360
|
-
return Number.isNaN(
|
|
376
|
+
const n = Number(e);
|
|
377
|
+
return Number.isNaN(n) || n === 0 ? "" : n > 0 ? " widget-table__td--up" : " widget-table__td--down";
|
|
361
378
|
}
|
|
362
|
-
function
|
|
363
|
-
const l = (
|
|
379
|
+
function yt(e, t, n, a) {
|
|
380
|
+
const l = (a == null ? void 0 : a.offsetHeight) ?? 0;
|
|
364
381
|
if (e === 0 || t <= 0 || l <= 0) return e;
|
|
365
|
-
const s = Math.floor((t - ((
|
|
382
|
+
const s = Math.floor((t - ((n == null ? void 0 : n.offsetHeight) ?? 0)) / l);
|
|
366
383
|
return Math.max(0, Math.min(e, s));
|
|
367
384
|
}
|
|
368
|
-
function
|
|
385
|
+
function Nt({ data: e, label: t }) {
|
|
369
386
|
var h;
|
|
370
|
-
const
|
|
371
|
-
|
|
387
|
+
const n = e.columns || [], a = e.rows || [], l = e.overflow === "clip", s = e.indexColumn === !0, c = t || String(e.label || ""), i = $(null), u = $(null), o = $(null), { height: m } = B(i), d = l ? a.slice(0, yt(
|
|
388
|
+
a.length,
|
|
372
389
|
m,
|
|
373
390
|
u.current,
|
|
374
391
|
((h = o.current) == null ? void 0 : h.firstElementChild) ?? null
|
|
375
|
-
)) :
|
|
376
|
-
return
|
|
377
|
-
|
|
392
|
+
)) : a;
|
|
393
|
+
return n.length === 0 ? /* @__PURE__ */ r(
|
|
394
|
+
I,
|
|
378
395
|
{
|
|
379
396
|
name: "table",
|
|
380
397
|
title: c,
|
|
381
398
|
state: "unconfigured",
|
|
382
399
|
stateMessage: "Configure as colunas da tabela."
|
|
383
400
|
}
|
|
384
|
-
) : /* @__PURE__ */ r(
|
|
401
|
+
) : /* @__PURE__ */ r(I, { name: "table", title: c, children: /* @__PURE__ */ r(
|
|
385
402
|
"div",
|
|
386
403
|
{
|
|
387
404
|
ref: i,
|
|
388
405
|
className: `widget-table__scroll${l ? " widget-table__scroll--clip" : ""}`,
|
|
389
|
-
children: /* @__PURE__ */
|
|
406
|
+
children: /* @__PURE__ */ p(
|
|
390
407
|
"table",
|
|
391
408
|
{
|
|
392
|
-
className: `widget-table__table${l && d.length <
|
|
409
|
+
className: `widget-table__table${l && d.length < a.length ? "" : " widget-table__table--fill"}`,
|
|
393
410
|
children: [
|
|
394
|
-
/* @__PURE__ */ r("thead", { ref: u, children: /* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ r("thead", { ref: u, children: /* @__PURE__ */ p("tr", { children: [
|
|
395
412
|
s && /* @__PURE__ */ r("th", { className: "widget-table__th widget-table__th--index", children: "#" }),
|
|
396
|
-
|
|
413
|
+
n.map((_) => /* @__PURE__ */ r(
|
|
397
414
|
"th",
|
|
398
415
|
{
|
|
399
|
-
className: `widget-table__th${
|
|
400
|
-
children:
|
|
416
|
+
className: `widget-table__th${J(_.format) ? " widget-table__th--num" : ""}`,
|
|
417
|
+
children: _.label || _.key
|
|
401
418
|
},
|
|
402
|
-
|
|
419
|
+
_.key
|
|
403
420
|
))
|
|
404
421
|
] }) }),
|
|
405
422
|
/* @__PURE__ */ r("tbody", { ref: o, children: d.length === 0 ? /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
|
|
406
423
|
"td",
|
|
407
424
|
{
|
|
408
425
|
className: "widget-table__td widget-table__td--placeholder",
|
|
409
|
-
colSpan:
|
|
426
|
+
colSpan: n.length + (s ? 1 : 0),
|
|
410
427
|
children: "Sem dados"
|
|
411
428
|
}
|
|
412
|
-
) }) : d.map((
|
|
413
|
-
s && /* @__PURE__ */ r("td", { className: "widget-table__td widget-table__td--index", children:
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
return /* @__PURE__ */ r("td", { className: `widget-table__td${
|
|
429
|
+
) }) : d.map((_, v) => /* @__PURE__ */ p("tr", { children: [
|
|
430
|
+
s && /* @__PURE__ */ r("td", { className: "widget-table__td widget-table__td--index", children: v + 1 }),
|
|
431
|
+
n.map((S) => {
|
|
432
|
+
const R = _[S.key], A = J(S.format) ? " widget-table__td--num" : "";
|
|
433
|
+
return /* @__PURE__ */ r("td", { className: `widget-table__td${A}${wt(R, S.format)}`, children: z(R, S.format) }, S.key);
|
|
417
434
|
})
|
|
418
|
-
] },
|
|
435
|
+
] }, v)) })
|
|
419
436
|
]
|
|
420
437
|
}
|
|
421
438
|
)
|
|
422
439
|
}
|
|
423
440
|
) });
|
|
424
441
|
}
|
|
425
|
-
function
|
|
426
|
-
return e === "yearly" ? /* @__PURE__ */ r(
|
|
427
|
-
|
|
442
|
+
function ke({ mode: e, value: t, dateBounds: n, rangeUnit: a, onChange: l }) {
|
|
443
|
+
return e === "yearly" ? /* @__PURE__ */ r(Rt, { value: t, dateBounds: n, onChange: l }) : e === "monthly" ? /* @__PURE__ */ r($t, { value: t, dateBounds: n, onChange: l }) : e === "weekly" ? /* @__PURE__ */ r(Ct, { value: t, dateBounds: n, onChange: l }) : a && a !== "day" ? /* @__PURE__ */ r(
|
|
444
|
+
St,
|
|
428
445
|
{
|
|
429
446
|
value: t,
|
|
430
|
-
dateBounds:
|
|
431
|
-
unit:
|
|
447
|
+
dateBounds: n,
|
|
448
|
+
unit: a,
|
|
432
449
|
onChange: l
|
|
433
450
|
}
|
|
434
|
-
) : /* @__PURE__ */ r(
|
|
451
|
+
) : /* @__PURE__ */ r(kt, { value: t, dateBounds: n, onChange: l });
|
|
435
452
|
}
|
|
436
|
-
function
|
|
437
|
-
const [l, s] = e ? e.split("|") : ["", ""], c =
|
|
453
|
+
function St({ value: e, dateBounds: t, unit: n, onChange: a }) {
|
|
454
|
+
const [l, s] = e ? e.split("|") : ["", ""], c = Fe(n, t), i = (o) => {
|
|
438
455
|
var m;
|
|
439
456
|
return ((m = c.find((d) => o >= d.start && o <= d.end)) == null ? void 0 : m.key) ?? "";
|
|
440
457
|
}, u = (o, m) => {
|
|
441
458
|
const d = c.find((h) => h.key === m);
|
|
442
|
-
d &&
|
|
459
|
+
d && a(o === "start" ? `${d.start}|${!s || s < d.end ? d.end : s}` : `${!l || l > d.start ? d.start : l}|${d.end}`);
|
|
443
460
|
};
|
|
444
|
-
return /* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
461
|
+
return /* @__PURE__ */ p("div", { className: "widget-filter__date-range widget-filter__date-range--period", children: [
|
|
462
|
+
/* @__PURE__ */ p(
|
|
446
463
|
"select",
|
|
447
464
|
{
|
|
448
465
|
className: "widget-filter__select",
|
|
@@ -455,7 +472,7 @@ function yt({ value: e, dateBounds: t, unit: a, onChange: n }) {
|
|
|
455
472
|
]
|
|
456
473
|
}
|
|
457
474
|
),
|
|
458
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ p(
|
|
459
476
|
"select",
|
|
460
477
|
{
|
|
461
478
|
className: "widget-filter__select",
|
|
@@ -470,41 +487,41 @@ function yt({ value: e, dateBounds: t, unit: a, onChange: n }) {
|
|
|
470
487
|
)
|
|
471
488
|
] });
|
|
472
489
|
}
|
|
473
|
-
function
|
|
474
|
-
const [
|
|
475
|
-
return /* @__PURE__ */
|
|
490
|
+
function kt({ value: e, dateBounds: t, onChange: n }) {
|
|
491
|
+
const [a, l] = e ? e.split("|") : ["", ""];
|
|
492
|
+
return /* @__PURE__ */ p("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
|
|
476
493
|
/* @__PURE__ */ r(
|
|
477
|
-
|
|
494
|
+
ee,
|
|
478
495
|
{
|
|
479
|
-
value:
|
|
496
|
+
value: a,
|
|
480
497
|
minIso: t == null ? void 0 : t.min,
|
|
481
498
|
maxIso: l || (t == null ? void 0 : t.max),
|
|
482
499
|
selectsStart: !0,
|
|
483
|
-
startIso:
|
|
500
|
+
startIso: a,
|
|
484
501
|
endIso: l,
|
|
485
502
|
placeholder: "Data inicial",
|
|
486
|
-
onChange: (s) =>
|
|
503
|
+
onChange: (s) => n(`${s}|${l}`)
|
|
487
504
|
}
|
|
488
505
|
),
|
|
489
506
|
/* @__PURE__ */ r(
|
|
490
|
-
|
|
507
|
+
ee,
|
|
491
508
|
{
|
|
492
509
|
value: l,
|
|
493
|
-
minIso:
|
|
510
|
+
minIso: a || (t == null ? void 0 : t.min),
|
|
494
511
|
maxIso: t == null ? void 0 : t.max,
|
|
495
512
|
selectsEnd: !0,
|
|
496
|
-
startIso:
|
|
513
|
+
startIso: a,
|
|
497
514
|
endIso: l,
|
|
498
515
|
placeholder: "Data final",
|
|
499
|
-
onChange: (s) =>
|
|
516
|
+
onChange: (s) => n(`${a}|${s}`)
|
|
500
517
|
}
|
|
501
518
|
)
|
|
502
519
|
] });
|
|
503
520
|
}
|
|
504
|
-
function
|
|
505
|
-
const [
|
|
506
|
-
const m =
|
|
507
|
-
|
|
521
|
+
function Rt({ value: e, dateBounds: t, onChange: n }) {
|
|
522
|
+
const [a] = e ? e.split("|") : [""], l = Ae(a), s = /* @__PURE__ */ new Date(), c = (l == null ? void 0 : l.year) ?? s.getFullYear(), i = q(t), u = (o) => {
|
|
523
|
+
const m = Te(o);
|
|
524
|
+
n(`${m.start}|${m.end}`);
|
|
508
525
|
};
|
|
509
526
|
return /* @__PURE__ */ r("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ r(
|
|
510
527
|
"select",
|
|
@@ -516,19 +533,19 @@ function St({ value: e, dateBounds: t, onChange: a }) {
|
|
|
516
533
|
}
|
|
517
534
|
) });
|
|
518
535
|
}
|
|
519
|
-
function
|
|
520
|
-
const [
|
|
521
|
-
const h =
|
|
522
|
-
|
|
536
|
+
function $t({ value: e, dateBounds: t, onChange: n }) {
|
|
537
|
+
const [a] = e ? e.split("|") : [""], l = he(a), s = /* @__PURE__ */ new Date(), c = (l == null ? void 0 : l.year) ?? s.getFullYear(), i = (l == null ? void 0 : l.month) ?? s.getMonth() + 1, u = q(t), o = (m, d) => {
|
|
538
|
+
const h = Me(m, d);
|
|
539
|
+
n(`${h.start}|${h.end}`);
|
|
523
540
|
};
|
|
524
|
-
return /* @__PURE__ */
|
|
541
|
+
return /* @__PURE__ */ p("div", { className: "widget-filter__date-range widget-filter__date-range--month", children: [
|
|
525
542
|
/* @__PURE__ */ r(
|
|
526
543
|
"select",
|
|
527
544
|
{
|
|
528
545
|
className: "widget-filter__select",
|
|
529
546
|
value: i,
|
|
530
547
|
onChange: (m) => o(c, parseInt(m.target.value)),
|
|
531
|
-
children:
|
|
548
|
+
children: fe.map((m, d) => /* @__PURE__ */ r("option", { value: d + 1, children: m }, d + 1))
|
|
532
549
|
}
|
|
533
550
|
),
|
|
534
551
|
/* @__PURE__ */ r(
|
|
@@ -542,17 +559,17 @@ function kt({ value: e, dateBounds: t, onChange: a }) {
|
|
|
542
559
|
)
|
|
543
560
|
] });
|
|
544
561
|
}
|
|
545
|
-
function Ct({ value: e, dateBounds: t, onChange:
|
|
546
|
-
const [
|
|
547
|
-
return /* @__PURE__ */
|
|
562
|
+
function Ct({ value: e, dateBounds: t, onChange: n }) {
|
|
563
|
+
const [a] = e ? e.split("|") : [""], l = he(a), s = /* @__PURE__ */ new Date(), c = (l == null ? void 0 : l.year) ?? s.getFullYear(), i = (l == null ? void 0 : l.month) ?? s.getMonth() + 1, u = q(t), o = G(c, i), m = xe(a, c, i) || 1;
|
|
564
|
+
return /* @__PURE__ */ p("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
|
|
548
565
|
/* @__PURE__ */ r(
|
|
549
566
|
"select",
|
|
550
567
|
{
|
|
551
568
|
className: "widget-filter__select",
|
|
552
569
|
value: c,
|
|
553
570
|
onChange: (d) => {
|
|
554
|
-
const h = parseInt(d.target.value),
|
|
555
|
-
|
|
571
|
+
const h = parseInt(d.target.value), v = G(h, i)[0];
|
|
572
|
+
v && n(`${v.start}|${v.end}`);
|
|
556
573
|
},
|
|
557
574
|
children: u.map((d) => /* @__PURE__ */ r("option", { value: d, children: d }, d))
|
|
558
575
|
}
|
|
@@ -563,10 +580,10 @@ function Ct({ value: e, dateBounds: t, onChange: a }) {
|
|
|
563
580
|
className: "widget-filter__select",
|
|
564
581
|
value: i,
|
|
565
582
|
onChange: (d) => {
|
|
566
|
-
const h = parseInt(d.target.value),
|
|
567
|
-
|
|
583
|
+
const h = parseInt(d.target.value), v = G(c, h)[0];
|
|
584
|
+
v && n(`${v.start}|${v.end}`);
|
|
568
585
|
},
|
|
569
|
-
children:
|
|
586
|
+
children: fe.map((d, h) => /* @__PURE__ */ r("option", { value: h + 1, children: d }, h + 1))
|
|
570
587
|
}
|
|
571
588
|
),
|
|
572
589
|
/* @__PURE__ */ r(
|
|
@@ -576,30 +593,30 @@ function Ct({ value: e, dateBounds: t, onChange: a }) {
|
|
|
576
593
|
value: m,
|
|
577
594
|
onChange: (d) => {
|
|
578
595
|
const h = o[parseInt(d.target.value) - 1];
|
|
579
|
-
h &&
|
|
596
|
+
h && n(`${h.start}|${h.end}`);
|
|
580
597
|
},
|
|
581
598
|
children: o.map((d) => /* @__PURE__ */ r("option", { value: d.index, children: d.label }, d.index))
|
|
582
599
|
}
|
|
583
600
|
)
|
|
584
601
|
] });
|
|
585
602
|
}
|
|
586
|
-
function
|
|
603
|
+
function At({ config: e, value: t, options: n = [], dateBounds: a, onChange: l }) {
|
|
587
604
|
const s = e.filterType || "select", c = e.label || "Filtro", i = e.dateFilterMode || "range";
|
|
588
|
-
return /* @__PURE__ */
|
|
605
|
+
return /* @__PURE__ */ p("div", { className: "widget-filter", children: [
|
|
589
606
|
/* @__PURE__ */ r("label", { className: "widget-filter__label", children: c }),
|
|
590
607
|
s === "date_range" ? /* @__PURE__ */ r(
|
|
591
|
-
|
|
608
|
+
ke,
|
|
592
609
|
{
|
|
593
610
|
mode: i,
|
|
594
611
|
value: t,
|
|
595
|
-
dateBounds:
|
|
612
|
+
dateBounds: a,
|
|
596
613
|
onChange: l
|
|
597
614
|
}
|
|
598
615
|
) : /* @__PURE__ */ r(
|
|
599
|
-
|
|
616
|
+
xt,
|
|
600
617
|
{
|
|
601
618
|
value: t,
|
|
602
|
-
options:
|
|
619
|
+
options: n,
|
|
603
620
|
multi: s === "multi_select",
|
|
604
621
|
searchable: e.searchable || !1,
|
|
605
622
|
onChange: l
|
|
@@ -607,23 +624,23 @@ function $t({ config: e, value: t, options: a = [], dateBounds: n, onChange: l }
|
|
|
607
624
|
)
|
|
608
625
|
] });
|
|
609
626
|
}
|
|
610
|
-
function
|
|
611
|
-
if (
|
|
627
|
+
function xt({ value: e, options: t, multi: n, searchable: a, onChange: l }) {
|
|
628
|
+
if (a)
|
|
612
629
|
return /* @__PURE__ */ r(
|
|
613
630
|
ge,
|
|
614
631
|
{
|
|
615
632
|
value: e,
|
|
616
633
|
options: t,
|
|
617
|
-
multi:
|
|
634
|
+
multi: n,
|
|
618
635
|
onChange: l
|
|
619
636
|
}
|
|
620
637
|
);
|
|
621
|
-
if (
|
|
622
|
-
const s = e ? e.split(
|
|
638
|
+
if (n) {
|
|
639
|
+
const s = e ? e.split(V) : [], c = (i) => {
|
|
623
640
|
const u = s.includes(i) ? s.filter((o) => o !== i) : [...s, i];
|
|
624
|
-
l(u.join(
|
|
641
|
+
l(u.join(V));
|
|
625
642
|
};
|
|
626
|
-
return /* @__PURE__ */
|
|
643
|
+
return /* @__PURE__ */ p("div", { className: "widget-filter__multi", children: [
|
|
627
644
|
s.length > 0 && /* @__PURE__ */ r(
|
|
628
645
|
"button",
|
|
629
646
|
{
|
|
@@ -633,7 +650,7 @@ function Rt({ value: e, options: t, multi: a, searchable: n, onChange: l }) {
|
|
|
633
650
|
children: "Limpar filtro"
|
|
634
651
|
}
|
|
635
652
|
),
|
|
636
|
-
t.map((i) => /* @__PURE__ */
|
|
653
|
+
t.map((i) => /* @__PURE__ */ p("label", { className: "widget-filter__multi-option", children: [
|
|
637
654
|
/* @__PURE__ */ r(
|
|
638
655
|
"input",
|
|
639
656
|
{
|
|
@@ -646,7 +663,7 @@ function Rt({ value: e, options: t, multi: a, searchable: n, onChange: l }) {
|
|
|
646
663
|
] }, i))
|
|
647
664
|
] });
|
|
648
665
|
}
|
|
649
|
-
return /* @__PURE__ */
|
|
666
|
+
return /* @__PURE__ */ p(
|
|
650
667
|
"select",
|
|
651
668
|
{
|
|
652
669
|
className: "widget-filter__select",
|
|
@@ -659,22 +676,22 @@ function Rt({ value: e, options: t, multi: a, searchable: n, onChange: l }) {
|
|
|
659
676
|
}
|
|
660
677
|
);
|
|
661
678
|
}
|
|
662
|
-
const
|
|
679
|
+
const Ft = {
|
|
663
680
|
currency: "R$",
|
|
664
681
|
percentage: "%"
|
|
665
682
|
};
|
|
666
|
-
function
|
|
667
|
-
const
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */ r("label", { className: "widget-variable__label", children:
|
|
670
|
-
/* @__PURE__ */
|
|
683
|
+
function Mt({ config: e, value: t, onChange: n }) {
|
|
684
|
+
const a = e.label || "Variavel", l = e.locked || !1, s = e.variableFormat || "number", c = Ft[s] || "";
|
|
685
|
+
return /* @__PURE__ */ p("div", { className: `widget-variable ${l ? "widget-variable--locked" : ""}`, children: [
|
|
686
|
+
/* @__PURE__ */ r("label", { className: "widget-variable__label", children: a }),
|
|
687
|
+
/* @__PURE__ */ p("div", { className: "widget-variable__input-wrapper", children: [
|
|
671
688
|
/* @__PURE__ */ r(
|
|
672
689
|
"input",
|
|
673
690
|
{
|
|
674
691
|
className: "widget-variable__input",
|
|
675
692
|
type: "number",
|
|
676
693
|
value: t,
|
|
677
|
-
onChange: (i) =>
|
|
694
|
+
onChange: (i) => n(parseFloat(i.target.value) || 0),
|
|
678
695
|
disabled: l,
|
|
679
696
|
step: s === "integer" ? 1 : 0.01
|
|
680
697
|
}
|
|
@@ -684,22 +701,22 @@ function xt({ config: e, value: t, onChange: a }) {
|
|
|
684
701
|
l && /* @__PURE__ */ r("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
685
702
|
] });
|
|
686
703
|
}
|
|
687
|
-
function
|
|
688
|
-
const
|
|
689
|
-
return /* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */ r("label", { className: "widget-palette__label", children:
|
|
691
|
-
/* @__PURE__ */ r(
|
|
704
|
+
function Tt({ config: e, palette: t, onChange: n }) {
|
|
705
|
+
const a = e.label || "Cores", l = e.locked || !1;
|
|
706
|
+
return /* @__PURE__ */ p("div", { className: `widget-palette ${l ? "widget-palette--locked" : ""}`, children: [
|
|
707
|
+
/* @__PURE__ */ r("label", { className: "widget-palette__label", children: a }),
|
|
708
|
+
/* @__PURE__ */ r(Ee, { selected: t, onSelect: n, customMode: !0, disabled: l }),
|
|
692
709
|
l && /* @__PURE__ */ r("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
693
710
|
] });
|
|
694
711
|
}
|
|
695
|
-
const
|
|
712
|
+
const Et = {
|
|
696
713
|
failed_to_compute: "Não foi possível calcular este widget"
|
|
697
714
|
};
|
|
698
|
-
function
|
|
715
|
+
function Lt({
|
|
699
716
|
type: e,
|
|
700
717
|
computed: t,
|
|
701
|
-
palette:
|
|
702
|
-
config:
|
|
718
|
+
palette: n,
|
|
719
|
+
config: a,
|
|
703
720
|
filterValue: l,
|
|
704
721
|
filterOptions: s,
|
|
705
722
|
dateBounds: c,
|
|
@@ -710,31 +727,31 @@ function Tt({
|
|
|
710
727
|
}) {
|
|
711
728
|
if (t.error)
|
|
712
729
|
return /* @__PURE__ */ r(
|
|
713
|
-
|
|
730
|
+
I,
|
|
714
731
|
{
|
|
715
732
|
name: e.replace("_", "-"),
|
|
716
|
-
title:
|
|
733
|
+
title: a == null ? void 0 : a.label,
|
|
717
734
|
state: "error",
|
|
718
|
-
stateMessage:
|
|
735
|
+
stateMessage: Et[String(t.error)]
|
|
719
736
|
}
|
|
720
737
|
);
|
|
721
|
-
const d =
|
|
738
|
+
const d = Le(n);
|
|
722
739
|
switch (e) {
|
|
723
740
|
case "kpi_card":
|
|
724
|
-
return /* @__PURE__ */ r(
|
|
741
|
+
return /* @__PURE__ */ r(it, { data: t, label: a == null ? void 0 : a.label });
|
|
725
742
|
case "gauge":
|
|
726
|
-
return /* @__PURE__ */ r(
|
|
743
|
+
return /* @__PURE__ */ r(dt, { data: t, palette: d, label: a == null ? void 0 : a.label });
|
|
727
744
|
case "chart":
|
|
728
|
-
return /* @__PURE__ */ r(
|
|
745
|
+
return /* @__PURE__ */ r(gt, { data: t, palette: d, label: a == null ? void 0 : a.label });
|
|
729
746
|
case "composition":
|
|
730
|
-
return /* @__PURE__ */ r(
|
|
747
|
+
return /* @__PURE__ */ r(vt, { data: t, palette: d, label: a == null ? void 0 : a.label });
|
|
731
748
|
case "table":
|
|
732
|
-
return /* @__PURE__ */ r(
|
|
749
|
+
return /* @__PURE__ */ r(Nt, { data: t, label: a == null ? void 0 : a.label });
|
|
733
750
|
case "filter":
|
|
734
|
-
return
|
|
735
|
-
|
|
751
|
+
return a && i ? /* @__PURE__ */ r(
|
|
752
|
+
At,
|
|
736
753
|
{
|
|
737
|
-
config:
|
|
754
|
+
config: a,
|
|
738
755
|
value: l || "",
|
|
739
756
|
options: s,
|
|
740
757
|
dateBounds: c,
|
|
@@ -742,9 +759,9 @@ function Tt({
|
|
|
742
759
|
}
|
|
743
760
|
) : null;
|
|
744
761
|
case "variable": {
|
|
745
|
-
const h =
|
|
762
|
+
const h = a;
|
|
746
763
|
return h && o ? /* @__PURE__ */ r(
|
|
747
|
-
|
|
764
|
+
Mt,
|
|
748
765
|
{
|
|
749
766
|
config: h,
|
|
750
767
|
value: u ?? h.variableValue ?? 0,
|
|
@@ -753,24 +770,24 @@ function Tt({
|
|
|
753
770
|
) : null;
|
|
754
771
|
}
|
|
755
772
|
case "color_palette":
|
|
756
|
-
return
|
|
757
|
-
|
|
773
|
+
return a && m ? /* @__PURE__ */ r(
|
|
774
|
+
Tt,
|
|
758
775
|
{
|
|
759
|
-
config:
|
|
760
|
-
palette:
|
|
776
|
+
config: a,
|
|
777
|
+
palette: n,
|
|
761
778
|
onChange: m
|
|
762
779
|
}
|
|
763
780
|
) : null;
|
|
764
781
|
default:
|
|
765
|
-
return /* @__PURE__ */ r(
|
|
782
|
+
return /* @__PURE__ */ r(I, { name: "unknown", state: "unconfigured" });
|
|
766
783
|
}
|
|
767
784
|
}
|
|
768
|
-
const
|
|
769
|
-
function
|
|
785
|
+
const Ot = (e, t) => e.grid.y - t.grid.y || e.grid.x - t.grid.x;
|
|
786
|
+
function tr({
|
|
770
787
|
token: e,
|
|
771
|
-
cellAspect: t =
|
|
772
|
-
stackBelow:
|
|
773
|
-
onGeometryChange:
|
|
788
|
+
cellAspect: t = We,
|
|
789
|
+
stackBelow: n,
|
|
790
|
+
onGeometryChange: a,
|
|
774
791
|
silenceWarnings: l,
|
|
775
792
|
className: s
|
|
776
793
|
}) {
|
|
@@ -782,146 +799,153 @@ function Jt({
|
|
|
782
799
|
filters: m,
|
|
783
800
|
variables: d,
|
|
784
801
|
palette: h,
|
|
785
|
-
setFilter:
|
|
786
|
-
setVariable:
|
|
787
|
-
setPalette:
|
|
788
|
-
} =
|
|
802
|
+
setFilter: _,
|
|
803
|
+
setVariable: v,
|
|
804
|
+
setPalette: S
|
|
805
|
+
} = Ze(e), { rootRef: R, gridRef: A, stacked: N } = nt({
|
|
789
806
|
columns: (c == null ? void 0 : c.gridColumns) ?? 0,
|
|
790
807
|
cellAspect: t,
|
|
791
|
-
stackBelow:
|
|
792
|
-
onGeometryChange:
|
|
808
|
+
stackBelow: n,
|
|
809
|
+
onGeometryChange: a,
|
|
793
810
|
silenceWarnings: l
|
|
794
|
-
}),
|
|
795
|
-
const
|
|
796
|
-
return
|
|
797
|
-
}, [c == null ? void 0 : c.widgets,
|
|
798
|
-
"--dash-gap": `${
|
|
799
|
-
"--dash-pad": `${
|
|
800
|
-
},
|
|
801
|
-
let
|
|
811
|
+
}), y = ue(() => {
|
|
812
|
+
const f = (c == null ? void 0 : c.widgets) ?? [];
|
|
813
|
+
return N ? [...f].sort(Ot) : f;
|
|
814
|
+
}, [c == null ? void 0 : c.widgets, N]), k = {
|
|
815
|
+
"--dash-gap": `${te}px`,
|
|
816
|
+
"--dash-pad": `${De}px`
|
|
817
|
+
}, F = ["preview-tab", s].filter(Boolean).join(" ");
|
|
818
|
+
let x;
|
|
802
819
|
if (o && !c)
|
|
803
|
-
|
|
820
|
+
x = /* @__PURE__ */ r("div", { className: "preview-tab__error", children: o });
|
|
804
821
|
else if (!c)
|
|
805
|
-
|
|
822
|
+
x = /* @__PURE__ */ r("div", { className: "preview-tab__loading", children: "Carregando dashboard..." });
|
|
806
823
|
else if (c.widgets.length === 0)
|
|
807
|
-
|
|
824
|
+
x = /* @__PURE__ */ r("div", { className: "preview-tab__empty", children: "Este dashboard nao possui widgets." });
|
|
808
825
|
else {
|
|
809
|
-
const
|
|
826
|
+
const f = (i == null ? void 0 : i.widgets) ?? {}, g = (i == null ? void 0 : i.date_bounds) ?? null, C = {
|
|
810
827
|
"--dash-cols": c.gridColumns,
|
|
811
828
|
"--dash-rows": c.gridRows,
|
|
812
|
-
...
|
|
813
|
-
},
|
|
814
|
-
|
|
829
|
+
..._e(h)
|
|
830
|
+
}, M = ["preview-tab__grid", N && "preview-tab__grid--stacked"].filter(Boolean).join(" ");
|
|
831
|
+
x = /* @__PURE__ */ p(de, { children: [
|
|
815
832
|
o && !i && /* @__PURE__ */ r("div", { className: "preview-tab__error", children: o }),
|
|
816
|
-
i && /* @__PURE__ */ r("div", { className:
|
|
817
|
-
const
|
|
833
|
+
i && /* @__PURE__ */ r("div", { className: M, style: C, ref: A, children: y.map((b) => {
|
|
834
|
+
const w = Oe.has(b.type), L = f[b.id], P = N ? {
|
|
818
835
|
gridColumn: 1,
|
|
819
|
-
aspectRatio: `${
|
|
820
|
-
minHeight: `${
|
|
836
|
+
aspectRatio: `${Pe(b.grid.w, b.grid.h, t)}`,
|
|
837
|
+
minHeight: `${Ie(b.grid.h, ze, te, 0)}px`
|
|
821
838
|
} : {
|
|
822
|
-
gridColumn: `${
|
|
823
|
-
gridRow: `${
|
|
824
|
-
},
|
|
839
|
+
gridColumn: `${b.grid.x + 1} / span ${b.grid.w}`,
|
|
840
|
+
gridRow: `${b.grid.y + 1} / span ${b.grid.h}`
|
|
841
|
+
}, O = b.type === "variable" ? d[b.id] ?? (L == null ? void 0 : L.value) ?? b.config.variableValue ?? 0 : void 0;
|
|
825
842
|
return /* @__PURE__ */ r(
|
|
826
843
|
"div",
|
|
827
844
|
{
|
|
828
|
-
className: `preview-tab__widget ${
|
|
829
|
-
style:
|
|
830
|
-
children:
|
|
831
|
-
|
|
845
|
+
className: `preview-tab__widget ${w ? "preview-tab__widget--control" : ""}`,
|
|
846
|
+
style: P,
|
|
847
|
+
children: w || L ? /* @__PURE__ */ r(
|
|
848
|
+
Lt,
|
|
832
849
|
{
|
|
833
|
-
type:
|
|
850
|
+
type: b.type,
|
|
834
851
|
computed: L || {},
|
|
835
852
|
palette: h,
|
|
836
|
-
config:
|
|
837
|
-
filterValue: m[
|
|
853
|
+
config: b.config,
|
|
854
|
+
filterValue: m[b.id] || "",
|
|
838
855
|
filterOptions: (
|
|
839
856
|
// Estruturais: vem do /layout (cacheavel), nao do /render —
|
|
840
857
|
// recalcula-los a cada render custaria um DISTINCT por filtro.
|
|
841
|
-
|
|
858
|
+
b.type === "filter" ? b.config.availableValues ?? [] : []
|
|
842
859
|
),
|
|
843
|
-
dateBounds:
|
|
844
|
-
onFilterChange: (
|
|
845
|
-
variableValue:
|
|
846
|
-
onVariableChange: (
|
|
847
|
-
onPaletteChange:
|
|
860
|
+
dateBounds: g,
|
|
861
|
+
onFilterChange: (j) => _(b.id, j),
|
|
862
|
+
variableValue: O,
|
|
863
|
+
onVariableChange: (j) => v(b.id, j),
|
|
864
|
+
onPaletteChange: S
|
|
848
865
|
}
|
|
849
866
|
) : /* @__PURE__ */ r("div", { className: "preview-tab__widget-loading", children: u ? "Carregando..." : "Sem dados" })
|
|
850
867
|
},
|
|
851
|
-
|
|
868
|
+
b.id
|
|
852
869
|
);
|
|
853
870
|
}) }),
|
|
854
871
|
u && i && /* @__PURE__ */ r("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
|
|
855
872
|
] });
|
|
856
873
|
}
|
|
857
|
-
return /* @__PURE__ */ r("div", { className:
|
|
874
|
+
return /* @__PURE__ */ r("div", { className: F, style: k, ref: R, children: x });
|
|
858
875
|
}
|
|
859
|
-
function
|
|
860
|
-
const
|
|
861
|
-
|
|
876
|
+
function It(e, t) {
|
|
877
|
+
const n = URL.createObjectURL(e), a = document.createElement("a");
|
|
878
|
+
a.href = n, a.download = t, document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
862
879
|
}
|
|
863
|
-
const
|
|
864
|
-
function
|
|
880
|
+
const Pt = 768, Dt = 879;
|
|
881
|
+
function Wt(e) {
|
|
865
882
|
return Array.from(e.normalize("NFD")).filter((t) => {
|
|
866
|
-
const
|
|
867
|
-
return
|
|
883
|
+
const n = t.codePointAt(0) ?? 0;
|
|
884
|
+
return n < Pt || n > Dt;
|
|
868
885
|
}).join("");
|
|
869
886
|
}
|
|
870
|
-
function
|
|
871
|
-
return `${
|
|
887
|
+
function zt(e, t) {
|
|
888
|
+
return `${Wt(e).replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase() || "documento"}.${t}`;
|
|
872
889
|
}
|
|
873
|
-
const
|
|
874
|
-
function
|
|
875
|
-
const [t,
|
|
876
|
-
|
|
890
|
+
const Ht = 300;
|
|
891
|
+
function jt(e) {
|
|
892
|
+
const [t, n] = T(null), [a, l] = T(null), [s, c] = T({}), [i, u] = T(!0), [o, m] = T(null), [d, h] = T(!1), _ = $(), v = $(!1), S = $(null), R = $(!1);
|
|
893
|
+
D(() => {
|
|
877
894
|
let y = !1;
|
|
878
|
-
return
|
|
879
|
-
y ||
|
|
880
|
-
}).catch((
|
|
881
|
-
y || m(
|
|
895
|
+
return v.current = !1, S.current = null, R.current = !1, He(e).then((k) => {
|
|
896
|
+
y || n(k);
|
|
897
|
+
}).catch((k) => {
|
|
898
|
+
y || m(k.message);
|
|
882
899
|
}), () => {
|
|
883
900
|
y = !0;
|
|
884
901
|
};
|
|
885
|
-
}, [e]),
|
|
886
|
-
if (t)
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
902
|
+
}, [e]), D(() => {
|
|
903
|
+
if (!t) return;
|
|
904
|
+
const y = W(s), k = H(y);
|
|
905
|
+
if (k === S.current) return;
|
|
906
|
+
_.current && clearTimeout(_.current);
|
|
907
|
+
const F = R.current ? Ht : 0;
|
|
908
|
+
return _.current = setTimeout(() => {
|
|
909
|
+
u(!0), je(e, y).then((x) => {
|
|
910
|
+
S.current = k, R.current = !0, l(x), !v.current && x.applied && (v.current = !0, c((f) => {
|
|
911
|
+
const g = { ...Ne(x.applied), ...f };
|
|
912
|
+
return ye(g, f) ? f : (S.current = H(W(g)), g);
|
|
913
|
+
})), m(null);
|
|
914
|
+
}).catch((x) => m(x.message)).finally(() => u(!1));
|
|
915
|
+
}, F), () => {
|
|
916
|
+
_.current && clearTimeout(_.current);
|
|
917
|
+
};
|
|
894
918
|
}, [e, t, s]);
|
|
895
|
-
const
|
|
896
|
-
c((
|
|
897
|
-
}, []),
|
|
898
|
-
h(!0),
|
|
899
|
-
|
|
919
|
+
const A = E((y, k) => {
|
|
920
|
+
c((F) => ({ ...F, [y]: k }));
|
|
921
|
+
}, []), N = E(() => {
|
|
922
|
+
h(!0), Ge(e, W(s)).then((y) => {
|
|
923
|
+
It(y, zt((t == null ? void 0 : t.name) ?? "demonstrativo", "pdf")), m(null);
|
|
900
924
|
}).catch((y) => m(y.message)).finally(() => h(!1));
|
|
901
925
|
}, [e, s, t == null ? void 0 : t.name]);
|
|
902
926
|
return {
|
|
903
927
|
layout: t,
|
|
904
|
-
renderData:
|
|
928
|
+
renderData: a,
|
|
905
929
|
loading: i,
|
|
906
930
|
error: o,
|
|
907
931
|
filters: s,
|
|
908
|
-
setFilter:
|
|
909
|
-
downloadPdf:
|
|
932
|
+
setFilter: A,
|
|
933
|
+
downloadPdf: N,
|
|
910
934
|
downloading: d
|
|
911
935
|
};
|
|
912
936
|
}
|
|
913
|
-
const
|
|
914
|
-
function
|
|
915
|
-
return { paddingLeft: `${
|
|
937
|
+
const Gt = 8, Yt = 14;
|
|
938
|
+
function ie(e) {
|
|
939
|
+
return { paddingLeft: `${Gt + e * Yt}px` };
|
|
916
940
|
}
|
|
917
|
-
function
|
|
941
|
+
function Vt(e) {
|
|
918
942
|
const t = {};
|
|
919
943
|
return e != null && e.accent && (t["--stmt-accent"] = e.accent), e != null && e.positive && (t["--stmt-positive"] = e.positive), e != null && e.negative && (t["--stmt-negative"] = e.negative), t;
|
|
920
944
|
}
|
|
921
|
-
function
|
|
945
|
+
function oe(e) {
|
|
922
946
|
return e == null || e === 0 ? "stmt__number" : `stmt__number stmt__number--${e > 0 ? "pos" : "neg"}`;
|
|
923
947
|
}
|
|
924
|
-
const
|
|
948
|
+
const Kt = {
|
|
925
949
|
day: "day",
|
|
926
950
|
week: "week",
|
|
927
951
|
month: "month",
|
|
@@ -929,37 +953,37 @@ const Yt = {
|
|
|
929
953
|
year: "year",
|
|
930
954
|
total: "month"
|
|
931
955
|
};
|
|
932
|
-
function
|
|
956
|
+
function Ut({ definition: e, value: t, options: n, bounds: a, rangeUnit: l, onChange: s }) {
|
|
933
957
|
if (e.type === "date_range") {
|
|
934
958
|
const c = e.dateFilterMode ?? "range";
|
|
935
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ p("div", { className: `stmt__filter stmt__filter--date stmt__filter--${c}`, children: [
|
|
936
960
|
/* @__PURE__ */ r("span", { className: "stmt__filter-label", children: e.label }),
|
|
937
961
|
/* @__PURE__ */ r(
|
|
938
|
-
|
|
962
|
+
ke,
|
|
939
963
|
{
|
|
940
964
|
mode: c,
|
|
941
965
|
value: t,
|
|
942
|
-
dateBounds:
|
|
966
|
+
dateBounds: a,
|
|
943
967
|
rangeUnit: l,
|
|
944
968
|
onChange: s
|
|
945
969
|
}
|
|
946
970
|
)
|
|
947
971
|
] });
|
|
948
972
|
}
|
|
949
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ p("div", { className: "stmt__filter", children: [
|
|
950
974
|
/* @__PURE__ */ r("span", { className: "stmt__filter-label", children: e.label }),
|
|
951
975
|
/* @__PURE__ */ r(
|
|
952
976
|
ge,
|
|
953
977
|
{
|
|
954
978
|
value: t,
|
|
955
|
-
options:
|
|
979
|
+
options: n,
|
|
956
980
|
multi: e.type === "multi_select",
|
|
957
981
|
onChange: s
|
|
958
982
|
}
|
|
959
983
|
)
|
|
960
984
|
] });
|
|
961
985
|
}
|
|
962
|
-
const
|
|
986
|
+
const qt = 13, ce = {
|
|
963
987
|
day: ["dia", "dias"],
|
|
964
988
|
week: ["semana", "semanas"],
|
|
965
989
|
month: ["mês", "meses"],
|
|
@@ -967,23 +991,23 @@ const Kt = 13, oe = {
|
|
|
967
991
|
year: ["ano", "anos"],
|
|
968
992
|
total: ["período", "períodos"]
|
|
969
993
|
};
|
|
970
|
-
function
|
|
971
|
-
const [
|
|
972
|
-
return `Variação sobre ${e} ${e === 1 ?
|
|
994
|
+
function Xt(e, t) {
|
|
995
|
+
const [n, a] = ce[t] ?? ce.total;
|
|
996
|
+
return `Variação sobre ${e} ${e === 1 ? n : a} atrás`;
|
|
973
997
|
}
|
|
974
|
-
function
|
|
998
|
+
function Bt({
|
|
975
999
|
line: e,
|
|
976
1000
|
columnCount: t,
|
|
977
|
-
showTotal:
|
|
978
|
-
showVertical:
|
|
1001
|
+
showTotal: n,
|
|
1002
|
+
showVertical: a,
|
|
979
1003
|
showHorizontal: l,
|
|
980
1004
|
comparisonLabel: s
|
|
981
1005
|
}) {
|
|
982
1006
|
if (e.type === "separator")
|
|
983
1007
|
return /* @__PURE__ */ r("tr", { className: "stmt__row stmt__row--separator", children: /* @__PURE__ */ r("td", { colSpan: t }) });
|
|
984
1008
|
if (e.type === "header" && e.formatted.length === 0)
|
|
985
|
-
return /* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */ r("th", { scope: "row", style:
|
|
1009
|
+
return /* @__PURE__ */ p("tr", { className: "stmt__row stmt__row--header", children: [
|
|
1010
|
+
/* @__PURE__ */ r("th", { scope: "row", style: ie(e.style.indent), children: e.label }),
|
|
987
1011
|
/* @__PURE__ */ r("td", { colSpan: t - 1 })
|
|
988
1012
|
] });
|
|
989
1013
|
const c = [
|
|
@@ -991,39 +1015,39 @@ function qt({
|
|
|
991
1015
|
`stmt__row--${e.type}`,
|
|
992
1016
|
e.style.bold && "stmt__row--bold"
|
|
993
1017
|
].filter(Boolean).join(" ");
|
|
994
|
-
return /* @__PURE__ */
|
|
995
|
-
/* @__PURE__ */ r("th", { scope: "row", style:
|
|
1018
|
+
return /* @__PURE__ */ p("tr", { className: c, children: [
|
|
1019
|
+
/* @__PURE__ */ r("th", { scope: "row", style: ie(e.style.indent), children: e.label }),
|
|
996
1020
|
e.formatted.map((i, u) => {
|
|
997
1021
|
var d;
|
|
998
1022
|
const o = e.horizontalAnalysis[u], m = (d = e.comparison) == null ? void 0 : d[u];
|
|
999
|
-
return /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */ r("span", { className:
|
|
1001
|
-
|
|
1023
|
+
return /* @__PURE__ */ p("td", { className: "stmt__value", children: [
|
|
1024
|
+
/* @__PURE__ */ r("span", { className: oe(e.values[u]), children: i }),
|
|
1025
|
+
a && e.verticalAnalysis[u] != null && /* @__PURE__ */ r("span", { className: "stmt__aux", title: "Análise vertical", children: z(e.verticalAnalysis[u], "percentage") }),
|
|
1002
1026
|
l && o != null && /* @__PURE__ */ r(
|
|
1003
1027
|
"span",
|
|
1004
1028
|
{
|
|
1005
1029
|
className: `stmt__aux stmt__aux--${o < 0 ? "down" : "up"}`,
|
|
1006
1030
|
title: "Variação sobre o período anterior",
|
|
1007
|
-
children:
|
|
1031
|
+
children: z(o, "percentage")
|
|
1008
1032
|
}
|
|
1009
1033
|
),
|
|
1010
|
-
s && m != null && /* @__PURE__ */
|
|
1034
|
+
s && m != null && /* @__PURE__ */ p(
|
|
1011
1035
|
"span",
|
|
1012
1036
|
{
|
|
1013
1037
|
className: `stmt__aux stmt__aux--${m < 0 ? "down" : "up"}`,
|
|
1014
1038
|
title: s,
|
|
1015
1039
|
children: [
|
|
1016
1040
|
"vs ",
|
|
1017
|
-
|
|
1041
|
+
z(m, "percentage")
|
|
1018
1042
|
]
|
|
1019
1043
|
}
|
|
1020
1044
|
)
|
|
1021
1045
|
] }, u);
|
|
1022
1046
|
}),
|
|
1023
|
-
|
|
1047
|
+
n && /* @__PURE__ */ r("td", { className: "stmt__value stmt__value--total", children: /* @__PURE__ */ r("span", { className: oe(e.total), children: e.totalFormatted ?? "-" }) })
|
|
1024
1048
|
] });
|
|
1025
1049
|
}
|
|
1026
|
-
function
|
|
1050
|
+
function rr({ token: e, palette: t, showDownload: n = !0, className: a }) {
|
|
1027
1051
|
const {
|
|
1028
1052
|
layout: l,
|
|
1029
1053
|
renderData: s,
|
|
@@ -1033,49 +1057,49 @@ function er({ token: e, palette: t, showDownload: a = !0, className: n }) {
|
|
|
1033
1057
|
setFilter: o,
|
|
1034
1058
|
downloadPdf: m,
|
|
1035
1059
|
downloading: d
|
|
1036
|
-
} =
|
|
1037
|
-
...
|
|
1038
|
-
...
|
|
1060
|
+
} = jt(e), [h, _] = T(!1), v = ["stmt", a].filter(Boolean).join(" "), S = {
|
|
1061
|
+
..._e(t),
|
|
1062
|
+
...Vt(l == null ? void 0 : l.colors)
|
|
1039
1063
|
};
|
|
1040
|
-
let
|
|
1064
|
+
let R;
|
|
1041
1065
|
if (i && !l)
|
|
1042
|
-
|
|
1066
|
+
R = /* @__PURE__ */ r("div", { className: "stmt__error", children: i });
|
|
1043
1067
|
else if (!l)
|
|
1044
|
-
|
|
1068
|
+
R = /* @__PURE__ */ r("div", { className: "stmt__state", children: "Carregando demonstrativo..." });
|
|
1045
1069
|
else {
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
l.filters.map((
|
|
1050
|
-
|
|
1070
|
+
const A = (s == null ? void 0 : s.dateBounds) ?? l.dateBounds, N = l.periods.showTotal, y = (s == null ? void 0 : s.columns) ?? [], k = (s == null ? void 0 : s.lines) ?? [], F = 1 + y.length + (N ? 1 : 0), x = k.some((w) => w.verticalAnalysis.length > 0), f = k.some((w) => w.horizontalAnalysis.length > 0), g = l.periods.comparisonOffset, C = g ? Xt(g, l.periods.granularity) : void 0, M = qt - (N ? 1 : 0), b = Math.max(0, y.length - M);
|
|
1071
|
+
R = /* @__PURE__ */ p(de, { children: [
|
|
1072
|
+
/* @__PURE__ */ p("div", { className: "stmt__toolbar", children: [
|
|
1073
|
+
l.filters.map((w) => /* @__PURE__ */ r(
|
|
1074
|
+
Ut,
|
|
1051
1075
|
{
|
|
1052
|
-
definition:
|
|
1053
|
-
value: u[
|
|
1054
|
-
options: l.filterOptions[
|
|
1055
|
-
bounds:
|
|
1056
|
-
rangeUnit:
|
|
1057
|
-
onChange: (L) => o(
|
|
1076
|
+
definition: w,
|
|
1077
|
+
value: u[w.id] ?? "",
|
|
1078
|
+
options: l.filterOptions[w.id] ?? [],
|
|
1079
|
+
bounds: A,
|
|
1080
|
+
rangeUnit: Kt[l.periods.granularity] ?? "day",
|
|
1081
|
+
onChange: (L) => o(w.id, L)
|
|
1058
1082
|
},
|
|
1059
|
-
|
|
1083
|
+
w.id
|
|
1060
1084
|
)),
|
|
1061
|
-
/* @__PURE__ */
|
|
1062
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ p("div", { className: "stmt__toolbar-end", children: [
|
|
1086
|
+
/* @__PURE__ */ p("span", { className: "stmt__bounds", children: [
|
|
1063
1087
|
"Base: ",
|
|
1064
|
-
|
|
1088
|
+
A.min,
|
|
1065
1089
|
" a ",
|
|
1066
|
-
|
|
1090
|
+
A.max
|
|
1067
1091
|
] }),
|
|
1068
|
-
|
|
1092
|
+
n && /* @__PURE__ */ r(
|
|
1069
1093
|
"button",
|
|
1070
1094
|
{
|
|
1071
1095
|
type: "button",
|
|
1072
1096
|
className: "stmt__download",
|
|
1073
1097
|
onClick: () => {
|
|
1074
|
-
if (
|
|
1075
|
-
|
|
1098
|
+
if (b > 0 && !h) {
|
|
1099
|
+
_(!0);
|
|
1076
1100
|
return;
|
|
1077
1101
|
}
|
|
1078
|
-
|
|
1102
|
+
_(!1), m();
|
|
1079
1103
|
},
|
|
1080
1104
|
disabled: d || !s,
|
|
1081
1105
|
title: "Baixar o documento em PDF",
|
|
@@ -1085,49 +1109,49 @@ function er({ token: e, palette: t, showDownload: a = !0, className: n }) {
|
|
|
1085
1109
|
] })
|
|
1086
1110
|
] }),
|
|
1087
1111
|
i && /* @__PURE__ */ r("div", { className: "stmt__error", children: i }),
|
|
1088
|
-
h &&
|
|
1112
|
+
h && b > 0 && /* @__PURE__ */ p("div", { className: "stmt__warning", children: [
|
|
1089
1113
|
"O PDF cabe ",
|
|
1090
|
-
|
|
1114
|
+
M,
|
|
1091
1115
|
" períodos e este documento tem ",
|
|
1092
|
-
|
|
1116
|
+
y.length,
|
|
1093
1117
|
": o arquivo sairá com os ",
|
|
1094
|
-
|
|
1118
|
+
M,
|
|
1095
1119
|
" mais recentes",
|
|
1096
|
-
|
|
1120
|
+
N && ", e a coluna de total seguirá cobrindo a janela inteira",
|
|
1097
1121
|
'. Clique em "Baixar PDF" de novo para gerar assim, ou reduza o período.'
|
|
1098
1122
|
] }),
|
|
1099
|
-
(s == null ? void 0 : s.truncated) && /* @__PURE__ */
|
|
1123
|
+
(s == null ? void 0 : s.truncated) && /* @__PURE__ */ p("div", { className: "stmt__warning", children: [
|
|
1100
1124
|
"A janela pedida excede o limite de colunas: o documento mostra as primeiras ",
|
|
1101
|
-
|
|
1125
|
+
y.length,
|
|
1102
1126
|
". Escolha um período menor ou uma coluna mais larga."
|
|
1103
1127
|
] }),
|
|
1104
|
-
s ?
|
|
1105
|
-
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */
|
|
1128
|
+
s ? y.length === 0 ? /* @__PURE__ */ r("div", { className: "stmt__state", children: "Nenhum período na janela selecionada." }) : k.length === 0 ? /* @__PURE__ */ r("div", { className: "stmt__state", children: "Este demonstrativo não possui linhas." }) : /* @__PURE__ */ r("div", { className: "stmt__scroll", children: /* @__PURE__ */ p("table", { className: "stmt__table", children: [
|
|
1129
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ p("tr", { children: [
|
|
1106
1130
|
/* @__PURE__ */ r("th", { className: "stmt__corner", scope: "col", children: s.name }),
|
|
1107
|
-
|
|
1108
|
-
|
|
1131
|
+
y.map((w) => /* @__PURE__ */ r("th", { scope: "col", title: `${w.start} a ${w.end}`, children: w.label }, w.key)),
|
|
1132
|
+
N && /* @__PURE__ */ r("th", { scope: "col", className: "stmt__total-head", children: l.periods.totalLabel })
|
|
1109
1133
|
] }) }),
|
|
1110
|
-
/* @__PURE__ */ r("tbody", { children:
|
|
1111
|
-
|
|
1134
|
+
/* @__PURE__ */ r("tbody", { children: k.map((w) => /* @__PURE__ */ r(
|
|
1135
|
+
Bt,
|
|
1112
1136
|
{
|
|
1113
|
-
line:
|
|
1114
|
-
columnCount:
|
|
1115
|
-
showTotal:
|
|
1116
|
-
showVertical:
|
|
1117
|
-
showHorizontal:
|
|
1118
|
-
comparisonLabel:
|
|
1137
|
+
line: w,
|
|
1138
|
+
columnCount: F,
|
|
1139
|
+
showTotal: N,
|
|
1140
|
+
showVertical: x,
|
|
1141
|
+
showHorizontal: f,
|
|
1142
|
+
comparisonLabel: C
|
|
1119
1143
|
},
|
|
1120
|
-
|
|
1144
|
+
w.id
|
|
1121
1145
|
)) })
|
|
1122
1146
|
] }) }) : /* @__PURE__ */ r("div", { className: "stmt__state", children: "Calculando..." }),
|
|
1123
1147
|
c && s && /* @__PURE__ */ r("div", { className: "stmt__recalculating", children: "Atualizando..." })
|
|
1124
1148
|
] });
|
|
1125
1149
|
}
|
|
1126
|
-
return /* @__PURE__ */ r("div", { className:
|
|
1150
|
+
return /* @__PURE__ */ r("div", { className: v, style: S, children: R });
|
|
1127
1151
|
}
|
|
1128
1152
|
export {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1153
|
+
lr as ApiError,
|
|
1154
|
+
tr as Dashboard,
|
|
1155
|
+
rr as Statement
|
|
1132
1156
|
};
|
|
1133
1157
|
//# sourceMappingURL=index.js.map
|