@carto/ps-react-ui 4.11.2 → 4.12.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/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/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-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/wrapper/style.d.ts +5 -12
- package/dist/widgets-v2/actions.js +40 -36
- package/dist/widgets-v2/actions.js.map +1 -1
- package/dist/widgets-v2/bar.js +77 -84
- 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/formula.js +37 -43
- package/dist/widgets-v2/formula.js.map +1 -1
- package/dist/widgets-v2/histogram.js +138 -144
- 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 +67 -73
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +75 -81
- 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 +81 -87
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2.js +247 -243
- package/dist/widgets-v2.js.map +1 -1
- package/package.json +3 -3
- 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-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/category/download.test.ts +9 -0
- package/src/widgets-v2/category/download.ts +16 -20
- package/src/widgets-v2/formula/download.tsx +23 -29
- package/src/widgets-v2/histogram/download.ts +22 -26
- package/src/widgets-v2/markdown/{download.ts → download.tsx} +5 -2
- package/src/widgets-v2/pie/download.ts +16 -20
- package/src/widgets-v2/scatterplot/download.ts +16 -20
- 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/wrapper/style.ts +13 -18
- package/src/widgets-v2/wrapper/widget-wrapper.test.tsx +66 -0
- package/src/widgets-v2/wrapper/widget-wrapper.tsx +7 -4
- 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
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { N, P as
|
|
1
|
+
import { D as P, F as E, a as R } from "../formula-DuC0NQLH.js";
|
|
2
|
+
import { N, P as V, S as _, a as $, V as j } from "../style-DVnT6HC1.js";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
|
-
import { c as
|
|
5
|
-
import { Box as m, Skeleton as
|
|
4
|
+
import { c as l } from "react/compiler-runtime";
|
|
5
|
+
import { Box as m, Skeleton as s } from "@mui/material";
|
|
6
6
|
import "react";
|
|
7
7
|
import "@mui/icons-material";
|
|
8
8
|
import "../lasso-tool-CDFj4zKY.js";
|
|
9
9
|
import "../cjs-D4KH3azB.js";
|
|
10
10
|
import "@carto/ps-utils";
|
|
11
|
-
import
|
|
12
|
-
import { b as
|
|
13
|
-
|
|
11
|
+
import "html2canvas";
|
|
12
|
+
import { b as u } from "../png-item-9dNbB37T.js";
|
|
13
|
+
import { b as f } from "../csv-item-hH_Gt7ur.js";
|
|
14
|
+
const n = {
|
|
14
15
|
root: {
|
|
15
16
|
display: "flex",
|
|
16
17
|
gap: 3,
|
|
@@ -23,52 +24,45 @@ const l = {
|
|
|
23
24
|
height: 36
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
|
-
function F(
|
|
27
|
-
const e =
|
|
28
|
-
count:
|
|
29
|
-
} =
|
|
30
|
-
let
|
|
31
|
-
return e[0] !== r ? (
|
|
27
|
+
function F(t) {
|
|
28
|
+
const e = l(2), {
|
|
29
|
+
count: a
|
|
30
|
+
} = t, r = a === void 0 ? 1 : a;
|
|
31
|
+
let o;
|
|
32
|
+
return e[0] !== r ? (o = /* @__PURE__ */ i(m, { sx: n.root, children: Array.from({
|
|
32
33
|
length: r
|
|
33
|
-
}).map(
|
|
34
|
+
}).map(p) }), e[0] = r, e[1] = o) : o = e[1], o;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
return /* @__PURE__ */ i(
|
|
36
|
+
function p(t, e) {
|
|
37
|
+
return /* @__PURE__ */ i(s, { variant: "rectangular", sx: n.block }, `row-${e}`);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function S(t) {
|
|
39
40
|
const e = [];
|
|
40
|
-
return
|
|
41
|
-
filename:
|
|
42
|
-
getCaptureEl:
|
|
43
|
-
pixelRatio:
|
|
44
|
-
backgroundColor:
|
|
45
|
-
})), e.push({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
r.push([a.series?.name ?? "", a.prefix ?? "", a.value, a.suffix ?? "", a.note ?? "", a.delta?.value ?? ""]);
|
|
53
|
-
const t = f(r);
|
|
54
|
-
return Promise.resolve({
|
|
55
|
-
url: t.url,
|
|
56
|
-
filename: `${o.filename}.csv`,
|
|
57
|
-
revoke: t.revoke
|
|
58
|
-
});
|
|
41
|
+
return t.getCaptureEl && e.push(u({
|
|
42
|
+
filename: t.filename,
|
|
43
|
+
getCaptureEl: t.getCaptureEl,
|
|
44
|
+
pixelRatio: t.pngPixelRatio,
|
|
45
|
+
backgroundColor: t.pngBackgroundColor
|
|
46
|
+
})), e.push(f({
|
|
47
|
+
filename: t.filename,
|
|
48
|
+
getRows: () => {
|
|
49
|
+
const a = t.getData(), r = [["series", "prefix", "value", "suffix", "note", "delta"]];
|
|
50
|
+
for (const o of a)
|
|
51
|
+
r.push([o.series?.name ?? "", o.prefix ?? "", o.value, o.suffix ?? "", o.note ?? "", o.delta?.value ?? ""]);
|
|
52
|
+
return r;
|
|
59
53
|
}
|
|
60
|
-
}), e;
|
|
54
|
+
})), e;
|
|
61
55
|
}
|
|
62
56
|
export {
|
|
63
|
-
|
|
57
|
+
P as Delta,
|
|
64
58
|
E as Formula,
|
|
65
59
|
F as FormulaSkeleton,
|
|
66
|
-
|
|
60
|
+
R as FormulaUI,
|
|
67
61
|
N as Note,
|
|
68
|
-
|
|
62
|
+
V as Prefix,
|
|
69
63
|
_ as Series,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
$ as Suffix,
|
|
65
|
+
j as Value,
|
|
66
|
+
S as createFormulaDownloadConfig
|
|
73
67
|
};
|
|
74
68
|
//# sourceMappingURL=formula.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula.js","sources":["../../src/widgets-v2/formula/skeleton.tsx","../../src/widgets-v2/formula/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 gap: 3,\n alignItems: 'baseline',\n minHeight: 64,\n py: 1,\n },\n block: { width: 120, height: 36 },\n} satisfies Record<string, SxProps<Theme>>\n\nexport interface FormulaSkeletonProps {\n count?: number\n}\n\nexport function FormulaSkeleton({ count = 1 }: FormulaSkeletonProps) {\n return (\n <Box sx={styles.root}>\n {Array.from({ length: count }).map((_, i) => (\n <Skeleton key={`row-${i}`} variant='rectangular' sx={styles.block} />\n ))}\n </Box>\n )\n}\n","import {\n
|
|
1
|
+
{"version":3,"file":"formula.js","sources":["../../src/widgets-v2/formula/skeleton.tsx","../../src/widgets-v2/formula/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 gap: 3,\n alignItems: 'baseline',\n minHeight: 64,\n py: 1,\n },\n block: { width: 120, height: 36 },\n} satisfies Record<string, SxProps<Theme>>\n\nexport interface FormulaSkeletonProps {\n count?: number\n}\n\nexport function FormulaSkeleton({ count = 1 }: FormulaSkeletonProps) {\n return (\n <Box sx={styles.root}>\n {Array.from({ length: count }).map((_, i) => (\n <Skeleton key={`row-${i}`} variant='rectangular' sx={styles.block} />\n ))}\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadItem,\n} from '../actions/download'\nimport type { FormulaWidgetData } from './types'\n\nexport interface FormulaDownloadConfigArgs {\n filename: string\n getData: () => FormulaWidgetData\n /**\n * Optional getter for the widget's capture element (registered by\n * `Widget.State`). When provided, a PNG item is prepended.\n */\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}\n\n/**\n * Builds download items for the Formula widget. Always includes a CSV item\n * with one row per KPI (`prefix`, `value`, `suffix`, `note`, `delta`).\n * When `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createFormulaDownloadConfig(\n args: FormulaDownloadConfigArgs,\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 buildCsvDownloadItem({\n filename: args.filename,\n getRows: () => {\n const data = args.getData()\n const rows: unknown[][] = [\n ['series', 'prefix', 'value', 'suffix', 'note', 'delta'],\n ]\n for (const d of data) {\n rows.push([\n d.series?.name ?? '',\n d.prefix ?? '',\n d.value,\n d.suffix ?? '',\n d.note ?? '',\n d.delta?.value ?? '',\n ])\n }\n return rows\n },\n }),\n )\n return items\n}\n"],"names":["styles","root","display","gap","alignItems","minHeight","py","block","width","height","FormulaSkeleton","t0","$","_c","count","t1","undefined","t2","Box","Array","from","length","map","_temp","_","i","jsx","Skeleton","createFormulaDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","buildCsvDownloadItem","getRows","data","getData","rows","d","series","name","prefix","value","suffix","note","delta"],"mappings":";;;;;;;;;;;;;AAGA,MAAMA,IAAS;AAAA,EACbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,KAAK;AAAA,IACLC,YAAY;AAAA,IACZC,WAAW;AAAA,IACXC,IAAI;AAAA,EAAA;AAAA,EAENC,OAAO;AAAA,IAAEC,OAAO;AAAA,IAAKC,QAAQ;AAAA,EAAA;AAC/B;AAMO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAyB;AAAA,IAAAC,OAAAC;AAAAA,EAAAA,IAAAJ,GAAEG,IAAAC,MAAAC,SAAA,IAAAD;AAAS,MAAAE;AAAA,SAAAL,SAAAE,KAEvCG,sBAACC,GAAA,EAAQ,IAAAlB,EAAMC,MACZkB,gBAAKC,KAAM;AAAA,IAAAC,QAAUP;AAAAA,EAAAA,CAAO,EAACQ,IAAKC,CAElC,GACH,GAAMX,OAAAE,GAAAF,OAAAK,KAAAA,IAAAL,EAAA,CAAA,GAJNK;AAIM;AANH,SAAAM,EAAAC,GAAAC,GAAA;AAAA,SAIC,gBAAAC,EAACC,KAAkC,SAAA,eAAkB,IAAA3B,EAAMO,MAAAA,GAA5C,OAAOkB,CAAC,EAA0C;AAAI;ACGtE,SAASG,EACdC,GACgB;AAChB,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,KACJO,EAAqB;AAAA,IACnBL,UAAUL,EAAKK;AAAAA,IACfM,SAASA,MAAM;AACb,YAAMC,IAAOZ,EAAKa,QAAAA,GACZC,IAAoB,CACxB,CAAC,UAAU,UAAU,SAAS,UAAU,QAAQ,OAAO,CAAC;AAE1D,iBAAWC,KAAKH;AACdE,QAAAA,EAAKX,KAAK,CACRY,EAAEC,QAAQC,QAAQ,IAClBF,EAAEG,UAAU,IACZH,EAAEI,OACFJ,EAAEK,UAAU,IACZL,EAAEM,QAAQ,IACVN,EAAEO,OAAOH,SAAS,EAAE,CACrB;AAEH,aAAOL;AAAAA,IACT;AAAA,EAAA,CACD,CACH,GACOb;AACT;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { n as S, d as
|
|
3
|
-
import { jsx as b, jsxs as
|
|
4
|
-
import { c as
|
|
1
|
+
import * as R from "echarts";
|
|
2
|
+
import { n as S, d as z, g as E, c as W, f as Y } from "../option-builders-F-c9ELi1.js";
|
|
3
|
+
import { jsx as b, jsxs as j } from "react/jsx-runtime";
|
|
4
|
+
import { c as q } from "react/compiler-runtime";
|
|
5
5
|
import { Skeleton as T, Box as A } from "@mui/material";
|
|
6
6
|
import "../widget-store-Bw5zRUGg.js";
|
|
7
7
|
import "zustand/shallow";
|
|
@@ -21,55 +21,55 @@ import "zustand/vanilla";
|
|
|
21
21
|
import "zustand/middleware";
|
|
22
22
|
import "zustand/react/shallow";
|
|
23
23
|
import { Z as O } from "../transforms-Cdx4fkU5.js";
|
|
24
|
-
import { m as
|
|
24
|
+
import { m as U, r as V } from "../resolve-theme-color-BdojIw0K.js";
|
|
25
25
|
import { p as J } from "../data-zoom-layout-CkVnm6ej.js";
|
|
26
|
-
import {
|
|
27
|
-
import { b as Q } from "../
|
|
26
|
+
import { b as K } from "../png-item-9dNbB37T.js";
|
|
27
|
+
import { b as Q } from "../csv-item-hH_Gt7ur.js";
|
|
28
28
|
function X({
|
|
29
|
-
theme:
|
|
30
|
-
formatter:
|
|
29
|
+
theme: t,
|
|
30
|
+
formatter: e
|
|
31
31
|
}) {
|
|
32
32
|
let s = 0, i = 1;
|
|
33
33
|
return {
|
|
34
34
|
grid: {
|
|
35
|
-
left: parseInt(
|
|
36
|
-
top: parseInt(
|
|
37
|
-
right: parseInt(
|
|
35
|
+
left: parseInt(t.spacing(1)),
|
|
36
|
+
top: parseInt(t.spacing(3)),
|
|
37
|
+
right: parseInt(t.spacing(1)),
|
|
38
38
|
// Default: no legend. Merger bumps this when there are >1 series.
|
|
39
|
-
...
|
|
39
|
+
...W(!1, t),
|
|
40
40
|
containLabel: !0
|
|
41
41
|
},
|
|
42
42
|
tooltip: {
|
|
43
43
|
trigger: "axis",
|
|
44
|
-
backgroundColor:
|
|
44
|
+
backgroundColor: t.palette.grey[900],
|
|
45
45
|
borderWidth: 0,
|
|
46
|
-
padding: [parseInt(
|
|
46
|
+
padding: [parseInt(t.spacing(1)), parseInt(t.spacing(1))],
|
|
47
47
|
textStyle: {
|
|
48
|
-
color:
|
|
48
|
+
color: t.palette.common.white,
|
|
49
49
|
fontSize: 11,
|
|
50
|
-
fontFamily:
|
|
50
|
+
fontFamily: t.typography.caption.fontFamily
|
|
51
51
|
},
|
|
52
52
|
axisPointer: {
|
|
53
53
|
type: "line"
|
|
54
54
|
},
|
|
55
|
-
position:
|
|
56
|
-
formatter:
|
|
55
|
+
position: E(t),
|
|
56
|
+
formatter: D(e)
|
|
57
57
|
},
|
|
58
58
|
// Legend styling baked here; `show` is toggled by the merger based on
|
|
59
59
|
// series count. Histogram doesn't accept `labelFormatter` at the
|
|
60
60
|
// options layer (bin labels are pre-formatted in the merger), so we
|
|
61
61
|
// skip the legend `labelFormatter` argument too.
|
|
62
62
|
legend: {
|
|
63
|
-
...
|
|
63
|
+
...z({
|
|
64
64
|
hasLegend: !1
|
|
65
65
|
})
|
|
66
66
|
},
|
|
67
67
|
axisPointer: {
|
|
68
68
|
lineStyle: {
|
|
69
|
-
color:
|
|
69
|
+
color: t.palette.grey[400]
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
color: [
|
|
72
|
+
color: [t.palette.secondary.main, ...Object.values(t.palette.qualitative?.bold ?? {})],
|
|
73
73
|
xAxis: {
|
|
74
74
|
type: "category",
|
|
75
75
|
axisLine: {
|
|
@@ -79,15 +79,15 @@ function X({
|
|
|
79
79
|
show: !1
|
|
80
80
|
},
|
|
81
81
|
axisLabel: {
|
|
82
|
-
padding: [parseInt(
|
|
82
|
+
padding: [parseInt(t.spacing(0.5)), 0, 0, 0],
|
|
83
83
|
margin: 0,
|
|
84
84
|
hideOverlap: !0
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
yAxis: {
|
|
88
88
|
type: "value",
|
|
89
|
-
min: (
|
|
90
|
-
max: (
|
|
89
|
+
min: (r) => (s = r.min < 0 ? S(r.min) : 0, s),
|
|
90
|
+
max: (r) => (i = r.max <= 0 ? 1 : S(r.max), i),
|
|
91
91
|
axisLine: {
|
|
92
92
|
show: !1
|
|
93
93
|
},
|
|
@@ -97,71 +97,71 @@ function X({
|
|
|
97
97
|
splitLine: {
|
|
98
98
|
show: !0,
|
|
99
99
|
lineStyle: {
|
|
100
|
-
color:
|
|
100
|
+
color: t.palette.black?.[4] ?? t.palette.divider
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
axisLabel: {
|
|
104
|
-
fontSize:
|
|
105
|
-
fontFamily:
|
|
106
|
-
margin: parseInt(
|
|
104
|
+
fontSize: t.typography.overlineDelicate?.fontSize,
|
|
105
|
+
fontFamily: t.typography.overlineDelicate?.fontFamily,
|
|
106
|
+
margin: parseInt(t.spacing(1)),
|
|
107
107
|
show: !0,
|
|
108
108
|
showMaxLabel: !0,
|
|
109
109
|
showMinLabel: !0,
|
|
110
110
|
verticalAlign: "bottom",
|
|
111
111
|
inside: !0,
|
|
112
|
-
formatter: (
|
|
112
|
+
formatter: (r) => r !== i && r !== s || r === 0 ? "" : e ? e(r) : String(r)
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Mt(t) {
|
|
118
118
|
const {
|
|
119
|
-
theme:
|
|
119
|
+
theme: e,
|
|
120
120
|
formatter: s,
|
|
121
121
|
ticks: i,
|
|
122
|
-
series:
|
|
122
|
+
series: r,
|
|
123
123
|
labelFormatter: c,
|
|
124
124
|
selection: l
|
|
125
|
-
} =
|
|
126
|
-
for (let
|
|
127
|
-
const
|
|
128
|
-
m.push(c ? c(
|
|
125
|
+
} = t, n = t.optionsOverride, p = l && l.length > 0 ? new Set(l) : null, m = [];
|
|
126
|
+
for (let o = 0; o < i.length - 1; o++) {
|
|
127
|
+
const f = i[o], d = i[o + 1], u = `${_(f)}–${_(d)}`;
|
|
128
|
+
m.push(c ? c(u) : u);
|
|
129
129
|
}
|
|
130
|
-
return (
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
theme:
|
|
130
|
+
return (o, f, d) => {
|
|
131
|
+
if (o == null) {
|
|
132
|
+
const a = X({
|
|
133
|
+
theme: e,
|
|
134
134
|
formatter: s
|
|
135
135
|
});
|
|
136
|
-
return
|
|
136
|
+
return n ? U(a, n) : a;
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
138
|
+
const u = Array.isArray(f) ? f : [];
|
|
139
|
+
if (u.length === 0 || m.length === 0)
|
|
140
140
|
return {
|
|
141
|
-
...
|
|
141
|
+
...o,
|
|
142
142
|
dataset: [],
|
|
143
143
|
series: []
|
|
144
144
|
};
|
|
145
|
-
const y =
|
|
146
|
-
let k = 0,
|
|
147
|
-
const
|
|
148
|
-
color: (
|
|
149
|
-
const
|
|
150
|
-
return
|
|
145
|
+
const y = u.length > 1, h = Array.isArray(o.series) ? o.series : [], $ = h[0] ?? {}, v = typeof o.yAxis == "object" && !Array.isArray(o.yAxis) ? o.yAxis : {}, I = typeof o.grid == "object" && !Array.isArray(o.grid) ? o.grid : {}, H = typeof o.tooltip == "object" && !Array.isArray(o.tooltip) ? o.tooltip : {}, Z = typeof o.legend == "object" && !Array.isArray(o.legend) ? o.legend : {}, L = d?.formatter;
|
|
146
|
+
let k = 0, C = 1;
|
|
147
|
+
const F = J(o.dataZoom, y), B = typeof I.bottom == "number" ? I.bottom : 24, M = y ? 56 : B, P = F ? M + O.sliderHeight + O.sliderGap : M, G = {
|
|
148
|
+
color: (a) => {
|
|
149
|
+
const g = a.color;
|
|
150
|
+
return p ? p.has(a.dataIndex) ? g : R.color.modifyAlpha(g, 0.15) : g;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
return {
|
|
154
|
-
...
|
|
155
|
-
dataset:
|
|
156
|
-
source: m.map((
|
|
154
|
+
...o,
|
|
155
|
+
dataset: u.map((a) => ({
|
|
156
|
+
source: m.map((g, x) => [g, a[x] ?? 0])
|
|
157
157
|
})),
|
|
158
|
-
series:
|
|
159
|
-
const x = h[
|
|
158
|
+
series: u.map((a, g) => {
|
|
159
|
+
const x = h[g] ?? $, N = V(e, r?.[g]?.color);
|
|
160
160
|
return {
|
|
161
161
|
...typeof x == "object" ? x : {},
|
|
162
162
|
type: "bar",
|
|
163
|
-
datasetIndex:
|
|
164
|
-
name:
|
|
163
|
+
datasetIndex: g,
|
|
164
|
+
name: r?.[g]?.name ?? `Series ${g + 1}`,
|
|
165
165
|
encode: {
|
|
166
166
|
x: 0,
|
|
167
167
|
y: 1
|
|
@@ -177,45 +177,45 @@ function Me(e) {
|
|
|
177
177
|
};
|
|
178
178
|
}),
|
|
179
179
|
legend: {
|
|
180
|
-
...
|
|
180
|
+
...Z,
|
|
181
181
|
show: y
|
|
182
182
|
},
|
|
183
183
|
grid: {
|
|
184
184
|
...I,
|
|
185
|
-
bottom:
|
|
185
|
+
bottom: P
|
|
186
186
|
},
|
|
187
|
-
...
|
|
188
|
-
dataZoom:
|
|
187
|
+
...F ? {
|
|
188
|
+
dataZoom: F
|
|
189
189
|
} : {},
|
|
190
190
|
yAxis: {
|
|
191
|
-
...
|
|
192
|
-
min: (
|
|
193
|
-
max: (
|
|
191
|
+
...v,
|
|
192
|
+
min: (a) => (k = a.min < 0 ? S(a.min) : 0, k),
|
|
193
|
+
max: (a) => (C = a.max <= 0 ? 1 : S(a.max), C),
|
|
194
194
|
axisLabel: {
|
|
195
|
-
...
|
|
196
|
-
formatter: (
|
|
195
|
+
...v.axisLabel ?? {},
|
|
196
|
+
formatter: (a) => a !== C && a !== k || a === 0 ? "" : L ? L(a) : String(a)
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
tooltip: {
|
|
200
200
|
...H,
|
|
201
|
-
formatter:
|
|
201
|
+
formatter: D(L)
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
return
|
|
208
|
-
const i =
|
|
206
|
+
function D(t) {
|
|
207
|
+
return Y((e) => {
|
|
208
|
+
const i = e.value?.[1], r = typeof i == "number" && t ? t(i) : i ?? "", c = typeof e.marker == "string" ? e.marker : "", l = e.seriesName ? `${e.seriesName}: ` : "";
|
|
209
209
|
return {
|
|
210
|
-
name: String(
|
|
210
|
+
name: String(e.name ?? ""),
|
|
211
211
|
seriesName: l,
|
|
212
212
|
marker: c,
|
|
213
|
-
value:
|
|
213
|
+
value: r
|
|
214
214
|
};
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
-
function _(
|
|
218
|
-
return Number.isInteger(
|
|
217
|
+
function _(t) {
|
|
218
|
+
return Number.isInteger(t) ? String(t) : Number(t.toFixed(2)).toString();
|
|
219
219
|
}
|
|
220
220
|
const w = {
|
|
221
221
|
container: {
|
|
@@ -224,11 +224,11 @@ const w = {
|
|
|
224
224
|
justifyContent: "space-between",
|
|
225
225
|
flexDirection: "column",
|
|
226
226
|
gap: ({
|
|
227
|
-
spacing:
|
|
228
|
-
}) =>
|
|
227
|
+
spacing: t
|
|
228
|
+
}) => t(1),
|
|
229
229
|
height: ({
|
|
230
|
-
spacing:
|
|
231
|
-
}) =>
|
|
230
|
+
spacing: t
|
|
231
|
+
}) => t(38)
|
|
232
232
|
},
|
|
233
233
|
grid: {
|
|
234
234
|
display: "flex",
|
|
@@ -241,100 +241,94 @@ const w = {
|
|
|
241
241
|
display: "flex",
|
|
242
242
|
alignItems: "center",
|
|
243
243
|
gap: ({
|
|
244
|
-
spacing:
|
|
245
|
-
}) =>
|
|
244
|
+
spacing: t
|
|
245
|
+
}) => t(2),
|
|
246
246
|
height: ({
|
|
247
|
-
spacing:
|
|
248
|
-
}) =>
|
|
247
|
+
spacing: t
|
|
248
|
+
}) => t(5)
|
|
249
249
|
},
|
|
250
250
|
legendItem: {
|
|
251
251
|
display: "flex",
|
|
252
252
|
alignItems: "center",
|
|
253
253
|
gap: ({
|
|
254
|
-
spacing:
|
|
255
|
-
}) =>
|
|
254
|
+
spacing: t
|
|
255
|
+
}) => t(1.5)
|
|
256
256
|
}
|
|
257
|
-
},
|
|
257
|
+
}, tt = (t) => ({
|
|
258
258
|
flex: 1,
|
|
259
|
-
height: `${
|
|
259
|
+
height: `${t}%`,
|
|
260
260
|
minWidth: 8
|
|
261
261
|
});
|
|
262
|
-
function
|
|
263
|
-
const
|
|
262
|
+
function Nt(t) {
|
|
263
|
+
const e = q(15), {
|
|
264
264
|
bins: s
|
|
265
|
-
} =
|
|
266
|
-
let
|
|
267
|
-
if (
|
|
268
|
-
const
|
|
265
|
+
} = t, i = s === void 0 ? 12 : s;
|
|
266
|
+
let r, c, l, n, p;
|
|
267
|
+
if (e[0] !== i) {
|
|
268
|
+
const d = Array.from({
|
|
269
269
|
length: i
|
|
270
|
-
}, (
|
|
270
|
+
}, (u, y) => {
|
|
271
271
|
const h = y / Math.max(1, i - 1);
|
|
272
272
|
return Math.round(20 + 80 * Math.exp(-((h - 0.5) ** 2) * 8));
|
|
273
273
|
});
|
|
274
|
-
c = A,
|
|
274
|
+
c = A, p = w.container, r = A, l = w.grid, n = d.map(rt), e[0] = i, e[1] = r, e[2] = c, e[3] = l, e[4] = n, e[5] = p;
|
|
275
275
|
} else
|
|
276
|
-
|
|
276
|
+
r = e[1], c = e[2], l = e[3], n = e[4], p = e[5];
|
|
277
277
|
let m;
|
|
278
|
-
|
|
279
|
-
let
|
|
280
|
-
|
|
281
|
-
let
|
|
282
|
-
return
|
|
278
|
+
e[6] !== r || e[7] !== l || e[8] !== n ? (m = /* @__PURE__ */ b(r, { sx: l, children: n }), e[6] = r, e[7] = l, e[8] = n, e[9] = m) : m = e[9];
|
|
279
|
+
let o;
|
|
280
|
+
e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ b(A, { sx: w.legend, children: [0, 1].map(et) }), e[10] = o) : o = e[10];
|
|
281
|
+
let f;
|
|
282
|
+
return e[11] !== c || e[12] !== p || e[13] !== m ? (f = /* @__PURE__ */ j(c, { sx: p, children: [
|
|
283
283
|
m,
|
|
284
|
-
|
|
285
|
-
] }),
|
|
284
|
+
o
|
|
285
|
+
] }), e[11] = c, e[12] = p, e[13] = m, e[14] = f) : f = e[14], f;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
return /* @__PURE__ */
|
|
287
|
+
function et(t) {
|
|
288
|
+
return /* @__PURE__ */ j(A, { sx: w.legendItem, children: [
|
|
289
289
|
/* @__PURE__ */ b(T, { variant: "circular", width: 8, height: 8 }),
|
|
290
290
|
/* @__PURE__ */ b(T, { width: 48, height: 8 })
|
|
291
|
-
] }, `legend-${
|
|
291
|
+
] }, `legend-${t}`);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
return /* @__PURE__ */ b(T, { variant: "rectangular", sx:
|
|
293
|
+
function rt(t, e) {
|
|
294
|
+
return /* @__PURE__ */ b(T, { variant: "rectangular", sx: tt(t) }, `bar-${e}`);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
298
|
-
return
|
|
299
|
-
filename:
|
|
300
|
-
getCaptureEl:
|
|
301
|
-
pixelRatio:
|
|
302
|
-
backgroundColor:
|
|
303
|
-
})),
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
c.push(e.seriesNames?.[a] ?? `series_${a + 1}`);
|
|
296
|
+
function Ot(t) {
|
|
297
|
+
const e = [];
|
|
298
|
+
return t.getCaptureEl && e.push(K({
|
|
299
|
+
filename: t.filename,
|
|
300
|
+
getCaptureEl: t.getCaptureEl,
|
|
301
|
+
pixelRatio: t.pngPixelRatio,
|
|
302
|
+
backgroundColor: t.pngBackgroundColor
|
|
303
|
+
})), e.push(Q({
|
|
304
|
+
filename: t.filename,
|
|
305
|
+
getRows: () => {
|
|
306
|
+
const s = t.getData(), i = t.getTicks(), r = s.length, c = ["bin_low", "bin_high"];
|
|
307
|
+
for (let n = 0; n < r; n++)
|
|
308
|
+
c.push(t.seriesNames?.[n] ?? `series_${n + 1}`);
|
|
310
309
|
const l = [c];
|
|
311
|
-
for (let
|
|
312
|
-
const
|
|
313
|
-
for (let
|
|
314
|
-
l.push(
|
|
310
|
+
for (let n = 0; n < Math.max(0, i.length - 1); n++) {
|
|
311
|
+
const p = [i[n], i[n + 1]];
|
|
312
|
+
for (let m = 0; m < r; m++) p.push(s[m]?.[n] ?? 0);
|
|
313
|
+
l.push(p);
|
|
315
314
|
}
|
|
316
|
-
|
|
317
|
-
return Promise.resolve({
|
|
318
|
-
url: p.url,
|
|
319
|
-
filename: `${e.filename}.csv`,
|
|
320
|
-
revoke: p.revoke
|
|
321
|
-
});
|
|
315
|
+
return l;
|
|
322
316
|
}
|
|
323
|
-
}),
|
|
317
|
+
})), e;
|
|
324
318
|
}
|
|
325
|
-
const
|
|
326
|
-
if (!
|
|
327
|
-
const s =
|
|
328
|
-
return s <= 0 ?
|
|
329
|
-
}) :
|
|
330
|
-
function
|
|
331
|
-
return Array.isArray(
|
|
319
|
+
const _t = (t) => Array.isArray(t) ? t.map((e) => {
|
|
320
|
+
if (!ot(e)) return e;
|
|
321
|
+
const s = e.reduce((i, r) => i + Math.abs(r), 0);
|
|
322
|
+
return s <= 0 ? e : e.map((i) => i / s * 100);
|
|
323
|
+
}) : t;
|
|
324
|
+
function ot(t) {
|
|
325
|
+
return Array.isArray(t) ? t.every((e) => typeof e == "number" && Number.isFinite(e)) : !1;
|
|
332
326
|
}
|
|
333
327
|
export {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
328
|
+
Nt as HistogramSkeleton,
|
|
329
|
+
Ot as createHistogramDownloadConfig,
|
|
330
|
+
Mt as createHistogramOptionFactory,
|
|
337
331
|
X as histogramOptions,
|
|
338
|
-
|
|
332
|
+
_t as toRelativeHistogramData
|
|
339
333
|
};
|
|
340
334
|
//# sourceMappingURL=histogram.js.map
|