@carto/ps-react-ui 4.11.0 → 4.11.2
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/{change-column-BiuuHCDN.js → change-column-DjjwoPt1.js} +256 -269
- package/dist/change-column-DjjwoPt1.js.map +1 -0
- package/dist/{data-zoom-layout--YiY6ko_.js → data-zoom-layout-CkVnm6ej.js} +4 -5
- package/dist/{data-zoom-layout--YiY6ko_.js.map → data-zoom-layout-CkVnm6ej.js.map} +1 -1
- package/dist/echart-BMPpj7n_.js +250 -0
- package/dist/echart-BMPpj7n_.js.map +1 -0
- package/dist/{png-item-CS4z1iSH.js → png-item-BE9uEqlD.js} +2 -2
- package/dist/png-item-BE9uEqlD.js.map +1 -0
- package/dist/{spread-CPis22AE.js → spread-DYNpzgh_.js} +9 -11
- package/dist/{spread-CPis22AE.js.map → spread-DYNpzgh_.js.map} +1 -1
- package/dist/{table-CQCAnDLb.js → table-C9IMbTr0.js} +50 -53
- package/dist/table-C9IMbTr0.js.map +1 -0
- package/dist/types/widgets-v2/echart/edge-label-clamp.d.ts +57 -0
- package/dist/types/widgets-v2/echart/edge-label-clamp.test.d.ts +1 -0
- package/dist/widgets-v2/actions.js +2 -2
- package/dist/widgets-v2/bar.js +91 -105
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +27 -29
- package/dist/widgets-v2/category.js.map +1 -1
- package/dist/widgets-v2/echart.js +1 -1
- package/dist/widgets-v2/formula.js +24 -25
- package/dist/widgets-v2/formula.js.map +1 -1
- package/dist/widgets-v2/histogram.js +98 -112
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/markdown.js +25 -27
- package/dist/widgets-v2/markdown.js.map +1 -1
- package/dist/widgets-v2/pie.js +7 -10
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +9 -12
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/spread.js +14 -16
- package/dist/widgets-v2/spread.js.map +1 -1
- package/dist/widgets-v2/table.js +38 -40
- package/dist/widgets-v2/table.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +106 -121
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2/utils.js +1 -1
- package/dist/widgets-v2.js +43 -46
- package/dist/widgets-v2.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets-v2/actions/brush-toggle/brush-toggle.tsx +1 -1
- package/src/widgets-v2/actions/change-column/sortable-column-item.tsx +1 -1
- package/src/widgets-v2/actions/download/download.tsx +1 -1
- package/src/widgets-v2/actions/download/icons.tsx +1 -1
- package/src/widgets-v2/actions/fullscreen/fullscreen.tsx +3 -3
- package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +2 -2
- package/src/widgets-v2/actions/relative-data/relative-data.tsx +1 -1
- package/src/widgets-v2/actions/searcher/searcher-toggle.tsx +1 -1
- package/src/widgets-v2/actions/searcher/searcher.tsx +2 -2
- package/src/widgets-v2/actions/show-all/show-all.tsx +1 -1
- package/src/widgets-v2/actions/stack-toggle/stack-toggle.tsx +1 -1
- package/src/widgets-v2/actions/zoom-toggle/zoom-toggle.tsx +1 -1
- package/src/widgets-v2/bar/options.test.ts +31 -4
- package/src/widgets-v2/bar/options.ts +18 -22
- package/src/widgets-v2/echart/echart-ui.test.tsx +70 -0
- package/src/widgets-v2/echart/echart-ui.tsx +28 -0
- package/src/widgets-v2/echart/edge-label-clamp.test.ts +198 -0
- package/src/widgets-v2/echart/edge-label-clamp.ts +216 -0
- package/src/widgets-v2/histogram/options.test.ts +11 -4
- package/src/widgets-v2/histogram/options.ts +17 -21
- package/src/widgets-v2/table/table-ui.tsx +4 -4
- package/src/widgets-v2/timeseries/options.test.ts +9 -4
- package/src/widgets-v2/timeseries/options.ts +17 -22
- package/src/widgets-v2/toolbox/toolbox.tsx +1 -1
- package/src/widgets-v2/wrapper/widget-wrapper.tsx +1 -1
- package/dist/change-column-BiuuHCDN.js.map +0 -1
- package/dist/echart-CU0KmClP.js +0 -176
- package/dist/echart-CU0KmClP.js.map +0 -1
- package/dist/png-item-CS4z1iSH.js.map +0 -1
- package/dist/table-CQCAnDLb.js.map +0 -1
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as $, a as j, b as A, c as N, d as z, e as V, f as G } from "../category-Dnd2_j0x.js";
|
|
2
2
|
import { jsx as m, jsxs as d } from "react/jsx-runtime";
|
|
3
3
|
import { c as h } from "react/compiler-runtime";
|
|
4
4
|
import { Box as p, Skeleton as f } from "@mui/material";
|
|
5
5
|
import "react";
|
|
6
|
-
import "@mui/icons-material
|
|
6
|
+
import "@mui/icons-material";
|
|
7
7
|
import "../lasso-tool-CDFj4zKY.js";
|
|
8
8
|
import "../cjs-D4KH3azB.js";
|
|
9
|
-
import "@mui/icons-material";
|
|
10
9
|
import "@carto/ps-utils";
|
|
11
10
|
import { a as w } from "../exports-Cx-f6m6U.js";
|
|
12
|
-
import "
|
|
13
|
-
|
|
14
|
-
const s = {
|
|
11
|
+
import { b as C } from "../png-item-BE9uEqlD.js";
|
|
12
|
+
const i = {
|
|
15
13
|
root: {
|
|
16
14
|
display: "flex",
|
|
17
15
|
flexDirection: "column",
|
|
@@ -44,28 +42,28 @@ const s = {
|
|
|
44
42
|
small: 4,
|
|
45
43
|
medium: 12
|
|
46
44
|
}, g = ["95%", "80%", "55%", "75%", "60%"];
|
|
47
|
-
function
|
|
45
|
+
function T(o) {
|
|
48
46
|
const e = h(5), {
|
|
49
47
|
rows: l,
|
|
50
|
-
size:
|
|
51
|
-
} = o, r = l === void 0 ? 5 : l, a =
|
|
48
|
+
size: s
|
|
49
|
+
} = o, r = l === void 0 ? 5 : l, a = s === void 0 ? "small" : s;
|
|
52
50
|
let t;
|
|
53
51
|
e[0] !== r ? (t = Array.from({
|
|
54
52
|
length: r
|
|
55
53
|
}), e[0] = r, e[1] = t) : t = e[1];
|
|
56
|
-
let
|
|
57
|
-
return e[2] !== a || e[3] !== t ? (
|
|
58
|
-
/* @__PURE__ */ d(p, { sx:
|
|
59
|
-
/* @__PURE__ */ m(f, { variant: "rectangular", sx:
|
|
60
|
-
/* @__PURE__ */ m(f, { variant: "rectangular", sx:
|
|
54
|
+
let n;
|
|
55
|
+
return e[2] !== a || e[3] !== t ? (n = /* @__PURE__ */ m(p, { sx: i.root, children: t.map((c, u) => /* @__PURE__ */ d(p, { sx: i.row, children: [
|
|
56
|
+
/* @__PURE__ */ d(p, { sx: i.rowHeader, children: [
|
|
57
|
+
/* @__PURE__ */ m(f, { variant: "rectangular", sx: i.name }),
|
|
58
|
+
/* @__PURE__ */ m(f, { variant: "rectangular", sx: i.value })
|
|
61
59
|
] }),
|
|
62
60
|
/* @__PURE__ */ m(f, { variant: "rectangular", sx: {
|
|
63
61
|
height: x[a],
|
|
64
62
|
width: g[u % g.length]
|
|
65
63
|
} })
|
|
66
|
-
] }, `row-${u}`)) }), e[2] = a, e[3] = t, e[4] =
|
|
64
|
+
] }, `row-${u}`)) }), e[2] = a, e[3] = t, e[4] = n) : n = e[4], n;
|
|
67
65
|
}
|
|
68
|
-
function
|
|
66
|
+
function B(o) {
|
|
69
67
|
const e = [];
|
|
70
68
|
return o.getCaptureEl && e.push(C({
|
|
71
69
|
filename: o.filename,
|
|
@@ -76,13 +74,13 @@ function _(o) {
|
|
|
76
74
|
id: "csv",
|
|
77
75
|
label: "Download as CSV",
|
|
78
76
|
resolve: () => {
|
|
79
|
-
const l = o.getData(),
|
|
77
|
+
const l = o.getData(), s = [["series", "name", "value"]];
|
|
80
78
|
for (const [a, t] of l.entries()) {
|
|
81
|
-
const
|
|
79
|
+
const n = o.seriesNames?.[a] ?? `series_${a + 1}`;
|
|
82
80
|
for (const c of t)
|
|
83
|
-
|
|
81
|
+
s.push([n, c.name, c.value]);
|
|
84
82
|
}
|
|
85
|
-
const r = w(
|
|
83
|
+
const r = w(s);
|
|
86
84
|
return Promise.resolve({
|
|
87
85
|
url: r.url,
|
|
88
86
|
filename: `${o.filename}.csv`,
|
|
@@ -92,14 +90,14 @@ function _(o) {
|
|
|
92
90
|
}), e;
|
|
93
91
|
}
|
|
94
92
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
$ as Category,
|
|
94
|
+
j as CategoryBar,
|
|
95
|
+
A as CategoryLegend,
|
|
96
|
+
N as CategoryRowMulti,
|
|
97
|
+
z as CategoryRowOther,
|
|
98
|
+
V as CategoryRowSingle,
|
|
99
|
+
T as CategorySkeleton,
|
|
100
|
+
G as CategoryUI,
|
|
101
|
+
B as createCategoryDownloadConfig
|
|
104
102
|
};
|
|
105
103
|
//# sourceMappingURL=category.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sources":["../../src/widgets-v2/category/skeleton.tsx","../../src/widgets-v2/category/download.ts"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\nimport type { CategorySize } from './types'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n py: 0.5,\n },\n // Mirror the real row layout: label + value on top, bar below.\n row: {\n display: 'flex',\n flexDirection: 'column',\n gap: 0.5,\n },\n rowHeader: {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 1,\n },\n // Small fixed-width shimmer pills — matches the visual density of the\n // real label / value cells without claiming the full row width.\n name: { height: 14, width: 80 },\n value: { height: 14, width: 48 },\n} satisfies Record<string, SxProps<Theme>>\n\n// Bar shimmer height matches the live bar track for each size variant so\n// the skeleton doesn't visibly resize the row on data settle.\nconst BAR_HEIGHT: Record<CategorySize, number> = {\n small: 4,\n medium: 12,\n}\n\n// Varied widths give the bar shimmer a more realistic, less uniform feel.\n// Cycles when `rows > WIDTH_PATTERNS.length`.\nconst WIDTH_PATTERNS = ['95%', '80%', '55%', '75%', '60%']\n\nexport interface CategorySkeletonProps {\n rows?: number\n /**\n * Visual density. Mirrors the live widget's `size` prop so the loading\n * shimmer's bar height matches what's about to render — no row jump\n * on data settle.\n */\n size?: CategorySize\n}\n\nexport function CategorySkeleton({\n rows = 5,\n size = 'small',\n}: CategorySkeletonProps) {\n return (\n <Box sx={styles.root}>\n {Array.from({ length: rows }).map((_, i) => (\n <Box key={`row-${i}`} sx={styles.row}>\n <Box sx={styles.rowHeader}>\n <Skeleton variant='rectangular' sx={styles.name} />\n <Skeleton variant='rectangular' sx={styles.value} />\n </Box>\n <Skeleton\n variant='rectangular'\n sx={{\n height: BAR_HEIGHT[size],\n width: WIDTH_PATTERNS[i % WIDTH_PATTERNS.length],\n }}\n />\n </Box>\n ))}\n </Box>\n )\n}\n","import {\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { CategoryWidgetData } from './types'\n\n/**\n * Download menu items for the Category widget. Always includes a CSV item\n * with `series, name, value` columns (one row per item). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createCategoryDownloadConfig(args: {\n filename: string\n getData: () => CategoryWidgetData\n seriesNames?: readonly string[]\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: 'csv',\n label: 'Download as CSV',\n resolve: () => {\n const data = args.getData()\n const rows: unknown[][] = [['series', 'name', 'value']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const item of series) {\n rows.push([seriesName, item.name, item.value])\n }\n }\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n"],"names":["styles","root","display","flexDirection","gap","py","row","rowHeader","justifyContent","alignItems","name","height","width","value","BAR_HEIGHT","small","medium","WIDTH_PATTERNS","CategorySkeleton","t0","$","_c","rows","t1","size","t2","undefined","t3","Array","from","length","t4","Box","map","_","i","jsxs","jsx","Skeleton","createCategoryDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","label","resolve","data","getData","series","entries","seriesName","seriesNames","item","handle","downloadToCSV","Promise","url","revoke"],"mappings":"
|
|
1
|
+
{"version":3,"file":"category.js","sources":["../../src/widgets-v2/category/skeleton.tsx","../../src/widgets-v2/category/download.ts"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\nimport type { CategorySize } from './types'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n py: 0.5,\n },\n // Mirror the real row layout: label + value on top, bar below.\n row: {\n display: 'flex',\n flexDirection: 'column',\n gap: 0.5,\n },\n rowHeader: {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: 1,\n },\n // Small fixed-width shimmer pills — matches the visual density of the\n // real label / value cells without claiming the full row width.\n name: { height: 14, width: 80 },\n value: { height: 14, width: 48 },\n} satisfies Record<string, SxProps<Theme>>\n\n// Bar shimmer height matches the live bar track for each size variant so\n// the skeleton doesn't visibly resize the row on data settle.\nconst BAR_HEIGHT: Record<CategorySize, number> = {\n small: 4,\n medium: 12,\n}\n\n// Varied widths give the bar shimmer a more realistic, less uniform feel.\n// Cycles when `rows > WIDTH_PATTERNS.length`.\nconst WIDTH_PATTERNS = ['95%', '80%', '55%', '75%', '60%']\n\nexport interface CategorySkeletonProps {\n rows?: number\n /**\n * Visual density. Mirrors the live widget's `size` prop so the loading\n * shimmer's bar height matches what's about to render — no row jump\n * on data settle.\n */\n size?: CategorySize\n}\n\nexport function CategorySkeleton({\n rows = 5,\n size = 'small',\n}: CategorySkeletonProps) {\n return (\n <Box sx={styles.root}>\n {Array.from({ length: rows }).map((_, i) => (\n <Box key={`row-${i}`} sx={styles.row}>\n <Box sx={styles.rowHeader}>\n <Skeleton variant='rectangular' sx={styles.name} />\n <Skeleton variant='rectangular' sx={styles.value} />\n </Box>\n <Skeleton\n variant='rectangular'\n sx={{\n height: BAR_HEIGHT[size],\n width: WIDTH_PATTERNS[i % WIDTH_PATTERNS.length],\n }}\n />\n </Box>\n ))}\n </Box>\n )\n}\n","import {\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { CategoryWidgetData } from './types'\n\n/**\n * Download menu items for the Category widget. Always includes a CSV item\n * with `series, name, value` columns (one row per item). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createCategoryDownloadConfig(args: {\n filename: string\n getData: () => CategoryWidgetData\n seriesNames?: readonly string[]\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: 'csv',\n label: 'Download as CSV',\n resolve: () => {\n const data = args.getData()\n const rows: unknown[][] = [['series', 'name', 'value']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const item of series) {\n rows.push([seriesName, item.name, item.value])\n }\n }\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n"],"names":["styles","root","display","flexDirection","gap","py","row","rowHeader","justifyContent","alignItems","name","height","width","value","BAR_HEIGHT","small","medium","WIDTH_PATTERNS","CategorySkeleton","t0","$","_c","rows","t1","size","t2","undefined","t3","Array","from","length","t4","Box","map","_","i","jsxs","jsx","Skeleton","createCategoryDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","label","resolve","data","getData","series","entries","seriesName","seriesNames","item","handle","downloadToCSV","Promise","url","revoke"],"mappings":"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"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { N
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { D as I, F as E, a as $ } from "../formula-DuC0NQLH.js";
|
|
2
|
+
import { N, P as R, S as _, a as j, V as z } from "../style-DVnT6HC1.js";
|
|
3
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
import { c as s } from "react/compiler-runtime";
|
|
5
5
|
import { Box as m, Skeleton as u } from "@mui/material";
|
|
6
6
|
import "react";
|
|
7
|
-
import "@mui/icons-material
|
|
7
|
+
import "@mui/icons-material";
|
|
8
8
|
import "../lasso-tool-CDFj4zKY.js";
|
|
9
9
|
import "../cjs-D4KH3azB.js";
|
|
10
|
-
import "@mui/icons-material";
|
|
11
10
|
import "@carto/ps-utils";
|
|
12
11
|
import { a as f } from "../exports-Cx-f6m6U.js";
|
|
13
|
-
import { b as p, C as c } from "../png-item-
|
|
12
|
+
import { b as p, C as c } from "../png-item-BE9uEqlD.js";
|
|
14
13
|
const l = {
|
|
15
14
|
root: {
|
|
16
15
|
display: "flex",
|
|
@@ -24,19 +23,19 @@ const l = {
|
|
|
24
23
|
height: 36
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
|
-
function
|
|
26
|
+
function F(o) {
|
|
28
27
|
const e = s(2), {
|
|
29
|
-
count:
|
|
30
|
-
} = o, r =
|
|
28
|
+
count: n
|
|
29
|
+
} = o, r = n === void 0 ? 1 : n;
|
|
31
30
|
let t;
|
|
32
|
-
return e[0] !== r ? (t = /* @__PURE__ */
|
|
31
|
+
return e[0] !== r ? (t = /* @__PURE__ */ i(m, { sx: l.root, children: Array.from({
|
|
33
32
|
length: r
|
|
34
33
|
}).map(d) }), e[0] = r, e[1] = t) : t = e[1], t;
|
|
35
34
|
}
|
|
36
35
|
function d(o, e) {
|
|
37
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ i(u, { variant: "rectangular", sx: l.block }, `row-${e}`);
|
|
38
37
|
}
|
|
39
|
-
function
|
|
38
|
+
function P(o) {
|
|
40
39
|
const e = [];
|
|
41
40
|
return o.getCaptureEl && e.push(p({
|
|
42
41
|
filename: o.filename,
|
|
@@ -46,10 +45,10 @@ function V(o) {
|
|
|
46
45
|
})), e.push({
|
|
47
46
|
id: "csv",
|
|
48
47
|
label: "CSV",
|
|
49
|
-
icon: /* @__PURE__ */
|
|
48
|
+
icon: /* @__PURE__ */ i(c, { fontSize: "small" }),
|
|
50
49
|
resolve: () => {
|
|
51
|
-
const
|
|
52
|
-
for (const a of
|
|
50
|
+
const n = o.getData(), r = [["series", "prefix", "value", "suffix", "note", "delta"]];
|
|
51
|
+
for (const a of n)
|
|
53
52
|
r.push([a.series?.name ?? "", a.prefix ?? "", a.value, a.suffix ?? "", a.note ?? "", a.delta?.value ?? ""]);
|
|
54
53
|
const t = f(r);
|
|
55
54
|
return Promise.resolve({
|
|
@@ -61,15 +60,15 @@ function V(o) {
|
|
|
61
60
|
}), e;
|
|
62
61
|
}
|
|
63
62
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
I as Delta,
|
|
64
|
+
E as Formula,
|
|
65
|
+
F as FormulaSkeleton,
|
|
66
|
+
$ as FormulaUI,
|
|
67
|
+
N as Note,
|
|
68
|
+
R as Prefix,
|
|
69
|
+
_ as Series,
|
|
70
|
+
j as Suffix,
|
|
71
|
+
z as Value,
|
|
72
|
+
P as createFormulaDownloadConfig
|
|
74
73
|
};
|
|
75
74
|
//# 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 CSVIcon,\n buildPngDownloadItem,\n downloadToCSV,\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 id: 'csv',\n label: 'CSV',\n icon: <CSVIcon fontSize='small' />,\n resolve: () => {\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 const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\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","id","label","icon","CSVIcon","resolve","data","getData","rows","d","series","name","prefix","value","suffix","note","delta","handle","downloadToCSV","Promise","url","revoke"],"mappings":"
|
|
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 CSVIcon,\n buildPngDownloadItem,\n downloadToCSV,\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 id: 'csv',\n label: 'CSV',\n icon: <CSVIcon fontSize='small' />,\n resolve: () => {\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 const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\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","id","label","icon","CSVIcon","resolve","data","getData","rows","d","series","name","prefix","value","suffix","note","delta","handle","downloadToCSV","Promise","url","revoke"],"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;ACItE,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,KAAK;AAAA,IACTO,IAAI;AAAA,IACJC,OAAO;AAAA,IACPC,MAAM,gBAAAf,EAACgB,GAAA,EAAQ,UAAS,QAAA,CAAO;AAAA,IAC/BC,SAASA,MAAM;AACb,YAAMC,IAAOf,EAAKgB,QAAAA,GACZC,IAAoB,CACxB,CAAC,UAAU,UAAU,SAAS,UAAU,QAAQ,OAAO,CAAC;AAE1D,iBAAWC,KAAKH;AACdE,QAAAA,EAAKd,KAAK,CACRe,EAAEC,QAAQC,QAAQ,IAClBF,EAAEG,UAAU,IACZH,EAAEI,OACFJ,EAAEK,UAAU,IACZL,EAAEM,QAAQ,IACVN,EAAEO,OAAOH,SAAS,EAAE,CACrB;AAEH,YAAMI,IAASC,EAAcV,CAAI;AACjC,aAAOW,QAAQd,QAAQ;AAAA,QACrBe,KAAKH,EAAOG;AAAAA,QACZxB,UAAU,GAAGL,EAAKK,QAAQ;AAAA,QAC1ByB,QAAQJ,EAAOI;AAAAA,MAAAA,CAChB;AAAA,IACH;AAAA,EAAA,CACD,GACM7B;AACT;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { n as
|
|
1
|
+
import * as z from "echarts";
|
|
2
|
+
import { n as S, d as E, g as R, c as V, f as W } from "../option-builders-F-c9ELi1.js";
|
|
3
3
|
import { jsx as b, jsxs as $ } from "react/jsx-runtime";
|
|
4
4
|
import { c as Y } from "react/compiler-runtime";
|
|
5
|
-
import { Skeleton as
|
|
5
|
+
import { Skeleton as T, Box as A } from "@mui/material";
|
|
6
6
|
import "../widget-store-Bw5zRUGg.js";
|
|
7
7
|
import "zustand/shallow";
|
|
8
8
|
import "@mui/icons-material";
|
|
@@ -15,7 +15,6 @@ import "@dnd-kit/core";
|
|
|
15
15
|
import "@dnd-kit/sortable";
|
|
16
16
|
import "@dnd-kit/utilities";
|
|
17
17
|
import "react-dom";
|
|
18
|
-
import "@mui/icons-material/ZoomIn";
|
|
19
18
|
import "../widget-context-DTGO0Yta.js";
|
|
20
19
|
import "zustand";
|
|
21
20
|
import "zustand/vanilla";
|
|
@@ -23,23 +22,21 @@ import "zustand/middleware";
|
|
|
23
22
|
import "zustand/react/shallow";
|
|
24
23
|
import { Z as O } from "../transforms-Cdx4fkU5.js";
|
|
25
24
|
import { m as q, r as U } from "../resolve-theme-color-BdojIw0K.js";
|
|
26
|
-
import { p as J } from "../data-zoom-layout
|
|
27
|
-
import "@mui/icons-material/FileDownload";
|
|
25
|
+
import { p as J } from "../data-zoom-layout-CkVnm6ej.js";
|
|
28
26
|
import { a as K } from "../exports-Cx-f6m6U.js";
|
|
29
|
-
import "
|
|
30
|
-
import { b as Q } from "../png-item-CS4z1iSH.js";
|
|
27
|
+
import { b as Q } from "../png-item-BE9uEqlD.js";
|
|
31
28
|
function X({
|
|
32
29
|
theme: e,
|
|
33
30
|
formatter: t
|
|
34
31
|
}) {
|
|
35
|
-
let
|
|
32
|
+
let s = 0, i = 1;
|
|
36
33
|
return {
|
|
37
34
|
grid: {
|
|
38
35
|
left: parseInt(e.spacing(1)),
|
|
39
36
|
top: parseInt(e.spacing(3)),
|
|
40
37
|
right: parseInt(e.spacing(1)),
|
|
41
38
|
// Default: no legend. Merger bumps this when there are >1 series.
|
|
42
|
-
...
|
|
39
|
+
...V(!1, e),
|
|
43
40
|
containLabel: !0
|
|
44
41
|
},
|
|
45
42
|
tooltip: {
|
|
@@ -55,7 +52,7 @@ function X({
|
|
|
55
52
|
axisPointer: {
|
|
56
53
|
type: "line"
|
|
57
54
|
},
|
|
58
|
-
position:
|
|
55
|
+
position: R(e),
|
|
59
56
|
formatter: j(t)
|
|
60
57
|
},
|
|
61
58
|
// Legend styling baked here; `show` is toggled by the merger based on
|
|
@@ -63,7 +60,7 @@ function X({
|
|
|
63
60
|
// options layer (bin labels are pre-formatted in the merger), so we
|
|
64
61
|
// skip the legend `labelFormatter` argument too.
|
|
65
62
|
legend: {
|
|
66
|
-
...
|
|
63
|
+
...E({
|
|
67
64
|
hasLegend: !1
|
|
68
65
|
})
|
|
69
66
|
},
|
|
@@ -89,8 +86,8 @@ function X({
|
|
|
89
86
|
},
|
|
90
87
|
yAxis: {
|
|
91
88
|
type: "value",
|
|
92
|
-
min: (
|
|
93
|
-
max: (
|
|
89
|
+
min: (o) => (s = o.min < 0 ? S(o.min) : 0, s),
|
|
90
|
+
max: (o) => (i = o.max <= 0 ? 1 : S(o.max), i),
|
|
94
91
|
axisLine: {
|
|
95
92
|
show: !1
|
|
96
93
|
},
|
|
@@ -112,60 +109,59 @@ function X({
|
|
|
112
109
|
showMinLabel: !0,
|
|
113
110
|
verticalAlign: "bottom",
|
|
114
111
|
inside: !0,
|
|
115
|
-
formatter: (
|
|
112
|
+
formatter: (o) => o !== i && o !== s || o === 0 ? "" : t ? t(o) : String(o)
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
115
|
};
|
|
119
116
|
}
|
|
120
|
-
function
|
|
117
|
+
function Me(e) {
|
|
121
118
|
const {
|
|
122
119
|
theme: t,
|
|
123
|
-
formatter:
|
|
124
|
-
ticks:
|
|
125
|
-
series:
|
|
126
|
-
labelFormatter:
|
|
127
|
-
selection:
|
|
128
|
-
} = e, p = e.optionsOverride,
|
|
129
|
-
for (let r = 0; r <
|
|
130
|
-
const
|
|
131
|
-
m.push(
|
|
120
|
+
formatter: s,
|
|
121
|
+
ticks: i,
|
|
122
|
+
series: o,
|
|
123
|
+
labelFormatter: c,
|
|
124
|
+
selection: l
|
|
125
|
+
} = e, p = e.optionsOverride, a = l && l.length > 0 ? new Set(l) : null, m = [];
|
|
126
|
+
for (let r = 0; r < i.length - 1; r++) {
|
|
127
|
+
const g = i[r], u = i[r + 1], d = `${_(g)}–${_(u)}`;
|
|
128
|
+
m.push(c ? c(d) : d);
|
|
132
129
|
}
|
|
133
|
-
return (r,
|
|
130
|
+
return (r, g, u) => {
|
|
134
131
|
if (r == null) {
|
|
135
|
-
const
|
|
132
|
+
const n = X({
|
|
136
133
|
theme: t,
|
|
137
|
-
formatter:
|
|
134
|
+
formatter: s
|
|
138
135
|
});
|
|
139
|
-
return p ? q(
|
|
136
|
+
return p ? q(n, p) : n;
|
|
140
137
|
}
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
138
|
+
const d = Array.isArray(g) ? g : [];
|
|
139
|
+
if (d.length === 0 || m.length === 0)
|
|
143
140
|
return {
|
|
144
141
|
...r,
|
|
145
142
|
dataset: [],
|
|
146
143
|
series: []
|
|
147
144
|
};
|
|
148
|
-
const y =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return n ? n.has(c.dataIndex) ? f : G.color.modifyAlpha(f, 0.15) : f;
|
|
145
|
+
const y = d.length > 1, h = Array.isArray(r.series) ? r.series : [], D = h[0] ?? {}, F = typeof r.yAxis == "object" && !Array.isArray(r.yAxis) ? r.yAxis : {}, I = typeof r.grid == "object" && !Array.isArray(r.grid) ? r.grid : {}, H = typeof r.tooltip == "object" && !Array.isArray(r.tooltip) ? r.tooltip : {}, P = typeof r.legend == "object" && !Array.isArray(r.legend) ? r.legend : {}, L = u?.formatter;
|
|
146
|
+
let k = 0, v = 1;
|
|
147
|
+
const C = J(r.dataZoom, y), Z = typeof I.bottom == "number" ? I.bottom : 24, M = y ? 56 : Z, B = C ? M + O.sliderHeight + O.sliderGap : M, G = {
|
|
148
|
+
color: (n) => {
|
|
149
|
+
const f = n.color;
|
|
150
|
+
return a ? a.has(n.dataIndex) ? f : z.color.modifyAlpha(f, 0.15) : f;
|
|
155
151
|
}
|
|
156
152
|
};
|
|
157
153
|
return {
|
|
158
154
|
...r,
|
|
159
|
-
dataset:
|
|
160
|
-
source: m.map((f,
|
|
155
|
+
dataset: d.map((n) => ({
|
|
156
|
+
source: m.map((f, x) => [f, n[x] ?? 0])
|
|
161
157
|
})),
|
|
162
|
-
series:
|
|
163
|
-
const
|
|
158
|
+
series: d.map((n, f) => {
|
|
159
|
+
const x = h[f] ?? D, N = U(t, o?.[f]?.color);
|
|
164
160
|
return {
|
|
165
|
-
...typeof
|
|
161
|
+
...typeof x == "object" ? x : {},
|
|
166
162
|
type: "bar",
|
|
167
163
|
datasetIndex: f,
|
|
168
|
-
name:
|
|
164
|
+
name: o?.[f]?.name ?? `Series ${f + 1}`,
|
|
169
165
|
encode: {
|
|
170
166
|
x: 0,
|
|
171
167
|
y: 1
|
|
@@ -174,60 +170,50 @@ function $e(e) {
|
|
|
174
170
|
emphasis: {
|
|
175
171
|
focus: "series"
|
|
176
172
|
},
|
|
177
|
-
itemStyle:
|
|
173
|
+
itemStyle: G,
|
|
178
174
|
...N ? {
|
|
179
175
|
color: N
|
|
180
176
|
} : {}
|
|
181
177
|
};
|
|
182
178
|
}),
|
|
183
179
|
legend: {
|
|
184
|
-
...
|
|
180
|
+
...P,
|
|
185
181
|
show: y
|
|
186
182
|
},
|
|
187
183
|
grid: {
|
|
188
|
-
...
|
|
189
|
-
bottom:
|
|
184
|
+
...I,
|
|
185
|
+
bottom: B
|
|
190
186
|
},
|
|
191
|
-
...
|
|
192
|
-
dataZoom:
|
|
187
|
+
...C ? {
|
|
188
|
+
dataZoom: C
|
|
193
189
|
} : {},
|
|
194
190
|
yAxis: {
|
|
195
|
-
...
|
|
196
|
-
min:
|
|
197
|
-
max:
|
|
191
|
+
...F,
|
|
192
|
+
min: (n) => (k = n.min < 0 ? S(n.min) : 0, k),
|
|
193
|
+
max: (n) => (v = n.max <= 0 ? 1 : S(n.max), v),
|
|
198
194
|
axisLabel: {
|
|
199
|
-
...
|
|
200
|
-
formatter: (
|
|
195
|
+
...F.axisLabel ?? {},
|
|
196
|
+
formatter: (n) => n !== v && n !== k || n === 0 ? "" : L ? L(n) : String(n)
|
|
201
197
|
}
|
|
202
198
|
},
|
|
203
199
|
tooltip: {
|
|
204
200
|
...H,
|
|
205
|
-
formatter: j(
|
|
201
|
+
formatter: j(L)
|
|
206
202
|
}
|
|
207
203
|
};
|
|
208
204
|
};
|
|
209
205
|
}
|
|
210
206
|
function j(e) {
|
|
211
207
|
return W((t) => {
|
|
212
|
-
const
|
|
208
|
+
const i = t.value?.[1], o = typeof i == "number" && e ? e(i) : i ?? "", c = typeof t.marker == "string" ? t.marker : "", l = t.seriesName ? `${t.seriesName}: ` : "";
|
|
213
209
|
return {
|
|
214
210
|
name: String(t.name ?? ""),
|
|
215
|
-
seriesName:
|
|
216
|
-
marker:
|
|
217
|
-
value:
|
|
211
|
+
seriesName: l,
|
|
212
|
+
marker: c,
|
|
213
|
+
value: o
|
|
218
214
|
};
|
|
219
215
|
});
|
|
220
216
|
}
|
|
221
|
-
function ee(e) {
|
|
222
|
-
let t = -1 / 0;
|
|
223
|
-
for (const a of e)
|
|
224
|
-
for (const o of a)
|
|
225
|
-
typeof o != "number" || !Number.isFinite(o) || o > t && (t = o);
|
|
226
|
-
return {
|
|
227
|
-
niceMinVal: 0,
|
|
228
|
-
niceMaxVal: t <= 0 ? 1 : L(t)
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
217
|
function _(e) {
|
|
232
218
|
return Number.isInteger(e) ? String(e) : Number(e.toFixed(2)).toString();
|
|
233
219
|
}
|
|
@@ -268,46 +254,46 @@ const w = {
|
|
|
268
254
|
spacing: e
|
|
269
255
|
}) => e(1.5)
|
|
270
256
|
}
|
|
271
|
-
},
|
|
257
|
+
}, ee = (e) => ({
|
|
272
258
|
flex: 1,
|
|
273
259
|
height: `${e}%`,
|
|
274
260
|
minWidth: 8
|
|
275
261
|
});
|
|
276
|
-
function
|
|
262
|
+
function Ne(e) {
|
|
277
263
|
const t = Y(15), {
|
|
278
|
-
bins:
|
|
279
|
-
} = e,
|
|
280
|
-
let
|
|
281
|
-
if (t[0] !==
|
|
282
|
-
const
|
|
283
|
-
length:
|
|
284
|
-
}, (
|
|
285
|
-
const
|
|
286
|
-
return Math.round(20 + 80 * Math.exp(-((
|
|
264
|
+
bins: s
|
|
265
|
+
} = e, i = s === void 0 ? 12 : s;
|
|
266
|
+
let o, c, l, p, a;
|
|
267
|
+
if (t[0] !== i) {
|
|
268
|
+
const u = Array.from({
|
|
269
|
+
length: i
|
|
270
|
+
}, (d, y) => {
|
|
271
|
+
const h = y / Math.max(1, i - 1);
|
|
272
|
+
return Math.round(20 + 80 * Math.exp(-((h - 0.5) ** 2) * 8));
|
|
287
273
|
});
|
|
288
|
-
|
|
274
|
+
c = A, a = w.container, o = A, l = w.grid, p = u.map(re), t[0] = i, t[1] = o, t[2] = c, t[3] = l, t[4] = p, t[5] = a;
|
|
289
275
|
} else
|
|
290
|
-
|
|
276
|
+
o = t[1], c = t[2], l = t[3], p = t[4], a = t[5];
|
|
291
277
|
let m;
|
|
292
|
-
t[6] !==
|
|
278
|
+
t[6] !== o || t[7] !== l || t[8] !== p ? (m = /* @__PURE__ */ b(o, { sx: l, children: p }), t[6] = o, t[7] = l, t[8] = p, t[9] = m) : m = t[9];
|
|
293
279
|
let r;
|
|
294
|
-
t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ b(A, { sx: w.legend, children: [0, 1].map(
|
|
295
|
-
let
|
|
296
|
-
return t[11] !==
|
|
280
|
+
t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ b(A, { sx: w.legend, children: [0, 1].map(te) }), t[10] = r) : r = t[10];
|
|
281
|
+
let g;
|
|
282
|
+
return t[11] !== c || t[12] !== a || t[13] !== m ? (g = /* @__PURE__ */ $(c, { sx: a, children: [
|
|
297
283
|
m,
|
|
298
284
|
r
|
|
299
|
-
] }), t[11] =
|
|
285
|
+
] }), t[11] = c, t[12] = a, t[13] = m, t[14] = g) : g = t[14], g;
|
|
300
286
|
}
|
|
301
|
-
function
|
|
287
|
+
function te(e) {
|
|
302
288
|
return /* @__PURE__ */ $(A, { sx: w.legendItem, children: [
|
|
303
|
-
/* @__PURE__ */ b(
|
|
304
|
-
/* @__PURE__ */ b(
|
|
289
|
+
/* @__PURE__ */ b(T, { variant: "circular", width: 8, height: 8 }),
|
|
290
|
+
/* @__PURE__ */ b(T, { width: 48, height: 8 })
|
|
305
291
|
] }, `legend-${e}`);
|
|
306
292
|
}
|
|
307
|
-
function
|
|
308
|
-
return /* @__PURE__ */ b(
|
|
293
|
+
function re(e, t) {
|
|
294
|
+
return /* @__PURE__ */ b(T, { variant: "rectangular", sx: ee(e) }, `bar-${t}`);
|
|
309
295
|
}
|
|
310
|
-
function
|
|
296
|
+
function Oe(e) {
|
|
311
297
|
const t = [];
|
|
312
298
|
return e.getCaptureEl && t.push(Q({
|
|
313
299
|
filename: e.filename,
|
|
@@ -318,16 +304,16 @@ function De(e) {
|
|
|
318
304
|
id: "csv",
|
|
319
305
|
label: "Download as CSV",
|
|
320
306
|
resolve: () => {
|
|
321
|
-
const
|
|
322
|
-
for (let
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
for (let
|
|
326
|
-
const m = [
|
|
327
|
-
for (let r = 0; r <
|
|
328
|
-
|
|
307
|
+
const s = e.getData(), i = e.getTicks(), o = s.length, c = ["bin_low", "bin_high"];
|
|
308
|
+
for (let a = 0; a < o; a++)
|
|
309
|
+
c.push(e.seriesNames?.[a] ?? `series_${a + 1}`);
|
|
310
|
+
const l = [c];
|
|
311
|
+
for (let a = 0; a < Math.max(0, i.length - 1); a++) {
|
|
312
|
+
const m = [i[a], i[a + 1]];
|
|
313
|
+
for (let r = 0; r < o; r++) m.push(s[r]?.[a] ?? 0);
|
|
314
|
+
l.push(m);
|
|
329
315
|
}
|
|
330
|
-
const p = K(
|
|
316
|
+
const p = K(l);
|
|
331
317
|
return Promise.resolve({
|
|
332
318
|
url: p.url,
|
|
333
319
|
filename: `${e.filename}.csv`,
|
|
@@ -336,19 +322,19 @@ function De(e) {
|
|
|
336
322
|
}
|
|
337
323
|
}), t;
|
|
338
324
|
}
|
|
339
|
-
const
|
|
340
|
-
if (!
|
|
341
|
-
const
|
|
342
|
-
return
|
|
325
|
+
const _e = (e) => Array.isArray(e) ? e.map((t) => {
|
|
326
|
+
if (!oe(t)) return t;
|
|
327
|
+
const s = t.reduce((i, o) => i + Math.abs(o), 0);
|
|
328
|
+
return s <= 0 ? t : t.map((i) => i / s * 100);
|
|
343
329
|
}) : e;
|
|
344
|
-
function
|
|
330
|
+
function oe(e) {
|
|
345
331
|
return Array.isArray(e) ? e.every((t) => typeof t == "number" && Number.isFinite(t)) : !1;
|
|
346
332
|
}
|
|
347
333
|
export {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
334
|
+
Ne as HistogramSkeleton,
|
|
335
|
+
Oe as createHistogramDownloadConfig,
|
|
336
|
+
Me as createHistogramOptionFactory,
|
|
351
337
|
X as histogramOptions,
|
|
352
|
-
|
|
338
|
+
_e as toRelativeHistogramData
|
|
353
339
|
};
|
|
354
340
|
//# sourceMappingURL=histogram.js.map
|