deepsea-components 5.15.23 → 5.15.25
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 +6 -6
- package/dist/components/AutoFit.js +29 -29
- package/dist/components/AutoScroll.cjs +7 -7
- package/dist/components/AutoScroll.js +30 -30
- package/dist/components/AutoSizeTextarea.cjs +4 -4
- package/dist/components/AutoSizeTextarea.js +17 -17
- package/dist/components/CircleText.js +4 -4
- package/dist/components/CopyButton.cjs +2 -2
- package/dist/components/CopyButton.js +13 -14
- package/dist/components/Echart.cjs +2 -2
- package/dist/components/Echart.js +12 -12
- package/dist/components/Flow.cjs +19 -19
- package/dist/components/Flow.js +44 -44
- package/dist/components/FormLabel.cjs +2 -2
- package/dist/components/FormLabel.js +8 -8
- package/dist/components/HlsPlayer.js +10 -10
- package/dist/components/IconFileType.cjs +4 -4
- package/dist/components/IconFileType.js +9 -9
- package/dist/components/InfiniteScroll.cjs +13 -13
- package/dist/components/InfiniteScroll.js +32 -32
- package/dist/components/InputFile.js +4 -4
- package/dist/components/InputFileButton.js +11 -11
- package/dist/components/LoopSwiper.cjs +33 -33
- package/dist/components/LoopSwiper.js +47 -47
- package/dist/components/ReadExcel.js +2 -2
- package/dist/components/ReadSheet.js +5 -5
- package/dist/components/Ring.js +4 -4
- package/dist/components/Scroll.cjs +15 -15
- package/dist/components/Scroll.js +32 -33
- package/dist/components/ScrollMask.js +13 -13
- package/dist/components/SectionRing.js +6 -6
- package/dist/components/Skeleton.cjs +17 -17
- package/dist/components/Skeleton.js +23 -23
- package/dist/components/Title.js +12 -12
- package/dist/components/TransitionBox.js +10 -10
- package/dist/components/TransitionNum.js +11 -11
- package/dist/components/Trapezium.cjs +4 -4
- package/dist/components/Trapezium.js +14 -14
- package/dist/components/Unify.js +10 -10
- package/dist/components/WriteExcel.js +2 -2
- package/dist/components/WriteSheet.js +4 -4
- package/dist/utils/getReactVersion.js +2 -2
- package/package.json +5 -5
- 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
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# deepsea-components
|
|
2
|
-
|
|
3
|
-
[](https://npmjs.org/package/deepsea-components)
|
|
4
|
-
[](https://npmjs.org/package/deepsea-components)
|
|
5
|
-
|
|
6
|
-
## Install
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
$ yarn install
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
$ npm run dev
|
|
14
|
-
$ npm run build
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Options
|
|
18
|
-
|
|
19
|
-
TODO
|
|
20
|
-
|
|
21
|
-
## LICENSE
|
|
22
|
-
|
|
23
|
-
MIT
|
|
1
|
+
# deepsea-components
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.org/package/deepsea-components)
|
|
4
|
+
[](https://npmjs.org/package/deepsea-components)
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
$ yarn install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
$ npm run dev
|
|
14
|
+
$ npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
TODO
|
|
20
|
+
|
|
21
|
+
## LICENSE
|
|
22
|
+
|
|
23
|
+
MIT
|
|
@@ -92,12 +92,12 @@ const AutoFit = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((pr
|
|
|
92
92
|
});
|
|
93
93
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
94
94
|
ref: ele,
|
|
95
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
96
|
-
position: absolute;
|
|
97
|
-
transform: var(--transform);
|
|
98
|
-
transform-origin: top left;
|
|
99
|
-
width: var(--width);
|
|
100
|
-
height: var(--height);
|
|
95
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
96
|
+
position: absolute;
|
|
97
|
+
transform: var(--transform);
|
|
98
|
+
transform-origin: top left;
|
|
99
|
+
width: var(--width);
|
|
100
|
+
height: var(--height);
|
|
101
101
|
`, className),
|
|
102
102
|
style: (0, index_cjs_namespaceObject.transformCSSVariable)({
|
|
103
103
|
transform,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const AutoFit = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "@emotion/css";
|
|
4
|
+
import { clsx } from "deepsea-tools";
|
|
5
|
+
import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { px, transformCSSVariable } from "../utils/index.js";
|
|
7
|
+
const AutoFit = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
8
|
const { width: designWidth = 1920, height: designHeight = 1080, direction, className, style, ...rest } = props;
|
|
9
|
-
const ele =
|
|
10
|
-
const [show, setShow] =
|
|
11
|
-
const [transform, setTransform] =
|
|
12
|
-
const [width, setWidth] =
|
|
13
|
-
const [height, setHeight] =
|
|
14
|
-
|
|
9
|
+
const ele = useRef(null);
|
|
10
|
+
const [show, setShow] = useState(false);
|
|
11
|
+
const [transform, setTransform] = useState(void 0);
|
|
12
|
+
const [width, setWidth] = useState(void 0);
|
|
13
|
+
const [height, setHeight] = useState(void 0);
|
|
14
|
+
useImperativeHandle(ref, ()=>ele.current, [
|
|
15
15
|
ele.current
|
|
16
16
|
]);
|
|
17
|
-
|
|
17
|
+
useLayoutEffect(()=>{
|
|
18
18
|
const element = ele.current;
|
|
19
19
|
const parent = element?.parentElement;
|
|
20
20
|
if (!element || !parent) return;
|
|
@@ -24,18 +24,18 @@ const AutoFit = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(
|
|
|
24
24
|
if ("horizontal" === direction) {
|
|
25
25
|
const scale = contentRect.width / designWidth;
|
|
26
26
|
setTransform(`scale(${scale})`);
|
|
27
|
-
setWidth(
|
|
28
|
-
setHeight(
|
|
27
|
+
setWidth(px(designWidth));
|
|
28
|
+
setHeight(px(contentRect.height / scale));
|
|
29
29
|
} else if ("vertical" === direction) {
|
|
30
30
|
const scale = contentRect.height / designHeight;
|
|
31
31
|
setTransform(`scale(${scale})`);
|
|
32
|
-
setWidth(
|
|
33
|
-
setHeight(
|
|
32
|
+
setWidth(px(contentRect.width / scale));
|
|
33
|
+
setHeight(px(designHeight));
|
|
34
34
|
} else {
|
|
35
35
|
const scale = Math.min(contentRect.width / designWidth, contentRect.height / designHeight);
|
|
36
36
|
setTransform(`translateX(${(contentRect.width - designWidth * scale) / 2}px) translateY(${(contentRect.height - designHeight * scale) / 2}px) scale(${scale})`);
|
|
37
|
-
setWidth(
|
|
38
|
-
setHeight(
|
|
37
|
+
setWidth(px(designWidth));
|
|
38
|
+
setHeight(px(designHeight));
|
|
39
39
|
}
|
|
40
40
|
setShow(true);
|
|
41
41
|
}
|
|
@@ -48,7 +48,7 @@ const AutoFit = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(
|
|
|
48
48
|
designHeight,
|
|
49
49
|
direction
|
|
50
50
|
]);
|
|
51
|
-
if ("development" === process.env.NODE_ENV)
|
|
51
|
+
if ("development" === process.env.NODE_ENV) useEffect(()=>{
|
|
52
52
|
const parent = ele.current?.parentElement;
|
|
53
53
|
if (!parent) return;
|
|
54
54
|
const style = getComputedStyle(parent);
|
|
@@ -56,22 +56,22 @@ const AutoFit = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(
|
|
|
56
56
|
}, [
|
|
57
57
|
ele.current?.parentElement
|
|
58
58
|
]);
|
|
59
|
-
if (!show) return /*#__PURE__*/
|
|
59
|
+
if (!show) return /*#__PURE__*/ jsx("div", {
|
|
60
60
|
ref: ele,
|
|
61
61
|
style: {
|
|
62
62
|
display: "none"
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
return /*#__PURE__*/
|
|
65
|
+
return /*#__PURE__*/ jsx("div", {
|
|
66
66
|
ref: ele,
|
|
67
|
-
className:
|
|
68
|
-
position: absolute;
|
|
69
|
-
transform: var(--transform);
|
|
70
|
-
transform-origin: top left;
|
|
71
|
-
width: var(--width);
|
|
72
|
-
height: var(--height);
|
|
67
|
+
className: clsx(css`
|
|
68
|
+
position: absolute;
|
|
69
|
+
transform: var(--transform);
|
|
70
|
+
transform-origin: top left;
|
|
71
|
+
width: var(--width);
|
|
72
|
+
height: var(--height);
|
|
73
73
|
`, className),
|
|
74
|
-
style:
|
|
74
|
+
style: transformCSSVariable({
|
|
75
75
|
transform,
|
|
76
76
|
width,
|
|
77
77
|
height
|
|
@@ -101,13 +101,13 @@ const AutoScroll = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(
|
|
|
101
101
|
onMouseLeave: onContainerMouseLeave,
|
|
102
102
|
...rest,
|
|
103
103
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
104
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
105
|
-
display: flex;
|
|
106
|
-
flex-direction: column;
|
|
107
|
-
gap: var(--gap, 0);
|
|
108
|
-
& > * {
|
|
109
|
-
flex: none;
|
|
110
|
-
}
|
|
104
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
gap: var(--gap, 0);
|
|
108
|
+
& > * {
|
|
109
|
+
flex: none;
|
|
110
|
+
}
|
|
111
111
|
`, containerClassName),
|
|
112
112
|
style: (0, index_cjs_namespaceObject.transformCSSVariable)({
|
|
113
113
|
gap: (0, index_cjs_namespaceObject.px)(gap)
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const AutoScroll = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "@emotion/css";
|
|
4
|
+
import { clsx, getArray } from "deepsea-tools";
|
|
5
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
6
|
+
import { useSize } from "soda-hooks";
|
|
7
|
+
import { px, transformCSSVariable } from "../utils/index.js";
|
|
8
|
+
import { Scroll } from "./Scroll.js";
|
|
9
|
+
const AutoScroll = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
10
10
|
const { count, itemHeight, animation = 1000, duration = 3000, onMouseEnter, onMouseLeave, gap = 0, containerClassName, containerStyle, children, playOnMouseEnter, scrollbar, paused, ...rest } = props;
|
|
11
|
-
const bar =
|
|
12
|
-
const timeout =
|
|
13
|
-
const ele =
|
|
14
|
-
const size =
|
|
15
|
-
const pausedRef =
|
|
16
|
-
const pausedProps =
|
|
11
|
+
const bar = useRef(null);
|
|
12
|
+
const timeout = useRef(void 0);
|
|
13
|
+
const ele = useRef(null);
|
|
14
|
+
const size = useSize(ele);
|
|
15
|
+
const pausedRef = useRef(false);
|
|
16
|
+
const pausedProps = useRef(paused);
|
|
17
17
|
pausedProps.current = paused;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
useImperativeHandle(ref, ()=>ele.current, []);
|
|
19
|
+
useImperativeHandle(scrollbar, ()=>bar.current, []);
|
|
20
|
+
useEffect(()=>{
|
|
21
21
|
if (playOnMouseEnter) pausedRef.current = false;
|
|
22
22
|
}, [
|
|
23
23
|
playOnMouseEnter
|
|
24
24
|
]);
|
|
25
|
-
|
|
25
|
+
useEffect(()=>{
|
|
26
26
|
if (!size || 0 === count) return;
|
|
27
27
|
const { height } = size;
|
|
28
|
-
const range =
|
|
28
|
+
const range = getArray(count, (index)=>(itemHeight + gap) * (index + 1) - (index === count - 1 ? gap : 0));
|
|
29
29
|
const scrollHeight = range[range.length - 1];
|
|
30
30
|
if (height >= scrollHeight) return;
|
|
31
31
|
function scroll(target) {
|
|
@@ -66,23 +66,23 @@ const AutoScroll = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRe
|
|
|
66
66
|
pausedRef.current = false;
|
|
67
67
|
onMouseLeave?.(e);
|
|
68
68
|
}
|
|
69
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/ jsx(Scroll, {
|
|
70
70
|
ref: ele,
|
|
71
71
|
scrollbar: bar,
|
|
72
72
|
onMouseEnter: onContainerMouseEnter,
|
|
73
73
|
onMouseLeave: onContainerMouseLeave,
|
|
74
74
|
...rest,
|
|
75
|
-
children: /*#__PURE__*/
|
|
76
|
-
className:
|
|
77
|
-
display: flex;
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
gap: var(--gap, 0);
|
|
80
|
-
& > * {
|
|
81
|
-
flex: none;
|
|
82
|
-
}
|
|
75
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
76
|
+
className: clsx(css`
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: var(--gap, 0);
|
|
80
|
+
& > * {
|
|
81
|
+
flex: none;
|
|
82
|
+
}
|
|
83
83
|
`, containerClassName),
|
|
84
|
-
style:
|
|
85
|
-
gap:
|
|
84
|
+
style: transformCSSVariable({
|
|
85
|
+
gap: px(gap)
|
|
86
86
|
}, containerStyle),
|
|
87
87
|
children: children
|
|
88
88
|
})
|
|
@@ -53,10 +53,10 @@ const AutoSizeTextArea = /*#__PURE__*/ (0, external_react_namespaceObject.forwar
|
|
|
53
53
|
}, []);
|
|
54
54
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("textarea", {
|
|
55
55
|
ref: ele,
|
|
56
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
57
|
-
height: var(--height);
|
|
58
|
-
resize: none;
|
|
59
|
-
overflow-y: hidden;
|
|
56
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
57
|
+
height: var(--height);
|
|
58
|
+
resize: none;
|
|
59
|
+
overflow-y: hidden;
|
|
60
60
|
`, className),
|
|
61
61
|
style: (0, index_cjs_namespaceObject.transformCSSVariable)({
|
|
62
62
|
height
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const AutoSizeTextArea = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "@emotion/css";
|
|
4
|
+
import { clsx } from "deepsea-tools";
|
|
5
|
+
import { forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { px, transformCSSVariable } from "../utils/index.js";
|
|
7
|
+
const AutoSizeTextArea = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
8
8
|
const { className, style, ...rest } = props;
|
|
9
|
-
const [height, setHeight] =
|
|
10
|
-
const ele =
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const [height, setHeight] = useState(void 0);
|
|
10
|
+
const ele = useRef(null);
|
|
11
|
+
useImperativeHandle(ref, ()=>ele.current, []);
|
|
12
|
+
useLayoutEffect(()=>{
|
|
13
13
|
const textarea = ele.current;
|
|
14
14
|
function resizeTextarea() {
|
|
15
15
|
setHeight("auto");
|
|
16
|
-
setHeight(
|
|
16
|
+
setHeight(px(textarea.scrollHeight + textarea.offsetHeight - textarea.clientHeight));
|
|
17
17
|
}
|
|
18
18
|
resizeTextarea();
|
|
19
19
|
textarea.addEventListener("input", resizeTextarea);
|
|
@@ -23,14 +23,14 @@ const AutoSizeTextArea = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.for
|
|
|
23
23
|
textarea.removeEventListener("change", resizeTextarea);
|
|
24
24
|
};
|
|
25
25
|
}, []);
|
|
26
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/ jsx("textarea", {
|
|
27
27
|
ref: ele,
|
|
28
|
-
className:
|
|
29
|
-
height: var(--height);
|
|
30
|
-
resize: none;
|
|
31
|
-
overflow-y: hidden;
|
|
28
|
+
className: clsx(css`
|
|
29
|
+
height: var(--height);
|
|
30
|
+
resize: none;
|
|
31
|
+
overflow-y: hidden;
|
|
32
32
|
`, className),
|
|
33
|
-
style:
|
|
33
|
+
style: transformCSSVariable({
|
|
34
34
|
height
|
|
35
35
|
}, style),
|
|
36
36
|
...rest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
4
|
const CircleText = (props)=>{
|
|
5
5
|
const { width, height, radius, startAngel = 0, gapAngel = 0, align = "center", style, direction = "outer", reverse = false, separator, children, ...rest } = props;
|
|
6
6
|
const unitAngle = 2 * Math.atan(width / 2 / radius);
|
|
@@ -15,8 +15,8 @@ const CircleText = (props)=>{
|
|
|
15
15
|
}
|
|
16
16
|
const words = "function" == typeof separator ? separator(children) : children.split(separator ?? "");
|
|
17
17
|
if (reverse) words.reverse();
|
|
18
|
-
return /*#__PURE__*/
|
|
19
|
-
children: words.map((w, idx)=>/*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
19
|
+
children: words.map((w, idx)=>/*#__PURE__*/ jsx("span", {
|
|
20
20
|
style: {
|
|
21
21
|
position: "absolute",
|
|
22
22
|
...style,
|
|
@@ -34,8 +34,8 @@ var __webpack_require__ = {};
|
|
|
34
34
|
var __webpack_exports__ = {};
|
|
35
35
|
__webpack_require__.r(__webpack_exports__);
|
|
36
36
|
__webpack_require__.d(__webpack_exports__, {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
CopyButton: ()=>CopyButton,
|
|
38
|
+
Event: ()=>external_clipboard_namespaceObject.Event
|
|
39
39
|
});
|
|
40
40
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
41
|
const external_clipboard_namespaceObject = require("clipboard");
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const CopyButton = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import clipboard_0, { Event } from "clipboard";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
5
|
+
import { useLatest } from "soda-hooks";
|
|
6
|
+
const CopyButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
7
|
const { text, onCopySuccess: _onCoptSuccess, onCopyError: _onCopyError, ...rest } = props;
|
|
8
|
-
const ele =
|
|
9
|
-
const onCopySuccess =
|
|
10
|
-
const onCopyError =
|
|
11
|
-
|
|
8
|
+
const ele = useRef(null);
|
|
9
|
+
const onCopySuccess = useLatest(_onCoptSuccess);
|
|
10
|
+
const onCopyError = useLatest(_onCopyError);
|
|
11
|
+
useImperativeHandle(ref, ()=>ele.current, [
|
|
12
12
|
ele.current
|
|
13
13
|
]);
|
|
14
|
-
|
|
15
|
-
const clipboard = new
|
|
14
|
+
useEffect(()=>{
|
|
15
|
+
const clipboard = new clipboard_0(ele.current);
|
|
16
16
|
clipboard.on("success", (event)=>onCopySuccess.current?.(event));
|
|
17
17
|
clipboard.on("error", (event)=>onCopyError.current?.(event));
|
|
18
18
|
return ()=>clipboard.destroy();
|
|
19
19
|
}, []);
|
|
20
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/ jsx("button", {
|
|
21
21
|
ref: ele,
|
|
22
22
|
...rest,
|
|
23
23
|
"data-clipboard-text": text
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
export { CopyButton, __webpack_exports__Event as Event };
|
|
26
|
+
export { CopyButton, Event };
|
|
@@ -26,8 +26,8 @@ var __webpack_exports__ = {};
|
|
|
26
26
|
__webpack_require__.r(__webpack_exports__);
|
|
27
27
|
__webpack_require__.d(__webpack_exports__, {
|
|
28
28
|
Pie: ()=>Pie,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
Line: ()=>Line,
|
|
30
|
+
Bar: ()=>Bar
|
|
31
31
|
});
|
|
32
32
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
33
|
const external_echarts_namespaceObject = require("echarts");
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const Echart = /*#__PURE__*/
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { init } from "echarts";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
5
|
+
const Echart = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
6
6
|
const { width, height, option, chart, ...rest } = props;
|
|
7
|
-
const container =
|
|
8
|
-
const chartRef =
|
|
9
|
-
|
|
7
|
+
const container = useRef(null);
|
|
8
|
+
const chartRef = useRef(null);
|
|
9
|
+
useLayoutEffect(()=>{
|
|
10
10
|
const ele = container.current;
|
|
11
|
-
chartRef.current =
|
|
11
|
+
chartRef.current = init(ele, option, {
|
|
12
12
|
width,
|
|
13
13
|
height
|
|
14
14
|
});
|
|
15
15
|
return ()=>chartRef.current?.dispose();
|
|
16
16
|
}, []);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
useImperativeHandle(ref, ()=>container.current, []);
|
|
18
|
+
useImperativeHandle(chart, ()=>chartRef.current, []);
|
|
19
|
+
useEffect(()=>{
|
|
20
20
|
chartRef.current?.setOption(option);
|
|
21
21
|
chartRef.current?.resize({
|
|
22
22
|
width,
|
|
23
23
|
height
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/ jsx("div", {
|
|
27
27
|
ref: container,
|
|
28
28
|
...rest
|
|
29
29
|
});
|
package/dist/components/Flow.cjs
CHANGED
|
@@ -25,10 +25,10 @@ var __webpack_require__ = {};
|
|
|
25
25
|
var __webpack_exports__ = {};
|
|
26
26
|
__webpack_require__.r(__webpack_exports__);
|
|
27
27
|
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
-
Flow: ()=>Flow,
|
|
29
|
-
getGapCountAndSize: ()=>getGapCountAndSize,
|
|
30
28
|
getGapRange: ()=>getGapRange,
|
|
31
|
-
|
|
29
|
+
getGapCountAndSize: ()=>getGapCountAndSize,
|
|
30
|
+
ManualFlow: ()=>ManualFlow,
|
|
31
|
+
Flow: ()=>Flow
|
|
32
32
|
});
|
|
33
33
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
34
|
const css_namespaceObject = require("@emotion/css");
|
|
@@ -137,24 +137,24 @@ function ManualFlow(props) {
|
|
|
137
137
|
]);
|
|
138
138
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
139
139
|
ref: ele,
|
|
140
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
141
|
-
position: relative;
|
|
142
|
-
height: var(--height);
|
|
143
|
-
overflow: hidden;
|
|
140
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
141
|
+
position: relative;
|
|
142
|
+
height: var(--height);
|
|
143
|
+
overflow: hidden;
|
|
144
144
|
`, className),
|
|
145
145
|
style: (0, index_cjs_namespaceObject.transformCSSVariable)({
|
|
146
146
|
height: (0, index_cjs_namespaceObject.px)(height)
|
|
147
147
|
}, style),
|
|
148
148
|
...rest,
|
|
149
149
|
children: data.map((item, index, arr)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
150
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
151
|
-
position: absolute;
|
|
152
|
-
width: var(--width);
|
|
153
|
-
height: var(--height);
|
|
154
|
-
transition: var(--transition);
|
|
155
|
-
left: 0;
|
|
156
|
-
top: 0;
|
|
157
|
-
transform: translate(var(--left), var(--top));
|
|
150
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
151
|
+
position: absolute;
|
|
152
|
+
width: var(--width);
|
|
153
|
+
height: var(--height);
|
|
154
|
+
transition: var(--transition);
|
|
155
|
+
left: 0;
|
|
156
|
+
top: 0;
|
|
157
|
+
transform: translate(var(--left), var(--top));
|
|
158
158
|
`, wrapperClassName),
|
|
159
159
|
style: (0, index_cjs_namespaceObject.transformCSSVariable)({
|
|
160
160
|
width: (0, index_cjs_namespaceObject.px)(itemWidth),
|
|
@@ -164,10 +164,10 @@ function ManualFlow(props) {
|
|
|
164
164
|
top: (0, index_cjs_namespaceObject.px)(getPosition(index).top)
|
|
165
165
|
}, wrapperStyle),
|
|
166
166
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
167
|
-
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
168
|
-
width: 100%;
|
|
169
|
-
height: 100%;
|
|
170
|
-
display: var(--display);
|
|
167
|
+
className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: 100%;
|
|
170
|
+
display: var(--display);
|
|
171
171
|
`, containerClassName),
|
|
172
172
|
style: (0, index_cjs_namespaceObject.transformCSSVariable)({
|
|
173
173
|
display: getHidden(index) ? "none" : "block"
|