deepsea-components 5.15.22 → 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.
Files changed (58) hide show
  1. package/README.md +23 -23
  2. package/dist/components/AutoFit.cjs +7 -7
  3. package/dist/components/AutoFit.js +7 -7
  4. package/dist/components/AutoScroll.cjs +7 -7
  5. package/dist/components/AutoScroll.js +7 -7
  6. package/dist/components/AutoSizeTextarea.cjs +4 -4
  7. package/dist/components/AutoSizeTextarea.js +4 -4
  8. package/dist/components/Flow.cjs +16 -16
  9. package/dist/components/Flow.js +16 -16
  10. package/dist/components/FormLabel.cjs +1 -1
  11. package/dist/components/FormLabel.js +1 -1
  12. package/dist/components/InfiniteScroll.cjs +13 -13
  13. package/dist/components/InfiniteScroll.js +13 -13
  14. package/dist/components/LoopSwiper.cjs +33 -33
  15. package/dist/components/LoopSwiper.js +33 -33
  16. package/dist/components/Scroll.cjs +13 -13
  17. package/dist/components/Scroll.js +13 -13
  18. package/dist/components/ScrollMask.module.cjs +2 -2
  19. package/dist/components/ScrollMask.module.js +2 -2
  20. package/dist/components/Skeleton.cjs +17 -17
  21. package/dist/components/Skeleton.js +17 -17
  22. package/dist/components/TransitionNum.cjs +1 -1
  23. package/dist/components/TransitionNum.js +1 -1
  24. package/dist/components/Trapezium.cjs +4 -4
  25. package/dist/components/Trapezium.js +4 -4
  26. package/package.json +4 -3
  27. package/src/components/AutoFit.tsx +104 -104
  28. package/src/components/AutoScroll.tsx +150 -150
  29. package/src/components/AutoSizeTextarea.tsx +50 -50
  30. package/src/components/CircleText.tsx +81 -81
  31. package/src/components/CopyButton.tsx +31 -31
  32. package/src/components/Echart.tsx +69 -69
  33. package/src/components/Flow.tsx +271 -271
  34. package/src/components/FormLabel.tsx +41 -41
  35. package/src/components/HlsPlayer.tsx +34 -34
  36. package/src/components/IconFileType.tsx +162 -162
  37. package/src/components/InfiniteScroll.tsx +163 -163
  38. package/src/components/InputFile.tsx +93 -93
  39. package/src/components/InputFileButton.tsx +122 -122
  40. package/src/components/LoopSwiper.tsx +125 -125
  41. package/src/components/ReadExcel.tsx +13 -13
  42. package/src/components/ReadSheet.tsx +17 -17
  43. package/src/components/Ring.tsx +30 -30
  44. package/src/components/Scroll.tsx +97 -97
  45. package/src/components/ScrollMask.module.css +87 -87
  46. package/src/components/ScrollMask.tsx +68 -68
  47. package/src/components/SectionRing.tsx +40 -40
  48. package/src/components/Skeleton.tsx +45 -45
  49. package/src/components/Title.tsx +27 -27
  50. package/src/components/TransitionBox.tsx +44 -44
  51. package/src/components/TransitionNum.tsx +54 -54
  52. package/src/components/Trapezium.tsx +60 -60
  53. package/src/components/Unify.tsx +38 -38
  54. package/src/components/WriteExcel.tsx +13 -13
  55. package/src/components/WriteSheet.tsx +25 -25
  56. package/src/utils/getReactVersion.ts +7 -7
  57. package/src/utils/index.ts +33 -33
  58. package/tsconfig.json +16 -16
@@ -1,5 +1,5 @@
1
1
  import "./ScrollMask_module.css";
2
- const ScrollMask_module_rslib_entry_ = {
2
+ const ScrollMask_module = {
3
3
  "scroll-mask": "scroll-mask-t2NITS",
4
4
  scrollMask: "scroll-mask-t2NITS",
5
5
  "top-scroll-mask": "top-scroll-mask-Lk0R6A",
@@ -21,4 +21,4 @@ const ScrollMask_module_rslib_entry_ = {
21
21
  "right-scroll-mask-content": "right-scroll-mask-content-mbgCn_",
22
22
  rightScrollMaskContent: "right-scroll-mask-content-mbgCn_"
23
23
  };
24
- export { ScrollMask_module_rslib_entry_ as default };
24
+ export { ScrollMask_module as default };
@@ -35,23 +35,23 @@ const Skeleton = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((p
35
35
  const { className, children, loading = null == children, ...rest } = props;
36
36
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
37
37
  ref: ref,
38
- className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
39
- @keyframes shimmer {
40
- 0% {
41
- background-position: -400px 0px;
42
- }
43
- 100% {
44
- background-position: 400px 0px;
45
- }
46
- }
47
- `, loading && (0, css_namespaceObject.css)`
48
- background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);
49
- animation-duration: 1s;
50
- animation-fill-mode: forwards;
51
- animation-iteration-count: infinite;
52
- animation-name: shimmer;
53
- animation-timing-function: linear;
54
- background-size: 800px 104px;
38
+ className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
39
+ @keyframes shimmer {
40
+ 0% {
41
+ background-position: -400px 0px;
42
+ }
43
+ 100% {
44
+ background-position: 400px 0px;
45
+ }
46
+ }
47
+ `, loading && (0, css_namespaceObject.css)`
48
+ background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);
49
+ animation-duration: 1s;
50
+ animation-fill-mode: forwards;
51
+ animation-iteration-count: infinite;
52
+ animation-name: shimmer;
53
+ animation-timing-function: linear;
54
+ background-size: 800px 104px;
55
55
  `, className),
56
56
  ...rest,
57
57
  children: children
@@ -7,23 +7,23 @@ const Skeleton = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)
7
7
  const { className, children, loading = null == children, ...rest } = props;
8
8
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
9
9
  ref: ref,
10
- className: (0, __WEBPACK_EXTERNAL_MODULE_deepsea_tools_8ecdf5a5__.clsx)((0, __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__.css)`
11
- @keyframes shimmer {
12
- 0% {
13
- background-position: -400px 0px;
14
- }
15
- 100% {
16
- background-position: 400px 0px;
17
- }
18
- }
19
- `, loading && (0, __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__.css)`
20
- background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);
21
- animation-duration: 1s;
22
- animation-fill-mode: forwards;
23
- animation-iteration-count: infinite;
24
- animation-name: shimmer;
25
- animation-timing-function: linear;
26
- background-size: 800px 104px;
10
+ className: (0, __WEBPACK_EXTERNAL_MODULE_deepsea_tools_8ecdf5a5__.clsx)((0, __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__.css)`
11
+ @keyframes shimmer {
12
+ 0% {
13
+ background-position: -400px 0px;
14
+ }
15
+ 100% {
16
+ background-position: 400px 0px;
17
+ }
18
+ }
19
+ `, loading && (0, __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__.css)`
20
+ background-image: linear-gradient(to right, rgba(0, 0, 0, 0.067) 8%, rgba(0, 0, 0, 0.133) 18%, rgba(0, 0, 0, 0.067) 33%);
21
+ animation-duration: 1s;
22
+ animation-fill-mode: forwards;
23
+ animation-iteration-count: infinite;
24
+ animation-name: shimmer;
25
+ animation-timing-function: linear;
26
+ background-size: 800px 104px;
27
27
  `, className),
28
28
  ...rest,
29
29
  children: children
@@ -32,7 +32,7 @@ const external_deepsea_tools_namespaceObject = require("deepsea-tools");
32
32
  const external_react_namespaceObject = require("react");
33
33
  const TransitionNum = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((props, ref)=>{
34
34
  const { children: num, period, numToStr, ins, ...rest } = props;
35
- if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) throw new RangeError("目标数字必须是整数,周期必须是正整数");
35
+ if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) throw new RangeError("\u76EE\u6807\u6570\u5B57\u5FC5\u987B\u662F\u6574\u6570\uFF0C\u5468\u671F\u5FC5\u987B\u662F\u6B63\u6574\u6570");
36
36
  const ele = (0, external_react_namespaceObject.useRef)(null);
37
37
  const cache = (0, external_react_namespaceObject.useRef)({
38
38
  num,
@@ -4,7 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_deepsea_tools_8ecdf5a5__ from "deepsea-too
4
4
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
5
5
  const TransitionNum = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)((props, ref)=>{
6
6
  const { children: num, period, numToStr, ins, ...rest } = props;
7
- if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) throw new RangeError("目标数字必须是整数,周期必须是正整数");
7
+ if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) throw new RangeError("\u76EE\u6807\u6570\u5B57\u5FC5\u987B\u662F\u6574\u6570\uFF0C\u5468\u671F\u5FC5\u987B\u662F\u6B63\u6574\u6570");
8
8
  const ele = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
9
9
  const cache = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)({
10
10
  num,
@@ -45,10 +45,10 @@ const Trapezium = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((
45
45
  const h = f * Math.sin(2 * a);
46
46
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
47
47
  ref: ref,
48
- className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
49
- width: var(--width);
50
- height: var(--height);
51
- clip-path: var(--clip-path);
48
+ className: (0, external_deepsea_tools_namespaceObject.clsx)((0, css_namespaceObject.css)`
49
+ width: var(--width);
50
+ height: var(--height);
51
+ clip-path: var(--clip-path);
52
52
  `, className),
53
53
  style: (0, index_cjs_namespaceObject.transformCSSVariable)({
54
54
  width: (0, index_cjs_namespaceObject.px)(bottom),
@@ -17,10 +17,10 @@ const Trapezium = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef
17
17
  const h = f * Math.sin(2 * a);
18
18
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
19
19
  ref: ref,
20
- className: (0, __WEBPACK_EXTERNAL_MODULE_deepsea_tools_8ecdf5a5__.clsx)((0, __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__.css)`
21
- width: var(--width);
22
- height: var(--height);
23
- clip-path: var(--clip-path);
20
+ className: (0, __WEBPACK_EXTERNAL_MODULE_deepsea_tools_8ecdf5a5__.clsx)((0, __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__.css)`
21
+ width: var(--width);
22
+ height: var(--height);
23
+ clip-path: var(--clip-path);
24
24
  `, className),
25
25
  style: (0, __WEBPACK_EXTERNAL_MODULE__utils_index_js_6619c453__.transformCSSVariable)({
26
26
  width: (0, __WEBPACK_EXTERNAL_MODULE__utils_index_js_6619c453__.px)(bottom),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepsea-components",
3
- "version": "5.15.22",
3
+ "version": "5.15.23",
4
4
  "description": "格数科技自用组件库",
5
5
  "type": "module",
6
6
  "exports": {
@@ -40,13 +40,14 @@
40
40
  "echarts": "^5.6.0",
41
41
  "hls.js": "^1.6.7",
42
42
  "smooth-scrollbar": "^8.8.4",
43
- "deepsea-tools": "5.40.2",
44
- "soda-hooks": "6.12.5"
43
+ "deepsea-tools": "5.40.3",
44
+ "soda-hooks": "6.12.6"
45
45
  },
46
46
  "devDependencies": {
47
47
  "typescript": "^5.8.3"
48
48
  },
49
49
  "peerDependencies": {
50
+ "@types/node": ">=20",
50
51
  "@types/react": ">=18.3.18",
51
52
  "@types/react-dom": ">=18.3.5",
52
53
  "react": ">=18.3.1",
@@ -1,104 +1,104 @@
1
- "use client"
2
-
3
- import { css } from "@emotion/css"
4
- import { clsx } from "deepsea-tools"
5
- import { HTMLAttributes, forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react"
6
-
7
- import { px, transformCSSVariable } from "@/utils"
8
-
9
- export interface AutoFitProps extends HTMLAttributes<HTMLDivElement> {
10
- /** 设计稿宽度,默认 1920 */
11
- width?: number
12
- /** 设计稿高度,默认 1080 */
13
- height?: number
14
- /**
15
- * 在哪些方向进行缩放,默认缩放所有方向
16
- * 1. 水平方向是指,宽度按照设计稿进行占满,高度反向缩放
17
- * 2. 垂直方向是指,高度按照设计稿进行占满,宽度反向缩放
18
- * 3. 默认是水平和垂直方向都进行缩放,类似于 background-size: contain 的效果
19
- */
20
- direction?: "horizontal" | "vertical" | "both"
21
- }
22
-
23
- /**
24
- * 自适应缩放组件
25
- *
26
- * 注意:
27
- * 1. 父元素必须设置非 static 定位方式
28
- * 2. 父元素只能有且仅有一个子元素,那就是 AutoFit
29
- * 3. 不要设置 AutoFit 的 position、left、top、transform、width、height 属性
30
- * 4. 在第一次完成缩放前,无论 props 是什么,返回的都是 <div style={{ display: "none" }} />
31
- * 5. 元素的属性、事件、资源并不是立即加载的,会有一帧的延迟,在第一次完成缩放后才会显示
32
- */
33
- export const AutoFit = forwardRef<HTMLDivElement, AutoFitProps>((props, ref) => {
34
- const { width: designWidth = 1920, height: designHeight = 1080, direction, className, style, ...rest } = props
35
- const ele = useRef<HTMLDivElement>(null)
36
- const [show, setShow] = useState(false)
37
- const [transform, setTransform] = useState<string | undefined>(undefined)
38
- const [width, setWidth] = useState<string | undefined>(undefined)
39
- const [height, setHeight] = useState<string | undefined>(undefined)
40
-
41
- useImperativeHandle(ref, () => ele.current!, [ele.current])
42
- useLayoutEffect(() => {
43
- const element = ele.current
44
- const parent = element?.parentElement
45
- if (!element || !parent) return
46
- function listener(entries: ResizeObserverEntry[]) {
47
- const entry = entries[0]
48
- const { contentRect } = entry
49
- if (direction === "horizontal") {
50
- const scale = contentRect.width / designWidth
51
- setTransform(`scale(${scale})`)
52
- setWidth(px(designWidth))
53
- setHeight(px(contentRect.height / scale))
54
- } else if (direction === "vertical") {
55
- const scale = contentRect.height / designHeight
56
- setTransform(`scale(${scale})`)
57
- setWidth(px(contentRect.width / scale))
58
- setHeight(px(designHeight))
59
- } else {
60
- const scale = Math.min(contentRect.width / designWidth, contentRect.height / designHeight)
61
- setTransform(
62
- `translateX(${(contentRect.width - designWidth * scale) / 2}px) translateY(${(contentRect.height - designHeight * scale) / 2}px) scale(${scale})`,
63
- )
64
- setWidth(px(designWidth))
65
- setHeight(px(designHeight))
66
- }
67
- setShow(true)
68
- }
69
- const observer = new ResizeObserver(listener)
70
- observer.observe(parent)
71
- return () => observer.disconnect()
72
- }, [ele.current?.parentElement, designWidth, designHeight, direction])
73
-
74
- if (process.env.NODE_ENV === "development") {
75
- useEffect(() => {
76
- const parent = ele.current?.parentElement
77
- if (!parent) return
78
- const style = getComputedStyle(parent)
79
- if (style.position === "static") {
80
- console.warn("AutoFit 组件的父元素的 position 属性不应该是 static")
81
- }
82
- }, [ele.current?.parentElement])
83
- }
84
-
85
- if (!show) return <div ref={ele} style={{ display: "none" }} />
86
-
87
- return (
88
- <div
89
- ref={ele}
90
- className={clsx(
91
- css`
92
- position: absolute;
93
- transform: var(--transform);
94
- transform-origin: top left;
95
- width: var(--width);
96
- height: var(--height);
97
- `,
98
- className,
99
- )}
100
- style={transformCSSVariable({ transform, width, height }, style)}
101
- {...rest}
102
- />
103
- )
104
- })
1
+ "use client"
2
+
3
+ import { css } from "@emotion/css"
4
+ import { clsx } from "deepsea-tools"
5
+ import { HTMLAttributes, forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react"
6
+
7
+ import { px, transformCSSVariable } from "@/utils"
8
+
9
+ export interface AutoFitProps extends HTMLAttributes<HTMLDivElement> {
10
+ /** 设计稿宽度,默认 1920 */
11
+ width?: number
12
+ /** 设计稿高度,默认 1080 */
13
+ height?: number
14
+ /**
15
+ * 在哪些方向进行缩放,默认缩放所有方向
16
+ * 1. 水平方向是指,宽度按照设计稿进行占满,高度反向缩放
17
+ * 2. 垂直方向是指,高度按照设计稿进行占满,宽度反向缩放
18
+ * 3. 默认是水平和垂直方向都进行缩放,类似于 background-size: contain 的效果
19
+ */
20
+ direction?: "horizontal" | "vertical" | "both"
21
+ }
22
+
23
+ /**
24
+ * 自适应缩放组件
25
+ *
26
+ * 注意:
27
+ * 1. 父元素必须设置非 static 定位方式
28
+ * 2. 父元素只能有且仅有一个子元素,那就是 AutoFit
29
+ * 3. 不要设置 AutoFit 的 position、left、top、transform、width、height 属性
30
+ * 4. 在第一次完成缩放前,无论 props 是什么,返回的都是 <div style={{ display: "none" }} />
31
+ * 5. 元素的属性、事件、资源并不是立即加载的,会有一帧的延迟,在第一次完成缩放后才会显示
32
+ */
33
+ export const AutoFit = forwardRef<HTMLDivElement, AutoFitProps>((props, ref) => {
34
+ const { width: designWidth = 1920, height: designHeight = 1080, direction, className, style, ...rest } = props
35
+ const ele = useRef<HTMLDivElement>(null)
36
+ const [show, setShow] = useState(false)
37
+ const [transform, setTransform] = useState<string | undefined>(undefined)
38
+ const [width, setWidth] = useState<string | undefined>(undefined)
39
+ const [height, setHeight] = useState<string | undefined>(undefined)
40
+
41
+ useImperativeHandle(ref, () => ele.current!, [ele.current])
42
+ useLayoutEffect(() => {
43
+ const element = ele.current
44
+ const parent = element?.parentElement
45
+ if (!element || !parent) return
46
+ function listener(entries: ResizeObserverEntry[]) {
47
+ const entry = entries[0]
48
+ const { contentRect } = entry
49
+ if (direction === "horizontal") {
50
+ const scale = contentRect.width / designWidth
51
+ setTransform(`scale(${scale})`)
52
+ setWidth(px(designWidth))
53
+ setHeight(px(contentRect.height / scale))
54
+ } else if (direction === "vertical") {
55
+ const scale = contentRect.height / designHeight
56
+ setTransform(`scale(${scale})`)
57
+ setWidth(px(contentRect.width / scale))
58
+ setHeight(px(designHeight))
59
+ } else {
60
+ const scale = Math.min(contentRect.width / designWidth, contentRect.height / designHeight)
61
+ setTransform(
62
+ `translateX(${(contentRect.width - designWidth * scale) / 2}px) translateY(${(contentRect.height - designHeight * scale) / 2}px) scale(${scale})`,
63
+ )
64
+ setWidth(px(designWidth))
65
+ setHeight(px(designHeight))
66
+ }
67
+ setShow(true)
68
+ }
69
+ const observer = new ResizeObserver(listener)
70
+ observer.observe(parent)
71
+ return () => observer.disconnect()
72
+ }, [ele.current?.parentElement, designWidth, designHeight, direction])
73
+
74
+ if (process.env.NODE_ENV === "development") {
75
+ useEffect(() => {
76
+ const parent = ele.current?.parentElement
77
+ if (!parent) return
78
+ const style = getComputedStyle(parent)
79
+ if (style.position === "static") {
80
+ console.warn("AutoFit 组件的父元素的 position 属性不应该是 static")
81
+ }
82
+ }, [ele.current?.parentElement])
83
+ }
84
+
85
+ if (!show) return <div ref={ele} style={{ display: "none" }} />
86
+
87
+ return (
88
+ <div
89
+ ref={ele}
90
+ className={clsx(
91
+ css`
92
+ position: absolute;
93
+ transform: var(--transform);
94
+ transform-origin: top left;
95
+ width: var(--width);
96
+ height: var(--height);
97
+ `,
98
+ className,
99
+ )}
100
+ style={transformCSSVariable({ transform, width, height }, style)}
101
+ {...rest}
102
+ />
103
+ )
104
+ })