@aintela/bi 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +299 -0
- package/dist/BiClientProvider-CWJochvi.js +219 -0
- package/dist/BiClientProvider-CWJochvi.js.map +1 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js +32 -0
- package/dist/ChartCardDefaultsContext-Cl5T25H0.js.map +1 -0
- package/dist/ChartContext-C_f_6khG.js +14 -0
- package/dist/ChartContext-C_f_6khG.js.map +1 -0
- package/dist/DashboardParametersContext-Clv--79U.js +39 -0
- package/dist/DashboardParametersContext-Clv--79U.js.map +1 -0
- package/dist/cards/ChartCard.d.ts +62 -0
- package/dist/cards/DataTableCard.d.ts +55 -0
- package/dist/cards/GaugeCard.d.ts +20 -0
- package/dist/cards/GaugeGroup.d.ts +12 -0
- package/dist/cards/MapBubbles.d.ts +35 -0
- package/dist/cards/MapConnections.d.ts +28 -0
- package/dist/cards/MetricCard.d.ts +15 -0
- package/dist/cards/MetricGroupCard.d.ts +10 -0
- package/dist/cards/TreeMapCard.d.ts +15 -0
- package/dist/cards/geoLayers.d.ts +23 -0
- package/dist/cards/index.d.ts +24 -0
- package/dist/cards/licenseGuard.d.ts +9 -0
- package/dist/cards/mapUtils.d.ts +23 -0
- package/dist/cards/useContainerRectangle.d.ts +9 -0
- package/dist/cards/worldMapPath.d.ts +7 -0
- package/dist/cards.d.ts +2 -0
- package/dist/cards.js +28 -0
- package/dist/cards.js.map +1 -0
- package/dist/client/BiClient.d.ts +160 -0
- package/dist/client/BiClientProvider.d.ts +21 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/composer/environment/environmentDom.d.ts +31 -0
- package/dist/composer/environment/types.d.ts +67 -0
- package/dist/composer/icons/cardTypeIcons.d.ts +31 -0
- package/dist/composer/index.d.ts +66 -0
- package/dist/composer/llm/ExampleCardSketch.d.ts +22 -0
- package/dist/composer/llm/ExamplePad.d.ts +18 -0
- package/dist/composer/llm/PrototypePad.d.ts +13 -0
- package/dist/composer/llm/useDashboardPad.d.ts +25 -0
- package/dist/composer/models/catalog.d.ts +33 -0
- package/dist/composer/models/sketchModels.d.ts +102 -0
- package/dist/composer/models/utils.d.ts +9 -0
- package/dist/composer/pad/CardSketch.d.ts +25 -0
- package/dist/composer/pad/ClonedComponent.d.ts +13 -0
- package/dist/composer/pad/DashboardPad.d.ts +38 -0
- package/dist/composer/pad/DashboardPadEditor.d.ts +35 -0
- package/dist/composer/pad/DashboardPadSketch.d.ts +31 -0
- package/dist/composer/pad/DatasetParameterizationControls.d.ts +34 -0
- package/dist/composer/pad/FilterSketch.d.ts +10 -0
- package/dist/composer/pad/HoverButton.d.ts +12 -0
- package/dist/composer/pad/TitleSketch.d.ts +19 -0
- package/dist/composer/pad/ToolBox.d.ts +11 -0
- package/dist/composer/store/ComposerProvider.d.ts +36 -0
- package/dist/composer/store/createComposerStore.d.ts +107 -0
- package/dist/composer/store/drafts.d.ts +20 -0
- package/dist/composer/view/ComposerChatBinding.d.ts +10 -0
- package/dist/composer/view/ComposerView.d.ts +49 -0
- package/dist/composer/view/DashboardPin.d.ts +3 -0
- package/dist/composer/view/DashboardSidePanel.d.ts +10 -0
- package/dist/composer/view/DrawablePrompt.d.ts +22 -0
- package/dist/composer/view/EntryEmptyState.d.ts +22 -0
- package/dist/composer/view/SpotlightOverlay.d.ts +21 -0
- package/dist/composer/view/composerAnimations.d.ts +11 -0
- package/dist/composer/view/composerTypes.d.ts +18 -0
- package/dist/composer/view/data/suggestions.d.ts +10 -0
- package/dist/composer/view/data/templates.d.ts +33 -0
- package/dist/composer/view/surfaces.d.ts +19 -0
- package/dist/composer/view/useComposerChatBridge.d.ts +43 -0
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +99 -0
- package/dist/composer.js.map +1 -0
- package/dist/createBiTheme-TyUv_UHM.js +93 -0
- package/dist/createBiTheme-TyUv_UHM.js.map +1 -0
- package/dist/data/ChartCardDefaultsContext.d.ts +43 -0
- package/dist/data/dataUtils.d.ts +152 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/queryModel.d.ts +23 -0
- package/dist/data.d.ts +2 -0
- package/dist/data.js +37 -0
- package/dist/data.js.map +1 -0
- package/dist/dataUtils-CAUE5uZY.js +372 -0
- package/dist/dataUtils-CAUE5uZY.js.map +1 -0
- package/dist/filters/VizAutoComplete.d.ts +23 -0
- package/dist/filters/VizDatePicker.d.ts +9 -0
- package/dist/filters/VizDateRangePicker.d.ts +14 -0
- package/dist/filters/VizSelect.d.ts +12 -0
- package/dist/filters/VizTextField.d.ts +8 -0
- package/dist/filters/VizTriggerButton.d.ts +9 -0
- package/dist/filters/filterFactory.d.ts +30 -0
- package/dist/filters/friendlyName.d.ts +4 -0
- package/dist/filters/index.d.ts +15 -0
- package/dist/filters.d.ts +2 -0
- package/dist/filters.js +15 -0
- package/dist/filters.js.map +1 -0
- package/dist/grid/BiErrorBoundary.d.ts +24 -0
- package/dist/grid/ChartContext.d.ts +14 -0
- package/dist/grid/GridCard.d.ts +45 -0
- package/dist/grid/GridCardPlaceHolder.d.ts +8 -0
- package/dist/grid/GridLayout.d.ts +147 -0
- package/dist/grid/gridModels.d.ts +33 -0
- package/dist/grid/index.d.ts +14 -0
- package/dist/grid/types.d.ts +23 -0
- package/dist/grid/useGridConfigTranslator.d.ts +72 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +20 -0
- package/dist/grid.js.map +1 -0
- package/dist/hooks/DashboardParametersContext.d.ts +32 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/useDashboardData.d.ts +20 -0
- package/dist/hooks/useDashboardLazyData.d.ts +79 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +16 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-BYc79sSy.js +131 -0
- package/dist/index-BYc79sSy.js.map +1 -0
- package/dist/index-C6JQ6770.js +4545 -0
- package/dist/index-C6JQ6770.js.map +1 -0
- package/dist/index-CZbCaXMC.js +15 -0
- package/dist/index-CZbCaXMC.js.map +1 -0
- package/dist/index-D3OoOPjl.js +259 -0
- package/dist/index-D3OoOPjl.js.map +1 -0
- package/dist/index-D7Oo_dC-.js +94 -0
- package/dist/index-D7Oo_dC-.js.map +1 -0
- package/dist/index-D7tVPX8d.js +347 -0
- package/dist/index-D7tVPX8d.js.map +1 -0
- package/dist/index-DGyvUtY3.js +494 -0
- package/dist/index-DGyvUtY3.js.map +1 -0
- package/dist/index-DOpx0R4Y.js +41 -0
- package/dist/index-DOpx0R4Y.js.map +1 -0
- package/dist/index-wtSLspPh.js +1065 -0
- package/dist/index-wtSLspPh.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/dist/inline/Chart.d.ts +29 -0
- package/dist/inline/IFrame.d.ts +19 -0
- package/dist/inline/Metric.d.ts +16 -0
- package/dist/inline/MetricGroup.d.ts +11 -0
- package/dist/inline/index.d.ts +9 -0
- package/dist/inline/parseKnownNumbers.d.ts +11 -0
- package/dist/inline.d.ts +2 -0
- package/dist/inline.js +9 -0
- package/dist/inline.js.map +1 -0
- package/dist/runtime/IDashboardDefinition.d.ts +22 -0
- package/dist/runtime/biModuleSurface.d.ts +2 -0
- package/dist/runtime/createBiUiTools.d.ts +74 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/loadDashboardBundle.d.ts +32 -0
- package/dist/runtime/registerBiModules.d.ts +36 -0
- package/dist/runtime/version.d.ts +6 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +19 -0
- package/dist/runtime.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/BiThemeBridge.d.ts +32 -0
- package/dist/theme/biPalette.d.ts +23 -0
- package/dist/theme/createBiTheme.d.ts +25 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +15 -0
- package/dist/theme.js.map +1 -0
- package/dist/version-DnqajORq.js +83 -0
- package/dist/version-DnqajORq.js.map +1 -0
- package/dist/viewer/ScriptDashboardViewer.d.ts +82 -0
- package/dist/viewer/ScriptDashboardViewerVertical.d.ts +24 -0
- package/dist/viewer/cardMetadata.d.ts +15 -0
- package/dist/viewer/index.d.ts +8 -0
- package/dist/viewer/models.d.ts +67 -0
- package/dist/viewer/useDashboardBundle.d.ts +73 -0
- package/dist/viewer.d.ts +2 -0
- package/dist/viewer.js +9 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +196 -0
|
@@ -0,0 +1,1065 @@
|
|
|
1
|
+
var gt = Object.defineProperty;
|
|
2
|
+
var p = (t, e) => gt(t, "name", { value: e, configurable: !0 });
|
|
3
|
+
import { jsx as r, jsxs as v, 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 qe } from "@mui/material";
|
|
5
|
+
import { p as kt, h as ne, v as St, j as rt, s as le, g as Ct, m as wt, i as Mt, l as Lt } from "./dataUtils-CAUE5uZY.js";
|
|
6
|
+
import { u as Tt, r as we } from "./createBiTheme-TyUv_UHM.js";
|
|
7
|
+
import { u as Ne } from "./ChartContext-C_f_6khG.js";
|
|
8
|
+
import $e, { useEffect as Pe, useState as Q, useMemo as B, useRef as nt, createContext as Rt, useContext as It, useCallback as ke } from "react";
|
|
9
|
+
import { alpha as ee } from "@mui/material/styles";
|
|
10
|
+
import Bt from "@mui/icons-material/FileDownloadOutlined";
|
|
11
|
+
import Et from "@mui/icons-material/TableViewOutlined";
|
|
12
|
+
import $t 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 Wt, GridToolbarExportContainer as Ft } from "@mui/x-data-grid-pro";
|
|
14
|
+
import { LicenseInfo as Ot } from "@mui/x-license";
|
|
15
|
+
import { ResponsiveContainer as ye, PieChart as jt, Pie as Xt, Cell as De, Tooltip as Re, Legend as Ie, ScatterChart as Yt, CartesianGrid as Qe, XAxis as Be, YAxis as Ee, Scatter as Zt, ComposedChart as Ut, BarChart as qt, AreaChart as Vt, LineChart as Dt, Bar as Qt, Area as Jt, Line as er, Treemap as tr } from "recharts";
|
|
16
|
+
import { u as rr } from "./ChartCardDefaultsContext-Cl5T25H0.js";
|
|
17
|
+
import { ComposableMap as ot, ZoomableGroup as it, Geographies as Se, Geography as Ce, useZoomPanContext as ze, Marker as Ae, useMapContext as nr } from "react-simple-maps";
|
|
18
|
+
function at({
|
|
19
|
+
currentValue: t,
|
|
20
|
+
previousValue: e,
|
|
21
|
+
prefix: o = "",
|
|
22
|
+
suffix: a = "",
|
|
23
|
+
differenceStyle: s = "percentage",
|
|
24
|
+
description: c,
|
|
25
|
+
icon: g,
|
|
26
|
+
label: x,
|
|
27
|
+
formatValue: h,
|
|
28
|
+
loading: l = !1
|
|
29
|
+
}) {
|
|
30
|
+
const f = Tt(), u = h ?? ne, { naked: d } = Ne() ?? {};
|
|
31
|
+
if (l)
|
|
32
|
+
return /* @__PURE__ */ r(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: /* @__PURE__ */ v(he, { spacing: 1, sx: { height: "100%" }, children: [
|
|
33
|
+
/* @__PURE__ */ r(_, { variant: "text", width: 100, sx: { fontSize: "0.75rem" } }),
|
|
34
|
+
/* @__PURE__ */ r(S, { sx: { flex: 1, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ r(_, { variant: "text", width: "60%", sx: { fontSize: "2.5rem" } }) }),
|
|
35
|
+
/* @__PURE__ */ r(_, { variant: "text", width: 140, sx: { fontSize: "0.875rem" } })
|
|
36
|
+
] }) });
|
|
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}${u(y)}${a}` : null, M = y != null ? St(y) : null, T = y != null ? y > 0 ? f.positive : y < 0 ? f.negative : f.neutral : void 0;
|
|
38
|
+
return /* @__PURE__ */ r(S, { className: "bi-metric-card", sx: { height: "100%", p: 1, alignContent: "center" }, children: /* @__PURE__ */ v(he, { spacing: 1, sx: { height: "100%" }, alignContent: "center", children: [
|
|
39
|
+
x && d && /* @__PURE__ */ v(he, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
40
|
+
g && /* @__PURE__ */ r(S, { sx: { color: "primary.main", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ r(A, { variant: "body2", children: g }) }),
|
|
41
|
+
/* @__PURE__ */ r(A, { variant: "body2", color: "text.secondary", sx: { letterSpacing: 0.6, lineHeight: 1.4, overflow: "clip" }, children: x })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ r(S, { sx: { flex: 1, display: "flex", alignItems: "center", minWidth: "100%", justifyContent: "center" }, children: /* @__PURE__ */ v(A, { variant: "h5", sx: { fontWeight: 800, fontSize: "28px", letterSpacing: -0.5 }, children: [
|
|
44
|
+
o,
|
|
45
|
+
u(t),
|
|
46
|
+
a
|
|
47
|
+
] }) }),
|
|
48
|
+
w && /* @__PURE__ */ v(he, { direction: "row", spacing: 0.5, alignItems: "center", justifyContent: "center", children: [
|
|
49
|
+
/* @__PURE__ */ v(A, { variant: "body1", className: "bi-metric-change", sx: { color: T, fontWeight: 700 }, children: [
|
|
50
|
+
M,
|
|
51
|
+
" ",
|
|
52
|
+
w
|
|
53
|
+
] }),
|
|
54
|
+
e != null && /* @__PURE__ */ v(A, { variant: "caption", color: "text.secondary", children: [
|
|
55
|
+
"vs ",
|
|
56
|
+
o,
|
|
57
|
+
u(e),
|
|
58
|
+
a
|
|
59
|
+
] })
|
|
60
|
+
] }),
|
|
61
|
+
c && /* @__PURE__ */ r(A, { variant: "caption", color: "text.secondary", sx: { opacity: 0.8 }, children: c })
|
|
62
|
+
] }) });
|
|
63
|
+
}
|
|
64
|
+
p(at, "MetricCard");
|
|
65
|
+
function or({ title: t, metrics: e, columns: o = 3, loading: a = !1 }) {
|
|
66
|
+
return a ? /* @__PURE__ */ v(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
67
|
+
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__ */ v(he, { spacing: 1, sx: { p: 1 }, children: [
|
|
69
|
+
/* @__PURE__ */ r(_, { variant: "text", width: 80, sx: { fontSize: "0.75rem" } }),
|
|
70
|
+
/* @__PURE__ */ r(_, { variant: "text", width: "70%", sx: { fontSize: "2rem" } }),
|
|
71
|
+
/* @__PURE__ */ r(_, { variant: "text", width: 100, sx: { fontSize: "0.75rem" } })
|
|
72
|
+
] }, c)) })
|
|
73
|
+
] }) : /* @__PURE__ */ v(S, { sx: { height: "100%", p: 2 }, children: [
|
|
74
|
+
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(at, { ...s }, c)) })
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
p(or, "MetricGroupCard");
|
|
79
|
+
const re = Math.PI, be = 2 * Math.PI, V = 50, ce = V + 10, de = V + 10, ir = 10, ar = 2 * V + ir + 10, sr = V + 40;
|
|
80
|
+
function _e(t) {
|
|
81
|
+
return [ce + V * Math.cos(t), de + V * Math.sin(t)];
|
|
82
|
+
}
|
|
83
|
+
p(_e, "polarToXY");
|
|
84
|
+
function Je(t, e) {
|
|
85
|
+
const [o, a] = _e(t), [s, c] = _e(e), g = e - t > Math.PI ? 1 : 0;
|
|
86
|
+
return `M ${o} ${a} A ${V} ${V} 0 ${g} 1 ${s} ${c}`;
|
|
87
|
+
}
|
|
88
|
+
p(Je, "describeArc");
|
|
89
|
+
function et({ zones: t, ratio: e, needleColor: o, strokeWidth: a, textPrimaryColor: s, textSecondaryColor: c, elementsClass: g, min: x, max: h, valueComponent: l, className: f, strokeLinecap: u = "round" }) {
|
|
90
|
+
const d = re + e * (be - re), [b, y] = _e(d);
|
|
91
|
+
return /* @__PURE__ */ v("svg", { className: f, x: "0", y: "0", viewBox: `0 0 ${ar} ${sr}`, width: "100%", height: "100%", preserveAspectRatio: "xMidYMid meet", children: [
|
|
92
|
+
t.map((w, M) => {
|
|
93
|
+
const T = Math.min(M > 0 ? t[M - 1].value : 0, 1), H = re + T * (be - re), L = Math.min(re + w.value * (be - re), be);
|
|
94
|
+
return /* @__PURE__ */ r(
|
|
95
|
+
"path",
|
|
96
|
+
{
|
|
97
|
+
className: g,
|
|
98
|
+
d: Je(H, L),
|
|
99
|
+
fill: "none",
|
|
100
|
+
stroke: w.color,
|
|
101
|
+
strokeWidth: a,
|
|
102
|
+
strokeLinecap: M === t.length - 1 ? "round" : u
|
|
103
|
+
},
|
|
104
|
+
M
|
|
105
|
+
);
|
|
106
|
+
}),
|
|
107
|
+
e > 5e-3 && /* @__PURE__ */ r("path", { className: g, d: Je(re, d), fill: "none", stroke: o, strokeWidth: a, strokeLinecap: "round" }),
|
|
108
|
+
/* @__PURE__ */ r("line", { className: g, x1: ce, y1: de, x2: b, y2: y, stroke: s, strokeWidth: 2.5, strokeLinecap: "round" }),
|
|
109
|
+
/* @__PURE__ */ r("circle", { className: g, cx: ce, cy: de, r: 4, fill: s }),
|
|
110
|
+
/* @__PURE__ */ r("text", { x: ce, y: de + 20, textAnchor: "middle", fill: s, fontSize: "14", fontWeight: "bold", children: l }),
|
|
111
|
+
/* @__PURE__ */ r("text", { x: ce - V, y: de + 12, textAnchor: "end", fill: c, fontSize: "8", children: x }),
|
|
112
|
+
/* @__PURE__ */ r("text", { x: ce + V - 10, y: de + 12, textAnchor: "start", fill: c, fontSize: "8", children: h })
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
p(et, "GaugeSvg");
|
|
116
|
+
function lr({ value: t, min: e = 0, max: o = 100, label: a, prefix: s = "", suffix: c = "", thresholds: g, formatValue: x, loading: h = !1 }) {
|
|
117
|
+
var w;
|
|
118
|
+
const l = ue(), f = x ?? ne;
|
|
119
|
+
if (h) {
|
|
120
|
+
const M = l.palette.action.disabledBackground;
|
|
121
|
+
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
|
+
et,
|
|
123
|
+
{
|
|
124
|
+
className: "parallax-layer layer-fg skeleton-card",
|
|
125
|
+
elementsClass: "svgElement",
|
|
126
|
+
zones: [{ color: M, value: 0.33 }, { color: M, value: 0.7 }, { color: M, value: 1 }],
|
|
127
|
+
ratio: 0.5,
|
|
128
|
+
strokeLinecap: "butt",
|
|
129
|
+
needleColor: "inherit",
|
|
130
|
+
strokeWidth: 20,
|
|
131
|
+
textPrimaryColor: l.palette.text.disabled,
|
|
132
|
+
textSecondaryColor: l.palette.text.disabled,
|
|
133
|
+
min: "",
|
|
134
|
+
max: "",
|
|
135
|
+
valueComponent: "Loading"
|
|
136
|
+
}
|
|
137
|
+
) });
|
|
138
|
+
}
|
|
139
|
+
const u = o - e || 1, d = Math.max(0, Math.min(1, (t - e) / u)), b = g ?? [
|
|
140
|
+
{ value: 0.33, color: l.palette.error.main },
|
|
141
|
+
{ value: 0.66, color: l.palette.warning.main },
|
|
142
|
+
{ value: 1, color: l.palette.success.main }
|
|
143
|
+
];
|
|
144
|
+
let y = ((w = b[b.length - 1]) == null ? void 0 : w.color) ?? l.palette.primary.main;
|
|
145
|
+
for (const M of b)
|
|
146
|
+
if (d <= M.value) {
|
|
147
|
+
y = M.color;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
return /* @__PURE__ */ v(S, { sx: { position: "relative", m: 0, height: "100%", p: 0, display: "flex", flexDirection: "column", alignItems: "center" }, children: [
|
|
151
|
+
a && /* @__PURE__ */ r(S, { sx: { position: "absolute", top: 100, left: 10 }, children: /* @__PURE__ */ r(A, { variant: "overline", color: "text.secondary", sx: { letterSpacing: 0.6 }, children: a }) }),
|
|
152
|
+
/* @__PURE__ */ r(S, { sx: { display: "inline-flex", mt: 0, alignItems: "normal", width: "100%", height: "inherit", alignContent: "center" }, children: /* @__PURE__ */ r(
|
|
153
|
+
et,
|
|
154
|
+
{
|
|
155
|
+
zones: b,
|
|
156
|
+
ratio: d,
|
|
157
|
+
needleColor: y,
|
|
158
|
+
strokeWidth: 20,
|
|
159
|
+
textPrimaryColor: l.palette.text.primary,
|
|
160
|
+
textSecondaryColor: l.palette.text.secondary,
|
|
161
|
+
min: f(e),
|
|
162
|
+
max: f(o),
|
|
163
|
+
valueComponent: `${s}${f(t)}${c}`
|
|
164
|
+
}
|
|
165
|
+
) })
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
p(lr, "GaugeCard");
|
|
169
|
+
const cr = /* @__PURE__ */ p((t) => /* @__PURE__ */ v("div", { style: { height: "100%" }, children: [
|
|
170
|
+
/* @__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
|
+
t.footNote && /* @__PURE__ */ r("div", { className: "ds-card-footer", children: /* @__PURE__ */ r("small", { children: t.footNote }) })
|
|
172
|
+
] }), "GaugeGroup");
|
|
173
|
+
let tt = !1;
|
|
174
|
+
function st() {
|
|
175
|
+
var e, o;
|
|
176
|
+
if (tt) return;
|
|
177
|
+
tt = !0;
|
|
178
|
+
let t;
|
|
179
|
+
try {
|
|
180
|
+
t = (o = (e = Ot).getLicenseKey) == null ? void 0 : o.call(e);
|
|
181
|
+
} catch {
|
|
182
|
+
t = void 0;
|
|
183
|
+
}
|
|
184
|
+
t || console.warn(
|
|
185
|
+
"[@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
|
+
}
|
|
188
|
+
p(st, "warnIfMuiXLicenseMissing");
|
|
189
|
+
function dr(t) {
|
|
190
|
+
if (t) {
|
|
191
|
+
if (typeof t == "function") return t;
|
|
192
|
+
switch (t) {
|
|
193
|
+
case "compact":
|
|
194
|
+
return (e) => e != null && typeof e == "number" ? ne(e) : le(e);
|
|
195
|
+
case "number":
|
|
196
|
+
return (e) => e != null && typeof e == "number" ? Lt(e) : le(e);
|
|
197
|
+
case "currency":
|
|
198
|
+
return (e) => e != null && typeof e == "number" ? Mt(e) : le(e);
|
|
199
|
+
case "percent":
|
|
200
|
+
return (e) => e != null && typeof e == "number" ? wt(e) : le(e);
|
|
201
|
+
case "check":
|
|
202
|
+
return (e) => e != null && typeof e == "boolean" ? Ct(e) : le(e);
|
|
203
|
+
case "date":
|
|
204
|
+
return (e) => e instanceof Date ? rt(e) : le(e);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
p(dr, "resolveFormatter");
|
|
209
|
+
function hr(t) {
|
|
210
|
+
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
|
+
p(hr, "isActiveFilterItem");
|
|
213
|
+
function ur({ onCsvExport: t, onXlsxExport: e, onClearFilters: o, exporting: a }) {
|
|
214
|
+
var x;
|
|
215
|
+
const s = Gt(), c = Nt(s, Pt), g = ((c == null ? void 0 : c.items) ?? []).some(hr) || (((x = c == null ? void 0 : c.quickFilterValues) == null ? void 0 : x.length) ?? 0) > 0;
|
|
216
|
+
return /* @__PURE__ */ v(zt, { children: [
|
|
217
|
+
/* @__PURE__ */ r(Ht, {}),
|
|
218
|
+
/* @__PURE__ */ r(Kt, {}),
|
|
219
|
+
/* @__PURE__ */ r(Wt, {}),
|
|
220
|
+
o && g && /* @__PURE__ */ r(yt, { size: "small", startIcon: /* @__PURE__ */ r($t, { fontSize: "small" }), onClick: o, sx: { textTransform: "none" }, children: "Limpar filtros" }),
|
|
221
|
+
/* @__PURE__ */ v(Ft, { children: [
|
|
222
|
+
t && /* @__PURE__ */ v(qe, { disabled: a, onClick: t, children: [
|
|
223
|
+
/* @__PURE__ */ r(Bt, { fontSize: "small", style: { marginRight: 8 } }),
|
|
224
|
+
"Exportar CSV (todos os dados)"
|
|
225
|
+
] }, "server-csv"),
|
|
226
|
+
e && /* @__PURE__ */ v(qe, { disabled: a, onClick: e, children: [
|
|
227
|
+
/* @__PURE__ */ r(Et, { fontSize: "small", style: { marginRight: 8 } }),
|
|
228
|
+
"Exportar Excel (todos os dados)"
|
|
229
|
+
] }, "server-xlsx")
|
|
230
|
+
] })
|
|
231
|
+
] });
|
|
232
|
+
}
|
|
233
|
+
p(ur, "ServerExportToolbar");
|
|
234
|
+
const pr = 11, mr = 30, lt = 80;
|
|
235
|
+
function fr(t) {
|
|
236
|
+
return Math.max(lt, t.length * pr + mr);
|
|
237
|
+
}
|
|
238
|
+
p(fr, "estimateHeaderWidth");
|
|
239
|
+
function gr(t, e) {
|
|
240
|
+
return t.map((o) => {
|
|
241
|
+
const a = dr(o.format), s = o.label ?? o.field, c = o.minWidth ?? lt, g = e ? Math.max(c, fr(s)) : c, x = {
|
|
242
|
+
field: o.field,
|
|
243
|
+
headerName: s,
|
|
244
|
+
align: o.align,
|
|
245
|
+
headerAlign: o.align,
|
|
246
|
+
headerClassName: o.headerClassName ?? "bi-datatable--header",
|
|
247
|
+
width: o.width,
|
|
248
|
+
minWidth: g,
|
|
249
|
+
sortable: o.sortable !== !1,
|
|
250
|
+
filterable: o.filterable !== !1,
|
|
251
|
+
flex: o.width ? void 0 : 1,
|
|
252
|
+
cellClassName: o.cellClassName,
|
|
253
|
+
renderCell: o.renderCell,
|
|
254
|
+
renderHeader: o.renderHeader
|
|
255
|
+
};
|
|
256
|
+
if (a && (x.valueFormatter = (h) => a(h)), o.type === "singleSelect") {
|
|
257
|
+
const h = x;
|
|
258
|
+
h.type = "singleSelect", h.valueOptions = o.valueOptions, o.multiSelectDropdown && (h.filterOperators = _t().filter((l) => l.value === "isAnyOf"));
|
|
259
|
+
}
|
|
260
|
+
return x;
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
p(gr, "toGridColumns");
|
|
264
|
+
function xr({
|
|
265
|
+
data: t,
|
|
266
|
+
lazyData: e,
|
|
267
|
+
schema: o,
|
|
268
|
+
getRowClassName: a,
|
|
269
|
+
title: s,
|
|
270
|
+
striped: c,
|
|
271
|
+
stripedColorEven: g,
|
|
272
|
+
stripedColorOdd: x,
|
|
273
|
+
getRowHeight: h,
|
|
274
|
+
headerColor: l,
|
|
275
|
+
pageSize: f,
|
|
276
|
+
dense: u = !0,
|
|
277
|
+
loading: d = !1,
|
|
278
|
+
autoFitHeaders: b = !0,
|
|
279
|
+
initialPinnedColumns: y
|
|
280
|
+
}) {
|
|
281
|
+
const w = ue(), M = $e.useRef(null), T = !!e;
|
|
282
|
+
Pe(() => {
|
|
283
|
+
st();
|
|
284
|
+
}, []), t && e && console.warn("[DataTableCard] Both `data` and `lazyData` were provided. These props are mutually exclusive. Using `lazyData` and ignoring `data`.");
|
|
285
|
+
const H = f ?? (T ? 50 : 20), [L, Z] = Q({ page: 0, pageSize: H }), U = B(() => {
|
|
286
|
+
const k = o ?? (e == null ? void 0 : e.columnSchema) ?? (t == null ? void 0 : t.columnSchema);
|
|
287
|
+
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 = B(() => G ? { getRows: G } : void 0, [G]), { naked: E } = Ne() ?? {}, j = vr({ containerRef: M, multiplier: E ? 1 : 0.9, naked: E, minHeight: 300 }), K = B(() => gr(U, b), [U, b]), R = e == null ? void 0 : e.downloadCsv, X = e == null ? void 0 : e.downloadXlsx, $ = (e == null ? void 0 : e.exporting) ?? !1, [m, N] = Q(null), P = $e.useCallback(
|
|
289
|
+
async (k) => {
|
|
290
|
+
const O = k === "xlsx" ? X : R;
|
|
291
|
+
if (!O) return;
|
|
292
|
+
const se = k === "xlsx" ? "Excel" : "CSV";
|
|
293
|
+
N({ kind: "progress", message: `Exportando ${se}…` });
|
|
294
|
+
try {
|
|
295
|
+
await O(), N({ kind: "success", message: `${se} exportado com sucesso` });
|
|
296
|
+
} catch (fe) {
|
|
297
|
+
console.error(`[DataTableCard] ${se} export failed`, fe), N({ kind: "error", message: fe instanceof Error ? fe.message : `Falha ao exportar ${se}` });
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
[R, X]
|
|
301
|
+
), z = B(() => R ? () => P("csv") : void 0, [R, P]), J = B(() => X ? () => P("xlsx") : void 0, [X, P]), q = e == null ? void 0 : e.apiRef, oe = B(
|
|
302
|
+
() => q ? () => {
|
|
303
|
+
var k;
|
|
304
|
+
return (k = q.current) == null ? void 0 : k.setFilterModel({ items: [], quickFilterValues: [] });
|
|
305
|
+
} : void 0,
|
|
306
|
+
[q]
|
|
307
|
+
), ie = B(() => {
|
|
308
|
+
if (!(!z && !J && !oe))
|
|
309
|
+
return { onCsvExport: z, onXlsxExport: J, onClearFilters: oe, exporting: $ };
|
|
310
|
+
}, [z, J, oe, $]), ve = B(() => {
|
|
311
|
+
const k = { density: u ? "compact" : "standard" };
|
|
312
|
+
return y && (k.pinnedColumns = y), k;
|
|
313
|
+
}, []), Me = B(() => t ? t.rows.map((k, O) => ({ id: O, ...k })) : [], [t]), ae = g ?? w.palette.action.hover, me = x ?? "transparent", Le = l ?? ee(w.palette.primary.main, w.palette.mode === "dark" ? 0.24 : 0.1);
|
|
314
|
+
return /* @__PURE__ */ v(S, { "data-testid": d ? "loading" : "", sx: { width: "100%", height: "100%", p: u ? 1 : 2, display: "flex", flexDirection: "column", overflow: "auto" }, ref: M, children: [
|
|
315
|
+
s && E && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: s }),
|
|
316
|
+
/* @__PURE__ */ r(
|
|
317
|
+
S,
|
|
318
|
+
{
|
|
319
|
+
sx: {
|
|
320
|
+
overflow: "auto",
|
|
321
|
+
height: `${j}px`,
|
|
322
|
+
"& .bi-datatable-row-even": { backgroundColor: ae },
|
|
323
|
+
"& .bi-datatable-row-odd": { backgroundColor: me }
|
|
324
|
+
},
|
|
325
|
+
children: /* @__PURE__ */ r(
|
|
326
|
+
At,
|
|
327
|
+
{
|
|
328
|
+
...T ? {
|
|
329
|
+
apiRef: e.apiRef,
|
|
330
|
+
dataSource: D,
|
|
331
|
+
onDataSourceError: e.onError,
|
|
332
|
+
loading: e.loading || d
|
|
333
|
+
} : { rows: Me, loading: d },
|
|
334
|
+
initialState: ve,
|
|
335
|
+
showToolbar: !!ie,
|
|
336
|
+
slots: ie ? { toolbar: ur } : void 0,
|
|
337
|
+
getRowHeight: h,
|
|
338
|
+
columns: K,
|
|
339
|
+
getRowClassName: /* @__PURE__ */ p((k) => {
|
|
340
|
+
let O = a ? a(k) : "";
|
|
341
|
+
return O.length > 0 && (O += " "), c && (O += k.indexRelativeToCurrentPage % 2 === 0 ? "bi-datatable-row-even" : "bi-datatable-row-odd"), O;
|
|
342
|
+
}, "getRowClassName"),
|
|
343
|
+
disableRowSelectionOnClick: !0,
|
|
344
|
+
filterDebounceMs: 300,
|
|
345
|
+
pagination: !0,
|
|
346
|
+
paginationModel: L,
|
|
347
|
+
pageSizeOptions: [20, 35, 50, 100],
|
|
348
|
+
onPaginationModelChange: Z,
|
|
349
|
+
slotProps: {
|
|
350
|
+
baseIconButton: { style: { backgroundColor: "transparent" } },
|
|
351
|
+
...ie ? { toolbar: ie } : {}
|
|
352
|
+
},
|
|
353
|
+
sx: {
|
|
354
|
+
fontSize: "14px",
|
|
355
|
+
maxHeight: "100%",
|
|
356
|
+
border: "none",
|
|
357
|
+
color: "text.primary",
|
|
358
|
+
[`& .${Ve.columnSeparator}`]: { color: "divider" },
|
|
359
|
+
[`& .${Ve.sortIcon}`]: { color: "text.primary" },
|
|
360
|
+
"& .bi-datatable--header": { backgroundColor: Le },
|
|
361
|
+
"& .MuiDataGrid-columnHeaders": { borderColor: "divider" },
|
|
362
|
+
"& .MuiDataGrid-cell": { borderColor: "divider" },
|
|
363
|
+
"& .MuiDataGrid-row:hover": { backgroundColor: "action.selected" },
|
|
364
|
+
"& .MuiDataGrid-footerContainer": { borderTop: "none" }
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ r(
|
|
371
|
+
xt,
|
|
372
|
+
{
|
|
373
|
+
open: m !== null,
|
|
374
|
+
autoHideDuration: (m == null ? void 0 : m.kind) === "progress" ? null : (m == null ? void 0 : m.kind) === "error" ? 6e3 : 3e3,
|
|
375
|
+
onClose: /* @__PURE__ */ p(() => N(null), "onClose"),
|
|
376
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
377
|
+
children: /* @__PURE__ */ r(
|
|
378
|
+
vt,
|
|
379
|
+
{
|
|
380
|
+
onClose: /* @__PURE__ */ p(() => N(null), "onClose"),
|
|
381
|
+
severity: (m == null ? void 0 : m.kind) === "error" ? "error" : (m == null ? void 0 : m.kind) === "success" ? "success" : "info",
|
|
382
|
+
icon: (m == null ? void 0 : m.kind) === "progress" ? /* @__PURE__ */ r(bt, { size: 16, color: "inherit" }) : void 0,
|
|
383
|
+
variant: "outlined",
|
|
384
|
+
sx: { bgcolor: "background.paper" },
|
|
385
|
+
children: m == null ? void 0 : m.message
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
] });
|
|
391
|
+
}
|
|
392
|
+
p(xr, "DataTableCard");
|
|
393
|
+
function vr({ containerRef: t, multiplier: e = 1, naked: o, minHeight: a = 200 }) {
|
|
394
|
+
const [s, c] = Q(a), g = nt(null), x = /* @__PURE__ */ p((h) => (h == null ? void 0 : h.parentElement) == null ? null : h != null && h.classList.contains("ds-card") ? h : x((h == null ? void 0 : h.parentElement) ?? null), "getParentGridCard");
|
|
395
|
+
return Pe(() => {
|
|
396
|
+
const h = t.current;
|
|
397
|
+
if (!h || typeof ResizeObserver > "u") return;
|
|
398
|
+
const l = x(h), f = new ResizeObserver((u) => {
|
|
399
|
+
g.current && clearTimeout(g.current);
|
|
400
|
+
const d = Math.floor(u[0].contentRect.height) * e;
|
|
401
|
+
g.current = setTimeout(() => {
|
|
402
|
+
c(() => d), g.current = null;
|
|
403
|
+
}, 50);
|
|
404
|
+
});
|
|
405
|
+
return l && f.observe(l), s !== 200 && l && c((u) => u * e), () => f.disconnect();
|
|
406
|
+
}, [t == null ? void 0 : t.current, o, e]), s;
|
|
407
|
+
}
|
|
408
|
+
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
|
+
function br(t) {
|
|
430
|
+
return t instanceof Date ? rt(t, "MM/DD") : String(t ?? "");
|
|
431
|
+
}
|
|
432
|
+
p(br, "defaultXFormatter");
|
|
433
|
+
function Ge(t, e, o, a = 0.25, s = 1) {
|
|
434
|
+
if (o <= 1) return t;
|
|
435
|
+
const c = e / Math.max(1, o - 1), g = a + (s - a) * c;
|
|
436
|
+
try {
|
|
437
|
+
return ee(t, g);
|
|
438
|
+
} catch {
|
|
439
|
+
return t;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
p(Ge, "chartShade");
|
|
443
|
+
function yr({
|
|
444
|
+
data: t,
|
|
445
|
+
type: e,
|
|
446
|
+
xAxis: o,
|
|
447
|
+
series: a,
|
|
448
|
+
title: s,
|
|
449
|
+
height: c = 300,
|
|
450
|
+
stacked: g = !1,
|
|
451
|
+
showLegend: x = !0,
|
|
452
|
+
showGrid: h = !0,
|
|
453
|
+
showTooltip: l = !0,
|
|
454
|
+
formatXAxis: f,
|
|
455
|
+
formatYAxis: u,
|
|
456
|
+
xAxisConfig: d,
|
|
457
|
+
yAxisConfig: b,
|
|
458
|
+
loading: y = !1,
|
|
459
|
+
maxSlices: w = 4,
|
|
460
|
+
palette: M,
|
|
461
|
+
backgroundColor: T,
|
|
462
|
+
gridColor: H
|
|
463
|
+
}) {
|
|
464
|
+
var Oe, je;
|
|
465
|
+
const L = ue(), { naked: Z } = Ne() ?? {}, U = t ? Array.isArray(t) ? t : t.rows : [], G = B(() => o ? U.map((i) => ({
|
|
466
|
+
...i,
|
|
467
|
+
__xLabel: (f ?? br)(i[o])
|
|
468
|
+
})) : U, [U, o, f]), D = u ?? ((i) => ne(i, 0)), E = L.palette.text.secondary, te = H ?? ee(L.palette.text.primary, 0.12), j = o ? "__xLabel" : void 0, K = /* @__PURE__ */ p((i, I) => {
|
|
469
|
+
var F, ge;
|
|
470
|
+
if (!i) return I;
|
|
471
|
+
const C = { ...I }, Y = i.color ?? ((F = I.tick) == null ? void 0 : F.fill) ?? E, W = i.fontSize ?? ((ge = I.tick) == null ? void 0 : ge.fontSize) ?? 12;
|
|
472
|
+
return C.tick = { fill: Y, fontSize: W }, i.hide !== void 0 && (C.hide = i.hide), i.label !== void 0 && (C.label = { value: i.label, position: "insideBottom", offset: -4, fill: Y, fontSize: W }), i.tickAngle !== void 0 && (C.tick.angle = i.tickAngle, C.tick.textAnchor = i.tickAngle < 0 ? "end" : i.tickAngle > 0 ? "start" : "middle"), i.tickCount !== void 0 && (C.tickCount = i.tickCount), i.interval !== void 0 && (C.interval = i.interval), i.tickSize !== void 0 && (C.tickSize = i.tickSize), i.tickLine !== void 0 && (C.tickLine = i.tickLine), i.axisLine !== void 0 && (C.axisLine = i.axisLine), i.domain && (C.domain = i.domain), i.unit !== void 0 && (C.unit = i.unit), i.reversed !== void 0 && (C.reversed = i.reversed), i.width !== void 0 && (C.width = i.width), i.height !== void 0 && (C.height = i.height), i.scale !== void 0 && (C.scale = i.scale), C;
|
|
473
|
+
}, "resolveAxisProps"), R = 10, X = /* @__PURE__ */ p((i) => i.length > R ? i.slice(0, R) : i, "truncateLabel"), $ = {
|
|
474
|
+
contentStyle: {
|
|
475
|
+
background: L.palette.background.paper,
|
|
476
|
+
border: `1px solid ${L.palette.divider}`,
|
|
477
|
+
borderRadius: L.shape.borderRadius,
|
|
478
|
+
color: L.palette.text.primary
|
|
479
|
+
},
|
|
480
|
+
itemStyle: { color: L.palette.text.primary },
|
|
481
|
+
labelStyle: { color: E },
|
|
482
|
+
// Recharts' default cursor is a hard-coded light grey overlay; give it
|
|
483
|
+
// both `fill` (BarChart hover rectangle) and `stroke` (Line/Area
|
|
484
|
+
// crosshair) from the theme so it belongs to either canvas.
|
|
485
|
+
cursor: {
|
|
486
|
+
fill: L.palette.action.hover,
|
|
487
|
+
stroke: L.palette.action.selected,
|
|
488
|
+
strokeWidth: 1
|
|
489
|
+
}
|
|
490
|
+
}, m = rr(), N = M ?? m.palette ?? we(L).series, P = m.monoShadePerCategory ?? !0, z = (m.rotateBasePerChart ?? !0) && N.length > 0, [J] = Q(() => {
|
|
491
|
+
var i;
|
|
492
|
+
return z ? ((i = m.allocateChartSlot) == null ? void 0 : i.call(m)) ?? 0 : 0;
|
|
493
|
+
}), q = /* @__PURE__ */ p((i) => N[((z ? J : 0) + i) % N.length], "pickPaletteColor"), oe = Math.PI / 180, ie = /* @__PURE__ */ p(({ cx: i, cy: I, midAngle: C, innerRadius: Y, outerRadius: W, percent: F, fill: ge }) => {
|
|
494
|
+
if (i == null || I == null || Y == null || W == null) return null;
|
|
495
|
+
const Xe = Y + (W - Y) * 0.5, Ye = Number(i), Ze = Ye + Xe * Math.cos(-(C ?? 0) * oe), ft = Number(I) + Xe * Math.sin(-(C ?? 0) * oe);
|
|
496
|
+
let Ue = L.palette.text.primary;
|
|
497
|
+
if (ge)
|
|
498
|
+
try {
|
|
499
|
+
Ue = L.palette.getContrastText(ge);
|
|
500
|
+
} catch {
|
|
501
|
+
}
|
|
502
|
+
return /* @__PURE__ */ r("text", { x: Ze, y: ft, fill: Ue, fontSize: 14, textAnchor: Ze > Ye ? "start" : "end", dominantBaseline: "central", children: `${((F ?? 1) * 100).toFixed(0)}%` });
|
|
503
|
+
}, "renderCustomizedLabel"), ve = a.map((i, I) => i.color ?? q(I)), Me = P && a.length === 1, ae = B(() => {
|
|
504
|
+
if (e !== "pie" && e !== "donut") return [];
|
|
505
|
+
const i = G.map((W, F) => ({
|
|
506
|
+
name: X(j ? String(W[j] ?? W[o] ?? F) : `#${F}`),
|
|
507
|
+
value: Number(a[0] ? W[a[0].dataKey] : 0) || 0
|
|
508
|
+
}));
|
|
509
|
+
if (i.length <= w) return i;
|
|
510
|
+
const I = [...i].sort((W, F) => F.value - W.value), C = I.slice(0, w - 1), Y = I.slice(w - 1).reduce((W, F) => W + F.value, 0);
|
|
511
|
+
return [...C, { name: "Others", value: Y }];
|
|
512
|
+
}, [e, G, j, o, a, w]), me = nt(null), [, Le] = ct(me);
|
|
513
|
+
if (y || !t)
|
|
514
|
+
return /* @__PURE__ */ v(S, { "data-testid": "loading", sx: { height: "100%", p: 2, width: "100%", backgroundColor: T }, children: [
|
|
515
|
+
s && Z && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
516
|
+
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
|
+
] });
|
|
518
|
+
if (e === "pie" || e === "donut")
|
|
519
|
+
return /* @__PURE__ */ v(S, { ref: me, sx: { height: "100%", width: "100%", px: 0, backgroundColor: T }, children: [
|
|
520
|
+
s && Z && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 0.5 }, children: s }),
|
|
521
|
+
/* @__PURE__ */ r(ye, { width: "100%", height: Le || c, children: /* @__PURE__ */ v(jt, { children: [
|
|
522
|
+
/* @__PURE__ */ v(
|
|
523
|
+
Xt,
|
|
524
|
+
{
|
|
525
|
+
data: ae,
|
|
526
|
+
dataKey: "value",
|
|
527
|
+
nameKey: "name",
|
|
528
|
+
cx: "50%",
|
|
529
|
+
cy: "50%",
|
|
530
|
+
innerRadius: e === "donut" ? "50%" : 0,
|
|
531
|
+
outerRadius: "70%",
|
|
532
|
+
label: ie,
|
|
533
|
+
labelLine: !1,
|
|
534
|
+
paddingAngle: 1,
|
|
535
|
+
children: [
|
|
536
|
+
ae.map((i, I) => /* @__PURE__ */ r(
|
|
537
|
+
De,
|
|
538
|
+
{
|
|
539
|
+
fill: P && ae.length > 1 ? Ge(q(0), I, ae.length) : q(I)
|
|
540
|
+
},
|
|
541
|
+
I
|
|
542
|
+
)),
|
|
543
|
+
l && /* @__PURE__ */ r(Re, { ...$ })
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
/* @__PURE__ */ r(Ie, { wrapperStyle: { color: L.palette.text.secondary } })
|
|
548
|
+
] }) })
|
|
549
|
+
] });
|
|
550
|
+
if (e === "scatter")
|
|
551
|
+
return /* @__PURE__ */ v(S, { sx: { height: "100%", p: 0, backgroundColor: T }, children: [
|
|
552
|
+
s && Z && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: s }),
|
|
553
|
+
/* @__PURE__ */ r(ye, { width: "100%", height: c, children: /* @__PURE__ */ v(Yt, { margin: { top: 8, right: 16, bottom: d != null && d.tickAngle ? 24 : 8, left: 0 }, children: [
|
|
554
|
+
h && /* @__PURE__ */ r(Qe, { stroke: te }),
|
|
555
|
+
/* @__PURE__ */ r(Be, { dataKey: o, name: o, ...K(d, { tick: { fill: E, fontSize: 12 } }) }),
|
|
556
|
+
/* @__PURE__ */ r(Ee, { dataKey: (Oe = a[0]) == null ? void 0 : Oe.dataKey, tickFormatter: D, name: (je = a[0]) == null ? void 0 : je.name, ...K(b, { tick: { fill: E, fontSize: 12 } }) }),
|
|
557
|
+
l && /* @__PURE__ */ r(Re, { ...$ }),
|
|
558
|
+
x && /* @__PURE__ */ r(Ie, { wrapperStyle: { color: L.palette.text.secondary } }),
|
|
559
|
+
a.map((i, I) => /* @__PURE__ */ r(Zt, { name: i.name ?? i.dataKey, data: G, fill: ve[I] }, i.dataKey))
|
|
560
|
+
] }) })
|
|
561
|
+
] });
|
|
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" ? qt : k === "area" || k === "stackedArea" ? Vt : Dt, pt = O ? "vertical" : "horizontal", Te = g || se, mt = /* @__PURE__ */ p((i) => i.type ? i.type : k === "combo" || k === "barV" || k === "barH" || k === "stackedBar" ? "bar" : k === "area" || k === "stackedArea" ? "area" : "line", "resolveSeriesType");
|
|
563
|
+
return /* @__PURE__ */ v(S, { sx: { height: "100%", p: 0.3, backgroundColor: T }, ref: me, children: [
|
|
564
|
+
s && Z && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: s }),
|
|
565
|
+
/* @__PURE__ */ r(ye, { width: "100%", height: "100%", children: /* @__PURE__ */ v(fe, { data: G, layout: pt, margin: { top: 0, right: 16, bottom: d != null && d.tickAngle ? 24 : 8, left: 0 }, style: { maxHeight: "95%" }, children: [
|
|
566
|
+
h && /* @__PURE__ */ r(Qe, { stroke: te, strokeDasharray: "3 3" }),
|
|
567
|
+
O ? /* @__PURE__ */ v(xe, { children: [
|
|
568
|
+
/* @__PURE__ */ r(Be, { type: "number", tickFormatter: D, ...K(d, { tick: { fill: E, fontSize: 12 } }) }),
|
|
569
|
+
/* @__PURE__ */ r(Ee, { type: "category", dataKey: j ?? o, ...K(b, { tick: { fill: E, fontSize: 12 }, width: 80 }) })
|
|
570
|
+
] }) : /* @__PURE__ */ v(xe, { children: [
|
|
571
|
+
/* @__PURE__ */ r(Be, { dataKey: j ?? o, ...K(d, { tick: { fill: E, fontSize: 12 } }) }),
|
|
572
|
+
/* @__PURE__ */ r(Ee, { tickFormatter: D, ...K(b, { tick: { fill: E, fontSize: 12 } }) })
|
|
573
|
+
] }),
|
|
574
|
+
l && /* @__PURE__ */ r(Re, { ...$ }),
|
|
575
|
+
x && /* @__PURE__ */ r(Ie, { wrapperStyle: { color: L.palette.text.secondary } }),
|
|
576
|
+
a.map((i, I) => {
|
|
577
|
+
const C = ve[I], Y = mt(i);
|
|
578
|
+
return Y === "bar" ? /* @__PURE__ */ r(
|
|
579
|
+
Qt,
|
|
580
|
+
{
|
|
581
|
+
dataKey: i.dataKey,
|
|
582
|
+
name: i.name ?? i.dataKey,
|
|
583
|
+
fill: C,
|
|
584
|
+
stackId: Te ? "stack" : void 0,
|
|
585
|
+
radius: O ? [0, 4, 4, 0] : [4, 4, 0, 0],
|
|
586
|
+
maxBarSize: 24,
|
|
587
|
+
children: Me && G.map((W, F) => (
|
|
588
|
+
// Bars are typically sorted descending, so invert the shade
|
|
589
|
+
// index: the largest bar gets the strongest alpha.
|
|
590
|
+
/* @__PURE__ */ r(De, { fill: Ge(C, G.length - 1 - F, G.length) }, F)
|
|
591
|
+
))
|
|
592
|
+
},
|
|
593
|
+
i.dataKey
|
|
594
|
+
) : Y === "area" ? /* @__PURE__ */ r(
|
|
595
|
+
Jt,
|
|
596
|
+
{
|
|
597
|
+
type: "monotone",
|
|
598
|
+
dataKey: i.dataKey,
|
|
599
|
+
name: i.name ?? i.dataKey,
|
|
600
|
+
stroke: C,
|
|
601
|
+
fill: C,
|
|
602
|
+
fillOpacity: Te ? 0.6 : 0.15,
|
|
603
|
+
stackId: Te ? "stack" : void 0,
|
|
604
|
+
strokeWidth: 2
|
|
605
|
+
},
|
|
606
|
+
i.dataKey
|
|
607
|
+
) : /* @__PURE__ */ r(er, { type: "monotone", dataKey: i.dataKey, name: i.name ?? i.dataKey, stroke: C, strokeWidth: 2, dot: !1, activeDot: { r: 4 } }, i.dataKey);
|
|
608
|
+
})
|
|
609
|
+
] }) })
|
|
610
|
+
] });
|
|
611
|
+
}
|
|
612
|
+
p(yr, "ChartCard");
|
|
613
|
+
function kr(t) {
|
|
614
|
+
const { x: e = 0, y: o = 0, width: a = 0, height: s = 0, name: c, size: g, fill: x, strokeColor: h, labelFor: l } = t, f = t.formatValue ?? ne;
|
|
615
|
+
if (a < 20 || s < 20) return null;
|
|
616
|
+
const u = x ? l(x) : h;
|
|
617
|
+
return /* @__PURE__ */ v("g", { children: [
|
|
618
|
+
/* @__PURE__ */ r("rect", { x: e, y: o, width: a, height: s, rx: 4, fill: x, stroke: h, strokeWidth: 1 }),
|
|
619
|
+
a > 50 && s > 30 && /* @__PURE__ */ v(xe, { children: [
|
|
620
|
+
/* @__PURE__ */ r("text", { x: e + 6, y: o + 16, fill: u, fontSize: 12, fontWeight: 600, children: (c ?? "").length > a / 7 ? (c ?? "").slice(0, Math.floor(a / 7)) + "…" : c }),
|
|
621
|
+
s > 44 && /* @__PURE__ */ r("text", { x: e + 6, y: o + 32, fill: ee(u, 0.7), fontSize: 11, children: f(g ?? 0) })
|
|
622
|
+
] })
|
|
623
|
+
] });
|
|
624
|
+
}
|
|
625
|
+
p(kr, "CustomContent");
|
|
626
|
+
function Sr({
|
|
627
|
+
data: t,
|
|
628
|
+
nameKey: e,
|
|
629
|
+
valueKey: o,
|
|
630
|
+
title: a,
|
|
631
|
+
height: s = 300,
|
|
632
|
+
formatValue: c,
|
|
633
|
+
loading: g = !1,
|
|
634
|
+
palette: x
|
|
635
|
+
}) {
|
|
636
|
+
const h = ue(), l = x ?? we(h).series, f = B(() => t ? t.rows.map((d, b) => ({
|
|
637
|
+
name: String(d[e] ?? ""),
|
|
638
|
+
size: Math.max(0, Number(d[o]) || 0),
|
|
639
|
+
fill: l[b % l.length]
|
|
640
|
+
})) : [], [t, e, o, l]), u = /* @__PURE__ */ p((d) => {
|
|
641
|
+
try {
|
|
642
|
+
return h.palette.getContrastText(d);
|
|
643
|
+
} catch {
|
|
644
|
+
return h.palette.text.primary;
|
|
645
|
+
}
|
|
646
|
+
}, "labelFor");
|
|
647
|
+
return g || !t ? /* @__PURE__ */ v(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
648
|
+
a && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
649
|
+
/* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: s })
|
|
650
|
+
] }) : /* @__PURE__ */ v(S, { sx: { height: "100%", p: 2 }, children: [
|
|
651
|
+
a && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: a }),
|
|
652
|
+
f.length === 0 ? /* @__PURE__ */ r(A, { variant: "body2", color: "text.secondary", children: "No data" }) : /* @__PURE__ */ r(ye, { width: "100%", height: s, children: /* @__PURE__ */ r(
|
|
653
|
+
tr,
|
|
654
|
+
{
|
|
655
|
+
data: f,
|
|
656
|
+
dataKey: "size",
|
|
657
|
+
nameKey: "name",
|
|
658
|
+
stroke: h.palette.background.paper,
|
|
659
|
+
content: /* @__PURE__ */ r(kr, { formatValue: c, strokeColor: h.palette.background.paper, labelFor: u })
|
|
660
|
+
}
|
|
661
|
+
) })
|
|
662
|
+
] });
|
|
663
|
+
}
|
|
664
|
+
p(Sr, "TreeMapCard");
|
|
665
|
+
const He = 150, Cr = 300, wr = 140;
|
|
666
|
+
function Ke(t, e = {}) {
|
|
667
|
+
const { autoFit: o = !0, defaultZoom: a, center: s } = e;
|
|
668
|
+
if (s && a != null)
|
|
669
|
+
return { center: s, zoom: a };
|
|
670
|
+
if (!o || t.length === 0)
|
|
671
|
+
return {
|
|
672
|
+
center: s ?? [0, 20],
|
|
673
|
+
zoom: a ?? 1
|
|
674
|
+
};
|
|
675
|
+
const c = t.map((H) => H.lat), g = t.map((H) => H.lng), x = Math.min(...c), h = Math.max(...c), l = Math.min(...g), f = Math.max(...g), u = s ?? [
|
|
676
|
+
(l + f) / 2,
|
|
677
|
+
(x + h) / 2
|
|
678
|
+
];
|
|
679
|
+
if (a != null)
|
|
680
|
+
return { center: u, zoom: a };
|
|
681
|
+
if (t.length === 1)
|
|
682
|
+
return { center: u, zoom: 4 };
|
|
683
|
+
const d = 1.5, b = Math.max(h - x, 5) * d, y = Math.max(f - l, 5) * d, w = wr / b, M = Cr / y, T = Math.max(1, Math.min(w, M, 20));
|
|
684
|
+
return { center: u, zoom: T };
|
|
685
|
+
}
|
|
686
|
+
p(Ke, "computeMapViewport");
|
|
687
|
+
const We = "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 = [We, dt], ht = [We], ut = Rt(null), Tr = ut.Provider;
|
|
688
|
+
function Fe(t) {
|
|
689
|
+
const e = It(ut);
|
|
690
|
+
return t !== void 0 ? Array.isArray(t) ? t : [t] : e ?? ht;
|
|
691
|
+
}
|
|
692
|
+
p(Fe, "useGeoLayers");
|
|
693
|
+
function Rr({ bubbles: t, maxVal: e, minBubbleSize: o, maxBubbleSize: a, fillColor: s, fmt: c, onHover: g, onLeave: x }) {
|
|
694
|
+
const { k: h } = ze();
|
|
695
|
+
return /* @__PURE__ */ r(xe, { children: t.map((l, f) => {
|
|
696
|
+
const u = Math.abs(l.value) / e, d = o + u * (a - o), b = `${l.label ?? ""} ${c(l.value)}`.trim();
|
|
697
|
+
return /* @__PURE__ */ r(Ae, { coordinates: [l.lng, l.lat], children: /* @__PURE__ */ v("g", { transform: `scale(${1 / h})`, style: { cursor: "pointer" }, onMouseEnter: /* @__PURE__ */ p((y) => g(y, b), "onMouseEnter"), onMouseMove: /* @__PURE__ */ p((y) => g(y, b), "onMouseMove"), onMouseLeave: x, children: [
|
|
698
|
+
/* @__PURE__ */ r("circle", { r: d, fill: s, opacity: 0.45 }),
|
|
699
|
+
/* @__PURE__ */ r("circle", { r: d * 0.6, fill: s, opacity: 0.85 })
|
|
700
|
+
] }) }, f);
|
|
701
|
+
}) });
|
|
702
|
+
}
|
|
703
|
+
p(Rr, "BubbleMarkers");
|
|
704
|
+
function Ir({
|
|
705
|
+
data: t,
|
|
706
|
+
title: e,
|
|
707
|
+
height: o = 340,
|
|
708
|
+
minBubbleSize: a = 4,
|
|
709
|
+
maxBubbleSize: s = 28,
|
|
710
|
+
color: c,
|
|
711
|
+
formatValue: g,
|
|
712
|
+
loading: x = !1,
|
|
713
|
+
defaultZoom: h,
|
|
714
|
+
center: l,
|
|
715
|
+
autoFit: f = !0,
|
|
716
|
+
geoUrl: u
|
|
717
|
+
}) {
|
|
718
|
+
const d = ue(), b = (t == null ? void 0 : t.rows) ?? [], [y, w] = Q(null), M = g ?? ne, T = c ?? we(d).series[0], H = Fe(u), L = ee(d.palette.text.primary, 0.06), Z = ee(d.palette.text.primary, 0.09), U = d.palette.divider, G = d.palette.text.disabled, D = B(() => Math.max(1, ...b.map((R) => Math.abs(R.value))), [b]), E = B(() => Ke(b, { autoFit: f, defaultZoom: h, center: l }), [b, f, h, l]), te = ke((R, X) => {
|
|
719
|
+
const $ = R.currentTarget.closest("svg");
|
|
720
|
+
if (!$) return;
|
|
721
|
+
const m = $.getBoundingClientRect();
|
|
722
|
+
w({ x: R.clientX - m.left, y: R.clientY - m.top, text: X });
|
|
723
|
+
}, []), j = ke(() => w(null), []);
|
|
724
|
+
if (x)
|
|
725
|
+
return /* @__PURE__ */ v(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
726
|
+
e && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
727
|
+
/* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: o })
|
|
728
|
+
] });
|
|
729
|
+
const K = { default: { outline: "none" }, hover: { outline: "none" }, pressed: { outline: "none" } };
|
|
730
|
+
return /* @__PURE__ */ v(S, { sx: { height: "100%", p: 0.5, overflow: "auto" }, children: [
|
|
731
|
+
e && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: e }),
|
|
732
|
+
/* @__PURE__ */ v(S, { sx: { position: "relative" }, children: [
|
|
733
|
+
/* @__PURE__ */ r(
|
|
734
|
+
ot,
|
|
735
|
+
{
|
|
736
|
+
projection: "geoMercator",
|
|
737
|
+
projectionConfig: { scale: He },
|
|
738
|
+
width: 800,
|
|
739
|
+
height: 500,
|
|
740
|
+
style: { width: "100%", height: "100%", display: "block", background: d.palette.background.default, borderRadius: d.shape.borderRadius },
|
|
741
|
+
children: /* @__PURE__ */ v(it, { center: E.center, zoom: E.zoom, minZoom: 1, maxZoom: 40, children: [
|
|
742
|
+
H.map(
|
|
743
|
+
(R, X) => X === 0 ? /* @__PURE__ */ r(Se, { geography: R, children: /* @__PURE__ */ p(({ geographies: $ }) => $.map((m) => /* @__PURE__ */ r(Ce, { geography: m, fill: L, stroke: U, strokeWidth: 0.5, style: { ...K, hover: { outline: "none", fill: Z } } }, m.rsmKey)), "children") }, R) : /* @__PURE__ */ r(Se, { geography: R, children: /* @__PURE__ */ p(({ geographies: $ }) => $.map((m) => /* @__PURE__ */ r(Ce, { geography: m, fill: "none", stroke: G, strokeWidth: 0.3, style: K }, m.rsmKey)), "children") }, R)
|
|
744
|
+
),
|
|
745
|
+
/* @__PURE__ */ r(Rr, { bubbles: b, maxVal: D, minBubbleSize: a, maxBubbleSize: s, fillColor: T, fmt: M, onHover: te, onLeave: j })
|
|
746
|
+
] })
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
y && /* @__PURE__ */ r(
|
|
750
|
+
S,
|
|
751
|
+
{
|
|
752
|
+
sx: {
|
|
753
|
+
position: "absolute",
|
|
754
|
+
left: y.x,
|
|
755
|
+
top: y.y - 34,
|
|
756
|
+
transform: "translateX(-50%)",
|
|
757
|
+
bgcolor: "background.paper",
|
|
758
|
+
color: "text.primary",
|
|
759
|
+
px: 1,
|
|
760
|
+
py: 0.5,
|
|
761
|
+
borderRadius: 1,
|
|
762
|
+
fontSize: 12,
|
|
763
|
+
pointerEvents: "none",
|
|
764
|
+
border: "1px solid",
|
|
765
|
+
borderColor: "divider",
|
|
766
|
+
whiteSpace: "nowrap",
|
|
767
|
+
zIndex: 10,
|
|
768
|
+
boxShadow: 2
|
|
769
|
+
},
|
|
770
|
+
children: y.text
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
] })
|
|
774
|
+
] });
|
|
775
|
+
}
|
|
776
|
+
p(Ir, "MapBubblesCard");
|
|
777
|
+
function Br(t, e, o, a) {
|
|
778
|
+
const s = (t + o) / 2, c = Math.min(e, a) - Math.abs(o - t) * 0.15;
|
|
779
|
+
return `M${t},${e} Q${s},${c} ${o},${a}`;
|
|
780
|
+
}
|
|
781
|
+
p(Br, "curvedPath");
|
|
782
|
+
function Er({ connections: t, maxVal: e, strokeColor: o, hoveredIdx: a, onHover: s, onLeave: c }) {
|
|
783
|
+
const { projection: g } = nr(), { k: x } = ze(), h = B(
|
|
784
|
+
() => t.map((l) => {
|
|
785
|
+
const f = g([l.fromLng, l.fromLat]), u = g([l.toLng, l.toLat]), d = (f == null ? void 0 : f[0]) ?? 0, b = (f == null ? void 0 : f[1]) ?? 0, y = (u == null ? void 0 : u[0]) ?? 0, w = (u == null ? void 0 : u[1]) ?? 0, T = 1 + Math.abs(l.value ?? 1) / e * 3;
|
|
786
|
+
return { ...l, x1: d, y1: b, x2: y, y2: w, width: T, d: Br(d, b, y, w) };
|
|
787
|
+
}),
|
|
788
|
+
[t, g, e]
|
|
789
|
+
);
|
|
790
|
+
return /* @__PURE__ */ r("g", { children: h.map((l, f) => /* @__PURE__ */ v("g", { onMouseEnter: /* @__PURE__ */ p((u) => s(f, u), "onMouseEnter"), onMouseMove: /* @__PURE__ */ p((u) => s(f, u), "onMouseMove"), onMouseLeave: c, style: { cursor: "pointer" }, children: [
|
|
791
|
+
/* @__PURE__ */ r("path", { d: l.d, fill: "none", stroke: "transparent", strokeWidth: (l.width + 8) / x }),
|
|
792
|
+
/* @__PURE__ */ r("path", { d: l.d, fill: "none", stroke: o, strokeWidth: l.width / x, opacity: a === f ? 0.9 : 0.4, strokeLinecap: "round" })
|
|
793
|
+
] }, f)) });
|
|
794
|
+
}
|
|
795
|
+
p(Er, "ConnectionArcs");
|
|
796
|
+
function $r({ connections: t, strokeColor: e }) {
|
|
797
|
+
const { k: o } = ze();
|
|
798
|
+
return /* @__PURE__ */ r(xe, { children: t.map((a, s) => /* @__PURE__ */ v($e.Fragment, { children: [
|
|
799
|
+
/* @__PURE__ */ r(Ae, { coordinates: [a.fromLng, a.fromLat], children: /* @__PURE__ */ r("circle", { r: 3 / o, fill: e, opacity: 0.8 }) }),
|
|
800
|
+
/* @__PURE__ */ r(Ae, { coordinates: [a.toLng, a.toLat], children: /* @__PURE__ */ r("circle", { r: 3 / o, fill: e, opacity: 0.8 }) })
|
|
801
|
+
] }, s)) });
|
|
802
|
+
}
|
|
803
|
+
p($r, "EndpointMarkers");
|
|
804
|
+
function Ar({
|
|
805
|
+
data: t,
|
|
806
|
+
title: e,
|
|
807
|
+
height: o = 340,
|
|
808
|
+
color: a,
|
|
809
|
+
showEndpoints: s = !0,
|
|
810
|
+
formatValue: c,
|
|
811
|
+
loading: g = !1,
|
|
812
|
+
defaultZoom: x,
|
|
813
|
+
center: h,
|
|
814
|
+
autoFit: l = !0,
|
|
815
|
+
geoUrl: f
|
|
816
|
+
}) {
|
|
817
|
+
const u = ue(), d = (t == null ? void 0 : t.rows) ?? [], [b, y] = Q(null), [w, M] = Q(null), T = c ?? ne, H = we(u).series, L = a ?? H[1 % H.length], Z = Fe(f), U = ee(u.palette.text.primary, 0.06), G = ee(u.palette.text.primary, 0.09), D = u.palette.divider, E = u.palette.text.disabled, te = B(() => Math.max(1, ...d.map((m) => Math.abs(m.value ?? 1))), [d]), j = B(() => d.flatMap((m) => [{ lat: m.fromLat, lng: m.fromLng }, { lat: m.toLat, lng: m.toLng }]), [d]), K = B(() => Ke(j, { autoFit: l, defaultZoom: x, center: h }), [j, l, x, h]), R = ke(
|
|
818
|
+
(m, N) => {
|
|
819
|
+
const P = d[m], z = `${P.label ?? ""} ${P.value != null ? T(P.value) : ""}`.trim();
|
|
820
|
+
if (!z) return;
|
|
821
|
+
const J = N.currentTarget.closest("svg");
|
|
822
|
+
if (!J) return;
|
|
823
|
+
const q = J.getBoundingClientRect();
|
|
824
|
+
M(m), y({ x: N.clientX - q.left, y: N.clientY - q.top, text: z });
|
|
825
|
+
},
|
|
826
|
+
[d, T]
|
|
827
|
+
), X = ke(() => {
|
|
828
|
+
M(null), y(null);
|
|
829
|
+
}, []);
|
|
830
|
+
if (g)
|
|
831
|
+
return /* @__PURE__ */ v(S, { "data-testid": "loading", sx: { height: "100%", p: 2 }, children: [
|
|
832
|
+
e && /* @__PURE__ */ r(_, { variant: "text", width: 180, sx: { fontSize: "1.25rem", mb: 1 } }),
|
|
833
|
+
/* @__PURE__ */ r(_, { variant: "rounded", width: "100%", height: o })
|
|
834
|
+
] });
|
|
835
|
+
const $ = { default: { outline: "none" }, hover: { outline: "none" }, pressed: { outline: "none" } };
|
|
836
|
+
return /* @__PURE__ */ v(S, { sx: { height: "100%", p: 2, overflow: "auto" }, children: [
|
|
837
|
+
e && /* @__PURE__ */ r(A, { variant: "h6", sx: { mb: 1 }, children: e }),
|
|
838
|
+
/* @__PURE__ */ v(S, { sx: { position: "relative" }, children: [
|
|
839
|
+
/* @__PURE__ */ r(
|
|
840
|
+
ot,
|
|
841
|
+
{
|
|
842
|
+
projection: "geoMercator",
|
|
843
|
+
projectionConfig: { scale: He },
|
|
844
|
+
width: 800,
|
|
845
|
+
style: { width: "100%", height: "100%", display: "block", background: u.palette.background.default, borderRadius: u.shape.borderRadius },
|
|
846
|
+
children: /* @__PURE__ */ v(it, { center: K.center, zoom: K.zoom, minZoom: 1, maxZoom: 40, children: [
|
|
847
|
+
Z.map(
|
|
848
|
+
(m, N) => N === 0 ? /* @__PURE__ */ r(Se, { geography: m, children: /* @__PURE__ */ p(({ geographies: P }) => P.map((z) => /* @__PURE__ */ r(Ce, { geography: z, fill: U, stroke: D, strokeWidth: 0.5, style: { ...$, hover: { outline: "none", fill: G } } }, z.rsmKey)), "children") }, m) : /* @__PURE__ */ r(Se, { geography: m, children: /* @__PURE__ */ p(({ geographies: P }) => P.map((z) => /* @__PURE__ */ r(Ce, { geography: z, fill: "none", stroke: E, strokeWidth: 0.3, style: $ }, z.rsmKey)), "children") }, m)
|
|
849
|
+
),
|
|
850
|
+
/* @__PURE__ */ r(Er, { connections: d, maxVal: te, strokeColor: L, hoveredIdx: w, onHover: R, onLeave: X }),
|
|
851
|
+
s && /* @__PURE__ */ r($r, { connections: d, strokeColor: L })
|
|
852
|
+
] })
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
b && /* @__PURE__ */ r(
|
|
856
|
+
S,
|
|
857
|
+
{
|
|
858
|
+
sx: {
|
|
859
|
+
position: "absolute",
|
|
860
|
+
left: b.x,
|
|
861
|
+
top: b.y - 34,
|
|
862
|
+
transform: "translateX(-50%)",
|
|
863
|
+
bgcolor: "background.paper",
|
|
864
|
+
color: "text.primary",
|
|
865
|
+
px: 1,
|
|
866
|
+
py: 0.5,
|
|
867
|
+
borderRadius: 1,
|
|
868
|
+
fontSize: 12,
|
|
869
|
+
pointerEvents: "none",
|
|
870
|
+
border: "1px solid",
|
|
871
|
+
borderColor: "divider",
|
|
872
|
+
whiteSpace: "nowrap",
|
|
873
|
+
zIndex: 10,
|
|
874
|
+
boxShadow: 2
|
|
875
|
+
},
|
|
876
|
+
children: b.text
|
|
877
|
+
}
|
|
878
|
+
)
|
|
879
|
+
] })
|
|
880
|
+
] });
|
|
881
|
+
}
|
|
882
|
+
p(Ar, "MapConnectionsCard");
|
|
883
|
+
function n(t, e) {
|
|
884
|
+
return [(e + 180) / 360 * 1e3, (90 - t) / 180 * 500];
|
|
885
|
+
}
|
|
886
|
+
p(n, "ll");
|
|
887
|
+
function pe(t) {
|
|
888
|
+
return t.map(([e, o], a) => `${a === 0 ? "M" : "L"}${e.toFixed(0)},${o.toFixed(0)}`).join(" ") + " Z";
|
|
889
|
+
}
|
|
890
|
+
p(pe, "toPath");
|
|
891
|
+
const _r = pe([
|
|
892
|
+
n(70, -165),
|
|
893
|
+
n(72, -140),
|
|
894
|
+
n(73, -100),
|
|
895
|
+
n(70, -80),
|
|
896
|
+
n(65, -60),
|
|
897
|
+
n(50, -55),
|
|
898
|
+
n(44, -65),
|
|
899
|
+
n(40, -73),
|
|
900
|
+
n(30, -80),
|
|
901
|
+
n(25, -80),
|
|
902
|
+
n(18, -88),
|
|
903
|
+
n(15, -92),
|
|
904
|
+
n(18, -105),
|
|
905
|
+
n(25, -110),
|
|
906
|
+
n(32, -117),
|
|
907
|
+
n(48, -125),
|
|
908
|
+
n(55, -130),
|
|
909
|
+
n(60, -140),
|
|
910
|
+
n(60, -165)
|
|
911
|
+
]), Gr = pe([
|
|
912
|
+
n(12, -75),
|
|
913
|
+
n(10, -60),
|
|
914
|
+
n(5, -52),
|
|
915
|
+
n(0, -50),
|
|
916
|
+
n(-5, -35),
|
|
917
|
+
n(-15, -38),
|
|
918
|
+
n(-23, -42),
|
|
919
|
+
n(-33, -52),
|
|
920
|
+
n(-42, -63),
|
|
921
|
+
n(-55, -68),
|
|
922
|
+
n(-50, -75),
|
|
923
|
+
n(-40, -73),
|
|
924
|
+
n(-18, -70),
|
|
925
|
+
n(-5, -77),
|
|
926
|
+
n(5, -77)
|
|
927
|
+
]), Nr = pe([
|
|
928
|
+
n(36, -10),
|
|
929
|
+
n(38, 0),
|
|
930
|
+
n(43, 5),
|
|
931
|
+
n(48, -5),
|
|
932
|
+
n(51, -10),
|
|
933
|
+
n(55, -7),
|
|
934
|
+
n(58, 5),
|
|
935
|
+
n(55, 15),
|
|
936
|
+
n(56, 25),
|
|
937
|
+
n(60, 30),
|
|
938
|
+
n(70, 30),
|
|
939
|
+
n(70, 15),
|
|
940
|
+
n(65, 10),
|
|
941
|
+
n(56, 10),
|
|
942
|
+
n(52, 5),
|
|
943
|
+
n(48, 5),
|
|
944
|
+
n(44, 10),
|
|
945
|
+
n(40, 10),
|
|
946
|
+
n(38, 0),
|
|
947
|
+
n(36, -5)
|
|
948
|
+
]), Pr = pe([
|
|
949
|
+
n(35, -10),
|
|
950
|
+
n(37, 10),
|
|
951
|
+
n(32, 32),
|
|
952
|
+
n(30, 33),
|
|
953
|
+
n(20, 38),
|
|
954
|
+
n(12, 44),
|
|
955
|
+
n(5, 42),
|
|
956
|
+
n(-5, 40),
|
|
957
|
+
n(-12, 45),
|
|
958
|
+
n(-25, 35),
|
|
959
|
+
n(-35, 20),
|
|
960
|
+
n(-34, 18),
|
|
961
|
+
n(-25, 15),
|
|
962
|
+
n(-15, 12),
|
|
963
|
+
n(-5, 10),
|
|
964
|
+
n(5, -5),
|
|
965
|
+
n(10, -15),
|
|
966
|
+
n(15, -17),
|
|
967
|
+
n(22, -17),
|
|
968
|
+
n(28, -13)
|
|
969
|
+
]), zr = pe([
|
|
970
|
+
n(70, 30),
|
|
971
|
+
n(72, 60),
|
|
972
|
+
n(75, 100),
|
|
973
|
+
n(72, 130),
|
|
974
|
+
n(65, 170),
|
|
975
|
+
n(55, 165),
|
|
976
|
+
n(50, 140),
|
|
977
|
+
n(45, 130),
|
|
978
|
+
n(35, 130),
|
|
979
|
+
n(30, 120),
|
|
980
|
+
n(22, 115),
|
|
981
|
+
n(10, 105),
|
|
982
|
+
n(5, 100),
|
|
983
|
+
n(8, 80),
|
|
984
|
+
n(12, 75),
|
|
985
|
+
n(25, 68),
|
|
986
|
+
n(28, 60),
|
|
987
|
+
n(30, 48),
|
|
988
|
+
n(32, 36),
|
|
989
|
+
n(38, 28),
|
|
990
|
+
n(42, 28),
|
|
991
|
+
n(48, 40),
|
|
992
|
+
n(55, 38),
|
|
993
|
+
n(60, 30)
|
|
994
|
+
]), Hr = pe([
|
|
995
|
+
n(-12, 130),
|
|
996
|
+
n(-15, 140),
|
|
997
|
+
n(-20, 148),
|
|
998
|
+
n(-28, 153),
|
|
999
|
+
n(-35, 150),
|
|
1000
|
+
n(-38, 145),
|
|
1001
|
+
n(-35, 137),
|
|
1002
|
+
n(-32, 130),
|
|
1003
|
+
n(-25, 115),
|
|
1004
|
+
n(-22, 115),
|
|
1005
|
+
n(-15, 122)
|
|
1006
|
+
]), Kr = [_r, Gr, Nr, Pr, zr, Hr], Wr = "0 0 1000 500";
|
|
1007
|
+
function Fr(t, e) {
|
|
1008
|
+
return n(t, e);
|
|
1009
|
+
}
|
|
1010
|
+
p(Fr, "latLngToXY");
|
|
1011
|
+
const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1012
|
+
__proto__: null,
|
|
1013
|
+
BASE_SCALE: He,
|
|
1014
|
+
CONTINENT_PATHS: Kr,
|
|
1015
|
+
ChartCard: yr,
|
|
1016
|
+
DataTableCard: xr,
|
|
1017
|
+
GEO_URL_BRAZIL_MUNICIPALITIES: Mr,
|
|
1018
|
+
GEO_URL_BRAZIL_STATES: dt,
|
|
1019
|
+
GEO_URL_WORLD: We,
|
|
1020
|
+
GaugeCard: lr,
|
|
1021
|
+
GaugeGroup: cr,
|
|
1022
|
+
GeoLayersProvider: Tr,
|
|
1023
|
+
MAP_VIEWBOX: Wr,
|
|
1024
|
+
MapBubblesCard: Ir,
|
|
1025
|
+
MapConnectionsCard: Ar,
|
|
1026
|
+
MetricCard: at,
|
|
1027
|
+
MetricGroupCard: or,
|
|
1028
|
+
TreeMapCard: Sr,
|
|
1029
|
+
brazilGeoLayers: Lr,
|
|
1030
|
+
chartShade: Ge,
|
|
1031
|
+
computeMapViewport: Ke,
|
|
1032
|
+
latLngToXY: Fr,
|
|
1033
|
+
useContainerRectangle: ct,
|
|
1034
|
+
useGeoLayers: Fe,
|
|
1035
|
+
warnIfMuiXLicenseMissing: st,
|
|
1036
|
+
worldGeoLayers: ht
|
|
1037
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1038
|
+
export {
|
|
1039
|
+
He as B,
|
|
1040
|
+
Kr as C,
|
|
1041
|
+
xr as D,
|
|
1042
|
+
Mr as G,
|
|
1043
|
+
Wr as M,
|
|
1044
|
+
Sr as T,
|
|
1045
|
+
yr as a,
|
|
1046
|
+
dt as b,
|
|
1047
|
+
We as c,
|
|
1048
|
+
lr as d,
|
|
1049
|
+
cr as e,
|
|
1050
|
+
Tr as f,
|
|
1051
|
+
Ir as g,
|
|
1052
|
+
Ar as h,
|
|
1053
|
+
at as i,
|
|
1054
|
+
or as j,
|
|
1055
|
+
Lr as k,
|
|
1056
|
+
Ge as l,
|
|
1057
|
+
Ke as m,
|
|
1058
|
+
Fr as n,
|
|
1059
|
+
Fe as o,
|
|
1060
|
+
ht as p,
|
|
1061
|
+
sn as q,
|
|
1062
|
+
ct as u,
|
|
1063
|
+
st as w
|
|
1064
|
+
};
|
|
1065
|
+
//# sourceMappingURL=index-wtSLspPh.js.map
|