@m4l/widgets 0.0.1 → 0.0.2-beta-add-widgets-piechart.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/charts/Pie/Pie.d.ts +10 -0
- package/charts/Pie/Pie.d.ts.map +1 -0
- package/charts/Pie/Pie.js +36 -0
- package/charts/Pie/Pie.styles.d.ts +3 -0
- package/charts/Pie/Pie.styles.d.ts.map +1 -0
- package/charts/Pie/Pie.styles.js +195 -0
- package/charts/Pie/constants.d.ts +2 -0
- package/charts/Pie/constants.d.ts.map +1 -0
- package/charts/Pie/constants.js +4 -0
- package/charts/Pie/helpers/options.d.ts +99 -0
- package/charts/Pie/helpers/options.d.ts.map +1 -0
- package/charts/Pie/helpers/options.js +90 -0
- package/charts/Pie/helpers/remap.d.ts +6 -0
- package/charts/Pie/helpers/remap.d.ts.map +1 -0
- package/charts/Pie/helpers/remap.js +18 -0
- package/charts/Pie/hooks/useChartResize.d.ts +8 -0
- package/charts/Pie/hooks/useChartResize.d.ts.map +1 -0
- package/charts/Pie/hooks/useChartResize.js +17 -0
- package/charts/Pie/hooks/usePieChartData.d.ts +88 -0
- package/charts/Pie/hooks/usePieChartData.d.ts.map +1 -0
- package/charts/Pie/hooks/usePieChartData.js +11 -0
- package/charts/Pie/index.d.ts +3 -0
- package/charts/Pie/index.d.ts.map +1 -0
- package/charts/Pie/slots/PieEnum.d.ts +18 -0
- package/charts/Pie/slots/PieEnum.d.ts.map +1 -0
- package/charts/Pie/slots/PieEnum.js +4 -0
- package/charts/Pie/slots/PieSlots.d.ts +28 -0
- package/charts/Pie/slots/PieSlots.d.ts.map +1 -0
- package/charts/Pie/slots/PieSlots.js +53 -0
- package/charts/Pie/subcomponents/CustomLegend/CustomLegend.d.ts +12 -0
- package/charts/Pie/subcomponents/CustomLegend/CustomLegend.d.ts.map +1 -0
- package/charts/Pie/subcomponents/CustomLegend/CustomLegend.js +30 -0
- package/charts/Pie/subcomponents/CustomLegend/types.d.ts +10 -0
- package/charts/Pie/subcomponents/CustomLegend/types.d.ts.map +1 -0
- package/charts/Pie/types.d.ts +52 -0
- package/charts/Pie/types.d.ts.map +1 -0
- package/charts/index.d.ts +2 -0
- package/charts/index.d.ts.map +1 -0
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/package.json +7 -2
- package/lib/widgets.d.ts +0 -6
- package/lib/widgets.d.ts.map +0 -1
- package/lib/widgets.js +0 -12
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PieProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente Pie para el gráfico de pastel (Pie chart).
|
|
4
|
+
* @param values - Valores para el gráfico
|
|
5
|
+
* @param size - Tamaño del componente
|
|
6
|
+
* @returns Componente Pie
|
|
7
|
+
*/
|
|
8
|
+
export declare function Pie({ values, size }: PieProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default Pie;
|
|
10
|
+
//# sourceMappingURL=Pie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pie.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/Pie.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAUxC;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,QAAQ,oDAgC7C;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import s from "echarts-for-react";
|
|
3
|
+
import { useRef as d } from "react";
|
|
4
|
+
import { CustomLegend as l } from "./subcomponents/CustomLegend/CustomLegend.js";
|
|
5
|
+
import { PieRootStyled as f, PieParentStyled as h, ChartContainerStyled as p, LegendContainerStyled as c } from "./slots/PieSlots.js";
|
|
6
|
+
import { usePieChartData as u } from "./hooks/usePieChartData.js";
|
|
7
|
+
import { useChartResize as C } from "./hooks/useChartResize.js";
|
|
8
|
+
function z({ values: o, size: i }) {
|
|
9
|
+
const t = d(null), { data: n, options: a } = u(o), m = C(t);
|
|
10
|
+
return /* @__PURE__ */ e(f, { children: /* @__PURE__ */ r(h, { children: [
|
|
11
|
+
/* @__PURE__ */ e(p, { ref: m, children: /* @__PURE__ */ e(
|
|
12
|
+
s,
|
|
13
|
+
{
|
|
14
|
+
ref: t,
|
|
15
|
+
option: a,
|
|
16
|
+
style: { height: "100%", width: "100%" },
|
|
17
|
+
notMerge: !0,
|
|
18
|
+
lazyUpdate: !0
|
|
19
|
+
}
|
|
20
|
+
) }),
|
|
21
|
+
/* @__PURE__ */ r(c, { children: [
|
|
22
|
+
/* @__PURE__ */ e(
|
|
23
|
+
l,
|
|
24
|
+
{
|
|
25
|
+
data: n,
|
|
26
|
+
size: i
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
" "
|
|
30
|
+
] })
|
|
31
|
+
] }) });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
z as Pie,
|
|
35
|
+
z as default
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pie.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/Pie.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC,eAAO,MAAM,SAAS,EAAE,SAyMvB,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { getTypographyStyles as i } from "@m4l/components";
|
|
2
|
+
const a = {
|
|
3
|
+
/**
|
|
4
|
+
* ***************************************************************
|
|
5
|
+
* Contenedor raíz: contexto de consulta de contenedores para el diseño responsivo.
|
|
6
|
+
* ***************************************************************
|
|
7
|
+
*/
|
|
8
|
+
pieRoot: () => ({
|
|
9
|
+
containerName: "root",
|
|
10
|
+
containerType: "size",
|
|
11
|
+
width: "100%",
|
|
12
|
+
height: "100%"
|
|
13
|
+
}),
|
|
14
|
+
/**
|
|
15
|
+
* ******************************************************************
|
|
16
|
+
* Contenedor flex interno que envuelve el gráfico y la leyenda.
|
|
17
|
+
* ******************************************************************
|
|
18
|
+
*/
|
|
19
|
+
pieParent: () => ({
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexFlow: "row wrap",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: "100%"
|
|
25
|
+
}),
|
|
26
|
+
/**
|
|
27
|
+
* *******************************************************************
|
|
28
|
+
* Caja izquierda: contenedor del gráfico. ReactECharts se renderiza dentro.
|
|
29
|
+
* *******************************************************************
|
|
30
|
+
*/
|
|
31
|
+
chartContainer: () => ({
|
|
32
|
+
display: "flex",
|
|
33
|
+
flex: "1 1 160px",
|
|
34
|
+
height: "100%",
|
|
35
|
+
width: "100%",
|
|
36
|
+
maxWidth: "200px",
|
|
37
|
+
maxHeight: "200px",
|
|
38
|
+
alignSelf: "center",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
"@container root (max-width: 359px)": {
|
|
41
|
+
height: "auto",
|
|
42
|
+
flex: "1 0 160px"
|
|
43
|
+
},
|
|
44
|
+
"@container root (max-width: 359px) and (max-height: 300px)": {
|
|
45
|
+
width: "100%",
|
|
46
|
+
height: "100%",
|
|
47
|
+
maxWidth: "100%"
|
|
48
|
+
},
|
|
49
|
+
"@container root (max-height: 65px)": {
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: "100%",
|
|
52
|
+
maxWidth: "100%"
|
|
53
|
+
},
|
|
54
|
+
"@container root (max-width: 120px)": {
|
|
55
|
+
width: "100%",
|
|
56
|
+
height: "100%",
|
|
57
|
+
maxWidth: "100%"
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
/**
|
|
61
|
+
* ********************************************************************
|
|
62
|
+
* Caja derecha: contenedor de la leyenda. CustomLegend se renderiza dentro.
|
|
63
|
+
* ********************************************************************
|
|
64
|
+
*/
|
|
65
|
+
legendContainer: ({ theme: e }) => ({
|
|
66
|
+
display: "flex",
|
|
67
|
+
flex: "1 0 100px",
|
|
68
|
+
flexFlow: "column wrap",
|
|
69
|
+
width: "100%",
|
|
70
|
+
height: "100%",
|
|
71
|
+
maxHeight: "150px",
|
|
72
|
+
alignSelf: "center",
|
|
73
|
+
// overflow: 'auto',
|
|
74
|
+
justifyContent: "flex-start",
|
|
75
|
+
alignContent: "flex-start",
|
|
76
|
+
gap: e.vars.size.baseSpacings.sp6,
|
|
77
|
+
"@container root (min-width: 0px) and (max-width: 299px)": {
|
|
78
|
+
flexFlow: "column nowrap",
|
|
79
|
+
alignContent: "flex-start",
|
|
80
|
+
alignItems: "flex-start",
|
|
81
|
+
justifyContent: "flex-start",
|
|
82
|
+
// overflow: 'auto',
|
|
83
|
+
maxHeight: "fit-content",
|
|
84
|
+
maxWidth: "100px"
|
|
85
|
+
},
|
|
86
|
+
"@container root (min-width: 300px) and (max-width: 344px)": {
|
|
87
|
+
justifyContent: "center",
|
|
88
|
+
flexFlow: "column nowrap",
|
|
89
|
+
alignContent: "flex-start",
|
|
90
|
+
alignItems: "flex-start",
|
|
91
|
+
// overflow: 'auto',
|
|
92
|
+
maxHeight: "fit-content",
|
|
93
|
+
maxWidth: "100px"
|
|
94
|
+
},
|
|
95
|
+
"@container root (max-width: 359px) and (max-height: 300px)": {
|
|
96
|
+
display: "none"
|
|
97
|
+
},
|
|
98
|
+
"@container root (max-height: 65px)": {
|
|
99
|
+
display: "none"
|
|
100
|
+
},
|
|
101
|
+
"@container root (max-width: 120px)": {
|
|
102
|
+
display: "none"
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
/**
|
|
106
|
+
* ******************************************************************
|
|
107
|
+
* Elemento de la leyenda (Grid).
|
|
108
|
+
* ******************************************************************
|
|
109
|
+
*/
|
|
110
|
+
legendItem: ({ theme: e }) => ({
|
|
111
|
+
display: "flex",
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
gap: e.vars.size.baseSpacings.sp2,
|
|
114
|
+
border: "1px solid transparent",
|
|
115
|
+
transition: "all 0.3s",
|
|
116
|
+
boxSizing: "border-box"
|
|
117
|
+
}),
|
|
118
|
+
/**
|
|
119
|
+
* ******************************************************************
|
|
120
|
+
* Punto de color del elemento de la leyenda.
|
|
121
|
+
* ******************************************************************
|
|
122
|
+
*/
|
|
123
|
+
legendItemColor: ({ theme: e, ownerState: t }) => ({
|
|
124
|
+
width: 11,
|
|
125
|
+
height: 11,
|
|
126
|
+
borderRadius: "30%",
|
|
127
|
+
backgroundColor: e.vars.palette.chips[t?.color]?.outlined.color,
|
|
128
|
+
flexShrink: 0
|
|
129
|
+
}),
|
|
130
|
+
/**
|
|
131
|
+
* ******************************************************************
|
|
132
|
+
* Contenedor de texto del elemento de la leyenda.
|
|
133
|
+
* ******************************************************************
|
|
134
|
+
*/
|
|
135
|
+
legendItemTextContainer: ({ theme: e }) => ({
|
|
136
|
+
color: e.vars.palette.text.primary,
|
|
137
|
+
flex: 1,
|
|
138
|
+
minWidth: 0,
|
|
139
|
+
display: "flex",
|
|
140
|
+
flexDirection: "column"
|
|
141
|
+
}),
|
|
142
|
+
/**
|
|
143
|
+
* ******************************************************************
|
|
144
|
+
* Contenedor de texto sub del elemento de la leyenda.
|
|
145
|
+
* ******************************************************************
|
|
146
|
+
*/
|
|
147
|
+
legendItemTextSubContainer: ({ theme: e }) => ({
|
|
148
|
+
display: "flex",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
gap: e.vars.size.baseSpacings["sp2-5"],
|
|
151
|
+
justifyContent: "flex-start"
|
|
152
|
+
}),
|
|
153
|
+
/**
|
|
154
|
+
* ******************************************************************
|
|
155
|
+
* Nombre del elemento de la leyenda.
|
|
156
|
+
* ******************************************************************
|
|
157
|
+
*/
|
|
158
|
+
legendItemName: ({ theme: e, ownerState: t }) => ({
|
|
159
|
+
...i(e.generalSettings.isMobile, t?.size || "medium", "subtitleDens"),
|
|
160
|
+
fontFamily: "Jura",
|
|
161
|
+
whiteSpace: "nowrap",
|
|
162
|
+
overflow: "hidden",
|
|
163
|
+
textOverflow: "ellipsis"
|
|
164
|
+
}),
|
|
165
|
+
/**
|
|
166
|
+
* ******************************************************************
|
|
167
|
+
* Badge de valor del elemento de la leyenda.
|
|
168
|
+
* ******************************************************************
|
|
169
|
+
*/
|
|
170
|
+
legendItemValueBadge: ({ theme: e, ownerState: t }) => ({
|
|
171
|
+
...i(e.generalSettings.isMobile, t?.size || "medium", "body"),
|
|
172
|
+
fontFamily: "Inter",
|
|
173
|
+
padding: `0 ${e.vars.size.baseSpacings.sp1}`,
|
|
174
|
+
borderRadius: e.vars.size.borderRadius.r1,
|
|
175
|
+
backgroundColor: e.vars.palette.chips[t?.color]?.contained.backgroundColor,
|
|
176
|
+
color: e.vars.palette.chips[t?.color]?.contained.color,
|
|
177
|
+
flexShrink: 0
|
|
178
|
+
}),
|
|
179
|
+
/**
|
|
180
|
+
* ******************************************************************
|
|
181
|
+
* Categoría del elemento de la leyenda.
|
|
182
|
+
* ******************************************************************
|
|
183
|
+
*/
|
|
184
|
+
legendItemCategory: ({ theme: e, ownerState: t }) => ({
|
|
185
|
+
...i(e.generalSettings.isMobile, t?.size || "medium", "body"),
|
|
186
|
+
fontFamily: "Inter",
|
|
187
|
+
color: e.vars.palette.text.secondary,
|
|
188
|
+
whiteSpace: "nowrap",
|
|
189
|
+
overflow: "hidden",
|
|
190
|
+
textOverflow: "ellipsis"
|
|
191
|
+
})
|
|
192
|
+
};
|
|
193
|
+
export {
|
|
194
|
+
a as pieStyles
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PieChartData } from '../types';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
/**
|
|
4
|
+
* Builds ECharts option config for the pie chart from data and theme.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateOptions(data: PieChartData[], theme: Theme): {
|
|
7
|
+
baseOption: {
|
|
8
|
+
tooltip: {
|
|
9
|
+
show: boolean;
|
|
10
|
+
};
|
|
11
|
+
legend: {
|
|
12
|
+
show: boolean;
|
|
13
|
+
};
|
|
14
|
+
series: ({
|
|
15
|
+
type: string;
|
|
16
|
+
coordinateSystem: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom renderItem for ECharts pie series.
|
|
19
|
+
*/
|
|
20
|
+
renderItem: (params: any, api: any) => {
|
|
21
|
+
type: string;
|
|
22
|
+
children: ({
|
|
23
|
+
type: string;
|
|
24
|
+
shape: {
|
|
25
|
+
cx: number;
|
|
26
|
+
cy: number;
|
|
27
|
+
r: number;
|
|
28
|
+
r0?: undefined;
|
|
29
|
+
};
|
|
30
|
+
style: {
|
|
31
|
+
fill: string;
|
|
32
|
+
stroke: string;
|
|
33
|
+
};
|
|
34
|
+
z: number;
|
|
35
|
+
} | {
|
|
36
|
+
type: string;
|
|
37
|
+
shape: {
|
|
38
|
+
cx: number;
|
|
39
|
+
cy: number;
|
|
40
|
+
r0: number;
|
|
41
|
+
r: number;
|
|
42
|
+
};
|
|
43
|
+
style: {
|
|
44
|
+
fill: string;
|
|
45
|
+
stroke?: undefined;
|
|
46
|
+
};
|
|
47
|
+
z: number;
|
|
48
|
+
})[];
|
|
49
|
+
};
|
|
50
|
+
data: number[];
|
|
51
|
+
radius?: undefined;
|
|
52
|
+
center?: undefined;
|
|
53
|
+
padAngle?: undefined;
|
|
54
|
+
label?: undefined;
|
|
55
|
+
labelLine?: undefined;
|
|
56
|
+
itemStyle?: undefined;
|
|
57
|
+
emphasis?: undefined;
|
|
58
|
+
} | {
|
|
59
|
+
type: string;
|
|
60
|
+
radius: string[];
|
|
61
|
+
center: string[];
|
|
62
|
+
padAngle: number;
|
|
63
|
+
data: PieChartData[];
|
|
64
|
+
label: {
|
|
65
|
+
show: boolean;
|
|
66
|
+
position: string;
|
|
67
|
+
};
|
|
68
|
+
labelLine: {
|
|
69
|
+
show: boolean;
|
|
70
|
+
};
|
|
71
|
+
itemStyle: {
|
|
72
|
+
borderRadius: string;
|
|
73
|
+
};
|
|
74
|
+
emphasis: {
|
|
75
|
+
label: {
|
|
76
|
+
show: boolean;
|
|
77
|
+
fontSize: number;
|
|
78
|
+
fontFamily: string;
|
|
79
|
+
fontWeight: number;
|
|
80
|
+
color: string;
|
|
81
|
+
formatter: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
coordinateSystem?: undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Custom renderItem for ECharts pie series.
|
|
87
|
+
*/
|
|
88
|
+
renderItem?: undefined;
|
|
89
|
+
})[];
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export declare const loadingOptions: {
|
|
93
|
+
text: string;
|
|
94
|
+
color: string;
|
|
95
|
+
textColor: string;
|
|
96
|
+
maskColor: string;
|
|
97
|
+
zlevel: number;
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/Pie/helpers/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK;;;;;;;;;;;YAmBxD;;eAEG;iCAC2B,GAAG,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAH3C;;eAEG;;;;EAuEZ;AAED,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
function u(e, t) {
|
|
2
|
+
const n = o(t.vars.palette.background.base), i = o(t.vars.palette.border.disabled), c = o(t.vars.palette.background.default), p = o(t.vars.palette.text.primary);
|
|
3
|
+
return {
|
|
4
|
+
baseOption: {
|
|
5
|
+
tooltip: {
|
|
6
|
+
show: !1
|
|
7
|
+
},
|
|
8
|
+
legend: {
|
|
9
|
+
show: !1
|
|
10
|
+
},
|
|
11
|
+
series: [
|
|
12
|
+
{
|
|
13
|
+
type: "custom",
|
|
14
|
+
coordinateSystem: "none",
|
|
15
|
+
/**
|
|
16
|
+
* Custom renderItem for ECharts pie series.
|
|
17
|
+
*/
|
|
18
|
+
renderItem: function(d, r) {
|
|
19
|
+
const a = r.getWidth() / 2, s = r.getHeight() / 2, l = Math.min(r.getWidth(), r.getHeight());
|
|
20
|
+
return {
|
|
21
|
+
type: "group",
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
type: "circle",
|
|
25
|
+
shape: {
|
|
26
|
+
cx: a,
|
|
27
|
+
cy: s,
|
|
28
|
+
r: l * 0.36
|
|
29
|
+
},
|
|
30
|
+
style: {
|
|
31
|
+
fill: n,
|
|
32
|
+
stroke: i
|
|
33
|
+
},
|
|
34
|
+
z: -10
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "ring",
|
|
38
|
+
shape: {
|
|
39
|
+
cx: a,
|
|
40
|
+
cy: s,
|
|
41
|
+
r0: l * 0.19,
|
|
42
|
+
r: l * 0.33
|
|
43
|
+
},
|
|
44
|
+
style: {
|
|
45
|
+
fill: c
|
|
46
|
+
},
|
|
47
|
+
z: -5
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
data: [0]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "pie",
|
|
56
|
+
radius: ["44%", "60%"],
|
|
57
|
+
center: ["50%", "50%"],
|
|
58
|
+
padAngle: 4,
|
|
59
|
+
data: e,
|
|
60
|
+
label: {
|
|
61
|
+
show: !1,
|
|
62
|
+
position: "center"
|
|
63
|
+
},
|
|
64
|
+
labelLine: {
|
|
65
|
+
show: !1
|
|
66
|
+
},
|
|
67
|
+
itemStyle: {
|
|
68
|
+
borderRadius: "6%"
|
|
69
|
+
},
|
|
70
|
+
emphasis: {
|
|
71
|
+
label: {
|
|
72
|
+
show: !0,
|
|
73
|
+
fontSize: 15,
|
|
74
|
+
fontFamily: "Jura",
|
|
75
|
+
fontWeight: 700,
|
|
76
|
+
color: p,
|
|
77
|
+
formatter: "{d}%"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function o(e) {
|
|
86
|
+
return e = e.replace("var(", ""), e = e.replace(")", ""), getComputedStyle(document.documentElement).getPropertyValue(e).trim();
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
u as generateOptions
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remap.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/Pie/helpers/remap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGvD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,YAAY,EAAE,CAYpE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BASE_TAG_OBJECT_COLORS_LIGHT as e } from "@m4l/styles";
|
|
2
|
+
function n(r) {
|
|
3
|
+
return r.map((o) => ({
|
|
4
|
+
name: o.title,
|
|
5
|
+
value: o.r,
|
|
6
|
+
valueFormatted: o.v,
|
|
7
|
+
itemStyle: {
|
|
8
|
+
color: l(o.palletColor)
|
|
9
|
+
},
|
|
10
|
+
colorName: o.palletColor
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
function l(r) {
|
|
14
|
+
return r.includes("#") ? r : e[r].contained.backgroundColorTone;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
n as remapData
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as ReactECharts } from 'echarts-for-react';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook para redimensionar el gráfico cuando el tamaño del contenedor cambia
|
|
4
|
+
* @param chartRef - Referencia al elemento del gráfico
|
|
5
|
+
* @returns Referencia al elemento padre del gráfico
|
|
6
|
+
*/
|
|
7
|
+
export declare function useChartResize(chartRef: React.RefObject<ReactECharts | null>): (node: HTMLDivElement | null) => void;
|
|
8
|
+
//# sourceMappingURL=useChartResize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartResize.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/Pie/hooks/useChartResize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAGlD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,yCAoB5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect as s } from "react";
|
|
2
|
+
import { useStateRef as a, useSizeContainer as o } from "@m4l/components";
|
|
3
|
+
function l(e) {
|
|
4
|
+
const [t, n] = a(null), r = o(t, {
|
|
5
|
+
throttleTime: 200,
|
|
6
|
+
excludePadding: !1,
|
|
7
|
+
leading: !0,
|
|
8
|
+
trailing: !0
|
|
9
|
+
});
|
|
10
|
+
return s(() => {
|
|
11
|
+
const i = e.current?.getEchartsInstance();
|
|
12
|
+
window.requestAnimationFrame(() => i?.resize());
|
|
13
|
+
}, [r, e]), n;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
l as useChartResize
|
|
17
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { PieProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns remapped pie data and ECharts options for the given values and current theme.
|
|
4
|
+
*/
|
|
5
|
+
export declare function usePieChartData(values: PieProps['values']): {
|
|
6
|
+
data: import('..').PieChartData[];
|
|
7
|
+
options: {
|
|
8
|
+
baseOption: {
|
|
9
|
+
tooltip: {
|
|
10
|
+
show: boolean;
|
|
11
|
+
};
|
|
12
|
+
legend: {
|
|
13
|
+
show: boolean;
|
|
14
|
+
};
|
|
15
|
+
series: ({
|
|
16
|
+
type: string;
|
|
17
|
+
coordinateSystem: string;
|
|
18
|
+
renderItem: (params: any, api: any) => {
|
|
19
|
+
type: string;
|
|
20
|
+
children: ({
|
|
21
|
+
type: string;
|
|
22
|
+
shape: {
|
|
23
|
+
cx: number;
|
|
24
|
+
cy: number;
|
|
25
|
+
r: number;
|
|
26
|
+
r0?: undefined;
|
|
27
|
+
};
|
|
28
|
+
style: {
|
|
29
|
+
fill: string;
|
|
30
|
+
stroke: string;
|
|
31
|
+
};
|
|
32
|
+
z: number;
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
shape: {
|
|
36
|
+
cx: number;
|
|
37
|
+
cy: number;
|
|
38
|
+
r0: number;
|
|
39
|
+
r: number;
|
|
40
|
+
};
|
|
41
|
+
style: {
|
|
42
|
+
fill: string;
|
|
43
|
+
stroke?: undefined;
|
|
44
|
+
};
|
|
45
|
+
z: number;
|
|
46
|
+
})[];
|
|
47
|
+
};
|
|
48
|
+
data: number[];
|
|
49
|
+
radius?: undefined;
|
|
50
|
+
center?: undefined;
|
|
51
|
+
padAngle?: undefined;
|
|
52
|
+
label?: undefined;
|
|
53
|
+
labelLine?: undefined;
|
|
54
|
+
itemStyle?: undefined;
|
|
55
|
+
emphasis?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
type: string;
|
|
58
|
+
radius: string[];
|
|
59
|
+
center: string[];
|
|
60
|
+
padAngle: number;
|
|
61
|
+
data: import('..').PieChartData[];
|
|
62
|
+
label: {
|
|
63
|
+
show: boolean;
|
|
64
|
+
position: string;
|
|
65
|
+
};
|
|
66
|
+
labelLine: {
|
|
67
|
+
show: boolean;
|
|
68
|
+
};
|
|
69
|
+
itemStyle: {
|
|
70
|
+
borderRadius: string;
|
|
71
|
+
};
|
|
72
|
+
emphasis: {
|
|
73
|
+
label: {
|
|
74
|
+
show: boolean;
|
|
75
|
+
fontSize: number;
|
|
76
|
+
fontFamily: string;
|
|
77
|
+
fontWeight: number;
|
|
78
|
+
color: string;
|
|
79
|
+
formatter: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
coordinateSystem?: undefined;
|
|
83
|
+
renderItem?: undefined;
|
|
84
|
+
})[];
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=usePieChartData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePieChartData.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/Pie/hooks/usePieChartData.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useMemo as r } from "react";
|
|
2
|
+
import { useTheme as n } from "@mui/material";
|
|
3
|
+
import { generateOptions as a } from "../helpers/options.js";
|
|
4
|
+
import { remapData as i } from "../helpers/remap.js";
|
|
5
|
+
function u(o) {
|
|
6
|
+
const e = n(), t = r(() => i(o), [o]), m = r(() => a(t, e), [t, e]);
|
|
7
|
+
return { data: t, options: m };
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
u as usePieChartData
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nombres de los slots para el componente de gráfico circular (Pie chart).
|
|
3
|
+
* Deben coincidir con las claves en Pie.styles.ts.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum PieSlots {
|
|
6
|
+
pieRoot = "pieRoot",
|
|
7
|
+
pieParent = "pieParent",
|
|
8
|
+
chartContainer = "chartContainer",
|
|
9
|
+
legendContainer = "legendContainer",
|
|
10
|
+
legendItem = "legendItem",
|
|
11
|
+
legendItemColor = "legendItemColor",
|
|
12
|
+
legendItemTextContainer = "legendItemTextContainer",
|
|
13
|
+
legendItemTextSubContainer = "legendItemTextSubContainer",
|
|
14
|
+
legendItemName = "legendItemName",
|
|
15
|
+
legendItemValueBadge = "legendItemValueBadge",
|
|
16
|
+
legendItemCategory = "legendItemCategory"
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=PieEnum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PieEnum.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/Pie/slots/PieEnum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,cAAc,mBAAkB;IAEhC,eAAe,oBAAoB;IACnC,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,uBAAuB,4BAA4B;IACnD,0BAA0B,+BAA+B;IACzD,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,kBAAkB,uBAAuB;CAC1C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var n = /* @__PURE__ */ ((e) => (e.pieRoot = "pieRoot", e.pieParent = "pieParent", e.chartContainer = "chartContainer", e.legendContainer = "legendContainer", e.legendItem = "legendItem", e.legendItemColor = "legendItemColor", e.legendItemTextContainer = "legendItemTextContainer", e.legendItemTextSubContainer = "legendItemTextSubContainer", e.legendItemName = "legendItemName", e.legendItemValueBadge = "legendItemValueBadge", e.legendItemCategory = "legendItemCategory", e))(n || {});
|
|
2
|
+
export {
|
|
3
|
+
n as PieSlots
|
|
4
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const PieRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
2
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
3
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const PieParentStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
5
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
6
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
7
|
+
export declare const ChartContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
8
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
9
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
10
|
+
export declare const LegendContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
11
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
12
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
13
|
+
export declare const LegendItemStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
14
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
15
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
16
|
+
export declare const LegendItemColorStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
17
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
18
|
+
}, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
19
|
+
export declare const LegendItemTextContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
20
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
21
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
22
|
+
export declare const LegendItemTextSubContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
23
|
+
ownerState?: (Partial<import('../types').PieOwnerState> & Record<string, unknown>) | undefined;
|
|
24
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
25
|
+
export declare const LegendItemNameStyled: any;
|
|
26
|
+
export declare const LegendItemValueBadgeStyled: any;
|
|
27
|
+
export declare const LegendItemCategoryStyled: any;
|
|
28
|
+
//# sourceMappingURL=PieSlots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PieSlots.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/Pie/slots/PieSlots.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa;;6NAGL,CAAC;AAEtB,eAAO,MAAM,eAAe;;6NAGL,CAAC;AAExB,eAAO,MAAM,oBAAoB;;6NAGL,CAAC;AAE7B,eAAO,MAAM,qBAAqB;;6NAGL,CAAC;AAE9B,eAAO,MAAM,gBAAgB;;6NAGL,CAAC;AAEzB,eAAO,MAAM,qBAAqB;;yGAIL,CAAC;AAE9B,eAAO,MAAM,6BAA6B;;6NAGL,CAAC;AAEtC,eAAO,MAAM,gCAAgC;;6NAGL,CAAC;AAEzC,eAAO,MAAM,oBAAoB,EAAE,GAGP,CAAC;AAE7B,eAAO,MAAM,0BAA0B,EAAE,GAGP,CAAC;AAEnC,eAAO,MAAM,wBAAwB,EAAE,GAGP,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { styled as e } from "@mui/material/styles";
|
|
2
|
+
import { Typography as d } from "@mui/material";
|
|
3
|
+
import { pieStyles as t } from "../Pie.styles.js";
|
|
4
|
+
import { PieSlots as n } from "./PieEnum.js";
|
|
5
|
+
import { PIE_KEY_COMPONENT as o } from "../constants.js";
|
|
6
|
+
const s = e("div", {
|
|
7
|
+
name: o,
|
|
8
|
+
slot: n.pieRoot
|
|
9
|
+
})(t.pieRoot), I = e("div", {
|
|
10
|
+
name: o,
|
|
11
|
+
slot: n.pieParent
|
|
12
|
+
})(t.pieParent), C = e("div", {
|
|
13
|
+
name: o,
|
|
14
|
+
slot: n.chartContainer
|
|
15
|
+
})(t.chartContainer), y = e("div", {
|
|
16
|
+
name: o,
|
|
17
|
+
slot: n.legendContainer
|
|
18
|
+
})(t.legendContainer), S = e("div", {
|
|
19
|
+
name: o,
|
|
20
|
+
slot: n.legendItem
|
|
21
|
+
})(t.legendItem), p = e("div", {
|
|
22
|
+
name: o,
|
|
23
|
+
slot: n.legendItemColor,
|
|
24
|
+
shouldForwardProp: (l) => l !== "ownerState"
|
|
25
|
+
})(t.legendItemColor), c = e("div", {
|
|
26
|
+
name: o,
|
|
27
|
+
slot: n.legendItemTextContainer
|
|
28
|
+
})(t.legendItemTextContainer), P = e("div", {
|
|
29
|
+
name: o,
|
|
30
|
+
slot: n.legendItemTextSubContainer
|
|
31
|
+
})(t.legendItemTextSubContainer), v = e(d, {
|
|
32
|
+
name: o,
|
|
33
|
+
slot: n.legendItemName
|
|
34
|
+
})(t.legendItemName), L = e(d, {
|
|
35
|
+
name: o,
|
|
36
|
+
slot: n.legendItemValueBadge
|
|
37
|
+
})(t.legendItemValueBadge), T = e(d, {
|
|
38
|
+
name: o,
|
|
39
|
+
slot: n.legendItemCategory
|
|
40
|
+
})(t.legendItemCategory);
|
|
41
|
+
export {
|
|
42
|
+
C as ChartContainerStyled,
|
|
43
|
+
y as LegendContainerStyled,
|
|
44
|
+
T as LegendItemCategoryStyled,
|
|
45
|
+
p as LegendItemColorStyled,
|
|
46
|
+
v as LegendItemNameStyled,
|
|
47
|
+
S as LegendItemStyled,
|
|
48
|
+
c as LegendItemTextContainerStyled,
|
|
49
|
+
P as LegendItemTextSubContainerStyled,
|
|
50
|
+
L as LegendItemValueBadgeStyled,
|
|
51
|
+
I as PieParentStyled,
|
|
52
|
+
s as PieRootStyled
|
|
53
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomLegendProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente CustomLegend para el gráfico de pastel (Pie chart). Muestra las etiquetas y valores de los segmentos.
|
|
4
|
+
* Los elementos se disponen en una fila cuando hay suficiente espacio y se envuelven a la siguiente línea (en una pila vertical) cuando no lo hay.
|
|
5
|
+
* @param data - Datos para el gráfico
|
|
6
|
+
* @param onLegendClick - Función para manejar el clic en la leyenda
|
|
7
|
+
* @param selectedLegendName - Nombre de la leyenda seleccionada
|
|
8
|
+
* @param size - Tamaño del componente
|
|
9
|
+
* @returns Componente CustomLegend
|
|
10
|
+
*/
|
|
11
|
+
export declare function CustomLegend({ data, size }: CustomLegendProps): import("@emotion/react/jsx-runtime").JSX.Element[];
|
|
12
|
+
//# sourceMappingURL=CustomLegend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomLegend.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/widgets/src/charts/Pie/subcomponents/CustomLegend/CustomLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAYjD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,iBAAiB,sDAgC7D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { LegendItemStyled as m, LegendItemColorStyled as a, LegendItemTextContainerStyled as c, LegendItemTextSubContainerStyled as g, LegendItemNameStyled as i, LegendItemValueBadgeStyled as S, LegendItemCategoryStyled as y } from "../../slots/PieSlots.js";
|
|
3
|
+
function u({ data: r, size: l }) {
|
|
4
|
+
return r.map((e, o) => {
|
|
5
|
+
const n = {
|
|
6
|
+
color: e.colorName,
|
|
7
|
+
size: l
|
|
8
|
+
};
|
|
9
|
+
return /* @__PURE__ */ d(
|
|
10
|
+
m,
|
|
11
|
+
{
|
|
12
|
+
ownerState: n,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ t(a, { ownerState: n }),
|
|
15
|
+
/* @__PURE__ */ d(c, { children: [
|
|
16
|
+
/* @__PURE__ */ d(g, { children: [
|
|
17
|
+
/* @__PURE__ */ t(i, { children: e.name.split(":")[1] }),
|
|
18
|
+
/* @__PURE__ */ t(S, { ownerState: n, children: e.valueFormatted })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ t(y, { children: e.name.split(":")[0] })
|
|
21
|
+
] })
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
o
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
u as CustomLegend
|
|
30
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
import { PieChartData } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Props para el subcomponente CustomLegend.
|
|
5
|
+
*/
|
|
6
|
+
export interface CustomLegendProps {
|
|
7
|
+
data: PieChartData[];
|
|
8
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/widgets/src/charts/Pie/subcomponents/CustomLegend/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
import { PieSlots } from './slots/PieEnum';
|
|
3
|
+
import { PIE_KEY_COMPONENT } from './constants';
|
|
4
|
+
import { M4LOverridesStyleRules } from '@m4l/components';
|
|
5
|
+
import { Theme } from '@mui/material/styles';
|
|
6
|
+
/**
|
|
7
|
+
* Item para el gráfico de Pie (API shape).
|
|
8
|
+
*/
|
|
9
|
+
export interface PieValueItem {
|
|
10
|
+
/** Muestra el nombre de la categoría. */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Muestra el valor formateado de la categoría. */
|
|
13
|
+
v: string;
|
|
14
|
+
/** Muestra el valor numérico de la categoría. */
|
|
15
|
+
r: number;
|
|
16
|
+
/** Muestra el color de la categoría. */
|
|
17
|
+
palletColor: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Props para el componente de gráfico de Pie.
|
|
21
|
+
*/
|
|
22
|
+
export interface PieProps {
|
|
23
|
+
/** Valores del gráfico (nombre, valor formateado, valor numérico, color). */
|
|
24
|
+
values: PieValueItem[];
|
|
25
|
+
/** Tamaño del componente. */
|
|
26
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Datos para el gráfico de Pie (nombre, valor, itemStyle).
|
|
30
|
+
*/
|
|
31
|
+
export interface PieChartData {
|
|
32
|
+
/** Muestra el nombre de la categoría. */
|
|
33
|
+
name: string;
|
|
34
|
+
/** Muestra el valor numérico de la categoría. */
|
|
35
|
+
value: number;
|
|
36
|
+
/** Muestra el valor formateado de la categoría. */
|
|
37
|
+
valueFormatted: string;
|
|
38
|
+
/** Muestra el color de la categoría. */
|
|
39
|
+
itemStyle: {
|
|
40
|
+
color: string;
|
|
41
|
+
};
|
|
42
|
+
/** Muestra el color de la categoría. */
|
|
43
|
+
colorName: string;
|
|
44
|
+
}
|
|
45
|
+
export type PieOwnerState = {
|
|
46
|
+
color?: PieChartData['colorName'];
|
|
47
|
+
size?: PieProps['size'];
|
|
48
|
+
selected?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export type PieSlotsType = keyof typeof PieSlots;
|
|
51
|
+
export type PieStyles = M4LOverridesStyleRules<PieSlotsType, typeof PIE_KEY_COMPONENT, Theme>;
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,CAAC,EAAE,MAAM,CAAC;IACV,iDAAiD;IACjD,CAAC,EAAE,MAAM,CAAC;IACV,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,6EAA6E;IAC7E,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,YAAY,GAAI,MAAM,OAAO,QAAQ,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,sBAAsB,CAAC,YAAY,EAAE,OAAO,iBAAiB,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/widgets/src/charts/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './charts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/widgets/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/widgets/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-beta-add-widgets-piechart.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,11 +24,16 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@emotion/react": "11.14.0",
|
|
26
26
|
"@emotion/styled": "11.14.1",
|
|
27
|
+
"@mui/material": "^5.0.0",
|
|
28
|
+
"echarts": "^6.0.0",
|
|
29
|
+
"echarts-for-react": "^3.0.0",
|
|
27
30
|
"react": "^18.0.0 || ^19.0.0",
|
|
28
31
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
29
32
|
},
|
|
30
33
|
"dependencies": {
|
|
31
34
|
"@emotion/react": "11.14.0",
|
|
32
|
-
"
|
|
35
|
+
"echarts-for-react": "^3.0.6",
|
|
36
|
+
"react": "^19.0.0",
|
|
37
|
+
"@mui/material": "5.16.7"
|
|
33
38
|
}
|
|
34
39
|
}
|
package/lib/widgets.d.ts
DELETED
package/lib/widgets.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../../../../../packages/widgets/src/lib/widgets.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,qDAMzB;AAED,eAAe,UAAU,CAAC"}
|
package/lib/widgets.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import e from "@emotion/styled";
|
|
3
|
-
const o = e.div`
|
|
4
|
-
color: pink;
|
|
5
|
-
`;
|
|
6
|
-
function r() {
|
|
7
|
-
return /* @__PURE__ */ t(o, { children: /* @__PURE__ */ t("h1", { children: "Welcome to M4lWidgets!" }) });
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
r as M4lWidgets,
|
|
11
|
-
r as default
|
|
12
|
-
};
|