@actionexec/dashboards 0.5.4 → 0.6.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-Bsda66uL.js +665 -0
- package/dist/ColorPaletteSelector-Bsda66uL.js.map +1 -0
- package/dist/components/SearchableSelect.d.ts +1 -2
- package/dist/index.js +376 -310
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +2 -2
- package/dist/internals.js +28 -27
- package/dist/styles.css +1 -1
- package/dist/types/index.d.ts +33 -6
- package/dist/widgets/TableWidget.d.ts +6 -0
- package/package.json +8 -2
- package/dist/index-BXIn44vr.js +0 -603
- package/dist/index-BXIn44vr.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { jsxs as _, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { PieChart as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const [
|
|
1
|
+
import { jsxs as _, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useRef as F, useEffect as T, useCallback as R, useMemo as j } from "react";
|
|
3
|
+
import { Q as z, R as U, n as L, L as H, G as I, I as D, m as P, w as M, J as X, k as A, q, v as Q, t as J, d as Z, y as B, x as ee, b as te } from "./ColorPaletteSelector-Bsda66uL.js";
|
|
4
|
+
import { U as Ue } from "./ColorPaletteSelector-Bsda66uL.js";
|
|
5
|
+
import { PieChart as ae, Pie as re, Cell as le, Tooltip as Y, LineChart as ne, Line as ie, AreaChart as se, Area as ce, BarChart as oe, Bar as de, CartesianGrid as ge, XAxis as he, YAxis as ue, Legend as me } from "recharts";
|
|
6
|
+
const _e = 300;
|
|
7
|
+
function be(t) {
|
|
8
|
+
const [l, n] = k(null), [r, e] = k(null), [i, c] = k({}), [s, m] = k({}), [g, o] = k(null), [d, h] = k(!0), [w, u] = k(null), b = F(), y = F(!1);
|
|
9
9
|
T(() => {
|
|
10
10
|
let v = !1;
|
|
11
|
-
return
|
|
11
|
+
return z(t).then((f) => {
|
|
12
12
|
v || n(f);
|
|
13
13
|
}).catch((f) => {
|
|
14
|
-
v ||
|
|
14
|
+
v || u(f.message);
|
|
15
15
|
}), () => {
|
|
16
16
|
v = !0;
|
|
17
17
|
};
|
|
18
|
-
}, [
|
|
19
|
-
if (
|
|
20
|
-
return
|
|
21
|
-
const v =
|
|
22
|
-
|
|
23
|
-
e(f), !
|
|
24
|
-
}).catch((f) =>
|
|
25
|
-
},
|
|
26
|
-
|
|
18
|
+
}, [t]), T(() => {
|
|
19
|
+
if (l)
|
|
20
|
+
return b.current && clearTimeout(b.current), b.current = setTimeout(() => {
|
|
21
|
+
const v = pe(i, s);
|
|
22
|
+
h(!0), U(t, v).then((f) => {
|
|
23
|
+
e(f), !y.current && f.applied && (y.current = !0, c(($) => ({ ...fe(f.applied), ...$ }))), u(null);
|
|
24
|
+
}).catch((f) => u(f.message)).finally(() => h(!1));
|
|
25
|
+
}, _e), () => {
|
|
26
|
+
b.current && clearTimeout(b.current);
|
|
27
27
|
};
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
28
|
+
}, [t, l, i, s]);
|
|
29
|
+
const p = R((v, f) => {
|
|
30
30
|
c(($) => ({ ...$, [v]: f }));
|
|
31
|
-
}, []), S =
|
|
31
|
+
}, []), S = R((v, f) => {
|
|
32
32
|
m(($) => ({ ...$, [v]: f }));
|
|
33
|
-
}, []),
|
|
34
|
-
|
|
33
|
+
}, []), N = R((v) => {
|
|
34
|
+
o(v);
|
|
35
35
|
}, []), C = j(
|
|
36
|
-
() =>
|
|
37
|
-
[
|
|
36
|
+
() => g ?? (l == null ? void 0 : l.palette) ?? [],
|
|
37
|
+
[g, l]
|
|
38
38
|
);
|
|
39
39
|
return {
|
|
40
|
-
layout:
|
|
41
|
-
renderData:
|
|
42
|
-
loading:
|
|
40
|
+
layout: l,
|
|
41
|
+
renderData: r,
|
|
42
|
+
loading: d,
|
|
43
43
|
error: w,
|
|
44
44
|
filters: i,
|
|
45
45
|
variables: s,
|
|
46
46
|
palette: C,
|
|
47
|
-
setFilter:
|
|
47
|
+
setFilter: p,
|
|
48
48
|
setVariable: S,
|
|
49
|
-
setPalette:
|
|
49
|
+
setPalette: N
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function pe(t, l) {
|
|
53
53
|
const n = {};
|
|
54
|
-
for (const [
|
|
54
|
+
for (const [r, e] of Object.entries(t))
|
|
55
55
|
if (e.includes("|")) {
|
|
56
56
|
const [i, c] = e.split("|");
|
|
57
57
|
i && (n.f_date_start = i), c && (n.f_date_end = c);
|
|
58
58
|
} else
|
|
59
|
-
n[`f_${
|
|
60
|
-
for (const [
|
|
61
|
-
n[`v_${
|
|
59
|
+
n[`f_${r}`] = e;
|
|
60
|
+
for (const [r, e] of Object.entries(l))
|
|
61
|
+
n[`v_${r}`] = String(e);
|
|
62
62
|
return n;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
for (const [n,
|
|
67
|
-
if (
|
|
68
|
-
const e =
|
|
69
|
-
|
|
70
|
-
} else Array.isArray(
|
|
71
|
-
return
|
|
64
|
+
function fe(t) {
|
|
65
|
+
const l = {};
|
|
66
|
+
for (const [n, r] of Object.entries(t))
|
|
67
|
+
if (r && typeof r == "object" && "start" in r) {
|
|
68
|
+
const e = r;
|
|
69
|
+
l[n] = `${e.start || ""}|${e.end || ""}`;
|
|
70
|
+
} else Array.isArray(r) ? l[n] = r.join(L) : typeof r == "string" && (l[n] = r);
|
|
71
|
+
return l;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const n =
|
|
73
|
+
function we({ data: t, label: l }) {
|
|
74
|
+
const n = l || String(t.label || ""), r = String(t.formatted || "-"), e = t.comparison, i = (e == null ? void 0 : e.trend) === "up" ? "widget-kpi__trend--up" : (e == null ? void 0 : e.trend) === "down" ? "widget-kpi__trend--down" : "", c = (e == null ? void 0 : e.trend) === "up" ? "↑" : (e == null ? void 0 : e.trend) === "down" ? "↓" : "";
|
|
75
75
|
return /* @__PURE__ */ _("div", { className: "widget widget-kpi", children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ a("span", { className: "widget-kpi__label", children: n }),
|
|
77
|
+
/* @__PURE__ */ a("span", { className: "widget-kpi__value", children: r }),
|
|
78
78
|
e && e.variance_pct != null && /* @__PURE__ */ _("div", { className: `widget-kpi__trend ${i}`, children: [
|
|
79
79
|
/* @__PURE__ */ _("span", { className: "widget-kpi__variance", children: [
|
|
80
80
|
c,
|
|
@@ -83,45 +83,45 @@ function fe({ data: a, label: r }) {
|
|
|
83
83
|
e.variance_pct.toFixed(1),
|
|
84
84
|
"%"
|
|
85
85
|
] }),
|
|
86
|
-
e.label && /* @__PURE__ */
|
|
86
|
+
e.label && /* @__PURE__ */ a("span", { className: "widget-kpi__trend-label", children: e.label })
|
|
87
87
|
] })
|
|
88
88
|
] });
|
|
89
89
|
}
|
|
90
90
|
const ve = "var(--bg-elevated)";
|
|
91
|
-
function
|
|
92
|
-
if (
|
|
93
|
-
if (
|
|
94
|
-
return `M ${
|
|
95
|
-
const e =
|
|
96
|
-
return `M ${
|
|
91
|
+
function E(t, l, n, r) {
|
|
92
|
+
if (r <= 0) return "";
|
|
93
|
+
if (r >= 1)
|
|
94
|
+
return `M ${t - n} ${l} A ${n} ${n} 0 0 1 ${t} ${l - n} A ${n} ${n} 0 0 1 ${t + n} ${l}`;
|
|
95
|
+
const e = r * Math.PI, i = t - n * Math.cos(e), c = l - n * Math.sin(e);
|
|
96
|
+
return `M ${t - n} ${l} A ${n} ${n} 0 0 1 ${i} ${c}`;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
const
|
|
100
|
-
return
|
|
98
|
+
function O(t) {
|
|
99
|
+
const l = Math.abs(t);
|
|
100
|
+
return l >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : l >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toLocaleString("pt-BR");
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
102
|
+
function ye({ data: t, palette: l, label: n }) {
|
|
103
|
+
const r = n || String(t.label || ""), e = typeof t.value == "number" ? t.value : null, i = e != null ? O(e) : "-", c = String(t.formatted || "-"), s = typeof t.ratio == "number" ? t.ratio : 0, m = t.target_value, g = t.comparison_label, o = s >= 1, d = Math.min(Math.max(s, 0), 1), h = o ? "var(--action-green)" : s >= 0.7 ? l[0] || "var(--color-info)" : s >= 0.4 ? "var(--color-warning)" : "var(--color-error)", w = m != null ? O(m) : "-", u = 50, b = 50, y = 44, p = 10;
|
|
104
104
|
return /* @__PURE__ */ _("div", { className: "widget widget-gauge", children: [
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ a("span", { className: "widget-gauge__label", children: r }),
|
|
106
106
|
/* @__PURE__ */ _("div", { className: "widget-gauge__chart", children: [
|
|
107
107
|
/* @__PURE__ */ _("svg", { viewBox: "0 0 100 56", preserveAspectRatio: "xMidYMax meet", children: [
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
108
|
+
/* @__PURE__ */ a("path", { d: E(u, b, y, 1), fill: "none", stroke: ve, strokeWidth: p, strokeLinecap: "butt" }),
|
|
109
|
+
d > 0 && /* @__PURE__ */ a("path", { d: E(u, b, y, d), fill: "none", stroke: h, strokeWidth: p, strokeLinecap: "butt" })
|
|
110
110
|
] }),
|
|
111
111
|
/* @__PURE__ */ _("div", { className: "widget-gauge__center", children: [
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ a("span", { className: "widget-gauge__percent", children: c }),
|
|
113
113
|
/* @__PURE__ */ _("span", { className: "widget-gauge__comparison", children: [
|
|
114
114
|
i,
|
|
115
115
|
" / ",
|
|
116
116
|
w
|
|
117
117
|
] }),
|
|
118
|
-
|
|
119
|
-
!
|
|
118
|
+
o && /* @__PURE__ */ a("span", { className: "widget-gauge__badge", children: g || "Meta batida" }),
|
|
119
|
+
!o && g && /* @__PURE__ */ a("span", { className: "widget-gauge__comparison", children: g })
|
|
120
120
|
] })
|
|
121
121
|
] })
|
|
122
122
|
] });
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const W = { fontSize: 10, fill: "var(--text-muted)" }, Ne = "var(--bg-elevated)", V = {
|
|
125
125
|
backgroundColor: "var(--bg-elevated)",
|
|
126
126
|
border: "1px solid var(--bg-paper)",
|
|
127
127
|
borderRadius: "6px",
|
|
@@ -130,342 +130,408 @@ const E = { fontSize: 10, fill: "var(--text-muted)" }, ye = "var(--bg-elevated)"
|
|
|
130
130
|
color: "var(--text-primary)",
|
|
131
131
|
fontWeight: 600
|
|
132
132
|
};
|
|
133
|
-
function
|
|
133
|
+
function G(t, l) {
|
|
134
134
|
var e;
|
|
135
|
-
const n = Array.isArray(
|
|
136
|
-
return typeof
|
|
135
|
+
const n = Array.isArray(l) ? l[0] : void 0, r = (e = n == null ? void 0 : n.payload) == null ? void 0 : e.tooltipLabel;
|
|
136
|
+
return typeof r == "string" && r ? r : String(t ?? "");
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const [
|
|
138
|
+
function ke(t) {
|
|
139
|
+
const [l, n] = k({ width: 0, height: 0 });
|
|
140
140
|
return T(() => {
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
141
|
+
const r = t.current;
|
|
142
|
+
if (!r) return;
|
|
143
143
|
const e = new ResizeObserver(([i]) => {
|
|
144
144
|
const { width: c, height: s } = i.contentRect;
|
|
145
145
|
n(
|
|
146
146
|
(m) => m.width !== Math.floor(c) || m.height !== Math.floor(s) ? { width: Math.floor(c), height: Math.floor(s) } : m
|
|
147
147
|
);
|
|
148
148
|
});
|
|
149
|
-
return e.observe(
|
|
150
|
-
}, [
|
|
149
|
+
return e.observe(r), () => e.disconnect();
|
|
150
|
+
}, [t]), l;
|
|
151
151
|
}
|
|
152
|
-
function x({ Chart:
|
|
153
|
-
return /* @__PURE__ */ _(
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
|
|
152
|
+
function x({ Chart: t, chartData: l, xKey: n, series: r, palette: e, renderSeries: i, width: c, height: s }) {
|
|
153
|
+
return /* @__PURE__ */ _(t, { data: l, width: c, height: s, children: [
|
|
154
|
+
/* @__PURE__ */ a(ge, { strokeDasharray: "3 3", stroke: Ne }),
|
|
155
|
+
/* @__PURE__ */ a(he, { dataKey: n, tick: W }),
|
|
156
|
+
/* @__PURE__ */ a(ue, { tick: W }),
|
|
157
|
+
/* @__PURE__ */ a(
|
|
158
|
+
Y,
|
|
159
159
|
{
|
|
160
|
-
contentStyle:
|
|
160
|
+
contentStyle: V,
|
|
161
161
|
labelStyle: K,
|
|
162
|
-
labelFormatter:
|
|
162
|
+
labelFormatter: G,
|
|
163
163
|
cursor: { fill: "var(--bg-paper)", opacity: 0.3 }
|
|
164
164
|
}
|
|
165
165
|
),
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
r.length > 1 && /* @__PURE__ */ a(me, {}),
|
|
167
|
+
r.map((m, g) => i(m, e[g % e.length], g))
|
|
168
168
|
] });
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
})() })
|
|
236
|
-
] })
|
|
170
|
+
function $e({ data: t, palette: l, label: n }) {
|
|
171
|
+
const r = String(t.chartType || "bar"), e = n || String(t.label || ""), i = String(t.xKey || "label"), c = t.series || [], s = t.data || [], m = F(null), { width: g, height: o } = ke(m), d = () => {
|
|
172
|
+
var w;
|
|
173
|
+
if (g <= 0 || o <= 0) return null;
|
|
174
|
+
if (r === "pie")
|
|
175
|
+
return /* @__PURE__ */ _(ae, { width: g, height: o, children: [
|
|
176
|
+
/* @__PURE__ */ a(
|
|
177
|
+
re,
|
|
178
|
+
{
|
|
179
|
+
data: s,
|
|
180
|
+
dataKey: ((w = c[0]) == null ? void 0 : w.key) || "s0",
|
|
181
|
+
nameKey: i,
|
|
182
|
+
cx: "50%",
|
|
183
|
+
cy: "50%",
|
|
184
|
+
outerRadius: "75%",
|
|
185
|
+
label: ({ name: u, percent: b }) => `${u}: ${(b * 100).toFixed(0)}%`,
|
|
186
|
+
labelLine: !1,
|
|
187
|
+
children: s.map((u, b) => /* @__PURE__ */ a(le, { fill: l[b % l.length] }, b))
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ a(
|
|
191
|
+
Y,
|
|
192
|
+
{
|
|
193
|
+
contentStyle: V,
|
|
194
|
+
labelStyle: K,
|
|
195
|
+
labelFormatter: G
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] });
|
|
199
|
+
const h = { chartData: s, xKey: i, series: c, palette: l, width: g, height: o };
|
|
200
|
+
return r === "line" ? /* @__PURE__ */ a(x, { ...h, Chart: ne, renderSeries: (u, b) => /* @__PURE__ */ a(
|
|
201
|
+
ie,
|
|
202
|
+
{
|
|
203
|
+
type: "monotone",
|
|
204
|
+
dataKey: u.key,
|
|
205
|
+
name: u.label,
|
|
206
|
+
stroke: b,
|
|
207
|
+
strokeWidth: 2,
|
|
208
|
+
dot: s.length <= 31
|
|
209
|
+
},
|
|
210
|
+
u.key
|
|
211
|
+
) }) : r === "area" ? /* @__PURE__ */ a(x, { ...h, Chart: se, renderSeries: (u, b) => /* @__PURE__ */ a(
|
|
212
|
+
ce,
|
|
213
|
+
{
|
|
214
|
+
type: "monotone",
|
|
215
|
+
dataKey: u.key,
|
|
216
|
+
name: u.label,
|
|
217
|
+
fill: b,
|
|
218
|
+
stroke: b,
|
|
219
|
+
fillOpacity: 0.3
|
|
220
|
+
},
|
|
221
|
+
u.key
|
|
222
|
+
) }) : /* @__PURE__ */ a(x, { ...h, Chart: oe, renderSeries: (u, b) => /* @__PURE__ */ a(
|
|
223
|
+
de,
|
|
224
|
+
{
|
|
225
|
+
dataKey: u.key,
|
|
226
|
+
name: u.label,
|
|
227
|
+
fill: b,
|
|
228
|
+
radius: [3, 3, 0, 0]
|
|
229
|
+
},
|
|
230
|
+
u.key
|
|
231
|
+
) });
|
|
232
|
+
};
|
|
233
|
+
return /* @__PURE__ */ _("div", { className: "widget widget-chart", children: [
|
|
234
|
+
e && /* @__PURE__ */ a("h4", { className: "widget-chart__title", children: e }),
|
|
235
|
+
/* @__PURE__ */ a("div", { ref: m, className: "widget-chart__container", children: s.length === 0 ? /* @__PURE__ */ a("div", { className: "widget-chart__empty", children: "Sem dados" }) : d() })
|
|
236
|
+
] });
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
|
|
238
|
+
function Se(t, l) {
|
|
239
|
+
if (t == null || t === "") return "-";
|
|
240
|
+
const n = typeof t == "number" ? t : Number(t), r = t !== "" && !Number.isNaN(n);
|
|
241
|
+
switch (l) {
|
|
242
|
+
case "currency":
|
|
243
|
+
return r ? n.toLocaleString("pt-BR", { style: "currency", currency: "BRL" }) : String(t);
|
|
244
|
+
case "integer":
|
|
245
|
+
return r ? Math.round(n).toLocaleString("pt-BR") : String(t);
|
|
246
|
+
case "number":
|
|
247
|
+
return r ? n.toLocaleString("pt-BR", { maximumFractionDigits: 1 }) : String(t);
|
|
248
|
+
case "percentage":
|
|
249
|
+
return r ? `${n > 0 ? "+" : ""}${Math.round(n)}%` : String(t);
|
|
250
|
+
default:
|
|
251
|
+
return String(t);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function Ce({ data: t, label: l }) {
|
|
255
|
+
var g;
|
|
256
|
+
const [n, r] = k(0), e = t.columns || [], i = t.tabs || [], c = i.length > 0, s = c ? ((g = i[Math.min(n, i.length - 1)]) == null ? void 0 : g.rows) || [] : t.rows || [], m = l || String(t.label || "");
|
|
257
|
+
return e.length === 0 ? /* @__PURE__ */ _("div", { className: "widget widget-table", children: [
|
|
258
|
+
m && /* @__PURE__ */ a("span", { className: "widget-table__label", children: m }),
|
|
259
|
+
/* @__PURE__ */ a("span", { className: "widget-table__empty", children: "Configure as colunas da tabela." })
|
|
260
|
+
] }) : /* @__PURE__ */ _("div", { className: "widget widget-table", children: [
|
|
261
|
+
m && /* @__PURE__ */ a("span", { className: "widget-table__label", children: m }),
|
|
262
|
+
c && /* @__PURE__ */ a("div", { className: "widget-table__tabs", role: "tablist", children: i.map((o, d) => /* @__PURE__ */ a(
|
|
263
|
+
"button",
|
|
264
|
+
{
|
|
265
|
+
type: "button",
|
|
266
|
+
role: "tab",
|
|
267
|
+
"aria-selected": d === n,
|
|
268
|
+
className: `widget-table__tab${d === n ? " widget-table__tab--active" : ""}`,
|
|
269
|
+
onClick: () => r(d),
|
|
270
|
+
children: o.label
|
|
271
|
+
},
|
|
272
|
+
d
|
|
273
|
+
)) }),
|
|
274
|
+
/* @__PURE__ */ a("div", { className: "widget-table__scroll", children: /* @__PURE__ */ _("table", { className: "widget-table__table", children: [
|
|
275
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: e.map((o) => {
|
|
276
|
+
const d = !!o.format && o.format !== "text";
|
|
277
|
+
return /* @__PURE__ */ a("th", { className: `widget-table__th${d ? " widget-table__th--num" : ""}`, children: o.label || o.key }, o.key);
|
|
278
|
+
}) }) }),
|
|
279
|
+
/* @__PURE__ */ a("tbody", { children: s.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { className: "widget-table__td widget-table__empty", colSpan: e.length, children: "Sem dados" }) }) : s.map((o, d) => /* @__PURE__ */ a("tr", { children: e.map((h) => {
|
|
280
|
+
const w = o[h.key], u = !!h.format && h.format !== "text";
|
|
281
|
+
let b = "";
|
|
282
|
+
if (h.format === "percentage") {
|
|
283
|
+
const y = Number(w);
|
|
284
|
+
Number.isNaN(y) || (b = y > 0 ? " widget-table__td--up" : y < 0 ? " widget-table__td--down" : "");
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ a("td", { className: `widget-table__td${u ? " widget-table__td--num" : ""}${b}`, children: Se(w, h.format) }, h.key);
|
|
287
|
+
}) }, d)) })
|
|
288
|
+
] }) })
|
|
289
|
+
] });
|
|
290
|
+
}
|
|
291
|
+
function Re({ config: t, value: l, options: n = [], dateBounds: r, onChange: e }) {
|
|
292
|
+
const i = t.filterType || "select", c = t.label || "Filtro", s = t.dateFilterMode || "range";
|
|
240
293
|
return /* @__PURE__ */ _("div", { className: "widget-filter", children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
i === "date_range" ? s === "yearly" ? /* @__PURE__ */
|
|
243
|
-
|
|
294
|
+
/* @__PURE__ */ a("label", { className: "widget-filter__label", children: c }),
|
|
295
|
+
i === "date_range" ? s === "yearly" ? /* @__PURE__ */ a(xe, { value: l, dateBounds: r, onChange: e }) : s === "monthly" ? /* @__PURE__ */ a(Fe, { value: l, dateBounds: r, onChange: e }) : s === "weekly" ? /* @__PURE__ */ a(Te, { value: l, dateBounds: r, onChange: e }) : /* @__PURE__ */ a(Me, { value: l, dateBounds: r, onChange: e }) : /* @__PURE__ */ a(
|
|
296
|
+
Le,
|
|
244
297
|
{
|
|
245
|
-
value:
|
|
298
|
+
value: l,
|
|
246
299
|
options: n,
|
|
247
300
|
multi: i === "multi_select",
|
|
248
|
-
searchable:
|
|
301
|
+
searchable: t.searchable || !1,
|
|
249
302
|
onChange: e
|
|
250
303
|
}
|
|
251
304
|
)
|
|
252
305
|
] });
|
|
253
306
|
}
|
|
254
|
-
function
|
|
255
|
-
const [
|
|
307
|
+
function Me({ value: t, dateBounds: l, onChange: n }) {
|
|
308
|
+
const [r, e] = t ? t.split("|") : ["", ""];
|
|
256
309
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
|
|
310
|
+
/* @__PURE__ */ a(
|
|
311
|
+
A,
|
|
259
312
|
{
|
|
260
|
-
value:
|
|
261
|
-
minIso:
|
|
262
|
-
maxIso: e || (
|
|
313
|
+
value: r,
|
|
314
|
+
minIso: l == null ? void 0 : l.min,
|
|
315
|
+
maxIso: e || (l == null ? void 0 : l.max),
|
|
263
316
|
selectsStart: !0,
|
|
264
|
-
startIso:
|
|
317
|
+
startIso: r,
|
|
265
318
|
endIso: e,
|
|
266
319
|
placeholder: "Data inicial",
|
|
267
320
|
onChange: (i) => n(`${i}|${e}`)
|
|
268
321
|
}
|
|
269
322
|
),
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
|
|
323
|
+
/* @__PURE__ */ a(
|
|
324
|
+
A,
|
|
272
325
|
{
|
|
273
326
|
value: e,
|
|
274
|
-
minIso:
|
|
275
|
-
maxIso:
|
|
327
|
+
minIso: r || (l == null ? void 0 : l.min),
|
|
328
|
+
maxIso: l == null ? void 0 : l.max,
|
|
276
329
|
selectsEnd: !0,
|
|
277
|
-
startIso:
|
|
330
|
+
startIso: r,
|
|
278
331
|
endIso: e,
|
|
279
332
|
placeholder: "Data final",
|
|
280
|
-
onChange: (i) => n(`${
|
|
333
|
+
onChange: (i) => n(`${r}|${i}`)
|
|
281
334
|
}
|
|
282
335
|
)
|
|
283
336
|
] });
|
|
284
337
|
}
|
|
285
|
-
function
|
|
286
|
-
const [
|
|
287
|
-
const
|
|
288
|
-
n(`${
|
|
338
|
+
function xe({ value: t, dateBounds: l, onChange: n }) {
|
|
339
|
+
const [r] = t ? t.split("|") : [""], e = H(r), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = I(l), m = (g) => {
|
|
340
|
+
const o = J(g);
|
|
341
|
+
n(`${o.start}|${o.end}`);
|
|
289
342
|
};
|
|
290
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ a("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ a(
|
|
291
344
|
"select",
|
|
292
345
|
{
|
|
293
346
|
className: "widget-filter__select",
|
|
294
347
|
value: c,
|
|
295
|
-
onChange: (
|
|
296
|
-
children: s.map((
|
|
348
|
+
onChange: (g) => m(parseInt(g.target.value)),
|
|
349
|
+
children: s.map((g) => /* @__PURE__ */ a("option", { value: g, children: g }, g))
|
|
297
350
|
}
|
|
298
351
|
) });
|
|
299
352
|
}
|
|
300
|
-
function
|
|
301
|
-
const [
|
|
302
|
-
const
|
|
303
|
-
n(`${
|
|
353
|
+
function Fe({ value: t, dateBounds: l, onChange: n }) {
|
|
354
|
+
const [r] = t ? t.split("|") : [""], e = D(r), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, m = I(l), g = (o, d) => {
|
|
355
|
+
const h = Q(o, d);
|
|
356
|
+
n(`${h.start}|${h.end}`);
|
|
304
357
|
};
|
|
305
358
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--month", children: [
|
|
306
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ a(
|
|
307
360
|
"select",
|
|
308
361
|
{
|
|
309
362
|
className: "widget-filter__select",
|
|
310
363
|
value: s,
|
|
311
|
-
onChange: (
|
|
312
|
-
children:
|
|
364
|
+
onChange: (o) => g(c, parseInt(o.target.value)),
|
|
365
|
+
children: P.map((o, d) => /* @__PURE__ */ a("option", { value: d + 1, children: o }, d + 1))
|
|
313
366
|
}
|
|
314
367
|
),
|
|
315
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ a(
|
|
316
369
|
"select",
|
|
317
370
|
{
|
|
318
371
|
className: "widget-filter__select",
|
|
319
372
|
value: c,
|
|
320
|
-
onChange: (
|
|
321
|
-
children: m.map((
|
|
373
|
+
onChange: (o) => g(parseInt(o.target.value), s),
|
|
374
|
+
children: m.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
|
|
322
375
|
}
|
|
323
376
|
)
|
|
324
377
|
] });
|
|
325
378
|
}
|
|
326
|
-
function
|
|
327
|
-
const [
|
|
379
|
+
function Te({ value: t, dateBounds: l, onChange: n }) {
|
|
380
|
+
const [r] = t ? t.split("|") : [""], e = D(r), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, m = I(l), g = M(c, s), o = X(r, c, s) || 1;
|
|
328
381
|
return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
|
|
329
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ a(
|
|
330
383
|
"select",
|
|
331
384
|
{
|
|
332
385
|
className: "widget-filter__select",
|
|
333
386
|
value: c,
|
|
334
|
-
onChange: (
|
|
335
|
-
const
|
|
336
|
-
|
|
387
|
+
onChange: (d) => {
|
|
388
|
+
const h = parseInt(d.target.value), u = M(h, s)[0];
|
|
389
|
+
u && n(`${u.start}|${u.end}`);
|
|
337
390
|
},
|
|
338
|
-
children: m.map((
|
|
391
|
+
children: m.map((d) => /* @__PURE__ */ a("option", { value: d, children: d }, d))
|
|
339
392
|
}
|
|
340
393
|
),
|
|
341
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ a(
|
|
342
395
|
"select",
|
|
343
396
|
{
|
|
344
397
|
className: "widget-filter__select",
|
|
345
398
|
value: s,
|
|
346
|
-
onChange: (
|
|
347
|
-
const
|
|
348
|
-
|
|
399
|
+
onChange: (d) => {
|
|
400
|
+
const h = parseInt(d.target.value), u = M(c, h)[0];
|
|
401
|
+
u && n(`${u.start}|${u.end}`);
|
|
349
402
|
},
|
|
350
|
-
children:
|
|
403
|
+
children: P.map((d, h) => /* @__PURE__ */ a("option", { value: h + 1, children: d }, h + 1))
|
|
351
404
|
}
|
|
352
405
|
),
|
|
353
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ a(
|
|
354
407
|
"select",
|
|
355
408
|
{
|
|
356
409
|
className: "widget-filter__select",
|
|
357
|
-
value:
|
|
358
|
-
onChange: (
|
|
359
|
-
const
|
|
360
|
-
|
|
410
|
+
value: o,
|
|
411
|
+
onChange: (d) => {
|
|
412
|
+
const h = g[parseInt(d.target.value) - 1];
|
|
413
|
+
h && n(`${h.start}|${h.end}`);
|
|
361
414
|
},
|
|
362
|
-
children:
|
|
415
|
+
children: g.map((d) => /* @__PURE__ */ a("option", { value: d.index, children: d.label }, d.index))
|
|
363
416
|
}
|
|
364
417
|
)
|
|
365
418
|
] });
|
|
366
419
|
}
|
|
367
|
-
function
|
|
368
|
-
if (
|
|
369
|
-
return /* @__PURE__ */
|
|
420
|
+
function Le({ value: t, options: l, multi: n, searchable: r, onChange: e }) {
|
|
421
|
+
if (r)
|
|
422
|
+
return /* @__PURE__ */ a(
|
|
370
423
|
q,
|
|
371
424
|
{
|
|
372
|
-
value:
|
|
373
|
-
options:
|
|
425
|
+
value: t,
|
|
426
|
+
options: l,
|
|
374
427
|
multi: n,
|
|
375
428
|
onChange: e
|
|
376
429
|
}
|
|
377
430
|
);
|
|
378
431
|
if (n) {
|
|
379
|
-
const i =
|
|
380
|
-
const m = i.includes(s) ? i.filter((
|
|
381
|
-
e(m.join(
|
|
432
|
+
const i = t ? t.split(L) : [], c = (s) => {
|
|
433
|
+
const m = i.includes(s) ? i.filter((g) => g !== s) : [...i, s];
|
|
434
|
+
e(m.join(L));
|
|
382
435
|
};
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
"
|
|
436
|
+
return /* @__PURE__ */ _("div", { className: "widget-filter__multi", children: [
|
|
437
|
+
i.length > 0 && /* @__PURE__ */ a(
|
|
438
|
+
"button",
|
|
386
439
|
{
|
|
387
|
-
type: "
|
|
388
|
-
|
|
389
|
-
|
|
440
|
+
type: "button",
|
|
441
|
+
className: "widget-filter__multi-clear",
|
|
442
|
+
onClick: () => e(""),
|
|
443
|
+
children: "Limpar filtro"
|
|
390
444
|
}
|
|
391
445
|
),
|
|
392
|
-
s
|
|
393
|
-
|
|
446
|
+
l.map((s) => /* @__PURE__ */ _("label", { className: "widget-filter__multi-option", children: [
|
|
447
|
+
/* @__PURE__ */ a(
|
|
448
|
+
"input",
|
|
449
|
+
{
|
|
450
|
+
type: "checkbox",
|
|
451
|
+
checked: i.includes(s),
|
|
452
|
+
onChange: () => c(s)
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
s
|
|
456
|
+
] }, s))
|
|
457
|
+
] });
|
|
394
458
|
}
|
|
395
459
|
return /* @__PURE__ */ _(
|
|
396
460
|
"select",
|
|
397
461
|
{
|
|
398
462
|
className: "widget-filter__select",
|
|
399
|
-
value:
|
|
463
|
+
value: t,
|
|
400
464
|
onChange: (i) => e(i.target.value),
|
|
401
465
|
children: [
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
|
|
466
|
+
/* @__PURE__ */ a("option", { value: "", children: "Todos" }),
|
|
467
|
+
l.map((i) => /* @__PURE__ */ a("option", { value: i, children: i }, i))
|
|
404
468
|
]
|
|
405
469
|
}
|
|
406
470
|
);
|
|
407
471
|
}
|
|
408
|
-
const
|
|
472
|
+
const Ie = {
|
|
409
473
|
currency: "R$",
|
|
410
474
|
percentage: "%"
|
|
411
475
|
};
|
|
412
|
-
function
|
|
413
|
-
const
|
|
476
|
+
function Ae({ config: t, value: l, onChange: n }) {
|
|
477
|
+
const r = t.label || "Variavel", e = t.locked || !1, i = t.variableFormat || "number", c = Ie[i] || "";
|
|
414
478
|
return /* @__PURE__ */ _("div", { className: `widget-variable ${e ? "widget-variable--locked" : ""}`, children: [
|
|
415
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ a("label", { className: "widget-variable__label", children: r }),
|
|
416
480
|
/* @__PURE__ */ _("div", { className: "widget-variable__input-wrapper", children: [
|
|
417
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ a(
|
|
418
482
|
"input",
|
|
419
483
|
{
|
|
420
484
|
className: "widget-variable__input",
|
|
421
485
|
type: "number",
|
|
422
|
-
value:
|
|
486
|
+
value: l,
|
|
423
487
|
onChange: (s) => n(parseFloat(s.target.value) || 0),
|
|
424
488
|
disabled: e,
|
|
425
489
|
step: i === "integer" ? 1 : 0.01
|
|
426
490
|
}
|
|
427
491
|
),
|
|
428
|
-
c && /* @__PURE__ */
|
|
492
|
+
c && /* @__PURE__ */ a("span", { className: "widget-variable__suffix", children: c })
|
|
429
493
|
] }),
|
|
430
|
-
e && /* @__PURE__ */
|
|
494
|
+
e && /* @__PURE__ */ a("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
431
495
|
] });
|
|
432
496
|
}
|
|
433
|
-
function
|
|
434
|
-
const
|
|
497
|
+
function Ee({ config: t, palette: l, onChange: n }) {
|
|
498
|
+
const r = t.label || "Cores", e = t.locked || !1;
|
|
435
499
|
return /* @__PURE__ */ _("div", { className: `widget-palette ${e ? "widget-palette--locked" : ""}`, children: [
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
e && /* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ a("label", { className: "widget-palette__label", children: r }),
|
|
501
|
+
/* @__PURE__ */ a(Z, { selected: l, onSelect: n, customMode: !0, disabled: e }),
|
|
502
|
+
e && /* @__PURE__ */ a("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
|
|
439
503
|
] });
|
|
440
504
|
}
|
|
441
|
-
function
|
|
442
|
-
type:
|
|
443
|
-
computed:
|
|
505
|
+
function Oe({
|
|
506
|
+
type: t,
|
|
507
|
+
computed: l,
|
|
444
508
|
palette: n,
|
|
445
|
-
config:
|
|
509
|
+
config: r,
|
|
446
510
|
filterValue: e,
|
|
447
511
|
filterOptions: i,
|
|
448
512
|
dateBounds: c,
|
|
449
513
|
onFilterChange: s,
|
|
450
514
|
variableValue: m,
|
|
451
|
-
onVariableChange:
|
|
452
|
-
onPaletteChange:
|
|
515
|
+
onVariableChange: g,
|
|
516
|
+
onPaletteChange: o
|
|
453
517
|
}) {
|
|
454
|
-
if (
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
const
|
|
457
|
-
switch (
|
|
518
|
+
if (l.error)
|
|
519
|
+
return /* @__PURE__ */ a("div", { className: "widget widget--error", children: /* @__PURE__ */ a("span", { className: "widget__error-text", children: String(l.error) }) });
|
|
520
|
+
const d = B(n);
|
|
521
|
+
switch (t) {
|
|
458
522
|
case "kpi_card":
|
|
459
|
-
return /* @__PURE__ */
|
|
523
|
+
return /* @__PURE__ */ a(we, { data: l, label: r == null ? void 0 : r.label });
|
|
460
524
|
case "gauge":
|
|
461
|
-
return /* @__PURE__ */
|
|
525
|
+
return /* @__PURE__ */ a(ye, { data: l, palette: d, label: r == null ? void 0 : r.label });
|
|
462
526
|
case "chart":
|
|
463
|
-
return /* @__PURE__ */
|
|
527
|
+
return /* @__PURE__ */ a($e, { data: l, palette: d, label: r == null ? void 0 : r.label });
|
|
528
|
+
case "table":
|
|
529
|
+
return /* @__PURE__ */ a(Ce, { data: l, label: r == null ? void 0 : r.label });
|
|
464
530
|
case "filter":
|
|
465
|
-
return
|
|
466
|
-
|
|
531
|
+
return r && s ? /* @__PURE__ */ a(
|
|
532
|
+
Re,
|
|
467
533
|
{
|
|
468
|
-
config:
|
|
534
|
+
config: r,
|
|
469
535
|
value: e || "",
|
|
470
536
|
options: i,
|
|
471
537
|
dateBounds: c,
|
|
@@ -473,38 +539,38 @@ function Le({
|
|
|
473
539
|
}
|
|
474
540
|
) : null;
|
|
475
541
|
case "variable": {
|
|
476
|
-
const
|
|
477
|
-
return
|
|
478
|
-
|
|
542
|
+
const h = r;
|
|
543
|
+
return h && g ? /* @__PURE__ */ a(
|
|
544
|
+
Ae,
|
|
479
545
|
{
|
|
480
|
-
config:
|
|
481
|
-
value: m ??
|
|
482
|
-
onChange:
|
|
546
|
+
config: h,
|
|
547
|
+
value: m ?? h.variableValue ?? 0,
|
|
548
|
+
onChange: g
|
|
483
549
|
}
|
|
484
550
|
) : null;
|
|
485
551
|
}
|
|
486
552
|
case "color_palette":
|
|
487
|
-
return
|
|
488
|
-
|
|
553
|
+
return r && o ? /* @__PURE__ */ a(
|
|
554
|
+
Ee,
|
|
489
555
|
{
|
|
490
|
-
config:
|
|
556
|
+
config: r,
|
|
491
557
|
palette: n,
|
|
492
|
-
onChange:
|
|
558
|
+
onChange: o
|
|
493
559
|
}
|
|
494
560
|
) : null;
|
|
495
561
|
default:
|
|
496
562
|
return /* @__PURE__ */ _("div", { className: "widget", children: [
|
|
497
563
|
"Widget: ",
|
|
498
|
-
|
|
564
|
+
t
|
|
499
565
|
] });
|
|
500
566
|
}
|
|
501
567
|
}
|
|
502
|
-
const
|
|
503
|
-
function
|
|
504
|
-
token:
|
|
505
|
-
rowHeight:
|
|
506
|
-
gridGap: n =
|
|
507
|
-
className:
|
|
568
|
+
const We = 2.5, De = 0.375;
|
|
569
|
+
function Ge({
|
|
570
|
+
token: t,
|
|
571
|
+
rowHeight: l = We,
|
|
572
|
+
gridGap: n = De,
|
|
573
|
+
className: r
|
|
508
574
|
}) {
|
|
509
575
|
const {
|
|
510
576
|
layout: e,
|
|
@@ -512,62 +578,62 @@ function Ye({
|
|
|
512
578
|
loading: c,
|
|
513
579
|
error: s,
|
|
514
580
|
filters: m,
|
|
515
|
-
variables:
|
|
516
|
-
palette:
|
|
517
|
-
setFilter:
|
|
518
|
-
setVariable:
|
|
581
|
+
variables: g,
|
|
582
|
+
palette: o,
|
|
583
|
+
setFilter: d,
|
|
584
|
+
setVariable: h,
|
|
519
585
|
setPalette: w
|
|
520
|
-
} =
|
|
586
|
+
} = be(t);
|
|
521
587
|
if (s && !e)
|
|
522
|
-
return /* @__PURE__ */
|
|
588
|
+
return /* @__PURE__ */ a("div", { className: `preview-tab ${r ?? ""}`, children: /* @__PURE__ */ a("div", { className: "preview-tab__error", children: s }) });
|
|
523
589
|
if (!e)
|
|
524
|
-
return /* @__PURE__ */
|
|
590
|
+
return /* @__PURE__ */ a("div", { className: `preview-tab ${r ?? ""}`, children: /* @__PURE__ */ a("div", { className: "preview-tab__loading", children: "Carregando dashboard..." }) });
|
|
525
591
|
if (e.widgets.length === 0)
|
|
526
|
-
return /* @__PURE__ */
|
|
527
|
-
const
|
|
592
|
+
return /* @__PURE__ */ a("div", { className: `preview-tab ${r ?? ""}`, children: /* @__PURE__ */ a("div", { className: "preview-tab__empty", children: "Este dashboard nao possui widgets." }) });
|
|
593
|
+
const u = (i == null ? void 0 : i.widgets) ?? {}, b = (i == null ? void 0 : i.date_bounds) ?? null, y = {
|
|
528
594
|
display: "grid",
|
|
529
595
|
gridTemplateColumns: `repeat(${e.gridColumns}, 1fr)`,
|
|
530
|
-
gridTemplateRows: `repeat(${e.gridRows}, ${
|
|
596
|
+
gridTemplateRows: `repeat(${e.gridRows}, ${l}rem)`,
|
|
531
597
|
gap: `${n}rem`,
|
|
532
|
-
...
|
|
598
|
+
...ee(o)
|
|
533
599
|
};
|
|
534
|
-
return /* @__PURE__ */ _("div", { className: `preview-tab ${
|
|
535
|
-
s && !i && /* @__PURE__ */
|
|
536
|
-
i && /* @__PURE__ */
|
|
537
|
-
const S =
|
|
538
|
-
gridColumn: `${
|
|
539
|
-
gridRow: `${
|
|
540
|
-
}, v =
|
|
541
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ _("div", { className: `preview-tab ${r ?? ""}`, children: [
|
|
601
|
+
s && !i && /* @__PURE__ */ a("div", { className: "preview-tab__error", children: s }),
|
|
602
|
+
i && /* @__PURE__ */ a("div", { className: "preview-tab__grid", style: y, children: e.widgets.map((p) => {
|
|
603
|
+
const S = te.has(p.type), N = u[p.id], C = {
|
|
604
|
+
gridColumn: `${p.grid.x + 1} / span ${p.grid.w}`,
|
|
605
|
+
gridRow: `${p.grid.y + 1} / span ${p.grid.h}`
|
|
606
|
+
}, v = p.type === "variable" ? g[p.id] ?? (N == null ? void 0 : N.value) ?? p.config.variableValue ?? 0 : void 0;
|
|
607
|
+
return /* @__PURE__ */ a(
|
|
542
608
|
"div",
|
|
543
609
|
{
|
|
544
610
|
className: `preview-tab__widget ${S ? "preview-tab__widget--control" : ""}`,
|
|
545
611
|
style: C,
|
|
546
|
-
children: S ||
|
|
547
|
-
|
|
612
|
+
children: S || N ? /* @__PURE__ */ a(
|
|
613
|
+
Oe,
|
|
548
614
|
{
|
|
549
|
-
type:
|
|
550
|
-
computed:
|
|
551
|
-
palette:
|
|
552
|
-
config:
|
|
553
|
-
filterValue: m[
|
|
554
|
-
filterOptions: (
|
|
555
|
-
dateBounds:
|
|
556
|
-
onFilterChange: (f) =>
|
|
615
|
+
type: p.type,
|
|
616
|
+
computed: N || {},
|
|
617
|
+
palette: o,
|
|
618
|
+
config: p.config,
|
|
619
|
+
filterValue: m[p.id] || "",
|
|
620
|
+
filterOptions: (N == null ? void 0 : N.available_values) || [],
|
|
621
|
+
dateBounds: b,
|
|
622
|
+
onFilterChange: (f) => d(p.id, f),
|
|
557
623
|
variableValue: v,
|
|
558
|
-
onVariableChange: (f) =>
|
|
624
|
+
onVariableChange: (f) => h(p.id, f),
|
|
559
625
|
onPaletteChange: w
|
|
560
626
|
}
|
|
561
|
-
) : /* @__PURE__ */
|
|
627
|
+
) : /* @__PURE__ */ a("div", { className: "preview-tab__widget-loading", children: c ? "Carregando..." : "Sem dados" })
|
|
562
628
|
},
|
|
563
|
-
|
|
629
|
+
p.id
|
|
564
630
|
);
|
|
565
631
|
}) }),
|
|
566
|
-
c && i && /* @__PURE__ */
|
|
632
|
+
c && i && /* @__PURE__ */ a("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
|
|
567
633
|
] });
|
|
568
634
|
}
|
|
569
635
|
export {
|
|
570
|
-
|
|
571
|
-
|
|
636
|
+
Ue as ApiError,
|
|
637
|
+
Ge as Dashboard
|
|
572
638
|
};
|
|
573
639
|
//# sourceMappingURL=index.js.map
|