deepsea-components 5.18.5 → 5.18.6
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.d.ts +1 -1
- package/dist/components/AutoScroll.d.ts +2 -2
- package/dist/components/AutoSizeTextarea.d.ts +1 -1
- package/dist/components/CircleText.d.ts +1 -1
- package/dist/components/CopyButton.cjs +2 -5
- package/dist/components/CopyButton.d.ts +3 -3
- package/dist/components/CopyButton.js +2 -2
- package/dist/components/DraggableGrid.d.ts +2 -2
- package/dist/components/Echart.d.ts +3 -3
- package/dist/components/Flow.d.ts +1 -1
- package/dist/components/FormLabel.d.ts +1 -1
- package/dist/components/HlsPlayer.d.ts +1 -1
- package/dist/components/IconFileType.d.ts +1 -1
- package/dist/components/InfiniteScroll.d.ts +1 -1
- package/dist/components/InputFile.d.ts +1 -1
- package/dist/components/InputFileButton.d.ts +2 -2
- package/dist/components/LoopSwiper.d.ts +1 -1
- package/dist/components/ReadExcel.d.ts +1 -1
- package/dist/components/ReadSheet.d.ts +2 -2
- package/dist/components/Ring.d.ts +1 -1
- package/dist/components/RtspPlayer.d.ts +1 -1
- package/dist/components/Scroll.d.ts +1 -1
- package/dist/components/ScrollMask.d.ts +1 -1
- package/dist/components/SectionRing.d.ts +1 -1
- package/dist/components/Skeleton.d.ts +1 -1
- package/dist/components/Title.d.ts +1 -1
- package/dist/components/TransitionBox.d.ts +1 -1
- package/dist/components/TransitionNum.d.ts +1 -1
- package/dist/components/Trapezium.d.ts +1 -1
- package/dist/components/Unify.d.ts +1 -1
- package/dist/components/WriteExcel.d.ts +1 -1
- package/dist/components/WriteSheet.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/package.json +6 -6
- package/src/components/AutoFit.tsx +1 -1
- package/src/components/AutoScroll.tsx +3 -3
- package/src/components/AutoSizeTextarea.tsx +1 -1
- package/src/components/CircleText.tsx +81 -81
- package/src/components/CopyButton.tsx +4 -3
- package/src/components/DraggableGrid.tsx +3 -2
- package/src/components/Echart.tsx +63 -62
- package/src/components/Flow.tsx +5 -1
- package/src/components/FormLabel.tsx +1 -1
- package/src/components/HlsPlayer.tsx +1 -1
- package/src/components/IconFileType.tsx +1 -1
- package/src/components/InfiniteScroll.tsx +10 -1
- package/src/components/InputFile.tsx +3 -1
- package/src/components/InputFileButton.tsx +13 -13
- package/src/components/LoopSwiper.tsx +1 -1
- package/src/components/ReadExcel.tsx +13 -13
- package/src/components/ReadSheet.tsx +2 -2
- package/src/components/Ring.tsx +1 -1
- package/src/components/RtspPlayer.tsx +3 -4
- package/src/components/Scroll.tsx +12 -1
- package/src/components/ScrollMask.module.css +87 -87
- package/src/components/ScrollMask.tsx +1 -1
- package/src/components/SectionRing.tsx +2 -2
- package/src/components/Skeleton.tsx +1 -1
- package/src/components/Title.tsx +1 -1
- package/src/components/TransitionBox.tsx +1 -1
- package/src/components/TransitionNum.tsx +1 -1
- package/src/components/Trapezium.tsx +1 -1
- package/src/components/Unify.tsx +11 -1
- package/src/components/WriteExcel.tsx +13 -13
- package/src/components/WriteSheet.tsx +2 -2
- package/src/components/rtspPlayer/reader.ts +6 -9
- package/src/utils/getReactVersion.ts +7 -7
- package/src/utils/index.ts +33 -33
- package/tsconfig.json +6 -13
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSProperties, FC } from "react";
|
|
2
|
-
import { ScrollProps } from "./Scroll";
|
|
1
|
+
import { type CSSProperties, type FC } from "react";
|
|
2
|
+
import { type ScrollProps } from "./Scroll";
|
|
3
3
|
export interface AutoScrollProps extends ScrollProps {
|
|
4
4
|
/** 轮播元素的个数 */
|
|
5
5
|
count: number;
|
|
@@ -34,8 +34,7 @@ var __webpack_require__ = {};
|
|
|
34
34
|
var __webpack_exports__ = {};
|
|
35
35
|
__webpack_require__.r(__webpack_exports__);
|
|
36
36
|
__webpack_require__.d(__webpack_exports__, {
|
|
37
|
-
CopyButton: ()=>CopyButton
|
|
38
|
-
Event: ()=>external_clipboard_namespaceObject.Event
|
|
37
|
+
CopyButton: ()=>CopyButton
|
|
39
38
|
});
|
|
40
39
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
40
|
const external_react_namespaceObject = require("react");
|
|
@@ -69,10 +68,8 @@ const CopyButton = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(
|
|
|
69
68
|
});
|
|
70
69
|
});
|
|
71
70
|
exports.CopyButton = __webpack_exports__.CopyButton;
|
|
72
|
-
exports.Event = __webpack_exports__.Event;
|
|
73
71
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
74
|
-
"CopyButton"
|
|
75
|
-
"Event"
|
|
72
|
+
"CopyButton"
|
|
76
73
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
77
74
|
Object.defineProperty(exports, '__esModule', {
|
|
78
75
|
value: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
import { Event } from "clipboard";
|
|
3
|
-
export { Event } from "clipboard";
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { type Event } from "clipboard";
|
|
3
|
+
export type { Event } from "clipboard";
|
|
4
4
|
export type CopyButtonProps = ComponentPropsWithoutRef<"button"> & {
|
|
5
5
|
text?: string;
|
|
6
6
|
onCopySuccess?: (e: Event) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
4
|
-
import clipboard_0
|
|
4
|
+
import clipboard_0 from "clipboard";
|
|
5
5
|
import { useLatest } from "soda-hooks";
|
|
6
6
|
const CopyButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
7
|
const { text, onCopySuccess: _onCoptSuccess, onCopyError: _onCopyError, ...rest } = props;
|
|
@@ -29,4 +29,4 @@ const CopyButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
29
29
|
"data-clipboard-text": text
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
export { CopyButton
|
|
32
|
+
export { CopyButton };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps, CSSProperties, Key, ReactNode } from "react";
|
|
2
|
-
import { DragMoveEvents } from "soda-hooks";
|
|
1
|
+
import { type ComponentProps, type CSSProperties, type Key, type ReactNode } from "react";
|
|
2
|
+
import { type DragMoveEvents } from "soda-hooks";
|
|
3
3
|
export type MustBeReactNode<T> = false extends (T extends ReactNode ? true : false) ? false : true;
|
|
4
4
|
export type MustBeReactKey<T> = false extends (T extends Key ? true : false) ? false : true;
|
|
5
5
|
export type DraggableGridClassName = string | ((status: ContainerStatus) => string);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentProps, FC, ReactNode, Ref } from "react";
|
|
2
|
-
import { AngleAxisComponentOption, AriaComponentOption, AxisPointerComponentOption, BarSeriesOption, BoxplotSeriesOption, BrushComponentOption, CalendarComponentOption, CandlestickSeriesOption, ChordSeriesOption, ComposeOption, ContinousVisualMapComponentOption, CustomSeriesOption, DatasetComponentOption, DataZoomComponentOption, ECharts, EChartsInitOpts, EffectScatterSeriesOption, FunnelSeriesOption, GaugeSeriesOption, GeoComponentOption, GraphicComponentOption, GraphSeriesOption, GridComponentOption, HeatmapSeriesOption, InsideDataZoomComponentOption, LegendComponentOption, LineSeriesOption, LinesSeriesOption, MapSeriesOption, MarkAreaComponentOption, MarkLineComponentOption, MarkPointComponentOption, MatrixComponentOption, ParallelSeriesOption, PictorialBarSeriesOption, PiecewiseVisualMapComponentOption, PieSeriesOption, PlainLegendComponentOption, PolarComponentOption, RadarComponentOption, RadarSeriesOption, RadiusAxisComponentOption, SankeySeriesOption, ScatterSeriesOption, ScrollableLegendComponentOption, SeriesOption, SingleAxisComponentOption, SliderDataZoomComponentOption, SunburstSeriesOption, ThemeRiverSeriesOption, ThumbnailComponentOption, TimelineComponentOption, TitleComponentOption, ToolboxComponentOption, TooltipComponentOption, TreemapSeriesOption, TreeSeriesOption, VisualMapComponentOption, XAXisComponentOption, YAXisComponentOption } from "echarts";
|
|
3
|
-
import { ECBasicOption } from "echarts/types/src/util/types.js";
|
|
1
|
+
import { type ComponentProps, type FC, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { type AngleAxisComponentOption, type AriaComponentOption, type AxisPointerComponentOption, type BarSeriesOption, type BoxplotSeriesOption, type BrushComponentOption, type CalendarComponentOption, type CandlestickSeriesOption, type ChordSeriesOption, type ComposeOption, type ContinousVisualMapComponentOption, type CustomSeriesOption, type DatasetComponentOption, type DataZoomComponentOption, type ECharts, type EChartsInitOpts, type EffectScatterSeriesOption, type FunnelSeriesOption, type GaugeSeriesOption, type GeoComponentOption, type GraphicComponentOption, type GraphSeriesOption, type GridComponentOption, type HeatmapSeriesOption, type InsideDataZoomComponentOption, type LegendComponentOption, type LineSeriesOption, type LinesSeriesOption, type MapSeriesOption, type MarkAreaComponentOption, type MarkLineComponentOption, type MarkPointComponentOption, type MatrixComponentOption, type ParallelSeriesOption, type PictorialBarSeriesOption, type PiecewiseVisualMapComponentOption, type PieSeriesOption, type PlainLegendComponentOption, type PolarComponentOption, type RadarComponentOption, type RadarSeriesOption, type RadiusAxisComponentOption, type SankeySeriesOption, type ScatterSeriesOption, type ScrollableLegendComponentOption, type SeriesOption, type SingleAxisComponentOption, type SliderDataZoomComponentOption, type SunburstSeriesOption, type ThemeRiverSeriesOption, type ThumbnailComponentOption, type TimelineComponentOption, type TitleComponentOption, type ToolboxComponentOption, type TooltipComponentOption, type TreemapSeriesOption, type TreeSeriesOption, type VisualMapComponentOption, type XAXisComponentOption, type YAXisComponentOption } from "echarts";
|
|
3
|
+
import type { ECBasicOption } from "echarts/types/src/util/types.js";
|
|
4
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
5
|
export type BarOption = ChartOption<BarSeriesOption>;
|
|
6
6
|
export type BoxplotOption = ChartOption<BoxplotSeriesOption>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps, JSX, JSXElementConstructor } from "react";
|
|
2
|
-
import { InputFileBaseProps, InputFileDataType, InputFileExtraProps } from "./InputFile";
|
|
1
|
+
import { type ComponentProps, type JSX, type JSXElementConstructor } from "react";
|
|
2
|
+
import { type InputFileBaseProps, type InputFileDataType, type InputFileExtraProps } from "./InputFile";
|
|
3
3
|
export type InputFileButtonProps<Multiple extends boolean = false, Type extends InputFileDataType = "file", AS extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = "button"> = Omit<ComponentProps<AS>, "as" | "type" | "disabled"> & InputFileExtraProps<Multiple, Type> & {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
inputProps?: Omit<InputFileBaseProps, "accept">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WorkBookData, WorkSheetData } from "deepsea-tools";
|
|
2
|
-
import { InputFileProps } from "./InputFile";
|
|
1
|
+
import { type WorkBookData, type WorkSheetData } from "deepsea-tools";
|
|
2
|
+
import { type InputFileProps } from "./InputFile";
|
|
3
3
|
export interface ReadSheetProps<Sheet = WorkSheetData> extends Omit<InputFileProps<false, "arrayBuffer">, "multiple" | "accept" | "type" | "onValueChange"> {
|
|
4
4
|
onValueChange?: (data: WorkBookData<Sheet>) => void;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, CSSProperties, FC, ForwardedRef } from "react";
|
|
1
|
+
import { type ComponentProps, type CSSProperties, type FC, type ForwardedRef } from "react";
|
|
2
2
|
import Scrollbar from "smooth-scrollbar";
|
|
3
3
|
import type { ScrollbarOptions, ScrollListener } from "smooth-scrollbar/interfaces";
|
|
4
4
|
export { default as Scrollbar } from "smooth-scrollbar";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, CSSProperties, FC } from "react";
|
|
1
|
+
import { type ComponentProps, type CSSProperties, type FC } from "react";
|
|
2
2
|
export type ScrollMaskPosition = "top" | "bottom" | "left" | "right";
|
|
3
3
|
export interface ScrollMaskProps extends Omit<ComponentProps<"div">, "children"> {
|
|
4
4
|
position?: ScrollMaskPosition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentProps, FC } from "react";
|
|
1
|
+
import { type ComponentProps, type FC } from "react";
|
|
2
2
|
export declare const Title: FC<ComponentProps<"title">>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, FC, HTMLAttributes } from "react";
|
|
1
|
+
import { type CSSProperties, type FC, type HTMLAttributes } from "react";
|
|
2
2
|
export interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
containerClassName?: string;
|
|
4
4
|
containerStyle?: CSSProperties;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, CSSProperties, FC, JSX, JSXElementConstructor, ReactNode } from "react";
|
|
1
|
+
import { type ComponentProps, type CSSProperties, type FC, type JSX, type JSXElementConstructor, type ReactNode } from "react";
|
|
2
2
|
export interface UnifyConfig {
|
|
3
3
|
className?: string;
|
|
4
4
|
style?: CSSProperties;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps, JSX, JSXElementConstructor } from "react";
|
|
2
|
-
import { WriteSheetParams } from "deepsea-tools";
|
|
1
|
+
import { type ComponentProps, type JSX, type JSXElementConstructor } from "react";
|
|
2
|
+
import { type WriteSheetParams } from "deepsea-tools";
|
|
3
3
|
export type WriteSheetProps<AS extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = "button"> = Omit<ComponentProps<AS>, "as" | "excel"> & {
|
|
4
4
|
as?: AS;
|
|
5
5
|
excel?: WriteSheetParams;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepsea-components",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.6",
|
|
4
4
|
"description": "格数科技自用组件库",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@emotion/css": "^11.13.5",
|
|
39
39
|
"clipboard": "^2.0.11",
|
|
40
|
-
"echarts": "^6.
|
|
40
|
+
"echarts": "^6.1.0",
|
|
41
41
|
"hls.js": "^1.6.13",
|
|
42
42
|
"smooth-scrollbar": "^8.8.4",
|
|
43
43
|
"stable-hash": "^0.0.6",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
44
|
+
"deepsea-tools": "5.48.1",
|
|
45
|
+
"soda-hooks": "6.17.2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"typescript": "
|
|
48
|
+
"typescript": "^6.0.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@types/node": "^24.12.4",
|
|
52
|
-
"@types/react": "
|
|
52
|
+
"@types/react": "^19.2.15",
|
|
53
53
|
"@types/react-dom": ">=19.2.3",
|
|
54
54
|
"react": ">=19.2.3",
|
|
55
55
|
"react-dom": ">=19.2.3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { type HTMLAttributes, forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react"
|
|
4
4
|
|
|
5
5
|
import { css } from "@emotion/css"
|
|
6
6
|
import { clsx } from "deepsea-tools"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { CSSProperties, FC, MouseEvent as ReactMouseEvent, useEffect, useEffectEvent, useImperativeHandle, useRef } from "react"
|
|
3
|
+
import { type CSSProperties, type FC, type MouseEvent as ReactMouseEvent, useEffect, useEffectEvent, useImperativeHandle, useRef } from "react"
|
|
4
4
|
|
|
5
5
|
import { css } from "@emotion/css"
|
|
6
6
|
import { clsx, getArray } from "deepsea-tools"
|
|
7
7
|
import Scrollbar from "smooth-scrollbar"
|
|
8
|
-
import { ScrollStatus } from "smooth-scrollbar/interfaces/scrollbar"
|
|
8
|
+
import type { ScrollStatus } from "smooth-scrollbar/interfaces/scrollbar"
|
|
9
9
|
import { useSize } from "soda-hooks"
|
|
10
10
|
|
|
11
11
|
import { px, transformCSSVariable } from "@/utils"
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { type ScrollProps, Scroll } from "./Scroll"
|
|
14
14
|
|
|
15
15
|
export interface AutoScrollProps extends ScrollProps {
|
|
16
16
|
/** 轮播元素的个数 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { type TextareaHTMLAttributes, forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState } from "react"
|
|
4
4
|
|
|
5
5
|
import { css } from "@emotion/css"
|
|
6
6
|
import { clsx } from "deepsea-tools"
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { FC,
|
|
4
|
-
|
|
5
|
-
export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
6
|
-
/** 每一个方块的宽度 */
|
|
7
|
-
width: number
|
|
8
|
-
/** 每一个方块的高度 */
|
|
9
|
-
height: number
|
|
10
|
-
/** 圆弧的半径,不包含方块的高度 */
|
|
11
|
-
radius: number
|
|
12
|
-
/** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
|
|
13
|
-
startAngel?: number
|
|
14
|
-
/** 每一个方块之间间隔的弧度 */
|
|
15
|
-
gapAngel?: number
|
|
16
|
-
/** 文字对齐的方式,默认居中 */
|
|
17
|
-
align?: "left" | "center" | "right"
|
|
18
|
-
/** 文字朝向圆心还是外侧,默认外侧 */
|
|
19
|
-
direction?: "inner" | "outer"
|
|
20
|
-
/** 是否反转文字顺序 */
|
|
21
|
-
reverse?: boolean
|
|
22
|
-
/** 分割文字的方法 */
|
|
23
|
-
separator?: string | RegExp | ((text: string) => string[])
|
|
24
|
-
/** 显示的文字 */
|
|
25
|
-
children: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** 环形文字 */
|
|
29
|
-
export const CircleText: FC<CircleTextProps> = props => {
|
|
30
|
-
const {
|
|
31
|
-
width,
|
|
32
|
-
height,
|
|
33
|
-
radius,
|
|
34
|
-
startAngel = 0,
|
|
35
|
-
gapAngel = 0,
|
|
36
|
-
align = "center",
|
|
37
|
-
style,
|
|
38
|
-
direction = "outer",
|
|
39
|
-
reverse = false,
|
|
40
|
-
separator,
|
|
41
|
-
children,
|
|
42
|
-
...rest
|
|
43
|
-
} = props
|
|
44
|
-
const unitAngle = Math.atan(width / 2 / radius) * 2
|
|
45
|
-
const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel
|
|
46
|
-
const offsetAngle = align === "left" ? 0 : align === "right" ? totalAngle : totalAngle / 2
|
|
47
|
-
|
|
48
|
-
function getTransform(idx: number) {
|
|
49
|
-
const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2
|
|
50
|
-
const x = (radius + height / 2) * Math.cos(angle) - width / 2
|
|
51
|
-
const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2
|
|
52
|
-
const z = Math.PI / 2 - angle + (direction === "inner" ? Math.PI : 0)
|
|
53
|
-
return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const words = typeof separator === "function" ? separator(children) : children.split(separator ?? "")
|
|
57
|
-
|
|
58
|
-
if (reverse) words.reverse()
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<Fragment>
|
|
62
|
-
{words.map((w, idx) => (
|
|
63
|
-
<span
|
|
64
|
-
key={idx}
|
|
65
|
-
style={{
|
|
66
|
-
position: "absolute",
|
|
67
|
-
...style,
|
|
68
|
-
transform: getTransform(idx),
|
|
69
|
-
textAlign: "center",
|
|
70
|
-
width,
|
|
71
|
-
lineHeight: `${height}px`,
|
|
72
|
-
height: height,
|
|
73
|
-
}}
|
|
74
|
-
{...rest}
|
|
75
|
-
>
|
|
76
|
-
{w}
|
|
77
|
-
</span>
|
|
78
|
-
))}
|
|
79
|
-
</Fragment>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { type FC, type HTMLAttributes, Fragment } from "react"
|
|
4
|
+
|
|
5
|
+
export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
6
|
+
/** 每一个方块的宽度 */
|
|
7
|
+
width: number
|
|
8
|
+
/** 每一个方块的高度 */
|
|
9
|
+
height: number
|
|
10
|
+
/** 圆弧的半径,不包含方块的高度 */
|
|
11
|
+
radius: number
|
|
12
|
+
/** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
|
|
13
|
+
startAngel?: number
|
|
14
|
+
/** 每一个方块之间间隔的弧度 */
|
|
15
|
+
gapAngel?: number
|
|
16
|
+
/** 文字对齐的方式,默认居中 */
|
|
17
|
+
align?: "left" | "center" | "right"
|
|
18
|
+
/** 文字朝向圆心还是外侧,默认外侧 */
|
|
19
|
+
direction?: "inner" | "outer"
|
|
20
|
+
/** 是否反转文字顺序 */
|
|
21
|
+
reverse?: boolean
|
|
22
|
+
/** 分割文字的方法 */
|
|
23
|
+
separator?: string | RegExp | ((text: string) => string[])
|
|
24
|
+
/** 显示的文字 */
|
|
25
|
+
children: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 环形文字 */
|
|
29
|
+
export const CircleText: FC<CircleTextProps> = props => {
|
|
30
|
+
const {
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
radius,
|
|
34
|
+
startAngel = 0,
|
|
35
|
+
gapAngel = 0,
|
|
36
|
+
align = "center",
|
|
37
|
+
style,
|
|
38
|
+
direction = "outer",
|
|
39
|
+
reverse = false,
|
|
40
|
+
separator,
|
|
41
|
+
children,
|
|
42
|
+
...rest
|
|
43
|
+
} = props
|
|
44
|
+
const unitAngle = Math.atan(width / 2 / radius) * 2
|
|
45
|
+
const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel
|
|
46
|
+
const offsetAngle = align === "left" ? 0 : align === "right" ? totalAngle : totalAngle / 2
|
|
47
|
+
|
|
48
|
+
function getTransform(idx: number) {
|
|
49
|
+
const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2
|
|
50
|
+
const x = (radius + height / 2) * Math.cos(angle) - width / 2
|
|
51
|
+
const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2
|
|
52
|
+
const z = Math.PI / 2 - angle + (direction === "inner" ? Math.PI : 0)
|
|
53
|
+
return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const words = typeof separator === "function" ? separator(children) : children.split(separator ?? "")
|
|
57
|
+
|
|
58
|
+
if (reverse) words.reverse()
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Fragment>
|
|
62
|
+
{words.map((w, idx) => (
|
|
63
|
+
<span
|
|
64
|
+
key={idx}
|
|
65
|
+
style={{
|
|
66
|
+
position: "absolute",
|
|
67
|
+
...style,
|
|
68
|
+
transform: getTransform(idx),
|
|
69
|
+
textAlign: "center",
|
|
70
|
+
width,
|
|
71
|
+
lineHeight: `${height}px`,
|
|
72
|
+
height: height,
|
|
73
|
+
}}
|
|
74
|
+
{...rest}
|
|
75
|
+
>
|
|
76
|
+
{w}
|
|
77
|
+
</span>
|
|
78
|
+
))}
|
|
79
|
+
</Fragment>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable no-restricted-syntax */
|
|
4
4
|
|
|
5
|
-
import { ComponentPropsWithoutRef, forwardRef, useEffect, useImperativeHandle, useRef } from "react"
|
|
5
|
+
import { type ComponentPropsWithoutRef, forwardRef, useEffect, useImperativeHandle, useRef } from "react"
|
|
6
6
|
|
|
7
|
-
import ClipboardJS, { Event } from "clipboard"
|
|
7
|
+
import ClipboardJS, { type Event } from "clipboard"
|
|
8
8
|
import { useLatest } from "soda-hooks"
|
|
9
9
|
|
|
10
|
-
export { Event } from "clipboard"
|
|
10
|
+
export type { Event } from "clipboard"
|
|
11
11
|
|
|
12
12
|
export type CopyButtonProps = ComponentPropsWithoutRef<"button"> & {
|
|
13
13
|
text?: string
|
|
@@ -28,6 +28,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>((props,
|
|
|
28
28
|
const clipboard = new ClipboardJS(ele.current!)
|
|
29
29
|
clipboard.on("success", event => onCopySuccess.current?.(event))
|
|
30
30
|
clipboard.on("error", event => onCopyError.current?.(event))
|
|
31
|
+
|
|
31
32
|
return () => clipboard.destroy()
|
|
32
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
34
|
}, [])
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
2
|
|
|
3
|
-
import { ComponentProps, CSSProperties, Key, ReactNode, useEffect, useMemo, useRef, useState } from "react"
|
|
3
|
+
import { type ComponentProps, type CSSProperties, type Key, type ReactNode, useEffect, useMemo, useRef, useState } from "react"
|
|
4
4
|
|
|
5
5
|
import { clsx, getArray, isNullable } from "deepsea-tools"
|
|
6
|
-
import { DragMoveEvent, DragMoveEvents, useDragMove } from "soda-hooks"
|
|
6
|
+
import { type DragMoveEvent, type DragMoveEvents, useDragMove } from "soda-hooks"
|
|
7
7
|
|
|
8
8
|
import styles from "./DraggableGrid.module.css"
|
|
9
9
|
|
|
@@ -349,6 +349,7 @@ export function DraggableGrid<T, K extends Key = T extends Key ? T : never>({
|
|
|
349
349
|
setKeyToOrder(newOrderMap)
|
|
350
350
|
onOrderMapChange?.(newOrderMap)
|
|
351
351
|
const newRenderKeys = new Set(newOrderMap.keys())
|
|
352
|
+
|
|
352
353
|
// eslint-disable-next-line react-hooks/immutability
|
|
353
354
|
setRenderKeys(prev => prev.intersection(newRenderKeys).union(newRenderKeys.difference(prev)))
|
|
354
355
|
}
|