@carto/ps-react-ui 4.3.10 → 4.4.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.
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 +12 -6
  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-Cx3gYUcL.js} +74 -68
  11. package/dist/utils-Cx3gYUcL.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 +20 -15
  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
3
  export declare function mergeEchartWidgetConfig<T extends EchartOptionsProps>(...options: [T | undefined, T | undefined]): T;
4
- export declare function getEChartZoomConfig(zoom: boolean, { start, end }?: {
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,87 +1,87 @@
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 h(...o) {
4
+ return d(o[0] ?? {}, o[1] ?? {}, {
5
+ customMerge: (e) => {
6
+ if (e === "color")
7
+ return (i, I) => I;
8
+ if (e === "series")
9
+ return (i, I) => i.length ? I?.map((r, l) => {
10
+ const g = i?.[l] ?? {};
11
+ return d(g, r);
12
+ }) : i;
13
13
  }
14
14
  });
15
15
  }
16
- function p(e, {
17
- start: i,
18
- end: I
16
+ function p({
17
+ start: o,
18
+ end: e
19
19
  } = {
20
20
  start: 0,
21
21
  end: 100
22
22
  }, {
23
- inside: a = !0,
24
- xSlider: g = !0,
25
- ySlider: t = !1,
23
+ inside: i = !0,
24
+ xSlider: I = !0,
25
+ ySlider: a = !1,
26
26
  showSliders: r = !0,
27
27
  xAxisLabelFormatter: l,
28
- bottomOffset: c = 0
29
- } = {}, o) {
30
- const d = o ? m(o) : {};
28
+ bottomOffset: g = 0
29
+ } = {}, t) {
30
+ const n = t ? s(t) : {};
31
31
  return {
32
- dataZoom: [a && {
32
+ dataZoom: [i && {
33
33
  throttle: 0,
34
34
  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 && {
35
+ xAxisIndex: I ? [0] : [],
36
+ yAxisIndex: a ? [0] : [],
37
+ show: !0,
38
+ zoomLock: !1,
39
+ start: o,
40
+ end: e
41
+ }, i && a && {
42
42
  throttle: 0,
43
43
  type: "inside",
44
- show: e,
45
- zoomLock: !e,
46
- start: i,
47
- end: I,
44
+ show: !0,
45
+ zoomLock: !1,
46
+ start: o,
47
+ end: e,
48
48
  orientation: "vertical"
49
- }, g && {
49
+ }, I && {
50
50
  throttle: 0,
51
51
  type: "slider",
52
52
  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,
53
+ bottom: g,
54
+ height: parseInt(t?.spacing?.(4) ?? "32"),
55
+ show: r,
56
+ zoomLock: !1,
57
+ start: o,
58
+ end: e,
59
59
  labelFormatter: l,
60
60
  showDetail: !1,
61
- ...d,
61
+ ...n,
62
62
  brushSelect: !1,
63
63
  moveHandleSize: 8,
64
64
  handleSize: "100%",
65
65
  handleIcon: "image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4="
66
- }, t && {
66
+ }, a && {
67
67
  throttle: 0,
68
68
  type: "slider",
69
- left: parseInt(o?.spacing?.(6) ?? "48"),
70
- width: parseInt(o?.spacing?.(4) ?? "32"),
69
+ left: parseInt(t?.spacing?.(6) ?? "48"),
70
+ width: parseInt(t?.spacing?.(4) ?? "32"),
71
71
  yAxisIndex: [0],
72
- show: e && r,
73
- zoomLock: !e,
74
- start: i,
75
- end: I,
76
- ...d,
72
+ show: r,
73
+ zoomLock: !1,
74
+ start: o,
75
+ end: e,
76
+ ...n,
77
77
  brushSelect: !1,
78
78
  moveHandleSize: 8,
79
79
  handleSize: "100%",
80
80
  handleIcon: "image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDM2IDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iOCIgaGVpZ2h0PSIxOCIgcng9IjQiIHRyYW5zZm9ybT0icm90YXRlKC05MCAwLjUgMC41KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDEzIDYpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTcgNikiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0icm90YXRlKC05MCAyMSA2KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4="
81
- }].filter((s) => !!s)
81
+ }].filter((c) => !!c)
82
82
  };
83
83
  }
84
- function m(e) {
84
+ function s(o) {
85
85
  return {
86
86
  fillerColor: "rgba(53, 139, 231, 0.25)",
87
87
  borderColor: "rgba(53, 139, 231, 0.3)",
@@ -94,7 +94,7 @@ function m(e) {
94
94
  },
95
95
  areaStyle: {
96
96
  opacity: 1,
97
- color: e.palette.secondary.main
97
+ color: o.palette.secondary.main
98
98
  }
99
99
  },
100
100
  selectedDataBackground: {
@@ -103,11 +103,11 @@ function m(e) {
103
103
  },
104
104
  areaStyle: {
105
105
  opacity: 1,
106
- color: e.palette.secondary.main
106
+ color: o.palette.secondary.main
107
107
  }
108
108
  },
109
109
  handleStyle: {
110
- color: e.palette.common.white,
110
+ color: o.palette.common.white,
111
111
  borderColor: "rgba(3, 111, 226, 0.08)",
112
112
  borderWidth: 1,
113
113
  shadowBlur: 3,
@@ -116,30 +116,36 @@ function m(e) {
116
116
  shadowOffsetY: 1
117
117
  },
118
118
  textStyle: {
119
- color: e.palette.black[60],
120
- fontSize: parseInt(e.typography.overlineDelicate.fontSize),
121
- fontFamily: e.typography.overlineDelicate.fontFamily
119
+ color: o.palette.black[60],
120
+ fontSize: parseInt(o.typography.overlineDelicate.fontSize),
121
+ fontFamily: o.typography.overlineDelicate.fontFamily
122
122
  }
123
123
  };
124
124
  }
125
- function b(e) {
126
- return e ? {
125
+ function z({
126
+ brushType: o = "lineX",
127
+ brushMode: e = "single",
128
+ xAxisIndex: i = 0
129
+ } = {}) {
130
+ return {
127
131
  brush: {
128
- brushType: "rect",
129
- brushMode: "single"
132
+ toolbox: ["lineX", "clear"],
133
+ brushType: o,
134
+ brushMode: e,
135
+ xAxisIndex: i
130
136
  }
131
- } : {};
137
+ };
132
138
  }
133
- function M(e, i = y) {
139
+ function b(o = m) {
134
140
  return {
135
- stack: e ? i : void 0
141
+ stack: o
136
142
  };
137
143
  }
138
144
  export {
139
- y as D,
140
- M as a,
145
+ m as D,
146
+ b as a,
141
147
  p as b,
142
- b as g,
148
+ z as g,
143
149
  h as m
144
150
  };
145
- //# sourceMappingURL=utils-idmvq0Oa.js.map
151
+ //# sourceMappingURL=utils-Cx3gYUcL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-Cx3gYUcL.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 { 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","options","deepmerge","customMerge","key","_","b","a","length","map","bItem","index","aItem","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,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,EACd;AAAA,EAAEC,OAAAA;AAAAA,EAAOC,KAAAA;AAAoC,IAAI;AAAA,EAAED,OAAO;AAAA,EAAGC,KAAK;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