deepsea-components 5.17.5 → 5.17.7

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.
@@ -1,6 +1,15 @@
1
1
  "use client"
2
2
  "use strict";
3
3
  var __webpack_require__ = {};
4
+ (()=>{
5
+ __webpack_require__.n = (module)=>{
6
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
7
+ __webpack_require__.d(getter, {
8
+ a: getter
9
+ });
10
+ return getter;
11
+ };
12
+ })();
4
13
  (()=>{
5
14
  __webpack_require__.d = (exports1, definition)=>{
6
15
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -25,53 +34,155 @@ var __webpack_require__ = {};
25
34
  var __webpack_exports__ = {};
26
35
  __webpack_require__.r(__webpack_exports__);
27
36
  __webpack_require__.d(__webpack_exports__, {
37
+ Candlestick: ()=>Candlestick,
28
38
  Pie: ()=>Pie,
39
+ Gauge: ()=>Gauge,
29
40
  Line: ()=>Line,
30
- Bar: ()=>Bar
41
+ Parallel: ()=>Parallel,
42
+ Bar: ()=>Bar,
43
+ Scatter: ()=>Scatter,
44
+ Custom: ()=>Custom,
45
+ EffectScatter: ()=>EffectScatter,
46
+ Radar: ()=>Radar,
47
+ Sunburst: ()=>Sunburst,
48
+ ThemeRiver: ()=>ThemeRiver,
49
+ Chord: ()=>Chord,
50
+ Heatmap: ()=>Heatmap,
51
+ Echart: ()=>Echart,
52
+ Map: ()=>Map,
53
+ Tree: ()=>Tree,
54
+ Treemap: ()=>Treemap,
55
+ PictorialBar: ()=>PictorialBar,
56
+ Sankey: ()=>Sankey,
57
+ Lines: ()=>Lines,
58
+ Funnel: ()=>Funnel,
59
+ Graph: ()=>Graph,
60
+ Boxplot: ()=>Boxplot
31
61
  });
32
62
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
63
  const external_react_namespaceObject = require("react");
34
64
  const external_echarts_namespaceObject = require("echarts");
35
- const Echart = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((props, ref)=>{
36
- const { width, height, option, chart, ...rest } = props;
65
+ const external_stable_hash_namespaceObject = require("stable-hash");
66
+ var external_stable_hash_default = /*#__PURE__*/ __webpack_require__.n(external_stable_hash_namespaceObject);
67
+ function Echart({ ref, width, height, locale, init: initOption, option, chart, ...rest }) {
37
68
  const container = (0, external_react_namespaceObject.useRef)(null);
38
69
  const chartRef = (0, external_react_namespaceObject.useRef)(null);
39
70
  (0, external_react_namespaceObject.useLayoutEffect)(()=>{
40
71
  const ele = container.current;
41
72
  chartRef.current = (0, external_echarts_namespaceObject.init)(ele, option, {
73
+ ...initOption,
42
74
  width,
43
- height
75
+ height,
76
+ locale
44
77
  });
45
78
  return ()=>{
46
79
  var _chartRef_current;
47
80
  return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.dispose();
48
81
  };
49
82
  }, []);
50
- (0, external_react_namespaceObject.useImperativeHandle)(ref, ()=>container.current, []);
51
- (0, external_react_namespaceObject.useImperativeHandle)(chart, ()=>chartRef.current, []);
83
+ (0, external_react_namespaceObject.useImperativeHandle)(ref, ()=>container.current);
84
+ (0, external_react_namespaceObject.useImperativeHandle)(chart, ()=>chartRef.current);
85
+ (0, external_react_namespaceObject.useEffect)(()=>{
86
+ var _chartRef_current;
87
+ return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.setOption(option);
88
+ }, [
89
+ external_stable_hash_default()(option)
90
+ ]);
52
91
  (0, external_react_namespaceObject.useEffect)(()=>{
53
- var _chartRef_current, _chartRef_current1;
54
- null == (_chartRef_current = chartRef.current) || _chartRef_current.setOption(option);
55
- null == (_chartRef_current1 = chartRef.current) || _chartRef_current1.resize({
92
+ var _chartRef_current;
93
+ return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.resize({
56
94
  width,
57
95
  height
58
96
  });
59
- });
97
+ }, [
98
+ width,
99
+ height
100
+ ]);
101
+ (0, external_react_namespaceObject.useEffect)(()=>{
102
+ var _chartRef_current;
103
+ return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.setOption({
104
+ locale
105
+ });
106
+ }, [
107
+ locale
108
+ ]);
60
109
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
61
110
  ref: container,
62
111
  ...rest
63
112
  });
64
- });
65
- const Pie = Echart;
113
+ }
66
114
  const Bar = Echart;
115
+ const Boxplot = Echart;
116
+ const Candlestick = Echart;
117
+ const Chord = Echart;
118
+ const Custom = Echart;
119
+ const EffectScatter = Echart;
120
+ const Funnel = Echart;
121
+ const Gauge = Echart;
122
+ const Graph = Echart;
123
+ const Heatmap = Echart;
67
124
  const Line = Echart;
125
+ const Lines = Echart;
126
+ const Map = Echart;
127
+ const Parallel = Echart;
128
+ const PictorialBar = Echart;
129
+ const Pie = Echart;
130
+ const Radar = Echart;
131
+ const Sankey = Echart;
132
+ const Scatter = Echart;
133
+ const Sunburst = Echart;
134
+ const ThemeRiver = Echart;
135
+ const Tree = Echart;
136
+ const Treemap = Echart;
68
137
  exports.Bar = __webpack_exports__.Bar;
138
+ exports.Boxplot = __webpack_exports__.Boxplot;
139
+ exports.Candlestick = __webpack_exports__.Candlestick;
140
+ exports.Chord = __webpack_exports__.Chord;
141
+ exports.Custom = __webpack_exports__.Custom;
142
+ exports.Echart = __webpack_exports__.Echart;
143
+ exports.EffectScatter = __webpack_exports__.EffectScatter;
144
+ exports.Funnel = __webpack_exports__.Funnel;
145
+ exports.Gauge = __webpack_exports__.Gauge;
146
+ exports.Graph = __webpack_exports__.Graph;
147
+ exports.Heatmap = __webpack_exports__.Heatmap;
69
148
  exports.Line = __webpack_exports__.Line;
149
+ exports.Lines = __webpack_exports__.Lines;
150
+ exports.Map = __webpack_exports__.Map;
151
+ exports.Parallel = __webpack_exports__.Parallel;
152
+ exports.PictorialBar = __webpack_exports__.PictorialBar;
70
153
  exports.Pie = __webpack_exports__.Pie;
154
+ exports.Radar = __webpack_exports__.Radar;
155
+ exports.Sankey = __webpack_exports__.Sankey;
156
+ exports.Scatter = __webpack_exports__.Scatter;
157
+ exports.Sunburst = __webpack_exports__.Sunburst;
158
+ exports.ThemeRiver = __webpack_exports__.ThemeRiver;
159
+ exports.Tree = __webpack_exports__.Tree;
160
+ exports.Treemap = __webpack_exports__.Treemap;
71
161
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
72
162
  "Bar",
163
+ "Boxplot",
164
+ "Candlestick",
165
+ "Chord",
166
+ "Custom",
167
+ "Echart",
168
+ "EffectScatter",
169
+ "Funnel",
170
+ "Gauge",
171
+ "Graph",
172
+ "Heatmap",
73
173
  "Line",
74
- "Pie"
174
+ "Lines",
175
+ "Map",
176
+ "Parallel",
177
+ "PictorialBar",
178
+ "Pie",
179
+ "Radar",
180
+ "Sankey",
181
+ "Scatter",
182
+ "Sunburst",
183
+ "ThemeRiver",
184
+ "Tree",
185
+ "Treemap"
75
186
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
76
187
  Object.defineProperty(exports, '__esModule', {
77
188
  value: true
@@ -1,15 +1,60 @@
1
- import { ComponentPropsWithoutRef, ForwardRefExoticComponent, ForwardedRef, RefAttributes } from "react";
2
- import { BarSeriesOption, ComposeOption, DatasetComponentOption, ECharts, GridComponentOption, LineSeriesOption, PieSeriesOption, TitleComponentOption, TooltipComponentOption } from "echarts";
3
- export type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>;
4
- export type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>;
5
- export type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>;
6
- export interface EchartProps<T extends any = any> extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
7
- width: number;
8
- height: number;
1
+ import { ComponentProps, FC, ReactNode, Ref } from "react";
2
+ import { AngleAxisComponentOption, AriaComponentOption, AxisPointerComponentOption, BarSeriesOption, BoxplotSeriesOption, BrushComponentOption, CalendarComponentOption, CandlestickSeriesOption, ChordSeriesOption, ComposeOption, ContinousVisualMapComponentOption, CustomSeriesOption, DataZoomComponentOption, DatasetComponentOption, ECharts, EChartsInitOpts, EffectScatterSeriesOption, FunnelSeriesOption, GaugeSeriesOption, GeoComponentOption, GraphSeriesOption, GraphicComponentOption, GridComponentOption, HeatmapSeriesOption, InsideDataZoomComponentOption, LegendComponentOption, LineSeriesOption, LinesSeriesOption, MapSeriesOption, MarkAreaComponentOption, MarkLineComponentOption, MarkPointComponentOption, MatrixComponentOption, ParallelSeriesOption, PictorialBarSeriesOption, PieSeriesOption, PiecewiseVisualMapComponentOption, PlainLegendComponentOption, PolarComponentOption, RadarComponentOption, RadarSeriesOption, RadiusAxisComponentOption, SankeySeriesOption, ScatterSeriesOption, ScrollableLegendComponentOption, SeriesOption, SingleAxisComponentOption, SliderDataZoomComponentOption, SunburstSeriesOption, ThemeRiverSeriesOption, ThumbnailComponentOption, TimelineComponentOption, TitleComponentOption, ToolboxComponentOption, TooltipComponentOption, TreeSeriesOption, TreemapSeriesOption, VisualMapComponentOption, XAXisComponentOption, YAXisComponentOption } from "echarts";
3
+ import { ECBasicOption } from "echarts/types/src/util/types.js";
4
+ export type ChartOption<T extends SeriesOption = never> = ComposeOption<T | DatasetComponentOption | GridComponentOption | LegendComponentOption | TitleComponentOption | TooltipComponentOption | AxisPointerComponentOption | GeoComponentOption | MarkLineComponentOption | MarkPointComponentOption | MarkAreaComponentOption | DataZoomComponentOption | AriaComponentOption | BrushComponentOption | PolarComponentOption | RadarComponentOption | XAXisComponentOption | YAXisComponentOption | MatrixComponentOption | GraphicComponentOption | ToolboxComponentOption | CalendarComponentOption | TimelineComponentOption | AngleAxisComponentOption | RadiusAxisComponentOption | SingleAxisComponentOption | VisualMapComponentOption | ThumbnailComponentOption | PlainLegendComponentOption | InsideDataZoomComponentOption | SliderDataZoomComponentOption | PiecewiseVisualMapComponentOption | ContinousVisualMapComponentOption | ScrollableLegendComponentOption>;
5
+ export type BarOption = ChartOption<BarSeriesOption>;
6
+ export type BoxplotOption = ChartOption<BoxplotSeriesOption>;
7
+ export type CandlestickOption = ChartOption<CandlestickSeriesOption>;
8
+ export type ChordOption = ChartOption<ChordSeriesOption>;
9
+ export type CustomOption = ChartOption<CustomSeriesOption>;
10
+ export type EffectScatterOption = ChartOption<EffectScatterSeriesOption>;
11
+ export type FunnelOption = ChartOption<FunnelSeriesOption>;
12
+ export type GaugeOption = ChartOption<GaugeSeriesOption>;
13
+ export type GraphOption = ChartOption<GraphSeriesOption>;
14
+ export type HeatmapOption = ChartOption<HeatmapSeriesOption>;
15
+ export type LineOption = ChartOption<LineSeriesOption>;
16
+ export type LinesOption = ChartOption<LinesSeriesOption>;
17
+ export type MapOption = ChartOption<MapSeriesOption>;
18
+ export type ParallelOption = ChartOption<ParallelSeriesOption>;
19
+ export type PictorialBarOption = ChartOption<PictorialBarSeriesOption>;
20
+ export type PieOption = ChartOption<PieSeriesOption>;
21
+ export type RadarOption = ChartOption<RadarSeriesOption>;
22
+ export type SankeyOption = ChartOption<SankeySeriesOption>;
23
+ export type ScatterOption = ChartOption<ScatterSeriesOption>;
24
+ export type SunburstOption = ChartOption<SunburstSeriesOption>;
25
+ export type ThemeRiverOption = ChartOption<ThemeRiverSeriesOption>;
26
+ export type TreeOption = ChartOption<TreeSeriesOption>;
27
+ export type TreemapOption = ChartOption<TreemapSeriesOption>;
28
+ export type ModifiableEChartsInitOpts = Pick<EChartsInitOpts, "width" | "height" | "locale">;
29
+ export interface EChartInitOption extends Omit<EChartsInitOpts, keyof ModifiableEChartsInitOpts> {
30
+ }
31
+ export interface EchartProps<T extends ECBasicOption = ECBasicOption> extends Omit<ComponentProps<"div">, "children">, ModifiableEChartsInitOpts {
32
+ init?: EChartInitOption;
9
33
  option: T;
10
- chart?: ForwardedRef<ECharts>;
34
+ chart?: Ref<ECharts>;
11
35
  }
12
- export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>>;
13
- export declare const Pie: EchartComponent<PieOption>;
36
+ export type EchartComponent<T extends ECBasicOption = ECBasicOption> = FC<EchartProps<T>>;
37
+ export declare function Echart<T extends ECBasicOption = ECBasicOption>({ ref, width, height, locale, init: initOption, option, chart, ...rest }: EchartProps<T>): ReactNode;
14
38
  export declare const Bar: EchartComponent<BarOption>;
39
+ export declare const Boxplot: EchartComponent<BoxplotOption>;
40
+ export declare const Candlestick: EchartComponent<CandlestickOption>;
41
+ export declare const Chord: EchartComponent<ChordOption>;
42
+ export declare const Custom: EchartComponent<CustomOption>;
43
+ export declare const EffectScatter: EchartComponent<EffectScatterOption>;
44
+ export declare const Funnel: EchartComponent<FunnelOption>;
45
+ export declare const Gauge: EchartComponent<GaugeOption>;
46
+ export declare const Graph: EchartComponent<GraphOption>;
47
+ export declare const Heatmap: EchartComponent<HeatmapOption>;
15
48
  export declare const Line: EchartComponent<LineOption>;
49
+ export declare const Lines: EchartComponent<LinesOption>;
50
+ export declare const Map: EchartComponent<MapOption>;
51
+ export declare const Parallel: EchartComponent<ParallelOption>;
52
+ export declare const PictorialBar: EchartComponent<PictorialBarOption>;
53
+ export declare const Pie: EchartComponent<PieOption>;
54
+ export declare const Radar: EchartComponent<RadarOption>;
55
+ export declare const Sankey: EchartComponent<SankeyOption>;
56
+ export declare const Scatter: EchartComponent<ScatterOption>;
57
+ export declare const Sunburst: EchartComponent<SunburstOption>;
58
+ export declare const ThemeRiver: EchartComponent<ThemeRiverOption>;
59
+ export declare const Tree: EchartComponent<TreeOption>;
60
+ export declare const Treemap: EchartComponent<TreemapOption>;
@@ -1,38 +1,76 @@
1
1
  "use client"
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
3
+ import { useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
4
4
  import { init } from "echarts";
5
- const Echart = /*#__PURE__*/ forwardRef((props, ref)=>{
6
- const { width, height, option, chart, ...rest } = props;
5
+ import stable_hash from "stable-hash";
6
+ function Echart({ ref, width, height, locale, init: initOption, option, chart, ...rest }) {
7
7
  const container = useRef(null);
8
8
  const chartRef = useRef(null);
9
9
  useLayoutEffect(()=>{
10
10
  const ele = container.current;
11
11
  chartRef.current = init(ele, option, {
12
+ ...initOption,
12
13
  width,
13
- height
14
+ height,
15
+ locale
14
16
  });
15
17
  return ()=>{
16
18
  var _chartRef_current;
17
19
  return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.dispose();
18
20
  };
19
21
  }, []);
20
- useImperativeHandle(ref, ()=>container.current, []);
21
- useImperativeHandle(chart, ()=>chartRef.current, []);
22
+ useImperativeHandle(ref, ()=>container.current);
23
+ useImperativeHandle(chart, ()=>chartRef.current);
24
+ useEffect(()=>{
25
+ var _chartRef_current;
26
+ return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.setOption(option);
27
+ }, [
28
+ stable_hash(option)
29
+ ]);
22
30
  useEffect(()=>{
23
- var _chartRef_current, _chartRef_current1;
24
- null == (_chartRef_current = chartRef.current) || _chartRef_current.setOption(option);
25
- null == (_chartRef_current1 = chartRef.current) || _chartRef_current1.resize({
31
+ var _chartRef_current;
32
+ return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.resize({
26
33
  width,
27
34
  height
28
35
  });
29
- });
36
+ }, [
37
+ width,
38
+ height
39
+ ]);
40
+ useEffect(()=>{
41
+ var _chartRef_current;
42
+ return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.setOption({
43
+ locale
44
+ });
45
+ }, [
46
+ locale
47
+ ]);
30
48
  return /*#__PURE__*/ jsx("div", {
31
49
  ref: container,
32
50
  ...rest
33
51
  });
34
- });
35
- const Pie = Echart;
52
+ }
36
53
  const Bar = Echart;
54
+ const Boxplot = Echart;
55
+ const Candlestick = Echart;
56
+ const Chord = Echart;
57
+ const Custom = Echart;
58
+ const EffectScatter = Echart;
59
+ const Funnel = Echart;
60
+ const Gauge = Echart;
61
+ const Graph = Echart;
62
+ const Heatmap = Echart;
37
63
  const Line = Echart;
38
- export { Bar, Line, Pie };
64
+ const Lines = Echart;
65
+ const Map = Echart;
66
+ const Parallel = Echart;
67
+ const PictorialBar = Echart;
68
+ const Pie = Echart;
69
+ const Radar = Echart;
70
+ const Sankey = Echart;
71
+ const Scatter = Echart;
72
+ const Sunburst = Echart;
73
+ const ThemeRiver = Echart;
74
+ const Tree = Echart;
75
+ const Treemap = Echart;
76
+ export { Bar, Boxplot, Candlestick, Chord, Custom, Echart, EffectScatter, Funnel, Gauge, Graph, Heatmap, Line, Lines, Map, Parallel, PictorialBar, Pie, Radar, Sankey, Scatter, Sunburst, ThemeRiver, Tree, Treemap };
@@ -68,11 +68,6 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
68
68
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
69
69
  ref: wrapper,
70
70
  className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
71
- display: flex;
72
- flex-direction: ${flexDirection};
73
- gap: ${gap}px;
74
- ${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
75
-
76
71
  @keyframes deepsea-horizontal-loop-swipe {
77
72
  from {
78
73
  transform: translateX(0);
@@ -108,6 +103,11 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
108
103
  transform: translateY(calc(100% + ${gap}px));
109
104
  }
110
105
  }
106
+ `, (0, css_namespaceObject.css)`
107
+ display: flex;
108
+ flex-direction: ${flexDirection};
109
+ gap: ${gap}px;
110
+ ${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
111
111
 
112
112
  ${pauseOnHover ? `&:hover > * {
113
113
  animation-play-state: paused;
@@ -119,6 +119,7 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
119
119
  ref: container,
120
120
  className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
121
121
  display: flex;
122
+ flex: none;
122
123
  flex-direction: ${flexDirection};
123
124
  gap: ${gap}px;
124
125
  animation-name: ${animationName};
@@ -131,6 +132,7 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
131
132
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
132
133
  className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
133
134
  display: ${swiper ? "flex" : "none"};
135
+ flex: none;
134
136
  flex-direction: ${flexDirection};
135
137
  gap: ${gap}px;
136
138
  animation-name: ${animationName};
@@ -40,11 +40,6 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
40
40
  return /*#__PURE__*/ jsxs("div", {
41
41
  ref: wrapper,
42
42
  className: clsx(css`
43
- display: flex;
44
- flex-direction: ${flexDirection};
45
- gap: ${gap}px;
46
- ${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
47
-
48
43
  @keyframes deepsea-horizontal-loop-swipe {
49
44
  from {
50
45
  transform: translateX(0);
@@ -80,6 +75,11 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
80
75
  transform: translateY(calc(100% + ${gap}px));
81
76
  }
82
77
  }
78
+ `, css`
79
+ display: flex;
80
+ flex-direction: ${flexDirection};
81
+ gap: ${gap}px;
82
+ ${"vertical" === direction ? "overflow-y: hidden;" : "overflow-x: hidden;"}
83
83
 
84
84
  ${pauseOnHover ? `&:hover > * {
85
85
  animation-play-state: paused;
@@ -91,6 +91,7 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
91
91
  ref: container,
92
92
  className: clsx(css`
93
93
  display: flex;
94
+ flex: none;
94
95
  flex-direction: ${flexDirection};
95
96
  gap: ${gap}px;
96
97
  animation-name: ${animationName};
@@ -103,6 +104,7 @@ const LoopSwiper = ({ ref, className, classNames: { root: rootClassName, contain
103
104
  /*#__PURE__*/ jsx("div", {
104
105
  className: clsx(css`
105
106
  display: ${swiper ? "flex" : "none"};
107
+ flex: none;
106
108
  flex-direction: ${flexDirection};
107
109
  gap: ${gap}px;
108
110
  animation-name: ${animationName};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepsea-components",
3
- "version": "5.17.5",
3
+ "version": "5.17.7",
4
4
  "description": "格数科技自用组件库",
5
5
  "type": "module",
6
6
  "exports": {
@@ -40,6 +40,7 @@
40
40
  "echarts": "^6.0.0",
41
41
  "hls.js": "^1.6.13",
42
42
  "smooth-scrollbar": "^8.8.4",
43
+ "stable-hash": "^0.0.6",
43
44
  "deepsea-tools": "5.42.4",
44
45
  "soda-hooks": "6.15.2"
45
46
  },
@@ -1,69 +1,242 @@
1
1
  "use client"
2
2
 
3
+ import { ComponentProps, FC, ReactNode, Ref, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react"
3
4
  import {
4
- ComponentPropsWithoutRef,
5
- ForwardRefExoticComponent,
6
- ForwardedRef,
7
- RefAttributes,
8
- forwardRef,
9
- useEffect,
10
- useImperativeHandle,
11
- useLayoutEffect,
12
- useRef,
13
- } from "react"
14
- import {
5
+ AngleAxisComponentOption,
6
+ AriaComponentOption,
7
+ AxisPointerComponentOption,
15
8
  BarSeriesOption,
9
+ BoxplotSeriesOption,
10
+ BrushComponentOption,
11
+ CalendarComponentOption,
12
+ CandlestickSeriesOption,
13
+ ChordSeriesOption,
16
14
  ComposeOption,
15
+ ContinousVisualMapComponentOption,
16
+ CustomSeriesOption,
17
+ DataZoomComponentOption,
17
18
  DatasetComponentOption,
18
19
  ECharts,
20
+ EChartsInitOpts,
21
+ EffectScatterSeriesOption,
22
+ FunnelSeriesOption,
23
+ GaugeSeriesOption,
24
+ GeoComponentOption,
25
+ GraphSeriesOption,
26
+ GraphicComponentOption,
19
27
  GridComponentOption,
28
+ HeatmapSeriesOption,
29
+ InsideDataZoomComponentOption,
30
+ LegendComponentOption,
20
31
  LineSeriesOption,
32
+ LinesSeriesOption,
33
+ MapSeriesOption,
34
+ MarkAreaComponentOption,
35
+ MarkLineComponentOption,
36
+ MarkPointComponentOption,
37
+ MatrixComponentOption,
38
+ ParallelSeriesOption,
39
+ PictorialBarSeriesOption,
21
40
  PieSeriesOption,
41
+ PiecewiseVisualMapComponentOption,
42
+ PlainLegendComponentOption,
43
+ PolarComponentOption,
44
+ RadarComponentOption,
45
+ RadarSeriesOption,
46
+ RadiusAxisComponentOption,
47
+ SankeySeriesOption,
48
+ ScatterSeriesOption,
49
+ ScrollableLegendComponentOption,
50
+ SeriesOption,
51
+ SingleAxisComponentOption,
52
+ SliderDataZoomComponentOption,
53
+ SunburstSeriesOption,
54
+ ThemeRiverSeriesOption,
55
+ ThumbnailComponentOption,
56
+ TimelineComponentOption,
22
57
  TitleComponentOption,
58
+ ToolboxComponentOption,
23
59
  TooltipComponentOption,
60
+ TreeSeriesOption,
61
+ TreemapSeriesOption,
62
+ VisualMapComponentOption,
63
+ XAXisComponentOption,
64
+ YAXisComponentOption,
24
65
  init,
25
66
  } from "echarts"
67
+ import { ECBasicOption } from "echarts/types/src/util/types.js"
68
+ import hash from "stable-hash"
69
+
70
+ export type ChartOption<T extends SeriesOption = never> = ComposeOption<
71
+ | T
72
+ | DatasetComponentOption
73
+ | GridComponentOption
74
+ | LegendComponentOption
75
+ | TitleComponentOption
76
+ | TooltipComponentOption
77
+ | AxisPointerComponentOption
78
+ | GeoComponentOption
79
+ | MarkLineComponentOption
80
+ | MarkPointComponentOption
81
+ | MarkAreaComponentOption
82
+ | DataZoomComponentOption
83
+ | AriaComponentOption
84
+ | BrushComponentOption
85
+ | PolarComponentOption
86
+ | RadarComponentOption
87
+ | XAXisComponentOption
88
+ | YAXisComponentOption
89
+ | MatrixComponentOption
90
+ | GraphicComponentOption
91
+ | ToolboxComponentOption
92
+ | CalendarComponentOption
93
+ | TimelineComponentOption
94
+ | AngleAxisComponentOption
95
+ | RadiusAxisComponentOption
96
+ | SingleAxisComponentOption
97
+ | VisualMapComponentOption
98
+ | ThumbnailComponentOption
99
+ | PlainLegendComponentOption
100
+ | InsideDataZoomComponentOption
101
+ | SliderDataZoomComponentOption
102
+ | PiecewiseVisualMapComponentOption
103
+ | ContinousVisualMapComponentOption
104
+ | ScrollableLegendComponentOption
105
+ >
106
+
107
+ export type BarOption = ChartOption<BarSeriesOption>
108
+
109
+ export type BoxplotOption = ChartOption<BoxplotSeriesOption>
110
+
111
+ export type CandlestickOption = ChartOption<CandlestickSeriesOption>
112
+
113
+ export type ChordOption = ChartOption<ChordSeriesOption>
114
+
115
+ export type CustomOption = ChartOption<CustomSeriesOption>
116
+
117
+ export type EffectScatterOption = ChartOption<EffectScatterSeriesOption>
118
+
119
+ export type FunnelOption = ChartOption<FunnelSeriesOption>
120
+
121
+ export type GaugeOption = ChartOption<GaugeSeriesOption>
122
+
123
+ export type GraphOption = ChartOption<GraphSeriesOption>
124
+
125
+ export type HeatmapOption = ChartOption<HeatmapSeriesOption>
126
+
127
+ export type LineOption = ChartOption<LineSeriesOption>
26
128
 
27
- export type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
129
+ export type LinesOption = ChartOption<LinesSeriesOption>
28
130
 
29
- export type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
131
+ export type MapOption = ChartOption<MapSeriesOption>
30
132
 
31
- export type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
133
+ export type ParallelOption = ChartOption<ParallelSeriesOption>
32
134
 
33
- export interface EchartProps<T extends any = any> extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
34
- width: number
35
- height: number
135
+ export type PictorialBarOption = ChartOption<PictorialBarSeriesOption>
136
+
137
+ export type PieOption = ChartOption<PieSeriesOption>
138
+
139
+ export type RadarOption = ChartOption<RadarSeriesOption>
140
+
141
+ export type SankeyOption = ChartOption<SankeySeriesOption>
142
+
143
+ export type ScatterOption = ChartOption<ScatterSeriesOption>
144
+
145
+ export type SunburstOption = ChartOption<SunburstSeriesOption>
146
+
147
+ export type ThemeRiverOption = ChartOption<ThemeRiverSeriesOption>
148
+
149
+ export type TreeOption = ChartOption<TreeSeriesOption>
150
+
151
+ export type TreemapOption = ChartOption<TreemapSeriesOption>
152
+
153
+ export type ModifiableEChartsInitOpts = Pick<EChartsInitOpts, "width" | "height" | "locale">
154
+
155
+ export interface EChartInitOption extends Omit<EChartsInitOpts, keyof ModifiableEChartsInitOpts> {}
156
+
157
+ export interface EchartProps<T extends ECBasicOption = ECBasicOption> extends Omit<ComponentProps<"div">, "children">, ModifiableEChartsInitOpts {
158
+ init?: EChartInitOption
36
159
  option: T
37
- chart?: ForwardedRef<ECharts>
160
+ chart?: Ref<ECharts>
38
161
  }
39
162
 
40
- export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<
41
- Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>
42
- >
163
+ export type EchartComponent<T extends ECBasicOption = ECBasicOption> = FC<EchartProps<T>>
43
164
 
44
- const Echart = forwardRef<HTMLDivElement, EchartProps>((props, ref) => {
45
- const { width, height, option, chart, ...rest } = props
165
+ export function Echart<T extends ECBasicOption = ECBasicOption>({
166
+ ref,
167
+ width,
168
+ height,
169
+ locale,
170
+ init: initOption,
171
+ option,
172
+ chart,
173
+ ...rest
174
+ }: EchartProps<T>): ReactNode {
46
175
  const container = useRef<HTMLDivElement>(null)
47
176
  const chartRef = useRef<ECharts | null>(null)
48
177
 
49
178
  useLayoutEffect(() => {
50
179
  const ele = container.current!
51
- chartRef.current = init(ele, option, { width, height })
180
+ chartRef.current = init(ele, option, { ...initOption, width, height, locale })
52
181
  return () => chartRef.current?.dispose()
53
182
  }, [])
54
183
 
55
- useImperativeHandle(ref, () => container.current!, [])
184
+ useImperativeHandle(ref, () => container.current!)
185
+
186
+ useImperativeHandle(chart, () => chartRef.current!)
56
187
 
57
- useImperativeHandle(chart, () => chartRef.current!, [])
188
+ useEffect(() => chartRef.current?.setOption(option), [hash(option)])
58
189
 
59
- useEffect(() => {
60
- chartRef.current?.setOption(option)
61
- chartRef.current?.resize({ width, height })
62
- })
190
+ // @ts-expect-error width and height can be string
191
+ useEffect(() => chartRef.current?.resize({ width, height }), [width, height])
192
+
193
+ useEffect(() => chartRef.current?.setOption({ locale }), [locale])
63
194
 
64
195
  return <div ref={container} {...rest} />
65
- })
196
+ }
66
197
 
67
- export const Pie = Echart as EchartComponent<PieOption>
68
198
  export const Bar = Echart as EchartComponent<BarOption>
199
+
200
+ export const Boxplot = Echart as EchartComponent<BoxplotOption>
201
+
202
+ export const Candlestick = Echart as EchartComponent<CandlestickOption>
203
+
204
+ export const Chord = Echart as EchartComponent<ChordOption>
205
+
206
+ export const Custom = Echart as EchartComponent<CustomOption>
207
+
208
+ export const EffectScatter = Echart as EchartComponent<EffectScatterOption>
209
+
210
+ export const Funnel = Echart as EchartComponent<FunnelOption>
211
+
212
+ export const Gauge = Echart as EchartComponent<GaugeOption>
213
+
214
+ export const Graph = Echart as EchartComponent<GraphOption>
215
+
216
+ export const Heatmap = Echart as EchartComponent<HeatmapOption>
217
+
69
218
  export const Line = Echart as EchartComponent<LineOption>
219
+
220
+ export const Lines = Echart as EchartComponent<LinesOption>
221
+
222
+ export const Map = Echart as EchartComponent<MapOption>
223
+
224
+ export const Parallel = Echart as EchartComponent<ParallelOption>
225
+
226
+ export const PictorialBar = Echart as EchartComponent<PictorialBarOption>
227
+
228
+ export const Pie = Echart as EchartComponent<PieOption>
229
+
230
+ export const Radar = Echart as EchartComponent<RadarOption>
231
+
232
+ export const Sankey = Echart as EchartComponent<SankeyOption>
233
+
234
+ export const Scatter = Echart as EchartComponent<ScatterOption>
235
+
236
+ export const Sunburst = Echart as EchartComponent<SunburstOption>
237
+
238
+ export const ThemeRiver = Echart as EchartComponent<ThemeRiverOption>
239
+
240
+ export const Tree = Echart as EchartComponent<TreeOption>
241
+
242
+ export const Treemap = Echart as EchartComponent<TreemapOption>
@@ -84,11 +84,6 @@ export const LoopSwiper: FC<LoopSwiperProps> = ({
84
84
  ref={wrapper}
85
85
  className={clsx(
86
86
  css`
87
- display: flex;
88
- flex-direction: ${flexDirection};
89
- gap: ${gap}px;
90
- ${direction === "vertical" ? "overflow-y: hidden;" : "overflow-x: hidden;"}
91
-
92
87
  @keyframes deepsea-horizontal-loop-swipe {
93
88
  from {
94
89
  transform: translateX(0);
@@ -124,6 +119,12 @@ export const LoopSwiper: FC<LoopSwiperProps> = ({
124
119
  transform: translateY(calc(100% + ${gap}px));
125
120
  }
126
121
  }
122
+ `,
123
+ css`
124
+ display: flex;
125
+ flex-direction: ${flexDirection};
126
+ gap: ${gap}px;
127
+ ${direction === "vertical" ? "overflow-y: hidden;" : "overflow-x: hidden;"}
127
128
 
128
129
  ${pauseOnHover
129
130
  ? `&:hover > * {
@@ -141,6 +142,7 @@ export const LoopSwiper: FC<LoopSwiperProps> = ({
141
142
  className={clsx(
142
143
  css`
143
144
  display: flex;
145
+ flex: none;
144
146
  flex-direction: ${flexDirection};
145
147
  gap: ${gap}px;
146
148
  animation-name: ${animationName};
@@ -157,6 +159,7 @@ export const LoopSwiper: FC<LoopSwiperProps> = ({
157
159
  className={clsx(
158
160
  css`
159
161
  display: ${swiper ? "flex" : "none"};
162
+ flex: none;
160
163
  flex-direction: ${flexDirection};
161
164
  gap: ${gap}px;
162
165
  animation-name: ${animationName};