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