@carto/ps-react-ui 4.4.1 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js.map +1 -1
- package/dist/download-config-Dqu78h2a.js +57 -0
- package/dist/download-config-Dqu78h2a.js.map +1 -0
- package/dist/error-CEkRPccv.js.map +1 -1
- package/dist/exports-Cr43OCul.js.map +1 -1
- package/dist/formatter-B9Bxn1k7.js +6 -0
- package/dist/formatter-B9Bxn1k7.js.map +1 -0
- package/dist/lasso-tool-BYbxrJ-7.js.map +1 -1
- package/dist/note-t51drNe0.js.map +1 -1
- package/dist/options-D9wflre6.js.map +1 -1
- package/dist/row-DTCV0Ocm.js.map +1 -1
- package/dist/series-CYNOu2Ju.js.map +1 -1
- package/dist/smart-tooltip-D4vwQpFf.js.map +1 -1
- package/dist/styles-Y8q7Jff3.js +118 -0
- package/dist/styles-Y8q7Jff3.js.map +1 -0
- package/dist/tooltip-BDnrRKrp.js.map +1 -1
- package/dist/types/components/basemaps/basemaps.d.ts +20 -0
- package/dist/types/components/geolocation-controls/geolocation-controls.d.ts +11 -0
- package/dist/types/components/lasso-tool/lasso-tool-inline.d.ts +17 -0
- package/dist/types/components/lasso-tool/lasso-tool.d.ts +21 -0
- package/dist/types/components/list-data/list-data.d.ts +16 -0
- package/dist/types/components/measurement-tools/measurement-tools.d.ts +20 -0
- package/dist/types/components/smart-tooltip/smart-tooltip.d.ts +17 -0
- package/dist/types/components/tooltip/tooltip.d.ts +13 -0
- package/dist/types/components/zoom-controls/zoom-controls.d.ts +16 -0
- package/dist/types/hooks/use-widget-ref.d.ts +4 -4
- package/dist/types/widgets/actions/brush-toggle/types.d.ts +8 -2
- package/dist/types/widgets/actions/download/download.d.ts +11 -0
- package/dist/types/widgets/actions/download/exports.d.ts +15 -0
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +13 -0
- package/dist/types/widgets/actions/index.d.ts +1 -1
- package/dist/types/widgets/actions/relative-data/relative-data.d.ts +1 -0
- package/dist/types/widgets/bar/config.d.ts +8 -4
- package/dist/types/widgets/category/category-ui.d.ts +3 -0
- package/dist/types/widgets/category/components/category-bar.d.ts +3 -0
- package/dist/types/widgets/category/components/category-legend.d.ts +3 -0
- package/dist/types/widgets/category/components/category-row-multi.d.ts +5 -1
- package/dist/types/widgets/category/components/category-row-other.d.ts +3 -0
- package/dist/types/widgets/category/components/category-row-single.d.ts +5 -1
- package/dist/types/widgets/category/config.d.ts +11 -0
- package/dist/types/widgets/category/types.d.ts +1 -0
- package/dist/types/widgets/echart/echart-ui.d.ts +7 -0
- package/dist/types/widgets/echart/echart.d.ts +6 -0
- package/dist/types/widgets/echart/options.d.ts +7 -0
- package/dist/types/widgets/echart/types.d.ts +3 -0
- package/dist/types/widgets/echart/utils.d.ts +41 -0
- package/dist/types/widgets/error/error.d.ts +10 -0
- package/dist/types/widgets/formula/components/item.d.ts +3 -0
- package/dist/types/widgets/formula/components/prefix.d.ts +3 -0
- package/dist/types/widgets/formula/components/row.d.ts +3 -0
- package/dist/types/widgets/formula/components/series.d.ts +3 -0
- package/dist/types/widgets/formula/components/suffix.d.ts +3 -0
- package/dist/types/widgets/formula/components/value.d.ts +3 -0
- package/dist/types/widgets/formula/config.d.ts +11 -0
- package/dist/types/widgets/formula/formula-ui.d.ts +3 -0
- package/dist/types/widgets/histogram/config.d.ts +18 -2
- package/dist/types/widgets/histogram/index.d.ts +2 -1
- package/dist/types/widgets/histogram/types.d.ts +6 -3
- package/dist/types/widgets/loader/loader.d.ts +22 -0
- package/dist/types/widgets/loader/utils.d.ts +26 -3
- package/dist/types/widgets/markdown/config.d.ts +10 -0
- package/dist/types/widgets/markdown/markdown-ui.d.ts +7 -0
- package/dist/types/widgets/markdown/markdown.d.ts +3 -0
- package/dist/types/widgets/note/note.d.ts +10 -0
- package/dist/types/widgets/pie/config.d.ts +8 -4
- package/dist/types/widgets/range/components/range-item.d.ts +3 -0
- package/dist/types/widgets/range/config.d.ts +5 -0
- package/dist/types/widgets/range/range-ui.d.ts +3 -0
- package/dist/types/widgets/scatterplot/config.d.ts +7 -3
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +11 -0
- package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +10 -0
- package/dist/types/widgets/spread/components/max-value.d.ts +3 -0
- package/dist/types/widgets/spread/components/min-value.d.ts +3 -0
- package/dist/types/widgets/spread/components/separator.d.ts +3 -0
- package/dist/types/widgets/spread/config.d.ts +11 -0
- package/dist/types/widgets/spread/spread-ui.d.ts +3 -0
- package/dist/types/widgets/stores/types.d.ts +2 -0
- package/dist/types/widgets/subheader/subheader.d.ts +11 -0
- package/dist/types/widgets/table/config.d.ts +8 -3
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +11 -3
- package/dist/types/widgets/table/hooks/use-selection.d.ts +11 -2
- package/dist/types/widgets/table/hooks/use-sort.d.ts +11 -3
- package/dist/types/widgets/timeseries/config.d.ts +8 -4
- package/dist/types/widgets/utils/chart-config/download-config.d.ts +3 -0
- package/dist/types/widgets/{_shared → utils}/chart-config/index.d.ts +2 -0
- package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.d.ts +14 -9
- package/dist/types/widgets/utils/formatter.d.ts +2 -0
- package/dist/types/widgets/utils/index.d.ts +7 -0
- package/dist/types/widgets/wrapper/components/actions.d.ts +3 -0
- package/dist/types/widgets/wrapper/components/options.d.ts +3 -0
- package/dist/types/widgets/wrapper/components/title.d.ts +3 -0
- package/dist/types/widgets/wrapper/wrapper-ui.d.ts +14 -0
- package/dist/types/widgets/wrapper/wrapper.d.ts +14 -0
- package/dist/use-widget-ref-wtFLDFCD.js.map +1 -1
- package/dist/utils-BOhInag6.js.map +1 -1
- package/dist/widgets/actions.js +720 -681
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +78 -92
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +206 -197
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/formula.js +54 -54
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +106 -86
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/loader.js.map +1 -1
- package/dist/widgets/markdown.js.map +1 -1
- package/dist/widgets/pie.js +147 -112
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/range.js +23 -22
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/scatterplot.js +46 -60
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/selection-summary.js.map +1 -1
- package/dist/widgets/skeleton-loader.js.map +1 -1
- package/dist/widgets/spread.js +40 -41
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/subheader.js.map +1 -1
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +51 -65
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/toolbar-actions.js +101 -6693
- package/dist/widgets/toolbar-actions.js.map +1 -1
- package/dist/widgets/utils.js +33 -0
- package/dist/widgets/utils.js.map +1 -0
- package/dist/widgets/wrapper.js.map +1 -1
- package/package.json +9 -4
- package/src/components/basemaps/basemaps.tsx +20 -0
- package/src/components/geolocation-controls/geolocation-controls.tsx +11 -0
- package/src/components/lasso-tool/lasso-tool-inline.tsx +17 -0
- package/src/components/lasso-tool/lasso-tool.tsx +21 -0
- package/src/components/list-data/list-data.tsx +16 -0
- package/src/components/measurement-tools/measurement-tools.tsx +20 -0
- package/src/components/smart-tooltip/smart-tooltip.tsx +17 -0
- package/src/components/tooltip/tooltip.tsx +13 -0
- package/src/components/zoom-controls/zoom-controls.tsx +16 -0
- package/src/hooks/use-widget-ref.ts +4 -4
- package/src/widgets/README.md +13 -13
- package/src/widgets/actions/brush-toggle/brush-toggle.tsx +42 -47
- package/src/widgets/actions/brush-toggle/types.ts +8 -2
- package/src/widgets/actions/download/download.tsx +11 -0
- package/src/widgets/actions/download/exports.tsx +15 -0
- package/src/widgets/actions/fullscreen/fullscreen.tsx +13 -0
- package/src/widgets/actions/index.ts +1 -0
- package/src/widgets/actions/relative-data/relative-data.test.tsx +62 -1
- package/src/widgets/actions/relative-data/relative-data.tsx +62 -39
- package/src/widgets/bar/config.ts +34 -34
- package/src/widgets/bar/style.ts +1 -1
- package/src/widgets/category/category-ui.tsx +12 -2
- package/src/widgets/category/components/category-bar.tsx +3 -0
- package/src/widgets/category/components/category-legend.tsx +3 -0
- package/src/widgets/category/components/category-row-multi.tsx +9 -2
- package/src/widgets/category/components/category-row-other.tsx +3 -0
- package/src/widgets/category/components/category-row-single.tsx +8 -1
- package/src/widgets/category/config.ts +11 -0
- package/src/widgets/category/types.ts +1 -0
- package/src/widgets/echart/echart-ui.tsx +7 -0
- package/src/widgets/echart/echart.tsx +6 -0
- package/src/widgets/echart/options.ts +7 -0
- package/src/widgets/echart/types.ts +3 -0
- package/src/widgets/echart/utils.ts +41 -0
- package/src/widgets/error/error.tsx +10 -0
- package/src/widgets/formula/components/item.tsx +3 -0
- package/src/widgets/formula/components/prefix.tsx +3 -0
- package/src/widgets/formula/components/row.tsx +3 -0
- package/src/widgets/formula/components/series.tsx +3 -0
- package/src/widgets/formula/components/suffix.tsx +3 -0
- package/src/widgets/formula/components/value.tsx +4 -2
- package/src/widgets/formula/config.ts +11 -0
- package/src/widgets/formula/formula-ui.tsx +3 -0
- package/src/widgets/histogram/config.ts +93 -21
- package/src/widgets/histogram/index.ts +6 -1
- package/src/widgets/histogram/style.ts +1 -1
- package/src/widgets/histogram/types.ts +9 -3
- package/src/widgets/loader/loader.tsx +22 -0
- package/src/widgets/loader/utils.ts +26 -3
- package/src/widgets/markdown/config.ts +10 -0
- package/src/widgets/markdown/markdown-ui.tsx +7 -0
- package/src/widgets/markdown/markdown.tsx +3 -0
- package/src/widgets/note/note.tsx +10 -0
- package/src/widgets/pie/config.ts +100 -33
- package/src/widgets/pie/style.ts +1 -1
- package/src/widgets/range/components/range-item.tsx +5 -2
- package/src/widgets/range/config.ts +5 -0
- package/src/widgets/range/range-ui.tsx +3 -0
- package/src/widgets/scatterplot/config.ts +19 -23
- package/src/widgets/scatterplot/style.ts +1 -1
- package/src/widgets/selection-summary/selection-summary.tsx +11 -0
- package/src/widgets/skeleton-loader/skeleton-loader.tsx +10 -0
- package/src/widgets/spread/components/max-value.tsx +4 -2
- package/src/widgets/spread/components/min-value.tsx +4 -2
- package/src/widgets/spread/components/separator.tsx +3 -0
- package/src/widgets/spread/config.ts +11 -0
- package/src/widgets/spread/spread-ui.tsx +3 -0
- package/src/widgets/stores/types.ts +2 -0
- package/src/widgets/subheader/subheader.tsx +11 -0
- package/src/widgets/table/config.ts +8 -3
- package/src/widgets/table/hooks/use-pagination.ts +11 -3
- package/src/widgets/table/hooks/use-selection.ts +11 -2
- package/src/widgets/table/hooks/use-sort.ts +11 -3
- package/src/widgets/timeseries/config.ts +32 -33
- package/src/widgets/timeseries/style.ts +1 -1
- package/src/widgets/utils/chart-config/download-config.ts +22 -0
- package/src/widgets/{_shared → utils}/chart-config/index.ts +4 -0
- package/src/widgets/{_shared → utils}/chart-config/option-builders.ts +23 -13
- package/src/widgets/utils/formatter.ts +2 -0
- package/src/widgets/utils/index.ts +26 -0
- package/src/widgets/wrapper/components/actions.tsx +3 -0
- package/src/widgets/wrapper/components/options.tsx +3 -0
- package/src/widgets/wrapper/components/title.tsx +3 -0
- package/src/widgets/wrapper/wrapper-ui.tsx +14 -0
- package/src/widgets/wrapper/wrapper.tsx +14 -0
- package/dist/styles-CAroD5Rc.js +0 -123
- package/dist/styles-CAroD5Rc.js.map +0 -1
- /package/dist/types/widgets/{_shared → utils}/chart-config/config-factory.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/chart-config/csv-modifiers.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.test.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/skeleton/index.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/skeleton/styles.d.ts +0 -0
- /package/src/widgets/{_shared → utils}/chart-config/config-factory.ts +0 -0
- /package/src/widgets/{_shared → utils}/chart-config/csv-modifiers.ts +0 -0
- /package/src/widgets/{_shared → utils}/chart-config/option-builders.test.ts +0 -0
- /package/src/widgets/{_shared → utils}/skeleton/index.ts +0 -0
- /package/src/widgets/{_shared → utils}/skeleton/styles.ts +0 -0
package/dist/widgets/pie.js
CHANGED
|
@@ -1,66 +1,97 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsxs as x, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { c as C } from "react/compiler-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "echarts";
|
|
5
5
|
import "../widget-store-CzDt8oSK.js";
|
|
6
6
|
import "zustand/shallow";
|
|
7
|
-
import { g as
|
|
8
|
-
import { m as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import "@mui/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import "../lasso-tool-BYbxrJ-7.js";
|
|
15
|
-
import "../cjs-D4KH3azB.js";
|
|
16
|
-
import "@dnd-kit/core";
|
|
17
|
-
import "@dnd-kit/sortable";
|
|
18
|
-
import "@dnd-kit/utilities";
|
|
19
|
-
function te({
|
|
20
|
-
refUI: e
|
|
21
|
-
}) {
|
|
22
|
-
return [{
|
|
23
|
-
...y,
|
|
24
|
-
modifier: () => y.modifier(e)
|
|
25
|
-
}, {
|
|
26
|
-
...x,
|
|
27
|
-
modifier: async (t) => {
|
|
28
|
-
const n = C(t);
|
|
29
|
-
return x.modifier(n);
|
|
30
|
-
}
|
|
31
|
-
}];
|
|
32
|
-
}
|
|
33
|
-
function oe(e) {
|
|
7
|
+
import { g as L } from "../options-D9wflre6.js";
|
|
8
|
+
import { m as N } from "../utils-BOhInag6.js";
|
|
9
|
+
import { c as j, f as A } from "../download-config-Dqu78h2a.js";
|
|
10
|
+
import { g as b, h as O, n as v, d as S, e as _, c as T } from "../styles-Y8q7Jff3.js";
|
|
11
|
+
import { Box as h, Skeleton as f } from "@mui/material";
|
|
12
|
+
const Y = j(A);
|
|
13
|
+
function F(e) {
|
|
34
14
|
return {
|
|
35
15
|
type: "pie",
|
|
36
|
-
option:
|
|
16
|
+
option: N(L(e), z(e)),
|
|
17
|
+
formatter: e.formatter,
|
|
18
|
+
labelFormatter: e.labelFormatter
|
|
37
19
|
};
|
|
38
20
|
}
|
|
39
|
-
function
|
|
21
|
+
function z({
|
|
40
22
|
data: e = [],
|
|
41
|
-
theme:
|
|
42
|
-
formatter:
|
|
23
|
+
theme: n,
|
|
24
|
+
formatter: r,
|
|
25
|
+
labelFormatter: o
|
|
43
26
|
}) {
|
|
44
|
-
if ((e?.length ?? 0) > 1)
|
|
27
|
+
if ((e?.length ?? 0) > 1) {
|
|
28
|
+
let i = 0, l = 1;
|
|
45
29
|
return {
|
|
30
|
+
legend: _({
|
|
31
|
+
hasLegend: !0,
|
|
32
|
+
labelFormatter: o
|
|
33
|
+
}),
|
|
34
|
+
grid: {
|
|
35
|
+
...S(!0, n),
|
|
36
|
+
right: parseInt(n.spacing(4))
|
|
37
|
+
},
|
|
46
38
|
xAxis: {
|
|
47
39
|
type: "value",
|
|
48
|
-
|
|
40
|
+
min: (t) => (i = t.min < 0 ? v(t.min) : 0, i),
|
|
41
|
+
max: (t) => (l = t.max <= 0 ? 1 : v(t.max), l),
|
|
42
|
+
axisLabel: {
|
|
43
|
+
fontSize: n.typography.overlineDelicate.fontSize,
|
|
44
|
+
fontFamily: n.typography.overlineDelicate.fontFamily,
|
|
45
|
+
margin: parseInt(n.spacing(1)),
|
|
46
|
+
show: !0,
|
|
47
|
+
showMaxLabel: !0,
|
|
48
|
+
showMinLabel: !0,
|
|
49
|
+
verticalAlign: "bottom",
|
|
50
|
+
inside: !0,
|
|
51
|
+
formatter: (t) => t !== l && t !== i || t === 0 ? "" : r ? r(t) : String(t)
|
|
52
|
+
},
|
|
53
|
+
axisLine: {
|
|
54
|
+
show: !1
|
|
55
|
+
},
|
|
56
|
+
axisTick: {
|
|
57
|
+
show: !1
|
|
58
|
+
},
|
|
59
|
+
splitLine: {
|
|
60
|
+
show: !0,
|
|
61
|
+
lineStyle: {
|
|
62
|
+
color: n.palette.black[4]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
49
65
|
},
|
|
50
66
|
yAxis: {
|
|
51
67
|
type: "category",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
axisLine: {
|
|
69
|
+
show: !1
|
|
70
|
+
},
|
|
71
|
+
axisTick: {
|
|
72
|
+
show: !1
|
|
73
|
+
},
|
|
74
|
+
axisLabel: {
|
|
75
|
+
padding: [parseInt(n.spacing(0.5)), 0, 0, 0],
|
|
76
|
+
...o && {
|
|
77
|
+
formatter: (t) => String(o(t))
|
|
78
|
+
}
|
|
79
|
+
}
|
|
57
80
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
tooltip: {
|
|
82
|
+
position: O(n),
|
|
83
|
+
formatter: b((t) => {
|
|
84
|
+
const s = t.value, u = t.dimensionNames?.[t.encode?.x?.at(0) ?? 1], a = s[u ?? ""], d = typeof a == "number" && r ? r(a) : a ?? "", m = typeof t.marker == "string" ? t.marker : "", I = t.seriesName ? `${t.seriesName}: ` : "";
|
|
85
|
+
return {
|
|
86
|
+
name: o ? String(o(t.name ?? "")) : t.name ?? "",
|
|
87
|
+
seriesName: I,
|
|
88
|
+
marker: m,
|
|
89
|
+
value: d
|
|
90
|
+
};
|
|
91
|
+
})
|
|
61
92
|
},
|
|
62
|
-
series: e.map((
|
|
63
|
-
datasetIndex:
|
|
93
|
+
series: e.map((t, s) => ({
|
|
94
|
+
datasetIndex: s,
|
|
64
95
|
type: "bar",
|
|
65
96
|
barMaxWidth: 100,
|
|
66
97
|
emphasis: {
|
|
@@ -68,11 +99,15 @@ function N({
|
|
|
68
99
|
}
|
|
69
100
|
}))
|
|
70
101
|
};
|
|
71
|
-
|
|
102
|
+
}
|
|
103
|
+
const c = !0;
|
|
72
104
|
return {
|
|
73
|
-
legend:
|
|
105
|
+
legend: _({
|
|
106
|
+
hasLegend: c,
|
|
107
|
+
labelFormatter: o
|
|
108
|
+
}),
|
|
74
109
|
grid: {
|
|
75
|
-
...
|
|
110
|
+
...S(c, n),
|
|
76
111
|
left: 0,
|
|
77
112
|
top: 0,
|
|
78
113
|
right: 0
|
|
@@ -85,38 +120,38 @@ function N({
|
|
|
85
120
|
},
|
|
86
121
|
tooltip: {
|
|
87
122
|
trigger: "item",
|
|
88
|
-
formatter:
|
|
89
|
-
const l =
|
|
123
|
+
formatter: b((i) => {
|
|
124
|
+
const l = i.value && typeof i.value == "object" && !Array.isArray(i.value) ? Object.values(i.value) : [], t = i.encode?.value?.at(0), s = l[t ?? 0], u = typeof s == "number" && r ? r(s) : s ?? "", a = typeof i.marker == "string" ? i.marker : "", d = i.seriesName ? `${i.seriesName}: ` : "", m = o ? String(o(i.name ?? "")) : i.name ?? "";
|
|
90
125
|
return {
|
|
91
|
-
name:
|
|
92
|
-
seriesName:
|
|
93
|
-
marker:
|
|
126
|
+
name: d,
|
|
127
|
+
seriesName: m,
|
|
128
|
+
marker: a,
|
|
94
129
|
value: u
|
|
95
130
|
};
|
|
96
131
|
})
|
|
97
132
|
},
|
|
98
|
-
color: Object.values(
|
|
99
|
-
series: e.map((
|
|
133
|
+
color: Object.values(n.palette.qualitative.bold),
|
|
134
|
+
series: e.map((i, l) => ({
|
|
100
135
|
datasetIndex: l,
|
|
101
136
|
type: "pie",
|
|
102
137
|
colorBy: "data",
|
|
103
138
|
radius: ["74%", "90%"],
|
|
104
139
|
avoidLabelOverlap: !0,
|
|
105
140
|
selectedOffset: 0,
|
|
106
|
-
bottom: parseInt(
|
|
141
|
+
bottom: parseInt(n.spacing(4)),
|
|
107
142
|
label: {
|
|
108
143
|
show: !0,
|
|
109
144
|
position: "center",
|
|
110
|
-
formatter: (
|
|
145
|
+
formatter: (t) => {
|
|
111
146
|
const {
|
|
112
|
-
name:
|
|
113
|
-
} =
|
|
147
|
+
name: s
|
|
148
|
+
} = t, u = t.encode?.value?.[0];
|
|
114
149
|
if (u === void 0)
|
|
115
150
|
return "";
|
|
116
|
-
const
|
|
117
|
-
return `{c|${
|
|
151
|
+
const a = Object.values(t.data ?? {}).at(u), d = typeof a == "number" && r ? r(a) : a ?? "", m = o ? String(o(s ?? "")) : s ?? "";
|
|
152
|
+
return `{c|${d}}
|
|
118
153
|
|
|
119
|
-
{b|${
|
|
154
|
+
{b|${m}}`;
|
|
120
155
|
},
|
|
121
156
|
rich: {
|
|
122
157
|
b: {
|
|
@@ -135,96 +170,96 @@ function N({
|
|
|
135
170
|
disabled: !0
|
|
136
171
|
},
|
|
137
172
|
itemStyle: {
|
|
138
|
-
borderColor:
|
|
173
|
+
borderColor: n.palette.background.paper,
|
|
139
174
|
borderWidth: 1
|
|
140
175
|
}
|
|
141
176
|
}))
|
|
142
177
|
};
|
|
143
178
|
}
|
|
144
|
-
const
|
|
179
|
+
const $ = {
|
|
145
180
|
skeleton: {
|
|
146
|
-
graph:
|
|
181
|
+
graph: T.graph
|
|
147
182
|
}
|
|
148
|
-
},
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
151
|
-
let
|
|
152
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
183
|
+
}, k = 32, y = 294 - k, w = y - k;
|
|
184
|
+
function ee() {
|
|
185
|
+
const e = C(5);
|
|
186
|
+
let n, r;
|
|
187
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = {
|
|
153
188
|
display: "flex",
|
|
154
189
|
alignItems: "center",
|
|
155
190
|
justifyContent: "center",
|
|
156
191
|
position: "relative"
|
|
157
|
-
},
|
|
158
|
-
let
|
|
159
|
-
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
192
|
+
}, r = /* @__PURE__ */ p(f, { variant: "circular", width: y, height: y }), e[0] = n, e[1] = r) : (n = e[0], r = e[1]);
|
|
193
|
+
let o;
|
|
194
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ p(f, { sx: {
|
|
160
195
|
position: "absolute",
|
|
161
196
|
zIndex: 1
|
|
162
|
-
}, variant: "circular", width:
|
|
163
|
-
let
|
|
164
|
-
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/* @__PURE__ */
|
|
197
|
+
}, variant: "circular", width: w, height: w }), e[2] = o) : o = e[2];
|
|
198
|
+
let g;
|
|
199
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ x(h, { sx: n, children: [
|
|
200
|
+
r,
|
|
201
|
+
o,
|
|
202
|
+
/* @__PURE__ */ x(h, { sx: {
|
|
168
203
|
position: "absolute",
|
|
169
204
|
zIndex: 2,
|
|
170
205
|
display: "flex",
|
|
171
206
|
flexDirection: "column",
|
|
172
207
|
alignItems: "center",
|
|
173
208
|
justifyContent: "center",
|
|
174
|
-
gap:
|
|
209
|
+
gap: V
|
|
175
210
|
}, children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ p(f, { height: 24, width: 72 }),
|
|
212
|
+
/* @__PURE__ */ p(f, { height: 8, width: 48 })
|
|
178
213
|
] })
|
|
179
|
-
] }), e[3] =
|
|
180
|
-
let
|
|
181
|
-
return e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
182
|
-
|
|
183
|
-
/* @__PURE__ */
|
|
214
|
+
] }), e[3] = g) : g = e[3];
|
|
215
|
+
let c;
|
|
216
|
+
return e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ x(h, { sx: $.skeleton.graph.container, children: [
|
|
217
|
+
g,
|
|
218
|
+
/* @__PURE__ */ p(h, { sx: {
|
|
184
219
|
display: "flex",
|
|
185
220
|
alignItems: "center",
|
|
186
|
-
gap:
|
|
187
|
-
height:
|
|
188
|
-
}, children: Array(2).fill(0).map(
|
|
189
|
-
] }), e[4] =
|
|
221
|
+
gap: W,
|
|
222
|
+
height: M
|
|
223
|
+
}, children: Array(2).fill(0).map(D) })
|
|
224
|
+
] }), e[4] = c) : c = e[4], c;
|
|
190
225
|
}
|
|
191
|
-
function
|
|
192
|
-
return /* @__PURE__ */
|
|
226
|
+
function D(e, n) {
|
|
227
|
+
return /* @__PURE__ */ x(h, { sx: {
|
|
193
228
|
display: "flex",
|
|
194
229
|
alignItems: "center",
|
|
195
|
-
gap:
|
|
230
|
+
gap: E
|
|
196
231
|
}, children: [
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
] }, `skeleton-${
|
|
232
|
+
/* @__PURE__ */ p(f, { variant: "circular", width: 8, height: 8 }),
|
|
233
|
+
/* @__PURE__ */ p(f, { width: 48, height: 8 })
|
|
234
|
+
] }, `skeleton-${n}`);
|
|
200
235
|
}
|
|
201
|
-
function
|
|
236
|
+
function E(e) {
|
|
202
237
|
const {
|
|
203
|
-
spacing:
|
|
238
|
+
spacing: n
|
|
204
239
|
} = e;
|
|
205
|
-
return
|
|
240
|
+
return n(1.5);
|
|
206
241
|
}
|
|
207
|
-
function
|
|
242
|
+
function M(e) {
|
|
208
243
|
const {
|
|
209
|
-
spacing:
|
|
244
|
+
spacing: n
|
|
210
245
|
} = e;
|
|
211
|
-
return
|
|
246
|
+
return n(5);
|
|
212
247
|
}
|
|
213
|
-
function
|
|
248
|
+
function W(e) {
|
|
214
249
|
const {
|
|
215
|
-
spacing:
|
|
250
|
+
spacing: n
|
|
216
251
|
} = e;
|
|
217
|
-
return
|
|
252
|
+
return n(2);
|
|
218
253
|
}
|
|
219
|
-
function
|
|
254
|
+
function V(e) {
|
|
220
255
|
const {
|
|
221
|
-
spacing:
|
|
256
|
+
spacing: n
|
|
222
257
|
} = e;
|
|
223
|
-
return
|
|
258
|
+
return n(1);
|
|
224
259
|
}
|
|
225
260
|
export {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
261
|
+
ee as PieSkeleton,
|
|
262
|
+
F as pieConfig,
|
|
263
|
+
Y as pieDownloadConfig
|
|
229
264
|
};
|
|
230
265
|
//# sourceMappingURL=pie.js.map
|
package/dist/widgets/pie.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie.js","sources":["../../src/widgets/pie/config.ts","../../src/widgets/pie/style.ts","../../src/widgets/pie/skeleton.tsx"],"sourcesContent":["import {\n getCommonOptions,\n mergeEchartWidgetConfig,\n type EchartOptionsProps,\n} from '../echart'\nimport type { PieConfig, PieWidgetConfig, PieWidgetData } from './types'\nimport {\n buildGridConfig,\n buildLegendConfig,\n flattenObjectArrayToCSV,\n createTooltipFormatter,\n} from '../_shared/chart-config'\nimport { downloadToCSV, downloadToPNG, type DownloadItem } from '../actions'\nimport type { ConfigProps } from '../loader/types'\n\nexport function pieDownloadConfig({\n refUI,\n}: ConfigProps): DownloadItem<PieWidgetData>[] {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const rows = flattenObjectArrayToCSV(data)\n return downloadToCSV.modifier(rows)\n },\n },\n ]\n}\n\nexport function pieConfig(props: PieConfig): PieWidgetConfig {\n return {\n type: 'pie',\n option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),\n }\n}\n\nfunction getOption({\n data = [],\n theme,\n formatter,\n}: PieConfig): EchartOptionsProps {\n const multiSeries = (data?.length ?? 0) > 1\n\n if (multiSeries) {\n return {\n xAxis: {\n type: 'value',\n show: true,\n },\n yAxis: {\n type: 'category',\n show: true,\n },\n legend: {\n show: true,\n bottom: 0,\n },\n grid: {\n bottom: parseInt(theme.spacing(4)),\n right: parseInt(theme.spacing(4)),\n },\n series: data.map((_: unknown, index: number) => ({\n datasetIndex: index,\n type: 'bar',\n barMaxWidth: 100,\n emphasis: {\n focus: 'series',\n },\n })),\n }\n }\n\n const hasLegend = true\n\n return {\n legend: buildLegendConfig(hasLegend),\n grid: {\n ...buildGridConfig(hasLegend, theme),\n left: 0,\n top: 0,\n right: 0,\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n tooltip: {\n trigger: 'item',\n formatter: createTooltipFormatter((item) => {\n const value =\n item.value &&\n typeof item.value === 'object' &&\n !Array.isArray(item.value)\n ? (Object.values(item.value) as (string | number)[])\n : []\n const index = item.encode?.value?.at(0)\n const _value = value[index ?? 0]\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : (_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = item.name ?? ''\n\n return {\n name: seriesName,\n seriesName: name,\n marker,\n value: formattedValue,\n }\n }),\n },\n color: Object.values(theme.palette.qualitative.bold),\n series: data.map((_: unknown, index: number) => ({\n datasetIndex: index,\n type: 'pie',\n colorBy: 'data',\n radius: ['74%', '90%'],\n avoidLabelOverlap: true,\n selectedOffset: 0,\n bottom: parseInt(theme.spacing(4)),\n\n label: {\n show: true,\n position: 'center',\n formatter: (params) => {\n const { name } = params\n const encodeIndex = params.encode?.value?.[0]\n if (encodeIndex === undefined) {\n return ''\n }\n\n const value = Object.values(params.data ?? {}).at(encodeIndex) as\n | number\n | string\n\n const formattedValue =\n typeof value === 'number' && formatter\n ? formatter(value)\n : (value ?? '')\n\n const nameFormatted = name\n\n return `{c|${formattedValue}}\\n\\n{b|${nameFormatted}}`\n },\n rich: {\n b: {\n fontSize: 16,\n fontWeight: 'normal',\n lineHeight: 20,\n },\n c: {\n fontSize: 28,\n fontWeight: 'bold',\n lineHeight: 27,\n },\n },\n },\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n borderColor: theme.palette.background.paper,\n borderWidth: 1,\n },\n })),\n } as EchartOptionsProps\n}\n","import type { SxProps, Theme } from '@mui/material'\nimport { baseSkeletonStyles } from '../_shared/skeleton'\n\nexport const styles = {\n skeleton: {\n graph: baseSkeletonStyles.graph,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nconst GUTTER = 32\nconst SIZE = 294 - GUTTER\nconst INNER_SIZE = SIZE - GUTTER\n\nexport function PieSkeleton() {\n return (\n <Box sx={styles.skeleton.graph.container}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <Skeleton variant='circular' width={SIZE} height={SIZE} />\n <Skeleton\n sx={{\n position: 'absolute',\n zIndex: 1,\n }}\n variant='circular'\n width={INNER_SIZE}\n height={INNER_SIZE}\n />\n <Box\n sx={{\n position: 'absolute',\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: ({ spacing }) => spacing(1),\n }}\n >\n <Skeleton height={24} width={72} />\n <Skeleton height={8} width={48} />\n </Box>\n </Box>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n }}\n >\n {Array(2)\n .fill(0)\n .map((_, i) => (\n <Box\n key={`skeleton-${i}`}\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n }}\n >\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n"],"names":["pieDownloadConfig","refUI","downloadToPNG","modifier","downloadToCSV","data","rows","flattenObjectArrayToCSV","pieConfig","props","type","option","mergeEchartWidgetConfig","getCommonOptions","getOption","theme","formatter","length","xAxis","show","yAxis","legend","bottom","grid","parseInt","spacing","right","series","map","_","index","datasetIndex","barMaxWidth","emphasis","focus","hasLegend","buildLegendConfig","buildGridConfig","left","top","tooltip","trigger","createTooltipFormatter","item","value","Array","isArray","Object","values","encode","at","_value","formattedValue","marker","seriesName","name","color","palette","qualitative","bold","colorBy","radius","avoidLabelOverlap","selectedOffset","label","position","params","encodeIndex","undefined","rich","b","fontSize","fontWeight","lineHeight","c","disabled","itemStyle","borderColor","background","paper","borderWidth","styles","skeleton","graph","baseSkeletonStyles","GUTTER","SIZE","INNER_SIZE","PieSkeleton","$","_c","t0","t1","Symbol","for","display","alignItems","justifyContent","Skeleton","t2","jsx","zIndex","t3","Box","jsxs","flexDirection","gap","_temp","t4","container","_temp2","height","_temp3","fill","_temp5","i","_temp4","spacing_2","spacing_1","spacing_0"],"mappings":";;;;;;;;;;;;;;;;;;AAeO,SAASA,GAAkB;AAAA,EAChCC,OAAAA;AACW,GAAkC;AAC7C,SAAO,CACL;AAAA,IACE,GAAGC;AAAAA,IACHC,UAAUA,MAAMD,EAAcC,SAASF,CAAK;AAAA,EAAA,GAE9C;AAAA,IACE,GAAGG;AAAAA,IACHD,UAAU,OAAOE,MAAS;AACxB,YAAMC,IAAOC,EAAwBF,CAAI;AACzC,aAAOD,EAAcD,SAASG,CAAI;AAAA,IACpC;AAAA,EAAA,CACD;AAEL;AAEO,SAASE,GAAUC,GAAmC;AAC3D,SAAO;AAAA,IACLC,MAAM;AAAA,IACNC,QAAQC,EAAwBC,EAAiBJ,CAAK,GAAGK,EAAUL,CAAK,CAAC;AAAA,EAAA;AAE7E;AAEA,SAASK,EAAU;AAAA,EACjBT,MAAAA,IAAO,CAAA;AAAA,EACPU,OAAAA;AAAAA,EACAC,WAAAA;AACS,GAAuB;AAGhC,OAFqBX,GAAMY,UAAU,KAAK;AAGxC,WAAO;AAAA,MACLC,OAAO;AAAA,QACLR,MAAM;AAAA,QACNS,MAAM;AAAA,MAAA;AAAA,MAERC,OAAO;AAAA,QACLV,MAAM;AAAA,QACNS,MAAM;AAAA,MAAA;AAAA,MAERE,QAAQ;AAAA,QACNF,MAAM;AAAA,QAC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AAC;AAxCnC,SAAAkF,EAAAhB,GAAA;AA6BW,QAAA;AAAA,IAAAlE,SAAAA;AAAAA,EAAAA,IAAAkE;AAAW,SAAKlE,EAAQ,CAAC;AAAC;"}
|
|
1
|
+
{"version":3,"file":"pie.js","sources":["../../src/widgets/pie/config.ts","../../src/widgets/pie/style.ts","../../src/widgets/pie/skeleton.tsx"],"sourcesContent":["import {\n getCommonOptions,\n mergeEchartWidgetConfig,\n type EchartOptionsProps,\n} from '../echart'\nimport type { PieConfig, PieWidgetConfig, PieWidgetData } from './types'\nimport {\n buildGridConfig,\n buildLegendConfig,\n flattenObjectArrayToCSV,\n createTooltipPositioner,\n createTooltipFormatter,\n createChartDownloadConfig,\n niceNum,\n} from '../utils/chart-config'\n\nexport const pieDownloadConfig = createChartDownloadConfig<PieWidgetData>(\n flattenObjectArrayToCSV,\n)\n\n/**\n * Generates ECharts configuration for pie and donut chart widgets. Falls back to a horizontal bar layout when multiple data series are provided.\n *\n * @param props - Pie chart configuration including data and theme.\n * @returns Widget config with ECharts option object.\n */\nexport function pieConfig(props: PieConfig): PieWidgetConfig {\n return {\n type: 'pie',\n option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),\n formatter: props.formatter,\n labelFormatter: props.labelFormatter,\n }\n}\n\nfunction getOption({\n data = [],\n theme,\n formatter,\n labelFormatter,\n}: PieConfig): EchartOptionsProps {\n const multiSeries = (data?.length ?? 0) > 1\n\n if (multiSeries) {\n let niceMin = 0\n let niceMax = 1\n\n return {\n legend: buildLegendConfig({ hasLegend: true, labelFormatter }),\n grid: {\n ...buildGridConfig(true, theme),\n right: parseInt(theme.spacing(4)),\n },\n xAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom' as const,\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n axisLine: {\n show: false,\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n yAxis: {\n type: 'category',\n axisLine: {\n show: false,\n },\n axisTick: {\n show: false,\n },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n ...(labelFormatter && {\n formatter: (value: string | number) =>\n String(labelFormatter(value)),\n }),\n },\n },\n tooltip: {\n position: createTooltipPositioner(theme),\n formatter: createTooltipFormatter((item) => {\n const value = item.value as Record<string, string | number>\n const index = item.dimensionNames?.[item.encode?.x?.at(0) ?? 1]\n const _value = value[index ?? '']\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : (_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n\n return { name, seriesName, marker, value: formattedValue }\n }),\n },\n series: data.map((_: unknown, index: number) => ({\n datasetIndex: index,\n type: 'bar',\n barMaxWidth: 100,\n emphasis: {\n focus: 'series',\n },\n })),\n }\n }\n\n const hasLegend = true\n\n return {\n legend: buildLegendConfig({ hasLegend, labelFormatter }),\n grid: {\n ...buildGridConfig(hasLegend, theme),\n left: 0,\n top: 0,\n right: 0,\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n tooltip: {\n trigger: 'item',\n formatter: createTooltipFormatter((item) => {\n const value =\n item.value &&\n typeof item.value === 'object' &&\n !Array.isArray(item.value)\n ? (Object.values(item.value) as (string | number)[])\n : []\n const index = item.encode?.value?.at(0)\n const _value = value[index ?? 0]\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : (_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n\n return {\n name: seriesName,\n seriesName: name,\n marker,\n value: formattedValue,\n }\n }),\n },\n color: Object.values(theme.palette.qualitative.bold),\n series: data.map((_: unknown, index: number) => ({\n datasetIndex: index,\n type: 'pie',\n colorBy: 'data',\n radius: ['74%', '90%'],\n avoidLabelOverlap: true,\n selectedOffset: 0,\n bottom: parseInt(theme.spacing(4)),\n\n label: {\n show: true,\n position: 'center',\n formatter: (params) => {\n const { name } = params\n const encodeIndex = params.encode?.value?.[0]\n if (encodeIndex === undefined) {\n return ''\n }\n\n const value = Object.values(params.data ?? {}).at(encodeIndex) as\n | number\n | string\n\n const formattedValue =\n typeof value === 'number' && formatter\n ? formatter(value)\n : (value ?? '')\n\n const nameFormatted = labelFormatter\n ? String(labelFormatter(name ?? ''))\n : (name ?? '')\n\n return `{c|${formattedValue}}\\n\\n{b|${nameFormatted}}`\n },\n rich: {\n b: {\n fontSize: 16,\n fontWeight: 'normal',\n lineHeight: 20,\n },\n c: {\n fontSize: 28,\n fontWeight: 'bold',\n lineHeight: 27,\n },\n },\n },\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n borderColor: theme.palette.background.paper,\n borderWidth: 1,\n },\n })),\n } as EchartOptionsProps\n}\n","import type { SxProps, Theme } from '@mui/material'\nimport { baseSkeletonStyles } from '../utils/skeleton'\n\nexport const styles = {\n skeleton: {\n graph: baseSkeletonStyles.graph,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nconst GUTTER = 32\nconst SIZE = 294 - GUTTER\nconst INNER_SIZE = SIZE - GUTTER\n\nexport function PieSkeleton() {\n return (\n <Box sx={styles.skeleton.graph.container}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <Skeleton variant='circular' width={SIZE} height={SIZE} />\n <Skeleton\n sx={{\n position: 'absolute',\n zIndex: 1,\n }}\n variant='circular'\n width={INNER_SIZE}\n height={INNER_SIZE}\n />\n <Box\n sx={{\n position: 'absolute',\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: ({ spacing }) => spacing(1),\n }}\n >\n <Skeleton height={24} width={72} />\n <Skeleton height={8} width={48} />\n </Box>\n </Box>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n }}\n >\n {Array(2)\n .fill(0)\n .map((_, i) => (\n <Box\n key={`skeleton-${i}`}\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n }}\n >\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n"],"names":["pieDownloadConfig","createChartDownloadConfig","flattenObjectArrayToCSV","pieConfig","props","type","option","mergeEchartWidgetConfig","getCommonOptions","getOption","formatter","labelFormatter","data","theme","length","niceMin","niceMax","legend","buildLegendConfig","hasLegend","grid","buildGridConfig","right","parseInt","spacing","xAxis","min","extent","niceNum","max","axisLabel","fontSize","typography","overlineDelicate","fontFamily","margin","show","showMaxLabel","showMinLabel","verticalAlign","inside","value","String","axisLine","axisTick","splitLine","lineStyle","color","palette","black","yAxis","padding","tooltip","position","createTooltipPositioner","createTooltipFormatter","item","index","dimensionNames","encode","x","at","_value","formattedValue","marker","seriesName","name","series","map","_","datasetIndex","barMaxWidth","emphasis","focus","left","top","trigger","Array","isArray","Object","values","qualitative","bold","colorBy","radius","avoidLabelOverlap","selectedOffset","bottom","label","params","encodeIndex","undefined","nameFormatted","rich","b","fontWeight","lineHeight","c","disabled","itemStyle","borderColor","background","paper","borderWidth","styles","skeleton","graph","baseSkeletonStyles","GUTTER","SIZE","INNER_SIZE","PieSkeleton","$","_c","t0","t1","Symbol","for","display","alignItems","justifyContent","Skeleton","t2","jsx","zIndex","t3","Box","jsxs","flexDirection","gap","_temp","t4","container","_temp2","height","_temp3","fill","_temp5","i","_temp4","spacing_2","spacing_1","spacing_0"],"mappings":";;;;;;;;;;;AAgBO,MAAMA,IAAoBC,EAC/BC,CACF;AAQO,SAASC,EAAUC,GAAmC;AAC3D,SAAO;AAAA,IACLC,MAAM;AAAA,IACNC,QAAQC,EAAwBC,EAAiBJ,CAAK,GAAGK,EAAUL,CAAK,CAAC;AAAA,IACzEM,WAAWN,EAAMM;AAAAA,IACjBC,gBAAgBP,EAAMO;AAAAA,EAAAA;AAE1B;AAEA,SAASF,EAAU;AAAA,EACjBG,MAAAA,IAAO,CAAA;AAAA,EACPC,OAAAA;AAAAA,EACAH,WAAAA;AAAAA,EACAC,gBAAAA;AACS,GAAuB;AAGhC,OAFqBC,GAAME,UAAU,KAAK,GAEzB;AACf,QAAIC,IAAU,GACVC,IAAU;AAEd,WAAO;AAAA,MACLC,QAAQC,EAAkB;AAAA,QAAEC,WAAW;AAAA,QAAMR,gBAAAA;AAAAA,MAAAA,CAAgB;AAAA,MAC7DS,MAAM;AAAA,QACJ,GAAGC,EAAgB,IAAMR,CAAK;AAAA,QAC9BS,OAAOC,SAASV,EAAMW,QAAQ,CAAC,CAAC;AAAA,MAAA;AAAA,MAElCC,OAAO;AAAA,QACLpB,MAAM;AAAA,QACNqB,KAAKA,CAACC,OACJZ,IAAUY,EAAOD,MAAM,IAAIE,EAAQD,EAAOD,GAAG,IAAI,GAC1CX;AAAAA,QAETc,KAAKA,CAACF,OACJX,IAAUW,EAAOE,OAAO,IAAI,IAAID,EAAQD,EAAOE,GAAG,GAC3Cb;AAAAA,QAETc,WAAW;AAAA,UACTC,UAAUlB,EAAMmB,WAAWC,iBAAiBF;AAAAA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A,IAAY,QAAA,EAAA,CAAC;AAAA,EAAA,EAAA,GARzB,YAAYiB,CAAC,EASpB;AAAM;AAzDX,SAAAC,EAAAzB,GAAA;AAoDe,QAAA;AAAA,IAAA1F,SAAAoH;AAAAA,EAAAA,IAAA1B;AAAW,SAAK1F,EAAQ,GAAG;AAAC;AApD3C,SAAA+G,EAAArB,GAAA;AAyCY,QAAA;AAAA,IAAA1F,SAAAqH;AAAAA,EAAAA,IAAA3B;AAAW,SAAK1F,EAAQ,CAAC;AAAC;AAzCtC,SAAA6G,EAAAnB,GAAA;AAwCS,QAAA;AAAA,IAAA1F,SAAAsH;AAAAA,EAAAA,IAAA5B;AAAW,SAAK1F,EAAQ,CAAC;AAAC;AAxCnC,SAAA0G,EAAAhB,GAAA;AA6BW,QAAA;AAAA,IAAA1F,SAAAA;AAAAA,EAAAA,IAAA0F;AAAW,SAAK1F,EAAQ,CAAC;AAAC;"}
|
package/dist/widgets/range.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Box as E, Slider as te, TextField as ne, Skeleton as H } from "@mui/mat
|
|
|
5
5
|
import { useState as X } from "react";
|
|
6
6
|
import { u as $ } from "../widget-store-CzDt8oSK.js";
|
|
7
7
|
import { useShallow as J } from "zustand/shallow";
|
|
8
|
+
import { d as ie } from "../formatter-B9Bxn1k7.js";
|
|
8
9
|
const v = {
|
|
9
10
|
rangeItem: {
|
|
10
11
|
display: "flex",
|
|
@@ -34,7 +35,7 @@ const v = {
|
|
|
34
35
|
color: (n) => n.palette.text.disabled
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
+
};
|
|
38
39
|
function ae(n) {
|
|
39
40
|
const e = L(65), {
|
|
40
41
|
id: i,
|
|
@@ -52,12 +53,12 @@ function ae(n) {
|
|
|
52
53
|
if (!t)
|
|
53
54
|
return null;
|
|
54
55
|
let B;
|
|
55
|
-
e[7] !== c || e[8] !== i || e[9] !== a || e[10] !== t || e[11] !== m || e[12] !== d ? (B = (s,
|
|
56
|
-
if (Array.isArray(
|
|
57
|
-
const [G, P] =
|
|
56
|
+
e[7] !== c || e[8] !== i || e[9] !== a || e[10] !== t || e[11] !== m || e[12] !== d ? (B = (s, S) => {
|
|
57
|
+
if (Array.isArray(S)) {
|
|
58
|
+
const [G, P] = S, x = c(i)?.data ?? [];
|
|
58
59
|
x[a] = {
|
|
59
60
|
...t,
|
|
60
|
-
value:
|
|
61
|
+
value: S
|
|
61
62
|
}, d(i, {
|
|
62
63
|
data: x
|
|
63
64
|
}), m?.([G, P], a);
|
|
@@ -68,14 +69,14 @@ function ae(n) {
|
|
|
68
69
|
e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = (s) => {
|
|
69
70
|
y(s.target.name);
|
|
70
71
|
}, e[14] = g) : g = e[14];
|
|
71
|
-
const
|
|
72
|
+
const _ = g;
|
|
72
73
|
let w;
|
|
73
74
|
if (e[15] !== l[0] || e[16] !== l[1] || e[17] !== c || e[18] !== i || e[19] !== a || e[20] !== t.max || e[21] !== t.min || e[22] !== m || e[23] !== d) {
|
|
74
|
-
const s = (
|
|
75
|
+
const s = (S) => {
|
|
75
76
|
const {
|
|
76
77
|
name: G,
|
|
77
78
|
value: P
|
|
78
|
-
} =
|
|
79
|
+
} = S.target;
|
|
79
80
|
let x;
|
|
80
81
|
G === "min" ? x = [Math.min(Math.max(t.min, parseFloat(P) || t.min), l[1]), l[1] ?? 0] : x = [l[0] ?? 0, Math.max(Math.min(t.max, parseFloat(P) || t.max), l[0])];
|
|
81
82
|
const Y = c(i)?.data ?? [];
|
|
@@ -86,8 +87,8 @@ function ae(n) {
|
|
|
86
87
|
} : O)
|
|
87
88
|
}), m?.([x[0], x[1]], a);
|
|
88
89
|
};
|
|
89
|
-
w = (
|
|
90
|
-
y(""), s(
|
|
90
|
+
w = (S) => {
|
|
91
|
+
y(""), s(S);
|
|
91
92
|
}, e[15] = l[0], e[16] = l[1], e[17] = c, e[18] = i, e[19] = a, e[20] = t.max, e[21] = t.min, e[22] = m, e[23] = d, e[24] = w;
|
|
92
93
|
} else
|
|
93
94
|
w = e[24];
|
|
@@ -114,14 +115,14 @@ function ae(n) {
|
|
|
114
115
|
"aria-label": "Minimum value"
|
|
115
116
|
}, e[41] = V) : V = e[41];
|
|
116
117
|
let F;
|
|
117
|
-
e[42] !== o || e[43] !== p || e[44] !== R || e[45] !== u || e[46] !== t.disabled || e[47] !== T || e[48] !== N ? (F = /* @__PURE__ */ f(Q, { isEditing: u, name: "min", value: N, formatter: o, onFocus:
|
|
118
|
+
e[42] !== o || e[43] !== p || e[44] !== R || e[45] !== u || e[46] !== t.disabled || e[47] !== T || e[48] !== N ? (F = /* @__PURE__ */ f(Q, { isEditing: u, name: "min", value: N, formatter: o, onFocus: _, onBlur: p, onKeyDown: R, disabled: t.disabled, inputProps: V }, T), e[42] = o, e[43] = p, e[44] = R, e[45] = u, e[46] = t.disabled, e[47] = T, e[48] = N, e[49] = F) : F = e[49];
|
|
118
119
|
const U = `max-${l[1]}`, q = l[1] ?? 0;
|
|
119
120
|
let z;
|
|
120
121
|
e[50] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = {
|
|
121
122
|
"aria-label": "Maximum value"
|
|
122
123
|
}, e[50] = z) : z = e[50];
|
|
123
124
|
let k;
|
|
124
|
-
e[51] !== o || e[52] !== p || e[53] !== R || e[54] !== u || e[55] !== t.disabled || e[56] !== U || e[57] !== q ? (k = /* @__PURE__ */ f(Q, { isEditing: u, name: "max", value: q, formatter: o, onFocus:
|
|
125
|
+
e[51] !== o || e[52] !== p || e[53] !== R || e[54] !== u || e[55] !== t.disabled || e[56] !== U || e[57] !== q ? (k = /* @__PURE__ */ f(Q, { isEditing: u, name: "max", value: q, formatter: o, onFocus: _, onBlur: p, onKeyDown: R, disabled: t.disabled, inputProps: z }, U), e[51] = o, e[52] = p, e[53] = R, e[54] = u, e[55] = t.disabled, e[56] = U, e[57] = q, e[58] = k) : k = e[58];
|
|
125
126
|
let W;
|
|
126
127
|
e[59] !== F || e[60] !== k ? (W = /* @__PURE__ */ j(E, { sx: v.inputsRow, children: [
|
|
127
128
|
F,
|
|
@@ -158,10 +159,10 @@ function Q(n) {
|
|
|
158
159
|
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = (w) => {
|
|
159
160
|
l(w.target.value);
|
|
160
161
|
}, e[3] = g) : g = e[3];
|
|
161
|
-
let
|
|
162
|
-
return e[4] !== r || e[5] !== d || e[6] !== a || e[7] !== o || e[8] !== m || e[9] !== c || e[10] !== I ? (
|
|
162
|
+
let _;
|
|
163
|
+
return e[4] !== r || e[5] !== d || e[6] !== a || e[7] !== o || e[8] !== m || e[9] !== c || e[10] !== I ? (_ = /* @__PURE__ */ f(ne, { name: a, value: I, onChange: g, onFocus: m, onBlur: o, onKeyDown: c, disabled: r, size: "small", sx: v.input, inputProps: d }), e[4] = r, e[5] = d, e[6] = a, e[7] = o, e[8] = m, e[9] = c, e[10] = I, e[11] = _) : _ = e[11], _;
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function he(n) {
|
|
165
166
|
const e = L(5);
|
|
166
167
|
let i;
|
|
167
168
|
e[0] !== n.id ? (i = (r) => {
|
|
@@ -173,7 +174,7 @@ function pe(n) {
|
|
|
173
174
|
let a;
|
|
174
175
|
return e[2] !== n.id || e[3] !== i ? (a = /* @__PURE__ */ f(ee, { id: n.id, children: i }), e[2] = n.id, e[3] = i, e[4] = a) : a = e[4], a;
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
+
function xe() {
|
|
177
178
|
const n = L(2);
|
|
178
179
|
let e;
|
|
179
180
|
n[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ f(H, { width: "100%", height: 32 }), n[0] = e) : e = n[0];
|
|
@@ -186,7 +187,7 @@ function he() {
|
|
|
186
187
|
] })
|
|
187
188
|
] }), n[1] = i) : i = n[1], i;
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
+
function be() {
|
|
190
191
|
return {};
|
|
191
192
|
}
|
|
192
193
|
function oe(n) {
|
|
@@ -195,15 +196,15 @@ function oe(n) {
|
|
|
195
196
|
note: typeof n.note == "string" ? n.note : void 0
|
|
196
197
|
};
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function ye(n) {
|
|
199
200
|
return n?.map(oe);
|
|
200
201
|
}
|
|
201
202
|
export {
|
|
202
203
|
ae as RangeItem,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
xe as RangeSkeleton,
|
|
205
|
+
he as RangeUI,
|
|
206
|
+
be as rangeConfig,
|
|
206
207
|
oe as sanitizeRangeDataItem,
|
|
207
|
-
|
|
208
|
+
ye as sanitizeRangeDataItems
|
|
208
209
|
};
|
|
209
210
|
//# sourceMappingURL=range.js.map
|