@actionexec/dashboards 0.18.0 → 0.19.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/README.md +4 -2
- package/dist/hooks/useCollapse.d.ts +2 -4
- package/dist/hooks/useCurrentPeriod.d.ts +12 -2
- package/dist/hooks/useStatementData.d.ts +4 -0
- package/dist/index.js +851 -822
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/statement.d.ts +22 -6
- package/package.json +1 -1
- package/dist/utils/statementOutline.d.ts +0 -40
- /package/dist/{utils/statementOutline.test.d.ts → hooks/useCollapse.test.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,358 +1,358 @@
|
|
|
1
1
|
import { jsxs as _, jsx as a, Fragment as V } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { M as
|
|
4
|
-
import { E as
|
|
5
|
-
import { LineChart as
|
|
2
|
+
import { useState as E, useRef as R, useEffect as O, useCallback as P, useMemo as F, memo as Fe } from "react";
|
|
3
|
+
import { M as B, f as Oe, a as Ie, c as ae, b as se, d as We, e as be, i as le, g as D, p as ze, h as J, j as ve, k as we, l as Y, m as De, r as He, D as ie, n as Ve, o as je, S as ye, C as Ge, q as Ke, s as Ne, t as Ye, u as Ue, v as Be, G as Xe, w as oe, x as qe, y as Qe, z as Ze, A as Je, B as et } from "./ColorPaletteSelector-nBO_fbbj.js";
|
|
4
|
+
import { E as Vr } from "./ColorPaletteSelector-nBO_fbbj.js";
|
|
5
|
+
import { LineChart as tt, Line as rt, AreaChart as nt, Area as at, BarChart as Se, Bar as X, CartesianGrid as ke, XAxis as Ce, YAxis as Re, Tooltip as q, Legend as st, Cell as ce, PieChart as lt, Pie as it } from "recharts";
|
|
6
6
|
function H(e, t = {}) {
|
|
7
|
-
const
|
|
8
|
-
for (const [
|
|
7
|
+
const n = {};
|
|
8
|
+
for (const [r, s] of Object.entries(e))
|
|
9
9
|
if (s.includes("|")) {
|
|
10
|
-
const [l,
|
|
11
|
-
l && (
|
|
10
|
+
const [l, i] = s.split("|");
|
|
11
|
+
l && (n.f_date_start = l), i && (n.f_date_end = i);
|
|
12
12
|
} else
|
|
13
|
-
|
|
14
|
-
for (const [
|
|
15
|
-
|
|
16
|
-
return
|
|
13
|
+
n[`f_${r}`] = s;
|
|
14
|
+
for (const [r, s] of Object.entries(t))
|
|
15
|
+
n[`v_${r}`] = String(s);
|
|
16
|
+
return n;
|
|
17
17
|
}
|
|
18
18
|
function j(e) {
|
|
19
19
|
return Object.keys(e).sort().map((t) => `${t}=${e[t]}`).join("&");
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return
|
|
21
|
+
function $e(e, t) {
|
|
22
|
+
const n = Object.keys(e);
|
|
23
|
+
return n.length !== Object.keys(t).length ? !1 : n.every((r) => e[r] === t[r]);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function xe(e) {
|
|
26
26
|
const t = {};
|
|
27
|
-
for (const [
|
|
28
|
-
if (
|
|
29
|
-
const s =
|
|
30
|
-
t[
|
|
31
|
-
} else Array.isArray(
|
|
27
|
+
for (const [n, r] of Object.entries(e))
|
|
28
|
+
if (r && typeof r == "object" && "start" in r) {
|
|
29
|
+
const s = r;
|
|
30
|
+
t[n] = `${s.start || ""}|${s.end || ""}`;
|
|
31
|
+
} else Array.isArray(r) ? t[n] = r.join(B) : typeof r == "string" && (t[n] = r);
|
|
32
32
|
return t;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
36
|
-
const [t,
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
}).catch((
|
|
42
|
-
|
|
34
|
+
const ot = 300;
|
|
35
|
+
function ct(e) {
|
|
36
|
+
const [t, n] = E(null), [r, s] = E(null), [l, i] = E({}), [o, u] = E({}), [c, d] = E(null), [m, h] = E(!0), [p, v] = E(null), f = R(), N = R(!1), w = R(null), y = R(!1);
|
|
37
|
+
O(() => {
|
|
38
|
+
let g = !1;
|
|
39
|
+
return N.current = !1, w.current = null, y.current = !1, Oe(e).then((b) => {
|
|
40
|
+
g || n(b);
|
|
41
|
+
}).catch((b) => {
|
|
42
|
+
g || v(b.message);
|
|
43
43
|
}), () => {
|
|
44
|
-
|
|
44
|
+
g = !0;
|
|
45
45
|
};
|
|
46
|
-
}, [e]),
|
|
46
|
+
}, [e]), O(() => {
|
|
47
47
|
if (!t) return;
|
|
48
48
|
if (t.widgets.length === 0) {
|
|
49
|
-
|
|
49
|
+
h(!1);
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
})),
|
|
62
|
-
}).catch((
|
|
63
|
-
},
|
|
64
|
-
|
|
52
|
+
const g = H(l, o), b = j(g);
|
|
53
|
+
if (b === w.current) return;
|
|
54
|
+
f.current && clearTimeout(f.current);
|
|
55
|
+
const S = y.current ? ot : 0;
|
|
56
|
+
return f.current = setTimeout(() => {
|
|
57
|
+
h(!0), Ie(e, g).then((x) => {
|
|
58
|
+
w.current = b, y.current = !0, s(x), !N.current && x.applied && (N.current = !0, i((C) => {
|
|
59
|
+
const k = { ...xe(x.applied), ...C };
|
|
60
|
+
return $e(k, C) ? C : (w.current = j(H(k, o)), k);
|
|
61
|
+
})), v(null);
|
|
62
|
+
}).catch((x) => v(x.message)).finally(() => h(!1));
|
|
63
|
+
}, S), () => {
|
|
64
|
+
f.current && clearTimeout(f.current);
|
|
65
65
|
};
|
|
66
|
-
}, [e, t, l,
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
}, []),
|
|
70
|
-
|
|
71
|
-
}, []),
|
|
72
|
-
|
|
73
|
-
}, []),
|
|
66
|
+
}, [e, t, l, o]);
|
|
67
|
+
const T = P((g, b) => {
|
|
68
|
+
i((S) => ({ ...S, [g]: b }));
|
|
69
|
+
}, []), A = P((g, b) => {
|
|
70
|
+
u((S) => ({ ...S, [g]: b }));
|
|
71
|
+
}, []), M = P((g) => {
|
|
72
|
+
d(g);
|
|
73
|
+
}, []), $ = F(
|
|
74
74
|
() => c ?? (t == null ? void 0 : t.palette) ?? [],
|
|
75
75
|
[c, t]
|
|
76
76
|
);
|
|
77
77
|
return {
|
|
78
78
|
layout: t,
|
|
79
|
-
renderData:
|
|
79
|
+
renderData: r,
|
|
80
80
|
loading: m,
|
|
81
|
-
error:
|
|
81
|
+
error: p,
|
|
82
82
|
filters: l,
|
|
83
|
-
variables:
|
|
84
|
-
palette:
|
|
85
|
-
setFilter:
|
|
86
|
-
setVariable:
|
|
87
|
-
setPalette:
|
|
83
|
+
variables: o,
|
|
84
|
+
palette: $,
|
|
85
|
+
setFilter: T,
|
|
86
|
+
setVariable: A,
|
|
87
|
+
setPalette: M
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
var t,
|
|
92
|
-
return ((
|
|
93
|
-
},
|
|
94
|
-
var t,
|
|
95
|
-
return ((
|
|
90
|
+
const dt = (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
|
+
}, ut = (e) => {
|
|
94
|
+
var t, n;
|
|
95
|
+
return ((n = (t = e.borderBoxSize) == null ? void 0 : t[0]) == null ? void 0 : n.blockSize) ?? e.target.offsetHeight;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
98
|
-
return e === void 0 ? 0 : e === "auto" ?
|
|
97
|
+
function mt(e, t, n) {
|
|
98
|
+
return e === void 0 ? 0 : e === "auto" ? We(t, n) : Math.max(0, e);
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function ht(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: n } = getComputedStyle(t);
|
|
104
|
+
if (n !== "visible")
|
|
105
|
+
return n === "hidden" || n === "clip" ? t : null;
|
|
106
106
|
t = t.parentElement;
|
|
107
107
|
}
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function ft(e) {
|
|
111
111
|
const t = R(e);
|
|
112
112
|
t.current = e;
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
!
|
|
118
|
-
`[@actionexec/dashboards] O dashboard esta sendo cortado: o container precisa de ${Math.ceil(
|
|
113
|
+
const n = R(null), r = R(null), s = R(null), l = R(null), i = R(null), o = R(0), u = R(0), c = R(!1), d = R(!1), m = R(-1), [h, p] = E(!1), v = P((g) => {
|
|
114
|
+
const b = r.current;
|
|
115
|
+
if (d.current || t.current.silenceWarnings || !b) return;
|
|
116
|
+
const S = ht(b);
|
|
117
|
+
!S || S.clientHeight >= g.gridHeight || (d.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 ${S.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 L,
|
|
122
|
-
if (!
|
|
123
|
-
const { columns:
|
|
124
|
-
containerWidth:
|
|
125
|
-
cellWidth:
|
|
126
|
-
cellHeight:
|
|
127
|
-
gridHeight:
|
|
120
|
+
}, []), f = P(() => {
|
|
121
|
+
var L, I;
|
|
122
|
+
if (!n.current) return;
|
|
123
|
+
const { columns: g, cellAspect: b } = t.current, S = o.current, x = se(S, g), C = {
|
|
124
|
+
containerWidth: S,
|
|
125
|
+
cellWidth: x,
|
|
126
|
+
cellHeight: ae(x, b),
|
|
127
|
+
gridHeight: u.current,
|
|
128
128
|
stacked: c.current
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
}, [
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
m.current =
|
|
137
|
-
const { columns:
|
|
138
|
-
|
|
139
|
-
const L =
|
|
140
|
-
|
|
141
|
-
}, []),
|
|
129
|
+
}, k = i.current;
|
|
130
|
+
k && k.containerWidth === C.containerWidth && k.cellWidth === C.cellWidth && k.cellHeight === C.cellHeight && k.gridHeight === C.gridHeight && k.stacked === C.stacked || (i.current = C, (I = (L = t.current).onGeometryChange) == null || I.call(L, C), v(C));
|
|
131
|
+
}, [v]), N = P((g = !1) => {
|
|
132
|
+
const b = n.current;
|
|
133
|
+
if (!b) return;
|
|
134
|
+
const S = o.current;
|
|
135
|
+
if (!g && S === m.current) return;
|
|
136
|
+
m.current = S;
|
|
137
|
+
const { columns: x, cellAspect: C, stackBelow: k } = t.current, z = se(S, x);
|
|
138
|
+
b.style.setProperty("--dash-cell-h", `${ae(z, C)}px`);
|
|
139
|
+
const L = mt(k, x, C), I = L > 0 && S > 0 && S < L;
|
|
140
|
+
I !== c.current && (c.current = I, p(I));
|
|
141
|
+
}, []), w = P(() => {
|
|
142
142
|
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
143
|
-
}, []),
|
|
143
|
+
}, []), y = P(() => {
|
|
144
144
|
l.current === null && (l.current = requestAnimationFrame(() => {
|
|
145
|
-
l.current = null,
|
|
145
|
+
l.current = null, N(), f();
|
|
146
146
|
}));
|
|
147
|
-
}, [
|
|
148
|
-
for (const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}, [
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
|
|
147
|
+
}, [N, f]), T = P((g) => {
|
|
148
|
+
for (const b of g)
|
|
149
|
+
b.target === n.current ? o.current = Math.round(dt(b)) : b.target === r.current && (u.current = ut(b));
|
|
150
|
+
y();
|
|
151
|
+
}, [y]), A = P(() => s.current ? s.current : typeof ResizeObserver > "u" ? null : (s.current = new ResizeObserver(T), s.current), [T]), M = P((g) => {
|
|
152
|
+
const b = A();
|
|
153
|
+
n.current && (b == null || b.unobserve(n.current)), n.current = g, g && (b == null || b.observe(g), o.current = Math.round(g.getBoundingClientRect().width), N(!0), y());
|
|
154
|
+
}, [N, A, y]), $ = P((g) => {
|
|
155
|
+
const b = A();
|
|
156
|
+
if (r.current && (b == null || b.unobserve(r.current)), r.current = g, !g) {
|
|
157
|
+
u.current = 0;
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
}, [
|
|
162
|
-
return
|
|
163
|
-
const
|
|
164
|
-
return
|
|
165
|
-
var
|
|
166
|
-
(
|
|
160
|
+
b == null || b.observe(g), u.current = g.getBoundingClientRect().height, y();
|
|
161
|
+
}, [A, y]);
|
|
162
|
+
return O(() => {
|
|
163
|
+
const g = A();
|
|
164
|
+
return n.current && (g == null || g.observe(n.current)), r.current && (g == null || g.observe(r.current)), () => {
|
|
165
|
+
var b;
|
|
166
|
+
(b = s.current) == null || b.disconnect(), s.current = null, w();
|
|
167
167
|
};
|
|
168
|
-
}, [
|
|
169
|
-
|
|
170
|
-
}, [e.columns, e.cellAspect, e.stackBelow,
|
|
168
|
+
}, [A, w]), O(() => {
|
|
169
|
+
n.current && (N(!0), y());
|
|
170
|
+
}, [e.columns, e.cellAspect, e.stackBelow, N, y]), { rootRef: M, gridRef: $, stacked: h };
|
|
171
171
|
}
|
|
172
|
-
const
|
|
172
|
+
const pt = {
|
|
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__ */ a("div", { className: `widget__state widget__state--${e}`, role: e === "error" ? "alert" : void 0, children: t ||
|
|
178
|
+
function ee({ kind: e, message: t }) {
|
|
179
|
+
return /* @__PURE__ */ a("div", { className: `widget__state widget__state--${e}`, role: e === "error" ? "alert" : void 0, children: t || pt[e] });
|
|
180
180
|
}
|
|
181
|
-
function W({ name: e, title: t, state:
|
|
181
|
+
function W({ name: e, title: t, state: n, stateMessage: r, toolbar: s, children: l }) {
|
|
182
182
|
return /* @__PURE__ */ _("div", { className: `widget widget-${e}`, children: [
|
|
183
183
|
t && /* @__PURE__ */ a("span", { className: "widget__title", children: t }),
|
|
184
184
|
s,
|
|
185
|
-
|
|
185
|
+
n ? /* @__PURE__ */ a(ee, { kind: n, message: r }) : l
|
|
186
186
|
] });
|
|
187
187
|
}
|
|
188
|
-
const
|
|
189
|
-
function
|
|
188
|
+
const _t = { up: "↑", down: "↓" };
|
|
189
|
+
function Te(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__ */ _("div", { className: `widget-kpi__trend widget-kpi__trend--${
|
|
194
|
+
function gt({ comparison: e, primary: t }) {
|
|
195
|
+
const n = e.sentiment ?? "neutral", r = _t[e.trend ?? ""] ?? "";
|
|
196
|
+
return /* @__PURE__ */ _("div", { className: `widget-kpi__trend widget-kpi__trend--${n}${t ? "" : " widget-kpi__trend--muted"}`, children: [
|
|
197
197
|
/* @__PURE__ */ _("span", { className: "widget-kpi__variance", children: [
|
|
198
|
-
|
|
198
|
+
r,
|
|
199
199
|
" ",
|
|
200
200
|
e.formatted
|
|
201
201
|
] }),
|
|
202
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__ */ _(W, { name: "kpi", title:
|
|
208
|
-
/* @__PURE__ */ a("span", { className: "widget-kpi__value", children:
|
|
209
|
-
s.map((l,
|
|
205
|
+
function bt({ data: e, label: t }) {
|
|
206
|
+
const n = t || String(e.label || ""), r = String(e.formatted || "-"), s = Te(e.comparisons);
|
|
207
|
+
return /* @__PURE__ */ _(W, { name: "kpi", title: n, children: [
|
|
208
|
+
/* @__PURE__ */ a("span", { className: "widget-kpi__value", children: r }),
|
|
209
|
+
s.map((l, i) => /* @__PURE__ */ a(gt, { comparison: l, primary: i === 0 }, l.id || i))
|
|
210
210
|
] });
|
|
211
211
|
}
|
|
212
|
-
const
|
|
212
|
+
const vt = "var(--bg-elevated)", wt = [
|
|
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 s =
|
|
224
|
-
return `M ${e -
|
|
225
|
-
}
|
|
226
|
-
function
|
|
227
|
-
const
|
|
228
|
-
return /* @__PURE__ */ a(W, { name: "gauge", title:
|
|
229
|
-
/* @__PURE__ */ _("svg", { viewBox: "0 0 100 56", preserveAspectRatio: "xMidYMax meet", role: "img", "aria-label": `${
|
|
230
|
-
/* @__PURE__ */ a("path", { d:
|
|
231
|
-
|
|
219
|
+
function de(e, t, n, r) {
|
|
220
|
+
if (r <= 0) return "";
|
|
221
|
+
if (r >= 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 s = r * Math.PI;
|
|
224
|
+
return `M ${e - n} ${t} A ${n} ${n} 0 0 1 ${e - n * Math.cos(s)} ${t - n * Math.sin(s)}`;
|
|
225
|
+
}
|
|
226
|
+
function yt({ data: e, palette: t, label: n }) {
|
|
227
|
+
const r = n || 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 || be(e.value, l)), o = String(e.formatted || "-"), u = Te(e.comparisons), [c, ...d] = u, m = String((c == null ? void 0 : c.baseline_formatted) || "-"), h = (c == null ? void 0 : c.label) ?? null, p = s >= 1, v = Math.min(Math.max(s, 0), 1), f = wt.find(([M]) => s >= M), N = (f == null ? void 0 : f[1]) || t[0] || "var(--color-info)", w = 50, y = 50, T = 44, A = 10;
|
|
228
|
+
return /* @__PURE__ */ a(W, { name: "gauge", title: r, 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(w, y, T, 1), fill: "none", stroke: vt, strokeWidth: A, strokeLinecap: "butt" }),
|
|
231
|
+
v > 0 && /* @__PURE__ */ a("path", { d: de(w, y, T, v), fill: "none", stroke: N, strokeWidth: A, strokeLinecap: "butt" })
|
|
232
232
|
] }),
|
|
233
233
|
/* @__PURE__ */ _("div", { className: "widget-gauge__center", children: [
|
|
234
|
-
/* @__PURE__ */ a("span", { className: "widget-gauge__percent", children:
|
|
234
|
+
/* @__PURE__ */ a("span", { className: "widget-gauge__percent", children: o }),
|
|
235
235
|
/* @__PURE__ */ _("span", { className: "widget-gauge__comparison", children: [
|
|
236
|
-
|
|
236
|
+
i,
|
|
237
237
|
" / ",
|
|
238
238
|
m
|
|
239
239
|
] }),
|
|
240
|
-
|
|
241
|
-
!
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
p && /* @__PURE__ */ a("span", { className: "widget-gauge__badge", children: h || "Meta batida" }),
|
|
241
|
+
!p && h && /* @__PURE__ */ a("span", { className: "widget-gauge__comparison", children: h }),
|
|
242
|
+
d.map((M, $) => /* @__PURE__ */ _("span", { className: "widget-gauge__comparison", children: [
|
|
243
|
+
M.formatted,
|
|
244
244
|
" ",
|
|
245
|
-
|
|
246
|
-
] },
|
|
245
|
+
M.label
|
|
246
|
+
] }, M.id || $))
|
|
247
247
|
] })
|
|
248
248
|
] }) });
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
const [t,
|
|
252
|
-
return
|
|
253
|
-
const
|
|
254
|
-
if (!
|
|
250
|
+
function te(e) {
|
|
251
|
+
const [t, n] = E({ width: 0, height: 0 });
|
|
252
|
+
return O(() => {
|
|
253
|
+
const r = e.current;
|
|
254
|
+
if (!r) return;
|
|
255
255
|
const s = new ResizeObserver(([l]) => {
|
|
256
|
-
const { width:
|
|
257
|
-
|
|
258
|
-
(
|
|
256
|
+
const { width: i, height: o } = l.contentRect;
|
|
257
|
+
n(
|
|
258
|
+
(u) => u.width !== Math.floor(i) || u.height !== Math.floor(o) ? { width: Math.floor(i), height: Math.floor(o) } : u
|
|
259
259
|
);
|
|
260
260
|
});
|
|
261
|
-
return s.observe(
|
|
261
|
+
return s.observe(r), () => s.disconnect();
|
|
262
262
|
}, [e]), t;
|
|
263
263
|
}
|
|
264
|
-
const
|
|
264
|
+
const ue = { fontSize: 10, fill: "var(--text-muted)" }, Nt = "var(--bg-elevated)", St = {
|
|
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
|
+
}, kt = {
|
|
270
270
|
color: "var(--text-primary)",
|
|
271
271
|
fontWeight: 600
|
|
272
272
|
};
|
|
273
|
-
function
|
|
273
|
+
function Ct(e, t) {
|
|
274
274
|
var s;
|
|
275
|
-
const
|
|
276
|
-
return typeof
|
|
277
|
-
}
|
|
278
|
-
function
|
|
279
|
-
return /* @__PURE__ */ _(e, { data: t, width:
|
|
280
|
-
/* @__PURE__ */ a(
|
|
281
|
-
/* @__PURE__ */ a(
|
|
282
|
-
/* @__PURE__ */ a(
|
|
275
|
+
const n = Array.isArray(t) ? t[0] : void 0, r = (s = n == null ? void 0 : n.payload) == null ? void 0 : s.tooltipLabel;
|
|
276
|
+
return typeof r == "string" && r ? r : String(e ?? "");
|
|
277
|
+
}
|
|
278
|
+
function U({ Chart: e, chartData: t, xKey: n, series: r, palette: s, renderSeries: l, width: i, height: o }) {
|
|
279
|
+
return /* @__PURE__ */ _(e, { data: t, width: i, height: o, children: [
|
|
280
|
+
/* @__PURE__ */ a(ke, { strokeDasharray: "3 3", stroke: Nt }),
|
|
281
|
+
/* @__PURE__ */ a(Ce, { dataKey: n, tick: ue }),
|
|
282
|
+
/* @__PURE__ */ a(Re, { tick: ue }),
|
|
283
283
|
/* @__PURE__ */ a(
|
|
284
|
-
|
|
284
|
+
q,
|
|
285
285
|
{
|
|
286
|
-
contentStyle:
|
|
287
|
-
labelStyle:
|
|
288
|
-
labelFormatter:
|
|
286
|
+
contentStyle: St,
|
|
287
|
+
labelStyle: kt,
|
|
288
|
+
labelFormatter: Ct,
|
|
289
289
|
cursor: { fill: "var(--bg-paper)", opacity: 0.3 }
|
|
290
290
|
}
|
|
291
291
|
),
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
r.length > 1 && /* @__PURE__ */ a(st, {}),
|
|
293
|
+
r.map((u, c) => l(u, s[c % s.length], c))
|
|
294
294
|
] });
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
298
|
-
if (c <= 0 ||
|
|
299
|
-
const
|
|
300
|
-
return
|
|
301
|
-
|
|
296
|
+
function Rt({ data: e, palette: t, label: n }) {
|
|
297
|
+
const r = String(e.chartType || "bar"), s = n || String(e.label || ""), l = String(e.xKey || "label"), i = e.series || [], o = e.data || [], u = R(null), { width: c, height: d } = te(u), m = () => {
|
|
298
|
+
if (c <= 0 || d <= 0) return null;
|
|
299
|
+
const h = { chartData: o, xKey: l, series: i, palette: t, width: c, height: d };
|
|
300
|
+
return r === "line" ? /* @__PURE__ */ a(U, { ...h, Chart: tt, renderSeries: (p, v) => /* @__PURE__ */ a(
|
|
301
|
+
rt,
|
|
302
302
|
{
|
|
303
303
|
type: "monotone",
|
|
304
|
-
dataKey:
|
|
305
|
-
name:
|
|
306
|
-
stroke:
|
|
304
|
+
dataKey: p.key,
|
|
305
|
+
name: p.label,
|
|
306
|
+
stroke: v,
|
|
307
307
|
strokeWidth: 2,
|
|
308
|
-
dot:
|
|
308
|
+
dot: o.length <= 31
|
|
309
309
|
},
|
|
310
|
-
|
|
311
|
-
) }) :
|
|
312
|
-
|
|
310
|
+
p.key
|
|
311
|
+
) }) : r === "area" ? /* @__PURE__ */ a(U, { ...h, Chart: nt, renderSeries: (p, v) => /* @__PURE__ */ a(
|
|
312
|
+
at,
|
|
313
313
|
{
|
|
314
314
|
type: "monotone",
|
|
315
|
-
dataKey:
|
|
316
|
-
name:
|
|
317
|
-
fill:
|
|
318
|
-
stroke:
|
|
315
|
+
dataKey: p.key,
|
|
316
|
+
name: p.label,
|
|
317
|
+
fill: v,
|
|
318
|
+
stroke: v,
|
|
319
319
|
fillOpacity: 0.3
|
|
320
320
|
},
|
|
321
|
-
|
|
322
|
-
) }) : /* @__PURE__ */ a(
|
|
321
|
+
p.key
|
|
322
|
+
) }) : /* @__PURE__ */ a(U, { ...h, Chart: Se, renderSeries: (p, v) => /* @__PURE__ */ a(
|
|
323
323
|
X,
|
|
324
324
|
{
|
|
325
|
-
dataKey:
|
|
326
|
-
name:
|
|
327
|
-
fill:
|
|
325
|
+
dataKey: p.key,
|
|
326
|
+
name: p.label,
|
|
327
|
+
fill: v,
|
|
328
328
|
radius: [3, 3, 0, 0]
|
|
329
329
|
},
|
|
330
|
-
|
|
330
|
+
p.key
|
|
331
331
|
) });
|
|
332
332
|
};
|
|
333
|
-
return /* @__PURE__ */ a(W, { name: "chart", title: s, children: /* @__PURE__ */ a("div", { ref:
|
|
333
|
+
return /* @__PURE__ */ a(W, { name: "chart", title: s, children: /* @__PURE__ */ a("div", { ref: u, className: "widget-chart__container", children: o.length === 0 ? /* @__PURE__ */ a(ee, { kind: "empty" }) : m() }) });
|
|
334
334
|
}
|
|
335
|
-
const
|
|
336
|
-
function
|
|
335
|
+
const me = { fontSize: 10, fill: "var(--text-muted)" }, $t = "var(--bg-elevated)", xt = { fill: "var(--bg-paper)", opacity: 0.3 };
|
|
336
|
+
function Tt(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__ */ a("span", { className: "widget-composition__tooltip-label", children:
|
|
344
|
-
/* @__PURE__ */ a("span", { className: "widget-composition__tooltip-value", children:
|
|
339
|
+
function he({ active: e, payload: t }) {
|
|
340
|
+
var r;
|
|
341
|
+
const n = e ? (r = t == null ? void 0 : t[0]) == null ? void 0 : r.payload : void 0;
|
|
342
|
+
return n ? /* @__PURE__ */ _("div", { className: "widget-composition__tooltip", children: [
|
|
343
|
+
/* @__PURE__ */ a("span", { className: "widget-composition__tooltip-label", children: n.label }),
|
|
344
|
+
/* @__PURE__ */ a("span", { className: "widget-composition__tooltip-value", children: n.formatted })
|
|
345
345
|
] }) : null;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
const
|
|
349
|
-
/* @__PURE__ */ a(
|
|
350
|
-
/* @__PURE__ */ a(
|
|
351
|
-
/* @__PURE__ */ a(
|
|
352
|
-
/* @__PURE__ */ a(
|
|
347
|
+
function Pt({ data: e, palette: t, label: n }) {
|
|
348
|
+
const r = n || String(e.label || ""), s = String(e.display || "pie"), l = e.data || [], i = typeof e.format == "string" ? e.format : void 0, o = R(null), { width: u, height: c } = te(o), d = () => /* @__PURE__ */ _(Se, { data: l, width: u, height: c, children: [
|
|
349
|
+
/* @__PURE__ */ a(ke, { strokeDasharray: "3 3", stroke: $t }),
|
|
350
|
+
/* @__PURE__ */ a(Ce, { dataKey: "label", tick: me, interval: 0 }),
|
|
351
|
+
/* @__PURE__ */ a(Re, { tick: me, tickFormatter: (h) => be(h, i) }),
|
|
352
|
+
/* @__PURE__ */ a(q, { content: /* @__PURE__ */ a(he, {}), cursor: xt }),
|
|
353
353
|
/* @__PURE__ */ a(X, { dataKey: "base", stackId: "bridge", fill: "none", fillOpacity: 0, isAnimationActive: !1 }),
|
|
354
|
-
/* @__PURE__ */ a(X, { dataKey: "span", stackId: "bridge", radius: [3, 3, 0, 0], children: l.map((
|
|
355
|
-
] }), m = () => /* @__PURE__ */ _(
|
|
354
|
+
/* @__PURE__ */ a(X, { dataKey: "span", stackId: "bridge", radius: [3, 3, 0, 0], children: l.map((h, p) => /* @__PURE__ */ a(ce, { fill: Tt(h) }, p)) })
|
|
355
|
+
] }), m = () => /* @__PURE__ */ _(lt, { width: u, height: c, children: [
|
|
356
356
|
/* @__PURE__ */ a(
|
|
357
357
|
it,
|
|
358
358
|
{
|
|
@@ -362,101 +362,101 @@ function At({ data: e, palette: t, label: r }) {
|
|
|
362
362
|
cx: "50%",
|
|
363
363
|
cy: "50%",
|
|
364
364
|
outerRadius: "75%",
|
|
365
|
-
label: ({ name:
|
|
365
|
+
label: ({ name: h, percent: p }) => `${h}: ${(p * 100).toFixed(0)}%`,
|
|
366
366
|
labelLine: !1,
|
|
367
|
-
children: l.map((
|
|
367
|
+
children: l.map((h, p) => /* @__PURE__ */ a(ce, { fill: t[p % t.length] }, p))
|
|
368
368
|
}
|
|
369
369
|
),
|
|
370
|
-
/* @__PURE__ */ a(
|
|
370
|
+
/* @__PURE__ */ a(q, { content: /* @__PURE__ */ a(he, {}) })
|
|
371
371
|
] });
|
|
372
|
-
return /* @__PURE__ */ a(W, { name: "composition", title:
|
|
372
|
+
return /* @__PURE__ */ a(W, { name: "composition", title: r, children: /* @__PURE__ */ a("div", { ref: o, className: "widget-composition__container", children: l.length === 0 || u <= 0 || c <= 0 ? /* @__PURE__ */ a(ee, { kind: "empty" }) : s === "bridge" ? d() : m() }) });
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function At(e, t) {
|
|
375
375
|
if (t !== "percentage") return "";
|
|
376
|
-
const
|
|
377
|
-
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";
|
|
378
378
|
}
|
|
379
|
-
function Et(e, t,
|
|
380
|
-
const s = (
|
|
379
|
+
function Et(e, t, n, r) {
|
|
380
|
+
const s = (r == null ? void 0 : r.offsetHeight) ?? 0;
|
|
381
381
|
if (e === 0 || t <= 0 || s <= 0) return e;
|
|
382
|
-
const l = Math.floor((t - ((
|
|
382
|
+
const l = Math.floor((t - ((n == null ? void 0 : n.offsetHeight) ?? 0)) / s);
|
|
383
383
|
return Math.max(0, Math.min(e, l));
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
var
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
((
|
|
392
|
-
)) :
|
|
393
|
-
return
|
|
385
|
+
function Mt({ data: e, label: t }) {
|
|
386
|
+
var h;
|
|
387
|
+
const n = e.columns || [], r = e.rows || [], s = e.overflow === "clip", l = e.indexColumn === !0, i = t || String(e.label || ""), o = R(null), u = R(null), c = R(null), { height: d } = te(o), m = s ? r.slice(0, Et(
|
|
388
|
+
r.length,
|
|
389
|
+
d,
|
|
390
|
+
u.current,
|
|
391
|
+
((h = c.current) == null ? void 0 : h.firstElementChild) ?? null
|
|
392
|
+
)) : r;
|
|
393
|
+
return n.length === 0 ? /* @__PURE__ */ a(
|
|
394
394
|
W,
|
|
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__ */ a(W, { name: "table", title:
|
|
401
|
+
) : /* @__PURE__ */ a(W, { name: "table", title: i, children: /* @__PURE__ */ a(
|
|
402
402
|
"div",
|
|
403
403
|
{
|
|
404
|
-
ref:
|
|
404
|
+
ref: o,
|
|
405
405
|
className: `widget-table__scroll${s ? " widget-table__scroll--clip" : ""}`,
|
|
406
406
|
children: /* @__PURE__ */ _(
|
|
407
407
|
"table",
|
|
408
408
|
{
|
|
409
|
-
className: `widget-table__table${s && m.length <
|
|
409
|
+
className: `widget-table__table${s && m.length < r.length ? "" : " widget-table__table--fill"}`,
|
|
410
410
|
children: [
|
|
411
|
-
/* @__PURE__ */ a("thead", { ref:
|
|
411
|
+
/* @__PURE__ */ a("thead", { ref: u, children: /* @__PURE__ */ _("tr", { children: [
|
|
412
412
|
l && /* @__PURE__ */ a("th", { className: "widget-table__th widget-table__th--index", children: "#" }),
|
|
413
|
-
|
|
413
|
+
n.map((p) => /* @__PURE__ */ a(
|
|
414
414
|
"th",
|
|
415
415
|
{
|
|
416
|
-
className: `widget-table__th${
|
|
417
|
-
children:
|
|
416
|
+
className: `widget-table__th${le(p.format) ? " widget-table__th--num" : ""}`,
|
|
417
|
+
children: p.label || p.key
|
|
418
418
|
},
|
|
419
|
-
|
|
419
|
+
p.key
|
|
420
420
|
))
|
|
421
421
|
] }) }),
|
|
422
422
|
/* @__PURE__ */ a("tbody", { ref: c, children: m.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: n.length + (l ? 1 : 0),
|
|
427
427
|
children: "Sem dados"
|
|
428
428
|
}
|
|
429
|
-
) }) : m.map((
|
|
430
|
-
l && /* @__PURE__ */ a("td", { className: "widget-table__td widget-table__td--index", children:
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
return /* @__PURE__ */ a("td", { className: `widget-table__td${
|
|
429
|
+
) }) : m.map((p, v) => /* @__PURE__ */ _("tr", { children: [
|
|
430
|
+
l && /* @__PURE__ */ a("td", { className: "widget-table__td widget-table__td--index", children: v + 1 }),
|
|
431
|
+
n.map((f) => {
|
|
432
|
+
const N = p[f.key], w = le(f.format) ? " widget-table__td--num" : "";
|
|
433
|
+
return /* @__PURE__ */ a("td", { className: `widget-table__td${w}${At(N, f.format)}`, children: D(N, f.format) }, f.key);
|
|
434
434
|
})
|
|
435
|
-
] },
|
|
435
|
+
] }, v)) })
|
|
436
436
|
]
|
|
437
437
|
}
|
|
438
438
|
)
|
|
439
439
|
}
|
|
440
440
|
) });
|
|
441
441
|
}
|
|
442
|
-
function
|
|
443
|
-
return e === "yearly" ? /* @__PURE__ */ a(Ot, { value: t, dateBounds:
|
|
442
|
+
function Pe({ mode: e, value: t, dateBounds: n, rangeUnit: r, onChange: s }) {
|
|
443
|
+
return e === "yearly" ? /* @__PURE__ */ a(Ot, { value: t, dateBounds: n, onChange: s }) : e === "monthly" ? /* @__PURE__ */ a(It, { value: t, dateBounds: n, onChange: s }) : e === "weekly" ? /* @__PURE__ */ a(Wt, { value: t, dateBounds: n, onChange: s }) : r && r !== "day" ? /* @__PURE__ */ a(
|
|
444
444
|
Lt,
|
|
445
445
|
{
|
|
446
446
|
value: t,
|
|
447
|
-
dateBounds:
|
|
448
|
-
unit:
|
|
447
|
+
dateBounds: n,
|
|
448
|
+
unit: r,
|
|
449
449
|
onChange: s
|
|
450
450
|
}
|
|
451
|
-
) : /* @__PURE__ */ a(Ft, { value: t, dateBounds:
|
|
452
|
-
}
|
|
453
|
-
function Lt({ value: e, dateBounds: t, unit:
|
|
454
|
-
const [s, l] = e ? e.split("|") : ["", ""],
|
|
455
|
-
var
|
|
456
|
-
return ((
|
|
457
|
-
},
|
|
458
|
-
const m =
|
|
459
|
-
m &&
|
|
451
|
+
) : /* @__PURE__ */ a(Ft, { value: t, dateBounds: n, onChange: s });
|
|
452
|
+
}
|
|
453
|
+
function Lt({ value: e, dateBounds: t, unit: n, onChange: r }) {
|
|
454
|
+
const [s, l] = e ? e.split("|") : ["", ""], i = He(n, t), o = (c) => {
|
|
455
|
+
var d;
|
|
456
|
+
return ((d = i.find((m) => c >= m.start && c <= m.end)) == null ? void 0 : d.key) ?? "";
|
|
457
|
+
}, u = (c, d) => {
|
|
458
|
+
const m = i.find((h) => h.key === d);
|
|
459
|
+
m && r(c === "start" ? `${m.start}|${!l || l < m.end ? m.end : l}` : `${!s || s > m.start ? m.start : s}|${m.end}`);
|
|
460
460
|
};
|
|
461
461
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--period", children: [
|
|
462
462
|
/* @__PURE__ */ _(
|
|
@@ -464,11 +464,11 @@ function Lt({ value: e, dateBounds: t, unit: r, onChange: n }) {
|
|
|
464
464
|
{
|
|
465
465
|
className: "widget-filter__select",
|
|
466
466
|
"aria-label": "Período inicial",
|
|
467
|
-
value:
|
|
468
|
-
onChange: (c) =>
|
|
467
|
+
value: o(s),
|
|
468
|
+
onChange: (c) => u("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
|
),
|
|
@@ -477,146 +477,146 @@ function Lt({ value: e, dateBounds: t, unit: r, onChange: n }) {
|
|
|
477
477
|
{
|
|
478
478
|
className: "widget-filter__select",
|
|
479
479
|
"aria-label": "Período final",
|
|
480
|
-
value:
|
|
481
|
-
onChange: (c) =>
|
|
480
|
+
value: o(l),
|
|
481
|
+
onChange: (c) => u("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 Ft({ value: e, dateBounds: t, onChange:
|
|
491
|
-
const [
|
|
490
|
+
function Ft({ value: e, dateBounds: t, onChange: n }) {
|
|
491
|
+
const [r, s] = e ? e.split("|") : ["", ""];
|
|
492
492
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
|
|
493
493
|
/* @__PURE__ */ a(
|
|
494
494
|
ie,
|
|
495
495
|
{
|
|
496
|
-
value:
|
|
496
|
+
value: r,
|
|
497
497
|
minIso: t == null ? void 0 : t.min,
|
|
498
498
|
maxIso: s || (t == null ? void 0 : t.max),
|
|
499
499
|
selectsStart: !0,
|
|
500
|
-
startIso:
|
|
500
|
+
startIso: r,
|
|
501
501
|
endIso: s,
|
|
502
502
|
placeholder: "Data inicial",
|
|
503
|
-
onChange: (l) =>
|
|
503
|
+
onChange: (l) => n(`${l}|${s}`)
|
|
504
504
|
}
|
|
505
505
|
),
|
|
506
506
|
/* @__PURE__ */ a(
|
|
507
507
|
ie,
|
|
508
508
|
{
|
|
509
509
|
value: s,
|
|
510
|
-
minIso:
|
|
510
|
+
minIso: r || (t == null ? void 0 : t.min),
|
|
511
511
|
maxIso: t == null ? void 0 : t.max,
|
|
512
512
|
selectsEnd: !0,
|
|
513
|
-
startIso:
|
|
513
|
+
startIso: r,
|
|
514
514
|
endIso: s,
|
|
515
515
|
placeholder: "Data final",
|
|
516
|
-
onChange: (l) =>
|
|
516
|
+
onChange: (l) => n(`${r}|${l}`)
|
|
517
517
|
}
|
|
518
518
|
)
|
|
519
519
|
] });
|
|
520
520
|
}
|
|
521
|
-
function Ot({ value: e, dateBounds: t, onChange:
|
|
522
|
-
const [
|
|
523
|
-
const
|
|
524
|
-
|
|
521
|
+
function Ot({ value: e, dateBounds: t, onChange: n }) {
|
|
522
|
+
const [r] = e ? e.split("|") : [""], s = ze(r), l = /* @__PURE__ */ new Date(), i = (s == null ? void 0 : s.year) ?? l.getFullYear(), o = J(t), u = (c) => {
|
|
523
|
+
const d = je(c);
|
|
524
|
+
n(`${d.start}|${d.end}`);
|
|
525
525
|
};
|
|
526
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: (c) =>
|
|
532
|
-
children:
|
|
530
|
+
value: i,
|
|
531
|
+
onChange: (c) => u(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 It({ value: e, dateBounds: t, onChange: n }) {
|
|
537
|
+
const [r] = e ? e.split("|") : [""], s = ve(r), l = /* @__PURE__ */ new Date(), i = (s == null ? void 0 : s.year) ?? l.getFullYear(), o = (s == null ? void 0 : s.month) ?? l.getMonth() + 1, u = J(t), c = (d, m) => {
|
|
538
|
+
const h = Ve(d, m);
|
|
539
|
+
n(`${h.start}|${h.end}`);
|
|
540
540
|
};
|
|
541
541
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--month", children: [
|
|
542
542
|
/* @__PURE__ */ a(
|
|
543
543
|
"select",
|
|
544
544
|
{
|
|
545
545
|
className: "widget-filter__select",
|
|
546
|
-
value:
|
|
547
|
-
onChange: (
|
|
548
|
-
children: we.map((
|
|
546
|
+
value: o,
|
|
547
|
+
onChange: (d) => c(i, parseInt(d.target.value)),
|
|
548
|
+
children: we.map((d, m) => /* @__PURE__ */ a("option", { value: m + 1, children: d }, m + 1))
|
|
549
549
|
}
|
|
550
550
|
),
|
|
551
551
|
/* @__PURE__ */ a(
|
|
552
552
|
"select",
|
|
553
553
|
{
|
|
554
554
|
className: "widget-filter__select",
|
|
555
|
-
value:
|
|
556
|
-
onChange: (
|
|
557
|
-
children:
|
|
555
|
+
value: i,
|
|
556
|
+
onChange: (d) => c(parseInt(d.target.value), o),
|
|
557
|
+
children: u.map((d) => /* @__PURE__ */ a("option", { value: d, children: d }, d))
|
|
558
558
|
}
|
|
559
559
|
)
|
|
560
560
|
] });
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
const [
|
|
562
|
+
function Wt({ value: e, dateBounds: t, onChange: n }) {
|
|
563
|
+
const [r] = e ? e.split("|") : [""], s = ve(r), l = /* @__PURE__ */ new Date(), i = (s == null ? void 0 : s.year) ?? l.getFullYear(), o = (s == null ? void 0 : s.month) ?? l.getMonth() + 1, u = J(t), c = Y(i, o), d = De(r, i, o) || 1;
|
|
564
564
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
|
|
565
565
|
/* @__PURE__ */ a(
|
|
566
566
|
"select",
|
|
567
567
|
{
|
|
568
568
|
className: "widget-filter__select",
|
|
569
|
-
value:
|
|
569
|
+
value: i,
|
|
570
570
|
onChange: (m) => {
|
|
571
|
-
const
|
|
572
|
-
|
|
571
|
+
const h = parseInt(m.target.value), v = Y(h, o)[0];
|
|
572
|
+
v && n(`${v.start}|${v.end}`);
|
|
573
573
|
},
|
|
574
|
-
children:
|
|
574
|
+
children: u.map((m) => /* @__PURE__ */ a("option", { value: m, children: m }, m))
|
|
575
575
|
}
|
|
576
576
|
),
|
|
577
577
|
/* @__PURE__ */ a(
|
|
578
578
|
"select",
|
|
579
579
|
{
|
|
580
580
|
className: "widget-filter__select",
|
|
581
|
-
value:
|
|
581
|
+
value: o,
|
|
582
582
|
onChange: (m) => {
|
|
583
|
-
const
|
|
584
|
-
|
|
583
|
+
const h = parseInt(m.target.value), v = Y(i, h)[0];
|
|
584
|
+
v && n(`${v.start}|${v.end}`);
|
|
585
585
|
},
|
|
586
|
-
children: we.map((m,
|
|
586
|
+
children: we.map((m, h) => /* @__PURE__ */ a("option", { value: h + 1, children: m }, h + 1))
|
|
587
587
|
}
|
|
588
588
|
),
|
|
589
589
|
/* @__PURE__ */ a(
|
|
590
590
|
"select",
|
|
591
591
|
{
|
|
592
592
|
className: "widget-filter__select",
|
|
593
|
-
value:
|
|
593
|
+
value: d,
|
|
594
594
|
onChange: (m) => {
|
|
595
|
-
const
|
|
596
|
-
|
|
595
|
+
const h = c[parseInt(m.target.value) - 1];
|
|
596
|
+
h && n(`${h.start}|${h.end}`);
|
|
597
597
|
},
|
|
598
598
|
children: c.map((m) => /* @__PURE__ */ a("option", { value: m.index, children: m.label }, m.index))
|
|
599
599
|
}
|
|
600
600
|
)
|
|
601
601
|
] });
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
const l = e.filterType || "select",
|
|
603
|
+
function zt({ config: e, value: t, options: n = [], dateBounds: r, onChange: s }) {
|
|
604
|
+
const l = e.filterType || "select", i = e.label || "Filtro", o = e.dateFilterMode || "range";
|
|
605
605
|
return /* @__PURE__ */ _("div", { className: "widget-filter", children: [
|
|
606
|
-
/* @__PURE__ */ a("label", { className: "widget-filter__label", children:
|
|
606
|
+
/* @__PURE__ */ a("label", { className: "widget-filter__label", children: i }),
|
|
607
607
|
l === "date_range" ? /* @__PURE__ */ a(
|
|
608
|
-
|
|
608
|
+
Pe,
|
|
609
609
|
{
|
|
610
|
-
mode:
|
|
610
|
+
mode: o,
|
|
611
611
|
value: t,
|
|
612
|
-
dateBounds:
|
|
612
|
+
dateBounds: r,
|
|
613
613
|
onChange: s
|
|
614
614
|
}
|
|
615
615
|
) : /* @__PURE__ */ a(
|
|
616
|
-
|
|
616
|
+
Dt,
|
|
617
617
|
{
|
|
618
618
|
value: t,
|
|
619
|
-
options:
|
|
619
|
+
options: n,
|
|
620
620
|
multi: l === "multi_select",
|
|
621
621
|
searchable: e.searchable || !1,
|
|
622
622
|
onChange: s
|
|
@@ -624,21 +624,21 @@ function Dt({ config: e, value: t, options: r = [], dateBounds: n, onChange: s }
|
|
|
624
624
|
)
|
|
625
625
|
] });
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
if (
|
|
627
|
+
function Dt({ value: e, options: t, multi: n, searchable: r, onChange: s }) {
|
|
628
|
+
if (r)
|
|
629
629
|
return /* @__PURE__ */ a(
|
|
630
|
-
|
|
630
|
+
ye,
|
|
631
631
|
{
|
|
632
632
|
value: e,
|
|
633
633
|
options: t,
|
|
634
|
-
multi:
|
|
634
|
+
multi: n,
|
|
635
635
|
onChange: s
|
|
636
636
|
}
|
|
637
637
|
);
|
|
638
|
-
if (
|
|
639
|
-
const l = e ? e.split(
|
|
640
|
-
const
|
|
641
|
-
s(
|
|
638
|
+
if (n) {
|
|
639
|
+
const l = e ? e.split(B) : [], i = (o) => {
|
|
640
|
+
const u = l.includes(o) ? l.filter((c) => c !== o) : [...l, o];
|
|
641
|
+
s(u.join(B));
|
|
642
642
|
};
|
|
643
643
|
return /* @__PURE__ */ _("div", { className: "widget-filter__multi", children: [
|
|
644
644
|
l.length > 0 && /* @__PURE__ */ a(
|
|
@@ -650,17 +650,17 @@ function Ht({ value: e, options: t, multi: r, searchable: n, onChange: s }) {
|
|
|
650
650
|
children: "Limpar filtro"
|
|
651
651
|
}
|
|
652
652
|
),
|
|
653
|
-
t.map((
|
|
653
|
+
t.map((o) => /* @__PURE__ */ _("label", { className: "widget-filter__multi-option", children: [
|
|
654
654
|
/* @__PURE__ */ a(
|
|
655
655
|
"input",
|
|
656
656
|
{
|
|
657
657
|
type: "checkbox",
|
|
658
|
-
checked: l.includes(
|
|
659
|
-
onChange: () => o
|
|
658
|
+
checked: l.includes(o),
|
|
659
|
+
onChange: () => i(o)
|
|
660
660
|
}
|
|
661
661
|
),
|
|
662
|
-
|
|
663
|
-
] },
|
|
662
|
+
o
|
|
663
|
+
] }, o))
|
|
664
664
|
] });
|
|
665
665
|
}
|
|
666
666
|
return /* @__PURE__ */ _(
|
|
@@ -676,14 +676,14 @@ function Ht({ value: e, options: t, multi: r, searchable: n, onChange: s }) {
|
|
|
676
676
|
}
|
|
677
677
|
);
|
|
678
678
|
}
|
|
679
|
-
const
|
|
679
|
+
const Ht = {
|
|
680
680
|
currency: "R$",
|
|
681
681
|
percentage: "%"
|
|
682
682
|
};
|
|
683
|
-
function
|
|
684
|
-
const
|
|
683
|
+
function Vt({ config: e, value: t, onChange: n }) {
|
|
684
|
+
const r = e.label || "Variavel", s = e.locked || !1, l = e.variableFormat || "number", i = Ht[l] || "";
|
|
685
685
|
return /* @__PURE__ */ _("div", { className: `widget-variable ${s ? "widget-variable--locked" : ""}`, children: [
|
|
686
|
-
/* @__PURE__ */ a("label", { className: "widget-variable__label", children:
|
|
686
|
+
/* @__PURE__ */ a("label", { className: "widget-variable__label", children: r }),
|
|
687
687
|
/* @__PURE__ */ _("div", { className: "widget-variable__input-wrapper", children: [
|
|
688
688
|
/* @__PURE__ */ a(
|
|
689
689
|
"input",
|
|
@@ -691,413 +691,418 @@ function jt({ config: e, value: t, onChange: r }) {
|
|
|
691
691
|
className: "widget-variable__input",
|
|
692
692
|
type: "number",
|
|
693
693
|
value: t,
|
|
694
|
-
onChange: (
|
|
694
|
+
onChange: (o) => n(parseFloat(o.target.value) || 0),
|
|
695
695
|
disabled: s,
|
|
696
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
|
|
704
|
+
function jt({ config: e, palette: t, onChange: n }) {
|
|
705
|
+
const r = e.label || "Cores", s = e.locked || !1;
|
|
706
706
|
return /* @__PURE__ */ _("div", { className: `widget-palette ${s ? "widget-palette--locked" : ""}`, children: [
|
|
707
|
-
/* @__PURE__ */ a("label", { className: "widget-palette__label", children:
|
|
708
|
-
/* @__PURE__ */ a(
|
|
707
|
+
/* @__PURE__ */ a("label", { className: "widget-palette__label", children: r }),
|
|
708
|
+
/* @__PURE__ */ a(Ge, { selected: t, onSelect: n, customMode: !0, disabled: s }),
|
|
709
709
|
s && /* @__PURE__ */ a("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
710
710
|
] });
|
|
711
711
|
}
|
|
712
|
-
const
|
|
712
|
+
const Gt = {
|
|
713
713
|
failed_to_compute: "Não foi possível calcular este widget"
|
|
714
714
|
};
|
|
715
|
-
function
|
|
715
|
+
function Kt({
|
|
716
716
|
type: e,
|
|
717
717
|
computed: t,
|
|
718
|
-
palette:
|
|
719
|
-
config:
|
|
718
|
+
palette: n,
|
|
719
|
+
config: r,
|
|
720
720
|
filterValue: s,
|
|
721
721
|
filterOptions: l,
|
|
722
|
-
dateBounds:
|
|
723
|
-
onFilterChange:
|
|
724
|
-
variableValue:
|
|
722
|
+
dateBounds: i,
|
|
723
|
+
onFilterChange: o,
|
|
724
|
+
variableValue: u,
|
|
725
725
|
onVariableChange: c,
|
|
726
|
-
onPaletteChange:
|
|
726
|
+
onPaletteChange: d
|
|
727
727
|
}) {
|
|
728
728
|
if (t.error)
|
|
729
729
|
return /* @__PURE__ */ a(
|
|
730
730
|
W,
|
|
731
731
|
{
|
|
732
732
|
name: e.replace("_", "-"),
|
|
733
|
-
title:
|
|
733
|
+
title: r == null ? void 0 : r.label,
|
|
734
734
|
state: "error",
|
|
735
|
-
stateMessage:
|
|
735
|
+
stateMessage: Gt[String(t.error)]
|
|
736
736
|
}
|
|
737
737
|
);
|
|
738
|
-
const m =
|
|
738
|
+
const m = Ke(n);
|
|
739
739
|
switch (e) {
|
|
740
740
|
case "kpi_card":
|
|
741
|
-
return /* @__PURE__ */ a(
|
|
741
|
+
return /* @__PURE__ */ a(bt, { data: t, label: r == null ? void 0 : r.label });
|
|
742
742
|
case "gauge":
|
|
743
|
-
return /* @__PURE__ */ a(
|
|
743
|
+
return /* @__PURE__ */ a(yt, { data: t, palette: m, label: r == null ? void 0 : r.label });
|
|
744
744
|
case "chart":
|
|
745
|
-
return /* @__PURE__ */ a(
|
|
745
|
+
return /* @__PURE__ */ a(Rt, { data: t, palette: m, label: r == null ? void 0 : r.label });
|
|
746
746
|
case "composition":
|
|
747
|
-
return /* @__PURE__ */ a(
|
|
747
|
+
return /* @__PURE__ */ a(Pt, { data: t, palette: m, label: r == null ? void 0 : r.label });
|
|
748
748
|
case "table":
|
|
749
|
-
return /* @__PURE__ */ a(
|
|
749
|
+
return /* @__PURE__ */ a(Mt, { data: t, label: r == null ? void 0 : r.label });
|
|
750
750
|
case "filter":
|
|
751
|
-
return
|
|
752
|
-
|
|
751
|
+
return r && o ? /* @__PURE__ */ a(
|
|
752
|
+
zt,
|
|
753
753
|
{
|
|
754
|
-
config:
|
|
754
|
+
config: r,
|
|
755
755
|
value: s || "",
|
|
756
756
|
options: l,
|
|
757
|
-
dateBounds:
|
|
758
|
-
onChange:
|
|
757
|
+
dateBounds: i,
|
|
758
|
+
onChange: o
|
|
759
759
|
}
|
|
760
760
|
) : null;
|
|
761
761
|
case "variable": {
|
|
762
|
-
const
|
|
763
|
-
return
|
|
764
|
-
|
|
762
|
+
const h = r;
|
|
763
|
+
return h && c ? /* @__PURE__ */ a(
|
|
764
|
+
Vt,
|
|
765
765
|
{
|
|
766
|
-
config:
|
|
767
|
-
value:
|
|
766
|
+
config: h,
|
|
767
|
+
value: u ?? h.variableValue ?? 0,
|
|
768
768
|
onChange: c
|
|
769
769
|
}
|
|
770
770
|
) : null;
|
|
771
771
|
}
|
|
772
772
|
case "color_palette":
|
|
773
|
-
return
|
|
774
|
-
|
|
773
|
+
return r && d ? /* @__PURE__ */ a(
|
|
774
|
+
jt,
|
|
775
775
|
{
|
|
776
|
-
config:
|
|
777
|
-
palette:
|
|
778
|
-
onChange:
|
|
776
|
+
config: r,
|
|
777
|
+
palette: n,
|
|
778
|
+
onChange: d
|
|
779
779
|
}
|
|
780
780
|
) : null;
|
|
781
781
|
default:
|
|
782
782
|
return /* @__PURE__ */ a(W, { name: "unknown", state: "unconfigured" });
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
|
-
const
|
|
786
|
-
function
|
|
785
|
+
const Yt = Fe(Kt), Ut = (e, t) => e.grid.y - t.grid.y || e.grid.x - t.grid.x, Bt = {}, fe = [];
|
|
786
|
+
function Wr({
|
|
787
787
|
token: e,
|
|
788
|
-
cellAspect: t =
|
|
789
|
-
stackBelow:
|
|
790
|
-
onGeometryChange:
|
|
788
|
+
cellAspect: t = qe,
|
|
789
|
+
stackBelow: n,
|
|
790
|
+
onGeometryChange: r,
|
|
791
791
|
silenceWarnings: s,
|
|
792
792
|
className: l
|
|
793
793
|
}) {
|
|
794
794
|
const {
|
|
795
|
-
layout:
|
|
796
|
-
renderData:
|
|
797
|
-
loading:
|
|
795
|
+
layout: i,
|
|
796
|
+
renderData: o,
|
|
797
|
+
loading: u,
|
|
798
798
|
error: c,
|
|
799
|
-
filters:
|
|
799
|
+
filters: d,
|
|
800
800
|
variables: m,
|
|
801
|
-
palette:
|
|
802
|
-
setFilter:
|
|
803
|
-
setVariable:
|
|
804
|
-
setPalette:
|
|
805
|
-
} =
|
|
806
|
-
columns: (
|
|
801
|
+
palette: h,
|
|
802
|
+
setFilter: p,
|
|
803
|
+
setVariable: v,
|
|
804
|
+
setPalette: f
|
|
805
|
+
} = ct(e), { rootRef: N, gridRef: w, stacked: y } = ft({
|
|
806
|
+
columns: (i == null ? void 0 : i.gridColumns) ?? 0,
|
|
807
807
|
cellAspect: t,
|
|
808
|
-
stackBelow:
|
|
809
|
-
onGeometryChange:
|
|
808
|
+
stackBelow: n,
|
|
809
|
+
onGeometryChange: r,
|
|
810
810
|
silenceWarnings: s
|
|
811
|
-
}),
|
|
812
|
-
const
|
|
813
|
-
return
|
|
814
|
-
}, [
|
|
815
|
-
const
|
|
816
|
-
for (const
|
|
817
|
-
|
|
818
|
-
onFilter: (
|
|
819
|
-
onVariable: (
|
|
811
|
+
}), T = F(() => {
|
|
812
|
+
const b = (i == null ? void 0 : i.widgets) ?? [];
|
|
813
|
+
return y ? [...b].sort(Ut) : b;
|
|
814
|
+
}, [i == null ? void 0 : i.widgets, y]), A = F(() => {
|
|
815
|
+
const b = {};
|
|
816
|
+
for (const S of T)
|
|
817
|
+
b[S.id] = {
|
|
818
|
+
onFilter: (x) => p(S.id, x),
|
|
819
|
+
onVariable: (x) => v(S.id, x)
|
|
820
820
|
};
|
|
821
|
-
return
|
|
822
|
-
}, [
|
|
823
|
-
"--dash-gap": `${
|
|
821
|
+
return b;
|
|
822
|
+
}, [T, p, v]), M = {
|
|
823
|
+
"--dash-gap": `${oe}px`,
|
|
824
824
|
"--dash-pad": `${Xe}px`
|
|
825
|
-
},
|
|
826
|
-
let
|
|
827
|
-
if (c && !
|
|
828
|
-
|
|
829
|
-
else if (!
|
|
830
|
-
|
|
831
|
-
else if (
|
|
832
|
-
|
|
825
|
+
}, $ = ["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
|
-
c && !
|
|
841
|
-
|
|
842
|
-
var
|
|
843
|
-
const z =
|
|
834
|
+
const b = (o == null ? void 0 : o.widgets) ?? {}, S = (o == null ? void 0 : o.date_bounds) ?? null, x = {
|
|
835
|
+
"--dash-cols": i.gridColumns,
|
|
836
|
+
"--dash-rows": i.gridRows,
|
|
837
|
+
...Ne(h)
|
|
838
|
+
}, C = ["preview-tab__grid", y && "preview-tab__grid--stacked"].filter(Boolean).join(" ");
|
|
839
|
+
g = /* @__PURE__ */ _(V, { children: [
|
|
840
|
+
c && !o && /* @__PURE__ */ a("div", { className: "preview-tab__error", children: c }),
|
|
841
|
+
o && /* @__PURE__ */ a("div", { className: C, style: x, ref: w, children: T.map((k) => {
|
|
842
|
+
var re, ne;
|
|
843
|
+
const z = Ye.has(k.type), L = b[k.id], I = y ? {
|
|
844
844
|
gridColumn: 1,
|
|
845
|
-
aspectRatio: `${
|
|
846
|
-
minHeight: `${
|
|
845
|
+
aspectRatio: `${Be(k.grid.w, k.grid.h, t)}`,
|
|
846
|
+
minHeight: `${Ue(k.grid.h, Qe, oe, 0)}px`
|
|
847
847
|
} : {
|
|
848
|
-
gridColumn: `${
|
|
849
|
-
gridRow: `${
|
|
850
|
-
}, Le =
|
|
848
|
+
gridColumn: `${k.grid.x + 1} / span ${k.grid.w}`,
|
|
849
|
+
gridRow: `${k.grid.y + 1} / span ${k.grid.h}`
|
|
850
|
+
}, Le = k.type === "variable" ? m[k.id] ?? (L == null ? void 0 : L.value) ?? k.config.variableValue ?? 0 : void 0;
|
|
851
851
|
return /* @__PURE__ */ a(
|
|
852
852
|
"div",
|
|
853
853
|
{
|
|
854
854
|
className: `preview-tab__widget ${z ? "preview-tab__widget--control" : ""}`,
|
|
855
|
-
style:
|
|
855
|
+
style: I,
|
|
856
856
|
children: z || L ? /* @__PURE__ */ a(
|
|
857
|
-
|
|
857
|
+
Yt,
|
|
858
858
|
{
|
|
859
|
-
type:
|
|
860
|
-
computed: L ||
|
|
861
|
-
palette:
|
|
862
|
-
config:
|
|
863
|
-
filterValue:
|
|
859
|
+
type: k.type,
|
|
860
|
+
computed: L || Bt,
|
|
861
|
+
palette: h,
|
|
862
|
+
config: k.config,
|
|
863
|
+
filterValue: d[k.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
|
+
k.type === "filter" ? k.config.availableValues ?? fe : fe
|
|
868
868
|
),
|
|
869
|
-
dateBounds:
|
|
870
|
-
onFilterChange: (
|
|
869
|
+
dateBounds: S,
|
|
870
|
+
onFilterChange: (re = A[k.id]) == null ? void 0 : re.onFilter,
|
|
871
871
|
variableValue: Le,
|
|
872
|
-
onVariableChange: (
|
|
873
|
-
onPaletteChange:
|
|
872
|
+
onVariableChange: (ne = A[k.id]) == null ? void 0 : ne.onVariable,
|
|
873
|
+
onPaletteChange: f
|
|
874
874
|
}
|
|
875
|
-
) : /* @__PURE__ */ a("div", { className: "preview-tab__widget-loading", children:
|
|
875
|
+
) : /* @__PURE__ */ a("div", { className: "preview-tab__widget-loading", children: u ? "Carregando..." : "Sem dados" })
|
|
876
876
|
},
|
|
877
|
-
|
|
877
|
+
k.id
|
|
878
878
|
);
|
|
879
879
|
}) }),
|
|
880
|
-
|
|
880
|
+
u && o && /* @__PURE__ */ a("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
|
|
881
881
|
] });
|
|
882
882
|
}
|
|
883
|
-
return /* @__PURE__ */ a("div", { className:
|
|
883
|
+
return /* @__PURE__ */ a("div", { className: $, style: M, ref: N, children: g });
|
|
884
884
|
}
|
|
885
885
|
function Xt(e, t) {
|
|
886
|
-
const
|
|
887
|
-
|
|
886
|
+
const n = URL.createObjectURL(e), r = document.createElement("a");
|
|
887
|
+
r.href = n, r.download = t, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
888
888
|
}
|
|
889
|
-
const
|
|
890
|
-
function
|
|
889
|
+
const qt = 768, Qt = 879;
|
|
890
|
+
function Zt(e) {
|
|
891
891
|
return Array.from(e.normalize("NFD")).filter((t) => {
|
|
892
|
-
const
|
|
893
|
-
return
|
|
892
|
+
const n = t.codePointAt(0) ?? 0;
|
|
893
|
+
return n < qt || n > Qt;
|
|
894
894
|
}).join("");
|
|
895
895
|
}
|
|
896
|
-
function
|
|
897
|
-
return `${
|
|
898
|
-
}
|
|
899
|
-
const
|
|
900
|
-
function
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
896
|
+
function Jt(e, t) {
|
|
897
|
+
return `${Zt(e).replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase() || "documento"}.${t}`;
|
|
898
|
+
}
|
|
899
|
+
const er = 300;
|
|
900
|
+
function tr(e) {
|
|
901
|
+
return !!e && typeof e == "object" && "start" in e;
|
|
902
|
+
}
|
|
903
|
+
function rr(e, t, n) {
|
|
904
|
+
const r = xe(t), s = { ...e };
|
|
905
|
+
for (const [l, i] of Object.entries(r)) {
|
|
906
|
+
const o = e[l];
|
|
907
|
+
(n ? o == null : o === "" && tr(t[l])) && (s[l] = i);
|
|
908
|
+
}
|
|
909
|
+
return s;
|
|
910
|
+
}
|
|
911
|
+
function nr(e) {
|
|
912
|
+
const [t, n] = E(null), [r, s] = E(null), [l, i] = E({}), [o, u] = E({}), [c, d] = E(!0), [m, h] = E(null), [p, v] = E(!1), f = R(), N = R(!1), w = R(null), y = R(!1);
|
|
913
|
+
O(() => {
|
|
914
|
+
let $ = !1;
|
|
915
|
+
return N.current = !1, w.current = null, y.current = !1, Ze(e).then((g) => {
|
|
916
|
+
$ || n(g);
|
|
917
|
+
}).catch((g) => {
|
|
918
|
+
$ || h(g.message);
|
|
908
919
|
}), () => {
|
|
909
|
-
|
|
920
|
+
$ = !0;
|
|
910
921
|
};
|
|
911
|
-
}, [e]),
|
|
922
|
+
}, [e]), O(() => {
|
|
912
923
|
if (!t) return;
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
924
|
+
const $ = H(l), g = j($);
|
|
925
|
+
if (g === w.current) return;
|
|
915
926
|
f.current && clearTimeout(f.current);
|
|
916
|
-
const
|
|
927
|
+
const b = y.current ? er : 0;
|
|
917
928
|
return f.current = setTimeout(() => {
|
|
918
|
-
d(!0),
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
929
|
+
d(!0), Je(e, $).then((S) => {
|
|
930
|
+
if (w.current = g, y.current = !0, s(S), S.applied) {
|
|
931
|
+
const x = !N.current;
|
|
932
|
+
N.current = !0, i((C) => {
|
|
933
|
+
const k = rr(C, S.applied, x);
|
|
934
|
+
return $e(k, C) ? C : (w.current = j(H(k)), k);
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
h(null);
|
|
938
|
+
}).catch((S) => h(S.message)).finally(() => d(!1));
|
|
939
|
+
}, b), () => {
|
|
925
940
|
f.current && clearTimeout(f.current);
|
|
926
941
|
};
|
|
927
942
|
}, [e, t, l]);
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
943
|
+
const T = P(($, g) => {
|
|
944
|
+
i((S) => ({ ...S, [$]: g }));
|
|
945
|
+
const b = g !== "";
|
|
946
|
+
u((S) => S[$] === b ? S : { ...S, [$]: b });
|
|
947
|
+
}, []), A = P(($) => {
|
|
948
|
+
T($, "");
|
|
949
|
+
}, [T]), M = P(() => {
|
|
950
|
+
v(!0), et(e, H(l)).then(($) => {
|
|
951
|
+
Xt($, Jt((t == null ? void 0 : t.name) ?? "demonstrativo", "pdf")), h(null);
|
|
952
|
+
}).catch(($) => h($.message)).finally(() => v(!1));
|
|
934
953
|
}, [e, l, t == null ? void 0 : t.name]);
|
|
935
954
|
return {
|
|
936
955
|
layout: t,
|
|
937
|
-
renderData:
|
|
938
|
-
loading:
|
|
939
|
-
error:
|
|
956
|
+
renderData: r,
|
|
957
|
+
loading: c,
|
|
958
|
+
error: m,
|
|
940
959
|
filters: l,
|
|
941
|
-
setFilter:
|
|
942
|
-
|
|
943
|
-
|
|
960
|
+
setFilter: T,
|
|
961
|
+
touched: o,
|
|
962
|
+
clearFilter: A,
|
|
963
|
+
downloadPdf: M,
|
|
964
|
+
downloading: p
|
|
944
965
|
};
|
|
945
966
|
}
|
|
946
|
-
const
|
|
947
|
-
function
|
|
948
|
-
let
|
|
949
|
-
for (const [l,
|
|
950
|
-
if (
|
|
951
|
-
if (
|
|
952
|
-
|
|
967
|
+
const ar = [0, 0.25, 0.5, 0.75, 1], sr = 150, lr = 1;
|
|
968
|
+
function ir(e, t, n) {
|
|
969
|
+
let r = null, s = 0;
|
|
970
|
+
for (const [l, i] of e) {
|
|
971
|
+
if (i <= 0) continue;
|
|
972
|
+
if (r === null || i > s) {
|
|
973
|
+
r = l, s = i;
|
|
953
974
|
continue;
|
|
954
975
|
}
|
|
955
|
-
if (
|
|
956
|
-
const
|
|
957
|
-
(
|
|
976
|
+
if (i < s) continue;
|
|
977
|
+
const o = l === n, u = r !== n && (t.get(l) ?? 1 / 0) < (t.get(r) ?? 1 / 0);
|
|
978
|
+
(o || u) && (r = l);
|
|
958
979
|
}
|
|
959
|
-
return
|
|
980
|
+
return r;
|
|
960
981
|
}
|
|
961
|
-
function
|
|
962
|
-
const [r,
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
982
|
+
function or(e, t) {
|
|
983
|
+
const [n, r] = E(null), [s, l] = E(null), i = R(null), o = R({ timer: null, left: null }), u = P(() => {
|
|
984
|
+
const d = o.current;
|
|
985
|
+
d.timer !== null && clearTimeout(d.timer), d.left = null, d.timer = setTimeout(() => {
|
|
986
|
+
var m;
|
|
987
|
+
d.timer = null, d.left = ((m = e.current) == null ? void 0 : m.scrollLeft) ?? null;
|
|
988
|
+
}, sr);
|
|
989
|
+
}, [e]), c = P((d) => {
|
|
990
|
+
i.current = d, l(d), u();
|
|
991
|
+
}, [u]);
|
|
992
|
+
return O(() => {
|
|
993
|
+
i.current !== null && !t.includes(i.current) && (i.current = null, l(null));
|
|
994
|
+
const d = e.current;
|
|
995
|
+
if (!d || t.length === 0) {
|
|
996
|
+
r(null);
|
|
972
997
|
return;
|
|
973
998
|
}
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
999
|
+
const m = () => {
|
|
1000
|
+
i.current = null, l(null);
|
|
1001
|
+
}, h = () => {
|
|
1002
|
+
if (i.current === null) return;
|
|
1003
|
+
const f = o.current;
|
|
1004
|
+
if (f.timer !== null) {
|
|
1005
|
+
u();
|
|
1006
|
+
return;
|
|
978
1007
|
}
|
|
979
|
-
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1008
|
+
f.left !== null && Math.abs(d.scrollLeft - f.left) > lr && m();
|
|
1009
|
+
};
|
|
1010
|
+
d.addEventListener("scroll", h, { passive: !0 });
|
|
1011
|
+
let p = null;
|
|
1012
|
+
const v = typeof IntersectionObserver > "u" ? [] : Array.from(d.querySelectorAll("th[data-period]"));
|
|
1013
|
+
if (v.length === 0)
|
|
1014
|
+
r(null);
|
|
1015
|
+
else {
|
|
1016
|
+
const f = /* @__PURE__ */ new Map(), N = new Map(t.map((w, y) => [w, y]));
|
|
1017
|
+
p = new IntersectionObserver((w) => {
|
|
1018
|
+
for (const y of w) {
|
|
1019
|
+
const T = y.target.dataset.period;
|
|
1020
|
+
T != null && f.set(T, y.isIntersecting ? y.intersectionRatio : 0);
|
|
1021
|
+
}
|
|
1022
|
+
r((y) => ir(f, N, i.current ?? y));
|
|
1023
|
+
}, { root: d, threshold: ar }), v.forEach((w) => p.observe(w));
|
|
1024
|
+
}
|
|
1025
|
+
return () => {
|
|
1026
|
+
d.removeEventListener("scroll", h), p == null || p.disconnect();
|
|
1027
|
+
};
|
|
1028
|
+
}, [e, t, u]), O(() => () => {
|
|
1029
|
+
const d = o.current;
|
|
1030
|
+
d.timer !== null && clearTimeout(d.timer);
|
|
1031
|
+
}, []), { current: s ?? n, pin: c };
|
|
1000
1032
|
}
|
|
1001
|
-
function
|
|
1033
|
+
function cr(e) {
|
|
1034
|
+
var n;
|
|
1002
1035
|
const t = /* @__PURE__ */ new Map();
|
|
1003
|
-
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
});
|
|
1007
|
-
const r = [];
|
|
1008
|
-
for (const [n, s] of t) {
|
|
1009
|
-
let l = !0;
|
|
1010
|
-
for (const o of t.keys())
|
|
1011
|
-
if (o >= s.from && o < s.to) {
|
|
1012
|
-
l = !1;
|
|
1013
|
-
break;
|
|
1014
|
-
}
|
|
1015
|
-
l && r.push(e[n].id);
|
|
1036
|
+
for (const r of e) {
|
|
1037
|
+
const s = ((n = r.collapse) == null ? void 0 : n.hides) ?? [];
|
|
1038
|
+
s.length > 0 && t.set(r.id, new Set(s));
|
|
1016
1039
|
}
|
|
1017
|
-
return
|
|
1040
|
+
return t;
|
|
1018
1041
|
}
|
|
1019
|
-
function
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
e[s].type === "data" && (n += 1);
|
|
1025
|
-
return n;
|
|
1042
|
+
function dr(e) {
|
|
1043
|
+
const t = /* @__PURE__ */ new Set();
|
|
1044
|
+
for (const [n, r] of e)
|
|
1045
|
+
[...r].some((s) => e.has(s)) || t.add(n);
|
|
1046
|
+
return t;
|
|
1026
1047
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const
|
|
1029
|
-
for (const
|
|
1030
|
-
const s
|
|
1031
|
-
|
|
1032
|
-
const l = Y(e, s);
|
|
1033
|
-
if (l)
|
|
1034
|
-
for (let o = l.from; o < l.to; o += 1)
|
|
1035
|
-
r.add(e[o].id);
|
|
1036
|
-
}
|
|
1037
|
-
return r;
|
|
1048
|
+
function ur(e, t) {
|
|
1049
|
+
const n = /* @__PURE__ */ new Set();
|
|
1050
|
+
for (const r of t)
|
|
1051
|
+
for (const s of e.get(r) ?? []) n.add(s);
|
|
1052
|
+
return n;
|
|
1038
1053
|
}
|
|
1039
|
-
function
|
|
1040
|
-
const t =
|
|
1041
|
-
(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
() => new Set(ir(t)),
|
|
1045
|
-
[t]
|
|
1046
|
-
), l = I(
|
|
1047
|
-
() => new Map(t.map((f, h) => [f.id, cr(t, h)])),
|
|
1048
|
-
[t]
|
|
1049
|
-
), [o, i] = T(null), d = o ?? s, c = I(() => dr(t, d), [t, d]), u = x((f) => {
|
|
1050
|
-
i((h) => {
|
|
1051
|
-
const v = new Set(h ?? s);
|
|
1052
|
-
return v.has(f) ? v.delete(f) : v.add(f), v;
|
|
1054
|
+
function mr(e) {
|
|
1055
|
+
const t = F(() => cr(e), [e]), n = F(() => new Set(t.keys()), [t]), r = F(() => dr(t), [t]), [s, l] = E(null), i = s ?? r, o = F(() => ur(t, i), [t, i]), u = P((m) => {
|
|
1056
|
+
l((h) => {
|
|
1057
|
+
const p = new Set(h ?? r);
|
|
1058
|
+
return p.has(m) ? p.delete(m) : p.add(m), p;
|
|
1053
1059
|
});
|
|
1054
|
-
}, [
|
|
1055
|
-
return
|
|
1060
|
+
}, [r]), c = P(() => l(r), [r]), d = P(() => l(/* @__PURE__ */ new Set()), []);
|
|
1061
|
+
return F(() => ({
|
|
1056
1062
|
collapsible: n,
|
|
1057
|
-
collapsed:
|
|
1058
|
-
hidden:
|
|
1059
|
-
|
|
1060
|
-
hasSections: r.length > 0,
|
|
1063
|
+
collapsed: i,
|
|
1064
|
+
hidden: o,
|
|
1065
|
+
hasSections: n.size > 0,
|
|
1061
1066
|
toggle: u,
|
|
1062
|
-
collapseToSummary:
|
|
1063
|
-
expandAll:
|
|
1064
|
-
}), [n,
|
|
1067
|
+
collapseToSummary: c,
|
|
1068
|
+
expandAll: d
|
|
1069
|
+
}), [n, i, o, u, c, d]);
|
|
1065
1070
|
}
|
|
1066
|
-
const
|
|
1067
|
-
var t,
|
|
1068
|
-
return ((
|
|
1071
|
+
const hr = 600, fr = (e) => {
|
|
1072
|
+
var t, n;
|
|
1073
|
+
return ((n = (t = e.contentBoxSize) == null ? void 0 : t[0]) == null ? void 0 : n.inlineSize) ?? e.contentRect.width;
|
|
1069
1074
|
};
|
|
1070
|
-
function
|
|
1071
|
-
const [
|
|
1072
|
-
|
|
1073
|
-
}, [t]),
|
|
1074
|
-
s.current =
|
|
1075
|
+
function pr(e, t = hr) {
|
|
1076
|
+
const [n, r] = E(!1), s = R(null), l = P((o) => {
|
|
1077
|
+
r(o > 0 && o < t);
|
|
1078
|
+
}, [t]), i = P((o) => {
|
|
1079
|
+
s.current = o, o && e && l(o.getBoundingClientRect().width);
|
|
1075
1080
|
}, [e, l]);
|
|
1076
|
-
return
|
|
1077
|
-
const
|
|
1078
|
-
if (!e || !
|
|
1079
|
-
const
|
|
1080
|
-
for (const
|
|
1081
|
-
|
|
1081
|
+
return O(() => {
|
|
1082
|
+
const o = s.current;
|
|
1083
|
+
if (!e || !o || typeof ResizeObserver > "u") return;
|
|
1084
|
+
const u = new ResizeObserver((c) => {
|
|
1085
|
+
for (const d of c)
|
|
1086
|
+
d.target === o && l(fr(d));
|
|
1082
1087
|
});
|
|
1083
|
-
return
|
|
1084
|
-
}, [e, l]), { ref:
|
|
1088
|
+
return u.observe(o), () => u.disconnect();
|
|
1089
|
+
}, [e, l]), { ref: i, narrow: e && n };
|
|
1085
1090
|
}
|
|
1086
|
-
const
|
|
1087
|
-
function
|
|
1088
|
-
return { paddingLeft: `${
|
|
1091
|
+
const _r = 8, gr = 14, pe = 10;
|
|
1092
|
+
function br(e, t = gr) {
|
|
1093
|
+
return { paddingLeft: `${_r + e * t}px` };
|
|
1089
1094
|
}
|
|
1090
|
-
function
|
|
1095
|
+
function vr(e) {
|
|
1091
1096
|
const t = {};
|
|
1092
1097
|
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;
|
|
1093
1098
|
}
|
|
1094
|
-
function
|
|
1099
|
+
function Q(e) {
|
|
1095
1100
|
return e == null || e === 0 ? "stmt__number" : `stmt__number stmt__number--${e > 0 ? "pos" : "neg"}`;
|
|
1096
1101
|
}
|
|
1097
|
-
function
|
|
1102
|
+
function _e(e) {
|
|
1098
1103
|
return e == null || e === 0 ? "stmt__aux" : `stmt__aux stmt__aux--${e > 0 ? "up" : "down"}`;
|
|
1099
1104
|
}
|
|
1100
|
-
const
|
|
1105
|
+
const wr = {
|
|
1101
1106
|
day: "day",
|
|
1102
1107
|
week: "week",
|
|
1103
1108
|
month: "month",
|
|
@@ -1105,19 +1110,40 @@ const vr = {
|
|
|
1105
1110
|
year: "year",
|
|
1106
1111
|
total: "month"
|
|
1107
1112
|
};
|
|
1108
|
-
function yr({
|
|
1113
|
+
function yr({
|
|
1114
|
+
definition: e,
|
|
1115
|
+
value: t,
|
|
1116
|
+
options: n,
|
|
1117
|
+
bounds: r,
|
|
1118
|
+
rangeUnit: s,
|
|
1119
|
+
touched: l,
|
|
1120
|
+
onChange: i,
|
|
1121
|
+
onClear: o
|
|
1122
|
+
}) {
|
|
1109
1123
|
if (e.type === "date_range") {
|
|
1110
|
-
const
|
|
1111
|
-
return /* @__PURE__ */ _("div", { className: `stmt__filter stmt__filter--date stmt__filter--${
|
|
1112
|
-
/* @__PURE__ */
|
|
1124
|
+
const u = e.dateFilterMode ?? "range";
|
|
1125
|
+
return /* @__PURE__ */ _("div", { className: `stmt__filter stmt__filter--date stmt__filter--${u}`, children: [
|
|
1126
|
+
/* @__PURE__ */ _("span", { className: "stmt__filter-label", children: [
|
|
1127
|
+
e.label,
|
|
1128
|
+
l && /* @__PURE__ */ a(
|
|
1129
|
+
"button",
|
|
1130
|
+
{
|
|
1131
|
+
type: "button",
|
|
1132
|
+
className: "stmt__filter-clear",
|
|
1133
|
+
title: "Voltar ao período padrão",
|
|
1134
|
+
onClick: o,
|
|
1135
|
+
children: "Limpar"
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] }),
|
|
1113
1139
|
/* @__PURE__ */ a(
|
|
1114
|
-
|
|
1140
|
+
Pe,
|
|
1115
1141
|
{
|
|
1116
|
-
mode:
|
|
1142
|
+
mode: u,
|
|
1117
1143
|
value: t,
|
|
1118
|
-
dateBounds:
|
|
1144
|
+
dateBounds: r,
|
|
1119
1145
|
rangeUnit: s,
|
|
1120
|
-
onChange:
|
|
1146
|
+
onChange: i
|
|
1121
1147
|
}
|
|
1122
1148
|
)
|
|
1123
1149
|
] });
|
|
@@ -1125,17 +1151,17 @@ function yr({ definition: e, value: t, options: r, bounds: n, rangeUnit: s, onCh
|
|
|
1125
1151
|
return /* @__PURE__ */ _("div", { className: "stmt__filter", children: [
|
|
1126
1152
|
/* @__PURE__ */ a("span", { className: "stmt__filter-label", children: e.label }),
|
|
1127
1153
|
/* @__PURE__ */ a(
|
|
1128
|
-
|
|
1154
|
+
ye,
|
|
1129
1155
|
{
|
|
1130
1156
|
value: t,
|
|
1131
|
-
options:
|
|
1157
|
+
options: n,
|
|
1132
1158
|
multi: e.type === "multi_select",
|
|
1133
|
-
onChange:
|
|
1159
|
+
onChange: i
|
|
1134
1160
|
}
|
|
1135
1161
|
)
|
|
1136
1162
|
] });
|
|
1137
1163
|
}
|
|
1138
|
-
const
|
|
1164
|
+
const Nr = 13, Sr = [], kr = [], ge = {
|
|
1139
1165
|
day: ["dia", "dias"],
|
|
1140
1166
|
week: ["semana", "semanas"],
|
|
1141
1167
|
month: ["mês", "meses"],
|
|
@@ -1143,14 +1169,14 @@ const wr = 13, Nr = [], Sr = [], be = {
|
|
|
1143
1169
|
year: ["ano", "anos"],
|
|
1144
1170
|
total: ["período", "períodos"]
|
|
1145
1171
|
};
|
|
1146
|
-
function
|
|
1147
|
-
const [
|
|
1148
|
-
return `Variação sobre ${e} ${e === 1 ?
|
|
1172
|
+
function Cr(e, t) {
|
|
1173
|
+
const [n, r] = ge[t] ?? ge.total;
|
|
1174
|
+
return `Variação sobre ${e} ${e === 1 ? n : r} atrás`;
|
|
1149
1175
|
}
|
|
1150
|
-
function
|
|
1176
|
+
function Rr({
|
|
1151
1177
|
label: e,
|
|
1152
1178
|
collapsed: t,
|
|
1153
|
-
onToggle:
|
|
1179
|
+
onToggle: n
|
|
1154
1180
|
}) {
|
|
1155
1181
|
return /* @__PURE__ */ a(
|
|
1156
1182
|
"button",
|
|
@@ -1159,46 +1185,40 @@ function Cr({
|
|
|
1159
1185
|
className: "stmt__toggle",
|
|
1160
1186
|
"aria-expanded": !t,
|
|
1161
1187
|
"aria-label": t ? `Expandir ${e}` : `Recolher ${e}`,
|
|
1162
|
-
onClick: (
|
|
1163
|
-
|
|
1188
|
+
onClick: (r) => {
|
|
1189
|
+
r.stopPropagation(), n();
|
|
1164
1190
|
},
|
|
1165
1191
|
children: /* @__PURE__ */ a("span", { className: "stmt__caret", "aria-hidden": "true" })
|
|
1166
1192
|
}
|
|
1167
1193
|
);
|
|
1168
1194
|
}
|
|
1169
|
-
function
|
|
1195
|
+
function Ae(e, t) {
|
|
1170
1196
|
return {
|
|
1171
1197
|
collapsible: t.collapsible.has(e.id),
|
|
1172
1198
|
collapsed: t.collapsed.has(e.id),
|
|
1173
|
-
hiddenCount: t.accountCounts.get(e.id) ?? 0,
|
|
1174
1199
|
onToggle: () => t.toggle(e.id)
|
|
1175
1200
|
};
|
|
1176
1201
|
}
|
|
1177
|
-
function G({ line: e, section: t, indentStep:
|
|
1178
|
-
const { collapsible:
|
|
1202
|
+
function G({ line: e, section: t, indentStep: n }) {
|
|
1203
|
+
const { collapsible: r, collapsed: s, onToggle: l } = t;
|
|
1179
1204
|
return /* @__PURE__ */ _(
|
|
1180
1205
|
"th",
|
|
1181
1206
|
{
|
|
1182
1207
|
scope: "row",
|
|
1183
|
-
style:
|
|
1184
|
-
onClick:
|
|
1208
|
+
style: br(e.style.indent, n),
|
|
1209
|
+
onClick: r ? l : void 0,
|
|
1185
1210
|
children: [
|
|
1186
|
-
|
|
1187
|
-
e.label
|
|
1188
|
-
n && s && l > 0 && /* @__PURE__ */ _("span", { className: "stmt__count", children: [
|
|
1189
|
-
l,
|
|
1190
|
-
" ",
|
|
1191
|
-
l === 1 ? "conta" : "contas"
|
|
1192
|
-
] })
|
|
1211
|
+
r && /* @__PURE__ */ a(Rr, { label: e.label, collapsed: s, onToggle: l }),
|
|
1212
|
+
e.label
|
|
1193
1213
|
]
|
|
1194
1214
|
}
|
|
1195
1215
|
);
|
|
1196
1216
|
}
|
|
1197
|
-
function K(e, t,
|
|
1217
|
+
function K(e, t, n = { bold: !0 }) {
|
|
1198
1218
|
return [
|
|
1199
1219
|
"stmt__row",
|
|
1200
1220
|
`stmt__row--${e.type}`,
|
|
1201
|
-
|
|
1221
|
+
n.bold && e.style.bold && "stmt__row--bold",
|
|
1202
1222
|
t.collapsible && "stmt__row--section",
|
|
1203
1223
|
t.collapsed && "stmt__row--collapsed"
|
|
1204
1224
|
].filter(Boolean).join(" ");
|
|
@@ -1206,26 +1226,26 @@ function K(e, t, r = { bold: !0 }) {
|
|
|
1206
1226
|
function Ee(e) {
|
|
1207
1227
|
return e.type === "header" && e.formatted.length === 0;
|
|
1208
1228
|
}
|
|
1209
|
-
function
|
|
1229
|
+
function $r({
|
|
1210
1230
|
line: e,
|
|
1211
1231
|
columnCount: t,
|
|
1212
|
-
showTotal:
|
|
1213
|
-
showVertical:
|
|
1232
|
+
showTotal: n,
|
|
1233
|
+
showVertical: r,
|
|
1214
1234
|
showHorizontal: s,
|
|
1215
1235
|
comparisonLabel: l,
|
|
1216
|
-
section:
|
|
1236
|
+
section: i
|
|
1217
1237
|
}) {
|
|
1218
|
-
return e.type === "separator" ? /* @__PURE__ */ a("tr", { className: "stmt__row stmt__row--separator", children: /* @__PURE__ */ a("td", { colSpan: t }) }) : Ee(e) ? /* @__PURE__ */ _("tr", { className: K(e,
|
|
1219
|
-
/* @__PURE__ */ a(G, { line: e, section:
|
|
1238
|
+
return e.type === "separator" ? /* @__PURE__ */ a("tr", { className: "stmt__row stmt__row--separator", children: /* @__PURE__ */ a("td", { colSpan: t }) }) : Ee(e) ? /* @__PURE__ */ _("tr", { className: K(e, i, { bold: !1 }), children: [
|
|
1239
|
+
/* @__PURE__ */ a(G, { line: e, section: i }),
|
|
1220
1240
|
/* @__PURE__ */ a("td", { colSpan: t - 1 })
|
|
1221
|
-
] }) : /* @__PURE__ */ _("tr", { className: K(e,
|
|
1222
|
-
/* @__PURE__ */ a(G, { line: e, section:
|
|
1223
|
-
e.formatted.map((
|
|
1241
|
+
] }) : /* @__PURE__ */ _("tr", { className: K(e, i), children: [
|
|
1242
|
+
/* @__PURE__ */ a(G, { line: e, section: i }),
|
|
1243
|
+
e.formatted.map((o, u) => {
|
|
1224
1244
|
var m;
|
|
1225
|
-
const c = e.horizontalAnalysis[
|
|
1245
|
+
const c = e.horizontalAnalysis[u], d = (m = e.comparison) == null ? void 0 : m[u];
|
|
1226
1246
|
return /* @__PURE__ */ _("td", { className: "stmt__value", children: [
|
|
1227
|
-
/* @__PURE__ */ a("span", { className:
|
|
1228
|
-
|
|
1247
|
+
/* @__PURE__ */ a("span", { className: Q(e.values[u]), children: o }),
|
|
1248
|
+
r && e.verticalAnalysis[u] != null && /* @__PURE__ */ a("span", { className: "stmt__aux", title: "Análise vertical", children: D(e.verticalAnalysis[u], "percentage") }),
|
|
1229
1249
|
s && c != null && /* @__PURE__ */ a(
|
|
1230
1250
|
"span",
|
|
1231
1251
|
{
|
|
@@ -1234,96 +1254,97 @@ function Rr({
|
|
|
1234
1254
|
children: D(c, "percentage")
|
|
1235
1255
|
}
|
|
1236
1256
|
),
|
|
1237
|
-
l &&
|
|
1257
|
+
l && d != null && /* @__PURE__ */ _(
|
|
1238
1258
|
"span",
|
|
1239
1259
|
{
|
|
1240
|
-
className: `stmt__aux stmt__aux--${
|
|
1260
|
+
className: `stmt__aux stmt__aux--${d < 0 ? "down" : "up"}`,
|
|
1241
1261
|
title: l,
|
|
1242
1262
|
children: [
|
|
1243
1263
|
"vs ",
|
|
1244
|
-
D(
|
|
1264
|
+
D(d, "percentage")
|
|
1245
1265
|
]
|
|
1246
1266
|
}
|
|
1247
1267
|
)
|
|
1248
|
-
] },
|
|
1268
|
+
] }, u);
|
|
1249
1269
|
}),
|
|
1250
|
-
|
|
1270
|
+
n && /* @__PURE__ */ a("td", { className: "stmt__value stmt__value--total", children: /* @__PURE__ */ a("span", { className: Q(e.total), children: e.totalFormatted ?? "-" }) })
|
|
1251
1271
|
] });
|
|
1252
1272
|
}
|
|
1253
|
-
function
|
|
1273
|
+
function xr({
|
|
1254
1274
|
name: e,
|
|
1255
1275
|
columns: t,
|
|
1256
|
-
lines:
|
|
1257
|
-
showTotal:
|
|
1276
|
+
lines: n,
|
|
1277
|
+
showTotal: r,
|
|
1258
1278
|
totalLabel: s,
|
|
1259
1279
|
showVertical: l,
|
|
1260
|
-
showHorizontal:
|
|
1261
|
-
comparisonLabel:
|
|
1262
|
-
collapse:
|
|
1280
|
+
showHorizontal: i,
|
|
1281
|
+
comparisonLabel: o,
|
|
1282
|
+
collapse: u
|
|
1263
1283
|
}) {
|
|
1264
|
-
const c = R(null),
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1284
|
+
const c = R(null), d = F(() => t.map((f) => f.key), [t]), { current: m, pin: h } = or(c, d), p = P((f) => {
|
|
1285
|
+
h(f);
|
|
1286
|
+
const N = c.current;
|
|
1287
|
+
if (!N) return;
|
|
1288
|
+
const w = N.querySelector(`[data-period="${CSS.escape(f)}"]`);
|
|
1289
|
+
w == null || w.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
|
|
1290
|
+
}, [h]), v = 1 + t.length + (r ? 1 : 0);
|
|
1270
1291
|
return /* @__PURE__ */ _(V, { children: [
|
|
1271
|
-
t.length > 1 && /* @__PURE__ */ a("nav", { className: "stmt__periods", "aria-label": "Períodos", children: t.map((
|
|
1272
|
-
const
|
|
1292
|
+
t.length > 1 && /* @__PURE__ */ a("nav", { className: "stmt__periods", "aria-label": "Períodos", children: t.map((f) => {
|
|
1293
|
+
const N = f.key === m;
|
|
1273
1294
|
return /* @__PURE__ */ a(
|
|
1274
1295
|
"button",
|
|
1275
1296
|
{
|
|
1276
1297
|
type: "button",
|
|
1277
|
-
className:
|
|
1278
|
-
"aria-current":
|
|
1279
|
-
title: `${
|
|
1280
|
-
onClick: () => p(
|
|
1281
|
-
children:
|
|
1298
|
+
className: N ? "stmt__period stmt__period--current" : "stmt__period",
|
|
1299
|
+
"aria-current": N ? "true" : void 0,
|
|
1300
|
+
title: `${f.start} a ${f.end}`,
|
|
1301
|
+
onClick: () => p(f.key),
|
|
1302
|
+
children: f.label
|
|
1282
1303
|
},
|
|
1283
|
-
|
|
1304
|
+
f.key
|
|
1284
1305
|
);
|
|
1285
1306
|
}) }),
|
|
1286
1307
|
/* @__PURE__ */ a("div", { className: "stmt__scroll", ref: c, children: /* @__PURE__ */ _("table", { className: "stmt__table", children: [
|
|
1287
1308
|
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ _("tr", { children: [
|
|
1288
1309
|
/* @__PURE__ */ a("th", { className: "stmt__corner", scope: "col", children: e }),
|
|
1289
|
-
t.map((
|
|
1310
|
+
t.map((f) => /* @__PURE__ */ a(
|
|
1290
1311
|
"th",
|
|
1291
1312
|
{
|
|
1292
1313
|
scope: "col",
|
|
1293
|
-
"data-period":
|
|
1294
|
-
title: `${
|
|
1295
|
-
children:
|
|
1314
|
+
"data-period": f.key,
|
|
1315
|
+
title: `${f.start} a ${f.end}`,
|
|
1316
|
+
children: f.label
|
|
1296
1317
|
},
|
|
1297
|
-
|
|
1318
|
+
f.key
|
|
1298
1319
|
)),
|
|
1299
|
-
|
|
1320
|
+
r && /* @__PURE__ */ a("th", { scope: "col", className: "stmt__total-head", children: s })
|
|
1300
1321
|
] }) }),
|
|
1301
|
-
/* @__PURE__ */ a("tbody", { children:
|
|
1302
|
-
|
|
1322
|
+
/* @__PURE__ */ a("tbody", { children: n.map((f) => u.hidden.has(f.id) ? null : /* @__PURE__ */ a(
|
|
1323
|
+
$r,
|
|
1303
1324
|
{
|
|
1304
|
-
line:
|
|
1305
|
-
columnCount:
|
|
1306
|
-
showTotal:
|
|
1325
|
+
line: f,
|
|
1326
|
+
columnCount: v,
|
|
1327
|
+
showTotal: r,
|
|
1307
1328
|
showVertical: l,
|
|
1308
|
-
showHorizontal:
|
|
1309
|
-
comparisonLabel:
|
|
1310
|
-
section:
|
|
1329
|
+
showHorizontal: i,
|
|
1330
|
+
comparisonLabel: o,
|
|
1331
|
+
section: Ae(f, u)
|
|
1311
1332
|
},
|
|
1312
|
-
|
|
1333
|
+
f.id
|
|
1313
1334
|
)) })
|
|
1314
1335
|
] }) })
|
|
1315
1336
|
] });
|
|
1316
1337
|
}
|
|
1317
|
-
function
|
|
1338
|
+
function Z(e) {
|
|
1318
1339
|
return e.kind === "total" ? "total" : `period:${e.column.key}`;
|
|
1319
1340
|
}
|
|
1320
|
-
function
|
|
1341
|
+
function Me(e) {
|
|
1321
1342
|
return e.kind === "total" ? e.label : e.column.label;
|
|
1322
1343
|
}
|
|
1323
|
-
function
|
|
1324
|
-
const
|
|
1325
|
-
return /* @__PURE__ */ _("div", { className: "stmt__picker", role: "group", "aria-label": "Seleção de período", onKeyDown: (
|
|
1326
|
-
|
|
1344
|
+
function Tr({ slots: e, selected: t, onSelect: n }) {
|
|
1345
|
+
const r = () => n(Math.max(0, t - 1)), s = () => n(Math.min(e.length - 1, t + 1));
|
|
1346
|
+
return /* @__PURE__ */ _("div", { className: "stmt__picker", role: "group", "aria-label": "Seleção de período", onKeyDown: (i) => {
|
|
1347
|
+
i.key === "ArrowLeft" ? (i.preventDefault(), r()) : i.key === "ArrowRight" && (i.preventDefault(), s());
|
|
1327
1348
|
}, children: [
|
|
1328
1349
|
/* @__PURE__ */ a(
|
|
1329
1350
|
"button",
|
|
@@ -1331,7 +1352,7 @@ function xr({ slots: e, selected: t, onSelect: r }) {
|
|
|
1331
1352
|
type: "button",
|
|
1332
1353
|
className: "stmt__picker-arrow",
|
|
1333
1354
|
"aria-label": "Período anterior",
|
|
1334
|
-
onClick:
|
|
1355
|
+
onClick: r,
|
|
1335
1356
|
disabled: t <= 0,
|
|
1336
1357
|
children: /* @__PURE__ */ a("span", { "aria-hidden": "true", children: "‹" })
|
|
1337
1358
|
}
|
|
@@ -1342,8 +1363,8 @@ function xr({ slots: e, selected: t, onSelect: r }) {
|
|
|
1342
1363
|
className: "stmt__picker-select",
|
|
1343
1364
|
"aria-label": "Período",
|
|
1344
1365
|
value: String(t),
|
|
1345
|
-
onChange: (
|
|
1346
|
-
children: e.map((
|
|
1366
|
+
onChange: (i) => n(Number(i.target.value)),
|
|
1367
|
+
children: e.map((i, o) => /* @__PURE__ */ a("option", { value: String(o), children: Me(i) }, Z(i)))
|
|
1347
1368
|
}
|
|
1348
1369
|
),
|
|
1349
1370
|
/* @__PURE__ */ a(
|
|
@@ -1359,61 +1380,61 @@ function xr({ slots: e, selected: t, onSelect: r }) {
|
|
|
1359
1380
|
)
|
|
1360
1381
|
] });
|
|
1361
1382
|
}
|
|
1362
|
-
function
|
|
1363
|
-
const
|
|
1364
|
-
if (
|
|
1365
|
-
return /* @__PURE__ */ _("span", { className:
|
|
1366
|
-
/* @__PURE__ */ a("span", { className: "stmt__aux-number", children: D(
|
|
1383
|
+
function Pr({ line: e, index: t, previous: n }) {
|
|
1384
|
+
const r = e.horizontalAnalysis[t];
|
|
1385
|
+
if (r != null)
|
|
1386
|
+
return /* @__PURE__ */ _("span", { className: _e(r), title: `Variação sobre ${n.label}`, children: [
|
|
1387
|
+
/* @__PURE__ */ a("span", { className: "stmt__aux-number", children: D(r, "percentage") }),
|
|
1367
1388
|
" ",
|
|
1368
1389
|
/* @__PURE__ */ _("span", { className: "stmt__aux-label", children: [
|
|
1369
1390
|
"vs ",
|
|
1370
|
-
|
|
1391
|
+
n.label
|
|
1371
1392
|
] })
|
|
1372
1393
|
] });
|
|
1373
1394
|
const s = e.formatted[t - 1];
|
|
1374
|
-
return s == null ? null : /* @__PURE__ */ _("span", { className:
|
|
1395
|
+
return s == null ? null : /* @__PURE__ */ _("span", { className: _e(e.values[t - 1]), title: `Valor em ${n.label}`, children: [
|
|
1375
1396
|
/* @__PURE__ */ _("span", { className: "stmt__aux-label", children: [
|
|
1376
|
-
|
|
1397
|
+
n.label,
|
|
1377
1398
|
":"
|
|
1378
1399
|
] }),
|
|
1379
1400
|
" ",
|
|
1380
1401
|
/* @__PURE__ */ a("span", { className: "stmt__aux-number", children: s })
|
|
1381
1402
|
] });
|
|
1382
1403
|
}
|
|
1383
|
-
function
|
|
1404
|
+
function Ar({ line: e, slot: t, previous: n, compare: r, section: s }) {
|
|
1384
1405
|
if (e.type === "separator")
|
|
1385
1406
|
return /* @__PURE__ */ a("tr", { className: "stmt__row stmt__row--separator", children: /* @__PURE__ */ a("td", { colSpan: 2 }) });
|
|
1386
1407
|
if (Ee(e))
|
|
1387
1408
|
return /* @__PURE__ */ _("tr", { className: K(e, s, { bold: !1 }), children: [
|
|
1388
|
-
/* @__PURE__ */ a(G, { line: e, section: s, indentStep:
|
|
1409
|
+
/* @__PURE__ */ a(G, { line: e, section: s, indentStep: pe }),
|
|
1389
1410
|
/* @__PURE__ */ a("td", {})
|
|
1390
1411
|
] });
|
|
1391
|
-
const l = t.kind === "total",
|
|
1412
|
+
const l = t.kind === "total", i = l ? e.total : e.values[t.index], o = l ? e.totalFormatted ?? "-" : e.formatted[t.index];
|
|
1392
1413
|
return /* @__PURE__ */ _("tr", { className: K(e, s), children: [
|
|
1393
|
-
/* @__PURE__ */ a(G, { line: e, section: s, indentStep:
|
|
1414
|
+
/* @__PURE__ */ a(G, { line: e, section: s, indentStep: pe }),
|
|
1394
1415
|
/* @__PURE__ */ _("td", { className: l ? "stmt__value stmt__value--total" : "stmt__value", children: [
|
|
1395
|
-
/* @__PURE__ */ a("span", { className:
|
|
1396
|
-
|
|
1416
|
+
/* @__PURE__ */ a("span", { className: Q(i), children: o }),
|
|
1417
|
+
r && t.kind === "period" && n && /* @__PURE__ */ a(Pr, { line: e, index: t.index, previous: n })
|
|
1397
1418
|
] })
|
|
1398
1419
|
] });
|
|
1399
1420
|
}
|
|
1400
|
-
function
|
|
1401
|
-
const
|
|
1402
|
-
const
|
|
1403
|
-
return
|
|
1404
|
-
}, [t,
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
}, [
|
|
1421
|
+
function Er({ name: e, columns: t, lines: n, showTotal: r, totalLabel: s, collapse: l }) {
|
|
1422
|
+
const i = F(() => {
|
|
1423
|
+
const w = t.map((y, T) => ({ kind: "period", index: T, column: y }));
|
|
1424
|
+
return r && w.push({ kind: "total", label: s }), w;
|
|
1425
|
+
}, [t, r, s]), [o, u] = E(null), [c, d] = E(!0), m = t.length - 1, h = o == null ? -1 : i.findIndex((w) => Z(w) === o), p = h >= 0 ? h : m, v = i[p], f = v.kind === "period" && v.index > 0 ? t[v.index - 1] : null, N = P((w) => {
|
|
1426
|
+
const y = i[w];
|
|
1427
|
+
y && u(Z(y));
|
|
1428
|
+
}, [i]);
|
|
1408
1429
|
return /* @__PURE__ */ _(V, { children: [
|
|
1409
|
-
/* @__PURE__ */ a(
|
|
1430
|
+
/* @__PURE__ */ a(Tr, { slots: i, selected: p, onSelect: N }),
|
|
1410
1431
|
/* @__PURE__ */ _("label", { className: "stmt__compare", children: [
|
|
1411
1432
|
/* @__PURE__ */ a(
|
|
1412
1433
|
"input",
|
|
1413
1434
|
{
|
|
1414
1435
|
type: "checkbox",
|
|
1415
1436
|
checked: c,
|
|
1416
|
-
onChange: (
|
|
1437
|
+
onChange: (w) => d(w.target.checked)
|
|
1417
1438
|
}
|
|
1418
1439
|
),
|
|
1419
1440
|
"Comparar com o anterior"
|
|
@@ -1421,18 +1442,18 @@ function Ar({ name: e, columns: t, lines: r, showTotal: n, totalLabel: s, collap
|
|
|
1421
1442
|
/* @__PURE__ */ a("div", { className: "stmt__scroll", children: /* @__PURE__ */ _("table", { className: "stmt__list", children: [
|
|
1422
1443
|
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ _("tr", { children: [
|
|
1423
1444
|
/* @__PURE__ */ a("th", { scope: "col", className: "stmt__list-name", children: e }),
|
|
1424
|
-
/* @__PURE__ */ a("th", { scope: "col", className: "stmt__list-period", "aria-live": "polite", "aria-atomic": "true", children:
|
|
1445
|
+
/* @__PURE__ */ a("th", { scope: "col", className: "stmt__list-period", "aria-live": "polite", "aria-atomic": "true", children: Me(v) })
|
|
1425
1446
|
] }) }),
|
|
1426
|
-
/* @__PURE__ */ a("tbody", { children:
|
|
1427
|
-
|
|
1447
|
+
/* @__PURE__ */ a("tbody", { children: n.map((w) => l.hidden.has(w.id) ? null : /* @__PURE__ */ a(
|
|
1448
|
+
Ar,
|
|
1428
1449
|
{
|
|
1429
|
-
line:
|
|
1430
|
-
slot:
|
|
1431
|
-
previous:
|
|
1450
|
+
line: w,
|
|
1451
|
+
slot: v,
|
|
1452
|
+
previous: f,
|
|
1432
1453
|
compare: c,
|
|
1433
|
-
section:
|
|
1454
|
+
section: Ae(w, l)
|
|
1434
1455
|
},
|
|
1435
|
-
|
|
1456
|
+
w.id
|
|
1436
1457
|
)) })
|
|
1437
1458
|
] }) })
|
|
1438
1459
|
] });
|
|
@@ -1440,68 +1461,72 @@ function Ar({ name: e, columns: t, lines: r, showTotal: n, totalLabel: s, collap
|
|
|
1440
1461
|
function Mr({
|
|
1441
1462
|
layout: e,
|
|
1442
1463
|
renderData: t,
|
|
1443
|
-
loading:
|
|
1444
|
-
error:
|
|
1464
|
+
loading: n,
|
|
1465
|
+
error: r,
|
|
1445
1466
|
filters: s,
|
|
1446
1467
|
setFilter: l,
|
|
1447
|
-
|
|
1448
|
-
|
|
1468
|
+
touched: i,
|
|
1469
|
+
clearFilter: o,
|
|
1470
|
+
downloadPdf: u,
|
|
1471
|
+
downloading: c,
|
|
1449
1472
|
showDownload: d,
|
|
1450
|
-
mode:
|
|
1473
|
+
mode: m
|
|
1451
1474
|
}) {
|
|
1452
|
-
const
|
|
1475
|
+
const h = (t == null ? void 0 : t.dateBounds) ?? e.dateBounds, p = e.periods.showTotal, v = (t == null ? void 0 : t.columns) ?? Sr, f = (t == null ? void 0 : t.lines) ?? kr, N = mr(f), [w, y] = E(!1), T = f.some((C) => C.verticalAnalysis.length > 0), A = f.some((C) => C.horizontalAnalysis.length > 0), M = e.periods.comparisonOffset, $ = M ? Cr(M, e.periods.granularity) : void 0, g = Nr - (p ? 1 : 0), b = Math.max(0, v.length - g), S = /* @__PURE__ */ _("span", { className: "stmt__meta stmt__bounds", children: [
|
|
1453
1476
|
"Base: ",
|
|
1454
|
-
|
|
1477
|
+
h.min,
|
|
1455
1478
|
" a ",
|
|
1456
|
-
|
|
1479
|
+
h.max
|
|
1457
1480
|
] });
|
|
1458
|
-
let
|
|
1459
|
-
return t ?
|
|
1460
|
-
|
|
1481
|
+
let x;
|
|
1482
|
+
return t ? v.length === 0 ? x = /* @__PURE__ */ a("div", { className: "stmt__state", children: "Nenhum período na janela selecionada." }) : f.length === 0 ? x = /* @__PURE__ */ a("div", { className: "stmt__state", children: "Este demonstrativo não possui linhas." }) : m === "periods" ? x = /* @__PURE__ */ a(
|
|
1483
|
+
Er,
|
|
1461
1484
|
{
|
|
1462
1485
|
name: t.name,
|
|
1463
|
-
columns:
|
|
1486
|
+
columns: v,
|
|
1464
1487
|
lines: f,
|
|
1465
|
-
showTotal:
|
|
1488
|
+
showTotal: p,
|
|
1466
1489
|
totalLabel: e.periods.totalLabel,
|
|
1467
|
-
collapse:
|
|
1490
|
+
collapse: N
|
|
1468
1491
|
}
|
|
1469
|
-
) :
|
|
1470
|
-
|
|
1492
|
+
) : x = /* @__PURE__ */ a(
|
|
1493
|
+
xr,
|
|
1471
1494
|
{
|
|
1472
1495
|
name: t.name,
|
|
1473
|
-
columns:
|
|
1496
|
+
columns: v,
|
|
1474
1497
|
lines: f,
|
|
1475
|
-
showTotal:
|
|
1498
|
+
showTotal: p,
|
|
1476
1499
|
totalLabel: e.periods.totalLabel,
|
|
1477
|
-
showVertical:
|
|
1478
|
-
showHorizontal:
|
|
1500
|
+
showVertical: T,
|
|
1501
|
+
showHorizontal: A,
|
|
1479
1502
|
comparisonLabel: $,
|
|
1480
|
-
collapse:
|
|
1503
|
+
collapse: N
|
|
1481
1504
|
}
|
|
1482
|
-
) :
|
|
1505
|
+
) : x = /* @__PURE__ */ a("div", { className: "stmt__state", children: "Calculando..." }), /* @__PURE__ */ _(V, { children: [
|
|
1483
1506
|
/* @__PURE__ */ _("div", { className: "stmt__toolbar", children: [
|
|
1484
|
-
e.filters.map((
|
|
1507
|
+
e.filters.map((C) => /* @__PURE__ */ a(
|
|
1485
1508
|
yr,
|
|
1486
1509
|
{
|
|
1487
|
-
definition:
|
|
1488
|
-
value: s[
|
|
1489
|
-
options: e.filterOptions[
|
|
1490
|
-
bounds:
|
|
1491
|
-
rangeUnit:
|
|
1492
|
-
|
|
1510
|
+
definition: C,
|
|
1511
|
+
value: s[C.id] ?? "",
|
|
1512
|
+
options: e.filterOptions[C.id] ?? [],
|
|
1513
|
+
bounds: h,
|
|
1514
|
+
rangeUnit: wr[e.periods.granularity] ?? "day",
|
|
1515
|
+
touched: i[C.id] ?? !1,
|
|
1516
|
+
onChange: (k) => l(C.id, k),
|
|
1517
|
+
onClear: () => o(C.id)
|
|
1493
1518
|
},
|
|
1494
|
-
|
|
1519
|
+
C.id
|
|
1495
1520
|
)),
|
|
1496
1521
|
/* @__PURE__ */ _("div", { className: "stmt__toolbar-end", children: [
|
|
1497
|
-
|
|
1498
|
-
|
|
1522
|
+
m === "table" && S,
|
|
1523
|
+
N.hasSections && /* @__PURE__ */ _(V, { children: [
|
|
1499
1524
|
/* @__PURE__ */ a(
|
|
1500
1525
|
"button",
|
|
1501
1526
|
{
|
|
1502
1527
|
type: "button",
|
|
1503
1528
|
className: "stmt__outline",
|
|
1504
|
-
onClick:
|
|
1529
|
+
onClick: N.collapseToSummary,
|
|
1505
1530
|
children: "Recolher seções"
|
|
1506
1531
|
}
|
|
1507
1532
|
),
|
|
@@ -1510,7 +1535,7 @@ function Mr({
|
|
|
1510
1535
|
{
|
|
1511
1536
|
type: "button",
|
|
1512
1537
|
className: "stmt__outline",
|
|
1513
|
-
onClick:
|
|
1538
|
+
onClick: N.expandAll,
|
|
1514
1539
|
children: "Expandir tudo"
|
|
1515
1540
|
}
|
|
1516
1541
|
)
|
|
@@ -1521,81 +1546,85 @@ function Mr({
|
|
|
1521
1546
|
type: "button",
|
|
1522
1547
|
className: "stmt__download",
|
|
1523
1548
|
onClick: () => {
|
|
1524
|
-
if (
|
|
1525
|
-
|
|
1549
|
+
if (b > 0 && !w) {
|
|
1550
|
+
y(!0);
|
|
1526
1551
|
return;
|
|
1527
1552
|
}
|
|
1528
|
-
|
|
1553
|
+
y(!1), u();
|
|
1529
1554
|
},
|
|
1530
|
-
disabled:
|
|
1555
|
+
disabled: c || !t,
|
|
1531
1556
|
title: "Baixar o documento em PDF",
|
|
1532
|
-
children:
|
|
1557
|
+
children: c ? "Gerando..." : "Baixar PDF"
|
|
1533
1558
|
}
|
|
1534
1559
|
)
|
|
1535
1560
|
] })
|
|
1536
1561
|
] }),
|
|
1537
|
-
|
|
1538
|
-
|
|
1562
|
+
r && /* @__PURE__ */ a("div", { className: "stmt__error", children: r }),
|
|
1563
|
+
w && b > 0 && /* @__PURE__ */ _("div", { className: "stmt__warning", children: [
|
|
1539
1564
|
"O PDF cabe ",
|
|
1540
|
-
|
|
1565
|
+
g,
|
|
1541
1566
|
" períodos e este documento tem ",
|
|
1542
|
-
|
|
1567
|
+
v.length,
|
|
1543
1568
|
": o arquivo sairá com os ",
|
|
1544
|
-
|
|
1569
|
+
g,
|
|
1545
1570
|
" mais recentes",
|
|
1546
|
-
|
|
1571
|
+
p && ", e a coluna de total seguirá cobrindo a janela inteira",
|
|
1547
1572
|
'. Clique em "Baixar PDF" de novo para gerar assim, ou reduza o período.'
|
|
1548
1573
|
] }),
|
|
1549
1574
|
(t == null ? void 0 : t.truncated) && /* @__PURE__ */ _("div", { className: "stmt__warning", children: [
|
|
1550
1575
|
"A janela pedida excede o limite de colunas: o documento mostra as primeiras ",
|
|
1551
|
-
|
|
1576
|
+
v.length,
|
|
1552
1577
|
". Escolha um período menor ou uma coluna mais larga."
|
|
1553
1578
|
] }),
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1579
|
+
x,
|
|
1580
|
+
m === "periods" && S,
|
|
1581
|
+
n && t && /* @__PURE__ */ a("div", { className: "stmt__recalculating", children: "Atualizando..." })
|
|
1557
1582
|
] });
|
|
1558
1583
|
}
|
|
1559
|
-
function
|
|
1584
|
+
function zr({
|
|
1560
1585
|
token: e,
|
|
1561
1586
|
palette: t,
|
|
1562
|
-
showDownload:
|
|
1563
|
-
layout:
|
|
1587
|
+
showDownload: n = !0,
|
|
1588
|
+
layout: r = "auto",
|
|
1564
1589
|
className: s
|
|
1565
1590
|
}) {
|
|
1566
1591
|
const {
|
|
1567
1592
|
layout: l,
|
|
1568
|
-
renderData:
|
|
1569
|
-
loading:
|
|
1570
|
-
error:
|
|
1593
|
+
renderData: i,
|
|
1594
|
+
loading: o,
|
|
1595
|
+
error: u,
|
|
1571
1596
|
filters: c,
|
|
1572
|
-
setFilter:
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1597
|
+
setFilter: d,
|
|
1598
|
+
touched: m,
|
|
1599
|
+
clearFilter: h,
|
|
1600
|
+
downloadPdf: p,
|
|
1601
|
+
downloading: v
|
|
1602
|
+
} = nr(e), { ref: f, narrow: N } = pr(r === "auto"), w = r === "auto" ? N ? "periods" : "table" : r, y = ["stmt", `stmt--${w}`, s].filter(Boolean).join(" "), T = {
|
|
1603
|
+
...t ? Ne(t) : {},
|
|
1604
|
+
...vr(l == null ? void 0 : l.colors)
|
|
1578
1605
|
};
|
|
1579
|
-
let
|
|
1580
|
-
return
|
|
1606
|
+
let A;
|
|
1607
|
+
return u && !l ? A = /* @__PURE__ */ a("div", { className: "stmt__error", children: u }) : l ? A = /* @__PURE__ */ a(
|
|
1581
1608
|
Mr,
|
|
1582
1609
|
{
|
|
1583
1610
|
layout: l,
|
|
1584
|
-
renderData:
|
|
1585
|
-
loading:
|
|
1586
|
-
error:
|
|
1611
|
+
renderData: i,
|
|
1612
|
+
loading: o,
|
|
1613
|
+
error: u,
|
|
1587
1614
|
filters: c,
|
|
1588
|
-
setFilter:
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1615
|
+
setFilter: d,
|
|
1616
|
+
touched: m,
|
|
1617
|
+
clearFilter: h,
|
|
1618
|
+
downloadPdf: p,
|
|
1619
|
+
downloading: v,
|
|
1620
|
+
showDownload: n,
|
|
1621
|
+
mode: w
|
|
1593
1622
|
}
|
|
1594
|
-
) :
|
|
1623
|
+
) : A = /* @__PURE__ */ a("div", { className: "stmt__state", children: "Carregando demonstrativo..." }), /* @__PURE__ */ a("div", { ref: f, className: y, style: T, children: A });
|
|
1595
1624
|
}
|
|
1596
1625
|
export {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1626
|
+
Vr as ApiError,
|
|
1627
|
+
Wr as Dashboard,
|
|
1628
|
+
zr as Statement
|
|
1600
1629
|
};
|
|
1601
1630
|
//# sourceMappingURL=index.js.map
|