@carto/ps-react-ui 5.0.0-widgets.12 → 5.0.0-widgets.14
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-D9ro6BXv.js → cjs-D4KH3azB.js} +2 -2
- package/dist/{cjs-D9ro6BXv.js.map → cjs-D4KH3azB.js.map} +1 -1
- package/dist/components.js +26 -26
- package/dist/components.js.map +1 -1
- package/dist/{lasso-tool-CYn3ivf-.js → lasso-tool-BwRzEW7k.js} +10 -10
- package/dist/{lasso-tool-CYn3ivf-.js.map → lasso-tool-BwRzEW7k.js.map} +1 -1
- package/dist/{note-Clng2ej6.js → note-t51drNe0.js} +3 -3
- package/dist/{note-Clng2ej6.js.map → note-t51drNe0.js.map} +1 -1
- package/dist/{series-Do02NQUF.js → series-D3Pc-kYX.js} +2 -2
- package/dist/{series-Do02NQUF.js.map → series-D3Pc-kYX.js.map} +1 -1
- package/dist/styles-CCZnY17y.js +117 -0
- package/dist/styles-CCZnY17y.js.map +1 -0
- package/dist/types/widgets/_shared/chart-config/index.d.ts +1 -1
- package/dist/types/widgets/_shared/chart-config/option-builders.d.ts +51 -0
- package/dist/types/widgets/echart/types.d.ts +1 -0
- package/dist/types/widgets/stores/types.d.ts +4 -0
- package/dist/{utils-Dv5Z47UQ.js → utils-D3-eQyDR.js} +2 -2
- package/dist/{utils-Dv5Z47UQ.js.map → utils-D3-eQyDR.js.map} +1 -1
- package/dist/widgets/actions.js +556 -531
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +86 -91
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +6 -6
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js +3 -3
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/formula.js +4 -4
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +108 -98
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/loader.js +1 -1
- package/dist/widgets/markdown.js +5 -5
- package/dist/widgets/markdown.js.map +1 -1
- package/dist/widgets/note.js +1 -1
- package/dist/widgets/pie.js +84 -71
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/range.js +6 -6
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/scatterplot.js +106 -96
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/spread.js +4 -4
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/table.js +8 -8
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +79 -67
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/toolbar-actions.js +1866 -1465
- package/dist/widgets/toolbar-actions.js.map +1 -1
- package/dist/widgets/wrapper.js +7 -7
- package/dist/widgets/wrapper.js.map +1 -1
- package/dist/widgets.js +1 -1
- package/package.json +4 -4
- package/dist/styles-dOu_pRNb.js +0 -77
- package/dist/styles-dOu_pRNb.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Theme } from '@mui/material';
|
|
2
2
|
import { LegendComponentOption } from 'echarts';
|
|
3
|
+
import { CallbackDataParams, TopLevelFormatterParams } from '../../../../node_modules/echarts/types/dist/shared';
|
|
3
4
|
/**
|
|
4
5
|
* Shared EChart configuration builders for chart widgets
|
|
5
6
|
*/
|
|
@@ -32,3 +33,53 @@ export declare function createTooltipPositioner(theme: Theme): (point: [number,
|
|
|
32
33
|
contentSize: [number, number];
|
|
33
34
|
viewSize: [number, number];
|
|
34
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;
|
|
@@ -21,6 +21,10 @@ export interface WidgetsStoreProps {
|
|
|
21
21
|
refUI?: RefObject<HTMLElement | null>;
|
|
22
22
|
/** Registered tools for the widget's transformation pipeline */
|
|
23
23
|
registeredTools?: ToolRegistration[];
|
|
24
|
+
/** Formatter function for widget values */
|
|
25
|
+
formatter?: (value: number) => string;
|
|
26
|
+
/** Locale for number formatting (e.g., 'en-US', 'es-ES', 'fr-FR') */
|
|
27
|
+
locale?: string;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* Tool transformation function type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as n } from "./cjs-
|
|
1
|
+
import { d as n } from "./cjs-D4KH3azB.js";
|
|
2
2
|
const s = "stacked";
|
|
3
3
|
function S(...e) {
|
|
4
4
|
return n(e[0] ?? {}, e[1] ?? {}, {
|
|
@@ -141,4 +141,4 @@ export {
|
|
|
141
141
|
p as g,
|
|
142
142
|
S as m
|
|
143
143
|
};
|
|
144
|
-
//# sourceMappingURL=utils-
|
|
144
|
+
//# sourceMappingURL=utils-D3-eQyDR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-D3-eQyDR.js","sources":["../src/widgets/echart/const.ts","../src/widgets/echart/utils.ts"],"sourcesContent":["export const DEFAULT_STACK_GROUP = 'stacked'\n","import deepmerge from 'deepmerge'\nimport type { EchartOptionsProps } from './types'\nimport type { Theme } from '@mui/material'\nimport { DEFAULT_STACK_GROUP } from './const'\n\nexport function mergeEchartWidgetConfig<T extends EchartOptionsProps>(\n ...options: [T | undefined, T | undefined]\n): T {\n return deepmerge(options[0] ?? {}, options[1] ?? {}, {\n customMerge: (key) => {\n if (key === 'color') {\n return (_, b: T['color']) => b\n }\n if (key === 'series') {\n return (a: T['series'][], b: T['series'][]) => {\n if (!a.length) return a // If there is no series in a, return a as is\n\n const mergedSeries = b?.map((bItem, index) => {\n const aItem = a?.[index] ?? {}\n return deepmerge(aItem, bItem as object)\n })\n return mergedSeries\n }\n }\n },\n }) as T\n}\n\nexport function getEChartZoomConfig(\n zoom: boolean,\n { start, end }: { start: number; end: number } = { start: 0, end: 100 },\n {\n inside = true,\n xSlider = true,\n ySlider = false,\n showSliders = true,\n xAxisLabelFormatter,\n } = {} as {\n inside?: boolean\n xSlider?: boolean\n ySlider?: boolean\n showSliders?: boolean\n xAxisLabelFormatter?: (value: number) => string\n },\n theme?: Theme,\n) {\n const sliderStyles = theme ? getEChartZoomSliderStyles(theme) : {}\n\n return {\n dataZoom: [\n inside && {\n throttle: 0,\n type: 'inside',\n xAxisIndex: xSlider ? [0] : [],\n yAxisIndex: ySlider ? [0] : [],\n show: zoom,\n zoomLock: !zoom,\n start,\n end,\n },\n inside &&\n ySlider && {\n throttle: 0,\n type: 'inside',\n show: zoom,\n zoomLock: !zoom,\n start,\n end,\n orientation: 'vertical',\n },\n xSlider && {\n throttle: 0,\n type: 'slider',\n xAxisIndex: [0],\n bottom: 0,\n height: parseInt(theme?.spacing?.(4) ?? '32'),\n show: zoom && showSliders,\n zoomLock: !zoom,\n start,\n end,\n labelFormatter: xAxisLabelFormatter,\n showDetail: false,\n ...sliderStyles,\n brushSelect: false,\n moveHandleSize: 8,\n handleSize: '100%',\n handleIcon:\n 'image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4=',\n },\n ySlider && {\n throttle: 0,\n type: 'slider',\n left: parseInt(theme?.spacing?.(6) ?? '48'),\n width: parseInt(theme?.spacing?.(4) ?? '32'),\n yAxisIndex: [0],\n show: zoom && showSliders,\n zoomLock: !zoom,\n start,\n end,\n ...sliderStyles,\n brushSelect: false,\n moveHandleSize: 8,\n handleSize: '100%',\n handleIcon:\n 'image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDM2IDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iOCIgaGVpZ2h0PSIxOCIgcng9IjQiIHRyYW5zZm9ybT0icm90YXRlKC05MCAwLjUgMC41KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDEzIDYpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTcgNikiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0icm90YXRlKC05MCAyMSA2KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4=',\n },\n ].filter((d) => !!d),\n }\n}\n\nfunction getEChartZoomSliderStyles(theme: Theme) {\n return {\n fillerColor: 'rgba(53, 139, 231, 0.25)',\n borderColor: 'rgba(53, 139, 231, 0.3)',\n borderWidth: 0.5,\n backgroundColor: 'transparent',\n borderRadius: 4,\n dataBackground: {\n lineStyle: {\n opacity: 0,\n },\n areaStyle: {\n opacity: 1,\n color: theme.palette.secondary.main,\n },\n },\n selectedDataBackground: {\n lineStyle: {\n opacity: 0,\n },\n areaStyle: {\n opacity: 1,\n color: theme.palette.secondary.main,\n },\n },\n handleStyle: {\n color: theme.palette.common.white,\n borderColor: 'rgba(3, 111, 226, 0.08)',\n borderWidth: 1,\n shadowBlur: 3,\n shadowColor: 'rgba(0, 0, 0, 0.1)',\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n },\n textStyle: {\n color: theme.palette.black[60],\n fontSize: parseInt(theme.typography.overlineDelicate.fontSize as string),\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n },\n } as const\n}\n\nexport function getEChartBrushConfig(brush: boolean) {\n return brush\n ? {\n brush: {\n brushType: 'rect',\n brushMode: 'single',\n },\n }\n : {}\n}\n\nexport function getEChartStackConfig(\n stack: boolean,\n stackGroup: string = DEFAULT_STACK_GROUP,\n) {\n return { stack: stack ? stackGroup : undefined }\n}\n"],"names":["DEFAULT_STACK_GROUP","mergeEchartWidgetConfig","options","deepmerge","customMerge","key","_","b","a","length","map","bItem","index","aItem","getEChartZoomConfig","zoom","start","end","inside","xSlider","ySlider","showSliders","xAxisLabelFormatter","theme","sliderStyles","getEChartZoomSliderStyles","dataZoom","throttle","type","xAxisIndex","yAxisIndex","show","zoomLock","orientation","bottom","height","parseInt","spacing","labelFormatter","showDetail","brushSelect","moveHandleSize","handleSize","handleIcon","left","width","filter","d","fillerColor","borderColor","borderWidth","backgroundColor","borderRadius","dataBackground","lineStyle","opacity","areaStyle","color","palette","secondary","main","selectedDataBackground","handleStyle","common","white","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","textStyle","black","fontSize","typography","overlineDelicate","fontFamily","getEChartBrushConfig","brush","brushType","brushMode","getEChartStackConfig","stack","stackGroup","undefined"],"mappings":";AAAO,MAAMA,IAAsB;ACK5B,SAASC,KACXC,GACA;AACH,SAAOC,EAAUD,EAAQ,CAAC,KAAK,CAAA,GAAIA,EAAQ,CAAC,KAAK,IAAI;AAAA,IACnDE,aAAcC,CAAAA,MAAQ;AACpB,UAAIA,MAAQ;AACV,eAAO,CAACC,GAAGC,MAAkBA;AAE/B,UAAIF,MAAQ;AACV,eAAO,CAACG,GAAkBD,MACnBC,EAAEC,SAEcF,GAAGG,IAAI,CAACC,GAAOC,MAAU;AAC5C,gBAAMC,IAAQL,IAAII,CAAK,KAAK,CAAA;AAC5B,iBAAOT,EAAUU,GAAOF,CAAe;AAAA,QACzC,CAAC,IALqBH;AAAAA,IAS5B;AAAA,EAAA,CACD;AACH;AAEO,SAASM,EACdC,GACA;AAAA,EAAEC,OAAAA;AAAAA,EAAOC,KAAAA;AAAoC,IAAI;AAAA,EAAED,OAAO;AAAA,EAAGC,KAAK;AAAI,GACtE;AAAA,EACEC,QAAAA,IAAS;AAAA,EACTC,SAAAA,IAAU;AAAA,EACVC,SAAAA,IAAU;AAAA,EACVC,aAAAA,IAAc;AAAA,EACdC,qBAAAA;AACF,IAAI,CAAA,GAOJC,GACA;AACA,QAAMC,IAAeD,IAAQE,EAA0BF,CAAK,IAAI,CAAA;AAEhE,SAAO;AAAA,IACLG,UAAU,CACRR,KAAU;AAAA,MACRS,UAAU;AAAA,MACVC,MAAM;AAAA,MACNC,YAAYV,IAAU,CAAC,CAAC,IAAI,CAAA;AAAA,MAC5BW,YAAYV,IAAU,CAAC,CAAC,IAAI,CAAA;AAAA,MAC5BW,MAAMhB;AAAAA,MACNiB,UAAU,CAACjB;AAAAA,MACXC,OAAAA;AAAAA,MACAC,KAAAA;AAAAA,IAAAA,GAEFC,KACEE,KAAW;AAAA,MACTO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