@carto/ps-react-ui 4.3.6 → 4.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +123 -123
- package/dist/components.js.map +1 -1
- package/dist/error-CEkRPccv.js +39 -0
- package/dist/error-CEkRPccv.js.map +1 -0
- package/dist/{lasso-tool-BctzdzBu.js → lasso-tool-jl4YK02H.js} +19 -19
- package/dist/lasso-tool-jl4YK02H.js.map +1 -0
- package/dist/no-data-hR3KcJ-_.js +60 -0
- package/dist/no-data-hR3KcJ-_.js.map +1 -0
- package/dist/{row-D3uVFImu.js → row-BKmVAUN5.js} +2 -2
- package/dist/{row-D3uVFImu.js.map → row-BKmVAUN5.js.map} +1 -1
- package/dist/{series-BAImrSBo.js → series-D1pynfeh.js} +3 -3
- package/dist/{series-BAImrSBo.js.map → series-D1pynfeh.js.map} +1 -1
- package/dist/{styles-CCZnY17y.js → styles-DrPyd0y5.js} +28 -22
- package/dist/styles-DrPyd0y5.js.map +1 -0
- package/dist/types/components/lasso-tool/types.d.ts +1 -1
- package/dist/types/widgets/_shared/chart-config/index.d.ts +1 -1
- package/dist/types/widgets/_shared/chart-config/option-builders.d.ts +7 -0
- package/dist/types/widgets/_shared/chart-config/option-builders.test.d.ts +1 -0
- package/dist/types/widgets/actions/change-column/change-column.d.ts +4 -0
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +1 -1
- package/dist/types/widgets/actions/fullscreen/types.d.ts +2 -1
- package/dist/types/widgets/actions/index.d.ts +1 -1
- package/dist/types/widgets/actions/lock-selection/types.d.ts +7 -7
- package/dist/types/widgets/actions/relative-data/types.d.ts +1 -1
- package/dist/types/widgets/echart/types.d.ts +0 -4
- package/dist/types/widgets/echart/utils.d.ts +2 -1
- package/dist/types/widgets/error/error.d.ts +1 -1
- package/dist/types/widgets/error/types.d.ts +8 -0
- package/dist/types/widgets/loader/loader.d.ts +1 -1
- package/dist/types/widgets/loader/types.d.ts +1 -1
- package/dist/types/widgets/stores/types.d.ts +1 -1
- package/dist/{use-widget-ref-B8x4sHIj.js → use-widget-ref-P-2i0MJG.js} +2 -2
- package/dist/{use-widget-ref-B8x4sHIj.js.map → use-widget-ref-P-2i0MJG.js.map} +1 -1
- package/dist/{utils-D3-eQyDR.js → utils-idmvq0Oa.js} +17 -16
- package/dist/utils-idmvq0Oa.js.map +1 -0
- package/dist/{widget-store-Dn0Bnc4h.js → widget-store-CzDt8oSK.js} +31 -46
- package/dist/widget-store-CzDt8oSK.js.map +1 -0
- package/dist/widgets/actions.js +714 -697
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +67 -63
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +250 -241
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js +93 -100
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/error.js +1 -1
- package/dist/widgets/formula.js +64 -72
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +75 -73
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/loader.js +58 -49
- package/dist/widgets/loader.js.map +1 -1
- package/dist/widgets/markdown.js +2 -2
- package/dist/widgets/no-data.js +1 -1
- package/dist/widgets/pie.js +4 -4
- package/dist/widgets/range.js +97 -105
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/scatterplot.js +8 -8
- package/dist/widgets/skeleton-loader.js +1 -1
- package/dist/widgets/spread.js +84 -100
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/stores.js +1 -1
- package/dist/widgets/table.js +493 -485
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +4 -4
- package/dist/widgets/wrapper.js +156 -156
- package/dist/widgets/wrapper.js.map +1 -1
- package/dist/widgets.js +4 -4
- package/package.json +1 -1
- package/src/components/lasso-tool/lasso-tool-inline.tsx +19 -17
- package/src/components/lasso-tool/lasso-tool.tsx +22 -20
- package/src/components/lasso-tool/types.ts +4 -3
- package/src/widgets/_shared/chart-config/index.ts +1 -0
- package/src/widgets/_shared/chart-config/option-builders.test.ts +40 -0
- package/src/widgets/_shared/chart-config/option-builders.ts +12 -0
- package/src/widgets/actions/change-column/change-column.test.tsx +129 -2
- package/src/widgets/actions/change-column/change-column.tsx +79 -2
- package/src/widgets/actions/fullscreen/fullscreen.tsx +8 -8
- package/src/widgets/actions/fullscreen/types.ts +6 -1
- package/src/widgets/actions/index.ts +4 -1
- package/src/widgets/actions/lock-selection/lock-selection.test.tsx +28 -30
- package/src/widgets/actions/lock-selection/types.ts +8 -8
- package/src/widgets/actions/relative-data/relative-data.test.tsx +13 -13
- package/src/widgets/actions/relative-data/types.ts +1 -1
- package/src/widgets/actions/stack-toggle/stack-toggle.test.tsx +19 -9
- package/src/widgets/actions/zoom-toggle/zoom-toggle.tsx +113 -95
- package/src/widgets/bar/config.ts +37 -28
- package/src/widgets/category/category-ui.tsx +25 -22
- package/src/widgets/echart/echart-ui.test.tsx +3 -18
- package/src/widgets/echart/echart-ui.tsx +4 -22
- package/src/widgets/echart/echart.test.tsx +9 -25
- package/src/widgets/echart/echart.tsx +36 -29
- package/src/widgets/echart/types.ts +0 -4
- package/src/widgets/echart/utils.ts +3 -1
- package/src/widgets/error/error.tsx +17 -14
- package/src/widgets/error/types.ts +10 -0
- package/src/widgets/formula/components/value.tsx +13 -13
- package/src/widgets/histogram/config.ts +36 -29
- package/src/widgets/loader/loader.tsx +28 -25
- package/src/widgets/loader/types.ts +3 -1
- package/src/widgets/no-data/no-data.tsx +8 -11
- package/src/widgets/range/components/range-item.tsx +9 -13
- package/src/widgets/spread/components/max-value.tsx +13 -13
- package/src/widgets/spread/components/min-value.tsx +13 -13
- package/src/widgets/stores/types.ts +1 -4
- package/src/widgets/stores/widget-store.ts +1 -27
- package/src/widgets/table/hooks/use-pagination.ts +44 -35
- package/src/widgets/table/hooks/use-sort.ts +25 -23
- package/src/widgets/wrapper/wrapper-ui.tsx +16 -17
- package/dist/error-piB8FwYO.js +0 -38
- package/dist/error-piB8FwYO.js.map +0 -1
- package/dist/lasso-tool-BctzdzBu.js.map +0 -1
- package/dist/no-data-jdlbMef0.js +0 -61
- package/dist/no-data-jdlbMef0.js.map +0 -1
- package/dist/styles-CCZnY17y.js.map +0 -1
- package/dist/utils-D3-eQyDR.js.map +0 -1
- package/dist/widget-store-Dn0Bnc4h.js.map +0 -1
package/dist/widgets/formula.js
CHANGED
|
@@ -1,119 +1,111 @@
|
|
|
1
|
-
import { I
|
|
1
|
+
import { I, S as W, P as D, a as P } from "../series-D1pynfeh.js";
|
|
2
2
|
import { jsx as f, jsxs as k, Fragment as C } from "react/jsx-runtime";
|
|
3
|
-
import { c as
|
|
4
|
-
import { u as
|
|
5
|
-
import { useShallow as
|
|
6
|
-
import { R
|
|
7
|
-
import { Box as
|
|
3
|
+
import { c as w } from "react/compiler-runtime";
|
|
4
|
+
import { u as h } from "../widget-store-CzDt8oSK.js";
|
|
5
|
+
import { useShallow as S } from "zustand/shallow";
|
|
6
|
+
import { R, s as T } from "../row-BKmVAUN5.js";
|
|
7
|
+
import { Box as F, Skeleton as $ } from "@mui/material";
|
|
8
8
|
import "@mui/icons-material";
|
|
9
9
|
import "react";
|
|
10
10
|
import "react-markdown";
|
|
11
|
-
import { d as
|
|
12
|
-
import "../lasso-tool-
|
|
11
|
+
import { d as y, a as v } from "../exports-Cr43OCul.js";
|
|
12
|
+
import "../lasso-tool-jl4YK02H.js";
|
|
13
13
|
import "../cjs-D4KH3azB.js";
|
|
14
14
|
import "@dnd-kit/core";
|
|
15
15
|
import "@dnd-kit/sortable";
|
|
16
16
|
import "@dnd-kit/utilities";
|
|
17
|
-
import { u as
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
const t =
|
|
21
|
-
let
|
|
17
|
+
import { u as b } from "../use-widget-ref-P-2i0MJG.js";
|
|
18
|
+
const j = (e) => e.toString();
|
|
19
|
+
function z(e) {
|
|
20
|
+
const t = w(19);
|
|
21
|
+
let i, o, r;
|
|
22
22
|
t[0] !== e ? ({
|
|
23
|
-
id:
|
|
23
|
+
id: i,
|
|
24
24
|
index: r,
|
|
25
|
-
...
|
|
26
|
-
} = e, t[0] = e, t[1] =
|
|
25
|
+
...o
|
|
26
|
+
} = e, t[0] = e, t[1] = i, t[2] = o, t[3] = r) : (i = t[1], o = t[2], r = t[3]);
|
|
27
27
|
const n = r === void 0 ? 0 : r;
|
|
28
|
-
let
|
|
29
|
-
t[4] !==
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
formatter: g?.formatter
|
|
35
|
-
};
|
|
36
|
-
}, t[4] = o, t[5] = n, t[6] = a) : a = t[6];
|
|
37
|
-
const {
|
|
38
|
-
value: l,
|
|
39
|
-
color: u,
|
|
40
|
-
formatter: h
|
|
41
|
-
} = R(T(a)), c = h === void 0 ? z : h;
|
|
28
|
+
let l;
|
|
29
|
+
t[4] !== i || t[5] !== n ? (l = (m) => m.getWidget(i)?.data?.[n]?.value, t[4] = i, t[5] = n, t[6] = l) : l = t[6];
|
|
30
|
+
const a = h(S(l));
|
|
31
|
+
let u;
|
|
32
|
+
t[7] !== i || t[8] !== n ? (u = (m) => m.getWidget(i)?.data?.[n]?.color, t[7] = i, t[8] = n, t[9] = u) : u = t[9];
|
|
33
|
+
const g = h(S(u)), x = h(S((m) => m.getWidget(i)?.formatter)) ?? j;
|
|
42
34
|
let s;
|
|
43
|
-
t[
|
|
44
|
-
color:
|
|
45
|
-
}, t[
|
|
46
|
-
const
|
|
35
|
+
t[10] !== g ? (s = {
|
|
36
|
+
color: g
|
|
37
|
+
}, t[10] = g, t[11] = s) : s = t[11];
|
|
38
|
+
const p = a ?? 0;
|
|
47
39
|
let d;
|
|
48
|
-
t[
|
|
49
|
-
let
|
|
50
|
-
return t[
|
|
40
|
+
t[12] !== x || t[13] !== p ? (d = x(p), t[12] = x, t[13] = p, t[14] = d) : d = t[14];
|
|
41
|
+
let c;
|
|
42
|
+
return t[15] !== o || t[16] !== s || t[17] !== d ? (c = /* @__PURE__ */ f(I, { TypographyProps: s, ...o, children: d }), t[15] = o, t[16] = s, t[17] = d, t[18] = c) : c = t[18], c;
|
|
51
43
|
}
|
|
52
|
-
function
|
|
44
|
+
function Z({
|
|
53
45
|
refUI: e
|
|
54
46
|
}) {
|
|
55
47
|
return [{
|
|
56
|
-
...
|
|
57
|
-
modifier: () =>
|
|
48
|
+
...y,
|
|
49
|
+
modifier: () => y.modifier(e)
|
|
58
50
|
}, {
|
|
59
51
|
...v,
|
|
60
52
|
modifier: async (t) => {
|
|
61
|
-
const
|
|
62
|
-
return v.modifier(
|
|
53
|
+
const i = [t?.map((o) => o.value) ?? []];
|
|
54
|
+
return v.modifier(i);
|
|
63
55
|
}
|
|
64
56
|
}];
|
|
65
57
|
}
|
|
66
|
-
function
|
|
58
|
+
function tt() {
|
|
67
59
|
return {
|
|
68
60
|
series: []
|
|
69
61
|
};
|
|
70
62
|
}
|
|
71
|
-
function
|
|
72
|
-
const t =
|
|
73
|
-
let
|
|
74
|
-
t[0] !== e.id ? (
|
|
63
|
+
function et(e) {
|
|
64
|
+
const t = w(8), i = b(e.id);
|
|
65
|
+
let o;
|
|
66
|
+
t[0] !== e.id ? (o = (l) => {
|
|
75
67
|
const {
|
|
76
|
-
index:
|
|
77
|
-
} =
|
|
68
|
+
index: a
|
|
69
|
+
} = l;
|
|
78
70
|
return /* @__PURE__ */ k(C, { children: [
|
|
79
|
-
/* @__PURE__ */ f(
|
|
80
|
-
/* @__PURE__ */ f(D, { id: e.id, index:
|
|
81
|
-
/* @__PURE__ */ f(
|
|
82
|
-
/* @__PURE__ */ f(P, { id: e.id, index:
|
|
71
|
+
/* @__PURE__ */ f(W, { id: e.id, index: a }),
|
|
72
|
+
/* @__PURE__ */ f(D, { id: e.id, index: a }),
|
|
73
|
+
/* @__PURE__ */ f(z, { id: e.id, index: a }),
|
|
74
|
+
/* @__PURE__ */ f(P, { id: e.id, index: a })
|
|
83
75
|
] });
|
|
84
|
-
}, t[0] = e.id, t[1] =
|
|
76
|
+
}, t[0] = e.id, t[1] = o) : o = t[1];
|
|
85
77
|
let r;
|
|
86
|
-
t[2] !== e.id || t[3] !==
|
|
78
|
+
t[2] !== e.id || t[3] !== o ? (r = /* @__PURE__ */ f(R, { id: e.id, children: o }), t[2] = e.id, t[3] = o, t[4] = r) : r = t[4];
|
|
87
79
|
let n;
|
|
88
|
-
return t[5] !==
|
|
80
|
+
return t[5] !== i || t[6] !== r ? (n = /* @__PURE__ */ f(F, { ref: i, children: r }), t[5] = i, t[6] = r, t[7] = n) : n = t[7], n;
|
|
89
81
|
}
|
|
90
|
-
function
|
|
91
|
-
const e =
|
|
82
|
+
function it() {
|
|
83
|
+
const e = w(1);
|
|
92
84
|
let t;
|
|
93
|
-
return e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ f(
|
|
85
|
+
return e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ f(F, { sx: T.row, "aria-label": "Formula skeleton", children: /* @__PURE__ */ f($, { width: 120, height: 32 }) }), e[0] = t) : t = e[0], t;
|
|
94
86
|
}
|
|
95
|
-
function
|
|
87
|
+
function V(e) {
|
|
96
88
|
return {
|
|
97
89
|
...e,
|
|
98
90
|
prefix: typeof e.prefix == "string" ? e.prefix : void 0,
|
|
99
91
|
suffix: typeof e.suffix == "string" ? e.suffix : void 0
|
|
100
92
|
};
|
|
101
93
|
}
|
|
102
|
-
function
|
|
103
|
-
return e?.map(
|
|
94
|
+
function ot(e) {
|
|
95
|
+
return e?.map(V);
|
|
104
96
|
}
|
|
105
97
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
it as FormulaSkeleton,
|
|
99
|
+
et as FormulaUI,
|
|
100
|
+
I as Item,
|
|
109
101
|
D as Prefix,
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
R as Row,
|
|
103
|
+
W as Series,
|
|
112
104
|
P as Suffix,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
105
|
+
z as Value,
|
|
106
|
+
tt as formulaConfig,
|
|
107
|
+
Z as formulaDownloadConfig,
|
|
108
|
+
V as sanitizeDataItem,
|
|
109
|
+
ot as sanitizeDataItems
|
|
118
110
|
};
|
|
119
111
|
//# sourceMappingURL=formula.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula.js","sources":["../../src/widgets/formula/components/value.tsx","../../src/widgets/formula/config.ts","../../src/widgets/formula/formula-ui.tsx","../../src/widgets/formula/skeleton.tsx","../../src/widgets/formula/serializer.ts"],"sourcesContent":["import { type FormulaWidgetState, type ValueProps } from '../types'\nimport { useWidgetStore } from '../../stores/widget-store'\nimport { Item } from './item'\nimport { useShallow } from 'zustand/shallow'\n\nconst defaultFormatter = (value: number) => value.toString()\n\nexport function Value({ id, index = 0, ...props }: ValueProps) {\n const
|
|
1
|
+
{"version":3,"file":"formula.js","sources":["../../src/widgets/formula/components/value.tsx","../../src/widgets/formula/config.ts","../../src/widgets/formula/formula-ui.tsx","../../src/widgets/formula/skeleton.tsx","../../src/widgets/formula/serializer.ts"],"sourcesContent":["import { type FormulaWidgetState, type ValueProps } from '../types'\nimport { useWidgetStore } from '../../stores/widget-store'\nimport { Item } from './item'\nimport { useShallow } from 'zustand/shallow'\n\nconst defaultFormatter = (value: number) => value.toString()\n\nexport function Value({ id, index = 0, ...props }: ValueProps) {\n const value = useWidgetStore(\n useShallow(\n (state) => state.getWidget<FormulaWidgetState>(id)?.data?.[index]?.value,\n ),\n )\n const color = useWidgetStore(\n useShallow(\n (state) => state.getWidget<FormulaWidgetState>(id)?.data?.[index]?.color,\n ),\n )\n const formatter =\n useWidgetStore(\n useShallow((state) => state.getWidget<FormulaWidgetState>(id)?.formatter),\n ) ?? defaultFormatter\n\n return (\n <Item TypographyProps={{ color }} {...props}>\n {formatter(value ?? 0)}\n </Item>\n )\n}\n","import { downloadToCSV, downloadToPNG } from '../actions'\nimport type { ConfigProps } from '../loader/types'\nimport type { FormulaDownloadConfig, FormulaWidgetConfig } from './types'\n\nexport function formulaDownloadConfig({\n refUI,\n}: ConfigProps): FormulaDownloadConfig {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const formulaData = [data?.map((item) => item.value) ?? []]\n return downloadToCSV.modifier(formulaData)\n },\n },\n ]\n}\n\nexport function formulaConfig(): FormulaWidgetConfig {\n return {\n series: [],\n }\n}\n","import type { FormulaUIProps } from './types'\nimport { Row } from './components/row'\nimport { Value } from './components/value'\nimport { Prefix } from './components/prefix'\nimport { Suffix } from './components/suffix'\nimport { Series } from './components/series'\nimport { useWidgetRef } from '../../hooks'\nimport { Box } from '@mui/material'\n\nexport function FormulaUI(props: FormulaUIProps) {\n const ref = useWidgetRef(props.id)\n\n return (\n <Box ref={ref}>\n <Row id={props.id}>\n {({ index }) => (\n <>\n <Series id={props.id} index={index} />\n <Prefix id={props.id} index={index} />\n <Value id={props.id} index={index} />\n <Suffix id={props.id} index={index} />\n </>\n )}\n </Row>\n </Box>\n )\n}\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nexport function FormulaSkeleton() {\n return (\n <Box sx={styles.row} aria-label='Formula skeleton'>\n <Skeleton width={120} height={32} />\n </Box>\n )\n}\n","import type { DataItem } from './types'\n\n/**\n * Sanitizes DataItem by converting ReactNode prefix/suffix values to undefined.\n * This ensures only string values are stored in the widget state.\n *\n * @param item - The DataItem to sanitize\n * @returns A new DataItem with ReactNode prefix/suffix values converted to undefined\n */\nexport function sanitizeDataItem(item: DataItem): DataItem {\n return {\n ...item,\n prefix: typeof item.prefix === 'string' ? item.prefix : undefined,\n suffix: typeof item.suffix === 'string' ? item.suffix : undefined,\n }\n}\n\n/**\n * Sanitizes an array of DataItems by converting ReactNode prefix/suffix values to undefined.\n *\n * @param items - Array of DataItems to sanitize\n * @returns A new array with sanitized DataItems\n */\nexport function sanitizeDataItems(\n items: DataItem[] | undefined,\n): DataItem[] | undefined {\n return items?.map(sanitizeDataItem)\n}\n"],"names":["defaultFormatter","value","toString","Value","t0","$","_c","id","props","t1","index","undefined","t2","state","getWidget","data","useWidgetStore","useShallow","t3","state_0","color","formatter","state_1","t4","t5","t6","t7","Item","formulaDownloadConfig","refUI","downloadToPNG","modifier","downloadToCSV","formulaData","map","item","formulaConfig","series","FormulaUI","ref","useWidgetRef","jsxs","Fragment","jsx","Series","Prefix","Suffix","Row","Box","FormulaSkeleton","Symbol","for","styles","row","Skeleton","sanitizeDataItem","prefix","suffix","sanitizeDataItems","items"],"mappings":";;;;;;;;;;;;;;;;;AAKA,MAAMA,IAAmBA,CAACC,MAAkBA,EAAMC,SAAAA;AAE3C,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA;AAAA,MAAAC,GAAAC,GAAAC;AAAA,EAAAJ,SAAAD,KAAe;AAAA,IAAAG,IAAAA;AAAAA,IAAAG,OAAAD;AAAAA,IAAA,GAAAD;AAAAA,EAAAA,IAAAJ,GAAuCC,OAAAD,GAAAC,OAAAE,GAAAF,OAAAG,GAAAH,OAAAI,MAAAF,IAAAF,EAAA,CAAA,GAAAG,IAAAH,EAAA,CAAA,GAAAI,IAAAJ,EAAA,CAAA;AAAjC,QAAAK,IAAAD,MAAAE,SAAA,IAAAF;AAAS,MAAAG;AAAA,EAAAP,EAAA,CAAA,MAAAE,KAAAF,SAAAK,KAG/BE,IAAAC,OAAWA,EAAKC,UAA+BP,CAAQ,GAACQ,OAAGL,CAAK,GAAQT,OAAAI,OAAAE,GAAAF,OAAAK,GAAAL,OAAAO,KAAAA,IAAAP,EAAA,CAAA;AAF5E,QAAAJ,IAAce,EACZC,EACEL,CACF,CACF;AAAC,MAAAM;AAAA,EAAAb,EAAA,CAAA,MAAAE,KAAAF,SAAAK,KAGGQ,IAAAC,OAAWN,EAAKC,UA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A,CAAA,MAAA6C,uBAAAC,IAAA,2BAAA,KAEH/C,IAAA,gBAAAuC,EAACK,GAAA,EAAQ,IAAAI,EAAMC,KAAiB,cAAA,oBAC9B,UAAA,gBAAAV,EAACW,GAAA,EAAgB,OAAA,KAAa,QAAA,IAAE,GAClC,GAAMjD,OAAAD,KAAAA,IAAAC,EAAA,CAAA,GAFND;AAEM;ACEH,SAASmD,EAAiBpB,GAA0B;AACzD,SAAO;AAAA,IACL,GAAGA;AAAAA,IACHqB,QAAQ,OAAOrB,EAAKqB,UAAW,WAAWrB,EAAKqB,SAAS7C;AAAAA,IACxD8C,QAAQ,OAAOtB,EAAKsB,UAAW,WAAWtB,EAAKsB,SAAS9C;AAAAA,EAAAA;AAE5D;AAQO,SAAS+C,GACdC,GACwB;AACxB,SAAOA,GAAOzB,IAAIqB,CAAgB;AACpC;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { c as x } from "react/compiler-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "echarts";
|
|
5
|
-
import "../widget-store-
|
|
5
|
+
import "../widget-store-CzDt8oSK.js";
|
|
6
6
|
import "zustand/shallow";
|
|
7
7
|
import { g as b } from "../options-D9wflre6.js";
|
|
8
|
-
import { m as w } from "../utils-
|
|
9
|
-
import { f as _, c as
|
|
10
|
-
import { Box as
|
|
8
|
+
import { m as w } from "../utils-idmvq0Oa.js";
|
|
9
|
+
import { f as _, c as S, a as k, n as L, b as C, d as v, e as I } from "../styles-DrPyd0y5.js";
|
|
10
|
+
import { Box as p, Skeleton as f } from "@mui/material";
|
|
11
11
|
import "@mui/icons-material";
|
|
12
12
|
import "react-markdown";
|
|
13
|
-
import { d as
|
|
14
|
-
import "../lasso-tool-
|
|
13
|
+
import { d as c, a as m } from "../exports-Cr43OCul.js";
|
|
14
|
+
import "../lasso-tool-jl4YK02H.js";
|
|
15
15
|
import "../cjs-D4KH3azB.js";
|
|
16
16
|
import "@dnd-kit/core";
|
|
17
17
|
import "@dnd-kit/sortable";
|
|
@@ -20,57 +20,32 @@ function ee({
|
|
|
20
20
|
refUI: t
|
|
21
21
|
}) {
|
|
22
22
|
return [{
|
|
23
|
-
...p,
|
|
24
|
-
modifier: () => p.modifier(t)
|
|
25
|
-
}, {
|
|
26
23
|
...c,
|
|
24
|
+
modifier: () => c.modifier(t)
|
|
25
|
+
}, {
|
|
26
|
+
...m,
|
|
27
27
|
modifier: async (e) => {
|
|
28
|
-
const
|
|
29
|
-
return
|
|
28
|
+
const n = _(e);
|
|
29
|
+
return m.modifier(n);
|
|
30
30
|
}
|
|
31
31
|
}];
|
|
32
32
|
}
|
|
33
33
|
function te(t) {
|
|
34
34
|
return {
|
|
35
35
|
type: "histogram",
|
|
36
|
-
option: w(b(t),
|
|
36
|
+
option: w(b(t), N(t))
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function N({
|
|
40
40
|
data: t = [],
|
|
41
41
|
theme: e,
|
|
42
|
-
formatter:
|
|
42
|
+
formatter: n
|
|
43
43
|
}) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
showMaxLabel: !0,
|
|
47
|
-
showMinLabel: !0,
|
|
48
|
-
splitNumber: 1,
|
|
49
|
-
axisLabel: {
|
|
50
|
-
fontSize: e.typography.overlineDelicate.fontSize,
|
|
51
|
-
fontFamily: e.typography.overlineDelicate.fontFamily,
|
|
52
|
-
margin: parseInt(e.spacing(1)),
|
|
53
|
-
show: !0,
|
|
54
|
-
showMaxLabel: !0,
|
|
55
|
-
showMinLabel: !0,
|
|
56
|
-
verticalAlign: "bottom"
|
|
57
|
-
},
|
|
58
|
-
axisLine: {
|
|
59
|
-
show: !1
|
|
60
|
-
},
|
|
61
|
-
axisTick: {
|
|
62
|
-
show: !1
|
|
63
|
-
},
|
|
64
|
-
splitLine: {
|
|
65
|
-
show: !0,
|
|
66
|
-
lineStyle: {
|
|
67
|
-
color: e.palette.black[4]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
44
|
+
const i = (t?.length ?? 0) > 1;
|
|
45
|
+
let a = 1;
|
|
71
46
|
return {
|
|
72
|
-
legend:
|
|
73
|
-
grid:
|
|
47
|
+
legend: v(i),
|
|
48
|
+
grid: C(i, e),
|
|
74
49
|
xAxis: {
|
|
75
50
|
type: "category",
|
|
76
51
|
axisLine: {
|
|
@@ -96,21 +71,48 @@ function I({
|
|
|
96
71
|
}
|
|
97
72
|
}
|
|
98
73
|
},
|
|
99
|
-
yAxis:
|
|
74
|
+
yAxis: {
|
|
75
|
+
type: "value",
|
|
76
|
+
min: 0,
|
|
77
|
+
max: (o) => (a = o.max <= 0 ? 1 : L(o.max), a),
|
|
78
|
+
splitNumber: 1,
|
|
79
|
+
axisLabel: {
|
|
80
|
+
fontSize: e.typography.overlineDelicate.fontSize,
|
|
81
|
+
fontFamily: e.typography.overlineDelicate.fontFamily,
|
|
82
|
+
margin: parseInt(e.spacing(1)),
|
|
83
|
+
show: !0,
|
|
84
|
+
showMaxLabel: !0,
|
|
85
|
+
showMinLabel: !0,
|
|
86
|
+
verticalAlign: "bottom",
|
|
87
|
+
formatter: (o) => o !== a ? "" : n ? n(o) : String(o)
|
|
88
|
+
},
|
|
89
|
+
axisLine: {
|
|
90
|
+
show: !1
|
|
91
|
+
},
|
|
92
|
+
axisTick: {
|
|
93
|
+
show: !1
|
|
94
|
+
},
|
|
95
|
+
splitLine: {
|
|
96
|
+
show: !0,
|
|
97
|
+
lineStyle: {
|
|
98
|
+
color: e.palette.black[4]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
100
102
|
tooltip: {
|
|
101
|
-
position:
|
|
102
|
-
formatter:
|
|
103
|
-
const
|
|
103
|
+
position: k(e),
|
|
104
|
+
formatter: S((o) => {
|
|
105
|
+
const s = o.value, g = o.dimensionNames?.[o.encode?.y?.at(0) ?? 1], l = s[g ?? ""], u = typeof l == "number" && n ? n(l) : l ?? "", d = typeof o.marker == "string" ? o.marker : "", y = o.seriesName ? `${o.seriesName}: ` : "";
|
|
104
106
|
return {
|
|
105
|
-
name:
|
|
106
|
-
seriesName:
|
|
107
|
-
marker:
|
|
107
|
+
name: o.name ?? "",
|
|
108
|
+
seriesName: y,
|
|
109
|
+
marker: d,
|
|
108
110
|
value: u
|
|
109
111
|
};
|
|
110
112
|
})
|
|
111
113
|
},
|
|
112
|
-
series: t.map((
|
|
113
|
-
datasetIndex:
|
|
114
|
+
series: t.map((o, s) => ({
|
|
115
|
+
datasetIndex: s,
|
|
114
116
|
type: "bar",
|
|
115
117
|
barGap: "1%",
|
|
116
118
|
// No gap between bars in histogram
|
|
@@ -124,55 +126,55 @@ function I({
|
|
|
124
126
|
}
|
|
125
127
|
const T = {
|
|
126
128
|
skeleton: {
|
|
127
|
-
graph:
|
|
129
|
+
graph: I.graph
|
|
128
130
|
}
|
|
129
131
|
};
|
|
130
132
|
function oe() {
|
|
131
133
|
const t = x(2);
|
|
132
134
|
let e;
|
|
133
|
-
t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */
|
|
135
|
+
t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ r(p, { sx: {
|
|
134
136
|
display: "flex",
|
|
135
137
|
alignItems: "flex-end",
|
|
136
138
|
justifyContent: "space-between",
|
|
137
|
-
gap:
|
|
138
|
-
height:
|
|
139
|
+
gap: M,
|
|
140
|
+
height: F,
|
|
139
141
|
width: "100%"
|
|
140
|
-
}, children: Array(8).fill(0).map(
|
|
141
|
-
let
|
|
142
|
-
return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
142
|
+
}, children: Array(8).fill(0).map(D) }), t[0] = e) : e = t[0];
|
|
143
|
+
let n;
|
|
144
|
+
return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ h(p, { sx: T.skeleton.graph.container, children: [
|
|
143
145
|
e,
|
|
144
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(p, { sx: {
|
|
145
147
|
display: "flex",
|
|
146
148
|
alignItems: "center",
|
|
147
149
|
justifyContent: "space-between",
|
|
148
150
|
width: "100%",
|
|
149
|
-
mt:
|
|
150
|
-
}, children: Array(4).fill(0).map(
|
|
151
|
-
] }), t[1] =
|
|
151
|
+
mt: j
|
|
152
|
+
}, children: Array(4).fill(0).map(A) })
|
|
153
|
+
] }), t[1] = n) : n = t[1], n;
|
|
152
154
|
}
|
|
153
|
-
function
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
+
function A(t, e) {
|
|
156
|
+
return /* @__PURE__ */ r(f, { width: 32, height: 8 }, e);
|
|
155
157
|
}
|
|
156
|
-
function
|
|
158
|
+
function j(t) {
|
|
157
159
|
const {
|
|
158
160
|
spacing: e
|
|
159
161
|
} = t;
|
|
160
162
|
return e(1);
|
|
161
163
|
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
164
|
-
return /* @__PURE__ */
|
|
164
|
+
function D(t, e) {
|
|
165
|
+
const i = `${[60, 80, 95, 85, 70, 55, 40, 30][e]}%`;
|
|
166
|
+
return /* @__PURE__ */ r(f, { variant: "rectangular", sx: {
|
|
165
167
|
flex: 1,
|
|
166
|
-
height:
|
|
168
|
+
height: i
|
|
167
169
|
} }, e);
|
|
168
170
|
}
|
|
169
|
-
function
|
|
171
|
+
function F(t) {
|
|
170
172
|
const {
|
|
171
173
|
spacing: e
|
|
172
174
|
} = t;
|
|
173
175
|
return e(30);
|
|
174
176
|
}
|
|
175
|
-
function
|
|
177
|
+
function M(t) {
|
|
176
178
|
const {
|
|
177
179
|
spacing: e
|
|
178
180
|
} = t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"histogram.js","sources":["../../src/widgets/histogram/config.ts","../../src/widgets/histogram/style.ts","../../src/widgets/histogram/skeleton.tsx"],"sourcesContent":["import {\n getCommonOptions,\n mergeEchartWidgetConfig,\n type EchartOptionsProps,\n} from '../echart'\nimport type {\n HistogramConfig,\n HistogramWidgetConfig,\n HistogramWidgetData,\n} from './types'\nimport {\n flattenObjectArrayToCSV,\n buildLegendConfig,\n buildGridConfig,\n createTooltipPositioner,\n createTooltipFormatter,\n applyYAxisFormatter,\n} from '../_shared/chart-config'\nimport { downloadToCSV, downloadToPNG, type DownloadItem } from '../actions'\nimport type { ConfigProps } from '../loader/types'\n\nexport function histogramDownloadConfig({\n refUI,\n}: ConfigProps): DownloadItem<HistogramWidgetData>[] {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const rows = flattenObjectArrayToCSV(data)\n return downloadToCSV.modifier(rows)\n },\n },\n ]\n}\nexport function histogramConfig(props: HistogramConfig): HistogramWidgetConfig {\n return {\n type: 'histogram',\n option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),\n }\n}\nfunction getOption({\n data = [],\n theme,\n formatter,\n}: HistogramConfig): EchartOptionsProps {\n const hasLegend = (data?.length ?? 0) > 1\n\n const yAxis = {\n type: 'value' as const,\n showMaxLabel: true,\n showMinLabel: true,\n splitNumber: 1,\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom' as const,\n },\n axisLine: {\n show: false,\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n }\n\n return {\n legend: buildLegendConfig(hasLegend),\n grid: buildGridConfig(hasLegend, theme),\n xAxis: {\n type: 'category',\n axisLine: {\n show: false,\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n showMinLabel: true,\n showMaxLabel: true,\n hideOverlap: true,\n margin: 0,\n padding: [\n parseInt(theme.spacing(0.5)),\n parseInt(theme.spacing(0.5)),\n 0,\n parseInt(theme.spacing(0.5)),\n ],\n color: theme.palette.black[60],\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n yAxis: applyYAxisFormatter(yAxis, formatter),\n tooltip: {\n position: createTooltipPositioner(theme),\n formatter: createTooltipFormatter((item) => {\n const value = item.value as Record<string, string | number>\n const index = item.dimensionNames?.[item.encode?.y?.at(0) ?? 1]\n const _value = value[index ?? '']\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : (_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = item.name ?? ''\n\n return { name, seriesName, marker, value: formattedValue }\n }),\n },\n series: data.map((_: unknown, index: number) => ({\n datasetIndex: index,\n type: 'bar',\n barGap: '1%', // No gap between bars in histogram\n barCategoryGap: '1%', // No gap between categories in histogram\n emphasis: {\n focus: 'series',\n },\n })),\n } as EchartOptionsProps\n}\n","import type { SxProps, Theme } from '@mui/material'\nimport { baseSkeletonStyles } from '../_shared/skeleton'\n\nexport const styles = {\n skeleton: {\n graph: baseSkeletonStyles.graph,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nexport function HistogramSkeleton() {\n return (\n <Box sx={styles.skeleton.graph.container}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'flex-end',\n justifyContent: 'space-between',\n gap: ({ spacing }) => spacing(0.5),\n height: ({ spacing }) => spacing(30),\n width: '100%',\n }}\n >\n {Array(8)\n .fill(0)\n .map((_, i) => {\n // Create varying heights for histogram bars\n const heights = [60, 80, 95, 85, 70, 55, 40, 30]\n const height = `${heights[i]}%`\n return (\n <Skeleton\n key={i}\n variant='rectangular'\n sx={{\n flex: 1,\n height,\n }}\n />\n )\n })}\n </Box>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n mt: ({ spacing }) => spacing(1),\n }}\n >\n {Array(4)\n .fill(0)\n .map((_, i) => (\n <Skeleton key={i} width={32} height={8} />\n ))}\n </Box>\n </Box>\n )\n}\n"],"names":["histogramDownloadConfig","refUI","downloadToPNG","modifier","downloadToCSV","data","rows","flattenObjectArrayToCSV","histogramConfig","props","type","option","mergeEchartWidgetConfig","getCommonOptions","getOption","theme","formatter","hasLegend","length","yAxis","showMaxLabel","showMinLabel","splitNumber","axisLabel","fontSize","typography","overlineDelicate","fontFamily","margin","parseInt","spacing","show","verticalAlign","axisLine","axisTick","splitLine","lineStyle","color","palette","black","legend","buildLegendConfig","grid","buildGridConfig","xAxis","hideOverlap","padding","applyYAxisFormatter","tooltip","position","createTooltipPositioner","createTooltipFormatter","item","value","index","dimensionNames","encode","y","at","_value","formattedValue","marker","seriesName","name","series","map","_","datasetIndex","barGap","barCategoryGap","emphasis","focus","styles","skeleton","graph","baseSkeletonStyles","HistogramSkeleton","$","_c","t0","Symbol","for","jsx","Box","display","alignItems","justifyContent","gap","_temp","height","_temp2","width","Array","fill","_temp3","t1","container","mt","_temp4","_temp5","__0","i_0","Skeleton","spacing_1","i","flex","spacing_0"],"mappings":";;;;;;;;;;;;;;;;;;AAqBO,SAASA,GAAwB;AAAA,EACtCC,OAAAA;AACW,GAAwC;AACnD,SAAO,CACL;AAAA,IACE,GAAGC;AAAAA,IACHC,UAAUA,MAAMD,EAAcC,SAASF,CAAK;AAAA,EAAA,GAE9C;AAAA,IACE,GAAGG;AAAAA,IACHD,UAAU,OAAOE,MAAS;AACxB,YAAMC,IAAOC,EAAwBF,CAAI;AACzC,aAAOD,EAAcD,SAASG,CAAI;AAAA,IACpC;AAAA,EAAA,CACD;AAEL;AACO,SAASE,GAAgBC,GAA+C;AAC7E,SAAO;AAAA,IACLC,MAAM;AAAA,IACNC,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E,EACrBe,CAAC,CAAC;AAAG,SAE7B,gBAAAtB,EAACoB,GAAA,EAES,SAAA,eACJ,IAAA;AAAA,IAAAG,MACI;AAAA,IAAChB,QAAAA;AAAAA,EAAAA,KAHJe,CAKJ;AACD;AA3BT,SAAAd,EAAAX,GAAA;AASY,QAAA;AAAA,IAAAjD,SAAA4E;AAAAA,EAAAA,IAAA3B;AAAW,SAAKjD,EAAQ,EAAE;AAAC;AATvC,SAAA0D,EAAAT,GAAA;AAQS,QAAA;AAAA,IAAAjD,SAAAA;AAAAA,EAAAA,IAAAiD;AAAW,SAAKjD,EAAQ,GAAG;AAAC;"}
|
|
1
|
+
{"version":3,"file":"histogram.js","sources":["../../src/widgets/histogram/config.ts","../../src/widgets/histogram/style.ts","../../src/widgets/histogram/skeleton.tsx"],"sourcesContent":["import {\n getCommonOptions,\n mergeEchartWidgetConfig,\n type EchartOptionsProps,\n} from '../echart'\nimport type {\n HistogramConfig,\n HistogramWidgetConfig,\n HistogramWidgetData,\n} from './types'\nimport {\n flattenObjectArrayToCSV,\n buildLegendConfig,\n buildGridConfig,\n createTooltipPositioner,\n createTooltipFormatter,\n niceNum,\n} from '../_shared/chart-config'\nimport { downloadToCSV, downloadToPNG, type DownloadItem } from '../actions'\nimport type { ConfigProps } from '../loader/types'\n\nexport function histogramDownloadConfig({\n refUI,\n}: ConfigProps): DownloadItem<HistogramWidgetData>[] {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const rows = flattenObjectArrayToCSV(data)\n return downloadToCSV.modifier(rows)\n },\n },\n ]\n}\nexport function histogramConfig(props: HistogramConfig): HistogramWidgetConfig {\n return {\n type: 'histogram',\n option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),\n }\n}\nfunction getOption({\n data = [],\n theme,\n formatter,\n}: HistogramConfig): EchartOptionsProps {\n const hasLegend = (data?.length ?? 0) > 1\n\n let niceMax = 1\n\n return {\n legend: buildLegendConfig(hasLegend),\n grid: buildGridConfig(hasLegend, theme),\n xAxis: {\n type: 'category',\n axisLine: {\n show: false,\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n showMinLabel: true,\n showMaxLabel: true,\n hideOverlap: true,\n margin: 0,\n padding: [\n parseInt(theme.spacing(0.5)),\n parseInt(theme.spacing(0.5)),\n 0,\n parseInt(theme.spacing(0.5)),\n ],\n color: theme.palette.black[60],\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n yAxis: {\n type: 'value' as const,\n min: 0,\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n splitNumber: 1,\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom' as const,\n formatter: (value: number) => {\n if (value !== niceMax) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n axisLine: {\n show: false,\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n tooltip: {\n position: createTooltipPositioner(theme),\n formatter: createTooltipFormatter((item) => {\n const value = item.value as Record<string, string | number>\n const index = item.dimensionNames?.[item.encode?.y?.at(0) ?? 1]\n const _value = value[index ?? '']\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : (_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = item.name ?? ''\n\n return { name, seriesName, marker, value: formattedValue }\n }),\n },\n series: data.map((_: unknown, index: number) => ({\n datasetIndex: index,\n type: 'bar',\n barGap: '1%', // No gap between bars in histogram\n barCategoryGap: '1%', // No gap between categories in histogram\n emphasis: {\n focus: 'series',\n },\n })),\n } as EchartOptionsProps\n}\n","import type { SxProps, Theme } from '@mui/material'\nimport { baseSkeletonStyles } from '../_shared/skeleton'\n\nexport const styles = {\n skeleton: {\n graph: baseSkeletonStyles.graph,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nexport function HistogramSkeleton() {\n return (\n <Box sx={styles.skeleton.graph.container}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'flex-end',\n justifyContent: 'space-between',\n gap: ({ spacing }) => spacing(0.5),\n height: ({ spacing }) => spacing(30),\n width: '100%',\n }}\n >\n {Array(8)\n .fill(0)\n .map((_, i) => {\n // Create varying heights for histogram bars\n const heights = [60, 80, 95, 85, 70, 55, 40, 30]\n const height = `${heights[i]}%`\n return (\n <Skeleton\n key={i}\n variant='rectangular'\n sx={{\n flex: 1,\n height,\n }}\n />\n )\n })}\n </Box>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n mt: ({ spacing }) => spacing(1),\n }}\n >\n {Array(4)\n .fill(0)\n .map((_, i) => (\n <Skeleton key={i} width={32} height={8} />\n ))}\n </Box>\n </Box>\n )\n}\n"],"names":["histogramDownloadConfig","refUI","downloadToPNG","modifier","downloadToCSV","data","rows","flattenObjectArrayToCSV","histogramConfig","props","type","option","mergeEchartWidgetConfig","getCommonOptions","getOption","theme","formatter","hasLegend","length","niceMax","legend","buildLegendConfig","grid","buildGridConfig","xAxis","axisLine","show","axisLabel","fontSize","typography","overlineDelicate","fontFamily","showMinLabel","showMaxLabel","hideOverlap","margin","padding","parseInt","spacing","color","palette","black","axisTick","splitLine","lineStyle","yAxis","min","max","extent","niceNum","splitNumber","verticalAlign","value","String","tooltip","position","createTooltipPositioner","createTooltipFormatter","item","index","dimensionNames","encode","y","at","_value","formattedValue","marker","seriesName","name","series","map","_","datasetIndex","barGap","barCategoryGap","emphasis","focus","styles","skeleton","graph","baseSkeletonStyles","HistogramSkeleton","$","_c","t0","Symbol","for","jsx","Box","display","alignItems","justifyContent","gap","_temp","height","_temp2","width","Array","fill","_temp3","t1","container","mt","_temp4","_temp5","__0","i_0","Skeleton","spacing_1","i","flex","spacing_0"],"mappings":";;;;;;;;;;;;;;;;;;AAqBO,SAASA,GAAwB;AAAA,EACtCC,OAAAA;AACW,GAAwC;AACnD,SAAO,CACL;AAAA,IACE,GAAGC;AAAAA,IACHC,UAAUA,MAAMD,EAAcC,SAASF,CAAK;AAAA,EAAA,GAE9C;AAAA,IACE,GAAGG;AAAAA,IACHD,UAAU,OAAOE,MAAS;AACxB,YAAMC,IAAOC,EAAwBF,CAAI;AACzC,aAAOD,EAAcD,SAASG,CAAI;AAAA,IACpC;AAAA,EAAA,CACD;AAEL;AACO,SAASE,GAAgBC,GAA+C;AAC7E,SAAO;AAAA,IACLC,MAAM;AAAA,IACNC,QAAQC,EAAwBC,EAAiBJ,CAAK,GAAGK,EAAUL,CAAK,CAAC;AAAA,EAAA;AAE7E;AACA,SAASK,EAAU;AAAA,EACjBT,MAAAA,IAAO,CAAA;AAAA,EACPU,OAAAA;AAAAA,EACAC,WAAAA;AACe,GAAuB;AACtC,QAAMC,KAAaZ,GAAMa,UAAU,KAAK;AAExC,MAAIC,IAAU;AAEd,SAAO;AAAA,IACLC,QAAQC,EAAkBJ,CAAS;AAAA,IACnCK,MAAMC,EAAgBN,GAAWF,CAAK;AAAA,IACtCS,OAAO;AAAA,MACLd,MAAM;AAAA,MACNe,UAAU;AAAA,QACRC,MAAM;AAAA,MAAA;AAAA,MAERC,WAAW;AAAA,QACTC,UAAUb,EAAMc,WAAWC,iBAAiBF;AAAAA,QAC5CG,YAAYhB,EAAMc,WAAWC,iBAAiBC;AAAAA,QAC9CC,cAAc;AAAA,QACdC,cAAc;AAAA,QACdC,aAAa;AAAA,QACbC,QAAQ;AAAA,QACRC,SAAS,CACPC,SAAStB,EAAMuB,QA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