deepsea-components 5.1.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Echart.d.ts +15 -0
- package/dist/cjs/components/Echart.js +55 -0
- package/dist/cjs/components/Echart.js.map +7 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/components/Echart.d.ts +15 -0
- package/dist/esm/components/Echart.d.ts.map +1 -0
- package/dist/esm/components/Echart.js +39 -0
- package/dist/esm/components/Echart.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/Echart.tsx +44 -0
- package/src/index.tsx +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BarSeriesOption, ComposeOption, DatasetComponentOption, ECharts, GridComponentOption, LineSeriesOption, PieSeriesOption, TitleComponentOption, TooltipComponentOption } from "echarts";
|
|
2
|
+
import { ComponentProps, ForwardedRef, ForwardRefExoticComponent, RefAttributes } from "react";
|
|
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<ComponentProps<"div">, "children"> {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
option: T;
|
|
10
|
+
chart?: ForwardedRef<ECharts>;
|
|
11
|
+
}
|
|
12
|
+
export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const Pie: EchartComponent<PieOption>;
|
|
14
|
+
export declare const Bar: EchartComponent<BarOption>;
|
|
15
|
+
export declare const Line: EchartComponent<LineOption>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/Echart.tsx
|
|
20
|
+
var Echart_exports = {};
|
|
21
|
+
__export(Echart_exports, {
|
|
22
|
+
Bar: () => Bar,
|
|
23
|
+
Line: () => Line,
|
|
24
|
+
Pie: () => Pie
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(Echart_exports);
|
|
27
|
+
var import_echarts = require("echarts");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var Echart = (0, import_react.forwardRef)((props, ref) => {
|
|
30
|
+
const { width, height, option, chart, ...rest } = props;
|
|
31
|
+
const container = (0, import_react.useRef)(null);
|
|
32
|
+
const chartRef = (0, import_react.useRef)(null);
|
|
33
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
34
|
+
const ele = container.current;
|
|
35
|
+
chartRef.current = (0, import_echarts.init)(ele, option, { width, height });
|
|
36
|
+
return () => chartRef.current?.dispose();
|
|
37
|
+
}, []);
|
|
38
|
+
(0, import_react.useImperativeHandle)(ref, () => container.current, []);
|
|
39
|
+
(0, import_react.useImperativeHandle)(chart, () => chartRef.current, []);
|
|
40
|
+
(0, import_react.useEffect)(() => {
|
|
41
|
+
chartRef.current?.setOption(option);
|
|
42
|
+
chartRef.current?.resize({ width, height });
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ React.createElement("div", { ref: container, ...rest });
|
|
45
|
+
});
|
|
46
|
+
var Pie = Echart;
|
|
47
|
+
var Bar = Echart;
|
|
48
|
+
var Line = Echart;
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
Bar,
|
|
52
|
+
Line,
|
|
53
|
+
Pie
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=Echart.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Echart.tsx"],
|
|
4
|
+
"sourcesContent": ["import { BarSeriesOption, ComposeOption, DatasetComponentOption, ECharts, GridComponentOption, init, LineSeriesOption, PieSeriesOption, TitleComponentOption, TooltipComponentOption } from \"echarts\"\r\nimport { ComponentProps, ForwardedRef, forwardRef, ForwardRefExoticComponent, RefAttributes, useEffect, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\r\n\r\nexport type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>\r\n\r\nexport type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>\r\n\r\nexport type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>\r\n\r\nexport interface EchartProps<T extends any = any> extends Omit<ComponentProps<\"div\">, \"children\"> {\r\n width: number\r\n height: number\r\n option: T\r\n chart?: ForwardedRef<ECharts>\r\n}\r\n\r\nexport type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<Omit<EchartProps<T>, \"ref\"> & RefAttributes<HTMLDivElement>>\r\n\r\nconst Echart = forwardRef<HTMLDivElement, EchartProps>((props, ref) => {\r\n const { width, height, option, chart, ...rest } = props\r\n const container = useRef<HTMLDivElement>(null)\r\n const chartRef = useRef<ECharts | null>(null)\r\n\r\n useLayoutEffect(() => {\r\n const ele = container.current!\r\n chartRef.current = init(ele, option, { width, height })\r\n return () => chartRef.current?.dispose()\r\n }, [])\r\n\r\n useImperativeHandle(ref, () => container.current!, [])\r\n\r\n useImperativeHandle(chart, () => chartRef.current!, [])\r\n\r\n useEffect(() => {\r\n chartRef.current?.setOption(option)\r\n chartRef.current?.resize({ width, height })\r\n })\r\n\r\n return <div ref={container} {...rest} />\r\n})\r\n\r\nexport const Pie = Echart as EchartComponent<PieOption>\r\nexport const Bar = Echart as EchartComponent<BarOption>\r\nexport const Line = Echart as EchartComponent<LineOption>\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA4L;AAC5L,mBAA4J;AAiB5J,IAAM,aAAS,yBAAwC,CAAC,OAAO,QAAQ;AACnE,QAAM,EAAE,OAAO,QAAQ,QAAQ,OAAO,GAAG,KAAK,IAAI;AAClD,QAAM,gBAAY,qBAAuB,IAAI;AAC7C,QAAM,eAAW,qBAAuB,IAAI;AAE5C,oCAAgB,MAAM;AAClB,UAAM,MAAM,UAAU;AACtB,aAAS,cAAU,qBAAK,KAAK,QAAQ,EAAE,OAAO,OAAO,CAAC;AACtD,WAAO,MAAM,SAAS,SAAS,QAAQ;AAAA,EAC3C,GAAG,CAAC,CAAC;AAEL,wCAAoB,KAAK,MAAM,UAAU,SAAU,CAAC,CAAC;AAErD,wCAAoB,OAAO,MAAM,SAAS,SAAU,CAAC,CAAC;AAEtD,8BAAU,MAAM;AACZ,aAAS,SAAS,UAAU,MAAM;AAClC,aAAS,SAAS,OAAO,EAAE,OAAO,OAAO,CAAC;AAAA,EAC9C,CAAC;AAED,SAAO,oCAAC,SAAI,KAAK,WAAY,GAAG,MAAM;AAC1C,CAAC;AAEM,IAAM,MAAM;AACZ,IAAM,MAAM;AACZ,IAAM,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __reExport(src_exports, require("./components/Skeleton"), module.exports);
|
|
|
32
32
|
__reExport(src_exports, require("./components/TransitionBox"), module.exports);
|
|
33
33
|
__reExport(src_exports, require("./components/TransitionNum"), module.exports);
|
|
34
34
|
__reExport(src_exports, require("./components/Trapezium"), module.exports);
|
|
35
|
+
__reExport(src_exports, require("./components/Echart"), module.exports);
|
|
35
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
37
|
0 && (module.exports = {
|
|
37
38
|
...require("./components/AutoFit"),
|
|
@@ -49,6 +50,7 @@ __reExport(src_exports, require("./components/Trapezium"), module.exports);
|
|
|
49
50
|
...require("./components/Skeleton"),
|
|
50
51
|
...require("./components/TransitionBox"),
|
|
51
52
|
...require("./components/TransitionNum"),
|
|
52
|
-
...require("./components/Trapezium")
|
|
53
|
+
...require("./components/Trapezium"),
|
|
54
|
+
...require("./components/Echart")
|
|
53
55
|
});
|
|
54
56
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["export * from \"./components/AutoFit\"\r\nexport * from \"./components/AutoScroll\"\r\nexport * from \"./components/AutoSizeTextarea\"\r\nexport * from \"./components/CircleText\"\r\nexport * from \"./components/Flow\"\r\nexport * from \"./components/HlsPlayer\"\r\nexport * from \"./components/InfiniteScroll\"\r\nexport * from \"./components/InputFile\"\r\nexport * from \"./components/LoopSwiper\"\r\nexport * from \"./components/Ring\"\r\nexport * from \"./components/Scroll\"\r\nexport * from \"./components/SectionRing\"\r\nexport * from \"./components/Skeleton\"\r\nexport * from \"./components/TransitionBox\"\r\nexport * from \"./components/TransitionNum\"\r\nexport * from \"./components/Trapezium\"\r\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,iCAAd;AACA,wBAAc,oCADd;AAEA,wBAAc,0CAFd;AAGA,wBAAc,oCAHd;AAIA,wBAAc,8BAJd;AAKA,wBAAc,mCALd;AAMA,wBAAc,wCANd;AAOA,wBAAc,mCAPd;AAQA,wBAAc,oCARd;AASA,wBAAc,8BATd;AAUA,wBAAc,gCAVd;AAWA,wBAAc,qCAXd;AAYA,wBAAc,kCAZd;AAaA,wBAAc,uCAbd;AAcA,wBAAc,uCAdd;AAeA,wBAAc,mCAfd;",
|
|
4
|
+
"sourcesContent": ["export * from \"./components/AutoFit\"\r\nexport * from \"./components/AutoScroll\"\r\nexport * from \"./components/AutoSizeTextarea\"\r\nexport * from \"./components/CircleText\"\r\nexport * from \"./components/Flow\"\r\nexport * from \"./components/HlsPlayer\"\r\nexport * from \"./components/InfiniteScroll\"\r\nexport * from \"./components/InputFile\"\r\nexport * from \"./components/LoopSwiper\"\r\nexport * from \"./components/Ring\"\r\nexport * from \"./components/Scroll\"\r\nexport * from \"./components/SectionRing\"\r\nexport * from \"./components/Skeleton\"\r\nexport * from \"./components/TransitionBox\"\r\nexport * from \"./components/TransitionNum\"\r\nexport * from \"./components/Trapezium\"\r\nexport * from \"./components/Echart\""],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,iCAAd;AACA,wBAAc,oCADd;AAEA,wBAAc,0CAFd;AAGA,wBAAc,oCAHd;AAIA,wBAAc,8BAJd;AAKA,wBAAc,mCALd;AAMA,wBAAc,wCANd;AAOA,wBAAc,mCAPd;AAQA,wBAAc,oCARd;AASA,wBAAc,8BATd;AAUA,wBAAc,gCAVd;AAWA,wBAAc,qCAXd;AAYA,wBAAc,kCAZd;AAaA,wBAAc,uCAbd;AAcA,wBAAc,uCAdd;AAeA,wBAAc,mCAfd;AAgBA,wBAAc,gCAhBd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BarSeriesOption, ComposeOption, DatasetComponentOption, ECharts, GridComponentOption, LineSeriesOption, PieSeriesOption, TitleComponentOption, TooltipComponentOption } from "echarts";
|
|
2
|
+
import { ComponentProps, ForwardedRef, ForwardRefExoticComponent, RefAttributes } from "react";
|
|
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<ComponentProps<"div">, "children"> {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
option: T;
|
|
10
|
+
chart?: ForwardedRef<ECharts>;
|
|
11
|
+
}
|
|
12
|
+
export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const Pie: EchartComponent<PieOption>;
|
|
14
|
+
export declare const Bar: EchartComponent<BarOption>;
|
|
15
|
+
export declare const Line: EchartComponent<LineOption>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Echart.d.ts","sourceRoot":"","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0 +1,39 @@
|
|
|
1
|
+
import { init } from "echarts";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const Echart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
5
|
+
const {
|
|
6
|
+
width,
|
|
7
|
+
height,
|
|
8
|
+
option,
|
|
9
|
+
chart,
|
|
10
|
+
...rest
|
|
11
|
+
} = props;
|
|
12
|
+
const container = useRef(null);
|
|
13
|
+
const chartRef = useRef(null);
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
const ele = container.current;
|
|
16
|
+
chartRef.current = init(ele, option, {
|
|
17
|
+
width,
|
|
18
|
+
height
|
|
19
|
+
});
|
|
20
|
+
return () => chartRef.current?.dispose();
|
|
21
|
+
}, []);
|
|
22
|
+
useImperativeHandle(ref, () => container.current, []);
|
|
23
|
+
useImperativeHandle(chart, () => chartRef.current, []);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
chartRef.current?.setOption(option);
|
|
26
|
+
chartRef.current?.resize({
|
|
27
|
+
width,
|
|
28
|
+
height
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return /*#__PURE__*/_jsx("div", {
|
|
32
|
+
ref: container,
|
|
33
|
+
...rest
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
export const Pie = Echart;
|
|
37
|
+
export const Bar = Echart;
|
|
38
|
+
export const Line = Echart;
|
|
39
|
+
//# sourceMappingURL=Echart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["init","forwardRef","useEffect","useImperativeHandle","useLayoutEffect","useRef","jsx","_jsx","Echart","props","ref","width","height","option","chart","rest","container","chartRef","ele","current","dispose","setOption","resize","Pie","Bar","Line"],"sources":["../../../src/components/Echart.tsx"],"sourcesContent":["import { BarSeriesOption, ComposeOption, DatasetComponentOption, ECharts, GridComponentOption, init, LineSeriesOption, PieSeriesOption, TitleComponentOption, TooltipComponentOption } from \"echarts\"\r\nimport { ComponentProps, ForwardedRef, forwardRef, ForwardRefExoticComponent, RefAttributes, useEffect, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\r\n\r\nexport type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>\r\n\r\nexport type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>\r\n\r\nexport type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>\r\n\r\nexport interface EchartProps<T extends any = any> extends Omit<ComponentProps<\"div\">, \"children\"> {\r\n width: number\r\n height: number\r\n option: T\r\n chart?: ForwardedRef<ECharts>\r\n}\r\n\r\nexport type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<Omit<EchartProps<T>, \"ref\"> & RefAttributes<HTMLDivElement>>\r\n\r\nconst Echart = forwardRef<HTMLDivElement, EchartProps>((props, ref) => {\r\n const { width, height, option, chart, ...rest } = props\r\n const container = useRef<HTMLDivElement>(null)\r\n const chartRef = useRef<ECharts | null>(null)\r\n\r\n useLayoutEffect(() => {\r\n const ele = container.current!\r\n chartRef.current = init(ele, option, { width, height })\r\n return () => chartRef.current?.dispose()\r\n }, [])\r\n\r\n useImperativeHandle(ref, () => container.current!, [])\r\n\r\n useImperativeHandle(chart, () => chartRef.current!, [])\r\n\r\n useEffect(() => {\r\n chartRef.current?.setOption(option)\r\n chartRef.current?.resize({ width, height })\r\n })\r\n\r\n return <div ref={container} {...rest} />\r\n})\r\n\r\nexport const Pie = Echart as EchartComponent<PieOption>\r\nexport const Bar = Echart as EchartComponent<BarOption>\r\nexport const Line = Echart as EchartComponent<LineOption>\r\n"],"mappings":"AAAA,SAA+FA,IAAI,QAAyF,SAAS;AACrM,SAAuCC,UAAU,EAA4CC,SAAS,EAAEC,mBAAmB,EAAEC,eAAe,EAA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index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":["export * from \"./components/AutoFit\"\r\nexport * from \"./components/AutoScroll\"\r\nexport * from \"./components/AutoSizeTextarea\"\r\nexport * from \"./components/CircleText\"\r\nexport * from \"./components/Flow\"\r\nexport * from \"./components/HlsPlayer\"\r\nexport * from \"./components/InfiniteScroll\"\r\nexport * from \"./components/InputFile\"\r\nexport * from \"./components/LoopSwiper\"\r\nexport * from \"./components/Ring\"\r\nexport * from \"./components/Scroll\"\r\nexport * from \"./components/SectionRing\"\r\nexport * from \"./components/Skeleton\"\r\nexport * from \"./components/TransitionBox\"\r\nexport * from \"./components/TransitionNum\"\r\nexport * from \"./components/Trapezium\"\r\
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":["export * from \"./components/AutoFit\"\r\nexport * from \"./components/AutoScroll\"\r\nexport * from \"./components/AutoSizeTextarea\"\r\nexport * from \"./components/CircleText\"\r\nexport * from \"./components/Flow\"\r\nexport * from \"./components/HlsPlayer\"\r\nexport * from \"./components/InfiniteScroll\"\r\nexport * from \"./components/InputFile\"\r\nexport * from \"./components/LoopSwiper\"\r\nexport * from \"./components/Ring\"\r\nexport * from \"./components/Scroll\"\r\nexport * from \"./components/SectionRing\"\r\nexport * from \"./components/Skeleton\"\r\nexport * from \"./components/TransitionBox\"\r\nexport * from \"./components/TransitionNum\"\r\nexport * from \"./components/Trapezium\"\r\nexport * from \"./components/Echart\""],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepsea-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "格数科技自用组件库",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@emotion/css": "^11.11.2",
|
|
28
28
|
"ahooks": "^3.7.11",
|
|
29
|
+
"echarts": "^5.5.0",
|
|
29
30
|
"hls.js": "^1.5.8",
|
|
30
31
|
"smooth-scrollbar": "^8.8.4",
|
|
31
32
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BarSeriesOption, ComposeOption, DatasetComponentOption, ECharts, GridComponentOption, init, LineSeriesOption, PieSeriesOption, TitleComponentOption, TooltipComponentOption } from "echarts"
|
|
2
|
+
import { ComponentProps, ForwardedRef, forwardRef, ForwardRefExoticComponent, RefAttributes, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react"
|
|
3
|
+
|
|
4
|
+
export type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
5
|
+
|
|
6
|
+
export type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
7
|
+
|
|
8
|
+
export type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
9
|
+
|
|
10
|
+
export interface EchartProps<T extends any = any> extends Omit<ComponentProps<"div">, "children"> {
|
|
11
|
+
width: number
|
|
12
|
+
height: number
|
|
13
|
+
option: T
|
|
14
|
+
chart?: ForwardedRef<ECharts>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>>
|
|
18
|
+
|
|
19
|
+
const Echart = forwardRef<HTMLDivElement, EchartProps>((props, ref) => {
|
|
20
|
+
const { width, height, option, chart, ...rest } = props
|
|
21
|
+
const container = useRef<HTMLDivElement>(null)
|
|
22
|
+
const chartRef = useRef<ECharts | null>(null)
|
|
23
|
+
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
const ele = container.current!
|
|
26
|
+
chartRef.current = init(ele, option, { width, height })
|
|
27
|
+
return () => chartRef.current?.dispose()
|
|
28
|
+
}, [])
|
|
29
|
+
|
|
30
|
+
useImperativeHandle(ref, () => container.current!, [])
|
|
31
|
+
|
|
32
|
+
useImperativeHandle(chart, () => chartRef.current!, [])
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
chartRef.current?.setOption(option)
|
|
36
|
+
chartRef.current?.resize({ width, height })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return <div ref={container} {...rest} />
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const Pie = Echart as EchartComponent<PieOption>
|
|
43
|
+
export const Bar = Echart as EchartComponent<BarOption>
|
|
44
|
+
export const Line = Echart as EchartComponent<LineOption>
|
package/src/index.tsx
CHANGED