@carto/ps-react-ui 4.2.7 → 4.3.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/cjs-D4KH3azB.js +85 -0
- package/dist/cjs-D4KH3azB.js.map +1 -0
- package/dist/components.js +770 -1415
- package/dist/components.js.map +1 -1
- package/dist/error-B2IJ9d2h.js +38 -0
- package/dist/error-B2IJ9d2h.js.map +1 -0
- package/dist/exports-Cr43OCul.js +51 -0
- package/dist/exports-Cr43OCul.js.map +1 -0
- package/dist/lasso-tool-BwRzEW7k.js +534 -0
- package/dist/lasso-tool-BwRzEW7k.js.map +1 -0
- package/dist/no-data-C54XJt13.js +61 -0
- package/dist/no-data-C54XJt13.js.map +1 -0
- package/dist/note-t51drNe0.js +124 -0
- package/dist/note-t51drNe0.js.map +1 -0
- package/dist/options-D9wflre6.js +49 -0
- package/dist/options-D9wflre6.js.map +1 -0
- package/dist/row-DrHwXNvF.js +35 -0
- package/dist/row-DrHwXNvF.js.map +1 -0
- package/dist/series-D3Pc-kYX.js +91 -0
- package/dist/series-D3Pc-kYX.js.map +1 -0
- package/dist/smart-tooltip-BEtBaIdz.js +39 -0
- package/dist/smart-tooltip-BEtBaIdz.js.map +1 -0
- package/dist/styles-CCZnY17y.js +117 -0
- package/dist/styles-CCZnY17y.js.map +1 -0
- package/dist/tooltip-BDnrRKrp.js +25 -0
- package/dist/tooltip-BDnrRKrp.js.map +1 -0
- package/dist/types/components/measurement-tools/styles.d.ts +13 -4
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/use-debounce.d.ts +19 -0
- package/dist/types/hooks/use-widget-ref.d.ts +17 -0
- package/dist/types/widgets/_shared/chart-config/config-factory.d.ts +38 -0
- package/dist/types/widgets/_shared/chart-config/csv-modifiers.d.ts +19 -0
- package/dist/types/widgets/_shared/chart-config/index.d.ts +7 -0
- package/dist/types/widgets/_shared/chart-config/option-builders.d.ts +85 -0
- package/dist/types/widgets/_shared/skeleton/index.d.ts +4 -0
- package/dist/types/widgets/_shared/skeleton/styles.d.ts +19 -0
- package/dist/types/widgets/actions/change-column/change-column-icon.d.ts +1 -0
- package/dist/types/widgets/actions/change-column/change-column.d.ts +16 -0
- package/dist/types/widgets/actions/change-column/sortable-column-item.d.ts +9 -0
- package/dist/types/widgets/actions/change-column/types.d.ts +19 -0
- package/dist/types/widgets/actions/download/download.d.ts +2 -0
- package/dist/types/widgets/actions/download/exports.d.ts +6 -0
- package/dist/types/widgets/actions/download/types.d.ts +21 -0
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +2 -0
- package/dist/types/widgets/actions/fullscreen/styles.d.ts +16 -0
- package/dist/types/widgets/actions/fullscreen/types.d.ts +20 -0
- package/dist/types/widgets/actions/index.d.ts +18 -0
- package/dist/types/widgets/actions/lock-selection/lock-selection.d.ts +19 -0
- package/dist/types/widgets/actions/lock-selection/types.d.ts +36 -0
- package/dist/types/widgets/actions/relative-data/relative-data.d.ts +18 -0
- package/dist/types/widgets/actions/relative-data/style.d.ts +8 -0
- package/dist/types/widgets/actions/relative-data/types.d.ts +27 -0
- package/dist/types/widgets/actions/relative-data/utils.d.ts +9 -0
- package/dist/types/widgets/actions/relative-data/utils.test.d.ts +1 -0
- package/dist/types/widgets/actions/searcher/searcher-toggle.d.ts +18 -0
- package/dist/types/widgets/actions/searcher/searcher.d.ts +21 -0
- package/dist/types/widgets/actions/searcher/types.d.ts +64 -0
- package/dist/types/widgets/actions/shared/styles.d.ts +11 -0
- package/dist/types/widgets/actions/stack-toggle/grouped-bar-chart-icon.d.ts +1 -0
- package/dist/types/widgets/actions/stack-toggle/stack-toggle.d.ts +16 -0
- package/dist/types/widgets/actions/stack-toggle/types.d.ts +25 -0
- package/dist/types/widgets/actions/zoom-toggle/index.d.ts +2 -0
- package/dist/types/widgets/actions/zoom-toggle/style.d.ts +13 -0
- package/dist/types/widgets/actions/zoom-toggle/types.d.ts +41 -0
- package/dist/types/widgets/actions/zoom-toggle/zoom-toggle.d.ts +18 -0
- package/dist/types/widgets/bar/config.d.ts +5 -0
- package/dist/types/widgets/bar/index.d.ts +3 -0
- package/dist/types/widgets/bar/skeleton.d.ts +1 -0
- package/dist/types/widgets/bar/style.d.ts +37 -0
- package/dist/types/widgets/bar/types.d.ts +9 -0
- package/dist/types/widgets/category/category-ui.d.ts +2 -0
- package/dist/types/widgets/category/components/category-bar.d.ts +7 -0
- package/dist/types/widgets/category/components/category-legend.d.ts +6 -0
- package/dist/types/widgets/category/components/category-row-multi.d.ts +11 -0
- package/dist/types/widgets/category/components/category-row-other.d.ts +6 -0
- package/dist/types/widgets/category/components/category-row-single.d.ts +11 -0
- package/dist/types/widgets/category/components/index.d.ts +10 -0
- package/dist/types/widgets/category/config.d.ts +16 -0
- package/dist/types/widgets/category/index.d.ts +6 -0
- package/dist/types/widgets/category/skeleton.d.ts +1 -0
- package/dist/types/widgets/category/style.d.ts +120 -0
- package/dist/types/widgets/category/types.d.ts +34 -0
- package/dist/types/widgets/echart/const.d.ts +1 -0
- package/dist/types/widgets/echart/echart-ui.d.ts +2 -0
- package/dist/types/widgets/echart/echart.d.ts +2 -0
- package/dist/types/widgets/echart/index.d.ts +5 -0
- package/dist/types/widgets/echart/options.d.ts +2 -0
- package/dist/types/widgets/echart/types.d.ts +34 -0
- package/dist/types/widgets/echart/utils.d.ts +80 -0
- package/dist/types/widgets/error/error.d.ts +2 -0
- package/dist/types/widgets/error/index.d.ts +2 -0
- package/dist/types/widgets/error/types.d.ts +12 -0
- package/dist/types/widgets/formula/components/item.d.ts +2 -0
- package/dist/types/widgets/formula/components/prefix.d.ts +2 -0
- package/dist/types/widgets/formula/components/row.d.ts +2 -0
- package/dist/types/widgets/formula/components/series.d.ts +2 -0
- package/dist/types/widgets/formula/components/suffix.d.ts +2 -0
- package/dist/types/widgets/formula/components/value.d.ts +2 -0
- package/dist/types/widgets/formula/config.d.ts +4 -0
- package/dist/types/widgets/formula/formula-ui.d.ts +2 -0
- package/dist/types/widgets/formula/index.d.ts +11 -0
- package/dist/types/widgets/formula/serializer.d.ts +16 -0
- package/dist/types/widgets/formula/skeleton.d.ts +1 -0
- package/dist/types/widgets/formula/style.d.ts +21 -0
- package/dist/types/widgets/formula/types.d.ts +42 -0
- package/dist/types/widgets/histogram/config.d.ts +5 -0
- package/dist/types/widgets/histogram/index.d.ts +3 -0
- package/dist/types/widgets/histogram/skeleton.d.ts +1 -0
- package/dist/types/widgets/histogram/style.d.ts +15 -0
- package/dist/types/widgets/histogram/types.d.ts +9 -0
- package/dist/types/widgets/index.d.ts +9 -1
- package/dist/types/widgets/loader/index.d.ts +3 -0
- package/dist/types/widgets/loader/loader.d.ts +2 -0
- package/dist/types/widgets/loader/types.d.ts +9 -0
- package/dist/types/widgets/loader/utils.d.ts +1 -0
- package/dist/types/widgets/markdown/config.d.ts +4 -0
- package/dist/types/widgets/markdown/index.d.ts +5 -0
- package/dist/types/widgets/markdown/markdown-ui.d.ts +2 -0
- package/dist/types/widgets/markdown/markdown.d.ts +2 -0
- package/dist/types/widgets/markdown/skeleton.d.ts +1 -0
- package/dist/types/widgets/markdown/style.d.ts +2 -0
- package/dist/types/widgets/markdown/types.d.ts +18 -0
- package/dist/types/widgets/no-data/index.d.ts +2 -0
- package/dist/types/widgets/no-data/no-data.d.ts +35 -0
- package/dist/types/widgets/no-data/style.d.ts +6 -0
- package/dist/types/widgets/no-data/types.d.ts +67 -0
- package/dist/types/widgets/note/index.d.ts +2 -0
- package/dist/types/widgets/note/note.d.ts +2 -0
- package/dist/types/widgets/note/style.d.ts +28 -0
- package/dist/types/widgets/note/types.d.ts +8 -0
- package/dist/types/widgets/pie/config.d.ts +5 -0
- package/dist/types/widgets/pie/index.d.ts +3 -0
- package/dist/types/widgets/pie/skeleton.d.ts +1 -0
- package/dist/types/widgets/pie/style.d.ts +15 -0
- package/dist/types/widgets/pie/types.d.ts +9 -0
- package/dist/types/widgets/range/components/range-item.d.ts +2 -0
- package/dist/types/widgets/range/config.d.ts +6 -0
- package/dist/types/widgets/range/index.d.ts +6 -0
- package/dist/types/widgets/range/range-ui.d.ts +2 -0
- package/dist/types/widgets/range/serializer.d.ts +16 -0
- package/dist/types/widgets/range/serializer.test.d.ts +1 -0
- package/dist/types/widgets/range/skeleton.d.ts +1 -0
- package/dist/types/widgets/range/style.d.ts +2 -0
- package/dist/types/widgets/range/types.d.ts +33 -0
- package/dist/types/widgets/scatterplot/config.d.ts +5 -0
- package/dist/types/widgets/scatterplot/index.d.ts +3 -0
- package/dist/types/widgets/scatterplot/skeleton.d.ts +1 -0
- package/dist/types/widgets/scatterplot/style.d.ts +24 -0
- package/dist/types/widgets/scatterplot/types.d.ts +9 -0
- package/dist/types/widgets/selection-summary/index.d.ts +2 -0
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +2 -0
- package/dist/types/widgets/selection-summary/style.d.ts +9 -0
- package/dist/types/widgets/selection-summary/types.d.ts +13 -0
- package/dist/types/widgets/skeleton-loader/index.d.ts +2 -0
- package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +2 -0
- package/dist/types/widgets/skeleton-loader/types.d.ts +7 -0
- package/dist/types/widgets/spread/components/max-value.d.ts +2 -0
- package/dist/types/widgets/spread/components/min-value.d.ts +2 -0
- package/dist/types/widgets/spread/components/separator.d.ts +2 -0
- package/dist/types/widgets/spread/config.d.ts +10 -0
- package/dist/types/widgets/spread/index.d.ts +9 -0
- package/dist/types/widgets/spread/skeleton.d.ts +1 -0
- package/dist/types/widgets/spread/spread-ui.d.ts +2 -0
- package/dist/types/widgets/spread/style.d.ts +21 -0
- package/dist/types/widgets/spread/types.d.ts +40 -0
- package/dist/types/widgets/stores/index.d.ts +2 -0
- package/dist/types/widgets/stores/types.d.ts +165 -0
- package/dist/types/widgets/stores/widget-store.d.ts +39 -0
- package/dist/types/widgets/stores/widget-store.test.d.ts +1 -0
- package/dist/types/widgets/subheader/index.d.ts +2 -0
- package/dist/types/widgets/subheader/style.d.ts +19 -0
- package/dist/types/widgets/subheader/subheader.d.ts +2 -0
- package/dist/types/widgets/subheader/types.d.ts +10 -0
- package/dist/types/widgets/table/components/cell-header.d.ts +5 -0
- package/dist/types/widgets/table/components/cell.d.ts +16 -0
- package/dist/types/widgets/table/components/index.d.ts +4 -0
- package/dist/types/widgets/table/components/pagination-actions.d.ts +5 -0
- package/dist/types/widgets/table/components/pagination.d.ts +5 -0
- package/dist/types/widgets/table/components/row.d.ts +5 -0
- package/dist/types/widgets/table/config.d.ts +17 -0
- package/dist/types/widgets/table/helpers.d.ts +38 -0
- package/dist/types/widgets/table/helpers.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/index.d.ts +6 -0
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +33 -0
- package/dist/types/widgets/table/hooks/use-pagination.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/use-selection.d.ts +30 -0
- package/dist/types/widgets/table/hooks/use-selection.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/use-sort.d.ts +22 -0
- package/dist/types/widgets/table/hooks/use-sort.test.d.ts +1 -0
- package/dist/types/widgets/table/index.d.ts +13 -0
- package/dist/types/widgets/table/serializer.d.ts +16 -0
- package/dist/types/widgets/table/skeleton.d.ts +10 -0
- package/dist/types/widgets/table/style.d.ts +33 -0
- package/dist/types/widgets/table/table-ui.d.ts +32 -0
- package/dist/types/widgets/table/types.d.ts +196 -0
- package/dist/types/widgets/timeseries/config.d.ts +5 -0
- package/dist/types/widgets/timeseries/index.d.ts +3 -0
- package/dist/types/widgets/timeseries/skeleton.d.ts +1 -0
- package/dist/types/widgets/timeseries/style.d.ts +38 -0
- package/dist/types/widgets/timeseries/types.d.ts +9 -0
- package/dist/types/widgets/toolbar-actions/index.d.ts +2 -0
- package/dist/types/widgets/toolbar-actions/styles.d.ts +37 -0
- package/dist/types/widgets/toolbar-actions/toolbar-actions.d.ts +8 -0
- package/dist/types/widgets/toolbar-actions/types.d.ts +45 -0
- package/dist/types/widgets/wrapper/components/actions.d.ts +2 -0
- package/dist/types/widgets/wrapper/components/options.d.ts +2 -0
- package/dist/types/widgets/wrapper/components/title.d.ts +6 -0
- package/dist/types/widgets/wrapper/index.d.ts +6 -0
- package/dist/types/widgets/wrapper/styles.d.ts +89 -0
- package/dist/types/widgets/wrapper/types.d.ts +37 -0
- package/dist/types/widgets/wrapper/wrapper-ui.d.ts +2 -0
- package/dist/types/widgets/wrapper/wrapper.d.ts +2 -0
- package/dist/use-widget-ref-B0aNCANx.js +19 -0
- package/dist/use-widget-ref-B0aNCANx.js.map +1 -0
- package/dist/utils-D3-eQyDR.js +144 -0
- package/dist/utils-D3-eQyDR.js.map +1 -0
- package/dist/widget-store-CB6Trp_0.js +131 -0
- package/dist/widget-store-CB6Trp_0.js.map +1 -0
- package/dist/widgets/actions.js +872 -0
- package/dist/widgets/actions.js.map +1 -0
- package/dist/widgets/bar.js +188 -0
- package/dist/widgets/bar.js.map +1 -0
- package/dist/widgets/category.js +427 -0
- package/dist/widgets/category.js.map +1 -0
- package/dist/widgets/echart.js +115 -0
- package/dist/widgets/echart.js.map +1 -0
- package/dist/widgets/error.js +5 -0
- package/dist/widgets/error.js.map +1 -0
- package/dist/widgets/formula.js +119 -0
- package/dist/widgets/formula.js.map +1 -0
- package/dist/widgets/histogram.js +186 -0
- package/dist/widgets/histogram.js.map +1 -0
- package/dist/widgets/loader.js +57 -0
- package/dist/widgets/loader.js.map +1 -0
- package/dist/widgets/markdown.js +127 -0
- package/dist/widgets/markdown.js.map +1 -0
- package/dist/widgets/no-data.js +5 -0
- package/dist/widgets/no-data.js.map +1 -0
- package/dist/widgets/note.js +5 -0
- package/dist/widgets/note.js.map +1 -0
- package/dist/widgets/pie.js +230 -0
- package/dist/widgets/pie.js.map +1 -0
- package/dist/widgets/range.js +217 -0
- package/dist/widgets/range.js.map +1 -0
- package/dist/widgets/scatterplot.js +233 -0
- package/dist/widgets/scatterplot.js.map +1 -0
- package/dist/widgets/selection-summary.js +40 -0
- package/dist/widgets/selection-summary.js.map +1 -0
- package/dist/widgets/skeleton-loader.js +24 -0
- package/dist/widgets/skeleton-loader.js.map +1 -0
- package/dist/widgets/spread.js +161 -0
- package/dist/widgets/spread.js.map +1 -0
- package/dist/widgets/stores.js +5 -0
- package/dist/widgets/stores.js.map +1 -0
- package/dist/widgets/subheader.js +52 -0
- package/dist/widgets/subheader.js.map +1 -0
- package/dist/widgets/table.js +672 -0
- package/dist/widgets/table.js.map +1 -0
- package/dist/widgets/timeseries.js +187 -0
- package/dist/widgets/timeseries.js.map +1 -0
- package/dist/widgets/toolbar-actions.js +6725 -0
- package/dist/widgets/toolbar-actions.js.map +1 -0
- package/dist/widgets/wrapper.js +295 -0
- package/dist/widgets/wrapper.js.map +1 -0
- package/dist/widgets.js +12 -1
- package/dist/widgets.js.map +1 -1
- package/package.json +114 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function m(t) {
|
|
2
|
+
const e = [];
|
|
3
|
+
if (t.length > 0 && (t[0]?.length ?? 0) > 0) {
|
|
4
|
+
const n = t?.[0]?.[0] ?? {}, i = Object.keys(n);
|
|
5
|
+
e.push(i);
|
|
6
|
+
}
|
|
7
|
+
return t.forEach((n) => {
|
|
8
|
+
n.forEach((i) => {
|
|
9
|
+
const o = Object.values(i).map((r) => String(r));
|
|
10
|
+
e.push(o);
|
|
11
|
+
});
|
|
12
|
+
}), e;
|
|
13
|
+
}
|
|
14
|
+
function y(t) {
|
|
15
|
+
const e = [];
|
|
16
|
+
return e.push(["x", "y"]), t.forEach((n) => {
|
|
17
|
+
n.forEach((i) => {
|
|
18
|
+
e.push([String(i[0]), String(i[1])]);
|
|
19
|
+
});
|
|
20
|
+
}), e;
|
|
21
|
+
}
|
|
22
|
+
function F(t) {
|
|
23
|
+
return {
|
|
24
|
+
show: t,
|
|
25
|
+
icon: "circle",
|
|
26
|
+
left: 0,
|
|
27
|
+
bottom: 0,
|
|
28
|
+
orient: "horizontal",
|
|
29
|
+
type: "scroll"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function v(t, e) {
|
|
33
|
+
return {
|
|
34
|
+
...!t && {
|
|
35
|
+
bottom: parseInt(e.spacing(3))
|
|
36
|
+
},
|
|
37
|
+
...t && {
|
|
38
|
+
bottom: parseInt(e.spacing(7))
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function x(t) {
|
|
43
|
+
return function(e, n, i, o, r) {
|
|
44
|
+
const l = {
|
|
45
|
+
top: parseInt(t.spacing(0.5))
|
|
46
|
+
};
|
|
47
|
+
return r.contentSize[0] < r.viewSize[0] - e[0] ? l.left = e[0] : l.right = r.viewSize[0] - e[0], l;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function u(t) {
|
|
51
|
+
if (t)
|
|
52
|
+
return (e) => t(e);
|
|
53
|
+
}
|
|
54
|
+
function b(t, e) {
|
|
55
|
+
let n = u(e);
|
|
56
|
+
const i = t && !Array.isArray(t), o = t;
|
|
57
|
+
return (!i || o.type !== "value") && (n = void 0), {
|
|
58
|
+
...o,
|
|
59
|
+
axisLabel: {
|
|
60
|
+
...typeof o.axisLabel == "object" && o.axisLabel ? o.axisLabel : {},
|
|
61
|
+
formatter: n
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function d(t) {
|
|
66
|
+
return (e) => {
|
|
67
|
+
const n = Array.isArray(e) ? e : [e], i = (s, a) => `<div style="margin: 0px 0 0;line-height:1;">${s ? `<div style="font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px">${s}</div>` : ""}<div style="margin: 0;line-height:1;">${a}</div><div style="clear:both"></div></div>`, o = n.map((s) => {
|
|
68
|
+
const {
|
|
69
|
+
name: a,
|
|
70
|
+
seriesName: c,
|
|
71
|
+
marker: f,
|
|
72
|
+
value: h
|
|
73
|
+
} = t(s, n);
|
|
74
|
+
return {
|
|
75
|
+
name: a,
|
|
76
|
+
seriesName: c,
|
|
77
|
+
marker: f,
|
|
78
|
+
value: h
|
|
79
|
+
};
|
|
80
|
+
}), r = o[0]?.name ?? "", p = r || n.length > 1 ? "margin: 10px 0 0;line-height:1;" : "margin: 0;line-height:1;", g = o.map(({
|
|
81
|
+
seriesName: s,
|
|
82
|
+
marker: a,
|
|
83
|
+
value: c
|
|
84
|
+
}) => `<div style="${p}"><div style="margin: 0px 0 0;line-height:1;">${a}${s ? `<span style="font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px">${s}</span>` : ""}<span style="float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900">${c}</span></div></div>`);
|
|
85
|
+
return i(r, g.join(""));
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const w = {
|
|
89
|
+
graph: {
|
|
90
|
+
/**
|
|
91
|
+
* Common container style for chart widget skeletons
|
|
92
|
+
*/
|
|
93
|
+
container: {
|
|
94
|
+
display: "flex",
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
justifyContent: "space-between",
|
|
97
|
+
flexDirection: "column",
|
|
98
|
+
gap: ({
|
|
99
|
+
spacing: t
|
|
100
|
+
}) => t(1),
|
|
101
|
+
height: ({
|
|
102
|
+
spacing: t
|
|
103
|
+
}) => t(38)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
x as a,
|
|
109
|
+
b,
|
|
110
|
+
d as c,
|
|
111
|
+
v as d,
|
|
112
|
+
F as e,
|
|
113
|
+
m as f,
|
|
114
|
+
w as g,
|
|
115
|
+
y as s
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=styles-CCZnY17y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-CCZnY17y.js","sources":["../src/widgets/_shared/chart-config/csv-modifiers.ts","../src/widgets/_shared/chart-config/option-builders.ts","../src/widgets/_shared/skeleton/styles.ts"],"sourcesContent":["/**\n * Shared CSV export modifiers for chart widgets\n */\n\n/**\n * Flattens object array data into CSV-ready rows.\n * Used by bar, pie, histogram, and timeseries widgets.\n *\n * @param data - Array of series, where each series is an array of data objects\n * @returns CSV rows with headers and values\n */\nexport function flattenObjectArrayToCSV<T extends Record<string, unknown>>(\n data: T[][],\n): string[][] {\n const rows: string[][] = []\n\n // Add headers from first data point if available\n if (data.length > 0 && (data[0]?.length ?? 0) > 0) {\n const firstDataPoint = data?.[0]?.[0] ?? {}\n const headers = Object.keys(firstDataPoint)\n rows.push(headers)\n }\n\n // Add data rows from all series\n data.forEach((series) => {\n series.forEach((dataPoint) => {\n const values = Object.values(dataPoint).map((v) => String(v))\n rows.push(values)\n })\n })\n\n return rows\n}\n\n/**\n * Creates CSV rows for scatterplot data.\n * Scatterplot uses array format [x, y] instead of objects.\n *\n * @param data - Array of series, where each series is an array of [x, y] tuples\n * @returns CSV rows with ['x', 'y'] headers\n */\nexport function scatterplotDataToCSV(data: number[][][]): string[][] {\n const rows: string[][] = []\n\n // Add headers\n rows.push(['x', 'y'])\n\n // Add data rows from all series\n data.forEach((series) => {\n series.forEach((dataPoint) => {\n rows.push([String(dataPoint[0]), String(dataPoint[1])])\n })\n })\n\n return rows\n}\n","import type { Theme } from '@mui/material'\nimport type { LegendComponentOption } from 'echarts'\nimport type {\n CallbackDataParams,\n TopLevelFormatterParams,\n} from 'node_modules/echarts/types/dist/shared'\n\n/**\n * Shared EChart configuration builders for chart widgets\n */\n\n/**\n * Builds standard legend configuration for chart widgets\n *\n * @param hasLegend - Whether to show the legend\n * @returns Legend configuration object\n */\nexport function buildLegendConfig(hasLegend: boolean): LegendComponentOption {\n return {\n show: hasLegend,\n icon: 'circle' as const,\n left: 0,\n bottom: 0,\n orient: 'horizontal',\n type: 'scroll',\n }\n}\n\n/**\n * Builds standard grid configuration with legend-aware spacing\n *\n * @param hasLegend - Whether the chart has a legend\n * @param theme - MUI theme for spacing\n * @param additionalConfig - Additional grid configuration to merge\n * @returns Grid configuration object\n */\nexport function buildGridConfig(hasLegend: boolean, theme: Theme) {\n return {\n ...(!hasLegend && { bottom: parseInt(theme.spacing(3)) }),\n ...(hasLegend && { bottom: parseInt(theme.spacing(7)) }),\n }\n}\n\n/**\n * Creates a tooltip position calculator that handles overflow\n * Used by bar, histogram, and scatterplot widgets\n *\n * @param theme - MUI theme for spacing\n * @returns Tooltip position function\n */\nexport function createTooltipPositioner(theme: Theme) {\n return function (\n point: [number, number],\n _params: unknown,\n _dom: unknown,\n _rect: unknown,\n size: { contentSize: [number, number]; viewSize: [number, number] },\n ) {\n const position = { top: parseInt(theme.spacing(0.5)) } as Record<\n string,\n number\n >\n\n // Position tooltip left or right based on available space\n if (size.contentSize[0] < size.viewSize[0] - point[0]) {\n position.left = point[0]\n } else {\n position.right = size.viewSize[0] - point[0]\n }\n\n return position\n }\n}\n\n/**\n * Creates an axis label formatter for ECharts\n * Used to format numeric axis labels with a widget formatter\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Axis label formatter function or undefined\n */\nexport function createAxisLabelFormatter(\n formatter?: (value: number) => string,\n) {\n if (!formatter) return undefined\n return (value: number) => formatter(value)\n}\n\n/**\n * Applies formatter to xAxis configuration\n * Only applies to single axis objects (not arrays) with type 'value'\n *\n * @param xAxis - Existing xAxis configuration\n * @param formatter - Optional formatter function from widget config\n * @returns Updated xAxis configuration or undefined if no changes needed\n */\nexport function applyXAxisFormatter(\n xAxis: unknown,\n formatter?: (value: number) => string,\n) {\n let axisFormatter = createAxisLabelFormatter(formatter)\n\n const xAxisIsObject = xAxis && !Array.isArray(xAxis)\n const xAxisTyped = xAxis as { type?: string; axisLabel?: unknown }\n\n if (!xAxisIsObject || xAxisTyped.type !== 'value') {\n axisFormatter = undefined\n }\n\n return {\n ...xAxisTyped,\n axisLabel: {\n ...(typeof xAxisTyped.axisLabel === 'object' && xAxisTyped.axisLabel\n ? xAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Applies formatter to yAxis configuration\n * Only applies to single axis objects (not arrays) with type 'value'\n *\n * @param yAxis - Existing yAxis configuration\n * @param formatter - Optional formatter function from widget config\n * @returns Updated yAxis configuration or undefined if no changes needed\n */\nexport function applyYAxisFormatter(\n yAxis: unknown,\n formatter?: (value: number) => string,\n) {\n let axisFormatter = createAxisLabelFormatter(formatter)\n\n const yAxisIsObject = yAxis && !Array.isArray(yAxis)\n const yAxisTyped = yAxis as { type?: string; axisLabel?: unknown }\n\n if (!yAxisIsObject || yAxisTyped.type !== 'value') {\n axisFormatter = undefined\n }\n\n return {\n ...yAxisTyped,\n axisLabel: {\n ...(typeof yAxisTyped.axisLabel === 'object' && yAxisTyped.axisLabel\n ? yAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Creates a tooltip formatter for ECharts\n * Formats numeric values in tooltip using widget formatter\n * Handles both axis trigger (array) and item trigger (object) modes\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Tooltip formatter function or undefined\n */\nexport function createTooltipFormatter(\n callback: (\n item: CallbackDataParams,\n items: CallbackDataParams[],\n ) => {\n name: string\n seriesName: string\n marker: string\n value: string | number\n },\n) {\n return (params: TopLevelFormatterParams) => {\n // Handle both array (axis trigger) and object (item trigger)\n const items = Array.isArray(params) ? params : [params]\n\n const tooltip = (name: string, callback: string) =>\n `<div style=\"margin: 0px 0 0;line-height:1;\">${name ? `<div style=\"font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px\">${name}</div>` : ''}<div style=\"margin: 0;line-height:1;\">${callback}</div><div style=\"clear:both\"></div></div>`\n\n const values = items.map((item) => {\n const { name, seriesName, marker, value } = callback(item, items)\n return {\n name,\n seriesName,\n marker,\n value,\n }\n })\n\n const name = values[0]?.name ?? ''\n // Show margin if name exists or there are multiple items\n const showMargin = name || items.length > 1\n const marginStyle = showMargin\n ? 'margin: 10px 0 0;line-height:1;'\n : 'margin: 0;line-height:1;'\n\n const formattedValues = values.map(\n ({ seriesName, marker, value }) =>\n `<div style=\"${marginStyle}\"><div style=\"margin: 0px 0 0;line-height:1;\">${marker}${seriesName ? `<span style=\"font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px\">${seriesName}</span>` : ''}<span style=\"float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900\">${value}</span></div></div>`,\n )\n\n return tooltip(name, formattedValues.join(''))\n }\n}\n","import type { Theme } from '@mui/material'\n\n/**\n * Base skeleton styles shared across all chart widgets\n */\nexport const baseSkeletonStyles = {\n graph: {\n /**\n * Common container style for chart widget skeletons\n */\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }: Theme) => spacing(1),\n height: ({ spacing }: Theme) => spacing(38),\n },\n },\n} as const\n"],"names":["flattenObjectArrayToCSV","data","rows","length","firstDataPoint","headers","Object","keys","push","forEach","series","dataPoint","values","map","v","String","scatterplotDataToCSV","buildLegendConfig","hasLegend","show","icon","left","bottom","orient","type","buildGridConfig","theme","parseInt","spacing","createTooltipPositioner","point","_params","_dom","_rect","size","position","top","contentSize","viewSize","right","createAxisLabelFormatter","formatter","value","applyYAxisFormatter","yAxis","axisFormatter","yAxisIsObject","Array","isArray","yAxisTyped","undefined","axisLabel","createTooltipFormatter","callback","params","items","tooltip","name","item","seriesName","marker","marginStyle","formattedValues","join","baseSkeletonStyles","graph","container","display","alignItems","justifyContent","flexDirection","gap","height"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as f } from "react/compiler-runtime";
|
|
3
|
+
import { Tooltip as c } from "@mui/material";
|
|
4
|
+
let s = 500;
|
|
5
|
+
function y(i) {
|
|
6
|
+
const t = f(10);
|
|
7
|
+
let e, o, r, l;
|
|
8
|
+
t[0] !== i ? ({
|
|
9
|
+
children: e,
|
|
10
|
+
title: l,
|
|
11
|
+
enterNextDelay: r,
|
|
12
|
+
...o
|
|
13
|
+
} = i, t[0] = i, t[1] = e, t[2] = o, t[3] = r, t[4] = l) : (e = t[1], o = t[2], r = t[3], l = t[4]);
|
|
14
|
+
const p = r === void 0 ? s : r;
|
|
15
|
+
let n;
|
|
16
|
+
return t[5] !== e || t[6] !== p || t[7] !== o || t[8] !== l ? (n = /* @__PURE__ */ a(c, { title: l, enterNextDelay: p, ...o, children: e }), t[5] = e, t[6] = p, t[7] = o, t[8] = l, t[9] = n) : n = t[9], n;
|
|
17
|
+
}
|
|
18
|
+
function D(i) {
|
|
19
|
+
s = i;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
y as T,
|
|
23
|
+
D as s
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=tooltip-BDnrRKrp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip-BDnrRKrp.js","sources":["../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import { Tooltip as MuiTooltip, type TooltipProps } from '@mui/material'\n\nlet tooltipEnterDelay = 500\n\n/**\n * A wrapper around MUI's Tooltip component with enterNextDelay set to 1000ms by default.\n *\n * This component ensures consistent tooltip behavior across the application.\n *\n * @example\n * <Tooltip title=\"This is a tooltip\">\n * <Button>Hover me</Button>\n * </Tooltip>\n */\nexport function Tooltip({\n children,\n title,\n enterNextDelay = tooltipEnterDelay,\n ...props\n}: TooltipProps) {\n return (\n <MuiTooltip title={title} enterNextDelay={enterNextDelay} {...props}>\n {children}\n </MuiTooltip>\n )\n}\n\nexport function setTooltipEnterDelay(delay: number) {\n tooltipEnterDelay = delay\n}\n"],"names":["tooltipEnterDelay","Tooltip","t0","$","_c","children","props","t1","title","enterNextDelay","undefined","t2","MuiTooltip","setTooltipEnterDelay","delay"],"mappings":";;;AAEA,IAAIA,IAAoB;AAYjB,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA;AAAA,MAAAC,GAAAC,GAAAC,GAAAC;AAAA,EAAAL,SAAAD,KAAiB;AAAA,IAAAG,UAAAA;AAAAA,IAAAG,OAAAA;AAAAA,IAAAC,gBAAAF;AAAAA,IAAA,GAAAD;AAAAA,EAAAA,IAAAJ,GAKTC,OAAAD,GAAAC,OAAAE,GAAAF,OAAAG,GAAAH,OAAAI,GAAAJ,OAAAK,MAAAH,IAAAF,EAAA,CAAA,GAAAG,IAAAH,EAAA,CAAA,GAAAI,IAAAJ,EAAA,CAAA,GAAAK,IAAAL,EAAA,CAAA;AAFb,QAAAM,IAAAF,MAAAG,SAAAV,IAAAO;AAAkC,MAAAI;AAAA,SAAAR,EAAA,CAAA,MAAAE,KAAAF,EAAA,CAAA,MAAAM,KAAAN,EAAA,CAAA,MAAAG,KAAAH,SAAAK,KAIhCG,sBAACC,GAAA,EAAkBJ,OAAAA,GAAuBC,gBAAAA,MAAoBH,gBAE9D,GAAaH,OAAAE,GAAAF,OAAAM,GAAAN,OAAAG,GAAAH,OAAAK,GAAAL,OAAAQ,KAAAA,IAAAR,EAAA,CAAA,GAFbQ;AAEa;AAIV,SAASE,EAAqBC,GAAe;AAClDd,EAAAA,IAAoBc;AACtB;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Theme } from '@mui/material';
|
|
2
|
-
import { CSSProperties } from 'react';
|
|
3
2
|
export declare const styles: {
|
|
4
3
|
container: {
|
|
5
4
|
display: "flex";
|
|
@@ -48,12 +47,22 @@ export declare const styles: {
|
|
|
48
47
|
padding: ({ spacing }: Theme) => string;
|
|
49
48
|
marginTop: ({ spacing }: Theme) => string;
|
|
50
49
|
marginBottom: ({ spacing }: Theme) => string;
|
|
51
|
-
'.MuiToggleButtonGroup-grouped':
|
|
50
|
+
'.MuiToggleButtonGroup-grouped': {
|
|
51
|
+
typography: string;
|
|
52
|
+
fontWeight: number;
|
|
53
|
+
margin: number;
|
|
54
|
+
'&:first-of-type:not(.MuiDivider-root)': {
|
|
55
|
+
marginLeft: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
subtitle: {
|
|
60
|
+
typography: string;
|
|
61
|
+
color: ({ palette }: Theme) => string;
|
|
52
62
|
};
|
|
53
|
-
subtitle: ({ typography, palette }: Theme) => CSSProperties;
|
|
54
63
|
optionsGroup: {
|
|
55
64
|
marginLeft: ({ spacing }: Theme) => string;
|
|
56
|
-
|
|
65
|
+
typography: string;
|
|
57
66
|
};
|
|
58
67
|
title: {
|
|
59
68
|
display: "flex";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for debouncing a callback function.
|
|
3
|
+
*
|
|
4
|
+
* @param callback - The function to debounce
|
|
5
|
+
* @param delay - The delay in milliseconds (default: 300ms)
|
|
6
|
+
* @returns A debounced version of the callback
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const debouncedSearch = useDebounce((searchText: string) => {
|
|
11
|
+
* // Perform search
|
|
12
|
+
* console.log('Searching for:', searchText)
|
|
13
|
+
* }, 300)
|
|
14
|
+
*
|
|
15
|
+
* // Call it anywhere
|
|
16
|
+
* debouncedSearch('react')
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function useDebounce<TArgs extends unknown[], TReturn = void>(callback: (...args: TArgs) => TReturn, delay?: number): (...args: TArgs) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for registering a DOM element ref with the widget store.
|
|
3
|
+
* This allows other parts of the application to access the widget's DOM element.
|
|
4
|
+
*
|
|
5
|
+
* @param widgetId - The widget ID to register the ref under
|
|
6
|
+
* @returns A ref object to attach to the DOM element
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* function MyWidget({ id }: { id: string }) {
|
|
11
|
+
* const ref = useWidgetRef<HTMLDivElement>(id)
|
|
12
|
+
*
|
|
13
|
+
* return <div ref={ref}>Widget content</div>
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function useWidgetRef<T extends HTMLElement = HTMLElement>(widgetId: string): import('react').RefObject<T | null>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EchartOptionsProps, EchartWidgetData } from '../../echart';
|
|
2
|
+
/**
|
|
3
|
+
* Base configuration interface for chart widgets
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartWidgetBaseConfig<TData = EchartWidgetData> {
|
|
6
|
+
data?: TData;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parameters for creating a chart widget configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface CreateChartWidgetConfigParams<TData = EchartWidgetData, TConfig extends ChartWidgetBaseConfig<TData> = ChartWidgetBaseConfig<TData>, TType extends string = string> {
|
|
12
|
+
/** Widget type identifier (e.g., 'bar', 'pie', 'histogram') */
|
|
13
|
+
type: TType;
|
|
14
|
+
/** Function to get EChart options from config */
|
|
15
|
+
getOptions: (config: TConfig) => EchartOptionsProps;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Return type of the chart widget config function
|
|
19
|
+
*/
|
|
20
|
+
export type ChartWidgetConfigResult<TData = EchartWidgetData, TConfig extends ChartWidgetBaseConfig<TData> = ChartWidgetBaseConfig<TData>, TType extends string = string> = TConfig & {
|
|
21
|
+
type: TType;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Factory function to create a standardized chart widget config function.
|
|
25
|
+
* This eliminates duplication across chart widgets by providing a common structure.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* export const barConfig = createChartWidgetConfig({
|
|
30
|
+
* type: 'bar' as const,
|
|
31
|
+
* getOptions: ({ data, theme }) => ({
|
|
32
|
+
* // EChart configuration
|
|
33
|
+
* }),
|
|
34
|
+
* csvModifier: (data) => flattenObjectArrayToCSV(data),
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function createChartWidgetConfig<TData = EchartWidgetData, TConfig extends ChartWidgetBaseConfig<TData> = ChartWidgetBaseConfig<TData>, TType extends string = string>({ type, getOptions, }: CreateChartWidgetConfigParams<TData, TConfig, TType>): (config: TConfig) => ChartWidgetConfigResult<TData, TConfig, TType>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CSV export modifiers for chart widgets
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Flattens object array data into CSV-ready rows.
|
|
6
|
+
* Used by bar, pie, histogram, and timeseries widgets.
|
|
7
|
+
*
|
|
8
|
+
* @param data - Array of series, where each series is an array of data objects
|
|
9
|
+
* @returns CSV rows with headers and values
|
|
10
|
+
*/
|
|
11
|
+
export declare function flattenObjectArrayToCSV<T extends Record<string, unknown>>(data: T[][]): string[][];
|
|
12
|
+
/**
|
|
13
|
+
* Creates CSV rows for scatterplot data.
|
|
14
|
+
* Scatterplot uses array format [x, y] instead of objects.
|
|
15
|
+
*
|
|
16
|
+
* @param data - Array of series, where each series is an array of [x, y] tuples
|
|
17
|
+
* @returns CSV rows with ['x', 'y'] headers
|
|
18
|
+
*/
|
|
19
|
+
export declare function scatterplotDataToCSV(data: number[][][]): string[][];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for chart widget configuration
|
|
3
|
+
*/
|
|
4
|
+
export { createChartWidgetConfig } from './config-factory';
|
|
5
|
+
export type { ChartWidgetBaseConfig, CreateChartWidgetConfigParams, } from './config-factory';
|
|
6
|
+
export { flattenObjectArrayToCSV, scatterplotDataToCSV } from './csv-modifiers';
|
|
7
|
+
export { buildLegendConfig, buildGridConfig, createTooltipPositioner, createAxisLabelFormatter, createTooltipFormatter, applyXAxisFormatter, applyYAxisFormatter, } from './option-builders';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { LegendComponentOption } from 'echarts';
|
|
3
|
+
import { CallbackDataParams, TopLevelFormatterParams } from '../../../../node_modules/echarts/types/dist/shared';
|
|
4
|
+
/**
|
|
5
|
+
* Shared EChart configuration builders for chart widgets
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Builds standard legend configuration for chart widgets
|
|
9
|
+
*
|
|
10
|
+
* @param hasLegend - Whether to show the legend
|
|
11
|
+
* @returns Legend configuration object
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildLegendConfig(hasLegend: boolean): LegendComponentOption;
|
|
14
|
+
/**
|
|
15
|
+
* Builds standard grid configuration with legend-aware spacing
|
|
16
|
+
*
|
|
17
|
+
* @param hasLegend - Whether the chart has a legend
|
|
18
|
+
* @param theme - MUI theme for spacing
|
|
19
|
+
* @param additionalConfig - Additional grid configuration to merge
|
|
20
|
+
* @returns Grid configuration object
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildGridConfig(hasLegend: boolean, theme: Theme): {
|
|
23
|
+
bottom?: number | undefined;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Creates a tooltip position calculator that handles overflow
|
|
27
|
+
* Used by bar, histogram, and scatterplot widgets
|
|
28
|
+
*
|
|
29
|
+
* @param theme - MUI theme for spacing
|
|
30
|
+
* @returns Tooltip position function
|
|
31
|
+
*/
|
|
32
|
+
export declare function createTooltipPositioner(theme: Theme): (point: [number, number], _params: unknown, _dom: unknown, _rect: unknown, size: {
|
|
33
|
+
contentSize: [number, number];
|
|
34
|
+
viewSize: [number, number];
|
|
35
|
+
}) => Record<string, number>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates an axis label formatter for ECharts
|
|
38
|
+
* Used to format numeric axis labels with a widget formatter
|
|
39
|
+
*
|
|
40
|
+
* @param formatter - Optional formatter function from widget config
|
|
41
|
+
* @returns Axis label formatter function or undefined
|
|
42
|
+
*/
|
|
43
|
+
export declare function createAxisLabelFormatter(formatter?: (value: number) => string): ((value: number) => string) | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Applies formatter to xAxis configuration
|
|
46
|
+
* Only applies to single axis objects (not arrays) with type 'value'
|
|
47
|
+
*
|
|
48
|
+
* @param xAxis - Existing xAxis configuration
|
|
49
|
+
* @param formatter - Optional formatter function from widget config
|
|
50
|
+
* @returns Updated xAxis configuration or undefined if no changes needed
|
|
51
|
+
*/
|
|
52
|
+
export declare function applyXAxisFormatter(xAxis: unknown, formatter?: (value: number) => string): {
|
|
53
|
+
axisLabel: {
|
|
54
|
+
formatter: ((value: number) => string) | undefined;
|
|
55
|
+
};
|
|
56
|
+
type?: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Applies formatter to yAxis configuration
|
|
60
|
+
* Only applies to single axis objects (not arrays) with type 'value'
|
|
61
|
+
*
|
|
62
|
+
* @param yAxis - Existing yAxis configuration
|
|
63
|
+
* @param formatter - Optional formatter function from widget config
|
|
64
|
+
* @returns Updated yAxis configuration or undefined if no changes needed
|
|
65
|
+
*/
|
|
66
|
+
export declare function applyYAxisFormatter(yAxis: unknown, formatter?: (value: number) => string): {
|
|
67
|
+
axisLabel: {
|
|
68
|
+
formatter: ((value: number) => string) | undefined;
|
|
69
|
+
};
|
|
70
|
+
type?: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Creates a tooltip formatter for ECharts
|
|
74
|
+
* Formats numeric values in tooltip using widget formatter
|
|
75
|
+
* Handles both axis trigger (array) and item trigger (object) modes
|
|
76
|
+
*
|
|
77
|
+
* @param formatter - Optional formatter function from widget config
|
|
78
|
+
* @returns Tooltip formatter function or undefined
|
|
79
|
+
*/
|
|
80
|
+
export declare function createTooltipFormatter(callback: (item: CallbackDataParams, items: CallbackDataParams[]) => {
|
|
81
|
+
name: string;
|
|
82
|
+
seriesName: string;
|
|
83
|
+
marker: string;
|
|
84
|
+
value: string | number;
|
|
85
|
+
}): (params: TopLevelFormatterParams) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
/**
|
|
3
|
+
* Base skeleton styles shared across all chart widgets
|
|
4
|
+
*/
|
|
5
|
+
export declare const baseSkeletonStyles: {
|
|
6
|
+
readonly graph: {
|
|
7
|
+
/**
|
|
8
|
+
* Common container style for chart widget skeletons
|
|
9
|
+
*/
|
|
10
|
+
readonly container: {
|
|
11
|
+
readonly display: "flex";
|
|
12
|
+
readonly alignItems: "center";
|
|
13
|
+
readonly justifyContent: "space-between";
|
|
14
|
+
readonly flexDirection: "column";
|
|
15
|
+
readonly gap: ({ spacing }: Theme) => string;
|
|
16
|
+
readonly height: ({ spacing }: Theme) => string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChangeColumnIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChangeColumnProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Widget action to reorder columns in a table widget via drag-and-drop.
|
|
4
|
+
*
|
|
5
|
+
* This action reads the columns from the widget store and allows users to
|
|
6
|
+
* drag and drop columns to reorder them. All columns are displayed and
|
|
7
|
+
* can be reordered.
|
|
8
|
+
*
|
|
9
|
+
* Returns null if there are fewer than 2 columns.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <ChangeColumn id="my-table-widget" />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function ChangeColumn({ id, labels, Icon, IconButtonProps, MenuProps, }: ChangeColumnProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TableColumn } from '../../table/types';
|
|
2
|
+
export interface SortableColumnItemProps {
|
|
3
|
+
column: TableColumn;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A draggable menu item for column reordering.
|
|
7
|
+
* Uses @dnd-kit/sortable for drag-and-drop functionality.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SortableColumnItem({ column }: SortableColumnItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IconButtonProps, MenuProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface ChangeColumnProps {
|
|
4
|
+
/** Widget ID to update column configuration in the widget store */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Custom labels for the action */
|
|
7
|
+
labels?: {
|
|
8
|
+
/** Tooltip label */
|
|
9
|
+
tooltip?: string;
|
|
10
|
+
/** Accessibility label */
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
};
|
|
13
|
+
/** Props passed to the IconButton component */
|
|
14
|
+
IconButtonProps?: IconButtonProps;
|
|
15
|
+
/** Props passed to the Menu component */
|
|
16
|
+
MenuProps?: Partial<MenuProps>;
|
|
17
|
+
/** Custom icon to display */
|
|
18
|
+
Icon?: ReactNode;
|
|
19
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { DownloadItem } from './types';
|
|
3
|
+
export declare const downloadToCSV: DownloadItem<unknown[][]>;
|
|
4
|
+
export declare const downloadToPNG: Omit<DownloadItem, 'modifier'> & {
|
|
5
|
+
modifier: (ref: Ref<HTMLElement | null> | undefined) => Promise<string | undefined>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JSX, ReactNode } from 'react';
|
|
2
|
+
import { IconButtonProps } from '@mui/material';
|
|
3
|
+
import { WidgetState } from '../../stores/types';
|
|
4
|
+
export interface DownloadItem<D = unknown> {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: JSX.Element;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
filename?: string;
|
|
10
|
+
modifier: (data: D) => Promise<string | undefined>;
|
|
11
|
+
callback?: (data: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface DownloadProps {
|
|
14
|
+
id: WidgetState['id'];
|
|
15
|
+
items: DownloadItem[];
|
|
16
|
+
labels?: {
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
};
|
|
19
|
+
IconButtonProps?: IconButtonProps;
|
|
20
|
+
Icon?: ReactNode;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
title: {
|
|
4
|
+
container: {
|
|
5
|
+
display: "flex";
|
|
6
|
+
alignItems: "center";
|
|
7
|
+
justifyContent: "space-between";
|
|
8
|
+
gap: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
content: {
|
|
12
|
+
display: "flex";
|
|
13
|
+
flexDirection: "column";
|
|
14
|
+
gap: ({ spacing }: Theme) => string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DialogContentProps, IconButtonProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BaseWidgetState } from '../../../widgets/stores/types';
|
|
4
|
+
export type FullScreenState<T = unknown> = BaseWidgetState<T & FullScreenConfigProps & {
|
|
5
|
+
title: string;
|
|
6
|
+
}>;
|
|
7
|
+
export interface FullScreenConfig {
|
|
8
|
+
isFullScreen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type FullScreenConfigProps = FullScreenConfig;
|
|
11
|
+
export interface FullScreenProps {
|
|
12
|
+
id: FullScreenState['id'];
|
|
13
|
+
labels?: {
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
};
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
DialogContentProps?: DialogContentProps;
|
|
18
|
+
IconButtonProps?: IconButtonProps;
|
|
19
|
+
Icon?: ReactNode;
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { FullScreen } from './fullscreen/fullscreen';
|
|
2
|
+
export type { FullScreenState, FullScreenConfig } from './fullscreen/types';
|
|
3
|
+
export { Download } from './download/download';
|
|
4
|
+
export type { DownloadItem, DownloadProps } from './download/types';
|
|
5
|
+
export { downloadToCSV, downloadToPNG } from './download/exports';
|
|
6
|
+
export { RelativeData, RELATIVE_DATA_TOOL_ID, } from './relative-data/relative-data';
|
|
7
|
+
export type { RelativeDataProps } from './relative-data/types';
|
|
8
|
+
export { ZoomToggle } from './zoom-toggle/zoom-toggle';
|
|
9
|
+
export type { ZoomToggleProps, ZoomState, ZoomConfig, } from './zoom-toggle/types';
|
|
10
|
+
export { StackToggle } from './stack-toggle/stack-toggle';
|
|
11
|
+
export type { StackToggleProps, StackToggleState } from './stack-toggle/types';
|
|
12
|
+
export { Searcher, SEARCHER_TOOL_ID } from './searcher/searcher';
|
|
13
|
+
export { SearcherToggle } from './searcher/searcher-toggle';
|
|
14
|
+
export type { SearcherToggleProps, SearcherProps, SearcherFilterFn, SearcherState, } from './searcher/types';
|
|
15
|
+
export { ChangeColumn } from './change-column/change-column';
|
|
16
|
+
export type { ChangeColumnProps } from './change-column/types';
|
|
17
|
+
export { LockSelection, LOCK_SELECTION_TOOL_ID, } from './lock-selection/lock-selection';
|
|
18
|
+
export type { LockSelectionProps, LockSelectionState, } from './lock-selection/types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LockSelectionProps } from './types';
|
|
2
|
+
export declare const LOCK_SELECTION_TOOL_ID = "lock-selection";
|
|
3
|
+
/**
|
|
4
|
+
* Widget action button to lock the current selection.
|
|
5
|
+
*
|
|
6
|
+
* When locked, the widget data is filtered to only show the selected items.
|
|
7
|
+
* The button is only visible when there are selected items.
|
|
8
|
+
* Registers a transformation tool in the widget pipeline when mounted.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <LockSelection
|
|
13
|
+
* id="my-widget"
|
|
14
|
+
* order={30}
|
|
15
|
+
* selectedItems={selectedItems}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function LockSelection({ id, selectedItems, order, labels, Icon, IconButtonProps, }: LockSelectionProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BaseWidgetState } from '../../stores/types';
|
|
4
|
+
/**
|
|
5
|
+
* Lock selection specific state properties.
|
|
6
|
+
*/
|
|
7
|
+
export interface LockSelectionStateProps {
|
|
8
|
+
/** Whether the selection is currently locked */
|
|
9
|
+
isLocked?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Widget state extension for lock selection functionality.
|
|
13
|
+
* Extends the base widget state with lock-specific properties.
|
|
14
|
+
*/
|
|
15
|
+
export type LockSelectionState<T = object> = BaseWidgetState<T & LockSelectionStateProps>;
|
|
16
|
+
export interface LockSelectionProps {
|
|
17
|
+
/** Widget ID to store lock selection state */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Currently selected items (by name) */
|
|
20
|
+
selectedItems: string[];
|
|
21
|
+
/** Execution order in the tool pipeline. Lower values execute first. Defaults to 30. */
|
|
22
|
+
order?: number;
|
|
23
|
+
/** Custom labels for the action */
|
|
24
|
+
labels?: {
|
|
25
|
+
/** Tooltip when unlocked (button will lock selection) */
|
|
26
|
+
lock?: string;
|
|
27
|
+
/** Tooltip when locked (button will unlock selection) */
|
|
28
|
+
unlock?: string;
|
|
29
|
+
/** Accessibility label */
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
};
|
|
32
|
+
/** Props passed to the IconButton component */
|
|
33
|
+
IconButtonProps?: IconButtonProps;
|
|
34
|
+
/** Custom icon to display */
|
|
35
|
+
Icon?: ReactNode;
|
|
36
|
+
}
|