@aintela/bi 0.2.0 → 0.2.2
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/GridCardPlaceHolder-DVVT3pqn.js +25 -0
- package/dist/GridCardPlaceHolder-DVVT3pqn.js.map +1 -0
- package/dist/GridLayout-1gWuIKeZ.js +348 -0
- package/dist/GridLayout-1gWuIKeZ.js.map +1 -0
- package/dist/ScriptDashboardViewerVertical-CuwnxisJ.js +713 -0
- package/dist/ScriptDashboardViewerVertical-CuwnxisJ.js.map +1 -0
- package/dist/biModuleSurface--gLAiZ9Z.js +34 -0
- package/dist/biModuleSurface--gLAiZ9Z.js.map +1 -0
- package/dist/cards.js +13 -12
- package/dist/cards.js.map +1 -1
- package/dist/composer.js +37 -37
- package/dist/filterFactory-Ysv0FOQ2.js +285 -0
- package/dist/filterFactory-Ysv0FOQ2.js.map +1 -0
- package/dist/filters.js +11 -10
- package/dist/filters.js.map +1 -1
- package/dist/grid.js +12 -10
- package/dist/grid.js.map +1 -1
- package/dist/index-BRx4bRbe.js +73 -0
- package/dist/index-BRx4bRbe.js.map +1 -0
- package/dist/index-BzUugG0A.js +136 -0
- package/dist/index-BzUugG0A.js.map +1 -0
- package/dist/index-DULVx84u.js +3630 -0
- package/dist/index-DULVx84u.js.map +1 -0
- package/dist/{index-wtSLspPh.js → index-DeiweWw8.js} +348 -368
- package/dist/index-DeiweWw8.js.map +1 -0
- package/dist/index-K50t61iI.js +13 -0
- package/dist/index-K50t61iI.js.map +1 -0
- package/dist/index.js +186 -180
- package/dist/index.js.map +1 -1
- package/dist/runtime/version.d.ts +1 -1
- package/dist/runtime.js +14 -13
- package/dist/runtime.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/useContainerRectangle-D464wPFX.js +27 -0
- package/dist/useContainerRectangle-D464wPFX.js.map +1 -0
- package/dist/{version-DnqajORq.js → version-BpSiNdYv.js} +20 -19
- package/dist/{version-DnqajORq.js.map → version-BpSiNdYv.js.map} +1 -1
- package/dist/viewer.js +1 -1
- package/package.json +1 -1
- package/dist/index-C6JQ6770.js +0 -4545
- package/dist/index-C6JQ6770.js.map +0 -1
- package/dist/index-D7tVPX8d.js +0 -347
- package/dist/index-D7tVPX8d.js.map +0 -1
- package/dist/index-DGyvUtY3.js +0 -494
- package/dist/index-DGyvUtY3.js.map +0 -1
- package/dist/index-wtSLspPh.js.map +0 -1
|
@@ -1,125 +1,126 @@
|
|
|
1
1
|
var gt = Object.defineProperty;
|
|
2
2
|
var p = (t, e) => gt(t, "name", { value: e, configurable: !0 });
|
|
3
|
-
import { jsx as r, jsxs as
|
|
4
|
-
import { Box as S, Stack as he, Skeleton as _, Typography as A, useTheme as ue, Snackbar as xt, Alert as vt, CircularProgress as bt, Button as yt, MenuItem as
|
|
5
|
-
import { p as kt, h as ne, v as St, j as
|
|
3
|
+
import { jsx as r, jsxs as x, Fragment as xe } from "react/jsx-runtime";
|
|
4
|
+
import { Box as S, Stack as he, Skeleton as _, Typography as A, useTheme as ue, Snackbar as xt, Alert as vt, CircularProgress as bt, Button as yt, MenuItem as Ue } from "@mui/material";
|
|
5
|
+
import { p as kt, h as ne, v as St, j as tt, s as le, g as Ct, m as wt, i as Mt, l as Lt } from "./dataUtils-CAUE5uZY.js";
|
|
6
6
|
import { u as Tt, r as we } from "./createBiTheme-TyUv_UHM.js";
|
|
7
7
|
import { u as Ne } from "./ChartContext-C_f_6khG.js";
|
|
8
|
-
import
|
|
9
|
-
import { alpha as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { DataGridPro as At, gridClasses as Ve, getGridSingleSelectOperators as _t, useGridApiContext as Gt, useGridSelector as Nt, gridFilterModelSelector as Pt, GridToolbarContainer as zt, GridToolbarColumnsButton as Ht, GridToolbarFilterButton as Kt, GridToolbarDensitySelector as
|
|
8
|
+
import Be, { useEffect as rt, useState as re, useMemo as E, useRef as nt, createContext as It, useContext as Rt, useCallback as ke } from "react";
|
|
9
|
+
import { alpha as J } from "@mui/material/styles";
|
|
10
|
+
import Et from "@mui/icons-material/FileDownloadOutlined";
|
|
11
|
+
import $t from "@mui/icons-material/TableViewOutlined";
|
|
12
|
+
import Bt from "@mui/icons-material/FilterAltOffOutlined";
|
|
13
|
+
import { DataGridPro as At, gridClasses as Ve, getGridSingleSelectOperators as _t, useGridApiContext as Gt, useGridSelector as Nt, gridFilterModelSelector as Pt, GridToolbarContainer as zt, GridToolbarColumnsButton as Ht, GridToolbarFilterButton as Kt, GridToolbarDensitySelector as Ft, GridToolbarExportContainer as Wt } from "@mui/x-data-grid-pro";
|
|
14
14
|
import { LicenseInfo as Ot } from "@mui/x-license";
|
|
15
|
-
import { ResponsiveContainer as ye, PieChart as jt, Pie as Xt, Cell as
|
|
15
|
+
import { ResponsiveContainer as ye, PieChart as jt, Pie as Xt, Cell as qe, Tooltip as Ie, Legend as Re, ScatterChart as Yt, CartesianGrid as De, XAxis as Ee, YAxis as $e, Scatter as Zt, ComposedChart as Ut, BarChart as Vt, AreaChart as qt, LineChart as Dt, Bar as Qt, Area as Jt, Line as er, Treemap as tr } from "recharts";
|
|
16
16
|
import { u as rr } from "./ChartCardDefaultsContext-Cl5T25H0.js";
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import { u as ot } from "./useContainerRectangle-D464wPFX.js";
|
|
18
|
+
import { ComposableMap as at, ZoomableGroup as it, Geographies as Se, Geography as Ce, useZoomPanContext as Pe, Marker as Ae, useMapContext as nr } from "react-simple-maps";
|
|
19
|
+
function st({
|
|
19
20
|
currentValue: t,
|
|
20
21
|
previousValue: e,
|
|
21
22
|
prefix: o = "",
|
|
22
|
-
suffix:
|
|
23
|
+
suffix: i = "",
|
|
23
24
|
differenceStyle: s = "percentage",
|
|
24
25
|
description: c,
|
|
25
|
-
icon:
|
|
26
|
-
label:
|
|
26
|
+
icon: f,
|
|
27
|
+
label: v,
|
|
27
28
|
formatValue: h,
|
|
28
29
|
loading: l = !1
|
|
29
30
|
}) {
|
|
30
|
-
const
|
|
31
|
+
const g = Tt(), m = h ?? ne, { naked: d } = Ne() ?? {};
|
|
31
32
|
if (l)
|
|
32
|
-
return /* @__PURE__ */ r(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ r(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: /* @__PURE__ */ x(he, { spacing: 1, sx: { height: "100%" }, children: [
|
|
33
34
|
/* @__PURE__ */ r(_, { variant: "text", width: 100, sx: { fontSize: "0.75rem" } }),
|
|
34
35
|
/* @__PURE__ */ r(S, { sx: { flex: 1, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ r(_, { variant: "text", width: "60%", sx: { fontSize: "2.5rem" } }) }),
|
|
35
36
|
/* @__PURE__ */ r(_, { variant: "text", width: 140, sx: { fontSize: "0.875rem" } })
|
|
36
37
|
] }) });
|
|
37
|
-
const b = e != null ? kt(e, t) : null, y = e != null ? t - e : null, w = b != null ? s === "percentage" ? `${(b * 100).toFixed(1)}%` : `${o}${
|
|
38
|
-
return /* @__PURE__ */ r(S, { className: "bi-metric-card", sx: { height: "100%", p: 1, alignContent: "center" }, children: /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */ r(A, { variant: "body2", color: "text.secondary", sx: { letterSpacing: 0.6, lineHeight: 1.4, overflow: "clip" }, children:
|
|
38
|
+
const b = e != null ? kt(e, t) : null, y = e != null ? t - e : null, w = b != null ? s === "percentage" ? `${(b * 100).toFixed(1)}%` : `${o}${m(y)}${i}` : null, M = y != null ? St(y) : null, T = y != null ? y > 0 ? g.positive : y < 0 ? g.negative : g.neutral : void 0;
|
|
39
|
+
return /* @__PURE__ */ r(S, { className: "bi-metric-card", sx: { height: "100%", p: 1, alignContent: "center" }, children: /* @__PURE__ */ x(he, { spacing: 1, sx: { height: "100%" }, alignContent: "center", children: [
|
|
40
|
+
v && d && /* @__PURE__ */ x(he, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
41
|
+
f && /* @__PURE__ */ r(S, { sx: { color: "primary.main", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ r(A, { variant: "body2", children: f }) }),
|
|
42
|
+
/* @__PURE__ */ r(A, { variant: "body2", color: "text.secondary", sx: { letterSpacing: 0.6, lineHeight: 1.4, overflow: "clip" }, children: v })
|
|
42
43
|
] }),
|
|
43
|
-
/* @__PURE__ */ r(S, { sx: { flex: 1, display: "flex", alignItems: "center", minWidth: "100%", justifyContent: "center" }, children: /* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ r(S, { sx: { flex: 1, display: "flex", alignItems: "center", minWidth: "100%", justifyContent: "center" }, children: /* @__PURE__ */ x(A, { variant: "h5", sx: { fontWeight: 800, fontSize: "28px", letterSpacing: -0.5 }, children: [
|
|
44
45
|
o,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
m(t),
|
|
47
|
+
i
|
|
47
48
|
] }) }),
|
|
48
|
-
w && /* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
49
|
+
w && /* @__PURE__ */ x(he, { direction: "row", spacing: 0.5, alignItems: "center", justifyContent: "center", children: [
|
|
50
|
+
/* @__PURE__ */ x(A, { variant: "body1", className: "bi-metric-change", sx: { color: T, fontWeight: 700 }, children: [
|
|
50
51
|
M,
|
|
51
52
|
" ",
|
|
52
53
|
w
|
|
53
54
|
] }),
|
|
54
|
-
e != null && /* @__PURE__ */
|
|
55
|
+
e != null && /* @__PURE__ */ x(A, { variant: "caption", color: "text.secondary", children: [
|
|
55
56
|
"vs ",
|
|
56
57
|
o,
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
m(e),
|
|
59
|
+
i
|
|
59
60
|
] })
|
|
60
61
|
] }),
|
|
61
62
|
c && /* @__PURE__ */ r(A, { variant: "caption", color: "text.secondary", sx: { opacity: 0.8 }, children: c })
|
|
62
63
|
] }) });
|
|
63
64
|
}
|
|
64
|
-
p(
|
|
65
|
-
function or({ title: t, metrics: e, columns: o = 3, loading:
|
|
66
|
-
return
|
|
65
|
+
p(st, "MetricCard");
|
|
66
|
+
function or({ title: t, metrics: e, columns: o = 3, loading: i = !1 }) {
|
|
67
|
+
return i ? /* @__PURE__ */ x(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
67
68
|
t && /* @__PURE__ */ r(_, { variant: "text", width: 160, sx: { fontSize: "1.25rem", mb: 2 } }),
|
|
68
|
-
/* @__PURE__ */ r(S, { sx: { display: "grid", gridTemplateColumns: `repeat(${o}, 1fr)`, gap: 2 }, children: Array.from({ length: o }).map((s, c) => /* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ r(S, { sx: { display: "grid", gridTemplateColumns: `repeat(${o}, 1fr)`, gap: 2 }, children: Array.from({ length: o }).map((s, c) => /* @__PURE__ */ x(he, { spacing: 1, sx: { p: 1 }, children: [
|
|
69
70
|
/* @__PURE__ */ r(_, { variant: "text", width: 80, sx: { fontSize: "0.75rem" } }),
|
|
70
71
|
/* @__PURE__ */ r(_, { variant: "text", width: "70%", sx: { fontSize: "2rem" } }),
|
|
71
72
|
/* @__PURE__ */ r(_, { variant: "text", width: 100, sx: { fontSize: "0.75rem" } })
|
|
72
73
|
] }, c)) })
|
|
73
|
-
] }) : /* @__PURE__ */
|
|
74
|
+
] }) : /* @__PURE__ */ x(S, { sx: { height: "100%", p: 2 }, children: [
|
|
74
75
|
t && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 2 }, children: t }),
|
|
75
|
-
/* @__PURE__ */ r(S, { sx: { display: "grid", gridTemplateColumns: `repeat(${o}, 1fr)`, gap: 2 }, children: e.map((s, c) => /* @__PURE__ */ r(
|
|
76
|
+
/* @__PURE__ */ r(S, { sx: { display: "grid", gridTemplateColumns: `repeat(${o}, 1fr)`, gap: 2 }, children: e.map((s, c) => /* @__PURE__ */ r(st, { ...s }, c)) })
|
|
76
77
|
] });
|
|
77
78
|
}
|
|
78
79
|
p(or, "MetricGroupCard");
|
|
79
|
-
const
|
|
80
|
+
const te = Math.PI, be = 2 * Math.PI, q = 50, ce = q + 10, de = q + 10, ar = 10, ir = 2 * q + ar + 10, sr = q + 40;
|
|
80
81
|
function _e(t) {
|
|
81
|
-
return [ce +
|
|
82
|
+
return [ce + q * Math.cos(t), de + q * Math.sin(t)];
|
|
82
83
|
}
|
|
83
84
|
p(_e, "polarToXY");
|
|
84
|
-
function
|
|
85
|
-
const [o,
|
|
86
|
-
return `M ${o} ${
|
|
85
|
+
function Qe(t, e) {
|
|
86
|
+
const [o, i] = _e(t), [s, c] = _e(e), f = e - t > Math.PI ? 1 : 0;
|
|
87
|
+
return `M ${o} ${i} A ${q} ${q} 0 ${f} 1 ${s} ${c}`;
|
|
87
88
|
}
|
|
88
|
-
p(
|
|
89
|
-
function
|
|
90
|
-
const d =
|
|
91
|
-
return /* @__PURE__ */
|
|
89
|
+
p(Qe, "describeArc");
|
|
90
|
+
function Je({ zones: t, ratio: e, needleColor: o, strokeWidth: i, textPrimaryColor: s, textSecondaryColor: c, elementsClass: f, min: v, max: h, valueComponent: l, className: g, strokeLinecap: m = "round" }) {
|
|
91
|
+
const d = te + e * (be - te), [b, y] = _e(d);
|
|
92
|
+
return /* @__PURE__ */ x("svg", { className: g, x: "0", y: "0", viewBox: `0 0 ${ir} ${sr}`, width: "100%", height: "100%", preserveAspectRatio: "xMidYMid meet", children: [
|
|
92
93
|
t.map((w, M) => {
|
|
93
|
-
const T = Math.min(M > 0 ? t[M - 1].value : 0, 1), H =
|
|
94
|
+
const T = Math.min(M > 0 ? t[M - 1].value : 0, 1), H = te + T * (be - te), L = Math.min(te + w.value * (be - te), be);
|
|
94
95
|
return /* @__PURE__ */ r(
|
|
95
96
|
"path",
|
|
96
97
|
{
|
|
97
|
-
className:
|
|
98
|
-
d:
|
|
98
|
+
className: f,
|
|
99
|
+
d: Qe(H, L),
|
|
99
100
|
fill: "none",
|
|
100
101
|
stroke: w.color,
|
|
101
|
-
strokeWidth:
|
|
102
|
-
strokeLinecap: M === t.length - 1 ? "round" :
|
|
102
|
+
strokeWidth: i,
|
|
103
|
+
strokeLinecap: M === t.length - 1 ? "round" : m
|
|
103
104
|
},
|
|
104
105
|
M
|
|
105
106
|
);
|
|
106
107
|
}),
|
|
107
|
-
e > 5e-3 && /* @__PURE__ */ r("path", { className:
|
|
108
|
-
/* @__PURE__ */ r("line", { className:
|
|
109
|
-
/* @__PURE__ */ r("circle", { className:
|
|
108
|
+
e > 5e-3 && /* @__PURE__ */ r("path", { className: f, d: Qe(te, d), fill: "none", stroke: o, strokeWidth: i, strokeLinecap: "round" }),
|
|
109
|
+
/* @__PURE__ */ r("line", { className: f, x1: ce, y1: de, x2: b, y2: y, stroke: s, strokeWidth: 2.5, strokeLinecap: "round" }),
|
|
110
|
+
/* @__PURE__ */ r("circle", { className: f, cx: ce, cy: de, r: 4, fill: s }),
|
|
110
111
|
/* @__PURE__ */ r("text", { x: ce, y: de + 20, textAnchor: "middle", fill: s, fontSize: "14", fontWeight: "bold", children: l }),
|
|
111
|
-
/* @__PURE__ */ r("text", { x: ce -
|
|
112
|
-
/* @__PURE__ */ r("text", { x: ce +
|
|
112
|
+
/* @__PURE__ */ r("text", { x: ce - q, y: de + 12, textAnchor: "end", fill: c, fontSize: "8", children: v }),
|
|
113
|
+
/* @__PURE__ */ r("text", { x: ce + q - 10, y: de + 12, textAnchor: "start", fill: c, fontSize: "8", children: h })
|
|
113
114
|
] });
|
|
114
115
|
}
|
|
115
|
-
p(
|
|
116
|
-
function lr({ value: t, min: e = 0, max: o = 100, label:
|
|
116
|
+
p(Je, "GaugeSvg");
|
|
117
|
+
function lr({ value: t, min: e = 0, max: o = 100, label: i, prefix: s = "", suffix: c = "", thresholds: f, formatValue: v, loading: h = !1 }) {
|
|
117
118
|
var w;
|
|
118
|
-
const l = ue(),
|
|
119
|
+
const l = ue(), g = v ?? ne;
|
|
119
120
|
if (h) {
|
|
120
121
|
const M = l.palette.action.disabledBackground;
|
|
121
122
|
return /* @__PURE__ */ r(S, { className: "parallax-wrapper parallax-group", "data-testid": "loading", sx: { height: "100%", p: 0, display: "flex", flexDirection: "column", alignItems: "center" }, children: /* @__PURE__ */ r(
|
|
122
|
-
|
|
123
|
+
Je,
|
|
123
124
|
{
|
|
124
125
|
className: "parallax-layer layer-fg skeleton-card",
|
|
125
126
|
elementsClass: "svgElement",
|
|
@@ -136,7 +137,7 @@ function lr({ value: t, min: e = 0, max: o = 100, label: a, prefix: s = "", suff
|
|
|
136
137
|
}
|
|
137
138
|
) });
|
|
138
139
|
}
|
|
139
|
-
const
|
|
140
|
+
const m = o - e || 1, d = Math.max(0, Math.min(1, (t - e) / m)), b = f ?? [
|
|
140
141
|
{ value: 0.33, color: l.palette.error.main },
|
|
141
142
|
{ value: 0.66, color: l.palette.warning.main },
|
|
142
143
|
{ value: 1, color: l.palette.success.main }
|
|
@@ -147,10 +148,10 @@ function lr({ value: t, min: e = 0, max: o = 100, label: a, prefix: s = "", suff
|
|
|
147
148
|
y = M.color;
|
|
148
149
|
break;
|
|
149
150
|
}
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
|
|
151
|
+
return /* @__PURE__ */ x(S, { sx: { position: "relative", m: 0, height: "100%", p: 0, display: "flex", flexDirection: "column", alignItems: "center" }, children: [
|
|
152
|
+
i && /* @__PURE__ */ r(S, { sx: { position: "absolute", top: 100, left: 10 }, children: /* @__PURE__ */ r(A, { variant: "overline", color: "text.secondary", sx: { letterSpacing: 0.6 }, children: i }) }),
|
|
152
153
|
/* @__PURE__ */ r(S, { sx: { display: "inline-flex", mt: 0, alignItems: "normal", width: "100%", height: "inherit", alignContent: "center" }, children: /* @__PURE__ */ r(
|
|
153
|
-
|
|
154
|
+
Je,
|
|
154
155
|
{
|
|
155
156
|
zones: b,
|
|
156
157
|
ratio: d,
|
|
@@ -158,23 +159,23 @@ function lr({ value: t, min: e = 0, max: o = 100, label: a, prefix: s = "", suff
|
|
|
158
159
|
strokeWidth: 20,
|
|
159
160
|
textPrimaryColor: l.palette.text.primary,
|
|
160
161
|
textSecondaryColor: l.palette.text.secondary,
|
|
161
|
-
min:
|
|
162
|
-
max:
|
|
163
|
-
valueComponent: `${s}${
|
|
162
|
+
min: g(e),
|
|
163
|
+
max: g(o),
|
|
164
|
+
valueComponent: `${s}${g(t)}${c}`
|
|
164
165
|
}
|
|
165
166
|
) })
|
|
166
167
|
] });
|
|
167
168
|
}
|
|
168
169
|
p(lr, "GaugeCard");
|
|
169
|
-
const cr = /* @__PURE__ */ p((t) => /* @__PURE__ */
|
|
170
|
+
const cr = /* @__PURE__ */ p((t) => /* @__PURE__ */ x("div", { style: { height: "100%" }, children: [
|
|
170
171
|
/* @__PURE__ */ r(he, { direction: "row", gap: 1, sx: { height: "100%" }, children: t.gauges.map((e, o) => /* @__PURE__ */ r("div", { children: e }, e.key ?? o)) }),
|
|
171
172
|
t.footNote && /* @__PURE__ */ r("div", { className: "ds-card-footer", children: /* @__PURE__ */ r("small", { children: t.footNote }) })
|
|
172
173
|
] }), "GaugeGroup");
|
|
173
|
-
let
|
|
174
|
-
function
|
|
174
|
+
let et = !1;
|
|
175
|
+
function lt() {
|
|
175
176
|
var e, o;
|
|
176
|
-
if (
|
|
177
|
-
|
|
177
|
+
if (et) return;
|
|
178
|
+
et = !0;
|
|
178
179
|
let t;
|
|
179
180
|
try {
|
|
180
181
|
t = (o = (e = Ot).getLicenseKey) == null ? void 0 : o.call(e);
|
|
@@ -185,7 +186,7 @@ function st() {
|
|
|
185
186
|
"[@aintela/bi] MUI X licence key not set. DataTableCard uses @mui/x-data-grid-pro; call LicenseInfo.setLicenseKey('<your key>') (from '@mui/x-license' or '@mui/x-data-grid-pro') in the host before the first BI render, or the grid renders a watermark."
|
|
186
187
|
);
|
|
187
188
|
}
|
|
188
|
-
p(
|
|
189
|
+
p(lt, "warnIfMuiXLicenseMissing");
|
|
189
190
|
function dr(t) {
|
|
190
191
|
if (t) {
|
|
191
192
|
if (typeof t == "function") return t;
|
|
@@ -201,7 +202,7 @@ function dr(t) {
|
|
|
201
202
|
case "check":
|
|
202
203
|
return (e) => e != null && typeof e == "boolean" ? Ct(e) : le(e);
|
|
203
204
|
case "date":
|
|
204
|
-
return (e) => e instanceof Date ?
|
|
205
|
+
return (e) => e instanceof Date ? tt(e) : le(e);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
}
|
|
@@ -210,42 +211,42 @@ function hr(t) {
|
|
|
210
211
|
return t.operator === "isEmpty" || t.operator === "isNotEmpty" ? !0 : Array.isArray(t.value) ? t.value.length > 0 : t.value !== void 0 && t.value !== null && t.value !== "";
|
|
211
212
|
}
|
|
212
213
|
p(hr, "isActiveFilterItem");
|
|
213
|
-
function ur({ onCsvExport: t, onXlsxExport: e, onClearFilters: o, exporting:
|
|
214
|
-
var
|
|
215
|
-
const s = Gt(), c = Nt(s, Pt),
|
|
216
|
-
return /* @__PURE__ */
|
|
214
|
+
function ur({ onCsvExport: t, onXlsxExport: e, onClearFilters: o, exporting: i }) {
|
|
215
|
+
var v;
|
|
216
|
+
const s = Gt(), c = Nt(s, Pt), f = ((c == null ? void 0 : c.items) ?? []).some(hr) || (((v = c == null ? void 0 : c.quickFilterValues) == null ? void 0 : v.length) ?? 0) > 0;
|
|
217
|
+
return /* @__PURE__ */ x(zt, { children: [
|
|
217
218
|
/* @__PURE__ */ r(Ht, {}),
|
|
218
219
|
/* @__PURE__ */ r(Kt, {}),
|
|
219
|
-
/* @__PURE__ */ r(
|
|
220
|
-
o &&
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
t && /* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */ r(
|
|
220
|
+
/* @__PURE__ */ r(Ft, {}),
|
|
221
|
+
o && f && /* @__PURE__ */ r(yt, { size: "small", startIcon: /* @__PURE__ */ r(Bt, { fontSize: "small" }), onClick: o, sx: { textTransform: "none" }, children: "Limpar filtros" }),
|
|
222
|
+
/* @__PURE__ */ x(Wt, { children: [
|
|
223
|
+
t && /* @__PURE__ */ x(Ue, { disabled: i, onClick: t, children: [
|
|
224
|
+
/* @__PURE__ */ r(Et, { fontSize: "small", style: { marginRight: 8 } }),
|
|
224
225
|
"Exportar CSV (todos os dados)"
|
|
225
226
|
] }, "server-csv"),
|
|
226
|
-
e && /* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */ r(
|
|
227
|
+
e && /* @__PURE__ */ x(Ue, { disabled: i, onClick: e, children: [
|
|
228
|
+
/* @__PURE__ */ r($t, { fontSize: "small", style: { marginRight: 8 } }),
|
|
228
229
|
"Exportar Excel (todos os dados)"
|
|
229
230
|
] }, "server-xlsx")
|
|
230
231
|
] })
|
|
231
232
|
] });
|
|
232
233
|
}
|
|
233
234
|
p(ur, "ServerExportToolbar");
|
|
234
|
-
const pr = 11, mr = 30,
|
|
235
|
+
const pr = 11, mr = 30, ct = 80;
|
|
235
236
|
function fr(t) {
|
|
236
|
-
return Math.max(
|
|
237
|
+
return Math.max(ct, t.length * pr + mr);
|
|
237
238
|
}
|
|
238
239
|
p(fr, "estimateHeaderWidth");
|
|
239
240
|
function gr(t, e) {
|
|
240
241
|
return t.map((o) => {
|
|
241
|
-
const
|
|
242
|
+
const i = dr(o.format), s = o.label ?? o.field, c = o.minWidth ?? ct, f = e ? Math.max(c, fr(s)) : c, v = {
|
|
242
243
|
field: o.field,
|
|
243
244
|
headerName: s,
|
|
244
245
|
align: o.align,
|
|
245
246
|
headerAlign: o.align,
|
|
246
247
|
headerClassName: o.headerClassName ?? "bi-datatable--header",
|
|
247
248
|
width: o.width,
|
|
248
|
-
minWidth:
|
|
249
|
+
minWidth: f,
|
|
249
250
|
sortable: o.sortable !== !1,
|
|
250
251
|
filterable: o.filterable !== !1,
|
|
251
252
|
flex: o.width ? void 0 : 1,
|
|
@@ -253,11 +254,11 @@ function gr(t, e) {
|
|
|
253
254
|
renderCell: o.renderCell,
|
|
254
255
|
renderHeader: o.renderHeader
|
|
255
256
|
};
|
|
256
|
-
if (
|
|
257
|
-
const h =
|
|
257
|
+
if (i && (v.valueFormatter = (h) => i(h)), o.type === "singleSelect") {
|
|
258
|
+
const h = v;
|
|
258
259
|
h.type = "singleSelect", h.valueOptions = o.valueOptions, o.multiSelectDropdown && (h.filterOperators = _t().filter((l) => l.value === "isAnyOf"));
|
|
259
260
|
}
|
|
260
|
-
return
|
|
261
|
+
return v;
|
|
261
262
|
});
|
|
262
263
|
}
|
|
263
264
|
p(gr, "toGridColumns");
|
|
@@ -265,29 +266,29 @@ function xr({
|
|
|
265
266
|
data: t,
|
|
266
267
|
lazyData: e,
|
|
267
268
|
schema: o,
|
|
268
|
-
getRowClassName:
|
|
269
|
+
getRowClassName: i,
|
|
269
270
|
title: s,
|
|
270
271
|
striped: c,
|
|
271
|
-
stripedColorEven:
|
|
272
|
-
stripedColorOdd:
|
|
272
|
+
stripedColorEven: f,
|
|
273
|
+
stripedColorOdd: v,
|
|
273
274
|
getRowHeight: h,
|
|
274
275
|
headerColor: l,
|
|
275
|
-
pageSize:
|
|
276
|
-
dense:
|
|
276
|
+
pageSize: g,
|
|
277
|
+
dense: m = !0,
|
|
277
278
|
loading: d = !1,
|
|
278
279
|
autoFitHeaders: b = !0,
|
|
279
280
|
initialPinnedColumns: y
|
|
280
281
|
}) {
|
|
281
|
-
const w = ue(), M =
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
const w = ue(), M = Be.useRef(null), T = !!e;
|
|
283
|
+
rt(() => {
|
|
284
|
+
lt();
|
|
284
285
|
}, []), t && e && console.warn("[DataTableCard] Both `data` and `lazyData` were provided. These props are mutually exclusive. Using `lazyData` and ignoring `data`.");
|
|
285
|
-
const H =
|
|
286
|
+
const H = g ?? (T ? 50 : 20), [L, Z] = re({ page: 0, pageSize: H }), U = E(() => {
|
|
286
287
|
const k = o ?? (e == null ? void 0 : e.columnSchema) ?? (t == null ? void 0 : t.columnSchema);
|
|
287
288
|
return k ? k.build() : [];
|
|
288
|
-
}, [o, t == null ? void 0 : t.columnSchema, e == null ? void 0 : e.columnSchema]), G = e == null ? void 0 : e.getRows, D =
|
|
289
|
+
}, [o, t == null ? void 0 : t.columnSchema, e == null ? void 0 : e.columnSchema]), G = e == null ? void 0 : e.getRows, D = E(() => G ? { getRows: G } : void 0, [G]), { naked: $ } = Ne() ?? {}, j = vr({ containerRef: M, multiplier: $ ? 1 : 0.9, naked: $, minHeight: 300 }), K = E(() => gr(U, b), [U, b]), I = e == null ? void 0 : e.downloadCsv, X = e == null ? void 0 : e.downloadXlsx, B = (e == null ? void 0 : e.exporting) ?? !1, [u, N] = re(null), P = Be.useCallback(
|
|
289
290
|
async (k) => {
|
|
290
|
-
const O = k === "xlsx" ? X :
|
|
291
|
+
const O = k === "xlsx" ? X : I;
|
|
291
292
|
if (!O) return;
|
|
292
293
|
const se = k === "xlsx" ? "Excel" : "CSV";
|
|
293
294
|
N({ kind: "progress", message: `Exportando ${se}…` });
|
|
@@ -297,29 +298,29 @@ function xr({
|
|
|
297
298
|
console.error(`[DataTableCard] ${se} export failed`, fe), N({ kind: "error", message: fe instanceof Error ? fe.message : `Falha ao exportar ${se}` });
|
|
298
299
|
}
|
|
299
300
|
},
|
|
300
|
-
[
|
|
301
|
-
), z =
|
|
302
|
-
() =>
|
|
301
|
+
[I, X]
|
|
302
|
+
), z = E(() => I ? () => P("csv") : void 0, [I, P]), Q = E(() => X ? () => P("xlsx") : void 0, [X, P]), V = e == null ? void 0 : e.apiRef, oe = E(
|
|
303
|
+
() => V ? () => {
|
|
303
304
|
var k;
|
|
304
|
-
return (k =
|
|
305
|
+
return (k = V.current) == null ? void 0 : k.setFilterModel({ items: [], quickFilterValues: [] });
|
|
305
306
|
} : void 0,
|
|
306
|
-
[
|
|
307
|
-
),
|
|
308
|
-
if (!(!z && !
|
|
309
|
-
return { onCsvExport: z, onXlsxExport:
|
|
310
|
-
}, [z,
|
|
311
|
-
const k = { density:
|
|
307
|
+
[V]
|
|
308
|
+
), ae = E(() => {
|
|
309
|
+
if (!(!z && !Q && !oe))
|
|
310
|
+
return { onCsvExport: z, onXlsxExport: Q, onClearFilters: oe, exporting: B };
|
|
311
|
+
}, [z, Q, oe, B]), ve = E(() => {
|
|
312
|
+
const k = { density: m ? "compact" : "standard" };
|
|
312
313
|
return y && (k.pinnedColumns = y), k;
|
|
313
|
-
}, []), Me =
|
|
314
|
-
return /* @__PURE__ */
|
|
315
|
-
s &&
|
|
314
|
+
}, []), Me = E(() => t ? t.rows.map((k, O) => ({ id: O, ...k })) : [], [t]), ie = f ?? w.palette.action.hover, me = v ?? "transparent", Le = l ?? J(w.palette.primary.main, w.palette.mode === "dark" ? 0.24 : 0.1);
|
|
315
|
+
return /* @__PURE__ */ x(S, { "data-testid": d ? "loading" : "", sx: { width: "100%", height: "100%", p: m ? 1 : 2, display: "flex", flexDirection: "column", overflow: "auto" }, ref: M, children: [
|
|
316
|
+
s && $ && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: s }),
|
|
316
317
|
/* @__PURE__ */ r(
|
|
317
318
|
S,
|
|
318
319
|
{
|
|
319
320
|
sx: {
|
|
320
321
|
overflow: "auto",
|
|
321
322
|
height: `${j}px`,
|
|
322
|
-
"& .bi-datatable-row-even": { backgroundColor:
|
|
323
|
+
"& .bi-datatable-row-even": { backgroundColor: ie },
|
|
323
324
|
"& .bi-datatable-row-odd": { backgroundColor: me }
|
|
324
325
|
},
|
|
325
326
|
children: /* @__PURE__ */ r(
|
|
@@ -332,12 +333,12 @@ function xr({
|
|
|
332
333
|
loading: e.loading || d
|
|
333
334
|
} : { rows: Me, loading: d },
|
|
334
335
|
initialState: ve,
|
|
335
|
-
showToolbar: !!
|
|
336
|
-
slots:
|
|
336
|
+
showToolbar: !!ae,
|
|
337
|
+
slots: ae ? { toolbar: ur } : void 0,
|
|
337
338
|
getRowHeight: h,
|
|
338
339
|
columns: K,
|
|
339
340
|
getRowClassName: /* @__PURE__ */ p((k) => {
|
|
340
|
-
let O =
|
|
341
|
+
let O = i ? i(k) : "";
|
|
341
342
|
return O.length > 0 && (O += " "), c && (O += k.indexRelativeToCurrentPage % 2 === 0 ? "bi-datatable-row-even" : "bi-datatable-row-odd"), O;
|
|
342
343
|
}, "getRowClassName"),
|
|
343
344
|
disableRowSelectionOnClick: !0,
|
|
@@ -348,7 +349,7 @@ function xr({
|
|
|
348
349
|
onPaginationModelChange: Z,
|
|
349
350
|
slotProps: {
|
|
350
351
|
baseIconButton: { style: { backgroundColor: "transparent" } },
|
|
351
|
-
...
|
|
352
|
+
...ae ? { toolbar: ae } : {}
|
|
352
353
|
},
|
|
353
354
|
sx: {
|
|
354
355
|
fontSize: "14px",
|
|
@@ -370,19 +371,19 @@ function xr({
|
|
|
370
371
|
/* @__PURE__ */ r(
|
|
371
372
|
xt,
|
|
372
373
|
{
|
|
373
|
-
open:
|
|
374
|
-
autoHideDuration: (
|
|
374
|
+
open: u !== null,
|
|
375
|
+
autoHideDuration: (u == null ? void 0 : u.kind) === "progress" ? null : (u == null ? void 0 : u.kind) === "error" ? 6e3 : 3e3,
|
|
375
376
|
onClose: /* @__PURE__ */ p(() => N(null), "onClose"),
|
|
376
377
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
377
378
|
children: /* @__PURE__ */ r(
|
|
378
379
|
vt,
|
|
379
380
|
{
|
|
380
381
|
onClose: /* @__PURE__ */ p(() => N(null), "onClose"),
|
|
381
|
-
severity: (
|
|
382
|
-
icon: (
|
|
382
|
+
severity: (u == null ? void 0 : u.kind) === "error" ? "error" : (u == null ? void 0 : u.kind) === "success" ? "success" : "info",
|
|
383
|
+
icon: (u == null ? void 0 : u.kind) === "progress" ? /* @__PURE__ */ r(bt, { size: 16, color: "inherit" }) : void 0,
|
|
383
384
|
variant: "outlined",
|
|
384
385
|
sx: { bgcolor: "background.paper" },
|
|
385
|
-
children:
|
|
386
|
+
children: u == null ? void 0 : u.message
|
|
386
387
|
}
|
|
387
388
|
)
|
|
388
389
|
}
|
|
@@ -390,51 +391,31 @@ function xr({
|
|
|
390
391
|
] });
|
|
391
392
|
}
|
|
392
393
|
p(xr, "DataTableCard");
|
|
393
|
-
function vr({ containerRef: t, multiplier: e = 1, naked: o, minHeight:
|
|
394
|
-
const [s, c] =
|
|
395
|
-
return
|
|
394
|
+
function vr({ containerRef: t, multiplier: e = 1, naked: o, minHeight: i = 200 }) {
|
|
395
|
+
const [s, c] = re(i), f = nt(null), v = /* @__PURE__ */ p((h) => (h == null ? void 0 : h.parentElement) == null ? null : h != null && h.classList.contains("ds-card") ? h : v((h == null ? void 0 : h.parentElement) ?? null), "getParentGridCard");
|
|
396
|
+
return rt(() => {
|
|
396
397
|
const h = t.current;
|
|
397
398
|
if (!h || typeof ResizeObserver > "u") return;
|
|
398
|
-
const l =
|
|
399
|
-
|
|
400
|
-
const d = Math.floor(
|
|
401
|
-
|
|
402
|
-
c(() => d),
|
|
399
|
+
const l = v(h), g = new ResizeObserver((m) => {
|
|
400
|
+
f.current && clearTimeout(f.current);
|
|
401
|
+
const d = Math.floor(m[0].contentRect.height) * e;
|
|
402
|
+
f.current = setTimeout(() => {
|
|
403
|
+
c(() => d), f.current = null;
|
|
403
404
|
}, 50);
|
|
404
405
|
});
|
|
405
|
-
return l &&
|
|
406
|
+
return l && g.observe(l), s !== 200 && l && c((m) => m * e), () => g.disconnect();
|
|
406
407
|
}, [t == null ? void 0 : t.current, o, e]), s;
|
|
407
408
|
}
|
|
408
409
|
p(vr, "useContainerMeasurements");
|
|
409
|
-
function ct(t, e = 0, o = 0, a) {
|
|
410
|
-
const [s, c] = Q(e), [g, x] = Q(o);
|
|
411
|
-
return Pe(() => {
|
|
412
|
-
const h = t.current;
|
|
413
|
-
if (!h) return;
|
|
414
|
-
if (typeof ResizeObserver > "u") {
|
|
415
|
-
const u = h.getBoundingClientRect();
|
|
416
|
-
c(u.width), x(u.height);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
const l = new ResizeObserver((u) => {
|
|
420
|
-
const d = u[0];
|
|
421
|
-
d && (x(d.contentRect.height), c(d.contentRect.width));
|
|
422
|
-
});
|
|
423
|
-
l.observe(h);
|
|
424
|
-
const f = h.getBoundingClientRect();
|
|
425
|
-
return c(f.width), x(f.height), () => l.disconnect();
|
|
426
|
-
}, [t, a]), [s, g];
|
|
427
|
-
}
|
|
428
|
-
p(ct, "useContainerRectangle");
|
|
429
410
|
function br(t) {
|
|
430
|
-
return t instanceof Date ?
|
|
411
|
+
return t instanceof Date ? tt(t, "MM/DD") : String(t ?? "");
|
|
431
412
|
}
|
|
432
413
|
p(br, "defaultXFormatter");
|
|
433
|
-
function Ge(t, e, o,
|
|
414
|
+
function Ge(t, e, o, i = 0.25, s = 1) {
|
|
434
415
|
if (o <= 1) return t;
|
|
435
|
-
const c = e / Math.max(1, o - 1),
|
|
416
|
+
const c = e / Math.max(1, o - 1), f = i + (s - i) * c;
|
|
436
417
|
try {
|
|
437
|
-
return
|
|
418
|
+
return J(t, f);
|
|
438
419
|
} catch {
|
|
439
420
|
return t;
|
|
440
421
|
}
|
|
@@ -444,15 +425,15 @@ function yr({
|
|
|
444
425
|
data: t,
|
|
445
426
|
type: e,
|
|
446
427
|
xAxis: o,
|
|
447
|
-
series:
|
|
428
|
+
series: i,
|
|
448
429
|
title: s,
|
|
449
430
|
height: c = 300,
|
|
450
|
-
stacked:
|
|
451
|
-
showLegend:
|
|
431
|
+
stacked: f = !1,
|
|
432
|
+
showLegend: v = !0,
|
|
452
433
|
showGrid: h = !0,
|
|
453
434
|
showTooltip: l = !0,
|
|
454
|
-
formatXAxis:
|
|
455
|
-
formatYAxis:
|
|
435
|
+
formatXAxis: g,
|
|
436
|
+
formatYAxis: m,
|
|
456
437
|
xAxisConfig: d,
|
|
457
438
|
yAxisConfig: b,
|
|
458
439
|
loading: y = !1,
|
|
@@ -461,16 +442,16 @@ function yr({
|
|
|
461
442
|
backgroundColor: T,
|
|
462
443
|
gridColor: H
|
|
463
444
|
}) {
|
|
464
|
-
var
|
|
465
|
-
const L = ue(), { naked: Z } = Ne() ?? {}, U = t ? Array.isArray(t) ? t : t.rows : [], G =
|
|
466
|
-
...
|
|
467
|
-
__xLabel: (
|
|
468
|
-
})) : U, [U, o,
|
|
469
|
-
var
|
|
470
|
-
if (!
|
|
471
|
-
const C = { ...
|
|
472
|
-
return C.tick = { fill: Y, fontSize:
|
|
473
|
-
}, "resolveAxisProps"),
|
|
445
|
+
var We, Oe;
|
|
446
|
+
const L = ue(), { naked: Z } = Ne() ?? {}, U = t ? Array.isArray(t) ? t : t.rows : [], G = E(() => o ? U.map((a) => ({
|
|
447
|
+
...a,
|
|
448
|
+
__xLabel: (g ?? br)(a[o])
|
|
449
|
+
})) : U, [U, o, g]), D = m ?? ((a) => ne(a, 0)), $ = L.palette.text.secondary, ee = H ?? J(L.palette.text.primary, 0.12), j = o ? "__xLabel" : void 0, K = /* @__PURE__ */ p((a, R) => {
|
|
450
|
+
var W, ge;
|
|
451
|
+
if (!a) return R;
|
|
452
|
+
const C = { ...R }, Y = a.color ?? ((W = R.tick) == null ? void 0 : W.fill) ?? $, F = a.fontSize ?? ((ge = R.tick) == null ? void 0 : ge.fontSize) ?? 12;
|
|
453
|
+
return C.tick = { fill: Y, fontSize: F }, a.hide !== void 0 && (C.hide = a.hide), a.label !== void 0 && (C.label = { value: a.label, position: "insideBottom", offset: -4, fill: Y, fontSize: F }), a.tickAngle !== void 0 && (C.tick.angle = a.tickAngle, C.tick.textAnchor = a.tickAngle < 0 ? "end" : a.tickAngle > 0 ? "start" : "middle"), a.tickCount !== void 0 && (C.tickCount = a.tickCount), a.interval !== void 0 && (C.interval = a.interval), a.tickSize !== void 0 && (C.tickSize = a.tickSize), a.tickLine !== void 0 && (C.tickLine = a.tickLine), a.axisLine !== void 0 && (C.axisLine = a.axisLine), a.domain && (C.domain = a.domain), a.unit !== void 0 && (C.unit = a.unit), a.reversed !== void 0 && (C.reversed = a.reversed), a.width !== void 0 && (C.width = a.width), a.height !== void 0 && (C.height = a.height), a.scale !== void 0 && (C.scale = a.scale), C;
|
|
454
|
+
}, "resolveAxisProps"), I = 10, X = /* @__PURE__ */ p((a) => a.length > I ? a.slice(0, I) : a, "truncateLabel"), B = {
|
|
474
455
|
contentStyle: {
|
|
475
456
|
background: L.palette.background.paper,
|
|
476
457
|
border: `1px solid ${L.palette.divider}`,
|
|
@@ -478,7 +459,7 @@ function yr({
|
|
|
478
459
|
color: L.palette.text.primary
|
|
479
460
|
},
|
|
480
461
|
itemStyle: { color: L.palette.text.primary },
|
|
481
|
-
labelStyle: { color:
|
|
462
|
+
labelStyle: { color: $ },
|
|
482
463
|
// Recharts' default cursor is a hard-coded light grey overlay; give it
|
|
483
464
|
// both `fill` (BarChart hover rectangle) and `stroke` (Line/Area
|
|
484
465
|
// crosshair) from the theme so it belongs to either canvas.
|
|
@@ -487,138 +468,138 @@ function yr({
|
|
|
487
468
|
stroke: L.palette.action.selected,
|
|
488
469
|
strokeWidth: 1
|
|
489
470
|
}
|
|
490
|
-
},
|
|
491
|
-
var
|
|
492
|
-
return z ? ((
|
|
493
|
-
}),
|
|
494
|
-
if (
|
|
495
|
-
const
|
|
496
|
-
let
|
|
471
|
+
}, u = rr(), N = M ?? u.palette ?? we(L).series, P = u.monoShadePerCategory ?? !0, z = (u.rotateBasePerChart ?? !0) && N.length > 0, [Q] = re(() => {
|
|
472
|
+
var a;
|
|
473
|
+
return z ? ((a = u.allocateChartSlot) == null ? void 0 : a.call(u)) ?? 0 : 0;
|
|
474
|
+
}), V = /* @__PURE__ */ p((a) => N[((z ? Q : 0) + a) % N.length], "pickPaletteColor"), oe = Math.PI / 180, ae = /* @__PURE__ */ p(({ cx: a, cy: R, midAngle: C, innerRadius: Y, outerRadius: F, percent: W, fill: ge }) => {
|
|
475
|
+
if (a == null || R == null || Y == null || F == null) return null;
|
|
476
|
+
const je = Y + (F - Y) * 0.5, Xe = Number(a), Ye = Xe + je * Math.cos(-(C ?? 0) * oe), ft = Number(R) + je * Math.sin(-(C ?? 0) * oe);
|
|
477
|
+
let Ze = L.palette.text.primary;
|
|
497
478
|
if (ge)
|
|
498
479
|
try {
|
|
499
|
-
|
|
480
|
+
Ze = L.palette.getContrastText(ge);
|
|
500
481
|
} catch {
|
|
501
482
|
}
|
|
502
|
-
return /* @__PURE__ */ r("text", { x:
|
|
503
|
-
}, "renderCustomizedLabel"), ve =
|
|
483
|
+
return /* @__PURE__ */ r("text", { x: Ye, y: ft, fill: Ze, fontSize: 14, textAnchor: Ye > Xe ? "start" : "end", dominantBaseline: "central", children: `${((W ?? 1) * 100).toFixed(0)}%` });
|
|
484
|
+
}, "renderCustomizedLabel"), ve = i.map((a, R) => a.color ?? V(R)), Me = P && i.length === 1, ie = E(() => {
|
|
504
485
|
if (e !== "pie" && e !== "donut") return [];
|
|
505
|
-
const
|
|
506
|
-
name: X(j ? String(
|
|
507
|
-
value: Number(
|
|
486
|
+
const a = G.map((F, W) => ({
|
|
487
|
+
name: X(j ? String(F[j] ?? F[o] ?? W) : `#${W}`),
|
|
488
|
+
value: Number(i[0] ? F[i[0].dataKey] : 0) || 0
|
|
508
489
|
}));
|
|
509
|
-
if (
|
|
510
|
-
const
|
|
490
|
+
if (a.length <= w) return a;
|
|
491
|
+
const R = [...a].sort((F, W) => W.value - F.value), C = R.slice(0, w - 1), Y = R.slice(w - 1).reduce((F, W) => F + W.value, 0);
|
|
511
492
|
return [...C, { name: "Others", value: Y }];
|
|
512
|
-
}, [e, G, j, o,
|
|
493
|
+
}, [e, G, j, o, i, w]), me = nt(null), [, Le] = ot(me);
|
|
513
494
|
if (y || !t)
|
|
514
|
-
return /* @__PURE__ */
|
|
495
|
+
return /* @__PURE__ */ x(S, { "data-testid": "loading", sx: { height: "100%", p: 2, width: "100%", backgroundColor: T }, children: [
|
|
515
496
|
s && Z && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
516
497
|
e === "pie" || e === "donut" ? /* @__PURE__ */ r(S, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: c }, children: /* @__PURE__ */ r(_, { variant: "circular", width: Math.min(c * 0.7, 200), height: Math.min(c * 0.7, 200) }) }) : /* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: c })
|
|
517
498
|
] });
|
|
518
499
|
if (e === "pie" || e === "donut")
|
|
519
|
-
return /* @__PURE__ */
|
|
500
|
+
return /* @__PURE__ */ x(S, { ref: me, sx: { height: "100%", width: "100%", px: 0, backgroundColor: T }, children: [
|
|
520
501
|
s && Z && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 0.5 }, children: s }),
|
|
521
|
-
/* @__PURE__ */ r(ye, { width: "100%", height: Le || c, children: /* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ r(ye, { width: "100%", height: Le || c, children: /* @__PURE__ */ x(jt, { children: [
|
|
503
|
+
/* @__PURE__ */ x(
|
|
523
504
|
Xt,
|
|
524
505
|
{
|
|
525
|
-
data:
|
|
506
|
+
data: ie,
|
|
526
507
|
dataKey: "value",
|
|
527
508
|
nameKey: "name",
|
|
528
509
|
cx: "50%",
|
|
529
510
|
cy: "50%",
|
|
530
511
|
innerRadius: e === "donut" ? "50%" : 0,
|
|
531
512
|
outerRadius: "70%",
|
|
532
|
-
label:
|
|
513
|
+
label: ae,
|
|
533
514
|
labelLine: !1,
|
|
534
515
|
paddingAngle: 1,
|
|
535
516
|
children: [
|
|
536
|
-
|
|
537
|
-
|
|
517
|
+
ie.map((a, R) => /* @__PURE__ */ r(
|
|
518
|
+
qe,
|
|
538
519
|
{
|
|
539
|
-
fill: P &&
|
|
520
|
+
fill: P && ie.length > 1 ? Ge(V(0), R, ie.length) : V(R)
|
|
540
521
|
},
|
|
541
|
-
|
|
522
|
+
R
|
|
542
523
|
)),
|
|
543
|
-
l && /* @__PURE__ */ r(
|
|
524
|
+
l && /* @__PURE__ */ r(Ie, { ...B })
|
|
544
525
|
]
|
|
545
526
|
}
|
|
546
527
|
),
|
|
547
|
-
/* @__PURE__ */ r(
|
|
528
|
+
/* @__PURE__ */ r(Re, { wrapperStyle: { color: L.palette.text.secondary } })
|
|
548
529
|
] }) })
|
|
549
530
|
] });
|
|
550
531
|
if (e === "scatter")
|
|
551
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ x(S, { sx: { height: "100%", p: 0, backgroundColor: T }, children: [
|
|
552
533
|
s && Z && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: s }),
|
|
553
|
-
/* @__PURE__ */ r(ye, { width: "100%", height: c, children: /* @__PURE__ */
|
|
554
|
-
h && /* @__PURE__ */ r(
|
|
555
|
-
/* @__PURE__ */ r(
|
|
556
|
-
/* @__PURE__ */ r(
|
|
557
|
-
l && /* @__PURE__ */ r(
|
|
558
|
-
|
|
559
|
-
|
|
534
|
+
/* @__PURE__ */ r(ye, { width: "100%", height: c, children: /* @__PURE__ */ x(Yt, { margin: { top: 8, right: 16, bottom: d != null && d.tickAngle ? 24 : 8, left: 0 }, children: [
|
|
535
|
+
h && /* @__PURE__ */ r(De, { stroke: ee }),
|
|
536
|
+
/* @__PURE__ */ r(Ee, { dataKey: o, name: o, ...K(d, { tick: { fill: $, fontSize: 12 } }) }),
|
|
537
|
+
/* @__PURE__ */ r($e, { dataKey: (We = i[0]) == null ? void 0 : We.dataKey, tickFormatter: D, name: (Oe = i[0]) == null ? void 0 : Oe.name, ...K(b, { tick: { fill: $, fontSize: 12 } }) }),
|
|
538
|
+
l && /* @__PURE__ */ r(Ie, { ...B }),
|
|
539
|
+
v && /* @__PURE__ */ r(Re, { wrapperStyle: { color: L.palette.text.secondary } }),
|
|
540
|
+
i.map((a, R) => /* @__PURE__ */ r(Zt, { name: a.name ?? a.dataKey, data: G, fill: ve[R] }, a.dataKey))
|
|
560
541
|
] }) })
|
|
561
542
|
] });
|
|
562
|
-
const k = e === "bar" ? "barH" : e, O = k === "barH", se = k === "stackedArea" || k === "stackedBar", fe = k === "combo" ? Ut : k === "barH" || k === "barV" || k === "stackedBar" ?
|
|
563
|
-
return /* @__PURE__ */
|
|
543
|
+
const k = e === "bar" ? "barH" : e, O = k === "barH", se = k === "stackedArea" || k === "stackedBar", fe = k === "combo" ? Ut : k === "barH" || k === "barV" || k === "stackedBar" ? Vt : k === "area" || k === "stackedArea" ? qt : Dt, pt = O ? "vertical" : "horizontal", Te = f || se, mt = /* @__PURE__ */ p((a) => a.type ? a.type : k === "combo" || k === "barV" || k === "barH" || k === "stackedBar" ? "bar" : k === "area" || k === "stackedArea" ? "area" : "line", "resolveSeriesType");
|
|
544
|
+
return /* @__PURE__ */ x(S, { sx: { height: "100%", p: 0.3, backgroundColor: T }, ref: me, children: [
|
|
564
545
|
s && Z && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: s }),
|
|
565
|
-
/* @__PURE__ */ r(ye, { width: "100%", height: "100%", children: /* @__PURE__ */
|
|
566
|
-
h && /* @__PURE__ */ r(
|
|
567
|
-
O ? /* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */ r(
|
|
569
|
-
/* @__PURE__ */ r(
|
|
570
|
-
] }) : /* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */ r(
|
|
572
|
-
/* @__PURE__ */ r(
|
|
546
|
+
/* @__PURE__ */ r(ye, { width: "100%", height: "100%", children: /* @__PURE__ */ x(fe, { data: G, layout: pt, margin: { top: 0, right: 16, bottom: d != null && d.tickAngle ? 24 : 8, left: 0 }, style: { maxHeight: "95%" }, children: [
|
|
547
|
+
h && /* @__PURE__ */ r(De, { stroke: ee, strokeDasharray: "3 3" }),
|
|
548
|
+
O ? /* @__PURE__ */ x(xe, { children: [
|
|
549
|
+
/* @__PURE__ */ r(Ee, { type: "number", tickFormatter: D, ...K(d, { tick: { fill: $, fontSize: 12 } }) }),
|
|
550
|
+
/* @__PURE__ */ r($e, { type: "category", dataKey: j ?? o, ...K(b, { tick: { fill: $, fontSize: 12 }, width: 80 }) })
|
|
551
|
+
] }) : /* @__PURE__ */ x(xe, { children: [
|
|
552
|
+
/* @__PURE__ */ r(Ee, { dataKey: j ?? o, ...K(d, { tick: { fill: $, fontSize: 12 } }) }),
|
|
553
|
+
/* @__PURE__ */ r($e, { tickFormatter: D, ...K(b, { tick: { fill: $, fontSize: 12 } }) })
|
|
573
554
|
] }),
|
|
574
|
-
l && /* @__PURE__ */ r(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
const C = ve[
|
|
555
|
+
l && /* @__PURE__ */ r(Ie, { ...B }),
|
|
556
|
+
v && /* @__PURE__ */ r(Re, { wrapperStyle: { color: L.palette.text.secondary } }),
|
|
557
|
+
i.map((a, R) => {
|
|
558
|
+
const C = ve[R], Y = mt(a);
|
|
578
559
|
return Y === "bar" ? /* @__PURE__ */ r(
|
|
579
560
|
Qt,
|
|
580
561
|
{
|
|
581
|
-
dataKey:
|
|
582
|
-
name:
|
|
562
|
+
dataKey: a.dataKey,
|
|
563
|
+
name: a.name ?? a.dataKey,
|
|
583
564
|
fill: C,
|
|
584
565
|
stackId: Te ? "stack" : void 0,
|
|
585
566
|
radius: O ? [0, 4, 4, 0] : [4, 4, 0, 0],
|
|
586
567
|
maxBarSize: 24,
|
|
587
|
-
children: Me && G.map((
|
|
568
|
+
children: Me && G.map((F, W) => (
|
|
588
569
|
// Bars are typically sorted descending, so invert the shade
|
|
589
570
|
// index: the largest bar gets the strongest alpha.
|
|
590
|
-
/* @__PURE__ */ r(
|
|
571
|
+
/* @__PURE__ */ r(qe, { fill: Ge(C, G.length - 1 - W, G.length) }, W)
|
|
591
572
|
))
|
|
592
573
|
},
|
|
593
|
-
|
|
574
|
+
a.dataKey
|
|
594
575
|
) : Y === "area" ? /* @__PURE__ */ r(
|
|
595
576
|
Jt,
|
|
596
577
|
{
|
|
597
578
|
type: "monotone",
|
|
598
|
-
dataKey:
|
|
599
|
-
name:
|
|
579
|
+
dataKey: a.dataKey,
|
|
580
|
+
name: a.name ?? a.dataKey,
|
|
600
581
|
stroke: C,
|
|
601
582
|
fill: C,
|
|
602
583
|
fillOpacity: Te ? 0.6 : 0.15,
|
|
603
584
|
stackId: Te ? "stack" : void 0,
|
|
604
585
|
strokeWidth: 2
|
|
605
586
|
},
|
|
606
|
-
|
|
607
|
-
) : /* @__PURE__ */ r(er, { type: "monotone", dataKey:
|
|
587
|
+
a.dataKey
|
|
588
|
+
) : /* @__PURE__ */ r(er, { type: "monotone", dataKey: a.dataKey, name: a.name ?? a.dataKey, stroke: C, strokeWidth: 2, dot: !1, activeDot: { r: 4 } }, a.dataKey);
|
|
608
589
|
})
|
|
609
590
|
] }) })
|
|
610
591
|
] });
|
|
611
592
|
}
|
|
612
593
|
p(yr, "ChartCard");
|
|
613
594
|
function kr(t) {
|
|
614
|
-
const { x: e = 0, y: o = 0, width:
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
return /* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */ r("rect", { x: e, y: o, width:
|
|
619
|
-
|
|
620
|
-
/* @__PURE__ */ r("text", { x: e + 6, y: o + 16, fill:
|
|
621
|
-
s > 44 && /* @__PURE__ */ r("text", { x: e + 6, y: o + 32, fill:
|
|
595
|
+
const { x: e = 0, y: o = 0, width: i = 0, height: s = 0, name: c, size: f, fill: v, strokeColor: h, labelFor: l } = t, g = t.formatValue ?? ne;
|
|
596
|
+
if (i < 20 || s < 20) return null;
|
|
597
|
+
const m = v ? l(v) : h;
|
|
598
|
+
return /* @__PURE__ */ x("g", { children: [
|
|
599
|
+
/* @__PURE__ */ r("rect", { x: e, y: o, width: i, height: s, rx: 4, fill: v, stroke: h, strokeWidth: 1 }),
|
|
600
|
+
i > 50 && s > 30 && /* @__PURE__ */ x(xe, { children: [
|
|
601
|
+
/* @__PURE__ */ r("text", { x: e + 6, y: o + 16, fill: m, fontSize: 12, fontWeight: 600, children: (c ?? "").length > i / 7 ? (c ?? "").slice(0, Math.floor(i / 7)) + "…" : c }),
|
|
602
|
+
s > 44 && /* @__PURE__ */ r("text", { x: e + 6, y: o + 32, fill: J(m, 0.7), fontSize: 11, children: g(f ?? 0) })
|
|
622
603
|
] })
|
|
623
604
|
] });
|
|
624
605
|
}
|
|
@@ -627,122 +608,122 @@ function Sr({
|
|
|
627
608
|
data: t,
|
|
628
609
|
nameKey: e,
|
|
629
610
|
valueKey: o,
|
|
630
|
-
title:
|
|
611
|
+
title: i,
|
|
631
612
|
height: s = 300,
|
|
632
613
|
formatValue: c,
|
|
633
|
-
loading:
|
|
634
|
-
palette:
|
|
614
|
+
loading: f = !1,
|
|
615
|
+
palette: v
|
|
635
616
|
}) {
|
|
636
|
-
const h = ue(), l =
|
|
617
|
+
const h = ue(), l = v ?? we(h).series, g = E(() => t ? t.rows.map((d, b) => ({
|
|
637
618
|
name: String(d[e] ?? ""),
|
|
638
619
|
size: Math.max(0, Number(d[o]) || 0),
|
|
639
620
|
fill: l[b % l.length]
|
|
640
|
-
})) : [], [t, e, o, l]),
|
|
621
|
+
})) : [], [t, e, o, l]), m = /* @__PURE__ */ p((d) => {
|
|
641
622
|
try {
|
|
642
623
|
return h.palette.getContrastText(d);
|
|
643
624
|
} catch {
|
|
644
625
|
return h.palette.text.primary;
|
|
645
626
|
}
|
|
646
627
|
}, "labelFor");
|
|
647
|
-
return
|
|
648
|
-
|
|
628
|
+
return f || !t ? /* @__PURE__ */ x(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
629
|
+
i && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
649
630
|
/* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: s })
|
|
650
|
-
] }) : /* @__PURE__ */
|
|
651
|
-
|
|
652
|
-
|
|
631
|
+
] }) : /* @__PURE__ */ x(S, { sx: { height: "100%", p: 2 }, children: [
|
|
632
|
+
i && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: i }),
|
|
633
|
+
g.length === 0 ? /* @__PURE__ */ r(A, { variant: "body2", color: "text.secondary", children: "No data" }) : /* @__PURE__ */ r(ye, { width: "100%", height: s, children: /* @__PURE__ */ r(
|
|
653
634
|
tr,
|
|
654
635
|
{
|
|
655
|
-
data:
|
|
636
|
+
data: g,
|
|
656
637
|
dataKey: "size",
|
|
657
638
|
nameKey: "name",
|
|
658
639
|
stroke: h.palette.background.paper,
|
|
659
|
-
content: /* @__PURE__ */ r(kr, { formatValue: c, strokeColor: h.palette.background.paper, labelFor:
|
|
640
|
+
content: /* @__PURE__ */ r(kr, { formatValue: c, strokeColor: h.palette.background.paper, labelFor: m })
|
|
660
641
|
}
|
|
661
642
|
) })
|
|
662
643
|
] });
|
|
663
644
|
}
|
|
664
645
|
p(Sr, "TreeMapCard");
|
|
665
|
-
const
|
|
666
|
-
function
|
|
667
|
-
const { autoFit: o = !0, defaultZoom:
|
|
668
|
-
if (s &&
|
|
669
|
-
return { center: s, zoom:
|
|
646
|
+
const ze = 150, Cr = 300, wr = 140;
|
|
647
|
+
function He(t, e = {}) {
|
|
648
|
+
const { autoFit: o = !0, defaultZoom: i, center: s } = e;
|
|
649
|
+
if (s && i != null)
|
|
650
|
+
return { center: s, zoom: i };
|
|
670
651
|
if (!o || t.length === 0)
|
|
671
652
|
return {
|
|
672
653
|
center: s ?? [0, 20],
|
|
673
|
-
zoom:
|
|
654
|
+
zoom: i ?? 1
|
|
674
655
|
};
|
|
675
|
-
const c = t.map((H) => H.lat),
|
|
676
|
-
(l +
|
|
677
|
-
(
|
|
656
|
+
const c = t.map((H) => H.lat), f = t.map((H) => H.lng), v = Math.min(...c), h = Math.max(...c), l = Math.min(...f), g = Math.max(...f), m = s ?? [
|
|
657
|
+
(l + g) / 2,
|
|
658
|
+
(v + h) / 2
|
|
678
659
|
];
|
|
679
|
-
if (
|
|
680
|
-
return { center:
|
|
660
|
+
if (i != null)
|
|
661
|
+
return { center: m, zoom: i };
|
|
681
662
|
if (t.length === 1)
|
|
682
|
-
return { center:
|
|
683
|
-
const d = 1.5, b = Math.max(h -
|
|
684
|
-
return { center:
|
|
663
|
+
return { center: m, zoom: 4 };
|
|
664
|
+
const d = 1.5, b = Math.max(h - v, 5) * d, y = Math.max(g - l, 5) * d, w = wr / b, M = Cr / y, T = Math.max(1, Math.min(w, M, 20));
|
|
665
|
+
return { center: m, zoom: T };
|
|
685
666
|
}
|
|
686
|
-
p(
|
|
687
|
-
const
|
|
667
|
+
p(He, "computeMapViewport");
|
|
668
|
+
const Ke = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json", dt = "https://servicodados.ibge.gov.br/api/v3/malhas/paises/BR?formato=application/vnd.geo+json&qualidade=maxima&intrarregiao=UF", Mr = "https://servicodados.ibge.gov.br/api/v3/malhas/paises/BR?formato=application/vnd.geo+json&qualidade=minima&intrarregiao=municipio", Lr = [Ke, dt], ht = [Ke], ut = It(null), Tr = ut.Provider;
|
|
688
669
|
function Fe(t) {
|
|
689
|
-
const e =
|
|
670
|
+
const e = Rt(ut);
|
|
690
671
|
return t !== void 0 ? Array.isArray(t) ? t : [t] : e ?? ht;
|
|
691
672
|
}
|
|
692
673
|
p(Fe, "useGeoLayers");
|
|
693
|
-
function
|
|
694
|
-
const { k: h } =
|
|
695
|
-
return /* @__PURE__ */ r(xe, { children: t.map((l,
|
|
696
|
-
const
|
|
697
|
-
return /* @__PURE__ */ r(Ae, { coordinates: [l.lng, l.lat], children: /* @__PURE__ */
|
|
674
|
+
function Ir({ bubbles: t, maxVal: e, minBubbleSize: o, maxBubbleSize: i, fillColor: s, fmt: c, onHover: f, onLeave: v }) {
|
|
675
|
+
const { k: h } = Pe();
|
|
676
|
+
return /* @__PURE__ */ r(xe, { children: t.map((l, g) => {
|
|
677
|
+
const m = Math.abs(l.value) / e, d = o + m * (i - o), b = `${l.label ?? ""} ${c(l.value)}`.trim();
|
|
678
|
+
return /* @__PURE__ */ r(Ae, { coordinates: [l.lng, l.lat], children: /* @__PURE__ */ x("g", { transform: `scale(${1 / h})`, style: { cursor: "pointer" }, onMouseEnter: /* @__PURE__ */ p((y) => f(y, b), "onMouseEnter"), onMouseMove: /* @__PURE__ */ p((y) => f(y, b), "onMouseMove"), onMouseLeave: v, children: [
|
|
698
679
|
/* @__PURE__ */ r("circle", { r: d, fill: s, opacity: 0.45 }),
|
|
699
680
|
/* @__PURE__ */ r("circle", { r: d * 0.6, fill: s, opacity: 0.85 })
|
|
700
|
-
] }) },
|
|
681
|
+
] }) }, g);
|
|
701
682
|
}) });
|
|
702
683
|
}
|
|
703
|
-
p(
|
|
704
|
-
function
|
|
684
|
+
p(Ir, "BubbleMarkers");
|
|
685
|
+
function Rr({
|
|
705
686
|
data: t,
|
|
706
687
|
title: e,
|
|
707
688
|
height: o = 340,
|
|
708
|
-
minBubbleSize:
|
|
689
|
+
minBubbleSize: i = 4,
|
|
709
690
|
maxBubbleSize: s = 28,
|
|
710
691
|
color: c,
|
|
711
|
-
formatValue:
|
|
712
|
-
loading:
|
|
692
|
+
formatValue: f,
|
|
693
|
+
loading: v = !1,
|
|
713
694
|
defaultZoom: h,
|
|
714
695
|
center: l,
|
|
715
|
-
autoFit:
|
|
716
|
-
geoUrl:
|
|
696
|
+
autoFit: g = !0,
|
|
697
|
+
geoUrl: m
|
|
717
698
|
}) {
|
|
718
|
-
const d = ue(), b = (t == null ? void 0 : t.rows) ?? [], [y, w] =
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
721
|
-
const
|
|
722
|
-
w({ x:
|
|
699
|
+
const d = ue(), b = (t == null ? void 0 : t.rows) ?? [], [y, w] = re(null), M = f ?? ne, T = c ?? we(d).series[0], H = Fe(m), L = J(d.palette.text.primary, 0.06), Z = J(d.palette.text.primary, 0.09), U = d.palette.divider, G = d.palette.text.disabled, D = E(() => Math.max(1, ...b.map((I) => Math.abs(I.value))), [b]), $ = E(() => He(b, { autoFit: g, defaultZoom: h, center: l }), [b, g, h, l]), ee = ke((I, X) => {
|
|
700
|
+
const B = I.currentTarget.closest("svg");
|
|
701
|
+
if (!B) return;
|
|
702
|
+
const u = B.getBoundingClientRect();
|
|
703
|
+
w({ x: I.clientX - u.left, y: I.clientY - u.top, text: X });
|
|
723
704
|
}, []), j = ke(() => w(null), []);
|
|
724
|
-
if (
|
|
725
|
-
return /* @__PURE__ */
|
|
705
|
+
if (v)
|
|
706
|
+
return /* @__PURE__ */ x(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
726
707
|
e && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
727
708
|
/* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: o })
|
|
728
709
|
] });
|
|
729
710
|
const K = { default: { outline: "none" }, hover: { outline: "none" }, pressed: { outline: "none" } };
|
|
730
|
-
return /* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ x(S, { sx: { height: "100%", p: 0.5, overflow: "auto" }, children: [
|
|
731
712
|
e && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: e }),
|
|
732
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ x(S, { sx: { position: "relative" }, children: [
|
|
733
714
|
/* @__PURE__ */ r(
|
|
734
|
-
|
|
715
|
+
at,
|
|
735
716
|
{
|
|
736
717
|
projection: "geoMercator",
|
|
737
|
-
projectionConfig: { scale:
|
|
718
|
+
projectionConfig: { scale: ze },
|
|
738
719
|
width: 800,
|
|
739
720
|
height: 500,
|
|
740
721
|
style: { width: "100%", height: "100%", display: "block", background: d.palette.background.default, borderRadius: d.shape.borderRadius },
|
|
741
|
-
children: /* @__PURE__ */
|
|
722
|
+
children: /* @__PURE__ */ x(it, { center: $.center, zoom: $.zoom, minZoom: 1, maxZoom: 40, children: [
|
|
742
723
|
H.map(
|
|
743
|
-
(
|
|
724
|
+
(I, X) => X === 0 ? /* @__PURE__ */ r(Se, { geography: I, children: /* @__PURE__ */ p(({ geographies: B }) => B.map((u) => /* @__PURE__ */ r(Ce, { geography: u, fill: L, stroke: U, strokeWidth: 0.5, style: { ...K, hover: { outline: "none", fill: Z } } }, u.rsmKey)), "children") }, I) : /* @__PURE__ */ r(Se, { geography: I, children: /* @__PURE__ */ p(({ geographies: B }) => B.map((u) => /* @__PURE__ */ r(Ce, { geography: u, fill: "none", stroke: G, strokeWidth: 0.3, style: K }, u.rsmKey)), "children") }, I)
|
|
744
725
|
),
|
|
745
|
-
/* @__PURE__ */ r(
|
|
726
|
+
/* @__PURE__ */ r(Ir, { bubbles: b, maxVal: D, minBubbleSize: i, maxBubbleSize: s, fillColor: T, fmt: M, onHover: ee, onLeave: j })
|
|
746
727
|
] })
|
|
747
728
|
}
|
|
748
729
|
),
|
|
@@ -773,82 +754,82 @@ function Ir({
|
|
|
773
754
|
] })
|
|
774
755
|
] });
|
|
775
756
|
}
|
|
776
|
-
p(
|
|
777
|
-
function
|
|
778
|
-
const s = (t + o) / 2, c = Math.min(e,
|
|
779
|
-
return `M${t},${e} Q${s},${c} ${o},${
|
|
757
|
+
p(Rr, "MapBubblesCard");
|
|
758
|
+
function Er(t, e, o, i) {
|
|
759
|
+
const s = (t + o) / 2, c = Math.min(e, i) - Math.abs(o - t) * 0.15;
|
|
760
|
+
return `M${t},${e} Q${s},${c} ${o},${i}`;
|
|
780
761
|
}
|
|
781
|
-
p(
|
|
782
|
-
function
|
|
783
|
-
const { projection:
|
|
762
|
+
p(Er, "curvedPath");
|
|
763
|
+
function $r({ connections: t, maxVal: e, strokeColor: o, hoveredIdx: i, onHover: s, onLeave: c }) {
|
|
764
|
+
const { projection: f } = nr(), { k: v } = Pe(), h = E(
|
|
784
765
|
() => t.map((l) => {
|
|
785
|
-
const
|
|
786
|
-
return { ...l, x1: d, y1: b, x2: y, y2: w, width: T, d:
|
|
766
|
+
const g = f([l.fromLng, l.fromLat]), m = f([l.toLng, l.toLat]), d = (g == null ? void 0 : g[0]) ?? 0, b = (g == null ? void 0 : g[1]) ?? 0, y = (m == null ? void 0 : m[0]) ?? 0, w = (m == null ? void 0 : m[1]) ?? 0, T = 1 + Math.abs(l.value ?? 1) / e * 3;
|
|
767
|
+
return { ...l, x1: d, y1: b, x2: y, y2: w, width: T, d: Er(d, b, y, w) };
|
|
787
768
|
}),
|
|
788
|
-
[t,
|
|
769
|
+
[t, f, e]
|
|
789
770
|
);
|
|
790
|
-
return /* @__PURE__ */ r("g", { children: h.map((l,
|
|
791
|
-
/* @__PURE__ */ r("path", { d: l.d, fill: "none", stroke: "transparent", strokeWidth: (l.width + 8) /
|
|
792
|
-
/* @__PURE__ */ r("path", { d: l.d, fill: "none", stroke: o, strokeWidth: l.width /
|
|
793
|
-
] },
|
|
771
|
+
return /* @__PURE__ */ r("g", { children: h.map((l, g) => /* @__PURE__ */ x("g", { onMouseEnter: /* @__PURE__ */ p((m) => s(g, m), "onMouseEnter"), onMouseMove: /* @__PURE__ */ p((m) => s(g, m), "onMouseMove"), onMouseLeave: c, style: { cursor: "pointer" }, children: [
|
|
772
|
+
/* @__PURE__ */ r("path", { d: l.d, fill: "none", stroke: "transparent", strokeWidth: (l.width + 8) / v }),
|
|
773
|
+
/* @__PURE__ */ r("path", { d: l.d, fill: "none", stroke: o, strokeWidth: l.width / v, opacity: i === g ? 0.9 : 0.4, strokeLinecap: "round" })
|
|
774
|
+
] }, g)) });
|
|
794
775
|
}
|
|
795
|
-
p(
|
|
796
|
-
function
|
|
797
|
-
const { k: o } =
|
|
798
|
-
return /* @__PURE__ */ r(xe, { children: t.map((
|
|
799
|
-
/* @__PURE__ */ r(Ae, { coordinates: [
|
|
800
|
-
/* @__PURE__ */ r(Ae, { coordinates: [
|
|
776
|
+
p($r, "ConnectionArcs");
|
|
777
|
+
function Br({ connections: t, strokeColor: e }) {
|
|
778
|
+
const { k: o } = Pe();
|
|
779
|
+
return /* @__PURE__ */ r(xe, { children: t.map((i, s) => /* @__PURE__ */ x(Be.Fragment, { children: [
|
|
780
|
+
/* @__PURE__ */ r(Ae, { coordinates: [i.fromLng, i.fromLat], children: /* @__PURE__ */ r("circle", { r: 3 / o, fill: e, opacity: 0.8 }) }),
|
|
781
|
+
/* @__PURE__ */ r(Ae, { coordinates: [i.toLng, i.toLat], children: /* @__PURE__ */ r("circle", { r: 3 / o, fill: e, opacity: 0.8 }) })
|
|
801
782
|
] }, s)) });
|
|
802
783
|
}
|
|
803
|
-
p(
|
|
784
|
+
p(Br, "EndpointMarkers");
|
|
804
785
|
function Ar({
|
|
805
786
|
data: t,
|
|
806
787
|
title: e,
|
|
807
788
|
height: o = 340,
|
|
808
|
-
color:
|
|
789
|
+
color: i,
|
|
809
790
|
showEndpoints: s = !0,
|
|
810
791
|
formatValue: c,
|
|
811
|
-
loading:
|
|
812
|
-
defaultZoom:
|
|
792
|
+
loading: f = !1,
|
|
793
|
+
defaultZoom: v,
|
|
813
794
|
center: h,
|
|
814
795
|
autoFit: l = !0,
|
|
815
|
-
geoUrl:
|
|
796
|
+
geoUrl: g
|
|
816
797
|
}) {
|
|
817
|
-
const
|
|
818
|
-
(
|
|
819
|
-
const P = d[
|
|
798
|
+
const m = ue(), d = (t == null ? void 0 : t.rows) ?? [], [b, y] = re(null), [w, M] = re(null), T = c ?? ne, H = we(m).series, L = i ?? H[1 % H.length], Z = Fe(g), U = J(m.palette.text.primary, 0.06), G = J(m.palette.text.primary, 0.09), D = m.palette.divider, $ = m.palette.text.disabled, ee = E(() => Math.max(1, ...d.map((u) => Math.abs(u.value ?? 1))), [d]), j = E(() => d.flatMap((u) => [{ lat: u.fromLat, lng: u.fromLng }, { lat: u.toLat, lng: u.toLng }]), [d]), K = E(() => He(j, { autoFit: l, defaultZoom: v, center: h }), [j, l, v, h]), I = ke(
|
|
799
|
+
(u, N) => {
|
|
800
|
+
const P = d[u], z = `${P.label ?? ""} ${P.value != null ? T(P.value) : ""}`.trim();
|
|
820
801
|
if (!z) return;
|
|
821
|
-
const
|
|
822
|
-
if (!
|
|
823
|
-
const
|
|
824
|
-
M(
|
|
802
|
+
const Q = N.currentTarget.closest("svg");
|
|
803
|
+
if (!Q) return;
|
|
804
|
+
const V = Q.getBoundingClientRect();
|
|
805
|
+
M(u), y({ x: N.clientX - V.left, y: N.clientY - V.top, text: z });
|
|
825
806
|
},
|
|
826
807
|
[d, T]
|
|
827
808
|
), X = ke(() => {
|
|
828
809
|
M(null), y(null);
|
|
829
810
|
}, []);
|
|
830
|
-
if (
|
|
831
|
-
return /* @__PURE__ */
|
|
811
|
+
if (f)
|
|
812
|
+
return /* @__PURE__ */ x(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
832
813
|
e && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
833
814
|
/* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: o })
|
|
834
815
|
] });
|
|
835
|
-
const
|
|
836
|
-
return /* @__PURE__ */
|
|
816
|
+
const B = { default: { outline: "none" }, hover: { outline: "none" }, pressed: { outline: "none" } };
|
|
817
|
+
return /* @__PURE__ */ x(S, { sx: { height: "100%", p: 2, overflow: "auto" }, children: [
|
|
837
818
|
e && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: e }),
|
|
838
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ x(S, { sx: { position: "relative" }, children: [
|
|
839
820
|
/* @__PURE__ */ r(
|
|
840
|
-
|
|
821
|
+
at,
|
|
841
822
|
{
|
|
842
823
|
projection: "geoMercator",
|
|
843
|
-
projectionConfig: { scale:
|
|
824
|
+
projectionConfig: { scale: ze },
|
|
844
825
|
width: 800,
|
|
845
|
-
style: { width: "100%", height: "100%", display: "block", background:
|
|
846
|
-
children: /* @__PURE__ */
|
|
826
|
+
style: { width: "100%", height: "100%", display: "block", background: m.palette.background.default, borderRadius: m.shape.borderRadius },
|
|
827
|
+
children: /* @__PURE__ */ x(it, { center: K.center, zoom: K.zoom, minZoom: 1, maxZoom: 40, children: [
|
|
847
828
|
Z.map(
|
|
848
|
-
(
|
|
829
|
+
(u, N) => N === 0 ? /* @__PURE__ */ r(Se, { geography: u, children: /* @__PURE__ */ p(({ geographies: P }) => P.map((z) => /* @__PURE__ */ r(Ce, { geography: z, fill: U, stroke: D, strokeWidth: 0.5, style: { ...B, hover: { outline: "none", fill: G } } }, z.rsmKey)), "children") }, u) : /* @__PURE__ */ r(Se, { geography: u, children: /* @__PURE__ */ p(({ geographies: P }) => P.map((z) => /* @__PURE__ */ r(Ce, { geography: z, fill: "none", stroke: $, strokeWidth: 0.3, style: B }, z.rsmKey)), "children") }, u)
|
|
849
830
|
),
|
|
850
|
-
/* @__PURE__ */ r(
|
|
851
|
-
s && /* @__PURE__ */ r(
|
|
831
|
+
/* @__PURE__ */ r($r, { connections: d, maxVal: ee, strokeColor: L, hoveredIdx: w, onHover: I, onLeave: X }),
|
|
832
|
+
s && /* @__PURE__ */ r(Br, { connections: d, strokeColor: L })
|
|
852
833
|
] })
|
|
853
834
|
}
|
|
854
835
|
),
|
|
@@ -885,7 +866,7 @@ function n(t, e) {
|
|
|
885
866
|
}
|
|
886
867
|
p(n, "ll");
|
|
887
868
|
function pe(t) {
|
|
888
|
-
return t.map(([e, o],
|
|
869
|
+
return t.map(([e, o], i) => `${i === 0 ? "M" : "L"}${e.toFixed(0)},${o.toFixed(0)}`).join(" ") + " Z";
|
|
889
870
|
}
|
|
890
871
|
p(pe, "toPath");
|
|
891
872
|
const _r = pe([
|
|
@@ -1003,63 +984,62 @@ const _r = pe([
|
|
|
1003
984
|
n(-25, 115),
|
|
1004
985
|
n(-22, 115),
|
|
1005
986
|
n(-15, 122)
|
|
1006
|
-
]), Kr = [_r, Gr, Nr, Pr, zr, Hr],
|
|
1007
|
-
function
|
|
987
|
+
]), Kr = [_r, Gr, Nr, Pr, zr, Hr], Fr = "0 0 1000 500";
|
|
988
|
+
function Wr(t, e) {
|
|
1008
989
|
return n(t, e);
|
|
1009
990
|
}
|
|
1010
|
-
p(
|
|
1011
|
-
const
|
|
991
|
+
p(Wr, "latLngToXY");
|
|
992
|
+
const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1012
993
|
__proto__: null,
|
|
1013
|
-
BASE_SCALE:
|
|
994
|
+
BASE_SCALE: ze,
|
|
1014
995
|
CONTINENT_PATHS: Kr,
|
|
1015
996
|
ChartCard: yr,
|
|
1016
997
|
DataTableCard: xr,
|
|
1017
998
|
GEO_URL_BRAZIL_MUNICIPALITIES: Mr,
|
|
1018
999
|
GEO_URL_BRAZIL_STATES: dt,
|
|
1019
|
-
GEO_URL_WORLD:
|
|
1000
|
+
GEO_URL_WORLD: Ke,
|
|
1020
1001
|
GaugeCard: lr,
|
|
1021
1002
|
GaugeGroup: cr,
|
|
1022
1003
|
GeoLayersProvider: Tr,
|
|
1023
|
-
MAP_VIEWBOX:
|
|
1024
|
-
MapBubblesCard:
|
|
1004
|
+
MAP_VIEWBOX: Fr,
|
|
1005
|
+
MapBubblesCard: Rr,
|
|
1025
1006
|
MapConnectionsCard: Ar,
|
|
1026
|
-
MetricCard:
|
|
1007
|
+
MetricCard: st,
|
|
1027
1008
|
MetricGroupCard: or,
|
|
1028
1009
|
TreeMapCard: Sr,
|
|
1029
1010
|
brazilGeoLayers: Lr,
|
|
1030
1011
|
chartShade: Ge,
|
|
1031
|
-
computeMapViewport:
|
|
1032
|
-
latLngToXY:
|
|
1033
|
-
useContainerRectangle:
|
|
1012
|
+
computeMapViewport: He,
|
|
1013
|
+
latLngToXY: Wr,
|
|
1014
|
+
useContainerRectangle: ot,
|
|
1034
1015
|
useGeoLayers: Fe,
|
|
1035
|
-
warnIfMuiXLicenseMissing:
|
|
1016
|
+
warnIfMuiXLicenseMissing: lt,
|
|
1036
1017
|
worldGeoLayers: ht
|
|
1037
1018
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1038
1019
|
export {
|
|
1039
|
-
|
|
1020
|
+
ze as B,
|
|
1040
1021
|
Kr as C,
|
|
1041
1022
|
xr as D,
|
|
1042
1023
|
Mr as G,
|
|
1043
|
-
|
|
1024
|
+
Fr as M,
|
|
1044
1025
|
Sr as T,
|
|
1045
1026
|
yr as a,
|
|
1046
1027
|
dt as b,
|
|
1047
|
-
|
|
1028
|
+
Ke as c,
|
|
1048
1029
|
lr as d,
|
|
1049
1030
|
cr as e,
|
|
1050
1031
|
Tr as f,
|
|
1051
|
-
|
|
1032
|
+
Rr as g,
|
|
1052
1033
|
Ar as h,
|
|
1053
|
-
|
|
1034
|
+
st as i,
|
|
1054
1035
|
or as j,
|
|
1055
1036
|
Lr as k,
|
|
1056
1037
|
Ge as l,
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
st as w
|
|
1038
|
+
He as m,
|
|
1039
|
+
Wr as n,
|
|
1040
|
+
ht as o,
|
|
1041
|
+
ln as p,
|
|
1042
|
+
Fe as u,
|
|
1043
|
+
lt as w
|
|
1064
1044
|
};
|
|
1065
|
-
//# sourceMappingURL=index-
|
|
1045
|
+
//# sourceMappingURL=index-DeiweWw8.js.map
|