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