@carto/ps-react-ui 4.11.3 → 4.12.1
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/chat.js +962 -733
- package/dist/chat.js.map +1 -1
- package/dist/csv-item-hH_Gt7ur.js +32 -0
- package/dist/csv-item-hH_Gt7ur.js.map +1 -0
- package/dist/{echart-BMPpj7n_.js → echart-Bdvbfx9s.js} +2 -2
- package/dist/echart-Bdvbfx9s.js.map +1 -0
- package/dist/{option-builders-F-c9ELi1.js → option-builders-DPeoyQaM.js} +41 -33
- package/dist/option-builders-DPeoyQaM.js.map +1 -0
- package/dist/png-item-9dNbB37T.js +57 -0
- package/dist/png-item-9dNbB37T.js.map +1 -0
- package/dist/table-B3ZWWhJt.js +383 -0
- package/dist/table-B3ZWWhJt.js.map +1 -0
- package/dist/types/chat/containers/chat-footer.d.ts +1 -1
- package/dist/types/chat/containers/styles.d.ts +79 -12
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/chat/types.d.ts +21 -0
- package/dist/types/chat/use-typewriter.d.ts +5 -3
- package/dist/types/widgets/utils/chart-config/index.d.ts +1 -1
- package/dist/types/widgets-v2/actions/download/constants.d.ts +12 -0
- package/dist/types/widgets-v2/actions/download/csv-item.d.ts +38 -0
- package/dist/types/widgets-v2/actions/download/icons.d.ts +6 -0
- package/dist/types/widgets-v2/actions/download/index.d.ts +3 -1
- package/dist/types/widgets-v2/actions/index.d.ts +1 -1
- package/dist/types/widgets-v2/pie/skeleton.d.ts +9 -0
- package/dist/widgets/bar.js +1 -1
- package/dist/widgets/histogram.js +1 -1
- package/dist/widgets/pie.js +1 -1
- package/dist/widgets/scatterplot.js +5 -5
- package/dist/widgets/timeseries.js +1 -1
- package/dist/widgets/utils.js +1 -1
- package/dist/widgets-v2/actions.js +40 -36
- package/dist/widgets-v2/actions.js.map +1 -1
- package/dist/widgets-v2/bar.js +69 -76
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +50 -55
- package/dist/widgets-v2/category.js.map +1 -1
- package/dist/widgets-v2/echart.js +1 -1
- package/dist/widgets-v2/formula.js +37 -43
- package/dist/widgets-v2/formula.js.map +1 -1
- package/dist/widgets-v2/histogram.js +141 -147
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/markdown.js +18 -17
- package/dist/widgets-v2/markdown.js.map +1 -1
- package/dist/widgets-v2/pie.js +174 -126
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +156 -166
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/spread.js +36 -41
- package/dist/widgets-v2/spread.js.map +1 -1
- package/dist/widgets-v2/table.js +46 -55
- package/dist/widgets-v2/table.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +83 -89
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2.js +3 -3
- package/package.json +1 -1
- package/src/chat/bubbles/styles.ts +5 -1
- package/src/chat/containers/chat-content.tsx +4 -1
- package/src/chat/containers/chat-footer.test.tsx +59 -0
- package/src/chat/containers/chat-footer.tsx +124 -36
- package/src/chat/containers/styles.ts +107 -16
- package/src/chat/feedback/styles.ts +11 -4
- package/src/chat/index.ts +1 -0
- package/src/chat/types.ts +22 -0
- package/src/chat/use-typewriter.ts +32 -24
- package/src/widgets/utils/chart-config/index.ts +1 -0
- package/src/widgets/utils/chart-config/option-builders.test.ts +34 -0
- package/src/widgets/utils/chart-config/option-builders.ts +21 -0
- package/src/widgets-v2/actions/download/constants.ts +14 -0
- package/src/widgets-v2/actions/download/csv-item.test.tsx +77 -0
- package/src/widgets-v2/actions/download/csv-item.tsx +71 -0
- package/src/widgets-v2/actions/download/icons.tsx +10 -1
- package/src/widgets-v2/actions/download/index.ts +3 -1
- package/src/widgets-v2/actions/download/png-item.tsx +2 -1
- package/src/widgets-v2/actions/index.ts +5 -0
- package/src/widgets-v2/bar/download.tsx +16 -22
- package/src/widgets-v2/bar/options.ts +3 -2
- package/src/widgets-v2/category/download.test.ts +9 -0
- package/src/widgets-v2/category/download.ts +16 -20
- package/src/widgets-v2/echart/edge-label-clamp.ts +7 -4
- package/src/widgets-v2/formula/download.tsx +23 -29
- package/src/widgets-v2/histogram/download.ts +22 -26
- package/src/widgets-v2/histogram/options.ts +3 -2
- package/src/widgets-v2/markdown/{download.ts → download.tsx} +5 -2
- package/src/widgets-v2/pie/download.ts +16 -20
- package/src/widgets-v2/pie/skeleton.test.tsx +6 -3
- package/src/widgets-v2/pie/skeleton.tsx +69 -7
- package/src/widgets-v2/scatterplot/download.ts +16 -20
- package/src/widgets-v2/scatterplot/options.ts +3 -6
- package/src/widgets-v2/spread/download.ts +23 -27
- package/src/widgets-v2/table/download.test.ts +10 -0
- package/src/widgets-v2/table/download.ts +11 -15
- package/src/widgets-v2/table/helpers.test.ts +19 -0
- package/src/widgets-v2/table/helpers.ts +7 -12
- package/src/widgets-v2/timeseries/download.ts +36 -40
- package/src/widgets-v2/timeseries/options.ts +3 -2
- package/dist/echart-BMPpj7n_.js.map +0 -1
- package/dist/option-builders-F-c9ELi1.js.map +0 -1
- package/dist/png-item-BE9uEqlD.js +0 -45
- package/dist/png-item-BE9uEqlD.js.map +0 -1
- package/dist/table-C9IMbTr0.js +0 -385
- package/dist/table-C9IMbTr0.js.map +0 -1
- package/dist/types/chat/feedback/styles.d.ts +0 -211
- package/dist/types/widgets/utils/chart-config/option-builders.d.ts +0 -124
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { M as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import { Box as
|
|
1
|
+
import { M as E, a as O, b as S } from "../markdown-BD1jcknS.js";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { c as s } from "react/compiler-runtime";
|
|
4
|
+
import { Box as c, Skeleton as p } from "@mui/material";
|
|
5
5
|
import "react";
|
|
6
6
|
import "@mui/icons-material";
|
|
7
7
|
import "../lasso-tool-CDFj4zKY.js";
|
|
8
8
|
import "../cjs-D4KH3azB.js";
|
|
9
9
|
import "@carto/ps-utils";
|
|
10
10
|
import "html2canvas";
|
|
11
|
-
import { b as d } from "../png-item-
|
|
11
|
+
import { b as d, D as f, M as u } from "../png-item-9dNbB37T.js";
|
|
12
12
|
const m = {
|
|
13
13
|
root: {
|
|
14
14
|
display: "flex",
|
|
@@ -21,21 +21,21 @@ const m = {
|
|
|
21
21
|
height: 18
|
|
22
22
|
})
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
const e =
|
|
24
|
+
function y(o) {
|
|
25
|
+
const e = s(2), {
|
|
26
26
|
lines: r
|
|
27
27
|
} = o, n = r === void 0 ? 5 : r;
|
|
28
28
|
let t;
|
|
29
29
|
if (e[0] !== n) {
|
|
30
30
|
const l = ["100%", "95%", "90%", "85%", "70%"];
|
|
31
|
-
t = /* @__PURE__ */
|
|
31
|
+
t = /* @__PURE__ */ i(c, { sx: m.root, children: Array.from({
|
|
32
32
|
length: n
|
|
33
|
-
}).map((
|
|
33
|
+
}).map((k, a) => /* @__PURE__ */ i(p, { variant: "rectangular", sx: m.line(l[a % l.length] ?? "85%") }, `line-${a}`)) }), e[0] = n, e[1] = t;
|
|
34
34
|
} else
|
|
35
35
|
t = e[1];
|
|
36
36
|
return t;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function I(o) {
|
|
39
39
|
const e = [];
|
|
40
40
|
return o.getCaptureEl && e.push(d({
|
|
41
41
|
filename: o.filename,
|
|
@@ -43,8 +43,9 @@ function y(o) {
|
|
|
43
43
|
pixelRatio: o.pngPixelRatio,
|
|
44
44
|
backgroundColor: o.pngBackgroundColor
|
|
45
45
|
})), e.push({
|
|
46
|
-
id:
|
|
47
|
-
label: "
|
|
46
|
+
id: f.markdown,
|
|
47
|
+
label: "Markdown",
|
|
48
|
+
icon: /* @__PURE__ */ i(u, { fontSize: "small" }),
|
|
48
49
|
resolve: () => {
|
|
49
50
|
const r = o.getData(), n = new Blob([r.content ?? ""], {
|
|
50
51
|
type: "text/markdown;charset=utf-8;"
|
|
@@ -58,10 +59,10 @@ function y(o) {
|
|
|
58
59
|
}), e;
|
|
59
60
|
}
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
E as Markdown,
|
|
63
|
+
O as MarkdownContent,
|
|
64
|
+
y as MarkdownSkeleton,
|
|
65
|
+
S as MarkdownUI,
|
|
66
|
+
I as createMarkdownDownloadConfig
|
|
66
67
|
};
|
|
67
68
|
//# sourceMappingURL=markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","sources":["../../src/widgets-v2/markdown/skeleton.tsx","../../src/widgets-v2/markdown/download.
|
|
1
|
+
{"version":3,"file":"markdown.js","sources":["../../src/widgets-v2/markdown/skeleton.tsx","../../src/widgets-v2/markdown/download.tsx"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n py: 1,\n },\n line: (width: string): SxProps<Theme> => ({ width, height: 18 }),\n} as const\n\nexport interface MarkdownSkeletonProps {\n lines?: number\n}\n\nexport function MarkdownSkeleton({ lines = 5 }: MarkdownSkeletonProps) {\n // Vary widths to mimic prose.\n const widths = ['100%', '95%', '90%', '85%', '70%']\n return (\n <Box sx={styles.root}>\n {Array.from({ length: lines }).map((_, i) => (\n <Skeleton\n key={`line-${i}`}\n variant='rectangular'\n sx={styles.line(widths[i % widths.length] ?? '85%')}\n />\n ))}\n </Box>\n )\n}\n","import {\n DOWNLOAD_ITEM_IDS,\n MarkdownIcon,\n buildPngDownloadItem,\n toCsvString,\n triggerLinkDownload,\n type DownloadItem,\n} from '../actions/download'\nimport type { MarkdownWidgetData } from './types'\n\n/**\n * Download menu items for the Markdown widget. Always includes a `.md`\n * item that saves the markdown source verbatim. When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createMarkdownDownloadConfig(args: {\n filename: string\n getData: () => MarkdownWidgetData\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: DOWNLOAD_ITEM_IDS.markdown,\n label: 'Markdown',\n icon: <MarkdownIcon fontSize='small' />,\n resolve: () => {\n const data = args.getData()\n const blob = new Blob([data.content ?? ''], {\n type: 'text/markdown;charset=utf-8;',\n })\n const url = URL.createObjectURL(blob)\n return Promise.resolve({\n url,\n filename: `${args.filename}.md`,\n revoke: () => URL.revokeObjectURL(url),\n })\n },\n })\n return items\n}\n\n// Re-export pure helpers consumers may want when building a custom Download item.\nexport { toCsvString, triggerLinkDownload }\n"],"names":["styles","root","display","flexDirection","gap","py","line","width","height","MarkdownSkeleton","t0","$","_c","lines","t1","undefined","t2","widths","Box","Array","from","length","map","_","i","jsx","Skeleton","createMarkdownDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","DOWNLOAD_ITEM_IDS","markdown","label","icon","MarkdownIcon","resolve","data","getData","blob","Blob","content","type","url","URL","createObjectURL","Promise","revoke","revokeObjectURL"],"mappings":";;;;;;;;;;;AAGA,MAAMA,IAAS;AAAA,EACbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA,IACLC,IAAI;AAAA,EAAA;AAAA,EAENC,MAAMA,CAACC,OAAmC;AAAA,IAAEA,OAAAA;AAAAA,IAAOC,QAAQ;AAAA,EAAA;AAC7D;AAMO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAA0B;AAAA,IAAAC,OAAAC;AAAAA,EAAAA,IAAAJ,GAAEG,IAAAC,MAAAC,SAAA,IAAAD;AAAS,MAAAE;AAAA,MAAAL,SAAAE,GAAA;AAE1C,UAAAI,IAAe,CAAC,QAAQ,OAAO,OAAO,OAAO,KAAK;AAEhDD,IAAAA,sBAACE,GAAA,EAAQ,IAAAlB,EAAMC,MACZkB,gBAAKC,KAAM;AAAA,MAAAC,QAAUR;AAAAA,IAAAA,CAAO,EAACS,IAAK,CAAAC,GAAAC,MACjC,gBAAAC,EAACC,GAAA,EAES,SAAA,eACJ,IAAA1B,EAAMM,KAAMW,EAAOO,IAAIP,EAAMI,MAAO,KAAxB,KAAkC,KAF7C,QAAQG,CAAC,EAEqC,CAEtD,EAAA,CACH,GAAMb,OAAAE,GAAAF,OAAAK;AAAAA,EAAA;AAAAA,IAAAA,IAAAL,EAAA,CAAA;AAAA,SARNK;AAQM;ACbH,SAASW,EAA6BC,GAM1B;AACjB,QAAMC,IAAwB,CAAA;AAC9B,SAAID,EAAKE,gBACPD,EAAME,KACJC,EAAqB;AAAA,IACnBC,UAAUL,EAAKK;AAAAA,IACfH,cAAcF,EAAKE;AAAAA,IACnBI,YAAYN,EAAKO;AAAAA,IACjBC,iBAAiBR,EAAKS;AAAAA,EAAAA,CACvB,CACH,GAEFR,EAAME,KAAK;AAAA,IACTO,IAAIC,EAAkBC;AAAAA,IACtBC,OAAO;AAAA,IACPC,MAAM,gBAAAjB,EAACkB,GAAA,EAAa,UAAS,QAAA,CAAO;AAAA,IACpCC,SAASA,MAAM;AACb,YAAMC,IAAOjB,EAAKkB,QAAAA,GACZC,IAAO,IAAIC,KAAK,CAACH,EAAKI,WAAW,EAAE,GAAG;AAAA,QAC1CC,MAAM;AAAA,MAAA,CACP,GACKC,IAAMC,IAAIC,gBAAgBN,CAAI;AACpC,aAAOO,QAAQV,QAAQ;AAAA,QACrBO,KAAAA;AAAAA,QACAlB,UAAU,GAAGL,EAAKK,QAAQ;AAAA,QAC1BsB,QAAQA,MAAMH,IAAII,gBAAgBL,CAAG;AAAA,MAAA,CACtC;AAAA,IACH;AAAA,EAAA,CACD,GACMtB;AACT;"}
|
package/dist/widgets-v2/pie.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { g as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { c as
|
|
5
|
-
import {
|
|
1
|
+
import * as N from "echarts";
|
|
2
|
+
import { g as O, d as D, i as P, c as $, f as T, n as F } from "../option-builders-DPeoyQaM.js";
|
|
3
|
+
import { jsx as x, jsxs as A } from "react/jsx-runtime";
|
|
4
|
+
import { c as z } from "react/compiler-runtime";
|
|
5
|
+
import { Skeleton as I, Box as w } from "@mui/material";
|
|
6
6
|
import "../widget-store-Bw5zRUGg.js";
|
|
7
7
|
import "zustand/shallow";
|
|
8
8
|
import "@mui/icons-material";
|
|
@@ -15,23 +15,23 @@ import "@dnd-kit/core";
|
|
|
15
15
|
import "@dnd-kit/sortable";
|
|
16
16
|
import "@dnd-kit/utilities";
|
|
17
17
|
import "react-dom";
|
|
18
|
-
import { m as
|
|
18
|
+
import { m as E, r as M } from "../resolve-theme-color-BdojIw0K.js";
|
|
19
19
|
import "../widget-context-DTGO0Yta.js";
|
|
20
20
|
import "zustand";
|
|
21
21
|
import "zustand/vanilla";
|
|
22
22
|
import "zustand/middleware";
|
|
23
23
|
import "zustand/react/shallow";
|
|
24
|
-
import {
|
|
25
|
-
import { b as
|
|
26
|
-
const
|
|
27
|
-
function
|
|
24
|
+
import { b as V } from "../png-item-9dNbB37T.js";
|
|
25
|
+
import { b as B } from "../csv-item-hH_Gt7ur.js";
|
|
26
|
+
const R = ["58%", "74%"];
|
|
27
|
+
function H({
|
|
28
28
|
theme: e,
|
|
29
29
|
formatter: r,
|
|
30
30
|
labelFormatter: t
|
|
31
31
|
}) {
|
|
32
32
|
return {
|
|
33
33
|
legend: {
|
|
34
|
-
...
|
|
34
|
+
...D({
|
|
35
35
|
hasLegend: !0,
|
|
36
36
|
labelFormatter: t
|
|
37
37
|
}),
|
|
@@ -60,8 +60,8 @@ function _({
|
|
|
60
60
|
fontSize: 11,
|
|
61
61
|
fontFamily: e.typography.caption.fontFamily
|
|
62
62
|
},
|
|
63
|
-
position:
|
|
64
|
-
formatter:
|
|
63
|
+
position: O(e),
|
|
64
|
+
formatter: _(r, t)
|
|
65
65
|
},
|
|
66
66
|
// V1 used `qualitative.bold` only (no `secondary.main` prefix) because
|
|
67
67
|
// pie slices are categorical — each slice deserves a distinct palette
|
|
@@ -101,59 +101,59 @@ function _({
|
|
|
101
101
|
}]
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function ve(e) {
|
|
105
105
|
const {
|
|
106
106
|
theme: r,
|
|
107
107
|
formatter: t,
|
|
108
|
-
labelFormatter:
|
|
108
|
+
labelFormatter: a,
|
|
109
109
|
optionsOverride: o,
|
|
110
|
-
series:
|
|
111
|
-
} = e, c = e.radius ??
|
|
112
|
-
return (
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
110
|
+
series: n
|
|
111
|
+
} = e, c = e.radius ?? R, u = e.selection, g = u && u.length > 0 ? new Set(u) : null;
|
|
112
|
+
return (d, f, b) => {
|
|
113
|
+
if (d == null) {
|
|
114
|
+
const h = H({
|
|
115
115
|
theme: r,
|
|
116
116
|
formatter: t,
|
|
117
|
-
labelFormatter:
|
|
117
|
+
labelFormatter: a
|
|
118
118
|
});
|
|
119
|
-
return o ?
|
|
119
|
+
return o ? E(h, o) : h;
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
return
|
|
123
|
-
...
|
|
121
|
+
const p = Array.isArray(f) ? f : [];
|
|
122
|
+
return p.length === 0 ? {
|
|
123
|
+
...d,
|
|
124
124
|
dataset: [],
|
|
125
125
|
series: []
|
|
126
|
-
} :
|
|
126
|
+
} : p.length > 1 ? G(d, p, r, n, b, g) : W(d, p, c, n, b, g);
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
function W(e, r, t,
|
|
130
|
-
const c = Array.isArray(e.series) ? e.series : [],
|
|
131
|
-
const l =
|
|
132
|
-
if (!
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
},
|
|
129
|
+
function W(e, r, t, a, o, n) {
|
|
130
|
+
const c = Array.isArray(e.series) ? e.series : [], u = c[0] ?? {}, g = typeof e.tooltip == "object" && !Array.isArray(e.tooltip) ? e.tooltip : {}, d = typeof e.legend == "object" && !Array.isArray(e.legend) ? e.legend : {}, f = o?.formatter, b = o?.labelFormatter, p = Array.isArray(e.color) ? e.color : [], h = (i) => (p.length > 0 ? p[i.dataIndex % p.length] : void 0) ?? i.color, C = (i) => {
|
|
131
|
+
const l = h(i);
|
|
132
|
+
if (!n) return l;
|
|
133
|
+
const m = i.value?.name ?? i.name;
|
|
134
|
+
return m != null && n.has(m) ? l : N.color.modifyAlpha(l, 0.15);
|
|
135
|
+
}, s = (i) => {
|
|
136
136
|
const {
|
|
137
137
|
name: l
|
|
138
|
-
} =
|
|
138
|
+
} = i, y = i.encode?.value?.[0];
|
|
139
139
|
if (y === void 0) return "";
|
|
140
|
-
const
|
|
141
|
-
return `{c|${
|
|
140
|
+
const m = Object.values(i.data ?? {}).at(y), S = typeof m == "number" ? f ? f(m) : String(m) : typeof m == "string" ? m : "", j = String(b ? b(l ?? "") : l ?? "");
|
|
141
|
+
return `{c|${S}}
|
|
142
142
|
|
|
143
|
-
{b|${
|
|
143
|
+
{b|${j}}`;
|
|
144
144
|
};
|
|
145
145
|
return {
|
|
146
146
|
...e,
|
|
147
|
-
dataset: r.map((
|
|
148
|
-
source:
|
|
147
|
+
dataset: r.map((i) => ({
|
|
148
|
+
source: i
|
|
149
149
|
})),
|
|
150
|
-
series: r.map((
|
|
151
|
-
const y = c[l] ??
|
|
150
|
+
series: r.map((i, l) => {
|
|
151
|
+
const y = c[l] ?? u, m = typeof y == "object" ? y : {}, S = m.label ?? {}, j = m.itemStyle ?? {};
|
|
152
152
|
return {
|
|
153
|
-
...
|
|
153
|
+
...m,
|
|
154
154
|
type: "pie",
|
|
155
155
|
datasetIndex: l,
|
|
156
|
-
name:
|
|
156
|
+
name: a?.[l]?.name ?? `Series ${l + 1}`,
|
|
157
157
|
radius: [...t],
|
|
158
158
|
// Lift the donut up so the bottom-anchored legend has the
|
|
159
159
|
// vertical real estate to wrap to multiple rows for long
|
|
@@ -166,64 +166,64 @@ function W(e, r, t, n, o, s) {
|
|
|
166
166
|
value: "value"
|
|
167
167
|
},
|
|
168
168
|
label: {
|
|
169
|
-
...
|
|
170
|
-
formatter:
|
|
169
|
+
...S,
|
|
170
|
+
formatter: s
|
|
171
171
|
},
|
|
172
172
|
itemStyle: {
|
|
173
|
-
...
|
|
174
|
-
color:
|
|
173
|
+
...j,
|
|
174
|
+
color: C
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
}),
|
|
178
178
|
// Legend always shows for pie (mirrors v1) — slice names drive the
|
|
179
179
|
// entries, so even a single donut benefits from a category list.
|
|
180
180
|
legend: {
|
|
181
|
-
...
|
|
181
|
+
...d,
|
|
182
182
|
show: !0
|
|
183
183
|
},
|
|
184
184
|
tooltip: {
|
|
185
|
-
...
|
|
186
|
-
formatter:
|
|
185
|
+
...g,
|
|
186
|
+
formatter: _(f, b)
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
const c = typeof e.tooltip == "object" && !Array.isArray(e.tooltip) ? e.tooltip : {},
|
|
190
|
+
function G(e, r, t, a, o, n) {
|
|
191
|
+
const c = typeof e.tooltip == "object" && !Array.isArray(e.tooltip) ? e.tooltip : {}, u = typeof e.legend == "object" && !Array.isArray(e.legend) ? e.legend : {}, g = typeof e.grid == "object" && !Array.isArray(e.grid) ? e.grid : {}, d = o?.formatter, f = o?.labelFormatter, {
|
|
192
192
|
niceMinVal: b,
|
|
193
|
-
niceMaxVal:
|
|
194
|
-
} =
|
|
195
|
-
const
|
|
196
|
-
if (!
|
|
197
|
-
const
|
|
198
|
-
return
|
|
193
|
+
niceMaxVal: p
|
|
194
|
+
} = Z(r), h = Array.isArray(e.color) ? e.color : [], C = (s) => {
|
|
195
|
+
const i = s.seriesIndex ?? 0, y = (h.length > 0 ? h[i % h.length] : void 0) ?? s.color;
|
|
196
|
+
if (!n) return y;
|
|
197
|
+
const S = s.value?.name ?? s.name;
|
|
198
|
+
return S != null && n.has(S) ? y : N.color.modifyAlpha(y, 0.15);
|
|
199
199
|
};
|
|
200
200
|
return {
|
|
201
201
|
...e,
|
|
202
|
-
dataset: r.map((
|
|
203
|
-
source:
|
|
202
|
+
dataset: r.map((s) => ({
|
|
203
|
+
source: s
|
|
204
204
|
})),
|
|
205
205
|
grid: {
|
|
206
|
-
...
|
|
207
|
-
|
|
206
|
+
...g,
|
|
207
|
+
...$(!0, t),
|
|
208
208
|
right: parseInt(t.spacing(4)),
|
|
209
209
|
containLabel: !0
|
|
210
210
|
},
|
|
211
211
|
// Drop pie-specific structural keys that shouldn't render in the
|
|
212
212
|
// bar fallback. ECharts ignores undefined keys, so this is a clean
|
|
213
213
|
// override.
|
|
214
|
-
series: r.map((
|
|
215
|
-
const l =
|
|
214
|
+
series: r.map((s, i) => {
|
|
215
|
+
const l = M(t, a?.[i]?.color);
|
|
216
216
|
return {
|
|
217
|
-
datasetIndex:
|
|
217
|
+
datasetIndex: i,
|
|
218
218
|
type: "bar",
|
|
219
|
-
name:
|
|
219
|
+
name: a?.[i]?.name ?? `Series ${i + 1}`,
|
|
220
220
|
barMaxWidth: 100,
|
|
221
221
|
emphasis: {
|
|
222
222
|
focus: "series"
|
|
223
223
|
},
|
|
224
|
-
...
|
|
224
|
+
...P(d, "x"),
|
|
225
225
|
itemStyle: {
|
|
226
|
-
color:
|
|
226
|
+
color: C
|
|
227
227
|
},
|
|
228
228
|
...l ? {
|
|
229
229
|
color: l
|
|
@@ -235,7 +235,7 @@ function E(e, r, t, n, o, s) {
|
|
|
235
235
|
// Closures over the pre-computed nice bounds — ECharts calls them
|
|
236
236
|
// once per render to resolve the axis extents.
|
|
237
237
|
min: () => b,
|
|
238
|
-
max: () =>
|
|
238
|
+
max: () => p,
|
|
239
239
|
axisLine: {
|
|
240
240
|
show: !1
|
|
241
241
|
},
|
|
@@ -262,7 +262,7 @@ function E(e, r, t, n, o, s) {
|
|
|
262
262
|
margin: parseInt(t.spacing(1)),
|
|
263
263
|
showMaxLabel: !0,
|
|
264
264
|
showMinLabel: !0,
|
|
265
|
-
formatter: (
|
|
265
|
+
formatter: (s) => s !== p && s !== b || s === 0 ? "" : d ? d(s) : String(s)
|
|
266
266
|
}
|
|
267
267
|
},
|
|
268
268
|
yAxis: {
|
|
@@ -275,111 +275,159 @@ function E(e, r, t, n, o, s) {
|
|
|
275
275
|
},
|
|
276
276
|
axisLabel: {
|
|
277
277
|
padding: [parseInt(t.spacing(0.5)), 0, 0, 0],
|
|
278
|
-
...
|
|
279
|
-
formatter: (
|
|
278
|
+
...f && {
|
|
279
|
+
formatter: (s) => String(f(s))
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
legend: {
|
|
284
|
-
...
|
|
284
|
+
...u,
|
|
285
285
|
show: !0
|
|
286
286
|
},
|
|
287
287
|
tooltip: {
|
|
288
288
|
...c,
|
|
289
289
|
trigger: "axis",
|
|
290
|
-
formatter:
|
|
290
|
+
formatter: U(d, f)
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
296
|
-
const
|
|
294
|
+
function U(e, r) {
|
|
295
|
+
return T((t) => {
|
|
296
|
+
const a = t.encode?.x?.at(0), o = a !== void 0 ? t.dimensionNames?.[a] : void 0, n = t.value && typeof t.value == "object" && !Array.isArray(t.value) ? t.value : void 0, c = o && n ? n[o] : void 0, u = typeof c == "number" && e ? e(c) : c ?? "", g = typeof t.marker == "string" ? t.marker : "", d = t.seriesName ? `${t.seriesName}: ` : "";
|
|
297
297
|
return {
|
|
298
298
|
name: String(r ? r(t.name ?? "") : t.name ?? ""),
|
|
299
|
-
seriesName:
|
|
300
|
-
marker:
|
|
301
|
-
value:
|
|
299
|
+
seriesName: d,
|
|
300
|
+
marker: g,
|
|
301
|
+
value: u
|
|
302
302
|
};
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Z(e) {
|
|
306
306
|
let r = 0, t = -1 / 0;
|
|
307
|
-
for (const
|
|
308
|
-
for (const o of
|
|
307
|
+
for (const a of e)
|
|
308
|
+
for (const o of a)
|
|
309
309
|
typeof o?.value != "number" || !Number.isFinite(o.value) || (o.value < r && (r = o.value), o.value > t && (t = o.value));
|
|
310
310
|
return {
|
|
311
|
-
niceMinVal: r < 0 ?
|
|
312
|
-
niceMaxVal: t <= 0 ? 1 :
|
|
311
|
+
niceMinVal: r < 0 ? F(r) : 0,
|
|
312
|
+
niceMaxVal: t <= 0 ? 1 : F(t)
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
return
|
|
317
|
-
const
|
|
315
|
+
function _(e, r) {
|
|
316
|
+
return T((t) => {
|
|
317
|
+
const a = t.encode?.value?.at(0) ?? 1, n = (t.value && typeof t.value == "object" && !Array.isArray(t.value) ? Object.values(t.value) : [])[a], c = typeof n == "number" && e ? e(n) : n ?? "", u = typeof t.marker == "string" ? t.marker : "", g = t.seriesName ? `${t.seriesName}: ` : "";
|
|
318
318
|
return {
|
|
319
319
|
name: String(r ? r(t.name ?? "") : t.name ?? ""),
|
|
320
|
-
seriesName:
|
|
321
|
-
marker:
|
|
320
|
+
seriesName: g,
|
|
321
|
+
marker: u,
|
|
322
322
|
value: c
|
|
323
323
|
};
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
|
-
const
|
|
326
|
+
const L = 160, k = 96, v = {
|
|
327
327
|
root: {
|
|
328
328
|
display: "flex",
|
|
329
|
+
flexDirection: "column",
|
|
329
330
|
alignItems: "center",
|
|
330
331
|
justifyContent: "center",
|
|
331
332
|
minHeight: 200,
|
|
332
333
|
py: 1,
|
|
333
|
-
gap:
|
|
334
|
+
gap: ({
|
|
335
|
+
spacing: e
|
|
336
|
+
}) => e(2)
|
|
334
337
|
},
|
|
335
338
|
donut: {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
+
position: "relative",
|
|
340
|
+
display: "flex",
|
|
341
|
+
alignItems: "center",
|
|
342
|
+
justifyContent: "center"
|
|
343
|
+
},
|
|
344
|
+
ring: {
|
|
345
|
+
width: L,
|
|
346
|
+
height: L
|
|
347
|
+
},
|
|
348
|
+
hole: {
|
|
349
|
+
position: "absolute",
|
|
350
|
+
zIndex: 1,
|
|
351
|
+
width: k,
|
|
352
|
+
height: k,
|
|
353
|
+
borderRadius: "50%",
|
|
354
|
+
bgcolor: "background.paper"
|
|
355
|
+
},
|
|
356
|
+
label: {
|
|
357
|
+
position: "absolute",
|
|
358
|
+
zIndex: 2,
|
|
359
|
+
display: "flex",
|
|
360
|
+
flexDirection: "column",
|
|
361
|
+
alignItems: "center",
|
|
362
|
+
justifyContent: "center",
|
|
363
|
+
gap: ({
|
|
364
|
+
spacing: e
|
|
365
|
+
}) => e(0.5)
|
|
366
|
+
},
|
|
367
|
+
legend: {
|
|
368
|
+
display: "flex",
|
|
369
|
+
alignItems: "center",
|
|
370
|
+
gap: ({
|
|
371
|
+
spacing: e
|
|
372
|
+
}) => e(2)
|
|
373
|
+
},
|
|
374
|
+
legendItem: {
|
|
375
|
+
display: "flex",
|
|
376
|
+
alignItems: "center",
|
|
377
|
+
gap: ({
|
|
378
|
+
spacing: e
|
|
379
|
+
}) => e(1.5)
|
|
339
380
|
}
|
|
340
381
|
};
|
|
341
|
-
function
|
|
342
|
-
const r =
|
|
343
|
-
|
|
344
|
-
|
|
382
|
+
function xe(e) {
|
|
383
|
+
const r = z(4);
|
|
384
|
+
let t, a;
|
|
385
|
+
r[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ x(I, { variant: "circular", sx: v.ring }), a = /* @__PURE__ */ x(w, { sx: v.hole }), r[0] = t, r[1] = a) : (t = r[0], a = r[1]);
|
|
345
386
|
let o;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
387
|
+
r[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ A(w, { sx: v.donut, children: [
|
|
388
|
+
t,
|
|
389
|
+
a,
|
|
390
|
+
/* @__PURE__ */ A(w, { sx: v.label, children: [
|
|
391
|
+
/* @__PURE__ */ x(I, { width: 56, height: 18 }),
|
|
392
|
+
/* @__PURE__ */ x(I, { width: 36, height: 8 })
|
|
393
|
+
] })
|
|
394
|
+
] }), r[2] = o) : o = r[2];
|
|
395
|
+
let n;
|
|
396
|
+
return r[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ A(w, { sx: v.root, children: [
|
|
397
|
+
o,
|
|
398
|
+
/* @__PURE__ */ x(w, { sx: v.legend, children: [0, 1].map(q) })
|
|
399
|
+
] }), r[3] = n) : n = r[3], n;
|
|
349
400
|
}
|
|
350
|
-
function
|
|
351
|
-
return /* @__PURE__ */
|
|
401
|
+
function q(e) {
|
|
402
|
+
return /* @__PURE__ */ A(w, { sx: v.legendItem, children: [
|
|
403
|
+
/* @__PURE__ */ x(I, { variant: "circular", width: 8, height: 8 }),
|
|
404
|
+
/* @__PURE__ */ x(I, { width: 48, height: 8 })
|
|
405
|
+
] }, `legend-${e}`);
|
|
352
406
|
}
|
|
353
|
-
function
|
|
407
|
+
function Se(e) {
|
|
354
408
|
const r = [];
|
|
355
|
-
return e.getCaptureEl && r.push(
|
|
409
|
+
return e.getCaptureEl && r.push(V({
|
|
356
410
|
filename: e.filename,
|
|
357
411
|
getCaptureEl: e.getCaptureEl,
|
|
358
412
|
pixelRatio: e.pngPixelRatio,
|
|
359
413
|
backgroundColor: e.pngBackgroundColor
|
|
360
|
-
})), r.push({
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
n.push([d, m.name, m.value]);
|
|
414
|
+
})), r.push(B({
|
|
415
|
+
filename: e.filename,
|
|
416
|
+
getRows: () => {
|
|
417
|
+
const t = e.getData(), a = [["series", "name", "value"]];
|
|
418
|
+
for (const [o, n] of t.entries()) {
|
|
419
|
+
const c = e.seriesNames?.[o] ?? `series_${o + 1}`;
|
|
420
|
+
for (const u of n)
|
|
421
|
+
a.push([c, u.name, u.value]);
|
|
369
422
|
}
|
|
370
|
-
|
|
371
|
-
return Promise.resolve({
|
|
372
|
-
url: o.url,
|
|
373
|
-
filename: `${e.filename}.csv`,
|
|
374
|
-
revoke: o.revoke
|
|
375
|
-
});
|
|
423
|
+
return a;
|
|
376
424
|
}
|
|
377
|
-
}), r;
|
|
425
|
+
})), r;
|
|
378
426
|
}
|
|
379
427
|
export {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
428
|
+
xe as PieSkeleton,
|
|
429
|
+
Se as createPieDownloadConfig,
|
|
430
|
+
ve as createPieOptionFactory,
|
|
431
|
+
H as pieOptions
|
|
384
432
|
};
|
|
385
433
|
//# sourceMappingURL=pie.js.map
|