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