deepsea-components 5.4.0 → 5.4.2

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 (43) hide show
  1. package/dist/cjs/components/AutoFit.d.ts +25 -0
  2. package/dist/cjs/components/AutoScroll.d.ts +38 -0
  3. package/dist/cjs/components/AutoSizeTextarea.d.ts +5 -0
  4. package/dist/cjs/components/CircleText.d.ts +25 -0
  5. package/dist/cjs/components/Echart.d.ts +15 -0
  6. package/dist/cjs/components/Flow.d.ts +86 -0
  7. package/dist/cjs/components/HlsPlayer.d.ts +5 -0
  8. package/dist/cjs/components/InfiniteScroll.d.ts +31 -0
  9. package/dist/cjs/components/InputFile.d.ts +64 -0
  10. package/dist/cjs/components/LoopSwiper.d.ts +9 -0
  11. package/dist/cjs/components/Ring.d.ts +7 -0
  12. package/dist/cjs/components/Scroll.d.ts +24 -0
  13. package/dist/cjs/components/SectionRing.d.ts +8 -0
  14. package/dist/cjs/components/Skeleton.d.ts +5 -0
  15. package/dist/cjs/components/Title.d.ts +3 -0
  16. package/dist/cjs/components/TransitionBox.d.ts +10 -0
  17. package/dist/cjs/components/TransitionNum.d.ts +16 -0
  18. package/dist/cjs/components/Trapezium.d.ts +9 -0
  19. package/dist/cjs/index.d.ts +20 -0
  20. package/dist/cjs/utils/getReactVersion.d.ts +1 -0
  21. package/dist/cjs/utils/index.d.ts +9 -0
  22. package/dist/esm/components/AutoFit.d.ts +25 -0
  23. package/dist/esm/components/AutoScroll.d.ts +38 -0
  24. package/dist/esm/components/AutoSizeTextarea.d.ts +5 -0
  25. package/dist/esm/components/CircleText.d.ts +25 -0
  26. package/dist/esm/components/Echart.d.ts +15 -0
  27. package/dist/esm/components/Flow.d.ts +86 -0
  28. package/dist/esm/components/HlsPlayer.d.ts +5 -0
  29. package/dist/esm/components/InfiniteScroll.d.ts +31 -0
  30. package/dist/esm/components/InputFile.d.ts +64 -0
  31. package/dist/esm/components/LoopSwiper.d.ts +9 -0
  32. package/dist/esm/components/Ring.d.ts +7 -0
  33. package/dist/esm/components/Scroll.d.ts +24 -0
  34. package/dist/esm/components/SectionRing.d.ts +8 -0
  35. package/dist/esm/components/Skeleton.d.ts +5 -0
  36. package/dist/esm/components/Title.d.ts +3 -0
  37. package/dist/esm/components/TransitionBox.d.ts +10 -0
  38. package/dist/esm/components/TransitionNum.d.ts +16 -0
  39. package/dist/esm/components/Trapezium.d.ts +9 -0
  40. package/dist/esm/index.d.ts +20 -0
  41. package/dist/esm/utils/getReactVersion.d.ts +1 -0
  42. package/dist/esm/utils/index.d.ts +9 -0
  43. package/package.json +2 -2
@@ -0,0 +1,25 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface AutoFitProps extends HTMLAttributes<HTMLDivElement> {
3
+ /** 设计稿宽度,默认 1920 */
4
+ width?: number;
5
+ /** 设计稿高度,默认 1080 */
6
+ height?: number;
7
+ /**
8
+ * 在哪些方向进行缩放,默认缩放所有方向
9
+ * 1. 水平方向是指,宽度按照设计稿进行占满,高度反向缩放
10
+ * 2. 垂直方向是指,高度按照设计稿进行占满,宽度反向缩放
11
+ * 3. 默认是水平和垂直方向都进行缩放,类似于 background-size: contain 的效果
12
+ */
13
+ direction?: "horizontal" | "vertical" | "both";
14
+ }
15
+ /**
16
+ * 自适应缩放组件
17
+ *
18
+ * 注意:
19
+ * 1. 父元素必须设置非 static 定位方式
20
+ * 2. 父元素只能有且仅有一个子元素,那就是 AutoFit
21
+ * 3. 不要设置 AutoFit 的 position、left、top、transform、width、height 属性
22
+ * 4. 在第一次完成缩放前,无论 props 是什么,返回的都是 <div style={{ display: "none" }} />
23
+ * 5. 元素的属性、事件、资源并不是立即加载的,会有一帧的延迟,在第一次完成缩放后才会显示
24
+ */
25
+ export declare const AutoFit: import("react").ForwardRefExoticComponent<AutoFitProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,38 @@
1
+ import { CSSProperties } from "react";
2
+ import { ScrollProps } from "./Scroll";
3
+ export interface AutoScrollProps extends ScrollProps {
4
+ /** 轮播元素的个数 */
5
+ count: number;
6
+ /** 轮播元素的高度 */
7
+ itemHeight: number;
8
+ /**
9
+ * 轮播动画的时间,单位毫秒
10
+ * @default 1000
11
+ */
12
+ animation?: number;
13
+ /**
14
+ * 每个元素的停留时间,单位毫秒
15
+ * @default 3000
16
+ */
17
+ duration?: number;
18
+ /**
19
+ * 元素之间的间距
20
+ * @default 0
21
+ */
22
+ gap?: number;
23
+ /** 容器类名 */
24
+ containerClassName?: string;
25
+ /** 容器样式 */
26
+ containerStyle?: CSSProperties;
27
+ /**
28
+ * 在鼠标移入时是否继续播放
29
+ * @default false
30
+ */
31
+ playOnMouseEnter?: boolean;
32
+ /**
33
+ * 是否暂停
34
+ * @default false
35
+ */
36
+ paused?: boolean;
37
+ }
38
+ export declare const AutoScroll: import("react").ForwardRefExoticComponent<AutoScrollProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,5 @@
1
+ import { TextareaHTMLAttributes } from "react";
2
+ /**
3
+ * 自适应高度的文本域
4
+ */
5
+ export declare const AutoSizeTextArea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,25 @@
1
+ import { FC, HTMLAttributes } from "react";
2
+ export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
3
+ /** 每一个方块的宽度 */
4
+ width: number;
5
+ /** 每一个方块的高度 */
6
+ height: number;
7
+ /** 圆弧的半径,不包含方块的高度 */
8
+ radius: number;
9
+ /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
10
+ startAngel?: number;
11
+ /** 每一个方块之间间隔的弧度 */
12
+ gapAngel?: number;
13
+ /** 文字对齐的方式,默认居中 */
14
+ align?: "left" | "center" | "right";
15
+ /** 文字朝向圆心还是外侧,默认外侧 */
16
+ direction?: "inner" | "outer";
17
+ /** 是否反转文字顺序 */
18
+ reverse?: boolean;
19
+ /** 分割文字的方法 */
20
+ separator?: string | RegExp | ((text: string) => string[]);
21
+ /** 显示的文字 */
22
+ children: string;
23
+ }
24
+ /** 环形文字 */
25
+ export declare const CircleText: FC<CircleTextProps>;
@@ -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,86 @@
1
+ import { CSSProperties, HTMLAttributes, Key, ReactNode, RefObject } from "react";
2
+ export interface FlowSizeData {
3
+ /** 容器宽度 */
4
+ width: number;
5
+ /** 容器高度 */
6
+ height: number;
7
+ /** 元素宽度 */
8
+ itemWidth: number;
9
+ /** 元素高度 */
10
+ itemHeight: number;
11
+ /** 列间距 */
12
+ columnGap: number;
13
+ /** 列数 */
14
+ columnCount: number;
15
+ /** 行间距 */
16
+ rowGap: number;
17
+ /** 行数 */
18
+ rowCount: number;
19
+ /** 元素格数 */
20
+ itemCount: number;
21
+ /** 最大行数 */
22
+ maxRows: number | null;
23
+ /** 是否有元素被隐藏 */
24
+ overflow: boolean;
25
+ }
26
+ export interface FlowProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
27
+ /** 元素宽度 */
28
+ itemWidth: number;
29
+ /** 元素高度 */
30
+ itemHeight: number;
31
+ /**
32
+ * 列间距
33
+ * 1. 如果是数字,表示列间距是固定的
34
+ * 2. 如果是 auto,表示会在尽可能放进更多列的情况下,列间距是平均的
35
+ * 2. 如果是数组,表示列间距是区间的,第一个元素是最小值,第二个元素是最大值
36
+ */
37
+ columnGap?: number | "auto" | [number | "auto", number | "auto"];
38
+ /** 行间距 */
39
+ rowGap?: number;
40
+ gap?: number;
41
+ /** 最大行数 */
42
+ maxRows?: number | null;
43
+ /** 源数据 */
44
+ data?: T[];
45
+ /** 渲染 */
46
+ render: (item: T, index: number, arr: T[]) => ReactNode;
47
+ /** key释放器,默认为 index */
48
+ keyExactor?: (item: T, index: number, arr: T[]) => Key;
49
+ /**
50
+ * 渲染的元素由两层容器包裹,外层容器类名
51
+ */
52
+ wrapperClassName?: string;
53
+ /**
54
+ * 渲染的元素由两层容器包裹,外层容器样式
55
+ */
56
+ wrapperStyle?: CSSProperties;
57
+ /**
58
+ * 渲染的元素由两层容器包裹,内层容器类名
59
+ */
60
+ containerClassName?: string;
61
+ /**
62
+ * 渲染的元素由两层容器包裹,内层容器样式
63
+ */
64
+ containerStyle?: CSSProperties;
65
+ /** 节流时间,单位毫秒,默认200ms,传入 0 不节流 */
66
+ throttle?: number;
67
+ /** 动画时间,单位毫秒,默认400ms,传入 0 不展示动画 */
68
+ transitionDuration?: number;
69
+ /** 变化的回调函数 */
70
+ onSizeChange?: (sizeData: FlowSizeData) => void;
71
+ element?: RefObject<HTMLDivElement>;
72
+ }
73
+ export declare function getGapRange(gap?: undefined | number | "auto" | (number | "auto")[]): [number, number | "auto"];
74
+ export interface GapAndCount {
75
+ count: number;
76
+ gap: number;
77
+ }
78
+ export declare function getGapCountAndSize(width: number, itemWidth: number, minGap: number, maxGap: number | "auto"): GapAndCount;
79
+ export interface ManualFlowProps<T> extends FlowProps<T> {
80
+ /** 组件宽度,必须指定 */
81
+ width: number;
82
+ }
83
+ /** 手动组件,由外界指定宽度,性能更好 */
84
+ export declare function ManualFlow<T>(props: ManualFlowProps<T>): import("react/jsx-runtime").JSX.Element;
85
+ /** 自适应浮动组件 */
86
+ export declare function Flow<T>(props: FlowProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { MediaHTMLAttributes } from "react";
2
+ export interface HlsPlayerProps extends Omit<MediaHTMLAttributes<HTMLVideoElement>, "src"> {
3
+ src: string;
4
+ }
5
+ export declare const HlsPlayer: import("react").ForwardRefExoticComponent<HlsPlayerProps & import("react").RefAttributes<HTMLVideoElement>>;
@@ -0,0 +1,31 @@
1
+ import { ComponentProps, CSSProperties } from "react";
2
+ export type InfiniteScrollProps = ComponentProps<"div"> & {
3
+ /**
4
+ * 滚动的方向
5
+ * @default "vertical"
6
+ */
7
+ direction?: "vertical" | "horizontal";
8
+ /** 渲染 children 的容器的类名 */
9
+ containerClassName?: string;
10
+ /** 渲染 children 的容器的样式 */
11
+ containerStyle?: CSSProperties;
12
+ /**
13
+ * 两个 children 容器之间的间距
14
+ * @default 0
15
+ */
16
+ gap?: number;
17
+ /** 一个周期的时间,单位:毫秒 */
18
+ duration: number;
19
+ /** 是否将 gap 的距离也加入 overflow 的计算 */
20
+ withGap?: boolean;
21
+ /** 尺寸刚好相同时,是否视为溢出 */
22
+ withEqual?: boolean;
23
+ /** 鼠标移入时,是否停止动画 */
24
+ pauseOnHover?: boolean;
25
+ };
26
+ /**
27
+ * 无限滚动的组件
28
+ * 子元素会内置的容器中被渲染两次,首尾相连,形成无限滚动的效果
29
+ * 但是,如果内部检测到并没有溢出,那么不会渲染两次,并且没有动画
30
+ */
31
+ export declare const InfiniteScroll: import("react").ForwardRefExoticComponent<Omit<InfiniteScrollProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,64 @@
1
+ import { ButtonHTMLAttributes, InputHTMLAttributes } from "react";
2
+ export interface InputFileDataTypes {
3
+ base64: string;
4
+ text: string;
5
+ arrayBuffer: ArrayBuffer;
6
+ binary: string;
7
+ file: File;
8
+ }
9
+ export type InputFileDataType = keyof InputFileDataTypes;
10
+ export interface InputFileData<T> {
11
+ result: T;
12
+ file: File;
13
+ }
14
+ export type InputFileProps = ({
15
+ multiple?: false;
16
+ type: "base64" | "text" | "binary";
17
+ onChange?: (data: InputFileData<string>) => void;
18
+ } | {
19
+ multiple?: false;
20
+ type: "arrayBuffer";
21
+ onChange?: (data: InputFileData<ArrayBuffer>) => void;
22
+ } | {
23
+ multiple?: false;
24
+ type?: "file";
25
+ onChange?: (data: InputFileData<File>) => void;
26
+ } | {
27
+ multiple: true;
28
+ type: "base64" | "text" | "binary";
29
+ onChange?: (data: InputFileData<string>[]) => void;
30
+ } | {
31
+ multiple: true;
32
+ type: "arrayBuffer";
33
+ onChange?: (data: InputFileData<ArrayBuffer>[]) => void;
34
+ } | {
35
+ multiple: true;
36
+ type?: "file";
37
+ onChange?: (data: InputFileData<File>[]) => void;
38
+ }) & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "multiple" | "type"> & {
39
+ /** 是否在捕获文件后清除 input 上的文件,默认为 false,主要区别在于如果不清除,连续两次选择同样的文件不会触发 onChange 事件,如果用于 form 表单,请设置为 flase */
40
+ clearAfterChange?: boolean;
41
+ };
42
+ export declare function getFileData<T extends InputFileDataType>(file: File, type: T): Promise<InputFileDataTypes[T]>;
43
+ /** 专用于读取文件的组件 */
44
+ export declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
45
+ export type InputFileButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
46
+ input: InputFileProps;
47
+ };
48
+ /** 专用于读取文件的 button 组件 */
49
+ export declare const InputFileButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
50
+ input: InputFileProps;
51
+ } & import("react").RefAttributes<HTMLButtonElement>>;
52
+ export interface ImportExcelProps extends Omit<InputFileProps, "multiple" | "onChange" | "accept" | "type"> {
53
+ onChange?: (data: Record<string, string>[]) => void;
54
+ }
55
+ /** 专门用于读取 excel 的组件 */
56
+ export declare const ImportExcel: import("react").ForwardRefExoticComponent<ImportExcelProps & import("react").RefAttributes<HTMLInputElement>>;
57
+ /** 手动导出 excel */
58
+ export declare function exportExcel(data: Record<string, string>[], name: string): void;
59
+ export interface ExportExcelProps extends ButtonHTMLAttributes<HTMLButtonElement> {
60
+ data: Record<string, string>[];
61
+ fileName: string;
62
+ }
63
+ /** 导出 excel 的 button 组件 */
64
+ export declare const ExportExcel: import("react").ForwardRefExoticComponent<ExportExcelProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,9 @@
1
+ import { CSSProperties, HTMLAttributes } from "react";
2
+ export interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {
3
+ direction?: "horizontal" | "vertical";
4
+ reverse?: boolean;
5
+ period: number;
6
+ gap?: CSSProperties["gap"];
7
+ }
8
+ /** 循环播放组件 */
9
+ export declare const LoopSwiper: import("react").ForwardRefExoticComponent<LoopSwiperProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,7 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface RingProps extends HTMLAttributes<HTMLDivElement> {
3
+ outerWidth: number;
4
+ innerWidth: number;
5
+ }
6
+ /** 环形组件 */
7
+ export declare const Ring: import("react").ForwardRefExoticComponent<RingProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,24 @@
1
+ import { CSSProperties, ForwardedRef, HTMLAttributes } from "react";
2
+ import Scrollbar from "smooth-scrollbar";
3
+ import type { ScrollbarOptions, ScrollListener } from "smooth-scrollbar/interfaces";
4
+ export { default as Scrollbar } from "smooth-scrollbar";
5
+ export * from "smooth-scrollbar/interfaces";
6
+ export interface ScrollOptions extends Partial<ScrollbarOptions> {
7
+ /** 滑块宽度 */
8
+ thumbWidth?: number | string;
9
+ /** 滑块圆角大小 */
10
+ thumbRadius?: number | string;
11
+ /** 滑块背景颜色 */
12
+ thumbColor?: CSSProperties["backgroundColor"];
13
+ /** 滚动条背景颜色 */
14
+ trackColor?: CSSProperties["backgroundColor"];
15
+ }
16
+ export interface ScrollProps extends HTMLAttributes<HTMLDivElement> {
17
+ /** 滚动的配置 */
18
+ options?: ScrollOptions;
19
+ /** 滚动条实例 */
20
+ scrollbar?: ForwardedRef<Scrollbar>;
21
+ /** 滚动条滚动事件 */
22
+ onScrollbar?: ScrollListener;
23
+ }
24
+ export declare const Scroll: import("react").ForwardRefExoticComponent<ScrollProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import { FC, HTMLAttributes } from "react";
2
+ export interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {
3
+ outerRadius: number;
4
+ innerRadius: number;
5
+ count: number;
6
+ angel: number;
7
+ }
8
+ export declare const SectionRing: FC<SectionRingProps>;
@@ -0,0 +1,5 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
3
+ loading?: boolean;
4
+ }
5
+ export declare const Skeleton: import("react").ForwardRefExoticComponent<SkeletonProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import { ComponentProps } from "react";
2
+ export type TitleProps = ComponentProps<"title">;
3
+ export declare const Title: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>, "ref"> & import("react").RefAttributes<HTMLTitleElement>>;
@@ -0,0 +1,10 @@
1
+ import { CSSProperties, FC, HTMLAttributes } from "react";
2
+ export interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {
3
+ containerClassName?: string;
4
+ containerStyle?: CSSProperties;
5
+ vertical?: boolean;
6
+ horizontal?: boolean;
7
+ time?: number;
8
+ }
9
+ /** 尺寸渐变的组件 */
10
+ export declare const TransitionBox: FC<TransitionBoxProps>;
@@ -0,0 +1,16 @@
1
+ import { ForwardedRef, HTMLAttributes } from "react";
2
+ export interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
3
+ /** 当前数字 */
4
+ children: number;
5
+ /** 变换周期,单位帧 */
6
+ period: number;
7
+ /** 数字转换为字符串的方法 */
8
+ numToStr?: (num: number) => string;
9
+ /** 实例 */
10
+ ins?: ForwardedRef<TransitionNumIns>;
11
+ }
12
+ export interface TransitionNumIns {
13
+ get(): number;
14
+ }
15
+ /** 渐变数字组件 */
16
+ export declare const TransitionNum: import("react").ForwardRefExoticComponent<TransitionNumProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,9 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {
3
+ top: number;
4
+ bottom: number;
5
+ height: number;
6
+ borderRadius: number;
7
+ }
8
+ /** 梯形组件 */
9
+ export declare const Trapezium: import("react").ForwardRefExoticComponent<TrapeziumProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ export * from "./components/AutoFit";
2
+ export * from "./components/AutoScroll";
3
+ export * from "./components/AutoSizeTextarea";
4
+ export * from "./components/CircleText";
5
+ export * from "./components/Echart";
6
+ export * from "./components/Flow";
7
+ export * from "./components/HlsPlayer";
8
+ export * from "./components/InfiniteScroll";
9
+ export * from "./components/InputFile";
10
+ export * from "./components/LoopSwiper";
11
+ export * from "./components/Ring";
12
+ export * from "./components/Scroll";
13
+ export * from "./components/SectionRing";
14
+ export * from "./components/Skeleton";
15
+ export * from "./components/Title";
16
+ export * from "./components/TransitionBox";
17
+ export * from "./components/TransitionNum";
18
+ export * from "./components/Trapezium";
19
+ export * from "./utils/getReactVersion";
20
+ export * from "./utils/index";
@@ -0,0 +1 @@
1
+ export declare function getReactVersion(): number[];
@@ -0,0 +1,9 @@
1
+ import { CSSProperties } from "react";
2
+ export type CSSVariableName = `--${string}`;
3
+ export type CSSVariableValue = string | number | undefined;
4
+ export interface StyleWithCSSVariable extends CSSProperties {
5
+ [X: CSSVariableName]: CSSVariableValue;
6
+ }
7
+ export declare function transformCSSVariableName(name: string): CSSVariableName;
8
+ export declare function transformCSSVariable(style: Partial<Record<string, CSSVariableValue>>, style2?: CSSProperties): CSSProperties;
9
+ export declare function px(value: string | number | undefined): string | undefined;
@@ -0,0 +1,25 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface AutoFitProps extends HTMLAttributes<HTMLDivElement> {
3
+ /** 设计稿宽度,默认 1920 */
4
+ width?: number;
5
+ /** 设计稿高度,默认 1080 */
6
+ height?: number;
7
+ /**
8
+ * 在哪些方向进行缩放,默认缩放所有方向
9
+ * 1. 水平方向是指,宽度按照设计稿进行占满,高度反向缩放
10
+ * 2. 垂直方向是指,高度按照设计稿进行占满,宽度反向缩放
11
+ * 3. 默认是水平和垂直方向都进行缩放,类似于 background-size: contain 的效果
12
+ */
13
+ direction?: "horizontal" | "vertical" | "both";
14
+ }
15
+ /**
16
+ * 自适应缩放组件
17
+ *
18
+ * 注意:
19
+ * 1. 父元素必须设置非 static 定位方式
20
+ * 2. 父元素只能有且仅有一个子元素,那就是 AutoFit
21
+ * 3. 不要设置 AutoFit 的 position、left、top、transform、width、height 属性
22
+ * 4. 在第一次完成缩放前,无论 props 是什么,返回的都是 <div style={{ display: "none" }} />
23
+ * 5. 元素的属性、事件、资源并不是立即加载的,会有一帧的延迟,在第一次完成缩放后才会显示
24
+ */
25
+ export declare const AutoFit: import("react").ForwardRefExoticComponent<AutoFitProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,38 @@
1
+ import { CSSProperties } from "react";
2
+ import { ScrollProps } from "./Scroll";
3
+ export interface AutoScrollProps extends ScrollProps {
4
+ /** 轮播元素的个数 */
5
+ count: number;
6
+ /** 轮播元素的高度 */
7
+ itemHeight: number;
8
+ /**
9
+ * 轮播动画的时间,单位毫秒
10
+ * @default 1000
11
+ */
12
+ animation?: number;
13
+ /**
14
+ * 每个元素的停留时间,单位毫秒
15
+ * @default 3000
16
+ */
17
+ duration?: number;
18
+ /**
19
+ * 元素之间的间距
20
+ * @default 0
21
+ */
22
+ gap?: number;
23
+ /** 容器类名 */
24
+ containerClassName?: string;
25
+ /** 容器样式 */
26
+ containerStyle?: CSSProperties;
27
+ /**
28
+ * 在鼠标移入时是否继续播放
29
+ * @default false
30
+ */
31
+ playOnMouseEnter?: boolean;
32
+ /**
33
+ * 是否暂停
34
+ * @default false
35
+ */
36
+ paused?: boolean;
37
+ }
38
+ export declare const AutoScroll: import("react").ForwardRefExoticComponent<AutoScrollProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,5 @@
1
+ import { TextareaHTMLAttributes } from "react";
2
+ /**
3
+ * 自适应高度的文本域
4
+ */
5
+ export declare const AutoSizeTextArea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,25 @@
1
+ import { FC, HTMLAttributes } from "react";
2
+ export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
3
+ /** 每一个方块的宽度 */
4
+ width: number;
5
+ /** 每一个方块的高度 */
6
+ height: number;
7
+ /** 圆弧的半径,不包含方块的高度 */
8
+ radius: number;
9
+ /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
10
+ startAngel?: number;
11
+ /** 每一个方块之间间隔的弧度 */
12
+ gapAngel?: number;
13
+ /** 文字对齐的方式,默认居中 */
14
+ align?: "left" | "center" | "right";
15
+ /** 文字朝向圆心还是外侧,默认外侧 */
16
+ direction?: "inner" | "outer";
17
+ /** 是否反转文字顺序 */
18
+ reverse?: boolean;
19
+ /** 分割文字的方法 */
20
+ separator?: string | RegExp | ((text: string) => string[]);
21
+ /** 显示的文字 */
22
+ children: string;
23
+ }
24
+ /** 环形文字 */
25
+ export declare const CircleText: FC<CircleTextProps>;
@@ -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,86 @@
1
+ import { CSSProperties, HTMLAttributes, Key, ReactNode, RefObject } from "react";
2
+ export interface FlowSizeData {
3
+ /** 容器宽度 */
4
+ width: number;
5
+ /** 容器高度 */
6
+ height: number;
7
+ /** 元素宽度 */
8
+ itemWidth: number;
9
+ /** 元素高度 */
10
+ itemHeight: number;
11
+ /** 列间距 */
12
+ columnGap: number;
13
+ /** 列数 */
14
+ columnCount: number;
15
+ /** 行间距 */
16
+ rowGap: number;
17
+ /** 行数 */
18
+ rowCount: number;
19
+ /** 元素格数 */
20
+ itemCount: number;
21
+ /** 最大行数 */
22
+ maxRows: number | null;
23
+ /** 是否有元素被隐藏 */
24
+ overflow: boolean;
25
+ }
26
+ export interface FlowProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
27
+ /** 元素宽度 */
28
+ itemWidth: number;
29
+ /** 元素高度 */
30
+ itemHeight: number;
31
+ /**
32
+ * 列间距
33
+ * 1. 如果是数字,表示列间距是固定的
34
+ * 2. 如果是 auto,表示会在尽可能放进更多列的情况下,列间距是平均的
35
+ * 2. 如果是数组,表示列间距是区间的,第一个元素是最小值,第二个元素是最大值
36
+ */
37
+ columnGap?: number | "auto" | [number | "auto", number | "auto"];
38
+ /** 行间距 */
39
+ rowGap?: number;
40
+ gap?: number;
41
+ /** 最大行数 */
42
+ maxRows?: number | null;
43
+ /** 源数据 */
44
+ data?: T[];
45
+ /** 渲染 */
46
+ render: (item: T, index: number, arr: T[]) => ReactNode;
47
+ /** key释放器,默认为 index */
48
+ keyExactor?: (item: T, index: number, arr: T[]) => Key;
49
+ /**
50
+ * 渲染的元素由两层容器包裹,外层容器类名
51
+ */
52
+ wrapperClassName?: string;
53
+ /**
54
+ * 渲染的元素由两层容器包裹,外层容器样式
55
+ */
56
+ wrapperStyle?: CSSProperties;
57
+ /**
58
+ * 渲染的元素由两层容器包裹,内层容器类名
59
+ */
60
+ containerClassName?: string;
61
+ /**
62
+ * 渲染的元素由两层容器包裹,内层容器样式
63
+ */
64
+ containerStyle?: CSSProperties;
65
+ /** 节流时间,单位毫秒,默认200ms,传入 0 不节流 */
66
+ throttle?: number;
67
+ /** 动画时间,单位毫秒,默认400ms,传入 0 不展示动画 */
68
+ transitionDuration?: number;
69
+ /** 变化的回调函数 */
70
+ onSizeChange?: (sizeData: FlowSizeData) => void;
71
+ element?: RefObject<HTMLDivElement>;
72
+ }
73
+ export declare function getGapRange(gap?: undefined | number | "auto" | (number | "auto")[]): [number, number | "auto"];
74
+ export interface GapAndCount {
75
+ count: number;
76
+ gap: number;
77
+ }
78
+ export declare function getGapCountAndSize(width: number, itemWidth: number, minGap: number, maxGap: number | "auto"): GapAndCount;
79
+ export interface ManualFlowProps<T> extends FlowProps<T> {
80
+ /** 组件宽度,必须指定 */
81
+ width: number;
82
+ }
83
+ /** 手动组件,由外界指定宽度,性能更好 */
84
+ export declare function ManualFlow<T>(props: ManualFlowProps<T>): import("react/jsx-runtime").JSX.Element;
85
+ /** 自适应浮动组件 */
86
+ export declare function Flow<T>(props: FlowProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { MediaHTMLAttributes } from "react";
2
+ export interface HlsPlayerProps extends Omit<MediaHTMLAttributes<HTMLVideoElement>, "src"> {
3
+ src: string;
4
+ }
5
+ export declare const HlsPlayer: import("react").ForwardRefExoticComponent<HlsPlayerProps & import("react").RefAttributes<HTMLVideoElement>>;
@@ -0,0 +1,31 @@
1
+ import { ComponentProps, CSSProperties } from "react";
2
+ export type InfiniteScrollProps = ComponentProps<"div"> & {
3
+ /**
4
+ * 滚动的方向
5
+ * @default "vertical"
6
+ */
7
+ direction?: "vertical" | "horizontal";
8
+ /** 渲染 children 的容器的类名 */
9
+ containerClassName?: string;
10
+ /** 渲染 children 的容器的样式 */
11
+ containerStyle?: CSSProperties;
12
+ /**
13
+ * 两个 children 容器之间的间距
14
+ * @default 0
15
+ */
16
+ gap?: number;
17
+ /** 一个周期的时间,单位:毫秒 */
18
+ duration: number;
19
+ /** 是否将 gap 的距离也加入 overflow 的计算 */
20
+ withGap?: boolean;
21
+ /** 尺寸刚好相同时,是否视为溢出 */
22
+ withEqual?: boolean;
23
+ /** 鼠标移入时,是否停止动画 */
24
+ pauseOnHover?: boolean;
25
+ };
26
+ /**
27
+ * 无限滚动的组件
28
+ * 子元素会内置的容器中被渲染两次,首尾相连,形成无限滚动的效果
29
+ * 但是,如果内部检测到并没有溢出,那么不会渲染两次,并且没有动画
30
+ */
31
+ export declare const InfiniteScroll: import("react").ForwardRefExoticComponent<Omit<InfiniteScrollProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,64 @@
1
+ import { ButtonHTMLAttributes, InputHTMLAttributes } from "react";
2
+ export interface InputFileDataTypes {
3
+ base64: string;
4
+ text: string;
5
+ arrayBuffer: ArrayBuffer;
6
+ binary: string;
7
+ file: File;
8
+ }
9
+ export type InputFileDataType = keyof InputFileDataTypes;
10
+ export interface InputFileData<T> {
11
+ result: T;
12
+ file: File;
13
+ }
14
+ export type InputFileProps = ({
15
+ multiple?: false;
16
+ type: "base64" | "text" | "binary";
17
+ onChange?: (data: InputFileData<string>) => void;
18
+ } | {
19
+ multiple?: false;
20
+ type: "arrayBuffer";
21
+ onChange?: (data: InputFileData<ArrayBuffer>) => void;
22
+ } | {
23
+ multiple?: false;
24
+ type?: "file";
25
+ onChange?: (data: InputFileData<File>) => void;
26
+ } | {
27
+ multiple: true;
28
+ type: "base64" | "text" | "binary";
29
+ onChange?: (data: InputFileData<string>[]) => void;
30
+ } | {
31
+ multiple: true;
32
+ type: "arrayBuffer";
33
+ onChange?: (data: InputFileData<ArrayBuffer>[]) => void;
34
+ } | {
35
+ multiple: true;
36
+ type?: "file";
37
+ onChange?: (data: InputFileData<File>[]) => void;
38
+ }) & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "multiple" | "type"> & {
39
+ /** 是否在捕获文件后清除 input 上的文件,默认为 false,主要区别在于如果不清除,连续两次选择同样的文件不会触发 onChange 事件,如果用于 form 表单,请设置为 flase */
40
+ clearAfterChange?: boolean;
41
+ };
42
+ export declare function getFileData<T extends InputFileDataType>(file: File, type: T): Promise<InputFileDataTypes[T]>;
43
+ /** 专用于读取文件的组件 */
44
+ export declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
45
+ export type InputFileButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
46
+ input: InputFileProps;
47
+ };
48
+ /** 专用于读取文件的 button 组件 */
49
+ export declare const InputFileButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
50
+ input: InputFileProps;
51
+ } & import("react").RefAttributes<HTMLButtonElement>>;
52
+ export interface ImportExcelProps extends Omit<InputFileProps, "multiple" | "onChange" | "accept" | "type"> {
53
+ onChange?: (data: Record<string, string>[]) => void;
54
+ }
55
+ /** 专门用于读取 excel 的组件 */
56
+ export declare const ImportExcel: import("react").ForwardRefExoticComponent<ImportExcelProps & import("react").RefAttributes<HTMLInputElement>>;
57
+ /** 手动导出 excel */
58
+ export declare function exportExcel(data: Record<string, string>[], name: string): void;
59
+ export interface ExportExcelProps extends ButtonHTMLAttributes<HTMLButtonElement> {
60
+ data: Record<string, string>[];
61
+ fileName: string;
62
+ }
63
+ /** 导出 excel 的 button 组件 */
64
+ export declare const ExportExcel: import("react").ForwardRefExoticComponent<ExportExcelProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,9 @@
1
+ import { CSSProperties, HTMLAttributes } from "react";
2
+ export interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {
3
+ direction?: "horizontal" | "vertical";
4
+ reverse?: boolean;
5
+ period: number;
6
+ gap?: CSSProperties["gap"];
7
+ }
8
+ /** 循环播放组件 */
9
+ export declare const LoopSwiper: import("react").ForwardRefExoticComponent<LoopSwiperProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,7 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface RingProps extends HTMLAttributes<HTMLDivElement> {
3
+ outerWidth: number;
4
+ innerWidth: number;
5
+ }
6
+ /** 环形组件 */
7
+ export declare const Ring: import("react").ForwardRefExoticComponent<RingProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,24 @@
1
+ import { CSSProperties, ForwardedRef, HTMLAttributes } from "react";
2
+ import Scrollbar from "smooth-scrollbar";
3
+ import type { ScrollbarOptions, ScrollListener } from "smooth-scrollbar/interfaces";
4
+ export { default as Scrollbar } from "smooth-scrollbar";
5
+ export * from "smooth-scrollbar/interfaces";
6
+ export interface ScrollOptions extends Partial<ScrollbarOptions> {
7
+ /** 滑块宽度 */
8
+ thumbWidth?: number | string;
9
+ /** 滑块圆角大小 */
10
+ thumbRadius?: number | string;
11
+ /** 滑块背景颜色 */
12
+ thumbColor?: CSSProperties["backgroundColor"];
13
+ /** 滚动条背景颜色 */
14
+ trackColor?: CSSProperties["backgroundColor"];
15
+ }
16
+ export interface ScrollProps extends HTMLAttributes<HTMLDivElement> {
17
+ /** 滚动的配置 */
18
+ options?: ScrollOptions;
19
+ /** 滚动条实例 */
20
+ scrollbar?: ForwardedRef<Scrollbar>;
21
+ /** 滚动条滚动事件 */
22
+ onScrollbar?: ScrollListener;
23
+ }
24
+ export declare const Scroll: import("react").ForwardRefExoticComponent<ScrollProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import { FC, HTMLAttributes } from "react";
2
+ export interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {
3
+ outerRadius: number;
4
+ innerRadius: number;
5
+ count: number;
6
+ angel: number;
7
+ }
8
+ export declare const SectionRing: FC<SectionRingProps>;
@@ -0,0 +1,5 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
3
+ loading?: boolean;
4
+ }
5
+ export declare const Skeleton: import("react").ForwardRefExoticComponent<SkeletonProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import { ComponentProps } from "react";
2
+ export type TitleProps = ComponentProps<"title">;
3
+ export declare const Title: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>, "ref"> & import("react").RefAttributes<HTMLTitleElement>>;
@@ -0,0 +1,10 @@
1
+ import { CSSProperties, FC, HTMLAttributes } from "react";
2
+ export interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {
3
+ containerClassName?: string;
4
+ containerStyle?: CSSProperties;
5
+ vertical?: boolean;
6
+ horizontal?: boolean;
7
+ time?: number;
8
+ }
9
+ /** 尺寸渐变的组件 */
10
+ export declare const TransitionBox: FC<TransitionBoxProps>;
@@ -0,0 +1,16 @@
1
+ import { ForwardedRef, HTMLAttributes } from "react";
2
+ export interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
3
+ /** 当前数字 */
4
+ children: number;
5
+ /** 变换周期,单位帧 */
6
+ period: number;
7
+ /** 数字转换为字符串的方法 */
8
+ numToStr?: (num: number) => string;
9
+ /** 实例 */
10
+ ins?: ForwardedRef<TransitionNumIns>;
11
+ }
12
+ export interface TransitionNumIns {
13
+ get(): number;
14
+ }
15
+ /** 渐变数字组件 */
16
+ export declare const TransitionNum: import("react").ForwardRefExoticComponent<TransitionNumProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,9 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {
3
+ top: number;
4
+ bottom: number;
5
+ height: number;
6
+ borderRadius: number;
7
+ }
8
+ /** 梯形组件 */
9
+ export declare const Trapezium: import("react").ForwardRefExoticComponent<TrapeziumProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ export * from "./components/AutoFit";
2
+ export * from "./components/AutoScroll";
3
+ export * from "./components/AutoSizeTextarea";
4
+ export * from "./components/CircleText";
5
+ export * from "./components/Echart";
6
+ export * from "./components/Flow";
7
+ export * from "./components/HlsPlayer";
8
+ export * from "./components/InfiniteScroll";
9
+ export * from "./components/InputFile";
10
+ export * from "./components/LoopSwiper";
11
+ export * from "./components/Ring";
12
+ export * from "./components/Scroll";
13
+ export * from "./components/SectionRing";
14
+ export * from "./components/Skeleton";
15
+ export * from "./components/Title";
16
+ export * from "./components/TransitionBox";
17
+ export * from "./components/TransitionNum";
18
+ export * from "./components/Trapezium";
19
+ export * from "./utils/getReactVersion";
20
+ export * from "./utils/index";
@@ -0,0 +1 @@
1
+ export declare function getReactVersion(): number[];
@@ -0,0 +1,9 @@
1
+ import { CSSProperties } from "react";
2
+ export type CSSVariableName = `--${string}`;
3
+ export type CSSVariableValue = string | number | undefined;
4
+ export interface StyleWithCSSVariable extends CSSProperties {
5
+ [X: CSSVariableName]: CSSVariableValue;
6
+ }
7
+ export declare function transformCSSVariableName(name: string): CSSVariableName;
8
+ export declare function transformCSSVariable(style: Partial<Record<string, CSSVariableValue>>, style2?: CSSProperties): CSSProperties;
9
+ export declare function px(value: string | number | undefined): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepsea-components",
3
- "version": "5.4.0",
3
+ "version": "5.4.2",
4
4
  "description": "格数科技自用组件库",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -30,7 +30,7 @@
30
30
  "hls.js": "^1.5.8",
31
31
  "smooth-scrollbar": "^8.8.4",
32
32
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
33
- "deepsea-tools": "5.6.0"
33
+ "deepsea-tools": "5.7.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "father": "^4.4.1",