@actionexec/dashboards 0.1.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -28
- package/dist/Dashboard.d.ts +5 -13
- package/dist/api/fetcher.d.ts +2 -19
- package/dist/hooks/useDashboardData.d.ts +1 -2
- package/dist/index-BHv7_r-h.js +484 -0
- package/dist/index-BHv7_r-h.js.map +1 -0
- package/dist/index.d.ts +1 -19
- package/dist/index.js +358 -852
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +8 -0
- package/dist/internals.js +46 -0
- package/dist/internals.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -1,658 +1,366 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as _, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as M, useEffect as T, useCallback as R, useMemo as G } from "react";
|
|
3
|
+
import { J as z, z as I, G as E, m as D, u as x, H as X, k as L, t as H, r as U, d as q, w as J, v as Q, b as Z } from "./index-BHv7_r-h.js";
|
|
4
|
+
import { PieChart as B, Pie as ee, Cell as te, Tooltip as W, LineChart as ae, Line as re, AreaChart as le, Area as ne, BarChart as ie, Bar as se, CartesianGrid as ce, XAxis as oe, YAxis as de, Legend as he } from "recharts";
|
|
5
|
+
const ue = "https://action-data-api.fly.dev/api", ge = "/external/dashboards";
|
|
6
|
+
class pe extends Error {
|
|
7
|
+
constructor(r, n, t) {
|
|
8
|
+
super(r), this.status = n, this.payload = t, this.name = "ApiError";
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
d = await o.json();
|
|
23
|
-
} catch {
|
|
24
|
-
}
|
|
25
|
-
throw new ge(
|
|
26
|
-
`Requisicao falhou (${o.status}) em ${c}`,
|
|
27
|
-
o.status,
|
|
28
|
-
d
|
|
29
|
-
);
|
|
11
|
+
async function Y(a, r, n) {
|
|
12
|
+
const t = new URL(`${ue}${ge}${a}`);
|
|
13
|
+
if (n)
|
|
14
|
+
for (const [i, s] of Object.entries(n)) t.searchParams.set(i, s);
|
|
15
|
+
const e = await fetch(t.toString(), {
|
|
16
|
+
headers: { Authorization: `Bearer ${r}` }
|
|
17
|
+
});
|
|
18
|
+
if (!e.ok) {
|
|
19
|
+
let i;
|
|
20
|
+
try {
|
|
21
|
+
i = await e.json();
|
|
22
|
+
} catch {
|
|
30
23
|
}
|
|
31
|
-
|
|
24
|
+
throw new pe(
|
|
25
|
+
`Requisicao falhou (${e.status}) em ${a}`,
|
|
26
|
+
e.status,
|
|
27
|
+
i
|
|
28
|
+
);
|
|
32
29
|
}
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
y || n(w);
|
|
45
|
-
}).catch((w) => {
|
|
46
|
-
y || h(w.message);
|
|
30
|
+
return await e.json();
|
|
31
|
+
}
|
|
32
|
+
const me = (a) => Y("/layout", a), _e = (a, r) => Y("/render", a, r), fe = 300;
|
|
33
|
+
function be(a) {
|
|
34
|
+
const [r, n] = N(null), [t, e] = N(null), [i, s] = N({}), [c, p] = N({}), [o, d] = N(null), [h, g] = N(!0), [w, u] = N(null), m = M(), $ = M(!1);
|
|
35
|
+
T(() => {
|
|
36
|
+
let v = !1;
|
|
37
|
+
return me(a).then((b) => {
|
|
38
|
+
v || n(b);
|
|
39
|
+
}).catch((b) => {
|
|
40
|
+
v || u(b.message);
|
|
47
41
|
}), () => {
|
|
48
|
-
|
|
42
|
+
v = !0;
|
|
49
43
|
};
|
|
50
|
-
}, []),
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}).catch((
|
|
57
|
-
},
|
|
58
|
-
|
|
44
|
+
}, [a]), T(() => {
|
|
45
|
+
if (r)
|
|
46
|
+
return m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
47
|
+
const v = ve(i, c);
|
|
48
|
+
g(!0), _e(a, v).then((b) => {
|
|
49
|
+
e(b), !$.current && b.applied && ($.current = !0, s((k) => ({ ...we(b.applied), ...k }))), u(null);
|
|
50
|
+
}).catch((b) => u(b.message)).finally(() => g(!1));
|
|
51
|
+
}, fe), () => {
|
|
52
|
+
m.current && clearTimeout(m.current);
|
|
59
53
|
};
|
|
60
|
-
}, [
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
}, []),
|
|
64
|
-
|
|
65
|
-
}, []),
|
|
66
|
-
|
|
54
|
+
}, [a, r, i, c]);
|
|
55
|
+
const f = R((v, b) => {
|
|
56
|
+
s((k) => ({ ...k, [v]: b }));
|
|
57
|
+
}, []), C = R((v, b) => {
|
|
58
|
+
p((k) => ({ ...k, [v]: b }));
|
|
59
|
+
}, []), y = R((v) => {
|
|
60
|
+
d(v);
|
|
67
61
|
}, []), S = G(
|
|
68
|
-
() =>
|
|
69
|
-
[
|
|
62
|
+
() => o ?? (r == null ? void 0 : r.palette) ?? [],
|
|
63
|
+
[o, r]
|
|
70
64
|
);
|
|
71
65
|
return {
|
|
72
|
-
layout:
|
|
73
|
-
renderData:
|
|
74
|
-
loading:
|
|
75
|
-
error:
|
|
76
|
-
filters:
|
|
66
|
+
layout: r,
|
|
67
|
+
renderData: t,
|
|
68
|
+
loading: h,
|
|
69
|
+
error: w,
|
|
70
|
+
filters: i,
|
|
77
71
|
variables: c,
|
|
78
72
|
palette: S,
|
|
79
|
-
setFilter:
|
|
80
|
-
setVariable:
|
|
81
|
-
setPalette:
|
|
73
|
+
setFilter: f,
|
|
74
|
+
setVariable: C,
|
|
75
|
+
setPalette: y
|
|
82
76
|
};
|
|
83
77
|
}
|
|
84
|
-
function
|
|
78
|
+
function ve(a, r) {
|
|
85
79
|
const n = {};
|
|
86
|
-
for (const [
|
|
87
|
-
if (
|
|
88
|
-
const [
|
|
89
|
-
|
|
80
|
+
for (const [t, e] of Object.entries(a))
|
|
81
|
+
if (e.includes("|")) {
|
|
82
|
+
const [i, s] = e.split("|");
|
|
83
|
+
i && (n.f_date_start = i), s && (n.f_date_end = s);
|
|
90
84
|
} else
|
|
91
|
-
n[`f_${
|
|
92
|
-
for (const [
|
|
93
|
-
n[`v_${
|
|
94
|
-
return n;
|
|
95
|
-
}
|
|
96
|
-
function _e(e) {
|
|
97
|
-
const t = {};
|
|
98
|
-
for (const [n, r] of Object.entries(e))
|
|
99
|
-
if (r && typeof r == "object" && "start" in r) {
|
|
100
|
-
const a = r;
|
|
101
|
-
t[n] = `${a.start || ""}|${a.end || ""}`;
|
|
102
|
-
} else Array.isArray(r) ? t[n] = r.join(",") : typeof r == "string" && (t[n] = r);
|
|
103
|
-
return t;
|
|
104
|
-
}
|
|
105
|
-
const _ = {
|
|
106
|
-
series0: 0,
|
|
107
|
-
series1: 1,
|
|
108
|
-
series2: 2,
|
|
109
|
-
series3: 3,
|
|
110
|
-
series4: 4,
|
|
111
|
-
bgDark: 5,
|
|
112
|
-
bgPaper: 6,
|
|
113
|
-
bgElevated: 7,
|
|
114
|
-
textPrimary: 8,
|
|
115
|
-
textMuted: 9,
|
|
116
|
-
accent: 10,
|
|
117
|
-
success: 11,
|
|
118
|
-
error: 12
|
|
119
|
-
}, be = 5, x = 13, ve = {
|
|
120
|
-
series0: "Série 1",
|
|
121
|
-
series1: "Série 2",
|
|
122
|
-
series2: "Série 3",
|
|
123
|
-
series3: "Série 4",
|
|
124
|
-
series4: "Série 5",
|
|
125
|
-
bgDark: "Fundo Escuro",
|
|
126
|
-
bgPaper: "Fundo Cartão",
|
|
127
|
-
bgElevated: "Fundo Elevado",
|
|
128
|
-
textPrimary: "Texto Primário",
|
|
129
|
-
textMuted: "Texto Secundário",
|
|
130
|
-
accent: "Destaque",
|
|
131
|
-
success: "Sucesso",
|
|
132
|
-
error: "Erro"
|
|
133
|
-
}, M = {
|
|
134
|
-
action: {
|
|
135
|
-
label: "Action",
|
|
136
|
-
colors: [
|
|
137
|
-
"#ff6b00",
|
|
138
|
-
"#a3e635",
|
|
139
|
-
"#e3f544",
|
|
140
|
-
"#65ffd1",
|
|
141
|
-
"#ff0404",
|
|
142
|
-
"#1a1a1a",
|
|
143
|
-
"#262626",
|
|
144
|
-
"#333333",
|
|
145
|
-
"#f5f5f5",
|
|
146
|
-
"#999999",
|
|
147
|
-
"#ff6b00",
|
|
148
|
-
"#a3e635",
|
|
149
|
-
"#ef4444"
|
|
150
|
-
]
|
|
151
|
-
},
|
|
152
|
-
westCoast: {
|
|
153
|
-
label: "West Coast",
|
|
154
|
-
colors: [
|
|
155
|
-
"#a3b86c",
|
|
156
|
-
"#c89b3c",
|
|
157
|
-
"#8b6f47",
|
|
158
|
-
"#6b8e23",
|
|
159
|
-
"#d2691e",
|
|
160
|
-
"#1f1a14",
|
|
161
|
-
"#2a241b",
|
|
162
|
-
"#3a3225",
|
|
163
|
-
"#e8dcc4",
|
|
164
|
-
"#a89878",
|
|
165
|
-
"#c89b3c",
|
|
166
|
-
"#a3b86c",
|
|
167
|
-
"#c44536"
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
mono: {
|
|
171
|
-
label: "Monocromático",
|
|
172
|
-
colors: [
|
|
173
|
-
"#f8fafc",
|
|
174
|
-
"#cbd5e1",
|
|
175
|
-
"#94a3b8",
|
|
176
|
-
"#64748b",
|
|
177
|
-
"#475569",
|
|
178
|
-
"#0a0a0a",
|
|
179
|
-
"#171717",
|
|
180
|
-
"#262626",
|
|
181
|
-
"#fafafa",
|
|
182
|
-
"#a3a3a3",
|
|
183
|
-
"#e5e5e5",
|
|
184
|
-
"#cbd5e1",
|
|
185
|
-
"#ef4444"
|
|
186
|
-
]
|
|
187
|
-
},
|
|
188
|
-
ocean: {
|
|
189
|
-
label: "Ocean",
|
|
190
|
-
colors: [
|
|
191
|
-
"#0ea5e9",
|
|
192
|
-
"#06b6d4",
|
|
193
|
-
"#0891b2",
|
|
194
|
-
"#3b82f6",
|
|
195
|
-
"#22d3ee",
|
|
196
|
-
"#0a1929",
|
|
197
|
-
"#0f2740",
|
|
198
|
-
"#173554",
|
|
199
|
-
"#e0f2fe",
|
|
200
|
-
"#7dd3fc",
|
|
201
|
-
"#22d3ee",
|
|
202
|
-
"#10b981",
|
|
203
|
-
"#f43f5e"
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
princess: {
|
|
207
|
-
label: "Cute Pink",
|
|
208
|
-
colors: [
|
|
209
|
-
"#ff79bc",
|
|
210
|
-
"#a855f7",
|
|
211
|
-
"#f472b6",
|
|
212
|
-
"#d946ef",
|
|
213
|
-
"#fb7185",
|
|
214
|
-
"#fff0f6",
|
|
215
|
-
"#ffe4ec",
|
|
216
|
-
"#ffffff",
|
|
217
|
-
"#ff4099",
|
|
218
|
-
"#ffadd5",
|
|
219
|
-
"#ec4899",
|
|
220
|
-
"#10b981",
|
|
221
|
-
"#e11d48"
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
}, rt = "action", V = M.action.colors;
|
|
225
|
-
function C(e) {
|
|
226
|
-
const t = V;
|
|
227
|
-
if (!e || e.length === 0) return [...t];
|
|
228
|
-
if (e.length >= x) return e.slice(0, x);
|
|
229
|
-
const n = [...e];
|
|
230
|
-
for (let r = e.length; r < x; r++) n.push(t[r]);
|
|
85
|
+
n[`f_${t}`] = e;
|
|
86
|
+
for (const [t, e] of Object.entries(r))
|
|
87
|
+
n[`v_${t}`] = String(e);
|
|
231
88
|
return n;
|
|
232
89
|
}
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
"
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"--action-orange": t[_.accent],
|
|
246
|
-
"--action-green": t[_.success],
|
|
247
|
-
"--color-success": t[_.success],
|
|
248
|
-
"--color-error": t[_.error],
|
|
249
|
-
"--color-info": t[_.series2],
|
|
250
|
-
"--color-warning": t[_.series3]
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function ye({ data: e, label: t }) {
|
|
254
|
-
const n = t || String(e.label || ""), r = String(e.formatted || "-"), a = e.comparison, s = (a == null ? void 0 : a.trend) === "up" ? "widget-kpi__trend--up" : (a == null ? void 0 : a.trend) === "down" ? "widget-kpi__trend--down" : "", i = (a == null ? void 0 : a.trend) === "up" ? "↑" : (a == null ? void 0 : a.trend) === "down" ? "↓" : "";
|
|
255
|
-
return /* @__PURE__ */ m("div", { className: "widget widget-kpi", children: [
|
|
90
|
+
function we(a) {
|
|
91
|
+
const r = {};
|
|
92
|
+
for (const [n, t] of Object.entries(a))
|
|
93
|
+
if (t && typeof t == "object" && "start" in t) {
|
|
94
|
+
const e = t;
|
|
95
|
+
r[n] = `${e.start || ""}|${e.end || ""}`;
|
|
96
|
+
} else Array.isArray(t) ? r[n] = t.join(",") : typeof t == "string" && (r[n] = t);
|
|
97
|
+
return r;
|
|
98
|
+
}
|
|
99
|
+
function ye({ data: a, label: r }) {
|
|
100
|
+
const n = r || String(a.label || ""), t = String(a.formatted || "-"), e = a.comparison, i = (e == null ? void 0 : e.trend) === "up" ? "widget-kpi__trend--up" : (e == null ? void 0 : e.trend) === "down" ? "widget-kpi__trend--down" : "", s = (e == null ? void 0 : e.trend) === "up" ? "↑" : (e == null ? void 0 : e.trend) === "down" ? "↓" : "";
|
|
101
|
+
return /* @__PURE__ */ _("div", { className: "widget widget-kpi", children: [
|
|
256
102
|
/* @__PURE__ */ l("span", { className: "widget-kpi__label", children: n }),
|
|
257
|
-
/* @__PURE__ */ l("span", { className: "widget-kpi__value", children:
|
|
258
|
-
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
|
|
103
|
+
/* @__PURE__ */ l("span", { className: "widget-kpi__value", children: t }),
|
|
104
|
+
e && e.variance_pct != null && /* @__PURE__ */ _("div", { className: `widget-kpi__trend ${i}`, children: [
|
|
105
|
+
/* @__PURE__ */ _("span", { className: "widget-kpi__variance", children: [
|
|
106
|
+
s,
|
|
261
107
|
" ",
|
|
262
|
-
|
|
263
|
-
|
|
108
|
+
e.variance_pct > 0 ? "+" : "",
|
|
109
|
+
e.variance_pct.toFixed(1),
|
|
264
110
|
"%"
|
|
265
111
|
] }),
|
|
266
|
-
|
|
112
|
+
e.label && /* @__PURE__ */ l("span", { className: "widget-kpi__trend-label", children: e.label })
|
|
267
113
|
] })
|
|
268
114
|
] });
|
|
269
115
|
}
|
|
270
|
-
const
|
|
271
|
-
function
|
|
272
|
-
if (
|
|
273
|
-
if (
|
|
274
|
-
return `M ${
|
|
275
|
-
const
|
|
276
|
-
return `M ${
|
|
277
|
-
}
|
|
278
|
-
function
|
|
279
|
-
const
|
|
280
|
-
return
|
|
281
|
-
}
|
|
282
|
-
function
|
|
283
|
-
const
|
|
284
|
-
return /* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */ l("span", { className: "widget-gauge__label", children:
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */ l("path", { d:
|
|
289
|
-
|
|
116
|
+
const Ne = "var(--bg-elevated)";
|
|
117
|
+
function P(a, r, n, t) {
|
|
118
|
+
if (t <= 0) return "";
|
|
119
|
+
if (t >= 1)
|
|
120
|
+
return `M ${a - n} ${r} A ${n} ${n} 0 0 1 ${a} ${r - n} A ${n} ${n} 0 0 1 ${a + n} ${r}`;
|
|
121
|
+
const e = t * Math.PI, i = a - n * Math.cos(e), s = r - n * Math.sin(e);
|
|
122
|
+
return `M ${a - n} ${r} A ${n} ${n} 0 0 1 ${i} ${s}`;
|
|
123
|
+
}
|
|
124
|
+
function A(a) {
|
|
125
|
+
const r = Math.abs(a);
|
|
126
|
+
return r >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : a.toLocaleString("pt-BR");
|
|
127
|
+
}
|
|
128
|
+
function $e({ data: a, palette: r, label: n }) {
|
|
129
|
+
const t = n || String(a.label || ""), e = typeof a.value == "number" ? a.value : null, i = e != null ? A(e) : "-", s = String(a.formatted || "-"), c = typeof a.ratio == "number" ? a.ratio : 0, p = a.target_value, o = a.comparison_label, d = c >= 1, h = Math.min(Math.max(c, 0), 1), g = d ? "var(--action-green)" : c >= 0.7 ? r[0] || "var(--color-info)" : c >= 0.4 ? "var(--color-warning)" : "var(--color-error)", w = p != null ? A(p) : "-", u = 50, m = 50, $ = 44, f = 10;
|
|
130
|
+
return /* @__PURE__ */ _("div", { className: "widget widget-gauge", children: [
|
|
131
|
+
/* @__PURE__ */ l("span", { className: "widget-gauge__label", children: t }),
|
|
132
|
+
/* @__PURE__ */ _("div", { className: "widget-gauge__chart", children: [
|
|
133
|
+
/* @__PURE__ */ _("svg", { viewBox: "0 0 100 56", preserveAspectRatio: "xMidYMax meet", children: [
|
|
134
|
+
/* @__PURE__ */ l("path", { d: P(u, m, $, 1), fill: "none", stroke: Ne, strokeWidth: f, strokeLinecap: "butt" }),
|
|
135
|
+
h > 0 && /* @__PURE__ */ l("path", { d: P(u, m, $, h), fill: "none", stroke: g, strokeWidth: f, strokeLinecap: "butt" })
|
|
290
136
|
] }),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */ l("span", { className: "widget-gauge__percent", children:
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
|
|
137
|
+
/* @__PURE__ */ _("div", { className: "widget-gauge__center", children: [
|
|
138
|
+
/* @__PURE__ */ l("span", { className: "widget-gauge__percent", children: s }),
|
|
139
|
+
/* @__PURE__ */ _("span", { className: "widget-gauge__comparison", children: [
|
|
140
|
+
i,
|
|
295
141
|
" / ",
|
|
296
|
-
|
|
142
|
+
w
|
|
297
143
|
] }),
|
|
298
|
-
|
|
299
|
-
!
|
|
144
|
+
d && /* @__PURE__ */ l("span", { className: "widget-gauge__badge", children: o || "Meta batida" }),
|
|
145
|
+
!d && o && /* @__PURE__ */ l("span", { className: "widget-gauge__comparison", children: o })
|
|
300
146
|
] })
|
|
301
147
|
] })
|
|
302
148
|
] });
|
|
303
149
|
}
|
|
304
|
-
const
|
|
150
|
+
const O = { fontSize: 10, fill: "var(--text-muted)" }, ke = "var(--bg-elevated)", V = {
|
|
305
151
|
backgroundColor: "var(--bg-elevated)",
|
|
306
152
|
border: "1px solid var(--bg-paper)",
|
|
307
153
|
borderRadius: "6px",
|
|
308
154
|
color: "var(--text-primary)"
|
|
309
|
-
},
|
|
155
|
+
}, j = {
|
|
310
156
|
color: "var(--text-primary)",
|
|
311
157
|
fontWeight: 600
|
|
312
158
|
};
|
|
313
|
-
function
|
|
314
|
-
var
|
|
315
|
-
const n = Array.isArray(
|
|
316
|
-
return typeof
|
|
317
|
-
}
|
|
318
|
-
function
|
|
319
|
-
const [
|
|
320
|
-
return
|
|
321
|
-
const
|
|
322
|
-
if (!
|
|
323
|
-
const
|
|
324
|
-
const { width:
|
|
159
|
+
function K(a, r) {
|
|
160
|
+
var e;
|
|
161
|
+
const n = Array.isArray(r) ? r[0] : void 0, t = (e = n == null ? void 0 : n.payload) == null ? void 0 : e.tooltipLabel;
|
|
162
|
+
return typeof t == "string" && t ? t : String(a ?? "");
|
|
163
|
+
}
|
|
164
|
+
function Ce(a) {
|
|
165
|
+
const [r, n] = N({ width: 0, height: 0 });
|
|
166
|
+
return T(() => {
|
|
167
|
+
const t = a.current;
|
|
168
|
+
if (!t) return;
|
|
169
|
+
const e = new ResizeObserver(([i]) => {
|
|
170
|
+
const { width: s, height: c } = i.contentRect;
|
|
325
171
|
n(
|
|
326
|
-
(
|
|
172
|
+
(p) => p.width !== Math.floor(s) || p.height !== Math.floor(c) ? { width: Math.floor(s), height: Math.floor(c) } : p
|
|
327
173
|
);
|
|
328
174
|
});
|
|
329
|
-
return
|
|
330
|
-
}, [
|
|
331
|
-
}
|
|
332
|
-
function
|
|
333
|
-
return /* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */ l(
|
|
335
|
-
/* @__PURE__ */ l(
|
|
336
|
-
/* @__PURE__ */ l(
|
|
175
|
+
return e.observe(t), () => e.disconnect();
|
|
176
|
+
}, [a]), r;
|
|
177
|
+
}
|
|
178
|
+
function F({ Chart: a, chartData: r, xKey: n, series: t, palette: e, renderSeries: i, width: s, height: c }) {
|
|
179
|
+
return /* @__PURE__ */ _(a, { data: r, width: s, height: c, children: [
|
|
180
|
+
/* @__PURE__ */ l(ce, { strokeDasharray: "3 3", stroke: ke }),
|
|
181
|
+
/* @__PURE__ */ l(oe, { dataKey: n, tick: O }),
|
|
182
|
+
/* @__PURE__ */ l(de, { tick: O }),
|
|
337
183
|
/* @__PURE__ */ l(
|
|
338
|
-
|
|
184
|
+
W,
|
|
339
185
|
{
|
|
340
|
-
contentStyle:
|
|
341
|
-
labelStyle:
|
|
342
|
-
labelFormatter:
|
|
186
|
+
contentStyle: V,
|
|
187
|
+
labelStyle: j,
|
|
188
|
+
labelFormatter: K,
|
|
343
189
|
cursor: { fill: "var(--bg-paper)", opacity: 0.3 }
|
|
344
190
|
}
|
|
345
191
|
),
|
|
346
|
-
|
|
347
|
-
|
|
192
|
+
t.length > 1 && /* @__PURE__ */ l(he, {}),
|
|
193
|
+
t.map((p, o) => i(p, e[o % e.length], o))
|
|
348
194
|
] });
|
|
349
195
|
}
|
|
350
|
-
function
|
|
351
|
-
const
|
|
352
|
-
return c.length ? /* @__PURE__ */
|
|
353
|
-
|
|
354
|
-
/* @__PURE__ */ l("div", { ref:
|
|
355
|
-
var
|
|
356
|
-
if (
|
|
357
|
-
if (
|
|
358
|
-
return /* @__PURE__ */
|
|
196
|
+
function Se({ data: a, palette: r, label: n }) {
|
|
197
|
+
const t = String(a.chartType || "bar"), e = n || String(a.label || ""), i = String(a.xKey || "label"), s = a.series || [], c = a.data || [], p = M(null), { width: o, height: d } = Ce(p);
|
|
198
|
+
return c.length ? /* @__PURE__ */ _("div", { className: "widget widget-chart", children: [
|
|
199
|
+
e && /* @__PURE__ */ l("h4", { className: "widget-chart__title", children: e }),
|
|
200
|
+
/* @__PURE__ */ l("div", { ref: p, className: "widget-chart__container", children: (() => {
|
|
201
|
+
var w;
|
|
202
|
+
if (o <= 0 || d <= 0) return null;
|
|
203
|
+
if (t === "pie")
|
|
204
|
+
return /* @__PURE__ */ _(B, { width: o, height: d, children: [
|
|
359
205
|
/* @__PURE__ */ l(
|
|
360
|
-
|
|
206
|
+
ee,
|
|
361
207
|
{
|
|
362
208
|
data: c,
|
|
363
|
-
dataKey: ((
|
|
364
|
-
nameKey:
|
|
209
|
+
dataKey: ((w = s[0]) == null ? void 0 : w.key) || "s0",
|
|
210
|
+
nameKey: i,
|
|
365
211
|
cx: "50%",
|
|
366
212
|
cy: "50%",
|
|
367
213
|
outerRadius: "75%",
|
|
368
|
-
label: ({ name:
|
|
214
|
+
label: ({ name: u, percent: m }) => `${u}: ${(m * 100).toFixed(0)}%`,
|
|
369
215
|
labelLine: !1,
|
|
370
|
-
children: c.map((
|
|
216
|
+
children: c.map((u, m) => /* @__PURE__ */ l(te, { fill: r[m % r.length] }, m))
|
|
371
217
|
}
|
|
372
218
|
),
|
|
373
219
|
/* @__PURE__ */ l(
|
|
374
|
-
|
|
220
|
+
W,
|
|
375
221
|
{
|
|
376
|
-
contentStyle:
|
|
377
|
-
labelStyle:
|
|
378
|
-
labelFormatter:
|
|
222
|
+
contentStyle: V,
|
|
223
|
+
labelStyle: j,
|
|
224
|
+
labelFormatter: K
|
|
379
225
|
}
|
|
380
226
|
)
|
|
381
227
|
] });
|
|
382
|
-
const
|
|
383
|
-
return
|
|
384
|
-
|
|
228
|
+
const g = { chartData: c, xKey: i, series: s, palette: r, width: o, height: d };
|
|
229
|
+
return t === "line" ? /* @__PURE__ */ l(F, { ...g, Chart: ae, renderSeries: (u, m) => /* @__PURE__ */ l(
|
|
230
|
+
re,
|
|
385
231
|
{
|
|
386
232
|
type: "monotone",
|
|
387
|
-
dataKey:
|
|
388
|
-
name:
|
|
389
|
-
stroke:
|
|
233
|
+
dataKey: u.key,
|
|
234
|
+
name: u.label,
|
|
235
|
+
stroke: m,
|
|
390
236
|
strokeWidth: 2,
|
|
391
237
|
dot: c.length <= 31
|
|
392
238
|
},
|
|
393
|
-
|
|
394
|
-
) }) :
|
|
239
|
+
u.key
|
|
240
|
+
) }) : t === "area" ? /* @__PURE__ */ l(F, { ...g, Chart: le, renderSeries: (u, m) => /* @__PURE__ */ l(
|
|
395
241
|
ne,
|
|
396
242
|
{
|
|
397
243
|
type: "monotone",
|
|
398
|
-
dataKey:
|
|
399
|
-
name:
|
|
400
|
-
fill:
|
|
401
|
-
stroke:
|
|
244
|
+
dataKey: u.key,
|
|
245
|
+
name: u.label,
|
|
246
|
+
fill: m,
|
|
247
|
+
stroke: m,
|
|
402
248
|
fillOpacity: 0.3
|
|
403
249
|
},
|
|
404
|
-
|
|
405
|
-
) }) : /* @__PURE__ */ l(
|
|
250
|
+
u.key
|
|
251
|
+
) }) : /* @__PURE__ */ l(F, { ...g, Chart: ie, renderSeries: (u, m) => /* @__PURE__ */ l(
|
|
406
252
|
se,
|
|
407
253
|
{
|
|
408
|
-
dataKey:
|
|
409
|
-
name:
|
|
410
|
-
fill:
|
|
254
|
+
dataKey: u.key,
|
|
255
|
+
name: u.label,
|
|
256
|
+
fill: m,
|
|
411
257
|
radius: [3, 3, 0, 0]
|
|
412
258
|
},
|
|
413
|
-
|
|
259
|
+
u.key
|
|
414
260
|
) });
|
|
415
261
|
})() })
|
|
416
262
|
] }) : /* @__PURE__ */ l("div", { className: "widget widget-chart widget-chart--empty", children: "Sem dados" });
|
|
417
263
|
}
|
|
418
|
-
|
|
419
|
-
"
|
|
420
|
-
"
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
"Mai",
|
|
424
|
-
"Jun",
|
|
425
|
-
"Jul",
|
|
426
|
-
"Ago",
|
|
427
|
-
"Set",
|
|
428
|
-
"Out",
|
|
429
|
-
"Nov",
|
|
430
|
-
"Dez"
|
|
431
|
-
], nt = [
|
|
432
|
-
"Janeiro",
|
|
433
|
-
"Fevereiro",
|
|
434
|
-
"Marco",
|
|
435
|
-
"Abril",
|
|
436
|
-
"Maio",
|
|
437
|
-
"Junho",
|
|
438
|
-
"Julho",
|
|
439
|
-
"Agosto",
|
|
440
|
-
"Setembro",
|
|
441
|
-
"Outubro",
|
|
442
|
-
"Novembro",
|
|
443
|
-
"Dezembro"
|
|
444
|
-
];
|
|
445
|
-
function De(e) {
|
|
446
|
-
return { start: `${e}-01-01`, end: `${e}-12-31` };
|
|
447
|
-
}
|
|
448
|
-
function Ce(e) {
|
|
449
|
-
if (!e) return null;
|
|
450
|
-
const t = e.match(/^(\d{4})/);
|
|
451
|
-
return t ? { year: parseInt(t[1]) } : null;
|
|
452
|
-
}
|
|
453
|
-
function Ee(e, t) {
|
|
454
|
-
const n = new Date(e, t, 0).getDate(), r = (a) => String(a).padStart(2, "0");
|
|
455
|
-
return {
|
|
456
|
-
start: `${e}-${r(t)}-01`,
|
|
457
|
-
end: `${e}-${r(t)}-${r(n)}`
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
function q(e) {
|
|
461
|
-
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
|
|
462
|
-
t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
|
|
463
|
-
const n = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
464
|
-
return Math.ceil(((t.getTime() - n.getTime()) / 864e5 + 1) / 7);
|
|
465
|
-
}
|
|
466
|
-
function lt(e, t) {
|
|
467
|
-
const n = new Date(e, 0, 4), r = (n.getDay() + 6) % 7, a = new Date(n.getTime() - r * 864e5), s = new Date(a.getTime() + (t - 1) * 7 * 864e5), i = new Date(s.getTime() + 6 * 864e5), c = (u) => String(u).padStart(2, "0"), g = (u) => `${u.getFullYear()}-${c(u.getMonth() + 1)}-${c(u.getDate())}`;
|
|
468
|
-
return { start: g(s), end: g(i) };
|
|
469
|
-
}
|
|
470
|
-
function st(e, t) {
|
|
471
|
-
const n = /* @__PURE__ */ new Set(), r = new Date(e, t, 0).getDate();
|
|
472
|
-
for (let a = 1; a <= r; a++)
|
|
473
|
-
n.add(q(new Date(e, t - 1, a)));
|
|
474
|
-
return Array.from(n).sort((a, s) => a - s);
|
|
475
|
-
}
|
|
476
|
-
function A(e, t) {
|
|
477
|
-
const n = new Date(e, t, 0).getDate(), r = (c) => String(c).padStart(2, "0"), a = [];
|
|
478
|
-
let s = 1, i = 1;
|
|
479
|
-
for (; s <= n; ) {
|
|
480
|
-
const c = s, g = Math.min(s + 6, n), u = `${e}-${r(t)}-${r(c)}`, o = `${e}-${r(t)}-${r(g)}`, d = `${i}° Semana (${r(c)}/${r(t)} - ${r(g)}/${r(t)})`;
|
|
481
|
-
a.push({ index: i, startDay: c, endDay: g, start: u, end: o, label: d }), s = g + 1, i++;
|
|
482
|
-
}
|
|
483
|
-
return a;
|
|
484
|
-
}
|
|
485
|
-
function xe(e, t, n) {
|
|
486
|
-
if (!e) return 1;
|
|
487
|
-
const r = (i) => String(i).padStart(2, "0"), a = e.match(new RegExp(`^${t}-${r(n)}-(\\d{2})`));
|
|
488
|
-
if (!a) return 1;
|
|
489
|
-
const s = parseInt(a[1]);
|
|
490
|
-
return Math.ceil(s / 7);
|
|
491
|
-
}
|
|
492
|
-
function Q(e) {
|
|
493
|
-
if (!e) return null;
|
|
494
|
-
const t = e.match(/^(\d{4})-(\d{2})/);
|
|
495
|
-
return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
|
|
496
|
-
}
|
|
497
|
-
function it(e) {
|
|
498
|
-
if (!e) return null;
|
|
499
|
-
const t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
500
|
-
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: q(t) };
|
|
501
|
-
}
|
|
502
|
-
function I(e) {
|
|
503
|
-
const t = /* @__PURE__ */ new Date(), n = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, r = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), a = [];
|
|
504
|
-
for (let s = r; s >= n; s--) a.push(s);
|
|
505
|
-
return a;
|
|
506
|
-
}
|
|
507
|
-
function D(e) {
|
|
508
|
-
if (!e) return null;
|
|
509
|
-
const [t, n, r] = e.split("-").map(Number);
|
|
510
|
-
return !t || !n || !r ? null : new Date(t, n - 1, r);
|
|
511
|
-
}
|
|
512
|
-
function Me(e) {
|
|
513
|
-
if (!e) return "";
|
|
514
|
-
const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
515
|
-
return `${t}-${n}-${r}`;
|
|
516
|
-
}
|
|
517
|
-
function U({
|
|
518
|
-
value: e,
|
|
519
|
-
onChange: t,
|
|
520
|
-
minIso: n,
|
|
521
|
-
maxIso: r,
|
|
522
|
-
placeholder: a,
|
|
523
|
-
selectsStart: s,
|
|
524
|
-
selectsEnd: i,
|
|
525
|
-
startIso: c,
|
|
526
|
-
endIso: g,
|
|
527
|
-
className: u,
|
|
528
|
-
disabled: o
|
|
529
|
-
}) {
|
|
530
|
-
return /* @__PURE__ */ l("div", { className: `ddp-field ${u ?? ""}`, children: /* @__PURE__ */ l(
|
|
531
|
-
ue,
|
|
532
|
-
{
|
|
533
|
-
selected: D(e),
|
|
534
|
-
onChange: (d) => t(Me(d)),
|
|
535
|
-
selectsStart: s,
|
|
536
|
-
selectsEnd: i,
|
|
537
|
-
startDate: D(c) ?? void 0,
|
|
538
|
-
endDate: D(g) ?? void 0,
|
|
539
|
-
minDate: D(n) ?? void 0,
|
|
540
|
-
maxDate: D(r) ?? void 0,
|
|
541
|
-
dateFormat: "dd/MM/yyyy",
|
|
542
|
-
placeholderText: a ?? "Selecione...",
|
|
543
|
-
disabled: o,
|
|
544
|
-
portalId: "ddp-portal",
|
|
545
|
-
popperPlacement: "bottom-start",
|
|
546
|
-
popperModifiers: [
|
|
547
|
-
{
|
|
548
|
-
name: "flip",
|
|
549
|
-
options: { fallbackPlacements: ["bottom-end", "top-start", "top-end"] },
|
|
550
|
-
fn: (d) => d
|
|
551
|
-
}
|
|
552
|
-
]
|
|
553
|
-
}
|
|
554
|
-
) });
|
|
555
|
-
}
|
|
556
|
-
function Fe({ config: e, value: t, options: n = [], dateBounds: r, onChange: a }) {
|
|
557
|
-
const s = e.filterType || "select", i = e.label || "Filtro", c = e.dateFilterMode || "range";
|
|
558
|
-
return /* @__PURE__ */ m("div", { className: "widget-filter", children: [
|
|
559
|
-
/* @__PURE__ */ l("label", { className: "widget-filter__label", children: i }),
|
|
560
|
-
s === "date_range" ? c === "yearly" ? /* @__PURE__ */ l(Ae, { value: t, dateBounds: r, onChange: a }) : c === "monthly" ? /* @__PURE__ */ l(Oe, { value: t, dateBounds: r, onChange: a }) : c === "weekly" ? /* @__PURE__ */ l(Pe, { value: t, dateBounds: r, onChange: a }) : /* @__PURE__ */ l(Le, { value: t, dateBounds: r, onChange: a }) : /* @__PURE__ */ l(
|
|
264
|
+
function Re({ config: a, value: r, options: n = [], dateBounds: t, onChange: e }) {
|
|
265
|
+
const i = a.filterType || "select", s = a.label || "Filtro", c = a.dateFilterMode || "range";
|
|
266
|
+
return /* @__PURE__ */ _("div", { className: "widget-filter", children: [
|
|
267
|
+
/* @__PURE__ */ l("label", { className: "widget-filter__label", children: s }),
|
|
268
|
+
i === "date_range" ? c === "yearly" ? /* @__PURE__ */ l(Fe, { value: r, dateBounds: t, onChange: e }) : c === "monthly" ? /* @__PURE__ */ l(Me, { value: r, dateBounds: t, onChange: e }) : c === "weekly" ? /* @__PURE__ */ l(Te, { value: r, dateBounds: t, onChange: e }) : /* @__PURE__ */ l(xe, { value: r, dateBounds: t, onChange: e }) : /* @__PURE__ */ l(
|
|
561
269
|
Ie,
|
|
562
270
|
{
|
|
563
|
-
value:
|
|
271
|
+
value: r,
|
|
564
272
|
options: n,
|
|
565
|
-
multi:
|
|
566
|
-
onChange:
|
|
273
|
+
multi: i === "multi_select",
|
|
274
|
+
onChange: e
|
|
567
275
|
}
|
|
568
276
|
)
|
|
569
277
|
] });
|
|
570
278
|
}
|
|
571
|
-
function
|
|
572
|
-
const [
|
|
573
|
-
return /* @__PURE__ */
|
|
279
|
+
function xe({ value: a, dateBounds: r, onChange: n }) {
|
|
280
|
+
const [t, e] = a ? a.split("|") : ["", ""];
|
|
281
|
+
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
|
|
574
282
|
/* @__PURE__ */ l(
|
|
575
|
-
|
|
283
|
+
L,
|
|
576
284
|
{
|
|
577
|
-
value:
|
|
578
|
-
minIso:
|
|
579
|
-
maxIso:
|
|
285
|
+
value: t,
|
|
286
|
+
minIso: r == null ? void 0 : r.min,
|
|
287
|
+
maxIso: e || (r == null ? void 0 : r.max),
|
|
580
288
|
selectsStart: !0,
|
|
581
|
-
startIso:
|
|
582
|
-
endIso:
|
|
289
|
+
startIso: t,
|
|
290
|
+
endIso: e,
|
|
583
291
|
placeholder: "Data inicial",
|
|
584
|
-
onChange: (
|
|
292
|
+
onChange: (i) => n(`${i}|${e}`)
|
|
585
293
|
}
|
|
586
294
|
),
|
|
587
295
|
/* @__PURE__ */ l(
|
|
588
|
-
|
|
296
|
+
L,
|
|
589
297
|
{
|
|
590
|
-
value:
|
|
591
|
-
minIso:
|
|
592
|
-
maxIso:
|
|
298
|
+
value: e,
|
|
299
|
+
minIso: t || (r == null ? void 0 : r.min),
|
|
300
|
+
maxIso: r == null ? void 0 : r.max,
|
|
593
301
|
selectsEnd: !0,
|
|
594
|
-
startIso:
|
|
595
|
-
endIso:
|
|
302
|
+
startIso: t,
|
|
303
|
+
endIso: e,
|
|
596
304
|
placeholder: "Data final",
|
|
597
|
-
onChange: (
|
|
305
|
+
onChange: (i) => n(`${t}|${i}`)
|
|
598
306
|
}
|
|
599
307
|
)
|
|
600
308
|
] });
|
|
601
309
|
}
|
|
602
|
-
function
|
|
603
|
-
const [
|
|
604
|
-
const
|
|
605
|
-
n(`${
|
|
310
|
+
function Fe({ value: a, dateBounds: r, onChange: n }) {
|
|
311
|
+
const [t] = a ? a.split("|") : [""], e = z(t), i = /* @__PURE__ */ new Date(), s = (e == null ? void 0 : e.year) ?? i.getFullYear(), c = I(r), p = (o) => {
|
|
312
|
+
const d = U(o);
|
|
313
|
+
n(`${d.start}|${d.end}`);
|
|
606
314
|
};
|
|
607
315
|
return /* @__PURE__ */ l("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ l(
|
|
608
316
|
"select",
|
|
609
317
|
{
|
|
610
318
|
className: "widget-filter__select",
|
|
611
|
-
value:
|
|
612
|
-
onChange: (
|
|
613
|
-
children: c.map((
|
|
319
|
+
value: s,
|
|
320
|
+
onChange: (o) => p(parseInt(o.target.value)),
|
|
321
|
+
children: c.map((o) => /* @__PURE__ */ l("option", { value: o, children: o }, o))
|
|
614
322
|
}
|
|
615
323
|
) });
|
|
616
324
|
}
|
|
617
|
-
function
|
|
618
|
-
const [
|
|
619
|
-
const
|
|
620
|
-
n(`${
|
|
325
|
+
function Me({ value: a, dateBounds: r, onChange: n }) {
|
|
326
|
+
const [t] = a ? a.split("|") : [""], e = E(t), i = /* @__PURE__ */ new Date(), s = (e == null ? void 0 : e.year) ?? i.getFullYear(), c = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, p = I(r), o = (d, h) => {
|
|
327
|
+
const g = H(d, h);
|
|
328
|
+
n(`${g.start}|${g.end}`);
|
|
621
329
|
};
|
|
622
|
-
return /* @__PURE__ */
|
|
330
|
+
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--month", children: [
|
|
623
331
|
/* @__PURE__ */ l(
|
|
624
332
|
"select",
|
|
625
333
|
{
|
|
626
334
|
className: "widget-filter__select",
|
|
627
335
|
value: c,
|
|
628
|
-
onChange: (
|
|
629
|
-
children:
|
|
336
|
+
onChange: (d) => o(s, parseInt(d.target.value)),
|
|
337
|
+
children: D.map((d, h) => /* @__PURE__ */ l("option", { value: h + 1, children: d }, h + 1))
|
|
630
338
|
}
|
|
631
339
|
),
|
|
632
340
|
/* @__PURE__ */ l(
|
|
633
341
|
"select",
|
|
634
342
|
{
|
|
635
343
|
className: "widget-filter__select",
|
|
636
|
-
value:
|
|
637
|
-
onChange: (
|
|
638
|
-
children:
|
|
344
|
+
value: s,
|
|
345
|
+
onChange: (d) => o(parseInt(d.target.value), c),
|
|
346
|
+
children: p.map((d) => /* @__PURE__ */ l("option", { value: d, children: d }, d))
|
|
639
347
|
}
|
|
640
348
|
)
|
|
641
349
|
] });
|
|
642
350
|
}
|
|
643
|
-
function
|
|
644
|
-
const [
|
|
645
|
-
return /* @__PURE__ */
|
|
351
|
+
function Te({ value: a, dateBounds: r, onChange: n }) {
|
|
352
|
+
const [t] = a ? a.split("|") : [""], e = E(t), i = /* @__PURE__ */ new Date(), s = (e == null ? void 0 : e.year) ?? i.getFullYear(), c = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, p = I(r), o = x(s, c), d = X(t, s, c) || 1;
|
|
353
|
+
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
|
|
646
354
|
/* @__PURE__ */ l(
|
|
647
355
|
"select",
|
|
648
356
|
{
|
|
649
357
|
className: "widget-filter__select",
|
|
650
|
-
value:
|
|
651
|
-
onChange: (
|
|
652
|
-
const
|
|
653
|
-
|
|
358
|
+
value: s,
|
|
359
|
+
onChange: (h) => {
|
|
360
|
+
const g = parseInt(h.target.value), u = x(g, c)[0];
|
|
361
|
+
u && n(`${u.start}|${u.end}`);
|
|
654
362
|
},
|
|
655
|
-
children:
|
|
363
|
+
children: p.map((h) => /* @__PURE__ */ l("option", { value: h, children: h }, h))
|
|
656
364
|
}
|
|
657
365
|
),
|
|
658
366
|
/* @__PURE__ */ l(
|
|
@@ -660,423 +368,221 @@ function Pe({ value: e, dateBounds: t, onChange: n }) {
|
|
|
660
368
|
{
|
|
661
369
|
className: "widget-filter__select",
|
|
662
370
|
value: c,
|
|
663
|
-
onChange: (
|
|
664
|
-
const
|
|
665
|
-
|
|
371
|
+
onChange: (h) => {
|
|
372
|
+
const g = parseInt(h.target.value), u = x(s, g)[0];
|
|
373
|
+
u && n(`${u.start}|${u.end}`);
|
|
666
374
|
},
|
|
667
|
-
children:
|
|
375
|
+
children: D.map((h, g) => /* @__PURE__ */ l("option", { value: g + 1, children: h }, g + 1))
|
|
668
376
|
}
|
|
669
377
|
),
|
|
670
378
|
/* @__PURE__ */ l(
|
|
671
379
|
"select",
|
|
672
380
|
{
|
|
673
381
|
className: "widget-filter__select",
|
|
674
|
-
value:
|
|
675
|
-
onChange: (
|
|
676
|
-
const
|
|
677
|
-
|
|
382
|
+
value: d,
|
|
383
|
+
onChange: (h) => {
|
|
384
|
+
const g = o[parseInt(h.target.value) - 1];
|
|
385
|
+
g && n(`${g.start}|${g.end}`);
|
|
678
386
|
},
|
|
679
|
-
children:
|
|
387
|
+
children: o.map((h) => /* @__PURE__ */ l("option", { value: h.index, children: h.label }, h.index))
|
|
680
388
|
}
|
|
681
389
|
)
|
|
682
390
|
] });
|
|
683
391
|
}
|
|
684
|
-
function Ie({ value:
|
|
392
|
+
function Ie({ value: a, options: r, multi: n, onChange: t }) {
|
|
685
393
|
if (n) {
|
|
686
|
-
const
|
|
687
|
-
const c =
|
|
688
|
-
|
|
394
|
+
const e = a ? a.split(",") : [], i = (s) => {
|
|
395
|
+
const c = e.includes(s) ? e.filter((p) => p !== s) : [...e, s];
|
|
396
|
+
t(c.join(","));
|
|
689
397
|
};
|
|
690
|
-
return /* @__PURE__ */ l("div", { className: "widget-filter__multi", children:
|
|
398
|
+
return /* @__PURE__ */ l("div", { className: "widget-filter__multi", children: r.map((s) => /* @__PURE__ */ _("label", { className: "widget-filter__multi-option", children: [
|
|
691
399
|
/* @__PURE__ */ l(
|
|
692
400
|
"input",
|
|
693
401
|
{
|
|
694
402
|
type: "checkbox",
|
|
695
|
-
checked:
|
|
696
|
-
onChange: () => s
|
|
403
|
+
checked: e.includes(s),
|
|
404
|
+
onChange: () => i(s)
|
|
697
405
|
}
|
|
698
406
|
),
|
|
699
|
-
|
|
700
|
-
] },
|
|
407
|
+
s
|
|
408
|
+
] }, s)) });
|
|
701
409
|
}
|
|
702
|
-
return /* @__PURE__ */
|
|
410
|
+
return /* @__PURE__ */ _(
|
|
703
411
|
"select",
|
|
704
412
|
{
|
|
705
413
|
className: "widget-filter__select",
|
|
706
|
-
value:
|
|
707
|
-
onChange: (
|
|
414
|
+
value: a,
|
|
415
|
+
onChange: (e) => t(e.target.value),
|
|
708
416
|
children: [
|
|
709
417
|
/* @__PURE__ */ l("option", { value: "", children: "Todos" }),
|
|
710
|
-
|
|
418
|
+
r.map((e) => /* @__PURE__ */ l("option", { value: e, children: e }, e))
|
|
711
419
|
]
|
|
712
420
|
}
|
|
713
421
|
);
|
|
714
422
|
}
|
|
715
|
-
const
|
|
423
|
+
const Le = {
|
|
716
424
|
currency: "R$",
|
|
717
425
|
percentage: "%"
|
|
718
426
|
};
|
|
719
|
-
function
|
|
720
|
-
const
|
|
721
|
-
return /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */ l("label", { className: "widget-variable__label", children:
|
|
723
|
-
/* @__PURE__ */
|
|
427
|
+
function Pe({ config: a, value: r, onChange: n }) {
|
|
428
|
+
const t = a.label || "Variavel", e = a.locked || !1, i = a.variableFormat || "number", s = Le[i] || "";
|
|
429
|
+
return /* @__PURE__ */ _("div", { className: `widget-variable ${e ? "widget-variable--locked" : ""}`, children: [
|
|
430
|
+
/* @__PURE__ */ l("label", { className: "widget-variable__label", children: t }),
|
|
431
|
+
/* @__PURE__ */ _("div", { className: "widget-variable__input-wrapper", children: [
|
|
724
432
|
/* @__PURE__ */ l(
|
|
725
433
|
"input",
|
|
726
434
|
{
|
|
727
435
|
className: "widget-variable__input",
|
|
728
436
|
type: "number",
|
|
729
|
-
value:
|
|
437
|
+
value: r,
|
|
730
438
|
onChange: (c) => n(parseFloat(c.target.value) || 0),
|
|
731
|
-
disabled:
|
|
732
|
-
step:
|
|
439
|
+
disabled: e,
|
|
440
|
+
step: i === "integer" ? 1 : 0.01
|
|
733
441
|
}
|
|
734
442
|
),
|
|
735
|
-
|
|
443
|
+
s && /* @__PURE__ */ l("span", { className: "widget-variable__suffix", children: s })
|
|
736
444
|
] }),
|
|
737
|
-
|
|
445
|
+
e && /* @__PURE__ */ l("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
738
446
|
] });
|
|
739
447
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
_
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
];
|
|
747
|
-
function Ue(e) {
|
|
748
|
-
if (!e) return !0;
|
|
749
|
-
const t = C(e);
|
|
750
|
-
return Object.values(M).some(
|
|
751
|
-
(n) => JSON.stringify(n.colors) === JSON.stringify(t)
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
const Ge = [
|
|
755
|
-
{ label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
|
|
756
|
-
{ label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
|
|
757
|
-
{ label: "Estados", slots: ["accent", "success", "error"] }
|
|
758
|
-
];
|
|
759
|
-
function je({
|
|
760
|
-
selected: e,
|
|
761
|
-
onSelect: t,
|
|
762
|
-
customMode: n,
|
|
763
|
-
onCustomModeChange: r,
|
|
764
|
-
disabled: a
|
|
765
|
-
}) {
|
|
766
|
-
var u;
|
|
767
|
-
const s = n ?? !Ue(e), i = C(e), c = s || (u = Object.entries(M).find(
|
|
768
|
-
([, o]) => JSON.stringify(o.colors) === JSON.stringify(i)
|
|
769
|
-
)) == null ? void 0 : u[0], g = (o, d) => {
|
|
770
|
-
const f = [...i];
|
|
771
|
-
for (; f.length < x; ) f.push("#000000");
|
|
772
|
-
f[o] = d, t(f);
|
|
773
|
-
};
|
|
774
|
-
return /* @__PURE__ */ m("div", { className: `palette-selector ${a ? "palette-selector--disabled" : ""}`, children: [
|
|
775
|
-
r && /* @__PURE__ */ m("label", { className: "config-panel__checkbox", children: [
|
|
776
|
-
/* @__PURE__ */ l(
|
|
777
|
-
"input",
|
|
778
|
-
{
|
|
779
|
-
type: "checkbox",
|
|
780
|
-
checked: s,
|
|
781
|
-
onChange: (o) => r(o.target.checked),
|
|
782
|
-
disabled: a
|
|
783
|
-
}
|
|
784
|
-
),
|
|
785
|
-
"Customizar"
|
|
786
|
-
] }),
|
|
787
|
-
s ? /* @__PURE__ */ l("div", { className: "palette-selector__custom", children: Ge.map((o) => /* @__PURE__ */ m("div", { className: "palette-selector__row", children: [
|
|
788
|
-
/* @__PURE__ */ l("span", { className: "palette-selector__row-label", children: o.label }),
|
|
789
|
-
/* @__PURE__ */ l("div", { className: "palette-selector__row-slots", children: o.slots.map((d) => {
|
|
790
|
-
const f = _[d];
|
|
791
|
-
return /* @__PURE__ */ l(
|
|
792
|
-
"input",
|
|
793
|
-
{
|
|
794
|
-
type: "color",
|
|
795
|
-
className: "palette-selector__color-input",
|
|
796
|
-
value: i[f] || "#000000",
|
|
797
|
-
onChange: (v) => g(f, v.target.value),
|
|
798
|
-
disabled: a,
|
|
799
|
-
title: ve[d]
|
|
800
|
-
},
|
|
801
|
-
d
|
|
802
|
-
);
|
|
803
|
-
}) })
|
|
804
|
-
] }, o.label)) }) : /* @__PURE__ */ l("div", { className: "palette-selector__options", children: Object.entries(M).map(([o, d]) => {
|
|
805
|
-
const f = C(d.colors);
|
|
806
|
-
return /* @__PURE__ */ m(
|
|
807
|
-
"button",
|
|
808
|
-
{
|
|
809
|
-
className: `palette-selector__option ${c === o ? "palette-selector__option--active" : ""}`,
|
|
810
|
-
onClick: () => t(d.colors),
|
|
811
|
-
disabled: a,
|
|
812
|
-
children: [
|
|
813
|
-
/* @__PURE__ */ l("div", { className: "palette-selector__bar", children: K(d.colors).map((v, h) => /* @__PURE__ */ l(
|
|
814
|
-
"span",
|
|
815
|
-
{
|
|
816
|
-
className: "palette-selector__swatch",
|
|
817
|
-
style: { backgroundColor: v }
|
|
818
|
-
},
|
|
819
|
-
h
|
|
820
|
-
)) }),
|
|
821
|
-
/* @__PURE__ */ l("div", { className: "palette-selector__bar palette-selector__bar--theme", children: We.map((v, h) => /* @__PURE__ */ l(
|
|
822
|
-
"span",
|
|
823
|
-
{
|
|
824
|
-
className: "palette-selector__swatch",
|
|
825
|
-
style: { backgroundColor: f[v] }
|
|
826
|
-
},
|
|
827
|
-
h
|
|
828
|
-
)) }),
|
|
829
|
-
/* @__PURE__ */ l("span", { className: "palette-selector__label", children: d.label })
|
|
830
|
-
]
|
|
831
|
-
},
|
|
832
|
-
o
|
|
833
|
-
);
|
|
834
|
-
}) })
|
|
448
|
+
function Ae({ config: a, palette: r, onChange: n }) {
|
|
449
|
+
const t = a.label || "Cores", e = a.locked || !1;
|
|
450
|
+
return /* @__PURE__ */ _("div", { className: `widget-palette ${e ? "widget-palette--locked" : ""}`, children: [
|
|
451
|
+
/* @__PURE__ */ l("label", { className: "widget-palette__label", children: t }),
|
|
452
|
+
/* @__PURE__ */ l(q, { selected: r, onSelect: n, customMode: !0, disabled: e }),
|
|
453
|
+
e && /* @__PURE__ */ l("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
835
454
|
] });
|
|
836
455
|
}
|
|
837
|
-
function
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
/* @__PURE__ */ l("label", { className: "widget-palette__label", children: r }),
|
|
841
|
-
/* @__PURE__ */ l(je, { selected: t, onSelect: n, customMode: !0, disabled: a }),
|
|
842
|
-
a && /* @__PURE__ */ l("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
843
|
-
] });
|
|
844
|
-
}
|
|
845
|
-
function Ke({
|
|
846
|
-
type: e,
|
|
847
|
-
computed: t,
|
|
456
|
+
function Oe({
|
|
457
|
+
type: a,
|
|
458
|
+
computed: r,
|
|
848
459
|
palette: n,
|
|
849
|
-
config:
|
|
850
|
-
filterValue:
|
|
851
|
-
filterOptions:
|
|
852
|
-
dateBounds:
|
|
460
|
+
config: t,
|
|
461
|
+
filterValue: e,
|
|
462
|
+
filterOptions: i,
|
|
463
|
+
dateBounds: s,
|
|
853
464
|
onFilterChange: c,
|
|
854
|
-
variableValue:
|
|
855
|
-
onVariableChange:
|
|
856
|
-
onPaletteChange:
|
|
465
|
+
variableValue: p,
|
|
466
|
+
onVariableChange: o,
|
|
467
|
+
onPaletteChange: d
|
|
857
468
|
}) {
|
|
858
|
-
if (
|
|
859
|
-
return /* @__PURE__ */ l("div", { className: "widget widget--error", children: /* @__PURE__ */ l("span", { className: "widget__error-text", children: String(
|
|
860
|
-
const
|
|
861
|
-
switch (
|
|
469
|
+
if (r.error)
|
|
470
|
+
return /* @__PURE__ */ l("div", { className: "widget widget--error", children: /* @__PURE__ */ l("span", { className: "widget__error-text", children: String(r.error) }) });
|
|
471
|
+
const h = J(n);
|
|
472
|
+
switch (a) {
|
|
862
473
|
case "kpi_card":
|
|
863
|
-
return /* @__PURE__ */ l(ye, { data:
|
|
474
|
+
return /* @__PURE__ */ l(ye, { data: r, label: t == null ? void 0 : t.label });
|
|
864
475
|
case "gauge":
|
|
865
|
-
return /* @__PURE__ */ l(
|
|
476
|
+
return /* @__PURE__ */ l($e, { data: r, palette: h, label: t == null ? void 0 : t.label });
|
|
866
477
|
case "chart":
|
|
867
|
-
return /* @__PURE__ */ l(
|
|
478
|
+
return /* @__PURE__ */ l(Se, { data: r, palette: h, label: t == null ? void 0 : t.label });
|
|
868
479
|
case "filter":
|
|
869
|
-
return
|
|
870
|
-
|
|
480
|
+
return t && c ? /* @__PURE__ */ l(
|
|
481
|
+
Re,
|
|
871
482
|
{
|
|
872
|
-
config:
|
|
873
|
-
value:
|
|
874
|
-
options:
|
|
875
|
-
dateBounds:
|
|
483
|
+
config: t,
|
|
484
|
+
value: e || "",
|
|
485
|
+
options: i,
|
|
486
|
+
dateBounds: s,
|
|
876
487
|
onChange: c
|
|
877
488
|
}
|
|
878
489
|
) : null;
|
|
879
490
|
case "variable": {
|
|
880
|
-
const
|
|
881
|
-
return
|
|
882
|
-
|
|
491
|
+
const g = t;
|
|
492
|
+
return g && o ? /* @__PURE__ */ l(
|
|
493
|
+
Pe,
|
|
883
494
|
{
|
|
884
|
-
config:
|
|
885
|
-
value:
|
|
886
|
-
onChange:
|
|
495
|
+
config: g,
|
|
496
|
+
value: p ?? g.variableValue ?? 0,
|
|
497
|
+
onChange: o
|
|
887
498
|
}
|
|
888
499
|
) : null;
|
|
889
500
|
}
|
|
890
501
|
case "color_palette":
|
|
891
|
-
return
|
|
892
|
-
|
|
502
|
+
return t && d ? /* @__PURE__ */ l(
|
|
503
|
+
Ae,
|
|
893
504
|
{
|
|
894
|
-
config:
|
|
505
|
+
config: t,
|
|
895
506
|
palette: n,
|
|
896
|
-
onChange:
|
|
507
|
+
onChange: d
|
|
897
508
|
}
|
|
898
509
|
) : null;
|
|
899
510
|
default:
|
|
900
|
-
return /* @__PURE__ */
|
|
511
|
+
return /* @__PURE__ */ _("div", { className: "widget", children: [
|
|
901
512
|
"Widget: ",
|
|
902
|
-
|
|
513
|
+
a
|
|
903
514
|
] });
|
|
904
515
|
}
|
|
905
516
|
}
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
variable: "Variável",
|
|
916
|
-
color_palette: "Paleta de Cores"
|
|
917
|
-
}, dt = ["kpi_card", "gauge", "chart"], ut = ["filter", "variable", "color_palette"], Xe = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), gt = {
|
|
918
|
-
sum: "Soma",
|
|
919
|
-
avg: "Média",
|
|
920
|
-
count: "Contagem",
|
|
921
|
-
min: "Mínimo",
|
|
922
|
-
max: "Máximo",
|
|
923
|
-
count_distinct: "Contagem Distinta"
|
|
924
|
-
}, qe = {
|
|
925
|
-
currency: "Moeda (R$)",
|
|
926
|
-
number: "Número",
|
|
927
|
-
integer: "Inteiro",
|
|
928
|
-
percentage: "Porcentagem",
|
|
929
|
-
date: "Data",
|
|
930
|
-
text: "Texto"
|
|
931
|
-
}, ft = Object.entries(qe).filter(([e]) => e !== "date" && e !== "text"), ht = {
|
|
932
|
-
yoy: "vs Ano Anterior",
|
|
933
|
-
mom: "vs Mês Anterior",
|
|
934
|
-
target: "vs Meta",
|
|
935
|
-
none: "Nenhuma"
|
|
936
|
-
}, mt = {
|
|
937
|
-
bar: "Barras",
|
|
938
|
-
line: "Linhas",
|
|
939
|
-
area: "Área",
|
|
940
|
-
pie: "Pizza"
|
|
941
|
-
}, pt = {
|
|
942
|
-
date_range: "Periodo",
|
|
943
|
-
select: "Seleção Única",
|
|
944
|
-
multi_select: "Seleção Múltipla"
|
|
945
|
-
}, _t = {
|
|
946
|
-
kpi_card: { x: 0, y: 0, w: 6, h: 3 },
|
|
947
|
-
gauge: { x: 0, y: 0, w: 6, h: 5 },
|
|
948
|
-
chart: { x: 0, y: 0, w: 6, h: 6 },
|
|
949
|
-
filter: { x: 0, y: 0, w: 4, h: 2 },
|
|
950
|
-
variable: { x: 0, y: 0, w: 4, h: 2 },
|
|
951
|
-
color_palette: { x: 0, y: 0, w: 4, h: 2 }
|
|
952
|
-
}, bt = {
|
|
953
|
-
kpi_card: { label: "Novo KPI", aggregation: "sum", format: "number" },
|
|
954
|
-
gauge: { label: "Novo Gauge", aggregation: "sum" },
|
|
955
|
-
chart: { label: "Novo Grafico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
|
|
956
|
-
filter: { label: "Novo Filtro", filterType: "select" },
|
|
957
|
-
variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
|
|
958
|
-
color_palette: { label: "Paleta de Cores", paletteColors: ze, locked: !1 }
|
|
959
|
-
}, Qe = 40, Ze = 6;
|
|
960
|
-
function vt(e) {
|
|
961
|
-
const { rowHeight: t = Qe, gridGap: n = Ze, className: r } = e, a = G(() => "fetcher" in e && e.fetcher ? e.fetcher : fe({ apiUrl: e.apiUrl, token: e.token }), [
|
|
962
|
-
"fetcher" in e ? e.fetcher : null,
|
|
963
|
-
"apiUrl" in e ? e.apiUrl : null,
|
|
964
|
-
"token" in e ? e.token : null
|
|
965
|
-
]), {
|
|
966
|
-
layout: s,
|
|
517
|
+
const Ee = 40, De = 6;
|
|
518
|
+
function Ke({
|
|
519
|
+
token: a,
|
|
520
|
+
rowHeight: r = Ee,
|
|
521
|
+
gridGap: n = De,
|
|
522
|
+
className: t
|
|
523
|
+
}) {
|
|
524
|
+
const {
|
|
525
|
+
layout: e,
|
|
967
526
|
renderData: i,
|
|
968
|
-
loading:
|
|
969
|
-
error:
|
|
970
|
-
filters:
|
|
527
|
+
loading: s,
|
|
528
|
+
error: c,
|
|
529
|
+
filters: p,
|
|
971
530
|
variables: o,
|
|
972
531
|
palette: d,
|
|
973
|
-
setFilter:
|
|
974
|
-
setVariable:
|
|
975
|
-
setPalette:
|
|
976
|
-
} =
|
|
977
|
-
if (
|
|
978
|
-
return /* @__PURE__ */ l("div", { className: `preview-tab ${
|
|
979
|
-
if (!
|
|
980
|
-
return /* @__PURE__ */ l("div", { className: `preview-tab ${
|
|
981
|
-
if (
|
|
982
|
-
return /* @__PURE__ */ l("div", { className: `preview-tab ${
|
|
983
|
-
const
|
|
532
|
+
setFilter: h,
|
|
533
|
+
setVariable: g,
|
|
534
|
+
setPalette: w
|
|
535
|
+
} = be(a);
|
|
536
|
+
if (c && !e)
|
|
537
|
+
return /* @__PURE__ */ l("div", { className: `preview-tab ${t ?? ""}`, children: /* @__PURE__ */ l("div", { className: "preview-tab__error", children: c }) });
|
|
538
|
+
if (!e)
|
|
539
|
+
return /* @__PURE__ */ l("div", { className: `preview-tab ${t ?? ""}`, children: /* @__PURE__ */ l("div", { className: "preview-tab__loading", children: "Carregando dashboard..." }) });
|
|
540
|
+
if (e.widgets.length === 0)
|
|
541
|
+
return /* @__PURE__ */ l("div", { className: `preview-tab ${t ?? ""}`, children: /* @__PURE__ */ l("div", { className: "preview-tab__empty", children: "Este dashboard nao possui widgets." }) });
|
|
542
|
+
const u = (i == null ? void 0 : i.widgets) ?? {}, m = (i == null ? void 0 : i.date_bounds) ?? null, $ = {
|
|
984
543
|
display: "grid",
|
|
985
|
-
gridTemplateColumns: `repeat(${
|
|
986
|
-
gridTemplateRows: `repeat(${
|
|
544
|
+
gridTemplateColumns: `repeat(${e.gridColumns}, 1fr)`,
|
|
545
|
+
gridTemplateRows: `repeat(${e.gridRows}, ${r}px)`,
|
|
987
546
|
gap: `${n}px`,
|
|
988
|
-
|
|
989
|
-
...we(d)
|
|
547
|
+
...Q(d)
|
|
990
548
|
};
|
|
991
|
-
return /* @__PURE__ */
|
|
992
|
-
|
|
993
|
-
i && /* @__PURE__ */ l("div", { className: "preview-tab__grid", style: $, children:
|
|
994
|
-
const
|
|
995
|
-
gridColumn: `${
|
|
996
|
-
gridRow: `${
|
|
997
|
-
},
|
|
549
|
+
return /* @__PURE__ */ _("div", { className: `preview-tab ${t ?? ""}`, children: [
|
|
550
|
+
c && !i && /* @__PURE__ */ l("div", { className: "preview-tab__error", children: c }),
|
|
551
|
+
i && /* @__PURE__ */ l("div", { className: "preview-tab__grid", style: $, children: e.widgets.map((f) => {
|
|
552
|
+
const C = Z.has(f.type), y = u[f.id], S = {
|
|
553
|
+
gridColumn: `${f.grid.x + 1} / span ${f.grid.w}`,
|
|
554
|
+
gridRow: `${f.grid.y + 1} / span ${f.grid.h}`
|
|
555
|
+
}, v = f.type === "variable" ? o[f.id] ?? (y == null ? void 0 : y.value) ?? f.config.variableValue ?? 0 : void 0;
|
|
998
556
|
return /* @__PURE__ */ l(
|
|
999
557
|
"div",
|
|
1000
558
|
{
|
|
1001
|
-
className: `preview-tab__widget ${
|
|
1002
|
-
style:
|
|
1003
|
-
children:
|
|
1004
|
-
|
|
559
|
+
className: `preview-tab__widget ${C ? "preview-tab__widget--control" : ""}`,
|
|
560
|
+
style: S,
|
|
561
|
+
children: C || y ? /* @__PURE__ */ l(
|
|
562
|
+
Oe,
|
|
1005
563
|
{
|
|
1006
|
-
type:
|
|
1007
|
-
computed:
|
|
564
|
+
type: f.type,
|
|
565
|
+
computed: y || {},
|
|
1008
566
|
palette: d,
|
|
1009
|
-
config:
|
|
1010
|
-
filterValue:
|
|
1011
|
-
filterOptions: (
|
|
1012
|
-
dateBounds:
|
|
1013
|
-
onFilterChange: (
|
|
1014
|
-
variableValue:
|
|
1015
|
-
onVariableChange: (
|
|
1016
|
-
onPaletteChange:
|
|
567
|
+
config: f.config,
|
|
568
|
+
filterValue: p[f.id] || "",
|
|
569
|
+
filterOptions: (y == null ? void 0 : y.available_values) || [],
|
|
570
|
+
dateBounds: m,
|
|
571
|
+
onFilterChange: (b) => h(f.id, b),
|
|
572
|
+
variableValue: v,
|
|
573
|
+
onVariableChange: (b) => g(f.id, b),
|
|
574
|
+
onPaletteChange: w
|
|
1017
575
|
}
|
|
1018
|
-
) : /* @__PURE__ */ l("div", { className: "preview-tab__widget-loading", children:
|
|
576
|
+
) : /* @__PURE__ */ l("div", { className: "preview-tab__widget-loading", children: s ? "Carregando..." : "Sem dados" })
|
|
1019
577
|
},
|
|
1020
|
-
|
|
578
|
+
f.id
|
|
1021
579
|
);
|
|
1022
580
|
}) }),
|
|
1023
|
-
|
|
581
|
+
s && i && /* @__PURE__ */ l("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
|
|
1024
582
|
] });
|
|
1025
583
|
}
|
|
1026
584
|
export {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
mt as CHART_TYPE_LABELS,
|
|
1030
|
-
ht as COMPARISON_LABELS,
|
|
1031
|
-
Xe as CONTROL_WIDGET_SET,
|
|
1032
|
-
ut as CONTROL_WIDGET_TYPES,
|
|
1033
|
-
$e as ChartWidget,
|
|
1034
|
-
je as ColorPaletteSelector,
|
|
1035
|
-
Ve as ColorPaletteWidget,
|
|
1036
|
-
dt as DATA_WIDGET_TYPES,
|
|
1037
|
-
bt as DEFAULT_CONFIG,
|
|
1038
|
-
_t as DEFAULT_GRID,
|
|
1039
|
-
Je as DEFAULT_GRID_COLUMNS,
|
|
1040
|
-
He as DEFAULT_GRID_ROWS,
|
|
1041
|
-
ze as DEFAULT_PALETTE,
|
|
1042
|
-
V as DEFAULT_PALETTE_COLORS,
|
|
1043
|
-
rt as DEFAULT_PALETTE_KEY,
|
|
1044
|
-
vt as Dashboard,
|
|
1045
|
-
U as DashboardDatePicker,
|
|
1046
|
-
ct as EMPTY_LAYOUT,
|
|
1047
|
-
pt as FILTER_TYPE_LABELS,
|
|
1048
|
-
qe as FORMAT_LABELS,
|
|
1049
|
-
Fe as FilterWidget,
|
|
1050
|
-
Ne as GaugeWidget,
|
|
1051
|
-
ye as KPIWidget,
|
|
1052
|
-
nt as MONTH_NAMES_FULL,
|
|
1053
|
-
X as MONTH_NAMES_SHORT,
|
|
1054
|
-
ft as NUMERIC_FORMAT_OPTIONS,
|
|
1055
|
-
M as PALETTES,
|
|
1056
|
-
be as SERIES_COUNT,
|
|
1057
|
-
_ as SLOT_INDEX,
|
|
1058
|
-
ve as SLOT_LABELS,
|
|
1059
|
-
x as TOTAL_SLOTS,
|
|
1060
|
-
Ye as VariableWidget,
|
|
1061
|
-
ot as WIDGET_TYPE_LABELS,
|
|
1062
|
-
Ke as WidgetRenderer,
|
|
1063
|
-
fe as createTokenFetcher,
|
|
1064
|
-
Me as dateToIso,
|
|
1065
|
-
C as ensurePaletteShape,
|
|
1066
|
-
De as getFullYearRange,
|
|
1067
|
-
q as getISOWeek,
|
|
1068
|
-
Ee as getMonthRange,
|
|
1069
|
-
A as getMonthWeeks,
|
|
1070
|
-
we as getPaletteCssVars,
|
|
1071
|
-
K as getSeries,
|
|
1072
|
-
lt as getWeekRange,
|
|
1073
|
-
st as getWeeksInMonth,
|
|
1074
|
-
I as getYearRange,
|
|
1075
|
-
D as isoToDate,
|
|
1076
|
-
Q as parseMonthFromRange,
|
|
1077
|
-
xe as parseMonthWeekFromRange,
|
|
1078
|
-
it as parseWeekFromRange,
|
|
1079
|
-
Ce as parseYearFromRange,
|
|
1080
|
-
me as useDashboardData
|
|
585
|
+
pe as ApiError,
|
|
586
|
+
Ke as Dashboard
|
|
1081
587
|
};
|
|
1082
588
|
//# sourceMappingURL=index.js.map
|