@carto/ps-react-ui 4.3.10 → 4.4.1

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.
Files changed (47) hide show
  1. package/dist/types/hooks/use-widget-ref.d.ts +5 -2
  2. package/dist/types/widgets/actions/brush-toggle/brush-toggle.d.ts +21 -0
  3. package/dist/types/widgets/actions/brush-toggle/style.d.ts +13 -0
  4. package/dist/types/widgets/actions/brush-toggle/types.d.ts +33 -0
  5. package/dist/types/widgets/actions/index.d.ts +2 -0
  6. package/dist/types/widgets/echart/types.d.ts +2 -1
  7. package/dist/types/widgets/echart/utils.d.ts +13 -7
  8. package/dist/use-widget-ref-wtFLDFCD.js +25 -0
  9. package/dist/use-widget-ref-wtFLDFCD.js.map +1 -0
  10. package/dist/{utils-idmvq0Oa.js → utils-BOhInag6.js} +95 -70
  11. package/dist/utils-BOhInag6.js.map +1 -0
  12. package/dist/widgets/actions.js +763 -661
  13. package/dist/widgets/actions.js.map +1 -1
  14. package/dist/widgets/bar.js +1 -1
  15. package/dist/widgets/echart.js +85 -82
  16. package/dist/widgets/echart.js.map +1 -1
  17. package/dist/widgets/formula.js +4 -2
  18. package/dist/widgets/formula.js.map +1 -1
  19. package/dist/widgets/histogram.js +1 -1
  20. package/dist/widgets/pie.js +1 -1
  21. package/dist/widgets/scatterplot.js +1 -1
  22. package/dist/widgets/spread.js +4 -2
  23. package/dist/widgets/spread.js.map +1 -1
  24. package/dist/widgets/table.js +4 -2
  25. package/dist/widgets/table.js.map +1 -1
  26. package/dist/widgets/timeseries.js +1 -1
  27. package/dist/widgets.js +1 -1
  28. package/package.json +1 -1
  29. package/src/hooks/use-widget-ref.ts +4 -3
  30. package/src/widgets/actions/brush-toggle/brush-toggle.tsx +220 -0
  31. package/src/widgets/actions/brush-toggle/style.ts +14 -0
  32. package/src/widgets/actions/brush-toggle/types.ts +37 -0
  33. package/src/widgets/actions/index.ts +9 -0
  34. package/src/widgets/actions/lock-selection/lock-selection.tsx +0 -9
  35. package/src/widgets/actions/stack-toggle/stack-toggle.test.tsx +4 -4
  36. package/src/widgets/actions/stack-toggle/stack-toggle.tsx +2 -13
  37. package/src/widgets/actions/zoom-toggle/zoom-toggle.tsx +2 -12
  38. package/src/widgets/echart/echart-ui.tsx +5 -2
  39. package/src/widgets/echart/echart.tsx +1 -1
  40. package/src/widgets/echart/types.ts +2 -1
  41. package/src/widgets/echart/utils.ts +53 -21
  42. package/src/widgets/formula/formula-ui.tsx +1 -1
  43. package/src/widgets/spread/spread-ui.tsx +1 -1
  44. package/src/widgets/table/table-ui.tsx +1 -1
  45. package/dist/use-widget-ref-P-2i0MJG.js +0 -19
  46. package/dist/use-widget-ref-P-2i0MJG.js.map +0 -1
  47. package/dist/utils-idmvq0Oa.js.map +0 -1
@@ -8,10 +8,13 @@
8
8
  * @example
9
9
  * ```tsx
10
10
  * function MyWidget({ id }: { id: string }) {
11
- * const ref = useWidgetRef<HTMLDivElement>(id)
11
+ * const { ref } = useWidgetRef<HTMLDivElement>(id)
12
12
  *
13
13
  * return <div ref={ref}>Widget content</div>
14
14
  * }
15
15
  * ```
16
16
  */
17
- export declare function useWidgetRef<T extends HTMLElement = HTMLElement>(widgetId: string): import('react').RefObject<T | null>;
17
+ export declare function useWidgetRef<T extends HTMLElement = HTMLElement>(widgetId: string): {
18
+ ref: import('react').RefObject<T | null>;
19
+ instance: import('react').RefObject<import('node_modules/echarts').ECharts | null>;
20
+ };
@@ -0,0 +1,21 @@
1
+ import { BrushToggleProps } from './types';
2
+ export declare const BRUSH_TOGGLE_TOOL_ID = "brush-toggle";
3
+ /**
4
+ * Widget action to toggle EChart brush selection functionality.
5
+ *
6
+ * Registers as a config pipeline tool so that brush configuration is automatically
7
+ * re-applied when the base config is updated (e.g., by WidgetLoader).
8
+ *
9
+ * When brush is active, users can drag across bars to select a range.
10
+ * Selection clearing is handled via the chart's brush interactions/toolbox configuration.
11
+ * Only intended for use in fullscreen ToolbarActions for bar and histogram widgets.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <BrushToggle
16
+ * id="my-widget"
17
+ * onBrushSelected={(items) => console.log(items)}
18
+ * />
19
+ * ```
20
+ */
21
+ export declare function BrushToggle({ id, onBrushSelected, labels, Icon, IconButtonProps, }: BrushToggleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { Theme } from '@mui/material';
2
+ export declare const styles: {
3
+ container: {
4
+ display: "flex";
5
+ alignItems: "center";
6
+ gap: ({ spacing }: Theme) => string;
7
+ };
8
+ trigger: {
9
+ '&[data-active="true"]': {
10
+ background: (theme: Theme) => string;
11
+ };
12
+ };
13
+ };
@@ -0,0 +1,33 @@
1
+ import { IconButtonProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ import { BaseWidgetState } from '../../stores/types';
4
+ /**
5
+ * Represents a single item selected by the brush
6
+ */
7
+ export type BrushSelectedItems = (string | number)[];
8
+ /**
9
+ * State stored in widget store for brush functionality
10
+ */
11
+ export interface BrushConfig {
12
+ brush?: boolean;
13
+ }
14
+ export type BrushState<T = unknown> = BaseWidgetState<T & BrushConfig>;
15
+ export interface BrushToggleProps {
16
+ /** Widget ID to update brush state in the widget store */
17
+ id: string;
18
+ /** Callback fired when items are selected via brush */
19
+ onBrushSelected?: (items: BrushSelectedItems) => void;
20
+ /** Custom labels for the action */
21
+ labels?: {
22
+ /** Tooltip when brush is disabled (button will enable brush) */
23
+ enable?: string;
24
+ /** Tooltip when brush is enabled (button will disable brush) */
25
+ disable?: string;
26
+ /** Accessibility label */
27
+ ariaLabel?: string;
28
+ };
29
+ /** Props passed to the IconButton component */
30
+ IconButtonProps?: IconButtonProps;
31
+ /** Custom icon to display for brush toggle */
32
+ Icon?: ReactNode;
33
+ }
@@ -16,3 +16,5 @@ export { ChangeColumn, CHANGE_COLUMN_TOOL_ID, } from './change-column/change-col
16
16
  export type { ChangeColumnProps } from './change-column/types';
17
17
  export { LockSelection, LOCK_SELECTION_TOOL_ID, } from './lock-selection/lock-selection';
18
18
  export type { LockSelectionProps, LockSelectionState, } from './lock-selection/types';
19
+ export { BrushToggle, BRUSH_TOGGLE_TOOL_ID } from './brush-toggle/brush-toggle';
20
+ export type { BrushToggleProps, BrushState, BrushConfig, BrushSelectedItems, } from './brush-toggle/types';
@@ -1,6 +1,6 @@
1
1
  import { EChartsOption } from 'echarts';
2
2
  import { BaseWidgetState } from '../stores/types';
3
- import { Ref } from 'react';
3
+ import { Ref, RefObject } from 'react';
4
4
  import { theme as CartoTheme } from '@carto/meridian-ds/theme';
5
5
  import type * as echarts from 'echarts';
6
6
  export type EchartOptionsProps = EChartsOption;
@@ -21,6 +21,7 @@ export type EchartWidgetState = BaseWidgetState<{
21
21
  option: EchartUIProps['option'];
22
22
  onEvents?: EchartUIProps['onEvents'];
23
23
  init?: EchartUIProps['init'];
24
+ instance?: RefObject<echarts.ECharts | null>;
24
25
  }>;
25
26
  export interface EchartWidgetOptionProps<D> {
26
27
  data?: D;
@@ -1,7 +1,7 @@
1
1
  import { EchartOptionsProps } from './types';
2
2
  import { Theme } from '@mui/material';
3
- export declare function mergeEchartWidgetConfig<T extends EchartOptionsProps>(...options: [T | undefined, T | undefined]): T;
4
- export declare function getEChartZoomConfig(zoom: boolean, { start, end }?: {
3
+ export declare function mergeEchartWidgetConfig<T extends EchartOptionsProps>(optionA: T | undefined, optionB: T | undefined, customMergeFn?: (key: string) => ((a: unknown, b: unknown) => unknown) | undefined): T;
4
+ export declare function getEChartZoomConfig({ start, end }?: {
5
5
  start: number;
6
6
  end: number;
7
7
  }, { inside, xSlider, ySlider, showSliders, xAxisLabelFormatter, bottomOffset, }?: {
@@ -68,14 +68,20 @@ export declare function getEChartZoomConfig(zoom: boolean, { start, end }?: {
68
68
  orientation?: undefined;
69
69
  })[];
70
70
  };
71
- export declare function getEChartBrushConfig(brush: boolean): {
71
+ export declare function getEChartBrushConfig({ brushType, brushMode, xAxisIndex }?: {
72
+ brushType?: string;
73
+ brushMode?: string;
74
+ xAxisIndex?: number;
75
+ throttleType?: string;
76
+ throttleDelay?: number;
77
+ }): {
72
78
  brush: {
79
+ toolbox: string[];
73
80
  brushType: string;
74
81
  brushMode: string;
82
+ xAxisIndex: number;
75
83
  };
76
- } | {
77
- brush?: undefined;
78
84
  };
79
- export declare function getEChartStackConfig(stack: boolean, stackGroup?: string): {
80
- stack: string | undefined;
85
+ export declare function getEChartStackConfig(stackGroup?: string): {
86
+ stack: string;
81
87
  };
@@ -0,0 +1,25 @@
1
+ import { c as i } from "react/compiler-runtime";
2
+ import { useRef as u, useEffect as l } from "react";
3
+ import { u as m } from "./widget-store-CzDt8oSK.js";
4
+ function R(t) {
5
+ const e = i(5), f = u(null), c = u(null), r = m(a);
6
+ let n, o;
7
+ e[0] !== r || e[1] !== t ? (n = () => {
8
+ f.current && r(t, {
9
+ refUI: f,
10
+ instance: c
11
+ });
12
+ }, o = [t, r], e[0] = r, e[1] = t, e[2] = n, e[3] = o) : (n = e[2], o = e[3]), l(n, o);
13
+ let s;
14
+ return e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {
15
+ ref: f,
16
+ instance: c
17
+ }, e[4] = s) : s = e[4], s;
18
+ }
19
+ function a(t) {
20
+ return t.setWidget;
21
+ }
22
+ export {
23
+ R as u
24
+ };
25
+ //# sourceMappingURL=use-widget-ref-wtFLDFCD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-widget-ref-wtFLDFCD.js","sources":["../src/hooks/use-widget-ref.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport { useWidgetStore } from '../widgets/stores/widget-store'\n\n/**\n * Custom hook for registering a DOM element ref with the widget store.\n * This allows other parts of the application to access the widget's DOM element.\n *\n * @param widgetId - The widget ID to register the ref under\n * @returns A ref object to attach to the DOM element\n *\n * @example\n * ```tsx\n * function MyWidget({ id }: { id: string }) {\n * const { ref } = useWidgetRef<HTMLDivElement>(id)\n *\n * return <div ref={ref}>Widget content</div>\n * }\n * ```\n */\nexport function useWidgetRef<T extends HTMLElement = HTMLElement>(\n widgetId: string,\n) {\n const ref = useRef<T | null>(null)\n const instance = useRef<echarts.ECharts | null>(null)\n const setWidget = useWidgetStore((store) => store.setWidget)\n\n useEffect(() => {\n if (ref.current) {\n setWidget(widgetId, { refUI: ref, instance: instance })\n }\n }, [widgetId, setWidget])\n\n return { ref, instance }\n}\n"],"names":["useWidgetRef","widgetId","$","_c","ref","useRef","instance","setWidget","useWidgetStore","_temp","t0","t1","current","refUI","useEffect","t2","Symbol","for","store"],"mappings":";;;AAmBO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAGLC,IAAYC,EAAiB,IAAI,GACjCC,IAAiBD,EAA+B,IAAI,GACpDE,IAAkBC,EAAeC,CAA0B;AAAC,MAAAC,GAAAC;AAAA,EAAAT,EAAA,CAAA,MAAAK,KAAAL,SAAAD,KAElDS,IAAAA,MAAA;AACR,IAAIN,EAAGQ,WACLL,EAAUN,GAAU;AAAA,MAAAY,OAAST;AAAAA,MAAGE,UAAAA;AAAAA,IAAAA,CAAsB;AAAA,EACvD,GACAK,IAAA,CAACV,GAAUM,CAAS,GAACL,OAAAK,GAAAL,OAAAD,GAAAC,OAAAQ,GAAAR,OAAAS,MAAAD,IAAAR,EAAA,CAAA,GAAAS,IAAAT,EAAA,CAAA,IAJxBY,EAAUJ,GAIPC,CAAqB;AAAC,MAAAI;AAAA,SAAAb,EAAA,CAAA,MAAAc,uBAAAC,IAAA,2BAAA,KAElBF,IAAA;AAAA,IAAAX,KAAAA;AAAAA,IAAAE,UAAAA;AAAAA,EAAAA,GAAiBJ,OAAAa,KAAAA,IAAAb,EAAA,CAAA,GAAjBa;AAAiB;AAbnB,SAAAN,EAAAS,GAAA;AAAA,SAKuCA,EAAKX;AAAU;"}
@@ -1,79 +1,98 @@
1
- import { d as n } from "./cjs-D4KH3azB.js";
2
- const y = "stacked";
3
- function h(...e) {
4
- return n(e[0] ?? {}, e[1] ?? {}, {
5
- customMerge: (i) => {
6
- if (i === "color")
7
- return (I, a) => a;
8
- if (i === "series")
9
- return (I, a) => I.length ? a?.map((t, r) => {
10
- const l = I?.[r] ?? {};
11
- return n(l, t);
12
- }) : I;
1
+ import { d } from "./cjs-D4KH3azB.js";
2
+ const m = "stacked";
3
+ function S(o, i, n) {
4
+ return d(o ?? {}, i ?? {}, {
5
+ customMerge: (r) => {
6
+ const l = n?.(r);
7
+ if (l) return l;
8
+ if (r === "color")
9
+ return (t, e) => e;
10
+ if (r === "axisLabel")
11
+ return (t, e) => {
12
+ const g = {
13
+ ...t,
14
+ ...e
15
+ };
16
+ if (typeof t?.formatter == "function" && typeof e?.formatter == "function") {
17
+ const a = t.formatter, c = e.formatter;
18
+ g.formatter = (I) => a(I) === "" ? "" : c(I);
19
+ }
20
+ return g;
21
+ };
22
+ if (r === "series")
23
+ return (t, e) => {
24
+ const g = Math.max(t?.length ?? 0, e?.length ?? 0);
25
+ return Array.from({
26
+ length: g
27
+ }, (a, c) => {
28
+ const I = t?.[c] ?? {}, s = e?.[c] ?? {};
29
+ return d(I, s);
30
+ });
31
+ };
13
32
  }
14
33
  });
15
34
  }
16
- function p(e, {
17
- start: i,
18
- end: I
35
+ function p({
36
+ start: o,
37
+ end: i
19
38
  } = {
20
39
  start: 0,
21
40
  end: 100
22
41
  }, {
23
- inside: a = !0,
24
- xSlider: g = !0,
25
- ySlider: t = !1,
26
- showSliders: r = !0,
27
- xAxisLabelFormatter: l,
28
- bottomOffset: c = 0
29
- } = {}, o) {
30
- const d = o ? m(o) : {};
42
+ inside: n = !0,
43
+ xSlider: r = !0,
44
+ ySlider: l = !1,
45
+ showSliders: t = !0,
46
+ xAxisLabelFormatter: e,
47
+ bottomOffset: g = 0
48
+ } = {}, a) {
49
+ const I = a ? y(a) : {};
31
50
  return {
32
- dataZoom: [a && {
51
+ dataZoom: [n && {
33
52
  throttle: 0,
34
53
  type: "inside",
35
- xAxisIndex: g ? [0] : [],
36
- yAxisIndex: t ? [0] : [],
37
- show: e,
38
- zoomLock: !e,
39
- start: i,
40
- end: I
41
- }, a && t && {
54
+ xAxisIndex: r ? [0] : [],
55
+ yAxisIndex: l ? [0] : [],
56
+ show: !0,
57
+ zoomLock: !1,
58
+ start: o,
59
+ end: i
60
+ }, n && l && {
42
61
  throttle: 0,
43
62
  type: "inside",
44
- show: e,
45
- zoomLock: !e,
46
- start: i,
47
- end: I,
63
+ show: !0,
64
+ zoomLock: !1,
65
+ start: o,
66
+ end: i,
48
67
  orientation: "vertical"
49
- }, g && {
68
+ }, r && {
50
69
  throttle: 0,
51
70
  type: "slider",
52
71
  xAxisIndex: [0],
53
- bottom: c,
54
- height: parseInt(o?.spacing?.(4) ?? "32"),
55
- show: e && r,
56
- zoomLock: !e,
57
- start: i,
58
- end: I,
59
- labelFormatter: l,
72
+ bottom: g,
73
+ height: parseInt(a?.spacing?.(4) ?? "32"),
74
+ show: t,
75
+ zoomLock: !1,
76
+ start: o,
77
+ end: i,
78
+ labelFormatter: e,
60
79
  showDetail: !1,
61
- ...d,
80
+ ...I,
62
81
  brushSelect: !1,
63
82
  moveHandleSize: 8,
64
83
  handleSize: "100%",
65
84
  handleIcon: "image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4="
66
- }, t && {
85
+ }, l && {
67
86
  throttle: 0,
68
87
  type: "slider",
69
- left: parseInt(o?.spacing?.(6) ?? "48"),
70
- width: parseInt(o?.spacing?.(4) ?? "32"),
88
+ left: parseInt(a?.spacing?.(6) ?? "48"),
89
+ width: parseInt(a?.spacing?.(4) ?? "32"),
71
90
  yAxisIndex: [0],
72
- show: e && r,
73
- zoomLock: !e,
74
- start: i,
75
- end: I,
76
- ...d,
91
+ show: t,
92
+ zoomLock: !1,
93
+ start: o,
94
+ end: i,
95
+ ...I,
77
96
  brushSelect: !1,
78
97
  moveHandleSize: 8,
79
98
  handleSize: "100%",
@@ -81,7 +100,7 @@ function p(e, {
81
100
  }].filter((s) => !!s)
82
101
  };
83
102
  }
84
- function m(e) {
103
+ function y(o) {
85
104
  return {
86
105
  fillerColor: "rgba(53, 139, 231, 0.25)",
87
106
  borderColor: "rgba(53, 139, 231, 0.3)",
@@ -94,7 +113,7 @@ function m(e) {
94
113
  },
95
114
  areaStyle: {
96
115
  opacity: 1,
97
- color: e.palette.secondary.main
116
+ color: o.palette.secondary.main
98
117
  }
99
118
  },
100
119
  selectedDataBackground: {
@@ -103,11 +122,11 @@ function m(e) {
103
122
  },
104
123
  areaStyle: {
105
124
  opacity: 1,
106
- color: e.palette.secondary.main
125
+ color: o.palette.secondary.main
107
126
  }
108
127
  },
109
128
  handleStyle: {
110
- color: e.palette.common.white,
129
+ color: o.palette.common.white,
111
130
  borderColor: "rgba(3, 111, 226, 0.08)",
112
131
  borderWidth: 1,
113
132
  shadowBlur: 3,
@@ -116,30 +135,36 @@ function m(e) {
116
135
  shadowOffsetY: 1
117
136
  },
118
137
  textStyle: {
119
- color: e.palette.black[60],
120
- fontSize: parseInt(e.typography.overlineDelicate.fontSize),
121
- fontFamily: e.typography.overlineDelicate.fontFamily
138
+ color: o.palette.black[60],
139
+ fontSize: parseInt(o.typography.overlineDelicate.fontSize),
140
+ fontFamily: o.typography.overlineDelicate.fontFamily
122
141
  }
123
142
  };
124
143
  }
125
- function b(e) {
126
- return e ? {
144
+ function b({
145
+ brushType: o = "lineX",
146
+ brushMode: i = "single",
147
+ xAxisIndex: n = 0
148
+ } = {}) {
149
+ return {
127
150
  brush: {
128
- brushType: "rect",
129
- brushMode: "single"
151
+ toolbox: ["lineX", "clear"],
152
+ brushType: o,
153
+ brushMode: i,
154
+ xAxisIndex: n
130
155
  }
131
- } : {};
156
+ };
132
157
  }
133
- function M(e, i = y) {
158
+ function u(o = m) {
134
159
  return {
135
- stack: e ? i : void 0
160
+ stack: o
136
161
  };
137
162
  }
138
163
  export {
139
- y as D,
140
- M as a,
164
+ m as D,
165
+ u as a,
141
166
  p as b,
142
167
  b as g,
143
- h as m
168
+ S as m
144
169
  };
145
- //# sourceMappingURL=utils-idmvq0Oa.js.map
170
+ //# sourceMappingURL=utils-BOhInag6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-BOhInag6.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 optionA: T | undefined,\n optionB: T | undefined,\n customMergeFn?: (\n key: string,\n ) => ((a: unknown, b: unknown) => unknown) | undefined,\n): T {\n return deepmerge(optionA ?? {}, optionB ?? {}, {\n customMerge: (key) => {\n const externalMerge = customMergeFn?.(key)\n if (externalMerge) return externalMerge\n\n if (key === 'color') {\n return (_, b: T['color']) => b\n }\n if (key === 'axisLabel') {\n return (\n a: Record<string, unknown> | undefined,\n b: Record<string, unknown> | undefined,\n ) => {\n const merged = { ...a, ...b }\n if (\n typeof a?.formatter === 'function' &&\n typeof b?.formatter === 'function'\n ) {\n const baseFormatter = a.formatter as (value: unknown) => unknown\n const customFormatter = b.formatter as (value: unknown) => unknown\n merged.formatter = (value: unknown) => {\n const baseResult = baseFormatter(value)\n if (baseResult === '') return ''\n return customFormatter(value)\n }\n }\n return merged\n }\n }\n if (key === 'series') {\n return (a: T['series'][], b: T['series'][]) => {\n const maxLength = Math.max(a?.length ?? 0, b?.length ?? 0)\n return Array.from({ length: maxLength }, (_, index) => {\n const aItem = a?.[index] ?? {}\n const bItem = b?.[index] ?? {}\n return deepmerge(aItem, bItem as object)\n })\n }\n }\n },\n }) as T\n}\n\nexport function getEChartZoomConfig(\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 bottomOffset = 0,\n } = {} as {\n inside?: boolean\n xSlider?: boolean\n ySlider?: boolean\n showSliders?: boolean\n xAxisLabelFormatter?: (value: number) => string\n bottomOffset?: number\n },\n theme?: Theme,\n) {\n const zoom = true\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: bottomOffset,\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(\n { brushType = 'lineX', brushMode = 'single', xAxisIndex = 0 } = {} as {\n brushType?: string\n brushMode?: string\n xAxisIndex?: number\n throttleType?: string\n throttleDelay?: number\n },\n) {\n return {\n brush: {\n toolbox: ['lineX', 'clear'],\n brushType,\n brushMode,\n xAxisIndex,\n },\n }\n}\n\nexport function getEChartStackConfig(stackGroup: string = DEFAULT_STACK_GROUP) {\n return { stack: stackGroup }\n}\n"],"names":["DEFAULT_STACK_GROUP","mergeEchartWidgetConfig","optionA","optionB","customMergeFn","deepmerge","customMerge","key","externalMerge","_","b","a","merged","formatter","baseFormatter","customFormatter","value","maxLength","Math","max","length","Array","from","index","aItem","bItem","getEChartZoomConfig","start","end","inside","xSlider","ySlider","showSliders","xAxisLabelFormatter","bottomOffset","theme","sliderStyles","getEChartZoomSliderStyles","dataZoom","throttle","type","xAxisIndex","yAxisIndex","show","zoom","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","brushType","brushMode","brush","toolbox","getEChartStackConfig","stackGroup","stack"],"mappings":";AAAO,MAAMA,IAAsB;ACK5B,SAASC,EACdC,GACAC,GACAC,GAGG;AACH,SAAOC,EAAUH,KAAW,IAAIC,KAAW,CAAA,GAAI;AAAA,IAC7CG,aAAcC,CAAAA,MAAQ;AACpB,YAAMC,IAAgBJ,IAAgBG,CAAG;AACzC,UAAIC,EAAe,QAAOA;AAE1B,UAAID,MAAQ;AACV,eAAO,CAACE,GAAGC,MAAkBA;AAE/B,UAAIH,MAAQ;AACV,eAAO,CACLI,GACAD,MACG;AACH,gBAAME,IAAS;AAAA,YAAE,GAAGD;AAAAA,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