deepsea-components 2.3.2 → 2.4.1
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/index.d.ts +6 -27
- package/dist/cjs/index.js +75 -71
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.d.ts +6 -27
- package/dist/esm/index.js +107 -109
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.tsx +77 -96
package/dist/cjs/index.d.ts
CHANGED
|
@@ -180,35 +180,14 @@ export interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
180
180
|
}
|
|
181
181
|
/** 梯形组件 */
|
|
182
182
|
export declare const Trapezium: import("react").ForwardRefExoticComponent<TrapeziumProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
183
|
-
export interface LoopSwiperProps<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
/** 每个元素的key */
|
|
189
|
-
keyExactor?: (item: T, index: number, array: T[]) => string;
|
|
190
|
-
/** 水平方向是宽度,垂直方向是高度 */
|
|
191
|
-
size: number;
|
|
192
|
-
/** 元素之间间隔 */
|
|
193
|
-
gap?: number;
|
|
194
|
-
/** 起始位置 */
|
|
195
|
-
start?: number;
|
|
196
|
-
/** 速度,水平方向正数为向左,水平方向负数为向右,垂直方向正数为向上,水平方向负数为向下 */
|
|
197
|
-
speed: number;
|
|
198
|
-
/** 是否暂停播放 */
|
|
199
|
-
paused?: boolean;
|
|
200
|
-
/** 容器的类名 */
|
|
201
|
-
className?: string;
|
|
202
|
-
/** x 水平方向,y 垂直方向 */
|
|
203
|
-
direction?: "x" | "y";
|
|
204
|
-
}
|
|
205
|
-
export interface LoopSwiperItem {
|
|
206
|
-
key: string;
|
|
207
|
-
dom: HTMLDivElement | null;
|
|
208
|
-
offset: number;
|
|
183
|
+
export interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {
|
|
184
|
+
direction?: "horizontal" | "vertical";
|
|
185
|
+
reverse?: boolean;
|
|
186
|
+
period: number;
|
|
187
|
+
gap?: CSSProperties["gap"];
|
|
209
188
|
}
|
|
210
189
|
/** 循环播放组件 */
|
|
211
|
-
export declare
|
|
190
|
+
export declare const LoopSwiper: import("react").ForwardRefExoticComponent<LoopSwiperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
212
191
|
export interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {
|
|
213
192
|
outerRadius: number;
|
|
214
193
|
innerRadius: number;
|
package/dist/cjs/index.js
CHANGED
|
@@ -96,9 +96,9 @@ var InputFile = (0, import_react.forwardRef)((props, ref) => {
|
|
|
96
96
|
file
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
onChange
|
|
99
|
+
onChange?.(result);
|
|
100
100
|
} else {
|
|
101
|
-
onChange
|
|
101
|
+
onChange?.({
|
|
102
102
|
result: await getFileData(files[0], type),
|
|
103
103
|
file: files[0]
|
|
104
104
|
});
|
|
@@ -126,7 +126,7 @@ var ImportExcel = (0, import_react.forwardRef)((props, ref) => {
|
|
|
126
126
|
Object.keys(it).filter((key) => key !== "__rowNum__").forEach((key) => _[key] = String(it[key]));
|
|
127
127
|
return _;
|
|
128
128
|
});
|
|
129
|
-
onChange
|
|
129
|
+
onChange?.($);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
return /* @__PURE__ */ React.createElement(InputFile, { ref, accept: ".xlsx", type: "arrayBuffer", onChange: onInputChange, ...others });
|
|
@@ -141,7 +141,7 @@ var ExportExcel = (0, import_react.forwardRef)((props, ref) => {
|
|
|
141
141
|
const { data, fileName, onClick, ...others } = props;
|
|
142
142
|
function onButtonClick(e) {
|
|
143
143
|
exportExcel(data, fileName);
|
|
144
|
-
onClick
|
|
144
|
+
onClick?.(e);
|
|
145
145
|
}
|
|
146
146
|
return /* @__PURE__ */ React.createElement("button", { ref, onClick: onButtonClick, ...others });
|
|
147
147
|
});
|
|
@@ -171,7 +171,7 @@ var TransitionBox = (props) => {
|
|
|
171
171
|
var SeaRadar = (props) => {
|
|
172
172
|
const { unitRadius = 50, circleCount = 4, circleWidth = 1, circleColor, directionCount = 36, directionWidth = 1, directionColor, backgroundColor, scanColor, scanAngle = Math.PI / 6, period = 8, targets, showGraduationLine, showGraduationText, showCircle, showDirection } = props;
|
|
173
173
|
const style = { "--unit-radius": `${unitRadius}px`, "--circle-count": circleCount, "--circle-width": `${circleWidth}px`, "--circle-color": circleColor, "--direction-count": directionCount, "--direction-width": `${directionWidth}px`, "--direction-color": directionColor, "--background-color": backgroundColor, "--scan-color": scanColor, "--period": `${period}s` };
|
|
174
|
-
return /* @__PURE__ */ React.createElement("div", { className: "sea-radar-wrapper", style }, Array(180).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-little-graduation", style: { transform: `rotateZ(${2 * index}deg)`, display: showGraduationLine ? "block" : "none" } })), Array(36).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-graduation", style: { transform: `rotateZ(${10 * index}deg)`, display: showGraduationLine ? "block" : "none" } }, /* @__PURE__ */ React.createElement("span", { className: "sea-radar-graduation-text", style: { display: showGraduationText ? "block" : "none" } }, String(index * 10).padStart(3, "0")))), /* @__PURE__ */ React.createElement("div", { className: "sea-radar" }, /* @__PURE__ */ React.createElement("div", { className: "sea-radar-scan", style: { height: `${unitRadius * circleCount * Math.tan(scanAngle)}px`, clipPath: `polygon(0 0, 0 100%, 100% 100%)` } }), showCircle && Array(circleCount).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-circle", style: { width: `${unitRadius * 2 * (index + 1)}px`, height: `${unitRadius * 2 * (index + 1)}px` } })), showDirection && Array(directionCount).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-direction", style: { transform: `rotateZ(${360 / directionCount * index}deg)` } })), targets
|
|
174
|
+
return /* @__PURE__ */ React.createElement("div", { className: "sea-radar-wrapper", style }, Array(180).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-little-graduation", style: { transform: `rotateZ(${2 * index}deg)`, display: showGraduationLine ? "block" : "none" } })), Array(36).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-graduation", style: { transform: `rotateZ(${10 * index}deg)`, display: showGraduationLine ? "block" : "none" } }, /* @__PURE__ */ React.createElement("span", { className: "sea-radar-graduation-text", style: { display: showGraduationText ? "block" : "none" } }, String(index * 10).padStart(3, "0")))), /* @__PURE__ */ React.createElement("div", { className: "sea-radar" }, /* @__PURE__ */ React.createElement("div", { className: "sea-radar-scan", style: { height: `${unitRadius * circleCount * Math.tan(scanAngle)}px`, clipPath: `polygon(0 0, 0 100%, 100% 100%)` } }), showCircle && Array(circleCount).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-circle", style: { width: `${unitRadius * 2 * (index + 1)}px`, height: `${unitRadius * 2 * (index + 1)}px` } })), showDirection && Array(directionCount).fill(0).map((_, index) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-direction", style: { transform: `rotateZ(${360 / directionCount * index}deg)` } })), targets?.map((it) => /* @__PURE__ */ React.createElement("div", { className: "sea-radar-target", style: { left: `${unitRadius * circleCount + it.radius * Math.cos(it.angle)}px`, bottom: `${unitRadius * circleCount + it.radius * Math.sin(it.angle)}px` } }, it.element))));
|
|
175
175
|
};
|
|
176
176
|
var Ring = (props) => {
|
|
177
177
|
const { outerWidth, innerWidth, style, ...leftProps } = props;
|
|
@@ -245,12 +245,12 @@ function Flow(props) {
|
|
|
245
245
|
};
|
|
246
246
|
}, [itemWidth, throttle, columnGap]);
|
|
247
247
|
(0, import_react.useEffect)(() => {
|
|
248
|
-
onSizeChange
|
|
248
|
+
onSizeChange?.({ width, height, itemWidth, itemHeight, columnGap: columnGapSize, columnCount, rowGap, rowCount: contentShownRows, overflow: data.length > contentShownRows * columnCount, itemCount: data.length, maxRows: maxRows ?? null });
|
|
249
249
|
}, [width, height, columnGapSize, columnCount, rowGap, contentShownRows, data.length, itemWidth, itemHeight, maxRows]);
|
|
250
250
|
return /* @__PURE__ */ React.createElement("div", { ref: ele, className, style: { position: "relative", boxSizing: "border-box", height, ...style }, ...others }, showItems && data.map((it, idx) => /* @__PURE__ */ React.createElement(
|
|
251
251
|
"div",
|
|
252
252
|
{
|
|
253
|
-
key:
|
|
253
|
+
key: keyExactor?.(it, idx) || idx,
|
|
254
254
|
className: containerClassName,
|
|
255
255
|
style: {
|
|
256
256
|
position: "absolute",
|
|
@@ -276,69 +276,77 @@ var Trapezium = (0, import_react.forwardRef)((props, ref) => {
|
|
|
276
276
|
const h = f * Math.sin(a * 2);
|
|
277
277
|
return /* @__PURE__ */ React.createElement("div", { ref, style: { width: bottom, height, clipPath: `path("M ${diff + f} ${0} A ${borderRadius} ${borderRadius} 0 0 0 ${diff - g} ${h} L ${c} ${height - d} A ${borderRadius} ${borderRadius} 0 0 0 ${b} ${height} L ${bottom - b} ${height} A ${borderRadius} ${borderRadius} 0 0 0 ${bottom - c} ${height - d} L ${top + diff + g} ${h} A ${borderRadius} ${borderRadius} 0 0 0 ${top + diff - f} ${0} Z")`, ...style }, ...other });
|
|
278
278
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
const keys = data.map((it, idx, arr) => keyExactor ? keyExactor(it, idx, arr) : String(idx));
|
|
285
|
-
const keysRef = (0, import_react.useRef)(keys);
|
|
286
|
-
const cache = (0, import_react.useRef)({ size, gap, speed, keys, paused, className, direction });
|
|
287
|
-
cache.current = { size, gap, speed, keys, paused, className, direction };
|
|
288
|
-
const eles = (0, import_react.useRef)(keys.map((key, idx) => ({ key, dom: null, offset: idx * (size + gap) + start })));
|
|
289
|
-
if (keysRef.current.length !== keys.length || keysRef.current.some((it, idx) => it !== keys[idx])) {
|
|
290
|
-
keysRef.current = keys;
|
|
291
|
-
eles.current = keys.map((key, idx) => ({ key, dom: null, offset: idx * (size + gap) + start }));
|
|
292
|
-
}
|
|
293
|
-
function setStyles() {
|
|
294
|
-
const { size: size2, speed: speed2, className: className2, direction: direction2 } = cache.current;
|
|
295
|
-
eles.current.forEach((it) => {
|
|
296
|
-
it.dom.className = className2;
|
|
297
|
-
it.dom.style.setProperty("position", `absolute`);
|
|
298
|
-
it.dom.style.setProperty("width", `${size2}px`);
|
|
299
|
-
direction2 === "x" && speed2 < 0 ? it.dom.style.setProperty("right", `0`) : it.dom.style.setProperty("left", `0`);
|
|
300
|
-
direction2 === "y" && speed2 < 0 ? it.dom.style.setProperty("bottom", `0`) : it.dom.style.setProperty("top", `0`);
|
|
301
|
-
it.dom.style.setProperty("transform", `translate${direction2.toUpperCase()}(${it.offset * (speed2 > 0 ? 1 : -1)}px)`);
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
(0, import_react.useEffect)(() => {
|
|
305
|
-
setStyles();
|
|
306
|
-
}, []);
|
|
307
|
-
(0, import_react.useEffect)(() => {
|
|
308
|
-
const stop = (0, import_deepsea_tools.setFrameInterval)(() => {
|
|
309
|
-
const { size: size2, gap: gap2, speed: speed2, keys: keys2, paused: paused2 } = cache.current;
|
|
310
|
-
if (paused2)
|
|
311
|
-
return;
|
|
312
|
-
eles.current.length = keys2.length;
|
|
313
|
-
let minIndex = 0;
|
|
314
|
-
eles.current.forEach((it, idx) => {
|
|
315
|
-
if (it.offset < eles.current[minIndex].offset) {
|
|
316
|
-
minIndex = idx;
|
|
279
|
+
import_css.css`
|
|
280
|
+
@keyframes deepsea-horizontal-loop-swipe {
|
|
281
|
+
from {
|
|
282
|
+
transform: translateX(0);
|
|
317
283
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
284
|
+
to {
|
|
285
|
+
transform: translateX(-100%);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
@keyframes deepsea-reverse-horizontal-loop-swipe {
|
|
289
|
+
from {
|
|
290
|
+
transform: translateX(0);
|
|
291
|
+
}
|
|
292
|
+
to {
|
|
293
|
+
transform: translateX(100%);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
@keyframes deepsea-vertical-loop-swipe {
|
|
297
|
+
from {
|
|
298
|
+
transform: translateY(0);
|
|
299
|
+
}
|
|
300
|
+
to {
|
|
301
|
+
transform: translateY(-100%);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
@keyframes deepsea-reverse-vertical-loop-swipe {
|
|
305
|
+
from {
|
|
306
|
+
transform: translateY(0);
|
|
307
|
+
}
|
|
308
|
+
to {
|
|
309
|
+
transform: translateY(100%);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
`;
|
|
313
|
+
var LoopSwiper = (0, import_react.forwardRef)((props, ref) => {
|
|
314
|
+
const { style, children, direction, period, reverse, gap, ...others } = props;
|
|
315
|
+
const wrapper = (0, import_react.useRef)(null);
|
|
316
|
+
const container = (0, import_react.useRef)(null);
|
|
317
|
+
const [swiper, setSwiper] = (0, import_react.useState)(false);
|
|
318
|
+
const directionRef = (0, import_react.useRef)(direction);
|
|
319
|
+
directionRef.current = direction;
|
|
320
|
+
const flexDirection = direction === "vertical" ? reverse ? "column-reverse" : "column" : reverse ? "row-reverse" : "row";
|
|
321
|
+
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";
|
|
322
|
+
const animationDuration = `${period}ms`;
|
|
323
|
+
const animationTimingFunction = "linear";
|
|
324
|
+
const animationIterationCount = "infinite";
|
|
325
|
+
(0, import_react.useImperativeHandle)(ref, () => wrapper.current);
|
|
326
|
+
(0, import_react.useEffect)(() => {
|
|
327
|
+
const wrapperEle = wrapper.current;
|
|
328
|
+
const containerEle = container.current;
|
|
329
|
+
let wrapperWidth = 0;
|
|
330
|
+
let wrapperHeight = 0;
|
|
331
|
+
let containerWidth = 0;
|
|
332
|
+
let containerHeight = 0;
|
|
333
|
+
const observer = new ResizeObserver((entries) => {
|
|
334
|
+
entries.forEach((entry) => {
|
|
335
|
+
if (entry.target === wrapperEle) {
|
|
336
|
+
wrapperWidth = entry.contentRect.width;
|
|
337
|
+
wrapperHeight = entry.contentRect.height;
|
|
338
|
+
} else if (entry.target === containerEle) {
|
|
339
|
+
containerWidth = entry.contentRect.width;
|
|
340
|
+
containerHeight = entry.contentRect.height;
|
|
328
341
|
}
|
|
329
|
-
it.offset = newOffset;
|
|
330
342
|
});
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
343
|
+
setSwiper(directionRef.current === "vertical" ? containerHeight > wrapperHeight : containerWidth > wrapperWidth);
|
|
344
|
+
});
|
|
345
|
+
observer.observe(wrapperEle);
|
|
346
|
+
observer.observe(containerEle);
|
|
334
347
|
}, []);
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return;
|
|
338
|
-
eles.current[index].dom = dom;
|
|
339
|
-
}
|
|
340
|
-
return /* @__PURE__ */ React.createElement(import_react.Fragment, null, data.map((it, idx, arr) => /* @__PURE__ */ React.createElement("div", { key: keys[idx], ref: (dom) => ref(dom, idx) }, render(it, idx, arr))));
|
|
341
|
-
}
|
|
348
|
+
return /* @__PURE__ */ React.createElement("div", { ref: wrapper, style: { display: "flex", flexDirection, gap, ...style }, ...others }, /* @__PURE__ */ React.createElement("div", { ref: container, style: { display: "flex", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount } }, children), /* @__PURE__ */ React.createElement("div", { style: { display: swiper ? "flex" : "none", flexDirection, gap, animationName, animationTimingFunction, animationDuration, animationIterationCount } }, children));
|
|
349
|
+
});
|
|
342
350
|
var SectionRing = (props) => {
|
|
343
351
|
const { outerRadius: o, innerRadius: i, count: c, angel: a, style, ...others } = props;
|
|
344
352
|
const s = Math.PI * 2 / c - a;
|
|
@@ -453,11 +461,7 @@ var AutoSizeTextArea = (0, import_react.forwardRef)((props, ref) => {
|
|
|
453
461
|
textarea.style.height = `${textarea.scrollHeight + textarea.offsetHeight - textarea.clientHeight}px`;
|
|
454
462
|
}
|
|
455
463
|
textarea.addEventListener("input", resizeTextarea);
|
|
456
|
-
textarea.
|
|
457
|
-
return () => {
|
|
458
|
-
textarea.removeEventListener("input", resizeTextarea);
|
|
459
|
-
textarea.removeEventListener("change", resizeTextarea);
|
|
460
|
-
};
|
|
464
|
+
return () => textarea.removeEventListener("input", resizeTextarea);
|
|
461
465
|
}, []);
|
|
462
466
|
return /* @__PURE__ */ React.createElement("textarea", { ref: ele, style: { ...otherStyle, resize: "none", overflowY: "hidden" }, ...others });
|
|
463
467
|
});
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { css } from \"@emotion/css\"\r\nimport { DrawArcOptions, clsx, drawArc, setFrameInterval } from \"deepsea-tools\"\r\nimport { ButtonHTMLAttributes, CSSProperties, ChangeEvent, FC, Fragment, HTMLAttributes, InputHTMLAttributes, MouseEvent as ReactMouseEvent, ReactNode, TextareaHTMLAttributes, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\"\r\nimport SmoothScrollBar from \"smooth-scrollbar\"\r\nimport type { ScrollbarOptions } from \"smooth-scrollbar/interfaces\"\r\nimport { read, utils, writeFile } from \"xlsx\"\r\n\r\nexport type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false\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, ...others } = 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 disabled={disabled && inputDisabled} ref={ref} type=\"file\" multiple={multiple} onChange={onInputChange} {...others} />\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, ...others } = 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} {...others} />\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, ...others } = 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} {...others} />\r\n})\r\n\r\nexport interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {\r\n containerClassName?: string\r\n containerStyle?: CSSProperties\r\n vertical?: boolean\r\n horizontal?: boolean\r\n time?: number\r\n}\r\n\r\n/** 尺寸渐变的组件 */\r\nexport const TransitionBox: FC<TransitionBoxProps> = props => {\r\n const { style, containerClassName, containerStyle, children, vertical = true, horizontal = true, time = 3000, ...others } = props\r\n const box = useRef<HTMLDivElement>(null)\r\n const [width, setWidth] = useState(0)\r\n const [height, setHeight] = useState(0)\r\n const [count, setCount] = useState(0)\r\n\r\n useEffect(() => {\r\n const observer = new ResizeObserver(entries => {\r\n const { width: currentWidth, height: currentHeight } = entries[0].contentRect\r\n setWidth(currentWidth)\r\n setHeight(currentHeight)\r\n })\r\n\r\n observer.observe(box.current!)\r\n\r\n return () => {\r\n observer.disconnect()\r\n }\r\n }, [])\r\n\r\n useEffect(() => {\r\n setCount(count => Math.min(count + 1, 3))\r\n }, [width, height])\r\n\r\n const outerStyle: CSSProperties = { transitionProperty: count === 3 ? [horizontal && \"width\", vertical && \"height\"].filter(Boolean).join(\", \") : undefined, transitionDuration: count === 3 ? `${time}ms` : undefined, width, height, overflow: \"hidden\", position: \"relative\", ...style }\r\n\r\n return (\r\n <div style={outerStyle} {...others}>\r\n <div className={containerClassName} style={{ position: \"absolute\", ...containerStyle }} ref={box}>\r\n {children}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport interface SeaRadarTarget {\r\n /** 半径 */\r\n radius: number\r\n /** 弧度 */\r\n angle: number\r\n /** 元素 */\r\n element: ReactNode\r\n}\r\n\r\nexport interface SeaRadarProps {\r\n /** 最小圆的半径 */\r\n unitRadius?: number\r\n /** 一共的全数 */\r\n circleCount?: number\r\n /** 角度分成多少份 */\r\n directionCount?: number\r\n /** 圈的宽度 */\r\n circleWidth?: number\r\n /** 圈的颜色 */\r\n circleColor: string\r\n /** 角度的宽度 */\r\n directionWidth?: number\r\n /** 角度颜色 */\r\n directionColor: string\r\n /** 背景色 */\r\n backgroundColor: string\r\n /** 扫描的颜色 */\r\n scanColor: string\r\n /** 扫描的弧度 */\r\n scanAngle?: number\r\n /** 扫描一周的时间,单位秒 */\r\n period?: number\r\n /** 目标列表 */\r\n targets?: SeaRadarTarget[]\r\n /** 展示圈 */\r\n showCircle?: boolean\r\n /** 展示方位 */\r\n showDirection?: boolean\r\n /** 展示刻度线 */\r\n showGraduationLine?: boolean\r\n /** 展示刻度文字 */\r\n showGraduationText?: boolean\r\n}\r\n\r\n/** 雷达组件 */\r\nexport const SeaRadar: FC<SeaRadarProps> = props => {\r\n const { unitRadius = 50, circleCount = 4, circleWidth = 1, circleColor, directionCount = 36, directionWidth = 1, directionColor, backgroundColor, scanColor, scanAngle = Math.PI / 6, period = 8, targets, showGraduationLine, showGraduationText, showCircle, showDirection } = props\r\n const style = { \"--unit-radius\": `${unitRadius}px`, \"--circle-count\": circleCount, \"--circle-width\": `${circleWidth}px`, \"--circle-color\": circleColor, \"--direction-count\": directionCount, \"--direction-width\": `${directionWidth}px`, \"--direction-color\": directionColor, \"--background-color\": backgroundColor, \"--scan-color\": scanColor, \"--period\": `${period}s` } as CSSProperties\r\n return (\r\n <div className=\"sea-radar-wrapper\" style={style}>\r\n {Array(180)\r\n .fill(0)\r\n .map((_, index) => (\r\n <div className=\"sea-radar-little-graduation\" style={{ transform: `rotateZ(${2 * index}deg)`, display: showGraduationLine ? \"block\" : \"none\" }}></div>\r\n ))}\r\n {Array(36)\r\n .fill(0)\r\n .map((_, index) => (\r\n <div className=\"sea-radar-graduation\" style={{ transform: `rotateZ(${10 * index}deg)`, display: showGraduationLine ? \"block\" : \"none\" }}>\r\n <span className=\"sea-radar-graduation-text\" style={{ display: showGraduationText ? \"block\" : \"none\" }}>\r\n {String(index * 10).padStart(3, \"0\")}\r\n </span>\r\n </div>\r\n ))}\r\n <div className=\"sea-radar\">\r\n <div className=\"sea-radar-scan\" style={{ height: `${unitRadius * circleCount * Math.tan(scanAngle)}px`, clipPath: `polygon(0 0, 0 100%, 100% 100%)` }}></div>\r\n {showCircle &&\r\n Array(circleCount)\r\n .fill(0)\r\n .map((_, index) => <div className=\"sea-radar-circle\" style={{ width: `${unitRadius * 2 * (index + 1)}px`, height: `${unitRadius * 2 * (index + 1)}px` }}></div>)}\r\n {showDirection &&\r\n Array(directionCount)\r\n .fill(0)\r\n .map((_, index) => <div className=\"sea-radar-direction\" style={{ transform: `rotateZ(${(360 / directionCount) * index}deg)` }}></div>)}\r\n {targets?.map(it => (\r\n <div className=\"sea-radar-target\" style={{ left: `${unitRadius * circleCount + it.radius * Math.cos(it.angle)}px`, bottom: `${unitRadius * circleCount + it.radius * Math.sin(it.angle)}px` }}>\r\n {it.element}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n )\r\n}\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: FC<RingProps> = props => {\r\n const { outerWidth, innerWidth, style, ...leftProps } = props\r\n\r\n const outerRadius = outerWidth / 2\r\n\r\n const innerRadius = innerWidth / 2\r\n\r\n return <div 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\")` }} {...leftProps} />\r\n}\r\n\r\nexport interface FlowSizeData {\r\n /** 容器宽度 */\r\n width: number\r\n /** 容器高度 */\r\n height: number\r\n /** 元素宽度 */\r\n itemWidth: number\r\n /** 元素高度 */\r\n itemHeight: number\r\n /** 列间距 */\r\n columnGap: number\r\n /** 列数 */\r\n columnCount: number\r\n /** 行间距 */\r\n rowGap: number\r\n /** 行数 */\r\n rowCount: number\r\n /** 元素格数 */\r\n itemCount: number\r\n /** 最大行数 */\r\n maxRows: number | null\r\n /** 是否有元素被隐藏 */\r\n overflow: boolean\r\n}\r\n\r\nexport interface FlowProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\r\n /** 元素宽度 */\r\n itemWidth: number\r\n /** 元素高度 */\r\n itemHeight: number\r\n /** 列间距 */\r\n columnGap?: number | null | (number | null)[]\r\n /** 行间距 */\r\n rowGap?: number\r\n /** 最大行数 */\r\n maxRows?: number | null\r\n /** 源数据 */\r\n data: T[]\r\n /** 渲染 */\r\n render: (item: T, index: number, hidden: boolean) => ReactNode\r\n /** key释放器,默认为 index */\r\n keyExactor?: (item: T, index: number) => string | number\r\n /** 容器类名 */\r\n containerClassName?: string\r\n /** 容器样式 */\r\n containerStyle?: CSSProperties\r\n /** 节流时间,单位毫秒,默认200ms,传入 null 不节流 */\r\n throttle?: number | null\r\n /** 动画时间,单位毫秒,默认400ms,传入 null 不展示动画 */\r\n transitionDuration?: number | null\r\n /** 变化的回调函数 */\r\n onSizeChange?: (sizeData: FlowSizeData) => void\r\n}\r\n\r\nexport function getGapRange(gap?: undefined | number | null | (number | null)[]): [number, number | null] {\r\n if (typeof gap === \"number\") return [gap, gap]\r\n if (Array.isArray(gap)) return [gap[0] || 0, gap[1]]\r\n return [0, null]\r\n}\r\n\r\nexport function getGapCountAndSize(width: number, itemWidth: number, minGap: number, maxGap: number | null): [number, number] {\r\n const count = Math.floor((width + minGap) / (itemWidth + minGap)) || 1\r\n if (count === 1) return [count, 0]\r\n const averageGap = (width - itemWidth * count) / (count - 1)\r\n if (averageGap < minGap) return [count, minGap]\r\n if (maxGap !== null && averageGap > maxGap) return [count, maxGap]\r\n return [count, averageGap]\r\n}\r\n\r\n/** 自适应浮动组件 */\r\nexport function Flow<T>(props: FlowProps<T>) {\r\n const { itemWidth, itemHeight, columnGap, rowGap = 0, maxRows, data, render, keyExactor, className, style, containerClassName, containerStyle, throttle, transitionDuration, onSizeChange, ...others } = props\r\n const [minColumnGap, maxColumnGap] = getGapRange(columnGap)\r\n const [width, setWidth] = useState(0)\r\n const [columnCount, setColumnCount] = useState(1)\r\n const [columnGapSize, setColumnGapSize] = useState(minColumnGap)\r\n const [showItems, setShowItems] = useState(false)\r\n const ele = useRef<HTMLDivElement>(null)\r\n const contentRows = Math.ceil(data.length / columnCount)\r\n const contentShownRows = typeof maxRows === \"number\" ? Math.min(contentRows, maxRows) : contentRows\r\n const height = contentShownRows > 0 ? contentShownRows * (itemHeight + rowGap) - rowGap : 0\r\n\r\n interface Position {\r\n left: number\r\n top: number\r\n }\r\n\r\n function getPosition(index: number): Position {\r\n const y = Math.floor(index / columnCount)\r\n const x = index - y * columnCount\r\n return {\r\n left: x * (itemWidth + columnGapSize),\r\n top: y * (itemHeight + rowGap)\r\n }\r\n }\r\n\r\n function getHidden(index: number) {\r\n if (typeof maxRows !== \"number\") return false\r\n return index >= maxRows * columnCount\r\n }\r\n\r\n useEffect(() => {\r\n let timeout: number\r\n const observer = new ResizeObserver(entries => {\r\n clearTimeout(timeout)\r\n function task() {\r\n const { inlineSize: width } = entries[0].borderBoxSize[0]\r\n const [newColumnCount, newColumnGapSize] = getGapCountAndSize(width, itemWidth, minColumnGap, maxColumnGap)\r\n setShowItems(true)\r\n setWidth(width)\r\n setColumnCount(newColumnCount)\r\n setColumnGapSize(newColumnGapSize)\r\n }\r\n if (throttle === null) {\r\n task()\r\n } else {\r\n timeout = window.setTimeout(task, throttle || 200)\r\n }\r\n })\r\n observer.observe(ele.current!)\r\n\r\n return () => {\r\n observer.disconnect()\r\n }\r\n }, [itemWidth, throttle, columnGap])\r\n\r\n useEffect(() => {\r\n onSizeChange?.({ width, height, itemWidth, itemHeight, columnGap: columnGapSize, columnCount, rowGap, rowCount: contentShownRows, overflow: data.length > contentShownRows * columnCount, itemCount: data.length, maxRows: maxRows ?? null })\r\n }, [width, height, columnGapSize, columnCount, rowGap, contentShownRows, data.length, itemWidth, itemHeight, maxRows])\r\n\r\n return (\r\n <div ref={ele} className={className} style={{ position: \"relative\", boxSizing: \"border-box\", height, ...style }} {...others}>\r\n {showItems &&\r\n data.map((it, idx) => (\r\n <div\r\n key={keyExactor?.(it, idx) || idx}\r\n className={containerClassName}\r\n style={{\r\n position: \"absolute\",\r\n width: itemWidth,\r\n height: itemHeight,\r\n transition: transitionDuration !== null ? `all ${transitionDuration ?? 400}ms` : undefined,\r\n ...getPosition(idx)\r\n }}>\r\n <div style={{ width: itemWidth, height: itemHeight, display: maxRows && idx >= maxRows * columnCount ? \"none\" : \"block\", ...containerStyle }}>{render(it, idx, getHidden(idx))}</div>\r\n </div>\r\n ))}\r\n </div>\r\n )\r\n}\r\n\r\nexport interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {\r\n top: number\r\n bottom: number\r\n height: number\r\n borderRadius: number\r\n}\r\n\r\n/** 梯形组件 */\r\nexport const Trapezium = forwardRef<HTMLDivElement, TrapeziumProps>((props, ref) => {\r\n const { top, bottom, height, borderRadius, style, ...other } = props\r\n\r\n const diff = (bottom - top) / 2\r\n\r\n const a = Math.atan(height / diff) / 2\r\n\r\n const b = borderRadius / Math.tan(a)\r\n\r\n const c = b * Math.cos(a * 2)\r\n\r\n const d = b * Math.sin(a * 2)\r\n\r\n const e = Math.PI / 2 - a\r\n\r\n const f = borderRadius / Math.tan(e)\r\n\r\n const g = f * Math.cos(a * 2)\r\n\r\n const h = f * Math.sin(a * 2)\r\n\r\n return <div ref={ref} style={{ width: bottom, height, clipPath: `path(\"M ${diff + f} ${0} A ${borderRadius} ${borderRadius} 0 0 0 ${diff - g} ${h} L ${c} ${height - d} A ${borderRadius} ${borderRadius} 0 0 0 ${b} ${height} L ${bottom - b} ${height} A ${borderRadius} ${borderRadius} 0 0 0 ${bottom - c} ${height - d} L ${top + diff + g} ${h} A ${borderRadius} ${borderRadius} 0 0 0 ${top + diff - f} ${0} Z\")`, ...style }} {...other} />\r\n})\r\n\r\nexport interface LoopSwiperProps<T> {\r\n /** 源数据 */\r\n data: T[]\r\n /** 渲染函数 */\r\n render: (item: T, index: number, array: T[]) => ReactNode\r\n /** 每个元素的key */\r\n keyExactor?: (item: T, index: number, array: T[]) => string\r\n /** 水平方向是宽度,垂直方向是高度 */\r\n size: number\r\n /** 元素之间间隔 */\r\n gap?: number\r\n /** 起始位置 */\r\n start?: number\r\n /** 速度,水平方向正数为向左,水平方向负数为向右,垂直方向正数为向上,水平方向负数为向下 */\r\n speed: number\r\n /** 是否暂停播放 */\r\n paused?: boolean\r\n /** 容器的类名 */\r\n className?: string\r\n /** x 水平方向,y 垂直方向 */\r\n direction?: \"x\" | \"y\"\r\n}\r\n\r\nexport interface LoopSwiperItem {\r\n key: string\r\n dom: HTMLDivElement | null\r\n offset: number\r\n}\r\n\r\n/** 循环播放组件 */\r\nexport function LoopSwiper<T>(props: LoopSwiperProps<T>) {\r\n const { data, render, keyExactor, size, gap = 0, start = 0, speed, paused = false, className = \"\", direction = \"x\" } = props\r\n if (!(size > 0 && (speed > 0 || speed < 0))) {\r\n throw new RangeError(\"size 必须是正数,speed 必须非0\")\r\n }\r\n const keys = data.map((it, idx, arr) => (keyExactor ? keyExactor(it, idx, arr) : String(idx)))\r\n const keysRef = useRef(keys)\r\n const cache = useRef({ size, gap, speed, keys, paused, className, direction })\r\n cache.current = { size, gap, speed, keys, paused, className, direction }\r\n const eles = useRef<LoopSwiperItem[]>(keys.map((key, idx) => ({ key, dom: null, offset: idx * (size + gap) + start })))\r\n\r\n if (keysRef.current.length !== keys.length || keysRef.current.some((it, idx) => it !== keys[idx])) {\r\n keysRef.current = keys\r\n eles.current = keys.map((key, idx) => ({ key, dom: null, offset: idx * (size + gap) + start }))\r\n }\r\n\r\n function setStyles() {\r\n const { size, speed, className, direction } = cache.current\r\n eles.current.forEach(it => {\r\n it.dom!.className = className\r\n it.dom!.style.setProperty(\"position\", `absolute`)\r\n it.dom!.style.setProperty(\"width\", `${size}px`)\r\n direction === \"x\" && speed < 0 ? it.dom!.style.setProperty(\"right\", `0`) : it.dom!.style.setProperty(\"left\", `0`)\r\n direction === \"y\" && speed < 0 ? it.dom!.style.setProperty(\"bottom\", `0`) : it.dom!.style.setProperty(\"top\", `0`)\r\n it.dom!.style.setProperty(\"transform\", `translate${direction.toUpperCase()}(${it.offset * (speed > 0 ? 1 : -1)}px)`)\r\n })\r\n }\r\n\r\n useEffect(() => {\r\n setStyles()\r\n }, [])\r\n\r\n useEffect(() => {\r\n const stop = setFrameInterval(() => {\r\n const { size, gap, speed, keys, paused } = cache.current\r\n if (paused) return\r\n eles.current.length = keys.length\r\n let minIndex = 0\r\n eles.current.forEach((it, idx) => {\r\n if (it.offset < eles.current[minIndex].offset) {\r\n minIndex = idx\r\n }\r\n })\r\n const minOffset = eles.current[minIndex].offset\r\n eles.current.forEach((it, idx) => {\r\n let index = idx\r\n if (idx < minIndex) index = eles.current.length + idx\r\n it.offset = minOffset + (index - minIndex) * (size + gap)\r\n let newOffset = it.offset - Math.abs(speed)\r\n if (newOffset + size + gap <= 0) {\r\n newOffset += eles.current.length * (size + gap)\r\n }\r\n it.offset = newOffset\r\n })\r\n setStyles()\r\n }, 1)\r\n\r\n return stop\r\n }, [])\r\n\r\n function ref(dom: HTMLDivElement | null, index: number) {\r\n if (!eles.current[index]) return\r\n eles.current[index].dom = dom\r\n }\r\n\r\n return (\r\n <Fragment>\r\n {data.map((it, idx, arr) => (\r\n <div key={keys[idx]} ref={dom => ref(dom, idx)}>\r\n {render(it, idx, arr)}\r\n </div>\r\n ))}\r\n </Fragment>\r\n )\r\n}\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, ...others } = 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 {...others}\r\n />\r\n )\r\n}\r\n\r\nexport interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\r\n /** 当前数字 */\r\n children: number\r\n /** 变换周期,单位帧 */\r\n period: number\r\n /** 数字转换为字符串的方法 */\r\n numToStr?: (num: number) => string\r\n}\r\n\r\nexport interface TransitionNumIns {\r\n get(): number\r\n}\r\n\r\n/** 渐变数字组件 */\r\nexport const TransitionNum = forwardRef<TransitionNumIns, TransitionNumProps>((props, ref) => {\r\n const { children: num, period, numToStr, ...others } = props\r\n if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) {\r\n throw new RangeError(\"目标数字必须是整数,周期必须是正整数\")\r\n }\r\n const ele = useRef<HTMLDivElement>(null)\r\n const cache = useRef({ num, period, numToStr, show: num })\r\n cache.current = { ...cache.current, num, period, numToStr }\r\n\r\n useImperativeHandle(ref, () => ({ get: () => cache.current.show }), [])\r\n\r\n useEffect(() => {\r\n const { num, period, show, numToStr } = cache.current\r\n ele.current!.innerText = (numToStr || String)(show)\r\n if (num === show) return\r\n const div = ele.current!\r\n const speed = (num - show) / period\r\n const cancel = setFrameInterval(() => {\r\n const { num, numToStr } = cache.current\r\n cache.current.show += speed\r\n if ((speed > 0 && cache.current.show > num) || (speed < 0 && cache.current.show < num)) {\r\n cancel()\r\n cache.current.show = num\r\n }\r\n div.innerText = (numToStr || String)(speed > 0 ? Math.floor(cache.current.show) : Math.ceil(cache.current.show))\r\n }, 1)\r\n\r\n return cancel\r\n }, [num])\r\n\r\n return <div ref={ele} {...others} />\r\n})\r\n\r\nexport interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\"> {\r\n /** 每一个方块的宽度 */\r\n width: number\r\n /** 每一个方块的高度 */\r\n height: number\r\n /** 圆弧的半径,不包含方块的高度 */\r\n radius: number\r\n /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */\r\n startAngel?: number\r\n /** 每一个方块之间间隔的弧度 */\r\n gapAngel?: number\r\n /** 文字对齐的方式,默认居中 */\r\n align?: \"left\" | \"center\" | \"right\"\r\n /** 文字朝向圆心还是外侧,默认外侧 */\r\n direction?: \"inner\" | \"outer\"\r\n /** 是否反转文字顺序 */\r\n reverse?: boolean\r\n /** 分割文字的方法 */\r\n separator?: string | RegExp | ((text: string) => string[])\r\n /** 显示的文字 */\r\n children: string\r\n}\r\n\r\n/** 环形文字 */\r\nexport const CircleText: FC<CircleTextProps> = props => {\r\n const { width, height, radius, startAngel = 0, gapAngel = 0, align = \"center\", style, direction = \"outer\", reverse = false, separator, children, ...others } = props\r\n const unitAngle = Math.atan(width / 2 / radius) * 2\r\n const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel\r\n const offsetAngle = align === \"left\" ? 0 : align === \"right\" ? totalAngle : totalAngle / 2\r\n\r\n function getTransform(idx: number) {\r\n const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2\r\n const x = (radius + height / 2) * Math.cos(angle) - width / 2\r\n const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2\r\n const z = Math.PI / 2 - angle + (direction === \"inner\" ? Math.PI : 0)\r\n return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`\r\n }\r\n\r\n const words = typeof separator === \"function\" ? separator(children) : children.split(separator ?? \"\")\r\n\r\n if (reverse) words.reverse()\r\n\r\n return (\r\n <Fragment>\r\n {words.map((w, idx) => (\r\n <span key={idx} style={{ position: \"absolute\", ...style, transform: getTransform(idx), textAlign: \"center\", width, lineHeight: `${height}px`, height: height }} {...others}>\r\n {w}\r\n </span>\r\n ))}\r\n </Fragment>\r\n )\r\n}\r\n\r\nexport interface ScrollOptions extends Partial<ScrollbarOptions> {\r\n /** 滑块宽度 */\r\n thumbWidth?: number\r\n}\r\n\r\nexport interface ScrollProps extends HTMLAttributes<HTMLDivElement> {\r\n /** 滚动的配置 */\r\n options?: ScrollOptions\r\n /** 容器宽度 */\r\n containerClassName?: string\r\n /** 容器样式 */\r\n containerStyle?: CSSProperties\r\n}\r\n\r\n/**\r\n * 滚动条组件\r\n * @description 注意 children 不是直接渲染在组件上的,而是渲染在内部的容器上\r\n */\r\nexport const Scroll = forwardRef<HTMLDivElement, ScrollProps>((props, ref) => {\r\n const { children, containerClassName, containerStyle, options, className, ...others } = props\r\n const { thumbWidth, ...scrollbarOptions } = options || {}\r\n const ele = useRef<HTMLDivElement>(null)\r\n\r\n useImperativeHandle(ref, () => ele.current!)\r\n\r\n useEffect(() => {\r\n SmoothScrollBar.init(ele.current!, scrollbarOptions)\r\n }, [])\r\n\r\n return (\r\n <div\r\n ref={ele}\r\n className={clsx(\r\n !!thumbWidth &&\r\n css`\r\n .scrollbar-track.scrollbar-track-x {\r\n height: ${thumbWidth}px;\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-x {\r\n height: ${thumbWidth}px;\r\n }\r\n\r\n .scrollbar-track.scrollbar-track-y {\r\n width: ${thumbWidth}px;\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-y {\r\n width: ${thumbWidth}px;\r\n }\r\n `,\r\n className\r\n )}\r\n {...others}>\r\n <div className={containerClassName} style={containerStyle}>\r\n {children}\r\n </div>\r\n </div>\r\n )\r\n})\r\n\r\nexport const AutoSizeTextArea = forwardRef<HTMLTextAreaElement, TextareaHTMLAttributes<HTMLTextAreaElement>>((props, ref) => {\r\n const { style = {}, ...others } = props\r\n const { height, resize, overflowY, ...otherStyle } = style\r\n const ele = useRef<HTMLTextAreaElement>(null)\r\n\r\n useImperativeHandle(ref, () => ele.current!)\r\n\r\n useEffect(() => {\r\n const textarea = ele.current!\r\n function resizeTextarea() {\r\n textarea.style.height = \"auto\"\r\n textarea.style.height = `${textarea.scrollHeight + textarea.offsetHeight - textarea.clientHeight}px`\r\n }\r\n textarea.addEventListener(\"input\", resizeTextarea)\r\n textarea.addEventListener(\"change\", resizeTextarea)\r\n\r\n return () => {\r\n textarea.removeEventListener(\"input\", resizeTextarea)\r\n textarea.removeEventListener(\"change\", resizeTextarea)\r\n }\r\n }, [])\r\n\r\n return <textarea ref={ele} style={{ ...otherStyle, resize: \"none\", overflowY: \"hidden\" }} {...others} />\r\n})\r\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AACpB,2BAAgE;AAChE,mBAAoP;AACpP,8BAA4B;AAE5B,kBAAuC;AAwDvC,eAAsB,YAAyC,MAAY,MAAyC;AAChH,QAAM,aAAa,IAAI,WAAW;AAClC,UAAQ,MAAM;AAAA,IACV,KAAK;AACD,iBAAW,kBAAkB,IAAI;AACjC;AAAA,IACJ,KAAK;AACD,iBAAW,mBAAmB,IAAI;AAClC;AAAA,IACJ,KAAK;AACD,iBAAW,cAAc,IAAI;AAC7B;AAAA,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Ac;AACpD,eAAS,oBAAoB,UAAU,cAAc;AAAA,IACzD;AAAA,EACJ,GAAG,CAAC,CAAC;AAEL,SAAO,oCAAC,cAAS,KAAK,KAAK,OAAO,EAAE,GAAG,YAAY,QAAQ,QAAQ,WAAW,SAAS,GAAI,GAAG,QAAQ;AAC1G,CAAC;",
|
|
6
|
-
"names": ["count", "width", "
|
|
4
|
+
"sourcesContent": ["import { css } from \"@emotion/css\"\r\nimport { DrawArcOptions, clsx, drawArc, setFrameInterval } from \"deepsea-tools\"\r\nimport { ButtonHTMLAttributes, CSSProperties, ChangeEvent, FC, Fragment, HTMLAttributes, InputHTMLAttributes, MouseEvent as ReactMouseEvent, ReactNode, TextareaHTMLAttributes, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\"\r\nimport SmoothScrollBar from \"smooth-scrollbar\"\r\nimport type { ScrollbarOptions } from \"smooth-scrollbar/interfaces\"\r\nimport { read, utils, writeFile } from \"xlsx\"\r\n\r\nexport type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false\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, ...others } = 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 disabled={disabled && inputDisabled} ref={ref} type=\"file\" multiple={multiple} onChange={onInputChange} {...others} />\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, ...others } = 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} {...others} />\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, ...others } = 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} {...others} />\r\n})\r\n\r\nexport interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {\r\n containerClassName?: string\r\n containerStyle?: CSSProperties\r\n vertical?: boolean\r\n horizontal?: boolean\r\n time?: number\r\n}\r\n\r\n/** 尺寸渐变的组件 */\r\nexport const TransitionBox: FC<TransitionBoxProps> = props => {\r\n const { style, containerClassName, containerStyle, children, vertical = true, horizontal = true, time = 3000, ...others } = props\r\n const box = useRef<HTMLDivElement>(null)\r\n const [width, setWidth] = useState(0)\r\n const [height, setHeight] = useState(0)\r\n const [count, setCount] = useState(0)\r\n\r\n useEffect(() => {\r\n const observer = new ResizeObserver(entries => {\r\n const { width: currentWidth, height: currentHeight } = entries[0].contentRect\r\n setWidth(currentWidth)\r\n setHeight(currentHeight)\r\n })\r\n\r\n observer.observe(box.current!)\r\n\r\n return () => {\r\n observer.disconnect()\r\n }\r\n }, [])\r\n\r\n useEffect(() => {\r\n setCount(count => Math.min(count + 1, 3))\r\n }, [width, height])\r\n\r\n const outerStyle: CSSProperties = { transitionProperty: count === 3 ? [horizontal && \"width\", vertical && \"height\"].filter(Boolean).join(\", \") : undefined, transitionDuration: count === 3 ? `${time}ms` : undefined, width, height, overflow: \"hidden\", position: \"relative\", ...style }\r\n\r\n return (\r\n <div style={outerStyle} {...others}>\r\n <div className={containerClassName} style={{ position: \"absolute\", ...containerStyle }} ref={box}>\r\n {children}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport interface SeaRadarTarget {\r\n /** 半径 */\r\n radius: number\r\n /** 弧度 */\r\n angle: number\r\n /** 元素 */\r\n element: ReactNode\r\n}\r\n\r\nexport interface SeaRadarProps {\r\n /** 最小圆的半径 */\r\n unitRadius?: number\r\n /** 一共的全数 */\r\n circleCount?: number\r\n /** 角度分成多少份 */\r\n directionCount?: number\r\n /** 圈的宽度 */\r\n circleWidth?: number\r\n /** 圈的颜色 */\r\n circleColor: string\r\n /** 角度的宽度 */\r\n directionWidth?: number\r\n /** 角度颜色 */\r\n directionColor: string\r\n /** 背景色 */\r\n backgroundColor: string\r\n /** 扫描的颜色 */\r\n scanColor: string\r\n /** 扫描的弧度 */\r\n scanAngle?: number\r\n /** 扫描一周的时间,单位秒 */\r\n period?: number\r\n /** 目标列表 */\r\n targets?: SeaRadarTarget[]\r\n /** 展示圈 */\r\n showCircle?: boolean\r\n /** 展示方位 */\r\n showDirection?: boolean\r\n /** 展示刻度线 */\r\n showGraduationLine?: boolean\r\n /** 展示刻度文字 */\r\n showGraduationText?: boolean\r\n}\r\n\r\n/** 雷达组件 */\r\nexport const SeaRadar: FC<SeaRadarProps> = props => {\r\n const { unitRadius = 50, circleCount = 4, circleWidth = 1, circleColor, directionCount = 36, directionWidth = 1, directionColor, backgroundColor, scanColor, scanAngle = Math.PI / 6, period = 8, targets, showGraduationLine, showGraduationText, showCircle, showDirection } = props\r\n const style = { \"--unit-radius\": `${unitRadius}px`, \"--circle-count\": circleCount, \"--circle-width\": `${circleWidth}px`, \"--circle-color\": circleColor, \"--direction-count\": directionCount, \"--direction-width\": `${directionWidth}px`, \"--direction-color\": directionColor, \"--background-color\": backgroundColor, \"--scan-color\": scanColor, \"--period\": `${period}s` } as CSSProperties\r\n return (\r\n <div className=\"sea-radar-wrapper\" style={style}>\r\n {Array(180)\r\n .fill(0)\r\n .map((_, index) => (\r\n <div className=\"sea-radar-little-graduation\" style={{ transform: `rotateZ(${2 * index}deg)`, display: showGraduationLine ? \"block\" : \"none\" }}></div>\r\n ))}\r\n {Array(36)\r\n .fill(0)\r\n .map((_, index) => (\r\n <div className=\"sea-radar-graduation\" style={{ transform: `rotateZ(${10 * index}deg)`, display: showGraduationLine ? \"block\" : \"none\" }}>\r\n <span className=\"sea-radar-graduation-text\" style={{ display: showGraduationText ? \"block\" : \"none\" }}>\r\n {String(index * 10).padStart(3, \"0\")}\r\n </span>\r\n </div>\r\n ))}\r\n <div className=\"sea-radar\">\r\n <div className=\"sea-radar-scan\" style={{ height: `${unitRadius * circleCount * Math.tan(scanAngle)}px`, clipPath: `polygon(0 0, 0 100%, 100% 100%)` }}></div>\r\n {showCircle &&\r\n Array(circleCount)\r\n .fill(0)\r\n .map((_, index) => <div className=\"sea-radar-circle\" style={{ width: `${unitRadius * 2 * (index + 1)}px`, height: `${unitRadius * 2 * (index + 1)}px` }}></div>)}\r\n {showDirection &&\r\n Array(directionCount)\r\n .fill(0)\r\n .map((_, index) => <div className=\"sea-radar-direction\" style={{ transform: `rotateZ(${(360 / directionCount) * index}deg)` }}></div>)}\r\n {targets?.map(it => (\r\n <div className=\"sea-radar-target\" style={{ left: `${unitRadius * circleCount + it.radius * Math.cos(it.angle)}px`, bottom: `${unitRadius * circleCount + it.radius * Math.sin(it.angle)}px` }}>\r\n {it.element}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n )\r\n}\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: FC<RingProps> = props => {\r\n const { outerWidth, innerWidth, style, ...leftProps } = props\r\n\r\n const outerRadius = outerWidth / 2\r\n\r\n const innerRadius = innerWidth / 2\r\n\r\n return <div 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\")` }} {...leftProps} />\r\n}\r\n\r\nexport interface FlowSizeData {\r\n /** 容器宽度 */\r\n width: number\r\n /** 容器高度 */\r\n height: number\r\n /** 元素宽度 */\r\n itemWidth: number\r\n /** 元素高度 */\r\n itemHeight: number\r\n /** 列间距 */\r\n columnGap: number\r\n /** 列数 */\r\n columnCount: number\r\n /** 行间距 */\r\n rowGap: number\r\n /** 行数 */\r\n rowCount: number\r\n /** 元素格数 */\r\n itemCount: number\r\n /** 最大行数 */\r\n maxRows: number | null\r\n /** 是否有元素被隐藏 */\r\n overflow: boolean\r\n}\r\n\r\nexport interface FlowProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\r\n /** 元素宽度 */\r\n itemWidth: number\r\n /** 元素高度 */\r\n itemHeight: number\r\n /** 列间距 */\r\n columnGap?: number | null | (number | null)[]\r\n /** 行间距 */\r\n rowGap?: number\r\n /** 最大行数 */\r\n maxRows?: number | null\r\n /** 源数据 */\r\n data: T[]\r\n /** 渲染 */\r\n render: (item: T, index: number, hidden: boolean) => ReactNode\r\n /** key释放器,默认为 index */\r\n keyExactor?: (item: T, index: number) => string | number\r\n /** 容器类名 */\r\n containerClassName?: string\r\n /** 容器样式 */\r\n containerStyle?: CSSProperties\r\n /** 节流时间,单位毫秒,默认200ms,传入 null 不节流 */\r\n throttle?: number | null\r\n /** 动画时间,单位毫秒,默认400ms,传入 null 不展示动画 */\r\n transitionDuration?: number | null\r\n /** 变化的回调函数 */\r\n onSizeChange?: (sizeData: FlowSizeData) => void\r\n}\r\n\r\nexport function getGapRange(gap?: undefined | number | null | (number | null)[]): [number, number | null] {\r\n if (typeof gap === \"number\") return [gap, gap]\r\n if (Array.isArray(gap)) return [gap[0] || 0, gap[1]]\r\n return [0, null]\r\n}\r\n\r\nexport function getGapCountAndSize(width: number, itemWidth: number, minGap: number, maxGap: number | null): [number, number] {\r\n const count = Math.floor((width + minGap) / (itemWidth + minGap)) || 1\r\n if (count === 1) return [count, 0]\r\n const averageGap = (width - itemWidth * count) / (count - 1)\r\n if (averageGap < minGap) return [count, minGap]\r\n if (maxGap !== null && averageGap > maxGap) return [count, maxGap]\r\n return [count, averageGap]\r\n}\r\n\r\n/** 自适应浮动组件 */\r\nexport function Flow<T>(props: FlowProps<T>) {\r\n const { itemWidth, itemHeight, columnGap, rowGap = 0, maxRows, data, render, keyExactor, className, style, containerClassName, containerStyle, throttle, transitionDuration, onSizeChange, ...others } = props\r\n const [minColumnGap, maxColumnGap] = getGapRange(columnGap)\r\n const [width, setWidth] = useState(0)\r\n const [columnCount, setColumnCount] = useState(1)\r\n const [columnGapSize, setColumnGapSize] = useState(minColumnGap)\r\n const [showItems, setShowItems] = useState(false)\r\n const ele = useRef<HTMLDivElement>(null)\r\n const contentRows = Math.ceil(data.length / columnCount)\r\n const contentShownRows = typeof maxRows === \"number\" ? Math.min(contentRows, maxRows) : contentRows\r\n const height = contentShownRows > 0 ? contentShownRows * (itemHeight + rowGap) - rowGap : 0\r\n\r\n interface Position {\r\n left: number\r\n top: number\r\n }\r\n\r\n function getPosition(index: number): Position {\r\n const y = Math.floor(index / columnCount)\r\n const x = index - y * columnCount\r\n return {\r\n left: x * (itemWidth + columnGapSize),\r\n top: y * (itemHeight + rowGap)\r\n }\r\n }\r\n\r\n function getHidden(index: number) {\r\n if (typeof maxRows !== \"number\") return false\r\n return index >= maxRows * columnCount\r\n }\r\n\r\n useEffect(() => {\r\n let timeout: number\r\n const observer = new ResizeObserver(entries => {\r\n clearTimeout(timeout)\r\n function task() {\r\n const { inlineSize: width } = entries[0].borderBoxSize[0]\r\n const [newColumnCount, newColumnGapSize] = getGapCountAndSize(width, itemWidth, minColumnGap, maxColumnGap)\r\n setShowItems(true)\r\n setWidth(width)\r\n setColumnCount(newColumnCount)\r\n setColumnGapSize(newColumnGapSize)\r\n }\r\n if (throttle === null) {\r\n task()\r\n } else {\r\n timeout = window.setTimeout(task, throttle || 200)\r\n }\r\n })\r\n observer.observe(ele.current!)\r\n\r\n return () => {\r\n observer.disconnect()\r\n }\r\n }, [itemWidth, throttle, columnGap])\r\n\r\n useEffect(() => {\r\n onSizeChange?.({ width, height, itemWidth, itemHeight, columnGap: columnGapSize, columnCount, rowGap, rowCount: contentShownRows, overflow: data.length > contentShownRows * columnCount, itemCount: data.length, maxRows: maxRows ?? null })\r\n }, [width, height, columnGapSize, columnCount, rowGap, contentShownRows, data.length, itemWidth, itemHeight, maxRows])\r\n\r\n return (\r\n <div ref={ele} className={className} style={{ position: \"relative\", boxSizing: \"border-box\", height, ...style }} {...others}>\r\n {showItems &&\r\n data.map((it, idx) => (\r\n <div\r\n key={keyExactor?.(it, idx) || idx}\r\n className={containerClassName}\r\n style={{\r\n position: \"absolute\",\r\n width: itemWidth,\r\n height: itemHeight,\r\n transition: transitionDuration !== null ? `all ${transitionDuration ?? 400}ms` : undefined,\r\n ...getPosition(idx)\r\n }}>\r\n <div style={{ width: itemWidth, height: itemHeight, display: maxRows && idx >= maxRows * columnCount ? \"none\" : \"block\", ...containerStyle }}>{render(it, idx, getHidden(idx))}</div>\r\n </div>\r\n ))}\r\n </div>\r\n )\r\n}\r\n\r\nexport interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {\r\n top: number\r\n bottom: number\r\n height: number\r\n borderRadius: number\r\n}\r\n\r\n/** 梯形组件 */\r\nexport const Trapezium = forwardRef<HTMLDivElement, TrapeziumProps>((props, ref) => {\r\n const { top, bottom, height, borderRadius, style, ...other } = props\r\n\r\n const diff = (bottom - top) / 2\r\n\r\n const a = Math.atan(height / diff) / 2\r\n\r\n const b = borderRadius / Math.tan(a)\r\n\r\n const c = b * Math.cos(a * 2)\r\n\r\n const d = b * Math.sin(a * 2)\r\n\r\n const e = Math.PI / 2 - a\r\n\r\n const f = borderRadius / Math.tan(e)\r\n\r\n const g = f * Math.cos(a * 2)\r\n\r\n const h = f * Math.sin(a * 2)\r\n\r\n return <div ref={ref} style={{ width: bottom, height, clipPath: `path(\"M ${diff + f} ${0} A ${borderRadius} ${borderRadius} 0 0 0 ${diff - g} ${h} L ${c} ${height - d} A ${borderRadius} ${borderRadius} 0 0 0 ${b} ${height} L ${bottom - b} ${height} A ${borderRadius} ${borderRadius} 0 0 0 ${bottom - c} ${height - d} L ${top + diff + g} ${h} A ${borderRadius} ${borderRadius} 0 0 0 ${top + diff - f} ${0} Z\")`, ...style }} {...other} />\r\n})\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\ncss`\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\r\n/** 循环播放组件 */\r\nexport const LoopSwiper = forwardRef<HTMLDivElement, LoopSwiperProps>((props, ref) => {\r\n const { style, children, direction, period, reverse, gap, ...others } = 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 ref={wrapper} style={{ display: \"flex\", flexDirection, gap, ...style }} {...others}>\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\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, ...others } = 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 {...others}\r\n />\r\n )\r\n}\r\n\r\nexport interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\r\n /** 当前数字 */\r\n children: number\r\n /** 变换周期,单位帧 */\r\n period: number\r\n /** 数字转换为字符串的方法 */\r\n numToStr?: (num: number) => string\r\n}\r\n\r\nexport interface TransitionNumIns {\r\n get(): number\r\n}\r\n\r\n/** 渐变数字组件 */\r\nexport const TransitionNum = forwardRef<TransitionNumIns, TransitionNumProps>((props, ref) => {\r\n const { children: num, period, numToStr, ...others } = props\r\n if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) {\r\n throw new RangeError(\"目标数字必须是整数,周期必须是正整数\")\r\n }\r\n const ele = useRef<HTMLDivElement>(null)\r\n const cache = useRef({ num, period, numToStr, show: num })\r\n cache.current = { ...cache.current, num, period, numToStr }\r\n\r\n useImperativeHandle(ref, () => ({ get: () => cache.current.show }), [])\r\n\r\n useEffect(() => {\r\n const { num, period, show, numToStr } = cache.current\r\n ele.current!.innerText = (numToStr || String)(show)\r\n if (num === show) return\r\n const div = ele.current!\r\n const speed = (num - show) / period\r\n const cancel = setFrameInterval(() => {\r\n const { num, numToStr } = cache.current\r\n cache.current.show += speed\r\n if ((speed > 0 && cache.current.show > num) || (speed < 0 && cache.current.show < num)) {\r\n cancel()\r\n cache.current.show = num\r\n }\r\n div.innerText = (numToStr || String)(speed > 0 ? Math.floor(cache.current.show) : Math.ceil(cache.current.show))\r\n }, 1)\r\n\r\n return cancel\r\n }, [num])\r\n\r\n return <div ref={ele} {...others} />\r\n})\r\n\r\nexport interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\"> {\r\n /** 每一个方块的宽度 */\r\n width: number\r\n /** 每一个方块的高度 */\r\n height: number\r\n /** 圆弧的半径,不包含方块的高度 */\r\n radius: number\r\n /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */\r\n startAngel?: number\r\n /** 每一个方块之间间隔的弧度 */\r\n gapAngel?: number\r\n /** 文字对齐的方式,默认居中 */\r\n align?: \"left\" | \"center\" | \"right\"\r\n /** 文字朝向圆心还是外侧,默认外侧 */\r\n direction?: \"inner\" | \"outer\"\r\n /** 是否反转文字顺序 */\r\n reverse?: boolean\r\n /** 分割文字的方法 */\r\n separator?: string | RegExp | ((text: string) => string[])\r\n /** 显示的文字 */\r\n children: string\r\n}\r\n\r\n/** 环形文字 */\r\nexport const CircleText: FC<CircleTextProps> = props => {\r\n const { width, height, radius, startAngel = 0, gapAngel = 0, align = \"center\", style, direction = \"outer\", reverse = false, separator, children, ...others } = props\r\n const unitAngle = Math.atan(width / 2 / radius) * 2\r\n const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel\r\n const offsetAngle = align === \"left\" ? 0 : align === \"right\" ? totalAngle : totalAngle / 2\r\n\r\n function getTransform(idx: number) {\r\n const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2\r\n const x = (radius + height / 2) * Math.cos(angle) - width / 2\r\n const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2\r\n const z = Math.PI / 2 - angle + (direction === \"inner\" ? Math.PI : 0)\r\n return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`\r\n }\r\n\r\n const words = typeof separator === \"function\" ? separator(children) : children.split(separator ?? \"\")\r\n\r\n if (reverse) words.reverse()\r\n\r\n return (\r\n <Fragment>\r\n {words.map((w, idx) => (\r\n <span key={idx} style={{ position: \"absolute\", ...style, transform: getTransform(idx), textAlign: \"center\", width, lineHeight: `${height}px`, height: height }} {...others}>\r\n {w}\r\n </span>\r\n ))}\r\n </Fragment>\r\n )\r\n}\r\n\r\nexport interface ScrollOptions extends Partial<ScrollbarOptions> {\r\n /** 滑块宽度 */\r\n thumbWidth?: number\r\n}\r\n\r\nexport interface ScrollProps extends HTMLAttributes<HTMLDivElement> {\r\n /** 滚动的配置 */\r\n options?: ScrollOptions\r\n /** 容器宽度 */\r\n containerClassName?: string\r\n /** 容器样式 */\r\n containerStyle?: CSSProperties\r\n}\r\n\r\n/**\r\n * 滚动条组件\r\n * @description 注意 children 不是直接渲染在组件上的,而是渲染在内部的容器上\r\n */\r\nexport const Scroll = forwardRef<HTMLDivElement, ScrollProps>((props, ref) => {\r\n const { children, containerClassName, containerStyle, options, className, ...others } = props\r\n const { thumbWidth, ...scrollbarOptions } = options || {}\r\n const ele = useRef<HTMLDivElement>(null)\r\n\r\n useImperativeHandle(ref, () => ele.current!)\r\n\r\n useEffect(() => {\r\n SmoothScrollBar.init(ele.current!, scrollbarOptions)\r\n }, [])\r\n\r\n return (\r\n <div\r\n ref={ele}\r\n className={clsx(\r\n !!thumbWidth &&\r\n css`\r\n .scrollbar-track.scrollbar-track-x {\r\n height: ${thumbWidth}px;\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-x {\r\n height: ${thumbWidth}px;\r\n }\r\n\r\n .scrollbar-track.scrollbar-track-y {\r\n width: ${thumbWidth}px;\r\n }\r\n\r\n .scrollbar-thumb.scrollbar-thumb-y {\r\n width: ${thumbWidth}px;\r\n }\r\n `,\r\n className\r\n )}\r\n {...others}>\r\n <div className={containerClassName} style={containerStyle}>\r\n {children}\r\n </div>\r\n </div>\r\n )\r\n})\r\n\r\nexport const AutoSizeTextArea = forwardRef<HTMLTextAreaElement, TextareaHTMLAttributes<HTMLTextAreaElement>>((props, ref) => {\r\n const { style = {}, ...others } = props\r\n const { height, resize, overflowY, ...otherStyle } = style\r\n const ele = useRef<HTMLTextAreaElement>(null)\r\n\r\n useImperativeHandle(ref, () => ele.current!)\r\n\r\n useEffect(() => {\r\n const textarea = ele.current!\r\n function resizeTextarea() {\r\n textarea.style.height = \"auto\"\r\n textarea.style.height = `${textarea.scrollHeight + textarea.offsetHeight - textarea.clientHeight}px`\r\n }\r\n textarea.addEventListener(\"input\", resizeTextarea)\r\n\r\n return () => textarea.removeEventListener(\"input\", resizeTextarea)\r\n }, [])\r\n\r\n return <textarea ref={ele} style={{ ...otherStyle, resize: \"none\", overflowY: \"hidden\" }} {...others} />\r\n})\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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AAA,QAGrB;AAAA,MACJ;AAAA,MACC,GAAG;AAAA;AAAA,IACJ,oCAAC,SAAI,WAAW,oBAAoB,OAAO,kBACtC,QACL;AAAA,EACJ;AAER,CAAC;AAEM,IAAM,uBAAmB,yBAA6E,CAAC,OAAO,QAAQ;AACzH,QAAM,EAAE,QAAQ,CAAC,GAAG,GAAG,OAAO,IAAI;AAClC,QAAM,EAAE,QAAQ,QAAQ,WAAW,GAAG,WAAW,IAAI;AACrD,QAAM,UAAM,qBAA4B,IAAI;AAE5C,wCAAoB,KAAK,MAAM,IAAI,OAAQ;AAE3C,8BAAU,MAAM;AACZ,UAAM,WAAW,IAAI;AACrB,aAAS,iBAAiB;AACtB,eAAS,MAAM,SAAS;AACxB,eAAS,MAAM,SAAS,GAAG,SAAS,eAAe,SAAS,eAAe,SAAS;AAAA,IACxF;AACA,aAAS,iBAAiB,SAAS,cAAc;AAEjD,WAAO,MAAM,SAAS,oBAAoB,SAAS,cAAc;AAAA,EACrE,GAAG,CAAC,CAAC;AAEL,SAAO,oCAAC,cAAS,KAAK,KAAK,OAAO,EAAE,GAAG,YAAY,QAAQ,QAAQ,WAAW,SAAS,GAAI,GAAG,QAAQ;AAC1G,CAAC;",
|
|
6
|
+
"names": ["count", "width", "num", "period", "numToStr", "SmoothScrollBar"]
|
|
7
7
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -180,35 +180,14 @@ export interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
180
180
|
}
|
|
181
181
|
/** 梯形组件 */
|
|
182
182
|
export declare const Trapezium: import("react").ForwardRefExoticComponent<TrapeziumProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
183
|
-
export interface LoopSwiperProps<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
/** 每个元素的key */
|
|
189
|
-
keyExactor?: (item: T, index: number, array: T[]) => string;
|
|
190
|
-
/** 水平方向是宽度,垂直方向是高度 */
|
|
191
|
-
size: number;
|
|
192
|
-
/** 元素之间间隔 */
|
|
193
|
-
gap?: number;
|
|
194
|
-
/** 起始位置 */
|
|
195
|
-
start?: number;
|
|
196
|
-
/** 速度,水平方向正数为向左,水平方向负数为向右,垂直方向正数为向上,水平方向负数为向下 */
|
|
197
|
-
speed: number;
|
|
198
|
-
/** 是否暂停播放 */
|
|
199
|
-
paused?: boolean;
|
|
200
|
-
/** 容器的类名 */
|
|
201
|
-
className?: string;
|
|
202
|
-
/** x 水平方向,y 垂直方向 */
|
|
203
|
-
direction?: "x" | "y";
|
|
204
|
-
}
|
|
205
|
-
export interface LoopSwiperItem {
|
|
206
|
-
key: string;
|
|
207
|
-
dom: HTMLDivElement | null;
|
|
208
|
-
offset: number;
|
|
183
|
+
export interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {
|
|
184
|
+
direction?: "horizontal" | "vertical";
|
|
185
|
+
reverse?: boolean;
|
|
186
|
+
period: number;
|
|
187
|
+
gap?: CSSProperties["gap"];
|
|
209
188
|
}
|
|
210
189
|
/** 循环播放组件 */
|
|
211
|
-
export declare
|
|
190
|
+
export declare const LoopSwiper: import("react").ForwardRefExoticComponent<LoopSwiperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
212
191
|
export interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {
|
|
213
192
|
outerRadius: number;
|
|
214
193
|
innerRadius: number;
|