deepsea-components 2.8.3 → 3.0.0
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/dist/cjs/components/AutoFit.d.ts +25 -0
- package/dist/cjs/components/AutoFit.js +99 -0
- package/dist/cjs/components/AutoFit.js.map +7 -0
- package/dist/cjs/components/AutoScroll.d.ts +5 -0
- package/dist/cjs/components/AutoScroll.js +8 -6
- package/dist/cjs/components/AutoScroll.js.map +2 -2
- package/dist/cjs/components/AutoSizeTextarea.d.ts +5 -0
- package/dist/cjs/components/AutoSizeTextarea.js +51 -0
- package/dist/cjs/components/AutoSizeTextarea.js.map +7 -0
- package/dist/cjs/components/CircleText.d.ts +25 -0
- package/dist/cjs/components/CircleText.js +48 -0
- package/dist/cjs/components/CircleText.js.map +7 -0
- package/dist/cjs/components/Flow.d.ts +57 -0
- package/dist/cjs/components/Flow.js +119 -0
- package/dist/cjs/components/Flow.js.map +7 -0
- package/dist/cjs/components/InputFile.d.ts +64 -0
- package/dist/cjs/components/InputFile.js +143 -0
- package/dist/cjs/components/InputFile.js.map +7 -0
- package/dist/cjs/components/LoopSwiper.d.ts +9 -0
- package/dist/cjs/components/LoopSwiper.js +116 -0
- package/dist/cjs/components/LoopSwiper.js.map +7 -0
- package/dist/cjs/components/Ring.d.ts +7 -0
- package/dist/cjs/components/Ring.js +37 -0
- package/dist/cjs/components/Ring.js.map +7 -0
- package/dist/cjs/components/Scroll.js.map +2 -2
- package/dist/cjs/components/SectionRing.d.ts +8 -0
- package/dist/cjs/components/SectionRing.js +50 -0
- package/dist/cjs/components/SectionRing.js.map +7 -0
- package/dist/cjs/components/Skeleton.d.ts +3 -0
- package/dist/cjs/components/Skeleton.js +60 -0
- package/dist/cjs/components/Skeleton.js.map +7 -0
- package/dist/cjs/components/TransitionBox.d.ts +10 -0
- package/dist/cjs/components/TransitionBox.js +45 -0
- package/dist/cjs/components/TransitionBox.js.map +7 -0
- package/dist/cjs/components/TransitionNum.d.ts +16 -0
- package/dist/cjs/components/TransitionNum.js +62 -0
- package/dist/cjs/components/TransitionNum.js.map +7 -0
- package/dist/cjs/components/Trapezium.d.ts +9 -0
- package/dist/cjs/components/Trapezium.js +44 -0
- package/dist/cjs/components/Trapezium.js.map +7 -0
- package/dist/cjs/index.d.ts +13 -265
- package/dist/cjs/index.js +26 -505
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/components/AutoFit.d.ts +25 -0
- package/dist/esm/components/AutoFit.js +87 -0
- package/dist/esm/components/AutoFit.js.map +1 -0
- package/dist/esm/components/AutoScroll.d.ts +5 -0
- package/dist/esm/components/AutoScroll.js +8 -5
- package/dist/esm/components/AutoScroll.js.map +1 -1
- package/dist/esm/components/AutoSizeTextarea.d.ts +5 -0
- package/dist/esm/components/AutoSizeTextarea.js +45 -0
- package/dist/esm/components/AutoSizeTextarea.js.map +1 -0
- package/dist/esm/components/CircleText.d.ts +25 -0
- package/dist/esm/components/CircleText.js +49 -0
- package/dist/esm/components/CircleText.js.map +1 -0
- package/dist/esm/components/Flow.d.ts +57 -0
- package/dist/esm/components/Flow.js +130 -0
- package/dist/esm/components/Flow.js.map +1 -0
- package/dist/esm/components/InputFile.d.ts +64 -0
- package/dist/esm/components/InputFile.js +167 -0
- package/dist/esm/components/InputFile.js.map +1 -0
- package/dist/esm/components/LoopSwiper.d.ts +9 -0
- package/dist/esm/components/LoopSwiper.js +122 -0
- package/dist/esm/components/LoopSwiper.js.map +1 -0
- package/dist/esm/components/Ring.d.ts +7 -0
- package/dist/esm/components/Ring.js +26 -0
- package/dist/esm/components/Ring.js.map +1 -0
- package/dist/esm/components/Scroll.js.map +1 -1
- package/dist/esm/components/SectionRing.d.ts +8 -0
- package/dist/esm/components/SectionRing.js +31 -0
- package/dist/esm/components/SectionRing.js.map +1 -0
- package/dist/esm/components/Skeleton.d.ts +3 -0
- package/dist/esm/components/Skeleton.js +35 -0
- package/dist/esm/components/Skeleton.js.map +1 -0
- package/dist/esm/components/TransitionBox.d.ts +10 -0
- package/dist/esm/components/TransitionBox.js +50 -0
- package/dist/esm/components/TransitionBox.js.map +1 -0
- package/dist/esm/components/TransitionNum.d.ts +16 -0
- package/dist/esm/components/TransitionNum.js +65 -0
- package/dist/esm/components/TransitionNum.js.map +1 -0
- package/dist/esm/components/Trapezium.d.ts +9 -0
- package/dist/esm/components/Trapezium.js +35 -0
- package/dist/esm/components/Trapezium.js.map +1 -0
- package/dist/esm/index.d.ts +13 -265
- package/dist/esm/index.js +13 -843
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/AutoFit.tsx +95 -0
- package/src/components/AutoScroll.tsx +18 -9
- package/src/components/AutoSizeTextarea.tsx +31 -0
- package/src/components/CircleText.tsx +56 -0
- package/src/components/Flow.tsx +154 -0
- package/src/components/InputFile.tsx +193 -0
- package/src/components/LoopSwiper.tsx +101 -0
- package/src/components/Ring.tsx +19 -0
- package/src/components/Scroll.tsx +1 -0
- package/src/components/SectionRing.tsx +36 -0
- package/src/components/Skeleton.tsx +38 -0
- package/src/components/TransitionBox.tsx +36 -0
- package/src/components/TransitionNum.tsx +54 -0
- package/src/components/Trapezium.tsx +35 -0
- package/src/index.tsx +13 -862
- package/dist/cjs/skeleton.css +0 -18
- package/dist/esm/skeleton.css +0 -18
- package/src/skeleton.css +0 -18
|
@@ -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,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/InputFile.tsx
|
|
21
|
+
var InputFile_exports = {};
|
|
22
|
+
__export(InputFile_exports, {
|
|
23
|
+
ExportExcel: () => ExportExcel,
|
|
24
|
+
ImportExcel: () => ImportExcel,
|
|
25
|
+
InputFile: () => InputFile,
|
|
26
|
+
InputFileButton: () => InputFileButton,
|
|
27
|
+
exportExcel: () => exportExcel,
|
|
28
|
+
getFileData: () => getFileData
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(InputFile_exports);
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_xlsx = require("xlsx");
|
|
33
|
+
async function getFileData(file, type) {
|
|
34
|
+
const fileReader = new FileReader();
|
|
35
|
+
switch (type) {
|
|
36
|
+
case "arrayBuffer":
|
|
37
|
+
fileReader.readAsArrayBuffer(file);
|
|
38
|
+
break;
|
|
39
|
+
case "binary":
|
|
40
|
+
fileReader.readAsBinaryString(file);
|
|
41
|
+
break;
|
|
42
|
+
case "base64":
|
|
43
|
+
fileReader.readAsDataURL(file);
|
|
44
|
+
break;
|
|
45
|
+
case "text":
|
|
46
|
+
fileReader.readAsText(file);
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
return file;
|
|
50
|
+
}
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
fileReader.addEventListener("load", () => {
|
|
53
|
+
resolve(fileReader.result);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var InputFile = (0, import_react.forwardRef)((props, ref) => {
|
|
58
|
+
const { multiple = false, type = "file", onChange, disabled: inputDisabled, clearAfterChange, ...rest } = props;
|
|
59
|
+
const [disabled, setDisabled] = (0, import_react.useState)(false);
|
|
60
|
+
async function onInputChange(e) {
|
|
61
|
+
const input = e.target;
|
|
62
|
+
const { files } = input;
|
|
63
|
+
if (!files || files.length === 0)
|
|
64
|
+
return;
|
|
65
|
+
setDisabled(true);
|
|
66
|
+
try {
|
|
67
|
+
if (multiple) {
|
|
68
|
+
const result = [];
|
|
69
|
+
for (const file of Array.from(files)) {
|
|
70
|
+
result.push({
|
|
71
|
+
result: await getFileData(file, type),
|
|
72
|
+
file
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
onChange?.(result);
|
|
76
|
+
} else {
|
|
77
|
+
onChange?.({
|
|
78
|
+
result: await getFileData(files[0], type),
|
|
79
|
+
file: files[0]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
setDisabled(false);
|
|
83
|
+
if (clearAfterChange)
|
|
84
|
+
input.value = "";
|
|
85
|
+
} catch (error) {
|
|
86
|
+
setDisabled(false);
|
|
87
|
+
if (clearAfterChange)
|
|
88
|
+
input.value = "";
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ React.createElement("input", { ref, disabled: disabled || inputDisabled, type: "file", multiple, onChange: onInputChange, ...rest });
|
|
93
|
+
});
|
|
94
|
+
var InputFileButton = (0, import_react.forwardRef)((props, ref) => {
|
|
95
|
+
const { onClick, input: inputProps, ...rest } = props;
|
|
96
|
+
const { style, ...restInputProps } = inputProps;
|
|
97
|
+
const input = (0, import_react.useRef)(null);
|
|
98
|
+
function onBtnClick(e) {
|
|
99
|
+
input.current?.click();
|
|
100
|
+
onClick?.(e);
|
|
101
|
+
}
|
|
102
|
+
return /* @__PURE__ */ React.createElement(import_react.Fragment, null, /* @__PURE__ */ React.createElement(InputFile, { ref: input, style: { display: "none", ...style }, ...restInputProps }), /* @__PURE__ */ React.createElement("button", { ref, type: "button", onClick: onBtnClick, ...rest }));
|
|
103
|
+
});
|
|
104
|
+
var ImportExcel = (0, import_react.forwardRef)((props, ref) => {
|
|
105
|
+
const { onChange, ...rest } = props;
|
|
106
|
+
function onInputChange(data) {
|
|
107
|
+
const wb = (0, import_xlsx.read)(data.result);
|
|
108
|
+
const result = import_xlsx.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
|
|
109
|
+
if (typeof result === "object") {
|
|
110
|
+
const $ = result.map((it) => {
|
|
111
|
+
const _ = {};
|
|
112
|
+
Object.keys(it).filter((key) => key !== "__rowNum__").forEach((key) => _[key] = String(it[key]));
|
|
113
|
+
return _;
|
|
114
|
+
});
|
|
115
|
+
onChange?.($);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ React.createElement(InputFile, { ref, accept: ".xlsx", type: "arrayBuffer", onChange: onInputChange, ...rest });
|
|
119
|
+
});
|
|
120
|
+
function exportExcel(data, name) {
|
|
121
|
+
const workSheet = import_xlsx.utils.json_to_sheet(data);
|
|
122
|
+
const workBook = import_xlsx.utils.book_new();
|
|
123
|
+
import_xlsx.utils.book_append_sheet(workBook, workSheet);
|
|
124
|
+
(0, import_xlsx.writeFile)(workBook, `${name}${name.endsWith(".xlsx") ? "" : ".xlsx"}`);
|
|
125
|
+
}
|
|
126
|
+
var ExportExcel = (0, import_react.forwardRef)((props, ref) => {
|
|
127
|
+
const { data, fileName, onClick, ...rest } = props;
|
|
128
|
+
function onButtonClick(e) {
|
|
129
|
+
exportExcel(data, fileName);
|
|
130
|
+
onClick?.(e);
|
|
131
|
+
}
|
|
132
|
+
return /* @__PURE__ */ React.createElement("button", { ref, onClick: onButtonClick, ...rest });
|
|
133
|
+
});
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
ExportExcel,
|
|
137
|
+
ImportExcel,
|
|
138
|
+
InputFile,
|
|
139
|
+
InputFileButton,
|
|
140
|
+
exportExcel,
|
|
141
|
+
getFileData
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=InputFile.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/InputFile.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { ButtonHTMLAttributes, ChangeEvent, Fragment, InputHTMLAttributes, MouseEvent as ReactMouseEvent, forwardRef, useRef, useState } from \"react\"\r\nimport { read, utils, writeFile } from \"xlsx\"\r\n\r\nexport interface InputFileDataTypes {\r\n base64: string\r\n text: string\r\n arrayBuffer: ArrayBuffer\r\n binary: string\r\n file: File\r\n}\r\n\r\nexport type InputFileDataType = keyof InputFileDataTypes\r\n\r\nexport interface InputFileData<T> {\r\n result: T\r\n file: File\r\n}\r\n\r\nexport type InputFileProps = (\r\n | {\r\n multiple?: false\r\n type: \"base64\" | \"text\" | \"binary\"\r\n onChange?: (data: InputFileData<string>) => void\r\n }\r\n | {\r\n multiple?: false\r\n type: \"arrayBuffer\"\r\n onChange?: (data: InputFileData<ArrayBuffer>) => void\r\n }\r\n | {\r\n multiple?: false\r\n type?: \"file\"\r\n onChange?: (data: InputFileData<File>) => void\r\n }\r\n | {\r\n multiple: true\r\n type: \"base64\" | \"text\" | \"binary\"\r\n onChange?: (data: InputFileData<string>[]) => void\r\n }\r\n | {\r\n multiple: true\r\n type: \"arrayBuffer\"\r\n onChange?: (data: InputFileData<ArrayBuffer>[]) => void\r\n }\r\n | {\r\n multiple: true\r\n type?: \"file\"\r\n onChange?: (data: InputFileData<File>[]) => void\r\n }\r\n) &\r\n Omit<InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"multiple\" | \"type\"> & {\r\n /** 是否在捕获文件后清除 input 上的文件,默认为 false,主要区别在于如果不清除,连续两次选择同样的文件不会触发 onChange 事件,如果用于 form 表单,请设置为 flase */\r\n clearAfterChange?: boolean\r\n }\r\n\r\nexport async function getFileData<T extends InputFileDataType>(file: File, type: T): Promise<InputFileDataTypes[T]> {\r\n const fileReader = new FileReader()\r\n switch (type) {\r\n case \"arrayBuffer\":\r\n fileReader.readAsArrayBuffer(file)\r\n break\r\n case \"binary\":\r\n fileReader.readAsBinaryString(file)\r\n break\r\n case \"base64\":\r\n fileReader.readAsDataURL(file)\r\n break\r\n case \"text\":\r\n fileReader.readAsText(file)\r\n break\r\n default:\r\n return file as any\r\n }\r\n return new Promise(resolve => {\r\n fileReader.addEventListener(\"load\", () => {\r\n resolve(fileReader.result as any)\r\n })\r\n })\r\n}\r\n\r\n/** 专用于读取文件的组件 */\r\nexport const InputFile = forwardRef<HTMLInputElement, InputFileProps>((props, ref) => {\r\n const { multiple = false, type = \"file\", onChange, disabled: inputDisabled, clearAfterChange, ...rest } = props\r\n const [disabled, setDisabled] = useState(false)\r\n\r\n async function onInputChange(e: ChangeEvent<HTMLInputElement>) {\r\n const input = e.target\r\n const { files } = input\r\n if (!files || files.length === 0) return\r\n setDisabled(true)\r\n try {\r\n if (multiple) {\r\n const result: any[] = []\r\n for (const file of Array.from(files)) {\r\n result.push({\r\n result: await getFileData(file, type),\r\n file\r\n })\r\n }\r\n onChange?.(result as any)\r\n } else {\r\n onChange?.({\r\n result: await getFileData(files[0], type),\r\n file: files[0]\r\n } as any)\r\n }\r\n setDisabled(false)\r\n if (clearAfterChange) input.value = \"\"\r\n } catch (error) {\r\n setDisabled(false)\r\n if (clearAfterChange) input.value = \"\"\r\n throw error\r\n }\r\n }\r\n\r\n return <input ref={ref} disabled={disabled || inputDisabled} type=\"file\" multiple={multiple} onChange={onInputChange} {...rest} />\r\n})\r\n\r\nexport type InputFileButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {\r\n input: InputFileProps\r\n}\r\n\r\n/** 专用于读取文件的 button 组件 */\r\nexport const InputFileButton = forwardRef<HTMLButtonElement, InputFileButtonProps>((props, ref) => {\r\n const { onClick, input: inputProps, ...rest } = props\r\n const { style, ...restInputProps } = inputProps\r\n const input = useRef<HTMLInputElement>(null)\r\n\r\n function onBtnClick(e: ReactMouseEvent<HTMLButtonElement, MouseEvent>) {\r\n input.current?.click()\r\n onClick?.(e)\r\n }\r\n\r\n return (\r\n <Fragment>\r\n <InputFile ref={input} style={{ display: \"none\", ...style }} {...restInputProps} />\r\n <button ref={ref} type=\"button\" onClick={onBtnClick} {...rest} />\r\n </Fragment>\r\n )\r\n})\r\n\r\nexport interface ImportExcelProps extends Omit<InputFileProps, \"multiple\" | \"onChange\" | \"accept\" | \"type\"> {\r\n onChange?: (data: Record<string, string>[]) => void\r\n}\r\n\r\n/** 专门用于读取 excel 的组件 */\r\nexport const ImportExcel = forwardRef<HTMLInputElement, ImportExcelProps>((props, ref) => {\r\n const { onChange, ...rest } = props\r\n\r\n function onInputChange(data: InputFileData<ArrayBuffer>) {\r\n const wb = read(data.result)\r\n const result = utils.sheet_to_json<any>(wb.Sheets[wb.SheetNames[0]])\r\n if (typeof result === \"object\") {\r\n const $ = result.map(it => {\r\n const _: Record<string, string> = {}\r\n Object.keys(it)\r\n .filter(key => key !== \"__rowNum__\")\r\n .forEach(key => (_[key] = String(it[key])))\r\n return _\r\n })\r\n onChange?.($)\r\n }\r\n }\r\n\r\n return <InputFile ref={ref} accept=\".xlsx\" type=\"arrayBuffer\" onChange={onInputChange} {...rest} />\r\n})\r\n\r\n/** 手动导出 excel */\r\nexport function exportExcel(data: Record<string, string>[], name: string) {\r\n const workSheet = utils.json_to_sheet(data)\r\n const workBook = utils.book_new()\r\n utils.book_append_sheet(workBook, workSheet)\r\n writeFile(workBook, `${name}${name.endsWith(\".xlsx\") ? \"\" : \".xlsx\"}`)\r\n}\r\n\r\nexport interface ExportExcelProps extends ButtonHTMLAttributes<HTMLButtonElement> {\r\n data: Record<string, string>[]\r\n fileName: string\r\n}\r\n\r\n/** 导出 excel 的 button 组件 */\r\nexport const ExportExcel = forwardRef<HTMLButtonElement, ExportExcelProps>((props, ref) => {\r\n const { data, fileName, onClick, ...rest } = props\r\n\r\n function onButtonClick(e: ReactMouseEvent<HTMLButtonElement, MouseEvent>) {\r\n exportExcel(data, fileName)\r\n onClick?.(e)\r\n }\r\n\r\n return <button ref={ref} onClick={onButtonClick} {...rest} />\r\n})\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA8I;AAC9I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G,CAAC;AAGM,SAAS,YAAY,MAAgC,MAAc;AACtE,QAAM,YAAY,kBAAM,cAAc,IAAI;AAC1C,QAAM,WAAW,kBAAM,SAAS;AAChC,oBAAM,kBAAkB,UAAU,SAAS;AAC3C,6BAAU,UAAU,GAAG,OAAO,KAAK,SAAS,OAAO,IAAI,KAAK,SAAS;AACzE;AAQO,IAAM,kBAAc,yBAAgD,CAAC,OAAO,QAAQ;AACvF,QAAM,EAAE,MAAM,UAAU,SAAS,GAAG,KAAK,IAAI;AAE7C,WAAS,cAAc,GAAmD;AACtE,gBAAY,MAAM,QAAQ;AAC1B,cAAU,CAAC;AAAA,EACf;AAEA,SAAO,oCAAC,YAAO,KAAU,SAAS,eAAgB,GAAG,MAAM;AAC/D,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/LoopSwiper.tsx
|
|
21
|
+
var LoopSwiper_exports = {};
|
|
22
|
+
__export(LoopSwiper_exports, {
|
|
23
|
+
LoopSwiper: () => LoopSwiper
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(LoopSwiper_exports);
|
|
26
|
+
var import_css = require("@emotion/css");
|
|
27
|
+
var import_deepsea_tools = require("deepsea-tools");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var LoopSwiper = (0, import_react.forwardRef)((props, ref) => {
|
|
30
|
+
const { className, style, children, direction, period, reverse, gap, ...rest } = props;
|
|
31
|
+
const wrapper = (0, import_react.useRef)(null);
|
|
32
|
+
const container = (0, import_react.useRef)(null);
|
|
33
|
+
const [swiper, setSwiper] = (0, import_react.useState)(false);
|
|
34
|
+
const directionRef = (0, import_react.useRef)(direction);
|
|
35
|
+
directionRef.current = direction;
|
|
36
|
+
const flexDirection = direction === "vertical" ? reverse ? "column-reverse" : "column" : reverse ? "row-reverse" : "row";
|
|
37
|
+
const animationName = swiper ? direction === "vertical" ? reverse ? "deepsea-reverse-vertical-loop-swipe" : "deepsea-vertical-loop-swipe" : reverse ? "deepsea-reverse-horizontal-loop-swipe" : "deepsea-horizontal-loop-swipe" : "none";
|
|
38
|
+
const animationDuration = `${period}ms`;
|
|
39
|
+
const animationTimingFunction = "linear";
|
|
40
|
+
const animationIterationCount = "infinite";
|
|
41
|
+
(0, import_react.useImperativeHandle)(ref, () => wrapper.current, []);
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
|
+
const wrapperEle = wrapper.current;
|
|
44
|
+
const containerEle = container.current;
|
|
45
|
+
let wrapperWidth = 0;
|
|
46
|
+
let wrapperHeight = 0;
|
|
47
|
+
let containerWidth = 0;
|
|
48
|
+
let containerHeight = 0;
|
|
49
|
+
const observer = new ResizeObserver((entries) => {
|
|
50
|
+
entries.forEach((entry) => {
|
|
51
|
+
if (entry.target === wrapperEle) {
|
|
52
|
+
wrapperWidth = entry.contentRect.width;
|
|
53
|
+
wrapperHeight = entry.contentRect.height;
|
|
54
|
+
} else if (entry.target === containerEle) {
|
|
55
|
+
containerWidth = entry.contentRect.width;
|
|
56
|
+
containerHeight = entry.contentRect.height;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
setSwiper(directionRef.current === "vertical" ? containerHeight > wrapperHeight : containerWidth > wrapperWidth);
|
|
60
|
+
});
|
|
61
|
+
observer.observe(wrapperEle);
|
|
62
|
+
observer.observe(containerEle);
|
|
63
|
+
}, []);
|
|
64
|
+
return /* @__PURE__ */ React.createElement(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
ref: wrapper,
|
|
68
|
+
className: (0, import_deepsea_tools.clsx)(
|
|
69
|
+
import_css.css`
|
|
70
|
+
@keyframes deepsea-horizontal-loop-swipe {
|
|
71
|
+
from {
|
|
72
|
+
transform: translateX(0);
|
|
73
|
+
}
|
|
74
|
+
to {
|
|
75
|
+
transform: translateX(-100%);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
@keyframes deepsea-reverse-horizontal-loop-swipe {
|
|
79
|
+
from {
|
|
80
|
+
transform: translateX(0);
|
|
81
|
+
}
|
|
82
|
+
to {
|
|
83
|
+
transform: translateX(100%);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
@keyframes deepsea-vertical-loop-swipe {
|
|
87
|
+
from {
|
|
88
|
+
transform: translateY(0);
|
|
89
|
+
}
|
|
90
|
+
to {
|
|
91
|
+
transform: translateY(-100%);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
@keyframes deepsea-reverse-vertical-loop-swipe {
|
|
95
|
+
from {
|
|
96
|
+
transform: translateY(0);
|
|
97
|
+
}
|
|
98
|
+
to {
|
|
99
|
+
transform: translateY(100%);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`,
|
|
103
|
+
className
|
|
104
|
+
),
|
|
105
|
+
style: { display: "flex", flexDirection, gap, ...style },
|
|
106
|
+
...rest
|
|
107
|
+
},
|
|
108
|
+
/* @__PURE__ */ React.createElement("div", { ref: container, style: { display: "flex", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount } }, children),
|
|
109
|
+
/* @__PURE__ */ React.createElement("div", { style: { display: swiper ? "flex" : "none", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount } }, children)
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
LoopSwiper
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=LoopSwiper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/LoopSwiper.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { css } from \"@emotion/css\"\r\nimport { clsx } from \"deepsea-tools\"\r\nimport { CSSProperties, forwardRef, HTMLAttributes, useEffect, useImperativeHandle, useRef, useState } from \"react\"\r\n\r\nexport interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {\r\n direction?: \"horizontal\" | \"vertical\"\r\n reverse?: boolean\r\n period: number\r\n gap?: CSSProperties[\"gap\"]\r\n}\r\n\r\n/** 循环播放组件 */\r\nexport const LoopSwiper = forwardRef<HTMLDivElement, LoopSwiperProps>((props, ref) => {\r\n const { className, style, children, direction, period, reverse, gap, ...rest } = props\r\n const wrapper = useRef<HTMLDivElement>(null)\r\n const container = useRef<HTMLDivElement>(null)\r\n const [swiper, setSwiper] = useState(false)\r\n const directionRef = useRef(direction)\r\n directionRef.current = direction\r\n const flexDirection: CSSProperties[\"flexDirection\"] = direction === \"vertical\" ? (reverse ? \"column-reverse\" : \"column\") : reverse ? \"row-reverse\" : \"row\"\r\n const animationName = swiper ? (direction === \"vertical\" ? (reverse ? \"deepsea-reverse-vertical-loop-swipe\" : \"deepsea-vertical-loop-swipe\") : reverse ? \"deepsea-reverse-horizontal-loop-swipe\" : \"deepsea-horizontal-loop-swipe\") : \"none\"\r\n const animationDuration = `${period}ms`\r\n const animationTimingFunction = \"linear\"\r\n const animationIterationCount = \"infinite\"\r\n\r\n useImperativeHandle(ref, () => wrapper.current!, [])\r\n\r\n useEffect(() => {\r\n const wrapperEle = wrapper.current!\r\n const containerEle = container.current!\r\n let wrapperWidth = 0\r\n let wrapperHeight = 0\r\n let containerWidth = 0\r\n let containerHeight = 0\r\n const observer = new ResizeObserver(entries => {\r\n entries.forEach(entry => {\r\n if (entry.target === wrapperEle) {\r\n wrapperWidth = entry.contentRect.width\r\n wrapperHeight = entry.contentRect.height\r\n } else if (entry.target === containerEle) {\r\n containerWidth = entry.contentRect.width\r\n containerHeight = entry.contentRect.height\r\n }\r\n })\r\n setSwiper(directionRef.current === \"vertical\" ? containerHeight > wrapperHeight : containerWidth > wrapperWidth)\r\n })\r\n observer.observe(wrapperEle)\r\n observer.observe(containerEle)\r\n }, [])\r\n\r\n return (\r\n <div\r\n ref={wrapper}\r\n className={clsx(\r\n css`\r\n @keyframes deepsea-horizontal-loop-swipe {\r\n from {\r\n transform: translateX(0);\r\n }\r\n to {\r\n transform: translateX(-100%);\r\n }\r\n }\r\n @keyframes deepsea-reverse-horizontal-loop-swipe {\r\n from {\r\n transform: translateX(0);\r\n }\r\n to {\r\n transform: translateX(100%);\r\n }\r\n }\r\n @keyframes deepsea-vertical-loop-swipe {\r\n from {\r\n transform: translateY(0);\r\n }\r\n to {\r\n transform: translateY(-100%);\r\n }\r\n }\r\n @keyframes deepsea-reverse-vertical-loop-swipe {\r\n from {\r\n transform: translateY(0);\r\n }\r\n to {\r\n transform: translateY(100%);\r\n }\r\n }\r\n `,\r\n className\r\n )}\r\n style={{ display: \"flex\", flexDirection, gap, ...style }}\r\n {...rest}>\r\n <div ref={container} style={{ display: \"flex\", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount }}>\r\n {children}\r\n </div>\r\n <div style={{ display: swiper ? \"flex\" : \"none\", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount }}>{children}</div>\r\n </div>\r\n )\r\n})\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAoB;AACpB,2BAAqB;AACrB,mBAA4G;AAUrG,IAAM,iBAAa,yBAA4C,CAAC,OAAO,QAAQ;AAClF,QAAM,EAAE,WAAW,OAAO,UAAU,WAAW,QAAQ,SAAS,KAAK,GAAG,KAAK,IAAI;AACjF,QAAM,cAAU,qBAAuB,IAAI;AAC3C,QAAM,gBAAY,qBAAuB,IAAI;AAC7C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,QAAM,mBAAe,qBAAO,SAAS;AACrC,eAAa,UAAU;AACvB,QAAM,gBAAgD,cAAc,aAAc,UAAU,mBAAmB,WAAY,UAAU,gBAAgB;AACrJ,QAAM,gBAAgB,SAAU,cAAc,aAAc,UAAU,wCAAwC,gCAAiC,UAAU,0CAA0C,kCAAmC;AACtO,QAAM,oBAAoB,GAAG;AAC7B,QAAM,0BAA0B;AAChC,QAAM,0BAA0B;AAEhC,wCAAoB,KAAK,MAAM,QAAQ,SAAU,CAAC,CAAC;AAEnD,8BAAU,MAAM;AACZ,UAAM,aAAa,QAAQ;AAC3B,UAAM,eAAe,UAAU;AAC/B,QAAI,eAAe;AACnB,QAAI,gBAAgB;AACpB,QAAI,iBAAiB;AACrB,QAAI,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number;
|
|
4
|
+
innerWidth: number;
|
|
5
|
+
}
|
|
6
|
+
/** 环形组件 */
|
|
7
|
+
export declare const Ring: import("react").ForwardRefExoticComponent<RingProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Ring.tsx
|
|
21
|
+
var Ring_exports = {};
|
|
22
|
+
__export(Ring_exports, {
|
|
23
|
+
Ring: () => Ring
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Ring_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var Ring = (0, import_react.forwardRef)((props, ref) => {
|
|
28
|
+
const { outerWidth, innerWidth, style, ...rest } = props;
|
|
29
|
+
const outerRadius = outerWidth / 2;
|
|
30
|
+
const innerRadius = innerWidth / 2;
|
|
31
|
+
return /* @__PURE__ */ React.createElement("div", { ref, style: { ...style, width: `${outerWidth}px`, height: `${outerWidth}px`, clipPath: `path("M0,${outerRadius} a${outerRadius},${outerRadius},0,1,0,${outerWidth},0 a${outerRadius},${outerRadius},0,1,0,-${outerWidth},0 l${outerRadius - innerRadius},0 a${innerRadius},${innerRadius},0,0,1,${innerRadius * 2},0 a${innerRadius},${innerRadius},0,0,1,-${innerRadius * 2},0 Z")` }, ...rest });
|
|
32
|
+
});
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
Ring
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=Ring.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Ring.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { forwardRef, HTMLAttributes } from \"react\"\r\n\r\nexport interface RingProps extends HTMLAttributes<HTMLDivElement> {\r\n outerWidth: number\r\n innerWidth: number\r\n}\r\n\r\n/** 环形组件 */\r\nexport const Ring = forwardRef<HTMLDivElement, RingProps>((props, ref) => {\r\n const { outerWidth, innerWidth, style, ...rest } = props\r\n\r\n const outerRadius = outerWidth / 2\r\n\r\n const innerRadius = innerWidth / 2\r\n\r\n return <div ref={ref} style={{ ...style, width: `${outerWidth}px`, height: `${outerWidth}px`, clipPath: `path(\"M0,${outerRadius} a${outerRadius},${outerRadius},0,1,0,${outerWidth},0 a${outerRadius},${outerRadius},0,1,0,-${outerWidth},0 l${outerRadius - innerRadius},0 a${innerRadius},${innerRadius},0,0,1,${innerRadius * 2},0 a${innerRadius},${innerRadius},0,0,1,-${innerRadius * 2},0 Z\")` }} {...rest} />\r\n})\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2C;AAQpC,IAAM,WAAO,yBAAsC,CAAC,OAAO,QAAQ;AACtE,QAAM,EAAE,YAAY,YAAY,OAAO,GAAG,KAAK,IAAI;AAEnD,QAAM,cAAc,aAAa;AAEjC,QAAM,cAAc,aAAa;AAEjC,SAAO,oCAAC,SAAI,KAAU,OAAO,EAAE,GAAG,OAAO,OAAO,GAAG,gBAAgB,QAAQ,GAAG,gBAAgB,UAAU,YAAY,gBAAgB,eAAe,qBAAqB,iBAAiB,eAAe,sBAAsB,iBAAiB,cAAc,kBAAkB,eAAe,qBAAqB,cAAc,QAAQ,eAAe,sBAAsB,cAAc,UAAU,GAAI,GAAG,MAAM;AACvZ,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Scroll.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\r\nimport { css } from \"@emotion/css\"\r\nimport { clsx } from \"deepsea-tools\"\r\nimport { CSSProperties, ForwardedRef, forwardRef, HTMLAttributes, useEffect, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\r\nimport Scrollbar from \"smooth-scrollbar\"\r\nimport type { ScrollbarOptions, ScrollListener } from \"smooth-scrollbar/interfaces\"\r\nexport { default as Scrollbar } from \"smooth-scrollbar\"\r\nexport * from \"smooth-scrollbar/interfaces\"\r\n\r\nexport interface ScrollOptions extends Partial<ScrollbarOptions> {\r\n /** 滑块宽度 */\r\n thumbWidth?: number | string\r\n /** 滑块圆角大小 */\r\n thumbRadius?: number | string\r\n /** 滑块背景颜色 */\r\n thumbColor?: string\r\n /** 滚动条背景颜色 */\r\n trackColor?: string\r\n}\r\n\r\nexport interface ScrollProps extends HTMLAttributes<HTMLDivElement> {\r\n /** 滚动的配置 */\r\n options?: ScrollOptions\r\n /** 滚动条实例 */\r\n scrollbar?: ForwardedRef<Scrollbar>\r\n /** 滚动条滚动事件 */\r\n onScrollbar?: ScrollListener\r\n}\r\n\r\nexport const Scroll = forwardRef<HTMLDivElement, ScrollProps>((props, ref) => {\r\n const { children, options, className, style, scrollbar, onScrollbar, ...rest } = props\r\n const { thumbWidth, thumbRadius, thumbColor, trackColor, ...scrollbarOptions } = options || {}\r\n const ele = useRef<HTMLDivElement>(null)\r\n const bar = useRef<Scrollbar | null>(null)\r\n\r\n useLayoutEffect(() => {\r\n bar.current = Scrollbar.init(ele.current!, scrollbarOptions)\r\n return () => bar.current?.destroy()\r\n }, [])\r\n\r\n useImperativeHandle(ref, () => ele.current!, [])\r\n\r\n useImperativeHandle(scrollbar, () => bar.current!, [])\r\n\r\n useEffect(() => {\r\n if (!onScrollbar) return\r\n bar.current?.addListener(onScrollbar)\r\n return () => bar.current?.removeListener(onScrollbar)\r\n }, [onScrollbar])\r\n\r\n return (\r\n <div\r\n ref={ele}\r\n className={clsx(\r\n css`\r\n .scrollbar-track.scrollbar-track-x {\r\n ${thumbWidth !== undefined ? \"height: var(--thumb-width);\" : \"\"}\r\n ${trackColor !== undefined ? \"background-color: var(--track-color);\" : \"\"}\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-x {\r\n ${thumbWidth !== undefined ? \"height: var(--thumb-width);\" : \"\"}\r\n ${thumbRadius !== undefined ? \"border-radius: var(--thumb-radius);\" : \"\"}\r\n ${thumbColor !== undefined ? \"background-color: var(--thumb-color);\" : \"\"}\r\n }\r\n\r\n .scrollbar-track.scrollbar-track-y {\r\n ${thumbWidth !== undefined ? \"width: var(--thumb-width);\" : \"\"}\r\n ${trackColor !== undefined ? \"background-color: var(--track-color);\" : \"\"}\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-y {\r\n ${thumbWidth !== undefined ? \"width: var(--thumb-width);\" : \"\"}\r\n ${thumbRadius !== undefined ? \"border-radius: var(--thumb-radius);\" : \"\"}\r\n ${thumbColor !== undefined ? \"background-color: var(--thumb-color);\" : \"\"}\r\n }\r\n `,\r\n className\r\n )}\r\n style={\r\n {\r\n \"--thumb-width\": typeof thumbWidth === \"number\" ? `${thumbWidth}px` : thumbWidth,\r\n \"--thumb-radius\": typeof thumbRadius === \"number\" ? `${thumbRadius}px` : thumbRadius,\r\n \"--thumb-color\": thumbColor,\r\n \"--track-color\": trackColor,\r\n ...style\r\n } as CSSProperties\r\n }\r\n {...rest}>\r\n {children}\r\n </div>\r\n )\r\n})\r\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { css } from \"@emotion/css\"\r\nimport { clsx } from \"deepsea-tools\"\r\nimport { CSSProperties, ForwardedRef, forwardRef, HTMLAttributes, useEffect, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\r\nimport Scrollbar from \"smooth-scrollbar\"\r\nimport type { ScrollbarOptions, ScrollListener } from \"smooth-scrollbar/interfaces\"\r\nexport { default as Scrollbar } from \"smooth-scrollbar\"\r\nexport * from \"smooth-scrollbar/interfaces\"\r\n\r\nexport interface ScrollOptions extends Partial<ScrollbarOptions> {\r\n /** 滑块宽度 */\r\n thumbWidth?: number | string\r\n /** 滑块圆角大小 */\r\n thumbRadius?: number | string\r\n /** 滑块背景颜色 */\r\n thumbColor?: string\r\n /** 滚动条背景颜色 */\r\n trackColor?: string\r\n}\r\n\r\nexport interface ScrollProps extends HTMLAttributes<HTMLDivElement> {\r\n /** 滚动的配置 */\r\n options?: ScrollOptions\r\n /** 滚动条实例 */\r\n scrollbar?: ForwardedRef<Scrollbar>\r\n /** 滚动条滚动事件 */\r\n onScrollbar?: ScrollListener\r\n}\r\n\r\nexport const Scroll = forwardRef<HTMLDivElement, ScrollProps>((props, ref) => {\r\n const { children, options, className, style, scrollbar, onScrollbar, ...rest } = props\r\n const { thumbWidth, thumbRadius, thumbColor, trackColor, ...scrollbarOptions } = options || {}\r\n const ele = useRef<HTMLDivElement>(null)\r\n const bar = useRef<Scrollbar | null>(null)\r\n\r\n useLayoutEffect(() => {\r\n bar.current = Scrollbar.init(ele.current!, scrollbarOptions)\r\n return () => bar.current?.destroy()\r\n }, [])\r\n\r\n useImperativeHandle(ref, () => ele.current!, [])\r\n\r\n useImperativeHandle(scrollbar, () => bar.current!, [])\r\n\r\n useEffect(() => {\r\n if (!onScrollbar) return\r\n bar.current?.addListener(onScrollbar)\r\n return () => bar.current?.removeListener(onScrollbar)\r\n }, [onScrollbar])\r\n\r\n return (\r\n <div\r\n ref={ele}\r\n className={clsx(\r\n css`\r\n .scrollbar-track.scrollbar-track-x {\r\n ${thumbWidth !== undefined ? \"height: var(--thumb-width);\" : \"\"}\r\n ${trackColor !== undefined ? \"background-color: var(--track-color);\" : \"\"}\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-x {\r\n ${thumbWidth !== undefined ? \"height: var(--thumb-width);\" : \"\"}\r\n ${thumbRadius !== undefined ? \"border-radius: var(--thumb-radius);\" : \"\"}\r\n ${thumbColor !== undefined ? \"background-color: var(--thumb-color);\" : \"\"}\r\n }\r\n\r\n .scrollbar-track.scrollbar-track-y {\r\n ${thumbWidth !== undefined ? \"width: var(--thumb-width);\" : \"\"}\r\n ${trackColor !== undefined ? \"background-color: var(--track-color);\" : \"\"}\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-y {\r\n ${thumbWidth !== undefined ? \"width: var(--thumb-width);\" : \"\"}\r\n ${thumbRadius !== undefined ? \"border-radius: var(--thumb-radius);\" : \"\"}\r\n ${thumbColor !== undefined ? \"background-color: var(--thumb-color);\" : \"\"}\r\n }\r\n `,\r\n className\r\n )}\r\n style={\r\n {\r\n \"--thumb-width\": typeof thumbWidth === \"number\" ? `${thumbWidth}px` : thumbWidth,\r\n \"--thumb-radius\": typeof thumbRadius === \"number\" ? `${thumbRadius}px` : thumbRadius,\r\n \"--thumb-color\": thumbColor,\r\n \"--track-color\": trackColor,\r\n ...style\r\n } as CSSProperties\r\n }\r\n {...rest}>\r\n {children}\r\n </div>\r\n )\r\n})\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAA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wC;AAAA,0BACpE,eAAe,SAAY,0CAA0C;AAAA;AAAA;AAAA,QAG/E;AAAA,MACJ;AAAA,MACA,OACI;AAAA,QACI,iBAAiB,OAAO,eAAe,WAAW,GAAG,iBAAiB;AAAA,QACtE,kBAAkB,OAAO,gBAAgB,WAAW,GAAG,kBAAkB;AAAA,QACzE,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,GAAG;AAAA,MACP;AAAA,MAEH,GAAG;AAAA;AAAA,IACH;AAAA,EACL;AAER,CAAC;",
|
|
6
6
|
"names": ["import_smooth_scrollbar", "Scrollbar"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/SectionRing.tsx
|
|
21
|
+
var SectionRing_exports = {};
|
|
22
|
+
__export(SectionRing_exports, {
|
|
23
|
+
SectionRing: () => SectionRing
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(SectionRing_exports);
|
|
26
|
+
var import_deepsea_tools = require("deepsea-tools");
|
|
27
|
+
var SectionRing = (props) => {
|
|
28
|
+
const { outerRadius: o, innerRadius: i, count: c, angel: a, style, ...rest } = props;
|
|
29
|
+
const s = Math.PI * 2 / c - a;
|
|
30
|
+
function arc(radius, startAngle, endAngle, options = {}) {
|
|
31
|
+
return (0, import_deepsea_tools.drawArc)(o, o, radius, startAngle, endAngle, options);
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ React.createElement(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
style: {
|
|
37
|
+
...style,
|
|
38
|
+
width: o * 2,
|
|
39
|
+
height: o * 2,
|
|
40
|
+
clipPath: `path("${Array(c).fill(0).map((it, idx) => `${arc(o, idx * (a + s), idx * (a + s) + a)} ${arc(i, idx * (a + s) + a, idx * (a + s), { line: true, anticlockwise: true })}`).join(" ")} Z")`
|
|
41
|
+
},
|
|
42
|
+
...rest
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
SectionRing
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=SectionRing.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/SectionRing.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { DrawArcOptions, drawArc } from \"deepsea-tools\"\r\nimport { FC, HTMLAttributes } from \"react\"\r\n\r\nexport interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {\r\n outerRadius: number\r\n innerRadius: number\r\n count: number\r\n angel: number\r\n}\r\n\r\nexport const SectionRing: FC<SectionRingProps> = props => {\r\n const { outerRadius: o, innerRadius: i, count: c, angel: a, style, ...rest } = props\r\n\r\n const s = (Math.PI * 2) / c - a\r\n\r\n function arc(radius: number, startAngle: number, endAngle: number, options: DrawArcOptions = {}) {\r\n return drawArc(o, o, radius, startAngle, endAngle, options)\r\n }\r\n\r\n return (\r\n <div\r\n style={{\r\n ...style,\r\n width: o * 2,\r\n height: o * 2,\r\n clipPath: `path(\"${Array(c)\r\n .fill(0)\r\n .map((it, idx) => `${arc(o, idx * (a + s), idx * (a + s) + a)} ${arc(i, idx * (a + s) + a, idx * (a + s), { line: true, anticlockwise: true })}`)\r\n .join(\" \")} Z\")`\r\n }}\r\n {...rest}\r\n />\r\n )\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAAwC;AAUjC,IAAM,cAAoC,WAAS;AACtD,QAAM,EAAE,aAAa,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,IAAI;AAE/E,QAAM,IAAK,KAAK,KAAK,IAAK,IAAI;AAE9B,WAAS,IAAI,QAAgB,YAAoB,UAAkB,UAA0B,CAAC,GAAG;AAC7F,eAAO,8BAAQ,GAAG,GAAG,QAAQ,YAAY,UAAU,OAAO;AAAA,EAC9D;AAEA,SACI;AAAA,IAAC;AAAA;AAAA,MACG,OAAO;AAAA,QACH,GAAG;AAAA,QACH,OAAO,IAAI;AAAA,QACX,QAAQ,IAAI;AAAA,QACZ,UAAU,SAAS,MAAM,CAAC,EACrB,KAAK,CAAC,EACN,IAAI,CAAC,IAAI,QAAQ,GAAG,IAAI,GAAG,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC,KAAK,IAAI,GAAG,OAAO,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,MAAM,MAAM,eAAe,KAAK,CAAC,GAAG,EAC/I,KAAK,GAAG;AAAA,MACjB;AAAA,MACC,GAAG;AAAA;AAAA,EACR;AAER;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Skeleton.tsx
|
|
21
|
+
var Skeleton_exports = {};
|
|
22
|
+
__export(Skeleton_exports, {
|
|
23
|
+
default: () => Skeleton_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Skeleton_exports);
|
|
26
|
+
var import_css = require("@emotion/css");
|
|
27
|
+
var import_deepsea_tools = require("deepsea-tools");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var Skeleton = (0, import_react.forwardRef)((props) => {
|
|
30
|
+
const { className, ...rest } = props;
|
|
31
|
+
return /* @__PURE__ */ React.createElement(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: (0, import_deepsea_tools.clsx)(
|
|
35
|
+
import_css.css`
|
|
36
|
+
@keyframes shimmer {
|
|
37
|
+
0% {
|
|
38
|
+
background-position: -400px 0px;
|
|
39
|
+
}
|
|
40
|
+
100% {
|
|
41
|
+
background-position: 400px 0px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
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%);
|
|
46
|
+
animation-duration: 1s;
|
|
47
|
+
animation-fill-mode: forwards;
|
|
48
|
+
animation-iteration-count: infinite;
|
|
49
|
+
animation-name: shimmer;
|
|
50
|
+
animation-timing-function: linear;
|
|
51
|
+
background-size: 800px 104px;
|
|
52
|
+
`,
|
|
53
|
+
className
|
|
54
|
+
),
|
|
55
|
+
...rest
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
var Skeleton_default = Skeleton;
|
|
60
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Skeleton.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { css } from \"@emotion/css\"\r\nimport { clsx } from \"deepsea-tools\"\r\nimport { forwardRef, HTMLAttributes } from \"react\"\r\n\r\nconst Skeleton = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(props => {\r\n const { className, ...rest } = props\r\n\r\n return (\r\n <div\r\n className={clsx(\r\n css`\r\n @keyframes shimmer {\r\n 0% {\r\n background-position: -400px 0px;\r\n }\r\n 100% {\r\n background-position: 400px 0px;\r\n }\r\n }\r\n\r\n 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%);\r\n animation-duration: 1s;\r\n animation-fill-mode: forwards;\r\n animation-iteration-count: infinite;\r\n animation-name: shimmer;\r\n animation-timing-function: linear;\r\n background-size: 800px 104px;\r\n `,\r\n className\r\n )}\r\n {...rest}\r\n />\r\n )\r\n})\r\n\r\nexport default Skeleton\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAoB;AACpB,2BAAqB;AACrB,mBAA2C;AAE3C,IAAM,eAAW,yBAA2D,WAAS;AACjF,QAAM,EAAE,WAAW,GAAG,KAAK,IAAI;AAE/B,SACI;AAAA,IAAC;AAAA;AAAA,MACG,eAAW;AAAA,QACP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAkBA;AAAA,MACJ;AAAA,MACC,GAAG;AAAA;AAAA,EACR;AAER,CAAC;AAED,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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>;
|