deepsea-components 5.15.21 → 5.15.23
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/README.md +23 -23
- package/dist/components/AutoFit.cjs +7 -7
- package/dist/components/AutoFit.js +7 -7
- package/dist/components/AutoScroll.cjs +7 -7
- package/dist/components/AutoScroll.js +7 -7
- package/dist/components/AutoSizeTextarea.cjs +4 -4
- package/dist/components/AutoSizeTextarea.js +4 -4
- package/dist/components/Flow.cjs +16 -16
- package/dist/components/Flow.js +16 -16
- package/dist/components/FormLabel.cjs +1 -1
- package/dist/components/FormLabel.js +1 -1
- package/dist/components/InfiniteScroll.cjs +13 -13
- package/dist/components/InfiniteScroll.js +13 -13
- package/dist/components/LoopSwiper.cjs +33 -33
- package/dist/components/LoopSwiper.js +33 -33
- package/dist/components/Scroll.cjs +13 -13
- package/dist/components/Scroll.js +13 -13
- package/dist/components/ScrollMask.module.cjs +2 -2
- package/dist/components/ScrollMask.module.js +2 -2
- package/dist/components/Skeleton.cjs +17 -17
- package/dist/components/Skeleton.js +17 -17
- package/dist/components/TransitionNum.cjs +1 -1
- package/dist/components/TransitionNum.js +1 -1
- package/dist/components/Trapezium.cjs +4 -4
- package/dist/components/Trapezium.js +4 -4
- package/package.json +4 -3
- package/src/components/AutoFit.tsx +104 -104
- package/src/components/AutoScroll.tsx +150 -150
- package/src/components/AutoSizeTextarea.tsx +50 -50
- package/src/components/CircleText.tsx +81 -81
- package/src/components/CopyButton.tsx +31 -31
- package/src/components/Echart.tsx +69 -69
- package/src/components/Flow.tsx +271 -271
- package/src/components/FormLabel.tsx +41 -41
- package/src/components/HlsPlayer.tsx +34 -34
- package/src/components/IconFileType.tsx +162 -162
- package/src/components/InfiniteScroll.tsx +163 -163
- package/src/components/InputFile.tsx +93 -93
- package/src/components/InputFileButton.tsx +122 -122
- package/src/components/LoopSwiper.tsx +125 -125
- package/src/components/ReadExcel.tsx +13 -13
- package/src/components/ReadSheet.tsx +17 -17
- package/src/components/Ring.tsx +30 -30
- package/src/components/Scroll.tsx +97 -97
- package/src/components/ScrollMask.module.css +87 -87
- package/src/components/ScrollMask.tsx +68 -68
- package/src/components/SectionRing.tsx +40 -40
- package/src/components/Skeleton.tsx +45 -45
- package/src/components/Title.tsx +27 -27
- package/src/components/TransitionBox.tsx +44 -44
- package/src/components/TransitionNum.tsx +54 -54
- package/src/components/Trapezium.tsx +60 -60
- package/src/components/Unify.tsx +38 -38
- package/src/components/WriteExcel.tsx +13 -13
- package/src/components/WriteSheet.tsx +25 -25
- package/src/utils/getReactVersion.ts +7 -7
- package/src/utils/index.ts +33 -33
- package/tsconfig.json +16 -16
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
BarSeriesOption,
|
|
5
|
-
ComposeOption,
|
|
6
|
-
DatasetComponentOption,
|
|
7
|
-
ECharts,
|
|
8
|
-
GridComponentOption,
|
|
9
|
-
LineSeriesOption,
|
|
10
|
-
PieSeriesOption,
|
|
11
|
-
TitleComponentOption,
|
|
12
|
-
TooltipComponentOption,
|
|
13
|
-
init,
|
|
14
|
-
} from "echarts"
|
|
15
|
-
import {
|
|
16
|
-
ComponentPropsWithoutRef,
|
|
17
|
-
ForwardRefExoticComponent,
|
|
18
|
-
ForwardedRef,
|
|
19
|
-
RefAttributes,
|
|
20
|
-
forwardRef,
|
|
21
|
-
useEffect,
|
|
22
|
-
useImperativeHandle,
|
|
23
|
-
useLayoutEffect,
|
|
24
|
-
useRef,
|
|
25
|
-
} from "react"
|
|
26
|
-
|
|
27
|
-
export type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
28
|
-
|
|
29
|
-
export type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
30
|
-
|
|
31
|
-
export type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
32
|
-
|
|
33
|
-
export interface EchartProps<T extends any = any> extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
34
|
-
width: number
|
|
35
|
-
height: number
|
|
36
|
-
option: T
|
|
37
|
-
chart?: ForwardedRef<ECharts>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<
|
|
41
|
-
Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
const Echart = forwardRef<HTMLDivElement, EchartProps>((props, ref) => {
|
|
45
|
-
const { width, height, option, chart, ...rest } = props
|
|
46
|
-
const container = useRef<HTMLDivElement>(null)
|
|
47
|
-
const chartRef = useRef<ECharts | null>(null)
|
|
48
|
-
|
|
49
|
-
useLayoutEffect(() => {
|
|
50
|
-
const ele = container.current!
|
|
51
|
-
chartRef.current = init(ele, option, { width, height })
|
|
52
|
-
return () => chartRef.current?.dispose()
|
|
53
|
-
}, [])
|
|
54
|
-
|
|
55
|
-
useImperativeHandle(ref, () => container.current!, [])
|
|
56
|
-
|
|
57
|
-
useImperativeHandle(chart, () => chartRef.current!, [])
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
chartRef.current?.setOption(option)
|
|
61
|
-
chartRef.current?.resize({ width, height })
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
return <div ref={container} {...rest} />
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
export const Pie = Echart as EchartComponent<PieOption>
|
|
68
|
-
export const Bar = Echart as EchartComponent<BarOption>
|
|
69
|
-
export const Line = Echart as EchartComponent<LineOption>
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BarSeriesOption,
|
|
5
|
+
ComposeOption,
|
|
6
|
+
DatasetComponentOption,
|
|
7
|
+
ECharts,
|
|
8
|
+
GridComponentOption,
|
|
9
|
+
LineSeriesOption,
|
|
10
|
+
PieSeriesOption,
|
|
11
|
+
TitleComponentOption,
|
|
12
|
+
TooltipComponentOption,
|
|
13
|
+
init,
|
|
14
|
+
} from "echarts"
|
|
15
|
+
import {
|
|
16
|
+
ComponentPropsWithoutRef,
|
|
17
|
+
ForwardRefExoticComponent,
|
|
18
|
+
ForwardedRef,
|
|
19
|
+
RefAttributes,
|
|
20
|
+
forwardRef,
|
|
21
|
+
useEffect,
|
|
22
|
+
useImperativeHandle,
|
|
23
|
+
useLayoutEffect,
|
|
24
|
+
useRef,
|
|
25
|
+
} from "react"
|
|
26
|
+
|
|
27
|
+
export type PieOption = ComposeOption<PieSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
28
|
+
|
|
29
|
+
export type BarOption = ComposeOption<BarSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
30
|
+
|
|
31
|
+
export type LineOption = ComposeOption<LineSeriesOption | TitleComponentOption | DatasetComponentOption | GridComponentOption | TooltipComponentOption>
|
|
32
|
+
|
|
33
|
+
export interface EchartProps<T extends any = any> extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
34
|
+
width: number
|
|
35
|
+
height: number
|
|
36
|
+
option: T
|
|
37
|
+
chart?: ForwardedRef<ECharts>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type EchartComponent<T extends PieOption | BarOption | LineOption> = ForwardRefExoticComponent<
|
|
41
|
+
Omit<EchartProps<T>, "ref"> & RefAttributes<HTMLDivElement>
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
const Echart = forwardRef<HTMLDivElement, EchartProps>((props, ref) => {
|
|
45
|
+
const { width, height, option, chart, ...rest } = props
|
|
46
|
+
const container = useRef<HTMLDivElement>(null)
|
|
47
|
+
const chartRef = useRef<ECharts | null>(null)
|
|
48
|
+
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
const ele = container.current!
|
|
51
|
+
chartRef.current = init(ele, option, { width, height })
|
|
52
|
+
return () => chartRef.current?.dispose()
|
|
53
|
+
}, [])
|
|
54
|
+
|
|
55
|
+
useImperativeHandle(ref, () => container.current!, [])
|
|
56
|
+
|
|
57
|
+
useImperativeHandle(chart, () => chartRef.current!, [])
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
chartRef.current?.setOption(option)
|
|
61
|
+
chartRef.current?.resize({ width, height })
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
return <div ref={container} {...rest} />
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
export const Pie = Echart as EchartComponent<PieOption>
|
|
68
|
+
export const Bar = Echart as EchartComponent<BarOption>
|
|
69
|
+
export const Line = Echart as EchartComponent<LineOption>
|